@mapcreator/sdk 1.5.9 → 1.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adornments/scalebar.d.ts +5 -2
- package/dist/controls/webControls.d.ts +1 -1
- package/dist/mapcreator-sdk.js +109 -96
- package/dist/mapcreator-sdk.umd.cjs +58 -58
- package/dist/report.html +1 -1
- package/package.json +1 -1
|
@@ -924,7 +924,7 @@ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matr
|
|
|
924
924
|
`;function Xi(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}function Zi(e){return document.fullscreenElement===e||document.webkitFullscreenElement===e||document.mozFullScreenElement===e||document.msFullscreenElement===e}function Qi(e){e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen?e.msRequestFullscreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}function $i(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen()}function ea(e){return Pi({type:`button`,className:`control-button fullscreen-control-button`,content:Yi,onClick:()=>{let t=e.getContainer();if(Xi())Zi(t)?$i():Qi(t);else{let e=document.location.href;e+=e.includes(`?`)?`&`:`?`,e+=`close-tab`,window.open(e,`_blank`)}}})}var ta=`<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M6.155 1.146A.546.546 0 0 1 6.53 1c.14 0 .275.053.375.146l1.588 1.5c.1.094.155.221.155.354 0 .132-.056.26-.155.353l-1.588 1.5a.546.546 0 0 1-.373.14.545.545 0 0 1-.37-.146.487.487 0 0 1-.154-.349.486.486 0 0 1 .148-.352L6.84 3.5H6c-1.878 0-3.441 1.476-3.441 3.25S4.122 10 6 10s3.441-1.476 3.441-3.25c0-.133.056-.26.155-.354a.546.546 0 0 1 .375-.146c.14 0 .275.053.374.146.1.094.155.221.155.354C10.5 9.076 8.463 11 6 11S1.5 9.076 1.5 6.75 3.537 2.5 6 2.5h.84l-.685-.647A.486.486 0 0 1 6 1.5c0-.133.056-.26.155-.354Z"/></svg>
|
|
925
925
|
`;function na(e,t){return Pi({type:`button`,className:`control-button refresh-button`,content:ta,onClick:()=>{e.easeTo({center:t.center,zoom:t.zoom,pitch:t.pitch,bearing:t.rotation})}})}var ra=`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="currentColor"><path d="M5.374.952a4.546 4.546 0 0 1 4.656 4.175 4.55 4.55 0 0 1-.958 3.184l1.824 1.81a.55.55 0 0 1 0 .765.55.55 0 0 1-.602.121.6.6 0 0 1-.179-.12l-1.807-1.81A4.544 4.544 0 0 1 .953 5.376 4.553 4.553 0 0 1 5.374.952m1.454 1.37a3.447 3.447 0 0 0-4.505 4.51 3.45 3.45 0 0 0 3.186 2.13A3.45 3.45 0 0 0 8.957 5.51a3.455 3.455 0 0 0-2.129-3.187"/></svg>
|
|
926
926
|
`,ia=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor"><path d="m7.038 5.96 3.03 3.03L13.1 5.958l1.01 1.01L11.078 10l3.031 3.032-1.01 1.01-3.031-3.031-3.03 3.028-1.01-1.01L9.059 10l-3.03-3.03z"/></svg>
|
|
927
|
-
`,aa={da_DK:{search:`Search`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Use two fingers to move the map`,windowsHelpText:`Use Ctrl + scroll to zoom the map`,macHelpText:`Use ⌘ + scroll to zoom the map`},de_DE:{search:`Suche`,videoAlert:`Das Video ist in der veröffentlichten Karte sichtbar.`,mobileHelpText:`Verwenden Sie zwei Finger um die Karte zu bewegen`,windowsHelpText:`Verwenden Sie Strg + Scroll um in der Karte zu zoomen`,macHelpText:`Verwenden Sie ⌘ + Scroll um in der Karte zu zoomen`},en_GB:{search:`Search`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Use two fingers to move the map`,windowsHelpText:`Use Ctrl + scroll to zoom the map`,macHelpText:`Use ⌘ + scroll to zoom the map`},es_ES:{search:`Buscar`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Use dos dedos para mover el mapa`,windowsHelpText:`Use Ctrl + desplazamiento para hacer zoom en el mapa`,macHelpText:`Use ⌘ + desplazamiento para hacer zoom en el mapa`},fr_FR:{search:`Rechercher`,videoAlert:`Votre vidéo sera diffusée sur la carte publiée`,mobileHelpText:`Utilisez deux doigts pour déplacer la carte`,windowsHelpText:`Utilisez Ctrl + défilement pour zoomer sur la carte`,macHelpText:`Utilisez ⌘ + défilement pour zoomer sur la carte`},it_IT:{search:`Cercare`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Usa due dita per muovere la mappa`,windowsHelpText:`Usa Ctrl + Scroll per ingrandire la mappa`,macHelpText:`Usa ⌘ + Scroll per ingrandire la mappa`},nl_NL:{search:`Zoeken`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Gebruik twee vingers om de kaart te bewegen`,windowsHelpText:`Gebruik Ctrl + Scroll om de kaart te zoomen`,macHelpText:`Gebruik ⌘ + Scroll om de kaart te zoomen`}};function oa(){let e=navigator.language.replace(`-`,`_`),t=Object.keys(aa);return t.find(t=>t===e)??t.find(t=>t.split(`_`)[0]===e.split(`_`)[0])??`en_GB`}var X=oa();function sa(e){return aa[X][e]??e}var ca=class{async getLocationInBounds(e,t,n=10){try{let r=await this._callGraphHopper({limit:n,q:e,point:`${t.lat},${t.lng}`});return this._mapResults(r.hits)}catch(e){return console.warn(`Geocoding failed: `,e),[]}}async _callGraphHopper(e){let t=new URLSearchParams(e);t.append(`key`,`c5c40ac9-ed73-4e20-aed6-cfe495604ca8`),t.append(`locale`,X.slice(0,2));let n={headers:{Accept:`application/json`}},r=`https://graphhopper.com/api/1/geocode?${t}`;return await(await fetch(r,n)).json()}_mapResults(e){return e.map(e=>({id:e.osm_id.toString(),labelTitle:e.name,position:{lng:e.point.lng,lat:e.point.lat},bbox:e.extent?[{lng:e.extent[0],lat:e.extent[1]},{lng:e.extent[2],lat:e.extent[3]}]:null,subtitle:[e.osm_value,e.city,e.state,e.country].filter(Boolean).join(`, `)}))}},la=class{map;mapContainer;container;control;input;dropdown;inputWrapper;button;isOpen=!1;geocoder=new ca;suggestions=[];items=[];index=0;debounce;constructor(e){this.map=e,this.container=document.createElement(`div`),this.control=document.createElement(`div`),this.input=document.createElement(`input`),this.dropdown=document.createElement(`div`),this.inputWrapper=document.createElement(`div`),this.button=document.createElement(`button`),this.mapContainer=this.map.getContainer()}init(){this.container.className=`geocoder-container`,this.control.className=`geocoder-control`,this.input.className=`geocoder-input`,this.dropdown.className=`geocoder-dropdown`,this.inputWrapper.className=`geocoder-input-wrapper`,this.button.className=`control-button`,this.input.type=`text`,this.input.placeholder=sa(`search`),this.button.innerHTML=ra;let e=document.createElement(`button`);e.className=`geocoder-clear`,e.innerHTML=ia;let t=document.createElement(`div`);return t.className=`geocoder-scrollwrapper`,t.append(this.dropdown),this.inputWrapper.append(this.input,e),this.control.append(this.button,this.inputWrapper,t),e.addEventListener(`click`,()=>this.clearAll()),this.button.addEventListener(`click`,()=>this.toggle()),this.input.addEventListener(`input`,()=>this.onInput()),this.input.addEventListener(`keydown`,e=>this.onKeyDown(e)),this.dropdown.addEventListener(`mousemove`,e=>this.onMouseMove(e)),this.mapContainer.addEventListener(`mousedown`,e=>this.clickOutside(e)),window.addEventListener(`resize`,()=>this.setMaxSizes()),this.setMaxSizes(),this.updateVisibility(),this.container.append(this.control),this.container}clickOutside(e){e.target instanceof Node&&!this.control.contains(e.target)&&this.hide()}setMaxSizes(){let{width:e,height:t}=this.mapContainer.getBoundingClientRect();this.control.style.maxWidth=`${e-40}px`,this.dropdown.style.maxHeight=`${Math.min(310,t-63)}px`}toggle(){this.isOpen=!this.isOpen,this.button.classList.toggle(`open`),this.updateVisibility(),this.isOpen&&this.input.focus()}hide(){this.isOpen&&(this.isOpen=!1,this.button.classList.remove(`open`),this.updateVisibility())}clearDropdown(){this.suggestions=[],this.items=[],this.dropdown.innerHTML=``}clearAll(){this.input.value=``,this.clearDropdown()}updateVisibility(){let e=this.isOpen;this.inputWrapper.style.display=e?`flex`:`none`,e||this.clearAll()}onInput(){let e=this.input.value.trim();if(this.debounce&&clearTimeout(this.debounce),e.length<2){this.dropdown.innerHTML=``;return}this.debounce=window.setTimeout(async()=>{this.suggestions=await this.geocoder.getLocationInBounds(e,this.map.getCenter(),20),this.items=[],this.renderSuggestions()},200)}renderSuggestions(){this.dropdown.innerHTML=``,this.items=[],this.index=0,this.suggestions.forEach(e=>{let t=document.createElement(`div`),n=document.createElement(`div`),r=document.createElement(`div`);t.className=`geocoder-suggestion`,n.className=`title`,r.className=`subtitle`,n.textContent=e.labelTitle,r.textContent=e.subtitle,t.append(n,r),t.addEventListener(`mousedown`,t=>{t.stopPropagation(),this.goToSelection(e)}),this.dropdown.appendChild(t),this.items.push({data:e,el:t})}),this.updateHighlight()}updateHighlight(){this.items.forEach((e,t)=>{e.el.classList.toggle(`highlight`,t===this.index)})}onKeyDown(e){if(e.key===`ArrowUp`)e.preventDefault(),this.index--,this.index<0&&(this.index=this.items.length-1),this.adjustScroll();else if(e.key===`ArrowDown`)e.preventDefault(),this.index++,this.index>this.items.length-1&&(this.index=0),this.adjustScroll();else if(e.key===`Enter`){e.preventDefault();let t=this.items[this.index];t&&this.goToSelection(t.data)}else e.key===`Escape`&&(e.preventDefault(),this.hide());this.updateHighlight()}onMouseMove(e){let t=e.target.closest(`.geocoder-suggestion`);this.index=this.items.findIndex(e=>e.el===t),this.updateHighlight()}goToSelection(e){e.bbox?this.map.fitBounds(e.bbox,{duration:0,animate:!1}):this.map.jumpTo({center:e.position,zoom:16}),this.input.value=e.labelTitle,this.clearDropdown()}adjustScroll(){let e=this.items[this.index].el,t=this.dropdown,n=t.getBoundingClientRect(),r=e.getBoundingClientRect();r.bottom>n.bottom?t.scrollTop+=r.bottom-n.bottom:r.top<n.top&&(t.scrollTop+=r.top-n.top)}};function ua(){return navigator.userAgent.toLowerCase().indexOf(`mobile`)>=0}function da(e,t,n,r){let
|
|
927
|
+
`,aa={da_DK:{search:`Search`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Use two fingers to move the map`,windowsHelpText:`Use Ctrl + scroll to zoom the map`,macHelpText:`Use ⌘ + scroll to zoom the map`},de_DE:{search:`Suche`,videoAlert:`Das Video ist in der veröffentlichten Karte sichtbar.`,mobileHelpText:`Verwenden Sie zwei Finger um die Karte zu bewegen`,windowsHelpText:`Verwenden Sie Strg + Scroll um in der Karte zu zoomen`,macHelpText:`Verwenden Sie ⌘ + Scroll um in der Karte zu zoomen`},en_GB:{search:`Search`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Use two fingers to move the map`,windowsHelpText:`Use Ctrl + scroll to zoom the map`,macHelpText:`Use ⌘ + scroll to zoom the map`},es_ES:{search:`Buscar`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Use dos dedos para mover el mapa`,windowsHelpText:`Use Ctrl + desplazamiento para hacer zoom en el mapa`,macHelpText:`Use ⌘ + desplazamiento para hacer zoom en el mapa`},fr_FR:{search:`Rechercher`,videoAlert:`Votre vidéo sera diffusée sur la carte publiée`,mobileHelpText:`Utilisez deux doigts pour déplacer la carte`,windowsHelpText:`Utilisez Ctrl + défilement pour zoomer sur la carte`,macHelpText:`Utilisez ⌘ + défilement pour zoomer sur la carte`},it_IT:{search:`Cercare`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Usa due dita per muovere la mappa`,windowsHelpText:`Usa Ctrl + Scroll per ingrandire la mappa`,macHelpText:`Usa ⌘ + Scroll per ingrandire la mappa`},nl_NL:{search:`Zoeken`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Gebruik twee vingers om de kaart te bewegen`,windowsHelpText:`Gebruik Ctrl + Scroll om de kaart te zoomen`,macHelpText:`Gebruik ⌘ + Scroll om de kaart te zoomen`}};function oa(){let e=navigator.language.replace(`-`,`_`),t=Object.keys(aa);return t.find(t=>t===e)??t.find(t=>t.split(`_`)[0]===e.split(`_`)[0])??`en_GB`}var X=oa();function sa(e){return aa[X][e]??e}var ca=class{async getLocationInBounds(e,t,n=10){try{let r=await this._callGraphHopper({limit:n,q:e,point:`${t.lat},${t.lng}`});return this._mapResults(r.hits)}catch(e){return console.warn(`Geocoding failed: `,e),[]}}async _callGraphHopper(e){let t=new URLSearchParams(e);t.append(`key`,`c5c40ac9-ed73-4e20-aed6-cfe495604ca8`),t.append(`locale`,X.slice(0,2));let n={headers:{Accept:`application/json`}},r=`https://graphhopper.com/api/1/geocode?${t}`;return await(await fetch(r,n)).json()}_mapResults(e){return e.map(e=>({id:e.osm_id.toString(),labelTitle:e.name,position:{lng:e.point.lng,lat:e.point.lat},bbox:e.extent?[{lng:e.extent[0],lat:e.extent[1]},{lng:e.extent[2],lat:e.extent[3]}]:null,subtitle:[e.osm_value,e.city,e.state,e.country].filter(Boolean).join(`, `)}))}},la=class{map;mapContainer;container;control;input;dropdown;inputWrapper;button;isOpen=!1;geocoder=new ca;suggestions=[];items=[];index=0;debounce;constructor(e){this.map=e,this.container=document.createElement(`div`),this.control=document.createElement(`div`),this.input=document.createElement(`input`),this.dropdown=document.createElement(`div`),this.inputWrapper=document.createElement(`div`),this.button=document.createElement(`button`),this.mapContainer=this.map.getContainer()}init(){this.container.className=`geocoder-container`,this.control.className=`geocoder-control`,this.input.className=`geocoder-input`,this.dropdown.className=`geocoder-dropdown`,this.inputWrapper.className=`geocoder-input-wrapper`,this.button.className=`control-button`,this.input.type=`text`,this.input.placeholder=sa(`search`),this.button.innerHTML=ra;let e=document.createElement(`button`);e.className=`geocoder-clear`,e.innerHTML=ia;let t=document.createElement(`div`);return t.className=`geocoder-scrollwrapper`,t.append(this.dropdown),this.inputWrapper.append(this.input,e),this.control.append(this.button,this.inputWrapper,t),e.addEventListener(`click`,()=>this.clearAll()),this.button.addEventListener(`click`,()=>this.toggle()),this.input.addEventListener(`input`,()=>this.onInput()),this.input.addEventListener(`keydown`,e=>this.onKeyDown(e)),this.dropdown.addEventListener(`mousemove`,e=>this.onMouseMove(e)),this.mapContainer.addEventListener(`mousedown`,e=>this.clickOutside(e)),window.addEventListener(`resize`,()=>this.setMaxSizes()),this.setMaxSizes(),this.updateVisibility(),this.container.append(this.control),this.container}clickOutside(e){e.target instanceof Node&&!this.control.contains(e.target)&&this.hide()}setMaxSizes(){let{width:e,height:t}=this.mapContainer.getBoundingClientRect();this.control.style.maxWidth=`${e-40}px`,this.dropdown.style.maxHeight=`${Math.min(310,t-63)}px`}toggle(){this.isOpen=!this.isOpen,this.button.classList.toggle(`open`),this.updateVisibility(),this.isOpen&&this.input.focus()}hide(){this.isOpen&&(this.isOpen=!1,this.button.classList.remove(`open`),this.updateVisibility())}clearDropdown(){this.suggestions=[],this.items=[],this.dropdown.innerHTML=``}clearAll(){this.input.value=``,this.clearDropdown()}updateVisibility(){let e=this.isOpen;this.inputWrapper.style.display=e?`flex`:`none`,e||this.clearAll()}onInput(){let e=this.input.value.trim();if(this.debounce&&clearTimeout(this.debounce),e.length<2){this.dropdown.innerHTML=``;return}this.debounce=window.setTimeout(async()=>{this.suggestions=await this.geocoder.getLocationInBounds(e,this.map.getCenter(),20),this.items=[],this.renderSuggestions()},200)}renderSuggestions(){this.dropdown.innerHTML=``,this.items=[],this.index=0,this.suggestions.forEach(e=>{let t=document.createElement(`div`),n=document.createElement(`div`),r=document.createElement(`div`);t.className=`geocoder-suggestion`,n.className=`title`,r.className=`subtitle`,n.textContent=e.labelTitle,r.textContent=e.subtitle,t.append(n,r),t.addEventListener(`mousedown`,t=>{t.stopPropagation(),this.goToSelection(e)}),this.dropdown.appendChild(t),this.items.push({data:e,el:t})}),this.updateHighlight()}updateHighlight(){this.items.forEach((e,t)=>{e.el.classList.toggle(`highlight`,t===this.index)})}onKeyDown(e){if(e.key===`ArrowUp`)e.preventDefault(),this.index--,this.index<0&&(this.index=this.items.length-1),this.adjustScroll();else if(e.key===`ArrowDown`)e.preventDefault(),this.index++,this.index>this.items.length-1&&(this.index=0),this.adjustScroll();else if(e.key===`Enter`){e.preventDefault();let t=this.items[this.index];t&&this.goToSelection(t.data)}else e.key===`Escape`&&(e.preventDefault(),this.hide());this.updateHighlight()}onMouseMove(e){let t=e.target.closest(`.geocoder-suggestion`);this.index=this.items.findIndex(e=>e.el===t),this.updateHighlight()}goToSelection(e){e.bbox?this.map.fitBounds(e.bbox,{duration:0,animate:!1}):this.map.jumpTo({center:e.position,zoom:16}),this.input.value=e.labelTitle,this.clearDropdown()}adjustScroll(){let e=this.items[this.index].el,t=this.dropdown,n=t.getBoundingClientRect(),r=e.getBoundingClientRect();r.bottom>n.bottom?t.scrollTop+=r.bottom-n.bottom:r.top<n.top&&(t.scrollTop+=r.top-n.top)}};function ua(){return navigator.userAgent.toLowerCase().indexOf(`mobile`)>=0}function da(e,t,n,r,i){let a=document.createElement(`div`);return a.classList.add(`web-control`,`adornment`),fa(e,i).forEach(e=>{let i;if(e===`zoomIn`)i=Ri(t);else if(e===`zoomOut`)i=zi(t);else if(e===`fullscreen`)i=ea(t);else if(e===`geolocation`)i=Ji(t,n);else if(e===`refresh`)i=na(t,r);else if(e===`search`)i=new la(t).init();else if(e===`toggleAdornments`)i=Fi(t,t.getContainer());else return;a.appendChild(i)}),a}function fa(e,t){let n=e.buttons.flatMap(e=>e===`zoom`?[`zoomIn`,`zoomOut`]:e);if(ua()){let e=n.filter(e=>e!==`zoomIn`&&e!==`zoomOut`);if(t){let t=e[0]===`search`?1:0;e.splice(t,0,`toggleAdornments`)}return e}return n}var Z={here:{href:`https://www.here.com/`,label:`© HERE 2025`},mapcreator:{href:`https://mapcreator.io/`,label:`© Mapcreator`},openStreetMap:{href:`https://www.openstreetmap.org/copyright/`,label:`© OpenStreetMap`}};function pa(e,t,n){let r=document.createElement(`div`);r.className=`adornment`;let i=()=>{r.innerHTML=ga(t,e,n)};return i(),t.on(`attributionchange`,i),t.on(`zoomend`,i),r}function ma(e){let t=Object.values(e.style.sourceCaches),n=[Z.mapcreator],r={osm:!1,here:!1};for(let e=0;e<t.length&&!(r.osm&&r.here);++e){let n=t[e];if(n.used){let e=n.getSource();`attribution`in e&&typeof e.attribution==`string`&&(e.attribution.includes(`OpenStreetMap`)&&(r.osm=!0),e.attribution.includes(`HERE`)&&(r.here=!0))}}return r.osm&&n.push(Z.openStreetMap),r.here&&n.push(Z.here),n}function ha(e,t,n){let r=document.createElement(`span`);r.style.fontFamily=t,r.style.fontSize=`${n}px`,r.style.position=`absolute`,r.style.visibility=`hidden`,r.innerText=e,document.body.appendChild(r);let i=Math.max(r.offsetWidth,1);return r.remove(),i}function ga(e,t,n){let{color:r=`#000000`,font:i=`Arial, sans-serif`,fontSize:a=10,orientation:o=`horizontal`,position:s}=t,c=ma(e),l=ha(c.map(({label:e})=>e).join(` `),i,a),u=a*1.2,d=o===`vertical`,f=[`top_left`,`bottom_left`].includes(s),p=d?u:l,m=d?l:u,h=d?f?-90:90:0,g=d?f?.38*a:.3*a:.38*a,_=c.map(e=>`<a href="${e.href}" target="_blank">${e.label}</a>`).join(` `);return`
|
|
928
928
|
<svg
|
|
929
929
|
class="adornment-svg"
|
|
930
930
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -1007,94 +1007,94 @@ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matr
|
|
|
1007
1007
|
>
|
|
1008
1008
|
${S.join(``)}
|
|
1009
1009
|
</svg>
|
|
1010
|
-
`,Sl(e)}function xl(e){let{scale:t,boundingBox:n,moveEndPosition:r}=e,i=e.globeFallbackActive&&e.globeGeoJson!==void 0||e.isGlobe,a=vl*t,o=qc(),s;if(i){let{lng:e,lat:t}=r;s=_l().scale(a/2).translate([a/2,a/2]).rotate([-e,-t]).clipAngle(90)}else{s=ml().scale(1).translate([0,0]);let e=s([n[0],n[3]]),t=s([n[2],n[1]]),r=Math.abs(t[0]-e[0]),i=Math.abs(t[1]-e[1]),o=(e[0]+t[0])/2,c=(e[1]+t[1])/2,l=1/Math.max(r/a,i/a);s.scale(l).translate([a/2-l*o,a/2-l*c])}return o.projection(s),{path:o,projection:s}}function Sl(e){let{id:t,map:n,container:r,scale:i}=e,a=r.querySelector(`#frame-${t}`),o=r.querySelector(`#frame-outline-${t}`),s=r.querySelector(`#dot-${t}`);if(!a||!o||!s)return;let c=Cl(n),{path:l,projection:u}=xl(e),d=1/0,f=-1/0,p=1/0,m=-1/0,h=1/0,g=-1/0;$n(c,e=>{let t=u(e);d=Math.min(d,e[0]),f=Math.max(f,e[0]),p=Math.min(p,t[0]),m=Math.max(m,t[0]),h=Math.min(h,t[1]),g=Math.max(g,t[1])});let _=10*i;if(m-p<_||g-h<_){a.style.display=`none`,o.style.display=`none`,s.style.display=`block`;let e=n.getCenter(),[t,r]=u([e.lng,e.lat]);s.setAttribute(`cx`,String(t)),s.setAttribute(`cy`,String(r))}else if(f-d<180){a.style.display=`block`,o.style.display=`block`,s.style.display=`none`;let e=l(c);a.setAttribute(`d`,e),o.setAttribute(`d`,e)}else a.style.display=`none`,o.style.display=`none`,s.style.display=`none`}function Cl(e){let t=e.getCanvas().width,n=e.getCanvas().height,r=[];for(let n=0;n<64;n++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([N(0,t,n/64),0]);r.push([i,a])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([t,N(0,n,i/64)]);r.push([a,o])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([N(t,0,i/64),n]);r.push([a,o])}for(let t=0;t<64;t++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,N(n,0,t/64)]);r.push([i,a])}let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,0]);return r.push([i,a]),{type:`Feature`,properties:{},geometry:{coordinates:[r],type:`Polygon`}}}var wl=[10,5,3,2,1];function Tl(e,t=1e-6){let n=Math.floor(e);if(e-=n,e<t)return[n,1];if(1-t<e)return[n+1,1];let r=0,i=1,a=1,o=1;for(;;){let s=r+a,c=i+o;if(c*(e+t)<s)a=s,o=c;else if(s<(e-t)*c)r=s,i=c;else return[n*c+s,c]}}function El(e){let t=10**Math.floor(Math.log10(e)),n=e/t;for(let e of wl)if(n>=e)return e*t;return Dl(n)*t}function Dl(e){let t=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t)/t}var Ol={kilometer:`km`,meter:`m`,mile:`mi`,foot:`ft`,nauticalMile:`nm`};function kl(e,t,n){let
|
|
1010
|
+
`,Sl(e)}function xl(e){let{scale:t,boundingBox:n,moveEndPosition:r}=e,i=e.globeFallbackActive&&e.globeGeoJson!==void 0||e.isGlobe,a=vl*t,o=qc(),s;if(i){let{lng:e,lat:t}=r;s=_l().scale(a/2).translate([a/2,a/2]).rotate([-e,-t]).clipAngle(90)}else{s=ml().scale(1).translate([0,0]);let e=s([n[0],n[3]]),t=s([n[2],n[1]]),r=Math.abs(t[0]-e[0]),i=Math.abs(t[1]-e[1]),o=(e[0]+t[0])/2,c=(e[1]+t[1])/2,l=1/Math.max(r/a,i/a);s.scale(l).translate([a/2-l*o,a/2-l*c])}return o.projection(s),{path:o,projection:s}}function Sl(e){let{id:t,map:n,container:r,scale:i}=e,a=r.querySelector(`#frame-${t}`),o=r.querySelector(`#frame-outline-${t}`),s=r.querySelector(`#dot-${t}`);if(!a||!o||!s)return;let c=Cl(n),{path:l,projection:u}=xl(e),d=1/0,f=-1/0,p=1/0,m=-1/0,h=1/0,g=-1/0;$n(c,e=>{let t=u(e);d=Math.min(d,e[0]),f=Math.max(f,e[0]),p=Math.min(p,t[0]),m=Math.max(m,t[0]),h=Math.min(h,t[1]),g=Math.max(g,t[1])});let _=10*i;if(m-p<_||g-h<_){a.style.display=`none`,o.style.display=`none`,s.style.display=`block`;let e=n.getCenter(),[t,r]=u([e.lng,e.lat]);s.setAttribute(`cx`,String(t)),s.setAttribute(`cy`,String(r))}else if(f-d<180){a.style.display=`block`,o.style.display=`block`,s.style.display=`none`;let e=l(c);a.setAttribute(`d`,e),o.setAttribute(`d`,e)}else a.style.display=`none`,o.style.display=`none`,s.style.display=`none`}function Cl(e){let t=e.getCanvas().width,n=e.getCanvas().height,r=[];for(let n=0;n<64;n++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([N(0,t,n/64),0]);r.push([i,a])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([t,N(0,n,i/64)]);r.push([a,o])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([N(t,0,i/64),n]);r.push([a,o])}for(let t=0;t<64;t++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,N(n,0,t/64)]);r.push([i,a])}let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,0]);return r.push([i,a]),{type:`Feature`,properties:{},geometry:{coordinates:[r],type:`Polygon`}}}var wl=[10,5,3,2,1];function Tl(e,t=1e-6){let n=Math.floor(e);if(e-=n,e<t)return[n,1];if(1-t<e)return[n+1,1];let r=0,i=1,a=1,o=1;for(;;){let s=r+a,c=i+o;if(c*(e+t)<s)a=s,o=c;else if(s<(e-t)*c)r=s,i=c;else return[n*c+s,c]}}function El(e){let t=10**Math.floor(Math.log10(e)),n=e/t;for(let e of wl)if(n>=e)return e*t;return Dl(n)*t}function Dl(e){let t=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t)/t}var Ol={kilometer:`km`,meter:`m`,mile:`mi`,foot:`ft`,nauticalMile:`nm`};function kl(e,t,n,r,i){let a=document.createElement(`div`);a.className=`adornment`;let o=`ArialMT`;return{element:a,ready:Lr(e.font??o,n,r).then(()=>{a.innerHTML=Al(t,e,i,o),t.on(`move`,()=>{a.innerHTML=Al(t,e,i,o)})})}}function Al(e,t,n,r){let{maxWidth:i=100,fontSize:a=8,font:o=r,color:s=`#000000`,unit:c=`metric_and_imperial`}=t,l=e.getCenter(),u=e.projectWithScaleCorrection(l),d=T(l,e.unprojectWithScaleCorrection([u.x+i,u.y])),f=Object.fromEntries(Object.entries(Ol).map(([e,t])=>{let n=M(`meter`,e,d),r=El(n)||0;return[e,{value:n,ratio:n?r/n:0,humanized:r<1?`${Tl(r).join(`/`)} ${t}`:`${r} ${t}`}]})),p=f.meter.value>1e3?f.kilometer:f.meter,m=f.foot.value>5280?f.mile:f.foot,h={imperial:m,metric:p,nautical:f.nauticalMile},g=c===`metric_and_imperial`?void 0:h[c],_={metric:Math.round(i*p.ratio),imperial:Math.round(i*m.ratio)},v=c===`metric_and_imperial`?Math.max(_.metric,_.imperial):Math.round(i*(g?.ratio??0)),y=a+7;if(c===`metric_and_imperial`){let e=y+a*2;return`
|
|
1011
1011
|
<svg
|
|
1012
1012
|
class="adornment-svg"
|
|
1013
1013
|
xmlns="http://www.w3.org/2000/svg"
|
|
1014
|
-
width="${
|
|
1014
|
+
width="${v*n}"
|
|
1015
1015
|
height="${e*n}"
|
|
1016
|
-
viewBox="0 0 ${
|
|
1016
|
+
viewBox="0 0 ${v} ${e}"
|
|
1017
1017
|
>
|
|
1018
1018
|
<line
|
|
1019
1019
|
x1="0"
|
|
1020
|
-
y1="${
|
|
1021
|
-
x2="${
|
|
1022
|
-
y2="${
|
|
1023
|
-
stroke="${
|
|
1020
|
+
y1="${y-.5}"
|
|
1021
|
+
x2="${v}"
|
|
1022
|
+
y2="${y-.5}"
|
|
1023
|
+
stroke="${s}"
|
|
1024
1024
|
stroke-width="1"
|
|
1025
1025
|
/>
|
|
1026
1026
|
<line
|
|
1027
1027
|
x1="0.5"
|
|
1028
|
-
y1="${
|
|
1028
|
+
y1="${y-5}"
|
|
1029
1029
|
x2="0.5"
|
|
1030
|
-
y2="${
|
|
1031
|
-
stroke="${
|
|
1030
|
+
y2="${y+5}"
|
|
1031
|
+
stroke="${s}"
|
|
1032
1032
|
stroke-width="1"
|
|
1033
1033
|
/>
|
|
1034
1034
|
<line
|
|
1035
|
-
x1="${
|
|
1036
|
-
y1="${
|
|
1037
|
-
x2="${
|
|
1038
|
-
y2="${
|
|
1039
|
-
stroke="${
|
|
1035
|
+
x1="${_.imperial-.5}"
|
|
1036
|
+
y1="${y-5}"
|
|
1037
|
+
x2="${_.imperial-.5}"
|
|
1038
|
+
y2="${y}"
|
|
1039
|
+
stroke="${s}"
|
|
1040
1040
|
stroke-width="1"
|
|
1041
1041
|
/>
|
|
1042
1042
|
<line
|
|
1043
|
-
x1="${
|
|
1044
|
-
y1="${
|
|
1045
|
-
x2="${
|
|
1046
|
-
y2="${
|
|
1047
|
-
stroke="${
|
|
1043
|
+
x1="${_.metric-.5}"
|
|
1044
|
+
y1="${y}"
|
|
1045
|
+
x2="${_.metric-.5}"
|
|
1046
|
+
y2="${y+5}"
|
|
1047
|
+
stroke="${s}"
|
|
1048
1048
|
stroke-width="1"
|
|
1049
1049
|
/>
|
|
1050
1050
|
<text
|
|
1051
1051
|
x="0"
|
|
1052
|
-
y="${
|
|
1053
|
-
font-size="${
|
|
1054
|
-
font-family="${
|
|
1052
|
+
y="${y+7+a}"
|
|
1053
|
+
font-size="${a}px"
|
|
1054
|
+
font-family="${o}"
|
|
1055
1055
|
font-weight="bold"
|
|
1056
|
-
fill="${
|
|
1056
|
+
fill="${s}"
|
|
1057
1057
|
text-anchor="start"
|
|
1058
1058
|
>
|
|
1059
1059
|
0
|
|
1060
1060
|
</text>
|
|
1061
1061
|
<text
|
|
1062
|
-
x="${
|
|
1063
|
-
y="${
|
|
1064
|
-
font-size="${
|
|
1065
|
-
font-family="${
|
|
1062
|
+
x="${_.imperial}"
|
|
1063
|
+
y="${y-7}"
|
|
1064
|
+
font-size="${a}px"
|
|
1065
|
+
font-family="${o}"
|
|
1066
1066
|
font-weight="bold"
|
|
1067
|
-
fill="${
|
|
1067
|
+
fill="${s}"
|
|
1068
1068
|
text-anchor="end"
|
|
1069
1069
|
>
|
|
1070
|
-
${
|
|
1070
|
+
${m.humanized}
|
|
1071
1071
|
</text>
|
|
1072
1072
|
<text
|
|
1073
|
-
x="${
|
|
1074
|
-
y="${
|
|
1075
|
-
font-size="${
|
|
1076
|
-
font-family="${
|
|
1073
|
+
x="${_.metric}"
|
|
1074
|
+
y="${y+7+a}"
|
|
1075
|
+
font-size="${a}px"
|
|
1076
|
+
font-family="${o}"
|
|
1077
1077
|
font-weight="bold"
|
|
1078
|
-
fill="${
|
|
1078
|
+
fill="${s}"
|
|
1079
1079
|
text-anchor="end"
|
|
1080
1080
|
>
|
|
1081
|
-
${
|
|
1081
|
+
${p.humanized}
|
|
1082
1082
|
</text>
|
|
1083
1083
|
</svg>
|
|
1084
|
-
`}let y
|
|
1084
|
+
`}let b=y+a+5;return`
|
|
1085
1085
|
<svg
|
|
1086
1086
|
class="adornment-svg"
|
|
1087
1087
|
xmlns="http://www.w3.org/2000/svg"
|
|
1088
|
-
width="${
|
|
1089
|
-
height="${
|
|
1090
|
-
viewBox="0 0 ${
|
|
1088
|
+
width="${v*n}"
|
|
1089
|
+
height="${b*n}"
|
|
1090
|
+
viewBox="0 0 ${v} ${b}"
|
|
1091
1091
|
>
|
|
1092
1092
|
<line
|
|
1093
1093
|
x1="0"
|
|
1094
1094
|
y1="4.5"
|
|
1095
|
-
x2="${
|
|
1095
|
+
x2="${v}"
|
|
1096
1096
|
y2="4.5"
|
|
1097
|
-
stroke="${
|
|
1097
|
+
stroke="${s}"
|
|
1098
1098
|
stroke-width="1"
|
|
1099
1099
|
/>
|
|
1100
1100
|
<line
|
|
@@ -1102,41 +1102,41 @@ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matr
|
|
|
1102
1102
|
y1="0"
|
|
1103
1103
|
x2="0.5"
|
|
1104
1104
|
y2="10"
|
|
1105
|
-
stroke="${
|
|
1105
|
+
stroke="${s}"
|
|
1106
1106
|
stroke-width="1"
|
|
1107
1107
|
/>
|
|
1108
1108
|
<line
|
|
1109
|
-
x1="${
|
|
1109
|
+
x1="${v-.5}"
|
|
1110
1110
|
y1="0"
|
|
1111
|
-
x2="${
|
|
1111
|
+
x2="${v-.5}"
|
|
1112
1112
|
y2="10"
|
|
1113
|
-
stroke="${
|
|
1113
|
+
stroke="${s}"
|
|
1114
1114
|
stroke-width="1"
|
|
1115
1115
|
/>
|
|
1116
1116
|
<text
|
|
1117
1117
|
x="0"
|
|
1118
|
-
y="${
|
|
1119
|
-
font-size="${
|
|
1120
|
-
font-family="${
|
|
1118
|
+
y="${a+12}"
|
|
1119
|
+
font-size="${a}px"
|
|
1120
|
+
font-family="${o}"
|
|
1121
1121
|
font-weight="bold"
|
|
1122
|
-
fill="${
|
|
1122
|
+
fill="${s}"
|
|
1123
1123
|
text-anchor="start"
|
|
1124
1124
|
>
|
|
1125
1125
|
0
|
|
1126
1126
|
</text>
|
|
1127
1127
|
<text
|
|
1128
|
-
x="${
|
|
1129
|
-
y="${
|
|
1130
|
-
font-size="${
|
|
1131
|
-
font-family="${
|
|
1128
|
+
x="${v}"
|
|
1129
|
+
y="${a+12}"
|
|
1130
|
+
font-size="${a}px"
|
|
1131
|
+
font-family="${o}"
|
|
1132
1132
|
font-weight="bold"
|
|
1133
|
-
fill="${
|
|
1133
|
+
fill="${s}"
|
|
1134
1134
|
text-anchor="end"
|
|
1135
1135
|
>
|
|
1136
|
-
${
|
|
1136
|
+
${g?.humanized??``}
|
|
1137
1137
|
</text>
|
|
1138
1138
|
</svg>
|
|
1139
|
-
`}function jl(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=`ArialMT`,o=[e.titleFont??a,e.subtitleFont??a],s=Array.from(new Set(o));return{element:i,ready:Promise.all(s.map(e=>Lr(e,t,n))).then(()=>{i.innerHTML=Ml(e,a,r)})}}function Ml(e,t,n){let{title:r,titleColor:i=`#000000`,titleFont:a=t,titleFontSize:o=20,titleJustify:s=`center`,subtitle:c,subtitleColor:l=`#000000`,subtitleFont:u=t,subtitleFontSize:d=12,subtitleJustify:f=`center`,background:p=`#ffffff`,showBackground:m=!1}=e,h=0,g=0,_=0,v=0,y=0,b=r.trim().length>0?ci([r],a,o):null,x=c.trim().length>0?ci([c],u,d):null;if(h=Math.max(b?.width??0,x?.width??0),b){let{ascent:e,descent:t}=b;g=e+t,v=8+e}if(x){let{ascent:e,descent:t}=x;_=e+t,y=b?v+b.descent+e+6:8+e}let S=h+16,C=g+_+16,w=s===`center`?S/2:s===`right`?S-8:8,T=f===`center`?S/2:f===`right`?S-8:8,E=``;if(E+=`<svg class="adornment-svg" xmlns="http://www.w3.org/2000/svg" width="${S*n}" height="${C*n}" viewBox="0 0 ${S} ${C}">`,E+=`<rect x="0" y="0" width="${S}" height="${C}" fill="${p}" rx="6" style="visibility:${m?`visible`:`hidden`}" />`,b||x){let e=s===`center`?`middle`:s===`right`?`end`:`start`,t=f===`center`?`middle`:f===`right`?`end`:`start`;E+=`<text x="${w}" y="${v}" fill="${i}" font-family="${a}" font-size="${o}" text-anchor="${e}">`,b&&(E+=`${Wr(r)}`),x&&(E+=`<tspan x="${T}" y="${y}" fill="${l}" font-family="${u}" font-size="${d}" text-anchor="${t}">`,E+=`${Wr(c)}`,E+=`</tspan>`),E+=`</text>`}return E+=`</svg>`,E}var Nl=[`top_left`,`top_right`,`bottom_left`,`bottom_right`,`top_center`,`left_center`,`right_center`,`bottom_center`],Pl=new Map;async function Fl(e,t,n,r,i,a,o,s,c,l){let u=[...e.adornments??[]];Il(n,t,c,l);let d=[];ua()&&!u.some(e=>e.type===`webControls`)&&u.unshift({type:`webControls`,id:`web_controls`,name:`Web controls`,position:`top_left`,stacking:`vertical`,buttons:[]}),u.forEach(t=>{if(t.type===`custom`)Rl(fe(t,c),t.position,t.stacking);else if(t.type===`scalebar`)Rl(kl(t,n,c),t.position,t.stacking);else if(t.type===`northArrow`)Rl(ji(t,n,c),t.position,t.stacking);else if(t.type===`webControls`&&t.buttons&&l!==`video`)Rl(da(t,n,r,i),t.position,t.stacking);else if(t.type===`insetMap`){let{element:e,ready:r}=yl(t,n,o,c);Rl(e,t.position,t.stacking),d.push(r)}else if(t.type===`heading`){let{element:e,ready:n}=jl(t,a,s,c);Rl(e,t.position,t.stacking),d.push(n)}else if(t.type===`manualLegend`){let{element:e,ready:n}=Ai(t,a,s,c);Rl(e,t.position,t.stacking),d.push(n)}else if(t.type===`connectedLegend`){let{element:r,ready:i}=Si(t,e,n,a,s,c);Rl(r,t.position,t.stacking),d.push(i)}else t.type===`copyright`&&l===`video`&&Rl(pa(t,n,c),t.position,t.stacking)}),zl(n),n.on(`moveend`,()=>zl(n)),await Promise.all(d)}function Il(e,t,n,r){let i=e.getContainer();for(let e of Nl){let a=document.createElement(`div`);a.classList.add(`adornment-container`,e),a.style.cssText=Ll(e,t[e],n,r);let o=document.createElement(`div`),s=document.createElement(`div`);o.classList.add(`inner`),s.classList.add(`inner`,`vertical`),a.append(o,s),i.appendChild(a),Pl.set(e,{horizontal:o,vertical:s})}}function Ll(e,t,n,r){let i=p[e],a=``,o=[],s=t.x*n,c=t.y*n,{unit:l}=t;return i.x===`center`?o.push(`translateX(${s}${l})`):a+=`${i.x}: ${s}${l};`,i.y===`center`?o.push(`translateY(${c}${l})`):e===`bottom_right`&&r!==`video`?a+=`${i.y}: max(${c}${l}, 25px);`:a+=`${i.y}: ${c}${l};`,o.length&&(a+=`transform: ${o.join(` `)};`),a}function Rl(e,t,n){ua()&&!e.classList.contains(`web-control`)&&e.classList.add(`hide`),n||=[`left_center`,`right_center`].includes(t)?`vertical`:`horizontal`;let r=Pl.get(t),i=t===`left_center`||t===`right_center`?`vertical`:`horizontal`;r?.[i].hasChildNodes()||(n=i),(r?.[n])?.appendChild(e)}function zl(e){let t=Array.from(document.querySelectorAll(`.adornment, .maplibregl-ctrl-attrib`)),n=[];t.forEach(e=>{let t=e.getBoundingClientRect();t&&n.push([t.x,t.y,t.x+t.width,t.y+t.height])}),e.setLabelFreeAreas(n)}function Bl(e){for(let t of h){let n=g[t];e.layers.find(e=>e.id===n)===void 0&&(e.sources.empty===void 0&&(e.sources.empty={type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),e.layers.push({id:n,type:`fill`,source:`empty`,layout:{visibility:`none`}}))}}function Vl(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>Hl(t,e,r,i))}}),e.addLayer({id:t.id,type:`fill`,source:t.id,metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id},paint:{"fill-color":[`get`,`fill-color`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-pattern`,type:`fill`,source:t.id,filter:[`has`,`fill-pattern`],paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id}},n),e.addLayer({id:`${t.id}-outline`,type:`line`,source:t.id,metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id},layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-width":[`get`,`outline-width`],"line-color":[`get`,`outline-color`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function Hl(e,t,n,r){let i=t.fillPattern===void 0?void 0:r.getMapLibreImageKey(n[t.fillPattern],2*window.devicePixelRatio);return{type:`Feature`,id:E(t.id),properties:{id:t.id,"fill-color":e.fillColor||t.fillColor?li(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?li(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":i},geometry:{type:`Polygon`,coordinates:vr(t)}}}function Ul(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>Wl(t,e,1,r,i))}}),e.addLayer({id:t.id,type:`fill`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`==`,[`geometry-type`],`Polygon`],paint:{"fill-color":[`get`,`fill-color`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-pattern`,type:`fill`,source:t.id,filter:[`has`,`fill-pattern`],paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},metadata:{"mc-model-type":`circle`,"mc-group-id":t.id}},n),e.addLayer({id:`${t.id}-radius-line`,type:`line`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`all`,[`==`,[`geometry-type`],`LineString`],[`get`,`radius-line-enabled`]],paint:{"line-color":[`get`,`radius-line-color`],"line-width":[`get`,`radius-line-width`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-outline`,type:`line`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`==`,[`geometry-type`],`Polygon`],layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-width":[`get`,`outline-width`],"line-color":[`get`,`outline-color`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function Wl(e,t,n,r,i){let a=t.fillPattern===void 0?void 0:i.getMapLibreImageKey(r[t.fillPattern],2*window.devicePixelRatio);return{type:`Feature`,id:E(t.id),properties:{id:t.id,"fill-color":e.fillColor||t.fillColor?li(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?li(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":a,"radius-line-enabled":t.radiusLineEnabled??!1,"radius-line-color":e.radiusLineColor||t.radiusLineColor?li(t.dataBindings??{},t.radiusLineColor,e.radiusLineColor):`#000000`,"radius-line-width":t.radiusLineWidth??0},geometry:{type:`GeometryCollection`,geometries:[{type:`Polygon`,coordinates:[pr(t.center,t.radius*n)]},{type:`LineString`,coordinates:mr(t.center,t.radius*n,t.radiusLineBearing??0)}]}}}var Gl=`Roboto-Regular`;function Kl(e,t,n,r,i){let a=[],o=new Set,s=new Set,c=[`match`,[`get`,`text-font`]],l=!!t.clustering;for(let n of t.models)(n.visible??!0)&&a.push(Jl(e,t,n,1,r,i)),o.add(n.textFont),s.add(n.textLineHeight??1.2);if(Array.from(o).length>0){for(let e of Array.from(o))c.push(e,[`literal`,[e,Gl]]);c.push([`literal`,[Gl]])}e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:a},cluster:l,clusterRadius:t.clusterRadius??50,clusterMaxZoom:t.clusterMaxZoom??14});let u=!t.collisionDetection,d=t.labelCollisionDetection===void 0?u:!t.labelCollisionDetection;s.forEach(r=>{e.addLayer({id:`${t.id}-${r}`,type:`symbol`,source:t.id,metadata:{"mc-model-type":`marker`,"mc-group-id":t.id},layout:{"icon-allow-overlap":u,"icon-ignore-placement":u,"text-allow-overlap":d,"text-ignore-placement":d,"text-optional":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":[`get`,`icon-anchor`],"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`],"text-field":`{text}`,"text-font":c,"text-max-width":[`get`,`text-max-width`],"text-offset":[`get`,`text-offset`],"text-rotate":[`get`,`text-rotate`],"text-size":[`get`,`text-size`],"text-anchor":[`get`,`text-anchor`],"text-letter-spacing":[`get`,`text-letter-spacing`],"text-line-height":r,"text-justify":[`get`,`text-justify`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],1],"text-color":[`get`,`text-color`],"text-halo-color":[`get`,`text-halo-color`],"text-halo-width":[`get`,`text-halo-width`],"text-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},filter:[`all`,[`==`,[`get`,`text-line-height`],r],[`!`,[`has`,`point_count`]]]},n)}),l&&(e.addLayer({id:`${t.id}-circle-cluster`,type:`circle`,source:t.id,filter:[`has`,`point_count`],paint:{"circle-color":{property:`point_count`,type:`interval`,stops:t.clusterCircleColor??[]},"circle-radius":{property:`point_count`,type:`interval`,stops:t.clusterCircleRadius??[]}}}),e.addLayer({id:`${t.id}-text-cluster`,type:`symbol`,source:t.id,filter:[`has`,`point_count`],paint:{"text-color":{property:`point_count`,type:`interval`,stops:t.clusterTextColor??[]}},layout:{"text-font":[`literal`,[Gl]],"text-field":`{point_count_abbreviated}`,"text-size":{property:`point_count`,type:`interval`,stops:t.clusterTextSize??[]}}}),e.addSource(`${t.id}-selected-element`,{type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),s.forEach(n=>{e.addLayer({id:`${t.id}-selected-element-${n}`,type:`symbol`,source:`${t.id}-selected-element`,metadata:{"mc-model-type":`marker`,"mc-group-id":t.id},layout:{"icon-allow-overlap":!0,"icon-ignore-placement":!0,"text-allow-overlap":!0,"text-ignore-placement":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":[`get`,`icon-anchor`],"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`],"text-field":`{text}`,"text-font":c,"text-max-width":[`get`,`text-max-width`],"text-offset":[`get`,`text-offset`],"text-rotate":[`get`,`text-rotate`],"text-size":[`get`,`text-size`],"text-anchor":[`get`,`text-anchor`],"text-letter-spacing":[`get`,`text-letter-spacing`],"text-line-height":n,"text-justify":[`get`,`text-justify`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],[`global-state`,`opacity-${t.id}`],1],"text-color":[`get`,`text-color`],"text-halo-color":[`get`,`text-halo-color`],"text-halo-width":[`get`,`text-halo-width`],"text-opacity":[`coalesce`,[`feature-state`,`opacity`],[`global-state`,`opacity-${t.id}`],1]},filter:[`all`,[`==`,[`get`,`text-line-height`],n],[`!`,[`has`,`point_count`]]]})}),ql(e,t))}function ql(e,t){e.on(`click`,`${t.id}-circle-cluster`,async t=>{let n=e.queryRenderedFeatures(t.point).find(e=>e.properties.cluster);if(!n)return;let r=e.getSource(n.source);if(!r)return;let i=await r.getClusterExpansionZoom(Number(n.id));e.easeTo({center:n.geometry.coordinates,zoom:i})})}function Jl(e,t,n,r,i,a){let o=n.svg===void 0?void 0:di(n.dataBindings??{},i[n.svg],t.svg?i[t.svg]:void 0),s=o===void 0?void 0:a.getMapLibreImageKey(o,window.devicePixelRatio*(n.iconScale??1)*e.getScale()),c=o===void 0?void 0:ni(o);return{type:`Feature`,id:E(n.id),properties:{id:n.id,"mc-image-key":s,"icon-anchor":n.iconAnchor??`center`,"icon-rotate":n.iconRotation??0,"icon-offset":n.iconOffset??[0,0],"icon-size":(n.iconScale??1)*r,"icon-collision-box":c??[0,0,0,0],text:t.text||n.text?ui(n.dataBindings??{},n.text,t.text):void 0,"text-anchor":n.textAnchor??`center`,"text-font":n.textFont,"text-offset":[(n.textOffset?.[0]??0)/(n.textSize??16),(n.textOffset?.[1]??0)/(n.textSize??16)],"text-rotate":n.textRotation??0,"text-max-width":n.textMaxWidth??10,"text-size":(n.textSize??16)*r,"text-color":t.textColor||n.textColor?li(n.dataBindings??{},n.textColor,t.textColor):`#000000`,"text-halo-color":t.textHaloColor||n.textHaloColor?li(n.dataBindings??{},n.textHaloColor,t.textHaloColor):`#000000`,"text-halo-width":n.textHaloWidth??0,"text-line-height":n.textLineHeight??1.2,"text-letter-spacing":n.textLetterSpacing??0,"text-justify":n.textJustify??`center`},geometry:{type:`Point`,coordinates:[n.lngLat.lng,n.lngLat.lat]}}}async function Yl(e,t,n,r,i,a){let o=await Promise.all(t.map(e=>`${r}/styles/${e}.json?access_token=${i}`).map(e=>fetch(e).then(e=>e.json()))),s=te(o.map(e=>e.sprite).filter(e=>typeof e==`string`));await Promise.all(s.map(e=>n.loadSprite(e).then(e=>n.addImages(e)).catch(()=>{})));for(let t=0;t<e.length;t++){let r=e[t],i=o[t];for(let e of i.layers)e.metadata===void 0&&(e.metadata={}),e.metadata[`mc-original-layer-id`]=e.id,e.id=`${r} | ${e.id}`;Xl(i,n,a)}return o}function Xl(e,t,n){for(let n in e.sources)t.getSource(n)===void 0&&t.addSource(n,e.sources[n]);for(let r of e.layers){t.getLayer(r.id)!==void 0&&t.removeLayer(r.id);let e=r.metadata?.[`mc-add-before`]??`mc-before-none`;t.addLayer(Zl(r,n),e)}}function Zl(e,t){let n=t??{},r=e.metadata?.[`mc-original-layer-id`],i=r===void 0?{}:n[r]??{},a={...e,layout:{...e.layout,...i.layout},paint:{...e.paint,...i.paint},metadata:{...e.metadata,...i.metadata}};return i.minzoom!==void 0&&(a.minzoom=i.minzoom),i.maxzoom!==void 0&&(a.maxzoom=i.maxzoom),`filter`in i&&a.type!==`background`&&(a.filter=i.filter),a}var Ql=`<svg xmlns="http://www.w3.org/2000/svg" width="6" height="10" viewBox="0 0 6 10" fill="currentColor"><path d="m0 4.647 4.282 4.4a.814.814 0 0 0 1.166-1.134L2.27 4.647l3.178-3.266A.814.814 0 1 0 4.282.246z"/></svg>
|
|
1139
|
+
`}function jl(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=`ArialMT`,o=[e.titleFont??a,e.subtitleFont??a],s=Array.from(new Set(o));return{element:i,ready:Promise.all(s.map(e=>Lr(e,t,n))).then(()=>{i.innerHTML=Ml(e,a,r)})}}function Ml(e,t,n){let{title:r,titleColor:i=`#000000`,titleFont:a=t,titleFontSize:o=20,titleJustify:s=`center`,subtitle:c,subtitleColor:l=`#000000`,subtitleFont:u=t,subtitleFontSize:d=12,subtitleJustify:f=`center`,background:p=`#ffffff`,showBackground:m=!1}=e,h=0,g=0,_=0,v=0,y=0,b=r.trim().length>0?ci([r],a,o):null,x=c.trim().length>0?ci([c],u,d):null;if(h=Math.max(b?.width??0,x?.width??0),b){let{ascent:e,descent:t}=b;g=e+t,v=8+e}if(x){let{ascent:e,descent:t}=x;_=e+t,y=b?v+b.descent+e+6:8+e}let S=h+16,C=g+_+16,w=s===`center`?S/2:s===`right`?S-8:8,T=f===`center`?S/2:f===`right`?S-8:8,E=``;if(E+=`<svg class="adornment-svg" xmlns="http://www.w3.org/2000/svg" width="${S*n}" height="${C*n}" viewBox="0 0 ${S} ${C}">`,E+=`<rect x="0" y="0" width="${S}" height="${C}" fill="${p}" rx="6" style="visibility:${m?`visible`:`hidden`}" />`,b||x){let e=s===`center`?`middle`:s===`right`?`end`:`start`,t=f===`center`?`middle`:f===`right`?`end`:`start`;E+=`<text x="${w}" y="${v}" fill="${i}" font-family="${a}" font-size="${o}" text-anchor="${e}">`,b&&(E+=`${Wr(r)}`),x&&(E+=`<tspan x="${T}" y="${y}" fill="${l}" font-family="${u}" font-size="${d}" text-anchor="${t}">`,E+=`${Wr(c)}`,E+=`</tspan>`),E+=`</text>`}return E+=`</svg>`,E}var Nl=[`top_left`,`top_right`,`bottom_left`,`bottom_right`,`top_center`,`left_center`,`right_center`,`bottom_center`],Pl=new Map;async function Fl(e,t,n,r,i,a,o,s,c,l){let u=[...e.adornments??[]];Il(n,t,c,l);let d=[],f=u.some(e=>![`copyright`,`webControls`].includes(e.type));ua()&&f&&!u.some(e=>e.type===`webControls`)&&u.unshift({type:`webControls`,id:`web_controls`,name:`Web controls`,position:`top_left`,stacking:`vertical`,buttons:[]}),u.forEach(t=>{if(t.type===`custom`)Rl(fe(t,c),t.position,t.stacking);else if(t.type===`northArrow`)Rl(ji(t,n,c),t.position,t.stacking);else if(t.type===`webControls`&&t.buttons&&l!==`video`)Rl(da(t,n,r,i,f),t.position,t.stacking);else if(t.type===`scalebar`){let{element:e,ready:r}=kl(t,n,a,s,c);Rl(e,t.position,t.stacking),d.push(r)}else if(t.type===`insetMap`){let{element:e,ready:r}=yl(t,n,o,c);Rl(e,t.position,t.stacking),d.push(r)}else if(t.type===`heading`){let{element:e,ready:n}=jl(t,a,s,c);Rl(e,t.position,t.stacking),d.push(n)}else if(t.type===`manualLegend`){let{element:e,ready:n}=Ai(t,a,s,c);Rl(e,t.position,t.stacking),d.push(n)}else if(t.type===`connectedLegend`){let{element:r,ready:i}=Si(t,e,n,a,s,c);Rl(r,t.position,t.stacking),d.push(i)}else t.type===`copyright`&&l===`video`&&Rl(pa(t,n,c),t.position,t.stacking)}),zl(n),n.on(`moveend`,()=>zl(n)),await Promise.all(d)}function Il(e,t,n,r){let i=e.getContainer();for(let e of Nl){let a=document.createElement(`div`);a.classList.add(`adornment-container`,e),a.style.cssText=Ll(e,t[e],n,r);let o=document.createElement(`div`),s=document.createElement(`div`);o.classList.add(`inner`),s.classList.add(`inner`,`vertical`),a.append(o,s),i.appendChild(a),Pl.set(e,{horizontal:o,vertical:s})}}function Ll(e,t,n,r){let i=p[e],a=``,o=[],s=t.x*n,c=t.y*n,{unit:l}=t;return i.x===`center`?o.push(`translateX(${s}${l})`):a+=`${i.x}: ${s}${l};`,i.y===`center`?o.push(`translateY(${c}${l})`):e===`bottom_right`&&r!==`video`?a+=`${i.y}: max(${c}${l}, 25px);`:a+=`${i.y}: ${c}${l};`,o.length&&(a+=`transform: ${o.join(` `)};`),a}function Rl(e,t,n){ua()&&!e.classList.contains(`web-control`)&&e.classList.add(`hide`),n||=[`left_center`,`right_center`].includes(t)?`vertical`:`horizontal`;let r=Pl.get(t),i=t===`left_center`||t===`right_center`?`vertical`:`horizontal`;r?.[i].hasChildNodes()||(n=i),(r?.[n])?.appendChild(e)}function zl(e){let t=Array.from(document.querySelectorAll(`.adornment, .maplibregl-ctrl-attrib`)),n=[];t.forEach(e=>{let t=e.getBoundingClientRect();t&&n.push([t.x,t.y,t.x+t.width,t.y+t.height])}),e.setLabelFreeAreas(n)}function Bl(e){for(let t of h){let n=g[t];e.layers.find(e=>e.id===n)===void 0&&(e.sources.empty===void 0&&(e.sources.empty={type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),e.layers.push({id:n,type:`fill`,source:`empty`,layout:{visibility:`none`}}))}}function Vl(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>Hl(t,e,r,i))}}),e.addLayer({id:t.id,type:`fill`,source:t.id,metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id},paint:{"fill-color":[`get`,`fill-color`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-pattern`,type:`fill`,source:t.id,filter:[`has`,`fill-pattern`],paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id}},n),e.addLayer({id:`${t.id}-outline`,type:`line`,source:t.id,metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id},layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-width":[`get`,`outline-width`],"line-color":[`get`,`outline-color`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function Hl(e,t,n,r){let i=t.fillPattern===void 0?void 0:r.getMapLibreImageKey(n[t.fillPattern],2*window.devicePixelRatio);return{type:`Feature`,id:E(t.id),properties:{id:t.id,"fill-color":e.fillColor||t.fillColor?li(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?li(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":i},geometry:{type:`Polygon`,coordinates:vr(t)}}}function Ul(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>Wl(t,e,1,r,i))}}),e.addLayer({id:t.id,type:`fill`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`==`,[`geometry-type`],`Polygon`],paint:{"fill-color":[`get`,`fill-color`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-pattern`,type:`fill`,source:t.id,filter:[`has`,`fill-pattern`],paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},metadata:{"mc-model-type":`circle`,"mc-group-id":t.id}},n),e.addLayer({id:`${t.id}-radius-line`,type:`line`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`all`,[`==`,[`geometry-type`],`LineString`],[`get`,`radius-line-enabled`]],paint:{"line-color":[`get`,`radius-line-color`],"line-width":[`get`,`radius-line-width`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-outline`,type:`line`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`==`,[`geometry-type`],`Polygon`],layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-width":[`get`,`outline-width`],"line-color":[`get`,`outline-color`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function Wl(e,t,n,r,i){let a=t.fillPattern===void 0?void 0:i.getMapLibreImageKey(r[t.fillPattern],2*window.devicePixelRatio);return{type:`Feature`,id:E(t.id),properties:{id:t.id,"fill-color":e.fillColor||t.fillColor?li(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?li(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":a,"radius-line-enabled":t.radiusLineEnabled??!1,"radius-line-color":e.radiusLineColor||t.radiusLineColor?li(t.dataBindings??{},t.radiusLineColor,e.radiusLineColor):`#000000`,"radius-line-width":t.radiusLineWidth??0},geometry:{type:`GeometryCollection`,geometries:[{type:`Polygon`,coordinates:[pr(t.center,t.radius*n)]},{type:`LineString`,coordinates:mr(t.center,t.radius*n,t.radiusLineBearing??0)}]}}}var Gl=`Roboto-Regular`;function Kl(e,t,n,r,i){let a=[],o=new Set,s=new Set,c=[`match`,[`get`,`text-font`]],l=!!t.clustering;for(let n of t.models)(n.visible??!0)&&a.push(Jl(e,t,n,1,r,i)),o.add(n.textFont),s.add(n.textLineHeight??1.2);if(Array.from(o).length>0){for(let e of Array.from(o))c.push(e,[`literal`,[e,Gl]]);c.push([`literal`,[Gl]])}e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:a},cluster:l,clusterRadius:t.clusterRadius??50,clusterMaxZoom:t.clusterMaxZoom??14});let u=!t.collisionDetection,d=t.labelCollisionDetection===void 0?u:!t.labelCollisionDetection;s.forEach(r=>{e.addLayer({id:`${t.id}-${r}`,type:`symbol`,source:t.id,metadata:{"mc-model-type":`marker`,"mc-group-id":t.id},layout:{"icon-allow-overlap":u,"icon-ignore-placement":u,"text-allow-overlap":d,"text-ignore-placement":d,"text-optional":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":[`get`,`icon-anchor`],"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`],"text-field":`{text}`,"text-font":c,"text-max-width":[`get`,`text-max-width`],"text-offset":[`get`,`text-offset`],"text-rotate":[`get`,`text-rotate`],"text-size":[`get`,`text-size`],"text-anchor":[`get`,`text-anchor`],"text-letter-spacing":[`get`,`text-letter-spacing`],"text-line-height":r,"text-justify":[`get`,`text-justify`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],1],"text-color":[`get`,`text-color`],"text-halo-color":[`get`,`text-halo-color`],"text-halo-width":[`get`,`text-halo-width`],"text-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},filter:[`all`,[`==`,[`get`,`text-line-height`],r],[`!`,[`has`,`point_count`]]]},n)}),l&&(e.addLayer({id:`${t.id}-circle-cluster`,type:`circle`,source:t.id,filter:[`has`,`point_count`],paint:{"circle-color":{property:`point_count`,type:`interval`,stops:t.clusterCircleColor??[]},"circle-radius":{property:`point_count`,type:`interval`,stops:t.clusterCircleRadius??[]}}}),e.addLayer({id:`${t.id}-text-cluster`,type:`symbol`,source:t.id,filter:[`has`,`point_count`],paint:{"text-color":{property:`point_count`,type:`interval`,stops:t.clusterTextColor??[]}},layout:{"text-font":[`literal`,[Gl]],"text-field":`{point_count_abbreviated}`,"text-size":{property:`point_count`,type:`interval`,stops:t.clusterTextSize??[]}}}),e.addSource(`${t.id}-selected-element`,{type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),s.forEach(n=>{e.addLayer({id:`${t.id}-selected-element-${n}`,type:`symbol`,source:`${t.id}-selected-element`,metadata:{"mc-model-type":`marker`,"mc-group-id":t.id},layout:{"icon-allow-overlap":!0,"icon-ignore-placement":!0,"text-allow-overlap":!0,"text-ignore-placement":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":[`get`,`icon-anchor`],"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`],"text-field":`{text}`,"text-font":c,"text-max-width":[`get`,`text-max-width`],"text-offset":[`get`,`text-offset`],"text-rotate":[`get`,`text-rotate`],"text-size":[`get`,`text-size`],"text-anchor":[`get`,`text-anchor`],"text-letter-spacing":[`get`,`text-letter-spacing`],"text-line-height":n,"text-justify":[`get`,`text-justify`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],[`global-state`,`opacity-${t.id}`],1],"text-color":[`get`,`text-color`],"text-halo-color":[`get`,`text-halo-color`],"text-halo-width":[`get`,`text-halo-width`],"text-opacity":[`coalesce`,[`feature-state`,`opacity`],[`global-state`,`opacity-${t.id}`],1]},filter:[`all`,[`==`,[`get`,`text-line-height`],n],[`!`,[`has`,`point_count`]]]})}),ql(e,t))}function ql(e,t){e.on(`click`,`${t.id}-circle-cluster`,async t=>{let n=e.queryRenderedFeatures(t.point).find(e=>e.properties.cluster);if(!n)return;let r=e.getSource(n.source);if(!r)return;let i=await r.getClusterExpansionZoom(Number(n.id));e.easeTo({center:n.geometry.coordinates,zoom:i})})}function Jl(e,t,n,r,i,a){let o=n.svg===void 0?void 0:di(n.dataBindings??{},i[n.svg],t.svg?i[t.svg]:void 0),s=o===void 0?void 0:a.getMapLibreImageKey(o,window.devicePixelRatio*(n.iconScale??1)*e.getScale()),c=o===void 0?void 0:ni(o);return{type:`Feature`,id:E(n.id),properties:{id:n.id,"mc-image-key":s,"icon-anchor":n.iconAnchor??`center`,"icon-rotate":n.iconRotation??0,"icon-offset":n.iconOffset??[0,0],"icon-size":(n.iconScale??1)*r,"icon-collision-box":c??[0,0,0,0],text:t.text||n.text?ui(n.dataBindings??{},n.text,t.text):void 0,"text-anchor":n.textAnchor??`center`,"text-font":n.textFont,"text-offset":[(n.textOffset?.[0]??0)/(n.textSize??16),(n.textOffset?.[1]??0)/(n.textSize??16)],"text-rotate":n.textRotation??0,"text-max-width":n.textMaxWidth??10,"text-size":(n.textSize??16)*r,"text-color":t.textColor||n.textColor?li(n.dataBindings??{},n.textColor,t.textColor):`#000000`,"text-halo-color":t.textHaloColor||n.textHaloColor?li(n.dataBindings??{},n.textHaloColor,t.textHaloColor):`#000000`,"text-halo-width":n.textHaloWidth??0,"text-line-height":n.textLineHeight??1.2,"text-letter-spacing":n.textLetterSpacing??0,"text-justify":n.textJustify??`center`},geometry:{type:`Point`,coordinates:[n.lngLat.lng,n.lngLat.lat]}}}async function Yl(e,t,n,r,i,a){let o=await Promise.all(t.map(e=>`${r}/styles/${e}.json?access_token=${i}`).map(e=>fetch(e).then(e=>e.json()))),s=te(o.map(e=>e.sprite).filter(e=>typeof e==`string`));await Promise.all(s.map(e=>n.loadSprite(e).then(e=>n.addImages(e)).catch(()=>{})));for(let t=0;t<e.length;t++){let r=e[t],i=o[t];for(let e of i.layers)e.metadata===void 0&&(e.metadata={}),e.metadata[`mc-original-layer-id`]=e.id,e.id=`${r} | ${e.id}`;Xl(i,n,a)}return o}function Xl(e,t,n){for(let n in e.sources)t.getSource(n)===void 0&&t.addSource(n,e.sources[n]);for(let r of e.layers){t.getLayer(r.id)!==void 0&&t.removeLayer(r.id);let e=r.metadata?.[`mc-add-before`]??`mc-before-none`;t.addLayer(Zl(r,n),e)}}function Zl(e,t){let n=t??{},r=e.metadata?.[`mc-original-layer-id`],i=r===void 0?{}:n[r]??{},a={...e,layout:{...e.layout,...i.layout},paint:{...e.paint,...i.paint},metadata:{...e.metadata,...i.metadata}};return i.minzoom!==void 0&&(a.minzoom=i.minzoom),i.maxzoom!==void 0&&(a.maxzoom=i.maxzoom),`filter`in i&&a.type!==`background`&&(a.filter=i.filter),a}var Ql=`<svg xmlns="http://www.w3.org/2000/svg" width="6" height="10" viewBox="0 0 6 10" fill="currentColor"><path d="m0 4.647 4.282 4.4a.814.814 0 0 0 1.166-1.134L2.27 4.647l3.178-3.266A.814.814 0 1 0 4.282.246z"/></svg>
|
|
1140
1140
|
`,$l=`<svg xmlns="http://www.w3.org/2000/svg" width="10" height="11" viewBox="0 0 10 11" fill="currentColor"><path d="M.21.71a.714.714 0 0 1 1.011 0l3.78 3.78L8.778.71a.715.715 0 0 1 1.013 1.01L6.01 5.501l3.78 3.778a.715.715 0 0 1-1.01 1.012L5 6.51l-3.779 3.78A.716.716 0 0 1 .21 9.28L3.99 5.5.21 1.721A.714.714 0 0 1 .21.71"/></svg>
|
|
1141
1141
|
`,eu=`<svg xmlns="http://www.w3.org/2000/svg" width="6" height="10" viewBox="0 0 6 10" fill="currentColor"><path d="m5.678 4.647-4.282 4.4A.814.814 0 1 1 .23 7.914l3.177-3.266L.23 1.381A.814.814 0 1 1 1.396.246z"/></svg>
|
|
1142
1142
|
`,tu=`<svg width="20" height="20" viewBox="0 0 40 40" stroke="currentColor" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20 4.167 1.667 35.834h36.667z" stroke-width="2" stroke-linejoin="round"/><path d="M20 29.167v.834m0-14.167.007 8.333" stroke-width="2" stroke-linecap="round"/></svg>
|