diff --git a/static/dist/layer.js b/static/dist/layer.js index cebedd58..b797ee79 100644 --- a/static/dist/layer.js +++ b/static/dist/layer.js @@ -1,4 +1,4 @@ -/*! @maps4html/web-map-custom-element 27-03-2024 */ +/*! @maps4html/web-map-custom-element 01-04-2024 */ import"./leaflet.js";import"./mapml.js";class MapLayer extends HTMLElement{static get observedAttributes(){return["src","label","checked","hidden","opacity"]}#hasConnected;get src(){return this.hasAttribute("src")?this.getAttribute("src"):""}set src(e){e&&this.setAttribute("src",e)}get label(){return this._layer?this._layer.getName():this.hasAttribute("label")?this.getAttribute("label"):""}set label(e){e&&this.setAttribute("label",e)}get checked(){return this.hasAttribute("checked")}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked")}get hidden(){return this.hasAttribute("hidden")}set hidden(e){e?this.setAttribute("hidden",""):this.removeAttribute("hidden")}get opacity(){return+(this._opacity??this.getAttribute("opacity"))}set opacity(e){1<+e||+e<0||this.setAttribute("opacity",e)}get extent(){return this._layer&&!this._layer.bounds&&this._layer._calculateBounds(),this._layer?Object.assign(M._convertAndFormatPCRS(this._layer.bounds,M[this.getProjection()],this.getProjection()),{zoom:this._layer.zoomBounds}):null}attributeChangedCallback(e,t,r){if(this.#hasConnected)switch(e){case"label":this._layer.setName(r);break;case"checked":"string"==typeof r?this.parentElement._map.addLayer(this._layer):this.parentElement._map.removeLayer(this._layer),this._layerControlCheckbox.checked=this.checked,this.dispatchEvent(new CustomEvent("map-change"));break;case"hidden":"string"==typeof r?this._layerControl.removeLayer(this._layer):(this._layerControl.addOrUpdateOverlay(this._layer,this.label),this._validateDisabled());break;case"opacity":t!==r&&this._layer&&(this._opacity=r,this._layer.changeOpacity(r));break;case"src":t!==r&&(this._onRemove(),this.isConnected&&this._onAdd())}}constructor(){super(),this._opacity=this.opacity||1,this._renderingMapContent=M.options.contentPreference,this.attachShadow({mode:"open"})}disconnectedCallback(){this.hasAttribute("data-moving")||this._onRemove()}_onRemove(){this._observer&&this._observer.disconnect();let e=this._layer,t=this._layerControl;this._layerControlHTML;delete this._layer,delete this._layerControl,delete this._layerControlHTML,delete this._fetchError,this.shadowRoot.innerHTML="",this.src&&(this.innerHTML=""),e&&e.off(),e&&e._map&&e._map.removeLayer(e),t&&!this.hidden&&t.removeLayer(e)}connectedCallback(){if(!this.hasAttribute("data-moving")){this.#hasConnected=!0,this._createLayerControlHTML=M._createLayerControlHTML.bind(this);const e=this._onAdd.bind(this),t=this._onRemove.bind(this);this.parentElement.whenReady().then(()=>{t(),e()}).catch(e=>{throw new Error("Map never became ready: "+e)})}}_onAdd(){new Promise((e,a)=>{this.addEventListener("changestyle",function(e){e.stopPropagation(),e.detail&&(this._renderingMapContent=e.detail._renderingMapContent,this.src=e.detail.src)},{once:!0}),this.addEventListener("zoomchangesrc",function(e){e.stopPropagation(),this.src=e.detail.href},{once:!0});let t=this.baseURI||document.baseURI;const r=new Headers;if(r.append("Accept","text/mapml"),this.src)fetch(this.src,{headers:r}).then(e=>{if(!e.ok)throw new Error("HTTP error! Status: "+e.status);return e.text()}).then(e=>{let t=(new DOMParser).parseFromString(e,"text/xml");if(t.querySelector("parsererror")||!t.querySelector("mapml-"))throw this._fetchError=!0,console.log("Error fetching layer content:\n\n"+e+"\n"),new Error("Parser error");return t}).then(e=>{this.copyRemoteContentToShadowRoot(e.querySelector("mapml-"));let t=this.shadowRoot.querySelectorAll("*"),r=[];for(let e=0;e{this.selectAlternateOrChangeProjection(),this.checkForPreferredContent()}).then(()=>{this._layer=M.mapMLLayer(new URL(this.src,t).href,this,{projection:this.getProjection(),opacity:this.opacity}),this._createLayerControlHTML(),this._attachedToMap(),this._runMutationObserver(this.shadowRoot.children),this._bindMutationObserver(),this._validateDisabled(),this.dispatchEvent(new CustomEvent("loadedmetadata",{detail:{target:this}})),e()}).catch(e=>{a(e)});else{let t=this.querySelectorAll("*"),r=[];for(let e=0;e{this.selectAlternateOrChangeProjection(),this.checkForPreferredContent()}).then(()=>{this._layer=M.mapMLLayer(null,this,{projection:this.getProjection(),opacity:this.opacity}),this._createLayerControlHTML(),this._attachedToMap(),this._runMutationObserver(this.children),this._bindMutationObserver(),this._validateDisabled(),this.dispatchEvent(new CustomEvent("loadedmetadata",{detail:{target:this}})),e()}).catch(e=>{a(e)})}}).catch(e=>{"changeprojection"===e.message?e.cause.href?(console.log("Changing layer src to: "+e.cause.href),this.src=e.cause.href):e.cause.mapprojection&&(console.log("Changing map projection to match layer: "+e.cause.mapprojection),this.parentElement.projection=e.cause.mapprojection):"findmatchingpreferredcontent"===e.message?e.cause.href&&(console.log("Changing layer to matching preferred content at: "+e.cause.href),this.src=e.cause.href):"Failed to fetch"===e.message?this._fetchError=!0:(console.log(e),this.dispatchEvent(new CustomEvent("error",{detail:{target:this}})))})}selectAlternateOrChangeProjection(){let e=this.src?this.shadowRoot:this,t=this.getProjection()!==this.parentElement.projection&&e.querySelector("map-link[rel=alternate][projection="+this.parentElement.projection+"][href]");if(t){var r=new URL(t.getAttribute("href"),t.getBase()).href;throw new Error("changeprojection",{cause:{href:r}})}r=this.getProjection();if(r!==this.parentElement.projection&&1===this.parentElement.layers.length)throw new Error("changeprojection",{cause:{mapprojection:r}})}checkForPreferredContent(){let e=this.src?this.shadowRoot:this,t=e.querySelector(`map-link[rel="style"][media="prefers-map-content=${this._renderingMapContent}"][href]`);if(t){var r=new URL(t.getAttribute("href"),t.getBase()).href;throw new Error("findmatchingpreferredcontent",{cause:{href:r}})}}copyRemoteContentToShadowRoot(e){let t=this.shadowRoot,r=document.createDocumentFragment();var a=e.querySelectorAll("map-head > *, map-body > *");for(let e=0;e{var r=t[0].attributes.units.value;let a=!0;for(let e=0;e{this.whenReady().then(()=>{delete this._layer.bounds,e.addFeature(this._layer._mapmlvectors)})},i=e=>{this.whenReady().then(()=>{this._layer.appendStyleLink(e)})},s=e=>{this.whenReady().then(()=>{this._layer.appendStyleElement(e)})},o=e=>{this.whenReady().then(()=>{delete this._layer.bounds,this._validateDisabled()})};let n=this.src?this.shadowRoot:this,h=n instanceof ShadowRoot?":host":":scope";var l=e=>{this.whenReady().then(()=>{this._layer._calculateBounds(),this._validateDisabled()})};for(let t=0;t [name=${e.getAttribute("name")}]`)&&e.hasAttribute("content")&&l(e)}}}_bindMutationObserver(){this._observer=new MutationObserver(e=>{for(var t of e)"childList"===t.type&&this._runMutationObserver(t.addedNodes)}),this._observer.observe(this.src?this.shadowRoot:this,{childList:!0})}_attachedToMap(){for(var e=0,t=1,r=this.parentNode.children;e{let s=this._layer,e=s?._map;if(e){this._validateLayerZoom({zoom:e.getZoom()});const o=(this.src?this.shadowRoot:this).querySelectorAll("map-extent");let t=[];for(let e=0;e{let t=0,r=0,a=["_staticTileLayer","_mapmlvectors","_extentLayer"];for(let e=0;e{console.log(e)})}},0)}_validateLayerZoom(e){var t=e.zoom,r=this.extent.zoom.minZoom,a=this.extent.zoom.maxZoom,i=(this.src?this.shadowRoot:this).querySelector("map-link[rel=zoomin]"),e=(this.src?this.shadowRoot:this).querySelector("map-link[rel=zoomout]");let s;r<=t&&t<=a||(i&&a{e.disabled=!0}))):(e.disabled=!1,a.disabled=!1,t.style.fontStyle="normal",r.style.fontStyle="normal",i&&(i.style.fontStyle="normal",i.querySelectorAll("input").forEach(e=>{e.disabled=!1})))}queryable(){let e=this.src?this.shadowRoot:this;return e.querySelector("map-extent[checked] > map-link[rel=query]")&&this.checked&&this._layer&&!this.hidden}getAlternateStyles(e){if(1{e.hasAttribute("href")?e.setAttribute("href",decodeURI(new URL(e.attributes.href.value,this.baseURI||document.baseURI).href)):e.hasAttribute("tref")&&e.setAttribute("tref",decodeURI(new URL(e.attributes.tref.value,this.baseURI||document.baseURI).href))})}var e=t.outerHTML;return t.remove(),e}zoomTo(){this.whenReady().then(()=>{let e=this.parentElement._map,t=this.extent,r=t.topLeft.pcrs,a=t.bottomRight.pcrs,i=L.bounds(L.point(r.horizontal,r.vertical),L.point(a.horizontal,a.vertical)),s=e.options.crs.unproject(i.getCenter(!0));var o=t.zoom.maxZoom,n=t.zoom.minZoom;e.setView(s,M.getMaxZoom(i,e,n,o),{animate:!1})})}mapml2geojson(e={}){return M.mapml2geojson(this,e)}pasteFeature(e){switch(typeof e){case"string":e.trim(),""===e.slice(-14)&&this.insertAdjacentHTML("beforeend",e);break;case"object":"MAP-FEATURE"===e.nodeName.toUpperCase()&&this.appendChild(e)}}whenReady(){return new Promise((t,r)=>{let a,i;this._layer&&this._layerControlHTML&&(!this.src||this.shadowRoot?.childNodes.length)?t():(a=setInterval(function(e){e._layer&&e._layerControlHTML&&(!e.src||e.shadowRoot?.childNodes.length)?(clearInterval(a),clearTimeout(i),t()):e._fetchError&&(clearInterval(a),clearTimeout(i),r("Error fetching layer content"))},200,this),i=setTimeout(function(){clearInterval(a),clearTimeout(i),r("Timeout reached waiting for layer to be ready")},5e3))})}whenElemsReady(){let e=[],t=this.src?this.shadowRoot:this;for(var r of[...t.querySelectorAll("map-extent"),...t.querySelectorAll("map-feature")])e.push(r.whenReady());return Promise.allSettled(e)}}export{MapLayer}; //# sourceMappingURL=layer.js.map \ No newline at end of file diff --git a/static/dist/leaflet.js b/static/dist/leaflet.js index b2403a52..b7f627cf 100644 --- a/static/dist/leaflet.js +++ b/static/dist/leaflet.js @@ -1,4 +1,4 @@ -/*! @maps4html/web-map-custom-element 27-03-2024 */ +/*! @maps4html/web-map-custom-element 01-04-2024 */ !function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).leaflet={})}(this,function(t){"use strict";function l(t){for(var i,e,s=1,n=arguments.length;s=this.min.x&&e.x<=this.max.x&&i.y>=this.min.y&&e.y<=this.max.y},intersects:function(t){t=B(t);var i=this.min,e=this.max,s=t.min,n=t.max,t=n.x>=i.x&&s.x<=e.x,e=n.y>=i.y&&s.y<=e.y;return t&&e},overlaps:function(t){t=B(t);var i=this.min,e=this.max,s=t.min,n=t.max,t=n.x>i.x&&s.xi.y&&s.y=s.lat&&e.lat<=n.lat&&i.lng>=s.lng&&e.lng<=n.lng},intersects:function(t){t=R(t);var i=this._southWest,e=this._northEast,s=t.getSouthWest(),n=t.getNorthEast(),t=n.lat>=i.lat&&s.lat<=e.lat,e=n.lng>=i.lng&&s.lng<=e.lng;return t&&e},overlaps:function(t){t=R(t);var i=this._southWest,e=this._northEast,s=t.getSouthWest(),n=t.getNorthEast(),t=n.lat>i.lat&&s.lati.lng&&s.lng","http://www.w3.org/2000/svg"===(Tt.firstChild&&Tt.firstChild.namespaceURI));function St(t){return 0<=navigator.userAgent.toLowerCase().indexOf(t)}var Et={ie:Y,ielt9:$,edge:tt,webkit:it,android:et,android23:st,androidStock:ot,opera:at,chrome:rt,gecko:ht,safari:lt,phantom:ct,opera12:ut,win:dt,ie3d:_t,webkit3d:pt,gecko3d:mt,any3d:ft,mobile:gt,mobileWebkit:vt,mobileWebkit3d:yt,msPointer:Mt,pointer:xt,touch:bt,touchNative:wt,mobileOpera:Pt,mobileGecko:F,retina:Lt,passiveEvents:Ct,canvas:nt,svg:Q,vml:!Q&&function(){try{var t=document.createElement("div");t.innerHTML='';var i=t.firstChild;return i.style.behavior="url(#default#VML)",i&&"object"==typeof i.adj}catch(t){return!1}}(),inlineSvg:Tt,mac:0===navigator.platform.indexOf("Mac"),linux:0===navigator.platform.indexOf("Linux")},kt=Et.msPointer?"MSPointerDown":"pointerdown",zt=Et.msPointer?"MSPointerMove":"pointermove",At=Et.msPointer?"MSPointerUp":"pointerup",Ot=Et.msPointer?"MSPointerCancel":"pointercancel",It={touchstart:kt,touchmove:zt,touchend:At,touchcancel:Ot},Zt={touchstart:function(t,i){i.MSPOINTER_TYPE_TOUCH&&i.pointerType===i.MSPOINTER_TYPE_TOUCH&&Oi(i);Gt(t,i)},touchmove:Gt,touchend:Gt,touchcancel:Gt},Bt={},Nt=!1;function Rt(t,i,e){return"touchstart"===i&&(Nt||(document.addEventListener(kt,jt,!0),document.addEventListener(zt,Dt,!0),document.addEventListener(At,qt,!0),document.addEventListener(Ot,qt,!0),Nt=!0)),Zt[i]?(e=Zt[i].bind(this,e),t.addEventListener(It[i],e,!1),e):(console.warn("wrong event specified:",i),c)}function jt(t){Bt[t.pointerId]=t}function Dt(t){Bt[t.pointerId]&&(Bt[t.pointerId]=t)}function qt(t){delete Bt[t.pointerId]}function Gt(t,i){if(i.pointerType!==(i.MSPOINTER_TYPE_MOUSE||"mouse")){for(var e in i.touches=[],Bt)i.touches.push(Bt[e]);i.changedTouches=[i],t(i)}}var Ft=200;function Ht(t,e){t.addEventListener("dblclick",e);var s,n=0;function i(t){var i;1===t.detail?"mouse"===t.pointerType||t.sourceCapabilities&&!t.sourceCapabilities.firesTouchEvents||((i=Zi(t)).some(function(t){return t instanceof HTMLLabelElement&&t.attributes.for})&&!i.some(function(t){return t instanceof HTMLInputElement||t instanceof HTMLSelectElement})||((i=Date.now())-n<=Ft?2===++s&&e(function(t){var i,e,s={};for(e in t)i=t[e],s[e]=i&&i.bind?i.bind(t):i;return(t=s).type="dblclick",s.detail=2,s.isTrusted=!1,s._simulated=!0,s}(t)):s=1,n=i)):s=t.detail}return t.addEventListener("click",i),{dblclick:e,simDblclick:i}}var Ut,Wt,Vt,Kt,Xt,Jt,Qt=_i(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Yt=_i(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),$t="webkitTransition"===Yt||"OTransition"===Yt?Yt+"End":"transitionend";function ti(t){return"string"==typeof t?document.getElementById(t):t}function ii(t,i){var e=t.style[i]||t.currentStyle&&t.currentStyle[i];return"auto"===(e=(!e||"auto"===e)&&document.defaultView?(t=document.defaultView.getComputedStyle(t,null))?t[i]:null:e)?null:e}function ei(t,i,e){t=document.createElement(t);return t.className=i||"",e&&e.appendChild(t),t}function si(t){var i=t.parentNode;i&&i.removeChild(t)}function ni(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function oi(t){var i=t.parentNode;i&&i.lastChild!==t&&i.appendChild(t)}function ai(t){var i=t.parentNode;i&&i.firstChild!==t&&i.insertBefore(t,i.firstChild)}function ri(t,i){if(void 0!==t.classList)return t.classList.contains(i);t=ui(t);return 0this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,i){this._enforcingBounds=!0;var e=this.getCenter(),t=this._limitCenter(e,this._zoom,R(t));return e.equals(t)||this.panTo(t,i),this._enforcingBounds=!1,this},panInside:function(t,i){var e=I((i=i||{}).paddingTopLeft||i.padding||[0,0]),s=I(i.paddingBottomRight||i.padding||[0,0]),n=this.project(this.getCenter()),o=this.project(t),t=this.getPixelBounds(),e=B([t.min.add(e),t.max.subtract(s)]),t=e.getSize();return e.contains(o)||(this._enforcingBounds=!0,s=o.subtract(e.getCenter()),t=e.extend(o).getSize().subtract(t),n.x+=s.x<0?-t.x:t.x,n.y+=s.y<0?-t.y:t.y,this.panTo(this.unproject(n),i),this._enforcingBounds=!1),this},invalidateSize:function(t){if(!this._loaded)return this;t=l({animate:!1,pan:!0},!0===t?{animate:!0}:t);var i=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var e=this.getSize(),s=i.divideBy(2).round(),n=e.divideBy(2).round(),n=s.subtract(n);return n.x||n.y?(t.animate&&t.pan?this.panBy(n):(t.pan&&this._rawPanBy(n),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:i,newSize:e})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=l({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var i=r(this._handleGeolocationResponse,this),e=r(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(i,e,t):navigator.geolocation.getCurrentPosition(i,e,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var i;this._container._leaflet_id&&(i=t.code,t=t.message||(1===i?"permission denied":2===i?"position unavailable":"timeout"),this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:i,message:"Geolocation error: "+t+"."}))},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var i,e=new j(t.coords.latitude,t.coords.longitude),s=e.toBounds(2*t.coords.accuracy),n=this._locateOptions;n.setView&&(i=this.getBoundsZoom(s),this.setView(e,n.maxZoom?Math.min(i,n.maxZoom):i));var o,a={latlng:e,bounds:s,timestamp:t.timestamp};for(o in t.coords)"number"==typeof t.coords[o]&&(a[o]=t.coords[o]);this.fire("locationfound",a)}},addHandler:function(t,i){if(!i)return this;i=this[t]=new i(this);return this._handlers.push(i),this.options[t]&&i.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}for(var t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),si(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(T(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)si(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,i){i=ei("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),i||this._mapPane);return t&&(this._panes[t]=i),i},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new N(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,i,e){t=R(t),e=I(e||[0,0]);var s=this.getZoom()||0,n=this.getMinZoom(),o=this.getMaxZoom(),a=t.getNorthWest(),r=t.getSouthEast(),t=this.getSize().subtract(e),e=B(this.project(r,s),this.project(a,s)).getSize(),r=Et.any3d?this.options.zoomSnap:1,a=t.x/e.x,e=t.y/e.y,e=i?Math.max(a,e):Math.min(a,e),s=this.getScaleZoom(e,s);return r&&(s=Math.round(s/(r/100))*(r/100),s=i?Math.ceil(s/r)*r:Math.floor(s/r)*r),Math.max(n,Math.min(o,s))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new A(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,i){i=this._getTopLeftPoint(t,i);return new Z(i,i.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,i){var e=this.options.crs;return i=void 0===i?this._zoom:i,e.scale(t)/e.scale(i)},getScaleZoom:function(t,i){var e=this.options.crs;i=void 0===i?this._zoom:i;i=e.zoom(t*e.scale(i));return isNaN(i)?1/0:i},project:function(t,i){return i=void 0===i?this._zoom:i,this.options.crs.latLngToPoint(D(t),i)},unproject:function(t,i){return i=void 0===i?this._zoom:i,this.options.crs.pointToLatLng(I(t),i)},layerPointToLatLng:function(t){t=I(t).add(this.getPixelOrigin());return this.unproject(t)},latLngToLayerPoint:function(t){return this.project(D(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(D(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(R(t))},distance:function(t,i){return this.options.crs.distance(D(t),D(i))},containerPointToLayerPoint:function(t){return I(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return I(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){t=this.containerPointToLayerPoint(I(t));return this.layerPointToLatLng(t)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(D(t)))},mouseEventToContainerPoint:function(t){return Bi(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){t=this._container=ti(t);if(!t)throw new Error("Map container not found.");if(t._leaflet_id)throw new Error("Map container is already initialized.");bi(t,"scroll",this._onScroll,this),this._containerId=h(t)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&Et.any3d,hi(t,"leaflet-container"+(Et.touch?" leaflet-touch":"")+(Et.retina?" leaflet-retina":"")+(Et.ielt9?" leaflet-oldie":"")+(Et.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var i=ii(t,"position");"absolute"!==i&&"relative"!==i&&"fixed"!==i&&"sticky"!==i&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),mi(this._mapPane,new A(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(hi(t.markerPane,"leaflet-zoom-hide"),hi(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,i,e){mi(this._mapPane,new A(0,0));var s=!this._loaded;this._loaded=!0,i=this._limitZoom(i),this.fire("viewprereset");var n=this._zoom!==i;this._moveStart(n,e)._move(t,i)._moveEnd(n),this.fire("viewreset"),s&&this.fire("load")},_moveStart:function(t,i){return t&&this.fire("zoomstart"),i||this.fire("movestart"),this},_move:function(t,i,e,s){void 0===i&&(i=this._zoom);var n=this._zoom!==i;return this._zoom=i,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),s?e&&e.pinch&&this.fire("zoom",e):((n||e&&e.pinch)&&this.fire("zoom",e),this.fire("move",e)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return T(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){mi(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={};var i=t?Li:bi;i((this._targets[h(this._container)]=this)._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&i(window,"resize",this._onResize,this),Et.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){T(this._resizeRequest),this._resizeRequest=C(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,i){for(var e,s=[],n="mouseout"===i||"mouseover"===i,o=t.target||t.srcElement,a=!1;o;){if((e=this._targets[h(o)])&&("click"===i||"preclick"===i)&&this._draggableMoved(e)){a=!0;break}if(e&&e.listens(i,!0)){if(n&&!ji(o,t))break;if(s.push(e),n)break}if(o===this._container)break;o=o.parentNode}return s=!(s.length||a||n)&&this.listens(i,!0)?[this]:s},_isClickDisabled:function(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var i,e=t.target||t.srcElement;!this._loaded||e._leaflet_disable_events||"click"===t.type&&this._isClickDisabled(e)||("mousedown"===(i=t.type)&&yi(e),this._fireDOMEvent(t,i))},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,i,e){"click"===t.type&&((a=l({},t)).type="preclick",this._fireDOMEvent(a,a.type,e));var s=this._findEventTargets(t,i);if(e){for(var n=[],o=0;othis.options.zoomAnimationThreshold)return!1;var s=this.getZoomScale(i),s=this._getCenterOffset(t)._divideBy(1-1/s);return!(!0!==e.animate&&!this.getSize().contains(s))&&(C(function(){this._moveStart(!0,e.noMoveStart||!1)._animateZoom(t,i,!0)},this),!0)},_animateZoom:function(t,i,e,s){this._mapPane&&(e&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=i,hi(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:i,noUpdate:s}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(r(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&li(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function Gi(t){return new Fi(t)}var Fi=E.extend({options:{position:"topright"},initialize:function(t){_(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var i=this._map;return i&&i.removeControl(this),this.options.position=t,i&&i.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var i=this._container=this.onAdd(t),e=this.getPosition(),t=t._controlCorners[e];return hi(i,"leaflet-control"),-1!==e.indexOf("bottom")?t.insertBefore(i,t.firstChild):t.appendChild(i),this._map.on("unload",this.remove,this),this},remove:function(){return this._map&&(si(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this},_refocusOnMap:function(t){this._map&&t&&0",i=document.createElement("div");return i.innerHTML=t,i.firstChild},_addItem:function(t){var i,e=document.createElement("label"),s=this._map.hasLayer(t.layer);t.overlay?((i=document.createElement("input")).type="checkbox",i.className="leaflet-control-layers-selector",i.defaultChecked=s):i=this._createRadioElement("leaflet-base-layers_"+h(this),s),this._layerControlInputs.push(i),i.layerId=h(t.layer),bi(i,"click",this._onInputClick,this);var n=document.createElement("span");n.innerHTML=" "+t.name;s=document.createElement("span");return e.appendChild(s),s.appendChild(i),s.appendChild(n),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(e),this._checkDisabledLayers(),e},_onInputClick:function(){if(!this._preventClick){var t,i,e=this._layerControlInputs,s=[],n=[];this._handlingClick=!0;for(var o=e.length-1;0<=o;o--)t=e[o],i=this._getLayer(t.layerId).layer,t.checked?s.push(i):t.checked||n.push(i);for(o=0;oi.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section;this._preventClick=!0,bi(t,"click",Oi),this.expand();var i=this;setTimeout(function(){Li(t,"click",Oi),i._preventClick=!1})}}),Ui=Fi.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(t){var i="leaflet-control-zoom",e=ei("div",i+" leaflet-bar"),s=this.options;return this._zoomInButton=this._createButton(s.zoomInText,s.zoomInTitle,i+"-in",e,this._zoomIn),this._zoomOutButton=this._createButton(s.zoomOutText,s.zoomOutTitle,i+"-out",e,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),e},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,i,e,s,n){s=ei("a",e,s);return s.innerHTML=t,s.href="#",s.title=i,s.setAttribute("role","button"),s.setAttribute("aria-label",i),Ai(s),bi(s,"click",Ii),bi(s,"click",n,this),bi(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,i="leaflet-disabled";li(this._zoomInButton,i),li(this._zoomOutButton,i),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),!this._disabled&&t._zoom!==t.getMinZoom()||(hi(this._zoomOutButton,i),this._zoomOutButton.setAttribute("aria-disabled","true")),!this._disabled&&t._zoom!==t.getMaxZoom()||(hi(this._zoomInButton,i),this._zoomInButton.setAttribute("aria-disabled","true"))}});qi.mergeOptions({zoomControl:!0}),qi.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new Ui,this.addControl(this.zoomControl))});var Wi=Fi.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var i="leaflet-control-scale",e=ei("div",i),s=this.options;return this._addScales(s,i+"-line",e),t.on(s.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),e},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,i,e){t.metric&&(this._mScale=ei("div",i,e)),t.imperial&&(this._iScale=ei("div",i,e))},_update:function(){var t=this._map,i=t.getSize().y/2,i=t.distance(t.containerPointToLatLng([0,i]),t.containerPointToLatLng([this.options.maxWidth,i]));this._updateScales(i)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var i=this._getRoundNum(t);this._updateScale(this._mScale,i<1e3?i+" m":i/1e3+" km",i/t)},_updateImperial:function(t){var i,e=3.2808399*t;5280'+(Et.inlineSvg?' ':"")+"Leaflet"},initialize:function(t){_(this,t),this._attributions={}},onAdd:function(t){for(var i in(t.attributionControl=this)._container=ei("div","leaflet-control-attribution"),Ai(this._container),t._layers)t._layers[i].getAttribution&&this.addAttribution(t._layers[i].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",function(){this.removeAttribution(t.layer.getAttribution())},this))},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t&&(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update()),this},removeAttribution:function(t){return t&&this._attributions[t]&&(this._attributions[t]--,this._update()),this},_update:function(){if(this._map){var t,i=[];for(t in this._attributions)this._attributions[t]&&i.push(t);var e=[];this.options.prefix&&e.push(this.options.prefix),i.length&&e.push(i.join(", ")),this._container.innerHTML=e.join(' ')}}});qi.mergeOptions({attributionControl:!0}),qi.addInitHook(function(){this.options.attributionControl&&(new Vi).addTo(this)});Fi.Layers=Hi,Fi.Zoom=Ui,Fi.Scale=Wi,Fi.Attribution=Vi,Gi.layers=function(t,i,e){return new Hi(t,i,e)},Gi.zoom=function(t){return new Ui(t)},Gi.scale=function(t){return new Wi(t)},Gi.attribution=function(t){return new Vi(t)};xt=E.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled&&(this._enabled=!1,this.removeHooks()),this},enabled:function(){return!!this._enabled}});xt.addTo=function(t,i){return t.addHandler(i,this),this};var bt={Events:k},Ki=Et.touch?"touchstart mousedown":"mousedown",Xi=z.extend({options:{clickTolerance:3},initialize:function(t,i,e,s){_(this,s),this._element=t,this._dragStartTarget=i||t,this._preventOutline=e},enable:function(){this._enabled||(bi(this._dragStartTarget,Ki,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Xi._dragging===this&&this.finishDrag(!0),Li(this._dragStartTarget,Ki,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){var i,e;this._enabled&&(this._moved=!1,ri(this._element,"leaflet-zoom-anim")||(t.touches&&1!==t.touches.length?Xi._dragging===this&&this.finishDrag():Xi._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||((Xi._dragging=this)._preventOutline&&yi(this._element),gi(),Vt(),this._moving||(this.fire("down"),i=t.touches?t.touches[0]:t,e=xi(this._element),this._startPoint=new A(i.clientX,i.clientY),this._startPos=fi(this._element),this._parentScale=wi(e),t="mousedown"===t.type,bi(document,t?"mousemove":"touchmove",this._onMove,this),bi(document,t?"mouseup":"touchend touchcancel",this._onUp,this)))))},_onMove:function(t){var i;this._enabled&&(t.touches&&1i&&(e.push(t[s]),n=s);ni.max.x&&(e|=2),t.yi.max.y&&(e|=8),e}function oe(t,i,e,s){var n=i.x,o=i.y,a=e.x-n,r=e.y-o,i=a*a+r*r;return 0this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()t.y!=s.y>t.y&&t.x<(s.x-e.x)*(t.y-e.y)/(s.y-e.y)+e.x&&(l=!l);return l||ye.prototype._containsPoint.call(this,t,!0)}});var xe=ue.extend({initialize:function(t,i){_(this,i),this._layers={},t&&this.addData(t)},addData:function(t){var i,e,s,n=g(t)?t:t.features;if(n){for(i=0,e=n.length;io.x&&(a=e.x+r-o.x+n.x),e.x-a-s.x<(r=0)&&(a=e.x-s.x),e.y+i+n.y>o.y&&(r=e.y+i-o.y+n.y),e.y-r-s.y<0&&(r=e.y-s.y),(a||r)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([a,r]))))},_getAnchor:function(){return I(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}});qi.mergeOptions({closePopupOnClick:!0}),qi.include({openPopup:function(t,i,e){return this._initOverlay(Ze,t,i,e).openOn(this),this},closePopup:function(t){return(t=arguments.length?t:this._popup)&&t.close(),this}}),k.include({bindPopup:function(t,i){return this._popup=this._initOverlay(Ze,this._popup,t,i),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t){return this._popup&&(this instanceof ue||(this._popup._source=this),this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var i;this._popup&&this._map&&(Ii(t),i=t.layer||t.target,this._popup._source!==i||i instanceof fe?(this._popup._source=i,this.openPopup(t.latlng)):this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var Be=Ie.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){Ie.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){Ie.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=Ie.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=ei("div",t),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+h(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var i,e=this._map,s=this._container,n=e.latLngToContainerPoint(e.getCenter()),o=e.layerPointToContainerPoint(t),a=this.options.direction,r=s.offsetWidth,h=s.offsetHeight,l=I(this.options.offset),e=this._getAnchor(),h="top"===a?(i=r/2,h):"bottom"===a?(i=r/2,0):(i="center"===a?r/2:"right"===a?0:"left"===a?r:o.xthis.options.maxZoom||sthis.options.maxZoom||void 0!==this.options.minZoom&&ne.max.x)||!i.wrapLat&&(t.ye.max.y))return!1}if(!this.options.bounds)return!0;t=this._tileCoordsToBounds(t);return R(this.options.bounds).overlaps(t)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var i=this._map,e=this.getTileSize(),s=t.scaleBy(e),e=s.add(e);return[i.unproject(s,t.z),i.unproject(e,t.z)]},_tileCoordsToBounds:function(t){t=this._tileCoordsToNwSe(t),t=new N(t[0],t[1]);return t=!this.options.noWrap?this._map.wrapLatLngBounds(t):t},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var i=t.split(":"),t=new A(+i[0],+i[1]);return t.z=+i[2],t},_removeTile:function(t){var i=this._tiles[t];i&&(si(i.el),delete this._tiles[t],this.fire("tileunload",{tile:i.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){hi(t,"leaflet-tile");var i=this.getTileSize();t.style.width=i.x+"px",t.style.height=i.y+"px",t.onselectstart=c,t.onmousemove=c,Et.ielt9&&this.options.opacity<1&&di(t,this.options.opacity)},_addTile:function(t,i){var e=this._getTilePos(t),s=this._tileCoordsToKey(t),n=this.createTile(this._wrapCoords(t),r(this._tileReady,this,t));this._initTile(n),this.createTile.length<2&&C(r(this._tileReady,this,t,null,n)),mi(n,e),this._tiles[s]={el:n,coords:t,current:!0},i.appendChild(n),this.fire("tileloadstart",{tile:n,coords:t})},_tileReady:function(t,i,e){i&&this.fire("tileerror",{error:i,tile:e,coords:t});var s=this._tileCoordsToKey(t);(e=this._tiles[s])&&(e.loaded=+new Date,this._map._fadeAnimated?(di(e.el,0),T(this._fadeFrame),this._fadeFrame=C(this._updateOpacity,this)):(e.active=!0,this._pruneTiles()),i||(hi(e.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:e.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Et.ielt9||!this._map._fadeAnimated?C(this._pruneTiles,this):setTimeout(r(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var i=new A(this._wrapX?n(t.x,this._wrapX):t.x,this._wrapY?n(t.y,this._wrapY):t.y);return i.z=t.z,i},_pxBoundsToTileRange:function(t){var i=this.getTileSize();return new Z(t.min.unscaleBy(i).floor(),t.max.unscaleBy(i).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});var je=Re.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,i){this._url=t,(i=_(this,i)).detectRetina&&Et.retina&&0')}}catch(t){}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),nt={_initContainer:function(){this._container=ei("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Ge.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var i=t._container=Ue("shape");hi(i,"leaflet-vml-shape "+(this.options.className||"")),i.coordsize="1 1",t._path=Ue("path"),i.appendChild(t._path),this._updateStyle(t),this._layers[h(t)]=t},_addPath:function(t){var i=t._container;this._container.appendChild(i),t.options.interactive&&t.addInteractiveTarget(i)},_removePath:function(t){var i=t._container;si(i),t.removeInteractiveTarget(i),delete this._layers[h(t)]},_updateStyle:function(t){var i=t._stroke,e=t._fill,s=t.options,n=t._container;n.stroked=!!s.stroke,n.filled=!!s.fill,s.stroke?(i=i||(t._stroke=Ue("stroke")),n.appendChild(i),i.weight=s.weight+"px",i.color=s.color,i.opacity=s.opacity,s.dashArray?i.dashStyle=g(s.dashArray)?s.dashArray.join(" "):s.dashArray.replace(/( *, *)/g," "):i.dashStyle="",i.endcap=s.lineCap.replace("butt","flat"),i.joinstyle=s.lineJoin):i&&(n.removeChild(i),t._stroke=null),s.fill?(e=e||(t._fill=Ue("fill")),n.appendChild(e),e.color=s.fillColor||s.color,e.opacity=s.fillOpacity):e&&(n.removeChild(e),t._fill=null)},_updateCircle:function(t){var i=t._point.round(),e=Math.round(t._radius),s=Math.round(t._radiusY||e);this._setPath(t,t._empty()?"M0 0":"AL "+i.x+","+i.y+" "+e+","+s+" 0,23592600")},_setPath:function(t,i){t._path.v=i},_bringToFront:function(t){oi(t._container)},_bringToBack:function(t){ai(t._container)}},We=Et.vml?Ue:X,Ve=Ge.extend({_initContainer:function(){this._container=We("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=We("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){si(this._container),Li(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){var t,i,e;this._map._animatingZoom&&this._bounds||(Ge.prototype._update.call(this),i=(t=this._bounds).getSize(),e=this._container,this._svgSize&&this._svgSize.equals(i)||(this._svgSize=i,e.setAttribute("width",i.x),e.setAttribute("height",i.y)),mi(e,t.min),e.setAttribute("viewBox",[t.min.x,t.min.y,i.x,i.y].join(" ")),this.fire("update"))},_initPath:function(t){var i=t._path=We("path");t.options.className&&hi(i,t.options.className),t.options.interactive&&hi(i,"leaflet-interactive"),this._updateStyle(t),this._layers[h(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){si(t._path),t.removeInteractiveTarget(t._path),delete this._layers[h(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var i=t._path,t=t.options;i&&(t.stroke?(i.setAttribute("stroke",t.color),i.setAttribute("stroke-opacity",t.opacity),i.setAttribute("stroke-width",t.weight),i.setAttribute("stroke-linecap",t.lineCap),i.setAttribute("stroke-linejoin",t.lineJoin),t.dashArray?i.setAttribute("stroke-dasharray",t.dashArray):i.removeAttribute("stroke-dasharray"),t.dashOffset?i.setAttribute("stroke-dashoffset",t.dashOffset):i.removeAttribute("stroke-dashoffset")):i.setAttribute("stroke","none"),t.fill?(i.setAttribute("fill",t.fillColor||t.color),i.setAttribute("fill-opacity",t.fillOpacity),i.setAttribute("fill-rule",t.fillRule||"evenodd")):i.setAttribute("fill","none"))},_updatePoly:function(t,i){this._setPath(t,J(t._parts,i))},_updateCircle:function(t){var i=t._point,e=Math.max(Math.round(t._radius),1),s="a"+e+","+(Math.max(Math.round(t._radiusY),1)||e)+" 0 1,0 ",e=t._empty()?"M0 0":"M"+(i.x-e)+","+i.y+s+2*e+",0 "+s+2*-e+",0 ";this._setPath(t,e)},_setPath:function(t,i){t._path.setAttribute("d",i)},_bringToFront:function(t){oi(t._path)},_bringToBack:function(t){ai(t._path)}});function Ke(t){return Et.svg||Et.vml?new Ve(t):null}Et.vml&&Ve.include(nt),qi.include({getRenderer:function(t){t=(t=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer)||(this._renderer=this._createRenderer());return this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var i=this._paneRenderers[t];return void 0===i&&(i=this._createRenderer({pane:t}),this._paneRenderers[t]=i),i},_createRenderer:function(t){return this.options.preferCanvas&&He(t)||Ke(t)}});var Xe=Me.extend({initialize:function(t,i){Me.prototype.initialize.call(this,this._boundsToLatLngs(t),i)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=R(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});Ve.create=We,Ve.pointsToPath=J,xe.geometryToLayer=we,xe.coordsToLatLng=Pe,xe.coordsToLatLngs=Le,xe.latLngToCoords=Ce,xe.latLngsToCoords=Te,xe.getFeature=Se,xe.asFeature=Ee,qi.mergeOptions({boxZoom:!0});F=xt.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){bi(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Li(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){si(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),Vt(),gi(),this._startPoint=this._map.mouseEventToContainerPoint(t),bi(document,{contextmenu:Ii,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=ei("div","leaflet-zoom-box",this._container),hi(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var i=new Z(this._point,this._startPoint),t=i.getSize();mi(this._box,i.min),this._box.style.width=t.x+"px",this._box.style.height=t.y+"px"},_finish:function(){this._moved&&(si(this._box),li(this._container,"leaflet-crosshair")),Kt(),vi(),Li(document,{contextmenu:Ii,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){1!==t.which&&1!==t.button||(this._finish(),this._moved&&(this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(r(this._resetState,this),0),t=new N(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point)),this._map.fitBounds(t).fire("boxzoomend",{boxZoomBounds:t})))},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});qi.addInitHook("addHandler","boxZoom",F),qi.mergeOptions({doubleClickZoom:!0});Q=xt.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var i=this._map,e=i.getZoom(),s=i.options.zoomDelta,s=t.originalEvent.shiftKey?e-s:e+s;"center"===i.options.doubleClickZoom?i.setZoom(s):i.setZoomAround(t.containerPoint,s)}});qi.addInitHook("addHandler","doubleClickZoom",Q),qi.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});V=xt.extend({addHooks:function(){var t;this._draggable||(t=this._map,this._draggable=new Xi(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))),hi(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){li(this._map._container,"leaflet-grab"),li(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t,i=this._map;i._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity?(t=R(this._map.options.maxBounds),this._offsetLimit=B(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))):this._offsetLimit=null,i.fire("movestart").fire("dragstart"),i.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){var i,e;this._map.options.inertia&&(i=this._lastTime=+new Date,e=this._lastPos=this._draggable._absPos||this._draggable._newPos,this._positions.push(e),this._times.push(i),this._prunePositions(i)),this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;1i.max.x&&(t.x=this._viscousLimit(t.x,i.max.x)),t.y>i.max.y&&(t.y=this._viscousLimit(t.y,i.max.y)),this._draggable._newPos=this._draggable._startPos.add(t))},_onPreDragWrap:function(){var t=this._worldWidth,i=Math.round(t/2),e=this._initialWorldOffset,s=this._draggable._newPos.x,n=(s-i+e)%t+i-e,i=(s+i+e)%t-i-e,i=Math.abs(n+e)i.getMaxZoom()&&1=this.text.length)return;t=this.text[this.place++]}switch(this.state){case 1:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},C.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(d.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},C.prototype.afterItem=function(t){if(","===t)return null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=1);"]"===t&&(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=1,this.currentObject=this.stack.pop(),this.currentObject||(this.state=-1))},C.prototype.number=function(t){if(!L.test(t)){if(d.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)}this.word+=t},C.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},C.prototype.keyword=function(t){if(u.test(t))this.word+=t;else{if("["===t){var i=[];return i.push(this.word),this.level++,null===this.root?this.root=i:this.currentObject.push(i),this.stack.push(this.currentObject),this.currentObject=i,void(this.state=1)}if(!d.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},C.prototype.neutral=function(t){if(s.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(L.test(t))return this.word=t,void(this.state=3);if(!d.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},C.prototype.output=function(){for(;this.placeMath.PI&&(s-=2*Math.PI),t=Math.sin(n),n=Math.cos(n),{x:((e=e/Math.sqrt(1-i*(t*t)))+o)*n*Math.cos(s),y:(e+o)*n*Math.sin(s),z:(e*(1-i)+o)*t}}function Y(t,i,e,s){var n,o,a,r,h,l,c,u,d,_,p,m=1e-12,f=t.x,g=t.y,v=t.z||0,y=Math.sqrt(f*f+g*g),M=Math.sqrt(f*f+g*g+v*v);if(y/ex?Math.tan(e):0,c=Math.pow(i,2),u=Math.pow(c,2),d=1-this.es*Math.pow(n,2);a/=Math.sqrt(d);i=qt(e,n,o,this.en),d=this.a*(this.k0*a*(1+r/6*(1-c+h+r/20*(5-18*c+u+14*h-58*c*h+r/42*(61+179*u-u*c-479*c)))))+this.x0,u=this.a*(this.k0*(i-this.ml0+n*s*a/2*(1+r/12*(5-c+9*h+4*l+r/30*(61+u-58*c+270*h-330*c*h+r/56*(1385+543*u-u*c-3111*c))))))+this.y0}else{c=o*Math.sin(s);if(Math.abs(Math.abs(c)-1)x?Math.tan(i):0,s=this.ep2*Math.pow(e,2),l=Math.pow(s,2),n=Math.pow(r,2),o=Math.pow(n,2),h=1-this.es*Math.pow(a,2),a=c*Math.sqrt(h)/this.k0,l=i-(h*=r)*(r=Math.pow(a,2))/(1-this.es)*.5*(1-r/12*(5+3*n-9*s*n+s-4*l-r/30*(61+90*n-252*s*n+45*o+46*s-r/56*(1385+3633*n+4095*o+1574*o*n)))),q(this.long0+a*(1-r/6*(1+2*n+s-r/20*(5+28*n+24*o+8*s*n+6*s-r/42*(61+662*n+1320*o+720*o*n))))/e)):(l=g*D(u),0)):(c=.5*((d=Math.exp(c/this.k0))-1/d),d=this.lat0+u/this.k0,d=Math.cos(d),h=Math.sqrt((1-Math.pow(d,2))/(1+Math.pow(c,2))),l=Math.asin(h),u<0&&(l=-l),0==c&&0===d?0:q(Math.atan2(c,d)+this.long0));return t.x=d,t.y=l,t},names:["Transverse_Mercator","Transverse Mercator","tmerc"]},Wt=function(t){var t=Math.exp(t);return t=(t-1/t)/2},Vt=function(t,i){t=Math.abs(t),i=Math.abs(i);var e=Math.max(t,i),i=Math.min(t,i)/(e||1);return e*Math.sqrt(1+Math.pow(i,2))},Kt=function(t){var i=1+t,e=i-1;return 0==e?t:t*Math.log(i)/e},Xt=function(t){var t=Math.exp(t);return t=(t+1/t)/2};var Jt={init:function(){if(void 0===this.es||this.es<=0)throw new Error("incorrect elliptical usage");this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=(i=this.es/(1+Math.sqrt(1-this.es)))/(2-i),i=t;this.cgb[0]=t*(2+t*(-2/3+t*(t*(116/45+t*(26/45+-2854/675*t))-2))),this.cbg[0]=t*(t*(2/3+t*(4/3+t*(-82/45+t*(32/45+4642/4725*t))))-2),this.cgb[1]=(i*=t)*(7/3+t*(t*(-227/45+t*(2704/315+2323/945*t))-1.6)),this.cbg[1]=i*(5/3+t*(-16/15+t*(-13/9+t*(904/315+-1522/945*t)))),this.cgb[2]=(i*=t)*(56/15+t*(-136/35+t*(-1262/105+73814/2835*t))),this.cbg[2]=i*(-26/15+t*(34/21+t*(1.6+-12686/2835*t))),this.cgb[3]=(i*=t)*(4279/630+t*(-332/35+-399572/14175*t)),this.cbg[3]=i*(1237/630+t*(-24832/14175*t-2.4)),this.cgb[4]=(i*=t)*(4174/315+-144838/6237*t),this.cbg[4]=i*(-734/315+109598/31185*t),this.cgb[5]=601676/22275*(i*=t),this.cbg[5]=444337/155925*i,i=Math.pow(t,2),this.Qn=this.k0/(1+t)*(1+i*(.25+i*(1/64+i/256))),this.utg[0]=t*(t*(2/3+t*(-37/96+t*(1/360+t*(81/512+-96199/604800*t))))-.5),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+7891/37800*t))))),this.utg[1]=i*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+1118711/3870720*t)))),this.gtu[1]=i*(13/48+t*(t*(557/1440+t*(281/630+-1983433/1935360*t))-.6)),this.utg[2]=(i*=t)*(-17/480+t*(37/840+t*(209/4480+-5569/90720*t))),this.gtu[2]=i*(61/240+t*(-103/140+t*(15061/26880+167603/181440*t))),this.utg[3]=(i*=t)*(-4397/161280+t*(11/504+830251/7257600*t)),this.gtu[3]=i*(49561/161280+t*(-179/168+6601661/7257600*t)),this.utg[4]=(i*=t)*(-4583/161280+108847/3991680*t),this.gtu[4]=i*(34729/80640+-3418889/1995840*t),this.utg[5]=-.03233083094085698*(i*=t),this.gtu[5]=.6650675310896665*i,i=Ft(this.cbg,this.lat0),this.Zb=-this.Qn*(i+function(t,i){for(var e,s=2*Math.cos(i),n=t.length-1,o=t[n],a=0;0<=--n;)e=s*o-a+t[n],a=o,o=e;return Math.sin(i)*e}(this.gtu,2*i))},forward:function(t){var i=q(t.x-this.long0),e=t.y,e=Ft(this.cbg,e),s=Math.sin(e),n=Math.cos(e),o=Math.sin(i),a=Math.cos(i);e=Math.atan2(s,a*n),i=Math.atan2(o*n,Vt(s,n*a)),n=Math.tan(i),a=Math.abs(n),a=Kt(a*(1+a/(Vt(1,a)+1)));var r,a=Ht(this.gtu,2*e,2*(i=n<0?-a:a));return e+=a[0],i+=a[1],e=Math.abs(i)<=2.623395162778?(r=this.a*(this.Qn*i)+this.x0,this.a*(this.Qn*e+this.Zb)+this.y0):r=1/0,t.x=r,t.y=e,t},inverse:function(t){var i,e,s,n,o=(t.x-this.x0)*(1/this.a),a=(t.y-this.y0)*(1/this.a);return a=(a-this.Zb)/this.Qn,o/=this.Qn,a=Math.abs(o)<=2.623395162778?(a+=(n=Ht(this.utg,2*a,2*o))[0],o+=n[1],o=Math.atan(Wt(o)),i=Math.sin(a),e=Math.cos(a),s=Math.sin(o),n=Math.cos(o),a=Math.atan2(i*n,Vt(s,n*e)),o=Math.atan2(s,n*e),e=q(o+this.long0),Ft(this.cgb,a)):e=1/0,t.x=e,t.y=a,t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"]};function Qt(t,i){return Math.pow((1-t)/(1+t),i)}var Yt={init:function(){var t=function(t,i){if(void 0===t){if((t=Math.floor(30*(q(i)+Math.PI)/Math.PI)+1)<0)return 0;if(60x?this.ns=Math.log(i/s)/Math.log(e/n):this.ns=t,isNaN(this.ns)&&(this.ns=t),this.f0=i/(this.ns*Math.pow(e,this.ns)),this.rh=this.a*this.f0*Math.pow(o,this.ns),this.title||(this.title="Lambert Conformal Conic"))},forward:function(t){var i=t.x,e=t.y;Math.abs(2*Math.abs(e)-Math.PI)<=x&&(e=D(e)*(g-2*x));var s,n=Math.abs(Math.abs(e)-g);if(xx?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(t){var i=t.x,e=t.y;this.sin_phi=Math.sin(e),this.cos_phi=Math.cos(e);var s=pi(this.e3,this.sin_phi,this.cos_phi),e=this.a*Math.sqrt(this.c-this.ns0*s)/this.ns0,s=this.ns0*q(i-this.long0),i=e*Math.sin(s)+this.x0,s=this.rh-e*Math.cos(s)+this.y0;return t.x=i,t.y=s,t},inverse:function(t){var i,e,s,n;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,e=0<=this.ns0?(i=Math.sqrt(t.x*t.x+t.y*t.y),1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),-1),(s=0)!==i&&(s=Math.atan2(e*t.x,e*t.y)),e=i*this.ns0/this.a,n=this.sphere?Math.asin((this.c-e*e)/(2*this.ns0)):(n=(this.c-e*e)/this.ns0,this.phi1z(this.e3,n)),s=q(s/this.ns0+this.long0),t.x=s,t.y=n,t},names:["Albers_Conic_Equal_Area","Albers","aea"],phi1z:function(t,i){var e,s,n,o=wi(.5*i);if(tMath.PI&&(e=Math.PI),s=(2*i+Math.sin(2*i))/Math.PI,12*g*this.a?void 0:(r=i/this.a,h=Math.sin(r),a=Math.cos(r),e=this.long0,Math.abs(i)<=x?s=this.lat0:(s=wi(a*this.sin_p12+t.y*h*this.cos_p12/i),o=Math.abs(this.lat0)-g,e=Math.abs(o)<=x?0<=this.lat0?q(this.long0+Math.atan2(t.x,-t.y)):q(this.long0-Math.atan2(-t.x,t.y)):q(this.long0+Math.atan2(t.x*h,i*this.cos_p12*a-t.y*this.sin_p12*h))),t.x=e,t.y=s,t):(r=ai(this.es),o=ri(this.es),a=hi(this.es),h=li(this.es),Math.abs(this.sin_p12-1)<=x?(n=this.a*oi(r,o,a,h,g),i=Math.sqrt(t.x*t.x+t.y*t.y),s=di((n-i)/this.a,r,o,a,h),e=q(this.long0+Math.atan2(t.x,-1*t.y))):Math.abs(this.sin_p12+1)<=x?(n=this.a*oi(r,o,a,h,g),i=Math.sqrt(t.x*t.x+t.y*t.y),s=di((i-n)/this.a,r,o,a,h),e=q(this.long0+Math.atan2(t.x,t.y))):(i=Math.sqrt(t.x*t.x+t.y*t.y),n=Math.atan2(t.x,t.y),r=ci(this.a,this.e,this.sin_p12),o=Math.cos(n),h=-(a=this.e*this.cos_p12*o)*a/(1-this.es),a=3*this.es*(1-h)*this.sin_p12*this.cos_p12*o/(1-this.es),r=1-h*(h=(r=i/r)-h*(1+h)*Math.pow(r,3)/6-a*(1+3*h)*Math.pow(r,4)/24)*h/2-r*h*h*h/6,o=Math.asin(this.sin_p12*Math.cos(h)+this.cos_p12*Math.sin(h)*o),e=q(this.long0+Math.asin(Math.sin(n)*Math.sin(h)/Math.cos(o))),h=Math.sin(o),s=Math.atan2((h-this.es*r*this.sin_p12)*Math.tan(o),h*(1-this.es))),t.x=e,t.y=s,t)},names:["Azimuthal_Equidistant","aeqd"]};var Bi={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)},forward:function(t){var i,e,s=t.x,n=t.y,o=q(s-this.long0),a=Math.sin(n),r=Math.cos(n),s=Math.cos(o);return(0<(n=this.sin_p14*a+this.cos_p14*r*s)||Math.abs(n)<=x)&&(i=+this.a*r*Math.sin(o),e=this.y0+ +this.a*(this.cos_p14*a-this.sin_p14*r*s)),t.x=i,t.y=e,t},inverse:function(t){var i,e,s,n,o,a;return t.x-=this.x0,t.y-=this.y0,i=Math.sqrt(t.x*t.x+t.y*t.y),n=wi(i/this.a),e=Math.sin(n),s=Math.cos(n),o=this.long0,Math.abs(i)<=x?(a=this.lat0,t.x=o,t.y=a,t):(a=wi(s*this.sin_p14+t.y*e*this.cos_p14/i),n=Math.abs(this.lat0)-g,o=Math.abs(n)<=x?0<=this.lat0?q(this.long0+Math.atan2(t.x,-t.y)):q(this.long0-Math.atan2(-t.x,t.y)):q(this.long0+Math.atan2(t.x*e,i*this.cos_p14*s-t.y*this.sin_p14*e)),t.x=o,t.y=a,t)},names:["ortho"]},Ni=1,Ri=2,ji=3,Di=4,qi=5,Gi=6,Fi={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Hi(t,i,e,s){var n;return t=g-w/2?this.face=qi:this.lat0<=-(g-w/2)?this.face=Gi:Math.abs(this.long0)<=w?this.face=Ni:Math.abs(this.long0)<=g+w?this.face=0=Math.abs(t.y)?l.value=Fi.AREA_0:0<=t.y&&t.y>=Math.abs(t.x)?(l.value=Fi.AREA_1,i-=g):t.x<0&&-t.x>=Math.abs(t.y)?(l.value=Fi.AREA_2,i=i<0?i+c:i-c):(l.value=Fi.AREA_3,i+=g),n=c/12*Math.tan(i),o=Math.sin(n)/(Math.cos(n)-1/Math.sqrt(2)),o=Math.atan(o),(e=1-(i=Math.cos(i))*i*(e=Math.tan(e))*e*(1-Math.cos(Math.atan(1/Math.cos(o)))))<-1?e=-1:1i.y)--e;else{if(!(Xi[e+1][0]<=i.y))break;++e}var s=Xi[e],n=function(t,i,e,s){for(var n=i;s;--s){var o=t(n);if(n-=o,Math.abs(o){(t=t.split(" ")).forEach(function(t){r.DomUtil[i].call(this,e,t)})},i=(t,i)=>e("addClass",t,i),s=(t,i)=>e("removeClass",t,i),t=r.Marker.extend({initialize(t,i){r.Util.setOptions(this,i),this._latlng=t,this.createIcon()},createIcon(){var t=this.options;let i="";void 0!==t.color&&(i+=`stroke:${t.color};`),void 0!==t.weight&&(i+=`stroke-width:${t.weight};`),void 0!==t.fillColor&&(i+=`fill:${t.fillColor};`),void 0!==t.fillOpacity&&(i+=`fill-opacity:${t.fillOpacity};`),void 0!==t.opacity&&(i+=`opacity:${t.opacity};`);t=this._getIconSVG(t,i);this._locationIcon=r.divIcon({className:t.className,html:t.svg,iconSize:[t.w,t.h]}),this.setIcon(this._locationIcon)},_getIconSVG(t,i){var e=t.radius,s=e+t.weight,t=2*s;return{className:"leaflet-control-locate-location",svg:``+'',w:t,h:t}},setStyle(t){r.Util.setOptions(this,t),this.createIcon()}});var n=t.extend({initialize(t,i,e){r.Util.setOptions(this,e),this._latlng=t,this._heading=i,this.createIcon()},setHeading(t){this._heading=t},_getIconSVG(t,i){var e=t.radius,s=t.width+t.weight,e=2*(e+t.depth+t.weight),t=`M0,0 l${t.width/2},${t.depth} l-${s},0 z`;return{className:"leaflet-control-locate-heading",svg:``+'',w:s,h:e}}}),n=r.Control.extend({options:{position:"topleft",layer:void 0,setView:"untilPanOrZoom",keepCurrentZoomLevel:!1,initialZoomLevel:!1,getLocationBounds(t){return t.bounds},flyTo:!1,clickBehavior:{inView:"stop",outOfView:"setView",inViewNotFollowing:"inView"},returnToPrevBounds:!1,cacheLocation:!0,drawCircle:!0,drawMarker:!0,showCompass:!0,markerClass:t,compassClass:n,circleStyle:{className:"leaflet-control-locate-circle",color:"#136AEC",fillColor:"#136AEC",fillOpacity:.15,weight:0},markerStyle:{className:"leaflet-control-locate-marker",color:"#fff",fillColor:"#2A93EE",fillOpacity:1,weight:3,opacity:1,radius:9},compassStyle:{fillColor:"#2A93EE",fillOpacity:1,weight:0,color:"#fff",opacity:1,radius:9,width:9,depth:6},followCircleStyle:{},followMarkerStyle:{},followCompassStyle:{},icon:"leaflet-control-locate-location-arrow",iconLoading:"leaflet-control-locate-spinner",iconElementTag:"span",textElementTag:"small",circlePadding:[0,0],metric:!0,createButtonCallback(t,i){const e=r.DomUtil.create("a","leaflet-bar-part leaflet-bar-part-single",t);e.title=i.strings.title,e.href="#",e.setAttribute("role","button");const s=r.DomUtil.create(i.iconElementTag,i.icon,e);if(void 0!==i.strings.text){const n=r.DomUtil.create(i.textElementTag,"leaflet-locate-text",e);n.textContent=i.strings.text,e.classList.add("leaflet-locate-text-active"),e.parentNode.style.display="flex",0new r.Control.Locate(t),n},window); //# sourceMappingURL=leaflet.js.map \ No newline at end of file diff --git a/static/dist/map-area.js b/static/dist/map-area.js index 5d18df6b..438de281 100644 --- a/static/dist/map-area.js +++ b/static/dist/map-area.js @@ -1,4 +1,4 @@ -/*! @maps4html/web-map-custom-element 27-03-2024 */ +/*! @maps4html/web-map-custom-element 01-04-2024 */ import"./leaflet.js";import"./mapml.js";class MapArea extends HTMLAreaElement{static get observedAttributes(){return["coords","alt","href","shape","rel","type","target"]}get alt(){return this.hasAttribute("alt")?this.getAttribute("alt"):""}set alt(t){this.setAttribute("controls",t)}get coords(){return this.hasAttribute("coords")?this.getAttribute("coords"):""}set coords(t){}get href(){return this.hasAttribute("href")?this.getAttribute("href"):""}set href(t){this.href=t}get shape(){return this.hasAttribute("shape")?this.getAttribute("shape"):"default"}set shape(t){(t=t.toLowerCase()).search(/default|circle|rect|poly/)&&(this.shape=t)}get rel(){return this.hasAttribute("rel")?this.getAttribute("rel"):""}set rel(t){this.rel=t}get type(){return this.hasAttribute("type")?this.getAttribute("type"):""}set type(t){this.type=t}get target(){return this.hasAttribute("target")?this.getAttribute("target"):""}constructor(){super()}attributeChangedCallback(t,e,r){}connectedCallback(){this.parentElement.whenReady().then(()=>{this._attachedToMap()})}_attachedToMap(){this._map=this.parentElement._map;var t=this.parentElement._map;if(!this._feature){var e,r,s=this._styleToPathOptions(window.getComputedStyle(this)),i=this.coords?this._coordsToArray(this.coords):null;if(i&&this.parentElement.poster)for(var a=(this.parentElement.poster.width-this.parentElement.width)/2,h=(this.parentElement.poster.height-this.parentElement.height)/2,o=0;o{this.parentElement.querySelector("map-caption").textContent!==t&&this.parentElement.setAttribute("aria-label",this.parentElement.querySelector("map-caption").textContent)}),this.observer.observe(this,{characterData:!0,subtree:!0,attributes:!0,childList:!0}),this.parentElement.hasAttribute("aria-label")||(e=this.textContent,this.parentElement.setAttribute("aria-label",e))}}disconnectedCallback(){this.observer.disconnect()}}export{MapCaption}; //# sourceMappingURL=map-caption.js.map \ No newline at end of file diff --git a/static/dist/map-extent.js b/static/dist/map-extent.js index 899f4d72..5c80ffd9 100644 --- a/static/dist/map-extent.js +++ b/static/dist/map-extent.js @@ -1,4 +1,4 @@ -/*! @maps4html/web-map-custom-element 27-03-2024 */ +/*! @maps4html/web-map-custom-element 01-04-2024 */ -class MapExtent extends HTMLElement{static get observedAttributes(){return["checked","label","opacity","hidden"]}#hasConnected;get units(){return this.getAttribute("units")||M.FALLBACK_PROJECTION}get checked(){return this.hasAttribute("checked")}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked")}get label(){return this.hasAttribute("label")?this.getAttribute("label"):M.options.locale.dfExtent}set label(e){e&&this.setAttribute("label",e)}get opacity(){return+(this._opacity??this.getAttribute("opacity"))}set opacity(e){1<+e||+e<0||this.setAttribute("opacity",e)}get hidden(){return this.hasAttribute("hidden")}set hidden(e){e?this.setAttribute("hidden",""):this.removeAttribute("hidden")}get extent(){const e=e=>Object.assign(M._convertAndFormatPCRS(e._extentLayer.bounds,M[e.units],e.units),{zoom:e._extentLayer.zoomBounds});var t;return this._extentLayer.bounds?e(this):((t=this)._calculateBounds(),e(t))}getOuterHTML(){let t=this.cloneNode(!0);if(this.querySelector("map-link")){let e=t.querySelectorAll("map-link");e.forEach(e=>{e.hasAttribute("href")?e.setAttribute("href",decodeURI(new URL(e.attributes.href.value,this.baseURI||document.baseURI).href)):e.hasAttribute("tref")&&e.setAttribute("tref",decodeURI(new URL(e.attributes.tref.value,this.baseURI||document.baseURI).href))})}var e=t.outerHTML;return t.remove(),e}zoomTo(){var e=this.extent;let t=this.getMapEl()._map,a=e.topLeft.pcrs.horizontal,r=e.bottomRight.pcrs.horizontal,i=e.bottomRight.pcrs.vertical,n=e.topLeft.pcrs.vertical,o=L.bounds(L.point(a,i),L.point(r,n)),s=t.options.crs.unproject(o.getCenter(!0)),l=e.zoom.maxZoom,h=e.zoom.minZoom;t.setView(s,M.getMaxZoom(o,t,h,l),{animate:!1})}getMapEl(){return(this.getRootNode()instanceof ShadowRoot?this.getRootNode().host:this).closest("mapml-viewer,map[is=web-map]")}getLayerEl(){return this.getRootNode()instanceof ShadowRoot?this.getRootNode().host:this.closest("layer-")}attributeChangedCallback(e,t,a){if(this.#hasConnected)switch(e){case"units":break;case"label":t!==a&&(this._layerControlHTML.querySelector(".mapml-extent-item-name").innerHTML=a||M.options.locale.dfExtent);break;case"checked":this.parentLayer.whenReady().then(()=>{this._handleChange(),this._calculateBounds(),this._layerControlCheckbox.checked=null!==a}).catch(e=>{console.log("Error while waiting on parentLayer for map-extent checked callback: "+e)});break;case"opacity":t!==a&&(this._opacity=a,this._extentLayer&&this._extentLayer.changeOpacity(a));break;case"hidden":t!==a&&this.parentLayer.whenReady().then(()=>{let e=this.parentLayer._propertiesGroupAnatomy;var t=Array.from(this.parentNode.querySelectorAll("map-extent:not([hidden])")).indexOf(this);null!==a?this._layerControlHTML.remove():0===t?e.insertAdjacentElement("afterbegin",this._layerControlHTML):0{console.log("Error while waiting on parentLayer for map-extent hidden callback")})}}constructor(){super(),this._createLayerControlExtentHTML=M._createLayerControlExtentHTML.bind(this),this._changeHandler=this._handleChange.bind(this)}async connectedCallback(){this.parentLayer="LAYER-"===this.parentNode.nodeName.toUpperCase()?this.parentNode:this.parentNode.host,this.hasAttribute("data-moving")||this.parentLayer.hasAttribute("data-moving")||(this.mapEl=this.parentLayer.closest("mapml-viewer,map[is=web-map]"),await this.mapEl.whenProjectionDefined(this.units).catch(()=>{throw new Error("Undefined projection:"+this.units)}),this.isConnected&&(this.#hasConnected=!0,this._map=this.mapEl._map,this.parentLayer.addEventListener("map-change",this._changeHandler),this.mapEl.addEventListener("map-projectionchange",this._changeHandler),this._opacity=this.opacity||1,this._extentLayer=M.extentLayer({opacity:this.opacity,crs:M[this.units],extentZIndex:Array.from(this.parentLayer.querySelectorAll("map-extent")).indexOf(this),extentEl:this}),this._layerControlHTML=this._createLayerControlExtentHTML(),this._calculateBounds(),this._runMutationObserver(this.children),this._bindMutationObserver()))}_bindMutationObserver(){this._observer=new MutationObserver(e=>{for(var t of e)"childList"===t.type&&this._runMutationObserver(t.addedNodes)}),this._observer.observe(this,{childList:!0})}_runMutationObserver(a){var r=e=>{this.whenReady().then(()=>{this._calculateBounds(),this._validateDisabled()})},i=e=>{this.whenReady().then(()=>{this._extentLayer.appendStyleLink(e)})},n=e=>{this.whenReady().then(()=>{this._extentLayer.appendStyleElement(e)})};for(let t=0;t{let t=r.length,a=0;for(let e=0;e map-meta[name=${e}]`)||this.parentLayer.shadowRoot.querySelector(`:host > map-meta[name=${e}]`):this.querySelector(`:scope > map-meta[name=${e}]`)||this.parentLayer.querySelector(`:scope > map-meta[name=${e}]`)}toggleLayerControlDisabled(){let e=this._layerControlCheckbox,t=this._layerControlLabel,a=this._opacityControl,r=this._opacitySlider,i=this._selectdetails;this.disabled?(e.disabled=!0,r.disabled=!0,t.style.fontStyle="italic",a.style.fontStyle="italic",i&&i.forEach(e=>{e.querySelectorAll("select").forEach(e=>{e.disabled=!0,e.style.fontStyle="italic"}),e.style.fontStyle="italic"})):(e.disabled=!1,r.disabled=!1,t.style.fontStyle="normal",a.style.fontStyle="normal",i&&i.forEach(e=>{e.querySelectorAll("select").forEach(e=>{e.disabled=!1,e.style.fontStyle="normal"}),e.style.fontStyle="normal"}))}_handleChange(){this.checked&&!this.disabled?(this._extentLayer.addTo(this.parentLayer._layer),this._extentLayer.setZIndex(Array.from(this.parentLayer.querySelectorAll("map-extent")).indexOf(this))):this.parentLayer._layer.removeLayer(this._extentLayer)}_validateLayerControlContainerHidden(){let e=this.parentLayer._propertiesGroupAnatomy,t=this.parentLayer.src?this.parentLayer.shadowRoot:this.parentLayer;e&&(0===t.querySelectorAll("map-extent:not([hidden])").length?e.setAttribute("hidden",""):e.removeAttribute("hidden"))}disconnectedCallback(){this.hasAttribute("data-moving")||this.parentLayer.hasAttribute("data-moving")||!this._extentLayer||(this._validateLayerControlContainerHidden(),this._layerControlHTML.remove(),this.parentLayer._layer&&this.parentLayer._layer.removeLayer(this._extentLayer),this.parentLayer.removeEventListener("map-change",this._changeHandler),this.mapEl.removeEventListener("map-projectionchange",this._changeHandler),delete this._extentLayer,this.parentLayer._layer&&delete this.parentLayer._layer.bounds)}_calculateBounds(){delete this._extentLayer.bounds,delete this._extentLayer.zoomBounds,this.parentLayer._layer&&delete this.parentLayer._layer.bounds;let t=this.querySelectorAll("map-link[rel=image],map-link[rel=tile],map-link[rel=features],map-link[rel=query]"),a=this.querySelector(":scope > map-meta[name=extent][content]")?M.getBoundsFromMeta(this):void 0,r=this.querySelector(":scope > map-meta[name=zoom][content]")?M.getZoomBoundsFromMeta(this):void 0;for(let e=0;e{let r,i;this._extentLayer?t():(r=setInterval(function(e){e._extentLayer?(clearInterval(r),clearTimeout(i),t()):e.isConnected||(clearInterval(r),clearTimeout(i),a("map-extent was disconnected while waiting to be ready"))},300,this),i=setTimeout(function(){clearInterval(r),clearTimeout(i),a("Timeout reached waiting for extent to be ready")},1e4))})}whenLinksReady(){var e;let t=[];for(e of[...this.querySelectorAll("map-link[rel=image],map-link[rel=tile],map-link[rel=features],map-link[rel=query]")])t.push(e.whenReady());return Promise.allSettled(t)}}export{MapExtent}; +class MapExtent extends HTMLElement{static get observedAttributes(){return["checked","label","opacity","hidden"]}#hasConnected;get units(){return this.getAttribute("units")||M.FALLBACK_PROJECTION}get checked(){return this.hasAttribute("checked")}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked")}get label(){return this.hasAttribute("label")?this.getAttribute("label"):M.options.locale.dfExtent}set label(e){e&&this.setAttribute("label",e)}get opacity(){return+(this._opacity??this.getAttribute("opacity"))}set opacity(e){1<+e||+e<0||this.setAttribute("opacity",e)}get hidden(){return this.hasAttribute("hidden")}set hidden(e){e?this.setAttribute("hidden",""):this.removeAttribute("hidden")}get extent(){const e=e=>Object.assign(M._convertAndFormatPCRS(e._extentLayer.bounds,M[e.units],e.units),{zoom:e._extentLayer.zoomBounds});var t;return this._extentLayer.bounds?e(this):((t=this)._calculateBounds(),e(t))}getOuterHTML(){let t=this.cloneNode(!0);if(this.querySelector("map-link")){let e=t.querySelectorAll("map-link");e.forEach(e=>{e.hasAttribute("href")?e.setAttribute("href",decodeURI(new URL(e.attributes.href.value,this.baseURI||document.baseURI).href)):e.hasAttribute("tref")&&e.setAttribute("tref",decodeURI(new URL(e.attributes.tref.value,this.baseURI||document.baseURI).href))})}var e=t.outerHTML;return t.remove(),e}zoomTo(){var e=this.extent;let t=this.getMapEl()._map,a=e.topLeft.pcrs.horizontal,r=e.bottomRight.pcrs.horizontal,i=e.bottomRight.pcrs.vertical,n=e.topLeft.pcrs.vertical,o=L.bounds(L.point(a,i),L.point(r,n)),s=t.options.crs.unproject(o.getCenter(!0)),l=e.zoom.maxZoom,h=e.zoom.minZoom;t.setView(s,M.getMaxZoom(o,t,h,l),{animate:!1})}getMapEl(){return M.getClosest(this,"mapml-viewer,map[is=web-map]")}getLayerEl(){return M.getClosest(this,"layer-")}attributeChangedCallback(e,t,a){if(this.#hasConnected)switch(e){case"units":break;case"label":t!==a&&(this._layerControlHTML.querySelector(".mapml-extent-item-name").innerHTML=a||M.options.locale.dfExtent);break;case"checked":this.parentLayer.whenReady().then(()=>{this._handleChange(),this._calculateBounds(),this._layerControlCheckbox.checked=null!==a}).catch(e=>{console.log("Error while waiting on parentLayer for map-extent checked callback: "+e)});break;case"opacity":t!==a&&(this._opacity=a,this._extentLayer&&this._extentLayer.changeOpacity(a));break;case"hidden":t!==a&&this.parentLayer.whenReady().then(()=>{let e=this.parentLayer._propertiesGroupAnatomy;var t=Array.from(this.parentNode.querySelectorAll("map-extent:not([hidden])")).indexOf(this);null!==a?this._layerControlHTML.remove():0===t?e.insertAdjacentElement("afterbegin",this._layerControlHTML):0{console.log("Error while waiting on parentLayer for map-extent hidden callback")})}}constructor(){super(),this._createLayerControlExtentHTML=M._createLayerControlExtentHTML.bind(this),this._changeHandler=this._handleChange.bind(this)}async connectedCallback(){this.parentLayer="LAYER-"===this.parentNode.nodeName.toUpperCase()?this.parentNode:this.parentNode.host,this.hasAttribute("data-moving")||this.parentLayer.hasAttribute("data-moving")||(this.mapEl=this.parentLayer.closest("mapml-viewer,map[is=web-map]"),await this.mapEl.whenProjectionDefined(this.units).catch(()=>{throw new Error("Undefined projection:"+this.units)}),this.isConnected&&(this.#hasConnected=!0,this._map=this.mapEl._map,this.parentLayer.addEventListener("map-change",this._changeHandler),this.mapEl.addEventListener("map-projectionchange",this._changeHandler),this._opacity=this.opacity||1,this._extentLayer=M.extentLayer({opacity:this.opacity,crs:M[this.units],extentZIndex:Array.from(this.parentLayer.querySelectorAll("map-extent")).indexOf(this),extentEl:this}),this._layerControlHTML=this._createLayerControlExtentHTML(),this._calculateBounds(),this._runMutationObserver(this.children),this._bindMutationObserver()))}_bindMutationObserver(){this._observer=new MutationObserver(e=>{for(var t of e)"childList"===t.type&&this._runMutationObserver(t.addedNodes)}),this._observer.observe(this,{childList:!0})}_runMutationObserver(a){var r=e=>{this.whenReady().then(()=>{this._calculateBounds(),this._validateDisabled()})},i=e=>{this.whenReady().then(()=>{this._extentLayer.appendStyleLink(e)})},n=e=>{this.whenReady().then(()=>{this._extentLayer.appendStyleElement(e)})};for(let t=0;t{let t=r.length,a=0;for(let e=0;e map-meta[name=${e}]`)||this.parentLayer.shadowRoot.querySelector(`:host > map-meta[name=${e}]`):this.querySelector(`:scope > map-meta[name=${e}]`)||this.parentLayer.querySelector(`:scope > map-meta[name=${e}]`)}toggleLayerControlDisabled(){let e=this._layerControlCheckbox,t=this._layerControlLabel,a=this._opacityControl,r=this._opacitySlider,i=this._selectdetails;this.disabled?(e.disabled=!0,r.disabled=!0,t.style.fontStyle="italic",a.style.fontStyle="italic",i&&i.forEach(e=>{e.querySelectorAll("select").forEach(e=>{e.disabled=!0,e.style.fontStyle="italic"}),e.style.fontStyle="italic"})):(e.disabled=!1,r.disabled=!1,t.style.fontStyle="normal",a.style.fontStyle="normal",i&&i.forEach(e=>{e.querySelectorAll("select").forEach(e=>{e.disabled=!1,e.style.fontStyle="normal"}),e.style.fontStyle="normal"}))}_handleChange(){this.checked&&!this.disabled?(this._extentLayer.addTo(this.parentLayer._layer),this._extentLayer.setZIndex(Array.from(this.parentLayer.querySelectorAll("map-extent")).indexOf(this))):this.parentLayer._layer.removeLayer(this._extentLayer)}_validateLayerControlContainerHidden(){let e=this.parentLayer._propertiesGroupAnatomy,t=this.parentLayer.src?this.parentLayer.shadowRoot:this.parentLayer;e&&(0===t.querySelectorAll("map-extent:not([hidden])").length?e.setAttribute("hidden",""):e.removeAttribute("hidden"))}disconnectedCallback(){this.hasAttribute("data-moving")||this.parentLayer.hasAttribute("data-moving")||!this._extentLayer||(this._validateLayerControlContainerHidden(),this._layerControlHTML.remove(),this.parentLayer._layer&&this.parentLayer._layer.removeLayer(this._extentLayer),this.parentLayer.removeEventListener("map-change",this._changeHandler),this.mapEl.removeEventListener("map-projectionchange",this._changeHandler),delete this._extentLayer,this.parentLayer._layer&&delete this.parentLayer._layer.bounds)}_calculateBounds(){delete this._extentLayer.bounds,delete this._extentLayer.zoomBounds,this.parentLayer._layer&&delete this.parentLayer._layer.bounds;let t=this.querySelectorAll("map-link[rel=image],map-link[rel=tile],map-link[rel=features],map-link[rel=query]"),a=this.querySelector(":scope > map-meta[name=extent][content]")?M.getBoundsFromMeta(this):void 0,r=this.querySelector(":scope > map-meta[name=zoom][content]")?M.getZoomBoundsFromMeta(this):void 0;for(let e=0;e{let r,i;this._extentLayer?t():(r=setInterval(function(e){e._extentLayer?(clearInterval(r),clearTimeout(i),t()):e.isConnected||(clearInterval(r),clearTimeout(i),a("map-extent was disconnected while waiting to be ready"))},300,this),i=setTimeout(function(){clearInterval(r),clearTimeout(i),a("Timeout reached waiting for extent to be ready")},1e4))})}whenLinksReady(){var e;let t=[];for(e of[...this.querySelectorAll("map-link[rel=image],map-link[rel=tile],map-link[rel=features],map-link[rel=query]")])t.push(e.whenReady());return Promise.allSettled(t)}}export{MapExtent}; //# sourceMappingURL=map-extent.js.map \ No newline at end of file diff --git a/static/dist/map-extent.js.map b/static/dist/map-extent.js.map index b2121d9d..7ac51f14 100644 --- a/static/dist/map-extent.js.map +++ b/static/dist/map-extent.js.map @@ -1 +1 @@ -{"version":3,"file":"map-extent.js","sources":["../src/map-extent.js"],"sourcesContent":["/* global M */\nexport class MapExtent extends HTMLElement {\n static get observedAttributes() {\n return ['checked', 'label', 'opacity', 'hidden'];\n }\n /* jshint ignore:start */\n #hasConnected;\n /* jshint ignore:end */\n get units() {\n return this.getAttribute('units') || M.FALLBACK_PROJECTION;\n }\n\n get checked() {\n return this.hasAttribute('checked');\n }\n\n set checked(val) {\n if (val) {\n this.setAttribute('checked', '');\n } else {\n this.removeAttribute('checked');\n }\n }\n get label() {\n return this.hasAttribute('label')\n ? this.getAttribute('label')\n : M.options.locale.dfExtent;\n }\n set label(val) {\n if (val) {\n this.setAttribute('label', val);\n }\n }\n get opacity() {\n // use ?? since 0 is falsy, || would return rhs in that case\n return +(this._opacity ?? this.getAttribute('opacity'));\n }\n\n set opacity(val) {\n if (+val > 1 || +val < 0) return;\n this.setAttribute('opacity', val);\n }\n get hidden() {\n return this.hasAttribute('hidden');\n }\n\n set hidden(val) {\n if (val) {\n this.setAttribute('hidden', '');\n } else {\n this.removeAttribute('hidden');\n }\n }\n get extent() {\n const getExtent = (extent) => {\n return Object.assign(\n M._convertAndFormatPCRS(\n extent._extentLayer.bounds,\n M[extent.units],\n extent.units\n ),\n { zoom: extent._extentLayer.zoomBounds }\n );\n };\n const getCalculatedExtent = (extent) => {\n extent._calculateBounds();\n return getExtent(extent);\n };\n\n return this._extentLayer.bounds\n ? getExtent(this)\n : getCalculatedExtent(this);\n }\n\n getOuterHTML() {\n let tempElement = this.cloneNode(true);\n\n if (this.querySelector('map-link')) {\n let mapLinks = tempElement.querySelectorAll('map-link');\n\n mapLinks.forEach((mapLink) => {\n if (mapLink.hasAttribute('href')) {\n mapLink.setAttribute(\n 'href',\n decodeURI(\n new URL(\n mapLink.attributes.href.value,\n this.baseURI ? this.baseURI : document.baseURI\n ).href\n )\n );\n } else if (mapLink.hasAttribute('tref')) {\n mapLink.setAttribute(\n 'tref',\n decodeURI(\n new URL(\n mapLink.attributes.tref.value,\n this.baseURI ? this.baseURI : document.baseURI\n ).href\n )\n );\n }\n });\n }\n\n let outerLayer = tempElement.outerHTML;\n\n tempElement.remove();\n\n return outerLayer;\n }\n\n zoomTo() {\n let extent = this.extent;\n let map = this.getMapEl()._map,\n xmin = extent.topLeft.pcrs.horizontal,\n xmax = extent.bottomRight.pcrs.horizontal,\n ymin = extent.bottomRight.pcrs.vertical,\n ymax = extent.topLeft.pcrs.vertical,\n bounds = L.bounds(L.point(xmin, ymin), L.point(xmax, ymax)),\n center = map.options.crs.unproject(bounds.getCenter(true)),\n maxZoom = extent.zoom.maxZoom,\n minZoom = extent.zoom.minZoom;\n map.setView(center, M.getMaxZoom(bounds, map, minZoom, maxZoom), {\n animate: false\n });\n }\n getMapEl() {\n return this.getRootNode() instanceof ShadowRoot\n ? this.getRootNode().host.closest('mapml-viewer,map[is=web-map]')\n : this.closest('mapml-viewer,map[is=web-map]');\n }\n getLayerEl() {\n return this.getRootNode() instanceof ShadowRoot\n ? this.getRootNode().host\n : this.closest('layer-');\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (this.#hasConnected /* jshint ignore:line */) {\n switch (name) {\n case 'units':\n if (oldValue !== newValue) {\n // handle side effects\n }\n break;\n case 'label':\n if (oldValue !== newValue) {\n this._layerControlHTML.querySelector(\n '.mapml-extent-item-name'\n ).innerHTML = newValue || M.options.locale.dfExtent;\n }\n break;\n case 'checked':\n this.parentLayer\n .whenReady()\n .then(() => {\n this._handleChange();\n this._calculateBounds();\n this._layerControlCheckbox.checked = newValue !== null;\n })\n .catch((error) => {\n console.log(\n 'Error while waiting on parentLayer for map-extent checked callback: ' +\n error\n );\n });\n break;\n case 'opacity':\n if (oldValue !== newValue) {\n this._opacity = newValue;\n if (this._extentLayer) this._extentLayer.changeOpacity(newValue);\n }\n break;\n case 'hidden':\n if (oldValue !== newValue) {\n this.parentLayer\n .whenReady()\n .then(() => {\n let extentsRootFieldset =\n this.parentLayer._propertiesGroupAnatomy;\n let position = Array.from(\n this.parentNode.querySelectorAll('map-extent:not([hidden])')\n ).indexOf(this);\n if (newValue !== null) {\n // remove from layer control (hide from user)\n this._layerControlHTML.remove();\n } else {\n // insert the extent fieldset into the layer control container in\n // the calculated position\n if (position === 0) {\n extentsRootFieldset.insertAdjacentElement(\n 'afterbegin',\n this._layerControlHTML\n );\n } else if (position > 0) {\n this.parentNode\n .querySelectorAll('map-extent:not([hidden])')\n [position - 1]._layerControlHTML.insertAdjacentElement(\n 'afterend',\n this._layerControlHTML\n );\n }\n }\n this._validateLayerControlContainerHidden();\n })\n .catch(() => {\n console.log(\n 'Error while waiting on parentLayer for map-extent hidden callback'\n );\n });\n }\n break;\n }\n }\n }\n constructor() {\n // Always call super first in constructor\n super();\n this._createLayerControlExtentHTML =\n M._createLayerControlExtentHTML.bind(this);\n this._changeHandler = this._handleChange.bind(this);\n }\n async connectedCallback() {\n // this.parentNode.host returns the layer- element when parentNode is\n // the shadow root\n this.parentLayer =\n this.parentNode.nodeName.toUpperCase() === 'LAYER-'\n ? this.parentNode\n : this.parentNode.host;\n if (\n this.hasAttribute('data-moving') ||\n this.parentLayer.hasAttribute('data-moving')\n )\n return;\n this.mapEl = this.parentLayer.closest('mapml-viewer,map[is=web-map]');\n await this.mapEl.whenProjectionDefined(this.units).catch(() => {\n throw new Error('Undefined projection:' + this.units);\n });\n // when projection is changed, the parent layer-._layer is created (so whenReady is fulfilled) but then removed,\n // then the map-extent disconnectedCallback will be triggered by layer-._onRemove() (clear the shadowRoot)\n // even before connectedCallback is finished\n // in this case, the microtasks triggered by the fulfillment of the removed MapMLLayer should be stopped as well\n // !this.isConnected <=> the disconnectedCallback has run before\n if (!this.isConnected) return;\n /* jshint ignore:start */\n this.#hasConnected = true;\n /* jshint ignore:end */\n this._map = this.mapEl._map;\n this.parentLayer.addEventListener('map-change', this._changeHandler);\n this.mapEl.addEventListener('map-projectionchange', this._changeHandler);\n // this._opacity is used to record the current opacity value (with or without updates),\n // the initial value of this._opacity should be set as opacity attribute value, if exists, or the default value 1.0\n this._opacity = this.opacity || 1.0;\n this._extentLayer = M.extentLayer({\n opacity: this.opacity,\n crs: M[this.units],\n extentZIndex: Array.from(\n this.parentLayer.querySelectorAll('map-extent')\n ).indexOf(this),\n extentEl: this\n });\n // this._layerControlHTML is the fieldset for the extent in the LayerControl\n this._layerControlHTML = this._createLayerControlExtentHTML();\n this._calculateBounds();\n // instead of children using parents' whenReady which can be cyclic,\n // when this element is ready, run stuff that is only available after\n // initialization\n this._runMutationObserver(this.children);\n // make sure same thing happens when children are added\n this._bindMutationObserver();\n }\n /*\n * Set up a function to watch additions of child elements of map-extent\n * and to invoke desired side effects of those additions via\n * _runMutationObserver\n */\n _bindMutationObserver() {\n this._observer = new MutationObserver((mutationList) => {\n for (let mutation of mutationList) {\n // the attributes changes should be handled by attributeChangedCallback()\n if (mutation.type === 'childList') {\n this._runMutationObserver(mutation.addedNodes);\n }\n }\n });\n // childList observes immediate children only (not grandchildren etc)\n this._observer.observe(this, {\n childList: true\n });\n }\n _runMutationObserver(elementsGroup) {\n const _addMetaElement = (mapMeta) => {\n this.whenReady().then(() => {\n this._calculateBounds();\n this._validateDisabled();\n });\n };\n const _addStylesheetLink = (mapLink) => {\n this.whenReady().then(() => {\n this._extentLayer.appendStyleLink(mapLink);\n });\n };\n const _addStyleElement = (mapStyle) => {\n this.whenReady().then(() => {\n this._extentLayer.appendStyleElement(mapStyle);\n });\n };\n for (let i = 0; i < elementsGroup.length; ++i) {\n let element = elementsGroup[i];\n switch (element.nodeName) {\n case 'MAP-META':\n const name =\n element.hasAttribute('name') &&\n (element.getAttribute('name').toLowerCase() === 'zoom' ||\n element.getAttribute('name').toLowerCase() === 'extent');\n if (name && element.hasAttribute('content')) {\n _addMetaElement(element);\n }\n break;\n case 'MAP-LINK':\n if (element.link && !element.link.isConnected)\n _addStylesheetLink(element);\n break;\n case 'MAP-STYLE':\n if (element.styleElement && !element.styleElement.isConnected) {\n _addStyleElement(element);\n }\n break;\n default:\n break;\n }\n }\n }\n getLayerControlHTML() {\n return this._layerControlHTML;\n }\n _projectionMatch() {\n return (\n this.units.toUpperCase() === this._map.options.projection.toUpperCase()\n );\n }\n _validateDisabled() {\n if (!this._extentLayer) return;\n let templates = this.querySelectorAll(\n 'map-link[rel=image],map-link[rel=tile],map-link[rel=features],map-link[rel=query]'\n );\n const noTemplateVisible = () => {\n let totalTemplateCount = templates.length,\n disabledTemplateCount = 0;\n for (let j = 0; j < totalTemplateCount; j++) {\n if (!templates[j]._validateDisabled()) {\n disabledTemplateCount++;\n }\n }\n return disabledTemplateCount === totalTemplateCount;\n };\n if (!this._projectionMatch() || noTemplateVisible()) {\n this.setAttribute('disabled', '');\n this.disabled = true;\n } else {\n this.removeAttribute('disabled');\n this.disabled = false;\n }\n this.toggleLayerControlDisabled();\n this._handleChange();\n return this.disabled;\n }\n getMeta(metaName) {\n let name = metaName.toLowerCase();\n if (name !== 'extent' && name !== 'zoom') return;\n return this.parentLayer.src\n ? this.querySelector(`:scope > map-meta[name=${name}]`) ||\n this.parentLayer.shadowRoot.querySelector(\n `:host > map-meta[name=${name}]`\n )\n : this.querySelector(`:scope > map-meta[name=${name}]`) ||\n this.parentLayer.querySelector(`:scope > map-meta[name=${name}]`);\n }\n // disable/italicize layer control elements based on the map-extent.disabled property\n toggleLayerControlDisabled() {\n let input = this._layerControlCheckbox,\n label = this._layerControlLabel, // access to the label for the specific map-extent\n opacityControl = this._opacityControl,\n opacitySlider = this._opacitySlider,\n selectDetails = this._selectdetails;\n if (this.disabled) {\n // update the status of layerControl\n input.disabled = true;\n opacitySlider.disabled = true;\n label.style.fontStyle = 'italic';\n opacityControl.style.fontStyle = 'italic';\n if (selectDetails) {\n selectDetails.forEach((i) => {\n i.querySelectorAll('select').forEach((j) => {\n j.disabled = true;\n j.style.fontStyle = 'italic';\n });\n i.style.fontStyle = 'italic';\n });\n }\n } else {\n input.disabled = false;\n opacitySlider.disabled = false;\n label.style.fontStyle = 'normal';\n opacityControl.style.fontStyle = 'normal';\n if (selectDetails) {\n selectDetails.forEach((i) => {\n i.querySelectorAll('select').forEach((j) => {\n j.disabled = false;\n j.style.fontStyle = 'normal';\n });\n i.style.fontStyle = 'normal';\n });\n }\n }\n }\n\n _handleChange() {\n // add _extentLayer to map if map-extent is checked, otherwise remove it\n if (this.checked && !this.disabled) {\n // can be added to mapmllayer layerGroup no matter layer- is checked or not\n this._extentLayer.addTo(this.parentLayer._layer);\n this._extentLayer.setZIndex(\n Array.from(this.parentLayer.querySelectorAll('map-extent')).indexOf(\n this\n )\n );\n } else {\n this.parentLayer._layer.removeLayer(this._extentLayer);\n }\n // change the checkbox in the layer control to match map-extent.checked\n // doesn't trigger the event handler because it's not user-caused AFAICT\n }\n _validateLayerControlContainerHidden() {\n let extentsFieldset = this.parentLayer._propertiesGroupAnatomy;\n let nodeToSearch = this.parentLayer.src\n ? this.parentLayer.shadowRoot\n : this.parentLayer;\n if (!extentsFieldset) return;\n if (\n nodeToSearch.querySelectorAll('map-extent:not([hidden])').length === 0\n ) {\n extentsFieldset.setAttribute('hidden', '');\n } else {\n extentsFieldset.removeAttribute('hidden');\n }\n }\n disconnectedCallback() {\n // in case of projection change, the disconnectedcallback will be triggered by removing layer-._layer even before\n // map-extent.connectedcallback is finished (because it will wait for the layer- to be ready)\n // !this._extentLayer <=> this.connectedCallback has not yet been finished before disconnectedCallback is triggered\n if (\n this.hasAttribute('data-moving') ||\n this.parentLayer.hasAttribute('data-moving') ||\n !this._extentLayer\n )\n return;\n this._validateLayerControlContainerHidden();\n // remove layer control for map-extent from layer control DOM\n // TODO: for the case of projection change, the layer control for map-extent has been created while _extentLayer has not yet been ready\n this._layerControlHTML.remove();\n if (this.parentLayer._layer) {\n this.parentLayer._layer.removeLayer(this._extentLayer);\n }\n this.parentLayer.removeEventListener('map-change', this._changeHandler);\n this.mapEl.removeEventListener('map-projectionchange', this._changeHandler);\n delete this._extentLayer;\n if (this.parentLayer._layer) delete this.parentLayer._layer.bounds;\n }\n _calculateBounds() {\n delete this._extentLayer.bounds;\n delete this._extentLayer.zoomBounds;\n if (this.parentLayer._layer) delete this.parentLayer._layer.bounds;\n let zoomMax = -Infinity,\n zoomMin = Infinity,\n maxNativeZoom = -Infinity,\n minNativeZoom = Infinity,\n templates = this.querySelectorAll(\n 'map-link[rel=image],map-link[rel=tile],map-link[rel=features],map-link[rel=query]'\n );\n\n // initialize bounds from this.scope > map-meta\n let bounds = this.querySelector(':scope > map-meta[name=extent][content]')\n ? M.getBoundsFromMeta(this) // TODO rewrite this pile of doo doo\n : undefined;\n\n // initialize zoom bounds from this.scope > map-meta\n let zoomBounds = this.querySelector(':scope > map-meta[name=zoom][content]')\n ? M.getZoomBoundsFromMeta(this) // TODO rewrite this pile of doo doo\n : undefined;\n\n // bounds should be able to be calculated unconditionally, not depend on map-extent.checked\n for (let j = 0; j < templates.length; j++) {\n const templateZoomBounds = templates[j].getZoomBounds(),\n templateBounds = templates[j].getBounds();\n let zoomMax =\n zoomBounds && zoomBounds.hasOwnProperty('maxZoom')\n ? zoomBounds.maxZoom\n : -Infinity,\n zoomMin =\n zoomBounds && zoomBounds.hasOwnProperty('minZoom')\n ? zoomBounds.minZoom\n : Infinity,\n minNativeZoom =\n zoomBounds && zoomBounds.hasOwnProperty('minNativeZoom')\n ? zoomBounds.minNativeZoom\n : Infinity,\n maxNativeZoom =\n zoomBounds && zoomBounds.hasOwnProperty('maxNativeZoom')\n ? zoomBounds.maxNativeZoom\n : -Infinity;\n if (!zoomBounds) {\n zoomBounds = Object.assign({}, templateZoomBounds);\n } else {\n zoomMax = Math.max(zoomMax, templateZoomBounds.maxZoom);\n zoomMin = Math.min(zoomMin, templateZoomBounds.minZoom);\n maxNativeZoom = Math.max(\n maxNativeZoom,\n templateZoomBounds.maxNativeZoom\n );\n minNativeZoom = Math.min(\n minNativeZoom,\n templateZoomBounds.minNativeZoom\n );\n zoomBounds.minZoom = zoomMin;\n zoomBounds.maxZoom = zoomMax;\n zoomBounds.minNativeZoom = minNativeZoom;\n zoomBounds.maxNativeZoom = maxNativeZoom;\n }\n if (!bounds) {\n bounds = L.bounds(templateBounds.min, templateBounds.max);\n } else {\n bounds.extend(templateBounds);\n }\n }\n if (bounds) {\n this._extentLayer.bounds = bounds;\n } else {\n this._extentLayer.bounds = L.bounds(\n M[this.units].options.bounds.min,\n M[this.units].options.bounds.max\n );\n }\n if (!zoomBounds) zoomBounds = {};\n if (!zoomBounds.hasOwnProperty('minZoom')) {\n zoomBounds.minZoom = 0;\n }\n if (!zoomBounds.hasOwnProperty('maxZoom')) {\n zoomBounds.maxZoom = M[this.units].options.resolutions.length - 1;\n }\n if (\n !zoomBounds.hasOwnProperty('minNativeZoom') ||\n zoomBounds.minNativeZoom === Infinity\n ) {\n zoomBounds.minNativeZoom = zoomBounds.minZoom;\n }\n if (\n !zoomBounds.hasOwnProperty('maxNativeZoom') ||\n zoomBounds.maxNativeZoom === -Infinity\n ) {\n zoomBounds.maxNativeZoom = zoomBounds.maxZoom;\n }\n this._extentLayer.zoomBounds = zoomBounds;\n }\n\n whenReady() {\n return new Promise((resolve, reject) => {\n let interval, failureTimer;\n if (this._extentLayer) {\n resolve();\n } else {\n let extentElement = this;\n interval = setInterval(testForExtent, 300, extentElement);\n failureTimer = setTimeout(extentNotDefined, 10000);\n }\n function testForExtent(extentElement) {\n if (extentElement._extentLayer) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n resolve();\n } else if (!extentElement.isConnected) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('map-extent was disconnected while waiting to be ready');\n }\n }\n function extentNotDefined() {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('Timeout reached waiting for extent to be ready');\n }\n });\n }\n\n whenLinksReady() {\n let templates = this.querySelectorAll(\n 'map-link[rel=image],map-link[rel=tile],map-link[rel=features],map-link[rel=query]'\n );\n let linksReady = [];\n for (let link of [...templates]) {\n linksReady.push(link.whenReady());\n }\n return Promise.allSettled(linksReady);\n }\n}\n"],"names":["MapExtent","HTMLElement","observedAttributes","#hasConnected","units","this","getAttribute","M","FALLBACK_PROJECTION","checked","hasAttribute","val","setAttribute","removeAttribute","label","options","locale","dfExtent","opacity","_opacity","hidden","extent","getExtent","Object","assign","_convertAndFormatPCRS","_extentLayer","bounds","zoom","zoomBounds","_calculateBounds","getOuterHTML","let","tempElement","cloneNode","querySelector","mapLinks","querySelectorAll","forEach","mapLink","decodeURI","URL","attributes","href","value","baseURI","document","tref","outerLayer","outerHTML","remove","zoomTo","map","getMapEl","_map","xmin","topLeft","pcrs","horizontal","xmax","bottomRight","ymin","vertical","ymax","L","point","center","crs","unproject","getCenter","maxZoom","minZoom","setView","getMaxZoom","animate","getRootNode","ShadowRoot","host","closest","getLayerEl","attributeChangedCallback","name","oldValue","newValue","_layerControlHTML","innerHTML","parentLayer","whenReady","then","_handleChange","_layerControlCheckbox","catch","console","log","error","changeOpacity","extentsRootFieldset","_propertiesGroupAnatomy","position","Array","from","parentNode","indexOf","insertAdjacentElement","_validateLayerControlContainerHidden","constructor","super","_createLayerControlExtentHTML","bind","_changeHandler","connectedCallback","nodeName","toUpperCase","mapEl","whenProjectionDefined","Error","isConnected","addEventListener","extentLayer","extentZIndex","extentEl","_runMutationObserver","children","_bindMutationObserver","_observer","MutationObserver","mutation","mutationList","type","addedNodes","observe","childList","elementsGroup","_addMetaElement","_validateDisabled","_addStylesheetLink","appendStyleLink","_addStyleElement","appendStyleElement","mapStyle","i","length","element","toLowerCase","link","styleElement","getLayerControlHTML","_projectionMatch","projection","templates","totalTemplateCount","disabledTemplateCount","j","noTemplateVisible","disabled","toggleLayerControlDisabled","getMeta","metaName","src","shadowRoot","input","_layerControlLabel","opacityControl","_opacityControl","opacitySlider","_opacitySlider","selectDetails","_selectdetails","style","fontStyle","addTo","_layer","setZIndex","removeLayer","extentsFieldset","nodeToSearch","disconnectedCallback","removeEventListener","getBoundsFromMeta","undefined","getZoomBoundsFromMeta","templateZoomBounds","getZoomBounds","templateBounds","getBounds","zoomMax","hasOwnProperty","Infinity","zoomMin","minNativeZoom","maxNativeZoom","Math","max","min","extend","resolutions","Promise","resolve","reject","interval","failureTimer","setInterval","extentElement","clearInterval","clearTimeout","setTimeout","whenLinksReady","linksReady","push","allSettled"],"mappings":";;MACaA,kBAAkBC,YAC7BC,gCACE,MAAO,CAAC,UAAW,QAAS,UAAW,UAGzCC,cAEAC,YACE,OAAOC,KAAKC,aAAa,UAAYC,EAAEC,oBAGzCC,cACE,OAAOJ,KAAKK,aAAa,WAG3BD,YAAYE,GACNA,EACFN,KAAKO,aAAa,UAAW,IAE7BP,KAAKQ,gBAAgB,WAGzBC,YACE,OAAOT,KAAKK,aAAa,SACrBL,KAAKC,aAAa,SAClBC,EAAEQ,QAAQC,OAAOC,SAEvBH,UAAUH,GACJA,GACFN,KAAKO,aAAa,QAASD,GAG/BO,cAEE,QAASb,KAAKc,UAAYd,KAAKC,aAAa,YAG9CY,YAAYP,GACC,GAANA,IAAYA,EAAM,GACvBN,KAAKO,aAAa,UAAWD,GAE/BS,aACE,OAAOf,KAAKK,aAAa,UAG3BU,WAAWT,GACLA,EACFN,KAAKO,aAAa,SAAU,IAE5BP,KAAKQ,gBAAgB,UAGzBQ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sources":["../src/map-extent.js"],"sourcesContent":["/* global M */\nexport class MapExtent extends HTMLElement {\n static get observedAttributes() {\n return ['checked', 'label', 'opacity', 'hidden'];\n }\n /* jshint ignore:start */\n #hasConnected;\n /* jshint ignore:end */\n get units() {\n return this.getAttribute('units') || M.FALLBACK_PROJECTION;\n }\n\n get checked() {\n return this.hasAttribute('checked');\n }\n\n set checked(val) {\n if (val) {\n this.setAttribute('checked', '');\n } else {\n this.removeAttribute('checked');\n }\n }\n get label() {\n return this.hasAttribute('label')\n ? this.getAttribute('label')\n : M.options.locale.dfExtent;\n }\n set label(val) {\n if (val) {\n this.setAttribute('label', val);\n }\n }\n get opacity() {\n // use ?? since 0 is falsy, || would return rhs in that case\n return +(this._opacity ?? this.getAttribute('opacity'));\n }\n\n set opacity(val) {\n if (+val > 1 || +val < 0) return;\n this.setAttribute('opacity', val);\n }\n get hidden() {\n return this.hasAttribute('hidden');\n }\n\n set hidden(val) {\n if (val) {\n this.setAttribute('hidden', '');\n } else {\n this.removeAttribute('hidden');\n }\n }\n get extent() {\n const getExtent = (extent) => {\n return Object.assign(\n M._convertAndFormatPCRS(\n extent._extentLayer.bounds,\n M[extent.units],\n extent.units\n ),\n { zoom: extent._extentLayer.zoomBounds }\n );\n };\n const getCalculatedExtent = (extent) => {\n extent._calculateBounds();\n return getExtent(extent);\n };\n\n return this._extentLayer.bounds\n ? getExtent(this)\n : getCalculatedExtent(this);\n }\n\n getOuterHTML() {\n let tempElement = this.cloneNode(true);\n\n if (this.querySelector('map-link')) {\n let mapLinks = tempElement.querySelectorAll('map-link');\n\n mapLinks.forEach((mapLink) => {\n if (mapLink.hasAttribute('href')) {\n mapLink.setAttribute(\n 'href',\n decodeURI(\n new URL(\n mapLink.attributes.href.value,\n this.baseURI ? this.baseURI : document.baseURI\n ).href\n )\n );\n } else if (mapLink.hasAttribute('tref')) {\n mapLink.setAttribute(\n 'tref',\n decodeURI(\n new URL(\n mapLink.attributes.tref.value,\n this.baseURI ? this.baseURI : document.baseURI\n ).href\n )\n );\n }\n });\n }\n\n let outerLayer = tempElement.outerHTML;\n\n tempElement.remove();\n\n return outerLayer;\n }\n\n zoomTo() {\n let extent = this.extent;\n let map = this.getMapEl()._map,\n xmin = extent.topLeft.pcrs.horizontal,\n xmax = extent.bottomRight.pcrs.horizontal,\n ymin = extent.bottomRight.pcrs.vertical,\n ymax = extent.topLeft.pcrs.vertical,\n bounds = L.bounds(L.point(xmin, ymin), L.point(xmax, ymax)),\n center = map.options.crs.unproject(bounds.getCenter(true)),\n maxZoom = extent.zoom.maxZoom,\n minZoom = extent.zoom.minZoom;\n map.setView(center, M.getMaxZoom(bounds, map, minZoom, maxZoom), {\n animate: false\n });\n }\n\n getMapEl() {\n return M.getClosest(this, 'mapml-viewer,map[is=web-map]');\n }\n getLayerEl() {\n return M.getClosest(this, 'layer-');\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (this.#hasConnected /* jshint ignore:line */) {\n switch (name) {\n case 'units':\n if (oldValue !== newValue) {\n // handle side effects\n }\n break;\n case 'label':\n if (oldValue !== newValue) {\n this._layerControlHTML.querySelector(\n '.mapml-extent-item-name'\n ).innerHTML = newValue || M.options.locale.dfExtent;\n }\n break;\n case 'checked':\n this.parentLayer\n .whenReady()\n .then(() => {\n this._handleChange();\n this._calculateBounds();\n this._layerControlCheckbox.checked = newValue !== null;\n })\n .catch((error) => {\n console.log(\n 'Error while waiting on parentLayer for map-extent checked callback: ' +\n error\n );\n });\n break;\n case 'opacity':\n if (oldValue !== newValue) {\n this._opacity = newValue;\n if (this._extentLayer) this._extentLayer.changeOpacity(newValue);\n }\n break;\n case 'hidden':\n if (oldValue !== newValue) {\n this.parentLayer\n .whenReady()\n .then(() => {\n let extentsRootFieldset =\n this.parentLayer._propertiesGroupAnatomy;\n let position = Array.from(\n this.parentNode.querySelectorAll('map-extent:not([hidden])')\n ).indexOf(this);\n if (newValue !== null) {\n // remove from layer control (hide from user)\n this._layerControlHTML.remove();\n } else {\n // insert the extent fieldset into the layer control container in\n // the calculated position\n if (position === 0) {\n extentsRootFieldset.insertAdjacentElement(\n 'afterbegin',\n this._layerControlHTML\n );\n } else if (position > 0) {\n this.parentNode\n .querySelectorAll('map-extent:not([hidden])')\n [position - 1]._layerControlHTML.insertAdjacentElement(\n 'afterend',\n this._layerControlHTML\n );\n }\n }\n this._validateLayerControlContainerHidden();\n })\n .catch(() => {\n console.log(\n 'Error while waiting on parentLayer for map-extent hidden callback'\n );\n });\n }\n break;\n }\n }\n }\n constructor() {\n // Always call super first in constructor\n super();\n this._createLayerControlExtentHTML =\n M._createLayerControlExtentHTML.bind(this);\n this._changeHandler = this._handleChange.bind(this);\n }\n async connectedCallback() {\n // this.parentNode.host returns the layer- element when parentNode is\n // the shadow root\n this.parentLayer =\n this.parentNode.nodeName.toUpperCase() === 'LAYER-'\n ? this.parentNode\n : this.parentNode.host;\n if (\n this.hasAttribute('data-moving') ||\n this.parentLayer.hasAttribute('data-moving')\n )\n return;\n this.mapEl = this.parentLayer.closest('mapml-viewer,map[is=web-map]');\n await this.mapEl.whenProjectionDefined(this.units).catch(() => {\n throw new Error('Undefined projection:' + this.units);\n });\n // when projection is changed, the parent layer-._layer is created (so whenReady is fulfilled) but then removed,\n // then the map-extent disconnectedCallback will be triggered by layer-._onRemove() (clear the shadowRoot)\n // even before connectedCallback is finished\n // in this case, the microtasks triggered by the fulfillment of the removed MapMLLayer should be stopped as well\n // !this.isConnected <=> the disconnectedCallback has run before\n if (!this.isConnected) return;\n /* jshint ignore:start */\n this.#hasConnected = true;\n /* jshint ignore:end */\n this._map = this.mapEl._map;\n this.parentLayer.addEventListener('map-change', this._changeHandler);\n this.mapEl.addEventListener('map-projectionchange', this._changeHandler);\n // this._opacity is used to record the current opacity value (with or without updates),\n // the initial value of this._opacity should be set as opacity attribute value, if exists, or the default value 1.0\n this._opacity = this.opacity || 1.0;\n this._extentLayer = M.extentLayer({\n opacity: this.opacity,\n crs: M[this.units],\n extentZIndex: Array.from(\n this.parentLayer.querySelectorAll('map-extent')\n ).indexOf(this),\n extentEl: this\n });\n // this._layerControlHTML is the fieldset for the extent in the LayerControl\n this._layerControlHTML = this._createLayerControlExtentHTML();\n this._calculateBounds();\n // instead of children using parents' whenReady which can be cyclic,\n // when this element is ready, run stuff that is only available after\n // initialization\n this._runMutationObserver(this.children);\n // make sure same thing happens when children are added\n this._bindMutationObserver();\n }\n /*\n * Set up a function to watch additions of child elements of map-extent\n * and to invoke desired side effects of those additions via\n * _runMutationObserver\n */\n _bindMutationObserver() {\n this._observer = new MutationObserver((mutationList) => {\n for (let mutation of mutationList) {\n // the attributes changes should be handled by attributeChangedCallback()\n if (mutation.type === 'childList') {\n this._runMutationObserver(mutation.addedNodes);\n }\n }\n });\n // childList observes immediate children only (not grandchildren etc)\n this._observer.observe(this, {\n childList: true\n });\n }\n _runMutationObserver(elementsGroup) {\n const _addMetaElement = (mapMeta) => {\n this.whenReady().then(() => {\n this._calculateBounds();\n this._validateDisabled();\n });\n };\n const _addStylesheetLink = (mapLink) => {\n this.whenReady().then(() => {\n this._extentLayer.appendStyleLink(mapLink);\n });\n };\n const _addStyleElement = (mapStyle) => {\n this.whenReady().then(() => {\n this._extentLayer.appendStyleElement(mapStyle);\n });\n };\n for (let i = 0; i < elementsGroup.length; ++i) {\n let element = elementsGroup[i];\n switch (element.nodeName) {\n case 'MAP-META':\n const name =\n element.hasAttribute('name') &&\n (element.getAttribute('name').toLowerCase() === 'zoom' ||\n element.getAttribute('name').toLowerCase() === 'extent');\n if (name && element.hasAttribute('content')) {\n _addMetaElement(element);\n }\n break;\n case 'MAP-LINK':\n if (element.link && !element.link.isConnected)\n _addStylesheetLink(element);\n break;\n case 'MAP-STYLE':\n if (element.styleElement && !element.styleElement.isConnected) {\n _addStyleElement(element);\n }\n break;\n default:\n break;\n }\n }\n }\n getLayerControlHTML() {\n return this._layerControlHTML;\n }\n _projectionMatch() {\n return (\n this.units.toUpperCase() === this._map.options.projection.toUpperCase()\n );\n }\n _validateDisabled() {\n if (!this._extentLayer) return;\n let templates = this.querySelectorAll(\n 'map-link[rel=image],map-link[rel=tile],map-link[rel=features],map-link[rel=query]'\n );\n const noTemplateVisible = () => {\n let totalTemplateCount = templates.length,\n disabledTemplateCount = 0;\n for (let j = 0; j < totalTemplateCount; j++) {\n if (!templates[j]._validateDisabled()) {\n disabledTemplateCount++;\n }\n }\n return disabledTemplateCount === totalTemplateCount;\n };\n if (!this._projectionMatch() || noTemplateVisible()) {\n this.setAttribute('disabled', '');\n this.disabled = true;\n } else {\n this.removeAttribute('disabled');\n this.disabled = false;\n }\n this.toggleLayerControlDisabled();\n this._handleChange();\n return this.disabled;\n }\n getMeta(metaName) {\n let name = metaName.toLowerCase();\n if (name !== 'extent' && name !== 'zoom') return;\n return this.parentLayer.src\n ? this.querySelector(`:scope > map-meta[name=${name}]`) ||\n this.parentLayer.shadowRoot.querySelector(\n `:host > map-meta[name=${name}]`\n )\n : this.querySelector(`:scope > map-meta[name=${name}]`) ||\n this.parentLayer.querySelector(`:scope > map-meta[name=${name}]`);\n }\n // disable/italicize layer control elements based on the map-extent.disabled property\n toggleLayerControlDisabled() {\n let input = this._layerControlCheckbox,\n label = this._layerControlLabel, // access to the label for the specific map-extent\n opacityControl = this._opacityControl,\n opacitySlider = this._opacitySlider,\n selectDetails = this._selectdetails;\n if (this.disabled) {\n // update the status of layerControl\n input.disabled = true;\n opacitySlider.disabled = true;\n label.style.fontStyle = 'italic';\n opacityControl.style.fontStyle = 'italic';\n if (selectDetails) {\n selectDetails.forEach((i) => {\n i.querySelectorAll('select').forEach((j) => {\n j.disabled = true;\n j.style.fontStyle = 'italic';\n });\n i.style.fontStyle = 'italic';\n });\n }\n } else {\n input.disabled = false;\n opacitySlider.disabled = false;\n label.style.fontStyle = 'normal';\n opacityControl.style.fontStyle = 'normal';\n if (selectDetails) {\n selectDetails.forEach((i) => {\n i.querySelectorAll('select').forEach((j) => {\n j.disabled = false;\n j.style.fontStyle = 'normal';\n });\n i.style.fontStyle = 'normal';\n });\n }\n }\n }\n\n _handleChange() {\n // add _extentLayer to map if map-extent is checked, otherwise remove it\n if (this.checked && !this.disabled) {\n // can be added to mapmllayer layerGroup no matter layer- is checked or not\n this._extentLayer.addTo(this.parentLayer._layer);\n this._extentLayer.setZIndex(\n Array.from(this.parentLayer.querySelectorAll('map-extent')).indexOf(\n this\n )\n );\n } else {\n this.parentLayer._layer.removeLayer(this._extentLayer);\n }\n // change the checkbox in the layer control to match map-extent.checked\n // doesn't trigger the event handler because it's not user-caused AFAICT\n }\n _validateLayerControlContainerHidden() {\n let extentsFieldset = this.parentLayer._propertiesGroupAnatomy;\n let nodeToSearch = this.parentLayer.src\n ? this.parentLayer.shadowRoot\n : this.parentLayer;\n if (!extentsFieldset) return;\n if (\n nodeToSearch.querySelectorAll('map-extent:not([hidden])').length === 0\n ) {\n extentsFieldset.setAttribute('hidden', '');\n } else {\n extentsFieldset.removeAttribute('hidden');\n }\n }\n disconnectedCallback() {\n // in case of projection change, the disconnectedcallback will be triggered by removing layer-._layer even before\n // map-extent.connectedcallback is finished (because it will wait for the layer- to be ready)\n // !this._extentLayer <=> this.connectedCallback has not yet been finished before disconnectedCallback is triggered\n if (\n this.hasAttribute('data-moving') ||\n this.parentLayer.hasAttribute('data-moving') ||\n !this._extentLayer\n )\n return;\n this._validateLayerControlContainerHidden();\n // remove layer control for map-extent from layer control DOM\n // TODO: for the case of projection change, the layer control for map-extent has been created while _extentLayer has not yet been ready\n this._layerControlHTML.remove();\n if (this.parentLayer._layer) {\n this.parentLayer._layer.removeLayer(this._extentLayer);\n }\n this.parentLayer.removeEventListener('map-change', this._changeHandler);\n this.mapEl.removeEventListener('map-projectionchange', this._changeHandler);\n delete this._extentLayer;\n if (this.parentLayer._layer) delete this.parentLayer._layer.bounds;\n }\n _calculateBounds() {\n delete this._extentLayer.bounds;\n delete this._extentLayer.zoomBounds;\n if (this.parentLayer._layer) delete this.parentLayer._layer.bounds;\n let zoomMax = -Infinity,\n zoomMin = Infinity,\n maxNativeZoom = -Infinity,\n minNativeZoom = Infinity,\n templates = this.querySelectorAll(\n 'map-link[rel=image],map-link[rel=tile],map-link[rel=features],map-link[rel=query]'\n );\n\n // initialize bounds from this.scope > map-meta\n let bounds = this.querySelector(':scope > map-meta[name=extent][content]')\n ? M.getBoundsFromMeta(this) // TODO rewrite this pile of doo doo\n : undefined;\n\n // initialize zoom bounds from this.scope > map-meta\n let zoomBounds = this.querySelector(':scope > map-meta[name=zoom][content]')\n ? M.getZoomBoundsFromMeta(this) // TODO rewrite this pile of doo doo\n : undefined;\n\n // bounds should be able to be calculated unconditionally, not depend on map-extent.checked\n for (let j = 0; j < templates.length; j++) {\n const templateZoomBounds = templates[j].getZoomBounds(),\n templateBounds = templates[j].getBounds();\n let zoomMax =\n zoomBounds && zoomBounds.hasOwnProperty('maxZoom')\n ? zoomBounds.maxZoom\n : -Infinity,\n zoomMin =\n zoomBounds && zoomBounds.hasOwnProperty('minZoom')\n ? zoomBounds.minZoom\n : Infinity,\n minNativeZoom =\n zoomBounds && zoomBounds.hasOwnProperty('minNativeZoom')\n ? zoomBounds.minNativeZoom\n : Infinity,\n maxNativeZoom =\n zoomBounds && zoomBounds.hasOwnProperty('maxNativeZoom')\n ? zoomBounds.maxNativeZoom\n : -Infinity;\n if (!zoomBounds) {\n zoomBounds = Object.assign({}, templateZoomBounds);\n } else {\n zoomMax = Math.max(zoomMax, templateZoomBounds.maxZoom);\n zoomMin = Math.min(zoomMin, templateZoomBounds.minZoom);\n maxNativeZoom = Math.max(\n maxNativeZoom,\n templateZoomBounds.maxNativeZoom\n );\n minNativeZoom = Math.min(\n minNativeZoom,\n templateZoomBounds.minNativeZoom\n );\n zoomBounds.minZoom = zoomMin;\n zoomBounds.maxZoom = zoomMax;\n zoomBounds.minNativeZoom = minNativeZoom;\n zoomBounds.maxNativeZoom = maxNativeZoom;\n }\n if (!bounds) {\n bounds = L.bounds(templateBounds.min, templateBounds.max);\n } else {\n bounds.extend(templateBounds);\n }\n }\n if (bounds) {\n this._extentLayer.bounds = bounds;\n } else {\n this._extentLayer.bounds = L.bounds(\n M[this.units].options.bounds.min,\n M[this.units].options.bounds.max\n );\n }\n if (!zoomBounds) zoomBounds = {};\n if (!zoomBounds.hasOwnProperty('minZoom')) {\n zoomBounds.minZoom = 0;\n }\n if (!zoomBounds.hasOwnProperty('maxZoom')) {\n zoomBounds.maxZoom = M[this.units].options.resolutions.length - 1;\n }\n if (\n !zoomBounds.hasOwnProperty('minNativeZoom') ||\n zoomBounds.minNativeZoom === Infinity\n ) {\n zoomBounds.minNativeZoom = zoomBounds.minZoom;\n }\n if (\n !zoomBounds.hasOwnProperty('maxNativeZoom') ||\n zoomBounds.maxNativeZoom === -Infinity\n ) {\n zoomBounds.maxNativeZoom = zoomBounds.maxZoom;\n }\n this._extentLayer.zoomBounds = zoomBounds;\n }\n\n whenReady() {\n return new Promise((resolve, reject) => {\n let interval, failureTimer;\n if (this._extentLayer) {\n resolve();\n } else {\n let extentElement = this;\n interval = setInterval(testForExtent, 300, extentElement);\n failureTimer = setTimeout(extentNotDefined, 10000);\n }\n function testForExtent(extentElement) {\n if (extentElement._extentLayer) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n resolve();\n } else if (!extentElement.isConnected) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('map-extent was disconnected while waiting to be ready');\n }\n }\n function extentNotDefined() {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('Timeout reached waiting for extent to be ready');\n }\n });\n }\n\n whenLinksReady() {\n let templates = this.querySelectorAll(\n 'map-link[rel=image],map-link[rel=tile],map-link[rel=features],map-link[rel=query]'\n );\n let linksReady = [];\n for (let link of [...templates]) {\n linksReady.push(link.whenReady());\n }\n return Promise.allSettled(linksReady);\n }\n}\n"],"names":["MapExtent","HTMLElement","observedAttributes","#hasConnected","units","this","getAttribute","M","FALLBACK_PROJECTION","checked","hasAttribute","val","setAttribute","removeAttribute","label","options","locale","dfExtent","opacity","_opacity","hidden","extent","getExtent","Object","assign","_convertAndFormatPCRS","_extentLayer","bounds","zoom","zoomBounds","_calculateBounds","getOuterHTML","let","tempElement","cloneNode","querySelector","mapLinks","querySelectorAll","forEach","mapLink","decodeURI","URL","attributes","href","value","baseURI","document","tref","outerLayer","outerHTML","remove","zoomTo","map","getMapEl","_map","xmin","topLeft","pcrs","horizontal","xmax","bottomRight","ymin","vertical","ymax","L","point","center","crs","unproject","getCenter","maxZoom","minZoom","setView","getMaxZoom","animate","getClosest","getLayerEl","attributeChangedCallback","name","oldValue","newValue","_layerControlHTML","innerHTML","parentLayer","whenReady","then","_handleChange","_layerControlCheckbox","catch","console","log","error","changeOpacity","extentsRootFieldset","_propertiesGroupAnatomy","position","Array","from","parentNode","indexOf","insertAdjacentElement","_validateLayerControlContainerHidden","constructor","super","_createLayerControlExtentHTML","bind","_changeHandler","connectedCallback","nodeName","toUpperCase","host","mapEl","closest","whenProjectionDefined","Error","isConnected","addEventListener","extentLayer","extentZIndex","extentEl","_runMutationObserver","children","_bindMutationObserver","_observer","MutationObserver","mutation","mutationList","type","addedNodes","observe","childList","elementsGroup","_addMetaElement","_validateDisabled","_addStylesheetLink","appendStyleLink","_addStyleElement","appendStyleElement","mapStyle","i","length","element","toLowerCase","link","styleElement","getLayerControlHTML","_projectionMatch","projection","templates","totalTemplateCount","disabledTemplateCount","j","noTemplateVisible","disabled","toggleLayerControlDisabled","getMeta","metaName","src","shadowRoot","input","_layerControlLabel","opacityControl","_opacityControl","opacitySlider","_opacitySlider","selectDetails","_selectdetails","style","fontStyle","addTo","_layer","setZIndex","removeLayer","extentsFieldset","nodeToSearch","disconnectedCallback","removeEventListener","getBoundsFromMeta","undefined","getZoomBoundsFromMeta","templateZoomBounds","getZoomBounds","templateBounds","getBounds","zoomMax","hasOwnProperty","Infinity","zoomMin","minNativeZoom","maxNativeZoom","Math","max","min","extend","resolutions","Promise","resolve","reject","interval","failureTimer","setInterval","extentElement","clearInterval","clearTimeout","setTimeout","whenLinksReady","linksReady","push","allSettled"],"m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O,IAAI+G,QAAQ,CAACC,EAASC,KAC3BrK,IAAIsK,EAAUC,EACVlM,KAAKqB,aACP0K,KAGAE,EAAWE,YAGb,SAAuBC,GACjBA,EAAc/K,cAChBgL,cAAcJ,GACdK,aAAaJ,GACbH,KACUK,EAActF,cACxBuF,cAAcJ,GACdK,aAAaJ,GACbF,EAAO,2DAX6B,IADlBhM,MAEpBkM,EAAeK,WAajB,WACEF,cAAcJ,GACdK,aAAaJ,GACbF,EAAO,mDAhBqC,QAqBlDQ,iBACE7K,IAIS+G,EADT/G,IAAI8K,EAAa,GACjB,IAAS/D,IAAQ,IAJD1I,KAAKgC,iBACnB,sFAIAyK,EAAWC,KAAKhE,EAAK3D,aAEvB,OAAO+G,QAAQa,WAAWF,WAtlBjB9M"} \ No newline at end of file diff --git a/static/dist/map-feature.js b/static/dist/map-feature.js index 497316ab..a816f883 100644 --- a/static/dist/map-feature.js +++ b/static/dist/map-feature.js @@ -1,4 +1,4 @@ -/*! @maps4html/web-map-custom-element 27-03-2024 */ +/*! @maps4html/web-map-custom-element 01-04-2024 */ -class MapFeature extends HTMLElement{static get observedAttributes(){return["zoom","min","max"]}#hasConnected;get zoom(){let t={},e=this.getMeta("zoom");return e&&(t=M._metaContentToObject(e.getAttribute("content"))),"MAP-LINK"===this._parentEl.nodeName?+(this.hasAttribute("zoom")?this.getAttribute("zoom"):t.value||t.max||this._initialZoom):+(this.hasAttribute("zoom")?this.getAttribute("zoom"):this._initialZoom)}set zoom(t){t=parseInt(t,10);!isNaN(t)&&t>=this.min&&t<=this.max&&this.setAttribute("zoom",t)}get min(){let t={},e=this.getMeta("zoom");e&&(t=M._metaContentToObject(e.getAttribute("content")));return"MAP-LINK"===this._parentEl.nodeName?+(this.hasAttribute("min")?this.getAttribute("min"):t.min||this._parentEl.getZoomBounds().minZoom):+(this.hasAttribute("min")?this.getAttribute("min"):t.min||0)}set min(t){var e=parseInt(t,10),t=this.getLayerEl().extent.zoom;isNaN(e)||(e>=t.minZoom&&e<=t.maxZoom?this.setAttribute("min",e):this.setAttribute("min",t.minZoom))}get max(){let t={},e=this.getMeta("zoom");e&&(t=M._metaContentToObject(e.getAttribute("content")));var o=this.getMapEl()._map.options.crs.options.resolutions.length-1;return"MAP-LINK"===this._parentEl.nodeName?+(this.hasAttribute("max")?this.getAttribute("max"):t.max||this._parentEl.getZoomBounds().maxZoom):+(this.hasAttribute("max")?this.getAttribute("max"):t.max||o)}set max(t){var e=parseInt(t,10),t=this.getLayerEl().extent.zoom;isNaN(e)||(e>=t.minZoom&&e<=t.maxZoom?this.setAttribute("max",e):this.setAttribute("max",t.maxZoom))}get extent(){if(this.isConnected)return this._getFeatureExtent||(this._getFeatureExtent=this._memoizeExtent()),this._getFeatureExtent()}getLayerEl(){let t;return t=this.getRootNode()instanceof ShadowRoot?this.getRootNode().host.getRootNode()instanceof ShadowRoot?this.getRootNode().host.getRootNode().host:"MAP-LINK"===this.getRootNode().host.nodeName?this.getRootNode().host.closest("layer-"):this.getRootNode().host:this.closest("layer-"),t}getMapEl(){return this.getLayerEl().closest("mapml-viewer,map[is=web-map]")}attributeChangedCallback(t,e,o){if(this.#hasConnected)switch(t){case"min":case"max":case"zoom":e!==o&&this.reRender(this._featureLayer)}}constructor(){super()}connectedCallback(){this.#hasConnected=!0,this._initialZoom=this.getMapEl().zoom,this._parentEl="LAYER-"===this.parentNode.nodeName.toUpperCase()||"MAP-LINK"===this.parentNode.nodeName.toUpperCase()?this.parentNode:this.parentNode.host,this.getLayerEl().hasAttribute("data-moving")||this._parentEl.parentElement?.hasAttribute("data-moving")||(this._observer=new MutationObserver(t=>{for(var e of t){if("attributes"===e.type&&e.target===this)return;this.reRender(this._featureLayer)}}),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,characterData:!0}))}disconnectedCallback(){this.getLayerEl()?.hasAttribute("data-moving")||this._parentEl.parentElement?.hasAttribute("data-moving")||(this._observer.disconnect(),this._featureLayer&&this.removeFeature(this._featureLayer))}reRender(e){if(this._groupEl.isConnected){var o=this._getFallbackCS();let t=document.createElement("span");this._groupEl.insertAdjacentElement("beforebegin",t),e._staticFeature&&e._removeFromFeaturesList(this._geometry),e.removeLayer(this._geometry),this._geometry=e.createGeometry(this,o).addTo(e),t.replaceWith(this._geometry.options.group),e._validateRendering(),delete this._getFeatureExtent,this._setUpEvents()}}removeFeature(t){t.removeLayer(this._geometry),t._staticFeature&&t._removeFromFeaturesList(this._geometry),t.options.properties=null,delete this._geometry,this._getFeatureExtent&&delete this._getFeatureExtent}addFeature(t){this._featureLayer=t;var e,o=this.getLayerEl();this.querySelector("map-geometry")&&(e=this._getFallbackCS(),o.src&&o.shadowRoot,this._geometry=t.createGeometry(this,e),this._geometry&&(t.addLayer(this._geometry),this._setUpEvents()))}_setUpEvents(){["click","focus","blur","keyup","keydown"].forEach(o=>{this._groupEl.addEventListener(o,e=>{if("click"===o){let t=new PointerEvent(o,{cancelable:!0});t.originalEvent=e,this.dispatchEvent(t)}else if("keyup"===o||"keydown"===o){let t=new KeyboardEvent(o,{cancelable:!0});t.originalEvent=e,this.dispatchEvent(t)}else{let t=new FocusEvent(o,{cancelable:!0});t.originalEvent=e,this.dispatchEvent(t)}})})}_getFallbackCS(){let e;if("MAP-LINK"===this._parentEl.nodeName)e=this._parentEl.shadowRoot.querySelector("map-meta[name=cs]")||this._parentEl.parentElement.getMeta("cs");else{let t=this.getLayerEl();e=(t.src?t.shadowRoot:t).querySelector("map-meta[name=cs]")}return e&&M._metaContentToObject(e.getAttribute("content")).content||"gcrs"}_memoizeExtent(){let p;return function(){if(p&&this._getFeatureExtent)return p;{let r=this.getMapEl()._map,t=this.querySelector("map-geometry"),e=t.getAttribute("cs")||this._getFallbackCS(),o=this.zoom,i=t.querySelectorAll("map-point, map-linestring, map-polygon, map-multipoint, map-multilinestring"),s=[1/0,1/0,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(var n of i){var m=n.querySelectorAll("map-coordinates");for(let t=0;t]+>/g,"").replace(/\s+/g," ").split(/[<>\ ]/g);switch(t.tagName.toUpperCase()){case"MAP-POINT":o=M._updateExtent(o,+i[0],+i[1]);break;case"MAP-LINESTRING":case"MAP-POLYGON":case"MAP-MULTIPOINT":case"MAP-MULTILINESTRING":for(let t=0;tr&&(r=this.min)),ri&&(r=i),r}getMeta(t){var e=t.toLowerCase();if("cs"===e||"zoom"===e||"projection"===e){var o=this._parentEl.shadowRoot.querySelector(`map-meta[name=${e}][content]`);return"MAP-LINK"===this._parentEl.nodeName?o||this._parentEl.parentElement.getMeta(t):(this._parentEl.src?this._parentEl.shadowRoot:this._parentEl).querySelector(`map-meta[name=${e}][content]`)}}mapml2geojson(t){t=Object.assign({},{propertyFunction:null,transform:!0},t);let e={type:"Feature",properties:{},geometry:{}},o=this.querySelector("map-properties");o?"function"==typeof t.propertyFunction?e.properties=t.propertyFunction(o):o.querySelector("table")?(n=o.querySelector("table").cloneNode(!0),e.properties=M._table2properties(n)):e.properties={prop0:o.innerHTML.replace(/(<([^>]+)>)/gi,"").replace(/\s/g,"")}:e.properties=null;let i=null,r=null,s=this.getMapEl()._map;t.transform&&(i=new proj4.Proj(s.options.crs.code),r=new proj4.Proj("EPSG:4326"),"EPSG:3857"!==s.options.crs.code&&"EPSG:4326"!==s.options.crs.code||(t.transform=!1));var a=this.querySelector("map-geometry").querySelector("map-geometrycollection"),n=this.querySelector("map-geometry").querySelectorAll("map-point, map-polygon, map-linestring, map-multipoint, map-multipolygon, map-multilinestring");if(a){e.geometry.type="GeometryCollection",e.geometry.geometries=[];for(var m of n)e.geometry.geometries.push(M._geometry2geojson(m,i,r,t.transform))}else e.geometry=M._geometry2geojson(n[0],i,r,t.transform);return e}click(){let t=this._groupEl,e=t.getBoundingClientRect();var o=new MouseEvent("click",{clientX:e.x+e.width/2,clientY:e.y+e.height/2,button:0}),i=this.querySelector("map-properties");if("link"===t.getAttribute("role"))for(var r of t.children)r.mousedown.call(this._geometry,o),r.mouseup.call(this._geometry,o);let s=new PointerEvent("click",{cancelable:!0});if(s.originalEvent=o,this.dispatchEvent(s),i&&this.isConnected){let t=this._geometry,e=t._layers;for(var a in e)e[a].isPopupOpen()&&e[a].closePopup();t.isPopupOpen()?t.closePopup():s.originalEvent.cancelBubble||t.openPopup()}}focus(t){this._groupEl.focus(t)}blur(){document.activeElement.shadowRoot?.activeElement!==this._groupEl&&document.activeElement.shadowRoot?.activeElement.parentNode!==this._groupEl||(this._groupEl.blur(),this.getMapEl()._map.getContainer().focus())}zoomTo(){let t=this.extent,e=this.getMapEl()._map,o=t.topLeft.pcrs,i=t.bottomRight.pcrs,r=L.bounds(L.point(o.horizontal,o.vertical),L.point(i.horizontal,i.vertical)),s=e.options.crs.unproject(r.getCenter(!0));e.setView(s,this.getZoomToZoom(),{animate:!1})}whenReady(){return new Promise((e,t)=>{let o,i;this.isConnected?e():(o=setInterval(function(t){t.isConnected&&(clearInterval(o),clearTimeout(i),e())},200,this),i=setTimeout(function(){clearInterval(o),clearTimeout(i),t("Timeout reached waiting for feature to be ready")},5e3))})}}export{MapFeature}; +class MapFeature extends HTMLElement{static get observedAttributes(){return["zoom","min","max"]}#hasConnected;get zoom(){let t={},e=this.getMeta("zoom");return e&&(t=M._metaContentToObject(e.getAttribute("content"))),"MAP-LINK"===this._parentEl.nodeName?+(this.hasAttribute("zoom")?this.getAttribute("zoom"):t.value||t.max||this._initialZoom):+(this.hasAttribute("zoom")?this.getAttribute("zoom"):this._initialZoom)}set zoom(t){t=parseInt(t,10);!isNaN(t)&&t>=this.min&&t<=this.max&&this.setAttribute("zoom",t)}get min(){let t={},e=this.getMeta("zoom");e&&(t=M._metaContentToObject(e.getAttribute("content")));return"MAP-LINK"===this._parentEl.nodeName?+(this.hasAttribute("min")?this.getAttribute("min"):t.min||this._parentEl.getZoomBounds().minZoom):+(this.hasAttribute("min")?this.getAttribute("min"):t.min||0)}set min(t){var e=parseInt(t,10),t=this.getLayerEl().extent.zoom;isNaN(e)||(e>=t.minZoom&&e<=t.maxZoom?this.setAttribute("min",e):this.setAttribute("min",t.minZoom))}get max(){let t={},e=this.getMeta("zoom");e&&(t=M._metaContentToObject(e.getAttribute("content")));var o=this.getMapEl()._map.options.crs.options.resolutions.length-1;return"MAP-LINK"===this._parentEl.nodeName?+(this.hasAttribute("max")?this.getAttribute("max"):t.max||this._parentEl.getZoomBounds().maxZoom):+(this.hasAttribute("max")?this.getAttribute("max"):t.max||o)}set max(t){var e=parseInt(t,10),t=this.getLayerEl().extent.zoom;isNaN(e)||(e>=t.minZoom&&e<=t.maxZoom?this.setAttribute("max",e):this.setAttribute("max",t.maxZoom))}get extent(){if(this.isConnected)return this._getFeatureExtent||(this._getFeatureExtent=this._memoizeExtent()),this._getFeatureExtent()}getMapEl(){return M.getClosest(this,"mapml-viewer,map[is=web-map]")}getLayerEl(){return M.getClosest(this,"layer-")}attributeChangedCallback(t,e,o){if(this.#hasConnected)switch(t){case"min":case"max":case"zoom":e!==o&&this.reRender(this._featureLayer)}}constructor(){super()}connectedCallback(){this.#hasConnected=!0,this._initialZoom=this.getMapEl().zoom,this._parentEl="LAYER-"===this.parentNode.nodeName.toUpperCase()||"MAP-LINK"===this.parentNode.nodeName.toUpperCase()?this.parentNode:this.parentNode.host,this.getLayerEl().hasAttribute("data-moving")||this._parentEl.parentElement?.hasAttribute("data-moving")||(this._observer=new MutationObserver(t=>{for(var e of t){if("attributes"===e.type&&e.target===this)return;this.reRender(this._featureLayer)}}),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,characterData:!0}))}disconnectedCallback(){this.getLayerEl()?.hasAttribute("data-moving")||this._parentEl.parentElement?.hasAttribute("data-moving")||(this._observer.disconnect(),this._featureLayer&&this.removeFeature(this._featureLayer))}reRender(e){if(this._groupEl.isConnected){var o=this._getFallbackCS();let t=document.createElement("span");this._groupEl.insertAdjacentElement("beforebegin",t),e._staticFeature&&e._removeFromFeaturesList(this._geometry),e.removeLayer(this._geometry),this._geometry=e.createGeometry(this,o).addTo(e),t.replaceWith(this._geometry.options.group),e._validateRendering(),delete this._getFeatureExtent,this._setUpEvents()}}removeFeature(t){t.removeLayer(this._geometry),t._staticFeature&&t._removeFromFeaturesList(this._geometry),t.options.properties=null,delete this._geometry,this._getFeatureExtent&&delete this._getFeatureExtent}addFeature(t){this._featureLayer=t;var e,o=this.getLayerEl();this.querySelector("map-geometry")&&(e=this._getFallbackCS(),o.src&&o.shadowRoot,this._geometry=t.createGeometry(this,e),this._geometry&&(t.addLayer(this._geometry),this._setUpEvents()))}_setUpEvents(){["click","focus","blur","keyup","keydown"].forEach(o=>{this._groupEl.addEventListener(o,e=>{if("click"===o){let t=new PointerEvent(o,{cancelable:!0});t.originalEvent=e,this.dispatchEvent(t)}else if("keyup"===o||"keydown"===o){let t=new KeyboardEvent(o,{cancelable:!0});t.originalEvent=e,this.dispatchEvent(t)}else{let t=new FocusEvent(o,{cancelable:!0});t.originalEvent=e,this.dispatchEvent(t)}})})}_getFallbackCS(){let e;if("MAP-LINK"===this._parentEl.nodeName)e=this._parentEl.shadowRoot.querySelector("map-meta[name=cs]")||this._parentEl.parentElement.getMeta("cs");else{let t=this.getLayerEl();e=(t.src?t.shadowRoot:t).querySelector("map-meta[name=cs]")}return e&&M._metaContentToObject(e.getAttribute("content")).content||"gcrs"}_memoizeExtent(){let p;return function(){if(p&&this._getFeatureExtent)return p;{let i=this.getMapEl()._map,t=this.querySelector("map-geometry"),e=t.getAttribute("cs")||this._getFallbackCS(),o=this.zoom,r=t.querySelectorAll("map-point, map-linestring, map-polygon, map-multipoint, map-multilinestring"),s=[1/0,1/0,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(var n of r){var m=n.querySelectorAll("map-coordinates");for(let t=0;t]+>/g,"").replace(/\s+/g," ").split(/[<>\ ]/g);switch(t.tagName.toUpperCase()){case"MAP-POINT":o=M._updateExtent(o,+r[0],+r[1]);break;case"MAP-LINESTRING":case"MAP-POLYGON":case"MAP-MULTIPOINT":case"MAP-MULTILINESTRING":for(let t=0;ti&&(i=this.min)),ir&&(i=r),i}getMeta(t){var e=t.toLowerCase();if("cs"===e||"zoom"===e||"projection"===e){var o=this._parentEl.shadowRoot.querySelector(`map-meta[name=${e}][content]`);return"MAP-LINK"===this._parentEl.nodeName?o||this._parentEl.parentElement.getMeta(t):(this._parentEl.src?this._parentEl.shadowRoot:this._parentEl).querySelector(`map-meta[name=${e}][content]`)}}mapml2geojson(t){t=Object.assign({},{propertyFunction:null,transform:!0},t);let e={type:"Feature",properties:{},geometry:{}},o=this.querySelector("map-properties");o?"function"==typeof t.propertyFunction?e.properties=t.propertyFunction(o):o.querySelector("table")?(n=o.querySelector("table").cloneNode(!0),e.properties=M._table2properties(n)):e.properties={prop0:o.innerHTML.replace(/(<([^>]+)>)/gi,"").replace(/\s/g,"")}:e.properties=null;let r=null,i=null,s=this.getMapEl()._map;t.transform&&(r=new proj4.Proj(s.options.crs.code),i=new proj4.Proj("EPSG:4326"),"EPSG:3857"!==s.options.crs.code&&"EPSG:4326"!==s.options.crs.code||(t.transform=!1));var a=this.querySelector("map-geometry").querySelector("map-geometrycollection"),n=this.querySelector("map-geometry").querySelectorAll("map-point, map-polygon, map-linestring, map-multipoint, map-multipolygon, map-multilinestring");if(a){e.geometry.type="GeometryCollection",e.geometry.geometries=[];for(var m of n)e.geometry.geometries.push(M._geometry2geojson(m,r,i,t.transform))}else e.geometry=M._geometry2geojson(n[0],r,i,t.transform);return e}click(){let t=this._groupEl,e=t.getBoundingClientRect();var o=new MouseEvent("click",{clientX:e.x+e.width/2,clientY:e.y+e.height/2,button:0}),r=this.querySelector("map-properties");if("link"===t.getAttribute("role"))for(var i of t.children)i.mousedown.call(this._geometry,o),i.mouseup.call(this._geometry,o);let s=new PointerEvent("click",{cancelable:!0});if(s.originalEvent=o,this.dispatchEvent(s),r&&this.isConnected){let t=this._geometry,e=t._layers;for(var a in e)e[a].isPopupOpen()&&e[a].closePopup();t.isPopupOpen()?t.closePopup():s.originalEvent.cancelBubble||t.openPopup()}}focus(t){this._groupEl.focus(t)}blur(){document.activeElement.shadowRoot?.activeElement!==this._groupEl&&document.activeElement.shadowRoot?.activeElement.parentNode!==this._groupEl||(this._groupEl.blur(),this.getMapEl()._map.getContainer().focus())}zoomTo(){let t=this.extent,e=this.getMapEl()._map,o=t.topLeft.pcrs,r=t.bottomRight.pcrs,i=L.bounds(L.point(o.horizontal,o.vertical),L.point(r.horizontal,r.vertical)),s=e.options.crs.unproject(i.getCenter(!0));e.setView(s,this.getZoomToZoom(),{animate:!1})}whenReady(){return new Promise((e,t)=>{let o,r;this.isConnected?e():(o=setInterval(function(t){t.isConnected&&(clearInterval(o),clearTimeout(r),e())},200,this),r=setTimeout(function(){clearInterval(o),clearTimeout(r),t("Timeout reached waiting for feature to be ready")},5e3))})}}export{MapFeature}; //# sourceMappingURL=map-feature.js.map \ No newline at end of file diff --git a/static/dist/map-feature.js.map b/static/dist/map-feature.js.map index da3bb8a0..78aea01b 100644 --- a/static/dist/map-feature.js.map +++ b/static/dist/map-feature.js.map @@ -1 +1 @@ -{"version":3,"file":"map-feature.js","sources":["../src/map-feature.js"],"sourcesContent":["export class MapFeature extends HTMLElement {\n static get observedAttributes() {\n return ['zoom', 'min', 'max'];\n }\n\n /* jshint ignore:start */\n #hasConnected;\n /* jshint ignore:end */\n get zoom() {\n // for templated or queried features ** native zoom is only used for zoomTo() **\n let meta = {},\n metaEl = this.getMeta('zoom');\n if (metaEl) meta = M._metaContentToObject(metaEl.getAttribute('content'));\n if (this._parentEl.nodeName === 'MAP-LINK') {\n // nativeZoom = zoom attribute || (sd.map-meta zoom 'value' || 'max') || this._initialZoom\n return +(this.hasAttribute('zoom')\n ? this.getAttribute('zoom')\n : meta.value\n ? meta.value\n : meta.max\n ? meta.max\n : this._initialZoom);\n } else {\n // for \"static\" features\n // nativeZoom zoom attribute || this._initialZoom\n // NOTE we don't use map-meta here, because the map-meta is the minimum\n // zoom bounds for the layer, and is extended by additional features\n // if added / removed during layer lifetime\n return +(this.hasAttribute('zoom')\n ? this.getAttribute('zoom')\n : this._initialZoom);\n }\n }\n\n set zoom(val) {\n var parsedVal = parseInt(val, 10);\n if (!isNaN(parsedVal) && parsedVal >= this.min && parsedVal <= this.max) {\n this.setAttribute('zoom', parsedVal);\n }\n }\n\n get min() {\n // for templated or queried features ** native zoom is only used for zoomTo() **\n let meta = {},\n metaEl = this.getMeta('zoom');\n if (metaEl) meta = M._metaContentToObject(metaEl.getAttribute('content'));\n let projectionMinZoom = 0;\n if (this._parentEl.nodeName === 'MAP-LINK') {\n // minZoom = min attribute || sd.map-meta min zoom || map-link minZoom\n return +(this.hasAttribute('min')\n ? this.getAttribute('min')\n : meta.min\n ? meta.min\n : this._parentEl.getZoomBounds().minZoom);\n } else {\n // for \"static\" features\n // minZoom = min attribute || map-meta zoom || projection minZoom\n return +(this.hasAttribute('min')\n ? this.getAttribute('min')\n : meta.min\n ? meta.min\n : projectionMinZoom);\n }\n }\n\n set min(val) {\n var parsedVal = parseInt(val, 10);\n var layerZoomBounds = this.getLayerEl().extent.zoom;\n if (!isNaN(parsedVal)) {\n if (\n parsedVal >= layerZoomBounds.minZoom &&\n parsedVal <= layerZoomBounds.maxZoom\n ) {\n this.setAttribute('min', parsedVal);\n } else {\n this.setAttribute('min', layerZoomBounds.minZoom);\n }\n }\n }\n\n get max() {\n // for templated or queried features ** native zoom is only used for zoomTo() **\n let meta = {},\n metaEl = this.getMeta('zoom');\n if (metaEl) meta = M._metaContentToObject(metaEl.getAttribute('content'));\n let projectionMaxZoom =\n this.getMapEl()._map.options.crs.options.resolutions.length - 1;\n if (this._parentEl.nodeName === 'MAP-LINK') {\n // maxZoom = max attribute || sd.map-meta max zoom || map-link maxZoom\n return +(this.hasAttribute('max')\n ? this.getAttribute('max')\n : meta.max\n ? meta.max\n : this._parentEl.getZoomBounds().maxZoom);\n } else {\n // for \"static\" features\n // maxZoom = max attribute || map-meta zoom max || projection maxZoom\n return +(this.hasAttribute('max')\n ? this.getAttribute('max')\n : meta.max\n ? meta.max\n : projectionMaxZoom);\n }\n }\n\n set max(val) {\n var parsedVal = parseInt(val, 10);\n var layerZoomBounds = this.getLayerEl().extent.zoom;\n if (!isNaN(parsedVal)) {\n if (\n parsedVal >= layerZoomBounds.minZoom &&\n parsedVal <= layerZoomBounds.maxZoom\n ) {\n this.setAttribute('max', parsedVal);\n } else {\n this.setAttribute('max', layerZoomBounds.maxZoom);\n }\n }\n }\n\n get extent() {\n if (this.isConnected) {\n // if the feature extent is the first time to be calculated or the feature extent is changed (by changing\n // the innertext of map-coordinates), then calculate feature extent by invoking the getFeatureExtent function\n if (!this._getFeatureExtent) {\n this._getFeatureExtent = this._memoizeExtent();\n }\n return this._getFeatureExtent();\n }\n }\n getLayerEl() {\n let layerEl;\n if (this.getRootNode() instanceof ShadowRoot) {\n if (this.getRootNode().host.getRootNode() instanceof ShadowRoot) {\n // layer- src\n // > sd\n // map-extent\n // map-link\n // > sd\n // map-feature (1)\n layerEl = this.getRootNode().host.getRootNode().host;\n } else if (this.getRootNode().host.nodeName === 'MAP-LINK') {\n // layer-\n // map-extent\n // map-link\n // > sd\n // map-feature (4)\n layerEl = this.getRootNode().host.closest('layer-');\n } else {\n // layer- src\n // > sd\n // map-feature (2)\n layerEl = this.getRootNode().host;\n }\n } else {\n // layer-\n // map-feature (3)\n layerEl = this.closest('layer-');\n }\n return layerEl;\n }\n getMapEl() {\n return this.getLayerEl().closest('mapml-viewer,map[is=web-map]');\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n if (this.#hasConnected /* jshint ignore:line */) {\n switch (name) {\n case 'min':\n case 'max':\n case 'zoom':\n if (oldValue !== newValue) {\n this.reRender(this._featureLayer);\n }\n break;\n }\n }\n }\n\n constructor() {\n // Always call super first in constructor\n super();\n }\n\n connectedCallback() {\n /* jshint ignore:start */\n this.#hasConnected = true;\n /* jshint ignore:end */\n // set the initial zoom of the map when features connected\n // used for fallback zoom getter for static features\n this._initialZoom = this.getMapEl().zoom;\n this._parentEl =\n this.parentNode.nodeName.toUpperCase() === 'LAYER-' ||\n this.parentNode.nodeName.toUpperCase() === 'MAP-LINK'\n ? this.parentNode\n : this.parentNode.host;\n if (\n this.getLayerEl().hasAttribute('data-moving') ||\n this._parentEl.parentElement?.hasAttribute('data-moving')\n )\n return;\n // use observer to monitor the changes in mapFeature's subtree\n // (i.e. map-properties, map-featurecaption, map-coordinates)\n this._observer = new MutationObserver((mutationList) => {\n for (let mutation of mutationList) {\n // the attributes changes of element should be handled by attributeChangedCallback()\n if (mutation.type === 'attributes' && mutation.target === this) {\n return;\n }\n // re-render feature if there is any observed change\n this.reRender(this._featureLayer);\n }\n });\n this._observer.observe(this, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeOldValue: true,\n characterData: true\n });\n }\n\n disconnectedCallback() {\n if (\n this.getLayerEl()?.hasAttribute('data-moving') ||\n this._parentEl.parentElement?.hasAttribute('data-moving')\n )\n return;\n this._observer.disconnect();\n if (this._featureLayer) {\n this.removeFeature(this._featureLayer);\n }\n }\n\n reRender(layerToRenderOn) {\n // this is for re-generating the rendering in case of changes\n // based on mutation observers. Kinda brute force.\n if (this._groupEl.isConnected) {\n let fallbackCS = this._getFallbackCS();\n let placeholder = document.createElement('span');\n this._groupEl.insertAdjacentElement('beforebegin', placeholder);\n if (layerToRenderOn._staticFeature) {\n layerToRenderOn._removeFromFeaturesList(this._geometry);\n }\n layerToRenderOn.removeLayer(this._geometry);\n // Garbage collection needed\n this._geometry = layerToRenderOn\n .createGeometry(this, fallbackCS) // side effect: this._groupEl set\n .addTo(layerToRenderOn);\n placeholder.replaceWith(this._geometry.options.group);\n layerToRenderOn._validateRendering();\n // TODO: getBounds() should dynamically update the layerBounds and zoomBounds\n delete this._getFeatureExtent;\n this._setUpEvents();\n }\n }\n\n removeFeature(layerToRemoveFrom) {\n // layerToRemoveFrom is the L.LayerGroup or L.FeatureGroup to remove this\n // feature from...\n layerToRemoveFrom.removeLayer(this._geometry);\n // TODO: MOVE THIS LOGIC TO layerToRemoveFrom.removeLayer(M.Geometry)\n // if (layerToRemoveFrom._staticFeature) {\n // if (layerToRemoveFrom._features[this.zoom]) {\n // this._removeInFeatureList(this.zoom);\n // }\n if (layerToRemoveFrom._staticFeature) {\n layerToRemoveFrom._removeFromFeaturesList(this._geometry);\n }\n layerToRemoveFrom.options.properties = null;\n delete this._geometry;\n // ensure that feature extent can be re-calculated everytime that map-feature element is updated / re-added\n if (this._getFeatureExtent) delete this._getFeatureExtent;\n }\n\n addFeature(layerToAddTo) {\n this._featureLayer = layerToAddTo;\n let parentLayer = this.getLayerEl();\n // \"synchronize\" the event handlers between map-feature and \n if (!this.querySelector('map-geometry')) return;\n let fallbackCS = this._getFallbackCS();\n let content = parentLayer.src ? parentLayer.shadowRoot : parentLayer;\n this._geometry = layerToAddTo.createGeometry(this, fallbackCS); // side effect: extends `this` with this._groupEl if successful, points to svg g element that renders to map SD\n if (!this._geometry) return;\n layerToAddTo.addLayer(this._geometry);\n this._setUpEvents();\n }\n\n _setUpEvents() {\n ['click', 'focus', 'blur', 'keyup', 'keydown'].forEach((name) => {\n // when is clicked / focused / blurred\n // should dispatch the click / focus / blur event listener on **linked HTMLFeatureElements**\n this._groupEl.addEventListener(name, (e) => {\n if (name === 'click') {\n // dispatch a cloned mouseevent to trigger the click event handlers set on HTMLFeatureElement\n let clickEv = new PointerEvent(name, { cancelable: true });\n clickEv.originalEvent = e;\n this.dispatchEvent(clickEv);\n } else if (name === 'keyup' || name === 'keydown') {\n let keyEv = new KeyboardEvent(name, { cancelable: true });\n keyEv.originalEvent = e;\n this.dispatchEvent(keyEv);\n } else {\n // dispatch a cloned focusevent to trigger the focus/blue event handlers set on HTMLFeatureElement\n let focusEv = new FocusEvent(name, { cancelable: true });\n focusEv.originalEvent = e;\n this.dispatchEvent(focusEv);\n }\n });\n });\n }\n\n // native cs: used by FeatureLayer._geometryToLayer(...),\n // the fallback cs for map-geometry if its cs attribute is not specified\n _getFallbackCS() {\n let csMeta;\n if (this._parentEl.nodeName === 'MAP-LINK') {\n // feature attaches to link's shadow\n csMeta =\n this._parentEl.shadowRoot.querySelector('map-meta[name=cs]') ||\n this._parentEl.parentElement.getMeta('cs');\n } else {\n let layerEl = this.getLayerEl();\n csMeta = layerEl.src\n ? layerEl.shadowRoot.querySelector('map-meta[name=cs]')\n : layerEl.querySelector('map-meta[name=cs]');\n }\n if (csMeta) {\n // M._metaContentObject(\"gcrs\") -> {content: \"gcrs\"}\n return (\n M._metaContentToObject(csMeta.getAttribute('content')).content || 'gcrs'\n );\n } else {\n return 'gcrs';\n }\n }\n\n // Util functions:\n // internal method to calculate the extent of the feature and store it in cache for the first time\n // and return cache when feature's extent is repeatedly requested\n // for .extent\n _memoizeExtent() {\n // memoize calculated extent\n let extentCache;\n return function () {\n if (extentCache && this._getFeatureExtent) {\n // if the extent has already been calculated and is not updated, return stored extent\n return extentCache;\n } else {\n // calculate feature extent\n let map = this.getMapEl()._map,\n geometry = this.querySelector('map-geometry'),\n cs = geometry.getAttribute('cs') || this._getFallbackCS(),\n // zoom level that the feature rendered at\n zoom = this.zoom,\n shapes = geometry.querySelectorAll(\n 'map-point, map-linestring, map-polygon, map-multipoint, map-multilinestring'\n ),\n bboxExtent = [\n Infinity,\n Infinity,\n Number.NEGATIVE_INFINITY,\n Number.NEGATIVE_INFINITY\n ];\n for (let shape of shapes) {\n let coord = shape.querySelectorAll('map-coordinates');\n for (let i = 0; i < coord.length; ++i) {\n bboxExtent = _updateExtent(shape, coord[i], bboxExtent);\n }\n }\n let topLeft = L.point(bboxExtent[0], bboxExtent[1]);\n let bottomRight = L.point(bboxExtent[2], bboxExtent[3]);\n let pcrsBound = M.boundsToPCRSBounds(\n L.bounds(topLeft, bottomRight),\n zoom,\n map.options.projection,\n cs\n );\n if (\n shapes.length === 1 &&\n shapes[0].tagName.toUpperCase() === 'MAP-POINT'\n ) {\n let projection = map.options.projection,\n maxZoom = this.hasAttribute('max')\n ? +this.getAttribute('max')\n : M[projection].options.resolutions.length - 1,\n tileCenter = M[projection].options.crs.tile.bounds.getCenter(),\n pixel = M[projection].transformation.transform(\n pcrsBound.min,\n M[projection].scale(+this.zoom || maxZoom)\n );\n pcrsBound = M.pixelToPCRSBounds(\n L.bounds(pixel.subtract(tileCenter), pixel.add(tileCenter)),\n this.zoom || maxZoom,\n projection\n );\n }\n let result = Object.assign(\n M._convertAndFormatPCRS(\n pcrsBound,\n map.options.crs,\n map.options.projection\n ),\n { zoom: this._getZoomBounds() }\n );\n // memoize calculated result\n extentCache = result;\n return result;\n }\n };\n\n // update the bboxExtent\n function _updateExtent(shape, coord, bboxExtent) {\n let data = coord.innerHTML\n .trim()\n .replace(/<[^>]+>/g, '')\n .replace(/\\s+/g, ' ')\n .split(/[<>\\ ]/g);\n switch (shape.tagName.toUpperCase()) {\n case 'MAP-POINT':\n bboxExtent = M._updateExtent(bboxExtent, +data[0], +data[1]);\n break;\n case 'MAP-LINESTRING':\n case 'MAP-POLYGON':\n case 'MAP-MULTIPOINT':\n case 'MAP-MULTILINESTRING':\n for (let i = 0; i < data.length; i += 2) {\n bboxExtent = M._updateExtent(bboxExtent, +data[i], +data[i + 1]);\n }\n break;\n default:\n break;\n }\n return bboxExtent;\n }\n }\n _getZoomBounds() {\n // ** native zoom is only used for zoomTo() **\n return {\n minZoom: this.min,\n maxZoom: this.max,\n minNativeZoom: this.zoom,\n maxNativeZoom: this.zoom\n };\n }\n getZoomToZoom() {\n let tL = this.extent.topLeft.pcrs,\n bR = this.extent.bottomRight.pcrs,\n bound = L.bounds(\n L.point(tL.horizontal, tL.vertical),\n L.point(bR.horizontal, bR.vertical)\n );\n let projection = this.getMapEl()._map.options.projection,\n layerZoomBounds = this.getLayerEl().extent.zoom,\n minZoom = layerZoomBounds.minZoom ? layerZoomBounds.minZoom : 0,\n maxZoom = layerZoomBounds.maxZoom\n ? layerZoomBounds.maxZoom\n : M[projection].options.resolutions.length - 1;\n let newZoom;\n if (this.hasAttribute('zoom')) {\n // if there is a zoom attribute set to the map-feature, zoom to the zoom attribute value\n newZoom = this.zoom;\n } else {\n // if not, calculate the maximum zoom level that can show the feature completely\n newZoom = M.getMaxZoom(bound, this.getMapEl()._map, minZoom, maxZoom);\n if (this.max < newZoom) {\n // if the calculated zoom is greater than the value of max zoom attribute, go with max zoom attribute\n newZoom = this.max;\n } else if (this.min > newZoom) {\n // if the calculated zoom is less than the value of min zoom attribute, go with min zoom attribute\n newZoom = this.min;\n }\n }\n // prevent overzooming / underzooming\n if (newZoom < minZoom) {\n newZoom = minZoom;\n } else if (newZoom > maxZoom) {\n newZoom = maxZoom;\n }\n\n // should check whether the extent after zooming falls into the templated extent bound\n return newZoom;\n }\n getMeta(metaName) {\n let name = metaName.toLowerCase();\n if (name !== 'cs' && name !== 'zoom' && name !== 'projection') return;\n let sdMeta = this._parentEl.shadowRoot.querySelector(\n `map-meta[name=${name}][content]`\n );\n if (this._parentEl.nodeName === 'MAP-LINK') {\n // sd.map-meta || map-extent meta || layer meta\n return sdMeta || this._parentEl.parentElement.getMeta(metaName);\n } else {\n return this._parentEl.src\n ? this._parentEl.shadowRoot.querySelector(\n `map-meta[name=${name}][content]`\n )\n : this._parentEl.querySelector(`map-meta[name=${name}][content]`);\n }\n }\n // internal support for returning a GeoJSON representation of geometry\n // The options object can contain the following:\n // propertyFunction - function(), A function that maps the features' element to a GeoJSON \"properties\" member.\n // transform - Bool, Transform coordinates to gcrs values, defaults to True\n // mapml2geojson: Object -> GeoJSON\n mapml2geojson(options) {\n let defaults = {\n propertyFunction: null,\n transform: true\n };\n // assign default values for undefined options\n options = Object.assign({}, defaults, options);\n\n let json = {\n type: 'Feature',\n properties: {},\n geometry: {}\n };\n let el = this.querySelector('map-properties');\n if (!el) {\n json.properties = null;\n } else if (typeof options.propertyFunction === 'function') {\n json.properties = options.propertyFunction(el);\n } else if (el.querySelector('table')) {\n // setting properties when table presented\n let table = el.querySelector('table').cloneNode(true);\n json.properties = M._table2properties(table);\n } else {\n // when no table present, strip any possible html tags to only get text\n json.properties = {\n prop0: el.innerHTML.replace(/(<([^>]+)>)/gi, '').replace(/\\s/g, '')\n };\n }\n\n // transform to gcrs if options.transform = true (default)\n let source = null,\n dest = null,\n map = this.getMapEl()._map;\n if (options.transform) {\n source = new proj4.Proj(map.options.crs.code);\n dest = new proj4.Proj('EPSG:4326');\n if (\n map.options.crs.code === 'EPSG:3857' ||\n map.options.crs.code === 'EPSG:4326'\n ) {\n options.transform = false;\n }\n }\n\n let collection = this.querySelector('map-geometry').querySelector(\n 'map-geometrycollection'\n ),\n shapes = this.querySelector('map-geometry').querySelectorAll(\n 'map-point, map-polygon, map-linestring, map-multipoint, map-multipolygon, map-multilinestring'\n );\n\n if (collection) {\n json.geometry.type = 'GeometryCollection';\n json.geometry.geometries = [];\n for (let shape of shapes) {\n json.geometry.geometries.push(\n M._geometry2geojson(shape, source, dest, options.transform)\n );\n }\n } else {\n json.geometry = M._geometry2geojson(\n shapes[0],\n source,\n dest,\n options.transform\n );\n }\n return json;\n }\n\n // a method that simulates a click, or invoking the user-defined click event\n click() {\n let g = this._groupEl,\n rect = g.getBoundingClientRect();\n let event = new MouseEvent('click', {\n clientX: rect.x + rect.width / 2,\n clientY: rect.y + rect.height / 2,\n button: 0\n });\n let properties = this.querySelector('map-properties');\n if (g.getAttribute('role') === 'link') {\n for (let path of g.children) {\n path.mousedown.call(this._geometry, event);\n path.mouseup.call(this._geometry, event);\n }\n }\n // dispatch click event for map-feature to allow events entered by 'addEventListener'\n let clickEv = new PointerEvent('click', { cancelable: true });\n clickEv.originalEvent = event;\n this.dispatchEvent(clickEv);\n // for custom projection, layer- element may disconnect and re-attach to the map after the click\n // so check whether map-feature element is still connected before any further operations\n if (properties && this.isConnected) {\n let geometry = this._geometry,\n shapes = geometry._layers;\n // close popup if the popup is currently open\n for (let id in shapes) {\n if (shapes[id].isPopupOpen()) {\n shapes[id].closePopup();\n }\n }\n if (geometry.isPopupOpen()) {\n geometry.closePopup();\n } else if (!clickEv.originalEvent.cancelBubble) {\n // If stopPropagation is not set on originalEvent by user\n geometry.openPopup();\n }\n }\n }\n\n // a method that sets the current focus to the element, or invoking the user-defined focus event\n // options (optional): as options parameter for native HTMLElement\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus\n focus(options) {\n this._groupEl.focus(options);\n }\n\n // a method that makes the element lose focus, or invoking the user-defined blur event\n blur() {\n if (\n document.activeElement.shadowRoot?.activeElement === this._groupEl ||\n document.activeElement.shadowRoot?.activeElement.parentNode ===\n this._groupEl\n ) {\n this._groupEl.blur();\n // set focus to the map container\n this.getMapEl()._map.getContainer().focus();\n }\n }\n\n // a method that can the viewport to be centred on the feature's extent\n zoomTo() {\n let extent = this.extent,\n map = this.getMapEl()._map;\n let tL = extent.topLeft.pcrs,\n bR = extent.bottomRight.pcrs,\n bound = L.bounds(\n L.point(tL.horizontal, tL.vertical),\n L.point(bR.horizontal, bR.vertical)\n ),\n center = map.options.crs.unproject(bound.getCenter(true));\n map.setView(center, this.getZoomToZoom(), { animate: false });\n }\n whenReady() {\n return new Promise((resolve, reject) => {\n let interval, failureTimer;\n if (this.isConnected /* jshint ignore:line */) {\n resolve();\n } else {\n let featureElement = this;\n interval = setInterval(testForFeature, 200, featureElement);\n failureTimer = setTimeout(featureNotDefined, 5000);\n }\n function testForFeature(featureElement) {\n if (featureElement.isConnected /* jshint ignore:line */) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n resolve();\n }\n }\n function featureNotDefined() {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('Timeout reached waiting for feature to be ready');\n }\n });\n }\n}\n"],"names":["MapFeature","HTMLElement","observedAttributes","#hasConnected","zoom","let","meta","metaEl","this","getMeta","M","_metaContentToObject","getAttribute","_parentEl","nodeName","hasAttribute","value","max","_initialZoom","val","parsedVal","parseInt","isNaN","min","setAttribute","getZoomBounds","minZoom","layerZoomBounds","getLayerEl","extent","maxZoom","projectionMaxZoom","getMapEl","_map","options","crs","resolutions","length","isConnected","_getFeatureExtent","_memoizeExtent","layerEl","getRootNode","ShadowRoot","host","closest","attributeChangedCallback","name","oldValue","newValue","reRender","_featureLayer","constructor","super","connectedCallback","parentNode","toUpperCase","parentElement","_observer","MutationObserver","mutation","mutationList","type","target","observe","childList","subtree","attributes","attributeOldValue","characterData","disconnectedCallback","disconnect","removeFeature","layerToRenderOn","_groupEl","fallbackCS","_getFallbackCS","placeholder","document","createElement","insertAdjacentElement","_staticFeature","_removeFromFeaturesList","_geometry","removeLayer","createGeometry","addTo","replaceWith","group","_validateRendering","_setUpEvents","layerToRemoveFrom","properties","addFeature","layerToAddTo","parentLayer","querySelector","src","shadowRoot","addLayer","forEach","addEventListener","clickEv","PointerEvent","cancelable","originalEvent","e","dispatchEvent","keyEv","KeyboardEvent","focusEv","FocusEvent","csMeta","content","extentCache","map","geometry","cs","shapes","querySelectorAll","bboxExtent","Infinity","Number","NEGATIVE_INFINITY","shape","coord","i","data","innerHTML","trim","replace","split","tagName","_updateExtent","topLeft","L","point","bottomRight","pcrsBound","boundsToPCRSBounds","bounds","projection","tileCenter","tile","getCenter","pixel","transformation","transform","scale","pixelToPCRSBounds","subtract","add","result","Object","assign","_convertAndFormatPCRS","_getZoomBounds","minNativeZoom","maxNativeZoom","getZoomToZoom","tL","pcrs","bR","bound","horizontal","vertical","newZoom","getMaxZoom","metaName","toLowerCase","sdMeta","mapml2geojson","propertyFunction","json","el","table","cloneNode","_table2properties","prop0","source","dest","proj4","Proj","code","collection","geometries","push","_geometry2geojson","click","g","rect","getBoundingClientRect","event","MouseEvent","clientX","x","width","clientY","y","height","button","path","children","mousedown","call","mouseup","_layers","id","isPopupOpen","closePopup","cancelBubble","openPopup","focus","blur","activeElement","getContainer","zoomTo","center","unproject","setView","animate","whenReady","Promise","resolve","reject","interval","failureTimer","setInterval","featureElement","clearInterval","clearTimeout","setTimeout"],"mappings":";;MAAaA,mBAAmBC,YAC9BC,gCACE,MAAO,CAAC,OAAQ,MAAO,OAIzBC,cAEAC,WAEEC,IAAIC,EAAO,GACTC,EAASC,KAAKC,QAAQ,QAExB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AE5BoD,EAAStG,EAAIjF,QAAQC,IAAIuL,UAAUvD,EAAMnB,WAAU,IACrD7B,EAAIwG,QAAQF,EAAQjN,KAAKuJ,gBAAiB,CAAE6D,SAAS,IAEvDC,YACE,OAAO,IAAIC,QAAQ,CAACC,EAASC,KAC3B3N,IAAI4N,EAAUC,EACV1N,KAAK8B,YACPyL,KAGAE,EAAWE,YAGb,SAAwBC,GAClBA,EAAe9L,cACjB+L,cAAcJ,GACdK,aAAaJ,GACbH,MAPqC,IADlBvN,MAErB0N,EAAeK,WASjB,WACEF,cAAcJ,GACdK,aAAaJ,GACbF,EAAO,oDAZsC,gBAhpBxChO"} \ No newline at end of file +{"version":3,"file":"map-feature.js","sources":["../src/map-feature.js"],"sourcesContent":["export class MapFeature extends HTMLElement {\n static get observedAttributes() {\n return ['zoom', 'min', 'max'];\n }\n\n /* jshint ignore:start */\n #hasConnected;\n /* jshint ignore:end */\n get zoom() {\n // for templated or queried features ** native zoom is only used for zoomTo() **\n let meta = {},\n metaEl = this.getMeta('zoom');\n if (metaEl) meta = M._metaContentToObject(metaEl.getAttribute('content'));\n if (this._parentEl.nodeName === 'MAP-LINK') {\n // nativeZoom = zoom attribute || (sd.map-meta zoom 'value' || 'max') || this._initialZoom\n return +(this.hasAttribute('zoom')\n ? this.getAttribute('zoom')\n : meta.value\n ? meta.value\n : meta.max\n ? meta.max\n : this._initialZoom);\n } else {\n // for \"static\" features\n // nativeZoom zoom attribute || this._initialZoom\n // NOTE we don't use map-meta here, because the map-meta is the minimum\n // zoom bounds for the layer, and is extended by additional features\n // if added / removed during layer lifetime\n return +(this.hasAttribute('zoom')\n ? this.getAttribute('zoom')\n : this._initialZoom);\n }\n }\n\n set zoom(val) {\n var parsedVal = parseInt(val, 10);\n if (!isNaN(parsedVal) && parsedVal >= this.min && parsedVal <= this.max) {\n this.setAttribute('zoom', parsedVal);\n }\n }\n\n get min() {\n // for templated or queried features ** native zoom is only used for zoomTo() **\n let meta = {},\n metaEl = this.getMeta('zoom');\n if (metaEl) meta = M._metaContentToObject(metaEl.getAttribute('content'));\n let projectionMinZoom = 0;\n if (this._parentEl.nodeName === 'MAP-LINK') {\n // minZoom = min attribute || sd.map-meta min zoom || map-link minZoom\n return +(this.hasAttribute('min')\n ? this.getAttribute('min')\n : meta.min\n ? meta.min\n : this._parentEl.getZoomBounds().minZoom);\n } else {\n // for \"static\" features\n // minZoom = min attribute || map-meta zoom || projection minZoom\n return +(this.hasAttribute('min')\n ? this.getAttribute('min')\n : meta.min\n ? meta.min\n : projectionMinZoom);\n }\n }\n\n set min(val) {\n var parsedVal = parseInt(val, 10);\n var layerZoomBounds = this.getLayerEl().extent.zoom;\n if (!isNaN(parsedVal)) {\n if (\n parsedVal >= layerZoomBounds.minZoom &&\n parsedVal <= layerZoomBounds.maxZoom\n ) {\n this.setAttribute('min', parsedVal);\n } else {\n this.setAttribute('min', layerZoomBounds.minZoom);\n }\n }\n }\n\n get max() {\n // for templated or queried features ** native zoom is only used for zoomTo() **\n let meta = {},\n metaEl = this.getMeta('zoom');\n if (metaEl) meta = M._metaContentToObject(metaEl.getAttribute('content'));\n let projectionMaxZoom =\n this.getMapEl()._map.options.crs.options.resolutions.length - 1;\n if (this._parentEl.nodeName === 'MAP-LINK') {\n // maxZoom = max attribute || sd.map-meta max zoom || map-link maxZoom\n return +(this.hasAttribute('max')\n ? this.getAttribute('max')\n : meta.max\n ? meta.max\n : this._parentEl.getZoomBounds().maxZoom);\n } else {\n // for \"static\" features\n // maxZoom = max attribute || map-meta zoom max || projection maxZoom\n return +(this.hasAttribute('max')\n ? this.getAttribute('max')\n : meta.max\n ? meta.max\n : projectionMaxZoom);\n }\n }\n\n set max(val) {\n var parsedVal = parseInt(val, 10);\n var layerZoomBounds = this.getLayerEl().extent.zoom;\n if (!isNaN(parsedVal)) {\n if (\n parsedVal >= layerZoomBounds.minZoom &&\n parsedVal <= layerZoomBounds.maxZoom\n ) {\n this.setAttribute('max', parsedVal);\n } else {\n this.setAttribute('max', layerZoomBounds.maxZoom);\n }\n }\n }\n\n get extent() {\n if (this.isConnected) {\n // if the feature extent is the first time to be calculated or the feature extent is changed (by changing\n // the innertext of map-coordinates), then calculate feature extent by invoking the getFeatureExtent function\n if (!this._getFeatureExtent) {\n this._getFeatureExtent = this._memoizeExtent();\n }\n return this._getFeatureExtent();\n }\n }\n getMapEl() {\n return M.getClosest(this, 'mapml-viewer,map[is=web-map]');\n }\n getLayerEl() {\n return M.getClosest(this, 'layer-');\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n if (this.#hasConnected /* jshint ignore:line */) {\n switch (name) {\n case 'min':\n case 'max':\n case 'zoom':\n if (oldValue !== newValue) {\n this.reRender(this._featureLayer);\n }\n break;\n }\n }\n }\n\n constructor() {\n // Always call super first in constructor\n super();\n }\n\n connectedCallback() {\n /* jshint ignore:start */\n this.#hasConnected = true;\n /* jshint ignore:end */\n // set the initial zoom of the map when features connected\n // used for fallback zoom getter for static features\n this._initialZoom = this.getMapEl().zoom;\n this._parentEl =\n this.parentNode.nodeName.toUpperCase() === 'LAYER-' ||\n this.parentNode.nodeName.toUpperCase() === 'MAP-LINK'\n ? this.parentNode\n : this.parentNode.host;\n if (\n this.getLayerEl().hasAttribute('data-moving') ||\n this._parentEl.parentElement?.hasAttribute('data-moving')\n )\n return;\n // use observer to monitor the changes in mapFeature's subtree\n // (i.e. map-properties, map-featurecaption, map-coordinates)\n this._observer = new MutationObserver((mutationList) => {\n for (let mutation of mutationList) {\n // the attributes changes of element should be handled by attributeChangedCallback()\n if (mutation.type === 'attributes' && mutation.target === this) {\n return;\n }\n // re-render feature if there is any observed change\n this.reRender(this._featureLayer);\n }\n });\n this._observer.observe(this, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeOldValue: true,\n characterData: true\n });\n }\n\n disconnectedCallback() {\n if (\n this.getLayerEl()?.hasAttribute('data-moving') ||\n this._parentEl.parentElement?.hasAttribute('data-moving')\n )\n return;\n this._observer.disconnect();\n if (this._featureLayer) {\n this.removeFeature(this._featureLayer);\n }\n }\n\n reRender(layerToRenderOn) {\n // this is for re-generating the rendering in case of changes\n // based on mutation observers. Kinda brute force.\n if (this._groupEl.isConnected) {\n let fallbackCS = this._getFallbackCS();\n let placeholder = document.createElement('span');\n this._groupEl.insertAdjacentElement('beforebegin', placeholder);\n if (layerToRenderOn._staticFeature) {\n layerToRenderOn._removeFromFeaturesList(this._geometry);\n }\n layerToRenderOn.removeLayer(this._geometry);\n // Garbage collection needed\n this._geometry = layerToRenderOn\n .createGeometry(this, fallbackCS) // side effect: this._groupEl set\n .addTo(layerToRenderOn);\n placeholder.replaceWith(this._geometry.options.group);\n layerToRenderOn._validateRendering();\n // TODO: getBounds() should dynamically update the layerBounds and zoomBounds\n delete this._getFeatureExtent;\n this._setUpEvents();\n }\n }\n\n removeFeature(layerToRemoveFrom) {\n // layerToRemoveFrom is the L.LayerGroup or L.FeatureGroup to remove this\n // feature from...\n layerToRemoveFrom.removeLayer(this._geometry);\n // TODO: MOVE THIS LOGIC TO layerToRemoveFrom.removeLayer(M.Geometry)\n // if (layerToRemoveFrom._staticFeature) {\n // if (layerToRemoveFrom._features[this.zoom]) {\n // this._removeInFeatureList(this.zoom);\n // }\n if (layerToRemoveFrom._staticFeature) {\n layerToRemoveFrom._removeFromFeaturesList(this._geometry);\n }\n layerToRemoveFrom.options.properties = null;\n delete this._geometry;\n // ensure that feature extent can be re-calculated everytime that map-feature element is updated / re-added\n if (this._getFeatureExtent) delete this._getFeatureExtent;\n }\n\n addFeature(layerToAddTo) {\n this._featureLayer = layerToAddTo;\n let parentLayer = this.getLayerEl();\n // \"synchronize\" the event handlers between map-feature and \n if (!this.querySelector('map-geometry')) return;\n let fallbackCS = this._getFallbackCS();\n let content = parentLayer.src ? parentLayer.shadowRoot : parentLayer;\n this._geometry = layerToAddTo.createGeometry(this, fallbackCS); // side effect: extends `this` with this._groupEl if successful, points to svg g element that renders to map SD\n if (!this._geometry) return;\n layerToAddTo.addLayer(this._geometry);\n this._setUpEvents();\n }\n\n _setUpEvents() {\n ['click', 'focus', 'blur', 'keyup', 'keydown'].forEach((name) => {\n // when is clicked / focused / blurred\n // should dispatch the click / focus / blur event listener on **linked HTMLFeatureElements**\n this._groupEl.addEventListener(name, (e) => {\n if (name === 'click') {\n // dispatch a cloned mouseevent to trigger the click event handlers set on HTMLFeatureElement\n let clickEv = new PointerEvent(name, { cancelable: true });\n clickEv.originalEvent = e;\n this.dispatchEvent(clickEv);\n } else if (name === 'keyup' || name === 'keydown') {\n let keyEv = new KeyboardEvent(name, { cancelable: true });\n keyEv.originalEvent = e;\n this.dispatchEvent(keyEv);\n } else {\n // dispatch a cloned focusevent to trigger the focus/blue event handlers set on HTMLFeatureElement\n let focusEv = new FocusEvent(name, { cancelable: true });\n focusEv.originalEvent = e;\n this.dispatchEvent(focusEv);\n }\n });\n });\n }\n\n // native cs: used by FeatureLayer._geometryToLayer(...),\n // the fallback cs for map-geometry if its cs attribute is not specified\n _getFallbackCS() {\n let csMeta;\n if (this._parentEl.nodeName === 'MAP-LINK') {\n // feature attaches to link's shadow\n csMeta =\n this._parentEl.shadowRoot.querySelector('map-meta[name=cs]') ||\n this._parentEl.parentElement.getMeta('cs');\n } else {\n let layerEl = this.getLayerEl();\n csMeta = layerEl.src\n ? layerEl.shadowRoot.querySelector('map-meta[name=cs]')\n : layerEl.querySelector('map-meta[name=cs]');\n }\n if (csMeta) {\n // M._metaContentObject(\"gcrs\") -> {content: \"gcrs\"}\n return (\n M._metaContentToObject(csMeta.getAttribute('content')).content || 'gcrs'\n );\n } else {\n return 'gcrs';\n }\n }\n\n // Util functions:\n // internal method to calculate the extent of the feature and store it in cache for the first time\n // and return cache when feature's extent is repeatedly requested\n // for .extent\n _memoizeExtent() {\n // memoize calculated extent\n let extentCache;\n return function () {\n if (extentCache && this._getFeatureExtent) {\n // if the extent has already been calculated and is not updated, return stored extent\n return extentCache;\n } else {\n // calculate feature extent\n let map = this.getMapEl()._map,\n geometry = this.querySelector('map-geometry'),\n cs = geometry.getAttribute('cs') || this._getFallbackCS(),\n // zoom level that the feature rendered at\n zoom = this.zoom,\n shapes = geometry.querySelectorAll(\n 'map-point, map-linestring, map-polygon, map-multipoint, map-multilinestring'\n ),\n bboxExtent = [\n Infinity,\n Infinity,\n Number.NEGATIVE_INFINITY,\n Number.NEGATIVE_INFINITY\n ];\n for (let shape of shapes) {\n let coord = shape.querySelectorAll('map-coordinates');\n for (let i = 0; i < coord.length; ++i) {\n bboxExtent = _updateExtent(shape, coord[i], bboxExtent);\n }\n }\n let topLeft = L.point(bboxExtent[0], bboxExtent[1]);\n let bottomRight = L.point(bboxExtent[2], bboxExtent[3]);\n let pcrsBound = M.boundsToPCRSBounds(\n L.bounds(topLeft, bottomRight),\n zoom,\n map.options.projection,\n cs\n );\n if (\n shapes.length === 1 &&\n shapes[0].tagName.toUpperCase() === 'MAP-POINT'\n ) {\n let projection = map.options.projection,\n maxZoom = this.hasAttribute('max')\n ? +this.getAttribute('max')\n : M[projection].options.resolutions.length - 1,\n tileCenter = M[projection].options.crs.tile.bounds.getCenter(),\n pixel = M[projection].transformation.transform(\n pcrsBound.min,\n M[projection].scale(+this.zoom || maxZoom)\n );\n pcrsBound = M.pixelToPCRSBounds(\n L.bounds(pixel.subtract(tileCenter), pixel.add(tileCenter)),\n this.zoom || maxZoom,\n projection\n );\n }\n let result = Object.assign(\n M._convertAndFormatPCRS(\n pcrsBound,\n map.options.crs,\n map.options.projection\n ),\n { zoom: this._getZoomBounds() }\n );\n // memoize calculated result\n extentCache = result;\n return result;\n }\n };\n\n // update the bboxExtent\n function _updateExtent(shape, coord, bboxExtent) {\n let data = coord.innerHTML\n .trim()\n .replace(/<[^>]+>/g, '')\n .replace(/\\s+/g, ' ')\n .split(/[<>\\ ]/g);\n switch (shape.tagName.toUpperCase()) {\n case 'MAP-POINT':\n bboxExtent = M._updateExtent(bboxExtent, +data[0], +data[1]);\n break;\n case 'MAP-LINESTRING':\n case 'MAP-POLYGON':\n case 'MAP-MULTIPOINT':\n case 'MAP-MULTILINESTRING':\n for (let i = 0; i < data.length; i += 2) {\n bboxExtent = M._updateExtent(bboxExtent, +data[i], +data[i + 1]);\n }\n break;\n default:\n break;\n }\n return bboxExtent;\n }\n }\n _getZoomBounds() {\n // ** native zoom is only used for zoomTo() **\n return {\n minZoom: this.min,\n maxZoom: this.max,\n minNativeZoom: this.zoom,\n maxNativeZoom: this.zoom\n };\n }\n getZoomToZoom() {\n let tL = this.extent.topLeft.pcrs,\n bR = this.extent.bottomRight.pcrs,\n bound = L.bounds(\n L.point(tL.horizontal, tL.vertical),\n L.point(bR.horizontal, bR.vertical)\n );\n let projection = this.getMapEl()._map.options.projection,\n layerZoomBounds = this.getLayerEl().extent.zoom,\n minZoom = layerZoomBounds.minZoom ? layerZoomBounds.minZoom : 0,\n maxZoom = layerZoomBounds.maxZoom\n ? layerZoomBounds.maxZoom\n : M[projection].options.resolutions.length - 1;\n let newZoom;\n if (this.hasAttribute('zoom')) {\n // if there is a zoom attribute set to the map-feature, zoom to the zoom attribute value\n newZoom = this.zoom;\n } else {\n // if not, calculate the maximum zoom level that can show the feature completely\n newZoom = M.getMaxZoom(bound, this.getMapEl()._map, minZoom, maxZoom);\n if (this.max < newZoom) {\n // if the calculated zoom is greater than the value of max zoom attribute, go with max zoom attribute\n newZoom = this.max;\n } else if (this.min > newZoom) {\n // if the calculated zoom is less than the value of min zoom attribute, go with min zoom attribute\n newZoom = this.min;\n }\n }\n // prevent overzooming / underzooming\n if (newZoom < minZoom) {\n newZoom = minZoom;\n } else if (newZoom > maxZoom) {\n newZoom = maxZoom;\n }\n\n // should check whether the extent after zooming falls into the templated extent bound\n return newZoom;\n }\n getMeta(metaName) {\n let name = metaName.toLowerCase();\n if (name !== 'cs' && name !== 'zoom' && name !== 'projection') return;\n let sdMeta = this._parentEl.shadowRoot.querySelector(\n `map-meta[name=${name}][content]`\n );\n if (this._parentEl.nodeName === 'MAP-LINK') {\n // sd.map-meta || map-extent meta || layer meta\n return sdMeta || this._parentEl.parentElement.getMeta(metaName);\n } else {\n return this._parentEl.src\n ? this._parentEl.shadowRoot.querySelector(\n `map-meta[name=${name}][content]`\n )\n : this._parentEl.querySelector(`map-meta[name=${name}][content]`);\n }\n }\n // internal support for returning a GeoJSON representation of geometry\n // The options object can contain the following:\n // propertyFunction - function(), A function that maps the features' element to a GeoJSON \"properties\" member.\n // transform - Bool, Transform coordinates to gcrs values, defaults to True\n // mapml2geojson: Object -> GeoJSON\n mapml2geojson(options) {\n let defaults = {\n propertyFunction: null,\n transform: true\n };\n // assign default values for undefined options\n options = Object.assign({}, defaults, options);\n\n let json = {\n type: 'Feature',\n properties: {},\n geometry: {}\n };\n let el = this.querySelector('map-properties');\n if (!el) {\n json.properties = null;\n } else if (typeof options.propertyFunction === 'function') {\n json.properties = options.propertyFunction(el);\n } else if (el.querySelector('table')) {\n // setting properties when table presented\n let table = el.querySelector('table').cloneNode(true);\n json.properties = M._table2properties(table);\n } else {\n // when no table present, strip any possible html tags to only get text\n json.properties = {\n prop0: el.innerHTML.replace(/(<([^>]+)>)/gi, '').replace(/\\s/g, '')\n };\n }\n\n // transform to gcrs if options.transform = true (default)\n let source = null,\n dest = null,\n map = this.getMapEl()._map;\n if (options.transform) {\n source = new proj4.Proj(map.options.crs.code);\n dest = new proj4.Proj('EPSG:4326');\n if (\n map.options.crs.code === 'EPSG:3857' ||\n map.options.crs.code === 'EPSG:4326'\n ) {\n options.transform = false;\n }\n }\n\n let collection = this.querySelector('map-geometry').querySelector(\n 'map-geometrycollection'\n ),\n shapes = this.querySelector('map-geometry').querySelectorAll(\n 'map-point, map-polygon, map-linestring, map-multipoint, map-multipolygon, map-multilinestring'\n );\n\n if (collection) {\n json.geometry.type = 'GeometryCollection';\n json.geometry.geometries = [];\n for (let shape of shapes) {\n json.geometry.geometries.push(\n M._geometry2geojson(shape, source, dest, options.transform)\n );\n }\n } else {\n json.geometry = M._geometry2geojson(\n shapes[0],\n source,\n dest,\n options.transform\n );\n }\n return json;\n }\n\n // a method that simulates a click, or invoking the user-defined click event\n click() {\n let g = this._groupEl,\n rect = g.getBoundingClientRect();\n let event = new MouseEvent('click', {\n clientX: rect.x + rect.width / 2,\n clientY: rect.y + rect.height / 2,\n button: 0\n });\n let properties = this.querySelector('map-properties');\n if (g.getAttribute('role') === 'link') {\n for (let path of g.children) {\n path.mousedown.call(this._geometry, event);\n path.mouseup.call(this._geometry, event);\n }\n }\n // dispatch click event for map-feature to allow events entered by 'addEventListener'\n let clickEv = new PointerEvent('click', { cancelable: true });\n clickEv.originalEvent = event;\n this.dispatchEvent(clickEv);\n // for custom projection, layer- element may disconnect and re-attach to the map after the click\n // so check whether map-feature element is still connected before any further operations\n if (properties && this.isConnected) {\n let geometry = this._geometry,\n shapes = geometry._layers;\n // close popup if the popup is currently open\n for (let id in shapes) {\n if (shapes[id].isPopupOpen()) {\n shapes[id].closePopup();\n }\n }\n if (geometry.isPopupOpen()) {\n geometry.closePopup();\n } else if (!clickEv.originalEvent.cancelBubble) {\n // If stopPropagation is not set on originalEvent by user\n geometry.openPopup();\n }\n }\n }\n\n // a method that sets the current focus to the element, or invoking the user-defined focus event\n // options (optional): as options parameter for native HTMLElement\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus\n focus(options) {\n this._groupEl.focus(options);\n }\n\n // a method that makes the element lose focus, or invoking the user-defined blur event\n blur() {\n if (\n document.activeElement.shadowRoot?.activeElement === this._groupEl ||\n document.activeElement.shadowRoot?.activeElement.parentNode ===\n this._groupEl\n ) {\n this._groupEl.blur();\n // set focus to the map container\n this.getMapEl()._map.getContainer().focus();\n }\n }\n\n // a method that can the viewport to be centred on the feature's extent\n zoomTo() {\n let extent = this.extent,\n map = this.getMapEl()._map;\n let tL = extent.topLeft.pcrs,\n bR = extent.bottomRight.pcrs,\n bound = L.bounds(\n L.point(tL.horizontal, tL.vertical),\n L.point(bR.horizontal, bR.vertical)\n ),\n center = map.options.crs.unproject(bound.getCenter(true));\n map.setView(center, this.getZoomToZoom(), { animate: false });\n }\n whenReady() {\n return new Promise((resolve, reject) => {\n let interval, failureTimer;\n if (this.isConnected /* jshint ignore:line */) {\n resolve();\n } else {\n let featureElement = this;\n interval = setInterval(testForFeature, 200, featureElement);\n failureTimer = setTimeout(featureNotDefined, 5000);\n }\n function testForFeature(featureElement) {\n if (featureElement.isConnected /* jshint ignore:line */) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n resolve();\n }\n }\n function featureNotDefined() {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('Timeout reached waiting for feature to be ready');\n }\n });\n }\n}\n"],"names":["MapFeature","HTMLElement","observedAttributes","#hasConnected","zoom","let","meta","metaEl","this","getMeta","M","_metaContentToObject","getAttribute","_parentEl","nodeName","hasAttribute","value","max","_initialZoom","val","parsedVal","parseInt","isNaN","min","setAttribute","getZoomBounds","minZoom","layerZoomBounds","getLayerEl","extent","maxZoom","projectionMaxZoom","getMapEl","_map","options","crs","resolutions","length","isConnected","_getFeatureExtent","_memoizeExtent","getClosest","attributeChangedCallback","name","oldValue","newValue","reRender","_featureLayer","constructor","super","connectedCallback","parentNode","toUpperCase","host","parentElement","_observer","MutationObserver","mutation","mutationList","type","target","observe","childList","subtree","attributes","attributeOldValue","characterData","disconnectedCallback","disconnect","removeFeature","layerToRenderOn","_groupEl","fallbackCS","_getFallbackCS","placeholder","document","createElement","insertAdjacentElement","_staticFeature","_removeFromFeaturesList","_geometry","removeLayer","createGeometry","addTo","replaceWith","group","_validateRendering","_setUpEvents","layerToRemoveFrom","properties","addFeature","layerToAddTo","parentLayer","querySelector","src","shadowRoot","addLayer","forEach","addEventListener","clickEv","PointerEvent","cancelable","originalEvent","e","dispatchEvent","keyEv","KeyboardEvent","focusEv","FocusEvent","csMeta","layerEl","content","extentCache","map","geometry","cs","shapes","querySelectorAll","bboxExtent","Infinity","Number","NEGATIVE_INFINITY","shape","coord","i","data","innerHTML","trim","replace","split","tagName","_updateExtent","topLeft","L","point","bottomRight","pcrsBound","boundsToPCRSBounds","bounds","projection","tileCenter","tile","getCenter","pixel","transformation","transform","scale","pixelToPCRSBounds","subtract","add","result","Object","assign","_convertAndFormatPCRS","_getZoomBounds","minNativeZoom","maxNativeZoom","getZoomToZoom","tL","pcrs","bR","bound","horizontal","vertical","newZoom","getMaxZoom","metaName","toLowerCase","sdMeta","mapml2geojson","propertyFunction","json","el","table","cloneNode","_table2properties","prop0","source","dest","proj4","Proj","code","collection","geometries","push","_geometry2geojson","click","g","rect","getBoundingClientRect","event","MouseEvent","clientX","x","width","clientY","y","height","button","path","children","mousedown","call","mouseup","_layers","id","isPopupOpen","closePopup","cancelBubble","openPopup","focus","blur","activeElement","getContainer","zoomTo","center","unproject","setView","animate","whenReady","Promise","resolve","reject","interval","failureTimer","setInterval","featureElement","clearInterval","clearTimeout","setTimeout"],"mappings":";;MAAaA,mBAAmBC,YAC9BC,gCACE,MAAO,CAAC,OAAQ,MAAO,OAIzBC,cAEAC,WAEEC,IAAIC,EAAO,GACTC,EAASC,KAAKC,QAAQ,QAExB,OADIF,IAAQD,EAAOI,EAAEC,qBAAqBJ,EAAOK,aAAa,aAC9B,aAA5BJ,KAAKK,UAAUC,WAERN,KAAKO,aAAa,QACvBP,KAAKI,aAAa,QAClBN,EAAKU,OAELV,EAAKW,KAELT,KAAKU,gBAOAV,KAAKO,aAAa,QACvBP,KAAKI,aAAa,QAClBJ,KAAKU,cAIbd,SAASe,GACHC,EAAYC,SAASF,EAAK,KACzBG,MAAMF,IAAcA,GAAaZ,KAAKe,KAAOH,GAAaZ,KAAKS,KAClET,KAAKgB,aAAa,OAAQJ,GAI9BG,UAEElB,IAAIC,EAAO,GACTC,EAASC,KAAKC,QAAQ,QACpBF,IAAQD,EAAOI,EAAEC,qBAAqBJ,EAAOK,aAAa,aAE9D,MAAgC,aAA5BJ,KAAKK,UAAUC,WAERN,KAAKO,aAAa,OACvBP,KAAKI,aAAa,OAClBN,EAAKiB,KAELf,KAAKK,UAAUY,gBAAgBC,WAI1BlB,KAAKO,aAAa,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DI,SAASyI,cAAcrH,YAAYqH,cAAcjK,aAC/C3C,KAAK+D,WAEP/D,KAAK+D,SAAS4I,OAEd3M,KAAKwB,WAAWC,KAAKoL,eAAeH,SAKxCI,SACEjN,IAAIwB,EAASrB,KAAKqB,OAChBoF,EAAMzG,KAAKwB,WAAWC,KACpB6H,EAAKjI,EAAOuG,QAAQ2B,KACtBC,EAAKnI,EAAO0G,YAAYwB,KACxBE,EAAQ5B,EAAEK,OACRL,EAAEC,MAAMwB,EAAGI,WAAYJ,EAAGK,UAC1B9B,EAAEC,MAAM0B,EAAGE,WAAYF,EAAGG,WAE5BoD,EAAStG,EAAI/E,QAAQC,IAAIqL,UAAUvD,EAAMnB,WAAU,IACrD7B,EAAIwG,QAAQF,EAAQ/M,KAAKqJ,gBAAiB,CAAE6D,SAAS,IAEvDC,YACE,OAAO,IAAIC,QAAQ,CAACC,EAASC,KAC3BzN,IAAI0N,EAAUC,EACVxN,KAAK8B,YACPuL,KAGAE,EAAWE,YAGb,SAAwBC,GAClBA,EAAe5L,cACjB6L,cAAcJ,GACdK,aAAaJ,GACbH,MAPqC,IADlBrN,MAErBwN,EAAeK,WASjB,WACEF,cAAcJ,GACdK,aAAaJ,GACbF,EAAO,oDAZsC,gBApnBxC9N"} \ No newline at end of file diff --git a/static/dist/map-input.js b/static/dist/map-input.js index bc2057b7..a73a3a5a 100644 --- a/static/dist/map-input.js +++ b/static/dist/map-input.js @@ -1,5 +1,5 @@ -/*! @maps4html/web-map-custom-element 27-03-2024 */ +/*! @maps4html/web-map-custom-element 01-04-2024 */ -class MapInput extends HTMLElement{static get observedAttributes(){return["name","type","value","axis","units","position","rel","min","max","step"]}get name(){return this.getAttribute("name")}set name(t){t&&this.setAttribute("name",t)}get type(){return this.getAttribute("type")}set type(t){["location"].includes(t)&&this.setAttribute("type",t)}get value(){return this.input.getValue()}set value(t){t&&this.setAttribute("value",t)}get axis(){return this.getAttribute("axis")}set axis(t){t&&this.setAttribute("axis",t)}get units(){return this.getAttribute("units")}set units(t){t&&this.setAttribute("units",t)}get position(){return this.getAttribute("position")}set position(t){t&&this.setAttribute("position",t)}get rel(){return this.getAttribute("rel")}set rel(t){t&&this.setAttribute("rel",t)}get min(){if("zoom"===this.type)return this.hasAttribute("min")?this.getAttribute("min"):this.parentElement.querySelector("map-meta[name=zoom]")?M._metaContentToObject(this.parentElement.querySelector("map-meta[name=zoom]").getAttribute("content")).min:this.getLayerEl().extent?.zoom.minZoom.toString()}set min(t){t&&this.setAttribute("min",t)}get max(){if("zoom"===this.type)return this.hasAttribute("max")?this.getAttribute("max"):this.parentElement.querySelector("map-meta[name=zoom]")?M._metaContentToObject(this.parentElement.querySelector("map-meta[name=zoom]").getAttribute("content")).max:this.getLayerEl().extent?.zoom.maxZoom.toString()}set max(t){t&&this.setAttribute("max",t)}get step(){return"zoom"!==this.type?null:this.getAttribute("step")||"1"}set step(t){t&&this.setAttribute("step",t)}getLayerEl(){return this.getRootNode()instanceof ShadowRoot?this.getRootNode().host:this.closest("layer-")}attributeChangedCallback(e,t,i){this.whenReady().then(()=>{switch(e){case"name":t!==i&&null!==t&&(this.input.name=i);break;case"type":break;case"value":t!==i&&null!==t&&(this.input.value=i);break;case"axis":t!==i&&this.input&&(this.input.axis=i);break;case"units":t!==i&&this.input&&(this.input.units=i);break;case"position":t!==i&&this.input&&(this.input.position=i);break;case"rel":t!==i&&this.input&&(this.input.rel=i);break;case"min":t!==i&&this.input&&(this.input.min=i);break;case"max":t!==i&&this.input&&(this.input.max=i);break;case"step":t!==i&&this.input&&(this.input.step=i)}}).catch(t=>{console.log(t,` +class MapInput extends HTMLElement{static get observedAttributes(){return["name","type","value","axis","units","position","rel","min","max","step"]}get name(){return this.getAttribute("name")}set name(t){t&&this.setAttribute("name",t)}get type(){return this.getAttribute("type")}set type(t){["location"].includes(t)&&this.setAttribute("type",t)}get value(){return this.input.getValue()}set value(t){t&&this.setAttribute("value",t)}get axis(){return this.getAttribute("axis")}set axis(t){t&&this.setAttribute("axis",t)}get units(){return this.getAttribute("units")}set units(t){t&&this.setAttribute("units",t)}get position(){return this.getAttribute("position")}set position(t){t&&this.setAttribute("position",t)}get rel(){return this.getAttribute("rel")}set rel(t){t&&this.setAttribute("rel",t)}get min(){if("zoom"===this.type)return this.hasAttribute("min")?this.getAttribute("min"):this.parentElement.querySelector("map-meta[name=zoom]")?M._metaContentToObject(this.parentElement.querySelector("map-meta[name=zoom]").getAttribute("content")).min:this.getLayerEl().extent?.zoom.minZoom.toString()}set min(t){t&&this.setAttribute("min",t)}get max(){if("zoom"===this.type)return this.hasAttribute("max")?this.getAttribute("max"):this.parentElement.querySelector("map-meta[name=zoom]")?M._metaContentToObject(this.parentElement.querySelector("map-meta[name=zoom]").getAttribute("content")).max:this.getLayerEl().extent?.zoom.maxZoom.toString()}set max(t){t&&this.setAttribute("max",t)}get step(){return"zoom"!==this.type?null:this.getAttribute("step")||"1"}set step(t){t&&this.setAttribute("step",t)}getMapEl(){return M.getClosest(this,"mapml-viewer,map[is=web-map]")}getLayerEl(){return M.getClosest(this,"layer-")}attributeChangedCallback(e,t,i){this.whenReady().then(()=>{switch(e){case"name":t!==i&&null!==t&&(this.input.name=i);break;case"type":break;case"value":t!==i&&null!==t&&(this.input.value=i);break;case"axis":t!==i&&this.input&&(this.input.axis=i);break;case"units":t!==i&&this.input&&(this.input.units=i);break;case"position":t!==i&&this.input&&(this.input.position=i);break;case"rel":t!==i&&this.input&&(this.input.rel=i);break;case"min":t!==i&&this.input&&(this.input.min=i);break;case"max":t!==i&&this.input&&(this.input.max=i);break;case"step":t!==i&&this.input&&(this.input.step=i)}}).catch(t=>{console.log(t,` in mapInput.attributeChangeCallback when changing attribute `+e)})}constructor(){super()}connectedCallback(){this.parentElement.whenReady().then(()=>{switch("MAP-EXTENT"===this.parentElement.nodeName&&(this._layer=this.parentElement._layer),this.type){case"zoom":this.initialValue=+this.getAttribute("value"),this.input=new M.ZoomInput(this.name,this.min,this.max,this.initialValue,this.step,this._layer);break;case"location":this.input=new M.LocationInput(this.name,this.position,this.axis,this.units,this.min,this.max,this.rel,this._layer);break;case"width":this.input=new M.WidthInput(this.name,this._layer);break;case"height":this.input=new M.HeightInput(this.name,this._layer);break;case"hidden":this.input=new M.HiddenInput(this.name,this.initialValue)}}).catch(t=>{console.log(t,"\nin mapInput.connectedCallback")})}disconnectedCallback(){}checkValidity(){if(this.input.validateInput())return!0;var t=new Event("invalid",{bubbles:!0,cancelable:!0,composed:!0});return this.dispatchEvent(t),!1}reportValidity(){if(this.input.validateInput())return!0;var t=new Event("invalid",{bubbles:!0,cancelable:!0,composed:!0});return this.dispatchEvent(t),console.log("Input type='"+this.type+"' is not valid!"),!1}whenReady(){return new Promise((e,i)=>{let n,s;this.input?e():(n=setInterval(function(t){t.input?(clearInterval(n),clearTimeout(s),e()):t.isConnected||(clearInterval(n),clearTimeout(s),i("map-input was disconnected while waiting to be ready"))},300,this),s=setTimeout(function(){clearInterval(n),clearTimeout(s),i("Timeout reached waiting for input to be ready")},1e4))})}}export{MapInput}; //# sourceMappingURL=map-input.js.map \ No newline at end of file diff --git a/static/dist/map-input.js.map b/static/dist/map-input.js.map index 2ca1550c..48104b5d 100644 --- a/static/dist/map-input.js.map +++ b/static/dist/map-input.js.map @@ -1 +1 @@ -{"version":3,"file":"map-input.js","sources":["../src/map-input.js"],"sourcesContent":["/* global M */\nexport class MapInput extends HTMLElement {\n static get observedAttributes() {\n return [\n 'name',\n 'type',\n 'value',\n 'axis',\n 'units',\n 'position',\n 'rel',\n 'min',\n 'max',\n 'step'\n ];\n }\n // sets default values for min,max on zoom and location input\n // this stuff should be handled by the default getters on map-input type=location or map-input type=zoom\n // if (\n // inp.hasAttribute('type') &&\n // inp.getAttribute('type') === 'location' &&\n // (!inp.hasAttribute('min') || !inp.hasAttribute('max')) &&\n // inp.hasAttribute('axis') &&\n // !['i', 'j'].includes(inp.getAttribute('axis').toLowerCase())\n // ) {\n // if (\n // zoomInput &&\n // template.includes(`{${zoomInput.getAttribute('name')}}`)\n // ) {\n // zoomInput.setAttribute('value', boundsFallback.zoom);\n // }\n // let axis = inp.getAttribute('axis'),\n // axisBounds = M.convertPCRSBounds(\n // boundsFallback.bounds,\n // boundsFallback.zoom,\n // projection,\n // M.axisToCS(axis)\n // );\n // inp.setAttribute('min', axisBounds.min[M.axisToXY(axis)]);\n // inp.setAttribute('max', axisBounds.max[M.axisToXY(axis)]);\n // }\n\n get name() {\n return this.getAttribute('name');\n }\n set name(val) {\n if (val) {\n this.setAttribute('name', val);\n }\n }\n get type() {\n return this.getAttribute('type');\n }\n set type(val) {\n if (['location'].includes(val)) {\n this.setAttribute('type', val);\n }\n }\n get value() {\n return this.input.getValue();\n }\n set value(val) {\n if (val) {\n this.setAttribute('value', val);\n }\n }\n get axis() {\n return this.getAttribute('axis');\n }\n set axis(val) {\n if (val) {\n this.setAttribute('axis', val);\n }\n }\n get units() {\n return this.getAttribute('units');\n }\n set units(val) {\n if (val) {\n this.setAttribute('units', val);\n }\n }\n get position() {\n return this.getAttribute('position');\n }\n set position(val) {\n if (val) {\n this.setAttribute('position', val);\n }\n }\n get rel() {\n return this.getAttribute('rel');\n }\n set rel(val) {\n if (val) {\n this.setAttribute('rel', val);\n }\n }\n get min() {\n switch (this.type) {\n case 'zoom':\n if (this.hasAttribute('min')) {\n return this.getAttribute('min');\n // min attribute can apply to: type=location, type=zoom\n // for zoom, it should fall back via upward document search: 1) this element,\n // 2) map-meta within the parent extent, 3) map-meta within the parent layer,\n // or finally 4) the map projection crs min/min\n // for location, it should fall back by searching upwards: same as for zoom\n } else if (this.parentElement.querySelector('map-meta[name=zoom]')) {\n // fallback map-meta on layer\n return M._metaContentToObject(\n this.parentElement\n .querySelector('map-meta[name=zoom]')\n .getAttribute('content')\n ).min;\n } else {\n // fallback map min\n return this.getLayerEl().extent?.zoom.minZoom.toString();\n }\n break;\n case 'location':\n default:\n break;\n }\n }\n set min(val) {\n if (val) {\n this.setAttribute('min', val);\n }\n }\n get max() {\n switch (this.type) {\n case 'zoom':\n if (this.hasAttribute('max')) {\n return this.getAttribute('max');\n // max attribute can apply to: type=location, type=zoom\n // for zoom, it should fall back via upward document search: 1) this element,\n // 2) map-meta within the parent extent, 3) map-meta within the parent layer,\n // or finally 4) the map projection crs min/max\n // for location, it should fall back by searching upwards: same as for zoom\n } else if (this.parentElement.querySelector('map-meta[name=zoom]')) {\n // fallback map-meta on layer\n return M._metaContentToObject(\n this.parentElement\n .querySelector('map-meta[name=zoom]')\n .getAttribute('content')\n ).max;\n } else {\n // fallback map max\n return this.getLayerEl().extent?.zoom.maxZoom.toString();\n }\n break;\n case 'location':\n default:\n break;\n }\n }\n set max(val) {\n if (val) {\n this.setAttribute('max', val);\n }\n }\n get step() {\n if (this.type !== 'zoom') {\n return null;\n } else {\n return this.getAttribute('step') || '1';\n }\n }\n set step(val) {\n if (val) {\n this.setAttribute('step', val);\n }\n }\n getLayerEl() {\n return this.getRootNode() instanceof ShadowRoot\n ? this.getRootNode().host\n : this.closest('layer-');\n }\n attributeChangedCallback(name, oldValue, newValue) {\n this.whenReady()\n .then(() => {\n switch (name) {\n case 'name':\n if (oldValue !== newValue) {\n // update associated class value on attribute change\n if (oldValue !== null) {\n this.input.name = newValue;\n }\n }\n break;\n case 'type':\n if (oldValue !== newValue) {\n // handle side effects\n // not allowed to change 'type'\n }\n break;\n case 'value':\n if (oldValue !== newValue) {\n if (oldValue !== null) {\n this.input.value = newValue;\n }\n }\n break;\n case 'axis':\n if (oldValue !== newValue && this.input) {\n // handle side effects\n this.input.axis = newValue;\n }\n break;\n case 'units':\n if (oldValue !== newValue && this.input) {\n // handle side effects\n this.input.units = newValue;\n }\n break;\n case 'position':\n if (oldValue !== newValue && this.input) {\n // handle side effects\n this.input.position = newValue;\n }\n break;\n case 'rel':\n if (oldValue !== newValue && this.input) {\n // handle side effects\n this.input.rel = newValue;\n }\n break;\n case 'min':\n if (oldValue !== newValue && this.input) {\n // handle side effects\n this.input.min = newValue;\n }\n break;\n case 'max':\n if (oldValue !== newValue && this.input) {\n // handle side effects\n this.input.max = newValue;\n }\n break;\n case 'step':\n if (oldValue !== newValue && this.input) {\n // handle side effects\n this.input.step = newValue;\n }\n break;\n }\n })\n .catch((reason) => {\n console.log(\n reason,\n `\\nin mapInput.attributeChangeCallback when changing attribute ${name}`\n );\n });\n }\n constructor() {\n // Always call super first in constructor\n super();\n }\n connectedCallback() {\n this.parentElement\n .whenReady()\n .then(() => {\n if (this.parentElement.nodeName === 'MAP-EXTENT') {\n this._layer = this.parentElement._layer;\n }\n switch (this.type) {\n case 'zoom':\n // input will store the input Class specific to the input type\n this.initialValue = +this.getAttribute('value');\n this.input = new M.ZoomInput(\n this.name,\n this.min,\n this.max,\n this.initialValue,\n this.step,\n this._layer\n );\n break;\n case 'location':\n // input will store the input Class specific to the input type\n this.input = new M.LocationInput(\n this.name,\n this.position,\n this.axis,\n this.units,\n this.min,\n this.max,\n this.rel,\n this._layer\n );\n break;\n case 'width':\n // input will store the input Class specific to the input type\n this.input = new M.WidthInput(this.name, this._layer);\n break;\n case 'height':\n // input will store the input Class specific to the input type\n this.input = new M.HeightInput(this.name, this._layer);\n break;\n case 'hidden':\n // input will store the input Class specific to the input type\n this.input = new M.HiddenInput(this.name, this.initialValue);\n break;\n }\n })\n .catch((reason) => {\n console.log(reason, '\\nin mapInput.connectedCallback');\n });\n }\n disconnectedCallback() {}\n\n //https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/checkValidity\n checkValidity() {\n if (this.input.validateInput()) {\n return true;\n } else {\n const evt = new Event('invalid', {\n bubbles: true,\n cancelable: true,\n composed: true\n });\n this.dispatchEvent(evt);\n return false;\n }\n }\n\n //https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/reportValidity\n reportValidity() {\n if (this.input.validateInput()) {\n return true;\n } else {\n const evt = new Event('invalid', {\n bubbles: true,\n cancelable: true,\n composed: true\n });\n this.dispatchEvent(evt);\n //if the event isn't canceled reports the problem to the user.\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-reportvalidity-dev\n console.log(\"Input type='\" + this.type + \"' is not valid!\");\n return false;\n }\n }\n whenReady() {\n return new Promise((resolve, reject) => {\n let interval, failureTimer;\n if (this.input) {\n resolve();\n } else {\n let inputElement = this;\n interval = setInterval(testForInput, 300, inputElement);\n failureTimer = setTimeout(inputNotDefined, 10000);\n }\n function testForInput(inputElement) {\n if (inputElement.input) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n resolve();\n } else if (!inputElement.isConnected) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('map-input was disconnected while waiting to be ready');\n }\n }\n function inputNotDefined() {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('Timeout reached waiting for input to be ready');\n }\n });\n }\n}\n"],"names":["MapInput","HTMLElement","observedAttributes","name","this","getAttribute","val","setAttribute","type","includes","value","input","getValue","axis","units","position","rel","min","hasAttribute","parentElement","querySelector","M","_metaContentToObject","getLayerEl","extent","zoom","minZoom","toString","max","maxZoom","step","getRootNode","ShadowRoot","host","closest","attributeChangedCallback","oldValue","newValue","whenReady","then","catch","console","log","reason","constructor","super","connectedCallback","nodeName","_layer","initialValue","ZoomInput","LocationInput","WidthInput","HeightInput","HiddenInput","disconnectedCallback","checkValidity","validateInput","evt","Event","bubbles","cancelable","composed","dispatchEvent","reportValidity","Promise","resolve","reject","let","interval","failureTimer","setInterval","inputElement","clearInterval","clearTimeout","isConnected","setTimeout"],"mappings":";;MACaA,iBAAiBC,YAC5BC,gCACE,MAAO,CACL,OACA,OACA,QACA,OACA,QACA,WACA,MACA,MACA,MACA,QA6BJC,WACE,OAAOC,KAAKC,aAAa,QAE3BF,SAASG,GACHA,GACFF,KAAKG,aAAa,OAAQD,GAG9BE,WACE,OAAOJ,KAAKC,aAAa,QAE3BG,SAASF,GACH,CAAC,YAAYG,SAASH,IACxBF,KAAKG,aAAa,OAAQD,GAG9BI,YACE,OAAON,KAAKO,MAAMC,WAEpBF,UAAUJ,GACJA,GACFF,KAAKG,aAAa,Q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,KAAKD,KAAMC,KAAK4C,QAC9C,MACF,IAAK,SAEH5C,KAAKO,MAAQ,IAAIU,EAAEgC,YAAYjD,KAAKD,KAAMC,KAAK4C,QAC/C,MACF,IAAK,SAEH5C,KAAKO,MAAQ,IAAIU,EAAEiC,YAAYlD,KAAKD,KAAMC,KAAK6C,iBAIpDT,MAAM,IACLC,QAAQC,IAAIC,EAAQ,qCAG1BY,wBAGAC,gBACE,GAAIpD,KAAKO,MAAM8C,gBACb,OAAO,EAEP,IAAMC,EAAM,IAAIC,MAAM,UAAW,CAC/BC,SAAS,EACTC,YAAY,EACZC,UAAU,IAGZ,OADA1D,KAAK2D,cAAcL,IACZ,EAKXM,iBACE,GAAI5D,KAAKO,MAAM8C,gBACb,OAAO,EAEP,IAAMC,EAAM,IAAIC,MAAM,UAAW,CAC/BC,SAAS,EACTC,YAAY,EACZC,UAAU,IAMZ,OAJA1D,KAAK2D,cAAcL,GAGnBjB,QAAQC,IAAI,eAAiBtC,KAAKI,KAAO,oBAClC,EAGX8B,YACE,OAAO,IAAI2B,QAAQ,CAACC,EAASC,KAC3BC,IAAIC,EAAUC,EACVlE,KAAKO,MACPuD,KAGAG,EAAWE,YAGb,SAAsBC,GAChBA,EAAa7D,OACf8D,cAAcJ,GACdK,aAAaJ,GACbJ,KACUM,EAAaG,cACvBF,cAAcJ,GACdK,aAAaJ,GACbH,EAAO,0DAX4B,IADlB/D,MAEnBkE,EAAeM,WAajB,WACEH,cAAcJ,GACdK,aAAaJ,GACbH,EAAO,kDAhBoC,gBA/VtCnE"} \ No newline at end of file +{"version":3,"file":"map-input.js","sources":["../src/map-input.js"],"sourcesContent":["/* global M */\nexport class MapInput extends HTMLElement {\n static get observedAttributes() {\n return [\n 'name',\n 'type',\n 'value',\n 'axis',\n 'units',\n 'position',\n 'rel',\n 'min',\n 'max',\n 'step'\n ];\n }\n // sets default values for min,max on zoom and location input\n // this stuff should be handled by the default getters on map-input type=location or map-input type=zoom\n // if (\n // inp.hasAttribute('type') &&\n // inp.getAttribute('type') === 'location' &&\n // (!inp.hasAttribute('min') || !inp.hasAttribute('max')) &&\n // inp.hasAttribute('axis') &&\n // !['i', 'j'].includes(inp.getAttribute('axis').toLowerCase())\n // ) {\n // if (\n // zoomInput &&\n // template.includes(`{${zoomInput.getAttribute('name')}}`)\n // ) {\n // zoomInput.setAttribute('value', boundsFallback.zoom);\n // }\n // let axis = inp.getAttribute('axis'),\n // axisBounds = M.convertPCRSBounds(\n // boundsFallback.bounds,\n // boundsFallback.zoom,\n // projection,\n // M.axisToCS(axis)\n // );\n // inp.setAttribute('min', axisBounds.min[M.axisToXY(axis)]);\n // inp.setAttribute('max', axisBounds.max[M.axisToXY(axis)]);\n // }\n\n get name() {\n return this.getAttribute('name');\n }\n set name(val) {\n if (val) {\n this.setAttribute('name', val);\n }\n }\n get type() {\n return this.getAttribute('type');\n }\n set type(val) {\n if (['location'].includes(val)) {\n this.setAttribute('type', val);\n }\n }\n get value() {\n return this.input.getValue();\n }\n set value(val) {\n if (val) {\n this.setAttribute('value', val);\n }\n }\n get axis() {\n return this.getAttribute('axis');\n }\n set axis(val) {\n if (val) {\n this.setAttribute('axis', val);\n }\n }\n get units() {\n return this.getAttribute('units');\n }\n set units(val) {\n if (val) {\n this.setAttribute('units', val);\n }\n }\n get position() {\n return this.getAttribute('position');\n }\n set position(val) {\n if (val) {\n this.setAttribute('position', val);\n }\n }\n get rel() {\n return this.getAttribute('rel');\n }\n set rel(val) {\n if (val) {\n this.setAttribute('rel', val);\n }\n }\n get min() {\n switch (this.type) {\n case 'zoom':\n if (this.hasAttribute('min')) {\n return this.getAttribute('min');\n // min attribute can apply to: type=location, type=zoom\n // for zoom, it should fall back via upward document search: 1) this element,\n // 2) map-meta within the parent extent, 3) map-meta within the parent layer,\n // or finally 4) the map projection crs min/min\n // for location, it should fall back by searching upwards: same as for zoom\n } else if (this.parentElement.querySelector('map-meta[name=zoom]')) {\n // fallback map-meta on layer\n return M._metaContentToObject(\n this.parentElement\n .querySelector('map-meta[name=zoom]')\n .getAttribute('content')\n ).min;\n } else {\n // fallback map min\n return this.getLayerEl().extent?.zoom.minZoom.toString();\n }\n break;\n case 'location':\n default:\n break;\n }\n }\n set min(val) {\n if (val) {\n this.setAttribute('min', val);\n }\n }\n get max() {\n switch (this.type) {\n case 'zoom':\n if (this.hasAttribute('max')) {\n return this.getAttribute('max');\n // max attribute can apply to: type=location, type=zoom\n // for zoom, it should fall back via upward document search: 1) this element,\n // 2) map-meta within the parent extent, 3) map-meta within the parent layer,\n // or finally 4) the map projection crs min/max\n // for location, it should fall back by searching upwards: same as for zoom\n } else if (this.parentElement.querySelector('map-meta[name=zoom]')) {\n // fallback map-meta on layer\n return M._metaContentToObject(\n this.parentElement\n .querySelector('map-meta[name=zoom]')\n .getAttribute('content')\n ).max;\n } else {\n // fallback map max\n return this.getLayerEl().extent?.zoom.maxZoom.toString();\n }\n break;\n case 'location':\n default:\n break;\n }\n }\n set max(val) {\n if (val) {\n this.setAttribute('max', val);\n }\n }\n get step() {\n if (this.type !== 'zoom') {\n return null;\n } else {\n return this.getAttribute('step') || '1';\n }\n }\n set step(val) {\n if (val) {\n this.setAttribute('step', val);\n }\n }\n getMapEl() {\n return M.getClosest(this, 'mapml-viewer,map[is=web-map]');\n }\n getLayerEl() {\n return M.getClosest(this, 'layer-');\n }\n attributeChangedCallback(name, oldValue, newValue) {\n this.whenReady()\n .then(() => {\n switch (name) {\n case 'name':\n if (oldValue !== newValue) {\n // update associated class value on attribute change\n if (oldValue !== null) {\n this.input.name = newValue;\n }\n }\n break;\n case 'type':\n if (oldValue !== newValue) {\n // handle side effects\n // not allowed to change 'type'\n }\n break;\n case 'value':\n if (oldValue !== newValue) {\n if (oldValue !== null) {\n this.input.value = newValue;\n }\n }\n break;\n case 'axis':\n if (oldValue !== newValue && this.input) {\n // handle side effects\n this.input.axis = newValue;\n }\n break;\n case 'units':\n if (oldValue !== newValue && this.input) {\n // handle side effects\n this.input.units = newValue;\n }\n break;\n case 'position':\n if (oldValue !== newValue && this.input) {\n // handle side effects\n this.input.position = newValue;\n }\n break;\n case 'rel':\n if (oldValue !== newValue && this.input) {\n // handle side effects\n this.input.rel = newValue;\n }\n break;\n case 'min':\n if (oldValue !== newValue && this.input) {\n // handle side effects\n this.input.min = newValue;\n }\n break;\n case 'max':\n if (oldValue !== newValue && this.input) {\n // handle side effects\n this.input.max = newValue;\n }\n break;\n case 'step':\n if (oldValue !== newValue && this.input) {\n // handle side effects\n this.input.step = newValue;\n }\n break;\n }\n })\n .catch((reason) => {\n console.log(\n reason,\n `\\nin mapInput.attributeChangeCallback when changing attribute ${name}`\n );\n });\n }\n constructor() {\n // Always call super first in constructor\n super();\n }\n connectedCallback() {\n this.parentElement\n .whenReady()\n .then(() => {\n if (this.parentElement.nodeName === 'MAP-EXTENT') {\n this._layer = this.parentElement._layer;\n }\n switch (this.type) {\n case 'zoom':\n // input will store the input Class specific to the input type\n this.initialValue = +this.getAttribute('value');\n this.input = new M.ZoomInput(\n this.name,\n this.min,\n this.max,\n this.initialValue,\n this.step,\n this._layer\n );\n break;\n case 'location':\n // input will store the input Class specific to the input type\n this.input = new M.LocationInput(\n this.name,\n this.position,\n this.axis,\n this.units,\n this.min,\n this.max,\n this.rel,\n this._layer\n );\n break;\n case 'width':\n // input will store the input Class specific to the input type\n this.input = new M.WidthInput(this.name, this._layer);\n break;\n case 'height':\n // input will store the input Class specific to the input type\n this.input = new M.HeightInput(this.name, this._layer);\n break;\n case 'hidden':\n // input will store the input Class specific to the input type\n this.input = new M.HiddenInput(this.name, this.initialValue);\n break;\n }\n })\n .catch((reason) => {\n console.log(reason, '\\nin mapInput.connectedCallback');\n });\n }\n disconnectedCallback() {}\n\n //https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/checkValidity\n checkValidity() {\n if (this.input.validateInput()) {\n return true;\n } else {\n const evt = new Event('invalid', {\n bubbles: true,\n cancelable: true,\n composed: true\n });\n this.dispatchEvent(evt);\n return false;\n }\n }\n\n //https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/reportValidity\n reportValidity() {\n if (this.input.validateInput()) {\n return true;\n } else {\n const evt = new Event('invalid', {\n bubbles: true,\n cancelable: true,\n composed: true\n });\n this.dispatchEvent(evt);\n //if the event isn't canceled reports the problem to the user.\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-cva-reportvalidity-dev\n console.log(\"Input type='\" + this.type + \"' is not valid!\");\n return false;\n }\n }\n whenReady() {\n return new Promise((resolve, reject) => {\n let interval, failureTimer;\n if (this.input) {\n resolve();\n } else {\n let inputElement = this;\n interval = setInterval(testForInput, 300, inputElement);\n failureTimer = setTimeout(inputNotDefined, 10000);\n }\n function testForInput(inputElement) {\n if (inputElement.input) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n resolve();\n } else if (!inputElement.isConnected) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('map-input was disconnected while waiting to be ready');\n }\n }\n function inputNotDefined() {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('Timeout reached waiting for input to be ready');\n }\n });\n }\n}\n"],"names":["MapInput","HTMLElement","observedAttributes","name","this","getAttribute","val","setAttribute","type","includes","value","input","getValue","axis","units","position","rel","min","hasAttribute","parentElement","querySelector","M","_metaContentToObject","getLayerEl","extent","zoom","minZoom","toString","max","maxZoom","step","getMapEl","getClosest","attributeChangedCallback","oldValue","newValue","whenReady","then","catch","console","log","reason","constructor","super","connectedCallback","nodeName","_layer","initialValue","ZoomInput","LocationInput","WidthInput","HeightInput","HiddenInput","disconnectedCallback","checkValidity","validateInput","evt","Event","bubbles","cancelable","composed","dispatchEvent","reportValidity","Promise","resolve","reject","let","interval","failureTimer","setInterval","inputElement","clearInterval","clearTimeout","isConnected","setTimeout"],"mappings":";;MACaA,iBAAiBC,YAC5BC,gCACE,MAAO,CACL,OACA,OACA,QACA,OACA,QACA,WACA,MACA,MACA,MACA,QA6BJC,WACE,OAAOC,KAAKC,aAAa,QAE3BF,SAASG,GACHA,GACF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ist/map-link.js +++ b/static/dist/map-link.js @@ -1,4 +1,4 @@ -/*! @maps4html/web-map-custom-element 27-03-2024 */ +/*! @maps4html/web-map-custom-element 01-04-2024 */ -class MapLink extends HTMLElement{static get observedAttributes(){return["type","rel","media","href","hreflang","tref","tms","projection"]}#hasConnected;get type(){return this.getAttribute("type")||"image/*"}set type(t){"text/mapml"!==t&&!t.startsWith("image/")||this.setAttribute("type",t)}get rel(){return this.getAttribute("rel")}set rel(t){["license","alternate","self","style","tile","image","features","zoomin","zoomout","legend","query","stylesheet"].includes(t)&&this.setAttribute("type",t)}get href(){return this.hasAttribute("href")?new URL(this.getAttribute("href"),this.getBase()).href:this.hasAttribute("tref")?this.resolve():void 0}set href(t){t&&this.setAttribute("href",t)}get hreflang(){return this.getAttribute("hreflang")}set hreflang(t){t&&this.setAttribute("hreflang",t)}get tref(){return this.hasAttribute("tref")?this.getAttribute("tref"):M.BLANK_TT_TREF}set tref(t){t&&this.setAttribute("tref",t)}get media(){return M._metaContentToObject(this.getAttribute("media"))}set media(t){this.setAttribute("media",t)}get tms(){return this.hasAttribute("tms")}set tms(t){t&&this.setAttribute("tms","")}get projection(){return this.getAttribute("projection")}set projection(t){["OSMTILE","CBMTILE","WGS84","APSTILE"].includes(t)&&this.setAttribute("projection",t)}get extent(){return this._templateVars?Object.assign(M._convertAndFormatPCRS(this.getBounds(),M[this.parentExtent.units],this.parentExtent.units),{zoom:this.getZoomBounds()}):null}zoomTo(){var h=this.extent;if(h){let t=this.getMapEl()._map,e=h.topLeft.pcrs.horizontal,s=h.bottomRight.pcrs.horizontal,i=h.bottomRight.pcrs.vertical,a=h.topLeft.pcrs.vertical,r=L.bounds(L.point(e,i),L.point(s,a)),o=t.options.crs.unproject(r.getCenter(!0)),n=h.zoom.maxZoom,l=h.zoom.minZoom;t.setView(o,M.getMaxZoom(r,t,l,n),{animate:!1})}}getMapEl(){return(this.getRootNode()instanceof ShadowRoot?this.getRootNode().host:this).closest("mapml-viewer,map[is=web-map]")}getLayerEl(){return this.getRootNode()instanceof ShadowRoot?this.getRootNode().host:this.closest("layer-")}attributeChangedCallback(t,e,s){if(this.#hasConnected)switch(t){case"type":case"rel":case"href":case"hreflang":break;case"tref":e!==s&&this._initTemplateVars()}}constructor(){super()}connectedCallback(){if(this.#hasConnected=!0,!(this.getLayerEl().hasAttribute("data-moving")||this.parentExtent&&this.parentExtent.hasAttribute("data-moving")))switch(this.rel.toLowerCase()){case"tile":case"image":case"features":case"query":this._initTemplateVars(),this._createTemplatedLink();break;case"style":case"self":case"style self":case"self style":this._createSelfOrStyleLink();break;case"zoomin":case"zoomout":case"legend":break;case"stylesheet":this._createStylesheetLink();break;case"alternate":this._createAlternateLink()}}disconnectedCallback(){"stylesheet"===this.rel.toLowerCase()&&this._stylesheetHost&&this.link.remove()}_createAlternateLink(t){this.href&&this.projection&&(this._alternate=!0)}_createStylesheetLink(){var t,e;this._stylesheetHost=this.getRootNode()instanceof ShadowRoot?this.getRootNode().host:this.parentElement,void 0!==this._stylesheetHost&&(this.link=document.createElement("link"),(this.link.mapLink=this).link.setAttribute("href",new URL(this.href,this.getBase()).href),e=(t=this).link,Array.from(t.attributes).forEach(t=>{"href"!==t.nodeName&&e.setAttribute(t.nodeName,t.nodeValue)}),this._stylesheetHost._layer?this._stylesheetHost._layer.appendStyleLink(this):this._stylesheetHost._templatedLayer?this._stylesheetHost._templatedLayer.appendStyleLink(this):this._stylesheetHost._extentLayer&&this._stylesheetHost._extentLayer.appendStyleLink(this))}async _createTemplatedLink(){if(this.parentExtent="MAP-EXTENT"===this.parentNode.nodeName.toUpperCase()?this.parentNode:this.parentNode.host,this.tref&&this.parentExtent){try{await this.parentExtent.whenReady(),await this._templateVars.inputsReady}catch(t){return void console.log("Error while creating templated link: "+t)}this.mapEl=this.getMapEl(),this.zIndex=Array.from(this.parentExtent.querySelectorAll("map-link[rel=image],map-link[rel=tile],map-link[rel=features]")).indexOf(this),"tile"===this.rel?this._templatedLayer=M.templatedTileLayer(this._templateVars,{zoomBounds:this.getZoomBounds(),extentBounds:this.getBounds(),crs:M[this.parentExtent.units],errorTileUrl:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zIndex:this.zIndex,pane:this.parentExtent._extentLayer.getContainer(),linkEl:this}).addTo(this.parentExtent._extentLayer):"image"===this.rel?this._templatedLayer=M.templatedImageLayer(this._templateVars,{zoomBounds:this.getZoomBounds(),extentBounds:this.getBounds(),zIndex:this.zIndex,pane:this.parentExtent._extentLayer.getContainer(),linkEl:this}).addTo(this.parentExtent._extentLayer):"features"===this.rel?(this.attachShadow({mode:"open"}),this._templatedLayer=M.templatedFeaturesLayer(this._templateVars,{zoomBounds:this.getZoomBounds(),extentBounds:this.getBounds(),zIndex:this.zIndex,pane:this.parentExtent._extentLayer.getContainer(),linkEl:this}).addTo(this.parentExtent._extentLayer)):"query"===this.rel&&(this.attachShadow({mode:"open"}),L.extend(this._templateVars,this._setupQueryVars(this._templateVars)),L.extend(this._templateVars,{extentBounds:this.getBounds()}))}}_setupQueryVars(t){for(var e={query:{}},s=t.values,i=0;i{let i,a,r;switch(this.rel.toLowerCase()){case"tile":case"image":case"features":r="_templatedLayer";break;case"style":case"self":case"style self":case"self style":r="_styleOption";break;case"query":r="shadowRoot";break;case"alternate":r="_alternate";break;default:e()}this[r]&&e(),i=setInterval(function(t){t[r]?(clearInterval(i),clearTimeout(a),e()):t.isConnected||(clearInterval(i),clearTimeout(a),s("map-link was disconnected while waiting to be ready"))},300,this),a=setTimeout(function(){clearInterval(i),clearTimeout(a),s("Timeout reached waiting for link to be ready")},1e4)})}}export{MapLink}; +class MapLink extends HTMLElement{static get observedAttributes(){return["type","rel","media","href","hreflang","tref","tms","projection"]}#hasConnected;get type(){return this.getAttribute("type")||"image/*"}set type(t){"text/mapml"!==t&&!t.startsWith("image/")||this.setAttribute("type",t)}get rel(){return this.getAttribute("rel")}set rel(t){["license","alternate","self","style","tile","image","features","zoomin","zoomout","legend","query","stylesheet"].includes(t)&&this.setAttribute("type",t)}get href(){return this.hasAttribute("href")?new URL(this.getAttribute("href"),this.getBase()).href:this.hasAttribute("tref")?this.resolve():void 0}set href(t){t&&this.setAttribute("href",t)}get hreflang(){return this.getAttribute("hreflang")}set hreflang(t){t&&this.setAttribute("hreflang",t)}get tref(){return this.hasAttribute("tref")?this.getAttribute("tref"):M.BLANK_TT_TREF}set tref(t){t&&this.setAttribute("tref",t)}get media(){return M._metaContentToObject(this.getAttribute("media"))}set media(t){this.setAttribute("media",t)}get tms(){return this.hasAttribute("tms")}set tms(t){t&&this.setAttribute("tms","")}get projection(){return this.getAttribute("projection")}set projection(t){["OSMTILE","CBMTILE","WGS84","APSTILE"].includes(t)&&this.setAttribute("projection",t)}get extent(){return this._templateVars?Object.assign(M._convertAndFormatPCRS(this.getBounds(),M[this.parentExtent.units],this.parentExtent.units),{zoom:this.getZoomBounds()}):null}zoomTo(){var h=this.extent;if(h){let t=this.getMapEl()._map,e=h.topLeft.pcrs.horizontal,i=h.bottomRight.pcrs.horizontal,s=h.bottomRight.pcrs.vertical,a=h.topLeft.pcrs.vertical,r=L.bounds(L.point(e,s),L.point(i,a)),o=t.options.crs.unproject(r.getCenter(!0)),n=h.zoom.maxZoom,l=h.zoom.minZoom;t.setView(o,M.getMaxZoom(r,t,l,n),{animate:!1})}}getMapEl(){return M.getClosest(this,"mapml-viewer,map[is=web-map]")}getLayerEl(){return M.getClosest(this,"layer-")}attributeChangedCallback(t,e,i){if(this.#hasConnected)switch(t){case"type":case"rel":case"href":case"hreflang":break;case"tref":e!==i&&this._initTemplateVars()}}constructor(){super()}connectedCallback(){if(this.#hasConnected=!0,!(this.getLayerEl().hasAttribute("data-moving")||this.parentExtent&&this.parentExtent.hasAttribute("data-moving")))switch(this.rel.toLowerCase()){case"tile":case"image":case"features":case"query":this._initTemplateVars(),this._createTemplatedLink();break;case"style":case"self":case"style self":case"self style":this._createSelfOrStyleLink();break;case"zoomin":case"zoomout":case"legend":break;case"stylesheet":this._createStylesheetLink();break;case"alternate":this._createAlternateLink()}}disconnectedCallback(){"stylesheet"===this.rel.toLowerCase()&&this._stylesheetHost&&this.link.remove()}_createAlternateLink(t){this.href&&this.projection&&(this._alternate=!0)}_createStylesheetLink(){var t,e;this._stylesheetHost=this.getRootNode()instanceof ShadowRoot?this.getRootNode().host:this.parentElement,void 0!==this._stylesheetHost&&(this.link=document.createElement("link"),(this.link.mapLink=this).link.setAttribute("href",new URL(this.href,this.getBase()).href),e=(t=this).link,Array.from(t.attributes).forEach(t=>{"href"!==t.nodeName&&e.setAttribute(t.nodeName,t.nodeValue)}),this._stylesheetHost._layer?this._stylesheetHost._layer.appendStyleLink(this):this._stylesheetHost._templatedLayer?this._stylesheetHost._templatedLayer.appendStyleLink(this):this._stylesheetHost._extentLayer&&this._stylesheetHost._extentLayer.appendStyleLink(this))}async _createTemplatedLink(){if(this.parentExtent="MAP-EXTENT"===this.parentNode.nodeName.toUpperCase()?this.parentNode:this.parentNode.host,this.tref&&this.parentExtent){try{await this.parentExtent.whenReady(),await this._templateVars.inputsReady}catch(t){return void console.log("Error while creating templated link: "+t)}this.mapEl=this.getMapEl(),this.zIndex=Array.from(this.parentExtent.querySelectorAll("map-link[rel=image],map-link[rel=tile],map-link[rel=features]")).indexOf(this),"tile"===this.rel?this._templatedLayer=M.templatedTileLayer(this._templateVars,{zoomBounds:this.getZoomBounds(),extentBounds:this.getBounds(),crs:M[this.parentExtent.units],errorTileUrl:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zIndex:this.zIndex,pane:this.parentExtent._extentLayer.getContainer(),linkEl:this}).addTo(this.parentExtent._extentLayer):"image"===this.rel?this._templatedLayer=M.templatedImageLayer(this._templateVars,{zoomBounds:this.getZoomBounds(),extentBounds:this.getBounds(),zIndex:this.zIndex,pane:this.parentExtent._extentLayer.getContainer(),linkEl:this}).addTo(this.parentExtent._extentLayer):"features"===this.rel?(this.attachShadow({mode:"open"}),this._templatedLayer=M.templatedFeaturesLayer(this._templateVars,{zoomBounds:this.getZoomBounds(),extentBounds:this.getBounds(),zIndex:this.zIndex,pane:this.parentExtent._extentLayer.getContainer(),linkEl:this}).addTo(this.parentExtent._extentLayer)):"query"===this.rel&&(this.attachShadow({mode:"open"}),L.extend(this._templateVars,this._setupQueryVars(this._templateVars)),L.extend(this._templateVars,{extentBounds:this.getBounds()}))}}_setupQueryVars(t){for(var e={query:{}},i=t.values,s=0;s{let s,a,r;switch(this.rel.toLowerCase()){case"tile":case"image":case"features":r="_templatedLayer";break;case"style":case"self":case"style self":case"self style":r="_styleOption";break;case"query":r="shadowRoot";break;case"alternate":r="_alternate";break;default:e()}this[r]&&e(),s=setInterval(function(t){t[r]?(clearInterval(s),clearTimeout(a),e()):t.isConnected||(clearInterval(s),clearTimeout(a),i("map-link was disconnected while waiting to be ready"))},300,this),a=setTimeout(function(){clearInterval(s),clearTimeout(a),i("Timeout reached waiting for link to be ready")},1e4)})}}export{MapLink}; //# sourceMappingURL=map-link.js.map \ No newline at end of file diff --git a/static/dist/map-link.js.map b/static/dist/map-link.js.map index b3ecfc97..2499d8c9 100644 --- a/static/dist/map-link.js.map +++ b/static/dist/map-link.js.map @@ -1 +1 @@ -{"version":3,"file":"map-link.js","sources":["../src/map-link.js"],"sourcesContent":["/* global M */\n\nexport class MapLink extends HTMLElement {\n static get observedAttributes() {\n return [\n 'type',\n 'rel',\n // 'title',\n 'media',\n 'href',\n 'hreflang',\n 'tref',\n 'tms',\n 'projection'\n ];\n }\n /* jshint ignore:start */\n #hasConnected;\n /* jshint ignore:end */\n get type() {\n return this.getAttribute('type') || 'image/*';\n }\n set type(val) {\n // improve this\n if (val === 'text/mapml' || val.startsWith('image/')) {\n this.setAttribute('type', val);\n }\n }\n get rel() {\n // rel value has no default value\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel#:~:text=The%20rel%20attribute%20has%20no%20default%20value.\n return this.getAttribute('rel');\n }\n set rel(val) {\n // improve this\n if (\n [\n 'license',\n 'alternate',\n 'self',\n 'style',\n 'tile',\n 'image',\n 'features',\n 'zoomin',\n 'zoomout',\n 'legend',\n 'query',\n 'stylesheet'\n ].includes(val)\n ) {\n this.setAttribute('type', val);\n }\n }\n // get title() {\n // return this.getAttribute('title');\n // }\n // set title(val) {\n // if (val) {\n // this.setAttribute('title', val);\n // }\n // }\n get href() {\n if (this.hasAttribute('href')) {\n return new URL(this.getAttribute('href'), this.getBase()).href;\n } else if (this.hasAttribute('tref')) {\n return this.resolve();\n }\n }\n set href(val) {\n // improve this\n if (val) {\n this.setAttribute('href', val);\n }\n }\n get hreflang() {\n return this.getAttribute('hreflang');\n }\n set hreflang(val) {\n // improve this\n if (val) {\n this.setAttribute('hreflang', val);\n }\n }\n get tref() {\n if (!this.hasAttribute('tref')) {\n return M.BLANK_TT_TREF;\n }\n return this.getAttribute('tref');\n }\n set tref(val) {\n // improve this\n if (val) {\n this.setAttribute('tref', val);\n }\n }\n get media() {\n // return the content of media attribute as an object\n // maybe memoizing the object to avoid repeated formatting\n // the Util function may need to be renamed?\n return M._metaContentToObject(this.getAttribute('media'));\n }\n set media(val) {\n this.setAttribute('media', val);\n }\n get tms() {\n return this.hasAttribute('tms');\n }\n set tms(val) {\n // improve this\n if (val) {\n this.setAttribute('tms', '');\n }\n }\n get projection() {\n return this.getAttribute('projection');\n }\n set projection(val) {\n // improve this\n if (['OSMTILE', 'CBMTILE', 'WGS84', 'APSTILE'].includes(val)) {\n this.setAttribute('projection', val);\n }\n }\n get extent() {\n // calculate the bounds of content, return it.\n // _templateVars existence happens for both templated layers and query links\n return this._templateVars\n ? Object.assign(\n M._convertAndFormatPCRS(\n this.getBounds(),\n M[this.parentExtent.units],\n this.parentExtent.units\n ),\n { zoom: this.getZoomBounds() }\n )\n : null;\n }\n zoomTo() {\n let extent = this.extent;\n if (!extent) return;\n let map = this.getMapEl()._map,\n xmin = extent.topLeft.pcrs.horizontal,\n xmax = extent.bottomRight.pcrs.horizontal,\n ymin = extent.bottomRight.pcrs.vertical,\n ymax = extent.topLeft.pcrs.vertical,\n bounds = L.bounds(L.point(xmin, ymin), L.point(xmax, ymax)),\n center = map.options.crs.unproject(bounds.getCenter(true)),\n maxZoom = extent.zoom.maxZoom,\n minZoom = extent.zoom.minZoom;\n map.setView(center, M.getMaxZoom(bounds, map, minZoom, maxZoom), {\n animate: false\n });\n }\n getMapEl() {\n return this.getRootNode() instanceof ShadowRoot\n ? this.getRootNode().host.closest('mapml-viewer,map[is=web-map]')\n : this.closest('mapml-viewer,map[is=web-map]');\n }\n getLayerEl() {\n return this.getRootNode() instanceof ShadowRoot\n ? this.getRootNode().host\n : this.closest('layer-');\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n //['type','rel','href','hreflang','tref','tms','projection'];\n // fold to lowercase\n if (this.#hasConnected /* jshint ignore:line */) {\n switch (name) {\n case 'type':\n // rel = tile, features, etc. TBD when it is used\n // ttype = !t.hasAttribute('type')\n // ? 'image/*'\n // : t.getAttribute('type').toLowerCase(),\n\n if (oldValue !== newValue) {\n // default value image/*\n // handle side effects\n }\n break;\n case 'rel':\n // mandatory attribute, no default value\n if (oldValue !== newValue) {\n // handle side effects\n if (newValue === 'query') {\n }\n }\n break;\n // case 'title':\n // if (oldValue !== newValue) {\n // // handle side effects\n // }\n // break;\n case 'href':\n // rel = license, legend, stylesheet, self, style, self style, style self, zoomin, zoomout\n if (oldValue !== newValue) {\n // handle side effects\n }\n break;\n case 'hreflang':\n // rel = *all*\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#hreflang\n // idea is that we can have multiple map-links with different hreflang, and map-extent chooses a map-link that matches with user's lang. Not a priority. - create an use-case issue?\n if (oldValue !== newValue) {\n // handle side effects\n }\n break;\n case 'tref':\n // rel = tile, image, features, query\n if (oldValue !== newValue) {\n // create or reset the _templateVars property\n this._initTemplateVars();\n }\n break;\n case 'media':\n break;\n case 'tms':\n // rel = tile\n if (oldValue !== newValue) {\n // handle side effects\n }\n break;\n case 'projection':\n // rel = alternate\n if (oldValue !== newValue) {\n // handle side effects\n }\n break;\n }\n }\n }\n constructor() {\n // Always call super first in constructor\n super();\n }\n connectedCallback() {\n this.#hasConnected = true; /* jshint ignore:line */\n if (\n this.getLayerEl().hasAttribute('data-moving') ||\n (this.parentExtent && this.parentExtent.hasAttribute('data-moving'))\n )\n return;\n switch (this.rel.toLowerCase()) {\n // for some cases, require a dependency check\n case 'tile':\n case 'image':\n case 'features':\n case 'query':\n this._initTemplateVars();\n this._createTemplatedLink();\n break;\n case 'style':\n case 'self':\n case 'style self':\n case 'self style':\n this._createSelfOrStyleLink();\n break;\n case 'zoomin':\n case 'zoomout':\n // this._createZoominOrZoomoutLink();\n break;\n case 'legend':\n //this._createLegendLink();\n break;\n case 'stylesheet':\n this._createStylesheetLink();\n break;\n case 'alternate':\n this._createAlternateLink(); // add media attribute\n break;\n case 'license':\n // this._createLicenseLink();\n break;\n }\n // create the type of templated leaflet layer appropriate to the rel value\n // image/map/features = templated(Image/Feature), tile=templatedTile,\n // this._tempatedTileLayer = M.templatedTile(pane: this.extentElement._leafletLayer._container)\n // add to viewer._map dependant on map-extent.checked, layer-.checked\n // what else?\n }\n disconnectedCallback() {\n switch (this.rel.toLowerCase()) {\n case 'stylesheet':\n if (this._stylesheetHost) {\n this.link.remove();\n }\n break;\n default:\n break;\n }\n }\n _createAlternateLink(mapml) {\n if (this.href && this.projection) this._alternate = true;\n }\n _createStylesheetLink() {\n // if the parent element is a map-link, the stylesheet is a link that should\n // be loaded as part of a templated layer processing i.e. on moveend\n // and the generated that implements this should be located\n // in the parent ._templatedLayer.container root node if\n // the _templatedLayer is an instance of M.TemplatedTileLayer or M.TemplatedFeaturesLayer\n //\n // if the parent node (or the host of the shadow root parent node) is layer-, the link should be created in the _layer\n // container\n this._stylesheetHost =\n this.getRootNode() instanceof ShadowRoot\n ? this.getRootNode().host\n : this.parentElement;\n if (this._stylesheetHost === undefined) return;\n\n this.link = document.createElement('link');\n this.link.mapLink = this;\n this.link.setAttribute('href', new URL(this.href, this.getBase()).href);\n copyAttributes(this, this.link);\n\n if (this._stylesheetHost._layer) {\n this._stylesheetHost._layer.appendStyleLink(this);\n } else if (this._stylesheetHost._templatedLayer) {\n this._stylesheetHost._templatedLayer.appendStyleLink(this);\n } else if (this._stylesheetHost._extentLayer) {\n this._stylesheetHost._extentLayer.appendStyleLink(this);\n }\n\n function copyAttributes(source, target) {\n return Array.from(source.attributes).forEach((attribute) => {\n if (attribute.nodeName !== 'href')\n target.setAttribute(attribute.nodeName, attribute.nodeValue);\n });\n }\n }\n\n async _createTemplatedLink() {\n // conditions check\n // the tms and type attributes are optional, may need to be checked in future\n this.parentExtent =\n this.parentNode.nodeName.toUpperCase() === 'MAP-EXTENT'\n ? this.parentNode\n : this.parentNode.host;\n if (!this.tref || !this.parentExtent) return;\n try {\n await this.parentExtent.whenReady();\n await this._templateVars.inputsReady;\n } catch (error) {\n console.log('Error while creating templated link: ' + error);\n return;\n }\n this.mapEl = this.getMapEl();\n // create the layer type appropriate to the rel value\n this.zIndex = Array.from(\n this.parentExtent.querySelectorAll(\n 'map-link[rel=image],map-link[rel=tile],map-link[rel=features]'\n )\n ).indexOf(this);\n if (this.rel === 'tile') {\n this._templatedLayer = M.templatedTileLayer(this._templateVars, {\n zoomBounds: this.getZoomBounds(),\n extentBounds: this.getBounds(),\n crs: M[this.parentExtent.units],\n errorTileUrl:\n 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==',\n zIndex: this.zIndex,\n pane: this.parentExtent._extentLayer.getContainer(),\n linkEl: this\n }).addTo(this.parentExtent._extentLayer);\n } else if (this.rel === 'image') {\n this._templatedLayer = M.templatedImageLayer(this._templateVars, {\n zoomBounds: this.getZoomBounds(),\n extentBounds: this.getBounds(),\n zIndex: this.zIndex,\n pane: this.parentExtent._extentLayer.getContainer(),\n linkEl: this\n }).addTo(this.parentExtent._extentLayer);\n } else if (this.rel === 'features') {\n // map-feature retrieved by link will be stored in shadowRoot owned by link\n this.attachShadow({ mode: 'open' });\n this._templatedLayer = M.templatedFeaturesLayer(this._templateVars, {\n zoomBounds: this.getZoomBounds(),\n extentBounds: this.getBounds(),\n zIndex: this.zIndex,\n pane: this.parentExtent._extentLayer.getContainer(),\n linkEl: this\n }).addTo(this.parentExtent._extentLayer);\n } else if (this.rel === 'query') {\n this.attachShadow({ mode: 'open' });\n L.extend(this._templateVars, this._setupQueryVars(this._templateVars));\n L.extend(this._templateVars, { extentBounds: this.getBounds() });\n }\n }\n _setupQueryVars(template) {\n // process the inputs associated to template and create an object named\n // query with member properties as follows:\n // {width: 'widthvarname',\n // height: 'heightvarname',\n // left: 'leftvarname',\n // right: 'rightvarname',\n // top: 'topvarname',\n // bottom: 'bottomvarname'\n // i: 'ivarname'\n // j: 'jvarname'}\n // x: 'xvarname' x being the tcrs x axis\n // y: 'yvarname' y being the tcrs y axis\n // z: 'zvarname' zoom\n // title: link title\n\n var queryVarNames = { query: {} },\n inputs = template.values;\n\n for (var i = 0; i < template.values.length; i++) {\n var type = inputs[i].getAttribute('type'),\n units = inputs[i].getAttribute('units'),\n axis = inputs[i].getAttribute('axis'),\n name = inputs[i].getAttribute('name'),\n position = inputs[i].getAttribute('position'),\n rel = inputs[i].getAttribute('rel'),\n select = inputs[i].tagName.toLowerCase() === 'map-select';\n if (type === 'width') {\n queryVarNames.query.width = name;\n } else if (type === 'height') {\n queryVarNames.query.height = name;\n } else if (type === 'location') {\n switch (axis) {\n case 'x':\n case 'y':\n case 'column':\n case 'row':\n queryVarNames.query[axis] = name;\n break;\n case 'longitude':\n case 'easting':\n if (position) {\n if (position.match(/.*?-left/i)) {\n if (rel === 'pixel') {\n queryVarNames.query.pixelleft = name;\n } else if (rel === 'tile') {\n queryVarNames.query.tileleft = name;\n } else {\n queryVarNames.query.mapleft = name;\n }\n } else if (position.match(/.*?-right/i)) {\n if (rel === 'pixel') {\n queryVarNames.query.pixelright = name;\n } else if (rel === 'tile') {\n queryVarNames.query.tileright = name;\n } else {\n queryVarNames.query.mapright = name;\n }\n }\n } else {\n queryVarNames.query[axis] = name;\n }\n break;\n case 'latitude':\n case 'northing':\n if (position) {\n if (position.match(/top-.*?/i)) {\n if (rel === 'pixel') {\n queryVarNames.query.pixeltop = name;\n } else if (rel === 'tile') {\n queryVarNames.query.tiletop = name;\n } else {\n queryVarNames.query.maptop = name;\n }\n } else if (position.match(/bottom-.*?/i)) {\n if (rel === 'pixel') {\n queryVarNames.query.pixelbottom = name;\n } else if (rel === 'tile') {\n queryVarNames.query.tilebottom = name;\n } else {\n queryVarNames.query.mapbottom = name;\n }\n }\n } else {\n queryVarNames.query[axis] = name;\n }\n break;\n case 'i':\n if (units === 'tile') {\n queryVarNames.query.tilei = name;\n } else {\n queryVarNames.query.mapi = name;\n }\n break;\n case 'j':\n if (units === 'tile') {\n queryVarNames.query.tilej = name;\n } else {\n queryVarNames.query.mapj = name;\n }\n break;\n default:\n // unsuportted axis value\n }\n } else if (type === 'zoom') {\n //\n queryVarNames.query.zoom = name;\n } else if (select) {\n /*jshint -W104 */\n const parsedselect = inputs[i].htmlselect;\n queryVarNames.query[name] = function () {\n return parsedselect.value;\n };\n } else {\n /*jshint -W104 */\n const input = inputs[i];\n queryVarNames.query[name] = function () {\n return input.getAttribute('value');\n };\n }\n }\n return queryVarNames;\n }\n _initTemplateVars() {\n // set up the URL template and associated inputs (which yield variable values when processed)\n var varNamesRe = new RegExp('(?:{)(.*?)(?:})', 'g'),\n zoomInput = this.parentElement.querySelector('map-input[type=\"zoom\" i]'),\n includesZoom = false,\n linkedZoomInput;\n\n var template = this.tref;\n if (template === M.BLANK_TT_TREF) {\n for (let i of this.parentElement.querySelectorAll('map-input')) {\n template += `{${i.getAttribute('name')}}`;\n }\n }\n this.zoomInput = zoomInput;\n\n var v,\n vcount = template.match(varNamesRe) || [],\n inputs = [],\n inputsReady = [];\n while ((v = varNamesRe.exec(template)) !== null) {\n let varName = v[1],\n inp = this.parentElement.querySelector(\n 'map-input[name=' + varName + '],map-select[name=' + varName + ']'\n );\n if (inp) {\n // this \"associates\" the input to this map-link\n inputs.push(inp);\n inputsReady.push(inp.whenReady());\n\n // I think this means that regardless of whether the tref includes\n // a reference to the zoom input, it gets associated to the link\n // and used (to specify the native zoom bounds??) for the templated(Tile|Image|Features)Layer\n if (\n inp.hasAttribute('type') &&\n inp.getAttribute('type').toLowerCase() === 'zoom'\n ) {\n linkedZoomInput = inp;\n includesZoom = true;\n }\n // moved a block to map-select to transcribe the map-select into an\n // actual html select for inclusion in the layer control.\n\n // TODO: if this is an input@type=location\n // get the TCRS min,max attribute values at the identified zoom level\n // save this information as properties of the mapExtent,\n // perhaps as a bounds object so that it can be easily used\n // later by the layer control to determine when to enable\n // disable the layer for drawing.\n } else {\n console.log(\n 'input with name=' +\n varName +\n ' not found for template variable of same name'\n );\n }\n }\n if (template && vcount.length === inputs.length) {\n if (!includesZoom && zoomInput) {\n inputs.push(zoomInput);\n linkedZoomInput = zoomInput;\n }\n let step = zoomInput ? zoomInput.getAttribute('step') : 1;\n if (!step || step === '0' || isNaN(step)) step = 1;\n // template has a matching input for every variable reference {varref}\n this._templateVars = {\n template: decodeURI(new URL(template, this.getBase())),\n linkEl: this,\n rel: this.rel,\n type: this.type,\n values: inputs,\n inputsReady: Promise.allSettled(inputsReady),\n zoom: linkedZoomInput,\n projection: this.parentElement.units,\n tms: this.tms,\n step: step\n };\n }\n }\n getZoomBounds() {\n return this._getZoomBounds(this._templateVars.zoom);\n }\n /**\n * TODO: review getBounds for sanity, also getFallbackBounds, perhaps integrate\n * there is no other kind of bounds but native....\n * each rectangle must be established and valid and converted to PCRS coordinates...\n // \"native\" bounds = input type=location min max || map-extent/map-meta name=extent min,max || layer-/map-meta name=extent min,max || layer projection min/max\n */\n getBounds() {\n let template = this._templateVars;\n let inputs = template.values,\n projection = this.parentElement.units,\n boundsUnit = {};\n boundsUnit.name = M.FALLBACK_CS;\n let bounds = M[projection].options.crs.tilematrix.bounds(0),\n locInputs = false,\n numberOfAxes = 0,\n horizontalAxis = false,\n verticalAxis = false;\n for (let i = 0; i < inputs.length; i++) {\n if (inputs[i].getAttribute('type') === 'location') {\n if (!inputs[i].getAttribute('max') || !inputs[i].getAttribute('min'))\n continue;\n let max = +inputs[i].getAttribute('max'),\n min = +inputs[i].getAttribute('min');\n switch (inputs[i].getAttribute('axis').toLowerCase()) {\n case 'x':\n case 'longitude':\n case 'column':\n case 'easting':\n boundsUnit.name = M.axisToCS(\n inputs[i].getAttribute('axis').toLowerCase()\n );\n bounds.min.x = min;\n bounds.max.x = max;\n boundsUnit.horizontalAxis = inputs[i]\n .getAttribute('axis')\n .toLowerCase();\n break;\n case 'y':\n case 'latitude':\n case 'row':\n case 'northing':\n boundsUnit.name = M.axisToCS(\n inputs[i].getAttribute('axis').toLowerCase()\n );\n bounds.min.y = min;\n bounds.max.y = max;\n boundsUnit.verticalAxis = inputs[i]\n .getAttribute('axis')\n .toLowerCase();\n break;\n default:\n break;\n }\n }\n }\n if (\n boundsUnit.horizontalAxis &&\n boundsUnit.verticalAxis &&\n ((boundsUnit.horizontalAxis === 'x' && boundsUnit.verticalAxis === 'y') ||\n (boundsUnit.horizontalAxis === 'longitude' &&\n boundsUnit.verticalAxis === 'latitude') ||\n (boundsUnit.horizontalAxis === 'column' &&\n boundsUnit.verticalAxis === 'row') ||\n (boundsUnit.horizontalAxis === 'easting' &&\n boundsUnit.verticalAxis === 'northing'))\n ) {\n locInputs = true;\n }\n if (locInputs) {\n let zoomValue = this._templateVars.zoom?.hasAttribute('value')\n ? +this._templateVars.zoom.getAttribute('value')\n : 0;\n bounds = M.boundsToPCRSBounds(\n bounds,\n zoomValue,\n projection,\n boundsUnit.name\n );\n } else if (!locInputs) {\n bounds = this.getFallbackBounds(projection);\n }\n return bounds;\n }\n getFallbackBounds(projection) {\n let bounds;\n\n let zoom = 0;\n let metaExtent = this.parentElement.getMeta('extent');\n if (metaExtent) {\n let content = M._metaContentToObject(metaExtent.getAttribute('content')),\n cs;\n\n zoom = content.zoom || zoom;\n\n let metaKeys = Object.keys(content);\n for (let i = 0; i < metaKeys.length; i++) {\n if (!metaKeys[i].includes('zoom')) {\n cs = M.axisToCS(metaKeys[i].split('-')[2]);\n break;\n }\n }\n let axes = M.csToAxes(cs);\n bounds = M.boundsToPCRSBounds(\n L.bounds(\n L.point(\n +content[`top-left-${axes[0]}`],\n +content[`top-left-${axes[1]}`]\n ),\n L.point(\n +content[`bottom-right-${axes[0]}`],\n +content[`bottom-right-${axes[1]}`]\n )\n ),\n zoom,\n projection,\n cs\n );\n } else {\n let crs = M[projection];\n bounds = crs.options.crs.pcrs.bounds;\n }\n return bounds;\n }\n getBase() {\n let layer = this.getRootNode().host;\n //\n let relativeURL =\n this.getRootNode().querySelector('map-base') &&\n this.getRootNode() instanceof ShadowRoot\n ? this.getRootNode().querySelector('map-base').getAttribute('href')\n : /* local content? */ !(this.getRootNode() instanceof ShadowRoot)\n ? /* use the baseURI algorithm which takes into account any */\n this.getRootNode().querySelector('map-base')?.getAttribute('href') ||\n this.baseURI\n : /* else use the resolved value */ new URL(\n layer.src,\n layer.baseURI\n ).href;\n\n // when remote content, use layer.src as base else use baseURI of map-link\n let baseURL =\n this.getRootNode() instanceof ShadowRoot\n ? new URL(layer.src, layer.baseURI).href\n : this.baseURI;\n return new URL(relativeURL, baseURL).href;\n }\n /**\n * Return BOTH min/max(Display)Zoom AND min/maxNativeZoom which\n * are options that can be passed to L.GridLayer...\n * https://leafletjs.com/reference.html#gridlayer-minzoom\n *\n * @param {Object} zoomInput - is an element reference to a map-input[type=zoom]\n * @returns {Object} - returns {minZoom: n,maxZoom: n,minNativeZoom: n,maxNativeZoom: n}\n */\n _getZoomBounds(zoomInput) {\n // native variables should ONLY come from map-input min/max attributes\n // BUT they should fall back to map-meta or projection values for min/max (display) zoom\n // display zoom variables should be EQUAL to native unless specified differently\n // via map-meta name=zoom\n // in particular minNativeZoom being > minZoom can be problematic because\n // you fetch tiles at larger scales (i.e. many many small tiles) and render\n // them at smaller scale (i.e. little postage stamps), which can freez your\n // browser and bury a tile cache in requests, getting you banned/blocked\n //\n // minZoom = map-meta name=zoom min || input type=zoom min || projection minZoom\n // minNativeZoom = input type=zoom min || minZoom\n // maxZoom = map-meta name=zoom max || input type=zoom max || projection maxZoom\n // maxNativeZoom = input type=zoom max || maxZoom\n\n let zoomBounds = {};\n // search document from here up, using closest source of zoom bounds info\n let meta = this.parentElement.getMeta('zoom');\n let metaMin = meta\n ? +M._metaContentToObject(meta.getAttribute('content'))?.min\n : null;\n zoomBounds.minZoom =\n metaMin || (zoomInput ? +zoomInput.getAttribute('min') : 0);\n zoomBounds.minNativeZoom = zoomInput\n ? +zoomInput.getAttribute('min')\n : zoomBounds.minZoom;\n let metaMax = meta\n ? +M._metaContentToObject(meta.getAttribute('content'))?.max\n : null;\n zoomBounds.maxZoom =\n metaMax ||\n (zoomInput\n ? +zoomInput.getAttribute('max')\n : M[this.parentElement.units].options.resolutions.length - 1);\n zoomBounds.maxNativeZoom = zoomInput\n ? +zoomInput.getAttribute('max')\n : zoomBounds.maxZoom;\n\n return zoomBounds;\n }\n _validateDisabled() {\n let isVisible = false,\n map = this.getMapEl(),\n mapZoom = map.zoom,\n extent = map.extent,\n xmin = extent.topLeft.pcrs.horizontal,\n xmax = extent.bottomRight.pcrs.horizontal,\n ymin = extent.bottomRight.pcrs.vertical,\n ymax = extent.topLeft.pcrs.vertical,\n mapBounds = L.bounds(L.point(xmin, ymin), L.point(xmax, ymax));\n\n if (this._templatedLayer) {\n isVisible = this._templatedLayer.isVisible();\n } else if (this.rel === 'query') {\n const minZoom = this.extent.zoom.minZoom,\n maxZoom = this.extent.zoom.maxZoom,\n withinZoomBounds = (z) => {\n return minZoom <= z && z <= maxZoom;\n };\n\n if (this.getBounds().overlaps(mapBounds) && withinZoomBounds(mapZoom)) {\n isVisible = true;\n }\n }\n return isVisible;\n }\n _createSelfOrStyleLink() {\n let layerEl = this.getLayerEl();\n const changeStyle = function (e) {\n L.DomEvent.stop(e);\n layerEl.dispatchEvent(\n new CustomEvent('changestyle', {\n detail: {\n src: e.target.getAttribute('data-href'),\n preference: this.media['prefers-map-content']\n }\n })\n );\n };\n\n let styleOption = document.createElement('div'),\n styleOptionInput = styleOption.appendChild(\n document.createElement('input')\n );\n styleOptionInput.setAttribute('type', 'radio');\n styleOptionInput.setAttribute('id', 'rad-' + L.stamp(styleOptionInput));\n styleOptionInput.setAttribute(\n 'name',\n // grouping radio buttons based on parent layer's style \n 'styles-' + L.stamp(styleOption)\n );\n styleOptionInput.setAttribute('value', this.getAttribute('title'));\n styleOptionInput.setAttribute(\n 'data-href',\n new URL(this.href, this.getBase()).href\n );\n var styleOptionLabel = styleOption.appendChild(\n document.createElement('label')\n );\n styleOptionLabel.setAttribute('for', 'rad-' + L.stamp(styleOptionInput));\n styleOptionLabel.innerText = this.title;\n if (this.rel === 'style self' || this.rel === 'self style') {\n styleOptionInput.checked = true;\n }\n this._styleOption = styleOption;\n styleOptionInput.addEventListener('click', changeStyle.bind(this));\n }\n getLayerControlOption() {\n return this._styleOption;\n }\n\n // Resolve the templated URL with info from the sibling map-input's\n resolve() {\n if (this.tref) {\n let obj = {};\n const inputs = this.parentElement.querySelectorAll('map-input');\n if (this.rel === 'image') {\n // image/map\n for (let i = 0; i < inputs.length; i++) {\n const inp = inputs[i];\n obj[inp.name] = inp.value;\n }\n console.log(obj); // DEBUGGING\n return L.Util.template(this.tref, obj);\n } else if (this.rel === 'tile') {\n // TODO. Need to get tile coords from moveend\n // should be done/called from the TemplatedTilelayer.js file\n return obj;\n } else if (this.rel === 'query') {\n // TODO. Need to get the click coords from click event\n // should be done/called from the templatedlayer.js file\n } else if (this.rel === 'features') {\n // TODO.\n }\n }\n }\n whenReady() {\n return new Promise((resolve, reject) => {\n let interval, failureTimer, ready;\n switch (this.rel.toLowerCase()) {\n // for some cases, require a dependency check\n case 'tile':\n case 'image':\n case 'features':\n ready = '_templatedLayer';\n break;\n case 'style':\n case 'self':\n case 'style self':\n case 'self style':\n ready = '_styleOption';\n break;\n case 'query':\n ready = 'shadowRoot';\n break;\n case 'alternate':\n ready = '_alternate';\n break;\n case 'zoomin':\n case 'zoomout':\n case 'legend':\n case 'stylesheet':\n case 'license':\n resolve();\n break;\n default:\n resolve();\n break;\n }\n if (this[ready]) {\n resolve();\n }\n interval = setInterval(testForLinkReady, 300, this);\n failureTimer = setTimeout(linkNotDefined, 10000);\n function testForLinkReady(linkElement) {\n if (linkElement[ready]) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n resolve();\n } else if (!linkElement.isConnected) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('map-link was disconnected while waiting to be ready');\n }\n }\n function linkNotDefined() {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('Timeout reached waiting for link to be ready');\n }\n });\n }\n}\n"],"names":["MapLink","HTMLElement","observedAttributes","#hasConnected","type","this","getAttribute","val","startsWith","setAttribute","rel","includes","href","hasAttribute","URL","getBase","resolve","hreflang","tref","M","BLANK_TT_TREF","media","_metaContentToObject","tms","projection","extent","_templateVars","Object","assign","_convertAndFormatPCRS","getBounds","parentExtent","units","zoom","getZoomBounds","zoomTo","let","map","getMapEl","_map","xmin","topLeft","pcrs","horizontal","xmax","bottomRight","ymin","vertical","ymax","bounds","L","point","center","options","crs","unproject","getCenter","maxZoom","minZoom","setView","getMaxZoom","animate","getRootNode","ShadowRoot","host","closest","getLayerEl","attributeChangedCallback","name","oldValue","newValue","_initTemplateVars","constructor","super","connectedCallback","toLowerCase","_createTemplatedLink","_createSelfOrStyleLink","_createStylesheetLink","_createAlternateLink","disconnectedCallback","_stylesheetHost","link","remove","mapml","_alternate","source","target","parentElement","undefined","document","createElement","mapLink","Array","from","attributes","forEach","attribute","nodeName","nodeValue","_layer","appendStyleLink","_templatedLayer","_extentLayer","parentNode","toUpperCase","whenReady","inputsReady","error","console","log","mapEl","zIndex","querySelectorAll","indexOf","templatedTileLayer","zoomBounds","extentBounds","errorTileUrl","pane","getContainer","linkEl","addTo","templatedImageLayer","attachShadow","mode","templatedFeaturesLayer","extend","_setupQueryVars","template","queryVarNames","query","inputs","values","i","length","axis","position","select","tagName","width","height","match","pixelleft","tileleft","mapleft","pixelright","tileright","mapright","pixeltop","tiletop","maptop","pixelbottom","tilebottom","mapbottom","tilei","mapi","tilej","mapj","parsedselect","htmlselect","value","input","linkedZoomInput","varNamesRe","RegExp","zoomInput","querySelector","includesZoom","v","vcount","exec","varName","inp","push","step","isNaN","decodeURI","Promise","allSettled","_getZoomBounds","zoomValue","boundsUnit","FALLBACK_CS","tilematrix","locInputs","max","min","axisToCS","x","horizontalAxis","y","verticalAxis","boundsToPCRSBounds","getFallbackBounds","metaExtent","getMeta","content","cs","metaKeys","keys","split","axes","csToAxes","layer","relativeURL","src","baseURI","baseURL","meta","metaMin","minNativeZoom","metaMax","resolutions","maxNativeZoom","_validateDisabled","isVisible","mapZoom","mapBounds","overlaps","z","layerEl","styleOption","styleOptionInput","appendChild","stamp","styleOptionLabel","innerText","title","checked","_styleOption","addEventListener","e","DomEvent","stop","dispatchEvent","CustomEvent","detail","preference","bind","getLayerControlOption","obj","Util","reject","interval","failureTimer","ready","setInterval","linkElement","clearInterval","clearTimeout","isConnected","setTimeout"],"mappings":";;MAEaA,gBAAgBC,YAC3BC,gCACE,MAAO,CACL,OACA,MAEA,QACA,OACA,WACA,OACA,MACA,cAIJC,cAEAC,WACE,OAAOC,KAAKC,aAAa,SAAW,UAEtCF,SAASG,GAEK,eAARA,IAAwBA,EAAIC,WAAW,WACzCH,KAAKI,aAAa,OAAQF,GAG9BG,UAGE,OAAOL,KAAKC,aAAa,OAE3BI,QAAQH,GAGJ,CACE,UACA,YACA,OACA,QACA,OACA,QACA,WACA,SACA,UACA,SACA,QACA,cACAI,SAASJ,IAEXF,KAAKI,aAAa,OAAQF,GAW9BK,WACE,OAAIP,KAAKQ,aAAa,QACb,IAAIC,IAAIT,KAAKC,aAAa,QAASD,KAAKU,WAAWH,K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b5O,KAAKK,IAGd,OAAOuO,EACe,UAAb5O,KAAKK,KAGLL,KAAKK,KAKpBgG,YACE,OAAO,IAAIwE,QAAQ,CAAClK,EAASmO,KAC3B/M,IAAIgN,EAAUC,EAAcC,EAC5B,OAAQjP,KAAKK,IAAIiE,eAEf,IAAK,OACL,IAAK,QACL,IAAK,WACH2K,EAAQ,kBACR,MACF,IAAK,QACL,IAAK,OACL,IAAK,aACL,IAAK,aACHA,EAAQ,eACR,MACF,IAAK,QACHA,EAAQ,aACR,MACF,IAAK,YACHA,EAAQ,aACR,MAQF,QACEtO,IAGAX,KAAKiP,IACPtO,IAEFoO,EAAWG,YAEX,SAA0BC,GACpBA,EAAYF,IACdG,cAAcL,GACdM,aAAaL,GACbrO,KACUwO,EAAYG,cACtBF,cAAcL,GACdM,aAAaL,GACbF,EAAO,yDAV8B,IAAK9O,MAC9CgP,EAAeO,WAYf,WACEH,cAAcL,GACdM,aAAaL,GACbF,EAAO,iDAfiC,eAp5BnCnP"} \ No newline at end of file +{"version":3,"file":"map-link.js","sources":["../src/map-link.js"],"sourcesContent":["/* global M */\n\nexport class MapLink extends HTMLElement {\n static get observedAttributes() {\n return [\n 'type',\n 'rel',\n // 'title',\n 'media',\n 'href',\n 'hreflang',\n 'tref',\n 'tms',\n 'projection'\n ];\n }\n /* jshint ignore:start */\n #hasConnected;\n /* jshint ignore:end */\n get type() {\n return this.getAttribute('type') || 'image/*';\n }\n set type(val) {\n // improve this\n if (val === 'text/mapml' || val.startsWith('image/')) {\n this.setAttribute('type', val);\n }\n }\n get rel() {\n // rel value has no default value\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel#:~:text=The%20rel%20attribute%20has%20no%20default%20value.\n return this.getAttribute('rel');\n }\n set rel(val) {\n // improve this\n if (\n [\n 'license',\n 'alternate',\n 'self',\n 'style',\n 'tile',\n 'image',\n 'features',\n 'zoomin',\n 'zoomout',\n 'legend',\n 'query',\n 'stylesheet'\n ].includes(val)\n ) {\n this.setAttribute('type', val);\n }\n }\n // get title() {\n // return this.getAttribute('title');\n // }\n // set title(val) {\n // if (val) {\n // this.setAttribute('title', val);\n // }\n // }\n get href() {\n if (this.hasAttribute('href')) {\n return new URL(this.getAttribute('href'), this.getBase()).href;\n } else if (this.hasAttribute('tref')) {\n return this.resolve();\n }\n }\n set href(val) {\n // improve this\n if (val) {\n this.setAttribute('href', val);\n }\n }\n get hreflang() {\n return this.getAttribute('hreflang');\n }\n set hreflang(val) {\n // improve this\n if (val) {\n this.setAttribute('hreflang', val);\n }\n }\n get tref() {\n if (!this.hasAttribute('tref')) {\n return M.BLANK_TT_TREF;\n }\n return this.getAttribute('tref');\n }\n set tref(val) {\n // improve this\n if (val) {\n this.setAttribute('tref', val);\n }\n }\n get media() {\n // return the content of media attribute as an object\n // maybe memoizing the object to avoid repeated formatting\n // the Util function may need to be renamed?\n return M._metaContentToObject(this.getAttribute('media'));\n }\n set media(val) {\n this.setAttribute('media', val);\n }\n get tms() {\n return this.hasAttribute('tms');\n }\n set tms(val) {\n // improve this\n if (val) {\n this.setAttribute('tms', '');\n }\n }\n get projection() {\n return this.getAttribute('projection');\n }\n set projection(val) {\n // improve this\n if (['OSMTILE', 'CBMTILE', 'WGS84', 'APSTILE'].includes(val)) {\n this.setAttribute('projection', val);\n }\n }\n get extent() {\n // calculate the bounds of content, return it.\n // _templateVars existence happens for both templated layers and query links\n return this._templateVars\n ? Object.assign(\n M._convertAndFormatPCRS(\n this.getBounds(),\n M[this.parentExtent.units],\n this.parentExtent.units\n ),\n { zoom: this.getZoomBounds() }\n )\n : null;\n }\n zoomTo() {\n let extent = this.extent;\n if (!extent) return;\n let map = this.getMapEl()._map,\n xmin = extent.topLeft.pcrs.horizontal,\n xmax = extent.bottomRight.pcrs.horizontal,\n ymin = extent.bottomRight.pcrs.vertical,\n ymax = extent.topLeft.pcrs.vertical,\n bounds = L.bounds(L.point(xmin, ymin), L.point(xmax, ymax)),\n center = map.options.crs.unproject(bounds.getCenter(true)),\n maxZoom = extent.zoom.maxZoom,\n minZoom = extent.zoom.minZoom;\n map.setView(center, M.getMaxZoom(bounds, map, minZoom, maxZoom), {\n animate: false\n });\n }\n getMapEl() {\n return M.getClosest(this, 'mapml-viewer,map[is=web-map]');\n }\n getLayerEl() {\n return M.getClosest(this, 'layer-');\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n //['type','rel','href','hreflang','tref','tms','projection'];\n // fold to lowercase\n if (this.#hasConnected /* jshint ignore:line */) {\n switch (name) {\n case 'type':\n // rel = tile, features, etc. TBD when it is used\n // ttype = !t.hasAttribute('type')\n // ? 'image/*'\n // : t.getAttribute('type').toLowerCase(),\n\n if (oldValue !== newValue) {\n // default value image/*\n // handle side effects\n }\n break;\n case 'rel':\n // mandatory attribute, no default value\n if (oldValue !== newValue) {\n // handle side effects\n if (newValue === 'query') {\n }\n }\n break;\n // case 'title':\n // if (oldValue !== newValue) {\n // // handle side effects\n // }\n // break;\n case 'href':\n // rel = license, legend, stylesheet, self, style, self style, style self, zoomin, zoomout\n if (oldValue !== newValue) {\n // handle side effects\n }\n break;\n case 'hreflang':\n // rel = *all*\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#hreflang\n // idea is that we can have multiple map-links with different hreflang, and map-extent chooses a map-link that matches with user's lang. Not a priority. - create an use-case issue?\n if (oldValue !== newValue) {\n // handle side effects\n }\n break;\n case 'tref':\n // rel = tile, image, features, query\n if (oldValue !== newValue) {\n // create or reset the _templateVars property\n this._initTemplateVars();\n }\n break;\n case 'media':\n break;\n case 'tms':\n // rel = tile\n if (oldValue !== newValue) {\n // handle side effects\n }\n break;\n case 'projection':\n // rel = alternate\n if (oldValue !== newValue) {\n // handle side effects\n }\n break;\n }\n }\n }\n constructor() {\n // Always call super first in constructor\n super();\n }\n connectedCallback() {\n this.#hasConnected = true; /* jshint ignore:line */\n if (\n this.getLayerEl().hasAttribute('data-moving') ||\n (this.parentExtent && this.parentExtent.hasAttribute('data-moving'))\n )\n return;\n switch (this.rel.toLowerCase()) {\n // for some cases, require a dependency check\n case 'tile':\n case 'image':\n case 'features':\n case 'query':\n this._initTemplateVars();\n this._createTemplatedLink();\n break;\n case 'style':\n case 'self':\n case 'style self':\n case 'self style':\n this._createSelfOrStyleLink();\n break;\n case 'zoomin':\n case 'zoomout':\n // this._createZoominOrZoomoutLink();\n break;\n case 'legend':\n //this._createLegendLink();\n break;\n case 'stylesheet':\n this._createStylesheetLink();\n break;\n case 'alternate':\n this._createAlternateLink(); // add media attribute\n break;\n case 'license':\n // this._createLicenseLink();\n break;\n }\n // create the type of templated leaflet layer appropriate to the rel value\n // image/map/features = templated(Image/Feature), tile=templatedTile,\n // this._tempatedTileLayer = M.templatedTile(pane: this.extentElement._leafletLayer._container)\n // add to viewer._map dependant on map-extent.checked, layer-.checked\n // what else?\n }\n disconnectedCallback() {\n switch (this.rel.toLowerCase()) {\n case 'stylesheet':\n if (this._stylesheetHost) {\n this.link.remove();\n }\n break;\n default:\n break;\n }\n }\n _createAlternateLink(mapml) {\n if (this.href && this.projection) this._alternate = true;\n }\n _createStylesheetLink() {\n // if the parent element is a map-link, the stylesheet is a link that should\n // be loaded as part of a templated layer processing i.e. on moveend\n // and the generated that implements this should be located\n // in the parent ._templatedLayer.container root node if\n // the _templatedLayer is an instance of M.TemplatedTileLayer or M.TemplatedFeaturesLayer\n //\n // if the parent node (or the host of the shadow root parent node) is layer-, the link should be created in the _layer\n // container\n this._stylesheetHost =\n this.getRootNode() instanceof ShadowRoot\n ? this.getRootNode().host\n : this.parentElement;\n if (this._stylesheetHost === undefined) return;\n\n this.link = document.createElement('link');\n this.link.mapLink = this;\n this.link.setAttribute('href', new URL(this.href, this.getBase()).href);\n copyAttributes(this, this.link);\n\n if (this._stylesheetHost._layer) {\n this._stylesheetHost._layer.appendStyleLink(this);\n } else if (this._stylesheetHost._templatedLayer) {\n this._stylesheetHost._templatedLayer.appendStyleLink(this);\n } else if (this._stylesheetHost._extentLayer) {\n this._stylesheetHost._extentLayer.appendStyleLink(this);\n }\n\n function copyAttributes(source, target) {\n return Array.from(source.attributes).forEach((attribute) => {\n if (attribute.nodeName !== 'href')\n target.setAttribute(attribute.nodeName, attribute.nodeValue);\n });\n }\n }\n\n async _createTemplatedLink() {\n // conditions check\n // the tms and type attributes are optional, may need to be checked in future\n this.parentExtent =\n this.parentNode.nodeName.toUpperCase() === 'MAP-EXTENT'\n ? this.parentNode\n : this.parentNode.host;\n if (!this.tref || !this.parentExtent) return;\n try {\n await this.parentExtent.whenReady();\n await this._templateVars.inputsReady;\n } catch (error) {\n console.log('Error while creating templated link: ' + error);\n return;\n }\n this.mapEl = this.getMapEl();\n // create the layer type appropriate to the rel value\n this.zIndex = Array.from(\n this.parentExtent.querySelectorAll(\n 'map-link[rel=image],map-link[rel=tile],map-link[rel=features]'\n )\n ).indexOf(this);\n if (this.rel === 'tile') {\n this._templatedLayer = M.templatedTileLayer(this._templateVars, {\n zoomBounds: this.getZoomBounds(),\n extentBounds: this.getBounds(),\n crs: M[this.parentExtent.units],\n errorTileUrl:\n 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==',\n zIndex: this.zIndex,\n pane: this.parentExtent._extentLayer.getContainer(),\n linkEl: this\n }).addTo(this.parentExtent._extentLayer);\n } else if (this.rel === 'image') {\n this._templatedLayer = M.templatedImageLayer(this._templateVars, {\n zoomBounds: this.getZoomBounds(),\n extentBounds: this.getBounds(),\n zIndex: this.zIndex,\n pane: this.parentExtent._extentLayer.getContainer(),\n linkEl: this\n }).addTo(this.parentExtent._extentLayer);\n } else if (this.rel === 'features') {\n // map-feature retrieved by link will be stored in shadowRoot owned by link\n this.attachShadow({ mode: 'open' });\n this._templatedLayer = M.templatedFeaturesLayer(this._templateVars, {\n zoomBounds: this.getZoomBounds(),\n extentBounds: this.getBounds(),\n zIndex: this.zIndex,\n pane: this.parentExtent._extentLayer.getContainer(),\n linkEl: this\n }).addTo(this.parentExtent._extentLayer);\n } else if (this.rel === 'query') {\n this.attachShadow({ mode: 'open' });\n L.extend(this._templateVars, this._setupQueryVars(this._templateVars));\n L.extend(this._templateVars, { extentBounds: this.getBounds() });\n }\n }\n _setupQueryVars(template) {\n // process the inputs associated to template and create an object named\n // query with member properties as follows:\n // {width: 'widthvarname',\n // height: 'heightvarname',\n // left: 'leftvarname',\n // right: 'rightvarname',\n // top: 'topvarname',\n // bottom: 'bottomvarname'\n // i: 'ivarname'\n // j: 'jvarname'}\n // x: 'xvarname' x being the tcrs x axis\n // y: 'yvarname' y being the tcrs y axis\n // z: 'zvarname' zoom\n // title: link title\n\n var queryVarNames = { query: {} },\n inputs = template.values;\n\n for (var i = 0; i < template.values.length; i++) {\n var type = inputs[i].getAttribute('type'),\n units = inputs[i].getAttribute('units'),\n axis = inputs[i].getAttribute('axis'),\n name = inputs[i].getAttribute('name'),\n position = inputs[i].getAttribute('position'),\n rel = inputs[i].getAttribute('rel'),\n select = inputs[i].tagName.toLowerCase() === 'map-select';\n if (type === 'width') {\n queryVarNames.query.width = name;\n } else if (type === 'height') {\n queryVarNames.query.height = name;\n } else if (type === 'location') {\n switch (axis) {\n case 'x':\n case 'y':\n case 'column':\n case 'row':\n queryVarNames.query[axis] = name;\n break;\n case 'longitude':\n case 'easting':\n if (position) {\n if (position.match(/.*?-left/i)) {\n if (rel === 'pixel') {\n queryVarNames.query.pixelleft = name;\n } else if (rel === 'tile') {\n queryVarNames.query.tileleft = name;\n } else {\n queryVarNames.query.mapleft = name;\n }\n } else if (position.match(/.*?-right/i)) {\n if (rel === 'pixel') {\n queryVarNames.query.pixelright = name;\n } else if (rel === 'tile') {\n queryVarNames.query.tileright = name;\n } else {\n queryVarNames.query.mapright = name;\n }\n }\n } else {\n queryVarNames.query[axis] = name;\n }\n break;\n case 'latitude':\n case 'northing':\n if (position) {\n if (position.match(/top-.*?/i)) {\n if (rel === 'pixel') {\n queryVarNames.query.pixeltop = name;\n } else if (rel === 'tile') {\n queryVarNames.query.tiletop = name;\n } else {\n queryVarNames.query.maptop = name;\n }\n } else if (position.match(/bottom-.*?/i)) {\n if (rel === 'pixel') {\n queryVarNames.query.pixelbottom = name;\n } else if (rel === 'tile') {\n queryVarNames.query.tilebottom = name;\n } else {\n queryVarNames.query.mapbottom = name;\n }\n }\n } else {\n queryVarNames.query[axis] = name;\n }\n break;\n case 'i':\n if (units === 'tile') {\n queryVarNames.query.tilei = name;\n } else {\n queryVarNames.query.mapi = name;\n }\n break;\n case 'j':\n if (units === 'tile') {\n queryVarNames.query.tilej = name;\n } else {\n queryVarNames.query.mapj = name;\n }\n break;\n default:\n // unsuportted axis value\n }\n } else if (type === 'zoom') {\n //\n queryVarNames.query.zoom = name;\n } else if (select) {\n /*jshint -W104 */\n const parsedselect = inputs[i].htmlselect;\n queryVarNames.query[name] = function () {\n return parsedselect.value;\n };\n } else {\n /*jshint -W104 */\n const input = inputs[i];\n queryVarNames.query[name] = function () {\n return input.getAttribute('value');\n };\n }\n }\n return queryVarNames;\n }\n _initTemplateVars() {\n // set up the URL template and associated inputs (which yield variable values when processed)\n var varNamesRe = new RegExp('(?:{)(.*?)(?:})', 'g'),\n zoomInput = this.parentElement.querySelector('map-input[type=\"zoom\" i]'),\n includesZoom = false,\n linkedZoomInput;\n\n var template = this.tref;\n if (template === M.BLANK_TT_TREF) {\n for (let i of this.parentElement.querySelectorAll('map-input')) {\n template += `{${i.getAttribute('name')}}`;\n }\n }\n this.zoomInput = zoomInput;\n\n var v,\n vcount = template.match(varNamesRe) || [],\n inputs = [],\n inputsReady = [];\n while ((v = varNamesRe.exec(template)) !== null) {\n let varName = v[1],\n inp = this.parentElement.querySelector(\n 'map-input[name=' + varName + '],map-select[name=' + varName + ']'\n );\n if (inp) {\n // this \"associates\" the input to this map-link\n inputs.push(inp);\n inputsReady.push(inp.whenReady());\n\n // I think this means that regardless of whether the tref includes\n // a reference to the zoom input, it gets associated to the link\n // and used (to specify the native zoom bounds??) for the templated(Tile|Image|Features)Layer\n if (\n inp.hasAttribute('type') &&\n inp.getAttribute('type').toLowerCase() === 'zoom'\n ) {\n linkedZoomInput = inp;\n includesZoom = true;\n }\n // moved a block to map-select to transcribe the map-select into an\n // actual html select for inclusion in the layer control.\n\n // TODO: if this is an input@type=location\n // get the TCRS min,max attribute values at the identified zoom level\n // save this information as properties of the mapExtent,\n // perhaps as a bounds object so that it can be easily used\n // later by the layer control to determine when to enable\n // disable the layer for drawing.\n } else {\n console.log(\n 'input with name=' +\n varName +\n ' not found for template variable of same name'\n );\n }\n }\n if (template && vcount.length === inputs.length) {\n if (!includesZoom && zoomInput) {\n inputs.push(zoomInput);\n linkedZoomInput = zoomInput;\n }\n let step = zoomInput ? zoomInput.getAttribute('step') : 1;\n if (!step || step === '0' || isNaN(step)) step = 1;\n // template has a matching input for every variable reference {varref}\n this._templateVars = {\n template: decodeURI(new URL(template, this.getBase())),\n linkEl: this,\n rel: this.rel,\n type: this.type,\n values: inputs,\n inputsReady: Promise.allSettled(inputsReady),\n zoom: linkedZoomInput,\n projection: this.parentElement.units,\n tms: this.tms,\n step: step\n };\n }\n }\n getZoomBounds() {\n return this._getZoomBounds(this._templateVars.zoom);\n }\n /**\n * TODO: review getBounds for sanity, also getFallbackBounds, perhaps integrate\n * there is no other kind of bounds but native....\n * each rectangle must be established and valid and converted to PCRS coordinates...\n // \"native\" bounds = input type=location min max || map-extent/map-meta name=extent min,max || layer-/map-meta name=extent min,max || layer projection min/max\n */\n getBounds() {\n let template = this._templateVars;\n let inputs = template.values,\n projection = this.parentElement.units,\n boundsUnit = {};\n boundsUnit.name = M.FALLBACK_CS;\n let bounds = M[projection].options.crs.tilematrix.bounds(0),\n locInputs = false,\n numberOfAxes = 0,\n horizontalAxis = false,\n verticalAxis = false;\n for (let i = 0; i < inputs.length; i++) {\n if (inputs[i].getAttribute('type') === 'location') {\n if (!inputs[i].getAttribute('max') || !inputs[i].getAttribute('min'))\n continue;\n let max = +inputs[i].getAttribute('max'),\n min = +inputs[i].getAttribute('min');\n switch (inputs[i].getAttribute('axis').toLowerCase()) {\n case 'x':\n case 'longitude':\n case 'column':\n case 'easting':\n boundsUnit.name = M.axisToCS(\n inputs[i].getAttribute('axis').toLowerCase()\n );\n bounds.min.x = min;\n bounds.max.x = max;\n boundsUnit.horizontalAxis = inputs[i]\n .getAttribute('axis')\n .toLowerCase();\n break;\n case 'y':\n case 'latitude':\n case 'row':\n case 'northing':\n boundsUnit.name = M.axisToCS(\n inputs[i].getAttribute('axis').toLowerCase()\n );\n bounds.min.y = min;\n bounds.max.y = max;\n boundsUnit.verticalAxis = inputs[i]\n .getAttribute('axis')\n .toLowerCase();\n break;\n default:\n break;\n }\n }\n }\n if (\n boundsUnit.horizontalAxis &&\n boundsUnit.verticalAxis &&\n ((boundsUnit.horizontalAxis === 'x' && boundsUnit.verticalAxis === 'y') ||\n (boundsUnit.horizontalAxis === 'longitude' &&\n boundsUnit.verticalAxis === 'latitude') ||\n (boundsUnit.horizontalAxis === 'column' &&\n boundsUnit.verticalAxis === 'row') ||\n (boundsUnit.horizontalAxis === 'easting' &&\n boundsUnit.verticalAxis === 'northing'))\n ) {\n locInputs = true;\n }\n if (locInputs) {\n let zoomValue = this._templateVars.zoom?.hasAttribute('value')\n ? +this._templateVars.zoom.getAttribute('value')\n : 0;\n bounds = M.boundsToPCRSBounds(\n bounds,\n zoomValue,\n projection,\n boundsUnit.name\n );\n } else if (!locInputs) {\n bounds = this.getFallbackBounds(projection);\n }\n return bounds;\n }\n getFallbackBounds(projection) {\n let bounds;\n\n let zoom = 0;\n let metaExtent = this.parentElement.getMeta('extent');\n if (metaExtent) {\n let content = M._metaContentToObject(metaExtent.getAttribute('content')),\n cs;\n\n zoom = content.zoom || zoom;\n\n let metaKeys = Object.keys(content);\n for (let i = 0; i < metaKeys.length; i++) {\n if (!metaKeys[i].includes('zoom')) {\n cs = M.axisToCS(metaKeys[i].split('-')[2]);\n break;\n }\n }\n let axes = M.csToAxes(cs);\n bounds = M.boundsToPCRSBounds(\n L.bounds(\n L.point(\n +content[`top-left-${axes[0]}`],\n +content[`top-left-${axes[1]}`]\n ),\n L.point(\n +content[`bottom-right-${axes[0]}`],\n +content[`bottom-right-${axes[1]}`]\n )\n ),\n zoom,\n projection,\n cs\n );\n } else {\n let crs = M[projection];\n bounds = crs.options.crs.pcrs.bounds;\n }\n return bounds;\n }\n getBase() {\n let layer = this.getRootNode().host;\n //\n let relativeURL =\n this.getRootNode().querySelector('map-base') &&\n this.getRootNode() instanceof ShadowRoot\n ? this.getRootNode().querySelector('map-base').getAttribute('href')\n : /* local content? */ !(this.getRootNode() instanceof ShadowRoot)\n ? /* use the baseURI algorithm which takes into account any */\n this.getRootNode().querySelector('map-base')?.getAttribute('href') ||\n this.baseURI\n : /* else use the resolved value */ new URL(\n layer.src,\n layer.baseURI\n ).href;\n\n // when remote content, use layer.src as base else use baseURI of map-link\n let baseURL =\n this.getRootNode() instanceof ShadowRoot\n ? new URL(layer.src, layer.baseURI).href\n : this.baseURI;\n return new URL(relativeURL, baseURL).href;\n }\n /**\n * Return BOTH min/max(Display)Zoom AND min/maxNativeZoom which\n * are options that can be passed to L.GridLayer...\n * https://leafletjs.com/reference.html#gridlayer-minzoom\n *\n * @param {Object} zoomInput - is an element reference to a map-input[type=zoom]\n * @returns {Object} - returns {minZoom: n,maxZoom: n,minNativeZoom: n,maxNativeZoom: n}\n */\n _getZoomBounds(zoomInput) {\n // native variables should ONLY come from map-input min/max attributes\n // BUT they should fall back to map-meta or projection values for min/max (display) zoom\n // display zoom variables should be EQUAL to native unless specified differently\n // via map-meta name=zoom\n // in particular minNativeZoom being > minZoom can be problematic because\n // you fetch tiles at larger scales (i.e. many many small tiles) and render\n // them at smaller scale (i.e. little postage stamps), which can freez your\n // browser and bury a tile cache in requests, getting you banned/blocked\n //\n // minZoom = map-meta name=zoom min || input type=zoom min || projection minZoom\n // minNativeZoom = input type=zoom min || minZoom\n // maxZoom = map-meta name=zoom max || input type=zoom max || projection maxZoom\n // maxNativeZoom = input type=zoom max || maxZoom\n\n let zoomBounds = {};\n // search document from here up, using closest source of zoom bounds info\n let meta = this.parentElement.getMeta('zoom');\n let metaMin = meta\n ? +M._metaContentToObject(meta.getAttribute('content'))?.min\n : null;\n zoomBounds.minZoom =\n metaMin || (zoomInput ? +zoomInput.getAttribute('min') : 0);\n zoomBounds.minNativeZoom = zoomInput\n ? +zoomInput.getAttribute('min')\n : zoomBounds.minZoom;\n let metaMax = meta\n ? +M._metaContentToObject(meta.getAttribute('content'))?.max\n : null;\n zoomBounds.maxZoom =\n metaMax ||\n (zoomInput\n ? +zoomInput.getAttribute('max')\n : M[this.parentElement.units].options.resolutions.length - 1);\n zoomBounds.maxNativeZoom = zoomInput\n ? +zoomInput.getAttribute('max')\n : zoomBounds.maxZoom;\n\n return zoomBounds;\n }\n _validateDisabled() {\n let isVisible = false,\n map = this.getMapEl(),\n mapZoom = map.zoom,\n extent = map.extent,\n xmin = extent.topLeft.pcrs.horizontal,\n xmax = extent.bottomRight.pcrs.horizontal,\n ymin = extent.bottomRight.pcrs.vertical,\n ymax = extent.topLeft.pcrs.vertical,\n mapBounds = L.bounds(L.point(xmin, ymin), L.point(xmax, ymax));\n\n if (this._templatedLayer) {\n isVisible = this._templatedLayer.isVisible();\n } else if (this.rel === 'query') {\n const minZoom = this.extent.zoom.minZoom,\n maxZoom = this.extent.zoom.maxZoom,\n withinZoomBounds = (z) => {\n return minZoom <= z && z <= maxZoom;\n };\n\n if (this.getBounds().overlaps(mapBounds) && withinZoomBounds(mapZoom)) {\n isVisible = true;\n }\n }\n return isVisible;\n }\n _createSelfOrStyleLink() {\n let layerEl = this.getLayerEl();\n const changeStyle = function (e) {\n L.DomEvent.stop(e);\n layerEl.dispatchEvent(\n new CustomEvent('changestyle', {\n detail: {\n src: e.target.getAttribute('data-href'),\n preference: this.media['prefers-map-content']\n }\n })\n );\n };\n\n let styleOption = document.createElement('div'),\n styleOptionInput = styleOption.appendChild(\n document.createElement('input')\n );\n styleOptionInput.setAttribute('type', 'radio');\n styleOptionInput.setAttribute('id', 'rad-' + L.stamp(styleOptionInput));\n styleOptionInput.setAttribute(\n 'name',\n // grouping radio buttons based on parent layer's style \n 'styles-' + L.stamp(styleOption)\n );\n styleOptionInput.setAttribute('value', this.getAttribute('title'));\n styleOptionInput.setAttribute(\n 'data-href',\n new URL(this.href, this.getBase()).href\n );\n var styleOptionLabel = styleOption.appendChild(\n document.createElement('label')\n );\n styleOptionLabel.setAttribute('for', 'rad-' + L.stamp(styleOptionInput));\n styleOptionLabel.innerText = this.title;\n if (this.rel === 'style self' || this.rel === 'self style') {\n styleOptionInput.checked = true;\n }\n this._styleOption = styleOption;\n styleOptionInput.addEventListener('click', changeStyle.bind(this));\n }\n getLayerControlOption() {\n return this._styleOption;\n }\n\n // Resolve the templated URL with info from the sibling map-input's\n resolve() {\n if (this.tref) {\n let obj = {};\n const inputs = this.parentElement.querySelectorAll('map-input');\n if (this.rel === 'image') {\n // image/map\n for (let i = 0; i < inputs.length; i++) {\n const inp = inputs[i];\n obj[inp.name] = inp.value;\n }\n console.log(obj); // DEBUGGING\n return L.Util.template(this.tref, obj);\n } else if (this.rel === 'tile') {\n // TODO. Need to get tile coords from moveend\n // should be done/called from the TemplatedTilelayer.js file\n return obj;\n } else if (this.rel === 'query') {\n // TODO. Need to get the click coords from click event\n // should be done/called from the templatedlayer.js file\n } else if (this.rel === 'features') {\n // TODO.\n }\n }\n }\n whenReady() {\n return new Promise((resolve, reject) => {\n let interval, failureTimer, ready;\n switch (this.rel.toLowerCase()) {\n // for some cases, require a dependency check\n case 'tile':\n case 'image':\n case 'features':\n ready = '_templatedLayer';\n break;\n case 'style':\n case 'self':\n case 'style self':\n case 'self style':\n ready = '_styleOption';\n break;\n case 'query':\n ready = 'shadowRoot';\n break;\n case 'alternate':\n ready = '_alternate';\n break;\n case 'zoomin':\n case 'zoomout':\n case 'legend':\n case 'stylesheet':\n case 'license':\n resolve();\n break;\n default:\n resolve();\n break;\n }\n if (this[ready]) {\n resolve();\n }\n interval = setInterval(testForLinkReady, 300, this);\n failureTimer = setTimeout(linkNotDefined, 10000);\n function testForLinkReady(linkElement) {\n if (linkElement[ready]) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n resolve();\n } else if (!linkElement.isConnected) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('map-link was disconnected while waiting to be ready');\n }\n }\n function linkNotDefined() {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('Timeout reached waiting for link to be ready');\n }\n });\n }\n}\n"],"names":["MapLink","HTMLElement","observedAttributes","#hasConnected","type","this","getAttribute","val","startsWith","setAttribute","rel","includes","href","hasAttribute","URL","getBase","resolve","hreflang","tref","M","BLANK_TT_TREF","media","_metaContentToObject","tms","projection","extent","_templateVars","Object","assign","_convertAndFormatPCRS","getBounds","parentExtent","units","zoom","getZoomBounds","zoomTo","let","map","getMapEl","_map","xmin","topLeft","pcrs","horizontal","xmax","bottomRight","ymin","vertical","ymax","bounds","L","point","center","options","crs","unproject","getCenter","maxZoom","minZoom","setView","getMaxZoom","animate","getClosest","getLayerEl","attributeChangedCallback","name","oldValue","newValue","_initTemplateVars","constructor","super","connectedCallback","toLowerCase","_createTemplatedLink","_createSelfOrStyleLink","_createStylesheetLink","_createAlternateLink","disconnectedCallback","_stylesheetHost","link","remove","mapml","_alternate","source","target","getRootNode","ShadowRoot","host","parentElement","undefined","document","createElement","mapLink","Array","from","attributes","forEach","attribute","nodeName","nodeValue","_layer","appendStyleLink","_templatedLayer","_extentLayer","parentNode","toUpperCase","whenReady","inputsReady","error","console","log","mapEl","zIndex","querySelectorAll","indexOf","templatedTileLayer","zoomBounds","extentBounds","errorTileUrl","pane","getContainer","linkEl","addTo","templatedImageLayer","attachShadow","mode","templatedFeaturesLayer","extend","_setupQueryVars","template","queryVarNames","query","inputs","values","i","length","axis","position","select","tagName","width","height","match","pixelleft","tileleft","mapleft","pixelright","tileright","mapright","pixeltop","tiletop","maptop","pixelbottom","tilebottom","mapbottom","tilei","mapi","tilej","mapj","parsedselect","htmlselect","value","input","linkedZoomInput","varNamesRe","RegExp","zoomInput","querySelector","includesZoom","v","vcount","exec","varName","inp","push","step","isNaN","decodeURI","Promise","allSettled","_getZoomBounds","zoomValue","boundsUnit","FALLBACK_CS","tilematrix","locInputs","max","min","axisToCS","x","horizontalAxis","y","verticalAxis","boundsToPCRSBounds","getFallbackBounds","metaExtent","getMeta","content","cs","metaKeys","keys","split","axes","csToAxes","layer","relativeURL","src","baseURI","baseURL","meta","metaMin","minNativeZoom","metaMax","resolutions","maxNativeZoom","_validateDisabled","isVisible","mapZoom","mapBounds","overlaps","z","layerEl","styleOption","styleOptionInput","appendChild","stamp","styleOptionLabel","innerText","title","checked","_styleOption","addEventListener","e","DomEvent","stop","dispatchEvent","CustomEvent","detail","preference","bind","getLayerControlOption","obj","Util","reject","interval","failureTimer","ready","setInterval","linkElement","clearInterval","clearTimeout","isConnected","setTimeout"],"mappings":";;MAEaA,gBAAgBC,YAC3BC,gCACE,MAAO,CACL,OACA,MAEA,QACA,OACA,WACA,OACA,MACA,cAIJC,cAEAC,WACE,OAAOC,KAAKC,aAAa,SAAW,UAEtCF,SAASG,GAEK,eAARA,IAAwBA,EAAIC,WAAW,WACzCH,KAAKI,aAAa,OAAQF,GAG9BG,UAGE,OAAOL,KAAKC,aAAa,OAE3BI,QAAQH,GAGJ,CACE,UACA,YACA,OACA,QACA,OACA,QACA,WACA,SACA,UACA,SACA,QACA,cACAI,SAASJ,IAEXF,KAAKI,aAAa,OAAQF,GAW9BK,WACE,OAAIP,KAAKQ,aAAa,QACb,IAAIC,IAAIT,KAAKC,aAAa,QAASD,KAAKU,WAAWH,KACjDP,KAAKQ,aAAa,QACpBR,KAAKW,eADP,EAITJ,SAASL,GAEHA,GACFF,KAAKI,aAAa,OAAQF,GAG9BU,eACE,OAAOZ,KAAKC,aAAa,YAE3BW,aAAaV,GAEPA,GACFF,KAAKI,aAAa,WAAYF,GAGlCW,WACE,OAAKb,KAAKQ,aAAa,QAGhBR,KAAKC,aAAa,QAFhBa,E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ACF,IAAK,YACHA,EAAQ,aACR,MAQF,QACEtO,IAGAX,KAAKiP,IACPtO,IAEFoO,EAAWG,YAEX,SAA0BC,GACpBA,EAAYF,IACdG,cAAcL,GACdM,aAAaL,GACbrO,KACUwO,EAAYG,cACtBF,cAAcL,GACdM,aAAaL,GACbF,EAAO,yDAV8B,IAAK9O,MAC9CgP,EAAeO,WAYf,WACEH,cAAcL,GACdM,aAAaL,GACbF,EAAO,iDAfiC,eAh5BnCnP"} \ No newline at end of file diff --git a/static/dist/map-select.js b/static/dist/map-select.js index 03b86cf9..739d6e01 100644 --- a/static/dist/map-select.js +++ b/static/dist/map-select.js @@ -1,4 +1,4 @@ -/*! @maps4html/web-map-custom-element 27-03-2024 */ +/*! @maps4html/web-map-custom-element 01-04-2024 */ class MapSelect extends HTMLElement{static get observedAttributes(){return["name","id"]}get name(){return this.getAttribute("name")}set name(e){this.setAttribute("name",e)}get id(){return this.getAttribute("id")}set id(e){this.setAttribute("id",e)}attributeChangedCallback(e,t,r){e}constructor(){super()}connectedCallback(){this._extentEl=this.parentElement,this._createLayerControlForSelect()}disconnectedCallback(){}_createLayerControlForSelect(){this.htmlselect=this.transcribe();var e=L.DomUtil.create("details","mapml-layer-item-details mapml-control-layers"),t=L.DomUtil.create("summary"),r=L.DomUtil.create("label");r.innerText=this.getAttribute("name"),r.setAttribute("for",this.getAttribute("id")),t.appendChild(r),e.appendChild(t),e.appendChild(this.htmlselect),this.selectdetails=e;e=function(){this.parentElement._extentLayer.redraw()}.bind(this);this.htmlselect.addEventListener("change",e)}transcribe(){var r=document.createElement("select"),t=this.getAttributeNames();for(let e=0;e{let i,a;this.selectdetails?t():(i=setInterval(function(e){e.selectdetails?(clearInterval(i),clearTimeout(a),t()):e.isConnected||(clearInterval(i),clearTimeout(a),r("map-select was disconnected while waiting to be ready"))},300,this),a=setTimeout(function(){clearInterval(i),clearTimeout(a),r("Timeout reached waiting for map-select to be ready")},1e4))})}}export{MapSelect}; //# sourceMappingURL=map-select.js.map \ No newline at end of file diff --git a/static/dist/map-style.js b/static/dist/map-style.js index 1dac11d9..6046e1a4 100644 --- a/static/dist/map-style.js +++ b/static/dist/map-style.js @@ -1,4 +1,4 @@ -/*! @maps4html/web-map-custom-element 27-03-2024 */ +/*! @maps4html/web-map-custom-element 01-04-2024 */ class MapStyle extends HTMLElement{static get observedAttributes(){}attributeChangedCallback(t,e,s){}constructor(){super()}connectedCallback(){var t,e;this._stylesheetHost=this.getRootNode()instanceof ShadowRoot?this.getRootNode().host:this.parentElement,void 0!==this._stylesheetHost&&(this.styleElement=document.createElement("style"),(this.styleElement.mapStyle=this).styleElement.textContent=this.textContent,e=(t=this).styleElement,Array.from(t.attributes).forEach(t=>{e.setAttribute(t.nodeName,t.nodeValue)}),this._stylesheetHost._layer?this._stylesheetHost._layer.appendStyleElement(this):this._stylesheetHost._templatedLayer?this._stylesheetHost._templatedLayer.appendStyleElement(this):this._stylesheetHost._extentLayer&&this._stylesheetHost._extentLayer.appendStyleElement(this))}disconnectedCallback(){this._stylesheetHost&&this.styleElement.remove()}}export{MapStyle}; //# sourceMappingURL=map-style.js.map \ No newline at end of file diff --git a/static/dist/mapml-viewer.js b/static/dist/mapml-viewer.js index 3a818681..5ea23eb7 100644 --- a/static/dist/mapml-viewer.js +++ b/static/dist/mapml-viewer.js @@ -1,4 +1,4 @@ -/*! @maps4html/web-map-custom-element 27-03-2024 */ +/*! @maps4html/web-map-custom-element 01-04-2024 */ -import"./leaflet.js";import"./mapml.js";import{MapLayer}from"./layer.js";import{MapCaption}from"./map-caption.js";import{MapFeature}from"./map-feature.js";import{MapExtent}from"./map-extent.js";import{MapInput}from"./map-input.js";import{MapSelect}from"./map-select.js";import{MapLink}from"./map-link.js";import{MapStyle}from"./map-style.js";class MapViewer extends HTMLElement{static get observedAttributes(){return["lat","lon","zoom","projection","width","height","controls","static","controlslist"]}get controls(){return this.hasAttribute("controls")}set controls(t){Boolean(t)?this.setAttribute("controls",""):this.removeAttribute("controls")}get controlsList(){return this._controlsList}set controlsList(t){this._controlsList.value=t,this.setAttribute("controlslist",t)}get width(){return+window.getComputedStyle(this).width.replace("px","")}set width(t){this.setAttribute("width",t)}get height(){return+window.getComputedStyle(this).height.replace("px","")}set height(t){this.setAttribute("height",t)}get lat(){return+(this.hasAttribute("lat")?this.getAttribute("lat"):0)}set lat(t){t&&this.setAttribute("lat",t)}get lon(){return+(this.hasAttribute("lon")?this.getAttribute("lon"):0)}set lon(t){t&&this.setAttribute("lon",t)}get projection(){return this.hasAttribute("projection")?this.getAttribute("projection"):"OSMTILE"}set projection(t){t&&this.whenProjectionDefined(t).then(()=>{this.setAttribute("projection",t)}).catch(()=>{throw new Error("Undefined projection:"+t)})}get zoom(){return+(this.hasAttribute("zoom")?this.getAttribute("zoom"):0)}set zoom(t){t=parseInt(t,10);!isNaN(t)&&0<=t&&t<=25&&this.setAttribute("zoom",t)}get layers(){return this.getElementsByTagName("layer-")}get extent(){let t=this._map,e=M.pixelToPCRSBounds(t.getPixelBounds(),t.getZoom(),t.options.projection),o=M._convertAndFormatPCRS(e,t.options.crs,this.projection),i=1/0,n=-1/0;for(let t=0;tn&&(n=this.layers[t].extent.zoom.maxZoom));return o.zoom={minZoom:i!==1/0?i:t.getMinZoom(),maxZoom:n!==-1/0?n:t.getMaxZoom()},o}get static(){return this.hasAttribute("static")}set static(t){Boolean(t)?this.setAttribute("static",""):this.removeAttribute("static")}constructor(){super(),this._source=this.outerHTML,this._history=[],this._historyIndex=-1,this._traversalCall=!1}connectedCallback(){this.whenProjectionDefined(this.projection).then(()=>{this._initShadowRoot(),this._controlsList=new M.DOMTokenList(this.getAttribute("controlslist"),this,"controlslist",["noreload","nofullscreen","nozoom","nolayer","noscale","geolocation"]);var t=window.getComputedStyle(this),e=t.width,t=t.height,e=this.hasAttribute("width")?this.getAttribute("width"):parseInt(e.replace("px","")),t=this.hasAttribute("height")?this.getAttribute("height"):parseInt(t.replace("px",""));this._changeWidth(e),this._changeHeight(t),this._createMap(),this.setAttribute("role","application"),this._toggleStatic();let o=this.querySelector("map-caption");null!==o&&setTimeout(()=>{this.getAttribute("aria-label")===o.innerHTML&&(this.mapCaptionObserver=new MutationObserver(t=>{this.querySelector("map-caption")!==o&&this.removeAttribute("aria-label")}),this.mapCaptionObserver.observe(this,{childList:!0}))},0)}).catch(()=>{throw new Error("Projection not defined")})}_initShadowRoot(){this.shadowRoot||this.attachShadow({mode:"open"});let t=document.createElement("template");t.innerHTML=``;let e=this.shadowRoot;this._container=document.createElement("div");this._container.insertAdjacentHTML("beforeend","");let o=document.createElement("style");o.innerHTML=':host {all: initial;contain: layout size;display: inline-block;height: 150px;width: 300px;border-width: 2px;border-style: inset;}:host([frameborder="0"]) {border-width: 0;}:host([hidden]) {display: none!important;}:host .leaflet-control-container {visibility: hidden!important;}';let i=document.createElement("style");i.innerHTML="mapml-viewer > * {display: none!important;}",this.appendChild(i),this._container.setAttribute("role","region"),this._container.setAttribute("aria-label","Interactive map"),e.appendChild(o),e.appendChild(t.content.cloneNode(!0)),e.appendChild(this._container)}_createMap(){this._map||(this._map=L.map(this._container,{center:new L.LatLng(this.lat,this.lon),minZoom:0,maxZoom:M[this.projection].options.resolutions.length-1,projection:this.projection,query:!0,contextMenu:!0,announceMovement:M.options.announceMovement,featureIndex:!0,mapEl:this,crs:M[this.projection],zoom:this.zoom,zoomControl:!1}),this._addToHistory(),this._createControls(),this._toggleControls(),this._crosshair=M.crosshair().addTo(this._map),M.options.featureIndexOverlayOption&&(this._featureIndexOverlay=M.featureIndexOverlay().addTo(this._map)),this._setUpEvents())}disconnectedCallback(){for(this._removeEvents();this.shadowRoot.firstChild;)this.shadowRoot.removeChild(this.shadowRoot.firstChild);delete this._map,this._deleteControls()}adoptedCallback(){}attributeChangedCallback(t,e,s){switch(t){case"controlslist":this._controlsList&&(!1===this._controlsList.valueSet&&(this._controlsList.value=s),this._toggleControls());break;case"controls":null!==e&&null===s?this._hideControls():null===e&&null!==s&&this._showControls();break;case"height":e!==s&&this._changeHeight(s);break;case"width":e!==s&&this._changeWidth(s);break;case"static":this._toggleStatic();break;case"projection":if(s&&this._map&&this._map.options.projection!==s){const o=(()=>{let t=this.lat,e=this.lon,o=this.zoom;this._map.options.crs=M[s],this._map.options.projection=s;let i=[];this._map.announceMovement.disable();for(var n of this.querySelectorAll("layer-")){n.removeAttribute("disabled");let t=this.removeChild(n);this.appendChild(t),i.push(t.whenReady())}return Promise.allSettled(i).then(()=>{this.zoomTo(t,e,o),M.options.announceMovement&&this._map.announceMovement.enable(),setTimeout(()=>{this.dispatchEvent(new CustomEvent("map-projectionchange"))},0)})}).bind(this);o().then(()=>{if(this._map&&this._map.options.projection!==e&&this._resetHistory(),this._debug)for(let t=0;t<2;t++)this.toggleDebug()})}}}_createControls(){let t=this._map.getSize().y,e=0;this._layerControl=M.layerControl(null,{collapsed:!0,mapEl:this}).addTo(this._map),this._map.on("movestart",this._layerControl.collapse,this._layerControl);let o=M.options.announceScale;"metric"===o&&(o={metric:!0,imperial:!1}),"imperial"===o&&(o={metric:!1,imperial:!0}),this._scaleBar||(this._scaleBar=M.scaleBar(o).addTo(this._map)),!this._zoomControl&&e+93<=t&&(e+=93,this._zoomControl=L.control.zoom().addTo(this._map)),!this._reloadButton&&e+49<=t&&(e+=49,this._reloadButton=M.reloadButton().addTo(this._map)),!this._fullScreenControl&&e+49<=t&&(e+=49,this._fullScreenControl=M.fullscreenButton().addTo(this._map)),this._geolocationButton||(this._geolocationButton=M.geolocationButton().addTo(this._map))}_toggleControls(){!1===this.controls?(this._hideControls(),this._map.contextMenu.toggleContextMenuItem("Controls","disabled")):(this._showControls(),this._map.contextMenu.toggleContextMenuItem("Controls","enabled"))}_hideControls(){this._setControlsVisibility("fullscreen",!0),this._setControlsVisibility("layercontrol",!0),this._setControlsVisibility("reload",!0),this._setControlsVisibility("zoom",!0),this._setControlsVisibility("geolocation",!0),this._setControlsVisibility("scale",!0)}_showControls(){this._setControlsVisibility("fullscreen",!1),this._setControlsVisibility("layercontrol",!1),this._setControlsVisibility("reload",!1),this._setControlsVisibility("zoom",!1),this._setControlsVisibility("geolocation",!0),this._setControlsVisibility("scale",!1),this._controlsList&&this._controlsList.forEach(t=>{switch(t.toLowerCase()){case"nofullscreen":this._setControlsVisibility("fullscreen",!0);break;case"nolayer":this._setControlsVisibility("layercontrol",!0);break;case"noreload":this._setControlsVisibility("reload",!0);break;case"nozoom":this._setControlsVisibility("zoom",!0);break;case"geolocation":this._setControlsVisibility("geolocation",!1);break;case"noscale":this._setControlsVisibility("scale",!0)}}),this._layerControl&&0===this._layerControl._layers.length&&this._layerControl._container.setAttribute("hidden","")}_deleteControls(){delete this._layerControl,delete this._zoomControl,delete this._reloadButton,delete this._fullScreenControl,delete this._geolocationButton,delete this._scaleBar}_setControlsVisibility(t,e){let o;switch(t){case"zoom":this._zoomControl&&(o=this._zoomControl._container);break;case"reload":this._reloadButton&&(o=this._reloadButton._container);break;case"fullscreen":this._fullScreenControl&&(o=this._fullScreenControl._container);break;case"layercontrol":this._layerControl&&(o=this._layerControl._container);break;case"geolocation":this._geolocationButton&&(o=this._geolocationButton._container);break;case"scale":this._scaleBar&&(o=this._scaleBar._container)}o&&(e?([...o.children].forEach(t=>{t.setAttribute("hidden","")}),o.setAttribute("hidden","")):([...o.children].forEach(t=>{t.removeAttribute("hidden")}),o.removeAttribute("hidden")))}_toggleStatic(){var t=this.hasAttribute("static");this._map&&(t?(this._map.dragging.disable(),this._map.touchZoom.disable(),this._map.doubleClickZoom.disable(),this._map.scrollWheelZoom.disable(),this._map.boxZoom.disable(),this._map.keyboard.disable(),this._zoomControl.disable()):(this._map.dragging.enable(),this._map.touchZoom.enable(),this._map.doubleClickZoom.enable(),this._map.scrollWheelZoom.enable(),this._map.boxZoom.enable(),this._map.keyboard.enable(),this._zoomControl.enable()))}_dropHandler(t){t.preventDefault();t=t.dataTransfer.getData("text");M._pasteLayer(this,t)}_dragoverHandler(t){t.preventDefault(),t.dataTransfer.dropEffect="copy"}_removeEvents(){this._map&&(this._map.off(),this.removeEventListener("drop",this._dropHandler,!1),this.removeEventListener("dragover",this._dragoverHandler,!1))}_setUpEvents(){this.addEventListener("drop",this._dropHandler,!1),this.addEventListener("dragover",this._dragoverHandler,!1),this.addEventListener("change",function(t){"LAYER-"===t.target.tagName&&this.dispatchEvent(new CustomEvent("layerchange",{details:{target:this,originalEvent:t}}))},!1),this.parentElement.addEventListener("keyup",function(t){9===t.keyCode&&"MAPML-VIEWER"===document.activeElement.nodeName&&document.activeElement.dispatchEvent(new CustomEvent("mapfocused",{detail:{target:this}}))}),this.addEventListener("keydown",function(t){86===t.keyCode&&t.ctrlKey?navigator.clipboard.readText().then(t=>{M._pasteLayer(this,t)}):32===t.keyCode&&"INPUT"!==this.shadowRoot.activeElement.nodeName&&(t.preventDefault(),this._map.fire("keypress",{originalEvent:t}))}),this.parentElement.addEventListener("mousedown",function(t){"MAPML-VIEWER"===document.activeElement.nodeName&&document.activeElement.dispatchEvent(new CustomEvent("mapfocused",{detail:{target:this}}))}),this._map.on("locationfound",function(t){this.dispatchEvent(new CustomEvent("maplocationfound",{detail:{latlng:t.latlng,accuracy:t.accuracy}}))},this),this._map.on("locationerror",function(t){this.dispatchEvent(new CustomEvent("locationerror",{detail:{error:t.message}}))},this),this._map.on("load",function(){this.dispatchEvent(new CustomEvent("load",{detail:{target:this}}))},this),this._map.on("preclick",function(t){this.dispatchEvent(new CustomEvent("preclick",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("click",function(t){this.dispatchEvent(new CustomEvent("click",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("dblclick",function(t){this.dispatchEvent(new CustomEvent("dblclick",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("mousemove",function(t){this.dispatchEvent(new CustomEvent("mousemove",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("mouseover",function(t){this.dispatchEvent(new CustomEvent("mouseover",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("mouseout",function(t){this.dispatchEvent(new CustomEvent("mouseout",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("mousedown",function(t){this.dispatchEvent(new CustomEvent("mousedown",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("mouseup",function(t){this.dispatchEvent(new CustomEvent("mouseup",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("contextmenu",function(t){this.dispatchEvent(new CustomEvent("contextmenu",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("movestart",function(){this.dispatchEvent(new CustomEvent("movestart",{detail:{target:this}}))},this),this._map.on("move",function(){this.dispatchEvent(new CustomEvent("move",{detail:{target:this}}))},this),this._map.on("moveend",function(){this._updateMapCenter(),this._addToHistory(),this.dispatchEvent(new CustomEvent("map-moveend",{detail:{target:this}}))},this),this._map.on("zoomstart",function(){this.dispatchEvent(new CustomEvent("zoomstart",{detail:{target:this}}))},this),this._map.on("zoom",function(){this.dispatchEvent(new CustomEvent("zoom",{detail:{target:this}}))},this),this._map.on("zoomend",function(){this._updateMapCenter(),this.dispatchEvent(new CustomEvent("zoomend",{detail:{target:this}}))},this);const t=(t=>{this.whenLayersReady().then(()=>{t&&t.layer._layerEl&&(this._map.setMaxZoom(this.extent.zoom.maxZoom),this._map.setMinZoom(this.extent.zoom.minZoom))})}).bind(this);this.whenLayersReady().then(()=>{this._map.setMaxZoom(this.extent.zoom.maxZoom),this._map.setMinZoom(this.extent.zoom.minZoom),this._map.on("layeradd layerremove",t,this)}),this.addEventListener("fullscreenchange",function(t){null===document.fullscreenElement?this._map.contextMenu.setViewFullScreenInnerHTML("view"):this._map.contextMenu.setViewFullScreenInnerHTML("exit")}),this.addEventListener("keydown",function(t){"MAPML-VIEWER"===document.activeElement.nodeName&&(t.ctrlKey&&82===t.keyCode?(t.preventDefault(),this.reload()):t.altKey&&39===t.keyCode?(t.preventDefault(),this.forward()):t.altKey&&37===t.keyCode&&(t.preventDefault(),this.back()))})}locate(t){this._geolocationButton&&this._geolocationButton.stop(),t?(t.zoomTo&&(t.setView=t.zoomTo,delete t.zoomTo),this._map.locate(t)):this._map.locate({setView:!0,maxZoom:16})}toggleDebug(){this._debug?(this._debug.remove(),this._debug=void 0):this._debug=M.debugOverlay().addTo(this._map)}_changeWidth(t){this._container&&(this._container.style.width=t+"px",this.shadowRoot.styleSheets[0].cssRules[0].style.width=t+"px"),this._map&&this._map.invalidateSize(!1)}_changeHeight(t){this._container&&(this._container.style.height=t+"px",this.shadowRoot.styleSheets[0].cssRules[0].style.height=t+"px"),this._map&&this._map.invalidateSize(!1)}zoomTo(t,e,o){o=Number.isInteger(+o)?+o:this.zoom;e=new L.LatLng(+t,+e);this._map.setView(e,o),this.zoom=o,this.lat=e.lat,this.lon=e.lng}_updateMapCenter(){this.lat=this._map.getCenter().lat,this.lon=this._map.getCenter().lng,this.zoom=this._map.getZoom()}_resetHistory(){this._history=[],this._historyIndex=-1,this._traversalCall=!1,this._addToHistory()}_addToHistory(){var t;0Math.round(M[e.projection].options.bounds.getSize().x/M[e.projection].options.resolutions[t])},vertical:{name:"y",min:0,max:t=>Math.round(M[e.projection].options.bounds.getSize().y/M[e.projection].options.resolutions[t])},bounds:t=>L.bounds([M[e.projection].options.crs.tcrs.horizontal.min,M[e.projection].options.crs.tcrs.vertical.min],[M[e.projection].options.crs.tcrs.horizontal.max(t),M[e.projection].options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return M[e.projection].options.bounds.min.x},get max(){return M[e.projection].options.bounds.max.x}},vertical:{name:"northing",get min(){return M[e.projection].options.bounds.min.y},get max(){return M[e.projection].options.bounds.max.y}},get bounds(){return M[e.projection].options.bounds}},gcrs:{horizontal:{name:"longitude",get min(){return M[e.projection].unproject(M.OSMTILE.options.bounds.min).lng},get max(){return M[e.projection].unproject(M.OSMTILE.options.bounds.max).lng}},vertical:{name:"latitude",get min(){return M[e.projection].unproject(M.OSMTILE.options.bounds.min).lat},get max(){return M[e.projection].unproject(M.OSMTILE.options.bounds.max).lat}},get bounds(){return L.latLngBounds([M[e.projection].options.crs.gcrs.vertical.min,M[e.projection].options.crs.gcrs.horizontal.min],[M[e.projection].options.crs.gcrs.vertical.max,M[e.projection].options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:t},vertical:{name:"j",min:0,max:t},get bounds(){return L.bounds([M[e.projection].options.crs.tile.horizontal.min,M[e.projection].options.crs.tile.vertical.min],[M[e.projection].options.crs.tile.horizontal.max,M[e.projection].options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>Math.round(M[e.projection].options.crs.tcrs.horizontal.max(t)/M[e.projection].options.crs.tile.bounds.getSize().x)},vertical:{name:"row",min:0,max:t=>Math.round(M[e.projection].options.crs.tcrs.vertical.max(t)/M[e.projection].options.crs.tile.bounds.getSize().y)},bounds:t=>L.bounds([M[e.projection].options.crs.tilematrix.horizontal.min,M[e.projection].options.crs.tilematrix.vertical.min],[M[e.projection].options.crs.tilematrix.horizontal.max(t),M[e.projection].options.crs.tilematrix.vertical.max(t)])}}}),M[e.projection.toUpperCase()]=M[e.projection],e.projection}whenReady(){return new Promise((e,t)=>{let o,i;this._map?e():(o=setInterval(function(t){t._map&&(clearInterval(o),clearTimeout(i),e())},200,this),i=setTimeout(function(){clearInterval(o),clearTimeout(i),t("Timeout reached waiting for map to be ready")},5e3))})}whenLayersReady(){let t=[];for(var e of[...this.layers])t.push(e.whenReady());return Promise.allSettled(t)}whenProjectionDefined(n){return new Promise((e,t)=>{let o,i;M[n]?e():(o=setInterval(function(t){M[t]&&(clearInterval(o),clearTimeout(i),e())},200,n),i=setTimeout(function(){clearInterval(o),clearTimeout(i),t("Timeout reached waiting for projection to be defined")},5e3))})}geojson2mapml(t,e={}){void 0===e.projection&&(e.projection=this.projection);e=M.geojson2mapml(t,e);return this.appendChild(e),e}}window.customElements.define("mapml-viewer",MapViewer),window.customElements.define("layer-",MapLayer),window.customElements.define("map-caption",MapCaption),window.customElements.define("map-feature",MapFeature),window.customElements.define("map-extent",MapExtent),window.customElements.define("map-input",MapInput),window.customElements.define("map-select",MapSelect),window.customElements.define("map-link",MapLink),window.customElements.define("map-style",MapStyle);export{MapViewer}; +import"./leaflet.js";import"./mapml.js";import{MapLayer}from"./layer.js";import{MapCaption}from"./map-caption.js";import{MapFeature}from"./map-feature.js";import{MapExtent}from"./map-extent.js";import{MapInput}from"./map-input.js";import{MapSelect}from"./map-select.js";import{MapLink}from"./map-link.js";import{MapStyle}from"./map-style.js";class MapViewer extends HTMLElement{static get observedAttributes(){return["lat","lon","zoom","projection","width","height","controls","static","controlslist"]}get controls(){return this.hasAttribute("controls")}set controls(t){Boolean(t)?this.setAttribute("controls",""):this.removeAttribute("controls")}get controlsList(){return this._controlsList}set controlsList(t){this._controlsList.value=t,this.setAttribute("controlslist",t)}get width(){return+window.getComputedStyle(this).width.replace("px","")}set width(t){this.setAttribute("width",t)}get height(){return+window.getComputedStyle(this).height.replace("px","")}set height(t){this.setAttribute("height",t)}get lat(){return+(this.hasAttribute("lat")?this.getAttribute("lat"):0)}set lat(t){t&&this.setAttribute("lat",t)}get lon(){return+(this.hasAttribute("lon")?this.getAttribute("lon"):0)}set lon(t){t&&this.setAttribute("lon",t)}get projection(){return this.hasAttribute("projection")?this.getAttribute("projection"):"OSMTILE"}set projection(t){t&&this.whenProjectionDefined(t).then(()=>{this.setAttribute("projection",t)}).catch(()=>{throw new Error("Undefined projection:"+t)})}get zoom(){return+(this.hasAttribute("zoom")?this.getAttribute("zoom"):0)}set zoom(t){t=parseInt(t,10);!isNaN(t)&&0<=t&&t<=25&&this.setAttribute("zoom",t)}get layers(){return this.getElementsByTagName("layer-")}get extent(){let t=this._map,e=M.pixelToPCRSBounds(t.getPixelBounds(),t.getZoom(),t.options.projection),o=M._convertAndFormatPCRS(e,t.options.crs,this.projection),i=1/0,n=-1/0;for(let t=0;tn&&(n=this.layers[t].extent.zoom.maxZoom));return o.zoom={minZoom:i!==1/0?i:t.getMinZoom(),maxZoom:n!==-1/0?n:t.getMaxZoom()},o}get static(){return this.hasAttribute("static")}set static(t){Boolean(t)?this.setAttribute("static",""):this.removeAttribute("static")}constructor(){super(),this._source=this.outerHTML,this._history=[],this._historyIndex=-1,this._traversalCall=!1}connectedCallback(){this.whenProjectionDefined(this.projection).then(()=>{this._initShadowRoot(),this._controlsList=new M.DOMTokenList(this.getAttribute("controlslist"),this,"controlslist",["noreload","nofullscreen","nozoom","nolayer","noscale","geolocation"]);var t=window.getComputedStyle(this),e=t.width,t=t.height,e=this.hasAttribute("width")?this.getAttribute("width"):parseInt(e.replace("px","")),t=this.hasAttribute("height")?this.getAttribute("height"):parseInt(t.replace("px",""));this._changeWidth(e),this._changeHeight(t),this._createMap(),this.setAttribute("role","application"),this._toggleStatic();let o=this.querySelector("map-caption");null!==o&&setTimeout(()=>{this.getAttribute("aria-label")===o.innerHTML&&(this.mapCaptionObserver=new MutationObserver(t=>{this.querySelector("map-caption")!==o&&this.removeAttribute("aria-label")}),this.mapCaptionObserver.observe(this,{childList:!0}))},0)}).catch(()=>{throw new Error("Projection not defined")})}_initShadowRoot(){this.shadowRoot||this.attachShadow({mode:"open"});let t=document.createElement("template");t.innerHTML=``;let e=this.shadowRoot;this._container=document.createElement("div");this._container.insertAdjacentHTML("beforeend","");let o=document.createElement("style");o.innerHTML=':host {all: initial;contain: layout size;display: inline-block;height: 150px;width: 300px;border-width: 2px;border-style: inset;}:host([frameborder="0"]) {border-width: 0;}:host([hidden]) {display: none!important;}:host .leaflet-control-container {visibility: hidden!important;}';let i=document.createElement("style");i.innerHTML="mapml-viewer > * {display: none!important;}",this.appendChild(i),this._container.setAttribute("role","region"),this._container.setAttribute("aria-label","Interactive map"),e.appendChild(o),e.appendChild(t.content.cloneNode(!0)),e.appendChild(this._container)}_createMap(){this._map||(this._map=L.map(this._container,{center:new L.LatLng(this.lat,this.lon),minZoom:0,maxZoom:M[this.projection].options.resolutions.length-1,projection:this.projection,query:!0,contextMenu:!0,announceMovement:M.options.announceMovement,featureIndex:!0,mapEl:this,crs:M[this.projection],zoom:this.zoom,zoomControl:!1}),this._addToHistory(),this._createControls(),this._toggleControls(),this._crosshair=M.crosshair().addTo(this._map),M.options.featureIndexOverlayOption&&(this._featureIndexOverlay=M.featureIndexOverlay().addTo(this._map)),this._setUpEvents())}disconnectedCallback(){for(this._removeEvents();this.shadowRoot.firstChild;)this.shadowRoot.removeChild(this.shadowRoot.firstChild);delete this._map,this._deleteControls()}adoptedCallback(){}attributeChangedCallback(t,e,s){switch(t){case"controlslist":this._controlsList&&(!1===this._controlsList.valueSet&&(this._controlsList.value=s),this._toggleControls());break;case"controls":null!==e&&null===s?this._hideControls():null===e&&null!==s&&this._showControls();break;case"height":e!==s&&this._changeHeight(s);break;case"width":e!==s&&this._changeWidth(s);break;case"static":this._toggleStatic();break;case"projection":if(s&&this._map&&this._map.options.projection!==s){const o=(()=>{let t=this.lat,e=this.lon,o=this.zoom;this._map.options.crs=M[s],this._map.options.projection=s;let i=[];this._map.announceMovement.disable();for(var n of this.querySelectorAll("layer-")){n.removeAttribute("disabled");let t=this.removeChild(n);this.appendChild(t),i.push(t.whenReady())}return Promise.allSettled(i).then(()=>{this.zoomTo(t,e,o),M.options.announceMovement&&this._map.announceMovement.enable(),setTimeout(()=>{this.dispatchEvent(new CustomEvent("map-projectionchange"))},0)})}).bind(this);o().then(()=>{if(this._map&&this._map.options.projection!==e&&this._resetHistory(),this._debug)for(let t=0;t<2;t++)this.toggleDebug()})}}}_createControls(){let t=this._map.getSize().y,e=0;this._layerControl=M.layerControl(null,{collapsed:!0,mapEl:this}).addTo(this._map),this._map.on("movestart",this._layerControl.collapse,this._layerControl);let o=M.options.announceScale;"metric"===o&&(o={metric:!0,imperial:!1}),"imperial"===o&&(o={metric:!1,imperial:!0}),this._scaleBar||(this._scaleBar=M.scaleBar(o).addTo(this._map)),!this._zoomControl&&e+93<=t&&(e+=93,this._zoomControl=L.control.zoom().addTo(this._map)),!this._reloadButton&&e+49<=t&&(e+=49,this._reloadButton=M.reloadButton().addTo(this._map)),!this._fullScreenControl&&e+49<=t&&(e+=49,this._fullScreenControl=M.fullscreenButton().addTo(this._map)),this._geolocationButton||(this._geolocationButton=M.geolocationButton().addTo(this._map))}_toggleControls(){!1===this.controls?(this._hideControls(),this._map.contextMenu.toggleContextMenuItem("Controls","disabled")):(this._showControls(),this._map.contextMenu.toggleContextMenuItem("Controls","enabled"))}_hideControls(){this._setControlsVisibility("fullscreen",!0),this._setControlsVisibility("layercontrol",!0),this._setControlsVisibility("reload",!0),this._setControlsVisibility("zoom",!0),this._setControlsVisibility("geolocation",!0),this._setControlsVisibility("scale",!0)}_showControls(){this._setControlsVisibility("fullscreen",!1),this._setControlsVisibility("layercontrol",!1),this._setControlsVisibility("reload",!1),this._setControlsVisibility("zoom",!1),this._setControlsVisibility("geolocation",!0),this._setControlsVisibility("scale",!1),this._controlsList&&this._controlsList.forEach(t=>{switch(t.toLowerCase()){case"nofullscreen":this._setControlsVisibility("fullscreen",!0);break;case"nolayer":this._setControlsVisibility("layercontrol",!0);break;case"noreload":this._setControlsVisibility("reload",!0);break;case"nozoom":this._setControlsVisibility("zoom",!0);break;case"geolocation":this._setControlsVisibility("geolocation",!1);break;case"noscale":this._setControlsVisibility("scale",!0)}}),this._layerControl&&0===this._layerControl._layers.length&&this._layerControl._container.setAttribute("hidden","")}_deleteControls(){delete this._layerControl,delete this._zoomControl,delete this._reloadButton,delete this._fullScreenControl,delete this._geolocationButton,delete this._scaleBar}_setControlsVisibility(t,e){let o;switch(t){case"zoom":this._zoomControl&&(o=this._zoomControl._container);break;case"reload":this._reloadButton&&(o=this._reloadButton._container);break;case"fullscreen":this._fullScreenControl&&(o=this._fullScreenControl._container);break;case"layercontrol":this._layerControl&&(o=this._layerControl._container);break;case"geolocation":this._geolocationButton&&(o=this._geolocationButton._container);break;case"scale":this._scaleBar&&(o=this._scaleBar._container)}o&&(e?([...o.children].forEach(t=>{t.setAttribute("hidden","")}),o.setAttribute("hidden","")):([...o.children].forEach(t=>{t.removeAttribute("hidden")}),o.removeAttribute("hidden")))}_toggleStatic(){var t=this.hasAttribute("static");this._map&&(t?(this._map.dragging.disable(),this._map.touchZoom.disable(),this._map.doubleClickZoom.disable(),this._map.scrollWheelZoom.disable(),this._map.boxZoom.disable(),this._map.keyboard.disable(),this._zoomControl.disable()):(this._map.dragging.enable(),this._map.touchZoom.enable(),this._map.doubleClickZoom.enable(),this._map.scrollWheelZoom.enable(),this._map.boxZoom.enable(),this._map.keyboard.enable(),this._zoomControl.enable()))}_dropHandler(t){t.preventDefault();t=t.dataTransfer.getData("text");M._pasteLayer(this,t)}_dragoverHandler(t){t.preventDefault(),t.dataTransfer.dropEffect="copy"}_removeEvents(){this._map&&(this._map.off(),this.removeEventListener("drop",this._dropHandler,!1),this.removeEventListener("dragover",this._dragoverHandler,!1))}_setUpEvents(){this.addEventListener("drop",this._dropHandler,!1),this.addEventListener("dragover",this._dragoverHandler,!1),this.addEventListener("change",function(t){"LAYER-"===t.target.tagName&&this.dispatchEvent(new CustomEvent("layerchange",{details:{target:this,originalEvent:t}}))},!1);let t=this.getRootNode()instanceof ShadowRoot?this.getRootNode().host:this.parentElement;t.addEventListener("keyup",function(t){9===t.keyCode&&"MAPML-VIEWER"===document.activeElement.nodeName&&document.activeElement.dispatchEvent(new CustomEvent("mapfocused",{detail:{target:this}}))}),this.addEventListener("keydown",function(t){86===t.keyCode&&t.ctrlKey?navigator.clipboard.readText().then(t=>{M._pasteLayer(this,t)}):32===t.keyCode&&"INPUT"!==this.shadowRoot.activeElement.nodeName&&(t.preventDefault(),this._map.fire("keypress",{originalEvent:t}))}),t.addEventListener("mousedown",function(t){"MAPML-VIEWER"===document.activeElement.nodeName&&document.activeElement.dispatchEvent(new CustomEvent("mapfocused",{detail:{target:this}}))}),this._map.on("locationfound",function(t){this.dispatchEvent(new CustomEvent("maplocationfound",{detail:{latlng:t.latlng,accuracy:t.accuracy}}))},this),this._map.on("locationerror",function(t){this.dispatchEvent(new CustomEvent("locationerror",{detail:{error:t.message}}))},this),this._map.on("load",function(){this.dispatchEvent(new CustomEvent("load",{detail:{target:this}}))},this),this._map.on("preclick",function(t){this.dispatchEvent(new CustomEvent("preclick",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("click",function(t){this.dispatchEvent(new CustomEvent("click",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("dblclick",function(t){this.dispatchEvent(new CustomEvent("dblclick",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("mousemove",function(t){this.dispatchEvent(new CustomEvent("mousemove",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("mouseover",function(t){this.dispatchEvent(new CustomEvent("mouseover",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("mouseout",function(t){this.dispatchEvent(new CustomEvent("mouseout",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("mousedown",function(t){this.dispatchEvent(new CustomEvent("mousedown",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("mouseup",function(t){this.dispatchEvent(new CustomEvent("mouseup",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("contextmenu",function(t){this.dispatchEvent(new CustomEvent("contextmenu",{detail:{lat:t.latlng.lat,lon:t.latlng.lng,x:t.containerPoint.x,y:t.containerPoint.y}}))},this),this._map.on("movestart",function(){this.dispatchEvent(new CustomEvent("movestart",{detail:{target:this}}))},this),this._map.on("move",function(){this.dispatchEvent(new CustomEvent("move",{detail:{target:this}}))},this),this._map.on("moveend",function(){this._updateMapCenter(),this._addToHistory(),this.dispatchEvent(new CustomEvent("map-moveend",{detail:{target:this}}))},this),this._map.on("zoomstart",function(){this.dispatchEvent(new CustomEvent("zoomstart",{detail:{target:this}}))},this),this._map.on("zoom",function(){this.dispatchEvent(new CustomEvent("zoom",{detail:{target:this}}))},this),this._map.on("zoomend",function(){this._updateMapCenter(),this.dispatchEvent(new CustomEvent("zoomend",{detail:{target:this}}))},this);const e=(t=>{this.whenLayersReady().then(()=>{t&&t.layer._layerEl&&(this._map.setMaxZoom(this.extent.zoom.maxZoom),this._map.setMinZoom(this.extent.zoom.minZoom))})}).bind(this);this.whenLayersReady().then(()=>{this._map.setMaxZoom(this.extent.zoom.maxZoom),this._map.setMinZoom(this.extent.zoom.minZoom),this._map.on("layeradd layerremove",e,this)}),this.addEventListener("fullscreenchange",function(t){null===document.fullscreenElement?this._map.contextMenu.setViewFullScreenInnerHTML("view"):this._map.contextMenu.setViewFullScreenInnerHTML("exit")}),this.addEventListener("keydown",function(t){"MAPML-VIEWER"===document.activeElement.nodeName&&(t.ctrlKey&&82===t.keyCode?(t.preventDefault(),this.reload()):t.altKey&&39===t.keyCode?(t.preventDefault(),this.forward()):t.altKey&&37===t.keyCode&&(t.preventDefault(),this.back()))})}locate(t){this._geolocationButton&&this._geolocationButton.stop(),t?(t.zoomTo&&(t.setView=t.zoomTo,delete t.zoomTo),this._map.locate(t)):this._map.locate({setView:!0,maxZoom:16})}toggleDebug(){this._debug?(this._debug.remove(),this._debug=void 0):this._debug=M.debugOverlay().addTo(this._map)}_changeWidth(t){this._container&&(this._container.style.width=t+"px",this.shadowRoot.styleSheets[0].cssRules[0].style.width=t+"px"),this._map&&this._map.invalidateSize(!1)}_changeHeight(t){this._container&&(this._container.style.height=t+"px",this.shadowRoot.styleSheets[0].cssRules[0].style.height=t+"px"),this._map&&this._map.invalidateSize(!1)}zoomTo(t,e,o){o=Number.isInteger(+o)?+o:this.zoom;e=new L.LatLng(+t,+e);this._map.setView(e,o),this.zoom=o,this.lat=e.lat,this.lon=e.lng}_updateMapCenter(){this.lat=this._map.getCenter().lat,this.lon=this._map.getCenter().lng,this.zoom=this._map.getZoom()}_resetHistory(){this._history=[],this._historyIndex=-1,this._traversalCall=!1,this._addToHistory()}_addToHistory(){var t;0Math.round(M[e.projection].options.bounds.getSize().x/M[e.projection].options.resolutions[t])},vertical:{name:"y",min:0,max:t=>Math.round(M[e.projection].options.bounds.getSize().y/M[e.projection].options.resolutions[t])},bounds:t=>L.bounds([M[e.projection].options.crs.tcrs.horizontal.min,M[e.projection].options.crs.tcrs.vertical.min],[M[e.projection].options.crs.tcrs.horizontal.max(t),M[e.projection].options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return M[e.projection].options.bounds.min.x},get max(){return M[e.projection].options.bounds.max.x}},vertical:{name:"northing",get min(){return M[e.projection].options.bounds.min.y},get max(){return M[e.projection].options.bounds.max.y}},get bounds(){return M[e.projection].options.bounds}},gcrs:{horizontal:{name:"longitude",get min(){return M[e.projection].unproject(M.OSMTILE.options.bounds.min).lng},get max(){return M[e.projection].unproject(M.OSMTILE.options.bounds.max).lng}},vertical:{name:"latitude",get min(){return M[e.projection].unproject(M.OSMTILE.options.bounds.min).lat},get max(){return M[e.projection].unproject(M.OSMTILE.options.bounds.max).lat}},get bounds(){return L.latLngBounds([M[e.projection].options.crs.gcrs.vertical.min,M[e.projection].options.crs.gcrs.horizontal.min],[M[e.projection].options.crs.gcrs.vertical.max,M[e.projection].options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:t},vertical:{name:"j",min:0,max:t},get bounds(){return L.bounds([M[e.projection].options.crs.tile.horizontal.min,M[e.projection].options.crs.tile.vertical.min],[M[e.projection].options.crs.tile.horizontal.max,M[e.projection].options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>Math.round(M[e.projection].options.crs.tcrs.horizontal.max(t)/M[e.projection].options.crs.tile.bounds.getSize().x)},vertical:{name:"row",min:0,max:t=>Math.round(M[e.projection].options.crs.tcrs.vertical.max(t)/M[e.projection].options.crs.tile.bounds.getSize().y)},bounds:t=>L.bounds([M[e.projection].options.crs.tilematrix.horizontal.min,M[e.projection].options.crs.tilematrix.vertical.min],[M[e.projection].options.crs.tilematrix.horizontal.max(t),M[e.projection].options.crs.tilematrix.vertical.max(t)])}}}),M[e.projection.toUpperCase()]=M[e.projection],e.projection}whenReady(){return new Promise((e,t)=>{let o,i;this._map?e():(o=setInterval(function(t){t._map&&(clearInterval(o),clearTimeout(i),e())},200,this),i=setTimeout(function(){clearInterval(o),clearTimeout(i),t("Timeout reached waiting for map to be ready")},5e3))})}whenLayersReady(){let t=[];for(var e of[...this.layers])t.push(e.whenReady());return Promise.allSettled(t)}whenProjectionDefined(n){return new Promise((e,t)=>{let o,i;M[n]?e():(o=setInterval(function(t){M[t]&&(clearInterval(o),clearTimeout(i),e())},200,n),i=setTimeout(function(){clearInterval(o),clearTimeout(i),t("Timeout reached waiting for projection to be defined")},5e3))})}geojson2mapml(t,e={}){void 0===e.projection&&(e.projection=this.projection);e=M.geojson2mapml(t,e);return this.appendChild(e),e}}window.customElements.define("mapml-viewer",MapViewer),window.customElements.define("layer-",MapLayer),window.customElements.define("map-caption",MapCaption),window.customElements.define("map-feature",MapFeature),window.customElements.define("map-extent",MapExtent),window.customElements.define("map-input",MapInput),window.customElements.define("map-select",MapSelect),window.customElements.define("map-link",MapLink),window.customElements.define("map-style",MapStyle);export{MapViewer}; //# sourceMappingURL=mapml-viewer.js.map \ No newline at end of file diff --git a/static/dist/mapml-viewer.js.map b/static/dist/mapml-viewer.js.map index 0f3a7ad8..7731507d 100644 --- a/static/dist/mapml-viewer.js.map +++ b/static/dist/mapml-viewer.js.map @@ -1 +1 @@ -{"version":3,"file":"mapml-viewer.js","sources":["../src/mapml-viewer.js"],"sourcesContent":["import './leaflet.js'; // bundled with proj4, proj4leaflet, modularized\nimport './mapml.js';\nimport { MapLayer } from './layer.js';\nimport { MapCaption } from './map-caption.js';\nimport { MapFeature } from './map-feature.js';\nimport { MapExtent } from './map-extent.js';\nimport { MapInput } from './map-input.js';\nimport { MapSelect } from './map-select.js';\nimport { MapLink } from './map-link.js';\nimport { MapStyle } from './map-style.js';\n\nexport class MapViewer extends HTMLElement {\n static get observedAttributes() {\n return [\n 'lat',\n 'lon',\n 'zoom',\n 'projection',\n 'width',\n 'height',\n 'controls',\n 'static',\n 'controlslist'\n ];\n }\n // see comments below regarding attributeChangedCallback vs. getter/setter\n // usage. Effectively, the user of the element must use the property, not\n // the getAttribute/setAttribute/removeAttribute DOM API, because the latter\n // calls don't result in the getter/setter being called (so you have to use\n // the getter/setter directly)\n get controls() {\n return this.hasAttribute('controls');\n }\n set controls(value) {\n const hasControls = Boolean(value);\n if (hasControls) {\n this.setAttribute('controls', '');\n } else {\n this.removeAttribute('controls');\n }\n }\n get controlsList() {\n return this._controlsList;\n }\n set controlsList(value) {\n this._controlsList.value = value;\n this.setAttribute('controlslist', value);\n }\n get width() {\n return +window.getComputedStyle(this).width.replace('px', '');\n }\n set width(val) {\n //img.height or img.width setters change or add the corresponding attributes\n this.setAttribute('width', val);\n }\n get height() {\n return +window.getComputedStyle(this).height.replace('px', '');\n }\n set height(val) {\n //img.height or img.width setters change or add the corresponding attributes\n this.setAttribute('height', val);\n }\n get lat() {\n return +(this.hasAttribute('lat') ? this.getAttribute('lat') : 0);\n }\n set lat(val) {\n if (val) {\n this.setAttribute('lat', val);\n }\n }\n get lon() {\n return +(this.hasAttribute('lon') ? this.getAttribute('lon') : 0);\n }\n set lon(val) {\n if (val) {\n this.setAttribute('lon', val);\n }\n }\n get projection() {\n return this.hasAttribute('projection')\n ? this.getAttribute('projection')\n : 'OSMTILE';\n }\n set projection(val) {\n if (val) {\n this.whenProjectionDefined(val)\n .then(() => {\n this.setAttribute('projection', val);\n })\n .catch(() => {\n throw new Error('Undefined projection:' + val);\n });\n }\n }\n get zoom() {\n return +(this.hasAttribute('zoom') ? this.getAttribute('zoom') : 0);\n }\n set zoom(val) {\n var parsedVal = parseInt(val, 10);\n if (!isNaN(parsedVal) && parsedVal >= 0 && parsedVal <= 25) {\n this.setAttribute('zoom', parsedVal);\n }\n }\n get layers() {\n return this.getElementsByTagName('layer-');\n }\n\n get extent() {\n let map = this._map,\n pcrsBounds = M.pixelToPCRSBounds(\n map.getPixelBounds(),\n map.getZoom(),\n map.options.projection\n );\n let formattedExtent = M._convertAndFormatPCRS(\n pcrsBounds,\n map.options.crs,\n this.projection\n );\n // get min/max zoom from layers at this moment\n let minZoom = Infinity,\n maxZoom = -Infinity;\n for (let i = 0; i < this.layers.length; i++) {\n if (this.layers[i].extent) {\n if (this.layers[i].extent.zoom.minZoom < minZoom)\n minZoom = this.layers[i].extent.zoom.minZoom;\n if (this.layers[i].extent.zoom.maxZoom > maxZoom)\n maxZoom = this.layers[i].extent.zoom.maxZoom;\n }\n }\n\n formattedExtent.zoom = {\n minZoom: minZoom !== Infinity ? minZoom : map.getMinZoom(),\n maxZoom: maxZoom !== -Infinity ? maxZoom : map.getMaxZoom()\n };\n return formattedExtent;\n }\n get static() {\n return this.hasAttribute('static');\n }\n set static(value) {\n const isStatic = Boolean(value);\n if (isStatic) this.setAttribute('static', '');\n else this.removeAttribute('static');\n }\n\n constructor() {\n // Always call super first in constructor\n super();\n this._source = this.outerHTML;\n // create an array to track the history of the map and the current index\n this._history = [];\n this._historyIndex = -1;\n this._traversalCall = false;\n }\n connectedCallback() {\n this.whenProjectionDefined(this.projection)\n .then(() => {\n this._initShadowRoot();\n\n this._controlsList = new M.DOMTokenList(\n this.getAttribute('controlslist'),\n this,\n 'controlslist',\n [\n 'noreload',\n 'nofullscreen',\n 'nozoom',\n 'nolayer',\n 'noscale',\n 'geolocation'\n ]\n );\n\n var s = window.getComputedStyle(this),\n wpx = s.width,\n hpx = s.height,\n w = this.hasAttribute('width')\n ? this.getAttribute('width')\n : parseInt(wpx.replace('px', '')),\n h = this.hasAttribute('height')\n ? this.getAttribute('height')\n : parseInt(hpx.replace('px', ''));\n this._changeWidth(w);\n this._changeHeight(h);\n\n this._createMap();\n\n // https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/274\n this.setAttribute('role', 'application');\n this._toggleStatic();\n\n /*\n 1. only deletes aria-label when the last (only remaining) map caption is removed\n 2. only deletes aria-label if the aria-label was defined by the map caption element itself\n */\n\n let mapcaption = this.querySelector('map-caption');\n\n if (mapcaption !== null) {\n setTimeout(() => {\n let ariaupdate = this.getAttribute('aria-label');\n\n if (ariaupdate === mapcaption.innerHTML) {\n this.mapCaptionObserver = new MutationObserver((m) => {\n let mapcaptionupdate = this.querySelector('map-caption');\n if (mapcaptionupdate !== mapcaption) {\n this.removeAttribute('aria-label');\n }\n });\n this.mapCaptionObserver.observe(this, {\n childList: true\n });\n }\n }, 0);\n }\n })\n .catch(() => {\n throw new Error('Projection not defined');\n });\n }\n _initShadowRoot() {\n if (!this.shadowRoot) {\n this.attachShadow({ mode: 'open' });\n }\n let tmpl = document.createElement('template');\n /* jshint ignore:start */\n tmpl.innerHTML = ``;\n /* jshint ignore:end */\n\n let shadowRoot = this.shadowRoot;\n this._container = document.createElement('div');\n\n let output =\n \"\";\n this._container.insertAdjacentHTML('beforeend', output);\n\n // Set default styles for the map element.\n let mapDefaultCSS = document.createElement('style');\n mapDefaultCSS.innerHTML =\n `:host {` +\n `all: initial;` + // Reset properties inheritable from html/body, as some inherited styles may cause unexpected issues with the map element's components (https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/140).\n `contain: layout size;` + // Contain layout and size calculations within the map element.\n `display: inline-block;` + // This together with dimension properties is required so that Leaflet isn't working with a height=0 box by default.\n `height: 150px;` + // Provide a \"default object size\" (https://github.com/Maps4HTML/HTML-Map-Element/issues/31).\n `width: 300px;` +\n `border-width: 2px;` + // Set a default border for contrast, similar to UA default for iframes.\n `border-style: inset;` +\n `}` +\n `:host([frameborder=\"0\"]) {` +\n `border-width: 0;` +\n `}` +\n `:host([hidden]) {` +\n `display: none!important;` +\n `}` +\n `:host .leaflet-control-container {` +\n `visibility: hidden!important;` + // Visibility hack to improve percieved performance (mitigate FOUC) – visibility is unset in mapml.css! (https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/154).\n `}`;\n\n // Hide all (light DOM) children of the map element.\n let hideElementsCSS = document.createElement('style');\n hideElementsCSS.innerHTML =\n `mapml-viewer > * {` + `display: none!important;` + `}`;\n this.appendChild(hideElementsCSS);\n\n // Make the Leaflet container element programmatically identifiable\n // (https://github.com/Leaflet/Leaflet/issues/7193).\n this._container.setAttribute('role', 'region');\n this._container.setAttribute('aria-label', 'Interactive map');\n\n shadowRoot.appendChild(mapDefaultCSS);\n shadowRoot.appendChild(tmpl.content.cloneNode(true));\n shadowRoot.appendChild(this._container);\n }\n _createMap() {\n if (!this._map) {\n this._map = L.map(this._container, {\n center: new L.LatLng(this.lat, this.lon),\n minZoom: 0,\n maxZoom: M[this.projection].options.resolutions.length - 1,\n projection: this.projection,\n query: true,\n contextMenu: true,\n announceMovement: M.options.announceMovement,\n featureIndex: true,\n mapEl: this,\n crs: M[this.projection],\n zoom: this.zoom,\n zoomControl: false\n });\n this._addToHistory();\n\n this._createControls();\n this._toggleControls();\n this._crosshair = M.crosshair().addTo(this._map);\n\n if (M.options.featureIndexOverlayOption)\n this._featureIndexOverlay = M.featureIndexOverlay().addTo(this._map);\n\n this._setUpEvents();\n }\n }\n disconnectedCallback() {\n this._removeEvents();\n while (this.shadowRoot.firstChild) {\n this.shadowRoot.removeChild(this.shadowRoot.firstChild);\n }\n delete this._map;\n this._deleteControls();\n }\n adoptedCallback() {\n // console.log('Custom map element moved to new page.');\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n // console.log('Attribute: ' + name + ' changed from: '+ oldValue + ' to: '+newValue);\n // \"Best practice\": handle side-effects in this callback\n // https://developers.google.com/web/fundamentals/web-components/best-practices\n // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy\n // note that the example is misleading, since the user can't use\n // setAttribute or removeAttribute to set the property, they need to use\n // the property directly in their API usage, which kinda sucks\n /*\n const hasValue = newValue !== null;\n switch (name) {\n case 'checked':\n // Note the attributeChangedCallback is only handling the *side effects*\n // of setting the attribute.\n this.setAttribute('aria-checked', hasValue);\n break;\n ...\n } */\n switch (name) {\n case 'controlslist':\n if (this._controlsList) {\n if (this._controlsList.valueSet === false) {\n this._controlsList.value = newValue;\n }\n this._toggleControls();\n }\n break;\n case 'controls':\n if (oldValue !== null && newValue === null) {\n this._hideControls();\n } else if (oldValue === null && newValue !== null) {\n this._showControls();\n }\n break;\n case 'height':\n if (oldValue !== newValue) {\n this._changeHeight(newValue);\n }\n break;\n case 'width':\n if (oldValue !== newValue) {\n this._changeWidth(newValue);\n }\n break;\n case 'static':\n this._toggleStatic();\n break;\n case 'projection':\n const reconnectLayers = () => {\n // save map location and zoom\n let lat = this.lat;\n let lon = this.lon;\n let zoom = this.zoom;\n // saving the lat, lon and zoom is necessary because Leaflet seems\n // to try to compensate for the change in the scales for each zoom\n // level in the crs by changing the zoom level of the map when\n // you set the map crs. So, we save the current view for use below\n // when all the layers' reconnections have settled.\n // leaflet doesn't like this: https://github.com/Leaflet/Leaflet/issues/2553\n this._map.options.crs = M[newValue];\n this._map.options.projection = newValue;\n let layersReady = [];\n this._map.announceMovement.disable();\n for (let layer of this.querySelectorAll('layer-')) {\n layer.removeAttribute('disabled');\n let reAttach = this.removeChild(layer);\n this.appendChild(reAttach);\n layersReady.push(reAttach.whenReady());\n }\n return Promise.allSettled(layersReady).then(() => {\n // use the saved map location to ensure it is correct after\n // changing the map CRS. Specifically affects projection\n // upgrades, e.g. https://maps4html.org/experiments/custom-projections/BNG/\n // see leaflet bug: https://github.com/Leaflet/Leaflet/issues/2553\n this.zoomTo(lat, lon, zoom);\n if (M.options.announceMovement) this._map.announceMovement.enable();\n // required to delay until map-extent.disabled is correctly set\n // which happens as a result of layer-._validateDisabled()\n // which happens so much we have to delay until they calls are\n // completed\n setTimeout(() => {\n this.dispatchEvent(new CustomEvent('map-projectionchange'));\n }, 0);\n });\n };\n if (\n newValue &&\n this._map &&\n this._map.options.projection !== newValue\n ) {\n const connect = reconnectLayers.bind(this);\n connect().then(() => {\n if (this._map && this._map.options.projection !== oldValue) {\n // this doesn't completely work either\n this._resetHistory();\n }\n if (this._debug) for (let i = 0; i < 2; i++) this.toggleDebug();\n });\n }\n break;\n }\n }\n\n // Creates All map controls and adds them to the map, when created.\n _createControls() {\n let mapSize = this._map.getSize().y,\n totalSize = 0;\n\n this._layerControl = M.layerControl(null, {\n collapsed: true,\n mapEl: this\n }).addTo(this._map);\n this._map.on('movestart', this._layerControl.collapse, this._layerControl);\n\n let scaleValue = M.options.announceScale;\n\n if (scaleValue === 'metric') {\n scaleValue = { metric: true, imperial: false };\n }\n if (scaleValue === 'imperial') {\n scaleValue = { metric: false, imperial: true };\n }\n\n if (!this._scaleBar)\n this._scaleBar = M.scaleBar(scaleValue).addTo(this._map);\n\n // Only add controls if there is enough top left vertical space\n if (!this._zoomControl && totalSize + 93 <= mapSize) {\n totalSize += 93;\n this._zoomControl = L.control.zoom().addTo(this._map);\n }\n if (!this._reloadButton && totalSize + 49 <= mapSize) {\n totalSize += 49;\n this._reloadButton = M.reloadButton().addTo(this._map);\n }\n if (!this._fullScreenControl && totalSize + 49 <= mapSize) {\n totalSize += 49;\n this._fullScreenControl = M.fullscreenButton().addTo(this._map);\n }\n\n if (!this._geolocationButton) {\n this._geolocationButton = M.geolocationButton().addTo(this._map);\n }\n }\n\n // Sets controls by hiding/unhiding them based on the map attribute\n _toggleControls() {\n if (this.controls === false) {\n this._hideControls();\n this._map.contextMenu.toggleContextMenuItem('Controls', 'disabled');\n } else {\n this._showControls();\n this._map.contextMenu.toggleContextMenuItem('Controls', 'enabled');\n }\n }\n\n _hideControls() {\n this._setControlsVisibility('fullscreen', true);\n this._setControlsVisibility('layercontrol', true);\n this._setControlsVisibility('reload', true);\n this._setControlsVisibility('zoom', true);\n this._setControlsVisibility('geolocation', true);\n this._setControlsVisibility('scale', true);\n }\n _showControls() {\n this._setControlsVisibility('fullscreen', false);\n this._setControlsVisibility('layercontrol', false);\n this._setControlsVisibility('reload', false);\n this._setControlsVisibility('zoom', false);\n this._setControlsVisibility('geolocation', true);\n this._setControlsVisibility('scale', false);\n\n // prune the controls shown if necessary\n // this logic could be embedded in _showControls\n // but would require being able to iterate the domain of supported tokens\n // for the controlslist\n if (this._controlsList) {\n this._controlsList.forEach((value) => {\n switch (value.toLowerCase()) {\n case 'nofullscreen':\n this._setControlsVisibility('fullscreen', true);\n break;\n case 'nolayer':\n this._setControlsVisibility('layercontrol', true);\n break;\n case 'noreload':\n this._setControlsVisibility('reload', true);\n break;\n case 'nozoom':\n this._setControlsVisibility('zoom', true);\n break;\n case 'geolocation':\n this._setControlsVisibility('geolocation', false);\n break;\n case 'noscale':\n this._setControlsVisibility('scale', true);\n break;\n }\n });\n }\n if (this._layerControl && this._layerControl._layers.length === 0) {\n this._layerControl._container.setAttribute('hidden', '');\n }\n }\n\n // delete the map controls that are private properties of this custom element\n _deleteControls() {\n delete this._layerControl;\n delete this._zoomControl;\n delete this._reloadButton;\n delete this._fullScreenControl;\n delete this._geolocationButton;\n delete this._scaleBar;\n }\n // Sets the control's visibility AND all its childrens visibility,\n // for the control element based on the Boolean hide parameter\n _setControlsVisibility(control, hide) {\n let container;\n switch (control) {\n case 'zoom':\n if (this._zoomControl) {\n container = this._zoomControl._container;\n }\n break;\n case 'reload':\n if (this._reloadButton) {\n container = this._reloadButton._container;\n }\n break;\n case 'fullscreen':\n if (this._fullScreenControl) {\n container = this._fullScreenControl._container;\n }\n break;\n case 'layercontrol':\n if (this._layerControl) {\n container = this._layerControl._container;\n }\n break;\n case 'geolocation':\n if (this._geolocationButton) {\n container = this._geolocationButton._container;\n }\n break;\n case 'scale':\n if (this._scaleBar) {\n container = this._scaleBar._container;\n }\n break;\n }\n if (container) {\n if (hide) {\n // setting the visibility for all the children of the element\n [...container.children].forEach((childEl) => {\n childEl.setAttribute('hidden', '');\n });\n container.setAttribute('hidden', '');\n } else {\n // setting the visibility for all the children of the element\n [...container.children].forEach((childEl) => {\n childEl.removeAttribute('hidden');\n });\n container.removeAttribute('hidden');\n }\n }\n }\n _toggleStatic() {\n const isStatic = this.hasAttribute('static');\n if (this._map) {\n if (isStatic) {\n this._map.dragging.disable();\n this._map.touchZoom.disable();\n this._map.doubleClickZoom.disable();\n this._map.scrollWheelZoom.disable();\n this._map.boxZoom.disable();\n this._map.keyboard.disable();\n this._zoomControl.disable();\n } else {\n this._map.dragging.enable();\n this._map.touchZoom.enable();\n this._map.doubleClickZoom.enable();\n this._map.scrollWheelZoom.enable();\n this._map.boxZoom.enable();\n this._map.keyboard.enable();\n this._zoomControl.enable();\n }\n }\n }\n\n _dropHandler(event) {\n event.preventDefault();\n let text = event.dataTransfer.getData('text');\n M._pasteLayer(this, text);\n }\n _dragoverHandler(event) {\n event.preventDefault();\n event.dataTransfer.dropEffect = 'copy';\n }\n _removeEvents() {\n if (this._map) {\n this._map.off();\n this.removeEventListener('drop', this._dropHandler, false);\n this.removeEventListener('dragover', this._dragoverHandler, false);\n }\n }\n _setUpEvents() {\n this.addEventListener('drop', this._dropHandler, false);\n this.addEventListener('dragover', this._dragoverHandler, false);\n this.addEventListener(\n 'change',\n function (e) {\n if (e.target.tagName === 'LAYER-') {\n this.dispatchEvent(\n new CustomEvent('layerchange', {\n details: { target: this, originalEvent: e }\n })\n );\n }\n },\n false\n );\n\n this.parentElement.addEventListener('keyup', function (e) {\n if (\n e.keyCode === 9 &&\n document.activeElement.nodeName === 'MAPML-VIEWER'\n ) {\n document.activeElement.dispatchEvent(\n new CustomEvent('mapfocused', { detail: { target: this } })\n );\n }\n });\n // pasting layer-, links and geojson using Ctrl+V\n this.addEventListener('keydown', function (e) {\n if (e.keyCode === 86 && e.ctrlKey) {\n navigator.clipboard.readText().then((layer) => {\n M._pasteLayer(this, layer);\n });\n // Prevents default spacebar event on all of mapml-viewer\n } else if (\n e.keyCode === 32 &&\n this.shadowRoot.activeElement.nodeName !== 'INPUT'\n ) {\n e.preventDefault();\n this._map.fire('keypress', { originalEvent: e });\n }\n });\n this.parentElement.addEventListener('mousedown', function (e) {\n if (document.activeElement.nodeName === 'MAPML-VIEWER') {\n document.activeElement.dispatchEvent(\n new CustomEvent('mapfocused', { detail: { target: this } })\n );\n }\n });\n\n this._map.on(\n 'locationfound',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('maplocationfound', {\n detail: { latlng: e.latlng, accuracy: e.accuracy }\n })\n );\n },\n this\n );\n this._map.on(\n 'locationerror',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('locationerror', { detail: { error: e.message } })\n );\n },\n this\n );\n this._map.on(\n 'load',\n function () {\n this.dispatchEvent(\n new CustomEvent('load', { detail: { target: this } })\n );\n },\n this\n );\n this._map.on(\n 'preclick',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('preclick', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'click',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('click', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'dblclick',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('dblclick', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'mousemove',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('mousemove', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'mouseover',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('mouseover', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'mouseout',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('mouseout', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'mousedown',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('mousedown', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'mouseup',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('mouseup', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'contextmenu',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('contextmenu', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'movestart',\n function () {\n this.dispatchEvent(\n new CustomEvent('movestart', { detail: { target: this } })\n );\n },\n this\n );\n this._map.on(\n 'move',\n function () {\n this.dispatchEvent(\n new CustomEvent('move', { detail: { target: this } })\n );\n },\n this\n );\n this._map.on(\n 'moveend',\n function () {\n this._updateMapCenter();\n this._addToHistory();\n this.dispatchEvent(\n new CustomEvent('map-moveend', { detail: { target: this } })\n );\n },\n this\n );\n this._map.on(\n 'zoomstart',\n function () {\n this.dispatchEvent(\n new CustomEvent('zoomstart', { detail: { target: this } })\n );\n },\n this\n );\n this._map.on(\n 'zoom',\n function () {\n this.dispatchEvent(\n new CustomEvent('zoom', { detail: { target: this } })\n );\n },\n this\n );\n this._map.on(\n 'zoomend',\n function () {\n this._updateMapCenter();\n this.dispatchEvent(\n new CustomEvent('zoomend', { detail: { target: this } })\n );\n },\n this\n );\n const setMapMinAndMaxZoom = ((e) => {\n this.whenLayersReady().then(() => {\n if (e && e.layer._layerEl) {\n this._map.setMaxZoom(this.extent.zoom.maxZoom);\n this._map.setMinZoom(this.extent.zoom.minZoom);\n }\n });\n }).bind(this);\n this.whenLayersReady().then(() => {\n this._map.setMaxZoom(this.extent.zoom.maxZoom);\n this._map.setMinZoom(this.extent.zoom.minZoom);\n this._map.on('layeradd layerremove', setMapMinAndMaxZoom, this);\n });\n this.addEventListener('fullscreenchange', function (event) {\n if (document.fullscreenElement === null) {\n // full-screen mode has been exited\n this._map.contextMenu.setViewFullScreenInnerHTML('view');\n } else {\n this._map.contextMenu.setViewFullScreenInnerHTML('exit');\n }\n });\n this.addEventListener('keydown', function (event) {\n if (document.activeElement.nodeName === 'MAPML-VIEWER') {\n // Check if Ctrl+R is pressed and map is focused\n if (event.ctrlKey && event.keyCode === 82) {\n // Prevent default browser behavior\n event.preventDefault();\n this.reload();\n } else if (event.altKey && event.keyCode === 39) {\n // Prevent default browser behavior\n event.preventDefault();\n this.forward();\n } else if (event.altKey && event.keyCode === 37) {\n // Prevent default browser behavior\n event.preventDefault();\n this.back();\n }\n }\n });\n }\n\n locate(options) {\n //options: https://leafletjs.com/reference.html#locate-options\n if (this._geolocationButton) {\n this._geolocationButton.stop();\n }\n if (options) {\n if (options.zoomTo) {\n options.setView = options.zoomTo;\n delete options.zoomTo;\n }\n this._map.locate(options);\n } else {\n this._map.locate({ setView: true, maxZoom: 16 });\n }\n }\n\n toggleDebug() {\n if (this._debug) {\n this._debug.remove();\n this._debug = undefined;\n } else {\n this._debug = M.debugOverlay().addTo(this._map);\n }\n }\n\n _changeWidth(width) {\n if (this._container) {\n this._container.style.width = width + 'px';\n this.shadowRoot.styleSheets[0].cssRules[0].style.width = width + 'px';\n }\n if (this._map) {\n this._map.invalidateSize(false);\n }\n }\n _changeHeight(height) {\n if (this._container) {\n this._container.style.height = height + 'px';\n this.shadowRoot.styleSheets[0].cssRules[0].style.height = height + 'px';\n }\n if (this._map) {\n this._map.invalidateSize(false);\n }\n }\n zoomTo(lat, lon, zoom) {\n zoom = Number.isInteger(+zoom) ? +zoom : this.zoom;\n let location = new L.LatLng(+lat, +lon);\n this._map.setView(location, zoom);\n this.zoom = zoom;\n this.lat = location.lat;\n this.lon = location.lng;\n }\n _updateMapCenter() {\n // remember to tell Leaflet event handler that 'this' in here refers to\n // something other than the map in this case the custom polymer element\n this.lat = this._map.getCenter().lat;\n this.lon = this._map.getCenter().lng;\n this.zoom = this._map.getZoom();\n }\n _resetHistory() {\n this._history = [];\n this._historyIndex = -1;\n this._traversalCall = false;\n // weird but ok\n this._addToHistory();\n }\n /**\n * Adds to the maps history on moveends\n * @private\n */\n _addToHistory() {\n if (this._traversalCall > 0) {\n // this._traversalCall tracks how many consecutive moveends to ignore from history\n this._traversalCall--; // this is useful for ignoring moveends corresponding to back, forward and reload\n return;\n }\n\n let mapLocation = this._map.getPixelBounds().getCenter();\n let location = {\n zoom: this._map.getZoom(),\n x: mapLocation.x,\n y: mapLocation.y\n };\n this._historyIndex++;\n this._history.splice(this._historyIndex, 0, location);\n // Remove future history and overwrite it when map pan/zoom while inside history\n if (this._historyIndex + 1 !== this._history.length) {\n this._history.length = this._historyIndex + 1;\n }\n if (this._historyIndex === 0) {\n // when at initial state of map, disable back, forward, and reload items\n this._map.contextMenu.toggleContextMenuItem('Back', 'disabled'); // back contextmenu item\n this._map.contextMenu.toggleContextMenuItem('Forward', 'disabled'); // forward contextmenu item\n this._map.contextMenu.toggleContextMenuItem('Reload', 'disabled'); // reload contextmenu item\n this._reloadButton?.disable();\n } else {\n this._map.contextMenu.toggleContextMenuItem('Back', 'enabled'); // back contextmenu item\n this._map.contextMenu.toggleContextMenuItem('Forward', 'disabled'); // forward contextmenu item\n this._map.contextMenu.toggleContextMenuItem('Reload', 'enabled'); // reload contextmenu item\n this._reloadButton?.enable();\n }\n }\n /**\n * Allow user to move back in history\n */\n back() {\n let history = this._history;\n let curr = history[this._historyIndex];\n\n if (this._historyIndex > 0) {\n this._map.contextMenu.toggleContextMenuItem('Forward', 'enabled'); // forward contextmenu item\n this._historyIndex--;\n let prev = history[this._historyIndex];\n // Disable back, reload contextmenu item when at the end of history\n if (this._historyIndex === 0) {\n this._map.contextMenu.toggleContextMenuItem('Back', 'disabled'); // back contextmenu item\n this._map.contextMenu.toggleContextMenuItem('Reload', 'disabled'); // reload contextmenu item\n this._reloadButton?.disable();\n }\n\n if (prev.zoom !== curr.zoom) {\n this._traversalCall = 2; // allows the next 2 moveends to be ignored from history\n\n let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level\n let prevScale = this._map.options.crs.scale(prev.zoom); // gets the scale of the previous zoom level\n\n let scale = currScale / prevScale; // used to convert the previous pixel location to be in terms of the current zoom level\n\n this._map.panBy([prev.x * scale - curr.x, prev.y * scale - curr.y], {\n animate: false\n });\n this._map.setZoom(prev.zoom);\n } else {\n this._traversalCall = 1;\n this._map.panBy([prev.x - curr.x, prev.y - curr.y]);\n }\n }\n }\n\n /**\n * Allows user to move forward in history\n */\n forward() {\n let history = this._history;\n let curr = history[this._historyIndex];\n if (this._historyIndex < history.length - 1) {\n this._map.contextMenu.toggleContextMenuItem('Back', 'enabled'); // back contextmenu item\n this._map.contextMenu.toggleContextMenuItem('Reload', 'enabled'); // reload contextmenu item\n this._reloadButton?.enable();\n this._historyIndex++;\n let next = history[this._historyIndex];\n // disable forward contextmenu item, when at the end of forward history\n if (this._historyIndex + 1 === this._history.length) {\n this._map.contextMenu.toggleContextMenuItem('Forward', 'disabled'); // forward contextmenu item\n }\n\n if (next.zoom !== curr.zoom) {\n this._traversalCall = 2; // allows the next 2 moveends to be ignored from history\n\n let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level\n let nextScale = this._map.options.crs.scale(next.zoom); // gets the scale of the next zoom level\n\n let scale = currScale / nextScale; // used to convert the next pixel location to be in terms of the current zoom level\n\n this._map.panBy([next.x * scale - curr.x, next.y * scale - curr.y], {\n animate: false\n });\n this._map.setZoom(next.zoom);\n } else {\n this._traversalCall = 1;\n this._map.panBy([next.x - curr.x, next.y - curr.y]);\n }\n }\n }\n\n /**\n * Allows the user to reload/reset the map's location to it's initial location\n */\n reload() {\n let initialLocation = this._history.shift();\n let mapLocation = this._map.getPixelBounds().getCenter();\n let curr = {\n zoom: this._map.getZoom(),\n x: mapLocation.x,\n y: mapLocation.y\n };\n\n this._map.contextMenu.toggleContextMenuItem('Back', 'disabled'); // back contextmenu item\n this._map.contextMenu.toggleContextMenuItem('Forward', 'disabled'); // forward contextmenu item\n this._map.contextMenu.toggleContextMenuItem('Reload', 'disabled'); // reload contextmenu item\n this._reloadButton?.disable();\n\n this._history = [initialLocation];\n this._historyIndex = 0;\n\n if (initialLocation.zoom !== curr.zoom) {\n this._traversalCall = 2; // ignores the next 2 moveend events\n\n let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level\n let initScale = this._map.options.crs.scale(initialLocation.zoom); // gets the scale of the initial location's zoom\n\n let scale = currScale / initScale;\n\n this._map.panBy(\n [\n initialLocation.x * scale - curr.x,\n initialLocation.y * scale - curr.y\n ],\n { animate: false }\n );\n this._map.setZoom(initialLocation.zoom);\n } else {\n // if it's on the same zoom level as the initial location, no need to calculate scales\n this._traversalCall = 1;\n this._map.panBy([initialLocation.x - curr.x, initialLocation.y - curr.y]);\n }\n this._map.getContainer().focus();\n }\n\n _toggleFullScreen() {\n this._map.toggleFullscreen();\n }\n\n viewSource() {\n let blob = new Blob([this._source], { type: 'text/plain' }),\n url = URL.createObjectURL(blob);\n window.open(url);\n URL.revokeObjectURL(url);\n }\n\n defineCustomProjection(jsonTemplate) {\n let t = JSON.parse(jsonTemplate);\n if (\n t === undefined ||\n !t.proj4string ||\n !t.projection ||\n !t.resolutions ||\n !t.origin ||\n !t.bounds\n )\n throw new Error('Incomplete TCRS Definition');\n if (t.projection.indexOf(':') >= 0)\n throw new Error('\":\" is not permitted in projection name');\n if (M[t.projection.toUpperCase()]) return t.projection.toUpperCase();\n let tileSize = [256, 512, 1024, 2048, 4096].includes(t.tilesize)\n ? t.tilesize\n : M.TILE_SIZE;\n\n M[t.projection] = new L.Proj.CRS(t.projection, t.proj4string, {\n origin: t.origin,\n resolutions: t.resolutions,\n bounds: L.bounds(t.bounds),\n crs: {\n tcrs: {\n horizontal: {\n name: 'x',\n min: 0,\n max: (zoom) =>\n Math.round(\n M[t.projection].options.bounds.getSize().x /\n M[t.projection].options.resolutions[zoom]\n )\n },\n vertical: {\n name: 'y',\n min: 0,\n max: (zoom) =>\n Math.round(\n M[t.projection].options.bounds.getSize().y /\n M[t.projection].options.resolutions[zoom]\n )\n },\n bounds: (zoom) =>\n L.bounds(\n [\n M[t.projection].options.crs.tcrs.horizontal.min,\n M[t.projection].options.crs.tcrs.vertical.min\n ],\n [\n M[t.projection].options.crs.tcrs.horizontal.max(zoom),\n M[t.projection].options.crs.tcrs.vertical.max(zoom)\n ]\n )\n },\n pcrs: {\n horizontal: {\n name: 'easting',\n get min() {\n return M[t.projection].options.bounds.min.x;\n },\n get max() {\n return M[t.projection].options.bounds.max.x;\n }\n },\n vertical: {\n name: 'northing',\n get min() {\n return M[t.projection].options.bounds.min.y;\n },\n get max() {\n return M[t.projection].options.bounds.max.y;\n }\n },\n get bounds() {\n return M[t.projection].options.bounds;\n }\n },\n gcrs: {\n horizontal: {\n name: 'longitude',\n // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25\n get min() {\n return M[t.projection].unproject(M.OSMTILE.options.bounds.min)\n .lng;\n },\n get max() {\n return M[t.projection].unproject(M.OSMTILE.options.bounds.max)\n .lng;\n }\n },\n vertical: {\n name: 'latitude',\n // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25\n get min() {\n return M[t.projection].unproject(M.OSMTILE.options.bounds.min)\n .lat;\n },\n get max() {\n return M[t.projection].unproject(M.OSMTILE.options.bounds.max)\n .lat;\n }\n },\n get bounds() {\n return L.latLngBounds(\n [\n M[t.projection].options.crs.gcrs.vertical.min,\n M[t.projection].options.crs.gcrs.horizontal.min\n ],\n [\n M[t.projection].options.crs.gcrs.vertical.max,\n M[t.projection].options.crs.gcrs.horizontal.max\n ]\n );\n }\n },\n map: {\n horizontal: {\n name: 'i',\n min: 0,\n max: (map) => map.getSize().x\n },\n vertical: {\n name: 'j',\n min: 0,\n max: (map) => map.getSize().y\n },\n bounds: (map) => L.bounds(L.point([0, 0]), map.getSize())\n },\n tile: {\n horizontal: {\n name: 'i',\n min: 0,\n max: tileSize\n },\n vertical: {\n name: 'j',\n min: 0,\n max: tileSize\n },\n get bounds() {\n return L.bounds(\n [\n M[t.projection].options.crs.tile.horizontal.min,\n M[t.projection].options.crs.tile.vertical.min\n ],\n [\n M[t.projection].options.crs.tile.horizontal.max,\n M[t.projection].options.crs.tile.vertical.max\n ]\n );\n }\n },\n tilematrix: {\n horizontal: {\n name: 'column',\n min: 0,\n max: (zoom) =>\n Math.round(\n M[t.projection].options.crs.tcrs.horizontal.max(zoom) /\n M[t.projection].options.crs.tile.bounds.getSize().x\n )\n },\n vertical: {\n name: 'row',\n min: 0,\n max: (zoom) =>\n Math.round(\n M[t.projection].options.crs.tcrs.vertical.max(zoom) /\n M[t.projection].options.crs.tile.bounds.getSize().y\n )\n },\n bounds: (zoom) =>\n L.bounds(\n [\n M[t.projection].options.crs.tilematrix.horizontal.min,\n M[t.projection].options.crs.tilematrix.vertical.min\n ],\n [\n M[t.projection].options.crs.tilematrix.horizontal.max(zoom),\n M[t.projection].options.crs.tilematrix.vertical.max(zoom)\n ]\n )\n }\n }\n }); //creates crs using L.Proj\n M[t.projection.toUpperCase()] = M[t.projection]; //adds the projection uppercase to global M\n return t.projection;\n }\n whenReady() {\n return new Promise((resolve, reject) => {\n let interval, failureTimer;\n if (this._map) {\n resolve();\n } else {\n let viewer = this;\n interval = setInterval(testForMap, 200, viewer);\n failureTimer = setTimeout(mapNotDefined, 5000);\n }\n function testForMap(viewer) {\n if (viewer._map) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n resolve();\n }\n }\n function mapNotDefined() {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('Timeout reached waiting for map to be ready');\n }\n });\n }\n whenLayersReady() {\n let layersReady = [];\n // check if all the children elements (map-extent, map-feature) of all layer- are ready\n for (let layer of [...this.layers]) {\n layersReady.push(layer.whenReady());\n }\n return Promise.allSettled(layersReady);\n }\n whenProjectionDefined(projection) {\n return new Promise((resolve, reject) => {\n let interval, failureTimer;\n if (M[projection]) {\n resolve();\n } else {\n interval = setInterval(testForProjection, 200, projection);\n failureTimer = setTimeout(projectionNotDefined, 5000);\n }\n function testForProjection(p) {\n if (M[p]) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n resolve();\n }\n }\n function projectionNotDefined() {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('Timeout reached waiting for projection to be defined');\n }\n });\n }\n geojson2mapml(json, options = {}) {\n if (options.projection === undefined) {\n options.projection = this.projection;\n }\n let geojsonLayer = M.geojson2mapml(json, options);\n this.appendChild(geojsonLayer);\n return geojsonLayer;\n }\n}\n// need to provide options { extends: ... } for custom built-in elements\nwindow.customElements.define('mapml-viewer', MapViewer);\nwindow.customElements.define('layer-', MapLayer);\nwindow.customElements.define('map-caption', MapCaption);\nwindow.customElements.define('map-feature', MapFeature);\nwindow.customElements.define('map-extent', MapExtent);\nwindow.customElements.define('map-input', MapInput);\nwindow.customElements.define('map-select', MapSelect);\nwindow.customElements.define('map-link', MapLink);\nwindow.customElements.define('map-style', MapStyle);\n"],"names":["MapLayer","MapCaption","MapFeature","MapExtent","MapInput","MapSelect","MapLink","MapStyle","MapViewer","HTMLElement","observedAttributes","controls","this","hasAttribute","value","Boolean","setAttribute","removeAttribute","controlsList","_controlsList","width","window","getComputedStyle","replace","val","height","lat","getAttribute","lon","projection","whenProjectionDefined","then","catch","Error","zoom","parsedVal","parseInt","isNaN","layers","getElementsByTagName","extent","let","map","_map","pcrsBounds","M","pixelToPCRSBounds","getPixelBounds","getZoom","options","formattedExtent","_convertAndFormatPCRS","crs","minZoom","Infinity","maxZoom","i","length","getMinZoom","getMaxZoom","static","constructor","super","_source","outerHTML","_history","_historyIndex","_traversalCall","connectedCallback","_initShadowRoot","DOMTokenList","s","wpx","hpx","w","h","_changeWidth","_changeHeight","_createMap","_toggleStatic","mapcaption","querySelector","setTimeout","innerHTML","mapCaptionObserver","MutationObserver","observe","childList","shadowRoot","attachShadow","mode","tmpl","document","createElement","URL","import","meta","url","href","_container","insertAdjacentHTML","mapDefaultCSS","hideElementsCSS","appendChild","content","cloneNode","L","center","LatLng","resolutions","query","contextMenu","announceMovement","featureIndex","mapEl","zoomControl","_addToHistory","_createControls","_toggleControls","_crosshair","crosshair","addTo","featureIndexOverlayOption","_featureIndexOverlay","featureIndexOverlay","_setUpEvents","disconnectedCallback","_removeEvents","firstChild","removeChild","_deleteControls","adoptedCallback","attributeChangedCallback","name","oldValue","newValue","valueSet","_hideControls","_showControls","connect","layersReady","disable","layer","querySelectorAll","reAttach","push","whenReady","Promise","allSettled","zoomTo","enable","dispatchEvent","CustomEvent","bind","_resetHistory","_debug","toggleDebug","mapSize","getSize","y","totalSize","_layerControl","layerControl","collapsed","on","collapse","scaleValue","announceScale","metric","imperial","_scaleBar","scaleBar","_zoomControl","control","_reloadButton","reloadButton","_fullScreenControl","fullscreenButton","_geolocationButton","geolocationButton","toggleContextMenuItem","_setControlsVisibility","forEach","toLowerCase","_layers","hide","container","children","childEl","isStatic","dragging","touchZoom","doubleClickZoom","scrollWheelZoom","boxZoom","keyboard","_dropHandler","event","preventDefault","text","dataTransfer","getData","_pasteLayer","_dragoverHandler","dropEffect","off","removeEventListener","addEventListener","e","target","tagName","details","originalEvent","parentElement","keyCode","activeElement","nodeName","detail","ctrlKey","navigator","clipboard","readText","fire","latlng","accuracy","error","message","lng","x","containerPoint","_updateMapCenter","setMapMinAndMaxZoom","whenLayersReady","_layerEl","setMaxZoom","setMinZoom","fullscreenElement","setViewFullScreenInnerHTML","reload","altKey","forward","back","locate","stop","setView","remove","undefined","debugOverlay","style","styleSheets","cssRules","invalidateSize","Number","isInteger","location","getCenter","mapLocation","splice","prev","history","curr","scale","panBy","animate","setZoom","next","initialLocation","shift","getContainer","focus","_toggleFullScreen","toggleFullscreen","viewSource","blob","Blob","type","createObjectURL","open","revokeObjectURL","defineCustomProjection","jsonTemplate","t","JSON","parse","proj4string","origin","bounds","indexOf","toUpperCase","tileSize","includes","tilesize","TILE_SIZE","Proj","CRS","tcrs","horizontal","min","max","Math","round","vertical","pcrs","gcrs","unproject","OSMTILE","latLngBounds","point","tile","tilematrix","resolve","reject","interval","failureTimer","setInterval","viewer","clearInterval","clearTimeout","p","geojson2mapml","json","geojsonLayer","customElements","define"],"mappings":";;+CAESA,iCACAC,yCACAC,yCACAC,uCACAC,qCACAC,uCACAC,mCACAC,oCAEIC,kBAAkBC,YAC7BC,gCACE,MAAO,CACL,MACA,MACA,OACA,aACA,QACA,SACA,WACA,SACA,gBAQJC,eACE,OAAOC,KAAKC,aAAa,YAE3BF,aAAaG,GACSC,QAAQD,GAE1BF,KAAKI,aAAa,WAAY,IAE9BJ,KAAKK,gBAAgB,YAGzB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AcJ,GACdK,aAAaJ,GACbF,EAAO,yDAZyC,QAgBtDQ,cAAcC,EAAM/Q,EAAU,SACDqM,IAAvBrM,EAAQpB,aACVoB,EAAQpB,WAAajB,KAAKiB,YAExBoS,EAAepR,EAAEkR,cAAcC,EAAM/Q,GAEzC,OADArC,KAAK2F,YAAY0N,GACVA,GAIX5S,OAAO6S,eAAeC,OAAO,eAAgB3T,WAC7Ca,OAAO6S,eAAeC,OAAO,SAAUnU,UACvCqB,OAAO6S,eAAeC,OAAO,cAAelU,YAC5CoB,OAAO6S,eAAeC,OAAO,cAAejU,YAC5CmB,OAAO6S,eAAeC,OAAO,aAAchU,WAC3CkB,OAAO6S,eAAeC,OAAO,YAAa/T,UAC1CiB,OAAO6S,eAAeC,OAAO,aAAc9T,WAC3CgB,OAAO6S,eAAeC,OAAO,WAAY7T,SACzCe,OAAO6S,eAAeC,OAAO,YAAa5T,iBA74C7BC"} \ No newline at end of file +{"version":3,"file":"mapml-viewer.js","sources":["../src/mapml-viewer.js"],"sourcesContent":["import './leaflet.js'; // bundled with proj4, proj4leaflet, modularized\nimport './mapml.js';\nimport { MapLayer } from './layer.js';\nimport { MapCaption } from './map-caption.js';\nimport { MapFeature } from './map-feature.js';\nimport { MapExtent } from './map-extent.js';\nimport { MapInput } from './map-input.js';\nimport { MapSelect } from './map-select.js';\nimport { MapLink } from './map-link.js';\nimport { MapStyle } from './map-style.js';\n\nexport class MapViewer extends HTMLElement {\n static get observedAttributes() {\n return [\n 'lat',\n 'lon',\n 'zoom',\n 'projection',\n 'width',\n 'height',\n 'controls',\n 'static',\n 'controlslist'\n ];\n }\n // see comments below regarding attributeChangedCallback vs. getter/setter\n // usage. Effectively, the user of the element must use the property, not\n // the getAttribute/setAttribute/removeAttribute DOM API, because the latter\n // calls don't result in the getter/setter being called (so you have to use\n // the getter/setter directly)\n get controls() {\n return this.hasAttribute('controls');\n }\n set controls(value) {\n const hasControls = Boolean(value);\n if (hasControls) {\n this.setAttribute('controls', '');\n } else {\n this.removeAttribute('controls');\n }\n }\n get controlsList() {\n return this._controlsList;\n }\n set controlsList(value) {\n this._controlsList.value = value;\n this.setAttribute('controlslist', value);\n }\n get width() {\n return +window.getComputedStyle(this).width.replace('px', '');\n }\n set width(val) {\n //img.height or img.width setters change or add the corresponding attributes\n this.setAttribute('width', val);\n }\n get height() {\n return +window.getComputedStyle(this).height.replace('px', '');\n }\n set height(val) {\n //img.height or img.width setters change or add the corresponding attributes\n this.setAttribute('height', val);\n }\n get lat() {\n return +(this.hasAttribute('lat') ? this.getAttribute('lat') : 0);\n }\n set lat(val) {\n if (val) {\n this.setAttribute('lat', val);\n }\n }\n get lon() {\n return +(this.hasAttribute('lon') ? this.getAttribute('lon') : 0);\n }\n set lon(val) {\n if (val) {\n this.setAttribute('lon', val);\n }\n }\n get projection() {\n return this.hasAttribute('projection')\n ? this.getAttribute('projection')\n : 'OSMTILE';\n }\n set projection(val) {\n if (val) {\n this.whenProjectionDefined(val)\n .then(() => {\n this.setAttribute('projection', val);\n })\n .catch(() => {\n throw new Error('Undefined projection:' + val);\n });\n }\n }\n get zoom() {\n return +(this.hasAttribute('zoom') ? this.getAttribute('zoom') : 0);\n }\n set zoom(val) {\n var parsedVal = parseInt(val, 10);\n if (!isNaN(parsedVal) && parsedVal >= 0 && parsedVal <= 25) {\n this.setAttribute('zoom', parsedVal);\n }\n }\n get layers() {\n return this.getElementsByTagName('layer-');\n }\n\n get extent() {\n let map = this._map,\n pcrsBounds = M.pixelToPCRSBounds(\n map.getPixelBounds(),\n map.getZoom(),\n map.options.projection\n );\n let formattedExtent = M._convertAndFormatPCRS(\n pcrsBounds,\n map.options.crs,\n this.projection\n );\n // get min/max zoom from layers at this moment\n let minZoom = Infinity,\n maxZoom = -Infinity;\n for (let i = 0; i < this.layers.length; i++) {\n if (this.layers[i].extent) {\n if (this.layers[i].extent.zoom.minZoom < minZoom)\n minZoom = this.layers[i].extent.zoom.minZoom;\n if (this.layers[i].extent.zoom.maxZoom > maxZoom)\n maxZoom = this.layers[i].extent.zoom.maxZoom;\n }\n }\n\n formattedExtent.zoom = {\n minZoom: minZoom !== Infinity ? minZoom : map.getMinZoom(),\n maxZoom: maxZoom !== -Infinity ? maxZoom : map.getMaxZoom()\n };\n return formattedExtent;\n }\n get static() {\n return this.hasAttribute('static');\n }\n set static(value) {\n const isStatic = Boolean(value);\n if (isStatic) this.setAttribute('static', '');\n else this.removeAttribute('static');\n }\n\n constructor() {\n // Always call super first in constructor\n super();\n this._source = this.outerHTML;\n // create an array to track the history of the map and the current index\n this._history = [];\n this._historyIndex = -1;\n this._traversalCall = false;\n }\n connectedCallback() {\n this.whenProjectionDefined(this.projection)\n .then(() => {\n this._initShadowRoot();\n\n this._controlsList = new M.DOMTokenList(\n this.getAttribute('controlslist'),\n this,\n 'controlslist',\n [\n 'noreload',\n 'nofullscreen',\n 'nozoom',\n 'nolayer',\n 'noscale',\n 'geolocation'\n ]\n );\n\n var s = window.getComputedStyle(this),\n wpx = s.width,\n hpx = s.height,\n w = this.hasAttribute('width')\n ? this.getAttribute('width')\n : parseInt(wpx.replace('px', '')),\n h = this.hasAttribute('height')\n ? this.getAttribute('height')\n : parseInt(hpx.replace('px', ''));\n this._changeWidth(w);\n this._changeHeight(h);\n\n this._createMap();\n\n // https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/274\n this.setAttribute('role', 'application');\n this._toggleStatic();\n\n /*\n 1. only deletes aria-label when the last (only remaining) map caption is removed\n 2. only deletes aria-label if the aria-label was defined by the map caption element itself\n */\n\n let mapcaption = this.querySelector('map-caption');\n\n if (mapcaption !== null) {\n setTimeout(() => {\n let ariaupdate = this.getAttribute('aria-label');\n\n if (ariaupdate === mapcaption.innerHTML) {\n this.mapCaptionObserver = new MutationObserver((m) => {\n let mapcaptionupdate = this.querySelector('map-caption');\n if (mapcaptionupdate !== mapcaption) {\n this.removeAttribute('aria-label');\n }\n });\n this.mapCaptionObserver.observe(this, {\n childList: true\n });\n }\n }, 0);\n }\n })\n .catch(() => {\n throw new Error('Projection not defined');\n });\n }\n _initShadowRoot() {\n if (!this.shadowRoot) {\n this.attachShadow({ mode: 'open' });\n }\n let tmpl = document.createElement('template');\n /* jshint ignore:start */\n tmpl.innerHTML = ``;\n /* jshint ignore:end */\n\n let shadowRoot = this.shadowRoot;\n this._container = document.createElement('div');\n\n let output =\n \"\";\n this._container.insertAdjacentHTML('beforeend', output);\n\n // Set default styles for the map element.\n let mapDefaultCSS = document.createElement('style');\n mapDefaultCSS.innerHTML =\n `:host {` +\n `all: initial;` + // Reset properties inheritable from html/body, as some inherited styles may cause unexpected issues with the map element's components (https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/140).\n `contain: layout size;` + // Contain layout and size calculations within the map element.\n `display: inline-block;` + // This together with dimension properties is required so that Leaflet isn't working with a height=0 box by default.\n `height: 150px;` + // Provide a \"default object size\" (https://github.com/Maps4HTML/HTML-Map-Element/issues/31).\n `width: 300px;` +\n `border-width: 2px;` + // Set a default border for contrast, similar to UA default for iframes.\n `border-style: inset;` +\n `}` +\n `:host([frameborder=\"0\"]) {` +\n `border-width: 0;` +\n `}` +\n `:host([hidden]) {` +\n `display: none!important;` +\n `}` +\n `:host .leaflet-control-container {` +\n `visibility: hidden!important;` + // Visibility hack to improve percieved performance (mitigate FOUC) – visibility is unset in mapml.css! (https://github.com/Maps4HTML/Web-Map-Custom-Element/issues/154).\n `}`;\n\n // Hide all (light DOM) children of the map element.\n let hideElementsCSS = document.createElement('style');\n hideElementsCSS.innerHTML =\n `mapml-viewer > * {` + `display: none!important;` + `}`;\n this.appendChild(hideElementsCSS);\n\n // Make the Leaflet container element programmatically identifiable\n // (https://github.com/Leaflet/Leaflet/issues/7193).\n this._container.setAttribute('role', 'region');\n this._container.setAttribute('aria-label', 'Interactive map');\n\n shadowRoot.appendChild(mapDefaultCSS);\n shadowRoot.appendChild(tmpl.content.cloneNode(true));\n shadowRoot.appendChild(this._container);\n }\n _createMap() {\n if (!this._map) {\n this._map = L.map(this._container, {\n center: new L.LatLng(this.lat, this.lon),\n minZoom: 0,\n maxZoom: M[this.projection].options.resolutions.length - 1,\n projection: this.projection,\n query: true,\n contextMenu: true,\n announceMovement: M.options.announceMovement,\n featureIndex: true,\n mapEl: this,\n crs: M[this.projection],\n zoom: this.zoom,\n zoomControl: false\n });\n this._addToHistory();\n\n this._createControls();\n this._toggleControls();\n this._crosshair = M.crosshair().addTo(this._map);\n\n if (M.options.featureIndexOverlayOption)\n this._featureIndexOverlay = M.featureIndexOverlay().addTo(this._map);\n\n this._setUpEvents();\n }\n }\n disconnectedCallback() {\n this._removeEvents();\n while (this.shadowRoot.firstChild) {\n this.shadowRoot.removeChild(this.shadowRoot.firstChild);\n }\n delete this._map;\n this._deleteControls();\n }\n adoptedCallback() {\n // console.log('Custom map element moved to new page.');\n }\n\n attributeChangedCallback(name, oldValue, newValue) {\n // console.log('Attribute: ' + name + ' changed from: '+ oldValue + ' to: '+newValue);\n // \"Best practice\": handle side-effects in this callback\n // https://developers.google.com/web/fundamentals/web-components/best-practices\n // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy\n // note that the example is misleading, since the user can't use\n // setAttribute or removeAttribute to set the property, they need to use\n // the property directly in their API usage, which kinda sucks\n /*\n const hasValue = newValue !== null;\n switch (name) {\n case 'checked':\n // Note the attributeChangedCallback is only handling the *side effects*\n // of setting the attribute.\n this.setAttribute('aria-checked', hasValue);\n break;\n ...\n } */\n switch (name) {\n case 'controlslist':\n if (this._controlsList) {\n if (this._controlsList.valueSet === false) {\n this._controlsList.value = newValue;\n }\n this._toggleControls();\n }\n break;\n case 'controls':\n if (oldValue !== null && newValue === null) {\n this._hideControls();\n } else if (oldValue === null && newValue !== null) {\n this._showControls();\n }\n break;\n case 'height':\n if (oldValue !== newValue) {\n this._changeHeight(newValue);\n }\n break;\n case 'width':\n if (oldValue !== newValue) {\n this._changeWidth(newValue);\n }\n break;\n case 'static':\n this._toggleStatic();\n break;\n case 'projection':\n const reconnectLayers = () => {\n // save map location and zoom\n let lat = this.lat;\n let lon = this.lon;\n let zoom = this.zoom;\n // saving the lat, lon and zoom is necessary because Leaflet seems\n // to try to compensate for the change in the scales for each zoom\n // level in the crs by changing the zoom level of the map when\n // you set the map crs. So, we save the current view for use below\n // when all the layers' reconnections have settled.\n // leaflet doesn't like this: https://github.com/Leaflet/Leaflet/issues/2553\n this._map.options.crs = M[newValue];\n this._map.options.projection = newValue;\n let layersReady = [];\n this._map.announceMovement.disable();\n for (let layer of this.querySelectorAll('layer-')) {\n layer.removeAttribute('disabled');\n let reAttach = this.removeChild(layer);\n this.appendChild(reAttach);\n layersReady.push(reAttach.whenReady());\n }\n return Promise.allSettled(layersReady).then(() => {\n // use the saved map location to ensure it is correct after\n // changing the map CRS. Specifically affects projection\n // upgrades, e.g. https://maps4html.org/experiments/custom-projections/BNG/\n // see leaflet bug: https://github.com/Leaflet/Leaflet/issues/2553\n this.zoomTo(lat, lon, zoom);\n if (M.options.announceMovement) this._map.announceMovement.enable();\n // required to delay until map-extent.disabled is correctly set\n // which happens as a result of layer-._validateDisabled()\n // which happens so much we have to delay until they calls are\n // completed\n setTimeout(() => {\n this.dispatchEvent(new CustomEvent('map-projectionchange'));\n }, 0);\n });\n };\n if (\n newValue &&\n this._map &&\n this._map.options.projection !== newValue\n ) {\n const connect = reconnectLayers.bind(this);\n connect().then(() => {\n if (this._map && this._map.options.projection !== oldValue) {\n // this doesn't completely work either\n this._resetHistory();\n }\n if (this._debug) for (let i = 0; i < 2; i++) this.toggleDebug();\n });\n }\n break;\n }\n }\n\n // Creates All map controls and adds them to the map, when created.\n _createControls() {\n let mapSize = this._map.getSize().y,\n totalSize = 0;\n\n this._layerControl = M.layerControl(null, {\n collapsed: true,\n mapEl: this\n }).addTo(this._map);\n this._map.on('movestart', this._layerControl.collapse, this._layerControl);\n\n let scaleValue = M.options.announceScale;\n\n if (scaleValue === 'metric') {\n scaleValue = { metric: true, imperial: false };\n }\n if (scaleValue === 'imperial') {\n scaleValue = { metric: false, imperial: true };\n }\n\n if (!this._scaleBar)\n this._scaleBar = M.scaleBar(scaleValue).addTo(this._map);\n\n // Only add controls if there is enough top left vertical space\n if (!this._zoomControl && totalSize + 93 <= mapSize) {\n totalSize += 93;\n this._zoomControl = L.control.zoom().addTo(this._map);\n }\n if (!this._reloadButton && totalSize + 49 <= mapSize) {\n totalSize += 49;\n this._reloadButton = M.reloadButton().addTo(this._map);\n }\n if (!this._fullScreenControl && totalSize + 49 <= mapSize) {\n totalSize += 49;\n this._fullScreenControl = M.fullscreenButton().addTo(this._map);\n }\n\n if (!this._geolocationButton) {\n this._geolocationButton = M.geolocationButton().addTo(this._map);\n }\n }\n\n // Sets controls by hiding/unhiding them based on the map attribute\n _toggleControls() {\n if (this.controls === false) {\n this._hideControls();\n this._map.contextMenu.toggleContextMenuItem('Controls', 'disabled');\n } else {\n this._showControls();\n this._map.contextMenu.toggleContextMenuItem('Controls', 'enabled');\n }\n }\n\n _hideControls() {\n this._setControlsVisibility('fullscreen', true);\n this._setControlsVisibility('layercontrol', true);\n this._setControlsVisibility('reload', true);\n this._setControlsVisibility('zoom', true);\n this._setControlsVisibility('geolocation', true);\n this._setControlsVisibility('scale', true);\n }\n _showControls() {\n this._setControlsVisibility('fullscreen', false);\n this._setControlsVisibility('layercontrol', false);\n this._setControlsVisibility('reload', false);\n this._setControlsVisibility('zoom', false);\n this._setControlsVisibility('geolocation', true);\n this._setControlsVisibility('scale', false);\n\n // prune the controls shown if necessary\n // this logic could be embedded in _showControls\n // but would require being able to iterate the domain of supported tokens\n // for the controlslist\n if (this._controlsList) {\n this._controlsList.forEach((value) => {\n switch (value.toLowerCase()) {\n case 'nofullscreen':\n this._setControlsVisibility('fullscreen', true);\n break;\n case 'nolayer':\n this._setControlsVisibility('layercontrol', true);\n break;\n case 'noreload':\n this._setControlsVisibility('reload', true);\n break;\n case 'nozoom':\n this._setControlsVisibility('zoom', true);\n break;\n case 'geolocation':\n this._setControlsVisibility('geolocation', false);\n break;\n case 'noscale':\n this._setControlsVisibility('scale', true);\n break;\n }\n });\n }\n if (this._layerControl && this._layerControl._layers.length === 0) {\n this._layerControl._container.setAttribute('hidden', '');\n }\n }\n\n // delete the map controls that are private properties of this custom element\n _deleteControls() {\n delete this._layerControl;\n delete this._zoomControl;\n delete this._reloadButton;\n delete this._fullScreenControl;\n delete this._geolocationButton;\n delete this._scaleBar;\n }\n // Sets the control's visibility AND all its childrens visibility,\n // for the control element based on the Boolean hide parameter\n _setControlsVisibility(control, hide) {\n let container;\n switch (control) {\n case 'zoom':\n if (this._zoomControl) {\n container = this._zoomControl._container;\n }\n break;\n case 'reload':\n if (this._reloadButton) {\n container = this._reloadButton._container;\n }\n break;\n case 'fullscreen':\n if (this._fullScreenControl) {\n container = this._fullScreenControl._container;\n }\n break;\n case 'layercontrol':\n if (this._layerControl) {\n container = this._layerControl._container;\n }\n break;\n case 'geolocation':\n if (this._geolocationButton) {\n container = this._geolocationButton._container;\n }\n break;\n case 'scale':\n if (this._scaleBar) {\n container = this._scaleBar._container;\n }\n break;\n }\n if (container) {\n if (hide) {\n // setting the visibility for all the children of the element\n [...container.children].forEach((childEl) => {\n childEl.setAttribute('hidden', '');\n });\n container.setAttribute('hidden', '');\n } else {\n // setting the visibility for all the children of the element\n [...container.children].forEach((childEl) => {\n childEl.removeAttribute('hidden');\n });\n container.removeAttribute('hidden');\n }\n }\n }\n _toggleStatic() {\n const isStatic = this.hasAttribute('static');\n if (this._map) {\n if (isStatic) {\n this._map.dragging.disable();\n this._map.touchZoom.disable();\n this._map.doubleClickZoom.disable();\n this._map.scrollWheelZoom.disable();\n this._map.boxZoom.disable();\n this._map.keyboard.disable();\n this._zoomControl.disable();\n } else {\n this._map.dragging.enable();\n this._map.touchZoom.enable();\n this._map.doubleClickZoom.enable();\n this._map.scrollWheelZoom.enable();\n this._map.boxZoom.enable();\n this._map.keyboard.enable();\n this._zoomControl.enable();\n }\n }\n }\n\n _dropHandler(event) {\n event.preventDefault();\n let text = event.dataTransfer.getData('text');\n M._pasteLayer(this, text);\n }\n _dragoverHandler(event) {\n event.preventDefault();\n event.dataTransfer.dropEffect = 'copy';\n }\n _removeEvents() {\n if (this._map) {\n this._map.off();\n this.removeEventListener('drop', this._dropHandler, false);\n this.removeEventListener('dragover', this._dragoverHandler, false);\n }\n }\n _setUpEvents() {\n this.addEventListener('drop', this._dropHandler, false);\n this.addEventListener('dragover', this._dragoverHandler, false);\n this.addEventListener(\n 'change',\n function (e) {\n if (e.target.tagName === 'LAYER-') {\n this.dispatchEvent(\n new CustomEvent('layerchange', {\n details: { target: this, originalEvent: e }\n })\n );\n }\n },\n false\n );\n\n let host =\n this.getRootNode() instanceof ShadowRoot\n ? this.getRootNode().host\n : this.parentElement;\n host.addEventListener('keyup', function (e) {\n if (\n e.keyCode === 9 &&\n document.activeElement.nodeName === 'MAPML-VIEWER'\n ) {\n document.activeElement.dispatchEvent(\n new CustomEvent('mapfocused', { detail: { target: this } })\n );\n }\n });\n // pasting layer-, links and geojson using Ctrl+V\n this.addEventListener('keydown', function (e) {\n if (e.keyCode === 86 && e.ctrlKey) {\n navigator.clipboard.readText().then((layer) => {\n M._pasteLayer(this, layer);\n });\n // Prevents default spacebar event on all of mapml-viewer\n } else if (\n e.keyCode === 32 &&\n this.shadowRoot.activeElement.nodeName !== 'INPUT'\n ) {\n e.preventDefault();\n this._map.fire('keypress', { originalEvent: e });\n }\n });\n host.addEventListener('mousedown', function (e) {\n if (document.activeElement.nodeName === 'MAPML-VIEWER') {\n document.activeElement.dispatchEvent(\n new CustomEvent('mapfocused', { detail: { target: this } })\n );\n }\n });\n\n this._map.on(\n 'locationfound',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('maplocationfound', {\n detail: { latlng: e.latlng, accuracy: e.accuracy }\n })\n );\n },\n this\n );\n this._map.on(\n 'locationerror',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('locationerror', { detail: { error: e.message } })\n );\n },\n this\n );\n this._map.on(\n 'load',\n function () {\n this.dispatchEvent(\n new CustomEvent('load', { detail: { target: this } })\n );\n },\n this\n );\n this._map.on(\n 'preclick',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('preclick', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'click',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('click', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'dblclick',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('dblclick', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'mousemove',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('mousemove', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'mouseover',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('mouseover', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'mouseout',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('mouseout', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'mousedown',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('mousedown', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'mouseup',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('mouseup', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'contextmenu',\n function (e) {\n this.dispatchEvent(\n new CustomEvent('contextmenu', {\n detail: {\n lat: e.latlng.lat,\n lon: e.latlng.lng,\n x: e.containerPoint.x,\n y: e.containerPoint.y\n }\n })\n );\n },\n this\n );\n this._map.on(\n 'movestart',\n function () {\n this.dispatchEvent(\n new CustomEvent('movestart', { detail: { target: this } })\n );\n },\n this\n );\n this._map.on(\n 'move',\n function () {\n this.dispatchEvent(\n new CustomEvent('move', { detail: { target: this } })\n );\n },\n this\n );\n this._map.on(\n 'moveend',\n function () {\n this._updateMapCenter();\n this._addToHistory();\n this.dispatchEvent(\n new CustomEvent('map-moveend', { detail: { target: this } })\n );\n },\n this\n );\n this._map.on(\n 'zoomstart',\n function () {\n this.dispatchEvent(\n new CustomEvent('zoomstart', { detail: { target: this } })\n );\n },\n this\n );\n this._map.on(\n 'zoom',\n function () {\n this.dispatchEvent(\n new CustomEvent('zoom', { detail: { target: this } })\n );\n },\n this\n );\n this._map.on(\n 'zoomend',\n function () {\n this._updateMapCenter();\n this.dispatchEvent(\n new CustomEvent('zoomend', { detail: { target: this } })\n );\n },\n this\n );\n const setMapMinAndMaxZoom = ((e) => {\n this.whenLayersReady().then(() => {\n if (e && e.layer._layerEl) {\n this._map.setMaxZoom(this.extent.zoom.maxZoom);\n this._map.setMinZoom(this.extent.zoom.minZoom);\n }\n });\n }).bind(this);\n this.whenLayersReady().then(() => {\n this._map.setMaxZoom(this.extent.zoom.maxZoom);\n this._map.setMinZoom(this.extent.zoom.minZoom);\n this._map.on('layeradd layerremove', setMapMinAndMaxZoom, this);\n });\n this.addEventListener('fullscreenchange', function (event) {\n if (document.fullscreenElement === null) {\n // full-screen mode has been exited\n this._map.contextMenu.setViewFullScreenInnerHTML('view');\n } else {\n this._map.contextMenu.setViewFullScreenInnerHTML('exit');\n }\n });\n this.addEventListener('keydown', function (event) {\n if (document.activeElement.nodeName === 'MAPML-VIEWER') {\n // Check if Ctrl+R is pressed and map is focused\n if (event.ctrlKey && event.keyCode === 82) {\n // Prevent default browser behavior\n event.preventDefault();\n this.reload();\n } else if (event.altKey && event.keyCode === 39) {\n // Prevent default browser behavior\n event.preventDefault();\n this.forward();\n } else if (event.altKey && event.keyCode === 37) {\n // Prevent default browser behavior\n event.preventDefault();\n this.back();\n }\n }\n });\n }\n\n locate(options) {\n //options: https://leafletjs.com/reference.html#locate-options\n if (this._geolocationButton) {\n this._geolocationButton.stop();\n }\n if (options) {\n if (options.zoomTo) {\n options.setView = options.zoomTo;\n delete options.zoomTo;\n }\n this._map.locate(options);\n } else {\n this._map.locate({ setView: true, maxZoom: 16 });\n }\n }\n\n toggleDebug() {\n if (this._debug) {\n this._debug.remove();\n this._debug = undefined;\n } else {\n this._debug = M.debugOverlay().addTo(this._map);\n }\n }\n\n _changeWidth(width) {\n if (this._container) {\n this._container.style.width = width + 'px';\n this.shadowRoot.styleSheets[0].cssRules[0].style.width = width + 'px';\n }\n if (this._map) {\n this._map.invalidateSize(false);\n }\n }\n _changeHeight(height) {\n if (this._container) {\n this._container.style.height = height + 'px';\n this.shadowRoot.styleSheets[0].cssRules[0].style.height = height + 'px';\n }\n if (this._map) {\n this._map.invalidateSize(false);\n }\n }\n zoomTo(lat, lon, zoom) {\n zoom = Number.isInteger(+zoom) ? +zoom : this.zoom;\n let location = new L.LatLng(+lat, +lon);\n this._map.setView(location, zoom);\n this.zoom = zoom;\n this.lat = location.lat;\n this.lon = location.lng;\n }\n _updateMapCenter() {\n // remember to tell Leaflet event handler that 'this' in here refers to\n // something other than the map in this case the custom polymer element\n this.lat = this._map.getCenter().lat;\n this.lon = this._map.getCenter().lng;\n this.zoom = this._map.getZoom();\n }\n _resetHistory() {\n this._history = [];\n this._historyIndex = -1;\n this._traversalCall = false;\n // weird but ok\n this._addToHistory();\n }\n /**\n * Adds to the maps history on moveends\n * @private\n */\n _addToHistory() {\n if (this._traversalCall > 0) {\n // this._traversalCall tracks how many consecutive moveends to ignore from history\n this._traversalCall--; // this is useful for ignoring moveends corresponding to back, forward and reload\n return;\n }\n\n let mapLocation = this._map.getPixelBounds().getCenter();\n let location = {\n zoom: this._map.getZoom(),\n x: mapLocation.x,\n y: mapLocation.y\n };\n this._historyIndex++;\n this._history.splice(this._historyIndex, 0, location);\n // Remove future history and overwrite it when map pan/zoom while inside history\n if (this._historyIndex + 1 !== this._history.length) {\n this._history.length = this._historyIndex + 1;\n }\n if (this._historyIndex === 0) {\n // when at initial state of map, disable back, forward, and reload items\n this._map.contextMenu.toggleContextMenuItem('Back', 'disabled'); // back contextmenu item\n this._map.contextMenu.toggleContextMenuItem('Forward', 'disabled'); // forward contextmenu item\n this._map.contextMenu.toggleContextMenuItem('Reload', 'disabled'); // reload contextmenu item\n this._reloadButton?.disable();\n } else {\n this._map.contextMenu.toggleContextMenuItem('Back', 'enabled'); // back contextmenu item\n this._map.contextMenu.toggleContextMenuItem('Forward', 'disabled'); // forward contextmenu item\n this._map.contextMenu.toggleContextMenuItem('Reload', 'enabled'); // reload contextmenu item\n this._reloadButton?.enable();\n }\n }\n /**\n * Allow user to move back in history\n */\n back() {\n let history = this._history;\n let curr = history[this._historyIndex];\n\n if (this._historyIndex > 0) {\n this._map.contextMenu.toggleContextMenuItem('Forward', 'enabled'); // forward contextmenu item\n this._historyIndex--;\n let prev = history[this._historyIndex];\n // Disable back, reload contextmenu item when at the end of history\n if (this._historyIndex === 0) {\n this._map.contextMenu.toggleContextMenuItem('Back', 'disabled'); // back contextmenu item\n this._map.contextMenu.toggleContextMenuItem('Reload', 'disabled'); // reload contextmenu item\n this._reloadButton?.disable();\n }\n\n if (prev.zoom !== curr.zoom) {\n this._traversalCall = 2; // allows the next 2 moveends to be ignored from history\n\n let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level\n let prevScale = this._map.options.crs.scale(prev.zoom); // gets the scale of the previous zoom level\n\n let scale = currScale / prevScale; // used to convert the previous pixel location to be in terms of the current zoom level\n\n this._map.panBy([prev.x * scale - curr.x, prev.y * scale - curr.y], {\n animate: false\n });\n this._map.setZoom(prev.zoom);\n } else {\n this._traversalCall = 1;\n this._map.panBy([prev.x - curr.x, prev.y - curr.y]);\n }\n }\n }\n\n /**\n * Allows user to move forward in history\n */\n forward() {\n let history = this._history;\n let curr = history[this._historyIndex];\n if (this._historyIndex < history.length - 1) {\n this._map.contextMenu.toggleContextMenuItem('Back', 'enabled'); // back contextmenu item\n this._map.contextMenu.toggleContextMenuItem('Reload', 'enabled'); // reload contextmenu item\n this._reloadButton?.enable();\n this._historyIndex++;\n let next = history[this._historyIndex];\n // disable forward contextmenu item, when at the end of forward history\n if (this._historyIndex + 1 === this._history.length) {\n this._map.contextMenu.toggleContextMenuItem('Forward', 'disabled'); // forward contextmenu item\n }\n\n if (next.zoom !== curr.zoom) {\n this._traversalCall = 2; // allows the next 2 moveends to be ignored from history\n\n let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level\n let nextScale = this._map.options.crs.scale(next.zoom); // gets the scale of the next zoom level\n\n let scale = currScale / nextScale; // used to convert the next pixel location to be in terms of the current zoom level\n\n this._map.panBy([next.x * scale - curr.x, next.y * scale - curr.y], {\n animate: false\n });\n this._map.setZoom(next.zoom);\n } else {\n this._traversalCall = 1;\n this._map.panBy([next.x - curr.x, next.y - curr.y]);\n }\n }\n }\n\n /**\n * Allows the user to reload/reset the map's location to it's initial location\n */\n reload() {\n let initialLocation = this._history.shift();\n let mapLocation = this._map.getPixelBounds().getCenter();\n let curr = {\n zoom: this._map.getZoom(),\n x: mapLocation.x,\n y: mapLocation.y\n };\n\n this._map.contextMenu.toggleContextMenuItem('Back', 'disabled'); // back contextmenu item\n this._map.contextMenu.toggleContextMenuItem('Forward', 'disabled'); // forward contextmenu item\n this._map.contextMenu.toggleContextMenuItem('Reload', 'disabled'); // reload contextmenu item\n this._reloadButton?.disable();\n\n this._history = [initialLocation];\n this._historyIndex = 0;\n\n if (initialLocation.zoom !== curr.zoom) {\n this._traversalCall = 2; // ignores the next 2 moveend events\n\n let currScale = this._map.options.crs.scale(curr.zoom); // gets the scale of the current zoom level\n let initScale = this._map.options.crs.scale(initialLocation.zoom); // gets the scale of the initial location's zoom\n\n let scale = currScale / initScale;\n\n this._map.panBy(\n [\n initialLocation.x * scale - curr.x,\n initialLocation.y * scale - curr.y\n ],\n { animate: false }\n );\n this._map.setZoom(initialLocation.zoom);\n } else {\n // if it's on the same zoom level as the initial location, no need to calculate scales\n this._traversalCall = 1;\n this._map.panBy([initialLocation.x - curr.x, initialLocation.y - curr.y]);\n }\n this._map.getContainer().focus();\n }\n\n _toggleFullScreen() {\n this._map.toggleFullscreen();\n }\n\n viewSource() {\n let blob = new Blob([this._source], { type: 'text/plain' }),\n url = URL.createObjectURL(blob);\n window.open(url);\n URL.revokeObjectURL(url);\n }\n\n defineCustomProjection(jsonTemplate) {\n let t = JSON.parse(jsonTemplate);\n if (\n t === undefined ||\n !t.proj4string ||\n !t.projection ||\n !t.resolutions ||\n !t.origin ||\n !t.bounds\n )\n throw new Error('Incomplete TCRS Definition');\n if (t.projection.indexOf(':') >= 0)\n throw new Error('\":\" is not permitted in projection name');\n if (M[t.projection.toUpperCase()]) return t.projection.toUpperCase();\n let tileSize = [256, 512, 1024, 2048, 4096].includes(t.tilesize)\n ? t.tilesize\n : M.TILE_SIZE;\n\n M[t.projection] = new L.Proj.CRS(t.projection, t.proj4string, {\n origin: t.origin,\n resolutions: t.resolutions,\n bounds: L.bounds(t.bounds),\n crs: {\n tcrs: {\n horizontal: {\n name: 'x',\n min: 0,\n max: (zoom) =>\n Math.round(\n M[t.projection].options.bounds.getSize().x /\n M[t.projection].options.resolutions[zoom]\n )\n },\n vertical: {\n name: 'y',\n min: 0,\n max: (zoom) =>\n Math.round(\n M[t.projection].options.bounds.getSize().y /\n M[t.projection].options.resolutions[zoom]\n )\n },\n bounds: (zoom) =>\n L.bounds(\n [\n M[t.projection].options.crs.tcrs.horizontal.min,\n M[t.projection].options.crs.tcrs.vertical.min\n ],\n [\n M[t.projection].options.crs.tcrs.horizontal.max(zoom),\n M[t.projection].options.crs.tcrs.vertical.max(zoom)\n ]\n )\n },\n pcrs: {\n horizontal: {\n name: 'easting',\n get min() {\n return M[t.projection].options.bounds.min.x;\n },\n get max() {\n return M[t.projection].options.bounds.max.x;\n }\n },\n vertical: {\n name: 'northing',\n get min() {\n return M[t.projection].options.bounds.min.y;\n },\n get max() {\n return M[t.projection].options.bounds.max.y;\n }\n },\n get bounds() {\n return M[t.projection].options.bounds;\n }\n },\n gcrs: {\n horizontal: {\n name: 'longitude',\n // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25\n get min() {\n return M[t.projection].unproject(M.OSMTILE.options.bounds.min)\n .lng;\n },\n get max() {\n return M[t.projection].unproject(M.OSMTILE.options.bounds.max)\n .lng;\n }\n },\n vertical: {\n name: 'latitude',\n // set min/max axis values from EPSG registry area of use, retrieved 2019-07-25\n get min() {\n return M[t.projection].unproject(M.OSMTILE.options.bounds.min)\n .lat;\n },\n get max() {\n return M[t.projection].unproject(M.OSMTILE.options.bounds.max)\n .lat;\n }\n },\n get bounds() {\n return L.latLngBounds(\n [\n M[t.projection].options.crs.gcrs.vertical.min,\n M[t.projection].options.crs.gcrs.horizontal.min\n ],\n [\n M[t.projection].options.crs.gcrs.vertical.max,\n M[t.projection].options.crs.gcrs.horizontal.max\n ]\n );\n }\n },\n map: {\n horizontal: {\n name: 'i',\n min: 0,\n max: (map) => map.getSize().x\n },\n vertical: {\n name: 'j',\n min: 0,\n max: (map) => map.getSize().y\n },\n bounds: (map) => L.bounds(L.point([0, 0]), map.getSize())\n },\n tile: {\n horizontal: {\n name: 'i',\n min: 0,\n max: tileSize\n },\n vertical: {\n name: 'j',\n min: 0,\n max: tileSize\n },\n get bounds() {\n return L.bounds(\n [\n M[t.projection].options.crs.tile.horizontal.min,\n M[t.projection].options.crs.tile.vertical.min\n ],\n [\n M[t.projection].options.crs.tile.horizontal.max,\n M[t.projection].options.crs.tile.vertical.max\n ]\n );\n }\n },\n tilematrix: {\n horizontal: {\n name: 'column',\n min: 0,\n max: (zoom) =>\n Math.round(\n M[t.projection].options.crs.tcrs.horizontal.max(zoom) /\n M[t.projection].options.crs.tile.bounds.getSize().x\n )\n },\n vertical: {\n name: 'row',\n min: 0,\n max: (zoom) =>\n Math.round(\n M[t.projection].options.crs.tcrs.vertical.max(zoom) /\n M[t.projection].options.crs.tile.bounds.getSize().y\n )\n },\n bounds: (zoom) =>\n L.bounds(\n [\n M[t.projection].options.crs.tilematrix.horizontal.min,\n M[t.projection].options.crs.tilematrix.vertical.min\n ],\n [\n M[t.projection].options.crs.tilematrix.horizontal.max(zoom),\n M[t.projection].options.crs.tilematrix.vertical.max(zoom)\n ]\n )\n }\n }\n }); //creates crs using L.Proj\n M[t.projection.toUpperCase()] = M[t.projection]; //adds the projection uppercase to global M\n return t.projection;\n }\n whenReady() {\n return new Promise((resolve, reject) => {\n let interval, failureTimer;\n if (this._map) {\n resolve();\n } else {\n let viewer = this;\n interval = setInterval(testForMap, 200, viewer);\n failureTimer = setTimeout(mapNotDefined, 5000);\n }\n function testForMap(viewer) {\n if (viewer._map) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n resolve();\n }\n }\n function mapNotDefined() {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('Timeout reached waiting for map to be ready');\n }\n });\n }\n whenLayersReady() {\n let layersReady = [];\n // check if all the children elements (map-extent, map-feature) of all layer- are ready\n for (let layer of [...this.layers]) {\n layersReady.push(layer.whenReady());\n }\n return Promise.allSettled(layersReady);\n }\n whenProjectionDefined(projection) {\n return new Promise((resolve, reject) => {\n let interval, failureTimer;\n if (M[projection]) {\n resolve();\n } else {\n interval = setInterval(testForProjection, 200, projection);\n failureTimer = setTimeout(projectionNotDefined, 5000);\n }\n function testForProjection(p) {\n if (M[p]) {\n clearInterval(interval);\n clearTimeout(failureTimer);\n resolve();\n }\n }\n function projectionNotDefined() {\n clearInterval(interval);\n clearTimeout(failureTimer);\n reject('Timeout reached waiting for projection to be defined');\n }\n });\n }\n geojson2mapml(json, options = {}) {\n if (options.projection === undefined) {\n options.projection = this.projection;\n }\n let geojsonLayer = M.geojson2mapml(json, options);\n this.appendChild(geojsonLayer);\n return geojsonLayer;\n }\n}\n// need to provide options { extends: ... } for custom built-in elements\nwindow.customElements.define('mapml-viewer', MapViewer);\nwindow.customElements.define('layer-', MapLayer);\nwindow.customElements.define('map-caption', MapCaption);\nwindow.customElements.define('map-feature', MapFeature);\nwindow.customElements.define('map-extent', MapExtent);\nwindow.customElements.define('map-input', MapInput);\nwindow.customElements.define('map-select', MapSelect);\nwindow.customElements.define('map-link', MapLink);\nwindow.customElements.define('map-style', MapStyle);\n"],"names":["MapLayer","MapCaption","MapFeature","MapExtent","MapInput","MapSelect","MapLink","MapStyle","MapViewer","HTMLElement","observedAttributes","controls","this","hasAttribute","value","Boolean","setAttribute","removeAttribute","controlsList","_controlsList","width","window","getComputedStyle","replace","val","height","lat","getAttribute","lon","projection","whenProjectionDefined","then","catch","Error","zoom","parsedVal","parseInt","isNaN","layers","getElementsByTagName","extent","let","map","_map","pcrsBounds","M","pixelToPCRSBounds","getPixelBounds","getZoom","options","formattedExtent","_convertAndFormatPCRS","crs","minZoom","Infinity","maxZoom","i","length","getMinZoom","getMaxZoom","static","constructor","super","_source","outerHTML","_history","_historyIndex","_traversalCall","connectedCallback","_initShadowRoot","DOMTokenList","s","wpx","hpx","w","h","_changeWidth","_changeHeight","_createMap","_toggleStatic","mapcaption","querySelector","setTimeout","innerHTML","mapCaptionObserver","MutationObserver","observe","childList","shadowRoot","attachShadow","mode","tmpl","document","createElement","URL","import","meta","url","href","_container","insertAdjacentHTML","mapDefaultCSS","hideElementsCSS","appendChild","content","cloneNode","L","center","LatLng","resolutions","query","contextMenu","announceMovement","featureIndex","mapEl","zoomControl","_addToHistory","_createControls","_toggleControls","_crosshair","crosshair","addTo","featureIndexOverlayOption","_featureIndexOverlay","featureIndexOverlay","_setUpEvents","disconnectedCallback","_removeEvents","firstChild","removeChild","_deleteControls","adoptedCallback","attributeChangedCallback","name","oldValue","newValue","valueSet","_hideControls","_showControls","connect","layersReady","disable","layer","querySelectorAll","reAttach","push","whenReady","Promise","allSettled","zoomTo","enable","dispatchEvent","CustomEvent","bind","_resetHistory","_debug","toggleDebug","mapSize","getSize","y","totalSize","_layerControl","layerControl","collapsed","on","collapse","scaleValue","announceScale","metric","imperial","_scaleBar","scaleBar","_zoomControl","control","_reloadButton","reloadButton","_fullScreenControl","fullscreenButton","_geolocationButton","geolocationButton","toggleContextMenuItem","_setControlsVisibility","forEach","toLowerCase","_layers","hide","container","children","childEl","isStatic","dragging","touchZoom","doubleClickZoom","scrollWheelZoom","boxZoom","keyboard","_dropHandler","event","preventDefault","text","dataTransfer","getData","_pasteLayer","_dragoverHandler","dropEffect","off","removeEventListener","addEventListener","e","target","tagName","details","originalEvent","host","getRootNode","ShadowRoot","parentElement","keyCode","activeElement","nodeName","detail","ctrlKey","navigator","clipboard","readText","fire","latlng","accuracy","error","message","lng","x","containerPoint","_updateMapCenter","setMapMinAndMaxZoom","whenLayersReady","_layerEl","setMaxZoom","setMinZoom","fullscreenElement","setViewFullScreenInnerHTML","reload","altKey","forward","back","locate","stop","setView","remove","undefined","debugOverlay","style","styleSheets","cssRules","invalidateSize","Number","isInteger","location","getCenter","mapLocation","splice","prev","history","curr","scale","panBy","animate","setZoom","next","initialLocation","shift","getContainer","focus","_toggleFullScreen","toggleFullscreen","viewSource","blob","Blob","type","createObjectURL","open","revokeObjectURL","defineCustomProjection","jsonTemplate","t","JSON","parse","proj4string","origin","bounds","indexOf","toUpperCase","tileSize","includes","tilesize","TILE_SIZE","Proj","CRS","tcrs","horizontal","min","max","Math","round","vertical","pcrs","gcrs","unproject","OSMTILE","latLngBounds","point","tile","tilematrix","resolve","reject","interval","failureTimer","setInterval","viewer","clearInterval","clearTimeout","p","geojson2mapml","json","geojsonLayer","customElements","define"],"mappings":";;+CAESA,iC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ImG,EAAc,GAElB,IAAKnG,IAAIqG,IAAS,IAAIlI,KAAK0B,QACzBsG,EAAYK,KAAKH,EAAMI,aAEzB,OAAOC,QAAQC,WAAWR,GAE5B9G,sBAAsBD,GACpB,OAAO,IAAIsH,QAAQ,CAACsK,EAASC,KAC3BjR,IAAIkR,EAAUC,EACV/Q,EAAEhB,GACJ4R,KAEAE,EAAWE,YAGb,SAA2BI,GACrBpR,EAAEoR,KACJF,cAAcJ,GACdK,aAAaJ,GACbH,MAPwC,IAAK5R,GAC/C+R,EAAe1O,WASjB,WACE6O,cAAcJ,GACdK,aAAaJ,GACbF,EAAO,yDAZyC,QAgBtDQ,cAAcC,EAAMlR,EAAU,SACDwM,IAAvBxM,EAAQpB,aACVoB,EAAQpB,WAAajB,KAAKiB,YAExBuS,EAAevR,EAAEqR,cAAcC,EAAMlR,GAEzC,OADArC,KAAK2F,YAAY6N,GACVA,GAIX/S,OAAOgT,eAAeC,OAAO,eAAgB9T,WAC7Ca,OAAOgT,eAAeC,OAAO,SAAUtU,UACvCqB,OAAOgT,eAAeC,OAAO,cAAerU,YAC5CoB,OAAOgT,eAAeC,OAAO,cAAepU,YAC5CmB,OAAOgT,eAAeC,OAAO,aAAcnU,WAC3CkB,OAAOgT,eAAeC,OAAO,YAAalU,UAC1CiB,OAAOgT,eAAeC,OAAO,aAAcjU,WAC3CgB,OAAOgT,eAAeC,OAAO,WAAYhU,SACzCe,OAAOgT,eAAeC,OAAO,YAAa/T,iBAj5C7BC"} \ No newline at end of file diff --git a/static/dist/mapml.css b/static/dist/mapml.css index 5cbb766f..d87c82fa 100644 --- a/static/dist/mapml.css +++ b/static/dist/mapml.css @@ -1,4 +1,4 @@ -.leaflet-image-layer,.leaflet-layer,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-pane,.leaflet-pane>canvas,.leaflet-pane>svg,.leaflet-tile,.leaflet-tile-container,.leaflet-zoom-box{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:0 0}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer{max-width:none!important;max-height:none!important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,0.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;-moz-box-sizing:border-box;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-bottom,.leaflet-top{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity .2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-pan-anim .leaflet-tile,.leaflet-zoom-anim .leaflet-tile{-webkit-transition:none;-moz-transition:none;transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-control,.leaflet-popup-pane{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-image-layer,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-image-layer.leaflet-interactive,.leaflet-marker-icon.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{border:2px dotted #38f;background:rgba(255,255,255,.5)}.leaflet-container{font-family:"Helvetica Neue",Arial,Helvetica,sans-serif;font-size:12px;font-size:.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px rgba(0,0,0,.65);border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:focus,.leaflet-bar a:hover{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:bold 18px 'Lucida Console',Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px rgba(0,0,0,.4);background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(images/layers.png);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(images/layers-2x.png);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(images/marker-icon.png)}.leaflet-container .leaflet-control-attribution{background:#fff;background:rgba(255,255,255,.8);margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:focus,.leaflet-control-attribution a:hover{text-decoration:underline}.leaflet-attribution-flag{display:inline!important;vertical-align:baseline!important;width:1em;height:.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;-moz-box-sizing:border-box;box-sizing:border-box;background:rgba(255,255,255,.8);text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers{box-shadow:none}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:17px 0;margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px rgba(0,0,0,.4)}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;color:#757575;text-decoration:none;background:0 0}.leaflet-container a.leaflet-popup-close-button:focus,.leaflet-container a.leaflet-popup-close-button:hover{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto}.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px rgba(0,0,0,.4)}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before,.leaflet-tooltip-top:before{position:absolute;pointer-events:none;border:6px solid transparent;background:0 0;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}.leaflet-control-locate a{cursor:pointer}.leaflet-control-locate a .leaflet-control-locate-location-arrow{display:inline-block;width:16px;height:16px;margin:7px;background-image:url('data:image/svg+xml;charset=UTF-8,')}.leaflet-control-locate a .leaflet-control-locate-spinner{display:inline-block;width:16px;height:16px;margin:7px;background-image:url('data:image/svg+xml;charset=UTF-8,');animation:leaflet-control-locate-spin 2s linear infinite}.leaflet-control-locate.active a .leaflet-control-locate-location-arrow{background-image:url('data:image/svg+xml;charset=UTF-8,')}.leaflet-control-locate.following a .leaflet-control-locate-location-arrow{background-image:url('data:image/svg+xml;charset=UTF-8,')}.leaflet-touch .leaflet-bar .leaflet-locate-text-active{width:100%;max-width:200px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;padding:0 10px}.leaflet-touch .leaflet-bar .leaflet-locate-text-active .leaflet-locate-icon{padding:0 5px 0 0}.leaflet-control-locate-location circle{animation:leaflet-control-locate-throb 4s ease infinite}@keyframes leaflet-control-locate-throb{0%{stroke-width:1}50%{stroke-width:3;transform:scale(.8,.8)}100%{stroke-width:1}}@keyframes leaflet-control-locate-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.leaflet-container{background-color:transparent;max-height:100%;max-width:100%;min-height:100%;min-width:100%;width:100%!important;height:100%!important}.leaflet-tile img{position:absolute;left:0;top:0}.leaflet-fade-anim .leaflet-image-layer{will-change:opacity}.leaflet-image-layer{visibility:hidden}.leaflet-image-loaded{visibility:inherit}.leaflet-container .leaflet-control-attribution,.leaflet-container .leaflet-control-scale,.leaflet-control-scale-line{font-size:12px}.leaflet-container{container:leafletmap/size}.mapml-control-scale{bottom:8px;left:0}@container leafletmap (max-height:250px){.mapml-control-scale{left:45px}}.leaflet-control-layers-overlays fieldset:disabled span.mapml-layer-item-name{font-style:italic}.mapml-button{background-color:transparent;border:none;border-radius:0;color:inherit;font:inherit;line-height:inherit;margin:0;padding:0;overflow:hidden;text-align:inherit;text-transform:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.leaflet-container a{color:revert}.leaflet-container a.leaflet-popup-close-button,.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-control-container a,.mapml-reload-button{color:#000}.mapml-layer-item-name a{color:revert}.leaflet-top .leaflet-control{margin-top:5px}.leaflet-left .leaflet-control{margin-left:5px}.leaflet-bar a,.mapml-reload-button{background-color:#fff;box-sizing:border-box;width:44px!important;height:44px!important;line-height:44px!important;font-size:34px!important;font-weight:400;text-align:center}.mapml-reload-button:hover,.mapml-reload-button[aria-disabled=true]{background-color:#f4f4f4}.mapml-reload-button[aria-disabled=true]{cursor:default}.mapml-button[aria-disabled=true],button.mapml-button:disabled{color:#bbb}button.mapml-contextmenu-item:disabled{opacity:.3}.leaflet-control-layers-toggle{width:44px!important;height:44px!important}.leaflet-bar a,.leaflet-control-layers,.mapml-reload-button{border-color:#e3e3e3!important}.leaflet-control-layers,.mapml-reload-button{border-radius:4px!important}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:4px!important;border-bottom-right-radius:4px!important}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:4px!important;border-top-right-radius:4px!important}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers{border-style:inherit}.leaflet-bar,.leaflet-container .leaflet-control-attribution,.leaflet-control-layers,.leaflet-popup-content-wrapper,.leaflet-popup-tip,.leaflet-tooltip-pane .leaflet-tooltip,.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers,.mapml-contextmenu,.mapml-debug{box-shadow:rgb(0 0 0 / 30%) 0 1px 4px -1px}.leaflet-control-attribution a{color:revert;text-decoration:revert}.leaflet-container .leaflet-control-attribution{background-color:#fff;border-radius:1.5em;color:currentColor;margin:5px;min-height:30px;min-width:30px;padding:0}.leaflet-control-attribution summary{display:block;list-style:none;border-radius:100%;position:absolute;bottom:0;left:calc(100% - 30px);line-height:0;width:30px;height:30px}.leaflet-control-attribution summary svg{border-radius:100%;width:inherit;height:inherit}.mapml-attribution-container{padding:5px 35px 5px 10px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{text-indent:unset}.leaflet-control-fullscreen a{background-image:url("data:image/svg+xml,%0A%3Csvg width='26' height='52' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg transform='translate(0 -1000.4)'%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23a'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23b'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23c'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23d'/%3E%3Cpath id='a' transform='translate(0 1000.4)' d='M5 15v6h6v-2H7v-4z' color='%23000' fill='%23404040'/%3E%3Cpath id='b' transform='translate(0 1000.4)' d='M21 15v6h-6v-2h4v-4z' color='%23000' fill='%23404040'/%3E%3Cpath d='M10 1037.4v4l1 1h4l1-1v-4l-1-1h-4z' color='%23000' fill='%23404040'/%3E%3Cpath id='d' d='M5 1011.4v-6h6v2H7v4z' color='%23000' fill='%23404040'/%3E%3Cpath id='c' d='M21 1011.4v-6h-6v2h4v4z' color='%23000' fill='%23404040'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;background-size:38px 76px;background-position:3px 3px}:host(.mapml-fullscreen-on) .leaflet-control-fullscreen a{background-position:3px -35px}:host(:-webkit-full-screen){width:100%!important;height:100%!important}:host(.mapml-fullscreen-on){width:100%!important;height:100%!important}:host(.leaflet-pseudo-fullscreen){position:fixed!important;width:100%!important;height:100%!important;top:0!important;left:0!important;z-index:99999}.leaflet-control-layers.leaflet-control{margin-right:5px;margin-left:5px;padding:0}.leaflet-control-layers-list{padding:0}.leaflet-control-layers fieldset{margin:0;padding:0;min-height:44px}.leaflet-control-layers label{display:inline}.mapml-control-layers>:not(summary){display:block;margin-block-start:5px;margin-inline-start:15px;width:calc(100% - 15px)}.mapml-layer-item-style>div{display:flex}.mapml-layer-item-style input{margin-inline-start:0}.leaflet-control .leaflet-control-layers-toggle{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath d='m11.99 18.54-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27L12 16zm0-11.47L17.74 9 12 13.47 6.26 9 12 4.53z'/%3E%3C/svg%3E");background-size:34px}.leaflet-control-layers-selector{margin-top:revert;position:revert}.mapml-contextmenu{border-radius:4px;padding:4px 0;background-color:#fff;cursor:default;position:absolute;width:fit-content;display:inline-block;z-index:10001}.mapml-contextmenu button.mapml-contextmenu-item{color:#222;font-size:12px;line-height:20px;text-decoration:none;padding:0 12px;border-top:1px solid transparent;border-bottom:1px solid transparent;cursor:default;width:100%;display:block}.mapml-contextmenu button.mapml-contextmenu-item.over{background-color:#f4f4f4;border-top:1px solid #f0f0f0;border-bottom:1px solid #f0f0f0}.mapml-contextmenu-separator{border-bottom:1px solid #e3e3e3;margin:5px 0}.mapml-contextmenu.mapml-submenu{width:80px;margin-bottom:-2rem;width:fit-content}@supports (contain:layout){.mapml-contextmenu{position:fixed}.mapml-contextmenu.mapml-submenu{position:absolute}}.mapml-contextmenu-item[aria-controls] span::after{content:">"}@supports (list-style-type:disclosure-open){.mapml-contextmenu-item[aria-controls] span{display:inline-block}.mapml-contextmenu-item[aria-controls] span::after{content:"";display:list-item;list-style-type:disclosure-closed;margin-inline-start:20px}}.mapml-debug{contain:content;max-height:100%;max-width:100%;border-radius:4px;padding:5px 10px;background-color:#fff;cursor:default;z-index:1000;position:absolute;display:block;top:auto;right:5px;bottom:5px;left:5px;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;font:inherit}.mapml-debug-banner{font-weight:700;text-transform:uppercase;display:inline-block;text-align:left;text-align:inline-start;line-height:2}.mapml-debug-grid,.mapml-debug-panel{font-family:monospace}.mapml-debug-tile{text-indent:6px;line-height:1.8}.mapml-debug-coordinates{padding-left:4px;padding-right:4px}.mapml-debug,.mapml-debug *{border-collapse:collapse;border-spacing:0}.mapml-debug-coordinates:empty{display:none}.mapml-debug-coordinates>*{display:inline}:host(.mapml-fullscreen-on) .mapml-debug-grid{color:#fff;text-shadow:1px 1px 1px #000,1px 1px 1px #000}:host(.leaflet-drag-target) .leaflet-grab{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}:host(.leaflet-drag-target) .leaflet-control{pointer-events:none}.leaflet-control :not([draggable=true]),.leaflet-popup-close-button,.mapml-contextmenu :not([draggable=true]),.mapml-popup-button{-webkit-user-drag:none}.leaflet-control,.mapml-contextmenu,.mapml-debug,.mapml-focus-buttons,.mapml-layer-item-settings summary{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.leaflet-control a::selection,.leaflet-control-attribution::selection,.leaflet-popup-close-button::selection{background-color:transparent}.leaflet-crosshair *,.leaflet-tooltip,.mapml-contextmenu-item>*,.mapml-feature-index-box,.mapml-layer-item-settings .mapml-control-layers summary label,.mapml-link-preview{pointer-events:none!important}.leaflet-container :focus{outline-color:-webkit-focus-ring-color!important;outline-style:auto!important;outline-width:thin!important;outline:revert!important}.leaflet-active:not(:focus){outline:unset!important}.leaflet-container:not(:focus-within) .mapml-outline{outline:0}.leaflet-container:not(:focus-within) .mapml-crosshair{display:none}.leaflet-control a{-webkit-tap-highlight-color:initial}.leaflet-zoom-box{border:thin dotted;background-color:rgba(255,255,255,.33)}button,input,label,summary{cursor:pointer}.mapml-draggable,.mapml-draggable *{cursor:row-resize}.leaflet-crosshair{cursor:crosshair}[hidden]{display:none!important}.leaflet-container .leaflet-control-container,.leaflet-container .mapml-contextmenu{visibility:unset!important}.mapml-crosshair{margin:-36px 0 0 -36px;width:72px;height:72px;left:50%;top:50%;position:absolute;z-index:10000}.mapml-popup-button{padding:0 4px 0 4px;border:none;text-align:center;font:16px/14px Tahoma,Verdana,sans-serif;color:inherit;text-decoration:none;font-weight:700;background:0 0;white-space:nowrap;box-sizing:border-box;width:44px;height:44px;line-height:44px}.mapml-focus-buttons{white-space:nowrap}.mapml-feature-count{display:inline;white-space:nowrap;text-align:center;padding:2px}.leaflet-container a.leaflet-popup-close-button,.mapml-focus-buttons button{width:44px;height:44px;min-width:44px;min-height:44px;line-height:44px}.leaflet-popup-content{margin:0;min-width:min-content}.mapml-popup-content{padding-top:44px}.mapml-focus-buttons{display:block;text-align:center}.mapml-focus-buttons button{display:inline-block;padding:0}.leaflet-container a.leaflet-popup-close-button{padding:0;font-size:20px}.leaflet-popup-content .mapml-feature-count{margin:0;padding:0 5px;line-height:44px}.mapml-popup-content hr:last-of-type{margin-bottom:0;border-bottom:0;border-top:1px solid #e3e3e3}.mapml-popup-content :first-child{margin-top:0;padding-top:0}.mapml-popup-content>:not(.mapml-focus-buttons){padding:0 1rem}.leaflet-popup-tip-container{margin-top:-1px}.mapml-outline{outline-style:auto;outline-offset:-2px;z-index:1000;pointer-events:none;position:absolute;height:100%;width:100%;color:initial}@media print{.leaflet-control{-webkit-print-color-adjust:exact;color-adjust:exact}}.leaflet-pane>svg g.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive g{pointer-events:visiblePainted;pointer-events:auto}.mapml-link-preview{position:absolute;left:0;bottom:0;background-color:#dee1e6;border-radius:0 5px 0 0;z-index:1050}.mapml-link-preview>p{margin:3px 5px 2px 3px;color:#3c4043}.mapml-button-icon{pointer-events:none}.mapml-button-icon svg{fill:currentColor}.mapml-layer-item,.mapml-layer-item *{box-sizing:border-box}.mapml-layer-extent,.mapml-layer-grouped-extents,.mapml-layer-item{background-color:#fff;border:1px solid #fff;margin:0;padding:0}.mapml-layer-item:not(:last-of-type){border-bottom:1px solid #e3e3e3}.mapml-layer-extent[aria-grabbed=true],.mapml-layer-item[aria-grabbed=true]{border:1px solid #e3e3e3;border-radius:0}.mapml-layer-extent:first-of-type,.mapml-layer-item:first-of-type{border-top-left-radius:4px;border-top-right-radius:4px}.mapml-layer-extent:last-of-type,.mapml-layer-item:last-of-type{border-bottom-left-radius:4px;border-bottom-right-radius:4px}.mapml-layer-item-properties{align-items:center;display:flex;justify-content:space-between;padding-inline-start:.5rem}.mapml-layer-item-controls{margin-inline-start:auto}.mapml-layer-item-controls button span{font-size:large;font-weight:900;vertical-align:middle}.mapml-layer-item-controls button svg{vertical-align:text-bottom}.mapml-layer-item-controls,.mapml-layer-item-remove-control,.mapml-layer-item-settings-control{align-items:center;display:flex;justify-content:center}.mapml-layer-item-remove-control,.mapml-layer-item-settings-control{min-height:44px;min-width:44px;height:44px;width:44px}label.mapml-layer-item-toggle{display:inline-flex;align-items:center;width:100%;min-height:44px}.mapml-layer-item-name{word-break:break-word;padding-block-start:.25rem;padding-block-end:.25rem;padding-inline-start:.25rem;padding-inline-end:1rem}.mapml-layer-item-settings>*{display:block;padding-block-start:.25rem;padding-block-end:.25rem;padding-inline-start:2rem;padding-inline-end:1rem}.mapml-screen-reader-output{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}.mapml-screen-reader-output-scale{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}.mapml-vector-container svg :is( +.leaflet-image-layer,.leaflet-layer,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-pane,.leaflet-pane>canvas,.leaflet-pane>svg,.leaflet-tile,.leaflet-tile-container,.leaflet-zoom-box{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:0 0}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none!important;max-height:none!important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer{max-width:none!important;max-height:none!important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51,181,229,0.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;-moz-box-sizing:border-box;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-bottom,.leaflet-top{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity .2s linear;-moz-transition:opacity .2s linear;transition:opacity .2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform .25s cubic-bezier(0,0,.25,1);-moz-transition:-moz-transform .25s cubic-bezier(0,0,.25,1);transition:transform .25s cubic-bezier(0,0,.25,1)}.leaflet-pan-anim .leaflet-tile,.leaflet-zoom-anim .leaflet-tile{-webkit-transition:none;-moz-transition:none;transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-control,.leaflet-popup-pane{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-image-layer,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-image-layer.leaflet-interactive,.leaflet-marker-icon.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078a8}.leaflet-zoom-box{border:2px dotted #38f;background:rgba(255,255,255,.5)}.leaflet-container{font-family:"Helvetica Neue",Arial,Helvetica,sans-serif;font-size:12px;font-size:.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px rgba(0,0,0,.65);border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:#000}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:focus,.leaflet-bar a:hover{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:bold 18px 'Lucida Console',Monaco,monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px rgba(0,0,0,.4);background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(images/layers.png);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(images/layers-2x.png);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(images/marker-icon.png)}.leaflet-container .leaflet-control-attribution{background:#fff;background:rgba(255,255,255,.8);margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:focus,.leaflet-control-attribution a:hover{text-decoration:underline}.leaflet-attribution-flag{display:inline!important;vertical-align:baseline!important;width:1em;height:.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;-moz-box-sizing:border-box;box-sizing:border-box;background:rgba(255,255,255,.8);text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers{box-shadow:none}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers{border:2px solid rgba(0,0,0,.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:17px 0;margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:#fff;color:#333;box-shadow:0 3px 14px rgba(0,0,0,.4)}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma,Verdana,sans-serif;color:#757575;text-decoration:none;background:0 0}.leaflet-container a.leaflet-popup-close-button:focus,.leaflet-container a.leaflet-popup-close-button:hover{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto}.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px rgba(0,0,0,.4)}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before,.leaflet-tooltip-top:before{position:absolute;pointer-events:none;border:6px solid transparent;background:0 0;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}.leaflet-control-locate a{cursor:pointer}.leaflet-control-locate a .leaflet-control-locate-location-arrow{display:inline-block;width:16px;height:16px;margin:7px;background-image:url('data:image/svg+xml;charset=UTF-8,')}.leaflet-control-locate a .leaflet-control-locate-spinner{display:inline-block;width:16px;height:16px;margin:7px;background-image:url('data:image/svg+xml;charset=UTF-8,');animation:leaflet-control-locate-spin 2s linear infinite}.leaflet-control-locate.active a .leaflet-control-locate-location-arrow{background-image:url('data:image/svg+xml;charset=UTF-8,')}.leaflet-control-locate.following a .leaflet-control-locate-location-arrow{background-image:url('data:image/svg+xml;charset=UTF-8,')}.leaflet-touch .leaflet-bar .leaflet-locate-text-active{width:100%;max-width:200px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;padding:0 10px}.leaflet-touch .leaflet-bar .leaflet-locate-text-active .leaflet-locate-icon{padding:0 5px 0 0}.leaflet-control-locate-location circle{animation:leaflet-control-locate-throb 4s ease infinite}@keyframes leaflet-control-locate-throb{0%{stroke-width:1}50%{stroke-width:3;transform:scale(.8,.8)}100%{stroke-width:1}}@keyframes leaflet-control-locate-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.leaflet-container{background-color:transparent;max-height:100%;max-width:100%;min-height:100%;min-width:100%;width:100%!important;height:100%!important}.leaflet-tile img{position:absolute;left:0;top:0}.leaflet-fade-anim .leaflet-image-layer{will-change:opacity}.leaflet-image-layer{visibility:hidden}.leaflet-image-loaded{visibility:inherit}.leaflet-container .leaflet-control-attribution,.leaflet-container .leaflet-control-scale,.leaflet-control-scale-line{font-size:12px}.leaflet-container{container:leafletmap/size}.mapml-control-scale{bottom:8px;left:0}@container leafletmap (max-height:250px){.mapml-control-scale{left:45px}}.leaflet-control-layers-overlays fieldset:disabled span.mapml-layer-item-name{font-style:italic}.mapml-button{background-color:transparent;border:none;border-radius:0;color:inherit;font:inherit;line-height:inherit;margin:0;padding:0;overflow:hidden;text-align:inherit;text-transform:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.leaflet-container a{color:revert}.leaflet-container a.leaflet-popup-close-button,.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-control-container a,.mapml-reload-button{color:#000}.mapml-layer-item-name a{color:revert}.leaflet-top .leaflet-control{margin-top:5px}.leaflet-left .leaflet-control{margin-left:5px}.leaflet-bar a,.mapml-reload-button{background-color:#fff;box-sizing:border-box;width:44px!important;height:44px!important;line-height:44px!important;font-size:34px!important;font-weight:400;text-align:center}.mapml-reload-button:hover,.mapml-reload-button[aria-disabled=true]{background-color:#f4f4f4}.mapml-reload-button[aria-disabled=true]{cursor:default}.mapml-button[aria-disabled=true],button.mapml-button:disabled{color:#bbb}button.mapml-contextmenu-item:disabled{opacity:.3}.leaflet-control-layers-toggle{width:44px!important;height:44px!important}.leaflet-bar a,.leaflet-control-layers,.mapml-reload-button{border-color:#e3e3e3!important}.leaflet-control-layers,.mapml-reload-button{border-radius:4px!important}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:4px!important;border-bottom-right-radius:4px!important}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:4px!important;border-top-right-radius:4px!important}.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers{border-style:inherit}.leaflet-bar,.leaflet-container .leaflet-control-attribution,.leaflet-control-layers,.leaflet-popup-content-wrapper,.leaflet-popup-tip,.leaflet-tooltip-pane .leaflet-tooltip,.leaflet-touch .leaflet-bar,.leaflet-touch .leaflet-control-layers,.mapml-contextmenu,.mapml-debug{box-shadow:rgb(0 0 0 / 30%) 0 1px 4px -1px}.leaflet-control-attribution a{color:revert;text-decoration:revert}.leaflet-container .leaflet-control-attribution{background-color:#fff;border-radius:1.5em;color:currentColor;margin:5px;min-height:30px;min-width:30px;padding:0}.leaflet-control-attribution summary{display:block;list-style:none;border-radius:100%;position:absolute;bottom:0;left:calc(100% - 30px);line-height:0;width:30px;height:30px}.leaflet-control-attribution summary svg{border-radius:100%;width:inherit;height:inherit}.mapml-attribution-container{padding:5px 35px 5px 10px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{text-indent:unset}.leaflet-control-fullscreen a{background-image:url("data:image/svg+xml,%0A%3Csvg width='26' height='52' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg transform='translate(0 -1000.4)'%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23a'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23b'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23c'/%3E%3Cuse transform='translate(0 26)' width='100%25' height='100%25' xlink:href='%23d'/%3E%3Cpath id='a' transform='translate(0 1000.4)' d='M5 15v6h6v-2H7v-4z' color='%23000' fill='%23404040'/%3E%3Cpath id='b' transform='translate(0 1000.4)' d='M21 15v6h-6v-2h4v-4z' color='%23000' fill='%23404040'/%3E%3Cpath d='M10 1037.4v4l1 1h4l1-1v-4l-1-1h-4z' color='%23000' fill='%23404040'/%3E%3Cpath id='d' d='M5 1011.4v-6h6v2H7v4z' color='%23000' fill='%23404040'/%3E%3Cpath id='c' d='M21 1011.4v-6h-6v2h4v4z' color='%23000' fill='%23404040'/%3E%3C/g%3E%3C/svg%3E");background-repeat:no-repeat;background-size:38px 76px;background-position:3px 3px}:host(:fullscreen) .leaflet-control-fullscreen a{background-position:3px -35px}:host(:-webkit-full-screen){width:100%!important;height:100%!important}:host(.leaflet-pseudo-fullscreen){position:fixed!important;width:100%!important;height:100%!important;top:0!important;left:0!important;z-index:99999}.leaflet-control-layers.leaflet-control{margin-right:5px;margin-left:5px;padding:0}.leaflet-control-layers-list{padding:0}.leaflet-control-layers fieldset{margin:0;padding:0;min-height:44px}.leaflet-control-layers label{display:inline}.mapml-control-layers>:not(summary){display:block;margin-block-start:5px;margin-inline-start:15px;width:calc(100% - 15px)}.mapml-layer-item-style>div{display:flex}.mapml-layer-item-style input{margin-inline-start:0}.leaflet-control .leaflet-control-layers-toggle{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath d='m11.99 18.54-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27L12 16zm0-11.47L17.74 9 12 13.47 6.26 9 12 4.53z'/%3E%3C/svg%3E");background-size:34px}.leaflet-control-layers-selector{margin-top:revert;position:revert}.mapml-contextmenu{border-radius:4px;padding:4px 0;background-color:#fff;cursor:default;position:absolute;width:fit-content;display:inline-block;z-index:10001}.mapml-contextmenu button.mapml-contextmenu-item{color:#222;font-size:12px;line-height:20px;text-decoration:none;padding:0 12px;border-top:1px solid transparent;border-bottom:1px solid transparent;cursor:default;width:100%;display:block}.mapml-contextmenu button.mapml-contextmenu-item.over{background-color:#f4f4f4;border-top:1px solid #f0f0f0;border-bottom:1px solid #f0f0f0}.mapml-contextmenu-separator{border-bottom:1px solid #e3e3e3;margin:5px 0}.mapml-contextmenu.mapml-submenu{width:80px;margin-bottom:-2rem;width:fit-content}@supports (contain:layout){.mapml-contextmenu{position:fixed}.mapml-contextmenu.mapml-submenu{position:absolute}}.mapml-contextmenu-item[aria-controls] span::after{content:">"}@supports (list-style-type:disclosure-open){.mapml-contextmenu-item[aria-controls] span{display:inline-block}.mapml-contextmenu-item[aria-controls] span::after{content:"";display:list-item;list-style-type:disclosure-closed;margin-inline-start:20px}}.mapml-debug{contain:content;max-height:100%;max-width:100%;border-radius:4px;padding:5px 10px;background-color:#fff;cursor:default;z-index:1000;position:absolute;display:block;top:auto;right:5px;bottom:5px;left:5px;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;font:inherit}.mapml-debug-banner{font-weight:700;text-transform:uppercase;display:inline-block;text-align:left;text-align:inline-start;line-height:2}.mapml-debug-grid,.mapml-debug-panel{font-family:monospace}.mapml-debug-tile{text-indent:6px;line-height:1.8}.mapml-debug-coordinates{padding-left:4px;padding-right:4px}.mapml-debug,.mapml-debug *{border-collapse:collapse;border-spacing:0}.mapml-debug-coordinates:empty{display:none}.mapml-debug-coordinates>*{display:inline}:host(.mapml-fullscreen-on) .mapml-debug-grid{color:#fff;text-shadow:1px 1px 1px #000,1px 1px 1px #000}:host(.leaflet-drag-target) .leaflet-grab{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}:host(.leaflet-drag-target) .leaflet-control{pointer-events:none}.leaflet-control :not([draggable=true]),.leaflet-popup-close-button,.mapml-contextmenu :not([draggable=true]),.mapml-popup-button{-webkit-user-drag:none}.leaflet-control,.mapml-contextmenu,.mapml-debug,.mapml-focus-buttons,.mapml-layer-item-settings summary{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.leaflet-control a::selection,.leaflet-control-attribution::selection,.leaflet-popup-close-button::selection{background-color:transparent}.leaflet-crosshair *,.leaflet-tooltip,.mapml-contextmenu-item>*,.mapml-feature-index-box,.mapml-layer-item-settings .mapml-control-layers summary label,.mapml-link-preview{pointer-events:none!important}.leaflet-container :focus{outline-color:-webkit-focus-ring-color!important;outline-style:auto!important;outline-width:thin!important;outline:revert!important}.leaflet-active:not(:focus){outline:unset!important}.leaflet-container:not(:focus-within) .mapml-outline{outline:0}.leaflet-container:not(:focus-within) .mapml-crosshair{display:none}.leaflet-control a{-webkit-tap-highlight-color:initial}.leaflet-zoom-box{border:thin dotted;background-color:rgba(255,255,255,.33)}button,input,label,summary{cursor:pointer}.mapml-draggable,.mapml-draggable *{cursor:row-resize}.leaflet-crosshair{cursor:crosshair}[hidden]{display:none!important}.leaflet-container .leaflet-control-container,.leaflet-container .mapml-contextmenu{visibility:unset!important}.mapml-crosshair{margin:-36px 0 0 -36px;width:72px;height:72px;left:50%;top:50%;position:absolute;z-index:10000}.mapml-popup-button{padding:0 4px 0 4px;border:none;text-align:center;font:16px/14px Tahoma,Verdana,sans-serif;color:inherit;text-decoration:none;font-weight:700;background:0 0;white-space:nowrap;box-sizing:border-box;width:44px;height:44px;line-height:44px}.mapml-focus-buttons{white-space:nowrap}.mapml-feature-count{display:inline;white-space:nowrap;text-align:center;padding:2px}.leaflet-container a.leaflet-popup-close-button,.mapml-focus-buttons button{width:44px;height:44px;min-width:44px;min-height:44px;line-height:44px}.leaflet-popup-content{margin:0;min-width:min-content}.mapml-popup-content{padding-top:44px}.mapml-focus-buttons{display:block;text-align:center}.mapml-focus-buttons button{display:inline-block;padding:0}.leaflet-container a.leaflet-popup-close-button{padding:0;font-size:20px}.leaflet-popup-content .mapml-feature-count{margin:0;padding:0 5px;line-height:44px}.mapml-popup-content hr:last-of-type{margin-bottom:0;border-bottom:0;border-top:1px solid #e3e3e3}.mapml-popup-content :first-child{margin-top:0;padding-top:0}.mapml-popup-content>:not(.mapml-focus-buttons){padding:0 1rem}.leaflet-popup-tip-container{margin-top:-1px}.mapml-outline{outline-style:auto;outline-offset:-2px;z-index:1000;pointer-events:none;position:absolute;height:100%;width:100%;color:initial}@media print{.leaflet-control{-webkit-print-color-adjust:exact;color-adjust:exact}}.leaflet-pane>svg g.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive g{pointer-events:visiblePainted;pointer-events:auto}.mapml-link-preview{position:absolute;left:0;bottom:0;background-color:#dee1e6;border-radius:0 5px 0 0;z-index:1050}.mapml-link-preview>p{margin:3px 5px 2px 3px;color:#3c4043}.mapml-button-icon{pointer-events:none}.mapml-button-icon svg{fill:currentColor}.mapml-layer-item,.mapml-layer-item *{box-sizing:border-box}.mapml-layer-extent,.mapml-layer-grouped-extents,.mapml-layer-item{background-color:#fff;border:1px solid #fff;margin:0;padding:0}.mapml-layer-item:not(:last-of-type){border-bottom:1px solid #e3e3e3}.mapml-layer-extent[aria-grabbed=true],.mapml-layer-item[aria-grabbed=true]{border:1px solid #e3e3e3;border-radius:0}.mapml-layer-extent:first-of-type,.mapml-layer-item:first-of-type{border-top-left-radius:4px;border-top-right-radius:4px}.mapml-layer-extent:last-of-type,.mapml-layer-item:last-of-type{border-bottom-left-radius:4px;border-bottom-right-radius:4px}.mapml-layer-item-properties{align-items:center;display:flex;justify-content:space-between;padding-inline-start:.5rem}.mapml-layer-item-controls{margin-inline-start:auto}.mapml-layer-item-controls button span{font-size:large;font-weight:900;vertical-align:middle}.mapml-layer-item-controls button svg{vertical-align:text-bottom}.mapml-layer-item-controls,.mapml-layer-item-remove-control,.mapml-layer-item-settings-control{align-items:center;display:flex;justify-content:center}.mapml-layer-item-remove-control,.mapml-layer-item-settings-control{min-height:44px;min-width:44px;height:44px;width:44px}label.mapml-layer-item-toggle{display:inline-flex;align-items:center;width:100%;min-height:44px}.mapml-layer-item-name{word-break:break-word;padding-block-start:.25rem;padding-block-end:.25rem;padding-inline-start:.25rem;padding-inline-end:1rem}.mapml-layer-item-settings>*{display:block;padding-block-start:.25rem;padding-block-end:.25rem;padding-inline-start:2rem;padding-inline-end:1rem}.mapml-screen-reader-output{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}.mapml-screen-reader-output-scale{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}.mapml-vector-container svg :is( [role=link]:focus,[role=link]:hover,[role=link]:focus path,[role=link]:hover path,[role=link] path:focus,[role=link] path:hover,[role=button]:focus,[role=button]:hover,[role=button]:focus path,[role=button]:hover path,[role=button] path:focus,[role=button] path:hover,path[tabindex="0"]:focus ){stroke:#0000EE;stroke:LinkText}.mapml-vector-container svg :is( [role=link]:focus:not(:focus-visible),[role=link]:focus:not(:focus-visible) path,[role=link] path:focus:not(:focus-visible),[role=button]:focus:not(:focus-visible),[role=button]:focus:not(:focus-visible) path,[role=button] path:focus:not(:focus-visible),path[tabindex="0"]:focus:not(:focus-visible) diff --git a/static/dist/mapml.js b/static/dist/mapml.js index fa1c8659..c3b57b97 100644 --- a/static/dist/mapml.js +++ b/static/dist/mapml.js @@ -1,4 +1,4 @@ -/*! @maps4html/web-map-custom-element 27-03-2024 */ +/*! @maps4html/web-map-custom-element 01-04-2024 */ !function(){"use strict";function t(t){return new m(t)}function e(t,e){return new c(t,e)}function o(t,e){return new p(t,e)}function i(t,e){return new h(t,e)}function n(t){return new d(t)}function a(t,e){return new _(t,e)}function s(t,e){return new y(t,e)}function r(t,e,o,i,n,a){return new f(t,e,o,i,n,a)}function l(t,e,o){return t||e?new g(t,e,o):null}function u(){return new b}var m=L.GridLayer.extend({initialize:function(t){L.setOptions(this,t),this.zoomBounds=this._getZoomBounds(t.tileContainer,t.maxZoomBound),L.extend(this.options,this.zoomBounds),this._groups=this._groupTiles(this.options.tileContainer.getElementsByTagName("map-tile")),this._bounds=this._getLayerBounds(this._groups,this.options.projection),this.layerBounds=this._bounds[Object.keys(this._bounds)[0]];for(var e of Object.keys(this._bounds))this.layerBounds.extend(this._bounds[e].min),this.layerBounds.extend(this._bounds[e].max)},onAdd:function(t){this._map=t,L.GridLayer.prototype.onAdd.call(this,this._map),this._handleMoveEnd()},getEvents:function(){let t=L.GridLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=t.moveend,t.moveend=this._handleMoveEnd,t.move=()=>{},t},isVisible:function(){var t=this._map.getZoom();let e=t;return e=e>this.options.maxNativeZoom?this.options.maxNativeZoom:e,e=e=this.zoomBounds.minZoom&&this._bounds[e]&&this._bounds[e].overlaps(M.pixelToPCRSBounds(this._map.getPixelBounds(),this._map.getZoom(),this._map.options.projection))},_handleMoveEnd:function(t){this.isVisible()&&this._parentOnMoveEnd()},_isValidTile(t){return this._groups[this._tileCoordsToKey(t)]},createTile:function(t){let o=this._groups[this._tileCoordsToKey(t)]||[],i=document.createElement("map-tile"),n=this.getTileSize();i.setAttribute("col",t.x),i.setAttribute("row",t.y),i.setAttribute("zoom",t.z);for(let e=0;ee.options.zIndex?1:0}},initialize:function(t,e){for(var o in L.setOptions(this,e),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[o],o,!0)},onAdd:function(){return this._initLayout(),L.DomEvent.on(this._container.getElementsByTagName("a")[0],"keydown",this._focusFirstLayer,this._container),L.DomEvent.on(this._container,"contextmenu",this._preventDefaultContextMenu,this),this._update(),this._layers.length<1&&!this._map._showControls?this._container.setAttribute("hidden",""):this._map._showControls=!0,this._container},onRemove:function(t){L.DomEvent.off(this._container.getElementsByTagName("a")[0],"keydown",this._focusFirstLayer,this._container)},addOrUpdateOverlay:function(t,e){for(var o=!1,i=0;ie.focus(),0)},_withinZoomBounds:function(t,e){return e.min<=t&&t<=e.max},_addItem:function(t){var e=t.layer._layerEl._layerControlHTML;return t.input=e.querySelector("input.leaflet-control-layers-selector"),this._layerControlInputs.push(t.input),t.input.layerId=L.stamp(t.layer),this._overlaysList.appendChild(e),e},collapse:function(t){if(this._container.className.includes("expanded")&&this._map.contextMenu._extentLayerMenu.hidden&&this._map.contextMenu._layerMenu.hidden)return"SELECT"===t.target.tagName||t.relatedTarget&&t.relatedTarget.parentElement&&("mapml-contextmenu mapml-layer-menu"===t.relatedTarget.className||"mapml-contextmenu mapml-layer-menu"===t.relatedTarget.parentElement.className)||this._map&&"block"===this._map.contextMenu._layerMenu.style.display||(L.DomUtil.removeClass(this._container,"leaflet-control-layers-expanded"),"touch"===t.originalEvent?.pointerType&&(this._container._isExpanded=!1)),this},_preventDefaultContextMenu:function(t){var e=this._map.mouseEventToLatLng(t),o=this._map.mouseEventToContainerPoint(t);t.preventDefault(),this._container._isExpanded||"touch"!==t.pointerType?this._map.fire("contextmenu",{originalEvent:t,containerPoint:o,latlng:e}):this._container._isExpanded=!0}}),p=L.FeatureGroup.extend({initialize:function(t,e){L.FeatureGroup.prototype.initialize.call(this,null,e),this.options.tiles||(this._container=null,this.options.query||this.options._leafletLayer?this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane):this._container=this.options.pane,L.DomUtil.addClass(this._container,"leaflet-pane mapml-vector-container"),L.setOptions(this.options.renderer,{pane:this._container})),this.options.query?this._queryFeatures=t.features||t:t||this.options._leafletLayer&&(this._features={},this._staticFeature=!0)},isVisible:function(){let n=this.options.mapEl._map;if(this.options.query)return!0;if(this._staticFeature&&0===Object.keys(this._features).length)return!1;{let t=n.getZoom(),e=this.zoomBounds||this.options.zoomBounds,o=this.layerBounds||this.options.layerBounds,i=!!e&&(t<=e.maxZoom&&t>=e.minZoom);return i&&this._layers&&o&&o.overlaps(M.pixelToPCRSBounds(n.getPixelBounds(),t,n.options.projection))}},onAdd:function(t){this._map=t,L.FeatureGroup.prototype.onAdd.call(this,t),this._staticFeature&&this._validateRendering(),this._queryFeatures&&t.on("featurepagination",this.showPaginationFeature,this)},addLayer:function(t){var e;return L.FeatureGroup.prototype.addLayer.call(this,t),this.options.layerBounds||(this.layerBounds=this.layerBounds?this.layerBounds.extend(t.layerBounds):L.bounds(t.layerBounds.min,t.layerBounds.max),this.zoomBounds?(t.zoomBounds.minZoomthis.zoomBounds.maxZoom&&(this.zoomBounds.maxZoom=t.zoomBounds.maxZoom),t.zoomBounds.minNativeZoomthis.zoomBounds.maxNativeZoom&&(this.zoomBounds.maxNativeZoom=t.zoomBounds.maxNativeZoom)):this.zoomBounds=t.zoomBounds),this._staticFeature&&((e=t.options.mapmlFeature.zoom)in this._features?this._features[e].push(t):this._features[e]=[t],this._validateRendering()),this},addRendering:function(t){L.FeatureGroup.prototype.addLayer.call(this,t)},onRemove:function(t){this._queryFeatures&&(t.off("featurepagination",this.showPaginationFeature,this),delete this._queryFeatures,L.DomUtil.remove(this._container)),L.FeatureGroup.prototype.onRemove.call(this,t),this._map.featureIndex.cleanIndex()},removeLayer:function(o){if(L.FeatureGroup.prototype.removeLayer.call(this,o),!this.options.layerBounds){delete this.layerBounds,delete this.options._leafletLayer.bounds,delete this.zoomBounds,delete this.options._leafletLayer.zoomBounds,delete this._layers[o._leaflet_id],this._removeFromFeaturesList(o);let t,e;var i;for(i of Object.keys(this._layers)){var n=this._layers[i];t?t.extend(n.layerBounds):t=L.bounds(n.layerBounds.min,n.layerBounds.max),e?(n.zoomBounds.minZoome.maxZoom&&(e.maxZoom=n.zoomBounds.maxZoom),n.zoomBounds.minNativeZoome.maxNativeZoom&&(e.maxNativeZoom=n.zoomBounds.maxNativeZoom)):(e={},e.minZoom=n.zoomBounds.minZoom,e.maxZoom=n.zoomBounds.maxZoom,e.minNativeZoom=n.zoomBounds.minNativeZoom,e.maxNativeZoom=n.zoomBounds.maxNativeZoom)}t?this.layerBounds=t:delete this.layerBounds,e?this.zoomBounds=e:(delete this.zoomBounds,delete this.options.zoomBounds)}return this},removeRendering:function(t){L.FeatureGroup.prototype.removeLayer.call(this,t)},_removeFromFeaturesList:function(t){for(var e in this._features)for(let t=0;t=this.zoomBounds.minZoom&&this.extentBounds.overlaps(o)},_initContainer:function(){this._container||(this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane),L.DomUtil.addClass(this._container,"mapml-templated-tile-container"),this._updateZIndex())},_handleMoveEnd:function(t){this.isVisible()&&this._parentOnMoveEnd()},createTile:function(e){let o=document.createElement("DIV"),i=this.getTileSize();if(L.DomUtil.addClass(o,"mapml-tile-group"),L.DomUtil.addClass(o,"leaflet-tile"),this._template.linkEl.dispatchEvent(new CustomEvent("tileloadstart",{detail:{x:e.x,y:e.y,zoom:e.z,appendTile:t=>{o.appendChild(t)}}})),this._template.type.startsWith("image/")){let t=L.TileLayer.prototype.createTile.call(this,e,function(){});t.width=i.x,t.height=i.y,o.appendChild(t)}else this._url.includes(M.BLANK_TT_TREF)||this._fetchTile(e,o);return o},_mapmlTileReady:function(t){L.DomUtil.addClass(t,"leaflet-tile-loaded")},getPane:function(){return this.options.pane},_fetchTile:function(e,o){fetch(this.getTileUrl(e),{redirect:"follow"}).then(function(t){return 200<=t.status&&t.status<300?Promise.resolve(t):(console.log("Looks like there was a problem. Status Code: "+t.status),Promise.reject(t))}).then(function(t){return t.text()}).then(t=>{return(new DOMParser).parseFromString(t,"application/xml")}).then(t=>{this._createFeatures(t,e,o),this._mapmlTileReady(o)}).catch(t=>{console.log("Error Creating Tile")})},_parseStylesheetAsHTML:function(t,e,o){if(o instanceof Element&&t&&t.querySelector("map-link[rel=stylesheet],map-style")){if(e instanceof Element)e=e.getAttribute("href")?e.getAttribute("href"):document.URL;else if(!e||""===e||e instanceof Object)return;for(var i,n,a=[],s=t.querySelectorAll("map-link[rel=stylesheet],map-style"),r=0;r{"href"!==t.nodeName&&e.setAttribute(t.nodeName,t.nodeValue)})}},_createFeatures:function(t,e,o){var i;t.querySelector("map-link[rel=stylesheet],map-style")&&(i=t.querySelector("map-base")&&t.querySelector("map-base").hasAttribute("href")?new URL(t.querySelector("map-base").getAttribute("href")).href:t.URL,this._parseStylesheetAsHTML(t,i,o));let n=L.SVG.create("svg"),a=L.SVG.create("g"),s=this._map.options.crs.options.crs.tile.bounds.max.x,r=e.x*s,l=e.y*s,u=M.featureLayer(null,{projection:this._map.options.projection,tiles:!0,layerBounds:this.extentBounds,zoomBounds:this.zoomBounds,interactive:!1,mapEl:this._linkEl.getMapEl()});var m=M.getNativeVariables(t),c=t.querySelectorAll("map-feature:has(> map-geometry)");for(let t=0;t=this._template.tilematrix.bounds.length||!this._template.tilematrix.bounds[t.z].contains(t))return"";var e,o={},i=this._template.linkEl,n=i.zoomInput;for(e in o[this._template.tilematrix.col.name]=t.x,o[this._template.tilematrix.row.name]=t.y,n&&i.hasAttribute("tref")&&i.getAttribute("tref").includes(`{${n.getAttribute("name")}}`)&&(o[this._template.zoom.name]=this._getZoomForUrl()),o[this._template.pcrs.easting.left]=this._tileMatrixToPCRSPosition(t,"top-left").x,o[this._template.pcrs.easting.right]=this._tileMatrixToPCRSPosition(t,"top-right").x,o[this._template.pcrs.northing.top]=this._tileMatrixToPCRSPosition(t,"top-left").y,o[this._template.pcrs.northing.bottom]=this._tileMatrixToPCRSPosition(t,"bottom-left").y,this._template.tile)["row","col","zoom","left","right","top","bottom"].indexOf(e)<0&&(o[e]=this._template.tile[e]);return this._map&&!this._map.options.crs.infinite&&(t=this._globalTileRange.max.y-t.y,this.options.tms&&(o[this._template.tilematrix.row.name]=t)),o.r=this.options.detectRetina&&L.Browser.retina&&0this.options.maxNativeZoom&&(this._template.step=this.options.maxNativeZoom),t!==e?t=e:t%this._template.step!=0&&(t=Math.floor(t/this._template.step)*this._template.step),t}}),d=L.LayerGroup.extend({initialize:function(t){L.LayerGroup.prototype.initialize.call(this,null,t),this._container=L.DomUtil.create("div","leaflet-layer"),this._extentEl=this.options.extentEl,this.changeOpacity(this.options.opacity),L.DomUtil.addClass(this._container,"mapml-extentlayer-container")},getEvents:function(){return{zoomstart:this._onZoomStart}},_onZoomStart:function(){this.closePopup()},getContainer:function(){return this._container},onAdd:function(t){L.LayerGroup.prototype.onAdd.call(this,t);let e=this.options.extentEl.parentLayer._layer._container;e.appendChild(this._container)},redraw:function(){this.eachLayer(function(t){t.redraw()})},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(){L.LayerGroup.prototype.onRemove.call(this,this._map),L.DomUtil.remove(this._container)},_previousFeature:function(t){0<=this._count+-1&&(this._count--,this._map.fire("featurepagination",{i:this._count,popup:this}))},_nextFeature:function(t){this._count+1=this.zoomBounds.minZoom&&this.extentBounds.overlaps(o)},getEvents:function(){return{moveend:this._onMoveEnd}},onAdd:function(e){this._map=e,this.options.pane.appendChild(this._container);var t=this.options.opacity||1,o=this._container;this._features?this._features.eachLayer(t=>t.addTo(e)):this._features=M.featureLayer(null,{renderer:M.featureRenderer(),pane:o,layerBounds:this.extentBounds,zoomBounds:this.zoomBounds,opacity:t,projection:e.options.projection,mapEl:this._linkEl.getMapEl(),onEachFeature:function(t,e){var o=document.createElement("div");o.classList.add("mapml-popup-content"),o.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(o,{autoClose:!1,minWidth:108})}}),this._onMoveEnd()},onRemove:function(){this._features&&this._features.eachLayer(t=>t.remove()),L.DomUtil.remove(this._container)},appendStyleLink:function(e){if(e.link){let t=this._getStylePositionAndNode();t.node.insertAdjacentElement(t.position,e.link)}},_getStylePositionAndNode:function(){return this._container.lastChild&&("SVG"===this._container.lastChild.nodeName.toUpperCase()||this._container.lastChild.classList.contains("mapml-vector-container"))?{position:"beforebegin",node:this._container.lastChild}:this._container.lastChild?{position:"afterend",node:this._container.lastChild}:{position:"afterbegin",node:this._container}},appendStyleElement:function(e){if(e.styleElement){let t=this._getStylePositionAndNode();t.node.insertAdjacentElement(t.position,e.styleElement)}},redraw:function(){this._onMoveEnd()},_removeCSS:function(){var o=this._container.querySelectorAll("link[rel=stylesheet],style");for(let e=0;e *, map-body > *");for(let t=0;t{for(let t=0;t=this.zoomBounds.minZoom&&this.extentBounds.overlaps(o)},_clearLayer:function(){var e=this._container.querySelectorAll("img");for(let t=0;t map-meta[name=extent][content]")?M.getBoundsFromMeta(this._layerEl.shadowRoot):this._layerEl.querySelector(":scope > map-meta[name=extent][content]")?M.getBoundsFromMeta(this._layerEl):void 0,r=this._layerEl.src&&this._layerEl.shadowRoot.querySelector(":host > map-meta[name=zoom][content]")?M.getZoomBoundsFromMeta(this._layerEl.shadowRoot):this._layerEl.querySelector(":scope > map-meta[name=zoom][content]")?M.getZoomBoundsFromMeta(this._layerEl):void 0;const l=(this._layerEl.src?this._layerEl.shadowRoot:this._layerEl).querySelectorAll("map-extent");["_staticTileLayer","_mapmlvectors","_extentLayer"].forEach(t=>{let e,o,i,n;if(r&&(e=r.maxZoom,o=r.minZoom,n=r.maxNativeZoom||-1/0,i=r.minNativeZoom||1/0),"_extentLayer"===t&&l.length)for(let t=0;t'+e+"");L.setOptions(n,{attribution:e});var e=a.querySelector("map-link[rel=legend]");e&&(n._legendUrl=e.getAttribute("href"));n._map&&n._map.hasLayer(n)&&n._map.attributionControl.addAttribution(n.getAttribution())}(),a.querySelector("map-title")?(n._title=a.querySelector("map-title").textContent.trim(),n._titleIsReadOnly=!0):a instanceof Element&&a.hasAttribute("label")&&(n._title=a.getAttribute("label").trim()),M[n.options.projection]&&function(){if(a.querySelector("map-tile")){var t=document.createElement("map-tiles"),e=a.querySelector("map-meta[name=zoom][content]")||a.querySelector("map-input[type=zoom][value]");t.setAttribute("zoom",e&&e.getAttribute("content")||e&&e.getAttribute("value")||"0");for(var o=a.getElementsByTagName("map-tile"),i=0;i{L.DomEvent.stop(t),s.featureIndex._sortIndex(),s.closePopup(),s._container.focus()},n);let r=L.DomUtil.create("button","mapml-popup-button",t);r.type="button",r.title="Previous Feature",r.innerHTML="",L.DomEvent.on(r,"click",e._previousFeature,n);let l=L.DomUtil.create("p","mapml-feature-count",t),u=this._totalFeatureCount||1;l.innerText=n._count+1+"/"+u;let m=L.DomUtil.create("button","mapml-popup-button",t);m.type="button",m.title="Next Feature",m.innerHTML="",L.DomEvent.on(m,"click",e._nextFeature,n);let c=L.DomUtil.create("button","mapml-popup-button",t);c.type="button",c.title="Focus Controls",c.innerHTML="",L.DomEvent.on(c,"click",t=>{s.featureIndex._sortIndex(),s.featureIndex.currentIndex=s.featureIndex.inBoundFeatures.length-1,s.featureIndex.inBoundFeatures[0]?.path.setAttribute("tabindex",-1),s.featureIndex.inBoundFeatures[s.featureIndex.currentIndex]?.path.setAttribute("tabindex",0),L.DomEvent.stop(t),s.closePopup(),s._controlContainer.querySelector("A:not([hidden])").focus()},n);var p=L.DomUtil.create("hr","mapml-popup-divider");function h(t){let e=t.originalEvent.path||t.originalEvent.composedPath();var o=9===t.originalEvent.keyCode,i=t.originalEvent.shiftKey;(e[0].classList.contains("leaflet-popup-close-button")&&o&&!i||27===t.originalEvent.keyCode||e[0].classList.contains("leaflet-popup-close-button")&&13===t.originalEvent.keyCode||e[0].classList.contains("mapml-popup-content")&&o&&i||e[0]===n._content.querySelector("a")&&o&&i)&&setTimeout(()=>{s.closePopup(n),a.focus(),L.DomEvent.stop(t)},0)}function d(t){let e=t.originalEvent.path||t.originalEvent.composedPath();var o=9===t.originalEvent.keyCode,i=t.originalEvent.shiftKey;13===t.originalEvent.keyCode&&e[0].classList.contains("leaflet-popup-close-button")||27===t.originalEvent.keyCode?(L.DomEvent.stopPropagation(t),s.closePopup(n),s._container.focus(),27!==t.originalEvent.keyCode&&(s._popupClosed=!0)):o&&e[0].classList.contains("leaflet-popup-close-button")?s.closePopup(n):e[0].classList.contains("mapml-popup-content")&&o&&i?(s.closePopup(n),setTimeout(()=>{L.DomEvent.stop(t),s._container.focus()},0)):e[0]===n._content.querySelector("a")&&o&&i&&(s.closePopup(n),setTimeout(()=>{L.DomEvent.stop(t),s.getContainer.focus()},0))}function _(o){let i=this._content,n=o?o.currFeature:this._source._groupLayer._featureEl;if(i.querySelector("a.mapml-zoom-link")&&i.querySelector("a.mapml-zoom-link").remove(),n.querySelector("map-geometry")){var a=n.extent.topLeft.gcrs,o=n.extent.bottomRight.gcrs,o=L.latLngBounds(L.latLng(a.horizontal,a.vertical),L.latLng(o.horizontal,o.vertical)).getCenter(!0);let t=document.createElement("a");t.href=`#${n.getZoomToZoom()},${o.lng},`+o.lat,t.innerHTML=""+M.options.locale.popupZoom,t.className="mapml-zoom-link",t.onclick=t.onkeydown=function(t){(t instanceof MouseEvent||13===t.keyCode)&&(t.preventDefault(),n.zoomTo(),s.closePopup(),s.getContainer().focus())};let e=i.querySelector(".mapml-zoom-link");e&&e.remove(),i.insertBefore(t,i.querySelector("hr.mapml-popup-divider"))}}n._navigationBar=t,n._content.appendChild(p),n._content.appendChild(t),o.focus(),a&&!M.options.featureIndexOverlayOption?(a.setAttribute("aria-expanded","true"),s.on("keydown",h)):s.on("keydown",d),s.on("popupclose",function t(e){e.popup===n&&(s.off("keydown",h),s.off("keydown",d),s.off("popupopen",_),s.off("popupclose",t),a&&a.setAttribute("aria-expanded","false"))})}}),b=L.Layer.extend({onAdd:function(t){var e=t.getSize();(400tile: @@ -41,6 +41,6 @@ `,u+=`map: i:${Math.trunc(o.containerPoint.x)}, j:${Math.trunc(o.containerPoint.y)} `,u+=`tcrs: x:${Math.trunc(i.x)}, y:${Math.trunc(i.y)} `,u+=`pcrs: easting:${l.x.toFixed(2)}, northing:${l.y.toFixed(2)} -`,u+=`gcrs: lon :${o.latlng.lng.toFixed(6)}, lat:`+o.latlng.lat.toFixed(6),this.contextMenu._copyData(u)},_createItem:function(t,e,o){if(e.spacer)return this._createSeparator(t,o);t=this._insertElementAt("button","mapml-contextmenu-item",t,o),o=this._createEventHandler(t,e.callback,e.context,e.hideOnSelect);return t.innerHTML=""+e.text,t.setAttribute("type","button"),t.classList.add("mapml-button"),e.popup&&(t.setAttribute("aria-haspopup","true"),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-controls","mapml-copy-submenu")),L.DomEvent.on(t,"mouseover",this._onItemMouseOver,this).on(t,"mouseout",this._onItemMouseOut,this).on(t,"mousedown",L.DomEvent.stopPropagation).on(t,"click",o),L.Browser.touch&&L.DomEvent.on(t,this._touchstart,L.DomEvent.stopPropagation),L.Browser.pointer||L.DomEvent.on(t,"click",this._onItemMouseOut,this),{id:L.Util.stamp(t),el:t,callback:o}},_createSeparator:function(t,e){e=this._insertElementAt("div","mapml-contextmenu-separator",t,e);return{id:L.Util.stamp(e),el:e}},_createEventHandler:function(r,l,u,m){let c=this;return m=void 0===m||m,function(t){let e=c._map,o=c._showLocation.containerPoint,i=e.containerPointToLayerPoint(o),n=e.layerPointToLatLng(i),a=c._showLocation.relatedTarget,s={containerPoint:o,layerPoint:i,latlng:n,relatedTarget:a};m&&c._hide(),l&&l.call(u||e,s),c._map.fire("contextmenu.select",{contextmenu:c,el:r})}},_insertElementAt:function(t,e,o,i){let n,a=document.createElement(t);return a.className=e,void 0!==i&&(n=o.children[i]),n?o.insertBefore(a,n):o.appendChild(a),a},_show:function(e){if(!e.originalEvent.target.closest(".mapml-vector-container")){this._mapMenuVisible&&this._hide();let t=(this._clickEvent=e).originalEvent.target;if(t.closest("fieldset"))t=t.closest("fieldset"),"mapml-layer-item"===t.className?(t=t.querySelector("span"),this._layerMenu.removeAttribute("hidden"),this._showAtPoint(e.containerPoint,e,this._layerMenu)):"mapml-layer-extent"===t.className&&(t=t.querySelector("span"),this._extentLayerMenu.removeAttribute("hidden"),this._showAtPoint(e.containerPoint,e,this._extentLayerMenu)),this._layerClicked=t;else if(t.classList.contains("leaflet-container")||t.classList.contains("mapml-debug-extent")||"path"===t.tagName){var o=this._map.options.mapEl.layers;this._layerClicked=Array.from(o).find(t=>t.checked);let t=e.containerPoint;L.Browser.gecko&&(t=(i=this._map.getContainer(),o=i.getBoundingClientRect().width,i=i.getBoundingClientRect().height,{x:Number.parseInt(o/2),y:Number.parseInt(i/2)})),this._container.removeAttribute("hidden"),this._showAtPoint(t,e,this._container),this._updateCS()}var i,n;0!==e.originalEvent.button&&-1!==e.originalEvent.button||(this._keyboardEvent=!0,this._layerClicked.className.includes("mapml-layer-item")?(n=document.activeElement,this._elementInFocus=n.shadowRoot.activeElement,this._layerMenuTabs=1,this._layerMenu.firstChild.focus()):this._layerClicked.className.includes("mapml-extent-item")?(n=document.activeElement,this._elementInFocus=n.shadowRoot.activeElement,this._extentLayerMenuTabs=1,this._extentLayerMenu.firstChild.focus()):this._container.querySelectorAll("button:not([disabled])")[0].focus())}},_showAtPoint:function(t,e,o){var i;this._items.length&&(i=L.extend(e||{},{contextmenu:this}),this._showLocation={containerPoint:t},e&&e.relatedTarget&&(this._showLocation.relatedTarget=e.relatedTarget),this._setPosition(t,o),this._mapMenuVisible||(o.removeAttribute("hidden"),this._mapMenuVisible=!0),this._map.fire("contextmenu.show",i))},_hide:function(){this._mapMenuVisible&&(this._mapMenuVisible=!1,this._container.setAttribute("hidden",""),this._copySubMenu.setAttribute("hidden",""),this._layerMenu.setAttribute("hidden",""),this._extentLayerMenu.setAttribute("hidden",""),this._map.fire("contextmenu.hide",{contextmenu:this}),setTimeout(()=>this._map._container.focus(),0),this.activeIndex=0,this.isRunned=!1)},_setPosition:function(t,e){var o,i=this._map.getSize(),n=this._getElementSize(e);this._map.options.contextmenuAnchor&&(o=L.point(this._map.options.contextmenuAnchor),t=t.add(o)),(e._leaflet_pos=t).x+n.x>i.x?(e.style.left="auto",e.style.right=Math.min(Math.max(i.x-t.x,0),i.x-n.x-1)+"px"):(e.style.left=Math.max(t.x,0)+"px",e.style.right="auto"),t.y+n.y>i.y?(e.style.top="auto",e.style.bottom=Math.min(Math.max(i.y-t.y,0),i.y-n.y-1)+"px"):(e.style.top=Math.max(t.y,0)+"px",e.style.bottom="auto")},_getElementSize:function(t){let e=this._size;return e&&!this._sizeChanged||(e={},t.style.left="-999999px",t.style.right="auto",e.x=t.offsetWidth,e.y=t.offsetHeight,t.style.left="auto",this._sizeChanged=!1),e},_focusOnLayerControl:function(){this._mapMenuVisible=!1,delete this._layerMenuTabs,delete this._extentLayerMenuTabs,this._layerMenu.setAttribute("hidden",""),this._extentLayerMenu.setAttribute("hidden",""),(this._elementInFocus||this._layerClicked.parentElement.firstChild).focus(),delete this._elementInFocus},_setActiveItem:function(o){if(null===document.activeElement.shadowRoot&&!0===this.noActiveEl&&(this.noActiveEl=!1,this._items[9].el.el.focus()),document.activeElement.shadowRoot.activeElement.innerHTML===this._items[o].el.el.innerHTML){let t=o+1;for(;this._items[t].el.el.disabled;)t++,t>=this._items.length&&(t=0);this._setActiveItem(t)}else if(this.excludedIndices.includes(o)){let t=o+1,e=o-1;for(;this.excludedIndices.includes(t)||this._items[t].el.el.disabled;)t++,t>=this._items.length&&(t=0);for(;this.excludedIndices.includes(e)||this._items[e].el.el.disabled;)e--,e<0&&(e=this._items.length-1);this.activeIndex=this._items.length&&(t=0);this._setActiveItem(t)}else this._setActiveItem(0),this.isRunned=!0;else{let t=0;for(;this._items[t].el.el.disabled;)t++,t>=this._items.length&&(t=0);this._setActiveItem(t)}else this._extentLayerMenu.children[this._menuItems.LYRZOOMTO].focus();else this._extentLayerMenu.children[this._menuItems.LYRCOPY].focus();else this._layerMenu.children[this._menuItems.LYRZOOMTO].focus();else this._layerMenu.children[this._menuItems.LYRCOPY].focus();else this._copySubMenu.children[this._menuItems.CPYMENUEXTENT].focus();else this._copySubMenu.children[this._menuItems.CPYMENULOC].focus();else this._copySubMenu.children[this._menuItems.CPYMENUMAP].focus();else if("ArrowRight"===t.code)null!==document.activeElement.shadowRoot&&document.activeElement.shadowRoot.activeElement.innerHTML===this._items[this._menuItems.CTXCOPY].el.el.innerHTML&&this._copySubMenu.hasAttribute("hidden")?(this._showCopySubMenu(),this._copySubMenu.children[0].focus()):document.activeElement.shadowRoot.activeElement.innerHTML!==this._items[this._menuItems.CTXCOPY].el.el.innerHTML||this._copySubMenu.hasAttribute("hidden")||this._copySubMenu.children[0].focus();else if("ArrowLeft"===t.code)this._copySubMenu.hasAttribute("hidden")||null===document.activeElement.shadowRoot||document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENUMAP].innerHTML&&document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENUEXTENT].innerHTML&&document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENULOC].innerHTML||(this._copySubMenu.setAttribute("hidden",""),this._setActiveItem(this._menuItems.CTXCOPY));else if("Escape"===t.code){if(this._layerMenuTabs||this._extentLayerMenuTabs)return L.DomEvent.stop(t),void this._focusOnLayerControl();null===document.activeElement.shadowRoot||this._copySubMenu.hasAttribute("hidden")?this._hide():document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENUMAP].innerHTML&&document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENUEXTENT].innerHTML&&document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENULOC].innerHTML||(this._copySubMenu.setAttribute("hidden",""),this._setActiveItem(this._menuItems.CTXCOPY))}else"KeyC"!==t.code&&document.activeElement.shadowRoot.activeElement.innerHTML!==this._items[this._menuItems.CTXCOPY].el.el.innerHTML&&this._hide();switch(t.code){case"Enter":document.activeElement.shadowRoot.activeElement.innerHTML===this._items[this._menuItems.CTXCOPY].el.el.innerHTML?(this._copyCoords({latlng:this._map.getCenter()}),this._copySubMenu.firstChild.focus()):this._map._container.parentNode.activeElement.parentNode.classList.contains("mapml-contextmenu")&&this._map._container.parentNode.activeElement.click();break;case"Space":this._map._container.parentNode.activeElement.parentNode.classList.contains("mapml-contextmenu")&&this._map._container.parentNode.activeElement.click();break;case"KeyC":this._copyCoords({latlng:this._map.getCenter()}),this._copySubMenu.firstChild.focus();break;case"KeyD":this._toggleDebug(t);break;case"KeyM":this._copyMapML(t);break;case"KeyL":this._layerClicked.className.includes("mapml-layer-item")?this._copyLayer(t):this._layerClicked.className.includes("mapml-extent-item")&&this._copyMapExtent(t);break;case"KeyF":this._toggleFullScreen(t);break;case"KeyP":this._paste(t);break;case"KeyT":this._toggleControls(t);break;case"KeyV":this._viewSource(t);break;case"KeyZ":this._layerClicked.className.includes("mapml-layer-item")?this._zoomToLayer(t):this._layerClicked.className.includes("mapml-extent-item")&&this._zoomToMapExtent(t)}}},_showCopySubMenu:function(t){let e=this._map.getSize(),o=this._clickEvent,i=this._copySubMenu,n=this._items[5].el.el;n.setAttribute("aria-expanded","true"),i.removeAttribute("hidden");var a=this._container.offsetWidth,s=(this._container.offsetHeight,i.offsetWidth);o.containerPoint.x+a+s>e.x?(i.style.left="auto",i.style.right=a+"px"):(i.style.left=a+"px",i.style.right="auto"),i.style.top="78px",i.style.bottom="auto"},_hideCopySubMenu:function(t){if(t.relatedTarget&&t.relatedTarget.parentElement&&!t.relatedTarget.parentElement.classList.contains("mapml-submenu")&&!t.relatedTarget.classList.contains("mapml-submenu")){let t=this._copySubMenu,e=this._items[4].el.el;e.setAttribute("aria-expanded","false"),t.setAttribute("hidden",""),this.noActiveEl=!0}},_onItemMouseOver:function(t){L.DomUtil.addClass(t.target||t.srcElement,"over"),t.srcElement.innerText===M.options.locale.cmCopyCoords+" (C)"&&this._showCopySubMenu(t)},_onItemMouseOut:function(t){L.DomUtil.removeClass(t.target||t.srcElement,"over"),this._hideCopySubMenu(t)},toggleContextMenuItem:function(t,e){t=t.toUpperCase(),"disabled"===e?"CONTROLS"===t?this._items[8].el.el.disabled=!0:"BACK"===t?this._items[0].el.el.disabled=!0:"FORWARD"===t?this._items[1].el.el.disabled=!0:"RELOAD"===t&&(this._items[2].el.el.disabled=!0):"enabled"===e&&("CONTROLS"===t?this._items[8].el.el.disabled=!1:"BACK"===t?this._items[0].el.el.disabled=!1:"FORWARD"===t?this._items[1].el.el.disabled=!1:"RELOAD"===t&&(this._items[2].el.el.disabled=!1))},setViewFullScreenInnerHTML:function(t){"view"===t?this._map.contextMenu._items[3].el.el.innerHTML=M.options.locale.btnFullScreen+" (F)":"exit"===t&&(this._map.contextMenu._items[3].el.el.innerHTML=M.options.locale.btnExitFullScreen+" (F)")}}),z=function(e,o,t){if(!e||!o)return{};let i=[],n=[],a=[],s=[],r=o.options.crs.tile.bounds.max.y;for(let t=0;t{!o.inPlace&&i?e.parentElement.zoomTo(+i.lat,+i.lng,+i.z):o.inPlace||e.zoomTo(),s&&(e.opacity=s),a.getContainer().focus()})}},Y=function(t){if(!t)return null;let o,i=t instanceof ShadowRoot?":host":":scope",n=t.querySelector(i+" > map-meta[name=projection]")&&M._metaContentToObject(t.querySelector(i+" > map-meta[name=projection]").getAttribute("content")).content.toUpperCase()||M.FALLBACK_PROJECTION;try{var a=t.querySelector(i+" > map-meta[name=extent]")&&M._metaContentToObject(t.querySelector(i+" > map-meta[name=extent]").getAttribute("content")),s=a.zoom;let e=Object.keys(a);for(let t=0;t map-meta[name=zoom]").getAttribute("content"));return e.min&&e.max&&e.value?{minZoom:+e.min,maxZoom:+e.max,minNativeZoom:+e.value,maxNativeZoom:+e.value}:e.min&&e.max?{minZoom:+e.min,maxZoom:+e.max}:e.min?{minZoom:+e.min}:e.max?{maxZoom:+e.max}:void 0},K=function(t,o){if(!t)return null;let i=100,n=0,a=t.querySelectorAll("map-feature"),e,s;for(let e=0;e';e.insertAdjacentHTML("beforeend",t),e.lastElementChild.whenReady().catch(()=>{e&&e.removeChild(e.lastChild),t=null})}catch(t){if(")|()|()|()|()|()|()|()|(