@mapcreator/sdk 2.0.2 → 3.1.0
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/README.md +26 -6
- package/dist/Image.d.ts +13 -0
- package/dist/MCMap.d.ts +68 -17
- package/dist/Video.d.ts +3 -2
- package/dist/adornments/categoricalLegend.d.ts +2 -1
- package/dist/adornments/connectedLegend.d.ts +3 -2
- package/dist/adornments/copyright.d.ts +6 -2
- package/dist/adornments/heading.d.ts +2 -1
- package/dist/adornments/manualLegend.d.ts +2 -1
- package/dist/adornments/scalebar.d.ts +2 -1
- package/dist/constants/index.d.ts +3 -2
- package/dist/events.d.ts +12 -0
- package/dist/index.bundler.d.ts +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/mapcreator-sdk-worker.mjs +10 -0
- package/dist/mapcreator-sdk.bundler.mjs +6228 -0
- package/dist/mapcreator-sdk.css +1 -1
- package/dist/mapcreator-sdk.mjs +545 -0
- package/dist/maplibre-gl-shared.mjs +6 -0
- package/dist/maplibre-gl-worker.mjs +6 -0
- package/dist/maplibre-gl.mjs +819 -0
- package/dist/models/line.d.ts +2 -1
- package/dist/renderAdornments.d.ts +2 -2
- package/dist/types/index.d.ts +0 -6
- package/dist/utils/fonts.d.ts +47 -3
- package/dist/utils/geoTiff.d.ts +13 -0
- package/dist/utils/helpers.d.ts +4 -2
- package/dist/utils/labelFreeAreas.d.ts +3 -0
- package/dist/utils/pdfFonts.d.ts +22 -0
- package/dist/utils/svg2pdf.d.ts +21 -0
- package/dist/utils/svgHelpers.d.ts +25 -9
- package/package.json +14 -13
- package/dist/mapcreator-sdk.js +0 -41109
- package/dist/mapcreator-sdk.umd.cjs +0 -1227
- package/dist/report.html +0 -4950
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as i,MercatorCoordinate as a,Point as o,Popup as s}from"./maplibre-gl.mjs";var c=Object.create,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=Object.getOwnPropertyNames,f=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty,m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),h=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=d(t),a=0,o=i.length,s;a<o;a++)s=i[a],!p.call(e,s)&&s!==n&&l(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=u(t,s))||r.enumerable});return e},g=(e,t,n)=>(n=e==null?{}:c(f(e)),h(t||!e||!e.__esModule?l(n,`default`,{value:e,enumerable:!0}):n,e));if(!Uint8Array.prototype.toBase64){let e={base64:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,base64url:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`};Uint8Array.prototype.toBase64=function(t){if(!(this instanceof Uint8Array))throw TypeError(`Receiver must be a Uint8Array`);let n=t?.alphabet??`base64`,r=t?.omitPadding??!1;if(n!==`base64`&&n!==`base64url`)throw TypeError(`alphabet must be 'base64' or 'base64url'`);if(typeof r!=`boolean`)throw TypeError(`omitPadding must be a boolean`);let i=e[n],a=this,o=a.length,s=[];for(var c=0;c+2<o;c+=3){let e=a[c]<<16|a[c+1]<<8|a[c+2];s.push(i[e>>18&63],i[e>>12&63],i[e>>6&63],i[e&63])}let l=o-c;if(l===1){let e=a[c]<<16;s.push(i[e>>18&63],i[e>>12&63]),r||s.push(`=`,`=`)}else if(l===2){let e=a[c]<<16|a[c+1]<<8;s.push(i[e>>18&63],i[e>>12&63],i[e>>6&63]),r||s.push(`=`)}return s.join(``)}}function _(e,t){for(let n of t.getStyle().layers){if(n.type!==`symbol`||n.id.startsWith(`custom-`)||n.id.startsWith(`gl-`))continue;let r=n.layout&&n.layout[`text-field`];n[`source-layer`]&&Array.isArray(r)&&r[0]===`coalesce`&&!r.find(e=>Array.isArray(e)&&e[1]===`name:abbr`)&&t.setLayoutProperty(n.id,`text-field`,v(n.source,e),{validate:!1})}}function v(e,t){return t!==`en`&&t!==`native`&&(t=x(t,y.TWO)),t===`native`?[`get`,`name`]:e.startsWith(`mc-base`)?[`coalesce`,[`get`,`name:${t}`],[`case`,[`has`,`name_is_latin`],[`get`,`name`],[`get`,`name:en`]]]:[`coalesce`,[`get`,`name:${t}`],[`get`,`name:en`],[`get`,`name`]]}var y=Object.freeze({THREE:`ISO 639-2/B`,API:`ISO 639-2/B`,TWO:`ISO 639-1`,MAPLIBRE_COMPAT:`ISO 639-1`,ENDONYM:`name`,NAME:`name`,LOCALE:`locale`,i18n:`locale`}),b=Object.freeze([{[y.TWO]:`en`,[y.THREE]:`eng`,[y.ENDONYM]:`English`,[y.LOCALE]:`en_GB`},{[y.TWO]:`da`,[y.THREE]:`dan`,[y.ENDONYM]:`Dansk`,[y.LOCALE]:`da_DK`},{[y.TWO]:`nl`,[y.THREE]:`dut`,[y.ENDONYM]:`Nederlands`,[y.LOCALE]:`nl_NL`},{[y.TWO]:`fi`,[y.THREE]:`fin`,[y.ENDONYM]:`Suomi`,[y.LOCALE]:`fi_FI`},{[y.TWO]:`fr`,[y.THREE]:`fre`,[y.ENDONYM]:`Francais`,[y.LOCALE]:`fr_FR`},{[y.TWO]:`de`,[y.THREE]:`ger`,[y.ENDONYM]:`Deutsch`,[y.LOCALE]:`de_DE`},{[y.TWO]:`it`,[y.THREE]:`ita`,[y.ENDONYM]:`Italiano`,[y.LOCALE]:`it_IT`},{[y.TWO]:`no`,[y.THREE]:`nor`,[y.ENDONYM]:`Norsk`,[y.LOCALE]:`nn_NO`},{[y.TWO]:`pl`,[y.THREE]:`pol`,[y.ENDONYM]:`Polski`,[y.LOCALE]:`pl_PL`},{[y.TWO]:`pt`,[y.THREE]:`por`,[y.ENDONYM]:`Portugues`,[y.LOCALE]:`pt_PT`},{[y.TWO]:`es`,[y.THREE]:`spa`,[y.ENDONYM]:`Espanol`,[y.LOCALE]:`es_ES`},{[y.TWO]:`sv`,[y.THREE]:`swe`,[y.ENDONYM]:`Svenska`,[y.LOCALE]:`sv_SE`},{[y.TWO]:`ja`,[y.THREE]:`jpn`,[y.ENDONYM]:`日本語`,[y.LOCALE]:`ja_JP`},{[y.TWO]:`zh`,[y.THREE]:`chi`,[y.ENDONYM]:`汉语`,[y.LOCALE]:`zh_CN`},{[y.TWO]:`ru`,[y.THREE]:`rus`,[y.ENDONYM]:`Русский`,[y.LOCALE]:`ru_RU`},{[y.TWO]:`uk`,[y.THREE]:`ukr`,[y.ENDONYM]:`Украї́нська`,[y.LOCALE]:`uk_UK`},{[y.TWO]:`lv`,[y.THREE]:`lav`,[y.ENDONYM]:`Latviešu valoda`,[y.LOCALE]:`lv-LV`},{[y.TWO]:`kk`,[y.THREE]:`kaz`,[y.ENDONYM]:`қазақша`,[y.LOCALE]:`kk-KZ`},{[y.TWO]:`ar`,[y.THREE]:`ara`,[y.ENDONYM]:`العربية`,[y.LOCALE]:`ar_SA`},{[y.TWO]:`native`,[y.THREE]:`native`,[y.ENDONYM]:`Native`,[y.LOCALE]:`native`}]);function x(e,t=y.MAPLIBRE_COMPAT){return(b.find(t=>Object.values(t).some(t=>t===e))??b[0])[t]}var S=/^\s*[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?\s*$/;function C(e){return e/180*Math.PI}function w(e){return e*180/Math.PI}function T(e,t){let n=Math.PI/180,r=e.lat*n,i=t.lat*n,a=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((t.lng-e.lng)*n);return 6371e3*Math.acos(Math.min(a,1))}function E(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}function D(e,t){return e.startsWith(`$`)?O(t[e.slice(1)]):e}function O(e){return typeof e==`string`?e:typeof e==`number`?String(e):typeof e==`boolean`?String(e).toUpperCase():typeof e==`object`&&e&&(e.t===`n`||e.t===`d`)?e.w??``:``}function k(e){return typeof e==`string`&&S.test(e)?Number(e):typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:typeof e==`object`&&e&&e.t===`n`?e.v:null}function A(e){return e=e.trim(),/^\$?[\w\-_]+$/.test(e)?e:(/(?:https?:\/\/)?(?:www\.)?youtu\.?be(?:\.com)?\/?.*(?:watch|embed)?(?:.*v=|v\/|\/)([\w\-_]+)&?/.exec(e)||[])[1]}var j=72;function M(e,t,n){if(e===t)return n;let r={millimeter:1,centimeter:.1,meter:.001,kilometer:1e-6,foot:.00328084,mile:6.21371e-7,nauticalMile:5.39957e-7,inch:.0393701,pixel:.0393701*j,pica:.236222};return n/r[e]*r[t]}function N(e,t=`pixel`,n=j){return t===`pixel`?e:M(t,`pixel`,e)*(n/j)}var P;function F(){if(P===void 0){let e=document.createElement(`canvas`).getContext(`webgl`);try{P=e?e.getParameter(e.MAX_TEXTURE_SIZE):4096}catch{P=4096}finally{e?.getExtension(`WEBGL_lose_context`)?.loseContext()}}return[P,P]}function ee(e){return 2*Math.round(e/2)}function I(e,t,n){return e+(t-e)*n}function te(e,t,n){return(n-e)/(t-e)}function ne(e,t,n){return Math.max(Math.min(e,n),t)}function re(e){return Array.from(new Set(e))}function L(e){let t=e.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>(e^=t,e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)),2166136261);return t^=t<<3,t+=t>>5,t^=t<<4,t+=t>>17,t^=t<<25,t+=t>>6,`0000000${(t>>>0).toString(16)}`.substr(-8)}function R(e,t,n,r){if(t.clientWidth>0&&t.clientHeight>0){let i=e.export?.size??[600,400],a=e.export?.unit,o=[`jpg`,`png`,`tiff`].includes(r),s=N(i[0],a),c=N(i[1],a);return Math.min(t.clientWidth/(n===`video`?ee(s):o?Math.round(s):s),t.clientHeight/(n===`video`?ee(c):o?Math.round(c):c))}return 1}function z(e,t,n=1e-4){return Math.abs(e-t)<n}function ie(e,t,n){let{lng:r,lat:i}=e.getCenter(),a=e.getPitch()*Math.PI/180,o=e.getBearing()*Math.PI/180,s=ae(r,i),c=ae(t,n),l=oe(s,se(le(ce([0,0,1],s)),o),a);return l[0]*c[0]+l[1]*c[1]+l[2]*c[2]>.3}function ae(e,t){let n=t*Math.PI/180,r=e*Math.PI/180;return[Math.cos(n)*Math.cos(r),Math.cos(n)*Math.sin(r),Math.sin(n)]}function oe(e,t,n){let[r,i,a]=e,[o,s,c]=t,l=Math.cos(n),u=Math.sin(n),d=r*o+i*s+a*c;return[r*l+(s*a-c*i)*u+o*d*(1-l),i*l+(c*r-o*a)*u+s*d*(1-l),a*l+(o*i-s*r)*u+c*d*(1-l)]}function se(e,t){let[n,r,i]=e,a=Math.cos(t),o=Math.sin(t);return[n*a-r*o,n*o+r*a,i]}function ce(e,t){let[n,r,i]=e,[a,o,s]=t;return[r*s-i*o,i*a-n*s,n*o-r*a]}function le(e){let[t,n,r]=e,i=Math.hypot(t,n,r);return[t/i,n/i,r/i]}function ue(e,t){if(t===`video`)return;let n=Array.from(e.getContainer().querySelectorAll(`.adornment, .maplibregl-ctrl-attrib`)),r=e.getCanvas().getBoundingClientRect(),i=n.map(e=>{let t=e.getBoundingClientRect(),n=t.x-r.x,i=t.y-r.y;return[n,i,n+t.width,i+t.height]});t===`static`&&(i.push([0,0,r.width,0]),i.push([r.width,0,r.width,r.height]),i.push([0,r.height,r.width,r.height]),i.push([0,0,0,r.height])),e.setLabelFreeAreas(i)}function de(e,t,n){let r=document.createElement(`div`);r.className=`adornment`;let{svg:i,scale:a=1}=e,o=new DOMParser().parseFromString(i,`image/svg+xml`).querySelector(`svg`);if(o){let i=new RegExp(S.toString().replace(/^\/\^|\$\/$/g,``).replace(/.*/,`^($&)[, ]($&)[, ]($&)[, ]($&)$$`)),s=o.getAttribute(`width`),c=o.getAttribute(`height`),l,u;if(s&&c&&S.test(s)&&S.test(c))l=Number(s),u=Number(c);else{let e=i.exec(o.getAttribute(`viewBox`));l=e?Number(e[3]):300,u=e?Number(e[4]):150}!o.getAttribute(`viewBox`)&&l>0&&u>0&&o.setAttribute(`viewBox`,`0 0 ${l} ${u}`);let d=()=>{o.setAttribute(`width`,String(l*a*t.getScale())),o.setAttribute(`height`,String(u*a*t.getScale()))};d(),n!==`interactive`&&t.on(`resize`,d),o.classList.add(`adornment-svg`),o.dataset.adornmentName=e.name,r.appendChild(o)}return r}var fe=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`,`emoji`,`math`,`fangsong`]),pe=class{vapiUrl;accessToken;cache=new Map;directFonts=new Set;registrations=new Map;fontMap;usedFontsCache=new Map;fontInjectedSvgCache=new Map;constructor(e,t,n){this.fontMap=e,this.vapiUrl=t,this.accessToken=n}resolve(e,t=`400`){let n=Array.from(this.fontMap.values()).filter(t=>t.name===e),r=n.find(t=>t.family!==e),i=r??{name:e,family:e,weight:t,style:`normal`},a=r!==void 0||n.length>0||this.directFonts.has(e)||Array.from(this.fontMap.values()).some(t=>t.family===e);return{...i,cssFamily:a?_e(i.family):ve(i.family)}}async loadFont(e){return this.cache.has(e)||this.cache.set(e,fetch(`${this.vapiUrl}/fonts/${encodeURIComponent(e)}.woff2?access_token=${this.accessToken}`).then(e=>e.ok?e.arrayBuffer():void 0).then(async t=>{if(t!==void 0)return document.fonts.add(await he(e,t)),this.directFonts.add(e),this.usedFontsCache=new Map,this.fontInjectedSvgCache=new Map,new Uint8Array(t).toBase64()}).catch(()=>void 0)),this.cache.get(e)}async loadReference(e,t=`400`){let n=this.resolve(e,t),r=be(n.cssFamily);await Promise.all(r.map(async({name:e,generic:t})=>{if(t)return;let i=Ce(this.fontMap.values(),e,n.weight,n.style),a=i?.name??(r.length===1?e:void 0);if(a===void 0)return;let o=await this.loadFont(a);if(i===void 0||o===void 0)return;let s=Te(i.family,i.weight,i.style);this.registrations.has(s)||this.registrations.set(s,(async()=>{document.fonts.add(await he(i.family,`url(data:font/woff2;base64,${o})`,{weight:i.weight,style:i.style}))})()),await this.registrations.get(s)})),await document.fonts.load(`${n.style} ${n.weight} 16px ${n.cssFamily}`).catch(()=>void 0)}getDirectFont(e){return this.directFonts.has(e)?{name:e,family:e,weight:`400`,style:`normal`}:void 0}},me=new FontFace(`mapcreator-font-probe`,`local("mapcreator-font-probe")`).family===new FontFace(`mapcreator-font-\\70 robe`,`local("mapcreator-font-probe")`).family;function he(e,t,n){return new FontFace(me?_e(e):e,t,n).load()}async function ge(e,t,n){let r=`${t}/stylesheets/ff-${e===`beta`?`b-`:``}${n}.css?access_token=${n}`,i=await fetch(r).then(e=>e.ok?e.text():void 0).catch(()=>void 0);if(i===void 0)return new Map;let a=document.createElement(`style`);a.textContent=i,document.head.insertBefore(a,document.head.firstChild);let o=a.sheet;if(o===null)return new Map;let s=new Map;for(let e of o.cssRules)if(e instanceof CSSFontFaceRule){let t=e.style,n=be(t.getPropertyValue(`font-family`))[0]?.name,r=t.getPropertyValue(`font-weight`).trim()||`400`,i=t.getPropertyValue(`font-style`).trim()||`normal`,a=t.getPropertyValue(`src`).match(/local\(\s*("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|(?:\\.|[^)\\])*)\s*\)/i),o=a===null?void 0:be(a[1])[0]?.name;n&&o&&s.set(Te(n,r,i),{name:o,family:n,weight:r,style:i})}return s}function _e(e){return`"${Array.from(e,e=>{let t=e.charCodeAt(0);return t<=31||t===127?`\\${(t||65533).toString(16)} `:e===`"`||e===`\\`?`\\${e}`:e}).join(``)}"`}function ve(e){return be(e).map(({name:e,generic:t})=>t?e:_e(e)).join(`, `)}function ye(e){let t=e.trimStart(),n=t.startsWith(`"`)||t.startsWith(`'`),r=n?t.trimEnd().slice(1,-1):t,i=``,a=!1,o=r.matchAll(/\\(?:([0-9a-f]{1,6})(?:\r\n|[ \t\r\n\f])?|(\r\n|[\n\r\f])|([\s\S]))|([ \t\r\n\f]+)|([\s\S])/gi);for(let[,e,t,r,s,c]of o){if(s!==void 0&&!n){a=i.length>0;continue}let o=t===void 0?r??s??c:``;if(e!==void 0){let t=parseInt(e,16);o=String.fromCodePoint(!t||t>1114111||t>=55296&&t<=57343?65533:t)}o&&(i+=(a?` `:``)+o,a=!1)}return{name:i,generic:!n&&fe.has(i.toLowerCase())}}function be(e){let t=[],n=``,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`\\`?i++:n?a===n&&(n=``):a===`"`||a===`'`?n=a:a===`,`&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t.map(ye).filter(e=>e.name.length>0)}function xe(e){return e===`bold`?700:Number(e)||400}function Se(e,t){let n=xe(e.weight);return t<400?n<=t?[0,t-n]:[1,n-t]:t>500?n>=t?[0,n-t]:[1,t-n]:n>=t&&n<=500?[0,n-t]:n<t?[1,t-n]:[2,n-t]}function Ce(e,t,n,r=`normal`){let i=xe(n),a=Array.from(e).filter(e=>e.family.toLowerCase()===t.toLowerCase()),o=r===`italic`?[`italic`,`oblique`,`normal`]:r===`oblique`?[`oblique`,`italic`,`normal`]:[`normal`,`oblique`,`italic`];for(let e of o){let t=a.filter(t=>t.style===e);if(t.length>0)return t.sort((e,t)=>{let n=Se(e,i),r=Se(t,i);return n[0]-r[0]||n[1]-r[1]})[0]}}function we(e){return`font-family="${B(e.cssFamily)}" font-weight="${B(e.weight)}" font-style="${B(e.style)}"`}function Te(e,t,n){return`${e}|${t}|${n}`}function Ee(e){let t=[1/0,1/0,-1/0,-1/0];for(let n=0;n<e.length;++n)t[0]=Math.min(t[0],e[n][0]),t[1]=Math.min(t[1],e[n][1]),t[2]=Math.max(t[2],e[n][2]),t[3]=Math.max(t[3],e[n][3]);return t}function De(e,t,n){e[0]+=t,e[1]+=n,e[2]+=t,e[3]+=n}function Oe(e){e[0]=Math.round(e[0]),e[1]=Math.round(e[1]),e[2]=Math.round(e[2]),e[3]=Math.round(e[3])}
|
|
2
|
+
// @license
|
|
3
|
+
(function(){var e=function(e){return e.map(function(e){return{type:e.type,values:Array.prototype.slice.call(e.values)}})},t=function(e){var t=[],n=null,r=null,i=null,a=null;return e.forEach(function(e){var o=e.type;if(o===`M`){var s=e.values[0],c=e.values[1];t.push({type:`M`,values:[s,c]}),i=s,a=c,n=s,r=c}else if(o===`m`){var s=n+e.values[0],c=r+e.values[1];t.push({type:`M`,values:[s,c]}),i=s,a=c,n=s,r=c}else if(o===`L`){var s=e.values[0],c=e.values[1];t.push({type:`L`,values:[s,c]}),n=s,r=c}else if(o===`l`){var s=n+e.values[0],c=r+e.values[1];t.push({type:`L`,values:[s,c]}),n=s,r=c}else if(o===`C`){var l=e.values[0],u=e.values[1],d=e.values[2],f=e.values[3],s=e.values[4],c=e.values[5];t.push({type:`C`,values:[l,u,d,f,s,c]}),n=s,r=c}else if(o===`c`){var l=n+e.values[0],u=r+e.values[1],d=n+e.values[2],f=r+e.values[3],s=n+e.values[4],c=r+e.values[5];t.push({type:`C`,values:[l,u,d,f,s,c]}),n=s,r=c}else if(o===`Q`){var l=e.values[0],u=e.values[1],s=e.values[2],c=e.values[3];t.push({type:`Q`,values:[l,u,s,c]}),n=s,r=c}else if(o===`q`){var l=n+e.values[0],u=r+e.values[1],s=n+e.values[2],c=r+e.values[3];t.push({type:`Q`,values:[l,u,s,c]}),n=s,r=c}else if(o===`A`){var s=e.values[5],c=e.values[6];t.push({type:`A`,values:[e.values[0],e.values[1],e.values[2],e.values[3],e.values[4],s,c]}),n=s,r=c}else if(o===`a`){var s=n+e.values[5],c=r+e.values[6];t.push({type:`A`,values:[e.values[0],e.values[1],e.values[2],e.values[3],e.values[4],s,c]}),n=s,r=c}else if(o===`H`){var s=e.values[0];t.push({type:`H`,values:[s]}),n=s}else if(o===`h`){var s=n+e.values[0];t.push({type:`H`,values:[s]}),n=s}else if(o===`V`){var c=e.values[0];t.push({type:`V`,values:[c]}),r=c}else if(o===`v`){var c=r+e.values[0];t.push({type:`V`,values:[c]}),r=c}else if(o===`S`){var d=e.values[0],f=e.values[1],s=e.values[2],c=e.values[3];t.push({type:`S`,values:[d,f,s,c]}),n=s,r=c}else if(o===`s`){var d=n+e.values[0],f=r+e.values[1],s=n+e.values[2],c=r+e.values[3];t.push({type:`S`,values:[d,f,s,c]}),n=s,r=c}else if(o===`T`){var s=e.values[0],c=e.values[1];t.push({type:`T`,values:[s,c]}),n=s,r=c}else if(o===`t`){var s=n+e.values[0],c=r+e.values[1];t.push({type:`T`,values:[s,c]}),n=s,r=c}else (o===`Z`||o===`z`)&&(t.push({type:`Z`,values:[]}),n=i,r=a)}),t},n=function(e){var t=[],n=null,i=null,a=null,o=null,s=null,c=null,l=null;return e.forEach(function(e){if(e.type===`M`){var u=e.values[0],d=e.values[1];t.push({type:`M`,values:[u,d]}),c=u,l=d,o=u,s=d}else if(e.type===`C`){var f=e.values[0],p=e.values[1],m=e.values[2],h=e.values[3],u=e.values[4],d=e.values[5];t.push({type:`C`,values:[f,p,m,h,u,d]}),i=m,a=h,o=u,s=d}else if(e.type===`L`){var u=e.values[0],d=e.values[1];t.push({type:`L`,values:[u,d]}),o=u,s=d}else if(e.type===`H`){var u=e.values[0];t.push({type:`L`,values:[u,s]}),o=u}else if(e.type===`V`){var d=e.values[0];t.push({type:`L`,values:[o,d]}),s=d}else if(e.type===`S`){var m=e.values[0],h=e.values[1],u=e.values[2],d=e.values[3],g,_;n===`C`||n===`S`?(g=o+(o-i),_=s+(s-a)):(g=o,_=s),t.push({type:`C`,values:[g,_,m,h,u,d]}),i=m,a=h,o=u,s=d}else if(e.type===`T`){var u=e.values[0],d=e.values[1],f,p;n===`Q`||n===`T`?(f=o+(o-i),p=s+(s-a)):(f=o,p=s);var g=o+2*(f-o)/3,_=s+2*(p-s)/3,v=u+2*(f-u)/3,y=d+2*(p-d)/3;t.push({type:`C`,values:[g,_,v,y,u,d]}),i=f,a=p,o=u,s=d}else if(e.type===`Q`){var f=e.values[0],p=e.values[1],u=e.values[2],d=e.values[3],g=o+2*(f-o)/3,_=s+2*(p-s)/3,v=u+2*(f-u)/3,y=d+2*(p-d)/3;t.push({type:`C`,values:[g,_,v,y,u,d]}),i=f,a=p,o=u,s=d}else if(e.type===`A`){var b=Math.abs(e.values[0]),x=Math.abs(e.values[1]),S=e.values[2],C=e.values[3],w=e.values[4],u=e.values[5],d=e.values[6];b===0||x===0?(t.push({type:`C`,values:[o,s,u,d,u,d]}),o=u,s=d):(o!==u||s!==d)&&(r(o,s,u,d,b,x,S,C,w).forEach(function(e){t.push({type:`C`,values:e})}),o=u,s=d)}else e.type===`Z`&&(t.push(e),o=c,s=l);n=e.type}),t},r=function(e,t,n,i,a,o,s,c,l,u){var d=function(e){return Math.PI*e/180},f=function(e,t,n){return{x:e*Math.cos(n)-t*Math.sin(n),y:e*Math.sin(n)+t*Math.cos(n)}},p=d(s),m=[],h,g,_,v;if(u)h=u[0],g=u[1],_=u[2],v=u[3];else{var y=f(e,t,-p);e=y.x,t=y.y;var b=f(n,i,-p);n=b.x,i=b.y;var x=(e-n)/2,S=(t-i)/2,C=x*x/(a*a)+S*S/(o*o);C>1&&(C=Math.sqrt(C),a=C*a,o=C*o);var w=c===l?-1:1,T=a*a,E=o*o,D=T*E-T*S*S-E*x*x,O=T*S*S+E*x*x,k=w*Math.sqrt(Math.abs(D/O));_=k*a*S/o+(e+n)/2,v=k*-o*x/a+(t+i)/2,h=Math.asin(parseFloat(((t-v)/o).toFixed(9))),g=Math.asin(parseFloat(((i-v)/o).toFixed(9))),e<_&&(h=Math.PI-h),n<_&&(g=Math.PI-g),h<0&&(h=Math.PI*2+h),g<0&&(g=Math.PI*2+g),l&&h>g&&(h-=Math.PI*2),!l&&g>h&&(g-=Math.PI*2)}var A=g-h;if(Math.abs(A)>Math.PI*120/180){var j=g,M=n,N=i;g=l&&g>h?h+Math.PI*120/180*1:h+Math.PI*120/180*-1,n=_+a*Math.cos(g),i=v+o*Math.sin(g),m=r(n,i,M,N,a,o,s,0,l,[g,j,_,v])}A=g-h;var P=Math.cos(h),F=Math.sin(h),ee=Math.cos(g),I=Math.sin(g),te=Math.tan(A/4),ne=4/3*a*te,re=4/3*o*te,L=[e,t],R=[e+ne*F,t-re*P],z=[n+ne*I,i-re*ee],ie=[n,i];if(R[0]=2*L[0]-R[0],R[1]=2*L[1]-R[1],u)return[R,z,ie].concat(m);m=[R,z,ie].concat(m);for(var ae=[],oe=0;oe<m.length;oe+=3){var a=f(m[oe][0],m[oe][1],p),o=f(m[oe+1][0],m[oe+1][1],p),se=f(m[oe+2][0],m[oe+2][1],p);ae.push([a.x,a.y,o.x,o.y,se.x,se.y])}return ae};let i=SVGPathElement.prototype.getPathData!==void 0&&SVGPathElement.prototype.setPathData!==void 0;if(i)try{document.createElementNS(`http://www.w3.org/2000/svg`,`path`).setPathData([{type:`M`,values:[0,0]}])}catch{i=!1}if(i===!1){var a={Z:`Z`,M:`M`,L:`L`,C:`C`,Q:`Q`,A:`A`,H:`H`,V:`V`,S:`S`,T:`T`,z:`Z`,m:`m`,l:`l`,c:`c`,q:`q`,a:`a`,h:`h`,v:`v`,s:`s`,t:`t`},o=function(e){this._string=e,this._currentIndex=0,this._endIndex=this._string.length,this._prevCommand=null,this._skipOptionalSpaces()},s=window.navigator.userAgent.indexOf(`MSIE `)!==-1;o.prototype={parseSegment:function(){var e=this._string[this._currentIndex],t=a[e]?a[e]:null;if(t===null){if(this._prevCommand===null||(t=(e===`+`||e===`-`||e===`.`||e>=`0`&&e<=`9`)&&this._prevCommand!==`Z`?this._prevCommand===`M`?`L`:this._prevCommand===`m`?`l`:this._prevCommand:null,t===null))return null}else this._currentIndex+=1;this._prevCommand=t;var n=null,r=t.toUpperCase();return r===`H`||r===`V`?n=[this._parseNumber()]:r===`M`||r===`L`||r===`T`?n=[this._parseNumber(),this._parseNumber()]:r===`S`||r===`Q`?n=[this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber()]:r===`C`?n=[this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber()]:r===`A`?n=[this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseArcFlag(),this._parseArcFlag(),this._parseNumber(),this._parseNumber()]:r===`Z`&&(this._skipOptionalSpaces(),n=[]),n===null||n.indexOf(null)>=0?null:{type:t,values:n}},hasMoreData:function(){return this._currentIndex<this._endIndex},peekSegmentType:function(){var e=this._string[this._currentIndex];return a[e]?a[e]:null},initialCommandIsMoveTo:function(){if(!this.hasMoreData())return!0;var e=this.peekSegmentType();return e===`M`||e===`m`},_isCurrentSpace:function(){var e=this._string[this._currentIndex];return e<=` `&&(e===` `||e===`
|
|
4
|
+
`||e===` `||e===`\r`||e===`\f`)},_skipOptionalSpaces:function(){for(;this._currentIndex<this._endIndex&&this._isCurrentSpace();)this._currentIndex+=1;return this._currentIndex<this._endIndex},_skipOptionalSpacesOrDelimiter:function(){return this._currentIndex<this._endIndex&&!this._isCurrentSpace()&&this._string[this._currentIndex]!==`,`?!1:(this._skipOptionalSpaces()&&this._currentIndex<this._endIndex&&this._string[this._currentIndex]===`,`&&(this._currentIndex+=1,this._skipOptionalSpaces()),this._currentIndex<this._endIndex)},_parseNumber:function(){var e=0,t=0,n=1,r=0,i=1,a=1,o=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex<this._endIndex&&this._string[this._currentIndex]===`+`?this._currentIndex+=1:this._currentIndex<this._endIndex&&this._string[this._currentIndex]===`-`&&(this._currentIndex+=1,i=-1),this._currentIndex===this._endIndex||(this._string[this._currentIndex]<`0`||this._string[this._currentIndex]>`9`)&&this._string[this._currentIndex]!==`.`)return null;for(var s=this._currentIndex;this._currentIndex<this._endIndex&&this._string[this._currentIndex]>=`0`&&this._string[this._currentIndex]<=`9`;)this._currentIndex+=1;if(this._currentIndex!==s)for(var c=this._currentIndex-1,l=1;c>=s;)t+=l*(this._string[c]-`0`),--c,l*=10;if(this._currentIndex<this._endIndex&&this._string[this._currentIndex]===`.`){if(this._currentIndex+=1,this._currentIndex>=this._endIndex||this._string[this._currentIndex]<`0`||this._string[this._currentIndex]>`9`)return null;for(;this._currentIndex<this._endIndex&&this._string[this._currentIndex]>=`0`&&this._string[this._currentIndex]<=`9`;)n*=10,r+=(this._string.charAt(this._currentIndex)-`0`)/n,this._currentIndex+=1}if(this._currentIndex!==o&&this._currentIndex+1<this._endIndex&&(this._string[this._currentIndex]===`e`||this._string[this._currentIndex]===`E`)&&this._string[this._currentIndex+1]!==`x`&&this._string[this._currentIndex+1]!==`m`){if(this._currentIndex+=1,this._string[this._currentIndex]===`+`?this._currentIndex+=1:this._string[this._currentIndex]===`-`&&(this._currentIndex+=1,a=-1),this._currentIndex>=this._endIndex||this._string[this._currentIndex]<`0`||this._string[this._currentIndex]>`9`)return null;for(;this._currentIndex<this._endIndex&&this._string[this._currentIndex]>=`0`&&this._string[this._currentIndex]<=`9`;)e*=10,e+=this._string[this._currentIndex]-`0`,this._currentIndex+=1}var u=t+r;return u*=i,e&&(u*=10**(a*e)),o===this._currentIndex?null:(this._skipOptionalSpacesOrDelimiter(),u)},_parseArcFlag:function(){if(this._currentIndex>=this._endIndex)return null;var e=null,t=this._string[this._currentIndex];if(this._currentIndex+=1,t===`0`)e=0;else if(t===`1`)e=1;else return null;return this._skipOptionalSpacesOrDelimiter(),e}};var c=function(e){if(!e||e.length===0)return[];var t=new o(e),n=[];if(t.initialCommandIsMoveTo())for(;t.hasMoreData();){var r=t.parseSegment();if(r===null)break;n.push(r)}return n},l=SVGPathElement.prototype.setAttribute,u=SVGPathElement.prototype.setAttributeNS,d=SVGPathElement.prototype.removeAttribute,f=SVGPathElement.prototype.removeAttributeNS,p=window.Symbol?Symbol():`__cachedPathData`,m=window.Symbol?Symbol():`__cachedNormalizedPathData`;SVGPathElement.prototype.setAttribute=function(e,t){e===`d`&&(this[p]=null,this[m]=null),l.call(this,e,t)},SVGPathElement.prototype.setAttributeNS=function(e,t,n){if(t===`d`){var r=`http://www.w3.org/2000/svg`;if(e)for(var i of this.ownerSVGElement.attributes)i.name===`xmlns:${e}`&&(r=i.value);r===`http://www.w3.org/2000/svg`&&(this[p]=null,this[m]=null)}u.call(this,e,t,n)},SVGPathElement.prototype.removeAttribute=function(e,t){e===`d`&&(this[p]=null,this[m]=null),d.call(this,e)},SVGPathElement.prototype.removeAttributeNS=function(e,t){if(t===`d`){var n=`http://www.w3.org/2000/svg`;if(e)for(var r of this.ownerSVGElement.attributes)r.name===`xmlns:${e}`&&(n=r.value);n===`http://www.w3.org/2000/svg`&&(this[p]=null,this[m]=null)}f.call(this,e,t)},SVGPathElement.prototype.getPathData=function(r){if(r&&r.normalize){if(this[m])return e(this[m]);var i;this[p]?i=e(this[p]):(i=c(this.getAttribute(`d`)||``),this[p]=e(i));var a=n(t(i));return this[m]=e(a),a}else if(this[p])return e(this[p]);else{var i=c(this.getAttribute(`d`)||``);return this[p]=e(i),i}},SVGPathElement.prototype.setPathData=function(e){if(e.length===0)s?this.setAttribute(`d`,``):this.removeAttribute(`d`);else{for(var t=``,n=0,r=e.length;n<r;n+=1){var i=e[n];n>0&&(t+=` `),t+=i.type,i.values&&i.values.length>0&&(t+=` `+i.values.join(` `))}this.setAttribute(`d`,t)}}}SVGRectElement.prototype.getPathData||(SVGRectElement.prototype.getPathData=function(e){var t=this.x.baseVal.value,r=this.y.baseVal.value,i=this.width.baseVal.value,a=this.height.baseVal.value,o=this.hasAttribute(`rx`)?this.rx.baseVal.value:this.ry.baseVal.value,s=this.hasAttribute(`ry`)?this.ry.baseVal.value:this.rx.baseVal.value;o>i/2&&(o=i/2),s>a/2&&(s=a/2);var c=[{type:`M`,values:[t+o,r]},{type:`H`,values:[t+i-o]},{type:`A`,values:[o,s,0,0,1,t+i,r+s]},{type:`V`,values:[r+a-s]},{type:`A`,values:[o,s,0,0,1,t+i-o,r+a]},{type:`H`,values:[t+o]},{type:`A`,values:[o,s,0,0,1,t,r+a-s]},{type:`V`,values:[r+s]},{type:`A`,values:[o,s,0,0,1,t+o,r]},{type:`Z`,values:[]}];return c=c.filter(function(e){return!(e.type===`A`&&(e.values[0]===0||e.values[1]===0))}),e&&e.normalize===!0&&(c=n(c)),c}),SVGCircleElement.prototype.getPathData||(SVGCircleElement.prototype.getPathData=function(e){var t=this.cx.baseVal.value,r=this.cy.baseVal.value,i=this.r.baseVal.value,a=[{type:`M`,values:[t+i,r]},{type:`A`,values:[i,i,0,0,1,t,r+i]},{type:`A`,values:[i,i,0,0,1,t-i,r]},{type:`A`,values:[i,i,0,0,1,t,r-i]},{type:`A`,values:[i,i,0,0,1,t+i,r]},{type:`Z`,values:[]}];return e&&e.normalize===!0&&(a=n(a)),a}),SVGEllipseElement.prototype.getPathData||(SVGEllipseElement.prototype.getPathData=function(e){var t=this.cx.baseVal.value,r=this.cy.baseVal.value,i=this.rx.baseVal.value,a=this.ry.baseVal.value,o=[{type:`M`,values:[t+i,r]},{type:`A`,values:[i,a,0,0,1,t,r+a]},{type:`A`,values:[i,a,0,0,1,t-i,r]},{type:`A`,values:[i,a,0,0,1,t,r-a]},{type:`A`,values:[i,a,0,0,1,t+i,r]},{type:`Z`,values:[]}];return e&&e.normalize===!0&&(o=n(o)),o}),SVGLineElement.prototype.getPathData||(SVGLineElement.prototype.getPathData=function(){return[{type:`M`,values:[this.x1.baseVal.value,this.y1.baseVal.value]},{type:`L`,values:[this.x2.baseVal.value,this.y2.baseVal.value]}]}),SVGPolylineElement.prototype.getPathData||(SVGPolylineElement.prototype.getPathData=function(){for(var e=[],t=0;t<this.points.numberOfItems;t+=1){var n=this.points.getItem(t);e.push({type:t===0?`M`:`L`,values:[n.x,n.y]})}return e}),SVGPolygonElement.prototype.getPathData||(SVGPolygonElement.prototype.getPathData=function(){for(var e=[],t=0;t<this.points.numberOfItems;t+=1){var n=this.points.getItem(t);e.push({type:t===0?`M`:`L`,values:[n.x,n.y]})}return e.push({type:`Z`,values:[]}),e})})();function B(e){return String(e).replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function V(e,t,n=1e-4){return Math.abs(e-t)<n}async function ke(e,t,n,r){let i=Re(e,r),a=await Promise.all(i.map(e=>r.loadFont(e.name)));e=ze(e,r,i,a);let o=new Blob([e],{type:`image/svg+xml`}),s=URL.createObjectURL(o),c=new Image;c.width=t,c.height=n,c.src=s;try{await c.decode()}finally{URL.revokeObjectURL(s)}return c}function Ae(e,t=e.getBoundingClientRect()){let n=e.querySelectorAll(`.adornment-svg`);return Array.from(n).map(e=>{let n=e.outerHTML,r=e.dataset.adornmentName,i=e.getBoundingClientRect();return{name:r,svg:n,x:i.left-t.left,y:i.top-t.top,w:i.width,h:i.height}})}async function je(e,t,n,r=n.getBoundingClientRect()){let{fonts:i}=t,a=e.canvas.width/r.width,o=e.canvas.height/r.height,s=await Promise.all(Ae(n,r).map(async({svg:e,x:t,y:n,w:r,h:s})=>{let c=r*a,l=s*o;return{image:await ke(e,c,l,i),x:t*a,y:n*o,width:c,height:l}}));for(let t of s)e.drawImage(t.image,t.x,t.y,t.width,t.height)}var Me=/\$\{([^}]+)}/g,Ne=new DOMParser,Pe=new XMLSerializer,Fe=new Map;function Ie(e){let t=Fe.get(e);return t||(t=Ne.parseFromString(e,`image/svg+xml`).documentElement,Fe.set(e,t)),t}function Le(e){let t=Pe.serializeToString(e);return Fe.has(t)||Fe.set(t,e),t}function Re(e,t){if(!t.usedFontsCache.has(e)){let n=new Map,r=Ie(e);document.body.appendChild(r);try{r.querySelectorAll(`text,tspan`).forEach(e=>{let r=window.getComputedStyle(e);be(r.fontFamily).forEach(({name:e,generic:i})=>{if(i)return;let a=Ce(t.fontMap.values(),e,r.fontWeight,r.fontStyle)??t.getDirectFont(e);a!==void 0&&n.set(Te(a.family,a.weight,a.style),a)})}),t.usedFontsCache.set(e,Array.from(n.values()))}finally{document.body.removeChild(r)}}return t.usedFontsCache.get(e)??[]}function ze(e,t,n,r){if(!t.fontInjectedSvgCache.has(e)){let i=n.map((e,t)=>{let n=r[t];return n===void 0?``:`
|
|
5
|
+
@font-face {
|
|
6
|
+
font-family: ${_e(e.family)};
|
|
7
|
+
font-weight: ${e.weight};
|
|
8
|
+
font-style: ${e.style};
|
|
9
|
+
src: url(data:font/woff2;base64,${n});
|
|
10
|
+
}
|
|
11
|
+
`}).join(``);if(i.length!==0){let n=Ie(e).cloneNode(!0),r=n.querySelector(`defs`);r===null&&(r=n.ownerDocument.createElementNS(`http://www.w3.org/2000/svg`,`defs`),n.prepend(r));let a=n.ownerDocument.createElementNS(`http://www.w3.org/2000/svg`,`style`);a.textContent=i,r.appendChild(a),t.fontInjectedSvgCache.set(e,Pe.serializeToString(n))}else t.fontInjectedSvgCache.set(e,e)}return t.fontInjectedSvgCache.get(e)??e}var Be=new Map;function Ve(e){let t=Be.get(e);if(t)return t;let n=Ie(e),r=n.querySelectorAll(`[mol_embed]`),i=r.length?Array.from(r):[n];document.body.appendChild(n);let a;try{let e=n.getBoundingClientRect();a=Ee(i.map(e=>{let{x:t,y:n,width:r,height:i}=e.getBoundingClientRect();return[t,n,t+r,n+i]})),De(a,-e.x,-e.y),Oe(a)}finally{document.body.removeChild(n)}return Be.set(e,a),a}var He=class{_seen=[];_svg=null;_element=null;constructor(e){this._svg=e}setElement(){return this._element=Ie(this._svg).cloneNode(!0),this._svg=null,this._element}getSvgString(){return this._svg??Le(this._element)}getSvgSize(){let e=this._element??Ie(this._svg);return[e.width.baseVal.value,e.height.baseVal.value]}getSvgColors(){let e=[],t=[],n=(this._element??Ie(this._svg)).querySelectorAll(`[mol_edit_style=true]`);for(let r=0;r<n.length;++r){let i=n[r],a=i.id;if(a&&t.every(e=>e.id!==a)){let n=i.getAttribute(`fill`)?.trim();if(n){let r=new Ze(n);if(r.badValue)e.push({name:`fill#${a}`,color:n});else{let{rgba:t}=r,n=i.getAttribute(`fill-opacity`);t[3]*=n?ne(Number(n),0,1):1,e.push({name:`fill#${a}`,color:Ze.fromRGB(t)})}t.push(i)}let r=i.getAttribute(`stroke`)?.trim();if(r){let n=new Ze(r);if(n.badValue)e.push({name:`stroke#${a}`,color:r});else{let{rgba:t}=n,r=i.getAttribute(`stroke-opacity`);t[3]*=r?ne(Number(r),0,1):1,e.push({name:`stroke#${a}`,color:Ze.fromRGB(t)})}t.push(i)}}}return e}setSvgColors(e){let t=[],n=(this._element??this.setElement()).querySelectorAll(`[mol_edit_style=true]`);for(let r=0;r<n.length;++r){let i=n[r],a=i.id;if(a&&t.every(e=>e.id!==a)&&(i.getAttribute(`fill`)?.trim()||i.getAttribute(`stroke`)?.trim())){let n=e.find(e=>e.name===`fill#${a}`);if(n?.color){let[e,t,r,a]=n.color.rgba;i.setAttribute(`fill`,`rgb(${e},${t},${r})`),i.setAttribute(`fill-opacity`,String(a))}let r=e.find(e=>e.name===`stroke#${a}`);if(r?.color){let[e,t,n,a]=r.color.rgba;i.setAttribute(`stroke`,`rgb(${e},${t},${n})`),i.setAttribute(`stroke-opacity`,String(a))}t.push(i)}}return this}getSvgTexts(){let e=[],t=(this._element??Ie(this._svg)).querySelectorAll(`[mol_edit_text=true]`);for(let n=0;n<t.length;++n){let r=t[n],i=r.id;i&&e.every(e=>e.name!==i)&&e.push({name:i,text:r.textContent||void 0,isMultiline:/^\s*true/i.test(r.getAttribute(`mol_wrap`)??`false`)})}return e}setSvgTexts(e){this._seen=[];let t=this._element??this.setElement(),n=t.querySelectorAll(`[mol_edit_text=true]`);document.body.appendChild(t);try{let r=t.width.baseVal.value/t.viewBox.baseVal.width;for(let r=0;r<n.length;++r){let i=n[r],a=i.id;if(a&&this._seen.every(e=>e.id!==a)){let n=e.find(e=>e.name===a);if(i.querySelector(`textPath`)){if(n)for(let e=0;e<i.childNodes.length;++e)i.childNodes[e].nodeName===`textPath`&&(i.childNodes[e].childNodes[0].nodeValue=n.text??``)}else this.wrapText(t,i,n&&(n.text??``));this.nodeChanged(i)}}this._seen.length&&(this.resetSize(r),this.resetAnchor())}finally{document.body.removeChild(t)}return this}nodeChanged(e){if(!e.id||this._seen.includes(e))return;let t=this._element??this.setElement(),n=this.getBBox(e),r=0,i=t.querySelectorAll(`[mol_wrap~="${e.id}"]`)??[];for(r=0;r<i.length;++r)this.wrapText(t,i[r]);for(i=t.querySelectorAll(`[mol_autoresizeid~="${e.id}"]`)??[],r=0;r<i.length;++r)this.autoResizeId(i[r],n);for(i=t.querySelectorAll(`[mol_samewidth~="${e.id}"]`)??[],r=0;r<i.length;++r)this.sameWidth(i[r],n);for(i=t.querySelectorAll(`[mol_sameheight~="${e.id}"]`)??[],r=0;r<i.length;++r)this.sameHeight(i[r],n);for(i=t.querySelectorAll(`[mol_stack~="${e.id}"]`)??[],r=0;r<i.length;++r)this.stack(i[r],n);for(i=t.querySelectorAll(`[mol_rectposition~="${e.id}"]`)??[],r=0;r<i.length;++r)this.rectPosition(i[r],n);for(i=t.querySelectorAll(`[mol_pathposition~="${e.id}"]`)??[],r=0;r<i.length;++r)this.pathPosition(i[r],e);for(i=t.querySelectorAll(`[mol_copyposition~="${e.id}"]`)??[],r=0;r<i.length;++r)this.copyPosition(i[r],e);this._seen.push(e)}autoResizeId(e,t){let n=e.attributes.mol_autoresizemargin?.value,r=[0,0,0,0];if(n){let e=n.split(` `).map(e=>parseFloat(e));r=e.length===1?[e[0],e[0],e[0],e[0]]:[e[0],e[1],e[2],e[3]]}V(e.attributes.x.value,t.x-r[0])&&V(e.attributes.y.value,t.y-r[2])&&V(e.attributes.width.value,t.width+r[0]+r[1])&&V(e.attributes.height.value,t.height+r[2]+r[3])||(e.attributes.x.value=t.x-r[0],e.attributes.y.value=t.y-r[2],e.attributes.width.value=t.width+r[0]+r[1],e.attributes.height.value=t.height+r[2]+r[3],this.nodeChanged(e))}sameWidth(e,t){let n=t.width+2*parseFloat(e.attributes.mol_samewidth.value.split(` `)[1]);V(e.attributes.width.value,n)||(e.attributes.width.value=n,this.nodeChanged(e))}sameHeight(e,t){let n=t.height+2*parseFloat(e.attributes.mol_sameheight.value.split(` `)[1]);V(e.attributes.height.value,n)||(this._seen.push(e),e.attributes.height.value=n,this.nodeChanged(e))}stack(e,t){let n=!1;switch(e.attributes.mol_stack.value.split(` `)[0]){case`top`:n=!(V(e.attributes.width.value,t.width)&&V(e.attributes.x.value,t.x)&&V(e.attributes.y.value,t.y-e.attributes.height.value)),n&&(e.attributes.width.value=t.width,e.attributes.x.value=t.x,e.attributes.y.value=t.y-e.attributes.height.value);break;case`bottom`:n=!(V(e.attributes.width.value,t.width)&&V(e.attributes.x.value,t.x)&&V(e.attributes.y.value,t.y+t.height)),n&&(e.attributes.width.value=t.width,e.attributes.x.value=t.x,e.attributes.y.value=t.y+t.height);break;case`left`:n=!(V(e.attributes.height.value,t.height)&&V(e.attributes.x.value,t.x-e.attributes.width.value)&&V(e.attributes.y.value,t.y)),n&&(e.attributes.height.value=t.height,e.attributes.x.value=t.x-e.attributes.width.value,e.attributes.y.value=t.y);break;case`right`:n=!(V(e.attributes.height.value,t.height)&&V(e.attributes.x.value,t.x+t.width)&&V(e.attributes.y.value,t.y)),n&&(e.attributes.height.value=t.height,e.attributes.x.value=t.x+t.width,e.attributes.y.value=t.y);break}n&&this.nodeChanged(e)}rectPosition(e,t){let n=e.attributes.mol_rectposition.value.split(` `)[1],r=e.attributes.mol_rectposition.value.split(` `)[2],i=parseFloat(e.attributes.mol_rectposition.value.split(` `)[3])||0,a={x:0,y:0};switch(n){case`center`:a={x:t.x+t.width/2,y:t.y+t.height/2};break;case`top`:case`bottom`:switch(a.x=t.x,r){case`start`:a.x+=i;break;case`middle`:a.x+=t.width/2+i;break;case`end`:a.x+=t.width-i;break}a.y=t.y,n===`bottom`&&(a.y+=t.height);break;case`left`:case`right`:switch(a.y=t.y,r){case`start`:a.y+=i;break;case`middle`:a.y+=t.height/2+i;break;case`end`:a.y+=t.height+i;break}a.x=t.x,n===`right`&&(a.x+=t.width);break}let o=this.getCoordinate(e,0,0);o&&!(V(o.x,a.x)&&V(o.y,a.y))&&(this.moveElement(e,a),this.nodeChanged(e))}pathPosition(e,t){let n=e.attributes.mol_pathposition.value.split(` `).map(e=>parseFloat(e)),r=this.getCoordinate(e,0,0),i=this.getCoordinate(t,n[1],n[2]);i&&r&&!(V(i.x,r.x)&&V(i.y,r.y))&&(this.moveElement(e,i),this.nodeChanged(e))}copyPosition(e,t){let n=e.attributes.mol_copyposition.value.split(` `).map(e=>parseFloat(e)),r=this.getCoordinate(e,n[0],n[1]),i=this.getCoordinate(t,n[3],n[4]);i&&r&&!(V(i.x,r.x)&&V(i.y,r.y))&&(this.setCoordinate(e,i,n[0],n[1]),this.nodeChanged(e))}resetSize(e){let t=this._element??this.setElement(),n=this.getBBox(t);n.x-=.1*n.width,n.y-=.1*n.height,n.width*=1.2,n.height*=1.2,t.setAttribute(`viewBox`,`${n.x} ${n.y} ${n.width} ${n.height}`),t.setAttribute(`width`,`${n.width*e}`),t.setAttribute(`height`,`${n.height*e}`)}resetAnchor(){let e=(this._element??Ie(this._svg)).querySelector(`[mol_edit_anchor]`);if(e){let t=e.getAttribute(`mol_edit_anchor`).split(` `).map(e=>parseFloat(e)),n=this.getCoordinate(e,t[0],t[1]),r=this._element??this.setElement(),i=r.getElementById(`scale`);if(i){let e=i.getAttribute(`transform`),t=(/scale\(([\d.]+)\)/i.exec(e)||[``,`1`]).map(Number.parseFloat)[1];n.x*=t,n.y*=t}r.setAttribute(`mol_svganchor`,`${n.x} ${n.y}`)}}getBBox(e){function t(e){if(e.nodeName!==`text`)return``;let t=e.textContent,n=0;for(;n<e.childNodes.length&&e.childNodes[n].nodeName===`tspan`&&e.childNodes[n].textContent.match(/\S+/)===null;)t=t.slice(e.childNodes[n].textContent.length),n++;for(n=e.childNodes.length-1;n>=0&&e.childNodes[n].nodeName===`tspan`&&e.childNodes[n].textContent.match(/\S+/)===null;)t=t.slice(0,t.length-e.childNodes[n].textContent.length),n--;let r=t.split(`
|
|
12
|
+
`);for(t=r[0],n=1;n<r.length;++n)r[n].length>t.length&&(t=r[n]);return t}let n=null,r=e.getBBox();if(e.nodeName===`text`){let i=t(e),a=r.width,o=r.x,s=i.match(/\S+.*\S+/);if(s&&s.length>0){let e=i.match(/^\s*/);e.length>0&&(o-=a/s[0].length*e[0].length),a+=a/s[0].length*(i.length-s[0].length)}n={width:a,height:r.height,x:o,y:r.y,descent:r.y+r.height-Number(e.getAttribute(`y`))}}else n={x:r.x,y:r.y,width:Math.max(1,r.width),height:Math.max(1,r.height)};return n}nodeToPoints(e){let t=[],n,r,i;for(r=e.points.length?e.points.length:e.points.numberOfItems,i=0;i<r;++i)n=e.points.getItem(i),t.push(n);return t}pointsToString(e){let t=``,n;for(n=0;n<e.length;++n)t=`${t} ${e[n].x.toString()}, ${e[n].y.toString()}`;return t}getCoordinate(e,t,n){let r={x:0,y:0},i=[],a=[];switch(e.nodeName){case`rect`:if(t===0)return r.x=parseFloat(e.getAttribute(`x`)),r.y=parseFloat(e.getAttribute(`y`)),r;if(t===1)return r.x=parseFloat(e.getAttribute(`x`))+parseFloat(e.getAttribute(`width`)),r.y=parseFloat(e.getAttribute(`y`))+parseFloat(e.getAttribute(`height`)),r;break;case`circle`:if(t===0)return r.x=parseFloat(e.getAttribute(`cx`)),r.y=parseFloat(e.getAttribute(`cy`)),r;if(t===1)return r.x=parseFloat(e.getAttribute(`cx`))+parseFloat(e.getAttribute(`r`)),r.y=parseFloat(e.getAttribute(`cy`)),r;break;case`ellipse`:if(t===0)return r.x=parseFloat(e.getAttribute(`cx`)),r.y=parseFloat(e.getAttribute(`cy`)),r;if(t===1)return r.x=parseFloat(e.getAttribute(`cx`))+parseFloat(e.getAttribute(`rx`)),r.y=parseFloat(e.getAttribute(`cy`)),r;if(t===2)return r.x=parseFloat(e.getAttribute(`cx`)),r.y=parseFloat(e.getAttribute(`cy`))-parseFloat(e.getAttribute(`ry`)),r;break;case`line`:if(t===0)return r.x=parseFloat(e.getAttribute(`x1`)),r.y=parseFloat(e.getAttribute(`y1`)),r;if(t===1)return r.x=parseFloat(e.getAttribute(`x2`)),r.y=parseFloat(e.getAttribute(`y2`)),r;break;case`polyline`:if(i=this.nodeToPoints(e),t<i.length)return r.x=i[t].x,r.y=i[t].y,r;break;case`polygon`:if(i=this.nodeToPoints(e),t<i.length)return r.x=i[t].x,r.y=i[t].y,r;break;case`path`:switch(a=e.getPathData({normalize:!0}),a[n].type){case`M`:switch(t){case 0:return r.x=a[n].values[0],r.y=a[n].values[1],r}break;case`L`:switch(t){case 0:return r.x=a[n].values[0],r.y=a[n].values[1],r}break}break}return null}setCoordinate(e,t,n,r){let i=``,a=[],o=[],s=0,c=0,l=0;switch(e.nodeName){case`rect`:n===0&&(e.setAttribute(`x`,t.x.toString()),e.setAttribute(`y`,t.y.toString())),n===1&&(s=t.x-Number(e.getAttribute(`x`)),s>=0?e.setAttribute(`width`,s.toString()):(c=Number(e.getAttribute(`x`))+s,e.setAttribute(`x`,c.toString()),e.setAttribute(`width`,`0`)),s=t.y-Number(e.getAttribute(`y`)),s>=0?e.setAttribute(`height`,s.toString()):(c=Number(e.getAttribute(`y`))+s,e.setAttribute(`y`,c.toString()),e.setAttribute(`height`,`0`)));break;case`circle`:n===0&&(e.setAttribute(`cx`,t.x.toString()),e.setAttribute(`cy`,t.y.toString())),n===1&&(c=parseFloat(e.getAttribute(`cx`))-t.x,l=parseFloat(e.getAttribute(`cy`))-t.y,s=Math.sqrt(c*c+l*l),e.setAttribute(`r`,s.toString()));break;case`ellipse`:n===0&&(e.setAttribute(`cx`,t.x.toString()),e.setAttribute(`cy`,t.y.toString())),n===1&&(s=Math.abs(parseFloat(e.getAttribute(`cx`))-t.x),e.setAttribute(`rx`,s.toString())),n===2&&(s=Math.abs(parseFloat(e.getAttribute(`cy`))-t.y),e.setAttribute(`ry`,s.toString()));break;case`line`:n===0&&(e.setAttribute(`x1`,t.x.toString()),e.setAttribute(`y2`,t.y.toString())),n===1&&(e.setAttribute(`x2`,t.x.toString()),e.setAttribute(`y2`,t.y.toString()));break;case`polyline`:a=this.nodeToPoints(e),n<a.length&&(a[n].x=t.x,a[n].y=t.y,i=this.pointsToString(a),e.setAttribute(`points`,i));break;case`polygon`:a=this.nodeToPoints(e),n<a.length&&(a[n].x=t.x,a[n].y=t.y,i=this.pointsToString(a),e.setAttribute(`points`,i));break;case`path`:if(!r)break;switch(o=e.getPathData({normalize:!0}),o[r].type){case`M`:o[r].values[0]=t.x,o[r].values[1]=t.y;break;case`L`:o[r].values[0]=t.x,o[r].values[1]=t.y;break}e.setPathData(o);break}}moveElement(e,t){let n={x:0,y:0},r={x:0,y:0},i=0,a=!1,o=[];switch(e.nodeName){case`rect`:case`circle`:case`ellipse`:n=this.getCoordinate(e,0,0),a=!V(n.x,t.x)||!V(n.y,t.y),a&&this.setCoordinate(e,t,0,0);break;case`polyline`:case`polygon`:if(n=this.getCoordinate(e,0,0),r.x=t.x-n.x,r.y=t.y-n.y,a=!V(r.x,0)||!V(r.y,0),a)for(this.setCoordinate(e,t,0,0),i=1,n=this.getCoordinate(e,i,0);n!==null;)n.x+=r.x,n.y+=r.y,this.setCoordinate(n,i,0,void 0),i++,n=this.getCoordinate(e,i,0);break;case`path`:if(n=this.getCoordinate(e,0,0),r.x=t.x-n.x,r.y=t.y-n.y,a=!V(r.x,0)||!V(r.y,0),a){o=e.getPathData({normalize:!0});for(let e=0;e<o.length;++e){let t=o[e];(t?.type===`M`||t?.type===`L`)&&(t.values[0]+=r.x,t.values[1]+=r.y)}e.setPathData(o)}break}return a}wrapText(e,t,n){let r=[],i=0,a,o=0,s=``,c=``,l,u,d,f=0,p=``,m,h=`http://www.w3.org/2000/svg`;for(n??=t.textContent;t.hasChildNodes();)t.removeChild(t.firstChild);let g=document.createTextNode(`gh`);t.appendChild(g);let _=t.getAttribute(`y`),v=null,y=``,b=[],x=0,S=0,C=!1;if(t.hasAttribute(`mol_wrap`)&&(b=t.getAttribute(`mol_wrap`).split(` `,4),b[0]===`true`&&(y=b[1],y===`newlineOnly`?(C=!0,y=``,x=0):x=parseFloat(b[2]),S=b.length>=4?parseFloat(b[3]):x)),y){let n=e.getElementById(y);v=this.getBBox(n||t)}else v=this.getBBox(t);let w=v.x,T=v.y,E=v.width,D=1e4;y!==``&&!C&&(D=E-2*x),v=this.getBBox(t);let O=v.height;t.hasAttribute(`font-size`)&&(O=parseFloat(t.getAttribute(`font-size`)));let k=v.y+v.height-_;if(t.removeChild(g),w+=x,T+=x+v.height,t.hasAttribute(`text-anchor`))switch(t.getAttribute(`text-anchor`)){case`end`:w=w-x+E-x;break;case`middle`:w=w-x+E/2;break}p=t.getAttribute(`id`),t.setAttribute(`x`,w.toString()),t.setAttribute(`y`,(T-k).toString()),n&&(r=n.replace(/\n/g,`
|
|
13
|
+
§`).replace(/-/g,`-§`).replace(/ /g,` §`).replace(/\t/g,` §`).split(`§`));let A=parseFloat(t.attributes.y.value);for(u=document.createElementNS(h,`tspan`),u.setAttributeNS(null,`x`,String(w)),u.setAttributeNS(null,`y`,String(A+o)),d=p+f.toString(),u.setAttribute(`id`,d),f++,s=``,i=0,l=document.createTextNode(s),u.appendChild(l),t.appendChild(u),o+=O,a=0;a<r.length;)c=s+r[a],i++,l.nodeValue=c,m=e.querySelector(`#${d}`).getComputedTextLength(),m<D?(s=c,s.length>0&&s[s.length-1]===`
|
|
14
|
+
`&&a<r.length-1&&(l.nodeValue=s,u=document.createElementNS(h,`tspan`),u.setAttributeNS(null,`x`,String(w)),u.setAttributeNS(null,`y`,String(A+o)),d=p+f.toString(),u.setAttribute(`id`,d),o+=O+S,f++,s=``,i=0,l=document.createTextNode(s),u.appendChild(l),t.appendChild(u)),a++):(i>1?l.nodeValue=s:(s=c,a++),s.length>0&&s[s.length-1]===`
|
|
15
|
+
`&&(s=s.substr(0,s.length-1),l.nodeValue=s),u=document.createElementNS(h,`tspan`),u.setAttributeNS(null,`x`,String(w)),u.setAttributeNS(null,`y`,String(A+o)),d=p+f.toString(),u.setAttribute(`id`,d),o+=O+S,f++,s=``,i=0,l=document.createTextNode(s),u.appendChild(l),t.appendChild(u));return t.childElementCount===1&&t.firstElementChild.replaceWith(t.firstElementChild.textContent),o}},Ue=class{map;keyCache=new Map;promises=[];fonts;constructor(e,t,n,r){this.map=e,this.fonts=new pe(t,n,r)}getMapLibreImageKey(e,t){let n=this.keyCache.get(t);n||(n=new Map,this.keyCache.set(t,n));let r=n.get(e);if(!r){let i=e+t,a=new He(e).getSvgSize(),o=Math.max(a[0]*t,1),s=Math.max(a[1]*t,1);r=`mc-image-${L(i)}`,this.promises.push(ke(e,o,s,this.fonts).then(e=>void this.map.addImage(r,e,{pixelRatio:t})).catch(e=>console.log(e))),n.set(e,r)}return r}settledImages(){let e=this.promises;return this.promises=[],Promise.allSettled(e).then(()=>void 0,()=>void 0)}getFillPatterns(e){let t=this.keyCache.get(e);return t?Array.from(t.entries()).map(([e,t])=>({name:t,string:e})):[]}},We=0,Ge=``,Ke=document.createElement(`canvas`).getContext(`2d`);function qe(e,t,n){let r=0,i=0,a=0,o=0,s=`${t.style} ${t.weight} ${n}px ${t.cssFamily}`;if(Ke){(We!==n||Ge!==s)&&(Ke.font=s,Ge=s,We=n),{actualBoundingBoxAscent:a,actualBoundingBoxDescent:o}=Ke.measureText(`█`);for(let t=0;t<e.length;++t){let{actualBoundingBoxLeft:n,actualBoundingBoxRight:i}=Ke.measureText(e[t]);n+i>r&&(r=n+i)}i=(a+o)*e.length}return{width:r,height:i,ascent:a,descent:o}}function Je(e,t,n,r,i){let a=n??t,o=!r,s=a?.match(/\$\{([^}]+)}/)?.[1],c=s?o?O(e[s]):k(e[s]):null,l=s?o?c:typeof c!=`boolean`&&c!==null&&c!==``?r(c):i:a;return l&&!new Ze(l).badValue?l:`#000000`}function Ye(e,t,n){return(n??t)?.split(Me).map((t,n)=>n&1?O(e[t]):t).join(``)||void 0}function Xe(e,t,n){let r=t;if(t){let i=new He(t),a=i.getSvgColors(),o=i.getSvgTexts(),s=n?new Map(new He(n).getSvgColors().map(({name:e,color:t})=>[e,t])):new Map,c=n?new Map(new He(n).getSvgTexts().map(({name:e,text:t})=>[e,t])):new Map,l=a.map(({name:t,color:n})=>({name:t,color:new Ze(Je(e,n?.toString(),s.get(t)?.toString()))})).filter((e,t)=>typeof a[t].color==`string`||!e.color.sameColor(a[t].color)),u=o.map(({name:t,text:n})=>({name:t,text:Ye(e,n,c.get(t))})).filter((e,t)=>e.text!==o[t].text);l.length&&i.setSvgColors(l),u.length&&i.setSvgTexts(u),(l.length||u.length)&&(r=i.getSvgString())}return r}var Ze=class e{_error=!1;_rgba;static fromRGB(t){let n=new e(`transparent`);return n._rgba[0]=t[0],n._rgba[1]=t[1],n._rgba[2]=t[2],n._rgba[3]=t.length>3?t[3]:1,n}constructor(e){e=String(e).trim().toLowerCase();let t=this._rgba=[0,0,0,1],n=e.length,r;if(n===0)this._error=!0;else if(e===`transparent`||e===`none`)t[3]=0;else if(e[0]===`#`)n<6?(t[0]=parseInt(e[1]+e[1],16)||0,t[1]=parseInt(e[2]+e[2],16)||0,t[2]=parseInt(e[3]+e[3],16)||0,n===5&&(t[3]=parseInt(e[4]+e[4],16)/255)):(t[0]=parseInt(e[1]+e[2],16)||0,t[1]=parseInt(e[3]+e[4],16)||0,t[2]=parseInt(e[5]+e[6],16)||0,n>8&&(t[3]=parseInt(e[7]+e[8],16)/255));else if(e in it){let n=it[e];t[0]=n[0],t[1]=n[1],t[2]=n[2]}else if(r=/^(rgba?|hs[lv]a?)\s*\(([^)]*)\)/.exec(e)){let e=r[1].replace(/a$/,``),n=r[2].trim().split(/\s*[,/]\s*|\s+/).map($e,{space:e});e===`rgb`?(t[0]=n[0],t[1]=n[1],t[2]=n[2],n.length>3&&(t[3]=n[3])):e===`hsl`?tt(n,t):e===`hsv`&&nt(n,t)}else this._error=!0}get badValue(){return this._error}get a(){return this._rgba[3]}get hex(){return`#${(Math.round(this._rgba[0])<<16|Math.round(this._rgba[1])<<8|Math.round(this._rgba[2])).toString(16).padStart(6,`0`)}`}get rgba(){return this._rgba.slice()}sameColor(e){return V(this._rgba[0],e._rgba[0])&&V(this._rgba[1],e._rgba[1])&&V(this._rgba[2],e._rgba[2])&&V(this._rgba[3],e._rgba[3])}toString(){let[e,t,n,r]=this._rgba;return r===1?this.hex:`rgba(${Math.round(e)}, ${Math.round(t)}, ${Math.round(n)}, ${r})`}},Qe={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function $e(e,t){let{space:n}=this;if(e[e.length-1]===`%`){let r=parseFloat(e),i=t<3&&n===`rgb`?255:1,a=t>0&&t<3&&n[0]===`h`?1:100;return(r<0?0:r>100?100:r)/a*i}if(n[t]===`h`||t===2&&n[n.length-1]===`h`){if(e in Qe)return Qe[e];let t=parseFloat(e);switch(!0){case e.endsWith(`turn`):t*=360;break;case e.endsWith(`grad`):t=t*360/400;break;case e.endsWith(`rad`):t=t*180/Math.PI;break}return(t%360+360)%360}if(e===`none`)return 0;{let r=parseFloat(e),i=t<3&&n===`rgb`?255:1;return r<0?0:r>i?i:r}}function et(e,t,n){return n<0&&(n+=1),n>1&&--n,(n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e)*255}function tt(e,t=[0,0,0,1]){let n=e[0]/360,r=e[1]/100,i=e[2]/100;if(r===0)t[2]=t[1]=t[0]=i*255;else{let e=i<.5?i*(1+r):i+r-i*r,a=2*i-e;t[0]=et(a,e,n+1/3),t[1]=et(a,e,n),t[2]=et(a,e,n-1/3)}return e.length>3&&(t[3]=e[3]),t}function nt(e,t=[0,0,0,1]){let n=e[0]/60,r=e[1]/100,i=e[2]/100*255,a=Math.floor(n),o=n-a,s=i*(1-r),c=i*(1-o*r),l=i*(1-(1-o)*r);switch(a%6){case 0:t[0]=i,t[1]=l,t[2]=s;break;case 1:t[0]=c,t[1]=i,t[2]=s;break;case 2:t[0]=s,t[1]=i,t[2]=l;break;case 3:t[0]=s,t[1]=c,t[2]=i;break;case 4:t[0]=l,t[1]=s,t[2]=i;break;case 5:t[0]=i,t[1]=s,t[2]=c;break}return e.length>3&&(t[3]=e[3]),t}function rt(e){let t=new Ze(e).rgba;return{color:`rgb(${Math.round(t[0])}, ${Math.round(t[1])}, ${Math.round(t[2])})`,opacity:t[3]}}function H(e,t=`fill`){if(e.trim().toLowerCase()===`none`)return`${t}="none"`;if(new Ze(e).badValue)return`${t}="${B(e)}"`;let{color:n,opacity:r}=rt(e);return`${t}="${n}" ${t===`stop-color`?`stop-opacity`:`${t}-opacity`}="${r}"`}var it={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function at(e,t,n,r){let{title:i=``,titleFontColor:a=`#000000`,titleFontSize:o=24,entries:s,entryFontColor:c=`#000000`,entryFontSize:l=13,entryShape:u=`rectangle`,layout:d=`vertical`,background:f=`#ffffff`,showBackground:p=!1}=e,m=r.resolve(e.titleFont??t),h=r.resolve(e.entryFont??t),g=qe([i],m,o),_=s.map(e=>qe([e.label],h,l)),v=i.trim().length>0,y,b;d===`vertical`?(y=Math.max(g.width,..._.map(e=>e.width+15+10))+30,b=30+(v?g.height+20:0)+_.reduce((e,t)=>e+t.height,0)+Math.max(_.length-1,0)*20):(y=Math.max(g.width+30,30+_.reduce((e,t)=>e+t.width+15+10,0)+Math.max(_.length-1,0)*20),b=30+(v?g.height+20:0)+Math.max(0,..._.map(e=>e.height)));let x=[];p&&x.push(`
|
|
16
|
+
<rect
|
|
17
|
+
x="0"
|
|
18
|
+
y="0"
|
|
19
|
+
rx="10"
|
|
20
|
+
ry="10"
|
|
21
|
+
width="${y}"
|
|
22
|
+
height="${b}"
|
|
23
|
+
${H(f)}
|
|
24
|
+
/>
|
|
25
|
+
`);let S=15,C=15;v&&(x.push(`
|
|
26
|
+
<text
|
|
27
|
+
x="${S}"
|
|
28
|
+
y="${C+g.ascent}"
|
|
29
|
+
${we(m)}
|
|
30
|
+
font-size="${o}"
|
|
31
|
+
${H(a)}
|
|
32
|
+
>
|
|
33
|
+
${B(i)}
|
|
34
|
+
</text>
|
|
35
|
+
`),C+=g.height+20);for(let e=0;e<s.length;e++){let t=s[e],n=_[e];if(u===`rectangle`)x.push(`
|
|
36
|
+
<rect
|
|
37
|
+
x="${S}"
|
|
38
|
+
y="${C+n.height/2-15/2}"
|
|
39
|
+
rx="2"
|
|
40
|
+
ry="2"
|
|
41
|
+
width="15"
|
|
42
|
+
height="15"
|
|
43
|
+
${H(t.color)}
|
|
44
|
+
/>
|
|
45
|
+
`);else if(u===`circle`)x.push(`
|
|
46
|
+
<circle
|
|
47
|
+
cx="${S+15/2}"
|
|
48
|
+
cy="${C+n.height/2}"
|
|
49
|
+
r="${15/2}"
|
|
50
|
+
${H(t.color)}
|
|
51
|
+
/>
|
|
52
|
+
`);else if(u===`line`)x.push(`
|
|
53
|
+
<line
|
|
54
|
+
x1="${S}"
|
|
55
|
+
y1="${C+n.height/2}"
|
|
56
|
+
x2="${S+15}"
|
|
57
|
+
y2="${C+n.height/2}"
|
|
58
|
+
${H(t.color,`stroke`)}
|
|
59
|
+
stroke-width="2"
|
|
60
|
+
stroke-linecap="round"
|
|
61
|
+
/>
|
|
62
|
+
`);else if(u===`icon`&&t.svg.length>0){let e=new DOMParser().parseFromString(t.svg,`image/svg+xml`).querySelector(`svg`);e&&(e.setAttribute(`width`,`15`),e.setAttribute(`height`,`15`),e.setAttribute(`transform`,`translate(${S}, ${C+n.height/2-15/2})`),x.push(e.outerHTML))}x.push(`
|
|
63
|
+
<text
|
|
64
|
+
x="${S+15+10}"
|
|
65
|
+
y="${C+n.ascent}"
|
|
66
|
+
${we(h)}
|
|
67
|
+
font-size="${l}"
|
|
68
|
+
${H(c)}
|
|
69
|
+
>
|
|
70
|
+
${B(t.label)}
|
|
71
|
+
</text>
|
|
72
|
+
`),d===`vertical`?C+=n.height+20:S+=n.width+15+10+20}return`
|
|
73
|
+
<svg
|
|
74
|
+
class="adornment-svg"
|
|
75
|
+
data-adornment-name="${B(e.name)}"
|
|
76
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
77
|
+
width="${y*n}"
|
|
78
|
+
height="${b*n}"
|
|
79
|
+
viewBox="0 0 ${y} ${b}"
|
|
80
|
+
>
|
|
81
|
+
${x.join(``)}
|
|
82
|
+
</svg>
|
|
83
|
+
`}function ot(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function st(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ct(e){let t,n,r;e.length===2?(t=e===ot||e===st?e:lt,n=e,r=e):(t=ot,n=(t,n)=>ot(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}function a(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}function o(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function lt(){return 0}function ut(e){return e===null?NaN:+e}var dt=ct(ot),ft=dt.right;dt.left,ct(ut).center;function pt(e,t){let n,r;if(t===void 0)for(let t of e)t!=null&&(n===void 0?t>=t&&(n=r=t):(n>t&&(n=t),r<t&&(r=t)));else{let i=-1;for(let a of e)(a=t(a,++i,e))!=null&&(n===void 0?a>=a&&(n=r=a):(n>a&&(n=a),r<a&&(r=a)))}return[n,r]}var mt=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let t=this._partials,n=0;for(let r=0;r<this._n&&r<32;r++){let i=t[r],a=e+i,o=Math.abs(e)<Math.abs(i)?e-(a-i):i-(a-e);o&&(t[n++]=o),e=a}return t[n]=e,this._n=n+1,this}valueOf(){let e=this._partials,t=this._n,n,r,i,a=0;if(t>0){for(a=e[--t];t>0&&(n=a,r=e[--t],a=n+r,i=r-(a-n),!i););t>0&&(i<0&&e[t-1]<0||i>0&&e[t-1]>0)&&(r=i*2,n=a+r,r==n-a&&(a=n))}return a}},ht=class extends Map{constructor(e,t=yt){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(gt(this,e))}has(e){return super.has(gt(this,e))}set(e,t){return super.set(_t(this,e),t)}delete(e){return super.delete(vt(this,e))}};function gt({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function _t({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function vt({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function yt(e){return typeof e==`object`&&e?e.valueOf():e}var bt=Math.sqrt(50),xt=Math.sqrt(10),St=Math.sqrt(2);function Ct(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=bt?10:a>=xt?5:a>=St?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/l<e&&++s,c/l>t&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*l<e&&++s,c*l>t&&--c),c<s&&.5<=n&&n<2?Ct(e,t,n*2):[s,c,l]}function wt(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?Ct(t,e,n):Ct(e,t,n);if(!(a>=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e<s;++e)c[e]=(a-e)/-o;else for(let e=0;e<s;++e)c[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)c[e]=(i+e)/-o;else for(let e=0;e<s;++e)c[e]=(i+e)*o;return c}function Tt(e,t,n){return t=+t,e=+e,n=+n,Ct(e,t,n)[2]}function Et(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?Tt(t,e,n):Tt(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function Dt(e,t,n=ut){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function*Ot(e){for(let t of e)yield*t}function kt(e){return Array.from(Ot(e))}function At(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}function jt(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function Mt(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Nt(e){return e=Mt(Math.abs(e)),e?e[1]:NaN}function Pt(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function Ft(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var It=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Lt(e){if(!(t=It.exec(e)))throw Error(`invalid format: `+e);var t;return new Rt({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Lt.prototype=Rt.prototype;function Rt(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}Rt.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function zt(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Bt;function Vt(e,t){var n=Mt(e,t);if(!n)return Bt=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(Bt=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+Mt(e,Math.max(0,t+a-1))[0]}function Ht(e,t){var n=Mt(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var Ut={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:jt,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Ht(e*100,t),r:Ht,s:Vt,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Wt(e){return e}var Gt=Array.prototype.map,Kt=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function qt(e){var t=e.grouping===void 0||e.thousands===void 0?Wt:Pt(Gt.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?Wt:Ft(Gt.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=Lt(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):Ut[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=Ut[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=zt(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&Bt!==void 0?Kt[8+Bt/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T<h?Array(h-T+1).join(u):``;switch(g&&m&&(e=t(E+e,E.length?h-r.length:1/0),E=``),d){case`<`:e=n+e+r+E;break;case`=`:e=n+E+e+r;break;case`^`:e=E.slice(0,T=E.length>>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(Nt(t)/3)))*3,r=10**-n,i=l((e=Lt(e),e.type=`f`,e),{suffix:Kt[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var Jt,Yt,Xt;Zt({thousands:`,`,grouping:[3],currency:[`$`,``]});function Zt(e){return Jt=qt(e),Yt=Jt.format,Xt=Jt.formatPrefix,Jt}function Qt(e){return Math.max(0,-Nt(Math.abs(e)))}function $t(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Nt(t)/3)))*3-Nt(Math.abs(e)))}function en(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Nt(t)-Nt(e))+1}function tn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function nn(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function rn(){}var an=.7,on=1/an,sn=`\\s*([+-]?\\d+)\\s*`,cn=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,ln=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,un=/^#([0-9a-f]{3,8})$/,dn=RegExp(`^rgb\\(${sn},${sn},${sn}\\)$`),fn=RegExp(`^rgb\\(${ln},${ln},${ln}\\)$`),pn=RegExp(`^rgba\\(${sn},${sn},${sn},${cn}\\)$`),mn=RegExp(`^rgba\\(${ln},${ln},${ln},${cn}\\)$`),hn=RegExp(`^hsl\\(${cn},${ln},${ln}\\)$`),gn=RegExp(`^hsla\\(${cn},${ln},${ln},${cn}\\)$`),_n={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};tn(rn,Sn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:vn,formatHex:vn,formatHex8:yn,formatHsl:bn,formatRgb:xn,toString:xn});function vn(){return this.rgb().formatHex()}function yn(){return this.rgb().formatHex8()}function bn(){return Pn(this).formatHsl()}function xn(){return this.rgb().formatRgb()}function Sn(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=un.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Cn(t):n===3?new U(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?wn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?wn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=dn.exec(e))?new U(t[1],t[2],t[3],1):(t=fn.exec(e))?new U(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=pn.exec(e))?wn(t[1],t[2],t[3],t[4]):(t=mn.exec(e))?wn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=hn.exec(e))?Nn(t[1],t[2]/100,t[3]/100,1):(t=gn.exec(e))?Nn(t[1],t[2]/100,t[3]/100,t[4]):_n.hasOwnProperty(e)?Cn(_n[e]):e===`transparent`?new U(NaN,NaN,NaN,0):null}function Cn(e){return new U(e>>16&255,e>>8&255,e&255,1)}function wn(e,t,n,r){return r<=0&&(e=t=n=NaN),new U(e,t,n,r)}function Tn(e){return e instanceof rn||(e=Sn(e)),e?(e=e.rgb(),new U(e.r,e.g,e.b,e.opacity)):new U}function En(e,t,n,r){return arguments.length===1?Tn(e):new U(e,t,n,r??1)}function U(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}tn(U,En,nn(rn,{brighter(e){return e=e==null?on:on**+e,new U(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?an:an**+e,new U(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new U(jn(this.r),jn(this.g),jn(this.b),An(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Dn,formatHex:Dn,formatHex8:On,formatRgb:kn,toString:kn}));function Dn(){return`#${Mn(this.r)}${Mn(this.g)}${Mn(this.b)}`}function On(){return`#${Mn(this.r)}${Mn(this.g)}${Mn(this.b)}${Mn((isNaN(this.opacity)?1:this.opacity)*255)}`}function kn(){let e=An(this.opacity);return`${e===1?`rgb(`:`rgba(`}${jn(this.r)}, ${jn(this.g)}, ${jn(this.b)}${e===1?`)`:`, ${e})`}`}function An(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function jn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mn(e){return e=jn(e),(e<16?`0`:``)+e.toString(16)}function Nn(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new In(e,t,n,r)}function Pn(e){if(e instanceof In)return new In(e.h,e.s,e.l,e.opacity);if(e instanceof rn||(e=Sn(e)),!e)return new In;if(e instanceof In)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new In(o,s,c,e.opacity)}function Fn(e,t,n,r){return arguments.length===1?Pn(e):new In(e,t,n,r??1)}function In(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}tn(In,Fn,nn(rn,{brighter(e){return e=e==null?on:on**+e,new In(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?an:an**+e,new In(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new U(zn(e>=240?e-240:e+120,i,r),zn(e,i,r),zn(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new In(Ln(this.h),Rn(this.s),Rn(this.l),An(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=An(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Ln(this.h)}, ${Rn(this.s)*100}%, ${Rn(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Ln(e){return e=(e||0)%360,e<0?e+360:e}function Rn(e){return Math.max(0,Math.min(1,e||0))}function zn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Bn=Math.PI/180,Vn=180/Math.PI,Hn=18,Un=.96422,Wn=1,Gn=.82521,Kn=4/29,qn=6/29,Jn=3*qn*qn,Yn=qn*qn*qn;function Xn(e){if(e instanceof Qn)return new Qn(e.l,e.a,e.b,e.opacity);if(e instanceof ar)return or(e);e instanceof U||(e=Tn(e));var t=nr(e.r),n=nr(e.g),r=nr(e.b),i=$n((.2225045*t+.7168786*n+.0606169*r)/Wn),a,o;return t===n&&n===r?a=o=i:(a=$n((.4360747*t+.3850649*n+.1430804*r)/Un),o=$n((.0139322*t+.0971045*n+.7141733*r)/Gn)),new Qn(116*i-16,500*(a-i),200*(i-o),e.opacity)}function Zn(e,t,n,r){return arguments.length===1?Xn(e):new Qn(e,t,n,r??1)}function Qn(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}tn(Qn,Zn,nn(rn,{brighter(e){return new Qn(this.l+Hn*(e??1),this.a,this.b,this.opacity)},darker(e){return new Qn(this.l-Hn*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=Un*er(t),e=Wn*er(e),n=Gn*er(n),new U(tr(3.1338561*t-1.6168667*e-.4906146*n),tr(-.9787684*t+1.9161415*e+.033454*n),tr(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function $n(e){return e>Yn?e**(1/3):e/Jn+Kn}function er(e){return e>qn?e*e*e:Jn*(e-Kn)}function tr(e){return 255*(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055)}function nr(e){return(e/=255)<=.04045?e/12.92:((e+.055)/1.055)**2.4}function rr(e){if(e instanceof ar)return new ar(e.h,e.c,e.l,e.opacity);if(e instanceof Qn||(e=Xn(e)),e.a===0&&e.b===0)return new ar(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*Vn;return new ar(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function ir(e,t,n,r){return arguments.length===1?rr(e):new ar(e,t,n,r??1)}function ar(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function or(e){if(isNaN(e.h))return new Qn(e.l,0,0,e.opacity);var t=e.h*Bn;return new Qn(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}tn(ar,ir,nn(rn,{brighter(e){return new ar(this.h,this.c,this.l+Hn*(e??1),this.opacity)},darker(e){return new ar(this.h,this.c,this.l-Hn*(e??1),this.opacity)},rgb(){return or(this).rgb()}}));var sr=e=>()=>e;function cr(e,t){return function(n){return e+n*t}}function lr(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function ur(e,t){var n=t-e;return n?cr(e,n>180||n<-180?n-360*Math.round(n/360):n):sr(isNaN(e)?t:e)}function dr(e){return(e=+e)==1?fr:function(t,n){return n-t?lr(t,n,e):sr(isNaN(t)?n:t)}}function fr(e,t){var n=t-e;return n?cr(e,n):sr(isNaN(e)?t:e)}var pr=(function e(t){var n=dr(t);function r(e,t){var r=n((e=En(e)).r,(t=En(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=fr(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function mr(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function hr(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function gr(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=Tr(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function _r(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function vr(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function yr(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=Tr(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var br=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xr=new RegExp(br.source,`g`);function Sr(e){return function(){return e}}function Cr(e){return function(t){return e(t)+``}}function wr(e,t){var n=br.lastIndex=xr.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=br.exec(e))&&(i=xr.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:vr(r,i)})),n=xr.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?Cr(c[0].x):Sr(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function Tr(e,t){var n=typeof t,r;return t==null||n===`boolean`?sr(t):(n===`number`?vr:n===`string`?(r=Sn(t))?(t=r,pr):wr:t instanceof Sn?pr:t instanceof Date?_r:hr(t)?mr:Array.isArray(t)?gr:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?yr:vr)(e,t)}function Er(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function Dr(e){return function(t,n){var r=e((t=ir(t)).h,(n=ir(n)).h),i=fr(t.c,n.c),a=fr(t.l,n.l),o=fr(t.opacity,n.opacity);return function(e){return t.h=r(e),t.c=i(e),t.l=a(e),t.opacity=o(e),t+``}}}var Or=Dr(ur);function kr(e,t){t===void 0&&(t=e,e=Tr);for(var n=0,r=t.length-1,i=t[0],a=Array(r<0?0:r);n<r;)a[n]=e(i,i=t[++n]);return function(e){var t=Math.max(0,Math.min(r-1,Math.floor(e*=r)));return a[t](e-t)}}function Ar(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}function jr(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}var Mr=Symbol(`implicit`);function Nr(){var e=new ht,t=[],n=[],r=Mr;function i(i){let a=e.get(i);if(a===void 0){if(r!==Mr)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new ht;for(let r of n)e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return Nr(t,n).unknown(r)},jr.apply(i,arguments),i}function Pr(e){return function(){return e}}function Fr(e){return+e}var Ir=[0,1];function Lr(e){return e}function Rr(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:Pr(isNaN(t)?NaN:.5)}function zr(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function Br(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=Rr(i,r),a=n(o,a)):(r=Rr(r,i),a=n(a,o)),function(e){return a(r(e))}}function Vr(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=Rr(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=ft(e,t,1,r)-1;return a[n](i[n](t))}}function Hr(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Ur(){var e=Ir,t=Ir,n=Tr,r,i,a,o=Lr,s,c,l;function u(){var n=Math.min(e.length,t.length);return o!==Lr&&(o=zr(e[0],e[n-1])),s=n>2?Vr:Br,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),vr))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,Fr),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=Er,u()},d.clamp=function(e){return arguments.length?(o=e?!0:Lr,u()):o!==Lr},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function Wr(){return Ur()(Lr,Lr)}function Gr(e,t,n,r){var i=Et(e,t,n),a;switch(r=Lt(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=$t(i,o))&&(r.precision=a),Xt(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=en(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=Qt(i))&&(r.precision=a-(r.type===`%`)*2);break}return Yt(r)}function Kr(e){var t=e.domain;return e.ticks=function(e){var n=t();return wt(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return Gr(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s<o&&(l=o,o=s,s=l,l=i,i=a,a=l);u-- >0;){if(l=Tt(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function qr(){var e=Wr();return e.copy=function(){return Hr(e,qr())},jr.apply(e,arguments),Kr(e)}function Jr(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r<i;)n[r-1]=Dt(e,r/i);return a}function a(e){return e==null||isNaN(e=+e)?r:t[ft(n,e)]}return a.invertExtent=function(r){var i=t.indexOf(r);return i<0?[NaN,NaN]:[i>0?n[i-1]:e[0],i<n.length?n[i]:e[e.length-1]]},a.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let n of t)n!=null&&!isNaN(n=+n)&&e.push(n);return e.sort(ot),i()},a.range=function(e){return arguments.length?(t=Array.from(e),i()):t.slice()},a.unknown=function(e){return arguments.length?(r=e,a):r},a.quantiles=function(){return n.slice()},a.copy=function(){return Jr().domain(e).range(t).unknown(r)},jr.apply(a,arguments)}function Yr(){var e=0,t=1,n=1,r=[.5],i=[0,1],a;function o(e){return e!=null&&e<=e?i[ft(r,e,0,n)]:a}function s(){var i=-1;for(r=Array(n);++i<n;)r[i]=((i+1)*t-(i-n)*e)/(n+1);return o}return o.domain=function(n){return arguments.length?([e,t]=n,e=+e,t=+t,s()):[e,t]},o.range=function(e){return arguments.length?(n=(i=Array.from(e)).length-1,s()):i.slice()},o.invertExtent=function(a){var o=i.indexOf(a);return o<0?[NaN,NaN]:o<1?[e,r[0]]:o>=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return Yr().domain([e,t]).range(i).unknown(a)},jr.apply(Kr(o),arguments)}var Xr=6371008.8;Xr*100,Xr*100,360/(2*Math.PI),Xr*3.28084,Xr*39.37,Xr/1e3,Xr/1e3,Xr/1609.344,Xr*1e3,Xr*1e3,Xr/1852,Xr*1.0936;function Zr(e,t,n={}){let r={type:`Feature`};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}function Qr(e,t,n={}){for(let t of e){if(t.length<4)throw Error(`Each LinearRing of a Polygon must have 4 or more Positions.`);if(t[t.length-1].length!==t[0].length)throw Error(`First and last Position are not equivalent.`);for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw Error(`First and last Position are not equivalent.`)}return Zr({type:`Polygon`,coordinates:e},t,n)}function $r(e,t,n={}){if(e.length<2)throw Error(`coordinates must be an array of two or more positions`);return Zr({type:`LineString`,coordinates:e},t,n)}function ei(e,t={}){let n={type:`FeatureCollection`};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}function ti(e,t,n={}){return Zr({type:`MultiLineString`,coordinates:e},t,n)}function ni(e,t,n={}){return Zr({type:`MultiPolygon`,coordinates:e},t,n)}function ri(e,t,n){if(e!==null)for(var r,i,a,o,s,c,l,u=0,d=0,f,p=e.type,m=p===`FeatureCollection`,h=p===`Feature`,g=m?e.features.length:1,_=0;_<g;_++){l=m?e.features[_].geometry:h?e.geometry:e,f=l?l.type===`GeometryCollection`:!1,s=f?l.geometries.length:1;for(var v=0;v<s;v++){var y=0,b=0;if(o=f?l.geometries[v]:l,o!==null){c=o.coordinates;var x=o.type;switch(u=n&&(x===`Polygon`||x===`MultiPolygon`)?1:0,x){case null:break;case`Point`:if(t(c,d,_,y,b)===!1)return!1;d++,y++;break;case`LineString`:case`MultiPoint`:for(r=0;r<c.length;r++){if(t(c[r],d,_,y,b)===!1)return!1;d++,x===`MultiPoint`&&y++}x===`LineString`&&y++;break;case`Polygon`:case`MultiLineString`:for(r=0;r<c.length;r++){for(i=0;i<c[r].length-u;i++){if(t(c[r][i],d,_,y,b)===!1)return!1;d++}x===`MultiLineString`&&y++,x===`Polygon`&&b++}x===`Polygon`&&y++;break;case`MultiPolygon`:for(r=0;r<c.length;r++){for(b=0,i=0;i<c[r].length;i++){for(a=0;a<c[r][i].length-u;a++){if(t(c[r][i][a],d,_,y,b)===!1)return!1;d++}b++}y++}break;case`GeometryCollection`:for(r=0;r<o.geometries.length;r++)if(ri(o.geometries[r],t,n)===!1)return!1;break;default:throw Error(`Unknown Geometry Type`)}}}}}function ii(e,t){var n,r,i,a,o,s,c,l,u,d,f=0,p=e.type===`FeatureCollection`,m=e.type===`Feature`,h=p?e.features.length:1;for(n=0;n<h;n++){for(s=p?e.features[n].geometry:m?e.geometry:e,l=p?e.features[n].properties:m?e.properties:{},u=p?e.features[n].bbox:m?e.bbox:void 0,d=p?e.features[n].id:m?e.id:void 0,c=s?s.type===`GeometryCollection`:!1,o=c?s.geometries.length:1,i=0;i<o;i++){if(a=c?s.geometries[i]:s,a===null){if(t(null,f,l,u,d)===!1)return!1;continue}switch(a.type){case`Point`:case`LineString`:case`MultiPoint`:case`Polygon`:case`MultiLineString`:case`MultiPolygon`:if(t(a,f,l,u,d)===!1)return!1;break;case`GeometryCollection`:for(r=0;r<a.geometries.length;r++)if(t(a.geometries[r],f,l,u,d)===!1)return!1;break;default:throw Error(`Unknown Geometry Type`)}}f++}}function ai(e,t,n){var r=n;return ii(e,function(e,i,a,o,s){r=i===0&&n===void 0?e:t(r,e,i,a,o,s)}),r}function oi(e,t){t||={},t.iterations=t.iterations||1;let{iterations:n}=t,r=[];if(!e)throw Error(`inputPolys is required`);return ii(e,function(e,t,i){if(e.type===`Polygon`){let t=[[]];for(let r=0;r<n;r++){let n=[],i=e;r>0&&(i=Qr(t).geometry),si(i,n),t=n.slice(0)}r.push(Qr(t,i))}else if(e.type===`MultiPolygon`){let t=[[[]]];for(let r=0;r<n;r++){let n=[],i=e;r>0&&(i=ni(t).geometry),ci(i,n),t=n.slice(0)}r.push(ni(t,i))}else throw Error(`geometry is invalid, must be Polygon or MultiPolygon`)}),ei(r)}function si(e,t){var n,r;ri(e,function(e,i,a,o,s){if(r!==s)t.push([]);else{var c=n[0],l=n[1],u=e[0],d=e[1];t[s].push([.75*c+.25*u,.75*l+.25*d]),t[s].push([.25*c+.75*u,.25*l+.75*d])}n=e,r=s},!1),t.forEach(function(e){e.push(e[0])})}function ci(e,t){let n,r,i;ri(e,function(e,a,o,s,c){if(r!==s)t.push([[]]);else if(i!==c)t[s].push([]);else{var l=n[0],u=n[1],d=e[0],f=e[1];t[s][c].push([.75*l+.25*d,.75*u+.25*f]),t[s][c].push([.25*l+.75*d,.25*u+.75*f])}n=e,r=s,i=c},!1),t.forEach(function(e){e.forEach(function(e){e.push(e[0])})})}function li(e){return e.type===`Feature`?e.geometry:e}function ui(e,t,n){var r=e.length,i=pi(e[0],t),a=[],o,s,c;let l,u;for(n||=[],o=1;o<r;o++){for(l=e[o-1],u=e[o],s=c=pi(u,t);;)if(!(i|s)){a.push(l),s===c?o===r-1&&a.push(u):(a.push(u),o<r-1&&(n.push(a),a=[]));break}else if(i&s)break;else i?(l=fi(l,u,i,t),i=pi(l,t)):(u=fi(l,u,s,t),s=pi(u,t));i=c}return a.length&&n.push(a),n}function di(e,t){var n,r,i,a,o,s,c;for(r=1;r<=8;r*=2){for(n=[],i=e[e.length-1],a=!(pi(i,t)&r),o=0;o<e.length;o++)s=e[o],c=!(pi(s,t)&r),c!==a&&n.push(fi(i,s,r,t)),c&&n.push(s),i=s,a=c;if(e=n,!e.length)break}return n}function fi(e,t,n,r){return n&8?[e[0]+(t[0]-e[0])*(r[3]-e[1])/(t[1]-e[1]),r[3]]:n&4?[e[0]+(t[0]-e[0])*(r[1]-e[1])/(t[1]-e[1]),r[1]]:n&2?[r[2],e[1]+(t[1]-e[1])*(r[2]-e[0])/(t[0]-e[0])]:n&1?[r[0],e[1]+(t[1]-e[1])*(r[0]-e[0])/(t[0]-e[0])]:null}function pi(e,t){var n=0;return e[0]<t[0]?n|=1:e[0]>t[2]&&(n|=2),e[1]<t[1]?n|=4:e[1]>t[3]&&(n|=8),n}function mi(e,t){let n=li(e),r=n.type,i=e.type===`Feature`?e.properties:{},a=n.coordinates;switch(r){case`LineString`:case`MultiLineString`:{let e=[];return r===`LineString`&&(a=[a]),a.forEach(n=>{ui(n,t,e)}),e.length===1?$r(e[0],i):ti(e,i)}case`Polygon`:return Qr(hi(a,t),i);case`MultiPolygon`:return ni(a.map(e=>hi(e,t)),i);default:throw Error(`geometry `+r+` not supported`)}}function hi(e,t){let n=[];for(let r of e){let e=di(r,t);e.length>0&&((e[0][0]!==e[e.length-1][0]||e[0][1]!==e[e.length-1][1])&&e.push(e[0]),e.length>=4&&n.push(e))}return n}var gi=mi;function _i(e,t){let n=[],r=Math.PI*2/100;for(let i=0;i<100;i++)n.push(yi(e,t,i*r));if(bi(e,t)){let e=n[0],t=n[n.length-1],r=(t[0]+e[0]-360)/2,i=(e[1]+t[1])/2;n.push([r,i]),n.push([r,90]),n.push([r+360,90]),n.push([r+360,i])}if(xi(e,t)){let e=n[49],t=n[50],r=(t[0]+e[0]-360)/2,i=(e[1]+t[1])/2;n.splice(50,0,[r+360,i],[r+360,-90],[r,-90],[r,i])}return n.push(n[0]),n}function vi(e,t,n){let r=[],i=t/100;for(let t=0;t<=100;t++)r.push(yi(e,t*i,C(n)));return gi($r(r),[-1/0,-85.051129,1/0,85.051129]).geometry.coordinates}function yi(e,t,n){let r=t/6378.1,i=C(e.lng),a=C(e.lat),o=Math.asin(Math.sin(a)*Math.cos(r)+Math.cos(a)*Math.sin(r)*Math.cos(n));return[w(i+Math.atan2(Math.sin(n)*Math.sin(r)*Math.cos(a),Math.cos(r)-Math.sin(a)*Math.sin(o))),w(o)]}function bi(e,t){return T(e,{lng:0,lat:90})/1e3<t}function xi(e,t){return T(e,{lng:0,lat:-90})/1e3<t}function Si(e){let{polygonType:t}=e,n=typeof e.anchorPoints?.[0]?.[0]==`number`?[e.anchorPoints]:e.anchorPoints;return t===`smooth`?oi(Qr(n),{iterations:4}).features?.[0]?.geometry?.coordinates??n.slice():n.slice()}function Ci(e,t){return`${e}-${L(`${t.vectorUrl}/${t.sourceLayerId}`)}`}function wi(e){return`custom-area-${L(e.vectorUrl)}`}function Ti(e,t){return e.reduce((e,n)=>{let r=n.dataBindings?.[t];return typeof r==`object`&&r&&r.t===`n`?e.push(r.v):typeof r==`number`?e.push(r):typeof r==`string`&&r&&e.push(S.test(r)?Number(r):r),e},[])}function Ei(e,t){let n=e.length;if(n<2)return 0;let r=t.projectWithScaleCorrection(e[n-1]),i=t.projectWithScaleCorrection(e[n-2]),a=r.x-i.x,o=i.y-r.y;return(90-180/Math.PI*Math.atan2(o,a)+360)%360}var Di=[[`#EDF8E9`,`#BAE4B3`,`#74C476`,`#31A354`,`#006D2C`],[`#EFF3FF`,`#BDD7E7`,`#6BAED6`,`#3182BD`,`#08519C`],[`#F0F9E8`,`#BAE4BC`,`#7BCCC4`,`#43A2CA`,`#0868AC`],[`#EDF8FB`,`#B3CDE3`,`#8C96C6`,`#8856A7`,`#810F7C`],[`#FEF0D9`,`#FDCC8A`,`#FC8D59`,`#E34A33`,`#B30000`],[`#FEEBE2`,`#FBB4B9`,`#F768A1`,`#C51B8A`,`#7A0177`],[`#D7191C`,`#FDAE61`,`#FFFFBF`,`#ABDDA4`,`#2B83BA`],[`#7B3294`,`#C2A5CF`,`#F7F7F7`,`#A6DBA0`,`#008837`]],Oi=[],ki=[/transparent/,/#[0-9a-fA-F]{3,4}/,/#[0-9a-fA-F]{6}/,/#[0-9a-fA-F]{8}/,/rgba?\(\s*(?:(?:\d{1,3}%?|none)\s*,\s*){2}(?:\d{1,3}%?|none)(?:\s*,\s*(?:0|1|0?\.\d+|\d+%|none))?\s*\)/,/rgba?\(\s*(?:\d{1,3}%?|none)\s+(?:\d{1,3}%?|none)\s+(?:\d{1,3}%?|none)(?:\s*\/\s*(?:0|1|0?\.\d+|\d+%|none))?\s*\)/,/hsla?\(\s*(?:[+-]?\d*\.?\d+(?:deg|grad|rad|turn)?|none)\s*,\s*(?:\d{1,3}%|none)\s*,\s*(?:\d{1,3}%|none)(?:\s*,\s*(?:0|1|0?\.\d+|\d+%|none))?\s*\)/,/hsla?\(\s*(?:[+-]?\d*\.?\d+(?:deg|grad|rad|turn)?|none)\s+(?:\d{1,3}%|none)\s+(?:\d{1,3}%|none)(?:\s*\/\s*(?:0|1|0?\.\d+|\d+%|none))?\s*\)/].map(e=>e.toString().replace(/^\/|\/$/g,``)).join(`|`),Ai=RegExp(`^\\s*(${ki})\\s*$`);function ji(e,t){let[n,r]=pt(e),i=t.length;return At(i).map(e=>n+e*(r-n)/(i-1))}var Mi={linear:(e,t)=>qr(ji(e,t),t).interpolate(Or).nice(4),quantile:(e,t)=>Jr(e,t),quantize:(e,t)=>Yr(pt(e),t).nice(),categorical:(e,t)=>Nr(e,t)};function Ni(e){if(e.choropleth){let t=Pi(e),n=Li(e.fillColor);if(t&&n){let{choropleth:r}=e,i=r.categoricalColors[n],a=r.colorMode===`categorical`?t.map(e=>i.values[e]):Fi(r.lowerColor,r.upperColor,r.colorMode===`linear`?void 0:r.colorCount);return Mi[r.colorMode](t,a)}}}function Pi(e){if(e.choropleth){let t=e.fillColor?.match(/\$\{([^}]+)}/)?.[1];if(t){let n=Ti(Object.values(e.models),t);if(!n.length||n.some(e=>typeof e!=`string`||!Ai.test(e)))return e.choropleth.colorMode===`categorical`?Array.from(new Set(n)):n}}}function Fi(e,t,n){let r=Di.find(n=>n[0]===e&&n[n.length-1]===t)??Oi.find(n=>n[0]===e&&n[n.length-1]===t);return r?Ar(kr(Or,r),n??r.length):Ar(Or(e,t),n??2)}function Ii(e,t){let n=t?Ti(e,t):void 0;return n?.length?n.every(e=>typeof e==`number`)?`number`:n.every(e=>typeof e==`string`&&Ai.test(e))?`color`:`string`:void 0}function Li(e){return e?.match(/\$\{([^}]+)}/)?.[1]}function Ri(e){let t=Object.create(null);for(let n in e){let r=e[n];t[r]=r in t?null:n}return t}function zi(e,t){let n=t?Ii(e,t):void 0;return n!==void 0&&n!==`color`}var Bi=`ArialMT`,W=15;function Vi(e,t,n,r,i){let a=document.createElement(`div`);a.className=`adornment`,e.showBackground&&(a.style.boxShadow=`0 0 7px 0 rgba(33, 37, 41, 0.25)`,a.style.borderRadius=`10px`);let o=Array.from(new Set([e.titleFont??Bi,e.labelFont??Bi]));return{element:a,ready:Promise.all(o.map(e=>r.loadReference(e))).then(()=>{let o=()=>{a.innerHTML=Hi(e,t,n,n.getScale(),r)};o(),i!==`interactive`&&n.on(`resize`,o)})}}function Hi(e,t,n,r,i){let{target:a}=e,o=t.registry?.models?.[a.modelType]?.find(e=>e.id===a.groupId),s=o?.models??[],c=o?.choropleth,l=Li(o?.fillColor);return!c||!l||o.models.every(e=>!(e.visible??!0))||!zi(s,l)?Ui(e):c.colorMode===`categorical`?Ki(e,c,l,r,i):c.colorMode===`linear`?Wi(e,o,n,r,i):c.colorMode===`quantile`||c.colorMode===`quantize`?Gi(e,o,n,r,i):Ui(e)}function Ui(e){return`
|
|
84
|
+
<svg
|
|
85
|
+
class="adornment-svg"
|
|
86
|
+
data-adornment-name="${B(e.name)}"
|
|
87
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
88
|
+
width="0"
|
|
89
|
+
height="0"
|
|
90
|
+
viewBox="0 0 0 0"
|
|
91
|
+
>
|
|
92
|
+
</svg>
|
|
93
|
+
`}function Wi(e,t,n,r,i){let a=15/2,{id:o,layout:s=`vertical`,labelFontSize:c=13,labelFontColor:l=`#000000`,numberFormat:u=`.2~s`,title:d=``,titleFontSize:f=14,titleFontColor:p=`#000000`,showBackground:m=!1,background:h=`#ffffff`}=e,g=i.resolve(e.labelFont??Bi),_=i.resolve(e.titleFont??Bi),v=`gradient-${o}`,y=s===`horizontal`,b=Ni(t);if(b===void 0)return Ui(e);let x=[],[S,C]=pt(b.domain()),w=wt(S,C,4),T=qi(u),E=w.map(e=>T(e)),D=E.map(e=>qe([e],g,c)),O=[];for(let e=0;e<32;e++){let t=e/31;O.push(`<stop offset="${t*100}%" ${H(b(S+t*(C-S)),`stop-color`)} />`)}let k=y?``:`rotate(90)`;x.push(`
|
|
94
|
+
<defs>
|
|
95
|
+
<linearGradient id="${v}" gradientTransform="${k}">
|
|
96
|
+
${O.join(``)}
|
|
97
|
+
</linearGradient>
|
|
98
|
+
</defs>
|
|
99
|
+
`);let A=qe([d],_,f),j=d.trim().length>0,M={width:Math.max(0,...D.map(e=>e.width)),height:Math.max(0,...D.map(e=>e.height)),ascent:Math.max(0,...D.map(e=>e.ascent))},N=j?A.height+10:0,P=j?A.width:0,F=w.length-1,ee=ne(45*F,Math.ceil(y?(M.width+10)*F:(M.height+10)*F),Math.floor(y?n.getContainer().clientWidth/r-10-W*2:n.getContainer().clientHeight/r-10-W*2-N)),re=Math.ceil(y?W*2+Math.max(P,ee):W*2+Math.max(P,25+M.width)),L=Math.ceil(y?W*2+N+20+5+M.ascent:W*2+N+ee);m&&x.push(`
|
|
100
|
+
<rect
|
|
101
|
+
x="0"
|
|
102
|
+
y="0"
|
|
103
|
+
rx="10"
|
|
104
|
+
ry="10"
|
|
105
|
+
width="${re}"
|
|
106
|
+
height="${L}"
|
|
107
|
+
${H(h)}
|
|
108
|
+
/>
|
|
109
|
+
`);let R=W,z=W;j&&(x.push(`
|
|
110
|
+
<text
|
|
111
|
+
x="${R}"
|
|
112
|
+
y="${z+A.ascent}"
|
|
113
|
+
${we(_)}
|
|
114
|
+
font-size="${f}"
|
|
115
|
+
${H(p)}
|
|
116
|
+
>
|
|
117
|
+
${B(d)}
|
|
118
|
+
</text>
|
|
119
|
+
`),z+=A.height+10),x.push(`
|
|
120
|
+
<rect
|
|
121
|
+
x="${R}"
|
|
122
|
+
y="${z}"
|
|
123
|
+
rx="${a}"
|
|
124
|
+
ry="${a}"
|
|
125
|
+
width="${y?ee:15}"
|
|
126
|
+
height="${y?15:ee}"
|
|
127
|
+
fill="url(#${v})"
|
|
128
|
+
/>
|
|
129
|
+
`);for(let e=1;e<w.length-1;e++){let t=w[e],n=E[e],r=D[e],i=I(0,ee,te(S,C,t));i>a&&i<ee-a&&x.push(`
|
|
130
|
+
<line
|
|
131
|
+
x1="${y?Math.floor(R+i)+.5:R}"
|
|
132
|
+
y1="${y?z:Math.floor(z+i)+.5}"
|
|
133
|
+
x2="${y?Math.floor(R+i)+.5:R+20}"
|
|
134
|
+
y2="${y?z+20:Math.floor(z+i)+.5}"
|
|
135
|
+
stroke="#ffffff"
|
|
136
|
+
/>
|
|
137
|
+
`),x.push(`
|
|
138
|
+
<text
|
|
139
|
+
x="${y?R+i:R+20+5}"
|
|
140
|
+
y="${y?z+20+5+r.ascent:z+i-r.descent+r.height/2}"
|
|
141
|
+
${we(g)}
|
|
142
|
+
font-size="${c}"
|
|
143
|
+
${H(l)}
|
|
144
|
+
text-anchor="${y?`middle`:`start`}"
|
|
145
|
+
>
|
|
146
|
+
${B(n)}
|
|
147
|
+
</text>
|
|
148
|
+
`)}return`
|
|
149
|
+
<svg
|
|
150
|
+
class="adornment-svg"
|
|
151
|
+
data-adornment-name="${B(e.name)}"
|
|
152
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
153
|
+
width="${re*r}"
|
|
154
|
+
height="${L*r}"
|
|
155
|
+
viewBox="0 0 ${re} ${L}"
|
|
156
|
+
>
|
|
157
|
+
${x.join(``)}
|
|
158
|
+
</svg>
|
|
159
|
+
`}function Gi(e,t,n,r,i){let a=Ni(t),o=a?.range(),s=[],c=0,l=0;if(a&&o&&o.length>1){let{layout:t=`vertical`,labelFontSize:u=13,labelFontColor:d=`#000000`,labelStyle:f=`range`,numberFormat:p=`.2~s`,title:m=``,titleFontSize:h=14,titleFontColor:g=`#000000`,showBackground:_=!1,background:v=`#ffffff`}=e,y=i.resolve(e.labelFont??Bi),b=i.resolve(e.titleFont??Bi),x=t===`vertical`,S=f===`range`,C=qi(p),w=S?o.map(e=>a.invertExtent(e)).map((e,t,n)=>t===0?`< ${C(e[1])}`:t===n.length-1?`> ${C(e[0])}`:`${C(e[0])} – ${C(e[1])}`):o.map(e=>a.invertExtent(e)).reduce((e,t,n)=>(n&&e.push(C(t[0])),e),[]),T=w.map(e=>qe([e],y,u)),E=qe([m],b,h),D=m.trim().length>0,O={width:Math.max(0,...T.map(e=>e.width)),height:Math.max(0,...T.map(e=>e.height)),ascent:Math.max(0,...T.map(e=>e.ascent))},k=D?E.height+10:0,A=D?E.width:0,j=o.length,M=45,N=15/2;x?(M=ne(M,Math.ceil(O.height)+10,Math.floor((n.getContainer().clientHeight/r-10-W*2-k)/j)),c=Math.ceil(W*2+k+j*M),l=Math.ceil(W*2+Math.max(A,25+O.width))):(M=ne(M,Math.ceil(O.width)+10,Math.floor((n.getContainer().clientWidth/r-10-W*2)/j)),l=Math.ceil(W*2+Math.max(A,j*M)),c=Math.ceil(W*2+k+15+10+O.ascent)),_&&s.push(`
|
|
160
|
+
<rect
|
|
161
|
+
x="0"
|
|
162
|
+
y="0"
|
|
163
|
+
rx="10"
|
|
164
|
+
ry="10"
|
|
165
|
+
width="${l}"
|
|
166
|
+
height="${c}"
|
|
167
|
+
${H(v)}
|
|
168
|
+
/>
|
|
169
|
+
`);let P=W,F=W;D&&(s.push(`
|
|
170
|
+
<text
|
|
171
|
+
x="${P}"
|
|
172
|
+
y="${F+E.ascent}"
|
|
173
|
+
${we(b)}
|
|
174
|
+
font-size="${h}"
|
|
175
|
+
${H(g)}
|
|
176
|
+
>
|
|
177
|
+
${B(m)}
|
|
178
|
+
</text>
|
|
179
|
+
`),F+=k);let ee=x?15:M,I=x?M:15,te=x?0:M,re=x?M:0,L=S?15:20,R=x?`M ${P} ${F+N} v ${M-N} h 15 v ${-(M-N)} a ${N} ${N} 0 0 0 -15 0 z`:`M ${P+N} ${F} h ${M-N} v 15 h ${-(M-N)} a ${N} ${N} 0 0 1 0 -15 z`;s.push(`<path d="${R}" ${H(o[0])} />`),P+=te,F+=re;for(let e=1;e<j-1;e++,P+=te,F+=re)s.push(`
|
|
180
|
+
<rect
|
|
181
|
+
x="${P}"
|
|
182
|
+
y="${F}"
|
|
183
|
+
width="${ee}"
|
|
184
|
+
height="${I}"
|
|
185
|
+
${H(o[e])}
|
|
186
|
+
/>
|
|
187
|
+
`),s.push(`
|
|
188
|
+
<line
|
|
189
|
+
x1="${x?P:P+.5}"
|
|
190
|
+
y1="${x?F+.5:F}"
|
|
191
|
+
x2="${x?P+L:P+.5}"
|
|
192
|
+
y2="${x?F+.5:F+L}"
|
|
193
|
+
stroke="#ffffff"
|
|
194
|
+
/>
|
|
195
|
+
`);let z=x?`M ${P} ${F} v ${M-N} a ${N} ${N} 0 0 0 15 0 v ${-(M-N)} z`:`M ${P} ${F} h ${M-N} a ${N} ${N} 0 0 1 0 15 h ${-(M-N)} z`;s.push(`<path d="${z}" ${H(o[j-1])} />`),s.push(`
|
|
196
|
+
<line
|
|
197
|
+
x1="${x?P:P+.5}"
|
|
198
|
+
y1="${x?F+.5:F}"
|
|
199
|
+
x2="${x?P+L:P+.5}"
|
|
200
|
+
y2="${x?F+.5:F+L}"
|
|
201
|
+
stroke="#ffffff"
|
|
202
|
+
/>
|
|
203
|
+
`),P=W,F=W+k;for(let e=0;e<w.length;e++,P+=te,F+=re)s.push(`
|
|
204
|
+
<text
|
|
205
|
+
x="${x?P+15+10:P+(S?M/2:M)}"
|
|
206
|
+
y="${x?F+(S?M/2:M)-O.height/2+O.ascent:F+15+10+O.ascent}"
|
|
207
|
+
text-anchor="${x?`start`:`middle`}"
|
|
208
|
+
${we(y)}
|
|
209
|
+
font-size="${u}"
|
|
210
|
+
${H(d)}
|
|
211
|
+
>
|
|
212
|
+
${B(w[e])}
|
|
213
|
+
</text>
|
|
214
|
+
`)}return`
|
|
215
|
+
<svg
|
|
216
|
+
class="adornment-svg"
|
|
217
|
+
data-adornment-name="${B(e.name)}"
|
|
218
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
219
|
+
width="${l*r}"
|
|
220
|
+
height="${c*r}"
|
|
221
|
+
viewBox="0 0 ${l} ${c}"
|
|
222
|
+
>
|
|
223
|
+
${s.join(``)}
|
|
224
|
+
</svg>
|
|
225
|
+
`}function Ki(e,t,n,r,i){let a=t.categoricalColors[n];if(a===void 0)return Ui(e);let o=Ri(a.values),s=Object.entries(a.colors).map(([e,n])=>({color:e,label:n.title??o[e]??t.defaultGroupName,order:n.order,hidden:n.hidden,svg:``})).filter(e=>!e.hidden).sort((e,t)=>e.order-t.order);return at({type:`manualLegend`,id:e.id,name:e.name,position:e.position,stacking:e.stacking??`vertical`,layout:e.layout??`vertical`,title:e.title??``,titleFont:e.titleFont??Bi,titleFontColor:e.titleFontColor??`#000000`,titleFontSize:e.titleFontSize??14,entryFont:e.labelFont??Bi,entryFontColor:e.labelFontColor??`#000000`,entryFontSize:e.labelFontSize??13,entryShape:`rectangle`,entries:s,background:e.background??`#ffffff`,showBackground:e.showBackground??!1},Bi,r,i)}function qi(e){let{decimal:t,group:n}=Ji();return qt({decimal:t,thousands:n,grouping:[3],currency:[``,``]}).format(e)}function Ji(){let e=new Intl.NumberFormat(navigator.languages).formatToParts(1000.1),t=e.find(e=>e.type===`decimal`)?.value,n=e.find(e=>e.type===`group`)?.value;return t!==void 0&&n!==void 0?{decimal:t,group:n}:{decimal:`.`,group:`,`}}function Yi(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`,e.showBackground&&(i.style.boxShadow=`0 0 7px 0 rgba(33, 37, 41, 0.25)`,i.style.borderRadius=`10px`);let a=`ArialMT`,o=Array.from(new Set([e.titleFont??a,e.entryFont??a]));return{element:i,ready:Promise.all(o.map(e=>n.loadReference(e))).then(()=>{let o=()=>{i.innerHTML=at(e,a,t.getScale(),n)};o(),r!==`interactive`&&t.on(`resize`,o)})}}function Xi(e,t,n){let r=document.createElement(`div`);r.className=`adornment`;let i=(e.scale??1)*30,a=()=>{let n=i*t.getScale();r.style.cssText=`width: ${n}px; height: ${n}px`,r.innerHTML=Zi(e,t,n)};return a(),t.on(`move`,a),n!==`interactive`&&t.on(`resize`,a),r}function Zi(e,t,n){let r=t.getPitch(),i=t.getBearing(),a=Math.cos(C(r));return`
|
|
226
|
+
<svg class="adornment-svg" data-adornment-name="${B(e.name)}" width="${n}" height="${n}" viewBox="-5 -5 30 30" xmlns="http://www.w3.org/2000/svg">
|
|
227
|
+
<g class="tilt" transform="matrix(1 0 0 ${a} 0 ${10*(1-a)})">
|
|
228
|
+
<g class="rotate" transform="rotate(${-i} 10 10)">
|
|
229
|
+
<path d="M0 20L10 0L20 20L10 12.7711L0 20Z" fill="#343A40" />
|
|
230
|
+
</g>
|
|
231
|
+
</g>
|
|
232
|
+
</svg>
|
|
233
|
+
`}var Qi=`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><mask id="a" fill="#fff"><rect x="8.582" y="1" width="6.42" height="6.42" rx="1.083"/></mask><rect x="8.582" y="1" width="6.42" height="6.42" rx="1.083" stroke="currentColor" stroke-width="2.6" stroke-linejoin="round" mask="url(#a)"/><mask id="b" fill="#fff"><rect x="1" y="1" width="6.42" height="6.42" rx="1.083"/></mask><rect x="1" y="1" width="6.42" height="6.42" rx="1.083" stroke="currentColor" stroke-width="2.6" stroke-linejoin="round" mask="url(#b)"/><mask id="c" fill="#fff"><rect x="8.582" y="8.582" width="6.42" height="6.42" rx="1.083"/></mask><rect x="8.582" y="8.582" width="6.42" height="6.42" rx="1.083" stroke="currentColor" stroke-width="2.6" stroke-linejoin="round" mask="url(#c)"/><mask id="d" fill="#fff"><rect x="1" y="8.582" width="6.42" height="6.42" rx="1.083"/></mask><rect x="1" y="8.582" width="6.42" height="6.42" rx="1.083" stroke="currentColor" stroke-width="2.6" stroke-linejoin="round" mask="url(#d)"/></svg>
|
|
234
|
+
`;function $i(e){let t=document.createElement(`button`);return t.className=e.className,t.innerHTML=`${e.content}`,t.addEventListener(`click`,e.onClick),t}function ea(e,t){return $i({type:`button`,className:`control-button toggle-adornments-button`,content:Qi,onClick:()=>{t.querySelectorAll(`.adornment:not(.web-control)`).forEach(e=>e.classList.toggle(`hide`)),t.querySelector(`.toggle-adornments-button`)?.classList.toggle(`active`),ue(e,`interactive`)}})}var ta=`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="currentColor"><path d="M5.5 1h1v10h-1z"/><path d="M1 6.5v-1h10v1z"/></svg>
|
|
235
|
+
`,na=`<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M11 6.144H1v-1h10v1Z"/></svg>
|
|
236
|
+
`;function ra(e){return $i({type:`button`,className:`control-button zoom-in-button`,content:ta,onClick:()=>e.zoomIn()})}function ia(e){return $i({type:`button`,className:`control-button zoom-out-button`,content:na,onClick:()=>e.zoomOut()})}var aa=`<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M5.571.875V0h.858v.875a5.143 5.143 0 0 1 4.696 4.696H12v.858h-.875a5.143 5.143 0 0 1-4.696 4.696V12H5.57v-.875A5.143 5.143 0 0 1 .875 6.429H0V5.57h.875A5.143 5.143 0 0 1 5.571.875Zm0 .86a4.286 4.286 0 0 0-3.835 3.836h.835v.858h-.835a4.286 4.286 0 0 0 3.835 3.835V9.43h.858v.835a4.285 4.285 0 0 0 3.835-3.835H9.43v-.86h.835A4.285 4.285 0 0 0 6.43 1.736v.835h-.86v-.835Zm-.177 3.659a.857.857 0 1 1 1.212 1.212.857.857 0 0 1-1.212-1.212Z"/></svg>
|
|
237
|
+
`,oa=`<svg width="34" viewBox="5 5 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#a)" fill="#343A40"><path d="M15.016 22.656a5.797 5.797 0 0 1-1.016-.46c-2.858-1.65-3.846-5.338-2.196-8.196 1.65-2.858 5.338-3.846 8.196-2.196 2.858 1.65 3.846 5.338 2.196 8.196-.2.346-.434.673-.694.962l2.933 2.72A10.1 10.1 0 0 0 25.66 22c2.75-4.763 1.103-10.91-3.66-13.66S11.09 7.237 8.34 12 7.237 22.91 12 25.66a9.61 9.61 0 0 0 1.635.748l1.381-3.752Z"/><path d="m11.01 17.183-3.999.06a10.051 10.051 0 0 0 6.427 9.097l1.484-3.714a6.025 6.025 0 0 1-3.913-5.443Zm13.284 5.183 1-1.732-2.598-1.5-1 1.732 2.598 1.5Zm-3.428-10.062 1.5-2.598-1.732-1-1.5 2.598 1.732 1Zm-9.562 2.562 1-1.732-2.598-1.5-1 1.732 2.598 1.5Z"/><path d="m13.366 25.294 1.5-2.598-1.732-1-1.5 2.598 1.732 1Z"/></g><defs><clipPath id="a"><path fill="#fff" d="m33.393 12.607-12 20.784-20.785-12 12-20.784z"/></clipPath></defs></svg>
|
|
238
|
+
`,sa=`<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><g filter="url(#a)"><circle cx="16" cy="16" r="10" fill="#349CF2"/><circle cx="16" cy="16" r="9" stroke="#fff" stroke-width="2"/></g><defs><filter id="a" x="0" y="0" width="32" height="32" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="4"/><feGaussianBlur stdDeviation="2"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/><feBlend in2="BackgroundImageFix" result="effect1_dropShadow_15_3175"/><feBlend in="SourceGraphic" in2="effect1_dropShadow_15_3175" result="shape"/></filter></defs></svg>
|
|
239
|
+
`,ca=(e,t)=>{let n=2*window.devicePixelRatio,r=t.getMapLibreImageKey(sa,n);e.setLayoutProperty(`location-dot`,`icon-image`,r)},la=(e,t)=>{e.getSource(`location-circle`)||e.addSource(`location-circle`,{type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),e.getSource(`location-dot`)||e.addSource(`location-dot`,{type:`geojson`,data:{type:`Feature`,geometry:{type:`Point`,coordinates:[]},properties:{}}}),e.getLayer(`location-circle`)||e.addLayer({id:`location-circle`,type:`fill`,source:`location-circle`,layout:{},paint:{"fill-color":`#349CF2`,"fill-opacity":.15,"fill-outline-color":`#005196`}},`mc-before-names`),e.getLayer(`location-dot`)||e.addLayer({id:`location-dot`,type:`symbol`,source:`location-dot`,layout:{"icon-padding":0},paint:{"icon-opacity":1},metadata:{"mc-name":`location dot`,"mc-skip-load":!0}},`mc-before-names`),ca(e,t)},ua=(e,t,n)=>{let r=e.getSource(`location-dot`);r&&r.setData({type:`Feature`,geometry:{type:`Point`,coordinates:[t,n]},properties:{}})},da=(e,t,n)=>{let r=n/1e3,i=[],a=r/(111.32*Math.cos(t*Math.PI/180)),o=r/110.574;for(let n=0;n<64;n++){let r=n/64*(2*Math.PI),s=a*Math.cos(r),c=o*Math.sin(r);i.push([e+s,t+c])}return i.push(i[0]),{type:`FeatureCollection`,features:[{type:`Feature`,geometry:{type:`Polygon`,coordinates:[i]}}]}},fa=()=>{let e=document.querySelector(`.map`),t=document.createElement(`div`);t.classList.add(`location-notification`),t.textContent=`Geolocation is not available`,e?.appendChild(t),setTimeout(()=>{e?.removeChild(t)},3e3)};function pa(e,t){let n=!1,r=e=>{let t=document.querySelector(`.geolocation-button`),r=t?.querySelector(`.geolocation-icon`),i=t?.querySelector(`.locating-icon`);r&&i&&(r.classList.toggle(`active`,!e),i.classList.toggle(`active`,e)),n=e},i=t=>{let{longitude:n,latitude:i,accuracy:a}=t.coords,o=[n,i];e.easeTo?e.easeTo({center:o,zoom:19,duration:1e3}):e.setCenter&&e.setCenter(o);let s=e.getSource(`location-circle`);s&&s.setData(da(n,i,a/2)),ua(e,n,i),e.once(`moveend`,()=>r(!1))},a=e=>{console.error(`Geolocation error:`,e),r(!1)};return $i({type:`button`,className:`control-button geolocation-button`,content:`
|
|
240
|
+
<div class="location-icon geolocation-icon active">${aa}</div>
|
|
241
|
+
<div class="location-icon locating-icon">${oa}</div>
|
|
242
|
+
`,onClick:()=>{if(!n){if(e.getSource(`location-circle`)||la(e,t),r(!0),!navigator.geolocation){fa(),r(!1);return}navigator.geolocation.getCurrentPosition(i,a,{maximumAge:6e4,timeout:5e3})}}})}var ma=`<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M4.774 6.44a.556.556 0 0 1 .832.734l-.047.052L2.897 9.89h1.436a.555.555 0 0 1 .065 1.107L4.333 11H1.556a.556.556 0 0 1-.552-.49L1 10.443V7.667a.556.556 0 0 1 1.107-.065l.004.065v1.436l2.663-2.662ZM10.444 1a.555.555 0 0 1 .552.49l.004.066v2.777a.556.556 0 0 1-1.107.065l-.004-.065V2.897L7.226 5.559a.556.556 0 0 1-.832-.733l.047-.052L9.103 2.11H7.667a.556.556 0 0 1-.065-1.107L7.667 1h2.777Z"/></svg>
|
|
243
|
+
`;function ha(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}function ga(e){return document.fullscreenElement===e||document.webkitFullscreenElement===e||document.mozFullScreenElement===e||document.msFullscreenElement===e}function _a(e){e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen?e.msRequestFullscreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}function va(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen()}function ya(e){if(ha())ga(e)?va():_a(e);else{let e=document.location.href;e+=e.includes(`?`)?`&`:`?`,e+=`close-tab`,window.open(e,`_blank`)}}function ba(e){return $i({type:`button`,className:`control-button fullscreen-control-button`,content:ma,onClick:()=>ya(e.getContainer())})}var xa=`<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>
|
|
244
|
+
`;function Sa(e,t){return $i({type:`button`,className:`control-button refresh-button`,content:xa,onClick:()=>{e.easeTo({center:t.center,zoom:t.zoom,pitch:t.pitch,bearing:t.rotation})}})}var Ca=`<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>
|
|
245
|
+
`,wa=`<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>
|
|
246
|
+
`,Ta={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 Ea(){let e=navigator.language.replace(`-`,`_`),t=Object.keys(Ta);return t.find(t=>t===e)??t.find(t=>t.split(`_`)[0]===e.split(`_`)[0])??`en_GB`}var Da=Ea();function Oa(e){return Ta[Da][e]??e}var ka=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`,Da.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(`, `)}))}},Aa=class{map;mapContainer;container;control;input;dropdown;inputWrapper;button;isOpen=!1;geocoder=new ka;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=Oa(`search`),this.button.innerHTML=Ca;let e=document.createElement(`button`);e.className=`geocoder-clear`,e.innerHTML=wa;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 ja(){return navigator.userAgent.toLowerCase().indexOf(`mobile`)>=0}function Ma(e,t,n,r,i){let a=document.createElement(`div`);return a.classList.add(`web-control`,`adornment`),Na(e,i).forEach(e=>{let i;if(e===`zoomIn`)i=ra(t);else if(e===`zoomOut`)i=ia(t);else if(e===`fullscreen`)i=ba(t);else if(e===`geolocation`)i=pa(t,n);else if(e===`refresh`)i=Sa(t,r);else if(e===`search`)i=new Aa(t).init();else if(e===`toggleAdornments`)i=ea(t,t.getContainer());else return;a.appendChild(i)}),a}function Na(e,t){let n=e.buttons.flatMap(e=>e===`zoom`?[`zoomIn`,`zoomOut`]:e);if(ja()){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 Pa={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 Fa(e,t,n){let r=document.createElement(`div`);r.className=`adornment`;let i=()=>{r.innerHTML=Ra(t,e,t.getScale(),n)},a=n.loadReference(e.font??`Arial, sans-serif`).then(i);return t.on(`attributionchange`,i),t.on(`zoomend`,i),t.on(`resize`,i),{element:r,ready:a}}function Ia(e){let t=Object.values(e.style.tileManagers),n=[Pa.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(Pa.openStreetMap),r.here&&n.push(Pa.here),n}function La(e,t,n){let r=document.createElement(`span`);r.style.fontFamily=t.cssFamily,r.style.fontWeight=t.weight,r.style.fontStyle=t.style,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 Ra(e,t,n,r){let{color:i=`#000000`,font:a=`Arial, sans-serif`,fontSize:o=10,orientation:s=`horizontal`,position:c}=t,l=r.resolve(a),u=Ia(e),d=La(u.map(({label:e})=>e).join(` `),l,o),f=o*1.2,p=s===`vertical`,m=[`top_left`,`bottom_left`].includes(c),h=p?f:d,g=p?d:f,_=p?m?-90:90:0,v=p?m?.38*o:.3*o:.38*o,y=u.map(e=>`<a href="${e.href}" target="_blank">${e.label}</a>`).join(` `);return`
|
|
247
|
+
<svg
|
|
248
|
+
class="adornment-svg"
|
|
249
|
+
data-adornment-name="${B(t.name)}"
|
|
250
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
251
|
+
viewBox="0 0 ${h} ${g}"
|
|
252
|
+
width="${h*n}"
|
|
253
|
+
height="${g*n}"
|
|
254
|
+
overflow="visible"
|
|
255
|
+
>
|
|
256
|
+
<text
|
|
257
|
+
x="${h/2}"
|
|
258
|
+
y="${g/2+v}"
|
|
259
|
+
transform="rotate(${_} ${h/2} ${g/2})"
|
|
260
|
+
${we(l)}
|
|
261
|
+
font-size="${o}"
|
|
262
|
+
${H(i)}
|
|
263
|
+
text-anchor="middle"
|
|
264
|
+
pointer-events="none"
|
|
265
|
+
>${y}</text>
|
|
266
|
+
</svg>
|
|
267
|
+
`}function za(e){return ai(e,(e,t)=>e+Ba(t),0)}function Ba(e){let t=0,n;switch(e.type){case`Polygon`:return Va(e.coordinates);case`MultiPolygon`:for(n=0;n<e.coordinates.length;n++)t+=Va(e.coordinates[n]);return t;case`Point`:case`MultiPoint`:case`LineString`:case`MultiLineString`:return 0}return 0}function Va(e){let t=0;if(e&&e.length>0){t+=Math.abs(Wa(e[0]));for(let n=1;n<e.length;n++)t-=Math.abs(Wa(e[n]))}return t}var Ha=Xr*Xr/2,Ua=Math.PI/180;function Wa(e){let t=e.length-1;if(t<=2)return 0;let n=0,r=0;for(;r<t;){let i=e[r],a=e[r+1===t?0:r+1],o=e[r+2>=t?(r+2)%t:r+2],s=i[0]*Ua,c=a[1]*Ua,l=o[0]*Ua;n+=(l-s)*Math.sin(c),r++}return n*Ha}function Ga(e){return e}function Ka(e){if(e==null)return Ga;var t,n,r=e.scale[0],i=e.scale[1],a=e.translate[0],o=e.translate[1];return function(e,s){s||(t=n=0);var c=2,l=e.length,u=Array(l);for(u[0]=(t+=e[0])*r+a,u[1]=(n+=e[1])*i+o;c<l;)u[c]=e[c],++c;return u}}function qa(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}function Ja(e,t){return typeof t==`string`&&(t=e.objects[t]),t.type===`GeometryCollection`?{type:`FeatureCollection`,features:t.geometries.map(function(t){return Ya(e,t)})}:Ya(e,t)}function Ya(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,a=Xa(e,t);return n==null&&r==null?{type:`Feature`,properties:i,geometry:a}:r==null?{type:`Feature`,id:n,properties:i,geometry:a}:{type:`Feature`,id:n,bbox:r,properties:i,geometry:a}}function Xa(e,t){var n=Ka(e.transform),r=e.arcs;function i(e,t){t.length&&t.pop();for(var i=r[e<0?~e:e],a=0,o=i.length;a<o;++a)t.push(n(i[a],a));e<0&&qa(t,o)}function a(e){return n(e)}function o(e){for(var t=[],n=0,r=e.length;n<r;++n)i(e[n],t);return t.length<2&&t.push(t[0]),t}function s(e){for(var t=o(e);t.length<4;)t.push(t[0]);return t}function c(e){return e.map(s)}function l(e){var t=e.type,n;switch(t){case`GeometryCollection`:return{type:t,geometries:e.geometries.map(l)};case`Point`:n=a(e.coordinates);break;case`MultiPoint`:n=e.coordinates.map(a);break;case`LineString`:n=o(e.arcs);break;case`MultiLineString`:n=e.arcs.map(o);break;case`Polygon`:n=c(e.arcs);break;case`MultiPolygon`:n=e.arcs.map(c);break;default:return null}return{type:t,coordinates:n}}return l(t)}var Za=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Qa=Math.ceil,$a=Math.floor,eo=`[BigNumber Error] `,to=eo+`Number primitive has more than 15 significant digits: `,no=0x5af3107a4000,G=14,ro=9007199254740991,io=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,0xe8d4a51000,0x9184e72a000],ao=1e7,K=1e9;function oo(e){var t,n,r,i=v.prototype={constructor:v,toString:null,valueOf:null},a=new v(1),o=20,s=4,c=-7,l=21,u=-1e7,d=1e7,f=!1,p=1,m=0,h={prefix:``,groupSize:3,secondaryGroupSize:0,groupSeparator:`,`,decimalSeparator:`.`,fractionGroupSize:0,fractionGroupSeparator:`\xA0`,suffix:``},g=`0123456789abcdefghijklmnopqrstuvwxyz`,_=!0;function v(e,t){var i,a,c,l,f,p,m,h,y=this;if(!(y instanceof v))return new v(e,t);if(t==null){if(e&&e._isBigNumber===!0){y.s=e.s,!e.c||e.e>d?y.c=y.e=null:e.e<u?y.c=[y.e=0]:(y.e=e.e,y.c=e.c.slice());return}if((p=typeof e==`number`)&&e*0==0){if(y.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,f=e;f>=10;f/=10,l++);l>d?y.c=y.e=null:(y.e=l,y.c=[e]);return}h=String(e)}else{if(!Za.test(h=String(e)))return r(y,h,p);y.s=h.charCodeAt(0)==45?(h=h.slice(1),-1):1}(l=h.indexOf(`.`))>-1&&(h=h.replace(`.`,``)),(f=h.search(/e/i))>0?(l<0&&(l=f),l+=+h.slice(f+1),h=h.substring(0,f)):l<0&&(l=h.length)}else{if(q(t,2,g.length,`Base`),t==10&&_)return y=new v(e),S(y,o+y.e+1,s);if(h=String(e),p=typeof e==`number`){if(e*0!=0)return r(y,h,p,t);if(y.s=1/e<0?(h=h.slice(1),-1):1,v.DEBUG&&h.replace(/^0\.0*|\./,``).length>15)throw Error(to+e)}else y.s=h.charCodeAt(0)===45?(h=h.slice(1),-1):1;for(i=g.slice(0,t),l=f=0,m=h.length;f<m;f++)if(i.indexOf(a=h.charAt(f))<0){if(a==`.`){if(f>l){l=m;continue}}else if(!c&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){c=!0,f=-1,l=0;continue}return r(y,String(e),p,t)}p=!1,h=n(h,t,10,y.s),(l=h.indexOf(`.`))>-1?h=h.replace(`.`,``):l=h.length}for(f=0;h.charCodeAt(f)===48;f++);for(m=h.length;h.charCodeAt(--m)===48;);if(h=h.slice(f,++m)){if(m-=f,p&&v.DEBUG&&m>15&&(e>ro||e!==$a(e)))throw Error(to+y.s*e);if((l=l-f-1)>d)y.c=y.e=null;else if(l<u)y.c=[y.e=0];else{if(y.e=l,y.c=[],f=(l+1)%G,l<0&&(f+=G),f<m){for(f&&y.c.push(+h.slice(0,f)),m-=G;f<m;)y.c.push(+h.slice(f,f+=G));f=G-(h=h.slice(f)).length}else f-=m;for(;f--;h+=`0`);y.c.push(+h)}}else y.c=[y.e=0]}v.clone=oo,v.ROUND_UP=0,v.ROUND_DOWN=1,v.ROUND_CEIL=2,v.ROUND_FLOOR=3,v.ROUND_HALF_UP=4,v.ROUND_HALF_DOWN=5,v.ROUND_HALF_EVEN=6,v.ROUND_HALF_CEIL=7,v.ROUND_HALF_FLOOR=8,v.EUCLID=9,v.config=v.set=function(e){var t,n;if(e!=null)if(typeof e==`object`){if(e.hasOwnProperty(t=`DECIMAL_PLACES`)&&(n=e[t],q(n,0,K,t),o=n),e.hasOwnProperty(t=`ROUNDING_MODE`)&&(n=e[t],q(n,0,8,t),s=n),e.hasOwnProperty(t=`EXPONENTIAL_AT`)&&(n=e[t],n&&n.pop?(q(n[0],-K,0,t),q(n[1],0,K,t),c=n[0],l=n[1]):(q(n,-K,K,t),c=-(l=n<0?-n:n))),e.hasOwnProperty(t=`RANGE`))if(n=e[t],n&&n.pop)q(n[0],-K,-1,t),q(n[1],1,K,t),u=n[0],d=n[1];else if(q(n,-K,K,t),n)u=-(d=n<0?-n:n);else throw Error(eo+t+` cannot be zero: `+n);if(e.hasOwnProperty(t=`CRYPTO`))if(n=e[t],n===!!n)if(n)if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=n;else throw f=!n,Error(eo+`crypto unavailable`);else f=n;else throw Error(eo+t+` not true or false: `+n);if(e.hasOwnProperty(t=`MODULO_MODE`)&&(n=e[t],q(n,0,9,t),p=n),e.hasOwnProperty(t=`POW_PRECISION`)&&(n=e[t],q(n,0,K,t),m=n),e.hasOwnProperty(t=`FORMAT`))if(n=e[t],typeof n==`object`)h=n;else throw Error(eo+t+` not an object: `+n);if(e.hasOwnProperty(t=`ALPHABET`))if(n=e[t],typeof n==`string`&&!/^.?$|[+\-.\s]|(.).*\1/.test(n))_=n.slice(0,10)==`0123456789`,g=n;else throw Error(eo+t+` invalid: `+n)}else throw Error(eo+`Object expected: `+e);return{DECIMAL_PLACES:o,ROUNDING_MODE:s,EXPONENTIAL_AT:[c,l],RANGE:[u,d],CRYPTO:f,MODULO_MODE:p,POW_PRECISION:m,FORMAT:h,ALPHABET:g}},v.isBigNumber=function(e){if(!e||e._isBigNumber!==!0)return!1;if(!v.DEBUG)return!0;var t,n,r=e.c,i=e.e,a=e.s;out:if({}.toString.call(r)==`[object Array]`){if((a===1||a===-1)&&i>=-K&&i<=K&&i===$a(i)){if(r[0]===0){if(i===0&&r.length===1)return!0;break out}if(t=(i+1)%G,t<1&&(t+=G),String(r[0]).length==t){for(t=0;t<r.length;t++)if(n=r[t],n<0||n>=no||n!==$a(n))break out;if(n!==0)return!0}}}else if(r===null&&i===null&&(a===null||a===1||a===-1))return!0;throw Error(eo+`Invalid BigNumber: `+e)},v.maximum=v.max=function(){return b(arguments,-1)},v.minimum=v.min=function(){return b(arguments,1)},v.random=(function(){var e=9007199254740992,t=Math.random()*e&2097151?function(){return $a(Math.random()*e)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(e){var n,r,i,s,c,l=0,u=[],d=new v(a);if(e==null?e=o:q(e,0,K),s=Qa(e/G),f)if(crypto.getRandomValues){for(n=crypto.getRandomValues(new Uint32Array(s*=2));l<s;)c=n[l]*131072+(n[l+1]>>>11),c>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),n[l]=r[0],n[l+1]=r[1]):(u.push(c%0x5af3107a4000),l+=2);l=s/2}else if(crypto.randomBytes){for(n=crypto.randomBytes(s*=7);l<s;)c=(n[l]&31)*281474976710656+n[l+1]*1099511627776+n[l+2]*4294967296+n[l+3]*16777216+(n[l+4]<<16)+(n[l+5]<<8)+n[l+6],c>=9e15?crypto.randomBytes(7).copy(n,l):(u.push(c%0x5af3107a4000),l+=7);l=s/7}else throw f=!1,Error(eo+`crypto unavailable`);if(!f)for(;l<s;)c=t(),c<9e15&&(u[l++]=c%0x5af3107a4000);for(s=u[--l],e%=G,s&&e&&(c=io[G-e],u[l]=$a(s/c)*c);u[l]===0;u.pop(),l--);if(l<0)u=[i=0];else{for(i=-1;u[0]===0;u.splice(0,1),i-=G);for(l=1,c=u[0];c>=10;c/=10,l++);l<G&&(i-=G-l)}return d.e=i,d.c=u,d}})(),v.sum=function(){for(var e=1,t=arguments,n=new v(t[0]);e<t.length;)n=n.plus(t[e++]);return n},n=(function(){var e=`0123456789`;function n(e,t,n,r){for(var i,a=[0],o,s=0,c=e.length;s<c;){for(o=a.length;o--;a[o]*=t);for(a[0]+=r.indexOf(e.charAt(s++)),i=0;i<a.length;i++)a[i]>n-1&&(a[i+1]??(a[i+1]=0),a[i+1]+=a[i]/n|0,a[i]%=n)}return a.reverse()}return function(r,i,a,c,l){var u,d,f,p,h,_,y,b,x=r.indexOf(`.`),S=o,C=s;for(x>=0&&(p=m,m=0,r=r.replace(`.`,``),b=new v(i),_=b.pow(r.length-x),m=p,b.c=n(po(co(_.c),_.e,`0`),10,a,e),b.e=b.c.length),y=n(r,i,a,l?(u=g,e):(u=e,g)),f=p=y.length;y[--p]==0;y.pop());if(!y[0])return u.charAt(0);if(x<0?--f:(_.c=y,_.e=f,_.s=c,_=t(_,b,S,C,a),y=_.c,h=_.r,f=_.e),d=f+S+1,x=y[d],p=a/2,h=h||d<0||y[d+1]!=null,h=C<4?(x!=null||h)&&(C==0||C==(_.s<0?3:2)):x>p||x==p&&(C==4||h||C==6&&y[d-1]&1||C==(_.s<0?8:7)),d<1||!y[0])r=h?po(u.charAt(1),-S,u.charAt(0)):u.charAt(0);else{if(y.length=d,h)for(--a;++y[--d]>a;)y[d]=0,d||(++f,y=[1].concat(y));for(p=y.length;!y[--p];);for(x=0,r=``;x<=p;r+=u.charAt(y[x++]));r=po(r,f,u.charAt(0))}return r}})(),t=(function(){function e(e,t,n){var r,i,a,o,s=0,c=e.length,l=t%ao,u=t/ao|0;for(e=e.slice();c--;)a=e[c]%ao,o=e[c]/ao|0,r=u*a+o*l,i=l*a+r%ao*ao+s,s=(i/n|0)+(r/ao|0)+u*o,e[c]=i%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,i,a,o,s){var c,l,u,d,f,p,m,h,g,_,y,b,x,C,w,T,E,D=r.s==i.s?1:-1,O=r.c,k=i.c;if(!O||!O[0]||!k||!k[0])return new v(!r.s||!i.s||(O?k&&O[0]==k[0]:!k)?NaN:O&&O[0]==0||!k?D*0:D/0);for(h=new v(D),g=h.c=[],l=r.e-i.e,D=a+l+1,s||(s=no,l=so(r.e/G)-so(i.e/G),D=D/G|0),u=0;k[u]==(O[u]||0);u++);if(k[u]>(O[u]||0)&&l--,D<0)g.push(1),d=!0;else{for(C=O.length,T=k.length,u=0,D+=2,f=$a(s/(k[0]+1)),f>1&&(k=e(k,f,s),O=e(O,f,s),T=k.length,C=O.length),x=T,_=O.slice(0,T),y=_.length;y<T;_[y++]=0);E=k.slice(),E=[0].concat(E),w=k[0],k[1]>=s/2&&w++;do{if(f=0,c=t(k,_,T,y),c<0){if(b=_[0],T!=y&&(b=b*s+(_[1]||0)),f=$a(b/w),f>1)for(f>=s&&(f=s-1),p=e(k,f,s),m=p.length,y=_.length;t(p,_,m,y)==1;)f--,n(p,T<m?E:k,m,s),m=p.length,c=1;else f==0&&(c=f=1),p=k.slice(),m=p.length;if(m<y&&(p=[0].concat(p)),n(_,p,y,s),y=_.length,c==-1)for(;t(k,_,T,y)<1;)f++,n(_,T<y?E:k,y,s),y=_.length}else c===0&&(f++,_=[0]);g[u++]=f,_[0]?_[y++]=O[x]||0:(_=[O[x]],y=1)}while((x++<C||_[0]!=null)&&D--);d=_[0]!=null,g[0]||g.splice(0,1)}if(s==no){for(u=1,D=g[0];D>=10;D/=10,u++);S(h,a+(h.e=u+l*G-1)+1,o,d)}else h.e=l,h.r=+d;return h}})();function y(e,t,n,r){var i,a,o,u,d;if(n==null?n=s:q(n,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,t==null)d=co(e.c),d=r==1||r==2&&(o<=c||o>=l)?fo(d,o):po(d,o,`0`);else if(e=S(new v(e),t,n),a=e.e,d=co(e.c),u=d.length,r==1||r==2&&(t<=a||a<=c)){for(;u<t;d+=`0`,u++);d=fo(d,a)}else if(t-=o+(r===2&&a>o),d=po(d,a,`0`),a+1>u){if(--t>0)for(d+=`.`;t--;d+=`0`);}else if(t+=a-u,t>0)for(a+1==u&&(d+=`.`);t--;d+=`0`);return e.s<0&&i?`-`+d:d}function b(e,t){for(var n,r,i=1,a=new v(e[0]);i<e.length;i++)r=new v(e[i]),(!r.s||(n=lo(a,r))===t||n===0&&a.s===t)&&(a=r);return a}function x(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*G-1)>d?e.c=e.e=null:n<u?e.c=[e.e=0]:(e.e=n,e.c=t),e}r=(function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,n=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(a,o,s,c){var l,u=s?o:o.replace(i,``);if(r.test(u))a.s=isNaN(u)?null:u<0?-1:1;else{if(!s&&(u=u.replace(e,function(e,t,n){return l=(n=n.toLowerCase())==`x`?16:n==`b`?2:8,!c||c==l?t:e}),c&&(l=c,u=u.replace(t,`$1`).replace(n,`0.$1`)),o!=u))return new v(u,l);if(v.DEBUG)throw Error(eo+`Not a`+(c?` base `+c:``)+` number: `+o);a.s=null}a.c=a.e=null}})();function S(e,t,n,r){var i,a,o,s,c,l,f,p=e.c,m=io;if(p){out:{for(i=1,s=p[0];s>=10;s/=10,i++);if(a=t-i,a<0)a+=G,o=t,c=p[l=0],f=$a(c/m[i-o-1]%10);else if(l=Qa((a+1)/G),l>=p.length)if(r){for(;p.length<=l;p.push(0));c=f=0,i=1,a%=G,o=a-G+1}else break out;else{for(c=s=p[l],i=1;s>=10;s/=10,i++);a%=G,o=a-G+i,f=o<0?0:$a(c/m[i-o-1]%10)}if(r=r||t<0||p[l+1]!=null||(o<0?c:c%m[i-o-1]),r=n<4?(f||r)&&(n==0||n==(e.s<0?3:2)):f>5||f==5&&(n==4||r||n==6&&(a>0?o>0?c/m[i-o]:0:p[l-1])%10&1||n==(e.s<0?8:7)),t<1||!p[0])return p.length=0,r?(t-=e.e+1,p[0]=m[(G-t%G)%G],e.e=-t||0):p[0]=e.e=0,e;if(a==0?(p.length=l,s=1,l--):(p.length=l+1,s=m[G-a],p[l]=o>0?$a(c/m[i-o]%m[o])*s:0),r)for(;;)if(l==0){for(a=1,o=p[0];o>=10;o/=10,a++);for(o=p[0]+=s,s=1;o>=10;o/=10,s++);a!=s&&(e.e++,p[0]==no&&(p[0]=1));break}else{if(p[l]+=s,p[l]!=no)break;p[l--]=0,s=1}for(a=p.length;p[--a]===0;p.pop());}e.e>d?e.c=e.e=null:e.e<u&&(e.c=[e.e=0])}return e}function C(e){var t,n=e.e;return n===null?e.toString():(t=co(e.c),t=n<=c||n>=l?fo(t,n):po(t,n,`0`),e.s<0?`-`+t:t)}return i.absoluteValue=i.abs=function(){var e=new v(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return lo(this,new v(e,t))},i.decimalPlaces=i.dp=function(e,t){var n,r,i,a=this;if(e!=null)return q(e,0,K),t==null?t=s:q(t,0,8),S(new v(a),e+a.e+1,t);if(!(n=a.c))return null;if(r=((i=n.length-1)-so(this.e/G))*G,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},i.dividedBy=i.div=function(e,n){return t(this,new v(e,n),o,s)},i.dividedToIntegerBy=i.idiv=function(e,n){return t(this,new v(e,n),0,1)},i.exponentiatedBy=i.pow=function(e,t){var n,r,i,o,c,l,u,d,f,p=this;if(e=new v(e),e.c&&!e.isInteger())throw Error(eo+`Exponent not an integer: `+C(e));if(t!=null&&(t=new v(t)),l=e.e>14,!p.c||!p.c[0]||p.c[0]==1&&!p.e&&p.c.length==1||!e.c||!e.c[0])return f=new v(C(p)**(l?e.s*(2-uo(e)):+C(e))),t?f.mod(t):f;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new v(NaN);r=!u&&p.isInteger()&&t.isInteger(),r&&(p=p.mod(t))}else if(e.e>9&&(p.e>0||p.e<-1||(p.e==0?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return o=p.s<0&&uo(e)?-0:0,p.e>-1&&(o=1/o),new v(u?1/o:o);else m&&(o=Qa(m/G+2));for(l?(n=new v(.5),u&&(e.s=1),d=uo(e)):(i=Math.abs(+C(e)),d=i%2),f=new v(a);;){if(d){if(f=f.times(p),!f.c)break;o?f.c.length>o&&(f.c.length=o):r&&(f=f.mod(t))}if(i){if(i=$a(i/2),i===0)break;d=i%2}else if(e=e.times(n),S(e,e.e+1,1),e.e>14)d=uo(e);else{if(i=+C(e),i===0)break;d=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(t))}return r?f:(u&&(f=a.div(f)),t?f.mod(t):o?S(f,m,s,c):f)},i.integerValue=function(e){var t=new v(this);return e==null?e=s:q(e,0,8),S(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return lo(this,new v(e,t))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return lo(this,new v(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return(t=lo(this,new v(e,t)))===1||t===0},i.isInteger=function(){return!!this.c&&so(this.e/G)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return lo(this,new v(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return(t=lo(this,new v(e,t)))===-1||t===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(e,t){var n,r,i,a,o=this,c=o.s;if(e=new v(e,t),t=e.s,!c||!t)return new v(NaN);if(c!=t)return e.s=-t,o.plus(e);var l=o.e/G,u=e.e/G,d=o.c,f=e.c;if(!l||!u){if(!d||!f)return d?(e.s=-t,e):new v(f?o:NaN);if(!d[0]||!f[0])return f[0]?(e.s=-t,e):new v(d[0]?o:s==3?-0:0)}if(l=so(l),u=so(u),d=d.slice(),c=l-u){for((a=c<0)?(c=-c,i=d):(u=l,i=f),i.reverse(),t=c;t--;i.push(0));i.reverse()}else for(r=(a=(c=d.length)<(t=f.length))?c:t,c=t=0;t<r;t++)if(d[t]!=f[t]){a=d[t]<f[t];break}if(a&&(i=d,d=f,f=i,e.s=-e.s),t=(r=f.length)-(n=d.length),t>0)for(;t--;d[n++]=0);for(t=no-1;r>c;){if(d[--r]<f[r]){for(n=r;n&&!d[--n];d[n]=t);--d[n],d[r]+=no}d[r]-=f[r]}for(;d[0]==0;d.splice(0,1),--u);return d[0]?x(e,d,u):(e.s=s==3?-1:1,e.c=[e.e=0],e)},i.modulo=i.mod=function(e,n){var r,i,a=this;return e=new v(e,n),!a.c||!e.s||e.c&&!e.c[0]?new v(NaN):!e.c||a.c&&!a.c[0]?new v(a):(p==9?(i=e.s,e.s=1,r=t(a,e,0,3),e.s=i,r.s*=i):r=t(a,e,0,p),e=a.minus(r.times(e)),!e.c[0]&&p==1&&(e.s=a.s),e)},i.multipliedBy=i.times=function(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=this,y=_.c,b=(e=new v(e,t)).c;if(!y||!b||!y[0]||!b[0])return!_.s||!e.s||y&&!y[0]&&!b||b&&!b[0]&&!y?e.c=e.e=e.s=null:(e.s*=_.s,!y||!b?e.c=e.e=null:(e.c=[0],e.e=0)),e;for(r=so(_.e/G)+so(e.e/G),e.s*=_.s,c=y.length,d=b.length,c<d&&(m=y,y=b,b=m,i=c,c=d,d=i),i=c+d,m=[];i--;m.push(0));for(h=no,g=ao,i=d;--i>=0;){for(n=0,f=b[i]%g,p=b[i]/g|0,o=c,a=i+o;a>i;)l=y[--o]%g,u=y[o]/g|0,s=p*l+u*f,l=f*l+s%g*g+m[a]+n,n=(l/h|0)+(s/g|0)+p*u,m[a--]=l%h;m[a]=n}return n?++r:m.splice(0,1),x(e,m,r)},i.negated=function(){var e=new v(this);return e.s=-e.s||null,e},i.plus=function(e,t){var n,r=this,i=r.s;if(e=new v(e,t),t=e.s,!i||!t)return new v(NaN);if(i!=t)return e.s=-t,r.minus(e);var a=r.e/G,o=e.e/G,s=r.c,c=e.c;if(!a||!o){if(!s||!c)return new v(i/0);if(!s[0]||!c[0])return c[0]?e:new v(s[0]?r:i*0)}if(a=so(a),o=so(o),s=s.slice(),i=a-o){for(i>0?(o=a,n=c):(i=-i,n=s),n.reverse();i--;n.push(0));n.reverse()}for(i=s.length,t=c.length,i-t<0&&(n=c,c=s,s=n,t=i),i=0;t;)i=(s[--t]=s[t]+c[t]+i)/no|0,s[t]=no===s[t]?0:s[t]%no;return i&&(s=[i].concat(s),++o),x(e,s,o)},i.precision=i.sd=function(e,t){var n,r,i,a=this;if(e!=null&&e!==!!e)return q(e,1,K),t==null?t=s:q(t,0,8),S(new v(a),e,t);if(!(n=a.c))return null;if(i=n.length-1,r=i*G+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&a.e+1>r&&(r=a.e+1),r},i.shiftedBy=function(e){return q(e,-ro,ro),this.times(`1e`+e)},i.squareRoot=i.sqrt=function(){var e,n,r,i,a,c=this,l=c.c,u=c.s,d=c.e,f=o+4,p=new v(`0.5`);if(u!==1||!l||!l[0])return new v(!u||u<0&&(!l||l[0])?NaN:l?c:1/0);if(u=Math.sqrt(+C(c)),u==0||u==1/0?(n=co(l),(n.length+d)%2==0&&(n+=`0`),u=Math.sqrt(+n),d=so((d+1)/2)-(d<0||d%2),u==1/0?n=`5e`+d:(n=u.toExponential(),n=n.slice(0,n.indexOf(`e`)+1)+d),r=new v(n)):r=new v(u+``),r.c[0]){for(d=r.e,u=d+f,u<3&&(u=0);;)if(a=r,r=p.times(a.plus(t(c,a,f,1))),co(a.c).slice(0,u)===(n=co(r.c)).slice(0,u))if(r.e<d&&--u,n=n.slice(u-3,u+1),n==`9999`||!i&&n==`4999`){if(!i&&(S(a,a.e+o+2,0),a.times(a).eq(c))){r=a;break}f+=4,u+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)==`5`)&&(S(r,r.e+o+2,1),e=!r.times(r).eq(c));break}}return S(r,r.e+o+1,s,e)},i.toExponential=function(e,t){return e!=null&&(q(e,0,K),e++),y(this,e,t,1)},i.toFixed=function(e,t){return e!=null&&(q(e,0,K),e=e+this.e+1),y(this,e,t)},i.toFormat=function(e,t,n){var r,i=this;if(n==null)e!=null&&t&&typeof t==`object`?(n=t,t=null):e&&typeof e==`object`?(n=e,e=t=null):n=h;else if(typeof n!=`object`)throw Error(eo+`Argument not an object: `+n);if(r=i.toFixed(e,t),i.c){var a,o=r.split(`.`),s=+n.groupSize,c=+n.secondaryGroupSize,l=n.groupSeparator||``,u=o[0],d=o[1],f=i.s<0,p=f?u.slice(1):u,m=p.length;if(c&&(a=s,s=c,c=a,m-=a),s>0&&m>0){for(a=m%s||s,u=p.substr(0,a);a<m;a+=s)u+=l+p.substr(a,s);c>0&&(u+=l+p.slice(a)),f&&(u=`-`+u)}r=d?u+(n.decimalSeparator||``)+((c=+n.fractionGroupSize)?d.replace(RegExp(`\\d{`+c+`}\\B`,`g`),`$&`+(n.fractionGroupSeparator||``)):d):u}return(n.prefix||``)+r+(n.suffix||``)},i.toFraction=function(e){var n,r,i,o,c,l,u,f,p,m,h,g,_=this,y=_.c;if(e!=null&&(u=new v(e),!u.isInteger()&&(u.c||u.s!==1)||u.lt(a)))throw Error(eo+`Argument `+(u.isInteger()?`out of range: `:`not an integer: `)+C(u));if(!y)return new v(_);for(n=new v(a),p=r=new v(a),i=f=new v(a),g=co(y),c=n.e=g.length-_.e-1,n.c[0]=io[(l=c%G)<0?G+l:l],e=!e||u.comparedTo(n)>0?c>0?n:p:u,l=d,d=1/0,u=new v(g),f.c[0]=0;m=t(u,n,0,1),o=r.plus(m.times(i)),o.comparedTo(e)!=1;)r=i,i=o,p=f.plus(m.times(o=p)),f=o,n=u.minus(m.times(o=n)),u=o;return o=t(e.minus(r),i,0,1),f=f.plus(o.times(p)),r=r.plus(o.times(i)),f.s=p.s=_.s,c*=2,h=t(p,i,c,s).minus(_).abs().comparedTo(t(f,r,c,s).minus(_).abs())<1?[p,i]:[f,r],d=l,h},i.toNumber=function(){return+C(this)},i.toPrecision=function(e,t){return e!=null&&q(e,1,K),y(this,e,t,2)},i.toString=function(e){var t,r=this,i=r.s,a=r.e;return a===null?i?(t=`Infinity`,i<0&&(t=`-`+t)):t=`NaN`:(e==null?t=a<=c||a>=l?fo(co(r.c),a):po(co(r.c),a,`0`):e===10&&_?(r=S(new v(r),o+a+1,s),t=po(co(r.c),r.e,`0`)):(q(e,2,g.length,`Base`),t=n(po(co(r.c),a,`0`),10,e,i,!0)),i<0&&r.c[0]&&(t=`-`+t)),t},i.valueOf=i.toJSON=function(){return C(this)},i._isBigNumber=!0,i[Symbol.toStringTag]=`BigNumber`,i[Symbol.for(`nodejs.util.inspect.custom`)]=i.valueOf,e!=null&&v.set(e),v}function so(e){var t=e|0;return e>0||e===t?t:t-1}function co(e){for(var t,n,r=1,i=e.length,a=e[0]+``;r<i;){for(t=e[r++]+``,n=G-t.length;n--;t=`0`+t);a+=t}for(i=a.length;a.charCodeAt(--i)===48;);return a.slice(0,i+1||1)}function lo(e,t){var n,r,i=e.c,a=t.c,o=e.s,s=t.s,c=e.e,l=t.e;if(!o||!s)return null;if(n=i&&!i[0],r=a&&!a[0],n||r)return n?r?0:-s:o;if(o!=s)return o;if(n=o<0,r=c==l,!i||!a)return r?0:!i^n?1:-1;if(!r)return c>l^n?1:-1;for(s=(c=i.length)<(l=a.length)?c:l,o=0;o<s;o++)if(i[o]!=a[o])return i[o]>a[o]^n?1:-1;return c==l?0:c>l^n?1:-1}function q(e,t,n,r){if(e<t||e>n||e!==$a(e))throw Error(eo+(r||`Argument`)+(typeof e==`number`?e<t||e>n?` out of range: `:` not an integer: `:` not a primitive number: `)+String(e))}function uo(e){var t=e.c.length-1;return so(e.e/G)==t&&e.c[t]%2!=0}function fo(e,t){return(e.length>1?e.charAt(0)+`.`+e.slice(1):e)+(t<0?`e`:`e+`)+t}function po(e,t,n){var r,i;if(t<0){for(i=n+`.`;++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+`.`+e.slice(t));return e}var mo=oo(),ho=class{key;left=null;right=null;constructor(e){this.key=e}},go=class extends ho{constructor(e){super(e)}},_o=class{size=0;modificationCount=0;splayCount=0;splay(e){let t=this.root;if(t==null)return this.compare(e,e),-1;let n=null,r=null,i=null,a=null,o=t,s=this.compare,c;for(;;)if(c=s(o.key,e),c>0){let t=o.left;if(t==null||(c=s(t.key,e),c>0&&(o.left=t.right,t.right=o,o=t,t=o.left,t==null)))break;n==null?r=o:n.left=o,n=o,o=t}else if(c<0){let t=o.right;if(t==null||(c=s(t.key,e),c<0&&(o.right=t.left,t.left=o,o=t,t=o.right,t==null)))break;i==null?a=o:i.right=o,i=o,o=t}else break;return i!=null&&(i.right=o.left,o.left=a),n!=null&&(n.left=o.right,o.right=r),this.root!==o&&(this.root=o,this.splayCount++),c}splayMin(e){let t=e,n=t.left;for(;n!=null;){let e=n;t.left=e.right,e.right=t,t=e,n=t.left}return t}splayMax(e){let t=e,n=t.right;for(;n!=null;){let e=n;t.right=e.left,e.left=t,t=e,n=t.right}return t}_delete(e){if(this.root==null||this.splay(e)!=0)return null;let t=this.root,n=t,r=t.left;if(this.size--,r==null)this.root=t.right;else{let e=t.right;t=this.splayMax(r),t.right=e,this.root=t}return this.modificationCount++,n}addNewRoot(e,t){this.size++,this.modificationCount++;let n=this.root;if(n==null){this.root=e;return}t<0?(e.left=n,e.right=n.right,n.right=null):(e.right=n,e.left=n.left,n.left=null),this.root=e}_first(){let e=this.root;return e==null?null:(this.root=this.splayMin(e),this.root)}_last(){let e=this.root;return e==null?null:(this.root=this.splayMax(e),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(e){return this.validKey(e)&&this.splay(e)==0}defaultCompare(){return(e,t)=>e<t?-1:e>t?1:0}wrap(){return{getRoot:()=>this.root,setRoot:e=>{this.root=e},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:e=>{this.splayCount=e},splay:e=>this.splay(e),has:e=>this.has(e)}}},vo=class e extends _o{root=null;compare;validKey;constructor(e,t){super(),this.compare=e??this.defaultCompare(),this.validKey=t??(e=>e!=null&&e!=null)}delete(e){return this.validKey(e)?this._delete(e)!=null:!1}deleteAll(e){for(let t of e)this.delete(t)}forEach(e){let t=this[Symbol.iterator](),n;for(;n=t.next(),!n.done;)e(n.value,n.value,this)}add(e){let t=this.splay(e);return t!=0&&this.addNewRoot(new go(e),t),this}addAndReturn(e){let t=this.splay(e);return t!=0&&this.addNewRoot(new go(e),t),this.root.key}addAll(e){for(let t of e)this.add(t)}isEmpty(){return this.root==null}isNotEmpty(){return this.root!=null}single(){if(this.size==0)throw`Bad state: No element`;if(this.size>1)throw`Bad state: Too many element`;return this.root.key}first(){if(this.size==0)throw`Bad state: No element`;return this._first().key}last(){if(this.size==0)throw`Bad state: No element`;return this._last().key}lastBefore(e){if(e==null)throw`Invalid arguments(s)`;if(this.root==null)return null;if(this.splay(e)<0)return this.root.key;let t=this.root.left;if(t==null)return null;let n=t.right;for(;n!=null;)t=n,n=t.right;return t.key}firstAfter(e){if(e==null)throw`Invalid arguments(s)`;if(this.root==null)return null;if(this.splay(e)>0)return this.root.key;let t=this.root.right;if(t==null)return null;let n=t.left;for(;n!=null;)t=n,n=t.left;return t.key}retainAll(t){let n=new e(this.compare,this.validKey),r=this.modificationCount;for(let e of t){if(r!=this.modificationCount)throw`Concurrent modification during iteration.`;this.validKey(e)&&this.splay(e)==0&&n.add(this.root.key)}n.size!=this.size&&(this.root=n.root,this.size=n.size,this.modificationCount++)}lookup(e){return!this.validKey(e)||this.splay(e)!=0?null:this.root.key}intersection(t){let n=new e(this.compare,this.validKey);for(let e of this)t.has(e)&&n.add(e);return n}difference(t){let n=new e(this.compare,this.validKey);for(let e of this)t.has(e)||n.add(e);return n}union(e){let t=this.clone();return t.addAll(e),t}clone(){let t=new e(this.compare,this.validKey);return t.size=this.size,t.root=this.copyNode(this.root),t}copyNode(e){if(e==null)return null;function t(e,n){let r,i;do{if(r=e.left,i=e.right,r!=null){let e=new go(r.key);n.left=e,t(r,e)}if(i!=null){let t=new go(i.key);n.right=t,e=i,n=t}}while(i!=null)}let n=new go(e.key);return t(e,n),n}toSet(){return this.clone()}entries(){return new xo(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[Symbol.iterator](){return new bo(this.wrap())}[Symbol.toStringTag]=`[object Set]`},yo=class{tree;path=[];modificationCount=null;splayCount;constructor(e){this.tree=e,this.splayCount=e.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;let e=this.path[this.path.length-1];return this.getValue(e)}rebuildPath(e){this.path.splice(0,this.path.length),this.tree.splay(e),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(e){for(;e!=null;)this.path.push(e),e=e.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let e=this.tree.getRoot();for(;e!=null;)this.path.push(e),e=e.left;return this.path.length>0}throw`Concurrent modification during iteration.`}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let e=this.path[this.path.length-1],t=e.right;if(t!=null){for(;t!=null;)this.path.push(t),t=t.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===e;)e=this.path.pop();return this.path.length>0}},bo=class extends yo{getValue(e){return e.key}},xo=class extends yo{getValue(e){return[e.key,e.key]}},So=e=>()=>e,Co=e=>{let t=e?(t,n)=>n.minus(t).abs().isLessThanOrEqualTo(e):So(!1);return(e,n)=>t(e,n)?0:e.comparedTo(n)};function wo(e){let t=e?(t,n,r,i,a)=>t.exponentiatedBy(2).isLessThanOrEqualTo(i.minus(n).exponentiatedBy(2).plus(a.minus(r).exponentiatedBy(2)).times(e)):So(!1);return(e,n,r)=>{let i=e.x,a=e.y,o=r.x,s=r.y,c=a.minus(s).times(n.x.minus(o)).minus(i.minus(o).times(n.y.minus(s)));return t(c,i,a,o,s)?0:c.comparedTo(0)}}var To=e=>e,Eo=e=>{if(e){let t=new vo(Co(e)),n=new vo(Co(e)),r=(e,t)=>t.addAndReturn(e),i=e=>({x:r(e.x,t),y:r(e.y,n)});return i({x:new mo(0),y:new mo(0)}),i}return To},Do=e=>({set:e=>{Oo=Do(e)},reset:()=>Do(e),compare:Co(e),snap:Eo(e),orient:wo(e)}),Oo=Do(),ko=(e,t)=>e.ll.x.isLessThanOrEqualTo(t.x)&&t.x.isLessThanOrEqualTo(e.ur.x)&&e.ll.y.isLessThanOrEqualTo(t.y)&&t.y.isLessThanOrEqualTo(e.ur.y),Ao=(e,t)=>{if(t.ur.x.isLessThan(e.ll.x)||e.ur.x.isLessThan(t.ll.x)||t.ur.y.isLessThan(e.ll.y)||e.ur.y.isLessThan(t.ll.y))return null;let n=e.ll.x.isLessThan(t.ll.x)?t.ll.x:e.ll.x,r=e.ur.x.isLessThan(t.ur.x)?e.ur.x:t.ur.x,i=e.ll.y.isLessThan(t.ll.y)?t.ll.y:e.ll.y,a=e.ur.y.isLessThan(t.ur.y)?e.ur.y:t.ur.y;return{ll:{x:n,y:i},ur:{x:r,y:a}}},jo=(e,t)=>e.x.times(t.y).minus(e.y.times(t.x)),Mo=(e,t)=>e.x.times(t.x).plus(e.y.times(t.y)),No=e=>Mo(e,e).sqrt(),Po=(e,t,n)=>{let r={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:n.x.minus(e.x),y:n.y.minus(e.y)};return jo(i,r).div(No(i)).div(No(r))},Fo=(e,t,n)=>{let r={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:n.x.minus(e.x),y:n.y.minus(e.y)};return Mo(i,r).div(No(i)).div(No(r))},Io=(e,t,n)=>t.y.isZero()?null:{x:e.x.plus(t.x.div(t.y).times(n.minus(e.y))),y:n},Lo=(e,t,n)=>t.x.isZero()?null:{x:n,y:e.y.plus(t.y.div(t.x).times(n.minus(e.x)))},Ro=(e,t,n,r)=>{if(t.x.isZero())return Lo(n,r,e.x);if(r.x.isZero())return Lo(e,t,n.x);if(t.y.isZero())return Io(n,r,e.y);if(r.y.isZero())return Io(e,t,n.y);let i=jo(t,r);if(i.isZero())return null;let a={x:n.x.minus(e.x),y:n.y.minus(e.y)},o=jo(a,t).div(i),s=jo(a,r).div(i),c=e.x.plus(s.times(t.x)),l=n.x.plus(o.times(r.x)),u=e.y.plus(s.times(t.y)),d=n.y.plus(o.times(r.y));return{x:c.plus(l).div(2),y:u.plus(d).div(2)}},zo=class e{point;isLeft;segment;otherSE;consumedBy;static compare(t,n){let r=e.comparePoints(t.point,n.point);return r===0?(t.point!==n.point&&t.link(n),t.isLeft===n.isLeft?qo.compare(t.segment,n.segment):t.isLeft?1:-1):r}static comparePoints(e,t){return e.x.isLessThan(t.x)?-1:e.x.isGreaterThan(t.x)?1:e.y.isLessThan(t.y)?-1:e.y.isGreaterThan(t.y)?1:0}constructor(e,t){e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=t}link(e){if(e.point===this.point)throw Error(`Tried to link already linked events`);let t=e.point.events;for(let e=0,n=t.length;e<n;e++){let n=t[e];this.point.events.push(n),n.point=this.point}this.checkForConsuming()}checkForConsuming(){let e=this.point.events.length;for(let t=0;t<e;t++){let n=this.point.events[t];if(n.segment.consumedBy===void 0)for(let r=t+1;r<e;r++){let e=this.point.events[r];e.consumedBy===void 0&&n.otherSE.point.events===e.otherSE.point.events&&n.segment.consume(e.segment)}}}getAvailableLinkedEvents(){let e=[];for(let t=0,n=this.point.events.length;t<n;t++){let n=this.point.events[t];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&e.push(n)}return e}getLeftmostComparator(e){let t=new Map,n=n=>{let r=n.otherSE;t.set(n,{sine:Po(this.point,e.point,r.point),cosine:Fo(this.point,e.point,r.point)})};return(e,r)=>{t.has(e)||n(e),t.has(r)||n(r);let{sine:i,cosine:a}=t.get(e),{sine:o,cosine:s}=t.get(r);return i.isGreaterThanOrEqualTo(0)&&o.isGreaterThanOrEqualTo(0)?a.isLessThan(s)?1:a.isGreaterThan(s)?-1:0:i.isLessThan(0)&&o.isLessThan(0)?a.isLessThan(s)?-1:a.isGreaterThan(s)?1:0:o.isLessThan(i)?-1:o.isGreaterThan(i)?1:0}}},Bo=class e{events;poly;_isExteriorRing;_enclosingRing;static factory(t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];if(!i.isInResult()||i.ringOut)continue;let a=null,o=i.leftSE,s=i.rightSE,c=[o],l=o.point,u=[];for(;a=o,o=s,c.push(o),o.point!==l;)for(;;){let t=o.getAvailableLinkedEvents();if(t.length===0){let e=c[0].point,t=c[c.length-1].point;throw Error(`Unable to complete output ring starting at [${e.x}, ${e.y}]. Last matching segment found ends at [${t.x}, ${t.y}].`)}if(t.length===1){s=t[0].otherSE;break}let r=null;for(let e=0,t=u.length;e<t;e++)if(u[e].point===o.point){r=e;break}if(r!==null){let t=u.splice(r)[0],i=c.splice(t.index);i.unshift(i[0].otherSE),n.push(new e(i.reverse()));continue}u.push({index:c.length,point:o.point});let i=o.getLeftmostComparator(a);s=t.sort(i)[0].otherSE;break}n.push(new e(c))}return n}constructor(e){this.events=e;for(let t=0,n=e.length;t<n;t++)e[t].segment.ringOut=this;this.poly=null}getGeom(){let e=this.events[0].point,t=[e];for(let n=1,r=this.events.length-1;n<r;n++){let r=this.events[n].point,i=this.events[n+1].point;Oo.orient(r,e,i)!==0&&(t.push(r),e=r)}if(t.length===1)return null;let n=t[0],r=t[1];Oo.orient(n,e,r)===0&&t.shift(),t.push(t[0]);let i=this.isExteriorRing()?1:-1,a=this.isExteriorRing()?0:t.length-1,o=this.isExteriorRing()?t.length:-1,s=[];for(let e=a;e!=o;e+=i)s.push([t[e].x.toNumber(),t[e].y.toNumber()]);return s}isExteriorRing(){if(this._isExteriorRing===void 0){let e=this.enclosingRing();this._isExteriorRing=e?!e.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let e=this.events[0];for(let t=1,n=this.events.length;t<n;t++){let n=this.events[t];zo.compare(e,n)>0&&(e=n)}let t=e.segment.prevInResult(),n=t?t.prevInResult():null;for(;;){if(!t)return null;if(!n)return t.ringOut;if(n.ringOut!==t.ringOut)return n.ringOut?.enclosingRing()===t.ringOut?t.ringOut?.enclosingRing():t.ringOut;t=n.prevInResult(),n=t?t.prevInResult():null}}},Vo=class{exteriorRing;interiorRings;constructor(e){this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){let e=this.exteriorRing.getGeom();if(e===null)return null;let t=[e];for(let e=0,n=this.interiorRings.length;e<n;e++){let n=this.interiorRings[e].getGeom();n!==null&&t.push(n)}return t}},Ho=class{rings;polys;constructor(e){this.rings=e,this.polys=this._composePolys(e)}getGeom(){let e=[];for(let t=0,n=this.polys.length;t<n;t++){let n=this.polys[t].getGeom();n!==null&&e.push(n)}return e}_composePolys(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];if(!r.poly)if(r.isExteriorRing())t.push(new Vo(r));else{let e=r.enclosingRing();e?.poly||t.push(new Vo(e)),e?.poly?.addInterior(r)}}return t}},Uo=class{queue;tree;segments;constructor(e,t=qo.compare){this.queue=e,this.tree=new vo(t),this.segments=[]}process(e){let t=e.segment,n=[];if(e.consumedBy)return e.isLeft?this.queue.delete(e.otherSE):this.tree.delete(t),n;e.isLeft&&this.tree.add(t);let r=t,i=t;do r=this.tree.lastBefore(r);while(r!=null&&r.consumedBy!=null);do i=this.tree.firstAfter(i);while(i!=null&&i.consumedBy!=null);if(e.isLeft){let a=null;if(r){let e=r.getIntersection(t);if(e!==null&&(t.isAnEndpoint(e)||(a=e),!r.isAnEndpoint(e))){let t=this._splitSafely(r,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}let o=null;if(i){let e=i.getIntersection(t);if(e!==null&&(t.isAnEndpoint(e)||(o=e),!i.isAnEndpoint(e))){let t=this._splitSafely(i,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}if(a!==null||o!==null){let e=null;e=a===null?o:o===null||zo.comparePoints(a,o)<=0?a:o,this.queue.delete(t.rightSE),n.push(t.rightSE);let r=t.split(e);for(let e=0,t=r.length;e<t;e++)n.push(r[e])}n.length>0?(this.tree.delete(t),n.push(e)):(this.segments.push(t),t.prev=r)}else{if(r&&i){let e=r.getIntersection(i);if(e!==null){if(!r.isAnEndpoint(e)){let t=this._splitSafely(r,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}if(!i.isAnEndpoint(e)){let t=this._splitSafely(i,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}}this.tree.delete(t)}return n}_splitSafely(e,t){this.tree.delete(e);let n=e.rightSE;this.queue.delete(n);let r=e.split(t);return r.push(n),e.consumedBy===void 0&&this.tree.add(e),r}},Wo=new class{type;numMultiPolys;run(e,t,n){Wo.type=e;let r=[new Xo(t,!0)];for(let e=0,t=n.length;e<t;e++)r.push(new Xo(n[e],!1));if(Wo.numMultiPolys=r.length,Wo.type===`difference`){let e=r[0],t=1;for(;t<r.length;)Ao(r[t].bbox,e.bbox)===null?r.splice(t,1):t++}if(Wo.type===`intersection`)for(let e=0,t=r.length;e<t;e++){let t=r[e];for(let n=e+1,i=r.length;n<i;n++)if(Ao(t.bbox,r[n].bbox)===null)return[]}let i=new vo(zo.compare);for(let e=0,t=r.length;e<t;e++){let t=r[e].getSweepEvents();for(let e=0,n=t.length;e<n;e++)i.add(t[e])}let a=new Uo(i),o=null;for(i.size!=0&&(o=i.first(),i.delete(o));o;){let e=a.process(o);for(let t=0,n=e.length;t<n;t++){let n=e[t];n.consumedBy===void 0&&i.add(n)}i.size==0?o=null:(o=i.first(),i.delete(o))}return Oo.reset(),new Ho(Bo.factory(a.segments)).getGeom()}},Go=Wo,Ko=0,qo=class e{id;leftSE;rightSE;rings;windings;ringOut;consumedBy;prev;_prevInResult;_beforeState;_afterState;_isInResult;static compare(e,t){let n=e.leftSE.point.x,r=t.leftSE.point.x,i=e.rightSE.point.x,a=t.rightSE.point.x;if(a.isLessThan(n))return 1;if(i.isLessThan(r))return-1;let o=e.leftSE.point.y,s=t.leftSE.point.y,c=e.rightSE.point.y,l=t.rightSE.point.y;if(n.isLessThan(r)){if(s.isLessThan(o)&&s.isLessThan(c))return 1;if(s.isGreaterThan(o)&&s.isGreaterThan(c))return-1;let n=e.comparePoint(t.leftSE.point);if(n<0)return 1;if(n>0)return-1;let r=t.comparePoint(e.rightSE.point);return r===0?-1:r}if(n.isGreaterThan(r)){if(o.isLessThan(s)&&o.isLessThan(l))return-1;if(o.isGreaterThan(s)&&o.isGreaterThan(l))return 1;let n=t.comparePoint(e.leftSE.point);if(n!==0)return n;let r=e.comparePoint(t.rightSE.point);return r<0?1:r>0?-1:1}if(o.isLessThan(s))return-1;if(o.isGreaterThan(s))return 1;if(i.isLessThan(a)){let n=t.comparePoint(e.rightSE.point);if(n!==0)return n}if(i.isGreaterThan(a)){let n=e.comparePoint(t.rightSE.point);if(n<0)return 1;if(n>0)return-1}if(!i.eq(a)){let e=c.minus(o),t=i.minus(n),u=l.minus(s),d=a.minus(r);if(e.isGreaterThan(t)&&u.isLessThan(d))return 1;if(e.isLessThan(t)&&u.isGreaterThan(d))return-1}return i.isGreaterThan(a)?1:i.isLessThan(a)||c.isLessThan(l)?-1:c.isGreaterThan(l)?1:e.id<t.id?-1:e.id>t.id?1:0}constructor(e,t,n,r){this.id=++Ko,this.leftSE=e,e.segment=this,e.otherSE=t,this.rightSE=t,t.segment=this,t.otherSE=e,this.rings=n,this.windings=r}static fromRing(t,n,r){let i,a,o,s=zo.comparePoints(t,n);if(s<0)i=t,a=n,o=1;else if(s>0)i=n,a=t,o=-1;else throw Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);return new e(new zo(i,!0),new zo(a,!1),[r],[o])}replaceRightSE(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let e=this.leftSE.point.y,t=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e.isLessThan(t)?e:t},ur:{x:this.rightSE.point.x,y:e.isGreaterThan(t)?e:t}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(e){return e.x.eq(this.leftSE.point.x)&&e.y.eq(this.leftSE.point.y)||e.x.eq(this.rightSE.point.x)&&e.y.eq(this.rightSE.point.y)}comparePoint(e){return Oo.orient(this.leftSE.point,e,this.rightSE.point)}getIntersection(e){let t=this.bbox(),n=e.bbox(),r=Ao(t,n);if(r===null)return null;let i=this.leftSE.point,a=this.rightSE.point,o=e.leftSE.point,s=e.rightSE.point,c=ko(t,o)&&this.comparePoint(o)===0,l=ko(n,i)&&e.comparePoint(i)===0,u=ko(t,s)&&this.comparePoint(s)===0,d=ko(n,a)&&e.comparePoint(a)===0;if(l&&c)return d&&!u?a:!d&&u?s:null;if(l)return u&&i.x.eq(s.x)&&i.y.eq(s.y)?null:i;if(c)return d&&a.x.eq(o.x)&&a.y.eq(o.y)?null:o;if(d&&u)return null;if(d)return a;if(u)return s;let f=Ro(i,this.vector(),o,e.vector());return f===null||!ko(r,f)?null:Oo.snap(f)}split(t){let n=[],r=t.events!==void 0,i=new zo(t,!0),a=new zo(t,!1),o=this.rightSE;this.replaceRightSE(a),n.push(a),n.push(i);let s=new e(i,o,this.rings.slice(),this.windings.slice());return zo.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),zo.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),a.checkForConsuming()),n}swapEvents(){let e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let e=0,t=this.windings.length;e<t;e++)this.windings[e]*=-1}consume(t){let n=this,r=t;for(;n.consumedBy;)n=n.consumedBy;for(;r.consumedBy;)r=r.consumedBy;let i=e.compare(n,r);if(i!==0){if(i>0){let e=n;n=r,r=e}if(n.prev===r){let e=n;n=r,r=e}for(let e=0,t=r.rings.length;e<t;e++){let t=r.rings[e],i=r.windings[e],a=n.rings.indexOf(t);a===-1?(n.rings.push(t),n.windings.push(i)):n.windings[a]+=i}r.rings=null,r.windings=null,r.consumedBy=n,r.leftSE.consumedBy=n.leftSE,r.rightSE.consumedBy=n.rightSE}}prevInResult(){return this._prevInResult===void 0&&(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}beforeState(){return this._beforeState===void 0&&(this.prev?this._beforeState=(this.prev.consumedBy||this.prev).afterState():this._beforeState={rings:[],windings:[],multiPolys:[]}),this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let e=this.beforeState();this._afterState={rings:e.rings.slice(0),windings:e.windings.slice(0),multiPolys:[]};let t=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys;for(let e=0,r=this.rings.length;e<r;e++){let r=this.rings[e],i=this.windings[e],a=t.indexOf(r);a===-1?(t.push(r),n.push(i)):n[a]+=i}let i=[],a=[];for(let e=0,r=t.length;e<r;e++){if(n[e]===0)continue;let r=t[e],o=r.poly;if(a.indexOf(o)===-1)if(r.isExterior)i.push(o);else{a.indexOf(o)===-1&&a.push(o);let e=i.indexOf(r.poly);e!==-1&&i.splice(e,1)}}for(let e=0,t=i.length;e<t;e++){let t=i[e].multiPoly;r.indexOf(t)===-1&&r.push(t)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let e=this.beforeState().multiPolys,t=this.afterState().multiPolys;switch(Go.type){case`union`:this._isInResult=e.length===0!=(t.length===0);break;case`intersection`:{let n,r;e.length<t.length?(n=e.length,r=t.length):(n=t.length,r=e.length),this._isInResult=r===Go.numMultiPolys&&n<r;break}case`xor`:this._isInResult=Math.abs(e.length-t.length)%2==1;break;case`difference`:{let n=e=>e.length===1&&e[0].isSubject;this._isInResult=n(e)!==n(t);break}}return this._isInResult}},Jo=class{poly;isExterior;segments;bbox;constructor(e,t,n){if(!Array.isArray(e)||e.length===0||(this.poly=t,this.isExterior=n,this.segments=[],typeof e[0][0]!=`number`||typeof e[0][1]!=`number`))throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);let r=Oo.snap({x:new mo(e[0][0]),y:new mo(e[0][1])});this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let i=r;for(let t=1,n=e.length;t<n;t++){if(typeof e[t][0]!=`number`||typeof e[t][1]!=`number`)throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);let n=Oo.snap({x:new mo(e[t][0]),y:new mo(e[t][1])});n.x.eq(i.x)&&n.y.eq(i.y)||(this.segments.push(qo.fromRing(i,n,this)),n.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.x),n.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.y),n.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.x),n.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.y),i=n)}(!r.x.eq(i.x)||!r.y.eq(i.y))&&this.segments.push(qo.fromRing(i,r,this))}getSweepEvents(){let e=[];for(let t=0,n=this.segments.length;t<n;t++){let n=this.segments[t];e.push(n.leftSE),e.push(n.rightSE)}return e}},Yo=class{multiPoly;exteriorRing;interiorRings;bbox;constructor(e,t){if(!Array.isArray(e))throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);this.exteriorRing=new Jo(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let t=1,n=e.length;t<n;t++){let n=new Jo(e[t],this,!1);n.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.bbox.ur.y),this.interiorRings.push(n)}this.multiPoly=t}getSweepEvents(){let e=this.exteriorRing.getSweepEvents();for(let t=0,n=this.interiorRings.length;t<n;t++){let n=this.interiorRings[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}},Xo=class{isSubject;polys;bbox;constructor(e,t){if(!Array.isArray(e))throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);try{typeof e[0][0][0]==`number`&&(e=[e])}catch{}this.polys=[],this.bbox={ll:{x:new mo(1/0),y:new mo(1/0)},ur:{x:new mo(-1/0),y:new mo(-1/0)}};for(let t=0,n=e.length;t<n;t++){let n=new Yo(e[t],this);n.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.bbox.ur.y),this.polys.push(n)}this.isSubject=t}getSweepEvents(){let e=[];for(let t=0,n=this.polys.length;t<n;t++){let n=this.polys[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}},Zo=(e,...t)=>Go.run(`intersection`,e,t);Oo.set;function Qo(e,t={}){let n=[];if(ii(e,e=>{n.push(e.coordinates)}),n.length<2)throw Error(`Must specify at least 2 geometries`);let r=Zo(n[0],...n.slice(1));return r.length===0?null:r.length===1?Qr(r[0],t.properties):ni(r,t.properties)}var J=1e-6,Y=Math.PI,$o=Y/2,es=Y/4,ts=Y*2,ns=180/Y,X=Y/180,Z=Math.abs,rs=Math.atan,is=Math.atan2,Q=Math.cos,as=Math.ceil,os=Math.exp,ss=Math.log,$=Math.sin,cs=Math.sign||function(e){return e>0?1:e<0?-1:0},ls=Math.sqrt,us=Math.tan;function ds(e){return e>1?0:e<-1?Y:Math.acos(e)}function fs(e){return e>1?$o:e<-1?-$o:Math.asin(e)}function ps(){}function ms(e,t){e&&gs.hasOwnProperty(e.type)&&gs[e.type](e,t)}var hs={Feature:function(e,t){ms(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)ms(n[r].geometry,t)}},gs={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){_s(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)_s(n[r],t,0)},Polygon:function(e,t){vs(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)vs(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)ms(n[r],t)}};function _s(e,t,n){var r=-1,i=e.length-n,a;for(t.lineStart();++r<i;)a=e[r],t.point(a[0],a[1],a[2]);t.lineEnd()}function vs(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)_s(e[n],t,1);t.polygonEnd()}function ys(e,t){e&&hs.hasOwnProperty(e.type)?hs[e.type](e,t):ms(e,t)}function bs(e){return[is(e[1],e[0]),fs(e[2])]}function xs(e){var t=e[0],n=e[1],r=Q(n);return[r*Q(t),r*$(t),$(n)]}function Ss(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Cs(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function ws(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Ts(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Es(e){var t=ls(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function Ds(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return n=t.invert(n,r),n&&e.invert(n[0],n[1])}),n}function Os(e,t){return Z(e)>Y&&(e-=Math.round(e/ts)*ts),[e,t]}Os.invert=Os;function ks(e,t,n){return(e%=ts)?t||n?Ds(js(e),Ms(t,n)):js(e):t||n?Ms(t,n):Os}function As(e){return function(t,n){return t+=e,Z(t)>Y&&(t-=Math.round(t/ts)*ts),[t,n]}}function js(e){var t=As(e);return t.invert=As(-e),t}function Ms(e,t){var n=Q(e),r=$(e),i=Q(t),a=$(t);function o(e,t){var o=Q(t),s=Q(e)*o,c=$(e)*o,l=$(t),u=l*n+s*r;return[is(c*i-u*a,s*n-l*r),fs(u*i+c*a)]}return o.invert=function(e,t){var o=Q(t),s=Q(e)*o,c=$(e)*o,l=$(t),u=l*i-c*a;return[is(c*i+l*a,s*n+u*r),fs(u*n-s*r)]},o}function Ns(e){e=ks(e[0]*X,e[1]*X,e.length>2?e[2]*X:0);function t(t){return t=e(t[0]*X,t[1]*X),t[0]*=ns,t[1]*=ns,t}return t.invert=function(t){return t=e.invert(t[0]*X,t[1]*X),t[0]*=ns,t[1]*=ns,t},t}function Ps(e,t,n,r,i,a){if(n){var o=Q(t),s=$(t),c=r*n;i==null?(i=t+r*ts,a=t-c/2):(i=Fs(o,i),a=Fs(o,a),(r>0?i<a:i>a)&&(i+=r*ts));for(var l,u=i;r>0?u>a:u<a;u-=c)l=bs([o,-s*Q(u),-s*$(u)]),e.point(l[0],l[1])}}function Fs(e,t){t=xs(t),t[0]-=e,Es(t);var n=ds(-t[1]);return((-t[2]<0?-n:n)+ts-J)%ts}function Is(){var e=[],t;return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:ps,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Ls(e,t){return Z(e[0]-t[0])<1e-6&&Z(e[1]-t[1])<1e-6}function Rs(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function zs(e,t,n,r,i){var a=[],o=[],s,c;if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n=e[0],r=e[t],c;if(Ls(n,r)){if(!n[2]&&!r[2]){for(i.lineStart(),s=0;s<t;++s)i.point((n=e[s])[0],n[1]);i.lineEnd();return}r[0]+=2*J}a.push(c=new Rs(n,e,null,!0)),o.push(c.o=new Rs(n,null,c,!1)),a.push(c=new Rs(r,e,null,!1)),o.push(c.o=new Rs(r,null,c,!0))}}),a.length){for(o.sort(t),Bs(a),Bs(o),s=0,c=o.length;s<c;++s)o[s].e=n=!n;for(var l=a[0],u,d;;){for(var f=l,p=!0;f.v;)if((f=f.n)===l)return;u=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(p)for(s=0,c=u.length;s<c;++s)i.point((d=u[s])[0],d[1]);else r(f.x,f.n.x,1,i);f=f.n}else{if(p)for(u=f.p.z,s=u.length-1;s>=0;--s)i.point((d=u[s])[0],d[1]);else r(f.x,f.p.x,-1,i);f=f.p}f=f.o,u=f.z,p=!p}while(!f.v);i.lineEnd()}}}function Bs(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n<t;)r.n=i=e[n],i.p=r,r=i;r.n=i=e[0],i.p=r}}function Vs(e){return Z(e[0])<=Y?e[0]:cs(e[0])*((Z(e[0])+Y)%ts-Y)}function Hs(e,t){var n=Vs(t),r=t[1],i=$(r),a=[$(n),-Q(n),0],o=0,s=0,c=new mt;i===1?r=$o+J:i===-1&&(r=-$o-J);for(var l=0,u=e.length;l<u;++l)if(f=(d=e[l]).length)for(var d,f,p=d[f-1],m=Vs(p),h=p[1]/2+es,g=$(h),_=Q(h),v=0;v<f;++v,m=b,g=S,_=C,p=y){var y=d[v],b=Vs(y),x=y[1]/2+es,S=$(x),C=Q(x),w=b-m,T=w>=0?1:-1,E=T*w,D=E>Y,O=g*S;if(c.add(is(O*T*$(E),_*C+O*Q(E))),o+=D?w+T*ts:w,D^m>=n^b>=n){var k=Cs(xs(p),xs(y));Es(k);var A=Cs(a,k);Es(A);var j=(D^w>=0?-1:1)*fs(A[2]);(r>j||r===j&&(k[0]||k[1]))&&(s+=D^w>=0?1:-1)}}return(o<-1e-6||o<1e-6&&c<-1e-12)^s&1}function Us(e,t,n,r){return function(i){var a=t(i),o=Is(),s=t(o),c=!1,l,u,d,f={point:p,lineStart:h,lineEnd:g,polygonStart:function(){f.point=_,f.lineStart=v,f.lineEnd=y,u=[],l=[]},polygonEnd:function(){f.point=p,f.lineStart=h,f.lineEnd=g,u=kt(u);var e=Hs(l,r);u.length?(c||=(i.polygonStart(),!0),zs(u,Gs,e,n,i)):e&&(c||=(i.polygonStart(),!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&=(i.polygonEnd(),!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function p(t,n){e(t,n)&&i.point(t,n)}function m(e,t){a.point(e,t)}function h(){f.point=m,a.lineStart()}function g(){f.point=p,a.lineEnd()}function _(e,t){d.push([e,t]),s.point(e,t)}function v(){s.lineStart(),d=[]}function y(){_(d[0][0],d[0][1]),s.lineEnd();var e=s.clean(),t=o.result(),n,r=t.length,a,f,p;if(d.pop(),l.push(d),d=null,r){if(e&1){if(f=t[0],(a=f.length-1)>0){for(c||=(i.polygonStart(),!0),i.lineStart(),n=0;n<a;++n)i.point((p=f[n])[0],p[1]);i.lineEnd()}return}r>1&&e&2&&t.push(t.pop().concat(t.shift())),u.push(t.filter(Ws))}}return f}}function Ws(e){return e.length>1}function Gs(e,t){return((e=e.x)[0]<0?e[1]-$o-J:$o-e[1])-((t=t.x)[0]<0?t[1]-$o-J:$o-t[1])}var Ks=Us(function(){return!0},qs,Ys,[-Y,-$o]);function qs(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(a,o){var s=a>0?Y:-Y,c=Z(a-t);Z(c-Y)<1e-6?(e.point(t,n=(n+o)/2>0?$o:-$o),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),e.point(a,n),i=0):r!==s&&c>=Y&&(Z(t-r)<1e-6&&(t-=r*J),Z(a-s)<1e-6&&(a-=s*J),n=Js(t,n,a,o),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),i=0),e.point(t=a,n=o),r=s},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function Js(e,t,n,r){var i,a,o=$(e-n);return Z(o)>1e-6?rs(($(t)*(a=Q(r))*$(n)-$(r)*(i=Q(t))*$(e))/(i*a*o)):(t+r)/2}function Ys(e,t,n,r){var i;if(e==null)i=n*$o,r.point(-Y,i),r.point(0,i),r.point(Y,i),r.point(Y,0),r.point(Y,-i),r.point(0,-i),r.point(-Y,-i),r.point(-Y,0),r.point(-Y,i);else if(Z(e[0]-t[0])>1e-6){var a=e[0]<t[0]?Y:-Y;i=n*a/2,r.point(-a,i),r.point(0,i),r.point(a,i)}else r.point(t[0],t[1])}function Xs(e){var t=Q(e),n=2*X,r=t>0,i=Z(t)>J;function a(t,r,i,a){Ps(a,e,n,i,t,r)}function o(e,n){return Q(e)*Q(n)>t}function s(e){var t,n,a,s,u;return{lineStart:function(){s=a=!1,u=1},point:function(d,f){var p=[d,f],m,h=o(d,f),g=r?h?0:l(d,f):h?l(d+(d<0?Y:-Y),f):0;if(!t&&(s=a=h)&&e.lineStart(),h!==a&&(m=c(t,p),(!m||Ls(t,m)||Ls(p,m))&&(p[2]=1)),h!==a)u=0,h?(e.lineStart(),m=c(p,t),e.point(m[0],m[1])):(m=c(t,p),e.point(m[0],m[1],2),e.lineEnd()),t=m;else if(i&&t&&r^h){var _;!(g&n)&&(_=c(p,t,!0))&&(u=0,r?(e.lineStart(),e.point(_[0][0],_[0][1]),e.point(_[1][0],_[1][1]),e.lineEnd()):(e.point(_[1][0],_[1][1]),e.lineEnd(),e.lineStart(),e.point(_[0][0],_[0][1],3)))}h&&(!t||!Ls(t,p))&&e.point(p[0],p[1]),t=p,a=h,n=g},lineEnd:function(){a&&e.lineEnd(),t=null},clean:function(){return u|(s&&a)<<1}}}function c(e,n,r){var i=xs(e),a=xs(n),o=[1,0,0],s=Cs(i,a),c=Ss(s,s),l=s[0],u=c-l*l;if(!u)return!r&&e;var d=t*c/u,f=-t*l/u,p=Cs(o,s),m=Ts(o,d);ws(m,Ts(s,f));var h=p,g=Ss(m,h),_=Ss(h,h),v=g*g-_*(Ss(m,m)-1);if(!(v<0)){var y=ls(v),b=Ts(h,(-g-y)/_);if(ws(b,m),b=bs(b),!r)return b;var x=e[0],S=n[0],C=e[1],w=n[1],T;S<x&&(T=x,x=S,S=T);var E=S-x,D=Z(E-Y)<J,O=D||E<1e-6;if(!D&&w<C&&(T=C,C=w,w=T),O?D?C+w>0^b[1]<(Z(b[0]-x)<1e-6?C:w):C<=b[1]&&b[1]<=w:E>Y^(x<=b[0]&&b[0]<=S)){var k=Ts(h,(-g+y)/_);return ws(k,m),[b,bs(k)]}}}function l(t,n){var i=r?e:Y-e,a=0;return t<-i?a|=1:t>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}return Us(o,s,a,r?[0,-e]:[-Y,e-Y])}function Zs(e,t,n,r,i,a){var o=e[0],s=e[1],c=t[0],l=t[1],u=0,d=1,f=c-o,p=l-s,m=n-o;if(!(!f&&m>0)){if(m/=f,f<0){if(m<u)return;m<d&&(d=m)}else if(f>0){if(m>d)return;m>u&&(u=m)}if(m=i-o,!(!f&&m<0)){if(m/=f,f<0){if(m>d)return;m>u&&(u=m)}else if(f>0){if(m<u)return;m<d&&(d=m)}if(m=r-s,!(!p&&m>0)){if(m/=p,p<0){if(m<u)return;m<d&&(d=m)}else if(p>0){if(m>d)return;m>u&&(u=m)}if(m=a-s,!(!p&&m<0)){if(m/=p,p<0){if(m>d)return;m>u&&(u=m)}else if(p>0){if(m<u)return;m<d&&(d=m)}return u>0&&(e[0]=o+u*f,e[1]=s+u*p),d<1&&(t[0]=o+d*f,t[1]=s+d*p),!0}}}}}var Qs=1e9,$s=-Qs;function ec(e,t,n,r){function i(i,a){return e<=i&&i<=n&&t<=a&&a<=r}function a(i,a,s,l){var u=0,d=0;if(i==null||(u=o(i,s))!==(d=o(a,s))||c(i,a)<0^s>0)do l.point(u===0||u===3?e:n,u>1?r:t);while((u=(u+s+4)%4)!==d);else l.point(a[0],a[1])}function o(r,i){return Z(r[0]-e)<1e-6?i>0?0:3:Z(r[0]-n)<1e-6?i>0?2:1:Z(r[1]-t)<1e-6?i>0?1:0:i>0?3:2}function s(e,t){return c(e.x,t.x)}function c(e,t){var n=o(e,1),r=o(t,1);return n===r?n===0?t[1]-e[1]:n===1?e[0]-t[0]:n===2?e[1]-t[1]:t[0]-e[0]:n-r}return function(o){var c=o,l=Is(),u,d,f,p,m,h,g,_,v,y,b,x={point:S,lineStart:E,lineEnd:D,polygonStart:w,polygonEnd:T};function S(e,t){i(e,t)&&c.point(e,t)}function C(){for(var t=0,n=0,i=d.length;n<i;++n)for(var a=d[n],o=1,s=a.length,c=a[0],l,u,f=c[0],p=c[1];o<s;++o)l=f,u=p,c=a[o],f=c[0],p=c[1],u<=r?p>r&&(f-l)*(r-u)>(p-u)*(e-l)&&++t:p<=r&&(f-l)*(r-u)<(p-u)*(e-l)&&--t;return t}function w(){c=l,u=[],d=[],b=!0}function T(){var e=C(),t=b&&e,n=(u=kt(u)).length;(t||n)&&(o.polygonStart(),t&&(o.lineStart(),a(null,null,1,o),o.lineEnd()),n&&zs(u,s,e,a,o),o.polygonEnd()),c=o,u=d=f=null}function E(){x.point=O,d&&d.push(f=[]),y=!0,v=!1,g=_=NaN}function D(){u&&(O(p,m),h&&v&&l.rejoin(),u.push(l.result())),x.point=S,v&&c.lineEnd()}function O(a,o){var s=i(a,o);if(d&&f.push([a,o]),y)p=a,m=o,h=s,y=!1,s&&(c.lineStart(),c.point(a,o));else if(s&&v)c.point(a,o);else{var l=[g=Math.max($s,Math.min(Qs,g)),_=Math.max($s,Math.min(Qs,_))],u=[a=Math.max($s,Math.min(Qs,a)),o=Math.max($s,Math.min(Qs,o))];Zs(l,u,e,t,n,r)?(v||(c.lineStart(),c.point(l[0],l[1])),c.point(u[0],u[1]),s||c.lineEnd(),b=!1):s&&(c.lineStart(),c.point(a,o),b=!1)}g=a,_=o,v=s}return x}}function tc(e,t,n){var r=At(e,t-J,n).concat(t);return function(e){return r.map(function(t){return[e,t]})}}function nc(e,t,n){var r=At(e,t-J,n).concat(t);return function(e){return r.map(function(t){return[t,e]})}}function rc(){var e,t,n,r,i,a,o,s,c=10,l=c,u=90,d=360,f,p,m,h,g=2.5;function _(){return{type:`MultiLineString`,coordinates:v()}}function v(){return At(as(r/u)*u,n,u).map(m).concat(At(as(s/d)*d,o,d).map(h)).concat(At(as(t/c)*c,e,c).filter(function(e){return Z(e%u)>J}).map(f)).concat(At(as(a/l)*l,i,l).filter(function(e){return Z(e%d)>J}).map(p))}return _.lines=function(){return v().map(function(e){return{type:`LineString`,coordinates:e}})},_.outline=function(){return{type:`Polygon`,coordinates:[m(r).concat(h(o).slice(1),m(n).reverse().slice(1),h(s).reverse().slice(1))]}},_.extent=function(e){return arguments.length?_.extentMajor(e).extentMinor(e):_.extentMinor()},_.extentMajor=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],s=+e[0][1],o=+e[1][1],r>n&&(e=r,r=n,n=e),s>o&&(e=s,s=o,o=e),_.precision(g)):[[r,s],[n,o]]},_.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],a=+n[0][1],i=+n[1][1],t>e&&(n=t,t=e,e=n),a>i&&(n=a,a=i,i=n),_.precision(g)):[[t,a],[e,i]]},_.step=function(e){return arguments.length?_.stepMajor(e).stepMinor(e):_.stepMinor()},_.stepMajor=function(e){return arguments.length?(u=+e[0],d=+e[1],_):[u,d]},_.stepMinor=function(e){return arguments.length?(c=+e[0],l=+e[1],_):[c,l]},_.precision=function(c){return arguments.length?(g=+c,f=tc(a,i,90),p=nc(t,e,g),m=tc(s,o,90),h=nc(r,n,g),_):g},_.extentMajor([[-180,-90+J],[180,90-J]]).extentMinor([[-180,-80-J],[180,80+J]])}var ic=e=>e,ac=new mt,oc=new mt,sc,cc,lc,uc,dc={point:ps,lineStart:ps,lineEnd:ps,polygonStart:function(){dc.lineStart=fc,dc.lineEnd=hc},polygonEnd:function(){dc.lineStart=dc.lineEnd=dc.point=ps,ac.add(Z(oc)),oc=new mt},result:function(){var e=ac/2;return ac=new mt,e}};function fc(){dc.point=pc}function pc(e,t){dc.point=mc,sc=lc=e,cc=uc=t}function mc(e,t){oc.add(uc*e-lc*t),lc=e,uc=t}function hc(){mc(sc,cc)}var gc=1/0,_c=gc,vc=-gc,yc=vc,bc={point:xc,lineStart:ps,lineEnd:ps,polygonStart:ps,polygonEnd:ps,result:function(){var e=[[gc,_c],[vc,yc]];return vc=yc=-(_c=gc=1/0),e}};function xc(e,t){e<gc&&(gc=e),e>vc&&(vc=e),t<_c&&(_c=t),t>yc&&(yc=t)}var Sc=0,Cc=0,wc=0,Tc=0,Ec=0,Dc=0,Oc=0,kc=0,Ac=0,jc,Mc,Nc,Pc,Fc={point:Ic,lineStart:Lc,lineEnd:Bc,polygonStart:function(){Fc.lineStart=Vc,Fc.lineEnd=Hc},polygonEnd:function(){Fc.point=Ic,Fc.lineStart=Lc,Fc.lineEnd=Bc},result:function(){var e=Ac?[Oc/Ac,kc/Ac]:Dc?[Tc/Dc,Ec/Dc]:wc?[Sc/wc,Cc/wc]:[NaN,NaN];return Sc=Cc=wc=Tc=Ec=Dc=Oc=kc=Ac=0,e}};function Ic(e,t){Sc+=e,Cc+=t,++wc}function Lc(){Fc.point=Rc}function Rc(e,t){Fc.point=zc,Ic(Nc=e,Pc=t)}function zc(e,t){var n=e-Nc,r=t-Pc,i=ls(n*n+r*r);Tc+=i*(Nc+e)/2,Ec+=i*(Pc+t)/2,Dc+=i,Ic(Nc=e,Pc=t)}function Bc(){Fc.point=Ic}function Vc(){Fc.point=Uc}function Hc(){Wc(jc,Mc)}function Uc(e,t){Fc.point=Wc,Ic(jc=Nc=e,Mc=Pc=t)}function Wc(e,t){var n=e-Nc,r=t-Pc,i=ls(n*n+r*r);Tc+=i*(Nc+e)/2,Ec+=i*(Pc+t)/2,Dc+=i,i=Pc*e-Nc*t,Oc+=i*(Nc+e),kc+=i*(Pc+t),Ac+=i*3,Ic(Nc=e,Pc=t)}function Gc(e){this._context=e}Gc.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,ts);break}},result:ps};var Kc=new mt,qc,Jc,Yc,Xc,Zc,Qc={point:ps,lineStart:function(){Qc.point=$c},lineEnd:function(){qc&&el(Jc,Yc),Qc.point=ps},polygonStart:function(){qc=!0},polygonEnd:function(){qc=null},result:function(){var e=+Kc;return Kc=new mt,e}};function $c(e,t){Qc.point=el,Jc=Xc=e,Yc=Zc=t}function el(e,t){Xc-=e,Zc-=t,Kc.add(ls(Xc*Xc+Zc*Zc)),Xc=e,Zc=t}var tl,nl,rl,il,al=class{constructor(e){this._append=e==null?ol:sl(e),this._radius=4.5,this._=``}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+=`Z`),this._point=NaN}point(e,t){switch(this._point){case 0:this._append`M${e},${t}`,this._point=1;break;case 1:this._append`L${e},${t}`;break;default:if(this._append`M${e},${t}`,this._radius!==rl||this._append!==nl){let e=this._radius,t=this._;this._=``,this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,rl=e,nl=this._append,il=this._,this._=t}this._+=il;break}}result(){let e=this._;return this._=``,e.length?e:null}};function ol(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function sl(e){let t=Math.floor(e);if(!(t>=0))throw RangeError(`invalid digits: ${e}`);if(t>15)return ol;if(t!==tl){let e=10**t;tl=t,nl=function(t){let n=1;this._+=t[0];for(let r=t.length;n<r;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}return nl}function cl(e,t){let n=3,r=4.5,i,a;function o(e){return e&&(typeof r==`function`&&a.pointRadius(+r.apply(this,arguments)),ys(e,i(a))),a.result()}return o.area=function(e){return ys(e,i(dc)),dc.result()},o.measure=function(e){return ys(e,i(Qc)),Qc.result()},o.bounds=function(e){return ys(e,i(bc)),bc.result()},o.centroid=function(e){return ys(e,i(Fc)),Fc.result()},o.projection=function(t){return arguments.length?(i=t==null?(e=null,ic):(e=t).stream,o):e},o.context=function(e){return arguments.length?(a=e==null?(t=null,new al(n)):new Gc(t=e),typeof r!=`function`&&a.pointRadius(r),o):t},o.pointRadius=function(e){return arguments.length?(r=typeof e==`function`?e:(a.pointRadius(+e),+e),o):r},o.digits=function(e){if(!arguments.length)return n;if(e==null)n=null;else{let t=Math.floor(e);if(!(t>=0))throw RangeError(`invalid digits: ${e}`);n=t}return t===null&&(a=new al(n)),o},o.projection(e).digits(n).context(t)}function ll(e){return function(t){var n=new ul;for(var r in e)n[r]=e[r];return n.stream=t,n}}function ul(){}ul.prototype={constructor:ul,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function dl(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),ys(n,e.stream(bc)),t(bc.result()),r!=null&&e.clipExtent(r),e}function fl(e,t,n){return dl(e,function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),o=+t[0][0]+(r-a*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(i-a*(n[1][1]+n[0][1]))/2;e.scale(150*a).translate([o,s])},n)}function pl(e,t,n){return fl(e,[[0,0],t],n)}function ml(e,t,n){return dl(e,function(n){var r=+t,i=r/(n[1][0]-n[0][0]),a=(r-i*(n[1][0]+n[0][0]))/2,o=-i*n[0][1];e.scale(150*i).translate([a,o])},n)}function hl(e,t,n){return dl(e,function(n){var r=+t,i=r/(n[1][1]-n[0][1]),a=-i*n[0][0],o=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([a,o])},n)}var gl=16,_l=Q(30*X);function vl(e,t){return+t?bl(e,t):yl(e)}function yl(e){return ll({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function bl(e,t){function n(r,i,a,o,s,c,l,u,d,f,p,m,h,g){var _=l-r,v=u-i,y=_*_+v*v;if(y>4*t&&h--){var b=o+f,x=s+p,S=c+m,C=ls(b*b+x*x+S*S),w=fs(S/=C),T=Z(Z(S)-1)<1e-6||Z(a-d)<1e-6?(a+d)/2:is(x,b),E=e(T,w),D=E[0],O=E[1],k=D-r,A=O-i,j=v*k-_*A;(j*j/y>t||Z((_*k+v*A)/y-.5)>.3||o*f+s*p+c*m<_l)&&(n(r,i,a,o,s,c,D,O,T,b/=C,x/=C,S,h,g),g.point(D,O),n(D,O,T,b,x,S,l,u,d,f,p,m,h,g))}}return function(t){var r,i,a,o,s,c,l,u,d,f,p,m,h={point:g,lineStart:_,lineEnd:y,polygonStart:function(){t.polygonStart(),h.lineStart=b},polygonEnd:function(){t.polygonEnd(),h.lineStart=_}};function g(n,r){n=e(n,r),t.point(n[0],n[1])}function _(){u=NaN,h.point=v,t.lineStart()}function v(r,i){var a=xs([r,i]),o=e(r,i);n(u,d,l,f,p,m,u=o[0],d=o[1],l=r,f=a[0],p=a[1],m=a[2],gl,t),t.point(u,d)}function y(){h.point=g,t.lineEnd()}function b(){_(),h.point=x,h.lineEnd=S}function x(e,t){v(r=e,t),i=u,a=d,o=f,s=p,c=m,h.point=v}function S(){n(u,d,l,f,p,m,i,a,r,o,s,c,gl,t),h.lineEnd=y,y()}return h}}var xl=ll({point:function(e,t){this.stream.point(e*X,t*X)}});function Sl(e){return ll({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function Cl(e,t,n,r,i){function a(a,o){return a*=r,o*=i,[t+e*a,n-e*o]}return a.invert=function(a,o){return[(a-t)/e*r,(n-o)/e*i]},a}function wl(e,t,n,r,i,a){if(!a)return Cl(e,t,n,r,i);var o=Q(a),s=$(a),c=o*e,l=s*e,u=o/e,d=s/e,f=(s*n-o*t)/e,p=(s*t+o*n)/e;function m(e,a){return e*=r,a*=i,[c*e-l*a+t,n-l*e-c*a]}return m.invert=function(e,t){return[r*(u*e-d*t+f),i*(p-d*e-u*t)]},m}function Tl(e){return El(function(){return e})()}function El(e){var t,n=150,r=480,i=250,a=0,o=0,s=0,c=0,l=0,u,d=0,f=1,p=1,m=null,h=Ks,g=null,_,v,y,b=ic,x=.5,S,C,w,T,E;function D(e){return w(e[0]*X,e[1]*X)}function O(e){return e=w.invert(e[0],e[1]),e&&[e[0]*ns,e[1]*ns]}D.stream=function(e){return T&&E===e?T:T=xl(Sl(u)(h(S(b(E=e)))))},D.preclip=function(e){return arguments.length?(h=e,m=void 0,A()):h},D.postclip=function(e){return arguments.length?(b=e,g=_=v=y=null,A()):b},D.clipAngle=function(e){return arguments.length?(h=+e?Xs(m=e*X):(m=null,Ks),A()):m*ns},D.clipExtent=function(e){return arguments.length?(b=e==null?(g=_=v=y=null,ic):ec(g=+e[0][0],_=+e[0][1],v=+e[1][0],y=+e[1][1]),A()):g==null?null:[[g,_],[v,y]]},D.scale=function(e){return arguments.length?(n=+e,k()):n},D.translate=function(e){return arguments.length?(r=+e[0],i=+e[1],k()):[r,i]},D.center=function(e){return arguments.length?(a=e[0]%360*X,o=e[1]%360*X,k()):[a*ns,o*ns]},D.rotate=function(e){return arguments.length?(s=e[0]%360*X,c=e[1]%360*X,l=e.length>2?e[2]%360*X:0,k()):[s*ns,c*ns,l*ns]},D.angle=function(e){return arguments.length?(d=e%360*X,k()):d*ns},D.reflectX=function(e){return arguments.length?(f=e?-1:1,k()):f<0},D.reflectY=function(e){return arguments.length?(p=e?-1:1,k()):p<0},D.precision=function(e){return arguments.length?(S=vl(C,x=e*e),A()):ls(x)},D.fitExtent=function(e,t){return fl(D,e,t)},D.fitSize=function(e,t){return pl(D,e,t)},D.fitWidth=function(e,t){return ml(D,e,t)},D.fitHeight=function(e,t){return hl(D,e,t)};function k(){var e=wl(n,0,0,f,p,d).apply(null,t(a,o)),m=wl(n,r-e[0],i-e[1],f,p,d);return u=ks(s,c,l),C=Ds(t,m),w=Ds(u,C),S=vl(C,x),A()}function A(){return T=E=null,D}return function(){return t=e.apply(this,arguments),D.invert=t.invert&&O,k()}}function Dl(e){return function(t,n){var r=ls(t*t+n*n),i=e(r),a=$(i),o=Q(i);return[is(t*a,r*o),fs(r&&n*a/r)]}}function Ol(e,t){return[e,ss(us(($o+t)/2))]}Ol.invert=function(e,t){return[e,2*rs(os(t))-$o]};function kl(){return Al(Ol).scale(961/ts)}function Al(e){var t=Tl(e),n=t.center,r=t.scale,i=t.translate,a=t.clipExtent,o=null,s,c,l;t.scale=function(e){return arguments.length?(r(e),u()):r()},t.translate=function(e){return arguments.length?(i(e),u()):i()},t.center=function(e){return arguments.length?(n(e),u()):n()},t.clipExtent=function(e){return arguments.length?(e==null?o=s=c=l=null:(o=+e[0][0],s=+e[0][1],c=+e[1][0],l=+e[1][1]),u()):o==null?null:[[o,s],[c,l]]};function u(){var n=Y*r(),i=t(Ns(t.rotate()).invert([0,0]));return a(o==null?[[i[0]-n,i[1]-n],[i[0]+n,i[1]+n]]:e===Ol?[[Math.max(i[0]-n,o),s],[Math.min(i[0]+n,c),l]]:[[o,Math.max(i[1]-n,s)],[c,Math.min(i[1]+n,l)]])}return u()}function jl(e,t){return[Q(t)*$(e),$(t)]}jl.invert=Dl(fs);function Ml(){return Tl(jl).scale(249.5).clipAngle(90+J)}var Nl=100;function Pl(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=e.scale??1;i.style.flexGrow=`0`,i.style.flexShrink=`0`;let o={id:e.id,name:e.name,map:t,container:i,moveEndPosition:t.getCenter(),geoJson:void 0,isGlobe:e.isGlobe,boundingBox:e.boundingBox,scale:a,backgroundColor:e.backgroundColor??`#000000`,globeBackgroundColor:e.globeBackgroundColor??`#000000`,borderColor:e.borderColor??`#000000`,primaryFillColor:e.primaryFillColor??`#000000`,primaryStrokeColor:e.primaryStrokeColor??`#000000`,secondaryFillColor:e.secondaryFillColor??`#000000`,secondaryStrokeColor:e.secondaryStrokeColor??`#000000`,graticuleColor:e.graticuleColor??`#000000`,frameColor:e.frameColor??`#000000`,frameOutlineColor:e.frameOutlineColor??`#000000`,dotColor:e.dotColor??`#000000`,dotOutlineColor:e.dotOutlineColor??`#000000`,globeFallbackActive:!1,globeGeoJson:void 0},s=[fetch(`${n}/data/insetmaps/${e.fileName}`).then(e=>e.json()).then(e=>{o.geoJson=Ja(e,Object.keys(e.objects)[0])})];if(!e.isGlobe){let e=fetch(`${n}/data/insetmaps/world-110m.json`).then(e=>e.json()).then(e=>{o.globeGeoJson=Ja(e,Object.keys(e.objects)[0])});s.push(e)}Fl(o),r!==`interactive`&&t.on(`resize`,()=>Fl(o));let c=Promise.all(s).then(()=>Fl(o)).catch(()=>{});return t.on(`moveend`,()=>{o.moveEndPosition=t.getCenter(),(o.isGlobe||o.globeFallbackActive)&&Fl(o)}),t.on(`move`,()=>{if(!o.isGlobe){let[e,n,r,i]=o.boundingBox,a=Rl(t),s=Qo(ei([a,Qr([[[e,n],[e,i],[r,i],[r,n],[e,n]]])])),c=za(a),l=(s?za(s):0)<c*.75;o.globeFallbackActive!==l&&(o.globeFallbackActive=l,o.moveEndPosition=t.getCenter(),Fl(o))}Ll(o)}),{element:i,ready:c}}function Fl(e){let{id:t,map:n,container:r,scale:i,backgroundColor:a,globeBackgroundColor:o,secondaryFillColor:s,secondaryStrokeColor:c,primaryFillColor:l,primaryStrokeColor:u,graticuleColor:d,borderColor:f,frameColor:p,frameOutlineColor:m,dotColor:h,dotOutlineColor:g}=e,_=Nl*i,v=n.getScale();r.style.width=`${_*v}px`,r.style.height=`${_*v}px`;let y=e.globeFallbackActive&&e.globeGeoJson!==void 0,b=y?e.globeGeoJson:e.geoJson,x=y||e.isGlobe;if(b===void 0)return;let S=_/2,C=.1*i,w=[x?`<circle cx="${S}" cy="${S}" r="${S}" ${H(o)}></circle>`:`<rect x="0" y="0" width="${_}" height="${_}" ${H(a)}></rect>`],{path:T}=Il(e),E=T({...b,features:b.features.filter(e=>e.properties?.class!==`P1`)});E&&w.push(`
|
|
268
|
+
<path
|
|
269
|
+
d="${E}"
|
|
270
|
+
${H(s)}
|
|
271
|
+
${H(c,`stroke`)}
|
|
272
|
+
stroke-width="${C}"
|
|
273
|
+
></path>
|
|
274
|
+
`);let D=T({...b,features:b.features.filter(e=>e.properties?.class===`P1`)});if(D&&w.push(`
|
|
275
|
+
<path
|
|
276
|
+
d="${D}"
|
|
277
|
+
${H(l)}
|
|
278
|
+
${H(u,`stroke`)}
|
|
279
|
+
stroke-width="${C}"
|
|
280
|
+
></path>
|
|
281
|
+
`),x){let e=T(ei(rc().step([10,10]).lines().map(e=>$r(e.coordinates))));w.push(`
|
|
282
|
+
<path
|
|
283
|
+
d="${e}"
|
|
284
|
+
fill="none"
|
|
285
|
+
${H(d,`stroke`)}
|
|
286
|
+
stroke-width="${C}"
|
|
287
|
+
></path>
|
|
288
|
+
`)}w.push(`
|
|
289
|
+
<path
|
|
290
|
+
id="frame-outline-${t}"
|
|
291
|
+
fill="none"
|
|
292
|
+
${H(m,`stroke`)}
|
|
293
|
+
stroke-width="${4*i}"
|
|
294
|
+
></path>
|
|
295
|
+
`),w.push(`
|
|
296
|
+
<path
|
|
297
|
+
id="frame-${t}"
|
|
298
|
+
fill="none"
|
|
299
|
+
${H(p,`stroke`)}
|
|
300
|
+
stroke-width="${2*i}"
|
|
301
|
+
></path>
|
|
302
|
+
`),w.push(`
|
|
303
|
+
<circle
|
|
304
|
+
id="dot-${t}"
|
|
305
|
+
r="${5*i}"
|
|
306
|
+
${H(h)}
|
|
307
|
+
${H(g,`stroke`)}
|
|
308
|
+
stroke-width="${2*i}"
|
|
309
|
+
></circle>
|
|
310
|
+
`),x||w.push(`
|
|
311
|
+
<rect
|
|
312
|
+
x="${i/2}"
|
|
313
|
+
y="${i/2}"
|
|
314
|
+
width="${_-i}"
|
|
315
|
+
height="${_-i}"
|
|
316
|
+
fill="none"
|
|
317
|
+
${H(f,`stroke`)}
|
|
318
|
+
stroke-width="${i}"
|
|
319
|
+
></rect>
|
|
320
|
+
`),r.innerHTML=`
|
|
321
|
+
<svg
|
|
322
|
+
class="adornment-svg"
|
|
323
|
+
data-adornment-name="${B(e.name)}"
|
|
324
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
325
|
+
viewBox="0 0 ${_} ${_}"
|
|
326
|
+
width="${_*v}"
|
|
327
|
+
height="${_*v}"
|
|
328
|
+
>
|
|
329
|
+
${w.join(``)}
|
|
330
|
+
</svg>
|
|
331
|
+
`,Ll(e)}function Il(e){let{scale:t,boundingBox:n,moveEndPosition:r}=e,i=e.globeFallbackActive&&e.globeGeoJson!==void 0||e.isGlobe,a=Nl*t,o=cl(),s;if(i){let{lng:e,lat:t}=r;s=Ml().scale(a/2).translate([a/2,a/2]).rotate([-e,-t]).clipAngle(90)}else{s=kl().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 Ll(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=Rl(n),{path:l,projection:u}=Il(e),d=1/0,f=-1/0,p=1/0,m=-1/0,h=1/0,g=-1/0;ri(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 Rl(e){let{clientWidth:t,clientHeight:n}=e.getCanvas(),r=[];for(let n=0;n<64;n++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([I(0,t,n/64),0]);r.push([i,a])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([t,I(0,n,i/64)]);r.push([a,o])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([I(t,0,i/64),n]);r.push([a,o])}for(let t=0;t<64;t++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,I(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 zl=[10,5,3,2,1];function Bl(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 Vl(e){let t=10**Math.floor(Math.log10(e)),n=e/t;for(let e of zl)if(n>=e)return e*t;return Hl(n)*t}function Hl(e){let t=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t)/t}var Ul={kilometer:`km`,meter:`m`,mile:`mi`,foot:`ft`,nauticalMile:`nm`};function Wl(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=`Arial, sans-serif`;return{element:i,ready:n.loadReference(e.font??a,`700`).then(()=>{let o=()=>{i.innerHTML=Gl(t,e,t.getScale(),a,n)};o(),t.on(`move`,o),r!==`interactive`&&t.on(`resize`,o)})}}function Gl(e,t,n,r,i){let{maxWidth:a=100,fontSize:o=8,color:s=`#000000`,unit:c=`metric_and_imperial`}=t,l=i.resolve(t.font??r,`700`),u=e.getCenter(),d=e.project(u),f=T(u,e.unproject([d.x+a,d.y])),p=Object.fromEntries(Object.entries(Ul).map(([e,t])=>{let n=M(`meter`,e,f),r=Vl(n)||0;return[e,{value:n,ratio:n?r/n:0,humanized:r<1?`${Bl(r).join(`/`)} ${t}`:`${r} ${t}`}]})),m=p.meter.value>1e3?p.kilometer:p.meter,h=p.foot.value>5280?p.mile:p.foot,g={imperial:h,metric:m,nautical:p.nauticalMile},_=c===`metric_and_imperial`?void 0:g[c],v={metric:Math.round(a*m.ratio),imperial:Math.round(a*h.ratio)},y=c===`metric_and_imperial`?Math.max(v.metric,v.imperial):Math.round(a*(_?.ratio??0)),b=o+7,x=o+3,S=c===`metric_and_imperial`?10+x*2:10+x;return c===`metric_and_imperial`?`
|
|
332
|
+
<svg
|
|
333
|
+
class="adornment-svg"
|
|
334
|
+
data-adornment-name="${B(t.name)}"
|
|
335
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
336
|
+
width="${y*n}"
|
|
337
|
+
height="${S*n}"
|
|
338
|
+
viewBox="0 0 ${y} ${S}"
|
|
339
|
+
>
|
|
340
|
+
<line
|
|
341
|
+
x1="0"
|
|
342
|
+
y1="${b-.5}"
|
|
343
|
+
x2="${y}"
|
|
344
|
+
y2="${b-.5}"
|
|
345
|
+
${H(s,`stroke`)}
|
|
346
|
+
stroke-width="1"
|
|
347
|
+
/>
|
|
348
|
+
<line
|
|
349
|
+
x1="0.5"
|
|
350
|
+
y1="${b-5}"
|
|
351
|
+
x2="0.5"
|
|
352
|
+
y2="${b+5}"
|
|
353
|
+
${H(s,`stroke`)}
|
|
354
|
+
stroke-width="1"
|
|
355
|
+
/>
|
|
356
|
+
<line
|
|
357
|
+
x1="${v.imperial-.5}"
|
|
358
|
+
y1="${b-5}"
|
|
359
|
+
x2="${v.imperial-.5}"
|
|
360
|
+
y2="${b}"
|
|
361
|
+
${H(s,`stroke`)}
|
|
362
|
+
stroke-width="1"
|
|
363
|
+
/>
|
|
364
|
+
<line
|
|
365
|
+
x1="${v.metric-.5}"
|
|
366
|
+
y1="${b}"
|
|
367
|
+
x2="${v.metric-.5}"
|
|
368
|
+
y2="${b+5}"
|
|
369
|
+
${H(s,`stroke`)}
|
|
370
|
+
stroke-width="1"
|
|
371
|
+
/>
|
|
372
|
+
<text
|
|
373
|
+
x="0"
|
|
374
|
+
y="${b+7+o}"
|
|
375
|
+
font-size="${o}px"
|
|
376
|
+
${we(l)}
|
|
377
|
+
${H(s)}
|
|
378
|
+
text-anchor="start"
|
|
379
|
+
>
|
|
380
|
+
0
|
|
381
|
+
</text>
|
|
382
|
+
<text
|
|
383
|
+
x="${v.imperial}"
|
|
384
|
+
y="${b-7}"
|
|
385
|
+
font-size="${o}px"
|
|
386
|
+
${we(l)}
|
|
387
|
+
${H(s)}
|
|
388
|
+
text-anchor="end"
|
|
389
|
+
>
|
|
390
|
+
${h.humanized}
|
|
391
|
+
</text>
|
|
392
|
+
<text
|
|
393
|
+
x="${v.metric}"
|
|
394
|
+
y="${b+7+o}"
|
|
395
|
+
font-size="${o}px"
|
|
396
|
+
${we(l)}
|
|
397
|
+
${H(s)}
|
|
398
|
+
text-anchor="end"
|
|
399
|
+
>
|
|
400
|
+
${m.humanized}
|
|
401
|
+
</text>
|
|
402
|
+
</svg>
|
|
403
|
+
`:`
|
|
404
|
+
<svg
|
|
405
|
+
class="adornment-svg"
|
|
406
|
+
data-adornment-name="${B(t.name)}"
|
|
407
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
408
|
+
width="${y*n}"
|
|
409
|
+
height="${S*n}"
|
|
410
|
+
viewBox="0 0 ${y} ${S}"
|
|
411
|
+
>
|
|
412
|
+
<line
|
|
413
|
+
x1="0"
|
|
414
|
+
y1="4.5"
|
|
415
|
+
x2="${y}"
|
|
416
|
+
y2="4.5"
|
|
417
|
+
${H(s,`stroke`)}
|
|
418
|
+
stroke-width="1"
|
|
419
|
+
/>
|
|
420
|
+
<line
|
|
421
|
+
x1="0.5"
|
|
422
|
+
y1="0"
|
|
423
|
+
x2="0.5"
|
|
424
|
+
y2="10"
|
|
425
|
+
${H(s,`stroke`)}
|
|
426
|
+
stroke-width="1"
|
|
427
|
+
/>
|
|
428
|
+
<line
|
|
429
|
+
x1="${y-.5}"
|
|
430
|
+
y1="0"
|
|
431
|
+
x2="${y-.5}"
|
|
432
|
+
y2="10"
|
|
433
|
+
${H(s,`stroke`)}
|
|
434
|
+
stroke-width="1"
|
|
435
|
+
/>
|
|
436
|
+
<text
|
|
437
|
+
x="0"
|
|
438
|
+
y="${o+12}"
|
|
439
|
+
font-size="${o}px"
|
|
440
|
+
${we(l)}
|
|
441
|
+
${H(s)}
|
|
442
|
+
text-anchor="start"
|
|
443
|
+
>
|
|
444
|
+
0
|
|
445
|
+
</text>
|
|
446
|
+
<text
|
|
447
|
+
x="${y}"
|
|
448
|
+
y="${o+12}"
|
|
449
|
+
font-size="${o}px"
|
|
450
|
+
${we(l)}
|
|
451
|
+
${H(s)}
|
|
452
|
+
text-anchor="end"
|
|
453
|
+
>
|
|
454
|
+
${_?.humanized??``}
|
|
455
|
+
</text>
|
|
456
|
+
</svg>
|
|
457
|
+
`}function Kl(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=`ArialMT`,o=Array.from(new Set([e.titleFont??a,e.subtitleFont??a]));return{element:i,ready:Promise.all(o.map(e=>n.loadReference(e))).then(()=>{let o=()=>{i.innerHTML=ql(e,a,t.getScale(),n)};o(),r!==`interactive`&&t.on(`resize`,o)})}}function ql(e,t,n,r){let{title:i,titleColor:a=`#000000`,titleFontSize:o=20,titleJustify:s=`center`,subtitle:c,subtitleColor:l=`#000000`,subtitleFontSize:u=12,subtitleJustify:d=`center`,background:f=`#ffffff`,showBackground:p=!1}=e,m=r.resolve(e.titleFont??t),h=r.resolve(e.subtitleFont??t),g=0,_=0,v=0,y=0,b=0,x=i.trim().length>0?qe([i],m,o):null,S=c.trim().length>0?qe([c],h,u):null;if(g=Math.max(x?.width??0,S?.width??0),x){let{ascent:e,descent:t}=x;_=e+t,y=8+e}if(S){let{ascent:e,descent:t}=S;v=e+t,b=x?y+x.descent+e:8+e}let C=g+16,w=_+v+16,T=s===`center`?C/2:s===`right`?C-8:8,E=d===`center`?C/2:d===`right`?C-8:8,D=``;if(D+=`<svg class="adornment-svg" data-adornment-name="${B(e.name)}" xmlns="http://www.w3.org/2000/svg" width="${C*n}" height="${w*n}" viewBox="0 0 ${C} ${w}">`,D+=`<rect x="0" y="0" width="${C}" height="${w}" ${H(f)} rx="6" style="visibility:${p?`visible`:`hidden`}" />`,x||S){let e=s===`center`?`middle`:s===`right`?`end`:`start`,t=d===`center`?`middle`:d===`right`?`end`:`start`;D+=`<text x="${T}" y="${y}" ${H(a)} ${we(m)} font-size="${o}" text-anchor="${e}">`,x&&(D+=`${B(i)}`),S&&(D+=`<tspan x="${E}" y="${b}" ${H(l)} ${we(h)} font-size="${u}" text-anchor="${t}">`,D+=`${B(c)}`,D+=`</tspan>`),D+=`</text>`}return D+=`</svg>`,D}var Jl={"sky-color":`#6babff`,"sky-horizon-blend":1,"horizon-color":[`interpolate-hcl`,[`linear`],[`zoom`],0,`#edf7fc`,9,`#edf7fc`,10,`#dcf0fa`],"horizon-fog-blend":.5,"fog-color":`#edf7fc`,"fog-ground-blend":.5,"atmosphere-blend":1},Yl={top_left:{x:5,y:5,unit:`px`},top_center:{x:0,y:5,unit:`px`},top_right:{x:5,y:5,unit:`px`},right_center:{x:5,y:0,unit:`px`},bottom_right:{x:5,y:5,unit:`px`},bottom_center:{x:0,y:5,unit:`px`},bottom_left:{x:5,y:5,unit:`px`},left_center:{x:5,y:0,unit:`px`}},Xl={top_left:{x:`left`,y:`top`},top_center:{x:`center`,y:`top`},top_right:{x:`right`,y:`top`},right_center:{x:`right`,y:`center`},bottom_right:{x:`right`,y:`bottom`},bottom_center:{x:`center`,y:`bottom`},bottom_left:{x:`left`,y:`bottom`},left_center:{x:`left`,y:`center`}},Zl={fill:{props:[`fill-opacity`],defaultValue:1},line:{props:[`line-opacity`],defaultValue:1},circle:{props:[`circle-opacity`,`circle-stroke-opacity`],defaultValue:1},heatmap:{props:[`heatmap-opacity`],defaultValue:1},"fill-extrusion":{props:[`fill-extrusion-opacity`],defaultValue:1},symbol:{props:[`icon-opacity`,`text-opacity`],defaultValue:1},raster:{props:[`raster-opacity`],defaultValue:1},hillshade:{props:[`hillshade-exaggeration`],defaultValue:.5},"color-relief":{props:[`color-relief-opacity`],defaultValue:1},background:{props:[`background-opacity`],defaultValue:1},custom:{props:[],defaultValue:1}},Ql=[`beforeWaters`,`beforeBoundaries`,`beforeNames`,`beforeNone`],$l={beforeWaters:`mc-before-waters`,beforeBoundaries:`mc-before-boundaries`,beforeNames:`mc-before-names`,beforeNone:`mc-before-none`},eu={jpg:`static`,png:`static`,svg:`static`,pdf:`static`,tiff:`static`,eps:`static`,eps_log:`static`,mp4:`video`,mov:`video`,mkv:`video`,mxf:`video`,webm:`video`,jpg_sequence:`video`,png_sequence:`video`,web_video:`video`,web:`interactive`,web_download:`interactive`},tu=[`top_left`,`top_right`,`bottom_left`,`bottom_right`,`top_center`,`left_center`,`right_center`,`bottom_center`],nu=new Map,ru=e=>nu.delete(e);async function iu(e,t,n,r,i,a,o){let s=[...e.adornments??[]],{fonts:c}=r;au(n),ou(n,t,o);let l=[],u=s.some(e=>![`copyright`,`webControls`].includes(e.type));ja()&&u&&!s.some(e=>e.type===`webControls`)&&s.unshift({type:`webControls`,id:`web_controls`,name:`Web controls`,position:`top_left`,stacking:`vertical`,buttons:[]}),s.forEach(t=>{if(t.type===`custom`)cu(n,de(t,n,o),t.position,t.stacking);else if(t.type===`northArrow`)cu(n,Xi(t,n,o),t.position,t.stacking);else if(t.type===`webControls`&&t.buttons&&o===`interactive`)cu(n,Ma(t,n,r,i,u),t.position,t.stacking);else if(t.type===`scalebar`){let{element:e,ready:r}=Wl(t,n,c,o);cu(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`insetMap`){let{element:e,ready:r}=Pl(t,n,a,o);cu(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`heading`){let{element:e,ready:r}=Kl(t,n,c,o);cu(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`manualLegend`){let{element:e,ready:r}=Yi(t,n,c,o);cu(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`connectedLegend`){let{element:r,ready:i}=Vi(t,e,n,c,o);cu(n,r,t.position,t.stacking),l.push(i)}else if(t.type===`copyright`&&o!==`interactive`){let{element:e,ready:r}=Fa(t,n,c);cu(n,e,t.position,t.stacking),l.push(r)}}),n.on(`resize`,()=>ou(n,t,o)),await Promise.all(l)}function au(e){let t=new Map,n=e.getContainer(),r=window.getComputedStyle(n);n.style.setProperty(`--adornment-text-direction`,r.direction),n.style.setProperty(`--adornment-text-writing-mode`,r.writingMode);for(let e of tu){let r=document.createElement(`div`),i=document.createElement(`div`),a=document.createElement(`div`);r.classList.add(`adornment-container`,e),i.classList.add(`inner`),a.classList.add(`inner`,`vertical`),r.append(i,a),n.appendChild(r),t.set(e,{container:r,horizontal:i,vertical:a})}nu.set(e,t)}function ou(e,t,n){let r=nu.get(e),i=e.getScale();if(r){e.getContainer().style.setProperty(`--adornment-spacing`,`${5*i}px`);for(let[e,{container:a}]of r)a.style.cssText=su(e,t[e],i,n)}}function su(e,t,n,r){let i=Xl[e],a=``,o=[],{x:s,y:c,unit:l}=t;return l===`px`&&(s*=n,c*=n),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===`interactive`?a+=`${i.y}: max(${c}${l}, 25px);`:a+=`${i.y}: ${c}${l};`,o.length&&(a+=`transform: ${o.join(` `)};`),a}function cu(e,t,n,r){ja()&&!t.classList.contains(`web-control`)&&t.classList.add(`hide`),r||=[`left_center`,`right_center`].includes(n)?`vertical`:`horizontal`;let i=nu.get(e)?.get(n),a=n===`left_center`||n===`right_center`?`vertical`:`horizontal`;i?.[a].hasChildNodes()||(r=a),(i?.[r])?.appendChild(t)}function lu(e){for(let t of Ql){let n=$l[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 uu(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>du(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 du(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?Je(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?Je(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":i},geometry:{type:`Polygon`,coordinates:Si(t)}}}function fu(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>pu(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 pu(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?Je(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?Je(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?Je(t.dataBindings??{},t.radiusLineColor,e.radiusLineColor):`#000000`,"radius-line-width":t.radiusLineWidth??0},geometry:{type:`GeometryCollection`,geometries:[{type:`Polygon`,coordinates:[_i(t.center,t.radius*n)]},{type:`LineString`,coordinates:vi(t.center,t.radius*n,t.radiusLineBearing??0)}]}}}var mu=`Roboto-Regular`;function hu(e,t,n,r,i,a){let o=[],s=new Set,c=new Set,l=[`match`,[`get`,`text-font`]],u=!!t.clustering;for(let n of t.models)(n.visible??!0)&&o.push(_u(e,t,n,1,r,i)),s.add(n.textFont),c.add(n.textLineHeight??1.2);if(Array.from(s).length>0){for(let e of Array.from(s))l.push(e,[`literal`,[e,mu]]);l.push([`literal`,[mu]])}e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:o},cluster:u,clusterRadius:t.clusterRadius??50,clusterMaxZoom:t.clusterMaxZoom??14});let d=!t.collisionDetection,f=t.labelCollisionDetection===void 0?d:!t.labelCollisionDetection;c.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":d,"icon-ignore-placement":d,"text-allow-overlap":f,"text-ignore-placement":f,"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":l,"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)}),u&&(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`,[mu]],"text-field":`{point_count_abbreviated}`,"text-size":{property:`point_count`,type:`interval`,stops:t.clusterTextSize??[]}}}),a===`interactive`&&(e.addSource(`${t.id}-selected-element`,{type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),c.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":l,"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`]]]})}),gu(e,t)))}function gu(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 _u(e,t,n,r,i,a){let o=n.svg===void 0?void 0:Xe(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:Ve(o);return{type:`Feature`,id:E(n.id),properties:{id:n.id,"mc-image-key":s,"mc-svg-string":o,"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?Ye(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?Je(n.dataBindings??{},n.textColor,t.textColor):`#000000`,"text-halo-color":t.textHaloColor||n.textHaloColor?Je(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 vu(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=re(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}`;yu(i,n,a)}return o}function yu(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(bu(r,n),e)}}function bu(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 xu=`<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>
|
|
458
|
+
`,Su=`<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>
|
|
459
|
+
`,Cu=`<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>
|
|
460
|
+
`,wu=`<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>
|
|
461
|
+
`;function Tu(e,t){let{allowFullscreen:n,loop:r}=e,i=D(e.src,t),a,o=i.match(/(?:youtube\.com\/(?:watch\?.*v=|embed\/|v\/)|youtu\.be\/)([-\w]{11})/)?.[1];a=o?`https://www.youtube.com/embed/${o}`:i;let s=[];if(n||s.push(`fs=0`),r&&o&&s.push(`loop=1&playlist=${o}`),a=Du(a),a=Eu(a),s.length){let e=a.includes(`?`)?`&`:`?`;a+=`${e}${s.join(`&`)}`}return a}function Eu(e){return e.replace(/([?&])si=[^&]+(&)?/,(e,t,n)=>t===`?`&&!n?``:t===`?`&&n?`?`:n?`&`:``)}function Du(e){let t=new URL(e),n=t.searchParams.get(`t`);if(!n)return e;let r=0,i=/^((\d+)m)?((\d+)s)?$/;if(/^\d+$/.test(n))r=parseInt(n,10);else{let e=n.match(i);if(e){let t=parseInt(e[2]||`0`,10),n=parseInt(e[4]||`0`,10);r=t*60+n}}return r>0&&(t.searchParams.delete(`t`),t.searchParams.set(`start`,String(r))),t.toString()}function Ou(e,t,n,r){let i;if(t?.type===`video`)i=r?Nu(t.src,n):`
|
|
462
|
+
<div class="youtube-container">
|
|
463
|
+
<iframe
|
|
464
|
+
src="${Tu(t,n)}"
|
|
465
|
+
width="100%" height="300" style="border: none" allowfullscreen>
|
|
466
|
+
</iframe>
|
|
467
|
+
</div>
|
|
468
|
+
`;else if(t?.type===`image`){let e=D(t.src,n),r=D(t.alt,n);i=`
|
|
469
|
+
<div class="image-container ${t.fill?`fill`:``}">
|
|
470
|
+
<img src="${e}" alt="${r}" />
|
|
471
|
+
</div>
|
|
472
|
+
`}i=i?`<div class="media-content">${i}</div>`:``;let a=e?`<div class="text-content">${ju(e,n)}</div>`:``;return`
|
|
473
|
+
<div class="popup-scroll-wrapper">
|
|
474
|
+
<div class="mc-popup">
|
|
475
|
+
${i}
|
|
476
|
+
${a}
|
|
477
|
+
</div>
|
|
478
|
+
</div>
|
|
479
|
+
`}var ku=`
|
|
480
|
+
<button class="mc-popup-button close">
|
|
481
|
+
${Su}
|
|
482
|
+
</button>
|
|
483
|
+
`,Au=`
|
|
484
|
+
<div class="cycle-buttons">
|
|
485
|
+
<button class="mc-popup-button prev">
|
|
486
|
+
${xu}
|
|
487
|
+
</button>
|
|
488
|
+
<button class="mc-popup-button next">
|
|
489
|
+
${Cu}
|
|
490
|
+
</button>
|
|
491
|
+
</div>
|
|
492
|
+
`;function ju(e,t){return e?(e=e.replace(/placeholder="[^"]+"/,``),e=e.replace(/onerror="[^"]+"/,``),e=e.replace(/youtube\.com\/embed\/\$([^"'<>\\]+)/gi,(e,n)=>{let r=O(t[n]);return r?`youtube.com/embed/${A(r)}?`:``}),e=e.replace(/(\S+?)\s*=\s*"\$([^"]+?)"/g,(e,n,r)=>{let i=O(t[r]);return[`src`,`href`].includes(n)&&!i?``:[`src`,`href`].includes(n)?/^(mailto:|tel:|ftp:|data:|http:\/\/|https:\/\/)/i.test(i)?` ${n}="${i}"`:` ${n}="${Mu(i)}"`:` ${n}="${i}"`}),e=e.replace(/>\$(.+?)</gi,(e,n)=>`>${O(t[n])}<`),e=e.replace(/<span\s+class="mention"\s+data-mention-id="[^"]*">(.*?)<\/span>/gim,(e,t)=>t),e):``}function Mu(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}function Nu(e,t){return`
|
|
493
|
+
<div class="youtube-placeholder">
|
|
494
|
+
<img src="${`https://img.youtube.com/vi/${A(D(e,t))}/hqdefault.jpg`}" />
|
|
495
|
+
<div class="popup-alert">
|
|
496
|
+
<div class="alert-icon">${wu}</div>
|
|
497
|
+
<div>${Oa(`videoAlert`)}</div>
|
|
498
|
+
</div>
|
|
499
|
+
</div>
|
|
500
|
+
`}var Pu=[`area`,`circle`,`dot`,`line`,`marker`,`polygon`],Fu=class{models;groups;customGroupIds;constructor(e){this.models={area:{},circle:{},dot:{},line:{},marker:{},polygon:{}},this.groups={area:{},circle:{},dot:{},line:{},marker:{},polygon:{}};for(let t of Pu)for(let n of e.registry?.models?.[t]??[]){this.models[t][n.id]={},this.groups[t][n.id]=n;for(let e of n.models){if(t===`area`){let t=e;t.featureId===void 0&&(t.featureId=Number(t.id),t.id=`${t.vectorUrl}-${t.id}`)}this.models[t][n.id][e.id]=e}}let{beforeWaters:t=[],beforeBoundaries:n=[],beforeNames:r=[],beforeNone:i=[]}=e.registry?.slots??{};this.customGroupIds=[...t,...n,...r,...i].map(e=>e.groupId)}getModel(e){let t=String(e.properties?.id),n=e.layer.metadata,r=n?.[`mc-group-id`],i=n?.[`mc-model-type`],a=n?.[`mc-model-id-prefix`];if(a&&(t=`${a}-${t}`),!(r===void 0||t===void 0||i===void 0))return this.models[i]?.[r]?.[t]}getPopupElements(){let e=[],t=[`circle`,`dot`,`line`,`marker`,`polygon`];for(let n of this.customGroupIds)for(let r of t){let t=this.models[r]?.[n];if(t)for(let[r,i]of Object.entries(t))(i.popup||i.popupMedia)&&e.push({groupId:n,modelId:r,popup:i.popup,popupMedia:i.popupMedia,lngLat:i.lngLat,center:i.center,radius:i.radius,anchorPoints:i.anchorPoints,dataBindings:i.dataBindings})}return e.reverse()}},Iu=class{map;popupElements;currentPopupElement;markerLayerIds;resizeObserver;hiddenCluster;clusterCheckId=0;constructor(e,t){this.map=e,this.popupElements=t,this.markerLayerIds=this.map.getStyle().layers.filter(e=>e.id.startsWith(`custom-marker`)).filter(e=>!e.id.endsWith(`-cluster`)).filter(e=>!e.id.includes(`-selected-element-`)).map(e=>e.id),this.map.on(`zoomend`,()=>{requestAnimationFrame(()=>{this.refreshCurrentCluster()})})}highlight(e,t=!1){if(this.currentPopupElement=e,this.clusterCheckId++,this.resetHiddenCluster(),this.deselect(),!e)return;let{groupId:n,modelId:r}=e,i=this.popupElements.filter(e=>e.groupId===n);i.length>1&&n.startsWith(`custom-marker`)&&this.highlightGroupedMarker(n,r,i),n.startsWith(`custom-marker`)&&this.fadeOtherMarkers(n),this.repositionMap(e,t),t||this.resetCluster(n)}resetCluster(e){this.resetHiddenCluster(),this.setSelectedClusterState(e)}setSelectedClusterState(e,t,n){let r=this.map.getSource(`${e}-selected-element`);r&&r.setData({type:`FeatureCollection`,features:t?[t]:[]});let i=n===void 0?[`has`,`point_count`]:[`all`,[`has`,`point_count`],[`!=`,[`get`,`cluster_id`],n]];this.map.getLayer(`${e}-circle-cluster`)&&this.map.getLayer(`${e}-text-cluster`)&&(this.map.setFilter(`${e}-circle-cluster`,i),this.map.setFilter(`${e}-text-cluster`,i))}resetHiddenCluster(){if(!this.hiddenCluster)return;let{source:e}=this.hiddenCluster,t=this.map.getSource(`${e}-selected-element`);t&&t.setData({type:`FeatureCollection`,features:[]}),this.map.getLayer(`${e}-circle-cluster`)&&this.map.getLayer(`${e}-text-cluster`)&&(this.map.setFilter(`${e}-circle-cluster`,[`has`,`point_count`]),this.map.setFilter(`${e}-text-cluster`,[`has`,`point_count`])),this.hiddenCluster=void 0}async checkCluster(e){let{lngLat:t,groupId:n,modelId:r}=e;if(!t){this.resetHiddenCluster();return}let i=++this.clusterCheckId,a=this.map.getSource(n);if(!a||!this.map.getLayer(`${n}-circle-cluster`)){this.resetCluster(n);return}let o=this.map.project(t),s=[[o.x-100,o.y-100],[o.x+100,o.y+100]],c=this.map.queryRenderedFeatures(s,{layers:[`${n}-circle-cluster`]}),l=new Set;for(let e of c){let t=e.properties?.cluster_id;t!==void 0&&l.add(t)}if(this.hiddenCluster&&this.hiddenCluster.source===n&&l.add(this.hiddenCluster.clusterId),!l.size){this.resetCluster(n);return}for(let e of l)try{let t=await a.getClusterLeaves(e,1/0,0);if(i!==this.clusterCheckId)return;let o=t.find(e=>e.properties?.id===r);if(o){this.resetHiddenCluster(),this.hiddenCluster={clusterId:e,source:n},this.setSelectedClusterState(n,o,e);return}}catch{i===this.clusterCheckId&&this.resetCluster(n)}this.resetCluster(n)}refreshCurrentCluster(){let e=this.currentPopupElement;e?.lngLat&&e.groupId.startsWith(`custom-marker`)&&this.checkCluster(e)}deselect(){this.markerLayerIds.forEach(e=>{this.map.setPaintProperty(e,`icon-opacity`,1),this.map.setPaintProperty(e,`text-opacity`,1)}),this.resizeObserver?.disconnect()}highlightGroupedMarker(e,t,n){let r=this.markerLayerIds.find(t=>t.startsWith(e));r&&(this.map.setPaintProperty(r,`icon-opacity`,[`case`,[`boolean`,[`feature-state`,`highlighted`],!1],1,.3]),this.map.setPaintProperty(r,`text-opacity`,[`case`,[`boolean`,[`feature-state`,`highlighted`],!1],1,.3]),n.forEach(n=>{this.map.setFeatureState({source:e,id:E(n.modelId)},{highlighted:n.modelId===t})}))}fadeOtherMarkers(e){this.markerLayerIds.filter(t=>!t.startsWith(e)).forEach(e=>{this.map.setPaintProperty(e,`icon-opacity`,.3),this.map.setPaintProperty(e,`text-opacity`,.3)})}repositionMap(e,t){let n,i=20;e.lngLat===void 0?e.anchorPoints===void 0?e.center!==void 0&&e.radius!==void 0&&(n=this.getElementBounds(_i(e.center,e.radius))):n=this.getElementBounds(this.flattenCoordinates(e.anchorPoints)):(n=new r(e.lngLat,e.lngLat),i=40);let a=document.querySelector(`.popup-container`);if(!a||!n)return;this.resizeObserver?.disconnect();let o=0;this.resizeObserver=new ResizeObserver(r=>{let a=r[0].contentRect.height;a>o&&(o=a,this.panToElement(n,i,e,t))}),this.resizeObserver.observe(a)}getElementBounds(e){let t=new r(e[0],e[0]);for(let n of e)t.extend(n);return t}flattenCoordinates(e){return Array.isArray(e[0][0])?e.flat():e}panToElement(e,t,n,r){let i=this.map;if(i.getProjection()?.type===`globe`&&[e.getSouthWest(),e.getNorthEast(),e.getNorthWest(),e.getSouthEast()].some(e=>!ie(this.map,e.lng,e.lat))){i.easeTo({center:e.getCenter(),duration:500}),r&&i.once(`moveend`,()=>{this.currentPopupElement&&this.checkCluster(n)});return}let a=i.projectWithScaleCorrection(e.getSouthWest()),o=i.projectWithScaleCorrection(e.getNorthEast()),s=i.getContainer().clientWidth,c=i.getContainer().clientHeight,l=s>600,u=document.querySelector(`.popup-container`)?.getBoundingClientRect(),d=u?.width??0,f=u?.height??0;l||(f=Math.min(f,c/2));let p=c-a.y>f+t,m=a.x>t+(l&&!p?d:0),h=o.x<s-t,g=o.y>t,_=l?a.y<c-t:p;if(m&&h&&g&&_)r&&this.checkCluster(n);else{if(o.x-a.x+2*t<s&&a.y-o.y+2*t<c){let t=e.getCenter();i.easeTo({center:t,duration:500,offset:l?[0,0]:[0,-30]})}else i.fitBounds(e,{padding:t,maxZoom:i.getZoom(),duration:500,linear:!0});r&&i.once(`moveend`,()=>{this.currentPopupElement&&this.checkCluster(n)})}}},Lu=class{map;youTubePlaceholder;language=`en`;publication;restrictMapMovement;center;popupPosition=`bottomLeft`;mapContainer;highlightManager;registry;promoteIdCache=new Map;popupElements=[];popupContainer;floatingPopup;feature;currentModelId;constructor(e,t){this.map=e,this.youTubePlaceholder=t,this.mapContainer=this.map.getContainer(),this.popupContainer=document.createElement(`div`),this.popupContainer.classList.add(`popup-container`),this.map.on(`mousemove`,e=>this.onMouseMove(e)),this.map.on(`click`,e=>this.onClick(e))}setJobObject(e){this.registry=new Fu(e)}setParams(e,t,n,r){this.popupPosition=e,this.language=t,this.restrictMapMovement=n,this.center=r}setPublication(e){this.publication=e}setpopupElements(){this.popupElements=this.registry.getPopupElements()}setHighlightManager(){this.highlightManager=new Iu(this.map,this.popupElements)}onMouseMove(e){this.feature=this.getInteractiveFeature(e),this.feature?this.map.getCanvas().style.cursor=`pointer`:this.map.getCanvas().style.cursor=``}onClick(e){this.feature=this.getInteractiveFeature(e);let t;this.feature?(t=this.registry.getModel(this.feature)?.id??(this.feature.id===void 0?void 0:String(this.feature.id)),t&&(!this.mapContainer.contains(this.popupContainer)||t!==this.currentModelId)&&(this.currentModelId=t,this.addPopup(e),this.highlightManager?.highlight(this.popupElements.find(e=>e.modelId===t)))):(this.hidePopup(),this.highlightManager?.highlight(void 0),this.currentModelId=void 0)}getInteractiveFeature(e){return this.map.queryRenderedFeatures(e.point).find(e=>{if(Object.keys(e.layer.metadata??{}).some(e=>e.startsWith(`mc-interactivity-template`)))return!0;let t=this.registry.getModel(e);return!!(t?.popup??t?.popupMedia)})}addPopup(e){if(!this.feature)return;this.floatingPopup?.remove();let t=this.getTemplate(this.feature);if(t)if(this.popupPosition===`mapElement`)if(this.feature.geometry.type===`Point`)this.addFloatingPopup(t,this.feature.geometry.coordinates);else{let{lng:n,lat:r}=this.map.unprojectWithScaleCorrection(e.point);this.addFloatingPopup(t,[n,r])}else this.popupContainer.innerHTML=t,this.popupElements.find(e=>e.modelId===this.currentModelId)&&this.addPopupControls(),this.mapContainer.appendChild(this.popupContainer)}addFloatingPopup(e,t){let n=this.restrictMapMovement?this.getAnchor(t):void 0;this.floatingPopup=new s({maxWidth:`none`,closeButton:!1,offset:20,...n!==void 0&&{anchor:n}}).setLngLat(t).setHTML(e).addTo(this.map)}getAnchor(e){let t=this.map.projectWithScaleCorrection(e),n=this.map.getContainer().clientWidth,r=this.map.getContainer().clientHeight,i,a;return i=t.y<r*.33?`top`:t.y>r*.66?`bottom`:`center`,a=t.x<n*.33?`left`:t.x>n*.66?`right`:`center`,i===`center`&&a===`center`?`bottom`:i===`center`?a:a===`center`?i:`${i}-${a}`}hidePopup(){this.popupContainer&&(this.popupContainer.remove(),this.feature=void 0,this.currentModelId=void 0),this.restrictMapMovement&&this.center&&this.map.easeTo({center:this.center})}getTemplate(e){let{layer:t}=e,n,r=this.registry.getModel(e);if(r?.popup||r?.popupMedia)n=Ou(r.popup,r.popupMedia,r.dataBindings??{},this.youTubePlaceholder);else{let r=[];this.publication&&(r.push(`:${this.publication}-${this.language}`),r.push(`:${this.publication}-:en`)),r.push(`:${this.language}`),r.push(`:en`),r.push(``);for(let i of r){let r=t.metadata?.[`mc-interactivity-template${i}`];if(r){n=this.fillDatalayerTemplate(e,r,i);break}}n&&=`
|
|
501
|
+
<div class="popup-scroll-wrapper">
|
|
502
|
+
<div class="mc-popup data-layer text-content">${n}</div>
|
|
503
|
+
</div>
|
|
504
|
+
`}return n}htmlToElement(e){let t=document.createElement(`template`);return t.innerHTML=e.trim(),t.content.firstElementChild}addPopupControls(){let e=this.htmlToElement(ku);if(e&&(e.addEventListener(`click`,()=>{this.hidePopup(),this.highlightManager.highlight(void 0)}),this.popupContainer.appendChild(e)),this.popupElements.length>1){let e=this.htmlToElement(Au);e&&(e.querySelector(`.prev`)?.addEventListener(`click`,()=>this.cyclePopups(!1)),e.querySelector(`.next`)?.addEventListener(`click`,()=>this.cyclePopups()),this.popupContainer.appendChild(e))}}fillDatalayerTemplate(e,t,n){let r=`data-mention-id`,i=new DOMParser().parseFromString(t,`text/html`).body;for(let t of i.querySelectorAll(`[${r}]`)){let i=this.getProperty(e,t.getAttribute(r),n);i!==void 0&&(t.innerText=i)}return i.innerHTML}getProperty(e,t,n){if(!t)return;let r=t.endsWith(`:en`)?[t.replace(`:en`,n),t]:[t];for(let t of r){let n=e.properties[t]??this.getVectorProperty(e,t);if(n!==void 0)return n}}getVectorProperty(e,t){let n=this.promoteIdCache.get(e.source);n===void 0&&(n=this.map.getSource(e.source)?.serialize().promoteId||`id`,this.promoteIdCache.set(e.source,n));try{let r=e.properties[n];return e.layer.metadata.properties[t][r]}catch{return}}cyclePopups(e=!0){let t=this.popupElements?.findIndex(e=>e.modelId===this.currentModelId);if(t!==-1){let n=0;n=e?t===this.popupElements.length-1?0:t+1:t===0?this.popupElements.length-1:t-1;let r=this.popupElements?.[n];this.currentModelId=r.modelId,this.highlightManager.highlight(r,!0);let i=Ou(r.popup,r.popupMedia,r.dataBindings??{},this.youTubePlaceholder),a=this.popupContainer;this.popupContainer.remove(),a.innerHTML=i,this.mapContainer.appendChild(a),this.addPopupControls(),e?this.popupContainer.querySelector(`.mc-popup-button.next`)?.focus():this.popupContainer.querySelector(`.mc-popup-button.prev`)?.focus()}}},Ru=class{line;mercatorLine;distances;totalLength;constructor(e){this.line=e.filter((t,n)=>n===0||e[n][0]!==e[n-1][0]||e[n][1]!==e[n-1][1]),this.mercatorLine=this.line.map(e=>a.fromLngLat(e)),this.distances=zu(this.mercatorLine),this.totalLength=this.distances[this.distances.length-1]}sample(e){let t=this.mercatorLine,n=this.distances;if(t.length<2)return t[0];e*=this.totalLength;for(let r=1;r<t.length;++r){let i=t[r-1],o=t[r],s=n[r-1],c=n[r];if(c>=e){let t=(e-s)/(c-s);return new a(I(i.x,o.x,t),I(i.y,o.y,t))}}return new a(t[t.length-1].x,t[t.length-1].y)}slice(e,t){if(this.line.length<2)return this.line;let n=this.mercatorLine.filter((n,r)=>this.distances[r]>=e*this.totalLength&&this.distances[r]<=t*this.totalLength);if(e>0){let t=this.sample(e);Bu(t,n[0])||n.unshift(t)}if(t<1){let e=this.sample(t);Bu(e,n[n.length-1])||n.push(e)}return n.map(e=>{let{lng:t,lat:n}=e.toLngLat();return[t,n]})}get length(){return this.totalLength}};function zu(e){let t=0,n=[t];for(let r=1;r<e.length;++r){let i=e[r-1],a=e[r],o=a.x-i.x,s=a.y-i.y;t+=Math.sqrt(o*o+s*s),n.push(t)}return n}function Bu(e,t){return e.x===t.x&&e.y===t.y}var Vu={solid:[1,0],dotted:[.7,.3],dashed:[3.5,1.5]};function Hu(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(n=>Uu(e,t,n,1,r))}}),Object.entries(Vu).forEach(([r,i])=>{t.models.some(e=>(e.lineStyle??`solid`)===r)&&e.addLayer({id:`${t.id}-${r}`,type:`line`,source:t.id,metadata:{"mc-model-type":`line`,"mc-group-id":t.id},filter:[`all`,[`==`,[`geometry-type`],`LineString`],[`==`,[`get`,`line-style`],r]],paint:{"line-width":[`get`,`line-width`],"line-color":[`get`,`line-color`],"line-dasharray":i,"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}),i===`interactive`&&e.addLayer({id:`${t.id}-clickable`,type:`line`,source:t.id,metadata:{"mc-model-type":`line`,"mc-group-id":t.id},paint:{"line-width":[`max`,[`get`,`line-width`],15],"line-opacity":0},filter:[`==`,[`geometry-type`],`LineString`]},n),t.models.some(e=>e.svg)&&e.addLayer({id:`${t.id}-icon`,type:`symbol`,source:t.id,metadata:{"mc-model-type":`line`,"mc-group-id":t.id},layout:{"icon-allow-overlap":!0,"icon-ignore-placement":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":`center`,"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},filter:[`==`,[`geometry-type`],`Point`]},n)}function Uu(e,t,n,r,i){let a=new Ru(n.geometry).slice(0,r),o=n.svg!==void 0&&a.length>1?Xe(n.dataBindings??{},n.svg,void 0):void 0,s=o===void 0?void 0:i.getMapLibreImageKey(o,window.devicePixelRatio*(n.iconScale??1)*e.getScale());return{type:`Feature`,id:E(n.id),properties:{id:n.id,"line-width":n.lineWidth??3,"line-color":t.lineColor||n.lineColor?Je(n.dataBindings??{},n.lineColor,t.lineColor):`#000000`,"line-style":n.lineStyle??`solid`,"mc-image-key":s,"mc-svg-string":o,"icon-rotate":Wu(n,a,e),"icon-offset":n.iconOffset,"icon-size":n.iconScale},geometry:{type:`GeometryCollection`,geometries:[{type:`LineString`,coordinates:a},{type:`Point`,coordinates:a[a.length-1]}]}}}function Wu(e,t,n){return e.iconRotation?e.iconAlign?Ei(t,n)+e.iconRotation:e.iconRotation:0}function Gu(e,t,n,r,i,a,o){let s=Ni(t),c=new Map,l=new Map;for(let e of t.models){let n=e.featureId,a=t.id,o=[],u=wi(e),d=Ci(a,e),f=l.get(d)??{model:e,featureIds:o,modelIdToFillColor:{},modelIdToFillPattern:{},modelIdToOutlineColor:{},modelIdToOutlineWidth:{}};if(e.visible??!0){f.featureIds.push(n);let a=e.fillPattern===void 0?null:i.getMapLibreImageKey(r[e.fillPattern],2*window.devicePixelRatio);f.modelIdToFillColor[n]=t.fillColor||e.fillColor?Je(e.dataBindings??{},e.fillColor,t.fillColor,s,t.choropleth?.unmatchedColor):`#000000`,f.modelIdToFillPattern[n]=a,f.modelIdToOutlineColor[n]=t.outlineColor||e.outlineColor?Je(e.dataBindings??{},e.outlineColor,t.outlineColor):`#000000`,f.modelIdToOutlineWidth[n]=e.outlineWidth??.5}c.set(u,e),l.set(d,f)}for(let t of c.keys())e.getSource(t)||e.addSource(t,{type:`vector`,url:`${a}${c.get(t).vectorUrl}?access_token=${o}`,promoteId:`id`});for(let r of l.keys()){let{model:i}=l.get(r),{sourceLayerId:a}=i,o=wi(i);e.addLayer({id:r,type:`fill`,source:o,"source-layer":a,filter:[`literal`,!1],metadata:{"mc-model-type":`area`,"mc-model-id-prefix":i.vectorUrl,"mc-group-id":t.id},paint:{"fill-color":`#ffffff`,"fill-outline-color":`#000000`,"fill-antialias":!1,"fill-opacity":[`coalesce`,[`feature-state`,`opacity-${t.id}`],1]}},n),e.addLayer({id:`${r}-pattern`,type:`fill`,source:o,"source-layer":a,filter:[`literal`,!1],metadata:{"mc-model-type":`area`,"mc-model-id-prefix":i.vectorUrl,"mc-group-id":t.id},paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity-${t.id}`],1]},layout:{visibility:`visible`}},n),e.addLayer({id:`${r}-outline`,type:`line`,source:o,"source-layer":a,filter:[`literal`,!1],metadata:{"mc-model-type":`area`,"mc-model-id-prefix":i.vectorUrl,"mc-group-id":t.id},paint:{"line-color":`#000000`,"line-width":.5,"line-opacity":[`coalesce`,[`feature-state`,`opacity-${t.id}`],1]}},n)}l.forEach((t,n)=>{let{featureIds:r,modelIdToFillColor:i,modelIdToFillPattern:a,modelIdToOutlineColor:o,modelIdToOutlineWidth:s}=t;e.setFilter(n,[`in`,`id`,...r]),e.setFilter(`${n}-outline`,[`in`,`id`,...r]),e.setPaintProperty(n,`fill-color`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,i]]),e.setPaintProperty(`${n}-outline`,`line-color`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,o]]),e.setPaintProperty(`${n}-outline`,`line-width`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,s]]),e.setFilter(`${n}-pattern`,[`to-boolean`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,a]]]),e.setPaintProperty(`${n}-pattern`,`fill-pattern`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,a]])})}function Ku(e,t,n){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>qu(t,e))}}),e.addLayer({id:t.id,type:`circle`,source:t.id,metadata:{"mc-model-type":`dot`,"mc-group-id":t.id},paint:{"circle-color":[`get`,`circle-color`],"circle-radius":[`get`,`circle-radius`],"circle-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function qu(e,t){return{type:`Feature`,id:t.id,properties:{id:t.id,"circle-radius":t.radius,"circle-color":e.fillColor||t.fillColor?Je(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`},geometry:{type:`Point`,coordinates:[t.center.lng,t.center.lat]}}}function Ju(e){let t=new Map,n=new Map,r=new Map;function i(n){return t.get(n)??t.set(n,e.load(n)).get(n)}return async(t,a,o,s,c)=>{let l=a||400,u=o||`normal`,d=be(t),f=JSON.stringify([d,l,u]);n.has(f)||n.set(f,(async()=>{for(let t of d){if(t.generic)continue;let n=e.registered(t.name,l,u);if(n!==void 0)return n;let r=await e.search(t.name,l,u);if(r!==void 0)return{name:r,weight:l,style:u};if(await i(t.name)!==void 0)return{name:t.name,weight:400,style:`normal`}}return{name:`Roboto-Regular`,weight:400,style:`normal`}})());let p=await n.get(f);return c!==void 0&&(c.fauxBold=l>=600&&p.weight<600,c.fauxItalic=u!==`normal`&&p.style===`normal`),r.has(p.name)||r.set(p.name,i(p.name).then(e=>{if(e===void 0)throw Error(`PDF font "${p.name}" is unavailable`);s.registerFont(p.name,e)})),await r.get(p.name),p.name}}function Yu(e,t,n){let r=e.metadata?.colorconversion,i=r?new Map(r.map(e=>[Xu(e.rgbin.split(` `).map(e=>Number(e))),e.cmykout.split(` `).map(e=>Number(e)*100)])):null;return{colorCallback:Zu.bind(null,i),fontCallback:Qu(t,n),assumePt:!0}}var Xu=([e,t,n])=>`R${e}G${t}B${n}`;function Zu(e,t){if(!t)return;let n=t[0],r=Xu(n),i=e?.get(r);if(i)return[i,t[1]];let a=(255-n[0])/255,o=(255-n[1])/255,s=(255-n[2])/255,c=Math.min(a,o,s);return[[(a-c)*100,(o-c)*100,(s-c)*100,c*100],t[1]]}function Qu(e,t){return Ju({registered:(t,n,r)=>{let i=Ce(e.fontMap.values(),t,n,r)??e.getDirectFont(t);return i&&{name:i.name,weight:i.weight===`bold`?700:Number(i.weight)||400,style:i.style}},search:async(e,n,r)=>(await $u(t,{family:e,weight:String(n),style:r}))[0]?.name,load:async e=>{let n=await fetch(`${t.vapiUrl}/fonts/${encodeURIComponent(e)}.ttf?access_token=${t.accessToken}`);if(!(n.status===404||n.status===410)){if(!n.ok)throw Error(`Failed to load PDF font "${e}": ${n.status}`);return n.arrayBuffer()}}})}async function $u(e,t){let n=new URLSearchParams(Object.entries(t).map(([e,t])=>[e,String(t)])),r=`${e.apiUrl??`https://api.mapcreator.io`}/v1/fonts/search?${n}`,i={Accept:`application/json`,Authorization:e.bearerToken.startsWith(`Bearer `)?e.bearerToken:`Bearer ${e.bearerToken}`},a=await fetch(r,{headers:i});if(a.ok){let e=await a.json().catch(()=>({success:!1,error:{type:`SyntaxError`,message:`Malformed JSON response`}}));if(e.success)return Array.isArray(e.data)?e.data:[e.data];throw Error(e.error.message)}else throw Error(a.statusText)}function ed(e,{width:t,height:n}){let r=[];for(let i=0;i<=2;i++)for(let s=0;s<=2;s++){let c=i/2*t,l=s/2*n,{x:u,y:d}=td(a.fromLngLat(e.unprojectWithScaleCorrection(new o(c,l))));r.push(c,l,0,u,d,0)}return{width:t,height:n,GTRasterTypeGeoKey:1,PhotometricInterpretation:2,ProjectedCSTypeGeoKey:3857,ModelTiepoint:r,ModelPixelScale:[]}}function td(e){return{x:I(-20037508.34,20037508.34,e.x),y:I(20037508.34,-20037508.34,e.y)}}var nd=class{mcMap;format;svgCache;backgroundColor;constructor(e,t,n,r){this.mcMap=e,this.format=t,this.svgCache=n,this.backgroundColor=r}async frame(e){let t=this.mcMap.map;t.triggerRepaint(),await t.once(`idle`);let n=t.getCanvas(),{width:r,height:i}=n;if(![`jpg`,`png`,`tiff`].includes(this.format))return e?new Blob:new ImageData(r,i);let a=new OffscreenCanvas(r,i),o=a.getContext(`2d`,{willReadFrequently:!0});return this.format===`jpg`&&(o.fillStyle=this.backgroundColor,o.fillRect(0,0,r,i)),o.drawImage(n,0,0),await je(o,this.svgCache,t.getContainer()),e?a.convertToBlob({type:this.format===`jpg`?`image/jpeg`:`image/png`,quality:1}):o.getImageData(0,0,r,i)}};function rd(e){let t=e.length>0?[id(e[0])]:[],n=0,r=0;for(let i=1;i<e.length;++i){let a=id(e[i]);n+=ad(e[i-1].center[0],a.center[0]),r+=ad(e[i-1].bearing,a.bearing),a.center[0]+=n*360,a.x+=n,a.bearing+=r*360,t.push(a)}return t}function id(e){return{...e,center:[e.center[0],e.center[1]]}}function ad(e,t){if(Math.abs(e)+Math.abs(t)>180){if(e>0&&t<0)return 1;if(e<0&&t>0)return-1}return 0}function od(e){return 2**-e}function sd(e){return e.length>0?e[e.length-1].time:0}function cd(e){return`${String(Math.floor(e%36e5/6e4)).padStart(2,`0`)}:${String(Math.floor(e%6e4/1e3)).padStart(2,`0`)}`}function ld(e){return z(e,23.976)?24e3/1001:z(e,29.97)?3e4/1001:z(e,59.94)?6e4/1001:e}function ud(e,t){return e===void 0||t===void 0?e===t:e.center.lat===t.center.lat&&e.center.lng===t.center.lng&&e.zoom===t.zoom&&e.bearing===t.bearing&&e.pitch===t.pitch&&e.fov===t.fov&&e.elevation===t.elevation}var dd=`
|
|
505
|
+
<div class="preload-bar-vertical"></div>
|
|
506
|
+
<div class="preload-bar-horizontal"></div>
|
|
507
|
+
<div class="preload-badge">
|
|
508
|
+
<div class="preload-ring-outer"></div>
|
|
509
|
+
<div class="preload-ring-inner"></div>
|
|
510
|
+
<div class="preload-ring-dots"></div>
|
|
511
|
+
<div class="preload-content">
|
|
512
|
+
<div class="preload-logo"><svg xmlns="http://www.w3.org/2000/svg" width="130" height="18" viewBox="0 0 130 18" fill="currentColor"><path d="M16.49.815h-3.283V17.35h3.283zm-6.566 0h-3.32v6.567h3.32zm16.461 0h-6.567v3.32h6.567zm0 13.215h-6.567v3.319h6.567zM3.321.815H.038V17.35h3.283zM38.38 5.18l2.01 5.667 2-5.666h2.12v7.812h-1.62v-2.137l.164-3.684-2.092 5.82h-1.128l-2.11-5.82.164 3.684v2.137h-1.61V5.18zm14.488 6.176h-2.81l-.537 1.61h-1.728l2.91-7.812h1.492l2.928 7.812h-1.719zm-2.392-1.273h1.955l-.982-2.929zm9.432.154v2.729h-1.61V5.18h3.046a3.5 3.5 0 0 1 1.547.318c.426.193.784.51 1.027.91.246.405.372.872.364 1.346a2.21 2.21 0 0 1-.791 1.819 3.27 3.27 0 0 1-2.174.663zm0-1.3h1.436c.352.02.698-.09.974-.31a1.1 1.1 0 0 0 .336-.909 1.2 1.2 0 0 0-1.1-1.291h-1.646zm14.059 1.455a2.73 2.73 0 0 1-.91 1.982 3.2 3.2 0 0 1-2.21.728 2.94 2.94 0 0 1-2.364-1.01 4.16 4.16 0 0 1-.91-2.783v-.472a4.7 4.7 0 0 1 .419-2.028c.25-.535.656-.982 1.164-1.283a3.24 3.24 0 0 1 1.71-.455 3.17 3.17 0 0 1 2.182.728c.557.53.884 1.259.91 2.028h-1.592a1.62 1.62 0 0 0-.418-1.091 1.57 1.57 0 0 0-1.11-.346 1.35 1.35 0 0 0-1.2.582 3.1 3.1 0 0 0-.41 1.82v.59c-.037.63.095 1.258.383 1.82a1.32 1.32 0 0 0 1.21.581c.398.034.796-.086 1.109-.336.273-.284.426-.662.427-1.055zm6.393-.255h-1.28v2.856h-1.61V5.18h2.9a3.2 3.2 0 0 1 2.138.618 2.12 2.12 0 0 1 .755 1.737 2.17 2.17 0 0 1-1.373 2.192l1.691 3.192v.073H81.89zm-1.281-1.31h1.3c.332.018.657-.092.91-.309a1.1 1.1 0 0 0 .336-.845 1.2 1.2 0 0 0-.318-.91 1.32 1.32 0 0 0-.964-.318h-1.264zm12.55.783h-3.093v2.09h3.638v1.292h-5.247V5.18h5.23v1.3h-3.639v1.865h3.092zm8.339 1.746H97.14l-.537 1.61h-1.71l2.91-7.812h1.492l2.929 7.812h-1.71zm-2.392-1.3h1.956l-.983-2.929zm13.06-3.575h-2.374v6.512h-1.609V6.48h-2.365v-1.3h6.366zm9.631 2.783a4.7 4.7 0 0 1-.409 2.028 3 3 0 0 1-1.164 1.337 3.44 3.44 0 0 1-3.474 0 3.07 3.07 0 0 1-1.183-1.337 4.55 4.55 0 0 1-.427-1.991V8.91a4.56 4.56 0 0 1 .418-2.028 3.1 3.1 0 0 1 1.174-1.355 3.48 3.48 0 0 1 3.474 0c.516.325.925.797 1.173 1.355a4.56 4.56 0 0 1 .418 2.028zm-1.628-.354a3.2 3.2 0 0 0-.445-1.874 1.45 1.45 0 0 0-1.255-.636 1.42 1.42 0 0 0-1.246.636 3.2 3.2 0 0 0-.446 1.82v.381c-.03.636.121 1.267.437 1.819a1.53 1.53 0 0 0 1.255.65 1.54 1.54 0 0 0 1.255-.65 3.36 3.36 0 0 0 .445-1.819zm8.14 1.227h-1.237v2.856h-1.619V5.18h2.91a3.2 3.2 0 0 1 2.137.618 2.12 2.12 0 0 1 .755 1.737 2.23 2.23 0 0 1-1.455 2.192l1.692 3.192v.073h-1.692zm-1.237-1.31h1.291c.33.01.653-.1.91-.309a1.08 1.08 0 0 0 .327-.845 1.2 1.2 0 0 0-.309-.91 1.33 1.33 0 0 0-.964-.318h-1.255z"/></svg>
|
|
513
|
+
</div>
|
|
514
|
+
<div class="preload-percentage">0%</div>
|
|
515
|
+
<div class="preload-label">Preloading tiles...</div>
|
|
516
|
+
</div>
|
|
517
|
+
</div>
|
|
518
|
+
`,fd=class{container;percentage;constructor(e){this.container=document.createElement(`div`),this.container.className=`preload-overlay`,this.container.innerHTML=dd,this.percentage=this.container.querySelector(`.preload-percentage`),e.getContainer().appendChild(this.container)}remove(){this.container.remove()}setProgress(e){this.percentage.innerText=`${Math.floor(e*100)}%`}};function pd(e){return e<0?-1:1}function md(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(pd(a)+pd(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function hd(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function gd(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function _d(e){this._context=e}_d.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:gd(this,this._t0,hd(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,gd(this,hd(this,n=md(this,e,t)),n);break;default:gd(this,this._t0,n=md(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function vd(e){this._context=new yd(e)}(vd.prototype=Object.create(_d.prototype)).point=function(e,t){_d.prototype.point.call(this,t,e)};function yd(e){this._context=e}yd.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function bd(e){return new _d(e)}var xd=m(((e,t)=>{var n=4,r=.001,i=1e-7,a=10,o=11,s=1/(o-1),c=typeof Float32Array==`function`;function l(e,t){return 1-3*t+3*e}function u(e,t){return 3*t-6*e}function d(e){return 3*e}function f(e,t,n){return((l(t,n)*e+u(t,n))*e+d(t))*e}function p(e,t,n){return 3*l(t,n)*e*e+2*u(t,n)*e+d(t)}function m(e,t,n,r,o){var s,c,l=0;do c=t+(n-t)/2,s=f(c,r,o)-e,s>0?n=c:t=c;while(Math.abs(s)>i&&++l<a);return c}function h(e,t,r,i){for(var a=0;a<n;++a){var o=p(t,r,i);if(o===0)return t;var s=f(t,r,i)-e;t-=s/o}return t}function g(e){return e}t.exports=function(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw Error(`bezier x values must be in [0, 1] range`);if(e===t&&n===i)return g;for(var a=c?new Float32Array(o):Array(o),l=0;l<o;++l)a[l]=f(l*s,e,n);function u(t){for(var i=0,c=1,l=o-1;c!==l&&a[c]<=t;++c)i+=s;--c;var u=(t-a[c])/(a[c+1]-a[c]),d=i+u*s,f=p(d,e,n);return f>=r?h(t,d,e,n):f===0?d:m(t,i,i+s,e,n)}return function(e){return e===0?0:e===1?1:f(u(e),t,i)}}})),Sd=m(((e,t)=>{t.exports=n;function n(e,t,n,r){var i,a,o,s,c,l,u,d,f,p,m,h,g,_;for(typeof t!=`function`&&(r=n,n=t,t=null),r||={},s=r.tolerance===void 0?1e-7:r.tolerance,_=r.epsilon===void 0?2220446049250313e-31:r.epsilon,c=r.maxIterations===void 0?20:r.maxIterations,m=r.h===void 0?1e-4:r.h,g=r.verbose===void 0?!1:r.verbose,h=1/m,l=0;l++<c;){if(a=e(n),t?o=t(n):(u=e(n+m),d=e(n-m),f=e(n+2*m),p=e(n-2*m),o=(p-f+8*(u-d))*h/12),Math.abs(o)<=_*Math.abs(a))return g&&console.log(`Newton-Raphson: failed to converged due to nearly zero first derivative`),!1;if(i=n-a/o,Math.abs(i-n)<=s*Math.abs(i))return g&&console.log(`Newton-Raphson: converged to x = `+i+` after `+l+` iterations`),i;n=i}return g&&console.log(`Newton-Raphson: Maximum iterations reached (`+c+`)`),!1}})),Cd=g(xd(),1),wd=g(Sd(),1),Td=class{segments;constructor(e){this.segments=[];let t=new Ed,n=bd(t);n.lineStart();for(let t of e)n.point(t.x,t.y);n.lineEnd(),this.segments=t.segments}sample(e){if(e<=0)return this.segments[0].startY;if(e>=this.segments[this.segments.length-1].endX)return this.segments[this.segments.length-1].endY;let t=this.segments.find(t=>e>=t.startX&&e<t.endX),n=te(t.startX,t.endX,e);return t.startY!==t.endY&&t.easing!==void 0?I(t.startY,t.endY,t.easing(n)):I(t.startY,t.endY,n)}solve(e,t){let n=(0,wd.default)(t=>this.sample(t)-e,t);return n===!1?t:n}},Ed=class{previousPoint={x:0,y:0};segments=[];bezierCurveTo(e,t,n,r,i,a){let o=this.previousPoint.x,s=this.previousPoint.y,c=i===o?void 0:(0,Cd.default)((e-o)/(i-o),(t-s)/(a-s),(n-o)/(i-o),(r-s)/(a-s));this.segments.push({startX:o,endX:i,startY:s,endY:a,easing:c}),this.previousPoint={x:i,y:a}}lineTo(e,t){this.segments.push({startX:this.previousPoint.x,endX:e,startY:this.previousPoint.y,endY:t,easing:void 0}),this.previousPoint={x:e,y:t}}moveTo(e,t){this.previousPoint={x:e,y:t}}closePath(){}arc(){}rect(){}arcTo(){}quadraticCurveTo(){}};function Dd(e,t,n,r){return t+n/r*e}function Od(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}function kd(e,t,n,r){let i=1.70158,a=0,o=n;return e===0?t:(e/=r)===1?t+n:(a||=r*.3,o<Math.abs(n)?(o=n,i=a/4):i=a/(2*Math.PI)*Math.asin(n/o),o*2**(-10*e)*Math.sin((e*r-i)*(2*Math.PI)/a)+n+t)}function Ad(e,t,n,r,i){return i===void 0&&(i=1.70158),n*((e=e/r-1)*e*((i+1)*e+i)+1)+t}function jd(e,t,n,r){return(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t}var Md=class{script;xCurve;yCurve;fovCurve;zoomCurve;pitchCurve;bearingCurve;altitudeCurve;elevationCurve;constructor(e){this.script=rd(e),this.xCurve=this.createMonotonicCurve(this.script,`x`),this.yCurve=this.createMonotonicCurve(this.script,`y`),this.fovCurve=this.createMonotonicCurve(this.script,`fov`),this.zoomCurve=this.createMonotonicCurve(this.script,`zoom`),this.pitchCurve=this.createMonotonicCurve(this.script,`pitch`),this.bearingCurve=this.createMonotonicCurve(this.script,`bearing`),this.altitudeCurve=this.createMonotonicCurve(this.script,`altitude`),this.elevationCurve=this.createMonotonicCurve(this.script,`elevation`)}sample(e){let t=this.zoomCurve.sample(e),n=this.altitudeCurve.solve(od(t),e),r=this.xCurve.sample(n),i=this.yCurve.sample(n),o=this.elevationCurve.sample(n),s=this.bearingCurve.sample(e),c=this.pitchCurve.sample(e),l=this.fovCurve.sample(e);return{center:new a(r,i).toLngLat(),zoom:t,bearing:s,pitch:c,fov:l,elevation:o}}createMonotonicCurve(e,t){let n=[];for(let r=0;r<e.length;r++){let i=r===0,a=r===e.length-1,o=e[r],s=e[r+1],c=e[r-1],l=this.getKeyframeValue(o,t);if(i&&n.push({x:-1,y:l}),n.push({x:o.time,y:l}),!i&&!a&&c.transition===`instant`&&o.transition===`ease`&&n.push({x:o.time+.1,y:l}),!a)if(o.transition===`linear`){let e=o.time+.1,r=s.time-.1,i=te(o.time,s.time,e),a=te(o.time,s.time,r),c=this.getKeyframeValue(s,t);n.push({x:e,y:I(l,c,i)}),n.push({x:r,y:I(l,c,a)})}else o.transition===`instant`&&(n.push({x:o.time+.1,y:l}),n.push({x:s.time-.1,y:l}));a&&n.push({x:o.time+1,y:l})}return new Td(n)}sampleAutoHideOpacity(e){let t=this.script;if(t.length<2)return 1;let n=this.getKeyframeIndexByTime(e);if(n===-1||n===t.length-1)return 1;let r=t[n],i=t[n+1],a=n>0?t[n-1]:void 0,o;if(r.hideLabels===(a?.hideLabels??!1))o=r.hideLabels?0:1;else{let t=e-r.time,n=Math.min(400,i.time-r.time);o=ne(Od(t,r.hideLabels?1:0,r.hideLabels?-1:1,n),0,1)}let s;if(n===t.length-2&&r.hideLabels){let t=Math.max(r.time,i.time-400);s=ne(Od(e-t,0,1,i.time-t),0,1)}else s=0;return Math.max(o,s)}getKeyframeIndexByTime(e){let t=this.script;if(t.length!==0){for(let n=0;n<t.length;n++)if(e<t[n].time)return n-1;return t.length-1}}getKeyframeValue(e,t){return t===`altitude`?od(e.zoom):e[t]}},Nd=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor"><path d="M2.83545 2.66675V6.00008H6.00078M3.38078 5.33341C3.99882 4.26305 4.96943 3.44057 6.1267 3.00656C7.28398 2.57255 8.55607 2.55396 9.72553 2.95397C10.895 3.35397 11.8892 4.14774 12.5383 5.19959C13.1873 6.25144 13.4509 7.49606 13.2839 8.72072C13.117 9.94537 12.5298 11.074 11.6229 11.9137C10.716 12.7535 9.54555 13.2521 8.31169 13.3245C7.07782 13.3968 5.85714 13.0384 4.85828 12.3104C3.85942 11.5824 3.1444 10.5302 2.83545 9.33341" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
|
519
|
+
`,Pd=`<svg xmlns="http://www.w3.org/2000/svg" width="10" height="12" viewBox="0 0 10 12" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M0.991136 3.66807e-08C1.53861 1.64225e-08 1.98242 0.474849 1.98242 1.06061L1.98242 10.6061C1.98242 11.1918 1.53861 11.6667 0.991137 11.6667C0.443665 11.6667 -0.000148911 11.1918 -0.000148941 10.6061L-0.000149434 1.06061C-0.000149464 0.47485 0.443664 5.69389e-08 0.991136 3.66807e-08Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8.92082 3.66807e-08C9.4683 1.64225e-08 9.91211 0.474849 9.91211 1.06061L9.91211 10.6061C9.91211 11.1918 9.4683 11.6667 8.92082 11.6667C8.37335 11.6667 7.92954 11.1918 7.92954 10.6061L7.92954 1.06061C7.92954 0.47485 8.37335 5.69389e-08 8.92082 3.66807e-08Z"/></svg>
|
|
520
|
+
`,Fd=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M4.88141 14.9874C4.58039 14.9874 4.2919 14.9121 4.01596 14.774C3.38883 14.4475 3 13.8072 3 13.104V2.88322C3 2.18007 3.38883 1.5397 4.01596 1.21323C4.6431 0.886771 5.39567 0.936996 5.97263 1.35135L13.2098 6.46175C13.7115 6.81332 14 7.39091 14 8.00617C14 8.62142 13.699 9.18645 13.2098 9.55059L5.97263 14.6484C5.64652 14.8744 5.27024 15 4.89396 15L4.88141 14.9874ZM4.88141 2.2554C4.78107 2.2554 4.68073 2.28052 4.59293 2.33074C4.3797 2.44375 4.25428 2.64465 4.25428 2.88322V13.104C4.25428 13.3426 4.3797 13.556 4.59293 13.6565C4.80616 13.7695 5.04447 13.7444 5.24515 13.6063L12.4823 8.49586C12.5634 8.4368 12.6294 8.35937 12.6749 8.2699C12.7204 8.18043 12.7442 8.08145 12.7442 7.98105C12.7442 7.88065 12.7204 7.78168 12.6749 7.69221C12.6294 7.60274 12.5634 7.52531 12.4823 7.46625L5.24515 2.36841C5.1378 2.29542 5.01118 2.25608 4.88141 2.2554Z"/></svg>
|
|
521
|
+
`,Id=e=>`
|
|
522
|
+
<div class="video-slider-container">
|
|
523
|
+
<div class="video-slider-line-wrapper">
|
|
524
|
+
<div class="video-slider-line-left"></div>
|
|
525
|
+
<div class="video-slider-line"></div>
|
|
526
|
+
</div>
|
|
527
|
+
<input class="video-slider" type="range" step="any" min="0" max="${e}" value="0" />
|
|
528
|
+
</div>
|
|
529
|
+
<div class="video-controls-row">
|
|
530
|
+
<button class="video-button play">
|
|
531
|
+
<span class="video-icon play-icon">${Fd}</span>
|
|
532
|
+
<span class="video-icon pause-icon">${Pd}</span>
|
|
533
|
+
</button>
|
|
534
|
+
<button class="video-button restart">
|
|
535
|
+
${Nd}
|
|
536
|
+
</button>
|
|
537
|
+
<div class="video-time">
|
|
538
|
+
<span class="video-playhead">${cd(0)}</span> /
|
|
539
|
+
<span class="video-duration">${cd(e)}</span>
|
|
540
|
+
</div>
|
|
541
|
+
<button class="video-button fullscreen">
|
|
542
|
+
${ma}
|
|
543
|
+
</button>
|
|
544
|
+
</div>
|
|
545
|
+
`,Ld=class{callbacks;duration;container;mapContainer;playButton;restartButton;fullscreenButton;slider;sliderFill;playheadLabel;playhead=0;isPlaying=!1;constructor(e,t,n){this.duration=t,this.callbacks=n,this.mapContainer=e.getContainer(),this.container=document.createElement(`div`),this.container.className=`video-controls`,this.container.innerHTML=Id(t),this.playButton=this.container.querySelector(`.video-button.play`),this.restartButton=this.container.querySelector(`.video-button.restart`),this.fullscreenButton=this.container.querySelector(`.video-button.fullscreen`),this.slider=this.container.querySelector(`.video-slider`),this.sliderFill=this.container.querySelector(`.video-slider-line-left`),this.playheadLabel=this.container.querySelector(`.video-playhead`),this.playButton.addEventListener(`click`,()=>this.callbacks.playPause()),this.restartButton.addEventListener(`click`,()=>this.callbacks.restart()),this.fullscreenButton.addEventListener(`click`,()=>ya(this.mapContainer)),this.slider.addEventListener(`input`,()=>{this.duration>0&&this.callbacks.seek(Number(this.slider.value))}),this.mapContainer.appendChild(this.container),this.update()}setPlayhead(e){this.playhead=e,this.update()}setPlaying(e){this.isPlaying=e,this.update()}update(){let{duration:e,playhead:t}=this;this.playButton.classList.toggle(`playing`,this.isPlaying),this.restartButton.classList.toggle(`disabled`,t===0),this.slider.value=String(t),this.sliderFill.style.width=`${te(0,e,t)*100}%`,this.playheadLabel.textContent=cd(t)}},Rd=class extends t{time;constructor(e,t){super(e),this.time=t}},zd={linear:Dd,easeOutCubic:Od,easeOutBack:Ad,easeOutBounce:jd,easeOutElastic:kd};function Bd(e){return e.entryType===`fade`||e.exitType===`fade`||e.entryType===`instant`||e.exitType===`instant`}function Vd(e){return e.entryType===`grow`||e.exitType===`grow`}function Hd(e,t,n){let{entry:r,entryDuration:i,exit:a,exitDuration:o}=e,{entryType:s,entryEasing:c,exitType:l,exitEasing:u}=e;return n<r&&(s===t||s===`instant`&&t===`fade`)||n>a&&(l===t||l===`instant`&&t===`fade`)?0:i>0&&n<r+i&&s===t?zd[c](n-r,0,1,i):o>0&&n>a-o&&l===t?zd[u](n-(a-o),1,-1,o):1}function Ud(e){return e.target.type===`model`}function Wd(e){return e.target.type===`layer`||e.target.type===`overlay`}var Gd=class{mcMap;cameraCurve;registryAnimations;layerAnimations;registry;svgs;svgCache;duration;frameRate;loop;mapstyle;overlays;layerInfo;backgroundColor;playhead;playbackContext;controls;preloadOverlay;constructor(e,t,n,r,i,o,s,c){this.mcMap=e,this.playhead=0,this.playbackContext=void 0;let l=(t.video?.keyframes??[]).map(e=>{let{x:t,y:n}=a.fromLngLat(e.center);return{...e,x:t,y:n,fov:e.fov??36.87,elevation:e.elevation??0}}),u=t.video?.animations??[];this.layerAnimations=u.filter(Wd);let d=u.filter(Ud);this.registryAnimations=[...d.filter(e=>e.target.modelId===void 0),...d.filter(e=>e.target.modelId!==void 0)],this.duration=sd(l),this.frameRate=ld(t.export?.frameRate??60),this.cameraCurve=new Md(l),this.registry=new Fu(t),this.svgs=n,this.svgCache=r,this.mapstyle=i,this.overlays=o,this.layerInfo=s,this.backgroundColor=c;let f=t.export?.format===`web_video`;this.loop=f&&(t.web?.loop??!1),f&&t.web?.controls&&(this.controls=new Ld(e.map,this.duration,{playPause:()=>this.playbackContext===void 0?this.play():this.pause(),restart:()=>{this.seekTo(0),this.play()},seek:e=>{this.pause(),this.seekTo(e)}}));let p=this.mcMap.map;p.setCenterClampedToGround(!1),p.setRasterAlignment(!1),p.style?.stylesheet&&(p.style.stylesheet.transition={duration:0,delay:0}),this.setFrame(0),f&&this.launch(t)}async launch(e){e.web?.preload&&await this.preload(),e.web?.autoplay&&setTimeout(()=>this.play())}play(){this.playbackContext===void 0&&this.duration>0&&(this.playhead>=this.duration&&(this.playhead=0),this.playbackContext={startTime:Date.now(),startPlayhead:this.playhead},this.mcMap.fire(new Rd(`playstart`,this.playhead)),this.controls?.setPlaying(!0),this.playFrame())}pause(){this.playbackContext!==void 0&&(this.playbackContext=void 0,this.mcMap.fire(new Rd(`playend`,this.playhead)),this.controls?.setPlaying(!1))}seekTo(e){this.duration>0&&(e=ne(e,0,this.duration),this.setFrame(e),this.playbackContext!==void 0&&(this.playbackContext={startTime:Date.now(),startPlayhead:e}))}remove(){this.playbackContext=void 0}async*frames(e){let t=this.mcMap.map,n=Math.ceil(this.duration*this.frameRate/1e3);t._fadeDuration=0;let r=t.getCanvas(),{width:i,height:a}=r,o=new OffscreenCanvas(i,a),s=o.getContext(`2d`,{willReadFrequently:!0}),c=t.getContainer(),l=c.getBoundingClientRect();for(let t=0;t<n;t++)yield this.captureFrame(t*1e3/this.frameRate,e,r,o,s,i,a,c,l);t._fadeDuration=300,this.playhead=0}async preload(){this.playbackContext!==void 0&&this.pause();let e=this.mcMap.map,t=Math.ceil(this.duration*this.frameRate/1e3);this.preloadOverlay=new fd(this.mcMap.map),e._fadeDuration=0;try{let n;for(let r=0;r<t;r++){this.preloadOverlay?.setProgress(r/t);let i=this.cameraCurve.sample(r*1e3/this.frameRate);ud(n,i)||(this.setCamera(i),await this.waitForRenderOrAbort()===`render`?n=i:(n!==void 0&&this.setCamera(n),e.triggerRepaint(),await e.once(`idle`),r--))}e.areTilesLoaded()||await e.once(`idle`)}finally{this.setFrame(this.playhead),e._fadeDuration=300,this.preloadOverlay?.remove(),this.preloadOverlay=void 0}}waitForRenderOrAbort(){let e=this.mcMap.map;return new Promise(t=>{let n=()=>{e.off(`render`,r),e.off(`dataabort`,i)},r=()=>{n(),t(`render`)},i=e=>{e.tile?.state===`loading`&&(n(),t(`abort`))};e.on(`render`,r),e.on(`dataabort`,i)})}async captureFrame(e,t,n,r,i,a,o,s,c){return this.setFrame(e),await this.mcMap.map.once(`idle`),i.fillStyle=this.backgroundColor,i.fillRect(0,0,a,o),i.drawImage(n,0,0),await je(i,this.svgCache,s,c),t?r.convertToBlob():i.getImageData(0,0,a,o)}playFrame(){if(this.playbackContext!==void 0){let e=this.playbackContext.startPlayhead+(Date.now()-this.playbackContext.startTime);e>this.duration?this.loop?(this.seekTo(0),requestAnimationFrame(()=>this.playFrame())):(this.setFrame(this.duration),this.playbackContext=void 0,this.mcMap.fire(new Rd(`playend`,this.playhead)),this.controls?.setPlaying(!1)):(this.setFrame(e),requestAnimationFrame(()=>this.playFrame()))}}setFrame(e){this.playhead=e;let t=this.cameraCurve.sample(e);this.setCamera(t),this.applyAnimations(e),this.mcMap.fire(new Rd(`play`,e)),this.controls?.setPlayhead(e)}setCamera(e){let t=this.mcMap.map,n=t.getCenter(),r=t.getZoom(),i=t.getBearing(),a=t.getPitch(),o=t.getCenterElevation(),s=t.getVerticalFieldOfView();e.center.lat!==n.lat||e.center.lng!==n.lng||e.zoom!==r||e.bearing!==i||e.pitch!==a||e.elevation!==o||e.fov!==s?(t.setVerticalFieldOfView(e.fov),t.jumpTo(e)):t.triggerRepaint()}applyAnimations(e){let t=this.mcMap.map,{svgs:n,svgCache:r,registryAnimations:i}=this;for(let n of i){let{target:r}=n;if(!Bd(n))continue;let{modelType:i,groupId:a,modelId:o}=r,s=Hd(n,`fade`,e);if(i===`area`){let e=this.registry.models.area[a]??{},n=o===void 0?Object.values(e):e[o]?[e[o]]:[];for(let e of n)t.setFeatureState({source:wi(e),sourceLayer:e.sourceLayerId,id:e.featureId},{[`opacity-${a}`]:s})}else if(i===`polygon`||i===`circle`||i===`line`||i===`marker`||i===`dot`){let e=this.registry.models[i][a]??{},n=o===void 0?Object.keys(e):[o];for(let e of n)t.setFeatureState({source:a,id:E(e)},{opacity:s})}}for(let i of Object.values(this.registry.groups.circle)){let{groupAnimation:a,modelAnimations:o}=this.getGroupAnimations(`circle`,i.id,`scale`),s=a===void 0?1:Hd(a,`grow`,e);(a!==void 0||o.size>0)&&t.getSource(i.id).setData({type:`FeatureCollection`,features:i.models.filter(e=>e.visible??!0).map(t=>{let a=o.get(t.id);return pu(i,t,a===void 0?s:Hd(a,`grow`,e),n,r)})})}for(let n of Object.values(this.registry.groups.line)){let{groupAnimation:i,modelAnimations:a}=this.getGroupAnimations(`line`,n.id,`scale`),o=i===void 0?1:Hd(i,`grow`,e);(i!==void 0||a.size>0)&&t.getSource(n.id).setData({type:`FeatureCollection`,features:n.models.filter(e=>e.visible??!0).map(i=>{let s=a.get(i.id);return Uu(t,n,i,s===void 0?o:Hd(s,`grow`,e),r)})})}for(let i of Object.values(this.registry.groups.marker)){let{groupAnimation:a,modelAnimations:o}=this.getGroupAnimations(`marker`,i.id,`scale`),s=a===void 0?1:Hd(a,`grow`,e);(a!==void 0||o.size>0)&&t.getSource(i.id).setData({type:`FeatureCollection`,features:i.models.filter(e=>e.visible??!0).map(a=>{let c=o.get(a.id);return _u(t,i,a,c===void 0?s:Hd(c,`grow`,e),n,r)})})}let a=this.cameraCurve.sampleAutoHideOpacity(e);for(let t of this.mapstyle.layers){let n=this.getLayerOpacity(t,e,void 0);n===void 0?t.type===`symbol`&&this.setLayerOpacity(t,a):this.setLayerOpacity(t,n)}for(let[t,n]of this.overlays)for(let r of n.layers){let n=this.getLayerOpacity(r,e,t);n===void 0?this.resetLayerOpacity(r):this.setLayerOpacity(r,n)}}getGroupAnimations(e,t,n){let r,i=new Map;for(let a of this.registryAnimations){let{target:o}=a;o.modelType===e&&o.groupId===t&&(n===`opacity`&&Bd(a)||n===`scale`&&Vd(a))&&(o.modelId===void 0?r=a:i.set(o.modelId,a))}return{groupAnimation:r,modelAnimations:i}}getLayerOpacity(e,t,n){let r,i,a=1/0;n!==void 0&&(r=this.layerAnimations.find(e=>e.target.type===`overlay`&&e.target.id===n));for(let t of this.layerAnimations){let{target:n}=t;n.type===`layer`&&n.ids.includes(e.id)&&n.ids.length<a&&(i=t,a=n.ids.length)}let o=this.layerInfo[e.id]?.opacity??Zl[e.type].defaultValue;return i===void 0?r===void 0?void 0:Hd(r,`fade`,t)*o:Hd(i,`fade`,t)*o}setLayerOpacity(e,t){let n=this.mcMap.map,r=Zl[e.type];for(let i of r.props)n.setPaintProperty(e.id,i,t)}resetLayerOpacity(e){let t=this.mcMap.map,n=Zl[e.type],r=this.layerInfo[e.id]?.opacity;for(let i of n.props)t.setPaintProperty(e.id,i,r??e.paint?.[i]??n.defaultValue)}},Kd=class extends n{map;format;mapstyle;svgCache;backgroundColor;vapiUrl;accessToken;image;video;constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(),this.map=e,this.format=t,this.mapstyle=o,this.svgCache=a,this.backgroundColor=l,this.vapiUrl=u,this.accessToken=d,this.image=new nd(this,t,a,l),n===`video`&&(r.video?.keyframes??[]).length>0&&(this.video=new Gd(this,r,i,a,o,s,c,l))}play(){this.video?.play()}pause(){this.video?.pause()}seekTo(e){this.video?.seekTo(e)}async*frames(e=!1){this.video===void 0?yield this.image.frame(e):yield*this.video.frames(e)}preload(){return this.video?.preload()??Promise.resolve()}geoTiffMetadata(e){return ed(this.map,e)}svgExportOptions(e,t,n){return{map:this.map,api:e,signal:n,options:{svgElements:Ae(this.map.getContainer()),fillPatterns:this.svgCache.getFillPatterns(2*window.devicePixelRatio),backgroundColor:this.backgroundColor,detailLevel:this.map.getDetailLevel(),forPDF:this.format===`pdf`,geoRef:this.format===`svg`&&!!t}}}pdfExportOptions(e){return Yu(this.mapstyle,this.svgCache.fonts,{vapiUrl:this.vapiUrl,accessToken:this.accessToken,apiUrl:e.href,bearerToken:e.token})}remove(){let e=this.map.getContainer();ru(this.map),this.video?.remove(),this.map.remove(),e.innerHTML=``,e.style.backgroundColor=``,e.classList.remove(`mc-map`),e.classList.remove(`mc-mode-web`)}};async function qd(t){let{accessToken:n,env:r=`production`}=t,a=r===`bleeding`?`https://vapi.bleeding.mc-cdn.io`:r===`beta`?`https://vapi.beta.mc-cdn.io`:`https://vapi.mc-cdn.io`,o=r===`bleeding`?`https://cdn.bleeding.mapcreator.io`:r===`beta`?`https://cdn.beta.mapcreator.io`:`https://cdn.mapcreator.io`,s=typeof t.job==`string`?await Jd(t.job,o,n):t.job,c=s.export?.format??`png`,l=eu[c]??`static`;await Yd();let u={container:t.container,attributionControl:!1,style:null,maxBounds:[-1/0,-90,1/0,90],maxPitch:85,maxZoom:22,locale:{"CooperativeGesturesHandler.WindowsHelpText":Oa(`windowsHelpText`),"CooperativeGesturesHandler.MacHelpText":Oa(`macHelpText`),"CooperativeGesturesHandler.MobileHelpText":Oa(`mobileHelpText`)},maxCanvasSize:F(),canvasContextAttributes:{preserveDrawingBuffer:t.preserveDrawingBuffer??!1}};l===`video`&&(u.maxTileCacheSize=1/0,u.maxTileCacheZoomLevels=1/0,u.refreshExpiredTiles=!1);let d=new i(u),f=d.getContainer();f.classList.add(`mc-map`),l===`interactive`&&f.classList.add(`mc-mode-web`);let p=l===`interactive`?new Lu(d,t.youTubePlaceholder??!1):void 0,{map:{language:m,hideBasemap:h,detailLevel:g=0,projection:v=`mercator`,terrain:b=!1,terrainExaggeration:S=1},registry:C={},web:w,positionOffsets:T}=s,{models:E={},slots:D={},svgs:O={}}=C,k=new Ue(d,await ge(r,a,n),a,n);d.resize();let A=l===`video`?s.video?.keyframes[0]:void 0,j=A?.pitch??s.map.pitch??0,M=A?.bearing??s.map.rotation??0,N=A?.zoom??s.map.zoom,P=A?.center===void 0?s.map.center:{lng:A.center[0],lat:A.center[1]};d.setPitch(j),d.setBearing(M);let ee=R(s,f,l,c),I,te;l===`interactive`?(te=N-g+Math.log2(ee),I=1):(te=N-g,I=ee,d.on(`resize`,()=>{let e=R(s,f,l,c);e!==d.getScale()&&d.setScale(e)})),d.setScale(I),d.setZoom(te),d.setCenter(P),d.setDetailLevel(g),d.setMinZoom(g),d.addControl(new e({compact:!1})),await iu(s,T??Yl,d,k,{center:P,zoom:te,pitch:j,rotation:M},o,l),p?.setJobObject(s);let ne=l!==`interactive`||(w?.restrictMapMovement??!1);ne&&(d.boxZoom.disable(),d.doubleClickZoom.disable(),d.dragPan.disable(),d.dragRotate.disable(),d.keyboard.disable(),d.scrollZoom.disable(),d.touchPitch.disable(),d.touchZoomRotate.disable(),d.getCanvasContainer().style.cursor=`default`),p?.setParams(w?.popupPosition??`bottomLeft`,x(m,y.TWO),ne,P);let re=s.meta?.mapstyleSet,L=re===void 0?{version:8,sources:{},layers:[]}:await fetch(`${a}/styles/${re}.json?access_token=${n}`).then(e=>e.json());lu(L),d.setStyle(null),d.setStyle(L),await d.once(`style.load`),ue(d,l),d.on(`moveend`,()=>ue(d,l)),d.on(`resize`,()=>ue(d,l)),d.on(`attributionchange`,()=>ue(d,l)),_(m,d);let z=s.map.overlays??[],ie=s.meta?.layers??[];z.length!==ie.length&&(z=[],ie=[]);let ae=await vu(z,ie,d,a,n,L.metadata?.styleOverride),oe=z.reduce((e,t,n)=>e.set(t,ae[n]),new Map);tf(d,k,E,D,O,a,n,l),_(m,d),p?.setPublication(L.metadata?.publication),p?.setpopupElements(),p?.setHighlightManager(),d.setProjection({type:v===`globe`?`globe`:`mercator`});let se=Xd(d,v);Zd(d,se),b&&Qd(d,a,n,S);let ce=$d(s.map.layerInfo,L,ae);ef(d,ce,!h);let le=new Kd(d,c,l,s,O,k,L,oe,ce,se,a,n);return await k.settledImages(),le}function Jd(e,t,n){return fetch(`${t}/jobs/${e}.json?access_token=${n}`).then(e=>e.json())}function Yd(){return new Promise(e=>{let t=()=>{window.innerWidth>0&&window.innerHeight>0&&(window.removeEventListener(`resize`,t),e())};window.addEventListener(`resize`,t),t()})}function Xd(e,t){let n=e.getStyle().metadata??{},r=n[`mc:background-color`]??`#f8f8f8`,i=n[`mc:background-color-globe`]??`#000000`;return t===`globe`?i:r}function Zd(e,t){e.getContainer().style.backgroundColor=t,e.setSky(e.getStyle().sky??Jl),e.setLight({position:[1.15,210,45]})}function Qd(e,t,n,r){e.addSource(`mc-dem`,{type:`raster-dem`,tiles:[`${t}/dataset/jaxa_terrainrgb/{z}/{x}/{y}?access_token=${n}`],attribution:`<a href="https://earth.jaxa.jp/en/data/policy" target="_blank">© AW3D30 (JAXA)</a>`,minzoom:0,maxzoom:12}),e.setTerrain({source:`mc-dem`,exaggeration:r})}function $d(e,t,n){let r=e?.reduce((e,t)=>(e[t.id]={visibility:t.visibility,...t.opacity!==void 0&&{opacity:t.opacity}},e),{})??{},i={};for(let e of t.layers)i[e.id]=r[e.id]??{visibility:(e.layout?.visibility??`visible`)===`visible`};for(let e of n)for(let t of e.layers)i[t.id]=r[t.id]??{visibility:!1};return i}function ef(e,t,n){for(let r in t){let i=e.getLayer(r);if(i!==void 0){let a=t[r];if(e.setLayoutProperty(r,`visibility`,a.visibility&&n?`visible`:`none`),a.opacity!==void 0){let t=Zl[i.type];for(let n of t.props)e.setPaintProperty(r,n,a.opacity)}}}}function tf(e,t,n,r,i,a,o,s){let{beforeNone:c=[],beforeNames:l=[],beforeBoundaries:u=[],beforeWaters:d=[]}=r;c.forEach(r=>{nf(e,t,n,r,i,`mc-before-none`,a,o,s)}),l.forEach(r=>{nf(e,t,n,r,i,`mc-before-names`,a,o,s)}),u.forEach(r=>{nf(e,t,n,r,i,`mc-before-boundaries`,a,o,s)}),d.forEach(r=>{nf(e,t,n,r,i,`mc-before-waters`,a,o,s)})}function nf(e,t,n,r,i,a,o,s,c){if(r.type===`marker`){let o=n.marker?.find(e=>e.id===r.groupId);o&&hu(e,o,a,i,t,c)}else if(r.type===`polygon`){let o=n.polygon?.find(e=>e.id===r.groupId);o&&uu(e,o,a,i,t)}else if(r.type===`circle`){let o=n.circle?.find(e=>e.id===r.groupId);o&&fu(e,o,a,i,t)}else if(r.type===`line`){let i=n.line?.find(e=>e.id===r.groupId);i&&Hu(e,i,a,t,c)}else if(r.type===`dot`){let t=n.dot?.find(e=>e.id===r.groupId);t&&Ku(e,t,a)}else if(r.type===`area`){let c=n.area?.find(e=>e.id===r.groupId);c&&Gu(e,c,a,i,t,o,s)}}export{qd as initMap};
|