From 46cc9c721a85bfa2e934a292b8945fc24da7ebdc Mon Sep 17 00:00:00 2001 From: viglino Date: Tue, 22 Aug 2023 08:48:43 +0200 Subject: [PATCH] [BUILD] --- dist/ol-ext.js | 25 +++++++++++++++++++++---- dist/ol-ext.min.js | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/dist/ol-ext.js b/dist/ol-ext.js index 676a3a51..13701794 100644 --- a/dist/ol-ext.js +++ b/dist/ol-ext.js @@ -17946,7 +17946,7 @@ ol.control.VideoRecorder = class olcontrolVideoRecorder extends ol.control.Contr ol.ext.element.create('BUTTON', { type: 'button', className: 'ol-start', - title: 'start', + title: ol.control.VideoRecorder.prototype.tips.start, click: function () { this.start() }.bind(this), @@ -17955,7 +17955,7 @@ ol.control.VideoRecorder = class olcontrolVideoRecorder extends ol.control.Contr ol.ext.element.create('BUTTON', { type: 'button', className: 'ol-stop', - title: 'stop', + title: ol.control.VideoRecorder.prototype.tips.stop, click: function () { this.stop() }.bind(this), @@ -17964,7 +17964,7 @@ ol.control.VideoRecorder = class olcontrolVideoRecorder extends ol.control.Contr ol.ext.element.create('BUTTON', { type: 'button', className: 'ol-pause', - title: 'pause', + title: ol.control.VideoRecorder.prototype.tips.pause, click: function () { this.pause() }.bind(this), @@ -17973,7 +17973,7 @@ ol.control.VideoRecorder = class olcontrolVideoRecorder extends ol.control.Contr ol.ext.element.create('BUTTON', { type: 'button', className: 'ol-resume', - title: 'resume', + title: ol.control.VideoRecorder.prototype.tips.resume, click: function () { this.resume() }.bind(this), @@ -17997,6 +17997,16 @@ ol.control.VideoRecorder = class olcontrolVideoRecorder extends ol.control.Contr target: ol.ext.element.create('DIV') }) } + /** Set button title + * @param {string} button button name (start, stop, pause or resume) + * @param {string} title + */ + setTooltip(button, title) { + var elt = this.element.querySelector('button.ol-'+button) + if (elt) { + elt.title = title; + } + } /** * Remove the control from its current map and attach it to the new map. * Subclasses may set up event handlers to get notified about changes to @@ -18115,6 +18125,13 @@ ol.control.VideoRecorder = class olcontrolVideoRecorder extends ol.control.Contr } } } +/** Default button tips */ +ol.control.VideoRecorder.prototype.tips = { + start: 'start video', + stop: 'stop', + pause: 'pause', + resume: 'resume' +} /* Using WMS Layer with EPSG:4326 projection. diff --git a/dist/ol-ext.min.js b/dist/ol-ext.min.js index d2191116..3d27f7af 100644 --- a/dist/ol-ext.min.js +++ b/dist/ol-ext.min.js @@ -6,4 +6,4 @@ * @see https://github.com/Viglino/ol-ext#, * @license BSD-3-Clause */ -window.ol&&(ol.ext||(ol.ext={}),ol.legend||(ol.legend={}),ol.particule||(ol.particule={}),ol.ext.imageLoader||(ol.ext.imageLoader={}),ol.ext.input||(ol.ext.input={}),ol.util?ol.util.VERSION||(ol.util.VERSION=ol.VERSION||"6.1.0"):ol.util={VERSION:ol.VERSION||"5.3.0"}),ol.ext.inherits=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e},window.ol&&(ol.inherits||(ol.inherits=ol.ext.inherits)),window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),window.Element&&!Element.prototype.remove&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)}),ol.ext.Ajax=class extends ol.Object{constructor(e){e=e||{},super(),this._auth=e.auth,this.set("dataType",e.dataType||"JSON")}static get(e){var t=new ol.ext.Ajax(e);e.success&&t.on("success",function(t){e.success(t.response,t)}),e.error&&t.on("error",function(t){e.error(t)}),t.send(e.url,e.data,e.options)}static getCORS(e,t){var i=new XMLHttpRequest;i.open("GET",e,!0),i.send(),i.onreadystatechange=function(){this.readyState==this.HEADERS_RECEIVED&&t(i.getResponseHeader("Access-Control-Allow-Origin"))}}send(e,t,i){var o=this,s=!1!==(i=i||{}).encode;s&&(e=encodeURI(e));var r="";for(var a in t)t.hasOwnProperty(a)&&void 0!==t[a]&&(r+=(r?"&":"?")+a+"="+(s?encodeURIComponent(t[a]):t[a]));this._request&&!1!==i.abort&&this._request.abort();var n=this._request=new XMLHttpRequest;n.open("GET",e+r,!0),i.timeout&&(n.timeout=i.timeout),this._auth&&n.setRequestHeader("Authorization","Basic "+this._auth),this.dispatchEvent({type:"loadstart"}),n.onload=function(){if(o._request=null,o.dispatchEvent({type:"loadend"}),this.status>=200&&this.status<400){var e;try{switch(o.get("dataType")){case"JSON":e=JSON.parse(this.response);break;default:e=this.response}}catch(e){return void o.dispatchEvent({type:"error",status:0,statusText:"parsererror",error:e,options:i,jqXHR:this})}o.dispatchEvent({type:"success",response:e,status:this.status,statusText:this.statusText,options:i,jqXHR:this})}else o.dispatchEvent({type:"error",status:this.status,statusText:this.statusText,options:i,jqXHR:this})},n.ontimeout=function(){o._request=null,o.dispatchEvent({type:"loadend"}),o.dispatchEvent({type:"error",status:this.status,statusText:"Timeout",options:i,jqXHR:this})},n.onerror=function(){o._request=null,o.dispatchEvent({type:"loadend"}),o.dispatchEvent({type:"error",status:this.status,statusText:this.statusText,options:i,jqXHR:this})},n.send()}},ol.ext.SVGFilter=class extends ol.Object{constructor(e){e=e||{},super(),ol.ext.SVGFilter.prototype.svg||(ol.ext.SVGFilter.prototype.svg=document.createElementNS(this.NS,"svg"),ol.ext.SVGFilter.prototype.svg.setAttribute("version","1.1"),ol.ext.SVGFilter.prototype.svg.setAttribute("width",0),ol.ext.SVGFilter.prototype.svg.setAttribute("height",0),ol.ext.SVGFilter.prototype.svg.style.position="absolute",document.body.appendChild(ol.ext.SVGFilter.prototype.svg)),this.element=document.createElementNS(this.NS,"filter"),this._id=e.id||"_ol_SVGFilter_"+ol.ext.SVGFilter.prototype._id++,this.element.setAttribute("id",this._id),e.color&&this.element.setAttribute("color-interpolation-filters",e.color),e.operation&&this.addOperation(e.operation),ol.ext.SVGFilter.prototype.svg.appendChild(this.element)}getId(){return this._id}remove(){this.element.remove()}addOperation(e){e instanceof Array?e.forEach(function(e){this.addOperation(e)}.bind(this)):(e instanceof ol.ext.SVGOperation||(e=new ol.ext.SVGOperation(e)),this.element.appendChild(e.geElement()))}grayscale(e){this.addOperation({feoperation:"feColorMatrix",type:"saturate",values:e||0})}luminanceToAlpha(e){e=e||{},this.addOperation({feoperation:"feColorMatrix",type:"luminanceToAlpha"}),e.gamma&&this.addOperation({feoperation:"feComponentTransfer",operations:[{feoperation:"feFuncA",type:"gamma",amplitude:e.gamma,exponent:1,offset:0}]})}applyTo(e){var t=document.createElement("CANVAS");return t.width=e.naturalWidth||e.width,t.height=e.naturalHeight||e.height,t.getContext("2d").filter="url(#"+this.getId()+")",t.getContext("2d").drawImage(e,0,0),t}},ol.ext.SVGFilter.prototype.NS="http://www.w3.org/2000/svg",ol.ext.SVGFilter.prototype.svg=null,ol.ext.SVGFilter.prototype._id=0,ol.ext.SVGOperation=class extends ol.Object{constructor(e){"string"==typeof e&&(e={feoperation:e}),super(),e&&e.feoperation?(this._name=e.feoperation,this.element=document.createElementNS(ol.ext.SVGOperation.NS||"http://www.w3.org/2000/svg",this._name),this.setProperties(e),e.operations instanceof Array&&this.appendChild(e.operations)):console.error("[SVGOperation]: no operation defined.")}getName(){return this._name}set(e,t){/^feoperation$|^operations$/.test(e)||(super.set(e,t),this.element.setAttribute(e,t))}setProperties(e){for(var t in e=e||{})this.set(t,e[t])}geElement(){return this.element}appendChild(e){e instanceof Array?e.forEach(function(e){this.appendChild(e)}.bind(this)):(e instanceof ol.ext.SVGOperation||(e=new ol.ext.SVGOperation(e)),this.element.appendChild(e.geElement()))}},ol.ext.TextStreamReader=function(e){e=e||{},this.setChunkSize(e.chunkSize),this.setFile(e.file),this.reader_=new FileReader},ol.ext.TextStreamReader.prototype.setFile=function(e){this.file_=e,this.fileSize_=this.file_.size-1,this.rewind()},ol.ext.TextStreamReader.prototype.rewind=function(){this.chunk_=0,this.residue_=""},ol.ext.TextStreamReader.prototype.setChunkSize=function(e){this.chunkSize_=e||1e6},ol.ext.TextStreamReader.prototype.getProgress=function(){return this.chunk_/this.fileSize_},ol.ext.TextStreamReader.prototype.readLines=function(e,t){this.rewind(),this.readChunk(function(i){for(var o=0;o.5?c/(2-n-l):c/(n+l),n){case s:i=(r-a)/c+(r3&&(u[3]=e[3]),u},ol.color.fromHSL=function(e,t){void 0===t&&(t=1e3);var i,o,s,r=e[0]/360,a=e[1]/100,n=e[2]/100;if(0==a)i=o=s=n;else{var l=function(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e},h=n<.5?n*(1+a):n+a-n*a,c=2*n-h;i=l(c,h,r+1/3),o=l(c,h,r),s=l(c,h,r-1/3)}var u=[Math.round(255*i*t)/t,Math.round(255*o*t)/t,Math.round(255*s*t)/t];return e.length>3&&(u[3]=e[3]),u},ol.color.toHSV=function(e,t){void 0===t&&(t=100),Array.isArray(e)||(e=ol.color.asArray(e));var i,o,s=e[0]/255,r=e[1]/255,a=e[2]/255,n=Math.max(s,r,a),l=Math.min(s,r,a),h=n,c=n-l;if(o=0==n?0:c/n,n==l)i=0;else switch(n){case s:i=(r-a)/c+(r3&&(u[3]=e[3]),u},ol.color.fromHSV=function(e,t){void 0===t&&(t=1e3);var i,o,s,r=e[0]/360,a=e[1]/100,n=e[2]/100,l=Math.floor(6*r),h=6*r-l,c=n*(1-a),u=n*(1-h*a),d=n*(1-(1-h)*a);switch(l%6){case 0:i=n,o=d,s=c;break;case 1:i=u,o=n,s=c;break;case 2:i=c,o=n,s=d;break;case 3:i=c,o=u,s=n;break;case 4:i=d,o=c,s=n;break;case 5:i=n,o=c,s=u}var g=[Math.round(255*i*t)/t,Math.round(255*o*t)/t,Math.round(255*s*t)/t];return e.length>3&&(g[3]=e[3]),g},ol.color.toHexa=function(e){return"#"+((1<<24)+(e[0]<<16)+(e[1]<<8)+e[2]).toString(16).slice(1)},ol.ext.element={},ol.ext.element.create=function(e,t){var i;if(t=t||{},"TEXT"===e)i=document.createTextNode(t.html||""),t.parent&&t.parent.appendChild(i);else for(var o in i=document.createElement(e),/button/i.test(e)&&i.setAttribute("type","button"),t)switch(o){case"className":t.className&&t.className.trim&&i.setAttribute("class",t.className.trim());break;case"text":i.innerText=t.text;break;case"html":t.html instanceof Element?i.appendChild(t.html):void 0!==t.html&&(i.innerHTML=t.html);break;case"parent":t.parent&&t.parent.appendChild(i);break;case"options":if(/select/i.test(e))for(var s in t.options)ol.ext.element.create("OPTION",{html:s,value:t.options[s],parent:i});break;case"style":ol.ext.element.setStyle(i,t.style);break;case"change":case"click":ol.ext.element.addListener(i,o,t[o]);break;case"on":for(var r in t.on)ol.ext.element.addListener(i,r,t.on[r]);break;case"checked":i.checked=!!t.checked;break;default:i.setAttribute(o,t[o])}return i},ol.ext.element.createSwitch=function(e){var t=ol.ext.element.create("INPUT",{type:"checkbox",on:e.on,click:e.click,change:e.change,parent:e.parent}),i=Object.assign({input:t},e||{});return new ol.ext.input.Switch(i),t},ol.ext.element.createCheck=function(e){var t=ol.ext.element.create("INPUT",{name:e.name,type:"radio"===e.type?"radio":"checkbox",on:e.on,parent:e.parent}),i=Object.assign({input:t},e||{});return"radio"===e.type?new ol.ext.input.Radio(i):new ol.ext.input.Checkbox(i),t},ol.ext.element.setHTML=function(e,t){t instanceof Element?e.appendChild(t):void 0!==t&&(e.innerHTML=t)},ol.ext.element.appendText=function(e,t){e.appendChild(document.createTextNode(t||""))},ol.ext.element.addListener=function(e,t,i,o){"string"==typeof t&&(t=t.split(" ")),t.forEach(function(t){e.addEventListener(t,i,o)})},ol.ext.element.removeListener=function(e,t,i){"string"==typeof t&&(t=t.split(" ")),t.forEach(function(t){e.removeEventListener(t,i)})},ol.ext.element.show=function(e){e.style.display=""},ol.ext.element.hide=function(e){e.style.display="none"},ol.ext.element.hidden=function(e){return"none"===ol.ext.element.getStyle(e,"display")},ol.ext.element.toggle=function(e){e.style.display="none"===e.style.display?"":"none"},ol.ext.element.setStyle=function(e,t){for(var i in t)switch(i){case"top":case"left":case"bottom":case"right":case"minWidth":case"maxWidth":case"width":case"height":"number"==typeof t[i]?e.style[i]=t[i]+"px":e.style[i]=t[i];break;default:e.style[i]=t[i]}},ol.ext.element.getStyle=function(e,t){var i,o=(e.ownerDocument||document).defaultView;if(o&&o.getComputedStyle)t=t.replace(/([A-Z])/g,"-$1").toLowerCase(),i=o.getComputedStyle(e,null).getPropertyValue(t);else if(e.currentStyle&&(t=t.replace(/-(\w)/g,function(e,t){return t.toUpperCase()}),i=e.currentStyle[t],/^\d+(em|pt|%|ex)?$/i.test(i)))return function(t){var i=e.style.left,o=e.runtimeStyle.left;return e.runtimeStyle.left=e.currentStyle.left,e.style.left=t||0,t=e.style.pixelLeft+"px",e.style.left=i,e.runtimeStyle.left=o,t}(i);return/px$/.test(i)?parseInt(i):i},ol.ext.element.outerHeight=function(e){return e.offsetHeight+ol.ext.element.getStyle(e,"marginBottom")},ol.ext.element.outerWidth=function(e){return e.offsetWidth+ol.ext.element.getStyle(e,"marginLeft")},ol.ext.element.offsetRect=function(e){var t=e.getBoundingClientRect();return{top:t.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),left:t.left+(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0),height:t.height||t.bottom-t.top,width:t.width||t.right-t.left}},ol.ext.element.getFixedOffset=function(e){var t={left:0,top:0},i=function(e){if(!e)return t;if("absolute"===ol.ext.element.getStyle(e,"position")&&"none"!==ol.ext.element.getStyle(e,"transform")){var o=e.getBoundingClientRect();return t.left+=o.left,t.top+=o.top,t}return i(e.offsetParent)};return i(e.offsetParent)},ol.ext.element.positionRect=function(e,t){var i=0,o=0,s=function(r){if(r)return i+=r.offsetLeft,o+=r.offsetTop,s(r.offsetParent);var a={top:e.offsetTop+o,left:e.offsetLeft+i};return t&&(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+e.offsetHeight,a.right=a.top+e.offsetWidth,a};return s(e.offsetParent)},ol.ext.element.scrollDiv=function(e,t){var i,o,s,r,a,n=!1,l=0,h=0,c="function"==typeof(t=t||{}).onmove?t.onmove:function(){},u=t.vertical?"screenY":"screenX",d=t.vertical?"scrollTop":"scrollLeft",g=!1,p=0,m=function(){a&&(p++,setTimeout(f))},f=function(){if(a){if(--p)return;var t=e.clientHeight,i=e.scrollHeight;o=t/i,a.style.height=100*o+"%",a.style.top=e.scrollTop/i*100+"%",r.style.height=t+"px",t>i-.5?r.classList.add("ol-100pc"):r.classList.remove("ol-100pc")}},v=function(t){t.target.classList.contains("ol-noscroll")||(g=!1,n=t[u],h=new Date,e.classList.add("ol-move"),t.preventDefault(),window.addEventListener("pointermove",y),ol.ext.element.addListener(window,["pointerup","pointercancel"],b))},y=function(t){if(!1!==n){var r=(s?-1/o:1)*(n-t[u]);g=g||Math.round(r),e[d]+=r,(i=new Date)-h&&(l=(l+r/(i-h))/2),n=t[u],h=i,r&&c(!0)}else g=!0},_=function(t){var i=t>0?Math.min(100,t/2):Math.max(-100,t/2);t-=i,e[d]+=i,-1100||s?l=0:h>0&&(l=((l||0)+(n-i[u])/h)/2),_(!1===t.animate?0:200*l),n=!1,l=0,h=0,e.classList.contains("ol-move")?e.classList.remove("ol-hasClick"):(e.classList.add("ol-hasClick"),setTimeout(function(){e.classList.remove("ol-hasClick")},500)),s=!1,window.removeEventListener("pointermove",y),ol.ext.element.removeListener(window,["pointerup","pointercancel"],b)},w=function(t){var i=Math.max(-1,Math.min(1,t.wheelDelta||-t.detail));return e.classList.add("ol-move"),e[d]-=30*i,e.classList.remove("ol-move"),!1};return t.mousewheel&&ol.ext.element.addListener(e,["mousewheel","DOMMouseScroll","onmousewheel"],w),{refresh:m}},ol.ext.element.dispatchEvent=function(e,t){var i;try{i=new CustomEvent(e)}catch(t){(i=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,{})}t.dispatchEvent(i)},ol.ext.getMapCanvas=function(e){if(!e)return null;var t=e.getViewport().getElementsByClassName("ol-fixedoverlay")[0];return t||(e.getViewport().querySelector(".ol-layers")?((t=document.createElement("canvas")).className="ol-fixedoverlay",e.getViewport().querySelector(".ol-layers").after(t),e.on("precompose",function(i){t.width=e.getSize()[0]*i.frameState.pixelRatio,t.height=e.getSize()[1]*i.frameState.pixelRatio})):t=e.getViewport().querySelector("canvas")),t},ol.ext.olVersion=ol.util.VERSION.split("."),ol.ext.olVersion=100*parseInt(ol.ext.olVersion[0])+parseInt(ol.ext.olVersion[1]),ol.ext.getVectorContextStyle=function(e,t){var i=e.frameState.pixelRatio;if(ol.ext.olVersion>605&&1!==i&&t.getImage()instanceof ol.style.Icon){var o=(t=t.clone()).getImage();o.setScale(o.getScale()*i);var s=o.getAnchor();if(s&&o.setDisplacement){var r=o.getDisplacement();r&&(r[0]-=s[0]/i,r[1]+=s[1]/i,o.setAnchor([0,0]))}else s&&(s[0]/=i,s[1]/=i)}return t},ol.ext.imageLoader.loadBILImage=function(e,t,i){var o=[parseInt(e.replace(/.*WIDTH=(\d*).*/i,"$1")),parseInt(e.replace(/.*HEIGHT=(\d*).*/i,"$1"))],s=new XMLHttpRequest;s.responseType="blob",s.addEventListener("loadend",function(){var e=this.response;if(void 0!==e){var s=new FileReader;s.addEventListener("loadend",e=>{var i=new Float32Array(e.target.result);t(i,o)}),s.readAsArrayBuffer(e)}else i()}),s.addEventListener("error",function(){i()}),s.open("GET",e),s.send()},ol.ext.imageLoader.loadImage=function(e,t,i){var o=new XMLHttpRequest;o.responseType="blob",o.addEventListener("loadend",function(){var e=this.response;if(void 0!==e){var o=new Image;o.onload=function(){t(o,[o.naturalWidth,o.naturalHeight])},o.src=URL.createObjectURL(e)}else i()}),o.addEventListener("error",function(){i()}),o.open("GET",e),o.send()},ol.ext.imageLoader.pixelTransform=function(e){return function(t,i){ol.ext.imageLoader.loadImage(i,function(i,o){var s=document.createElement("canvas");s.width=o[0],s.height=o[1];var r=s.getContext("2d");r.drawImage(i,0,0);for(var a=r.getImageData(0,0,o[0],o[1]),n=a.data,l=0;l>>3)})},ol.ext.imageLoader.transparent=function(e){var t,i;e instanceof Array&&(t=e[0],i=e[1]);var o=t=ol.color.asArray(t);return i?(i=ol.color.asArray(i),o=[Math.min(t[0],i[0]),Math.min(t[1],i[1]),Math.min(t[2],i[2])],i=[Math.max(t[0],i[0]),Math.max(t[1],i[1]),Math.max(t[2],i[2])],ol.ext.imageLoader.pixelTransform(function(e,s){e[s]>=t[0]&&e[s]<=i[0]&&e[s+1]>=o[1]&&e[s+1]<=i[1]&&e[s+2]>=o[2]&&e[s+2]<=i[2]&&(e[s+3]=0)})):ol.ext.imageLoader.pixelTransform(function(e,t){e[t]===o[0]&&e[t+1]===o[1]&&e[t+2]===o[2]&&(e[t+3]=0)})},ol.ext.imageLoader.seaLevelMap=function(e,t){t=t||{};var i=Math.max(e+.01,.01),o=t.color?ol.color.asArray(t.color):[135,203,249],s="number"==typeof t.minValue?t.minValue:-1/0,r=!1!==t.opacity;return ol.ext.imageLoader.elevationMap(function(e){return es?[o[0],o[1],o[2],r?255*(i-e)/i:255]:[0,0,0,0]})},ol.ext.imageLoader.shadedRelief=function(){var e=Math.PI/4,t=2*Math.PI-Math.PI/4;return function(i,o){ol.ext.imageLoader.loadBILImage(o,function(o,s){var r=document.createElement("canvas"),a=r.getContext("2d"),n=r.width=s[0],l=r.height=s[1],h=a.getImageData(0,0,n,l),c=h.data;function u(e,t){return e+t*n}for(var d=0;d0?b>0?M=S+1.5*Math.PI:b<0?M=1.5*Math.PI-S:S=1.5*Math.PI:x<0?M=b<0?S+.5*Math.PI:b>0?.5*Math.PI-S:.5*Math.PI:b<0?M=Math.PI:b>0&&(M=0);var C=Math.cos(M-t)*Math.cos(.5*Math.PI-Math.atan(w))*Math.cos(e)+Math.sin(.5*Math.PI-Math.atan(w))*Math.sin(e);C<0&&(C=0),C=Math.sqrt(.8*C+.5);var E=4*u(d,g);c[E]=c[E+1]=c[E+2]=0,c[E+3]=255-255*C}a.putImageData(h,0,0),i.setImage(r)},function(){i.setState(3)})}},ol.ext.imageLoader.elevationMap=function(e){return"function"!=typeof e&&(e=ol.ext.getPixelFromElevation),function(t,i){ol.ext.imageLoader.loadBILImage(i,function(i,o){var s=document.createElement("canvas"),r=s.getContext("2d");s.width=o[0],s.height=o[1];for(var a=r.getImageData(0,0,o[0],o[1]),n=a.data,l=0;l>16,t%65536>>8,t%256,255]},ol.ext.getElevationFromPixel=function(e){return.01*((e[0]<<16)+(e[1]<<8)+e[2])-12e3},ol.matrix3D={},ol.matrix3D.getTransform=function(e){var t,i,o=window.getComputedStyle(e,null),s=(o.getPropertyValue("-webkit-transform")||o.getPropertyValue("-moz-transform")||o.getPropertyValue("-ms-transform")||o.getPropertyValue("-o-transform")||o.getPropertyValue("transform")).split("(")[1].split(")")[0].split(","),r=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];if(16===s.length)for(t=0;t<4;++t)for(i=0;i<4;++i)r[i][t]=+s[4*t+i];else for(t=0;t<3;++t)for(i=0;i<2;++i)r[i][t]=+s[2*t+i];return r},ol.matrix3D.getTransformOrigin=function(e){for(var t=window.getComputedStyle(e,null),i=(t.getPropertyValue("-webkit-transform-origin")||t.getPropertyValue("-moz-transform-origin")||t.getPropertyValue("-ms-transform-origin")||t.getPropertyValue("-o-transform-origin")||t.getPropertyValue("transform-origin")).split(" "),o=[0,0,0,1],s=0;sdocument.documentElement.clientHeight?this._elt.popup.style.top=Math.max(document.documentElement.clientHeight-this._elt.popup.offsetHeight-i.top,0)+"px":this._elt.popup.style.top=t.bottom+"px",t.left+this._elt.popup.offsetWidth+i.left>document.documentElement.clientWidth?this._elt.popup.style.left=Math.max(document.documentElement.clientWidth-this._elt.popup.offsetWidth-i.left,0)+"px":this._elt.popup.style.left=t.left+"px"}}isCollapsed(){return!this._elt.popup.classList.contains("ol-visible")}toggle(){this.collapse(!this.isCollapsed())}},ol.ext.input.Checkbox=class extends ol.ext.input.Base{constructor(e){super(e=e||{});var t=this.element=document.createElement("LABEL");e.html instanceof Element?t.appendChild(e.html):void 0!==e.html&&(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}},ol.ext.input.Collection=class extends ol.Object{constructor(e){super(),this.element=ol.ext.element.create("UL",{className:("ol-collection-list "+(e.className||"")).trim(),parent:e.target}),this._title="function"==typeof e.getTitle?e.getTitle:function(e){return e.title},this.setCollection(e.collection)}removeCollection(){this.collection&&(this.collection.un("change:length",this._update),this.collection=null)}setCollection(e){this.removeCollection(),this.collection=e,this.refresh(),this.collection&&(this._update=function(){if(!this._reorder){this.refresh();var e=this.getSelectPosition();e<0?this.dispatchEvent({type:"item:select",position:-1,item:null}):this.dispatchEvent({type:"item:order",position:e,item:this._currentItem})}}.bind(this),this.collection.on("change:length",this._update))}select(e){if(e!==this._currentItem){var t=-1;this._listElt.forEach(function(i,o){i.item!==e?i.li.classList.remove("ol-select"):(i.li.classList.add("ol-select"),t=o)}),this._currentItem=t>=0?e:null,this.dispatchEvent({type:"item:select",position:t,item:this._currentItem})}}selectAt(e){this.select(this.collection.item(e))}getSelect(){return this._currentItem}getSelectPosition(){return this.collection?this.collection.getArray().indexOf(this._currentItem):-1}refresh(){this.element.innerHTML="",this._listElt=[],this.collection&&this.collection.forEach((e,t)=>{var i=ol.ext.element.create("LI",{html:this._title(e),className:this._currentItem===e?"ol-select":"","data-position":t,on:{click:function(){this.select(e)}.bind(this),dblclick:function(){this.dispatchEvent({type:"item:dblclick",position:t,item:e})}.bind(this)},parent:this.element});this._listElt.push({li:i,item:e});var o=ol.ext.element.create("DIV",{className:"ol-noscroll ol-order",parent:i}),s=t,r=function(e){for(var t="touch"===e.pointerType?document.elementFromPoint(e.clientX,e.clientY):e.target;t&&t.parentNode!==this.element;)t=t.parentNode;if(t&&t!==i){var o=parseInt(t.getAttribute("data-position"));t.getAttribute("data-position")t?s-1:s,e),this._reorder=!1,this.dispatchEvent({type:"item:order",position:s>t?s-1:s,oldPosition:t,item:e}),this.refresh())}.bind(this);o.addEventListener("pointerdown",function(){this.select(e),document.addEventListener("pointermove",r),document.addEventListener("pointerup",a),document.addEventListener("pointercancel",a)}.bind(this))})}},ol.ext.input.Color=class extends ol.ext.input.PopupBase{constructor(e){(e=e||{}).hidden=!1!==e.hidden,e.className=("ol-ext-colorpicker "+(e.hastab?"ol-tab ":"")+(e.className||"")).trim(),super(e),!1===e.opacity&&this.element.classList.add("ol-nopacity"),this._cursor={};var t=this._hsv={};this._elt.vignet=ol.ext.element.create("DIV",{className:"ol-vignet",parent:this.element});var i=ol.ext.element.create("DIV",{className:"ol-tabbar",parent:this._elt.popup});ol.ext.element.create("DIV",{className:"ol-tab",html:e.paletteLabel||"palette",click:function(){this.element.classList.remove("ol-picker-tab")}.bind(this),parent:i}),ol.ext.element.create("DIV",{className:"ol-tab",html:e.pickerLabel||"picker",click:function(){this.element.classList.add("ol-picker-tab")}.bind(this),parent:i});var o=ol.ext.element.create("DIV",{className:"ol-container",parent:this._elt.popup}),s=this._elt.picker=ol.ext.element.create("DIV",{className:"ol-picker",parent:o}),r=this._cursor.picker=ol.ext.element.create("DIV",{className:"ol-cursor",parent:s});this._listenDrag(s,function(e){var i=Math.max(0,Math.min(e.offsetX/s.clientWidth,1)),o=Math.max(0,Math.min(e.offsetY/s.clientHeight,1));r.style.left=Math.round(100*i)+"%",r.style.top=Math.round(100*o)+"%",t.s=100*i,t.v=100-100*o,this.setColor()}.bind(this));var a=ol.ext.element.create("DIV",{className:"ol-slider",parent:o});this._elt.slider=ol.ext.element.create("DIV",{parent:a});var n=this._cursor.slide=ol.ext.element.create("DIV",{className:"ol-cursor",parent:a});this._listenDrag(a,function(e){var i=Math.max(0,Math.min(e.offsetX/a.clientWidth,1));t.a=100*i,n.style.left=Math.round(100*i)+"%",this.setColor()}.bind(this));var l=ol.ext.element.create("DIV",{className:"ol-tint",parent:o}),h=this._cursor.tint=ol.ext.element.create("DIV",{className:"ol-cursor",parent:l});this._listenDrag(l,function(e){var i=Math.max(0,Math.min(e.offsetY/l.clientHeight,1));t.h=360*i,h.style.top=Math.round(100*i)+"%",this.setColor()}.bind(this)),ol.ext.element.create("DIV",{className:"ol-clear",click:function(){this.setColor([0,0,0,0])}.bind(this),parent:o});var c,u=ol.ext.element.create("DIV",{className:"ol-rgb",parent:o}),d=function(){var e=Math.max(0,Math.min(255,parseInt(this._elt.r.value))),t=Math.max(0,Math.min(255,parseInt(this._elt.g.value))),i=Math.max(0,Math.min(255,parseInt(this._elt.b.value))),o=Math.max(0,Math.min(1,parseFloat(this._elt.a.value)));this.setColor([e,t,i,o])}.bind(this);for(this._elt.r=ol.ext.element.create("INPUT",{type:"number",lang:"en-GB",change:d,min:0,max:255,parent:u}),this._elt.g=ol.ext.element.create("INPUT",{type:"number",lang:"en-GB",change:d,min:0,max:255,parent:u}),this._elt.b=ol.ext.element.create("INPUT",{type:"number",lang:"en-GB",change:d,min:0,max:255,parent:u}),this._elt.a=ol.ext.element.create("INPUT",{type:"number",lang:"en-GB",change:d,min:0,max:1,step:.1,parent:u}),this._elt.txtColor=ol.ext.element.create("INPUT",{type:"text",className:"ol-txt-color",change:function(){var e;this._elt.txtColor.classList.remove("ol-error");try{e=ol.color.asArray(this._elt.txtColor.value)}catch(e){this._elt.txtColor.classList.add("ol-error")}e&&this.setColor(e)}.bind(this),parent:o}),ol.ext.element.create("BUTTON",{html:"OK",click:function(){this._addCustomColor(this.getColor()),this.collapse(!0)}.bind(this),parent:o}),this._paletteColor={},this._elt.palette=ol.ext.element.create("DIV",{className:"ol-palette",parent:this._elt.popup}),c=0;c<8;c++){var g=Math.round(255-255*c/7);this.addPaletteColor([g,g,g],g)}var p=["#f00","#f90","#ff0","#0f0","#0ff","#48e","#00f","#f0f"];for(p.forEach(function(e){this.addPaletteColor(e,ol.color.toHexa(ol.color.asArray(e)))}.bind(this)),c=0;c<5;c++)p.forEach(function(e){e=[(e=ol.color.toHSV(ol.color.asArray(e)))[0],c/4*80+20,100-c/4*60],e=ol.color.fromHSV(e,1),this.addPaletteColor(e,ol.color.toHexa(e))}.bind(this));(ol.ext.element.create("HR",{parent:this._elt.palette}),ol.ext.input.Color.customColorList)||(ol.ext.input.Color.customColorList=new ol.Collection,JSON.parse(localStorage.getItem("ol-ext@colorpicker")||"[]").forEach(function(e){ol.ext.input.Color.customColorList.push(e)}),ol.ext.input.Color.customColorList.on(["add","remove"],function(){localStorage.setItem("ol-ext@colorpicker",JSON.stringify(ol.ext.input.Color.customColorList.getArray()))}));ol.ext.input.Color.customColorList.on("add",function(e){this.addPaletteColor(this.getColorFromID(e.element))}.bind(this)),ol.ext.input.Color.customColorList.on("remove",function(e){this._paletteColor[e.element]&&this._paletteColor[e.element].element.remove(),delete this._paletteColor[e.element]}.bind(this)),ol.ext.input.Color.customColorList.forEach(function(e){this._addCustomColor(this.getColorFromID(e))}.bind(this)),this.setColor(e.color||[0,0,0,0]),this._currentColor=this.getColorID(this.getColor()),this.on("color",function(){this._addCustomColor(this.getColor()),this._currentColor=this.getColorID(this.getColor()),this.setColor()}.bind(this)),this.on("collapse",function(e){if(e.visible)this._currentColor=this.getColorID(this.getColor());else{var t=this.getColor();this._currentColor!==this.getColorID(t)&&this.dispatchEvent({type:"color",color:t})}}.bind(this))}addPaletteColor(e,t,i){try{e=ol.color.asArray(e)}catch(e){return}var o=this.getColorID(e);!this._paletteColor[o]&&e[3]&&(this._paletteColor[o]={color:e,element:ol.ext.element.create("DIV",{title:t||"",className:e[3]<1?"ol-alpha":"",style:{color:"rgb("+e.join(",")+")"},click:function(){this.setColor(e),this.get("autoClose")&&this.collapse(!0)}.bind(this),parent:this._elt.palette})}),i&&this._selectPalette(e)}showTab(e){"palette"===e?this.element.classList.remove("ol-picker-tab"):this.element.classList.add("ol-picker-tab")}getTab(){return this.element.classList.contains("ol-picker-tab")?"picker":"palette"}_selectPalette(e){var t=this.getColorID(e);Object.keys(this._paletteColor).forEach(function(e){this._paletteColor[e].element.classList.remove("ol-select")}.bind(this)),this._paletteColor[t]&&this._paletteColor[t].element.classList.add("ol-select")}setColor(e){var t=this._hsv;if(e){e=ol.color.asArray(e);var i=ol.color.toHSV(e);t.h=i[0],t.s=i[1],t.v=i[2],i.length>3?t.a=100*i[3]:t.a=100,this._cursor.picker.style.left=t.s+"%",this._cursor.picker.style.top=100-t.v+"%",this._cursor.tint.style.top=t.h/360*100+"%",this._cursor.slide.style.left=t.a+"%",this.isCollapsed()&&this.dispatchEvent({type:"color",color:e})}else t.a=Math.round(t.a),e=this.getColor();var o="rgba("+e.join(", ")+")";this._elt.picker.style.color="hsl("+t.h+", 100%, 50%)",this._elt.slider.style.backgroundImage="linear-gradient(45deg, transparent, rgba("+this.getColor(!1).join(",")+"))",this._elt.vignet.style.color=o,this._elt.r.value=e[0],this._elt.g.value=e[1],this._elt.b.value=e[2],this._elt.a.value=e[3],this._elt.txtColor.classList.remove("ol-error"),1===e[3]?this._elt.txtColor.value=ol.color.toHexa(e):this._elt.txtColor.value=o,this._selectPalette(e),this.input.value!==o&&(this.input.value=o,this.input.dispatchEvent(new Event("change")))}getColor(e){return ol.color.fromHSV([this._hsv.h,this._hsv.s,this._hsv.v,!1!==e?this._hsv.a/100:1],1)}_addCustomColor(e){var t=this.getColorID(e);this._paletteColor[t]||e[3]&&(ol.ext.input.Color.customColorList.getArray().indexOf(t)<0&&(ol.ext.input.Color.customColorList.push(t),ol.ext.input.Color.customColorList.getLength()>24&&ol.ext.input.Color.customColorList.removeAt(0)),this.addPaletteColor(e))}clearCustomColor(){ol.ext.input.Color.customColorList.clear()}getColorID(e){return void 0===(e=ol.color.asArray(e))[3]&&(e[3]=1),e.join("-")}getColorFromID(e){var t=e.split("-");return[parseFloat(t[0]),parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])]}},ol.ext.input.Color.customColorList=null,ol.ext.input.List=class extends ol.ext.input.Base{constructor(e){switch(super(e=e||{}),this._content=ol.ext.element.create("DIV"),(e.hidden||e.disabled)&&(e.hover=!0),this.element=ol.ext.element.create("DIV",{html:this._content,className:"ol-input-popup"+(e.hover?" ol-hover":"")}),this.set("hideOnClick",!1!==e.hideOnClick),e.className&&this.element.classList.add(e.className),e.fixed&&(this.element.classList.add("ol-fixed"),this.set("hideOnClick",!1)),e.align){case"middle":this.set("hideOnClick",!1);case"rigth":this.element.classList.add("ol-"+e.align)}var t=this.input;t.parentNode&&t.parentNode.insertBefore(this.element,t),this.element.appendChild(t);var i=this.popup=ol.ext.element.create("UL",{className:"ol-popup",parent:this.element}),o=[];e.options.forEach(e=>{o.push({value:e.value,element:ol.ext.element.create("LI",{html:e.html,title:e.title||e.value,className:"ol-option",on:{pointerdown:function(){this.setValue(e.value),this.get("hideOnClick")&&(i.style.display="none",setTimeout(function(){i.style.display=""},200))}.bind(this)},parent:this.popup})})}),this.input.addEventListener("change",function(){var e,t=this.input.value;o.forEach(function(i){i.value==t?(i.element.classList.add("ol-selected"),e=i.element):i.element.classList.remove("ol-selected")}),this.dispatchEvent({type:"change:value",value:this.getValue()}),this._content.innerHTML=e?e.innerHTML:""}.bind(this));var s=new Event("change");setTimeout(function(){this.input.dispatchEvent(s)}.bind(this))}},ol.ext.input.Radio=class extends ol.ext.input.Checkbox{constructor(e){super(e=e||{}),this.element.className=("ol-ext-check ol-ext-radio "+(e.className||"")).trim()}},ol.ext.input.Range=class extends ol.ext.input.Base{constructor(e){super(e=e||{}),this.set("overflow",!!e.overflow),this.element=ol.ext.element.create("DIV",{className:"ol-input-slider ol-input-range"+(e.className?" "+e.className:"")});var t=this.input;t.parentNode&&t.parentNode.insertBefore(this.element,t),this.element.appendChild(t);var i=this.slider=ol.ext.element.create("DIV",{className:"ol-slider",parent:this.element}),o=ol.ext.element.create("DIV",{className:"ol-back",parent:this.slider}),s=this.input2=e.input2;s&&this.element.appendChild(s);var r=ol.ext.element.create("DIV",{className:"ol-cursor",parent:i}),a=ol.ext.element.create("DIV",{className:"ol-cursor",parent:s?i:void 0}),n=r;function l(e){n=e.target}r.addEventListener("mousedown",l,!1),r.addEventListener("touchstart",l,!1),a.addEventListener("mousedown",l,!1),a.addEventListener("touchstart",l,!1);var h=void 0!==e.min?e.min:parseFloat(t.min)||0,c=void 0!==e.max?e.max:parseFloat(t.max)||1,u=1/(void 0!==e.step?e.step:parseFloat(t.step)||1);function d(){if(s){var e=parseFloat(r.style.left)||0,t=parseFloat(a.style.left)||0;o.style.left=Math.min(e,t)+"%",o.style.right=100-Math.max(e,t)+"%"}else o.style.left=0,o.style.right=(100-parseFloat(r.style.left)||0)+"%"}function g(){if(s&&parseFloat(t.value)>parseFloat(s.value)){var e=t.value;t.value=s.value,s.value=e,p({target:t}),s&&p({target:s})}}this._listenDrag(i,function(e){var o=n===r?t:s,a=Math.max(0,Math.min(e.offsetX/i.clientWidth,1));n.style.left=Math.max(0,Math.min(100,Math.round(100*a)))+"%";var l=o.value=Math.round((a*(c-h)+h)*u)/u;d(),this.dispatchEvent({type:"change:value",value:l}),"pointerup"===e.type&&g()}.bind(this));var p=function(e){var i=e.target,o=i===t?r:a,s=parseFloat(i.value)||0;this.get("overflow")||(s=Math.max(h,Math.min(c,s))),s!=i.value&&(i.value=s);var n=(s-h)/(c-h);o.style.left=Math.max(0,Math.min(100,Math.round(100*n)))+"%",d(),this.dispatchEvent({type:"change:value",value:s}),g()}.bind(this);t.addEventListener("change",p),s&&s.addEventListener("change",p),p({target:t}),s&&p({target:s})}setValue2(e){this.input2&&(void 0!==e&&(this.input2.value=e),this.input2.dispatchEvent(new Event("change")))}getValue2(){return this.input2?this.input2.value:null}getMin(){return Math.min(parseFloat(this.getValue()),parseFloat(this.getValue2()))}getMax(){return Math.max(parseFloat(this.getValue()),parseFloat(this.getValue2()))}},ol.ext.input.Size=class extends ol.ext.input.List{constructor(e){(e=e||{}).options=[],(e.size||[0,2,3,5,8,13,21,34,55]).forEach(function(t){e.options.push({value:t,html:ol.ext.element.create("DIV",{className:"ol-option-"+t,style:{fontSize:t?t+"px":void 0}})})}),super(e),this._content.remove(),this.element.classList.add("ol-size")}getValue(){return parseFloat(super.getValue())}},ol.ext.input.Switch=class extends ol.ext.input.Checkbox{constructor(e){super(e=e||{}),this.element.className=("ol-ext-toggle-switch "+(e.className||"")).trim()}},ol.ext.input.Width=class extends ol.ext.input.List{constructor(e){(e=e||{}).options=[],(e.size||[0,1,2,3,5,10,15,20]).forEach(function(t){e.options.push({value:t,html:ol.ext.element.create("DIV",{className:"ol-option-"+t,style:{height:t||void 0}})})}),super(e),this._content.remove(),this.element.classList.add("ol-width")}getValue(){return parseFloat(super.getValue())}},ol.legend.Legend=class extends ol.Object{constructor(e){super(),e=e||{},this._items=new ol.Collection;var t,i=[];this._items.on("add",function(e){i.push({item:e.element,on:e.element.on("change",function(){this.refresh()}.bind(this))}),t&&(clearTimeout(t),t=null),t=setTimeout(function(){this.refresh()}.bind(this),0)}.bind(this)),this._items.on("remove",function(e){for(var o=0;o":return o>t.val;case">=":return o>=t.val;case"contain":return new RegExp(this._escape(t.val),i?"":"i").test(o);case"!contain":return!new RegExp(this._escape(t.val),i?"":"i").test(o);case"regexp":return new RegExp(t.val,i?"":"i").test(o);case"!regexp":return!new RegExp(t.val,i?"":"i").test(o);default:return!1}}_selectFeatures(e,t,i,o,s){var r;i=i||[];for(var a=t.length-1;r=t[a];a--){for(var n,l=o,h=0;n=i[h];h++)n.attr&&(l=o?l&&this._checkCondition(r,n,s):l||this._checkCondition(r,n,s));l?e.push(r):this._features&&this._features.removeAt(a)}return e}getSources(){if(this.get("source"))return this.get("source");var e=[];return this.getMap()&&function t(i){i.forEach(function(i){i.getLayers?t(i.getLayers()):i.getSource&&i.getSource()instanceof ol.source.Vector&&e.push(i.getSource())})}(this.getMap().getLayers()),e}doSelect(e){var t=[];if((e=e||{}).features)this._selectFeatures(t,e.features,e.conditions,e.matchAll,e.useCase);else if(this._features)this._selectFeatures(t,this._features.getArray(),e.conditions,e.matchAll,e.useCase);else{(e.sources||this.getSources()).forEach(function(i){this._selectFeatures(t,i.getFeatures(),e.conditions,e.matchAll,e.useCase)}.bind(this))}return this.dispatchEvent({type:"select",features:t}),t}},ol.control.SelectBase.prototype.operationsList={"=":"=","!=":"≠","<":"<","<=":"≤",">=":"≥",">":">",contain:"⊂","!contain":"⊄",regexp:"≃","!regexp":"≄"},ol.control.Button=class extends ol.control.Control{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,o=this.button_=document.createElement(/ol-text-button/.test(e.className)?"div":"button");o.type="button",e.title&&(o.title=e.title),e.name&&(o.name=e.name),e.html instanceof Element?o.appendChild(e.html):o.innerHTML=e.html||"";o.addEventListener("click",function(t){t&&t.preventDefault&&(t.preventDefault(),t.stopPropagation()),e.handleClick&&e.handleClick.call(i,t)}),t.appendChild(o),!e.title&&o.firstElementChild&&(o.title=o.firstElementChild.title),e.title&&this.set("title",e.title),e.title&&this.set("title",e.title),e.name&&this.set("name",e.name)}setVisible(e){e?ol.ext.element.show(this.element):ol.ext.element.hide(this.element)}setTitle(e){this.button_.setAttribute("title",e)}setHtml(e){ol.ext.element.setHTML(this.button_,e)}getButtonElement(){return this.button_}},ol.control.Toggle=class extends ol.control.Button{constructor(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_))}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.dispatchEvent({type:"change:active",key:"active",oldValue:!e,active:e}))}setInteraction(e){this.interaction_=e}getInteraction(){return this.interaction_}},ol.control.Search=class extends ol.control.Control{constructor(e){var t=((e=e||{}).className||"")+" ol-search"+(e.target?"":" ol-unselectable ol-control"),i=ol.ext.element.create("DIV",{className:t});super({element:i,target:e.target});var o=this;if(null==e.typing&&(e.typing=300),this._classname=e.className||"search",!1!==e.collapsed&&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 e=i.querySelectorAll("li"),t=0;t=0)if(a=l){r&&clearTimeout(r);var h=o.get("minLength");r=setTimeout(function(){if(a.length>=h){var e=o.autocomplete(a,function(e){o.drawList_(e)});e&&o.drawList_(e)}else o.drawList_()},e.typing)}else o.drawList_();else(s=i.querySelector("ul.autocomplete li"))&&s.classList.remove("select");else i.classList.contains("ol-control")&&n.blur(),s.classList.remove("select"),a=l,o._handleSelect(o._list[s.getAttribute("data-search")]);else setTimeout(function(){o.drawList_()},200)};if(n.addEventListener("keyup",l),n.addEventListener("search",l),n.addEventListener("cut",l),n.addEventListener("paste",l),n.addEventListener("input",l),e.noCollapse||(n.addEventListener("blur",function(){setTimeout(function(){n!==document.activeElement&&(i.classList.add("ol-collapsed"),this.set("reverse",!1),i.classList.remove("ol-revers"))}.bind(this),200)}.bind(this)),n.addEventListener("focus",function(){this.get("reverse")||(i.classList.remove("ol-collapsed"),i.classList.remove("ol-revers"))}.bind(this))),i.appendChild(n),e.reverse){var h=ol.ext.element.create("BUTTON",{type:"button",class:"ol-revers",title:e.reverseTitle||"click on the map",click:function(){this.get("reverse")?this.set("reverse",!1):(this.set("reverse",!this.get("reverse")),n.focus(),i.classList.add("ol-revers"))}.bind(this)});i.appendChild(h)}var c=document.createElement("UL");c.classList.add("autocomplete"),i.appendChild(c),"function"==typeof e.getTitle&&(this.getTitle=e.getTitle),"function"==typeof e.autocomplete&&(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(e){var t=this.getMap();t&&t.getView().setCenter(e.coordinate)}.bind(this)),e.zoomOnSelect&&this.on("select",function(t){var i=this.getMap();i&&(i.getView().setCenter(t.coordinate),i.getView().getZoom()=0;o--)s[o]&&JSON.stringify(s[o])!==r||s.splice(o,1)}catch(t){for(o=s.length-1;o>=0;o--)s[o]===e&&s.splice(o,1)}s.unshift(e);for(var a=Math.max(0,this.get("maxHistory")||10)||0;s.length>a;)s.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(e){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(e){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{if(this.element.querySelector("input.search").value)return;e=this.get("history"),i.setAttribute("class","autocomplete history")}for(var o,s=Math.min(t.get("maxItems"),e.length),r=0;r=200&&e.status<400?"function"==typeof this._callback&&this._callback(e.response):("function"==typeof this._callback&&this._callback(!1,"error"),console.log("AJAX ERROR",arguments))}.bind(this)),this._ajax.on("error",function(){"function"==typeof this._callback&&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)),"function"==typeof e.handleResponse&&(this.handleResponse=e.handleResponse)}ajax(e,t,i,o){o=o||{},this._callback=i,this._ajax.set("dataType",o.dataType||"JSON"),this._ajax.send(e,t,o)}autocomplete(e,t){var i=this.requestData(e),o=encodeURI(this.get("url"));this.ajax(o,i,function(e){"function"==typeof t&&t(this.handleResponse(e))})}requestData(e){return{q:e}}handleResponse(e){return e}},ol.control.SearchPhoton=class extends ol.control.SearchJSON{constructor(e){(e=e||{}).className=e.className||"photon",e.url=e.url||"https://photon.komoot.io/api/",e.copy=e.copy||'© OpenStreetMap contributors',super(e),this.set("lang",e.lang),this.set("position",e.position)}getTitle(e){var t=e.properties;return(t.housenumber||"")+" "+(t.street||t.name||"")+" "+(t.postcode||"")+" "+(t.city||"")+" ("+t.country+")"}requestData(e){var t={q:e,lang:this.get("lang"),limit:this.get("maxItems")};if(this.get("position")){var i=this.getMap().getView(),o=new ol.geom.Point(i.getCenter());o=o.transform(i.getProjection(),"EPSG:4326").getCoordinates(),t.lon=o[0],t.lat=o[1]}return t}handleResponse(e){return e.features}equalFeatures(e,t){return this.getTitle(e)===this.getTitle(t)&&e.geometry.coordinates[0]===t.geometry.coordinates[0]&&e.geometry.coordinates[1]===t.geometry.coordinates[1]}select(e){var t=e.geometry.coordinates;try{t=ol.proj.transform(e.geometry.coordinates,"EPSG:4326",this.getMap().getView().getProjection())}catch(e){}this.dispatchEvent({type:"select",search:e,coordinate:t})}reverseData(e){var t=ol.proj.transform(e,this.getMap().getView().getProjection(),"EPSG:4326");return{lon:t[0],lat:t[1]}}reverseGeocode(e,t){this.ajax(this.get("url").replace("/api/","/reverse/").replace("/search/","/reverse/"),this.reverseData(e),function(e){e.features&&(e=e.features),e instanceof Array||(e=[e]),t?t.call(this,e):this._handleSelect(e[0],!0)}.bind(this))}},ol.control.SearchGeoportail=class extends ol.control.SearchJSON{constructor(e){(e=e||{}).className=e.className||"IGNF",e.typing=e.typing||500,1==e.version?e.url="https://wxs.ign.fr/"+(e.apiKey||"essentiels")+"/ols/apis/completion":e.url="https://wxs.ign.fr/"+(e.apiKey||"essentiels")+"/geoportail/geocodage/rest/0.1/completion",e.copy='© IGN-Géoportail',super(e),this.set("type",e.type||"StreetAddress,PositionOfInterest"),this.set("timeout",e.timeout||2e3)}reverseGeocode(e,t){var i=ol.proj.transform(e,this.getMap().getView().getProjection(),"EPSG:4326");this._handleSelect({x:i[0],y:i[1],fulltext:i[0].toFixed(6)+","+i[1].toFixed(6)},!0,t);var o="Commune"===this.get("type")?"PositionOfInterest":this.get("type")||"StreetAddress";/,/.test(o)&&(o="StreetAddress");var s=this.get("url").replace("ols/apis/completion","geoportail/ols").replace("completion","reverse");if(/ols/.test(s)){var r=' '+o+" "+i[1]+" "+i[0]+" ";this.ajax(s,{xls:r},function(e){var o={};if(e){var s=(e=e.replace(/\n|\r/g,"")).replace(/.*(.*)<\/gml:pos>.*/,"$1").split(" ");if(Number(s[1])||Number(s[0]))if(o.x=i[0],o.y=i[1],o.city=e.replace(/.*([^<]*)<\/Place>.*/,"$1"),o.insee=e.replace(/.*([^<]*)<\/Place>.*/,"$1"),o.zipcode=e.replace(/.*([^<]*)<\/PostalCode>.*/,"$1"),//.test(e)){o.kind="",o.country="StreetAddress",o.street=e.replace(/.*([^<]*)<\/Street>.*/,"$1");var r=e.replace(/.*([^<]*)<\/Place>.*/,"$1"),o.country="PositionOfInterest",o.street="",o.fulltext=o.zipcode+" "+o.city;else o={x:i[0],y:i[1],fulltext:i[0].toFixed(6)+","+i[1].toFixed(6)}}else o={x:i[0],y:i[1],fulltext:i[0].toFixed(6)+","+i[1].toFixed(6)};"function"==typeof t?t.call(this,[o]):(this.getHistory().shift(),this._handleSelect(o,!0,t))}.bind(this),{timeout:this.get("timeout"),dataType:"XML"})}else this.ajax(s+"?lon="+i[0]+"&lat="+i[1],{},function(e){var o;try{(o=(e=JSON.parse(e).features[0]).properties).x=e.geometry.coordinates[0],o.y=e.geometry.coordinates[1],o.click=i,o.name?o.fulltext=o.name+", "+o.postcode+" "+o.city:o.fulltext=o.postcode+" "+o.city}catch(e){o={x:i[0],y:i[1],lonlat:i,fulltext:i[0].toFixed(6)+","+i[1].toFixed(6)}}"function"==typeof t?t.call(this,[o]):(this.getHistory().shift(),this._handleSelect(o,!0,t))}.bind(this),{timeout:this.get("timeout"),dataType:"XML"})}getTitle(e){return e.fulltext}requestData(e){return{text:e,type:"Commune"===this.get("type")?"PositionOfInterest":this.get("type")||"StreetAddress,PositionOfInterest",maximumResponses:this.get("maxItems")}}handleResponse(e){var t=e.results;if("Commune"===this.get("type"))for(var i=t.length-1;i>=0;i--)t[i].kind&&(t[i].classification>5||"Département"==t[i].kind)&&t.splice(i,1);return t}select(e,t,i,o){if(e.x||e.y){var s=[Number(e.x),Number(e.y)];try{s=ol.proj.transform(s,"EPSG:4326",this.getMap().getView().getProjection())}catch(e){}"Commune"===this.get("type")?this.searchCommune(e,function(){ol.control.Search.prototype.select.call(this,e,t,s,o)}.bind(this)):super.select(e,t,s,o)}else this.searchCommune(e)}searchCommune(e,t){var i=this.get("url").replace("ols/apis/completion","geoportail/ols").replace("completion","reverse");if(/ols/.test(i)){var o='
'+e.zipcode+" "+e.city+"+
";this.ajax(this.get("url").replace("ols/apis/completion","geoportail/ols"),{xls:o},function(i){if(i){var o=(new DOMParser).parseFromString(i,"text/xml").getElementsByTagName("GeocodedAddress")[0],s=o.getElementsByTagName("gml:Point")[0].textContent.trim().split(" ");e.x=Number(s[1]),e.y=Number(s[0]);for(var r=o.getElementsByTagName("Place"),a=0;at-o){ol.ext.element.setStyle(this.element,{height:"100%"});var r=this.panel_.querySelectorAll("li.ol-visible .li-content")[0],a=r?2*ol.ext.element.getStyle(r,"height"):0;switch(e){case 1:s+=a;break;case-1:s-=a;break;case"+50%":s+=Math.round(t/2);break;case"-50%":s-=Math.round(t/2)}return s+i<=t-3*o/2?(s=t-3*o/2-i,ol.ext.element.hide(this.botv)):ol.ext.element.show(this.botv),s>=0?(s=0,ol.ext.element.hide(this.topv)):ol.ext.element.show(this.topv),ol.ext.element.setStyle(this.panel_,{top:s+"px"}),!0}return ol.ext.element.setStyle(this.element,{height:"auto"}),ol.ext.element.setStyle(this.panel_,{top:0}),ol.ext.element.hide(this.botv),ol.ext.element.hide(this.topv),!1}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(e){"displayInLayerSwitcher"!==e.key&&"openInLayerSwitcher"!==e.key&&"title"!==e.key&&"name"!==e.key||this.drawPanel(e)}.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=100*e.getOpacity()+"%"),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(e){ol.Observable.unByKey(e)})}),this._layers=[]}_getLayerForLI(e){for(var t,i=0;t=this._layers[i];i++)if(t.li===e)return t.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(e){e.classList.contains("ol-header")||e.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}}switchLayerVisibility(e,t){e.get("baseLayer")?(e.getVisible()||e.setVisible(!0),t.forEach(function(t){e!==t&&t.get("baseLayer")&&t.getVisible()&&t.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()2&&(l=!1,n.classList.add("drag"),s=a._getLayerForLI(n),i=!1,r=a._getLayerForLI(n.parentNode.parentNode),o=ol.ext.element.create("LI",{className:"ol-dragover",html:n.innerHTML,style:{position:"absolute","z-index":1e4,left:n.offsetLeft,opacity:.5,width:ol.ext.element.outerWidth(n),height:ol.ext.element.getStyle(n,"height")},parent:h}),a.element.classList.add("drag"),a.dispatchEvent({type:"reorder-start",layer:s,group:r})),!l){var u;for(e.preventDefault(),e.stopPropagation(),ol.ext.element.setStyle(o,{top:t-ol.ext.element.offsetRect(h).top+h.scrollTop+5}),(u=e.touches?document.elementFromPoint(e.touches[0].clientX,e.touches[0].clientY):e.target).classList.contains("ol-switcherbottomdiv")?a.overflow(-1):u.classList.contains("ol-switchertopdiv")&&a.overflow(1);u&&"LI"!==u.tagName;)u=u.parentNode;u&&u.classList.contains("dropover")||n.parentNode.querySelectorAll("li").forEach(function(e){e.classList.remove("dropover"),e.classList.remove("dropover-after"),e.classList.remove("dropover-before")}),u&&u.parentNode.classList.contains("drag")&&u!==n?((i=a._getLayerForLI(u))&&!i.get("allwaysOnTop")==!s.get("allwaysOnTop")?(u.classList.add("dropover"),u.classList.add(n.offsetTopg?h.insertAt(g,t):h.insertAt(g+1,t);break}}l&&a.selectLayer(t),a.dispatchEvent({type:"reorder-end",layer:t,group:r})}n.parentNode.querySelectorAll("li").forEach(function(e){e.classList.remove("dropover"),e.classList.remove("dropover-after"),e.classList.remove("dropover-before")}),n.classList.remove("drag"),n.parentNode.classList.remove("drag"),a.element.classList.remove("drag"),o&&o.remove(),ol.ext.element.removeListener(document,"mousemove touchmove",u),ol.ext.element.removeListener(document,"mouseup touchend touchcancel",e)})}dragOpacity_(e){e.stopPropagation(),e.preventDefault();var t=this,i=e.target,o=this._getLayerForLI(i.parentNode.parentNode.parentNode);if(o){var s=e.pageX||e.touches&&e.touches.length&&e.touches[0].pageX||e.changedTouches&&e.changedTouches.length&&e.changedTouches[0].pageX,r=ol.ext.element.getStyle(i,"left")-s;t.dragging_=!0,ol.ext.element.addListener(document,"mouseup touchend touchcancel",function e(){ol.ext.element.removeListener(document,"mouseup touchend touchcancel",e),ol.ext.element.removeListener(document,"mousemove touchmove",a),t.dragging_=!1}),ol.ext.element.addListener(document,"mousemove touchmove",a)}function a(e){var t=e.pageX||e.touches&&e.touches.length&&e.touches[0].pageX||e.changedTouches&&e.changedTouches.length&&e.changedTouches[0].pageX,s=(r+t)/ol.ext.element.getStyle(i.parentNode,"width"),a=Math.max(0,Math.min(1,s));ol.ext.element.setStyle(i,{left:100*a+"%"}),i.parentNode.nextElementSibling.innerHTML=Math.round(100*a),o.setOpacity(a)}}drawList(e,t){var i=this,o=t.getArray(),s=function(e){e.stopPropagation(),e.preventDefault();var o=i._getLayerForLI(this.parentNode.parentNode);i.switchLayerVisibility(o,t),i.get("selection")&&o.getVisible()&&i.selectLayer(o),i.onchangeCheck&&i.onchangeCheck(o)};function r(e){e.stopPropagation(),e.preventDefault();var t=i._getLayerForLI(this.parentNode.parentNode);i.oninfo(t),i.dispatchEvent({type:"info",layer:t})}function a(e){e.stopPropagation(),e.preventDefault();var t=i._getLayerForLI(this.parentNode.parentNode);i.onextent?i.onextent(t):i.getMap().getView().fit(t.getExtent(),i.getMap().getSize()),i.dispatchEvent({type:"extent",layer:t})}function n(e){e.stopPropagation(),e.preventDefault();var t,o=this.parentNode.parentNode.parentNode.parentNode,s=i._getLayerForLI(o);s?(t=i._getLayerForLI(this.parentNode.parentNode),s.getLayers().remove(t),0!=s.getLayers().getLength()||s.get("noSwitcherDelete")||n.call(o.querySelectorAll(".layerTrash")[0],e)):(o=this.parentNode.parentNode,i.getMap().removeLayer(i._getLayerForLI(o)))}function l(t){if(this.displayInLayerSwitcher(t)){var l=ol.ext.element.create("LI",{className:(t.getVisible()?"ol-visible ":" ")+(t.get("baseLayer")?"baselayer":""),parent:e});this._setLayerForLI(l,t),this._selectedLayer===t&&l.classList.add("ol-layer-select");var c=ol.ext.element.create("DIV",{className:"ol-layerswitcher-buttons",parent:l}),u=ol.ext.element.create("DIV",{className:"li-content",parent:l});ol.ext.element.create("INPUT",{type:t.get("baseLayer")?"radio":"checkbox",className:"ol-visibility",checked:t.getVisible(),click:s,parent:u});var d=ol.ext.element.create("LABEL",{title:t.get("title")||t.get("name"),click:s,style:{userSelect:"none"},parent:u});if(d.addEventListener("selectstart",function(){return!1}),ol.ext.element.create("SPAN",{html:t.get("title")||t.get("name"),click:function(e){this.get("selection")&&(e.stopPropagation(),this.selectLayer(t))}.bind(this),parent:d}),this.reordering&&(h0&&(!t.get("allwaysOnTop")||o[h-1].get("allwaysOnTop")))&&ol.ext.element.create("DIV",{className:"layerup ol-noscroll",title:this.tip.up,on:{"mousedown touchstart":function(e){i.dragOrdering_(e)}},parent:c}),t.getLayers){var g=0;t.getLayers().forEach(function(e){i.displayInLayerSwitcher(e)&&g++}),g&&ol.ext.element.create("DIV",{className:t.get("openInLayerSwitcher")?"collapse-layers":"expend-layers",title:this.tip.plus,click:function(){var e=i._getLayerForLI(this.parentNode.parentNode);e.set("openInLayerSwitcher",!e.get("openInLayerSwitcher"))},parent:c})}if(this.oninfo&&ol.ext.element.create("DIV",{className:"layerInfo",title:this.tip.info,click:r,parent:c}),this.hastrash&&!t.get("noSwitcherDelete")&&ol.ext.element.create("DIV",{className:"layerTrash",title:this.tip.trash,click:n,parent:c}),this.hasextent&&o[h].getExtent()){var p=o[h].getExtent();4==p.length&&p[0]=0;h--)l.call(this,o[h]);this.viewChange(),e===this.panel_&&this.overflow()}getLayerClass(e){return e?e.getLayers?"ol-layer-group":e instanceof ol.layer.Vector?"ol-layer-vector":e instanceof ol.layer.VectorTile?"ol-layer-vectortile":e instanceof ol.layer.Tile?"ol-layer-tile":e instanceof ol.layer.Image?"ol-layer-image":e instanceof ol.layer.Heatmap?"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.drawPanel(),t||this.dispatchEvent({type:"select",layer:e})}getSelection(){return this._selectedLayer}setprogress_(e){if(!e.layerswitcher_progress){var t=0,i=0,o=function(){i===t?(i=t=0,ol.ext.element.setStyle(e.layerswitcher_progress,{width:0})):ol.ext.element.setStyle(e.layerswitcher_progress,{width:(t/i*100).toFixed(1)+"%"})};e.getSource().on("tileloadstart",function(){i++,o()}),e.getSource().on("tileloadend",function(){t++,o()}),e.getSource().on("tileloaderror",function(){t++,o()})}}},ol.control.LayerSwitcher.prototype.tip={up:"up/down",down:"down",info:"informations...",extent:"zoom to extent",trash:"remove layer",plus:"expand/shrink"},ol.control.Bar=class extends ol.control.Control{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(e){return e.length>0});t.classList.add.apply(t.classList,i)}if(e.group&&t.classList.add("ol-group"),super({element:t,target:e.target}),this.set("toggleOne",e.toggleOne),this.set("autoDeactivate",e.autoDeactivate),this.controls_=[],e.controls instanceof Array)for(var o=0;o-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;t0?this.set("max",Number(t)):t=this.get("max"),t){var o=Math.round(e/t*100);ol.ext.element.setStyle(this._progress,{display:""}),this._progressbar.className=o?"":"notransition",ol.ext.element.setStyle(this._progressbar,{width:o+"%"})}else ol.ext.element.setStyle(this._progress,{display:"none"});this._progressMessage.innerHTML="",ol.ext.element.setHTML(this._progressMessage,i||"")}else ol.ext.element.setStyle(this._progress,{display:"none"})}_onButton(e,t){return function(i){i.preventDefault(),"submit"===e&&!1===this.get("closeOnSubmit")||this.hide();var o=this.getInputs();this.dispatchEvent({type:"button",button:e,inputs:o}),"function"==typeof t&&t(e,o)}.bind(this)}getInputs(){var e={};return["input","textarea","select"].forEach(function(t){this.element.querySelectorAll("form "+t).forEach(function(t){t.className&&t.className.split(" ").forEach(function(i){e[i]=t})})}.bind(this)),e}hide(){this.element.classList.remove("ol-visible"),this.dispatchEvent({type:"hide"})}close(){this.hide()}isOpen(){return this.element.classList.contains("ol-visible")}},ol.control.Disable=class extends ol.control.Control{constructor(e){e=e||{};var t=document.createElement("div");t.className=(e.className||" ol-disable ol-unselectable ol-control").trim();var i={top:"0px",left:"0px",right:"0px",bottom:"0px",zIndex:1e4,background:"none",display:"none"};Object.keys(i).forEach(function(e){t.style[e]=i[e]}),super({element:t})}isOn(){return this.element.classList.contains("ol-disable")}disableMap(e){e?(this.element.classList.add("ol-enable"),this.element.style.display="block"):(this.element.classList.remove("ol-enable"),this.element.style.display="none")}},ol.control.EditBar=class extends ol.control.Bar{constructor(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),!1!==e.edition&&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"):"string"==typeof e?e:e.title}_setSelectInteraction(e){var t,i=this,o=new ol.control.Bar;if(!1!==e.interactions.Delete){e.interactions.Delete instanceof ol.interaction.Delete?this._interactions.Delete=e.interactions.Delete:this._interactions.Delete=new ol.interaction.Delete;var s=this._interactions.Delete;s.setActive(!1),this.getMap()&&this.getMap().addInteraction(s),o.addControl(new ol.control.Button({className:"ol-delete",title:this._getTitle(e.interactions.Delete)||"Delete",name:"Delete",handleClick:function(e){s.delete(t.getInteraction().getFeatures());var i={type:"select",selected:[],deselected:t.getInteraction().getFeatures().getArray().slice(),mapBrowserEvent:e.mapBrowserEvent};t.getInteraction().getFeatures().clear(),t.getInteraction().dispatchEvent(i)}}))}if(!1!==e.interactions.Info&&o.addControl(new ol.control.Button({className:"ol-info",name:"Info",title:this._getTitle(e.interactions.Info)||"Show informations",handleClick:function(){i.dispatchEvent({type:"info",features:t.getInteraction().getFeatures()})}})),!1!==e.interactions.Select){e.interactions.Select instanceof ol.interaction.Select?this._interactions.Select=e.interactions.Select:this._interactions.Select=new ol.interaction.Select({condition:ol.events.condition.click});var r=this._interactions.Select;t=new ol.control.Toggle({className:"ol-selection",name:"Select",title:this._getTitle(e.interactions.Select)||"Select",interaction:r,bar:o.getControls().length?o:void 0,autoActivate:!0,active:!0}),this.addControl(t),r.on("change:active",function(){r.getActive()||r.getFeatures().clear()})}}_setEditInteraction(e){if(!1!==e.interactions.DrawPoint){e.interactions.DrawPoint instanceof ol.interaction.Draw?this._interactions.DrawPoint=e.interactions.DrawPoint:this._interactions.DrawPoint=new ol.interaction.Draw({type:"Point",source:this._source});var t=new ol.control.Toggle({className:"ol-drawpoint",name:"DrawPoint",title:this._getTitle(e.interactions.DrawPoint)||"Point",interaction:this._interactions.DrawPoint});this.addControl(t)}if(!1!==e.interactions.DrawLine){e.interactions.DrawLine instanceof ol.interaction.Draw?this._interactions.DrawLine=e.interactions.DrawLine:this._interactions.DrawLine=new ol.interaction.Draw({type:"LineString",source:this._source,geometryFunction:function(e,t){return t?t.setCoordinates(e):t=new ol.geom.LineString(e),this.nbpts=t.getCoordinates().length,t}});var i=new ol.control.Toggle({className:"ol-drawline",title:this._getTitle(e.interactions.DrawLine)||"LineString",name:"DrawLine",interaction:this._interactions.DrawLine,bar:new ol.control.Bar({controls:[new ol.control.TextButton({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 ol.control.TextButton({html:this._getTitle(e.interactions.FinishDraw)||"finish",title:this._getTitle(e.interactions.FinishDraw)||"finish",handleClick:function(){i.getInteraction().nbpts>2&&i.getInteraction().finishDrawing()}})]})});this.addControl(i)}if(!1!==e.interactions.DrawPolygon&&(e.interactions.DrawPolygon instanceof ol.interaction.Draw?this._interactions.DrawPolygon=e.interactions.DrawPolygon:this._interactions.DrawPolygon=new ol.interaction.Draw({type:"Polygon",source:this._source,geometryFunction:function(e,t){return this.nbpts=e[0].length,t?t.setCoordinates([e[0].concat([e[0][0]])]):t=new ol.geom.Polygon(e),t}}),this._setDrawPolygon("ol-drawpolygon",this._interactions.DrawPolygon,this._getTitle(e.interactions.DrawPolygon)||"Polygon","DrawPolygon",e)),!1!==e.interactions.DrawHole&&(e.interactions.DrawHole instanceof ol.interaction.DrawHole?this._interactions.DrawHole=e.interactions.DrawHole:this._interactions.DrawHole=new ol.interaction.DrawHole,this._setDrawPolygon("ol-drawhole",this._interactions.DrawHole,this._getTitle(e.interactions.DrawHole)||"Hole","DrawHole",e)),!1!==e.interactions.DrawRegular){var o={pts:"pts",circle:"circle"};e.interactions.DrawRegular instanceof ol.interaction.DrawRegular?(this._interactions.DrawRegular=e.interactions.DrawRegular,o.pts=this._interactions.DrawRegular.get("ptsLabel")||o.pts,o.circle=this._interactions.DrawRegular.get("circleLabel")||o.circle):(this._interactions.DrawRegular=new ol.interaction.DrawRegular({source:this._source,sides:4}),e.interactions.DrawRegular&&(o.pts=e.interactions.DrawRegular.ptsLabel||o.pts,o.circle=e.interactions.DrawRegular.circleLabel||o.circle));var s=this._interactions.DrawRegular,r=document.createElement("DIV"),a=ol.ext.element.create("DIV",{parent:r});ol.ext.element.addListener(a,["click","touchstart"],function(){var e=s.getSides()-1;e<2&&(e=2),s.setSides(e),n.textContent=e>2?e+" "+o.pts:o.circle}.bind(this));var n=ol.ext.element.create("TEXT",{html:"4 "+o.pts,parent:r}),l=ol.ext.element.create("DIV",{parent:r});ol.ext.element.addListener(l,["click","touchstart"],function(){var e=s.getSides()+1;e<3&&(e=3),s.setSides(e),n.textContent=e+" "+o.pts}.bind(this));var h=new ol.control.Toggle({className:"ol-drawregular",title:this._getTitle(e.interactions.DrawRegular)||"Regular",name:"DrawRegular",interaction:this._interactions.DrawRegular,bar:new ol.control.Bar({controls:[new ol.control.TextButton({html:r})]})});this.addControl(h)}}_setDrawPolygon(e,t,i,o,s){var r=new ol.control.Toggle({className:e,name:o,title:i,interaction:t,bar:new ol.control.Bar({controls:[new ol.control.TextButton({html:this._getTitle(s.interactions.UndoDraw)||"undo",title:this._getTitle(s.interactions.UndoDraw)||"undo last point",handleClick:function(){r.getInteraction().nbpts>1&&r.getInteraction().removeLastPoint()}}),new ol.control.TextButton({html:this._getTitle(s.interactions.FinishDraw)||"finish",title:this._getTitle(s.interactions.FinishDraw)||"finish",handleClick:function(){r.getInteraction().nbpts>3&&r.getInteraction().finishDrawing()}})]})});return this.addControl(r),r}_setModifyInteraction(e){if(!1!==e.interactions.ModifySelect&&!1!==e.interactions.Select&&(e.interactions.ModifySelect instanceof ol.interaction.ModifyFeature?this._interactions.ModifySelect=e.interactions.ModifySelect:this._interactions.ModifySelect=new ol.interaction.ModifyFeature({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))),!1!==e.interactions.Transform){e.interactions.Transform instanceof ol.interaction.Transform?this._interactions.Transform=e.interactions.Transform:this._interactions.Transform=new ol.interaction.Transform({addCondition:ol.events.condition.shiftKeyOnly});var t=new ol.control.Toggle({html:"",className:"ol-transform",title:this._getTitle(e.interactions.Transform)||"Transform",name:"Transform",interaction:this._interactions.Transform});this.addControl(t)}if(!1!==e.interactions.Split){e.interactions.Split instanceof ol.interaction.Split?this._interactions.Split=e.interactions.Split:this._interactions.Split=new ol.interaction.Split({sources:this._source});var i=new ol.control.Toggle({className:"ol-split",title:this._getTitle(e.interactions.Split)||"Split",name:"Split",interaction:this._interactions.Split});this.addControl(i)}if(!1!==e.interactions.Offset){e.interactions.Offset instanceof ol.interaction.Offset?this._interactions.Offset=e.interactions.Offset:this._interactions.Offset=new ol.interaction.Offset({source:this._source});var o=new ol.control.Toggle({html:"",className:"ol-offset",title:this._getTitle(e.interactions.Offset)||"Offset",name:"Offset",interaction:this._interactions.Offset});this.addControl(o)}}},ol.control.Gauge=class extends ol.control.Control{constructor(e){e=e||{};var t=ol.ext.element.create("DIV",{className:((e.className||"")+" ol-gauge ol-unselectable ol-control").trim()});super({element:t,target:e.target}),this.title_=ol.ext.element.create("SPAN",{parent:t});var i=ol.ext.element.create("DIV",{parent:t});this.gauge_=ol.ext.element.create("BUTTON",{type:"button",style:{width:"0px"},parent:i}),this.setTitle(e.title),this.set("max",e.max||100),this.val(e.val)}setTitle(e){this.title_.innerHTML=e||"",this.title_.display=e?"":"none"}val(e){return void 0!==e&&(this.val_=e,this.gauge_.style.width=e/this.get("max")*100+"%"),this.val_}},ol.control.GeoBookmark=class extends ol.control.Control{constructor(e){e=e||{};var t=document.createElement("div");super({element:t,target:e.target});var i=this;e.target?t.className=e.className||"ol-bookmark":(t.className=(e.className||"ol-bookmark")+" ol-unselectable ol-control ol-collapsed",t.addEventListener("mouseleave",function(){r!==document.activeElement&&(o.style.display="none")}),this.button=ol.ext.element.create("BUTTON",{type:"button",title:e.title||"Geobookmarks",click:function(){var e=""===o.style.display||"none"===o.style.display;o.style.display=e?"block":"none",e&&this.setBookmarks()}.bind(this)}),t.appendChild(this.button));var o=document.createElement("div");t.appendChild(o);var s=document.createElement("ul");o.appendChild(s);var r=document.createElement("input");r.setAttribute("placeholder",e.placeholder||"Add a new geomark..."),r.addEventListener("keydown",function(e){if(e.stopPropagation(),13===e.keyCode){e.preventDefault();var t=this.value;t&&(i.addBookmark(t),this.value="",i.dispatchEvent({type:"add",name:t})),o.style.display="none"}}),r.addEventListener("blur",function(){o.style.display="none"}),o.appendChild(r),this.on("propertychange",function(e){"editable"===e.key&&(t.className=t.className.replace(" ol-editable",""),this.get("editable")&&(t.className+=" ol-editable"))}.bind(this)),this.set("namespace",e.namespace||"ol"),this.set("editable",!1!==e.editable),this.set("deleteTitle",e.deleteTitle||"Suppr.");var a={};try{localStorage[this.get("namespace")+"@bookmark"]&&(a=JSON.parse(localStorage[this.get("namespace")+"@bookmark"]))}catch(e){console.warn("Failed to access localStorage...")}if(e.marks)for(var n in e.marks)a[n]=e.marks[n];this.setBookmarks(a)}setBookmarks(e){if(!e){e={};try{e=JSON.parse(localStorage[this.get("namespace")+"@bookmark"]||"{}")}catch(e){console.warn("Failed to access localStorage...")}}var t=this.get("editable"),i=this.element.querySelector("ul"),o=this.element.querySelector("div"),s=this;for(var r in i.innerHTML="",e){var a=document.createElement("li");if(a.textContent=r,a.setAttribute("data-bookmark",JSON.stringify(e[r])),a.setAttribute("data-name",r),a.addEventListener("click",function(){var e=JSON.parse(this.getAttribute("data-bookmark"));s.getMap().getView().setCenter(e.pos),s.getMap().getView().setZoom(e.zoom),s.getMap().getView().setRotation(e.rot||0),o.style.display="none",s.dispatchEvent({type:"select",name:this.getAttribute("data-name"),bookmark:e})}),i.appendChild(a),t&&!e[r].permanent){var n=document.createElement("button");n.setAttribute("data-name",r),n.setAttribute("type","button"),n.setAttribute("title",this.get("deleteTitle")||"Suppr."),n.addEventListener("click",function(e){s.removeBookmark(this.getAttribute("data-name")),s.dispatchEvent({type:"remove",name:this.getAttribute("data-name")}),e.stopPropagation()}),a.appendChild(n)}}try{localStorage[this.get("namespace")+"@bookmark"]=JSON.stringify(e)}catch(e){console.warn("Failed to access localStorage...")}}getBookmarks(){var e={};try{e=JSON.parse(localStorage[this.get("namespace")+"@bookmark"]||"{}")}catch(e){console.warn("Failed to access localStorage...")}return e}removeBookmark(e){if(e){var t=this.getBookmarks();delete t[e],this.setBookmarks(t)}}addBookmark(e,t,i,o){if(e){var s,r=t;r&&r.position?(i=r.zoom,o=r.permanent,s=r.rotation,t=r.position):s=this.getMap().getView().getRotation();var a=this.getBookmarks();a[e]&&a[e].permanent||(a[e]={pos:t||this.getMap().getView().getCenter(),zoom:i||this.getMap().getView().getZoom(),permanent:!!o},s&&(a[e].rot=s),this.setBookmarks(a))}}},ol.control.GeolocationBar=class extends ol.control.Bar{constructor(e){(e=e||{}).className=e.className||"ol-geobar",super(e),this.setPosition(e.position||"bottom-right");var t=this.element,i=new ol.interaction.GeolocationDraw({source:e.source,zoom:e.zoom,minZoom:e.minZoom,tolerance:e.tolerance,followTrack:e.followTrack,minAccuracy:e.minAccuracy||1e4});this._geolocBt=new ol.control.Toggle({className:"geolocBt",interaction:i,onToggle:function(){i.pause(!0),i.setFollowTrack(e.followTrack),t.classList.remove("pauseTrack")}}),this.addControl(this._geolocBt),this._geolocBt.setActive(!1);var o=new ol.control.Bar;this.addControl(o);var s=new ol.control.TextButton({className:"centerBt",html:e.centerLabel||"center",handleClick:function(){i.setFollowTrack("auto")}});o.addControl(s);var r=new ol.control.Button({className:"startBt",handleClick:function(){i.pause(!1),i.setFollowTrack("auto"),t.classList.add("pauseTrack")}});o.addControl(r);var a=new ol.control.Button({className:"pauseBt",handleClick:function(){i.pause(!0),i.setFollowTrack("auto"),t.classList.remove("pauseTrack")}});o.addControl(a),i.on("follow",function(e){e.following?t.classList.remove("centerTrack"):t.classList.add("centerTrack")}),this._geolocBt.on("change:active",function(e){e.active?t.classList.add("ol-active"):t.classList.remove("ol-active")})}setMap(e){this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,super.setMap(e),e&&(this._listener=e.on("moveend",function(){var t=this.getInteraction();t.getActive()&&"auto"===t.get("followTrack")&&t.path_.length&&t.path_[t.path_.length-1][0]!==e.getView().getCenter()[0]&&this.element.classList.add("centerTrack")}.bind(this)))}getInteraction(){return this._geolocBt.getInteraction()}},ol.control.GeolocationButton=class extends ol.control.Toggle{constructor(e){(e=e||{}).followTrack=e.followTrack||"auto",e.zoom=e.zoom||16;var t,i=new ol.interaction.GeolocationDraw(e);super({className:e.className=((e.className||"")+" ol-geobt").trim(),interaction:i,title:e.title||"Geolocation",onToggle:function(){i.pause(!0),i.setFollowTrack(e.followTrack||"auto")}}),this.setActive(!1),i.on("tracking",function(e){this.dispatchEvent({type:"position",coordinate:e.geolocation.getPosition()})}.bind(this)),i.on("change:active",function(){this.dispatchEvent({type:"position"}),t&&(clearTimeout(t),t=null),i.getActive()&&(t=setTimeout(function(){i.setActive(!1),t=null}.bind(this),e.delay||3e3))}.bind(this))}},ol.control.Globe=class extends ol.control.Control{constructor(e){var t=e||{},i=document.createElement("div");super({element:i,target:t.target});var o=this;t.target?this.panel_=t.target:(i.classList.add("ol-globe","ol-unselectable","ol-control"),/top/.test(t.align)&&i.classList.add("ol-control-top"),/right/.test(t.align)&&i.classList.add("ol-control-right"),this.panel_=document.createElement("div"),this.panel_.classList.add("panel"),i.appendChild(this.panel_),this.pointer_=document.createElement("div"),this.pointer_.classList.add("ol-pointer"),i.appendChild(this.pointer_)),this.ovmap_=new ol.Map({controls:new ol.Collection,interactions:new ol.Collection,target:this.panel_,view:new ol.View({zoom:0,center:[0,0]}),layers:t.layers}),setTimeout(function(){o.ovmap_.updateSize()},0),this.set("follow",t.follow||!1),this.extentLayer=new ol.layer.Vector({name:"Cache extent",source:new ol.source.Vector,style:t.style||[new ol.style.Style({image:new ol.style.Circle({fill:new ol.style.Fill({color:"rgba(255,0,0, 1)"}),stroke:new ol.style.Stroke({width:7,color:"rgba(255,0,0, 0.8)"}),radius:5})})]}),this.ovmap_.addLayer(this.extentLayer)}setMap(e){this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,ol.control.Control.prototype.setMap.call(this,e),e&&(this._listener=e.getView().on("propertychange",this.setView.bind(this)),this.setView())}setView(){this.getMap()&&this.get("follow")&&this.setCenter(this.getMap().getView().getCenter())}getGlobe(){return this.ovmap_}show(e){!1!==e?this.element.classList.remove("ol-collapsed"):this.element.classList.add("ol-collapsed"),this.ovmap_.updateSize()}setPosition(e){/top/.test(e)?this.element.classList.add("ol-control-top"):this.element.classList.remove("ol-control-top"),/right/.test(e)?this.element.classList.add("ol-control-right"):this.element.classList.remove("ol-control-right")}setCenter(e,t){var i=this;if(this.pointer_.classList.add("hidden"),e){var o=this.ovmap_,s=o.getPixelFromCoordinate(e);if(s){if(!1!==t){var r=this.element.clientHeight;setTimeout(function(){i.pointer_.style.top=String(Math.min(Math.max(s[1],0),r))+"px",i.pointer_.style.left="50%",i.pointer_.classList.remove("hidden")},800)}o.getView().animate({center:[e[0],0]})}}}},ol.control.Graticule=class extends ol.control.CanvasBase{constructor(e){e=e||{};var t=document.createElement("div");t.className="ol-graticule ol-unselectable ol-hidden",super({element:t}),this.set("projection",e.projection||"EPSG:4326");var i=new ol.proj.Projection({code:this.get("projection")}).getMetersPerUnit();for(this.fac=1;i/this.fac>10;)this.fac*=10;this.fac=1e4/this.fac,this.set("maxResolution",e.maxResolution||1/0),this.set("step",e.step||.1),this.set("stepCoord",e.stepCoord||1),this.set("spacing",e.spacing||40),this.set("intervals",e.intervals),this.set("precision",e.precision),this.set("margin",e.margin||0),this.set("borderWidth",e.borderWidth||5),this.set("stroke",!1!==e.stroke),this.formatCoord=e.formatCoord||function(e){return e},e.style instanceof ol.style.Style?this.setStyle(e.style):this.setStyle(new ol.style.Style({stroke:new ol.style.Stroke({color:"#000",width:1}),fill:new ol.style.Fill({color:"#fff"}),text:new ol.style.Text({stroke:new ol.style.Stroke({color:"#fff",width:2}),fill:new ol.style.Fill({color:"#000"})})}))}setStyle(e){this._style=e}_draw(e){if(!(this.get("maxResolution")r)(f*=Math.round((c-u)/r*m/f))>this.fac&&(f=Math.round(f/this.fac)*this.fac);var x=this.get("intervals");if(Array.isArray(x)){for(var b=x[0],w=(p=0,x.length);p=x[p]);++p)b=x[p];f=b}var S=this.get("precision"),M=f;S>0&&f>S&&(M=f/Math.ceil(f/S)),u=Math.floor(u/f)*f-f,g=Math.floor(g/f)*f-f,c=Math.floor(c/f)*f+2*f,d=Math.floor(d/f)*f+2*f;var C=ol.proj.get(n).getExtent();C&&(uC[2]&&(c=C[2]+f),d>C[3]&&(d=C[3]+f));var E=this.getStyle().getStroke()&&this.get("stroke"),L=this.getStyle().getText(),T=this.getStyle().getFill();i.save(),i.scale(s,s),i.beginPath(),i.rect(_,_,r-2*_,a-2*_),i.clip(),i.beginPath();var P,k,A,I,F,N={top:[],left:[],bottom:[],right:[]};for(P=u;P0&&F[1]<0&&N.top.push([P,A]),A[1]>a&&F[1]0&&N.left.push([k,A]),A[0]r&&N.right.push([k,A]),A=F;if(E&&(i.strokeStyle=this.getStyle().getStroke().getColor(),i.lineWidth=this.getStyle().getStroke().getWidth(),i.stroke()),L){var D,O;i.fillStyle=this.getStyle().getText().getFill().getColor(),i.strokeStyle=this.getStyle().getText().getStroke().getColor(),i.lineWidth=this.getStyle().getText().getStroke().getWidth(),i.font=this.getStyle().getText().getFont(),i.textAlign="center",i.textBaseline="hanging";var R=(T?y:0)+_+2;for(p=0;D=N.top[p];p++)Math.round(D[0]/this.get("step"))%v||(O=this.formatCoord(D[0],"top"),i.strokeText(O,D[1][0],R),i.fillText(O,D[1][0],R));for(i.textBaseline="alphabetic",p=0;D=N.bottom[p];p++)Math.round(D[0]/this.get("step"))%v||(O=this.formatCoord(D[0],"bottom"),i.strokeText(O,D[1][0],a-R),i.fillText(O,D[1][0],a-R));for(i.textBaseline="middle",i.textAlign="left",p=0;D=N.left[p];p++)Math.round(D[0]/this.get("step"))%v||(O=this.formatCoord(D[0],"left"),i.strokeText(O,R,D[1][1]),i.fillText(O,R,D[1][1]));for(i.textAlign="right",p=0;D=N.right[p];p++)Math.round(D[0]/this.get("step"))%v||(O=this.formatCoord(D[0],"right"),i.strokeText(O,r-R,D[1][1]),i.fillText(O,r-R,D[1][1]))}if(T){var G,V,B=this.getStyle().getFill().getColor();for((V=this.getStyle().getStroke())?G=this.getStyle().getStroke().getColor():(G=B,B="#fff"),i.strokeStyle=G,i.lineWidth=V?V.getWidth():1,p=1;p=i[0])return"";var s=Math.floor((t[3]-e[1])/(t[3]-t[1])*i[1]);return s<0||s>=i[1]?"":this.getHIndex(o)+this.getVIndex(s)}}getVIndex(e){return e}getHIndex(e){return String.fromCharCode(65+e)}_draw(e){if(!(this.get("maxResolution")r?(y=r-_,t.textBaseline="alphabetic"):t.textBaseline="hanging",t.strokeText(f,v,y),t.fillText(f,v,y);for(t.textBaseline="middle",p=0;ps?(v=s-_,t.textAlign="right"):t.textAlign="left",t.strokeText(f,v,y),t.fillText(f,v,y);t.restore()}}},ol.control.Imageline=class extends ol.control.Control{constructor(e){var t=ol.ext.element.create("DIV",{className:(e.className||"")+" ol-imageline"+(e.target?"":" ol-unselectable ol-control")+(e.collapsed&&e.collapsible?"ol-collapsed":"")});super({element:t,target:e.target}),!e.target&&e.collapsible&&ol.ext.element.create("BUTTON",{type:"button",click:function(){this.toggle()}.bind(this),parent:t}),e.source&&(this._sources=e.source.forEach?e.source:[e.source]),e.layers&&this.setLayers(e.layers),this._setScrolling(),this._scrolldiv.addEventListener("scroll",function(){this.getMap()&&this.getMap().render()}.bind(this)),"function"==typeof e.getImage&&(this._getImage=e.getImage),"function"==typeof e.getTitle&&(this._getTitle=e.getTitle),this.set("maxFeatures",e.maxFeatures||100),this.set("linkColor",e.linkColor||!1),this.set("hover",e.hover||!1),this.set("useExtent",e.useExtent||!1),this.refresh()}setMap(e){this._listener&&this._listener.forEach(function(e){ol.Observable.unByKey(e)}.bind(this)),this._listener=null,super.setMap(e),e&&(this._listener=[e.on("postcompose",this._drawLink.bind(this)),e.on("moveend",function(){this.get("useExtent")&&this.refresh()}.bind(this))],this.refresh())}setLayers(e){this._sources=this._getSources(e)}_getSources(e){var t=[];return e.forEach(function(e){e.getVisible()&&(e.getSource()&&e.getSource().getFeatures?t.push(e.getSource()):e.getLayers&&this._getSources(e.getLayers()))}.bind(this)),t}useExtent(e){this.set("useExtent",e),this.refresh()}isCollapsed(){return this.element.classList.contains("ol-collapsed")}collapse(e){e?this.element.classList.add("ol-collapsed"):this.element.classList.remove("ol-collapsed"),this.getMap()&&setTimeout(function(){this.getMap().render()}.bind(this),this.isCollapsed()?0:250),this.dispatchEvent({type:"collapse",collapsed:this.isCollapsed()})}toggle(){this.element.classList.toggle("ol-collapsed"),this.getMap()&&setTimeout(function(){this.getMap().render()}.bind(this),this.isCollapsed()?0:250),this.dispatchEvent({type:"collapse",collapsed:this.isCollapsed()})}_getImage(e){return e.get("img")}_getTitle(){return""}getFeatures(){var e=this.getMap();if(!e)return[];var t=[];return(this._sources||this._getSources(e.getLayers())).forEach(function(i){if(t.lengtho[0]?(t.moveTo((o[0]-5)*i,o[1]*i),t.lineTo((o[0]+5)*i,(o[1]+5)*i)):(t.moveTo((o[0]-5)*i,(o[1]+5)*i),t.lineTo((o[0]+5)*i,o[1]*i)),t.lineTo(s[0]*i,s[1]*i),t.fill(),t.restore()}}},ol.control.IsochroneGeoportail=class extends ol.control.Control{constructor(e){e||(e={}),null==e.typing&&(e.typing=300);var t=(e.className?e.className:"")+" ol-isochrone ol-routing";e.target||(t+=" ol-unselectable ol-control");var i=ol.ext.element.create("DIV",{className:t});e.target||ol.ext.element.create("BUTTON",{parent:i}).addEventListener("click",function(){i.classList.toggle("ol-collapsed")});super({element:i,target:e.target});var o=this;this.set("iter",1);var s=ol.ext.element.create("DIV",{className:"content",parent:i});this._addSearchCtrl(s,e),ol.ext.element.create("BUTTON",{className:"ol-button ol-method-time selected",title:"isochrone",parent:s}).addEventListener("click",function(){this.setMethod("time")}.bind(this)),ol.ext.element.create("I",{className:"ol-button ol-method-distance",title:"isodistance",parent:s}).addEventListener("click",function(){this.setMethod("distance")}.bind(this)),ol.ext.element.create("I",{className:"ol-button ol-car selected",title:"by car",parent:s}).addEventListener("click",function(){this.setMode("car")}.bind(this)),ol.ext.element.create("I",{className:"ol-button ol-pedestrian",title:"by foot",parent:s}).addEventListener("click",function(){this.setMode("pedestrian")}.bind(this)),ol.ext.element.create("I",{className:"ol-button ol-direction-direct selected",title:"direct",parent:s}).addEventListener("click",function(){this.setDirection("direct")}.bind(this)),ol.ext.element.create("I",{className:"ol-button ol-direction-reverse",title:"reverse",parent:s}).addEventListener("click",function(){this.setDirection("reverse")}.bind(this));var r=ol.ext.element.create("DIV",{className:"ol-time",parent:s});ol.ext.element.create("DIV",{html:"isochrone:",parent:r}),ol.ext.element.create("INPUT",{type:"number",parent:r,min:0}).addEventListener("change",function(){o.set("hour",Number(this.value))}),ol.ext.element.create("TEXT",{parent:r,html:"h"}),ol.ext.element.create("INPUT",{type:"number",parent:r,min:0}).addEventListener("change",function(){o.set("minute",Number(this.value))}),ol.ext.element.create("TEXT",{parent:r,html:"mn"}),r=ol.ext.element.create("DIV",{className:"ol-distance",parent:s}),ol.ext.element.create("DIV",{html:"isodistance:",parent:r}),ol.ext.element.create("INPUT",{type:"number",step:"any",parent:r,min:0}).addEventListener("change",function(){o.set("distance",Number(this.value))}),ol.ext.element.create("TEXT",{parent:r,html:"km"}),r=ol.ext.element.create("DIV",{className:"ol-iter",parent:s}),ol.ext.element.create("DIV",{html:"Iteration:",parent:r}),ol.ext.element.create("INPUT",{type:"number",parent:r,value:1,min:1}).addEventListener("change",function(){o.set("iter",Number(this.value))}),ol.ext.element.create("I",{className:"ol-ok",html:"ok",parent:s}).addEventListener("click",function(){var e=0;switch(this.get("method")){case"distance":e=1e3*this.get("distance");break;default:e=3600*(this.get("hour")||0)+60*(this.get("minute")||0)}e&&this.get("coordinate")&&this.search(this.get("coordinate"),e)}.bind(this)),this.set("url","https://wxs.ign.fr/"+(e.apiKey||"essentiels")+"/isochrone/isochrone.json"),this._ajax=new ol.ext.Ajax({dataType:"JSON",auth:e.auth}),this._ajax.on("success",this._success.bind(this)),this._ajax.on("error",this._error.bind(this)),this._ajax.on("loadstart",function(){this.element.classList.add("ol-searching")}.bind(this)),this._ajax.on("loadend",function(){this.element.classList.remove("ol-searching")}.bind(this)),this.setMethod(e.method)}setMap(e){super.setMap(e),this._search.setMap(e)}_addSearchCtrl(e,t){var i=ol.ext.element.create("DIV",{parent:e}),o=this._search=new ol.control.SearchGeoportail({className:"IGNF ol-collapsed",apiKey:t.apiKey,target:i});o.on("select",function(e){o.setInput(e.search.fulltext),this.set("coordinate",e.coordinate)}.bind(this)),o.on("change:input",function(){this.set("coordinate",!1)}.bind(this))}setMethod(e){e=/distance/.test(e)?"distance":"time",this.element.querySelector(".ol-method-time").classList.remove("selected"),this.element.querySelector(".ol-method-distance").classList.remove("selected"),this.element.querySelector(".ol-method-"+e).classList.add("selected"),this.element.querySelector("div.ol-time").classList.remove("selected"),this.element.querySelector("div.ol-distance").classList.remove("selected"),this.element.querySelector("div.ol-"+e).classList.add("selected"),this.set("method",e)}setMode(e){this.set("mode",e),this.element.querySelector(".ol-car").classList.remove("selected"),this.element.querySelector(".ol-pedestrian").classList.remove("selected"),this.element.querySelector(".ol-"+e).classList.add("selected")}setDirection(e){this.set("direction",e),this.element.querySelector(".ol-direction-direct").classList.remove("selected"),this.element.querySelector(".ol-direction-reverse").classList.remove("selected"),this.element.querySelector(".ol-direction-"+e).classList.add("selected")}search(e,t,i){var o=this.getMap()?this.getMap().getView().getProjection():"EPSG:3857",s=/distance/.test(this.get("method"))?"distance":"time";if("string"==typeof t){var r=t.replace(/([0-9|.]*)([a-z]*)$/,"$2");switch(s="time",t=parseFloat(t),r){case"mn":t*=60;break;case"h":t*=3600;break;case"m":s="distance";break;case"km":s="distance",t*=1e3}}var a=Math.round(t*(this.get("iter")-(i||0))/this.get("iter"));if("number"==typeof t){var n={"gp-access-lib":"2.1.0",location:ol.proj.toLonLat(e,o),graphName:"pedestrian"===this.get("mode")?"Pieton":"Voiture",exclusions:this.get("exclusions")||void 0,method:s,time:"time"===s?a:void 0,distance:"distance"===s?a:void 0,reverse:"reverse"===this.get("direction"),smoothing:this.get("smoothing")||!0,holes:this.get("holes")||!1};this._ajax.send(this.get("url"),n,{coord:e,option:t,data:n,iteration:(i||0)+1})}}_success(e){var t=this.getMap()?this.getMap().getView().getProjection():"EPSG:3857",i=new ol.format.WKT,o=e.response;o.feature=i.readFeature(o.wktGeometry,{dataProjection:"EPSG:4326",featureProjection:t}),o.feature.set("iteration",e.options.iteration),o.feature.set("method",e.options.data.method),o.feature.set(e.options.data.method,e.options.data[e.options.data.method]),delete o.wktGeometry,o.type="isochrone",o.iteration=e.options.iteration-1,this.dispatchEvent(o),e.options.iteration=0?setTimeout(function(){o.classList.add("ol-collapsed"),i._listener=null},t||3e3):null},100)}hide(){this._listener&&(clearTimeout(this._listener),this._listener=null),this.element.classList.add("ol-collapsed")}toggle(e){this.element.classList.contains("ol-collapsed")?this.show(null,e):this.hide()}},ol.control.Overlay=class extends ol.control.Control{constructor(e){e=e||{};var t=ol.ext.element.create("DIV",{className:"ol-unselectable ol-overlay "+(e.className||""),html:e.content});super({element:t,target:e.target});var i=this;e.hideOnClick&&t.addEventListener("click",function(){i.hide()}),this.set("closeBox",e.closeBox),this._timeout=!1,this.setContent(e.content)}setContent(e){var t=this;if(e){var i=this.element;if(e instanceof Element?(i.innerHTML="",i.appendChild(e)):void 0!==e&&(i.innerHTML=e),this.get("closeBox")){var o=document.createElement("div");o.classList.add("ol-closebox"),o.addEventListener("click",function(){t.hide()}),i.insertBefore(o,i.firstChild)}}}show(e,t){var i=this,o=this.element;o.style.display="block",t?(this.center_=this.getMap().getPixelFromCoordinate(t),o.style.top=this.center_[1]+"px",o.style.left=this.center_[0]+"px"):(this.center_=!1,o.style.top="",o.style.left=""),e&&this.setContent(e),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(function(){o.classList.add("ol-visible"),o.style.top="",o.style.left="",i.dispatchEvent({type:"change:visible",visible:!0,element:i.element})},10)}showImage(e,t){t=t||{};var i=ol.ext.element.create("DIV",{className:"ol-fullscreen-image"});ol.ext.element.create("IMG",{src:e,parent:i}),t.title&&(i.classList.add("ol-has-title"),ol.ext.element.create("P",{html:t.title,parent:i})),this.show(i,t.coordinate)}hide(){var e=this.element;this.element.classList.remove("ol-visible"),this.center_&&(e.style.top=this.center_[1]+"px",e.style.left=this.center_[0]+"px",this.center_=!1),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(function(){e.style.display="none"},500),this.dispatchEvent({type:"change:visible",visible:!1,element:this.element})}toggle(){this.getVisible()?this.hide():this.show()}getVisible(){return"none"!==ol.ext.element.getStyle(this.element,"display")}setClass(e){var t=this.element.classList.contains("ol-visible");this.element.className=("ol-unselectable ol-overlay "+(t?"ol-visible ":"")+e).trim()}},ol.control.Overview=class extends ol.control.Control{constructor(e){e=e||{};var t=document.createElement("div");super({element:t,target:e.target});var i=this;if(this.minZoom=e.minZoom||0,this.maxZoom=e.maxZoom||18,this.rotation=e.rotation,e.target)this.panel_=e.target;else{t.classList.add("ol-overview","ol-unselectable","ol-control","ol-collapsed"),/top/.test(e.align)&&t.classList.add("ol-control-top"),/right/.test(e.align)&&t.classList.add("ol-control-right");var o=document.createElement("button");o.setAttribute("type","button"),o.addEventListener("touchstart",function(e){i.toggleMap(),e.preventDefault()}),o.addEventListener("click",function(){i.toggleMap()}),t.appendChild(o),this.panel_=document.createElement("div"),this.panel_.classList.add("panel"),t.appendChild(this.panel_)}this.ovmap_=new ol.Map({controls:new ol.Collection,interactions:new ol.Collection,target:this.panel_,view:new ol.View({zoom:2,center:[0,0],projection:e.projection}),layers:e.layers}),this.oview_=this.ovmap_.getView(),this.extentLayer=new ol.layer.Vector({name:"Cache extent",source:new ol.source.Vector,style:e.style||[new ol.style.Style({image:new ol.style.Circle({fill:new ol.style.Fill({color:"rgba(255,0,0, 1)"}),stroke:new ol.style.Stroke({width:7,color:"rgba(255,0,0, 0.8)"}),radius:5}),stroke:new ol.style.Stroke({width:5,color:"rgba(255,0,0,0.8)"})})]}),this.ovmap_.addLayer(this.extentLayer);this.ovmap_.addInteraction(new ol.interaction.Pointer({handleDownEvent:function(t){var o,s,r,a,n;return!1!==e.panAnimation?"elastic"==e.panAnimation||e.elasticPan?i.getMap().getView().animate({center:t.coordinate,easing:(o=2,s=.3,r=3*o*Math.PI/2,a=s>0?-1/s:-100,n=Math.cos(r)*Math.pow(2,a),function(e){return e=1-Math.cos(e*Math.PI/2),1-Math.cos(r*e)*Math.pow(2,a*e)+n*e}),duration:1e3}):i.getMap().getView().animate({center:t.coordinate,duration:300}):i.getMap().getView().setCenter(t.coordinate),!1}}))}getOverviewMap(){return this.ovmap_}toggleMap(){this.element.classList.toggle("ol-collapsed"),this.ovmap_.updateSize(),this.setView()}setPosition(e){/top/.test(e)?this.element.classList.add("ol-control-top"):this.element.classList.remove("ol-control-top"),/right/.test(e)?this.element.classList.add("ol-control-right"):this.element.classList.remove("ol-control-right")}setMap(e){if(this._listener)for(var t in this._listener)ol.Observable.unByKey(this._listener[t]);this._listener={},super.setMap(e),e&&(this._listener.map=e.on("change:view",function(){this._listener.view&&ol.Observable.unByKey(this._listener.view),e.getView()&&(this._listener.view=e.getView().on("propertychange",this.setView.bind(this)),this.setView())}.bind(this)),this._listener.view=e.getView().on("propertychange",this.setView.bind(this)),this.setView())}calcExtent_(e){var t=this.getMap();if(t){var i=this.extentLayer.getSource();i.clear();var o=new ol.Feature,s=t.getSize(),r=t.getView().getResolution(),a=t.getView().getRotation(),n=t.getView().getCenter();if(r){var l=r*s[0]/2,h=r*s[1]/2,c=this.oview_.getResolution();if(l/c>5||h/c>5){var u,d,g,p=Math.cos(a),m=Math.sin(a);for(e=[[-l,-h],[-l,h],[l,h],[l,-h]],u=0;u<4;++u)d=e[u][0],g=e[u][1],e[u][0]=n[0]+d*p-g*m,e[u][1]=n[1]+d*m+g*p;o.setGeometry(new ol.geom.Polygon([e]))}else o.setGeometry(new ol.geom.Point(n));i.addFeature(o)}}}setView(e){if(!e)return this.setView({key:"rotation"}),this.setView({key:"resolution"}),void this.setView({key:"center"});switch(e.key){case"rotation":this.rotation?this.oview_.setRotation(this.getMap().getView().getRotation()):this.oview_.getRotation()&&this.oview_.setRotation(0);break;case"center":var t=this.getMap().getView().calculateExtent(this.getMap().getSize()),i=this.oview_.calculateExtent(this.ovmap_.getSize());(t[0]i[2]||t[3]>i[3])&&this.oview_.setCenter(this.getMap().getView().getCenter());break;case"resolution":var o=2*Math.round(this.oview_.getZoomForResolution(this.getMap().getView().getResolution())/2)-4;o=Math.min(this.maxZoom,Math.max(this.minZoom,o)),this.oview_.setZoom(o)}this.calcExtent_()}},ol.control.Permalink=class extends ol.control.Control{constructor(e){var t=e||{},i=document.createElement("div");super({element:i,target:t.target});var o=this,s=document.createElement("button");if(ol.ext.element.create("I",{parent:s}),this.replaceState_=!1!==t.urlReplace,this.fixed_=t.fixed||6,this.hash_=t.anchor?"#":"?",this._localStorage=t.localStorage,!this._localStorage)try{localStorage.removeItem("ol@permalink")}catch(e){console.warn("Failed to access localStorage...")}function r(){"function"==typeof t.onclick?t.onclick(o.getLink()):o.setUrlReplace(!o.replaceState_)}s.addEventListener("click",r,!1),s.addEventListener("touchstart",r,!1),i.className=(t.className||"ol-permalink")+" ol-unselectable ol-control",i.appendChild(s),(t.hidden||!1===t.visible)&&ol.ext.element.hide(i),this.set("geohash",t.geohash),this.set("initial",!1),this.on("change",this.viewChange_.bind(this)),this.search_={};var a={},n=document.location.hash||document.location.search||"";if(this.replaceState_&&!n&&this._localStorage)try{n=localStorage["ol@permalink"]}catch(e){console.warn("Failed to access localStorage...")}if(n){n=n.replace(/(^#|^\?)/,"").split("&");for(var l=0;ll.height?"landscape":"portrait"),"landscape"===u&&(h=[h[1],h[0]]);var g=Math.min((h[0]-2*d)/l.width,(h[1]-2*d)/l.height);s=g*l.width,r=g*l.height,a=[(h[0]-s)/2,(h[1]-r)/2]}try{n=l?l.toDataURL(t,i):null}catch(p){return void this.dispatchEvent({type:"error",canvas:l})}var p=Object.assign({type:"print",print:{format:c,orientation:u,unit:"mm",size:h,position:a,imageWidth:s,imageHeight:r},image:n,imageType:t,quality:i,canvas:l},e);this.dispatchEvent(p)}.bind(this)),this.getMap().render()}}},ol.control.PrintDialog=class extends ol.control.Control{constructor(e){e=e||{};var t=ol.ext.element.create("DIV",{className:(e.className||"ol-print")+" ol-unselectable ol-control"});super({element:t}),this._lang=e.lang||"en",e.target||ol.ext.element.create("BUTTON",{type:"button",title:e.title||"Print",click:function(){this.print()}.bind(this),parent:t}),e.openWindow&&this.on("print",function(e){e.canvas&&window.open().document.write('')}),e.target=e.target||ol.ext.element.create("DIV");var i=this._printCtrl=new ol.control.Print(e);i.on(["print","error","printing"],function(e){s.setAttribute("data-status",e.type),e.clipboard||this.dispatchEvent(e)}.bind(this)),this._compass=new ol.control.Compass({src:e.northImage||"compact",visible:!1,className:"olext-print-compass",style:new ol.style.Stroke({color:"#333",width:0})});var o=this._printDialog=new ol.control.Dialog({target:e.targetDialog||document.body,closeBox:!0,className:"ol-ext-print-dialog"}),s=o.getContentElement();this._input={};var r=ol.ext.element.create("DIV",{className:"ol-print-param",parent:s});this._pages=[ol.ext.element.create("DIV",{className:"ol-page"})];var a=ol.ext.element.create("DIV",{className:"ol-map",parent:this._pages[0]});ol.ext.element.create("DIV",{html:this._pages[0],className:"ol-print-map",parent:s}),ol.ext.element.create("H2",{html:this.i18n("title"),parent:r});var n=ol.ext.element.create("UL",{parent:r}),l=ol.ext.element.create("LI",{className:"ol-orientation",parent:n});this._input.orientation={list:l};var h,c=ol.ext.element.create("LABEL",{className:"portrait",parent:l});this._input.orientation.portrait=ol.ext.element.create("INPUT",{type:"radio",name:"ol-print-orientation",value:"portrait",checked:!0,on:{change:function(e){this.setOrientation(e.target.value)}.bind(this)},parent:c}),ol.ext.element.create("SPAN",{html:this.i18n("portrait"),parent:c}),c=ol.ext.element.create("LABEL",{className:"landscape",parent:l}),this._input.orientation.landscape=ol.ext.element.create("INPUT",{type:"radio",name:"ol-print-orientation",value:"landscape",on:{change:function(e){this.setOrientation(e.target.value)}.bind(this)},parent:c}),ol.ext.element.create("SPAN",{html:this.i18n("landscape"),parent:c}),l=ol.ext.element.create("LI",{html:ol.ext.element.create("LABEL",{html:this.i18n("size")}),className:"ol-size",parent:n});var u=this._input.size=ol.ext.element.create("SELECT",{on:{change:function(){this.setSize(u.value||M)}.bind(this)},parent:l});for(h in this.paperSize)ol.ext.element.create("OPTION",{html:h+(this.paperSize[h]?" - "+this.paperSize[h][0]+"x"+this.paperSize[h][1]+" mm":this.i18n("custom")),value:h,parent:u});l=ol.ext.element.create("LI",{html:ol.ext.element.create("LABEL",{html:this.i18n("margin")}),className:"ol-margin",parent:n});var d=this._input.margin=ol.ext.element.create("SELECT",{on:{change:function(){this.setMargin(d.value)}.bind(this)},parent:l});for(h in this.marginSize)ol.ext.element.create("OPTION",{html:this.i18n(h)+" - "+this.marginSize[h]+" mm",value:this.marginSize[h],parent:d});l=ol.ext.element.create("LI",{html:ol.ext.element.create("LABEL",{html:this.i18n("scale")}),className:"ol-scale",parent:n});var g=this._input.scale=ol.ext.element.create("SELECT",{on:{change:function(){this.setScale(parseInt(g.value))}.bind(this)},parent:l});Object.keys(this.scales).forEach(function(e){ol.ext.element.create("OPTION",{html:this.scales[e],value:e,parent:g})}.bind(this)),l=ol.ext.element.create("LI",{className:"ol-legend",parent:n});var p=ol.ext.element.createSwitch({html:this.i18n("legend"),checked:!1,on:{change:function(){L.legend.control.setCanvas(p.checked)}.bind(this)},parent:l});l=ol.ext.element.create("LI",{className:"ol-print-north",parent:n});var m=this._input.north=ol.ext.element.createSwitch({html:this.i18n("north"),checked:"checked",on:{change:function(){m.checked?this._compass.element.classList.add("ol-print-compass"):this._compass.element.classList.remove("ol-print-compass"),this.getMap().render()}.bind(this)},parent:l});l=ol.ext.element.create("LI",{className:"ol-print-title",parent:n});var f=ol.ext.element.createSwitch({html:this.i18n("mapTitle"),checked:!1,on:{change:function(e){L.title.control.setVisible(e.target.checked)}.bind(this)},parent:l}),v=ol.ext.element.create("INPUT",{type:"text",placeholder:this.i18n("mapTitle"),on:{keydown:function(e){13===e.keyCode&&e.preventDefault()},keyup:function(){L.title.control.setTitle(v.value)},change:function(){L.title.control.setTitle(v.value)}.bind(this)},parent:l}),y=ol.ext.element.create("DIV",{className:"ol-user-param",parent:r});l=ol.ext.element.create("LI",{className:"ol-saveas",parent:n});var _=ol.ext.element.create("DIV",{html:this.i18n("copied"),className:"ol-clipboard-copy",parent:l}),x=ol.ext.element.create("SELECT",{on:{change:function(){if(this.formats[x.value].clipboard)i.copyMap(this.formats[x.value],function(e){e&&(_.classList.add("visible"),setTimeout(function(){_.classList.remove("visible")},1e3))});else{var e="string"==typeof this.getSize()?this.getSize():null,t=Object.assign({format:e,size:e?this.paperSize[e]:null,orient:this.getOrientation(),margin:this.getMargin()},this.formats[x.value]);i.print(t)}x.value=""}.bind(this)},parent:l});ol.ext.element.create("OPTION",{html:this.i18n("saveas"),style:{display:"none"},value:"",parent:x}),this.formats.forEach(function(t,i){if(t.pdf){if(!1===e.pdf)return}else if(t.clipboard){if(!1===e.copy)return}else if(!1===e.save)return;ol.ext.element.create("OPTION",{html:this.i18n(t.title),value:i,parent:x})}.bind(this)),l=ol.ext.element.create("LI",{className:"ol-savelegend",parent:n});var b=ol.ext.element.create("DIV",{html:this.i18n("copied"),className:"ol-clipboard-copy",parent:l}),w=ol.ext.element.create("SELECT",{on:{change:function(){var e=L.legend.control.getLegend().getCanvas(),t=document.createElement("CANVAS");t.width=e.width,t.height=e.height;var i,o=t.getContext("2d");if(o.fillStyle="#fff",o.fillRect(0,0,t.width,t.height),o.drawImage(e,0,0),this.formats[w.value].clipboard)t.toBlob(function(e){try{navigator.clipboard.write([new window.ClipboardItem(Object.defineProperty({},e.type,{value:e,enumerable:!0}))]),b.classList.add("visible"),setTimeout(function(){b.classList.remove("visible")},1e3)}catch(e){}},"image/png");else try{i=t.toDataURL(this.formats[w.value].imageType,this.formats[w.value].quality);var s="string"==typeof this.getSize()?this.getSize():"A4",r=t.width/96*25.4,a=t.height/96*25.4,n=this.paperSize[s];"landscape"===this.getOrientation()&&(n=[n[1],n[0]]);var l=[(n[0]-r)/2,(n[1]-a)/2];this.dispatchEvent({type:"print",print:{legend:!0,format:s,orientation:this.getOrientation(),unit:"mm",size:this.paperSize[s],position:l,imageWidth:r,imageHeight:a},image:i,imageType:this.formats[w.value].imageType,pdf:this.formats[w.value].pdf,quality:this.formats[w.value].quality,canvas:t})}catch(e){}w.value=""}.bind(this)},parent:l});ol.ext.element.create("OPTION",{html:this.i18n("saveLegend"),style:{display:"none"},value:"",parent:w}),this.formats.forEach(function(e,t){ol.ext.element.create("OPTION",{html:this.i18n(e.title),value:t,parent:w})}.bind(this));var S,M,C,E=ol.ext.element.create("DIV",{className:"ol-ext-buttons",parent:r});ol.ext.element.create("BUTTON",{html:this.i18n("printBt"),type:"submit",click:function(e){e.preventDefault(),window.print()},parent:E}),ol.ext.element.create("BUTTON",{html:this.i18n("cancel"),type:"button",click:function(){o.hide()},parent:E}),ol.ext.element.create("DIV",{html:this.i18n("errorMsg"),className:"ol-error",parent:r});var L={};o.on("show",function(){this.dispatchEvent({type:"show",userElement:y,dialog:this._printDialog,page:this.getPage()});var e=this.getMap();e&&(document.body.classList.add("ol-print-document"),S=e.getTargetElement(),M=e.getSize(),"string"==typeof this.getSize()?this.setSize(this.getSize()):this.setSize(M),e.setTarget(a),C&&ol.Observable.unByKey(C),C=e.on("moveend",function(){this.setScale(ol.sphere.getMapScale(e))}.bind(this)),this.setScale(ol.sphere.getMapScale(e)),L={},this.getMap().getControls().forEach(function(e){e instanceof ol.control.Legend&&(L.legend={control:e}),e instanceof ol.control.CanvasTitle&&(L.title={control:e}),e instanceof ol.control.Compass&&(L.compass?e.element.classList.remove("ol-print-compass"):(this._input.north.checked?e.element.classList.add("ol-print-compass"):e.element.classList.remove("ol-print-compass"),this._compass=e,L.compass={control:e}))}.bind(this)),L.title?(f.checked=L.title.isVisible=L.title.control.getVisible(),v.value=L.title.control.getTitle(),f.parentNode.parentNode.classList.remove("hidden")):f.parentNode.parentNode.classList.add("hidden"),L.legend?(L.legend.ison=L.legend.control.onCanvas(),L.legend.collapsed=L.legend.control.isCollapsed(),L.legend.control.collapse(!1),w.parentNode.classList.remove("hidden"),p.parentNode.parentNode.classList.remove("hidden"),p.checked=!L.legend.collapsed,L.legend.control.setCanvas(!L.legend.collapsed)):(w.parentNode.classList.add("hidden"),p.parentNode.parentNode.classList.add("hidden")))}.bind(this)),o.on("hide",function(){document.body.classList.remove("ol-print-document"),S&&(this.getMap().setTarget(S),S=null,C&&ol.Observable.unByKey(C),L.title&&L.title.control.setVisible(L.title.isVisible),L.legend&&(L.legend.control.setCanvas(L.legend.ison),L.legend.control.collapse(L.legend.collapsed)),this.dispatchEvent({type:"hide"}))}.bind(this)),window.addEventListener("resize",function(){this.setSize()}.bind(this)),e.saveAs&&this.on("print",function(t){t.pdf||t.canvas.toBlob(function(i){var o=(t.print.legend?"legend.":"map.")+t.imageType.replace("image/","");e.saveAs(i,o)},t.imageType,t.quality)}),e.jsPDF&&this.on("print",function(t){if(t.pdf){var i=new e.jsPDF({orientation:t.print.orientation,unit:t.print.unit,format:t.print.size});i.addImage(t.image,"JPEG",t.print.position[0],t.print.position[0],t.print.imageWidth,t.print.imageHeight),i.save(t.print.legend?"legend.pdf":"map.pdf")}})}static addLang(e,t){ol.control.PrintDialog.prototype._labels[e]=t}isOpen(){return this._printDialog.isOpen()}i18n(e){var t=this._labels.en[e]||e;return this._labels[this._lang]&&this._labels[this._lang][e]&&(t=this._labels[this._lang][e]),t}getOrientation(){return this._orientation||"portrait"}setOrientation(e){this._orientation="landscape"===e?"landscape":"portrait",this._input.orientation[this._orientation].checked=!0,this.setSize()}getMargin(){return this._margin||0}setMargin(e){this._margin=e,this._input.margin.value=e,this.setSize()}getSize(){return this._size}setSize(e){if(this._printDialog.getContentElement().setAttribute("data-status",""),e?this._size=e:e=this._size,e){if("string"==typeof e){for(var t in this.paperSize)t&&new RegExp(t,"i").test(e)&&(e=t);this.paperSize[e]||(e=this._size="A4"),this._input.size.value=e,e=[Math.trunc(96*this.paperSize[e][0]/25.4),Math.trunc(96*this.paperSize[e][1]/25.4)],"landscape"===this.getOrientation()&&(e=[e[1],e[0]]),this.getPage().classList.remove("margin")}else this._input.size.value="",this.getPage().classList.add("margin");var i=this.getPage(),o=i.parentNode.getBoundingClientRect(),s=(o.width-40)/e[0],r=(o.height-40)/e[1],a=Math.min(s,r,1);i.style.width=e[0]+"px",i.style.height=e[1]+"px",i.style["-webkit-transform"]=i.style.transform="translate(-50%,-50%) scale("+a+")";var n=Math.round(5/a);i.style["-webkit-box-shadow"]=i.style["box-shadow"]=n+"px "+n+"px "+n+"px rgba(0,0,0,.6)",i.style.padding=96*this.getMargin()/25.4+"px",this.getMap()&&this.getMap().updateSize(),this.dispatchEvent({type:"dialog:refresh"})}}getContentElement(){return this._printDialog.getContentElement()}getUserElement(){return this._printDialog.getContentElement().querySelector(".ol-user-param")}getPage(){return this._pages[0]}setMap(e){this.getMap()&&(this.getMap().removeControl(this._compass),this.getMap().removeControl(this._printCtrl),this.getMap().removeControl(this._printDialog)),super.setMap(e),this.getMap()&&(this.getMap().addControl(this._compass),this.getMap().addControl(this._printCtrl),this.getMap().addControl(this._printDialog))}setScale(e){ol.sphere.setMapScale(this.getMap(),e),this._input.scale.value=" "+100*Math.round(e/100)}getScale(){return ol.sphere.getMapScale(this.getMap())}print(e){(e=e||{}).size&&this.setSize(e.size),e.scale&&this.setScale(e.scale),e.orientation&&this.setOrientation(e.orientation),e.margin&&this.setMargin(e.margin),this._printDialog.show()}getrintControl(){return this._printCtrl}},ol.control.PrintDialog.prototype._labels={en:{title:"Print",orientation:"Orientation",portrait:"Portrait",landscape:"Landscape",size:"Page size",custom:"screen size",margin:"Margin",scale:"Scale",legend:"Legend",north:"North arrow",mapTitle:"Map title",saveas:"Save as...",saveLegend:"Save legend...",copied:"✔ Copied to clipboard",errorMsg:"Can't save map canvas...",printBt:"Print...",clipboardFormat:"copy to clipboard...",jpegFormat:"save as jpeg",pngFormat:"save as png",pdfFormat:"save as pdf",none:"none",small:"small",large:"large",cancel:"cancel"},fr:{title:"Imprimer",orientation:"Orientation",portrait:"Portrait",landscape:"Paysage",size:"Taille du papier",custom:"taille écran",margin:"Marges",scale:"Echelle",legend:"Légende",north:"Flèche du nord",mapTitle:"Titre de la carte",saveas:"Enregistrer sous...",saveLegend:"Enregistrer la légende...",copied:"✔ Carte copiée",errorMsg:"Impossible d'enregistrer la carte",printBt:"Imprimer",clipboardFormat:"copier dans le presse-papier...",jpegFormat:"enregistrer un jpeg",pngFormat:"enregistrer un png",pdfFormat:"enregistrer un pdf",none:"aucune",small:"petites",large:"larges",cancel:"annuler"},de:{title:"Drucken",orientation:"Ausrichtung",portrait:"Hochformat",landscape:"Querformat",size:"Papierformat",custom:"Bildschirmgröße",margin:"Rand",scale:"Maßstab",legend:"Legende",north:"Nordpfeil",mapTitle:"Kartentitel",saveas:"Speichern als...",saveLegend:"Legende speichern...",copied:"✔ In die Zwischenablage kopiert",errorMsg:"Kann Karte nicht speichern...",printBt:"Drucken...",clipboardFormat:"in die Zwischenablage kopieren...",jpegFormat:"speichern als jpeg",pngFormat:"speichern als png",pdfFormat:"speichern als pdf",none:"kein",small:"klein",large:"groß",cancel:"abbrechen"},zh:{title:"打印",orientation:"方向",portrait:"纵向",landscape:"横向",size:"页面大小",custom:"屏幕大小",margin:"外边距",scale:"尺度",legend:"图例",north:"指北针",mapTitle:"地图名字",saveas:"保存为...",saveLegend:"保存图例为...",copied:"✔ 已复制到剪贴板",errorMsg:"无法保存地图...",printBt:"打印...",cancel:"取消"}},ol.control.PrintDialog.prototype.paperSize={"":null,A0:[841,1189],A1:[594,841],A2:[420,594],A3:[297,420],A4:[210,297],"US Letter":[215.9,279.4],A5:[148,210],B4:[257,364],B5:[182,257]},ol.control.PrintDialog.prototype.marginSize={none:0,small:5,large:10},ol.control.PrintDialog.prototype.formats=[{title:"clipboardFormat",imageType:"image/png",clipboard:!0},{title:"jpegFormat",imageType:"image/jpeg",quality:.8},{title:"pngFormat",imageType:"image/png",quality:.8},{title:"pdfFormat",imageType:"image/jpeg",pdf:!0}],ol.control.PrintDialog.prototype.scales={" 5000":"1/5.000"," 10000":"1/10.000"," 25000":"1/25.000"," 50000":"1/50.000"," 100000":"1/100.000"," 250000":"1/250.000"," 1000000":"1/1.000.000"},ol.control.Profil=class extends ol.control.Control{constructor(e){e=e||{};var t=document.createElement("div");super({element:t,target:e.target});var i=this;if(this.info=e.info||ol.control.Profil.prototype.info,e.target)t.classList.add(e.className||"ol-profil");else{t.className=((e.className||"ol-profil")+" ol-unselectable ol-control ol-collapsed").trim(),this.button=document.createElement("button"),this.button.title=e.title||"Profile",this.button.setAttribute("type","button");var o=function(e){i.toggle(),e.preventDefault()};this.button.addEventListener("click",o),this.button.addEventListener("touchstart",o),t.appendChild(this.button),ol.ext.element.create("I",{parent:this.button})}e.style instanceof ol.style.Style?this._style=e.style:this._style=new ol.style.Style({text:new ol.style.Text,stroke:new ol.style.Stroke({width:1.5,color:"#369"})}),this._style.getText()||this._style.setText(new ol.style.Text),e.selectStyle instanceof ol.style.Style?this._selectStyle=e.selectStyle:this._selectStyle=new ol.style.Style({fill:new ol.style.Fill({color:"#369"})});var s=document.createElement("div");s.classList.add("ol-inner"),t.appendChild(s);var r=document.createElement("div");r.style.position="relative",s.appendChild(r);var a=this.ratio=2;this.canvas_=document.createElement("canvas"),this.canvas_.width=(e.width||300)*a,this.canvas_.height=(e.height||150)*a;var n={msTransform:"scale(0.5,0.5)",msTransformOrigin:"0 0",webkitTransform:"scale(0.5,0.5)",webkitTransformOrigin:"0 0",mozTransform:"scale(0.5,0.5)",mozTransformOrigin:"0 0",transform:"scale(0.5,0.5)",transformOrigin:"0 0"};Object.keys(n).forEach(function(e){e in i.canvas_.style&&(i.canvas_.style[e]=n[e])});var l=document.createElement("div");r.appendChild(l),l.style.width=this.canvas_.width/a+"px",l.style.height=this.canvas_.height/a+"px",l.appendChild(this.canvas_),l.addEventListener("pointerdown",this.onMove.bind(this)),document.addEventListener("pointerup",this.onMove.bind(this)),l.addEventListener("mousemove",this.onMove.bind(this)),l.addEventListener("touchmove",this.onMove.bind(this)),this.set("selectable",e.selectable),this.margin_={top:10*a,left:45*a,bottom:30*a,right:10*a},this.info.ytitle||(this.margin_.left-=20*a),this.info.xtitle||(this.margin_.bottom-=20*a),this.bar_=document.createElement("div"),this.bar_.classList.add("ol-profilbar"),this.bar_.style.top=this.margin_.top/a+"px",this.bar_.style.height=(this.canvas_.height-this.margin_.top-this.margin_.bottom)/a+"px",r.appendChild(this.bar_),this.cursor_=document.createElement("div"),this.cursor_.classList.add("ol-profilcursor"),r.appendChild(this.cursor_),this.popup_=document.createElement("div"),this.popup_.classList.add("ol-profilpopup"),this.cursor_.appendChild(this.popup_);var h=document.createElement("table");h.cellPadding="0",h.cellSpacing="0",h.style.clientWidth=this.canvas_.width/a+"px",r.appendChild(h);var c=document.createElement("tr");c.classList.add("track-info"),h.appendChild(c);var u=document.createElement("td");u.innerHTML=(this.info.zmin||"Zmin")+': ',c.appendChild(u);var d=document.createElement("td");d.innerHTML=(this.info.zmax||"Zmax")+': ',c.appendChild(d);var g=document.createElement("td");g.innerHTML=(this.info.distance||"Distance")+': ',c.appendChild(g);var p=document.createElement("td");p.innerHTML=(this.info.time||"Time")+': ',c.appendChild(p);var m=document.createElement("tr");m.classList.add("point-info"),h.appendChild(m);var f=document.createElement("td");f.innerHTML=(this.info.altitude||"Altitude")+': ',m.appendChild(f);var v=document.createElement("td");v.innerHTML=(this.info.distance||"Distance")+': ',m.appendChild(v);var y,_,x=document.createElement("td");(x.innerHTML=(this.info.time||"Time")+': ',m.appendChild(x),this.tab_=[],e.feature&&this.setGeometry(e.feature),e.zoomable)&&(this.set("selectable",!0),this.on("change:geometry",function(){_=null}),this.on("dragstart",function(e){y=e.index}),this.on("dragend",function(e){if(Math.abs(y-e.index)>10){if(!_)var i=ol.ext.element.create("BUTTON",{parent:t,className:"ol-zoom-out",click:function(e){e.stopPropagation(),e.preventDefault(),_&&(this.dispatchEvent({type:"zoom"}),this.setGeometry(_,this._geometry[1])),t.removeChild(i)}.bind(this)});var o=_||this._geometry[0],s=new ol.geom.LineString(this.getSelection(y,e.index));this.setGeometry(s,this._geometry[1]),_=o,this.dispatchEvent({type:"zoom",geometry:s,start:y,end:e.index})}}.bind(this)))}popup(e){this.popup_.innerHTML=e}_drawAt(e,t){e?(this.cursor_.style.left=t+"px",this.cursor_.style.top=(this.canvas_.height-this.margin_.bottom+e[1]*this.scale_[1]+this.dy_)/this.ratio+"px",this.cursor_.style.display="block",this.bar_.parentElement.classList.add("over"),this.bar_.style.left=t+"px",this.bar_.style.display="block",this.element.querySelector(".point-info .z").textContent=e[1]+this.info.altitudeUnits,this.element.querySelector(".point-info .dist").textContent=(e[0]/1e3).toFixed(1)+this.info.distanceUnitsKM,this.element.querySelector(".point-info .time").textContent=e[2],t>this.canvas_.width/this.ratio/2?this.popup_.classList.add("ol-left"):this.popup_.classList.remove("ol-left")):(this.cursor_.style.display="none",this.bar_.style.display="none",this.cursor_.style.display="none",this.bar_.parentElement.classList.remove("over"))}showAt(e){var t,i,o,s=1/0;if(void 0===e)this.bar_.parentElement.classList.contains("over")&&this._drawAt();else if(e.length)for(t=1;i=this.tab_[t];t++){var r=ol.coordinate.dist2d(i[3],e);r=e));t++);if(o){var a=(o[0]*this.scale_[0]+this.margin_.left)/this.ratio;return this._drawAt(o,a),o[3]}return null}showAtTime(e,t){var i,o,s;if(e instanceof Date?e=e.getTime()/1e3:t&&(e+=this.tab_[0][3][3]),void 0===e)this.bar_.parentElement.classList.contains("over")&&this._drawAt();else for(i=0;(o=this.tab_[i])&&(s=o,!(o[3][3]>=e));i++);if(s){var r=(s[0]*this.scale_[0]+this.margin_.left)/this.ratio;return this._drawAt(s,r),s[3]}return null}pointAtTime(e){var t,i;for(t=1;i=this.tab_[t];t++){var o=i[3][3];if(o>=e){var s=this.tab_[t-1][3];return(s[3]+o)/2this.margin_.left/l-20&&a<(this.canvas_.width-this.margin_.right)/l+8&&n>this.margin_.top/l&&n<(this.canvas_.height-this.margin_.bottom)/l){var h,c,u=(a*l-this.margin_.left)/this.scale_[0],d=this.tab_[0];for(h=1;c=this.tab_[h];h++)if(c[0]>=u){u<(c[0]+d[0])/2&&(h=0,c=d);break}switch(c||(c=this.tab_[this.tab_.length-1]),a=Math.max(this.margin_.left/l,Math.min(a,(this.canvas_.width-this.margin_.right)/l)),this._drawAt(c,a),this.dispatchEvent({type:"over",click:"click"===e.type,index:h,coord:c[3],time:c[2],distance:c[0]}),e.type){case"pointerdown":this._dragging={event:{type:"dragstart",index:h,coord:c[3],time:c[2],distance:c[0]},pageX:s,pageY:r};break;case"pointerup":this._dragging&&this._dragging.pageX?Math.abs(this._dragging.pageX-s)<3&&Math.abs(this._dragging.pageY-r)<3&&(this.dispatchEvent({type:"click",index:h,coord:c[3],time:c[2],distance:c[0]}),this.refresh()):this.dispatchEvent({type:"dragend",index:h,coord:c[3],time:c[2],distance:c[0]}),this._dragging=!1;break;default:if(this._dragging)if(this._dragging.pageX)(Math.abs(this._dragging.pageX-s)>3||Math.abs(this._dragging.pageY-r)>3)&&(this._dragging.pageX=this._dragging.pageY=!1,this.dispatchEvent(this._dragging.event));else{this.dispatchEvent({type:"dragging",index:h,coord:c[3],time:c[2],distance:c[0]});var g=Math.min(this._dragging.event.index,h),p=Math.max(this._dragging.event.index,h);this.refresh(),this.get("selectable")&&this._drawGraph(this.tab_.slice(g,p),this._selectStyle)}}}else this.bar_.parentElement.classList.contains("over")&&(this._drawAt(),this.dispatchEvent({type:"out"})),"pointerup"===e.type&&this._dragging&&(this.dispatchEvent({type:"dragcancel"}),this._dragging=!1)}}show(){this.element.classList.remove("ol-collapsed"),this.dispatchEvent({type:"show",show:!0})}hide(){this.element.classList.add("ol-collapsed"),this.dispatchEvent({type:"show",show:!1})}toggle(){this.element.classList.toggle("ol-collapsed");var e=this.element.classList.contains("ol-collapsed");this.dispatchEvent({type:"show",show:!e})}isShown(){return!this.element.classList.contains("ol-collapsed")}getSelection(e,t){for(var i=[],o=Math.max(Math.min(e,t),0),s=Math.min(Math.max(e,t),this.tab_.length-1),r=o;r<=s;r++)i.push(this.tab_[r][3]);return i}_drawGraph(e,t){if(e.length){var i,o,s=this.canvas_.getContext("2d"),r=this.scale_[0],a=this.scale_[1],n=this.dy_,l=this.ratio;for(s.beginPath(),i=0;o=e[i];i++)0==i?s.moveTo(o[0]*r,o[1]*a+n):s.lineTo(o[0]*r,o[1]*a+n);t.getStroke()&&(s.strokeStyle=t.getStroke().getColor()||"#000",s.lineWidth=t.getStroke().getWidth()*l,s.setLineDash([]),s.stroke()),t.getFill()&&(s.fillStyle=t.getFill().getColor()||"#000",s.Style=t.getFill().getColor()||"#000",s.lineTo(e[e.length-1][0]*r,0),s.lineTo(e[0][0]*r,0),s.fill())}}setGeometry(e,t){if(t||(t={}),e instanceof ol.Feature&&(e=e.getGeometry()),this._geometry=[e,t],/Z/.test(e.getLayout())){/M/.test(e.getLayout())?this.element.querySelector(".time").parentElement.style.display="block":this.element.querySelector(".time").parentElement.style.display="none";var i=e.getCoordinates();switch(e.getType()){case"LineString":break;case"MultiLineString":i=i[0];break;default:return}var o,s,r,a,n,l,h,c=t.projection||this.getMap().getView().getProjection(),u=1/0,d=-1/0,g=this.tab_=[];for(o=0;s=i[o];o++)(a=s[2])d&&(d=a),0==o?r=0:r+=(l=i[o-1],h=s,ol.sphere.getDistance(ol.proj.transform(l,c,"EPSG:4326"),ol.proj.transform(h,c,"EPSG:4326"))),n=p(i[0][3],s[3]),g.push([r,a,n,s]);this._z=[u,d],this.set("graduation",t.graduation||100),this.set("zmin",t.zmin),this.set("zmax",t.zmax),this.set("amplitude",t.amplitude),this.set("unit",t.unit),this.set("zunit",t.zunit),this.set("zDigits",t.zDigits),this.set("zMaxChars",t.zMaxChars),this.dispatchEvent({type:"change:geometry",geometry:e}),this.refresh()}function p(e,t){if(!e||!t)return"-";var i=(t-e)/60,o=Math.trunc(i/60),s=Math.trunc(i-60*o);return o+"h"+(s<10?"0":"")+s+"mn"}}refresh(){var e=this.canvas_,t=e.getContext("2d"),i=e.width,o=e.height;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,i,o);var s,r=this._z[0],a=this._z[1],n=this.tab_,l=n[n.length-1][0],h=n[n.length-1][2];if(l){t.setTransform(1,0,0,1,this.margin_.left,o-this.margin_.bottom);var c=this.ratio;i-=this.margin_.right+this.margin_.left,o-=this.margin_.top+this.margin_.bottom,t.strokeStyle=this._style.getText().getFill().getColor()||"#000",t.lineWidth=.5*c,t.beginPath(),t.moveTo(0,0),t.lineTo(0,-o),t.moveTo(0,0),t.lineTo(i,0),t.stroke(),this.element.querySelector(".track-info .zmin").textContent=r.toFixed(2)+this.info.altitudeUnits,this.element.querySelector(".track-info .zmax").textContent=a.toFixed(2)+this.info.altitudeUnits,this.element.querySelector(".track-info .dist").textContent=l>1e3?(l/1e3).toFixed(1)+this.info.distanceUnitsKM:l.toFixed(1)+this.info.distanceUnitsM,this.element.querySelector(".track-info .time").textContent=h;for(var u=this.get("graduation");;){if(!(o/(((a=Math.ceil(a/u)*u)-(r=Math.floor(r/u)*u))/u)<15*c))break;u*=2}"number"==typeof this.get("zmin")&&r>this.get("zmin")&&(r=this.get("zmin")),"number"==typeof this.get("zmax")&&a1e3?(M=100*Math.round(l/1e3))>1e3&&(M=1e3*Math.ceil(M/1e3)):(C="m",M=l>100?10*Math.round(l/100):l>10?Math.round(l/10):l>1?Math.round(l)/10:l),s=0;s<=l;s+=M){var E="m"==C?s:s/1e3;t.fillText(Math.round(10*E)/10,s*g,4*c),t.moveTo(s*g,2*c),t.lineTo(s*g,0)}t.font=12*c+"px arial",t.fillText(this.info.xtitle.replace("(km)","("+C+")"),i/2,18*c),t.save(),t.rotate(-Math.PI/2),t.fillText(this.info.ytitle,o/2,-this.margin_.left),t.restore(),t.stroke()}else console.error("[ol/control/Profil] no data...",n)}getImage(e,t){return"canvas"===e?this.canvas_:this.canvas_.toDataURL(e,t)}},ol.control.Profil.prototype.info={zmin:"Zmin",zmax:"Zmax",ytitle:"Altitude (m)",xtitle:"Distance (km)",time:"Time",altitude:"Altitude",distance:"Distance",altitudeUnits:"m",distanceUnitsM:"m",distanceUnitsKM:"km"},ol.control.ProgressBar=class extends ol.control.Control{constructor(e){e=e||{};var t=ol.ext.element.create("DIV",{className:((e.className||"")+" ol-progress-bar ol-unselectable ol-control").trim()});super({element:t,target:e.target}),this._waiting=ol.ext.element.create("DIV",{html:e.label||"",className:"ol-waiting",parent:t}),this._bar=ol.ext.element.create("DIV",{className:"ol-bar",parent:t}),this._layerlistener=[],this.setLayers(e.layers)}setPercent(e){this._bar.style.width=100*(Number(e)||0)+"%",void 0===e?ol.ext.element.hide(this.element):ol.ext.element.show(this.element)}setLabel(e){this._waiting.innerHTML=e}setLayers(e){this._layerlistener.forEach(function(e){ol.Observable.unByKey(e)}),this._layerlistener=[],this.setPercent();var t,i=0,o=0;(e instanceof ol.layer.Layer&&(e=[e]),e&&e.forEach)&&e.forEach(function(e){e instanceof ol.layer.Layer&&(this._layerlistener.push(e.getSource().on("tileloadstart",function(){i++,this.setPercent(o/i),clearTimeout(t)}.bind(this))),this._layerlistener.push(e.getSource().on(["tileloadend","tileloaderror"],function(){++o===i?(i=o=0,this.setPercent(1),t=setTimeout(this.setPercent.bind(this),300)):this.setPercent(o/i)}.bind(this))))}.bind(this))}},ol.control.RoutingGeoportail=class extends ol.control.Control{constructor(e){null==(e=e||{}).typing&&(e.typing=300),e.apiKey=e.apiKey||"itineraire",e.search||(e.search={}),e.search.apiKey=e.search.apiKey||"essentiels";var t=document.createElement("DIV");super({element:t,target:e.target});var i=this;this._classname=e.className||"search",this._source=new ol.source.Vector,this._auth=e.authentication;var o=(e.className||"")+" ol-routing";(e.target||(o+=" ol-unselectable ol-control"),t.setAttribute("class",o),e.target)||ol.ext.element.create("BUTTON",{parent:t}).addEventListener("click",function(){t.classList.toggle("ol-collapsed")});this.set("url","https://wxs.ign.fr/calcul/geoportail/"+e.apiKey+"/rest/1.0.0/route");var s=ol.ext.element.create("DIV",{className:"content",parent:t}),r=ol.ext.element.create("DIV",{className:"search-input",parent:s});this._search=[],this.addSearch(r,e),this.addSearch(r,e),ol.ext.element.create("I",{className:"ol-car",title:e.carlabel||"by car",parent:s}).addEventListener("click",function(){i.setMode("car")}),ol.ext.element.create("I",{className:"ol-pedestrian",title:e.pedlabel||"pedestrian",parent:s}).addEventListener("click",function(){i.setMode("pedestrian")}),ol.ext.element.create("I",{className:"ol-ok",title:e.runlabel||"search",html:"OK",parent:s}).addEventListener("click",function(){i.calculate()}),ol.ext.element.create("I",{className:"ol-cancel",html:"cancel",parent:s}).addEventListener("click",function(){this.resultElement.innerHTML=""}.bind(this)),this.resultElement=document.createElement("DIV"),this.resultElement.setAttribute("class","ol-result"),t.appendChild(this.resultElement),this.setMode(e.mode||"car"),this.set("timeout",e.timeout||2e4)}setMode(e,t){this.set("mode",e),this.element.querySelector(".ol-car").classList.remove("selected"),this.element.querySelector(".ol-pedestrian").classList.remove("selected"),this.element.querySelector(".ol-"+e).classList.add("selected"),t||this.calculate()}setMethod(e,t){this.set("method",e),t||this.calculate()}addButton(e,t,i){var o=document.createElement("I");return o.setAttribute("class",e),o.setAttribute("type","button"),o.setAttribute("title",t),o.innerHTML=i||"",this.element.appendChild(o),o}getSource(){return this._source}_resetArray(e){this._search=[];var t=e.parentNode.querySelectorAll(".search-input > div");t.forEach(function(e){e.olsearch&&(e.olsearch.get("feature")&&(e.olsearch.get("feature").set("step",this._search.length),0===this._search.length?e.olsearch.get("feature").set("pos","start"):this._search.length===t.length-1?e.olsearch.get("feature").set("pos","end"):e.olsearch.get("feature").set("pos","")),this._search.push(e.olsearch))}.bind(this))}removeSearch(e,t,i){e.removeChild(i),i.olsearch.get("feature")&&this._source.removeFeature(i.olsearch.get("feature")),this.getMap()&&this.getMap().removeControl(i.olsearch),this._resetArray(e)}addSearch(e,t,i){var o=this,s=ol.ext.element.create("DIV");i?e.insertBefore(s,i.nextSibling):e.appendChild(s),ol.ext.element.create("BUTTON",{title:t.startlabel||"add/remove",parent:s}).addEventListener("click",function(i){i.ctrlKey?this._search.length>2&&this.removeSearch(e,t,s):i.shiftKey&&this.addSearch(e,t,s)}.bind(this));var r=s.olsearch=new ol.control.SearchGeoportail({className:"IGNF ol-collapsed",apiKey:t.search.apiKey,authentication:t.search.authentication,target:s,reverse:!0});r._changeCounter=0,this._resetArray(e),r.on("select",function(e){r.setInput(e.search.fulltext);var t=r.get("feature");t?(r.checkgeom=!1,e.silent||t.getGeometry().setCoordinates(e.coordinate),r.checkgeom=!0):(t=new ol.Feature(new ol.geom.Point(e.coordinate)),r.set("feature",t),this._source.addFeature(t),r.checkgeom=!0,t.getGeometry().on("change",function(){r.checkgeom&&this.onGeometryChange(r,t)}.bind(this))),t.set("name",r.getTitle(e.search)),t.set("step",this._search.indexOf(r)),0===t.get("step")?t.set("pos","start"):t.get("step")===this._search.length-1&&t.set("pos","end"),r.set("selection",e.search)}.bind(this)),r.element.querySelector("input").addEventListener("change",function(){r.set("selection",null),o.resultElement.innerHTML=""}),this.getMap()&&this.getMap().addControl(r)}onGeometryChange(e,t,i){var o=ol.proj.transform(t.getGeometry().getCoordinates(),this.getMap().getView().getProjection(),"EPSG:4326");if(e._handleSelect({x:o[0],y:o[1],fulltext:o[0].toFixed(6)+","+o[1].toFixed(6)},!0,{silent:!0}),i){if(e._changeCounter--,!e._changeCounter)return void e.reverseGeocode(t.getGeometry().getCoordinates(),{silent:!0})}else e._changeCounter++,setTimeout(function(){this.onGeometryChange(e,t,!0)}.bind(this),1e3)}setMap(e){super.setMap(e);for(var t=0;t"+r+(t?" - "+t:"")+"",on:{pointerenter:function(){this.dispatchEvent({type:"step:hover",hover:!1,index:i,feature:e})}.bind(this),pointerleave:function(){this.dispatchEvent({type:"step:hover",hover:!1,index:i,feature:e})}.bind(this)},click:function(){this.dispatchEvent({type:"step:select",index:i,feature:e})}.bind(this),parent:o})}.bind(this))}handleResponse(e,t,i){if("ERROR"!==e.status){for(var o,s,r,a={type:"routing",features:[]},n=0,l=0,h=new ol.format.GeoJSON,c=0;r=e.portions[c];c++)for(var u,d=0;u=r.steps[d];d++){u.type="Feature",u.properties=u.attributes.name||u.attributes,u.properties.distance=u.distance,u.properties.duration=Math.round(60*u.duration),u.instruction&&(u.properties.instruction_type=u.instruction.type,u.properties.instruction_modifier=u.instruction.modifier),n+=u.distance,l+=u.duration,u.properties.distanceT=Math.round(100*n)/100,u.properties.durationT=Math.round(60*l),u.properties.name=u.properties.cpx_toponyme_route_nommee||u.properties.cpx_toponyme||u.properties.cpx_numero||u.properties.nom_1_droite||u.properties.nom_1_gauche||"";var g=u.geometry.coordinates[u.geometry.coordinates.length-1];s&&!ol.coordinate.equal(g,u.geometry.coordinates[u.geometry.coordinates.length-1])&&u.geometry.coordinates.unshift(s),s=u.geometry.coordinates[u.geometry.coordinates.length-1],o=h.readFeature(u,{featureProjection:this.getMap().getView().getProjection()}),a.features.push(o)}a.distance=parseFloat(e.distance),a.duration=parseFloat(e.duration)/60;var p=h.readGeometry(e.geometry,{featureProjection:this.getMap().getView().getProjection()});return a.feature=new ol.Feature({geometry:p,start:this._search[0].getTitle(t),end:this._search[0].getTitle(i),distance:a.distance,duration:a.duration}),this.dispatchEvent(a),this.path=a,a}this.dispatchEvent({type:"errror",status:"200",statusText:e.message})}abort(){this._request&&(this._request.abort(),this._request=null,this.dispatchEvent({type:"abort"}))}calculate(e){if(this.resultElement.innerHTML="",e){var t=[];e.forEach(function(e){t.push({x:e[0],y:e[1]})}),e=t}else{e=[];for(var i=0;i=200&&e.status<400?h.listRouting(h.handleResponse(JSON.parse(e.response),o,s)):this.dispatchEvent({type:"error",status:e.status,statusText:e.statusText})}.bind(this),function(e){this.dispatchEvent({type:"error",status:e.status,statusText:e.statusText})}.bind(this)),!0}ajax(e,t,i){var o=this;this._request&&this._request.abort();var s=this._request=new XMLHttpRequest;s.open("GET",e,!0),s.timeout=this.get("timeout")||2e4,this._auth&&s.setRequestHeader("Authorization","Basic "+this._auth),this.element.classList.add("ol-searching"),s.onload=function(){o._request=null,o.element.classList.remove("ol-searching"),t.call(o,this)},s.ontimeout=function(){o._request=null,o.element.classList.remove("ol-searching"),i&&i.call(o,this)},s.onerror=function(){o._request=null,o.element.classList.remove("ol-searching"),i&&i.call(o,this)},s.send()}},ol.control.Scale=class extends ol.control.Control{constructor(e){void 0===(e=e||{}).typing&&(e.typing=300);var t=document.createElement("DIV"),i=(e.className||"")+" ol-scale";e.target||(i+=" ol-unselectable ol-control"),super({element:t,target:e.target}),this._input=document.createElement("INPUT"),this._input.value="-",t.setAttribute("class",i),!1===e.editable&&(this._input.readOnly=!0),t.appendChild(this._input),this._input.addEventListener("change",this.setScale.bind(this)),this.set("ppi",e.ppi||96)}setMap(e){this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,super.setMap(e),e&&(this._listener=e.on("moveend",this.getScale.bind(this)))}getScale(){var e=this.getMap();if(e){var t=ol.sphere.getMapScale(e,this.get("ppi"));return this._input.value=this.formatScale(t),t}}formatScale(e){return"1 / "+(e=e>100?100*Math.round(e/100):Math.round(e)).toLocaleString()}setScale(e){var t=this.getMap();t&&e&&(e.target&&(e=e.target.value),ol.sphere.setMapScale(t,e,this.get("ppi"))),this.getScale()}},ol.control.SearchBAN=class extends ol.control.SearchPhoton{constructor(e){(e=e||{}).typing=e.typing||500,e.url=e.url||"https://api-adresse.data.gouv.fr/search/",e.className=e.className||"BAN",e.copy='© BAN-data.gouv.fr',super(e),this.set("postcode",e.postcode),this.set("citycode",e.citycode),this.set("type",e.type)}getTitle(e){return e.properties.label}select(e){var t=e.geometry.coordinates;try{t=ol.proj.transform(e.geometry.coordinates,"EPSG:4326",this.getMap().getView().getProjection())}catch(e){}this.dispatchEvent({type:"select",search:e,coordinate:t})}requestData(e){var t=super.requestData(e);return t.postcode=this.get("postcode"),t.citycode=this.get("citycode"),t.type=this.get("type"),t}},ol.control.SearchDFCI=class extends ol.control.Search{constructor(e){(e=e||{}).className=e.className||"dfci",e.placeholder=e.placeholder||"Code DFCI",super(e)}autocomplete(e){if((e=(e=e.toUpperCase()).replace(/[^0-9,^A-H,^K-N]/g,"")).length<2)return this.setInput(e),[];var t,i=this.getMap().getView().getProjection(),o=[],s=ol.coordinate.fromDFCI(e,i),r=Math.floor(e.length/2)-1,a=ol.coordinate.toDFCI(s,r,i);if(a=a.replace(/[^0-9,^A-H,^K-N]/g,""),!/NaN/.test(a)&&a){if(console.log("ok",a),this.setInput(a+e.substring(a.length,e.length)),o.push({coordinate:ol.coordinate.fromDFCI(a,i),name:a}),5===e.length)for(s=ol.coordinate.fromDFCI(e+0,i),a=ol.coordinate.toDFCI(s,r+1,i).substring(0,5),t=0;t<10;t++)o.push({coordinate:ol.coordinate.fromDFCI(a+t,i),name:a+t});if(2===r)for(t=0;t<6;t++)o.push({coordinate:ol.coordinate.fromDFCI(a+"."+t,i),name:a+"."+t})}return o}},ol.control.SearchFeature=class extends ol.control.Search{constructor(e){(e=e||{}).className=e.className||"feature",super(e),"function"==typeof e.getSearchString&&(this.getSearchString=e.getSearchString),this.set("property",e.property||"name"),this.source_=e.source,this._sort=e.sort}restoreHistory(){this.set("history",[])}saveHistory(){try{localStorage.removeItem("ol@search-"+this._classname)}catch(e){console.warn("Failed to access localStorage...")}}getTitle(e){return e.get(this.get("property")||"name")}getSearchString(e){return this.getTitle(e)}getSource(){return this.source_}setSource(e){this.source_=e}setSortFunction(e){this._sort=e}autocomplete(e){var t=[];if(this.source_){e=e.replace(/^\*/,"");for(var i,o=new RegExp(e,"i"),s=this.source_.getFeatures(),r=this.get("maxItems"),a=0;i=s[a];a++){var n=this.getSearchString(i);if(void 0!==n&&o.test(n)&&(t.push(i),--r<=0))break}}return"function"==typeof this._sort&&(t=t.sort(this._sort)),t}},ol.control.SearchGPS=class extends ol.control.Search{constructor(e){(e=e||{}).className=(e.className||"")+" ol-searchgps",e.placeholder=e.placeholder||"lon,lat",super(e),this.geolocation=new ol.Geolocation({projection:"EPSG:4326",trackingOptions:{maximumAge:1e4,enableHighAccuracy:!0,timeout:6e5}}),ol.ext.element.create("BUTTON",{className:"ol-geoloc",title:"Locate with GPS",parent:this.element,click:function(){this.geolocation.setTracking(!0)}.bind(this)}),ol.ext.element.createSwitch({html:"decimal",after:"DMS",change:function(e){e.target.checked?this.element.classList.add("ol-dms"):this.element.classList.remove("ol-dms")}.bind(this),parent:this.element}),this._createForm();var t=this.element.querySelector("ul.autocomplete");this.element.appendChild(t)}_createForm(){var e=function(e){if(e.target.classList.contains("ol-dms")&&(o.value=(s.value<0?-1:1)*Number(s.value)+Number(r.value)/60+Number(a.value)/3600,o.value=(s.value<0?-1:1)*Math.round(1e7*o.value)/1e7,n.value=(l.value<0?-1:1)*Number(l.value)+Number(h.value)/60+Number(c.value)/3600,n.value=(l.value<0?-1:1)*Math.round(1e7*n.value)/1e7),o.value||n.value?this._input.value=o.value+","+n.value:this._input.value="",!e.target.classList.contains("ol-dms")){var t=ol.coordinate.toStringHDMS([Number(o.value),Number(n.value)]),i=t.replace(/(N|S|E|W)/g,"").split("″");i[1]=i[1].trim().split(" "),s.value=(/W/.test(t)?-1:1)*parseInt(i[1][0]),r.value=parseInt(i[1][1]),a.value=parseInt(i[1][2]),i[0]=i[0].trim().split(" "),l.value=(/W/.test(t)?-1:1)*parseInt(i[0][0]),h.value=parseInt(i[0][1]),c.value=parseInt(i[0][2])}this.search()}.bind(this);function t(t,o){var s=ol.ext.element.create("INPUT",{className:t,type:"number",step:"any",lang:"en",parent:i,on:{"change keyup":e}});return o&&ol.ext.element.create("SPAN",{className:"ol-dms",html:o,parent:i}),s}var i=ol.ext.element.create("DIV",{className:"ol-longitude",parent:this.element});ol.ext.element.create("LABEL",{html:"Longitude",parent:i});var o=t("ol-decimal"),s=t("ol-dms","°"),r=t("ol-dms","'"),a=t("ol-dms",'"');i=ol.ext.element.create("DIV",{className:"ol-latitude",parent:this.element}),ol.ext.element.create("LABEL",{html:"Latitude",parent:i});var n=t("ol-decimal"),l=t("ol-dms","°"),h=t("ol-dms","'"),c=t("ol-dms",'"');this.button&&this.button.addEventListener("click",function(){o.focus()}),this.on("select",function(e){o.value=e.search.gps[0],n.value=e.search.gps[1]}.bind(this)),this.geolocation.on("change",function(){this.geolocation.setTracking(!1);var e=this.geolocation.getPosition();o.value=e[0],n.value=e[1],this._triggerCustomEvent("keyup",o)}.bind(this))}autocomplete(e){var t=[],i=e.split(",");i[0]=Number(i[0]),i[1]=Number(i[1]),(e=ol.coordinate.toStringHDMS(i))&&(e=e.replace(/(°|′|″) /g,"$1"));var o=ol.proj.transform([i[0],i[1]],"EPSG:4326",this.getMap().getView().getProjection());return t.push({gps:i,coordinate:o,name:e}),t}},ol.control.SearchGeoportailParcelle=class extends ol.control.SearchGeoportail{constructor(e){e.type="Commune",e.className=(e.className?e.className:"")+" IGNF-parcelle ol-collapsed-list ol-collapsed-num",e.inputLabel="Commune",e.noCollapse=!0,e.placeholder=e.placeholder||"Choisissez une commune...",super(e),this.set("copy",null);var t=this.element,i=this,o=document.createElement("DIV");t.appendChild(o);var s,r=document.createElement("LABEL");r.innerText="Préfixe",o.appendChild(r),(r=document.createElement("LABEL")).innerText="Section",o.appendChild(r),(r=document.createElement("LABEL")).innerText="Numéro",o.appendChild(r),o.appendChild(document.createElement("BR")),this._inputParcelle={prefix:document.createElement("INPUT"),section:document.createElement("INPUT"),numero:document.createElement("INPUT")},this._inputParcelle.prefix.setAttribute("maxlength",3),this._inputParcelle.section.setAttribute("maxlength",2),this._inputParcelle.numero.setAttribute("maxlength",4);var a=function(){s&&clearTimeout(s),s=setTimeout(function(){i.autocompleteParcelle()},e.typing||0)};for(var n in this._inputParcelle)o.appendChild(this._inputParcelle[n]),this._inputParcelle[n].addEventListener("keyup",a),this._inputParcelle[n].addEventListener("blur",function(){s=setTimeout(function(){t.classList.add("ol-collapsed-num")},200)}),this._inputParcelle[n].addEventListener("focus",function(){clearTimeout(s),t.classList.remove("ol-collapsed-num")});this.activateParcelle(!1);var l=document.createElement("DIV");l.className="autocomplete-parcelle",t.appendChild(l);var h=document.createElement("UL");h.classList.add("autocomplete-parcelle"),l.appendChild(h),(h=document.createElement("UL")).classList.add("autocomplete-page"),l.appendChild(h),this._input.addEventListener("blur",function(){setTimeout(function(){t.classList.add("ol-collapsed-list")},200)}),this._input.addEventListener("focus",function(){t.classList.remove("ol-collapsed-list"),i._listParcelle([]),i._commune&&(i._commune=null,i._input.value="",i.drawList_()),i.activateParcelle(!1)}),this.on("select",this.selectCommune.bind(this)),this.set("pageSize",e.pageSize||5)}selectCommune(e){this._commune=e.search.insee||e.sear,this._input.value=e.search.insee+" - "+e.search.fulltext,this.activateParcelle(!0),this._inputParcelle.numero.focus(),this.autocompleteParcelle()}setParcelle(e,t){this._inputParcelle.prefix.value=(e.Commune||"")+(e.CommuneAbsorbee||""),this._inputParcelle.section.value=e.Section||"",this._inputParcelle.numero.value=e.Numero||"",t&&this._triggerCustomEvent("keyup",this._inputParcelle.prefix)}activateParcelle(e){for(var t in this._inputParcelle)this._inputParcelle[t].readOnly=!e;e?this._inputParcelle.section.parentElement.classList.add("ol-active"):this._inputParcelle.section.parentElement.classList.remove("ol-active")}autocompleteParcelle(){function e(e,t,i){if(!e)return e;for(i=i||"0";e.length";this.ajax(this.get("url").replace("ols/apis/completion","geoportail/ols"),{xls:a},function(e){for(var t,i=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("GeocodedAddress"),o=[],r=0;t=i[r];r++){for(var a,n=(t.getElementsByTagName("gml:pos")[0]||t.getElementsByTagName("pos")[0]).childNodes[0].nodeValue.split(" "),l=t.getElementsByTagName("Place"),h={lon:Number(n[1]),lat:Number(n[0])},c=0;a=l[c];c++)h[a.attributes.type.value]=a.childNodes[0].nodeValue;o.push(h)}console.log(o),s(o)},{dataType:"XML"})}else this.ajax(r+"?index=parcel&q=&departmentcode="+e.substr(0,2)+"&municipalitycode="+e.substr(-3)+(t?"&oldmunicipalitycode="+t.replace(/_/g,"0"):"")+(i?"§ion="+i:"")+(o?"&number="+o:"")+"&limit=20",{},function(e){var t=[];e.features.forEach(function(e){var i=e.properties;t.push({id:i.id,INSEE:i.departmentcode+i.municipalitycode,Commune:i.municipalitycode,Departement:i.departmentcode,CommuneAbsorbee:i.oldmunicipalitycode,Section:i.section,Numero:i.number,Municipality:i.city,Feuille:i.sheet,lon:e.geometry.coordinates[0],lat:e.geometry.coordinates[1]})}),s(t)})}_listParcelle(e){var t=this,i=this.element.querySelector("ul.autocomplete-parcelle");i.innerHTML="";var o=this.element.querySelector("ul.autocomplete-page");function s(e){var t,s=i.children,r="ol-list-"+e;for(t=0;t1?"":"none"}o.innerHTML="",this._listParc=[],e.sort(function(e,t){var i=e.INSEE+e.CommuneAbsorbee+e.Section+e.Numero,o=t.INSEE+t.CommuneAbsorbee+t.Section+t.Numero;return i===o?0:i0&&l.classList.add("ol-list-"+Math.floor(n/a)),this._listParc.push(r),l.addEventListener("click",function(e){t._handleParcelle(t._listParc[e.currentTarget.getAttribute("data-search")])}),l.innerHTML=r.INSEE+r.CommuneAbsorbee+r.Section+r.Numero,i.appendChild(l),a>0&&!(n%a)&&((l=document.createElement("LI")).innerText=Math.floor(n/a),l.addEventListener("click",function(e){s(e.currentTarget.innerText)}),o.appendChild(l))}a>0&&s(0)}_handleParcelle(e){this.dispatchEvent({type:"parcelle",search:e,coordinate:ol.proj.fromLonLat([e.lon,e.lat],this.getMap().getView().getProjection())})}},ol.control.SearchNominatim=class extends ol.control.SearchJSON{constructor(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=ol.proj.transform(t,"EPSG:4326",this.getMap().getView().getProjection())}catch(e){}this.dispatchEvent({type:"select",search:e,coordinate:t})}reverseGeocode(e,t){var i=ol.proj.transform(e,this.getMap().getView().getProjection(),"EPSG:4326");this.ajax(this.get("url").replace("search","reverse"),{lon:i[0],lat:i[1],format:"json"},function(e){t?t.call(this,[e]):e&&!e.error&&this._handleSelect(e,!0)}.bind(this))}handleResponse(e){return e.results||e}},ol.control.SearchWikipedia=class extends ol.control.SearchJSON{constructor(e){(e=e||{}).lang=e.lang||"en",e.className=e.className||"ol-search-wikipedia",e.url="https://"+e.lang+".wikipedia.org/w/api.php",e.placeholder=e.placeholder||"search string, File:filename",e.copy='Wikipedia® - CC-By-SA',super(e),this.set("lang",e.lang)}getTitle(e){return ol.ext.element.create("DIV",{html:e.title,title:e.desc})}setLang(e){this.set("lang",e),this.set("url","https://"+e+".wikipedia.org/w/api.php")}requestData(e){return{action:"opensearch",search:e,lang:this.get("lang"),format:"json",origin:"*",limit:this.get("maxItems")}}handleResponse(e){for(var t=[],i=0;i100));l++);var h=new RegExp(e,"i");for(var c in o)if("geometry"!==c&&h.test(c)){var u=document.createElement("li");u.textContent=c,u.addEventListener("click",function(){t.previousElementSibling.value=this.textContent;var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),t.previousElementSibling.dispatchEvent(e),t.classList.add("ol-hidden")}),t.appendChild(u)}}_getLiCondition(e){var t=this,i=document.createElement("li"),o=document.createElement("div");o.classList.add("ol-autocomplete"),o.addEventListener("mouseleave",function(){this.querySelector("ul").classList.add("ol-hidden")}),i.appendChild(o);var s=document.createElement("input");s.classList.add("ol-attr"),s.setAttribute("type","search"),s.setAttribute("placeholder",this.get("attrPlaceHolder")),s.addEventListener("keyup",function(){t._autocomplete(this.value,this.nextElementSibling)}),s.addEventListener("focusout",function(){setTimeout(function(){o.querySelector("ul").classList.add("ol-hidden")},300)}),s.addEventListener("click",function(){setTimeout(function(){t._autocomplete(this.value,this.nextElementSibling),this.nextElementSibling.classList.remove("ol-hidden")}.bind(this))}),s.addEventListener("change",function(){t._conditions[e].attr=this.value}),s.value=t._conditions[e].attr,o.appendChild(s);var r=document.createElement("ul");r.classList.add("ol-hidden"),o.appendChild(r);var a=document.createElement("select");for(var n in i.appendChild(a),this.operationsList){var l=document.createElement("option");l.value=n,l.textContent=this.operationsList[n],a.appendChild(l)}a.value=t._conditions[e].op,a.addEventListener("change",function(){t._conditions[e].op=this.value});var h=document.createElement("input");if(h.setAttribute("type","text"),h.setAttribute("placeholder",this.get("valuePlaceHolder")),h.addEventListener("change",function(){t._conditions[e].val=this.value}),h.value=t._conditions[e].val,i.appendChild(h),this._conditions.length>1){var c=document.createElement("div");c.classList.add("ol-delete"),c.addEventListener("click",function(){t.removeCondition(e)}),i.appendChild(c)}return i}removeCondition(e){this._conditions.splice(e,1),this._drawlist()}doSelect(e){return(e=e||{}).useCase=e.useCase||this._useCase.checked,e.matchAll=e.matchAll||this._all.checked,e.conditions=e.conditions||this._conditions,super.doSelect(e)}},ol.control.SelectCheck=class extends ol.control.SelectBase{constructor(e){var t=(e=e||{}).content=ol.ext.element.create("DIV");e.label&&ol.ext.element.create("LABEL",{html:e.label,parent:t}),e.className=e.className||"ol-select-check",super(e);var i=t.querySelector("button");this._input=ol.ext.element.create("DIV",{parent:t}),t.appendChild(i),this.set("property",e.property||"name"),this.set("max",e.max||1e4),this.set("defaultLabel",e.defaultLabel),this.set("type",e.type),this._selectAll=e.selectAll,this._onchoice=e.onchoice,e.values?this.setValues({values:e.values,sort:!0}):this.setValues()}setMap(e){super.setMap(e),this.setValues()}doSelect(e){e=e||{};var t=[];return this._checks.forEach(function(e){e.checked&&e.value&&t.push({attr:this.get("property"),op:"=",val:e.value})}.bind(this)),t.length?super.doSelect({features:e.features,conditions:t}):super.doSelect({features:e.features,matchAll:this._selectAll})}setValues(e){var t,i;if((e=e||{}).values)e.values instanceof Array?(i={},e.values.forEach(function(e){i[e]=e})):i=e.values;else{i={};var o=this.get("property");this.getSources().forEach(function(e){for(var t=e.getFeatures(),s=Math.min(t.length,this.get("max")),r=0;r "+e[i]+"
";ol.ext.element.setHTML(this.element,t)}else ol.ext.element.hide(this.element)}setPosition(e){this.element.classList.remove("ol-left"),this.element.classList.remove("ol-right"),this.element.classList.remove("ol-bottom"),this.element.classList.remove("ol-center"),/^left$|^right$|^bottom$|^center$/.test(e)&&this.element.classList.add("ol-"+e)}show(e){!1===e?ol.ext.element.hide(this.element):ol.ext.element.show(this.element)}hide(){ol.ext.element.hide(this.element)}toggle(){ol.ext.element.toggle(this.element)}isShown(){return"none"===this.element.style.display}},ol.control.Storymap=class extends ol.control.Control{constructor(e){e.target&&(e.html?e.html instanceof Element&&(e.html=e.html.innerHTML):e.html=e.target.innerHTML,e.target.innerHTML="");var t=ol.ext.element.create("DIV",{className:(e.className||"")+" ol-storymap"+(e.target?"":" ol-unselectable ol-control")});super({element:t,target:e.target}),this.content=ol.ext.element.create("DIV",{parent:t}),ol.ext.element.scrollDiv(this.content,{vertical:!0,mousewheel:!0,minibar:e.minibar}),this.setStory(e.html)}setChapter(e){for(var t,i=this.content.querySelectorAll(".chapter"),o=0;t=i[o];o++)t.getAttribute("name")===e&&(this.content.scrollTop=t.offsetTop-30)}setStory(e){e instanceof Element?(this.content.innerHTML="",this.content.appendChild(e)):this.content.innerHTML=e,this.content.querySelectorAll(".chapter").forEach(function(e){e.addEventListener("click",function(t){e.classList.contains("ol-select")?"IMG"===t.target.tagName&&t.target.dataset.title&&this.dispatchEvent({coordinate:this.getMap()?this.getMap().getCoordinateFromPixel([t.layerX,t.layerY]):null,type:"clickimage",img:t.target,title:t.target.dataset.title,element:e,name:e.getAttribute("name"),originalEvent:t}):(this.content.scrollTop=e.offsetTop-30,t.preventDefault())}.bind(this))}.bind(this));var t=this.content.querySelectorAll(".ol-scroll-next");t.forEach(function(e){e.addEventListener("click",function(t){if(e.parentElement.classList.contains("ol-select")){for(var i,o=this.content.querySelectorAll(".chapter"),s=e.offsetTop,r=0;i=o[r];r++)if(i.offsetTop>s){s=i.offsetTop;break}this.content.scrollTop=s-30,t.stopPropagation(),t.preventDefault()}}.bind(this))}.bind(this)),(t=this.content.querySelectorAll(".ol-scroll-top")).forEach(function(e){e.addEventListener("click",function(e){this.content.scrollTop=0,e.stopPropagation(),e.preventDefault()}.bind(this))}.bind(this));var i=function(e){var t=[parseFloat(e.getAttribute("data-lon")),parseFloat(e.getAttribute("data-lat"))],i=ol.proj.fromLonLat(t,this.getMap().getView().getProjection()),o=parseFloat(e.getAttribute("data-zoom"));return{type:"scrollto",element:e,name:e.getAttribute("name"),coordinate:i,lon:t,zoom:o}}.bind(this),o=this.content.querySelectorAll(".chapter")[0];setTimeout(function(){o.classList.add("ol-select"),this.dispatchEvent(i(o))}.bind(this)),this.content.addEventListener("scroll",function(){var e,t=this.content.querySelectorAll(".chapter"),s=ol.ext.element.getStyle(this.content,"height");if(this.content.scrollTop)for(var r,a=0;r=t[a];a++){if(r.offsetTop-this.content.scrollTop>s/3)break;e=r}else e=t[0];if(e&&e!==o){o&&o.classList.remove("ol-select"),(o=e).classList.add("ol-select");var n=i(o),l=this.getMap().getView();switch(l.cancelAnimations(),o.getAttribute("data-animation")){case"flyto":l.flyTo({center:n.coordinate,zoomAt:Math.min(l.getZoom(),n.zoom)-1,zoom:n.zoom})}this.dispatchEvent(n)}}.bind(this))}},ol.control.Swipe=class extends ol.control.Control{constructor(e){e=e||{};var t=document.createElement("div");super({element:t}),t.className=(e.className||"ol-swipe")+" ol-unselectable ol-control";var i=document.createElement("button");t.appendChild(i),t.addEventListener("mousedown",this.move.bind(this)),t.addEventListener("touchstart",this.move.bind(this)),this.precomposeRight_=this.precomposeRight.bind(this),this.precomposeLeft_=this.precomposeLeft.bind(this),this.postcompose_=this.postcompose.bind(this),this.layers=[],e.layers&&this.addLayer(e.layers,!1),e.rightLayers&&this.addLayer(e.rightLayers,!0),this.on("propertychange",function(e){if(this.getMap())try{this.getMap().renderSync()}catch(e){}"horizontal"===this.get("orientation")?(this.element.style.top=100*this.get("position")+"%",this.element.style.left=""):("vertical"!==this.get("orientation")&&this.set("orientation","vertical"),this.element.style.left=100*this.get("position")+"%",this.element.style.top=""),"orientation"===e.key&&(this.element.classList.remove("horizontal","vertical"),this.element.classList.add(this.get("orientation"))),this.isMoving||this.layers.forEach(function(e){e.layer.getImageRatio&&e.layer.changed()})}.bind(this)),this.set("position",e.position||.5),this.set("orientation",e.orientation||"vertical")}setMap(e){var t,i;if(this.getMap()){for(t=0;t=0&&this.getMap()&&(this.layers[i].right?e[t].un(["precompose","prerender"],this.precomposeRight_):e[t].un(["precompose","prerender"],this.precomposeLeft_),e[t].un(["postcompose","postrender"],this.postcompose_),this.layers.splice(i,1))}if(this.getMap())try{this.getMap().renderSync()}catch(e){}}getRectangle(){var e;return"vertical"===this.get("orientation")?[0,0,(e=this.getMap().getSize())[0]*this.get("position"),e[1]]:[0,0,(e=this.getMap().getSize())[0],e[1]*this.get("position")]}move(e){var t,i=this;switch(this._movefn||(this._movefn=this.move.bind(this)),e.type){case"touchcancel":case"touchend":case"mouseup":i.isMoving=!1,["mouseup","mousemove","touchend","touchcancel","touchmove"].forEach(function(e){document.removeEventListener(e,i._movefn)}),this.layers.forEach(function(e){e.layer.getImageRatio&&e.layer.changed()});break;case"mousedown":case"touchstart":i.isMoving=!0,["mouseup","mousemove","touchend","touchcancel","touchmove"].forEach(function(e){document.addEventListener(e,i._movefn)});case"mousemove":case"touchmove":if(i.isMoving)if("vertical"===i.get("orientation")){var o=e.pageX||e.touches&&e.touches.length&&e.touches[0].pageX||e.changedTouches&&e.changedTouches.length&&e.changedTouches[0].pageX;if(!o)break;o-=i.getMap().getTargetElement().getBoundingClientRect().left+window.pageXOffset-document.documentElement.clientLeft;var s=(t=i.getMap().getSize()[0])-Math.min(Math.max(0,t-o),t);t=s/t,i.set("position",t),i.dispatchEvent({type:"moving",size:[s,i.getMap().getSize()[1]],position:[t,0]})}else{var r=e.pageY||e.touches&&e.touches.length&&e.touches[0].pageY||e.changedTouches&&e.changedTouches.length&&e.changedTouches[0].pageY;if(!r)break;r-=i.getMap().getTargetElement().getBoundingClientRect().top+window.pageYOffset-document.documentElement.clientTop;var a=(t=i.getMap().getSize()[1])-Math.min(Math.max(0,t-r),t);t=a/t,i.set("position",t),i.dispatchEvent({type:"moving",size:[i.getMap().getSize()[0],a],position:[0,t]})}}}_transformPt(e,t){var i=e.inversePixelTransform,o=t[0],s=t[1];return t[0]=i[0]*o+i[2]*s+i[4],t[1]=i[1]*o+i[3]*s+i[5],t}_drawRect(e,t){var i=e.inversePixelTransform;if(i){var o=[[t[0][0],t[0][1]],[t[0][0],t[1][1]],[t[1][0],t[1][1]],[t[1][0],t[0][1]],[t[0][0],t[0][1]]];if(e.context.save(),e.target.getImageRatio){var s=-Math.atan2(e.frameState.pixelToCoordinateTransform[1],e.frameState.pixelToCoordinateTransform[0]);e.context.translate(e.frameState.size[0]/2,e.frameState.size[1]/2),e.context.rotate(s),e.context.translate(-e.frameState.size[0]/2,-e.frameState.size[1]/2)}o.forEach(function(t,o){t=[t[0]*i[0]-t[1]*i[1]+i[4],-t[0]*i[2]+t[1]*i[3]+i[5]],o?e.context.lineTo(t[0],t[1]):e.context.moveTo(t[0],t[1])}),e.context.restore()}else{var r=e.frameState.pixelRatio;e.context.rect(t[0][0]*r,t[0][1]*r,t[1][0]*r,t[1][1]*r)}}precomposeLeft(e){var t=e.context;if(t instanceof WebGLRenderingContext){if("prerender"===e.type){t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.enable(t.SCISSOR_TEST);var i,o,s=this.getMap().getSize(),r=this._transformPt(e,[0,s[1]]),a=this._transformPt(e,[s[0],0]),n=a[0]-r[0],l=a[1]-r[1];"vertical"===this.get("orientation")?(i=Math.round(n*this.get("position")),o=l):(i=n,o=Math.round(l*this.get("position")),r[1]+=l-o),t.scissor(r[0],r[1],i,o)}}else{var h=e.frameState.size;t.save(),t.beginPath();var c=[[0,0],[h[0],h[1]]];"vertical"===this.get("orientation")?c[1]=[.5*h[0]+this.getMap().getSize()[0]*(this.get("position")-.5),h[1]]:c[1]=[h[0],.5*h[1]+this.getMap().getSize()[1]*(this.get("position")-.5)],this._drawRect(e,c),t.clip()}}precomposeRight(e){var t=e.context;if(t instanceof WebGLRenderingContext){if("prerender"===e.type){t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.enable(t.SCISSOR_TEST);var i,o,s=this.getMap().getSize(),r=this._transformPt(e,[0,s[1]]),a=this._transformPt(e,[s[0],0]),n=a[0]-r[0],l=a[1]-r[1];"vertical"===this.get("orientation")?(o=l,i=Math.round(n*(1-this.get("position"))),r[0]+=n-i):(i=n,o=Math.round(l*(1-this.get("position")))),t.scissor(r[0],r[1],i,o)}}else{var h=e.frameState.size;t.save(),t.beginPath();var c=[[0,0],[h[0],h[1]]];"vertical"===this.get("orientation")?c[0]=[.5*h[0]+this.getMap().getSize()[0]*(this.get("position")-.5),0]:c[0]=[0,.5*h[1]+this.getMap().getSize()[1]*(this.get("position")-.5)],this._drawRect(e,c),t.clip()}}postcompose(e){if(e.context instanceof WebGLRenderingContext){if("postrender"===e.type){var t=e.context;t.disable(t.SCISSOR_TEST)}}else e.target.getClassName&&"ol-layer"!==e.target.getClassName()&&e.target.get("declutter")?setTimeout(function(){e.context.restore()},0):e.context.restore()}},ol.control.SwipeMap=class extends ol.control.Control{constructor(e){e=e||{};var t=document.createElement("button"),i=document.createElement("div");i.className=(e.className||"ol-swipe")+" ol-unselectable ol-control",super({element:i}),i.appendChild(t),i.addEventListener("mousedown",this.move.bind(this)),i.addEventListener("touchstart",this.move.bind(this)),this.on("propertychange",function(e){"horizontal"===this.get("orientation")?(this.element.style.top=100*this.get("position")+"%",this.element.style.left=""):("vertical"!==this.get("orientation")&&this.set("orientation","vertical"),this.element.style.left=100*this.get("position")+"%",this.element.style.top=""),"orientation"===e.key&&(this.element.classList.remove("horizontal","vertical"),this.element.classList.add(this.get("orientation"))),this._clip()}.bind(this)),this.on("change:active",this._clip.bind(this)),this.set("position",e.position||.5),this.set("orientation",e.orientation||"vertical"),this.set("right",e.right)}setMap(e){this.getMap()&&(this._listener&&ol.Observable.unByKey(this._listener),this.getMap().getViewport().querySelector(".ol-layers").style.clip="");super.setMap(e),e&&(this._listener=e.on("change:size",this._clip.bind(this)))}_clip(){if(this.getMap()){var e=this.getMap().getViewport().querySelector(".ol-layers"),t=this.getRectangle();e.style.clip="rect("+t[1]+"px,"+t[2]+"px,"+t[3]+"px,"+t[0]+"px)"}}getRectangle(){var e=this.getMap().getSize();return"vertical"===this.get("orientation")?this.get("right")?[e[0]*this.get("position"),0,e[0],e[1]]:[0,0,e[0]*this.get("position"),e[1]]:this.get("right")?[0,e[1]*this.get("position"),e[0],e[1]]:[0,0,e[0],e[1]*this.get("position")]}move(e){var t,i=this;switch(this._movefn||(this._movefn=this.move.bind(this)),e.type){case"touchcancel":case"touchend":case"mouseup":i.isMoving=!1,["mouseup","mousemove","touchend","touchcancel","touchmove"].forEach(function(e){document.removeEventListener(e,i._movefn)});break;case"mousedown":case"touchstart":i.isMoving=!0,["mouseup","mousemove","touchend","touchcancel","touchmove"].forEach(function(e){document.addEventListener(e,i._movefn)});case"mousemove":case"touchmove":if(i.isMoving)if("vertical"===i.get("orientation")){var o=e.pageX||e.touches&&e.touches.length&&e.touches[0].pageX||e.changedTouches&&e.changedTouches.length&&e.changedTouches[0].pageX;if(!o)break;o-=i.getMap().getTargetElement().getBoundingClientRect().left+window.pageXOffset-document.documentElement.clientLeft;var s=(t=i.getMap().getSize()[0])-Math.min(Math.max(0,t-o),t);t=s/t,i.set("position",t),i.dispatchEvent({type:"moving",size:[s,i.getMap().getSize()[1]],position:[t,0]})}else{var r=e.pageY||e.touches&&e.touches.length&&e.touches[0].pageY||e.changedTouches&&e.changedTouches.length&&e.changedTouches[0].pageY;if(!r)break;r-=i.getMap().getTargetElement().getBoundingClientRect().top+window.pageYOffset-document.documentElement.clientTop;var a=(t=i.getMap().getSize()[1])-Math.min(Math.max(0,t-r),t);t=a/t,i.set("position",t),i.dispatchEvent({type:"moving",size:[i.getMap().getSize()[0],a],position:[0,t]})}}}},ol.control.Target=class extends ol.control.CanvasBase{constructor(e){var t=(e=e||{}).style||[new ol.style.Style({image:new ol.style.RegularShape({points:4,radius:11,radius1:0,radius2:0,snapToPixel:!0,stroke:new ol.style.Stroke({color:"#fff",width:3})})}),new ol.style.Style({image:new ol.style.RegularShape({points:4,radius:11,radius1:0,radius2:0,snapToPixel:!0,stroke:new ol.style.Stroke({color:"#000",width:1})})})];t instanceof Array||(t=[t]);var i=document.createElement("div");i.className="ol-target ol-unselectable ol-control",super({element:i,style:t,target:e.target}),this.composite=e.composite||"",this.setVisible(!1!==e.visible)}setStyle(e){e instanceof Array||(e=[e]),super.setStyle(e)}setVisible(e){if(this.set("visible",e),this.getMap())try{this.getMap().renderSync()}catch(e){}}getVisible(){return this.get("visible")}_draw(e){var t=this.getContext(e);if(t&&this.getMap()&&this.getVisible()){var i=e.frameState.pixelRatio;t.save(),t.scale(i,i);var o=t.canvas.width/2/i,s=t.canvas.height/2/i,r=new ol.geom.Point(this.getMap().getCoordinateFromPixel([o,s]));this.composite&&(t.globalCompositeOperation=this.composite);for(var a=0;a=1?e++:e=Math.min(1,e+.1),e=Math.round(100*e)/100,this.refresh(e)}.bind(this)}),this.addButton({className:"ol-zoom-out",handleClick:function(){var e=this.get("zoom");e>1?e--:e-=.1,e=Math.round(100*e)/100,this.refresh(e)}.bind(this)})),this._intervalDiv=ol.ext.element.create("DIV",{className:"ol-center-date",parent:this.element}),this.element.addEventListener("mouseover",function(){this._select&&this._select.elt.classList.remove("ol-select")}.bind(this));var t=null;this._scrollDiv.addEventListener("scroll",function(){this._setScrollLeft(),t&&(clearTimeout(t),t=null),t=setTimeout(function(){this.dispatchEvent({type:"scroll",date:this.getDate(),dateStart:this.getDate("start"),dateEnd:this.getDate("end")})}.bind(this),e.scrollTimeout||15)}.bind(this)),ol.ext.element.scrollDiv(this._scrollDiv,{onmove:function(e){this._moving=e}.bind(this)}),this._tline=[],this._scrollLeft=0,this.set("maxWidth",e.maxWidth||2e3),this.set("minDate",e.minDate||1/0),this.set("maxDate",e.maxDate||-1/0),this.set("graduation",e.graduation),this.set("minZoom",e.minZoom||.2),this.set("maxZoom",e.maxZoom||4),this.setInterval(e.interval),e.getHTML&&(this._getHTML=e.getHTML),e.getFeatureDate&&(this._getFeatureDate=e.getFeatureDate),e.endFeatureDate&&(this._endFeatureDate=e.endFeatureDate),this.setFeatures(e.features||e.source,e.zoom)}setMap(e){super.setMap(e),this.refresh(this.get("zoom")||1,!0)}addButton(e){this.element.classList.add("ol-hasbutton"),ol.ext.element.create("BUTTON",{className:e.className||void 0,title:e.title,html:e.html,click:e.handleClick,parent:this._buttons})}setInterval(e){"string"==typeof e&&(e=/s$/.test(e)?1e3*parseFloat(e):/mn$/.test(e)?1e3*parseFloat(e)*60:/h$/.test(e)?1e3*parseFloat(e)*3600:/d$/.test(e)?1e3*parseFloat(e)*3600*24:/y$/.test(e)?1e3*parseFloat(e)*3600*24*365:0),this.set("interval",e||0),e?this.element.classList.add("ol-interval"):this.element.classList.remove("ol-interval"),this.refresh(this.get("zoom"))}_getHTML(e){return e.get("name")||""}_getFeatureDate(e){return e&&e.get?e.get("date"):null}_endFeatureDate(){}isCollapsed(){return this.element.classList.contains("ol-collapsed")}collapse(e){e?this.element.classList.add("ol-collapsed"):this.element.classList.remove("ol-collapsed"),this.dispatchEvent({type:"collapse",collapsed:this.isCollapsed()})}toggle(){this.element.classList.toggle("ol-collapsed"),this.dispatchEvent({type:"collapse",collapsed:this.isCollapsed()})}setFeatures(e,t){this._features=this._source=null,e instanceof ol.source.Vector?this._source=e:e instanceof Array?this._features=e:this._features=[],this.refresh(t)}getFeatures(){return this._features||this._source.getFeatures()}refresh(e,t){if(this.getMap()){e||(e=this.get("zoom")),e=Math.min(this.get("maxZoom"),Math.max(this.get("minZoom"),e||1)),this.set("zoom",e),this._scrollDiv.innerHTML="";var i,o,s=this.getFeatures(),r=this._tline=[];s.forEach(function(e){(i=this._getFeatureDate(e))&&(i instanceof Date||(i=new Date(i)),this._endFeatureDate&&((o=this._endFeatureDate(e))instanceof Date||(o=new Date(o))),isNaN(i)||r.push({date:i,end:isNaN(o)?null:o,feature:e}))}.bind(this)),r.sort(function(e,t){return e.datec?c/h:1)*e;h=(l-(n=this._minDate=this._minDate-10/u))*u,ol.ext.element.setStyle(a,{width:h,maxWidth:"unset"}),this._drawTime(a,n,l,u),this.get("interval")?ol.ext.element.setStyle(this._intervalDiv,{width:this.get("interval")*u}):ol.ext.element.setStyle(this._intervalDiv,{width:""});var d=[],g=ol.ext.element.getStyle(this._scrollDiv,"lineHeight"),p=ol.ext.element.create("DIV",{className:"ol-features",parent:a});r.forEach(function(e){for(var t=e.date,i=e.elt=ol.ext.element.create("DIV",{className:"ol-feature",style:{left:Math.round((t-n)*u)},html:this._getHTML(e.feature),parent:p}),o=i.querySelectorAll("img"),s=0;sa);r++);d[r]=l+ol.ext.element.getStyle(i,"width"),ol.ext.element.setStyle(i,{top:r*g})}.bind(this)),this._nbline=d.length,t&&this.setDate(this._minDate,{anim:!1,position:"start"}),this.dispatchEvent({type:"scroll",date:this.getDate(),dateStart:this.getDate("start"),dateEnd:this.getDate("end")})}}_getOffsetFromDate(e){return(e-this._minDate)*this._scale}_getDateFromOffset(e){return e/this._scale+this._minDate}_setScrollLeft(e){this._scrollLeft=e,void 0!==e&&(this._scrollDiv.scrollLeft=e)}_getScrollLeft(){return void 0===this._scrollLeft?this._scrollDiv.scrollLeft:this._scrollLeft}_drawTime(e,t,i,o){var s,r,a,n,l=ol.ext.element.create("DIV",{className:"ol-times",parent:e}),h=ol.ext.element.getStyle(l,"left"),c=ol.ext.element.getStyle(l,"height"),u=new Date(this._minDate).getFullYear();r=(new Date(0).setFullYear(String(u))-new Date(0).setFullYear(String(u-1)))*o;for(var d=Math.round(2*c/r)+1;!((s=new Date(0).setFullYear(u))>this._maxDate);)ol.ext.element.create("DIV",{className:"ol-time ol-year",style:{left:this._getOffsetFromDate(s)-h},html:u,parent:l}),u+=d;if(/day|month/.test(this.get("graduation"))&&(r=(new Date(0,0,1).setFullYear(String(u))-new Date(0,0,1).setFullYear(String(u-1)))*o,(n=Math.max(1,Math.round(12/Math.round(r/c/2))))<12))for(u=new Date(this._minDate).getFullYear(),a=n+1;(s=new Date(0,0,1)).setFullYear(u),s.setMonth(a-1),!(s>this._maxDate);)ol.ext.element.create("DIV",{className:"ol-time ol-month",style:{left:this._getOffsetFromDate(s)-h},html:s.toLocaleDateString(void 0,{month:"short"}),parent:l}),(a+=n)>12&&(u++,a=n+1);if("day"===this.get("graduation")){r=(new Date(0,1,1)-new Date(0,0,1))*o;var g=Math.max(1,Math.round(31/Math.round(r/c/2)));if(g<31){u=new Date(this._minDate).getFullYear(),a=0;for(var p=g;;)if((s=new Date(0,0,1)).setFullYear(u),s.setMonth(a),s.setDate(p),isNaN(s))++a>12&&(a=1,u++),p=g;else{if(s>this._maxDate)break;if(p>1){var m=this._getOffsetFromDate(s);this._getOffsetFromDate(new Date(u,a+1,1))-m>c&&ol.ext.element.create("DIV",{className:"ol-time ol-day",style:{left:m-h},html:p,parent:l})}u=s.getFullYear(),a=s.getMonth(),(p=s.getDate()+g)>new Date(u,a+1,0).getDate()&&(a++,p=g)}}}}setDate(e,t){var i;if(t=t||{},e instanceof Date?i=e:(this.getFeatures().indexOf(e)>=0&&(i=this._getFeatureDate(e)),!i||i instanceof Date||(i=new Date(i)),i&&!isNaN(i)||(i=new Date(String(e)))),!isNaN(i)){!1===t.anim&&this._scrollDiv.classList.add("ol-move");var o=this._getOffsetFromDate(i);if("start"===t.position?o+=ol.ext.element.outerWidth(this._scrollDiv)/2-ol.ext.element.getStyle(this._scrollDiv,"marginLeft")/2:"end"===t.position&&(o-=ol.ext.element.outerWidth(this._scrollDiv)/2-ol.ext.element.getStyle(this._scrollDiv,"marginLeft")/2),this._setScrollLeft(o),!1===t.anim&&this._scrollDiv.classList.remove("ol-move"),e)for(var s,r=0;s=this._tline[r];r++)s.feature===e?(s.elt.classList.add("ol-select"),this._select=s):s.elt.classList.remove("ol-select")}}roundDate(e,t){switch(t){case"mn":return new Date(this._roundTo(e,6e4));case"hour":return new Date(this._roundTo(e,36e5));case"day":return new Date(this._roundTo(e,864e5));case"month":return(e=new Date(this._roundTo(e,864e5))).getDate()>15&&(e=new Date(e.setMonth(e.getMonth()+1))),e=e.setDate(1),new Date(e);default:return new Date(e)}}getDate(e,t){var i;switch(t||(t=e),e){case"start":i=this.get("interval")?-ol.ext.element.getStyle(this._intervalDiv,"width")/2+ol.ext.element.getStyle(this._scrollDiv,"marginLeft")/2:-ol.ext.element.outerWidth(this._scrollDiv)/2+ol.ext.element.getStyle(this._scrollDiv,"marginLeft")/2;break;case"end":i=this.get("interval")?ol.ext.element.getStyle(this._intervalDiv,"width")/2-ol.ext.element.getStyle(this._scrollDiv,"marginLeft")/2:ol.ext.element.outerWidth(this._scrollDiv)/2-ol.ext.element.getStyle(this._scrollDiv,"marginLeft")/2;break;default:i=0}var o=this._getDateFromOffset(this._getScrollLeft()+i);return o=this.roundDate(o,t),new Date(o)}_roundTo(e,t){return Math.round(e/t)*t}getStartDate(){return new Date(this.get("minDate"))}getEndDate(){return new Date(this.get("maxDate"))}},ol.control.VideoRecorder=class extends ol.control.Control{constructor(e){e=e||{};var t=ol.ext.element.create("DIV",{className:(e.className||"ol-videorec")+" ol-unselectable ol-control"});super({element:t,target:e.target}),ol.ext.element.create("BUTTON",{type:"button",className:"ol-start",title:"start",click:function(){this.start()}.bind(this),parent:t}),ol.ext.element.create("BUTTON",{type:"button",className:"ol-stop",title:"stop",click:function(){this.stop()}.bind(this),parent:t}),ol.ext.element.create("BUTTON",{type:"button",className:"ol-pause",title:"pause",click:function(){this.pause()}.bind(this),parent:t}),ol.ext.element.create("BUTTON",{type:"button",className:"ol-resume",title:"resume",click:function(){this.resume()}.bind(this),parent:t}),this.set("framerate",30),this.set("videoBitsPerSecond",5e6),"DIALOG"===e.videoTarget?(this._dialog=new ol.control.Dialog({className:"ol-fullscreen-dialog",target:document.body,closeBox:!0}),this._videoTarget=this._dialog.getContentElement()):this._videoTarget=e.videoTarget,this._printCtrl=new ol.control.Print({target:ol.ext.element.create("DIV")})}setMap(e){this.getMap()&&(this.getMap().removeControl(this._printCtrl),this._dialog&&this.getMap().removeControl(this._dialog)),super.setMap(e),this.getMap()&&(this.getMap().addControl(this._printCtrl),this._dialog&&this.getMap().addControl(this._dialog))}start(){var e=this._printCtrl,t=!1;function i(o){t||e.fastPrint({canvas:o},i)}e.fastPrint({},function(e){var o;try{o=e.captureStream(this.get("framerate")||30)}catch(e){return void this.dispatchEvent({type:"error",error:e})}this._mediaRecorder=new MediaRecorder(o,{videoBitsPerSecond:this.get("videoBitsPerSecond")||5e6});var s=[];this._mediaRecorder.ondataavailable=function(e){s.push(e.data)},this._mediaRecorder.onstop=function(){t=!0;var e,i=new Blob(s,{type:"video/mp4"});(s=[],this._videoTarget instanceof Element)?("VIDEO"===this._videoTarget.tagName?e=this._videoTarget:(e=this._videoTarget.querySelector("video"))||(e=ol.ext.element.create("VIDEO",{controls:"",parent:this._videoTarget})),this._dialog&&this._dialog.show(),e.src=URL.createObjectURL(i),this.dispatchEvent({type:"stop",videoURL:e.src})):this.dispatchEvent({type:"stop",videoURL:URL.createObjectURL(i)})}.bind(this),this._mediaRecorder.onpause=function(){t=!0,this.dispatchEvent({type:"pause"})}.bind(this),this._mediaRecorder.onresume=function(){t=!1,i(e),this.dispatchEvent({type:"resume"})}.bind(this),this._mediaRecorder.onerror=function(e){this.dispatchEvent({type:"error",error:e})}.bind(this),t=!1,i(e),this._mediaRecorder.start(),this.dispatchEvent({type:"start",canvas:e}),this.element.setAttribute("data-state","rec")}.bind(this))}stop(){this._mediaRecorder&&(this._mediaRecorder.stop(),this._mediaRecorder=null,this.element.setAttribute("data-state","inactive"))}pause(){this._mediaRecorder&&(this._mediaRecorder.pause(),this.element.setAttribute("data-state","pause"))}resume(){this._mediaRecorder&&(this._mediaRecorder.resume(),this.element.setAttribute("data-state","rec"))}},ol.control.WMSCapabilities=class extends ol.control.Button{constructor(e){e=e||{};var t=Object.assign({},e||{});t.target===document.body&&delete t.target,t.target?(t.className=((t.className||"")+" ol-wmscapabilities ol-hidden").trim(),delete t.target):(t.className=((t.className||"")+" ol-wmscapabilities").trim(),t.handleClick=function(){i.showDialog()}),super(t);var i=this;this._proxy=e.proxy,this.set("srs",e.srs||[]),this.set("cors",e.cors),this.set("trace",e.trace),this.set("title",e.title),this.set("loadLabel",e.loadLabel),this.set("optional",e.optional),this.createDialog(e),this._elements.formVersion.value="1.0.0";var o=this._getParser();this._ajax=new ol.ext.Ajax({dataType:"text",auth:e.authentication}),this._ajax.on("success",function(e){var t;try{t=o.read(e.response)}catch(e){this.showError({type:"load",error:e})}t&&(t.Capability.Layer.Layer?this.showCapabilities(t):this.showError({type:"noLayer"})),this.dispatchEvent({type:"capabilities",capabilities:t}),"function"==typeof e.options.callback&&e.options.callback(t)}.bind(this)),this._ajax.on("error",function(e){this.showError({type:"load",error:e}),this.dispatchEvent({type:"capabilities"}),e.options.callback}.bind(this)),this._ajax.on("loadstart",function(){this._elements.element.classList.add("ol-searching")}.bind(this)),this._ajax.on("loadend",function(){this._elements.element.classList.remove("ol-searching")}.bind(this)),e.onselect&&this.on("load",function(t){e.onselect(t.layer,t.options)})}_getParser(){return new ol.format.WMSCapabilities}createDialog(e){var t=e.target;t&&t!==document.body||(this._dialog=new ol.control.Dialog({className:"ol-wmscapabilities",closeBox:!0,closeOnSubmit:!1,target:e.target}),this._dialog.on("button",function(e){"submit"===e.button&&this.getCapabilities(e.inputs.url.value)}.bind(this)),t=null);var i=ol.ext.element.create("DIV",{className:("ol-wmscapabilities "+(e.className||"")).trim(),parent:t});this._elements={element:t||i};var o=ol.ext.element.create("DIV",{className:"ol-url",parent:i}),s=this._elements.input=ol.ext.element.create("INPUT",{className:"url",type:"text",tabIndex:1,placeholder:e.placeholder||"service url...",autocorrect:"off",autocapitalize:"off",parent:o});if(s.addEventListener("keyup",function(t){13===t.keyCode&&this.getCapabilities(s.value,e)}.bind(this)),e.services){var r=ol.ext.element.create("SELECT",{className:"url",on:{change:function(t){var i=t.target.options[t.target.selectedIndex].value;this.getCapabilities(i,e),t.target.selectedIndex=0}.bind(this)},parent:o});for(var a in ol.ext.element.create("OPTION",{html:" ",parent:r}),e.services)ol.ext.element.create("OPTION",{html:a,value:e.services[a],parent:r})}ol.ext.element.create("BUTTON",{click:function(){this.getCapabilities(s.value,e)}.bind(this),html:e.searchLabel||"search",parent:o}),this._elements.error=ol.ext.element.create("DIV",{className:"ol-error",parent:o});var n=this._elements.result=ol.ext.element.create("DIV",{className:"ol-result",parent:i}),l=ol.ext.element.create("DIV",{className:"ol-preview",html:e.previewLabel||"preview",parent:n});this._elements.preview=ol.ext.element.create("IMG",{parent:l}),this._img=new Image,this._img.crossOrigin="Anonymous",this._img.addEventListener("error",function(){l.className="ol-preview tainted",this._elements.formCrossOrigin.checked=!1}.bind(this)),this._img.addEventListener("load",function(){l.className="ol-preview ok",this._elements.formCrossOrigin.checked=!0}.bind(this)),this._elements.select=ol.ext.element.create("DIV",{className:"ol-select-list",tabIndex:2,parent:n}),this._elements.data=ol.ext.element.create("DIV",{className:"ol-data",parent:n}),this._elements.buttons=ol.ext.element.create("DIV",{className:"ol-buttons",parent:n}),this._elements.legend=ol.ext.element.create("IMG",{className:"ol-legend",parent:n});var h=this._elements.form=ol.ext.element.create("UL",{className:"ol-wmsform",parent:i}),c=function(e,t,i){var o=ol.ext.element.create("LI",{parent:h});if(ol.ext.element.create("LABEL",{html:this.labels[e],parent:o}),"boolean"==typeof t)this._elements[e]=ol.ext.element.create("INPUT",{type:"checkbox",checked:t,parent:o});else if(t instanceof Array){var s=this._elements[e]=ol.ext.element.create("SELECT",{parent:o});t.forEach(function(e){ol.ext.element.create("OPTION",{html:e,value:e,parent:s})}.bind(this))}else this._elements[e]=ol.ext.element.create("INPUT",{value:void 0===t?"":t,placeholder:i||"",type:"number"==typeof t?"number":"text",parent:o});return o}.bind(this);c("formTitle"),c("formLayer","","layer1,layer2,...");var u=c("formMap");u.setAttribute("data-param","map"),(u=c("formStyle")).setAttribute("data-param","style"),c("formFormat",["image/png","image/jpeg"]),c("formMinZoom",0),c("formMaxZoom",20),(u=c("formExtent","","xmin,ymin,xmax,ymax")).setAttribute("data-param","extent");var d=u.querySelector("input");return ol.ext.element.create("BUTTON",{title:this.labels.mapExtent,click:function(){d.value=this.getMap().getView().calculateExtent(this.getMap().getSize()).join(",")}.bind(this),parent:u}),(u=c("formProjection","")).setAttribute("data-param","proj"),c("formCrossOrigin",!1),(u=c("formVersion","1.3.0")).setAttribute("data-param","version"),c("formAttribution",""),ol.ext.element.create("BUTTON",{html:this.get("loadLabel")||"Load",click:function(){var e=this._getFormOptions(),t=this.getLayerFromOptions(e);this.dispatchEvent({type:"load",layer:t,options:e}),this._dialog.hide()}.bind(this),parent:h}),i}getLayerFromOptions(e){e.layer.source=new ol.source.TileWMS(e.source);var t=new ol.layer.Tile(e.layer);return delete e.layer.source,t}setMap(e){super.setMap(e),this._dialog&&this._dialog.setMap(e)}getDialog(){return this._dialog}showDialog(e,t){this.showError(),this._elements.formProjection.value||(this._elements.formProjection.value=this.getMap().getView().getProjection().getCode()),this._dialog&&this._dialog.show({title:void 0===this.get("title")?"WMS":this.get("title"),content:this._elements.element}),this.getCapabilities(e,t);var i=this._elements.select.querySelector(".selected");i&&(this._elements.select.scrollTop=i.offsetTop-20)}testUrl(e){return!!new RegExp("^(https?:\\/\\/)((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=\\/-]*)?(\\#[-a-z\\d_]*)?$","i").test(e)}getRequestParam(e){return{SERVICE:"WMS",REQUEST:"GetCapabilities",VERSION:e.version||"1.3.0"}}getCapabilities(e,t){if(e)if(this.testUrl(e)){t=t||{};var i=(e=e.split("?"))[1];e=e[0],this._elements.formMap.value="",this._elements.formLayer.value="",this._elements.formStyle.value="",this._elements.formTitle.value="",this._elements.formProjection.value=this.getMap().getView().getProjection().getCode(),this._elements.formFormat.selectedIndex=0;var o=t.map||"",s={};i&&(i=i.replace(/^\?/,"").split("&")).forEach(function(e){if((e=e.split("="))[1]=decodeURIComponent(e[1]||""),/^map$/i.test(e[0])&&(o=e[1],this._elements.formMap.value=o),/^layers$/i.test(e[0])&&(this._elements.formLayer.value=e[1],this._elements.formTitle.value=e[1].split(",")[0]),/^style$/i.test(e[0])&&(this._elements.formStyle.value=e[1]),/^crs$/i.test(e[0])&&(this._elements.formProjection.value=e[1]),/^format$/i.test(e[0]))for(var t,i=0;t=this._elements.formFormat.options[i];i++)if(t.value===e[1]){this._elements.formFormat.selectedIndex=i;break}this.get("optional")&&this.get("optional").split(",").forEach(function(t){t===e[0]&&(s[t]=e[1])}.bind(this))}.bind(this));var r=this.getRequestParam(t),a=[];for(var n in o&&(r.MAP=o,a.push("map="+o)),s)r[n]=s[n],a.push(n+"="+s[n]);if(this._elements.input.value=(e||"")+(a?"?"+a.join("&"):""),this.clearForm(),this._proxy){var l="";for(var h in r)l+=(l?"&":"")+h+"="+r[h];this._ajax.send(this._proxy,{url:l},{timeout:t.timeout||1e4,callback:t.onload,abort:!1})}else this._ajax.send(e,r,{timeout:t.timeout||1e4,callback:t.onload,abort:!1})}else this.showError({type:"badUrl"})}showError(e){this._elements.error.innerHTML=e?this.error[e.type]||"ERROR ("+e.type+")":"",e&&"load"===e.type?this._elements.form.classList.add("visible"):this._elements.form.classList.remove("visible")}clearForm(){this._elements.result.classList.remove("ol-visible"),this.showError(),this._elements.select.innerHTML="",this._elements.data.innerHTML="",this._elements.preview.src="",this._elements.legend.src="",this._elements.legend.classList.remove("visible")}showCapabilities(e){this._elements.result.classList.add("ol-visible");var t=[],i=function(o,s){s=s||0,o.Layer.forEach(function(r){r.Attribution||(r.Attribution=o.Attribution),r.EX_GeographicBoundingBox||(r.EX_GeographicBoundingBox=o.EX_GeographicBoundingBox);var a=ol.ext.element.create("DIV",{className:(r.Layer?"ol-title ":"")+"level-"+s,html:r.Name||r.Title,click:function(){this._elements.buttons.innerHTML="",this._elements.data.innerHTML="",this._elements.legend.src=this._elements.preview.src="",this._elements.element.classList.remove("ol-form"),this.showError();var i=this.getOptionsFromCap(r,e),o=this.getLayerFromOptions(i);if(this._currentOptions=i,t.forEach(function(e){e.classList.remove("selected")}),a.classList.add("selected"),o){ol.ext.element.create("BUTTON",{html:this.get("loadLabel")||"Load",className:"ol-load",click:function(){this.dispatchEvent({type:"load",layer:o,options:i}),this._dialog&&this._dialog.hide()}.bind(this),parent:this._elements.buttons}),ol.ext.element.create("BUTTON",{className:"ol-wmsform",click:function(){this._elements.element.classList.toggle("ol-form")}.bind(this),parent:this._elements.buttons});var s=this.getMap().getView().getResolution(),n=this.getMap().getView().getCenter();this._elements.preview.src=o.getPreview(n,s,this.getMap().getView().getProjection()),this._img.src=this._elements.preview.src,ol.ext.element.create("p",{className:"ol-title",html:i.data.title,parent:this._elements.data}),ol.ext.element.create("p",{html:i.data.abstract,parent:this._elements.data}),i.data.legend&&i.data.legend.length?(this._elements.legend.src=i.data.legend[0],this._elements.legend.classList.add("visible")):(this._elements.legend.src="",this._elements.legend.classList.remove("visible"))}}.bind(this),parent:this._elements.select});t.push(a),r.Layer&&i(r,s+1)}.bind(this))}.bind(this);this._elements.select.innerHTML="",i(e.Capability.Layer)}getLayerResolution(e,t,i){var o="min"===e?"MinScaleDenominator":"MaxScaleDenominator";if(void 0!==t[o])return t[o]/(72/2.54*100);if(!t.Layer)return"min"===e?0:156543.03392804097;i="min"===e?156543.03392804097:0;for(var s=0;s=0?l=!0:e.CRS.indexOf("EPSG:4326")>=0?(n="EPSG:4326",l=!0):this.get("srs").forEach(function(t){e.CRS.indexOf(t)>=0&&(n=t,l=!0)}):l=!1,l||(this.showError({type:"srs"}),this.get("trace")&&console.log("BAD srs: ",e.CRS));var h=e.EX_GeographicBoundingBox;h&&(h=ol.proj.transformExtent(h,"EPSG:4326",this.getMap().getView().getProjection()));var c=[];e.Attribution&&e.Attribution.Title&&c.push('© '+e.Attribution.Title.replace(/");var u={title:e.Title,extent:h,queryable:e.queryable,abstract:e.Abstract,minResolution:this.getLayerResolution("min",e),maxResolution:this.getLayerResolution("max",e)||156543.03392804097},d={url:t.Capability.Request.GetMap.DCPType[0].HTTP.Get.OnlineResource,projection:n,attributions:c,crossOrigin:this.get("cors")?"anonymous":null,params:{LAYERS:e.Name,FORMAT:i,VERSION:t.version||"1.3.0"}},g=new ol.View({projection:this.getMap().getView().getProjection()});g.setResolution(u.minResolution);var p=Math.round(g.getZoom());g.setResolution(u.maxResolution);var m=Math.round(g.getZoom());if(this._fillForm({title:u.title,layers:d.params.LAYERS,format:d.params.FORMAT,minZoom:m,maxZoom:p,extent:h?h.join(","):"",projection:d.projection,attribution:d.attributions[0]||"",version:d.params.VERSION}),this.get("trace")){var f=JSON.stringify([d],null,"\t").replace(/\\"/g,'"');u.source="SOURCE";var v="new ol.layer.Tile ("+JSON.stringify(u,null,"\t")+")";v=v.replace(/\\"/g,'"').replace('"SOURCE"',"new ol.source.TileWMS("+f+")").replace(/\\t/g,"\t").replace(/\\n/g,"\n").replace("([\n\t","(").replace("}\n])","})"),console.log(v),delete u.source}var y=[];return e.Style&&e.Style.forEach(function(e){e.LegendURL&&y.push(e.LegendURL[0].OnlineResource)}),{layer:u,source:d,data:{title:e.Title,abstract:e.Abstract,logo:e.Attribution&&e.Attribution.LogoURL?e.Attribution.LogoURL.OnlineResource:void 0,keyword:e.KeywordList,legend:y,opaque:e.opaque,queryable:e.queryable}}}_getFormOptions(){var e=parseInt(this._elements.formMinZoom.value),t=parseInt(this._elements.formMaxZoom.value),i=new ol.View({projection:this.getMap().getView().getProjection()});i.setZoom(e);var o=i.getResolution();i.setZoom(t);var s=i.getResolution(),r=[];this._elements.formExtent.value&&this._elements.formExtent.value.split(",").forEach(function(e){r.push(parseFloat(e))}),4!==r.length&&(r=void 0);var a=[];this._elements.formAttribution.value&&a.push(this._elements.formAttribution.value);var n={layer:{title:this._elements.formTitle.value,extent:r,maxResolution:o,minResolution:s},source:{url:this._elements.input.value,crossOrigin:this._elements.formCrossOrigin.checked?"anonymous":null,projection:this._elements.formProjection.value,attributions:a,params:{FORMAT:this._elements.formFormat.options[this._elements.formFormat.selectedIndex].value,LAYERS:this._elements.formLayer.value,VERSION:this._elements.formVersion.value}},data:{title:this._elements.formTitle.value}};return this._elements.formMap.value&&(n.source.params.MAP=this._elements.formMap.value),n}_fillForm(e){var t,i;for(this._elements.formTitle.value=e.title,this._elements.formLayer.value=e.layers,this._elements.formStyle.value=e.style,i=0;t=this._elements.formFormat.options[i];i++)if(t.value===e.format){this._elements.formFormat.selectedIndex=i;break}this._elements.formExtent.value=e.extent||"",this._elements.formMaxZoom.value=e.maxZoom,this._elements.formMinZoom.value=e.minZoom,this._elements.formProjection.value=e.projection,this._elements.formAttribution.value=e.attribution,this._elements.formVersion.value=e.version}loadLayer(e,t,i){this.getCapabilities(e,{onload:function(e){e?e.Capability.Layer.Layer.forEach(function(o){if(o.Name===t||o.Identifier===t){var s=this.getOptionsFromCap(o,e),r=this.getLayerFromOptions(s);this.dispatchEvent({type:"load",layer:r,options:s}),"function"==typeof i&&i({layer:r,options:s})}}.bind(this)):this.dispatchEvent({type:"load",error:!0})}.bind(this)})}},ol.control.WMSCapabilities.prototype.error={load:"Can't retrieve service capabilities, try to add it manually...",badUrl:"The input value is not a valid url...",TileMatrix:"No TileMatrixSet supported...",noLayer:"No layer available for this service...",srs:"The service projection looks different from that of your map, it may not display correctly..."},ol.control.WMSCapabilities.prototype.labels={formTitle:"Title:",formLayer:"Layers:",formMap:"Map:",formStyle:"Style:",formFormat:"Format:",formMinZoom:"Min zoom level:",formMaxZoom:"Max zoom level:",formExtent:"Extent:",mapExtent:"use map extent...",formProjection:"Projection:",formCrossOrigin:"CrossOrigin:",formVersion:"Version:",formAttribution:"Attribution:"},ol.control.WMTSCapabilities=class extends ol.control.WMSCapabilities{constructor(e){(e=e||{}).title=e.title||"WMTS",super(e),this.getDialog().element.classList.add("ol-wmtscapabilities")}_getParser(){var e=new ol.format.WMTSCapabilities;return{read:function(t){var i=e.read(t);i.Capability={Layer:i.Contents},i.Capability.Layer.Attribution={Title:i.ServiceProvider.ProviderName};var o=[];return i.Contents.Layer.forEach(function(e){e.Format&&/jpeg|png/.test(e.Format[0])&&o.push(e)}),i.Contents.Layer=o,i}.bind(this)}}getRequestParam(e){return{SERVICE:"WMTS",REQUEST:"GetCapabilities",VERSION:e.version||"1.0.0"}}_getTG(e,t,i,o){for(var s=new Array,r=new Array,a=ol.extent.getWidth(ol.proj.get("EPSG:3857").getExtent())/256,n=0;n<=(i||20);n++){var l=o?e+":"+n:n;s[n]=l,r[n]=a/Math.pow(2,n)}return{origin:[-20037508,20037508],resolutions:r,matrixIds:s,minZoom:t||0}}getTileGrid(e,t,i,o){return new ol.tilegrid.WMTS(this._getTG(e,t,i,o))}isSupportedSet(e){return"PM"===e.TileMatrixSet||"3857"===e.TileMatrixSet||"EPSG:3857"===e.TileMatrixSet||"webmercator"===e.TileMatrixSet||"GoogleMapsCompatible"===e.TileMatrixSet}getOptionsFromCap(e,t){var i=e.WGS84BoundingBox;i&&(i=ol.proj.transformExtent(i,"EPSG:4326",this.getMap().getView().getProjection()));var o,s=1/0,r=-1/0;if(e.TileMatrixSetLink.forEach(function(t){this.isSupportedSet(t)&&(o=t,e.TileMatrixSet=t.TileMatrixSet)}.bind(this)),o){if(o.TileMatrixSetLimits){var a=o.TileMatrixSetLimits[0].TileMatrix.split(":").length>1;o.TileMatrixSetLimits.forEach(function(e){var t=e.TileMatrix.split(":").pop();s=Math.min(s,parseInt(t)),r=Math.max(r,parseInt(t))})}else s=0,r=20;var n=new ol.View;n.setZoom(s);var l={title:e.Title,extent:i,abstract:e.Abstract,maxResolution:n.getResolution()},h={url:t.OperationsMetadata.GetTile.DCP.HTTP.Get[0].href,layer:e.Identifier,matrixSet:e.TileMatrixSet,format:e.Format[0]||"image/jpeg",projection:"EPSG:3857",tilePrefix:a,minZoom:s,maxZoom:r,style:e.Style?e.Style[0].Identifier:"normal",attributions:e.Attribution.Title,crossOrigin:this.get("cors")?"anonymous":null,wrapX:!1!==this.get("wrapX")};if(this._fillForm({title:l.title,layers:h.layer,style:h.style,format:h.format,minZoom:s,maxZoom:r,extent:i?i.join(","):"",projection:h.projection,attribution:h.attributions||"",version:"1.0.0"}),this.get("trace")){h.tileGrid="TILEGRID";var c=JSON.stringify([h],null,"\t").replace(/\\"/g,'"');c=c.replace('"TILEGRID"',"new ol.tilegrid.WMTS("+JSON.stringify(this._getTG(h.matrixSet,h.minZoom,h.maxZoom,h.tilePrefix),null,"\t").replace(/\n/g,"\n\t\t")+")"),delete h.tileGrid,l.source="SOURCE";var u="new ol.layer.Tile ("+JSON.stringify(l,null,"\t")+")";u=u.replace(/\\"/g,'"').replace('"SOURCE"',"new ol.source.WMTS("+c+")").replace(/\\t/g,"\t").replace(/\\n/g,"\n").replace(/"tileGrid": {/g,'"tileGrid": new ol.tilegrid.WMTS({').replace(/},\n(\t*)"style"/g,'}),\n$1"style"').replace("([\n\t","(").replace("}\n])","})"),console.log(u),delete l.source}var d=void 0;return e.Style&&e.Style[0]&&e.Style[0].LegendURL&&e.Style[0].LegendURL[0]&&(d=[e.Style[0].LegendURL[0].href]),{layer:l,source:h,data:{title:e.Title,abstract:e.Abstract,legend:d}}}this.showError({type:"TileMatrix"})}_getFormOptions(){var e=this._currentOptions||{};e.layer||(e.layer={}),e.source||(e.source={}),e.data||(e.data={});var t=parseInt(this._elements.formMinZoom.value)||0,i=parseInt(this._elements.formMaxZoom.value)||20,o=[];this._elements.formExtent.value&&this._elements.formExtent.value.split(",").forEach(function(e){o.push(parseFloat(e))}),4!==o.length&&(o=void 0);var s=[];this._elements.formAttribution.value&&s.push(this._elements.formAttribution.value);var r=new ol.View({projection:this.getMap().getView().getProjection()});return r.setZoom(t),{layer:{title:this._elements.formTitle.value,extent:o,abstract:e.layer.abstract||"",maxResolution:r.getResolution()},source:{url:this._elements.input.value,layer:this._elements.formLayer.value,matrixSet:e.source.matrixSet||"PM",format:this._elements.formFormat.options[this._elements.formFormat.selectedIndex].value,projection:"EPSG:3857",minZoom:t,maxZoom:i,style:this._elements.formStyle.value||"normal",attributions:s,crossOrigin:this._elements.formCrossOrigin.checked?"anonymous":null,wrapX:!1!==this.get("wrapX")},data:{title:this._elements.formTitle.value,abstract:e.data.abstract,legend:e.data.legend}}}getLayerFromOptions(e){if(e){e.source.tileGrid=this.getTileGrid(e.source.matrixSet,e.source.minZoom,e.source.maxZoom,e.source.tilePrefix),e.layer.source=new ol.source.WMTS(e.source);var t=new ol.layer.Tile(e.layer);return delete e.layer.source,delete e.source.tileGrid,t}}},ol.featureAnimation=class extends ol.Object{constructor(e){e=e||{},super(),this.duration_="number"==typeof e.duration?e.duration>=0?e.duration:0:1e3,this.fade_="function"==typeof e.fade?e.fade:null,this.repeat_=Number(e.repeat);var t="function"==typeof e.easing?e.easing:ol.easing.linear;e.revers?this.easing_=function(e){return 1-t(e)}:this.easing_=t,this.hiddenStyle=e.hiddenStyle}drawGeom_(e,t,i){this.fade_&&(e.context.globalAlpha=this.fade_(1-e.elapsed));for(var o=e.style,s=0;s=0;l--)0===t[l].duration_&&t.splice(l,1);var h=0,c=0,u=i&&this.getFilters?this.getFilters():[];function d(i){ol.Observable.unByKey(o),o=null,e.setStyle(r),n.stop=(new Date).getTime();var a={type:"animationend",feature:e};if(i)for(var l in i)i.hasOwnProperty(l)&&(a[l]=i[l]);t[c].dispatchEvent(a),s.dispatchEvent(a)}function g(i){if(t.length&&!o){if(n.stop&&(n.start=(new Date).getTime()-n.stop+n.start,n.stop=0),o=s.on(["postcompose","postrender"],function(i){n.type=i.type;try{n.vectorContext=i.vectorContext||ol.render.getVectorContext(i)}catch(i){}if(n.frameState=i.frameState,n.inversePixelTransform=i.inversePixelTransform,n.extent||(n.extent=i.frameState.extent,n.start=i.frameState.time,n.context=i.context),n.time=i.frameState.time-n.start,n.elapsed=n.time/t[c].duration_,n.elapsed>1&&(n.elapsed=1),i.context.save(),u.forEach(function(e){e.get("active")&&e.precompose(i)}),this.getOpacity&&(i.context.globalAlpha=this.getOpacity()),t[c].animate(n)){var o={type:"animating",step:c,start:n.start,time:n.time,elapsed:n.elapsed,rotation:n.rotation||0,geom:n.geom,coordinate:n.coord,feature:e,extra:n.extra||{}};t[c].dispatchEvent(o),s.dispatchEvent(o)}else++h0&&(this.duration_=this.dist_/this.speed_)}animate(e){if(!e.time&&!this.dist_)return!1;var t,i,o,s,r,a,n=this.dist_*this.easing_(e.elapsed),l=0;i=this.path_[0];for(var h=1;h=n){e.extra={index:h,coordinates:i},o=(n-l)/a,i=[t[0]+(i[0]-t[0])*o,t[1]+(i[1]-t[1])*o];break}l+=a}var c=e.style;if(e.rotation=Math.PI/2+Math.atan2(t[1]-i[1],t[0]-i[0]),!1!==this.rotate_){var u=[],d=this.rotate_-e.rotation+e.frameState.viewState.rotation;e.rotation=Math.PI/2+Math.atan2(t[1]-i[1],t[0]-i[0]);for(var g=0;o=e.style[g];g++)o.getImage()&&o.getImage().setRotation(d),u.push(o);e.style=u}return e.geom.setCoordinates(i),this.drawGeom_(e,e.geom),e.style=c,e.time<=this.duration_}},ol.featureAnimation.Shake=class extends ol.featureAnimation{constructor(e){super(e=e||{}),this.amplitude_=e.amplitude||40,this.bounce_=-Math.PI*(e.bounce||6),this.horizontal_=e.horizontal}animate(e){var t=e.geom.clone(),i=e.geom.clone(),o=this.easing_(e.elapsed);return o=Math.sin(this.bounce_*o)*this.amplitude_*(1-o)*e.frameState.viewState.resolution,this.horizontal_?(t.translate(o,0),i.translate(o,0)):t.translate(0,o),this.drawGeom_(e,t,i),e.time<=this.duration_}},ol.featureAnimation.Show=class extends ol.featureAnimation{constructor(e){super(e)}animate(e){return this.drawGeom_(e,e.geom),e.time<=this.duration_}},ol.featureAnimation.Slide=class extends ol.featureAnimation{constructor(e){super(e=e||{}),this.speed_=e.speed||0,this.side_=e.side||"left"}animate(e){e.time||("left"==this.side_?this.dx=e.extent[0]-e.bbox[2]:this.dx=e.extent[2]-e.bbox[0],this.speed_&&(this.duration_=Math.abs(this.dx)/this.speed_/e.frameState.viewState.resolution));var t=e.geom.clone();return t.translate(this.dx*(1-this.easing_(e.elapsed)),0),this.drawGeom_(e,t),e.time<=this.duration_}},ol.featureAnimation.Teleport=class extends ol.featureAnimation{constructor(e){super(e)}animate(e){var t=this.easing_(e.elapsed);if(t){e.context.save();var i=e.frameState.pixelRatio;e.context.globalAlpha=t,e.context.scale(t,1/t);var o=e.frameState.coordinateToPixelTransform,s=(1/t-1)*i*(o[0]*e.coord[0]+o[1]*e.coord[1]+o[4]),r=(t-1)*i*(o[2]*e.coord[0]+o[3]*e.coord[1]+o[5]);e.context.translate(s,r),this.drawGeom_(e,e.geom),e.context.restore()}return e.time<=this.duration_}},ol.featureAnimation.Throw=class extends ol.featureAnimation{constructor(e){super(e=e||{}),this.speed_=e.speed||0,this.side_=e.side||"left"}animate(e){var t,i;!e.time&&this.speed_&&("left"==this.side_?(t=this.dx=e.extent[0]-e.bbox[2],i=this.dy=e.extent[3]-e.bbox[1]):(t=this.dx=e.extent[2]-e.bbox[0],i=this.dy=e.extent[3]-e.bbox[1]),this.duration_=Math.sqrt(t*t+i*i)/this.speed_/e.frameState.viewState.resolution);var o=e.geom.clone(),s=e.geom.clone();return o.translate(this.dx*(1-this.easing_(e.elapsed)),this.dy*Math.cos(Math.PI/2*this.easing_(e.elapsed))),s.translate(this.dx*(1-this.easing_(e.elapsed)),0),this.drawGeom_(e,o,s),e.time<=this.duration_}},ol.featureAnimation.Zoom=class extends ol.featureAnimation{constructor(e){super(e=e||{}),this.set("zoomout",e.zoomOut)}animate(e){var t=this.easing_(e.elapsed);if(t){this.get("zoomout")&&(t=1/t);var i,o,s=e.style,r=[];for(i=0;i=0;i--)this.filters_[i]===t&&this.filters_.splice(i,1);for(i=t._listener.length-1;i>=0;i--)t._listener[i].target===this&&(t.removeFromLayer&&t.removeFromLayer(this),ol.Observable.unByKey(t._listener[i].listener),t._listener.splice(i,1));e.call(this)}else this.filters_.forEach(function(e){this.removeFilter(e)}.bind(this))}ol.Map.prototype.addFilter=function(e){console.warn("[OL-EXT] addFilter deprecated on map."),t.call(this,e)},ol.Map.prototype.removeFilter=function(e){i.call(this,e)},ol.Map.prototype.getFilters=function(){return this.filters_||[]},ol.layer.Base.prototype.addFilter=function(e){t.call(this,e)},ol.layer.Base.prototype.removeFilter=function(e){i.call(this,e)},ol.layer.Base.prototype.getFilters=function(){return this.filters_||[]}}(),ol.filter.Mask=class extends ol.filter.Base{constructor(e){if(super(e=e||{}),e.feature)switch(e.feature.getGeometry().getType()){case"Polygon":case"MultiPolygon":this.feature_=e.feature}this.set("inner",e.inner),this._fillColor=e.fill&&ol.color.asString(e.fill.getColor())||"rgba(0,0,0,0.2)",this._shadowColor=e.shadowColor&&ol.color.asString(e.shadowColor)||"rgba(0,0,0,0.5)",this.set("shadowWidth",e.shadowWidth||0),this.set("shadowMapUnits",!0===e.shadowMapUnits)}setFillColor(e){this._fillColor=e&&ol.color.asString(e)||"rgba(0,0,0,0.2)"}setShadowColor(e){this._shadowColor=e&&ol.color.asString(e)||"rgba(0,0,0,0.5)"}drawFeaturePath_(e,t){var i,o=e.context,s=o.canvas,r=e.frameState.pixelRatio;if(e.frameState.coordinateToPixelTransform){var a=e.frameState.coordinateToPixelTransform;if(e.inversePixelTransform){var n=e.inversePixelTransform;i=function(e){return[(e=[e[0]*a[0]+e[1]*a[1]+a[4],e[0]*a[2]+e[1]*a[3]+a[5]])[0]*n[0]-e[1]*n[1]+n[4],-e[0]*n[2]+e[1]*n[3]+n[5]]}}else i=function(e){return[(e[0]*a[0]+e[1]*a[1]+a[4])*r,(e[0]*a[2]+e[1]*a[3]+a[5])*r]}}else a=e.frameState.coordinateToPixelMatrix,i=function(e){return[(e[0]*a[0]+e[1]*a[1]+a[12])*r,(e[0]*a[4]+e[1]*a[5]+a[13])*r]};var l=this.feature_.getGeometry().getCoordinates();function h(e){for(var t=0;tf&&([m,f]=[f,m]);for(var v=m;v<=f;v++)h(v*u)}else h(0)}postcompose(e){if(this.feature_){var t=e.context;if(t.save(),this.drawFeaturePath_(e,!this.get("inner")),t.fillStyle=this._fillColor,t.fill("evenodd"),this.get("shadowWidth")){var i=this.get("shadowWidth")*e.frameState.pixelRatio;this.get("shadowMapUnits")&&(i/=e.frameState.viewState.resolution),t.clip("evenodd"),t.filter="blur("+i+"px)",t.strokeStyle=this._shadowColor,t.lineCap="round",t.lineJoin="round",t.lineWidth=i,t.stroke()}t.restore()}}},ol.filter.CSS=class extends ol.filter.Base{constructor(e){super(e),this._layers=[]}setBlend(e){this.set("blend",e),this._layers.forEach(function(t){t.once("postrender",function(t){t.context.canvas.parentNode.style["mix-blend-mode"]=e||""}.bind(this)),t.changed()})}setFilter(e){this.set("filter",e),this._layers.forEach(function(t){t.once("postrender",function(t){t.context.canvas.parentNode.style.filter=e||""}.bind(this)),t.changed()})}setDisplay(e){this.set("display",e),this._layers.forEach(function(t){t.once("postrender",function(t){t.context.canvas.parentNode.style.display=e?"":"none"}.bind(this)),t.changed()})}addToLayer(e){e.once("postrender",function(e){e.context.canvas.parentNode.style["mix-blend-mode"]=this.get("blend")||"",e.context.canvas.parentNode.style.filter=this.get("filter")||"",e.context.canvas.parentNode.style.display=!1!==this.get("display")?"":"none"}.bind(this)),e.changed(),this._layers.push(e)}removeFromLayer(e){var t=this._layers.indexOf(e);t>=0&&(e.once("postrender",function(e){e.context.canvas.parentNode.style["mix-blend-mode"]="",e.context.canvas.parentNode.style.filter="",e.context.canvas.parentNode.style.display=""}.bind(this)),e.changed(),this._layers.splice(t,1))}},ol.filter.CanvasFilter=class extends ol.filter.Base{constructor(e){super(e),this._svg={}}addSVGFilter(e){e.getId&&(e="#"+e.getId()),this._svg[e]=1,this.dispatchEvent({type:"propertychange",key:"svg",oldValue:this._svg})}removeSVGFilter(e){e.getId&&(e="#"+e.getId()),delete this._svg[e],this.dispatchEvent({type:"propertychange",key:"svg",oldValue:this._svg})}precompose(){}postcompose(e){var t=[];for(var i in void 0!==this.get("url")&&t.push("url("+this.get("url")+")"),this._svg)t.push("url("+i+")");void 0!==this.get("blur")&&t.push("blur("+this.get("blur")+"px)"),void 0!==this.get("brightness")&&t.push("brightness("+this.get("brightness")+"%)"),void 0!==this.get("contrast")&&t.push("contrast("+this.get("contrast")+"%)"),void 0!==this.get("shadow")&&t.push("drop-shadow("+this.get("shadow")[0]+"px "+this.get("shadow")[1]+"px "+(this.get("shadowBlur")||0)+"px "+this.get("shadowColor")+")"),void 0!==this.get("grayscale")&&t.push("grayscale("+this.get("grayscale")+"%)"),void 0!==this.get("sepia")&&t.push("sepia("+this.get("sepia")+"%)"),void 0!==this.get("hueRotate")&&t.push("hue-rotate("+this.get("hueRotate")+"deg)"),void 0!==this.get("invert")&&t.push("invert("+this.get("invert")+"%)"),void 0!==this.get("saturate")&&t.push("saturate("+this.get("saturate")+"%)"),(t=t.join(" "))&&(e.context.save(),e.context.filter=t,e.context.drawImage(e.context.canvas,0,0),e.context.restore())}},ol.filter.Clip=class extends ol.filter.Base{constructor(e){if(super(e=e||{}),this.set("coords",e.coords),this.set("units",e.units),this.set("keepAspectRatio",e.keepAspectRatio),this.set("extent",e.extent||[0,0,1,1]),this.set("color",e.color),!e.extent&&"%"!=e.units&&e.coords){for(var t,i=1/0,o=1/0,s=-1/0,r=-1/0,a=0;t=e.coords[a];a++)i>t[0]&&(i=t[0]),st[1]&&(o=t[1]),r0;r--)o=r*l/n[0]-(r==n[0]?t[0]*(n[1]%2)+i:0),s=h-t[1]*(r%2)-i,e.lineTo(o,s);for(r=n[1];r>0;r--)o=t[0]*(r%2)+i,s=r*h/n[1]-(r==n[1]?i:0),e.lineTo(o,s);e.closePath()}precompose(e){var t=e.context;t.save(),t.shadowColor="rgba(0,0,0,0.3)",t.shadowBlur=8,t.shadowOffsetX=2,t.shadowOffsetY=3,this.drawLine_(t,this.get("fsize"),this.get("margin")),t.fillStyle="#fff",this.get("fill")&&t.fill(),t.strokeStyle="rgba(0,0,0,0.1)",t.stroke(),t.restore(),t.save(),this.drawLine_(t,this.get("fsize"),this.get("margin")+this.get("padding")),t.clip()}postcompose(e){var t=e.context,i=t.canvas;if(t.restore(),t.save(),this.drawLine_(t,this.get("fsize"),this.get("margin")),t.clip(),this.get("shadow")){var o=this.get("fold"),s=i.width/o[0],r=i.height/o[1],a=t.createRadialGradient(5*s/8,5*s/8,s/4,s/2,s/2,s);a.addColorStop(0,"transparent"),a.addColorStop(1,"rgba(0,0,0,"+this.get("opacity")+")"),t.fillStyle=a,t.scale(1,r/s);for(var n=0;nthis.pixels.length)for(;this.pixels.length-1}:this._whiteList=function(){return!0},"function"==typeof e.blackList?this._blackList=e.blackList:e.blackList&&e.blackList.indexOf?this._blackList=function(t){return e.blackList.indexOf(t)>-1}:this._blackList=function(){return!1},this._deleteNull=!1!==e.deleteNullProperties&&[null,void 0,""];var t=2;e.dataProjection&&"EPSG:4326"!==e.dataProjection||(t=7),isNaN(parseInt(e.decimals))||(t=parseInt(e.decimals)),this._decimals=t,this.setLayout(e.layout||"XY")}setLayout(e){switch(e){case"XYZ":case"XYZM":this._layout=e;break;default:this._layout="XY"}}getLayout(){return this._layout}encodeNumber(e,t){!isNaN(Number(e))&&null!==e&&isFinite(e)||(e=0),t||0===t||(t=this._decimals),(e=Math.round(e*Math.pow(10,t)))<0?e=-2*e-1:e*=2;for(var i,o="",s=e;i=s%this._size,o=this._radix.charAt(i)+o,0!=(s=Math.floor(s/this._size)););return o}decodeNumber(e,t){t||0===t||(t=this._decimals);var i=0;e.split("").forEach(function(e){i=i*this._size+this._radix.indexOf(e)}.bind(this));var o=Math.floor(i/2);return o!==i/2&&(o=-1-o),o/Math.pow(10,t)}encodeCoordinates(e,t){var i,o;if("number"==typeof e[0])return c=this.encodeNumber(e[0],t)+","+this.encodeNumber(e[1],t),"Z"==this._layout[2]&&e.length>2&&(c+=","+this.encodeNumber(e[2],2)),"M"==this._layout[3]&&e.length>3&&(c+=","+this.encodeNumber(e[3],0)),c;if(e.length&&e[0]){if("number"==typeof e[0][0]){var s=[0,0,0,0],r=[],a="Z"==this._layout[2]&&e[0].length>2,n="M"==this._layout[3]&&e[0].length>3;for(i=0;i1){var c="A,A"+(a?",A":"")+(n?",A":"");r.push(c)}return r.join(";")}for(i=0;i1){var s=Math.pow(10,t),r=[0,0,0,0];return e.forEach(function(i,o){e[o]=i.split(","),e[o][0]=Math.round((this.decodeNumber(e[o][0],t)+r[0])*s)/s,e[o][1]=Math.round((this.decodeNumber(e[o][1],t)+r[1])*s)/s,e[o].length>2&&(e[o][2]=Math.round((this.decodeNumber(e[o][2],2)+r[2])*s)/s),e[o].length>3&&(e[o][3]=Math.round((this.decodeNumber(e[o][3],0)+r[3])*s)/s),r=e[o]}.bind(this)),e}return e=e[0].split(","),o=[this.decodeNumber(e[0],t),this.decodeNumber(e[1],t)],e.length>2&&(o[2]=this.decodeNumber(e[2],2)),e.length>3&&(o[3]=this.decodeNumber(e[3],0)),o}if(e.length){var a=[];for(i=0;i0?1:-1)*Math.min(.015,s/7e4*e),t=0;t=0})),"function"==typeof e.featureFilter)this._features=e.featureFilter;else if(e.featureFilter){var o=e.featureFilter;this._features=function(e){return o.indexOf?!!o[o.indexOf(e)]:!!o.item(o.getArray().indexOf(e))}}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(e,t){if(!this._current&&this._features(e,t)){var o=e.getGeometry();if("Polygon"===o.getType()&&o.intersectsCoordinate(i))this._polygonIndex=!1,this._polygon=o,this._current=e;else if("MultiPolygon"===o.getType()&&o.intersectsCoordinate(i))for(var s,r=0;s=o.getPolygon(r);r++)if(s.intersectsCoordinate(i)){this._polygonIndex=r,this._polygon=s,this._current=e;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(!1!==this._polygonIndex){for(var i,o=e.feature.getGeometry(),s=new ol.geom.MultiPolygon([]),r=0;i=o.getPolygon(r);r++)r===this._polygonIndex?(i.appendLinearRing(new ol.geom.LinearRing(t)),s.appendPolygon(i)):s.appendPolygon(i);e.feature.setGeometry(s)}else this.getPolygon().appendLinearRing(new ol.geom.LinearRing(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 ol.geom.Polygon(e),t}},ol.interaction.DrawRegular=class extends ol.interaction.Interaction{constructor(e){e=e||{},super({handleEvent:function(e){return t.handleEvent_(e)}});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_=!1!==e.canRotate,this.geometryName_=e.geometryName||"geometry",this.setSides(e.sides);var i=ol.style.Style.defaultStyle(!0);this.sketch_=new ol.Collection,this.overlayLayer_=new ol.layer.Vector({source:new ol.source.Vector({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!0!==e&&!1!==e||(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,i,o,s,r,a=this.center_,n=this.coord_;if(!this.sides_&&this.square_&&!this.centered_)return a=[(n[0]+a[0])/2,(n[1]+a[1])/2],t=[n[0]-a[0],n[1]-a[1]],o=Math.sqrt(t[0]*t[0]+t[1]*t[1]),s=new ol.geom.Circle(a,o,"XY"),r=this.getMap().getPixelFromCoordinate(a),i=Math.max(100,Math.abs(r[0]-this.coordPx_[0]),Math.abs(r[1]-this.coordPx_[1])),i=Math.min(this.maxCircleCoordinates_,Math.round(i/3)),ol.geom.Polygon.fromCircle(s,i,0);var l=this.canRotate_&&this.centered_&&this.square_;if(t=[n[0]-a[0],n[1]-a[1]],this.square_&&!l){var h=Math.max(Math.abs(t[0]),Math.abs(t[1]));n=[a[0]+(t[0]>0?h:-h),a[1]+(t[1]>0?h:-h)]}if((o=Math.sqrt(t[0]*t[0]+t[1]*t[1]))>0){var c;if(s=new ol.geom.Circle(a,o,"XY"),c=l?Math.atan2(t[1],t[0]):this.startAngle[this.sides_]||this.startAngle.default,this.sides_?e=ol.geom.Polygon.fromCircle(s,this.sides_,c):(r=this.getMap().getPixelFromCoordinate(this.center_),i=Math.max(100,Math.abs(r[0]-this.coordPx_[0]),Math.abs(r[1]-this.coordPx_[1])),i=Math.min(this.maxCircleCoordinates_,Math.round(i/(this.centered_?3:5))),e=ol.geom.Polygon.fromCircle(s,i,0)),l)return e;var u=e.getExtent(),d=((a=this.centered_?[2*this.center_[0]-this.coord_[0],2*this.center_[1]-this.coord_[1]]:this.center_)[0]-n[0])/(u[0]-u[2]),g=(a[1]-n[1])/(u[1]-u[3]);if(this.square_){var p=Math.min(Math.abs(d),Math.abs(g));d=Math.sign(d)*p,g=Math.sign(g)*p}var m=[a[0]-u[0]*d,a[1]-u[1]*g];return e.applyTransform(function(e,t,i){for(var o=0;o450,this._longTouch&&this.handleMoveEvent_(e)}.bind(this),500);break;case"pointerup":this.started_&&this.coord_&&(t=this.downPx_[0]-e.pixel[0])*t+(i=this.downPx_[1]-e.pixel[1])*i<=this.squaredClickTolerance_&&("pointermove"==this.lastEvent||"keydown"==this.lastEvent?this.end_(e):(t=this.upPx_[0]-e.pixel[0])*t+(i=this.upPx_[1]-e.pixel[1])*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 o=this.getMap().getPixelFromCoordinate(this.center_);(t=o[0]-e.pixel[0])*t+(i=o[1]-e.pixel[1])*i<=this.squaredClickTolerance_&&this.reset()}return!this._longTouch;case"pointermove":this.started_&&(t=this.downPx_[0]-e.pixel[0])*t+(i=this.downPx_[1]-e.pixel[1])*i>this.squaredClickTolerance_&&(this.handleMoveEvent_(e),this.lastEvent=e.type);break;default:if(this.lastEvent=e.type,this.started_&&"dblclick"===e.type)return!1}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 ol.Feature({});t.setGeometryName(this.geometryName_||"geometry"),t.setGeometry(new ol.geom.Polygon([[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])this.dispatchEvent({type:"drawcancel",feature:null,pixel:e.pixel,coordinate:e.coordinate,square:this.square_,centered:this.centered_});else{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_})}this.center_=this.coord_=null,this.drawSketch_()}},ol.interaction.DrawRegular.prototype.startAngle={default:Math.PI/2,3:-Math.PI/2,4:Math.PI/4},ol.interaction.DrawTouch=class extends ol.interaction.CenterTouch{constructor(e){(e=e||{}).handleEvent=function(e){if(this.get("tap"))switch(this.sketch.setPosition(this.getPosition()),e.type){case"singleclick":this.addPoint();break;case"dblclick":return this.addPoint(),this.finishDrawing(),!1}return!0},super(e),e.sketchStyle||(e.sketchStyle=ol.style.Style.defaultStyle());var t=this.sketch=new ol.layer.SketchOverlay(e);t.on(["drawstart","drawabort"],function(e){this.dispatchEvent(e)}.bind(this)),t.on(["drawend"],function(t){t.feature&&t.valid&&e.source&&e.source.addFeature(t.feature),this.dispatchEvent(t)}.bind(this)),this._source=e.source,this.set("tap",!1!==e.tap),this.setActive(!1!==e.active)}setMap(e){if(this._listener)for(var t in this._listener)ol.Observable.unByKey(t);this._listener={},super.setMap(e),this.sketch.setMap(e),e&&(this._listener.center=e.on("postcompose",function(){ol.coordinate.equal(this.getPosition(),this.sketch.getPosition()||[])||this.sketch.setPosition(this.getPosition())}.bind(this)))}setGeometryType(e){return this.sketch.setGeometryType(e)}getGeometryType(){return this.sketch.getGeometryType()}finishDrawing(){this.sketch.finishDrawing(!0)}addPoint(){this.sketch.addPoint(this.getPosition())}removeLastPoint(){this.sketch.removeLastPoint()}setActive(e){super.setActive(e),this.sketch&&(this.sketch.abortDrawing(),this.sketch.setVisible(e))}},ol.interaction.DropFile=class extends ol.interaction.Interaction{constructor(e){e=e||{},super({});var t=e.zone||document;t.addEventListener("dragenter",this.onstop),t.addEventListener("dragover",this.onstop),t.addEventListener("dragleave",this.onstop),this.formatConstructors_=e.formatConstructors||[ol.format.GPX,ol.format.GeoJSONX,ol.format.GeoJSONP,ol.format.GeoJSON,ol.format.IGC,ol.format.KML,ol.format.TopoJSON],this.projection_=e.projection,this.accept_=e.accept||["gpx","json","geojsonx","geojsonp","geojson","igc","kml","topojson"],t.addEventListener("drop",function(e){return this.ondrop(e)}.bind(this))}setMap(e){super.setMap(e)}onstop(e){return e.preventDefault(),e.stopPropagation(),!1}ondrop(e){if(e.preventDefault(),e.dataTransfer&&e.dataTransfer.files.length){var t=this.projection_||(this.getMap()?this.getMap().getView().getProjection():null),i=e.dataTransfer.files,o=/\.([0-9a-z]+)(?=[?#])|(\.)(?:[\w]+)$/;Array.prototype.forEach.call(i,function(e){var i=e.name.match(o)[0],s=this.accept_.indexOf(i.toLocaleLowerCase())>=0;if(this.dispatchEvent({type:"loadstart",file:e,filesize:e.size,filetype:e.type,fileextension:i,projection:t,isok:s}),this.formatConstructors_.length){var r=new FileReader,a=this.formatConstructors_,n=e;r.onload=function(e){var i,o,s=e.target.result,r=[];for(i=0,o=a.length;i0)return this.dispatchEvent({type:"addfeatures",features:r,file:n,projection:t}),void this.dispatchEvent({type:"loadend",features:r,file:n,projection:t})}catch(e){}}this.dispatchEvent({type:"loadend",file:n,result:s})}.bind(this),r.readAsText(e)}}.bind(this))}return!1}},ol.interaction.FillAttribute=class extends ol.interaction.Select{constructor(e,t){if((e=e||{}).condition||(e.condition=ol.events.condition.click),super(e),this.setActive(!1!==e.active),this.set("name",e.name),this._attributes=t,this.on("select",function(e){this.getFeatures().clear(),this.fill(e.selected,this._attributes)}.bind(this)),void 0===e.cursor){var i=document.createElement("CANVAS");i.width=i.height=32;var o=i.getContext("2d");o.beginPath(),o.moveTo(9,3),o.lineTo(2,9),o.lineTo(10,17),o.lineTo(17,11),o.closePath(),o.fillStyle="#fff",o.fill(),o.stroke(),o.beginPath(),o.moveTo(6,4),o.lineTo(0,8),o.lineTo(0,13),o.lineTo(3,17),o.lineTo(3,8),o.closePath(),o.fillStyle="#000",o.fill(),o.stroke(),o.moveTo(8,8),o.lineTo(10,0),o.lineTo(11,0),o.lineTo(13,3),o.lineTo(13,7),o.stroke(),this._cursor="url("+i.toDataURL()+") 0 13, auto"}e.cursor&&(this._cursor=e.cursor)}setCursor(e){this._cursor=e}getCursor(){return this._cursor}setActive(e){e!==this.getActive()&&(super.setActive(e),this.getMap()&&this._cursor&&(e?(this._previousCursor=this.getMap().getTargetElement().style.cursor,this.getMap().getTargetElement().style.cursor=this._cursor):(this.getMap().getTargetElement().style.cursor=this._previousCursor,this._previousCursor=void 0)))}setAttributes(e){this._attributes=e}setAttribute(e,t){this._attributes[e]=t}getAttributes(){return this._attributes}getAttribute(e){return this._attributes[e]}fill(e,t){if(e.length&&t){for(var i,o=!1,s=0;i=e[s];s++){for(var r in t)i.get(r)!==t[r]&&(o=!0);if(o)break}o&&(this.dispatchEvent({type:"setattributestart",features:e,properties:t}),e.forEach(function(e){for(var i in t)e.set(i,t[i])}),this.dispatchEvent({type:"setattributeend",features:e,properties:t}))}}},ol.interaction.Flashlight=class extends ol.interaction.Pointer{constructor(e){super({handleDownEvent:function(e){return this.setPosition(e)},handleMoveEvent:function(e){return this.setPosition(e)}}),e=e||{},this.pos=!1,this.radius=e.radius||100,this.setColor(e)}setMap(e){this.getMap()&&this.getMap().render(),this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,super.setMap(e),e&&(this._listener=e.on("postcompose",this.postcompose_.bind(this)))}setRadius(e){if(this.radius=e,this.getMap())try{this.getMap().renderSync()}catch(e){}}setColor(e){var t=e.fill?e.fill:[0,0,0,.8],i=ol.color.asArray(t);if(this.startColor=ol.color.asString(i),e.color?(this.endColor=ol.color.asString(ol.color.asArray(e.color)||e.color),i=ol.color.asArray(this.endColor)):(i[3]=0,this.endColor=ol.color.asString(i)),this.midColor=ol.color.asString(i),this.getMap())try{this.getMap().renderSync()}catch(e){}}setPosition(e){if(e.pixel?this.pos=e.pixel:this.pos=e,this.getMap())try{this.getMap().renderSync()}catch(e){}}postcompose_(e){var t=ol.ext.getMapCanvas(this.getMap()).getContext("2d"),i=e.frameState.pixelRatio,o=t.canvas.width,s=t.canvas.height;if(t.save(),t.scale(i,i),this.pos){var r=Math.max(o,s),a=t.createRadialGradient(this.pos[0],this.pos[1],o*this.radius/r,this.pos[0],this.pos[1],s*this.radius/r);a.addColorStop(0,this.startColor),a.addColorStop(.8,this.midColor),a.addColorStop(1,this.endColor),t.fillStyle=a,t.fillRect(this.pos[0]-r,this.pos[1]-r,2*r,2*r)}else t.fillStyle=this.startColor,t.fillRect(0,0,o,s);t.restore()}},ol.interaction.FocusMap=class extends ol.interaction.Interaction{constructor(){super({}),this.focusBt=ol.ext.element.create("BUTTON",{on:{focus:function(){this.dispatchEvent({type:"focus"})}.bind(this)},style:{position:"absolute",zIndex:-1,top:0,opacity:0}})}setMap(e){this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,this.getMap()&&this.getMap().getViewport().removeChild(this.focusBt),super.setMap(e),this.getMap()&&(this._listener=this.getMap().on("pointerdown",function(){this.getActive()&&this.focusBt.focus()}.bind(this)),this.getMap().getViewport().appendChild(this.focusBt))}},ol.interaction.GeolocationDraw=class extends ol.interaction.Interaction{constructor(e){e=e||{},super({handleEvent:function(){return!this.get("followTrack")||"auto"==this.get("followTrack")}}),this.geolocation=new ol.Geolocation({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],o=new ol.style.Circle({radius:6,fill:new ol.style.Fill({color:i}),stroke:new ol.style.Stroke({color:t,width:1.5})}),s=[new ol.style.Style({stroke:new ol.style.Stroke({color:t,width:5})}),new ol.style.Style({stroke:new ol.style.Stroke({color:i,width:3}),fill:new ol.style.Fill({color:[255,255,255,.5]})})],r=new ol.style.RegularShape({radius:10.5,points:3,rotation:0,fill:new ol.style.Fill({color:i}),stroke:new ol.style.Stroke({color:t,width:1.5})}),a=r.getImage(),n=a.getContext("2d"),l=document.createElement("canvas");l.width=l.height=a.width,l.getContext("2d").drawImage(a,0,0),n.clearRect(0,0,a.width,a.height),n.drawImage(l,0,0,a.width,a.height,3,0,a.width-6,a.height);this.locStyle={error:new ol.style.Style({fill:new ol.style.Fill({color:[255,0,0,.2]})}),warn:new ol.style.Style({fill:new ol.style.Fill({color:[255,192,0,.2]})}),ok:new ol.style.Style({fill:new ol.style.Fill({color:[0,255,0,.2]})})},this.overlayLayer_=new ol.layer.Vector({source:new ol.source.Vector,name:"GeolocationDraw overlay",style:e.style||function(e){return void 0===e.get("heading")?s[1].setImage(o):(s[1].setImage(r),r.setRotation(e.get("heading")||0)),s}}),this.sketch_=[new ol.Feature,new ol.Feature,new ol.Feature],this.overlayLayer_.getSource().addFeatures(this.sketch_),this.features_=e.features,this.source_=e.source,this.condition_=e.condition||function(e){return e.getAccuracy()t&&(r.push(i[n]),a=s)}return r[r.length-1]!==i[i.length-1]&&r.push(i[i.length-1]),e="Polygon"===this.get("type")?new ol.geom.Polygon([r],"XYZM"):new ol.geom.LineString(r,"XYZM")}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(e){}}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){var i=(t=t||{}).delay||1e3;this._track={track:e,pos:0,timeout:setTimeout(function e(){if(this._track.pos>=this._track.track.length)this._track=!1;else{var o=this._track.track[this._track.pos];o[2]=o[3]||0,o[3]=(new Date).getTime(),this._track.pos++,!1!==t.repeat&&(this._track.pos=this._track.pos%this._track.track.length),this.getActive()&&this.draw_(!0,o,t.accuracy),this._track.timeout=setTimeout(e.bind(this),i)}}.bind(this),0)}}else this._track=!1}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_=!1!==e}isPaused(){return this.pause_}setFollowTrack(e){this.set("followTrack",e);var t,i=this.getMap();if(this.getActive()&&i)if("position"!==e&&(t=this.get("minZoom")?Math.max(this.get("minZoom"),i.getView().getZoom()):this.get("zoom")),!1===e||this.lastPosition_)"auto"===e&&this.lastPosition_&&i.getView().animate({center:this.lastPosition_,zoom:t});else{var o=this.path_[this.path_.length-1];o&&i.getView().animate({center:o,zoom:t})}this.lastPosition_=!1,this.dispatchEvent({type:"follow",following:!1!==e})}draw_(e,t,i){var o=this.getMap();if(o){var s,r,a,n,l;if(this._track){if(!0!==e)return;if(r=t,s=i||10,this.path_&&this.path_.length){var h=this.path_[this.path_.length-1];l=Math.atan2(t[0]-h[0],t[1]-h[1])}var c=new ol.geom.Circle(r,o.getView().getResolution()*s);a=ol.geom.Polygon.fromCircle(c)}else s=(n=this.geolocation).getAccuracy(),r=this.getPosition(n),a=n.getAccuracyGeometry(),l=n.getHeading();switch(this.get("followTrack")){case!0:1==this.get("followTrack")&&(this.get("minZoom")?this.get("minZoom")>o.getView().getZoom()&&o.getView().setZoom(this.get("minZoom")):o.getView().setZoom(this.get("zoom")||16),ol.extent.containsExtent(o.getView().calculateExtent(o.getSize()),a.getExtent())||o.getView().fit(a.getExtent())),o.getView().setCenter(r);break;case"position":o.getView().setCenter(r);break;case"auto":if(this.lastPosition_){var u=o.getView().getCenter();u[0]!=this.lastPosition_[0]||u[1]!=this.lastPosition_[1]?this.setFollowTrack(!1):(o.getView().setCenter(r),this.lastPosition_=r)}else o.getView().setCenter(r),this.get("minZoom")?this.get("minZoom")>o.getView().getZoom()&&o.getView().setZoom(this.get("minZoom")):this.get("zoom")&&o.getView().setZoom(this.get("zoom")),this.lastPosition_=r;break;case"visible":ol.extent.containsCoordinate(o.getView().calculateExtent(o.getSize()),r)||o.getView().setCenter(r)}var d,g=this.sketch_[0];if(g.setGeometry(a),s1?(d=new ol.geom.LineString(this.path_,"XYZM"),this.get("tolerance")&&(d=this.simplify3D(d,this.get("tolerance"))),g.setGeometry(d)):g.setGeometry();break;case"Polygon":this.path_.length>2?(d=new ol.geom.Polygon([this.path_],"XYZM"),this.get("tolerance")&&(d=this.simplify3D(d,this.get("tolerance"))),g.setGeometry(d)):g.setGeometry()}this.dispatchEvent({type:"drawing",feature:this.sketch_[1],geolocation:n})}this.sketch_[2].setGeometry(new ol.geom.Point(r)),this.sketch_[2].set("heading",l),this.dispatchEvent({type:"tracking",feature:this.sketch_[1],geolocation:n})}}getPosition(e){var t=e.getPosition();return t.push(Math.round(100*(e.getAltitude()||0))/100),t.push(Math.round((new Date).getTime()/1e3)),t}},ol.interaction.Hover=class extends ol.interaction.Interaction{constructor(e){e||(e=e||{});var t=!1;super({handleEvent:function(o){if(!i.getActive())return!0;switch(o.type){case"pointerdrag":t=!0;break;case"pointerup":t=!1;break;case"pointermove":t||i.handleMove_(o)}return!e.handleEvent||e.handleEvent(o)}});var i=this;this.setLayerFilter(e.layerFilter),e.layers&&e.layers.length&&this.setLayerFilter(function(t){return e.layers.indexOf(t)>=0}),this.setFeatureFilter(e.featureFilter),this.set("hitTolerance",e.hitTolerance),this.setCursor(e.cursor)}setMap(e){void 0!==this.previousCursor_&&this.getMap()&&(this.getMap().getTargetElement().style.cursor=this.previousCursor_,this.previousCursor_=void 0),super.setMap(e)}setActive(e){if(super.setActive(e),this.cursor_&&this.getMap()&&this.getMap().getTargetElement()){var t=this.getMap().getTargetElement().style;void 0!==this.previousCursor_&&(t.cursor=this.previousCursor_,this.previousCursor_=void 0)}}setCursor(e){!e&&void 0!==this.previousCursor_&&this.getMap()&&(this.getMap().getTargetElement().style.cursor=this.previousCursor_,this.previousCursor_=void 0),this.cursor_=e}setFeatureFilter(e){this.featureFilter_="function"==typeof e?e:function(){return!0}}setLayerFilter(e){this.layerFilter_="function"==typeof e?e:function(){return!0}}handleMove_(e){var t=this.getMap();if(t){var i,o,s=this,r=t.forEachFeatureAtPixel(e.pixel,function(e,t){return s.featureFilter_.call(null,e,t)?(i=e,o=t,!0):(i=o=null,!1)},{hitTolerance:this.get("hitTolerance"),layerFilter:s.layerFilter_});if(r&&this.dispatchEvent({type:"hover",feature:i,layer:o,coordinate:e.coordinate,pixel:e.pixel,map:e.map,originalEvent:e.originalEvent,dragging:e.dragging}),this.feature_===i&&this.layer_===o||(this.feature_=i,this.layer_=o,i?this.dispatchEvent({type:"enter",feature:i,layer:o,coordinate:e.coordinate,pixel:e.pixel,map:e.map,originalEvent:e.originalEvent,dragging:e.dragging}):this.dispatchEvent({type:"leave",coordinate:e.coordinate,pixel:e.pixel,map:e.map,originalEvent:e.originalEvent,dragging:e.dragging})),this.cursor_){var a=t.getTargetElement().style;r?a.cursor!=this.cursor_&&(this.previousCursor_=a.cursor,a.cursor=this.cursor_):void 0!==this.previousCursor_&&(a.cursor=this.previousCursor_,this.previousCursor_=void 0)}}}},ol.interaction.LongTouch=class extends ol.interaction.Interaction{constructor(e){var t,i,o=(e=e||{}).handleLongTouchEvent||function(){},s=null,r=e.pixelTolerance||0;super({handleEvent:function(e){if(this.getActive())switch(e.type){case"pointerdown":s&&clearTimeout(s),t=e.pixel,i={type:"longtouch",originalEvent:e.originalEvent,frameState:e.frameState,pixel:e.pixel,coordinate:e.coordinate,map:this.getMap()},s=setTimeout(function(){o(i),i.map.dispatchEvent(i)},this.delay_);break;case"pointerdrag":s&&(Math.abs(e.pixel[0]-t[0])>r||Math.abs(e.pixel[1]-t[1])>r)&&(clearTimeout(s),s=null);break;case"pointerup":s&&(clearTimeout(s),s=null)}else s&&(clearTimeout(s),s=null);return!0}}),this.delay_=e.delay||1e3}},ol.interaction.Modify.prototype.getModifiedFeatures=function(){var e={};this.dragSegments_.forEach(function(t){var i=t[0].feature;window&&window.ol&&window.ol.util?e[ol.util.getUid(i)]=i:e[ol.getUid(i)]=i});var t=[];for(var i in e)t.push(e[i]);return t},ol.interaction.ModifyFeature=class extends ol.interaction.Interaction{constructor(e){var t,i;e=e||{},super({handleEvent:function(e){switch(e.type){case"pointerdown":return t=this.handleDownEvent(e),i=t||this._deleteCondition(e),!t;case"pointerup":return t=!1,this.handleUpEvent(e);case"pointerdrag":return!t||this.handleDragEvent(e);case"pointermove":return!t&&this.handleMoveEvent(e);case"singleclick":case"click":return!i;default:return!0}}}),this.snapDistance_=e.pixelTolerance||10,this.tolerance_=1e-10,this.cursor_=e.cursor,this.sources_=e.sources?e.sources instanceof Array?e.sources:[e.sources]:[],e.source&&this.sources_.push(e.source),e.features&&this.sources_.push(new ol.source.Vector({features:e.features})),this.filterSplit_=e.filter||function(){return!0},this._condition=e.condition||ol.events.condition.primaryAction,this._deleteCondition=e.deleteCondition||ol.events.condition.altKeyOnly,this._insertVertexCondition=e.insertVertexCondition||ol.events.condition.always;var o=function(){return[new ol.style.Style({image:new ol.style.Circle({radius:6,fill:new ol.style.Fill({color:[0,153,255,1]}),stroke:new ol.style.Stroke({color:"#FFF",width:1.25})})})]};e.style&&(o="function"==typeof e.style?e.style:function(){return e.style}),this.overlayLayer_=new ol.layer.Vector({source:new ol.source.Vector({useSpatialIndex:!1}),name:"Modify overlay",displayInLayerSwitcher:!1,style:o,wrapX:e.wrapX})}setMap(e){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),super.setMap(e),this.overlayLayer_.setMap(e)}setActive(e){super.setActive(e),this.overlayLayer_&&this.overlayLayer_.getSource().clear()}setFilter(e){"function"==typeof e?this.filterSplit_=e:void 0===e&&(this.filterSplit_=function(){return!0})}getClosestFeature(e){for(var t,i,o=this.snapDistance_+1,s=0;sthis.snapDistance_)return this.currentFeature&&this.dispatchEvent({type:"select",selected:[],deselected:[this.currentFeature]}),this.currentFeature=null,!1;var l=this.getNearestCoord(i,t.getGeometry());if(l){l=l.coord;var h=this.getMap().getPixelFromCoordinate(l);return ol.coordinate.dist2d(e.pixel,h)2){for(i=h[1].getCoordinates(),o=2;s=h[o];o++){var c=s.getCoordinates();c.shift(),i=i.concat(c)}h=[h[0],new ol.geom.LineString(i)]}if(2===h.length){var u=h[0].getCoordinates(),d=h[1].getCoordinates(),g=u.length+d.length-1;u.pop(),d.shift(),n={geom:e,type:e.getType(),coord1:u,coord2:d,node:e.getCoordinates().length===g,closed:!1}}else if(1===h.length){s=h[0].getCoordinates();var p=ol.coordinate.equal(s[0],t),m=ol.coordinate.equal(s[s.length-1],t);p?(s.shift(),m&&s.pop(),n={geom:e,type:e.getType(),coord1:[],coord2:s,node:!0,closed:m}):m&&(s.pop(),n={geom:e,type:e.getType(),coord1:s,coord2:[],node:!0,closed:!1})}}break;case"MultiLineString":var f=e.getLineStrings();for(o=0;r=f[o];o++)if(n=this.getArcs(r,t)){n.geom=e,n.type=e.getType(),n.lstring=o;break}break;case"Polygon":var v=e.getLinearRings();for(o=0;r=v[o];o++)if(n=this.getArcs(r,t)){n.geom=e,n.type=e.getType(),n.index=o;break}break;case"MultiPolygon":var y=e.getPolygons();for(o=0;r=y[o];o++)if(n=this.getArcs(r,t)){n.geom=e,n.type=e.getType(),n.poly=o;break}break;case"GeometryCollection":for(a=e.getGeometries(),o=0;r=a[o];o++)if(n=this.getArcs(r,t)){n.geom=e,n.g=o,n.typeg=n.type,n.type=e.getType();break}break;default:console.error("ol/interaction/ModifyFeature "+e.getType()+" not supported!")}return n}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(e){var o=ol.extent.buffer(ol.extent.boundingExtent([t.coord]),this.tolerance_);i=i.concat(i,e.getFeaturesInExtent(o))}.bind(this)),this._modifiedFeatures=[],i.forEach(function(i){var o=this.getArcs(i.getGeometry(),t.coord);o&&(this._insertVertexCondition(e)||o.node)&&(o.feature=i,this._modifiedFeatures.push(i),this.arcs.push(o))}.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))}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())[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())[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 o=e.geom,s=o.getGeometries();e.geom=s[e.g];var r=this._getModification(e);return o.setGeometries(s),e.geom=o,e.type="GeometryCollection",r}return!1}_removePoint(e,t){if(!this.arcs)return!1;this.overlayLayer_.getSource().clear();var i=!1;return this.arcs.forEach(function(e){i=i||this._getModification(e)}.bind(this)),i&&(this.dispatchEvent({type:"modifystart",coordinate:e.coord,originalEvent:t.originalEvent,features:this._modifiedFeatures}),this.arcs.forEach(function(e){if("GeometryCollection"===e.geom.getType()){if(e.coords){var t=e.geom.getGeometries();t[e.g].setCoordinates(e.coords),e.geom.setGeometries(t)}}else e.coords&&e.geom.setCoordinates(e.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))}setArcCoordinates(e,t){var i;switch(e.type){case"Point":e.geom.setCoordinates(t[0]);break;case"MultiPoint":(i=e.geom.getCoordinates())[e.index]=t[0],e.geom.setCoordinates(i);break;case"LineString":e.geom.setCoordinates(t);break;case"MultiLineString":(i=e.geom.getCoordinates())[e.lstring]=t,e.geom.setCoordinates(i);break;case"Polygon":(i=e.geom.getCoordinates())[e.index]=t,e.geom.setCoordinates(i);break;case"MultiPolygon":(i=e.geom.getCoordinates())[e.poly][e.index]=t,e.geom.setCoordinates(i);break;case"GeometryCollection":e.type=e.typeg;var o=e.geom,s=o.getGeometries();e.geom=s[e.g],this.setArcCoordinates(e,t),o.setGeometries(s),e.geom=o,e.type="GeometryCollection"}}handleDragEvent(e){if(!this.getActive())return!1;if(!this.arcs)return!0;this.overlayLayer_.getSource().clear();var t=new ol.Feature(new ol.geom.Point(e.coordinate));return this.overlayLayer_.getSource().addFeature(t),!this.arcs.length||(this.arcs.forEach(function(t){var i=t.coord1.concat([e.coordinate],t.coord2);t.closed&&i.push(e.coordinate),this.setArcCoordinates(t,i)}.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 ol.Feature(new ol.geom.Point(t.coord));this.overlayLayer_.getSource().addFeature(i)}var o=e.map.getTargetElement();return this.cursor_&&(t?o.style.cursor!=this.cursor_&&(this.previousCursor_=o.style.cursor,o.style.cursor=this.cursor_):void 0!==this.previousCursor_&&(o.style.cursor=this.previousCursor_,this.previousCursor_=void 0)),!0}getCurrentFeature(){return this.currentFeature}},ol.interaction.ModifyTouch=class extends ol.interaction.Modify{constructor(e){var t=((e=e||{}).pixelTolerance||0)+5;e.condition=function(e){var i,o,s=this.getMap().getFeaturesAtPixel(e.pixel,{hitTolerance:t}),r=!1;if(s){var a=this._features;if(!a){i=[e.pixel[0]-t,e.pixel[1]-t],o=[e.pixel[0]+t,e.pixel[1]+t],i=this.getMap().getCoordinateFromPixel(i),o=this.getMap().getCoordinateFromPixel(o);var n=ol.extent.boundingExtent([i,o]);a=this._source.getFeaturesInExtent(n)}a.getArray&&(a=a.getArray());for(var l,h=0;(l=s[h])&&!(a.indexOf(l)>=0);h++);if(l){i=e.pixel,o=l.getGeometry().getClosestPoint(e.coordinate),o=this.getMap().getPixelFromCoordinate(o);var c=i[0]-o[0],u=i[1]-o[1];r=Math.sqrt(c*c+u*u)1)return!1;var n=s.getGeometry().getClosestPoint(e.coordinate),l=n[0]-e.coordinate[0],h=n[1]-e.coordinate[1];return Math.sqrt(l*l+h*h)/e.frameState.viewState.resolution<5&&{feature:s,hit:n,coordinates:s.getGeometry().getCoordinates(),geom:s.getGeometry().clone(),geomType:a}}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)}handleDragEvent_(e){this._modifystart&&(this.dispatchEvent({type:"modifystart",features:[this.current_.feature]}),this._modifystart=!1);var t,i,o,s,r=this.current_.geom.getClosestPoint(e.coordinate),a=ol.coordinate.dist2d(r,e.coordinate);switch(this.current_.geomType){case"Polygon":if(t=ol.coordinate.findSegment(r,this.current_.coordinates[0]).segment){i=[t[1][0]-t[0][0],t[1][1]-t[0][1]],o=[e.coordinate[0]-r[0],e.coordinate[1]-r[1]],i[0]*o[1]-i[1]*o[0]>0&&(a=-a),s=[];for(var n=0;n0&&(a=-a),s=ol.coordinate.offsetCoords(this.current_.coordinates,a),this.current_.feature.setGeometry(new ol.geom.LineString(s)))}this.dispatchEvent({type:"offsetting",feature:this.current_.feature,offset:a,segment:[r,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){this.getFeatureAtPixel_(e)?(!1===this.previousCursor_&&(this.previousCursor_=e.map.getTargetElement().style.cursor),e.map.getTargetElement().style.cursor="pointer"):(e.map.getTargetElement().style.cursor=this.previousCursor_,this.previousCursor_=!1)}},ol.interaction.Ripple=class extends ol.interaction.Pointer{constructor(e){super({handleDownEvent:function(e){return this.rainDrop(e)},handleMoveEvent:function(e){return this.rainDrop(e)}}),e=e||{},this.riprad=e.radius||3,this.ripplemap=[],this.last_map=[],this.rains(this.interval),e.layer.on(["postcompose","postrender"],this.postcompose_.bind(this))}rains(e){this.onrain&&clearTimeout(this.onrain);var t=this,i=("number"==typeof e?e:1e3)/2,o=3*i/2,s=Math.random;o&&function e(){t.width&&t.rainDrop([s()*t.width,s()*t.height]),t.onrain=setTimeout(e,s()*i+o)}()}rainDrop(e){if(this.width){var t,i;e.pixel?(t=e.pixel[0]*this.ratio,i=e.pixel[1]*this.ratio):(t=e[0]*this.ratio,i=e[1]*this.ratio),t<<=0;for(var o=(i<<=0)-this.riprad*this.ratio;o>1,this.half_height=this.height>>1,this.size=this.width*(this.height+2)*2,this.oldind=this.width,this.newind=this.width*(this.height+3);for(var l=0;l>1,o-=this.ripplemap[p],o-=o>>5,this.ripplemap[p]=o,o=1024-o,this.last_map[l]!=o&&(this.last_map[l]=o,t=((g-this.half_width)*o/1024<<0)+this.half_width,i=((d-this.half_height)*o/1024<<0)+this.half_height,t>=this.width&&(t=this.width-1),t<0&&(t=0),i>=this.height&&(i=this.height-1),i<0&&(i=0),r=4*(t+i*this.width),c[s=4*l]=u[r],c[s+1]=u[r+1],c[s+2]=u[r+2]),++l}a.putImageData(this.ripple,0,0),this.getMap().render()}},ol.interaction.SelectCluster=class extends ol.interaction.Select{constructor(e){e=e||{};var t=new ol.layer.Vector({source:new ol.source.Vector({features:new ol.Collection,wrapX:e.wrapX,useSpatialIndex:!0}),name:"Cluster overlay",updateWhileAnimating:!0,updateWhileInteracting:!0,displayInLayerSwitcher:!1,style:e.featureStyle});if(e.layers)if("function"==typeof e.layers){var i=e.layers;e.layers=function(e){return e===t||i(e)}}else e.layers.push&&e.layers.push(t);if(e.filter){var o=e.filter;e.filter=function(e,t){return!(!t&&e.get("selectclusterlink"))&&o(e,t)}}else e.filter=function(e,t){return!(!t&&e.get("selectclusterlink"))};!1!==e.autoClose||e.toggleCondition||(e.toggleCondition=ol.events.condition.singleClick),super(e),this.overlayLayer_=t,this.filter_=e.filter,this.pointRadius=e.pointRadius||12,this.circleMaxObjects=e.circleMaxObjects||10,this.maxObjects=e.maxObjects||60,this.spiral=!1!==e.spiral,this.animate=e.animate,this.animationDuration=e.animationDuration||500,this.selectCluster_=!1!==e.selectCluster,this._autoClose=!1!==e.autoClose,this.on("select",this.selectCluster.bind(this))}setMap(e){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,super.setMap(e),this.overlayLayer_.setMap(e),e&&e.getView()&&(this._listener=e.getView().on("change:resolution",this.clear.bind(this)))}clear(){this.getFeatures().clear(),this.overlayLayer_.getSource().clear()}getLayer(){return this.overlayLayer_}selectCluster(e){if(e instanceof ol.Feature&&(e={selected:[e]}),e.selected.length){var t=e.selected[0];if(!t.get("selectclusterfeature")){var i=this.overlayLayer_.getSource();this._autoClose&&i.clear();var o=t.get("features");if(o&&1!=o.length){this.selectCluster_||this.getFeatures().clear();var s,r,a,n,l,h,c,u=t.getGeometry().getCoordinates(),d=this.getMap().getView().getResolution(),g=[];if(!this.spiral||o.length<=this.circleMaxObjects)for(n=Math.min(o.length,this.circleMaxObjects),s=d*this.pointRadius*(.5+n/4),a=0;a{var t=e.get("selectcluserfeatures");t&&t.forEach(e=>{this.overlayLayer_.getSource().removeFeature(e)})})}}animateCluster_(e,t){if(this.listenerKey_&&ol.Observable.unByKey(this.listenerKey_),t.length){var i=this.overlayLayer_.getStyle(),o="function"==typeof i?i:i.length?function(){return i}:function(){return[i]},s=this.animationDuration||500,r=(new Date).getTime();this.listenerKey_=this.overlayLayer_.on(["postcompose","postrender"],function(i){for(var a,n=i.vectorContext||ol.render.getVectorContext(i),l=i.frameState.pixelRatio,h=this.getMap().getView().getResolution(),c=ol.easing.easeOut((i.frameState.time-r)/s),u=0;a=t[u];u++)if(a.get("features")){var d=a.getGeometry().getCoordinates();d[0]=e[0]+c*(d[0]-e[0]),d[1]=e[1]+c*(d[1]-e[1]);for(var g=new ol.geom.Point(d),p=o(a,h),m=0;m1)return ol.Observable.unByKey(this.listenerKey_),this.overlayLayer_.getSource().addFeatures(t),void this.overlayLayer_.changed();i.frameState.animate=!0}.bind(this));var a=new ol.Feature(new ol.geom.Point(this.getMap().getView().getCenter()));a.setStyle(new ol.style.Style({image:new ol.style.Circle({})})),this.overlayLayer_.getSource().addFeature(a)}}getClusterExtent(e){if(!e.get("features"))return null;var t=ol.extent.createEmpty();return e.get("features").forEach(function(e){t=ol.extent.extend(t,e.getGeometry().getExtent())}),t[0]===t[2]&&t[1]===t[3]?null:t}},ol.interaction.SnapGuides=class extends ol.interaction.Interaction{constructor(e){function t(e,t){var i=e[1][0]-e[0][0],o=e[1][1]-e[0][1],s=t[1][0]-t[0][0],r=t[1][1]-t[0][1],a=i*r-o*s;if(0!=a){var n=(i*e[0][1]-i*t[0][1]-o*e[0][0]+o*t[0][0])/a;return[t[0][0]+n*s,t[0][1]+n*r]}return!1}function i(e,t){var i=e[0]-t[0],o=e[1]-t[1];return Math.sqrt(i*i+o*o)}e=e||{},super({handleEvent:function(e){if(this.getActive()){for(var o,s=this.overlaySource_.getFeatures(),r=null,a=null,n=e.frameState.viewState.resolution,l=0;o=s[l];l++){var h=o.getGeometry().getClosestPoint(e.coordinate);if(i(h,e.coordinate)/nthis.projExtent_[2]&&(o[2]=this.projExtent_[2]),o[3]>this.projExtent_[3]&&(o[3]=this.projExtent_[3]);var r=e[0][0]-e[1][0],a=e[0][1]-e[1][1],n=1/Math.sqrt(r*r+a*a),l=function(i){for(var l,h=[],c=s*i*2,u=0;(i>0?uc)&&(l=t?[e[0][0]+a*n*u,e[0][1]-r*n*u]:[e[0][0]+r*n*u,e[0][1]+a*n*u],ol.extent.containsCoordinate(o,l));u+=s*i/100)h.push(l);return new ol.Feature(new ol.geom.LineString([h[0],h[h.length-1]]))},h=l(1),c=l(-1);return this.overlaySource_.addFeature(h),this.overlaySource_.addFeature(c),[h,c]}}addOrthoGuide(e){return this.addGuide(e,!0)}setDrawInteraction(e){var t=this,i=0,o=[];function s(e){var s=e.target.getCoordinates();switch(e.target.getType()){case"Point":return;case"Polygon":s=s[0].slice(0,-1)}var r=s.length;if(2===r&&t.enableInitialGuides_){var a=s[0][0],n=s[0][1];s=[[a,n],[a,n-1]]}if(r!=i&&(t.enableInitialGuides_?r>=2:r>2)){t.clearGuides(o);try{var l=s[r-2],h=s[r-2-1];r>2&&(l[0]!==h[0]||l[1]!==h[1])&&(o=t.addOrthoGuide([s[r-2],s[r-2-1]])),o=(o=o.concat(t.addGuide([s[0],s[1]]))).concat(t.addOrthoGuide([s[0],s[1]])),i=r}catch(e){}}}e.on("drawstart",function(e){e.feature.getGeometry().on("change",s)}),e.on(["drawend","change:active"],function(e){t.clearGuides(o),e.feature&&e.feature.getGeometry().un("change",s),i=0,o=[]})}setModifyInteraction(e){function t(e,t){return(e%t+t)%t}var i=this,o=[];function s(e){var s=e.coordinate;if(!s){var r=e.target.vertexFeature_;if(!r)return;s=r.getGeometry().getCoordinates()}var a=e.target.getModifiedFeatures()[0].getGeometry(),n=a.getCoordinates();switch(a.getType()){case"Point":return;case"Polygon":n=n[0].slice(0,-1)}var l=n.findIndex(function(e){return e[0]===s[0]&&e[1]===s[1]}),h=n.length;i.clearGuides(o),o=(o=(o=(o=i.addOrthoGuide([n[t(l-1,h)],n[t(l-2,h)]])).concat(i.addGuide([n[t(l-1,h)],n[t(l-2,h)]]))).concat(i.addGuide([n[t(l+1,h)],n[t(l+2,h)]]))).concat(i.addOrthoGuide([n[t(l+1,h)],n[t(l+2,h)]]))}e.on("modifystart",function(e){setTimeout(s,0,e)}),e.on("modifyend",function(){i.clearGuides(o),o=[]})}},ol.interaction.SnapLayerPixel=class extends ol.interaction.Interaction{constructor(e){var t=(e=e||{}).radius||8,i=2*t;super({handleEvent:function(e){if(this._layer.getVisible()&&this._layer.getOpacity()&&ol.events.condition.altKeyOnly(e)&&this.getMap()){var o,s,r,a,n=e.pixel[0]-t,l=e.pixel[1]-t,h=this._ctx.getImageData(n,l,i,i).data,c=-1,u=[];for(o=0;o10?d:0)}for(o=1;oc&&(c=g,r=o,a=s)}e.pixel=[n+r,l+a],e.coordinate=this.getMap().getCoordinateFromPixel(e.pixel)}return!0}}),this._layer=e.layer,this._layer.on(["postcompose","postrender"],function(e){this._ctx=e.context}.bind(this))}},ol.interaction.Split=class extends ol.interaction.Interaction{constructor(e){e||(e={}),super({handleEvent:function(e){switch(e.type){case"singleclick":return this.handleDownEvent(e);case"pointermove":return this.handleMoveEvent(e);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 ol.source.Vector({features:e.features}))),this.filterSplit_=e.filter||function(){return!0};var t=[255,255,255,1],i=[0,153,255,1],o=new ol.style.Fill({color:"rgba(255,255,255,0.4)"}),s=new ol.style.Stroke({color:"#3399CC",width:1.25}),r=[new ol.style.Style({image:new ol.style.Circle({fill:o,stroke:s,radius:5}),fill:o,stroke:s})],a=[new ol.style.Style({stroke:new ol.style.Stroke({color:t,width:5})}),new ol.style.Style({image:new ol.style.Circle({radius:6,fill:new ol.style.Fill({color:i}),stroke:new ol.style.Stroke({color:t,width:1.5})}),stroke:new ol.style.Stroke({color:i,width:3})})];e.sketchStyle&&(r=e.sketchStyle instanceof Array?e.sketchStyle:[e.sketchStyle]),e.featureStyle&&(a=e.featureStyle instanceof Array?e.featureStyle:[e.featureStyle]),this.overlayLayer_=new ol.layer.Vector({source:new ol.source.Vector({useSpatialIndex:!1}),name:"Split overlay",displayInLayerSwitcher:!1,style:function(e){return e._sketch_?r:a}})}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(i){i.getVisible()&&(i.getSource&&i.getSource()instanceof ol.source.Vector?e.unshift(i.getSource()):i.getLayers&&t(i.getLayers()))})};return t(this.getMap().getLayers()),e}return this.sources_||[]}setSources(e){this.sources_=!!e&&(e instanceof Array?e||!1:[e])}getClosestFeature(e){var t,i,o,s,r=this.snapDistance_+1;if(this.getSources().forEach(function(a){var n=a.getClosestFeatureToCoordinate(e.coordinate);if(n&&n.getGeometry().splitAt){var l=n.getGeometry().getClosestPoint(e.coordinate),h=new ol.geom.LineString([e.coordinate,l]),c=h.getLength()/e.frameState.viewState.resolution;cthis.snapDistance_)return!1;var a=this.getNearestCoord(o,i.getGeometry().getCoordinates()),n=this.getMap().getPixelFromCoordinate(a);return ol.coordinate.dist2d(e.pixel,n)1){var s=[];for(i=0;i1)return!1;var h=((e[0][1]-t[1][1])*o-(e[0][0]-t[1][0])*r)/n;if(Math.abs(h)1)return!1;var c=e[0][0]*e[1][1]-e[0][1]*e[1][0],u=t[0][0]*t[1][1]-t[0][1]*t[1][0];return[(c*s-u*o)/n,(c*a-u*r)/n]}splitSource(e,t){this.getActive()&&(this.splitting||(this.source_.dispatchEvent({type:"beforesplit",feaure:e,source:this.source_}),this.dispatchEvent({type:"beforesplit",feaure:e,source:this.source_}),t?this._splitSource(e):setTimeout(function(){this._splitSource(e)}.bind(this))))}_splitSource(e){var t,i,o;this.splitting=!0,this.added_=[],this.removed_=[];var s=e.getGeometry().getCoordinates();switch(e.getGeometry().getType()){case"Point":s=[s];break;case"LineString":break;default:s=[]}var r,a=[];function n(t){if(t!==e&&t.getGeometry().splitAt)for(var i=t.getGeometry().getCoordinates(),o=0;o1))return c=t,!0}return!1}if(1===s.length){r=[s[0],s[0]];var l=ol.extent.buffer(ol.extent.boundingExtent(r),this.tolerance_);this.source_.forEachFeatureIntersectingExtent(l,function(e){if(e.getGeometry().splitAt){var t=e.getGeometry().splitAt(s[0],this.tolerance_);if(t.length>1)for(this.source_.removeFeature(e),i=0;i1){for(i=0;i30&&!this.isout_&&(this.lastSparkle=e.frameState.time,this.sparkles.push({p:[this.sparkle[0]+15*Math.random()-7.5,this.sparkle[1]+15*Math.random()],o:1})),t.save(),t.scale(e.frameState.pixelRatio,e.frameState.pixelRatio),t.fillStyle=this.get("color");for(var o,s=this.sparkles.length-1;o=this.sparkles[s];s--){if(o.o<.2){this.sparkles.splice(0,s+1);break}t.globalAlpha=o.o,t.beginPath(),t.arc(o.p[0],o.p[1],2.2,0,2*Math.PI,!1),t.fill(),o.o*=.98,o.p[0]+=Math.random()-.5,o.p[1]+=i*(1+Math.random())/30}t.restore(),this.sparkles.length&&this.getMap().render()}},ol.interaction.TouchCompass=class extends ol.interaction.Pointer{constructor(e){e=e||{};var t={handleDownEvent:function(e){var t=this.getCenter_(),i=e.pixel[0]-t[0],o=e.pixel[1]-t[1];return this.start=e,Math.sqrt(i*i+o*o)this.get("maxButtons")&&this.set("maxButtons",e.buttons.length);var o=this.overlay.element,s=e.buttons.length>4?0:1;e.buttons.forEach(function(e,t){t<5&&ol.ext.element.create("DIV",{className:((e.className||"")+" ol-button ol-button-"+(t+s)).trim(),html:ol.ext.element.create("DIV",{html:e.html}),click:e.click,on:e.on,parent:o})})}var r=!1,a=!1;this.on("dragstart",function(e){return this._pixel=this.getMap().getPixelFromCoordinate(this.overlay.getPosition()),a=e,!e.overlay}),this.on("dragend",function(e){return this._pixel=this.getMap().getPixelFromCoordinate(this.overlay.getPosition()),!e.overlay||(r?(this.dispatchEvent({type:"dragend",dragging:r,originalEvent:e.originalEvent,frameState:e.frameState,pixel:this._pixel,coordinate:this.overlay.getPosition()}),r=!1):e.originalEvent.target===this.overlay.element&&this.dispatchEvent({type:"click",dragging:r,originalEvent:e.originalEvent,frameState:e.frameState,pixel:this._pixel,coordinate:this.overlay.getPosition()}),!1)}.bind(this)),this.on("dragging",function(e){return this._pixel=this.getMap().getPixelFromCoordinate(this.overlay.getPosition()),!e.overlay||(r=!0,a&&(this.dispatchEvent({type:"dragstart",dragging:r,originalEvent:a.originalEvent,frameState:e.frameState,pixel:this._pixel,coordinate:a.coordinate}),a=!1),this.dispatchEvent({type:"dragging",dragging:r,originalEvent:e.originalEvent,frameState:e.frameState,pixel:this._pixel,coordinate:this.overlay.getPosition()}),!1)}.bind(this))}setMap(e){for(var t in this.getMap()&&(this.getMap().removeInteraction(this.ctouch),this.getActive()&&this.getMap().removeOverlay(this.overlay)),this._listeners)ol.Observable.unByKey(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)))}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"number"==typeof e?this.getOverlayElement().getElementsByClassName("ol-button")[e]:this.getOverlayElement().getElementsByClassName(e)[0]}removeButton(e){if(void 0===e)for(var t=this.getOverlayElement().getElementsByClassName("ol-button"),i=t.length-1;i>=0;i--)this.getOverlayElement().removeChild(t[i]);else{var o=this.getButtonElement(e);o&&this.getOverlayElement().removeChild(o)}}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+")...");else{var o=ol.ext.element.create("DIV",{className:((e.className||"")+" ol-button").trim(),html:ol.ext.element.create("DIV",{html:e.html}),click:e.click,on:e.on});e.before&&0!==t.length?this.getOverlayElement().insertBefore(o,t[0]):this.getOverlayElement().appendChild(o);for(var s=t.length>=i?0:1,r=0;r=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 o=this.getMap().getView().getRotation();this.coordinate_=e.coordinate,this.pixel_=e.pixel,this.geoms_=[],this.rotatedGeoms_=[];for(var s,r=ol.extent.createEmpty(),a=ol.extent.createEmpty(),n=0;s=this.selection_.item(n);n++)if(this.geoms_.push(s.getGeometry().clone()),r=ol.extent.extend(r,s.getGeometry().getExtent()),this.get("enableRotatedTransform")&&0!==o){var l=this.getGeometryRotateToZero_(s,!0);this.rotatedGeoms_.push(l),a=ol.extent.extend(a,l.getExtent())}if(this.extent_=ol.geom.Polygon.fromExtent(r).getCoordinates()[0],this.get("enableRotatedTransform")&&0!==o&&(this.rotatedExtent_=ol.geom.Polygon.fromExtent(a).getCoordinates()[0]),"rotate"===this.mode_){this.center_=this.getCenter()||ol.extent.getCenter(r);var h=e.map.getTargetElement();h.style.cursor=this.Cursors.rotate0,this.previousCursor_=h.style.cursor}else this.center_=ol.extent.getCenter(r);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}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_=1===this.selection_.getLength()&&"Point"==this.selection_.item(0).getGeometry().getType(),this.iscircle_=1===this.selection_.getLength()&&"Circle"==this.selection_.item(0).getGeometry().getType(),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,i,o,s,r=this.getMap().getView().getRotation(),a=[this.coordinate_[0],this.coordinate_[1]],n=[e.coordinate[0],e.coordinate[1]];switch(this.isUpdating_=!0,this.mode_){case"rotate":var l=Math.atan2(this.center_[1]-n[1],this.center_[0]-n[0]);if(!this.ispt)for(t=0;o=this.selection_.item(t);t++)(s=this.geoms_[t].clone()).rotate(l-this.angle_,this.center_),"Circle"==s.getType()&&s.setCenterAndRadius(s.getCenter(),s.getRadius()),o.setGeometry(s);this.drawSketch_(!0),this.dispatchEvent({type:"rotating",feature:this.selection_.item(0),features:this.selection_,angle:l-this.angle_,pixel:e.pixel,coordinate:e.coordinate});break;case"translate":var h=n[0]-a[0],c=n[1]-a[1];for(t=0;o=this.selection_.item(t);t++)o.getGeometry().translate(h,c);this.handles_.forEach(function(e){e.getGeometry().translate(h,c)}),this.coordinate_=e.coordinate,this.dispatchEvent({type:"translating",feature:this.selection_.item(0),features:this.selection_,delta:[h,c],pixel:e.pixel,coordinate:e.coordinate});break;case"scale":var u=this.center_;if(this.get("modifyCenter")(e)){var d=this.extent_;this.get("enableRotatedTransform")&&0!==r&&(d=this.rotatedExtent_),u=d[(Number(this.opt_)+2)%4]}var g=1==this.geoms_.length&&this._isRectangle(this.geoms_[0]),p=this.constraint_,m=this.opt_,f=this.coordinate_,v=e.coordinate;if(this.get("enableRotatedTransform")&&0!==r){var y=new ol.geom.Point(this.coordinate_);y.rotate(-1*r,u),f=y.getCoordinates();var _=new ol.geom.Point(e.coordinate);_.rotate(-1*r,u),v=_.getCoordinates()}var x=(v[0]-u[0])/(f[0]-u[0]),b=(v[1]-u[1])/(f[1]-u[1]),w=[v[0]-f[0],v[1]-f[1]];if(this.get("enableRotatedTransform")&&0!==r){var S=new ol.geom.Point(u);S.rotate(-1*r,this.getMap().getView().getCenter()),u=S.getCoordinates()}for(this.get("noFlip")&&(x<0&&(x=-x),b<0&&(b=-b)),this.constraint_?"h"==this.constraint_?x=1:b=1:this.get("keepAspectRatio")(e)&&(x=b=Math.min(x,b)),t=0;o=this.selection_.item(t);t++)(s=0!==r&&this.get("enableRotatedTransform")?this.rotatedGeoms_[t].clone():this.geoms_[t].clone()).applyTransform(function(e,t,o){if(o<2)return t;if(g){var r=[[6],[0,8],[2],[4]],a=[e[0],e[1]],n=[e[2],e[3]],l=[e[4],e[5]],h=[e[6],e[7]],c=[e[8],e[9]];if(p){var d=m%2==0?this._countVector(a,n):this._countVector(h,a),f=this._projectVectorOnVector(w,d),y=[...r[m],...r[m+1this.get("maxLength");)this.shift();if(this.get("maxSize"))for(;this.length()>1&&this.size()>this.get("maxSize");)this.shift()}getStack(e){return"redo"===e?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,"blockstart"===e.type)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(e){ol.Observable.unByKey(e)}),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(e){ol.Observable.unByKey(e)}),this._sourceListener=[];var t=this;e&&(function e(i,o){return o||(o=[]),i.forEach(function(i){i instanceof ol.layer.Vector?(!t._layers||t._layers.indexOf(i)>=0)&&o.push(i):i.getLayers&&e(i.getLayers(),o)}),o}(e.getLayers()).forEach(function(e){var t=e.getSource();this._sourceListener.push(t.on(["addfeature","removefeature"],this._onAddRemove.bind(this))),this._sourceListener.push(t.on("clearstart",function(){this.blockStart("clear")}.bind(this))),this._sourceListener.push(t.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(e){ol.Observable.unByKey(e)}),this._interactionListener=[],e&&(e.getInteractions().forEach(function(e){this._interactionListener.push(e.on(["setattributestart","modifystart","rotatestart","translatestart","scalestart","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 o=e.newProperties,s=e.oldProperties;for(var r in s)void 0===s?e.feature.unset(r):e.feature.set(r,s[r]);e.oldProperties=o,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))}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()}},ol.interaction.UndoRedo.prototype._onInteraction.setattributestart=function(e){this.blockStart(e.target.get("name")||"setattribute");var t=Object.assign({},e.properties);e.features.forEach(function(e){var i={};for(var o in t)i[o]=e.get(o);this._undoStack.push({type:"changeattribute",feature:e,newProperties:t,oldProperties:i})}.bind(this)),this.blockEnd()},ol.interaction.UndoRedo.prototype._onInteraction.rotatestart=ol.interaction.UndoRedo.prototype._onInteraction.translatestart=ol.interaction.UndoRedo.prototype._onInteraction.scalestart=ol.interaction.UndoRedo.prototype._onInteraction.modifystart=function(e){this.blockStart(e.type.replace(/start$/,"")),e.features.forEach(function(e){this._undoStack.push({type:"changegeometry",feature:e,oldGeom:e.getGeometry().clone()})}.bind(this)),this.blockEnd()},ol.interaction.UndoRedo.prototype._onInteraction.beforesplit=function(){var e=this._undoStack.getLength();e>2&&"blockend"===this._undoStack.item(e-1).type&&"changegeometry"===this._undoStack.item(e-2).type?this._undoStack.pop():this.blockStart("split")},ol.interaction.UndoRedo.prototype._onInteraction.deletestart=function(){this.blockStart("delete")},ol.interaction.UndoRedo.prototype._onInteraction.aftersplit=ol.interaction.UndoRedo.prototype._onInteraction.deleteend=ol.interaction.UndoRedo.prototype.blockEnd,ol.source.BinBase=class extends ol.source.Vector{constructor(e){super(e=e||{}),this._bindModify=this._onModifyFeature.bind(this),this._watch=!0,this._origin=e.source,this._listen=!1!==e.listenChange,this._geomFn=e.geometryFunction||ol.coordinate.getFeatureCenter||function(e){return e.getGeometry().getFirstCoordinate()},this._origin.on("addfeature",this._onAddFeature.bind(this)),this._origin.on("removefeature",this._onRemoveFeature.bind(this)),this._origin.on("clearstart",this._onClearFeature.bind(this)),this._origin.on("clearend",this._onClearFeature.bind(this)),"function"==typeof e.flatAttributes&&(this._flatAttributes=e.flatAttributes)}_onAddFeature(e,t,i){var o=e.feature||e.target;(t=t||this.getBinAt(this._geomFn(o),!0))&&t.get("features").push(o),this._listen&&!1!==i&&o.on("change",this._bindModify)}_onRemoveFeature(e,t,i){if(this._watch){var o=e.feature||e.target;if(t=t||this.getBinAt(this._geomFn(o))){for(var s,r=t.get("features"),a=0;s=r[a];a++)if(s===o){r.splice(a,1);break}r.length||this.removeFeature(t)}this._listen&&!1!==i&&o.un("change",this._bindModify)}}_onClearFeature(e){"clearstart"===e.type?(this._listen&&this._origin.getFeatures().forEach(function(e){e.un("change",this._bindModify)}.bind(this)),this.clear(),this._watch=!1):this._watch=!0}getBin(e){for(var t,i=this.getFeatures(),o=0;t=i[o];o++)for(var s,r=t.get("features"),a=0;s=r[a];a++)if(s===e)return t;return null}getGridGeomAt(e){return new ol.geom.Polygon([e])}getBinAt(e,t){var i={},o=this.getGridGeomAt(e,i);if(!o)return null;var s=o.getInteriorPoint?o.getInteriorPoint().getCoordinates():o.getInteriorPoints().getCoordinates()[0],r=this.getFeaturesAtCoordinate(s)[0];return!r&&t&&(i.geometry=o,i.features=[],i.center=s,r=new ol.Feature(i),this.addFeature(r)),r||null}_onModifyFeature(e){var t=this.getBin(e.target),i=this.getBinAt(this._geomFn(e.target),"create");t!==i&&(t&&this._onRemoveFeature(e,t,!1),i&&this._onAddFeature(e,i,!1)),this.changed()}reset(){this.clear();for(var e,t=this._origin.getFeatures(),i=0;e=t[i];i++)this._onAddFeature({feature:e});this.changed()}getGridFeatures(){var e=[];return this.getFeatures().forEach(function(t){var i=new ol.Feature(t.getGeometry().clone());for(var o in t.getProperties())"features"!==o&&"geometry"!==o&&i.set(o,t.get(o));i.set("nb",t.get("features").length),this._flatAttributes(i,t.get("features")),e.push(i)}.bind(this)),e}_flatAttributes(){}setFlatAttributesFn(e){"function"==typeof e&&(this._flatAttributes=e)}getSource(){return this._origin}},ol.source.DBPedia=class extends ol.source.Vector{constructor(e){var t=e||{};t.attributions||(t.attributions=['© DBpedia CC-by-SA']),t.strategy||(t.strategy=ol.loadingstrategy.bbox),super(t),this.setLoader(this._loaderFn),this._url=t.url||"http://fr.dbpedia.org/sparql",this._maxResolution=t.maxResolution||100,this._lang=t.lang||"fr",this._limit=t.limit||1e3}readFeature(e,t,i){for(var o in t)"uri"===t[o].type&&(t[o].value=encodeURI(t[o].value)),e.set(o,t[o].value);return!i||i.get("subject")!=t.subject.value||(i.set("type",i.get("type")+"\n"+t.type.value),!1)}querySubject(){return"?subject rdfs:label ?label. OPTIONAL {?subject dbo:thumbnail ?thumbnail}.OPTIONAL {?subject dbo:abstract ?abstract} . OPTIONAL {?subject rdf:type ?type}"}queryFilter(){return"lang(?label) = '"+this._lang+"' && lang(?abstract) = '"+this._lang+"'"}_loaderFn(e,t,i){if(!(t>this._maxResolution)){var o=this,s=ol.proj.transformExtent(e,i,"EPSG:4326"),r="PREFIX geo: SELECT DISTINCT * WHERE { ?subject geo:lat ?lat . ?subject geo:long ?long . "+this.querySubject()+" . FILTER("+this.queryFilter()+") . FILTER(xsd:float(?lat) <= "+s[3]+" && "+s[1]+" <= xsd:float(?lat) && xsd:float(?long) <= "+s[2]+" && "+s[0]+" <= xsd:float(?long) ) . } LIMIT "+this._limit;ol.ext.Ajax.get({url:this._url,data:{query:r,format:"json"},success:function(e){var t,s,r,a=e.results.bindings,n=[],l=null;for(var h in a)t=a[h],s=[Number(a[h].long.value),Number(a[h].lat.value)],r=new ol.Feature(new ol.geom.Point(ol.proj.transform(s,"EPSG:4326",i))),o.readFeature(r,t,l)&&(n.push(r),l=r);o.addFeatures(n)}})}}},ol.style.clearDBPediaStyleCache,ol.style.dbPediaStyleFunction,function(){var e={};ol.style.clearDBPediaStyleCache=function(){e={}},ol.style.dbPediaStyleFunction=function(t){var i;switch(t||(t={}),typeof t.glyph){case"function":i=t.glyph;break;case"string":i=function(){return t.glyph};break;default:i=function(e){var t=e.get("type");if(t){if(t.match("/Museum"))return"fa-camera";if(t.match("/Monument"))return"fa-building";if(t.match("/Sculpture"))return"fa-android";if(t.match("/Religious"))return"fa-institution";if(t.match("/Castle"))return"fa-key";if(t.match("Water"))return"fa-tint";if(t.match("Island"))return"fa-leaf";if(t.match("/Event"))return"fa-heart";if(t.match("/Artwork"))return"fa-asterisk";if(t.match("/Stadium"))return"fa-futbol-o";if(t.match("/Place"))return"fa-street-view"}return"fa-star"}}var o=t.radius||8,s=t.fill||new ol.style.Fill({color:"navy"}),r=t.stroke||new ol.style.Stroke({color:"#fff",width:2}),a=t.prefix?t.prefix+"_":"";return function(t){var n=i(t),l=a+n,h=e[l];return h||(e[l]=h=new ol.style.Style({image:new ol.style.FontSymbol({glyph:n,radius:o,fill:s,stroke:r})})),[h]}}}(),ol.source.DFCI=class extends ol.source.Vector{constructor(e){(e=e||{}).loader=function(e,t,i){return this._calcGrid(e,t,i)},e.strategy=function(e,t){return this.resolution&&this.resolution!=t&&(this.clear(),this.refresh()),[e]},super(e),this._bbox=[[0,16e5],[11e5,26e5]],this.set("resolutions",e.resolutions||[1e3,100,20]),proj4.defs["EPSG:27572"]||proj4.defs("EPSG:27572","+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs"),ol.proj.proj4.register(proj4)}_calcGrid(e,t,i){var o,s,r=this.get("resolutions");t>(r[0]||1e3)?this.resolution!=t&&(this._features0||(s=[this._bbox[0][0],this._bbox[0][1],this._bbox[1][0],this._bbox[1][1]],this._features0=this._getFeatures(0,s,i)),this.addFeatures(this._features0)):t>(r[1]||100)?(this.clear(),s=ol.proj.transformExtent(e,i,"EPSG:27572"),o=this._getFeatures(1,s,i),this.addFeatures(o)):t>(r[2]||0)?(this.clear(),s=ol.proj.transformExtent(e,i,"EPSG:27572"),o=this._getFeatures(2,s,i),this.addFeatures(o)):(this.clear(),s=ol.proj.transformExtent(e,i,"EPSG:27572"),o=this._getFeatures(3,s,i),this.addFeatures(o)),this.resolution=t}_midPt(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}_trFeature(e,t,i,o){var s=new ol.geom.Polygon([e]),r=new ol.Feature(s.transform("EPSG:27572",o));return r.set("id",t),r.set("level",i),r}_getFeatures(e,t,i){var o,s=[],r=1e5;e>0&&(r/=5),e>1&&(r/=10);for(var a=[Math.max(this._bbox[0][0],Math.floor(t[0]/r)*r),Math.max(this._bbox[0][1],Math.floor(t[1]/r)*r)],n=[Math.min(this._bbox[1][0]+99999,Math.floor(t[2]/r)*r),Math.min(this._bbox[1][1]+99999,Math.floor(t[3]/r)*r)],l=a[0];l<=n[0];l+=r)for(var h=a[1];h<=n[1];h+=r){var c,u=[[l,h],[l+r,h],[l+r,h+r],[l,h+r],[l,h]];if(e>2){var d=this._midPt(u[0],u[2]),g=[];for(o=0;o=-180;m-=c)a.push([m,p]);a.push(a[0])}if("daynight"===t){var f=[];a.forEach(function(e){f.push(e.slice())}),f[0][1]=-f[0][1],f[f.length-1][1]=-f[0][1],f[f.length-1][1]=-f[0][1],a=[a,f]}return a}},ol.source.Delaunay=class extends ol.source.Vector{constructor(e){var t=(e=e||{}).source;delete e.source,super(e),this._nodes=t,this.hull=[],this._nodes.on("addfeature",this._onAddNode.bind(this)),this._nodes.on("removefeature",this._onRemoveNode.bind(this)),this.set("epsilon",e.epsilon||1e-4)}clear(e){super.clear(e),this.getNodeSource().clear(e)}_addTriangle(e){e.push(e[0]);var t=new ol.Feature(new ol.geom.Polygon([e]));return this.addFeature(t),this.flip.push(t),t}getNodes(){return this._nodes.getFeatures()}getNodeSource(){return this._nodes}_onRemoveNode(e){var t=e.feature.getGeometry().getCoordinates();if(t&&!this.getNodesAt(t).length){var i,o=this.getTrianglesAt(t);this.flip=[];for(var s=[];o.length;){var r=o.pop();this.removeFeature(r),r=r.getGeometry().getCoordinates()[0];var a=[];for(i=0;i<3;i++)l=r[i],ol.coordinate.equal(l,t)||a.push(l);s.push(a)}for(a=s.pop(),i=0;;){var n=s[i];if(f(n[0],n[1],0)||f(n[1],n[0],0)||f(n[0],n[1],a.length-1)||f(n[1],n[0],a.length-1)?(s.splice(i,1),i=0):i++,!s.length)break;if(i>=s.length)throw"[DELAUNAY:removePoint] No edge found"}var l,h=ol.coordinate.equal(a[0],a[a.length-1]);for(h&&a.pop();l=this.hull[i];i++)if(ol.coordinate.equal(t,l)){this.hull.splice(i,1);break}this.hull=ol.coordinate.convexHull(this.hull.concat(a));var c,u=function(e){for(var t,i=0,o=0;o=0?1:-1},d=a.slice();for(h?c=u(a):(d.push(t),c=u(d)),i=0;i<=a.length+1&&!(a.length<3);i++){var g=[a[i%a.length],a[(i+1)%a.length],a[(i+2)%a.length]];if(u(g)===c){for(var p=!0,m=i+3;m1)this._nodes.removeFeature(o);else if(s.length<=3){if(3===s.length){var a=[];for(t=0;t<3;t++)a.push(s[t].getGeometry().getCoordinates());this._addTriangle(a),this.hull=ol.coordinate.convexHull(a)}}else{var n=this.getFeaturesAtCoordinate(r)[0];if(n){this.removeFeature(n),n.set("del",!0);var l=n.getGeometry().getCoordinates()[0];for(t=0;t<3;t++)this._addTriangle([r,l[t],l[(t+1)%3]])}else{var h=this.hull.slice();for(h.push(r),h=ol.coordinate.convexHull(h),t=0;(i=h[t])&&!ol.coordinate.equal(i,r);t++);var c=h[t=0!==t?t-1:h.length-1],u=h[(t+2)%h.length];for(t=0;(i=this.hull[t])&&!ol.coordinate.equal(i,c);t++);for(;;){if(t>1e3){console.error("[DELAUNAY:addPoint] Too many iterations");break}if(t++,i=this.hull[t%this.hull.length],this._addTriangle([r,i,c]),c=i,i[0]===u[0]&&i[1]===u[1])break}this.hull=h}this.flipTriangles()}}else this._nodes.removeFeature(o)}flipTriangles(){for(var e,t=1e3;this.flip.length;){if(t--<0){console.error("[DELAUNAY:flipTriangles] Too many iterations");break}var i=this.flip.pop();if(!i.get("del"))for(var o=i.getGeometry().getCoordinates()[0],s=0;s<3;s++){var r=[(o[(s+1)%3][0]+o[s][0])/2,(o[(s+1)%3][1]+o[s][1])/2],a=this.getTrianglesAt(r),n=null;if(a.length>1){var l=a[0].getGeometry().getCoordinates()[0],h=a[1].getGeometry().getCoordinates()[0];for(e=0;eGéoportail © IGN-France',ol.source.Geoportail.getServiceURL=function(e,t){return e?e.replace(/^(https?:\/\/[^/]*)(.*)$/,"$1/"+t+"$2"):(window.geoportailConfig?window.geoportailConfig.url:"https://wxs.ign.fr/")+t+"/geoportail/wmts"},ol.source.GridBin=class extends ol.source.BinBase{constructor(e){super(e=e||{}),this.set("gridProjection",e.gridProjection||"EPSG:4326"),this.setSize("size",e.size||1),this.reset()}setGridProjection(e){this.set("gridProjection",e),this.reset()}setSize(e){this.set("size",e),this.reset()}getGridGeomAt(e){e=ol.proj.transform(e,this.getProjection()||"EPSG:3857",this.get("gridProjection"));var t=this.get("size"),i=t*Math.floor(e[0]/t),o=t*Math.floor(e[1]/t);return new ol.geom.Polygon([[[i,o],[i+t,o],[i+t,o+t],[i,o+t],[i,o]]]).transform(this.get("gridProjection"),this.getProjection()||"EPSG:3857")}},ol.source.HexBin=class extends ol.source.BinBase{constructor(e){super(e=e||{}),this._hexgrid=new ol.HexGrid(e),this.reset()}getGridGeomAt(e){var t=this._hexgrid.coord2hex(e);return new ol.geom.Polygon([this._hexgrid.getHexagon(t)])}setSize(e,t){this._hexgrid.setSize(e),t||this.reset()}getSize(){return this._hexgrid.getSize()}setLayout(e,t){this._hexgrid.setLayout(e),t||this.reset()}getLayout(){return this._hexgrid.getLayout()}setOrigin(e,t){this._hexgrid.setOrigin(e),t||this.reset()}getOrigin(){return this._hexgrid.getOrigin()}getHexFeatures(){return super.getGridFeatures()}},ol.source.IDW=class extends ol.source.ImageCanvas{constructor(e){if((e=e||{}).canvasFunction=function(e,t,i,o){return this.calculateImage(e,t,i,o)},super(e),this._source=e.source,this._canvas=document.createElement("CANVAS"),this._source.on(["addfeature","removefeature","clear","removefeature"],function(){this.changed()}.bind(this)),"function"==typeof e.getColor&&(this.getColor=e.getColor),e.useWorker){var t={hue2rgb:this.hue2rgb,getColor:this.getColor};for(var i in e.useWorker)t[i]=e.useWorker[i];this.worker=new ol.ext.Worker(this.computeImage,{onMessage:this.onImageData.bind(this),lib:t})}this._position={extent:[],resolution:0},this.set("scale",e.scale||4),this._weight="function"==typeof e.weight?e.weight:function(t){return t.get(e.weight||"weight")}}getSource(){return this._source}getValue(e){if(!this._canvas)return null;var t=this.transform(e);return this._canvas.getContext("2d").getImageData(Math.round(t[0]),Math.round(t[1]),1,1).data}hue2rgb(e){return(e=(e+6)%6)<1?Math.round(255*e):e<3?255:e<4?Math.round(255*(4-e)):0}getColor(e){var t=4-.04*e;return[this.hue2rgb(t+2),this.hue2rgb(t),this.hue2rgb(t-2),255]}computeImage(e){var t,i,o=e.data.pts,s=e.data.width,r=e.data.height,a=new Uint8ClampedArray(s*r*4);for(i=0;iMapillary"]),t.strategy||(t.strategy=ol.loadingstrategy.bbox),super(t),this._maxResolution=t.maxResolution||100,this._limit=t.limit||100}readFeature(){return!0}_loaderFn(e,t,i){if(!(t>this._maxResolution)){var o=ol.proj.transformExtent(e,i,"EPSG:4326"),s=Date.now()-15552e6,r="https://a.mapillary.com/v2/search/im?client_id="+this.get("clientId")+"&max_lat="+o[3]+"&max_lon="+o[2]+"&min_lat="+o[1]+"&min_lon="+o[0]+"&limit="+(this._limit-1)+"&start_time="+s;ol.ext.Ajax.get({url:r,dataType:"jsonp",success:function(e){console.log(e)}})}}},ol.source.OilPainting=class extends ol.source.Raster{constructor(e){e.operation=ol.source.OilPainting._operation,e.operationType="image",super(e),this.set("radius",e.radius||4),this.set("intensity",e.intensity||25),this.on("beforeoperations",function(e){var t=Math.round((e.extent[2]-e.extent[0])/e.resolution),i=Math.round((e.extent[3]-e.extent[1])/e.resolution);e.data.image=new ImageData(t,i),e.data.radius=Number(this.get("radius"))||1,e.data.intensity=Number(this.get("intensity"))}.bind(this))}set(e,t){if(t)switch(e){case"intensity":case"radius":(t=Number(t))<1&&(t=1),this.changed()}return super.set(e,t)}},ol.source.OilPainting._operation=function(e,t){for(var i=e[0].width,o=e[0].height,s=e[0].data,r=[],a=t.image,n=a.data,l=[],h=[],c=0;c0&&c+y0&&u+_this._maxResolution)){var o=this,s=ol.proj.transformExtent(e,i,"EPSG:4326"),r="[bbox:"+(s=s[1]+","+s[0]+","+s[3]+","+s[2])+"][out:xml][timeout:25];";for(var a in r+="(",this._types)if(this._types[a]){r+=a;for(var n,l=0;n=this._filter[l];l++)r+="["+n+"]";r+=";"}r+=");out;>;out skel qt;";var h=new XMLHttpRequest;h.open("POST",this._url,!0),h.onload=function(){for(var e,t=(new ol.format.OSMXML).readFeatures(this.responseText,{featureProjection:i}),s=[],r=0;e=t[r];r++)o.hasFeature(e)||s.push(e);o.addFeatures(s)},h.onerror=function(){console.log(arguments)},h.send("data="+r)}}hasFeature(e){for(var t,i=e.getGeometry().getFirstCoordinate(),o=e.getId(),s=this.getFeaturesInExtent([i[0]-.1,i[1]-.1,i[0]+.1,i[1]+.1]),r=0;t=s[r];r++)if(o===t.getId())return!0;return!1}},ol.source.TileWFS=class extends ol.source.Vector{constructor(e){(e=e||{}).featureLimit||(e.featureLimit=1/0);var t=e.tileZoom||14,i={strategy:ol.loadingstrategy.tile(ol.tilegrid.createXYZ({minZoom:t,maxZoom:t,tileSize:512}))},o=new ol.format.GeoJSON,s=e.url+"?service=WFS&request=GetFeature&version="+(e.version||"1.1.0")+"&typename="+(e.typeName||"")+"&outputFormat=application/json";e.maxFeatures&&(s+="&maxFeatures="+e.maxFeatures+"&count="+e.maxFeatures);var r={loading:0,loaded:0};i.loader=function(t,i,a){r.loading===r.loaded&&(r.loading=r.loaded=0,this.getFeatures().length>e.maxFeatures&&(this.clear(),this.refresh())),r.loading++,this.dispatchEvent({type:"tileloadstart",loading:r.loading,loaded:r.loaded}),this._loadTile(s,t,a,o,r)},super(i),this.set("pagination",e.pagination)}_loadTile(e,t,i,o,s){var r=e+"&srsname="+i.getCode()+"&bbox="+t.join(",")+","+i.getCode();this.get("pagination")&&!/&startIndex/.test(e)&&(r+="&startIndex=0"),ol.ext.Ajax.get({url:r,success:function(r){if(s.loaded++,r.error)this.dispatchEvent({type:"tileloaderror",error:r,loading:s.loading,loaded:s.loaded});else{var a=o.readFeatures(r,{featureProjection:i});a.length>0&&this.addFeatures(a);var n=r.numberReturned||0;/&startIndex/.test(e)&&(n+=parseInt(e.replace(/.*&startIndex=(\d*).*/,"$1")),e=e.replace(/&startIndex=(\d*)/,"")),nthis.get("maxResolution"))){if(this.res_=400*t,this.animate_){var i=e.frameState.time-this.animate_;ithis.animateDuration_&&(this.animate_=!1),!!this.animate_}_getFeatureHeight(e){if(this.animate_){var t=this.height_(e),i=this.toHeight_(e);return t*(1-this.elapsedRatio_)+this.elapsedRatio_*i}return this.height_(e)}hvector_(e,t){var i=[e[0]*this.matrix_[0]+e[1]*this.matrix_[1]+this.matrix_[4],e[0]*this.matrix_[2]+e[1]*this.matrix_[3]+this.matrix_[5]];return{p0:i,p1:[i[0]+t/this.res_*(i[0]-this.center_[0]),i[1]+t/this.res_*(i[1]-this.center_[1])]}}getFeature3D_(e,t){var i=this.get("geometry")(e),o=i.getCoordinates();switch(i.getType()){case"Polygon":o=[o];case"MultiPolygon":for(var s=[],r=0;r=0;r--)e.lineTo(s[r].p1[0],s[r].p1[1]);e.closePath()}e.fill("evenodd"),e.stroke();break;case"Point":var n=(s=t[i]).feature.get("label");if(n){var l=s.geom.p1,h=e.measureText(n),c=Number(e.font.match(/\d+(\.\d+)?/g).join([]));e.fillRect(l[0]-h.width/2-5,l[1]-c-5,h.width+10,c+10),e.strokeRect(l[0]-h.width/2-5,l[1]-c-5,h.width+10,c+10),e.save(),e.fillStyle=ol.color.asString(this._style.getText().getFill().getColor()),e.textAlign="center",e.textBaseline="bottom",e.fillText(n,l[0],l[1]),e.restore()}}}},ol.source.WikiCommons=class extends ol.source.Vector{constructor(e){var t=e||{};t.loader=function(e,t,i){return this._loaderFn(e,t,i)},t.attributions||(t.attributions=['© Wikimedia Commons']),t.strategy||(t.strategy=ol.loadingstrategy.bbox),super(t),this._maxResolution=t.maxResolution||100,this._lang=t.lang||"fr",this._limit=t.limit||100}readFeature(e,t){return e.set("descriptionurl",t.descriptionurl),e.set("url",t.url),e.set("title",t.title.replace(/^file:|.jpg$/gi,"")),e.set("thumbnail",t.url.replace(/^(.+wikipedia\/commons)\/([a-zA-Z0-9]\/[a-zA-Z0-9]{2})\/(.+)$/,"$1/thumb/$2/$3/200px-$3")),e.set("user",t.user),t.extmetadata&&t.extmetadata.LicenseShortName&&e.set("copy",t.extmetadata.LicenseShortName.value),!0}_loaderFn(e,t,i){if(!(t>this._maxResolution)){var o=this,s=ol.proj.transformExtent(e,i,"EPSG:4326"),r="https://commons.wikimedia.org/w/api.php?action=query&format=json&origin=*&prop=coordinates|imageinfo&generator=geosearch&iiprop=timestamp|user|url|extmetadata|metadata|size&iiextmetadatafilter=LicenseShortName&ggsbbox="+s[3]+"|"+s[0]+"|"+s[1]+"|"+s[2]+"&ggslimit="+this._limit+"&iilimit="+(this._limit-1)+"&ggsnamespace=6";ol.ext.Ajax.get({url:r,success:function(e){var t,s,r,a=[];if(e.query&&e.query.pages){for(var n in e.query.pages){if((t=e.query.pages[n]).coordinates&&t.coordinates.length)s=[t.coordinates[0].lon,t.coordinates[0].lat];else{var l=t.imageinfo[0].metadata;if(!l)continue;s=[];for(var h=0,c=0;c1e3)return void this.stopAnimation();a=r.start=(new Date).getTime()}if(r.start){var c=e.vectorContext||ol.render.getVectorContext(e),u=(a-r.start)/t;u>1&&(this.stopAnimation(),u=1),u=this.get("animationMethod")(u);var d=this.getStyle(),g="function"==typeof d?d:d.length?function(){return d}:function(){return[d]};for(e.context.save(),e.context.globalAlpha=this.getOpacity(),i=0;h=r.clusters[i];i++){var p=h.f.getGeometry().getCoordinates(),m=p[0]-h.pt[0],f=p[1]-h.pt[1];r.revers?(p[0]=h.pt[0]+u*m,p[1]=h.pt[1]+u*f):(p[0]=p[0]-u*m,p[1]=p[1]-u*f);var v=g(h.f,s,!0);if(v.length||(v=[v]),1!==h.f.get("features").length||m||f){var y=new ol.geom.Point(p);l=new ol.Feature(y)}else l=h.f.get("features")[0];for(var _,x=0;_=v[x];x++)if(_.getText()&&/\n/.test(_.getText().getText())){var b,w=_.getText().getOffsetX(),S=_.getText().getOffsetY(),M=_.getText().getRotation()||0,C=1.2*Number((_.getText().getFont()||"10px").match(/\d+/)),E=_.getText().getText().split("\n"),L=E.length-1,T=_.clone();E.forEach(function(t,i){switch(1==i&&(T.setImage(),T.setFill(),T.setStroke()),_.getText().getTextBaseline()){case"alphabetic":case"ideographic":case"bottom":b=L;break;case"hanging":case"top":b=0;break;default:b=L/2}T.getText().setOffsetX(w-Math.sin(M)*C*(i-b)),T.getText().setOffsetY(S+Math.cos(M)*C*(i-b)),T.getText().setText(t),c.drawFeature(l,ol.ext.getVectorContextStyle(e,T))})}else c.drawFeature(l,ol.ext.getVectorContextStyle(e,_))}e.context.restore(),e.frameState.animate=!0,e.context.save(),e.context.beginPath(),e.context.rect(0,0,0,0),e.context.clip(),this.clip_=!0}}}postanimate(e){this.clip_&&(e.context.restore(),this.clip_=!1)}},ol.layer.GeoImage=class extends ol.layer.Image{constructor(e){super(e)}getExtent(){return this.getSource().getExtent()}},ol.layer.Geoportail=class extends ol.layer.Tile{constructor(e,t,i){t=t||{},i=i||{},"string"!=typeof e&&(i=t||{},e=(t=e).layer);var o=t.maxZoom;t.source&&(e=t.source.getLayer(),t.gppKey=t.source.getGPPKey());var s=window.geoportailConfig&&(window.geoportailConfig.capabilities[t.gppKey||t.key]||window.geoportailConfig.capabilities.default)||ol.layer.Geoportail.capabilities;for(var r in(s=s[e])||(s=ol.layer.Geoportail.capabilities[e]),s||(s={title:e,originators:[]},console.error('ol.layer.Geoportail: no layer definition for "'+e+'"\nTry to use ol/layer/Geoportail~loadCapabilities() to get it.')),s)void 0===i[r]&&(i[r]=s[r]);i.gppKey||i.key||(i.gppKey=t.gppKey||t.key),t.source||(t.source=new ol.source.Geoportail(e,i)),t.title||(t.title=s.title),t.name||(t.name=e),t.layer=e,t.queryable||(t.queryable=s.queryable),t.desc||(t.desc=s.desc),!t.extent&&s.bbox&&s.bbox[0]>-170&&s.bbox[2]<170&&(t.extent=ol.proj.transformExtent(s.bbox,"EPSG:4326",t.projection||"EPSG:3857")),t.maxZoom=o,!t.maxResolution&&i.minZoom&&(t.source.getTileGrid().minZoom-=i.minZoom>1?2:1,t.maxResolution=t.source.getTileGrid().getResolution(t.source.getTileGrid().minZoom),t.source.getTileGrid().minZoom=i.minZoom),super(t),this._originators=s.originators}static register(e,t){ol.layer.Geoportail.capabilities[e]=t}static isRegistered(e){return ol.layer.Geoportail.capabilities[e]&&ol.layer.Geoportail.capabilities[e].key}static loadCapabilities(e,t){var i=function(){},o=function(){},s=function(){};this.getCapabilities(e,t).then(function(e){ol.layer.Geoportail.capabilities=e,i(e)}).catch(function(e){o(e)}).finally(function(e){s(e)});var r={then:function(e){return"function"==typeof e&&(i=e),r},catch:function(e){return"function"==typeof e&&(o=e),r},finally:function(e){return"function"==typeof e&&(s=e),r}};return r}static getCapabilities(e){var t={},i=function(){},o=function(){},s=function(){},r=[156543.03390625,78271.516953125,39135.7584765625,19567.87923828125,9783.939619140625,4891.9698095703125,2445.9849047851562,1222.9924523925781,611.4962261962891,305.74811309814453,152.87405654907226,76.43702827453613,38.218514137268066,19.109257068634033,9.554628534317017,4.777314267158508,2.388657133579254,1.194328566789627,.5971642833948135,.29858214169740677,.14929107084870338];function a(e){e=281e-6*Number(e);for(var t=0;tr[t])return t}function n(e){for(var t=e.constraint.length-1;t>0;t--)for(var i=0;i$/,"$1"),originators:{}},d=r.getElementsByTagName("gpp:Originator"),g=0;c=d[g];g++){for(var p,m=u.originators[c.attributes.name.value]={href:c.getElementsByTagName("gpp:URL")[0].innerHTML,attribution:c.getElementsByTagName("gpp:Attribution")[0].innerHTML,logo:c.getElementsByTagName("gpp:Logo")[0].innerHTML,minZoom:20,maxZoom:0,constraint:[]},f=c.getElementsByTagName("gpp:Constraint"),v=0;p=f[v];v++){var y=a(p.getElementsByTagName("sld:MinScaleDenominator")[0].innerHTML),_=a(p.getElementsByTagName("sld:MaxScaleDenominator")[0].innerHTML);_>m.maxZoom&&(m.maxZoom=_),_m.maxZoom&&(m.maxZoom=y),ythis.getMaxResolution()){var o=this.getMinResolution(),s=this.getMaxResolution();for(s>1e5&&(s=156543),o<.15&&(o=.15),t=s;s>o;)s/=2,t=o*=2}var r=this.getExtent();if(e||(e=[21020,6355964]),r&&!ol.extent.containsCoordinate(r,e)&&(e=[(r[0]+r[2])/2,(r[1]+r[3])/2]),i&&(e=ol.proj.transform(e,i,this.getSource().getProjection())),this.getSource&&this.getSource())try{return[this.getSource().getPreview(e,t)]}catch(r){}return[]},ol.layer.Group.prototype.getPreview=function(e,t){if(this.get("preview"))return[this.get("preview")];var i=[];if(this.getLayers)for(var o=this.getLayers().getArray(),s=0;sthis.get("maxResolution"))){if(this.res_=400*t,this.animate_){var i=e.frameState.time-this.animate_;ithis.animateDuration_&&(this.animate_=!1),!!this.animate_}getFeatureHeight(e){if(this.animate_){var t=this.height_(e),i=this.toHeight_(e);return t*(1-this.elapsedRatio_)+this.elapsedRatio_*i}return this.height_(e)}hvector_(e,t){var i=[e[0]*this.matrix_[0]+e[1]*this.matrix_[1]+this.matrix_[4],e[0]*this.matrix_[2]+e[1]*this.matrix_[3]+this.matrix_[5]];return{p0:i,p1:[i[0]+t/this.res_*(i[0]-this.center_[0]),i[1]+t/this.res_*(i[1]-this.center_[1])]}}getFeature3D_(e,t){var i=this.get("geometry")(e),o=i.getCoordinates();switch(i.getType()){case"Polygon":o=[o];case"MultiPolygon":for(var s=[],r=0;r=0;r--)e.lineTo(s[r].p1[0],s[r].p1[1]);e.closePath()}e.fill("evenodd"),e.stroke();break;case"Point":var n=(s=t[i]).feature.get("label");if(n){var l=s.geom.p1,h=e.fillStyle;e.fillStyle=e.strokeStyle,e.textAlign="center",e.textBaseline="bottom",e.fillText(n,l[0],l[1]);var c=e.measureText(n),u=Number(e.font.match(/\d+(\.\d+)?/g).join([]));e.fillStyle="rgba(255,255,255,0.5)",e.fillRect(l[0]-c.width/2-5,l[1]-u-5,c.width+10,u+10),e.strokeRect(l[0]-c.width/2-5,l[1]-u-5,c.width+10,u+10),e.fillStyle=h}}}drawGhost3D_(e,t){var i,o,s,r;for(i=0;i=2&&this.finishDrawing(),!0)}removeLastPoint(){this._geom.pop(),this._lastCoord=this._geom[this._geom.length-1],this.drawSketch()}startDrawing(e){e=e||{},this._geom=[],e.type&&this.setGeometryType(e.type),this.drawSketch(),this._drawing||this.dispatchEvent({type:"drawstart",feature:this.getFeature()}),this._drawing=!0}finishDrawing(e){var t=this.getSource().getFeatures()[2].clone(),i=!!t;switch(this.getGeometryType()){case"Circle":case"LineString":i=this._geom.length>1;break;case"Polygon":i=this._geom.length>2}return!(e&&!i)&&(this._geom=[],this._lastCoord=null,this.drawSketch(),this._drawing&&this.dispatchEvent({type:"drawend",valid:i,feature:t}),this._drawing=!1,t)}abortDrawing(){this._drawing&&this.dispatchEvent({type:"drawabort",feature:this.getFeature()}),this._drawing=!1,this._geom=[],this._lastCoord=null,this.drawSketch()}setPosition(e){this._position=e,this.drawLink()}getPosition(){return this._position}drawLink(){var e=this.getSource().getFeatures();this._position?(this._lastCoord&&this._lastCoord===this._position?e[0].getGeometry().setCoordinates([]):e[0].getGeometry().setCoordinates(this._position),this._geom.length?"Circle"===this.getGeometryType()?e[1].setGeometry(new ol.geom.Circle(this._geom[0],ol.coordinate.dist2d(this._geom[0],this._position))):"Polygon"===this.getGeometryType()?e[1].setGeometry(new ol.geom.LineString([this._lastCoord,this._position,this._geom[0]])):e[1].setGeometry(new ol.geom.LineString([this._lastCoord,this._position])):e[1].setGeometry(new ol.geom.LineString([]))):(e[0].getGeometry().setCoordinates([]),e[1].setGeometry(new ol.geom.LineString([])))}getFeature(){return this.getSource().getFeatures()[2]}drawSketch(){this.drawLink();var e=this.getSource().getFeatures();if(this._geom.length)switch(this._lastCoord||(this._lastCoord=this._geom[this._geom.length-1]),e[3].getGeometry().setCoordinates(this._lastCoord),this._type){case"Point":e[2].setGeometry(new ol.geom.Point(this._lastCoord));break;case"Circle":e[2].getGeometry()?e[2].getGeometry().setRadius(ol.coordinate.dist2d(this._geom[0],this._geom[this._geom.length-1])):e[2].setGeometry(new ol.geom.Circle(this._geom[0],ol.coordinate.dist2d(this._geom[0],this._geom[this._geom.length-1])));break;case"LineString":e[2].getGeometry()?e[2].getGeometry().setCoordinates(this._geom):e[2].setGeometry(new ol.geom.LineString(this._geom));break;case"Polygon":this._geom.push(this._geom[0]),e[2].getGeometry()?e[2].getGeometry().setCoordinates([this._geom]):e[2].setGeometry(new ol.geom.Polygon([this._geom])),this._geom.pop();break;default:console.error("[ol/layer/SketchOverlay~drawSketch] geometry type not supported ("+this._type+")")}else e[2].setGeometry(null),e[3].setGeometry(new ol.geom.Point([]))}},ol.PerspectiveMap=class extends ol.Map{constructor(e){var t=e.target instanceof Element?e.target:document.getElementById(e.target);"absolute"!==window.getComputedStyle(t).position&&(t.style.position="relative"),t.style.overflow="hidden";var i=ol.ext.element.create("DIV",{className:"ol-perspective-map",parent:t}),o={};Object.assign(o,e),o.target=i,super(o),this._tiltCondition=e.tiltCondition||ol.events.condition.altKeyOnly}getPixelRatio(){return window.devicePixelRatio}setPerspective(e,t){t=t||{},e>30?e=30:e<0&&(e=0);var i=this._angle||0,o=Math.round(10*e)/10,s=this.getTarget().querySelector(".ol-layers").style;cancelAnimationFrame(this._animatedPerspective),requestAnimationFrame(function(e){this._animatePerpective(e,e,s,i,o,t.duration,t.easing||ol.easing.inAndOut)}.bind(this))}_animatePerpective(e,t,i,o,s,r,a){var n,l,h;0===r?(n=1,l=!0):l=(n=(t-e)/(r||500))>=1,n=a(n);var c=(h=this._angle=l?s:o+(s-o)*n)/30;i.transform="translateY(-"+17*c+"%) perspective(200px) rotateX("+h+"deg) scaleY("+(1-c/2)+")",this.getMatrix3D(!0),this.render(),l||requestAnimationFrame(function(t){this._animatePerpective(e,t,i,o,s,r||500,a||ol.easing.inAndOut)}.bind(this)),this.dispatchEvent({type:"change:perspective",angle:h,animating:!l})}handleMapBrowserEvent(e){if(e.pixel=[e.originalEvent.offsetX/this.getPixelRatio(),e.originalEvent.offsetY/this.getPixelRatio()],e.coordinate=this.getCoordinateFromPixel(e.pixel),ol.Map.prototype.handleMapBrowserEvent.call(this,e),this._tiltCondition(e))switch(e.type){case"pointerdown":this._dragging=e.originalEvent.offsetY;break;case"pointerup":this._dragging=!1;break;case"pointerdrag":if(!1!==this._dragging){var t=e.originalEvent.offsetY>this._dragging?.5:-.5;t&&this.setPerspective((this._angle||0)+t,{duration:0}),this._dragging=e.originalEvent.offsetY}}else this._dragging=!1}getMatrix3D(e){if(e){var t=this.getTarget().querySelector(".ol-layers"),i=ol.matrix3D.getTransform(t),o=ol.matrix3D.getTransformOrigin(t);this._matrixTransform=ol.matrix3D.computeTransformMatrix(i,o)}return this._matrixTransform||(this._matrixTransform=ol.matrix3D.identity()),this._matrixTransform}getPixelScreenFromCoordinate(e){var t=this.getPixelFromCoordinate(e),i=this.getMatrix3D(),o=ol.matrix3D.transformVertex(i,t);return[(o=ol.matrix3D.projectVertex(o))[0],o[1]]}getPixelFromPixelScreen(e){var t=ol.matrix3D.inverse(this.getMatrix3D()),i=ol.matrix3D.transformVertex(t,e);return[(i=ol.matrix3D.projectVertex(i))[0],i[1]]}},function(){var e=ol.Overlay.prototype.updatePixelPosition;ol.Overlay.prototype.updatePixelPosition=function(){var t=this.getMap();if(t&&t instanceof ol.PerspectiveMap){var i=this.getPosition();if(!t||!t.isRendered()||!i)return void this.setVisible(!1);var o=t.getPixelScreenFromCoordinate(i),s=t.getSize();o[0]-=s[0]/4,o[1]-=s[1]/4,this.updateRenderedPosition(o,s)}else e.call(this)}}(),ol.particule.Base=class extends ol.Object{constructor(e){super(e=e||{}),this.setOverlay(e.overlay),this.coordinate=e.coordinate||[0,0]}setOverlay(e){this._overlay=e}getOverlay(){return this._overlay}draw(){}update(){}getRandomCoord(e){return this.getOverlay().randomCoord?this.getOverlay().randomCoord():[e,0]}},ol.particule.Bird=class extends ol.particule.Base{constructor(e){super(e=e||{}),this.bird=new Image,this.bird.addEventListener("load",function(){this.set("size",[this.bird.width||50,this.bird.height||50]),console.log(this.bird.width,this.bird.height)}.bind(this)),this.bird.src=e.src||"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAABDCAQAAAD+S8VaAAAAAnNCSVQICFXsRgQAAAAJcEhZcwAAAvMAAALzAdLpCioAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAG90lEQVR42uWaaVRTRxTHJ4AUUIoIiqISOArIDiIhBBfccCMoR0vVUpXjTqun4Fr1tO5i3YuodaFqRMECKm4VUHEhUvWgBYuilgpiRVZpCARI3r8fWA4hYY9AXu77+ObNzO/O8u787xDSyeYSTzSICpu+DjV0ogrze84PBneByuJv3JpbBlx6MEBbJfG/8S2RAACFXXtU0gERN1BjCc9UEN/e7I2w1gFPinv3UDkHbFiGOqOwJVjlHMALRT3LLJ7trGIOuHwFUsY7q2IOuJ0u7YB//pswWFn6/vnUcbOCAn7ctfnUrsijl85dv5pw786fd9OTsvg5/JykN3fTb6ZcTDgVvefIkqXmVvKr0NN/IUQDO7C1qwJrOwyftIZ7cmIiN21eZlB+SOUtFKNl9kF0hb9ujmyVM73FMmWv3m+2J4zxw74NDN5/5vT1qzeT7j3n5/Bz7mcmPk24cy32Ai8i9Pj2nwIX+jo4kc8UMMqeXr5bfC6N/2tUHrdsCQ4gAR/QNhNRJ8+6GklXH7xStlxW+ViLxrpjqBswJ/z4rYyCFrQnwJPCxGe/x53i+fO+XOth2xpsvQm+PkfGP3YuYIo1oInTyIJiLDFtoZfUP+AXeaW2rZHXKZ8xJ35NeU+1odVSbIIBbEQeb70Tffd6ckmj0QbDy9/zOufdILE6SN0TBkVafnn0ka/NatrrditDXpmYKw36pREwPyr+Y0V72n0CsxoedTDFrMJJyRMDZJYIx8+yYICQKbDJtcjtL9IGAcEMKN7efIy+snnTYv/tR8Ry3+eWRUYFzavRB9SWL7icXKWAVrPRr96wEqjBTjg5bop03GGi77XF85FdqVZNIQ1konOsEvx35yOCN1xMFimszjNSDqh+ektGfVG3xjyTzaqkX3uDTiaCdh0ZA/qSgWXWWfb7CYMQQsiUUANK1j8hoJf1lSFUg0u+z1xCiFuMUYWsAy7QCj9ZzhIgIDCkpi4nhBCGsafNGx2peXCQRvhlcGrEAQSOhYQQQtyTG74YCglN8CswrVF8goEVhBBCrMzdozi33OOHJmvUvQqghQtKMEUu+GDB0Cj2Q/vsUdJn0JH8+oXG4rWS46djSD0ePcr2lUuafbZlIbN0UAnngpyA0I3FumeZxxQYVlZ/ooWleKm0+FHQbTDuWnAp5F6cbNfskcDtcg9J9aMGNUxDIiglgy+CPxhypj4Ddu/cfFpxOrIqrv7QAsH4V2nwYxoEvwQEOpRlAeeG07hWnopH7FMHgTr6VmhAA1xEQNjF4bMxQwpcj2I9duVZLiVtTb7YT7T2I30JccyqrrA7ZuESRF0SvhQ/QKfByDu/VZAs5O6rXS9U6onZ+A2CLgQvwWn0l5n4TAFnjOKksR5En6i73q6/q3IRhvwugB8LBylwi6IhixxX9Wd/CoWQwTrJTuaEOSwzENcKDR7Yj4xOg4+Hq3SEXzX8fIfcObAZPizV+bGxqLZhMyxBWgdP+xi4ScGbCNnhhrodqxnrso65pLidNxMQENihqoPgS3AY5rU7krh35eCPbon2c4hap2nnxob2GQQE+zpAM4qFb53EoUWxE3t93jXyBwyXcG1KD+8/IXwBAmFYg26Vx37oHjnIlnQlGzbJvMCX+lQrPgT6dat9yAcT/S6aSOIs2rjjxLaQ9SsX83gv8uShiNuAn4mR9fZ5dizpphRpREvj1YvOhiU84OdmoghFyKH47y/GHohtLf45ITvVuLyfyKLI5RlntyJSXx2+P+gaejt5O7FNCSEkcFHTuAmPom6/qqxJqFRee33wHGc6rVLjXtym8C8nTTcnDNMh/n5BfnN8mFY18jWdbPlceeBViEsPi16xxFSL7ncjukVelTvxUzsxjOlAUzsULv8/GfdEJa7G7D7YWLCcUzbNkfb42zaXNaG2h4XTHH/n9x+bjIHKqeAdNMZf55fbrKBYLNq+lqb433lkFrUk5hNKdu6mIf5XA1KetzibR+09TLcfonrMtVYlNKk9h2gV//FCW3tCFmMXT0nOe83bxpklbdDJqrD+BC1mwUzTtOw2Sl/UFjpsh8ci2pHirFgxV8nxV/oJxO2RwR6+HNFbmfkZ15PaqwQe/VmJ+R18Aql37XTAsQ9EefUBW6NeEk34IaWN8HkIQk+Jva0SzwGXP6p1XDeEoqB1qx/L0B3dKY+VSr0JDurDFNaK2ZoYg5142sx1m3LEYxUsq+Vv8ejVSv8bdJ/UXySds9eDB4JwEnFIRS6KUIi/8RJxCEEARte74GBR6DycFpGgtZNFPkHrHgOx61miSaPDEOtEn8qWwvepZMc5Mel3ItZmHbbM12wSXV/snMHZQ6eRlzEzI9d9rnftskwERhXVNxF7ik1Krd87pbLCbWYR9Y7v0f/htaJHbsoDhwAAAABJRU5ErkJggg==",this.set("size",[this.bird.width||50,this.bird.height||50])}draw(e){var t=this.getOverlay().get("angle");e.save(),e.translate(this.coordinate[0],this.coordinate[1]),e.rotate(t+Math.PI/2),e.scale(.5,.5),e.drawImage(this.bird,-this.bird.width/2,-this.bird.height/2),e.restore()}update(e){var t=this.getOverlay().get("speed")*e/this.getOverlay()._fps,i=this.getOverlay().get("angle");this.coordinate[0]+=t*Math.cos(i),this.coordinate[1]+=t*Math.sin(i)}},ol.particule.Cloud=class extends ol.particule.Base{constructor(e){super(e=e||{}),this.set("size",[100,100]);var t=document.createElement("CANVAS");t.width=200,t.height=200;var i=t.getContext("2d"),o=this.gradient=i.createRadialGradient(50,50,0,50,50,50);o.addColorStop(0,"rgba(255,255,255,.2"),o.addColorStop(1,"rgba(255,255,255,0"),this.image=t;for(var s=0;s<7;s++){i.save();var r=100*Math.random(),a=100*Math.random();i.translate(r,a),i.fillStyle=o,i.fillRect(0,0,t.width,t.height),i.restore()}}draw(e){e.save(),e.translate(this.coordinate[0],this.coordinate[1]),e.drawImage(this.image,-this.image.width/2,-this.image.width/2),e.restore()}update(e){var t=this.getOverlay().get("speed")*e/this.getOverlay()._fps,i=this.getOverlay().get("angle");this.coordinate[0]+=t*Math.cos(i),this.coordinate[1]+=t*Math.sin(i)}},ol.particule.Rain=class extends ol.particule.Base{constructor(e){super(e=e||{}),this.z=Math.floor(5*Math.random())+1;var t=document.createElement("CANVAS");t.width=50,t.height=50;var i=t.getContext("2d");this.gradient=i.createRadialGradient(0,0,0,0,0,25),this.gradient.addColorStop(0,"rgba(0,0,80,0)"),this.gradient.addColorStop(1,"rgba(0,0,80,.3)")}draw(e){e.save();var t=this.getOverlay().get("angle");e.beginPath();var i=10*Math.cos(t)*(1+this.z/2),o=10*Math.sin(t)*(1+this.z/2);e.lineWidth=Math.round(this.z/2),e.strokeStyle=this.gradient,e.translate(this.coordinate[0],this.coordinate[1]),e.moveTo(0,0),e.lineTo(i,o),e.stroke(),e.restore()}update(e){var t=this.getOverlay().get("speed")*e/this.getOverlay()._fps*this.z,i=this.getOverlay().get("angle");this.coordinate[0]+=t*Math.cos(i),this.coordinate[1]+=t*Math.sin(i)}},ol.particule.RainDrop=class extends ol.particule.Base{constructor(e){super(e=e||{}),this.size=0;var t=document.createElement("CANVAS");t.width=100,t.height=100;var i=t.getContext("2d"),o=i.createRadialGradient(50,50,0,50,50,50);o.addColorStop(0,"rgba(128,128,192,.8"),o.addColorStop(1,"rgba(128,128,192,0"),this.image=t,i.fillStyle=o,i.fillRect(0,0,t.width,t.height)}draw(e){this.size>0&&(e.save(),e.translate(this.coordinate[0],this.coordinate[1]),e.globalAlpha=this.size/50,e.scale(1-this.size/50,1-this.size/50),e.drawImage(this.image,-50,-50),e.restore())}update(e){(this.size>0||Math.random()<.01)&&(this.size<=0&&(this.size=50,this.coordinates=this.getRandomCoord()),this.size=this.size-Math.round(e/20))}},ol.particule.Snow=class extends ol.particule.Base{constructor(e){super(e=e||{}),this.z=(Math.floor(5*Math.random())+1)/5,this.angle=Math.random()*Math.PI;var t=document.createElement("CANVAS");t.width=20,t.height=20;var i=t.getContext("2d"),o=i.createRadialGradient(10,10,0,10,10,10);o.addColorStop(0,"rgba(255, 255, 255,1)"),o.addColorStop(.8,"rgba(210, 236, 242,.8)"),o.addColorStop(1,"rgba(237, 247, 249,0)"),this.image=t,i.fillStyle=o,i.fillRect(0,0,t.width,t.height)}draw(e){e.save(),e.translate(this.coordinate[0],this.coordinate[1]),e.globalAlpha=.4+this.z/2,e.scale(this.z,this.z),e.drawImage(this.image,-10,-10),e.restore()}update(e){var t=this.getOverlay().get("speed")*e/this.getOverlay()._fps*this.z*5,i=this.getOverlay().get("angle");this.angle=this.angle+e/this.getOverlay()._fps/100,this.coordinate[0]+=2*Math.sin(this.angle+this.z)+t*Math.cos(i),this.coordinate[1]+=Math.cos(this.angle)+t*Math.sin(i)}},ol.Overlay.Popup=class extends ol.Overlay{constructor(e){e=e||{};var t=document.createElement("div");e.element=t,super(e),"number"==typeof e.offsetBox?this.offsetBox=[e.offsetBox,e.offsetBox,e.offsetBox,e.offsetBox]:this.offsetBox=e.offsetBox,this.closeBox=e.closeBox,this.onclose=e.onclose,this.onshow=e.onshow,ol.ext.element.create("BUTTON",{className:"closeBox"+(e.closeBox?" hasclosebox":""),type:"button",click:function(){this.hide()}.bind(this),parent:t}),!1!==e.anchor&&ol.ext.element.create("DIV",{className:"anchor",parent:t}),this.content=ol.ext.element.create("DIV",{html:e.html||"",className:"ol-popup-content",parent:t}),e.minibar&&ol.ext.element.scrollDiv(this.content,{vertical:!0,mousewheel:!0,minibar:!0}),e.stopEvent&&(t.addEventListener("mousedown",function(e){e.stopPropagation()}),t.addEventListener("touchstart",function(e){e.stopPropagation()})),this._elt=t,this.setPositioning(e.positioning||"auto"),this.setPopupClass(e.popupClass||e.className||"default"),e.anim&&this.addPopupClass("anim"),e.position&&setTimeout(function(){this.show(e.position)}.bind(this))}getClassPositioning(){var e="",t=this.getPositioning();return/bottom/.test(t)&&(e+="ol-popup-bottom "),/top/.test(t)&&(e+="ol-popup-top "),/left/.test(t)&&(e+="ol-popup-left "),/right/.test(t)&&(e+="ol-popup-right "),/^center/.test(t)&&(e+="ol-popup-middle "),/center$/.test(t)&&(e+="ol-popup-center "),e}setClosebox(e){this.closeBox=e,e?this.element.classList.add("hasclosebox"):this.element.classList.remove("hasclosebox")}setPopupClass(e){var t=["ol-popup"];this.getVisible()&&t.push("visible"),this.element.className="";var i=this.getClassPositioning().split(" ").filter(function(e){return e.length>0});e?e.split(" ").filter(function(e){return e.length>0}).forEach(function(e){t.push(e)}):t.push("default"),i.forEach(function(e){t.push(e)}),this.closeBox&&t.push("hasclosebox"),this.element.classList.add.apply(this.element.classList,t)}addPopupClass(e){this.element.classList.add(e)}removePopupClass(e){this.element.classList.remove(e)}setPositioning(e){void 0!==e&&(/auto/.test(e)?(this.autoPositioning=e.split("-"),1==this.autoPositioning.length&&(this.autoPositioning[1]="auto")):this.autoPositioning=!1,"center"==(e=e.replace(/auto/g,"center"))&&(e="bottom-center"),this.setPositioning_(e))}setPositioning_(e){if(this.element){super.setPositioning(e),this.element.classList.remove("ol-popup-top","ol-popup-bottom","ol-popup-left","ol-popup-right","ol-popup-center","ol-popup-middle");var t=this.getClassPositioning().split(" ").filter(function(e){return e.length>0});this.element.classList.add.apply(this.element.classList,t)}}getVisible(){return this.element.classList.contains("visible")}show(e,t){t||"string"!=typeof e||(t=e,e=null),!0===e&&(e=this.getPosition());var i=this,o=this.getMap();if(o&&(t&&t!==this.prevHTML&&(this.prevHTML=t,this.content.innerHTML="",t instanceof Element?this.content.appendChild(t):ol.ext.element.create("DIV",{html:t,parent:this.content}),Array.prototype.slice.call(this.content.querySelectorAll("img")).forEach(function(e){e.addEventListener("load",function(){try{o.renderSync()}catch(e){}i.content.dispatchEvent(new Event("scroll"))})})),e)){if(this.autoPositioning){var s=o.getPixelFromCoordinate(e),r=o.getSize(),a=[];"auto"==this.autoPositioning[0]?a[0]=s[1]this._particules.length)for(var o=this._particules.length;othis._canvas.width+t[0]?(e.coordinate[0]=-t[0],e.coordinate[1]=Math.random()*(this._canvas.height+t[1])-t[1]/2):e.coordinate[1]<-t[1]?(e.coordinate[0]=Math.random()*(this._canvas.width+t[0])-t[0]/2,e.coordinate[1]=this._canvas.height+t[1]):e.coordinate[1]>this._canvas.height+t[1]&&(e.coordinate[0]=Math.random()*(this._canvas.width+t[0])-t[0]/2,e.coordinate[1]=-t[1])}clear(){this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height)}getCanvas(){return this._canvas}setAnimation(e){e=!1!==e,this.set("animation",e),e?(this._pause=!0,requestAnimationFrame(this._animate.bind(this))):this.dispatchEvent({type:"animation:stop",time:this._time})}_animate(e){this.getVisible()&&this.get("animation")&&(this._pause?requestAnimationFrame(function(e){this._time=e,requestAnimationFrame(this._animate.bind(this))}.bind(this)):(e-this._time>this._fps&&(this.draw(e-this._time),this._time=e),requestAnimationFrame(this._animate.bind(this)))),this._pause=!1}},ol.Overlay.Fixed=class extends ol.Overlay{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(1e3*e[0])===Math.round(1e3*this._pixel[0])&&Math.round(1e3*e[0])===Math.round(1e3*this._pixel[0])||this.setPosition(this.getMap().getCoordinateFromPixel(this._pixel))}}},ol.Overlay.FixedPopup=class extends ol.Overlay.Popup{constructor(e){e.anchor=!1,e.positioning=e.positioning||"center-center",e.className=(e.className||"")+" ol-fixPopup",super(e),this.set("minScale",e.minScale||.5),this.set("maxScale",e.maxScale||2);var t=document.createElement("canvas");this._overlay=new ol.layer.Image({source:new ol.source.ImageCanvas({canvasFunction:function(e,i,o,s){return t.width=s[0],t.height=s[1],t}})}),this._style=e.style||new ol.style.Style({fill:new ol.style.Fill({color:[102,153,255]})}),this._overlay.on(["postcompose","postrender"],function(e){if(this.getVisible()&&this._pixel){var t=this.getMap(),i=this.getPosition(),o=t.getPixelFromCoordinate(i),s=this.element.getBoundingClientRect(),r=this.getMap().getTargetElement().getBoundingClientRect(),a=[s.left-r.left+s.width/2,s.top-r.top+s.height/2];e.context.save();var n=e.inversePixelTransform;n?e.context.transform(n[0],n[1],n[2],n[3],n[4],n[5]):e.context.scale(e.frameState.pixelRatio,e.frameState.pixelRatio),e.context.beginPath(),e.context.moveTo(o[0],o[1]),Math.abs(a[0]-o[0])>Math.abs(a[1]-o[1])?(e.context.lineTo(a[0],a[1]-8),e.context.lineTo(a[0],a[1]+8)):(e.context.lineTo(a[0]-8,a[1]),e.context.lineTo(a[0]+8,a[1])),e.context.moveTo(o[0],o[1]),this._style.getFill()&&(e.context.fillStyle=ol.color.asString(this._style.getFill().getColor()),e.context.fill()),this._style.getStroke()&&(e.context.strokeStyle=ol.color.asString(this._style.getStroke().getColor()),e.context.lineWidth=this._style.getStroke().width(),e.context.stroke()),e.context.restore()}}.bind(this));var i=function(){this.setPixelPosition()}.bind(this);function o(e){var t=0,i=0,o=0;for(var s in e)t+=e[s].clientX,i+=e[s].clientY,o++;return[t/o,i/o]}function s(e){var t=Object.keys(e);return!(t.length<2)&&ol.coordinate.dist2d([e[t[0]].clientX,e[t[0]].clientY],[e[t[1]].clientX,e[t[1]].clientY])}this.on(["hide","show"],function(){setTimeout(i)}.bind(this));var r,a,n,l,h={},c={},u=[];this.element.addEventListener("pointerdown",function(e){for(var t in e.preventDefault(),e.stopPropagation(),h)c[t]&&(h[t]=c[t]);h[e.pointerId]=e,u=this._pixel,a=this.get("rotation")||0,n=this.get("scale")||1,r=s(h),l=!1}.bind(this)),this.element.addEventListener("click",function(e){l&&(e.preventDefault(),e.stopPropagation())},!0);var d=function(e){h[e.pointerId]&&(delete h[e.pointerId],e.preventDefault()),c[e.pointerId]&&delete c[e.pointerId]}.bind(this);document.addEventListener("pointerup",d),document.addEventListener("pointercancel",d),document.addEventListener("pointermove",function(e){if(h[e.pointerId]){e.preventDefault(),c[e.pointerId]=e;var t=o(h),i=o(c),d=i[0]-t[0],g=i[1]-t[1];l=l||Math.abs(d)>3||Math.abs(g)>3;var p=function(){var e,t,i=Object.keys(h);if(i.length<2)return!1;e=h[i[0]];var o=[(t=h[i[1]]).clientX-e.clientX,t.clientY-e.clientY];e=c[i[0]];var s=[(t=c[i[1]]).clientX-e.clientX,t.clientY-e.clientY],r=Math.sqrt(o[0]*o[0]+o[1]*o[1]),a=Math.sqrt(s[0]*s[0]+s[1]*s[1]),n=360*Math.acos((o[0]*s[0]+o[1]*s[1])/(r*a))/Math.PI;return o[0]*s[1]-o[1]*s[0]<0?-n:n}();p&&this.setRotation(a+1.5*p,!1);var m=s(c);!1!==m&&r&&(this.setScale(n*m/r,!1),r=n*m/this.get("scale")),this.setPixelPosition([u[0]+d,u[1]+g])}}.bind(this))}setMap(e){super.setMap(e),this._overlay.setMap(this.getMap()),this._listener&&ol.Observable.unByKey(this._listener),e&&(this._listener=e.on("change:size",function(){this.setPixelPosition()}.bind(this)))}updatePixelPosition(){var e=this.getMap(),t=this.getPosition();if(e&&e.isRendered()&&t)if(this._pixel)this.setVisible(!0);else{this._pixel=e.getPixelFromCoordinate(t);var i=e.getSize();this.updateRenderedPosition(this._pixel,i)}else this.setVisible(!1)}updateRenderedPosition(e,t){super.updateRenderedPosition(e,t),this.setRotation(),this.setScale()}setPixelPosition(e,t){var i,o=this.getMap(),s=o?o.getSize():[0,0];if(t&&(this.setPositioning(t),(i=ol.ext.element.offsetRect(this.element)).width=i.height=0,/top/.test(t)?e[1]+=i.height/2:/bottom/.test(t)?e[1]=s[1]-i.height/2-e[1]:e[1]=s[1]/2+e[1],/left/.test(t)?e[0]+=i.width/2:/right/.test(t)?e[0]=s[0]-i.width/2-e[0]:e[0]=s[0]/2+e[0]),e&&(this._pixel=e),o&&o.getTargetElement()&&this._pixel){this.updateRenderedPosition(this._pixel,s);var r=!1;i=ol.ext.element.offsetRect(this.element);var a=ol.ext.element.offsetRect(o.getTargetElement());i.lefta.left+a.width&&(this._pixel[0]=this._pixel[0]+a.left-i.left+a.width-i.width,r=!0),i.topa.top+a.height&&(this._pixel[1]=this._pixel[1]+a.top-i.top+a.height-i.height,r=!0),r&&this.updateRenderedPosition(this._pixel,s),this._overlay.changed()}}getPixelPosition(){return this._pixel}setPopupClass(e){super.setPopupClass(e),this.addPopupClass("ol-fixPopup")}setRotation(e,t){"number"==typeof e&&this.set("rotation",e),!1!==t&&(/rotate/.test(this.element.style.transform)?this.element.style.transform=this.element.style.transform.replace(/rotate\((-?[\d,.]+)deg\)/,"rotate("+(this.get("rotation")||0)+"deg)"):this.element.style.transform=this.element.style.transform+" rotate("+(this.get("rotation")||0)+"deg)")}setScale(e,t){"number"==typeof e&&this.set("scale",e),e=Math.min(Math.max(this.get("minScale")||0,this.get("scale")||1),this.get("maxScale")||2),this.set("scale",e),!1!==t&&(/scale/.test(this.element.style.transform)?this.element.style.transform=this.element.style.transform.replace(/scale\(([\d,.]+)\)/,"scale("+e+")"):this.element.style.transform=this.element.style.transform+" scale("+e+")")}setLinkStyle(e){this._style=e,this._overlay.changed()}getLinkStyle(){return this._style}},ol.Overlay.Magnify=class extends ol.Overlay{constructor(e){var t=document.createElement("div");t.className="ol-magnify",super({positioning:e.positioning||"center-center",element:t,stopEvent:!1}),this._elt=t,this.mgmap_=new ol.Map({controls:new ol.Collection,interactions:new ol.Collection,target:e.target||this._elt,view:new ol.View({projection:e.projection}),layers:e.layers}),this.mgview_=this.mgmap_.getView(),this.external_=!!e.target,this.set("zoomOffset",e.zoomOffset||1),this.set("active",!0),this.on("propertychange",this.setView_.bind(this))}setMap(e){this.getMap()&&this.getMap().getViewport().removeEventListener("mousemove",this.onMouseMove_),this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,super.setMap(e),e.getViewport().addEventListener("mousemove",this.onMouseMove_.bind(this)),this._listener=e.getView().on("propertychange",this.setView_.bind(this)),this.setView_()}getMagMap(){return this.mgmap_}getActive(){return this.get("active")}setActive(e){return this.set("active",e)}onMouseMove_(e){if(this.get("active")){var t=this.getMap().getEventCoordinate(e);this.external_||this.setPosition(t),this.mgview_.setCenter(t),this._elt.querySelector("canvas")&&"none"!=this._elt.querySelector("canvas").style.display||this.mgmap_.updateSize()}else this.setPosition()}setView_(e){if(this.get("active")){if(!e)return this.setView_({key:"rotation"}),void this.setView_({key:"resolution"});switch(e.key){case"rotation":this.mgview_.setRotation(this.getMap().getView().getRotation());break;case"zoomOffset":case"resolution":var t=Math.max(0,this.getMap().getView().getZoom()+Number(this.get("zoomOffset")));this.mgview_.setZoom(t)}}else this.setPosition()}},ol.Overlay.Placemark=class extends ol.Overlay.Popup{constructor(e){(e=e||{}).popupClass=(e.popupClass||"")+" placemark anim",e.positioning="bottom-center",super(e),this.setPositioning=function(){},e.color&&(this.element.style.color=e.color),e.backgroundColor&&(this.element.style.backgroundColor=e.backgroundColor),e.contentColor&&this.setContentColor(e.contentColor),e.size&&this.setRadius(e.size)}show(e,t){!0===e&&(e=this.getPosition()),this.hide(),super.show(e,t)}setColor(e){this.element.style.color=e}setBackgroundColor(e){this._elt.style.backgroundColor=e}setContentColor(e){var t=this.element.getElementsByClassName("ol-popup-content")[0];t&&(t.style.color=e)}setClassName(e){var t=this.element.className;this.element.className="ol-popup placemark ol-popup-bottom ol-popup-center "+(/visible/.test(t)?"visible ":"")+(/anim/.test(t)?"anim ":"")+e}setRadius(e){this.element.style.fontSize=e+"px"}},ol.Overlay.PopupFeature=class extends ol.Overlay.Popup{constructor(e){super(e=e||{}),this.setTemplate(e.template),this.set("canFix",e.canFix),this.set("showImage",e.showImage),this.set("maxChar",e.maxChar||200),this.set("keepSelection",e.keepSelection),e.select&&"function"==typeof e.select.on&&(this._select=e.select,e.select.on("select",function(t){this._noselect||(t.selected[0]?this.show(t.mapBrowserEvent.coordinate,e.select.getFeatures().getArray(),t.selected[0]):this.hide())}.bind(this)))}setTemplate(e){e||(e=function(e){var t=e.getProperties();return delete t[e.getGeometryName()],{attributes:Object.keys(t)}}),this._template=e,this._attributeObject(this._template)}_attributeObject(e){if(e&&e.attributes instanceof Array){var t={};e.attributes.forEach(function(e){t[e]=!0}),e.attributes=t}return e.attributes}show(e,t,i){(e instanceof ol.Feature||e instanceof Array&&e[0]instanceof ol.Feature)&&(t=e,e=null),t instanceof Array||(t=[t]),this._features=t.slice(),this._count||(this._count=1),this._count=1;var o=this.get("keepSelection")&&i||t[0],s=this._getHtml(o);s?(this.element.classList.contains("ol-fixed")||this.hide(),e&&"Point"!==t[0].getGeometry().getType()||(e=t[0].getGeometry().getFirstCoordinate()),super.show(e,s)):this.hide()}_getHtml(e){if(!e)return"";var t=ol.ext.element.create("DIV",{className:"ol-popupfeature"});this.get("canFix")&&ol.ext.element.create("I",{className:"ol-fix",parent:t}).addEventListener("click",function(){this.element.classList.toggle("ol-fixed")}.bind(this));var i,o=this._template;if("function"==typeof o)o=o(e,this._count,this._features.length);else if(!o||!o.attributes)for(var s in(o=o||{}).attributes={},e.getProperties())"geometry"!=s&&(o.attributes[s]=s);o.title&&(i="function"==typeof o.title?o.title(e):e.get(o.title),ol.ext.element.create("H1",{html:i,parent:t}));if(o.attributes){var r,a=ol.ext.element.create("TABLE",{parent:t}),n=this._attributeObject(o),l=e.getProperties();for(var h in n)if(l.hasOwnProperty(h)){var c,u=n[h],d=l[h];u&&"function"==typeof u.format&&(d=u.format(d,e));var g=!0;if(u&&"boolean"==typeof u.visible?g=u.visible:u&&"function"==typeof u.visible&&(g=u.visible(e,d)),g){if(r=ol.ext.element.create("TR",{parent:a}),ol.ext.element.create("TD",{html:u&&u.title||h,parent:r}),this.get("showImage")&&/(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|gif|png)/.test(d))c=ol.ext.element.create("IMG",{src:d});else{c=u?(u.before||"")+d+(u.after||""):"";var p=this.get("maxChar")||200;"string"==typeof c&&c.length>p&&(c=c.substr(0,p)+"[...]")}ol.ext.element.create("TD",{html:c,parent:r})}}}if(ol.ext.element.create("BUTTON",{className:"ol-zoombt",parent:t}).addEventListener("click",function(){if("Point"===e.getGeometry().getType())this.getMap().getView().animate({center:e.getGeometry().getFirstCoordinate(),zoom:Math.max(this.getMap().getView().getZoom(),18)});else{var t=e.getGeometry().getExtent();this.getMap().getView().fit(t,{duration:1e3})}}.bind(this)),!this.get("keepSelection")&&this._features.length>1){var m=ol.ext.element.create("DIV",{className:"ol-count",parent:t});ol.ext.element.create("DIV",{className:"ol-prev",parent:m,click:function(){this._count--,this._count<1&&(this._count=this._features.length),t=this._getHtml(this._features[this._count-1]),setTimeout(function(){ol.Overlay.Popup.prototype.show.call(this,this.getPosition(),t)}.bind(this),350)}.bind(this)}),ol.ext.element.create("TEXT",{html:this._count+"/"+this._features.length,parent:m}),ol.ext.element.create("DIV",{className:"ol-next",parent:m,click:function(){this._count++,this._count>this._features.length&&(this._count=1),t=this._getHtml(this._features[this._count-1]),setTimeout(function(){ol.Overlay.Popup.prototype.show.call(this,this.getPosition(),t)}.bind(this),350)}.bind(this)})}return this._select&&!this.get("keepSelection")&&(this._noselect=!0,this._select.getFeatures().clear(),this._select.getFeatures().push(e),this._noselect=!1),this.dispatchEvent({type:"select",feature:e,index:this._count}),t}setFix(e){e?this.element.classList.add("ol-fixed"):this.element.classList.remove("ol-fixed")}getFix(){return this.element.classList.contains("ol-fixed")}},ol.Overlay.PopupFeature.localString=function(e,t){return function(i){if(i&&i.toLocaleString)return i.toLocaleString(e,t);var o=new Date(i);return isNaN(o)?i:o.toLocaleString(e,t)}},ol.Overlay.Tooltip=class extends ol.Overlay.Popup{constructor(e){(e=e||{}).popupClass=e.popupClass||e.className||"tooltips black",e.positioning=e.positioning||"center-left",e.stopEvent=!!e.stopEvent,super(e),this.set("maximumFractionDigits",e.maximumFractionDigits||2),"function"==typeof e.formatLength&&(this.formatLength=e.formatLength),"function"==typeof e.formatArea&&(this.formatArea=e.formatArea),"function"==typeof e.getHTML&&(this.getHTML=e.getHTML),this._interaction=new ol.interaction.Interaction({handleEvent:function(e){if("pointermove"===e.type||"click"===e.type){var t=this.getHTML(this._feature,this.get("info"));t?this.show(e.coordinate,t):this.hide(),this._coord=e.coordinate}return!0}.bind(this)})}setMap(e){this.getMap()&&this.getMap().removeInteraction(this._interaction),super.setMap(e),this.getMap()&&this.getMap().addInteraction(this._interaction)}getHTML(e,t){return this.get("measure")?this.get("measure")+(t?"
"+t:""):t||""}setInfo(e){e?setTimeout(function(){this.set("info",e),this.show(this._coord,this.get("info"))}.bind(this)):(this.set("info",""),this.hide())}removeFeature(){this.setFeature()}formatArea(e){return e>Math.pow(10,-1*this.get("maximumFractionDigits"))?e>1e4?(e/1e6).toLocaleString(void 0,{maximumFractionDigits:this.get("maximumFractionDigits)")})+" km²":e.toLocaleString(void 0,{maximumFractionDigits:this.get("maximumFractionDigits")})+" m²":""}formatLength(e){return e>Math.pow(10,-1*this.get("maximumFractionDigits"))?e>100?(e/1e3).toLocaleString(void 0,{maximumFractionDigits:this.get("maximumFractionDigits")})+" km":e.toLocaleString(void 0,{maximumFractionDigits:this.get("maximumFractionDigits")})+" m":""}setFeature(e){e&&e.feature&&(e=e.feature),this._feature=e,this._listener&&this._listener.forEach(function(e){ol.Observable.unByKey(e)}),this._listener=[],this.set("measure",""),e&&this._listener.push(e.getGeometry().on("change",function(e){var t,i=e.target;i.getArea?t=this.formatArea(ol.sphere.getArea(i,{projection:this.getMap().getView().getProjection()})):i.getLength&&(t=this.formatLength(ol.sphere.getLength(i,{projection:this.getMap().getView().getProjection()}))),this.set("measure",t)}.bind(this)))}},ol.coordinate.convexHull,function(){var e=function(e,t,i){return(e[0]-i[0])*(t[1]-i[1])-(e[1]-i[1])*(t[0]-i[0])<=0};ol.coordinate.convexHull=function(t){var i;t.sort(function(e,t){return e[0]==t[0]?e[1]-t[1]:e[0]-t[0]});var o=[];for(i=0;i=2&&e(o[o.length-2],o[o.length-1],t[i]);)o.pop();o.push(t[i])}var s=[];for(i=t.length-1;i>=0;i--){for(;s.length>=2&&e(s[s.length-2],s[s.length-1],t[i]);)s.pop();s.push(t[i])}return s.pop(),o.pop(),o.concat(s)};var t=function(e){var i,o,s=[];switch(e.getType()){case"Point":s.push(e.getCoordinates());break;case"LineString":case"LinearRing":case"MultiPoint":s=e.getCoordinates();break;case"MultiLineString":for(o=e.getLineStrings(),i=0;i1?".1":".4":n>2?l>1?".2":".3":l>2?n<2?".1":".2":l<1?n<2?".4":".3":".5"},ol.coordinate.fromDFCI=function(e,t){var i,o=1e5,s=e.charCodeAt(0)-65;s=(s<8?s:s-2)*o;var r=e.charCodeAt(1)-65;if(r=(r<8?r:r-2)*o+15e5,2===e.length)i=[s+o/2,r+o/2];else if(o/=5,s+=Number(e.charAt(2))/2*o,r+=Number(e.charAt(3))/2*o,4===e.length)i=[s+o/2,r+o/2];else{o/=10;var a=e.charCodeAt(4)-65;if(s+=(a<8?a:a-2)*o,r+=Number(e.charAt(5))*o,6===e.length)i=[s+o/2,r+o/2];else switch(e.charAt(7)){case"1":i=[s+o/4,r+3*o/4];break;case"2":i=[s+3*o/4,r+3*o/4];break;case"3":i=[s+3*o/4,r+o/4];break;case"4":i=[s+o/4,r+o/4];break;default:i=[s+o/2,r+o/2]}}return t&&(ol.proj.get("EPSG:27572")||(proj4.defs["EPSG:27572"]||proj4.defs("EPSG:27572","+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs"),ol.proj.proj4.register(proj4)),i=ol.proj.transform(i,"EPSG:27572",t)),i},ol.coordinate.validDFCI=function(e){if(e.length<2||e.length>8)return!1;if(/[^A-H|^K-N]/.test(e.substr(0,1)))return!1;if(/[^B-H|^K-N]/.test(e.substr(1,1)))return!1;if(e.length>2){if(e.length<4)return!1;if(/[^0,^2,^4,^6,^8]/.test(e.substr(2,1)))return!1;if(/[^0,^2,^4,^6,^8]/.test(e.substr(3,1)))return!1}if(e.length>4){if(e.length<6)return!1;if(/[^A-H|^K-L]/.test(e.substr(4,1)))return!1;if(/[^0-9]/.test(e.substr(5,1)))return!1}if(e.length>6){if(e.length<8)return!1;if("."!==e.substr(6,1))return!1;if(/[^1-5]/.test(e.substr(7,1)))return!1}return!0},ol.coordinate.validDFCICoord=function(e,t){return t&&(ol.proj.get("EPSG:27572")||(proj4.defs["EPSG:27572"]||proj4.defs("EPSG:27572","+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs"),ol.proj.proj4.register(proj4)),e=ol.proj.transform(e,t,"EPSG:27572")),!(0>e[0]||e[0]>12e5)&&!(16e5>e[1]||e[1]>27e5)},ol.graph={},ol.graph.Dijkstra=class extends ol.Object{constructor(e){e=e||{},super(),this.source=e.source,this.nodes=new ol.source.Vector,this.maxIteration=e.maxIteration||2e4,this.stepIteration=e.stepIteration||2e3,this.astar=!0,this.candidat=[],this.set("epsilon",e.epsilon||1e-6)}weight(){return 1}direction(){return 2}getLength(e){return e.getGeometry&&(e=e.getGeometry()),e.getLength()}getNodeSource(){return this.nodes}getEdges(e){var t=ol.extent.buffer(ol.extent.boundingExtent([e]),this.get("epsilon")),i=[];return this.source.forEachFeatureIntersectingExtent(t,function(e){i.push(e)}),i}getNode(e){var t=ol.extent.buffer(ol.extent.boundingExtent([e]),this.get("epsilon")),i=[];return this.nodes.forEachFeatureIntersectingExtent(t,function(e){i.push(e)}),i[0]}addNode(e,t,i,o,s){if(this.wdist&&t>this.wdist)return!1;var r=this.getNode(e),a=t+this.getLength(new ol.geom.LineString([this.end,e]))*this.weight();if(this.astar&&this.wdist&&a>this.wdist)return!1;if(r){if(r!==this.arrival&&r.get("wdist")<=t)return r;r.set("dist",i),r.set("wdist",t),r.set("dtotal",a),r.set("from",o),r.set("prev",s),r===this.arrival&&(this.wdist=t),this.candidat.push(r)}else r=new ol.Feature({geometry:new ol.geom.Point(e),from:o,prev:s,dist:i||0,wdist:t,dtotal:a}),t<0?r.set("wdist",!1):this.candidat.push(r),this.nodes.addFeature(r);return r}closestCoordinate(e){var t=this.source.getClosestFeatureToCoordinate(e),i=t.getGeometry().getFirstCoordinate(),o=t.getGeometry().getLastCoordinate();return ol.coordinate.dist2d(e,i)i&&(e=t,i=t.get("wdist"));return this.getRoute(e)}_resume(){if(this.running){for(;this.candidat.length;){this.candidat.sort(function(e,t){return e.get("dtotal")this.maxIteration)return this.running=!1,void this.dispatchEvent({type:"pause",overflow:-1!==this.nb});if(!(this.nb%this.stepIteration)){var c=this;return window.setTimeout(function(){c._resume()},5),void this.dispatchEvent({type:"calculating"})}}}this.nodes.clear(),this.running=!1,this.dispatchEvent({type:"finish",route:this.getRoute(this.arrival),wDistance:this.wdist,distance:this.arrival.get("dist")})}}getRoute(e){for(var t=[];e;)t.unshift(e.get("from")),e=e.get("prev");return t.shift(),t}},ol.graph.Dijskra=ol.graph.Dijkstra,ol.geom.GPAltiCode=function(e,t){t=t||{};var i=e.getType();if("Point"===i||"LineString"===i){var o=t.projection||"EPSG:3857",s=t.sampling||0;if(t.samplingDist){var r=e.getLength();s=Math.max(s,Math.round(r/t.samplingDist))}s>5e3&&(s=5e3),s<2&&(s=0),e=e.clone().transform(o,"EPSG:4326");var a,n=[],l=[];switch(i){case"Point":a=[e.getCoordinates()];break;case"LineString":a=e.getCoordinates();break;default:return}s<=a.length&&(s=0),a.forEach(function(e){n.push(Math.round(1e6*e[0])/1e6),l.push(Math.round(1e6*e[1])/1e6)});var h="lon="+n.join("|")+"&lat="+l.join("|");s&&(h+="&sampling="+s),ol.ext.Ajax.get({url:"https://wxs.ign.fr/"+(t.apiKey||"essentiels")+"/alti/rest/"+(n.length>1?"elevationLine":"elevation")+".json?"+h,success:function(e){var r=[];e.elevations.forEach(function(e,t){s?r.push([e.lon,e.lat,e.z]):r.push([a[t][0],a[t][1],e.z])}),"Point"===i&&(r=r[0]);var n=ol.geom.createFromType(i,r);n.transform("EPSG:4326",o),"function"==typeof t.success&&t.success(n)},error:function(e){"function"==typeof t.error&&t.error(e)}})}else console.warn("[GPAltiCode] "+i+" not supported...")},ol.coordinate.GPAltiCode=function(e,t){t=t||{};var i=!e[0].length?new ol.geom.Point(e):new ol.geom.LineString(e);ol.geom.GPAltiCode(i,{projection:t.projection,apiKey:t.apiKey,sampling:t.sampling,samplingDist:t.samplingDist,success:function(e){"function"==typeof t.success&&t.success(e.getCoordinates())},error:t.error})},ol.coordinate.dist2d=function(e,t){var i=e[0]-t[0],o=e[1]-t[1];return Math.sqrt(i*i+o*o)},ol.coordinate.equal=function(e,t){return e[0]==t[0]&&e[1]==t[1]},ol.coordinate.getFeatureCenter=function(e){return ol.coordinate.getGeomCenter(e.getGeometry())},ol.coordinate.getGeomCenter=function(e){switch(e.getType()){case"Point":return e.getCoordinates();case"MultiPolygon":e=e.getPolygon(0);case"Polygon":return e.getInteriorPoint().getCoordinates();default:return e.getClosestPoint(ol.extent.getCenter(e.getExtent()))}},ol.coordinate.offsetCoords=function(e,t){var i,o,s,r,a,n,l,h,c,u,d,g,p,m=[],f=e.length-1,v=f,y=ol.coordinate.equal(e[0],e[f]);y||(d=e[0],g=e[1],p=[d[0]+(g[1]-d[1])/ol.coordinate.dist2d(d,g)*t,d[1]-(g[0]-d[0])/ol.coordinate.dist2d(d,g)*t],m.push(p),e.push(e[f]),f++,v--);for(var _=0;_1e-10&&(s=Math.sqrt((g[0]-d[0])*(g[0]-d[0])+(g[1]-d[1])*(g[1]-d[1])),r=Math.sqrt((p[0]-g[0])*(p[0]-g[0])+(p[1]-g[1])*(p[1]-g[1])),a=d[0]+t*(g[1]-d[1])/s,c=(o*(n=g[0]+t*(p[1]-g[1])/r)-i*a+(l=d[1]-t*(g[0]-d[0])/s)-(h=g[1]-t*(p[0]-g[0])/r))/(o-i),u=(i*o*(n-a)+o*l-i*h)/(o-i),g[0]-d[0]==0&&(u=o*(c=g[0]+t*(g[1]-d[1])/Math.abs(g[1]-d[1]))-o*n+h),p[0]-g[0]==0&&(u=i*(c=p[0]+t*(p[1]-g[1])/Math.abs(p[1]-g[1]))-i*a+l),m.push([c,u]));return y?m.push(m[0]):(e.pop(),d=e[e.length-1],g=e[e.length-2],p=[d[0]-(g[1]-d[1])/ol.coordinate.dist2d(d,g)*t,d[1]+(g[0]-d[0])/ol.coordinate.dist2d(d,g)*t],m.push(p)),m},ol.coordinate.findSegment=function(e,t){for(var i=0;it||e[a][1]>=t&&e[a+1][1]0;o--)(e[o][0]>t&&e[o-1][0]t)&&(i=[t,(t-e[o][0])/(e[o-1][0]-e[o][0])*(e[o-1][1]-e[o][1])+e[o][1]],e.splice(o,0,i))}function t(e,t){for(var i,o=e.length-1;o>0;o--)(e[o][1]>t&&e[o-1][1]t)&&(i=[(t-e[o][1])/(e[o-1][1]-e[o][1])*(e[o-1][0]-e[o][0])+e[o][0],t],e.splice(o,0,i))}ol.extent.intersection=function(i,o){var s="Polygon"===o.getType();if(!s&&"MultiPolygon"!==o.getType())return null;var r=o.getCoordinates();return s&&(r=[r]),r.forEach(function(o){o.forEach(function(o){e(o,i[0]),e(o,i[2]),t(o,i[1]),t(o,i[3])})}),r.forEach(function(e){e.forEach(function(e){e.forEach(function(e){e[0]i[2]&&(e[0]=i[2]),e[1]i[3]&&(e[1]=i[3])})})}),s?new ol.geom.Polygon(r[0]):new ol.geom.MultiPolygon(r)}}(),ol.coordinate.sampleAt=function(e,t,i,o){var s=[];!1!==o&&s.push(e);var r=ol.coordinate.dist2d(e,t);if(r){var a=Math.round(r/i);if(a>1)for(var n=(t[0]-e[0])/a,l=(t[1]-e[1])/a,h=1;hs?(a=!0,i.push([o[0]+s/t*(e[0]-o[0]),o[1]+s/t*(e[1]-o[1])])):i.push(e)})})}),a?"Polygon"===e.getType()?new ol.geom.Polygon(n[0]):new ol.geom.MultiPolygon(n):e}}else console.warn("[ol/geom/Circle~intersection] Unsupported geometry type: "+e.getType());return e},ol.geom.LineString.prototype.splitAt=function(e,t){var i;if(!e)return[this];if(t||(t=1e-10),e.length&&e[0].length){var o=[this];for(i=0;i1&&h.push(new ol.geom.LineString(l)),h.length?h:[this]},ol.geom.MultiPolygon.prototype.scribbleFill=function(e){var t,i,o,s=[],r=this.getPolygons();for(t=0;i=r[t];t++){var a=i.scribbleFill(e);a&&s.push(a)}if(!s.length)return null;var n,l=s[0];for(t=0;o=s[t];t++){n=o.getLineStrings();for(var h=0;hf);){if(c[i][0].pt[1]===f){var _=Math.min((c[i][0].index-o[0].index+d)%d,(o[0].index-c[i][0].index+d)%d),x=Math.min((o[1].index-o[0].index+d)%d,(o[0].index-o[1].index+d)%d);_=0;i--)s.unshift(t[i]);else for(i=t.length-2;i>=0;i--)s.push(t[i])})}e.geom=t,e.feature.getGeometry().setCoordinates(t)}),e}simplifyVisvalingam(e){this._edges.forEach(function(t){var i=t.get("edge")[0].feature.getGeometry().getType();t.setGeometry(t.get("geom").simplifyVisvalingam({area:e.area,dist:e.dist,ratio:e.ratio,minPoints:e.minPoints,keepEnds:!!/Polygon/.test(i)||e.keepEnds}))})}simplify(e){this._edges.forEach(function(t){t.setGeometry(t.get("geom").simplify(e))})}_calcEdges(e,t){var i,o,s={};e.forEach(function(e){if(!/Point/.test(e.getGeometry().getType())){var r=this._getArcs(e.getGeometry().getCoordinates(),[],"0",t);i="",r.forEach(function(t,r){!function(e,t,r){var a=t.seg[0]+"-"+t.seg[1],n=s[a];if(n||(a=t.seg[1]+"-"+t.seg[0],n=s[a]),n)n.edge.push({feature:e,contour:t.contour,index:r}),i="";else{var l={geometry:t.seg,edge:[{feature:e,contour:t.contour,index:r}],prev:i===t.contour&&o};i=t.contour,o=l,s[a]=l}}(e,t,r)})}}.bind(this));var r=[];for(var a in s)r.push(s[a]);return r}_getArcs(e,t,i,o){return e[0][0][0].length?e.forEach(function(e,s){this._getArcs(e,t,i+"-"+s,o)}.bind(this)):e.forEach(function(e,o){for(var s,r=e[0],a=i+"-"+o,n=1;n12)&&(t=12);for(var n=0,l=0,h=!0,c="",u=-90,d=90,g=-180,p=180;c.length=m?(n=2*n+1,g=m):(n*=2,p=m)}else{var f=(u+d)/2;o>=f?(n=2*n+1,u=f):(n*=2,d=f)}h=!h,5==++l&&(c+=ol.geohash.base32.charAt(n),l=0,n=0)}return c},ol.geohash.toLonLat=function(e){var t=ol.geohash.getExtent(e),i=t[1],o=t[0],s=t[3],r=t[2],a=(i+s)/2,n=(o+r)/2;return a=a.toFixed(Math.floor(2-Math.log(s-i)/Math.LN10)),n=n.toFixed(Math.floor(2-Math.log(r-o)/Math.LN10)),[Number(n),Number(a)]},ol.geohash.getExtent=function(e){if(!e)return!1;e=e.toLowerCase();for(var t=!0,i=-90,o=90,s=-180,r=180,a=0;a=0;h--){var c=l>>h&1;if(t){var u=(s+r)/2;1==c?s=u:r=u}else{var d=(i+o)/2;1==c?i=d:o=d}t=!t}}return[s,i,r,o]},ol.geohash.getAdjacent=function(e,t){if(e=e.toLowerCase(),t=t.toLowerCase(),!e)return!1;if(-1=="nsew".indexOf(t))return!1;var i=e.slice(-1),o=e.slice(0,-1),s=e.length%2;return-1!={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]}[t][s].indexOf(i)&&""!=o&&(o=ol.geohash.getAdjacent(o,t)),o+ol.geohash.base32.charAt({n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]}[t][s].indexOf(i))},ol.geohash.getNeighbours=function(e){return{n:ol.geohash.getAdjacent(e,"n"),ne:ol.geohash.getAdjacent(ol.geohash.getAdjacent(e,"n"),"e"),e:ol.geohash.getAdjacent(e,"e"),se:ol.geohash.getAdjacent(ol.geohash.getAdjacent(e,"s"),"e"),s:ol.geohash.getAdjacent(e,"s"),sw:ol.geohash.getAdjacent(ol.geohash.getAdjacent(e,"s"),"w"),w:ol.geohash.getAdjacent(e,"w"),nw:ol.geohash.getAdjacent(ol.geohash.getAdjacent(e,"n"),"w")}},ol.sphere.greatCircleBearing=function(e,t){var i=Math.PI/180,o=[e[0]*i,e[1]*i],s=[t[0]*i,t[1]*i];return Math.atan2(Math.sin(s[0]-o[0])*Math.cos(s[1]),Math.cos(o[1])*Math.sin(s[1])-Math.sin(o[1])*Math.cos(s[1])*Math.cos(s[0]-o[0]))},ol.sphere.computeDestinationPoint=function(e,t,i,o){o=o||{};var s=Math.PI/180,r=o.radius||6371008.8,a=e[1]*s,n=e[0]*s,l=t/r,h=Math.asin(Math.sin(a)*Math.cos(l)+Math.cos(a)*Math.sin(l)*Math.cos(i)),c=(n+Math.atan2(Math.sin(i)*Math.sin(l)*Math.cos(a),Math.cos(l)-Math.sin(a)*Math.sin(h)))/s;return!1!==o.normalize&&(c<-180||c>180)&&(c=540*c%360-180),[c,h/s]},ol.sphere.greatCircleTrack=function(e,t,i){i=i||{};for(var o=ol.sphere.greatCircleBearing(e,t),s=ol.sphere.getDistance(e,t,i.radius),r=i.distance||1e3,a=r,n=[e];a1&&(l[0]>t[0]?t[0]+=360:t[0]-=360),n.push(t),n},ol.sphere.getMapScale=function(e,t){var i=e.getView(),o=i.getProjection(),s=i.getCenter(),r=e.getPixelFromCoordinate(s);r[1]+=1;var a=e.getCoordinateFromPixel(r),n=ol.sphere.getDistance(ol.proj.transform(s,o,"EPSG:4326"),ol.proj.transform(a,o,"EPSG:4326"));return n*=(t||96)/.0254},ol.sphere.setMapScale=function(e,t,i){if(e&&t){var o=t;if("string"==typeof t&&((o=(t=t.replace(":","/").split("/"))[1])||(o=t[0]||""),o=o.replace(/[^\d]/g,""),o=parseInt(o),t[1])){var s=parseInt(t[0]);s&&(o/=s)}if(!o)return;var r=e.getView(),a=r.getProjection(),n=r.getCenter(),l=e.getPixelFromCoordinate(n);l[1]+=1;var h=e.getCoordinateFromPixel(l),c=ol.sphere.getDistance(ol.proj.transform(n,a,"EPSG:4326"),ol.proj.transform(h,a,"EPSG:4326"));return c*=(i||96)/.0254,r.setResolution(r.getResolution()*o/c),o}},function(){function e(e,t){return e[1][2]-t[1][2]}function t(e){return Math.abs((e[0][0]-e[2][0])*(e[1][1]-e[0][1])-(e[0][0]-e[1][0])*(e[2][1]-e[0][1]))}ol.geom.LineString.prototype.simplifyVisvalingam=function(i){var o=this.getCoordinates();if(i.minPoints&&i.minPoints>=o.length)return new ol.geom.LineString(o);for(var s,r=function(){var t={},i=[];function o(t){for(var o=i[t];t>0;){var s=(t+1>>1)-1,r=i[s];if(e(o,r)>=0)break;i[r.index=t]=r,i[o.index=t=s]=o}}function s(t){for(var o=i[t];;){var s=2*(t+1),r=s-1,a=t,n=i[a];if(ru});return i.keepEnds&&(ol.coordinate.equal(m[0],o[0])||m.unshift(o[0]),ol.coordinate.equal(m[m.length-1],o[o.length-1])||m.push(o[o.length-1])),new ol.geom.LineString(m)}}(),ol.Map.prototype.animExtent=function(e,t){var i;(t=t||{}).projection&&(e=ol.proj.transformExtent(e,t.projection,this.getView().getProjection()));var o=(new Date).getTime(),s=t.duration||1e3,r=t.easing||ol.easing.upAndDown,a=t.style&&t.style.getWidth()||2,n=t.style&&t.style.getColr()||"red";i=this.on("postcompose",function(t){var l=t.frameState,h=l.pixelRatio,c=l.time-o;if(c>s)ol.Observable.unByKey(i);else{var u=c/s,d=this.getPixelFromCoordinate([e[0],e[1]]),g=this.getPixelFromCoordinate([e[2],e[3]]),p=t.context;p.save(),p.scale(h,h),p.beginPath(),p.globalAlpha=r(1-u),p.lineWidth=a,p.strokeStyle=n,p.rect(d[0],d[1],g[0]-d[0],g[1]-d[1]),p.stroke(),p.restore(),l.animate=!0}}.bind(this));try{this.renderSync()}catch(e){}},ol.geom.Geometry.prototype.cspline=function(e){return this.calcCSpline_?(this.csplineGeometryRevision==this.getRevision()&&this.csplineOption==JSON.stringify(e)||(this.csplineGeometry_=this.calcCSpline_(e),this.csplineGeometryRevision=this.getRevision(),this.csplineOption=JSON.stringify(e)),this.csplineGeometry_):this},ol.geom.GeometryCollection.prototype.calcCSpline_=function(e){for(var t=[],i=this.getGeometries(),o=0;o2&&e[0][0]==e[e.length-1][0]&&e[0][1]==e[e.length-1][1]?(r.unshift(e[e.length-2]),r.push(e[1])):(r.unshift(e[0]),r.push(e[e.length-1])),y=1;yr&&s>a?t=-i-o:r>a?i=-t-o:o=-t-i,[t,i,o]}hex_round(e){return this.cube2hex(this.cube_round(this.hex2cube(e)))}hex_corner(e,t,i){return[e[0]+t*this.layout_[8+i%6*2],e[1]+t*this.layout_[9+i%6*2]]}getHexagonAtCoord(e){return this.getHexagon(this.coord2hex(e))}getHexagon(e){for(var t=[],i=this.hex2coord(e),o=0;o<=7;o++)t.push(this.hex_corner(i,this.size_,o,this.layout_[8]));return t}hex2coord(e){return[this.origin_[0]+this.size_*(this.layout_[0]*e[0]+this.layout_[1]*e[1]),this.origin_[1]+this.size_*(this.layout_[2]*e[0]+this.layout_[3]*e[1])]}coord2hex(e){var t=[(e[0]-this.origin_[0])/this.size_,(e[1]-this.origin_[1])/this.size_],i=this.layout_[4]*t[0]+this.layout_[5]*t[1],o=this.layout_[6]*t[0]+this.layout_[7]*t[1];return this.hex_round([i,o])}cube_distance(e,t){return Math.max(Math.abs(e[0]-t[0]),Math.abs(e[1]-t[1]),Math.abs(e[2]-t[2]))}lerp(e,t,i){return e+(t-e)*i}cube_lerp(e,t,i){return[this.lerp(e[0]+1e-6,t[0],i),this.lerp(e[1]+1e-6,t[1],i),this.lerp(e[2]+1e-6,t[2],i)]}cube_line(e,t){var i=this.cube_distance(e,t);if(!i)return[e];for(var o=[],s=0;s<=i;s++)o.push(this.cube_round(this.cube_lerp(e,t,s/i)));return o}hex_neighbors(e,t){if(void 0!==t)return[e[0]+this.neighbors.hex[t%6][0],e[1]+this.neighbors.hex[t%6][1]];var i=[];for(t=0;t<6;t++)i.push([e[0]+this.neighbors.hex[t][0],e[1]+this.neighbors.hex[t][1]]);return i}cube_neighbors(e,t){if(void 0!==t)return[e[0]+this.neighbors.cube[t%6][0],e[1]+this.neighbors.cube[t%6][1],e[2]+this.neighbors.cube[t%6][2]];var i=[];for(t=0;t<6;t++)i.push([e[0]+this.neighbors.cube[t][0],e[1]+this.neighbors.cube[t][1],e[2]+this.neighbors.cube[t][2]]);for(t=0;t<6;t++)i[t]=this.cube2hex(i[t]);return i}},ol.HexGrid.prototype.layout={pointy:[Math.sqrt(3),Math.sqrt(3)/2,0,1.5,Math.sqrt(3)/3,-1/3,0,2/3,Math.cos(Math.PI/180*30),Math.sin(Math.PI/180*30),Math.cos(Math.PI/180*90),Math.sin(Math.PI/180*90),Math.cos(Math.PI/180*150),Math.sin(Math.PI/180*150),Math.cos(Math.PI/180*210),Math.sin(Math.PI/180*210),Math.cos(Math.PI/180*270),Math.sin(Math.PI/180*270),Math.cos(Math.PI/180*330),Math.sin(Math.PI/180*330)],flat:[1.5,0,Math.sqrt(3)/2,Math.sqrt(3),2/3,0,-1/3,Math.sqrt(3)/3,Math.cos(Math.PI/180*0),Math.sin(Math.PI/180*0),Math.cos(Math.PI/180*60),Math.sin(Math.PI/180*60),Math.cos(Math.PI/180*120),Math.sin(Math.PI/180*120),Math.cos(Math.PI/180*180),Math.sin(Math.PI/180*180),Math.cos(Math.PI/180*240),Math.sin(Math.PI/180*240),Math.cos(Math.PI/180*300),Math.sin(Math.PI/180*300)]},ol.HexGrid.prototype.neighbors={cube:[[1,-1,0],[1,0,-1],[0,1,-1],[-1,1,0],[-1,0,1],[0,-1,1]],hex:[[1,0],[1,-1],[0,-1],[-1,0],[-1,1],[0,1]]},ol.InseeGrid=class extends ol.Object{constructor(e){e=e||{},proj4.defs["EPSG:3035"]||(proj4.defs("EPSG:3035","+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs"),ol.proj.proj4.register(proj4)),super(e);var t=Math.max(200,200*Math.round((e.size||0)/200));this.set("size",t)}getExtent(e){return ol.proj.transformExtent(ol.InseeGrid.extent,e||"EPSG:3035","EPSG:3857")}getGridAtCoordinate(e,t){var i=ol.proj.transform(e,t||"EPSG:3857","EPSG:3035"),o=this.get("size"),s=Math.floor(i[0]/o)*o,r=Math.floor(i[1]/o)*o,a=new ol.geom.Polygon([[[s,r],[s+o,r],[s+o,r+o],[s,r+o],[s,r]]]);return a.transform("EPSG:3035",t||"EPSG:3857"),a}},ol.InseeGrid.extent=[32e5,2e6,43e5,314e4],ol.Map.prototype.markup=function(e,t){var i,o=this;(t=t||{}).projection&&(e=ol.proj.transform(e,t.projection,this.getView().getProjection()));var s=(new Date).getTime(),r=t.delay||3e3,a=1e3,n=t.maxZoom||100,l=ol.easing.easeOut,h=t.style;h||(h=new ol.style.Circle({radius:10,stroke:new ol.style.Stroke({color:"red",width:2})})),h instanceof ol.style.Image&&(h=new ol.style.Style({image:h})),h instanceof Array||(h=[h]),setTimeout(function(){if(i)try{o.renderSync()}catch(e){}},r),i=this.on("postcompose",function(t){var o=t.frameState,c=o.time-s;if(c>r+a)ol.Observable.unByKey(i),i=null;else{r>c&&this.getView().getZoom()>n&&(r=c);var u=o.pixelRatio,d=0;c>r&&(d=(c-r)/a);var g=t.context;g.save(),g.beginPath(),g.globalAlpha=l(1-d);for(var p=0;p=r&&(o.animate=!0)}}.bind(this));try{this.renderSync()}catch(e){}return i.stop=function(){r=a=0;try{this.target.renderSync()}catch(e){}},i},ol.ordering={},ol.ordering.yOrdering=function(){return function(e,t){return t.getGeometry().getExtent()[1]-e.getGeometry().getExtent()[1]}},ol.ordering.zIndex=function(e){e||(e={});var t=e.attribute||"zIndex";return e.equalFn?function(i,o){return i.get(t)==o.get(t)?e.equalFn(i,o):i.get(t)s)ol.Observable.unByKey(i);else{var u=c/s,d=t.context;d.save(),d.beginPath();var g=r(u);d.globalAlpha=r(1-u);for(var p=0;p0?Number(e.scale):1)*ol.has.DEVICE_PIXEL_RATIO||ol.has.DEVICE_PIXEL_RATIO,s=i.getContext("2d");if(e.image){var r;e.image.load();var a=e.image.getImage();if(a.width)i.width=Math.round(a.width*o),i.height=Math.round(a.height*o),s.globalAlpha="number"==typeof e.opacity?e.opacity:1,s.drawImage(a,0,0,a.width,a.height,0,0,i.width,i.height),t=s.createPattern(i,"repeat");else{var n=this;t=[0,0,0,0],a.onload=function(){i.width=Math.round(a.width*o),i.height=Math.round(a.height*o),s.globalAlpha="number"==typeof e.opacity?e.opacity:1,s.drawImage(a,0,0,a.width,a.height,0,0,i.width,i.height),t=s.createPattern(i,"repeat"),n.setColor(t)}}}else{var l=this.getPattern_(e);if(i.width=Math.round(l.width*o),i.height=Math.round(l.height*o),s.beginPath(),e.fill&&(s.fillStyle=ol.color.asString(e.fill.getColor()),s.fillRect(0,0,i.width,i.height)),s.scale(o,o),s.lineCap="round",s.lineWidth=l.stroke||1,s.fillStyle=ol.color.asString(e.color||"#000"),s.strokeStyle=ol.color.asString(e.color||"#000"),l.circles)for(r=0;r180&&(s-=360),s*=Math.PI/180;var r=Math.cos(s),a=Math.sin(s);if(Math.abs(a)<1e-4)i.width=i.height=o,i.lines=[[0,.5,o,.5]],i.repeat=[[0,0],[0,o]];else if(Math.abs(r)<1e-4)i.width=i.height=o,i.lines=[[.5,0,.5,o]],i.repeat=[[0,0],[o,0]],"cross"==e.pattern&&(i.lines.push([0,.5,o,.5]),i.repeat.push([0,o]));else{var n=i.width=Math.round(Math.abs(o/a))||1,l=i.height=Math.round(Math.abs(o/r))||1;"cross"==e.pattern?(i.lines=[[-n,-l,2*n,2*l],[2*n,-l,-n,2*l]],i.repeat=[[0,0]]):r*a>0?(i.lines=[[-n,-l,2*n,2*l]],i.repeat=[[0,0],[n,0],[0,l]]):(i.lines=[[2*n,-l,-n,2*l]],i.repeat=[[0,0],[-n,0],[0,l]])}i.stroke=0===e.size?0:e.size||4}return i}},ol.style.FillPattern.patterns={hatch:{width:5,height:5,lines:[[0,2.5,5,2.5]],stroke:1},cross:{width:7,height:7,lines:[[0,3,10,3],[3,0,3,10]],stroke:1},dot:{width:8,height:8,circles:[[5,5,2]],stroke:!1,fill:!0},circle:{width:10,height:10,circles:[[5,5,2]],stroke:1,fill:!1},square:{width:10,height:10,lines:[[3,3,3,8,8,8,8,3,3,3]],stroke:1,fill:!1},tile:{width:10,height:10,lines:[[3,3,3,8,8,8,8,3,3,3]],fill:!0},woven:{width:12,height:12,lines:[[3,3,9,9],[0,12,3,9],[9,3,12,0],[-1,1,1,-1],[13,11,11,13]],stroke:1},crosses:{width:8,height:8,lines:[[2,2,6,6],[2,6,6,2]],stroke:1},caps:{width:8,height:8,lines:[[2,6,4,2,6,6]],stroke:1},nylon:{width:20,height:20,lines:[[1,6,1,1,6,1],[6,11,11,11,11,6],[11,16,11,21,16,21],[16,11,21,11,21,16]],repeat:[[0,0],[-20,0],[0,-20]],stroke:1},hexagon:{width:20,height:12,lines:[[0,10,4,4,10,4,14,10,10,16,4,16,0,10]],stroke:1,repeat:[[0,0],[10,6],[10,-6],[-10,-6]]},cemetry:{width:15,height:19,lines:[[0,3.5,7,3.5],[3.5,0,3.5,10]],stroke:1,repeat:[[0,0],[7,9]]},sand:{width:20,height:20,circles:[[1,2,1],[9,3,1],[2,16,1],[7,8,1],[6,14,1],[4,19,1],[14,2,1],[12,10,1],[14,18,1],[18,8,1],[18,14,1]],fill:1},conglomerate:{width:60,height:40,circles:[[2,4,1],[17,3,1],[26,18,1],[12,17,1],[5,17,2],[28,11,2]],lines:[[7,5,6,7,9,9,11,8,11,6,9,5,7,5],[16,10,15,13,16,14,19,15,21,13,22,9,20,8,19,8,16,10],[24,6,26,7,27,5,26,4,24,4,24,6]],repeat:[[30,0],[-15,20],[15,20],[45,20]],stroke:1},conglomerate2:{width:60,height:40,circles:[[2,4,1],[17,3,1],[26,18,1],[12,17,1],[5,17,2],[28,11,2]],lines:[[7,5,6,7,9,9,11,8,11,6,9,5,7,5],[16,10,15,13,16,14,19,15,21,13,22,9,20,8,19,8,16,10],[24,6,26,7,27,5,26,4,24,4,24,6]],repeat:[[30,0],[-15,20],[15,20],[45,20]],fill:1},gravel:{width:15,height:10,circles:[[4,2,1],[5,9,1],[1,7,1]],lines:[[7,5,6,6,7,7,8,7,9,7,10,5,9,4,7,5],[11,2,14,4,14,1,12,1,11,2]],stroke:1},brick:{width:18,height:16,lines:[[0,1,18,1],[0,10,18,10],[6,1,6,10],[12,10,12,18],[12,0,12,1]],stroke:1},dolomite:{width:20,height:16,lines:[[0,1,20,1],[0,9,20,9],[1,9,6,1],[11,9,14,16],[14,0,14.4,1]],stroke:1},coal:{width:20,height:16,lines:[[1,5,7,1,7,7],[11,10,12,5,18,9],[5,10,2,15,9,15],[15,16,15,13,20,16],[15,0,15,2,20,0]],fill:1},breccia:{width:20,height:16,lines:[[1,5,7,1,7,7,1,5],[11,10,12,5,18,9,11,10],[5,10,2,15,9,15,5,10],[15,16,15,13,22,18],[15,0,15,2,20,0]],stroke:1},clay:{width:20,height:20,lines:[[0,0,3,11,0,20],[11,0,10,3,13,13,11,20],[0,0,10,3,20,0],[0,12,3,11,13,13,20,12]],stroke:1},flooded:{width:15,height:10,lines:[[0,1,10,1],[0,6,5,6],[10,6,15,6]],stroke:1},chaos:{width:40,height:40,lines:[[40,2,40,0,38,0,40,2],[4,0,3,2,2,5,0,0,0,3,2,7,5,6,7,7,8,10,9,12,9,13,9,14,8,14,6,15,2,15,0,20,0,22,2,20,5,19,8,15,10,14,11,12.25,10,12,10,10,12,9,13,7,12,6,13,4,16,7,17,4,20,0,18,0,15,3,14,2,14,0,12,1,11,0,10,1,11,4,10,7,9,8,8,5,6,4,5,3,5,1,5,0,4,0],[7,1,7,3,8,3,8,2,7,1],[4,3,5,5,4,5,4,3],[34,5,33,7,38,10,38,8,36,5,34,5],[27,0,23,2,21,8,30,0,27,0],[25,8,26,12,26,16,22.71875,15.375,20,13,18,15,17,18,13,22,17,21,19,22,21,20,19,18,22,17,30,25,26,26,24,28,21.75,33.34375,20,36,18,40,20,40,24,37,25,32,27,31,26,38,27,37,30,32,32,35,36,37,38,40,38,39,40,40,37,36,34,32,37,31,36,29,33,27,34,24,39,21,40,21,40,16,37,20,31,22,32,25,27,20,29,15,30,20,32,20,34,18,33,12,31,11,29,14,26,9,25,8],[39,24,37,26,40,28,39,24],[13,15,9,19,14,18,13,15],[18,23,14,27,16,27,17,25,20,26,18,23],[6,24,2,26,1,28,2,30,5,28,12,30,16,32,18,30,15,30,12,28,9,25,7,27,6,24],[29,27,32,28,33,31,30,29,27,28,29,27],[5,35,1,33,3,36,13,38,15,35,10,36,5,35]],fill:1},grass:{width:27,height:22,lines:[[0,10.5,13,10.5],[2.5,10,1.5,7],[4.5,10,4.5,5,3.5,4],[7,10,7.5,6,8.5,3],[10,10,11,6]],repeat:[[0,0],[14,10]],stroke:1},swamp:{width:24,height:23,lines:[[0,10.5,9.5,10.5],[2.5,10,2.5,7],[4.5,10,4.5,4],[6.5,10,6.5,6],[3,12.5,7,12.5]],repeat:[[0,0],[14,10]],stroke:1},reed:{width:26,height:23,lines:[[2.5,10,2,7],[4.5,10,4.2,4],[6.5,10,6.8,4],[8.5,10,9,6],[3.7,4,3.7,2.5],[4.7,4,4.7,2.5],[6.3,4,6.3,2.5],[7.3,4,7.3,2.5]],circles:[[4.2,2.5,.5],[18.2,12.5,.5],[6.8,2.5,.5],[20.8,12.5,.5],[9,6,.5],[23,16,.5]],repeat:[[0,0],[14,10]],stroke:1},wave:{width:10,height:8,lines:[[0,0,5,4,10,0]],stroke:1},vine:{width:13,height:13,lines:[[3,0,3,6],[9,7,9,13]],stroke:1},forest:{width:55,height:30,circles:[[7,7,3.5],[20,20,1.5],[42,22,3.5],[35,5,1.5]],stroke:1},forest2:{width:55,height:30,circles:[[7,7,3.5],[20,20,1.5],[42,22,3.5],[35,5,1.5]],fill:1,stroke:1},scrub:{width:26,height:20,lines:[[1,4,4,8,6,4]],circles:[[20,13,1.5]],stroke:1},tree:{width:30,height:30,lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,.71,6.36,0,4.24,.71,2.12,4.24,0,7.78,.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78]],repeat:[[3,1],[18,16]],stroke:1},tree2:{width:30,height:30,lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,.71,6.36,0,4.24,.71,2.12,4.24,0,7.78,.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78,4.95,10.61,7.78,10.61]],repeat:[[3,1],[18,16]],fill:1,stroke:1},pine:{width:30,height:30,lines:[[5.66,11.31,2.83,11.31,2.83,8.49,0,8.49,2.83,0,5.66,8.49,2.83,8.49]],repeat:[[3,1],[18,16]],stroke:1},pine2:{width:30,height:30,lines:[[5.66,11.31,2.83,11.31,2.83,8.49,0,8.49,2.83,0,5.66,8.49,2.83,8.49,2.83,11.31,5.66,11.31]],repeat:[[3,1],[18,16]],fill:1,stroke:1},mixtree:{width:30,height:30,lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,.71,6.36,0,4.24,.71,2.12,4.24,0,7.78,.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78,4.95,10.61,7.78,10.61],[23.66,27.31,20.83,27.31,20.83,24.49,18,24.49,20.83,16,23.66,24.49,20.83,24.49,20.83,27.31,23.66,27.31]],repeat:[[3,1]],stroke:1},mixtree2:{width:30,height:30,lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,.71,6.36,0,4.24,.71,2.12,4.24,0,7.78,.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78,4.95,10.61,7.78,10.61],[23.66,27.31,20.83,27.31,20.83,24.49,18,24.49,20.83,16,23.66,24.49,20.83,24.49,20.83,27.31,23.66,27.31]],repeat:[[3,1]],fill:1,stroke:1},pines:{width:22,height:20,lines:[[1,4,3.5,1,6,4],[1,8,3.5,5,6,8],[3.5,1,3.5,11],[12,14.5,14.5,14,17,14.5],[12,18,17,18],[14.5,12,14.5,18]],repeat:[[2,1]],stroke:1},rock:{width:20,height:20,lines:[[1,0,1,9],[4,0,4,9],[7,0,7,9],[10,1,19,1],[10,4,19,4],[10,7,19,7],[0,11,9,11],[0,14,9,14],[0,17,9,17],[12,10,12,19],[15,10,15,19],[18,10,18,19]],repeat:[[.5,.5]],stroke:1},rocks:{width:20,height:20,lines:[[5,0,3,0,5,4,4,6,0,3,0,5,3,6,5,9,3.75,10,2.5,10,0,9,0,10,4,11,5,14,4,15,0,13,0,13,0,13,0,14,0,14,5,16,5,18,3,19,0,19,-.25,19.9375,5,20,10,19,10,20,11,20,12,19,14,20,15,20,17,19,20,20,20,19,19,16,20,15,20,11,20,10,19,8,20,5,20,0,19,0,20,2,19,4,17,4,16,3,15,0,14,0,15,4,11,5,10,4,11,0,10,0,9,4,6,5,5,0],[18,5,19,6,18,10,16,10,14,9,16,5,18,5],[5,6,9,5,10,6,10,9,6,10,5,6],[14,5,14,8,13,9,12,9,11,7,12,5,14,5],[5,11,8,10,9,11,10,14,6,15,6,15,5,11],[13,10,14,11,15,14,15,14,15,14,11,15,10,11,11,10,13,10],[15,12,16,11,19,11,19,15,16,14,16,14,15,12],[6,16,9,15,10,18,5,19,6,16],[10,16,14,16,14,18,13,19,11,18,10,16],[15,15,18,16,18,18,16,19,15,18,15,15]],stroke:1}},ol.style.FlowLine=class extends ol.style.Style{constructor(e){super({stroke:(e=e||{}).stroke,text:e.text,zIndex:e.zIndex,geometry:e.geometry}),this.setRenderer(this._render.bind(this)),this._visible=!1!==e.visible,"function"==typeof e.width?this._widthFn=e.width:this.setWidth(e.width),this.setWidth2(e.width2),"function"==typeof e.color?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}}setLineCap(e){this._lineCap="round"===e?"round":"butt"}getWidth(e,t){if(this._widthFn)return this._widthFn(e,t);var i="number"==typeof this._width2?this._width2:this._width;return this._width+(i-this._width)*t}setColor(e){try{this._color=ol.color.asArray(e)}catch(e){this._color=[0,0,0,1]}}setColor2(e){try{this._color2=ol.color.asArray(e)}catch(e){this._color2=null}}setArrowColor(e){try{this._acolor=ol.color.asString(e)}catch(e){this._acolor=null}}getColor(e,t){if(this._colorFn)return ol.color.asString(this._colorFn(e,t));var i=this._color,o=this._color2||this._color;return"rgba("+ +Math.round(i[0]+(o[0]-i[0])*t)+","+Math.round(i[1]+(o[1]-i[1])*t)+","+Math.round(i[2]+(o[2]-i[2])*t)+","+(i[3]+(o[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:"number"==typeof e&&(this._arrowSize=[e,e])}drawArrow(e,t,i,o,s){var r=this.getArrowSize()[0]*s,a=ol.coordinate.dist2d(t,i),n=(t[0]-i[0])/a,l=(t[1]-i[1])/a;o=Math.max(this.getArrowSize()[1]/2,o/2)*s,e.beginPath(),e.moveTo(t[0],t[1]),e.lineTo(t[0]-r*n+o*l,t[1]-r*l-o*n),e.lineTo(t[0]-r*n-o*l,t[1]-r*l+o*n),e.lineTo(t[0],t[1]),e.fill()}_render(e,t){if("LineString"===t.geometry.getType()){var i,o,s,r=t.context;if(!this._visible){var a=t.pixelRatio/t.resolution,n=Math.cos(t.rotation),l=Math.sin(t.rotation);o=t.geometry.getCoordinates();var h=e[0][0]-o[0][0]*a*n-o[0][1]*a*l,c=e[0][1]-o[0][0]*a*l+o[0][1]*a*n;for(e=[],i=0;s=o[i];i++)e[i]=[h+s[0]*a*n+s[1]*a*l,c+s[0]*a*l-s[1]*a*n,s[2]]}var u=this.getArrowSize()[0]*t.pixelRatio;r.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&&(-1===this.getArrow()||2===this.getArrow())&&(s=this._splitAsize(e,u),this._acolor?r.fillStyle=this._acolor:r.fillStyle=this.getColor(t.feature,0),this.drawArrow(r,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?r.fillStyle=this._acolor:r.fillStyle=this.getColor(t.feature,1),this.drawArrow(r,s[0],s[1],this.getWidth(t.feature,1),t.pixelRatio));var d=this._splitInto(e,255,2),g=0,p=d.length;if(r.lineJoin="round",r.lineCap=this._lineCap||"butt",d.length>1)for(g=0;gt){o=[o[0]+(s[0]-o[0])*(t-n)/a,o[1]+(s[1]-o[1])*(t-n)/a],a=ol.coordinate.dist2d(o,r),i?(e.push(s),e.push(o),e.push([o[0]+(r[0]-o[0])/a,o[1]+(r[1]-o[1])/a])):(e.unshift(s),e.unshift(o),e.unshift([o[0]+(r[0]-o[0])/a,o[1]+(r[1]-o[1])/a]));break}n+=a,o=s}return[r,o]}_splitInto(e,t,i){var o,s,r,a=this._noOverlap?1:.9,n=[],l=0;for(o=1;s=e[o];o++)l+=ol.coordinate.dist2d(e[o-1],s);var h=Math.max(i||2,l/(t||255)),c=e[0];l=0;var u=[c];for(o=1,s=e[1];oh){var p=(h-l)/r;u.push([c[0]+d*p,c[1]+g*p]),n.push(u),u=[c=[c[0]+d*p*a,c[1]+g*p*a]],l=0}else l+=r,c=s,u.push(c),s=e[++o]}return n.push(u),n}},ol.style.FontSymbol=class extends ol.style.RegularShape{constructor(e){var t=0;(e=e||{}).stroke&&(t=e.stroke.getWidth()),e.displacement||(e.displacement=[e.offsetX||0,-e.offsetY||0]),super({radius:e.radius,fill:e.fill,rotation:e.rotation,displacement:e.displacement,rotateWithView:e.rotateWithView}),"number"==typeof e.opacity&&this.setOpacity(e.opacity),this._color=e.color,this._fontSize=e.fontSize||1,this._fontStyle=e.fontStyle||"",this._stroke=e.stroke,this._fill=e.fill,this._radius=e.radius-t,this._form=e.form||"none",this._gradient=e.gradient,this._offset=[e.offsetX?e.offsetX:0,e.offsetY?e.offsetY:0],e.glyph?this._glyph=this.getGlyph(e.glyph):this._glyph=this.getTextGlyph(e.text||"",e.font),this.getDisplacement||this.getImage()}static addDefs(e,t){var i=e;if("string"==typeof e&&(i={font:e,name:e,copyright:""}),i.font&&"string"==typeof i.font){var o=i.font;for(var s in ol.style.FontSymbol.defs.fonts[o]=i,t){var r=t[s];"string"!=typeof r||1!=r.length&&2!=r.length||(r={char:r}),ol.style.FontSymbol.defs.glyphs[s]={font:i.font,char:r.char||""+String.fromCharCode(r.code)||"",theme:r.theme||i.name,name:r.name||s,search:r.search||""}}}else console.log("bad font def")}clone(){var e=new ol.style.FontSymbol({text:this._glyph.char,font:this._glyph.font,color:this._color,fontSize:this._fontSize,fontStyle:this._fontStyle,stroke:this._stroke,fill:this._fill,radius:this._radius+(this._stroke?this._stroke.getWidth():0),form:this._form,gradient:this._gradient,offsetX:this._offset[0],offsetY:this._offset[1],opacity:this.getOpacity(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView()});return e.setScale(this.getScale()),e}getFill(){return this._fill}getStroke(){return this._stroke}getGlyph(e){return e?ol.style.FontSymbol.defs.glyphs[e]||{font:"sans-serif",char:e.charAt(0),theme:"none",name:"none",search:""}:this._glyph}getTextGlyph(e,t){return{font:t||"sans-serif",char:String(e),theme:"none",name:"none",search:""}}getGlyphName(){for(var e in ol.style.FontSymbol.defs.glyphs)if(ol.style.FontSymbol.defs.glyphs[e]===this._glyph)return e;return""}getFontInfo(e){return ol.style.FontSymbol.defs.fonts[e.font]}getImage(e){e=e||1;var t,i=super.getImage(e),o=0;this._stroke&&(t=ol.color.asString(this._stroke.getColor()),o=this._stroke.getWidth());var s={strokeStyle:t,strokeWidth:o,size:i.width/e},r=i.getContext("2d");if(r.clearRect(0,0,i.width,i.height),this.drawMarker_(s,r,0,0,e),!this.getDisplacement){var a=this.getAnchor();a[0]=i.width/2-this._offset[0],a[1]=i.width/2-this._offset[1]}return i}drawPath_(e,t){var i=2*this._radius+e.strokeWidth,o=e.strokeWidth/2,s=e.size/2,r={fac:1,posX:e.size/2,posY:e.size/2};switch(t.lineJoin="round",t.lineCap="round",t.beginPath(),this._form){case"none":r.fac=1;break;case"circle":case"ban":t.arc(s,s,i/2,0,2*Math.PI,!0);break;case"poi":t.arc(s,s-.4*this._radius,.6*this._radius,.15*Math.PI,.85*Math.PI,!0),t.lineTo(s-.89*.05*i,(.95+.45*.05)*i+o),t.arc(s,.95*i+o,.05*i,.85*Math.PI,.15*Math.PI,!0),r={fac:.45,posX:s,posY:s-.35*this._radius};break;case"bubble":t.arc(s,s-.2*this._radius,.8*this._radius,.4*Math.PI,.6*Math.PI,!0),t.lineTo(.5*i+o,i+o),r={fac:.7,posX:s,posY:s-.2*this._radius};break;case"marker":t.arc(s,s-.2*this._radius,.8*this._radius,.25*Math.PI,.75*Math.PI,!0),t.lineTo(.5*i+o,i+o),r={fac:.7,posX:s,posY:s-.2*this._radius};break;case"coma":t.moveTo(s+.8*this._radius,s-.2*this._radius),t.quadraticCurveTo(.95*i+o,.75*i+o,.5*i+o,i+o),t.arc(s,s-.2*this._radius,.8*this._radius,.45*Math.PI,0,!1),r={fac:.7,posX:s,posY:s-.2*this._radius};break;default:var a;switch(this._form){case"shield":a=[.05,0,.95,0,.95,.8,.5,1,.05,.8,.05,0],r.posY=.45*i+o;break;case"blazon":a=[.1,0,.9,0,.9,.8,.6,.8,.5,1,.4,.8,.1,.8,.1,0],r.fac=.8,r.posY=.4*i+o;break;case"bookmark":a=[.05,0,.95,0,.95,1,.5,.8,.05,1,.05,0],r.fac=.9,r.posY=.4*i+o;break;case"hexagon":a=[.05,.2,.5,0,.95,.2,.95,.8,.5,1,.05,.8,.05,.2],r.fac=.9,r.posY=.5*i+o;break;case"diamond":a=[.25,0,.75,0,1,.2,1,.4,.5,1,0,.4,0,.2,.25,0],r.fac=.75,r.posY=.35*i+o;break;case"triangle":a=[0,0,1,0,.5,1,0,0],r.fac=.6,r.posY=.3*i+o;break;case"sign":a=[.5,.05,1,.95,0,.95,.5,.05],r.fac=.7,r.posY=.65*i+o;break;case"lozenge":a=[.5,0,1,.5,.5,1,0,.5,.5,0],r.fac=.7;break;case"square":default:a=[0,0,1,0,1,1,0,1,0,0]}for(var n=0;nthis.textPathMaxResolution_)){var t,i=e.frameState.extent,o=e.frameState.coordinateToPixelTransform,s=e.context;s.save(),s.scale(e.frameState.pixelRatio,e.frameState.pixelRatio);for(var r,a=this.getSource().getFeaturesInExtent(i),n=0;r=a[n];n++)for(var l,h=this.textPathStyle_(r,e.frameState.viewState.resolution),c=0;l=h[c];c++){var u,d=l.getGeometry()||r.getGeometry();switch(d.getType()){case"LineString":u=d.getCoordinates();break;case"MultiLineString":u=d.getLineString(0).getCoordinates();break;default:continue}var g=l.getText(),p=m(u,g.getRotateWithView());s.font=g.getFont(),s.textBaseline=g.getTextBaseline(),s.textAlign=g.getTextAlign(),s.lineWidth=g.getStroke()&&g.getStroke().getWidth()||0,s.strokeStyle=g.getStroke()&&g.getStroke().getColor()||"#fff",s.fillStyle=g.getFill()&&g.getFill().getColor()||"#000",s.textJustify="justify"==g.getTextAlign(),s.textOverflow=g.getTextOverflow?g.getTextOverflow():"",s.minWidth=g.getMinWidth?g.getMinWidth():0,s.textPath(g.getText()||r.get("name"),p)}s.restore()}function m(e,i){var s=[];for(t=0;ts[s.length-2]){var r=[];for(t=s.length-2;t>=0;t-=2)r.push(s[t]),r.push(s[t+1]);return r}return s}}.bind(this))),void 0===e&&(e=[new ol.style.Style({text:new ol.style.Text})]),this.textPathStyle_="function"==typeof e?e:function(){return e},this.textPathMaxResolution_=Number(t)||Number.MAX_VALUE,this.changed()},ol.style.TextPath=function(e){e||(e={}),ol.style.Text.call(this,e),this.textOverflow_=void 0!==e.textOverflow?e.textOverflow:"visible",this.minWidth_=e.minWidth||0},ol.ext.inherits(ol.style.TextPath,ol.style.Text),ol.style.TextPath.prototype.getTextOverflow=function(){return this.textOverflow_},ol.style.TextPath.prototype.getMinWidth=function(){return this.minWidth_}}(),CanvasRenderingContext2D.prototype.textPath=function(e,t){var i=this;function o(e,t,i,o){var s=i-e,r=o-t;return Math.sqrt(s*s+r*r)}var s,r=0,a=2;function n(e,t){if(!s||r+st))&&!((a+=2)>=e.length);)r+=s;var i,n,l,h=t-r;return a>=e.length&&(a=e.length-2),h?(i=e[a-2]+(e[a]-e[a-2])*h/s,n=e[a-1]+(e[a+1]-e[a-1])*h/s,l=Math.atan2(e[a+1]-e[a-1],e[a]-e[a-2])):(i=e[a-2],n=e[a-1],l=Math.atan2(e[a+1]-e[a-1],e[a]-e[a-2])),[i,n,l]}for(var l=.25*i.measureText(" ").width,h=0,c=0,u=2;u0?Number(e.scale):1)*ol.has.DEVICE_PIXEL_RATIO||ol.has.DEVICE_PIXEL_RATIO,r=o.getContext("2d");if(e.image){e.image.load();var a=e.image.getImage();if(a.width)o.width=Math.round(a.width*s),o.height=Math.round(a.height*s),r.globalAlpha="number"==typeof e.opacity?e.opacity:1,r.drawImage(a,0,0,a.width,a.height,0,0,o.width,o.height),t=r.createPattern(o,"repeat");else{var n=this;t=[0,0,0,0],a.onload=function(){o.width=Math.round(a.width*s),o.height=Math.round(a.height*s),r.globalAlpha="number"==typeof e.opacity?e.opacity:1,r.drawImage(a,0,0,a.width,a.height,0,0,o.width,o.height),t=r.createPattern(o,"repeat"),n.setColor(t)}}}else{var l=this.getPattern_(e);if(o.width=Math.round(l.width*s),o.height=Math.round(l.height*s),r.beginPath(),e.fill&&(r.fillStyle=ol.color.asString(e.fill.getColor()),r.fillRect(0,0,o.width,o.height)),r.scale(s,s),r.lineCap="round",r.lineWidth=l.stroke||1,r.fillStyle=ol.color.asString(e.color||"#000"),r.strokeStyle=ol.color.asString(e.color||"#000"),l.circles)for(i=0;i180&&(s-=360),s*=Math.PI/180;var r=Math.cos(s),a=Math.sin(s);if(Math.abs(a)<1e-4)i.width=i.height=o,i.lines=[[0,.5,o,.5]],i.repeat=[[0,0],[0,o]];else if(Math.abs(r)<1e-4)i.width=i.height=o,i.lines=[[.5,0,.5,o]],i.repeat=[[0,0],[o,0]],"cross"==e.pattern&&(i.lines.push([0,.5,o,.5]),i.repeat.push([0,o]));else{var n=i.width=Math.round(Math.abs(o/a))||1,l=i.height=Math.round(Math.abs(o/r))||1;"cross"==e.pattern?(i.lines=[[-n,-l,2*n,2*l],[2*n,-l,-n,2*l]],i.repeat=[[0,0]]):r*a>0?(i.lines=[[-n,-l,2*n,2*l]],i.repeat=[[0,0],[n,0],[0,l]]):(i.lines=[[2*n,-l,-n,2*l]],i.repeat=[[0,0],[-n,0],[0,l]])}i.stroke=0===e.size?0:e.size||4}return i}},ol.style.Style.defaultStyle,function(){var e=[255,255,255,1],t=[0,153,255,1],i=[new ol.style.Style({stroke:new ol.style.Stroke({color:e,width:5})}),new ol.style.Style({image:new ol.style.Circle({radius:6,fill:new ol.style.Fill({color:t}),stroke:new ol.style.Stroke({color:e,width:1.5})}),stroke:new ol.style.Stroke({color:t,width:3}),fill:new ol.style.Fill({color:[255,255,255,.5]})})];ol.style.Style.defaultStyle=function(e){if(!0===e)return i;e=e||{};var t=new ol.style.Fill({color:e.fillColor||"rgba(255,255,255,0.4)"}),o=new ol.style.Stroke({color:e.color||"#3399CC",width:1.25});return[new ol.style.Style({image:new ol.style.Circle({fill:t,stroke:o,radius:5}),fill:t,stroke:o})]}}(),ol.style.geoportailStyle,function(){var e={},t=0;function i(i){var o="ROUT-"+t+++"-";return function(t,s){var r=!0===i.sens||s0?[0,100,0,1]:[0,128,0,1];if(!e.get("importance"))return"magenta";if("Piste cyclable"===e.get("nature"))return[27,177,27,.5];if("0"!=e.get("position_par_rapport_au_sol")){var t;switch(e.get("importance")){case"1":t=[177,27,177,1];break;case"2":t=[177,27,27,1];break;case"3":t=[217,119,0,1];break;case"4":t=[255,225,0,1];break;case"5":t=[204,204,204,1];break;default:t=[211,211,211,1]}return e.get("position_par_rapport_au_sol")<0&&(t[3]=.7),t}switch(e.get("importance")){case"1":return[255,0,255,1];case"2":return[255,0,0,1];case"3":return[255,165,0,1];case"4":return[255,255,0,1];case"5":return[255,255,255,1];default:return[211,211,211,1]}}(t),width:function(e){return Math.max(e.get("largeur_de_chaussee")||2,2)}(t),lineDash:function(e){switch(e.get("nature")){case"Escalier":return[1,4];case"Sentier":return[8,10]}}(t)}),zIndex:function(e){if(!e.get("position_par_rapport_au_sol"))return 100;var t=Number(e.get("position_par_rapport_au_sol"));return t>0?10+10*t-(Number(e.get("importance"))||10):t<0?Math.max(4+t,0):10-(Number(e.get("importance"))||10)}(t)-100})]),n[0].getText()&&n[0].getText().setRotation(function(e){for(var t,i,o=e.getCoordinates(),s=0,r=e.getLength(),a=0;a=r/2));a++);return-Math.atan2(i,t)}(t.getGeometry())),n}}var o={111:{color:[230,0,77,255],title:"Continuous urban fabric"},112:{color:[255,0,0,255],title:"Discontinuous urban fabric"},121:{color:[204,77,242,255],title:"Industrial or commercial units"},122:{color:[204,0,0,255],title:"Road and rail networks and associated land"},123:{color:[230,204,204,255],title:"Port areas"},124:{color:[230,204,230,255],title:"Airports"},131:{color:[166,0,204,255],title:"Mineral extraction sites"},132:{color:[166,77,0,255],title:"Dump sites"},133:{color:[255,77,255,255],title:"Construction sites"},141:{color:[255,166,255,255],title:"Green urban areas"},142:{color:[255,230,255,255],title:"Sport and leisure facilities"},211:{color:[255,255,168,255],title:"Non-irrigated arable land"},212:{color:[255,255,0,255],title:"Permanently irrigated land"},213:{color:[230,230,0,255],title:"Rice fields"},221:{color:[230,128,0,255],title:"Vineyards"},222:{color:[242,166,77,255],title:"Fruit trees and berry plantations"},223:{color:[230,166,0,255],title:"Olive groves"},231:{color:[230,230,77,255],title:"Pastures"},241:{color:[255,230,166,255],title:"Annual crops associated with permanent crops"},242:{color:[255,230,77,255],title:"Complex cultivation patterns"},243:{color:[230,204,77,255],title:"Land principally occupied by agriculture with significant areas of natural vegetation"},244:{color:[242,204,166,255],title:"Agro-forestry areas"},311:{color:[128,255,0,255],title:"Broad-leaved forest"},312:{color:[0,166,0,255],title:"Coniferous forest"},313:{color:[77,255,0,255],title:"Mixed forest"},321:{color:[204,242,77,255],title:"Natural grasslands"},322:{color:[166,255,128,255],title:"Moors and heathland"},323:{color:[166,230,77,255],title:"Sclerophyllous vegetation"},324:{color:[166,242,0,255],title:"Transitional woodland-shrub"},331:{color:[230,230,230,255],title:"Beaches dunes sands"},332:{color:[204,204,204,255],title:"Bare rocks"},333:{color:[204,255,204,255],title:"Sparsely vegetated areas"},334:{color:[0,0,0,255],title:"Burnt areas"},335:{color:[166,230,204,255],title:"Glaciers and perpetual snow"},411:{color:[166,166,255,255],title:"Inland marshes"},412:{color:[77,77,255,255],title:"Peat bogs"},421:{color:[204,204,255,255],title:"Salt marshes"},422:{color:[230,230,255,255],title:"Salines"},423:{color:[166,166,230,255],title:"Intertidal flats"},511:{color:[0,204,242,255],title:"Water courses"},512:{color:[128,242,230,255],title:"Water bodies"},521:{color:[0,255,166,255],title:"Coastal lagoons"},522:{color:[166,255,230,255],title:"Estuaries"},523:{color:[230,242,255,255],title:"Sea and ocean"}};ol.style.geoportailStyle=function(s,r){switch(r=r||{},s){case"BDTOPO_V3:troncon_de_route":return i(r);case"BDTOPO_V3:batiment":return function(i){var o="BATI-"+t+++"-";return function(t){if(t.get("detruit"))return[];var s=o+t.get("usage_1")+"-"+t.get("nature")+"-"+t.get("etat_de_l_objet"),r=e[s];if(!r){var a=function(e){switch(e.get("nature")){case"Industriel, agricole ou commercial":return[51,102,153,1];case"Remarquable":return[0,192,0,1];default:switch(e.get("usage_1")){case"Résidentiel":case"Indifférencié":return[128,128,128,1];case"Industriel":case"Commercial et services":return[51,102,153,1];case"Sportif":return[51,153,102,1];case"Religieux":return[153,102,51,1];default:return[153,51,51,1]}}}(t),n=[a[0],a[1],a[1],.5],l=!/en service/i.test(t.get("etat_de_l_objet"));l&&(n[3]=.1);var h=i.symbol?function(e){switch(e.get("usage_1")){case"Commercial et services":return"";case"Sportif":return"";default:return null}}(t):null;return[new ol.style.Style({text:h?new ol.style.Text({text:h,font:"12px FontAwesome",fill:new ol.style.Fill({color:[0,0,0,.6]})}):null,fill:new ol.style.Fill({color:n}),stroke:new ol.style.Stroke({color:a,width:1.5,lineDash:l?[5,5]:null})})]}return r}}(r);case"CADASTRALPARCELS.PARCELLAIRE_EXPRESS:parcelle":return function(e){var t=new ol.style.Style({text:new ol.style.Text({text:"0000",font:"bold 12px sans-serif",fill:new ol.style.Fill({color:[100,0,255,1]}),stroke:new ol.style.Stroke({color:[255,255,255,.8],width:3})}),stroke:new ol.style.Stroke({color:[255,165,0,1],width:1.5}),fill:new ol.style.Fill({color:[100,0,255,.1]})});return function(i,o){return o<.8?t.getText().setFont("bold 12px sans-serif"):t.getText().setFont("bold 10px sans-serif"),e.section?t.getText().setText(i.get("section")+"-"+(i.get("numero")||"").replace(/^0*/,"")):t.getText().setText((i.get("numero")||"").replace(/^0*/,"")),t}}(r);default:return/LANDCOVER/.test(s)?(r.date=s.replace(/[^\d]*(\d*).*/,"$1"),function(t){return function(i){var s=i.get("code_"+t.date),r=e["CLC-"+s];if(!r){var a=o[s].color.slice();a[3]=t.opacity||1,r=e["CLC-"+s]=new ol.style.Style({fill:new ol.style.Fill({color:a||[255,255,255,.5]})})}return r}}(r)):(console.warn("[ol/style/geoportailStyle] no style defined for type: "+s),ol.style.Style.defaultStyle())}},ol.style.geoportailStyle.clcColors=JSON.parse(JSON.stringify(o))}(); \ No newline at end of file +window.ol&&(ol.ext||(ol.ext={}),ol.legend||(ol.legend={}),ol.particule||(ol.particule={}),ol.ext.imageLoader||(ol.ext.imageLoader={}),ol.ext.input||(ol.ext.input={}),ol.util?ol.util.VERSION||(ol.util.VERSION=ol.VERSION||"6.1.0"):ol.util={VERSION:ol.VERSION||"5.3.0"}),ol.ext.inherits=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e},window.ol&&(ol.inherits||(ol.inherits=ol.ext.inherits)),window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),window.Element&&!Element.prototype.remove&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)}),ol.ext.Ajax=class extends ol.Object{constructor(e){e=e||{},super(),this._auth=e.auth,this.set("dataType",e.dataType||"JSON")}static get(e){var t=new ol.ext.Ajax(e);e.success&&t.on("success",function(t){e.success(t.response,t)}),e.error&&t.on("error",function(t){e.error(t)}),t.send(e.url,e.data,e.options)}static getCORS(e,t){var i=new XMLHttpRequest;i.open("GET",e,!0),i.send(),i.onreadystatechange=function(){this.readyState==this.HEADERS_RECEIVED&&t(i.getResponseHeader("Access-Control-Allow-Origin"))}}send(e,t,i){var o=this,s=!1!==(i=i||{}).encode;s&&(e=encodeURI(e));var r="";for(var a in t)t.hasOwnProperty(a)&&void 0!==t[a]&&(r+=(r?"&":"?")+a+"="+(s?encodeURIComponent(t[a]):t[a]));this._request&&!1!==i.abort&&this._request.abort();var n=this._request=new XMLHttpRequest;n.open("GET",e+r,!0),i.timeout&&(n.timeout=i.timeout),this._auth&&n.setRequestHeader("Authorization","Basic "+this._auth),this.dispatchEvent({type:"loadstart"}),n.onload=function(){if(o._request=null,o.dispatchEvent({type:"loadend"}),this.status>=200&&this.status<400){var e;try{switch(o.get("dataType")){case"JSON":e=JSON.parse(this.response);break;default:e=this.response}}catch(e){return void o.dispatchEvent({type:"error",status:0,statusText:"parsererror",error:e,options:i,jqXHR:this})}o.dispatchEvent({type:"success",response:e,status:this.status,statusText:this.statusText,options:i,jqXHR:this})}else o.dispatchEvent({type:"error",status:this.status,statusText:this.statusText,options:i,jqXHR:this})},n.ontimeout=function(){o._request=null,o.dispatchEvent({type:"loadend"}),o.dispatchEvent({type:"error",status:this.status,statusText:"Timeout",options:i,jqXHR:this})},n.onerror=function(){o._request=null,o.dispatchEvent({type:"loadend"}),o.dispatchEvent({type:"error",status:this.status,statusText:this.statusText,options:i,jqXHR:this})},n.send()}},ol.ext.SVGFilter=class extends ol.Object{constructor(e){e=e||{},super(),ol.ext.SVGFilter.prototype.svg||(ol.ext.SVGFilter.prototype.svg=document.createElementNS(this.NS,"svg"),ol.ext.SVGFilter.prototype.svg.setAttribute("version","1.1"),ol.ext.SVGFilter.prototype.svg.setAttribute("width",0),ol.ext.SVGFilter.prototype.svg.setAttribute("height",0),ol.ext.SVGFilter.prototype.svg.style.position="absolute",document.body.appendChild(ol.ext.SVGFilter.prototype.svg)),this.element=document.createElementNS(this.NS,"filter"),this._id=e.id||"_ol_SVGFilter_"+ol.ext.SVGFilter.prototype._id++,this.element.setAttribute("id",this._id),e.color&&this.element.setAttribute("color-interpolation-filters",e.color),e.operation&&this.addOperation(e.operation),ol.ext.SVGFilter.prototype.svg.appendChild(this.element)}getId(){return this._id}remove(){this.element.remove()}addOperation(e){e instanceof Array?e.forEach(function(e){this.addOperation(e)}.bind(this)):(e instanceof ol.ext.SVGOperation||(e=new ol.ext.SVGOperation(e)),this.element.appendChild(e.geElement()))}grayscale(e){this.addOperation({feoperation:"feColorMatrix",type:"saturate",values:e||0})}luminanceToAlpha(e){e=e||{},this.addOperation({feoperation:"feColorMatrix",type:"luminanceToAlpha"}),e.gamma&&this.addOperation({feoperation:"feComponentTransfer",operations:[{feoperation:"feFuncA",type:"gamma",amplitude:e.gamma,exponent:1,offset:0}]})}applyTo(e){var t=document.createElement("CANVAS");return t.width=e.naturalWidth||e.width,t.height=e.naturalHeight||e.height,t.getContext("2d").filter="url(#"+this.getId()+")",t.getContext("2d").drawImage(e,0,0),t}},ol.ext.SVGFilter.prototype.NS="http://www.w3.org/2000/svg",ol.ext.SVGFilter.prototype.svg=null,ol.ext.SVGFilter.prototype._id=0,ol.ext.SVGOperation=class extends ol.Object{constructor(e){"string"==typeof e&&(e={feoperation:e}),super(),e&&e.feoperation?(this._name=e.feoperation,this.element=document.createElementNS(ol.ext.SVGOperation.NS||"http://www.w3.org/2000/svg",this._name),this.setProperties(e),e.operations instanceof Array&&this.appendChild(e.operations)):console.error("[SVGOperation]: no operation defined.")}getName(){return this._name}set(e,t){/^feoperation$|^operations$/.test(e)||(super.set(e,t),this.element.setAttribute(e,t))}setProperties(e){for(var t in e=e||{})this.set(t,e[t])}geElement(){return this.element}appendChild(e){e instanceof Array?e.forEach(function(e){this.appendChild(e)}.bind(this)):(e instanceof ol.ext.SVGOperation||(e=new ol.ext.SVGOperation(e)),this.element.appendChild(e.geElement()))}},ol.ext.TextStreamReader=function(e){e=e||{},this.setChunkSize(e.chunkSize),this.setFile(e.file),this.reader_=new FileReader},ol.ext.TextStreamReader.prototype.setFile=function(e){this.file_=e,this.fileSize_=this.file_.size-1,this.rewind()},ol.ext.TextStreamReader.prototype.rewind=function(){this.chunk_=0,this.residue_=""},ol.ext.TextStreamReader.prototype.setChunkSize=function(e){this.chunkSize_=e||1e6},ol.ext.TextStreamReader.prototype.getProgress=function(){return this.chunk_/this.fileSize_},ol.ext.TextStreamReader.prototype.readLines=function(e,t){this.rewind(),this.readChunk(function(i){for(var o=0;o.5?c/(2-n-l):c/(n+l),n){case s:i=(r-a)/c+(r3&&(u[3]=e[3]),u},ol.color.fromHSL=function(e,t){void 0===t&&(t=1e3);var i,o,s,r=e[0]/360,a=e[1]/100,n=e[2]/100;if(0==a)i=o=s=n;else{var l=function(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e},h=n<.5?n*(1+a):n+a-n*a,c=2*n-h;i=l(c,h,r+1/3),o=l(c,h,r),s=l(c,h,r-1/3)}var u=[Math.round(255*i*t)/t,Math.round(255*o*t)/t,Math.round(255*s*t)/t];return e.length>3&&(u[3]=e[3]),u},ol.color.toHSV=function(e,t){void 0===t&&(t=100),Array.isArray(e)||(e=ol.color.asArray(e));var i,o,s=e[0]/255,r=e[1]/255,a=e[2]/255,n=Math.max(s,r,a),l=Math.min(s,r,a),h=n,c=n-l;if(o=0==n?0:c/n,n==l)i=0;else switch(n){case s:i=(r-a)/c+(r3&&(u[3]=e[3]),u},ol.color.fromHSV=function(e,t){void 0===t&&(t=1e3);var i,o,s,r=e[0]/360,a=e[1]/100,n=e[2]/100,l=Math.floor(6*r),h=6*r-l,c=n*(1-a),u=n*(1-h*a),d=n*(1-(1-h)*a);switch(l%6){case 0:i=n,o=d,s=c;break;case 1:i=u,o=n,s=c;break;case 2:i=c,o=n,s=d;break;case 3:i=c,o=u,s=n;break;case 4:i=d,o=c,s=n;break;case 5:i=n,o=c,s=u}var g=[Math.round(255*i*t)/t,Math.round(255*o*t)/t,Math.round(255*s*t)/t];return e.length>3&&(g[3]=e[3]),g},ol.color.toHexa=function(e){return"#"+((1<<24)+(e[0]<<16)+(e[1]<<8)+e[2]).toString(16).slice(1)},ol.ext.element={},ol.ext.element.create=function(e,t){var i;if(t=t||{},"TEXT"===e)i=document.createTextNode(t.html||""),t.parent&&t.parent.appendChild(i);else for(var o in i=document.createElement(e),/button/i.test(e)&&i.setAttribute("type","button"),t)switch(o){case"className":t.className&&t.className.trim&&i.setAttribute("class",t.className.trim());break;case"text":i.innerText=t.text;break;case"html":t.html instanceof Element?i.appendChild(t.html):void 0!==t.html&&(i.innerHTML=t.html);break;case"parent":t.parent&&t.parent.appendChild(i);break;case"options":if(/select/i.test(e))for(var s in t.options)ol.ext.element.create("OPTION",{html:s,value:t.options[s],parent:i});break;case"style":ol.ext.element.setStyle(i,t.style);break;case"change":case"click":ol.ext.element.addListener(i,o,t[o]);break;case"on":for(var r in t.on)ol.ext.element.addListener(i,r,t.on[r]);break;case"checked":i.checked=!!t.checked;break;default:i.setAttribute(o,t[o])}return i},ol.ext.element.createSwitch=function(e){var t=ol.ext.element.create("INPUT",{type:"checkbox",on:e.on,click:e.click,change:e.change,parent:e.parent}),i=Object.assign({input:t},e||{});return new ol.ext.input.Switch(i),t},ol.ext.element.createCheck=function(e){var t=ol.ext.element.create("INPUT",{name:e.name,type:"radio"===e.type?"radio":"checkbox",on:e.on,parent:e.parent}),i=Object.assign({input:t},e||{});return"radio"===e.type?new ol.ext.input.Radio(i):new ol.ext.input.Checkbox(i),t},ol.ext.element.setHTML=function(e,t){t instanceof Element?e.appendChild(t):void 0!==t&&(e.innerHTML=t)},ol.ext.element.appendText=function(e,t){e.appendChild(document.createTextNode(t||""))},ol.ext.element.addListener=function(e,t,i,o){"string"==typeof t&&(t=t.split(" ")),t.forEach(function(t){e.addEventListener(t,i,o)})},ol.ext.element.removeListener=function(e,t,i){"string"==typeof t&&(t=t.split(" ")),t.forEach(function(t){e.removeEventListener(t,i)})},ol.ext.element.show=function(e){e.style.display=""},ol.ext.element.hide=function(e){e.style.display="none"},ol.ext.element.hidden=function(e){return"none"===ol.ext.element.getStyle(e,"display")},ol.ext.element.toggle=function(e){e.style.display="none"===e.style.display?"":"none"},ol.ext.element.setStyle=function(e,t){for(var i in t)switch(i){case"top":case"left":case"bottom":case"right":case"minWidth":case"maxWidth":case"width":case"height":"number"==typeof t[i]?e.style[i]=t[i]+"px":e.style[i]=t[i];break;default:e.style[i]=t[i]}},ol.ext.element.getStyle=function(e,t){var i,o=(e.ownerDocument||document).defaultView;if(o&&o.getComputedStyle)t=t.replace(/([A-Z])/g,"-$1").toLowerCase(),i=o.getComputedStyle(e,null).getPropertyValue(t);else if(e.currentStyle&&(t=t.replace(/-(\w)/g,function(e,t){return t.toUpperCase()}),i=e.currentStyle[t],/^\d+(em|pt|%|ex)?$/i.test(i)))return function(t){var i=e.style.left,o=e.runtimeStyle.left;return e.runtimeStyle.left=e.currentStyle.left,e.style.left=t||0,t=e.style.pixelLeft+"px",e.style.left=i,e.runtimeStyle.left=o,t}(i);return/px$/.test(i)?parseInt(i):i},ol.ext.element.outerHeight=function(e){return e.offsetHeight+ol.ext.element.getStyle(e,"marginBottom")},ol.ext.element.outerWidth=function(e){return e.offsetWidth+ol.ext.element.getStyle(e,"marginLeft")},ol.ext.element.offsetRect=function(e){var t=e.getBoundingClientRect();return{top:t.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),left:t.left+(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0),height:t.height||t.bottom-t.top,width:t.width||t.right-t.left}},ol.ext.element.getFixedOffset=function(e){var t={left:0,top:0},i=function(e){if(!e)return t;if("absolute"===ol.ext.element.getStyle(e,"position")&&"none"!==ol.ext.element.getStyle(e,"transform")){var o=e.getBoundingClientRect();return t.left+=o.left,t.top+=o.top,t}return i(e.offsetParent)};return i(e.offsetParent)},ol.ext.element.positionRect=function(e,t){var i=0,o=0,s=function(r){if(r)return i+=r.offsetLeft,o+=r.offsetTop,s(r.offsetParent);var a={top:e.offsetTop+o,left:e.offsetLeft+i};return t&&(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+e.offsetHeight,a.right=a.top+e.offsetWidth,a};return s(e.offsetParent)},ol.ext.element.scrollDiv=function(e,t){var i,o,s,r,a,n=!1,l=0,h=0,c="function"==typeof(t=t||{}).onmove?t.onmove:function(){},u=t.vertical?"screenY":"screenX",d=t.vertical?"scrollTop":"scrollLeft",g=!1,p=0,m=function(){a&&(p++,setTimeout(f))},f=function(){if(a){if(--p)return;var t=e.clientHeight,i=e.scrollHeight;o=t/i,a.style.height=100*o+"%",a.style.top=e.scrollTop/i*100+"%",r.style.height=t+"px",t>i-.5?r.classList.add("ol-100pc"):r.classList.remove("ol-100pc")}},v=function(t){t.target.classList.contains("ol-noscroll")||(g=!1,n=t[u],h=new Date,e.classList.add("ol-move"),t.preventDefault(),window.addEventListener("pointermove",y),ol.ext.element.addListener(window,["pointerup","pointercancel"],b))},y=function(t){if(!1!==n){var r=(s?-1/o:1)*(n-t[u]);g=g||Math.round(r),e[d]+=r,(i=new Date)-h&&(l=(l+r/(i-h))/2),n=t[u],h=i,r&&c(!0)}else g=!0},_=function(t){var i=t>0?Math.min(100,t/2):Math.max(-100,t/2);t-=i,e[d]+=i,-1100||s?l=0:h>0&&(l=((l||0)+(n-i[u])/h)/2),_(!1===t.animate?0:200*l),n=!1,l=0,h=0,e.classList.contains("ol-move")?e.classList.remove("ol-hasClick"):(e.classList.add("ol-hasClick"),setTimeout(function(){e.classList.remove("ol-hasClick")},500)),s=!1,window.removeEventListener("pointermove",y),ol.ext.element.removeListener(window,["pointerup","pointercancel"],b)},w=function(t){var i=Math.max(-1,Math.min(1,t.wheelDelta||-t.detail));return e.classList.add("ol-move"),e[d]-=30*i,e.classList.remove("ol-move"),!1};return t.mousewheel&&ol.ext.element.addListener(e,["mousewheel","DOMMouseScroll","onmousewheel"],w),{refresh:m}},ol.ext.element.dispatchEvent=function(e,t){var i;try{i=new CustomEvent(e)}catch(t){(i=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,{})}t.dispatchEvent(i)},ol.ext.getMapCanvas=function(e){if(!e)return null;var t=e.getViewport().getElementsByClassName("ol-fixedoverlay")[0];return t||(e.getViewport().querySelector(".ol-layers")?((t=document.createElement("canvas")).className="ol-fixedoverlay",e.getViewport().querySelector(".ol-layers").after(t),e.on("precompose",function(i){t.width=e.getSize()[0]*i.frameState.pixelRatio,t.height=e.getSize()[1]*i.frameState.pixelRatio})):t=e.getViewport().querySelector("canvas")),t},ol.ext.olVersion=ol.util.VERSION.split("."),ol.ext.olVersion=100*parseInt(ol.ext.olVersion[0])+parseInt(ol.ext.olVersion[1]),ol.ext.getVectorContextStyle=function(e,t){var i=e.frameState.pixelRatio;if(ol.ext.olVersion>605&&1!==i&&t.getImage()instanceof ol.style.Icon){var o=(t=t.clone()).getImage();o.setScale(o.getScale()*i);var s=o.getAnchor();if(s&&o.setDisplacement){var r=o.getDisplacement();r&&(r[0]-=s[0]/i,r[1]+=s[1]/i,o.setAnchor([0,0]))}else s&&(s[0]/=i,s[1]/=i)}return t},ol.ext.imageLoader.loadBILImage=function(e,t,i){var o=[parseInt(e.replace(/.*WIDTH=(\d*).*/i,"$1")),parseInt(e.replace(/.*HEIGHT=(\d*).*/i,"$1"))],s=new XMLHttpRequest;s.responseType="blob",s.addEventListener("loadend",function(){var e=this.response;if(void 0!==e){var s=new FileReader;s.addEventListener("loadend",e=>{var i=new Float32Array(e.target.result);t(i,o)}),s.readAsArrayBuffer(e)}else i()}),s.addEventListener("error",function(){i()}),s.open("GET",e),s.send()},ol.ext.imageLoader.loadImage=function(e,t,i){var o=new XMLHttpRequest;o.responseType="blob",o.addEventListener("loadend",function(){var e=this.response;if(void 0!==e){var o=new Image;o.onload=function(){t(o,[o.naturalWidth,o.naturalHeight])},o.src=URL.createObjectURL(e)}else i()}),o.addEventListener("error",function(){i()}),o.open("GET",e),o.send()},ol.ext.imageLoader.pixelTransform=function(e){return function(t,i){ol.ext.imageLoader.loadImage(i,function(i,o){var s=document.createElement("canvas");s.width=o[0],s.height=o[1];var r=s.getContext("2d");r.drawImage(i,0,0);for(var a=r.getImageData(0,0,o[0],o[1]),n=a.data,l=0;l>>3)})},ol.ext.imageLoader.transparent=function(e){var t,i;e instanceof Array&&(t=e[0],i=e[1]);var o=t=ol.color.asArray(t);return i?(i=ol.color.asArray(i),o=[Math.min(t[0],i[0]),Math.min(t[1],i[1]),Math.min(t[2],i[2])],i=[Math.max(t[0],i[0]),Math.max(t[1],i[1]),Math.max(t[2],i[2])],ol.ext.imageLoader.pixelTransform(function(e,s){e[s]>=t[0]&&e[s]<=i[0]&&e[s+1]>=o[1]&&e[s+1]<=i[1]&&e[s+2]>=o[2]&&e[s+2]<=i[2]&&(e[s+3]=0)})):ol.ext.imageLoader.pixelTransform(function(e,t){e[t]===o[0]&&e[t+1]===o[1]&&e[t+2]===o[2]&&(e[t+3]=0)})},ol.ext.imageLoader.seaLevelMap=function(e,t){t=t||{};var i=Math.max(e+.01,.01),o=t.color?ol.color.asArray(t.color):[135,203,249],s="number"==typeof t.minValue?t.minValue:-1/0,r=!1!==t.opacity;return ol.ext.imageLoader.elevationMap(function(e){return es?[o[0],o[1],o[2],r?255*(i-e)/i:255]:[0,0,0,0]})},ol.ext.imageLoader.shadedRelief=function(){var e=Math.PI/4,t=2*Math.PI-Math.PI/4;return function(i,o){ol.ext.imageLoader.loadBILImage(o,function(o,s){var r=document.createElement("canvas"),a=r.getContext("2d"),n=r.width=s[0],l=r.height=s[1],h=a.getImageData(0,0,n,l),c=h.data;function u(e,t){return e+t*n}for(var d=0;d0?b>0?M=S+1.5*Math.PI:b<0?M=1.5*Math.PI-S:S=1.5*Math.PI:x<0?M=b<0?S+.5*Math.PI:b>0?.5*Math.PI-S:.5*Math.PI:b<0?M=Math.PI:b>0&&(M=0);var C=Math.cos(M-t)*Math.cos(.5*Math.PI-Math.atan(w))*Math.cos(e)+Math.sin(.5*Math.PI-Math.atan(w))*Math.sin(e);C<0&&(C=0),C=Math.sqrt(.8*C+.5);var E=4*u(d,g);c[E]=c[E+1]=c[E+2]=0,c[E+3]=255-255*C}a.putImageData(h,0,0),i.setImage(r)},function(){i.setState(3)})}},ol.ext.imageLoader.elevationMap=function(e){return"function"!=typeof e&&(e=ol.ext.getPixelFromElevation),function(t,i){ol.ext.imageLoader.loadBILImage(i,function(i,o){var s=document.createElement("canvas"),r=s.getContext("2d");s.width=o[0],s.height=o[1];for(var a=r.getImageData(0,0,o[0],o[1]),n=a.data,l=0;l>16,t%65536>>8,t%256,255]},ol.ext.getElevationFromPixel=function(e){return.01*((e[0]<<16)+(e[1]<<8)+e[2])-12e3},ol.matrix3D={},ol.matrix3D.getTransform=function(e){var t,i,o=window.getComputedStyle(e,null),s=(o.getPropertyValue("-webkit-transform")||o.getPropertyValue("-moz-transform")||o.getPropertyValue("-ms-transform")||o.getPropertyValue("-o-transform")||o.getPropertyValue("transform")).split("(")[1].split(")")[0].split(","),r=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];if(16===s.length)for(t=0;t<4;++t)for(i=0;i<4;++i)r[i][t]=+s[4*t+i];else for(t=0;t<3;++t)for(i=0;i<2;++i)r[i][t]=+s[2*t+i];return r},ol.matrix3D.getTransformOrigin=function(e){for(var t=window.getComputedStyle(e,null),i=(t.getPropertyValue("-webkit-transform-origin")||t.getPropertyValue("-moz-transform-origin")||t.getPropertyValue("-ms-transform-origin")||t.getPropertyValue("-o-transform-origin")||t.getPropertyValue("transform-origin")).split(" "),o=[0,0,0,1],s=0;sdocument.documentElement.clientHeight?this._elt.popup.style.top=Math.max(document.documentElement.clientHeight-this._elt.popup.offsetHeight-i.top,0)+"px":this._elt.popup.style.top=t.bottom+"px",t.left+this._elt.popup.offsetWidth+i.left>document.documentElement.clientWidth?this._elt.popup.style.left=Math.max(document.documentElement.clientWidth-this._elt.popup.offsetWidth-i.left,0)+"px":this._elt.popup.style.left=t.left+"px"}}isCollapsed(){return!this._elt.popup.classList.contains("ol-visible")}toggle(){this.collapse(!this.isCollapsed())}},ol.ext.input.Checkbox=class extends ol.ext.input.Base{constructor(e){super(e=e||{});var t=this.element=document.createElement("LABEL");e.html instanceof Element?t.appendChild(e.html):void 0!==e.html&&(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}},ol.ext.input.Collection=class extends ol.Object{constructor(e){super(),this.element=ol.ext.element.create("UL",{className:("ol-collection-list "+(e.className||"")).trim(),parent:e.target}),this._title="function"==typeof e.getTitle?e.getTitle:function(e){return e.title},this.setCollection(e.collection)}removeCollection(){this.collection&&(this.collection.un("change:length",this._update),this.collection=null)}setCollection(e){this.removeCollection(),this.collection=e,this.refresh(),this.collection&&(this._update=function(){if(!this._reorder){this.refresh();var e=this.getSelectPosition();e<0?this.dispatchEvent({type:"item:select",position:-1,item:null}):this.dispatchEvent({type:"item:order",position:e,item:this._currentItem})}}.bind(this),this.collection.on("change:length",this._update))}select(e){if(e!==this._currentItem){var t=-1;this._listElt.forEach(function(i,o){i.item!==e?i.li.classList.remove("ol-select"):(i.li.classList.add("ol-select"),t=o)}),this._currentItem=t>=0?e:null,this.dispatchEvent({type:"item:select",position:t,item:this._currentItem})}}selectAt(e){this.select(this.collection.item(e))}getSelect(){return this._currentItem}getSelectPosition(){return this.collection?this.collection.getArray().indexOf(this._currentItem):-1}refresh(){this.element.innerHTML="",this._listElt=[],this.collection&&this.collection.forEach((e,t)=>{var i=ol.ext.element.create("LI",{html:this._title(e),className:this._currentItem===e?"ol-select":"","data-position":t,on:{click:function(){this.select(e)}.bind(this),dblclick:function(){this.dispatchEvent({type:"item:dblclick",position:t,item:e})}.bind(this)},parent:this.element});this._listElt.push({li:i,item:e});var o=ol.ext.element.create("DIV",{className:"ol-noscroll ol-order",parent:i}),s=t,r=function(e){for(var t="touch"===e.pointerType?document.elementFromPoint(e.clientX,e.clientY):e.target;t&&t.parentNode!==this.element;)t=t.parentNode;if(t&&t!==i){var o=parseInt(t.getAttribute("data-position"));t.getAttribute("data-position")t?s-1:s,e),this._reorder=!1,this.dispatchEvent({type:"item:order",position:s>t?s-1:s,oldPosition:t,item:e}),this.refresh())}.bind(this);o.addEventListener("pointerdown",function(){this.select(e),document.addEventListener("pointermove",r),document.addEventListener("pointerup",a),document.addEventListener("pointercancel",a)}.bind(this))})}},ol.ext.input.Color=class extends ol.ext.input.PopupBase{constructor(e){(e=e||{}).hidden=!1!==e.hidden,e.className=("ol-ext-colorpicker "+(e.hastab?"ol-tab ":"")+(e.className||"")).trim(),super(e),!1===e.opacity&&this.element.classList.add("ol-nopacity"),this._cursor={};var t=this._hsv={};this._elt.vignet=ol.ext.element.create("DIV",{className:"ol-vignet",parent:this.element});var i=ol.ext.element.create("DIV",{className:"ol-tabbar",parent:this._elt.popup});ol.ext.element.create("DIV",{className:"ol-tab",html:e.paletteLabel||"palette",click:function(){this.element.classList.remove("ol-picker-tab")}.bind(this),parent:i}),ol.ext.element.create("DIV",{className:"ol-tab",html:e.pickerLabel||"picker",click:function(){this.element.classList.add("ol-picker-tab")}.bind(this),parent:i});var o=ol.ext.element.create("DIV",{className:"ol-container",parent:this._elt.popup}),s=this._elt.picker=ol.ext.element.create("DIV",{className:"ol-picker",parent:o}),r=this._cursor.picker=ol.ext.element.create("DIV",{className:"ol-cursor",parent:s});this._listenDrag(s,function(e){var i=Math.max(0,Math.min(e.offsetX/s.clientWidth,1)),o=Math.max(0,Math.min(e.offsetY/s.clientHeight,1));r.style.left=Math.round(100*i)+"%",r.style.top=Math.round(100*o)+"%",t.s=100*i,t.v=100-100*o,this.setColor()}.bind(this));var a=ol.ext.element.create("DIV",{className:"ol-slider",parent:o});this._elt.slider=ol.ext.element.create("DIV",{parent:a});var n=this._cursor.slide=ol.ext.element.create("DIV",{className:"ol-cursor",parent:a});this._listenDrag(a,function(e){var i=Math.max(0,Math.min(e.offsetX/a.clientWidth,1));t.a=100*i,n.style.left=Math.round(100*i)+"%",this.setColor()}.bind(this));var l=ol.ext.element.create("DIV",{className:"ol-tint",parent:o}),h=this._cursor.tint=ol.ext.element.create("DIV",{className:"ol-cursor",parent:l});this._listenDrag(l,function(e){var i=Math.max(0,Math.min(e.offsetY/l.clientHeight,1));t.h=360*i,h.style.top=Math.round(100*i)+"%",this.setColor()}.bind(this)),ol.ext.element.create("DIV",{className:"ol-clear",click:function(){this.setColor([0,0,0,0])}.bind(this),parent:o});var c,u=ol.ext.element.create("DIV",{className:"ol-rgb",parent:o}),d=function(){var e=Math.max(0,Math.min(255,parseInt(this._elt.r.value))),t=Math.max(0,Math.min(255,parseInt(this._elt.g.value))),i=Math.max(0,Math.min(255,parseInt(this._elt.b.value))),o=Math.max(0,Math.min(1,parseFloat(this._elt.a.value)));this.setColor([e,t,i,o])}.bind(this);for(this._elt.r=ol.ext.element.create("INPUT",{type:"number",lang:"en-GB",change:d,min:0,max:255,parent:u}),this._elt.g=ol.ext.element.create("INPUT",{type:"number",lang:"en-GB",change:d,min:0,max:255,parent:u}),this._elt.b=ol.ext.element.create("INPUT",{type:"number",lang:"en-GB",change:d,min:0,max:255,parent:u}),this._elt.a=ol.ext.element.create("INPUT",{type:"number",lang:"en-GB",change:d,min:0,max:1,step:.1,parent:u}),this._elt.txtColor=ol.ext.element.create("INPUT",{type:"text",className:"ol-txt-color",change:function(){var e;this._elt.txtColor.classList.remove("ol-error");try{e=ol.color.asArray(this._elt.txtColor.value)}catch(e){this._elt.txtColor.classList.add("ol-error")}e&&this.setColor(e)}.bind(this),parent:o}),ol.ext.element.create("BUTTON",{html:"OK",click:function(){this._addCustomColor(this.getColor()),this.collapse(!0)}.bind(this),parent:o}),this._paletteColor={},this._elt.palette=ol.ext.element.create("DIV",{className:"ol-palette",parent:this._elt.popup}),c=0;c<8;c++){var g=Math.round(255-255*c/7);this.addPaletteColor([g,g,g],g)}var p=["#f00","#f90","#ff0","#0f0","#0ff","#48e","#00f","#f0f"];for(p.forEach(function(e){this.addPaletteColor(e,ol.color.toHexa(ol.color.asArray(e)))}.bind(this)),c=0;c<5;c++)p.forEach(function(e){e=[(e=ol.color.toHSV(ol.color.asArray(e)))[0],c/4*80+20,100-c/4*60],e=ol.color.fromHSV(e,1),this.addPaletteColor(e,ol.color.toHexa(e))}.bind(this));(ol.ext.element.create("HR",{parent:this._elt.palette}),ol.ext.input.Color.customColorList)||(ol.ext.input.Color.customColorList=new ol.Collection,JSON.parse(localStorage.getItem("ol-ext@colorpicker")||"[]").forEach(function(e){ol.ext.input.Color.customColorList.push(e)}),ol.ext.input.Color.customColorList.on(["add","remove"],function(){localStorage.setItem("ol-ext@colorpicker",JSON.stringify(ol.ext.input.Color.customColorList.getArray()))}));ol.ext.input.Color.customColorList.on("add",function(e){this.addPaletteColor(this.getColorFromID(e.element))}.bind(this)),ol.ext.input.Color.customColorList.on("remove",function(e){this._paletteColor[e.element]&&this._paletteColor[e.element].element.remove(),delete this._paletteColor[e.element]}.bind(this)),ol.ext.input.Color.customColorList.forEach(function(e){this._addCustomColor(this.getColorFromID(e))}.bind(this)),this.setColor(e.color||[0,0,0,0]),this._currentColor=this.getColorID(this.getColor()),this.on("color",function(){this._addCustomColor(this.getColor()),this._currentColor=this.getColorID(this.getColor()),this.setColor()}.bind(this)),this.on("collapse",function(e){if(e.visible)this._currentColor=this.getColorID(this.getColor());else{var t=this.getColor();this._currentColor!==this.getColorID(t)&&this.dispatchEvent({type:"color",color:t})}}.bind(this))}addPaletteColor(e,t,i){try{e=ol.color.asArray(e)}catch(e){return}var o=this.getColorID(e);!this._paletteColor[o]&&e[3]&&(this._paletteColor[o]={color:e,element:ol.ext.element.create("DIV",{title:t||"",className:e[3]<1?"ol-alpha":"",style:{color:"rgb("+e.join(",")+")"},click:function(){this.setColor(e),this.get("autoClose")&&this.collapse(!0)}.bind(this),parent:this._elt.palette})}),i&&this._selectPalette(e)}showTab(e){"palette"===e?this.element.classList.remove("ol-picker-tab"):this.element.classList.add("ol-picker-tab")}getTab(){return this.element.classList.contains("ol-picker-tab")?"picker":"palette"}_selectPalette(e){var t=this.getColorID(e);Object.keys(this._paletteColor).forEach(function(e){this._paletteColor[e].element.classList.remove("ol-select")}.bind(this)),this._paletteColor[t]&&this._paletteColor[t].element.classList.add("ol-select")}setColor(e){var t=this._hsv;if(e){e=ol.color.asArray(e);var i=ol.color.toHSV(e);t.h=i[0],t.s=i[1],t.v=i[2],i.length>3?t.a=100*i[3]:t.a=100,this._cursor.picker.style.left=t.s+"%",this._cursor.picker.style.top=100-t.v+"%",this._cursor.tint.style.top=t.h/360*100+"%",this._cursor.slide.style.left=t.a+"%",this.isCollapsed()&&this.dispatchEvent({type:"color",color:e})}else t.a=Math.round(t.a),e=this.getColor();var o="rgba("+e.join(", ")+")";this._elt.picker.style.color="hsl("+t.h+", 100%, 50%)",this._elt.slider.style.backgroundImage="linear-gradient(45deg, transparent, rgba("+this.getColor(!1).join(",")+"))",this._elt.vignet.style.color=o,this._elt.r.value=e[0],this._elt.g.value=e[1],this._elt.b.value=e[2],this._elt.a.value=e[3],this._elt.txtColor.classList.remove("ol-error"),1===e[3]?this._elt.txtColor.value=ol.color.toHexa(e):this._elt.txtColor.value=o,this._selectPalette(e),this.input.value!==o&&(this.input.value=o,this.input.dispatchEvent(new Event("change")))}getColor(e){return ol.color.fromHSV([this._hsv.h,this._hsv.s,this._hsv.v,!1!==e?this._hsv.a/100:1],1)}_addCustomColor(e){var t=this.getColorID(e);this._paletteColor[t]||e[3]&&(ol.ext.input.Color.customColorList.getArray().indexOf(t)<0&&(ol.ext.input.Color.customColorList.push(t),ol.ext.input.Color.customColorList.getLength()>24&&ol.ext.input.Color.customColorList.removeAt(0)),this.addPaletteColor(e))}clearCustomColor(){ol.ext.input.Color.customColorList.clear()}getColorID(e){return void 0===(e=ol.color.asArray(e))[3]&&(e[3]=1),e.join("-")}getColorFromID(e){var t=e.split("-");return[parseFloat(t[0]),parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])]}},ol.ext.input.Color.customColorList=null,ol.ext.input.List=class extends ol.ext.input.Base{constructor(e){switch(super(e=e||{}),this._content=ol.ext.element.create("DIV"),(e.hidden||e.disabled)&&(e.hover=!0),this.element=ol.ext.element.create("DIV",{html:this._content,className:"ol-input-popup"+(e.hover?" ol-hover":"")}),this.set("hideOnClick",!1!==e.hideOnClick),e.className&&this.element.classList.add(e.className),e.fixed&&(this.element.classList.add("ol-fixed"),this.set("hideOnClick",!1)),e.align){case"middle":this.set("hideOnClick",!1);case"rigth":this.element.classList.add("ol-"+e.align)}var t=this.input;t.parentNode&&t.parentNode.insertBefore(this.element,t),this.element.appendChild(t);var i=this.popup=ol.ext.element.create("UL",{className:"ol-popup",parent:this.element}),o=[];e.options.forEach(e=>{o.push({value:e.value,element:ol.ext.element.create("LI",{html:e.html,title:e.title||e.value,className:"ol-option",on:{pointerdown:function(){this.setValue(e.value),this.get("hideOnClick")&&(i.style.display="none",setTimeout(function(){i.style.display=""},200))}.bind(this)},parent:this.popup})})}),this.input.addEventListener("change",function(){var e,t=this.input.value;o.forEach(function(i){i.value==t?(i.element.classList.add("ol-selected"),e=i.element):i.element.classList.remove("ol-selected")}),this.dispatchEvent({type:"change:value",value:this.getValue()}),this._content.innerHTML=e?e.innerHTML:""}.bind(this));var s=new Event("change");setTimeout(function(){this.input.dispatchEvent(s)}.bind(this))}},ol.ext.input.Radio=class extends ol.ext.input.Checkbox{constructor(e){super(e=e||{}),this.element.className=("ol-ext-check ol-ext-radio "+(e.className||"")).trim()}},ol.ext.input.Range=class extends ol.ext.input.Base{constructor(e){super(e=e||{}),this.set("overflow",!!e.overflow),this.element=ol.ext.element.create("DIV",{className:"ol-input-slider ol-input-range"+(e.className?" "+e.className:"")});var t=this.input;t.parentNode&&t.parentNode.insertBefore(this.element,t),this.element.appendChild(t);var i=this.slider=ol.ext.element.create("DIV",{className:"ol-slider",parent:this.element}),o=ol.ext.element.create("DIV",{className:"ol-back",parent:this.slider}),s=this.input2=e.input2;s&&this.element.appendChild(s);var r=ol.ext.element.create("DIV",{className:"ol-cursor",parent:i}),a=ol.ext.element.create("DIV",{className:"ol-cursor",parent:s?i:void 0}),n=r;function l(e){n=e.target}r.addEventListener("mousedown",l,!1),r.addEventListener("touchstart",l,!1),a.addEventListener("mousedown",l,!1),a.addEventListener("touchstart",l,!1);var h=void 0!==e.min?e.min:parseFloat(t.min)||0,c=void 0!==e.max?e.max:parseFloat(t.max)||1,u=1/(void 0!==e.step?e.step:parseFloat(t.step)||1);function d(){if(s){var e=parseFloat(r.style.left)||0,t=parseFloat(a.style.left)||0;o.style.left=Math.min(e,t)+"%",o.style.right=100-Math.max(e,t)+"%"}else o.style.left=0,o.style.right=(100-parseFloat(r.style.left)||0)+"%"}function g(){if(s&&parseFloat(t.value)>parseFloat(s.value)){var e=t.value;t.value=s.value,s.value=e,p({target:t}),s&&p({target:s})}}this._listenDrag(i,function(e){var o=n===r?t:s,a=Math.max(0,Math.min(e.offsetX/i.clientWidth,1));n.style.left=Math.max(0,Math.min(100,Math.round(100*a)))+"%";var l=o.value=Math.round((a*(c-h)+h)*u)/u;d(),this.dispatchEvent({type:"change:value",value:l}),"pointerup"===e.type&&g()}.bind(this));var p=function(e){var i=e.target,o=i===t?r:a,s=parseFloat(i.value)||0;this.get("overflow")||(s=Math.max(h,Math.min(c,s))),s!=i.value&&(i.value=s);var n=(s-h)/(c-h);o.style.left=Math.max(0,Math.min(100,Math.round(100*n)))+"%",d(),this.dispatchEvent({type:"change:value",value:s}),g()}.bind(this);t.addEventListener("change",p),s&&s.addEventListener("change",p),p({target:t}),s&&p({target:s})}setValue2(e){this.input2&&(void 0!==e&&(this.input2.value=e),this.input2.dispatchEvent(new Event("change")))}getValue2(){return this.input2?this.input2.value:null}getMin(){return Math.min(parseFloat(this.getValue()),parseFloat(this.getValue2()))}getMax(){return Math.max(parseFloat(this.getValue()),parseFloat(this.getValue2()))}},ol.ext.input.Size=class extends ol.ext.input.List{constructor(e){(e=e||{}).options=[],(e.size||[0,2,3,5,8,13,21,34,55]).forEach(function(t){e.options.push({value:t,html:ol.ext.element.create("DIV",{className:"ol-option-"+t,style:{fontSize:t?t+"px":void 0}})})}),super(e),this._content.remove(),this.element.classList.add("ol-size")}getValue(){return parseFloat(super.getValue())}},ol.ext.input.Switch=class extends ol.ext.input.Checkbox{constructor(e){super(e=e||{}),this.element.className=("ol-ext-toggle-switch "+(e.className||"")).trim()}},ol.ext.input.Width=class extends ol.ext.input.List{constructor(e){(e=e||{}).options=[],(e.size||[0,1,2,3,5,10,15,20]).forEach(function(t){e.options.push({value:t,html:ol.ext.element.create("DIV",{className:"ol-option-"+t,style:{height:t||void 0}})})}),super(e),this._content.remove(),this.element.classList.add("ol-width")}getValue(){return parseFloat(super.getValue())}},ol.legend.Legend=class extends ol.Object{constructor(e){super(),e=e||{},this._items=new ol.Collection;var t,i=[];this._items.on("add",function(e){i.push({item:e.element,on:e.element.on("change",function(){this.refresh()}.bind(this))}),t&&(clearTimeout(t),t=null),t=setTimeout(function(){this.refresh()}.bind(this),0)}.bind(this)),this._items.on("remove",function(e){for(var o=0;o":return o>t.val;case">=":return o>=t.val;case"contain":return new RegExp(this._escape(t.val),i?"":"i").test(o);case"!contain":return!new RegExp(this._escape(t.val),i?"":"i").test(o);case"regexp":return new RegExp(t.val,i?"":"i").test(o);case"!regexp":return!new RegExp(t.val,i?"":"i").test(o);default:return!1}}_selectFeatures(e,t,i,o,s){var r;i=i||[];for(var a=t.length-1;r=t[a];a--){for(var n,l=o,h=0;n=i[h];h++)n.attr&&(l=o?l&&this._checkCondition(r,n,s):l||this._checkCondition(r,n,s));l?e.push(r):this._features&&this._features.removeAt(a)}return e}getSources(){if(this.get("source"))return this.get("source");var e=[];return this.getMap()&&function t(i){i.forEach(function(i){i.getLayers?t(i.getLayers()):i.getSource&&i.getSource()instanceof ol.source.Vector&&e.push(i.getSource())})}(this.getMap().getLayers()),e}doSelect(e){var t=[];if((e=e||{}).features)this._selectFeatures(t,e.features,e.conditions,e.matchAll,e.useCase);else if(this._features)this._selectFeatures(t,this._features.getArray(),e.conditions,e.matchAll,e.useCase);else{(e.sources||this.getSources()).forEach(function(i){this._selectFeatures(t,i.getFeatures(),e.conditions,e.matchAll,e.useCase)}.bind(this))}return this.dispatchEvent({type:"select",features:t}),t}},ol.control.SelectBase.prototype.operationsList={"=":"=","!=":"≠","<":"<","<=":"≤",">=":"≥",">":">",contain:"⊂","!contain":"⊄",regexp:"≃","!regexp":"≄"},ol.control.Button=class extends ol.control.Control{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,o=this.button_=document.createElement(/ol-text-button/.test(e.className)?"div":"button");o.type="button",e.title&&(o.title=e.title),e.name&&(o.name=e.name),e.html instanceof Element?o.appendChild(e.html):o.innerHTML=e.html||"";o.addEventListener("click",function(t){t&&t.preventDefault&&(t.preventDefault(),t.stopPropagation()),e.handleClick&&e.handleClick.call(i,t)}),t.appendChild(o),!e.title&&o.firstElementChild&&(o.title=o.firstElementChild.title),e.title&&this.set("title",e.title),e.title&&this.set("title",e.title),e.name&&this.set("name",e.name)}setVisible(e){e?ol.ext.element.show(this.element):ol.ext.element.hide(this.element)}setTitle(e){this.button_.setAttribute("title",e)}setHtml(e){ol.ext.element.setHTML(this.button_,e)}getButtonElement(){return this.button_}},ol.control.Toggle=class extends ol.control.Button{constructor(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_))}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.dispatchEvent({type:"change:active",key:"active",oldValue:!e,active:e}))}setInteraction(e){this.interaction_=e}getInteraction(){return this.interaction_}},ol.control.Search=class extends ol.control.Control{constructor(e){var t=((e=e||{}).className||"")+" ol-search"+(e.target?"":" ol-unselectable ol-control"),i=ol.ext.element.create("DIV",{className:t});super({element:i,target:e.target});var o=this;if(null==e.typing&&(e.typing=300),this._classname=e.className||"search",!1!==e.collapsed&&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 e=i.querySelectorAll("li"),t=0;t=0)if(a=l){r&&clearTimeout(r);var h=o.get("minLength");r=setTimeout(function(){if(a.length>=h){var e=o.autocomplete(a,function(e){o.drawList_(e)});e&&o.drawList_(e)}else o.drawList_()},e.typing)}else o.drawList_();else(s=i.querySelector("ul.autocomplete li"))&&s.classList.remove("select");else i.classList.contains("ol-control")&&n.blur(),s.classList.remove("select"),a=l,o._handleSelect(o._list[s.getAttribute("data-search")]);else setTimeout(function(){o.drawList_()},200)};if(n.addEventListener("keyup",l),n.addEventListener("search",l),n.addEventListener("cut",l),n.addEventListener("paste",l),n.addEventListener("input",l),e.noCollapse||(n.addEventListener("blur",function(){setTimeout(function(){n!==document.activeElement&&(i.classList.add("ol-collapsed"),this.set("reverse",!1),i.classList.remove("ol-revers"))}.bind(this),200)}.bind(this)),n.addEventListener("focus",function(){this.get("reverse")||(i.classList.remove("ol-collapsed"),i.classList.remove("ol-revers"))}.bind(this))),i.appendChild(n),e.reverse){var h=ol.ext.element.create("BUTTON",{type:"button",class:"ol-revers",title:e.reverseTitle||"click on the map",click:function(){this.get("reverse")?this.set("reverse",!1):(this.set("reverse",!this.get("reverse")),n.focus(),i.classList.add("ol-revers"))}.bind(this)});i.appendChild(h)}var c=document.createElement("UL");c.classList.add("autocomplete"),i.appendChild(c),"function"==typeof e.getTitle&&(this.getTitle=e.getTitle),"function"==typeof e.autocomplete&&(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(e){var t=this.getMap();t&&t.getView().setCenter(e.coordinate)}.bind(this)),e.zoomOnSelect&&this.on("select",function(t){var i=this.getMap();i&&(i.getView().setCenter(t.coordinate),i.getView().getZoom()=0;o--)s[o]&&JSON.stringify(s[o])!==r||s.splice(o,1)}catch(t){for(o=s.length-1;o>=0;o--)s[o]===e&&s.splice(o,1)}s.unshift(e);for(var a=Math.max(0,this.get("maxHistory")||10)||0;s.length>a;)s.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(e){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(e){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{if(this.element.querySelector("input.search").value)return;e=this.get("history"),i.setAttribute("class","autocomplete history")}for(var o,s=Math.min(t.get("maxItems"),e.length),r=0;r=200&&e.status<400?"function"==typeof this._callback&&this._callback(e.response):("function"==typeof this._callback&&this._callback(!1,"error"),console.log("AJAX ERROR",arguments))}.bind(this)),this._ajax.on("error",function(){"function"==typeof this._callback&&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)),"function"==typeof e.handleResponse&&(this.handleResponse=e.handleResponse)}ajax(e,t,i,o){o=o||{},this._callback=i,this._ajax.set("dataType",o.dataType||"JSON"),this._ajax.send(e,t,o)}autocomplete(e,t){var i=this.requestData(e),o=encodeURI(this.get("url"));this.ajax(o,i,function(e){"function"==typeof t&&t(this.handleResponse(e))})}requestData(e){return{q:e}}handleResponse(e){return e}},ol.control.SearchPhoton=class extends ol.control.SearchJSON{constructor(e){(e=e||{}).className=e.className||"photon",e.url=e.url||"https://photon.komoot.io/api/",e.copy=e.copy||'© OpenStreetMap contributors',super(e),this.set("lang",e.lang),this.set("position",e.position)}getTitle(e){var t=e.properties;return(t.housenumber||"")+" "+(t.street||t.name||"")+" "+(t.postcode||"")+" "+(t.city||"")+" ("+t.country+")"}requestData(e){var t={q:e,lang:this.get("lang"),limit:this.get("maxItems")};if(this.get("position")){var i=this.getMap().getView(),o=new ol.geom.Point(i.getCenter());o=o.transform(i.getProjection(),"EPSG:4326").getCoordinates(),t.lon=o[0],t.lat=o[1]}return t}handleResponse(e){return e.features}equalFeatures(e,t){return this.getTitle(e)===this.getTitle(t)&&e.geometry.coordinates[0]===t.geometry.coordinates[0]&&e.geometry.coordinates[1]===t.geometry.coordinates[1]}select(e){var t=e.geometry.coordinates;try{t=ol.proj.transform(e.geometry.coordinates,"EPSG:4326",this.getMap().getView().getProjection())}catch(e){}this.dispatchEvent({type:"select",search:e,coordinate:t})}reverseData(e){var t=ol.proj.transform(e,this.getMap().getView().getProjection(),"EPSG:4326");return{lon:t[0],lat:t[1]}}reverseGeocode(e,t){this.ajax(this.get("url").replace("/api/","/reverse/").replace("/search/","/reverse/"),this.reverseData(e),function(e){e.features&&(e=e.features),e instanceof Array||(e=[e]),t?t.call(this,e):this._handleSelect(e[0],!0)}.bind(this))}},ol.control.SearchGeoportail=class extends ol.control.SearchJSON{constructor(e){(e=e||{}).className=e.className||"IGNF",e.typing=e.typing||500,1==e.version?e.url="https://wxs.ign.fr/"+(e.apiKey||"essentiels")+"/ols/apis/completion":e.url="https://wxs.ign.fr/"+(e.apiKey||"essentiels")+"/geoportail/geocodage/rest/0.1/completion",e.copy='© IGN-Géoportail',super(e),this.set("type",e.type||"StreetAddress,PositionOfInterest"),this.set("timeout",e.timeout||2e3)}reverseGeocode(e,t){var i=ol.proj.transform(e,this.getMap().getView().getProjection(),"EPSG:4326");this._handleSelect({x:i[0],y:i[1],fulltext:i[0].toFixed(6)+","+i[1].toFixed(6)},!0,t);var o="Commune"===this.get("type")?"PositionOfInterest":this.get("type")||"StreetAddress";/,/.test(o)&&(o="StreetAddress");var s=this.get("url").replace("ols/apis/completion","geoportail/ols").replace("completion","reverse");if(/ols/.test(s)){var r=' '+o+" "+i[1]+" "+i[0]+" ";this.ajax(s,{xls:r},function(e){var o={};if(e){var s=(e=e.replace(/\n|\r/g,"")).replace(/.*(.*)<\/gml:pos>.*/,"$1").split(" ");if(Number(s[1])||Number(s[0]))if(o.x=i[0],o.y=i[1],o.city=e.replace(/.*([^<]*)<\/Place>.*/,"$1"),o.insee=e.replace(/.*([^<]*)<\/Place>.*/,"$1"),o.zipcode=e.replace(/.*([^<]*)<\/PostalCode>.*/,"$1"),//.test(e)){o.kind="",o.country="StreetAddress",o.street=e.replace(/.*([^<]*)<\/Street>.*/,"$1");var r=e.replace(/.*([^<]*)<\/Place>.*/,"$1"),o.country="PositionOfInterest",o.street="",o.fulltext=o.zipcode+" "+o.city;else o={x:i[0],y:i[1],fulltext:i[0].toFixed(6)+","+i[1].toFixed(6)}}else o={x:i[0],y:i[1],fulltext:i[0].toFixed(6)+","+i[1].toFixed(6)};"function"==typeof t?t.call(this,[o]):(this.getHistory().shift(),this._handleSelect(o,!0,t))}.bind(this),{timeout:this.get("timeout"),dataType:"XML"})}else this.ajax(s+"?lon="+i[0]+"&lat="+i[1],{},function(e){var o;try{(o=(e=JSON.parse(e).features[0]).properties).x=e.geometry.coordinates[0],o.y=e.geometry.coordinates[1],o.click=i,o.name?o.fulltext=o.name+", "+o.postcode+" "+o.city:o.fulltext=o.postcode+" "+o.city}catch(e){o={x:i[0],y:i[1],lonlat:i,fulltext:i[0].toFixed(6)+","+i[1].toFixed(6)}}"function"==typeof t?t.call(this,[o]):(this.getHistory().shift(),this._handleSelect(o,!0,t))}.bind(this),{timeout:this.get("timeout"),dataType:"XML"})}getTitle(e){return e.fulltext}requestData(e){return{text:e,type:"Commune"===this.get("type")?"PositionOfInterest":this.get("type")||"StreetAddress,PositionOfInterest",maximumResponses:this.get("maxItems")}}handleResponse(e){var t=e.results;if("Commune"===this.get("type"))for(var i=t.length-1;i>=0;i--)t[i].kind&&(t[i].classification>5||"Département"==t[i].kind)&&t.splice(i,1);return t}select(e,t,i,o){if(e.x||e.y){var s=[Number(e.x),Number(e.y)];try{s=ol.proj.transform(s,"EPSG:4326",this.getMap().getView().getProjection())}catch(e){}"Commune"===this.get("type")?this.searchCommune(e,function(){ol.control.Search.prototype.select.call(this,e,t,s,o)}.bind(this)):super.select(e,t,s,o)}else this.searchCommune(e)}searchCommune(e,t){var i=this.get("url").replace("ols/apis/completion","geoportail/ols").replace("completion","reverse");if(/ols/.test(i)){var o='
'+e.zipcode+" "+e.city+"+
";this.ajax(this.get("url").replace("ols/apis/completion","geoportail/ols"),{xls:o},function(i){if(i){var o=(new DOMParser).parseFromString(i,"text/xml").getElementsByTagName("GeocodedAddress")[0],s=o.getElementsByTagName("gml:Point")[0].textContent.trim().split(" ");e.x=Number(s[1]),e.y=Number(s[0]);for(var r=o.getElementsByTagName("Place"),a=0;at-o){ol.ext.element.setStyle(this.element,{height:"100%"});var r=this.panel_.querySelectorAll("li.ol-visible .li-content")[0],a=r?2*ol.ext.element.getStyle(r,"height"):0;switch(e){case 1:s+=a;break;case-1:s-=a;break;case"+50%":s+=Math.round(t/2);break;case"-50%":s-=Math.round(t/2)}return s+i<=t-3*o/2?(s=t-3*o/2-i,ol.ext.element.hide(this.botv)):ol.ext.element.show(this.botv),s>=0?(s=0,ol.ext.element.hide(this.topv)):ol.ext.element.show(this.topv),ol.ext.element.setStyle(this.panel_,{top:s+"px"}),!0}return ol.ext.element.setStyle(this.element,{height:"auto"}),ol.ext.element.setStyle(this.panel_,{top:0}),ol.ext.element.hide(this.botv),ol.ext.element.hide(this.topv),!1}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(e){"displayInLayerSwitcher"!==e.key&&"openInLayerSwitcher"!==e.key&&"title"!==e.key&&"name"!==e.key||this.drawPanel(e)}.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=100*e.getOpacity()+"%"),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(e){ol.Observable.unByKey(e)})}),this._layers=[]}_getLayerForLI(e){for(var t,i=0;t=this._layers[i];i++)if(t.li===e)return t.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(e){e.classList.contains("ol-header")||e.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}}switchLayerVisibility(e,t){e.get("baseLayer")?(e.getVisible()||e.setVisible(!0),t.forEach(function(t){e!==t&&t.get("baseLayer")&&t.getVisible()&&t.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()2&&(l=!1,n.classList.add("drag"),s=a._getLayerForLI(n),i=!1,r=a._getLayerForLI(n.parentNode.parentNode),o=ol.ext.element.create("LI",{className:"ol-dragover",html:n.innerHTML,style:{position:"absolute","z-index":1e4,left:n.offsetLeft,opacity:.5,width:ol.ext.element.outerWidth(n),height:ol.ext.element.getStyle(n,"height")},parent:h}),a.element.classList.add("drag"),a.dispatchEvent({type:"reorder-start",layer:s,group:r})),!l){var u;for(e.preventDefault(),e.stopPropagation(),ol.ext.element.setStyle(o,{top:t-ol.ext.element.offsetRect(h).top+h.scrollTop+5}),(u=e.touches?document.elementFromPoint(e.touches[0].clientX,e.touches[0].clientY):e.target).classList.contains("ol-switcherbottomdiv")?a.overflow(-1):u.classList.contains("ol-switchertopdiv")&&a.overflow(1);u&&"LI"!==u.tagName;)u=u.parentNode;u&&u.classList.contains("dropover")||n.parentNode.querySelectorAll("li").forEach(function(e){e.classList.remove("dropover"),e.classList.remove("dropover-after"),e.classList.remove("dropover-before")}),u&&u.parentNode.classList.contains("drag")&&u!==n?((i=a._getLayerForLI(u))&&!i.get("allwaysOnTop")==!s.get("allwaysOnTop")?(u.classList.add("dropover"),u.classList.add(n.offsetTopg?h.insertAt(g,t):h.insertAt(g+1,t);break}}l&&a.selectLayer(t),a.dispatchEvent({type:"reorder-end",layer:t,group:r})}n.parentNode.querySelectorAll("li").forEach(function(e){e.classList.remove("dropover"),e.classList.remove("dropover-after"),e.classList.remove("dropover-before")}),n.classList.remove("drag"),n.parentNode.classList.remove("drag"),a.element.classList.remove("drag"),o&&o.remove(),ol.ext.element.removeListener(document,"mousemove touchmove",u),ol.ext.element.removeListener(document,"mouseup touchend touchcancel",e)})}dragOpacity_(e){e.stopPropagation(),e.preventDefault();var t=this,i=e.target,o=this._getLayerForLI(i.parentNode.parentNode.parentNode);if(o){var s=e.pageX||e.touches&&e.touches.length&&e.touches[0].pageX||e.changedTouches&&e.changedTouches.length&&e.changedTouches[0].pageX,r=ol.ext.element.getStyle(i,"left")-s;t.dragging_=!0,ol.ext.element.addListener(document,"mouseup touchend touchcancel",function e(){ol.ext.element.removeListener(document,"mouseup touchend touchcancel",e),ol.ext.element.removeListener(document,"mousemove touchmove",a),t.dragging_=!1}),ol.ext.element.addListener(document,"mousemove touchmove",a)}function a(e){var t=e.pageX||e.touches&&e.touches.length&&e.touches[0].pageX||e.changedTouches&&e.changedTouches.length&&e.changedTouches[0].pageX,s=(r+t)/ol.ext.element.getStyle(i.parentNode,"width"),a=Math.max(0,Math.min(1,s));ol.ext.element.setStyle(i,{left:100*a+"%"}),i.parentNode.nextElementSibling.innerHTML=Math.round(100*a),o.setOpacity(a)}}drawList(e,t){var i=this,o=t.getArray(),s=function(e){e.stopPropagation(),e.preventDefault();var o=i._getLayerForLI(this.parentNode.parentNode);i.switchLayerVisibility(o,t),i.get("selection")&&o.getVisible()&&i.selectLayer(o),i.onchangeCheck&&i.onchangeCheck(o)};function r(e){e.stopPropagation(),e.preventDefault();var t=i._getLayerForLI(this.parentNode.parentNode);i.oninfo(t),i.dispatchEvent({type:"info",layer:t})}function a(e){e.stopPropagation(),e.preventDefault();var t=i._getLayerForLI(this.parentNode.parentNode);i.onextent?i.onextent(t):i.getMap().getView().fit(t.getExtent(),i.getMap().getSize()),i.dispatchEvent({type:"extent",layer:t})}function n(e){e.stopPropagation(),e.preventDefault();var t,o=this.parentNode.parentNode.parentNode.parentNode,s=i._getLayerForLI(o);s?(t=i._getLayerForLI(this.parentNode.parentNode),s.getLayers().remove(t),0!=s.getLayers().getLength()||s.get("noSwitcherDelete")||n.call(o.querySelectorAll(".layerTrash")[0],e)):(o=this.parentNode.parentNode,i.getMap().removeLayer(i._getLayerForLI(o)))}function l(t){if(this.displayInLayerSwitcher(t)){var l=ol.ext.element.create("LI",{className:(t.getVisible()?"ol-visible ":" ")+(t.get("baseLayer")?"baselayer":""),parent:e});this._setLayerForLI(l,t),this._selectedLayer===t&&l.classList.add("ol-layer-select");var c=ol.ext.element.create("DIV",{className:"ol-layerswitcher-buttons",parent:l}),u=ol.ext.element.create("DIV",{className:"li-content",parent:l});ol.ext.element.create("INPUT",{type:t.get("baseLayer")?"radio":"checkbox",className:"ol-visibility",checked:t.getVisible(),click:s,parent:u});var d=ol.ext.element.create("LABEL",{title:t.get("title")||t.get("name"),click:s,style:{userSelect:"none"},parent:u});if(d.addEventListener("selectstart",function(){return!1}),ol.ext.element.create("SPAN",{html:t.get("title")||t.get("name"),click:function(e){this.get("selection")&&(e.stopPropagation(),this.selectLayer(t))}.bind(this),parent:d}),this.reordering&&(h0&&(!t.get("allwaysOnTop")||o[h-1].get("allwaysOnTop")))&&ol.ext.element.create("DIV",{className:"layerup ol-noscroll",title:this.tip.up,on:{"mousedown touchstart":function(e){i.dragOrdering_(e)}},parent:c}),t.getLayers){var g=0;t.getLayers().forEach(function(e){i.displayInLayerSwitcher(e)&&g++}),g&&ol.ext.element.create("DIV",{className:t.get("openInLayerSwitcher")?"collapse-layers":"expend-layers",title:this.tip.plus,click:function(){var e=i._getLayerForLI(this.parentNode.parentNode);e.set("openInLayerSwitcher",!e.get("openInLayerSwitcher"))},parent:c})}if(this.oninfo&&ol.ext.element.create("DIV",{className:"layerInfo",title:this.tip.info,click:r,parent:c}),this.hastrash&&!t.get("noSwitcherDelete")&&ol.ext.element.create("DIV",{className:"layerTrash",title:this.tip.trash,click:n,parent:c}),this.hasextent&&o[h].getExtent()){var p=o[h].getExtent();4==p.length&&p[0]=0;h--)l.call(this,o[h]);this.viewChange(),e===this.panel_&&this.overflow()}getLayerClass(e){return e?e.getLayers?"ol-layer-group":e instanceof ol.layer.Vector?"ol-layer-vector":e instanceof ol.layer.VectorTile?"ol-layer-vectortile":e instanceof ol.layer.Tile?"ol-layer-tile":e instanceof ol.layer.Image?"ol-layer-image":e instanceof ol.layer.Heatmap?"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.drawPanel(),t||this.dispatchEvent({type:"select",layer:e})}getSelection(){return this._selectedLayer}setprogress_(e){if(!e.layerswitcher_progress){var t=0,i=0,o=function(){i===t?(i=t=0,ol.ext.element.setStyle(e.layerswitcher_progress,{width:0})):ol.ext.element.setStyle(e.layerswitcher_progress,{width:(t/i*100).toFixed(1)+"%"})};e.getSource().on("tileloadstart",function(){i++,o()}),e.getSource().on("tileloadend",function(){t++,o()}),e.getSource().on("tileloaderror",function(){t++,o()})}}},ol.control.LayerSwitcher.prototype.tip={up:"up/down",down:"down",info:"informations...",extent:"zoom to extent",trash:"remove layer",plus:"expand/shrink"},ol.control.Bar=class extends ol.control.Control{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(e){return e.length>0});t.classList.add.apply(t.classList,i)}if(e.group&&t.classList.add("ol-group"),super({element:t,target:e.target}),this.set("toggleOne",e.toggleOne),this.set("autoDeactivate",e.autoDeactivate),this.controls_=[],e.controls instanceof Array)for(var o=0;o-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;t0?this.set("max",Number(t)):t=this.get("max"),t){var o=Math.round(e/t*100);ol.ext.element.setStyle(this._progress,{display:""}),this._progressbar.className=o?"":"notransition",ol.ext.element.setStyle(this._progressbar,{width:o+"%"})}else ol.ext.element.setStyle(this._progress,{display:"none"});this._progressMessage.innerHTML="",ol.ext.element.setHTML(this._progressMessage,i||"")}else ol.ext.element.setStyle(this._progress,{display:"none"})}_onButton(e,t){return function(i){i.preventDefault(),"submit"===e&&!1===this.get("closeOnSubmit")||this.hide();var o=this.getInputs();this.dispatchEvent({type:"button",button:e,inputs:o}),"function"==typeof t&&t(e,o)}.bind(this)}getInputs(){var e={};return["input","textarea","select"].forEach(function(t){this.element.querySelectorAll("form "+t).forEach(function(t){t.className&&t.className.split(" ").forEach(function(i){e[i]=t})})}.bind(this)),e}hide(){this.element.classList.remove("ol-visible"),this.dispatchEvent({type:"hide"})}close(){this.hide()}isOpen(){return this.element.classList.contains("ol-visible")}},ol.control.Disable=class extends ol.control.Control{constructor(e){e=e||{};var t=document.createElement("div");t.className=(e.className||" ol-disable ol-unselectable ol-control").trim();var i={top:"0px",left:"0px",right:"0px",bottom:"0px",zIndex:1e4,background:"none",display:"none"};Object.keys(i).forEach(function(e){t.style[e]=i[e]}),super({element:t})}isOn(){return this.element.classList.contains("ol-disable")}disableMap(e){e?(this.element.classList.add("ol-enable"),this.element.style.display="block"):(this.element.classList.remove("ol-enable"),this.element.style.display="none")}},ol.control.EditBar=class extends ol.control.Bar{constructor(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),!1!==e.edition&&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"):"string"==typeof e?e:e.title}_setSelectInteraction(e){var t,i=this,o=new ol.control.Bar;if(!1!==e.interactions.Delete){e.interactions.Delete instanceof ol.interaction.Delete?this._interactions.Delete=e.interactions.Delete:this._interactions.Delete=new ol.interaction.Delete;var s=this._interactions.Delete;s.setActive(!1),this.getMap()&&this.getMap().addInteraction(s),o.addControl(new ol.control.Button({className:"ol-delete",title:this._getTitle(e.interactions.Delete)||"Delete",name:"Delete",handleClick:function(e){s.delete(t.getInteraction().getFeatures());var i={type:"select",selected:[],deselected:t.getInteraction().getFeatures().getArray().slice(),mapBrowserEvent:e.mapBrowserEvent};t.getInteraction().getFeatures().clear(),t.getInteraction().dispatchEvent(i)}}))}if(!1!==e.interactions.Info&&o.addControl(new ol.control.Button({className:"ol-info",name:"Info",title:this._getTitle(e.interactions.Info)||"Show informations",handleClick:function(){i.dispatchEvent({type:"info",features:t.getInteraction().getFeatures()})}})),!1!==e.interactions.Select){e.interactions.Select instanceof ol.interaction.Select?this._interactions.Select=e.interactions.Select:this._interactions.Select=new ol.interaction.Select({condition:ol.events.condition.click});var r=this._interactions.Select;t=new ol.control.Toggle({className:"ol-selection",name:"Select",title:this._getTitle(e.interactions.Select)||"Select",interaction:r,bar:o.getControls().length?o:void 0,autoActivate:!0,active:!0}),this.addControl(t),r.on("change:active",function(){r.getActive()||r.getFeatures().clear()})}}_setEditInteraction(e){if(!1!==e.interactions.DrawPoint){e.interactions.DrawPoint instanceof ol.interaction.Draw?this._interactions.DrawPoint=e.interactions.DrawPoint:this._interactions.DrawPoint=new ol.interaction.Draw({type:"Point",source:this._source});var t=new ol.control.Toggle({className:"ol-drawpoint",name:"DrawPoint",title:this._getTitle(e.interactions.DrawPoint)||"Point",interaction:this._interactions.DrawPoint});this.addControl(t)}if(!1!==e.interactions.DrawLine){e.interactions.DrawLine instanceof ol.interaction.Draw?this._interactions.DrawLine=e.interactions.DrawLine:this._interactions.DrawLine=new ol.interaction.Draw({type:"LineString",source:this._source,geometryFunction:function(e,t){return t?t.setCoordinates(e):t=new ol.geom.LineString(e),this.nbpts=t.getCoordinates().length,t}});var i=new ol.control.Toggle({className:"ol-drawline",title:this._getTitle(e.interactions.DrawLine)||"LineString",name:"DrawLine",interaction:this._interactions.DrawLine,bar:new ol.control.Bar({controls:[new ol.control.TextButton({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 ol.control.TextButton({html:this._getTitle(e.interactions.FinishDraw)||"finish",title:this._getTitle(e.interactions.FinishDraw)||"finish",handleClick:function(){i.getInteraction().nbpts>2&&i.getInteraction().finishDrawing()}})]})});this.addControl(i)}if(!1!==e.interactions.DrawPolygon&&(e.interactions.DrawPolygon instanceof ol.interaction.Draw?this._interactions.DrawPolygon=e.interactions.DrawPolygon:this._interactions.DrawPolygon=new ol.interaction.Draw({type:"Polygon",source:this._source,geometryFunction:function(e,t){return this.nbpts=e[0].length,t?t.setCoordinates([e[0].concat([e[0][0]])]):t=new ol.geom.Polygon(e),t}}),this._setDrawPolygon("ol-drawpolygon",this._interactions.DrawPolygon,this._getTitle(e.interactions.DrawPolygon)||"Polygon","DrawPolygon",e)),!1!==e.interactions.DrawHole&&(e.interactions.DrawHole instanceof ol.interaction.DrawHole?this._interactions.DrawHole=e.interactions.DrawHole:this._interactions.DrawHole=new ol.interaction.DrawHole,this._setDrawPolygon("ol-drawhole",this._interactions.DrawHole,this._getTitle(e.interactions.DrawHole)||"Hole","DrawHole",e)),!1!==e.interactions.DrawRegular){var o={pts:"pts",circle:"circle"};e.interactions.DrawRegular instanceof ol.interaction.DrawRegular?(this._interactions.DrawRegular=e.interactions.DrawRegular,o.pts=this._interactions.DrawRegular.get("ptsLabel")||o.pts,o.circle=this._interactions.DrawRegular.get("circleLabel")||o.circle):(this._interactions.DrawRegular=new ol.interaction.DrawRegular({source:this._source,sides:4}),e.interactions.DrawRegular&&(o.pts=e.interactions.DrawRegular.ptsLabel||o.pts,o.circle=e.interactions.DrawRegular.circleLabel||o.circle));var s=this._interactions.DrawRegular,r=document.createElement("DIV"),a=ol.ext.element.create("DIV",{parent:r});ol.ext.element.addListener(a,["click","touchstart"],function(){var e=s.getSides()-1;e<2&&(e=2),s.setSides(e),n.textContent=e>2?e+" "+o.pts:o.circle}.bind(this));var n=ol.ext.element.create("TEXT",{html:"4 "+o.pts,parent:r}),l=ol.ext.element.create("DIV",{parent:r});ol.ext.element.addListener(l,["click","touchstart"],function(){var e=s.getSides()+1;e<3&&(e=3),s.setSides(e),n.textContent=e+" "+o.pts}.bind(this));var h=new ol.control.Toggle({className:"ol-drawregular",title:this._getTitle(e.interactions.DrawRegular)||"Regular",name:"DrawRegular",interaction:this._interactions.DrawRegular,bar:new ol.control.Bar({controls:[new ol.control.TextButton({html:r})]})});this.addControl(h)}}_setDrawPolygon(e,t,i,o,s){var r=new ol.control.Toggle({className:e,name:o,title:i,interaction:t,bar:new ol.control.Bar({controls:[new ol.control.TextButton({html:this._getTitle(s.interactions.UndoDraw)||"undo",title:this._getTitle(s.interactions.UndoDraw)||"undo last point",handleClick:function(){r.getInteraction().nbpts>1&&r.getInteraction().removeLastPoint()}}),new ol.control.TextButton({html:this._getTitle(s.interactions.FinishDraw)||"finish",title:this._getTitle(s.interactions.FinishDraw)||"finish",handleClick:function(){r.getInteraction().nbpts>3&&r.getInteraction().finishDrawing()}})]})});return this.addControl(r),r}_setModifyInteraction(e){if(!1!==e.interactions.ModifySelect&&!1!==e.interactions.Select&&(e.interactions.ModifySelect instanceof ol.interaction.ModifyFeature?this._interactions.ModifySelect=e.interactions.ModifySelect:this._interactions.ModifySelect=new ol.interaction.ModifyFeature({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))),!1!==e.interactions.Transform){e.interactions.Transform instanceof ol.interaction.Transform?this._interactions.Transform=e.interactions.Transform:this._interactions.Transform=new ol.interaction.Transform({addCondition:ol.events.condition.shiftKeyOnly});var t=new ol.control.Toggle({html:"",className:"ol-transform",title:this._getTitle(e.interactions.Transform)||"Transform",name:"Transform",interaction:this._interactions.Transform});this.addControl(t)}if(!1!==e.interactions.Split){e.interactions.Split instanceof ol.interaction.Split?this._interactions.Split=e.interactions.Split:this._interactions.Split=new ol.interaction.Split({sources:this._source});var i=new ol.control.Toggle({className:"ol-split",title:this._getTitle(e.interactions.Split)||"Split",name:"Split",interaction:this._interactions.Split});this.addControl(i)}if(!1!==e.interactions.Offset){e.interactions.Offset instanceof ol.interaction.Offset?this._interactions.Offset=e.interactions.Offset:this._interactions.Offset=new ol.interaction.Offset({source:this._source});var o=new ol.control.Toggle({html:"",className:"ol-offset",title:this._getTitle(e.interactions.Offset)||"Offset",name:"Offset",interaction:this._interactions.Offset});this.addControl(o)}}},ol.control.Gauge=class extends ol.control.Control{constructor(e){e=e||{};var t=ol.ext.element.create("DIV",{className:((e.className||"")+" ol-gauge ol-unselectable ol-control").trim()});super({element:t,target:e.target}),this.title_=ol.ext.element.create("SPAN",{parent:t});var i=ol.ext.element.create("DIV",{parent:t});this.gauge_=ol.ext.element.create("BUTTON",{type:"button",style:{width:"0px"},parent:i}),this.setTitle(e.title),this.set("max",e.max||100),this.val(e.val)}setTitle(e){this.title_.innerHTML=e||"",this.title_.display=e?"":"none"}val(e){return void 0!==e&&(this.val_=e,this.gauge_.style.width=e/this.get("max")*100+"%"),this.val_}},ol.control.GeoBookmark=class extends ol.control.Control{constructor(e){e=e||{};var t=document.createElement("div");super({element:t,target:e.target});var i=this;e.target?t.className=e.className||"ol-bookmark":(t.className=(e.className||"ol-bookmark")+" ol-unselectable ol-control ol-collapsed",t.addEventListener("mouseleave",function(){r!==document.activeElement&&(o.style.display="none")}),this.button=ol.ext.element.create("BUTTON",{type:"button",title:e.title||"Geobookmarks",click:function(){var e=""===o.style.display||"none"===o.style.display;o.style.display=e?"block":"none",e&&this.setBookmarks()}.bind(this)}),t.appendChild(this.button));var o=document.createElement("div");t.appendChild(o);var s=document.createElement("ul");o.appendChild(s);var r=document.createElement("input");r.setAttribute("placeholder",e.placeholder||"Add a new geomark..."),r.addEventListener("keydown",function(e){if(e.stopPropagation(),13===e.keyCode){e.preventDefault();var t=this.value;t&&(i.addBookmark(t),this.value="",i.dispatchEvent({type:"add",name:t})),o.style.display="none"}}),r.addEventListener("blur",function(){o.style.display="none"}),o.appendChild(r),this.on("propertychange",function(e){"editable"===e.key&&(t.className=t.className.replace(" ol-editable",""),this.get("editable")&&(t.className+=" ol-editable"))}.bind(this)),this.set("namespace",e.namespace||"ol"),this.set("editable",!1!==e.editable),this.set("deleteTitle",e.deleteTitle||"Suppr.");var a={};try{localStorage[this.get("namespace")+"@bookmark"]&&(a=JSON.parse(localStorage[this.get("namespace")+"@bookmark"]))}catch(e){console.warn("Failed to access localStorage...")}if(e.marks)for(var n in e.marks)a[n]=e.marks[n];this.setBookmarks(a)}setBookmarks(e){if(!e){e={};try{e=JSON.parse(localStorage[this.get("namespace")+"@bookmark"]||"{}")}catch(e){console.warn("Failed to access localStorage...")}}var t=this.get("editable"),i=this.element.querySelector("ul"),o=this.element.querySelector("div"),s=this;for(var r in i.innerHTML="",e){var a=document.createElement("li");if(a.textContent=r,a.setAttribute("data-bookmark",JSON.stringify(e[r])),a.setAttribute("data-name",r),a.addEventListener("click",function(){var e=JSON.parse(this.getAttribute("data-bookmark"));s.getMap().getView().setCenter(e.pos),s.getMap().getView().setZoom(e.zoom),s.getMap().getView().setRotation(e.rot||0),o.style.display="none",s.dispatchEvent({type:"select",name:this.getAttribute("data-name"),bookmark:e})}),i.appendChild(a),t&&!e[r].permanent){var n=document.createElement("button");n.setAttribute("data-name",r),n.setAttribute("type","button"),n.setAttribute("title",this.get("deleteTitle")||"Suppr."),n.addEventListener("click",function(e){s.removeBookmark(this.getAttribute("data-name")),s.dispatchEvent({type:"remove",name:this.getAttribute("data-name")}),e.stopPropagation()}),a.appendChild(n)}}try{localStorage[this.get("namespace")+"@bookmark"]=JSON.stringify(e)}catch(e){console.warn("Failed to access localStorage...")}}getBookmarks(){var e={};try{e=JSON.parse(localStorage[this.get("namespace")+"@bookmark"]||"{}")}catch(e){console.warn("Failed to access localStorage...")}return e}removeBookmark(e){if(e){var t=this.getBookmarks();delete t[e],this.setBookmarks(t)}}addBookmark(e,t,i,o){if(e){var s,r=t;r&&r.position?(i=r.zoom,o=r.permanent,s=r.rotation,t=r.position):s=this.getMap().getView().getRotation();var a=this.getBookmarks();a[e]&&a[e].permanent||(a[e]={pos:t||this.getMap().getView().getCenter(),zoom:i||this.getMap().getView().getZoom(),permanent:!!o},s&&(a[e].rot=s),this.setBookmarks(a))}}},ol.control.GeolocationBar=class extends ol.control.Bar{constructor(e){(e=e||{}).className=e.className||"ol-geobar",super(e),this.setPosition(e.position||"bottom-right");var t=this.element,i=new ol.interaction.GeolocationDraw({source:e.source,zoom:e.zoom,minZoom:e.minZoom,tolerance:e.tolerance,followTrack:e.followTrack,minAccuracy:e.minAccuracy||1e4});this._geolocBt=new ol.control.Toggle({className:"geolocBt",interaction:i,onToggle:function(){i.pause(!0),i.setFollowTrack(e.followTrack),t.classList.remove("pauseTrack")}}),this.addControl(this._geolocBt),this._geolocBt.setActive(!1);var o=new ol.control.Bar;this.addControl(o);var s=new ol.control.TextButton({className:"centerBt",html:e.centerLabel||"center",handleClick:function(){i.setFollowTrack("auto")}});o.addControl(s);var r=new ol.control.Button({className:"startBt",handleClick:function(){i.pause(!1),i.setFollowTrack("auto"),t.classList.add("pauseTrack")}});o.addControl(r);var a=new ol.control.Button({className:"pauseBt",handleClick:function(){i.pause(!0),i.setFollowTrack("auto"),t.classList.remove("pauseTrack")}});o.addControl(a),i.on("follow",function(e){e.following?t.classList.remove("centerTrack"):t.classList.add("centerTrack")}),this._geolocBt.on("change:active",function(e){e.active?t.classList.add("ol-active"):t.classList.remove("ol-active")})}setMap(e){this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,super.setMap(e),e&&(this._listener=e.on("moveend",function(){var t=this.getInteraction();t.getActive()&&"auto"===t.get("followTrack")&&t.path_.length&&t.path_[t.path_.length-1][0]!==e.getView().getCenter()[0]&&this.element.classList.add("centerTrack")}.bind(this)))}getInteraction(){return this._geolocBt.getInteraction()}},ol.control.GeolocationButton=class extends ol.control.Toggle{constructor(e){(e=e||{}).followTrack=e.followTrack||"auto",e.zoom=e.zoom||16;var t,i=new ol.interaction.GeolocationDraw(e);super({className:e.className=((e.className||"")+" ol-geobt").trim(),interaction:i,title:e.title||"Geolocation",onToggle:function(){i.pause(!0),i.setFollowTrack(e.followTrack||"auto")}}),this.setActive(!1),i.on("tracking",function(e){this.dispatchEvent({type:"position",coordinate:e.geolocation.getPosition()})}.bind(this)),i.on("change:active",function(){this.dispatchEvent({type:"position"}),t&&(clearTimeout(t),t=null),i.getActive()&&(t=setTimeout(function(){i.setActive(!1),t=null}.bind(this),e.delay||3e3))}.bind(this))}},ol.control.Globe=class extends ol.control.Control{constructor(e){var t=e||{},i=document.createElement("div");super({element:i,target:t.target});var o=this;t.target?this.panel_=t.target:(i.classList.add("ol-globe","ol-unselectable","ol-control"),/top/.test(t.align)&&i.classList.add("ol-control-top"),/right/.test(t.align)&&i.classList.add("ol-control-right"),this.panel_=document.createElement("div"),this.panel_.classList.add("panel"),i.appendChild(this.panel_),this.pointer_=document.createElement("div"),this.pointer_.classList.add("ol-pointer"),i.appendChild(this.pointer_)),this.ovmap_=new ol.Map({controls:new ol.Collection,interactions:new ol.Collection,target:this.panel_,view:new ol.View({zoom:0,center:[0,0]}),layers:t.layers}),setTimeout(function(){o.ovmap_.updateSize()},0),this.set("follow",t.follow||!1),this.extentLayer=new ol.layer.Vector({name:"Cache extent",source:new ol.source.Vector,style:t.style||[new ol.style.Style({image:new ol.style.Circle({fill:new ol.style.Fill({color:"rgba(255,0,0, 1)"}),stroke:new ol.style.Stroke({width:7,color:"rgba(255,0,0, 0.8)"}),radius:5})})]}),this.ovmap_.addLayer(this.extentLayer)}setMap(e){this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,ol.control.Control.prototype.setMap.call(this,e),e&&(this._listener=e.getView().on("propertychange",this.setView.bind(this)),this.setView())}setView(){this.getMap()&&this.get("follow")&&this.setCenter(this.getMap().getView().getCenter())}getGlobe(){return this.ovmap_}show(e){!1!==e?this.element.classList.remove("ol-collapsed"):this.element.classList.add("ol-collapsed"),this.ovmap_.updateSize()}setPosition(e){/top/.test(e)?this.element.classList.add("ol-control-top"):this.element.classList.remove("ol-control-top"),/right/.test(e)?this.element.classList.add("ol-control-right"):this.element.classList.remove("ol-control-right")}setCenter(e,t){var i=this;if(this.pointer_.classList.add("hidden"),e){var o=this.ovmap_,s=o.getPixelFromCoordinate(e);if(s){if(!1!==t){var r=this.element.clientHeight;setTimeout(function(){i.pointer_.style.top=String(Math.min(Math.max(s[1],0),r))+"px",i.pointer_.style.left="50%",i.pointer_.classList.remove("hidden")},800)}o.getView().animate({center:[e[0],0]})}}}},ol.control.Graticule=class extends ol.control.CanvasBase{constructor(e){e=e||{};var t=document.createElement("div");t.className="ol-graticule ol-unselectable ol-hidden",super({element:t}),this.set("projection",e.projection||"EPSG:4326");var i=new ol.proj.Projection({code:this.get("projection")}).getMetersPerUnit();for(this.fac=1;i/this.fac>10;)this.fac*=10;this.fac=1e4/this.fac,this.set("maxResolution",e.maxResolution||1/0),this.set("step",e.step||.1),this.set("stepCoord",e.stepCoord||1),this.set("spacing",e.spacing||40),this.set("intervals",e.intervals),this.set("precision",e.precision),this.set("margin",e.margin||0),this.set("borderWidth",e.borderWidth||5),this.set("stroke",!1!==e.stroke),this.formatCoord=e.formatCoord||function(e){return e},e.style instanceof ol.style.Style?this.setStyle(e.style):this.setStyle(new ol.style.Style({stroke:new ol.style.Stroke({color:"#000",width:1}),fill:new ol.style.Fill({color:"#fff"}),text:new ol.style.Text({stroke:new ol.style.Stroke({color:"#fff",width:2}),fill:new ol.style.Fill({color:"#000"})})}))}setStyle(e){this._style=e}_draw(e){if(!(this.get("maxResolution")r)(f*=Math.round((c-u)/r*m/f))>this.fac&&(f=Math.round(f/this.fac)*this.fac);var x=this.get("intervals");if(Array.isArray(x)){for(var b=x[0],w=(p=0,x.length);p=x[p]);++p)b=x[p];f=b}var S=this.get("precision"),M=f;S>0&&f>S&&(M=f/Math.ceil(f/S)),u=Math.floor(u/f)*f-f,g=Math.floor(g/f)*f-f,c=Math.floor(c/f)*f+2*f,d=Math.floor(d/f)*f+2*f;var C=ol.proj.get(n).getExtent();C&&(uC[2]&&(c=C[2]+f),d>C[3]&&(d=C[3]+f));var E=this.getStyle().getStroke()&&this.get("stroke"),L=this.getStyle().getText(),T=this.getStyle().getFill();i.save(),i.scale(s,s),i.beginPath(),i.rect(_,_,r-2*_,a-2*_),i.clip(),i.beginPath();var P,k,A,I,F,N={top:[],left:[],bottom:[],right:[]};for(P=u;P0&&F[1]<0&&N.top.push([P,A]),A[1]>a&&F[1]0&&N.left.push([k,A]),A[0]r&&N.right.push([k,A]),A=F;if(E&&(i.strokeStyle=this.getStyle().getStroke().getColor(),i.lineWidth=this.getStyle().getStroke().getWidth(),i.stroke()),L){var D,O;i.fillStyle=this.getStyle().getText().getFill().getColor(),i.strokeStyle=this.getStyle().getText().getStroke().getColor(),i.lineWidth=this.getStyle().getText().getStroke().getWidth(),i.font=this.getStyle().getText().getFont(),i.textAlign="center",i.textBaseline="hanging";var R=(T?y:0)+_+2;for(p=0;D=N.top[p];p++)Math.round(D[0]/this.get("step"))%v||(O=this.formatCoord(D[0],"top"),i.strokeText(O,D[1][0],R),i.fillText(O,D[1][0],R));for(i.textBaseline="alphabetic",p=0;D=N.bottom[p];p++)Math.round(D[0]/this.get("step"))%v||(O=this.formatCoord(D[0],"bottom"),i.strokeText(O,D[1][0],a-R),i.fillText(O,D[1][0],a-R));for(i.textBaseline="middle",i.textAlign="left",p=0;D=N.left[p];p++)Math.round(D[0]/this.get("step"))%v||(O=this.formatCoord(D[0],"left"),i.strokeText(O,R,D[1][1]),i.fillText(O,R,D[1][1]));for(i.textAlign="right",p=0;D=N.right[p];p++)Math.round(D[0]/this.get("step"))%v||(O=this.formatCoord(D[0],"right"),i.strokeText(O,r-R,D[1][1]),i.fillText(O,r-R,D[1][1]))}if(T){var G,V,B=this.getStyle().getFill().getColor();for((V=this.getStyle().getStroke())?G=this.getStyle().getStroke().getColor():(G=B,B="#fff"),i.strokeStyle=G,i.lineWidth=V?V.getWidth():1,p=1;p=i[0])return"";var s=Math.floor((t[3]-e[1])/(t[3]-t[1])*i[1]);return s<0||s>=i[1]?"":this.getHIndex(o)+this.getVIndex(s)}}getVIndex(e){return e}getHIndex(e){return String.fromCharCode(65+e)}_draw(e){if(!(this.get("maxResolution")r?(y=r-_,t.textBaseline="alphabetic"):t.textBaseline="hanging",t.strokeText(f,v,y),t.fillText(f,v,y);for(t.textBaseline="middle",p=0;ps?(v=s-_,t.textAlign="right"):t.textAlign="left",t.strokeText(f,v,y),t.fillText(f,v,y);t.restore()}}},ol.control.Imageline=class extends ol.control.Control{constructor(e){var t=ol.ext.element.create("DIV",{className:(e.className||"")+" ol-imageline"+(e.target?"":" ol-unselectable ol-control")+(e.collapsed&&e.collapsible?"ol-collapsed":"")});super({element:t,target:e.target}),!e.target&&e.collapsible&&ol.ext.element.create("BUTTON",{type:"button",click:function(){this.toggle()}.bind(this),parent:t}),e.source&&(this._sources=e.source.forEach?e.source:[e.source]),e.layers&&this.setLayers(e.layers),this._setScrolling(),this._scrolldiv.addEventListener("scroll",function(){this.getMap()&&this.getMap().render()}.bind(this)),"function"==typeof e.getImage&&(this._getImage=e.getImage),"function"==typeof e.getTitle&&(this._getTitle=e.getTitle),this.set("maxFeatures",e.maxFeatures||100),this.set("linkColor",e.linkColor||!1),this.set("hover",e.hover||!1),this.set("useExtent",e.useExtent||!1),this.refresh()}setMap(e){this._listener&&this._listener.forEach(function(e){ol.Observable.unByKey(e)}.bind(this)),this._listener=null,super.setMap(e),e&&(this._listener=[e.on("postcompose",this._drawLink.bind(this)),e.on("moveend",function(){this.get("useExtent")&&this.refresh()}.bind(this))],this.refresh())}setLayers(e){this._sources=this._getSources(e)}_getSources(e){var t=[];return e.forEach(function(e){e.getVisible()&&(e.getSource()&&e.getSource().getFeatures?t.push(e.getSource()):e.getLayers&&this._getSources(e.getLayers()))}.bind(this)),t}useExtent(e){this.set("useExtent",e),this.refresh()}isCollapsed(){return this.element.classList.contains("ol-collapsed")}collapse(e){e?this.element.classList.add("ol-collapsed"):this.element.classList.remove("ol-collapsed"),this.getMap()&&setTimeout(function(){this.getMap().render()}.bind(this),this.isCollapsed()?0:250),this.dispatchEvent({type:"collapse",collapsed:this.isCollapsed()})}toggle(){this.element.classList.toggle("ol-collapsed"),this.getMap()&&setTimeout(function(){this.getMap().render()}.bind(this),this.isCollapsed()?0:250),this.dispatchEvent({type:"collapse",collapsed:this.isCollapsed()})}_getImage(e){return e.get("img")}_getTitle(){return""}getFeatures(){var e=this.getMap();if(!e)return[];var t=[];return(this._sources||this._getSources(e.getLayers())).forEach(function(i){if(t.lengtho[0]?(t.moveTo((o[0]-5)*i,o[1]*i),t.lineTo((o[0]+5)*i,(o[1]+5)*i)):(t.moveTo((o[0]-5)*i,(o[1]+5)*i),t.lineTo((o[0]+5)*i,o[1]*i)),t.lineTo(s[0]*i,s[1]*i),t.fill(),t.restore()}}},ol.control.IsochroneGeoportail=class extends ol.control.Control{constructor(e){e||(e={}),null==e.typing&&(e.typing=300);var t=(e.className?e.className:"")+" ol-isochrone ol-routing";e.target||(t+=" ol-unselectable ol-control");var i=ol.ext.element.create("DIV",{className:t});e.target||ol.ext.element.create("BUTTON",{parent:i}).addEventListener("click",function(){i.classList.toggle("ol-collapsed")});super({element:i,target:e.target});var o=this;this.set("iter",1);var s=ol.ext.element.create("DIV",{className:"content",parent:i});this._addSearchCtrl(s,e),ol.ext.element.create("BUTTON",{className:"ol-button ol-method-time selected",title:"isochrone",parent:s}).addEventListener("click",function(){this.setMethod("time")}.bind(this)),ol.ext.element.create("I",{className:"ol-button ol-method-distance",title:"isodistance",parent:s}).addEventListener("click",function(){this.setMethod("distance")}.bind(this)),ol.ext.element.create("I",{className:"ol-button ol-car selected",title:"by car",parent:s}).addEventListener("click",function(){this.setMode("car")}.bind(this)),ol.ext.element.create("I",{className:"ol-button ol-pedestrian",title:"by foot",parent:s}).addEventListener("click",function(){this.setMode("pedestrian")}.bind(this)),ol.ext.element.create("I",{className:"ol-button ol-direction-direct selected",title:"direct",parent:s}).addEventListener("click",function(){this.setDirection("direct")}.bind(this)),ol.ext.element.create("I",{className:"ol-button ol-direction-reverse",title:"reverse",parent:s}).addEventListener("click",function(){this.setDirection("reverse")}.bind(this));var r=ol.ext.element.create("DIV",{className:"ol-time",parent:s});ol.ext.element.create("DIV",{html:"isochrone:",parent:r}),ol.ext.element.create("INPUT",{type:"number",parent:r,min:0}).addEventListener("change",function(){o.set("hour",Number(this.value))}),ol.ext.element.create("TEXT",{parent:r,html:"h"}),ol.ext.element.create("INPUT",{type:"number",parent:r,min:0}).addEventListener("change",function(){o.set("minute",Number(this.value))}),ol.ext.element.create("TEXT",{parent:r,html:"mn"}),r=ol.ext.element.create("DIV",{className:"ol-distance",parent:s}),ol.ext.element.create("DIV",{html:"isodistance:",parent:r}),ol.ext.element.create("INPUT",{type:"number",step:"any",parent:r,min:0}).addEventListener("change",function(){o.set("distance",Number(this.value))}),ol.ext.element.create("TEXT",{parent:r,html:"km"}),r=ol.ext.element.create("DIV",{className:"ol-iter",parent:s}),ol.ext.element.create("DIV",{html:"Iteration:",parent:r}),ol.ext.element.create("INPUT",{type:"number",parent:r,value:1,min:1}).addEventListener("change",function(){o.set("iter",Number(this.value))}),ol.ext.element.create("I",{className:"ol-ok",html:"ok",parent:s}).addEventListener("click",function(){var e=0;switch(this.get("method")){case"distance":e=1e3*this.get("distance");break;default:e=3600*(this.get("hour")||0)+60*(this.get("minute")||0)}e&&this.get("coordinate")&&this.search(this.get("coordinate"),e)}.bind(this)),this.set("url","https://wxs.ign.fr/"+(e.apiKey||"essentiels")+"/isochrone/isochrone.json"),this._ajax=new ol.ext.Ajax({dataType:"JSON",auth:e.auth}),this._ajax.on("success",this._success.bind(this)),this._ajax.on("error",this._error.bind(this)),this._ajax.on("loadstart",function(){this.element.classList.add("ol-searching")}.bind(this)),this._ajax.on("loadend",function(){this.element.classList.remove("ol-searching")}.bind(this)),this.setMethod(e.method)}setMap(e){super.setMap(e),this._search.setMap(e)}_addSearchCtrl(e,t){var i=ol.ext.element.create("DIV",{parent:e}),o=this._search=new ol.control.SearchGeoportail({className:"IGNF ol-collapsed",apiKey:t.apiKey,target:i});o.on("select",function(e){o.setInput(e.search.fulltext),this.set("coordinate",e.coordinate)}.bind(this)),o.on("change:input",function(){this.set("coordinate",!1)}.bind(this))}setMethod(e){e=/distance/.test(e)?"distance":"time",this.element.querySelector(".ol-method-time").classList.remove("selected"),this.element.querySelector(".ol-method-distance").classList.remove("selected"),this.element.querySelector(".ol-method-"+e).classList.add("selected"),this.element.querySelector("div.ol-time").classList.remove("selected"),this.element.querySelector("div.ol-distance").classList.remove("selected"),this.element.querySelector("div.ol-"+e).classList.add("selected"),this.set("method",e)}setMode(e){this.set("mode",e),this.element.querySelector(".ol-car").classList.remove("selected"),this.element.querySelector(".ol-pedestrian").classList.remove("selected"),this.element.querySelector(".ol-"+e).classList.add("selected")}setDirection(e){this.set("direction",e),this.element.querySelector(".ol-direction-direct").classList.remove("selected"),this.element.querySelector(".ol-direction-reverse").classList.remove("selected"),this.element.querySelector(".ol-direction-"+e).classList.add("selected")}search(e,t,i){var o=this.getMap()?this.getMap().getView().getProjection():"EPSG:3857",s=/distance/.test(this.get("method"))?"distance":"time";if("string"==typeof t){var r=t.replace(/([0-9|.]*)([a-z]*)$/,"$2");switch(s="time",t=parseFloat(t),r){case"mn":t*=60;break;case"h":t*=3600;break;case"m":s="distance";break;case"km":s="distance",t*=1e3}}var a=Math.round(t*(this.get("iter")-(i||0))/this.get("iter"));if("number"==typeof t){var n={"gp-access-lib":"2.1.0",location:ol.proj.toLonLat(e,o),graphName:"pedestrian"===this.get("mode")?"Pieton":"Voiture",exclusions:this.get("exclusions")||void 0,method:s,time:"time"===s?a:void 0,distance:"distance"===s?a:void 0,reverse:"reverse"===this.get("direction"),smoothing:this.get("smoothing")||!0,holes:this.get("holes")||!1};this._ajax.send(this.get("url"),n,{coord:e,option:t,data:n,iteration:(i||0)+1})}}_success(e){var t=this.getMap()?this.getMap().getView().getProjection():"EPSG:3857",i=new ol.format.WKT,o=e.response;o.feature=i.readFeature(o.wktGeometry,{dataProjection:"EPSG:4326",featureProjection:t}),o.feature.set("iteration",e.options.iteration),o.feature.set("method",e.options.data.method),o.feature.set(e.options.data.method,e.options.data[e.options.data.method]),delete o.wktGeometry,o.type="isochrone",o.iteration=e.options.iteration-1,this.dispatchEvent(o),e.options.iteration=0?setTimeout(function(){o.classList.add("ol-collapsed"),i._listener=null},t||3e3):null},100)}hide(){this._listener&&(clearTimeout(this._listener),this._listener=null),this.element.classList.add("ol-collapsed")}toggle(e){this.element.classList.contains("ol-collapsed")?this.show(null,e):this.hide()}},ol.control.Overlay=class extends ol.control.Control{constructor(e){e=e||{};var t=ol.ext.element.create("DIV",{className:"ol-unselectable ol-overlay "+(e.className||""),html:e.content});super({element:t,target:e.target});var i=this;e.hideOnClick&&t.addEventListener("click",function(){i.hide()}),this.set("closeBox",e.closeBox),this._timeout=!1,this.setContent(e.content)}setContent(e){var t=this;if(e){var i=this.element;if(e instanceof Element?(i.innerHTML="",i.appendChild(e)):void 0!==e&&(i.innerHTML=e),this.get("closeBox")){var o=document.createElement("div");o.classList.add("ol-closebox"),o.addEventListener("click",function(){t.hide()}),i.insertBefore(o,i.firstChild)}}}show(e,t){var i=this,o=this.element;o.style.display="block",t?(this.center_=this.getMap().getPixelFromCoordinate(t),o.style.top=this.center_[1]+"px",o.style.left=this.center_[0]+"px"):(this.center_=!1,o.style.top="",o.style.left=""),e&&this.setContent(e),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(function(){o.classList.add("ol-visible"),o.style.top="",o.style.left="",i.dispatchEvent({type:"change:visible",visible:!0,element:i.element})},10)}showImage(e,t){t=t||{};var i=ol.ext.element.create("DIV",{className:"ol-fullscreen-image"});ol.ext.element.create("IMG",{src:e,parent:i}),t.title&&(i.classList.add("ol-has-title"),ol.ext.element.create("P",{html:t.title,parent:i})),this.show(i,t.coordinate)}hide(){var e=this.element;this.element.classList.remove("ol-visible"),this.center_&&(e.style.top=this.center_[1]+"px",e.style.left=this.center_[0]+"px",this.center_=!1),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(function(){e.style.display="none"},500),this.dispatchEvent({type:"change:visible",visible:!1,element:this.element})}toggle(){this.getVisible()?this.hide():this.show()}getVisible(){return"none"!==ol.ext.element.getStyle(this.element,"display")}setClass(e){var t=this.element.classList.contains("ol-visible");this.element.className=("ol-unselectable ol-overlay "+(t?"ol-visible ":"")+e).trim()}},ol.control.Overview=class extends ol.control.Control{constructor(e){e=e||{};var t=document.createElement("div");super({element:t,target:e.target});var i=this;if(this.minZoom=e.minZoom||0,this.maxZoom=e.maxZoom||18,this.rotation=e.rotation,e.target)this.panel_=e.target;else{t.classList.add("ol-overview","ol-unselectable","ol-control","ol-collapsed"),/top/.test(e.align)&&t.classList.add("ol-control-top"),/right/.test(e.align)&&t.classList.add("ol-control-right");var o=document.createElement("button");o.setAttribute("type","button"),o.addEventListener("touchstart",function(e){i.toggleMap(),e.preventDefault()}),o.addEventListener("click",function(){i.toggleMap()}),t.appendChild(o),this.panel_=document.createElement("div"),this.panel_.classList.add("panel"),t.appendChild(this.panel_)}this.ovmap_=new ol.Map({controls:new ol.Collection,interactions:new ol.Collection,target:this.panel_,view:new ol.View({zoom:2,center:[0,0],projection:e.projection}),layers:e.layers}),this.oview_=this.ovmap_.getView(),this.extentLayer=new ol.layer.Vector({name:"Cache extent",source:new ol.source.Vector,style:e.style||[new ol.style.Style({image:new ol.style.Circle({fill:new ol.style.Fill({color:"rgba(255,0,0, 1)"}),stroke:new ol.style.Stroke({width:7,color:"rgba(255,0,0, 0.8)"}),radius:5}),stroke:new ol.style.Stroke({width:5,color:"rgba(255,0,0,0.8)"})})]}),this.ovmap_.addLayer(this.extentLayer);this.ovmap_.addInteraction(new ol.interaction.Pointer({handleDownEvent:function(t){var o,s,r,a,n;return!1!==e.panAnimation?"elastic"==e.panAnimation||e.elasticPan?i.getMap().getView().animate({center:t.coordinate,easing:(o=2,s=.3,r=3*o*Math.PI/2,a=s>0?-1/s:-100,n=Math.cos(r)*Math.pow(2,a),function(e){return e=1-Math.cos(e*Math.PI/2),1-Math.cos(r*e)*Math.pow(2,a*e)+n*e}),duration:1e3}):i.getMap().getView().animate({center:t.coordinate,duration:300}):i.getMap().getView().setCenter(t.coordinate),!1}}))}getOverviewMap(){return this.ovmap_}toggleMap(){this.element.classList.toggle("ol-collapsed"),this.ovmap_.updateSize(),this.setView()}setPosition(e){/top/.test(e)?this.element.classList.add("ol-control-top"):this.element.classList.remove("ol-control-top"),/right/.test(e)?this.element.classList.add("ol-control-right"):this.element.classList.remove("ol-control-right")}setMap(e){if(this._listener)for(var t in this._listener)ol.Observable.unByKey(this._listener[t]);this._listener={},super.setMap(e),e&&(this._listener.map=e.on("change:view",function(){this._listener.view&&ol.Observable.unByKey(this._listener.view),e.getView()&&(this._listener.view=e.getView().on("propertychange",this.setView.bind(this)),this.setView())}.bind(this)),this._listener.view=e.getView().on("propertychange",this.setView.bind(this)),this.setView())}calcExtent_(e){var t=this.getMap();if(t){var i=this.extentLayer.getSource();i.clear();var o=new ol.Feature,s=t.getSize(),r=t.getView().getResolution(),a=t.getView().getRotation(),n=t.getView().getCenter();if(r){var l=r*s[0]/2,h=r*s[1]/2,c=this.oview_.getResolution();if(l/c>5||h/c>5){var u,d,g,p=Math.cos(a),m=Math.sin(a);for(e=[[-l,-h],[-l,h],[l,h],[l,-h]],u=0;u<4;++u)d=e[u][0],g=e[u][1],e[u][0]=n[0]+d*p-g*m,e[u][1]=n[1]+d*m+g*p;o.setGeometry(new ol.geom.Polygon([e]))}else o.setGeometry(new ol.geom.Point(n));i.addFeature(o)}}}setView(e){if(!e)return this.setView({key:"rotation"}),this.setView({key:"resolution"}),void this.setView({key:"center"});switch(e.key){case"rotation":this.rotation?this.oview_.setRotation(this.getMap().getView().getRotation()):this.oview_.getRotation()&&this.oview_.setRotation(0);break;case"center":var t=this.getMap().getView().calculateExtent(this.getMap().getSize()),i=this.oview_.calculateExtent(this.ovmap_.getSize());(t[0]i[2]||t[3]>i[3])&&this.oview_.setCenter(this.getMap().getView().getCenter());break;case"resolution":var o=2*Math.round(this.oview_.getZoomForResolution(this.getMap().getView().getResolution())/2)-4;o=Math.min(this.maxZoom,Math.max(this.minZoom,o)),this.oview_.setZoom(o)}this.calcExtent_()}},ol.control.Permalink=class extends ol.control.Control{constructor(e){var t=e||{},i=document.createElement("div");super({element:i,target:t.target});var o=this,s=document.createElement("button");if(ol.ext.element.create("I",{parent:s}),this.replaceState_=!1!==t.urlReplace,this.fixed_=t.fixed||6,this.hash_=t.anchor?"#":"?",this._localStorage=t.localStorage,!this._localStorage)try{localStorage.removeItem("ol@permalink")}catch(e){console.warn("Failed to access localStorage...")}function r(){"function"==typeof t.onclick?t.onclick(o.getLink()):o.setUrlReplace(!o.replaceState_)}s.addEventListener("click",r,!1),s.addEventListener("touchstart",r,!1),i.className=(t.className||"ol-permalink")+" ol-unselectable ol-control",i.appendChild(s),(t.hidden||!1===t.visible)&&ol.ext.element.hide(i),this.set("geohash",t.geohash),this.set("initial",!1),this.on("change",this.viewChange_.bind(this)),this.search_={};var a={},n=document.location.hash||document.location.search||"";if(this.replaceState_&&!n&&this._localStorage)try{n=localStorage["ol@permalink"]}catch(e){console.warn("Failed to access localStorage...")}if(n){n=n.replace(/(^#|^\?)/,"").split("&");for(var l=0;ll.height?"landscape":"portrait"),"landscape"===u&&(h=[h[1],h[0]]);var g=Math.min((h[0]-2*d)/l.width,(h[1]-2*d)/l.height);s=g*l.width,r=g*l.height,a=[(h[0]-s)/2,(h[1]-r)/2]}try{n=l?l.toDataURL(t,i):null}catch(p){return void this.dispatchEvent({type:"error",canvas:l})}var p=Object.assign({type:"print",print:{format:c,orientation:u,unit:"mm",size:h,position:a,imageWidth:s,imageHeight:r},image:n,imageType:t,quality:i,canvas:l},e);this.dispatchEvent(p)}.bind(this)),this.getMap().render()}}},ol.control.PrintDialog=class extends ol.control.Control{constructor(e){e=e||{};var t=ol.ext.element.create("DIV",{className:(e.className||"ol-print")+" ol-unselectable ol-control"});super({element:t}),this._lang=e.lang||"en",e.target||ol.ext.element.create("BUTTON",{type:"button",title:e.title||"Print",click:function(){this.print()}.bind(this),parent:t}),e.openWindow&&this.on("print",function(e){e.canvas&&window.open().document.write('')}),e.target=e.target||ol.ext.element.create("DIV");var i=this._printCtrl=new ol.control.Print(e);i.on(["print","error","printing"],function(e){s.setAttribute("data-status",e.type),e.clipboard||this.dispatchEvent(e)}.bind(this)),this._compass=new ol.control.Compass({src:e.northImage||"compact",visible:!1,className:"olext-print-compass",style:new ol.style.Stroke({color:"#333",width:0})});var o=this._printDialog=new ol.control.Dialog({target:e.targetDialog||document.body,closeBox:!0,className:"ol-ext-print-dialog"}),s=o.getContentElement();this._input={};var r=ol.ext.element.create("DIV",{className:"ol-print-param",parent:s});this._pages=[ol.ext.element.create("DIV",{className:"ol-page"})];var a=ol.ext.element.create("DIV",{className:"ol-map",parent:this._pages[0]});ol.ext.element.create("DIV",{html:this._pages[0],className:"ol-print-map",parent:s}),ol.ext.element.create("H2",{html:this.i18n("title"),parent:r});var n=ol.ext.element.create("UL",{parent:r}),l=ol.ext.element.create("LI",{className:"ol-orientation",parent:n});this._input.orientation={list:l};var h,c=ol.ext.element.create("LABEL",{className:"portrait",parent:l});this._input.orientation.portrait=ol.ext.element.create("INPUT",{type:"radio",name:"ol-print-orientation",value:"portrait",checked:!0,on:{change:function(e){this.setOrientation(e.target.value)}.bind(this)},parent:c}),ol.ext.element.create("SPAN",{html:this.i18n("portrait"),parent:c}),c=ol.ext.element.create("LABEL",{className:"landscape",parent:l}),this._input.orientation.landscape=ol.ext.element.create("INPUT",{type:"radio",name:"ol-print-orientation",value:"landscape",on:{change:function(e){this.setOrientation(e.target.value)}.bind(this)},parent:c}),ol.ext.element.create("SPAN",{html:this.i18n("landscape"),parent:c}),l=ol.ext.element.create("LI",{html:ol.ext.element.create("LABEL",{html:this.i18n("size")}),className:"ol-size",parent:n});var u=this._input.size=ol.ext.element.create("SELECT",{on:{change:function(){this.setSize(u.value||M)}.bind(this)},parent:l});for(h in this.paperSize)ol.ext.element.create("OPTION",{html:h+(this.paperSize[h]?" - "+this.paperSize[h][0]+"x"+this.paperSize[h][1]+" mm":this.i18n("custom")),value:h,parent:u});l=ol.ext.element.create("LI",{html:ol.ext.element.create("LABEL",{html:this.i18n("margin")}),className:"ol-margin",parent:n});var d=this._input.margin=ol.ext.element.create("SELECT",{on:{change:function(){this.setMargin(d.value)}.bind(this)},parent:l});for(h in this.marginSize)ol.ext.element.create("OPTION",{html:this.i18n(h)+" - "+this.marginSize[h]+" mm",value:this.marginSize[h],parent:d});l=ol.ext.element.create("LI",{html:ol.ext.element.create("LABEL",{html:this.i18n("scale")}),className:"ol-scale",parent:n});var g=this._input.scale=ol.ext.element.create("SELECT",{on:{change:function(){this.setScale(parseInt(g.value))}.bind(this)},parent:l});Object.keys(this.scales).forEach(function(e){ol.ext.element.create("OPTION",{html:this.scales[e],value:e,parent:g})}.bind(this)),l=ol.ext.element.create("LI",{className:"ol-legend",parent:n});var p=ol.ext.element.createSwitch({html:this.i18n("legend"),checked:!1,on:{change:function(){L.legend.control.setCanvas(p.checked)}.bind(this)},parent:l});l=ol.ext.element.create("LI",{className:"ol-print-north",parent:n});var m=this._input.north=ol.ext.element.createSwitch({html:this.i18n("north"),checked:"checked",on:{change:function(){m.checked?this._compass.element.classList.add("ol-print-compass"):this._compass.element.classList.remove("ol-print-compass"),this.getMap().render()}.bind(this)},parent:l});l=ol.ext.element.create("LI",{className:"ol-print-title",parent:n});var f=ol.ext.element.createSwitch({html:this.i18n("mapTitle"),checked:!1,on:{change:function(e){L.title.control.setVisible(e.target.checked)}.bind(this)},parent:l}),v=ol.ext.element.create("INPUT",{type:"text",placeholder:this.i18n("mapTitle"),on:{keydown:function(e){13===e.keyCode&&e.preventDefault()},keyup:function(){L.title.control.setTitle(v.value)},change:function(){L.title.control.setTitle(v.value)}.bind(this)},parent:l}),y=ol.ext.element.create("DIV",{className:"ol-user-param",parent:r});l=ol.ext.element.create("LI",{className:"ol-saveas",parent:n});var _=ol.ext.element.create("DIV",{html:this.i18n("copied"),className:"ol-clipboard-copy",parent:l}),x=ol.ext.element.create("SELECT",{on:{change:function(){if(this.formats[x.value].clipboard)i.copyMap(this.formats[x.value],function(e){e&&(_.classList.add("visible"),setTimeout(function(){_.classList.remove("visible")},1e3))});else{var e="string"==typeof this.getSize()?this.getSize():null,t=Object.assign({format:e,size:e?this.paperSize[e]:null,orient:this.getOrientation(),margin:this.getMargin()},this.formats[x.value]);i.print(t)}x.value=""}.bind(this)},parent:l});ol.ext.element.create("OPTION",{html:this.i18n("saveas"),style:{display:"none"},value:"",parent:x}),this.formats.forEach(function(t,i){if(t.pdf){if(!1===e.pdf)return}else if(t.clipboard){if(!1===e.copy)return}else if(!1===e.save)return;ol.ext.element.create("OPTION",{html:this.i18n(t.title),value:i,parent:x})}.bind(this)),l=ol.ext.element.create("LI",{className:"ol-savelegend",parent:n});var b=ol.ext.element.create("DIV",{html:this.i18n("copied"),className:"ol-clipboard-copy",parent:l}),w=ol.ext.element.create("SELECT",{on:{change:function(){var e=L.legend.control.getLegend().getCanvas(),t=document.createElement("CANVAS");t.width=e.width,t.height=e.height;var i,o=t.getContext("2d");if(o.fillStyle="#fff",o.fillRect(0,0,t.width,t.height),o.drawImage(e,0,0),this.formats[w.value].clipboard)t.toBlob(function(e){try{navigator.clipboard.write([new window.ClipboardItem(Object.defineProperty({},e.type,{value:e,enumerable:!0}))]),b.classList.add("visible"),setTimeout(function(){b.classList.remove("visible")},1e3)}catch(e){}},"image/png");else try{i=t.toDataURL(this.formats[w.value].imageType,this.formats[w.value].quality);var s="string"==typeof this.getSize()?this.getSize():"A4",r=t.width/96*25.4,a=t.height/96*25.4,n=this.paperSize[s];"landscape"===this.getOrientation()&&(n=[n[1],n[0]]);var l=[(n[0]-r)/2,(n[1]-a)/2];this.dispatchEvent({type:"print",print:{legend:!0,format:s,orientation:this.getOrientation(),unit:"mm",size:this.paperSize[s],position:l,imageWidth:r,imageHeight:a},image:i,imageType:this.formats[w.value].imageType,pdf:this.formats[w.value].pdf,quality:this.formats[w.value].quality,canvas:t})}catch(e){}w.value=""}.bind(this)},parent:l});ol.ext.element.create("OPTION",{html:this.i18n("saveLegend"),style:{display:"none"},value:"",parent:w}),this.formats.forEach(function(e,t){ol.ext.element.create("OPTION",{html:this.i18n(e.title),value:t,parent:w})}.bind(this));var S,M,C,E=ol.ext.element.create("DIV",{className:"ol-ext-buttons",parent:r});ol.ext.element.create("BUTTON",{html:this.i18n("printBt"),type:"submit",click:function(e){e.preventDefault(),window.print()},parent:E}),ol.ext.element.create("BUTTON",{html:this.i18n("cancel"),type:"button",click:function(){o.hide()},parent:E}),ol.ext.element.create("DIV",{html:this.i18n("errorMsg"),className:"ol-error",parent:r});var L={};o.on("show",function(){this.dispatchEvent({type:"show",userElement:y,dialog:this._printDialog,page:this.getPage()});var e=this.getMap();e&&(document.body.classList.add("ol-print-document"),S=e.getTargetElement(),M=e.getSize(),"string"==typeof this.getSize()?this.setSize(this.getSize()):this.setSize(M),e.setTarget(a),C&&ol.Observable.unByKey(C),C=e.on("moveend",function(){this.setScale(ol.sphere.getMapScale(e))}.bind(this)),this.setScale(ol.sphere.getMapScale(e)),L={},this.getMap().getControls().forEach(function(e){e instanceof ol.control.Legend&&(L.legend={control:e}),e instanceof ol.control.CanvasTitle&&(L.title={control:e}),e instanceof ol.control.Compass&&(L.compass?e.element.classList.remove("ol-print-compass"):(this._input.north.checked?e.element.classList.add("ol-print-compass"):e.element.classList.remove("ol-print-compass"),this._compass=e,L.compass={control:e}))}.bind(this)),L.title?(f.checked=L.title.isVisible=L.title.control.getVisible(),v.value=L.title.control.getTitle(),f.parentNode.parentNode.classList.remove("hidden")):f.parentNode.parentNode.classList.add("hidden"),L.legend?(L.legend.ison=L.legend.control.onCanvas(),L.legend.collapsed=L.legend.control.isCollapsed(),L.legend.control.collapse(!1),w.parentNode.classList.remove("hidden"),p.parentNode.parentNode.classList.remove("hidden"),p.checked=!L.legend.collapsed,L.legend.control.setCanvas(!L.legend.collapsed)):(w.parentNode.classList.add("hidden"),p.parentNode.parentNode.classList.add("hidden")))}.bind(this)),o.on("hide",function(){document.body.classList.remove("ol-print-document"),S&&(this.getMap().setTarget(S),S=null,C&&ol.Observable.unByKey(C),L.title&&L.title.control.setVisible(L.title.isVisible),L.legend&&(L.legend.control.setCanvas(L.legend.ison),L.legend.control.collapse(L.legend.collapsed)),this.dispatchEvent({type:"hide"}))}.bind(this)),window.addEventListener("resize",function(){this.setSize()}.bind(this)),e.saveAs&&this.on("print",function(t){t.pdf||t.canvas.toBlob(function(i){var o=(t.print.legend?"legend.":"map.")+t.imageType.replace("image/","");e.saveAs(i,o)},t.imageType,t.quality)}),e.jsPDF&&this.on("print",function(t){if(t.pdf){var i=new e.jsPDF({orientation:t.print.orientation,unit:t.print.unit,format:t.print.size});i.addImage(t.image,"JPEG",t.print.position[0],t.print.position[0],t.print.imageWidth,t.print.imageHeight),i.save(t.print.legend?"legend.pdf":"map.pdf")}})}static addLang(e,t){ol.control.PrintDialog.prototype._labels[e]=t}isOpen(){return this._printDialog.isOpen()}i18n(e){var t=this._labels.en[e]||e;return this._labels[this._lang]&&this._labels[this._lang][e]&&(t=this._labels[this._lang][e]),t}getOrientation(){return this._orientation||"portrait"}setOrientation(e){this._orientation="landscape"===e?"landscape":"portrait",this._input.orientation[this._orientation].checked=!0,this.setSize()}getMargin(){return this._margin||0}setMargin(e){this._margin=e,this._input.margin.value=e,this.setSize()}getSize(){return this._size}setSize(e){if(this._printDialog.getContentElement().setAttribute("data-status",""),e?this._size=e:e=this._size,e){if("string"==typeof e){for(var t in this.paperSize)t&&new RegExp(t,"i").test(e)&&(e=t);this.paperSize[e]||(e=this._size="A4"),this._input.size.value=e,e=[Math.trunc(96*this.paperSize[e][0]/25.4),Math.trunc(96*this.paperSize[e][1]/25.4)],"landscape"===this.getOrientation()&&(e=[e[1],e[0]]),this.getPage().classList.remove("margin")}else this._input.size.value="",this.getPage().classList.add("margin");var i=this.getPage(),o=i.parentNode.getBoundingClientRect(),s=(o.width-40)/e[0],r=(o.height-40)/e[1],a=Math.min(s,r,1);i.style.width=e[0]+"px",i.style.height=e[1]+"px",i.style["-webkit-transform"]=i.style.transform="translate(-50%,-50%) scale("+a+")";var n=Math.round(5/a);i.style["-webkit-box-shadow"]=i.style["box-shadow"]=n+"px "+n+"px "+n+"px rgba(0,0,0,.6)",i.style.padding=96*this.getMargin()/25.4+"px",this.getMap()&&this.getMap().updateSize(),this.dispatchEvent({type:"dialog:refresh"})}}getContentElement(){return this._printDialog.getContentElement()}getUserElement(){return this._printDialog.getContentElement().querySelector(".ol-user-param")}getPage(){return this._pages[0]}setMap(e){this.getMap()&&(this.getMap().removeControl(this._compass),this.getMap().removeControl(this._printCtrl),this.getMap().removeControl(this._printDialog)),super.setMap(e),this.getMap()&&(this.getMap().addControl(this._compass),this.getMap().addControl(this._printCtrl),this.getMap().addControl(this._printDialog))}setScale(e){ol.sphere.setMapScale(this.getMap(),e),this._input.scale.value=" "+100*Math.round(e/100)}getScale(){return ol.sphere.getMapScale(this.getMap())}print(e){(e=e||{}).size&&this.setSize(e.size),e.scale&&this.setScale(e.scale),e.orientation&&this.setOrientation(e.orientation),e.margin&&this.setMargin(e.margin),this._printDialog.show()}getrintControl(){return this._printCtrl}},ol.control.PrintDialog.prototype._labels={en:{title:"Print",orientation:"Orientation",portrait:"Portrait",landscape:"Landscape",size:"Page size",custom:"screen size",margin:"Margin",scale:"Scale",legend:"Legend",north:"North arrow",mapTitle:"Map title",saveas:"Save as...",saveLegend:"Save legend...",copied:"✔ Copied to clipboard",errorMsg:"Can't save map canvas...",printBt:"Print...",clipboardFormat:"copy to clipboard...",jpegFormat:"save as jpeg",pngFormat:"save as png",pdfFormat:"save as pdf",none:"none",small:"small",large:"large",cancel:"cancel"},fr:{title:"Imprimer",orientation:"Orientation",portrait:"Portrait",landscape:"Paysage",size:"Taille du papier",custom:"taille écran",margin:"Marges",scale:"Echelle",legend:"Légende",north:"Flèche du nord",mapTitle:"Titre de la carte",saveas:"Enregistrer sous...",saveLegend:"Enregistrer la légende...",copied:"✔ Carte copiée",errorMsg:"Impossible d'enregistrer la carte",printBt:"Imprimer",clipboardFormat:"copier dans le presse-papier...",jpegFormat:"enregistrer un jpeg",pngFormat:"enregistrer un png",pdfFormat:"enregistrer un pdf",none:"aucune",small:"petites",large:"larges",cancel:"annuler"},de:{title:"Drucken",orientation:"Ausrichtung",portrait:"Hochformat",landscape:"Querformat",size:"Papierformat",custom:"Bildschirmgröße",margin:"Rand",scale:"Maßstab",legend:"Legende",north:"Nordpfeil",mapTitle:"Kartentitel",saveas:"Speichern als...",saveLegend:"Legende speichern...",copied:"✔ In die Zwischenablage kopiert",errorMsg:"Kann Karte nicht speichern...",printBt:"Drucken...",clipboardFormat:"in die Zwischenablage kopieren...",jpegFormat:"speichern als jpeg",pngFormat:"speichern als png",pdfFormat:"speichern als pdf",none:"kein",small:"klein",large:"groß",cancel:"abbrechen"},zh:{title:"打印",orientation:"方向",portrait:"纵向",landscape:"横向",size:"页面大小",custom:"屏幕大小",margin:"外边距",scale:"尺度",legend:"图例",north:"指北针",mapTitle:"地图名字",saveas:"保存为...",saveLegend:"保存图例为...",copied:"✔ 已复制到剪贴板",errorMsg:"无法保存地图...",printBt:"打印...",cancel:"取消"}},ol.control.PrintDialog.prototype.paperSize={"":null,A0:[841,1189],A1:[594,841],A2:[420,594],A3:[297,420],A4:[210,297],"US Letter":[215.9,279.4],A5:[148,210],B4:[257,364],B5:[182,257]},ol.control.PrintDialog.prototype.marginSize={none:0,small:5,large:10},ol.control.PrintDialog.prototype.formats=[{title:"clipboardFormat",imageType:"image/png",clipboard:!0},{title:"jpegFormat",imageType:"image/jpeg",quality:.8},{title:"pngFormat",imageType:"image/png",quality:.8},{title:"pdfFormat",imageType:"image/jpeg",pdf:!0}],ol.control.PrintDialog.prototype.scales={" 5000":"1/5.000"," 10000":"1/10.000"," 25000":"1/25.000"," 50000":"1/50.000"," 100000":"1/100.000"," 250000":"1/250.000"," 1000000":"1/1.000.000"},ol.control.Profil=class extends ol.control.Control{constructor(e){e=e||{};var t=document.createElement("div");super({element:t,target:e.target});var i=this;if(this.info=e.info||ol.control.Profil.prototype.info,e.target)t.classList.add(e.className||"ol-profil");else{t.className=((e.className||"ol-profil")+" ol-unselectable ol-control ol-collapsed").trim(),this.button=document.createElement("button"),this.button.title=e.title||"Profile",this.button.setAttribute("type","button");var o=function(e){i.toggle(),e.preventDefault()};this.button.addEventListener("click",o),this.button.addEventListener("touchstart",o),t.appendChild(this.button),ol.ext.element.create("I",{parent:this.button})}e.style instanceof ol.style.Style?this._style=e.style:this._style=new ol.style.Style({text:new ol.style.Text,stroke:new ol.style.Stroke({width:1.5,color:"#369"})}),this._style.getText()||this._style.setText(new ol.style.Text),e.selectStyle instanceof ol.style.Style?this._selectStyle=e.selectStyle:this._selectStyle=new ol.style.Style({fill:new ol.style.Fill({color:"#369"})});var s=document.createElement("div");s.classList.add("ol-inner"),t.appendChild(s);var r=document.createElement("div");r.style.position="relative",s.appendChild(r);var a=this.ratio=2;this.canvas_=document.createElement("canvas"),this.canvas_.width=(e.width||300)*a,this.canvas_.height=(e.height||150)*a;var n={msTransform:"scale(0.5,0.5)",msTransformOrigin:"0 0",webkitTransform:"scale(0.5,0.5)",webkitTransformOrigin:"0 0",mozTransform:"scale(0.5,0.5)",mozTransformOrigin:"0 0",transform:"scale(0.5,0.5)",transformOrigin:"0 0"};Object.keys(n).forEach(function(e){e in i.canvas_.style&&(i.canvas_.style[e]=n[e])});var l=document.createElement("div");r.appendChild(l),l.style.width=this.canvas_.width/a+"px",l.style.height=this.canvas_.height/a+"px",l.appendChild(this.canvas_),l.addEventListener("pointerdown",this.onMove.bind(this)),document.addEventListener("pointerup",this.onMove.bind(this)),l.addEventListener("mousemove",this.onMove.bind(this)),l.addEventListener("touchmove",this.onMove.bind(this)),this.set("selectable",e.selectable),this.margin_={top:10*a,left:45*a,bottom:30*a,right:10*a},this.info.ytitle||(this.margin_.left-=20*a),this.info.xtitle||(this.margin_.bottom-=20*a),this.bar_=document.createElement("div"),this.bar_.classList.add("ol-profilbar"),this.bar_.style.top=this.margin_.top/a+"px",this.bar_.style.height=(this.canvas_.height-this.margin_.top-this.margin_.bottom)/a+"px",r.appendChild(this.bar_),this.cursor_=document.createElement("div"),this.cursor_.classList.add("ol-profilcursor"),r.appendChild(this.cursor_),this.popup_=document.createElement("div"),this.popup_.classList.add("ol-profilpopup"),this.cursor_.appendChild(this.popup_);var h=document.createElement("table");h.cellPadding="0",h.cellSpacing="0",h.style.clientWidth=this.canvas_.width/a+"px",r.appendChild(h);var c=document.createElement("tr");c.classList.add("track-info"),h.appendChild(c);var u=document.createElement("td");u.innerHTML=(this.info.zmin||"Zmin")+': ',c.appendChild(u);var d=document.createElement("td");d.innerHTML=(this.info.zmax||"Zmax")+': ',c.appendChild(d);var g=document.createElement("td");g.innerHTML=(this.info.distance||"Distance")+': ',c.appendChild(g);var p=document.createElement("td");p.innerHTML=(this.info.time||"Time")+': ',c.appendChild(p);var m=document.createElement("tr");m.classList.add("point-info"),h.appendChild(m);var f=document.createElement("td");f.innerHTML=(this.info.altitude||"Altitude")+': ',m.appendChild(f);var v=document.createElement("td");v.innerHTML=(this.info.distance||"Distance")+': ',m.appendChild(v);var y,_,x=document.createElement("td");(x.innerHTML=(this.info.time||"Time")+': ',m.appendChild(x),this.tab_=[],e.feature&&this.setGeometry(e.feature),e.zoomable)&&(this.set("selectable",!0),this.on("change:geometry",function(){_=null}),this.on("dragstart",function(e){y=e.index}),this.on("dragend",function(e){if(Math.abs(y-e.index)>10){if(!_)var i=ol.ext.element.create("BUTTON",{parent:t,className:"ol-zoom-out",click:function(e){e.stopPropagation(),e.preventDefault(),_&&(this.dispatchEvent({type:"zoom"}),this.setGeometry(_,this._geometry[1])),t.removeChild(i)}.bind(this)});var o=_||this._geometry[0],s=new ol.geom.LineString(this.getSelection(y,e.index));this.setGeometry(s,this._geometry[1]),_=o,this.dispatchEvent({type:"zoom",geometry:s,start:y,end:e.index})}}.bind(this)))}popup(e){this.popup_.innerHTML=e}_drawAt(e,t){e?(this.cursor_.style.left=t+"px",this.cursor_.style.top=(this.canvas_.height-this.margin_.bottom+e[1]*this.scale_[1]+this.dy_)/this.ratio+"px",this.cursor_.style.display="block",this.bar_.parentElement.classList.add("over"),this.bar_.style.left=t+"px",this.bar_.style.display="block",this.element.querySelector(".point-info .z").textContent=e[1]+this.info.altitudeUnits,this.element.querySelector(".point-info .dist").textContent=(e[0]/1e3).toFixed(1)+this.info.distanceUnitsKM,this.element.querySelector(".point-info .time").textContent=e[2],t>this.canvas_.width/this.ratio/2?this.popup_.classList.add("ol-left"):this.popup_.classList.remove("ol-left")):(this.cursor_.style.display="none",this.bar_.style.display="none",this.cursor_.style.display="none",this.bar_.parentElement.classList.remove("over"))}showAt(e){var t,i,o,s=1/0;if(void 0===e)this.bar_.parentElement.classList.contains("over")&&this._drawAt();else if(e.length)for(t=1;i=this.tab_[t];t++){var r=ol.coordinate.dist2d(i[3],e);r=e));t++);if(o){var a=(o[0]*this.scale_[0]+this.margin_.left)/this.ratio;return this._drawAt(o,a),o[3]}return null}showAtTime(e,t){var i,o,s;if(e instanceof Date?e=e.getTime()/1e3:t&&(e+=this.tab_[0][3][3]),void 0===e)this.bar_.parentElement.classList.contains("over")&&this._drawAt();else for(i=0;(o=this.tab_[i])&&(s=o,!(o[3][3]>=e));i++);if(s){var r=(s[0]*this.scale_[0]+this.margin_.left)/this.ratio;return this._drawAt(s,r),s[3]}return null}pointAtTime(e){var t,i;for(t=1;i=this.tab_[t];t++){var o=i[3][3];if(o>=e){var s=this.tab_[t-1][3];return(s[3]+o)/2this.margin_.left/l-20&&a<(this.canvas_.width-this.margin_.right)/l+8&&n>this.margin_.top/l&&n<(this.canvas_.height-this.margin_.bottom)/l){var h,c,u=(a*l-this.margin_.left)/this.scale_[0],d=this.tab_[0];for(h=1;c=this.tab_[h];h++)if(c[0]>=u){u<(c[0]+d[0])/2&&(h=0,c=d);break}switch(c||(c=this.tab_[this.tab_.length-1]),a=Math.max(this.margin_.left/l,Math.min(a,(this.canvas_.width-this.margin_.right)/l)),this._drawAt(c,a),this.dispatchEvent({type:"over",click:"click"===e.type,index:h,coord:c[3],time:c[2],distance:c[0]}),e.type){case"pointerdown":this._dragging={event:{type:"dragstart",index:h,coord:c[3],time:c[2],distance:c[0]},pageX:s,pageY:r};break;case"pointerup":this._dragging&&this._dragging.pageX?Math.abs(this._dragging.pageX-s)<3&&Math.abs(this._dragging.pageY-r)<3&&(this.dispatchEvent({type:"click",index:h,coord:c[3],time:c[2],distance:c[0]}),this.refresh()):this.dispatchEvent({type:"dragend",index:h,coord:c[3],time:c[2],distance:c[0]}),this._dragging=!1;break;default:if(this._dragging)if(this._dragging.pageX)(Math.abs(this._dragging.pageX-s)>3||Math.abs(this._dragging.pageY-r)>3)&&(this._dragging.pageX=this._dragging.pageY=!1,this.dispatchEvent(this._dragging.event));else{this.dispatchEvent({type:"dragging",index:h,coord:c[3],time:c[2],distance:c[0]});var g=Math.min(this._dragging.event.index,h),p=Math.max(this._dragging.event.index,h);this.refresh(),this.get("selectable")&&this._drawGraph(this.tab_.slice(g,p),this._selectStyle)}}}else this.bar_.parentElement.classList.contains("over")&&(this._drawAt(),this.dispatchEvent({type:"out"})),"pointerup"===e.type&&this._dragging&&(this.dispatchEvent({type:"dragcancel"}),this._dragging=!1)}}show(){this.element.classList.remove("ol-collapsed"),this.dispatchEvent({type:"show",show:!0})}hide(){this.element.classList.add("ol-collapsed"),this.dispatchEvent({type:"show",show:!1})}toggle(){this.element.classList.toggle("ol-collapsed");var e=this.element.classList.contains("ol-collapsed");this.dispatchEvent({type:"show",show:!e})}isShown(){return!this.element.classList.contains("ol-collapsed")}getSelection(e,t){for(var i=[],o=Math.max(Math.min(e,t),0),s=Math.min(Math.max(e,t),this.tab_.length-1),r=o;r<=s;r++)i.push(this.tab_[r][3]);return i}_drawGraph(e,t){if(e.length){var i,o,s=this.canvas_.getContext("2d"),r=this.scale_[0],a=this.scale_[1],n=this.dy_,l=this.ratio;for(s.beginPath(),i=0;o=e[i];i++)0==i?s.moveTo(o[0]*r,o[1]*a+n):s.lineTo(o[0]*r,o[1]*a+n);t.getStroke()&&(s.strokeStyle=t.getStroke().getColor()||"#000",s.lineWidth=t.getStroke().getWidth()*l,s.setLineDash([]),s.stroke()),t.getFill()&&(s.fillStyle=t.getFill().getColor()||"#000",s.Style=t.getFill().getColor()||"#000",s.lineTo(e[e.length-1][0]*r,0),s.lineTo(e[0][0]*r,0),s.fill())}}setGeometry(e,t){if(t||(t={}),e instanceof ol.Feature&&(e=e.getGeometry()),this._geometry=[e,t],/Z/.test(e.getLayout())){/M/.test(e.getLayout())?this.element.querySelector(".time").parentElement.style.display="block":this.element.querySelector(".time").parentElement.style.display="none";var i=e.getCoordinates();switch(e.getType()){case"LineString":break;case"MultiLineString":i=i[0];break;default:return}var o,s,r,a,n,l,h,c=t.projection||this.getMap().getView().getProjection(),u=1/0,d=-1/0,g=this.tab_=[];for(o=0;s=i[o];o++)(a=s[2])d&&(d=a),0==o?r=0:r+=(l=i[o-1],h=s,ol.sphere.getDistance(ol.proj.transform(l,c,"EPSG:4326"),ol.proj.transform(h,c,"EPSG:4326"))),n=p(i[0][3],s[3]),g.push([r,a,n,s]);this._z=[u,d],this.set("graduation",t.graduation||100),this.set("zmin",t.zmin),this.set("zmax",t.zmax),this.set("amplitude",t.amplitude),this.set("unit",t.unit),this.set("zunit",t.zunit),this.set("zDigits",t.zDigits),this.set("zMaxChars",t.zMaxChars),this.dispatchEvent({type:"change:geometry",geometry:e}),this.refresh()}function p(e,t){if(!e||!t)return"-";var i=(t-e)/60,o=Math.trunc(i/60),s=Math.trunc(i-60*o);return o+"h"+(s<10?"0":"")+s+"mn"}}refresh(){var e=this.canvas_,t=e.getContext("2d"),i=e.width,o=e.height;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,i,o);var s,r=this._z[0],a=this._z[1],n=this.tab_,l=n[n.length-1][0],h=n[n.length-1][2];if(l){t.setTransform(1,0,0,1,this.margin_.left,o-this.margin_.bottom);var c=this.ratio;i-=this.margin_.right+this.margin_.left,o-=this.margin_.top+this.margin_.bottom,t.strokeStyle=this._style.getText().getFill().getColor()||"#000",t.lineWidth=.5*c,t.beginPath(),t.moveTo(0,0),t.lineTo(0,-o),t.moveTo(0,0),t.lineTo(i,0),t.stroke(),this.element.querySelector(".track-info .zmin").textContent=r.toFixed(2)+this.info.altitudeUnits,this.element.querySelector(".track-info .zmax").textContent=a.toFixed(2)+this.info.altitudeUnits,this.element.querySelector(".track-info .dist").textContent=l>1e3?(l/1e3).toFixed(1)+this.info.distanceUnitsKM:l.toFixed(1)+this.info.distanceUnitsM,this.element.querySelector(".track-info .time").textContent=h;for(var u=this.get("graduation");;){if(!(o/(((a=Math.ceil(a/u)*u)-(r=Math.floor(r/u)*u))/u)<15*c))break;u*=2}"number"==typeof this.get("zmin")&&r>this.get("zmin")&&(r=this.get("zmin")),"number"==typeof this.get("zmax")&&a1e3?(M=100*Math.round(l/1e3))>1e3&&(M=1e3*Math.ceil(M/1e3)):(C="m",M=l>100?10*Math.round(l/100):l>10?Math.round(l/10):l>1?Math.round(l)/10:l),s=0;s<=l;s+=M){var E="m"==C?s:s/1e3;t.fillText(Math.round(10*E)/10,s*g,4*c),t.moveTo(s*g,2*c),t.lineTo(s*g,0)}t.font=12*c+"px arial",t.fillText(this.info.xtitle.replace("(km)","("+C+")"),i/2,18*c),t.save(),t.rotate(-Math.PI/2),t.fillText(this.info.ytitle,o/2,-this.margin_.left),t.restore(),t.stroke()}else console.error("[ol/control/Profil] no data...",n)}getImage(e,t){return"canvas"===e?this.canvas_:this.canvas_.toDataURL(e,t)}},ol.control.Profil.prototype.info={zmin:"Zmin",zmax:"Zmax",ytitle:"Altitude (m)",xtitle:"Distance (km)",time:"Time",altitude:"Altitude",distance:"Distance",altitudeUnits:"m",distanceUnitsM:"m",distanceUnitsKM:"km"},ol.control.ProgressBar=class extends ol.control.Control{constructor(e){e=e||{};var t=ol.ext.element.create("DIV",{className:((e.className||"")+" ol-progress-bar ol-unselectable ol-control").trim()});super({element:t,target:e.target}),this._waiting=ol.ext.element.create("DIV",{html:e.label||"",className:"ol-waiting",parent:t}),this._bar=ol.ext.element.create("DIV",{className:"ol-bar",parent:t}),this._layerlistener=[],this.setLayers(e.layers)}setPercent(e){this._bar.style.width=100*(Number(e)||0)+"%",void 0===e?ol.ext.element.hide(this.element):ol.ext.element.show(this.element)}setLabel(e){this._waiting.innerHTML=e}setLayers(e){this._layerlistener.forEach(function(e){ol.Observable.unByKey(e)}),this._layerlistener=[],this.setPercent();var t,i=0,o=0;(e instanceof ol.layer.Layer&&(e=[e]),e&&e.forEach)&&e.forEach(function(e){e instanceof ol.layer.Layer&&(this._layerlistener.push(e.getSource().on("tileloadstart",function(){i++,this.setPercent(o/i),clearTimeout(t)}.bind(this))),this._layerlistener.push(e.getSource().on(["tileloadend","tileloaderror"],function(){++o===i?(i=o=0,this.setPercent(1),t=setTimeout(this.setPercent.bind(this),300)):this.setPercent(o/i)}.bind(this))))}.bind(this))}},ol.control.RoutingGeoportail=class extends ol.control.Control{constructor(e){null==(e=e||{}).typing&&(e.typing=300),e.apiKey=e.apiKey||"itineraire",e.search||(e.search={}),e.search.apiKey=e.search.apiKey||"essentiels";var t=document.createElement("DIV");super({element:t,target:e.target});var i=this;this._classname=e.className||"search",this._source=new ol.source.Vector,this._auth=e.authentication;var o=(e.className||"")+" ol-routing";(e.target||(o+=" ol-unselectable ol-control"),t.setAttribute("class",o),e.target)||ol.ext.element.create("BUTTON",{parent:t}).addEventListener("click",function(){t.classList.toggle("ol-collapsed")});this.set("url","https://wxs.ign.fr/calcul/geoportail/"+e.apiKey+"/rest/1.0.0/route");var s=ol.ext.element.create("DIV",{className:"content",parent:t}),r=ol.ext.element.create("DIV",{className:"search-input",parent:s});this._search=[],this.addSearch(r,e),this.addSearch(r,e),ol.ext.element.create("I",{className:"ol-car",title:e.carlabel||"by car",parent:s}).addEventListener("click",function(){i.setMode("car")}),ol.ext.element.create("I",{className:"ol-pedestrian",title:e.pedlabel||"pedestrian",parent:s}).addEventListener("click",function(){i.setMode("pedestrian")}),ol.ext.element.create("I",{className:"ol-ok",title:e.runlabel||"search",html:"OK",parent:s}).addEventListener("click",function(){i.calculate()}),ol.ext.element.create("I",{className:"ol-cancel",html:"cancel",parent:s}).addEventListener("click",function(){this.resultElement.innerHTML=""}.bind(this)),this.resultElement=document.createElement("DIV"),this.resultElement.setAttribute("class","ol-result"),t.appendChild(this.resultElement),this.setMode(e.mode||"car"),this.set("timeout",e.timeout||2e4)}setMode(e,t){this.set("mode",e),this.element.querySelector(".ol-car").classList.remove("selected"),this.element.querySelector(".ol-pedestrian").classList.remove("selected"),this.element.querySelector(".ol-"+e).classList.add("selected"),t||this.calculate()}setMethod(e,t){this.set("method",e),t||this.calculate()}addButton(e,t,i){var o=document.createElement("I");return o.setAttribute("class",e),o.setAttribute("type","button"),o.setAttribute("title",t),o.innerHTML=i||"",this.element.appendChild(o),o}getSource(){return this._source}_resetArray(e){this._search=[];var t=e.parentNode.querySelectorAll(".search-input > div");t.forEach(function(e){e.olsearch&&(e.olsearch.get("feature")&&(e.olsearch.get("feature").set("step",this._search.length),0===this._search.length?e.olsearch.get("feature").set("pos","start"):this._search.length===t.length-1?e.olsearch.get("feature").set("pos","end"):e.olsearch.get("feature").set("pos","")),this._search.push(e.olsearch))}.bind(this))}removeSearch(e,t,i){e.removeChild(i),i.olsearch.get("feature")&&this._source.removeFeature(i.olsearch.get("feature")),this.getMap()&&this.getMap().removeControl(i.olsearch),this._resetArray(e)}addSearch(e,t,i){var o=this,s=ol.ext.element.create("DIV");i?e.insertBefore(s,i.nextSibling):e.appendChild(s),ol.ext.element.create("BUTTON",{title:t.startlabel||"add/remove",parent:s}).addEventListener("click",function(i){i.ctrlKey?this._search.length>2&&this.removeSearch(e,t,s):i.shiftKey&&this.addSearch(e,t,s)}.bind(this));var r=s.olsearch=new ol.control.SearchGeoportail({className:"IGNF ol-collapsed",apiKey:t.search.apiKey,authentication:t.search.authentication,target:s,reverse:!0});r._changeCounter=0,this._resetArray(e),r.on("select",function(e){r.setInput(e.search.fulltext);var t=r.get("feature");t?(r.checkgeom=!1,e.silent||t.getGeometry().setCoordinates(e.coordinate),r.checkgeom=!0):(t=new ol.Feature(new ol.geom.Point(e.coordinate)),r.set("feature",t),this._source.addFeature(t),r.checkgeom=!0,t.getGeometry().on("change",function(){r.checkgeom&&this.onGeometryChange(r,t)}.bind(this))),t.set("name",r.getTitle(e.search)),t.set("step",this._search.indexOf(r)),0===t.get("step")?t.set("pos","start"):t.get("step")===this._search.length-1&&t.set("pos","end"),r.set("selection",e.search)}.bind(this)),r.element.querySelector("input").addEventListener("change",function(){r.set("selection",null),o.resultElement.innerHTML=""}),this.getMap()&&this.getMap().addControl(r)}onGeometryChange(e,t,i){var o=ol.proj.transform(t.getGeometry().getCoordinates(),this.getMap().getView().getProjection(),"EPSG:4326");if(e._handleSelect({x:o[0],y:o[1],fulltext:o[0].toFixed(6)+","+o[1].toFixed(6)},!0,{silent:!0}),i){if(e._changeCounter--,!e._changeCounter)return void e.reverseGeocode(t.getGeometry().getCoordinates(),{silent:!0})}else e._changeCounter++,setTimeout(function(){this.onGeometryChange(e,t,!0)}.bind(this),1e3)}setMap(e){super.setMap(e);for(var t=0;t"+r+(t?" - "+t:"")+"",on:{pointerenter:function(){this.dispatchEvent({type:"step:hover",hover:!1,index:i,feature:e})}.bind(this),pointerleave:function(){this.dispatchEvent({type:"step:hover",hover:!1,index:i,feature:e})}.bind(this)},click:function(){this.dispatchEvent({type:"step:select",index:i,feature:e})}.bind(this),parent:o})}.bind(this))}handleResponse(e,t,i){if("ERROR"!==e.status){for(var o,s,r,a={type:"routing",features:[]},n=0,l=0,h=new ol.format.GeoJSON,c=0;r=e.portions[c];c++)for(var u,d=0;u=r.steps[d];d++){u.type="Feature",u.properties=u.attributes.name||u.attributes,u.properties.distance=u.distance,u.properties.duration=Math.round(60*u.duration),u.instruction&&(u.properties.instruction_type=u.instruction.type,u.properties.instruction_modifier=u.instruction.modifier),n+=u.distance,l+=u.duration,u.properties.distanceT=Math.round(100*n)/100,u.properties.durationT=Math.round(60*l),u.properties.name=u.properties.cpx_toponyme_route_nommee||u.properties.cpx_toponyme||u.properties.cpx_numero||u.properties.nom_1_droite||u.properties.nom_1_gauche||"";var g=u.geometry.coordinates[u.geometry.coordinates.length-1];s&&!ol.coordinate.equal(g,u.geometry.coordinates[u.geometry.coordinates.length-1])&&u.geometry.coordinates.unshift(s),s=u.geometry.coordinates[u.geometry.coordinates.length-1],o=h.readFeature(u,{featureProjection:this.getMap().getView().getProjection()}),a.features.push(o)}a.distance=parseFloat(e.distance),a.duration=parseFloat(e.duration)/60;var p=h.readGeometry(e.geometry,{featureProjection:this.getMap().getView().getProjection()});return a.feature=new ol.Feature({geometry:p,start:this._search[0].getTitle(t),end:this._search[0].getTitle(i),distance:a.distance,duration:a.duration}),this.dispatchEvent(a),this.path=a,a}this.dispatchEvent({type:"errror",status:"200",statusText:e.message})}abort(){this._request&&(this._request.abort(),this._request=null,this.dispatchEvent({type:"abort"}))}calculate(e){if(this.resultElement.innerHTML="",e){var t=[];e.forEach(function(e){t.push({x:e[0],y:e[1]})}),e=t}else{e=[];for(var i=0;i=200&&e.status<400?h.listRouting(h.handleResponse(JSON.parse(e.response),o,s)):this.dispatchEvent({type:"error",status:e.status,statusText:e.statusText})}.bind(this),function(e){this.dispatchEvent({type:"error",status:e.status,statusText:e.statusText})}.bind(this)),!0}ajax(e,t,i){var o=this;this._request&&this._request.abort();var s=this._request=new XMLHttpRequest;s.open("GET",e,!0),s.timeout=this.get("timeout")||2e4,this._auth&&s.setRequestHeader("Authorization","Basic "+this._auth),this.element.classList.add("ol-searching"),s.onload=function(){o._request=null,o.element.classList.remove("ol-searching"),t.call(o,this)},s.ontimeout=function(){o._request=null,o.element.classList.remove("ol-searching"),i&&i.call(o,this)},s.onerror=function(){o._request=null,o.element.classList.remove("ol-searching"),i&&i.call(o,this)},s.send()}},ol.control.Scale=class extends ol.control.Control{constructor(e){void 0===(e=e||{}).typing&&(e.typing=300);var t=document.createElement("DIV"),i=(e.className||"")+" ol-scale";e.target||(i+=" ol-unselectable ol-control"),super({element:t,target:e.target}),this._input=document.createElement("INPUT"),this._input.value="-",t.setAttribute("class",i),!1===e.editable&&(this._input.readOnly=!0),t.appendChild(this._input),this._input.addEventListener("change",this.setScale.bind(this)),this.set("ppi",e.ppi||96)}setMap(e){this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,super.setMap(e),e&&(this._listener=e.on("moveend",this.getScale.bind(this)))}getScale(){var e=this.getMap();if(e){var t=ol.sphere.getMapScale(e,this.get("ppi"));return this._input.value=this.formatScale(t),t}}formatScale(e){return"1 / "+(e=e>100?100*Math.round(e/100):Math.round(e)).toLocaleString()}setScale(e){var t=this.getMap();t&&e&&(e.target&&(e=e.target.value),ol.sphere.setMapScale(t,e,this.get("ppi"))),this.getScale()}},ol.control.SearchBAN=class extends ol.control.SearchPhoton{constructor(e){(e=e||{}).typing=e.typing||500,e.url=e.url||"https://api-adresse.data.gouv.fr/search/",e.className=e.className||"BAN",e.copy='© BAN-data.gouv.fr',super(e),this.set("postcode",e.postcode),this.set("citycode",e.citycode),this.set("type",e.type)}getTitle(e){return e.properties.label}select(e){var t=e.geometry.coordinates;try{t=ol.proj.transform(e.geometry.coordinates,"EPSG:4326",this.getMap().getView().getProjection())}catch(e){}this.dispatchEvent({type:"select",search:e,coordinate:t})}requestData(e){var t=super.requestData(e);return t.postcode=this.get("postcode"),t.citycode=this.get("citycode"),t.type=this.get("type"),t}},ol.control.SearchDFCI=class extends ol.control.Search{constructor(e){(e=e||{}).className=e.className||"dfci",e.placeholder=e.placeholder||"Code DFCI",super(e)}autocomplete(e){if((e=(e=e.toUpperCase()).replace(/[^0-9,^A-H,^K-N]/g,"")).length<2)return this.setInput(e),[];var t,i=this.getMap().getView().getProjection(),o=[],s=ol.coordinate.fromDFCI(e,i),r=Math.floor(e.length/2)-1,a=ol.coordinate.toDFCI(s,r,i);if(a=a.replace(/[^0-9,^A-H,^K-N]/g,""),!/NaN/.test(a)&&a){if(console.log("ok",a),this.setInput(a+e.substring(a.length,e.length)),o.push({coordinate:ol.coordinate.fromDFCI(a,i),name:a}),5===e.length)for(s=ol.coordinate.fromDFCI(e+0,i),a=ol.coordinate.toDFCI(s,r+1,i).substring(0,5),t=0;t<10;t++)o.push({coordinate:ol.coordinate.fromDFCI(a+t,i),name:a+t});if(2===r)for(t=0;t<6;t++)o.push({coordinate:ol.coordinate.fromDFCI(a+"."+t,i),name:a+"."+t})}return o}},ol.control.SearchFeature=class extends ol.control.Search{constructor(e){(e=e||{}).className=e.className||"feature",super(e),"function"==typeof e.getSearchString&&(this.getSearchString=e.getSearchString),this.set("property",e.property||"name"),this.source_=e.source,this._sort=e.sort}restoreHistory(){this.set("history",[])}saveHistory(){try{localStorage.removeItem("ol@search-"+this._classname)}catch(e){console.warn("Failed to access localStorage...")}}getTitle(e){return e.get(this.get("property")||"name")}getSearchString(e){return this.getTitle(e)}getSource(){return this.source_}setSource(e){this.source_=e}setSortFunction(e){this._sort=e}autocomplete(e){var t=[];if(this.source_){e=e.replace(/^\*/,"");for(var i,o=new RegExp(e,"i"),s=this.source_.getFeatures(),r=this.get("maxItems"),a=0;i=s[a];a++){var n=this.getSearchString(i);if(void 0!==n&&o.test(n)&&(t.push(i),--r<=0))break}}return"function"==typeof this._sort&&(t=t.sort(this._sort)),t}},ol.control.SearchGPS=class extends ol.control.Search{constructor(e){(e=e||{}).className=(e.className||"")+" ol-searchgps",e.placeholder=e.placeholder||"lon,lat",super(e),this.geolocation=new ol.Geolocation({projection:"EPSG:4326",trackingOptions:{maximumAge:1e4,enableHighAccuracy:!0,timeout:6e5}}),ol.ext.element.create("BUTTON",{className:"ol-geoloc",title:"Locate with GPS",parent:this.element,click:function(){this.geolocation.setTracking(!0)}.bind(this)}),ol.ext.element.createSwitch({html:"decimal",after:"DMS",change:function(e){e.target.checked?this.element.classList.add("ol-dms"):this.element.classList.remove("ol-dms")}.bind(this),parent:this.element}),this._createForm();var t=this.element.querySelector("ul.autocomplete");this.element.appendChild(t)}_createForm(){var e=function(e){if(e.target.classList.contains("ol-dms")&&(o.value=(s.value<0?-1:1)*Number(s.value)+Number(r.value)/60+Number(a.value)/3600,o.value=(s.value<0?-1:1)*Math.round(1e7*o.value)/1e7,n.value=(l.value<0?-1:1)*Number(l.value)+Number(h.value)/60+Number(c.value)/3600,n.value=(l.value<0?-1:1)*Math.round(1e7*n.value)/1e7),o.value||n.value?this._input.value=o.value+","+n.value:this._input.value="",!e.target.classList.contains("ol-dms")){var t=ol.coordinate.toStringHDMS([Number(o.value),Number(n.value)]),i=t.replace(/(N|S|E|W)/g,"").split("″");i[1]=i[1].trim().split(" "),s.value=(/W/.test(t)?-1:1)*parseInt(i[1][0]),r.value=parseInt(i[1][1]),a.value=parseInt(i[1][2]),i[0]=i[0].trim().split(" "),l.value=(/W/.test(t)?-1:1)*parseInt(i[0][0]),h.value=parseInt(i[0][1]),c.value=parseInt(i[0][2])}this.search()}.bind(this);function t(t,o){var s=ol.ext.element.create("INPUT",{className:t,type:"number",step:"any",lang:"en",parent:i,on:{"change keyup":e}});return o&&ol.ext.element.create("SPAN",{className:"ol-dms",html:o,parent:i}),s}var i=ol.ext.element.create("DIV",{className:"ol-longitude",parent:this.element});ol.ext.element.create("LABEL",{html:"Longitude",parent:i});var o=t("ol-decimal"),s=t("ol-dms","°"),r=t("ol-dms","'"),a=t("ol-dms",'"');i=ol.ext.element.create("DIV",{className:"ol-latitude",parent:this.element}),ol.ext.element.create("LABEL",{html:"Latitude",parent:i});var n=t("ol-decimal"),l=t("ol-dms","°"),h=t("ol-dms","'"),c=t("ol-dms",'"');this.button&&this.button.addEventListener("click",function(){o.focus()}),this.on("select",function(e){o.value=e.search.gps[0],n.value=e.search.gps[1]}.bind(this)),this.geolocation.on("change",function(){this.geolocation.setTracking(!1);var e=this.geolocation.getPosition();o.value=e[0],n.value=e[1],this._triggerCustomEvent("keyup",o)}.bind(this))}autocomplete(e){var t=[],i=e.split(",");i[0]=Number(i[0]),i[1]=Number(i[1]),(e=ol.coordinate.toStringHDMS(i))&&(e=e.replace(/(°|′|″) /g,"$1"));var o=ol.proj.transform([i[0],i[1]],"EPSG:4326",this.getMap().getView().getProjection());return t.push({gps:i,coordinate:o,name:e}),t}},ol.control.SearchGeoportailParcelle=class extends ol.control.SearchGeoportail{constructor(e){e.type="Commune",e.className=(e.className?e.className:"")+" IGNF-parcelle ol-collapsed-list ol-collapsed-num",e.inputLabel="Commune",e.noCollapse=!0,e.placeholder=e.placeholder||"Choisissez une commune...",super(e),this.set("copy",null);var t=this.element,i=this,o=document.createElement("DIV");t.appendChild(o);var s,r=document.createElement("LABEL");r.innerText="Préfixe",o.appendChild(r),(r=document.createElement("LABEL")).innerText="Section",o.appendChild(r),(r=document.createElement("LABEL")).innerText="Numéro",o.appendChild(r),o.appendChild(document.createElement("BR")),this._inputParcelle={prefix:document.createElement("INPUT"),section:document.createElement("INPUT"),numero:document.createElement("INPUT")},this._inputParcelle.prefix.setAttribute("maxlength",3),this._inputParcelle.section.setAttribute("maxlength",2),this._inputParcelle.numero.setAttribute("maxlength",4);var a=function(){s&&clearTimeout(s),s=setTimeout(function(){i.autocompleteParcelle()},e.typing||0)};for(var n in this._inputParcelle)o.appendChild(this._inputParcelle[n]),this._inputParcelle[n].addEventListener("keyup",a),this._inputParcelle[n].addEventListener("blur",function(){s=setTimeout(function(){t.classList.add("ol-collapsed-num")},200)}),this._inputParcelle[n].addEventListener("focus",function(){clearTimeout(s),t.classList.remove("ol-collapsed-num")});this.activateParcelle(!1);var l=document.createElement("DIV");l.className="autocomplete-parcelle",t.appendChild(l);var h=document.createElement("UL");h.classList.add("autocomplete-parcelle"),l.appendChild(h),(h=document.createElement("UL")).classList.add("autocomplete-page"),l.appendChild(h),this._input.addEventListener("blur",function(){setTimeout(function(){t.classList.add("ol-collapsed-list")},200)}),this._input.addEventListener("focus",function(){t.classList.remove("ol-collapsed-list"),i._listParcelle([]),i._commune&&(i._commune=null,i._input.value="",i.drawList_()),i.activateParcelle(!1)}),this.on("select",this.selectCommune.bind(this)),this.set("pageSize",e.pageSize||5)}selectCommune(e){this._commune=e.search.insee||e.sear,this._input.value=e.search.insee+" - "+e.search.fulltext,this.activateParcelle(!0),this._inputParcelle.numero.focus(),this.autocompleteParcelle()}setParcelle(e,t){this._inputParcelle.prefix.value=(e.Commune||"")+(e.CommuneAbsorbee||""),this._inputParcelle.section.value=e.Section||"",this._inputParcelle.numero.value=e.Numero||"",t&&this._triggerCustomEvent("keyup",this._inputParcelle.prefix)}activateParcelle(e){for(var t in this._inputParcelle)this._inputParcelle[t].readOnly=!e;e?this._inputParcelle.section.parentElement.classList.add("ol-active"):this._inputParcelle.section.parentElement.classList.remove("ol-active")}autocompleteParcelle(){function e(e,t,i){if(!e)return e;for(i=i||"0";e.length";this.ajax(this.get("url").replace("ols/apis/completion","geoportail/ols"),{xls:a},function(e){for(var t,i=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("GeocodedAddress"),o=[],r=0;t=i[r];r++){for(var a,n=(t.getElementsByTagName("gml:pos")[0]||t.getElementsByTagName("pos")[0]).childNodes[0].nodeValue.split(" "),l=t.getElementsByTagName("Place"),h={lon:Number(n[1]),lat:Number(n[0])},c=0;a=l[c];c++)h[a.attributes.type.value]=a.childNodes[0].nodeValue;o.push(h)}console.log(o),s(o)},{dataType:"XML"})}else this.ajax(r+"?index=parcel&q=&departmentcode="+e.substr(0,2)+"&municipalitycode="+e.substr(-3)+(t?"&oldmunicipalitycode="+t.replace(/_/g,"0"):"")+(i?"§ion="+i:"")+(o?"&number="+o:"")+"&limit=20",{},function(e){var t=[];e.features.forEach(function(e){var i=e.properties;t.push({id:i.id,INSEE:i.departmentcode+i.municipalitycode,Commune:i.municipalitycode,Departement:i.departmentcode,CommuneAbsorbee:i.oldmunicipalitycode,Section:i.section,Numero:i.number,Municipality:i.city,Feuille:i.sheet,lon:e.geometry.coordinates[0],lat:e.geometry.coordinates[1]})}),s(t)})}_listParcelle(e){var t=this,i=this.element.querySelector("ul.autocomplete-parcelle");i.innerHTML="";var o=this.element.querySelector("ul.autocomplete-page");function s(e){var t,s=i.children,r="ol-list-"+e;for(t=0;t1?"":"none"}o.innerHTML="",this._listParc=[],e.sort(function(e,t){var i=e.INSEE+e.CommuneAbsorbee+e.Section+e.Numero,o=t.INSEE+t.CommuneAbsorbee+t.Section+t.Numero;return i===o?0:i0&&l.classList.add("ol-list-"+Math.floor(n/a)),this._listParc.push(r),l.addEventListener("click",function(e){t._handleParcelle(t._listParc[e.currentTarget.getAttribute("data-search")])}),l.innerHTML=r.INSEE+r.CommuneAbsorbee+r.Section+r.Numero,i.appendChild(l),a>0&&!(n%a)&&((l=document.createElement("LI")).innerText=Math.floor(n/a),l.addEventListener("click",function(e){s(e.currentTarget.innerText)}),o.appendChild(l))}a>0&&s(0)}_handleParcelle(e){this.dispatchEvent({type:"parcelle",search:e,coordinate:ol.proj.fromLonLat([e.lon,e.lat],this.getMap().getView().getProjection())})}},ol.control.SearchNominatim=class extends ol.control.SearchJSON{constructor(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=ol.proj.transform(t,"EPSG:4326",this.getMap().getView().getProjection())}catch(e){}this.dispatchEvent({type:"select",search:e,coordinate:t})}reverseGeocode(e,t){var i=ol.proj.transform(e,this.getMap().getView().getProjection(),"EPSG:4326");this.ajax(this.get("url").replace("search","reverse"),{lon:i[0],lat:i[1],format:"json"},function(e){t?t.call(this,[e]):e&&!e.error&&this._handleSelect(e,!0)}.bind(this))}handleResponse(e){return e.results||e}},ol.control.SearchWikipedia=class extends ol.control.SearchJSON{constructor(e){(e=e||{}).lang=e.lang||"en",e.className=e.className||"ol-search-wikipedia",e.url="https://"+e.lang+".wikipedia.org/w/api.php",e.placeholder=e.placeholder||"search string, File:filename",e.copy='Wikipedia® - CC-By-SA',super(e),this.set("lang",e.lang)}getTitle(e){return ol.ext.element.create("DIV",{html:e.title,title:e.desc})}setLang(e){this.set("lang",e),this.set("url","https://"+e+".wikipedia.org/w/api.php")}requestData(e){return{action:"opensearch",search:e,lang:this.get("lang"),format:"json",origin:"*",limit:this.get("maxItems")}}handleResponse(e){for(var t=[],i=0;i100));l++);var h=new RegExp(e,"i");for(var c in o)if("geometry"!==c&&h.test(c)){var u=document.createElement("li");u.textContent=c,u.addEventListener("click",function(){t.previousElementSibling.value=this.textContent;var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),t.previousElementSibling.dispatchEvent(e),t.classList.add("ol-hidden")}),t.appendChild(u)}}_getLiCondition(e){var t=this,i=document.createElement("li"),o=document.createElement("div");o.classList.add("ol-autocomplete"),o.addEventListener("mouseleave",function(){this.querySelector("ul").classList.add("ol-hidden")}),i.appendChild(o);var s=document.createElement("input");s.classList.add("ol-attr"),s.setAttribute("type","search"),s.setAttribute("placeholder",this.get("attrPlaceHolder")),s.addEventListener("keyup",function(){t._autocomplete(this.value,this.nextElementSibling)}),s.addEventListener("focusout",function(){setTimeout(function(){o.querySelector("ul").classList.add("ol-hidden")},300)}),s.addEventListener("click",function(){setTimeout(function(){t._autocomplete(this.value,this.nextElementSibling),this.nextElementSibling.classList.remove("ol-hidden")}.bind(this))}),s.addEventListener("change",function(){t._conditions[e].attr=this.value}),s.value=t._conditions[e].attr,o.appendChild(s);var r=document.createElement("ul");r.classList.add("ol-hidden"),o.appendChild(r);var a=document.createElement("select");for(var n in i.appendChild(a),this.operationsList){var l=document.createElement("option");l.value=n,l.textContent=this.operationsList[n],a.appendChild(l)}a.value=t._conditions[e].op,a.addEventListener("change",function(){t._conditions[e].op=this.value});var h=document.createElement("input");if(h.setAttribute("type","text"),h.setAttribute("placeholder",this.get("valuePlaceHolder")),h.addEventListener("change",function(){t._conditions[e].val=this.value}),h.value=t._conditions[e].val,i.appendChild(h),this._conditions.length>1){var c=document.createElement("div");c.classList.add("ol-delete"),c.addEventListener("click",function(){t.removeCondition(e)}),i.appendChild(c)}return i}removeCondition(e){this._conditions.splice(e,1),this._drawlist()}doSelect(e){return(e=e||{}).useCase=e.useCase||this._useCase.checked,e.matchAll=e.matchAll||this._all.checked,e.conditions=e.conditions||this._conditions,super.doSelect(e)}},ol.control.SelectCheck=class extends ol.control.SelectBase{constructor(e){var t=(e=e||{}).content=ol.ext.element.create("DIV");e.label&&ol.ext.element.create("LABEL",{html:e.label,parent:t}),e.className=e.className||"ol-select-check",super(e);var i=t.querySelector("button");this._input=ol.ext.element.create("DIV",{parent:t}),t.appendChild(i),this.set("property",e.property||"name"),this.set("max",e.max||1e4),this.set("defaultLabel",e.defaultLabel),this.set("type",e.type),this._selectAll=e.selectAll,this._onchoice=e.onchoice,e.values?this.setValues({values:e.values,sort:!0}):this.setValues()}setMap(e){super.setMap(e),this.setValues()}doSelect(e){e=e||{};var t=[];return this._checks.forEach(function(e){e.checked&&e.value&&t.push({attr:this.get("property"),op:"=",val:e.value})}.bind(this)),t.length?super.doSelect({features:e.features,conditions:t}):super.doSelect({features:e.features,matchAll:this._selectAll})}setValues(e){var t,i;if((e=e||{}).values)e.values instanceof Array?(i={},e.values.forEach(function(e){i[e]=e})):i=e.values;else{i={};var o=this.get("property");this.getSources().forEach(function(e){for(var t=e.getFeatures(),s=Math.min(t.length,this.get("max")),r=0;r "+e[i]+"
";ol.ext.element.setHTML(this.element,t)}else ol.ext.element.hide(this.element)}setPosition(e){this.element.classList.remove("ol-left"),this.element.classList.remove("ol-right"),this.element.classList.remove("ol-bottom"),this.element.classList.remove("ol-center"),/^left$|^right$|^bottom$|^center$/.test(e)&&this.element.classList.add("ol-"+e)}show(e){!1===e?ol.ext.element.hide(this.element):ol.ext.element.show(this.element)}hide(){ol.ext.element.hide(this.element)}toggle(){ol.ext.element.toggle(this.element)}isShown(){return"none"===this.element.style.display}},ol.control.Storymap=class extends ol.control.Control{constructor(e){e.target&&(e.html?e.html instanceof Element&&(e.html=e.html.innerHTML):e.html=e.target.innerHTML,e.target.innerHTML="");var t=ol.ext.element.create("DIV",{className:(e.className||"")+" ol-storymap"+(e.target?"":" ol-unselectable ol-control")});super({element:t,target:e.target}),this.content=ol.ext.element.create("DIV",{parent:t}),ol.ext.element.scrollDiv(this.content,{vertical:!0,mousewheel:!0,minibar:e.minibar}),this.setStory(e.html)}setChapter(e){for(var t,i=this.content.querySelectorAll(".chapter"),o=0;t=i[o];o++)t.getAttribute("name")===e&&(this.content.scrollTop=t.offsetTop-30)}setStory(e){e instanceof Element?(this.content.innerHTML="",this.content.appendChild(e)):this.content.innerHTML=e,this.content.querySelectorAll(".chapter").forEach(function(e){e.addEventListener("click",function(t){e.classList.contains("ol-select")?"IMG"===t.target.tagName&&t.target.dataset.title&&this.dispatchEvent({coordinate:this.getMap()?this.getMap().getCoordinateFromPixel([t.layerX,t.layerY]):null,type:"clickimage",img:t.target,title:t.target.dataset.title,element:e,name:e.getAttribute("name"),originalEvent:t}):(this.content.scrollTop=e.offsetTop-30,t.preventDefault())}.bind(this))}.bind(this));var t=this.content.querySelectorAll(".ol-scroll-next");t.forEach(function(e){e.addEventListener("click",function(t){if(e.parentElement.classList.contains("ol-select")){for(var i,o=this.content.querySelectorAll(".chapter"),s=e.offsetTop,r=0;i=o[r];r++)if(i.offsetTop>s){s=i.offsetTop;break}this.content.scrollTop=s-30,t.stopPropagation(),t.preventDefault()}}.bind(this))}.bind(this)),(t=this.content.querySelectorAll(".ol-scroll-top")).forEach(function(e){e.addEventListener("click",function(e){this.content.scrollTop=0,e.stopPropagation(),e.preventDefault()}.bind(this))}.bind(this));var i=function(e){var t=[parseFloat(e.getAttribute("data-lon")),parseFloat(e.getAttribute("data-lat"))],i=ol.proj.fromLonLat(t,this.getMap().getView().getProjection()),o=parseFloat(e.getAttribute("data-zoom"));return{type:"scrollto",element:e,name:e.getAttribute("name"),coordinate:i,lon:t,zoom:o}}.bind(this),o=this.content.querySelectorAll(".chapter")[0];setTimeout(function(){o.classList.add("ol-select"),this.dispatchEvent(i(o))}.bind(this)),this.content.addEventListener("scroll",function(){var e,t=this.content.querySelectorAll(".chapter"),s=ol.ext.element.getStyle(this.content,"height");if(this.content.scrollTop)for(var r,a=0;r=t[a];a++){if(r.offsetTop-this.content.scrollTop>s/3)break;e=r}else e=t[0];if(e&&e!==o){o&&o.classList.remove("ol-select"),(o=e).classList.add("ol-select");var n=i(o),l=this.getMap().getView();switch(l.cancelAnimations(),o.getAttribute("data-animation")){case"flyto":l.flyTo({center:n.coordinate,zoomAt:Math.min(l.getZoom(),n.zoom)-1,zoom:n.zoom})}this.dispatchEvent(n)}}.bind(this))}},ol.control.Swipe=class extends ol.control.Control{constructor(e){e=e||{};var t=document.createElement("div");super({element:t}),t.className=(e.className||"ol-swipe")+" ol-unselectable ol-control";var i=document.createElement("button");t.appendChild(i),t.addEventListener("mousedown",this.move.bind(this)),t.addEventListener("touchstart",this.move.bind(this)),this.precomposeRight_=this.precomposeRight.bind(this),this.precomposeLeft_=this.precomposeLeft.bind(this),this.postcompose_=this.postcompose.bind(this),this.layers=[],e.layers&&this.addLayer(e.layers,!1),e.rightLayers&&this.addLayer(e.rightLayers,!0),this.on("propertychange",function(e){if(this.getMap())try{this.getMap().renderSync()}catch(e){}"horizontal"===this.get("orientation")?(this.element.style.top=100*this.get("position")+"%",this.element.style.left=""):("vertical"!==this.get("orientation")&&this.set("orientation","vertical"),this.element.style.left=100*this.get("position")+"%",this.element.style.top=""),"orientation"===e.key&&(this.element.classList.remove("horizontal","vertical"),this.element.classList.add(this.get("orientation"))),this.isMoving||this.layers.forEach(function(e){e.layer.getImageRatio&&e.layer.changed()})}.bind(this)),this.set("position",e.position||.5),this.set("orientation",e.orientation||"vertical")}setMap(e){var t,i;if(this.getMap()){for(t=0;t=0&&this.getMap()&&(this.layers[i].right?e[t].un(["precompose","prerender"],this.precomposeRight_):e[t].un(["precompose","prerender"],this.precomposeLeft_),e[t].un(["postcompose","postrender"],this.postcompose_),this.layers.splice(i,1))}if(this.getMap())try{this.getMap().renderSync()}catch(e){}}getRectangle(){var e;return"vertical"===this.get("orientation")?[0,0,(e=this.getMap().getSize())[0]*this.get("position"),e[1]]:[0,0,(e=this.getMap().getSize())[0],e[1]*this.get("position")]}move(e){var t,i=this;switch(this._movefn||(this._movefn=this.move.bind(this)),e.type){case"touchcancel":case"touchend":case"mouseup":i.isMoving=!1,["mouseup","mousemove","touchend","touchcancel","touchmove"].forEach(function(e){document.removeEventListener(e,i._movefn)}),this.layers.forEach(function(e){e.layer.getImageRatio&&e.layer.changed()});break;case"mousedown":case"touchstart":i.isMoving=!0,["mouseup","mousemove","touchend","touchcancel","touchmove"].forEach(function(e){document.addEventListener(e,i._movefn)});case"mousemove":case"touchmove":if(i.isMoving)if("vertical"===i.get("orientation")){var o=e.pageX||e.touches&&e.touches.length&&e.touches[0].pageX||e.changedTouches&&e.changedTouches.length&&e.changedTouches[0].pageX;if(!o)break;o-=i.getMap().getTargetElement().getBoundingClientRect().left+window.pageXOffset-document.documentElement.clientLeft;var s=(t=i.getMap().getSize()[0])-Math.min(Math.max(0,t-o),t);t=s/t,i.set("position",t),i.dispatchEvent({type:"moving",size:[s,i.getMap().getSize()[1]],position:[t,0]})}else{var r=e.pageY||e.touches&&e.touches.length&&e.touches[0].pageY||e.changedTouches&&e.changedTouches.length&&e.changedTouches[0].pageY;if(!r)break;r-=i.getMap().getTargetElement().getBoundingClientRect().top+window.pageYOffset-document.documentElement.clientTop;var a=(t=i.getMap().getSize()[1])-Math.min(Math.max(0,t-r),t);t=a/t,i.set("position",t),i.dispatchEvent({type:"moving",size:[i.getMap().getSize()[0],a],position:[0,t]})}}}_transformPt(e,t){var i=e.inversePixelTransform,o=t[0],s=t[1];return t[0]=i[0]*o+i[2]*s+i[4],t[1]=i[1]*o+i[3]*s+i[5],t}_drawRect(e,t){var i=e.inversePixelTransform;if(i){var o=[[t[0][0],t[0][1]],[t[0][0],t[1][1]],[t[1][0],t[1][1]],[t[1][0],t[0][1]],[t[0][0],t[0][1]]];if(e.context.save(),e.target.getImageRatio){var s=-Math.atan2(e.frameState.pixelToCoordinateTransform[1],e.frameState.pixelToCoordinateTransform[0]);e.context.translate(e.frameState.size[0]/2,e.frameState.size[1]/2),e.context.rotate(s),e.context.translate(-e.frameState.size[0]/2,-e.frameState.size[1]/2)}o.forEach(function(t,o){t=[t[0]*i[0]-t[1]*i[1]+i[4],-t[0]*i[2]+t[1]*i[3]+i[5]],o?e.context.lineTo(t[0],t[1]):e.context.moveTo(t[0],t[1])}),e.context.restore()}else{var r=e.frameState.pixelRatio;e.context.rect(t[0][0]*r,t[0][1]*r,t[1][0]*r,t[1][1]*r)}}precomposeLeft(e){var t=e.context;if(t instanceof WebGLRenderingContext){if("prerender"===e.type){t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.enable(t.SCISSOR_TEST);var i,o,s=this.getMap().getSize(),r=this._transformPt(e,[0,s[1]]),a=this._transformPt(e,[s[0],0]),n=a[0]-r[0],l=a[1]-r[1];"vertical"===this.get("orientation")?(i=Math.round(n*this.get("position")),o=l):(i=n,o=Math.round(l*this.get("position")),r[1]+=l-o),t.scissor(r[0],r[1],i,o)}}else{var h=e.frameState.size;t.save(),t.beginPath();var c=[[0,0],[h[0],h[1]]];"vertical"===this.get("orientation")?c[1]=[.5*h[0]+this.getMap().getSize()[0]*(this.get("position")-.5),h[1]]:c[1]=[h[0],.5*h[1]+this.getMap().getSize()[1]*(this.get("position")-.5)],this._drawRect(e,c),t.clip()}}precomposeRight(e){var t=e.context;if(t instanceof WebGLRenderingContext){if("prerender"===e.type){t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.enable(t.SCISSOR_TEST);var i,o,s=this.getMap().getSize(),r=this._transformPt(e,[0,s[1]]),a=this._transformPt(e,[s[0],0]),n=a[0]-r[0],l=a[1]-r[1];"vertical"===this.get("orientation")?(o=l,i=Math.round(n*(1-this.get("position"))),r[0]+=n-i):(i=n,o=Math.round(l*(1-this.get("position")))),t.scissor(r[0],r[1],i,o)}}else{var h=e.frameState.size;t.save(),t.beginPath();var c=[[0,0],[h[0],h[1]]];"vertical"===this.get("orientation")?c[0]=[.5*h[0]+this.getMap().getSize()[0]*(this.get("position")-.5),0]:c[0]=[0,.5*h[1]+this.getMap().getSize()[1]*(this.get("position")-.5)],this._drawRect(e,c),t.clip()}}postcompose(e){if(e.context instanceof WebGLRenderingContext){if("postrender"===e.type){var t=e.context;t.disable(t.SCISSOR_TEST)}}else e.target.getClassName&&"ol-layer"!==e.target.getClassName()&&e.target.get("declutter")?setTimeout(function(){e.context.restore()},0):e.context.restore()}},ol.control.SwipeMap=class extends ol.control.Control{constructor(e){e=e||{};var t=document.createElement("button"),i=document.createElement("div");i.className=(e.className||"ol-swipe")+" ol-unselectable ol-control",super({element:i}),i.appendChild(t),i.addEventListener("mousedown",this.move.bind(this)),i.addEventListener("touchstart",this.move.bind(this)),this.on("propertychange",function(e){"horizontal"===this.get("orientation")?(this.element.style.top=100*this.get("position")+"%",this.element.style.left=""):("vertical"!==this.get("orientation")&&this.set("orientation","vertical"),this.element.style.left=100*this.get("position")+"%",this.element.style.top=""),"orientation"===e.key&&(this.element.classList.remove("horizontal","vertical"),this.element.classList.add(this.get("orientation"))),this._clip()}.bind(this)),this.on("change:active",this._clip.bind(this)),this.set("position",e.position||.5),this.set("orientation",e.orientation||"vertical"),this.set("right",e.right)}setMap(e){this.getMap()&&(this._listener&&ol.Observable.unByKey(this._listener),this.getMap().getViewport().querySelector(".ol-layers").style.clip="");super.setMap(e),e&&(this._listener=e.on("change:size",this._clip.bind(this)))}_clip(){if(this.getMap()){var e=this.getMap().getViewport().querySelector(".ol-layers"),t=this.getRectangle();e.style.clip="rect("+t[1]+"px,"+t[2]+"px,"+t[3]+"px,"+t[0]+"px)"}}getRectangle(){var e=this.getMap().getSize();return"vertical"===this.get("orientation")?this.get("right")?[e[0]*this.get("position"),0,e[0],e[1]]:[0,0,e[0]*this.get("position"),e[1]]:this.get("right")?[0,e[1]*this.get("position"),e[0],e[1]]:[0,0,e[0],e[1]*this.get("position")]}move(e){var t,i=this;switch(this._movefn||(this._movefn=this.move.bind(this)),e.type){case"touchcancel":case"touchend":case"mouseup":i.isMoving=!1,["mouseup","mousemove","touchend","touchcancel","touchmove"].forEach(function(e){document.removeEventListener(e,i._movefn)});break;case"mousedown":case"touchstart":i.isMoving=!0,["mouseup","mousemove","touchend","touchcancel","touchmove"].forEach(function(e){document.addEventListener(e,i._movefn)});case"mousemove":case"touchmove":if(i.isMoving)if("vertical"===i.get("orientation")){var o=e.pageX||e.touches&&e.touches.length&&e.touches[0].pageX||e.changedTouches&&e.changedTouches.length&&e.changedTouches[0].pageX;if(!o)break;o-=i.getMap().getTargetElement().getBoundingClientRect().left+window.pageXOffset-document.documentElement.clientLeft;var s=(t=i.getMap().getSize()[0])-Math.min(Math.max(0,t-o),t);t=s/t,i.set("position",t),i.dispatchEvent({type:"moving",size:[s,i.getMap().getSize()[1]],position:[t,0]})}else{var r=e.pageY||e.touches&&e.touches.length&&e.touches[0].pageY||e.changedTouches&&e.changedTouches.length&&e.changedTouches[0].pageY;if(!r)break;r-=i.getMap().getTargetElement().getBoundingClientRect().top+window.pageYOffset-document.documentElement.clientTop;var a=(t=i.getMap().getSize()[1])-Math.min(Math.max(0,t-r),t);t=a/t,i.set("position",t),i.dispatchEvent({type:"moving",size:[i.getMap().getSize()[0],a],position:[0,t]})}}}},ol.control.Target=class extends ol.control.CanvasBase{constructor(e){var t=(e=e||{}).style||[new ol.style.Style({image:new ol.style.RegularShape({points:4,radius:11,radius1:0,radius2:0,snapToPixel:!0,stroke:new ol.style.Stroke({color:"#fff",width:3})})}),new ol.style.Style({image:new ol.style.RegularShape({points:4,radius:11,radius1:0,radius2:0,snapToPixel:!0,stroke:new ol.style.Stroke({color:"#000",width:1})})})];t instanceof Array||(t=[t]);var i=document.createElement("div");i.className="ol-target ol-unselectable ol-control",super({element:i,style:t,target:e.target}),this.composite=e.composite||"",this.setVisible(!1!==e.visible)}setStyle(e){e instanceof Array||(e=[e]),super.setStyle(e)}setVisible(e){if(this.set("visible",e),this.getMap())try{this.getMap().renderSync()}catch(e){}}getVisible(){return this.get("visible")}_draw(e){var t=this.getContext(e);if(t&&this.getMap()&&this.getVisible()){var i=e.frameState.pixelRatio;t.save(),t.scale(i,i);var o=t.canvas.width/2/i,s=t.canvas.height/2/i,r=new ol.geom.Point(this.getMap().getCoordinateFromPixel([o,s]));this.composite&&(t.globalCompositeOperation=this.composite);for(var a=0;a=1?e++:e=Math.min(1,e+.1),e=Math.round(100*e)/100,this.refresh(e)}.bind(this)}),this.addButton({className:"ol-zoom-out",handleClick:function(){var e=this.get("zoom");e>1?e--:e-=.1,e=Math.round(100*e)/100,this.refresh(e)}.bind(this)})),this._intervalDiv=ol.ext.element.create("DIV",{className:"ol-center-date",parent:this.element}),this.element.addEventListener("mouseover",function(){this._select&&this._select.elt.classList.remove("ol-select")}.bind(this));var t=null;this._scrollDiv.addEventListener("scroll",function(){this._setScrollLeft(),t&&(clearTimeout(t),t=null),t=setTimeout(function(){this.dispatchEvent({type:"scroll",date:this.getDate(),dateStart:this.getDate("start"),dateEnd:this.getDate("end")})}.bind(this),e.scrollTimeout||15)}.bind(this)),ol.ext.element.scrollDiv(this._scrollDiv,{onmove:function(e){this._moving=e}.bind(this)}),this._tline=[],this._scrollLeft=0,this.set("maxWidth",e.maxWidth||2e3),this.set("minDate",e.minDate||1/0),this.set("maxDate",e.maxDate||-1/0),this.set("graduation",e.graduation),this.set("minZoom",e.minZoom||.2),this.set("maxZoom",e.maxZoom||4),this.setInterval(e.interval),e.getHTML&&(this._getHTML=e.getHTML),e.getFeatureDate&&(this._getFeatureDate=e.getFeatureDate),e.endFeatureDate&&(this._endFeatureDate=e.endFeatureDate),this.setFeatures(e.features||e.source,e.zoom)}setMap(e){super.setMap(e),this.refresh(this.get("zoom")||1,!0)}addButton(e){this.element.classList.add("ol-hasbutton"),ol.ext.element.create("BUTTON",{className:e.className||void 0,title:e.title,html:e.html,click:e.handleClick,parent:this._buttons})}setInterval(e){"string"==typeof e&&(e=/s$/.test(e)?1e3*parseFloat(e):/mn$/.test(e)?1e3*parseFloat(e)*60:/h$/.test(e)?1e3*parseFloat(e)*3600:/d$/.test(e)?1e3*parseFloat(e)*3600*24:/y$/.test(e)?1e3*parseFloat(e)*3600*24*365:0),this.set("interval",e||0),e?this.element.classList.add("ol-interval"):this.element.classList.remove("ol-interval"),this.refresh(this.get("zoom"))}_getHTML(e){return e.get("name")||""}_getFeatureDate(e){return e&&e.get?e.get("date"):null}_endFeatureDate(){}isCollapsed(){return this.element.classList.contains("ol-collapsed")}collapse(e){e?this.element.classList.add("ol-collapsed"):this.element.classList.remove("ol-collapsed"),this.dispatchEvent({type:"collapse",collapsed:this.isCollapsed()})}toggle(){this.element.classList.toggle("ol-collapsed"),this.dispatchEvent({type:"collapse",collapsed:this.isCollapsed()})}setFeatures(e,t){this._features=this._source=null,e instanceof ol.source.Vector?this._source=e:e instanceof Array?this._features=e:this._features=[],this.refresh(t)}getFeatures(){return this._features||this._source.getFeatures()}refresh(e,t){if(this.getMap()){e||(e=this.get("zoom")),e=Math.min(this.get("maxZoom"),Math.max(this.get("minZoom"),e||1)),this.set("zoom",e),this._scrollDiv.innerHTML="";var i,o,s=this.getFeatures(),r=this._tline=[];s.forEach(function(e){(i=this._getFeatureDate(e))&&(i instanceof Date||(i=new Date(i)),this._endFeatureDate&&((o=this._endFeatureDate(e))instanceof Date||(o=new Date(o))),isNaN(i)||r.push({date:i,end:isNaN(o)?null:o,feature:e}))}.bind(this)),r.sort(function(e,t){return e.datec?c/h:1)*e;h=(l-(n=this._minDate=this._minDate-10/u))*u,ol.ext.element.setStyle(a,{width:h,maxWidth:"unset"}),this._drawTime(a,n,l,u),this.get("interval")?ol.ext.element.setStyle(this._intervalDiv,{width:this.get("interval")*u}):ol.ext.element.setStyle(this._intervalDiv,{width:""});var d=[],g=ol.ext.element.getStyle(this._scrollDiv,"lineHeight"),p=ol.ext.element.create("DIV",{className:"ol-features",parent:a});r.forEach(function(e){for(var t=e.date,i=e.elt=ol.ext.element.create("DIV",{className:"ol-feature",style:{left:Math.round((t-n)*u)},html:this._getHTML(e.feature),parent:p}),o=i.querySelectorAll("img"),s=0;sa);r++);d[r]=l+ol.ext.element.getStyle(i,"width"),ol.ext.element.setStyle(i,{top:r*g})}.bind(this)),this._nbline=d.length,t&&this.setDate(this._minDate,{anim:!1,position:"start"}),this.dispatchEvent({type:"scroll",date:this.getDate(),dateStart:this.getDate("start"),dateEnd:this.getDate("end")})}}_getOffsetFromDate(e){return(e-this._minDate)*this._scale}_getDateFromOffset(e){return e/this._scale+this._minDate}_setScrollLeft(e){this._scrollLeft=e,void 0!==e&&(this._scrollDiv.scrollLeft=e)}_getScrollLeft(){return void 0===this._scrollLeft?this._scrollDiv.scrollLeft:this._scrollLeft}_drawTime(e,t,i,o){var s,r,a,n,l=ol.ext.element.create("DIV",{className:"ol-times",parent:e}),h=ol.ext.element.getStyle(l,"left"),c=ol.ext.element.getStyle(l,"height"),u=new Date(this._minDate).getFullYear();r=(new Date(0).setFullYear(String(u))-new Date(0).setFullYear(String(u-1)))*o;for(var d=Math.round(2*c/r)+1;!((s=new Date(0).setFullYear(u))>this._maxDate);)ol.ext.element.create("DIV",{className:"ol-time ol-year",style:{left:this._getOffsetFromDate(s)-h},html:u,parent:l}),u+=d;if(/day|month/.test(this.get("graduation"))&&(r=(new Date(0,0,1).setFullYear(String(u))-new Date(0,0,1).setFullYear(String(u-1)))*o,(n=Math.max(1,Math.round(12/Math.round(r/c/2))))<12))for(u=new Date(this._minDate).getFullYear(),a=n+1;(s=new Date(0,0,1)).setFullYear(u),s.setMonth(a-1),!(s>this._maxDate);)ol.ext.element.create("DIV",{className:"ol-time ol-month",style:{left:this._getOffsetFromDate(s)-h},html:s.toLocaleDateString(void 0,{month:"short"}),parent:l}),(a+=n)>12&&(u++,a=n+1);if("day"===this.get("graduation")){r=(new Date(0,1,1)-new Date(0,0,1))*o;var g=Math.max(1,Math.round(31/Math.round(r/c/2)));if(g<31){u=new Date(this._minDate).getFullYear(),a=0;for(var p=g;;)if((s=new Date(0,0,1)).setFullYear(u),s.setMonth(a),s.setDate(p),isNaN(s))++a>12&&(a=1,u++),p=g;else{if(s>this._maxDate)break;if(p>1){var m=this._getOffsetFromDate(s);this._getOffsetFromDate(new Date(u,a+1,1))-m>c&&ol.ext.element.create("DIV",{className:"ol-time ol-day",style:{left:m-h},html:p,parent:l})}u=s.getFullYear(),a=s.getMonth(),(p=s.getDate()+g)>new Date(u,a+1,0).getDate()&&(a++,p=g)}}}}setDate(e,t){var i;if(t=t||{},e instanceof Date?i=e:(this.getFeatures().indexOf(e)>=0&&(i=this._getFeatureDate(e)),!i||i instanceof Date||(i=new Date(i)),i&&!isNaN(i)||(i=new Date(String(e)))),!isNaN(i)){!1===t.anim&&this._scrollDiv.classList.add("ol-move");var o=this._getOffsetFromDate(i);if("start"===t.position?o+=ol.ext.element.outerWidth(this._scrollDiv)/2-ol.ext.element.getStyle(this._scrollDiv,"marginLeft")/2:"end"===t.position&&(o-=ol.ext.element.outerWidth(this._scrollDiv)/2-ol.ext.element.getStyle(this._scrollDiv,"marginLeft")/2),this._setScrollLeft(o),!1===t.anim&&this._scrollDiv.classList.remove("ol-move"),e)for(var s,r=0;s=this._tline[r];r++)s.feature===e?(s.elt.classList.add("ol-select"),this._select=s):s.elt.classList.remove("ol-select")}}roundDate(e,t){switch(t){case"mn":return new Date(this._roundTo(e,6e4));case"hour":return new Date(this._roundTo(e,36e5));case"day":return new Date(this._roundTo(e,864e5));case"month":return(e=new Date(this._roundTo(e,864e5))).getDate()>15&&(e=new Date(e.setMonth(e.getMonth()+1))),e=e.setDate(1),new Date(e);default:return new Date(e)}}getDate(e,t){var i;switch(t||(t=e),e){case"start":i=this.get("interval")?-ol.ext.element.getStyle(this._intervalDiv,"width")/2+ol.ext.element.getStyle(this._scrollDiv,"marginLeft")/2:-ol.ext.element.outerWidth(this._scrollDiv)/2+ol.ext.element.getStyle(this._scrollDiv,"marginLeft")/2;break;case"end":i=this.get("interval")?ol.ext.element.getStyle(this._intervalDiv,"width")/2-ol.ext.element.getStyle(this._scrollDiv,"marginLeft")/2:ol.ext.element.outerWidth(this._scrollDiv)/2-ol.ext.element.getStyle(this._scrollDiv,"marginLeft")/2;break;default:i=0}var o=this._getDateFromOffset(this._getScrollLeft()+i);return o=this.roundDate(o,t),new Date(o)}_roundTo(e,t){return Math.round(e/t)*t}getStartDate(){return new Date(this.get("minDate"))}getEndDate(){return new Date(this.get("maxDate"))}},ol.control.VideoRecorder=class extends ol.control.Control{constructor(e){e=e||{};var t=ol.ext.element.create("DIV",{className:(e.className||"ol-videorec")+" ol-unselectable ol-control"});super({element:t,target:e.target}),ol.ext.element.create("BUTTON",{type:"button",className:"ol-start",title:ol.control.VideoRecorder.prototype.tips.start,click:function(){this.start()}.bind(this),parent:t}),ol.ext.element.create("BUTTON",{type:"button",className:"ol-stop",title:ol.control.VideoRecorder.prototype.tips.stop,click:function(){this.stop()}.bind(this),parent:t}),ol.ext.element.create("BUTTON",{type:"button",className:"ol-pause",title:ol.control.VideoRecorder.prototype.tips.pause,click:function(){this.pause()}.bind(this),parent:t}),ol.ext.element.create("BUTTON",{type:"button",className:"ol-resume",title:ol.control.VideoRecorder.prototype.tips.resume,click:function(){this.resume()}.bind(this),parent:t}),this.set("framerate",30),this.set("videoBitsPerSecond",5e6),"DIALOG"===e.videoTarget?(this._dialog=new ol.control.Dialog({className:"ol-fullscreen-dialog",target:document.body,closeBox:!0}),this._videoTarget=this._dialog.getContentElement()):this._videoTarget=e.videoTarget,this._printCtrl=new ol.control.Print({target:ol.ext.element.create("DIV")})}setTooltip(e,t){var i=this.element.querySelector("button.ol-"+e);i&&(i.title=t)}setMap(e){this.getMap()&&(this.getMap().removeControl(this._printCtrl),this._dialog&&this.getMap().removeControl(this._dialog)),super.setMap(e),this.getMap()&&(this.getMap().addControl(this._printCtrl),this._dialog&&this.getMap().addControl(this._dialog))}start(){var e=this._printCtrl,t=!1;function i(o){t||e.fastPrint({canvas:o},i)}e.fastPrint({},function(e){var o;try{o=e.captureStream(this.get("framerate")||30)}catch(e){return void this.dispatchEvent({type:"error",error:e})}this._mediaRecorder=new MediaRecorder(o,{videoBitsPerSecond:this.get("videoBitsPerSecond")||5e6});var s=[];this._mediaRecorder.ondataavailable=function(e){s.push(e.data)},this._mediaRecorder.onstop=function(){t=!0;var e,i=new Blob(s,{type:"video/mp4"});(s=[],this._videoTarget instanceof Element)?("VIDEO"===this._videoTarget.tagName?e=this._videoTarget:(e=this._videoTarget.querySelector("video"))||(e=ol.ext.element.create("VIDEO",{controls:"",parent:this._videoTarget})),this._dialog&&this._dialog.show(),e.src=URL.createObjectURL(i),this.dispatchEvent({type:"stop",videoURL:e.src})):this.dispatchEvent({type:"stop",videoURL:URL.createObjectURL(i)})}.bind(this),this._mediaRecorder.onpause=function(){t=!0,this.dispatchEvent({type:"pause"})}.bind(this),this._mediaRecorder.onresume=function(){t=!1,i(e),this.dispatchEvent({type:"resume"})}.bind(this),this._mediaRecorder.onerror=function(e){this.dispatchEvent({type:"error",error:e})}.bind(this),t=!1,i(e),this._mediaRecorder.start(),this.dispatchEvent({type:"start",canvas:e}),this.element.setAttribute("data-state","rec")}.bind(this))}stop(){this._mediaRecorder&&(this._mediaRecorder.stop(),this._mediaRecorder=null,this.element.setAttribute("data-state","inactive"))}pause(){this._mediaRecorder&&(this._mediaRecorder.pause(),this.element.setAttribute("data-state","pause"))}resume(){this._mediaRecorder&&(this._mediaRecorder.resume(),this.element.setAttribute("data-state","rec"))}},ol.control.VideoRecorder.prototype.tips={start:"start video",stop:"stop",pause:"pause",resume:"resume"},ol.control.WMSCapabilities=class extends ol.control.Button{constructor(e){e=e||{};var t=Object.assign({},e||{});t.target===document.body&&delete t.target,t.target?(t.className=((t.className||"")+" ol-wmscapabilities ol-hidden").trim(),delete t.target):(t.className=((t.className||"")+" ol-wmscapabilities").trim(),t.handleClick=function(){i.showDialog()}),super(t);var i=this;this._proxy=e.proxy,this.set("srs",e.srs||[]),this.set("cors",e.cors),this.set("trace",e.trace),this.set("title",e.title),this.set("loadLabel",e.loadLabel),this.set("optional",e.optional),this.createDialog(e),this._elements.formVersion.value="1.0.0";var o=this._getParser();this._ajax=new ol.ext.Ajax({dataType:"text",auth:e.authentication}),this._ajax.on("success",function(e){var t;try{t=o.read(e.response)}catch(e){this.showError({type:"load",error:e})}t&&(t.Capability.Layer.Layer?this.showCapabilities(t):this.showError({type:"noLayer"})),this.dispatchEvent({type:"capabilities",capabilities:t}),"function"==typeof e.options.callback&&e.options.callback(t)}.bind(this)),this._ajax.on("error",function(e){this.showError({type:"load",error:e}),this.dispatchEvent({type:"capabilities"}),e.options.callback}.bind(this)),this._ajax.on("loadstart",function(){this._elements.element.classList.add("ol-searching")}.bind(this)),this._ajax.on("loadend",function(){this._elements.element.classList.remove("ol-searching")}.bind(this)),e.onselect&&this.on("load",function(t){e.onselect(t.layer,t.options)})}_getParser(){return new ol.format.WMSCapabilities}createDialog(e){var t=e.target;t&&t!==document.body||(this._dialog=new ol.control.Dialog({className:"ol-wmscapabilities",closeBox:!0,closeOnSubmit:!1,target:e.target}),this._dialog.on("button",function(e){"submit"===e.button&&this.getCapabilities(e.inputs.url.value)}.bind(this)),t=null);var i=ol.ext.element.create("DIV",{className:("ol-wmscapabilities "+(e.className||"")).trim(),parent:t});this._elements={element:t||i};var o=ol.ext.element.create("DIV",{className:"ol-url",parent:i}),s=this._elements.input=ol.ext.element.create("INPUT",{className:"url",type:"text",tabIndex:1,placeholder:e.placeholder||"service url...",autocorrect:"off",autocapitalize:"off",parent:o});if(s.addEventListener("keyup",function(t){13===t.keyCode&&this.getCapabilities(s.value,e)}.bind(this)),e.services){var r=ol.ext.element.create("SELECT",{className:"url",on:{change:function(t){var i=t.target.options[t.target.selectedIndex].value;this.getCapabilities(i,e),t.target.selectedIndex=0}.bind(this)},parent:o});for(var a in ol.ext.element.create("OPTION",{html:" ",parent:r}),e.services)ol.ext.element.create("OPTION",{html:a,value:e.services[a],parent:r})}ol.ext.element.create("BUTTON",{click:function(){this.getCapabilities(s.value,e)}.bind(this),html:e.searchLabel||"search",parent:o}),this._elements.error=ol.ext.element.create("DIV",{className:"ol-error",parent:o});var n=this._elements.result=ol.ext.element.create("DIV",{className:"ol-result",parent:i}),l=ol.ext.element.create("DIV",{className:"ol-preview",html:e.previewLabel||"preview",parent:n});this._elements.preview=ol.ext.element.create("IMG",{parent:l}),this._img=new Image,this._img.crossOrigin="Anonymous",this._img.addEventListener("error",function(){l.className="ol-preview tainted",this._elements.formCrossOrigin.checked=!1}.bind(this)),this._img.addEventListener("load",function(){l.className="ol-preview ok",this._elements.formCrossOrigin.checked=!0}.bind(this)),this._elements.select=ol.ext.element.create("DIV",{className:"ol-select-list",tabIndex:2,parent:n}),this._elements.data=ol.ext.element.create("DIV",{className:"ol-data",parent:n}),this._elements.buttons=ol.ext.element.create("DIV",{className:"ol-buttons",parent:n}),this._elements.legend=ol.ext.element.create("IMG",{className:"ol-legend",parent:n});var h=this._elements.form=ol.ext.element.create("UL",{className:"ol-wmsform",parent:i}),c=function(e,t,i){var o=ol.ext.element.create("LI",{parent:h});if(ol.ext.element.create("LABEL",{html:this.labels[e],parent:o}),"boolean"==typeof t)this._elements[e]=ol.ext.element.create("INPUT",{type:"checkbox",checked:t,parent:o});else if(t instanceof Array){var s=this._elements[e]=ol.ext.element.create("SELECT",{parent:o});t.forEach(function(e){ol.ext.element.create("OPTION",{html:e,value:e,parent:s})}.bind(this))}else this._elements[e]=ol.ext.element.create("INPUT",{value:void 0===t?"":t,placeholder:i||"",type:"number"==typeof t?"number":"text",parent:o});return o}.bind(this);c("formTitle"),c("formLayer","","layer1,layer2,...");var u=c("formMap");u.setAttribute("data-param","map"),(u=c("formStyle")).setAttribute("data-param","style"),c("formFormat",["image/png","image/jpeg"]),c("formMinZoom",0),c("formMaxZoom",20),(u=c("formExtent","","xmin,ymin,xmax,ymax")).setAttribute("data-param","extent");var d=u.querySelector("input");return ol.ext.element.create("BUTTON",{title:this.labels.mapExtent,click:function(){d.value=this.getMap().getView().calculateExtent(this.getMap().getSize()).join(",")}.bind(this),parent:u}),(u=c("formProjection","")).setAttribute("data-param","proj"),c("formCrossOrigin",!1),(u=c("formVersion","1.3.0")).setAttribute("data-param","version"),c("formAttribution",""),ol.ext.element.create("BUTTON",{html:this.get("loadLabel")||"Load",click:function(){var e=this._getFormOptions(),t=this.getLayerFromOptions(e);this.dispatchEvent({type:"load",layer:t,options:e}),this._dialog.hide()}.bind(this),parent:h}),i}getLayerFromOptions(e){e.layer.source=new ol.source.TileWMS(e.source);var t=new ol.layer.Tile(e.layer);return delete e.layer.source,t}setMap(e){super.setMap(e),this._dialog&&this._dialog.setMap(e)}getDialog(){return this._dialog}showDialog(e,t){this.showError(),this._elements.formProjection.value||(this._elements.formProjection.value=this.getMap().getView().getProjection().getCode()),this._dialog&&this._dialog.show({title:void 0===this.get("title")?"WMS":this.get("title"),content:this._elements.element}),this.getCapabilities(e,t);var i=this._elements.select.querySelector(".selected");i&&(this._elements.select.scrollTop=i.offsetTop-20)}testUrl(e){return!!new RegExp("^(https?:\\/\\/)((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=\\/-]*)?(\\#[-a-z\\d_]*)?$","i").test(e)}getRequestParam(e){return{SERVICE:"WMS",REQUEST:"GetCapabilities",VERSION:e.version||"1.3.0"}}getCapabilities(e,t){if(e)if(this.testUrl(e)){t=t||{};var i=(e=e.split("?"))[1];e=e[0],this._elements.formMap.value="",this._elements.formLayer.value="",this._elements.formStyle.value="",this._elements.formTitle.value="",this._elements.formProjection.value=this.getMap().getView().getProjection().getCode(),this._elements.formFormat.selectedIndex=0;var o=t.map||"",s={};i&&(i=i.replace(/^\?/,"").split("&")).forEach(function(e){if((e=e.split("="))[1]=decodeURIComponent(e[1]||""),/^map$/i.test(e[0])&&(o=e[1],this._elements.formMap.value=o),/^layers$/i.test(e[0])&&(this._elements.formLayer.value=e[1],this._elements.formTitle.value=e[1].split(",")[0]),/^style$/i.test(e[0])&&(this._elements.formStyle.value=e[1]),/^crs$/i.test(e[0])&&(this._elements.formProjection.value=e[1]),/^format$/i.test(e[0]))for(var t,i=0;t=this._elements.formFormat.options[i];i++)if(t.value===e[1]){this._elements.formFormat.selectedIndex=i;break}this.get("optional")&&this.get("optional").split(",").forEach(function(t){t===e[0]&&(s[t]=e[1])}.bind(this))}.bind(this));var r=this.getRequestParam(t),a=[];for(var n in o&&(r.MAP=o,a.push("map="+o)),s)r[n]=s[n],a.push(n+"="+s[n]);if(this._elements.input.value=(e||"")+(a?"?"+a.join("&"):""),this.clearForm(),this._proxy){var l="";for(var h in r)l+=(l?"&":"")+h+"="+r[h];this._ajax.send(this._proxy,{url:l},{timeout:t.timeout||1e4,callback:t.onload,abort:!1})}else this._ajax.send(e,r,{timeout:t.timeout||1e4,callback:t.onload,abort:!1})}else this.showError({type:"badUrl"})}showError(e){this._elements.error.innerHTML=e?this.error[e.type]||"ERROR ("+e.type+")":"",e&&"load"===e.type?this._elements.form.classList.add("visible"):this._elements.form.classList.remove("visible")}clearForm(){this._elements.result.classList.remove("ol-visible"),this.showError(),this._elements.select.innerHTML="",this._elements.data.innerHTML="",this._elements.preview.src="",this._elements.legend.src="",this._elements.legend.classList.remove("visible")}showCapabilities(e){this._elements.result.classList.add("ol-visible");var t=[],i=function(o,s){s=s||0,o.Layer.forEach(function(r){r.Attribution||(r.Attribution=o.Attribution),r.EX_GeographicBoundingBox||(r.EX_GeographicBoundingBox=o.EX_GeographicBoundingBox);var a=ol.ext.element.create("DIV",{className:(r.Layer?"ol-title ":"")+"level-"+s,html:r.Name||r.Title,click:function(){this._elements.buttons.innerHTML="",this._elements.data.innerHTML="",this._elements.legend.src=this._elements.preview.src="",this._elements.element.classList.remove("ol-form"),this.showError();var i=this.getOptionsFromCap(r,e),o=this.getLayerFromOptions(i);if(this._currentOptions=i,t.forEach(function(e){e.classList.remove("selected")}),a.classList.add("selected"),o){ol.ext.element.create("BUTTON",{html:this.get("loadLabel")||"Load",className:"ol-load",click:function(){this.dispatchEvent({type:"load",layer:o,options:i}),this._dialog&&this._dialog.hide()}.bind(this),parent:this._elements.buttons}),ol.ext.element.create("BUTTON",{className:"ol-wmsform",click:function(){this._elements.element.classList.toggle("ol-form")}.bind(this),parent:this._elements.buttons});var s=this.getMap().getView().getResolution(),n=this.getMap().getView().getCenter();this._elements.preview.src=o.getPreview(n,s,this.getMap().getView().getProjection()),this._img.src=this._elements.preview.src,ol.ext.element.create("p",{className:"ol-title",html:i.data.title,parent:this._elements.data}),ol.ext.element.create("p",{html:i.data.abstract,parent:this._elements.data}),i.data.legend&&i.data.legend.length?(this._elements.legend.src=i.data.legend[0],this._elements.legend.classList.add("visible")):(this._elements.legend.src="",this._elements.legend.classList.remove("visible"))}}.bind(this),parent:this._elements.select});t.push(a),r.Layer&&i(r,s+1)}.bind(this))}.bind(this);this._elements.select.innerHTML="",i(e.Capability.Layer)}getLayerResolution(e,t,i){var o="min"===e?"MinScaleDenominator":"MaxScaleDenominator";if(void 0!==t[o])return t[o]/(72/2.54*100);if(!t.Layer)return"min"===e?0:156543.03392804097;i="min"===e?156543.03392804097:0;for(var s=0;s=0?l=!0:e.CRS.indexOf("EPSG:4326")>=0?(n="EPSG:4326",l=!0):this.get("srs").forEach(function(t){e.CRS.indexOf(t)>=0&&(n=t,l=!0)}):l=!1,l||(this.showError({type:"srs"}),this.get("trace")&&console.log("BAD srs: ",e.CRS));var h=e.EX_GeographicBoundingBox;h&&(h=ol.proj.transformExtent(h,"EPSG:4326",this.getMap().getView().getProjection()));var c=[];e.Attribution&&e.Attribution.Title&&c.push('© '+e.Attribution.Title.replace(/");var u={title:e.Title,extent:h,queryable:e.queryable,abstract:e.Abstract,minResolution:this.getLayerResolution("min",e),maxResolution:this.getLayerResolution("max",e)||156543.03392804097},d={url:t.Capability.Request.GetMap.DCPType[0].HTTP.Get.OnlineResource,projection:n,attributions:c,crossOrigin:this.get("cors")?"anonymous":null,params:{LAYERS:e.Name,FORMAT:i,VERSION:t.version||"1.3.0"}},g=new ol.View({projection:this.getMap().getView().getProjection()});g.setResolution(u.minResolution);var p=Math.round(g.getZoom());g.setResolution(u.maxResolution);var m=Math.round(g.getZoom());if(this._fillForm({title:u.title,layers:d.params.LAYERS,format:d.params.FORMAT,minZoom:m,maxZoom:p,extent:h?h.join(","):"",projection:d.projection,attribution:d.attributions[0]||"",version:d.params.VERSION}),this.get("trace")){var f=JSON.stringify([d],null,"\t").replace(/\\"/g,'"');u.source="SOURCE";var v="new ol.layer.Tile ("+JSON.stringify(u,null,"\t")+")";v=v.replace(/\\"/g,'"').replace('"SOURCE"',"new ol.source.TileWMS("+f+")").replace(/\\t/g,"\t").replace(/\\n/g,"\n").replace("([\n\t","(").replace("}\n])","})"),console.log(v),delete u.source}var y=[];return e.Style&&e.Style.forEach(function(e){e.LegendURL&&y.push(e.LegendURL[0].OnlineResource)}),{layer:u,source:d,data:{title:e.Title,abstract:e.Abstract,logo:e.Attribution&&e.Attribution.LogoURL?e.Attribution.LogoURL.OnlineResource:void 0,keyword:e.KeywordList,legend:y,opaque:e.opaque,queryable:e.queryable}}}_getFormOptions(){var e=parseInt(this._elements.formMinZoom.value),t=parseInt(this._elements.formMaxZoom.value),i=new ol.View({projection:this.getMap().getView().getProjection()});i.setZoom(e);var o=i.getResolution();i.setZoom(t);var s=i.getResolution(),r=[];this._elements.formExtent.value&&this._elements.formExtent.value.split(",").forEach(function(e){r.push(parseFloat(e))}),4!==r.length&&(r=void 0);var a=[];this._elements.formAttribution.value&&a.push(this._elements.formAttribution.value);var n={layer:{title:this._elements.formTitle.value,extent:r,maxResolution:o,minResolution:s},source:{url:this._elements.input.value,crossOrigin:this._elements.formCrossOrigin.checked?"anonymous":null,projection:this._elements.formProjection.value,attributions:a,params:{FORMAT:this._elements.formFormat.options[this._elements.formFormat.selectedIndex].value,LAYERS:this._elements.formLayer.value,VERSION:this._elements.formVersion.value}},data:{title:this._elements.formTitle.value}};return this._elements.formMap.value&&(n.source.params.MAP=this._elements.formMap.value),n}_fillForm(e){var t,i;for(this._elements.formTitle.value=e.title,this._elements.formLayer.value=e.layers,this._elements.formStyle.value=e.style,i=0;t=this._elements.formFormat.options[i];i++)if(t.value===e.format){this._elements.formFormat.selectedIndex=i;break}this._elements.formExtent.value=e.extent||"",this._elements.formMaxZoom.value=e.maxZoom,this._elements.formMinZoom.value=e.minZoom,this._elements.formProjection.value=e.projection,this._elements.formAttribution.value=e.attribution,this._elements.formVersion.value=e.version}loadLayer(e,t,i){this.getCapabilities(e,{onload:function(e){e?e.Capability.Layer.Layer.forEach(function(o){if(o.Name===t||o.Identifier===t){var s=this.getOptionsFromCap(o,e),r=this.getLayerFromOptions(s);this.dispatchEvent({type:"load",layer:r,options:s}),"function"==typeof i&&i({layer:r,options:s})}}.bind(this)):this.dispatchEvent({type:"load",error:!0})}.bind(this)})}},ol.control.WMSCapabilities.prototype.error={load:"Can't retrieve service capabilities, try to add it manually...",badUrl:"The input value is not a valid url...",TileMatrix:"No TileMatrixSet supported...",noLayer:"No layer available for this service...",srs:"The service projection looks different from that of your map, it may not display correctly..."},ol.control.WMSCapabilities.prototype.labels={formTitle:"Title:",formLayer:"Layers:",formMap:"Map:",formStyle:"Style:",formFormat:"Format:",formMinZoom:"Min zoom level:",formMaxZoom:"Max zoom level:",formExtent:"Extent:",mapExtent:"use map extent...",formProjection:"Projection:",formCrossOrigin:"CrossOrigin:",formVersion:"Version:",formAttribution:"Attribution:"},ol.control.WMTSCapabilities=class extends ol.control.WMSCapabilities{constructor(e){(e=e||{}).title=e.title||"WMTS",super(e),this.getDialog().element.classList.add("ol-wmtscapabilities")}_getParser(){var e=new ol.format.WMTSCapabilities;return{read:function(t){var i=e.read(t);i.Capability={Layer:i.Contents},i.Capability.Layer.Attribution={Title:i.ServiceProvider.ProviderName};var o=[];return i.Contents.Layer.forEach(function(e){e.Format&&/jpeg|png/.test(e.Format[0])&&o.push(e)}),i.Contents.Layer=o,i}.bind(this)}}getRequestParam(e){return{SERVICE:"WMTS",REQUEST:"GetCapabilities",VERSION:e.version||"1.0.0"}}_getTG(e,t,i,o){for(var s=new Array,r=new Array,a=ol.extent.getWidth(ol.proj.get("EPSG:3857").getExtent())/256,n=0;n<=(i||20);n++){var l=o?e+":"+n:n;s[n]=l,r[n]=a/Math.pow(2,n)}return{origin:[-20037508,20037508],resolutions:r,matrixIds:s,minZoom:t||0}}getTileGrid(e,t,i,o){return new ol.tilegrid.WMTS(this._getTG(e,t,i,o))}isSupportedSet(e){return"PM"===e.TileMatrixSet||"3857"===e.TileMatrixSet||"EPSG:3857"===e.TileMatrixSet||"webmercator"===e.TileMatrixSet||"GoogleMapsCompatible"===e.TileMatrixSet}getOptionsFromCap(e,t){var i=e.WGS84BoundingBox;i&&(i=ol.proj.transformExtent(i,"EPSG:4326",this.getMap().getView().getProjection()));var o,s=1/0,r=-1/0;if(e.TileMatrixSetLink.forEach(function(t){this.isSupportedSet(t)&&(o=t,e.TileMatrixSet=t.TileMatrixSet)}.bind(this)),o){if(o.TileMatrixSetLimits){var a=o.TileMatrixSetLimits[0].TileMatrix.split(":").length>1;o.TileMatrixSetLimits.forEach(function(e){var t=e.TileMatrix.split(":").pop();s=Math.min(s,parseInt(t)),r=Math.max(r,parseInt(t))})}else s=0,r=20;var n=new ol.View;n.setZoom(s);var l={title:e.Title,extent:i,abstract:e.Abstract,maxResolution:n.getResolution()},h={url:t.OperationsMetadata.GetTile.DCP.HTTP.Get[0].href,layer:e.Identifier,matrixSet:e.TileMatrixSet,format:e.Format[0]||"image/jpeg",projection:"EPSG:3857",tilePrefix:a,minZoom:s,maxZoom:r,style:e.Style?e.Style[0].Identifier:"normal",attributions:e.Attribution.Title,crossOrigin:this.get("cors")?"anonymous":null,wrapX:!1!==this.get("wrapX")};if(this._fillForm({title:l.title,layers:h.layer,style:h.style,format:h.format,minZoom:s,maxZoom:r,extent:i?i.join(","):"",projection:h.projection,attribution:h.attributions||"",version:"1.0.0"}),this.get("trace")){h.tileGrid="TILEGRID";var c=JSON.stringify([h],null,"\t").replace(/\\"/g,'"');c=c.replace('"TILEGRID"',"new ol.tilegrid.WMTS("+JSON.stringify(this._getTG(h.matrixSet,h.minZoom,h.maxZoom,h.tilePrefix),null,"\t").replace(/\n/g,"\n\t\t")+")"),delete h.tileGrid,l.source="SOURCE";var u="new ol.layer.Tile ("+JSON.stringify(l,null,"\t")+")";u=u.replace(/\\"/g,'"').replace('"SOURCE"',"new ol.source.WMTS("+c+")").replace(/\\t/g,"\t").replace(/\\n/g,"\n").replace(/"tileGrid": {/g,'"tileGrid": new ol.tilegrid.WMTS({').replace(/},\n(\t*)"style"/g,'}),\n$1"style"').replace("([\n\t","(").replace("}\n])","})"),console.log(u),delete l.source}var d=void 0;return e.Style&&e.Style[0]&&e.Style[0].LegendURL&&e.Style[0].LegendURL[0]&&(d=[e.Style[0].LegendURL[0].href]),{layer:l,source:h,data:{title:e.Title,abstract:e.Abstract,legend:d}}}this.showError({type:"TileMatrix"})}_getFormOptions(){var e=this._currentOptions||{};e.layer||(e.layer={}),e.source||(e.source={}),e.data||(e.data={});var t=parseInt(this._elements.formMinZoom.value)||0,i=parseInt(this._elements.formMaxZoom.value)||20,o=[];this._elements.formExtent.value&&this._elements.formExtent.value.split(",").forEach(function(e){o.push(parseFloat(e))}),4!==o.length&&(o=void 0);var s=[];this._elements.formAttribution.value&&s.push(this._elements.formAttribution.value);var r=new ol.View({projection:this.getMap().getView().getProjection()});return r.setZoom(t),{layer:{title:this._elements.formTitle.value,extent:o,abstract:e.layer.abstract||"",maxResolution:r.getResolution()},source:{url:this._elements.input.value,layer:this._elements.formLayer.value,matrixSet:e.source.matrixSet||"PM",format:this._elements.formFormat.options[this._elements.formFormat.selectedIndex].value,projection:"EPSG:3857",minZoom:t,maxZoom:i,style:this._elements.formStyle.value||"normal",attributions:s,crossOrigin:this._elements.formCrossOrigin.checked?"anonymous":null,wrapX:!1!==this.get("wrapX")},data:{title:this._elements.formTitle.value,abstract:e.data.abstract,legend:e.data.legend}}}getLayerFromOptions(e){if(e){e.source.tileGrid=this.getTileGrid(e.source.matrixSet,e.source.minZoom,e.source.maxZoom,e.source.tilePrefix),e.layer.source=new ol.source.WMTS(e.source);var t=new ol.layer.Tile(e.layer);return delete e.layer.source,delete e.source.tileGrid,t}}},ol.featureAnimation=class extends ol.Object{constructor(e){e=e||{},super(),this.duration_="number"==typeof e.duration?e.duration>=0?e.duration:0:1e3,this.fade_="function"==typeof e.fade?e.fade:null,this.repeat_=Number(e.repeat);var t="function"==typeof e.easing?e.easing:ol.easing.linear;e.revers?this.easing_=function(e){return 1-t(e)}:this.easing_=t,this.hiddenStyle=e.hiddenStyle}drawGeom_(e,t,i){this.fade_&&(e.context.globalAlpha=this.fade_(1-e.elapsed));for(var o=e.style,s=0;s=0;l--)0===t[l].duration_&&t.splice(l,1);var h=0,c=0,u=i&&this.getFilters?this.getFilters():[];function d(i){ol.Observable.unByKey(o),o=null,e.setStyle(r),n.stop=(new Date).getTime();var a={type:"animationend",feature:e};if(i)for(var l in i)i.hasOwnProperty(l)&&(a[l]=i[l]);t[c].dispatchEvent(a),s.dispatchEvent(a)}function g(i){if(t.length&&!o){if(n.stop&&(n.start=(new Date).getTime()-n.stop+n.start,n.stop=0),o=s.on(["postcompose","postrender"],function(i){n.type=i.type;try{n.vectorContext=i.vectorContext||ol.render.getVectorContext(i)}catch(i){}if(n.frameState=i.frameState,n.inversePixelTransform=i.inversePixelTransform,n.extent||(n.extent=i.frameState.extent,n.start=i.frameState.time,n.context=i.context),n.time=i.frameState.time-n.start,n.elapsed=n.time/t[c].duration_,n.elapsed>1&&(n.elapsed=1),i.context.save(),u.forEach(function(e){e.get("active")&&e.precompose(i)}),this.getOpacity&&(i.context.globalAlpha=this.getOpacity()),t[c].animate(n)){var o={type:"animating",step:c,start:n.start,time:n.time,elapsed:n.elapsed,rotation:n.rotation||0,geom:n.geom,coordinate:n.coord,feature:e,extra:n.extra||{}};t[c].dispatchEvent(o),s.dispatchEvent(o)}else++h0&&(this.duration_=this.dist_/this.speed_)}animate(e){if(!e.time&&!this.dist_)return!1;var t,i,o,s,r,a,n=this.dist_*this.easing_(e.elapsed),l=0;i=this.path_[0];for(var h=1;h=n){e.extra={index:h,coordinates:i},o=(n-l)/a,i=[t[0]+(i[0]-t[0])*o,t[1]+(i[1]-t[1])*o];break}l+=a}var c=e.style;if(e.rotation=Math.PI/2+Math.atan2(t[1]-i[1],t[0]-i[0]),!1!==this.rotate_){var u=[],d=this.rotate_-e.rotation+e.frameState.viewState.rotation;e.rotation=Math.PI/2+Math.atan2(t[1]-i[1],t[0]-i[0]);for(var g=0;o=e.style[g];g++)o.getImage()&&o.getImage().setRotation(d),u.push(o);e.style=u}return e.geom.setCoordinates(i),this.drawGeom_(e,e.geom),e.style=c,e.time<=this.duration_}},ol.featureAnimation.Shake=class extends ol.featureAnimation{constructor(e){super(e=e||{}),this.amplitude_=e.amplitude||40,this.bounce_=-Math.PI*(e.bounce||6),this.horizontal_=e.horizontal}animate(e){var t=e.geom.clone(),i=e.geom.clone(),o=this.easing_(e.elapsed);return o=Math.sin(this.bounce_*o)*this.amplitude_*(1-o)*e.frameState.viewState.resolution,this.horizontal_?(t.translate(o,0),i.translate(o,0)):t.translate(0,o),this.drawGeom_(e,t,i),e.time<=this.duration_}},ol.featureAnimation.Show=class extends ol.featureAnimation{constructor(e){super(e)}animate(e){return this.drawGeom_(e,e.geom),e.time<=this.duration_}},ol.featureAnimation.Slide=class extends ol.featureAnimation{constructor(e){super(e=e||{}),this.speed_=e.speed||0,this.side_=e.side||"left"}animate(e){e.time||("left"==this.side_?this.dx=e.extent[0]-e.bbox[2]:this.dx=e.extent[2]-e.bbox[0],this.speed_&&(this.duration_=Math.abs(this.dx)/this.speed_/e.frameState.viewState.resolution));var t=e.geom.clone();return t.translate(this.dx*(1-this.easing_(e.elapsed)),0),this.drawGeom_(e,t),e.time<=this.duration_}},ol.featureAnimation.Teleport=class extends ol.featureAnimation{constructor(e){super(e)}animate(e){var t=this.easing_(e.elapsed);if(t){e.context.save();var i=e.frameState.pixelRatio;e.context.globalAlpha=t,e.context.scale(t,1/t);var o=e.frameState.coordinateToPixelTransform,s=(1/t-1)*i*(o[0]*e.coord[0]+o[1]*e.coord[1]+o[4]),r=(t-1)*i*(o[2]*e.coord[0]+o[3]*e.coord[1]+o[5]);e.context.translate(s,r),this.drawGeom_(e,e.geom),e.context.restore()}return e.time<=this.duration_}},ol.featureAnimation.Throw=class extends ol.featureAnimation{constructor(e){super(e=e||{}),this.speed_=e.speed||0,this.side_=e.side||"left"}animate(e){var t,i;!e.time&&this.speed_&&("left"==this.side_?(t=this.dx=e.extent[0]-e.bbox[2],i=this.dy=e.extent[3]-e.bbox[1]):(t=this.dx=e.extent[2]-e.bbox[0],i=this.dy=e.extent[3]-e.bbox[1]),this.duration_=Math.sqrt(t*t+i*i)/this.speed_/e.frameState.viewState.resolution);var o=e.geom.clone(),s=e.geom.clone();return o.translate(this.dx*(1-this.easing_(e.elapsed)),this.dy*Math.cos(Math.PI/2*this.easing_(e.elapsed))),s.translate(this.dx*(1-this.easing_(e.elapsed)),0),this.drawGeom_(e,o,s),e.time<=this.duration_}},ol.featureAnimation.Zoom=class extends ol.featureAnimation{constructor(e){super(e=e||{}),this.set("zoomout",e.zoomOut)}animate(e){var t=this.easing_(e.elapsed);if(t){this.get("zoomout")&&(t=1/t);var i,o,s=e.style,r=[];for(i=0;i=0;i--)this.filters_[i]===t&&this.filters_.splice(i,1);for(i=t._listener.length-1;i>=0;i--)t._listener[i].target===this&&(t.removeFromLayer&&t.removeFromLayer(this),ol.Observable.unByKey(t._listener[i].listener),t._listener.splice(i,1));e.call(this)}else this.filters_.forEach(function(e){this.removeFilter(e)}.bind(this))}ol.Map.prototype.addFilter=function(e){console.warn("[OL-EXT] addFilter deprecated on map."),t.call(this,e)},ol.Map.prototype.removeFilter=function(e){i.call(this,e)},ol.Map.prototype.getFilters=function(){return this.filters_||[]},ol.layer.Base.prototype.addFilter=function(e){t.call(this,e)},ol.layer.Base.prototype.removeFilter=function(e){i.call(this,e)},ol.layer.Base.prototype.getFilters=function(){return this.filters_||[]}}(),ol.filter.Mask=class extends ol.filter.Base{constructor(e){if(super(e=e||{}),e.feature)switch(e.feature.getGeometry().getType()){case"Polygon":case"MultiPolygon":this.feature_=e.feature}this.set("inner",e.inner),this._fillColor=e.fill&&ol.color.asString(e.fill.getColor())||"rgba(0,0,0,0.2)",this._shadowColor=e.shadowColor&&ol.color.asString(e.shadowColor)||"rgba(0,0,0,0.5)",this.set("shadowWidth",e.shadowWidth||0),this.set("shadowMapUnits",!0===e.shadowMapUnits)}setFillColor(e){this._fillColor=e&&ol.color.asString(e)||"rgba(0,0,0,0.2)"}setShadowColor(e){this._shadowColor=e&&ol.color.asString(e)||"rgba(0,0,0,0.5)"}drawFeaturePath_(e,t){var i,o=e.context,s=o.canvas,r=e.frameState.pixelRatio;if(e.frameState.coordinateToPixelTransform){var a=e.frameState.coordinateToPixelTransform;if(e.inversePixelTransform){var n=e.inversePixelTransform;i=function(e){return[(e=[e[0]*a[0]+e[1]*a[1]+a[4],e[0]*a[2]+e[1]*a[3]+a[5]])[0]*n[0]-e[1]*n[1]+n[4],-e[0]*n[2]+e[1]*n[3]+n[5]]}}else i=function(e){return[(e[0]*a[0]+e[1]*a[1]+a[4])*r,(e[0]*a[2]+e[1]*a[3]+a[5])*r]}}else a=e.frameState.coordinateToPixelMatrix,i=function(e){return[(e[0]*a[0]+e[1]*a[1]+a[12])*r,(e[0]*a[4]+e[1]*a[5]+a[13])*r]};var l=this.feature_.getGeometry().getCoordinates();function h(e){for(var t=0;tf&&([m,f]=[f,m]);for(var v=m;v<=f;v++)h(v*u)}else h(0)}postcompose(e){if(this.feature_){var t=e.context;if(t.save(),this.drawFeaturePath_(e,!this.get("inner")),t.fillStyle=this._fillColor,t.fill("evenodd"),this.get("shadowWidth")){var i=this.get("shadowWidth")*e.frameState.pixelRatio;this.get("shadowMapUnits")&&(i/=e.frameState.viewState.resolution),t.clip("evenodd"),t.filter="blur("+i+"px)",t.strokeStyle=this._shadowColor,t.lineCap="round",t.lineJoin="round",t.lineWidth=i,t.stroke()}t.restore()}}},ol.filter.CSS=class extends ol.filter.Base{constructor(e){super(e),this._layers=[]}setBlend(e){this.set("blend",e),this._layers.forEach(function(t){t.once("postrender",function(t){t.context.canvas.parentNode.style["mix-blend-mode"]=e||""}.bind(this)),t.changed()})}setFilter(e){this.set("filter",e),this._layers.forEach(function(t){t.once("postrender",function(t){t.context.canvas.parentNode.style.filter=e||""}.bind(this)),t.changed()})}setDisplay(e){this.set("display",e),this._layers.forEach(function(t){t.once("postrender",function(t){t.context.canvas.parentNode.style.display=e?"":"none"}.bind(this)),t.changed()})}addToLayer(e){e.once("postrender",function(e){e.context.canvas.parentNode.style["mix-blend-mode"]=this.get("blend")||"",e.context.canvas.parentNode.style.filter=this.get("filter")||"",e.context.canvas.parentNode.style.display=!1!==this.get("display")?"":"none"}.bind(this)),e.changed(),this._layers.push(e)}removeFromLayer(e){var t=this._layers.indexOf(e);t>=0&&(e.once("postrender",function(e){e.context.canvas.parentNode.style["mix-blend-mode"]="",e.context.canvas.parentNode.style.filter="",e.context.canvas.parentNode.style.display=""}.bind(this)),e.changed(),this._layers.splice(t,1))}},ol.filter.CanvasFilter=class extends ol.filter.Base{constructor(e){super(e),this._svg={}}addSVGFilter(e){e.getId&&(e="#"+e.getId()),this._svg[e]=1,this.dispatchEvent({type:"propertychange",key:"svg",oldValue:this._svg})}removeSVGFilter(e){e.getId&&(e="#"+e.getId()),delete this._svg[e],this.dispatchEvent({type:"propertychange",key:"svg",oldValue:this._svg})}precompose(){}postcompose(e){var t=[];for(var i in void 0!==this.get("url")&&t.push("url("+this.get("url")+")"),this._svg)t.push("url("+i+")");void 0!==this.get("blur")&&t.push("blur("+this.get("blur")+"px)"),void 0!==this.get("brightness")&&t.push("brightness("+this.get("brightness")+"%)"),void 0!==this.get("contrast")&&t.push("contrast("+this.get("contrast")+"%)"),void 0!==this.get("shadow")&&t.push("drop-shadow("+this.get("shadow")[0]+"px "+this.get("shadow")[1]+"px "+(this.get("shadowBlur")||0)+"px "+this.get("shadowColor")+")"),void 0!==this.get("grayscale")&&t.push("grayscale("+this.get("grayscale")+"%)"),void 0!==this.get("sepia")&&t.push("sepia("+this.get("sepia")+"%)"),void 0!==this.get("hueRotate")&&t.push("hue-rotate("+this.get("hueRotate")+"deg)"),void 0!==this.get("invert")&&t.push("invert("+this.get("invert")+"%)"),void 0!==this.get("saturate")&&t.push("saturate("+this.get("saturate")+"%)"),(t=t.join(" "))&&(e.context.save(),e.context.filter=t,e.context.drawImage(e.context.canvas,0,0),e.context.restore())}},ol.filter.Clip=class extends ol.filter.Base{constructor(e){if(super(e=e||{}),this.set("coords",e.coords),this.set("units",e.units),this.set("keepAspectRatio",e.keepAspectRatio),this.set("extent",e.extent||[0,0,1,1]),this.set("color",e.color),!e.extent&&"%"!=e.units&&e.coords){for(var t,i=1/0,o=1/0,s=-1/0,r=-1/0,a=0;t=e.coords[a];a++)i>t[0]&&(i=t[0]),st[1]&&(o=t[1]),r0;r--)o=r*l/n[0]-(r==n[0]?t[0]*(n[1]%2)+i:0),s=h-t[1]*(r%2)-i,e.lineTo(o,s);for(r=n[1];r>0;r--)o=t[0]*(r%2)+i,s=r*h/n[1]-(r==n[1]?i:0),e.lineTo(o,s);e.closePath()}precompose(e){var t=e.context;t.save(),t.shadowColor="rgba(0,0,0,0.3)",t.shadowBlur=8,t.shadowOffsetX=2,t.shadowOffsetY=3,this.drawLine_(t,this.get("fsize"),this.get("margin")),t.fillStyle="#fff",this.get("fill")&&t.fill(),t.strokeStyle="rgba(0,0,0,0.1)",t.stroke(),t.restore(),t.save(),this.drawLine_(t,this.get("fsize"),this.get("margin")+this.get("padding")),t.clip()}postcompose(e){var t=e.context,i=t.canvas;if(t.restore(),t.save(),this.drawLine_(t,this.get("fsize"),this.get("margin")),t.clip(),this.get("shadow")){var o=this.get("fold"),s=i.width/o[0],r=i.height/o[1],a=t.createRadialGradient(5*s/8,5*s/8,s/4,s/2,s/2,s);a.addColorStop(0,"transparent"),a.addColorStop(1,"rgba(0,0,0,"+this.get("opacity")+")"),t.fillStyle=a,t.scale(1,r/s);for(var n=0;nthis.pixels.length)for(;this.pixels.length-1}:this._whiteList=function(){return!0},"function"==typeof e.blackList?this._blackList=e.blackList:e.blackList&&e.blackList.indexOf?this._blackList=function(t){return e.blackList.indexOf(t)>-1}:this._blackList=function(){return!1},this._deleteNull=!1!==e.deleteNullProperties&&[null,void 0,""];var t=2;e.dataProjection&&"EPSG:4326"!==e.dataProjection||(t=7),isNaN(parseInt(e.decimals))||(t=parseInt(e.decimals)),this._decimals=t,this.setLayout(e.layout||"XY")}setLayout(e){switch(e){case"XYZ":case"XYZM":this._layout=e;break;default:this._layout="XY"}}getLayout(){return this._layout}encodeNumber(e,t){!isNaN(Number(e))&&null!==e&&isFinite(e)||(e=0),t||0===t||(t=this._decimals),(e=Math.round(e*Math.pow(10,t)))<0?e=-2*e-1:e*=2;for(var i,o="",s=e;i=s%this._size,o=this._radix.charAt(i)+o,0!=(s=Math.floor(s/this._size)););return o}decodeNumber(e,t){t||0===t||(t=this._decimals);var i=0;e.split("").forEach(function(e){i=i*this._size+this._radix.indexOf(e)}.bind(this));var o=Math.floor(i/2);return o!==i/2&&(o=-1-o),o/Math.pow(10,t)}encodeCoordinates(e,t){var i,o;if("number"==typeof e[0])return c=this.encodeNumber(e[0],t)+","+this.encodeNumber(e[1],t),"Z"==this._layout[2]&&e.length>2&&(c+=","+this.encodeNumber(e[2],2)),"M"==this._layout[3]&&e.length>3&&(c+=","+this.encodeNumber(e[3],0)),c;if(e.length&&e[0]){if("number"==typeof e[0][0]){var s=[0,0,0,0],r=[],a="Z"==this._layout[2]&&e[0].length>2,n="M"==this._layout[3]&&e[0].length>3;for(i=0;i1){var c="A,A"+(a?",A":"")+(n?",A":"");r.push(c)}return r.join(";")}for(i=0;i1){var s=Math.pow(10,t),r=[0,0,0,0];return e.forEach(function(i,o){e[o]=i.split(","),e[o][0]=Math.round((this.decodeNumber(e[o][0],t)+r[0])*s)/s,e[o][1]=Math.round((this.decodeNumber(e[o][1],t)+r[1])*s)/s,e[o].length>2&&(e[o][2]=Math.round((this.decodeNumber(e[o][2],2)+r[2])*s)/s),e[o].length>3&&(e[o][3]=Math.round((this.decodeNumber(e[o][3],0)+r[3])*s)/s),r=e[o]}.bind(this)),e}return e=e[0].split(","),o=[this.decodeNumber(e[0],t),this.decodeNumber(e[1],t)],e.length>2&&(o[2]=this.decodeNumber(e[2],2)),e.length>3&&(o[3]=this.decodeNumber(e[3],0)),o}if(e.length){var a=[];for(i=0;i0?1:-1)*Math.min(.015,s/7e4*e),t=0;t=0})),"function"==typeof e.featureFilter)this._features=e.featureFilter;else if(e.featureFilter){var o=e.featureFilter;this._features=function(e){return o.indexOf?!!o[o.indexOf(e)]:!!o.item(o.getArray().indexOf(e))}}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(e,t){if(!this._current&&this._features(e,t)){var o=e.getGeometry();if("Polygon"===o.getType()&&o.intersectsCoordinate(i))this._polygonIndex=!1,this._polygon=o,this._current=e;else if("MultiPolygon"===o.getType()&&o.intersectsCoordinate(i))for(var s,r=0;s=o.getPolygon(r);r++)if(s.intersectsCoordinate(i)){this._polygonIndex=r,this._polygon=s,this._current=e;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(!1!==this._polygonIndex){for(var i,o=e.feature.getGeometry(),s=new ol.geom.MultiPolygon([]),r=0;i=o.getPolygon(r);r++)r===this._polygonIndex?(i.appendLinearRing(new ol.geom.LinearRing(t)),s.appendPolygon(i)):s.appendPolygon(i);e.feature.setGeometry(s)}else this.getPolygon().appendLinearRing(new ol.geom.LinearRing(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 ol.geom.Polygon(e),t}},ol.interaction.DrawRegular=class extends ol.interaction.Interaction{constructor(e){e=e||{},super({handleEvent:function(e){return t.handleEvent_(e)}});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_=!1!==e.canRotate,this.geometryName_=e.geometryName||"geometry",this.setSides(e.sides);var i=ol.style.Style.defaultStyle(!0);this.sketch_=new ol.Collection,this.overlayLayer_=new ol.layer.Vector({source:new ol.source.Vector({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!0!==e&&!1!==e||(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,i,o,s,r,a=this.center_,n=this.coord_;if(!this.sides_&&this.square_&&!this.centered_)return a=[(n[0]+a[0])/2,(n[1]+a[1])/2],t=[n[0]-a[0],n[1]-a[1]],o=Math.sqrt(t[0]*t[0]+t[1]*t[1]),s=new ol.geom.Circle(a,o,"XY"),r=this.getMap().getPixelFromCoordinate(a),i=Math.max(100,Math.abs(r[0]-this.coordPx_[0]),Math.abs(r[1]-this.coordPx_[1])),i=Math.min(this.maxCircleCoordinates_,Math.round(i/3)),ol.geom.Polygon.fromCircle(s,i,0);var l=this.canRotate_&&this.centered_&&this.square_;if(t=[n[0]-a[0],n[1]-a[1]],this.square_&&!l){var h=Math.max(Math.abs(t[0]),Math.abs(t[1]));n=[a[0]+(t[0]>0?h:-h),a[1]+(t[1]>0?h:-h)]}if((o=Math.sqrt(t[0]*t[0]+t[1]*t[1]))>0){var c;if(s=new ol.geom.Circle(a,o,"XY"),c=l?Math.atan2(t[1],t[0]):this.startAngle[this.sides_]||this.startAngle.default,this.sides_?e=ol.geom.Polygon.fromCircle(s,this.sides_,c):(r=this.getMap().getPixelFromCoordinate(this.center_),i=Math.max(100,Math.abs(r[0]-this.coordPx_[0]),Math.abs(r[1]-this.coordPx_[1])),i=Math.min(this.maxCircleCoordinates_,Math.round(i/(this.centered_?3:5))),e=ol.geom.Polygon.fromCircle(s,i,0)),l)return e;var u=e.getExtent(),d=((a=this.centered_?[2*this.center_[0]-this.coord_[0],2*this.center_[1]-this.coord_[1]]:this.center_)[0]-n[0])/(u[0]-u[2]),g=(a[1]-n[1])/(u[1]-u[3]);if(this.square_){var p=Math.min(Math.abs(d),Math.abs(g));d=Math.sign(d)*p,g=Math.sign(g)*p}var m=[a[0]-u[0]*d,a[1]-u[1]*g];return e.applyTransform(function(e,t,i){for(var o=0;o450,this._longTouch&&this.handleMoveEvent_(e)}.bind(this),500);break;case"pointerup":this.started_&&this.coord_&&(t=this.downPx_[0]-e.pixel[0])*t+(i=this.downPx_[1]-e.pixel[1])*i<=this.squaredClickTolerance_&&("pointermove"==this.lastEvent||"keydown"==this.lastEvent?this.end_(e):(t=this.upPx_[0]-e.pixel[0])*t+(i=this.upPx_[1]-e.pixel[1])*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 o=this.getMap().getPixelFromCoordinate(this.center_);(t=o[0]-e.pixel[0])*t+(i=o[1]-e.pixel[1])*i<=this.squaredClickTolerance_&&this.reset()}return!this._longTouch;case"pointermove":this.started_&&(t=this.downPx_[0]-e.pixel[0])*t+(i=this.downPx_[1]-e.pixel[1])*i>this.squaredClickTolerance_&&(this.handleMoveEvent_(e),this.lastEvent=e.type);break;default:if(this.lastEvent=e.type,this.started_&&"dblclick"===e.type)return!1}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 ol.Feature({});t.setGeometryName(this.geometryName_||"geometry"),t.setGeometry(new ol.geom.Polygon([[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])this.dispatchEvent({type:"drawcancel",feature:null,pixel:e.pixel,coordinate:e.coordinate,square:this.square_,centered:this.centered_});else{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_})}this.center_=this.coord_=null,this.drawSketch_()}},ol.interaction.DrawRegular.prototype.startAngle={default:Math.PI/2,3:-Math.PI/2,4:Math.PI/4},ol.interaction.DrawTouch=class extends ol.interaction.CenterTouch{constructor(e){(e=e||{}).handleEvent=function(e){if(this.get("tap"))switch(this.sketch.setPosition(this.getPosition()),e.type){case"singleclick":this.addPoint();break;case"dblclick":return this.addPoint(),this.finishDrawing(),!1}return!0},super(e),e.sketchStyle||(e.sketchStyle=ol.style.Style.defaultStyle());var t=this.sketch=new ol.layer.SketchOverlay(e);t.on(["drawstart","drawabort"],function(e){this.dispatchEvent(e)}.bind(this)),t.on(["drawend"],function(t){t.feature&&t.valid&&e.source&&e.source.addFeature(t.feature),this.dispatchEvent(t)}.bind(this)),this._source=e.source,this.set("tap",!1!==e.tap),this.setActive(!1!==e.active)}setMap(e){if(this._listener)for(var t in this._listener)ol.Observable.unByKey(t);this._listener={},super.setMap(e),this.sketch.setMap(e),e&&(this._listener.center=e.on("postcompose",function(){ol.coordinate.equal(this.getPosition(),this.sketch.getPosition()||[])||this.sketch.setPosition(this.getPosition())}.bind(this)))}setGeometryType(e){return this.sketch.setGeometryType(e)}getGeometryType(){return this.sketch.getGeometryType()}finishDrawing(){this.sketch.finishDrawing(!0)}addPoint(){this.sketch.addPoint(this.getPosition())}removeLastPoint(){this.sketch.removeLastPoint()}setActive(e){super.setActive(e),this.sketch&&(this.sketch.abortDrawing(),this.sketch.setVisible(e))}},ol.interaction.DropFile=class extends ol.interaction.Interaction{constructor(e){e=e||{},super({});var t=e.zone||document;t.addEventListener("dragenter",this.onstop),t.addEventListener("dragover",this.onstop),t.addEventListener("dragleave",this.onstop),this.formatConstructors_=e.formatConstructors||[ol.format.GPX,ol.format.GeoJSONX,ol.format.GeoJSONP,ol.format.GeoJSON,ol.format.IGC,ol.format.KML,ol.format.TopoJSON],this.projection_=e.projection,this.accept_=e.accept||["gpx","json","geojsonx","geojsonp","geojson","igc","kml","topojson"],t.addEventListener("drop",function(e){return this.ondrop(e)}.bind(this))}setMap(e){super.setMap(e)}onstop(e){return e.preventDefault(),e.stopPropagation(),!1}ondrop(e){if(e.preventDefault(),e.dataTransfer&&e.dataTransfer.files.length){var t=this.projection_||(this.getMap()?this.getMap().getView().getProjection():null),i=e.dataTransfer.files,o=/\.([0-9a-z]+)(?=[?#])|(\.)(?:[\w]+)$/;Array.prototype.forEach.call(i,function(e){var i=e.name.match(o)[0],s=this.accept_.indexOf(i.toLocaleLowerCase())>=0;if(this.dispatchEvent({type:"loadstart",file:e,filesize:e.size,filetype:e.type,fileextension:i,projection:t,isok:s}),this.formatConstructors_.length){var r=new FileReader,a=this.formatConstructors_,n=e;r.onload=function(e){var i,o,s=e.target.result,r=[];for(i=0,o=a.length;i0)return this.dispatchEvent({type:"addfeatures",features:r,file:n,projection:t}),void this.dispatchEvent({type:"loadend",features:r,file:n,projection:t})}catch(e){}}this.dispatchEvent({type:"loadend",file:n,result:s})}.bind(this),r.readAsText(e)}}.bind(this))}return!1}},ol.interaction.FillAttribute=class extends ol.interaction.Select{constructor(e,t){if((e=e||{}).condition||(e.condition=ol.events.condition.click),super(e),this.setActive(!1!==e.active),this.set("name",e.name),this._attributes=t,this.on("select",function(e){this.getFeatures().clear(),this.fill(e.selected,this._attributes)}.bind(this)),void 0===e.cursor){var i=document.createElement("CANVAS");i.width=i.height=32;var o=i.getContext("2d");o.beginPath(),o.moveTo(9,3),o.lineTo(2,9),o.lineTo(10,17),o.lineTo(17,11),o.closePath(),o.fillStyle="#fff",o.fill(),o.stroke(),o.beginPath(),o.moveTo(6,4),o.lineTo(0,8),o.lineTo(0,13),o.lineTo(3,17),o.lineTo(3,8),o.closePath(),o.fillStyle="#000",o.fill(),o.stroke(),o.moveTo(8,8),o.lineTo(10,0),o.lineTo(11,0),o.lineTo(13,3),o.lineTo(13,7),o.stroke(),this._cursor="url("+i.toDataURL()+") 0 13, auto"}e.cursor&&(this._cursor=e.cursor)}setCursor(e){this._cursor=e}getCursor(){return this._cursor}setActive(e){e!==this.getActive()&&(super.setActive(e),this.getMap()&&this._cursor&&(e?(this._previousCursor=this.getMap().getTargetElement().style.cursor,this.getMap().getTargetElement().style.cursor=this._cursor):(this.getMap().getTargetElement().style.cursor=this._previousCursor,this._previousCursor=void 0)))}setAttributes(e){this._attributes=e}setAttribute(e,t){this._attributes[e]=t}getAttributes(){return this._attributes}getAttribute(e){return this._attributes[e]}fill(e,t){if(e.length&&t){for(var i,o=!1,s=0;i=e[s];s++){for(var r in t)i.get(r)!==t[r]&&(o=!0);if(o)break}o&&(this.dispatchEvent({type:"setattributestart",features:e,properties:t}),e.forEach(function(e){for(var i in t)e.set(i,t[i])}),this.dispatchEvent({type:"setattributeend",features:e,properties:t}))}}},ol.interaction.Flashlight=class extends ol.interaction.Pointer{constructor(e){super({handleDownEvent:function(e){return this.setPosition(e)},handleMoveEvent:function(e){return this.setPosition(e)}}),e=e||{},this.pos=!1,this.radius=e.radius||100,this.setColor(e)}setMap(e){this.getMap()&&this.getMap().render(),this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,super.setMap(e),e&&(this._listener=e.on("postcompose",this.postcompose_.bind(this)))}setRadius(e){if(this.radius=e,this.getMap())try{this.getMap().renderSync()}catch(e){}}setColor(e){var t=e.fill?e.fill:[0,0,0,.8],i=ol.color.asArray(t);if(this.startColor=ol.color.asString(i),e.color?(this.endColor=ol.color.asString(ol.color.asArray(e.color)||e.color),i=ol.color.asArray(this.endColor)):(i[3]=0,this.endColor=ol.color.asString(i)),this.midColor=ol.color.asString(i),this.getMap())try{this.getMap().renderSync()}catch(e){}}setPosition(e){if(e.pixel?this.pos=e.pixel:this.pos=e,this.getMap())try{this.getMap().renderSync()}catch(e){}}postcompose_(e){var t=ol.ext.getMapCanvas(this.getMap()).getContext("2d"),i=e.frameState.pixelRatio,o=t.canvas.width,s=t.canvas.height;if(t.save(),t.scale(i,i),this.pos){var r=Math.max(o,s),a=t.createRadialGradient(this.pos[0],this.pos[1],o*this.radius/r,this.pos[0],this.pos[1],s*this.radius/r);a.addColorStop(0,this.startColor),a.addColorStop(.8,this.midColor),a.addColorStop(1,this.endColor),t.fillStyle=a,t.fillRect(this.pos[0]-r,this.pos[1]-r,2*r,2*r)}else t.fillStyle=this.startColor,t.fillRect(0,0,o,s);t.restore()}},ol.interaction.FocusMap=class extends ol.interaction.Interaction{constructor(){super({}),this.focusBt=ol.ext.element.create("BUTTON",{on:{focus:function(){this.dispatchEvent({type:"focus"})}.bind(this)},style:{position:"absolute",zIndex:-1,top:0,opacity:0}})}setMap(e){this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,this.getMap()&&this.getMap().getViewport().removeChild(this.focusBt),super.setMap(e),this.getMap()&&(this._listener=this.getMap().on("pointerdown",function(){this.getActive()&&this.focusBt.focus()}.bind(this)),this.getMap().getViewport().appendChild(this.focusBt))}},ol.interaction.GeolocationDraw=class extends ol.interaction.Interaction{constructor(e){e=e||{},super({handleEvent:function(){return!this.get("followTrack")||"auto"==this.get("followTrack")}}),this.geolocation=new ol.Geolocation({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],o=new ol.style.Circle({radius:6,fill:new ol.style.Fill({color:i}),stroke:new ol.style.Stroke({color:t,width:1.5})}),s=[new ol.style.Style({stroke:new ol.style.Stroke({color:t,width:5})}),new ol.style.Style({stroke:new ol.style.Stroke({color:i,width:3}),fill:new ol.style.Fill({color:[255,255,255,.5]})})],r=new ol.style.RegularShape({radius:10.5,points:3,rotation:0,fill:new ol.style.Fill({color:i}),stroke:new ol.style.Stroke({color:t,width:1.5})}),a=r.getImage(),n=a.getContext("2d"),l=document.createElement("canvas");l.width=l.height=a.width,l.getContext("2d").drawImage(a,0,0),n.clearRect(0,0,a.width,a.height),n.drawImage(l,0,0,a.width,a.height,3,0,a.width-6,a.height);this.locStyle={error:new ol.style.Style({fill:new ol.style.Fill({color:[255,0,0,.2]})}),warn:new ol.style.Style({fill:new ol.style.Fill({color:[255,192,0,.2]})}),ok:new ol.style.Style({fill:new ol.style.Fill({color:[0,255,0,.2]})})},this.overlayLayer_=new ol.layer.Vector({source:new ol.source.Vector,name:"GeolocationDraw overlay",style:e.style||function(e){return void 0===e.get("heading")?s[1].setImage(o):(s[1].setImage(r),r.setRotation(e.get("heading")||0)),s}}),this.sketch_=[new ol.Feature,new ol.Feature,new ol.Feature],this.overlayLayer_.getSource().addFeatures(this.sketch_),this.features_=e.features,this.source_=e.source,this.condition_=e.condition||function(e){return e.getAccuracy()t&&(r.push(i[n]),a=s)}return r[r.length-1]!==i[i.length-1]&&r.push(i[i.length-1]),e="Polygon"===this.get("type")?new ol.geom.Polygon([r],"XYZM"):new ol.geom.LineString(r,"XYZM")}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(e){}}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){var i=(t=t||{}).delay||1e3;this._track={track:e,pos:0,timeout:setTimeout(function e(){if(this._track.pos>=this._track.track.length)this._track=!1;else{var o=this._track.track[this._track.pos];o[2]=o[3]||0,o[3]=(new Date).getTime(),this._track.pos++,!1!==t.repeat&&(this._track.pos=this._track.pos%this._track.track.length),this.getActive()&&this.draw_(!0,o,t.accuracy),this._track.timeout=setTimeout(e.bind(this),i)}}.bind(this),0)}}else this._track=!1}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_=!1!==e}isPaused(){return this.pause_}setFollowTrack(e){this.set("followTrack",e);var t,i=this.getMap();if(this.getActive()&&i)if("position"!==e&&(t=this.get("minZoom")?Math.max(this.get("minZoom"),i.getView().getZoom()):this.get("zoom")),!1===e||this.lastPosition_)"auto"===e&&this.lastPosition_&&i.getView().animate({center:this.lastPosition_,zoom:t});else{var o=this.path_[this.path_.length-1];o&&i.getView().animate({center:o,zoom:t})}this.lastPosition_=!1,this.dispatchEvent({type:"follow",following:!1!==e})}draw_(e,t,i){var o=this.getMap();if(o){var s,r,a,n,l;if(this._track){if(!0!==e)return;if(r=t,s=i||10,this.path_&&this.path_.length){var h=this.path_[this.path_.length-1];l=Math.atan2(t[0]-h[0],t[1]-h[1])}var c=new ol.geom.Circle(r,o.getView().getResolution()*s);a=ol.geom.Polygon.fromCircle(c)}else s=(n=this.geolocation).getAccuracy(),r=this.getPosition(n),a=n.getAccuracyGeometry(),l=n.getHeading();switch(this.get("followTrack")){case!0:1==this.get("followTrack")&&(this.get("minZoom")?this.get("minZoom")>o.getView().getZoom()&&o.getView().setZoom(this.get("minZoom")):o.getView().setZoom(this.get("zoom")||16),ol.extent.containsExtent(o.getView().calculateExtent(o.getSize()),a.getExtent())||o.getView().fit(a.getExtent())),o.getView().setCenter(r);break;case"position":o.getView().setCenter(r);break;case"auto":if(this.lastPosition_){var u=o.getView().getCenter();u[0]!=this.lastPosition_[0]||u[1]!=this.lastPosition_[1]?this.setFollowTrack(!1):(o.getView().setCenter(r),this.lastPosition_=r)}else o.getView().setCenter(r),this.get("minZoom")?this.get("minZoom")>o.getView().getZoom()&&o.getView().setZoom(this.get("minZoom")):this.get("zoom")&&o.getView().setZoom(this.get("zoom")),this.lastPosition_=r;break;case"visible":ol.extent.containsCoordinate(o.getView().calculateExtent(o.getSize()),r)||o.getView().setCenter(r)}var d,g=this.sketch_[0];if(g.setGeometry(a),s1?(d=new ol.geom.LineString(this.path_,"XYZM"),this.get("tolerance")&&(d=this.simplify3D(d,this.get("tolerance"))),g.setGeometry(d)):g.setGeometry();break;case"Polygon":this.path_.length>2?(d=new ol.geom.Polygon([this.path_],"XYZM"),this.get("tolerance")&&(d=this.simplify3D(d,this.get("tolerance"))),g.setGeometry(d)):g.setGeometry()}this.dispatchEvent({type:"drawing",feature:this.sketch_[1],geolocation:n})}this.sketch_[2].setGeometry(new ol.geom.Point(r)),this.sketch_[2].set("heading",l),this.dispatchEvent({type:"tracking",feature:this.sketch_[1],geolocation:n})}}getPosition(e){var t=e.getPosition();return t.push(Math.round(100*(e.getAltitude()||0))/100),t.push(Math.round((new Date).getTime()/1e3)),t}},ol.interaction.Hover=class extends ol.interaction.Interaction{constructor(e){e||(e=e||{});var t=!1;super({handleEvent:function(o){if(!i.getActive())return!0;switch(o.type){case"pointerdrag":t=!0;break;case"pointerup":t=!1;break;case"pointermove":t||i.handleMove_(o)}return!e.handleEvent||e.handleEvent(o)}});var i=this;this.setLayerFilter(e.layerFilter),e.layers&&e.layers.length&&this.setLayerFilter(function(t){return e.layers.indexOf(t)>=0}),this.setFeatureFilter(e.featureFilter),this.set("hitTolerance",e.hitTolerance),this.setCursor(e.cursor)}setMap(e){void 0!==this.previousCursor_&&this.getMap()&&(this.getMap().getTargetElement().style.cursor=this.previousCursor_,this.previousCursor_=void 0),super.setMap(e)}setActive(e){if(super.setActive(e),this.cursor_&&this.getMap()&&this.getMap().getTargetElement()){var t=this.getMap().getTargetElement().style;void 0!==this.previousCursor_&&(t.cursor=this.previousCursor_,this.previousCursor_=void 0)}}setCursor(e){!e&&void 0!==this.previousCursor_&&this.getMap()&&(this.getMap().getTargetElement().style.cursor=this.previousCursor_,this.previousCursor_=void 0),this.cursor_=e}setFeatureFilter(e){this.featureFilter_="function"==typeof e?e:function(){return!0}}setLayerFilter(e){this.layerFilter_="function"==typeof e?e:function(){return!0}}handleMove_(e){var t=this.getMap();if(t){var i,o,s=this,r=t.forEachFeatureAtPixel(e.pixel,function(e,t){return s.featureFilter_.call(null,e,t)?(i=e,o=t,!0):(i=o=null,!1)},{hitTolerance:this.get("hitTolerance"),layerFilter:s.layerFilter_});if(r&&this.dispatchEvent({type:"hover",feature:i,layer:o,coordinate:e.coordinate,pixel:e.pixel,map:e.map,originalEvent:e.originalEvent,dragging:e.dragging}),this.feature_===i&&this.layer_===o||(this.feature_=i,this.layer_=o,i?this.dispatchEvent({type:"enter",feature:i,layer:o,coordinate:e.coordinate,pixel:e.pixel,map:e.map,originalEvent:e.originalEvent,dragging:e.dragging}):this.dispatchEvent({type:"leave",coordinate:e.coordinate,pixel:e.pixel,map:e.map,originalEvent:e.originalEvent,dragging:e.dragging})),this.cursor_){var a=t.getTargetElement().style;r?a.cursor!=this.cursor_&&(this.previousCursor_=a.cursor,a.cursor=this.cursor_):void 0!==this.previousCursor_&&(a.cursor=this.previousCursor_,this.previousCursor_=void 0)}}}},ol.interaction.LongTouch=class extends ol.interaction.Interaction{constructor(e){var t,i,o=(e=e||{}).handleLongTouchEvent||function(){},s=null,r=e.pixelTolerance||0;super({handleEvent:function(e){if(this.getActive())switch(e.type){case"pointerdown":s&&clearTimeout(s),t=e.pixel,i={type:"longtouch",originalEvent:e.originalEvent,frameState:e.frameState,pixel:e.pixel,coordinate:e.coordinate,map:this.getMap()},s=setTimeout(function(){o(i),i.map.dispatchEvent(i)},this.delay_);break;case"pointerdrag":s&&(Math.abs(e.pixel[0]-t[0])>r||Math.abs(e.pixel[1]-t[1])>r)&&(clearTimeout(s),s=null);break;case"pointerup":s&&(clearTimeout(s),s=null)}else s&&(clearTimeout(s),s=null);return!0}}),this.delay_=e.delay||1e3}},ol.interaction.Modify.prototype.getModifiedFeatures=function(){var e={};this.dragSegments_.forEach(function(t){var i=t[0].feature;window&&window.ol&&window.ol.util?e[ol.util.getUid(i)]=i:e[ol.getUid(i)]=i});var t=[];for(var i in e)t.push(e[i]);return t},ol.interaction.ModifyFeature=class extends ol.interaction.Interaction{constructor(e){var t,i;e=e||{},super({handleEvent:function(e){switch(e.type){case"pointerdown":return t=this.handleDownEvent(e),i=t||this._deleteCondition(e),!t;case"pointerup":return t=!1,this.handleUpEvent(e);case"pointerdrag":return!t||this.handleDragEvent(e);case"pointermove":return!t&&this.handleMoveEvent(e);case"singleclick":case"click":return!i;default:return!0}}}),this.snapDistance_=e.pixelTolerance||10,this.tolerance_=1e-10,this.cursor_=e.cursor,this.sources_=e.sources?e.sources instanceof Array?e.sources:[e.sources]:[],e.source&&this.sources_.push(e.source),e.features&&this.sources_.push(new ol.source.Vector({features:e.features})),this.filterSplit_=e.filter||function(){return!0},this._condition=e.condition||ol.events.condition.primaryAction,this._deleteCondition=e.deleteCondition||ol.events.condition.altKeyOnly,this._insertVertexCondition=e.insertVertexCondition||ol.events.condition.always;var o=function(){return[new ol.style.Style({image:new ol.style.Circle({radius:6,fill:new ol.style.Fill({color:[0,153,255,1]}),stroke:new ol.style.Stroke({color:"#FFF",width:1.25})})})]};e.style&&(o="function"==typeof e.style?e.style:function(){return e.style}),this.overlayLayer_=new ol.layer.Vector({source:new ol.source.Vector({useSpatialIndex:!1}),name:"Modify overlay",displayInLayerSwitcher:!1,style:o,wrapX:e.wrapX})}setMap(e){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),super.setMap(e),this.overlayLayer_.setMap(e)}setActive(e){super.setActive(e),this.overlayLayer_&&this.overlayLayer_.getSource().clear()}setFilter(e){"function"==typeof e?this.filterSplit_=e:void 0===e&&(this.filterSplit_=function(){return!0})}getClosestFeature(e){for(var t,i,o=this.snapDistance_+1,s=0;sthis.snapDistance_)return this.currentFeature&&this.dispatchEvent({type:"select",selected:[],deselected:[this.currentFeature]}),this.currentFeature=null,!1;var l=this.getNearestCoord(i,t.getGeometry());if(l){l=l.coord;var h=this.getMap().getPixelFromCoordinate(l);return ol.coordinate.dist2d(e.pixel,h)2){for(i=h[1].getCoordinates(),o=2;s=h[o];o++){var c=s.getCoordinates();c.shift(),i=i.concat(c)}h=[h[0],new ol.geom.LineString(i)]}if(2===h.length){var u=h[0].getCoordinates(),d=h[1].getCoordinates(),g=u.length+d.length-1;u.pop(),d.shift(),n={geom:e,type:e.getType(),coord1:u,coord2:d,node:e.getCoordinates().length===g,closed:!1}}else if(1===h.length){s=h[0].getCoordinates();var p=ol.coordinate.equal(s[0],t),m=ol.coordinate.equal(s[s.length-1],t);p?(s.shift(),m&&s.pop(),n={geom:e,type:e.getType(),coord1:[],coord2:s,node:!0,closed:m}):m&&(s.pop(),n={geom:e,type:e.getType(),coord1:s,coord2:[],node:!0,closed:!1})}}break;case"MultiLineString":var f=e.getLineStrings();for(o=0;r=f[o];o++)if(n=this.getArcs(r,t)){n.geom=e,n.type=e.getType(),n.lstring=o;break}break;case"Polygon":var v=e.getLinearRings();for(o=0;r=v[o];o++)if(n=this.getArcs(r,t)){n.geom=e,n.type=e.getType(),n.index=o;break}break;case"MultiPolygon":var y=e.getPolygons();for(o=0;r=y[o];o++)if(n=this.getArcs(r,t)){n.geom=e,n.type=e.getType(),n.poly=o;break}break;case"GeometryCollection":for(a=e.getGeometries(),o=0;r=a[o];o++)if(n=this.getArcs(r,t)){n.geom=e,n.g=o,n.typeg=n.type,n.type=e.getType();break}break;default:console.error("ol/interaction/ModifyFeature "+e.getType()+" not supported!")}return n}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(e){var o=ol.extent.buffer(ol.extent.boundingExtent([t.coord]),this.tolerance_);i=i.concat(i,e.getFeaturesInExtent(o))}.bind(this)),this._modifiedFeatures=[],i.forEach(function(i){var o=this.getArcs(i.getGeometry(),t.coord);o&&(this._insertVertexCondition(e)||o.node)&&(o.feature=i,this._modifiedFeatures.push(i),this.arcs.push(o))}.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))}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())[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())[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 o=e.geom,s=o.getGeometries();e.geom=s[e.g];var r=this._getModification(e);return o.setGeometries(s),e.geom=o,e.type="GeometryCollection",r}return!1}_removePoint(e,t){if(!this.arcs)return!1;this.overlayLayer_.getSource().clear();var i=!1;return this.arcs.forEach(function(e){i=i||this._getModification(e)}.bind(this)),i&&(this.dispatchEvent({type:"modifystart",coordinate:e.coord,originalEvent:t.originalEvent,features:this._modifiedFeatures}),this.arcs.forEach(function(e){if("GeometryCollection"===e.geom.getType()){if(e.coords){var t=e.geom.getGeometries();t[e.g].setCoordinates(e.coords),e.geom.setGeometries(t)}}else e.coords&&e.geom.setCoordinates(e.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))}setArcCoordinates(e,t){var i;switch(e.type){case"Point":e.geom.setCoordinates(t[0]);break;case"MultiPoint":(i=e.geom.getCoordinates())[e.index]=t[0],e.geom.setCoordinates(i);break;case"LineString":e.geom.setCoordinates(t);break;case"MultiLineString":(i=e.geom.getCoordinates())[e.lstring]=t,e.geom.setCoordinates(i);break;case"Polygon":(i=e.geom.getCoordinates())[e.index]=t,e.geom.setCoordinates(i);break;case"MultiPolygon":(i=e.geom.getCoordinates())[e.poly][e.index]=t,e.geom.setCoordinates(i);break;case"GeometryCollection":e.type=e.typeg;var o=e.geom,s=o.getGeometries();e.geom=s[e.g],this.setArcCoordinates(e,t),o.setGeometries(s),e.geom=o,e.type="GeometryCollection"}}handleDragEvent(e){if(!this.getActive())return!1;if(!this.arcs)return!0;this.overlayLayer_.getSource().clear();var t=new ol.Feature(new ol.geom.Point(e.coordinate));return this.overlayLayer_.getSource().addFeature(t),!this.arcs.length||(this.arcs.forEach(function(t){var i=t.coord1.concat([e.coordinate],t.coord2);t.closed&&i.push(e.coordinate),this.setArcCoordinates(t,i)}.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 ol.Feature(new ol.geom.Point(t.coord));this.overlayLayer_.getSource().addFeature(i)}var o=e.map.getTargetElement();return this.cursor_&&(t?o.style.cursor!=this.cursor_&&(this.previousCursor_=o.style.cursor,o.style.cursor=this.cursor_):void 0!==this.previousCursor_&&(o.style.cursor=this.previousCursor_,this.previousCursor_=void 0)),!0}getCurrentFeature(){return this.currentFeature}},ol.interaction.ModifyTouch=class extends ol.interaction.Modify{constructor(e){var t=((e=e||{}).pixelTolerance||0)+5;e.condition=function(e){var i,o,s=this.getMap().getFeaturesAtPixel(e.pixel,{hitTolerance:t}),r=!1;if(s){var a=this._features;if(!a){i=[e.pixel[0]-t,e.pixel[1]-t],o=[e.pixel[0]+t,e.pixel[1]+t],i=this.getMap().getCoordinateFromPixel(i),o=this.getMap().getCoordinateFromPixel(o);var n=ol.extent.boundingExtent([i,o]);a=this._source.getFeaturesInExtent(n)}a.getArray&&(a=a.getArray());for(var l,h=0;(l=s[h])&&!(a.indexOf(l)>=0);h++);if(l){i=e.pixel,o=l.getGeometry().getClosestPoint(e.coordinate),o=this.getMap().getPixelFromCoordinate(o);var c=i[0]-o[0],u=i[1]-o[1];r=Math.sqrt(c*c+u*u)1)return!1;var n=s.getGeometry().getClosestPoint(e.coordinate),l=n[0]-e.coordinate[0],h=n[1]-e.coordinate[1];return Math.sqrt(l*l+h*h)/e.frameState.viewState.resolution<5&&{feature:s,hit:n,coordinates:s.getGeometry().getCoordinates(),geom:s.getGeometry().clone(),geomType:a}}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)}handleDragEvent_(e){this._modifystart&&(this.dispatchEvent({type:"modifystart",features:[this.current_.feature]}),this._modifystart=!1);var t,i,o,s,r=this.current_.geom.getClosestPoint(e.coordinate),a=ol.coordinate.dist2d(r,e.coordinate);switch(this.current_.geomType){case"Polygon":if(t=ol.coordinate.findSegment(r,this.current_.coordinates[0]).segment){i=[t[1][0]-t[0][0],t[1][1]-t[0][1]],o=[e.coordinate[0]-r[0],e.coordinate[1]-r[1]],i[0]*o[1]-i[1]*o[0]>0&&(a=-a),s=[];for(var n=0;n0&&(a=-a),s=ol.coordinate.offsetCoords(this.current_.coordinates,a),this.current_.feature.setGeometry(new ol.geom.LineString(s)))}this.dispatchEvent({type:"offsetting",feature:this.current_.feature,offset:a,segment:[r,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){this.getFeatureAtPixel_(e)?(!1===this.previousCursor_&&(this.previousCursor_=e.map.getTargetElement().style.cursor),e.map.getTargetElement().style.cursor="pointer"):(e.map.getTargetElement().style.cursor=this.previousCursor_,this.previousCursor_=!1)}},ol.interaction.Ripple=class extends ol.interaction.Pointer{constructor(e){super({handleDownEvent:function(e){return this.rainDrop(e)},handleMoveEvent:function(e){return this.rainDrop(e)}}),e=e||{},this.riprad=e.radius||3,this.ripplemap=[],this.last_map=[],this.rains(this.interval),e.layer.on(["postcompose","postrender"],this.postcompose_.bind(this))}rains(e){this.onrain&&clearTimeout(this.onrain);var t=this,i=("number"==typeof e?e:1e3)/2,o=3*i/2,s=Math.random;o&&function e(){t.width&&t.rainDrop([s()*t.width,s()*t.height]),t.onrain=setTimeout(e,s()*i+o)}()}rainDrop(e){if(this.width){var t,i;e.pixel?(t=e.pixel[0]*this.ratio,i=e.pixel[1]*this.ratio):(t=e[0]*this.ratio,i=e[1]*this.ratio),t<<=0;for(var o=(i<<=0)-this.riprad*this.ratio;o>1,this.half_height=this.height>>1,this.size=this.width*(this.height+2)*2,this.oldind=this.width,this.newind=this.width*(this.height+3);for(var l=0;l>1,o-=this.ripplemap[p],o-=o>>5,this.ripplemap[p]=o,o=1024-o,this.last_map[l]!=o&&(this.last_map[l]=o,t=((g-this.half_width)*o/1024<<0)+this.half_width,i=((d-this.half_height)*o/1024<<0)+this.half_height,t>=this.width&&(t=this.width-1),t<0&&(t=0),i>=this.height&&(i=this.height-1),i<0&&(i=0),r=4*(t+i*this.width),c[s=4*l]=u[r],c[s+1]=u[r+1],c[s+2]=u[r+2]),++l}a.putImageData(this.ripple,0,0),this.getMap().render()}},ol.interaction.SelectCluster=class extends ol.interaction.Select{constructor(e){e=e||{};var t=new ol.layer.Vector({source:new ol.source.Vector({features:new ol.Collection,wrapX:e.wrapX,useSpatialIndex:!0}),name:"Cluster overlay",updateWhileAnimating:!0,updateWhileInteracting:!0,displayInLayerSwitcher:!1,style:e.featureStyle});if(e.layers)if("function"==typeof e.layers){var i=e.layers;e.layers=function(e){return e===t||i(e)}}else e.layers.push&&e.layers.push(t);if(e.filter){var o=e.filter;e.filter=function(e,t){return!(!t&&e.get("selectclusterlink"))&&o(e,t)}}else e.filter=function(e,t){return!(!t&&e.get("selectclusterlink"))};!1!==e.autoClose||e.toggleCondition||(e.toggleCondition=ol.events.condition.singleClick),super(e),this.overlayLayer_=t,this.filter_=e.filter,this.pointRadius=e.pointRadius||12,this.circleMaxObjects=e.circleMaxObjects||10,this.maxObjects=e.maxObjects||60,this.spiral=!1!==e.spiral,this.animate=e.animate,this.animationDuration=e.animationDuration||500,this.selectCluster_=!1!==e.selectCluster,this._autoClose=!1!==e.autoClose,this.on("select",this.selectCluster.bind(this))}setMap(e){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,super.setMap(e),this.overlayLayer_.setMap(e),e&&e.getView()&&(this._listener=e.getView().on("change:resolution",this.clear.bind(this)))}clear(){this.getFeatures().clear(),this.overlayLayer_.getSource().clear()}getLayer(){return this.overlayLayer_}selectCluster(e){if(e instanceof ol.Feature&&(e={selected:[e]}),e.selected.length){var t=e.selected[0];if(!t.get("selectclusterfeature")){var i=this.overlayLayer_.getSource();this._autoClose&&i.clear();var o=t.get("features");if(o&&1!=o.length){this.selectCluster_||this.getFeatures().clear();var s,r,a,n,l,h,c,u=t.getGeometry().getCoordinates(),d=this.getMap().getView().getResolution(),g=[];if(!this.spiral||o.length<=this.circleMaxObjects)for(n=Math.min(o.length,this.circleMaxObjects),s=d*this.pointRadius*(.5+n/4),a=0;a{var t=e.get("selectcluserfeatures");t&&t.forEach(e=>{this.overlayLayer_.getSource().removeFeature(e)})})}}animateCluster_(e,t){if(this.listenerKey_&&ol.Observable.unByKey(this.listenerKey_),t.length){var i=this.overlayLayer_.getStyle(),o="function"==typeof i?i:i.length?function(){return i}:function(){return[i]},s=this.animationDuration||500,r=(new Date).getTime();this.listenerKey_=this.overlayLayer_.on(["postcompose","postrender"],function(i){for(var a,n=i.vectorContext||ol.render.getVectorContext(i),l=i.frameState.pixelRatio,h=this.getMap().getView().getResolution(),c=ol.easing.easeOut((i.frameState.time-r)/s),u=0;a=t[u];u++)if(a.get("features")){var d=a.getGeometry().getCoordinates();d[0]=e[0]+c*(d[0]-e[0]),d[1]=e[1]+c*(d[1]-e[1]);for(var g=new ol.geom.Point(d),p=o(a,h),m=0;m1)return ol.Observable.unByKey(this.listenerKey_),this.overlayLayer_.getSource().addFeatures(t),void this.overlayLayer_.changed();i.frameState.animate=!0}.bind(this));var a=new ol.Feature(new ol.geom.Point(this.getMap().getView().getCenter()));a.setStyle(new ol.style.Style({image:new ol.style.Circle({})})),this.overlayLayer_.getSource().addFeature(a)}}getClusterExtent(e){if(!e.get("features"))return null;var t=ol.extent.createEmpty();return e.get("features").forEach(function(e){t=ol.extent.extend(t,e.getGeometry().getExtent())}),t[0]===t[2]&&t[1]===t[3]?null:t}},ol.interaction.SnapGuides=class extends ol.interaction.Interaction{constructor(e){function t(e,t){var i=e[1][0]-e[0][0],o=e[1][1]-e[0][1],s=t[1][0]-t[0][0],r=t[1][1]-t[0][1],a=i*r-o*s;if(0!=a){var n=(i*e[0][1]-i*t[0][1]-o*e[0][0]+o*t[0][0])/a;return[t[0][0]+n*s,t[0][1]+n*r]}return!1}function i(e,t){var i=e[0]-t[0],o=e[1]-t[1];return Math.sqrt(i*i+o*o)}e=e||{},super({handleEvent:function(e){if(this.getActive()){for(var o,s=this.overlaySource_.getFeatures(),r=null,a=null,n=e.frameState.viewState.resolution,l=0;o=s[l];l++){var h=o.getGeometry().getClosestPoint(e.coordinate);if(i(h,e.coordinate)/nthis.projExtent_[2]&&(o[2]=this.projExtent_[2]),o[3]>this.projExtent_[3]&&(o[3]=this.projExtent_[3]);var r=e[0][0]-e[1][0],a=e[0][1]-e[1][1],n=1/Math.sqrt(r*r+a*a),l=function(i){for(var l,h=[],c=s*i*2,u=0;(i>0?uc)&&(l=t?[e[0][0]+a*n*u,e[0][1]-r*n*u]:[e[0][0]+r*n*u,e[0][1]+a*n*u],ol.extent.containsCoordinate(o,l));u+=s*i/100)h.push(l);return new ol.Feature(new ol.geom.LineString([h[0],h[h.length-1]]))},h=l(1),c=l(-1);return this.overlaySource_.addFeature(h),this.overlaySource_.addFeature(c),[h,c]}}addOrthoGuide(e){return this.addGuide(e,!0)}setDrawInteraction(e){var t=this,i=0,o=[];function s(e){var s=e.target.getCoordinates();switch(e.target.getType()){case"Point":return;case"Polygon":s=s[0].slice(0,-1)}var r=s.length;if(2===r&&t.enableInitialGuides_){var a=s[0][0],n=s[0][1];s=[[a,n],[a,n-1]]}if(r!=i&&(t.enableInitialGuides_?r>=2:r>2)){t.clearGuides(o);try{var l=s[r-2],h=s[r-2-1];r>2&&(l[0]!==h[0]||l[1]!==h[1])&&(o=t.addOrthoGuide([s[r-2],s[r-2-1]])),o=(o=o.concat(t.addGuide([s[0],s[1]]))).concat(t.addOrthoGuide([s[0],s[1]])),i=r}catch(e){}}}e.on("drawstart",function(e){e.feature.getGeometry().on("change",s)}),e.on(["drawend","change:active"],function(e){t.clearGuides(o),e.feature&&e.feature.getGeometry().un("change",s),i=0,o=[]})}setModifyInteraction(e){function t(e,t){return(e%t+t)%t}var i=this,o=[];function s(e){var s=e.coordinate;if(!s){var r=e.target.vertexFeature_;if(!r)return;s=r.getGeometry().getCoordinates()}var a=e.target.getModifiedFeatures()[0].getGeometry(),n=a.getCoordinates();switch(a.getType()){case"Point":return;case"Polygon":n=n[0].slice(0,-1)}var l=n.findIndex(function(e){return e[0]===s[0]&&e[1]===s[1]}),h=n.length;i.clearGuides(o),o=(o=(o=(o=i.addOrthoGuide([n[t(l-1,h)],n[t(l-2,h)]])).concat(i.addGuide([n[t(l-1,h)],n[t(l-2,h)]]))).concat(i.addGuide([n[t(l+1,h)],n[t(l+2,h)]]))).concat(i.addOrthoGuide([n[t(l+1,h)],n[t(l+2,h)]]))}e.on("modifystart",function(e){setTimeout(s,0,e)}),e.on("modifyend",function(){i.clearGuides(o),o=[]})}},ol.interaction.SnapLayerPixel=class extends ol.interaction.Interaction{constructor(e){var t=(e=e||{}).radius||8,i=2*t;super({handleEvent:function(e){if(this._layer.getVisible()&&this._layer.getOpacity()&&ol.events.condition.altKeyOnly(e)&&this.getMap()){var o,s,r,a,n=e.pixel[0]-t,l=e.pixel[1]-t,h=this._ctx.getImageData(n,l,i,i).data,c=-1,u=[];for(o=0;o10?d:0)}for(o=1;oc&&(c=g,r=o,a=s)}e.pixel=[n+r,l+a],e.coordinate=this.getMap().getCoordinateFromPixel(e.pixel)}return!0}}),this._layer=e.layer,this._layer.on(["postcompose","postrender"],function(e){this._ctx=e.context}.bind(this))}},ol.interaction.Split=class extends ol.interaction.Interaction{constructor(e){e||(e={}),super({handleEvent:function(e){switch(e.type){case"singleclick":return this.handleDownEvent(e);case"pointermove":return this.handleMoveEvent(e);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 ol.source.Vector({features:e.features}))),this.filterSplit_=e.filter||function(){return!0};var t=[255,255,255,1],i=[0,153,255,1],o=new ol.style.Fill({color:"rgba(255,255,255,0.4)"}),s=new ol.style.Stroke({color:"#3399CC",width:1.25}),r=[new ol.style.Style({image:new ol.style.Circle({fill:o,stroke:s,radius:5}),fill:o,stroke:s})],a=[new ol.style.Style({stroke:new ol.style.Stroke({color:t,width:5})}),new ol.style.Style({image:new ol.style.Circle({radius:6,fill:new ol.style.Fill({color:i}),stroke:new ol.style.Stroke({color:t,width:1.5})}),stroke:new ol.style.Stroke({color:i,width:3})})];e.sketchStyle&&(r=e.sketchStyle instanceof Array?e.sketchStyle:[e.sketchStyle]),e.featureStyle&&(a=e.featureStyle instanceof Array?e.featureStyle:[e.featureStyle]),this.overlayLayer_=new ol.layer.Vector({source:new ol.source.Vector({useSpatialIndex:!1}),name:"Split overlay",displayInLayerSwitcher:!1,style:function(e){return e._sketch_?r:a}})}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(i){i.getVisible()&&(i.getSource&&i.getSource()instanceof ol.source.Vector?e.unshift(i.getSource()):i.getLayers&&t(i.getLayers()))})};return t(this.getMap().getLayers()),e}return this.sources_||[]}setSources(e){this.sources_=!!e&&(e instanceof Array?e||!1:[e])}getClosestFeature(e){var t,i,o,s,r=this.snapDistance_+1;if(this.getSources().forEach(function(a){var n=a.getClosestFeatureToCoordinate(e.coordinate);if(n&&n.getGeometry().splitAt){var l=n.getGeometry().getClosestPoint(e.coordinate),h=new ol.geom.LineString([e.coordinate,l]),c=h.getLength()/e.frameState.viewState.resolution;cthis.snapDistance_)return!1;var a=this.getNearestCoord(o,i.getGeometry().getCoordinates()),n=this.getMap().getPixelFromCoordinate(a);return ol.coordinate.dist2d(e.pixel,n)1){var s=[];for(i=0;i1)return!1;var h=((e[0][1]-t[1][1])*o-(e[0][0]-t[1][0])*r)/n;if(Math.abs(h)1)return!1;var c=e[0][0]*e[1][1]-e[0][1]*e[1][0],u=t[0][0]*t[1][1]-t[0][1]*t[1][0];return[(c*s-u*o)/n,(c*a-u*r)/n]}splitSource(e,t){this.getActive()&&(this.splitting||(this.source_.dispatchEvent({type:"beforesplit",feaure:e,source:this.source_}),this.dispatchEvent({type:"beforesplit",feaure:e,source:this.source_}),t?this._splitSource(e):setTimeout(function(){this._splitSource(e)}.bind(this))))}_splitSource(e){var t,i,o;this.splitting=!0,this.added_=[],this.removed_=[];var s=e.getGeometry().getCoordinates();switch(e.getGeometry().getType()){case"Point":s=[s];break;case"LineString":break;default:s=[]}var r,a=[];function n(t){if(t!==e&&t.getGeometry().splitAt)for(var i=t.getGeometry().getCoordinates(),o=0;o1))return c=t,!0}return!1}if(1===s.length){r=[s[0],s[0]];var l=ol.extent.buffer(ol.extent.boundingExtent(r),this.tolerance_);this.source_.forEachFeatureIntersectingExtent(l,function(e){if(e.getGeometry().splitAt){var t=e.getGeometry().splitAt(s[0],this.tolerance_);if(t.length>1)for(this.source_.removeFeature(e),i=0;i1){for(i=0;i30&&!this.isout_&&(this.lastSparkle=e.frameState.time,this.sparkles.push({p:[this.sparkle[0]+15*Math.random()-7.5,this.sparkle[1]+15*Math.random()],o:1})),t.save(),t.scale(e.frameState.pixelRatio,e.frameState.pixelRatio),t.fillStyle=this.get("color");for(var o,s=this.sparkles.length-1;o=this.sparkles[s];s--){if(o.o<.2){this.sparkles.splice(0,s+1);break}t.globalAlpha=o.o,t.beginPath(),t.arc(o.p[0],o.p[1],2.2,0,2*Math.PI,!1),t.fill(),o.o*=.98,o.p[0]+=Math.random()-.5,o.p[1]+=i*(1+Math.random())/30}t.restore(),this.sparkles.length&&this.getMap().render()}},ol.interaction.TouchCompass=class extends ol.interaction.Pointer{constructor(e){e=e||{};var t={handleDownEvent:function(e){var t=this.getCenter_(),i=e.pixel[0]-t[0],o=e.pixel[1]-t[1];return this.start=e,Math.sqrt(i*i+o*o)this.get("maxButtons")&&this.set("maxButtons",e.buttons.length);var o=this.overlay.element,s=e.buttons.length>4?0:1;e.buttons.forEach(function(e,t){t<5&&ol.ext.element.create("DIV",{className:((e.className||"")+" ol-button ol-button-"+(t+s)).trim(),html:ol.ext.element.create("DIV",{html:e.html}),click:e.click,on:e.on,parent:o})})}var r=!1,a=!1;this.on("dragstart",function(e){return this._pixel=this.getMap().getPixelFromCoordinate(this.overlay.getPosition()),a=e,!e.overlay}),this.on("dragend",function(e){return this._pixel=this.getMap().getPixelFromCoordinate(this.overlay.getPosition()),!e.overlay||(r?(this.dispatchEvent({type:"dragend",dragging:r,originalEvent:e.originalEvent,frameState:e.frameState,pixel:this._pixel,coordinate:this.overlay.getPosition()}),r=!1):e.originalEvent.target===this.overlay.element&&this.dispatchEvent({type:"click",dragging:r,originalEvent:e.originalEvent,frameState:e.frameState,pixel:this._pixel,coordinate:this.overlay.getPosition()}),!1)}.bind(this)),this.on("dragging",function(e){return this._pixel=this.getMap().getPixelFromCoordinate(this.overlay.getPosition()),!e.overlay||(r=!0,a&&(this.dispatchEvent({type:"dragstart",dragging:r,originalEvent:a.originalEvent,frameState:e.frameState,pixel:this._pixel,coordinate:a.coordinate}),a=!1),this.dispatchEvent({type:"dragging",dragging:r,originalEvent:e.originalEvent,frameState:e.frameState,pixel:this._pixel,coordinate:this.overlay.getPosition()}),!1)}.bind(this))}setMap(e){for(var t in this.getMap()&&(this.getMap().removeInteraction(this.ctouch),this.getActive()&&this.getMap().removeOverlay(this.overlay)),this._listeners)ol.Observable.unByKey(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)))}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"number"==typeof e?this.getOverlayElement().getElementsByClassName("ol-button")[e]:this.getOverlayElement().getElementsByClassName(e)[0]}removeButton(e){if(void 0===e)for(var t=this.getOverlayElement().getElementsByClassName("ol-button"),i=t.length-1;i>=0;i--)this.getOverlayElement().removeChild(t[i]);else{var o=this.getButtonElement(e);o&&this.getOverlayElement().removeChild(o)}}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+")...");else{var o=ol.ext.element.create("DIV",{className:((e.className||"")+" ol-button").trim(),html:ol.ext.element.create("DIV",{html:e.html}),click:e.click,on:e.on});e.before&&0!==t.length?this.getOverlayElement().insertBefore(o,t[0]):this.getOverlayElement().appendChild(o);for(var s=t.length>=i?0:1,r=0;r=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 o=this.getMap().getView().getRotation();this.coordinate_=e.coordinate,this.pixel_=e.pixel,this.geoms_=[],this.rotatedGeoms_=[];for(var s,r=ol.extent.createEmpty(),a=ol.extent.createEmpty(),n=0;s=this.selection_.item(n);n++)if(this.geoms_.push(s.getGeometry().clone()),r=ol.extent.extend(r,s.getGeometry().getExtent()),this.get("enableRotatedTransform")&&0!==o){var l=this.getGeometryRotateToZero_(s,!0);this.rotatedGeoms_.push(l),a=ol.extent.extend(a,l.getExtent())}if(this.extent_=ol.geom.Polygon.fromExtent(r).getCoordinates()[0],this.get("enableRotatedTransform")&&0!==o&&(this.rotatedExtent_=ol.geom.Polygon.fromExtent(a).getCoordinates()[0]),"rotate"===this.mode_){this.center_=this.getCenter()||ol.extent.getCenter(r);var h=e.map.getTargetElement();h.style.cursor=this.Cursors.rotate0,this.previousCursor_=h.style.cursor}else this.center_=ol.extent.getCenter(r);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}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_=1===this.selection_.getLength()&&"Point"==this.selection_.item(0).getGeometry().getType(),this.iscircle_=1===this.selection_.getLength()&&"Circle"==this.selection_.item(0).getGeometry().getType(),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,i,o,s,r=this.getMap().getView().getRotation(),a=[this.coordinate_[0],this.coordinate_[1]],n=[e.coordinate[0],e.coordinate[1]];switch(this.isUpdating_=!0,this.mode_){case"rotate":var l=Math.atan2(this.center_[1]-n[1],this.center_[0]-n[0]);if(!this.ispt)for(t=0;o=this.selection_.item(t);t++)(s=this.geoms_[t].clone()).rotate(l-this.angle_,this.center_),"Circle"==s.getType()&&s.setCenterAndRadius(s.getCenter(),s.getRadius()),o.setGeometry(s);this.drawSketch_(!0),this.dispatchEvent({type:"rotating",feature:this.selection_.item(0),features:this.selection_,angle:l-this.angle_,pixel:e.pixel,coordinate:e.coordinate});break;case"translate":var h=n[0]-a[0],c=n[1]-a[1];for(t=0;o=this.selection_.item(t);t++)o.getGeometry().translate(h,c);this.handles_.forEach(function(e){e.getGeometry().translate(h,c)}),this.coordinate_=e.coordinate,this.dispatchEvent({type:"translating",feature:this.selection_.item(0),features:this.selection_,delta:[h,c],pixel:e.pixel,coordinate:e.coordinate});break;case"scale":var u=this.center_;if(this.get("modifyCenter")(e)){var d=this.extent_;this.get("enableRotatedTransform")&&0!==r&&(d=this.rotatedExtent_),u=d[(Number(this.opt_)+2)%4]}var g=1==this.geoms_.length&&this._isRectangle(this.geoms_[0]),p=this.constraint_,m=this.opt_,f=this.coordinate_,v=e.coordinate;if(this.get("enableRotatedTransform")&&0!==r){var y=new ol.geom.Point(this.coordinate_);y.rotate(-1*r,u),f=y.getCoordinates();var _=new ol.geom.Point(e.coordinate);_.rotate(-1*r,u),v=_.getCoordinates()}var x=(v[0]-u[0])/(f[0]-u[0]),b=(v[1]-u[1])/(f[1]-u[1]),w=[v[0]-f[0],v[1]-f[1]];if(this.get("enableRotatedTransform")&&0!==r){var S=new ol.geom.Point(u);S.rotate(-1*r,this.getMap().getView().getCenter()),u=S.getCoordinates()}for(this.get("noFlip")&&(x<0&&(x=-x),b<0&&(b=-b)),this.constraint_?"h"==this.constraint_?x=1:b=1:this.get("keepAspectRatio")(e)&&(x=b=Math.min(x,b)),t=0;o=this.selection_.item(t);t++)(s=0!==r&&this.get("enableRotatedTransform")?this.rotatedGeoms_[t].clone():this.geoms_[t].clone()).applyTransform(function(e,t,o){if(o<2)return t;if(g){var r=[[6],[0,8],[2],[4]],a=[e[0],e[1]],n=[e[2],e[3]],l=[e[4],e[5]],h=[e[6],e[7]],c=[e[8],e[9]];if(p){var d=m%2==0?this._countVector(a,n):this._countVector(h,a),f=this._projectVectorOnVector(w,d),y=[...r[m],...r[m+1this.get("maxLength");)this.shift();if(this.get("maxSize"))for(;this.length()>1&&this.size()>this.get("maxSize");)this.shift()}getStack(e){return"redo"===e?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,"blockstart"===e.type)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(e){ol.Observable.unByKey(e)}),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(e){ol.Observable.unByKey(e)}),this._sourceListener=[];var t=this;e&&(function e(i,o){return o||(o=[]),i.forEach(function(i){i instanceof ol.layer.Vector?(!t._layers||t._layers.indexOf(i)>=0)&&o.push(i):i.getLayers&&e(i.getLayers(),o)}),o}(e.getLayers()).forEach(function(e){var t=e.getSource();this._sourceListener.push(t.on(["addfeature","removefeature"],this._onAddRemove.bind(this))),this._sourceListener.push(t.on("clearstart",function(){this.blockStart("clear")}.bind(this))),this._sourceListener.push(t.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(e){ol.Observable.unByKey(e)}),this._interactionListener=[],e&&(e.getInteractions().forEach(function(e){this._interactionListener.push(e.on(["setattributestart","modifystart","rotatestart","translatestart","scalestart","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 o=e.newProperties,s=e.oldProperties;for(var r in s)void 0===s?e.feature.unset(r):e.feature.set(r,s[r]);e.oldProperties=o,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))}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()}},ol.interaction.UndoRedo.prototype._onInteraction.setattributestart=function(e){this.blockStart(e.target.get("name")||"setattribute");var t=Object.assign({},e.properties);e.features.forEach(function(e){var i={};for(var o in t)i[o]=e.get(o);this._undoStack.push({type:"changeattribute",feature:e,newProperties:t,oldProperties:i})}.bind(this)),this.blockEnd()},ol.interaction.UndoRedo.prototype._onInteraction.rotatestart=ol.interaction.UndoRedo.prototype._onInteraction.translatestart=ol.interaction.UndoRedo.prototype._onInteraction.scalestart=ol.interaction.UndoRedo.prototype._onInteraction.modifystart=function(e){this.blockStart(e.type.replace(/start$/,"")),e.features.forEach(function(e){this._undoStack.push({type:"changegeometry",feature:e,oldGeom:e.getGeometry().clone()})}.bind(this)),this.blockEnd()},ol.interaction.UndoRedo.prototype._onInteraction.beforesplit=function(){var e=this._undoStack.getLength();e>2&&"blockend"===this._undoStack.item(e-1).type&&"changegeometry"===this._undoStack.item(e-2).type?this._undoStack.pop():this.blockStart("split")},ol.interaction.UndoRedo.prototype._onInteraction.deletestart=function(){this.blockStart("delete")},ol.interaction.UndoRedo.prototype._onInteraction.aftersplit=ol.interaction.UndoRedo.prototype._onInteraction.deleteend=ol.interaction.UndoRedo.prototype.blockEnd,ol.source.BinBase=class extends ol.source.Vector{constructor(e){super(e=e||{}),this._bindModify=this._onModifyFeature.bind(this),this._watch=!0,this._origin=e.source,this._listen=!1!==e.listenChange,this._geomFn=e.geometryFunction||ol.coordinate.getFeatureCenter||function(e){return e.getGeometry().getFirstCoordinate()},this._origin.on("addfeature",this._onAddFeature.bind(this)),this._origin.on("removefeature",this._onRemoveFeature.bind(this)),this._origin.on("clearstart",this._onClearFeature.bind(this)),this._origin.on("clearend",this._onClearFeature.bind(this)),"function"==typeof e.flatAttributes&&(this._flatAttributes=e.flatAttributes)}_onAddFeature(e,t,i){var o=e.feature||e.target;(t=t||this.getBinAt(this._geomFn(o),!0))&&t.get("features").push(o),this._listen&&!1!==i&&o.on("change",this._bindModify)}_onRemoveFeature(e,t,i){if(this._watch){var o=e.feature||e.target;if(t=t||this.getBinAt(this._geomFn(o))){for(var s,r=t.get("features"),a=0;s=r[a];a++)if(s===o){r.splice(a,1);break}r.length||this.removeFeature(t)}this._listen&&!1!==i&&o.un("change",this._bindModify)}}_onClearFeature(e){"clearstart"===e.type?(this._listen&&this._origin.getFeatures().forEach(function(e){e.un("change",this._bindModify)}.bind(this)),this.clear(),this._watch=!1):this._watch=!0}getBin(e){for(var t,i=this.getFeatures(),o=0;t=i[o];o++)for(var s,r=t.get("features"),a=0;s=r[a];a++)if(s===e)return t;return null}getGridGeomAt(e){return new ol.geom.Polygon([e])}getBinAt(e,t){var i={},o=this.getGridGeomAt(e,i);if(!o)return null;var s=o.getInteriorPoint?o.getInteriorPoint().getCoordinates():o.getInteriorPoints().getCoordinates()[0],r=this.getFeaturesAtCoordinate(s)[0];return!r&&t&&(i.geometry=o,i.features=[],i.center=s,r=new ol.Feature(i),this.addFeature(r)),r||null}_onModifyFeature(e){var t=this.getBin(e.target),i=this.getBinAt(this._geomFn(e.target),"create");t!==i&&(t&&this._onRemoveFeature(e,t,!1),i&&this._onAddFeature(e,i,!1)),this.changed()}reset(){this.clear();for(var e,t=this._origin.getFeatures(),i=0;e=t[i];i++)this._onAddFeature({feature:e});this.changed()}getGridFeatures(){var e=[];return this.getFeatures().forEach(function(t){var i=new ol.Feature(t.getGeometry().clone());for(var o in t.getProperties())"features"!==o&&"geometry"!==o&&i.set(o,t.get(o));i.set("nb",t.get("features").length),this._flatAttributes(i,t.get("features")),e.push(i)}.bind(this)),e}_flatAttributes(){}setFlatAttributesFn(e){"function"==typeof e&&(this._flatAttributes=e)}getSource(){return this._origin}},ol.source.DBPedia=class extends ol.source.Vector{constructor(e){var t=e||{};t.attributions||(t.attributions=['© DBpedia CC-by-SA']),t.strategy||(t.strategy=ol.loadingstrategy.bbox),super(t),this.setLoader(this._loaderFn),this._url=t.url||"http://fr.dbpedia.org/sparql",this._maxResolution=t.maxResolution||100,this._lang=t.lang||"fr",this._limit=t.limit||1e3}readFeature(e,t,i){for(var o in t)"uri"===t[o].type&&(t[o].value=encodeURI(t[o].value)),e.set(o,t[o].value);return!i||i.get("subject")!=t.subject.value||(i.set("type",i.get("type")+"\n"+t.type.value),!1)}querySubject(){return"?subject rdfs:label ?label. OPTIONAL {?subject dbo:thumbnail ?thumbnail}.OPTIONAL {?subject dbo:abstract ?abstract} . OPTIONAL {?subject rdf:type ?type}"}queryFilter(){return"lang(?label) = '"+this._lang+"' && lang(?abstract) = '"+this._lang+"'"}_loaderFn(e,t,i){if(!(t>this._maxResolution)){var o=this,s=ol.proj.transformExtent(e,i,"EPSG:4326"),r="PREFIX geo: SELECT DISTINCT * WHERE { ?subject geo:lat ?lat . ?subject geo:long ?long . "+this.querySubject()+" . FILTER("+this.queryFilter()+") . FILTER(xsd:float(?lat) <= "+s[3]+" && "+s[1]+" <= xsd:float(?lat) && xsd:float(?long) <= "+s[2]+" && "+s[0]+" <= xsd:float(?long) ) . } LIMIT "+this._limit;ol.ext.Ajax.get({url:this._url,data:{query:r,format:"json"},success:function(e){var t,s,r,a=e.results.bindings,n=[],l=null;for(var h in a)t=a[h],s=[Number(a[h].long.value),Number(a[h].lat.value)],r=new ol.Feature(new ol.geom.Point(ol.proj.transform(s,"EPSG:4326",i))),o.readFeature(r,t,l)&&(n.push(r),l=r);o.addFeatures(n)}})}}},ol.style.clearDBPediaStyleCache,ol.style.dbPediaStyleFunction,function(){var e={};ol.style.clearDBPediaStyleCache=function(){e={}},ol.style.dbPediaStyleFunction=function(t){var i;switch(t||(t={}),typeof t.glyph){case"function":i=t.glyph;break;case"string":i=function(){return t.glyph};break;default:i=function(e){var t=e.get("type");if(t){if(t.match("/Museum"))return"fa-camera";if(t.match("/Monument"))return"fa-building";if(t.match("/Sculpture"))return"fa-android";if(t.match("/Religious"))return"fa-institution";if(t.match("/Castle"))return"fa-key";if(t.match("Water"))return"fa-tint";if(t.match("Island"))return"fa-leaf";if(t.match("/Event"))return"fa-heart";if(t.match("/Artwork"))return"fa-asterisk";if(t.match("/Stadium"))return"fa-futbol-o";if(t.match("/Place"))return"fa-street-view"}return"fa-star"}}var o=t.radius||8,s=t.fill||new ol.style.Fill({color:"navy"}),r=t.stroke||new ol.style.Stroke({color:"#fff",width:2}),a=t.prefix?t.prefix+"_":"";return function(t){var n=i(t),l=a+n,h=e[l];return h||(e[l]=h=new ol.style.Style({image:new ol.style.FontSymbol({glyph:n,radius:o,fill:s,stroke:r})})),[h]}}}(),ol.source.DFCI=class extends ol.source.Vector{constructor(e){(e=e||{}).loader=function(e,t,i){return this._calcGrid(e,t,i)},e.strategy=function(e,t){return this.resolution&&this.resolution!=t&&(this.clear(),this.refresh()),[e]},super(e),this._bbox=[[0,16e5],[11e5,26e5]],this.set("resolutions",e.resolutions||[1e3,100,20]),proj4.defs["EPSG:27572"]||proj4.defs("EPSG:27572","+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs"),ol.proj.proj4.register(proj4)}_calcGrid(e,t,i){var o,s,r=this.get("resolutions");t>(r[0]||1e3)?this.resolution!=t&&(this._features0||(s=[this._bbox[0][0],this._bbox[0][1],this._bbox[1][0],this._bbox[1][1]],this._features0=this._getFeatures(0,s,i)),this.addFeatures(this._features0)):t>(r[1]||100)?(this.clear(),s=ol.proj.transformExtent(e,i,"EPSG:27572"),o=this._getFeatures(1,s,i),this.addFeatures(o)):t>(r[2]||0)?(this.clear(),s=ol.proj.transformExtent(e,i,"EPSG:27572"),o=this._getFeatures(2,s,i),this.addFeatures(o)):(this.clear(),s=ol.proj.transformExtent(e,i,"EPSG:27572"),o=this._getFeatures(3,s,i),this.addFeatures(o)),this.resolution=t}_midPt(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}_trFeature(e,t,i,o){var s=new ol.geom.Polygon([e]),r=new ol.Feature(s.transform("EPSG:27572",o));return r.set("id",t),r.set("level",i),r}_getFeatures(e,t,i){var o,s=[],r=1e5;e>0&&(r/=5),e>1&&(r/=10);for(var a=[Math.max(this._bbox[0][0],Math.floor(t[0]/r)*r),Math.max(this._bbox[0][1],Math.floor(t[1]/r)*r)],n=[Math.min(this._bbox[1][0]+99999,Math.floor(t[2]/r)*r),Math.min(this._bbox[1][1]+99999,Math.floor(t[3]/r)*r)],l=a[0];l<=n[0];l+=r)for(var h=a[1];h<=n[1];h+=r){var c,u=[[l,h],[l+r,h],[l+r,h+r],[l,h+r],[l,h]];if(e>2){var d=this._midPt(u[0],u[2]),g=[];for(o=0;o=-180;m-=c)a.push([m,p]);a.push(a[0])}if("daynight"===t){var f=[];a.forEach(function(e){f.push(e.slice())}),f[0][1]=-f[0][1],f[f.length-1][1]=-f[0][1],f[f.length-1][1]=-f[0][1],a=[a,f]}return a}},ol.source.Delaunay=class extends ol.source.Vector{constructor(e){var t=(e=e||{}).source;delete e.source,super(e),this._nodes=t,this.hull=[],this._nodes.on("addfeature",this._onAddNode.bind(this)),this._nodes.on("removefeature",this._onRemoveNode.bind(this)),this.set("epsilon",e.epsilon||1e-4)}clear(e){super.clear(e),this.getNodeSource().clear(e)}_addTriangle(e){e.push(e[0]);var t=new ol.Feature(new ol.geom.Polygon([e]));return this.addFeature(t),this.flip.push(t),t}getNodes(){return this._nodes.getFeatures()}getNodeSource(){return this._nodes}_onRemoveNode(e){var t=e.feature.getGeometry().getCoordinates();if(t&&!this.getNodesAt(t).length){var i,o=this.getTrianglesAt(t);this.flip=[];for(var s=[];o.length;){var r=o.pop();this.removeFeature(r),r=r.getGeometry().getCoordinates()[0];var a=[];for(i=0;i<3;i++)l=r[i],ol.coordinate.equal(l,t)||a.push(l);s.push(a)}for(a=s.pop(),i=0;;){var n=s[i];if(f(n[0],n[1],0)||f(n[1],n[0],0)||f(n[0],n[1],a.length-1)||f(n[1],n[0],a.length-1)?(s.splice(i,1),i=0):i++,!s.length)break;if(i>=s.length)throw"[DELAUNAY:removePoint] No edge found"}var l,h=ol.coordinate.equal(a[0],a[a.length-1]);for(h&&a.pop();l=this.hull[i];i++)if(ol.coordinate.equal(t,l)){this.hull.splice(i,1);break}this.hull=ol.coordinate.convexHull(this.hull.concat(a));var c,u=function(e){for(var t,i=0,o=0;o=0?1:-1},d=a.slice();for(h?c=u(a):(d.push(t),c=u(d)),i=0;i<=a.length+1&&!(a.length<3);i++){var g=[a[i%a.length],a[(i+1)%a.length],a[(i+2)%a.length]];if(u(g)===c){for(var p=!0,m=i+3;m1)this._nodes.removeFeature(o);else if(s.length<=3){if(3===s.length){var a=[];for(t=0;t<3;t++)a.push(s[t].getGeometry().getCoordinates());this._addTriangle(a),this.hull=ol.coordinate.convexHull(a)}}else{var n=this.getFeaturesAtCoordinate(r)[0];if(n){this.removeFeature(n),n.set("del",!0);var l=n.getGeometry().getCoordinates()[0];for(t=0;t<3;t++)this._addTriangle([r,l[t],l[(t+1)%3]])}else{var h=this.hull.slice();for(h.push(r),h=ol.coordinate.convexHull(h),t=0;(i=h[t])&&!ol.coordinate.equal(i,r);t++);var c=h[t=0!==t?t-1:h.length-1],u=h[(t+2)%h.length];for(t=0;(i=this.hull[t])&&!ol.coordinate.equal(i,c);t++);for(;;){if(t>1e3){console.error("[DELAUNAY:addPoint] Too many iterations");break}if(t++,i=this.hull[t%this.hull.length],this._addTriangle([r,i,c]),c=i,i[0]===u[0]&&i[1]===u[1])break}this.hull=h}this.flipTriangles()}}else this._nodes.removeFeature(o)}flipTriangles(){for(var e,t=1e3;this.flip.length;){if(t--<0){console.error("[DELAUNAY:flipTriangles] Too many iterations");break}var i=this.flip.pop();if(!i.get("del"))for(var o=i.getGeometry().getCoordinates()[0],s=0;s<3;s++){var r=[(o[(s+1)%3][0]+o[s][0])/2,(o[(s+1)%3][1]+o[s][1])/2],a=this.getTrianglesAt(r),n=null;if(a.length>1){var l=a[0].getGeometry().getCoordinates()[0],h=a[1].getGeometry().getCoordinates()[0];for(e=0;eGéoportail © IGN-France',ol.source.Geoportail.getServiceURL=function(e,t){return e?e.replace(/^(https?:\/\/[^/]*)(.*)$/,"$1/"+t+"$2"):(window.geoportailConfig?window.geoportailConfig.url:"https://wxs.ign.fr/")+t+"/geoportail/wmts"},ol.source.GridBin=class extends ol.source.BinBase{constructor(e){super(e=e||{}),this.set("gridProjection",e.gridProjection||"EPSG:4326"),this.setSize("size",e.size||1),this.reset()}setGridProjection(e){this.set("gridProjection",e),this.reset()}setSize(e){this.set("size",e),this.reset()}getGridGeomAt(e){e=ol.proj.transform(e,this.getProjection()||"EPSG:3857",this.get("gridProjection"));var t=this.get("size"),i=t*Math.floor(e[0]/t),o=t*Math.floor(e[1]/t);return new ol.geom.Polygon([[[i,o],[i+t,o],[i+t,o+t],[i,o+t],[i,o]]]).transform(this.get("gridProjection"),this.getProjection()||"EPSG:3857")}},ol.source.HexBin=class extends ol.source.BinBase{constructor(e){super(e=e||{}),this._hexgrid=new ol.HexGrid(e),this.reset()}getGridGeomAt(e){var t=this._hexgrid.coord2hex(e);return new ol.geom.Polygon([this._hexgrid.getHexagon(t)])}setSize(e,t){this._hexgrid.setSize(e),t||this.reset()}getSize(){return this._hexgrid.getSize()}setLayout(e,t){this._hexgrid.setLayout(e),t||this.reset()}getLayout(){return this._hexgrid.getLayout()}setOrigin(e,t){this._hexgrid.setOrigin(e),t||this.reset()}getOrigin(){return this._hexgrid.getOrigin()}getHexFeatures(){return super.getGridFeatures()}},ol.source.IDW=class extends ol.source.ImageCanvas{constructor(e){if((e=e||{}).canvasFunction=function(e,t,i,o){return this.calculateImage(e,t,i,o)},super(e),this._source=e.source,this._canvas=document.createElement("CANVAS"),this._source.on(["addfeature","removefeature","clear","removefeature"],function(){this.changed()}.bind(this)),"function"==typeof e.getColor&&(this.getColor=e.getColor),e.useWorker){var t={hue2rgb:this.hue2rgb,getColor:this.getColor};for(var i in e.useWorker)t[i]=e.useWorker[i];this.worker=new ol.ext.Worker(this.computeImage,{onMessage:this.onImageData.bind(this),lib:t})}this._position={extent:[],resolution:0},this.set("scale",e.scale||4),this._weight="function"==typeof e.weight?e.weight:function(t){return t.get(e.weight||"weight")}}getSource(){return this._source}getValue(e){if(!this._canvas)return null;var t=this.transform(e);return this._canvas.getContext("2d").getImageData(Math.round(t[0]),Math.round(t[1]),1,1).data}hue2rgb(e){return(e=(e+6)%6)<1?Math.round(255*e):e<3?255:e<4?Math.round(255*(4-e)):0}getColor(e){var t=4-.04*e;return[this.hue2rgb(t+2),this.hue2rgb(t),this.hue2rgb(t-2),255]}computeImage(e){var t,i,o=e.data.pts,s=e.data.width,r=e.data.height,a=new Uint8ClampedArray(s*r*4);for(i=0;iMapillary"]),t.strategy||(t.strategy=ol.loadingstrategy.bbox),super(t),this._maxResolution=t.maxResolution||100,this._limit=t.limit||100}readFeature(){return!0}_loaderFn(e,t,i){if(!(t>this._maxResolution)){var o=ol.proj.transformExtent(e,i,"EPSG:4326"),s=Date.now()-15552e6,r="https://a.mapillary.com/v2/search/im?client_id="+this.get("clientId")+"&max_lat="+o[3]+"&max_lon="+o[2]+"&min_lat="+o[1]+"&min_lon="+o[0]+"&limit="+(this._limit-1)+"&start_time="+s;ol.ext.Ajax.get({url:r,dataType:"jsonp",success:function(e){console.log(e)}})}}},ol.source.OilPainting=class extends ol.source.Raster{constructor(e){e.operation=ol.source.OilPainting._operation,e.operationType="image",super(e),this.set("radius",e.radius||4),this.set("intensity",e.intensity||25),this.on("beforeoperations",function(e){var t=Math.round((e.extent[2]-e.extent[0])/e.resolution),i=Math.round((e.extent[3]-e.extent[1])/e.resolution);e.data.image=new ImageData(t,i),e.data.radius=Number(this.get("radius"))||1,e.data.intensity=Number(this.get("intensity"))}.bind(this))}set(e,t){if(t)switch(e){case"intensity":case"radius":(t=Number(t))<1&&(t=1),this.changed()}return super.set(e,t)}},ol.source.OilPainting._operation=function(e,t){for(var i=e[0].width,o=e[0].height,s=e[0].data,r=[],a=t.image,n=a.data,l=[],h=[],c=0;c0&&c+y0&&u+_this._maxResolution)){var o=this,s=ol.proj.transformExtent(e,i,"EPSG:4326"),r="[bbox:"+(s=s[1]+","+s[0]+","+s[3]+","+s[2])+"][out:xml][timeout:25];";for(var a in r+="(",this._types)if(this._types[a]){r+=a;for(var n,l=0;n=this._filter[l];l++)r+="["+n+"]";r+=";"}r+=");out;>;out skel qt;";var h=new XMLHttpRequest;h.open("POST",this._url,!0),h.onload=function(){for(var e,t=(new ol.format.OSMXML).readFeatures(this.responseText,{featureProjection:i}),s=[],r=0;e=t[r];r++)o.hasFeature(e)||s.push(e);o.addFeatures(s)},h.onerror=function(){console.log(arguments)},h.send("data="+r)}}hasFeature(e){for(var t,i=e.getGeometry().getFirstCoordinate(),o=e.getId(),s=this.getFeaturesInExtent([i[0]-.1,i[1]-.1,i[0]+.1,i[1]+.1]),r=0;t=s[r];r++)if(o===t.getId())return!0;return!1}},ol.source.TileWFS=class extends ol.source.Vector{constructor(e){(e=e||{}).featureLimit||(e.featureLimit=1/0);var t=e.tileZoom||14,i={strategy:ol.loadingstrategy.tile(ol.tilegrid.createXYZ({minZoom:t,maxZoom:t,tileSize:512}))},o=new ol.format.GeoJSON,s=e.url+"?service=WFS&request=GetFeature&version="+(e.version||"1.1.0")+"&typename="+(e.typeName||"")+"&outputFormat=application/json";e.maxFeatures&&(s+="&maxFeatures="+e.maxFeatures+"&count="+e.maxFeatures);var r={loading:0,loaded:0};i.loader=function(t,i,a){r.loading===r.loaded&&(r.loading=r.loaded=0,this.getFeatures().length>e.maxFeatures&&(this.clear(),this.refresh())),r.loading++,this.dispatchEvent({type:"tileloadstart",loading:r.loading,loaded:r.loaded}),this._loadTile(s,t,a,o,r)},super(i),this.set("pagination",e.pagination)}_loadTile(e,t,i,o,s){var r=e+"&srsname="+i.getCode()+"&bbox="+t.join(",")+","+i.getCode();this.get("pagination")&&!/&startIndex/.test(e)&&(r+="&startIndex=0"),ol.ext.Ajax.get({url:r,success:function(r){if(s.loaded++,r.error)this.dispatchEvent({type:"tileloaderror",error:r,loading:s.loading,loaded:s.loaded});else{var a=o.readFeatures(r,{featureProjection:i});a.length>0&&this.addFeatures(a);var n=r.numberReturned||0;/&startIndex/.test(e)&&(n+=parseInt(e.replace(/.*&startIndex=(\d*).*/,"$1")),e=e.replace(/&startIndex=(\d*)/,"")),nthis.get("maxResolution"))){if(this.res_=400*t,this.animate_){var i=e.frameState.time-this.animate_;ithis.animateDuration_&&(this.animate_=!1),!!this.animate_}_getFeatureHeight(e){if(this.animate_){var t=this.height_(e),i=this.toHeight_(e);return t*(1-this.elapsedRatio_)+this.elapsedRatio_*i}return this.height_(e)}hvector_(e,t){var i=[e[0]*this.matrix_[0]+e[1]*this.matrix_[1]+this.matrix_[4],e[0]*this.matrix_[2]+e[1]*this.matrix_[3]+this.matrix_[5]];return{p0:i,p1:[i[0]+t/this.res_*(i[0]-this.center_[0]),i[1]+t/this.res_*(i[1]-this.center_[1])]}}getFeature3D_(e,t){var i=this.get("geometry")(e),o=i.getCoordinates();switch(i.getType()){case"Polygon":o=[o];case"MultiPolygon":for(var s=[],r=0;r=0;r--)e.lineTo(s[r].p1[0],s[r].p1[1]);e.closePath()}e.fill("evenodd"),e.stroke();break;case"Point":var n=(s=t[i]).feature.get("label");if(n){var l=s.geom.p1,h=e.measureText(n),c=Number(e.font.match(/\d+(\.\d+)?/g).join([]));e.fillRect(l[0]-h.width/2-5,l[1]-c-5,h.width+10,c+10),e.strokeRect(l[0]-h.width/2-5,l[1]-c-5,h.width+10,c+10),e.save(),e.fillStyle=ol.color.asString(this._style.getText().getFill().getColor()),e.textAlign="center",e.textBaseline="bottom",e.fillText(n,l[0],l[1]),e.restore()}}}},ol.source.WikiCommons=class extends ol.source.Vector{constructor(e){var t=e||{};t.loader=function(e,t,i){return this._loaderFn(e,t,i)},t.attributions||(t.attributions=['© Wikimedia Commons']),t.strategy||(t.strategy=ol.loadingstrategy.bbox),super(t),this._maxResolution=t.maxResolution||100,this._lang=t.lang||"fr",this._limit=t.limit||100}readFeature(e,t){return e.set("descriptionurl",t.descriptionurl),e.set("url",t.url),e.set("title",t.title.replace(/^file:|.jpg$/gi,"")),e.set("thumbnail",t.url.replace(/^(.+wikipedia\/commons)\/([a-zA-Z0-9]\/[a-zA-Z0-9]{2})\/(.+)$/,"$1/thumb/$2/$3/200px-$3")),e.set("user",t.user),t.extmetadata&&t.extmetadata.LicenseShortName&&e.set("copy",t.extmetadata.LicenseShortName.value),!0}_loaderFn(e,t,i){if(!(t>this._maxResolution)){var o=this,s=ol.proj.transformExtent(e,i,"EPSG:4326"),r="https://commons.wikimedia.org/w/api.php?action=query&format=json&origin=*&prop=coordinates|imageinfo&generator=geosearch&iiprop=timestamp|user|url|extmetadata|metadata|size&iiextmetadatafilter=LicenseShortName&ggsbbox="+s[3]+"|"+s[0]+"|"+s[1]+"|"+s[2]+"&ggslimit="+this._limit+"&iilimit="+(this._limit-1)+"&ggsnamespace=6";ol.ext.Ajax.get({url:r,success:function(e){var t,s,r,a=[];if(e.query&&e.query.pages){for(var n in e.query.pages){if((t=e.query.pages[n]).coordinates&&t.coordinates.length)s=[t.coordinates[0].lon,t.coordinates[0].lat];else{var l=t.imageinfo[0].metadata;if(!l)continue;s=[];for(var h=0,c=0;c1e3)return void this.stopAnimation();a=r.start=(new Date).getTime()}if(r.start){var c=e.vectorContext||ol.render.getVectorContext(e),u=(a-r.start)/t;u>1&&(this.stopAnimation(),u=1),u=this.get("animationMethod")(u);var d=this.getStyle(),g="function"==typeof d?d:d.length?function(){return d}:function(){return[d]};for(e.context.save(),e.context.globalAlpha=this.getOpacity(),i=0;h=r.clusters[i];i++){var p=h.f.getGeometry().getCoordinates(),m=p[0]-h.pt[0],f=p[1]-h.pt[1];r.revers?(p[0]=h.pt[0]+u*m,p[1]=h.pt[1]+u*f):(p[0]=p[0]-u*m,p[1]=p[1]-u*f);var v=g(h.f,s,!0);if(v.length||(v=[v]),1!==h.f.get("features").length||m||f){var y=new ol.geom.Point(p);l=new ol.Feature(y)}else l=h.f.get("features")[0];for(var _,x=0;_=v[x];x++)if(_.getText()&&/\n/.test(_.getText().getText())){var b,w=_.getText().getOffsetX(),S=_.getText().getOffsetY(),M=_.getText().getRotation()||0,C=1.2*Number((_.getText().getFont()||"10px").match(/\d+/)),E=_.getText().getText().split("\n"),L=E.length-1,T=_.clone();E.forEach(function(t,i){switch(1==i&&(T.setImage(),T.setFill(),T.setStroke()),_.getText().getTextBaseline()){case"alphabetic":case"ideographic":case"bottom":b=L;break;case"hanging":case"top":b=0;break;default:b=L/2}T.getText().setOffsetX(w-Math.sin(M)*C*(i-b)),T.getText().setOffsetY(S+Math.cos(M)*C*(i-b)),T.getText().setText(t),c.drawFeature(l,ol.ext.getVectorContextStyle(e,T))})}else c.drawFeature(l,ol.ext.getVectorContextStyle(e,_))}e.context.restore(),e.frameState.animate=!0,e.context.save(),e.context.beginPath(),e.context.rect(0,0,0,0),e.context.clip(),this.clip_=!0}}}postanimate(e){this.clip_&&(e.context.restore(),this.clip_=!1)}},ol.layer.GeoImage=class extends ol.layer.Image{constructor(e){super(e)}getExtent(){return this.getSource().getExtent()}},ol.layer.Geoportail=class extends ol.layer.Tile{constructor(e,t,i){t=t||{},i=i||{},"string"!=typeof e&&(i=t||{},e=(t=e).layer);var o=t.maxZoom;t.source&&(e=t.source.getLayer(),t.gppKey=t.source.getGPPKey());var s=window.geoportailConfig&&(window.geoportailConfig.capabilities[t.gppKey||t.key]||window.geoportailConfig.capabilities.default)||ol.layer.Geoportail.capabilities;for(var r in(s=s[e])||(s=ol.layer.Geoportail.capabilities[e]),s||(s={title:e,originators:[]},console.error('ol.layer.Geoportail: no layer definition for "'+e+'"\nTry to use ol/layer/Geoportail~loadCapabilities() to get it.')),s)void 0===i[r]&&(i[r]=s[r]);i.gppKey||i.key||(i.gppKey=t.gppKey||t.key),t.source||(t.source=new ol.source.Geoportail(e,i)),t.title||(t.title=s.title),t.name||(t.name=e),t.layer=e,t.queryable||(t.queryable=s.queryable),t.desc||(t.desc=s.desc),!t.extent&&s.bbox&&s.bbox[0]>-170&&s.bbox[2]<170&&(t.extent=ol.proj.transformExtent(s.bbox,"EPSG:4326",t.projection||"EPSG:3857")),t.maxZoom=o,!t.maxResolution&&i.minZoom&&(t.source.getTileGrid().minZoom-=i.minZoom>1?2:1,t.maxResolution=t.source.getTileGrid().getResolution(t.source.getTileGrid().minZoom),t.source.getTileGrid().minZoom=i.minZoom),super(t),this._originators=s.originators}static register(e,t){ol.layer.Geoportail.capabilities[e]=t}static isRegistered(e){return ol.layer.Geoportail.capabilities[e]&&ol.layer.Geoportail.capabilities[e].key}static loadCapabilities(e,t){var i=function(){},o=function(){},s=function(){};this.getCapabilities(e,t).then(function(e){ol.layer.Geoportail.capabilities=e,i(e)}).catch(function(e){o(e)}).finally(function(e){s(e)});var r={then:function(e){return"function"==typeof e&&(i=e),r},catch:function(e){return"function"==typeof e&&(o=e),r},finally:function(e){return"function"==typeof e&&(s=e),r}};return r}static getCapabilities(e){var t={},i=function(){},o=function(){},s=function(){},r=[156543.03390625,78271.516953125,39135.7584765625,19567.87923828125,9783.939619140625,4891.9698095703125,2445.9849047851562,1222.9924523925781,611.4962261962891,305.74811309814453,152.87405654907226,76.43702827453613,38.218514137268066,19.109257068634033,9.554628534317017,4.777314267158508,2.388657133579254,1.194328566789627,.5971642833948135,.29858214169740677,.14929107084870338];function a(e){e=281e-6*Number(e);for(var t=0;tr[t])return t}function n(e){for(var t=e.constraint.length-1;t>0;t--)for(var i=0;i$/,"$1"),originators:{}},d=r.getElementsByTagName("gpp:Originator"),g=0;c=d[g];g++){for(var p,m=u.originators[c.attributes.name.value]={href:c.getElementsByTagName("gpp:URL")[0].innerHTML,attribution:c.getElementsByTagName("gpp:Attribution")[0].innerHTML,logo:c.getElementsByTagName("gpp:Logo")[0].innerHTML,minZoom:20,maxZoom:0,constraint:[]},f=c.getElementsByTagName("gpp:Constraint"),v=0;p=f[v];v++){var y=a(p.getElementsByTagName("sld:MinScaleDenominator")[0].innerHTML),_=a(p.getElementsByTagName("sld:MaxScaleDenominator")[0].innerHTML);_>m.maxZoom&&(m.maxZoom=_),_m.maxZoom&&(m.maxZoom=y),ythis.getMaxResolution()){var o=this.getMinResolution(),s=this.getMaxResolution();for(s>1e5&&(s=156543),o<.15&&(o=.15),t=s;s>o;)s/=2,t=o*=2}var r=this.getExtent();if(e||(e=[21020,6355964]),r&&!ol.extent.containsCoordinate(r,e)&&(e=[(r[0]+r[2])/2,(r[1]+r[3])/2]),i&&(e=ol.proj.transform(e,i,this.getSource().getProjection())),this.getSource&&this.getSource())try{return[this.getSource().getPreview(e,t)]}catch(r){}return[]},ol.layer.Group.prototype.getPreview=function(e,t){if(this.get("preview"))return[this.get("preview")];var i=[];if(this.getLayers)for(var o=this.getLayers().getArray(),s=0;sthis.get("maxResolution"))){if(this.res_=400*t,this.animate_){var i=e.frameState.time-this.animate_;ithis.animateDuration_&&(this.animate_=!1),!!this.animate_}getFeatureHeight(e){if(this.animate_){var t=this.height_(e),i=this.toHeight_(e);return t*(1-this.elapsedRatio_)+this.elapsedRatio_*i}return this.height_(e)}hvector_(e,t){var i=[e[0]*this.matrix_[0]+e[1]*this.matrix_[1]+this.matrix_[4],e[0]*this.matrix_[2]+e[1]*this.matrix_[3]+this.matrix_[5]];return{p0:i,p1:[i[0]+t/this.res_*(i[0]-this.center_[0]),i[1]+t/this.res_*(i[1]-this.center_[1])]}}getFeature3D_(e,t){var i=this.get("geometry")(e),o=i.getCoordinates();switch(i.getType()){case"Polygon":o=[o];case"MultiPolygon":for(var s=[],r=0;r=0;r--)e.lineTo(s[r].p1[0],s[r].p1[1]);e.closePath()}e.fill("evenodd"),e.stroke();break;case"Point":var n=(s=t[i]).feature.get("label");if(n){var l=s.geom.p1,h=e.fillStyle;e.fillStyle=e.strokeStyle,e.textAlign="center",e.textBaseline="bottom",e.fillText(n,l[0],l[1]);var c=e.measureText(n),u=Number(e.font.match(/\d+(\.\d+)?/g).join([]));e.fillStyle="rgba(255,255,255,0.5)",e.fillRect(l[0]-c.width/2-5,l[1]-u-5,c.width+10,u+10),e.strokeRect(l[0]-c.width/2-5,l[1]-u-5,c.width+10,u+10),e.fillStyle=h}}}drawGhost3D_(e,t){var i,o,s,r;for(i=0;i=2&&this.finishDrawing(),!0)}removeLastPoint(){this._geom.pop(),this._lastCoord=this._geom[this._geom.length-1],this.drawSketch()}startDrawing(e){e=e||{},this._geom=[],e.type&&this.setGeometryType(e.type),this.drawSketch(),this._drawing||this.dispatchEvent({type:"drawstart",feature:this.getFeature()}),this._drawing=!0}finishDrawing(e){var t=this.getSource().getFeatures()[2].clone(),i=!!t;switch(this.getGeometryType()){case"Circle":case"LineString":i=this._geom.length>1;break;case"Polygon":i=this._geom.length>2}return!(e&&!i)&&(this._geom=[],this._lastCoord=null,this.drawSketch(),this._drawing&&this.dispatchEvent({type:"drawend",valid:i,feature:t}),this._drawing=!1,t)}abortDrawing(){this._drawing&&this.dispatchEvent({type:"drawabort",feature:this.getFeature()}),this._drawing=!1,this._geom=[],this._lastCoord=null,this.drawSketch()}setPosition(e){this._position=e,this.drawLink()}getPosition(){return this._position}drawLink(){var e=this.getSource().getFeatures();this._position?(this._lastCoord&&this._lastCoord===this._position?e[0].getGeometry().setCoordinates([]):e[0].getGeometry().setCoordinates(this._position),this._geom.length?"Circle"===this.getGeometryType()?e[1].setGeometry(new ol.geom.Circle(this._geom[0],ol.coordinate.dist2d(this._geom[0],this._position))):"Polygon"===this.getGeometryType()?e[1].setGeometry(new ol.geom.LineString([this._lastCoord,this._position,this._geom[0]])):e[1].setGeometry(new ol.geom.LineString([this._lastCoord,this._position])):e[1].setGeometry(new ol.geom.LineString([]))):(e[0].getGeometry().setCoordinates([]),e[1].setGeometry(new ol.geom.LineString([])))}getFeature(){return this.getSource().getFeatures()[2]}drawSketch(){this.drawLink();var e=this.getSource().getFeatures();if(this._geom.length)switch(this._lastCoord||(this._lastCoord=this._geom[this._geom.length-1]),e[3].getGeometry().setCoordinates(this._lastCoord),this._type){case"Point":e[2].setGeometry(new ol.geom.Point(this._lastCoord));break;case"Circle":e[2].getGeometry()?e[2].getGeometry().setRadius(ol.coordinate.dist2d(this._geom[0],this._geom[this._geom.length-1])):e[2].setGeometry(new ol.geom.Circle(this._geom[0],ol.coordinate.dist2d(this._geom[0],this._geom[this._geom.length-1])));break;case"LineString":e[2].getGeometry()?e[2].getGeometry().setCoordinates(this._geom):e[2].setGeometry(new ol.geom.LineString(this._geom));break;case"Polygon":this._geom.push(this._geom[0]),e[2].getGeometry()?e[2].getGeometry().setCoordinates([this._geom]):e[2].setGeometry(new ol.geom.Polygon([this._geom])),this._geom.pop();break;default:console.error("[ol/layer/SketchOverlay~drawSketch] geometry type not supported ("+this._type+")")}else e[2].setGeometry(null),e[3].setGeometry(new ol.geom.Point([]))}},ol.PerspectiveMap=class extends ol.Map{constructor(e){var t=e.target instanceof Element?e.target:document.getElementById(e.target);"absolute"!==window.getComputedStyle(t).position&&(t.style.position="relative"),t.style.overflow="hidden";var i=ol.ext.element.create("DIV",{className:"ol-perspective-map",parent:t}),o={};Object.assign(o,e),o.target=i,super(o),this._tiltCondition=e.tiltCondition||ol.events.condition.altKeyOnly}getPixelRatio(){return window.devicePixelRatio}setPerspective(e,t){t=t||{},e>30?e=30:e<0&&(e=0);var i=this._angle||0,o=Math.round(10*e)/10,s=this.getTarget().querySelector(".ol-layers").style;cancelAnimationFrame(this._animatedPerspective),requestAnimationFrame(function(e){this._animatePerpective(e,e,s,i,o,t.duration,t.easing||ol.easing.inAndOut)}.bind(this))}_animatePerpective(e,t,i,o,s,r,a){var n,l,h;0===r?(n=1,l=!0):l=(n=(t-e)/(r||500))>=1,n=a(n);var c=(h=this._angle=l?s:o+(s-o)*n)/30;i.transform="translateY(-"+17*c+"%) perspective(200px) rotateX("+h+"deg) scaleY("+(1-c/2)+")",this.getMatrix3D(!0),this.render(),l||requestAnimationFrame(function(t){this._animatePerpective(e,t,i,o,s,r||500,a||ol.easing.inAndOut)}.bind(this)),this.dispatchEvent({type:"change:perspective",angle:h,animating:!l})}handleMapBrowserEvent(e){if(e.pixel=[e.originalEvent.offsetX/this.getPixelRatio(),e.originalEvent.offsetY/this.getPixelRatio()],e.coordinate=this.getCoordinateFromPixel(e.pixel),ol.Map.prototype.handleMapBrowserEvent.call(this,e),this._tiltCondition(e))switch(e.type){case"pointerdown":this._dragging=e.originalEvent.offsetY;break;case"pointerup":this._dragging=!1;break;case"pointerdrag":if(!1!==this._dragging){var t=e.originalEvent.offsetY>this._dragging?.5:-.5;t&&this.setPerspective((this._angle||0)+t,{duration:0}),this._dragging=e.originalEvent.offsetY}}else this._dragging=!1}getMatrix3D(e){if(e){var t=this.getTarget().querySelector(".ol-layers"),i=ol.matrix3D.getTransform(t),o=ol.matrix3D.getTransformOrigin(t);this._matrixTransform=ol.matrix3D.computeTransformMatrix(i,o)}return this._matrixTransform||(this._matrixTransform=ol.matrix3D.identity()),this._matrixTransform}getPixelScreenFromCoordinate(e){var t=this.getPixelFromCoordinate(e),i=this.getMatrix3D(),o=ol.matrix3D.transformVertex(i,t);return[(o=ol.matrix3D.projectVertex(o))[0],o[1]]}getPixelFromPixelScreen(e){var t=ol.matrix3D.inverse(this.getMatrix3D()),i=ol.matrix3D.transformVertex(t,e);return[(i=ol.matrix3D.projectVertex(i))[0],i[1]]}},function(){var e=ol.Overlay.prototype.updatePixelPosition;ol.Overlay.prototype.updatePixelPosition=function(){var t=this.getMap();if(t&&t instanceof ol.PerspectiveMap){var i=this.getPosition();if(!t||!t.isRendered()||!i)return void this.setVisible(!1);var o=t.getPixelScreenFromCoordinate(i),s=t.getSize();o[0]-=s[0]/4,o[1]-=s[1]/4,this.updateRenderedPosition(o,s)}else e.call(this)}}(),ol.particule.Base=class extends ol.Object{constructor(e){super(e=e||{}),this.setOverlay(e.overlay),this.coordinate=e.coordinate||[0,0]}setOverlay(e){this._overlay=e}getOverlay(){return this._overlay}draw(){}update(){}getRandomCoord(e){return this.getOverlay().randomCoord?this.getOverlay().randomCoord():[e,0]}},ol.particule.Bird=class extends ol.particule.Base{constructor(e){super(e=e||{}),this.bird=new Image,this.bird.addEventListener("load",function(){this.set("size",[this.bird.width||50,this.bird.height||50]),console.log(this.bird.width,this.bird.height)}.bind(this)),this.bird.src=e.src||"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAABDCAQAAAD+S8VaAAAAAnNCSVQICFXsRgQAAAAJcEhZcwAAAvMAAALzAdLpCioAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAG90lEQVR42uWaaVRTRxTHJ4AUUIoIiqISOArIDiIhBBfccCMoR0vVUpXjTqun4Fr1tO5i3YuodaFqRMECKm4VUHEhUvWgBYuilgpiRVZpCARI3r8fWA4hYY9AXu77+ObNzO/O8u787xDSyeYSTzSICpu+DjV0ogrze84PBneByuJv3JpbBlx6MEBbJfG/8S2RAACFXXtU0gERN1BjCc9UEN/e7I2w1gFPinv3UDkHbFiGOqOwJVjlHMALRT3LLJ7trGIOuHwFUsY7q2IOuJ0u7YB//pswWFn6/vnUcbOCAn7ctfnUrsijl85dv5pw786fd9OTsvg5/JykN3fTb6ZcTDgVvefIkqXmVvKr0NN/IUQDO7C1qwJrOwyftIZ7cmIiN21eZlB+SOUtFKNl9kF0hb9ujmyVM73FMmWv3m+2J4zxw74NDN5/5vT1qzeT7j3n5/Bz7mcmPk24cy32Ai8i9Pj2nwIX+jo4kc8UMMqeXr5bfC6N/2tUHrdsCQ4gAR/QNhNRJ8+6GklXH7xStlxW+ViLxrpjqBswJ/z4rYyCFrQnwJPCxGe/x53i+fO+XOth2xpsvQm+PkfGP3YuYIo1oInTyIJiLDFtoZfUP+AXeaW2rZHXKZ8xJ35NeU+1odVSbIIBbEQeb70Tffd6ckmj0QbDy9/zOufdILE6SN0TBkVafnn0ka/NatrrditDXpmYKw36pREwPyr+Y0V72n0CsxoedTDFrMJJyRMDZJYIx8+yYICQKbDJtcjtL9IGAcEMKN7efIy+snnTYv/tR8Ry3+eWRUYFzavRB9SWL7icXKWAVrPRr96wEqjBTjg5bop03GGi77XF85FdqVZNIQ1konOsEvx35yOCN1xMFimszjNSDqh+ektGfVG3xjyTzaqkX3uDTiaCdh0ZA/qSgWXWWfb7CYMQQsiUUANK1j8hoJf1lSFUg0u+z1xCiFuMUYWsAy7QCj9ZzhIgIDCkpi4nhBCGsafNGx2peXCQRvhlcGrEAQSOhYQQQtyTG74YCglN8CswrVF8goEVhBBCrMzdozi33OOHJmvUvQqghQtKMEUu+GDB0Cj2Q/vsUdJn0JH8+oXG4rWS46djSD0ePcr2lUuafbZlIbN0UAnngpyA0I3FumeZxxQYVlZ/ooWleKm0+FHQbTDuWnAp5F6cbNfskcDtcg9J9aMGNUxDIiglgy+CPxhypj4Ddu/cfFpxOrIqrv7QAsH4V2nwYxoEvwQEOpRlAeeG07hWnopH7FMHgTr6VmhAA1xEQNjF4bMxQwpcj2I9duVZLiVtTb7YT7T2I30JccyqrrA7ZuESRF0SvhQ/QKfByDu/VZAs5O6rXS9U6onZ+A2CLgQvwWn0l5n4TAFnjOKksR5En6i73q6/q3IRhvwugB8LBylwi6IhixxX9Wd/CoWQwTrJTuaEOSwzENcKDR7Yj4xOg4+Hq3SEXzX8fIfcObAZPizV+bGxqLZhMyxBWgdP+xi4ScGbCNnhhrodqxnrso65pLidNxMQENihqoPgS3AY5rU7krh35eCPbon2c4hap2nnxob2GQQE+zpAM4qFb53EoUWxE3t93jXyBwyXcG1KD+8/IXwBAmFYg26Vx37oHjnIlnQlGzbJvMCX+lQrPgT6dat9yAcT/S6aSOIs2rjjxLaQ9SsX83gv8uShiNuAn4mR9fZ5dizpphRpREvj1YvOhiU84OdmoghFyKH47y/GHohtLf45ITvVuLyfyKLI5RlntyJSXx2+P+gaejt5O7FNCSEkcFHTuAmPom6/qqxJqFRee33wHGc6rVLjXtym8C8nTTcnDNMh/n5BfnN8mFY18jWdbPlceeBViEsPi16xxFSL7ncjukVelTvxUzsxjOlAUzsULv8/GfdEJa7G7D7YWLCcUzbNkfb42zaXNaG2h4XTHH/n9x+bjIHKqeAdNMZf55fbrKBYLNq+lqb433lkFrUk5hNKdu6mIf5XA1KetzibR+09TLcfonrMtVYlNKk9h2gV//FCW3tCFmMXT0nOe83bxpklbdDJqrD+BC1mwUzTtOw2Sl/UFjpsh8ci2pHirFgxV8nxV/oJxO2RwR6+HNFbmfkZ15PaqwQe/VmJ+R18Aql37XTAsQ9EefUBW6NeEk34IaWN8HkIQk+Jva0SzwGXP6p1XDeEoqB1qx/L0B3dKY+VSr0JDurDFNaK2ZoYg5142sx1m3LEYxUsq+Vv8ejVSv8bdJ/UXySds9eDB4JwEnFIRS6KUIi/8RJxCEEARte74GBR6DycFpGgtZNFPkHrHgOx61miSaPDEOtEn8qWwvepZMc5Mel3ItZmHbbM12wSXV/snMHZQ6eRlzEzI9d9rnftskwERhXVNxF7ik1Krd87pbLCbWYR9Y7v0f/htaJHbsoDhwAAAABJRU5ErkJggg==",this.set("size",[this.bird.width||50,this.bird.height||50])}draw(e){var t=this.getOverlay().get("angle");e.save(),e.translate(this.coordinate[0],this.coordinate[1]),e.rotate(t+Math.PI/2),e.scale(.5,.5),e.drawImage(this.bird,-this.bird.width/2,-this.bird.height/2),e.restore()}update(e){var t=this.getOverlay().get("speed")*e/this.getOverlay()._fps,i=this.getOverlay().get("angle");this.coordinate[0]+=t*Math.cos(i),this.coordinate[1]+=t*Math.sin(i)}},ol.particule.Cloud=class extends ol.particule.Base{constructor(e){super(e=e||{}),this.set("size",[100,100]);var t=document.createElement("CANVAS");t.width=200,t.height=200;var i=t.getContext("2d"),o=this.gradient=i.createRadialGradient(50,50,0,50,50,50);o.addColorStop(0,"rgba(255,255,255,.2"),o.addColorStop(1,"rgba(255,255,255,0"),this.image=t;for(var s=0;s<7;s++){i.save();var r=100*Math.random(),a=100*Math.random();i.translate(r,a),i.fillStyle=o,i.fillRect(0,0,t.width,t.height),i.restore()}}draw(e){e.save(),e.translate(this.coordinate[0],this.coordinate[1]),e.drawImage(this.image,-this.image.width/2,-this.image.width/2),e.restore()}update(e){var t=this.getOverlay().get("speed")*e/this.getOverlay()._fps,i=this.getOverlay().get("angle");this.coordinate[0]+=t*Math.cos(i),this.coordinate[1]+=t*Math.sin(i)}},ol.particule.Rain=class extends ol.particule.Base{constructor(e){super(e=e||{}),this.z=Math.floor(5*Math.random())+1;var t=document.createElement("CANVAS");t.width=50,t.height=50;var i=t.getContext("2d");this.gradient=i.createRadialGradient(0,0,0,0,0,25),this.gradient.addColorStop(0,"rgba(0,0,80,0)"),this.gradient.addColorStop(1,"rgba(0,0,80,.3)")}draw(e){e.save();var t=this.getOverlay().get("angle");e.beginPath();var i=10*Math.cos(t)*(1+this.z/2),o=10*Math.sin(t)*(1+this.z/2);e.lineWidth=Math.round(this.z/2),e.strokeStyle=this.gradient,e.translate(this.coordinate[0],this.coordinate[1]),e.moveTo(0,0),e.lineTo(i,o),e.stroke(),e.restore()}update(e){var t=this.getOverlay().get("speed")*e/this.getOverlay()._fps*this.z,i=this.getOverlay().get("angle");this.coordinate[0]+=t*Math.cos(i),this.coordinate[1]+=t*Math.sin(i)}},ol.particule.RainDrop=class extends ol.particule.Base{constructor(e){super(e=e||{}),this.size=0;var t=document.createElement("CANVAS");t.width=100,t.height=100;var i=t.getContext("2d"),o=i.createRadialGradient(50,50,0,50,50,50);o.addColorStop(0,"rgba(128,128,192,.8"),o.addColorStop(1,"rgba(128,128,192,0"),this.image=t,i.fillStyle=o,i.fillRect(0,0,t.width,t.height)}draw(e){this.size>0&&(e.save(),e.translate(this.coordinate[0],this.coordinate[1]),e.globalAlpha=this.size/50,e.scale(1-this.size/50,1-this.size/50),e.drawImage(this.image,-50,-50),e.restore())}update(e){(this.size>0||Math.random()<.01)&&(this.size<=0&&(this.size=50,this.coordinates=this.getRandomCoord()),this.size=this.size-Math.round(e/20))}},ol.particule.Snow=class extends ol.particule.Base{constructor(e){super(e=e||{}),this.z=(Math.floor(5*Math.random())+1)/5,this.angle=Math.random()*Math.PI;var t=document.createElement("CANVAS");t.width=20,t.height=20;var i=t.getContext("2d"),o=i.createRadialGradient(10,10,0,10,10,10);o.addColorStop(0,"rgba(255, 255, 255,1)"),o.addColorStop(.8,"rgba(210, 236, 242,.8)"),o.addColorStop(1,"rgba(237, 247, 249,0)"),this.image=t,i.fillStyle=o,i.fillRect(0,0,t.width,t.height)}draw(e){e.save(),e.translate(this.coordinate[0],this.coordinate[1]),e.globalAlpha=.4+this.z/2,e.scale(this.z,this.z),e.drawImage(this.image,-10,-10),e.restore()}update(e){var t=this.getOverlay().get("speed")*e/this.getOverlay()._fps*this.z*5,i=this.getOverlay().get("angle");this.angle=this.angle+e/this.getOverlay()._fps/100,this.coordinate[0]+=2*Math.sin(this.angle+this.z)+t*Math.cos(i),this.coordinate[1]+=Math.cos(this.angle)+t*Math.sin(i)}},ol.Overlay.Popup=class extends ol.Overlay{constructor(e){e=e||{};var t=document.createElement("div");e.element=t,super(e),"number"==typeof e.offsetBox?this.offsetBox=[e.offsetBox,e.offsetBox,e.offsetBox,e.offsetBox]:this.offsetBox=e.offsetBox,this.closeBox=e.closeBox,this.onclose=e.onclose,this.onshow=e.onshow,ol.ext.element.create("BUTTON",{className:"closeBox"+(e.closeBox?" hasclosebox":""),type:"button",click:function(){this.hide()}.bind(this),parent:t}),!1!==e.anchor&&ol.ext.element.create("DIV",{className:"anchor",parent:t}),this.content=ol.ext.element.create("DIV",{html:e.html||"",className:"ol-popup-content",parent:t}),e.minibar&&ol.ext.element.scrollDiv(this.content,{vertical:!0,mousewheel:!0,minibar:!0}),e.stopEvent&&(t.addEventListener("mousedown",function(e){e.stopPropagation()}),t.addEventListener("touchstart",function(e){e.stopPropagation()})),this._elt=t,this.setPositioning(e.positioning||"auto"),this.setPopupClass(e.popupClass||e.className||"default"),e.anim&&this.addPopupClass("anim"),e.position&&setTimeout(function(){this.show(e.position)}.bind(this))}getClassPositioning(){var e="",t=this.getPositioning();return/bottom/.test(t)&&(e+="ol-popup-bottom "),/top/.test(t)&&(e+="ol-popup-top "),/left/.test(t)&&(e+="ol-popup-left "),/right/.test(t)&&(e+="ol-popup-right "),/^center/.test(t)&&(e+="ol-popup-middle "),/center$/.test(t)&&(e+="ol-popup-center "),e}setClosebox(e){this.closeBox=e,e?this.element.classList.add("hasclosebox"):this.element.classList.remove("hasclosebox")}setPopupClass(e){var t=["ol-popup"];this.getVisible()&&t.push("visible"),this.element.className="";var i=this.getClassPositioning().split(" ").filter(function(e){return e.length>0});e?e.split(" ").filter(function(e){return e.length>0}).forEach(function(e){t.push(e)}):t.push("default"),i.forEach(function(e){t.push(e)}),this.closeBox&&t.push("hasclosebox"),this.element.classList.add.apply(this.element.classList,t)}addPopupClass(e){this.element.classList.add(e)}removePopupClass(e){this.element.classList.remove(e)}setPositioning(e){void 0!==e&&(/auto/.test(e)?(this.autoPositioning=e.split("-"),1==this.autoPositioning.length&&(this.autoPositioning[1]="auto")):this.autoPositioning=!1,"center"==(e=e.replace(/auto/g,"center"))&&(e="bottom-center"),this.setPositioning_(e))}setPositioning_(e){if(this.element){super.setPositioning(e),this.element.classList.remove("ol-popup-top","ol-popup-bottom","ol-popup-left","ol-popup-right","ol-popup-center","ol-popup-middle");var t=this.getClassPositioning().split(" ").filter(function(e){return e.length>0});this.element.classList.add.apply(this.element.classList,t)}}getVisible(){return this.element.classList.contains("visible")}show(e,t){t||"string"!=typeof e||(t=e,e=null),!0===e&&(e=this.getPosition());var i=this,o=this.getMap();if(o&&(t&&t!==this.prevHTML&&(this.prevHTML=t,this.content.innerHTML="",t instanceof Element?this.content.appendChild(t):ol.ext.element.create("DIV",{html:t,parent:this.content}),Array.prototype.slice.call(this.content.querySelectorAll("img")).forEach(function(e){e.addEventListener("load",function(){try{o.renderSync()}catch(e){}i.content.dispatchEvent(new Event("scroll"))})})),e)){if(this.autoPositioning){var s=o.getPixelFromCoordinate(e),r=o.getSize(),a=[];"auto"==this.autoPositioning[0]?a[0]=s[1]this._particules.length)for(var o=this._particules.length;othis._canvas.width+t[0]?(e.coordinate[0]=-t[0],e.coordinate[1]=Math.random()*(this._canvas.height+t[1])-t[1]/2):e.coordinate[1]<-t[1]?(e.coordinate[0]=Math.random()*(this._canvas.width+t[0])-t[0]/2,e.coordinate[1]=this._canvas.height+t[1]):e.coordinate[1]>this._canvas.height+t[1]&&(e.coordinate[0]=Math.random()*(this._canvas.width+t[0])-t[0]/2,e.coordinate[1]=-t[1])}clear(){this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height)}getCanvas(){return this._canvas}setAnimation(e){e=!1!==e,this.set("animation",e),e?(this._pause=!0,requestAnimationFrame(this._animate.bind(this))):this.dispatchEvent({type:"animation:stop",time:this._time})}_animate(e){this.getVisible()&&this.get("animation")&&(this._pause?requestAnimationFrame(function(e){this._time=e,requestAnimationFrame(this._animate.bind(this))}.bind(this)):(e-this._time>this._fps&&(this.draw(e-this._time),this._time=e),requestAnimationFrame(this._animate.bind(this)))),this._pause=!1}},ol.Overlay.Fixed=class extends ol.Overlay{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(1e3*e[0])===Math.round(1e3*this._pixel[0])&&Math.round(1e3*e[0])===Math.round(1e3*this._pixel[0])||this.setPosition(this.getMap().getCoordinateFromPixel(this._pixel))}}},ol.Overlay.FixedPopup=class extends ol.Overlay.Popup{constructor(e){e.anchor=!1,e.positioning=e.positioning||"center-center",e.className=(e.className||"")+" ol-fixPopup",super(e),this.set("minScale",e.minScale||.5),this.set("maxScale",e.maxScale||2);var t=document.createElement("canvas");this._overlay=new ol.layer.Image({source:new ol.source.ImageCanvas({canvasFunction:function(e,i,o,s){return t.width=s[0],t.height=s[1],t}})}),this._style=e.style||new ol.style.Style({fill:new ol.style.Fill({color:[102,153,255]})}),this._overlay.on(["postcompose","postrender"],function(e){if(this.getVisible()&&this._pixel){var t=this.getMap(),i=this.getPosition(),o=t.getPixelFromCoordinate(i),s=this.element.getBoundingClientRect(),r=this.getMap().getTargetElement().getBoundingClientRect(),a=[s.left-r.left+s.width/2,s.top-r.top+s.height/2];e.context.save();var n=e.inversePixelTransform;n?e.context.transform(n[0],n[1],n[2],n[3],n[4],n[5]):e.context.scale(e.frameState.pixelRatio,e.frameState.pixelRatio),e.context.beginPath(),e.context.moveTo(o[0],o[1]),Math.abs(a[0]-o[0])>Math.abs(a[1]-o[1])?(e.context.lineTo(a[0],a[1]-8),e.context.lineTo(a[0],a[1]+8)):(e.context.lineTo(a[0]-8,a[1]),e.context.lineTo(a[0]+8,a[1])),e.context.moveTo(o[0],o[1]),this._style.getFill()&&(e.context.fillStyle=ol.color.asString(this._style.getFill().getColor()),e.context.fill()),this._style.getStroke()&&(e.context.strokeStyle=ol.color.asString(this._style.getStroke().getColor()),e.context.lineWidth=this._style.getStroke().width(),e.context.stroke()),e.context.restore()}}.bind(this));var i=function(){this.setPixelPosition()}.bind(this);function o(e){var t=0,i=0,o=0;for(var s in e)t+=e[s].clientX,i+=e[s].clientY,o++;return[t/o,i/o]}function s(e){var t=Object.keys(e);return!(t.length<2)&&ol.coordinate.dist2d([e[t[0]].clientX,e[t[0]].clientY],[e[t[1]].clientX,e[t[1]].clientY])}this.on(["hide","show"],function(){setTimeout(i)}.bind(this));var r,a,n,l,h={},c={},u=[];this.element.addEventListener("pointerdown",function(e){for(var t in e.preventDefault(),e.stopPropagation(),h)c[t]&&(h[t]=c[t]);h[e.pointerId]=e,u=this._pixel,a=this.get("rotation")||0,n=this.get("scale")||1,r=s(h),l=!1}.bind(this)),this.element.addEventListener("click",function(e){l&&(e.preventDefault(),e.stopPropagation())},!0);var d=function(e){h[e.pointerId]&&(delete h[e.pointerId],e.preventDefault()),c[e.pointerId]&&delete c[e.pointerId]}.bind(this);document.addEventListener("pointerup",d),document.addEventListener("pointercancel",d),document.addEventListener("pointermove",function(e){if(h[e.pointerId]){e.preventDefault(),c[e.pointerId]=e;var t=o(h),i=o(c),d=i[0]-t[0],g=i[1]-t[1];l=l||Math.abs(d)>3||Math.abs(g)>3;var p=function(){var e,t,i=Object.keys(h);if(i.length<2)return!1;e=h[i[0]];var o=[(t=h[i[1]]).clientX-e.clientX,t.clientY-e.clientY];e=c[i[0]];var s=[(t=c[i[1]]).clientX-e.clientX,t.clientY-e.clientY],r=Math.sqrt(o[0]*o[0]+o[1]*o[1]),a=Math.sqrt(s[0]*s[0]+s[1]*s[1]),n=360*Math.acos((o[0]*s[0]+o[1]*s[1])/(r*a))/Math.PI;return o[0]*s[1]-o[1]*s[0]<0?-n:n}();p&&this.setRotation(a+1.5*p,!1);var m=s(c);!1!==m&&r&&(this.setScale(n*m/r,!1),r=n*m/this.get("scale")),this.setPixelPosition([u[0]+d,u[1]+g])}}.bind(this))}setMap(e){super.setMap(e),this._overlay.setMap(this.getMap()),this._listener&&ol.Observable.unByKey(this._listener),e&&(this._listener=e.on("change:size",function(){this.setPixelPosition()}.bind(this)))}updatePixelPosition(){var e=this.getMap(),t=this.getPosition();if(e&&e.isRendered()&&t)if(this._pixel)this.setVisible(!0);else{this._pixel=e.getPixelFromCoordinate(t);var i=e.getSize();this.updateRenderedPosition(this._pixel,i)}else this.setVisible(!1)}updateRenderedPosition(e,t){super.updateRenderedPosition(e,t),this.setRotation(),this.setScale()}setPixelPosition(e,t){var i,o=this.getMap(),s=o?o.getSize():[0,0];if(t&&(this.setPositioning(t),(i=ol.ext.element.offsetRect(this.element)).width=i.height=0,/top/.test(t)?e[1]+=i.height/2:/bottom/.test(t)?e[1]=s[1]-i.height/2-e[1]:e[1]=s[1]/2+e[1],/left/.test(t)?e[0]+=i.width/2:/right/.test(t)?e[0]=s[0]-i.width/2-e[0]:e[0]=s[0]/2+e[0]),e&&(this._pixel=e),o&&o.getTargetElement()&&this._pixel){this.updateRenderedPosition(this._pixel,s);var r=!1;i=ol.ext.element.offsetRect(this.element);var a=ol.ext.element.offsetRect(o.getTargetElement());i.lefta.left+a.width&&(this._pixel[0]=this._pixel[0]+a.left-i.left+a.width-i.width,r=!0),i.topa.top+a.height&&(this._pixel[1]=this._pixel[1]+a.top-i.top+a.height-i.height,r=!0),r&&this.updateRenderedPosition(this._pixel,s),this._overlay.changed()}}getPixelPosition(){return this._pixel}setPopupClass(e){super.setPopupClass(e),this.addPopupClass("ol-fixPopup")}setRotation(e,t){"number"==typeof e&&this.set("rotation",e),!1!==t&&(/rotate/.test(this.element.style.transform)?this.element.style.transform=this.element.style.transform.replace(/rotate\((-?[\d,.]+)deg\)/,"rotate("+(this.get("rotation")||0)+"deg)"):this.element.style.transform=this.element.style.transform+" rotate("+(this.get("rotation")||0)+"deg)")}setScale(e,t){"number"==typeof e&&this.set("scale",e),e=Math.min(Math.max(this.get("minScale")||0,this.get("scale")||1),this.get("maxScale")||2),this.set("scale",e),!1!==t&&(/scale/.test(this.element.style.transform)?this.element.style.transform=this.element.style.transform.replace(/scale\(([\d,.]+)\)/,"scale("+e+")"):this.element.style.transform=this.element.style.transform+" scale("+e+")")}setLinkStyle(e){this._style=e,this._overlay.changed()}getLinkStyle(){return this._style}},ol.Overlay.Magnify=class extends ol.Overlay{constructor(e){var t=document.createElement("div");t.className="ol-magnify",super({positioning:e.positioning||"center-center",element:t,stopEvent:!1}),this._elt=t,this.mgmap_=new ol.Map({controls:new ol.Collection,interactions:new ol.Collection,target:e.target||this._elt,view:new ol.View({projection:e.projection}),layers:e.layers}),this.mgview_=this.mgmap_.getView(),this.external_=!!e.target,this.set("zoomOffset",e.zoomOffset||1),this.set("active",!0),this.on("propertychange",this.setView_.bind(this))}setMap(e){this.getMap()&&this.getMap().getViewport().removeEventListener("mousemove",this.onMouseMove_),this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,super.setMap(e),e.getViewport().addEventListener("mousemove",this.onMouseMove_.bind(this)),this._listener=e.getView().on("propertychange",this.setView_.bind(this)),this.setView_()}getMagMap(){return this.mgmap_}getActive(){return this.get("active")}setActive(e){return this.set("active",e)}onMouseMove_(e){if(this.get("active")){var t=this.getMap().getEventCoordinate(e);this.external_||this.setPosition(t),this.mgview_.setCenter(t),this._elt.querySelector("canvas")&&"none"!=this._elt.querySelector("canvas").style.display||this.mgmap_.updateSize()}else this.setPosition()}setView_(e){if(this.get("active")){if(!e)return this.setView_({key:"rotation"}),void this.setView_({key:"resolution"});switch(e.key){case"rotation":this.mgview_.setRotation(this.getMap().getView().getRotation());break;case"zoomOffset":case"resolution":var t=Math.max(0,this.getMap().getView().getZoom()+Number(this.get("zoomOffset")));this.mgview_.setZoom(t)}}else this.setPosition()}},ol.Overlay.Placemark=class extends ol.Overlay.Popup{constructor(e){(e=e||{}).popupClass=(e.popupClass||"")+" placemark anim",e.positioning="bottom-center",super(e),this.setPositioning=function(){},e.color&&(this.element.style.color=e.color),e.backgroundColor&&(this.element.style.backgroundColor=e.backgroundColor),e.contentColor&&this.setContentColor(e.contentColor),e.size&&this.setRadius(e.size)}show(e,t){!0===e&&(e=this.getPosition()),this.hide(),super.show(e,t)}setColor(e){this.element.style.color=e}setBackgroundColor(e){this._elt.style.backgroundColor=e}setContentColor(e){var t=this.element.getElementsByClassName("ol-popup-content")[0];t&&(t.style.color=e)}setClassName(e){var t=this.element.className;this.element.className="ol-popup placemark ol-popup-bottom ol-popup-center "+(/visible/.test(t)?"visible ":"")+(/anim/.test(t)?"anim ":"")+e}setRadius(e){this.element.style.fontSize=e+"px"}},ol.Overlay.PopupFeature=class extends ol.Overlay.Popup{constructor(e){super(e=e||{}),this.setTemplate(e.template),this.set("canFix",e.canFix),this.set("showImage",e.showImage),this.set("maxChar",e.maxChar||200),this.set("keepSelection",e.keepSelection),e.select&&"function"==typeof e.select.on&&(this._select=e.select,e.select.on("select",function(t){this._noselect||(t.selected[0]?this.show(t.mapBrowserEvent.coordinate,e.select.getFeatures().getArray(),t.selected[0]):this.hide())}.bind(this)))}setTemplate(e){e||(e=function(e){var t=e.getProperties();return delete t[e.getGeometryName()],{attributes:Object.keys(t)}}),this._template=e,this._attributeObject(this._template)}_attributeObject(e){if(e&&e.attributes instanceof Array){var t={};e.attributes.forEach(function(e){t[e]=!0}),e.attributes=t}return e.attributes}show(e,t,i){(e instanceof ol.Feature||e instanceof Array&&e[0]instanceof ol.Feature)&&(t=e,e=null),t instanceof Array||(t=[t]),this._features=t.slice(),this._count||(this._count=1),this._count=1;var o=this.get("keepSelection")&&i||t[0],s=this._getHtml(o);s?(this.element.classList.contains("ol-fixed")||this.hide(),e&&"Point"!==t[0].getGeometry().getType()||(e=t[0].getGeometry().getFirstCoordinate()),super.show(e,s)):this.hide()}_getHtml(e){if(!e)return"";var t=ol.ext.element.create("DIV",{className:"ol-popupfeature"});this.get("canFix")&&ol.ext.element.create("I",{className:"ol-fix",parent:t}).addEventListener("click",function(){this.element.classList.toggle("ol-fixed")}.bind(this));var i,o=this._template;if("function"==typeof o)o=o(e,this._count,this._features.length);else if(!o||!o.attributes)for(var s in(o=o||{}).attributes={},e.getProperties())"geometry"!=s&&(o.attributes[s]=s);o.title&&(i="function"==typeof o.title?o.title(e):e.get(o.title),ol.ext.element.create("H1",{html:i,parent:t}));if(o.attributes){var r,a=ol.ext.element.create("TABLE",{parent:t}),n=this._attributeObject(o),l=e.getProperties();for(var h in n)if(l.hasOwnProperty(h)){var c,u=n[h],d=l[h];u&&"function"==typeof u.format&&(d=u.format(d,e));var g=!0;if(u&&"boolean"==typeof u.visible?g=u.visible:u&&"function"==typeof u.visible&&(g=u.visible(e,d)),g){if(r=ol.ext.element.create("TR",{parent:a}),ol.ext.element.create("TD",{html:u&&u.title||h,parent:r}),this.get("showImage")&&/(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|gif|png)/.test(d))c=ol.ext.element.create("IMG",{src:d});else{c=u?(u.before||"")+d+(u.after||""):"";var p=this.get("maxChar")||200;"string"==typeof c&&c.length>p&&(c=c.substr(0,p)+"[...]")}ol.ext.element.create("TD",{html:c,parent:r})}}}if(ol.ext.element.create("BUTTON",{className:"ol-zoombt",parent:t}).addEventListener("click",function(){if("Point"===e.getGeometry().getType())this.getMap().getView().animate({center:e.getGeometry().getFirstCoordinate(),zoom:Math.max(this.getMap().getView().getZoom(),18)});else{var t=e.getGeometry().getExtent();this.getMap().getView().fit(t,{duration:1e3})}}.bind(this)),!this.get("keepSelection")&&this._features.length>1){var m=ol.ext.element.create("DIV",{className:"ol-count",parent:t});ol.ext.element.create("DIV",{className:"ol-prev",parent:m,click:function(){this._count--,this._count<1&&(this._count=this._features.length),t=this._getHtml(this._features[this._count-1]),setTimeout(function(){ol.Overlay.Popup.prototype.show.call(this,this.getPosition(),t)}.bind(this),350)}.bind(this)}),ol.ext.element.create("TEXT",{html:this._count+"/"+this._features.length,parent:m}),ol.ext.element.create("DIV",{className:"ol-next",parent:m,click:function(){this._count++,this._count>this._features.length&&(this._count=1),t=this._getHtml(this._features[this._count-1]),setTimeout(function(){ol.Overlay.Popup.prototype.show.call(this,this.getPosition(),t)}.bind(this),350)}.bind(this)})}return this._select&&!this.get("keepSelection")&&(this._noselect=!0,this._select.getFeatures().clear(),this._select.getFeatures().push(e),this._noselect=!1),this.dispatchEvent({type:"select",feature:e,index:this._count}),t}setFix(e){e?this.element.classList.add("ol-fixed"):this.element.classList.remove("ol-fixed")}getFix(){return this.element.classList.contains("ol-fixed")}},ol.Overlay.PopupFeature.localString=function(e,t){return function(i){if(i&&i.toLocaleString)return i.toLocaleString(e,t);var o=new Date(i);return isNaN(o)?i:o.toLocaleString(e,t)}},ol.Overlay.Tooltip=class extends ol.Overlay.Popup{constructor(e){(e=e||{}).popupClass=e.popupClass||e.className||"tooltips black",e.positioning=e.positioning||"center-left",e.stopEvent=!!e.stopEvent,super(e),this.set("maximumFractionDigits",e.maximumFractionDigits||2),"function"==typeof e.formatLength&&(this.formatLength=e.formatLength),"function"==typeof e.formatArea&&(this.formatArea=e.formatArea),"function"==typeof e.getHTML&&(this.getHTML=e.getHTML),this._interaction=new ol.interaction.Interaction({handleEvent:function(e){if("pointermove"===e.type||"click"===e.type){var t=this.getHTML(this._feature,this.get("info"));t?this.show(e.coordinate,t):this.hide(),this._coord=e.coordinate}return!0}.bind(this)})}setMap(e){this.getMap()&&this.getMap().removeInteraction(this._interaction),super.setMap(e),this.getMap()&&this.getMap().addInteraction(this._interaction)}getHTML(e,t){return this.get("measure")?this.get("measure")+(t?"
"+t:""):t||""}setInfo(e){e?setTimeout(function(){this.set("info",e),this.show(this._coord,this.get("info"))}.bind(this)):(this.set("info",""),this.hide())}removeFeature(){this.setFeature()}formatArea(e){return e>Math.pow(10,-1*this.get("maximumFractionDigits"))?e>1e4?(e/1e6).toLocaleString(void 0,{maximumFractionDigits:this.get("maximumFractionDigits)")})+" km²":e.toLocaleString(void 0,{maximumFractionDigits:this.get("maximumFractionDigits")})+" m²":""}formatLength(e){return e>Math.pow(10,-1*this.get("maximumFractionDigits"))?e>100?(e/1e3).toLocaleString(void 0,{maximumFractionDigits:this.get("maximumFractionDigits")})+" km":e.toLocaleString(void 0,{maximumFractionDigits:this.get("maximumFractionDigits")})+" m":""}setFeature(e){e&&e.feature&&(e=e.feature),this._feature=e,this._listener&&this._listener.forEach(function(e){ol.Observable.unByKey(e)}),this._listener=[],this.set("measure",""),e&&this._listener.push(e.getGeometry().on("change",function(e){var t,i=e.target;i.getArea?t=this.formatArea(ol.sphere.getArea(i,{projection:this.getMap().getView().getProjection()})):i.getLength&&(t=this.formatLength(ol.sphere.getLength(i,{projection:this.getMap().getView().getProjection()}))),this.set("measure",t)}.bind(this)))}},ol.coordinate.convexHull,function(){var e=function(e,t,i){return(e[0]-i[0])*(t[1]-i[1])-(e[1]-i[1])*(t[0]-i[0])<=0};ol.coordinate.convexHull=function(t){var i;t.sort(function(e,t){return e[0]==t[0]?e[1]-t[1]:e[0]-t[0]});var o=[];for(i=0;i=2&&e(o[o.length-2],o[o.length-1],t[i]);)o.pop();o.push(t[i])}var s=[];for(i=t.length-1;i>=0;i--){for(;s.length>=2&&e(s[s.length-2],s[s.length-1],t[i]);)s.pop();s.push(t[i])}return s.pop(),o.pop(),o.concat(s)};var t=function(e){var i,o,s=[];switch(e.getType()){case"Point":s.push(e.getCoordinates());break;case"LineString":case"LinearRing":case"MultiPoint":s=e.getCoordinates();break;case"MultiLineString":for(o=e.getLineStrings(),i=0;i1?".1":".4":n>2?l>1?".2":".3":l>2?n<2?".1":".2":l<1?n<2?".4":".3":".5"},ol.coordinate.fromDFCI=function(e,t){var i,o=1e5,s=e.charCodeAt(0)-65;s=(s<8?s:s-2)*o;var r=e.charCodeAt(1)-65;if(r=(r<8?r:r-2)*o+15e5,2===e.length)i=[s+o/2,r+o/2];else if(o/=5,s+=Number(e.charAt(2))/2*o,r+=Number(e.charAt(3))/2*o,4===e.length)i=[s+o/2,r+o/2];else{o/=10;var a=e.charCodeAt(4)-65;if(s+=(a<8?a:a-2)*o,r+=Number(e.charAt(5))*o,6===e.length)i=[s+o/2,r+o/2];else switch(e.charAt(7)){case"1":i=[s+o/4,r+3*o/4];break;case"2":i=[s+3*o/4,r+3*o/4];break;case"3":i=[s+3*o/4,r+o/4];break;case"4":i=[s+o/4,r+o/4];break;default:i=[s+o/2,r+o/2]}}return t&&(ol.proj.get("EPSG:27572")||(proj4.defs["EPSG:27572"]||proj4.defs("EPSG:27572","+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs"),ol.proj.proj4.register(proj4)),i=ol.proj.transform(i,"EPSG:27572",t)),i},ol.coordinate.validDFCI=function(e){if(e.length<2||e.length>8)return!1;if(/[^A-H|^K-N]/.test(e.substr(0,1)))return!1;if(/[^B-H|^K-N]/.test(e.substr(1,1)))return!1;if(e.length>2){if(e.length<4)return!1;if(/[^0,^2,^4,^6,^8]/.test(e.substr(2,1)))return!1;if(/[^0,^2,^4,^6,^8]/.test(e.substr(3,1)))return!1}if(e.length>4){if(e.length<6)return!1;if(/[^A-H|^K-L]/.test(e.substr(4,1)))return!1;if(/[^0-9]/.test(e.substr(5,1)))return!1}if(e.length>6){if(e.length<8)return!1;if("."!==e.substr(6,1))return!1;if(/[^1-5]/.test(e.substr(7,1)))return!1}return!0},ol.coordinate.validDFCICoord=function(e,t){return t&&(ol.proj.get("EPSG:27572")||(proj4.defs["EPSG:27572"]||proj4.defs("EPSG:27572","+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs"),ol.proj.proj4.register(proj4)),e=ol.proj.transform(e,t,"EPSG:27572")),!(0>e[0]||e[0]>12e5)&&!(16e5>e[1]||e[1]>27e5)},ol.graph={},ol.graph.Dijkstra=class extends ol.Object{constructor(e){e=e||{},super(),this.source=e.source,this.nodes=new ol.source.Vector,this.maxIteration=e.maxIteration||2e4,this.stepIteration=e.stepIteration||2e3,this.astar=!0,this.candidat=[],this.set("epsilon",e.epsilon||1e-6)}weight(){return 1}direction(){return 2}getLength(e){return e.getGeometry&&(e=e.getGeometry()),e.getLength()}getNodeSource(){return this.nodes}getEdges(e){var t=ol.extent.buffer(ol.extent.boundingExtent([e]),this.get("epsilon")),i=[];return this.source.forEachFeatureIntersectingExtent(t,function(e){i.push(e)}),i}getNode(e){var t=ol.extent.buffer(ol.extent.boundingExtent([e]),this.get("epsilon")),i=[];return this.nodes.forEachFeatureIntersectingExtent(t,function(e){i.push(e)}),i[0]}addNode(e,t,i,o,s){if(this.wdist&&t>this.wdist)return!1;var r=this.getNode(e),a=t+this.getLength(new ol.geom.LineString([this.end,e]))*this.weight();if(this.astar&&this.wdist&&a>this.wdist)return!1;if(r){if(r!==this.arrival&&r.get("wdist")<=t)return r;r.set("dist",i),r.set("wdist",t),r.set("dtotal",a),r.set("from",o),r.set("prev",s),r===this.arrival&&(this.wdist=t),this.candidat.push(r)}else r=new ol.Feature({geometry:new ol.geom.Point(e),from:o,prev:s,dist:i||0,wdist:t,dtotal:a}),t<0?r.set("wdist",!1):this.candidat.push(r),this.nodes.addFeature(r);return r}closestCoordinate(e){var t=this.source.getClosestFeatureToCoordinate(e),i=t.getGeometry().getFirstCoordinate(),o=t.getGeometry().getLastCoordinate();return ol.coordinate.dist2d(e,i)i&&(e=t,i=t.get("wdist"));return this.getRoute(e)}_resume(){if(this.running){for(;this.candidat.length;){this.candidat.sort(function(e,t){return e.get("dtotal")this.maxIteration)return this.running=!1,void this.dispatchEvent({type:"pause",overflow:-1!==this.nb});if(!(this.nb%this.stepIteration)){var c=this;return window.setTimeout(function(){c._resume()},5),void this.dispatchEvent({type:"calculating"})}}}this.nodes.clear(),this.running=!1,this.dispatchEvent({type:"finish",route:this.getRoute(this.arrival),wDistance:this.wdist,distance:this.arrival.get("dist")})}}getRoute(e){for(var t=[];e;)t.unshift(e.get("from")),e=e.get("prev");return t.shift(),t}},ol.graph.Dijskra=ol.graph.Dijkstra,ol.geom.GPAltiCode=function(e,t){t=t||{};var i=e.getType();if("Point"===i||"LineString"===i){var o=t.projection||"EPSG:3857",s=t.sampling||0;if(t.samplingDist){var r=e.getLength();s=Math.max(s,Math.round(r/t.samplingDist))}s>5e3&&(s=5e3),s<2&&(s=0),e=e.clone().transform(o,"EPSG:4326");var a,n=[],l=[];switch(i){case"Point":a=[e.getCoordinates()];break;case"LineString":a=e.getCoordinates();break;default:return}s<=a.length&&(s=0),a.forEach(function(e){n.push(Math.round(1e6*e[0])/1e6),l.push(Math.round(1e6*e[1])/1e6)});var h="lon="+n.join("|")+"&lat="+l.join("|");s&&(h+="&sampling="+s),ol.ext.Ajax.get({url:"https://wxs.ign.fr/"+(t.apiKey||"essentiels")+"/alti/rest/"+(n.length>1?"elevationLine":"elevation")+".json?"+h,success:function(e){var r=[];e.elevations.forEach(function(e,t){s?r.push([e.lon,e.lat,e.z]):r.push([a[t][0],a[t][1],e.z])}),"Point"===i&&(r=r[0]);var n=ol.geom.createFromType(i,r);n.transform("EPSG:4326",o),"function"==typeof t.success&&t.success(n)},error:function(e){"function"==typeof t.error&&t.error(e)}})}else console.warn("[GPAltiCode] "+i+" not supported...")},ol.coordinate.GPAltiCode=function(e,t){t=t||{};var i=!e[0].length?new ol.geom.Point(e):new ol.geom.LineString(e);ol.geom.GPAltiCode(i,{projection:t.projection,apiKey:t.apiKey,sampling:t.sampling,samplingDist:t.samplingDist,success:function(e){"function"==typeof t.success&&t.success(e.getCoordinates())},error:t.error})},ol.coordinate.dist2d=function(e,t){var i=e[0]-t[0],o=e[1]-t[1];return Math.sqrt(i*i+o*o)},ol.coordinate.equal=function(e,t){return e[0]==t[0]&&e[1]==t[1]},ol.coordinate.getFeatureCenter=function(e){return ol.coordinate.getGeomCenter(e.getGeometry())},ol.coordinate.getGeomCenter=function(e){switch(e.getType()){case"Point":return e.getCoordinates();case"MultiPolygon":e=e.getPolygon(0);case"Polygon":return e.getInteriorPoint().getCoordinates();default:return e.getClosestPoint(ol.extent.getCenter(e.getExtent()))}},ol.coordinate.offsetCoords=function(e,t){var i,o,s,r,a,n,l,h,c,u,d,g,p,m=[],f=e.length-1,v=f,y=ol.coordinate.equal(e[0],e[f]);y||(d=e[0],g=e[1],p=[d[0]+(g[1]-d[1])/ol.coordinate.dist2d(d,g)*t,d[1]-(g[0]-d[0])/ol.coordinate.dist2d(d,g)*t],m.push(p),e.push(e[f]),f++,v--);for(var _=0;_1e-10&&(s=Math.sqrt((g[0]-d[0])*(g[0]-d[0])+(g[1]-d[1])*(g[1]-d[1])),r=Math.sqrt((p[0]-g[0])*(p[0]-g[0])+(p[1]-g[1])*(p[1]-g[1])),a=d[0]+t*(g[1]-d[1])/s,c=(o*(n=g[0]+t*(p[1]-g[1])/r)-i*a+(l=d[1]-t*(g[0]-d[0])/s)-(h=g[1]-t*(p[0]-g[0])/r))/(o-i),u=(i*o*(n-a)+o*l-i*h)/(o-i),g[0]-d[0]==0&&(u=o*(c=g[0]+t*(g[1]-d[1])/Math.abs(g[1]-d[1]))-o*n+h),p[0]-g[0]==0&&(u=i*(c=p[0]+t*(p[1]-g[1])/Math.abs(p[1]-g[1]))-i*a+l),m.push([c,u]));return y?m.push(m[0]):(e.pop(),d=e[e.length-1],g=e[e.length-2],p=[d[0]-(g[1]-d[1])/ol.coordinate.dist2d(d,g)*t,d[1]+(g[0]-d[0])/ol.coordinate.dist2d(d,g)*t],m.push(p)),m},ol.coordinate.findSegment=function(e,t){for(var i=0;it||e[a][1]>=t&&e[a+1][1]0;o--)(e[o][0]>t&&e[o-1][0]t)&&(i=[t,(t-e[o][0])/(e[o-1][0]-e[o][0])*(e[o-1][1]-e[o][1])+e[o][1]],e.splice(o,0,i))}function t(e,t){for(var i,o=e.length-1;o>0;o--)(e[o][1]>t&&e[o-1][1]t)&&(i=[(t-e[o][1])/(e[o-1][1]-e[o][1])*(e[o-1][0]-e[o][0])+e[o][0],t],e.splice(o,0,i))}ol.extent.intersection=function(i,o){var s="Polygon"===o.getType();if(!s&&"MultiPolygon"!==o.getType())return null;var r=o.getCoordinates();return s&&(r=[r]),r.forEach(function(o){o.forEach(function(o){e(o,i[0]),e(o,i[2]),t(o,i[1]),t(o,i[3])})}),r.forEach(function(e){e.forEach(function(e){e.forEach(function(e){e[0]i[2]&&(e[0]=i[2]),e[1]i[3]&&(e[1]=i[3])})})}),s?new ol.geom.Polygon(r[0]):new ol.geom.MultiPolygon(r)}}(),ol.coordinate.sampleAt=function(e,t,i,o){var s=[];!1!==o&&s.push(e);var r=ol.coordinate.dist2d(e,t);if(r){var a=Math.round(r/i);if(a>1)for(var n=(t[0]-e[0])/a,l=(t[1]-e[1])/a,h=1;hs?(a=!0,i.push([o[0]+s/t*(e[0]-o[0]),o[1]+s/t*(e[1]-o[1])])):i.push(e)})})}),a?"Polygon"===e.getType()?new ol.geom.Polygon(n[0]):new ol.geom.MultiPolygon(n):e}}else console.warn("[ol/geom/Circle~intersection] Unsupported geometry type: "+e.getType());return e},ol.geom.LineString.prototype.splitAt=function(e,t){var i;if(!e)return[this];if(t||(t=1e-10),e.length&&e[0].length){var o=[this];for(i=0;i1&&h.push(new ol.geom.LineString(l)),h.length?h:[this]},ol.geom.MultiPolygon.prototype.scribbleFill=function(e){var t,i,o,s=[],r=this.getPolygons();for(t=0;i=r[t];t++){var a=i.scribbleFill(e);a&&s.push(a)}if(!s.length)return null;var n,l=s[0];for(t=0;o=s[t];t++){n=o.getLineStrings();for(var h=0;hf);){if(c[i][0].pt[1]===f){var _=Math.min((c[i][0].index-o[0].index+d)%d,(o[0].index-c[i][0].index+d)%d),x=Math.min((o[1].index-o[0].index+d)%d,(o[0].index-o[1].index+d)%d);_=0;i--)s.unshift(t[i]);else for(i=t.length-2;i>=0;i--)s.push(t[i])})}e.geom=t,e.feature.getGeometry().setCoordinates(t)}),e}simplifyVisvalingam(e){this._edges.forEach(function(t){var i=t.get("edge")[0].feature.getGeometry().getType();t.setGeometry(t.get("geom").simplifyVisvalingam({area:e.area,dist:e.dist,ratio:e.ratio,minPoints:e.minPoints,keepEnds:!!/Polygon/.test(i)||e.keepEnds}))})}simplify(e){this._edges.forEach(function(t){t.setGeometry(t.get("geom").simplify(e))})}_calcEdges(e,t){var i,o,s={};e.forEach(function(e){if(!/Point/.test(e.getGeometry().getType())){var r=this._getArcs(e.getGeometry().getCoordinates(),[],"0",t);i="",r.forEach(function(t,r){!function(e,t,r){var a=t.seg[0]+"-"+t.seg[1],n=s[a];if(n||(a=t.seg[1]+"-"+t.seg[0],n=s[a]),n)n.edge.push({feature:e,contour:t.contour,index:r}),i="";else{var l={geometry:t.seg,edge:[{feature:e,contour:t.contour,index:r}],prev:i===t.contour&&o};i=t.contour,o=l,s[a]=l}}(e,t,r)})}}.bind(this));var r=[];for(var a in s)r.push(s[a]);return r}_getArcs(e,t,i,o){return e[0][0][0].length?e.forEach(function(e,s){this._getArcs(e,t,i+"-"+s,o)}.bind(this)):e.forEach(function(e,o){for(var s,r=e[0],a=i+"-"+o,n=1;n12)&&(t=12);for(var n=0,l=0,h=!0,c="",u=-90,d=90,g=-180,p=180;c.length=m?(n=2*n+1,g=m):(n*=2,p=m)}else{var f=(u+d)/2;o>=f?(n=2*n+1,u=f):(n*=2,d=f)}h=!h,5==++l&&(c+=ol.geohash.base32.charAt(n),l=0,n=0)}return c},ol.geohash.toLonLat=function(e){var t=ol.geohash.getExtent(e),i=t[1],o=t[0],s=t[3],r=t[2],a=(i+s)/2,n=(o+r)/2;return a=a.toFixed(Math.floor(2-Math.log(s-i)/Math.LN10)),n=n.toFixed(Math.floor(2-Math.log(r-o)/Math.LN10)),[Number(n),Number(a)]},ol.geohash.getExtent=function(e){if(!e)return!1;e=e.toLowerCase();for(var t=!0,i=-90,o=90,s=-180,r=180,a=0;a=0;h--){var c=l>>h&1;if(t){var u=(s+r)/2;1==c?s=u:r=u}else{var d=(i+o)/2;1==c?i=d:o=d}t=!t}}return[s,i,r,o]},ol.geohash.getAdjacent=function(e,t){if(e=e.toLowerCase(),t=t.toLowerCase(),!e)return!1;if(-1=="nsew".indexOf(t))return!1;var i=e.slice(-1),o=e.slice(0,-1),s=e.length%2;return-1!={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]}[t][s].indexOf(i)&&""!=o&&(o=ol.geohash.getAdjacent(o,t)),o+ol.geohash.base32.charAt({n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]}[t][s].indexOf(i))},ol.geohash.getNeighbours=function(e){return{n:ol.geohash.getAdjacent(e,"n"),ne:ol.geohash.getAdjacent(ol.geohash.getAdjacent(e,"n"),"e"),e:ol.geohash.getAdjacent(e,"e"),se:ol.geohash.getAdjacent(ol.geohash.getAdjacent(e,"s"),"e"),s:ol.geohash.getAdjacent(e,"s"),sw:ol.geohash.getAdjacent(ol.geohash.getAdjacent(e,"s"),"w"),w:ol.geohash.getAdjacent(e,"w"),nw:ol.geohash.getAdjacent(ol.geohash.getAdjacent(e,"n"),"w")}},ol.sphere.greatCircleBearing=function(e,t){var i=Math.PI/180,o=[e[0]*i,e[1]*i],s=[t[0]*i,t[1]*i];return Math.atan2(Math.sin(s[0]-o[0])*Math.cos(s[1]),Math.cos(o[1])*Math.sin(s[1])-Math.sin(o[1])*Math.cos(s[1])*Math.cos(s[0]-o[0]))},ol.sphere.computeDestinationPoint=function(e,t,i,o){o=o||{};var s=Math.PI/180,r=o.radius||6371008.8,a=e[1]*s,n=e[0]*s,l=t/r,h=Math.asin(Math.sin(a)*Math.cos(l)+Math.cos(a)*Math.sin(l)*Math.cos(i)),c=(n+Math.atan2(Math.sin(i)*Math.sin(l)*Math.cos(a),Math.cos(l)-Math.sin(a)*Math.sin(h)))/s;return!1!==o.normalize&&(c<-180||c>180)&&(c=540*c%360-180),[c,h/s]},ol.sphere.greatCircleTrack=function(e,t,i){i=i||{};for(var o=ol.sphere.greatCircleBearing(e,t),s=ol.sphere.getDistance(e,t,i.radius),r=i.distance||1e3,a=r,n=[e];a1&&(l[0]>t[0]?t[0]+=360:t[0]-=360),n.push(t),n},ol.sphere.getMapScale=function(e,t){var i=e.getView(),o=i.getProjection(),s=i.getCenter(),r=e.getPixelFromCoordinate(s);r[1]+=1;var a=e.getCoordinateFromPixel(r),n=ol.sphere.getDistance(ol.proj.transform(s,o,"EPSG:4326"),ol.proj.transform(a,o,"EPSG:4326"));return n*=(t||96)/.0254},ol.sphere.setMapScale=function(e,t,i){if(e&&t){var o=t;if("string"==typeof t&&((o=(t=t.replace(":","/").split("/"))[1])||(o=t[0]||""),o=o.replace(/[^\d]/g,""),o=parseInt(o),t[1])){var s=parseInt(t[0]);s&&(o/=s)}if(!o)return;var r=e.getView(),a=r.getProjection(),n=r.getCenter(),l=e.getPixelFromCoordinate(n);l[1]+=1;var h=e.getCoordinateFromPixel(l),c=ol.sphere.getDistance(ol.proj.transform(n,a,"EPSG:4326"),ol.proj.transform(h,a,"EPSG:4326"));return c*=(i||96)/.0254,r.setResolution(r.getResolution()*o/c),o}},function(){function e(e,t){return e[1][2]-t[1][2]}function t(e){return Math.abs((e[0][0]-e[2][0])*(e[1][1]-e[0][1])-(e[0][0]-e[1][0])*(e[2][1]-e[0][1]))}ol.geom.LineString.prototype.simplifyVisvalingam=function(i){var o=this.getCoordinates();if(i.minPoints&&i.minPoints>=o.length)return new ol.geom.LineString(o);for(var s,r=function(){var t={},i=[];function o(t){for(var o=i[t];t>0;){var s=(t+1>>1)-1,r=i[s];if(e(o,r)>=0)break;i[r.index=t]=r,i[o.index=t=s]=o}}function s(t){for(var o=i[t];;){var s=2*(t+1),r=s-1,a=t,n=i[a];if(ru});return i.keepEnds&&(ol.coordinate.equal(m[0],o[0])||m.unshift(o[0]),ol.coordinate.equal(m[m.length-1],o[o.length-1])||m.push(o[o.length-1])),new ol.geom.LineString(m)}}(),ol.Map.prototype.animExtent=function(e,t){var i;(t=t||{}).projection&&(e=ol.proj.transformExtent(e,t.projection,this.getView().getProjection()));var o=(new Date).getTime(),s=t.duration||1e3,r=t.easing||ol.easing.upAndDown,a=t.style&&t.style.getWidth()||2,n=t.style&&t.style.getColr()||"red";i=this.on("postcompose",function(t){var l=t.frameState,h=l.pixelRatio,c=l.time-o;if(c>s)ol.Observable.unByKey(i);else{var u=c/s,d=this.getPixelFromCoordinate([e[0],e[1]]),g=this.getPixelFromCoordinate([e[2],e[3]]),p=t.context;p.save(),p.scale(h,h),p.beginPath(),p.globalAlpha=r(1-u),p.lineWidth=a,p.strokeStyle=n,p.rect(d[0],d[1],g[0]-d[0],g[1]-d[1]),p.stroke(),p.restore(),l.animate=!0}}.bind(this));try{this.renderSync()}catch(e){}},ol.geom.Geometry.prototype.cspline=function(e){return this.calcCSpline_?(this.csplineGeometryRevision==this.getRevision()&&this.csplineOption==JSON.stringify(e)||(this.csplineGeometry_=this.calcCSpline_(e),this.csplineGeometryRevision=this.getRevision(),this.csplineOption=JSON.stringify(e)),this.csplineGeometry_):this},ol.geom.GeometryCollection.prototype.calcCSpline_=function(e){for(var t=[],i=this.getGeometries(),o=0;o2&&e[0][0]==e[e.length-1][0]&&e[0][1]==e[e.length-1][1]?(r.unshift(e[e.length-2]),r.push(e[1])):(r.unshift(e[0]),r.push(e[e.length-1])),y=1;yr&&s>a?t=-i-o:r>a?i=-t-o:o=-t-i,[t,i,o]}hex_round(e){return this.cube2hex(this.cube_round(this.hex2cube(e)))}hex_corner(e,t,i){return[e[0]+t*this.layout_[8+i%6*2],e[1]+t*this.layout_[9+i%6*2]]}getHexagonAtCoord(e){return this.getHexagon(this.coord2hex(e))}getHexagon(e){for(var t=[],i=this.hex2coord(e),o=0;o<=7;o++)t.push(this.hex_corner(i,this.size_,o,this.layout_[8]));return t}hex2coord(e){return[this.origin_[0]+this.size_*(this.layout_[0]*e[0]+this.layout_[1]*e[1]),this.origin_[1]+this.size_*(this.layout_[2]*e[0]+this.layout_[3]*e[1])]}coord2hex(e){var t=[(e[0]-this.origin_[0])/this.size_,(e[1]-this.origin_[1])/this.size_],i=this.layout_[4]*t[0]+this.layout_[5]*t[1],o=this.layout_[6]*t[0]+this.layout_[7]*t[1];return this.hex_round([i,o])}cube_distance(e,t){return Math.max(Math.abs(e[0]-t[0]),Math.abs(e[1]-t[1]),Math.abs(e[2]-t[2]))}lerp(e,t,i){return e+(t-e)*i}cube_lerp(e,t,i){return[this.lerp(e[0]+1e-6,t[0],i),this.lerp(e[1]+1e-6,t[1],i),this.lerp(e[2]+1e-6,t[2],i)]}cube_line(e,t){var i=this.cube_distance(e,t);if(!i)return[e];for(var o=[],s=0;s<=i;s++)o.push(this.cube_round(this.cube_lerp(e,t,s/i)));return o}hex_neighbors(e,t){if(void 0!==t)return[e[0]+this.neighbors.hex[t%6][0],e[1]+this.neighbors.hex[t%6][1]];var i=[];for(t=0;t<6;t++)i.push([e[0]+this.neighbors.hex[t][0],e[1]+this.neighbors.hex[t][1]]);return i}cube_neighbors(e,t){if(void 0!==t)return[e[0]+this.neighbors.cube[t%6][0],e[1]+this.neighbors.cube[t%6][1],e[2]+this.neighbors.cube[t%6][2]];var i=[];for(t=0;t<6;t++)i.push([e[0]+this.neighbors.cube[t][0],e[1]+this.neighbors.cube[t][1],e[2]+this.neighbors.cube[t][2]]);for(t=0;t<6;t++)i[t]=this.cube2hex(i[t]);return i}},ol.HexGrid.prototype.layout={pointy:[Math.sqrt(3),Math.sqrt(3)/2,0,1.5,Math.sqrt(3)/3,-1/3,0,2/3,Math.cos(Math.PI/180*30),Math.sin(Math.PI/180*30),Math.cos(Math.PI/180*90),Math.sin(Math.PI/180*90),Math.cos(Math.PI/180*150),Math.sin(Math.PI/180*150),Math.cos(Math.PI/180*210),Math.sin(Math.PI/180*210),Math.cos(Math.PI/180*270),Math.sin(Math.PI/180*270),Math.cos(Math.PI/180*330),Math.sin(Math.PI/180*330)],flat:[1.5,0,Math.sqrt(3)/2,Math.sqrt(3),2/3,0,-1/3,Math.sqrt(3)/3,Math.cos(Math.PI/180*0),Math.sin(Math.PI/180*0),Math.cos(Math.PI/180*60),Math.sin(Math.PI/180*60),Math.cos(Math.PI/180*120),Math.sin(Math.PI/180*120),Math.cos(Math.PI/180*180),Math.sin(Math.PI/180*180),Math.cos(Math.PI/180*240),Math.sin(Math.PI/180*240),Math.cos(Math.PI/180*300),Math.sin(Math.PI/180*300)]},ol.HexGrid.prototype.neighbors={cube:[[1,-1,0],[1,0,-1],[0,1,-1],[-1,1,0],[-1,0,1],[0,-1,1]],hex:[[1,0],[1,-1],[0,-1],[-1,0],[-1,1],[0,1]]},ol.InseeGrid=class extends ol.Object{constructor(e){e=e||{},proj4.defs["EPSG:3035"]||(proj4.defs("EPSG:3035","+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs"),ol.proj.proj4.register(proj4)),super(e);var t=Math.max(200,200*Math.round((e.size||0)/200));this.set("size",t)}getExtent(e){return ol.proj.transformExtent(ol.InseeGrid.extent,e||"EPSG:3035","EPSG:3857")}getGridAtCoordinate(e,t){var i=ol.proj.transform(e,t||"EPSG:3857","EPSG:3035"),o=this.get("size"),s=Math.floor(i[0]/o)*o,r=Math.floor(i[1]/o)*o,a=new ol.geom.Polygon([[[s,r],[s+o,r],[s+o,r+o],[s,r+o],[s,r]]]);return a.transform("EPSG:3035",t||"EPSG:3857"),a}},ol.InseeGrid.extent=[32e5,2e6,43e5,314e4],ol.Map.prototype.markup=function(e,t){var i,o=this;(t=t||{}).projection&&(e=ol.proj.transform(e,t.projection,this.getView().getProjection()));var s=(new Date).getTime(),r=t.delay||3e3,a=1e3,n=t.maxZoom||100,l=ol.easing.easeOut,h=t.style;h||(h=new ol.style.Circle({radius:10,stroke:new ol.style.Stroke({color:"red",width:2})})),h instanceof ol.style.Image&&(h=new ol.style.Style({image:h})),h instanceof Array||(h=[h]),setTimeout(function(){if(i)try{o.renderSync()}catch(e){}},r),i=this.on("postcompose",function(t){var o=t.frameState,c=o.time-s;if(c>r+a)ol.Observable.unByKey(i),i=null;else{r>c&&this.getView().getZoom()>n&&(r=c);var u=o.pixelRatio,d=0;c>r&&(d=(c-r)/a);var g=t.context;g.save(),g.beginPath(),g.globalAlpha=l(1-d);for(var p=0;p=r&&(o.animate=!0)}}.bind(this));try{this.renderSync()}catch(e){}return i.stop=function(){r=a=0;try{this.target.renderSync()}catch(e){}},i},ol.ordering={},ol.ordering.yOrdering=function(){return function(e,t){return t.getGeometry().getExtent()[1]-e.getGeometry().getExtent()[1]}},ol.ordering.zIndex=function(e){e||(e={});var t=e.attribute||"zIndex";return e.equalFn?function(i,o){return i.get(t)==o.get(t)?e.equalFn(i,o):i.get(t)s)ol.Observable.unByKey(i);else{var u=c/s,d=t.context;d.save(),d.beginPath();var g=r(u);d.globalAlpha=r(1-u);for(var p=0;p0?Number(e.scale):1)*ol.has.DEVICE_PIXEL_RATIO||ol.has.DEVICE_PIXEL_RATIO,s=i.getContext("2d");if(e.image){var r;e.image.load();var a=e.image.getImage();if(a.width)i.width=Math.round(a.width*o),i.height=Math.round(a.height*o),s.globalAlpha="number"==typeof e.opacity?e.opacity:1,s.drawImage(a,0,0,a.width,a.height,0,0,i.width,i.height),t=s.createPattern(i,"repeat");else{var n=this;t=[0,0,0,0],a.onload=function(){i.width=Math.round(a.width*o),i.height=Math.round(a.height*o),s.globalAlpha="number"==typeof e.opacity?e.opacity:1,s.drawImage(a,0,0,a.width,a.height,0,0,i.width,i.height),t=s.createPattern(i,"repeat"),n.setColor(t)}}}else{var l=this.getPattern_(e);if(i.width=Math.round(l.width*o),i.height=Math.round(l.height*o),s.beginPath(),e.fill&&(s.fillStyle=ol.color.asString(e.fill.getColor()),s.fillRect(0,0,i.width,i.height)),s.scale(o,o),s.lineCap="round",s.lineWidth=l.stroke||1,s.fillStyle=ol.color.asString(e.color||"#000"),s.strokeStyle=ol.color.asString(e.color||"#000"),l.circles)for(r=0;r180&&(s-=360),s*=Math.PI/180;var r=Math.cos(s),a=Math.sin(s);if(Math.abs(a)<1e-4)i.width=i.height=o,i.lines=[[0,.5,o,.5]],i.repeat=[[0,0],[0,o]];else if(Math.abs(r)<1e-4)i.width=i.height=o,i.lines=[[.5,0,.5,o]],i.repeat=[[0,0],[o,0]],"cross"==e.pattern&&(i.lines.push([0,.5,o,.5]),i.repeat.push([0,o]));else{var n=i.width=Math.round(Math.abs(o/a))||1,l=i.height=Math.round(Math.abs(o/r))||1;"cross"==e.pattern?(i.lines=[[-n,-l,2*n,2*l],[2*n,-l,-n,2*l]],i.repeat=[[0,0]]):r*a>0?(i.lines=[[-n,-l,2*n,2*l]],i.repeat=[[0,0],[n,0],[0,l]]):(i.lines=[[2*n,-l,-n,2*l]],i.repeat=[[0,0],[-n,0],[0,l]])}i.stroke=0===e.size?0:e.size||4}return i}},ol.style.FillPattern.patterns={hatch:{width:5,height:5,lines:[[0,2.5,5,2.5]],stroke:1},cross:{width:7,height:7,lines:[[0,3,10,3],[3,0,3,10]],stroke:1},dot:{width:8,height:8,circles:[[5,5,2]],stroke:!1,fill:!0},circle:{width:10,height:10,circles:[[5,5,2]],stroke:1,fill:!1},square:{width:10,height:10,lines:[[3,3,3,8,8,8,8,3,3,3]],stroke:1,fill:!1},tile:{width:10,height:10,lines:[[3,3,3,8,8,8,8,3,3,3]],fill:!0},woven:{width:12,height:12,lines:[[3,3,9,9],[0,12,3,9],[9,3,12,0],[-1,1,1,-1],[13,11,11,13]],stroke:1},crosses:{width:8,height:8,lines:[[2,2,6,6],[2,6,6,2]],stroke:1},caps:{width:8,height:8,lines:[[2,6,4,2,6,6]],stroke:1},nylon:{width:20,height:20,lines:[[1,6,1,1,6,1],[6,11,11,11,11,6],[11,16,11,21,16,21],[16,11,21,11,21,16]],repeat:[[0,0],[-20,0],[0,-20]],stroke:1},hexagon:{width:20,height:12,lines:[[0,10,4,4,10,4,14,10,10,16,4,16,0,10]],stroke:1,repeat:[[0,0],[10,6],[10,-6],[-10,-6]]},cemetry:{width:15,height:19,lines:[[0,3.5,7,3.5],[3.5,0,3.5,10]],stroke:1,repeat:[[0,0],[7,9]]},sand:{width:20,height:20,circles:[[1,2,1],[9,3,1],[2,16,1],[7,8,1],[6,14,1],[4,19,1],[14,2,1],[12,10,1],[14,18,1],[18,8,1],[18,14,1]],fill:1},conglomerate:{width:60,height:40,circles:[[2,4,1],[17,3,1],[26,18,1],[12,17,1],[5,17,2],[28,11,2]],lines:[[7,5,6,7,9,9,11,8,11,6,9,5,7,5],[16,10,15,13,16,14,19,15,21,13,22,9,20,8,19,8,16,10],[24,6,26,7,27,5,26,4,24,4,24,6]],repeat:[[30,0],[-15,20],[15,20],[45,20]],stroke:1},conglomerate2:{width:60,height:40,circles:[[2,4,1],[17,3,1],[26,18,1],[12,17,1],[5,17,2],[28,11,2]],lines:[[7,5,6,7,9,9,11,8,11,6,9,5,7,5],[16,10,15,13,16,14,19,15,21,13,22,9,20,8,19,8,16,10],[24,6,26,7,27,5,26,4,24,4,24,6]],repeat:[[30,0],[-15,20],[15,20],[45,20]],fill:1},gravel:{width:15,height:10,circles:[[4,2,1],[5,9,1],[1,7,1]],lines:[[7,5,6,6,7,7,8,7,9,7,10,5,9,4,7,5],[11,2,14,4,14,1,12,1,11,2]],stroke:1},brick:{width:18,height:16,lines:[[0,1,18,1],[0,10,18,10],[6,1,6,10],[12,10,12,18],[12,0,12,1]],stroke:1},dolomite:{width:20,height:16,lines:[[0,1,20,1],[0,9,20,9],[1,9,6,1],[11,9,14,16],[14,0,14.4,1]],stroke:1},coal:{width:20,height:16,lines:[[1,5,7,1,7,7],[11,10,12,5,18,9],[5,10,2,15,9,15],[15,16,15,13,20,16],[15,0,15,2,20,0]],fill:1},breccia:{width:20,height:16,lines:[[1,5,7,1,7,7,1,5],[11,10,12,5,18,9,11,10],[5,10,2,15,9,15,5,10],[15,16,15,13,22,18],[15,0,15,2,20,0]],stroke:1},clay:{width:20,height:20,lines:[[0,0,3,11,0,20],[11,0,10,3,13,13,11,20],[0,0,10,3,20,0],[0,12,3,11,13,13,20,12]],stroke:1},flooded:{width:15,height:10,lines:[[0,1,10,1],[0,6,5,6],[10,6,15,6]],stroke:1},chaos:{width:40,height:40,lines:[[40,2,40,0,38,0,40,2],[4,0,3,2,2,5,0,0,0,3,2,7,5,6,7,7,8,10,9,12,9,13,9,14,8,14,6,15,2,15,0,20,0,22,2,20,5,19,8,15,10,14,11,12.25,10,12,10,10,12,9,13,7,12,6,13,4,16,7,17,4,20,0,18,0,15,3,14,2,14,0,12,1,11,0,10,1,11,4,10,7,9,8,8,5,6,4,5,3,5,1,5,0,4,0],[7,1,7,3,8,3,8,2,7,1],[4,3,5,5,4,5,4,3],[34,5,33,7,38,10,38,8,36,5,34,5],[27,0,23,2,21,8,30,0,27,0],[25,8,26,12,26,16,22.71875,15.375,20,13,18,15,17,18,13,22,17,21,19,22,21,20,19,18,22,17,30,25,26,26,24,28,21.75,33.34375,20,36,18,40,20,40,24,37,25,32,27,31,26,38,27,37,30,32,32,35,36,37,38,40,38,39,40,40,37,36,34,32,37,31,36,29,33,27,34,24,39,21,40,21,40,16,37,20,31,22,32,25,27,20,29,15,30,20,32,20,34,18,33,12,31,11,29,14,26,9,25,8],[39,24,37,26,40,28,39,24],[13,15,9,19,14,18,13,15],[18,23,14,27,16,27,17,25,20,26,18,23],[6,24,2,26,1,28,2,30,5,28,12,30,16,32,18,30,15,30,12,28,9,25,7,27,6,24],[29,27,32,28,33,31,30,29,27,28,29,27],[5,35,1,33,3,36,13,38,15,35,10,36,5,35]],fill:1},grass:{width:27,height:22,lines:[[0,10.5,13,10.5],[2.5,10,1.5,7],[4.5,10,4.5,5,3.5,4],[7,10,7.5,6,8.5,3],[10,10,11,6]],repeat:[[0,0],[14,10]],stroke:1},swamp:{width:24,height:23,lines:[[0,10.5,9.5,10.5],[2.5,10,2.5,7],[4.5,10,4.5,4],[6.5,10,6.5,6],[3,12.5,7,12.5]],repeat:[[0,0],[14,10]],stroke:1},reed:{width:26,height:23,lines:[[2.5,10,2,7],[4.5,10,4.2,4],[6.5,10,6.8,4],[8.5,10,9,6],[3.7,4,3.7,2.5],[4.7,4,4.7,2.5],[6.3,4,6.3,2.5],[7.3,4,7.3,2.5]],circles:[[4.2,2.5,.5],[18.2,12.5,.5],[6.8,2.5,.5],[20.8,12.5,.5],[9,6,.5],[23,16,.5]],repeat:[[0,0],[14,10]],stroke:1},wave:{width:10,height:8,lines:[[0,0,5,4,10,0]],stroke:1},vine:{width:13,height:13,lines:[[3,0,3,6],[9,7,9,13]],stroke:1},forest:{width:55,height:30,circles:[[7,7,3.5],[20,20,1.5],[42,22,3.5],[35,5,1.5]],stroke:1},forest2:{width:55,height:30,circles:[[7,7,3.5],[20,20,1.5],[42,22,3.5],[35,5,1.5]],fill:1,stroke:1},scrub:{width:26,height:20,lines:[[1,4,4,8,6,4]],circles:[[20,13,1.5]],stroke:1},tree:{width:30,height:30,lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,.71,6.36,0,4.24,.71,2.12,4.24,0,7.78,.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78]],repeat:[[3,1],[18,16]],stroke:1},tree2:{width:30,height:30,lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,.71,6.36,0,4.24,.71,2.12,4.24,0,7.78,.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78,4.95,10.61,7.78,10.61]],repeat:[[3,1],[18,16]],fill:1,stroke:1},pine:{width:30,height:30,lines:[[5.66,11.31,2.83,11.31,2.83,8.49,0,8.49,2.83,0,5.66,8.49,2.83,8.49]],repeat:[[3,1],[18,16]],stroke:1},pine2:{width:30,height:30,lines:[[5.66,11.31,2.83,11.31,2.83,8.49,0,8.49,2.83,0,5.66,8.49,2.83,8.49,2.83,11.31,5.66,11.31]],repeat:[[3,1],[18,16]],fill:1,stroke:1},mixtree:{width:30,height:30,lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,.71,6.36,0,4.24,.71,2.12,4.24,0,7.78,.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78,4.95,10.61,7.78,10.61],[23.66,27.31,20.83,27.31,20.83,24.49,18,24.49,20.83,16,23.66,24.49,20.83,24.49,20.83,27.31,23.66,27.31]],repeat:[[3,1]],stroke:1},mixtree2:{width:30,height:30,lines:[[7.78,10.61,4.95,10.61,4.95,7.78,3.54,7.78,2.12,6.36,.71,6.36,0,4.24,.71,2.12,4.24,0,7.78,.71,9.19,3.54,7.78,4.95,7.07,7.07,4.95,7.78,4.95,10.61,7.78,10.61],[23.66,27.31,20.83,27.31,20.83,24.49,18,24.49,20.83,16,23.66,24.49,20.83,24.49,20.83,27.31,23.66,27.31]],repeat:[[3,1]],fill:1,stroke:1},pines:{width:22,height:20,lines:[[1,4,3.5,1,6,4],[1,8,3.5,5,6,8],[3.5,1,3.5,11],[12,14.5,14.5,14,17,14.5],[12,18,17,18],[14.5,12,14.5,18]],repeat:[[2,1]],stroke:1},rock:{width:20,height:20,lines:[[1,0,1,9],[4,0,4,9],[7,0,7,9],[10,1,19,1],[10,4,19,4],[10,7,19,7],[0,11,9,11],[0,14,9,14],[0,17,9,17],[12,10,12,19],[15,10,15,19],[18,10,18,19]],repeat:[[.5,.5]],stroke:1},rocks:{width:20,height:20,lines:[[5,0,3,0,5,4,4,6,0,3,0,5,3,6,5,9,3.75,10,2.5,10,0,9,0,10,4,11,5,14,4,15,0,13,0,13,0,13,0,14,0,14,5,16,5,18,3,19,0,19,-.25,19.9375,5,20,10,19,10,20,11,20,12,19,14,20,15,20,17,19,20,20,20,19,19,16,20,15,20,11,20,10,19,8,20,5,20,0,19,0,20,2,19,4,17,4,16,3,15,0,14,0,15,4,11,5,10,4,11,0,10,0,9,4,6,5,5,0],[18,5,19,6,18,10,16,10,14,9,16,5,18,5],[5,6,9,5,10,6,10,9,6,10,5,6],[14,5,14,8,13,9,12,9,11,7,12,5,14,5],[5,11,8,10,9,11,10,14,6,15,6,15,5,11],[13,10,14,11,15,14,15,14,15,14,11,15,10,11,11,10,13,10],[15,12,16,11,19,11,19,15,16,14,16,14,15,12],[6,16,9,15,10,18,5,19,6,16],[10,16,14,16,14,18,13,19,11,18,10,16],[15,15,18,16,18,18,16,19,15,18,15,15]],stroke:1}},ol.style.FlowLine=class extends ol.style.Style{constructor(e){super({stroke:(e=e||{}).stroke,text:e.text,zIndex:e.zIndex,geometry:e.geometry}),this.setRenderer(this._render.bind(this)),this._visible=!1!==e.visible,"function"==typeof e.width?this._widthFn=e.width:this.setWidth(e.width),this.setWidth2(e.width2),"function"==typeof e.color?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}}setLineCap(e){this._lineCap="round"===e?"round":"butt"}getWidth(e,t){if(this._widthFn)return this._widthFn(e,t);var i="number"==typeof this._width2?this._width2:this._width;return this._width+(i-this._width)*t}setColor(e){try{this._color=ol.color.asArray(e)}catch(e){this._color=[0,0,0,1]}}setColor2(e){try{this._color2=ol.color.asArray(e)}catch(e){this._color2=null}}setArrowColor(e){try{this._acolor=ol.color.asString(e)}catch(e){this._acolor=null}}getColor(e,t){if(this._colorFn)return ol.color.asString(this._colorFn(e,t));var i=this._color,o=this._color2||this._color;return"rgba("+ +Math.round(i[0]+(o[0]-i[0])*t)+","+Math.round(i[1]+(o[1]-i[1])*t)+","+Math.round(i[2]+(o[2]-i[2])*t)+","+(i[3]+(o[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:"number"==typeof e&&(this._arrowSize=[e,e])}drawArrow(e,t,i,o,s){var r=this.getArrowSize()[0]*s,a=ol.coordinate.dist2d(t,i),n=(t[0]-i[0])/a,l=(t[1]-i[1])/a;o=Math.max(this.getArrowSize()[1]/2,o/2)*s,e.beginPath(),e.moveTo(t[0],t[1]),e.lineTo(t[0]-r*n+o*l,t[1]-r*l-o*n),e.lineTo(t[0]-r*n-o*l,t[1]-r*l+o*n),e.lineTo(t[0],t[1]),e.fill()}_render(e,t){if("LineString"===t.geometry.getType()){var i,o,s,r=t.context;if(!this._visible){var a=t.pixelRatio/t.resolution,n=Math.cos(t.rotation),l=Math.sin(t.rotation);o=t.geometry.getCoordinates();var h=e[0][0]-o[0][0]*a*n-o[0][1]*a*l,c=e[0][1]-o[0][0]*a*l+o[0][1]*a*n;for(e=[],i=0;s=o[i];i++)e[i]=[h+s[0]*a*n+s[1]*a*l,c+s[0]*a*l-s[1]*a*n,s[2]]}var u=this.getArrowSize()[0]*t.pixelRatio;r.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&&(-1===this.getArrow()||2===this.getArrow())&&(s=this._splitAsize(e,u),this._acolor?r.fillStyle=this._acolor:r.fillStyle=this.getColor(t.feature,0),this.drawArrow(r,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?r.fillStyle=this._acolor:r.fillStyle=this.getColor(t.feature,1),this.drawArrow(r,s[0],s[1],this.getWidth(t.feature,1),t.pixelRatio));var d=this._splitInto(e,255,2),g=0,p=d.length;if(r.lineJoin="round",r.lineCap=this._lineCap||"butt",d.length>1)for(g=0;gt){o=[o[0]+(s[0]-o[0])*(t-n)/a,o[1]+(s[1]-o[1])*(t-n)/a],a=ol.coordinate.dist2d(o,r),i?(e.push(s),e.push(o),e.push([o[0]+(r[0]-o[0])/a,o[1]+(r[1]-o[1])/a])):(e.unshift(s),e.unshift(o),e.unshift([o[0]+(r[0]-o[0])/a,o[1]+(r[1]-o[1])/a]));break}n+=a,o=s}return[r,o]}_splitInto(e,t,i){var o,s,r,a=this._noOverlap?1:.9,n=[],l=0;for(o=1;s=e[o];o++)l+=ol.coordinate.dist2d(e[o-1],s);var h=Math.max(i||2,l/(t||255)),c=e[0];l=0;var u=[c];for(o=1,s=e[1];oh){var p=(h-l)/r;u.push([c[0]+d*p,c[1]+g*p]),n.push(u),u=[c=[c[0]+d*p*a,c[1]+g*p*a]],l=0}else l+=r,c=s,u.push(c),s=e[++o]}return n.push(u),n}},ol.style.FontSymbol=class extends ol.style.RegularShape{constructor(e){var t=0;(e=e||{}).stroke&&(t=e.stroke.getWidth()),e.displacement||(e.displacement=[e.offsetX||0,-e.offsetY||0]),super({radius:e.radius,fill:e.fill,rotation:e.rotation,displacement:e.displacement,rotateWithView:e.rotateWithView}),"number"==typeof e.opacity&&this.setOpacity(e.opacity),this._color=e.color,this._fontSize=e.fontSize||1,this._fontStyle=e.fontStyle||"",this._stroke=e.stroke,this._fill=e.fill,this._radius=e.radius-t,this._form=e.form||"none",this._gradient=e.gradient,this._offset=[e.offsetX?e.offsetX:0,e.offsetY?e.offsetY:0],e.glyph?this._glyph=this.getGlyph(e.glyph):this._glyph=this.getTextGlyph(e.text||"",e.font),this.getDisplacement||this.getImage()}static addDefs(e,t){var i=e;if("string"==typeof e&&(i={font:e,name:e,copyright:""}),i.font&&"string"==typeof i.font){var o=i.font;for(var s in ol.style.FontSymbol.defs.fonts[o]=i,t){var r=t[s];"string"!=typeof r||1!=r.length&&2!=r.length||(r={char:r}),ol.style.FontSymbol.defs.glyphs[s]={font:i.font,char:r.char||""+String.fromCharCode(r.code)||"",theme:r.theme||i.name,name:r.name||s,search:r.search||""}}}else console.log("bad font def")}clone(){var e=new ol.style.FontSymbol({text:this._glyph.char,font:this._glyph.font,color:this._color,fontSize:this._fontSize,fontStyle:this._fontStyle,stroke:this._stroke,fill:this._fill,radius:this._radius+(this._stroke?this._stroke.getWidth():0),form:this._form,gradient:this._gradient,offsetX:this._offset[0],offsetY:this._offset[1],opacity:this.getOpacity(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView()});return e.setScale(this.getScale()),e}getFill(){return this._fill}getStroke(){return this._stroke}getGlyph(e){return e?ol.style.FontSymbol.defs.glyphs[e]||{font:"sans-serif",char:e.charAt(0),theme:"none",name:"none",search:""}:this._glyph}getTextGlyph(e,t){return{font:t||"sans-serif",char:String(e),theme:"none",name:"none",search:""}}getGlyphName(){for(var e in ol.style.FontSymbol.defs.glyphs)if(ol.style.FontSymbol.defs.glyphs[e]===this._glyph)return e;return""}getFontInfo(e){return ol.style.FontSymbol.defs.fonts[e.font]}getImage(e){e=e||1;var t,i=super.getImage(e),o=0;this._stroke&&(t=ol.color.asString(this._stroke.getColor()),o=this._stroke.getWidth());var s={strokeStyle:t,strokeWidth:o,size:i.width/e},r=i.getContext("2d");if(r.clearRect(0,0,i.width,i.height),this.drawMarker_(s,r,0,0,e),!this.getDisplacement){var a=this.getAnchor();a[0]=i.width/2-this._offset[0],a[1]=i.width/2-this._offset[1]}return i}drawPath_(e,t){var i=2*this._radius+e.strokeWidth,o=e.strokeWidth/2,s=e.size/2,r={fac:1,posX:e.size/2,posY:e.size/2};switch(t.lineJoin="round",t.lineCap="round",t.beginPath(),this._form){case"none":r.fac=1;break;case"circle":case"ban":t.arc(s,s,i/2,0,2*Math.PI,!0);break;case"poi":t.arc(s,s-.4*this._radius,.6*this._radius,.15*Math.PI,.85*Math.PI,!0),t.lineTo(s-.89*.05*i,(.95+.45*.05)*i+o),t.arc(s,.95*i+o,.05*i,.85*Math.PI,.15*Math.PI,!0),r={fac:.45,posX:s,posY:s-.35*this._radius};break;case"bubble":t.arc(s,s-.2*this._radius,.8*this._radius,.4*Math.PI,.6*Math.PI,!0),t.lineTo(.5*i+o,i+o),r={fac:.7,posX:s,posY:s-.2*this._radius};break;case"marker":t.arc(s,s-.2*this._radius,.8*this._radius,.25*Math.PI,.75*Math.PI,!0),t.lineTo(.5*i+o,i+o),r={fac:.7,posX:s,posY:s-.2*this._radius};break;case"coma":t.moveTo(s+.8*this._radius,s-.2*this._radius),t.quadraticCurveTo(.95*i+o,.75*i+o,.5*i+o,i+o),t.arc(s,s-.2*this._radius,.8*this._radius,.45*Math.PI,0,!1),r={fac:.7,posX:s,posY:s-.2*this._radius};break;default:var a;switch(this._form){case"shield":a=[.05,0,.95,0,.95,.8,.5,1,.05,.8,.05,0],r.posY=.45*i+o;break;case"blazon":a=[.1,0,.9,0,.9,.8,.6,.8,.5,1,.4,.8,.1,.8,.1,0],r.fac=.8,r.posY=.4*i+o;break;case"bookmark":a=[.05,0,.95,0,.95,1,.5,.8,.05,1,.05,0],r.fac=.9,r.posY=.4*i+o;break;case"hexagon":a=[.05,.2,.5,0,.95,.2,.95,.8,.5,1,.05,.8,.05,.2],r.fac=.9,r.posY=.5*i+o;break;case"diamond":a=[.25,0,.75,0,1,.2,1,.4,.5,1,0,.4,0,.2,.25,0],r.fac=.75,r.posY=.35*i+o;break;case"triangle":a=[0,0,1,0,.5,1,0,0],r.fac=.6,r.posY=.3*i+o;break;case"sign":a=[.5,.05,1,.95,0,.95,.5,.05],r.fac=.7,r.posY=.65*i+o;break;case"lozenge":a=[.5,0,1,.5,.5,1,0,.5,.5,0],r.fac=.7;break;case"square":default:a=[0,0,1,0,1,1,0,1,0,0]}for(var n=0;nthis.textPathMaxResolution_)){var t,i=e.frameState.extent,o=e.frameState.coordinateToPixelTransform,s=e.context;s.save(),s.scale(e.frameState.pixelRatio,e.frameState.pixelRatio);for(var r,a=this.getSource().getFeaturesInExtent(i),n=0;r=a[n];n++)for(var l,h=this.textPathStyle_(r,e.frameState.viewState.resolution),c=0;l=h[c];c++){var u,d=l.getGeometry()||r.getGeometry();switch(d.getType()){case"LineString":u=d.getCoordinates();break;case"MultiLineString":u=d.getLineString(0).getCoordinates();break;default:continue}var g=l.getText(),p=m(u,g.getRotateWithView());s.font=g.getFont(),s.textBaseline=g.getTextBaseline(),s.textAlign=g.getTextAlign(),s.lineWidth=g.getStroke()&&g.getStroke().getWidth()||0,s.strokeStyle=g.getStroke()&&g.getStroke().getColor()||"#fff",s.fillStyle=g.getFill()&&g.getFill().getColor()||"#000",s.textJustify="justify"==g.getTextAlign(),s.textOverflow=g.getTextOverflow?g.getTextOverflow():"",s.minWidth=g.getMinWidth?g.getMinWidth():0,s.textPath(g.getText()||r.get("name"),p)}s.restore()}function m(e,i){var s=[];for(t=0;ts[s.length-2]){var r=[];for(t=s.length-2;t>=0;t-=2)r.push(s[t]),r.push(s[t+1]);return r}return s}}.bind(this))),void 0===e&&(e=[new ol.style.Style({text:new ol.style.Text})]),this.textPathStyle_="function"==typeof e?e:function(){return e},this.textPathMaxResolution_=Number(t)||Number.MAX_VALUE,this.changed()},ol.style.TextPath=function(e){e||(e={}),ol.style.Text.call(this,e),this.textOverflow_=void 0!==e.textOverflow?e.textOverflow:"visible",this.minWidth_=e.minWidth||0},ol.ext.inherits(ol.style.TextPath,ol.style.Text),ol.style.TextPath.prototype.getTextOverflow=function(){return this.textOverflow_},ol.style.TextPath.prototype.getMinWidth=function(){return this.minWidth_}}(),CanvasRenderingContext2D.prototype.textPath=function(e,t){var i=this;function o(e,t,i,o){var s=i-e,r=o-t;return Math.sqrt(s*s+r*r)}var s,r=0,a=2;function n(e,t){if(!s||r+st))&&!((a+=2)>=e.length);)r+=s;var i,n,l,h=t-r;return a>=e.length&&(a=e.length-2),h?(i=e[a-2]+(e[a]-e[a-2])*h/s,n=e[a-1]+(e[a+1]-e[a-1])*h/s,l=Math.atan2(e[a+1]-e[a-1],e[a]-e[a-2])):(i=e[a-2],n=e[a-1],l=Math.atan2(e[a+1]-e[a-1],e[a]-e[a-2])),[i,n,l]}for(var l=.25*i.measureText(" ").width,h=0,c=0,u=2;u0?Number(e.scale):1)*ol.has.DEVICE_PIXEL_RATIO||ol.has.DEVICE_PIXEL_RATIO,r=o.getContext("2d");if(e.image){e.image.load();var a=e.image.getImage();if(a.width)o.width=Math.round(a.width*s),o.height=Math.round(a.height*s),r.globalAlpha="number"==typeof e.opacity?e.opacity:1,r.drawImage(a,0,0,a.width,a.height,0,0,o.width,o.height),t=r.createPattern(o,"repeat");else{var n=this;t=[0,0,0,0],a.onload=function(){o.width=Math.round(a.width*s),o.height=Math.round(a.height*s),r.globalAlpha="number"==typeof e.opacity?e.opacity:1,r.drawImage(a,0,0,a.width,a.height,0,0,o.width,o.height),t=r.createPattern(o,"repeat"),n.setColor(t)}}}else{var l=this.getPattern_(e);if(o.width=Math.round(l.width*s),o.height=Math.round(l.height*s),r.beginPath(),e.fill&&(r.fillStyle=ol.color.asString(e.fill.getColor()),r.fillRect(0,0,o.width,o.height)),r.scale(s,s),r.lineCap="round",r.lineWidth=l.stroke||1,r.fillStyle=ol.color.asString(e.color||"#000"),r.strokeStyle=ol.color.asString(e.color||"#000"),l.circles)for(i=0;i180&&(s-=360),s*=Math.PI/180;var r=Math.cos(s),a=Math.sin(s);if(Math.abs(a)<1e-4)i.width=i.height=o,i.lines=[[0,.5,o,.5]],i.repeat=[[0,0],[0,o]];else if(Math.abs(r)<1e-4)i.width=i.height=o,i.lines=[[.5,0,.5,o]],i.repeat=[[0,0],[o,0]],"cross"==e.pattern&&(i.lines.push([0,.5,o,.5]),i.repeat.push([0,o]));else{var n=i.width=Math.round(Math.abs(o/a))||1,l=i.height=Math.round(Math.abs(o/r))||1;"cross"==e.pattern?(i.lines=[[-n,-l,2*n,2*l],[2*n,-l,-n,2*l]],i.repeat=[[0,0]]):r*a>0?(i.lines=[[-n,-l,2*n,2*l]],i.repeat=[[0,0],[n,0],[0,l]]):(i.lines=[[2*n,-l,-n,2*l]],i.repeat=[[0,0],[-n,0],[0,l]])}i.stroke=0===e.size?0:e.size||4}return i}},ol.style.Style.defaultStyle,function(){var e=[255,255,255,1],t=[0,153,255,1],i=[new ol.style.Style({stroke:new ol.style.Stroke({color:e,width:5})}),new ol.style.Style({image:new ol.style.Circle({radius:6,fill:new ol.style.Fill({color:t}),stroke:new ol.style.Stroke({color:e,width:1.5})}),stroke:new ol.style.Stroke({color:t,width:3}),fill:new ol.style.Fill({color:[255,255,255,.5]})})];ol.style.Style.defaultStyle=function(e){if(!0===e)return i;e=e||{};var t=new ol.style.Fill({color:e.fillColor||"rgba(255,255,255,0.4)"}),o=new ol.style.Stroke({color:e.color||"#3399CC",width:1.25});return[new ol.style.Style({image:new ol.style.Circle({fill:t,stroke:o,radius:5}),fill:t,stroke:o})]}}(),ol.style.geoportailStyle,function(){var e={},t=0;function i(i){var o="ROUT-"+t+++"-";return function(t,s){var r=!0===i.sens||s0?[0,100,0,1]:[0,128,0,1];if(!e.get("importance"))return"magenta";if("Piste cyclable"===e.get("nature"))return[27,177,27,.5];if("0"!=e.get("position_par_rapport_au_sol")){var t;switch(e.get("importance")){case"1":t=[177,27,177,1];break;case"2":t=[177,27,27,1];break;case"3":t=[217,119,0,1];break;case"4":t=[255,225,0,1];break;case"5":t=[204,204,204,1];break;default:t=[211,211,211,1]}return e.get("position_par_rapport_au_sol")<0&&(t[3]=.7),t}switch(e.get("importance")){case"1":return[255,0,255,1];case"2":return[255,0,0,1];case"3":return[255,165,0,1];case"4":return[255,255,0,1];case"5":return[255,255,255,1];default:return[211,211,211,1]}}(t),width:function(e){return Math.max(e.get("largeur_de_chaussee")||2,2)}(t),lineDash:function(e){switch(e.get("nature")){case"Escalier":return[1,4];case"Sentier":return[8,10]}}(t)}),zIndex:function(e){if(!e.get("position_par_rapport_au_sol"))return 100;var t=Number(e.get("position_par_rapport_au_sol"));return t>0?10+10*t-(Number(e.get("importance"))||10):t<0?Math.max(4+t,0):10-(Number(e.get("importance"))||10)}(t)-100})]),n[0].getText()&&n[0].getText().setRotation(function(e){for(var t,i,o=e.getCoordinates(),s=0,r=e.getLength(),a=0;a=r/2));a++);return-Math.atan2(i,t)}(t.getGeometry())),n}}var o={111:{color:[230,0,77,255],title:"Continuous urban fabric"},112:{color:[255,0,0,255],title:"Discontinuous urban fabric"},121:{color:[204,77,242,255],title:"Industrial or commercial units"},122:{color:[204,0,0,255],title:"Road and rail networks and associated land"},123:{color:[230,204,204,255],title:"Port areas"},124:{color:[230,204,230,255],title:"Airports"},131:{color:[166,0,204,255],title:"Mineral extraction sites"},132:{color:[166,77,0,255],title:"Dump sites"},133:{color:[255,77,255,255],title:"Construction sites"},141:{color:[255,166,255,255],title:"Green urban areas"},142:{color:[255,230,255,255],title:"Sport and leisure facilities"},211:{color:[255,255,168,255],title:"Non-irrigated arable land"},212:{color:[255,255,0,255],title:"Permanently irrigated land"},213:{color:[230,230,0,255],title:"Rice fields"},221:{color:[230,128,0,255],title:"Vineyards"},222:{color:[242,166,77,255],title:"Fruit trees and berry plantations"},223:{color:[230,166,0,255],title:"Olive groves"},231:{color:[230,230,77,255],title:"Pastures"},241:{color:[255,230,166,255],title:"Annual crops associated with permanent crops"},242:{color:[255,230,77,255],title:"Complex cultivation patterns"},243:{color:[230,204,77,255],title:"Land principally occupied by agriculture with significant areas of natural vegetation"},244:{color:[242,204,166,255],title:"Agro-forestry areas"},311:{color:[128,255,0,255],title:"Broad-leaved forest"},312:{color:[0,166,0,255],title:"Coniferous forest"},313:{color:[77,255,0,255],title:"Mixed forest"},321:{color:[204,242,77,255],title:"Natural grasslands"},322:{color:[166,255,128,255],title:"Moors and heathland"},323:{color:[166,230,77,255],title:"Sclerophyllous vegetation"},324:{color:[166,242,0,255],title:"Transitional woodland-shrub"},331:{color:[230,230,230,255],title:"Beaches dunes sands"},332:{color:[204,204,204,255],title:"Bare rocks"},333:{color:[204,255,204,255],title:"Sparsely vegetated areas"},334:{color:[0,0,0,255],title:"Burnt areas"},335:{color:[166,230,204,255],title:"Glaciers and perpetual snow"},411:{color:[166,166,255,255],title:"Inland marshes"},412:{color:[77,77,255,255],title:"Peat bogs"},421:{color:[204,204,255,255],title:"Salt marshes"},422:{color:[230,230,255,255],title:"Salines"},423:{color:[166,166,230,255],title:"Intertidal flats"},511:{color:[0,204,242,255],title:"Water courses"},512:{color:[128,242,230,255],title:"Water bodies"},521:{color:[0,255,166,255],title:"Coastal lagoons"},522:{color:[166,255,230,255],title:"Estuaries"},523:{color:[230,242,255,255],title:"Sea and ocean"}};ol.style.geoportailStyle=function(s,r){switch(r=r||{},s){case"BDTOPO_V3:troncon_de_route":return i(r);case"BDTOPO_V3:batiment":return function(i){var o="BATI-"+t+++"-";return function(t){if(t.get("detruit"))return[];var s=o+t.get("usage_1")+"-"+t.get("nature")+"-"+t.get("etat_de_l_objet"),r=e[s];if(!r){var a=function(e){switch(e.get("nature")){case"Industriel, agricole ou commercial":return[51,102,153,1];case"Remarquable":return[0,192,0,1];default:switch(e.get("usage_1")){case"Résidentiel":case"Indifférencié":return[128,128,128,1];case"Industriel":case"Commercial et services":return[51,102,153,1];case"Sportif":return[51,153,102,1];case"Religieux":return[153,102,51,1];default:return[153,51,51,1]}}}(t),n=[a[0],a[1],a[1],.5],l=!/en service/i.test(t.get("etat_de_l_objet"));l&&(n[3]=.1);var h=i.symbol?function(e){switch(e.get("usage_1")){case"Commercial et services":return"";case"Sportif":return"";default:return null}}(t):null;return[new ol.style.Style({text:h?new ol.style.Text({text:h,font:"12px FontAwesome",fill:new ol.style.Fill({color:[0,0,0,.6]})}):null,fill:new ol.style.Fill({color:n}),stroke:new ol.style.Stroke({color:a,width:1.5,lineDash:l?[5,5]:null})})]}return r}}(r);case"CADASTRALPARCELS.PARCELLAIRE_EXPRESS:parcelle":return function(e){var t=new ol.style.Style({text:new ol.style.Text({text:"0000",font:"bold 12px sans-serif",fill:new ol.style.Fill({color:[100,0,255,1]}),stroke:new ol.style.Stroke({color:[255,255,255,.8],width:3})}),stroke:new ol.style.Stroke({color:[255,165,0,1],width:1.5}),fill:new ol.style.Fill({color:[100,0,255,.1]})});return function(i,o){return o<.8?t.getText().setFont("bold 12px sans-serif"):t.getText().setFont("bold 10px sans-serif"),e.section?t.getText().setText(i.get("section")+"-"+(i.get("numero")||"").replace(/^0*/,"")):t.getText().setText((i.get("numero")||"").replace(/^0*/,"")),t}}(r);default:return/LANDCOVER/.test(s)?(r.date=s.replace(/[^\d]*(\d*).*/,"$1"),function(t){return function(i){var s=i.get("code_"+t.date),r=e["CLC-"+s];if(!r){var a=o[s].color.slice();a[3]=t.opacity||1,r=e["CLC-"+s]=new ol.style.Style({fill:new ol.style.Fill({color:a||[255,255,255,.5]})})}return r}}(r)):(console.warn("[ol/style/geoportailStyle] no style defined for type: "+s),ol.style.Style.defaultStyle())}},ol.style.geoportailStyle.clcColors=JSON.parse(JSON.stringify(o))}(); \ No newline at end of file