forked from Viglino/ol-ext
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathol-ext.min.js
9 lines (9 loc) · 394 KB
/
ol-ext.min.js
1
2
3
4
5
6
7
8
9
/**
* ol-ext - A set of cool extensions for OpenLayers (ol) in node modules structure
* @description ol3,openlayers,popup,menu,symbol,renderer,filter,canvas,interaction,split,statistic,charts,pie,LayerSwitcher,toolbar,animation
* @version v3.1.2
* @author Jean-Marc Viglino
* @see https://github.com/Viglino/ol-ext#,
* @license BSD-3-Clause
*/
window.ol&&!ol.ext&&(ol.ext={}),ol.ext.inherits=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t},window.ol&&(ol.inherits||(ol.inherits=ol.ext.inherits)),ol.ext.Ajax=function(t){t=t||{},ol.Object.call(this),this._auth=t.auth,this.set("dataType",t.dataType||"JSON")},ol.ext.inherits(ol.ext.Ajax,ol.Object),ol.ext.Ajax.get=function(t){var e=new ol.ext.Ajax(t);t.success&&e.on("success",function(e){t.success(e.response,e)}),t.error&&e.on("error",function(e){t.error(e)}),e.send(t.url,t.data,t.options)},ol.ext.Ajax.prototype.send=function(t,e,o){var i=this,r=!1!==(o=o||{}).encode;r&&(t=encodeURI(t));var n="";for(var s in e)e.hasOwnProperty(s)&&void 0!==e[s]&&(n+=(n?"&":"?")+s+"="+(r?encodeURIComponent(e[s]):e[s]));this._request&&!1!==o.abort&&this._request.abort();var a=this._request=new XMLHttpRequest;a.open("GET",t+n,!0),this._auth&&a.setRequestHeader("Authorization","Basic "+this._auth),this.dispatchEvent({type:"loadstart"}),a.onload=function(){if(i._request=null,i.dispatchEvent({type:"loadend"}),this.status>=200&&this.status<400){var t;try{switch(i.get("dataType")){case"JSON":t=JSON.parse(this.response);break;default:t=this.response}}catch(t){return void i.dispatchEvent({type:"error",status:0,statusText:"parsererror",error:t,options:o,jqXHR:this})}i.dispatchEvent({type:"success",response:t,status:this.status,statusText:this.statusText,options:o,jqXHR:this})}else i.dispatchEvent({type:"error",status:this.status,statusText:this.statusText,options:o,jqXHR:this})},a.onerror=function(){i._request=null,i.dispatchEvent({type:"loadend"}),i.dispatchEvent({type:"error",status:this.status,statusText:this.statusText,options:o,jqXHR:this})},a.send()},ol.ext.element={},ol.ext.element.create=function(t,e){var o;if(e=e||{},"TEXT"===t)o=document.createTextNode(e.html||""),e.parent&&e.parent.appendChild(o);else for(var i in o=document.createElement(t),/button/i.test(t)&&o.setAttribute("type","button"),e)switch(i){case"className":e.className&&e.className.trim&&o.setAttribute("class",e.className.trim());break;case"html":e.html instanceof Element?o.appendChild(e.html):void 0!==e.html&&(o.innerHTML=e.html);break;case"parent":e.parent.appendChild(o);break;case"style":this.setStyle(o,e.style);break;case"change":case"click":ol.ext.element.addListener(o,i,e[i]);break;case"on":for(var r in e.on)ol.ext.element.addListener(o,r,e.on[r]);break;case"checked":o.checked=!!e.checked;break;default:o.setAttribute(i,e[i])}return o},ol.ext.element.setHTML=function(t,e){e instanceof Element?t.appendChild(e):void 0!==e&&(t.innerHTML=e)},ol.ext.element.appendText=function(t,e){t.appendChild(document.createTextNode(e||""))},ol.ext.element.addListener=function(t,e,o){"string"==typeof e&&(e=e.split(" ")),e.forEach(function(e){t.addEventListener(e,o)})},ol.ext.element.removeListener=function(t,e,o){"string"==typeof e&&(e=e.split(" ")),e.forEach(function(e){t.removeEventListener(e,o)})},ol.ext.element.show=function(t){t.style.display=""},ol.ext.element.hide=function(t){t.style.display="none"},ol.ext.element.hidden=function(t){return"none"===ol.ext.element.getStyle(t,"display")},ol.ext.element.toggle=function(t){t.style.display="none"===t.style.display?"":"none"},ol.ext.element.setStyle=function(t,e){for(var o in e)switch(o){case"top":case"left":case"bottom":case"right":case"minWidth":case"maxWidth":case"width":case"height":"number"==typeof e[o]?t.style[o]=e[o]+"px":t.style[o]=e[o];break;default:t.style[o]=e[o]}},ol.ext.element.getStyle=function(t,e){var o,i=(t.ownerDocument||document).defaultView;if(i&&i.getComputedStyle)e=e.replace(/([A-Z])/g,"-$1").toLowerCase(),o=i.getComputedStyle(t,null).getPropertyValue(e);else if(t.currentStyle&&(e=e.replace(/-(\w)/g,function(t,e){return e.toUpperCase()}),o=t.currentStyle[e],/^\d+(em|pt|%|ex)?$/i.test(o)))return function(e){var o=t.style.left,i=t.runtimeStyle.left;return t.runtimeStyle.left=t.currentStyle.left,t.style.left=e||0,e=t.style.pixelLeft+"px",t.style.left=o,t.runtimeStyle.left=i,e}(o);return/px$/.test(o)?parseInt(o):o},ol.ext.element.outerHeight=function(t){return t.offsetHeight+ol.ext.element.getStyle(t,"marginBottom")},ol.ext.element.outerWidth=function(t){return t.offsetWidth+ol.ext.element.getStyle(t,"marginLeft")},ol.ext.element.offsetRect=function(t){var e=t.getBoundingClientRect();return{top:e.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),left:e.left+(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0),height:e.height||e.bottom-e.top,width:e.widtth||e.right-e.left}},ol.ext.element.scrollDiv=function(t,e){var o,i=!1,r=0,n=0,s="function"==typeof e.onmove?e.onmove:function(){},a=e.vertical?"pageY":"pageX",l=e.vertical?"scrollTop":"scrollLeft";t.querySelectorAll("img").forEach(function(t){t.ondragstart=function(){return!1}}),ol.ext.element.addListener(t,["mousedown"],function(e){i=e[a],n=new Date,t.classList.add("ol-move")}),ol.ext.element.addListener(window,["mousemove"],function(e){if(!1!==i){var c=i-e[a];t[l]+=c,(o=new Date)-n&&(r=(r+c/(o-n))/2),i=e[a],n=o,c&&s(!0)}else s(!1)}),ol.ext.element.addListener(window,["mouseup"],function(e){t.classList.remove("ol-move"),(n=new Date-n)>100?r=0:n>0&&(r=((r||0)+(i-e[a])/n)/2),t[l]+=100*r,i=!1,r=0,n=0}),e.mousewheel&&!t.classList.contains("ol-touch")&&ol.ext.element.addListener(t,["mousewheel","DOMMouseScroll","onmousewheel"],function(e){var o=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail));return t.classList.add("ol-move"),t[l]-=30*o,!1})},window.ol&&!ol.sphere&&(ol.sphere={},ol.sphere.getDistance=function(t,e,o){return new ol.Sphere(o||6371008.8).haversineDistance(t,e)},ol.sphere.getArea=ol.Sphere.getArea,ol.sphere.getLength=ol.Sphere.getLength),ol.control.CanvasBase=function(t){t||(t={}),this.setStyle(t.style),ol.control.Control.call(this,t)},ol.ext.inherits(ol.control.CanvasBase,ol.control.Control),ol.control.CanvasBase.prototype.setMap=function(t){var e=this.getMap();this._listener&&(ol.Observable.unByKey(this._listener),this._listener=null),ol.control.Control.prototype.setMap.call(this,t),e&&e.renderSync(),t&&(this._listener=t.on("postcompose",this._draw.bind(this)))},ol.control.CanvasBase.prototype.getContext=function(t){var e=t.context;if(!e){for(var o=this.getMap().getViewport().querySelectorAll("canvas.ol-fixed-canvas-layer"),i=o.length-1;i>=0&&(!(e=o[i].getContext("2d")).canvas.width||!e.canvas.height);i--);if(!e){var r=document.createElement("canvas"),n=new ol.layer.Image({source:new ol.source.ImageCanvas({canvasFunction:function(t,e,o,i){return r.setAttribute("width",i[0]),r.setAttribute("height",i[1]),r}.bind(this)}),zIndex:999});n.setMap(this.getMap()),n.on("postrender",function(t){t.context.canvas.classList.add("ol-fixed-canvas-layer"),t.context.canvas.style.width=t.context.canvas.width/t.frameState.pixelRatio+"px"}.bind(this))}}return e},ol.control.CanvasBase.prototype.setStyle=function(t){this._style=t||new ol.style.Style({})},ol.control.CanvasBase.prototype.getStroke=function(){return this._style.getStroke()||this._style.setStroke(new ol.style.Stroke({color:"#000",width:3})),this._style.getStroke()},ol.control.CanvasBase.prototype.getFill=function(){return this._style.getFill()||this._style.setFill(new ol.style.Fill({color:"#fff"})),this._style.getFill()},ol.control.CanvasBase.prototype.getTextStroke=function(){var t=this._style.getText();return t||(t=new ol.style.Text({})),t.getStroke()||t.setStroke(new ol.style.Stroke({color:"#fff",width:3})),t.getStroke()},ol.control.CanvasBase.prototype.getTextFill=function(){var t=this._style.getText();return t||(t=new ol.style.Text({})),t.getFill()||t.setFill(new ol.style.Fill({color:"#fff",width:3})),t.getFill()},ol.control.CanvasBase.prototype.getTextFont=function(){var t=this._style.getText();return t||(t=new ol.style.Text({})),t.getFont()||t.setFont("12px sans-serif"),t.getFont()},ol.control.CanvasBase.prototype._draw=function(){console.warn("[CanvasBase] draw function not implemented.")},ol.control.SelectBase=function(t){var e;t||(t={}),this._features=this.setFeatures(t.features),t.target?e=document.createElement("div"):((e=document.createElement("div")).className="ol-select ol-unselectable ol-control ol-collapsed",ol.ext.element.create("BUTTON",{type:"button",on:{"click touchstart":function(t){e.classList.toggle("ol-collapsed"),t.preventDefault()}},parent:e})),t.className&&e.classList.add(t.className),e.appendChild(t.content),ol.ext.element.create("BUTTON",{html:t.btInfo||"OK",className:"ol-ok",on:{"click touchstart":this.doSelect.bind(this)},parent:t.content}),ol.control.Control.call(this,{element:e,target:t.target}),this.setSources(t.source)},ol.ext.inherits(ol.control.SelectBase,ol.control.Control),ol.control.SelectBase.prototype.setSources=function(t){t?this.set("source",t instanceof Array?t:[t]):this.unset("source")},ol.control.SelectBase.prototype.setFeatures=function(t){t instanceof ol.Collection?this._features=t:this._features=null},ol.control.SelectBase.prototype.getFeatures=function(){return this._features},ol.control.SelectBase.prototype.operationsList={"=":"=","!=":"≠","<":"<","<=":"≤",">=":"≥",">":">",contain:"⊂","!contain":"⊄",regexp:"≈"},ol.control.SelectBase.prototype._escape=function(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},ol.control.SelectBase.prototype._checkCondition=function(t,e,o){if(!e.attr)return!0;var i=t.get(e.attr);switch(e.op){case"=":return new RegExp("^"+this._escape(e.val)+"$",o?"":"i").test(i);case"!=":return!new RegExp("^"+this._escape(e.val)+"$",o?"":"i").test(i);case"<":return i<e.val;case"<=":return i<=e.val;case">":return i>e.val;case">=":return i>=e.val;case"contain":return new RegExp(this._escape(e.val),o?"":"i").test(i);case"!contain":return!new RegExp(this._escape(e.val),o?"":"i").test(i);case"regexp":return new RegExp(e.val,o?"":"i").test(i);default:return!1}},ol.control.SelectBase.prototype._selectFeatures=function(t,e,o,i,r){var n;o=o||[];for(var s=e.length-1;n=e[s];s--){for(var a,l=i,c=0;a=o[c];c++)a.attr&&(l=i?l&&this._checkCondition(n,a,r):l||this._checkCondition(n,a,r));l?t.push(n):this._features&&this._features.removeAt(s)}return t},ol.control.SelectBase.prototype.getSources=function(){if(this.get("source"))return this.get("source");var t=[];return this.getMap()&&function e(o){o.forEach(function(o){o.getLayers?e(o.getLayers()):o.getSource&&o.getSource()instanceof ol.source.Vector&&t.push(o.getSource())})}(this.getMap().getLayers()),t},ol.control.SelectBase.prototype.doSelect=function(t){var e=[];if((t=t||{}).features)this._selectFeatures(e,t.features,t.conditions,t.matchAll,t.useCase);else if(this._features)this._selectFeatures(e,this._features.getArray(),t.conditions,t.matchAll,t.useCase);else{(t.sources||this.getSources()).forEach(function(o){this._selectFeatures(e,o.getFeatures(),t.conditions,t.matchAll,t.useCase)}.bind(this))}return this.dispatchEvent({type:"select",features:e}),e},ol.control.Search=function(t){var e=this;t||(t={}),null==t.typing&&(t.typing=300),this._classname=t.className||"search";var o=(t.className||"")+" ol-search"+(t.target?"":" ol-unselectable ol-control ol-collapsed"),i=ol.ext.element.create("DIV",{className:o+" ol-collapsed"});if(t.target||(this.button=document.createElement("BUTTON"),this.button.setAttribute("type","button"),this.button.setAttribute("title",t.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 t=i.querySelectorAll("li"),o=0;o<t.length;o++)t[o].classList.remove("select");a.value||e.drawList_()}}),i.appendChild(this.button)),t.inputLabel){var r=document.createElement("LABEL");r.innerText=t.inputLabel,i.appendChild(r)}var n,s="",a=this._input=document.createElement("INPUT");a.setAttribute("type","search"),a.setAttribute("class","search"),a.setAttribute("placeholder",t.placeholder||"Search..."),a.addEventListener("change",function(t){e.dispatchEvent({type:"change:input",input:t,value:a.value})});var l=function(o){var r=i.querySelector("ul.autocomplete li.select"),l=a.value;"ArrowDown"==o.key||"ArrowUp"==o.key||"Down"==o.key||"Up"==o.key?r?(r.classList.remove("select"),(r=/Down/.test(o.key)?r.nextElementSibling:r.previousElementSibling)&&r.classList.add("select")):i.querySelector("ul.autocomplete li").classList.add("select"):"input"!=o.type||l?!r||"search"!=o.type&&"Enter"!=o.key?"search"==o.type||"Enter"==o.key||s!=l&&t.typing>=0?(s=l)?(n&&clearTimeout(n),n=setTimeout(function(){if(s.length>=e.get("minLength")){var t=e.autocomplete(s,function(t){e.drawList_(t)});t&&e.drawList_(t)}else e.drawList_()},t.typing)):e.drawList_():(r=i.querySelector("ul.autocomplete li"))&&r.classList.remove("select"):(i.classList.contains("ol-control")&&a.blur(),r.classList.remove("select"),s=l,e._handleSelect(e._list[r.getAttribute("data-search")])):e.drawList_()};a.addEventListener("keyup",l),a.addEventListener("search",l),a.addEventListener("cut",l),a.addEventListener("paste",l),a.addEventListener("input",l),t.noCollapse||(a.addEventListener("blur",function(){setTimeout(function(){i.classList.add("ol-collapsed")},200)}),a.addEventListener("focus",function(){i.classList.remove("ol-collapsed")})),i.appendChild(a);var c=document.createElement("UL");c.classList.add("autocomplete"),i.appendChild(c),ol.control.Control.call(this,{element:i,target:t.target}),"function"==typeof t.getTitle&&(this.getTitle=t.getTitle),"function"==typeof t.autocomplete&&(this.autocomplete=t.autocomplete),this.set("copy",t.copy),this.set("minLength",t.minLength||1),this.set("maxItems",t.maxItems||10),this.set("maxHistory",t.maxHistory||t.maxItems||10),this.restoreHistory(),this.drawList_()},ol.ext.inherits(ol.control.Search,ol.control.Control),ol.control.Search.prototype.getInputField=function(){return this._input},ol.control.Search.prototype.getTitle=function(t){return t.name||"No title"},ol.control.Search.prototype.search=function(){var t=this.element.querySelector("input.search");this._triggerCustomEvent("search",t)},ol.control.Search.prototype._triggerCustomEvent=function(t,e){var o;window.CustomEvent?o=new CustomEvent(t):(o=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,{}),e.dispatchEvent(o)},ol.control.Search.prototype.setInput=function(t,e){var o=this.element.querySelector("input.search");o.value=t,e&&this._triggerCustomEvent("keyup",o)},ol.control.Search.prototype.select=function(t){this.dispatchEvent({type:"select",search:t})},ol.control.Search.prototype._handleSelect=function(t){if(t){var e,o=this.get("history");try{var i=JSON.stringify(t);for(e=o.length-1;e>=0;e--)o[e]&&JSON.stringify(o[e])!==i||o.splice(e,1)}catch(i){for(e=o.length-1;e>=0;e--)o[e]===t&&o.splice(e,1)}for(o.unshift(t);o.length>(this.get("maxHistory")||10);)o.pop();this.saveHistory(),this.select(t)}},ol.control.Search.prototype.saveHistory=function(){if(this.get("maxHistory")>=0)try{localStorage["ol@search-"+this._classname]=JSON.stringify(this.get("history"))}catch(t){}else localStorage.removeItem("ol@search-"+this._classname)},ol.control.Search.prototype.restoreHistory=function(){try{this.set("history",JSON.parse(localStorage["ol@search-"+this._classname]))}catch(t){this.set("history",[])}},ol.control.Search.prototype.clearHistory=function(){this.set("history",[]),this.saveHistory(),this.drawList_()},ol.control.Search.prototype.getHistory=function(){return this.get("history")},ol.control.Search.prototype.autocomplete=function(t,e){return e([]),!1},ol.control.Search.prototype.drawList_=function(t){var e=this,o=this.element.querySelector("ul.autocomplete");if(o.innerHTML="",this._list=[],t)o.setAttribute("class","autocomplete");else{if(this.element.querySelector("input.search").value)return;t=this.get("history"),o.setAttribute("class","autocomplete history")}for(var i,r=Math.min(e.get("maxItems"),t.length),n=0;n<r;n++)if(t[n]&&(!n||!e.equalFeatures(t[n],t[n-1]))){(i=document.createElement("LI")).setAttribute("data-search",this._list.length),this._list.push(t[n]),i.addEventListener("click",function(t){e._handleSelect(e._list[t.currentTarget.getAttribute("data-search")])});var s=e.getTitle(t[n]);s instanceof Element?i.appendChild(s):i.innerHTML=s,o.appendChild(i)}r&&this.get("copy")&&((i=document.createElement("LI")).classList.add("copy"),i.innerHTML=this.get("copy"),o.appendChild(i))},ol.control.Search.prototype.equalFeatures=function(){return!1},ol.control.SearchJSON=function(t){(t=t||{}).className=t.className||"JSON",delete t.autocomplete,t.minLength=t.minLength||3,t.typing=t.typing||800,ol.control.Search.call(this,t);var e=t.url||"";if("https:"===window.location.protocol){var o=document.createElement("a");o.href=e,o.protocol=window.location.protocol,e=o.href}this.set("url",e),this._auth=t.authentication,"function"==typeof t.handleResponse&&(this.handleResponse=t.handleResponse)},ol.ext.inherits(ol.control.SearchJSON,ol.control.Search),ol.control.SearchJSON.prototype.autocomplete=function(t,e){var o=this.requestData(t),i=encodeURI(this.get("url")),r="";for(var n in o)r+=r?"&":"?",o.hasOwnProperty(n)&&(r+=n+"="+encodeURIComponent(o[n]));this.ajax(i+r,function(t){if(t.status>=200&&t.status<400){var o=JSON.parse(t.response);e(this.handleResponse(o))}else console.log(i+r,arguments)},function(){console.log(i+r,arguments)})},ol.control.SearchJSON.prototype.ajax=function(t,e,o){var i=this;this._request&&this._request.abort();var r=this._request=new XMLHttpRequest;r.open("GET",t,!0),this._auth&&r.setRequestHeader("Authorization","Basic "+this._auth),this.element.classList.add("searching"),r.onload=function(){i._request=null,i.element.classList.remove("searching"),e.call(i,this)},r.onerror=function(){i._request=null,i.element.classList.remove("searching"),o&&o.call(i)},r.send()},ol.control.SearchJSON.prototype.requestData=function(t){return{q:t}},ol.control.SearchJSON.prototype.handleResponse=function(t){return t},ol.control.SearchPhoton=function(t){(t=t||{}).className=t.className||"photon",t.url=t.url||"http://photon.komoot.de/api/",t.copy='<a href="http://www.openstreetmap.org/copyright" target="new">© OpenStreetMap contributors</a>',ol.control.SearchJSON.call(this,t),this.set("lang",t.lang),this.set("position",t.position)},ol.ext.inherits(ol.control.SearchPhoton,ol.control.SearchJSON),ol.control.SearchPhoton.prototype.getTitle=function(t){var e=t.properties;return(e.housenumber||"")+" "+(e.street||e.name||"")+"<i> "+(e.postcode||"")+" "+(e.city||"")+" ("+e.country+")</i>"},ol.control.SearchPhoton.prototype.requestData=function(t){var e={q:t,lang:this.get("lang"),limit:this.get("maxItems")};if(this.get("position")){var o=this.getMap().getView(),i=new ol.geom.Point(o.getCenter());i=i.transform(o.getProjection(),"EPSG:4326").getCoordinates(),e.lon=i[0],e.lat=i[1]}return e},ol.control.SearchPhoton.prototype.handleResponse=function(t){return t.features},ol.control.SearchPhoton.prototype.equalFeatures=function(t,e){return this.getTitle(t)===this.getTitle(e)&&t.geometry.coordinates[0]===e.geometry.coordinates[0]&&t.geometry.coordinates[1]===e.geometry.coordinates[1]},ol.control.SearchPhoton.prototype.select=function(t){var e=t.geometry.coordinates;try{e=ol.proj.transform(t.geometry.coordinates,"EPSG:4326",this.getMap().getView().getProjection())}catch(t){}this.dispatchEvent({type:"select",search:t,coordinate:e})},ol.control.SearchGeoportail=function(t){(t=t||{}).className=t.className||"IGNF",t.typing=t.typing||500,t.url="https://wxs.ign.fr/"+t.apiKey+"/ols/apis/completion",t.copy='<a href="https://www.geoportail.gouv.fr/" target="new">© IGN-Géoportail</a>',ol.control.SearchJSON.call(this,t),this.set("type",t.type||"StreetAddress,PositionOfInterest")},ol.ext.inherits(ol.control.SearchGeoportail,ol.control.SearchJSON),ol.control.SearchGeoportail.prototype.getTitle=function(t){return t.fulltext},ol.control.SearchGeoportail.prototype.requestData=function(t){return{text:t,type:"Commune"===this.get("type")?"PositionOfInterest":this.get("type")||"StreetAddress,PositionOfInterest",maximumResponses:this.get("maxItems")}},ol.control.SearchGeoportail.prototype.handleResponse=function(t){var e=t.results;if("Commune"===this.get("type"))for(var o=e.length-1;o>=0;o--)e[o].kind&&(e[o].classification>5||"Département"==e[o].kind)&&e.splice(o,1);return e},ol.control.SearchGeoportail.prototype.select=function(t){if(t.x||t.y){var e=[Number(t.x),Number(t.y)];try{e=ol.proj.transform(e,"EPSG:4326",this.getMap().getView().getProjection())}catch(t){}"Commune"===this.get("type")?this.searchCommune(t,function(){this.dispatchEvent({type:"select",search:t,coordinate:e})}):this.dispatchEvent({type:"select",search:t,coordinate:e})}else this.searchCommune(t)},ol.control.SearchGeoportail.prototype.searchCommune=function(t,e){var o='<?xml version="1.0" encoding="UTF-8"?><XLS xmlns:xls="http://www.opengis.net/xls" xmlns:gml="http://www.opengis.net/gml" xmlns="http://www.opengis.net/xls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="http://www.opengis.net/xls http://schemas.opengis.net/ols/1.2/olsAll.xsd"><RequestHeader/><Request requestID="1" version="1.2" methodName="LocationUtilityService"><GeocodeRequest returnFreeForm="false"><Address countryCode="PositionOfInterest"><freeFormAddress>'+t.fulltext+"+</freeFormAddress></Address></GeocodeRequest></Request></XLS>",i=this.get("url").replace("ols/apis/completion","geoportail/ols")+"?xls="+encodeURIComponent(o);this.ajax(i,function(o){var i=o.response;if(i){var r=(i=i.replace(/\n|\r/g,"")).replace(/.*<gml:pos>(.*)<\/gml:pos>.*/,"$1").split(" ");t.x=Number(r[1]),t.y=Number(r[0]),t.kind=i.replace(/.*<Place type="Nature">([^<]*)<\/Place>.*/,"$1"),t.insee=i.replace(/.*<Place type="INSEE">([^<]*)<\/Place>.*/,"$1"),(t.x||t.y)&&(e?e.call(this,[t]):this._handleSelect(t))}})},ol.control.LayerSwitcher=function(t){t=t||{};var e,o=this;this.dcount=0,this.show_progress=t.show_progress,this.oninfo="function"==typeof t.oninfo?t.oninfo:null,this.onextent="function"==typeof t.onextent?t.onextent:null,this.hasextent=t.extent||t.onextent,this.hastrash=t.trash,this.reordering=!1!==t.reordering,this._layers=[],"function"==typeof t.displayInLayerSwitcher&&(this.displayInLayerSwitcher=t.displayInLayerSwitcher),t.target?e=ol.ext.element.create("DIV",{className:t.switcherClass||"ol-layerswitcher"}):(e=ol.ext.element.create("DIV",{className:(t.switcherClass||"ol-layerswitcher")+" ol-unselectable ol-control ol-collapsed"}),this.button=ol.ext.element.create("BUTTON",{type:"button",parent:e}),this.button.addEventListener("touchstart",function(t){e.classList.toggle("ol-collapsed"),t.preventDefault(),o.overflow()}),this.button.addEventListener("click",function(){e.classList.toggle("ol-forceopen"),e.classList.add("ol-collapsed"),o.overflow()}),t.mouseover&&(e.addEventListener("mouseleave",function(){e.classList.add("ol-collapsed")}),e.addEventListener("mouseover",function(){e.classList.remove("ol-collapsed")})),this.topv=ol.ext.element.create("DIV",{className:"ol-switchertopdiv",parent:e,click:function(){o.overflow("+50%")}}),this.botv=ol.ext.element.create("DIV",{className:"ol-switcherbottomdiv",parent:e,click:function(){o.overflow("-50%")}})),this.panel_=ol.ext.element.create("UL",{className:"panel",parent:e}),ol.ext.element.addListener(this.panel_,"mousewheel DOMMouseScroll onmousewheel",function(t){o.overflow(Math.max(-1,Math.min(1,t.wheelDelta||-t.detail)))&&(t.stopPropagation(),t.preventDefault())}),this.header_=ol.ext.element.create("LI",{className:"ol-header",parent:this.panel_}),ol.control.Control.call(this,{element:e,target:t.target}),this.set("drawDelay",t.drawDelay||0)},ol.ext.inherits(ol.control.LayerSwitcher,ol.control.Control),ol.control.LayerSwitcher.prototype.tip={up:"up/down",down:"down",info:"informations...",extent:"zoom to extent",trash:"remove layer",plus:"expand/shrink"},ol.control.LayerSwitcher.prototype.displayInLayerSwitcher=function(t){return!1!==t.get("displayInLayerSwitcher")},ol.control.LayerSwitcher.prototype.setMap=function(t){ol.control.Control.prototype.setMap.call(this,t),this.drawPanel(),this._listener&&(this._listener&&ol.Observable.unByKey(this._listener.change),this._listener&&ol.Observable.unByKey(this._listener.moveend),this._listener&&ol.Observable.unByKey(this._listener.size)),this._listener=null,t&&(this._listener={change:t.getLayerGroup().on("change",this.drawPanel.bind(this)),moveend:t.on("moveend",this.viewChange.bind(this)),size:t.on("change:size",this.overflow.bind(this))})},ol.control.LayerSwitcher.prototype.show=function(){this.element.classList.add("ol-forceopen"),this.overflow()},ol.control.LayerSwitcher.prototype.hide=function(){this.element.classList.remove("ol-forceopen"),this.overflow()},ol.control.LayerSwitcher.prototype.toggle=function(){this.element.classList.toggle("ol-forceopen"),this.overflow()},ol.control.LayerSwitcher.prototype.isOpen=function(){return this.element.classList.contains("ol-forceopen")},ol.control.LayerSwitcher.prototype.setHeader=function(t){ol.ext.element.setHTML(this.header_,t)},ol.control.LayerSwitcher.prototype.overflow=function(t){if(this.button){if(ol.ext.element.hidden(this.panel_))return void ol.ext.element.setStyle(this.element,{height:"auto"});var e=ol.ext.element.outerHeight(this.element),o=ol.ext.element.outerHeight(this.panel_),i=this.button.offsetTop+ol.ext.element.outerHeight(this.button),r=this.panel_.offsetTop-i;if(o>e-i){ol.ext.element.setStyle(this.element,{height:"100%"});var n=2*ol.ext.element.getStyle(this.panel_.querySelectorAll("li.visible .li-content")[0],"height");switch(t){case 1:r+=n;break;case-1:r-=n;break;case"+50%":r+=Math.round(e/2);break;case"-50%":r-=Math.round(e/2)}return r+o<=e-3*i/2?(r=e-3*i/2-o,ol.ext.element.hide(this.botv)):ol.ext.element.show(this.botv),r>=0?(r=0,ol.ext.element.hide(this.topv)):ol.ext.element.show(this.topv),ol.ext.element.setStyle(this.panel_,{top:r+"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},ol.control.LayerSwitcher.prototype._setLayerForLI=function(t,e){this._layers.push({li:t,layer:e})},ol.control.LayerSwitcher.prototype._getLayerForLI=function(t){for(var e,o=0;e=this._layers[o];o++)if(e.li===t)return e.layer;return null},ol.control.LayerSwitcher.prototype.viewChange=function(){var t=this.getMap(),e=t.getView().getResolution();this.panel_.querySelectorAll("li").forEach(function(o){var i=this._getLayerForLI(o);if(i)if(i.getMaxResolution()<=e||i.getMinResolution()>=e)o.classList.add("ol-layer-hidden");else{var r=i.getExtent();if(r){var n=t.getView().calculateExtent(t.getSize());ol.extent.intersects(n,r)?o.classList.remove("ol-layer-hidden"):o.classList.add("ol-layer-hidden")}else o.classList.remove("ol-layer-hidden")}}.bind(this))},ol.control.LayerSwitcher.prototype.drawPanel=function(){if(this.getMap()){var t=this;this.dcount++,setTimeout(function(){t.drawPanel_()},this.get("drawDelay")||0)}},ol.control.LayerSwitcher.prototype.drawPanel_=function(){--this.dcount||this.dragging_||(this._layers=[],this.panel_.querySelectorAll("li").forEach(function(t){t.classList.contains("ol-header")||t.remove()}.bind(this)),this.drawList(this.panel_,this.getMap().getLayers()))},ol.control.LayerSwitcher.prototype.switchLayerVisibility=function(t,e){t.get("baseLayer")?(t.getVisible()||t.setVisible(!0),e.forEach(function(e){t!==e&&e.get("baseLayer")&&e.getVisible()&&e.setVisible(!1)})):t.setVisible(!t.getVisible())},ol.control.LayerSwitcher.prototype.testLayerVisibility=function(t){if(this.getMap()){var e=this.getMap().getView().getResolution();if(t.getMaxResolution()<=e||t.getMinResolution()>=e)return!1;var o=t.getExtent();if(o){var i=this.getMap().getView().calculateExtent(this.getMap().getSize());return ol.extent.intersects(i,o)}return!0}return!0},ol.control.LayerSwitcher.prototype.dragOrdering_=function(t){t.stopPropagation(),t.preventDefault();var e,o,i,r,n,s=this,a=t.currentTarget.parentNode.parentNode,l=!0,c=this.panel_,h=t.pageY||t.touches&&t.touches.length&&t.touches[0].pageY||t.changedTouches&&t.changedTouches.length&&t.changedTouches[0].pageY;function p(t){if(e=t.pageY||t.touches&&t.touches.length&&t.touches[0].pageY||t.changedTouches&&t.changedTouches.length&&t.changedTouches[0].pageY,l&&Math.abs(h-e)>2&&(l=!1,a.classList.add("drag"),r=s._getLayerForLI(a),o=!1,n=s._getLayerForLI(a.parentNode.parentNode),i=ol.ext.element.create("LI",{className:"ol-dragover",html:a.innerHTML,style:{position:"absolute","z-index":1e4,left:a.offsetLeft,opacity:.5,width:ol.ext.element.outerWidth(a),height:ol.ext.element.getStyle(a,"height")},parent:c}),s.element.classList.add("drag")),!l){var p;for(t.preventDefault(),t.stopPropagation(),ol.ext.element.setStyle(i,{top:e-ol.ext.element.offsetRect(c).top+c.scrollTop+5}),(p=t.touches?document.elementFromPoint(t.touches[0].clientX,t.touches[0].clientY):t.target).classList.contains("ol-switcherbottomdiv")?s.overflow(-1):p.classList.contains("ol-switchertopdiv")&&s.overflow(1);p&&"LI"!==p.tagName;)p=p.parentNode;p&&p.classList.contains("dropover")||a.parentNode.querySelectorAll("li").forEach(function(t){t.classList.remove("dropover"),t.classList.remove("dropover-after"),t.classList.remove("dropover-before")}),p&&p.parentNode.classList.contains("drag")&&p!==a?((o=s._getLayerForLI(p))&&!o.get("allwaysOnTop")==!r.get("allwaysOnTop")?(p.classList.add("dropover"),p.classList.add(a.offsetTop<p.offsetTop?"dropover-after":"dropover-before")):o=!1,ol.ext.element.show(i)):(o=!1,p===a?ol.ext.element.hide(i):ol.ext.element.show(i)),o?i.classList.remove("forbidden"):i.classList.add("forbidden")}}a.parentNode.classList.add("drag"),ol.ext.element.addListener(document,"mousemove touchmove",p),ol.ext.element.addListener(document,"mouseup touchend touchcancel",function t(){if(o){var e=r;if(e&&o){for(var l,c=(l=n?n.getLayers():s.getMap().getLayers()).getArray(),h=0;h<c.length;h++)if(c[h]==e){l.removeAt(h);break}for(var u=0;u<c.length;u++)if(c[u]==o){h>u?l.insertAt(u,e):l.insertAt(u+1,e);break}}}a.parentNode.querySelectorAll("li").forEach(function(t){t.classList.remove("dropover"),t.classList.remove("dropover-after"),t.classList.remove("dropover-before")}),a.classList.remove("drag"),a.parentNode.classList.remove("drag"),s.element.classList.remove("drag"),i&&i.remove(),ol.ext.element.removeListener(document,"mousemove touchmove",p),ol.ext.element.removeListener(document,"mouseup touchend touchcancel",t)})},ol.control.LayerSwitcher.prototype.dragOpacity_=function(t){t.stopPropagation(),t.preventDefault();var e=this,o=t.target,i=this._getLayerForLI(o.parentNode.parentNode.parentNode);if(i){var r=t.pageX||t.touches&&t.touches.length&&t.touches[0].pageX||t.changedTouches&&t.changedTouches.length&&t.changedTouches[0].pageX,n=ol.ext.element.getStyle(o,"left")-r;e.dragging_=!0,ol.ext.element.addListener(document,"mouseup touchend touchcancel",function t(){ol.ext.element.removeListener(document,"mouseup touchend touchcancel",t),ol.ext.element.removeListener(document,"mousemove touchmove",s),e.dragging_=!1}),ol.ext.element.addListener(document,"mousemove touchmove",s)}function s(t){var e=t.pageX||t.touches&&t.touches.length&&t.touches[0].pageX||t.changedTouches&&t.changedTouches.length&&t.changedTouches[0].pageX,r=(n+e)/ol.ext.element.getStyle(o.parentNode,"width"),s=Math.max(0,Math.min(1,r));ol.ext.element.setStyle(o,{left:100*s+"%"}),o.parentNode.nextElementSibling.innerHTML=Math.round(100*s),i.setOpacity(s)}},ol.control.LayerSwitcher.prototype.drawList=function(t,e){var o=this,i=e.getArray(),r=function(t){t.stopPropagation(),t.preventDefault();var i=o._getLayerForLI(this.parentNode.parentNode);o.switchLayerVisibility(i,e)};function n(t){t.stopPropagation(),t.preventDefault();var e=o._getLayerForLI(this.parentNode.parentNode);o.oninfo(e),o.dispatchEvent({type:"info",layer:e})}function s(t){t.stopPropagation(),t.preventDefault();var e=o._getLayerForLI(this.parentNode.parentNode);o.onextent?o.onextent(e):o.getMap().getView().fit(e.getExtent(),o.getMap().getSize()),o.dispatchEvent({type:"extent",layer:e})}function a(t){t.stopPropagation(),t.preventDefault();var e,i=this.parentNode.parentNode.parentNode.parentNode,r=o._getLayerForLI(i);r?(e=o._getLayerForLI(this.parentNode.parentNode),r.getLayers().remove(e),0!=r.getLayers().getLength()||r.get("noSwitcherDelete")||a.call(i.querySelectorAll(".layerTrash")[0],t)):(i=this.parentNode.parentNode,o.getMap().removeLayer(o._getLayerForLI(i)))}for(var l=i.length-1;l>=0;l--){var c=i[l];if(o.displayInLayerSwitcher(c)){var h=ol.ext.element.create("LI",{className:(c.getVisible()?"visible ":" ")+(c.get("baseLayer")?"baselayer":""),parent:t});this._setLayerForLI(h,c);var p=ol.ext.element.create("DIV",{className:"ol-layerswitcher-buttons",parent:h}),u=ol.ext.element.create("DIV",{className:"li-content"+(this.testLayerVisibility(c)?"":" ol-layer-hidden"),parent:h});if(ol.ext.element.create("INPUT",{type:c.get("baseLayer")?"radio":"checkbox",checked:c.getVisible(),click:r,parent:u}),ol.ext.element.create("LABEL",{html:c.get("title")||c.get("name"),title:c.get("title")||c.get("name"),click:r,unselectable:"on",style:{userSelect:"none"},parent:u}).addEventListener("selectstart",function(){return!1}),this.reordering&&(l<i.length-1&&(c.get("allwaysOnTop")||!i[l+1].get("allwaysOnTop"))||l>0&&(!c.get("allwaysOnTop")||i[l-1].get("allwaysOnTop")))&&ol.ext.element.create("DIV",{className:"layerup",title:this.tip.up,on:{"mousedown touchstart":function(t){o.dragOrdering_(t)}},parent:p}),c.getLayers){var d=0;c.getLayers().forEach(function(t){o.displayInLayerSwitcher(t)&&d++}),d&&ol.ext.element.create("DIV",{className:c.get("openInLayerSwitcher")?"collapse-layers":"expend-layers",title:this.tip.plus,click:function(){var t=o._getLayerForLI(this.parentNode.parentNode);t.set("openInLayerSwitcher",!t.get("openInLayerSwitcher"))},parent:p})}if(this.oninfo&&ol.ext.element.create("DIV",{className:"layerInfo",title:this.tip.info,click:n,parent:p}),this.hastrash&&!c.get("noSwitcherDelete")&&ol.ext.element.create("DIV",{className:"layerTrash",title:this.tip.trash,click:a,parent:p}),this.hasextent&&i[l].getExtent()){var g=i[l].getExtent();4==g.length&&g[0]<g[2]&&g[1]<g[3]&&ol.ext.element.create("DIV",{className:"layerExtent",title:this.tip.extent,click:s,parent:p})}if(this.show_progress&&c instanceof ol.layer.Tile){var f=ol.ext.element.create("DIV",{className:"layerswitcher-progress",parent:u});this.setprogress_(c),c.layerswitcher_progress=ol.ext.element.create("DIV",{parent:f})}var m=ol.ext.element.create("DIV",{className:"layerswitcher-opacity",click:function(t){if(t.target===this){t.stopPropagation(),t.preventDefault();var e=Math.max(0,Math.min(1,t.offsetX/ol.ext.element.getStyle(this,"width")));o._getLayerForLI(this.parentNode.parentNode).setOpacity(e)}},parent:u});if(ol.ext.element.create("DIV",{className:"layerswitcher-opacity-cursor",style:{left:100*c.getOpacity()+"%"},on:{"mousedown touchstart":function(t){o.dragOpacity_(t)}},parent:m}),ol.ext.element.create("DIV",{className:"layerswitcher-opacity-label",html:Math.round(100*c.getOpacity()),parent:u}),c.getLayers){if(h.classList.add("ol-layer-group"),!0===c.get("openInLayerSwitcher")){var y=ol.ext.element.create("UL",{parent:h});this.drawList(y,c.getLayers())}}else c instanceof ol.layer.Vector?h.classList.add("ol-layer-vector"):c instanceof ol.layer.VectorTile?h.classList.add("ol-layer-vector"):c instanceof ol.layer.Tile?h.classList.add("ol-layer-tile"):c instanceof ol.layer.Image?h.classList.add("ol-layer-image"):c instanceof ol.layer.Heatmap&&h.classList.add("ol-layer-heatmap");this.dispatchEvent({type:"drawlist",layer:c,li:h})}}this.viewChange(),t===this.panel_&&this.overflow()},ol.control.LayerSwitcher.prototype.setprogress_=function(t){if(!t.layerswitcher_progress){var e=0,o=0,i=function(){o===e?(o=e=0,ol.ext.element.setStyle(t.layerswitcher_progress,{width:0})):ol.ext.element.setStyle(t.layerswitcher_progress,{width:(e/o*100).toFixed(1)+"%"})};t.getSource().on("tileloadstart",function(){o++,i()}),t.getSource().on("tileloadend",function(){e++,i()}),t.getSource().on("tileloaderror",function(){e++,i()})}},ol.control.Bar=function(t){t||(t={});var e=document.createElement("div");if(e.classList.add("ol-unselectable","ol-control","ol-bar"),t.className){var o=t.className.split(" ").filter(function(t){return t.length>0});e.classList.add.apply(e.classList,o)}if(t.group&&e.classList.add("ol-group"),ol.control.Control.call(this,{element:e,target:t.target}),this.set("toggleOne",t.toggleOne),this.set("autoDeactivate",t.autoDeactivate),this.controls_=[],t.controls instanceof Array)for(var i=0;i<t.controls.length;i++)this.addControl(t.controls[i])},ol.ext.inherits(ol.control.Bar,ol.control.Control),ol.control.Bar.prototype.setVisible=function(t){this.element.style.display=t?"":"none"},ol.control.Bar.prototype.getVisible=function(){return"none"!=this.element.style.display},ol.control.Bar.prototype.setMap=function(t){ol.control.Control.prototype.setMap.call(this,t);for(var e=0;e<this.controls_.length;e++){this.controls_[e].setMap(t)}},ol.control.Bar.prototype.getControls=function(){return this.controls_},ol.control.Bar.prototype.setPosition=function(t){this.element.classList.remove("ol-left","ol-top","ol-bottom","ol-right"),t=t.split("-");for(var e=0;e<t.length;e++)switch(t[e]){case"top":case"left":case"bottom":case"right":this.element.classList.add("ol-"+t[e])}},ol.control.Bar.prototype.addControl=function(t){this.controls_.push(t),t.setTarget(this.element),this.getMap()&&this.getMap().addControl(t),t.on("change:active",this.onActivateControl_.bind(this)),t.getActive&&t.getActive()&&t.dispatchEvent({type:"change:active",key:"active",oldValue:!1,active:!0})},ol.control.Bar.prototype.deactivateControls=function(t){for(var e=0;e<this.controls_.length;e++)this.controls_[e]!==t&&this.controls_[e].setActive&&this.controls_[e].setActive(!1)},ol.control.Bar.prototype.getActiveControls=function(){for(var t,e=[],o=0;t=this.controls_[o];o++)t.getActive&&t.getActive()&&e.push(t);return e},ol.control.Bar.prototype.setActive=function(t){if(!t&&this.get("autoDeactivate")&&this.deactivateControls(),t)for(var e,o=this.getControls(),i=0;e=o[i];i++)e.get("autoActivate")&&e.setActive(!0)},ol.control.Bar.prototype.onActivateControl_=function(t){if(this.get("toggleOne"))if(t.active){var e,o=t.target;for(e=0;e<this.controls_.length&&this.controls_[e]!==o;e++);if(e==this.controls_.length)return;this.deactivateControls(this.controls_[e])}else if(!this.getActiveControls().length)for(var i,r=0;i=this.controls_[r];r++)if(i.get("autoActivate")){i.setActive(!0);break}},ol.control.Bar.prototype.getControlsByName=function(t){return this.getControls().filter(function(e){return e.get("name")===t})},ol.control.Button=function(t){t=t||{};var e=document.createElement("div");e.className=(t.className||"")+" ol-button ol-unselectable ol-control";var o=this,i=this.button_=document.createElement(/ol-text-button/.test(t.className)?"div":"button");i.type="button",t.title&&(i.title=t.title),t.html instanceof Element?i.appendChild(t.html):i.innerHTML=t.html||"";var r=function(e){e&&e.preventDefault&&(e.preventDefault(),e.stopPropagation()),t.handleClick&&t.handleClick.call(o,e)};i.addEventListener("click",r),i.addEventListener("touchstart",r),e.appendChild(i),!t.title&&i.firstElementChild&&(i.title=i.firstElementChild.title),ol.control.Control.call(this,{element:e,target:t.target}),t.title&&this.set("title",t.title),t.title&&this.set("title",t.title),t.name&&this.set("name",t.name)},ol.ext.inherits(ol.control.Button,ol.control.Control),ol.control.Button.prototype.setVisible=function(t){t?ol.ext.element.show(this.element):ol.ext.element.hide(this.element)},ol.control.Button.prototype.setTitle=function(t){this.button_.setAttribute("title",t)},ol.control.Button.prototype.setHtml=function(t){ol.ext.element.setHTML(this.button_,t)},ol.control.CanvasAttribution=function(t){t||(t={}),ol.control.Attribution.call(this,t),this.setCanvas(!!t.canvas),t||(t={}),t.style||(t.style=new ol.style.Style),this.setStyle(t.style)},ol.ext.inherits(ol.control.CanvasAttribution,ol.control.Attribution),ol.control.CanvasAttribution.prototype.setCanvas=function(t){this.isCanvas_=t,t&&this.setCollapsed(!1),this.element.style.visibility=t?"hidden":"visible",this.map_&&this.map_.renderSync()},ol.control.CanvasAttribution.prototype.getContext=ol.control.CanvasBase.prototype.getContext,ol.control.CanvasAttribution.prototype.setStyle=function(t){var e=t.getText();this.font_=e?e.getFont():"10px Arial";var o=e?e.getStroke():null,i=e?e.getFill():null;this.fontStrokeStyle_=o?ol.color.asString(o.getColor()):"#fff",this.fontFillStyle_=i?ol.color.asString(i.getColor()):"#000",this.fontStrokeWidth_=o?o.getWidth():3,this.getMap()&&this.getMap().render()},ol.control.CanvasAttribution.prototype.setMap=function(t){var e=this.getMap();this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,ol.control.ScaleLine.prototype.setMap.call(this,t),e&&e.renderSync(),t&&(this._listener=t.on("postcompose",this.drawAttribution_.bind(this))),this.map_=t,this.setCanvas(this.isCanvas_)},ol.control.CanvasAttribution.prototype.drawAttribution_=function(t){if(this.isCanvas_){var e=this.getContext(t);if(e){var o="";Array.prototype.slice.call(this.element.querySelectorAll("li")).filter(function(t){return"none"!==t.style.display}).map(function(t){o+=(o?" - ":"")+t.textContent});var i=t.frameState.pixelRatio;e.save(),e.scale(i,i);var r=this.element.getBoundingClientRect(),n=this.getMap().getViewport().getBoundingClientRect(),s=this.getMap().getSize()[0]/n.width;e.translate((r.left-n.left)*s,(r.top-n.top)*s);var a=this.element.clientHeight,l=this.element.clientWidth/2+this.element.querySelectorAll("button")[0].clientWidth;e.beginPath(),e.strokeStyle=this.fontStrokeStyle_,e.fillStyle=this.fontFillStyle_,e.lineWidth=this.fontStrokeWidth_,e.textAlign="center",e.textBaseline="middle",e.font=this.font_,e.strokeText(o,l,a/2),e.fillText(o,l,a/2),e.closePath(),e.restore()}}},ol.control.CanvasScaleLine=function(t){ol.control.ScaleLine.call(this,t),this.scaleHeight_=6,t||(t={}),t.style||(t.style=new ol.style.Style),this.setStyle(t.style)},ol.ext.inherits(ol.control.CanvasScaleLine,ol.control.ScaleLine),ol.control.CanvasScaleLine.prototype.getContext=ol.control.CanvasBase.prototype.getContext,ol.control.CanvasScaleLine.prototype.setMap=function(t){var e=this.getMap();this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,ol.control.ScaleLine.prototype.setMap.call(this,t),e&&e.renderSync(),t&&(this._listener=t.on("postcompose",this.drawScale_.bind(this))),this.element.style.visibility="hidden",this.olscale=this.element.querySelector(".ol-scale-line-inner")},ol.control.CanvasScaleLine.prototype.setStyle=function(t){var e=t.getStroke();this.strokeStyle_=e?ol.color.asString(e.getColor()):"#000",this.strokeWidth_=e?e.getWidth():2;var o=t.getFill();this.fillStyle_=o?ol.color.asString(o.getColor()):"#fff";var i=t.getText();this.font_=i?i.getFont():"10px Arial",e=i?i.getStroke():null,o=i?i.getFill():null,this.fontStrokeStyle_=e?ol.color.asString(e.getColor()):this.fillStyle_,this.fontStrokeWidth_=e?e.getWidth():3,this.fontFillStyle_=o?ol.color.asString(o.getColor()):this.strokeStyle_,this.getMap()&&this.getMap().render()},ol.control.CanvasScaleLine.prototype.drawScale_=function(t){if("hidden"===this.element.style.visibility){var e=this.getContext(t);if(e){var o=parseInt(this.olscale.style.width);if(o){var i=this.olscale.textContent,r={left:this.element.offsetLeft,top:this.element.offsetTop},n=t.frameState.pixelRatio;e.save(),e.scale(n,n),r.top+=this.element.clientHeight-this.scaleHeight_,e.beginPath(),e.strokeStyle=this.fontStrokeStyle_,e.fillStyle=this.fontFillStyle_,e.lineWidth=this.fontStrokeWidth_,e.textAlign="center",e.textBaseline="bottom",e.font=this.font_,e.strokeText(i,r.left+o/2,r.top),e.fillText(i,r.left+o/2,r.top),e.closePath(),r.top+=2,e.lineWidth=this.strokeWidth_,e.strokeStyle=this.strokeStyle_;for(var s=4,a=parseInt(i);a%10==0;)a/=10;a%5==0&&(s=5);for(var l=0;l<s;l++)e.beginPath(),e.fillStyle=l%2?this.fillStyle_:this.strokeStyle_,e.rect(r.left+l*o/s,r.top,o/s,this.scaleHeight_),e.stroke(),e.fill(),e.closePath();e.restore()}}}},ol.control.CanvasTitle=function(t){t||(t={});var e=ol.ext.element.create("DIV",{className:(t.className||"")+" ol-control-title ol-unselectable",style:{display:"block",visibility:"hidden"}});ol.control.CanvasBase.call(this,{element:e,style:t.style}),this.setTitle(t.title||"Title"),this.element.style.font=this.getTextFont()},ol.ext.inherits(ol.control.CanvasTitle,ol.control.CanvasBase),ol.control.CanvasTitle.prototype.setStyle=function(t){ol.control.CanvasBase.prototype.setStyle.call(this,t),this.element&&(this.element.style.font=this.getTextFont()),this.getMap()&&this.getMap().render()},ol.control.CanvasTitle.prototype.setTitle=function(t){this.element.textContent=t,this.set("title",t),this.getMap()&&this.getMap().renderSync()},ol.control.CanvasTitle.prototype.getTitle=function(){return this.get("title")},ol.control.CanvasTitle.prototype.setVisible=function(t){this.element.style.display=t?"block":"none",this.getMap()&&this.getMap().renderSync()},ol.control.CanvasTitle.prototype.getVisible=function(){return"none"!==this.element.style.display},ol.control.CanvasTitle.prototype._draw=function(t){if(this.getVisible()){var e=this.getContext(t);if(e){var o=t.frameState.pixelRatio;e.save(),e.scale(o,o);var i=this.element.getBoundingClientRect(),r=this.getMap().getViewport().getBoundingClientRect(),n=this.getMap().getSize()[0]/r.width;e.translate((i.left-r.left)*n,(i.top-r.top)*n);var s=this.element.clientHeight,a=this.element.clientWidth,l=a/2;e.beginPath(),e.fillStyle=ol.color.asString(this.getFill().getColor()),e.rect(0,0,a,s),e.fill(),e.closePath(),e.beginPath(),e.fillStyle=ol.color.asString(this.getTextFill().getColor()),e.strokeStyle=ol.color.asString(this.getTextStroke().getColor()),e.lineWidth=this.getTextStroke().getWidth(),e.textAlign="center",e.textBaseline="middle",e.font=this.getTextFont(),e.lineWidth&&e.strokeText(this.getTitle(),l,s/2),e.fillText(this.getTitle(),l,s/2),e.closePath(),e.restore()}}},ol.control.CenterPosition=function(t){t||(t={});var e=ol.ext.element.create("DIV",{className:(t.className||"")+" ol-center-position ol-unselectable",style:{display:"block",visibility:"hidden"}});ol.control.CanvasBase.call(this,{element:e,style:t.style}),this.element.style.font=this.getTextFont(),this.set("projection",t.projection),this.setCanvas(t.canvas),this._format="function"==typeof t.coordinateFormat?t.coordinateFormat:ol.coordinate.toStringXY},ol.ext.inherits(ol.control.CenterPosition,ol.control.CanvasBase),ol.control.CenterPosition.prototype.setStyle=function(t){ol.control.CanvasBase.prototype.setStyle.call(this,t),this.element&&(this.element.style.font=this.getTextFont()),this.getMap()&&this.getMap().render()},ol.control.CenterPosition.prototype.setCanvas=function(t){this.set("canvas",t),this.element.style.visibility=t?"hidden":"visible",this.getMap()&&this.getMap().renderSync()},ol.control.CenterPosition.prototype.setVisible=function(t){this.element.style.display=t?"":"none",this.getMap()&&this.getMap().renderSync()},ol.control.CenterPosition.prototype.getVisible=function(){return"none"!==this.element.style.display},ol.control.CenterPosition.prototype._draw=function(t){if(this.getVisible()&&this.getMap()){var e=this.getMap().getView().getCenter();if(this.get("projection")&&(e=ol.proj.transform(e,this.getMap().getView().getProjection(),this.get("projection"))),e=this._format(e),this.element.textContent=e,this.get("canvas")){var o=this.getContext(t);if(o){var i=t.frameState.pixelRatio;o.save(),o.scale(i,i);var r=this.element.getBoundingClientRect(),n=this.getMap().getViewport().getBoundingClientRect(),s=this.getMap().getSize()[0]/n.width;o.translate((r.left-n.left)*s,(r.top-n.top)*s);var a=this.element.clientHeight,l=this.element.clientWidth;o.beginPath(),o.fillStyle=ol.color.asString(this.getTextFill().getColor()),o.strokeStyle=ol.color.asString(this.getTextStroke().getColor()),o.lineWidth=this.getTextStroke().getWidth(),o.textAlign="center",o.textBaseline="middle",o.font=this.getTextFont(),o.lineWidth&&o.strokeText(e,l/2,a/2),o.fillText(e,l/2,a/2),o.closePath(),o.restore()}}}},ol.control.Compass=function(t){var e=this;t||(t={});var o=document.createElement("div");o.className="ol-compassctrl ol-unselectable ol-hidden"+(t.className?" "+t.className:""),o.style.position="absolute",o.style.visibility="hidden",ol.control.CanvasBase.call(this,{element:o}),this.set("rotateVithView",!1!==t.rotateWithView),this.style=t.style,t.image?this.img_=t.image:t.src?(this.img_=new Image,this.img_.onload=function(){e.getMap()&&e.getMap().renderSync()},this.img_.src=t.src):this.img_=this.defaultCompass_(this.element.clientWidth,this.style?this.style.getColor():""),this.da_=[];for(var i=0;i<8;i++)this.da_[i]=[Math.cos(Math.PI*i/8),Math.sin(Math.PI*i/8)]},ol.ext.inherits(ol.control.Compass,ol.control.CanvasBase),ol.control.Compass.prototype.setMap=function(t){var e=this.getMap();this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,ol.control.CanvasBase.prototype.setMap.call(this,t),e&&e.renderSync(),t&&(this._listener=t.on("postcompose",this.drawCompass_.bind(this)))},ol.control.Compass.prototype.defaultCompass_=function(t,e){var o=document.createElement("canvas"),i=o.getContext("2d"),r=(t=o.width=o.height=t||150)/2,n=.22*r;function s(t,o){i.fillStyle=e||"#963",i.beginPath(),i.moveTo(0,0),i.lineTo(t,0),i.lineTo(o,o),i.moveTo(0,0),i.lineTo(-t,0),i.lineTo(-o,-o),i.moveTo(0,0),i.lineTo(0,t),i.lineTo(-o,o),i.moveTo(0,0),i.lineTo(0,-t),i.lineTo(o,-o),i.moveTo(0,0),i.fill(),i.stroke()}function a(t,e){i.globalCompositeOperation="destination-out",i.fillStyle="#fff",i.beginPath(),i.moveTo(0,0),i.lineTo(t,0),i.lineTo(e,-e),i.moveTo(0,0),i.lineTo(-t,0),i.lineTo(-e,e),i.moveTo(0,0),i.lineTo(0,t),i.lineTo(e,e),i.moveTo(0,0),i.lineTo(0,-t),i.lineTo(-e,-e),i.moveTo(0,0),i.fill(),i.globalCompositeOperation="source-over",i.beginPath(),i.moveTo(0,0),i.lineTo(t,0),i.lineTo(e,-e),i.moveTo(0,0),i.lineTo(-t,0),i.lineTo(-e,e),i.moveTo(0,0),i.lineTo(0,t),i.lineTo(e,e),i.moveTo(0,0),i.lineTo(0,-t),i.lineTo(-e,-e),i.moveTo(0,0),i.stroke()}return i.translate(r,r),i.strokeStyle=e||"#963",i.lineWidth=1.5,i.beginPath(),i.arc(0,0,.41*t,0,2*Math.PI),i.arc(0,0,.44*t,0,2*Math.PI),i.stroke(),i.rotate(Math.PI/4),s(.9*r,.8*n),a(.9*r,.8*n),i.rotate(-Math.PI/4),s(r,n),a(r,n),o},ol.control.Compass.prototype.drawCompass_=function(t){var e=this.getContext(t),o=e.canvas,i=t.frameState.pixelRatio;e.save(),e.scale(i,i);var r=this.element.clientWidth,n=this.element.clientHeight,s=this.element.offsetLeft,a=this.element.offsetTop,l=this.img_,c=t.frameState.viewState.rotation;if(e.beginPath(),e.translate(s+r/2,a+n/2),this.get("rotateVithView")&&e.rotate(c),this.style){e.beginPath(),e.strokeStyle=this.style.getColor(),e.lineWidth=this.style.getWidth();for(var h=Math.max(o.width,o.height),p=0;p<8;p++)e.moveTo(-this.da_[p][0]*h,-this.da_[p][1]*h),e.lineTo(this.da_[p][0]*h,this.da_[p][1]*h);e.stroke()}l.width&&e.drawImage(l,-r/2,-n/2,r,n),e.closePath(),e.restore()},ol.control.Disable=function(t){t=t||{};var e=document.createElement("div");e.className=(t.className||" ol-disable ol-unselectable ol-control").trim();var o={top:"0px",left:"0px",right:"0px",bottom:"0px",zIndex:1e4,background:"none",display:"none"};Object.keys(o).forEach(function(t){e.style[t]=o[t]}),ol.control.Control.call(this,{element:e})},ol.ext.inherits(ol.control.Disable,ol.control.Control),ol.control.Disable.prototype.isOn=function(){return this.element.classList.contains("ol-disable")},ol.control.Disable.prototype.disableMap=function(t){t?this.element.classList.add("ol-enable").show():this.element.classList.remove("ol-enable").hide()},ol.control.EditBar=function(t){(t=t||{}).interactions=t.interactions||{},ol.control.Bar.call(this,{className:(t.className?t.className+" ":"")+"ol-editbar",toggleOne:!0,target:t.target}),this._source=t.source,this._interactions={},this._setSelectInteraction(t),!1!==t.edition&&this._setEditInteraction(t),this._setModifyInteraction(t)},ol.ext.inherits(ol.control.EditBar,ol.control.Bar),ol.control.EditBar.prototype.setMap=function(t){this.getMap()&&(this._interactions.Delete&&this.getMap().removeInteraction(this._interactions.Delete),this._interactions.ModifySelect&&this.getMap().removeInteraction(this._interactions.ModifySelect)),ol.control.Bar.prototype.setMap.call(this,t),this.getMap()&&(this._interactions.Delete&&this.getMap().addInteraction(this._interactions.Delete),this._interactions.ModifySelect&&this.getMap().addInteraction(this._interactions.ModifySelect))},ol.control.EditBar.prototype.getInteraction=function(t){return this._interactions[t]},ol.control.EditBar.prototype._getTitle=function(t){return t&&t.title?t.title:t},ol.control.EditBar.prototype._setSelectInteraction=function(t){var e,o=this,i=new ol.control.Bar;if(!1!==t.interactions.Delete){t.interactions.Delete instanceof ol.interaction.Delete?this._interactions.Delete=t.interactions.Delete:this._interactions.Delete=new ol.interaction.Delete;var r=this._interactions.Delete;r.setActive(!1),this.getMap()&&this.getMap().addInteraction(r),i.addControl(new ol.control.Button({className:"ol-delete",title:this._getTitle(t.interactions.Delete)||"Delete",handleClick:function(t){r.delete(e.getInteraction().getFeatures()),console.log("del");var o={type:"select",selected:[],deselected:e.getInteraction().getFeatures().getArray().slice(),mapBrowserEvent:t.mapBrowserEvent};e.getInteraction().getFeatures().clear(),e.getInteraction().dispatchEvent(o)}}))}if(!1!==t.interactions.Info&&i.addControl(new ol.control.Button({className:"ol-info",title:this._getTitle(t.interactions.Info)||"Show informations",handleClick:function(){o.dispatchEvent({type:"info",features:e.getInteraction().getFeatures()})}})),!1!==t.interactions.Select){t.interactions.Select instanceof ol.interaction.Select?this._interactions.Select=t.interactions.Select:this._interactions.Select=new ol.interaction.Select({condition:ol.events.condition.click});var n=this._interactions.Select;e=new ol.control.Toggle({className:"ol-selection",title:this._getTitle(t.interactions.Select)||"Select",interaction:n,bar:i.getControls().length?i:void 0,autoActivate:!0,active:!0}),this.addControl(e),n.on("change:active",function(){n.getFeatures().clear()})}},ol.control.EditBar.prototype._setEditInteraction=function(t){if(!1!==t.interactions.DrawPoint){t.interactions.DrawPoint instanceof ol.interaction.Draw?this._interactions.DrawPoint=t.interactions.DrawPoint:this._interactions.DrawPoint=new ol.interaction.Draw({type:"Point",source:this._source});var e=new ol.control.Toggle({className:"ol-drawpoint",title:this._getTitle(t.interactions.DrawPoint)||"Point",interaction:this._interactions.DrawPoint});this.addControl(e)}if(!1!==t.interactions.DrawLine){t.interactions.DrawLine instanceof ol.interaction.Draw?this._interactions.DrawLine=t.interactions.DrawLine:this._interactions.DrawLine=new ol.interaction.Draw({type:"LineString",source:this._source,geometryFunction:function(t,e){return e?e.setCoordinates(t):e=new ol.geom.LineString(t),this.nbpts=e.getCoordinates().length,e}});var o=new ol.control.Toggle({className:"ol-drawline",title:this._getTitle(t.interactions.DrawLine)||"LineString",interaction:this._interactions.DrawLine,bar:new ol.control.Bar({controls:[new ol.control.TextButton({html:this._getTitle(t.interactions.UndoDraw)||"undo",title:this._getTitle(t.interactions.UndoDraw)||"delete last point",handleClick:function(){o.getInteraction().nbpts>1&&o.getInteraction().removeLastPoint()}}),new ol.control.TextButton({html:this._getTitle(t.interactions.FinishDraw)||"finish",title:this._getTitle(t.interactions.FinishDraw)||"finish",handleClick:function(){o.getInteraction().nbpts>2&&o.getInteraction().finishDrawing()}})]})});this.addControl(o)}if(!1!==t.interactions.DrawPolygon&&(t.interactions.DrawPolygon instanceof ol.interaction.Draw?this._interactions.DrawPolygon=t.interactions.DrawPolygon:this._interactions.DrawPolygon=new ol.interaction.Draw({type:"Polygon",source:this._source,geometryFunction:function(t,e){return this.nbpts=t[0].length,e?e.setCoordinates([t[0].concat([t[0][0]])]):e=new ol.geom.Polygon(t),e}}),this._setDrawPolygon("ol-drawpolygon",this._interactions.DrawPolygon,this._getTitle(t.interactions.DrawPolygon)||"Polygon",t)),!1!==t.interactions.DrawHole&&(t.interactions.DrawHole instanceof ol.interaction.DrawHole?this._interactions.DrawHole=t.interactions.DrawHole:this._interactions.DrawHole=new ol.interaction.DrawHole,this._setDrawPolygon("ol-drawhole",this._interactions.DrawHole,this._getTitle(t.interactions.DrawHole)||"Hole",t)),!1!==t.interactions.DrawRegular){t.interactions.DrawRegular instanceof ol.interaction.DrawRegular?this._interactions.DrawRegular=t.interactions.DrawRegular:this._interactions.DrawRegular=new ol.interaction.DrawRegular({source:this._source,sides:4});var i=this._interactions.DrawRegular,r=document.createElement("DIV"),n=ol.ext.element.create("DIV",{parent:r});ol.ext.element.addListener(n,["click","touchstart"],function(){var t=i.getSides()-1;t<2&&(t=2),i.setSides(t),s.textContent=t>2?t+" pts":"circle"}.bind(this));var s=ol.ext.element.create("TEXT",{html:"4 pts",parent:r}),a=ol.ext.element.create("DIV",{parent:r});ol.ext.element.addListener(a,["click","touchstart"],function(){var t=i.getSides()+1;t<3&&(t=3),i.setSides(t),s.textContent=t+" pts"}.bind(this));var l=new ol.control.Toggle({className:"ol-drawregular",title:this._getTitle(t.interactions.DrawRegular)||"Regular",interaction:this._interactions.DrawRegular,bar:new ol.control.Bar({controls:[new ol.control.TextButton({html:r})]})});this.addControl(l)}},ol.control.EditBar.prototype._setDrawPolygon=function(t,e,o,i){var r=new ol.control.Toggle({className:t,title:o,interaction:e,bar:new ol.control.Bar({controls:[new ol.control.TextButton({html:this._getTitle(i.interactions.UndoDraw)||"undo",title:this._getTitle(i.interactions.UndoDraw)||"undo last point",handleClick:function(){r.getInteraction().nbpts>1&&r.getInteraction().removeLastPoint()}}),new ol.control.TextButton({html:this._getTitle(i.interactions.FinishDraw)||"finish",title:this._getTitle(i.interactions.FinishDraw)||"finish",handleClick:function(){r.getInteraction().nbpts>3&&r.getInteraction().finishDrawing()}})]})});this.addControl(r)},ol.control.EditBar.prototype._setModifyInteraction=function(t){if(!1!==t.interactions.ModifySelect&&!1!==t.interactions.Select&&(t.interactions.ModifySelect instanceof ol.interaction.ModifyFeature?this._interactions.ModifySelect=t.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!==t.interactions.Transform){t.interactions.Transform instanceof ol.interaction.Transform?this._interactions.Transform=t.interactions.Transform:this._interactions.Transform=new ol.interaction.Transform({addCondition:ol.events.condition.shiftKeyOnly});var e=new ol.control.Toggle({html:"<i></i>",className:"ol-transform",title:this._getTitle(t.interactions.Transform)||"Transform",interaction:this._interactions.Transform});this.addControl(e)}if(!1!==t.interactions.Split){t.interactions.Split instanceof ol.interaction.Split?this._interactions.Split=t.interactions.Split:this._interactions.Split=new ol.interaction.Split({sources:this._source});var o=new ol.control.Toggle({className:"ol-split",title:this._getTitle(t.interactions.Split)||"Split",interaction:this._interactions.Split});this.addControl(o)}if(!1!==t.interactions.Offset){t.interactions.Offset instanceof ol.interaction.Offset?this._interactions.Offset=t.interactions.Offset:this._interactions.Offset=new ol.interaction.Offset({source:this._source});var i=new ol.control.Toggle({html:"<i></i>",className:"ol-offset",title:this._getTitle(t.interactions.Offset)||"Offset",interaction:this._interactions.Offset});this.addControl(i)}},ol.control.Gauge=function(t){t=t||{};var e=document.createElement("div");e.className=((t.className||"")+" ol-gauge ol-unselectable ol-control").trim(),this.title_=document.createElement("span"),e.appendChild(this.title_),this.gauge_=document.createElement("button"),this.gauge_.setAttribute("type","button"),e.appendChild(document.createElement("div").appendChild(this.gauge_)),this.gauge_.style.width="0px",ol.control.Control.call(this,{element:e,target:t.target}),this.setTitle(t.title),this.val(t.val),this.set("max",t.max||100)},ol.ext.inherits(ol.control.Gauge,ol.control.Control),ol.control.Gauge.prototype.setTitle=function(t){this.title_.innerHTML=t||"",this.title_.display=t?"":"none"},ol.control.Gauge.prototype.val=function(t){return void 0!==t&&(this.val_=t,this.gauge_.style.width=t/this.get("max")*100+"%"),this.val_},ol.control.GeoBookmark=function(t){t=t||{};var e=this,o=document.createElement("div");t.target?o.className=t.className||"ol-bookmark":(o.className=(t.className||"ol-bookmark")+" ol-unselectable ol-control ol-collapsed",o.addEventListener("mouseleave",function(){n!==document.activeElement&&(i.style.display="none")}),this.button=document.createElement("button"),this.button.setAttribute("type","button"),this.button.addEventListener("click",function(){i.style.display=""===i.style.display||"none"===i.style.display?"block":"none"}),o.appendChild(this.button));var i=document.createElement("div");o.appendChild(i);var r=document.createElement("ul");i.appendChild(r);var n=document.createElement("input");n.setAttribute("placeholder",t.placeholder||"Add a new geomark..."),n.addEventListener("change",function(){var t=this.value;t&&(e.addBookmark(t),this.value="",e.dispatchEvent({type:"add",name:t})),i.style.display="none"}),n.addEventListener("blur",function(){i.style.display="none"}),i.appendChild(n),ol.control.Control.call(this,{element:o,target:t.target}),this.on("propertychange",function(t){"editable"===t.key&&(o.className=o.className.replace(" ol-editable",""),this.get("editable")&&(o.className+=" ol-editable"))}.bind(this)),this.set("namespace",t.namespace||"ol"),this.set("editable",!1!==t.editable),this.setBookmarks(localStorage[this.get("namespace")+"@bookmark"]?null:t.marks)},ol.ext.inherits(ol.control.GeoBookmark,ol.control.Control),ol.control.GeoBookmark.prototype.setBookmarks=function(t){t||(t=JSON.parse(localStorage[this.get("namespace")+"@bookmark"]||"{}"));var e=this.get("editable"),o=this.element.querySelector("ul"),i=this.element.querySelector("div"),r=this;for(var n in o.innerHTML="",t){var s=document.createElement("li");if(s.textContent=n,s.setAttribute("data-bookmark",JSON.stringify(t[n])),s.addEventListener("click",function(){var t=JSON.parse(this.getAttribute("data-bookmark"));r.getMap().getView().setCenter(t.pos),r.getMap().getView().setZoom(t.zoom),i.style.display="none"}),o.appendChild(s),e&&!t[n].permanent){var a=document.createElement("button");a.setAttribute("data-name",n),a.setAttribute("title","Suppr."),a.addEventListener("click",function(t){r.removeBookmark(this.getAttribute("data-name")),r.dispatchEvent({type:"remove",name:this.getAttribute("data-name")}),t.stopPropagation()}),s.appendChild(a)}}localStorage[this.get("namespace")+"@bookmark"]=JSON.stringify(t)},ol.control.GeoBookmark.prototype.getBookmarks=function(){return JSON.parse(localStorage[this.get("namespace")+"@bookmark"]||"{}")},ol.control.GeoBookmark.prototype.removeBookmark=function(t){if(t){var e=this.getBookmarks();delete e[t],this.setBookmarks(e)}},ol.control.GeoBookmark.prototype.addBookmark=function(t,e,o,i){if(t){var r=this.getBookmarks();r[t]&&r[t].permanent||(r[t]={pos:e||this.getMap().getView().getCenter(),zoom:o||this.getMap().getView().getZoom(),permanent:!!i},this.setBookmarks(r))}},ol.control.GeolocationBar=function(t){t||(t={}),t.className=t.className||"ol-geobar",ol.control.Bar.call(this,t),this.setPosition(t.position||"bottom-right");var e=this.element,o=new ol.interaction.GeolocationDraw({source:t.source,zoom:t.zoom,followTrack:t.followTrack,minAccuracy:t.minAccuracy||1e4});this._geolocBt=new ol.control.Toggle({className:"geolocBt",interaction:o,onToggle:function(){o.pause(!0),o.setFollowTrack(t.followTrack),e.classList.remove("pauseTrack")}}),this.addControl(this._geolocBt),this._geolocBt.setActive(!1);var i=new ol.control.Bar;this.addControl(i);var r=new ol.control.TextButton({className:"centerBt",html:t.centerLabel||"center",handleClick:function(){o.setFollowTrack("auto")}});i.addControl(r);var n=new ol.control.Button({className:"startBt",handleClick:function(){o.pause(!1),o.setFollowTrack("auto"),e.classList.add("pauseTrack")}});i.addControl(n);var s=new ol.control.Button({className:"pauseBt",handleClick:function(){o.pause(!0),o.setFollowTrack("auto"),e.classList.remove("pauseTrack")}});i.addControl(s),o.on("follow",function(t){t.following?e.classList.remove("centerTrack"):e.classList.add("centerTrack")}),this._geolocBt.on("change:active",function(t){t.active?e.classList.add("ol-active"):e.classList.remove("ol-active")})},ol.ext.inherits(ol.control.GeolocationBar,ol.control.Bar),ol.control.GeolocationBar.prototype.getInteraction=function(){return this._geolocBt.getInteraction()},ol.control.Globe=function(t){var e,o=t||{},i=this;o.target?(e=document.createElement("div"),this.panel_=o.target):((e=document.createElement("div")).classList.add("ol-globe","ol-unselectable","ol-control"),/top/.test(o.align)&&e.classList.add("ol-control-top"),/right/.test(o.align)&&e.classList.add("ol-control-right"),this.panel_=document.createElement("div"),this.panel_.classList.add("panel"),e.appendChild(this.panel_),this.pointer_=document.createElement("div"),this.pointer_.classList.add("ol-pointer"),e.appendChild(this.pointer_)),ol.control.Control.call(this,{element:e,target:o.target}),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:o.layers}),setTimeout(function(){i.ovmap_.updateSize()},0),this.set("follow",o.follow||!1),this.extentLayer=new ol.layer.Vector({name:"Cache extent",source:new ol.source.Vector,style:o.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)},ol.ext.inherits(ol.control.Globe,ol.control.Control),ol.control.Globe.prototype.setMap=function(t){this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,ol.control.Control.prototype.setMap.call(this,t),t&&(this._listener=t.getView().on("propertychange",this.setView.bind(this)),this.setView())},ol.control.Globe.prototype.setView=function(){this.getMap()&&this.get("follow")&&this.setCenter(this.getMap().getView().getCenter())},ol.control.Globe.prototype.getGlobe=function(){return this.ovmap_},ol.control.Globe.prototype.show=function(t){!1!==t?this.element.classList.remove("ol-collapsed"):this.element.classList.add("ol-collapsed"),this.ovmap_.updateSize()},ol.control.Globe.prototype.setPosition=function(t){/top/.test(t)?this.element.classList.add("ol-control-top"):this.element.classList.remove("ol-control-top"),/right/.test(t)?this.element.classList.add("ol-control-right"):this.element.classList.remove("ol-control-right")},ol.control.Globe.prototype.setCenter=function(t,e){var o=this;if(this.pointer_.classList.add("hidden"),t){var i=this.ovmap_,r=i.getPixelFromCoordinate(t);if(r){if(!1!==e){var n=this.element.clientHeight;setTimeout(function(){o.pointer_.style.top=String(Math.min(Math.max(r[1],0),n))+"px",o.pointer_.style.left="50%",o.pointer_.classList.remove("hidden")},800)}i.getView().animate({center:[t[0],0]})}}},ol.control.Graticule=function(t){t||(t={});var e=document.createElement("div");e.className="ol-graticule ol-unselectable ol-hidden",ol.control.CanvasBase.call(this,{element:e}),this.set("projection",t.projection||"EPSG:4326");var o=new ol.proj.Projection({code:this.get("projection")}).getMetersPerUnit();for(this.fac=1;o/this.fac>10;)this.fac*=10;this.fac=1e4/this.fac,this.set("maxResolution",t.maxResolution||1/0),this.set("step",t.step||.1),this.set("stepCoord",t.stepCoord||1),this.set("spacing",t.spacing||40),this.set("margin",t.margin||0),this.set("borderWidth",t.borderWidth||5),this.set("stroke",!1!==t.stroke),this.formatCoord=t.formatCoord||function(t){return t},t.style instanceof ol.style.Style?this.style=t.style:this.style=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"})})})},ol.ext.inherits(ol.control.Graticule,ol.control.CanvasBase),ol.control.Graticule.prototype.setMap=function(t){var e=this.getMap();this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,ol.control.CanvasBase.prototype.setMap.call(this,t),e&&e.renderSync(),t&&(this._listener=t.on("postcompose",this.drawGraticule_.bind(this)))},ol.control.Graticule.prototype.setStyle=function(t){this.style=t},ol.control.Graticule.prototype.getStyle=function(t){return t},ol.control.Graticule.prototype.drawGraticule_=function(t){if(!(this.get("maxResolution")<t.frameState.viewState.resolution)){for(var e,o=this.getContext(t),i=o.canvas,r=t.frameState.pixelRatio,n=i.width/r,s=i.height/r,a=this.get("projection"),l=this.getMap(),c=[l.getCoordinateFromPixel([0,0]),l.getCoordinateFromPixel([n,0]),l.getCoordinateFromPixel([n,s]),l.getCoordinateFromPixel([0,s])],h=-1/0,p=1/0,u=-1/0,d=1/0,g=0;e=c[g];g++)c[g]=ol.proj.transform(e,l.getView().getProjection(),a),h=Math.max(h,c[g][0]),p=Math.min(p,c[g][0]),u=Math.max(u,c[g][1]),d=Math.min(d,c[g][1]);var f=this.get("spacing"),m=this.get("step"),y=this.get("stepCoord"),v=this.get("borderWidth"),_=this.get("margin");if((h-p)/m*f>n)(m*=Math.round((h-p)/n*f/m))>this.fac&&(m=Math.round(m/this.fac)*this.fac);p=Math.floor(p/m)*m-m,d=Math.floor(d/m)*m-m,h=Math.floor(h/m)*m+2*m,u=Math.floor(u/m)*m+2*m;var w=ol.proj.get(a).getExtent();w&&(p<w[0]&&(p=w[0]),d<w[1]&&(d=w[1]),h>w[2]&&(h=w[2]+m),u>w[3]&&(u=w[3]+m));var x=this.style.getStroke()&&this.get("stroke"),S=this.style.getText(),b=this.style.getFill();o.save(),o.scale(r,r),o.beginPath(),o.rect(_,_,n-2*_,s-2*_),o.clip(),o.beginPath();var C,M,k,L,T,P={top:[],left:[],bottom:[],right:[]};for(C=p;C<h;C+=m)for(L=ol.proj.transform([C,d],a,l.getView().getProjection()),L=l.getPixelFromCoordinate(L),x&&o.moveTo(L[0],L[1]),k=L,M=d+m;M<=u;M+=m)T=ol.proj.transform([C,M],a,l.getView().getProjection()),T=l.getPixelFromCoordinate(T),x&&o.lineTo(T[0],T[1]),k[1]>0&&T[1]<0&&P.top.push([C,k]),k[1]>s&&T[1]<s&&P.bottom.push([C,k]),k=T;for(M=d;M<u;M+=m)for(L=ol.proj.transform([p,M],a,l.getView().getProjection()),L=l.getPixelFromCoordinate(L),x&&o.moveTo(L[0],L[1]),k=L,C=p+m;C<=h;C+=m)T=ol.proj.transform([C,M],a,l.getView().getProjection()),T=l.getPixelFromCoordinate(T),x&&o.lineTo(T[0],T[1]),k[0]<0&&T[0]>0&&P.left.push([M,k]),k[0]<n&&T[0]>n&&P.right.push([M,k]),k=T;if(x&&(o.strokeStyle=this.style.getStroke().getColor(),o.lineWidth=this.style.getStroke().getWidth(),o.stroke()),S){var E,A;o.fillStyle=this.style.getText().getFill().getColor(),o.strokeStyle=this.style.getText().getStroke().getColor(),o.lineWidth=this.style.getText().getStroke().getWidth(),o.textAlign="center",o.textBaseline="hanging";var F=(b?v:0)+_+2;for(g=0;E=P.top[g];g++)Math.round(E[0]/this.get("step"))%y||(A=this.formatCoord(E[0]),o.strokeText(A,E[1][0],F),o.fillText(A,E[1][0],F));for(o.textBaseline="alphabetic",g=0;E=P.bottom[g];g++)Math.round(E[0]/this.get("step"))%y||(A=this.formatCoord(E[0]),o.strokeText(A,E[1][0],s-F),o.fillText(A,E[1][0],s-F));for(o.textBaseline="middle",o.textAlign="left",g=0;E=P.left[g];g++)Math.round(E[0]/this.get("step"))%y||(A=this.formatCoord(E[0]),o.strokeText(A,F,E[1][1]),o.fillText(A,F,E[1][1]));for(o.textAlign="right",g=0;E=P.right[g];g++)Math.round(E[0]/this.get("step"))%y||(A=this.formatCoord(E[0]),o.strokeText(A,n-F,E[1][1]),o.fillText(A,n-F,E[1][1]))}if(b){var I,D,N=this.style.getFill().getColor();for((D=this.style.getStroke())?I=this.style.getStroke().getColor():(I=N,N="#fff"),o.strokeStyle=I,o.lineWidth=D?D.getWidth():1,g=1;g<P.top.length;g++)o.beginPath(),o.rect(P.top[g-1][1][0],_,P.top[g][1][0]-P.top[g-1][1][0],v),o.fillStyle=Math.round(P.top[g][0]/m)%2?I:N,o.fill(),o.stroke();for(g=1;g<P.bottom.length;g++)o.beginPath(),o.rect(P.bottom[g-1][1][0],s-v-_,P.bottom[g][1][0]-P.bottom[g-1][1][0],v),o.fillStyle=Math.round(P.bottom[g][0]/m)%2?I:N,o.fill(),o.stroke();for(g=1;g<P.left.length;g++)o.beginPath(),o.rect(_,P.left[g-1][1][1],v,P.left[g][1][1]-P.left[g-1][1][1]),o.fillStyle=Math.round(P.left[g][0]/m)%2?I:N,o.fill(),o.stroke();for(g=1;g<P.right.length;g++)o.beginPath(),o.rect(n-v-_,P.right[g-1][1][1],v,P.right[g][1][1]-P.right[g-1][1][1]),o.fillStyle=Math.round(P.right[g][0]/m)%2?I:N,o.fill(),o.stroke();o.beginPath(),o.fillStyle=I,o.rect(_,_,v,v),o.rect(_,s-v-_,v,v),o.rect(n-v-_,_,v,v),o.rect(n-v-_,s-v-_,v,v),o.fill()}o.restore()}},ol.control.GridReference=function(t){t||(t={});var e=document.createElement("div");e.className=(t.target?"":"ol-control ")+"ol-gridreference ol-unselectable "+(t.className||""),ol.control.CanvasBase.call(this,{element:e,target:t.target}),"function"==typeof t.property&&(this.getFeatureName=t.property),"function"==typeof t.sortFeatures&&(this.sortFeatures=t.sortFeatures),"function"==typeof t.indexTitle&&(this.indexTitle=t.indexTitle),this.source_=t.source,t.source&&(this.setIndex(t.source.getFeatures(),t),t.source.once("change",function(){"ready"===t.source.getState()&&this.setIndex(t.source.getFeatures(),t)}.bind(this))),this.set("maxResolution",t.maxResolution||1/0),this.set("extent",t.extent),this.set("size",t.size),this.set("margin",t.margin||0),this.set("property",t.property||"name"),this.set("filterLabel",t.filterLabel||"filter"),t.style instanceof ol.style.Style?this.style=t.style:this.style=new ol.style.Style({stroke:new ol.style.Stroke({color:"#000",width:1}),text:new ol.style.Text({font:"bold 14px Arial",stroke:new ol.style.Stroke({color:"#fff",width:2}),fill:new ol.style.Fill({color:"#000"})})})},ol.ext.inherits(ol.control.GridReference,ol.control.CanvasBase),ol.control.GridReference.prototype.getFeatureName=function(t){return t.get(this.get("property")||"name")},ol.control.GridReference.prototype.sortFeatures=function(t,e){return this.getFeatureName(t)==this.getFeatureName(e)?0:this.getFeatureName(t)<this.getFeatureName(e)?-1:1},ol.control.GridReference.prototype.indexTitle=function(t){return this.getFeatureName(t).charAt(0)},ol.control.GridReference.prototype.setIndex=function(t){if(this.getMap()){var e=this;t.getArray&&(t=t.getArray()),t.sort(function(t,o){return e.sortFeatures(t,o)}),this.element.innerHTML="";var o=this.element,i=document.createElement("input");i.setAttribute("type","search"),i.setAttribute("placeholder",this.get("filterLabel")||"filter");var r=function(){var t=this.value.replace(/^\*/,""),e=new RegExp(t,"i");a.querySelectorAll("li").forEach(function(t){t.classList.contains("ol-title")?t.style.display="":e.test(t.querySelector(".ol-name").textContent)?t.style.display="":t.style.display="none"}),a.querySelectorAll("li.ol-title").forEach(function(t){var e=!1;e=[].filter.call(t.parentNode.children,function(o){return o.previousElementSibling===t?e=!0:e}),console.log(e);var o=e[0];o.length&&!o.classList.contains("ol-title")?t.style.display="":t.style.display="none"})};i.addEventListener("search",r),i.addEventListener("keyup",r),o.appendChild(i);var n,s,a=document.createElement("ul");o.appendChild(a);for(var l,c=0;l=t[c];c++)!function(t){if(n=e.getReference(t.getGeometry().getFirstCoordinate())){var o=e.getFeatureName(t),i=e.indexTitle(t);if(i!=s){var r=document.createElement("li");r.classList.add("ol-title"),r.textContent=i,a.appendChild(r)}s=i;var l=document.createElement("li"),c=document.createElement("span");c.classList.add("ol-name"),c.textContent=o,l.appendChild(c);var h=document.createElement("span");h.classList.add("ol-ref"),h.textContent=n,l.appendChild(h);var p=t;l.addEventListener("click",function(){e.dispatchEvent({type:"select",feature:p})}),a.appendChild(l)}}(l)}},ol.control.GridReference.prototype.getReference=function(t){if(this.getMap()){var e=this.get("extent"),o=this.get("size"),i=Math.floor((t[0]-e[0])/(e[2]-e[0])*o[0]);if(i<0||i>=o[0])return"";var r=Math.floor((e[3]-t[1])/(e[3]-e[1])*o[1]);return r<0||r>=o[1]?"":String.fromCharCode(65+i)+r}},ol.control.GridReference.prototype.setMap=function(t){var e=this.getMap();this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,ol.control.CanvasBase.prototype.setMap.call(this,t),e&&e.renderSync(),t&&(this._listener=t.on("postcompose",this.drawGrid_.bind(this)),this.source_&&this.setIndex(this.source_.getFeatures()))},ol.control.GridReference.prototype.setStyle=function(t){this.style=t},ol.control.GridReference.prototype.getStyle=function(){return this.style},ol.control.GridReference.prototype.drawGrid_=function(t){if(!(this.get("maxResolution")<t.frameState.viewState.resolution)){var e=this.getContext(t),o=e.canvas,i=t.frameState.pixelRatio,r=o.width/i,n=o.height/i,s=this.get("extent"),a=this.get("size"),l=this.getMap(),c=ol.extent.boundingExtent([l.getPixelFromCoordinate([s[0],s[1]]),l.getPixelFromCoordinate([s[2],s[3]])]),h=[c[0],c[1]],p=[c[2],c[3]],u=(p[0]-h[0])/a[0],d=(p[1]-h[1])/a[1];e.save();var g,f=this.get("margin");for(e.scale(i,i),e.strokeStyle=this.style.getStroke().getColor(),e.lineWidth=this.style.getStroke().getWidth(),e.beginPath(),g=0;g<=a[0];g++)e.moveTo(h[0]+g*u,h[1]),e.lineTo(h[0]+g*u,p[1]);for(g=0;g<=a[1];g++)e.moveTo(h[0],h[1]+g*d),e.lineTo(p[0],h[1]+g*d);e.stroke(),e.font=this.style.getText().getFont(),e.fillStyle=this.style.getText().getFill().getColor(),e.strokeStyle=this.style.getText().getStroke().getColor();var m,y,v,_=f+(e.lineWidth=this.style.getText().getStroke().getWidth());for(e.textAlign="center",g=0;g<a[0];g++)m=String.fromCharCode(65+g),y=h[0]+g*u+u/2,(v=h[1]-_)<0?(v=_,e.textBaseline="hanging"):e.textBaseline="alphabetic",e.strokeText(m,y,v),e.fillText(m,y,v),(v=p[1]+_)>n?(v=n-_,e.textBaseline="alphabetic"):e.textBaseline="hanging",e.strokeText(m,y,v),e.fillText(m,y,v);for(e.textBaseline="middle",g=0;g<a[0];g++)v=h[1]+g*d+d/2,e.textAlign="right",(y=h[0]-_)<0?(y=_,e.textAlign="left"):e.textAlign="right",e.strokeText(g,y,v),e.fillText(g,y,v),(y=p[0]+_)>r?(y=r-_,e.textAlign="right"):e.textAlign="left",e.strokeText(g,y,v),e.fillText(g,y,v);e.restore()}},ol.control.Imageline=function(t){var e=ol.ext.element.create("DIV",{className:(t.className||"")+" ol-imageline"+(t.target?"":" ol-unselectable ol-control")+(t.collapsed&&t.collapsible?"ol-collapsed":"")+(ol.has.TOUCH?" ol-touch":"")});!t.target&&t.collapsible&&ol.ext.element.create("BUTTON",{type:"button",click:function(){this.toggle()}.bind(this),parent:e}),this._source=t.source,ol.control.Control.call(this,{element:e,target:t.target}),this._setScrolling(),this._scrolldiv.addEventListener("scroll",function(){this.getMap()&&this.getMap().render()}.bind(this)),"function"==typeof t.getImage&&(this._getImage=t.getImage),"function"==typeof t.getTitle&&(this._getTitle=t.getTitle),this.set("maxFeatures",t.maxFeatures||100),this.set("linkColor",t.linkColor||!1),this.set("hover",t.hover||!1),this.set("useExtent",t.useExtent||!1),this.refresh()},ol.ext.inherits(ol.control.Imageline,ol.control.Control),ol.control.Imageline.prototype.setMap=function(t){this._listener&&this._listener.forEach(function(t){ol.Observable.unByKey(t)}.bind(this)),this._listener=null,ol.control.Control.prototype.setMap.call(this,t),t&&(this._listener=[t.on("postcompose",this._drawLink.bind(this)),t.on("moveend",function(){this.get("useExtent")&&this.refresh()}.bind(this))])},ol.control.Imageline.prototype.useExtent=function(t){this.set("useExtent",t),this.refresh()},ol.control.Imageline.prototype.isCollapsed=function(){return this.element.classList.contains("ol-collapsed")},ol.control.Imageline.prototype.collapse=function(t){t?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()})},ol.control.Imageline.prototype.toggle=function(){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()})},ol.control.Imageline.prototype._getImage=function(t){return t.get("img")},ol.control.Imageline.prototype._getTitle=function(){return""},ol.control.Imageline.prototype.getFeatures=function(){var t=this.getMap();if(this.get("useExtent")&&t){var e=t.getView().calculateExtent(t.getSize());return this._source.getFeaturesInExtent(e)}return this._source.getFeatures()},ol.control.Imageline.prototype._setScrolling=function(){var t=this._scrolldiv=ol.ext.element.create("DIV",{parent:this.element});ol.ext.element.scrollDiv(t,{onmove:function(t){this._moving=t}.bind(this)})},ol.control.Imageline.prototype.refresh=function(){this._scrolldiv.innerHTML="";var t=this.getFeatures(),e=this._select?this._select.feature:null;this._select&&(this._select.elt=null),this._iline=[],this.getMap()&&this.getMap().render();for(var o,i=function(t){if(this._getImage(t)){var o=ol.ext.element.create("DIV",{className:"ol-image",parent:this._scrolldiv});ol.ext.element.create("IMG",{src:this._getImage(t),parent:o}).addEventListener("load",function(){this.classList.add("ol-loaded")}),ol.ext.element.create("SPAN",{html:this._getTitle(t),parent:o});var i={elt:o,feature:t};o.addEventListener("click",function(){this._moving||(this.dispatchEvent({type:"select",feature:t}),this._scrolldiv.scrollLeft=o.offsetLeft+ol.ext.element.getStyle(o,"width")/2-ol.ext.element.getStyle(this.element,"width")/2,this._select&&this._select.elt.classList.remove("select"),this._select=i,this._select.elt.classList.add("select"))}.bind(this)),o.addEventListener("mouseover",function(t){this.get("hover")&&(this._select&&this._select.elt.classList.remove("select"),this._select=i,this._select.elt.classList.add("select"),this.getMap().render(),t.stopPropagation())}.bind(this)),o.addEventListener("mouseout",function(t){this.get("hover")&&(this._select&&this._select.elt.classList.remove("select"),this._select=!1,this.getMap().render(),t.stopPropagation())}.bind(this)),o.ondragstart=function(){return!1},this._iline.push(i),e===t&&(this._select=i,i.elt.classList.add("select"))}}.bind(this),r=this.get("maxFeatures"),n=0;(o=t[n])&&!(r--<0);n++)i(o);this._select&&this._select.feature&&!this._select.elt&&i(this._select.feature)},ol.control.Imageline.prototype.select=function(t,e){this._select=!1,this._iline.forEach(function(o){o.feature===t?(o.elt.classList.add("select"),this._select=o,!1!==e&&(this._scrolldiv.scrollLeft=o.elt.offsetLeft+ol.ext.element.getStyle(o.elt,"width")/2-ol.ext.element.getStyle(this.element,"width")/2)):o.elt.classList.remove("select")}.bind(this))},ol.control.Imageline.prototype._drawLink=function(t){if(!(!this.get("linkColor")|this.isCollapsed())&&(this.getMap()&&this._select&&this._select.elt)){var e=t.context,o=t.frameState.pixelRatio,i=[this._select.elt.offsetLeft-this._scrolldiv.scrollLeft+ol.ext.element.getStyle(this._select.elt,"width")/2,parseFloat(ol.ext.element.getStyle(this.element,"top"))||this.getMap().getSize()[1]],r=this._select.feature.getGeometry().getFirstCoordinate();r=this.getMap().getPixelFromCoordinate(r),e.save(),e.fillStyle=this.get("linkColor"),e.beginPath(),r[0]>i[0]?(e.moveTo((i[0]-5)*o,i[1]*o),e.lineTo((i[0]+5)*o,(i[1]+5)*o)):(e.moveTo((i[0]-5)*o,(i[1]+5)*o),e.lineTo((i[0]+5)*o,i[1]*o)),e.lineTo(r[0]*o,r[1]*o),e.fill(),e.restore()}},ol.control.IsochroneGeoportail=function(t){var e=this;t||(t={}),null==t.typing&&(t.typing=300);var o=(t.className?t.className:"")+" ol-isochrone ol-routing";t.target||(o+=" ol-unselectable ol-control");var i=ol.ext.element.create("DIV",{className:o});t.target||ol.ext.element.create("BUTTON",{parent:i}).addEventListener("click",function(){i.classList.toggle("ol-collapsed")});ol.control.Control.call(this,{element:i,target:t.target}),this.set("iter",1);var r=ol.ext.element.create("DIV",{className:"content",parent:i});this._addSearchCtrl(r,t),ol.ext.element.create("BUTTON",{className:"ol-button ol-method-time selected",title:"isochrone",parent:r}).addEventListener("click",function(){this.setMethod("time")}.bind(this)),ol.ext.element.create("I",{className:"ol-button ol-method-distance",title:"isodistance",parent:r}).addEventListener("click",function(){this.setMethod("distance")}.bind(this)),ol.ext.element.create("I",{className:"ol-button ol-car selected",title:"by car",parent:r}).addEventListener("click",function(){this.setMode("car")}.bind(this)),ol.ext.element.create("I",{className:"ol-button ol-pedestrian",title:"by foot",parent:r}).addEventListener("click",function(){this.setMode("pedestrian")}.bind(this)),ol.ext.element.create("I",{className:"ol-button ol-direction-direct selected",title:"direct",parent:r}).addEventListener("click",function(){this.setDirection("direct")}.bind(this)),ol.ext.element.create("I",{className:"ol-button ol-direction-reverse",title:"reverse",parent:r}).addEventListener("click",function(){this.setDirection("reverse")}.bind(this));var n=ol.ext.element.create("DIV",{className:"ol-time",parent:r});ol.ext.element.create("DIV",{html:"isochrone:",parent:n}),ol.ext.element.create("INPUT",{type:"number",parent:n,min:0}).addEventListener("change",function(){e.set("hour",Number(this.value))}),ol.ext.element.create("TEXT",{parent:n,html:"h"}),ol.ext.element.create("INPUT",{type:"number",parent:n,min:0}).addEventListener("change",function(){e.set("minute",Number(this.value))}),ol.ext.element.create("TEXT",{parent:n,html:"mn"}),n=ol.ext.element.create("DIV",{className:"ol-distance",parent:r}),ol.ext.element.create("DIV",{html:"isodistance:",parent:n}),ol.ext.element.create("INPUT",{type:"number",step:"any",parent:n,min:0}).addEventListener("change",function(){e.set("distance",Number(this.value))}),ol.ext.element.create("TEXT",{parent:n,html:"km"}),n=ol.ext.element.create("DIV",{className:"ol-iter",parent:r}),ol.ext.element.create("DIV",{html:"Iteration:",parent:n}),ol.ext.element.create("INPUT",{type:"number",parent:n,value:1,min:1}).addEventListener("change",function(){e.set("iter",Number(this.value))}),ol.ext.element.create("I",{className:"ol-ok",html:"ok",parent:r}).addEventListener("click",function(){var t=0;switch(this.get("method")){case"distance":t=1e3*this.get("distance");break;default:t=3600*(this.get("hour")||0)+60*(this.get("minute")||0)}t&&this.get("coordinate")&&this.search(this.get("coordinate"),t)}.bind(this)),this.set("url","https://wxs.ign.fr/"+t.apiKey+"/isochrone/isochrone.json"),this._ajax=new ol.ext.Ajax({dataType:"JSON",auth:t.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(t.method)},ol.ext.inherits(ol.control.IsochroneGeoportail,ol.control.Control),ol.control.IsochroneGeoportail.prototype.setMap=function(t){ol.control.Control.prototype.setMap.call(this,t),this._search.setMap(t)},ol.control.IsochroneGeoportail.prototype._addSearchCtrl=function(t,e){var o=ol.ext.element.create("DIV",{parent:t}),i=this._search=new ol.control.SearchGeoportail({className:"IGNF ol-collapsed",apiKey:e.apiKey,target:o});i.on("select",function(t){i.setInput(t.search.fulltext),this.set("coordinate",t.coordinate)}.bind(this)),i.on("change:input",function(){this.set("coordinate",!1)}.bind(this))},ol.control.IsochroneGeoportail.prototype.setMethod=function(t){t=/distance/.test(t)?"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-"+t).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-"+t).classList.add("selected"),this.set("method",t)},ol.control.IsochroneGeoportail.prototype.setMode=function(t){this.set("mode",t),this.element.querySelector(".ol-car").classList.remove("selected"),this.element.querySelector(".ol-pedestrian").classList.remove("selected"),this.element.querySelector(".ol-"+t).classList.add("selected")},ol.control.IsochroneGeoportail.prototype.setDirection=function(t){this.set("direction",t),this.element.querySelector(".ol-direction-direct").classList.remove("selected"),this.element.querySelector(".ol-direction-reverse").classList.remove("selected"),this.element.querySelector(".ol-direction-"+t).classList.add("selected")},ol.control.IsochroneGeoportail.prototype.search=function(t,e,o){var i=this.getMap()?this.getMap().getView().getProjection():"EPSG:3857",r=/distance/.test(this.get("method"))?"distance":"time";if("string"==typeof e){var n=e.replace(/([0-9|.]*)([a-z]*)$/,"$2");switch(r="time",e=parseFloat(e),n){case"mn":e*=60;break;case"h":e*=3600;break;case"m":r="distance";break;case"km":r="distance",e*=1e3}}var s=Math.round(e*(this.get("iter")-(o||0))/this.get("iter"));if("number"==typeof e){var a={"gp-access-lib":"2.1.0",location:ol.proj.toLonLat(t,i),graphName:"pedestrian"===this.get("mode")?"Pieton":"Voiture",exclusions:this.get("exclusions")||void 0,method:r,time:"time"===r?s:void 0,distance:"distance"===r?s:void 0,reverse:"reverse"===this.get("direction"),smoothing:this.get("smoothing")||!0,holes:this.get("holes")||!1};this._ajax.send(this.get("url"),a,{coord:t,option:e,iteration:(o||0)+1})}},ol.control.IsochroneGeoportail.prototype._success=function(t){var e=this.getMap()?this.getMap().getView().getProjection():"EPSG:3857",o=new ol.format.WKT,i=t.response;i.feature=o.readFeature(i.wktGeometry,{dataProjection:"EPSG:4326",featureProjection:e}),delete i.wktGeometry,i.type="isochrone",i.iteration=t.options.iteration-1,this.dispatchEvent(i),t.options.iteration<this.get("iter")&&this.search(t.options.coord,t.options.option,t.options.iteration)},ol.control.IsochroneGeoportail.prototype._error=function(){this.dispatchEvent({type:"error"})},ol.control.LayerPopup=function(t){(t=t||{}).switcherClass="ol-layerswitcher-popup",!1!==t.mouseover&&(t.mouseover=!0),ol.control.LayerSwitcher.call(this,t)},ol.ext.inherits(ol.control.LayerPopup,ol.control.LayerSwitcher),ol.control.LayerPopup.prototype.overflow=function(){},ol.control.LayerPopup.prototype.drawList=function(t,e){var o=this,i=function(t){t.preventDefault();var i=o._getLayerForLI(this);o.switchLayerVisibility(i,e),"touchstart"==t.type&&o.element.classList.add("ol-collapsed")};e.forEach(function(e){if(o.displayInLayerSwitcher(e)){var r=ol.ext.element.create("LI",{html:e.get("title")||e.get("name"),on:{"click touchstart":i},parent:t});o._setLayerForLI(r,e),o.testLayerVisibility(e)&&r.classList.add("ol-layer-hidden"),e.getVisible()&&r.classList.add("select")}})},ol.control.LayerSwitcherImage=function(t){(t=t||{}).switcherClass="ol-layerswitcher-image",!1!==t.mouseover&&(t.mouseover=!0),ol.control.LayerSwitcher.call(this,t)},ol.ext.inherits(ol.control.LayerSwitcherImage,ol.control.LayerSwitcher),ol.control.LayerSwitcherImage.prototype.drawList=function(t,e){var o=this,i=function(t){t.preventDefault();var i=o._getLayerForLI(this);o.switchLayerVisibility(i,e),"touchstart"==t.type&&o.element.classList.add("ol-collapsed")};ol.ext.element.setStyle(t,{height:"auto"}),e.forEach(function(e){if(o.displayInLayerSwitcher(e)){var r=e.getPreview?e.getPreview():["none"],n=ol.ext.element.create("LI",{className:"ol-imgcontainer"+(e.getVisible()?" select":""),on:{"touchstart click":i},parent:t});o._setLayerForLI(n,e),r.forEach(function(t){ol.ext.element.create("IMG",{src:t,parent:n})}),ol.ext.element.create("p",{html:e.get("title")||e.get("name"),parent:n}),o.testLayerVisibility(e)&&n.classList.add("ol-layer-hidden")}})},ol.control.LayerSwitcherImage.prototype.overflow=function(){},ol.control.Legend=function(t){t=t||{};var e=document.createElement("div");if(t.target)e.className=t.className||"ol-legend";else{e.className=(t.className||"ol-legend")+" ol-unselectable ol-control ol-collapsed"+(!1===t.collapsible?" ol-uncollapsible":"");var o=document.createElement("button");o.setAttribute("type","button"),o.addEventListener("click",function(){e.classList.toggle("ol-collapsed")}),e.appendChild(o),(o=document.createElement("button")).setAttribute("type","button"),o.className="ol-closebox",o.addEventListener("click",function(){e.classList.toggle("ol-collapsed")}),e.appendChild(o)}this._imgElement=document.createElement("div"),this._imgElement.className="ol-legendImg",e.appendChild(this._imgElement),this._tableElement=document.createElement("ul"),e.appendChild(this._tableElement),ol.control.Control.call(this,{element:e,target:t.target}),this._rows=[],this.set("size",t.size||[40,25]),this.set("margin",0===t.margin?0:t.margin||10),this.set("title",t.title||""),this._style=t.style,!1===t.collapsed&&this.show(),this.refresh()},ol.ext.inherits(ol.control.Legend,ol.control.Control),ol.control.Legend.prototype.setStyle=function(t){this._style=t,this.refresh()},ol.control.Legend.prototype.addRow=function(t){this._rows.push(t||{}),this.refresh()},ol.control.Legend.prototype.removeRow=function(t){this._rows.splice(t,1),this.refresh()},ol.control.Legend.prototype.getRow=function(t){return this._rows[t]},ol.control.Legend.prototype.getLength=function(){return this._rows.length},ol.control.Legend.prototype.refresh=function(){var t=this,e=this._tableElement;e.innerHTML="";var o=this.get("size")[0]+2*this.get("margin"),i=this.get("size")[1]+2*this.get("margin");function r(r,n,s,a){var l=document.createElement("li");l.style.height=i+"px",l.addEventListener("click",function(){t.dispatchEvent({type:"select",title:r,row:s,index:a})});var c=document.createElement("div");l.appendChild(c),c.style.height=i+"px",c=document.createElement("div"),n?l.className="ol-title":c.style.paddingLeft=o+"px",c.innerHTML=r||"",l.appendChild(c),e.appendChild(l)}this.get("title")&&r(this.get("title"),!0,{},-1);var n=document.createElement("canvas");n.width=5*o,n.height=(this._rows.length+1)*i*ol.has.DEVICE_PIXEL_RATIO,this._imgElement.innerHTML="",this._imgElement.append(n),this._imgElement.style.height=(this._rows.length+1)*i+"px";for(var s,a=0;s=this._rows[a];a++)r(s.title,!1,s,a),n=this.getStyleImage(s,n,a+(this.get("title")?1:0))},ol.control.Legend.prototype.show=function(){this.element.classList.remove("ol-collapsed")},ol.control.Legend.prototype.hide=function(){this.element.classList.add("ol-collapsed")},ol.control.Legend.prototype.toggle=function(){this.element.classList.toggle("ol-collapsed")},ol.control.Legend.prototype.getStyleImage=function(t,e,o){t=t||{};var i=this.get("size"),r=i[0]+2*this.get("margin"),n=i[1]+2*this.get("margin"),s=e,a=ol.has.DEVICE_PIXEL_RATIO;s||((s=document.createElement("canvas")).width=r*a,s.height=n*a);var l=s.getContext("2d");l.save();var c,h=ol.render.toContext(l),p=t.typeGeom,u=t.feature;!u&&t.properties&&p&&(u=/Point/.test(p)?new ol.Feature(new ol.geom.Point([0,0])):/LineString/.test(p)?new ol.Feature(new ol.geom.LineString([0,0])):new ol.Feature(new ol.geom.Polygon([[0,0]]))).setProperties(t.properties),u?((c=u.getStyle())||(c="function"==typeof this._style?this._style(u):this._style||[]),p=u.getGeometry().getType()):c=t.style,c instanceof Array||(c=[c]);var d,g,f=r/2,m=n/2,y=i[0]/2,v=i[1]/2;if("Point"===p){var _=null;for(d=0;g=c[d];d++){var w=g.getImage();if(w&&w.getAnchor){var x=w.getAnchor(),S=w.getSize(),b=x[0]-S[0],C=x[1]-S[1];_?ol.extent.extend(_,[b,C,b+S[0],C+S[1]]):_=[b,C,b+S[0],C+S[1]]}}_&&(f+=(_[2]+_[0])/2,m+=(_[3]+_[1])/2)}for(m+=e?o*n:0,d=0;g=c[d];d++)switch(h.setStyle(g),p){case ol.geom.Point:case"Point":h.drawGeometry(new ol.geom.Point([f,m]));break;case ol.geom.LineString:case"LineString":l.save(),l.rect(this.get("margin")*a,0,i[0]*a,s.height),l.clip(),h.drawGeometry(new ol.geom.LineString([[f-y,m],[f+y,m]])),l.restore();break;case ol.geom.Polygon:case"Polygon":h.drawGeometry(new ol.geom.Polygon([[[f-y,m-v],[f+y,m-v],[f+y,m+v],[f-y,m+v],[f-y,m-v]]]))}return l.restore(),s},ol.control.MapZone=function(t){t||(t={});var e=document.createElement("div");if(t.target)e=ol.ext.element.create("DIV",{className:t.className||"ol-mapzone"});else{e=ol.ext.element.create("DIV",{className:(t.className||"ol-mapzone")+" ol-unselectable ol-control ol-collapsed"});var o=ol.ext.element.create("BUTTON",{type:"button",on:{click:function(){e.classList.toggle("ol-collapsed"),i.forEach(function(t){t.updateSize()})}.bind(this)},parent:e});ol.ext.element.create("I",{parent:o})}ol.control.Control.call(this,{element:e,target:t.target});var i=[];t.zones.forEach(function(o){var r=new ol.View({zoom:6,center:[0,0],projection:t.projection}),n=ol.proj.transformExtent(o.extent,"EPSG:4326",r.getProjection());console.log(n,o.extent);var s=ol.ext.element.create("DIV",{className:"ol-mapzonezone",parent:e,click:function(){this.dispatchEvent({type:"select",coordinate:ol.extent.getCenter(n),extent:n}),!1!==t.centerOnClick&&this.getMap().getView().fit(n),this.setVisible(!1)}.bind(this)}),a=new t.layer.constructor({source:t.layer.getSource()}),l=new ol.Map({target:s,view:r,controls:[],interactions:[],layers:[a]});i.push(l),r.fit(n),ol.ext.element.create("P",{html:o.title,parent:s})}.bind(this)),setTimeout(function(){i.forEach(function(t){t.updateSize()})})},ol.ext.inherits(ol.control.MapZone,ol.control.Control),ol.control.MapZone.prototype.setVisible=function(t){t?this.element.classList.remove("ol-collapsed"):this.element.classList.add("ol-collapsed")},ol.control.MapZone.zones={},ol.control.MapZone.zones.DOM=[{title:"Guadeloupe",extent:[-61.898594315312444,15.75623038647845,-60.957887532935324,16.575317670979473]},{title:"Guyane",extent:[-54.72525931072715,2.1603763430019,-51.528236062921344,5.7984307809552575]},{title:"Martinique",extent:[-61.257556528564756,14.387506317407514,-60.76934912110432,14.895067461729951]},{title:"Mayotte",extent:[44.959844536967815,-13.01674138212816,45.35328866510648,-12.65521942207829]},{title:"La réunion",extent:[55.17059012967656,-21.407680069231688,55.88195702001797,-20.85560221637526]}],ol.control.MapZone.zones.TOM=[{title:"Polynésie Française",extent:[206.23664226630862,-22.189040615809787,221.85920743981987,-10.835039595040698]},{title:"Nouvelle Calédonie",extent:[163.76420580160925,-22.581641092751838,167.66984709498706,-19.816411635668445]},{title:"St-Pierre et Miquelon",extent:[-56.453698765748676,46.74449858188555,-56.0980198121544,47.14669874229787]},{title:"Wallis et Futuna",extent:[181.7588623143665,-14.7341169873267,183.95612353301715,-13.134720799175085]},{title:"St-Martin St-Barthélemy",extent:[-63.1726389501678,17.806097291313506,-62.7606535945649,18.13267688837938]}],ol.control.MapZone.zones.DOMTOM=[{title:"Métropole",extent:[-5.318421740712579,41.16082274292913,9.73284186155716,51.21957336557702]}].concat(ol.control.MapZone.zones.DOM,ol.control.MapZone.zones.TOM),ol.control.Notification=function(t){t=t||{};var e=document.createElement("DIV");this.contentElement=document.createElement("DIV"),e.appendChild(this.contentElement);var o=(t.className||"")+" ol-notification";t.target||(o+=" ol-unselectable ol-control ol-collapsed"),e.setAttribute("class",o),ol.control.Control.call(this,{element:e,target:t.target})},ol.ext.inherits(ol.control.Notification,ol.control.Control),ol.control.Notification.prototype.show=function(t,e){var o=this,i=this.element;t&&(t instanceof Node?(this.contentElement.innerHTML="",this.contentElement.appendChild(t)):this.contentElement.innerHTML=t),this._listener&&(clearTimeout(this._listener),this._listener=null),i.classList.add("ol-collapsed"),this._listener=setTimeout(function(){i.classList.remove("ol-collapsed"),o._listener=!e||e>=0?setTimeout(function(){i.classList.add("ol-collapsed"),o._listener=null},e||3e3):null},100)},ol.control.Notification.prototype.hide=function(){this._listener&&(clearTimeout(this._listener),this._listener=null),this.element.classList.add("ol-collapsed")},ol.control.Notification.prototype.toggle=function(t){this.element.classList.contains("ol-collapsed")?this.show(null,t):this.hide()},ol.control.Overlay=function(t){t||(t={});var e=ol.ext.element.create("DIV",{className:"ol-unselectable ol-overlay "+(t.className||""),html:t.content});ol.control.Control.call(this,{element:e,target:t.target});var o=this;t.hideOnClick&&e.addEventListener("click",function(){o.hide()}),this.set("closeBox",t.closeBox),this._timeout=!1,this.setContent(t.content)},ol.ext.inherits(ol.control.Overlay,ol.control.Control),ol.control.Overlay.prototype.setContent=function(t){var e=this;if(t){var o=this.element;if(t instanceof Element?o.appendChild(t):void 0!==t&&(o.innerHTML=t),this.get("closeBox")){var i=document.createElement("div");i.classList.add("ol-closebox"),i.addEventListener("click",function(){e.hide()}),o.insertBefore(i,o.firstChild)}}},ol.control.Overlay.prototype.show=function(t,e){var o=this,i=this.element;i.style.display="block",e?(this.center_=this.getMap().getPixelFromCoordinate(e),i.style.top=this.center_[1]+"px",i.style.left=this.center_[0]+"px"):(this.center_=!1,i.style.top="",i.style.left=""),t&&this.setContent(t),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(function(){i.classList.add("ol-visible"),i.style.top="",i.style.left="",o.dispatchEvent({type:"change:visible",visible:!0,element:o.element})},10),o.dispatchEvent({type:"change:visible",visible:!1,element:o.element})},ol.control.Overlay.prototype.hide=function(){var t=this.element;this.element.classList.remove("ol-visible"),this.center_&&(t.style.top=this.center_[1]+"px",t.style.left=this.center_[0]+"px",this.center_=!1),this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout(function(){t.style.display="none"},500),this.dispatchEvent({type:"change:visible",visible:!1,element:this.element})},ol.control.Overlay.prototype.toggle=function(){this.getVisible()?this.hide():this.show()},ol.control.Overlay.prototype.getVisible=function(){return"none"!==ol.ext.element.getStyle(this.element,"display")},ol.control.Overlay.prototype.setClass=function(t){var e=this.element.classList.contains("ol-visible");this.element.className="";var o=["ol-unselectable","ol-overlay"];e&&o.push("ol-visible"),o=o.concat(t.split(" ")),this.element.classList.add.apply(this.element.classList,o)},ol.control.Overview=function(t){t=t||{};var e,o=this;if(this.minZoom=t.minZoom||0,this.maxZoom=t.maxZoom||18,this.rotation=t.rotation,t.target)e=document.createElement("div"),this.panel_=t.target;else{(e=document.createElement("div")).classList.add("ol-overview","ol-unselectable","ol-control","ol-collapsed"),/top/.test(t.align)&&e.classList.add("ol-control-top"),/right/.test(t.align)&&e.classList.add("ol-control-right");var i=document.createElement("button");i.setAttribute("type","button"),i.addEventListener("touchstart",function(t){o.toggleMap(),t.preventDefault()}),i.addEventListener("click",function(){o.toggleMap()}),e.appendChild(i),this.panel_=document.createElement("div"),this.panel_.classList.add("panel"),e.appendChild(this.panel_)}ol.control.Control.call(this,{element:e,target:t.target}),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:t.projection}),layers:t.layers}),this.oview_=this.ovmap_.getView(),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}),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(e){var i,r,n,s,a;return!1!==t.panAnimation?"elastic"==t.panAnimation||t.elasticPan?o.getMap().getView().animate({center:e.coordinate,easing:(i=2,r=.3,n=3*i*Math.PI/2,s=r>0?-1/r:-100,a=Math.cos(n)*Math.pow(2,s),function(t){return t=1-Math.cos(t*Math.PI/2),1-Math.cos(n*t)*Math.pow(2,s*t)+a*t}),duration:1e3}):o.getMap().getView().animate({center:e.coordinate,duration:300}):o.getMap().getView().setCenter(e.coordinate),!1}}))},ol.ext.inherits(ol.control.Overview,ol.control.Control),ol.control.Overview.prototype.getOverviewMap=function(){return this.ovmap_},ol.control.Overview.prototype.toggleMap=function(){this.element.classList.toggle("ol-collapsed"),this.ovmap_.updateSize(),this.setView()},ol.control.Overview.prototype.setPosition=function(t){/top/.test(t)?this.element.classList.add("ol-control-top"):this.element.classList.remove("ol-control-top"),/right/.test(t)?this.element.classList.add("ol-control-right"):this.element.classList.remove("ol-control-right")},ol.control.Overview.prototype.setMap=function(t){this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,ol.control.Control.prototype.setMap.call(this,t),t&&(this._listener=t.getView().on("propertychange",this.setView.bind(this)),this.setView())},ol.control.Overview.prototype.calcExtent_=function(t){var e=this.getMap();if(e){var o=this.extentLayer.getSource();o.clear();var i=new ol.Feature,r=e.getSize(),n=e.getView().getResolution(),s=e.getView().getRotation(),a=e.getView().getCenter();if(n){var l=n*r[0]/2,c=n*r[1]/2,h=this.oview_.getResolution();if(l/h>5||c/h>5){var p,u,d,g=Math.cos(s),f=Math.sin(s);for(t=[[-l,-c],[-l,c],[l,c],[l,-c]],p=0;p<4;++p)u=t[p][0],d=t[p][1],t[p][0]=a[0]+u*g-d*f,t[p][1]=a[1]+u*f+d*g;i.setGeometry(new ol.geom.Polygon([t]))}else i.setGeometry(new ol.geom.Point(a));o.addFeature(i)}}},ol.control.Overview.prototype.setView=function(t){if(!t)return this.setView({key:"rotation"}),this.setView({key:"resolution"}),void this.setView({key:"center"});switch(t.key){case"rotation":this.rotation?this.oview_.setRotation(this.getMap().getView().getRotation()):this.oview_.getRotation()&&this.oview_.setRotation(0);break;case"center":var e=this.getMap().getView().calculateExtent(this.getMap().getSize()),o=this.oview_.calculateExtent(this.ovmap_.getSize());(e[0]<o[0]||e[1]<o[1]||e[2]>o[2]||e[3]>o[3])&&this.oview_.setCenter(this.getMap().getView().getCenter());break;case"resolution":var i=2*Math.round(this.oview_.getZoomForResolution(this.getMap().getView().getResolution())/2)-4;i=Math.min(this.maxZoom,Math.max(this.minZoom,i)),this.oview_.setZoom(i)}this.calcExtent_()},ol.control.Permalink=function(t){var e=t||{},o=this,i=document.createElement("button");function r(){"function"==typeof e.onclick?e.onclick(o.getLink()):o.setUrlReplace(!o.replaceState_)}this.replaceState_=!1!==e.urlReplace,this.fixed_=e.fixed||6,this.hash_=e.anchor?"#":"?",i.addEventListener("click",r,!1),i.addEventListener("touchstart",r,!1);var n=document.createElement("div");n.className=(e.className||"ol-permalink")+" ol-unselectable ol-control",n.appendChild(i),e.hidden&&ol.ext.element.hide(n),ol.control.Control.call(this,{element:n,target:e.target}),this.on("change",this.viewChange_.bind(this)),this.search_={};var s=document.location.hash||document.location.search;if(s){s=s.replace(/(^#|^\?)/,"").split("&");for(var a=0;a<s.length;a++){var l=s[a].split("=");switch(l[0]){case"lon":case"lat":case"z":case"r":case"l":break;default:this.search_[l[0]]=l[1]}}}this.setPosition()},ol.ext.inherits(ol.control.Permalink,ol.control.Control),ol.control.Permalink.prototype.setMap=function(t){this._listener&&(ol.Observable.unByKey(this._listener.change),ol.Observable.unByKey(this._listener.moveend)),this._listener=null,ol.control.Control.prototype.setMap.call(this,t),t&&(this._listener={change:t.getLayerGroup().on("change",this.layerChange_.bind(this)),moveend:t.on("moveend",this.viewChange_.bind(this))},this.setPosition())},ol.control.Permalink.prototype.getLayerByLink=function(t,e){!e&&this.getMap()&&(e=this.getMap().getLayers().getArray());for(var o=0;o<e.length;o++){if(e[o].get("permalink")==t)return e[o];if(e[o].getLayers){var i=this.getLayerByLink(t,e[o].getLayers().getArray());if(i)return i}}return!1},ol.control.Permalink.prototype.setPosition=function(){var t=this.getMap();if(t){var e=document.location.hash||document.location.search;if(e){var o,i,r={};for(e=e.replace(/(^#|^\?)/,"").split("&"),o=0;o<e.length;o++)r[(i=e[o].split("="))[0]]=i[1];var n=ol.proj.transform([Number(r.lon),Number(r.lat)],"EPSG:4326",t.getView().getProjection());if(n[0]&&n[1]&&t.getView().setCenter(n),r.z&&t.getView().setZoom(Number(r.z)),r.r&&t.getView().setRotation(Number(r.r)),r.l){!function e(o){o||(o=t.getLayers().getArray());for(var i=0;i<o.length;i++)o[i].get("permalink")&&o[i].setVisible(!1),o[i].getLayers&&e(o[i].getLayers().getArray())}();var s=r.l.split("|");for(o=0;o<s.length;o++){i=s[o].split(":");var a=this.getLayerByLink(i[0]),l=Number(i[1]);a&&(a.setOpacity(l),a.setVisible(!0))}}}}},ol.control.Permalink.prototype.getUrlParams=function(){return this.search_},ol.control.Permalink.prototype.setUrlParam=function(t,e){t&&(void 0===e||""===e?delete this.search_[encodeURIComponent(t)]:this.search_[encodeURIComponent(t)]=encodeURIComponent(e)),this.viewChange_()},ol.control.Permalink.prototype.getUrlParam=function(t){return decodeURIComponent(this.search_[encodeURIComponent(t)]||"")},ol.control.Permalink.prototype.hasUrlParam=function(t){return this.search_.hasOwnProperty(encodeURIComponent(t))},ol.control.Permalink.prototype.getLink=function(){var t=this.getMap(),e=ol.proj.transform(t.getView().getCenter(),t.getView().getProjection(),"EPSG:4326"),o=t.getView().getZoom(),i=t.getView().getRotation(),r=this.layerStr_,n="lon="+e[0].toFixed(this.fixed_)+"&lat="+e[1].toFixed(this.fixed_)+"&z="+o+(i?"&r="+Math.round(1e4*i)/1e4:"")+(r?"&l="+r:"");for(var s in this.search_)n+="&"+s+"="+this.search_[s];return document.location.protocol+"//"+document.location.host+document.location.pathname+this.hash_+n},ol.control.Permalink.prototype.setUrlReplace=function(t){try{if(this.replaceState_=t,t)window.history.replaceState(null,null,this.getLink());else{var e="";for(var o in this.search_)e+=(""==e?"?":"&")+o+"="+this.search_[o];window.history.replaceState(null,null,document.location.origin+document.location.pathname+e)}}catch(t){}},ol.control.Permalink.prototype.viewChange_=function(){try{this.replaceState_&&window.history.replaceState(null,null,this.getLink())}catch(t){}},ol.control.Permalink.prototype.layerChange_=function(){var t="";!function e(o){for(var i=0;i<o.length;i++)o[i].getVisible()&&o[i].get("permalink")&&(t&&(t+="|"),t+=o[i].get("permalink")+":"+o[i].get("opacity")),o[i].getLayers&&e(o[i].getLayers().getArray())}(this.getMap().getLayers().getArray()),this.layerStr_=t,this.viewChange_()},ol.control.Print=function(t){t||(t={});var e=ol.ext.element.create("DIV",{className:t.className||"ol-print"});t.target||(e.classList.add("ol-unselectable","ol-control"),ol.ext.element.create("BUTTON",{type:"button",click:function(){this.print()}.bind(this),parent:e})),ol.control.Control.call(this,{element:e,target:t.target}),this.set("imageType",t.imageType||"image/jpeg"),this.set("quality",t.quality||.8)},ol.ext.inherits(ol.control.Print,ol.control.Control),ol.control.Print.prototype.print=function(t){var e=(t=t||{}).imageType||this.get("imageType"),o=t.quality||this.get("quality");this.getMap()&&(this.dispatchEvent(Object.assign({type:"printing"},t)),this.getMap().once("rendercomplete",function(i){var r,n;i.context?r=i.context.canvas:this.getMap().getViewport().querySelectorAll(".ol-layer").forEach(function(t){if(t.width){if(!r){r=document.createElement("canvas");var o=this.getMap().getSize();r.width=o[0],r.height=o[1],n=r.getContext("2d"),/jp.*g$/.test(e)&&(n.fillStyle="white",n.fillRect(0,0,r.width,r.height))}n.save(),n.globalAlpha=t.style.opacity||1;var i=ol.ext.element.getStyle(t,"transform")||ol.ext.element.getStyle(t,"-webkit-transform");/^matrix/.test(i)?((i=i.replace(/^matrix\(|\)$/g,"").split(",")).forEach(function(t,e){i[e]=parseFloat(t)}),n.transform(i[0],i[1],i[2],i[3],i[4],i[5]),n.drawImage(t,0,0)):n.drawImage(t,0,0,ol.ext.element.getStyle(t,"width"),ol.ext.element.getStyle(t,"height")),n.restore()}}.bind(this));var s,a,l,c,h=[210,297];if(r){r.width>r.height?(c="landscape",h=[h[1],h[0]]):c="portrait";var p=Math.min((h[0]-20)/r.width,(h[1]-20)/r.height);s=p*r.width,a=p*r.height,l=[(h[0]-s)/2,(h[1]-a)/2]}var u=Object.assign({type:"print",print:{format:"a4",orientation:c,unit:"mm",size:h,position:l,imageWidth:s,imageHeight:a},image:r?r.toDataURL(e,o):null,imageType:e,canvas:r},t);this.dispatchEvent(u)}.bind(this)),this.getMap().render())},ol.control.Profil=function(t){var e=t||{};this.info=e.info||ol.control.Profil.prototype.info;var o,i=this;if(e.target)(o=document.createElement("div")).classList.add(e.className||"ol-profil");else{(o=document.createElement("div")).className=((e.className||"ol-profil")+" ol-unselectable ol-control ol-collapsed").trim(),this.button=document.createElement("button"),this.button.setAttribute("type","button");var r=function(t){i.toggle(),t.preventDefault()};this.button.addEventListener("click",r),this.button.addEventListener("touchstart",r),o.appendChild(this.button)}var n=document.createElement("div");n.classList.add("ol-inner"),o.appendChild(n);var s=document.createElement("div");s.style.position="relative",n.appendChild(s);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 l={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(l).forEach(function(t){t in i.canvas_.style&&(i.canvas_.style[t]=l[t])});var c=document.createElement("div");s.appendChild(c),c.style.width=this.canvas_.width/a+"px",c.style.height=this.canvas_.height/a+"px",c.appendChild(this.canvas_),c.addEventListener("click",function(t){i.onMove(t)}),c.addEventListener("mousemove",function(t){i.onMove(t)}),ol.control.Control.call(this,{element:o,target:e.target}),this.margin_={top:10*a,left:40*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",s.appendChild(this.bar_),this.cursor_=document.createElement("div"),this.cursor_.classList.add("ol-profilcursor"),s.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",s.appendChild(h);var p=document.createElement("tr");p.classList.add("track-info"),h.appendChild(p);var u=document.createElement("td");u.innerHTML=(this.info.zmin||"Zmin")+': <span class="zmin">',p.appendChild(u);var d=document.createElement("td");d.innerHTML=(this.info.zmax||"Zmax")+': <span class="zmax">',p.appendChild(d);var g=document.createElement("td");g.innerHTML=(this.info.distance||"Distance")+': <span class="dist">',p.appendChild(g);var f=document.createElement("td");f.innerHTML=(this.info.time||"Time")+': <span class="time">',p.appendChild(f);var m=document.createElement("tr");m.classList.add("point-info"),h.appendChild(m);var y=document.createElement("td");y.innerHTML=(this.info.altitude||"Altitude")+': <span class="z">',m.appendChild(y);var v=document.createElement("td");v.innerHTML=(this.info.distance||"Distance")+': <span class="dist">',m.appendChild(v);var _=document.createElement("td");_.innerHTML=(this.info.time||"Time")+': <span class="time">',m.appendChild(_),this.tab_=[],e.feature&&this.setGeometry(e.feature)},ol.ext.inherits(ol.control.Profil,ol.control.Control),ol.control.Profil.prototype.info={zmin:"Zmin",zmax:"Zmax",ytitle:"Altitude (m)",xtitle:"Distance (km)",time:"Time",altitude:"Altitude",distance:"Distance"},ol.control.Profil.prototype.popup=function(t){this.popup_.innerHTML=t},ol.control.Profil.prototype.onMove=function(t){if(this.tab_.length){var e=this.canvas_.getBoundingClientRect(),o=e.top+window.pageYOffset-document.documentElement.clientTop,i=e.left+window.pageXOffset-document.documentElement.clientLeft,r=t.pageX-i,n=t.pageY-o,s=this.ratio;if(r>this.margin_.left/s&&r<(this.canvas_.width-this.margin_.right)/s&&n>this.margin_.top/s&&n<(this.canvas_.height-this.margin_.bottom)/s){this.bar_.style.left=r+"px",this.bar_.style.display="block";for(var a,l=(r*s-this.margin_.left)/this.scale_[0],c=this.tab_[0],h=1;a=this.tab_[h];h++)if(a[0]>=l){l<(a[0]+c[0])/2&&(a=c);break}a?(this.cursor_.style.left=r+"px",this.cursor_.style.top=(this.canvas_.height-this.margin_.bottom+a[1]*this.scale_[1]+this.dy_)/s+"px",this.cursor_.style.display="block"):this.cursor_.style.display="none",this.bar_.parentElement.classList.add("over"),this.element.querySelector(".point-info .z").textContent=a[1]+"m",this.element.querySelector(".point-info .dist").textContent=(a[0]/1e3).toFixed(1)+"km",this.element.querySelector(".point-info .time").textContent=a[2],r>this.canvas_.width/s/2?this.popup_.classList.add("ol-left"):this.popup_.classList.remove("ol-left"),this.dispatchEvent({type:"over",click:"click"==t.type,coord:a[3],time:a[2],distance:a[0]})}else this.bar_.parentElement.classList.contains("over")&&(this.bar_.style.display="none",this.cursor_.style.display="none",this.bar_.parentElement.classList.remove("over"),this.dispatchEvent({type:"out"}))}},ol.control.Profil.prototype.show=function(){this.element.classList.remove("ol-collapsed"),this.dispatchEvent({type:"show",show:!0})},ol.control.Profil.prototype.hide=function(){this.element.classList.add("ol-collapsed"),this.dispatchEvent({type:"show",show:!1})},ol.control.Profil.prototype.toggle=function(){this.element.classList.toggle("ol-collapsed");var t=this.element.classList.contains("ol-collapsed");this.dispatchEvent({type:"show",show:!t})},ol.control.Profil.prototype.isShown=function(){return!this.element.classList.contains("ol-collapsed")},ol.control.Profil.prototype.setGeometry=function(t,e){e||(e={}),t instanceof ol.Feature&&(t=t.getGeometry());var o=this.canvas_,i=o.getContext("2d"),r=o.width,n=o.height;if(i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,r,n),/Z/.test(t.getLayout())){/M/.test(t.getLayout())?this.element.querySelector(".time").parentElement.style.display="block":this.element.querySelector(".time").parentElement.style.display="none";var s=t.getCoordinates();switch(t.getType()){case"LineString":break;case"MultiLineString":s=s[0];break;default:return}var a=e.projection||this.getMap().getView().getProjection();i.setTransform(1,0,0,1,this.margin_.left,n-this.margin_.bottom);var l=this.ratio;r-=this.margin_.right+this.margin_.left,n-=this.margin_.top+this.margin_.bottom,i.strokeStyle="#000",i.lineWidth=.5*l,i.beginPath(),i.moveTo(0,0),i.lineTo(0,-n),i.moveTo(0,0),i.lineTo(r,0),i.stroke();var c,h,p,u,d,g,f,m=1/0,y=-1/0,v=this.tab_=[];for(c=0;h=s[c];c++)(u=h[2])<m&&(m=u),u>y&&(y=u),0==c?p=0:p+=(g=s[c-1],f=h,ol.sphere.getDistance(ol.proj.transform(g,a,"EPSG:4326"),ol.proj.transform(f,a,"EPSG:4326"))),d=L(s[0][3],h[3]),v.push([p,u,d,h]);this.element.querySelector(".track-info .zmin").textContent=m.toFixed(2)+"m",this.element.querySelector(".track-info .zmax").textContent=y.toFixed(2)+"m",this.element.querySelector(".track-info .dist").textContent=p>1e3?(p/1e3).toFixed(1)+"km":p.toFixed(1)+"m",this.element.querySelector(".track-info .time").textContent=d;for(var _=e.graduation||100;;){if(!(n/(((y=Math.ceil(y/_)*_)-(m=Math.floor(m/_)*_))/_)<15*l))break;_*=2}"number"==typeof e.zmin&&m>e.zmin&&(m=e.zmin),"number"==typeof e.zmax&&y<e.zmax&&(y=e.zmax);var w=e.amplitude;w&&(y=Math.max(m+w,y));var x=r/p,S=-n/(y-m),b=this.dy_=-m*S;for(this.scale_=[x,S],i.font=10*l+"px arial",i.textAlign="right",i.textBaseline="middle",i.fillStyle="#000",i.beginPath(),c=m;c<=y;c+=_)"km"!=e.zunit?i.fillText(c,-4*l,c*S+b):i.fillText((c/1e3).toFixed(1),-4*l,c*S+b),i.moveTo(-2*l,c*S+b),0!=c?i.lineTo(p*x,c*S+b):i.lineTo(0,c*S+b);i.textAlign="center",i.textBaseline="top",i.setLineDash([l,3*l]);var C,M=e.unit||"km";for(p>1e3?(C=100*Math.round(p/1e3))>1e3&&(C=1e3*Math.ceil(C/1e3)):(M="m",C=p>100?10*Math.round(p/100):p>10?Math.round(p/10):p>1?Math.round(p)/10:p),c=0;c<=p;c+=C){var k="m"==M?c:c/1e3;i.fillText(Math.round(10*k)/10,c*x,4*l),i.moveTo(c*x,2*l),i.lineTo(c*x,0)}for(i.font=12*l+"px arial",i.fillText(this.info.xtitle.replace("(km)","("+M+")"),r/2,18*l),i.save(),i.rotate(-Math.PI/2),i.fillText(this.info.ytitle,n/2,-this.margin_.left),i.restore(),i.stroke(),i.strokeStyle="#369",i.lineWidth=1,i.setLineDash([]),i.beginPath(),c=0;h=v[c];c++)0==c?i.moveTo(h[0]*x,h[1]*S+b):i.lineTo(h[0]*x,h[1]*S+b);i.stroke()}function L(t,e){if(!t||!e)return"-";var o=(e-t)/60,i=Math.trunc(o/60),r=Math.trunc(o-60*i);return i+"h"+(r<10?"0":"")+r+"mn"}},ol.control.Profil.prototype.getImage=function(t,e){return"canvas"===t?this.canvas_:this.canvas_.toDataURL(t,e)},ol.control.RoutingGeoportail=function(t){var e=this;t||(t={}),null==t.typing&&(t.typing=300),this._classname=t.className||"search";var o=document.createElement("DIV"),i=(t.className||"")+" ol-routing";(t.target||(i+=" ol-unselectable ol-control"),o.setAttribute("class",i),t.target)||ol.ext.element.create("BUTTON",{parent:o}).addEventListener("click",function(){o.classList.toggle("ol-collapsed")});ol.control.Control.call(this,{element:o,target:t.target}),this.set("url","https://wxs.ign.fr/"+t.apiKey+"/itineraire/rest/route.json"),this._search=[];var r=ol.ext.element.create("DIV",{className:"content",parent:o}),n=document.createElement("DIV");this.addSearch(r,t),this.addSearch(r,t),r.appendChild(n),ol.ext.element.create("I",{className:"ol-car",title:t.carlabel||"by car",parent:r}).addEventListener("click",function(){e.setMode("car")}),ol.ext.element.create("I",{className:"ol-pedestrian",title:t.pedlabel||"pedestrian",parent:r}).addEventListener("click",function(){e.setMode("pedestrian")}),ol.ext.element.create("I",{className:"ol-ok",title:t.runlabel||"search",html:"OK",parent:r}).addEventListener("click",function(){e.calculate()}),this.resultElement=document.createElement("DIV"),this.resultElement.setAttribute("class","ol-result"),o.appendChild(this.resultElement),this.setMode(t.mode||"car")},ol.ext.inherits(ol.control.RoutingGeoportail,ol.control.Control),ol.control.RoutingGeoportail.prototype.setMode=function(t){this.set("mode",t),this.element.querySelector(".ol-car").classList.remove("selected"),this.element.querySelector(".ol-pedestrian").classList.remove("selected"),this.element.querySelector(".ol-"+t).classList.add("selected"),this.calculate()},ol.control.RoutingGeoportail.prototype.addButton=function(t,e,o){var i=document.createElement("I");return i.setAttribute("class",t),i.setAttribute("type","button"),i.setAttribute("title",e),i.innerHTML=o||"",this.element.appendChild(i),i},ol.control.RoutingGeoportail.prototype.addSearch=function(t,e){var o=this,i=ol.ext.element.create("DIV",{parent:t});ol.ext.element.create("BUTTON",{title:e.startlabel||"search",parent:i}).addEventListener("click",function(){o.resultElement.innerHTML=""});var r=new ol.control.SearchGeoportail({className:"IGNF ol-collapsed",apiKey:e.apiKey,target:i});this._search.push(r),r.on("select",function(t){r.setInput(t.search.fulltext),r.set("selection",t.search)}),r.element.querySelector("input").addEventListener("change",function(){r.set("selection",null),o.resultElement.innerHTML=""})},ol.control.RoutingGeoportail.prototype.setMap=function(t){ol.control.Control.prototype.setMap.call(this,t);for(var e=0;e<this._search.length;e++){this._search[e].setMap(t)}},ol.control.RoutingGeoportail.prototype.requestData=function(t,e){return{"gp-access-lib":"1.1.0",origin:t.x+","+t.y,destination:e.x+","+e.y,method:"time",graphName:"pedestrian"===this.get("mode")?"Pieton":"Voiture",waypoints:"",format:"STANDARDEXT"}},ol.control.RoutingGeoportail.prototype.listRouting=function(t){var e=t.duration/60;this.resultElement.innerHTML="";var o="";o+=e<60?e.toFixed(0)+" min":(e/60).toFixed(0)+" h "+(e%60).toFixed(0)+" min";var i=t.distance;o+=i<1e3?" ("+i.toFixed(0)+" m)":" ("+(i/1e3).toFixed(2)+" km)";var r=document.createElement("i");r.textContent=o,this.resultElement.appendChild(r);var n=document.createElement("ul");this.resultElement.appendChild(n);for(var s,a={none:"Prendre sur ",R:"Tourner à droite sur ",FR:"Tourner légèrement à droite sur ",L:"Tourner à gauche sur ",FL:"Tourner légèrement à gauche sur ",F:"Continuer tout droit sur "},l=0;s=t.features[l];l++){var c=s.get("distance");c=c<1e3?c.toFixed(0)+" m":(c/1e3).toFixed(2)+" km",o=s.get("durationT")/60,console.log(s.get("duration"),o),o=s.get("duration")<40?"":o<60?o.toFixed(0)+" min":(o/60).toFixed(0)+" h "+(o%60).toFixed(0)+" min";var h=document.createElement("li");h.classList.add(s.get("instruction")),h.innerHTML=(a[s.get("instruction")||"none"]||"#")+" "+s.get("name")+"<i>"+c+(o?" - "+o:"")+"</i>",n.appendChild(h)}},ol.control.RoutingGeoportail.prototype.handleResponse=function(t,e,o){for(var i,r,n={type:"routing",features:[]},s=0,a=0,l=[],c=0;r=t.legs[c];c++)for(var h,p=0;h=r.steps[p];p++){for(var u,d=[],g=0;u=h.points[g];g++)u=u.split(","),d.push([parseFloat(u[0]),parseFloat(u[1])]),0!==c&&0===g||l.push(d[g]);var f={geometry:(d=new ol.geom.LineString(d)).transform("EPSG:4326",this.getMap().getView().getProjection()),name:h.name,instruction:h.navInstruction,distance:parseFloat(h.distanceMeters),duration:parseFloat(h.durationSeconds)};s+=f.distance,a+=f.duration,f.distanceT=s,f.durationT=a,i=new ol.Feature(f),n.features.push(i)}return n.distance=parseFloat(t.distanceMeters),n.duration=parseFloat(t.durationSeconds),l=new ol.geom.LineString(l),n.feature=new ol.Feature({geometry:l.transform("EPSG:4326",this.getMap().getView().getProjection()),start:this._search[0].getTitle(e),end:this._search[0].getTitle(o),distance:n.distance,duration:n.duration}),this.dispatchEvent(n),this.path=n,n},ol.control.RoutingGeoportail.prototype.calculate=function(){this.resultElement.innerHTML="";for(var t=0;t<this._search.length;t++)if(!this._search[t].get("selection"))return;var e=this._search[0].get("selection"),o=this._search[1].get("selection"),i=this.requestData(e,o),r=encodeURI(this.get("url")),n="";for(var s in i)n+=n?"&":"?",i.hasOwnProperty(s)&&(n+=s+"="+i[s]);var a=this;this.ajax(r+n,function(t){t.status>=200&&t.status<400?a.listRouting(a.handleResponse(JSON.parse(t.response),e,o)):console.log(r+n,arguments)},function(){console.log(r+n,arguments)})},ol.control.RoutingGeoportail.prototype.ajax=function(t,e,o){var i=this;this._request&&this._request.abort();var r=this._request=new XMLHttpRequest;r.open("GET",t,!0),this._auth&&r.setRequestHeader("Authorization","Basic "+this._auth),this.element.classList.add("ol-searching"),r.onload=function(){i._request=null,i.element.classList.remove("ol-searching"),e.call(i,this)},r.onerror=function(){i._request=null,i.element.classList.remove("ol-searching"),o&&o.call(i)},r.send()},ol.control.Scale=function(t){t||(t={}),null==t.typing&&(t.typing=300);var e=document.createElement("DIV"),o=(t.className||"")+" ol-scale";t.target||(o+=" ol-unselectable ol-control"),this._input=document.createElement("INPUT"),this._input.value="-",e.setAttribute("class",o),!1===t.editable&&(this._input.readOnly=!0),e.appendChild(this._input),ol.control.Control.call(this,{element:e,target:t.target}),this._input.addEventListener("change",this.setScale.bind(this)),this.set("ppi",t.ppi||96)},ol.ext.inherits(ol.control.Scale,ol.control.Control),ol.control.Scale.prototype.setMap=function(t){this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,ol.control.Control.prototype.setMap.call(this,t),t&&(this._listener=t.on("moveend",this._showScale.bind(this)))},ol.control.Scale.prototype._showScale=function(){var t=this.getMap();if(t){var e=t.getView(),o=e.getProjection(),i=e.getCenter(),r=t.getPixelFromCoordinate(i);r[1]+=1;var n=t.getCoordinateFromPixel(r),s=ol.sphere.getDistance(ol.proj.transform(i,o,"EPSG:4326"),ol.proj.transform(n,o,"EPSG:4326"));s*=this.get("ppi")/.0254,this._input.value=this.formatScale(s)}},ol.control.Scale.prototype.formatScale=function(t){return"1 / "+(t=t>100?100*Math.round(t/100):Math.round(t)).toLocaleString()},ol.control.Scale.prototype.setScale=function(t){var e=this.getMap();if(e&&t){t.target&&(t=t.target.value);var o=t;"string"==typeof t&&((o=t.split("/")[1])||(o=t),o=o.replace(/[^\d]/g,""),o=parseInt(o));var i=e.getView(),r=i.getProjection(),n=i.getCenter(),s=e.getPixelFromCoordinate(n);s[1]+=1;var a=e.getCoordinateFromPixel(s),l=ol.sphere.getDistance(ol.proj.transform(n,r,"EPSG:4326"),ol.proj.transform(a,r,"EPSG:4326"));l*=this.get("ppi")/.0254,i.setResolution(i.getResolution()*o/l)}this._showScale()},ol.control.SearchBAN=function(t){(t=t||{}).typing=t.typing||500,t.url=t.url||"https://api-adresse.data.gouv.fr/search/",t.className=t.className||"BAN",t.copy='<a href="https://adresse.data.gouv.fr/" target="new">© BAN-data.gouv.fr</a>',ol.control.SearchPhoton.call(this,t)},ol.ext.inherits(ol.control.SearchBAN,ol.control.SearchPhoton),ol.control.SearchBAN.prototype.getTitle=function(t){return t.properties.label},ol.control.SearchBAN.prototype.select=function(t){var e=t.geometry.coordinates;try{e=ol.proj.transform(t.geometry.coordinates,"EPSG:4326",this.getMap().getView().getProjection())}catch(t){}this.dispatchEvent({type:"select",search:t,coordinate:e})},ol.control.SearchDFCI=function(t){t||(t={}),t.className=t.className||"dfci",t.placeholder=t.placeholder||"Code DFCI",ol.control.Search.call(this,t)},ol.ext.inherits(ol.control.SearchDFCI,ol.control.Search),ol.control.SearchDFCI.prototype.autocomplete=function(t){if((t=(t=t.toUpperCase()).replace(/[^0-9,^A-H,^K-N]/g,"")).length<2)return this.setInput(t),[];var e,o=this.getMap().getView().getProjection(),i=[],r=ol.coordinate.fromDFCI(t,o),n=Math.floor(t.length/2)-1,s=ol.coordinate.toDFCI(r,n,o);if(s=s.replace(/[^0-9,^A-H,^K-N]/g,""),!/NaN/.test(s)&&s){if(console.log("ok",s),this.setInput(s+t.substring(s.length,t.length)),i.push({coordinate:ol.coordinate.fromDFCI(s,o),name:s}),5===t.length)for(r=ol.coordinate.fromDFCI(t+0,o),s=ol.coordinate.toDFCI(r,n+1,o).substring(0,5),e=0;e<10;e++)i.push({coordinate:ol.coordinate.fromDFCI(s+e,o),name:s+e});if(2===n)for(e=0;e<6;e++)i.push({coordinate:ol.coordinate.fromDFCI(s+"."+e,o),name:s+"."+e})}return i},ol.control.SearchFeature=function(t){t||(t={}),t.className=t.className||"feature",ol.control.Search.call(this,t),"function"==typeof t.getSearchString&&(this.getSearchString=t.getSearchString),this.set("property",t.property||"name"),this.source_=t.source},ol.ext.inherits(ol.control.SearchFeature,ol.control.Search),ol.control.SearchFeature.prototype.restoreHistory=function(){this.set("history",[])},ol.control.SearchFeature.prototype.saveHistory=function(){localStorage.removeItem("ol@search-"+this._classname)},ol.control.SearchFeature.prototype.getTitle=function(t){return t.get(this.get("property")||"name")},ol.control.SearchFeature.prototype.getSearchString=function(t){return this.getTitle(t)},ol.control.SearchFeature.prototype.getSource=function(){return this.source_},ol.control.SearchFeature.prototype.setSource=function(t){this.source_=t},ol.control.SearchFeature.prototype.autocomplete=function(t){var e=[];if(this.source_){t=t.replace(/^\*/,"");for(var o,i=new RegExp(t,"i"),r=this.source_.getFeatures(),n=this.get("maxItems"),s=0;o=r[s];s++){var a=this.getSearchString(o);if(void 0!==a&&i.test(a)&&(e.push(o),--n<=0))break}}return e},ol.control.SearchGPS=function(t){t||(t={}),t.className=(t.className||"")+" ol-searchgps",t.placeholder=t.placeholder||"lon,lat",ol.control.Search.call(this,t),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)});var e=ol.ext.element.create("LABEL",{className:"ol-switch",parent:this.element});ol.ext.element.create("TEXT",{html:"decimal",parent:e}),ol.ext.element.create("INPUT",{type:"checkbox",parent:e,on:{change:function(t){t.target.checked?this.element.classList.add("ol-dms"):this.element.classList.remove("ol-dms")}.bind(this)}}),ol.ext.element.create("SPAN",{parent:e}),ol.ext.element.create("TEXT",{html:"DMS",parent:e}),this._createForm();var o=this.element.querySelector("ul.autocomplete");this.element.appendChild(o)},ol.ext.inherits(ol.control.SearchGPS,ol.control.Search),ol.control.SearchGPS.prototype._createForm=function(){var t=function(t){if(t.target.classList.contains("ol-dms")&&(i.value=(r.value<0?-1:1)*Number(r.value)+Number(n.value)/60+Number(s.value)/3600,i.value=(r.value<0?-1:1)*Math.round(1e7*i.value)/1e7,a.value=(l.value<0?-1:1)*Number(l.value)+Number(c.value)/60+Number(h.value)/3600,a.value=(l.value<0?-1:1)*Math.round(1e7*a.value)/1e7),i.value||a.value?this._input.value=i.value+","+a.value:this._input.value="",!t.target.classList.contains("ol-dms")){var e=ol.coordinate.toStringHDMS([Number(i.value),Number(a.value)]),o=e.replace(/(N|S|E|W)/g,"").split("″");o[1]=o[1].trim().split(" "),r.value=(/W/.test(e)?-1:1)*parseInt(o[1][0]),n.value=parseInt(o[1][1]),s.value=parseInt(o[1][2]),o[0]=o[0].trim().split(" "),l.value=(/W/.test(e)?-1:1)*parseInt(o[0][0]),c.value=parseInt(o[0][1]),h.value=parseInt(o[0][2])}this._input.dispatchEvent(new Event("search"))}.bind(this);function e(e,i){var r=ol.ext.element.create("INPUT",{className:e,type:"number",step:"any",lang:"en",parent:o,on:{"change keyup":t}});return i&&ol.ext.element.create("SPAN",{className:"ol-dms",html:i,parent:o}),r}var o=ol.ext.element.create("DIV",{className:"ol-longitude",parent:this.element});ol.ext.element.create("LABEL",{html:"Longitude",parent:o});var i=e("ol-decimal"),r=e("ol-dms","°"),n=e("ol-dms","'"),s=e("ol-dms",'"');o=ol.ext.element.create("DIV",{className:"ol-latitude",parent:this.element}),ol.ext.element.create("LABEL",{html:"Latitude",parent:o});var a=e("ol-decimal"),l=e("ol-dms","°"),c=e("ol-dms","'"),h=e("ol-dms",'"');this.button.addEventListener("click",function(){i.focus()}),this.on("select",function(t){i.value=t.search.gps[0],a.value=t.search.gps[1]}.bind(this)),this.geolocation.on("change",function(){this.geolocation.setTracking(!1);var t=this.geolocation.getPosition();i.value=t[0],a.value=t[1],i.dispatchEvent(new Event("keyup"))}.bind(this))},ol.control.SearchGPS.prototype.autocomplete=function(t){var e=[],o=t.split(",");o[0]=Number(o[0]),o[1]=Number(o[1]),(t=ol.coordinate.toStringHDMS(o))&&(t=t.replace(/(°|′|″) /g,"$1"));var i=ol.proj.transform([o[0],o[1]],"EPSG:4326",this.getMap().getView().getProjection());return e.push({gps:o,coordinate:i,name:t}),e},ol.control.SearchGeoportailParcelle=function(t){var e=this;t.type="Commune",t.className=t.className?t.className+" IGNF-parcelle":"IGNF-parcelle",t.inputLabel="Commune",t.noCollapse=!0,t.placeholder=t.placeholder||"Choisissez une commune...",ol.control.SearchGeoportail.call(this,t),this.set("copy",null);var o=this.element,i=document.createElement("DIV");o.appendChild(i);var r,n=document.createElement("LABEL");n.innerText="Préfixe",i.appendChild(n),(n=document.createElement("LABEL")).innerText="Section",i.appendChild(n),(n=document.createElement("LABEL")).innerText="Numéro",i.appendChild(n),i.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 s=function(){r&&clearTimeout(r),r=setTimeout(function(){e.autocompleteParcelle()},t.typing||0)};for(var a in this._inputParcelle)i.appendChild(this._inputParcelle[a]),this._inputParcelle[a].addEventListener("keyup",s);this.activateParcelle(!1);var l=document.createElement("UL");l.classList.add("autocomplete-parcelle"),o.appendChild(l),(l=document.createElement("UL")).classList.add("autocomplete-page"),o.appendChild(l),this._input.addEventListener("blur",function(){setTimeout(function(){o.classList.add("ol-collapsed-list")},200)}),this._input.addEventListener("focus",function(){o.classList.remove("ol-collapsed-list"),e._listParcelle([]),e._commune&&(e._commune=null,e._input.value="",e.drawList_()),e.activateParcelle(!1)}),this.on("select",this.selectCommune.bind(this)),this.set("pageSize",t.pageSize||5)},ol.ext.inherits(ol.control.SearchGeoportailParcelle,ol.control.SearchGeoportail),ol.control.SearchGeoportailParcelle.prototype.selectCommune=function(t){this._commune=t.search.insee,this._input.value=t.search.insee+" - "+t.search.fulltext,this.activateParcelle(!0),this._inputParcelle.numero.focus(),this.autocompleteParcelle()},ol.control.SearchGeoportailParcelle.prototype.activateParcelle=function(t){for(var e in this._inputParcelle)this._inputParcelle[e].readOnly=!t;t?this._inputParcelle.section.parentElement.classList.add("ol-active"):this._inputParcelle.section.parentElement.classList.remove("ol-active")},ol.control.SearchGeoportailParcelle.prototype.autocompleteParcelle=function(){var t=this;function e(t,e,o){if(!t)return t;for(o=o||"0";t.length<e;)t=o+t;return t.replace(/\*/g,"_")}var o=this._commune,i=e(this._inputParcelle.prefix.value,3);"000"===i&&(i="___");var r=e(this._inputParcelle.section.value,2),n=e(this._inputParcelle.numero.value,4,"0"),s='<?xml version="1.0" encoding="UTF-8"?><XLS xmlns:xls="http://www.opengis.net/xls" xmlns:gml="http://www.opengis.net/gml" xmlns="http://www.opengis.net/xls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="http://www.opengis.net/xls http://schemas.opengis.net/ols/1.2/olsAll.xsd"><RequestHeader/><Request requestID="1" version="1.2" methodName="LocationUtilityService"><GeocodeRequest returnFreeForm="false"><Address countryCode="CadastralParcel"><freeFormAddress>'+(o+(i||"___")+(r||"__")+(n||(r?"____":"0001")))+"+</freeFormAddress></Address></GeocodeRequest></Request></XLS>",a=this.get("url").replace("ols/apis/completion","geoportail/ols?xls=")+encodeURIComponent(s);this.ajax(a,function(e){for(var o,i=(new DOMParser).parseFromString(e.response,"text/xml").getElementsByTagName("GeocodedAddress"),r=[],n=0;o=i[n];n++){for(var s,a=(o.getElementsByTagName("gml:pos")[0]||o.getElementsByTagName("pos")[0]).childNodes[0].nodeValue.split(" "),l=o.getElementsByTagName("Place"),c={lon:Number(a[1]),lat:Number(a[0])},h=0;s=l[h];h++)c[s.attributes.type.value]=s.childNodes[0].nodeValue;r.push(c)}t._listParcelle(r)},function(){console.log("oops")})},ol.control.SearchGeoportailParcelle.prototype._listParcelle=function(t){var e=this,o=this.element.querySelector("ul.autocomplete-parcelle");o.innerHTML="";var i=this.element.querySelector("ul.autocomplete-page");function r(t){var e,r=o.children,n="ol-list-"+t;for(e=0;e<r.length;e++)r[e].style.display=r[e].className===n?"":"none";for(r=i.children,e=0;e<r.length;e++)r[e].className=r[e].innerText==t?"selected":"";i.style.display=r.length>1?"":"none"}i.innerHTML="",this._listParc=[],t.sort(function(t,e){var o=t.INSEE+t.CommuneAbsorbee+t.Section+t.Numero,i=e.INSEE+e.CommuneAbsorbee+e.Section+e.Numero;return o===i?0:o<i?-1:1});for(var n,s=this.get("pageSize"),a=0;n=t[a];a++){var l=document.createElement("LI");l.setAttribute("data-search",a),s>0&&l.classList.add("ol-list-"+Math.floor(a/s)),this._listParc.push(n),l.addEventListener("click",function(t){e._handleParcelle(e._listParc[t.currentTarget.getAttribute("data-search")])}),l.innerHTML=n.INSEE+n.CommuneAbsorbee+n.Section+n.Numero,o.appendChild(l),s>0&&!(a%s)&&((l=document.createElement("LI")).innerText=Math.floor(a/s),l.addEventListener("click",function(t){r(t.currentTarget.innerText)}),i.appendChild(l))}s>0&&r(0)},ol.control.SearchGeoportailParcelle.prototype._handleParcelle=function(t){this.dispatchEvent({type:"parcelle",search:t,coordinate:ol.proj.fromLonLat([t.lon,t.lat],this.getMap().getView().getProjection())})},ol.control.SearchNominatim=function(t){(t=t||{}).className=t.className||"nominatim",t.typing=t.typing||500,t.url=t.url||"https://nominatim.openstreetmap.org/search",t.copy='<a href="http://www.openstreetmap.org/copyright" target="new">© OpenStreetMap contributors</a>',ol.control.SearchJSON.call(this,t),this.set("polygon",t.polygon),this.set("viewbox",t.viewbox)},ol.ext.inherits(ol.control.SearchNominatim,ol.control.SearchJSON),ol.control.SearchNominatim.prototype.getTitle=function(t){var e=t.display_name+"<i>"+t.class+" - "+t.type+"</i>";return t.icon&&(e="<img src='"+t.icon+"' />"+e),e},ol.control.SearchNominatim.prototype.requestData=function(t){var e={format:"json",addressdetails:1,q:t,polygon_geojson:this.get("polygon")?1:0,limit:this.get("maxItems")};return this.get("viewbox")&&(e.viewbox=this.get("viewbox")),e},ol.control.SearchNominatim.prototype.select=function(t){var e=[Number(t.lon),Number(t.lat)];try{e=ol.proj.transform(e,"EPSG:4326",this.getMap().getView().getProjection())}catch(t){}this.dispatchEvent({type:"select",search:t,coordinate:e})},ol.control.SearchWikipedia=function(t){(t=t||{}).lang=t.lang||"en",t.className=t.className||"ol-search-wikipedia",t.url="https://"+t.lang+".wikipedia.org/w/api.php",t.placeholder=t.placeholder||"search string, File:filename",t.copy='<a href="https://'+t.lang+'.wikipedia.org/" target="new">Wikipedia® - CC-By-SA</a>',ol.control.SearchJSON.call(this,t),this.set("lang",t.lang)},ol.ext.inherits(ol.control.SearchWikipedia,ol.control.SearchJSON),ol.control.SearchWikipedia.prototype.getTitle=function(t){return ol.ext.element.create("DIV",{html:t.title,title:t.desc})},ol.control.SearchWikipedia.prototype.setLang=function(t){this.set("lang",t),this.set("url","https://"+t+".wikipedia.org/w/api.php")},ol.control.SearchWikipedia.prototype.requestData=function(t){return{action:"opensearch",search:t,lang:this.get("lang"),format:"json",origin:"*",limit:this.get("maxItems")}},ol.control.SearchWikipedia.prototype.handleResponse=function(t){for(var e=[],o=0;o<t[1].length;o++)e.push({title:t[1][o],desc:t[2][o],uri:t[3][o]});return e},ol.control.SearchWikipedia.prototype.select=function(t){var e=decodeURIComponent(t.uri.split("/").pop()).replace(/'/,"%27");ol.ext.Ajax.get({url:t.uri.split("wiki/")[0]+"w/api.php",data:{action:"query",prop:"pageimages|coordinates|extracts",exintro:1,explaintext:1,piprop:"original",origin:"*",format:"json",redirects:1,titles:e},options:{encode:!1},success:function(e){var o=e.query.pages[Object.keys(e.query.pages).pop()];console.log(o);var i,r={title:t.title,desc:o.extract||t.desc,url:t.uri,img:o.original?o.original.source:void 0,pageid:o.pageid};o.coordinates&&(r.lon=o.coordinates[0].lon,r.lat=o.coordinates[0].lat,i=[r.lon,r.lat],i=ol.proj.transform(i,"EPSG:4326",this.getMap().getView().getProjection())),this.dispatchEvent({type:"select",search:r,coordinate:i})}.bind(this)})},ol.control.Select=function(t){var e=this;t||(t={});var o=t.content=document.createElement("div");this._ul=ol.ext.element.create("UL",{parent:o}),this._all=ol.ext.element.create("INPUT",{type:"checkbox",checked:!0});var i=ol.ext.element.create("LABEL",{html:this._all,parent:o});ol.ext.element.appendText(i,t.allLabel||"match all"),this._useCase=ol.ext.element.create("INPUT",{type:"checkbox"});var r=ol.ext.element.create("LABEL",{html:this._useCase,parent:o});ol.ext.element.appendText(r,t.caseLabel||"case sensitive"),ol.control.SelectBase.call(this,t),ol.ext.element.create("BUTTON",{className:"ol-append",html:t.addLabel||"add rule",click:function(){e.addCondition()},parent:o}),this._conditions=[],this.set("attrPlaceHolder",t.attrPlaceHolder||"attribute"),this.set("valuePlaceHolder",t.valuePlaceHolder||"value"),this.addCondition()},ol.ext.inherits(ol.control.Select,ol.control.SelectBase),ol.control.Select.prototype.addCondition=function(t){t=t||{},this._conditions.push({attr:t.attr||"",op:t.op||"=",val:t.val||""}),this._drawlist()},ol.control.Select.prototype.getConditions=function(){return{usecase:this._useCase.checked,all:this._all.checked,conditions:this._conditions}},ol.control.Select.prototype.setConditions=function(t){this._useCase.checked=t.usecase,this._all.checked=t.all,this._conditions=t.conditions,this._drawlist()},ol.control.Select.prototype.getConditionsString=function(t){for(var e,o="",i=0;e=t.conditions[i];i++)e.attr&&(o+=(o?t.all?" AND ":" OR ":"")+e.attr+this.operationsList[e.op]+e.val);return o},ol.control.Select.prototype._drawlist=function(){this._ul.innerHTML="";for(var t=0;t<this._conditions.length;t++)this._ul.appendChild(this._getLiCondition(t))},ol.control.Select.prototype._autocomplete=function(t,e){e.classList.remove("ol-hidden"),e.innerHTML="";for(var o,i={},r=this.get("source"),n=0;o=r[n];n++)for(var s,a=o.getFeatures(),l=0;(s=a[l])&&(Object.assign(i,s.getProperties()),!(l>100));l++);var c=new RegExp(t,"i");for(var h in i)if("geometry"!==h&&c.test(h)){var p=document.createElement("li");p.textContent=h,p.addEventListener("click",function(){e.previousElementSibling.value=this.textContent;var t=document.createEvent("HTMLEvents");t.initEvent("change",!0,!1),e.previousElementSibling.dispatchEvent(t),e.classList.add("ol-hidden")}),e.appendChild(p)}},ol.control.Select.prototype._getLiCondition=function(t){var e=this,o=document.createElement("li"),i=document.createElement("div");i.classList.add("ol-autocomplete"),i.addEventListener("mouseleave",function(){this.querySelector("ul").classList.add("ol-hidden")}),o.appendChild(i);var r=document.createElement("input");r.classList.add("ol-attr"),r.setAttribute("type","text"),r.setAttribute("placeholder",this.get("attrPlaceHolder")),r.addEventListener("keyup",function(){e._autocomplete(this.value,this.nextElementSibling)}),r.addEventListener("click",function(){e._autocomplete(this.value,this.nextElementSibling),this.nextElementSibling.classList.remove("ol-hidden")}),r.addEventListener("change",function(){e._conditions[t].attr=this.value}),r.value=e._conditions[t].attr,i.appendChild(r);var n=document.createElement("ul");n.classList.add("ol-hidden"),i.appendChild(n);var s=document.createElement("select");for(var a in o.appendChild(s),this.operationsList){var l=document.createElement("option");l.value=a,l.textContent=this.operationsList[a],s.appendChild(l)}s.value=e._conditions[t].op,s.addEventListener("change",function(){e._conditions[t].op=this.value});var c=document.createElement("input");if(c.setAttribute("type","text"),c.setAttribute("placeholder",this.get("valuePlaceHolder")),c.addEventListener("change",function(){e._conditions[t].val=this.value}),c.value=e._conditions[t].val,o.appendChild(c),this._conditions.length>1){var h=document.createElement("div");h.classList.add("ol-delete"),h.addEventListener("click",function(){e.removeCondition(t)}),o.appendChild(h)}return o},ol.control.Select.prototype.removeCondition=function(t){this._conditions.splice(t,1),this._drawlist()},ol.control.Select.prototype.doSelect=function(t){return(t=t||{}).useCase=t.useCase||this._useCase.checked,t.matchAll=t.matchAll||this._all.checked,t.conditions=t.conditions||this._conditions,ol.control.SelectBase.prototype.doSelect.call(this,t)},ol.control.SelectCheck=function(t){t||(t={});var e=t.content=ol.ext.element.create("DIV");t.label&&ol.ext.element.create("LABEL",{html:t.label,parent:e}),this._input=ol.ext.element.create("DIV",{parent:e}),t.className=t.className||"ol-select-check",ol.control.SelectBase.call(this,t),this.set("property",t.property||"name"),this.set("max",t.max||1e4),this.set("defaultLabel",t.defaultLabel),this.set("type",t.type),this._selectAll=t.selectAll,this._onchoice=t.onchoice,this.setValues()},ol.ext.inherits(ol.control.SelectCheck,ol.control.SelectBase),ol.control.SelectCheck.prototype.setMap=function(t){ol.control.SelectBase.prototype.setMap.call(this,t),this.setValues()},ol.control.SelectCheck.prototype.doSelect=function(t){t=t||{};var e=[];return this._checks.forEach(function(t){t.checked&&t.value&&e.push({attr:this.get("property"),op:"=",val:t.value})}.bind(this)),e.length?ol.control.SelectBase.prototype.doSelect.call(this,{features:t.features,conditions:e}):ol.control.SelectBase.prototype.doSelect.call(this,{features:t.features,matchAll:this._selectAll})},ol.control.SelectCheck.prototype.setValues=function(t){var e,o;if(t=t||{},console.log(t),t.values)t.values instanceof Array?(o={},t.values.forEach(function(t){o[t]=t})):o=t.values;else{o={};var i=this.get("property");this.getSources().forEach(function(t){for(var e=t.getFeatures(),r=Math.min(e.length,this.get("max")),n=0;n<r;n++){var s=e[n].get(i);s&&(o[s]=s)}}.bind(this))}if(Object.keys(o).length){t.sort?(e={},Object.keys(o).sort().forEach(function(t){e[t]=o[t]})):e=o,ol.ext.element.setHTML(this._input,""),this._checks=[];var r="radio_"+(new Date).getTime(),n=function(t,e){var o=ol.ext.element.create("LABEL",{className:"radio"===this.get("type")?"ol-radio":"ol-checkbox",parent:this._input});this._checks.push(ol.ext.element.create("INPUT",{name:r,type:"radio"===this.get("type")?"radio":"checkbox",value:t,change:function(){this._onchoice?this._onchoice():this.doSelect()}.bind(this),parent:o})),ol.ext.element.create("DIV",{html:e,parent:o})}.bind(this);for(var s in this.get("defaultLabel")&&"radio"===this.get("type")&&n("",this.get("defaultLabel")),e)n(s,e[s])}},ol.control.SelectCondition=function(t){t||(t={});var e=t.content=ol.ext.element.create("DIV"),o=ol.ext.element.create("LABEL",{parent:e});this._check=ol.ext.element.create("INPUT",{type:"checkbox",change:function(){this._onchoice?this._onchoice():this.doSelect()}.bind(this),parent:o}),ol.ext.element.create("DIV",{html:t.label||"condition",parent:o}),this._input=ol.ext.element.create("DIV",{parent:e}),t.className=t.className||"ol-select-condition",ol.control.SelectBase.call(this,t),this.setCondition(t.condition),this._selectAll=t.selectAll,this._onchoice=t.onchoice},ol.ext.inherits(ol.control.SelectCondition,ol.control.SelectBase),ol.control.SelectCondition.prototype.setCondition=function(t){this._conditions=t?t instanceof Array?t:[t]:[]},ol.control.SelectCondition.prototype.addCondition=function(t){this._conditions.push(t)},ol.control.SelectCondition.prototype.doSelect=function(t){t=t||{};var e=this._conditions;return this._check.checked?ol.control.SelectBase.prototype.doSelect.call(this,{features:t.features,conditions:e}):ol.control.SelectBase.prototype.doSelect.call(this,{features:t.features,matchAll:this._selectAll})},ol.control.SelectFulltext=function(t){t||(t={});var e=t.content=ol.ext.element.create("DIV");t.label&&ol.ext.element.create("LABEL",{html:t.label,parent:e}),this._input=ol.ext.element.create("INPUT",{placeHolder:t.placeHolder||"search...",change:function(){this._onchoice&&this._onchoice()}.bind(this),parent:e}),ol.control.SelectBase.call(this,t),this._onchoice=t.onchoice,this.set("property",t.property||"name")},ol.ext.inherits(ol.control.SelectFulltext,ol.control.SelectBase),ol.control.SelectFulltext.prototype.doSelect=function(t){return t=t||{},ol.control.SelectBase.prototype.doSelect.call(this,{features:t.features,useCase:!1,conditions:[{attr:this.get("property"),op:"contain",val:this._input.value}]})},ol.control.SelectMulti=function(t){t||(t={}),t.content=ol.ext.element.create("DIV"),this._container=ol.ext.element.create("UL",{parent:t.content}),t.className=t.className||"ol-select-multi",ol.control.SelectBase.call(this,t),this._controls=[],t.controls.forEach(this.addControl.bind(this))},ol.ext.inherits(ol.control.SelectMulti,ol.control.SelectBase),ol.control.SelectMulti.prototype.setMap=function(t){this.getMap()&&this._controls.forEach(function(t){this.getMap().remveControl(t)}.bind(this)),ol.control.SelectBase.prototype.setMap.call(this,t),this.getMap()&&this._controls.forEach(function(t){this.getMap().addControl(t)}.bind(this))},ol.control.SelectMulti.prototype.addControl=function(t){t instanceof ol.control.SelectBase&&(this._controls.push(t),t.setTarget(ol.ext.element.create("LI",{parent:this._container})),t._selectAll=!0,t._onchoice=this.doSelect.bind(this),this.getMap()&&this.getMap().addControl(t))},ol.control.SelectMulti.prototype.getControls=function(){return this._controls},ol.control.SelectMulti.prototype.doSelect=function(){var t=[];return this.getSources().forEach(function(e){t=t.concat(e.getFeatures())}),this._controls.forEach(function(e){t=e.doSelect({features:t})}),this.dispatchEvent({type:"select",features:t}),t},ol.control.SelectPopup=function(t){t||(t={});var e=t.content=ol.ext.element.create("DIV");t.label&&ol.ext.element.create("LABEL",{html:t.label,parent:e}),this._input=ol.ext.element.create("SELECT",{on:{change:function(){this._onchoice?this._onchoice():this.doSelect()}.bind(this)},parent:e}),t.className=t.className||"ol-select-popup",ol.control.SelectBase.call(this,t),this.set("property",t.property||"name"),this.set("max",t.max||1e4),this.set("defaultLabel",t.defaultLabel),this._selectAll=t.selectAll,this._onchoice=t.onchoice,this.setValues()},ol.ext.inherits(ol.control.SelectPopup,ol.control.SelectBase),ol.control.SelectPopup.prototype.setMap=function(t){ol.control.SelectBase.prototype.setMap.call(this,t),this.setValues()},ol.control.SelectPopup.prototype.doSelect=function(t){return t=t||{},this._input.value?ol.control.SelectBase.prototype.doSelect.call(this,{features:t.features,conditions:[{attr:this.get("property"),op:"=",val:this._input.value}]}):ol.control.SelectBase.prototype.doSelect.call(this,{features:t.features,matchAll:this._selectAll})},ol.control.SelectPopup.prototype.setValues=function(t){var e,o;if((t=t||{}).values)t.values instanceof Array?(o={},t.values.forEach(function(t){o[t]=t})):o=t.values;else{o={};var i=this.get("property");this.getSources().forEach(function(t){for(var e=t.getFeatures(),r=Math.min(e.length,this.get("max")),n=0;n<r;n++){var s=e[n].get(i);s&&(o[s]=s)}}.bind(this))}for(var r in t.sort?(e={},Object.keys(o).sort().forEach(function(t){e[t]=o[t]})):e=o,ol.ext.element.setHTML(this._input,""),ol.ext.element.create("OPTION",{className:"ol-default",html:this.get("defaultLabel")||"",value:"",parent:this._input}),e)ol.ext.element.create("OPTION",{html:e[r],value:r,parent:this._input})},ol.control.Storymap=function(t){t.target&&(t.html?t.html instanceof Element&&(t.html=t.html.innerHTML):t.html=t.target.innerHTML,t.target.innerHTML="");var e=ol.ext.element.create("DIV",{className:(t.className||"")+" ol-storymap"+(t.target?"":" ol-unselectable ol-control")+(ol.has.TOUCH?" ol-touch":""),html:t.html});ol.control.Control.call(this,{element:e,target:t.target}),ol.ext.element.scrollDiv(this.element,{vertical:!0,mousewheel:!0});var o=this.element.querySelectorAll(".ol-scroll-next");o.forEach(function(t){t.addEventListener("click",function(){for(var e,o=this.element.querySelectorAll(".chapter"),i=t.offsetTop,r=0;e=o[r];r++)if(e.offsetTop>i){i=e.offsetTop;break}this.element.scrollTop=i}.bind(this))}.bind(this)),(o=this.element.querySelectorAll(".ol-scroll-top")).forEach(function(t){t.addEventListener("click",function(){this.element.scrollTop=0}.bind(this))}.bind(this));var i=this.element.querySelectorAll(".chapter")[0];setTimeout(function(){this.dispatchEvent({type:"scrollto",start:!0,element:i,name:i.getAttribute("name")})}.bind(this)),this.element.addEventListener("scroll",function(){var t,e=this.element.querySelectorAll(".chapter"),o=ol.ext.element.getStyle(this.element,"height");if(this.element.scrollTop)for(var r,n=0;r=e[n];n++){if(r.offsetTop-this.element.scrollTop>o/3)break;t=r}else t=e[0];t&&t!==i&&(i=t,this.dispatchEvent({type:"scrollto",element:i,name:i.getAttribute("name")}))}.bind(this))},ol.ext.inherits(ol.control.Storymap,ol.control.Control),ol.control.Storymap.prototype.setChapter=function(t){for(var e,o=this.element.querySelectorAll(".chapter"),i=0;e=o[i];i++)e.getAttribute("name")===t&&(this.element.scrollTop=e.offsetTop)},ol.control.Swipe=function(t){t=t||{};var e=document.createElement("button"),o=document.createElement("div");o.className=(t.className||"ol-swipe")+" ol-unselectable ol-control",o.appendChild(e),o.addEventListener("mousedown",this.move.bind(this)),o.addEventListener("touchstart",this.move.bind(this)),ol.control.Control.call(this,{element:o}),this.precomposeRight_=this.precomposeRight.bind(this),this.precomposeLeft_=this.precomposeLeft.bind(this),this.postcompose_=this.postcompose.bind(this),this.layers=[],t.layers&&this.addLayer(t.layers,!1),t.rightLayers&&this.addLayer(t.rightLayers,!0),this.on("propertychange",function(){this.getMap()&&this.getMap().renderSync(),"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=""),this.element.classList.remove("horizontal","vertical"),this.element.classList.add(this.get("orientation"))}.bind(this)),this.set("position",t.position||.5),this.set("orientation",t.orientation||"vertical")},ol.ext.inherits(ol.control.Swipe,ol.control.Control),ol.control.Swipe.prototype.setMap=function(t){var e;if(this.getMap()){for(e=0;e<this.layers.length;e++)o.right?o.layer.un(["precompose","prerender"],this.precomposeRight_):o.layer.un(["precompose","prerender"],this.precomposeLeft_),o.layer.un(["postcompose","postrender"],this.postcompose_);this.getMap().renderSync()}if(ol.control.Control.prototype.setMap.call(this,t),t){for(this._listener=[],e=0;e<this.layers.length;e++){var o=this.layers[e];o.right?o.layer.on(["precompose","prerender"],this.precomposeRight_):o.layer.on(["precompose","prerender"],this.precomposeLeft_),o.layer.on(["postcompose","postrender"],this.postcompose_)}t.renderSync()}},ol.control.Swipe.prototype.isLayer_=function(t){for(var e=0;e<this.layers.length;e++)if(this.layers[e].layer===t)return e;return-1},ol.control.Swipe.prototype.addLayer=function(t,e){t instanceof Array||(t=[t]);for(var o=0;o<t.length;o++){var i=t[o];this.isLayer_(i)<0&&(this.layers.push({layer:i,right:e}),this.getMap()&&(e?i.on(["precompose","prerender"],this.precomposeRight_):i.on(["precompose","prerender"],this.precomposeLeft_),i.on(["postcompose","postrender"],this.postcompose_),this.getMap().renderSync()))}},ol.control.Swipe.prototype.removeLayer=function(t){t instanceof Array||(t=[t]);for(var e=0;e<t.length;e++){var o=this.isLayer_(t[e]);o>=0&&this.getMap()&&(this.layers[o].right?t[e].un(["precompose","prerender"],this.precomposeRight_):t[e].un(["precompose","prerender"],this.precomposeLeft_),t[e].un(["postcompose","postrender"],this.postcompose_),this.layers.splice(o,1),this.getMap().renderSync())}},ol.control.Swipe.prototype.move=function(t){var e,o=this;switch(t.type){case"touchcancel":case"touchend":case"mouseup":o.isMoving=!1,["mouseup","mousemove","touchend","touchcancel","touchmove"].forEach(function(t){document.removeEventListener(t,o.move)});break;case"mousedown":case"touchstart":o.isMoving=!0,["mouseup","mousemove","touchend","touchcancel","touchmove"].forEach(function(t){document.addEventListener(t,o.move.bind(o))});case"mousemove":case"touchmove":if(o.isMoving)if("vertical"===o.get("orientation")){var i=t.pageX||t.touches&&t.touches.length&&t.touches[0].pageX||t.changedTouches&&t.changedTouches.length&&t.changedTouches[0].pageX;if(!i)break;i-=o.getMap().getTargetElement().getBoundingClientRect().left+window.pageXOffset-document.documentElement.clientLeft,e=o.getMap().getSize()[0],e=Math.min(Math.max(0,1-(e-i)/e),1),o.set("position",e)}else{var r=t.pageY||t.touches&&t.touches.length&&t.touches[0].pageY||t.changedTouches&&t.changedTouches.length&&t.changedTouches[0].pageY;if(!r)break;r-=o.getMap().getTargetElement().getBoundingClientRect().top+window.pageYOffset-document.documentElement.clientTop,e=o.getMap().getSize()[1],e=Math.min(Math.max(0,1-(e-r)/e),1),o.set("position",e)}}},ol.control.Swipe.prototype.precomposeLeft=function(t){var e=t.context,o=e.canvas;e.save(),e.beginPath(),"vertical"===this.get("orientation")?e.rect(0,0,o.width*this.get("position"),o.height):e.rect(0,0,o.width,o.height*this.get("position")),e.clip()},ol.control.Swipe.prototype.precomposeRight=function(t){var e=t.context,o=e.canvas;e.save(),e.beginPath(),"vertical"===this.get("orientation")?e.rect(o.width*this.get("position"),0,o.width,o.height):e.rect(0,o.height*this.get("position"),o.width,o.height),e.clip()},ol.control.Swipe.prototype.postcompose=function(t){t.context.restore()},ol.control.Target=function(t){t=t||{},this.style=t.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})})})],this.style instanceof Array||(this.style=[this.style]),this.composite=t.composite||"";var e=document.createElement("div");e.className="ol-target ol-unselectable ol-control",ol.control.CanvasBase.call(this,{element:e,target:t.target}),this.setVisible(!1!==t.visible)},ol.ext.inherits(ol.control.Target,ol.control.CanvasBase),ol.control.Target.prototype.setMap=function(t){this.getMap()&&this.getVisible()&&this.getMap().renderSync(),this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,ol.control.CanvasBase.prototype.setMap.call(this,t),t&&(this._listener=t.on("postcompose",this.drawTarget_.bind(this)))},ol.control.Target.prototype.setVisible=function(t){this.set("visible",t),this.getMap()&&this.getMap().renderSync()},ol.control.Target.prototype.getVisible=function(){return this.get("visible")},ol.control.Target.prototype.drawTarget_=function(t){if(this.getMap()&&this.getVisible()){var e=this.getContext(t),o=t.frameState.pixelRatio;e.save(),e.scale(o,o);var i=e.canvas.width/(2*o),r=e.canvas.height/(2*o),n=new ol.geom.Point(this.getMap().getCoordinateFromPixel([i,r]));this.composite&&(e.globalCompositeOperation=this.composite);for(var s=0;s<this.style.length;s++){var a=this.style[s];if(a instanceof ol.style.Style){var l=0,c=!ol.Map.prototype.getFeaturesAtPixel&&a.getImage();c&&(l=c.getScale(),c.setScale(o*l));var h=t.vectorContext;if(!h){var p={inversePixelTransform:[o,0,0,o,0,0],context:e,frameState:{pixelRatio:o,extent:t.frameState.extent,coordinateToPixelTransform:t.frameState.coordinateToPixelTransform,viewState:t.frameState.viewState}};h=ol.render.getVectorContext(p)}h.setStyle(a),h.drawGeometry(n),c&&c.setScale(l)}}e.restore()}},ol.control.TextButton=function(t){(t=t||{}).className=(t.className||"")+" ol-text-button",ol.control.Button.call(this,t)},ol.ext.inherits(ol.control.TextButton,ol.control.Button),ol.control.Timeline=function(t){var e=ol.ext.element.create("DIV",{className:(t.className||"")+" ol-timeline"+(t.target?"":" ol-unselectable ol-control")+(t.zoomButton?" ol-hasbutton":"")+(ol.has.TOUCH?" ol-touch":"")});ol.control.Control.call(this,{element:e,target:t.target}),this._scrollDiv=ol.ext.element.create("DIV",{className:"ol-scroll",parent:this.element}),this._buttons=ol.ext.element.create("DIV",{className:"ol-buttons",parent:this.element}),t.zoomButton&&(this.addButton({className:"ol-zoom-in",handleClick:function(){var t=this.get("zoom");t>=1?t++:t=Math.min(1,t+.1),t=Math.round(100*t)/100,this.refresh(t)}.bind(this)}),this.addButton({className:"ol-zoom-out",handleClick:function(){var t=this.get("zoom");t>1?t--:t-=.1,t=Math.round(100*t)/100,this.refresh(t)}.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 o=null;this._scrollDiv.addEventListener("scroll",function(){o&&(clearTimeout(o),o=null),o=setTimeout(function(){this.dispatchEvent({type:"scroll",date:this.getDate(),dateStart:this.getDate("start"),dateEnd:this.getDate("end")})}.bind(this),t.scrollTimeout||15)}.bind(this)),this._scrollDiv.addEventListener("gesturechange",function(){}),ol.ext.element.scrollDiv(this._scrollDiv,{onmove:function(t){this._moving=t}.bind(this)}),this._tline=[],this.set("maxWidth",t.maxWidth||2e3),this.set("minDate",t.minDate||1/0),this.set("maxDate",t.maxDate||-1/0),this.set("graduation",t.graduation),this.set("minZoom",t.minZoom||.2),this.set("maxZoom",t.maxZoom||4),this.setInterval(t.interval),t.getHTML&&(this._getHTML=t.getHTML),t.getFeatureDate&&(this._getFeatureDate=t.getFeatureDate),t.endFeatureDate&&(this._endFeatureDate=t.endFeatureDate),this.setFeatures(t.features||t.source,t.zoom)},ol.ext.inherits(ol.control.Timeline,ol.control.Control),ol.control.Timeline.prototype.setMap=function(t){ol.control.Control.prototype.setMap.call(this,t),this.refresh(this.get("zoom")||1,!0)},ol.control.Timeline.prototype.addButton=function(t){this.element.classList.add("ol-hasbutton"),ol.ext.element.create("BUTTON",{className:t.className||void 0,title:t.title,html:t.html,click:t.handleClick,parent:this._buttons})},ol.control.Timeline.prototype.setInterval=function(t){"string"==typeof t&&(t=/s$/.test(t)?1e3*parseFloat(t):/mn$/.test(t)?1e3*parseFloat(t)*60:/h$/.test(t)?1e3*parseFloat(t)*3600:/d$/.test(t)?1e3*parseFloat(t)*3600*24:/y$/.test(t)?1e3*parseFloat(t)*3600*24*365:0),this.set("interval",t||0),t?this.element.classList.add("ol-interval"):this.element.classList.remove("ol-interval"),this.refresh(this.get("zoom"))},ol.control.Timeline.prototype._getHTML=function(t){return t.get("name")||""},ol.control.Timeline.prototype._getFeatureDate=function(t){return t&&t.get?t.get("date"):null},ol.control.Timeline.prototype._endFeatureDate=function(){},ol.control.Timeline.prototype.isCollapsed=function(){return this.element.classList.contains("ol-collapsed")},ol.control.Timeline.prototype.collapse=function(t){t?this.element.classList.add("ol-collapsed"):this.element.classList.remove("ol-collapsed"),this.dispatchEvent({type:"collapse",collapsed:this.isCollapsed()})},ol.control.Timeline.prototype.toggle=function(){this.element.classList.toggle("ol-collapsed"),this.dispatchEvent({type:"collapse",collapsed:this.isCollapsed()})},ol.control.Timeline.prototype.setFeatures=function(t,e){this._features=this._source=null,t instanceof ol.source.Vector?this._source=t:t instanceof Array?this._features=t:this._features=[],this.refresh(e)},ol.control.Timeline.prototype.getFeatures=function(){return this._features||this._source.getFeatures()},ol.control.Timeline.prototype.refresh=function(t,e){if(this.getMap()){t||(t=this.get("zoom")),t=Math.min(this.get("maxZoom"),Math.max(this.get("minZoom"),t||1)),this.set("zoom",t),this._scrollDiv.innerHTML="";var o,i,r=this.getFeatures(),n=this._tline=[];r.forEach(function(t){(o=this._getFeatureDate(t))&&(o instanceof Date||(o=new Date(o)),this._endFeatureDate&&((i=this._endFeatureDate(t))instanceof Date||(i=new Date(i))),isNaN(o)||n.push({date:o,end:isNaN(i)?null:i,feature:t}))}.bind(this)),n.sort(function(t,e){return t.date<e.date?-1:t.date===e.date?0:1});var s=ol.ext.element.create("DIV",{parent:this._scrollDiv}),a=this._minDate=Math.min(this.get("minDate"),n.length?n[0].date:1/0),l=this._maxDate=Math.max(this.get("maxDate"),n.length?n[n.length-1].date:-1/0);isFinite(a)||(this._minDate=a=new Date),isFinite(l)||(this._maxDate=l=new Date);var c=l-a,h=this.get("maxWidth"),p=this._scale=(c>h?h/c:1)*t;c=(l-(a=this._minDate=this._minDate-10/p))*p,ol.ext.element.setStyle(s,{width:c,maxWidth:"unset"}),this._drawTime(s,a,l,p),this.get("interval")?ol.ext.element.setStyle(this._intervalDiv,{width:this.get("interval")*p}):ol.ext.element.setStyle(this._intervalDiv,{width:""});var u=[],d=ol.ext.element.getStyle(this._scrollDiv,"lineHeight"),g=ol.ext.element.create("DIV",{className:"ol-features",parent:s});n.forEach(function(t){for(var e=t.date,o=t.elt=ol.ext.element.create("DIV",{className:"ol-feature",style:{left:Math.round((e-a)*p)},html:this._getHTML(t.feature),parent:g}),i=o.querySelectorAll("img"),r=0;r<i.length;r++)i[r].ondragstart=function(){return!1};t.end&&ol.ext.element.setStyle(o,{minWidth:(t.end-e)*p,width:(t.end-e)*p,maxWidth:"unset"});var n,s,l=ol.ext.element.getStyle(o,"left");for(o.addEventListener("click",function(){this._moving||this.dispatchEvent({type:"select",feature:t.feature})}.bind(this)),n=0;(s=u[n])&&!(l>s);n++);u[n]=l+ol.ext.element.getStyle(o,"width"),ol.ext.element.setStyle(o,{top:n*d})}.bind(this)),this._nbline=u.length,e&&this.setDate(this._minDate,{anim:!1,position:"start"}),this.dispatchEvent({type:"scroll",date:this.getDate(),dateStart:this.getDate("start"),dateEnd:this.getDate("end")})}},ol.control.Timeline.prototype._drawTime=function(t,e,o,i){var r,n,s,a,l=ol.ext.element.create("DIV",{className:"ol-times",parent:t}),c=ol.ext.element.getStyle(l,"left"),h=ol.ext.element.getStyle(l,"height"),p=new Date(this._minDate).getFullYear();n=(new Date(String(p))-new Date(String(p-1)))*i;for(var u=Math.round(2*h/n)+1;!((r=new Date(String(p)))>this._maxDate);)ol.ext.element.create("DIV",{className:"ol-time ol-year",style:{left:Math.round((r-this._minDate)*i)-c},html:p,parent:l}),p+=u;if(/day|month/.test(this.get("graduation"))&&(n=(new Date(String(p))-new Date(String(p-1)))*i,(a=Math.max(1,Math.round(12/Math.round(n/h/2))))<12))for(p=new Date(this._minDate).getFullYear(),s=a+1;!((r=new Date(p+"/"+s+"/01"))>this._maxDate);)ol.ext.element.create("DIV",{className:"ol-time ol-month",style:{left:Math.round((r-this._minDate)*i)-c},html:r.toLocaleDateString(void 0,{month:"short"}),parent:l}),(s+=a)>12&&(p++,s=a+1);if("day"===this.get("graduation")){n=(new Date(p+"/02/01")-new Date(p+"/01/01"))*i;var d=Math.max(1,Math.round(31/Math.round(n/h/2)));if(d<31){p=new Date(this._minDate).getFullYear(),s=1;for(var g=d;;)if(r=new Date(p+"/"+s+"/"+g),isNaN(r))++s>12&&(s=1,p++),g=d;else{if(r>this._maxDate)break;ol.ext.element.create("DIV",{className:"ol-time ol-day",style:{left:Math.round((r-this._minDate)*i)-c},html:g,parent:l}),(g+=d)+d/2>31&&(g=32)}}}},ol.control.Timeline.prototype.setDate=function(t,e){var o;if(e=e||{},t instanceof Date?o=t:(this.getFeatures().indexOf(t)>=0&&(o=this._getFeatureDate(t)),!o||o instanceof Date||(o=new Date(o)),o&&!isNaN(o)||(o=new Date(String(t)))),!isNaN(o)){!1===e.anim&&this._scrollDiv.classList.add("ol-move");var i=(o-this._minDate)*this._scale;if("start"===e.position?i+=ol.ext.element.outerWidth(this._scrollDiv)/2-ol.ext.element.getStyle(this._scrollDiv,"marginLeft")/2:"end"===e.position&&(i-=ol.ext.element.outerWidth(this._scrollDiv)/2-ol.ext.element.getStyle(this._scrollDiv,"marginLeft")/2),this._scrollDiv.scrollLeft=i,!1===e.anim&&this._scrollDiv.classList.remove("ol-move"),t)for(var r,n=0;r=this._tline[n];n++)r.feature===t?(r.elt.classList.add("ol-select"),this._select=r):r.elt.classList.remove("ol-select")}},ol.control.Timeline.prototype.getDate=function(t){var e;switch(t){case"start":e=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":e=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:e=0}var o=(this._scrollDiv.scrollLeft+e)/this._scale+this._minDate;return new Date(o)},ol.control.Toggle=function(t){t=t||{};var e=this;this.interaction_=t.interaction,this.interaction_&&this.interaction_.on("change:active",function(t){e.setActive(!t.oldValue)}),t.toggleFn&&(t.onToggle=t.toggleFn),t.handleClick=function(){e.toggle(),t.onToggle&&t.onToggle.call(e,e.getActive())},t.className=(t.className||"")+" ol-toggle",ol.control.Button.call(this,t),this.set("title",t.title),this.set("autoActivate",t.autoActivate),t.bar&&(this.subbar_=t.bar,this.subbar_.setTarget(this.element),this.subbar_.element.classList.add("ol-option-bar")),this.setActive(t.active),this.setDisable(t.disable)},ol.ext.inherits(ol.control.Toggle,ol.control.Button),ol.control.Toggle.prototype.setMap=function(t){!t&&this.getMap()&&(this.interaction_&&this.getMap().removeInteraction(this.interaction_),this.subbar_&&this.getMap().removeControl(this.subbar_)),ol.control.Control.prototype.setMap.call(this,t),t&&(this.interaction_&&t.addInteraction(this.interaction_),this.subbar_&&t.addControl(this.subbar_))},ol.control.Toggle.prototype.getSubBar=function(){return this.subbar_},ol.control.Toggle.prototype.getDisable=function(){var t=this.element.querySelector("button");return t&&t.disabled},ol.control.Toggle.prototype.setDisable=function(t){this.getDisable()!=t&&(this.element.querySelector("button").disabled=t,t&&this.getActive()&&this.setActive(!1),this.dispatchEvent({type:"change:disable",key:"disable",oldValue:!t,disable:t}))},ol.control.Toggle.prototype.getActive=function(){return this.element.classList.contains("ol-active")},ol.control.Toggle.prototype.toggle=function(){this.getActive()?this.setActive(!1):this.setActive(!0)},ol.control.Toggle.prototype.setActive=function(t){this.getActive()!=t&&(t?this.element.classList.add("ol-active"):this.element.classList.remove("ol-active"),this.interaction_&&this.interaction_.setActive(t),this.subbar_&&this.subbar_.setActive(t),this.dispatchEvent({type:"change:active",key:"active",oldValue:!t,active:t}))},ol.control.Toggle.prototype.setInteraction=function(t){this.interaction_=t},ol.control.Toggle.prototype.getInteraction=function(){return this.interaction_},ol.featureAnimation=function(t){t=t||{},this.duration_="number"==typeof t.duration?t.duration>=0?t.duration:0:1e3,this.fade_="function"==typeof t.fade?t.fade:null,this.repeat_=Number(t.repeat);var e="function"==typeof t.easing?t.easing:ol.easing.linear;t.revers?this.easing_=function(t){return 1-e(t)}:this.easing_=e,this.hiddenStyle=t.hiddenStyle,ol.Object.call(this)},ol.ext.inherits(ol.featureAnimation,ol.Object),ol.featureAnimation.prototype.drawGeom_=function(t,e,o){this.fade_&&(t.context.globalAlpha=this.fade_(1-t.elapsed));for(var i=t.style,r=0;r<i.length;r++){var n=0,s=!ol.Map.prototype.getFeaturesAtPixel&&i[r].getImage();s&&(n=s.getScale(),s.setScale(t.frameState.pixelRatio*n));try{var a=t.vectorContext||ol.render.getVectorContext(t);a.setStyle(i[r]),i[r].getZIndex()<0?a.drawGeometry(o||e):a.drawGeometry(e)}catch(t){}s&&s.setScale(n)}},ol.featureAnimation.prototype.animate=function(){return!1},ol.Map.prototype.animateFeature=function(t,e){!function o(i){for(var r,n=i.length-1;r=i[n];n--)if(r.getVisible()){if(!r.getLayers)return r.animateFeature(t,e),!0;if(o(r.getLayers().getArray()))return!0}return!1}(this.getLayers().getArray())},ol.layer.Base.prototype.animateFeature=function(t,e,o){var i,r=this,n=t.getStyle(),s=n||(this.getStyleFunction?this.getStyleFunction()(t):null);s||(s=[]),s instanceof Array||(s=[s]);var a={vectorContext:null,frameState:null,start:0,time:0,elapsed:0,extent:!1,feature:t,geom:t.getGeometry(),typeGeom:t.getGeometry().getType(),bbox:t.getGeometry().getExtent(),coord:ol.extent.getCenter(t.getGeometry().getExtent()),style:s};e instanceof Array||(e=[e]);for(var l=e.length-1;l>=0;l--)0===e[l].duration_&&e.splice(l,1);var c=0,h=0,p=o&&this.getFilters?this.getFilters():[];function u(o){try{a.vectorContext=o.vectorContext||ol.render.getVectorContext(o)}catch(o){}a.frameState=o.frameState,a.extent||(a.extent=o.frameState.extent,a.start=o.frameState.time,a.context=o.context),a.time=o.frameState.time-a.start,a.elapsed=a.time/e[h].duration_,a.elapsed>1&&(a.elapsed=1),o.context.save(),p.forEach(function(t){t.get("active")&&t.precompose(o)}),this.getOpacity&&(o.context.globalAlpha=this.getOpacity()),e[h].animate(a)||(++c<e[h].repeat_?a.extent=!1:h<e.length-1?(e[h].dispatchEvent({type:"animationend",feature:t}),h++,c=0,a.extent=!1):d()),p.forEach(function(t){t.get("active")&&t.postcompose(o)}),o.context.restore(),o.frameState.animate=!0}function d(o){ol.Observable.unByKey(i),i=null,t.setStyle(n);var s={type:"animationend",feature:t};if(o)for(var a in o)o.hasOwnProperty(a)&&(s[a]=o[a]);e[h].dispatchEvent(s),r.dispatchEvent(s)}function g(o){if(e.length&&!i){i=r.on(["postcompose","postrender"],u.bind(r)),r.renderSync?r.renderSync():r.changed(),t.setStyle(e[h].hiddenStyle||new ol.style.Style({image:new ol.style.Circle({})}));var n={type:"animationstart",feature:t};if(o)for(var s in o)o.hasOwnProperty(s)&&(n[s]=o[s]);e[h].dispatchEvent(n),r.dispatchEvent(n)}}return g(),{start:g,stop:d,isPlaying:function(){return!!i}}},ol.featureAnimation.Bounce=function(t){t=t||{},ol.featureAnimation.call(this,t),this.amplitude_=t.amplitude||40,this.bounce_=-Math.PI*(t.bounce||3)},ol.ext.inherits(ol.featureAnimation.Bounce,ol.featureAnimation),ol.featureAnimation.Bounce.prototype.animate=function(t){var e=t.geom.clone(),o=Math.abs(Math.sin(this.bounce_*t.elapsed))*this.amplitude_*(1-this.easing_(t.elapsed))*t.frameState.viewState.resolution;return e.translate(0,o),this.drawGeom_(t,e,t.geom),t.time<=this.duration_},ol.featureAnimation.Drop=function(t){t=t||{},this.speed_=t.speed||0,ol.featureAnimation.call(this,t),this.side_=t.side||"top"},ol.ext.inherits(ol.featureAnimation.Drop,ol.featureAnimation),ol.featureAnimation.Drop.prototype.animate=function(t){if(!t.time){var e=t.frameState.viewState.rotation,o=t.frameState.size[1]*t.frameState.viewState.resolution;"top"!=this.side_&&(o*=-1),this.dx=-Math.sin(e)*o,this.dy=Math.cos(e)*o,this.speed_&&(this.duration_=o/this.speed_/t.frameState.viewState.resolution)}var i=t.geom.clone();return i.translate(this.dx*(1-this.easing_(t.elapsed)),this.dy*(1-this.easing_(t.elapsed))),this.drawGeom_(t,i,t.geom),t.time<=this.duration_},ol.featureAnimation.Fade=function(t){t=t||{},this.speed_=t.speed||0,ol.featureAnimation.call(this,t)},ol.ext.inherits(ol.featureAnimation.Fade,ol.featureAnimation),ol.featureAnimation.Fade.prototype.animate=function(t){return t.context.globalAlpha=this.easing_(t.elapsed),this.drawGeom_(t,t.geom),t.time<=this.duration_},ol.featureAnimation.None=function(t){ol.featureAnimation.call(this,t)},ol.ext.inherits(ol.featureAnimation.None,ol.featureAnimation),ol.featureAnimation.None.prototype.animate=function(t){return t.time<=this.duration_},ol.featureAnimation.Null=function(){ol.featureAnimation.call(this,{duration:0})},ol.ext.inherits(ol.featureAnimation.Null,ol.featureAnimation),ol.featureAnimation.Path=function(t){switch(t=t||{},ol.featureAnimation.call(this,t),this.speed_=t.speed||0,this.path_=t.path,t.rotate){case!0:case 0:this.rotate_=0;break;default:this.rotate_=t.rotate||!1}this.path_&&this.path_.getGeometry&&(this.path_=this.path_.getGeometry()),this.path_&&this.path_.getLineString&&(this.path_=this.path_.getLineString()),this.path_.getLength?(this.dist_=this.path_.getLength(),this.path_&&this.path_.getCoordinates&&(this.path_=this.path_.getCoordinates())):this.dist_=0,this.speed_>0&&(this.duration_=this.dist_/this.speed_)},ol.ext.inherits(ol.featureAnimation.Path,ol.featureAnimation),ol.featureAnimation.Path.prototype.animate=function(t){if(!t.time&&!this.dist_)return!1;var e,o,i,r,n,s,a=this.dist_*this.easing_(t.elapsed),l=0;o=this.path_[0];for(var c=1;c<this.path_.length;c++){if(e=o,r=(o=this.path_[c])[0]-e[0],n=o[1]-e[1],(s=Math.sqrt(r*r+n*n))&&l+s>=a){i=(a-l)/s,o=[e[0]+(o[0]-e[0])*i,e[1]+(o[1]-e[1])*i];break}l+=s}if(!1!==this.rotate_)for(var h=this.rotate_-Math.atan2(e[1]-o[1],e[0]-o[0]),p=0;i=t.style[p];p++)i.getImage()&&i.getImage().setRotation(h);return t.geom.setCoordinates(o),this.drawGeom_(t,t.geom),t.time<=this.duration_},ol.featureAnimation.Shake=function(t){t=t||{},ol.featureAnimation.call(this,t),this.amplitude_=t.amplitude||40,this.bounce_=-Math.PI*(t.bounce||6),this.horizontal_=t.horizontal},ol.ext.inherits(ol.featureAnimation.Shake,ol.featureAnimation),ol.featureAnimation.Shake.prototype.animate=function(t){var e=t.geom.clone(),o=t.geom.clone(),i=this.easing_(t.elapsed);return i=Math.sin(this.bounce_*i)*this.amplitude_*(1-i)*t.frameState.viewState.resolution,this.horizontal_?(e.translate(i,0),o.translate(i,0)):e.translate(0,i),this.drawGeom_(t,e,o),t.time<=this.duration_},ol.featureAnimation.Show=function(t){ol.featureAnimation.call(this,t)},ol.ext.inherits(ol.featureAnimation.Show,ol.featureAnimation),ol.featureAnimation.Show.prototype.animate=function(t){return this.drawGeom_(t,t.geom),t.time<=this.duration_},ol.featureAnimation.Slide=function(t){t=t||{},this.speed_=t.speed||0,ol.featureAnimation.call(this,t),this.side_=t.side||"left"},ol.ext.inherits(ol.featureAnimation.Slide,ol.featureAnimation),ol.featureAnimation.Slide.prototype.animate=function(t){t.time||("left"==this.side_?this.dx=t.extent[0]-t.bbox[2]:this.dx=t.extent[2]-t.bbox[0],this.speed_&&(this.duration_=Math.abs(this.dx)/this.speed_/t.frameState.viewState.resolution));var e=t.geom.clone();return e.translate(this.dx*(1-this.easing_(t.elapsed)),0),this.drawGeom_(t,e),t.time<=this.duration_},ol.featureAnimation.Teleport=function(t){ol.featureAnimation.call(this,t)},ol.ext.inherits(ol.featureAnimation.Teleport,ol.featureAnimation),ol.featureAnimation.Teleport.prototype.animate=function(t){var e=this.easing_(t.elapsed);if(e){t.context.save();var o=t.frameState.pixelRatio;t.context.globalAlpha=e,t.context.scale(e,1/e);var i=t.frameState.coordinateToPixelTransform,r=(1/e-1)*o*(i[0]*t.coord[0]+i[1]*t.coord[1]+i[4]),n=(e-1)*o*(i[2]*t.coord[0]+i[3]*t.coord[1]+i[5]);t.context.translate(r,n),this.drawGeom_(t,t.geom),t.context.restore()}return t.time<=this.duration_},ol.featureAnimation.Throw=function(t){t=t||{},ol.featureAnimation.call(this,t),this.speed_=t.speed||0,this.side_=t.side||"left"},ol.ext.inherits(ol.featureAnimation.Throw,ol.featureAnimation),ol.featureAnimation.Throw.prototype.animate=function(t){var e,o;!t.time&&this.speed_&&("left"==this.side_?(e=this.dx=t.extent[0]-t.bbox[2],o=this.dy=t.extent[3]-t.bbox[1]):(e=this.dx=t.extent[2]-t.bbox[0],o=this.dy=t.extent[3]-t.bbox[1]),this.duration_=Math.sqrt(e*e+o*o)/this.speed_/t.frameState.viewState.resolution);var i=t.geom.clone(),r=t.geom.clone();return i.translate(this.dx*(1-this.easing_(t.elapsed)),this.dy*Math.cos(Math.PI/2*this.easing_(t.elapsed))),r.translate(this.dx*(1-this.easing_(t.elapsed)),0),this.drawGeom_(t,i,r),t.time<=this.duration_},ol.featureAnimation.Zoom=function(t){t=t||{},ol.featureAnimation.call(this,t),this.set("zoomout",t.zoomOut)},ol.ext.inherits(ol.featureAnimation.Zoom,ol.featureAnimation),ol.featureAnimation.ZoomOut=function(t){(t=t||{}).zoomOut=!0,ol.featureAnimation.Zoom.call(this,t)},ol.ext.inherits(ol.featureAnimation.ZoomOut,ol.featureAnimation.Zoom),ol.featureAnimation.Zoom.prototype.animate=function(t){var e=this.easing_(t.elapsed);if(e){this.get("zoomout")&&(e=1/e);var o,i,r=t.style,n=[];for(o=0;o<r.length;o++)(i=r[o].getImage())&&(n[o]=i.getScale(),i.setScale(n[o]*e));t.context.save();var s=t.frameState.pixelRatio,a=t.frameState.coordinateToPixelTransform,l=(1/e-1)*s*(a[0]*t.coord[0]+a[1]*t.coord[1]+a[4]),c=(1/e-1)*s*(a[2]*t.coord[0]+a[3]*t.coord[1]+a[5]);for(t.context.scale(e,e),t.context.translate(l,c),this.drawGeom_(t,t.geom),t.context.restore(),o=0;o<r.length;o++)(i=r[o].getImage())&&i.setScale(n[o])}return t.time<=this.duration_},ol.filter={},ol.filter.Base=function(t){ol.Object.call(this),this._listener=[],t&&!1===t.active?this.set("active",!1):this.set("active",!0)},ol.ext.inherits(ol.filter.Base,ol.Object),ol.filter.Base.prototype.setActive=function(t){this.set("active",!0===t)},ol.filter.Base.prototype.getActive=function(){return this.get("active")},function(){function t(){this.renderSync?this.renderSync():this.changed()}function e(e){this.filters_||(this.filters_=[]),this.filters_.push(e),e.precompose&&e._listener.push({listener:this.on(["precompose","prerender"],function(t){this.get("active")&&t.context&&this.precompose(t)}.bind(e)),target:this}),e.postcompose&&e._listener.push({listener:this.on(["postcompose","postrender"],function(t){this.get("active")&&t.context&&this.postcompose(t)}.bind(e)),target:this}),e._listener.push({listener:e.on("propertychange",t.bind(this)),target:this}),t.call(this)}function o(e){var o;for(this.filters_||(this.filters_=[]),o=this.filters_.length-1;o>=0;o--)this.filters_[o]===e&&this.filters_.splice(o,1);for(o=e._listener.length-1;o>=0;o--)e._listener[o].target===this&&(ol.Observable.unByKey(e._listener[o].listener),e._listener.splice(o,1));t.call(this)}ol.Map.prototype.addFilter=function(t){console.warn("[OL-EXT] addFilter deprecated on map."),e.call(this,t)},ol.Map.prototype.removeFilter=function(t){o.call(this,t)},ol.Map.prototype.getFilters=function(){return this.filters_||[]},ol.layer.Base.prototype.addFilter=function(t){e.call(this,t)},ol.layer.Base.prototype.removeFilter=function(t){o.call(this,t)},ol.layer.Base.prototype.getFilters=function(){return this.filters_||[]}}(),ol.filter.Mask=function(t){if(t=t||{},ol.filter.Base.call(this,t),t.feature)switch(t.feature.getGeometry().getType()){case"Polygon":case"MultiPolygon":this.feature_=t.feature}this.set("inner",t.inner),this.fillColor_=t.fill&&ol.color.asString(t.fill.getColor())||"rgba(0,0,0,0.2)"},ol.ext.inherits(ol.filter.Mask,ol.filter.Base),ol.filter.Mask.prototype.drawFeaturePath_=function(t,e){var o=t.context,i=o.canvas,r=t.frameState.pixelRatio,n=t.frameState.coordinateToPixelTransform,s=function(t){return[(t[0]*n[0]+t[1]*n[1]+n[4])*r,(t[0]*n[2]+t[1]*n[3]+n[5])*r]};n||(n=t.frameState.coordinateToPixelMatrix,s=function(t){return[(t[0]*n[0]+t[1]*n[1]+n[12])*r,(t[0]*n[4]+t[1]*n[5]+n[13])*r]});var a=this.feature_.getGeometry().getCoordinates();"Polygon"==this.feature_.getGeometry().getType()&&(a=[a]),o.beginPath(),e&&(o.moveTo(0,0),o.lineTo(i.width,0),o.lineTo(i.width,i.height),o.lineTo(0,i.height),o.lineTo(0,0));for(var l=0;l<a.length;l++)for(var c=a[l],h=0;h<c.length;h++){var p=s(c[h][0]);o.moveTo(p[0],p[1]);for(var u=1;u<c[h].length;u++)p=s(c[h][u]),o.lineTo(p[0],p[1])}},ol.filter.Mask.prototype.postcompose=function(t){if(this.feature_){var e=t.context;e.save(),this.drawFeaturePath_(t,!this.get("inner")),e.fillStyle=this.fillColor_,e.fill("evenodd"),e.restore()}},ol.filter.Clip=function(t){if(t=t||{},ol.filter.Base.call(this,t),this.set("coords",t.coords),this.set("units",t.units),this.set("keepAspectRatio",t.keepAspectRatio),this.set("extent",t.extent||[0,0,1,1]),this.set("color",t.color),!t.extent&&"%"!=t.units&&t.coords){for(var e,o=1/0,i=1/0,r=-1/0,n=-1/0,s=0;e=t.coords[s];s++)o>e[0]&&(o=e[0]),r<e[0]&&(r=e[0]),i>e[1]&&(i=e[1]),n<e[1]&&(n=e[1]);t.extent=[o,i,r,n]}},ol.ext.inherits(ol.filter.Clip,ol.filter.Base),ol.filter.Clip.prototype.clipPath_=function(t){var e=t.context,o=e.canvas,i=this.get("coords");if(i){var r=this.get("extent"),n=1,s=1;"%"==this.get("units")&&(n=o.width/(r[2]-r[0]),s=o.height/(r[3]-r[1])),this.get("keepAspectRatio")&&(n=s=Math.min(n,s));var a=this.get("position"),l=0,c=0;/left/.test(a)?l=-r[0]*n:/center/.test(a)?l=o.width/2-(r[2]-r[0])*n/2:/right/.test(a)&&(l=o.width-(r[2]-r[0])*n);var h=function(t){return t*n+l};/top/.test(a)?c=-r[1]*s:/middle/.test(a)?c=o.height/2-(r[3]-r[1])*s/2:/bottom/.test(a)&&(c=o.height-(r[3]-r[1])*s);var p=function(t){return t*s+c};e.moveTo(h(i[0][0]),p(i[0][1]));for(var u,d=1;u=i[d];d++)e.lineTo(h(u[0]),p(u[1]));e.lineTo(h(i[0][0]),p(i[0][1]))}},ol.filter.Clip.prototype.precompose=function(t){this.get("color")||(t.context.save(),t.context.beginPath(),this.clipPath_(t),t.context.clip())},ol.filter.Clip.prototype.postcompose=function(t){if(this.get("color")){var e=t.context,o=t.context.canvas;e.save(),e.beginPath(),e.moveTo(0,0),e.lineTo(0,o.height),e.lineTo(o.width,o.height),e.lineTo(o.width,o.height),e.lineTo(o.width,0),e.lineTo(0,0),this.clipPath_(t),e.fillStyle=this.get("color"),e.fill("evenodd")}t.context.restore()},ol.filter.Colorize=function(t){ol.filter.Base.call(this,t),this.setFilter(t)},ol.ext.inherits(ol.filter.Colorize,ol.filter.Base),ol.filter.Colorize.prototype.setFilter=function(t){switch(t=t||{}){case"grayscale":t={operation:"hue",red:0,green:0,blue:0,value:1};break;case"invert":t={operation:"difference",red:255,green:255,blue:255,value:1};break;case"sepia":t={operation:"color",red:153,green:102,blue:51,value:.6}}var e,o=t.color?ol.color.asArray(t.color):[t.red,t.green,t.blue,t.value];switch(this.set("color",ol.color.asString(o)),this.set("value",o[3]||1),t.operation){case"color":case"hue":case"difference":case"color-dodge":case"enhance":this.set("operation",t.operation);break;case"saturation":e=255*(t.value||0),this.set("color",ol.color.asString([0,0,e,e||1])),this.set("operation",t.operation);break;case"luminosity":e=255*(t.value||0),this.set("color",ol.color.asString([e,e,e,255])),this.set("operation","hard-light");break;case"contrast":e=255*(t.value||0),this.set("color",ol.color.asString([e,e,e,255])),this.set("operation","soft-light");break;default:this.set("operation","color")}},ol.filter.Colorize.prototype.setValue=function(t){this.set("value",t);var e=ol.color.asArray(this.get("color"));e[3]=t,this.set("color",ol.color.asString(e))},ol.filter.Colorize.prototype.setColor=function(t){(t=ol.color.asArray(t))&&(t[3]=this.get("value"),this.set("color",ol.color.asString(t)))},ol.filter.Colorize.prototype.precompose=function(){},ol.filter.Colorize.prototype.postcompose=function(t){var e=t.context,o=e.canvas;if(e.save(),"enhance"==this.get("operation")){var i=this.get("value");if(i){var r=o.width,n=o.height;e.globalCompositeOperation="color-burn",e.globalAlpha=i,e.drawImage(o,0,0,r,n),e.drawImage(o,0,0,r,n),e.drawImage(o,0,0,r,n)}}else e.globalCompositeOperation=this.get("operation"),e.fillStyle=this.get("color"),e.fillRect(0,0,o.width,o.height);e.restore()},ol.filter.Composite=function(t){ol.filter.Base.call(this,t),this.set("operation",t.operation||"source-over")},ol.ext.inherits(ol.filter.Composite,ol.filter.Base),ol.filter.Composite.prototype.setOperation=function(t){this.set("operation",t||"source-over")},ol.filter.Composite.prototype.precompose=function(t){var e=t.context;e.save(),e.globalCompositeOperation=this.get("operation")},ol.filter.Composite.prototype.postcompose=function(t){t.context.restore()},ol.filter.Crop=function(t){t=t||{},ol.filter.Mask.call(this,t)},ol.ext.inherits(ol.filter.Crop,ol.filter.Mask),ol.filter.Crop.prototype.precompose=function(t){if(this.feature_){var e=t.context;e.save(),this.drawFeaturePath_(t,this.get("inner")),e.clip("evenodd")}},ol.filter.Crop.prototype.postcompose=function(t){this.feature_&&t.context.restore()},ol.filter.Fold=function(t){t=t||{},ol.filter.Base.call(this,t),this.set("fold",t.fold||[8,4]),this.set("margin",t.margin||8),this.set("padding",t.padding||8),"number"==typeof t.fsize&&(t.fsize=[t.fsize,t.fsize]),this.set("fsize",t.fsize||[8,10])},ol.ext.inherits(ol.filter.Fold,ol.filter.Base),ol.filter.Fold.prototype.drawLine_=function(t,e,o){var i,r,n,s=t.canvas,a=this.get("fold"),l=s.width,c=s.height;for(t.beginPath(),t.moveTo(o,o),n=1;n<=a[0];n++)i=n*l/a[0]-(n==a[0]?o:0),r=e[1]*(n%2)+o,t.lineTo(i,r);for(n=1;n<=a[1];n++)i=l-e[0]*(n%2)-o,r=n*c/a[1]-(n==a[1]?e[0]*(a[0]%2)+o:0),t.lineTo(i,r);for(n=a[0];n>0;n--)i=n*l/a[0]-(n==a[0]?e[0]*(a[1]%2)+o:0),r=c-e[1]*(n%2)-o,t.lineTo(i,r);for(n=a[1];n>0;n--)i=e[0]*(n%2)+o,r=n*c/a[1]-(n==a[1]?o:0),t.lineTo(i,r);t.closePath()},ol.filter.Fold.prototype.precompose=function(t){var e=t.context;e.save(),e.shadowColor="rgba(0,0,0,0.3)",e.shadowBlur=8,e.shadowOffsetX=2,e.shadowOffsetY=3,this.drawLine_(e,this.get("fsize"),this.get("margin")),e.fillStyle="#fff",e.fill(),e.strokeStyle="rgba(0,0,0,0.1)",e.stroke(),e.restore(),e.save(),this.drawLine_(e,this.get("fsize"),this.get("margin")+this.get("padding")),e.clip()},ol.filter.Fold.prototype.postcompose=function(t){var e=t.context,o=e.canvas;e.restore(),e.save(),this.drawLine_(e,this.get("fsize"),this.get("margin")),e.clip();var i=this.get("fold"),r=o.width/i[0],n=o.height/i[1],s=e.createRadialGradient(5*r/8,5*r/8,r/4,r/2,r/2,r);s.addColorStop(0,"transparent"),s.addColorStop(1,"rgba(0,0,0,0.2)"),e.fillStyle=s,e.scale(1,n/r);for(var a=0;a<i[0];a++)for(var l=0;l<i[1];l++)e.save(),e.translate(a*r,l*r),e.fillRect(0,0,r,r),e.restore();e.restore()},ol.filter.Lego=function(t){t||(t={}),ol.filter.Base.call(this,t);var e=new Image;e.src=this.img[t.img]||this.img.ol3,e.crossOrigin=t.crossOrigin||null,this.pattern={canvas:document.createElement("canvas")},this.setBrick(t.brickSize,e),this.internal_=document.createElement("canvas")},ol.ext.inherits(ol.filter.Lego,ol.filter.Base),ol.filter.Lego.prototype.img={brick:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAAAnNCSVQICFXsRgQAAAAJcEhZcwAAD10AAA9dAah0GUAAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAGAElEQVRo3sWZy4tkVx3HP+fcc29Vd1dP17TdTcbJPDKPMGR0kVEZkuBCF0EE9Z8QXLhxMUsRF4oLwYWQTSCgSxUXroQhoiEuskgEUUQh+BhHOpkZO11dr3vvefxc3FPlNHNvPbrD1Dl016XoqvM539/znFbcZo3VjbFmxcMA3Mg2fSoAiQJDov7/B1o9+aEgkycv4PBSPU9eHeDEixNwOAFXPYvFia0+rcnQEeBr218cfLIwCqW1UWillEYphUKpCmCCIQAiCEhAJIggTiSISBAfggTvJZTifQghWO+89cOQexuOXN8Pwz/9ff9X/xF0uEA7AmTsjLp/2xZQCgXHlj0OEBEAeRwGkep3qN6pfibDB3DBixMnvdCXt8J3FZowNYFSjgv71RtPaehjD0alalVOqCtHU3qlAGrVAGbidCtUYLUAiV6dCUx8XV4BhUKjY0AJgUB4LE8sA7CkCRSalFYnE72WiBrLSCKCp6TALZNRDEDCwgAKQ/vyRidN9c32K1sbqlCP/C+P9kXJI597PA7HkGJRCLNUGCY767udF9e+9dz1S5ueoRzIEZa1OxcK9td+/fAHvYH0LY6MkgHFIuYwS0ifXe1+qXvn1vk99QfzCwokToUylPrre1/de/vMnf9+5MsSg2HMELegAsl86duvnP3e8y/f1r83v8Li1RO7k/9c2t/avHnt27xpyhRDguEIuxDA3OXXX93+8a0rz6ZvcKgadqUEL73wx+9sb5//WWKTGCOHsxEWM0H71e2ffmF3lPyEkZppVyVYefCw/9a5f3epSvsWh7MMsUgeaL20/dpLu4fJXZUvFCgi46/8i5RNFCCc4bA5JuZ7f/Kp7g9fuLSdvLnY8lEHxz8ItOPcaN7gPAB1tvPl7udupT9nvGSmLLlHSosWLdbJTgpgLna+eVv9hiO1ZIpFOGBEFmejBnrO/tc/0znXTf+sHMuPwD0MrSnETID6/SXPrH/junp3Xiw3atCjxJCRktKu10DHzrZ+pOvpc5cP/6T8CWtt4BATZ4tkBoCvTz8tbTb8TnHiYi/0pgCmPufMUkB1ss9vtU7Trgt9EgyGhIS0zgjRB6RukaSdfHpLPly2xTg2chQJmgRN2qiAa3DBtu5kYXgqAIFYEzTJDAVCnQIqaA+O0wyFjj8q1oY6AB/qd5nLw9JvcpqOOcFMT5dqlg/UAoy5exS2TgGg6DxhkHofqHVCGYf3ho/S904DcHZ6jpZ6lWMY1iogCDxsn8oDduP3BEI9QvSBWgU8YRDeGezsyEk1SNlD8HF51wjQoEAgHNkffXBw+XfJiZbXXCTBT2fZaAJfn4iEEt+z73bTk92jZTxPwOFxVCeGRif0tt4HCtxB+f0P7l//rTlBAN6gjcNicThcfU2NCnjf0NU43L59vf2XZf1A8wzX8JRTgLw+Ckx17SahIZGOyMri7dHalXf6DJdYfovPAgVlRLAzAXwI0gCQU5La8m6SXeH9pi+pWf5lUooIUFKSN6V0A1AE39RyeAYYEpvYNjf4OwP8XNuf50UycnKKKURjSTMALkjzzgpyEhI0LW7ygHvYRh00G7zARQL5dBYU9JtLWvQB52e0VX0MOl5anmOP+3yIjZldpteZijZXuIbBxZ1PAEbkc05GVspZtnX04hlHEDKucpUePYbklCgyNjjDLp9AERhjKSNAQc6IwSzPMQClt37OIeOQ7vQWxJPSZSf2OZMyK1h8jHsbNSgY0Z/tNRWA2HmuVXLIZsxnliw2mROAyR2Rjwmn8vyC0XynrUwQ3PzGs6QX06rDRgD9GIDEjF9pUFLSXyRsowLFIp2/44icDpZ02umq6S3ZxDwupp3hYs1cVMAu1noLBZaMNbJoAD3tl6prOodnTF5feBoBRmGweO8fyClISMlIowkkApRYyqbeZ5YJQrHc4UNieeGYArL8NeUkFcvgJKc/AU56ajxejod+/DT/W/IkQC4P3GoBwoGsFKAf9v2qAGIxej9MU8rTGdNjWtVsJv315aL3YwDYqG5MTDxAPMvTNkJS3ReY6AmtlTrhKsf/AHgAA6ezGE+FAAAAAElFTkSuQmCC",ol3:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAAAnNCSVQICFXsRgQAAAAJcEhZcwAAD10AAA9dAah0GUAAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAHtUlEQVRo3sWZTWxcVxXHf/d9zIztcTz+pE6cOHXiyLJJadKgKE2oCBLlQwIWSCxYI0WiGxZZIYRAArFAYoEEi0hIsGBBURd0g4iK2lJAaWlaojZVKkU0H26cxB8Zz/f7uPeweHdebDLPnqlQ5l2N5/mN7tz/+Z//OffcM4rPUKCPl0eBAqqfAEAt5Ia1LwCuAg93CyCnAzgj7TstEKMluW+/x0AsWmKBmFggTu4lIpYome2Qw0kA8I2xL9T2Bp5COY6ncJRSDkopFEolANowBEAEATGIGBEkFjEiYkQbI0ZrMaFobYwxkY51pOumpSNTiau6bm7oZX1NP4Ai+ylYADkmGqUPxwSUQsG2ZbcDsBAA2QoGkeSvSZ4kr/alDcRGSyyxbJqqvG5+pHAwbRegVMz+leTBY7qcbTee8vsmQycRmnL6CkD1G4DXFl0fGegvANfpnws8+947AwqFg2MDSjAYzJY80QuAHl2gcPDJF3PiDLiimtIQC0ETEhD3klE8AJeuASg8CgeHir7vLBVOjwypQK3plyoromRNtzSamJg6QbcgvJ7C0J0YnCweG/jek/Ozw5q6bEiFiIHz+wNWBv68+rPNmlQjYnKE1Ai6cYfXA/W5Q6Uvl84f3zel3vH+SIDYoVAeofOdqa9PvbHn/PoDHYZ4eDSpE3fJgLs79YXToz858uxJ5+/en4jQ6hHr5OPZlZHhpcM/4BUv9PFw8agQdQVg1+UHnx/75fG5Gf83lFWGVUrQsmmu/HBsbN8f3Mi1MVLeGUJ3Lig8P/a7s5MN97c01I5+VUIk91err0/fLqFwgBHKOzmimzyQPzX2q1OTZfeianUVKCLNr93EZxiFIOyhnB0Tu6vf/XTp54uzY+4r3S1veYj5CEPBjqFsA3cDoEaLXy199rj/Is0eM2XILXzy5MkzSO6TAvAOFF84qf5KRfWYYhE2aJCzI5MDbxf7B58pTpf89x8qX1yWGKXKFaUBZIF1tWo/KzJPiYi3VAgYbrFEnpiYiBzBTgx0ts99YvDcvHr7YSBJka/Q4k1u3jz5eQ/EYebkXvL241NUeZN/31gkDwibhHjk8PGzTh+OrWw7X/6g/+TB8nuJrQCc4Z/KU08rb+1f/1gCSqy9NUNoP72txtXRb40dfJ+nkgMEZTw78riZLhDRndNP3vGG9GBKnRzhrppmilfhmcWoRYkxyuxv86euUaT24h4W2WN53WQmheB1ygc7MaCKuc+N5LeW6wfOXeUorwFQZIV5RlnbNqcGjBMyaAFUcfHwcHHxOznBakA6JQq34B4dkXtt+8QjvnCQa/Z/jxpFCmdbpPSJI7NyhMVzK/j2UQuFi4OLkz57FECcIcGCU8yZeirQvdxjjuvpTKGAem2EcjpjkjnUC5cvfIm/bRG3Y4e7AwOmEwPKOJotfhvlPj61dGaBEChtAdD88Yeq9et1LqWOUTj2lYzOItSmcxi2ZDXUw+k0n0bqDoXDJBsMM8rHKeIKFbxgIV9nL3cSFlPpZQBoa6AjgCYXK2YkndbckkxmWWfu2D00ozzYNinOlagwbRct/k92zNJARxFK01yur/mX2wDWGE0jfuHyNfa+Y6hQYNsmJQ45hqwwFaPpOVo6s2zDsCMDgsBq2sBR9xj8ZvX70+LJc9w+scA1Sjz49rjMy7zMywE5IY64PMcNDlkHKCbt9xhMZwhOooGODGhMzVyqTUxIm4Pll9797ixnWFZ3WORdSqz//hI+Pv7LT5dXOcNZltUa49y3qplC0Hb5uBMAbwcGDKYS/eLu6YMfrSZCUhWY+QCfGZ7iZYRbarSdYMfd0bvXazh8ii/yF2vcAVwitB1hZirWnROREFLYjN4uLQ5QTZ/WmeA2VwDUHbBks351HRxK3OaqtTTHEQwxmpjkxJApQh111kBAvBH+9O7y/KveFsfcYyNj82qywqZdxmWBAjEREbHdkrNEqNE6o6qJiVeiC4UPHuqg20PvExxGE6YAWp2jwEvabmIyqpoGuTB4ozEwd6lKvYflRzgBBIQWQrQjAG2MZABoEeJH4UU3N8f1rC/psPyz+AQWQEhIK6s09wACk+EC0NTwcCM3KrDAf6ihd6ui2ccxcrRoEaQg6lnQPYDYSLZlAS1cXBzyLHGfW0SZPDgMscgBDK10BARUs48mVgNxtl2GKh6ObVpOM8Uy94hsZpe0nakoMMdhPGJreRtAg9YuJ6NIwp18G7OJsilVyHGIQ2yySZ0WIYocQ+xhknEUhiYRoQUQ0KJBbSfleAChjvQuh4wypbQLovEpMWHrnPY2K0RoG/eR5SCgQXVn1SQAJNpNWiFlhm0+i8jZIrMNoN0j0jbhJMoPaOwu2sQFJt69oRKyadNqTGQBOFsAiM34CQchIdVuwtYyEOgu4jumQosiEX5a6aq0S9Z2T2zTThfdkS0MRN21lISAiBwD5KwDnLReStp0MZomrc4bTyaAhql131gztAhw8cnhWxeIBRASEWbVPju5wAS9/VYgdnthGwPSe5uynYqlpun9EuCTzHt0O67r5uP8teRRAC25H/cXgNmQvgKomhXdLwB2M7pu0pTyeK70mJYUm251sLfo/T8AGEoKes8eIGZ43E5wk36BBwhO2mbqgwZa9C0CAP4LFLGzNDDzmrAAAAAASUVORK5CYII=",lego:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD8AAAA/CAQAAAD9VthUAAAAAnNCSVQICFXsRgQAAAAJcEhZcwAADzoAAA86AZc528IAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAHvElEQVRYw8WZWWxcVxnHf+fec2fGu+M4qbPH2EmTLk4FApqQNrgiVYyKeClIwBsvPCAQkZAQPND2gRekCoGQEItYHhBLurCksoTKA6QNJW0CBZLWCc3qEBvHy3hsz93O+XiYMxM7nhmPGxGf++Dre2fO7/v+5/u+s4zigzSxVq3osaZNAwzkuq1nPeUrAE9p99JTAKWn5WYEwErpv9TdGbECRlKMgBEjRlIgsqlAKBBaSKUokAjgkcFz+Ce6BvM9sVbKU55WKKWUh1IeoJQCFhsgIIIgIohYEWwq1ooVK9ZasdbG1hhrjUmMsYlZsJEJzYIpmLwZs/8xZ9JpaGYHOYfPyvrChrdbpAxbjFRltCqhnQ2yxBTKf0WQUgNrwYqIFStGUkkllqIU5E/2aQBbEV8pz/ZM3Or8/95UmeUB+J63RiHoAWi1ZHTvNl6pNfXe99Taeq/W1HvuYOzvKG5c4q1afIWHj4eHBwgWwWCQ1aWvBvC8VXngE5DbmO3UxrOeqEhmTFEcPiIiadwEfVttWxmd623tyu7Mfnrjru5cM0Th+Nyp2Z/MztvJNDLkSImZJ27MhNWIr8j1tn+g9at7+/ubivaSHYkmjPF1f+sj7Uc3Xc29VPjm1JSJEzJkCZkjaVT8hvzubDvQ8cz9AwPeG/rHFD3BZkoeTqLwCuqzrQf7nw9+UJhOidEEFAhX0sCJr1fyXm/uPLr5849n/u1/j3mMWtqtYEFm5v/2pXUHdhzNjgaxzunQQzNX3wDdWIT0dT3bP3Qo8wIXSVWNDpWQys2xmW/3fbn1WpAWXUrWNaARvN+/7lu7jzysf8q4siuEh5A8fX5/+8XepLyEs8zfCd7raP/K9scf1T9iQjUUzU+JynOR3TQBgpAS1a16dVtusONTH8kc42ZjcFFKEApcJyBHjizt+O8Wr3e2P7Uv+3curyT7InhJ8nFCMmTJkqWlVlnzVsj0psc69vbrV1SyKnjJgCsEZMiQoanWINcfe39v6xfv808Suu6f5EVlQA7QAcC/1DXp42GmuazOiaJbjjDFSTUNCLOEZMiQEJAjrZYB9b0PmoPe7fpNZQAkYFb1A9CphtWwGlbNkmX/R59TpzhPAAwdf37XKWac1JZJAnc1VSfp0ufSqtK3NT/Y3DJVKZ5tYbHiwfvJAjc5dO7Pw4cZOb4vc51ccvZjh7ZfubaTC8y4evgeAjQaTYCpgZfq06TXpD++Rd6hHHTdZ8JKDs8yAsAD92/gjxSfGNvYzp7Wt3nj6sS2D5NxtXAeHNwnIFpOqSe+bg+2d6ejFXzXS8WlJUSyhBiKoAqj1yFuYQLQZCvFOMLDx8evPFuOF7HV0sqzXmsuP1mJ5tbfVirYc++VITnItvyN8rhJjqIrL7qS50KCX1mWeLXFr5Z02nqiJ2+lXOasIQHJkD75C6DjtQ8dH6Eg99FHyD+LBRclaomnqgL3lo++w4utWsBVbNYtr1htYZFBZgm2299Z5rmXl4+ZtwaPjDlt9CJ0gIeqXNXFN7WKDtMLnW1y+9e6Txc5z2le25Te0BTVic89ovf3yIXE1QeP4FbJbmCla21V723evjklncued/0mZA6AcEABfH/6rXzb2IM5fJD1zLvIB02zm3ak+iK0hK8mvmBnzA/Hoy3LJoyW4XIITn5daAbaX0w3XBnIIsCBL7zDpFNvPWoRvBY+larBZ5Gb6eX20xXxf/2QDMkgmc+sl8MyJH2cf/Seka3yGFv+kR7Ok/1riwxhvruJUYffhGCxWKS0IqqReFXFN5g583qaNokC0aSf/JUaVn95ufNrJ9SwGlapMkkUXuPMAy/E24CJbQVeVWeIXDAFbEYwWCymes3XAMZW9d5gC8k3Rn++79hJjErvvcBB0P53/sBBAOa5knmdnWwlywlQZ7mHfQivOsd6yVDEkGIwxDVrfo2yY4nJ5tMTLe9rkYKSkUtcEqXk9/DKok9d5nLlfpzxyn0Tu7Gk7jLVNx8eQFw98oUi6Vz07NiZ3c/4y+bz+i1gHxliEhJnQFKn6MbVu01ISRaSX2b8vk/4q4D77GErCTGxM2EBW1P8pLr4YJkjiKORhZ91hR1qpsG9m89O9pASOXxMXF6wrCb0ACIidBJe8ZNdjHID24DsA/RhCImInAnztQqr897UeI1lDp3ToU8TO2jiat39q0cLD7GJlNBdERFhLd8dPjamtldx98K8dhNGD91cZ6zKPl6hyNJPP5rYIcsGFGprVva+Nl4GF455lVzI0UcvU0ySX7R5aKabHnrwMRSJlhiQr7fT1QCprYPnmKHgzjQtliwZNrIZHyHBkHHLSMG4KI+JK6Lna+9wFuETUzecLAUHN6QkBARofHwCFImr6Mbld+Lw0Upwhy/acKWUMswS07YI77tllHJTqsW4t4lLtcLKBwyl0JN05YQSiqS0knW+a7eGu4W3rrgmJMwRNpCkLvRsaBoqKAkzZGgi66S/HV+Sf4GQxvor4xPbYDkVIuLS2RZ6CV4wRMQkNNpXGb9go1V8BSElJXRrWIXCupM9We2hvMPPG1bbaqxf3sWhamTzhjVpHsCc/a9dQ3xo82uJL9jRNRLfTTnnBO+u/pTkLT5c8fPNd9nt5tLmRbsVynbsXR704Bbeq775v0uht3btfyZT7OA5knjdAAAAAElFTkSuQmCC"},ol.filter.Lego.prototype.set=function(t,e){ol.filter.Base.prototype.set.call(this,t,e),"brickSize"==t&&this.pattern.canvas.width!=e&&this.setBrick(e)},ol.filter.Lego.prototype.setBrick=function(t,e,o){if(t=Number(t)||30,"string"==typeof e){var i=new Image;i.src=this.img[e]||this.img.ol3,i.crossOrigin=o||null,e=i}if(e&&(this.pattern.img=e),this.pattern.img.width)this.pattern.canvas.width=this.pattern.canvas.height=t,this.pattern.ctx=this.pattern.canvas.getContext("2d"),this.pattern.ctx.fillStyle=this.pattern.ctx.createPattern(this.pattern.img,"repeat"),this.set("brickSize",t),this.set("img",e.src);else{var r=this;this.pattern.img.onload=function(){r.setBrick(t,e)}}},ol.filter.Lego.prototype.getPattern=function(t,e){if(!this.pattern.ctx)return"transparent";var o=this.pattern.canvas,i=this.pattern.ctx,r=o.width/this.pattern.img.width;return i.save(),i.clearRect(0,0,o.width,o.height),i.scale(r,r),t/=r,e/=r,i.translate(t,e),i.beginPath(),i.clearRect(-2*o.width,-2*o.height,4*o.width,4*o.height),i.rect(-t,-e,2*o.width/r,2*o.height/r),i.fill(),i.restore(),i.createPattern(o,"repeat")},ol.filter.Lego.prototype.postcompose=function(t){var e=t.context,o=e.canvas,i=t.frameState.pixelRatio;e.save();var r=this.pattern.canvas.width*i,n=t.frameState.extent,s=t.frameState.viewState.resolution/i,a=[-Math.round(n[0]/s%r),Math.round(n[1]/s%r)],l=this.internal_.getContext("2d"),c=this.internal_.width=o.width,h=this.internal_.height=o.height;l.webkitImageSmoothingEnabled=l.mozImageSmoothingEnabled=l.msImageSmoothingEnabled=l.imageSmoothingEnabled=!1;var p=Math.floor((c-a[0])/r),u=Math.floor((h-a[1])/r);l.drawImage(o,a[0],a[1],p*r,u*r,0,0,p,u),e.webkitImageSmoothingEnabled=e.mozImageSmoothingEnabled=e.msImageSmoothingEnabled=e.imageSmoothingEnabled=!1,e.clearRect(0,0,c,h),e.drawImage(this.internal_,0,0,p,u,a[0],a[1],p*r,u*r),e.scale(i,i),e.fillStyle=this.getPattern(a[0]/i,a[1]/i),e.rect(0,0,c,h),e.fill(),e.restore()},ol.filter.Texture=function(t){ol.filter.Base.call(this,t),this.setFilter(t)},ol.ext.inherits(ol.filter.Texture,ol.filter.Base),ol.filter.Texture.prototype.setFilter=function(t){var e;(t=t||{}).img?e=t.img:(e=new Image,t.src&&(ol.filter.Texture.Image&&ol.filter.Texture.Image[t.src]?e.src=ol.filter.Texture.Image[t.src]:e.src||(e.src=t.src)),e.crossOrigin=t.crossOrigin||null),this.set("rotateWithView",!1!==t.rotateWithView),this.set("opacity","number"==typeof t.opacity?t.opacity:1),this.set("ready",!1);var o=this;function i(e){o.pattern={},o.pattern.scale=t.scale||1,o.pattern.canvas=document.createElement("canvas"),o.pattern.canvas.width=e.width*o.pattern.scale,o.pattern.canvas.height=e.height*o.pattern.scale,o.pattern.canvas.width=e.width,o.pattern.canvas.height=e.height,o.pattern.ctx=o.pattern.canvas.getContext("2d"),o.pattern.ctx.fillStyle=o.pattern.ctx.createPattern(e,"repeat"),o.set("ready",!0)}e.width?i(e):e.onload=function(){i(e)}},ol.filter.Texture.prototype.getPattern=function(t,e){var o=this.pattern.canvas,i=this.pattern.ctx;return i.save(),i.translate(-t,e),i.beginPath(),i.rect(t,-e,o.width,o.height),i.fill(),i.restore(),i.createPattern(o,"repeat")},ol.filter.Texture.prototype.postcompose=function(t){if(this.pattern){var e=t.context,o=e.canvas,i=1.5*Math.max(o.width,o.height),r=t.frameState.pixelToCoordinateTransform;r||((r=t.frameState.pixelToCoordinateMatrix)[2]=r[4],r[3]=r[5],r[4]=r[12],r[5]=r[13]);var n=t.frameState.pixelRatio,s=t.frameState.viewState.resolution,a=o.width/2,l=o.height/2;if(e.save(),e.globalCompositeOperation="multiply",e.globalAlpha=this.get("opacity"),e.scale(n*this.pattern.scale,n*this.pattern.scale),this.get("rotateWithView"))s*=this.pattern.scale,e.fillStyle=this.getPattern((a*r[0]+l*r[1]+r[4])/s,(a*r[2]+l*r[3]+r[5])/s),e.translate(a/this.pattern.scale,l/this.pattern.scale),e.rotate(t.frameState.viewState.rotation),e.beginPath(),e.rect(-a-i,-l-i,2*i,2*i),e.fill();else{var c=-(a*r[0]+l*r[1]+r[4])/s,h=(a*r[2]+l*r[3]+r[5])/s,p=Math.cos(t.frameState.viewState.rotation),u=Math.sin(t.frameState.viewState.rotation),d=(c*p-h*u)/this.pattern.scale,g=(c*u+h*p)/this.pattern.scale;e.translate(d,g),e.beginPath(),e.fillStyle=this.pattern.ctx.fillStyle,e.rect(-d-i,-g-i,2*i,2*i),e.fill()}e.restore()}},ol.interaction.CenterTouch=function(t){t=t||{},this._listener={};var e=/^pointermove$|^pointerup$/;this.targetStyle=t.targetStyle||[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})})})],this.targetStyle instanceof Array||(this.targetStyle=[this.targetStyle]),this.composite=t.composite||"",this.ctouch=new ol.interaction.Interaction({handleEvent:function(t){return e.test(t.type)&&this.getMap()&&(t.coordinate=this.getMap().getView().getCenter(),t.pixel=this.getMap().getSize(),t.pixel=[t.pixel[0]/2,t.pixel[1]/2]),!0}}),ol.interaction.Interaction.call(this,{handleEvent:function(o){return e.test(o.type)&&(this.pos_=o.coordinate),!t.handleEvent||t.handleEvent.call(this,o)}})},ol.ext.inherits(ol.interaction.CenterTouch,ol.interaction.Interaction),ol.interaction.CenterTouch.prototype.setMap=function(t){this.getMap()&&this.getMap().removeInteraction(this.ctouch),this._listener.drawtarget&&ol.Observable.unByKey(this._listener.drawtarget),this._listener.drawtarget=null,ol.interaction.Interaction.prototype.setMap.call(this,t),this.getMap()&&(this.getActive()&&this.getMap().addInteraction(this.ctouch),this._listener.drawtarget=this.getMap().on("postcompose",this.drawTarget_.bind(this)))},ol.interaction.CenterTouch.prototype.setActive=function(t){ol.interaction.Interaction.prototype.setActive.call(this,t),this.pos_=null,this.getMap()&&(this.getActive()?this.getMap().addInteraction(this.ctouch):this.getMap().removeInteraction(this.ctouch))},ol.interaction.CenterTouch.prototype.getPosition=function(){if(!this.pos_){var t=this.getMap().getSize();t=[t[0]/2,t[1]/2],this.pos_=this.getMap().getCoordinateFromPixel(t)}return this.pos_},ol.interaction.CenterTouch.prototype.drawTarget_=function(t){if(this.getMap()&&this.getActive()){var e=t.context,o=t.frameState.pixelRatio;e.save();var i=e.canvas.width/(2*o),r=e.canvas.height/(2*o),n=new ol.geom.Point(this.getMap().getCoordinateFromPixel([i,r]));this.composite&&(e.globalCompositeOperation=this.composite);for(var s=0;s<this.targetStyle.length;s++){var a=this.targetStyle[s];if(a instanceof ol.style.Style){var l=0,c=!ol.Map.prototype.getFeaturesAtPixel&&a.getImage();c&&(l=c.getScale(),c.setScale(o*l)),t.vectorContext.setStyle(a),t.vectorContext.drawGeometry(n),c&&c.setScale(l)}}e.restore()}},ol.interaction.Clip=function(t){this.layers_=[],ol.interaction.Pointer.call(this,{handleDownEvent:this.setPosition,handleMoveEvent:this.setPosition}),this.precomposeBind_=this.precompose_.bind(this),this.postcomposeBind_=this.postcompose_.bind(this),t=t||{},this.pos=!1,this.radius=t.radius||100,t.layers&&this.addLayer(t.layers)},ol.ext.inherits(ol.interaction.Clip,ol.interaction.Pointer),ol.interaction.Clip.prototype.setMap=function(t){var e;if(this.getMap()){for(e=0;e<this.layers_.length;e++)this.layers_[e].un(["precompose","prerender"],this.precomposeBind_),this.layers_[e].un(["postcompose","postrender"],this.postcomposeBind_);this.getMap().renderSync()}if(ol.interaction.Pointer.prototype.setMap.call(this,t),t){for(e=0;e<this.layers_.length;e++)this.layers_[e].on(["precompose","prerender"],this.precomposeBind_),this.layers_[e].on(["postcompose","postrender"],this.postcomposeBind_);t.renderSync()}},ol.interaction.Clip.prototype.setRadius=function(t){this.radius=t,this.getMap()&&this.getMap().renderSync()},ol.interaction.Clip.prototype.addLayer=function(t){t instanceof Array||(t=[t]);for(var e=0;e<t.length;e++)this.getMap()&&(t[e].on(["precompose","prerender"],this.precomposeBind_),t[e].on(["postcompose","postrender"],this.postcomposeBind_),this.getMap().renderSync()),this.layers_.push(t[e])},ol.interaction.Clip.prototype.removeLayer=function(t){t instanceof Array||(t=[t]);for(var e=0;e<t.length;e++){var o;for(o=0;o<this.layers_.length&&this.layers_[o]!==t[e];o++);o!=this.layers_.length&&this.getMap()&&(this.layers_[o].un(["precompose","prerender"],this.precomposeBind_),this.layers_[o].un(["postcompose","postrender"],this.postcomposeBind_),this.layers_.splice(o,1),this.getMap().renderSync())}},ol.interaction.Clip.prototype.setPosition=function(t){t.pixel?this.pos=t.pixel:t&&t instanceof Array?this.pos=t:t=[-1e7,-1e7],this.getMap()&&this.getMap().renderSync()},ol.interaction.Clip.prototype.precompose_=function(t){var e=t.context,o=t.frameState.pixelRatio;e.save(),e.beginPath(),e.arc(this.pos[0]*o,this.pos[1]*o,this.radius*o,0,2*Math.PI),e.clip()},ol.interaction.Clip.prototype.postcompose_=function(t){t.context.restore()},ol.interaction.Clip.prototype.setActive=function(t){if(t!==this.getActive()){var e;if(ol.interaction.Pointer.prototype.setActive.call(this,t),t)for(e=0;e<this.layers_.length;e++)this.layers_[e].on(["precompose","prerender"],this.precomposeBind_),this.layers_[e].on(["postcompose","postrender"],this.postcomposeBind_);else for(e=0;e<this.layers_.length;e++)this.layers_[e].un(["precompose","prerender"],this.precomposeBind_),this.layers_[e].un(["postcompose","postrender"],this.postcomposeBind_);this.getMap()&&this.getMap().renderSync()}},ol.interaction.Delete=function(t){ol.interaction.Select.call(this,t),this.on("select",function(t){this.getFeatures().clear(),this.delete(t.selected)}.bind(this))},ol.ext.inherits(ol.interaction.Delete,ol.interaction.Select),ol.interaction.Delete.prototype._getSources=function(t){if(!this.getMap())return[];t||(t=this.getMap().getLayers());var e=[];return t.forEach(function(t){t.getLayers?e=e.concat(this._getSources(t.getLayers())):t.getSource&&t.getSource()instanceof ol.source.Vector&&e.push(t.getSource())}.bind(this)),e},ol.interaction.Delete.prototype.delete=function(t){if(t&&(t.length||t.getLength())){this.dispatchEvent({type:"deletestart",features:t});var e=[];this._getSources().forEach(function(o){try{t.forEach(function(t){o.removeFeature(t),e.push(t)})}catch(t){}}),this.dispatchEvent({type:"deleteend",features:e})}},ol.interaction.DragOverlay=function(t){t||(t={}),ol.interaction.Pointer.call(this,{handleDownEvent:function(t){return/^(BUTTON|A)$/.test(t.originalEvent.target.tagName)?(this._dragging=!1,!0):!!this._dragging&&(this._dragging.setPosition(t.coordinate),this.dispatchEvent({type:"dragstart",overlay:this._dragging,coordinate:t.coordinate}),!0)},handleDragEvent:function(t){this._dragging&&(this._dragging.setPosition(t.coordinate),this.dispatchEvent({type:"dragging",overlay:this._dragging,coordinate:t.coordinate}))},handleUpEvent:function(t){return this._dragging&&this.dispatchEvent({type:"dragend",overlay:this._dragging,coordinate:t.coordinate}),this._dragging=!1}}),this._overlays=[],t.overlays instanceof Array||(t.overlays=[t.overlays]),t.overlays.forEach(this.addOverlay.bind(this))},ol.ext.inherits(ol.interaction.DragOverlay,ol.interaction.Pointer),ol.interaction.DragOverlay.prototype.addOverlay=function(t){for(var e,o=0;e=this._overlays[o];o++)if(e===t)return;if(t.element.parentElement&&t.element.parentElement.classList.contains("ol-overlaycontainer-stopevent"))console.warn("[DragOverlay.addOverlay] overlay must be created with stopEvent set to false!");else{var i=function(){this.getMap()===t.getMap()&&(this._dragging=t)}.bind(this);this._overlays.push({overlay:t,listener:i}),t.element.addEventListener("pointerdown",i)}},ol.interaction.DragOverlay.prototype.removeOverlay=function(t){for(var e,o=0;e=this._overlays[o];o++)if(e.overlay===t){var i=this._overlays.splice(o,1)[0];t.element.removeEventListener("pointerdown",i.listener);break}},ol.interaction.DrawHole=function(t){t||(t={});var e=this;this._select=new ol.interaction.Select({style:t.style}),this._select.setActive(!1);var o,i=t.geometryFunction;o=i?function(t,o){return o=e._geometryFn(t,o),i(t,o)}:function(t,o){return e._geometryFn(t,o)},t.type="Polygon",t.geometryFunction=o,ol.interaction.Draw.call(this,t),t.layers&&("function"==typeof t.layers?this.layers_=t.layers:t.layers.indexOf&&(this.layers_=function(e){return t.layers.indexOf(e)>=0})),this.on("drawstart",this._startDrawing.bind(this)),this.on("drawend",this._finishDrawing.bind(this))},ol.ext.inherits(ol.interaction.DrawHole,ol.interaction.Draw),ol.interaction.DrawHole.prototype.setMap=function(t){this.getMap()&&this.getMap().removeInteraction(this._select),t&&t.addInteraction(this._select),ol.interaction.Draw.prototype.setMap.call(this,t)},ol.interaction.DrawHole.prototype.setActive=function(t){this._select.getFeatures().clear(),ol.interaction.Draw.prototype.setActive.call(this,t)},ol.interaction.DrawHole.prototype.removeLastPoint=function(){this._feature&&this._feature.getGeometry().getCoordinates()[0].length>2&&ol.interaction.Draw.prototype.removeLastPoint.call(this)},ol.interaction.DrawHole.prototype.getPolygon=function(){return this._polygon},ol.interaction.DrawHole.prototype._startDrawing=function(t){var e=this.getMap(),o=this.layers_;this._feature=t.feature;var i=t.feature.getGeometry().getCoordinates()[0][0],r=e.getFeaturesAtPixel(e.getPixelFromCoordinate(i),{layerFilter:o});if(this._current=null,r)for(var n=0;n<r.length;n++){var s=r[n].getGeometry();if("Polygon"===s.getType()&&s.intersectsCoordinate(i))this._polygonIndex=!1,this._polygon=s,this._current=r[n];else if("MultiPolygon"===s.getType()&&s.intersectsCoordinate(i))for(var a,l=0;a=s.getPolygon(l);l++)if(a.intersectsCoordinate(i)){this._polygonIndex=l,this._polygon=a,this._current=r[n];break}if(this._current)break}this._select.getFeatures().clear(),this._current?this._select.getFeatures().push(this._current):(this.setActive(!1),this.setActive(!0))},ol.interaction.DrawHole.prototype._finishDrawing=function(t){t.hole=t.feature,t.feature=this._select.getFeatures().item(0),this.dispatchEvent({type:"modifystart",features:[this._current]});var e=t.hole.getGeometry().getCoordinates()[0];if(e.length>3)if(!1!==this._polygonIndex){for(var o,i=t.feature.getGeometry(),r=new ol.geom.MultiPolygon([]),n=0;o=i.getPolygon(n);n++)n===this._polygonIndex?(o.appendLinearRing(new ol.geom.LinearRing(e)),r.appendPolygon(o)):r.appendPolygon(o);t.feature.setGeometry(r)}else this.getPolygon().appendLinearRing(new ol.geom.LinearRing(e));this.dispatchEvent({type:"modifyend",features:[this._current]}),this._feature=null,this._select.getFeatures().clear()},ol.interaction.DrawHole.prototype._geometryFn=function(t,e){var o=t[0].pop();return this.getPolygon()&&!this.getPolygon().intersectsCoordinate(o)||(this.lastOKCoord=[o[0],o[1]]),t[0].push([this.lastOKCoord[0],this.lastOKCoord[1]]),e?e.setCoordinates([t[0].concat([t[0][0]])]):e=new ol.geom.Polygon(t),e},ol.interaction.DrawRegular=function(t){t||(t={}),this.squaredClickTolerance_=t.clickTolerance?t.clickTolerance*t.clickTolerance:36,this.maxCircleCoordinates_=t.maxCircleCoordinates||100,this.features_=t.features,this.source_=t.source,this.squareFn_=t.squareCondition,this.centeredFn_=t.centerCondition,this.canRotate_=!1!==t.canRotate,this.geometryName_=t.geometryName,this.setSides(t.sides);var e=[255,255,255,1],o=[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:o}),stroke:new ol.style.Stroke({color:e,width:1.5})}),stroke:new ol.style.Stroke({color:o,width:3}),fill:new ol.style.Fill({color:[255,255,255,.5]})})];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:t.style||i}),ol.interaction.Interaction.call(this,{handleEvent:this.handleEvent_})},ol.ext.inherits(ol.interaction.DrawRegular,ol.interaction.Interaction),ol.interaction.DrawRegular.prototype.setMap=function(t){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),ol.interaction.Interaction.prototype.setMap.call(this,t),this.overlayLayer_.setMap(t)},ol.interaction.DrawRegular.prototype.setActive=function(t){this.reset(),ol.interaction.Interaction.prototype.setActive.call(this,t)},ol.interaction.DrawRegular.prototype.reset=function(){this.overlayLayer_.getSource().clear(),this.started_=!1},ol.interaction.DrawRegular.prototype.setSides=function(t){t=parseInt(t),this.sides_=t>2?t:0},ol.interaction.DrawRegular.prototype.canRotate=function(t){return!0!==t&&!1!==t||(this.canRotate_=t),this.canRotate_},ol.interaction.DrawRegular.prototype.getSides=function(){return this.sides_},ol.interaction.DrawRegular.prototype.startAngle={default:Math.PI/2,3:-Math.PI/2,4:Math.PI/4},ol.interaction.DrawRegular.prototype.getGeom_=function(){if(this.overlayLayer_.getSource().clear(),!this.center_)return!1;var t;if(this.coord_){var e,o,i,r,n,s=this.center_,a=this.coord_;if(!this.sides_&&this.square_&&!this.centered_)return s=[(a[0]+s[0])/2,(a[1]+s[1])/2],e=[a[0]-s[0],a[1]-s[1]],i=Math.sqrt(e[0]*e[0]+e[1]*e[1]),r=new ol.geom.Circle(s,i,"XY"),n=this.getMap().getPixelFromCoordinate(s),o=Math.max(100,Math.abs(n[0]-this.coordPx_[0]),Math.abs(n[1]-this.coordPx_[1])),o=Math.min(this.maxCircleCoordinates_,Math.round(o/3)),ol.geom.Polygon.fromCircle(r,o,0);var l=this.canRotate_&&this.centered_&&this.square_;if(e=[a[0]-s[0],a[1]-s[1]],this.square_&&!l){var c=Math.max(Math.abs(e[0]),Math.abs(e[1]));a=[s[0]+(e[0]>0?c:-c),s[1]+(e[1]>0?c:-c)]}if((i=Math.sqrt(e[0]*e[0]+e[1]*e[1]))>0){var h;if(r=new ol.geom.Circle(s,i,"XY"),h=l?Math.atan2(e[1],e[0]):this.startAngle[this.sides_]||this.startAngle.default,this.sides_?t=ol.geom.Polygon.fromCircle(r,this.sides_,h):(n=this.getMap().getPixelFromCoordinate(this.center_),o=Math.max(100,Math.abs(n[0]-this.coordPx_[0]),Math.abs(n[1]-this.coordPx_[1])),o=Math.min(this.maxCircleCoordinates_,Math.round(o/(this.centered_?3:5))),t=ol.geom.Polygon.fromCircle(r,o,0)),l)return t;var p=t.getExtent(),u=((s=this.centered_?[2*this.center_[0]-this.coord_[0],2*this.center_[1]-this.coord_[1]]:this.center_)[0]-a[0])/(p[0]-p[2]),d=(s[1]-a[1])/(p[1]-p[3]);if(this.square_){var g=Math.min(Math.abs(u),Math.abs(d));u=Math.sign(u)*g,d=Math.sign(d)*g}var f=[s[0]-p[0]*u,s[1]-p[1]*d];return t.applyTransform(function(t,e,o){for(var i=0;i<t.length;i+=o)e[i]=t[i]*u+f[0],e[i+1]=t[i+1]*d+f[1];return e}),t}}return new ol.geom.Point(this.center_)},ol.interaction.DrawRegular.prototype.drawSketch_=function(t){if(this.overlayLayer_.getSource().clear(),t){this.square_=this.squareFn_?this.squareFn_(t):t.originalEvent.shiftKey,this.centered_=this.centeredFn_?this.centeredFn_(t):t.originalEvent.metaKey||t.originalEvent.ctrlKey;var e=this.getGeom_();if(e){var o=this.feature_;return this.geometryName_&&o.setGeometryName(this.geometryName_),"Polygon"===e.getType()&&o.getGeometry().setCoordinates(e.getCoordinates()),this.overlayLayer_.getSource().addFeature(o),this.coord_&&this.square_&&(this.canRotate_&&this.centered_&&this.coord_||!this.sides_&&!this.centered_)&&this.overlayLayer_.getSource().addFeature(new ol.Feature(new ol.geom.LineString([this.center_,this.coord_]))),o}}},ol.interaction.DrawRegular.prototype.drawPoint_=function(t,e){e||this.overlayLayer_.getSource().clear(),this.overlayLayer_.getSource().addFeature(new ol.Feature(new ol.geom.Point(t)))},ol.interaction.DrawRegular.prototype.handleEvent_=function(t){var e,o;switch(this._eventTime=new Date,t.type){case"pointerdown":this.downPx_=t.pixel,this.start_(t);this._longTouch=!1,setTimeout(function(){this._longTouch=new Date-this._eventTime>450,this._longTouch&&this.handleMoveEvent_(t)}.bind(this),500);break;case"pointerup":this.started_&&this.coord_&&(e=this.downPx_[0]-t.pixel[0])*e+(o=this.downPx_[1]-t.pixel[1])*o<=this.squaredClickTolerance_&&("pointermove"==this.lastEvent||"keydown"==this.lastEvent?this.end_(t):(e=this.upPx_[0]-t.pixel[0])*e+(o=this.upPx_[1]-t.pixel[1])*o<=this.squaredClickTolerance_?this.end_(t):(this.handleMoveEvent_(t),this.drawPoint_(t.coordinate,!0))),this.upPx_=t.pixel;break;case"pointerdrag":if(this.started_){var i=this.getMap().getPixelFromCoordinate(this.center_);(e=i[0]-t.pixel[0])*e+(o=i[1]-t.pixel[1])*o<=this.squaredClickTolerance_&&this.reset()}return!this._longTouch;case"pointermove":this.started_&&(e=this.downPx_[0]-t.pixel[0])*e+(o=this.downPx_[1]-t.pixel[1])*o>this.squaredClickTolerance_&&(this.handleMoveEvent_(t),this.lastEvent=t.type);break;default:if(this.lastEvent=t.type,this.started_&&"dblclick"===t.type)return!1}return!0},ol.interaction.DrawRegular.prototype.finishDrawing=function(){this.started_&&this.coord_&&this.end_({pixel:this.upPx_,coordinate:this.coord_})},ol.interaction.DrawRegular.prototype.handleMoveEvent_=function(t){if(this.started_){this.coord_=t.coordinate,this.coordPx_=t.pixel;var e=this.drawSketch_(t);this.dispatchEvent({type:"drawing",feature:e,pixel:t.pixel,startCoordinate:this.center_,coordinate:t.coordinate,square:this.square_,centered:this.centered_})}else this.drawPoint_(t.coordinate)},ol.interaction.DrawRegular.prototype.start_=function(t){if(this.started_)this.coord_=t.coordinate;else{this.started_=!0,this.center_=t.coordinate,this.coord_=null;var e=new ol.geom.Polygon([[t.coordinate,t.coordinate,t.coordinate]]),o=this.feature_=new ol.Feature(e);this.drawSketch_(t),this.dispatchEvent({type:"drawstart",feature:o,pixel:t.pixel,coordinate:t.coordinate})}},ol.interaction.DrawRegular.prototype.end_=function(t){if(this.coord_=t.coordinate,this.started_=!1,this.coord_&&this.center_[0]!=this.coord_[0]&&this.center_[1]!=this.coord_[1]){var e=this.feature_;this.geometryName_&&e.setGeometryName(this.geometryName_),e.setGeometry(this.getGeom_()),this.source_?this.source_.addFeature(e):this.features_&&this.features_.push(e),this.dispatchEvent({type:"drawend",feature:e,pixel:t.pixel,coordinate:t.coordinate,square:this.square_,centered:this.centered_})}else this.dispatchEvent({type:"drawcancel",feature:null,pixel:t.pixel,coordinate:t.coordinate,square:this.square_,centered:this.centered_});this.center_=this.coord_=null,this.drawSketch_()},ol.interaction.DrawTouch=function(t){(t=t||{}).handleEvent=function(t){if(this.get("tap"))switch(t.type){case"singleclick":this.addPoint();break;case"dblclick":return this.addPoint(),this.finishDrawing(),!1}return!0},ol.interaction.CenterTouch.call(this,t),this.typeGeom_=t.type,this.source_=t.source,this.set("tap",!1!==t.tap);var e=[255,255,255,1],o=[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:o}),stroke:new ol.style.Stroke({color:e,width:1.5})}),stroke:new ol.style.Stroke({color:o,width:3}),fill:new ol.style.Fill({color:[255,255,255,.5]})})];this.overlay_=new ol.layer.Vector({source:new ol.source.Vector({useSpatialIndex:!1}),style:i}),this.geom_=[]},ol.ext.inherits(ol.interaction.DrawTouch,ol.interaction.CenterTouch),ol.interaction.DrawTouch.prototype.setMap=function(t){this._listener.drawSketch&&ol.Observable.unByKey(this._listener.drawSketch),this._listener.drawSketch=null,ol.interaction.CenterTouch.prototype.setMap.call(this,t),this.overlay_.setMap(t),this.getMap()&&(this._listener.drawSketch=this.getMap().on("postcompose",this.drawSketchLink_.bind(this)))},ol.interaction.DrawTouch.prototype.startDrawing=function(){this.geom_=[],this.addPoint()},ol.interaction.DrawTouch.prototype.getGeometryType=function(){return this.typeGeom_},ol.interaction.DrawTouch.prototype.finishDrawing=function(){if(this.getMap()){var t;switch(this.typeGeom_){case"LineString":this.geom_.length>1&&(t=new ol.Feature(new ol.geom.LineString(this.geom_)));break;case"Polygon":this.geom_[this.geom_.length-1]!=this.geom_[0]&&this.geom_.push(this.geom_[0]),this.geom_.length>3&&(t=new ol.Feature(new ol.geom.Polygon([this.geom_])))}t&&this.source_.addFeature(t),this.geom_=[],this.drawSketch_()}},ol.interaction.DrawTouch.prototype.addPoint=function(){if(this.getMap())switch(this.geom_.push(this.getPosition()),this.typeGeom_){case"Point":var t=new ol.Feature(new ol.geom.Point(this.geom_.pop()));this.source_.addFeature(t);break;case"LineString":case"Polygon":this.drawSketch_()}},ol.interaction.DrawTouch.prototype.removeLastPoint=function(){this.getMap()&&(this.geom_.pop(),this.drawSketch_())},ol.interaction.DrawTouch.prototype.drawSketch_=function(){if(this.overlay_&&(this.overlay_.getSource().clear(),this.geom_.length)){var t;"Polygon"==this.typeGeom_&&(t=new ol.Feature(new ol.geom.Polygon([this.geom_])),this.overlay_.getSource().addFeature(t));var e=new ol.geom.LineString(this.geom_);t=new ol.Feature(e),this.overlay_.getSource().addFeature(t),t=new ol.Feature(new ol.geom.Point(this.geom_.slice(-1).pop())),this.overlay_.getSource().addFeature(t)}},ol.interaction.DrawTouch.prototype.drawSketchLink_=function(t){if(this.getActive()&&this.getPosition()){var e=t.context;e.save();var o,i=this.getMap().getPixelFromCoordinate(this.getPosition()),r=t.frameState.pixelRatio||1;e.scale(r,r),e.strokeStyle="rgba(0, 153, 255, 1)",e.lineWidth=1,e.beginPath(),e.arc(i[0],i[1],5,0,2*Math.PI),e.stroke(),this.geom_.length&&(o=this.getMap().getPixelFromCoordinate(this.geom_[this.geom_.length-1]),e.beginPath(),e.moveTo(o[0],o[1]),e.lineTo(i[0],i[1]),"Polygon"==this.typeGeom_&&(o=this.getMap().getPixelFromCoordinate(this.geom_[0]),e.lineTo(o[0],o[1])),e.stroke()),e.restore()}},ol.interaction.DrawTouch.prototype.setActive=function(t){ol.interaction.CenterTouch.prototype.setActive.call(this,t),t||(this.geom_=[]),this.drawSketch_()},ol.interaction.DropFile=function(t){t=t||{},ol.interaction.DragAndDrop.call(this,{});var e=t.zone||document;e.addEventListener("dragenter",this.onstop),e.addEventListener("dragover",this.onstop),e.addEventListener("dragleave",this.onstop),this.formatConstructors_=t.formatConstructors||[ol.format.GPX,ol.format.GeoJSON,ol.format.IGC,ol.format.KML,ol.format.TopoJSON],this.projection_=t.projection,this.accept_=t.accept||["gpx","json","geojson","igc","kml","topojson"];var o=this;e.addEventListener("drop",function(t){return o.ondrop(t)})},ol.ext.inherits(ol.interaction.DropFile,ol.interaction.DragAndDrop),ol.interaction.DropFile.prototype.setMap=function(t){ol.interaction.Interaction.prototype.setMap.call(this,t)},ol.interaction.DropFile.prototype.onstop=function(t){return t.preventDefault(),t.stopPropagation(),!1},ol.interaction.DropFile.prototype.ondrop=function(t){if(t.preventDefault(),t.dataTransfer&&t.dataTransfer.files.length)for(var e,o=this,i=t.dataTransfer.files,r=/\.([0-9a-z]+)(?=[?#])|(\.)(?:[\w]+)$/,n=0;e=i[n];n++){var s=e.name.match(r)[0];o.dispatchEvent({type:"loadstart",file:e,filesize:e.size,filetype:e.type,fileextension:s,projection:l,target:o});var a=new FileReader,l=this.projection_||this.getMap().getView().getProjection(),c=this.formatConstructors_;if(!l)return;var h=function(t,e,o){try{return t.readFeatures(e,o)}catch(t){}},p=e;a.onload=function(t){var e,i,r=t.target.result,n=[];for(e=0,i=c.length;e<i;++e){var s=new(0,c[e]);if((n=h(s,r,{featureProjection:l}))&&n.length>0)return o.dispatchEvent({type:"addfeatures",features:n,file:p,projection:l,target:o}),void o.dispatchEvent({type:"loadend",features:n,file:p,projection:l,target:o})}o.dispatchEvent({type:"loadend",file:p,target:o})},a.readAsText(e)}return!1},ol.interaction.FillAttribute=function(t,e){if((t=t||{}).condition||(t.condition=ol.events.condition.click),ol.interaction.Select.call(this,t),this.setActive(!1!==t.active),this._attributes=e,this.on("select",function(t){this.getFeatures().clear(),this.fill(t.selected,this._attributes)}.bind(this)),!1!==t.cursor){var o=document.createElement("CANVAS");o.width=o.height=32;var i=o.getContext("2d");i.beginPath(),i.moveTo(9,3),i.lineTo(2,9),i.lineTo(10,17),i.lineTo(17,11),i.closePath(),i.fillStyle="#fff",i.fill(),i.stroke(),i.beginPath(),i.moveTo(6,4),i.lineTo(0,8),i.lineTo(0,13),i.lineTo(3,17),i.lineTo(3,8),i.closePath(),i.fillStyle="#000",i.fill(),i.stroke(),i.moveTo(8,8),i.lineTo(10,0),i.lineTo(11,0),i.lineTo(13,3),i.lineTo(13,7),i.stroke(),this._cursor="url("+o.toDataURL()+") 0 13, auto"}},ol.ext.inherits(ol.interaction.FillAttribute,ol.interaction.Select),ol.interaction.FillAttribute.prototype.setActive=function(t){ol.interaction.Select.prototype.setActive.call(this,t),this.getMap()&&this._cursor&&(t?(this._previousCursor=this.getMap().getTargetElement().style.cursor,this.getMap().getTargetElement().style.cursor=this._cursor,console.log("setCursor",this._cursor)):(this.getMap().getTargetElement().style.cursor=this._previousCursor,this._previousCursor=void 0))},ol.interaction.FillAttribute.prototype.setAttributes=function(t){this._attributes=t},ol.interaction.FillAttribute.prototype.setAttribute=function(t,e){this._attributes[t]=e},ol.interaction.FillAttribute.prototype.getAttributes=function(){return this._attributes},ol.interaction.FillAttribute.prototype.getAttribute=function(t){return this._attributes[t]},ol.interaction.FillAttribute.prototype.fill=function(t,e){t.length&&e&&(this.dispatchEvent({type:"setattributestart",features:t,properties:e}),t.forEach(function(t){for(var o in e)t.set(o,e[o])}),this.dispatchEvent({type:"setattributeend",features:t,properties:e}))},ol.interaction.Flashlight=function(t){ol.interaction.Pointer.call(this,{handleDownEvent:this.setPosition,handleMoveEvent:this.setPosition}),t=t||{},this.pos=!1,this.radius=t.radius||100,this.setColor(t)},ol.ext.inherits(ol.interaction.Flashlight,ol.interaction.Pointer),ol.interaction.Flashlight.prototype.setMap=function(t){this.getMap()&&this.getMap().render(),this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,ol.interaction.Pointer.prototype.setMap.call(this,t),t&&(this._listener=t.on("postcompose",this.postcompose_.bind(this)))},ol.interaction.Flashlight.prototype.setRadius=function(t){this.radius=t,this.getMap()&&this.getMap().renderSync()},ol.interaction.Flashlight.prototype.setColor=function(t){var e=t.fill?t.fill:[0,0,0,.8],o=ol.color.asArray(e);this.startColor=ol.color.asString(o),t.color?o=this.endColor=ol.color.asString(ol.color.asArray(t.color)||t.color):(o[3]=0,this.endColor=ol.color.asString(o)),o[3]=.1,this.midColor=ol.color.asString(o),this.getMap()&&this.getMap().renderSync()},ol.interaction.Flashlight.prototype.setPosition=function(t){t.pixel?this.pos=t.pixel:this.pos=t,this.getMap()&&this.getMap().renderSync()},ol.interaction.Flashlight.prototype.postcompose_=function(t){var e=t.context,o=t.frameState.pixelRatio,i=e.canvas.width,r=e.canvas.height;if(e.save(),e.scale(o,o),this.pos){var n=Math.max(i,r),s=e.createRadialGradient(this.pos[0],this.pos[1],i*this.radius/n,this.pos[0],this.pos[1],r*this.radius/n);s.addColorStop(0,this.startColor),s.addColorStop(.8,this.midColor),s.addColorStop(1,this.endColor),e.fillStyle=s,e.fillRect(this.pos[0]-n,this.pos[1]-n,2*n,2*n)}else e.fillStyle=this.startColor,e.fillRect(0,0,i,r);e.restore()},ol.interaction.GeolocationDraw=function(t){t||(t={}),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 e=[255,255,255,1],o=[0,153,255,1],i=new ol.style.Circle({radius:6,fill:new ol.style.Fill({color:o}),stroke:new ol.style.Stroke({color:e,width:1.5})}),r=[new ol.style.Style({stroke:new ol.style.Stroke({color:e,width:5})}),new ol.style.Style({stroke:new ol.style.Stroke({color:o,width:3}),fill:new ol.style.Fill({color:[255,255,255,.5]})})],n=new ol.style.RegularShape({radius:10.5,points:3,rotation:0,fill:new ol.style.Fill({color:o}),stroke:new ol.style.Stroke({color:e,width:1.5})}),s=n.getImage(),a=s.getContext("2d"),l=document.createElement("canvas");l.width=l.height=s.width,l.getContext("2d").drawImage(s,0,0),a.clearRect(0,0,s.width,s.height),a.drawImage(l,0,0,s.width,s.height,3,0,s.width-6,s.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:t.style||function(t){return void 0===t.get("heading")?r[1].setImage(i):(r[1].setImage(n),n.setRotation(t.get("heading")||0)),r}}),this.sketch_=[new ol.Feature,new ol.Feature,new ol.Feature],this.overlayLayer_.getSource().addFeatures(this.sketch_),this.features_=t.features,this.source_=t.source,this.condition_=t.condition||function(t){return t.getAccuracy()<this.get("minAccuracy")},ol.interaction.Interaction.call(this,{handleEvent:function(){return!this.get("followTrack")||"auto"==this.get("followTrack")}}),this.set("type",t.type||"LineString"),this.set("attributes",t.attributes||{}),this.set("minAccuracy",t.minAccuracy||20),this.set("tolerance",t.tolerance||5),this.set("zoom",t.zoom),this.setFollowTrack(void 0===t.followTrack||t.followTrack),this.setActive(!1)},ol.ext.inherits(ol.interaction.GeolocationDraw,ol.interaction.Interaction),ol.interaction.GeolocationDraw.prototype.setMap=function(t){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),ol.interaction.Pointer.prototype.setMap.call(this,t),this.overlayLayer_.setMap(t),t&&this.geolocation.setProjection(t.getView().getProjection())},ol.interaction.GeolocationDraw.prototype.setActive=function(t){if(ol.interaction.Interaction.prototype.setActive.call(this,t),this.overlayLayer_.setVisible(t),this.getMap()&&(this.geolocation.setTracking(t),this.getMap().renderSync()),this.pause(!t),t)this.reset(),this.dispatchEvent({type:"drawstart",feature:this.sketch_[1]});else{var e=this.sketch_[1].clone();e.getGeometry()&&(this.features_&&this.features_.push(e),this.source_&&this.source_.addFeature(e),this.dispatchEvent({type:"drawend",feature:e}))}},ol.interaction.GeolocationDraw.prototype.reset=function(){this.sketch_[1].setGeometry(),this.path_=[],this.lastPosition_=!1},ol.interaction.GeolocationDraw.prototype.start=function(){this.setActive(!0)},ol.interaction.GeolocationDraw.prototype.stop=function(){this.setActive(!1)},ol.interaction.GeolocationDraw.prototype.pause=function(t){this.pause_=!1!==t},ol.interaction.GeolocationDraw.prototype.isPaused=function(){return this.pause_},ol.interaction.GeolocationDraw.prototype.setFollowTrack=function(t){this.set("followTrack",t);var e=this.getMap();if(!1!==t&&!this.lastPosition_&&e){var o=this.path_[this.path_.length-1];o&&e.getView().animate({center:o,zoom:"position"!=t?this.get("zoom"):void 0})}this.lastPosition_=!1,this.dispatchEvent({type:"follow",following:!1!==t})},ol.interaction.GeolocationDraw.prototype.draw_=function(){var t=this.getMap();if(t){var e=this.geolocation,o=e.getAccuracy(),i=e.getPosition();i.push(Math.round(100*(e.getAltitude()||0))/100),i.push(Math.round((new Date).getTime()/1e3));var r=e.getAccuracyGeometry();switch(this.get("followTrack")){case!0:1==this.get("followTrack")&&(t.getView().setZoom(this.get("zoom")||16),ol.extent.containsExtent(t.getView().calculateExtent(t.getSize()),r.getExtent())||t.getView().fit(r.getExtent())),t.getView().setCenter(i);break;case"position":t.getView().setCenter(i);break;case"auto":if(this.lastPosition_){var n=t.getView().getCenter();n[0]!=this.lastPosition_[0]||n[1]!=this.lastPosition_[1]?this.setFollowTrack(!1):(t.getView().setCenter(i),this.lastPosition_=i)}else t.getView().setCenter(i),this.get("zoom")&&t.getView().setZoom(this.get("zoom")),this.lastPosition_=i;break;case"visible":ol.extent.containsCoordinate(t.getView().calculateExtent(t.getSize()),i)||t.getView().setCenter(i)}var s,a=this.sketch_[0];if(a.setGeometry(r),o<this.get("minAccuracy")/2?a.setStyle(this.locStyle.ok):o<this.get("minAccuracy")?a.setStyle(this.locStyle.warn):a.setStyle(this.locStyle.error),!this.pause_&&this.condition_.call(this,e)){switch(a=this.sketch_[1],this.path_.push(i),this.get("type")){case"Point":this.path_=[i],a.setGeometry(new ol.geom.Point(i,"XYZM"));var l=this.get("attributes");l.heading&&a.set("heading",e.getHeading()),l.accuracy&&a.set("accuracy",e.getAccuracy()),l.altitudeAccuracy&&a.set("altitudeAccuracy",e.getAltitudeAccuracy()),l.speed&&a.set("speed",e.getSpeed());break;case"LineString":this.path_.length>1?((s=new ol.geom.LineString(this.path_,"XYZM")).simplify(this.get("tolerance")),a.setGeometry(s)):a.setGeometry();break;case"Polygon":this.path_.length>2?((s=new ol.geom.Polygon([this.path_],"XYZM")).simplify(this.get("tolerance")),a.setGeometry(s)):a.setGeometry()}this.dispatchEvent({type:"drawing",feature:this.sketch_[1],geolocation:e})}this.sketch_[2].setGeometry(new ol.geom.Point(i)),this.sketch_[2].set("heading",e.getHeading()),this.dispatchEvent({type:"tracking",feature:this.sketch_[1],geolocation:e})}},ol.interaction.Hover=function(t){t||(t={});var e=this;ol.interaction.Interaction.call(this,{handleEvent:function(o){return"pointermove"==o.type&&e.handleMove_(o),!t.handleEvent||t.handleEvent(o)}}),this.setFeatureFilter(t.featureFilter),this.setLayerFilter(t.layerFilter),this.set("hitTolerance",t.hitTolerance),this.setCursor(t.cursor)},ol.ext.inherits(ol.interaction.Hover,ol.interaction.Interaction),ol.interaction.Hover.prototype.setMap=function(t){void 0!==this.previousCursor_&&this.getMap()&&(this.getMap().getTargetElement().style.cursor=this.previousCursor_,this.previousCursor_=void 0),ol.interaction.Interaction.prototype.setMap.call(this,t)},ol.interaction.Hover.prototype.setCursor=function(t){!t&&void 0!==this.previousCursor_&&this.getMap()&&(this.getMap().getTargetElement().style.cursor=this.previousCursor_,this.previousCursor_=void 0),this.cursor_=t},ol.interaction.Hover.prototype.setFeatureFilter=function(t){this.featureFilter_="function"==typeof t?t:function(){return!0}},ol.interaction.Hover.prototype.setLayerFilter=function(t){this.layerFilter_="function"==typeof t?t:function(){return!0}},ol.interaction.Hover.prototype.handleMove_=function(t){var e=this.getMap();if(e){var o,i,r=this,n=e.forEachFeatureAtPixel(t.pixel,function(t,e){return r.layerFilter_.call(null,e)&&r.featureFilter_.call(null,t,e)?(o=t,i=e,!0):(o=i=null,!1)},{hitTolerance:this.get("hitTolerance")});if(n&&this.dispatchEvent({type:"hover",feature:o,layer:i,coordinate:t.coordinate,pixel:t.pixel,map:t.map,dragging:t.dragging}),this.feature_===o&&this.layer_===i||(this.feature_=o,this.layer_=i,o?this.dispatchEvent({type:"enter",feature:o,layer:i,coordinate:t.coordinate,pixel:t.pixel,map:t.map,dragging:t.dragging}):this.dispatchEvent({type:"leave",coordinate:t.coordinate,pixel:t.pixel,map:t.map,dragging:t.dragging})),this.cursor_){var s=e.getTargetElement().style;n?s.cursor!=this.cursor_&&(this.previousCursor_=s.cursor,s.cursor=this.cursor_):void 0!==this.previousCursor_&&(s.cursor=this.previousCursor_,this.previousCursor_=void 0)}}},ol.interaction.LongTouch=function(t){t||(t={}),this.delay_=t.delay||1e3;var e=t.handleLongTouchEvent||function(){},o=null;ol.interaction.Interaction.call(this,{handleEvent:function(t){if(this.getActive())switch(t.type){case"pointerdown":o&&clearTimeout(o),o=setTimeout(function(){t.type="longtouch",e(t)},this.delay_);break;case"pointerdrag":case"pointerup":o&&(clearTimeout(o),o=null)}else o&&(clearTimeout(o),o=null);return!0}})},ol.ext.inherits(ol.interaction.LongTouch,ol.interaction.Interaction),ol.interaction.Modify.prototype.getModifiedFeatures=function(){var t={};this.dragSegments_.forEach(function(e){var o=e[0].feature;t[ol.getUid(o)]=o});var e=[];for(var o in t)e.push(t[o]);return e},ol.interaction.ModifyFeature=function(t){var e,o;t||(t={}),ol.interaction.Pointer.call(this,{handleEvent:function(t){switch(t.type){case"pointerdown":return e=this.handleDownEvent(t),o=e||this._deleteCondition(t),!e;case"pointerup":return e=!1,this.handleUpEvent(t);case"pointerdrag":return!e||this.handleDragEvent(t);case"pointermove":return!!e||this.handleMoveEvent(t);case"singleclick":case"click":return!o;default:return!0}}}),this.snapDistance_=t.pixelTolerance||10,this.tolerance_=1e-10,this.cursor_=t.cursor,this.sources_=t.sources?t.sources instanceof Array?t.sources:[t.sources]:[],t.features&&this.sources_.push(new ol.source.Vector({features:t.features})),this.filterSplit_=t.filter||function(){return!0},this._condition=t.condition||ol.events.condition.primaryAction,this._deleteCondition=t.deleteCondition||ol.events.condition.altKeyOnly,this._insertVertexCondition=t.insertVertexCondition||ol.events.condition.always;var i=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})})})]};t.style&&(i="function"==typeof t.style?t.style:function(){return t.style}),this.overlayLayer_=new ol.layer.Vector({source:new ol.source.Vector({useSpatialIndex:!1}),name:"Modify overlay",displayInLayerSwitcher:!1,style:i})},ol.ext.inherits(ol.interaction.ModifyFeature,ol.interaction.Pointer),ol.interaction.ModifyFeature.prototype.setMap=function(t){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),ol.interaction.Interaction.prototype.setMap.call(this,t),this.overlayLayer_.setMap(t)},ol.interaction.ModifyFeature.prototype.setActive=function(t){ol.interaction.Interaction.prototype.setActive.call(this,t),this.overlayLayer_&&this.overlayLayer_.getSource().clear()},ol.interaction.ModifyFeature.prototype.getClosestFeature=function(t){for(var e,o,i=this.snapDistance_+1,r=0;r<this.sources_.length;r++){var n=this.sources_[r];if((e=n.getClosestFeatureToCoordinate(t.coordinate))&&this.filterSplit_(e)){var s=e.getGeometry().getClosestPoint(t.coordinate),a=ol.coordinate.dist2d(t.coordinate,s)/t.frameState.viewState.resolution;a<i&&(i=a,o=s);break}}if(i>this.snapDistance_)return!1;var l=this.getNearestCoord(o,e.getGeometry());if(l){l=l.coord;var c=this.getMap().getPixelFromCoordinate(l);return ol.coordinate.dist2d(t.pixel,c)<this.snapDistance_&&(o=l),{source:n,feature:e,coord:o}}},ol.interaction.ModifyFeature.prototype.getNearestCoord=function(t,e){var o,i,r,n,s;switch(e.getType()){case"Point":return{coord:e.getCoordinates(),dist:ol.coordinate.dist2d(e.getCoordinates(),t)};case"MultiPoint":return this.getNearestCoord(t,new ol.geom.LineString(e.getCoordinates()));case"LineString":case"LinearRing":var a;s=Number.MAX_VALUE;var l=e.getCoordinates();for(o=0;o<l.length;o++)(a=ol.coordinate.dist2d(t,l[o]))<s&&(s=a,n=l[o]);return{coord:n,dist:s};case"MultiLineString":var c=e.getLineStrings();for(n=!1,s=Number.MAX_VALUE,o=0;i=c[o];o++)(r=this.getNearestCoord(t,i))&&r.dist<s&&(n=r,s=r.dist,n.ring=o);return n;case"Polygon":var h=e.getLinearRings();for(n=!1,s=Number.MAX_VALUE,o=0;i=h[o];o++)(r=this.getNearestCoord(t,i))&&r.dist<s&&(n=r,s=r.dist,n.ring=o);return n;case"MultiPolygon":var p=e.getPolygons();for(n=!1,s=Number.MAX_VALUE,o=0;i=p[o];o++)(r=this.getNearestCoord(t,i))&&r.dist<s&&(n=r,s=r.dist,p.poly=o);return n;default:return!1}},ol.interaction.ModifyFeature.prototype.getArcs=function(t,e){var o,i,r,n,s=!1;switch(t.getType()){case"Point":s={geom:t,type:t.getType(),coord1:[],coord2:[],node:!0};break;case"MultiPoint":for(o=t.getCoordinates(),i=0;i<o.length;i++)if(ol.coordinate.equal(e,o[i])){s={geom:t,type:t.getType(),index:i,coord1:[],coord2:[],node:!0};break}break;case"LinearRing":case"LineString":var a=t.getClosestPoint(e);if(ol.coordinate.dist2d(a,e)<1.5*this.tolerance_){var l;if("LinearRing"===t.getType())l=new ol.geom.LineString(t.getCoordinates()).splitAt(e,this.tolerance_);else l=t.splitAt(e,this.tolerance_);if(l.length>2){for(o=l[1].getCoordinates(),i=2;r=l[i];i++){var c=r.getCoordinates();c.shift(),o=o.concat(c)}l=[l[0],new ol.geom.LineString(o)]}if(2===l.length){var h=l[0].getCoordinates(),p=l[1].getCoordinates(),u=h.length+p.length-1;h.pop(),p.shift(),s={geom:t,type:t.getType(),coord1:h,coord2:p,node:t.getCoordinates().length===u,closed:!1}}else if(1===l.length){r=l[0].getCoordinates();var d=ol.coordinate.equal(r[0],e),g=ol.coordinate.equal(r[r.length-1],e);d?(r.shift(),g&&r.pop(),s={geom:t,type:t.getType(),coord1:[],coord2:r,node:!0,closed:g}):g&&(r.pop(),s={geom:t,type:t.getType(),coord1:r,coord2:[],node:!0,closed:!1})}}break;case"MultiLineString":var f=t.getLineStrings();for(i=0;n=f[i];i++)if(s=this.getArcs(n,e)){s.geom=t,s.type=t.getType(),s.lstring=i;break}break;case"Polygon":var m=t.getLinearRings();for(i=0;n=m[i];i++)if(s=this.getArcs(n,e)){s.geom=t,s.type=t.getType(),s.index=i;break}break;case"MultiPolygon":var y=t.getPolygons();for(i=0;n=y[i];i++)if(s=this.getArcs(n,e)){s.geom=t,s.type=t.getType(),s.poly=i;break}break;default:console.error("ol/interaction/ModifyFeature "+t.getType()+" not supported!")}return s},ol.interaction.ModifyFeature.prototype.handleDownEvent=function(t){if(!this.getActive())return!1;var e=this.getClosestFeature(t);if(e&&(this._condition(t)||this._deleteCondition(t))){var o=[];return this.arcs=[],this.sources_.forEach(function(t){var i=ol.extent.buffer(ol.extent.boundingExtent([e.coord]),this.tolerance_);o=o.concat(o,t.getFeaturesInExtent(i))}.bind(this)),this._modifiedFeatures=[],o.forEach(function(o){var i=this.getArcs(o.getGeometry(),e.coord);i&&(this._insertVertexCondition(t)||i.node)&&(i.feature=o,this._modifiedFeatures.push(o),this.arcs.push(i))}.bind(this)),!this._modifiedFeatures.length||(this._deleteCondition(t)?!this._removePoint(e,t):(this.dispatchEvent({type:"modifystart",coordinate:e.coord,originalEvent:t.originalEvent,features:this._modifiedFeatures}),this.handleDragEvent({coordinate:e.coord}),!0))}return!1},ol.interaction.ModifyFeature.prototype.getModifiedFeatures=function(){return this._modifiedFeatures||[]},ol.interaction.ModifyFeature.prototype.removePoint=function(){this._removePoint({},{})},ol.interaction.ModifyFeature.prototype._removePoint=function(t,e){if(!this.arcs)return!1;this.overlayLayer_.getSource().clear();var o=!1;return this.arcs.forEach(function(t){var e=t.coord1.concat(t.coord2);switch(t.type){case"LineString":t.closed&&e.push(e[0]),e.length>1&&t.geom.getCoordinates().length!=e.length&&(t.coords=e,o=!0);break;case"MultiLineString":if(t.closed&&e.push(e[0]),e.length>1){var i=t.geom.getCoordinates();i[t.lstring].length!=e.length&&(i[t.lstring]=e,t.coords=i,o=!0)}break;case"Polygon":t.closed&&e.push(e[0]),e.length>3&&(i=t.geom.getCoordinates())[t.index].length!=e.length&&(i[t.index]=e,t.coords=i,o=!0);break;case"MultiPolygon":t.closed&&e.push(e[0]),e.length>3&&(i=t.geom.getCoordinates())[t.poly][t.index].length!=e.length&&(i[t.poly][t.index]=e,t.coords=i,o=!0)}}.bind(this)),o&&(this.dispatchEvent({type:"modifystart",coordinate:t.coord,originalEvent:e.originalEvent,features:this._modifiedFeatures}),this.arcs.forEach(function(t){t.coords&&t.geom.setCoordinates(t.coords)}),this.dispatchEvent({type:"modifyend",coordinate:t.coord,originalEvent:e.originalEvent,features:this._modifiedFeatures})),this.arcs=[],o},ol.interaction.ModifyFeature.prototype.handleUpEvent=function(t){return!!this.getActive()&&(!this.arcs||!this.arcs.length||(this.overlayLayer_.getSource().clear(),this.dispatchEvent({type:"modifyend",coordinate:t.coordinate,originalEvent:t.originalEvent,features:this._modifiedFeatures}),!0))},ol.interaction.ModifyFeature.prototype.handleDragEvent=function(t){if(!this.getActive())return!1;if(!this.arcs)return!0;this.overlayLayer_.getSource().clear();var e=new ol.Feature(new ol.geom.Point(t.coordinate));return this.overlayLayer_.getSource().addFeature(e),!this.arcs.length||(this.arcs.forEach(function(e){var o,i=e.coord1.concat([t.coordinate],e.coord2);switch(e.closed&&i.push(t.coordinate),e.type){case"Point":e.geom.setCoordinates(t.coordinate);break;case"MultiPoint":(o=e.geom.getCoordinates())[e.index]=t.coordinate,e.geom.setCoordinates(o);break;case"LineString":e.geom.setCoordinates(i);break;case"MultiLineString":(o=e.geom.getCoordinates())[e.lstring]=i,e.geom.setCoordinates(o);break;case"Polygon":(o=e.geom.getCoordinates())[e.index]=i,e.geom.setCoordinates(o);break;case"MultiPolygon":(o=e.geom.getCoordinates())[e.poly][e.index]=i,e.geom.setCoordinates(o)}}.bind(this)),this.dispatchEvent({type:"modifying",coordinate:t.coordinate,originalEvent:t.originalEvent,features:this._modifiedFeatures}),!0)},ol.interaction.ModifyFeature.prototype.handleMoveEvent=function(t){if(!this.getActive())return!1;this.overlayLayer_.getSource().clear();var e=this.getClosestFeature(t);if(e){var o=new ol.Feature(new ol.geom.Point(e.coord));this.overlayLayer_.getSource().addFeature(o)}var i=t.map.getTargetElement();this.cursor_&&(e?i.style.cursor!=this.cursor_&&(this.previousCursor_=i.style.cursor,i.style.cursor=this.cursor_):void 0!==this.previousCursor_&&(i.style.cursor=this.previousCursor_,this.previousCursor_=void 0))},ol.interaction.ModifyTouch=function(t){var e=this;t||(t={}),this._popup=new ol.Overlay.Popup({popupClass:t.calssName||"modifytouch",positioning:"bottom-rigth",offsetBox:10}),this._source=t.source,this._features=t.features;var o=document.createElement("a");o.appendChild(document.createTextNode(t.title||"remove point")),o.onclick=function(){e.removePoint()},this.setPopupContent(o);var i=(t.pixelTolerance||0)+5;t.condition=function(t){var e,o,r=this.getMap().getFeaturesAtPixel(t.pixel,{hitTolerance:i}),n=!1;if(r){var s=this._features;if(!s){e=[t.pixel[0]-i,t.pixel[1]-i],o=[t.pixel[0]+i,t.pixel[1]+i],e=this.getMap().getCoordinateFromPixel(e),o=this.getMap().getCoordinateFromPixel(o);var a=ol.extent.boundingExtent([e,o]);s=this._source.getFeaturesInExtent(a)}s.getArray&&(s=s.getArray());for(var l,c=0;(l=r[c])&&!(s.indexOf(l)>=0);c++);if(l){e=t.pixel,o=l.getGeometry().getClosestPoint(t.coordinate),o=this.getMap().getPixelFromCoordinate(o);var h=e[0]-o[0],p=e[1]-o[1];n=Math.sqrt(h*h+p*p)<i}}return this.showDeleteBt(n?{type:"show",feature:l,coordinate:t.coordinate}:{type:"hide"}),t.preventDefault(),t.stopPropagation(),!0},t.insertVertexCondition=function(){return this.showDeleteBt({type:"hide"}),!0},ol.interaction.Modify.call(this,t),this.on(["modifystart","modifyend"],function(){this.showDeleteBt({type:"hide",modifying:!0})}),this.set("usePopup",!1!==t.usePopup)},ol.ext.inherits(ol.interaction.ModifyTouch,ol.interaction.Modify),ol.interaction.ModifyTouch.prototype.setMap=function(t){this.getMap()&&this.getMap().removeOverlay(this._popup),ol.interaction.Modify.prototype.setMap.call(this,t),this.getMap()&&this.getMap().addOverlay(this._popup)},ol.interaction.ModifyTouch.prototype.setActive=function(t){ol.interaction.Modify.prototype.setActive.call(this,t),this.showDeleteBt({type:"hide"})},ol.interaction.ModifyTouch.prototype.removePoint=function(){new Date-this._timeout<200||(ol.interaction.Modify.prototype.removePoint.call(this),this.showDeleteBt({type:"hide"}))},ol.interaction.ModifyTouch.prototype.showDeleteBt=function(t){this.get("usePopup")&&"show"===t.type?this._popup.show(t.coordinate,this._menu):this._popup.hide(),t.type+="popup",this.dispatchEvent(t),this._timeout=new Date},ol.interaction.ModifyTouch.prototype.setPopupContent=function(t){this._menu=t},ol.interaction.ModifyTouch.prototype.getPopupContent=function(){return this._menu},ol.interaction.Offset=function(t){t||(t={}),ol.interaction.Pointer.call(this,{handleDownEvent:this.handleDownEvent_,handleDragEvent:this.handleDragEvent_,handleMoveEvent:this.handleMoveEvent_,handleUpEvent:this.handleUpEvent_}),this.features_=t.features,this.layers_=t.layers?t.layers instanceof Array?t.layers:[t.layers]:null,this.set("duplicate",t.duplicate),this.source_=t.source,this.previousCursor_=!1},ol.ext.inherits(ol.interaction.Offset,ol.interaction.Pointer),ol.interaction.Offset.prototype.setMap=function(t){ol.interaction.Pointer.prototype.setMap.call(this,t)},ol.interaction.Offset.prototype.getFeatureAtPixel_=function(t){var e=this;return this.getMap().forEachFeatureAtPixel(t.pixel,function(o,i){var r;if(e.layers_){for(var n=0;n<e.layers_.length;n++)if(e.layers_[n]===i){r=o;break}}else e.features_?e.features_.forEach(function(t){t===o&&(r=o)}):r=o;var s=r.getGeometry().getType();if(r&&/Polygon|LineString/.test(s)){if("Polygon"===s&&r.getGeometry().getCoordinates().length>1)return!1;var a=r.getGeometry().getClosestPoint(t.coordinate),l=a[0]-t.coordinate[0],c=a[1]-t.coordinate[1];return Math.sqrt(l*l+c*c)/t.frameState.viewState.resolution<5&&{feature:r,hit:a,coordinates:r.getGeometry().getCoordinates(),geom:r.getGeometry().clone(),geomType:s}}return!1},{hitTolerance:5})},ol.interaction.Offset.prototype.handleDownEvent_=function(t){return this.current_=this.getFeatureAtPixel_(t),this.source_&&(this.get("duplicate")||t.originalEvent.ctrlKey)?(this.current_.feature=this.current_.feature.clone(),this.source_.addFeature(this.current_.feature)):this.current_&&this.dispatchEvent({type:"modifystart",features:[this.current_.feature]}),!!this.current_&&(this.dispatchEvent({type:"offsetstart",feature:this.current_.feature,offset:0}),!0)},ol.interaction.Offset.prototype.handleDragEvent_=function(t){var e,o,i,r,n=this.current_.geom.getClosestPoint(t.coordinate),s=ol.coordinate.dist2d(n,t.coordinate);switch(this.current_.geomType){case"Polygon":if(e=ol.coordinate.findSegment(n,this.current_.coordinates[0]).segment){o=[e[1][0]-e[0][0],e[1][1]-e[0][1]],i=[t.coordinate[0]-n[0],t.coordinate[1]-n[1]],o[0]*i[1]-o[1]*i[0]>0&&(s=-s),r=[];for(var a=0;a<this.current_.coordinates.length;a++)r.push(ol.coordinate.offsetCoords(this.current_.coordinates[a],0==a?s:-s));this.current_.feature.setGeometry(new ol.geom.Polygon(r))}break;case"LineString":(e=ol.coordinate.findSegment(n,this.current_.coordinates).segment)&&(o=[e[1][0]-e[0][0],e[1][1]-e[0][1]],i=[t.coordinate[0]-n[0],t.coordinate[1]-n[1]],o[0]*i[1]-o[1]*i[0]>0&&(s=-s),r=ol.coordinate.offsetCoords(this.current_.coordinates,s),this.current_.feature.setGeometry(new ol.geom.LineString(r)))}this.dispatchEvent({type:"offsetting",feature:this.current_.feature,offset:s,segment:[n,t.coordinate],coordinate:t.coordinate})},ol.interaction.Offset.prototype.handleUpEvent_=function(t){this.dispatchEvent({type:"offsetend",feature:this.current_.feature,coordinate:t.coordinate}),this.current_=!1},ol.interaction.Offset.prototype.handleMoveEvent_=function(t){this.getFeatureAtPixel_(t)?(!1===this.previousCursor_&&(this.previousCursor_=t.map.getTargetElement().style.cursor),t.map.getTargetElement().style.cursor="pointer"):(t.map.getTargetElement().style.cursor=this.previousCursor_,this.previousCursor_=!1)},ol.interaction.Ripple=function(t){ol.interaction.Pointer.call(this,{handleDownEvent:this.rainDrop,handleMoveEvent:this.rainDrop}),t=t||{},this.riprad=t.radius||3,this.ripplemap=[],this.last_map=[],this.interval=t.interval,this.rains(this.interval)},ol.ext.inherits(ol.interaction.Ripple,ol.interaction.Pointer),ol.interaction.Ripple.prototype.setMap=function(t){this.oncompose&&(ol.Observable.unByKey(this.oncompose),this.getMap()&&this.getMap().render()),ol.interaction.Pointer.prototype.setMap.call(this,t),t&&(this.oncompose=t.on("postcompose",this.postcompose_.bind(this)))},ol.interaction.Ripple.prototype.rains=function(t){this.onrain&&clearTimeout(this.onrain);var e=this,o=("number"==typeof t?t:1e3)/2,i=3*o/2,r=Math.random;i&&function t(){e.width&&e.rainDrop([r()*e.width,r()*e.height]),e.onrain=setTimeout(t,r()*o+i)}()},ol.interaction.Ripple.prototype.rainDrop=function(t){if(this.width){var e,o;t.pixel?(e=t.pixel[0]*this.ratio,o=t.pixel[1]*this.ratio):(e=t[0]*this.ratio,o=t[1]*this.ratio),e<<=0;for(var i=(o<<=0)-this.riprad*this.ratio;i<o+this.riprad*this.ratio;i++)for(var r=e-this.riprad*this.ratio;r<e+this.riprad*this.ratio;r++)this.ripplemap[this.oldind+i*this.width+r]+=128}},ol.interaction.Ripple.prototype.postcompose_=function(t){var e,o,i,r,n,s=t.context,a=s.canvas;if(this.width!=a.width||this.height!=a.height){this.width=a.width,this.height=a.height,this.ratio=t.frameState.pixelRatio,this.half_width=this.width>>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<this.size;l++)this.last_map[l]=this.ripplemap[l]=0}this.texture=s.getImageData(0,0,this.width,this.height),this.ripple=s.getImageData(0,0,this.width,this.height);var c=this.oldind;this.oldind=this.newind,this.newind=c,l=0;for(var h=this.ripple.data,p=this.texture.data,u=0;u<this.height;u++)for(var d=0;d<this.width;d++){var g=this.newind+l,f=this.oldind+l;i=this.ripplemap[f-this.width]+this.ripplemap[f+this.width]+this.ripplemap[f-1]+this.ripplemap[f+1]>>1,i-=this.ripplemap[g],i-=i>>5,this.ripplemap[g]=i,i=1024-i,this.last_map[l]!=i&&(this.last_map[l]=i,e=((d-this.half_width)*i/1024<<0)+this.half_width,o=((u-this.half_height)*i/1024<<0)+this.half_height,e>=this.width&&(e=this.width-1),e<0&&(e=0),o>=this.height&&(o=this.height-1),o<0&&(o=0),n=4*(e+o*this.width),h[r=4*l]=p[n],h[r+1]=p[n+1],h[r+2]=p[n+2]),++l}s.putImageData(this.ripple,0,0),this.getMap().render()},ol.interaction.SelectCluster=function(t){var e;t=t||{},this.pointRadius=t.pointRadius||12,this.circleMaxObjects=t.circleMaxObjects||10,this.maxObjects=t.maxObjects||60,this.spiral=!1!==t.spiral,this.animate=t.animate,this.animationDuration=t.animationDuration||500,this.selectCluster_=!1!==t.selectCluster;var o=this.overlayLayer_=new ol.layer.Vector({source:new ol.source.Vector({features:new ol.Collection,wrapX:t.wrapX,useSpatialIndex:!0}),name:"Cluster overlay",updateWhileAnimating:!0,updateWhileInteracting:!0,displayInLayerSwitcher:!1,style:t.featureStyle});t.layers&&("function"==typeof t.layers?(e=t.layers,t.layers=function(t){return t===o||e(t)}):t.layers.push&&t.layers.push(this.overlayLayer_)),t.filter?(e=t.filter,t.filter=function(t,o){return!(!o&&t.get("selectclusterlink"))&&e(t,o)}):t.filter=function(t,e){return!(!e&&t.get("selectclusterlink"))},this.filter_=t.filter,ol.interaction.Select.call(this,t),this.on("select",this.selectCluster.bind(this))},ol.ext.inherits(ol.interaction.SelectCluster,ol.interaction.Select),ol.interaction.SelectCluster.prototype.setMap=function(t){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,ol.interaction.Select.prototype.setMap.call(this,t),this.overlayLayer_.setMap(t),t&&t.getView()&&(this._listener=t.getView().on("change:resolution",this.clear.bind(this)))},ol.interaction.SelectCluster.prototype.clear=function(){this.getFeatures().clear(),this.overlayLayer_.getSource().clear()},ol.interaction.SelectCluster.prototype.getLayer=function(){return this.overlayLayer_},ol.interaction.SelectCluster.prototype.selectCluster=function(t){if(t.selected.length){var e=t.selected[0];if(!e.get("selectclusterfeature")){var o=this.overlayLayer_.getSource();o.clear();var i=e.get("features");if(i&&1!=i.length){this.selectCluster_||this.getFeatures().clear();var r,n,s,a,l,c,h=e.getGeometry().getCoordinates(),p=this.getMap().getView().getResolution(),u=p*this.pointRadius*(.5+i.length/4),d=[];if(!this.spiral||i.length<=this.circleMaxObjects)for(s=Math.min(i.length,this.circleMaxObjects),n=0;n<s;n++)r=2*Math.PI*n/s,2!=s&&4!=s||(r+=Math.PI/4),a=[h[0]+u*Math.sin(r),h[1]+u*Math.cos(r)],(l=new ol.Feature({selectclusterfeature:!0,features:[i[n]],geometry:new ol.geom.Point(a)})).setStyle(i[n].getStyle()),d.push(l),c=new ol.Feature({selectclusterlink:!0,geometry:new ol.geom.LineString([h,a])}),d.push(c);else{r=0;var g=2*this.pointRadius;for(s=Math.min(this.maxObjects,i.length),n=0;n<s;n++){r+=(g+.1)/(u=g/2+g*r/(2*Math.PI));var f=p*u*Math.sin(r),m=p*u*Math.cos(r);a=[h[0]+f,h[1]+m],(l=new ol.Feature({selectclusterfeature:!0,features:[i[n]],geometry:new ol.geom.Point(a)})).setStyle(i[n].getStyle()),d.push(l),c=new ol.Feature({selectclusterlink:!0,geometry:new ol.geom.LineString([h,a])}),d.push(c)}}o.clear(),this.animate?this.animateCluster_(h,d):o.addFeatures(d)}}}else this.clear()},ol.interaction.SelectCluster.prototype.animateCluster_=function(t,e){if(this.listenerKey_&&ol.Observable.unByKey(this.listenerKey_),e.length){var o=this.overlayLayer_.getStyle(),i="function"==typeof o?o:o.length?function(){return o}:function(){return[o]},r=this.animationDuration||500,n=(new Date).getTime();this.listenerKey_=this.overlayLayer_.on(["postcompose","postrender"],function(o){for(var s,a=o.vectorContext||ol.render.getVectorContext(o),l=o.frameState.pixelRatio,c=this.getMap().getView().getResolution(),h=ol.easing.easeOut((o.frameState.time-n)/r),p=0;s=e[p];p++)if(s.get("features")){var u=s.getGeometry().getCoordinates();u[0]=t[0]+h*(u[0]-t[0]),u[1]=t[1]+h*(u[1]-t[1]);for(var d=new ol.geom.Point(u),g=i(s,c),f=0;f<g.length;f++){var m,y=!ol.Map.prototype.getFeaturesAtPixel&&g[f].getImage();y&&(m=y.getScale(),y.setScale(l)),a.setStyle?(a.setStyle(g[f]),a.drawGeometry(d)):(a.setImageStyle(y),a.drawPointGeometry(d)),y&&y.setScale(m)}}if(h>1)return ol.Observable.unByKey(this.listenerKey_),this.overlayLayer_.getSource().addFeatures(e),void this.overlayLayer_.changed();o.frameState.animate=!0}.bind(this));var s=new ol.Feature(new ol.geom.Point(this.getMap().getView().getCenter()));s.setStyle(new ol.style.Style({image:new ol.style.Circle({})})),this.overlayLayer_.getSource().addFeature(s)}},ol.interaction.SnapGuides=function(t){function e(t,e){var o=t[1][0]-t[0][0],i=t[1][1]-t[0][1],r=e[1][0]-e[0][0],n=e[1][1]-e[0][1],s=o*n-i*r;if(0!=s){var a=(o*t[0][1]-o*e[0][1]-i*t[0][0]+i*e[0][0])/s;return[e[0][0]+a*r,e[0][1]+a*n]}return!1}function o(t,e){var o=t[0]-e[0],i=t[1]-e[1];return Math.sqrt(o*o+i*i)}t||(t={}),this.snapDistance_=t.pixelTolerance||10,this.enableInitialGuides_=t.enableInitialGuides||!1;var i=[new ol.style.Style({stroke:new ol.style.Stroke({color:"#ffcc33",lineDash:[8,5],width:1.25})})];t.style&&(i=t.style instanceof Array?t.style:[t.style]),this.overlaySource_=new ol.source.Vector({features:new ol.Collection,useSpatialIndex:!1}),this.overlayLayer_=new ol.layer.Vector({renderMode:"image",source:this.overlaySource_,style:function(){return i},name:"Snap overlay",displayInLayerSwitcher:!1}),ol.interaction.Interaction.call(this,{handleEvent:function(t){if(this.getActive()){for(var i,r=this.overlaySource_.getFeatures(),n=null,s=null,a=t.frameState.viewState.resolution,l=0;i=r[l];l++){var c=i.getGeometry().getClosestPoint(t.coordinate);if(o(c,t.coordinate)/a<this.snapDistance_){if(n){var h=e(n.getGeometry().getCoordinates(),i.getGeometry().getCoordinates());h&&o(h,t.coordinate)/a<this.snapDistance_&&(s=h)}else s=c;n=i}}s&&(t.coordinate=s)}return!0}})},ol.ext.inherits(ol.interaction.SnapGuides,ol.interaction.Interaction),ol.interaction.SnapGuides.prototype.setMap=function(t){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),ol.interaction.Interaction.prototype.setMap.call(this,t),this.overlayLayer_.setMap(t),t&&(this.projExtent_=t.getView().getProjection().getExtent())},ol.interaction.SnapGuides.prototype.setActive=function(t){this.overlayLayer_.setVisible(t),ol.interaction.Interaction.prototype.setActive.call(this,t)},ol.interaction.SnapGuides.prototype.clearGuides=function(t){if(t)for(var e,o=0;e=t[o];o++)try{this.overlaySource_.removeFeature(e)}catch(t){}else this.overlaySource_.clear()},ol.interaction.SnapGuides.prototype.getGuides=function(){return this.overlaySource_.getFeaturesCollection()},ol.interaction.SnapGuides.prototype.addGuide=function(t,e){if(t){var o=this.getMap(),i=o.getView().calculateExtent(o.getSize()),r=Math.max(this.projExtent_[2]-this.projExtent_[0],this.projExtent_[3]-this.projExtent_[1]);(i=ol.extent.buffer(i,1.5*r))[0]<this.projExtent_[0]&&(i[0]=this.projExtent_[0]),i[1]<this.projExtent_[1]&&(i[1]=this.projExtent_[1]),i[2]>this.projExtent_[2]&&(i[2]=this.projExtent_[2]),i[3]>this.projExtent_[3]&&(i[3]=this.projExtent_[3]);var n=t[0][0]-t[1][0],s=t[0][1]-t[1][1],a=1/Math.sqrt(n*n+s*s),l=function(o){for(var l,c=[],h=r*o*2,p=0;(o>0?p<h:p>h)&&(l=e?[t[0][0]+s*a*p,t[0][1]-n*a*p]:[t[0][0]+n*a*p,t[0][1]+s*a*p],ol.extent.containsCoordinate(i,l));p+=r*o/100)c.push(l);return new ol.Feature(new ol.geom.LineString([c[0],c[c.length-1]]))},c=l(1),h=l(-1);return this.overlaySource_.addFeature(c),this.overlaySource_.addFeature(h),[c,h]}},ol.interaction.SnapGuides.prototype.addOrthoGuide=function(t){return this.addGuide(t,!0)},ol.interaction.SnapGuides.prototype.setDrawInteraction=function(t){var e=this,o=0,i=[];function r(t){var r=t.target.getCoordinates();switch(t.target.getType()){case"Polygon":r=r[0].slice(0,-1)}var n=r.length;if(2===n&&e.enableInitialGuides_){var s=r[0][0],a=r[0][1];r=[[s,a],[s,a-1]]}if(n!=o&&(e.enableInitialGuides_?n>=2:n>2)){e.clearGuides(i);var l=r[n-2],c=r[n-2-1];n>2&&(l[0]!==c[0]||l[1]!==c[1])&&(i=e.addOrthoGuide([r[n-2],r[n-2-1]])),i=(i=i.concat(e.addGuide([r[0],r[1]]))).concat(e.addOrthoGuide([r[0],r[1]])),o=n}}t.on("drawstart",function(t){t.feature.getGeometry().on("change",r)}),t.on(["drawend","change:active"],function(t){e.clearGuides(i),t.feature&&t.feature.getGeometry().un("change",r),o=0,i=[]})},ol.interaction.SnapGuides.prototype.setModifyInteraction=function(t){function e(t,e){return(t%e+e)%e}var o=this,i=[];function r(t){var r=t.target.vertexFeature_;if(r){var n=t.target.getModifiedFeatures()[0].getGeometry(),s=n.getCoordinates();switch(n.getType()){case"Polygon":s=s[0].slice(0,-1)}var a=r.getGeometry().getCoordinates(),l=s.findIndex(function(t){return t[0]===a[0]&&t[1]===a[1]}),c=s.length;o.clearGuides(i),i=(i=(i=(i=o.addOrthoGuide([s[e(l-1,c)],s[e(l-2,c)]])).concat(o.addGuide([s[e(l-1,c)],s[e(l-2,c)]]))).concat(o.addGuide([s[e(l+1,c)],s[e(l+2,c)]]))).concat(o.addOrthoGuide([s[e(l+1,c)],s[e(l+2,c)]]))}}t.on("modifystart",function(t){setTimeout(r,0,t)}),t.on("modifyend",function(){o.clearGuides(i),i=[]})},ol.interaction.Split=function(t){t||(t={}),ol.interaction.Interaction.call(this,{handleEvent:function(t){switch(t.type){case"singleclick":return this.handleDownEvent(t);case"pointermove":return this.handleMoveEvent(t);default:return!0}}}),this.snapDistance_=t.snapDistance||25,this.tolerance_=t.tolerance||1e-10,this.cursor_=t.cursor,this.sources_=t.sources?t.sources instanceof Array?t.sources:[t.sources]:[],t.features&&this.sources_.push(new ol.source.Vector({features:t.features})),this.filterSplit_=t.filter||function(){return!0};var e=[255,255,255,1],o=[0,153,255,1],i=new ol.style.Fill({color:"rgba(255,255,255,0.4)"}),r=new ol.style.Stroke({color:"#3399CC",width:1.25}),n=[new ol.style.Style({image:new ol.style.Circle({fill:i,stroke:r,radius:5}),fill:i,stroke:r})],s=[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:o}),stroke:new ol.style.Stroke({color:e,width:1.5})}),stroke:new ol.style.Stroke({color:o,width:3})})];t.sketchStyle&&(n=t.sketchStyle instanceof Array?t.sketchStyle:[t.sketchStyle]),t.featureStyle&&(s=t.featureStyle instanceof Array?t.featureStyle:[t.featureStyle]),this.overlayLayer_=new ol.layer.Vector({source:new ol.source.Vector({useSpatialIndex:!1}),name:"Split overlay",displayInLayerSwitcher:!1,style:function(t){return t._sketch_?n:s}})},ol.ext.inherits(ol.interaction.Split,ol.interaction.Interaction),ol.interaction.Split.prototype.setMap=function(t){this.getMap()&&this.getMap().removeLayer(this.overlayLayer_),ol.interaction.Interaction.prototype.setMap.call(this,t),this.overlayLayer_.setMap(t)},ol.interaction.Split.prototype.getClosestFeature=function(t){for(var e,o,i,r=this.snapDistance_+1,n=0;n<this.sources_.length;n++){var s=this.sources_[n];if((e=s.getClosestFeatureToCoordinate(t.coordinate))&&e.getGeometry().splitAt){o=e.getGeometry().getClosestPoint(t.coordinate),r=(i=new ol.geom.LineString([t.coordinate,o])).getLength()/t.frameState.viewState.resolution;break}}if(r>this.snapDistance_)return!1;var a=this.getNearestCoord(o,e.getGeometry().getCoordinates()),l=this.getMap().getPixelFromCoordinate(a);return ol.coordinate.dist2d(t.pixel,l)<this.snapDistance_&&(o=a),{source:s,feature:e,coord:o,link:i}},ol.interaction.Split.prototype.getNearestCoord=function(t,e){for(var o,i,r=Number.MAX_VALUE,n=0;n<e.length;n++)(o=ol.coordinate.dist2d(t,e[n]))<r&&(r=o,i=e[n]);return i},ol.interaction.Split.prototype.handleDownEvent=function(t){var e=this.getClosestFeature(t);if(e){this.overlayLayer_.getSource().clear();var o,i=e.feature.getGeometry().splitAt(e.coord,this.tolerance_);if(i.length>1){var r=[];for(o=0;o<i.length;o++){var n=e.feature.clone();n.setGeometry(i[o]),r.push(n)}for(this.dispatchEvent({type:"beforesplit",original:e.feature,features:r}),e.source.dispatchEvent({type:"beforesplit",original:e.feature,features:r}),e.source.removeFeature(e.feature),o=0;o<r.length;o++)e.source.addFeature(r[o]);this.dispatchEvent({type:"aftersplit",original:e.feature,features:r}),e.source.dispatchEvent({type:"aftersplit",original:e.feature,features:r})}}return!1},ol.interaction.Split.prototype.handleMoveEvent=function(t){var e=t.map;this.overlayLayer_.getSource().clear();var o,i,r=this.getClosestFeature(t);r&&this.filterSplit_(r.feature)?(this.overlayLayer_.getSource().addFeature(r.feature),(o=new ol.Feature(new ol.geom.Point(r.coord)))._sketch_=!0,this.overlayLayer_.getSource().addFeature(o),(i=new ol.Feature(r.link))._sketch_=!0,this.overlayLayer_.getSource().addFeature(i),this.dispatchEvent({type:"pointermove",coordinate:t.coordinate,frameState:t.frameState,originalEvent:t.originalEvent,map:t.map,pixel:t.pixel,feature:r.feature,linkGeometry:r.link})):this.dispatchEvent(t);var n=e.getTargetElement();this.cursor_&&(r?n.style.cursor!=this.cursor_&&(this.previousCursor_=n.style.cursor,n.style.cursor=this.cursor_):void 0!==this.previousCursor_&&(n.style.cursor=this.previousCursor_,this.previousCursor_=void 0))},ol.interaction.Splitter=function(t){t||(t={}),ol.interaction.Interaction.call(this,{handleEvent:function(t){return"pointermove"!=t.type&&"pointerdrag"!=t.type?(this.lastEvent_&&(this.splitSource(this.lastEvent_.feature),this.lastEvent_=null),this.moving_=!1):this.moving_=!0,!0}}),this.added_=[],this.removed_=[],t.features?this.source_=new ol.source.Vector({features:t.features}):this.source_=t.source?t.source:new ol.source.Vector({features:new ol.Collection});var e=this.triggerSource;t.triggerFeatures&&(e=new ol.source.Vector({features:t.triggerFeatures})),e?(e.on("addfeature",this.onAddFeature.bind(this)),e.on("changefeature",this.onChangeFeature.bind(this)),e.on("removefeature",this.onRemoveFeature.bind(this))):(this.source_.on("addfeature",this.onAddFeature.bind(this)),this.source_.on("changefeature",this.onChangeFeature.bind(this)),this.source_.on("removefeature",this.onRemoveFeature.bind(this))),this.tolerance_=t.tolerance||1e-10,this.filterSplit_=t.filter||function(){return!0}},ol.ext.inherits(ol.interaction.Splitter,ol.interaction.Interaction),ol.interaction.Splitter.prototype.intersectSegs=function(t,e){var o=this.tolerance_,i=t[0][0]-t[1][0],r=e[0][0]-e[1][0],n=t[0][1]-t[1][1],s=e[0][1]-e[1][1],a=i*s-n*r;if(Math.abs(a)<o)return!1;var l=((t[0][0]-e[1][0])*s-(t[0][1]-e[1][1])*r)/a;if(Math.abs(l)<o)return t[0];if(Math.abs(1-l)<o)return t[1];if(l<0||l>1)return!1;var c=((t[0][1]-e[1][1])*i-(t[0][0]-e[1][0])*n)/a;if(Math.abs(c)<o)return e[1];if(Math.abs(1-c)<o)return e[0];if(c<0||c>1)return!1;var h=t[0][0]*t[1][1]-t[0][1]*t[1][0],p=e[0][0]*e[1][1]-e[0][1]*e[1][0];return[(h*r-p*i)/a,(h*s-p*n)/a]},ol.interaction.Splitter.prototype.splitSource=function(t){if(!this.splitting){var e,o,i,r=this;this.source_.dispatchEvent({type:"beforesplit",feaure:t,source:this.source_}),this.splitting=!0,this.added_=[],this.removed_=[];var n,s=t.getGeometry().getCoordinates(),a=[];for(e=0;e<s.length-1;e++){n=[s[e],s[e+1]];for(var l,c=ol.extent.buffer(ol.extent.boundingExtent(n),this.tolerance_);;){var h=!1;if(this.source_.forEachFeatureIntersectingExtent(c,m.bind(this)),!h)break;var p=h;for(this.source_.removeFeature(p),o=0;o<l.length;o++)(i=p.clone()).setGeometry(l[o]),this.source_.addFeature(i)}}for(e=0;e<s.length-2;e++)for(var u=e+1;u<s.length-1;u++){var d=this.intersectSegs([s[e],s[e+1]],[s[u],s[u+1]]);d&&d!=s[e+1]&&a.push(d)}var g=!1;if(a.length){var f=t.getGeometry().splitAt(a,this.tolerance_);if(f.length>1){for(o=0;o<f.length;o++)(i=t.clone()).setGeometry(f[o]),this.source_.addFeature(i);g=!0}}setTimeout(function(){g&&r.source_.removeFeature(t),r.source_.dispatchEvent({type:"aftersplit",featureAdded:r.added_,featureRemoved:r.removed_,source:this.source_}),r.splitting=!1},0)}function m(e){if(e!==t)for(var o=e.getGeometry().getCoordinates(),i=0;i<o.length-1;i++){var r=this.intersectSegs(n,[o[i],o[i+1]]);if(r&&(a.push(r),(l=e.getGeometry().splitAt(r,this.tolerance_))&&l.length>1))return h=e,!0}return!1}},ol.interaction.Splitter.prototype.onAddFeature=function(t){this.splitSource(t.feature),this.splitting&&this.added_.push(t.feature)},ol.interaction.Splitter.prototype.onRemoveFeature=function(t){if(this.splitting){var e=this.added_.indexOf(t.feature);-1==e?this.removed_.push(t.feature):this.added_.splice(e,1)}},ol.interaction.Splitter.prototype.onChangeFeature=function(t){this.moving_?this.lastEvent_=t:this.splitSource(t.feature)},ol.interaction.Synchronize=function(t){t||(t={});var e=this;ol.interaction.Interaction.call(this,{handleEvent:function(t){return"pointermove"==t.type&&e.handleMove_(t),!0}}),this.maps=t.maps},ol.ext.inherits(ol.interaction.Synchronize,ol.interaction.Interaction),ol.interaction.Synchronize.prototype.setMap=function(t){this._listener&&(ol.Observable.unByKey(this._listener.center),ol.Observable.unByKey(this._listener.rotation),ol.Observable.unByKey(this._listener.resolution),this.getMap().getTargetElement().removeEventListener("mouseout",this._listener.mouseout)),this._listener=null,ol.interaction.Interaction.prototype.setMap.call(this,t),t&&(this._listener={},this._listener.center=this.getMap().getView().on("change:center",this.syncMaps.bind(this)),this._listener.rotation=this.getMap().getView().on("change:rotation",this.syncMaps.bind(this)),this._listener.resolution=this.getMap().getView().on("change:resolution",this.syncMaps.bind(this)),this._listener.mouseout=this.handleMouseOut_.bind(this),this.getMap().getTargetElement().addEventListener("mouseout",this._listener.mouseout),this.syncMaps())},ol.interaction.Synchronize.prototype.syncMaps=function(t){var e=this.getMap();if(t||(t={type:"all"}),e)for(var o=0;o<this.maps.length;o++)switch(t.type){case"change:rotation":this.maps[o].getView().getRotation()!=e.getView().getRotation()&&this.maps[o].getView().setRotation(e.getView().getRotation());break;case"change:center":this.maps[o].getView().getCenter()!=e.getView().getCenter()&&this.maps[o].getView().setCenter(e.getView().getCenter());break;case"change:resolution":this.maps[o].getView().getResolution()!=e.getView().getResolution()&&this.maps[o].getView().setResolution(e.getView().getResolution());break;default:this.maps[o].getView().setRotation(e.getView().getRotation()),this.maps[o].getView().setCenter(e.getView().getCenter()),this.maps[o].getView().setResolution(e.getView().getResolution())}},ol.interaction.Synchronize.prototype.handleMove_=function(t){for(var e=0;e<this.maps.length;e++)this.maps[e].showTarget(t.coordinate);this.getMap().showTarget()},ol.interaction.Synchronize.prototype.handleMouseOut_=function(){for(var t=0;t<this.maps.length;t++)this.maps[t].targetOverlay_.setPosition(void 0)},ol.Map.prototype.showTarget=function(t){if(!this.targetOverlay_){var e=document.createElement("div");e.classList.add("ol-target"),this.targetOverlay_=new ol.Overlay({element:e}),this.targetOverlay_.setPositioning("center-center"),this.addOverlay(this.targetOverlay_),e.parentElement.classList.add("ol-target-overlay"),this.targetOverlay_.setPosition([0,0])}this.targetOverlay_.setPosition(t)},ol.Map.prototype.hideTarget=function(){this.removeOverlay(this.targetOverlay_),this.targetOverlay_=void 0},ol.interaction.TinkerBell=function(t){t=t||{},ol.interaction.Pointer.call(this,{handleDownEvent:this.onMove,handleMoveEvent:this.onMove}),this.set("color",t.color?ol.color.asString(t.color):"#fff"),this.sparkle=[0,0],this.sparkles=[],this.lastSparkle=this.time=new Date;var e=this;this.out_=function(){e.isout_=!0},this.isout_=!0},ol.ext.inherits(ol.interaction.TinkerBell,ol.interaction.Pointer),ol.interaction.TinkerBell.prototype.setMap=function(t){this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,this.getMap()&&(t.getViewport().removeEventListener("mouseout",this.out_,!1),this.getMap().render()),ol.interaction.Pointer.prototype.setMap.call(this,t),t&&(this._listener=t.on("postcompose",this.postcompose_.bind(this)),t.getViewport().addEventListener("mouseout",this.out_,!1))},ol.interaction.TinkerBell.prototype.onMove=function(t){this.sparkle=t.pixel,this.isout_=!1,this.getMap().render()},ol.interaction.TinkerBell.prototype.postcompose_=function(t){var e=t.context,o=t.frameState.time-this.time;this.time=t.frameState.time,t.frameState.time-this.lastSparkle>30&&!this.isout_&&(this.lastSparkle=t.frameState.time,this.sparkles.push({p:[this.sparkle[0]+15*Math.random()-7.5,this.sparkle[1]+15*Math.random()],o:1})),e.save(),e.scale(t.frameState.pixelRatio,t.frameState.pixelRatio),e.fillStyle=this.get("color");for(var i,r=this.sparkles.length-1;i=this.sparkles[r];r--){if(i.o<.2){this.sparkles.splice(0,r+1);break}e.globalAlpha=i.o,e.beginPath(),e.arc(i.p[0],i.p[1],2.2,0,2*Math.PI,!1),e.fill(),i.o*=.98,i.p[0]+=Math.random()-.5,i.p[1]+=o*(1+Math.random())/30}e.restore(),this.sparkles.length&&this.getMap().render()},ol.interaction.TouchCompass=function(t){t=t||{};var e={handleDownEvent:function(t){var e=this.getCenter_(),o=t.pixel[0]-e[0],i=t.pixel[1]-e[1];return this.start=t,Math.sqrt(o*o+i*i)<this.size/2},handleDragEvent:function(t){this.pos||(this.pos=this.start,this.getMap().renderSync()),this.pos=t},handleUpEvent:function(){return this.pos=!1,!0}};if(ol.interaction.Pointer.call(this,e),this.ondrag_=t.onDrag,this.size=t.size||80,this.alpha=t.alpha||.5,!ol.interaction.TouchCompass.prototype.compass){var o=ol.interaction.TouchCompass.prototype.compass=document.createElement("canvas"),i=o.getContext("2d"),r=o.width=o.height=this.size,n=r/10,s=r/2,a=.22*s;i.translate(s,s),i.fillStyle="#999",i.strokeStyle="#ccc",i.lineWidth=n,i.beginPath(),i.arc(0,0,.42*r,0,2*Math.PI),i.fill(),i.stroke(),i.fillStyle="#99f",i.beginPath(),i.moveTo(0,0),i.lineTo(s,0),i.lineTo(a,a),i.moveTo(0,0),i.lineTo(-s,0),i.lineTo(-a,-a),i.moveTo(0,0),i.lineTo(0,s),i.lineTo(-a,a),i.moveTo(0,0),i.lineTo(0,-s),i.lineTo(a,-a),i.moveTo(0,0),i.fill(),i.fillStyle="#eee",i.beginPath(),i.moveTo(0,0),i.lineTo(s,0),i.lineTo(a,-a),i.moveTo(0,0),i.lineTo(-s,0),i.lineTo(-a,a),i.moveTo(0,0),i.lineTo(0,s),i.lineTo(a,a),i.moveTo(0,0),i.lineTo(0,-s),i.lineTo(-a,-a),i.moveTo(0,0),i.fill()}},ol.ext.inherits(ol.interaction.TouchCompass,ol.interaction.Pointer),ol.interaction.TouchCompass.prototype.compass=null,ol.interaction.TouchCompass.prototype.setMap=function(t){this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,ol.interaction.Pointer.prototype.setMap.call(this,t),t&&(this._listener=t.on("postcompose",this.drawCompass_.bind(this)))},ol.interaction.TouchCompass.prototype.setActive=function(t){ol.interaction.Pointer.prototype.setActive.call(this,t),this.getMap()&&this.getMap().renderSync()},ol.interaction.TouchCompass.prototype.getCenter_=function(){var t=this.size,e=this.getMap().getSize();return[e[0]/2,e[1]-10-t/2]},ol.interaction.TouchCompass.prototype.drawCompass_=function(t){if(this.getActive()){var e=t.context,o=t.frameState.pixelRatio;e.save(),e.scale(o,o),e.globalAlpha=this.alpha,e.strokeStyle="#fff",e.lineWidth=5;var i=this.size,r=this.getCenter_();if(e.drawImage(this.compass,0,0,this.compass.width,this.compass.height,r[0]-i/2,r[1]-i/2,i,i),this.pos)for(var n=this.pos.pixel[0]-this.start.pixel[0],s=this.pos.pixel[1]-this.start.pixel[1],a=1;a<=4;a++)e.beginPath(),e.arc(r[0]+n/4*a,r[1]+s/4*a,i/2*(.6+.4*a/4),0,2*Math.PI),e.stroke();if(e.restore(),this.pos){if(this.ondrag_){var l=this.getMap().getView().getResolution(),c={dpixel:[this.pos.pixel[0]-this.start.pixel[0],this.pos.pixel[1]-this.start.pixel[1]]};c.traction=[c.dpixel[0]*l,-c.dpixel[1]*l],this.ondrag_(c,this.pos)}t.frameState.animate=!0}}},ol.interaction.Transform=function(t){t||(t={});var e=this;this.handles_=new ol.Collection,this.overlayLayer_=new ol.layer.Vector({source:new ol.source.Vector({features:this.handles_,useSpatialIndex:!1,wrapX:!1}),name:"Transform overlay",displayInLayerSwitcher:!1,style:function(t){return e.style[(t.get("handle")||"default")+(t.get("constraint")||"")+(t.get("option")||"")]}}),ol.interaction.Pointer.call(this,{handleDownEvent:this.handleDownEvent_,handleDragEvent:this.handleDragEvent_,handleMoveEvent:this.handleMoveEvent_,handleUpEvent:this.handleUpEvent_}),this.features_=t.features,"function"==typeof t.filter&&(this._filter=t.filter),this.layers_=t.layers?t.layers instanceof Array?t.layers:[t.layers]:null,this.addFn_=t.addCondition||function(){return!1},this.set("translateFeature",!1!==t.translateFeature),this.set("translate",!1!==t.translate),this.set("stretch",!1!==t.stretch),this.set("scale",!1!==t.scale),this.set("rotate",!1!==t.rotate),this.set("keepAspectRatio",t.keepAspectRatio||function(t){return t.originalEvent.shiftKey}),this.set("modifyCenter",t.modifyCenter||function(t){return t.originalEvent.metaKey||t.originalEvent.ctrlKey}),this.set("noFlip",t.noFlip||!1),this.set("selection",!1!==t.selection),this.set("hitTolerance",t.hitTolerance||0),this.selection_=[],this.on("propertychange",function(){this.drawSketch_()}),this.setDefaultStyle()},ol.ext.inherits(ol.interaction.Transform,ol.interaction.Pointer),ol.interaction.Transform.prototype.Cursors={default:"auto",select:"pointer",translate:"move",rotate:"move",rotate0:"move",scale:"nesw-resize",scale1:"nwse-resize",scale2:"nesw-resize",scale3:"nwse-resize",scalev:"ew-resize",scaleh1:"ns-resize",scalev2:"ew-resize",scaleh3:"ns-resize"},ol.interaction.Transform.prototype.setMap=function(t){this.getMap()&&(this.getMap().removeLayer(this.overlayLayer_),this.previousCursor_&&(this.getMap().getTargetElement().style.cursor=this.previousCursor_,this.previousCursor_=void 0)),ol.interaction.Pointer.prototype.setMap.call(this,t),this.overlayLayer_.setMap(t),null!==t&&(this.isTouch=/touch/.test(t.getViewport().className),this.setDefaultStyle())},ol.interaction.Transform.prototype.setActive=function(t){this.select(null),this.overlayLayer_.setVisible(t),ol.interaction.Pointer.prototype.setActive.call(this,t)},ol.interaction.Transform.prototype.setDefaultStyle=function(){var t=new ol.style.Stroke({color:[255,0,0,1],width:1}),e=new ol.style.Stroke({color:[255,0,0,1],width:1,lineDash:[4,4]}),o=new ol.style.Fill({color:[255,0,0,.01]}),i=new ol.style.Fill({color:[255,255,255,.8]}),r=new ol.style.RegularShape({fill:i,stroke:t,radius:this.isTouch?12:6,points:15});r.getAnchor()[0]=this.isTouch?-10:-5;var n=new ol.style.RegularShape({fill:i,stroke:t,radius:this.isTouch?16:8,points:4,angle:Math.PI/4}),s=new ol.style.RegularShape({fill:i,stroke:t,radius:this.isTouch?12:6,points:4,angle:Math.PI/4});function a(t,e,o){return[new ol.style.Style({image:t,stroke:e,fill:o})]}this.style={default:a(n,e,o),translate:a(n,t,i),rotate:a(r,t,i),rotate0:a(n,t,i),scale:a(n,t,i),scale1:a(n,t,i),scale2:a(n,t,i),scale3:a(n,t,i),scalev:a(s,t,i),scaleh1:a(s,t,i),scalev2:a(s,t,i),scaleh3:a(s,t,i)},this.drawSketch_()},ol.interaction.Transform.prototype.setStyle=function(t,e){if(e){e instanceof Array?this.style[t]=e:this.style[t]=[e];for(var o=0;o<this.style[t].length;o++){var i=this.style[t][o].getImage();i&&("rotate"==t&&(i.getAnchor()[0]=-5),this.isTouch&&i.setScale(1.8));var r=this.style[t][o].getText();r&&("rotate"==t&&r.setOffsetX(this.isTouch?14:7),this.isTouch&&r.setScale(1.8))}this.drawSketch_()}},ol.interaction.Transform.prototype.getFeatureAtPixel_=function(t){var e=this;return this.getMap().forEachFeatureAtPixel(t,function(t,o){var i=!1;if(!o){if(t===e.bbox_)return!1;if(e.handles_.forEach(function(e){e===t&&(i=!0)}),i)return{feature:t,handle:t.get("handle"),constraint:t.get("constraint"),option:t.get("option")}}if(!e.get("selection"))return e.selection_.some(function(e){return t===e})?{feature:t}:null;if(e._filter)return e._filter(t,o)?{feature:t}:null;if(e.layers_){for(var r=0;r<e.layers_.length;r++)if(e.layers_[r]===o)return{feature:t};return null}return e.features_?(e.features_.forEach(function(e){e===t&&(i=!0)}),i?{feature:t}:null):{feature:t}},{hitTolerance:this.get("hitTolerance")})||{}},ol.interaction.Transform.prototype.drawSketch_=function(t){var e,o,i;if(this.overlayLayer_.getSource().clear(),this.selection_.length){var r=this.selection_[0].getGeometry().getExtent();for(r=ol.extent.buffer(r,0),e=1;o=this.selection_[e];e++)ol.extent.extend(r,o.getGeometry().getExtent());if(!0===t)this.ispt_||(this.overlayLayer_.getSource().addFeature(new ol.Feature({geometry:new ol.geom.Point(this.center_),handle:"rotate0"})),i=ol.geom.Polygon.fromExtent(r),o=this.bbox_=new ol.Feature(i),this.overlayLayer_.getSource().addFeature(o));else{if(this.ispt_){var n=this.getMap().getPixelFromCoordinate([r[0],r[1]]);r=ol.extent.boundingExtent([this.getMap().getCoordinateFromPixel([n[0]-10,n[1]-10]),this.getMap().getCoordinateFromPixel([n[0]+10,n[1]+10])])}i=ol.geom.Polygon.fromExtent(r),o=this.bbox_=new ol.Feature(i);var s=[],a=i.getCoordinates()[0];if(!this.ispt_){if(s.push(o),this.get("stretch")&&this.get("scale"))for(e=0;e<a.length-1;e++)o=new ol.Feature({geometry:new ol.geom.Point([(a[e][0]+a[e+1][0])/2,(a[e][1]+a[e+1][1])/2]),handle:"scale",constraint:e%2?"h":"v",option:e}),s.push(o);if(this.get("scale"))for(e=0;e<a.length-1;e++)o=new ol.Feature({geometry:new ol.geom.Point(a[e]),handle:"scale",option:e}),s.push(o);this.get("translate")&&!this.get("translateFeature")&&(o=new ol.Feature({geometry:new ol.geom.Point([(a[0][0]+a[2][0])/2,(a[0][1]+a[2][1])/2]),handle:"translate"}),s.push(o))}this.get("rotate")&&(o=new ol.Feature({geometry:new ol.geom.Point(a[3]),handle:"rotate"}),s.push(o)),this.overlayLayer_.getSource().addFeatures(s)}}},ol.interaction.Transform.prototype.select=function(t,e){if(!t)return this.selection_=[],void this.drawSketch_();t.getGeometry&&t.getGeometry()&&(e?this.selection_.push(t):this.selection_=[t],this.ispt_=1===this.selection_.length&&"Point"==this.selection_[0].getGeometry().getType(),this.drawSketch_(),this.watchFeatures_(),this.dispatchEvent({type:"select",feature:t,features:this.selection_}))},ol.interaction.Transform.prototype.watchFeatures_=function(){this._featureListeners&&this._featureListeners.forEach(function(t){ol.Observable.unByKey(t)}),this._featureListeners=[],this.selection_.forEach(function(t){this._featureListeners.push(t.on("change",function(){this.drawSketch_()}.bind(this)))}.bind(this))},ol.interaction.Transform.prototype.handleDownEvent_=function(t){var e=this.getFeatureAtPixel_(t.pixel),o=e.feature;if(this.selection_.length&&this.selection_.indexOf(o)>=0&&(this.ispt_&&this.get("translate")||this.get("translateFeature"))&&(e.handle="translate"),e.handle){this.mode_=e.handle,this.opt_=e.option,this.constraint_=e.constraint,this.coordinate_=t.coordinate,this.pixel_=t.pixel,this.geoms_=[];for(var i,r=ol.extent.createEmpty(),n=0;i=this.selection_[n];n++)this.geoms_.push(i.getGeometry().clone()),r=ol.extent.extend(r,i.getGeometry().getExtent());if(this.extent_=ol.geom.Polygon.fromExtent(r).getCoordinates()[0],"rotate"===this.mode_){this.center_=this.getCenter()||ol.extent.getCenter(r);var s=t.map.getTargetElement();s.style.cursor=this.Cursors.rotate0,this.previousCursor_=s.style.cursor}else this.center_=ol.extent.getCenter(r);return this.angle_=Math.atan2(this.center_[1]-t.coordinate[1],this.center_[0]-t.coordinate[0]),this.dispatchEvent({type:this.mode_+"start",feature:this.selection_[0],features:this.selection_,pixel:t.pixel,coordinate:t.coordinate}),!0}if(this.get("selection")){if(o){this.addFn_(t)||(this.selection_=[]);var a=this.selection_.indexOf(o);a<0?this.selection_.push(o):this.selection_.splice(a,1)}else this.selection_=[];return this.ispt_=1===this.selection_.length&&"Point"==this.selection_[0].getGeometry().getType(),this.drawSketch_(),this.watchFeatures_(),this.dispatchEvent({type:"select",feature:o,features:this.selection_,pixel:t.pixel,coordinate:t.coordinate}),!1}},ol.interaction.Transform.prototype.getFeatures=function(){return this.selection_},ol.interaction.Transform.prototype.getCenter=function(){return this.get("center")},ol.interaction.Transform.prototype.setCenter=function(t){return this.set("center",t)},ol.interaction.Transform.prototype.handleDragEvent_=function(t){var e,o,i;switch(this.mode_){case"rotate":var r=Math.atan2(this.center_[1]-t.coordinate[1],this.center_[0]-t.coordinate[0]);if(!this.ispt)for(e=0;o=this.selection_[e];e++)(i=this.geoms_[e].clone()).rotate(r-this.angle_,this.center_),"Circle"==i.getType()&&i.setCenterAndRadius(i.getCenter(),i.getRadius()),o.setGeometry(i);this.drawSketch_(!0),this.dispatchEvent({type:"rotating",feature:this.selection_[0],features:this.selection_,angle:r-this.angle_,pixel:t.pixel,coordinate:t.coordinate});break;case"translate":var n=t.coordinate[0]-this.coordinate_[0],s=t.coordinate[1]-this.coordinate_[1];for(e=0;o=this.selection_[e];e++)o.getGeometry().translate(n,s);this.handles_.forEach(function(t){t.getGeometry().translate(n,s)}),this.coordinate_=t.coordinate,this.dispatchEvent({type:"translating",feature:this.selection_[0],features:this.selection_,delta:[n,s],pixel:t.pixel,coordinate:t.coordinate});break;case"scale":var a=this.center_;this.get("modifyCenter")(t)&&(a=this.extent_[(Number(this.opt_)+2)%4]);var l=(t.coordinate[0]-a[0])/(this.coordinate_[0]-a[0]),c=(t.coordinate[1]-a[1])/(this.coordinate_[1]-a[1]);for(this.get("noFlip")&&(l<0&&(l=-l),c<0&&(c=-c)),this.constraint_?"h"==this.constraint_?l=1:c=1:this.get("keepAspectRatio")(t)&&(l=c=Math.min(l,c)),e=0;o=this.selection_[e];e++)(i=this.geoms_[e].clone()).applyTransform(function(t,e,o){if(o<2)return e;for(var r=0;r<t.length;r+=o)1!=l&&(e[r]=a[0]+(t[r]-a[0])*l),1!=c&&(e[r+1]=a[1]+(t[r+1]-a[1])*c);return"Circle"==i.getType()&&i.setCenterAndRadius(i.getCenter(),i.getRadius()),e}),o.setGeometry(i);this.drawSketch_(),this.dispatchEvent({type:"scaling",feature:this.selection_[0],features:this.selection_,scale:[l,c],pixel:t.pixel,coordinate:t.coordinate})}},ol.interaction.Transform.prototype.handleMoveEvent_=function(t){if(!this.mode_){var e=this.getFeatureAtPixel_(t.pixel),o=t.map.getTargetElement();if(e.feature){var i=e.handle?this.Cursors[(e.handle||"default")+(e.constraint||"")+(e.option||"")]:this.Cursors.select;void 0===this.previousCursor_&&(this.previousCursor_=o.style.cursor),o.style.cursor=i}else void 0!==this.previousCursor_&&(o.style.cursor=this.previousCursor_),this.previousCursor_=void 0}},ol.interaction.Transform.prototype.handleUpEvent_=function(t){"rotate"===this.mode_&&(t.map.getTargetElement().style.cursor=this.Cursors.default,this.previousCursor_=void 0);return this.dispatchEvent({type:this.mode_+"end",feature:this.selection_[0],features:this.selection_,oldgeom:this.geoms_[0],oldgeoms:this.geoms_}),this.drawSketch_(),this.mode_=null,!1},ol.interaction.UndoRedo=function(t){t||(t={}),ol.interaction.Interaction.call(this,{handleEvent:function(){return!0}}),this._undoStack=[],this._redoStack=[],this._block=0,this._record=!0,this._defs={}},ol.ext.inherits(ol.interaction.UndoRedo,ol.interaction.Interaction),ol.interaction.UndoRedo.prototype.define=function(t,e,o){this._defs["_"+t]={undo:e,redo:o}},ol.interaction.UndoRedo.prototype.push=function(t,e){return!!this._defs["_"+t]&&(this._undoStack.push({type:"_"+t,prop:e}),!0)},ol.interaction.UndoRedo.prototype.setActive=function(t){ol.interaction.Interaction.prototype.setActive.call(this,t),this._record=t},ol.interaction.UndoRedo.prototype.setMap=function(t){ol.interaction.Interaction.prototype.setMap.call(this,t),this._watchSources(),this._watchInteractions()},ol.interaction.UndoRedo.prototype._watchSources=function(){var t=this.getMap();(this._sourceListener&&this._sourceListener.forEach(function(t){ol.Observable.unByKey(t)}),this._sourceListener=[],t)&&(function t(e,o){return o||(o=[]),e.forEach(function(e){e instanceof ol.layer.Vector?o.push(e):e.getLayers&&t(e.getLayers(),o)}),o}(t.getLayers()).forEach(function(t){var e=t.getSource();this._sourceListener.push(e.on(["addfeature","removefeature"],this._onAddRemove.bind(this))),this._sourceListener.push(e.on("clearstart",this.blockStart.bind(this))),this._sourceListener.push(e.on("clearend",this.blockEnd.bind(this)))}.bind(this)),this._sourceListener.push(t.getLayers().on(["add","remove"],this._watchSources.bind(this))))},ol.interaction.UndoRedo.prototype._watchInteractions=function(){var t=this.getMap();this._interactionListener&&this._interactionListener.forEach(function(t){ol.Observable.unByKey(t)}),this._interactionListener=[],t&&(t.getInteractions().forEach(function(t){this._interactionListener.push(t.on(["setattributestart","modifystart","rotatestart","translatestart","scalestart","deletestart","deleteend","beforesplit","aftersplit"],this._onInteraction.bind(this)))}.bind(this)),this._interactionListener.push(t.getInteractions().on(["add","remove"],this._watchInteractions.bind(this))))},ol.interaction.UndoRedo.prototype._onAddRemove=function(t){this._record&&(this._undoStack.push({type:t.type,source:t.target,feature:t.feature}),this._redoStack=[])},ol.interaction.UndoRedo.prototype._onInteraction=function(t){var e=this._onInteraction[t.type];e&&e.call(this,t)},ol.interaction.UndoRedo.prototype._onInteraction.setattributestart=function(t){this.blockStart();var e=Object.assign({},t.properties);t.features.forEach(function(t){var o={};for(var i in e)o[i]=t.get(i);this._undoStack.push({type:"changeattribute",feature:t,newProperties:e,oldProperties:o})}.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(t){this.blockStart(),t.features.forEach(function(t){this._undoStack.push({type:"changefeature",feature:t,oldFeature:t.clone()})}.bind(this)),this.blockEnd()},ol.interaction.UndoRedo.prototype.blockStart=function(){this._undoStack.push({type:"blockstart"}),this._redoStack=[]},ol.interaction.UndoRedo.prototype._onInteraction.beforesplit=ol.interaction.UndoRedo.prototype._onInteraction.deletestart=ol.interaction.UndoRedo.prototype.blockStart,ol.interaction.UndoRedo.prototype.blockEnd=function(){this._undoStack.push({type:"blockend"})},ol.interaction.UndoRedo.prototype._onInteraction.aftersplit=ol.interaction.UndoRedo.prototype._onInteraction.deleteend=ol.interaction.UndoRedo.prototype.blockEnd,ol.interaction.UndoRedo.prototype._handleDo=function(t,e){if(this.getActive()){switch(this._record=!1,t.type){case"addfeature":e?t.source.removeFeature(t.feature):t.source.addFeature(t.feature);break;case"removefeature":e?t.source.addFeature(t.feature):t.source.removeFeature(t.feature);break;case"changefeature":var o=t.feature.getGeometry();t.feature.setGeometry(t.oldFeature.getGeometry()),t.oldFeature.setGeometry(o);break;case"changeattribute":var i=t.newProperties,r=t.oldProperties;for(var n in r)void 0===r?t.feature.unset(n):t.feature.set(n,r[n]);t.oldProperties=i,t.newProperties=r;break;case"blockstart":this._block+=e?-1:1;break;case"blockend":this._block+=e?1:-1;break;default:this._defs[t.type]?e?this._defs[t.type].undo(t.prop):this._defs[t.type].redo(t.prop):console.warn('[UndoRedoInteraction]: "'+t.type.substr(1)+'" is not defined.')}this._block<0&&(this._block=0),this._block&&(e?this.undo():this.redo()),this._record=!0,this.dispatchEvent({type:e?"undo":"redo",action:t})}},ol.interaction.UndoRedo.prototype.undo=function(){var t=this._undoStack.pop();t&&(this._redoStack.push(t),this._handleDo(t,!0))},ol.interaction.UndoRedo.prototype.redo=function(){var t=this._redoStack.pop();t&&(this._undoStack.push(t),this._handleDo(t,!1))},ol.interaction.UndoRedo.prototype.clear=function(){this._undoStack=[],this._redoStack=[]},ol.interaction.UndoRedo.prototype.hasUndo=function(){return this._undoStack.length},ol.interaction.UndoRedo.prototype.hasRedo=function(){return this._redoStack.length},ol.source.BinBase=function(t){t=t||{},this._bindModify=this._onModifyFeature.bind(this),this._watch,ol.source.Vector.call(this,t),this._origin=t.source,this._listen=!1!==t.listenChange,this._geomFn=t.geometryFunction||ol.coordinate.getFeatureCenter||function(t){return t.getGeometry().getFirstCoordinate()},this.reset(),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 t.flatAttributes&&(this._flatAttributes=t.flatAttributes)},ol.ext.inherits(ol.source.BinBase,ol.source.Vector),ol.source.BinBase.prototype._onAddFeature=function(t,e,o){var i=t.feature||t.target;(e=e||this.getBinAt(this._geomFn(i),!0))&&e.get("features").push(i),this._listen&&!1!==o&&i.on("change",this._bindModify)},ol.source.BinBase.prototype._onRemoveFeature=function(t,e,o){if(this._watch){var i=t.feature||t.target;if(e=e||this.getBinAt(this._geomFn(i))){for(var r,n=e.get("features"),s=0;r=n[s];s++)if(r===i){n.splice(s,1);break}n.length||this.removeFeature(e)}this._listen&&!1!==o&&i.un("change",this._bindModify)}},ol.source.BinBase.prototype._onClearFeature=function(t){"clearstart"===t.type?(this._listen&&this._origin.getFeatures().forEach(function(t){t.un("change",this._bindModify)}.bind(this)),this.clear(),this._watch=!1):this._watch=!0},ol.source.BinBase.prototype.getBin=function(t){for(var e,o=this.getFeatures(),i=0;e=o[i];i++)for(var r,n=e.get("features"),s=0;r=n[s];s++)if(r===t)return e;return null},ol.source.BinBase.prototype.getGridGeomAt=function(t){return new ol.geom.Polygon([t])},ol.source.BinBase.prototype.getBinAt=function(t,e){var o={},i=this.getGridGeomAt(t,o);if(!i)return null;var r=i.getInteriorPoint?i.getInteriorPoint().getCoordinates():i.getInteriorPoints().getCoordinates()[0],n=this.getFeaturesAtCoordinate(r)[0];return!n&&e&&(o.geometry=i,o.features=[],o.center=r,n=new ol.Feature(o),this.addFeature(n)),n||null},ol.source.BinBase.prototype._onModifyFeature=function(t){var e=this.getBin(t.target),o=this.getBinAt(this._geomFn(t.target),"create");e!==o&&(e&&this._onRemoveFeature(t,e,!1),o&&this._onAddFeature(t,o,!1)),this.changed()},ol.source.BinBase.prototype.reset=function(){this.clear();for(var t,e=this._origin.getFeatures(),o=0;t=e[o];o++)this._onAddFeature({feature:t})},ol.source.BinBase.prototype.getGridFeatures=function(){var t=[];return this.getFeatures().forEach(function(e){var o=new ol.Feature(e.getGeometry().clone());for(var i in e.getProperties())"features"!==i&&"geometry"!==i&&o.set(i,e.get(i));o.set("nb",e.get("features").length),this._flatAttributes(o,e.get("features")),t.push(o)}.bind(this)),t},ol.source.BinBase.prototype._flatAttributes=function(){},ol.source.BinBase.prototype.getSource=function(){return this._origin},ol.source.DBPedia=function(t){var e=t||{};e.loader=this._loaderFn,this._url=e.url||"http://fr.dbpedia.org/sparql",this._maxResolution=e.maxResolution||100,this._lang=e.lang||"fr",this._limit=e.limit||1e3,e.attributions||(e.attributions=["© <a href='http://dbpedia.org/'>DBpedia</a> CC-by-SA"]),e.strategy||(e.strategy=ol.loadingstrategy.bbox),ol.source.Vector.call(this,e)},ol.ext.inherits(ol.source.DBPedia,ol.source.Vector),ol.source.DBPedia.prototype.readFeature=function(t,e,o){for(var i in e)"uri"===e[i].type&&(e[i].value=encodeURI(e[i].value)),t.set(i,e[i].value);return!o||o.get("subject")!=e.subject.value||(o.set("type",o.get("type")+"\n"+e.type.value),!1)},ol.source.DBPedia.prototype.querySubject=function(){return"?subject rdfs:label ?label. OPTIONAL {?subject dbpedia-owl:thumbnail ?thumbnail}.OPTIONAL {?subject dbpedia-owl:abstract ?abstract} . OPTIONAL {?subject rdf:type ?type}"},ol.source.DBPedia.prototype.queryFilter=function(){return"lang(?label) = '"+this._lang+"' && lang(?abstract) = '"+this._lang+"'"},ol.source.DBPedia.prototype._loaderFn=function(t,e,o){if(!(e>this._maxResolution)){var i=this,r=ol.proj.transformExtent(t,o,"EPSG:4326"),n="PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> SELECT DISTINCT * WHERE { ?subject geo:lat ?lat . ?subject geo:long ?long . "+this.querySubject()+" . FILTER("+this.queryFilter()+") . FILTER(xsd:float(?lat) <= "+r[3]+" && "+r[1]+" <= xsd:float(?lat) && xsd:float(?long) <= "+r[2]+" && "+r[0]+" <= xsd:float(?long) ) . } LIMIT "+this._limit;ol.ext.Ajax.get({url:this._url,data:{query:n,format:"json"},success:function(t){var e,r,n,s=t.results.bindings,a=[],l=null;for(var c in s)e=s[c],r=[Number(s[c].long.value),Number(s[c].lat.value)],n=new ol.Feature(new ol.geom.Point(ol.proj.transform(r,"EPSG:4326",o))),i.readFeature(n,e,l)&&(a.push(n),l=n);i.addFeatures(a)}})}},ol.style.clearDBPediaStyleCache,ol.style.dbPediaStyleFunction,function(){var t={};ol.style.clearDBPediaStyleCache=function(){t={}},ol.style.dbPediaStyleFunction=function(e){var o;switch(e||(e={}),typeof e.glyph){case"function":o=e.glyph;break;case"string":o=function(){return e.glyph};break;default:o=function(t){var e=t.get("type");if(e){if(e.match("/Museum"))return"fa-camera";if(e.match("/Monument"))return"fa-building";if(e.match("/Sculpture"))return"fa-android";if(e.match("/Religious"))return"fa-institution";if(e.match("/Castle"))return"fa-key";if(e.match("Water"))return"fa-tint";if(e.match("Island"))return"fa-leaf";if(e.match("/Event"))return"fa-heart";if(e.match("/Artwork"))return"fa-asterisk";if(e.match("/Stadium"))return"fa-futbol-o";if(e.match("/Place"))return"fa-street-view"}return"fa-star"}}var i=e.radius||8,r=e.fill||new ol.style.Fill({color:"navy"}),n=e.stroke||new ol.style.Stroke({color:"#fff",width:2}),s=e.prefix?e.prefix+"_":"";return function(e){var a=o(e),l=s+a,c=t[l];return c||(t[l]=c=new ol.style.Style({image:new ol.style.FontSymbol({glyph:a,radius:i,fill:r,stroke:n})})),[c]}}}(),ol.source.DFCI=function(t){(t=t||{}).loader=this._calcGrid,t.strategy=function(t,e){return this.resolution&&this.resolution!=e&&this.clear(),[t]},this._bbox=[[0,16e5],[11e5,26e5]],ol.source.Vector.call(this,t),this.set("resolutions",t.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)},ol.ext.inherits(ol.source.DFCI,ol.source.Vector),ol.source.DFCI.prototype._calcGrid=function(t,e,o){var i,r,n=this.get("resolutions");e>(n[0]||1e3)?this.resolution!=e&&(this._features0||(r=[this._bbox[0][0],this._bbox[0][1],this._bbox[1][0],this._bbox[1][1]],this._features0=this._getFeatures(0,r,o)),this.addFeatures(this._features0)):e>(n[1]||100)?(this.clear(),r=ol.proj.transformExtent(t,o,"EPSG:27572"),i=this._getFeatures(1,r,o),this.addFeatures(i)):e>(n[2]||0)?(this.clear(),r=ol.proj.transformExtent(t,o,"EPSG:27572"),i=this._getFeatures(2,r,o),this.addFeatures(i)):(this.clear(),r=ol.proj.transformExtent(t,o,"EPSG:27572"),i=this._getFeatures(3,r,o),this.addFeatures(i)),this.resolution=e},ol.source.DFCI.prototype._midPt=function(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]},ol.source.DFCI.prototype._trFeature=function(t,e,o,i){var r=new ol.geom.Polygon([t]),n=new ol.Feature(r.transform("EPSG:27572",i));return n.set("id",e),n.set("level",o),n},ol.source.DFCI.prototype._getFeatures=function(t,e,o){var i,r=[],n=1e5;t>0&&(n/=5),t>1&&(n/=10);for(var s=[Math.max(this._bbox[0][0],Math.floor(e[0]/n)*n),Math.max(this._bbox[0][1],Math.floor(e[1]/n)*n)],a=[Math.min(this._bbox[1][0]+99999,Math.floor(e[2]/n)*n),Math.min(this._bbox[1][1]+99999,Math.floor(e[3]/n)*n)],l=s[0];l<=a[0];l+=n)for(var c=s[1];c<=a[1];c+=n){var h,p=[[l,c],[l+n,c],[l+n,c+n],[l,c+n],[l,c]];if(t>2){var u=this._midPt(p[0],p[2]),d=[];for(i=0;i<p.length;i++)d.push(this._midPt(p[i],u));for(r.push(this._trFeature(d,ol.coordinate.toDFCI([l,c],2)+".5",t,o)),i=0;i<4;i++)(d=[]).push(p[i]),d.push(this._midPt(p[i],p[(i+1)%4])),d.push(this._midPt(u,d[1])),d.push(this._midPt(u,p[i])),h=this._midPt(p[i],p[(i+3)%4]),d.push(this._midPt(u,h)),d.push(h),d.push(p[i]),r.push(this._trFeature(d,ol.coordinate.toDFCI([l,c],2)+"."+(4-i),t,o))}else r.push(this._trFeature(p,ol.coordinate.toDFCI([l,c],t),t,o))}return r},ol.source.Delaunay=function(t){t=t||{},this._nodes=t.source,delete t.source,ol.source.Vector.call(this,t),this.hull=[],this._nodes.on("addfeature",this._onAddNode.bind(this)),this._nodes.on("removefeature",this._onRemoveNode.bind(this)),this.set("epsilon",t.epsilon||1e-4)},ol.ext.inherits(ol.source.Delaunay,ol.source.Vector),ol.source.Delaunay.prototype._addTriangle=function(t){var e=new ol.Feature(new ol.geom.Polygon([t]));return this.addFeature(e),this.flip.push(e),e},ol.source.Delaunay.prototype.getNodes=function(){return this._nodes.getFeatures()},ol.source.Delaunay.prototype.getNodeSource=function(){return this._nodes},ol.source.Delaunay.prototype._onRemoveNode=function(t){var e=t.feature.getGeometry().getCoordinates();if(e&&!this.getNodesAt(e).length){var o,i=this.getTrianglesAt(e);this.flip=[];for(var r=[];i.length;){var n=i.pop();this.removeFeature(n),n=n.getGeometry().getCoordinates()[0];var s=[];for(o=0;c=n[o];o++)ol.coordinate.equal(c,e)||s.push(c);r.push(s)}s=r.pop();var a="";for(r.forEach(function(t){a+=" - "+this.listpt(t)}.bind(this)),console.log("EDGES",a),o=0;;){var l=r[o];if(y(l[0],l[1],0)||y(l[1],l[0],0)||y(l[0],l[1],s.length-1)||y(l[1],l[0],s.length-1)?(r.splice(o,1),o=0):o++,!r.length)break;if(o>=r.length)throw console.log(this.listpt(s),this.listpt(r)),"[DELAUNAY:removePoint] No edge found"}console.log("PTS",this.listpt(s));var c,h=ol.coordinate.equal(s[0],s[s.length-1]);for(h&&s.pop();c=this.hull[o];o++)if(ol.coordinate.equal(e,c)){this.hull.splice(o,1);break}this.hull=ol.coordinate.convexHull(this.hull.concat(s));var p,u=function(t){for(var e,o=0,i=0;i<t.length;i++)o+=(t[e=(i+1)%t.length][0]-t[i][0])*(t[e][1]+t[i][1]);return console.log(o),o>=0?1:-1},d=s.slice();for(h?p=u(s):(console.log("ouvert",s,s.slice().push(e)),d.push(e),p=u(d)),console.log("S=",p,"CLOSED",h),console.log("E=",this.listpt(d)),o=0;o<=s.length+1&&!(s.length<3);o++){var g=[s[o%s.length],s[(o+1)%s.length],s[(o+2)%s.length]];if(u(g)===p){for(var f=!0,m=o+3;m<o+s.length;m++)if(console.log("test "+m,this.listpt([s[m%s.length]])),this.inCircle(s[m%s.length],g)){f=!1;break}f&&(console.log(this.listpt(g),"ok"),this._addTriangle(g),s.splice((o+1)%s.length,1),o=-1)}else console.log(this.listpt(g),"nok")}this.flipTriangles()}function y(t,e,o){return!!ol.coordinate.equal(t,s[o])&&(o?s.push(e):s.unshift(e),!0)}},ol.source.Delaunay.prototype._onAddNode=function(t){var e,o,i=t.feature;if("Point"===i.getGeometry().getType()){this.flip=[];var r=this.getNodes(),n=i.getGeometry().getCoordinates();if(this.getNodesAt(n).length>1)return console.log("remove duplicated points"),void this._nodes.removeFeature(i);if(r.length<=3){if(3===r.length){var s=[];for(e=0;e<3;e++)s.push(r[e].getGeometry().getCoordinates());this._addTriangle(s),this.hull=ol.coordinate.convexHull(s)}}else{var a=this.getFeaturesAtCoordinate(n)[0];if(a){this.removeFeature(a),a.set("del",!0);var l=a.getGeometry().getCoordinates()[0];for(e=0;e<3;e++)this._addTriangle([n,l[e],l[(e+1)%3]])}else{var c=this.hull.slice();for(c.push(n),c=ol.coordinate.convexHull(c),e=0;(o=c[e])&&!ol.coordinate.equal(o,n);e++);var h=c[e=0!==e?e-1:c.length-1],p=c[(e+2)%c.length];for(e=0;(o=this.hull[e])&&!ol.coordinate.equal(o,h);e++);for(;;){if(e>1e3){console.error("[DELAUNAY:addPoint] Too many iterations");break}if(e++,o=this.hull[e%this.hull.length],this._addTriangle([n,o,h]),h=o,o[0]===p[0]&&o[1]===p[1])break}this.hull=c}this.flipTriangles()}}else this._nodes.removeFeature(i)};ol.source.Delaunay.prototype.flipTriangles=function(){for(var t,e=1e3;this.flip.length;){if(e--<0){console.error("[DELAUNAY:flipTriangles] Too many iterations");break}var o=this.flip.pop();if(!o.get("del"))for(var i=o.getGeometry().getCoordinates()[0],r=0;r<3;r++){var n=[(i[(r+1)%3][0]+i[r][0])/2,(i[(r+1)%3][1]+i[r][1])/2],s=this.getTrianglesAt(n),a=null;if(s.length>1){var l=s[0].getGeometry().getCoordinates()[0],c=s[1].getGeometry().getCoordinates()[0];for(t=0;t<c.length;t++)if(!this._ptInTriangle(c[t],l)){a=c[t];break}}if(a&&this.inCircle(a,l)){var h;for(t=0;t<l.length;t++)if(!this._ptInTriangle(l[t],c)){h=l.splice(t,1)[0];break}if(this.intersectSegs([a,h],l)){for(;s.length;){var p=s.pop();p.set("del",!0),this.removeFeature(p)}this._addTriangle([a,h,l[0]]),this._addTriangle([a,h,l[1]])}}}}},ol.source.Delaunay.prototype.intersectSegs=function(t,e){var o=t[1][0]-t[0][0],i=t[1][1]-t[0][1],r=e[1][0]-e[0][0],n=o*(e[1][1]-e[0][1])-i*r;if(0!=n){var s=(o*t[0][1]-o*e[0][1]-i*t[0][0]+i*e[0][0])/n;return 0<s&&s<1}return!1},ol.source.Delaunay.prototype._ptInTriangle=function(t,e){for(var o,i=0;o=e[i];i++)if(ol.coordinate.equal(t,o))return!0;return!1},ol.source.Delaunay.prototype.listpt=function(t){for(var e,o="",i=0;e=t[i];i++){var r=this._nodes.getClosestFeatureToCoordinate(e);ol.coordinate.equal(r.getGeometry().getCoordinates(),e)||(r=null),o+=(o?", ":"")+(r?r.get("id"):"?")}return o},ol.source.Delaunay.prototype.inCircle=function(t,e){var o=this.getCircumCircle(e);return ol.coordinate.dist2d(t,o.center)<o.radius},ol.source.Delaunay.prototype.getCircumCircle=function(t){var e=t[0][0],o=t[0][1],i=t[1][0],r=t[1][1],n=t[2][0],s=t[2][1],a=(e-i)/(r-o),l=(e-n)/(s-o),c=(o+r)/2-a*(e+i)/2,h=((o+s)/2-l*(e+n)/2-c)/(a-l),p=[h,a*h+c];return{center:p,radius:ol.coordinate.dist2d(p,t[0])}},ol.source.Delaunay.prototype.getTrianglesAt=function(t){var e=ol.extent.buffer(ol.extent.boundingExtent([t]),this.get("epsilon")),o=[];return this.forEachFeatureIntersectingExtent(e,function(t){o.push(t)}),o},ol.source.Delaunay.prototype.getNodesAt=function(t){var e=ol.extent.buffer(ol.extent.boundingExtent([t]),this.get("epsilon"));return this._nodes.getFeaturesInExtent(e)},ol.source.FeatureBin=function(t){t=t||{},this._sourceFeature=new ol.source.Vector({features:t.features||[]}),ol.source.BinBase.call(this,t)},ol.ext.inherits(ol.source.FeatureBin,ol.source.BinBase),ol.source.FeatureBin.prototype.setFeatures=function(t){this._sourceFeature.clear(),this._sourceFeature.addFeatures(t||[]),this.reset()},ol.source.FeatureBin.prototype.getGridGeomAt=function(t,e){var o=this._sourceFeature.getFeaturesAtCoordinate(t)[0];if(!o)return null;var i=o.getProperties();for(var r in i)"geometry"!==r&&(e[r]=i[r]);return o.getGeometry()},ol.source.GeoImage=function(t){var e={attributions:t.attributions,logo:t.logo,projection:t.projection};this.center=t.imageCenter,this.scale=t.imageScale,this.rotate=t.imageRotate?t.imageRotate:0,this.crop=t.imageCrop,this.mask=t.imageMask,this._image=t.image?t.image:new Image,this._image.crossOrigin=t.crossOrigin;var o=this;this._image.onload=function(){o.setCrop(o.crop),o.changed()},t.image||(this._image.src=t.url),e.canvasFunction=function(t,e,o,i){var r=document.createElement("canvas");r.width=i[0],r.height=i[1];var n=r.getContext("2d");if(!this._imageSize)return r;function s(e){return[(e[0]-t[0])/(t[2]-t[0])*i[0],(e[1]-t[3])/(t[1]-t[3])*i[1]]}if(this.mask){n.beginPath();var a=s(this.mask[0]);n.moveTo(a[0],a[1]);for(var l=1;l<this.mask.length;l++)a=s(this.mask[l]),n.lineTo(a[0],a[1]);n.clip()}var c=s(this.center),h=(this._image.naturalWidth/2-this.crop[0])*this.scale[0]/e*o,p=(this._image.naturalHeight/2-this.crop[1])*this.scale[1]/e*o,u=this._imageSize[0]*this.scale[0]/e*o,d=this._imageSize[1]*this.scale[1]/e*o;return n.translate(c[0],c[1]),this.rotate&&n.rotate(this.rotate),n.drawImage(this._image,this.crop[0],this.crop[1],this._imageSize[0],this._imageSize[1],-h,-p,u,d),r},ol.source.ImageCanvas.call(this,e),this.setCrop(this.crop)},ol.ext.inherits(ol.source.GeoImage,ol.source.ImageCanvas),ol.source.GeoImage.prototype.getCenter=function(){return this.center},ol.source.GeoImage.prototype.setCenter=function(t){this.center=t,this.changed()},ol.source.GeoImage.prototype.getScale=function(){return this.scale},ol.source.GeoImage.prototype.setScale=function(t){switch(typeof t){case"number":t=[t,t];break;case"object":if(2!=t.length)return;break;default:return}this.scale=t,this.changed()},ol.source.GeoImage.prototype.getRotation=function(){return this.rotate},ol.source.GeoImage.prototype.setRotation=function(t){this.rotate=t,this.changed()},ol.source.GeoImage.prototype.getGeoImage=function(){return this._image},ol.source.GeoImage.prototype.getCrop=function(){return this.crop},ol.source.GeoImage.prototype.setMask=function(t){this.mask=t,this.changed()},ol.source.GeoImage.prototype.getMask=function(){return this.mask},ol.source.GeoImage.prototype.setCrop=function(t){if(this._image.naturalWidth){if(t){switch(typeof t){case"number":t=[t,t,this._image.naturalWidth-t,this._image.naturalHeight-t];break;case"object":if(4!=t.length)return;break;default:return}t=ol.extent.boundingExtent([[t[0],t[1]],[t[2],t[3]]]),this.crop=[Math.max(0,t[0]),Math.max(0,t[1]),Math.min(this._image.naturalWidth,t[2]),Math.min(this._image.naturalHeight,t[3])]}else this.crop=[0,0,this._image.naturalWidth,this._image.naturalHeight];this.crop[2]<=this.crop[0]&&(this.crop[2]=this.crop[0]+1),this.crop[3]<=this.crop[1]&&(this.crop[3]=this.crop[1]+1),this._imageSize=[this.crop[2]-this.crop[0],this.crop[3]-this.crop[1]],this.changed()}else this.crop=t},ol.source.GridBin=function(t){t=t||{},ol.source.BinBase.call(this,t),this.set("gridProjection",t.gridProjection||"EPSG:4326"),this.set("size",t.size||1)},ol.ext.inherits(ol.source.GridBin,ol.source.BinBase),ol.source.GridBin.prototype.setGridProjection=function(t){this.set("gridProjection",t),this.reset()},ol.source.GridBin.prototype.setSize=function(t){this.set("size",t),this.reset()},ol.source.GridBin.prototype.getGridGeomAt=function(t){t=ol.proj.transform(t,this.getProjection()||"EPSG:3857",this.get("gridProjection"));var e=this.get("size"),o=e*Math.floor(t[0]/e),i=e*Math.floor(t[1]/e);return new ol.geom.Polygon([[[o,i],[o+e,i],[o+e,i+e],[o,i+e],[o,i]]]).transform(this.get("gridProjection"),this.getProjection()||"EPSG:3857")},ol.source.HexBin=function(t){t=t||{},this._hexgrid=new ol.HexGrid(t),ol.source.BinBase.call(this,t)},ol.ext.inherits(ol.source.HexBin,ol.source.BinBase),ol.source.HexBin.prototype.getGridGeomAt=function(t){var e=this._hexgrid.coord2hex(t);return new ol.geom.Polygon([this._hexgrid.getHexagon(e)])},ol.source.HexBin.prototype.setSize=function(t,e){this._hexgrid.setSize(t),e||this.reset()},ol.source.HexBin.prototype.getSize=function(){return this._hexgrid.getSize()},ol.source.HexBin.prototype.setLayout=function(t,e){this._hexgrid.setLayout(t),e||this.reset()},ol.source.HexBin.prototype.getLayout=function(){return this._hexgrid.getLayout()},ol.source.HexBin.prototype.setOrigin=function(t,e){this._hexgrid.setOrigin(t),e||this.reset()},ol.source.HexBin.prototype.getOrigin=function(){return this._hexgrid.getOrigin()},ol.source.HexBin.prototype.getHexFeatures=function(){return ol.source.BinBase.prototype.getGridFeatures.call(this)},ol.source.InseeBin=function(t){t=t||{},this._grid=new ol.InseeGrid({size:t.size}),ol.source.BinBase.call(this,t)},ol.ext.inherits(ol.source.InseeBin,ol.source.BinBase),ol.source.InseeBin.prototype.setSize=function(t){this.getSize()!==t&&(this._grid.set("size",t),this.reset())},ol.source.InseeBin.prototype.getSize=function(){return this._grid.get("size")},ol.source.InseeBin.prototype.getGridGeomAt=function(t){return this._grid.getGridAtCoordinate(t,this.getProjection())},ol.source.InseeBin.prototype.getGridExtent=function(t){return this._grid.getExtent(t)},ol.source.Mapillary=function(t){var e=t||{};e.loader=this._loaderFn,this._maxResolution=e.maxResolution||100,this._limit=e.limit||100,e.attributions||(e.attributions=["© <a href='https://www.mapillary.com/'>Mapillary</a>"]),e.strategy||(e.strategy=ol.loadingstrategy.bbox),ol.source.Vector.call(this,e)},ol.ext.inherits(ol.source.Mapillary,ol.source.Vector),ol.source.Mapillary.prototype.readFeature=function(){return!0},ol.source.Mapillary.prototype._loaderFn=function(t,e,o){if(!(e>this._maxResolution)){var i=ol.proj.transformExtent(t,o,"EPSG:4326"),r=Date.now()-15552e6,n="https://a.mapillary.com/v2/search/im?client_id="+this.get("clientId")+"&max_lat="+i[3]+"&max_lon="+i[2]+"&min_lat="+i[1]+"&min_lon="+i[0]+"&limit="+(this._limit-1)+"&start_time="+r;ol.ext.Ajax.get({url:n,dataType:"jsonp",success:function(t){console.log(t)}})}},ol.source.Overpass=function(t){(t=t||{}).loader=this._loaderFn,this._url=t.url||"https://overpass-api.de/api/interpreter",this._maxResolution=t.maxResolution||100,t.attributions||(t.attributions=ol.source.OSM.ATTRIBUTION),t.strategy||(t.strategy=ol.loadingstrategy.bbox),ol.source.Vector.call(this,t),this._types={node:!1!==t.node,way:!1!==t.way,rel:!0===t.rel},this._filter=t.filter},ol.ext.inherits(ol.source.Overpass,ol.source.Vector),ol.source.Overpass.prototype._loaderFn=function(t,e,o){if(!(e>this._maxResolution)){var i=this,r=ol.proj.transformExtent(t,o,"EPSG:4326"),n="[bbox:"+(r=r[1]+","+r[0]+","+r[3]+","+r[2])+"][out:xml][timeout:25];";for(var s in n+="(",this._types)if(this._types[s]){n+=s;for(var a,l=0;a=this._filter[l];l++)n+="["+a+"]";n+=";"}n+=");out;>;out skel qt;";var c=new XMLHttpRequest;c.open("POST",this._url,!0),c.onload=function(){for(var t,e=(new ol.format.OSMXML).readFeatures(this.responseText,{featureProjection:o}),r=[],n=0;t=e[n];n++)i.hasFeature(t)||r.push(t);i.addFeatures(r)},c.onerror=function(){console.log(arguments)},c.send("data="+n)}},ol.source.Overpass.prototype.hasFeature=function(t){for(var e,o=t.getGeometry().getFirstCoordinate(),i=t.getId(),r=this.getFeaturesInExtent([o[0]-.1,o[1]-.1,o[0]+.1,o[1]+.1]),n=0;e=r[n];n++)if(i===e.getId())return!0;return!1},function(){var t=ol.source.Vector.prototype.clear;ol.source.Vector.prototype.clear=function(e){this.dispatchEvent({type:"clearstart"}),t.call(this,e),this.dispatchEvent({type:"clearend"})}}(),ol.source.WikiCommons=function(t){var e=t||{};e.loader=this._loaderFn,this._maxResolution=e.maxResolution||100,this._lang=e.lang||"fr",this._limit=e.limit||100,e.attributions||(e.attributions=["© <a href='https://commons.wikimedia.org/'>Wikimedia Commons</a>"]),e.strategy||(e.strategy=ol.loadingstrategy.bbox),ol.source.Vector.call(this,e)},ol.ext.inherits(ol.source.WikiCommons,ol.source.Vector),ol.source.WikiCommons.prototype.readFeature=function(t,e){return t.set("descriptionurl",e.descriptionurl),t.set("url",e.url),t.set("title",e.title.replace(/^file:|.jpg$/gi,"")),t.set("thumbnail",e.url.replace(/^(.+wikipedia\/commons)\/([a-zA-Z0-9]\/[a-zA-Z0-9]{2})\/(.+)$/,"$1/thumb/$2/$3/200px-$3")),t.set("user",e.user),e.extmetadata&&e.extmetadata.LicenseShortName&&t.set("copy",e.extmetadata.LicenseShortName.value),!0},ol.source.WikiCommons.prototype._loaderFn=function(t,e,o){if(!(e>this._maxResolution)){var i=this,r=ol.proj.transformExtent(t,o,"EPSG:4326"),n="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="+r[3]+"|"+r[0]+"|"+r[1]+"|"+r[2]+"&ggslimit="+this._limit+"&iilimit="+(this._limit-1)+"&ggsnamespace=6";ol.ext.Ajax.get({url:n,success:function(t){var e,r,n,s=[];if(t.query&&t.query.pages){for(var a in t.query.pages){if((e=t.query.pages[a]).coordinates&&e.coordinates.length)r=[e.coordinates[0].lon,e.coordinates[0].lat];else{var l=e.imageinfo[0].metadata;if(!l)continue;r=[];for(var c=0,h=0;h<l.length;h++)"GPSLongitude"==l[h].name&&(r[0]=l[h].value,c++),"GPSLatitude"==l[h].name&&(r[1]=l[h].value,c++);if(2!=c)continue}n=new ol.Feature(new ol.geom.Point(ol.proj.transform(r,"EPSG:4326",o))),e.imageinfo[0].title=e.title,i.readFeature(n,e.imageinfo[0])&&s.push(n)}i.addFeatures(s)}}})}},ol.layer.AnimatedCluster=function(t){var e=t||{};ol.layer.Vector.call(this,e),this.oldcluster=new ol.source.Vector,this.clusters=[],this.animation={start:!1},this.set("animationDuration","number"==typeof e.animationDuration?e.animationDuration:700),this.set("animationMethod",e.animationMethod||ol.easing.easeOut),this.getSource().on("change",this.saveCluster.bind(this)),this.on(["precompose","prerender"],this.animate.bind(this)),this.on(["postcompose","postrender"],this.postanimate.bind(this))},ol.ext.inherits(ol.layer.AnimatedCluster,ol.layer.Vector),ol.layer.AnimatedCluster.prototype.saveCluster=function(){if(this.oldcluster){if(this.oldcluster.clear(),!this.get("animationDuration"))return;var t=this.getSource().getFeatures();t.length&&t[0].get("features")&&(this.oldcluster.addFeatures(this.clusters),this.clusters=t.slice(0),this.sourceChanged=!0)}},ol.layer.AnimatedCluster.prototype.getClusterForFeature=function(t,e){for(var o,i=0;o=e[i];i++){var r=o.get("features");if(r&&r.length)for(var n,s=0;n=r[s];s++)if(t===n)return o}return!1},ol.layer.AnimatedCluster.prototype.stopAnimation=function(){this.animation.start=!1,this.animation.cA=[],this.animation.cB=[]},ol.layer.AnimatedCluster.prototype.animate=function(t){var e=this.get("animationDuration");if(e){var o,i,r=t.frameState.viewState.resolution,n=this.animation,s=t.frameState.time;if(n.resolution!=r&&this.sourceChanged){var a=t.frameState.extent;for(n.resolution<r?(a=ol.extent.buffer(a,100*r),n.cA=this.oldcluster.getFeaturesInExtent(a),n.cB=this.getSource().getFeaturesInExtent(a),n.revers=!1):(a=ol.extent.buffer(a,100*r),n.cA=this.getSource().getFeaturesInExtent(a),n.cB=this.oldcluster.getFeaturesInExtent(a),n.revers=!0),n.clusters=[],o=0;i=n.cA[o];o++){var l=i.get("features");if(l&&l.length){var c=this.getClusterForFeature(l[0],n.cB);c&&n.clusters.push({f:i,pt:c.getGeometry().getCoordinates()})}}if(n.resolution=r,this.sourceChanged=!1,!n.clusters.length||n.clusters.length>1e3)return void this.stopAnimation();s=n.start=(new Date).getTime()}if(n.start){var h=t.vectorContext||ol.render.getVectorContext(t),p=(s-n.start)/e;p>1&&(this.stopAnimation(),p=1),p=this.get("animationMethod")(p);var u=this.getStyle(),d="function"==typeof u?u:u.length?function(){return u}:function(){return[u]};t.context.save(),t.context.globalAlpha=this.getOpacity();var g=t.frameState.pixelRatio;for(o=0;c=n.clusters[o];o++){var f=c.f.getGeometry().getCoordinates(),m=f[0]-c.pt[0],y=f[1]-c.pt[1];n.revers?(f[0]=c.pt[0]+p*m,f[1]=c.pt[1]+p*y):(f[0]=f[0]-p*m,f[1]=f[1]-p*y);for(var v,_=d(c.f,r,!0),w=new ol.geom.Point(f),x=0;v=_[x];x++){var S,b=!ol.Map.prototype.getFeaturesAtPixel&&v.getImage();b&&(S=b.getScale(),b.setScale(S*g)),h.setStyle?1!==c.f.get("features").length||m||y?(h.setStyle(v),h.drawGeometry(w)):h.drawFeature(c.f.get("features")[0],v):(h.setImageStyle(b),h.setTextStyle(v.getText()),h.drawPointGeometry(w)),b&&b.setScale(S)}}t.context.restore(),t.frameState.animate=!0,t.context.save(),t.context.beginPath(),t.context.rect(0,0,0,0),t.context.clip(),this.clip_=!0}}},ol.layer.AnimatedCluster.prototype.postanimate=function(t){this.clip_&&(t.context.restore(),this.clip_=!1)},ol.source.Source.prototype.getPreview=function(){return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAk6QAAJOkBUCTn+AAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAANeSURBVHic7ZpPiE1RHMc/780MBhkik79JSUlIUbOxI+wkI2yRhYSUlJLNpJF/xcpiJBmZGBZsNM1CkmhKITGkGbH0/BuPmXnP4rxbb/TOn3fvOffeec6nfqvb/b7f93fveeec37ng8Xg8Ho/nf6Uu4d+fDswFssCvhHOJhaXAMeApMAQUyyIPPAdOAiuTStAVy4EHjDWsix5gdRLJ2mY34ulWYz6IEeA4kIk9awtkgTOEM/5vdAKT4k0/Ou3YMR/ELcbRm9AKFLBbgCJwNE4TYZkJfMG++SIwDCyLz0o4bI17WdyJz0r1TAZ+oDcxCBwAFgIzEIuhvcBbg3sLwOK4DFXLFvQGniCGSSUagS4DjUPOHESkA3XiOWCORqMR6Nfo9DjI3QqPUSd+ylBnv0Zn0GrWFvmIOvGNhjqrNDp/EAutyFgRKUM2tgO+Gur81FxvAKYZaimxXYBvmuuLDHWWaK4X0RfJCNsF6NdcbzXU2a65PohYFKWOc+jn8PUajbWIXaBKp9NB7lZYh34OzwFbFfd/NtDYYSth27urLGIm0M31AL3APWAAmIooymaDnPIl/Vz4NN1yHrd7gcvxWQnHAuA3bsyPop8hUsE13BSgK04TUViBeFo2zedJ8S6wElexW4D2eNOPTjNi6WvD/DtEr8E6tk6GGoAmxFY2iFHE9NZiQf8gogiB9gTEH23izAZuE77vHyU+ANucO1QwD3hD/MbLowAcdm20EmkwXx4n3NodS9rMB2HabYpEWs0HcRqHp0fNwAvJD+eBTZr7p6BvmQVxUaEzEbiruNfJekH15L8jtrEm7JJolEcOmKXRqQOuKDQuY7HZY8s8iNfzkSLxIuI43FTrkkLnOlBfRW4VsWk+oAX5weknxFAxJQNckGgVgZuIRVoomoGXEmGTMa+iQ6K7M4SW7k24QYgiuDQPYinbhugiF4H3RGtzZYCzyIvQXfpNI1ybLyeLpf5+iTbkRbiP2EcocTHm4+YI8iI8RFHwWjAfsA95Q+YZFU6wasl8wB7kReijtNbIILa0vcg/PRlGfPQwHmlCviDqAzaA+OREtzqr1ejOIDorxlNEjTGUBV4nnUWCvAJxGDlA8q9j3DEArAn2zvXAfOwfl6eVAmJrPpJ0Ih6Px+PxeJLjLwPul3vj5d0eAAAAAElFTkSuQmCC"},ol.source.Tile.prototype.getPreview=function(t,e){t||(t=[21020,6355964]),e||(e=150);var o=this.getTileGrid().getTileCoordForCoordAndResolution(t,e);return this.getTileUrlFunction().call(this,o,this.getProjection())},ol.source.TileWMS.prototype.getPreview=function(t,e){t||(t=[21020,6355964]),e||(e=150);var o=this.getGetFeatureInfoUrl(t,e,this.getProjection()||"EPSG:3857",{});return o=o.replace(/getfeatureinfo/i,"GetMap")},ol.layer.Base.prototype.getPreview=function(t,e){if(this.get("preview"))return[this.get("preview")];if(e||(e=150),e<this.getMinResolution()||e>this.getMaxResolution()){var o=this.getMinResolution(),i=this.getMaxResolution();for(i>1e5&&(i=156543),o<.15&&(o=.15),e=i;i>o;)i/=2,e=o*=2}var r=this.getExtent();return t||(t=[21020,6355964]),r&&!ol.extent.containsCoordinate(r,t)&&(t=[(r[0]+r[2])/2,(r[1]+r[3])/2]),this.getSource?[this.getSource().getPreview(t,e)]:[]},ol.layer.Group.prototype.getPreview=function(t,e){if(this.get("preview"))return[this.get("preview")];var o=[];if(this.getLayers)for(var i=this.getLayers().getArray(),r=0;r<i.length;r++)o=o.concat(i[r].getPreview(t,e));return o},ol.layer.Vector.prototype.setRender3D=function(t){t.setLayer(this)},ol.render3D=function(t){t=t||{},this.maxResolution_=t.maxResolution||100,this.defaultHeight_=t.defaultHeight||0,this.height_=this.getHfn(t.height)},ol.render3D.prototype.onPostcompose_=function(t){var e=t.frameState.viewState.resolution;if(!(e>this.maxResolution_)){if(this.res_=400*e,this.animate_){var o=t.frameState.time-this.animate_;o<this.animateDuration_?(this.elapsedRatio_=this.easing_(o/this.animateDuration_),t.frameState.animate=!0):(this.animate_=!1,this.height_=this.toHeight_)}var i=t.frameState.pixelRatio,r=t.context,n=this.matrix_=t.frameState.coordinateToPixelTransform;n||((n=t.frameState.coordinateToPixelMatrix)[2]=n[4],n[3]=n[5],n[4]=n[12],n[5]=n[13]),this.center_=[r.canvas.width/2/i,r.canvas.height/i];var s=this.layer_.getSource().getFeaturesInExtent(t.frameState.extent);r.save(),r.scale(i,i),r.lineWidth=1,r.strokeStyle="red",r.fillStyle="rgba(0,0,255,0.5)";for(var a=[],l=0;l<s.length;l++)a.push(this.getFeature3D_(s[l],this.getFeatureHeight(s[l])));this.drawFeature3D_(r,a),r.restore()}},ol.render3D.prototype.setLayer=function(t){this._listener&&this._listener.forEach(function(t){ol.Observable.unByKey(t)}),this.layer_=t,this._listener=t.on(["postcompose","postrender"],this.onPostcompose_.bind(this))},ol.render3D.prototype.getHfn=function(t){switch(typeof t){case"function":return t;case"string":var e=this.defaultHeight_;return function(o){return Number(o.get(t))||e};case"number":return function(){return t};default:return function(){return 10}}},ol.render3D.prototype.animate=function(t){t=t||{},this.toHeight_=this.getHfn(t.height),this.animate_=(new Date).getTime(),this.animateDuration_=t.duration||1e3,this.easing_=t.easing||ol.easing.easeOut,this.layer_.changed()},ol.render3D.prototype.animating=function(){return this.animate_&&(new Date).getTime()-this.animate_>this.animateDuration_&&(this.animate_=!1),!!this.animate_},ol.render3D.prototype.getFeatureHeight=function(t){if(this.animate_){var e=this.height_(t),o=this.toHeight_(t);return e*(1-this.elapsedRatio_)+this.elapsedRatio_*o}return this.height_(t)},ol.render3D.prototype.hvector_=function(t,e){var o=[t[0]*this.matrix_[0]+t[1]*this.matrix_[1]+this.matrix_[4],t[0]*this.matrix_[2]+t[1]*this.matrix_[3]+this.matrix_[5]];return{p0:o,p1:[o[0]+e/this.res_*(o[0]-this.center_[0]),o[1]+e/this.res_*(o[1]-this.center_[1])]}},ol.render3D.prototype.getFeature3D_=function(t,e){var o=t.getGeometry().getCoordinates();switch(t.getGeometry().getType()){case"Polygon":o=[o];case"MultiPolygon":for(var i=[],r=0;r<o.length;r++)for(var n=0;n<o[r].length;n++){for(var s=[],a=0;a<o[r][n].length;a++)s.push(this.hvector_(o[r][n][a],e));i.push(s)}return{type:"MultiPolygon",feature:t,geom:i};case"Point":return{type:"Point",feature:t,geom:this.hvector_(o,e)};default:return{}}},ol.render3D.prototype.drawFeature3D_=function(t,e){var o,i,r,n;for(o=0;o<e.length;o++)switch(e[o].type){case"MultiPolygon":for(i=0;i<e[o].geom.length;i++)for(r=e[o].geom[i],n=0;n<r.length;n++)t.beginPath(),t.moveTo(r[n].p0[0],r[n].p0[1]),t.lineTo(r[n].p1[0],r[n].p1[1]),t.stroke();break;case"Point":var s=e[o].geom;t.beginPath(),t.moveTo(s.p0[0],s.p0[1]),t.lineTo(s.p1[0],s.p1[1]),t.stroke()}for(o=0;o<e.length;o++)switch(e[o].type){case"MultiPolygon":for(t.beginPath(),i=0;i<e[o].geom.length;i++){if(r=e[o].geom[i],0==i)for(t.moveTo(r[0].p1[0],r[0].p1[1]),n=1;n<r.length;n++)t.lineTo(r[n].p1[0],r[n].p1[1]);else for(t.moveTo(r[0].p1[0],r[0].p1[1]),n=r.length-2;n>=0;n--)t.lineTo(r[n].p1[0],r[n].p1[1]);t.closePath()}t.fill("evenodd"),t.stroke();break;case"Point":var a=(r=e[o]).feature.get("label"),l=r.geom.p1,c=t.fillStyle;t.fillStyle=t.strokeStyle,t.textAlign="center",t.textBaseline="bottom",t.fillText(a,l[0],l[1]);var h=t.measureText(a),p=Number(t.font.match(/\d+(\.\d+)?/g).join([]));t.fillStyle="rgba(255,255,255,0.5)",t.fillRect(l[0]-h.width/2-5,l[1]-p-5,h.width+10,p+10),t.strokeRect(l[0]-h.width/2-5,l[1]-p-5,h.width+10,p+10),t.fillStyle=c}},ol.Overlay.Popup=function(t){var e=this;"number"==typeof(t=t||{}).offsetBox?this.offsetBox=[t.offsetBox,t.offsetBox,t.offsetBox,t.offsetBox]:this.offsetBox=t.offsetBox;var o=document.createElement("div");t.element=o;var i=document.createElement("div");i.classList.add("anchor"),o.appendChild(i),this.content=ol.ext.element.create("div",{html:t.html||"",className:"ol-popup-content",parent:o}),this.closeBox=t.closeBox,this.onclose=t.onclose,this.onshow=t.onshow;var r=document.createElement("button");r.classList.add("closeBox"),t.closeBox&&r.classList.add("hasclosebox"),r.setAttribute("type","button"),o.insertBefore(r,i),r.addEventListener("click",function(){e.hide()}),t.stopEvent&&(o.addEventListener("mousedown",function(t){t.stopPropagation()}),o.addEventListener("touchstart",function(t){t.stopPropagation()})),ol.Overlay.call(this,t),this._elt=this.element,this.setPositioning(t.positioning||"auto"),this.setPopupClass(t.popupClass||t.className||"default"),t.position&&setTimeout(function(){this.show(t.position)}.bind(this))},ol.ext.inherits(ol.Overlay.Popup,ol.Overlay),ol.Overlay.Popup.prototype.getClassPositioning=function(){var t="",e=this.getPositioning();return/bottom/.test(e)&&(t+="ol-popup-bottom "),/top/.test(e)&&(t+="ol-popup-top "),/left/.test(e)&&(t+="ol-popup-left "),/right/.test(e)&&(t+="ol-popup-right "),/^center/.test(e)&&(t+="ol-popup-middle "),/center$/.test(e)&&(t+="ol-popup-center "),t},ol.Overlay.Popup.prototype.setClosebox=function(t){this.closeBox=t,t?this._elt.classList.add("hasclosebox"):this._elt.classList.remove("hasclosebox")},ol.Overlay.Popup.prototype.setPopupClass=function(t){this._elt.className="";var e=this.getClassPositioning().split(" ").filter(function(t){return t.length>0}),o=["ol-popup"];t?t.split(" ").filter(function(t){return t.length>0}).forEach(function(t){o.push(t)}):o.push("default"),e.forEach(function(t){o.push(t)}),this.closeBox&&o.push("hasclosebox"),this._elt.classList.add.apply(this._elt.classList,o)},ol.Overlay.Popup.prototype.addPopupClass=function(t){this._elt.classList.add(t)},ol.Overlay.Popup.prototype.removePopupClass=function(t){this._elt.classList.remove(t)},ol.Overlay.Popup.prototype.setPositioning=function(t){void 0!==t&&(/auto/.test(t)?(this.autoPositioning=t.split("-"),1==this.autoPositioning.length&&(this.autoPositioning[1]="auto")):this.autoPositioning=!1,"center"==(t=t.replace(/auto/g,"center"))&&(t="bottom-center"),this.setPositioning_(t))},ol.Overlay.Popup.prototype.setPositioning_=function(t){if(this._elt){ol.Overlay.prototype.setPositioning.call(this,t),this._elt.classList.remove("ol-popup-top","ol-popup-bottom","ol-popup-left","ol-popup-right","ol-popup-center","ol-popup-middle");var e=this.getClassPositioning().split(" ").filter(function(t){return t.length>0});this._elt.classList.add.apply(this._elt.classList,e)}},ol.Overlay.Popup.prototype.getVisible=function(){return this._elt.classList.contains("visible")},ol.Overlay.Popup.prototype.show=function(t,e){e||"string"!=typeof t||(e=t,t=null),!0===t&&(t=this.getPosition());var o=this,i=this.getMap();if(i&&(e&&e!==this.prevHTML&&(this.prevHTML=e,this.content.innerHTML="",e instanceof Element?this.content.appendChild(e):this.content.insertAdjacentHTML("beforeend",e),Array.prototype.slice.call(this.content.querySelectorAll("img")).forEach(function(t){t.addEventListener("load",function(){i.renderSync()})})),t)){if(this.autoPositioning){var r=i.getPixelFromCoordinate(t),n=i.getSize(),s=[];"auto"==this.autoPositioning[0]?s[0]=r[1]<n[1]/3?"top":"bottom":s[0]=this.autoPositioning[0],s[1]=r[0]<2*n[0]/3?"left":"right",this.setPositioning_(s[0]+"-"+s[1]),this.offsetBox&&this.setOffset([this.offsetBox["left"==s[1]?2:0],this.offsetBox["top"==s[0]?3:1]])}else this.offsetBox&&this.setOffset(this.offsetBox);this.setPosition(t),this._elt.parentElement.style.display="","function"==typeof this.onshow&&this.onshow(),this._tout=setTimeout(function(){o._elt.classList.add("visible")},0)}},ol.Overlay.Popup.prototype.hide=function(){null!=this.getPosition()&&("function"==typeof this.onclose&&this.onclose(),this.setPosition(void 0),this._tout&&clearTimeout(this._tout),this._elt.classList.remove("visible"))},ol.Overlay.Magnify=function(t){var e=document.createElement("div");e.className="ol-magnify",this._elt=e,ol.Overlay.call(this,{positioning:t.positioning||"center-center",element:this._elt,stopEvent:!1}),this.mgmap_=new ol.Map({controls:new ol.Collection,interactions:new ol.Collection,target:t.target||this._elt,view:new ol.View({projection:t.projection}),layers:t.layers}),this.mgview_=this.mgmap_.getView(),this.external_=!!t.target,this.set("zoomOffset",t.zoomOffset||1),this.set("active",!0),this.on("propertychange",this.setView_.bind(this))},ol.ext.inherits(ol.Overlay.Magnify,ol.Overlay),ol.Overlay.Magnify.prototype.setMap=function(t){this.getMap()&&this.getMap().getViewport().removeEventListener("mousemove",this.onMouseMove_),this._listener&&ol.Observable.unByKey(this._listener),this._listener=null,ol.Overlay.prototype.setMap.call(this,t),t.getViewport().addEventListener("mousemove",this.onMouseMove_.bind(this)),this._listener=t.getView().on("propertychange",this.setView_.bind(this)),this.setView_()},ol.Overlay.Magnify.prototype.getMagMap=function(){return this.mgmap_},ol.Overlay.Magnify.prototype.getActive=function(){return this.get("active")},ol.Overlay.Magnify.prototype.setActive=function(t){return this.set("active",t)},ol.Overlay.Magnify.prototype.onMouseMove_=function(t){if(this.get("active")){var e=this.getMap().getEventCoordinate(t);this.external_||this.setPosition(e),this.mgview_.setCenter(e),"none"==this._elt.querySelector("canvas").style.display&&this.mgmap_.updateSize()}else this.setPosition()},ol.Overlay.Magnify.prototype.setView_=function(t){if(this.get("active")){if(!t)return this.setView_({key:"rotation"}),void this.setView_({key:"resolution"});switch(t.key){case"rotation":this.mgview_.setRotation(this.getMap().getView().getRotation());break;case"zoomOffset":case"resolution":var e=Math.max(0,this.getMap().getView().getZoom()+Number(this.get("zoomOffset")));this.mgview_.setZoom(e)}}else this.setPosition()},ol.Overlay.Placemark=function(t){(t=t||{}).popupClass=(t.popupClass||"")+" placemark anim",t.positioning="bottom-center",ol.Overlay.Popup.call(this,t),this.setPositioning=function(){},t.color&&(this.element.style.color=t.color),t.backgroundColor&&(this.element.style.backgroundColor=t.backgroundColor),t.contentColor&&this.setContentColor(t.contentColor),t.size&&this.setRadius(t.size)},ol.ext.inherits(ol.Overlay.Placemark,ol.Overlay.Popup),ol.Overlay.Placemark.prototype.show=function(t,e){!0===t&&(t=this.getPosition()),this.hide(),ol.Overlay.Popup.prototype.show.apply(this,[t,e])},ol.Overlay.Placemark.prototype.setColor=function(t){this.element.style.color=t},ol.Overlay.Placemark.prototype.setBackgroundColor=function(t){this.element.style.backgroundColor=t},ol.Overlay.Placemark.prototype.setContentColor=function(t){this.element.getElementsByClassName("content")[0].style.color=t},ol.Overlay.Placemark.prototype.setClassName=function(t){var e=this.element.className;this.element.className="ol-popup placemark ol-popup-bottom ol-popup-center "+(/visible/.test(e)?"visible ":"")+(/anim/.test(e)?"anim ":"")+t},ol.Overlay.Placemark.prototype.setRadius=function(t){this.element.style.fontSize=t+"px"},ol.Overlay.PopupFeature=function(t){t=t||{},ol.Overlay.Popup.call(this,t),this.setTemplate(t.template),this.set("canFix",t.canFix),this.set("showImage",t.showImage),this.set("maxChar",t.maxChar||200),t.select&&"function"==typeof t.select.on&&(this._select=t.select,t.select.on("select",function(e){this._noselect||this.show(e.mapBrowserEvent.coordinate,t.select.getFeatures().getArray())}.bind(this)))},ol.ext.inherits(ol.Overlay.PopupFeature,ol.Overlay.Popup),ol.Overlay.PopupFeature.prototype.setTemplate=function(t){if(this._template=t,this._template&&this._template.attributes instanceof Array){var e={};this._template.attributes.forEach(function(t){e[t]=!0}),this._template.attributes=e}},ol.Overlay.PopupFeature.prototype.show=function(t,e){(t instanceof ol.Feature||t instanceof Array&&t[0]instanceof ol.Feature)&&(e=t,t=null),e instanceof Array||(e=[e]),this._features=e.slice(),this._count||(this._count=1),this._count=1;var o=this._getHtml(e[0]);this.hide(),o&&(t&&"Point"!==e[0].getGeometry().getType()||(t=e[0].getGeometry().getFirstCoordinate()),ol.Overlay.Popup.prototype.show.call(this,t,o))},ol.Overlay.PopupFeature.prototype._getHtml=function(t){if(!t)return"";var e=ol.ext.element.create("DIV",{className:"ol-popupfeature"});this.get("canFix")&&ol.ext.element.create("I",{className:"ol-fix",parent:e}).addEventListener("click",function(){this.element.classList.toggle("ol-fixed")}.bind(this));var o,i=this._template;if(!i||!i.attributes)for(var r in(i=i||{}).attributes={},t.getProperties())"geometry"!=r&&(i.attributes[r]=r);i.title&&(o="function"==typeof i.title?i.title(t):t.get(i.title),ol.ext.element.create("H1",{html:o,parent:e}));if(i.attributes){var n,s=ol.ext.element.create("TABLE",{parent:e}),a=i.attributes;for(var l in a){var c=a[l];n=ol.ext.element.create("TR",{parent:s}),ol.ext.element.create("TD",{html:c.title||l,parent:n});var h,p=t.get(l);if(this.get("showImage")&&/(http(s?):)([\/|.|\w|\s|-])*\.(?:jpg|gif|png)/.test(p))h=ol.ext.element.create("IMG",{src:p});else{h=(c.before||"")+(c.format?c.format(p):p)+(c.after||"");var u=this.get("maxChar")||200;"string"==typeof h&&h.length>u&&(h=h.substr(0,u)+"[...]")}ol.ext.element.create("TD",{html:h,parent:n})}}if(ol.ext.element.create("BUTTON",{className:"ol-zoombt",parent:e}).addEventListener("click",function(){if("Point"===t.getGeometry().getType())this.getMap().getView().animate({center:t.getGeometry().getFirstCoordinate(),zoom:Math.max(this.getMap().getView().getZoom(),18)});else{var e=t.getGeometry().getExtent();this.getMap().getView().fit(e,{duration:1e3})}}.bind(this)),this._features.length>1){var d=ol.ext.element.create("DIV",{className:"ol-count",parent:e});ol.ext.element.create("DIV",{className:"ol-prev",parent:d}).addEventListener("click",function(){this._count--,this._count<1&&(this._count=this._features.length),e=this._getHtml(this._features[this._count-1]),ol.Overlay.Popup.prototype.show.call(this,this.getPosition(),e)}.bind(this)),ol.ext.element.create("TEXT",{html:this._count+"/"+this._features.length,parent:d}),ol.ext.element.create("DIV",{className:"ol-next",parent:d}).addEventListener("click",function(){this._count++,this._count>this._features.length&&(this._count=1),e=this._getHtml(this._features[this._count-1]),ol.Overlay.Popup.prototype.show.call(this,this.getPosition(),e)}.bind(this))}return this._select&&(this._noselect=!0,this._select.getFeatures().clear(),this._select.getFeatures().push(t),this._noselect=!1),e},ol.Overlay.PopupFeature.localString=function(t,e){return function(o){if(o&&o.toLocaleString)return o.toLocaleString(t,e);var i=new Date(o);return isNaN(i)?o:i.toLocaleString(t,e)}},ol.Overlay.Tooltip=function(t){(t=t||{}).popupClass=t.popupClass||t.className||"tooltips black",t.positioning=t.positioning||"center-left",ol.Overlay.Popup.call(this,t),this._interaction=new ol.interaction.Interaction({handleEvent:function(t){return"pointermove"!==t.type&&"click"!==t.type||(this.get("info")?this.show(t.coordinate,this.get("info")):this.hide(),this._coord=t.coordinate),!0}.bind(this)})},ol.ext.inherits(ol.Overlay.Tooltip,ol.Overlay.Popup),ol.Overlay.Tooltip.prototype.setMap=function(t){this.getMap()&&this.getMap().removeInteraction(this._interaction),ol.Overlay.Popup.prototype.setMap.call(this,t),this.getMap()&&this.getMap().addInteraction(this._interaction)},ol.Overlay.Tooltip.prototype.show=function(t,e){this.get("measure")&&(e=this.get("measure")+"<br/>"+e),ol.Overlay.Popup.prototype.show.call(this,t,e)},ol.Overlay.Tooltip.prototype.setInfo=function(t){t?setTimeout(function(){this.set("info",t),this.show(this._coord,this.get("info"))}.bind(this)):(this.set("info",""),this.hide())},ol.Overlay.Tooltip.prototype.setFeature=function(t){this._feature=t,this._listener&&this._listener.forEach(function(t){ol.Observable.unByKey(t)}),this._listener=[],this.set("measure",""),t&&this._listener.push(t.getGeometry().on("change",function(t){var e,o=t.target;if(o.getArea){var i=ol.sphere.getArea(o,{projection:this.getMap().getView().getProjection()});(i=Math.round(100*i)/100)&&(i=i>1e4?(i/1e6).toLocaleString(void 0,{maximumFractionDigits:2})+" km²":i.toLocaleString(void 0,{maximumFractionDigits:2})+" m²"),e=i}else if(o.getLength){var r=ol.sphere.getLength(o,{projection:this.getMap().getView().getProjection()});(r=Math.round(100*r)/100)&&(r=r>100?(r/1e3).toLocaleString(void 0,{maximumFractionDigits:2})+" km":r.toLocaleString(void 0,{maximumFractionDigits:2})+" m"),e=r}this.set("measure",e)}.bind(this)))},ol.coordinate.convexHull,function(){var t=function(t,e,o){return(t[0]-o[0])*(e[1]-o[1])-(t[1]-o[1])*(e[0]-o[0])<=0};ol.coordinate.convexHull=function(e){var o;e.sort(function(t,e){return t[0]==e[0]?t[1]-e[1]:t[0]-e[0]});var i=[];for(o=0;o<e.length;o++){for(;i.length>=2&&t(i[i.length-2],i[i.length-1],e[o]);)i.pop();i.push(e[o])}var r=[];for(o=e.length-1;o>=0;o--){for(;r.length>=2&&t(r[r.length-2],r[r.length-1],e[o]);)r.pop();r.push(e[o])}return r.pop(),i.pop(),i.concat(r)};var e=function(t){var o,i,r=[];switch(t.getType()){case"Point":r.push(t.getCoordinates());break;case"LineString":case"LinearRing":case"MultiPoint":r=t.getCoordinates();break;case"MultiLineString":for(i=t.getLineStrings(),o=0;o<i.length;o++)r.concat(e(i[o]));break;case"Polygon":r=e(t.getLinearRing(0));break;case"MultiPolygon":for(i=t.getPolygons(),o=0;o<i.length;o++)r.concat(e(i[o]));break;case"GeometryCollection":for(i=t.getGeometries(),o=0;o<i.length;o++)r.concat(e(i[o]))}return r};ol.geom.Geometry.prototype.convexHull=function(){return ol.coordinate.convexHull(e(this))}}(),ol.coordinate.toDFCI=function(t,e,o){e||0===e||(e=3),o&&(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)),t=ol.proj.transform(t,o,"EPSG:27572"));var i=t[0],r=t[1],n="";if(n+=String.fromCharCode(65+Math.floor((i<8e5?i:i+2e5)/1e5))+String.fromCharCode(65+Math.floor((r<23e5?r:r+2e5)/1e5)-15),0===e)return n;if(n+=2*Math.floor(i%1e5/2e4),n+=2*Math.floor(r%1e5/2e4),1===e)return n;var s=Math.floor(i%2e4/2e3);if(n+=String.fromCharCode(65+(s<8?s:s+2)),n+=Math.floor(r%2e4/2e3),2===e)return n;var a=Math.floor(i%2e3/500),l=Math.floor(r%2e3/500);return n+=a<1?l>1?".1":".4":a>2?l>1?".2":".3":l>2?a<2?".1":".2":l<1?a<2?".4":".3":".5"},ol.coordinate.fromDFCI=function(t,e){var o,i=1e5,r=t.charCodeAt(0)-65;r=(r<8?r:r-2)*i;var n=t.charCodeAt(1)-65;if(n=(n<8?n:n-2)*i+15e5,2===t.length)o=[r+i/2,n+i/2];else if(i/=5,r+=Number(t.charAt(2))/2*i,n+=Number(t.charAt(3))/2*i,4===t.length)o=[r+i/2,n+i/2];else{i/=10;var s=t.charCodeAt(4)-65;if(r+=(s<8?s:s-2)*i,n+=Number(t.charAt(5))*i,6===t.length)o=[r+i/2,n+i/2];else switch(t.charAt(7)){case"1":o=[r+i/4,n+3*i/4];break;case"2":o=[r+3*i/4,n+3*i/4];break;case"3":o=[r+3*i/4,n+i/4];break;case"4":o=[r+i/4,n+i/4];break;default:o=[r+i/2,n+i/2]}}return e&&(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)),o=ol.proj.transform(o,"EPSG:27572",e)),o},ol.coordinate.validDFCI=function(t){if(t.length<2||t.length>8)return!1;if(/[^A-H|^K-N]/.test(t.substr(0,1)))return!1;if(/[^B-H|^K-N]/.test(t.substr(1,1)))return!1;if(t.length>2){if(t.length<4)return!1;if(/[^0,^2,^4,^6,^8]/.test(t.substr(2,1)))return!1;if(/[^0,^2,^4,^6,^8]/.test(t.substr(3,1)))return!1}if(t.length>4){if(t.length<6)return!1;if(/[^A-H|^K-L]/.test(t.substr(4,1)))return!1;if(/[^0-9]/.test(t.substr(5,1)))return!1}if(t.length>6){if(t.length<8)return!1;if("."!==t.substr(6,1))return!1;if(/[^1-5]/.test(t.substr(7,1)))return!1}return!0},ol.coordinate.validDFCICoord=function(t,e){return e&&(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)),t=ol.proj.transform(t,e,"EPSG:27572")),!(0>t[0]||t[0]>12e5)&&!(16e5>t[1]||t[1]>27e5)},ol.graph={},ol.graph.Dijskra=function(t){t=t||{},this.source=t.source,this.nodes=new ol.source.Vector,this.maxIteration=t.maxIteration||2e4,this.stepIteration=t.stepIteration||2e3,this.astar=!0,this.candidat=[],ol.Object.call(this),this.set("epsilon",t.epsilon||1e-6)},ol.ext.inherits(ol.graph.Dijskra,ol.Object),ol.graph.Dijskra.prototype.weight=function(){return 1},ol.graph.Dijskra.prototype.direction=function(){return 2},ol.graph.Dijskra.prototype.getLength=function(t){return t.getGeometry&&(t=t.getGeometry()),t.getLength()},ol.graph.Dijskra.prototype.getNodeSource=function(){return this.nodes},ol.graph.Dijskra.prototype.getEdges=function(t){var e=ol.extent.buffer(ol.extent.boundingExtent([t]),this.get("epsilon")),o=[];return this.source.forEachFeatureIntersectingExtent(e,function(t){o.push(t)}),o},ol.graph.Dijskra.prototype.getNode=function(t){var e=ol.extent.buffer(ol.extent.boundingExtent([t]),this.get("epsilon")),o=[];return this.nodes.forEachFeatureIntersectingExtent(e,function(t){o.push(t)}),o[0]},ol.graph.Dijskra.prototype.addNode=function(t,e,o,i,r){if(this.wdist&&e>this.wdist)return!1;var n=this.getNode(t),s=e+this.getLength(new ol.geom.LineString([this.end,t]))*this.weight();if(this.astar&&this.wdist&&s>this.wdist)return!1;if(n){if(n!==this.arrival&&n.get("wdist")<=e)return n;n.set("dist",o),n.set("wdist",e),n.set("dtotal",s),n.set("from",i),n.set("prev",r),n===this.arrival&&(this.wdist=e),this.candidat.push(n)}else n=new ol.Feature({geometry:new ol.geom.Point(t),from:i,prev:r,dist:o||0,wdist:e,dtotal:s}),e<0?n.set("wdist",!1):this.candidat.push(n),this.nodes.addFeature(n);return n},ol.graph.Dijskra.prototype.closestCoordinate=function(t){var e=this.source.getClosestFeatureToCoordinate(t),o=e.getGeometry().getFirstCoordinate(),i=e.getGeometry().getLastCoordinate();return ol.coordinate.dist2d(t,o)<ol.coordinate.dist2d(t,i)?o:i},ol.graph.Dijskra.prototype.path=function(t,e){if(this.running)return!1;var o=this;return this.nodes.clear(),this.candidat=[],this.wdist=0,this.running=!0,t=this.closestCoordinate(t),this.end=this.closestCoordinate(e),t[0]===this.end[0]&&t[1]===this.end[1]?(this.dispatchEvent({type:"finish",route:[],distance:this.wdist}),!1):(this.addNode(t,0),this.arrival=this.addNode(this.end,-1),this.nb=0,this.dispatchEvent({type:"start"}),setTimeout(function(){o._resume()}),[t,this.end])},ol.graph.Dijskra.prototype.resume=function(){this.running||this.candidat.length&&(this.running=!0,this.nb=0,this._resume())},ol.graph.Dijskra.prototype.pause=function(){this.running&&(this.nb=-1)},ol.graph.Dijskra.prototype.getBestWay=function(){for(var t,e,o=-1,i=0;e=this.candidat[i];i++)e.get("wdist")>o&&(t=e,o=e.get("wdist"));return this.getRoute(t)},ol.graph.Dijskra.prototype._resume=function(){if(this.running){for(;this.candidat.length;){this.candidat.sort(function(t,e){return t.get("dtotal")<e.get("dtotal")?1:t.get("dtotal")===e.get("dtotal")?0:-1});for(var t,e=this.candidat.pop(),o=e.getGeometry().getCoordinates(),i=this.getEdges(o),r=0;t=i[r];r++){if(e.get("from")!==t){var n=this.getLength(t);n<0&&console.log("distance < 0!");var s=e.get("wdist")+n*this.weight(t);n=e.get("dist")+n;var a=t.getGeometry().getFirstCoordinate(),l=t.getGeometry().getLastCoordinate(),c=this.direction(t);0!==c&&(o[0]===a[0]&&o[1]===a[1]&&-1!==c&&this.addNode(l,s,n,t,e),o[0]===l[0]&&o[0]===l[0]&&1!==c&&this.addNode(a,s,n,t,e))}if(-1===this.nb||this.nb++>this.maxIteration)return this.running=!1,void this.dispatchEvent({type:"pause",overflow:-1!==this.nb});if(!(this.nb%this.stepIteration)){var h=this;return window.setTimeout(function(){h._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")})}},ol.graph.Dijskra.prototype.getRoute=function(t){for(var e=[];t;)e.unshift(t.get("from")),t=t.get("prev");return e.shift(),e},ol.coordinate.dist2d=function(t,e){var o=t[0]-e[0],i=t[1]-e[1];return Math.sqrt(o*o+i*i)},ol.coordinate.equal=function(t,e){return t[0]==e[0]&&t[1]==e[1]},ol.coordinate.getFeatureCenter=function(t){return ol.coordinate.getGeomCenter(t.getGeometry())},ol.coordinate.getGeomCenter=function(t){switch(t.getType()){case"Point":return t.getCoordinates();case"MultiPolygon":t=t.getPolygon(0);case"Polygon":return t.getInteriorPoint().getCoordinates();default:return t.getClosestPoint(ol.extent.getCenter(t.getExtent()))}},ol.coordinate.offsetCoords=function(t,e){var o,i,r,n,s,a,l,c,h,p,u,d,g,f=[],m=t.length-1,y=m,v=ol.coordinate.equal(t[0],t[m]);v||(u=t[0],d=t[1],g=[u[0]+(d[1]-u[1])/ol.coordinate.dist2d(u,d)*e,u[1]-(d[0]-u[0])/ol.coordinate.dist2d(u,d)*e],f.push(g),t.push(t[m]),m++,y--);for(var _=0;_<y;_++)u=t[_],d=t[(_+1)%m],g=t[(_+2)%m],o=(d[1]-u[1])/(d[0]-u[0]),i=(g[1]-d[1])/(g[0]-d[0]),Math.abs(o-i)>1e-10&&(r=Math.sqrt((d[0]-u[0])*(d[0]-u[0])+(d[1]-u[1])*(d[1]-u[1])),n=Math.sqrt((g[0]-d[0])*(g[0]-d[0])+(g[1]-d[1])*(g[1]-d[1])),s=u[0]+e*(d[1]-u[1])/r,h=(i*(a=d[0]+e*(g[1]-d[1])/n)-o*s+(l=u[1]-e*(d[0]-u[0])/r)-(c=d[1]-e*(g[0]-d[0])/n))/(i-o),p=(o*i*(a-s)+i*l-o*c)/(i-o),d[0]-u[0]==0&&(p=i*(h=d[0]+e*(d[1]-u[1])/Math.abs(d[1]-u[1]))-i*a+c),g[0]-d[0]==0&&(p=o*(h=g[0]+e*(g[1]-d[1])/Math.abs(g[1]-d[1]))-o*s+l),f.push([h,p]));return v?f.push(f[0]):(t.pop(),u=t[t.length-1],d=t[t.length-2],g=[u[0]-(d[1]-u[1])/ol.coordinate.dist2d(u,d)*e,u[1]+(d[0]-u[0])/ol.coordinate.dist2d(u,d)*e],f.push(g)),f},ol.coordinate.findSegment=function(t,e){for(var o=0;o<e.length-1;o++){var i=e[o],r=e[o+1];if(ol.coordinate.equal(t,i)||ol.coordinate.equal(t,r))return{index:1,segment:[i,r]};var n=ol.coordinate.dist2d(i,r),s=[(r[0]-i[0])/n,(r[1]-i[1])/n],a=ol.coordinate.dist2d(i,t),l=[(t[0]-i[0])/a,(t[1]-i[1])/a];if(Math.abs(s[0]*l[1]-s[1]*l[0])<1e-10)return{index:1,segment:[i,r]}}return{index:-1}},ol.coordinate.splitH=function(t,e,o){for(var i,r,n=[],s=0;s<t.length-1;s++)t[s].length&&t[s+1].length&&(t[s][1]<=e&&t[s+1][1]>e||t[s][1]>=e&&t[s+1][1]<e)&&(i=(r=(e-t[s][1])/(t[s+1][1]-t[s][1]))*(t[s+1][0]-t[s][0])+t[s][0],n.push({contour:o,index:s,pt:[i,e],abs:r}));n.sort(function(t,e){return t.pt[0]-e.pt[0]});for(var a=[],l=0;l<n.length-1;l+=2)a.push([n[l],n[l+1]]);return a},ol.geom.LineString.prototype.splitAt=function(t,e){var o;if(!t)return[this];if(e||(e=1e-10),t.length&&t[0].length){var i=[this];for(o=0;o<t.length;o++){for(var r=[],n=0;n<i.length;n++){var s=i[n].splitAt(t[o],e);r=r.concat(s)}i=r}return i}if(ol.coordinate.equal(t,this.getFirstCoordinate())||ol.coordinate.equal(t,this.getLastCoordinate()))return[this];var a=this.getCoordinates(),l=[a[0]],c=[];for(o=0;o<a.length-1;o++)if(!ol.coordinate.equal(a[o],a[o+1])){if(ol.coordinate.equal(t,a[o+1]))l.push(a[o+1]),c.push(new ol.geom.LineString(l)),l=[];else if(!ol.coordinate.equal(t,a[o])){var h,p,u=!1;a[o][0]==a[o+1][0]?(h=(a[o][1]-t[1])/(a[o][1]-a[o+1][1]),u=a[o][0]==t[0]&&0<h&&h<=1):a[o][1]==a[o+1][1]?(h=(a[o][0]-t[0])/(a[o][0]-a[o+1][0]),u=a[o][1]==t[1]&&0<h&&h<=1):(h=(a[o][0]-t[0])/(a[o][0]-a[o+1][0]),p=(a[o][1]-t[1])/(a[o][1]-a[o+1][1]),u=Math.abs(h-p)<=e&&0<h&&h<=1),u&&(l.push(t),c.push(new ol.geom.LineString(l)),l=[t])}l.push(a[o+1])}return l.length>1&&c.push(new ol.geom.LineString(l)),c.length?c:[this]},ol.geom.MultiPolygon.prototype.scribbleFill=function(t){var e,o,i,r=[],n=this.getPolygons();for(e=0;o=n[e];e++){var s=o.scribbleFill(t);s&&r.push(s)}if(!r.length)return null;var a,l=r[0];for(e=0;i=r[e];e++){a=i.getLineStrings();for(var c=0;c<a.length;c++)l.appendLineString(a[c])}return l},ol.geom.Polygon.prototype.scribbleFill=function(t){var e,o,i,r=t.interval,n=t.angle||Math.PI/2,s=this.clone();s.rotate(n,[0,0]);var a=s.getCoordinates(),l=a[0];for(e=1;e<a.length;e++)l.push([]),l=l.concat(a[e]);for(var c=s.getExtent(),h=[],p=(Math.floor(c[1]/r)+1)*r;p<c[3];p+=r)i=ol.coordinate.splitH(l,p,e),h=h.concat(i);if(!h.length)return null;var u=l.length-1,d=h[0][0].index;for(o=0;i=h[o];o++)h[o][0].index=(h[o][0].index-d+u)%u,h[o][1].index=(h[o][1].index-d+u)%u;for(var g=[];;){for(o=0;(i=h[o])&&i[0].done;o++);if(!i)break;for(var f=[];i;){i[0].done=!0,f.push(i[0].pt),f.push(i[1].pt);for(var m=i[0].pt[1]+r,y=1/0,v=null;h[o]&&!(h[o][0].pt[1]>m);){if(h[o][0].pt[1]===m){var _=Math.min((h[o][0].index-i[0].index+u)%u,(i[0].index-h[o][0].index+u)%u),w=Math.min((i[1].index-i[0].index+u)%u,(i[0].index-i[1].index+u)%u);_<y&&_<w&&(y=_,v=h[o][0].done?null:h[o])}o++}i=v}f.length&&g.push(f)}if(!g.length)return null;var x=new ol.geom.MultiLineString(g);return x.rotate(-n,[0,0]),x.cspline({pointsPerSeg:8,tension:.9})},ol.Map.prototype.animExtent=function(t,e){var o;(e=e||{}).projection&&(t=ol.proj.transformExtent(t,e.projection,this.getView().getProjection()));var i=(new Date).getTime(),r=e.duration||1e3,n=e.easing||ol.easing.upAndDown,s=e.style&&e.style.getWidth()||2,a=e.style&&e.style.getColr()||"red";o=this.on("postcompose",function(e){var l=e.frameState,c=l.pixelRatio,h=l.time-i;if(h>r)ol.Observable.unByKey(o);else{var p=h/r,u=this.getPixelFromCoordinate([t[0],t[1]]),d=this.getPixelFromCoordinate([t[2],t[3]]),g=e.context;g.save(),g.scale(c,c),g.beginPath(),g.globalAlpha=n(1-p),g.lineWidth=s,g.strokeStyle=a,g.rect(u[0],u[1],d[0]-u[0],d[1]-u[1]),g.stroke(),g.restore(),l.animate=!0}}.bind(this)),this.renderSync()},ol.geom.Geometry.prototype.cspline=function(t){return this.calcCSpline_?(this.csplineGeometryRevision==this.getRevision()&&this.csplineOption==JSON.stringify(t)||(this.csplineGeometry_=this.calcCSpline_(t),this.csplineGeometryRevision=this.getRevision(),this.csplineOption=JSON.stringify(t)),this.csplineGeometry_):this},ol.geom.GeometryCollection.prototype.calcCSpline_=function(t){for(var e=[],o=this.getGeometries(),i=0;i<o.length;i++)e.push(o[i].cspline(t));return new ol.geom.GeometryCollection(e)},ol.geom.MultiLineString.prototype.calcCSpline_=function(t){for(var e=[],o=this.getLineStrings(),i=0;i<o.length;i++)e.push(o[i].cspline(t).getCoordinates());return new ol.geom.MultiLineString(e)},ol.geom.Polygon.prototype.calcCSpline_=function(t){for(var e=[],o=this.getCoordinates(),i=0;i<o.length;i++)e.push(new ol.geom.LineString(o[i]).cspline(t).getCoordinates());return new ol.geom.Polygon(e)},ol.geom.MultiPolygon.prototype.calcCSpline_=function(t){for(var e=[],o=this.getPolygons(),i=0;i<o.length;i++)e.push(o[i].cspline(t).getCoordinates());return new ol.geom.MultiPolygon(e)},ol.geom.LineString.prototype.calcCSpline_=function(t){t||(t={});var e,o,i,r,n,s,a,l,c,h,p,u,d,g,f=this.getCoordinates(),m="number"==typeof t.tension?t.tension:.5,y=t.resolution||this.getLength()/f.length/(t.pointsPerSeg||10),v=[];function _(t,e,o,i){var r=o-t,n=i-e;return Math.sqrt(r*r+n*n)}for(e=f.slice(0),f.length>2&&f[0][0]==f[f.length-1][0]&&f[0][1]==f[f.length-1][1]?(e.unshift(f[f.length-2]),e.push(f[1])):(e.unshift(f[0]),e.push(f[f.length-1])),g=1;g<e.length-2;g++){var w=_(e[g][0],e[g][1],e[g+1][0],e[g+1][1]),x=Math.round(w/y),S=1;if(t.normalize){w=_(e[g+1][0],e[g+1][1],e[g-1][0],e[g-1][1]);var b=_(e[g+2][0],e[g+2][1],e[g][0],e[g][1]);S=w<b?w/b:b/w}for(r=(e[g+1][0]-e[g-1][0])*m*S,n=(e[g+2][0]-e[g][0])*m*S,s=(e[g+1][1]-e[g-1][1])*m*S,a=(e[g+2][1]-e[g][1])*m*S,d=0;d<=x;d++)u=d/x,l=2*Math.pow(u,3)-3*Math.pow(u,2)+1,c=-2*Math.pow(u,3)+3*Math.pow(u,2),h=Math.pow(u,3)-2*Math.pow(u,2)+u,p=Math.pow(u,3)-Math.pow(u,2),o=l*e[g][0]+c*e[g+1][0]+h*r+p*n,i=l*e[g][1]+c*e[g+1][1]+h*s+p*a,o&&i&&v.push([o,i])}return new ol.geom.LineString(v)},ol.HexGrid=function(t){t=t||{},ol.Object.call(this,t),this.size_=t.size||8e4,this.origin_=t.origin||[0,0],this.layout_=this.layout[t.layout]||this.layout.pointy},ol.ext.inherits(ol.HexGrid,ol.Object),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.setLayout=function(t){this.layout_=this.layout[t]||this.layout.pointy,this.changed()},ol.HexGrid.prototype.getLayout=function(){return 0!=this.layout_[9]?"pointy":"flat"},ol.HexGrid.prototype.setOrigin=function(t){this.origin_=t,this.changed()},ol.HexGrid.prototype.getOrigin=function(){return this.origin_},ol.HexGrid.prototype.setSize=function(t){this.size_=t||8e4,this.changed()},ol.HexGrid.prototype.getSize=function(){return this.size_},ol.HexGrid.prototype.cube2hex=function(t){return[t[0],t[2]]},ol.HexGrid.prototype.hex2cube=function(t){return[t[0],-t[0]-t[1],t[1]]},ol.HexGrid.prototype.hex2offset=function(t){return this.layout_[9]?[t[0]+(t[1]-(1&t[1]))/2,t[1]]:[t[0],t[1]+(t[0]+(1&t[0]))/2]},ol.HexGrid.prototype.offset2hex=function(t){return this.layout_[9]?[t[0]-(t[1]-(1&t[1]))/2,t[1]]:[t[0],t[1]-(t[0]+(1&t[0]))/2]},ol.HexGrid.prototype.cube_round=function(t){var e=Math.round(t[0]),o=Math.round(t[1]),i=Math.round(t[2]),r=Math.abs(e-t[0]),n=Math.abs(o-t[1]),s=Math.abs(i-t[2]);return r>n&&r>s?e=-o-i:n>s?o=-e-i:i=-e-o,[e,o,i]},ol.HexGrid.prototype.hex_round=function(t){return this.cube2hex(this.cube_round(this.hex2cube(t)))},ol.HexGrid.prototype.hex_corner=function(t,e,o){return[t[0]+e*this.layout_[8+o%6*2],t[1]+e*this.layout_[9+o%6*2]]},ol.HexGrid.prototype.getHexagonAtCoord=function(t){return this.getHexagon(this.coord2hex(t))},ol.HexGrid.prototype.getHexagon=function(t){for(var e=[],o=this.hex2coord(t),i=0;i<=7;i++)e.push(this.hex_corner(o,this.size_,i,this.layout_[8]));return e},ol.HexGrid.prototype.hex2coord=function(t){return[this.origin_[0]+this.size_*(this.layout_[0]*t[0]+this.layout_[1]*t[1]),this.origin_[1]+this.size_*(this.layout_[2]*t[0]+this.layout_[3]*t[1])]},ol.HexGrid.prototype.coord2hex=function(t){var e=[(t[0]-this.origin_[0])/this.size_,(t[1]-this.origin_[1])/this.size_],o=this.layout_[4]*e[0]+this.layout_[5]*e[1],i=this.layout_[6]*e[0]+this.layout_[7]*e[1];return this.hex_round([o,i])},ol.HexGrid.prototype.cube_distance=function(t,e){return Math.max(Math.abs(t[0]-e[0]),Math.abs(t[1]-e[1]),Math.abs(t[2]-e[2]))},function(){function t(t,e,o){return t+(e-t)*o}function e(e,o,i){return[t(e[0]+1e-6,o[0],i),t(e[1]+1e-6,o[1],i),t(e[2]+1e-6,o[2],i)]}ol.HexGrid.prototype.cube_line=function(t,o){var i=this.cube_distance(t,o);if(!i)return[t];for(var r=[],n=0;n<=i;n++)r.push(this.cube_round(e(t,o,n/i)));return r}}(),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.HexGrid.prototype.hex_neighbors=function(t,e){if(void 0!==e)return[t[0]+this.neighbors.hex[e%6][0],t[1]+this.neighbors.hex[e%6][1]];var o=[];for(e=0;e<6;e++)o.push([t[0]+this.neighbors.hex[e][0],t[1]+this.neighbors.hex[e][1]]);return o},ol.HexGrid.prototype.cube_neighbors=function(t,e){if(void 0!==e)return[t[0]+this.neighbors.cube[e%6][0],t[1]+this.neighbors.cube[e%6][1],t[2]+this.neighbors.cube[e%6][2]];var o=[];for(e=0;e<6;e++)o.push([t[0]+this.neighbors.cube[e][0],t[1]+this.neighbors.cube[e][1],t[2]+this.neighbors.cube[e][2]]);for(e=0;e<6;e++)o[e]=this.cube2hex(o[e]);return o},ol.InseeGrid=function(t){t=t||{},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)),ol.Object.call(this,t);var e=Math.max(200,200*Math.round((t.size||0)/200));this.set("size",e)},ol.ext.inherits(ol.InseeGrid,ol.Object),ol.InseeGrid.extent=[32e5,2e6,43e5,314e4],ol.InseeGrid.prototype.getExtent=function(t){return ol.proj.transformExtent(ol.InseeGrid.extent,t||"EPSG:3035","EPSG:3857")},ol.InseeGrid.prototype.getGridAtCoordinate=function(t,e){var o=ol.proj.transform(t,e||"EPSG:3857","EPSG:3035"),i=this.get("size"),r=Math.floor(o[0]/i)*i,n=Math.floor(o[1]/i)*i,s=new ol.geom.Polygon([[[r,n],[r+i,n],[r+i,n+i],[r,n+i],[r,n]]]);return s.transform("EPSG:3035",e||"EPSG:3857"),s},ol.Map.prototype.markup=function(t,e){var o,i=this;(e=e||{}).projection&&(t=ol.proj.transform(t,e.projection,this.getView().getProjection()));var r=(new Date).getTime(),n=e.delay||3e3,s=1e3,a=e.maxZoom||100,l=ol.easing.easeOut,c=e.style;return c||(c=new ol.style.Circle({radius:10,stroke:new ol.style.Stroke({color:"red",width:2})})),c instanceof ol.style.Image&&(c=new ol.style.Style({image:c})),c instanceof Array||(c=[c]),setTimeout(function(){o&&i.renderSync()},n),o=this.on("postcompose",function(e){var i=e.frameState,h=i.time-r;if(h>n+s)ol.Observable.unByKey(o),o=null;else{n>h&&this.getView().getZoom()>a&&(n=h);var p=i.pixelRatio,u=0;h>n&&(u=(h-n)/s);var d=e.context;d.save(),d.beginPath(),d.globalAlpha=l(1-u);for(var g=0;g<c.length;g++){var f=c[g].getImage(),m=f.getScale();f.setScale(m*p),e.vectorContext.setStyle(c[g]),e.vectorContext.drawGeometry(new ol.geom.Point(t)),f.setScale(m)}d.restore(),h>=n&&(i.animate=!0)}}.bind(this)),this.renderSync(),o.stop=function(){n=s=0,this.target.renderSync()},o},ol.ordering={},ol.ordering.yOrdering=function(){return function(t,e){return e.getGeometry().getExtent()[1]-t.getGeometry().getExtent()[1]}},ol.ordering.zIndex=function(t){t||(t={});var e=t.attribute||"zIndex";return t.equalFn?function(o,i){return o.get(e)==i.get(e)?t.equalFn(o,i):o.get(e)<i.get(e)?1:-1}:function(t,o){return t.get(e)==o.get(e)?0:t.get(e)<o.get(e)?1:-1}},ol.Map.prototype.pulse=function(t,e){var o;(e=e||{}).projection&&(t=ol.proj.transform(t,e.projection,this.getView().getProjection()));var i=(new Date).getTime(),r=e.duration||3e3,n=e.easing||ol.easing.easeOut,s=e.style;s||(s=new ol.style.Circle({radius:30,stroke:new ol.style.Stroke({color:"red",width:2})})),s instanceof ol.style.Image&&(s=new ol.style.Style({image:s})),s instanceof Array||(s=[s]);var a=e.amplitude||1;a<0&&(a=0);var l=e.radius||15;l<0&&(l=5),o=this.on("postcompose",function(e){var l=e.frameState,c=l.pixelRatio,h=l.time-i;if(h>r)ol.Observable.unByKey(o);else{var p=h/r,u=e.context;u.save(),u.beginPath();var d=n(p);u.globalAlpha=n(1-p),console.log("anim");for(var g=0;g<s.length;g++){var f=s[g].getImage(),m=f.getScale();f.setScale(c*m*(1+a*(d-1))),e.vectorContext.setStyle(s[g]),e.vectorContext.drawGeometry(new ol.geom.Point(t)),f.setScale(m)}u.restore(),l.animate=!0}}.bind(this)),this.renderSync()},ol.style.Chart=function(t){var e=t||{},o=0;t.stroke&&(o=t.stroke.getWidth()),ol.style.RegularShape.call(this,{radius:e.radius+o,fill:new ol.style.Fill({color:[0,0,0]}),rotation:e.rotation,snapToPixel:e.snapToPixel}),e.scale&&this.setScale(e.scale),this.stroke_=e.stroke,this.radius_=e.radius||20,this.donutratio_=e.donutRatio||.5,this.type_=e.type,this.offset_=[e.offsetX?e.offsetX:0,e.offsetY?e.offsetY:0],this.animation_="number"==typeof e.animation?{animate:!0,step:e.animation}:this.animation_={animate:!1,step:1},this.max_=e.max,this.data_=e.data,e.colors instanceof Array?this.colors_=e.colors:(this.colors_=ol.style.Chart.colors[e.colors],this.colors_||(this.colors_=ol.style.Chart.colors.classic)),this.renderChart_()},ol.ext.inherits(ol.style.Chart,ol.style.RegularShape),ol.style.Chart.colors={classic:["#ffa500","blue","red","green","cyan","magenta","yellow","#0f0"],dark:["#960","#003","#900","#060","#099","#909","#990","#090"],pale:["#fd0","#369","#f64","#3b7","#880","#b5d","#666"],pastel:["#fb4","#79c","#f66","#7d7","#acc","#fdd","#ff9","#b9b"],neon:["#ff0","#0ff","#0f0","#f0f","#f00","#00f"]},ol.style.Chart.prototype.clone=function(){var t=new ol.style.Chart({type:this.type_,radius:this.radius_,rotation:this.getRotation(),scale:this.getScale(),data:this.getData(),snapToPixel:this.getSnapToPixel(),stroke:this.stroke_,colors:this.colors_,offsetX:this.offset_[0],offsetY:this.offset_[1],animation:this.animation_});return t.setScale(this.getScale()),t.setOpacity(this.getOpacity()),t},ol.style.Chart.prototype.getData=function(){return this.data_},ol.style.Chart.prototype.setData=function(t){this.data_=t,this.renderChart_()},ol.style.Chart.prototype.getRadius=function(){return this.radius_},ol.style.Chart.prototype.setRadius=function(t,e){this.radius_=t,this.donuratio_=e||this.donuratio_,this.renderChart_()},ol.style.Chart.prototype.setAnimation=function(t){if(!1===t){if(0==this.animation_.animate)return;this.animation_.animate=!1}else{if(this.animation_.step==t)return;this.animation_.animate=!0,this.animation_.step=t}this.renderChart_()},ol.style.Chart.prototype.renderChart_=function(){var t,e=0;this.stroke_&&(t=ol.color.asString(this.stroke_.getColor()),e=this.stroke_.getWidth());var o=this.getImage(),i=o.getContext("2d");i.clearRect(0,0,o.width,o.height),i.lineJoin="round";var r,n,s=0;for(r=0;r<this.data_.length;r++)s+=this.data_[r];i.setTransform(1,0,0,1,0,0),i.translate(0,0);var a=this.animation_.animate?this.animation_.step:1;switch(this.type_){case"donut":case"pie3D":case"pie":var l,c=Math.PI*(a-1.5);for(n=o.width/2,i.strokeStyle=t,i.lineWidth=e,i.save(),"pie3D"==this.type_&&(i.translate(0,.3*n),i.scale(1,.7),i.beginPath(),i.fillStyle="#369",i.arc(n,1.4*n,this.radius_*a,0,2*Math.PI),i.fill(),i.stroke()),"donut"==this.type_&&(i.save(),i.beginPath(),i.rect(0,0,2*n,2*n),i.arc(n,n,this.radius_*a*this.donutratio_,0,2*Math.PI),i.clip("evenodd")),r=0;r<this.data_.length;r++)i.beginPath(),i.moveTo(n,n),i.fillStyle=this.colors_[r%this.colors_.length],l=c+2*Math.PI*this.data_[r]/s*a,i.arc(n,n,this.radius_*a,c,l),i.closePath(),i.fill(),i.stroke(),c=l;"donut"==this.type_&&(i.restore(),i.beginPath(),i.strokeStyle=t,i.lineWidth=e,i.arc(n,n,this.radius_*a*this.donutratio_,Math.PI*(a-1.5),c),i.stroke()),i.restore();break;case"bar":default:var h=0;if(this.max_)h=this.max_;else for(r=0;r<this.data_.length;r++)h<this.data_[r]&&(h=this.data_[r]);var p=Math.min(5,2*this.radius_/this.data_.length);n=o.width/2;var u,d=o.width-e,g=n-this.data_.length*p/2;for(i.strokeStyle=t,i.lineWidth=e,r=0;r<this.data_.length;r++){i.beginPath(),i.fillStyle=this.colors_[r%this.colors_.length],u=g+p;var f=this.data_[r]/h*2*this.radius_*a;i.rect(g,d-f,p,f),i.closePath(),i.fill(),i.stroke(),g=u}}var m=this.getAnchor();m[0]=n-this.offset_[0],m[1]=n-this.offset_[1]},ol.style.Chart.prototype.getChecksum=function(){var t=null!==this.stroke_?this.stroke_.getChecksum():"-";if(null===this.checksums_||t!=this.checksums_[1]||null!=this.checksums_[2]||this.radius_!=this.checksums_[3]||this.data_.join("|")!=this.checksums_[4]){var e="c"+t+void 0+(void 0!==this.radius_?this.radius_.toString():"-")+this.data_.join("|");this.checksums_=[e,t,void 0,this.radius_,this.data_.join("|")]}return this.checksums_[0]},ol.style.FillPattern=function(t){var e;t||(t={});var o=this.canvas_=document.createElement("canvas"),i=(Number(t.scale)>0?Number(t.scale):1)*ol.has.DEVICE_PIXEL_RATIO||ol.has.DEVICE_PIXEL_RATIO,r=o.getContext("2d");if(t.image){var n;t.image.load();var s=t.image.getImage();if(s.width)o.width=Math.round(s.width*i),o.height=Math.round(s.height*i),r.globalAlpha="number"==typeof t.opacity?t.opacity:1,r.drawImage(s,0,0,s.width,s.height,0,0,o.width,o.height),e=r.createPattern(o,"repeat");else{var a=this;e=[0,0,0,0],s.onload=function(){o.width=Math.round(s.width*i),o.height=Math.round(s.height*i),r.globalAlpha="number"==typeof t.opacity?t.opacity:1,r.drawImage(s,0,0,s.width,s.height,0,0,o.width,o.height),e=r.createPattern(o,"repeat"),a.setColor(e)}}}else{var l=this.getPattern_(t);if(o.width=Math.round(l.width*i),o.height=Math.round(l.height*i),r.beginPath(),t.fill&&(r.fillStyle=ol.color.asString(t.fill.getColor()),r.fillRect(0,0,o.width,o.height)),r.scale(i,i),r.lineCap="round",r.lineWidth=l.stroke||1,r.fillStyle=ol.color.asString(t.color||"#000"),r.strokeStyle=ol.color.asString(t.color||"#000"),l.circles)for(n=0;n<l.circles.length;n++){var c=l.circles[n];r.beginPath(),r.arc(c[0],c[1],c[2],0,2*Math.PI),l.fill&&r.fill(),l.stroke&&r.stroke()}if(l.repeat||(l.repeat=[[0,0]]),l.char&&(r.font=l.font||l.width+"px Arial",r.textAlign="center",r.textBaseline="middle",l.angle?(r.fillText(l.char,l.width/4,l.height/4),r.fillText(l.char,5*l.width/4,5*l.height/4),r.fillText(l.char,l.width/4,5*l.height/4),r.fillText(l.char,5*l.width/4,l.height/4),r.fillText(l.char,3*l.width/4,3*l.height/4),r.fillText(l.char,-l.width/4,-l.height/4),r.fillText(l.char,3*l.width/4,-l.height/4),r.fillText(l.char,-l.width/4,3*l.height/4)):r.fillText(l.char,l.width/2,l.height/2)),l.lines)for(n=0;n<l.lines.length;n++)for(var h=0;h<l.repeat.length;h++){var p=l.lines[n];r.beginPath(),r.moveTo(p[0]+l.repeat[h][0],p[1]+l.repeat[h][1]);for(var u=2;u<p.length;u+=2)r.lineTo(p[u]+l.repeat[h][0],p[u+1]+l.repeat[h][1]);l.fill&&r.fill(),l.stroke&&r.stroke(),r.save(),r.strokeStyle="red",r.strokeWidth=.1,r.restore()}if(e=r.createPattern(o,"repeat"),t.offset){var d=t.offset;if("number"==typeof d&&(d=[d,d]),d instanceof Array){var g=Math.round(d[0]*i),f=Math.round(d[1]*i);r.scale(1/i,1/i),r.clearRect(0,0,o.width,o.height),r.translate(g,f),r.fillStyle=e,r.fillRect(-g,-f,o.width,o.height),e=r.createPattern(o,"repeat")}}}ol.style.Fill.call(this,{color:e})},ol.ext.inherits(ol.style.FillPattern,ol.style.Fill),ol.style.FillPattern.prototype.clone=function(){var t=ol.style.Fill.prototype.clone.call(this);return t.canvas_=this.canvas_,t},ol.style.FillPattern.prototype.getImage=function(){return this.canvas_},ol.style.FillPattern.prototype.getPattern_=function(t){var e,o=ol.style.FillPattern.prototype.patterns[t.pattern]||ol.style.FillPattern.prototype.patterns.dot,i=Math.round(t.spacing)||10;switch(t.pattern){case"dot":case"circle":e=0===t.size?0:t.size/2||2,t.angle?(i=o.width=o.height=Math.round(1.4*i),o.circles=[[i/4,i/4,e],[3*i/4,3*i/4,e]],"circle"==t.pattern&&(o.circles=o.circles.concat([[i/4+i,i/4,e],[i/4,i/4+i,e],[3*i/4-i,3*i/4,e],[3*i/4,3*i/4-i,e],[i/4+i,i/4+i,e],[3*i/4-i,3*i/4-i,e]]))):(o.width=o.height=i,o.circles=[[i/2,i/2,e]],"circle"==t.pattern&&(o.circles=o.circles.concat([[i/2+i,i/2,e],[i/2-i,i/2,e],[i/2,i/2+i,e],[i/2,i/2-i,e],[i/2+i,i/2+i,e],[i/2+i,i/2-i,e],[i/2-i,i/2+i,e],[i/2-i,i/2-i,e]])));break;case"tile":case"square":e=0===t.size?0:t.size/2||2,t.angle?(o.width=o.height=i,o.lines=[[i/2-e,i/2,i/2,i/2-e,i/2+e,i/2,i/2,i/2+e,i/2-e,i/2]]):(o.width=o.height=i,o.lines=[[i/2-e,i/2-e,i/2+e,i/2-e,i/2+e,i/2+e,i/2-e,i/2+e,i/2-e,i/2-e]]),"square"==t.pattern&&(o.repeat=[[0,0],[0,i],[i,0],[0,-i],[-i,0],[-i,-i],[i,i],[-i,i],[i,-i]]);break;case"cross":t.angle&&(t.angle=45);case"hatch":var r=Math.round(((t.angle||0)-90)%360);r>180&&(r-=360),r*=Math.PI/180;var n=Math.cos(r),s=Math.sin(r);if(Math.abs(s)<1e-4)o.width=o.height=i,o.lines=[[0,.5,i,.5]],o.repeat=[[0,0],[0,i]];else if(Math.abs(n)<1e-4)o.width=o.height=i,o.lines=[[.5,0,.5,i]],o.repeat=[[0,0],[i,0]],"cross"==t.pattern&&(o.lines.push([0,.5,i,.5]),o.repeat.push([0,i]));else{var a=o.width=Math.round(Math.abs(i/s))||1,l=o.height=Math.round(Math.abs(i/n))||1;"cross"==t.pattern?(o.lines=[[-a,-l,2*a,2*l],[2*a,-l,-a,2*l]],o.repeat=[[0,0]]):n*s>0?(o.lines=[[-a,-l,2*a,2*l]],o.repeat=[[0,0],[a,0],[0,l]]):(o.lines=[[2*a,-l,-a,2*l]],o.repeat=[[0,0],[-a,0],[0,l]])}o.stroke=0===t.size?0:t.size||4}return o},ol.style.FillPattern.addPattern=function(t,e){e||(e={}),ol.style.FillPattern.prototype.patterns[t||e.char]={width:e.width||e.size||10,height:e.height||e.size||10,font:e.font,char:e.char,circles:e.circles,lines:e.lines,repeat:e.repeat,stroke:e.stroke,angle:e.angle,fill:e.fill}},ol.style.FillPattern.prototype.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:30,height:20,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]],stroke: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},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},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},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},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=function(t){t||(t={}),ol.style.Style.call(this,{renderer:this._render.bind(this),geometry:t.geometry}),this._visible=!1!==t.visible,"function"==typeof t.width?this._widthFn=t.width:this.setWidth(t.width),this.setWidth2(t.width2),"function"==typeof t.color?this._colorFn=t.color:this.setColor(t.color),this.setColor2(t.color2),this.setLineCap(t.lineCap)},ol.ext.inherits(ol.style.FlowLine,ol.style.Style),ol.style.FlowLine.prototype.setWidth=function(t){this._width=t||0},ol.style.FlowLine.prototype.setWidth2=function(t){this._width2=t},ol.style.FlowLine.prototype.setLineCap=function(t){this._lineCap="round"===t?"round":"mitter"},ol.style.FlowLine.prototype.getWidth=function(t,e){if(this._widthFn)return this._widthFn(t,e);var o="number"==typeof this._width2?this._width2:this._width;return this._width+(o-this._width)*e},ol.style.FlowLine.prototype.setColor=function(t){try{this._color=ol.color.asArray(t)}catch(t){this._color=[0,0,0,1]}},ol.style.FlowLine.prototype.setColor2=function(t){try{this._color2=ol.color.asArray(t)}catch(t){this._color2=null}},ol.style.FlowLine.prototype.getColor=function(t,e){if(this._colorFn)return ol.color.asString(this._colorFn(t,e));var o=this._color,i=this._color2||this._color;return"rgba("+ +Math.round(o[0]+(i[0]-o[0])*e)+","+Math.round(o[1]+(i[1]-o[1])*e)+","+Math.round(o[2]+(i[2]-o[2])*e)+","+(o[3]+(i[3]-o[3])*e)+")"},ol.style.FlowLine.prototype._render=function(t,e){if("LineString"===e.geometry.getType()){var o,i,r=e.context;if(!this._visible){var n=e.pixelRatio/e.resolution,s=e.geometry.getCoordinates(),a=t[0][0]-s[0][0]*n,l=t[0][1]+s[0][1]*n;for(t=[],o=0;i=s[o];o++)t[o]=[a+i[0]*n,l-i[1]*n]}var c=this._splitInto(t,255,2),h=0,p=c.length;r.save(),r.lineJoin="round",r.lineCap=this._lineCap||"mitter",c.forEach(function(t){var n=h++/p;for(r.lineWidth=this.getWidth(e.feature,n)*e.pixelRatio,r.strokeStyle=this.getColor(e.feature,n),r.beginPath(),r.moveTo(t[0][0],t[0][1]),o=1;i=t[o];o++)r.lineTo(i[0],i[1]),r.stroke()}.bind(this)),r.restore()}},ol.style.FlowLine.prototype._splitInto=function(t,e,o){var i,r,n,s=[],a=0;for(i=1;r=t[i];i++)a+=ol.coordinate.dist2d(t[i-1],r);var l=Math.max(o||2,a/(e||255)),c=t[0];a=0;var h=[c];for(i=1,r=t[1];i<t.length;){var p=r[0]-c[0],u=r[1]-c[1];if(a+(n=Math.sqrt(p*p+u*u))>l){var d=(l-a)/n;h.push([c[0]+p*d,c[1]+u*d]),s.push(h),h=[c=[c[0]+p*d*.9,c[1]+u*d*.9]],a=0}else a+=n,c=r,h.push(c),r=t[++i]}return s.push(h),s},ol.style.FontSymbol=function(t){var e=0;(t=t||{}).stroke&&(e=t.stroke.getWidth()),ol.style.RegularShape.call(this,{radius:t.radius,fill:t.fill,rotation:t.rotation,rotateWithView:t.rotateWithView}),"number"==typeof t.opacity&&this.setOpacity(t.opacity),this.color_=t.color,this.fontSize_=t.fontSize||1,this.fontStyle_=t.fontStyle||"",this.stroke_=t.stroke,this.fill_=t.fill,this.radius_=t.radius-e,this.form_=t.form||"none",this.gradient_=t.gradient,this.offset_=[t.offsetX?t.offsetX:0,t.offsetY?t.offsetY:0],this.glyph_=this.getGlyph(t.glyph)||"",this.renderMarker_()},ol.ext.inherits(ol.style.FontSymbol,ol.style.RegularShape),ol.style.Image.prototype.getImagePNG=function(){var t=this.getImage();if(!t)return!1;try{return t.toDataURL("image/png")}catch(t){return!1}},ol.style.FontSymbol.prototype.defs={fonts:{},glyphs:{}},ol.style.FontSymbol.addDefs=function(t,e){var o=t;if("string"==typeof t&&(o={font:t,name:t,copyright:""}),o.font&&"string"==typeof o.font){var i=o.font;for(var r in ol.style.FontSymbol.prototype.defs.fonts[i]=o,e){var n=e[r];"string"==typeof n&&1==n.length&&(n={char:n}),ol.style.FontSymbol.prototype.defs.glyphs[r]={font:o.font,char:n.char||""+String.fromCharCode(n.code)||"",theme:n.theme||o.name,name:n.name||r,search:n.search||""}}}else console.log("bad font def")},ol.style.FontSymbol.prototype.clone=function(){var t=new ol.style.FontSymbol({glyph:"",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 t.setScale(this.getScale()),t.glyph_=this.glyph_,t.renderMarker_(),t},ol.style.FontSymbol.prototype.getFill=function(){return this.fill_},ol.style.FontSymbol.prototype.getStroke=function(){return this.stroke_},ol.style.FontSymbol.prototype.getGlyph=function(t){return t?ol.style.FontSymbol.prototype.defs.glyphs[t]||{font:"none",char:t.charAt(0),theme:"none",name:"none",search:""}:this.glyph_},ol.style.FontSymbol.prototype.getGlyphName=function(){for(var t in ol.style.FontSymbol.prototype.defs.glyphs)if(ol.style.FontSymbol.prototype.defs.glyphs[t]===this.glyph_)return t;return""},ol.style.FontSymbol.prototype.getFontInfo=function(t){return ol.style.FontSymbol.prototype.defs.fonts[t.font]},ol.style.FontSymbol.prototype.renderMarker_=function(){var t,e=0;this.stroke_&&(t=ol.color.asString(this.stroke_.getColor()),e=this.stroke_.getWidth());var o=this.getImage(),i={strokeStyle:t,strokeWidth:e,size:o.width},r=o.getContext("2d");r.clearRect(0,0,o.width,o.height),this.drawMarker_(i,r,0,0);var n=this.getAnchor();n[0]=o.width/2-this.offset_[0],n[1]=o.width/2-this.offset_[1]},ol.style.FontSymbol.prototype.drawPath_=function(t,e){var o=2*this.radius_+t.strokeWidth+1,i=t.strokeWidth/2,r=t.size/2,n={fac:1,posX:t.size/2,posY:t.size/2};switch(e.lineJoin="round",e.beginPath(),this.form_){case"none":n.fac=1;break;case"circle":case"ban":e.arc(r,r,o/2,0,2*Math.PI,!0);break;case"poi":e.arc(r,r-.4*this.radius_,.6*this.radius_,.15*Math.PI,.85*Math.PI,!0),e.lineTo(r-.89*.05*o,(.95+.45*.05)*o+i),e.arc(r,.95*o+i,.05*o,.85*Math.PI,.15*Math.PI,!0),n={fac:.45,posX:r,posY:r-.35*this.radius_};break;case"bubble":e.arc(r,r-.2*this.radius_,.8*this.radius_,.4*Math.PI,.6*Math.PI,!0),e.lineTo(.5*o+i,o+i),n={fac:.7,posX:r,posY:r-.2*this.radius_};break;case"marker":e.arc(r,r-.2*this.radius_,.8*this.radius_,.25*Math.PI,.75*Math.PI,!0),e.lineTo(.5*o+i,o+i),n={fac:.7,posX:r,posY:r-.2*this.radius_};break;case"coma":e.moveTo(r+.8*this.radius_,r-.2*this.radius_),e.quadraticCurveTo(.95*o+i,.75*o+i,.5*o+i,o+i),e.arc(r,r-.2*this.radius_,.8*this.radius_,.45*Math.PI,0,!1),n={fac:.7,posX:r,posY:r-.2*this.radius_};break;default:var s;switch(this.form_){case"shield":s=[.05,0,.95,0,.95,.8,.5,1,.05,.8,.05,0],n.posY=.45*o+i;break;case"blazon":s=[.1,0,.9,0,.9,.8,.6,.8,.5,1,.4,.8,.1,.8,.1,0],n.fac=.8,n.posY=.4*o+i;break;case"bookmark":s=[.05,0,.95,0,.95,1,.5,.8,.05,1,.05,0],n.fac=.9,n.posY=.4*o+i;break;case"hexagon":s=[.05,.2,.5,0,.95,.2,.95,.8,.5,1,.05,.8,.05,.2],n.fac=.9,n.posY=.5*o+i;break;case"diamond":s=[.25,0,.75,0,1,.2,1,.4,.5,1,0,.4,0,.2,.25,0],n.fac=.75,n.posY=.35*o+i;break;case"triangle":s=[0,0,1,0,.5,1,0,0],n.fac=.6,n.posY=.3*o+i;break;case"sign":s=[.5,.05,1,.95,0,.95,.5,.05],n.fac=.7,n.posY=.65*o+i;break;case"lozenge":s=[.5,0,1,.5,.5,1,0,.5,.5,0],n.fac=.7;break;case"square":default:s=[0,0,1,0,1,1,0,1,0,0]}for(var a=0;a<s.length;a+=2)e.lineTo(s[a]*o+i,s[a+1]*o+i)}return e.closePath(),n},ol.style.FontSymbol.prototype.drawMarker_=function(t,e,o,i){var r=this.fill_?this.fill_.getColor():"#000",n=this.stroke_?this.stroke_.getColor():"#000";"none"==this.form_&&this.stroke_&&this.fill_&&(n=this.fill_.getColor(),r=this.stroke_.getColor()),e.setTransform(1,0,0,1,0,0),e.translate(o,i);var s=this.drawPath_(t,e);if(this.fill_){if(this.gradient_&&"none"!=this.form_){var a=e.createLinearGradient(0,0,t.size/2,t.size);a.addColorStop(1,ol.color.asString(r)),a.addColorStop(0,ol.color.asString(n)),e.fillStyle=a}else e.fillStyle=ol.color.asString(r);e.fill()}if(this.stroke_&&t.strokeWidth&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,e.stroke()),this.glyph_.char){e.font=this.fontStyle_+" "+2*s.fac*this.radius_*this.fontSize_+"px "+this.glyph_.font,e.strokeStyle=e.fillStyle,e.lineWidth=t.strokeWidth*("none"==this.form_?2:1),e.fillStyle=ol.color.asString(this.color_||n),e.textAlign="center",e.textBaseline="middle";var l=this.glyph_.char;t.strokeWidth&&"transparent"!=n&&e.strokeText(l,s.posX,s.posY),e.fillText(l,s.posX,s.posY)}if("ban"==this.form_&&this.stroke_&&t.strokeWidth){e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth;var c=this.radius_+t.strokeWidth,h=this.radius_*Math.cos(Math.PI/4);e.moveTo(c+h,c-h),e.lineTo(c-h,c+h),e.stroke()}},ol.style.FontSymbol.prototype.getChecksum=function(){var t=null!==this.stroke_?this.stroke_.getChecksum():"-",e=null!==this.fill_?this.fill_.getChecksum():"-";if(null===this.checksums_||t!=this.checksums_[1]||e!=this.checksums_[2]||this.radius_!=this.checksums_[3]||this.form_+"-"+this.glyphs_!=this.checksums_[4]){var o="c"+t+e+(void 0!==this.radius_?this.radius_.toString():"-")+this.form_+"-"+this.glyphs_;this.checksums_=[o,t,e,this.radius_,this.form_+"-"+this.glyphs_]}return this.checksums_[0]},ol.style.Photo=function(t){t=t||{},this.sanchor_="anchored"==t.kind?8:0,this.shadow_=Number(t.shadow)||0,t.stroke||(t.stroke=new ol.style.Stroke({width:0,color:"#000"}));var e=t.stroke.getWidth();if(e<0&&(e=0),"folio"==t.kind&&(e+=6),t.stroke.setWidth(e),ol.style.RegularShape.call(this,{radius:t.radius+e+this.sanchor_/2+this.shadow_/2,points:0}),!this.hitDetectionCanvas_){var o=this.getImage();for(var i in this)if(this[i]&&this[i].getContext&&this[i]!==o){this.hitDetectionCanvas_=this[i];break}}this.stroke_=t.stroke,this.fill_=t.fill,this.crop_=t.crop,this.crossOrigin_=t.crossOrigin,this.kind_=t.kind||"default",this.radius_=t.radius,this.src_=t.src,this.offset_=[t.offsetX?t.offsetX:0,t.offsetY?t.offsetY:0],this.onload_=t.onload,"number"==typeof t.opacity&&this.setOpacity(t.opacity),"number"==typeof t.rotation&&this.setRotation(t.rotation),this.renderPhoto_()},ol.ext.inherits(ol.style.Photo,ol.style.RegularShape),ol.style.Photo.prototype.clone=function(){return new ol.style.Photo({stroke:this.stroke_,fill:this.fill_,shadow:this.shadow_,crop:this.crop_,crossOrigin:this.crossOrigin_,kind:this.kind_,radius:this.radius_,src:this.src_,offsetX:this.offset_[0],offsetY:this.offset_[1],opacity:this.getOpacity(),rotation:this.getRotation()})},CanvasRenderingContext2D.prototype.roundRect=function(t,e,o,i,r){return r?(o<2*r&&(r=o/2),i<2*r&&(r=i/2),this.beginPath(),this.moveTo(t+r,e),this.arcTo(t+o,e,t+o,e+i,r),this.arcTo(t+o,e+i,t,e+i,r),this.arcTo(t,e+i,t,e,r),this.arcTo(t,e,t+o,e,r),this.closePath()):this.rect(t,e,o,i),this},ol.style.Photo.prototype.drawBack_=function(t,e,o){var i=t.canvas;switch(t.beginPath(),t.fillStyle=e,t.clearRect(0,0,i.width,i.height),this.kind_){case"square":t.rect(0,0,i.width-this.shadow_,i.height-this.shadow_);break;case"circle":t.arc(this.radius_+o,this.radius_+o,this.radius_+o,0,2*Math.PI,!1);break;case"folio":o-=6,t.strokeStyle="rgba(0,0,0,0.5)";var r=i.width-this.shadow_-12,n=Math.atan(6/r);t.save(),t.rotate(-n),t.translate(-6,2),t.beginPath(),t.rect(6,6,r,r),t.stroke(),t.fill(),t.restore(),t.save(),t.translate(6,-1),t.rotate(n),t.beginPath(),t.rect(6,6,r,r),t.stroke(),t.fill(),t.restore(),t.beginPath(),t.rect(6,6,r,r),t.stroke();break;case"anchored":t.roundRect(this.sanchor_/2,0,i.width-this.sanchor_-this.shadow_,i.height-this.sanchor_-this.shadow_,o),t.moveTo(i.width/2-this.sanchor_-this.shadow_/2,i.height-this.sanchor_-this.shadow_),t.lineTo(i.width/2+this.sanchor_-this.shadow_/2,i.height-this.sanchor_-this.shadow_),t.lineTo(i.width/2-this.shadow_/2,i.height-this.shadow_);break;default:t.roundRect(0,0,i.width-this.shadow_,i.height-this.shadow_,o)}t.closePath()},ol.style.Photo.prototype.renderPhoto_=function(){var t,e=0;this.stroke_&&(t=ol.color.asString(this.stroke_.getColor()),e=this.stroke_.getWidth());var o=this.getImage(),i=this.hitDetectionCanvas_.getContext("2d");this.drawBack_(i,"#000",e),i.fill(),i=o.getContext("2d"),this.drawBack_(i,t,e),this.shadow_&&(i.shadowColor="rgba(0,0,0,0.5)",i.shadowBlur=this.shadow_/2,i.shadowOffsetX=this.shadow_/2,i.shadowOffsetY=this.shadow_/2),i.fill(),i.shadowColor="transparent";var r=this,n=this.img_=new Image;this.crossOrigin_&&(n.crossOrigin=this.crossOrigin_),n.src=this.src_,n.width?r.drawImage_(n):n.onload=function(){r.drawImage_(n),r.onload_&&r.onload_()};var s=this.getAnchor();s[0]=(o.width-this.shadow_)/2,s[1]=(o.height-this.shadow_)/2,this.sanchor_&&(s[1]=o.height-this.shadow_)},ol.style.Photo.prototype.drawImage_=function(t){var e=this.getImage().getContext("2d"),o=0;this.stroke_&&(o=this.stroke_.getWidth());var i,r,n,s,a,l,c,h,p,u=2*this.radius_;e.save(),"circle"==this.kind_&&(e.beginPath(),e.arc(this.radius_+o,this.radius_+o,this.radius_,0,2*Math.PI,!1),e.clip()),this.crop_?(h=p=(i=Math.min(t.width/u,t.height/u))*u,l=(t.width-h)/2,c=(t.height-p)/2,r=n=0,s=a=u+1):(l=c=0,r=(u-(s=(i=Math.min(u/t.width,u/t.height))*(h=t.width)))/2,n=(u-(a=i*(p=t.height)))/2),r+=o+this.sanchor_/2,n+=o,e.drawImage(t,l,c,h,p,r,n,s,a),e.restore(),"circle"==this.kind_&&o&&(e.beginPath(),e.strokeStyle=ol.color.asString(this.stroke_.getColor()),e.lineWidth=o/4,e.arc(this.radius_+o,this.radius_+o,this.radius_,0,2*Math.PI,!1),e.stroke())},ol.style.Photo.prototype.getChecksum=function(){var t=null!==this.stroke_?this.stroke_.getChecksum():"-",e=null!==this.fill_?this.fill_.getChecksum():"-";if(null===this.checksums_||t!=this.checksums_[1]||e!=this.checksums_[2]||this.radius_!=this.checksums_[3]){var o="c"+t+e+(void 0!==this.radius_?this.radius_.toString():"-");this.checksums_=[o,t,e,this.radius_]}return this.checksums_[0]},function(){ol.layer.Vector.prototype.setTextPathStyle=function(t,e){if(null===t)return this.textPath_&&this.unByKey(this.textPath_),this.textPath_=null,void this.changed();this.textPath_||(this.textPath_=this.on(["postcompose","postrender"],function(t){if(!(t.frameState.viewState.resolution>this.textPathMaxResolution_)){var e,o=t.frameState.extent,i=t.frameState.coordinateToPixelTransform,r=t.context;r.save(),r.scale(t.frameState.pixelRatio,t.frameState.pixelRatio);for(var n,s=this.getSource().getFeaturesInExtent(o),a=0;n=s[a];a++)for(var l,c=this.textPathStyle_(n,t.frameState.viewState.resolution),h=0;l=c[h];h++){var p,u=l.getGeometry()||n.getGeometry();switch(u.getType()){case"LineString":p=u.getCoordinates();break;case"MultiLineString":p=u.getLineString(0).getCoordinates();break;default:continue}var d=l.getText(),g=f(p,d.getRotateWithView());r.font=d.getFont(),r.textBaseline=d.getTextBaseline(),r.textAlign=d.getTextAlign(),r.lineWidth=d.getStroke()&&d.getStroke().getWidth()||0,r.strokeStyle=d.getStroke()&&d.getStroke().getColor()||"#fff",r.fillStyle=d.getFill()&&d.getFill().getColor()||"#000",r.textJustify="justify"==d.getTextAlign(),r.textOverflow=d.getTextOverflow?d.getTextOverflow():"",r.minWidth=d.getMinWidth?d.getMinWidth():0,r.textPath(d.getText()||n.get("name"),g)}r.restore()}function f(t,o){var r=[];for(e=0;e<t.length;e++)r.push(i[0]*t[e][0]+i[1]*t[e][1]+i[4]),r.push(i[2]*t[e][0]+i[3]*t[e][1]+i[5]);if(o&&r[0]>r[r.length-2]){var n=[];for(e=r.length-2;e>=0;e-=2)n.push(r[e]),n.push(r[e+1]);return n}return r}}.bind(this))),void 0===t&&(t=[new ol.style.Style({text:new ol.style.Text})]),this.textPathStyle_="function"==typeof t?t:function(){return t},this.textPathMaxResolution_=Number(e)||Number.MAX_VALUE,this.changed()},ol.style.TextPath=function(t){t||(t={}),ol.style.Text.call(this,t),this.textOverflow_=void 0!==t.textOverflow?t.textOverflow:"visible",this.minWidth_=t.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(t,e){var o=this;function i(t,e,o,i){var r=o-t,n=i-e;return Math.sqrt(r*r+n*n)}var r,n=0,s=2;function a(t,e){if(!r||n+r<e)for(;s<t.length&&(r=i(t[s-2],t[s-1],t[s],t[s+1]),!(n+r>e))&&!((s+=2)>=t.length);)n+=r;var o,a,l,c=e-n;return s>=t.length&&(s=t.length-2),c?(o=t[s-2]+(t[s]-t[s-2])*c/r,a=t[s-1]+(t[s+1]-t[s-1])*c/r,l=Math.atan2(t[s+1]-t[s-1],t[s]-t[s-2])):(o=t[s-2],a=t[s-1],l=Math.atan2(t[s+1]-t[s-1],t[s]-t[s-2])),[o,a,l]}for(var l=.25*o.measureText(" ").width,c=0,h=0,p=2;p<e.length;p+=2)h+=i(e[p-2],e[p-1],e[p],e[p+1]);if(!(h<o.minWidth)){var u=t.split(" ").length-1;if("visible"!=o.textOverflow&&h<o.measureText(t).width+(t.length-1+u)*l){var d="ellipsis"==o.textOverflow?"…":o.textOverflow;do{u=t.split(" ").length-1,t=t.slice(0,t.length-1)}while(t&&h<o.measureText(t+d).width+(t.length+d.length-1+u)*l);t+=d}switch(o.textJustify||o.textAlign){case!0:case"center":case"end":case"right":o.textJustify?(c=0,l=(h-o.measureText(t).width)/(t.length-1+u)):(c=h-o.measureText(t).width-(t.length+u)*l,"center"==o.textAlign&&(c/=2))}for(var g=0;g<t.length;g++){var f=t[g],m=o.measureText(f).width,y=a(e,c+m/2);o.save(),o.textAlign="center",o.translate(y[0],y[1]),o.rotate(y[2]),o.lineWidth&&o.strokeText(f,0,0),o.fillText(f,0,0),o.restore(),c+=m+l*(" "==f?2:1)}}},ol.style.Shadow=function(t){(t=t||{}).fill||(t.fill=new ol.style.Fill({color:"rgba(0,0,0,0.5)"})),ol.style.RegularShape.call(this,{radius:t.radius,fill:t.fill}),this.fill_=t.fill,this.radius_=t.radius,this.blur_=0===t.blur?0:t.blur||t.radius/3,this.offset_=[t.offsetX?t.offsetX:0,t.offsetY?t.offsetY:0],this.renderShadow_()},ol.ext.inherits(ol.style.Shadow,ol.style.RegularShape),ol.style.Shadow.prototype.clone=function(){var t=new ol.style.Shadow({fill:this.fill_,radius:this.radius_,blur:this.blur_,offsetX:this.offset_[0],offsetY:this.offset_[1]});return t.setScale(this.getScale()),t.setOpacity(this.getOpacity()),t},ol.style.Shadow.prototype.renderShadow_=function(){var t=this.radius_,e=this.getImage();[e.width,e.height][1]=t;var o=e.getContext("2d");o.beginPath(),o.clearRect(0,0,e.width,e.height),o.scale(1,.5),o.arc(t,-t,t-this.blur_,0,2*Math.PI,!1),o.fillStyle="#000",o.shadowColor=this.fill_.getColor(),o.shadowBlur=.7*this.blur_,o.shadowOffsetX=0,o.shadowOffsetY=1.5*t,o.closePath(),o.fill(),o.shadowColor="transparent";var i=this.getAnchor();i[0]=e.width/2-this.offset_[0],i[1]=e.height/2-this.offset_[1]},ol.style.Shadow.prototype.getChecksum=function(){var t=null!==this.stroke_?this.stroke_.getChecksum():"-",e=null!==this.fill_?this.fill_.getChecksum():"-";if(null===this.checksums_||t!=this.checksums_[1]||e!=this.checksums_[2]||this.radius_!=this.checksums_[3]||this.form_+"-"+this.glyphs_!=this.checksums_[4]){var o="c"+t+e+(void 0!==this.radius_?this.radius_.toString():"-")+this.form_+"-"+this.glyphs_;this.checksums_=[o,t,e,this.radius_,this.form_+"-"+this.glyphs_]}return this.checksums_[0]},ol.style.StrokePattern=function(t){var e,o;t||(t={});var i=this.canvas_=document.createElement("canvas"),r=(Number(t.scale)>0?Number(t.scale):1)*ol.has.DEVICE_PIXEL_RATIO||ol.has.DEVICE_PIXEL_RATIO,n=i.getContext("2d");if(t.image){t.image.load();var s=t.image.getImage();if(s.width)i.width=Math.round(s.width*r),i.height=Math.round(s.height*r),n.globalAlpha="number"==typeof t.opacity?t.opacity:1,n.drawImage(s,0,0,s.width,s.height,0,0,i.width,i.height),e=n.createPattern(i,"repeat");else{var a=this;e=[0,0,0,0],s.onload=function(){i.width=Math.round(s.width*r),i.height=Math.round(s.height*r),n.globalAlpha="number"==typeof t.opacity?t.opacity:1,n.drawImage(s,0,0,s.width,s.height,0,0,i.width,i.height),e=n.createPattern(i,"repeat"),a.setColor(e)}}}else{var l=this.getPattern_(t);if(i.width=Math.round(l.width*r),i.height=Math.round(l.height*r),n.beginPath(),t.fill&&(n.fillStyle=ol.color.asString(t.fill.getColor()),n.fillRect(0,0,i.width,i.height)),n.scale(r,r),n.lineCap="round",n.lineWidth=l.stroke||1,n.fillStyle=ol.color.asString(t.color||"#000"),n.strokeStyle=ol.color.asString(t.color||"#000"),l.circles)for(o=0;o<l.circles.length;o++){var c=l.circles[o];n.beginPath(),n.arc(c[0],c[1],c[2],0,2*Math.PI),l.fill&&n.fill(),l.stroke&&n.stroke()}if(l.repeat||(l.repeat=[[0,0]]),l.char&&(n.font=l.font||l.width+"px Arial",n.textAlign="center",n.textBaseline="middle",l.angle?(n.fillText(l.char,l.width/4,l.height/4),n.fillText(l.char,5*l.width/4,5*l.height/4),n.fillText(l.char,l.width/4,5*l.height/4),n.fillText(l.char,5*l.width/4,l.height/4),n.fillText(l.char,3*l.width/4,3*l.height/4),n.fillText(l.char,-l.width/4,-l.height/4),n.fillText(l.char,3*l.width/4,-l.height/4),n.fillText(l.char,-l.width/4,3*l.height/4)):n.fillText(l.char,l.width/2,l.height/2)),l.lines)for(o=0;o<l.lines.length;o++)for(var h=0;h<l.repeat.length;h++){var p=l.lines[o];n.beginPath(),n.moveTo(p[0]+l.repeat[h][0],p[1]+l.repeat[h][1]);for(var u=2;u<p.length;u+=2)n.lineTo(p[u]+l.repeat[h][0],p[u+1]+l.repeat[h][1]);l.fill&&n.fill(),l.stroke&&n.stroke(),n.save(),n.strokeStyle="red",n.strokeWidth=.1,n.restore()}if(e=n.createPattern(i,"repeat"),t.offset){var d=t.offset;if("number"==typeof d&&(d=[d,d]),d instanceof Array){var g=Math.round(d[0]*r),f=Math.round(d[1]*r);n.scale(1/r,1/r),n.clearRect(0,0,i.width,i.height),n.translate(g,f),n.fillStyle=e,n.fillRect(-g,-f,i.width,i.height),e=n.createPattern(i,"repeat")}}}t.color=e,ol.style.Stroke.call(this,t)},ol.ext.inherits(ol.style.StrokePattern,ol.style.Stroke),ol.style.StrokePattern.prototype.clone=function(){var t=ol.style.Fill.prototype.clone.call(this);return t.canvas_=this.canvas_,t},ol.style.StrokePattern.prototype.getImage=function(){return this.canvas_},ol.style.StrokePattern.prototype.getPattern_=function(t){var e,o=ol.style.FillPattern.prototype.patterns[t.pattern]||ol.style.FillPattern.prototype.patterns.dot,i=Math.round(t.spacing)||10;switch(t.pattern){case"dot":case"circle":e=0===t.size?0:t.size/2||2,t.angle?(i=o.width=o.height=Math.round(1.4*i),o.circles=[[i/4,i/4,e],[3*i/4,3*i/4,e]],"circle"==t.pattern&&(o.circles=o.circles.concat([[i/4+i,i/4,e],[i/4,i/4+i,e],[3*i/4-i,3*i/4,e],[3*i/4,3*i/4-i,e],[i/4+i,i/4+i,e],[3*i/4-i,3*i/4-i,e]]))):(o.width=o.height=i,o.circles=[[i/2,i/2,e]],"circle"==t.pattern&&(o.circles=o.circles.concat([[i/2+i,i/2,e],[i/2-i,i/2,e],[i/2,i/2+i,e],[i/2,i/2-i,e],[i/2+i,i/2+i,e],[i/2+i,i/2-i,e],[i/2-i,i/2+i,e],[i/2-i,i/2-i,e]])));break;case"tile":case"square":e=0===t.size?0:t.size/2||2,t.angle?(o.width=o.height=i,o.lines=[[i/2-e,i/2,i/2,i/2-e,i/2+e,i/2,i/2,i/2+e,i/2-e,i/2]]):(o.width=o.height=i,o.lines=[[i/2-e,i/2-e,i/2+e,i/2-e,i/2+e,i/2+e,i/2-e,i/2+e,i/2-e,i/2-e]]),"square"==t.pattern&&(o.repeat=[[0,0],[0,i],[i,0],[0,-i],[-i,0],[-i,-i],[i,i],[-i,i],[i,-i]]);break;case"cross":t.angle&&(t.angle=45);case"hatch":var r=Math.round(((t.angle||0)-90)%360);r>180&&(r-=360),r*=Math.PI/180;var n=Math.cos(r),s=Math.sin(r);if(Math.abs(s)<1e-4)o.width=o.height=i,o.lines=[[0,.5,i,.5]],o.repeat=[[0,0],[0,i]];else if(Math.abs(n)<1e-4)o.width=o.height=i,o.lines=[[.5,0,.5,i]],o.repeat=[[0,0],[i,0]],"cross"==t.pattern&&(o.lines.push([0,.5,i,.5]),o.repeat.push([0,i]));else{var a=o.width=Math.round(Math.abs(i/s))||1,l=o.height=Math.round(Math.abs(i/n))||1;"cross"==t.pattern?(o.lines=[[-a,-l,2*a,2*l],[2*a,-l,-a,2*l]],o.repeat=[[0,0]]):n*s>0?(o.lines=[[-a,-l,2*a,2*l]],o.repeat=[[0,0],[a,0],[0,l]]):(o.lines=[[2*a,-l,-a,2*l]],o.repeat=[[0,0],[-a,0],[0,l]])}o.stroke=0===t.size?0:t.size||4}return o};