@maptalks/vt 0.63.8 → 0.63.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/maptalks.vt.js +6 -5
- package/dist/maptalks.vt.mjs +4 -4
- package/package.json +2 -2
package/dist/maptalks.vt.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @maptalks/vt v0.63.
|
|
2
|
+
* @maptalks/vt v0.63.9
|
|
3
3
|
* LICENSE : undefined
|
|
4
4
|
* (c) 2016-2022 maptalks.org
|
|
5
5
|
*/
|
|
@@ -27,7 +27,7 @@ import F from "@maptalks/vt-plugin";
|
|
|
27
27
|
|
|
28
28
|
import E from "@mapbox/point-geometry";
|
|
29
29
|
|
|
30
|
-
const H = 'function(t){\n/*!\n Feature Filter by\n\n (c) mapbox 2016 and maptalks 2018\n www.mapbox.com | www.maptalks.org\n License: MIT, header required.\n */\nconst n=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function i(t){return new Function("f","var p = (f && f.properties || {}); return "+e(t))}function e(t){if(!t)return"true";const n=t[0];if(t.length<=1)return"any"===n?"false":"true";return`(${"=="===n?s(t[1],t[2],"===",!1):"!="===n?s(t[1],t[2],"!==",!1):"<"===n||">"===n||"<="===n||">="===n?s(t[1],t[2],n,!0):"any"===n?o(t.slice(1),"||"):"all"===n?o(t.slice(1),"&&"):"none"===n?u(o(t.slice(1),"||")):"in"===n?a(t[1],t.slice(2)):"!in"===n?u(a(t[1],t.slice(2))):"has"===n?h(t[1]):"!has"===n?u(h(t[1])):"true"})`}function r(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function s(t,i,e,s){const o=r(t),a="$type"===t?n.indexOf(i):JSON.stringify(i);return(s?`typeof ${o}=== typeof ${a}&&`:"")+o+e+a}function o(t,n){return t.map(e).join(n)}function a(t,i){"$type"===t&&(i=i.map(t=>n.indexOf(t)));const e=JSON.stringify(i.sort(l)),s=r(t);return i.length<=200?`${e}.indexOf(${s}) !== -1`:`function(v, a, i, j) {\\n while (i <= j) { var m = (i + j) >> 1;\\n if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;\\n }\\n return false; }(${s}, ${e},0,${i.length-1})`}function h(t){return"$id"===t?\'"id" in f\':JSON.stringify(t)+" in p"}function u(t){return`!(${t})`}function l(t,n){return t<n?-1:t>n?1:0}function c(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];for(const n in i)t[n]=i[n]}return t}function f(t,n){for(let i=0;i<t.stops.length;i++)if(n===t.stops[i][0])return t.stops[i][1];return t.default}function d(t,n){for(var i=0;i<t.stops.length&&!(n<t.stops[i][0]);i++);return t.stops[Math.max(i-1,0)][1]}function y(t,n){for(var i=void 0!==t.base?t.base:1,e=0;!(e>=t.stops.length||n<=t.stops[e][0]);)e++;return 0===e?t.stops[e][1]:e===t.stops.length?t.stops[e-1][1]:function t(n,i,e,r,s,o){return"function"==typeof s?function(){var a=s.apply(void 0,arguments),h=o.apply(void 0,arguments);return t(n,i,e,r,a,h)}:s.length?function(t,n,i,e,r,s){var o=[];for(let a=0;a<r.length;a++)o[a]=p(t,n,i,e,r[a],s[a]);return o}(n,i,e,r,s,o):p(n,i,e,r,s,o)}(n,i,t.stops[e-1][0],t.stops[e][0],t.stops[e-1][1],t.stops[e][1])}function v(t,n){return function(t,n,i){return void 0!==t?t:void 0!==n?n:void 0!==i?i:null}(n,t.default)}function p(t,n,i,e,r,s){var o,a=e-i,h=t-i;return r*(1-(o=1===n?h/a:(Math.pow(n,h)-1)/(Math.pow(n,a)-1)))+s*o}function m(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type)}function g(t){return b(t,"exponential")}function w(t){return b(t,"interval")}function M(t,n){if(!t)return null;var i=!1;if(Array.isArray(t)){var e,r=[];for(let s=0;s<t.length;s++)(e=M(t[s],n))?(r.push(e),i=!0):r.push(t[s]);return i?r:t}var s,o={__fn_types_loaded:!0},a=[];for(s in t)t.hasOwnProperty(s)&&a.push(s);const h=function(t){Object.defineProperty(o,t,{get:function(){return this["__fn_"+t]||(this["__fn_"+t]=g(this["_"+t])),this["__fn_"+t].apply(this,n())},set:function(n){this["_"+t]=n},configurable:!0,enumerable:!0})};for(let n=0,e=a.length;n<e;n++)m(t[s=a[n]])?(i=!0,o["_"+s]=t[s],h(s)):o[s]=t[s];return i?o:t}function b(t,n){if(!m(t))return function(){return t};let i=!0,e=!0;const r=(t=JSON.parse(JSON.stringify(t))).stops;if(r)for(let t=0;t<r.length;t++)if(m(r[t][1])){const s=b(r[t][1],n);i=i&&s.isZoomConstant,e=e&&s.isFeatureConstant,r[t]=[r[t][0],s]}const s=function t(n,i){var e,r,s;if(m(n)){var o,a=n.stops&&"object"==typeof n.stops[0][0],h=a||void 0!==n.property,u=a||!h,l=n.type||i||"exponential";if("exponential"===l)o=y;else if("interval"===l)o=d;else if("categorical"===l)o=f;else{if("identity"!==l)throw new Error(\'Unknown function type "\'+l+\'"\');o=v}if(a){var c={},p=[];for(let t=0;t<n.stops.length;t++){var g=n.stops[t];void 0===c[g[0].zoom]&&(c[g[0].zoom]={zoom:g[0].zoom,type:n.type,property:n.property,default:n.default,stops:[]}),c[g[0].zoom].stops.push([g[0].value,g[1]])}for(let n in c)p.push([c[n].zoom,t(c[n])]);e=function(t,i){const e=y({stops:p,base:n.base},t)(t,i);return"function"==typeof e?e(t,i):e},r=!1,s=!1}else u?(e=function(t){const i=o(n,t);return"function"==typeof i?i(t):i},r=!0,s=!1):(e=function(t,i){const e=o(n,i?i[n.property]:null);return"function"==typeof e?e(t,i):e},r=!1,s=!0)}else e=function(){return n},r=!0,s=!0;return e.isZoomConstant=s,e.isFeatureConstant=r,e}(t,n);return s.isZoomConstant=i&&s.isZoomConstant,s.isFeatureConstant=e&&s.isFeatureConstant,s}let x=0;const F="function"==typeof Object.assign;function A(t,...n){if(F)return Object.assign(t,...n),t;for(let i=0;i<n.length;i++){const e=n[i];for(const n in e)t[n]=e[n]}return t}function k(t){return!O(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function P(t){return"number"==typeof t&&!isNaN(t)}function S(t){return!O(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function _(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function O(t){return null==t}function I(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];if(i)for(let n=0,e=i.length;n<e;n++)t.push(i[n])}return t.length}function T(t){return t<65536?Uint16Array:Uint32Array}function L(t){return t<256?Uint8Array:t<65536?Uint16Array:Uint32Array}function U(t){return(t=Math.abs(t))<128?Int8Array:t<32768?Int16Array:Float32Array}function z(t){return function t(n){if(!Array.isArray(n))return t([n]);const e=[];for(let t=0;t<n.length;t++){let r;r=!0===n[t].filter?function(){return!0}:i(n[t].filter),e.push(c({},n[t],{filter:r}))}return e}(t=t.map(t=>{const n=A({},t);return n.filter&&n.filter.value&&(n.filter=n.filter.value),n}))}function D(t){return m(t)&&t.property}const E="function"==typeof fetch&&"function"==typeof AbortController,C={jsonp:function(t,n){const i="_maptalks_jsonp_"+x++;t.match(/\\?/)?t+="&callback="+i:t+="?callback="+i;let e=document.createElement("script");return e.type="text/javascript",e.src=t,window[i]=function(t){n(null,t),document.getElementsByTagName("head")[0].removeChild(e),e=null,delete window[i]},document.getElementsByTagName("head")[0].appendChild(e),this},get:function(t,n,i){if(S(n)){const t=i;i=n,n=t}(n=n||{}).method&&(n.method=n.method.toUpperCase());const e="POST"===n.method;if(E){const r=new AbortController,s={signal:r.signal,method:n.method||"GET",referrerPolicy:"origin"};return e&&(O(n.body)||(s.body=JSON.stringify(n.body))),O(n.headers)||(s.headers=n.headers),O(n.credentials)||(s.credentials=n.credentials),fetch(t,s).then(t=>{const e=this.t(t,n.returnJSON,n.responseType);e.message?i(e):e.then(e=>{"arraybuffer"===n.responseType?i(null,{data:e,cacheControl:t.headers.get("Cache-Control"),expires:t.headers.get("Expires"),contentType:t.headers.get("Content-Type")}):i(null,e)}).catch(t=>{t.code&&t.code===DOMException.ABORT_ERR||(console.error(t),i(t))})}).catch(t=>{t.code&&t.code===DOMException.ABORT_ERR||(console.error(t),i(t))}),r}{const r=C.s(i);if(r.open(n.method||"GET",t,!0),n){for(const t in n.headers)r.setRequestHeader(t,n.headers[t]);r.withCredentials="include"===n.credentials,n.responseType&&(r.responseType=n.responseType)}return r.send(e?n.body:null),r}},t:(t,n,i)=>200!==t.status?{status:t.status,statusText:t.statusText,message:`incorrect http request with status code(${t.status}): ${t.statusText}`}:"arraybuffer"===i?t.arrayBuffer():n?t.json():t.text(),o:function(t,n){return function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?n({status:200,statusText:t.statusText,message:"http status 200 returned without content."}):n(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else n(null,t.responseText);else n({status:t.status,statusText:t.statusText,message:`incorrect http request with status code(${t.status}): ${t.statusText}`})}},s:function(t){let n;try{n=new XMLHttpRequest}catch(t){try{n=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{n=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}return n.onreadystatechange=C.o(n,t),n},getArrayBuffer(t,n,i){if(S(n)){const t=i;i=n,n=t}return n||(n={}),n.responseType="arraybuffer",C.get(t,n,i)}};function j(t,n,i,e,r,s){var o=r-i,a=s-e;if(0!==o||0!==a){var h=((t-i)*o+(n-e)*a)/(o*o+a*a);h>1?(i=r,e=s):h>0&&(i+=o*h,e+=a*h)}return(o=t-i)*o+(a=n-e)*a}function N(t,n,i,e){var r={id:void 0===t?null:t,type:n,geometry:i,tags:e,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var n=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)H(t,n);else if("Polygon"===i||"MultiLineString"===i)for(var e=0;e<n.length;e++)H(t,n[e]);else if("MultiPolygon"===i)for(e=0;e<n.length;e++)for(var r=0;r<n[e].length;r++)H(t,n[e][r])}(r),r}function H(t,n){for(var i=0;i<n.length;i+=3)t.minX=Math.min(t.minX,n[i]),t.minY=Math.min(t.minY,n[i+1]),t.maxX=Math.max(t.maxX,n[i]),t.maxY=Math.max(t.maxY,n[i+1])}function V(t,n,i,e){if(n.geometry){var r=n.geometry.coordinates,s=n.geometry.type,o=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),a=[],h=n.id;if(i.promoteId?h=n.properties[i.promoteId]:i.generateId&&(h=e||0),"Point"===s)R(r,a);else if("MultiPoint"===s)for(var u=0;u<r.length;u++)R(r[u],a);else if("LineString"===s)$(r,a,o,!1);else if("MultiLineString"===s){if(i.lineMetrics){for(u=0;u<r.length;u++)a=[],$(r[u],a,o,!1),t.push(N(h,"LineString",a,n.properties));return}W(r,a,o,!1)}else if("Polygon"===s)W(r,a,o,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<n.geometry.geometries.length;u++)V(t,{id:h,geometry:n.geometry.geometries[u],properties:n.properties},i,e);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<r.length;u++){var l=[];W(r[u],l,o,!0),a.push(l)}}t.push(N(h,s,a,n.properties))}}function R(t,n){n.push(q(t[0])),n.push(B(t[1])),n.push(0)}function $(t,n,i,e){for(var r,s,o=0,a=0;a<t.length;a++){var h=q(t[a][0]),u=B(t[a][1]);n.push(h),n.push(u),n.push(0),a>0&&(o+=e?(r*u-h*s)/2:Math.sqrt(Math.pow(h-r,2)+Math.pow(u-s,2))),r=h,s=u}var l=n.length-3;n[2]=1,function t(n,i,e,r){for(var s,o=r,a=e-i>>1,h=e-i,u=n[i],l=n[i+1],c=n[e],f=n[e+1],d=i+3;d<e;d+=3){var y=j(n[d],n[d+1],u,l,c,f);if(y>o)s=d,o=y;else if(y===o){var v=Math.abs(d-a);v<h&&(s=d,h=v)}}o>r&&(s-i>3&&t(n,i,s,r),n[s+2]=o,e-s>3&&t(n,s,e,r))}(n,0,l,i),n[l+2]=1,n.size=Math.abs(o),n.start=0,n.end=n.size}function W(t,n,i,e){for(var r=0;r<t.length;r++){var s=[];$(t[r],s,i,e),n.push(s)}}function q(t){return t/360+.5}function B(t){var n=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+n)/(1-n))/Math.PI;return i<0?0:i>1?1:i}function G(t,n,i,e,r,s,o,a){if(e/=n,s>=(i/=n)&&o<e)return t;if(o<i||s>=e)return null;for(var h=[],u=0;u<t.length;u++){var l=t[u],c=l.geometry,f=l.type,d=0===r?l.minX:l.minY,y=0===r?l.maxX:l.maxY;if(d>=i&&y<e)h.push(l);else if(!(y<i||d>=e)){var v=[];if("Point"===f||"MultiPoint"===f)J(c,v,i,e,r);else if("LineString"===f)X(c,v,i,e,r,!1,a.lineMetrics);else if("MultiLineString"===f)Y(c,v,i,e,r,!1);else if("Polygon"===f)Y(c,v,i,e,r,!0);else if("MultiPolygon"===f)for(var p=0;p<c.length;p++){var m=[];Y(c[p],m,i,e,r,!0),m.length&&v.push(m)}if(v.length){if(a.lineMetrics&&"LineString"===f){for(p=0;p<v.length;p++)h.push(N(l.id,f,v[p],l.tags));continue}"LineString"!==f&&"MultiLineString"!==f||(1===v.length?(f="LineString",v=v[0]):f="MultiLineString"),"Point"!==f&&"MultiPoint"!==f||(f=3===v.length?"Point":"MultiPoint"),h.push(N(l.id,f,v,l.tags))}}}return h.length?h:null}function J(t,n,i,e,r){for(var s=0;s<t.length;s+=3){var o=t[s+r];o>=i&&o<=e&&(n.push(t[s]),n.push(t[s+1]),n.push(t[s+2]))}}function X(t,n,i,e,r,s,o){for(var a,h,u=Z(t),l=0===r?Q:tt,c=t.start,f=0;f<t.length-3;f+=3){var d=t[f],y=t[f+1],v=t[f+2],p=t[f+3],m=t[f+4],g=0===r?d:y,w=0===r?p:m,M=!1;o&&(a=Math.sqrt(Math.pow(d-p,2)+Math.pow(y-m,2))),g<i?w>i&&(h=l(u,d,y,p,m,i),o&&(u.start=c+a*h)):g>e?w<e&&(h=l(u,d,y,p,m,e),o&&(u.start=c+a*h)):K(u,d,y,v),w<i&&g>=i&&(h=l(u,d,y,p,m,i),M=!0),w>e&&g<=e&&(h=l(u,d,y,p,m,e),M=!0),!s&&M&&(o&&(u.end=c+a*h),n.push(u),u=Z(t)),o&&(c+=a)}var b=t.length-3;d=t[b],y=t[b+1],v=t[b+2],(g=0===r?d:y)>=i&&g<=e&&K(u,d,y,v),b=u.length-3,s&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&K(u,u[0],u[1],u[2]),u.length&&n.push(u)}function Z(t){var n=[];return n.size=t.size,n.start=t.start,n.end=t.end,n}function Y(t,n,i,e,r,s){for(var o=0;o<t.length;o++)X(t[o],n,i,e,r,s,!1)}function K(t,n,i,e){t.push(n),t.push(i),t.push(e)}function Q(t,n,i,e,r,s){var o=(s-n)/(e-n);return t.push(s),t.push(i+(r-i)*o),t.push(1),o}function tt(t,n,i,e,r,s){var o=(s-i)/(r-i);return t.push(n+(e-n)*o),t.push(s),t.push(1),o}function nt(t,n){for(var i=[],e=0;e<t.length;e++){var r,s=t[e],o=s.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)r=it(s.geometry,n);else if("MultiLineString"===o||"Polygon"===o){r=[];for(var a=0;a<s.geometry.length;a++)r.push(it(s.geometry[a],n))}else if("MultiPolygon"===o)for(r=[],a=0;a<s.geometry.length;a++){for(var h=[],u=0;u<s.geometry[a].length;u++)h.push(it(s.geometry[a][u],n));r.push(h)}i.push(N(s.id,o,r,s.tags))}return i}function it(t,n){var i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(var e=0;e<t.length;e+=3)i.push(t[e]+n,t[e+1],t[e+2]);return i}function et(t,n){if(t.transformed)return t;var i,e,r,s=1<<t.z,o=t.x,a=t.y;for(i=0;i<t.features.length;i++){var h=t.features[i],u=h.geometry,l=h.type;if(h.geometry=[],1===l)for(e=0;e<u.length;e+=2)h.geometry.push(rt(u[e],u[e+1],n,s,o,a));else for(e=0;e<u.length;e++){var c=[];for(r=0;r<u[e].length;r+=2)c.push(rt(u[e][r],u[e][r+1],n,s,o,a));h.geometry.push(c)}}return t.transformed=!0,t}function rt(t,n,i,e,r,s){return[Math.round(i*(t*e-r)),Math.round(i*(n*e-s))]}function st(t,n,i,e,r){for(var s=n===r.maxZoom?0:r.tolerance/((1<<n)*r.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:e,z:n,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<t.length;a++){o.numFeatures++,ot(o,t[a],s,r);var h=t[a].minX,u=t[a].minY,l=t[a].maxX,c=t[a].maxY;h<o.minX&&(o.minX=h),u<o.minY&&(o.minY=u),l>o.maxX&&(o.maxX=l),c>o.maxY&&(o.maxY=c)}return o}function ot(t,n,i,e){var r=n.geometry,s=n.type,o=[];if("Point"===s||"MultiPoint"===s)for(var a=0;a<r.length;a+=3)o.push(r[a]),o.push(r[a+1]),t.numPoints++,t.numSimplified++;else if("LineString"===s)at(o,r,t,i,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(a=0;a<r.length;a++)at(o,r[a],t,i,"Polygon"===s,0===a);else if("MultiPolygon"===s)for(var h=0;h<r.length;h++){var u=r[h];for(a=0;a<u.length;a++)at(o,u[a],t,i,!0,0===a)}if(o.length){var l=n.tags||null;if("LineString"===s&&e.lineMetrics){for(var c in l={},n.tags)l[c]=n.tags[c];l.mapbox_clip_start=r.start/r.size,l.mapbox_clip_end=r.end/r.size}var f={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:l};null!==n.id&&(f.id=n.id),t.features.push(f)}}function at(t,n,i,e,r,s){var o=e*e;if(e>0&&n.size<(r?o:e))i.numPoints+=n.length/3;else{for(var a=[],h=0;h<n.length;h+=3)(0===e||n[h+2]>o)&&(i.numSimplified++,a.push(n[h]),a.push(n[h+1])),i.numPoints++;r&&function(t,n){for(var i=0,e=0,r=t.length,s=r-2;e<r;s=e,e+=2)i+=(t[e]-t[s])*(t[e+1]+t[s+1]);if(i>0===n)for(e=0,r=t.length;e<r/2;e+=2){var o=t[e],a=t[e+1];t[e]=t[r-2-e],t[e+1]=t[r-1-e],t[r-2-e]=o,t[r-1-e]=a}}(a,s),t.push(a)}}function ht(t,n){var i=(n=this.options=function(t,n){for(var i in n)t[i]=n[i];return t}(Object.create(this.options),n)).debug;if(i&&console.time("preprocess data"),n.maxZoom<0||n.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(n.promoteId&&n.generateId)throw new Error("promoteId and generateId cannot be used together.");var e=function(t,n){var i=[];if("FeatureCollection"===t.type)for(var e=0;e<t.features.length;e++)V(i,t.features[e],n,e);else"Feature"===t.type?V(i,t,n):V(i,{geometry:t},n);return i}(t,n);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",n.indexMaxZoom,n.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(e=function(t,n){var i=n.buffer/n.extent,e=t,r=G(t,1,-1-i,i,0,-1,2,n),s=G(t,1,1-i,2+i,0,-1,2,n);return(r||s)&&(e=G(t,1,-i,1+i,0,-1,2,n)||[],r&&(e=nt(r,1).concat(e)),s&&(e=e.concat(nt(s,-1)))),e}(e,n)).length&&this.splitTile(e,0,0,0),i&&(e.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function ut(t,n,i){return 32*((1<<t)*i+n)+t}function lt(t,n,i,e,r,s){const o=i&&Array.isArray(i[0]);for(let a=0,h=i.length;a<h;a++){t[n]=Math.round((o?i[a][0]:i[a].x)*e),t[n+1]=Math.round((o?i[a][1]:i[a].y)*e);let u=r||0;Array.isArray(r)&&(u=r[a]),u=u?Math.round(e*u):0,t[n+2]=u,n+=3,s&&0!==a&&a!==h-1&&(t[n]=t[n-3],t[n+1]=t[n-2],t[n+2]=t[n-1],n+=3)}return n}function ct(t,n,i,e){const r=t[3*n],s=t[3*n+1],o=t[3*i],a=t[3*i+1];return r===o&&(r<0||r>e)||s===a&&(s<0||s>e)}C.getJSON=function(t,n,i){if(S(n)){const t=i;i=n,n=t}const e=function(t,n){const e="string"==typeof n?JSON.parse(n):n||null;i(t,e)};return n&&n.jsonp?C.jsonp(t,e):((n=n||{}).returnJSON=!0,C.get(t,n,e))},ht.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ht.prototype.splitTile=function(t,n,i,e,r,s,o){for(var a=[t,n,i,e],h=this.options,u=h.debug;a.length;){e=a.pop(),i=a.pop(),n=a.pop(),t=a.pop();var l=1<<n,c=ut(n,i,e),f=this.tiles[c];if(!f&&(u>1&&console.time("creation"),f=this.tiles[c]=st(t,n,i,e,h),this.tileCoords.push({z:n,x:i,y:e}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,i,e,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var d="z"+n;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(f.source=t,r){if(n===h.maxZoom||n===r)continue;var y=1<<r-n;if(i!==Math.floor(s/y)||e!==Math.floor(o/y))continue}else if(n===h.indexMaxZoom||f.numPoints<=h.indexMaxPoints)continue;if(f.source=null,0!==t.length){u>1&&console.time("clipping");var v,p,m,g,w,M,b=.5*h.buffer/h.extent,x=.5-b,F=.5+b,A=1+b;v=p=m=g=null,w=G(t,l,i-b,i+F,0,f.minX,f.maxX,h),M=G(t,l,i+x,i+A,0,f.minX,f.maxX,h),t=null,w&&(v=G(w,l,e-b,e+F,1,f.minY,f.maxY,h),p=G(w,l,e+x,e+A,1,f.minY,f.maxY,h),w=null),M&&(m=G(M,l,e-b,e+F,1,f.minY,f.maxY,h),g=G(M,l,e+x,e+A,1,f.minY,f.maxY,h),M=null),u>1&&console.timeEnd("clipping"),a.push(v||[],n+1,2*i,2*e),a.push(p||[],n+1,2*i,2*e+1),a.push(m||[],n+1,2*i+1,2*e),a.push(g||[],n+1,2*i+1,2*e+1)}}},ht.prototype.getTile=function(t,n,i){var e=this.options,r=e.extent,s=e.debug;if(t<0||t>24)return null;var o=1<<t,a=ut(t,n=(n%o+o)%o,i);if(this.tiles[a])return et(this.tiles[a],r);s>1&&console.log("drilling down to z%d-%d-%d",t,n,i);for(var h,u=t,l=n,c=i;!h&&u>0;)u--,l=Math.floor(l/2),c=Math.floor(c/2),h=this.tiles[ut(u,l,c)];return h&&h.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,l,c),s>1&&console.time("drilling down"),this.splitTile(h.source,u,l,c,t,n,i),s>1&&console.timeEnd("drilling down"),this.tiles[a]?et(this.tiles[a],r):null):null};class ft{constructor(t,n){this.x=t,this.y=n}clone(){return new ft(this.x,this.y)}normalize(){const t=this.length();this.x/=t,this.y/=t}negate(){this.x=-this.x,this.y=-this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}diff(t){return new ft(this.x-t.x,this.y-t.y)}distance(t){const n=this.x-t.x,i=this.y-t.y;return Math.sqrt(n*n+i*i)}dot(t){return this.x*t.x+this.y*t.y}equals(t){return this.x===t.x&&this.y===t.y}orthogonal(){return new ft(this.y,-this.x)}}function dt(t,n,i){const e=(n.x-t.x)*(i.y-t.y)-(n.y-t.y)*(i.x-t.x);return e>1e-5?1:e<-1e-5?2:0}function yt(t,n,i,e){const r=n.x*e.y-n.y*e.x,s=i.x-t.x,o=i.y-t.y,a=(s*e.y-o*e.x)/r;return new ft(t.x+a*n.x,t.y+a*n.y)}const vt=[];function pt(t,n,i){let e=0;const r=[];for(let s=n;s<i;s+=3)vt[e]?(vt[e].x=t[s],vt[e].y=t[s+1]):vt[e]=new ft(t[s],t[s+1]),r.push(vt[e]),e++;const s=function(t){let n;this.UpdateOmbb=function(t,i,e,r,s,o,a,h){const u=yt(t,i,s,o),l=yt(e,r,s,o),c=yt(a,h,t,i),f=yt(a,h,e,r),d=u.distance(l)*u.distance(c);d<this.BestObbArea&&(n=[u,c,f,l],this.BestObbArea=d)},this.BestObbArea=Number.MAX_VALUE;const i=[];for(let n=0;n<t.length;n++)i.push(t[(n+1)%t.length].diff(t[n])),i[n].normalize();const e=new ft(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),r=new ft(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let s,o,a,h;for(let n=0;n<t.length;n++){const i=t[n];i.x<e.x&&(e.x=i.x,s=n),i.x>r.x&&(r.x=i.x,o=n),i.y<e.y&&(e.y=i.y,h=n),i.y>r.y&&(r.y=i.y,a=n)}let u=new ft(0,-1),l=new ft(0,1),c=new ft(-1,0),f=new ft(1,0);for(let n=0;n<t.length;n++){const n=[Math.acos(u.dot(i[s])),Math.acos(l.dot(i[o])),Math.acos(c.dot(i[a])),Math.acos(f.dot(i[h]))];switch(n.indexOf(Math.min.apply(Math,n))){case 0:u=i[s].clone(),l=u.clone(),l.negate(),c=u.orthogonal(),f=c.clone(),f.negate(),s=(s+1)%t.length;break;case 1:l=i[o].clone(),u=l.clone(),u.negate(),c=u.orthogonal(),f=c.clone(),f.negate(),o=(o+1)%t.length;break;case 2:c=i[a].clone(),f=c.clone(),f.negate(),u=f.orthogonal(),l=u.clone(),l.negate(),a=(a+1)%t.length;break;case 3:f=i[h].clone(),c=f.clone(),c.negate(),u=f.orthogonal(),l=u.clone(),l.negate(),h=(h+1)%t.length}this.UpdateOmbb(t[s],u,t[o],l,t[a],c,t[h],f)}return n}(function(t){if(t.length<3)return t;let n=t[0];const i=[];for(let i=1;i<t.length;i++)(t[i].x<n.x||Math.abs(t[i].x-n.x)<1e-5&&t[i].y<n.y)&&(n=t[i]);let e=t[0];do{i.unshift(n.clone());for(let i=1;i<t.length;i++){const r=dt(n,e,t[i]);(e.equals(n)||1===r||0===r&&n.distance(t[i])>n.distance(e))&&(e=t[i])}n=e}while(!e.equals(i[i.length-1]));return i}(r)),o=s[0].distance(s[1]),a=s[1].distance(s[2]),h=s.map(t=>[t.x,t.y]);return h.push(+(a>o)),h}var mt="undefined"!=typeof Float32Array?Float32Array:Array;function gt(){var t=new mt(3);return mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function wt(t,n,i){var e=new mt(3);return e[0]=t,e[1]=n,e[2]=i,e}function Mt(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function bt(t,n,i,e){return t[0]=n,t[1]=i,t[2]=e,t}function xt(t,n,i){return t[0]=n[0]+i[0],t[1]=n[1]+i[1],t[2]=n[2]+i[2],t}function Ft(t,n,i){return t[0]=n[0]/i[0],t[1]=n[1]/i[1],t[2]=n[2]/i[2],t}function At(t,n){var i=n[0],e=n[1],r=n[2],s=i*i+e*e+r*r;return s>0&&(s=1/Math.sqrt(s),t[0]=n[0]*s,t[1]=n[1]*s,t[2]=n[2]*s),t}function kt(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Pt(t,n,i){var e=n[0],r=n[1],s=n[2],o=i[0],a=i[1],h=i[2];return t[0]=r*h-s*a,t[1]=s*o-e*h,t[2]=e*a-r*o,t}var St=function(t,n,i){return t[0]=n[0]-i[0],t[1]=n[1]-i[1],t[2]=n[2]-i[2],t};function _t(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function Ot(t,n,i,e,r){return t[0]=n,t[1]=i,t[2]=e,t[3]=r,t}function It(){var t=new mt(4);return mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Tt(t,n){var i=n[0]+n[4]+n[8],e=void 0;if(i>0)e=Math.sqrt(i+1),t[3]=.5*e,e=.5/e,t[0]=(n[5]-n[7])*e,t[1]=(n[6]-n[2])*e,t[2]=(n[1]-n[3])*e;else{var r=0;n[4]>n[0]&&(r=1),n[8]>n[3*r+r]&&(r=2);var s=(r+1)%3,o=(r+2)%3;e=Math.sqrt(n[3*r+r]-n[3*s+s]-n[3*o+o]+1),t[r]=.5*e,e=.5/e,t[3]=(n[3*s+o]-n[3*o+s])*e,t[s]=(n[3*s+r]+n[3*r+s])*e,t[o]=(n[3*o+r]+n[3*r+o])*e}return t}gt(),function(){var t,n=(t=new mt(4),mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var Lt,Ut=function(t,n,i){return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=n[3]*i,t},zt=function(t,n){var i=n[0],e=n[1],r=n[2],s=n[3],o=i*i+e*e+r*r+s*s;return o>0&&(o=1/Math.sqrt(o),t[0]=i*o,t[1]=e*o,t[2]=r*o,t[3]=s*o),t};function Dt(t,n){var i=n[0]-t[0],e=n[1]-t[1];return Math.sqrt(i*i+e*e)}function Et(t,n,i,e,r,s,o,a,h,u){0===t?function(t,n,i,e,r,s,o,a,h){const u=[0,0];for(let r=t;r<n;r+=3){const t=r/3*2,n=e[r],l=e[r+1];i[t]=u[0]+n*s*o/a,i[t+1]=u[1]-l*s*o/h}}(n,i,e,r,0,o,a,h,u):1===t&&function(t,n,i,e){const r=pt(e,t,n),s=r[4],o=r[s],a=r[s+1],h=r[s+2],u=(a[1]-o[1])/(a[0]-o[0]),l=(h[1]-a[1])/(h[0]-a[0]),c=Dt(o,a),f=Dt(a,h);for(let r=t;r<n;r+=3){const t=r/3*2,n=e[r],s=e[r+1];i[t]=jt(n,s,o,u,c),i[t+1]=-jt(n,s,a,l,f)}}(n,i,e,r)}gt(),wt(1,0,0),wt(0,1,0),It(),It(),Lt=new mt(9),mt!=Float32Array&&(Lt[1]=0,Lt[2]=0,Lt[3]=0,Lt[5]=0,Lt[6]=0,Lt[7]=0),Lt[0]=1,Lt[4]=1,Lt[8]=1,function(){var t=function(){var t=new mt(2);return mt!=Float32Array&&(t[0]=0,t[1]=0),t}()}();const Ct=[];function jt(t,n,i,e,r){return Ct[0]=(e*e*i[0]+e*(n-i[1])+t)/(e*e+1),Ct[1]=e*(Ct[0]-i[0])+i[1],Dt(i,Ct)/r}function Nt(t,n,i,e,r){const s=3*n[i-1],o=3*n[i-1]+1,a=t[s],h=t[o];return u=e,l=r,c=a,f=h,Math.sqrt((c-u)*(c-u)+(f-l)*(f-l));var u,l,c,f}"undefined"!=typeof undefinedThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof undefined?global:"undefined"!=typeof self&&self;var Ht=Vt;function Vt(t,n){this.x=t,this.y=n}function Rt(t,n,i){i=i||{},this.w=t||64,this.h=n||64,this.autoResize=!!i.autoResize,this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0}function $t(t,n,i){this.x=0,this.y=t,this.w=this.free=n,this.h=i}function Wt(t,n,i,e,r,s,o){this.id=t,this.x=n,this.y=i,this.w=e,this.h=r,this.maxw=s||e,this.maxh=o||r,this.refcount=0}Vt.prototype={clone:function(){return new Vt(this.x,this.y)},add:function(t){return this.clone().u(t)},sub:function(t){return this.clone().v(t)},multByPoint:function(t){return this.clone().m(t)},divByPoint:function(t){return this.clone().M(t)},mult:function(t){return this.clone().F(t)},div:function(t){return this.clone().A(t)},rotate:function(t){return this.clone().k(t)},rotateAround:function(t,n){return this.clone().P(t,n)},matMult:function(t){return this.clone().S(t)},unit:function(){return this.clone()._()},perp:function(){return this.clone().O()},round:function(){return this.clone().I()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var n=t.x-this.x,i=t.y-this.y;return n*n+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},S:function(t){var n=t[0]*this.x+t[1]*this.y,i=t[2]*this.x+t[3]*this.y;return this.x=n,this.y=i,this},u:function(t){return this.x+=t.x,this.y+=t.y,this},v:function(t){return this.x-=t.x,this.y-=t.y,this},F:function(t){return this.x*=t,this.y*=t,this},A:function(t){return this.x/=t,this.y/=t,this},m:function(t){return this.x*=t.x,this.y*=t.y,this},M:function(t){return this.x/=t.x,this.y/=t.y,this},_:function(){return this.A(this.mag()),this},O:function(){var t=this.y;return this.y=this.x,this.x=-t,this},k:function(t){var n=Math.cos(t),i=Math.sin(t),e=n*this.x-i*this.y,r=i*this.x+n*this.y;return this.x=e,this.y=r,this},P:function(t,n){var i=Math.cos(t),e=Math.sin(t),r=n.x+i*(this.x-n.x)-e*(this.y-n.y),s=n.y+e*(this.x-n.x)+i*(this.y-n.y);return this.x=r,this.y=s,this},I:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Vt.convert=function(t){return t instanceof Vt?t:Array.isArray(t)?new Vt(t[0],t[1]):t},Rt.prototype.pack=function(t,n){t=[].concat(t),n=n||{};for(var i,e,r,s,o=[],a=0;a<t.length;a++)if(i=t[a].w||t[a].width,e=t[a].h||t[a].height,r=t[a].id,i&&e){if(!(s=this.packOne(i,e,r)))continue;n.inPlace&&(t[a].x=s.x,t[a].y=s.y,t[a].id=s.id),o.push(s)}return this.shrink(),o},Rt.prototype.packOne=function(t,n,i){var e,r,s,o,a,h,u,l,c={freebin:-1,shelf:-1,waste:1/0},f=0;if("string"==typeof i||"number"==typeof i){if(e=this.getBin(i))return this.ref(e),e;"number"==typeof i&&(this.maxId=Math.max(i,this.maxId))}else i=++this.maxId;for(o=0;o<this.freebins.length;o++){if(n===(e=this.freebins[o]).maxh&&t===e.maxw)return this.allocFreebin(o,t,n,i);n>e.maxh||t>e.maxw||n<=e.maxh&&t<=e.maxw&&(s=e.maxw*e.maxh-t*n)<c.waste&&(c.waste=s,c.freebin=o)}for(o=0;o<this.shelves.length;o++)if(f+=(r=this.shelves[o]).h,!(t>r.free)){if(n===r.h)return this.allocShelf(o,t,n,i);n>r.h||n<r.h&&(s=(r.h-n)*t)<c.waste&&(c.freebin=-1,c.waste=s,c.shelf=o)}return-1!==c.freebin?this.allocFreebin(c.freebin,t,n,i):-1!==c.shelf?this.allocShelf(c.shelf,t,n,i):n<=this.h-f&&t<=this.w?(r=new $t(f,this.w,n),this.allocShelf(this.shelves.push(r)-1,t,n,i)):this.autoResize?(a=h=this.h,((u=l=this.w)<=a||t>u)&&(l=2*Math.max(t,u)),(a<u||n>a)&&(h=2*Math.max(n,a)),this.resize(l,h),this.packOne(t,n,i)):null},Rt.prototype.allocFreebin=function(t,n,i,e){var r=this.freebins.splice(t,1)[0];return r.id=e,r.w=n,r.h=i,r.refcount=0,this.bins[e]=r,this.ref(r),r},Rt.prototype.allocShelf=function(t,n,i,e){var r=this.shelves[t].alloc(n,i,e);return this.bins[e]=r,this.ref(r),r},Rt.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,n=0,i=0;i<this.shelves.length;i++){var e=this.shelves[i];n+=e.h,t=Math.max(e.w-e.free,t)}this.resize(t,n)}},Rt.prototype.getBin=function(t){return this.bins[t]},Rt.prototype.ref=function(t){if(1==++t.refcount){var n=t.h;this.stats[n]=1+(0|this.stats[n])}return t.refcount},Rt.prototype.unref=function(t){return 0===t.refcount?0:(0==--t.refcount&&(this.stats[t.h]--,delete this.bins[t.id],this.freebins.push(t)),t.refcount)},Rt.prototype.clear=function(){this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0},Rt.prototype.resize=function(t,n){this.w=t,this.h=n;for(var i=0;i<this.shelves.length;i++)this.shelves[i].resize(t);return!0},$t.prototype.alloc=function(t,n,i){if(t>this.free||n>this.h)return null;var e=this.x;return this.x+=t,this.free-=t,new Wt(i,e,this.y,t,n,t,this.h)},$t.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0};var qt={exports:{}};qt.exports=function(){function t(t,n,i){var e=t[n];t[n]=t[i],t[i]=e}function n(t,n){return t<n?-1:t>n?1:0}return function(i,e,r,s,o){!function n(i,e,r,s,o){for(;s>r;){if(s-r>600){var a=s-r+1,h=e-r+1,u=Math.log(a),l=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*l*(a-l)/a)*(h-a/2<0?-1:1),f=Math.max(r,Math.floor(e-h*l/a+c)),d=Math.min(s,Math.floor(e+(a-h)*l/a+c));n(i,e,f,d,o)}var y=i[e],v=r,p=s;for(t(i,r,e),o(i[s],y)>0&&t(i,r,s);v<p;){for(t(i,v,p),v++,p--;o(i[v],y)<0;)v++;for(;o(i[p],y)>0;)p--}0===o(i[r],y)?t(i,r,p):(p++,t(i,p,s)),p<=e&&(r=p+1),e<=p&&(s=p-1)}}(i,e,r||0,s||i.length-1,o||n)}}();var Bt=qt.exports,Gt={exports:{}};function Jt(t,n){if(!(this instanceof Jt))return new Jt(t,n);if(this.data=t||[],this.length=this.data.length,this.compare=n||Xt,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this.T(i)}function Xt(t,n){return t<n?-1:t>n?1:0}Gt.exports=Jt,Gt.exports.default=Jt,Jt.prototype={push:function(t){this.data.push(t),this.length++,this.L(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this.T(0)),this.data.pop(),t}},peek:function(){return this.data[0]},L:function(t){for(var n=this.data,i=this.compare,e=n[t];t>0;){var r=t-1>>1,s=n[r];if(i(e,s)>=0)break;n[t]=s,t=r}n[t]=e},T:function(t){for(var n=this.data,i=this.compare,e=this.length>>1,r=n[t];t<e;){var s=1+(t<<1),o=s+1,a=n[s];if(o<this.length&&i(n[o],a)<0&&(s=o,a=n[o]),i(a,r)>=0)break;n[t]=a,t=s}n[t]=r}};var Zt=Gt.exports,Yt={exports:{}},Kt={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]},Qt={exports:{}},tn=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},nn=Array.prototype.concat,en=Array.prototype.slice,rn=Qt.exports=function(t){for(var n=[],i=0,e=t.length;i<e;i++){var r=t[i];tn(r)?n=nn.call(n,en.call(r)):n.push(r)}return n};rn.wrap=function(t){return function(){return t(rn(arguments))}};var sn=Kt,on=Qt.exports,an=Object.hasOwnProperty,hn={};for(var un in sn)an.call(sn,un)&&(hn[sn[un]]=un);var ln=Yt.exports={to:{},get:{}};function cn(t,n,i){return Math.min(Math.max(n,t),i)}function fn(t){var n=Math.round(t).toString(16).toUpperCase();return n.length<2?"0"+n:n}ln.get=function(t){var n,i;switch(t.substring(0,3).toLowerCase()){case"hsl":n=ln.get.hsl(t),i="hsl";break;case"hwb":n=ln.get.hwb(t),i="hwb";break;default:n=ln.get.rgb(t),i="rgb"}return n?{model:i,value:n}:null},ln.get.rgb=function(t){if(!t)return null;var n,i,e,r=[0,0,0,1];if(n=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(e=n[2],n=n[1],i=0;i<3;i++){var s=2*i;r[i]=parseInt(n.slice(s,s+2),16)}e&&(r[3]=parseInt(e,16)/255)}else if(n=t.match(/^#([a-f0-9]{3,4})$/i)){for(e=(n=n[1])[3],i=0;i<3;i++)r[i]=parseInt(n[i]+n[i],16);e&&(r[3]=parseInt(e+e,16)/255)}else if(n=t.match(/^rgba?\\(\\s*([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/)){for(i=0;i<3;i++)r[i]=parseInt(n[i+1],0);n[4]&&(n[5]?r[3]=.01*parseFloat(n[4]):r[3]=parseFloat(n[4]))}else{if(!(n=t.match(/^rgba?\\(\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/)))return(n=t.match(/^(\\w+)$/))?"transparent"===n[1]?[0,0,0,0]:an.call(sn,n[1])?((r=sn[n[1]])[3]=1,r):null:null;for(i=0;i<3;i++)r[i]=Math.round(2.55*parseFloat(n[i+1]));n[4]&&(n[5]?r[3]=.01*parseFloat(n[4]):r[3]=parseFloat(n[4]))}for(i=0;i<3;i++)r[i]=cn(r[i],0,255);return r[3]=cn(r[3],0,1),r},ln.get.hsl=function(t){if(!t)return null;var n=t.match(/^hsla?\\(\\s*([+-]?(?:\\d{0,3}\\.)?\\d+)(?:deg)?\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*(?:[,|\\/]\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/);if(n){var i=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,cn(parseFloat(n[2]),0,100),cn(parseFloat(n[3]),0,100),cn(isNaN(i)?1:i,0,1)]}return null},ln.get.hwb=function(t){if(!t)return null;var n=t.match(/^hwb\\(\\s*([+-]?\\d{0,3}(?:\\.\\d+)?)(?:deg)?\\s*,\\s*([+-]?[\\d\\.]+)%\\s*,\\s*([+-]?[\\d\\.]+)%\\s*(?:,\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/);if(n){var i=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,cn(parseFloat(n[2]),0,100),cn(parseFloat(n[3]),0,100),cn(isNaN(i)?1:i,0,1)]}return null},ln.to.hex=function(){var t=on(arguments);return"#"+fn(t[0])+fn(t[1])+fn(t[2])+(t[3]<1?fn(Math.round(255*t[3])):"")},ln.to.rgb=function(){var t=on(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},ln.to.rgb.percent=function(){var t=on(arguments),n=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),e=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+n+"%, "+i+"%, "+e+"%)":"rgba("+n+"%, "+i+"%, "+e+"%, "+t[3]+")"},ln.to.hsl=function(){var t=on(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},ln.to.hwb=function(){var t=on(arguments),n="";return t.length>=4&&1!==t[3]&&(n=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+n+")"},ln.to.keyword=function(t){return hn[t.slice(0,3)]};var dn={exports:{}},yn=Kt,vn={};for(var pn in yn)yn.hasOwnProperty(pn)&&(vn[yn[pn]]=pn);var mn=dn.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var gn in mn)if(mn.hasOwnProperty(gn)){if(!("channels"in mn[gn]))throw new Error("missing channels property: "+gn);if(!("labels"in mn[gn]))throw new Error("missing channel labels property: "+gn);if(mn[gn].labels.length!==mn[gn].channels)throw new Error("channel and label counts mismatch: "+gn);var wn=mn[gn].channels,Mn=mn[gn].labels;delete mn[gn].channels,delete mn[gn].labels,Object.defineProperty(mn[gn],"channels",{value:wn}),Object.defineProperty(mn[gn],"labels",{value:Mn})}function bn(t,n){return Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2)+Math.pow(t[2]-n[2],2)}mn.rgb.hsl=function(t){var n,i,e=t[0]/255,r=t[1]/255,s=t[2]/255,o=Math.min(e,r,s),a=Math.max(e,r,s),h=a-o;return a===o?n=0:e===a?n=(r-s)/h:r===a?n=2+(s-e)/h:s===a&&(n=4+(e-r)/h),(n=Math.min(60*n,360))<0&&(n+=360),i=(o+a)/2,[n,100*(a===o?0:i<=.5?h/(a+o):h/(2-a-o)),100*i]},mn.rgb.hsv=function(t){var n,i,e,r,s,o=t[0]/255,a=t[1]/255,h=t[2]/255,u=Math.max(o,a,h),l=u-Math.min(o,a,h),c=function(t){return(u-t)/6/l+.5};return 0===l?r=s=0:(s=l/u,n=c(o),i=c(a),e=c(h),o===u?r=e-i:a===u?r=1/3+n-e:h===u&&(r=2/3+i-n),r<0?r+=1:r>1&&(r-=1)),[360*r,100*s,100*u]},mn.rgb.hwb=function(t){var n=t[0],i=t[1],e=t[2];return[mn.rgb.hsl(t)[0],100*(1/255*Math.min(n,Math.min(i,e))),100*(e=1-1/255*Math.max(n,Math.max(i,e)))]},mn.rgb.cmyk=function(t){var n,i=t[0]/255,e=t[1]/255,r=t[2]/255;return[100*((1-i-(n=Math.min(1-i,1-e,1-r)))/(1-n)||0),100*((1-e-n)/(1-n)||0),100*((1-r-n)/(1-n)||0),100*n]},mn.rgb.keyword=function(t){var n=vn[t];if(n)return n;var i,e=1/0;for(var r in yn)if(yn.hasOwnProperty(r)){var s=bn(t,yn[r]);s<e&&(e=s,i=r)}return i},mn.keyword.rgb=function(t){return yn[t]},mn.rgb.xyz=function(t){var n=t[0]/255,i=t[1]/255,e=t[2]/255;return[100*(.4124*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.3576*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)+.1805*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)),100*(.2126*n+.7152*i+.0722*e),100*(.0193*n+.1192*i+.9505*e)]},mn.rgb.lab=function(t){var n=mn.rgb.xyz(t),i=n[0],e=n[1],r=n[2];return e/=100,r/=108.883,i=(i/=95.047)>.008856?Math.pow(i,1/3):7.787*i+16/116,[116*(e=e>.008856?Math.pow(e,1/3):7.787*e+16/116)-16,500*(i-e),200*(e-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]},mn.hsl.rgb=function(t){var n,i,e,r,s,o=t[0]/360,a=t[1]/100,h=t[2]/100;if(0===a)return[s=255*h,s,s];n=2*h-(i=h<.5?h*(1+a):h+a-h*a),r=[0,0,0];for(var u=0;u<3;u++)(e=o+1/3*-(u-1))<0&&e++,e>1&&e--,s=6*e<1?n+6*(i-n)*e:2*e<1?i:3*e<2?n+(i-n)*(2/3-e)*6:n,r[u]=255*s;return r},mn.hsl.hsv=function(t){var n=t[0],i=t[1]/100,e=t[2]/100,r=i,s=Math.max(e,.01);return i*=(e*=2)<=1?e:2-e,r*=s<=1?s:2-s,[n,100*(0===e?2*r/(s+r):2*i/(e+i)),100*((e+i)/2)]},mn.hsv.rgb=function(t){var n=t[0]/60,i=t[1]/100,e=t[2]/100,r=Math.floor(n)%6,s=n-Math.floor(n),o=255*e*(1-i),a=255*e*(1-i*s),h=255*e*(1-i*(1-s));switch(e*=255,r){case 0:return[e,h,o];case 1:return[a,e,o];case 2:return[o,e,h];case 3:return[o,a,e];case 4:return[h,o,e];case 5:return[e,o,a]}},mn.hsv.hsl=function(t){var n,i,e,r=t[0],s=t[1]/100,o=t[2]/100,a=Math.max(o,.01);return e=(2-s)*o,i=s*a,[r,100*(i=(i/=(n=(2-s)*a)<=1?n:2-n)||0),100*(e/=2)]},mn.hwb.rgb=function(t){var n,i,e,r,s,o,a,h=t[0]/360,u=t[1]/100,l=t[2]/100,c=u+l;switch(c>1&&(u/=c,l/=c),e=6*h-(n=Math.floor(6*h)),0!=(1&n)&&(e=1-e),r=u+e*((i=1-l)-u),n){default:case 6:case 0:s=i,o=r,a=u;break;case 1:s=r,o=i,a=u;break;case 2:s=u,o=i,a=r;break;case 3:s=u,o=r,a=i;break;case 4:s=r,o=u,a=i;break;case 5:s=i,o=u,a=r}return[255*s,255*o,255*a]},mn.cmyk.rgb=function(t){var n=t[0]/100,i=t[1]/100,e=t[2]/100,r=t[3]/100;return[255*(1-Math.min(1,n*(1-r)+r)),255*(1-Math.min(1,i*(1-r)+r)),255*(1-Math.min(1,e*(1-r)+r))]},mn.xyz.rgb=function(t){var n,i,e,r=t[0]/100,s=t[1]/100,o=t[2]/100;return i=-.9689*r+1.8758*s+.0415*o,e=.0557*r+-.204*s+1.057*o,n=(n=3.2406*r+-1.5372*s+-.4986*o)>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:12.92*i,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,[255*(n=Math.min(Math.max(0,n),1)),255*(i=Math.min(Math.max(0,i),1)),255*(e=Math.min(Math.max(0,e),1))]},mn.xyz.lab=function(t){var n=t[0],i=t[1],e=t[2];return i/=100,e/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116)-16,500*(n-i),200*(i-(e=e>.008856?Math.pow(e,1/3):7.787*e+16/116))]},mn.lab.xyz=function(t){var n,i,e,r=t[0];n=t[1]/500+(i=(r+16)/116),e=i-t[2]/200;var s=Math.pow(i,3),o=Math.pow(n,3),a=Math.pow(e,3);return i=s>.008856?s:(i-16/116)/7.787,n=o>.008856?o:(n-16/116)/7.787,e=a>.008856?a:(e-16/116)/7.787,[n*=95.047,i*=100,e*=108.883]},mn.lab.lch=function(t){var n,i=t[0],e=t[1],r=t[2];return(n=360*Math.atan2(r,e)/2/Math.PI)<0&&(n+=360),[i,Math.sqrt(e*e+r*r),n]},mn.lch.lab=function(t){var n,i=t[0],e=t[1];return n=t[2]/360*2*Math.PI,[i,e*Math.cos(n),e*Math.sin(n)]},mn.rgb.ansi16=function(t){var n=t[0],i=t[1],e=t[2],r=1 in arguments?arguments[1]:mn.rgb.hsv(t)[2];if(0===(r=Math.round(r/50)))return 30;var s=30+(Math.round(e/255)<<2|Math.round(i/255)<<1|Math.round(n/255));return 2===r&&(s+=60),s},mn.hsv.ansi16=function(t){return mn.rgb.ansi16(mn.hsv.rgb(t),t[2])},mn.rgb.ansi256=function(t){var n=t[0],i=t[1],e=t[2];return n===i&&i===e?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(i/255*5)+Math.round(e/255*5)},mn.ansi16.rgb=function(t){var n=t%10;if(0===n||7===n)return t>50&&(n+=3.5),[n=n/10.5*255,n,n];var i=.5*(1+~~(t>50));return[(1&n)*i*255,(n>>1&1)*i*255,(n>>2&1)*i*255]},mn.ansi256.rgb=function(t){if(t>=232){var n=10*(t-232)+8;return[n,n,n]}var i;return t-=16,[Math.floor(t/36)/5*255,Math.floor((i=t%36)/6)/5*255,i%6/5*255]},mn.rgb.hex=function(t){var n=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(n.length)+n},mn.hex.rgb=function(t){var n=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!n)return[0,0,0];var i=n[0];3===n[0].length&&(i=i.split("").map((function(t){return t+t})).join(""));var e=parseInt(i,16);return[e>>16&255,e>>8&255,255&e]},mn.rgb.hcg=function(t){var n,i=t[0]/255,e=t[1]/255,r=t[2]/255,s=Math.max(Math.max(i,e),r),o=Math.min(Math.min(i,e),r),a=s-o;return n=a<=0?0:s===i?(e-r)/a%6:s===e?2+(r-i)/a:4+(i-e)/a+4,n/=6,[360*(n%=1),100*a,100*(a<1?o/(1-a):0)]},mn.hsl.hcg=function(t){var n=t[1]/100,i=t[2]/100,e=1,r=0;return(e=i<.5?2*n*i:2*n*(1-i))<1&&(r=(i-.5*e)/(1-e)),[t[0],100*e,100*r]},mn.hsv.hcg=function(t){var n=t[1]/100,i=t[2]/100,e=n*i,r=0;return e<1&&(r=(i-e)/(1-e)),[t[0],100*e,100*r]},mn.hcg.rgb=function(t){var n=t[0]/360,i=t[1]/100,e=t[2]/100;if(0===i)return[255*e,255*e,255*e];var r,s=[0,0,0],o=n%1*6,a=o%1,h=1-a;switch(Math.floor(o)){case 0:s[0]=1,s[1]=a,s[2]=0;break;case 1:s[0]=h,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=a;break;case 3:s[0]=0,s[1]=h,s[2]=1;break;case 4:s[0]=a,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=h}return r=(1-i)*e,[255*(i*s[0]+r),255*(i*s[1]+r),255*(i*s[2]+r)]},mn.hcg.hsv=function(t){var n=t[1]/100,i=n+t[2]/100*(1-n),e=0;return i>0&&(e=n/i),[t[0],100*e,100*i]},mn.hcg.hsl=function(t){var n=t[1]/100,i=t[2]/100*(1-n)+.5*n,e=0;return i>0&&i<.5?e=n/(2*i):i>=.5&&i<1&&(e=n/(2*(1-i))),[t[0],100*e,100*i]},mn.hcg.hwb=function(t){var n=t[1]/100,i=n+t[2]/100*(1-n);return[t[0],100*(i-n),100*(1-i)]},mn.hwb.hcg=function(t){var n=t[1]/100,i=1-t[2]/100,e=i-n,r=0;return e<1&&(r=(i-e)/(1-e)),[t[0],100*e,100*r]},mn.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},mn.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},mn.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},mn.gray.hsl=mn.gray.hsv=function(t){return[0,0,t[0]]},mn.gray.hwb=function(t){return[0,100,t[0]]},mn.gray.cmyk=function(t){return[0,0,0,t[0]]},mn.gray.lab=function(t){return[t[0],0,0]},mn.gray.hex=function(t){var n=255&Math.round(t[0]/100*255),i=((n<<16)+(n<<8)+n).toString(16).toUpperCase();return"000000".substring(i.length)+i},mn.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};var xn=dn.exports;function Fn(t){var n=function(){for(var t={},n=Object.keys(xn),i=n.length,e=0;e<i;e++)t[n[e]]={distance:-1,parent:null};return t}(),i=[t];for(n[t].distance=0;i.length;)for(var e=i.pop(),r=Object.keys(xn[e]),s=r.length,o=0;o<s;o++){var a=r[o],h=n[a];-1===h.distance&&(h.distance=n[e].distance+1,h.parent=e,i.unshift(a))}return n}function An(t,n){return function(i){return n(t(i))}}function kn(t,n){for(var i=[n[t].parent,t],e=xn[n[t].parent][t],r=n[t].parent;n[r].parent;)i.unshift(n[r].parent),e=An(xn[n[r].parent][r],e),r=n[r].parent;return e.conversion=i,e}var Pn=dn.exports,Sn=function(t){for(var n=Fn(t),i={},e=Object.keys(n),r=e.length,s=0;s<r;s++){var o=e[s];null!==n[o].parent&&(i[o]=kn(o,n))}return i},_n={};Object.keys(Pn).forEach((function(t){_n[t]={},Object.defineProperty(_n[t],"channels",{value:Pn[t].channels}),Object.defineProperty(_n[t],"labels",{value:Pn[t].labels});var n=Sn(t);Object.keys(n).forEach((function(i){var e=n[i];_n[t][i]=function(t){var n=function(n){if(null==n)return n;arguments.length>1&&(n=Array.prototype.slice.call(arguments));var i=t(n);if("object"==typeof i)for(var e=i.length,r=0;r<e;r++)i[r]=Math.round(i[r]);return i};return"conversion"in t&&(n.conversion=t.conversion),n}(e),_n[t][i].raw=function(t){var n=function(n){return null==n?n:(arguments.length>1&&(n=Array.prototype.slice.call(arguments)),t(n))};return"conversion"in t&&(n.conversion=t.conversion),n}(e)}))}));var On=_n,In=Yt.exports,Tn=On,Ln=[].slice,Un=["keyword","gray","hex"],zn={};Object.keys(Tn).forEach((function(t){zn[Ln.call(Tn[t].labels).sort().join("")]=t}));var Dn={};function En(t,n){if(!(this instanceof En))return new En(t,n);if(n&&n in Un&&(n=null),n&&!(n in Tn))throw new Error("Unknown model: "+n);var i,e;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof En)this.model=t.model,this.color=t.color.slice(),this.valpha=t.valpha;else if("string"==typeof t){var r=In.get(t);if(null===r)throw new Error("Unable to parse color from string: "+t);this.model=r.model,e=Tn[this.model].channels,this.color=r.value.slice(0,e),this.valpha="number"==typeof r.value[e]?r.value[e]:1}else if(t.length){this.model=n||"rgb",e=Tn[this.model].channels;var s=Ln.call(t,0,e);this.color=Hn(s,e),this.valpha="number"==typeof t[e]?t[e]:1}else if("number"==typeof t)t&=16777215,this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;var o=Object.keys(t);"alpha"in t&&(o.splice(o.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);var a=o.sort().join("");if(!(a in zn))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=zn[a];var h=Tn[this.model].labels,u=[];for(i=0;i<h.length;i++)u.push(t[h[i]]);this.color=Hn(u)}if(Dn[this.model])for(e=Tn[this.model].channels,i=0;i<e;i++){var l=Dn[this.model][i];l&&(this.color[i]=l(this.color[i]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}function Cn(t,n,i){return(t=Array.isArray(t)?t:[t]).forEach((function(t){(Dn[t]||(Dn[t]=[]))[n]=i})),t=t[0],function(e){var r;return arguments.length?(i&&(e=i(e)),(r=this[t]()).color[n]=e,r):(r=this[t]().color[n],i&&(r=i(r)),r)}}function jn(t){return function(n){return Math.max(0,Math.min(t,n))}}function Nn(t){return Array.isArray(t)?t:[t]}function Hn(t,n){for(var i=0;i<n;i++)"number"!=typeof t[i]&&(t[i]=0);return t}En.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(t){var n=this.model in In.to?this:this.rgb(),i=1===(n=n.round("number"==typeof t?t:1)).valpha?n.color:n.color.concat(this.valpha);return In.to[n.model](i)},percentString:function(t){var n=this.rgb().round("number"==typeof t?t:1),i=1===n.valpha?n.color:n.color.concat(this.valpha);return In.to.rgb.percent(i)},array:function(){return 1===this.valpha?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var t={},n=Tn[this.model].channels,i=Tn[this.model].labels,e=0;e<n;e++)t[i[e]]=this.color[e];return 1!==this.valpha&&(t.alpha=this.valpha),t},unitArray:function(){var t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,1!==this.valpha&&t.push(this.valpha),t},unitObject:function(){var t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,1!==this.valpha&&(t.alpha=this.valpha),t},round:function(t){return t=Math.max(t||0,0),new En(this.color.map(function(t){return function(n){return function(t,n){return Number(t.toFixed(n))}(n,t)}}(t)).concat(this.valpha),this.model)},alpha:function(t){return arguments.length?new En(this.color.concat(Math.max(0,Math.min(1,t))),this.model):this.valpha},red:Cn("rgb",0,jn(255)),green:Cn("rgb",1,jn(255)),blue:Cn("rgb",2,jn(255)),hue:Cn(["hsl","hsv","hsl","hwb","hcg"],0,(function(t){return(t%360+360)%360})),saturationl:Cn("hsl",1,jn(100)),lightness:Cn("hsl",2,jn(100)),saturationv:Cn("hsv",1,jn(100)),value:Cn("hsv",2,jn(100)),chroma:Cn("hcg",1,jn(100)),gray:Cn("hcg",2,jn(100)),white:Cn("hwb",1,jn(100)),wblack:Cn("hwb",2,jn(100)),cyan:Cn("cmyk",0,jn(100)),magenta:Cn("cmyk",1,jn(100)),yellow:Cn("cmyk",2,jn(100)),black:Cn("cmyk",3,jn(100)),x:Cn("xyz",0,jn(100)),y:Cn("xyz",1,jn(100)),z:Cn("xyz",2,jn(100)),l:Cn("lab",0,jn(100)),a:Cn("lab",1),b:Cn("lab",2),keyword:function(t){return arguments.length?new En(t):Tn[this.model].keyword(this.color)},hex:function(t){return arguments.length?new En(t):In.to.hex(this.rgb().round().color)},rgbNumber:function(){var t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity:function(){for(var t=this.rgb().color,n=[],i=0;i<t.length;i++){var e=t[i]/255;n[i]=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}return.2126*n[0]+.7152*n[1]+.0722*n[2]},contrast:function(t){var n=this.luminosity(),i=t.luminosity();return n>i?(n+.05)/(i+.05):(i+.05)/(n+.05)},level:function(t){var n=this.contrast(t);return n>=7.1?"AAA":n>=4.5?"AA":""},isDark:function(){var t=this.rgb().color;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var t=this.rgb(),n=0;n<3;n++)t.color[n]=255-t.color[n];return t},lighten:function(t){var n=this.hsl();return n.color[2]+=n.color[2]*t,n},darken:function(t){var n=this.hsl();return n.color[2]-=n.color[2]*t,n},saturate:function(t){var n=this.hsl();return n.color[1]+=n.color[1]*t,n},desaturate:function(t){var n=this.hsl();return n.color[1]-=n.color[1]*t,n},whiten:function(t){var n=this.hwb();return n.color[1]+=n.color[1]*t,n},blacken:function(t){var n=this.hwb();return n.color[2]+=n.color[2]*t,n},grayscale:function(){var t=this.rgb().color,n=.3*t[0]+.59*t[1]+.11*t[2];return En.rgb(n,n,n)},fade:function(t){return this.alpha(this.valpha-this.valpha*t)},opaquer:function(t){return this.alpha(this.valpha+this.valpha*t)},rotate:function(t){var n=this.hsl(),i=n.color[0];return i=(i=(i+t)%360)<0?360+i:i,n.color[0]=i,n},mix:function(t,n){if(!t||!t.rgb)throw new Error(\'Argument to "mix" was not a Color instance, but rather an instance of \'+typeof t);var i=t.rgb(),e=this.rgb(),r=void 0===n?.5:n,s=2*r-1,o=i.alpha()-e.alpha(),a=((s*o==-1?s:(s+o)/(1+s*o))+1)/2,h=1-a;return En.rgb(a*i.red()+h*e.red(),a*i.green()+h*e.green(),a*i.blue()+h*e.blue(),i.alpha()*r+e.alpha()*(1-r))}},Object.keys(Tn).forEach((function(t){if(-1===Un.indexOf(t)){var n=Tn[t].channels;En.prototype[t]=function(){if(this.model===t)return new En(this);if(arguments.length)return new En(arguments,t);var i="number"==typeof arguments[n]?n:this.valpha;return new En(Nn(Tn[this.model][t].raw(this.color)).concat(i),t)},En[t]=function(i){return"number"==typeof i&&(i=Hn(Ln.call(arguments),n)),new En(i,t)}}}));var Vn=En;class Rn{constructor(t,n){this.position=t,this.index=n,this.faces=[],this.neighbors=[]}addUniqueNeighbor(t){-1===this.neighbors.indexOf(t)&&this.neighbors.push(t)}}class $n{constructor(t,n,i,e){this.a=e.a,this.b=e.b,this.c=e.c,this.v1=t,this.v2=n,this.v3=i,this.normal=[],this.computeNormal(),t.faces.push(this),t.addUniqueNeighbor(n),t.addUniqueNeighbor(i),n.faces.push(this),n.addUniqueNeighbor(t),n.addUniqueNeighbor(i),i.faces.push(this),i.addUniqueNeighbor(t),i.addUniqueNeighbor(n)}computeNormal(){const t=this.v1.position,n=this.v2.position,i=this.v3.position,e=Pt([],St([],i,n),St([],t,n));At(this.normal,e)}hasVertex(t){return t===this.v1||t===this.v2||t===this.v3}}\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */const Wn=[],qn=[],Bn=[],Gn=[];function Jn(t,n,i){const e=Pt(qn,n,i);t=Tt(t,function(t,n,i,e,r,s,o,a,h,u){return t[0]=n,t[1]=i,t[2]=e,t[3]=r,t[4]=s,t[5]=o,t[6]=a,t[7]=h,t[8]=u,t}(Wn,i[0],i[1],i[2],...e,...n));if((t=function(t){return t[3]<0?Ut(t,t,-1):t}(t=zt(t,t)))[3]<1/32767){t[3]=1/32767;const n=Math.sqrt(.9999999990686206);t[0]*=n,t[1]*=n,t[2]*=n}const r=i[3]>0?Pt(Bn,i,n):Pt(Bn,n,i);return kt(Pt(Gn,i,n),r)<0&&Ut(t,t,-1),t}function Xn(t,n){const i=[],e=[];let r=0;for(r=0;r<t.length;r+=3){const n=new Rn([t[r],t[r+1],t[r+2]],r/3);i.push(n)}if(!n.length){const t=n;n=[];for(let i=0;i<t;i++)n.push(i)}for(r=0;r<n.length/3;r++){const t={a:n[3*r],b:n[3*r+1],c:n[3*r+2]};new $n(i[t.a],i[t.b],i[t.c],t)}const s=[],o=[0,0,0];for(r=0;r<i.length;r++){const t=i[r],n=t.index;bt(o,0,0,0);let a=t.faces.length;for(let n=0;n<a;n++)xt(o,o,t.faces[n].normal);a=a||1,bt(s,a,a,a),Ft(o,o,s),e[3*n]=o[0],e[3*n+1]=o[1],e[3*n+2]=o[2]}return e}\n/*!\n * Contains code from THREE.JS\n * https://github.com/mrdoob/three.js/\n * License MIT\n * \n * Generate tangents per vertex.\n */function Zn(t,n,i){return t[0]=n[i],t[1]=n[i+1],t[2]=n[i+2],t}function Yn(t,n,i){return t[0]=n[i],t[1]=n[i+1],t}var Kn={exports:{}};function Qn(t,n,i){i=i||2;var e,r,s,o,a,h,u,l=n&&n.length,c=l?n[0]*i:t.length,f=ti(t,0,c,i,!0),d=[];if(!f||f.next===f.prev)return d;if(l&&(f=function(t,n,i,e){var r,s,o,a,h,u=[];for(r=0,s=n.length;r<s;r++)o=n[r]*e,a=r<s-1?n[r+1]*e:t.length,(h=ti(t,o,a,e,!1))===h.next&&(h.steiner=!0),u.push(ci(h));for(u.sort(ai),r=0;r<u.length;r++)i=ni(i=hi(u[r],i),i.next);return i}(t,n,f,i)),t.length>80*i){e=s=t[0],r=o=t[1];for(var y=i;y<c;y+=i)(a=t[y])<e&&(e=a),(h=t[y+1])<r&&(r=h),a>s&&(s=a),h>o&&(o=h);u=0!==(u=Math.max(s-e,o-r))?1/u:0}return ii(f,d,i,e,r,u),d}function ti(t,n,i,e,r){var s,o;if(r===Ai(t,n,i,e)>0)for(s=n;s<i;s+=e)o=bi(s,t[s],t[s+1],o);else for(s=i-e;s>=n;s-=e)o=bi(s,t[s],t[s+1],o);return o&&vi(o,o.next)&&(xi(o),o=o.next),o}function ni(t,n){if(!t)return t;n||(n=t);var i,e=t;do{if(i=!1,e.steiner||!vi(e,e.next)&&0!==yi(e.prev,e,e.next))e=e.next;else{if(xi(e),(e=n=e.prev)===e.next)break;i=!0}}while(i||e!==n);return n}function ii(t,n,i,e,r,s,o){if(t){!o&&s&&function(t,n,i,e){var r=t;do{null===r.z&&(r.z=li(r.x,r.y,n,i,e)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var n,i,e,r,s,o,a,h,u=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,e=i,a=0,n=0;n<u&&(a++,e=e.nextZ);n++);for(h=u;a>0||h>0&&e;)0!==a&&(0===h||!e||i.z<=e.z)?(r=i,i=i.nextZ,a--):(r=e,e=e.nextZ,h--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=e}s.nextZ=null,u*=2}while(o>1)}(r)}(t,e,r,s);for(var a,h,u=t;t.prev!==t.next;)if(a=t.prev,h=t.next,s?ri(t,e,r,s):ei(t))n.push(a.i/i),n.push(t.i/i),n.push(h.i/i),xi(t),t=h.next,u=h.next;else if((t=h)===u){o?1===o?ii(t=si(ni(t),n,i),n,i,e,r,s,2):2===o&&oi(t,n,i,e,r,s):ii(ni(t),n,i,e,r,s,1);break}}}function ei(t){var n=t.prev,i=t,e=t.next;if(yi(n,i,e)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(fi(n.x,n.y,i.x,i.y,e.x,e.y,r.x,r.y)&&yi(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function ri(t,n,i,e){var r=t.prev,s=t,o=t.next;if(yi(r,s,o)>=0)return!1;for(var a=r.x<s.x?r.x<o.x?r.x:o.x:s.x<o.x?s.x:o.x,h=r.y<s.y?r.y<o.y?r.y:o.y:s.y<o.y?s.y:o.y,u=r.x>s.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,l=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,c=li(a,h,n,i,e),f=li(u,l,n,i,e),d=t.prevZ,y=t.nextZ;d&&d.z>=c&&y&&y.z<=f;){if(d!==t.prev&&d!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&yi(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,y!==t.prev&&y!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,y.x,y.y)&&yi(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&yi(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;y&&y.z<=f;){if(y!==t.prev&&y!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,y.x,y.y)&&yi(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function si(t,n,i){var e=t;do{var r=e.prev,s=e.next.next;!vi(r,s)&&pi(r,e,e.next,s)&&wi(r,s)&&wi(s,r)&&(n.push(r.i/i),n.push(e.i/i),n.push(s.i/i),xi(e),xi(e.next),e=t=s),e=e.next}while(e!==t);return ni(e)}function oi(t,n,i,e,r,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&di(o,a)){var h=Mi(o,a);return o=ni(o,o.next),h=ni(h,h.next),ii(o,n,i,e,r,s),void ii(h,n,i,e,r,s)}a=a.next}o=o.next}while(o!==t)}function ai(t,n){return t.x-n.x}function hi(t,n){var i=function(t,n){var i,e=n,r=t.x,s=t.y,o=-1/0;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=r&&a>o){if(o=a,a===r){if(s===e.y)return e;if(s===e.next.y)return e.next}i=e.x<e.next.x?e:e.next}}e=e.next}while(e!==n);if(!i)return null;if(r===o)return i;var h,u=i,l=i.x,c=i.y,f=1/0;e=i;do{r>=e.x&&e.x>=l&&r!==e.x&&fi(s<c?r:o,s,l,c,s<c?o:r,s,e.x,e.y)&&(h=Math.abs(s-e.y)/(r-e.x),wi(e,t)&&(h<f||h===f&&(e.x>i.x||e.x===i.x&&ui(i,e)))&&(i=e,f=h)),e=e.next}while(e!==u);return i}(t,n);if(!i)return n;var e=Mi(i,t),r=ni(i,i.next);return ni(e,e.next),n===i?r:n}function ui(t,n){return yi(t.prev,t,n.prev)<0&&yi(n.next,t,t.next)<0}function li(t,n,i,e,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=32767*(n-e)*r)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function ci(t){var n=t,i=t;do{(n.x<i.x||n.x===i.x&&n.y<i.y)&&(i=n),n=n.next}while(n!==t);return i}function fi(t,n,i,e,r,s,o,a){return(r-o)*(n-a)-(t-o)*(s-a)>=0&&(t-o)*(e-a)-(i-o)*(n-a)>=0&&(i-o)*(s-a)-(r-o)*(e-a)>=0}function di(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==n.i&&i.next.i!==n.i&&pi(i,i.next,t,n))return!0;i=i.next}while(i!==t);return!1}(t,n)&&(wi(t,n)&&wi(n,t)&&function(t,n){var i=t,e=!1,r=(t.x+n.x)/2,s=(t.y+n.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(e=!e),i=i.next}while(i!==t);return e}(t,n)&&(yi(t.prev,t,n.prev)||yi(t,n.prev,n))||vi(t,n)&&yi(t.prev,t,t.next)>0&&yi(n.prev,n,n.next)>0)}function yi(t,n,i){return(n.y-t.y)*(i.x-n.x)-(n.x-t.x)*(i.y-n.y)}function vi(t,n){return t.x===n.x&&t.y===n.y}function pi(t,n,i,e){var r=gi(yi(t,n,i)),s=gi(yi(t,n,e)),o=gi(yi(i,e,t)),a=gi(yi(i,e,n));return r!==s&&o!==a||(!(0!==r||!mi(t,i,n))||(!(0!==s||!mi(t,e,n))||(!(0!==o||!mi(i,t,e))||!(0!==a||!mi(i,n,e)))))}function mi(t,n,i){return n.x<=Math.max(t.x,i.x)&&n.x>=Math.min(t.x,i.x)&&n.y<=Math.max(t.y,i.y)&&n.y>=Math.min(t.y,i.y)}function gi(t){return t>0?1:t<0?-1:0}function wi(t,n){return yi(t.prev,t,t.next)<0?yi(t,n,t.next)>=0&&yi(t,t.prev,n)>=0:yi(t,n,t.prev)<0||yi(t,t.next,n)<0}function Mi(t,n){var i=new Fi(t.i,t.x,t.y),e=new Fi(n.i,n.x,n.y),r=t.next,s=n.prev;return t.next=n,n.prev=t,i.next=r,r.prev=i,e.next=i,i.prev=e,s.next=e,e.prev=s,e}function bi(t,n,i,e){var r=new Fi(t,n,i);return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function xi(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Fi(t,n,i){this.i=t,this.x=n,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ai(t,n,i,e){for(var r=0,s=n,o=i-e;s<i;s+=e)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}Kn.exports=Qn,Kn.exports.default=Qn,Qn.deviation=function(t,n,i,e){var r=n&&n.length,s=r?n[0]*i:t.length,o=Math.abs(Ai(t,0,s,i));if(r)for(var a=0,h=n.length;a<h;a++){var u=n[a]*i,l=a<h-1?n[a+1]*i:t.length;o-=Math.abs(Ai(t,u,l,i))}var c=0;for(a=0;a<e.length;a+=3){var f=e[a]*i,d=e[a+1]*i,y=e[a+2]*i;c+=Math.abs((t[f]-t[y])*(t[d+1]-t[f+1])-(t[f]-t[d])*(t[y+1]-t[f+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},Qn.flatten=function(t){for(var n=t[0][0].length,i={vertices:[],holes:[],dimensions:n},e=0,r=0;r<t.length;r++){for(var s=0;s<t[r].length;s++)for(var o=0;o<n;o++)i.vertices.push(t[r][s][o]);r>0&&(e+=t[r-1].length,i.holes.push(e))}return i};var ki=Kn.exports;\n/*!\n * @maptalks/vector-packer v0.63.4\n * LICENSE : UNLICENSED\n * (c) 2016-2022 maptalks.com\n */const Pi={Point:1,LineString:2,Polygon:3,MultiPoint:4,MultiLineString:5,MultiPolygon:6};function Si(t,n={}){var i=[];if("FeatureCollection"===t.type)for(var e=0;e<t.features.length;e++)_i(i,t.features[e],n,e);else _i(i,"Feature"===t.type?t:{geometry:t},n);return i}function _i(t,n,i,e){if(n.geometry&&n.geometry.geometry){var r=n.geometry.coordinates,s=n.geometry.type,o=[],a=n.id;if(i.promoteId?a=n.properties[i.promoteId]:i.generateId&&(a=e||0),"Point"===s)Oi(r,o);else if("MultiPoint"===s)for(var h=0;h<r.length;h++)Oi(r[h],o);else if("LineString"===s)Ti([r],o);else if("MultiLineString"===s){if(i.lineMetrics){for(h=0;h<r.length;h++)Ii(r[h],o=[]),t.push(Li(a,"LineString",o,n.properties));return}Ti(r,o)}else if("Polygon"===s)Ti(r,o);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(h=0;h<n.geometry.geometries.length;h++)_i(t,{id:a,geometry:n.geometry.geometries[h],properties:n.properties},i,e);return}return void console.warn(`Input data type(${s}) is not a valid GeoJSON geometry type.`)}for(h=0;h<r.length;h++){var u=[];Ti(r[h],u),o.push(u)}}t.push(Li(a,s,o,n.properties))}}function Oi(t,n){n.push([new Ht(t[0],t[1])])}function Ii(t,n){for(var i=0;i<t.length;i++)n.push(new Ht(t[i][0],t[i][1]))}function Ti(t,n,i,e){for(var r=0;r<t.length;r++){var s=[];Ii(t[r],s),n.push(s)}}function Li(t,n,i,e){return{id:void 0===t?null:t,type:Pi[n],geometry:i,properties:e}}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */function Ui(t,{width:n,height:i},e,r){if(r){if(r.length!==n*i*e)throw new RangeError("mismatched image size")}else r=new Uint8Array(n*i*e);return t.width=n,t.height=i,t.data=r,t}function zi(t,{width:n,height:i},e){if(n===t.width&&i===t.height)return;const r=Ui({},{width:n,height:i},e);Di(t,r,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,i)},e),t.width=n,t.height=i,t.data=r.data}function Di(t,n,i,e,r,s){if(0===r.width||0===r.height)return n;if(r.width>t.width||r.height>t.height||i.x>t.width-r.width||i.y>t.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>n.width||r.height>n.height||e.x>n.width-r.width||e.y>n.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const o=t.data,a=n.data;if(o===a)return n;for(let h=0;h<r.height;h++){const u=((i.y+h)*t.width+i.x)*s,l=((e.y+h)*n.width+e.x)*s;for(let t=0;t<r.width*s;t++)a[l+t]=o[u+t]}return n}class Ei{constructor(t,n){Ui(this,t,1,n)}resize(t){zi(this,t,1)}clone(){return new Ei({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,i,e,r){Di(t,n,i,e,r,1)}}class Ci{constructor(t,n){Ui(this,t,4,n)}resize(t){zi(this,t,4)}clone(){return new Ci({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,i,e,r){Di(t,n,i,e,r,4)}}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */class ji{constructor(t,{pixelRatio:n}){this.paddedRect=t,this.pixelRatio=n||1}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Ni{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n={},i=new Rt(0,0,{autoResize:!0}),e=[];for(const i in t){const r=t[i],s={x:0,y:0,w:r.data.width+2,h:r.data.height+2};e.push(s),n[i]=new ji(s,r)}if(i.pack(e,{inPlace:!0}),!Hi(i.w)||!Hi(i.h)){const t=Vi(i.w),n=Vi(i.h);i.resize(t,n)}const r=new Ci({width:i.w,height:i.h});for(const i in t){const e=t[i],s=n[i].paddedRect;Ci.copy(e.data,r,{x:0,y:0},{x:s.x+1,y:s.y+1},e.data)}this.image=r,this.positions=n}}function Hi(t){return 0==(t&t-1)&&0!==t}function Vi(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n * TODO 升级为potpack\n */class Ri{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n={},i=new Rt(0,0,{autoResize:!0}),e=[];for(const i in t){const r=t[i],s=n[i]={};for(const t in r){const n=r[+t];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const i={x:0,y:0,w:n.bitmap.width+2,h:n.bitmap.height+2};e.push(i),s[t]={rect:i,metrics:n.metrics}}}i.pack(e,{inPlace:!0});const r=new Ei({width:i.w,height:i.h});for(const i in t){const e=t[i];for(const t in e){const s=e[+t];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const o=n[i][t].rect;Ei.copy(s.bitmap,r,{x:0,y:0},{x:o.x+1,y:o.y+1},s.bitmap)}}this.image=r,this.positions=n}}function $i(t){return t<65536?Uint16Array:Uint32Array}function Wi(t){return(t=Math.abs(t))<128?Int8Array:t<32768?Int16Array:Float32Array}function qi(t){return t<256?Uint8Array:t<65536?Uint16Array:Float32Array}function Bi(t){const n=t.type,i=[];if(1===n||4===n)for(let n=0;n<t.geometry.length;n++)Oi(t.geometry[n],i);else if(2===n)Ti(t.geometry,i);else if(3===n)Ti(t.geometry,i);else if(5===n)Ti(t.geometry,i);else if(6===n)for(let n=0;n<t.geometry.length;n++){const e=[];Ti(t.geometry[n],e),i.push(e)}return t.geometry=i,t}function Gi(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];for(const n in i)t[n]=i[n]}return t}function Ji(t){return null==t}function Xi(t){return"number"==typeof t&&!isNaN(t)}function Zi(t){return"object"==typeof t&&!!t}function Yi(t){return!Ji(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}const Ki=Object.prototype.hasOwnProperty;function Qi(t,n){return Ki.call(t,n)}function te(t){return m(t)&&t.property}function ne(t){let n=0;for(let i,e,r=0,s=t.length,o=s-1;r<s;o=r++)i=t[r],e=t[o],n+=void 0!==i.x?(e.x-i.x)*(i.y+e.y):(e[0]-i[0])*(i[1]+e[1]);return n}function ie(t,n,i,e,r){const s=t[n*e],o=t[n*e+1],a=t[i*e],h=t[i*e+1];return s===a&&(s<0||s>r)&&o!==h||o===h&&(o<0||o>r)&&s!==a}function ee(t,n,i){let e=i;return n&&t&&(e=t[n]),void 0===e&&(e=i),10*(e||0)}function re(t,n,i,e,r,s,o){const a=ee(t.properties,i,e),h=a*n;let u=a;return r?u=ee(t.properties,r,s):o&&(u=a-ee(t.properties,o,0)),u*=n,{altitude:h,height:u}}function se(t,n){return n<1/0&&(t.x<0||t.x>n||t.y<0||t.y>n)}function oe(t){return null==t}function ae(t,n,i){if(t===i||t===n)return t;const e=i-n;return((t-n)%e+e)%e+n}class he{constructor(t,n,i,e){this.feature=t,this.symbol=n,this.fnTypes=i,this.options=e}getPolygonResource(){let t=this.symbol.polygonPatternFile;const{polygonPatternFileFn:n}=this.fnTypes;return this.U(t,n)}getLineResource(){let t=this.symbol.linePatternFile;const{linePatternFileFn:n}=this.fnTypes;return this.U(t,n)}U(t,n){return n&&(t=n(this.options.zoom,this.feature.properties)),t}}const ue={lineWidth:1,lineStrokeWidth:1,lineDx:1,lineDy:1,lineOpacity:1,linePatternAnimSpeed:1,markerWidth:1,markerHeight:1,markerDx:1,markerDy:1,markerSpacing:1,markerOpacity:1,markerRotation:1,textWrapWidth:1,textSpacing:1,textSize:1,textHaloRadius:1,textHaloOpacity:1,textDx:1,textDy:1,textOpacity:1,textRotation:1,polygonOpacity:1};class le{static isAtlasLoaded(t,n={}){const{iconAtlas:i}=n;return!!(!t||i&&i.positions[t])}static genFnTypes(t){const n={};for(const i in t)if(te(t[i])){const e=(i+"_Fn_0").trim(),r=(i+"Fn").trim();ue[i]?(n[e]=g(t[i]),n[r]=(t,i)=>{const r=n[e](t,i);return te(r)?g(r)(t,i):r}):(n[e]=w(t[i]),n[r]=(t,i)=>{const r=n[e](t,i);return te(r)?w(r)(t,i):r})}return n}constructor(t,n,i){this.options=i,this.features=this.D(t),this.symbolDef=n,this.symbol=M(n,()=>[i.zoom]),this.styledVectors=[],this.properties={},this.C=le.genFnTypes(this.symbolDef),te(this.symbolDef.visible)&&(this.j=g(this.symbolDef.visible)),i.atlas&&(this.iconAtlas=i.atlas.iconAtlas,this.glyphAtlas=i.atlas.glyphAtlas)}D(t){if(!t.length)return t;const n="__fea_idx".trim();let e,r=0,s=t[r];for(;!s.geometry;)r++,s=t[r];if(Array.isArray(s.geometry)&&s.properties){let n=s.geometry[0];for(;Array.isArray(n);)n=n[0];n instanceof Ht&&(e=t)}if(!e)if(e=[],Array.isArray(s.geometry))for(let n=0;n<t.length;n++){const i=Gi({},t[n]);e.push(Bi(i))}else for(let i=0;i<t.length;i++){const r=t[i],s=Si(r);for(let t=0;t<s.length;t++){const i=s[t];i[n]=r[n],e.push(i)}}const o=this.options.order;if(o){const t=[];for(let n=0;n<o.length;n++)o[n]&&t.push(i(o[n]));e=e.sort((n,i)=>{const e=t.length;let r=e,s=e;for(let o=0;o<e&&(t[o](n)&&(r=o),t[o](i)&&(s=o),!(r<e&&s<e));o++);return r-s})}return e}load(t=1){const n="__fea_idx".trim(),i="_debug_info".trim(),e=this.C,r=this.styledVectors;this.count=0;const s=this.features;if(!s||!s.length)return Promise.resolve(null);const o={},a={},h={zoom:this.options.zoom},u=M(this.symbolDef,()=>[h.zoom]);let l=0,c=s.length;const f=this.options.debugIndex;try{for(;l<c;l++){const t=s[l];if(!t||!t.geometry)continue;if(void 0!==f&&t[i].index!==f)continue;t.properties||(t.properties={}),t.properties.$layer=t.layer,t.properties.$type=t.type;const c=this.createStyledVector(t,u,e,h,o,a);c&&c.feature.geometry&&(c.featureIdx=void 0===t[n]?l:t[n],this.count++,r.push(c))}}catch(t){return Promise.reject(t)}return this.options.atlas?Promise.resolve(this.pack(t)):this.loadAtlas(o,a).then(()=>this.pack(t))}loadAtlas(t,n){return new Promise((i,e)=>{this.fetchAtlas(t,n,(t,n)=>{if(t)e(t);else{if(n){const{icons:t,glyphs:i}=n;if(t&&Object.keys(t).length){for(const n in t){const i=t[n],{width:e,height:r,data:s}=i.data;i.data=new Ci({width:e,height:r},s)}this.iconAtlas=new Ni(t)}if(i&&Object.keys(i).length){for(const t in i){const n=i[t];for(const t in n){const i=n[t],{width:e,height:r,data:s}=i.bitmap;i.bitmap=new Ei({width:e,height:r},s)}}this.glyphAtlas=new Ri(i)}}i({glyphAtlas:this.glyphAtlas,iconAtlas:this.iconAtlas})}})})}fetchAtlas(t,n,i){Object.keys(t).length>0||Object.keys(n).length>0?this.options.requestor(t,n,i):i()}pack(t){if(!this.count)return null;if(null==t)throw new Error("layout scale is undefined");const n=this.createDataPack(this.styledVectors,t);if(!n)return null;n.properties=this.properties,this.empty&&(n.empty=!0);const i=n.buffers;delete n.buffers;const e={data:n,buffers:i};if(this.iconAtlas){const t=e.data.iconAtlas=ce(this.iconAtlas);if(t.glyphMap)for(const n in t.glyphMap)i.push(t.glyphMap[n].data.data.buffer);i.push(e.data.iconAtlas.image.data.buffer)}return this.glyphAtlas&&(e.data.glyphAtlas=ce(this.glyphAtlas),i.push(e.data.glyphAtlas.image.data.buffer)),e}createStyledVector(t,n,i,e){return new he(t,n,i,e)}createDataPack(t,n){if(!t||!t.length)return null;this.maxIndex=0,this.maxPos=0,this.maxAltitude=0;const i=this.data={};let e=this.elements=[];const r=this.getFormat(Array.isArray(t[0])?t[0][0].symbol:t[0].symbol);for(let t=0;t<r.length;t++)i[r[t].name]=[];let s=[],o=0;const a=[];let h=0,u=!1;for(let e=0,r=t.length;e<r;e++){if(!t[e].feature.geometry)continue;const r=Array.isArray(t[e])?t[e][0].feature.id:t[e].feature.id;Xi(r)&&(Math.abs(r)>h&&(h=Math.abs(r)),r<0&&(u=!0));const l=this.data.aPosition.length;if(Array.isArray(t[e]))for(let i=0;i<t[e].length;i++)this.N(t[e][i],n);else this.N(t[e],n);const c=(i.aPosition.length-l)/3;for(let n=0;n<c;n++)s.push(t[e].featureIdx),Xi(r)&&a.push(r);o=Math.max(o,t[e].featureIdx)}if(this.hasElements()&&!e.length)return null;s=new(qi(o))(s),r[0].type=this.options.positionType?this.options.positionType:Wi(Math.max(this.maxPos,this.maxAltitude));const l=this.options.center;if(l&&(l[0]||l[1])){const t=i.aPosition;for(let n=0;n<t.length;n+=3)t[n]-=l[0],t[n+1]-=l[1]}const c=function(t,n){const i={};for(let e=0;e<t.length;e++){const r=t[e],s=r.type,o=r.name;i[o]=s===Array?n[o]:new s(n[o])}return i}(r,i);c.aPickingId=s;const f=[];for(const t in c)f.push(c[t].buffer);e=new($i(this.maxIndex))(e),f.push(e.buffer);const d={data:c,indices:this.hasElements()?e:null,positionSize:3,\n//!this.maxAltitude ? 2 : 3,\nbuffers:f,symbolIndex:this.symbolDef.index||{index:0}};if(a.length){const t=u?Wi(h):qi(h);d.featureIds=new t(a),f.push(d.featureIds.buffer)}else d.featureIds=[];return d}N(t,n){this.j&&this.j.isZoomConstant&&!this.j(null,t.feature.properties)||this.placeVector(t,n,this.formatWidth)}addElements(...t){this.maxIndex=Math.max(this.maxIndex,...t),this.elements.push(...t)}hasElements(){return!0}getAltitude(t){const{altitudeProperty:n,defaultAltitude:i,altitudeScale:e}=this.options;let r=ee(t,n,i);return e&&(r*=e),this.maxAltitude=Math.max(this.maxAltitude,Math.abs(r)),r}getIconAtlasMaxValue(){const t=this.iconAtlas.positions;let n=0;for(const i in t)if(Qi(t,i)){const{tl:e,displaySize:r}=t[i],s=Math.max(e[0],e[1],r[0]-1,r[1]-1);s>n&&(n=s)}return n}}function ce(t){let n=t.positions,i=t.image&&t.image.format||"alpha";if(t instanceof Ni){n={};for(const i in t.positions){const e=t.positions[i];n[i]={paddedRect:e.paddedRect,pixelRatio:e.pixelRatio,tl:e.tl,br:e.br,displaySize:e.displaySize}}i="rgba"}const e=t.image;return{image:{width:e.width,height:e.height,data:e.data,format:i},glyphMap:t.glyphMap,positions:n}}function fe(t,n,i,e){const r="__fn_textSize".trim();let s=t.textSize;if(Ji(n.textSize))return[16,16];t[r]&&(s=t[r]);const o=[];var a;return o[0]=Ji(a=s)||"function"!=typeof a&&(null===a.constructor||a.constructor!==Function)?s:s(e,i),o[1]=o[0],o}function de(t){const n=t.stops;let i=-1/0;for(let t=0;t<n.length;t++){let e=n[t][1];Zi(n[t][1])&&(e=de(n[t][1])),e>i&&(i=e)}return i}const ye=/\\{([\\w_]+)\\}/g;function ve(t,n){return Yi(t)?t.replace(ye,(function(t,i){if(!n)return"";const e=n[i];return Ji(e)?"":Array.isArray(e)?e.join():e})):t}const pe=t=>t>=11904&&t<=12031,me=t=>t>=12032&&t<=12255,ge=t=>t>=12272&&t<=12287,we=t=>t>=12288&&t<=12351,Me=t=>t>=12352&&t<=12447,be=t=>t>=12448&&t<=12543,xe=t=>t>=12544&&t<=12591,Fe=t=>t>=12704&&t<=12735,Ae=t=>t>=12736&&t<=12783,ke=t=>t>=12784&&t<=12799,Pe=t=>t>=12800&&t<=13055,Se=t=>t>=13056&&t<=13311,_e=t=>t>=13312&&t<=19903,Oe=t=>t>=19968&&t<=40959,Ie=t=>t>=40960&&t<=42127,Te=t=>t>=42128&&t<=42191,Le=t=>t>=63744&&t<=64255,Ue=t=>t>=64336&&t<=65023,ze=t=>t>=65040&&t<=65055,De=t=>t>=65072&&t<=65103,Ee=t=>t>=65104&&t<=65135,Ce=t=>t>=65136&&t<=65279,je=t=>t>=65280&&t<=65519;function Ne(t){return!((t=>t>=1536&&t<=1791)(t)||(t=>t>=1872&&t<=1919)(t)||(t=>t>=2208&&t<=2303)(t)||Ue(t)||Ce(t))}function He(t){return!!(746===t||747===t||!(t<4352)&&(Fe(t)||xe(t)||De(t)&&!(t>=65097&&t<=65103)||Le(t)||Se(t)||pe(t)||Ae(t)||!(!we(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||_e(t)||Oe(t)||Pe(t)||(t=>t>=12592&&t<=12687)(t)||(t=>t>=43360&&t<=43391)(t)||(t=>t>=55216&&t<=55295)(t)||(t=>t>=4352&&t<=4607)(t)||(t=>t>=44032&&t<=55215)(t)||Me(t)||ge(t)||(t=>t>=12688&&t<=12703)(t)||me(t)||ke(t)||be(t)&&12540!==t||!(!je(t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Ee(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(t=>t>=5120&&t<=5759)(t)||(t=>t>=6320&&t<=6399)(t)||ze(t)||(t=>t>=19904&&t<=19967)(t)||Ie(t)||Te(t)))}function Ve(t){return!(He(t)||function(t){return!!((t=>t>=128&&t<=255)(t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||(t=>t>=8192&&t<=8303)(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||(t=>t>=8448&&t<=8527)(t)||(t=>t>=8528&&t<=8591)(t)||(t=>t>=8960&&t<=9215)(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||(t=>t>=9216&&t<=9279)(t)&&9251!==t||(t=>t>=9280&&t<=9311)(t)||(t=>t>=9312&&t<=9471)(t)||(t=>t>=9632&&t<=9727)(t)||(t=>t>=9728&&t<=9983)(t)&&!(t>=9754&&t<=9759)||(t=>t>=11008&&t<=11263)(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||we(t)||be(t)||(t=>t>=57344&&t<=63743)(t)||De(t)||Ee(t)||je(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Re(t){return t>=1424&&t<=2303||Ue(t)||Ce(t)}const $e=[[9,9],[32,32],[5760,5760],[8192,8198],[8200,8202],[8287,12288],[6158,6158],[8203,8205]];function We(t){for(const n of $e)if(t>=n[0]&&t<=n[1])return!0;return!1}const qe={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\\\":"\","]":"﹈","^":"^",H:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function Be(t,n,i,e,r,s,o,a,h,u){let l=t.trim();2===u&&(l=function(t){let n="";for(let i=0;i<t.length;i++){const e=t.charCodeAt(i+1)||null,r=t.charCodeAt(i-1)||null;n+=e&&Ve(e)&&!qe[t[i+1]]||r&&Ve(r)&&!qe[t[i-1]]||!qe[t[i]]?t[i]:qe[t[i]]}return n}(l));const c=[],f={positionedGlyphs:c,text:l,top:a[1],bottom:a[1],left:a[0],right:a[0],writingMode:u};let d;return d=function(t,n){const i=[];let e=0;for(let r=0;r<n.length;r++){const s=n[r];i.push(t.substring(e,s)),e=s}return e<t.length&&i.push(t.substring(e,t.length)),i}(l,function(t,n,i,e){if(!i)return[];if(!t)return[];const r=[],s=function(t,n,i,e){let r=0;for(let i=0;i<t.length;i++){const s=e[t.charCodeAt(i)];s&&(r+=s.metrics.advance+n)}return r/Math.max(1,Math.ceil(r/i))}(t,n,i,e);let o=0;for(let i=0;i<t.length;i++){const h=t.charCodeAt(i),u=e[h];u&&!Ge[h]&&(o+=u.metrics.advance+n),i<t.length-1&&(Je[h]||!((a=h)<11904)&&(Fe(a)||xe(a)||De(a)||Le(a)||Se(a)||pe(a)||Ae(a)||we(a)||_e(a)||Oe(a)||Pe(a)||je(a)||Me(a)||ge(a)||me(a)||ke(a)||be(a)||ze(a)||Te(a)||Ie(a)))&&r.push(Ye(i+1,o,s,r,Ze(h,t.charCodeAt(i+1)),!1))}var a;return function t(n){return n?t(n.priorBreak).concat(n.index):[]}(Ye(t.length,o,s,r,0,!0))}(l,o,i,n)),function(t,n,i,e,r,s,o,a,h){let u=0,l=8,c=0;const f=t.positionedGlyphs,d="right"===s?1:"left"===s?0:.5;for(let t=0;t<i.length;t++){let r=i[t];if(r=r.trim(),!r.length){l-=e;continue}const s=f.length;for(let t=0;t<r.length;t++){const i=r.charCodeAt(t),e=n[i];e&&(He(i)&&1!==o?(32!==i&&f.push({glyph:i,x:u,y:0,vertical:!0}),u+=h+a):(32!==i&&f.push({glyph:i,x:u,y:l,vertical:!1}),u+=e.metrics.advance+a))}f.length!==s&&(c=Math.max(u-a,c),Qe(f,n,s,f.length-1,d)),u=0,l-=e}const{horizontalAlign:y,verticalAlign:v}=Ke(r);!function(t,n,i,e,r,s,o){const a=(n-i)*r,h=-(-e*o+.5)*s;if(a||h)for(let n=0;n<t.length;n++)t[n].x+=a,t[n].y+=h}(f,d,y,v,c,e,i.length);const p=i.length*e;t.top+=-v*p,t.bottom=t.top+p,t.left+=-y*c,t.right=t.left+c}(f,n,d,e,r,s,u,o,h),!!c.length&&f}const Ge={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Je={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Xe(t,n,i,e){const r=Math.pow(t-n,2);return e?t<n?r/2:2*r:r+Math.abs(i)*i}function Ze(t,n){let i=0;return 10===t&&(i-=1e4),40!==t&&65288!==t||(i+=50),41!==n&&65289!==n||(i+=50),i}function Ye(t,n,i,e,r,s){let o=null,a=Xe(n,i,r,s);for(let t=0;t<e.length;t++){const h=e[t],u=Xe(n-h.x,i,r,s)+h.badness;u<=a&&(o=h,a=u)}return{index:t,x:n,priorBreak:o,badness:a}}function Ke(t){let n=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":n=1;break;case"left":case"top-left":case"bottom-left":n=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:n,verticalAlign:i}}function Qe(t,n,i,e,r){if(!r)return;const s=n[t[e].glyph];if(s){const n=(t[e].x+s.metrics.advance)*r;if(!n)return;for(let r=i;r<=e;r++)t[r].x-=n}}function tr(t){if(!function(t){for(const n of t)if(Re(n.charCodeAt(0)))return!0;return!1}(t))return t;const n=[],i=[],e=[];let r=0,s=0,o=1,a=1;for(const h of t){const t=h.codePointAt(0);We(t)?(e.push(h),r++):(o=Re(t)?-1:1,a!==o?(s=r,i.length&&(a>0&&i.reverse(),n.push(...i)),e.length&&(n.splice(s,0,...e),e.length=0),a=o,i.length=0):e.length&&(i.push(...e),e.length=0),i.push(h),r++)}return e.length&&i.push(...e),i.length&&(a>0&&i.reverse(),n.push(...i)),n.reverse().join("")}const nr=/\\{ *([\\w_]+) *\\}/g;class ir{constructor(t,n,i,e,r){this.feature=t,this.symbolDef=n,this.symbol=i,this.options=r,this.V=this.R.bind(this),this.C=e}R(t,n){return this.feature.properties[n]||"default"}getShape(t,n){if(this.W)return this.W;const{textHorizontalAlignmentFn:i,textVerticalAlignmentFn:e,markerHorizontalAlignmentFn:r,markerVerticalAlignmentFn:s,textWrapWidthFn:o}=this.C;let a;const h=this.symbol,u=this.getIconAndGlyph(),l=this.feature.properties;if(u&&u.glyph){const{font:t,text:r}=u.glyph;if(""===r)return null;const s=this.size[0]/24,c=24,f=h.textKeepUpright,d="map"===h.textRotationAlignment&&"line"===h.textPlacement&&!h.isIconText,y=n.glyphMap[t],v=er(i?i(null,l):h.textHorizontalAlignment,e?e(null,l):h.textVerticalAlignment),p=1.2*c,m=function(t){for(let n=0;n<t.length;n++)if(!Ne(t.charAt(n).charCodeAt(0)))return!1;return!0}(r),g=m&&h.textLetterSpacing/s||0,w=[h.textDx/s||0,h.textDy/s||0],M=((o?o(null,l):h.textWrapWidth)||10*c)/s;a={},a.horizontal=Be(r,y,M,p,v,"center",g,w,c,1),m&&d&&f&&(a.vertical=Be(r,y,M,p,v,"center",g,w,c,2))}else if(u&&u.icon){if(!t.positions[u.icon.url])return null;const n=er(r?r(null,l):h.markerHorizontalAlignment,s?s(null,l):h.markerVerticalAlignment);a=function(t,n){const{horizontalAlign:i,verticalAlign:e}=Ke(n),r=-24*i,s=-24*e;return{image:t,top:s,bottom:s+24,left:r,right:r+24}}(t.positions[u.icon.url],n),this.size||(this.size=a.image.displaySize)}return this.W=a,a}getIconAndGlyph(){if(this.iconGlyph)return this.iconGlyph;const{markerFileFn:t,markerTypeFn:n,markerPathFn:i,markerWidthFn:e,markerHeightFn:r,markerFillFn:s,markerFillPatternFileFn:o,markerFillOpacityFn:a,markerTextFitFn:h,markerTextFitPaddingFn:u,markerLineColorFn:l,markerLineWidthFn:c,markerLineOpacityFn:f,markerLineDasharrayFn:d,markerLinePatternFileFn:y,markerPathWidthFn:v,markerPathHeightFn:p,textNameFn:w,textFaceNameFn:M,textStyleFn:b,textWeightFn:x}=this.C,{zoom:F}=this.options,A={},k=this.symbol,P=this.feature.properties,S=t?t(null,P):k.markerFile,_=n?n(null,P):k.markerType,O=S||_||k.markerPath,I=!Ji(this.symbolDef.textName);let T;if(O){T=function(t,n,i,e,r,s){if(Ji(n.markerWidth)&&Ji(n.markerHeight))return null;const o="__fn_markerWidth".trim(),a="__fn_markerHeight".trim();let h=n.markerWidth||0,u=n.markerHeight||0;return Zi(h)&&("identity"!==h.type?h=de(h):(h=t.markerWidth,t[o]&&(h=t[o](e,i)),Zi(h)&&(h="identity"===h.type?r(e,i):de(h)))),Zi(u)&&("identity"!==u.type?u=de(u):(u=t.markerHeight,t[a]&&(u=t[a](e,i)),Zi(u)&&(u="identity"===u.type?s(e,i):de(u)))),[h,u]}(k,this.symbolDef,P,F,e,r)||[0,0];let t=k.markerTextFit;if(h&&(t=h(F,P)),t&&t&&"none"!==t){const n=k.text.textSize;let i=k.text.textName;m(i)&&(i=g(i)(F,P));const e=ve(i,P);if(e){const i="__fn_textSize".trim(),r="__fn_textSize_0".trim();m(n)&&!k.text[i]&&(k.text[r]=g(n),k.text[i]=(t,n)=>{const i=k.text[r](t,n);return m(i)?g(i)(t,n):i});const s=fe(k.text,k.text,P,F);if("width"!==t&&"both"!==t||(T[0]=s[0]*e.length),"height"!==t&&"both"!==t||(T[1]=s[1]),s[0]&&s[1]){let t=k.markerTextFitPadding||[0,0,0,0];u&&(t=u(F,P)),T[0]+=t[1]+t[3],T[1]+=t[0]+t[2]}}else T[0]=T[1]=-1}}if(I&&(T=fe(k,this.symbolDef,P,F)),!T)return A;if(T[0]=Math.ceil(T[0]),T[1]=Math.ceil(T[1]),this.size=T,O&&T[0]>=0&&T[1]>=0){let t;if(_){const n={};if(n.markerType=_,"path"===_&&(n.markerPath=i?i(null,P):k.markerPath,n.markerPathWidth=v?v(null,P):k.markerPathWidth,n.markerPathHeight=p?p(null,P):k.markerPathHeight),e){const t=e(null,P);Ji(t)||(n.markerWidth=t)}else k.markerWidth>=0&&(n.markerWidth=k.markerWidth);if(r){const t=r(null,P);Ji(t)||(n.markerHeight=t)}else k.markerHeight>=0&&(n.markerHeight=k.markerHeight);if(s){const t=s(null,P);Ji(t)||(n.markerFill=t)}else k.markerFill&&(n.markerFill=k.markerFill);if(o){const t=o(null,P);Ji(t)||(n.markerFillPatternFile=t)}else k.markerFillPatternFile&&(n.markerFillPatternFile=k.markerFillPatternFile);if(a){const t=a(null,P);Ji(t)||(n.markerFillOpacity=t)}else k.markerFillOpacity>=0&&(n.markerFillOpacity=k.markerFillOpacity);if(l){const t=l(null,P);Ji(t)||(n.markerLineColor=t)}else k.markerLineColor&&(n.markerLineColor=k.markerLineColor);if(c){const t=c(null,P);Ji(t)||(n.markerLineWidth=t)}else k.markerLineWidth>=0&&(n.markerLineWidth=k.markerLineWidth);if(f){const t=f(null,P);Ji(t)||(n.markerLineOpacity=t)}else k.markerLineOpacity>=0&&(n.markerLineOpacity=k.markerLineOpacity);if(d){const t=d(null,P);Ji(t)||(n.markerLineDasharray=t)}else k.markerLineDasharray&&(n.markerLineDasharray=k.markerLineDasharray);if(y){const t=y(null,P);Ji(t)||(n.markerLinePatternFile=t)}else k.markerLinePatternFile&&(n.markerLinePatternFile=k.markerLinePatternFile);t="vector://"+JSON.stringify(n)}else t=S?S.replace(nr,this.V):k.markerPath?function(t,n,i){if(!t.markerPath)return null;let e=1;const r=function(t){const n={stroke:{stroke:t.markerLineColor,"stroke-width":t.markerLineWidth,"stroke-opacity":t.markerLineOpacity,"stroke-dasharray":null,"stroke-linecap":"butt","stroke-linejoin":"round"},fill:{fill:t.markerFill,"fill-opacity":t.markerFillOpacity}};return 0===n.stroke["stroke-width"]&&(n.stroke["stroke-opacity"]=0),n}(t);Xi(t.markerOpacity)&&(e=t.markerOpacity),Xi(t.opacity)&&(e*=t.opacity);const s={};if(r){for(const t in r.stroke)Qi(r.stroke,t)&&(Ji(r.stroke[t])||(s[t]=r.stroke[t]));for(const t in r.fill)Qi(r.fill,t)&&(Ji(r.fill[t])||(s[t]=r.fill[t]))}const o=Array.isArray(t.markerPath)?t.markerPath:[t.markerPath];let a;const h=[];for(let t=0;t<o.length;t++)a=Yi(o[t])?{path:o[t]}:o[t],a=Gi({},a,s),a.d=a.path,delete a.path,h.push(a);const u=[\'<svg version="1.1"\',\'xmlns="http://www.w3.org/2000/svg"\'];e<1&&u.push(\'opacity="\'+e+\'"\'),t.markerPathWidth&&t.markerPathHeight&&u.push(\'viewBox="0 0 \'+t.markerPathWidth+" "+t.markerPathHeight+\'"\'),u.push(\'preserveAspectRatio="none"\'),n&&u.push(\'width="\'+n+\'"\'),i&&u.push(\'height="\'+i+\'"\'),u.push("><defs></defs>");for(let t=0;t<h.length;t++){let n="<path ";for(const i in h[t])Qi(h[t],i)&&(n+=" "+i+\'="\'+h[t][i]+\'"\');n+="></path>",u.push(n)}return u.push("</svg>"),"data:image/svg+xml;base64,"+btoa(u.join(" "))}(k,T[0],T[1]):null;A.icon={url:t,size:T}}if(I){const t=w?w(null,P):k.textName;if(t||0===t){const n=function(t,n,i){return[n||"normal",i||"normal","24px",t||"monospace"].join(" ")}(M?M(null,P):k.textFaceName,b?b(null,P):k.textStyle,x?x(null,P):k.textWeight);let i=ve(t,P);i&&i.length&&(i=tr(i),A.glyph={font:n,text:i})}}return this.iconGlyph=A,A}}function er(t,n){n&&"middle"!==n||(n="center"),t&&"middle"!==t||(t="center");let i="center"!==n?n:"";return i+="center"!==t?(i.length?"-":"")+t:"",i\n/*!\n * From mapbox-gl-js\n * MIT License\n * https://github.com/mapbox/mapbox-gl-js\n */}function rr(t,n,i,e,r){const s=[];for(let o=0;o<t.length;o++){const a=t[o];let h;for(let t=0;t<a.length-1;t++){let o=a[t],u=a[t+1];o.x<n&&u.x<n||(o.x<n?o=new Ht(n,o.y+(n-o.x)/(u.x-o.x)*(u.y-o.y)).I():u.x<n&&(u=new Ht(n,o.y+(n-o.x)/(u.x-o.x)*(u.y-o.y)).I()),o.y<i&&u.y<i||(o.y<i?o=new Ht(o.x+(i-o.y)/(u.y-o.y)*(u.x-o.x),i).I():u.y<i&&(u=new Ht(o.x+(i-o.y)/(u.y-o.y)*(u.x-o.x),i).I()),o.x>=e&&u.x>=e||(o.x>=e?o=new Ht(e,o.y+(e-o.x)/(u.x-o.x)*(u.y-o.y)).I():u.x>=e&&(u=new Ht(e,o.y+(e-o.x)/(u.x-o.x)*(u.y-o.y)).I()),o.y>=r&&u.y>=r||(o.y>=r?o=new Ht(o.x+(r-o.y)/(u.y-o.y)*(u.x-o.x),r).I():u.y>=r&&(u=new Ht(o.x+(r-o.y)/(u.y-o.y)*(u.x-o.x),r).I()),h&&o.equals(h[h.length-1])||(h=[o],s.push(h)),h.push(u)))))}}return s}class sr extends Ht{constructor(t,n,i,e){super(t,n),this.angle=i,void 0!==e&&(this.segment=e)}clone(){return new sr(this.x,this.y,this.angle,this.segment)}}\n/*!\n * From mapbox-gl-js\n * MIT License\n * https://github.com/mapbox/mapbox-gl-js\n */function or(t,n,i,e,r){if(void 0===n.segment)return!0;let s=n,o=n.segment+1,a=0;for(;a>-i/2;){if(o--,o<0)return!1;a-=t[o].dist(s),s=t[o]}a+=t[o].dist(t[o+1]),o++;const h=[];let u=0;for(;a<i/2;){const n=t[o],i=t[o+1];if(!i)return!1;let s=t[o-1].angleTo(n)-n.angleTo(i);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),h.push({distance:a,angleDelta:s}),u+=s;a-h[0].distance>e;)u-=h.shift().angleDelta;if(u>r)return!1;o++,a+=n.dist(i)}return!0}function ar(t,n,i,e,r,s,o,a,h){const u=function(t,n,i){return t?.6*n*i:0}(e,s,o),l=function(t,n){return Math.max(t?t.right-t.left:0,n?n.right-n.left:0)}(e,r),c=0===t[0].x||t[0].x===h||0===t[0].y||t[0].y===h;return n-l*o<n/4&&(n=l*o+n/4),function t(n,i,e,r,s,o,a,h,u){const l=o/2,c=function(t){let n=0;for(let i=0;i<t.length-1;i++)n+=t[i].dist(t[i+1]);return n}(n);let f=0,d=i-e,y=[];for(let t=0;t<n.length-1;t++){const i=n[t],a=n[t+1],h=i.dist(a),v=a.angleTo(i);for(;d+e<f+h;){d+=e;const p=(d-f)/h,m=hr(i.x,a.x,p),g=hr(i.y,a.y,p);if(m>=0&&m<u&&g>=0&&g<u&&d-l>=0&&d+l<=c){const i=new sr(m,g,v,t);i.line=n,i.I(),r&&!or(n,i,o,r,s)||y.push(i)}}f+=h}return h||y.length||a||(y=t(n,f/2,e,r,s,o,a,!0,u)),y}(t,c?n/2*a%n:(l/2+2*s)*o*a%n,n,u,i,l*o,c,!1,h)}function hr(t,n,i){return t*(1-i)+n*i}function ur(t,n){const i=t.length;if(i<=1)return[t];const e=[];let r,s;for(let n=0;n<i;n++){const i=ne(t[n]);0!==i&&(t[n].area=Math.abs(i),void 0===s&&(s=i<0),s===i<0?(r&&e.push(r),r=[t[n]]):r.push(t[n]))}if(r&&e.push(r),n>1)for(let t=0;t<e.length;t++)e[t].length<=n||(Bt(e[t],n,1,e[t].length-1,lr),e[t]=e[t].slice(0,n));return e}function lr(t,n){return n.area-t.area}function cr(t,n,i){const e=n.distSqr(i);if(0===e)return t.distSqr(n);const r=((t.x-n.x)*(i.x-n.x)+(t.y-n.y)*(i.y-n.y))/e;return t.distSqr(r<0?n:r>1?i:i.sub(n).F(r).u(n))}function fr(t,n=1,i=!1){let e=1/0,r=1/0,s=-1/0,o=-1/0;const a=t[0];for(let t=0;t<a.length;t++){const n=a[t];(!t||n.x<e)&&(e=n.x),(!t||n.y<r)&&(r=n.y),(!t||n.x>s)&&(s=n.x),(!t||n.y>o)&&(o=n.y)}const h=Math.min(s-e,o-r);let u=h/2;const l=new Zt(null,dr);if(0===h)return new Ht(e,r);for(let n=e;n<s;n+=h)for(let i=r;i<o;i+=h)l.push(new yr(n+u,i+u,u,t));let c=function(t){let n=0,i=0,e=0;const r=t[0];for(let t=0,s=r.length,o=s-1;t<s;o=t++){const s=r[t],a=r[o],h=s.x*a.y-a.x*s.y;i+=(s.x+a.x)*h,e+=(s.y+a.y)*h,n+=3*h}return new yr(i/n,e/n,0,t)}(t),f=l.length;for(;l.length;){const e=l.pop();(e.d>c.d||!c.d)&&(c=e,i&&console.log("found best %d after %d probes",Math.round(1e4*e.d)/1e4,f)),e.max-c.d<=n||(u=e.h/2,l.push(new yr(e.p.x-u,e.p.y-u,u,t)),l.push(new yr(e.p.x+u,e.p.y-u,u,t)),l.push(new yr(e.p.x-u,e.p.y+u,u,t)),l.push(new yr(e.p.x+u,e.p.y+u,u,t)),f+=4)}return i&&(console.log("num probes: "+f),console.log("best distance: "+c.d)),c.p}function dr(t,n){return n.max-t.max}function yr(t,n,i,e){this.p=new Ht(t,n),this.h=i,this.d=function(t,n){let i=!1,e=1/0;for(let r=0;r<n.length;r++){const s=n[r];for(let n=0,r=s.length,o=r-1;n<r;o=n++){const r=s[n],a=s[o];r.y>t.y!=a.y>t.y&&t.x<(a.x-r.x)*(t.y-r.y)/(a.y-r.y)+r.x&&(i=!i),e=Math.min(e,cr(t,r,a))}}return(i?1:-1)*Math.sqrt(e)}(this.p,e),this.max=this.d+this.h*Math.SQRT2}const vr=45*Math.PI/100;function pr(t,n){const i={},e={},r=[];let s=0;function o(n){r.push(t[n]),s++}function a(t,n,i){const s=e[t];return delete e[t],e[n]=s,r[s].geometry[0].pop(),r[s].geometry[0]=r[s].geometry[0].concat(i[0]),s}function h(t,n,e){const s=i[n];return delete i[n],i[t]=s,r[s].geometry[0].shift(),r[s].geometry[0]=e[0].concat(r[s].geometry[0]),s}function u(t,n,i){const e=i?n[0][n[0].length-1]:n[0][0];return`${t}:${e.x}:${e.y}`}for(let l=0;l<t.length;l++){const c=t[l],f=c.geometry;if(!f)continue;const d=c.properties[n]?c.properties[n].toString():null;if(!d){o(l);continue}const y=u(d,f),v=u(d,f,!0);if(y in e&&v in i&&e[y]!==i[v]){const t=h(y,v,f),n=a(y,v,r[t].geometry);delete i[y],delete e[v],e[u(d,r[n].geometry,!0)]=n,r[t].geometry=null}else y in e?a(y,v,f):v in i?h(y,v,f):(o(l),i[y]=s-1,e[v]=s-1)}return r.filter(t=>t.geometry)}class mr extends le{static needMerge(t){return t.mergeOnProperty&&("line"===t.textPlacement||"line"===t.markerPlacement)}static mergeLineFeatures(t,n,i){const e="__index".trim(),r=function(t,n,i){const e="__index".trim(),r=le.genFnTypes(n),{mergeOnPropertyFn:s}=r;if(!n.mergeOnProperty||"line"!==n.textPlacement&&"line"!==n.markerPlacement)return[];if(!(oe(o=n.mergeOnProperty)||"string"!=typeof o&&(null===o.constructor||o.constructor!==String)||"line"!==n.textPlacement&&"line"!==n.markerPlacement))return[{features:t,property:n.mergeOnProperty}];var o;const a=[],h={},u=[];for(let r=0;r<t.length;r++){t[r][e]=r;const o=t[r].properties=t[r].properties||{};o.$layer=t[r].layer,o.$type=t[r].type;let l=n.markerPlacement;"line"!==l&&(l=n.textPlacement);const c=s?s(i,o):n.mergeOnProperty;"line"!==l||oe(c)?u.push(t[r]):(void 0===h[c]&&(h[c]=a.length,a.push({features:[],property:c})),a[h[c]].features.push(t[r]))}return u.length&&a.push({features:u}),a}(t,n,i);if(r.length){const n=[];for(let i=0;i<r.length;i++)n.push(r[i].property?pr(r[i].features,r[i].property):t);if(1===n.length)return n[0];{let t=[];for(let i=0;i<n.length;i++)t=t.concat(n[i]);return t.sort((t,n)=>t[e]-n[e]),t}}}static splitPointSymbol(t,n=0){const i=[];if(Array.isArray(t)){const n=t;for(let t=0;t<n.length;t++)n[t]&&i.push(...mr.splitPointSymbol(n[t],t));return i}let e=null,r=null;for(const n in t)0===n.indexOf("marker")?(e=e||{},e[n]=t[n]):0===n.indexOf("text")&&(r=r||{},r[n]=t[n]);return e&&(e.isIconText=!0,t.mergeOnProperty&&(e.mergeOnProperty=t.mergeOnProperty),i.push(e)),r&&(e&&(r.textPlacement=e.markerPlacement,r.textSpacing=e.markerSpacing,r.isIconText=!0),t.mergeOnProperty&&(r.mergeOnProperty=t.mergeOnProperty),i.push(r)),void 0!==t.visible&&(e&&(e.visible=t.visible),r&&(r.visible=t.visible)),e&&(e.markerTextFit&&r&&(e.text={},e.text.textName=r.textName,e.text.textSize=r.textSize),e.index={index:n,type:0}),r&&(r.index={index:n,type:1}),i}static isAtlasLoaded(t,n){const{icon:i,glyph:e}=t,{iconAtlas:r,glyphAtlas:s}=n;if(i&&(!r||!r.positions[i.url]))return!1;if(e){if(!s||!s.positions[e.font])return!1;const t=s.positions[e.font],{text:n}=e;for(let i=0;i<n.length;i++)if(!t[n.charCodeAt(i)])return!1}return!0}constructor(t,n,i){super(t,n,i)}createStyledVector(t,n,i,e,r,s){const o=new ir(t,this.symbolDef,n,i,e),a=o.getIconAndGlyph();if(a.icon&&!this.options.atlas){const{url:t,size:n}=a.icon;r[t]||(r[t]=a.icon.size),r[t][0]<n[0]&&(r[t][0]=n[0]),r[t][1]<n[1]&&(r[t][1]=n[1])}if(a.glyph&&!this.options.atlas){const{font:t,text:i}=a.glyph,e=s[t]=s[t]||{};for(let t=0;t<i.length;t++)e[i.charCodeAt(t)]=1;"line"===n.textPlacement&&(s.options={isCharsCompact:!1})}return this.options.allowEmptyPack||a.icon||a.glyph?o:null}getFormat(t){const n=void 0!==t.textName,i=n?function(t){return"line"!==t.textPlacement||t.isIconText?[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"},{type:Uint8Array,width:1,name:"aCount"}]:[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"},{type:Uint8Array,width:1,name:"aCount"},{type:Int16Array,width:2,name:"aGlyphOffset"},{type:Uint16Array,width:3,name:"aSegment"},{type:Uint8Array,width:1,name:"aVertical"}]}(t):[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"}];n?i.push(...this.q()):i.push(...this.B());const{markerOpacityFn:e,textOpacityFn:r,markerPitchAlignmentFn:s,textPitchAlignmentFn:o,markerRotationAlignmentFn:a,textRotationAlignmentFn:h,markerRotationFn:u,textRotationFn:l,markerAllowOverlapFn:c,textAllowOverlapFn:f,markerIgnorePlacementFn:d,textIgnorePlacementFn:y}=this.C;return(e||r)&&i.push({type:Uint8Array,width:1,name:"aColorOpacity"}),(s||o)&&i.push({type:Uint8Array,width:1,name:"aPitchAlign"}),(a||h)&&i.push({type:Uint8Array,width:1,name:"aRotationAlign"}),(u||l)&&i.push({type:Uint16Array,width:1,name:"aRotation"}),(c||f||d||y)&&i.push({type:Uint8Array,width:1,name:"aOverlap"}),i}q(){const{textFillFn:t,textSizeFn:n,textHaloFillFn:i,textHaloRadiusFn:e,textHaloOpacityFn:r,textDxFn:s,textDyFn:o}=this.C,a=[];return t&&a.push({type:Uint8Array,width:4,name:"aTextFill"}),n&&a.push({type:Uint8Array,width:1,name:"aTextSize"}),i&&a.push({type:Uint8Array,width:4,name:"aTextHaloFill"}),e&&a.push({type:Uint8Array,width:1,name:"aTextHaloRadius"}),r&&a.push({type:Uint8Array,width:1,name:"aTextHaloOpacity"}),s&&a.push({type:Int8Array,width:1,name:"aTextDx"}),o&&a.push({type:Int8Array,width:1,name:"aTextDy"}),a}B(){const{markerWidthFn:t,markerHeightFn:n,markerDxFn:i,markerDyFn:e}=this.C,r=[];return t&&r.push({type:Uint8Array,width:1,name:"aMarkerWidth"}),n&&r.push({type:Uint8Array,width:1,name:"aMarkerHeight"}),i&&r.push({type:Int8Array,width:1,name:"aMarkerDx"}),e&&r.push({type:Int8Array,width:1,name:"aMarkerDy"}),r}createDataPack(){if(!this.iconAtlas&&!this.glyphAtlas){if(!this.options.allowEmptyPack)return null;this.empty=!0}this.lineVertex=[];const t=super.createDataPack.apply(this,arguments);return t?(t.lineVertex=new Int16Array(this.lineVertex),t.buffers.push(t.lineVertex.buffer),t):null}placeVector(t,n){const i=t.getShape(this.iconAtlas,this.glyphAtlas);if(!this.options.allowEmptyPack&&!i)return;const e=this.G(t,i,n);if(0===e.length)return;const r=this.data;let s=this.data.aPosition.length/3;const o=t.symbol,a=t.feature.properties,h="line"===o.textPlacement&&!o.isIconText,u=void 0!==o.textName,l=u&&h&&function(t){let n=0;for(let i=0;i<t.length;i++)if(He(t.charAt(i).charCodeAt(0)))n=0;else if(n++,n>=1)return!1;return!0}(t.getIconAndGlyph().glyph.text)?1:0,{textFillFn:c,textSizeFn:f,textHaloFillFn:d,textHaloRadiusFn:y,textHaloOpacityFn:v,textDxFn:p,textDyFn:g,textPitchAlignmentFn:w,textRotationAlignmentFn:M,textRotationFn:b,textAllowOverlapFn:x,textIgnorePlacementFn:F,textOpacityFn:A,markerWidthFn:k,markerHeightFn:P,markerDxFn:S,markerDyFn:_,markerPitchAlignmentFn:O,markerRotationAlignmentFn:I,markerRotationFn:T,markerAllowOverlapFn:L,markerIgnorePlacementFn:U,markerOpacityFn:z}=this.C;let D,E,C,j,N,H,V,R,$,W,q,B,G,J,X,Z,Y;if(u){const n=t.getIconAndGlyph().glyph.font;D=function(t,n,i){const e=t.positionedGlyphs,r=[];for(let s=0;s<e.length;s++){const o=e[s],a=i[o.glyph];if(!a)continue;const h=a.rect;if(!h)continue;const u=4,l=a.metrics.advance/2,c=a.metrics.height/2,f=n?[o.x+l,0]:[0,0],d=n?[0,o.y-c]:[o.x+l,o.y-c],y=a.metrics.left-u-l+d[0],v=a.metrics.top-u+d[1],p=y+h.w,m=v+h.h,g=new Ht(y,v),w=new Ht(p,v),M=new Ht(y,m),b=new Ht(p,m);if(n&&o.vertical){const t=new Ht(-l,l),n=-Math.PI/2,i=new Ht(5,0);g.P(n,t).u(i),w.P(n,t).u(i),M.P(n,t).u(i),b.P(n,t).u(i)}r.push({tl:g,tr:w,bl:M,br:b,tex:h,writingMode:t.writingMode,glyphOffset:f})}return r}(i.horizontal,h,this.glyphAtlas.positions[n]),c&&(E=c(null,a),m(E)?E=[0,0,0,0]:(E=Array.isArray(E)?E.map(t=>255*t):Vn(E).array(),3===E.length&&E.push(255))),f&&(C=f(this.options.zoom,a),oe(C)&&(C=14)),d&&(j=d(null,a),j=Array.isArray(j)?j.map(t=>255*t):Vn(j).array(),3===j.length&&j.push(255)),y&&(N=y(null,a)),v&&(H=255*v(null,a)),p&&(V=p(null,a)||0),g&&(R=g(null,a)||0),w&&(G=+("map"===w(null,a))),M&&(J=+("map"===M(null,a))),b&&(X=ae(b(null,a),0,360)*Math.PI/180)}else D=i?function(t){const n=t.image,i=t.top-1/n.pixelRatio,e=t.left-1/n.pixelRatio,r=t.bottom+1/n.pixelRatio,s=t.right+1/n.pixelRatio;let o,a,h,u;return o=new Ht(e,i),a=new Ht(s,i),h=new Ht(s,r),u=new Ht(e,r),[{tl:o,tr:a,bl:u,br:h,tex:{x:n.tl[0],y:n.tl[1],w:n.displaySize[0],h:n.displaySize[1]},writingMode:void 0,glyphOffset:[0,0]}]}(i):function(){const t=new Ht(0,0),n=new Ht(0,0),i=new Ht(0,0);return[{tl:t,tr:n,bl:new Ht(0,0),br:i,tex:{x:0,y:0,w:0,h:0},writingMode:void 0,glyphOffset:[0,0]}]}(),k&&($=k(null,a)),P&&(W=P(null,a)),S&&(q=S(null,a)),_&&(B=_(null,a)),O&&(G=+("map"===O(null,a))),I&&(J=+("map"===I(null,a))),T&&(X=ae(T(null,a),0,360)*Math.PI/180);const K=L||x;K&&(Z=K(null,a)||0);const Q=U||F;let tt;Q&&(Y=Q(null,a)||0);const nt=A||z;nt&&(tt=255*nt(this.options.zoom,a));const it=this.options.EXTENT,et=D.length,rt=this.getAltitude(t.feature.properties);for(let t=0;t<e.length;t++){const n=e[t];if(it!==1/0&&se(n,it))continue;const i=n.x,o=n.y,a=D.length;for(let t=0;t<a;t++){const e=D[t],{tl:a,tr:c,bl:f,br:d,tex:y}=e;this.J(r,i,o,rt,10*a.x,10*a.y,y.x,y.y+y.h),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*c.x,10*c.y,y.x+y.w,y.y+y.h),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*f.x,10*f.y,y.x,y.y),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*d.x,10*d.y,y.x+y.w,y.y),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.addElements(s,s+1,s+2),this.addElements(s+1,s+2,s+3),s+=4;const v=Math.max(Math.abs(i),Math.abs(o),Math.abs(rt));v>this.maxPos&&(this.maxPos=v)}}}J(t,n,i,e,r,s,o,a){t.aPosition.push(n,i,e),t.aShape.push(r,s),t.aTexCoord.push(o,a)}X(t,n,i,e,r,s){if(t.aCount.push(i),n){t.aGlyphOffset.push(e[0],e[1]);const n=r.startIndex;t.aSegment.push(r.segment+n,n,r.line.length),t.aVertical.push(s)}}Z(t,n,i,e,r,s,o,a,h,u,l,c,f,d,y,v,p,m){const{textFillFn:g,textSizeFn:w,textHaloFillFn:M,textHaloRadiusFn:b,textHaloOpacityFn:x,textDxFn:F,textDyFn:A,textPitchAlignmentFn:k,textRotationAlignmentFn:P,textRotationFn:S,textAllowOverlapFn:_,textIgnorePlacementFn:O,textOpacityFn:I,markerWidthFn:T,markerHeightFn:L,markerDxFn:U,markerDyFn:z,markerPitchAlignmentFn:D,markerRotationAlignmentFn:E,markerRotationFn:C,markerAllowOverlapFn:j,markerIgnorePlacementFn:N,markerOpacityFn:H}=this.C;g&&t.aTextFill.push(...n),w&&t.aTextSize.push(i),M&&t.aTextHaloFill.push(...e),b&&t.aTextHaloRadius.push(r),x&&t.aTextHaloOpacity.push(s),F&&t.aTextDx.push(o),A&&t.aTextDy.push(a),T&&t.aMarkerWidth.push(h),L&&t.aMarkerHeight.push(u),U&&t.aMarkerDx.push(l),z&&t.aMarkerDy.push(c),(H||I)&&t.aColorOpacity.push(f),(k||D)&&t.aPitchAlign.push(d),(E||P)&&t.aRotationAlign.push(y),(C||S)&&t.aRotation.push(9362*v);const V=j||_,R=N||O;(V||R)&&t.aOverlap.push((V?8:0)+4*p+((R?2:0)+m)),r>0&&(this.properties.hasHalo=1)}G(t,n,i){const{feature:e,symbol:r}=t,s=this.Y(t,r),o=e.properties,{markerSpacingFn:a,textSpacingFn:h}=this.C,u=((a?a(null,o):r.markerSpacing)||(h?h(null,o):r.textSpacing)||250)*i;return function(t,n,i,e,r,s,o){const{feature:a,size:h,symbol:u}=t,l=h?24:0,c=e*(h?h[0]/l:1),f=[];if("line"===s){let t=a.geometry;r&&(t=rr(a.geometry,0,0,r,r));for(let e=0;e<t.length;e++){const s=ar(t[e],o,vr,u.isIconText?null:i.vertical||i.horizontal||i,null,l,u.isIconText?1:c,1,r||1/0);if(u.textPlacement&&!u.isIconText)for(let t=0;t<s.length;t++)s[t].startIndex=n.length/3;if(f.push.apply(f,s),u.textPlacement&&!u.isIconText)for(let i=0;i<t[e].length;i++)n.push(t[e][i].x,t[e][i].y,0)}}else if(3===a.type){const t=ur(a.geometry,0);for(let n=0;n<t.length;n++){const i=t[n];if("vertex"===s)for(let t=0;t<i.length;t++){const n=i[t];for(let t=0;t<n.length;t++)se(n[t],r)||f.push(n[t])}else{const t=fr(i,16);se(t,r)||f.push(t)}}}else if(2===a.type)for(let t=0;t<a.geometry.length;t++){const n=a.geometry[t];if("vertex"===s)for(let t=0;t<n.length;t++)se(n[t],r)||f.push(n[t]);else se(n[0],r)||f.push(n[0])}else if(1===a.type)for(let t=0;t<a.geometry.length;t++){const n=a.geometry[t];for(let t=0;t<n.length;t++){const i=n[t];se(i,r)||f.push(i)}}return f}(t,this.lineVertex,n,i,this.options.EXTENT,s,u)}Y(t,n){return this.C.markerPlacementFn?this.C.markerPlacementFn(this.options.zoom,t.feature.properties):n.markerPlacement||n.textPlacement}}const gr=Math.cos(Math.PI/180*37.5),wr=Math.pow(2,16)/1;class Mr extends le{constructor(t,n,i){super(t,n,i);let e=!1;const{lineDasharrayFn:r,lineDashColorFn:s}=this.C;r&&(e=function(t,n,i){for(let e=0;e<t.length;e++)if(i(n,t[e].properties))return!0;return!1}(t,this.options.zoom,r),e&&(this.dasharrayFn=r)),(Fr(this.symbol.lineDasharray)||e)&&s&&(this.dashColorFn=s)}createStyledVector(t,n,i,e,r){const s=new he(t,n,i,e),o=s.getLineResource();return!this.options.atlas&&o&&(r[o]=[0,0]),s}getFormat(){const{lineWidthFn:t,lineStrokeWidthFn:n,lineStrokeColorFn:i,lineColorFn:e,lineOpacityFn:r,lineDxFn:s,lineDyFn:o,linePatternAnimSpeedFn:a,linePatternGapFn:h}=this.C,u=[{type:Int16Array,width:3,name:"aPosition"}];if(u.push(this.options.center||this.iconAtlas?{type:Int8Array,width:3,name:"aExtrude"}:{type:Int8Array,width:2,name:"aExtrude"}),u.push({type:Uint16Array,width:1,name:"aLinesofar"}),t&&u.push({type:Uint8Array,width:1,name:"aLineWidth"}),n&&u.push({type:Uint8Array,width:1,name:"aLineStrokeWidth"}),e&&u.push({type:Uint8Array,width:4,name:"aColor"}),i&&u.push({type:Uint8Array,width:4,name:"aStrokeColor"}),r&&u.push({type:Uint8Array,width:1,name:"aOpacity"}),this.symbol.lineOffset&&u.push({type:Int8Array,width:2,name:"aExtrudeOffset"}),this.dasharrayFn&&u.push({type:Uint8Array,width:4,name:"aDasharray"}),this.dashColorFn&&u.push({type:Uint8Array,width:4,name:"aDashColor"}),this.iconAtlas){const t=this.getIconAtlasMaxValue();u.push({type:t>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return s&&u.push({type:Int8Array,width:1,name:"aLineDx"}),o&&u.push({type:Int8Array,width:1,name:"aLineDy"}),a&&u.push({type:Int8Array,width:1,name:"aLinePatternAnimSpeed"}),h&&u.push({type:Uint8Array,width:1,name:"aLinePatternGap"}),u}placeVector(t){const{lineJoinFn:n,lineCapFn:i,lineWidthFn:e,lineStrokeWidthFn:r,lineStrokeColorFn:s,lineColorFn:o,lineOpacityFn:a,lineJoinPatternModeFn:h,lineDxFn:u,lineDyFn:l,linePatternAnimSpeedFn:c,linePatternGapFn:f}=this.C,d=this.symbol,y=t.feature,v=3===y.type,p=y.properties,g=this.elements;v&&(this.elements=[]);let w=d.lineJoin||"miter",M=d.lineCap||"butt";if(n&&(w=n(this.options.zoom,p)||"miter"),i&&(M=i(this.options.zoom,p)||"butt"),e){let t=e(this.options.zoom,p);Ji(t)&&(t=4),this.feaLineWidth=t}else this.feaLineWidth=d.lineWidth;if(r){let t=r(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineStrokeWidth=t}else this.feaLineStrokeWidth=d.lineStrokeWidth||0;if(o&&(this.feaColor=o(this.options.zoom,p)||[0,0,0,255],m(this.feaColor)?this.feaColor=[0,0,0,0]:(this.feaColor=Array.isArray(this.feaColor)?this.feaColor.map(t=>255*t):Vn(this.feaColor).array(),3===this.feaColor.length&&this.feaColor.push(255))),s&&(this.feaStrokeColor=s(this.options.zoom,p)||[0,0,0,255],m(this.feaStrokeColor)?this.feaStrokeColor=[0,0,0,0]:(this.feaStrokeColor=Array.isArray(this.feaStrokeColor)?this.feaStrokeColor.map(t=>255*t):Vn(this.feaStrokeColor).array(),3===this.feaStrokeColor.length&&this.feaStrokeColor.push(255))),a){let t=a(this.options.zoom,p);Ji(t)&&(t=1),this.feaOpacity=255*t}if(this.dasharrayFn){let t=this.dasharrayFn(this.options.zoom,p)||[0,0,0,0];if(t.length<4){const n=t;1===t.length?t=[n[0],n[0],n[0],n[0]]:2===t.length?t=[n[0],n[1],n[0],n[1]]:3===t.length&&(t=[n[0],n[1],n[2],n[2]])}this.feaDash=t}if(this.dashColorFn){let t=(this.dashColorFn?this.dashColorFn(this.options.zoom,p):this.symbol.lineDashColor)||[0,0,0,0];t=Array.isArray(t)?t.map(t=>255*t):Vn(t).array(),3===t.length&&t.push(255),this.feaDashColor=t}if(this.iconAtlas){const n=t.getLineResource(),i=this.iconAtlas.glyphMap[n];if(this.feaTexInfo=this.feaTexInfo||[0,0,0,0],i){const{tl:t,displaySize:i}=this.iconAtlas.positions[n];this.feaTexInfo[0]=t[0]+1,this.feaTexInfo[1]=t[1]+1,this.feaTexInfo[2]=i[0]-3,this.feaTexInfo[3]=i[1]-3}else this.feaTexInfo[0]=this.feaTexInfo[1]=this.feaTexInfo[2]=this.feaTexInfo[3]=0;this.feaJoinPatternMode=h?h(this.options.zoom,p)||0:d.lineJoinPatternMode||0}if(u){let t=u(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineDx=t}if(l){let t=l(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineDy=t}if(c){let t=c(this.options.zoom,p);Ji(t)&&(t=0),0!==t&&(this.properties.hasPatternAnim=1),this.feaPatternAnimSpeed=t}if(f){let t=f(this.options.zoom,p);Ji(t)&&(t=0),this.feaLinePatternGap=t}const b=this.options.EXTENT;let x=y.geometry;b!==1/0&&3!==y.type&&(x=rr(y.geometry,-1,-1,b+1,b+1));for(let t=0;t<x.length;t++)this.offset=this.data.aPosition.length/3,this.K(x[t],y,w,M,2,1.05),v&&(this.tt(g),this.elements=[]);v&&(this.elements=g)}nt(){return this.iconAtlas&&this.feaTexInfo[2]&&this.feaTexInfo[3]}K(t,n,i,e,r,s){const o=this.nt()||Fr(this.feaDash)||Fr(this.symbol.lineDasharray);this.overscaling=1;const a=this.options.EXTENT;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.symbol.lineGradientProperty&&n.properties&&Qi(n.properties,"mapbox_clip_start")&&Qi(n.properties,"mapbox_clip_end")){this.clipStart=+n.properties.mapbox_clip_start,this.clipEnd=+n.properties.mapbox_clip_end;for(let n=0;n<t.length-1;n++)this.totalDistance+=t[n].dist(t[n+1]);this.updateScaledDistance()}const h=3===n.type;let u=t.length;for(;u>=2&&t[u-1].equals(t[u-2]);)u--;let l=0;for(;l<u-1&&t[l].equals(t[l+1]);)l++;if(u<(h?3:2))return;"bevel"===i&&(r=1.05);const c=this.overscaling<=16?15*a/(512*this.overscaling):0,f={vertexLength:0,primitiveLength:0};let d,y,v,p,m;this.e1=this.e2=-1,h&&(d=t[u-2],m=t[l].sub(d)._().O());for(let n=l;n<u;n++){if(v=n===u-1?h?t[l+1]:void 0:t[n+1],v&&t[n].equals(v))continue;m&&(p=m),d&&(y=d),d=t[n],m=v?v.sub(d)._().O():p,p=p||m;let a=p.add(m);0===a.x&&0===a.y||a._();const g=p.x*m.x+p.y*m.y,w=a.x*m.x+a.y*m.y,M=0!==w?1/w:1/0,b=2*Math.sqrt(2-2*w),x=w<gr&&y&&v,F=p.x*m.y-p.y*m.x>0;if(!o&&x&&n>l){const t=d.dist(y);if(t>2*c){const n=d.sub(d.sub(y).F(c/t).I());this.updateDistance(y,n),this.addCurrentVertex(n,p,0,0,f),y=n}}const A=y&&v;let k=A?i:h?"butt":e;if(A&&"round"===k&&(M<s?k="miter":M<=2&&(k="fakeround")),"miter"===k&&M>r&&(k="bevel"),"bevel"===k&&(M>2&&(k="flipbevel"),M<r&&(k="miter")),y&&this.updateDistance(y,d),(n>l&&n<u-1||h&&n===u-1)&&o){const t=this.feaJoinPatternMode?0:-p.mag()*w;this.addCurrentVertex(d,p,t,t,f),this.it=1}if("miter"===k)a.F(M),this.addCurrentVertex(d,a,0,0,f);else if("flipbevel"===k){if(M>100)a=m.mult(-1);else{const t=M*p.add(m).mag()/p.sub(m).mag();a.O().F(t*(F?-1:1))}this.addCurrentVertex(d,a,0,0,f),this.addCurrentVertex(d,a.mult(-1),0,0,f)}else if("bevel"===k||"fakeround"===k){const t=-Math.sqrt(M*M-1),n=F?t:0,i=F?0:t;if(y&&this.addCurrentVertex(d,p,n,i,f),"fakeround"===k){const t=Math.round(180*b/Math.PI/20);for(let n=1;n<t;n++){let i=n/t;if(.5!==i){const t=i-.5;i+=i*t*(i-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*t*t+(.848013+g*(.215638*g-1.06021)))}const e=m.sub(p).F(i).u(p)._().F(F?-1:1);this.addHalfVertex(d,e.x,e.y,!1,F,0,f)}}v&&this.addCurrentVertex(d,m,-n,-i,f)}else if("butt"===k)this.addCurrentVertex(d,a,0,0,f);else if("square"===k){const t=y?1:-1;this.addCurrentVertex(d,a,t,t,f)}else"round"===k&&(y&&(this.addCurrentVertex(d,p,0,0,f),this.addCurrentVertex(d,p,1,1,f,!0)),v&&(this.addCurrentVertex(d,m,-1,-1,f,!0),this.addCurrentVertex(d,m,0,0,f)));if(!o&&x&&n<u-1){const t=d.dist(v);if(t>2*c){const n=d.add(v.sub(d).F(c/t).I());this.updateDistance(d,n),this.addCurrentVertex(n,m,0,0,f),d=n}}if((n>l&&n<u-1||h&&n===l)&&o){delete this.it;const t=this.feaJoinPatternMode?0:m.mag()*w;this.addCurrentVertex(d,m,t,t,f)}}}addCurrentVertex(t,n,i,e,r,s=!1){const o=n.y*e-n.x,a=-n.y-n.x*e;this.addHalfVertex(t,n.x+n.y*i,n.y-n.x*i,s,!1,i,r),this.addHalfVertex(t,o,a,s,!0,-e,r),this.distance>wr/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,n,i,e,r,s))}addHalfVertex({x:t,y:n},i,e,r,s,o,a){this.fillData(this.data,t,n,i,e,r,s,1*this.scaledDistance);const h=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.addElements(this.e1,this.e2,h),a.primitiveLength++),s?this.e2=h:this.e1=h}fillData(t,n,i,e,r,s,o,a){const{lineWidthFn:h,lineStrokeWidthFn:u,lineStrokeColorFn:l,lineColorFn:c,lineOpacityFn:f,lineDxFn:d,lineDyFn:y,linePatternAnimSpeedFn:v,linePatternGapFn:p}=this.C;if(this.options.center?t.aPosition.push(n,i,0):t.aPosition.push(n=(n<<1)+(s?1:0),i=(i<<1)+(o?1:0),0),t.aExtrude.push(63*e,63*r),this.options.center||this.iconAtlas){let n=0;this.options.center&&(n+=2*s+o),this.iconAtlas&&(n+=4*(this.it&&this.feaJoinPatternMode?1:0)),t.aExtrude.push(n)}t.aLinesofar.push(a),h&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),u&&t.aLineStrokeWidth.push(Math.round(2*this.feaLineStrokeWidth)),c&&t.aColor.push(...this.feaColor),l&&t.aStrokeColor.push(...this.feaStrokeColor),f&&t.aOpacity.push(this.feaOpacity),this.dasharrayFn&&t.aDasharray.push(...this.feaDash),this.dashColorFn&&t.aDashColor.push(...this.feaDashColor),this.iconAtlas&&t.aTexInfo.push(...this.feaTexInfo),d&&t.aLineDx.push(this.feaLineDx),y&&t.aLineDy.push(this.feaLineDy),v&&t.aLinePatternAnimSpeed.push(127*this.feaPatternAnimSpeed),p&&t.aLinePatternGap.push(10*this.feaLinePatternGap),this.maxPos=Math.max(this.maxPos,Math.abs(n)+1,Math.abs(i)+1)}addElements(t,n,i){super.addElements(this.offset+t,this.offset+n,this.offset+i)}tt(t){const n=this.options.EXTENT,i=this.elements;for(let e=0;e<i.length;e+=3)n!==1/0&&(xr(this.data.aPosition,i[e],i[e+1],3,n)||xr(this.data.aPosition,i[e+1],i[e+2],3,n))||t.push(i[e],i[e+1],i[e+2])}et(t){if(t.length<=1)return t;const n=[],i=this.options.EXTENT;let e,r=!0;for(e=0;e<t.length-1;e++){const s=br(t[e],t[e+1],i);s&&r||(n.push(t[e]),r=s)}return r||n.push(t[e]),n}updateDistance(t,n){this.distance+=t.dist(n),this.updateScaledDistance()}updateScaledDistance(){this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(wr-1):this.distance}}function br(t,n,i){return i!==1/0&&(t.x<0&&n.x<0||t.x>i&&n.x>i||t.y<0&&n.y<0||t.y>i&&n.y>i)}function xr(t,n,i,e,r){if(r===1/0)return!1;const s=Math.floor(.5*t[n*e]),o=Math.floor(.5*t[n*e+1]),a=Math.floor(.5*t[i*e]),h=Math.floor(.5*t[i*e+1]);return s===a&&(s<0||s>r)&&o!==h||o===h&&(o<0||o>r)&&s!==a}function Fr(t){if(!Array.isArray(t))return!1;for(let n=0;n<t.length;n++)if(t[n])return!0;return!1}class Ar extends Mr{constructor(t,n,i){super(t,n,i),this.rt=i.altitudeProperty}getFormat(){const{lineColorFn:t,lineWidthFn:n}=this.C,i=[{type:Int16Array,width:3,name:"aPosition"},{type:Uint16Array,width:1,name:"aLinesofar"},{type:Uint8Array,width:1,name:"aUp"},{type:Int16Array,width:3,name:"aExtrudedPosition"},{type:Int8Array,width:2,name:"aExtrude"}];return t&&i.push({type:Uint8Array,width:4,name:"aColor"}),n&&i.push({type:Uint8Array,width:1,name:"aLineWidth"}),this.rt&&i.push({type:Array,width:1,name:"aLineHeight"}),i}placeVector(t){const n=t.feature;if(this.rt){const{altitudeScale:t,altitudeProperty:i,defaultAltitude:e,heightProperty:r,defaultHeight:s,minHeightProperty:o}=this.options,{altitude:a,height:h}=re(n,t,i,e,r,s,o);this.feaAltitude=a,this.feaMinHeight=(a-h)/a*32767,a>this.maxAltitude&&(this.maxAltitude=a)}return super.placeVector(t)}K(t,n,i,e,r,s){const o=this.data.aPosition.length/3;super.K(t,n,i,e,r,s);const a=this.data.aPosition.length/3,h=this.data.aPosition.length/3-this.offset;if(3!==n.type&&h>0&&!1!==this.options.side){const t=!1!==this.options.top?1:0,n=t+4;let i=this.data.aPosition.length/3;for(const t in this.data){const n=this.data[t],e=n.length/i;for(let t=0;t<e;t++)n.push(n[o*e+3*e+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[o*r+r*n+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[o*r+r*(n+3)+t])}super.addElements(t+1,h+1,h),super.addElements(h,h+1,h+2);const e=this.data.aPosition.length/3-this.offset;i=this.data.aPosition.length/3;for(const t in this.data){const n=this.data[t],e=n.length/i;for(let t=0;t<e;t++)n.push(n[a*e-e+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[a*r-n*r-r+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[a*r-n*r-3*r+t])}super.addElements(e,h-3,e+1),super.addElements(h-3,e+2,e+1)}}fillData(t,n,i,e,r,s,o,a){const h=!1!==this.options.top,u=!1!==this.options.side,l=this.feaLineWidth||this.symbol.lineWidth/2*(this.options.EXTENT/this.options.tileSize),c=63*e,f=63*r,d=l*e+n,y=l*r+i;this.st(t,n,i,e,r,s,o,a,d,y,c,f),u&&(h&&this.st(t,n,i,e,r,s,o,a,d,y,c,f),this.st(t,n,i,e,r,s,o,a,d,y,c,f),this.ot(t,n,i,e,r,s,o,a,d,y,c,f),this.ot(t,n,i,e,r,s,o,a,d,y,c,f)),this.maxPos=Math.max(this.maxPos,Math.abs(n),Math.abs(i))}st(t,n,i,e,r,s,o,a,h,u,l,c){const{lineColorFn:f,lineWidthFn:d}=this.C;t.aPosition.push(n,i,32767),t.aLinesofar.push(a),t.aUp.push(+o),t.aExtrudedPosition.push(h,u,1),t.aExtrude.push(l,c),f&&t.aColor.push(...this.feaColor),d&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),this.rt&&t.aLineHeight.push(this.feaAltitude)}ot(t,n,i,e,r,s,o,a,h,u,l,c){const{lineColorFn:f,lineWidthFn:d}=this.C;t.aPosition.push(n,i,this.feaMinHeight||0),t.aLinesofar.push(a),t.aUp.push(+o),t.aExtrudedPosition.push(h,u,1),t.aExtrude.push(l,c),f&&t.aColor.push(...this.feaColor),d&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),this.rt&&t.aLineHeight.push(this.feaAltitude)}addElements(t,n,i){const e=!1!==this.options.top,r=!1!==this.options.side,s=(e?1:0)+(r?4:0);if(t*=s,n*=s,this.data.aUp[this.offset+(i*=s)+4]){if(e&&super.addElements(n,t,i),r){const t=e?1:0;super.addElements(n+t,i+t,i+t+2),super.addElements(n+t+1,i+t+1+2,n+t+1+2)}}else if(e&&super.addElements(t,i,n),r){const n=e?1:0;super.addElements(t+n,t+n+2,i+n),super.addElements(t+n+1+2,i+n+1+2,i+n+1)}}createDataPack(t,n){this.maxAltitude=0;const i=super.createDataPack(t,n);if(!i)return i;const{data:e,indices:r}=i;this.getFormat().reduce((t,n)=>(t[n.name]={size:n.width},t),{}).aPickingId={size:1};const{aExtrudedPosition:s,aPosition:o,aLinesofar:a,aUp:h,aExtrude:u,aColor:l,aLineHeight:c,aLineWidth:f}=e,d={},y=Xn(s,r);let v,p=!0;for(let t=0;t<y.length;t++)y[t]=-y[t],y[t]%1!=0&&(p=!1);if(!1!==this.options.top&&this.symbol.material&&function(t){for(const n in t)if(n.indexOf("Texture")>=0&&t[n])return!0;return!1}(this.symbol.material)&&(v=function(t,n,i){const e=[];for(let r=0;r<t.length;r+=3){const t=n[r/3];e.push(t/256,i[r/3]?1:0)}return e}(s,a,h)),d.aPosition=o,v&&(d.aTexCoord0=new Float32Array(v)),d.aNormal=p?new Int8Array(y):new Float32Array(y),d.aPickingId=e.aPickingId,d.aExtrude=u,l&&(d.aColor=l),f&&(d.aLineWidth=f),c){const t=Wi(this.maxAltitude);d.aLineHeight=new t(c)}const m=[];for(const t in d)m.push(d[t].buffer);return i.data=d,i.buffers=m,i}}const kr=Math.pow(2,16)/1;class Pr extends le{getFormat(){return[{type:Int16Array,width:3,name:"aPosition"}]}placeVector(t){const n=t.feature,i=3===n.type,e=n.geometry,r=this.elements;i&&(this.elements=[]);for(let t=0;t<e.length;t++)this.offset=this.data.aPosition.length/3,this.K(e[t],n),i&&(this.tt(r),this.elements=[]);i&&(this.elements=r)}K(t,n){const i=3===n.type;let e=t.length;for(;e>=2&&t[e-1].equals(t[e-2]);)e--;let r,s,o,a=0;for(;a<e-1&&t[a].equals(t[a+1]);)a++;if(!(e<(i?3:2))){this.distance=0,this.vertexLength=0,this.primitiveLength=0,this.e1=this.e2=this.e3=-1,i&&(r=t[e-2]);for(let n=a;n<e;n++)o=i&&n===e-1?t[a+1]:t[n+1],o&&t[n].equals(o)||(r&&(s=r),r=t[n],s&&(this.distance+=r.dist(s)),this.addCurrentVertex(r,this.distance))}}addCurrentVertex(t,n){const i=this.vertexLength++;this.addLineVertex(this.data,t,n),i>=1&&this.addElements(i-1,i),n>kr&&(this.distance=0,this.addCurrentVertex(t,this.distance))}addLineVertex(t,n){t.aPosition.push(n.x,n.y,0),this.maxPos=Math.max(this.maxPos,Math.abs(n.x),Math.abs(n.y))}addElements(t,n){super.addElements(this.offset+t,this.offset+n)}tt(t){const n=this.options.EXTENT,i=this.elements;for(let e=0;e<i.length;e+=2)ie(this.data.aPosition,i[e],i[e+1],3,n)||t.push(i[e],i[e+1])}}const Sr=45*Math.PI/100;class _r extends le{getFormat(){return[{type:Int16Array,width:3,name:"aPosition"}]}placeVector(t){const n=this.G(t,this.symbol.markerSpacing||250,this.symbol.markerPlacement||"point"),i=this.getAltitude(t.feature.properties);for(let t=0;t<n.length;t++){const e=n[t];this.data.aPosition.push(e.x,e.y),this.data.aPosition.push(i);const r=Math.max(Math.abs(e.x),Math.abs(e.y));r>this.maxPos&&(this.maxPos=r)}}G(t,n,i){const e=t.feature,r=t.feature.type,s=this.options.EXTENT,o=[];if("line"===i){let t=e.geometry;s&&(t=rr(e.geometry,0,0,s,s));for(let i=0;i<t.length;i++){const e=ar(t[i],n,Sr,null,null,24,1,1,s||1/0);o.push.apply(o,e)}}else if(3===r){const t=ur(e.geometry,0);for(let n=0;n<t.length;n++){const i=fr(t[n],16);se(i,s)||o.push(i)}}else if(2===e.type)for(let t=0;t<e.geometry.length;t++){const n=e.geometry[t];se(n[0],s)||o.push(n[0])}else if(1===e.type)for(let t=0;t<e.geometry.length;t++){const n=e.geometry[t];for(let t=0;t<n.length;t++){const i=n[t];se(i,s)||o.push(i)}}return o}hasElements(){return!1}}\n/*!\n * from @turf/bboxClip\n * https://github.com/Turfjs/turf\n * MIT LICENSE\n */const Or=[],Ir=[];function Tr(t,n){var i,e,r,s,o,a,h;for(e=1;e<=8;e*=2){for(i=[],s=!(Ur(r=t[t.length-1],n)&e),o=0;o<t.length;o++){if((h=!(Ur(a=t[o],n)&e))!==s){const t=Lr(r,a,e,n);i.push(void 0!==a.x?new Ht(t[0],t[1]):t)}h&&i.push(a),r=a,s=h}if(!(t=i).length)break}return i}function Lr(t,n,i,e){return Or[0]=void 0===t.x?t[0]:t.x,Or[1]=void 0===t.y?t[1]:t.y,t=Or,Ir[0]=void 0===n.x?n[0]:n.x,Ir[1]=void 0===n.y?n[1]:n.y,n=Ir,8&i?[t[0]+(n[0]-t[0])*(e[3]-t[1])/(n[1]-t[1]),e[3]]:4&i?[t[0]+(n[0]-t[0])*(e[1]-t[1])/(n[1]-t[1]),e[1]]:2&i?[e[2],t[1]+(n[1]-t[1])*(e[2]-t[0])/(n[0]-t[0])]:1&i?[e[0],t[1]+(n[1]-t[1])*(e[0]-t[0])/(n[0]-t[0])]:null}function Ur(t,n){Or[0]=void 0===t.x?t[0]:t.x,Or[1]=void 0===t.y?t[1]:t.y;var i=0;return(t=Or)[0]<n[0]?i|=1:t[0]>n[2]&&(i|=2),t[1]<n[1]?i|=4:t[1]>n[3]&&(i|=8),i}class zr extends le{constructor(...t){super(...t),this.lineElements=[]}createStyledVector(t,n,i,e,r){const s=new he(t,n,i,e),o=s.getPolygonResource();return!this.options.atlas&&o&&(r[o]=[0,0]),s}getFormat(){const t=[{type:Int16Array,width:3,name:"aPosition"}],{polygonFillFn:n,polygonOpacityFn:i,uvScaleFn:e,uvOffsetFn:r}=this.C;if(this.iconAtlas){const n=this.getIconAtlasMaxValue();t.push({type:n>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return n&&t.push({type:Uint8Array,width:4,name:"aColor"}),i&&t.push({type:Uint8Array,width:1,name:"aOpacity"}),e&&t.push({type:Uint16Array,width:2,name:"aUVScale"}),r&&t.push({type:Uint8Array,width:2,name:"aUVOffset"}),t}createDataPack(...t){this.maxLineIndex=0,this.lineElements=[];const n=super.createDataPack(...t);if(!n)return n;let i=this.lineElements;return i=new($i(this.maxLineIndex))(this.lineElements),n.lineIndices=i,n.buffers.push(i.buffer),n}placeVector(t,n){const i=t.feature;this.at(i.geometry,i,n)}at(t,n){let i,e,r,s;const{polygonFillFn:o,polygonOpacityFn:a,uvScaleFn:h,uvOffsetFn:u}=this.C,l=n.properties;o&&(i=o(this.options.zoom,l)||[255,255,255,255],m(i)?i=[0,0,0,0]:(i=Array.isArray(i)?i.map(t=>255*t):Vn(i).array(),3===i.length&&i.push(255))),a&&(e=a(this.options.zoom,l),Ji(e)&&(e=1),e*=255),h&&(r=h(this.options.zoom,l),Ji(r)&&(r=[1,1]),r=[255*r[0],255*r[1]]),u&&(s=u(this.options.zoom,l),Ji(s)&&(s=[0,0]),s=[255*s[0],255*s[1]]);const c=!!this.iconAtlas,f=ur(t,500),d=this.getAltitude(l),y=[0,0],v=[0,0];if(c){const{polygonPatternFileFn:t}=this.C,n=t?t(null,l):this.symbol.polygonPatternFile;if(this.iconAtlas.glyphMap[n]){const t=this.iconAtlas.positions[n];y[0]=t.tl[0]+1,y[1]=t.tl[1]+1,v[0]=t.displaySize[0]-3,v[1]=t.displaySize[1]-3}}const p=[-1,-1,n.extent+1,n.extent+1];for(let t=0;t<f.length;t++){const n=f[t],o=this.data.aPosition.length/3,a=[],h=[];for(let t=0;t<n.length;t++){let o=n[t];if(this.options.EXTENT!==1/0&&(o=Tr(o,p)),0===o.length)continue;0!==t&&h.push(a.length/2);const u=this.lineElements.length;this.data.aPosition.push(o[0].x,o[0].y,d),c&&this.data.aTexInfo.push(...y,...v),void 0!==i&&this.data.aColor.push(...i),void 0!==e&&this.data.aOpacity.push(e),void 0!==r&&this.data.aUVScale.push(...r),void 0!==s&&this.data.aUVOffset.push(...s),this.maxPos=Math.max(this.maxPos,Math.abs(o[0].x),Math.abs(o[0].y)),this.addLineElements(u+o.length-1,u),a.push(o[0].x),a.push(o[0].y);for(let t=1;t<o.length;t++)this.data.aPosition.push(o[t].x,o[t].y,d),c&&this.data.aTexInfo.push(...y,...v),void 0!==i&&this.data.aColor.push(...i),void 0!==e&&this.data.aOpacity.push(e),void 0!==r&&this.data.aUVScale.push(...r),void 0!==s&&this.data.aUVOffset.push(...s),this.maxPos=Math.max(this.maxPos,Math.abs(o[t].x),Math.abs(o[t].y)),this.addLineElements(u+t-1,u+t),a.push(o[t].x),a.push(o[t].y)}const u=ki(a,h);for(let t=0;t<u.length;t+=3)this.addElements(o+u[t],o+u[t+1],o+u[t+2])}}addLineElements(...t){this.maxLineIndex=Math.max(this.maxLineIndex,...t),this.lineElements.push(...t)}}var Dr=Object.freeze({__proto__:null,clipPolygon:Tr,calculateSignedArea:ne,getFeaAltitudeAndHeight:re,convertRTLText:tr});const Er={polygonPatternFile:1,markerFile:1,markerPlacement:1,markerSpacing:1,textName:1,textStyle:1,textFaceName:1,textWeight:1,textPlacement:1,textSpacing:1,lineJoin:1,lineCap:1,linePatternFile:1};Object.assign({visible:1,textHorizontalAlignment:1,textVerticalAlignment:1,textWrapWidth:1,markerHorizontalAlignment:1,markerVerticalAlignment:1},Er),Object.assign({lineDasharray:1},Er);function Cr(t,n,i,e,r,s,o,a,h,u,l,c,f,d,y){const v=n.length,p=r/3;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-s;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-o;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-s;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-o;r+=v,(i=i||[]).push(v/3);for(let n=0;n<i.length;n++){jr(p+(i[n-1]||0),p+i[n],t,v/3,a,e,h,u,l,c,f,d,y)}return r}function jr(t,n,i,e,r,s,o,a,h,u,l,c,f){const d=s.length;let y,v;for(let o=t,a=n;o<a-1;o++)y=o,v=o+1,ct(i,y,v,r)||((o-t)%2==1&&(y+=2*e,v+=2*e),s.push(y+e,y,v),s.push(v,v+e,y+e));o&&function(t,n,i,e,r,s,o,a,h){let u,l=0,c=0,f=0,d=0;for(let y=e.length-1;y>=0;y--){const v=3*e[y],p=3*e[y]+1,m=3*e[y]+2,g=i[v],w=i[p],M=i[m];l||c||(l=Math.max(i[m],i[3*e[y-2]+2]),c=Math.min(i[m],i[3*e[y-2]+2]),u=l-c);let b=f;const x=y%6;0===t?(5===x&&(d=Nt(i,e,y,g,w)),b=2===x||3===x||4===x?f:f+d):1===t&&(2===x||3===x||4===x?b=0:5===x?(d=Nt(i,e,y,g,w),b=d):b=d);const F=b*o*a/r,A=M===l?0:u*h/s;n[v/3*2]=F,n[v/3*2+1]=-A,0===x&&(f+=d)}}(a,h,i,s.slice(d,s.length),u[0],u[1],l,c,f)}function Nr(t,n,i,e,r,s,o,a,h,u){void 0===n.top&&(n.top=!0),void 0===n.side&&(n.side=!0);const{altitudeScale:l,altitudeProperty:c,defaultAltitude:f,heightProperty:d,minHeightProperty:y,defaultHeight:v,tangent:p,uv:m,uvScale:M,topUVMode:b,sideUVMode:x,top:F,side:A,topThickness:k}=n,S=function(t,n,{altitudeScale:i,altitudeProperty:e,defaultAltitude:r,heightProperty:s,minHeightProperty:o,defaultHeight:a},{side:h,top:u,topThickness:l,uvOrigin:c,uv:f,uvSize:d,topUVMode:y,sideUVMode:v,glScale:p,localScale:m,vScale:g},w){const M=n/t[0].extent,b=[],x=[],F=[],A=[],k=[],S=[],_=!!f,O=!!u,T=!!h,z=_?[]:null;function D(t,i,e,r){if(O){const r=ki(A,e,3);if(0===r.length)return i;let s;I(k,A),i+=A.length;for(let n=2,i=r.length;n<i;n+=3)s=r[n-1],r[n-1]=r[n]+t/3,r[n]=s+t/3,r[n-2]+=t/3;I(S,r),_&&Et(y||0,t,i,z,k,0,p,m,d[0],d[1]),l>0&&!T&&(i=Cr(k,A,e,S,i,0,l,n,_,v||0,z,d,p,m,g))}return T&&(O&&(l=0),i=Cr(k,A,e,S,i,l,r,n,_,v||0,z,d,p,m,g)),i}let E=0,C=0;const j=[-1,-1,n+1,n+1];let N=0,H=t.length;void 0!==w&&(N=w,H=w+1);let V=0,R=!1;for(;N<H;N++){const h=t[N],u=h.id;P(u)&&(Math.abs(u)>V&&(V=Math.abs(u)),u<0&&(R=!0));const l=h.geometry,{altitude:c,height:f}=Dr.getFeaAltitudeAndHeight(h,i,e,r,s,a,o);E=Math.max(Math.abs(c),E);const d=k.length;let y=C,v=[];A.length=0;for(let t=0,i=l.length;t<i;t++){const e=Dr.calculateSignedArea(l[t])<0;!e&&t>0&&(C=D(y,C,v,f*M),A.length=0,v=[],y=C);let r=l[t];if(n!==1/0&&(r=Dr.clipPolygon(r,j)),!r.length){t===i-1&&(C=D(y,C,v,f*M));continue}const s=r.length;Array.isArray(r[0])?r[0][0]===r[s-1][0]&&r[0][1]===r[s-1][1]||r.push([r[0][0],r[0][1]]):r[0].x===r[s-1].x&&r[0].y===r[s-1].y||r.push(r[0]),e&&v.push(A.length/3),lt(A,A.length,r,M,c),t===i-1&&(C=D(y,C,v,f*M))}const p=k.length-d,m="__fea_idx".trim();for(let t=0;t<p/3;t++)x.push(void 0===h[m]?N:h[m]),b.push(N),P(u)&&F.push(u)}const $=L(x.length?x[x.length-1]:0),W={maxAltitude:E,vertices:new(U(Math.max(512,E)))(k),indices:S,pickingIds:new $(x),featureIndexes:b};if(F.length){const t=R?U(V):L(V);W.featureIds=new t(F)}else W.featureIds=[];return z&&(z.length=k.length/3*2,W.uvs=z),W}(t,i,{altitudeScale:l,altitudeProperty:c,defaultAltitude:f||0,heightProperty:d,minHeightProperty:y,defaultHeight:v||0},{top:F,side:A,topThickness:10*k||0,uv:m||p,uvSize:M?[.5*M[0],.5*M[1]]:[.5,.5],uvOrigin:e,topUVMode:b,sideUVMode:x,glScale:r,localScale:o,vScale:s},u),_=[],O=new(T(S.vertices.length/3))(S.indices);delete S.indices,_.push(O.buffer,S.vertices.buffer,S.pickingIds.buffer);const z=Xn(S.vertices,O);let E=!0;for(let t=0;t<z.length;t++)z[t]=-z[t],z[t]%1!=0&&(E=!1);if(S.normals=z,p){let t=function(t,n,i,e){const r=t.length/3,s=new Array(4*r),o=[],a=[];for(let t=0;t<r;t++)o[t]=[0,0,0],a[t]=[0,0,0];const h=[0,0,0],u=[0,0,0],l=[0,0,0],c=[0,0],f=[0,0],d=[0,0],y=[0,0,0],v=[0,0,0];function p(n,e,r){Zn(h,t,3*n),Zn(u,t,3*e),Zn(l,t,3*r),Yn(c,i,2*n),Yn(f,i,2*e),Yn(d,i,2*r);const s=u[0]-h[0],p=l[0]-h[0],m=u[1]-h[1],g=l[1]-h[1],w=u[2]-h[2],M=l[2]-h[2],b=f[0]-c[0],x=d[0]-c[0],F=f[1]-c[1],A=d[1]-c[1],k=1/(b*A-x*F);bt(y,(A*s-F*p)*k,(A*m-F*g)*k,(A*w-F*M)*k),bt(v,(b*p-x*s)*k,(b*g-x*m)*k,(b*M-x*w)*k),xt(o[n],o[n],y),xt(o[e],o[e],y),xt(o[r],o[r],y),xt(a[n],a[n],v),xt(a[e],a[e],v),xt(a[r],a[r],v)}for(let t=0,n=e.length;t<n;t+=3)p(e[t+0],e[t+1],e[t+2]);const m=[],g=[],w=[],M=[];let b,x,F;function A(t){Zn(w,n,3*t),Mt(M,w),x=o[t],Mt(m,x),St(m,m,function(t,n,i){return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t}(w,w,kt(w,x))),At(m,m),Pt(g,M,x),F=kt(g,a[t]),b=F<0?-1:1,s[4*t]=m[0],s[4*t+1]=m[1],s[4*t+2]=m[2],s[4*t+3]=b}for(let t=0,n=e.length;t<n;t+=3)A(e[t+0]),A(e[t+1]),A(e[t+2]);return s}(S.vertices,S.normals,S.uvs,O);t=function(t,n){const i=new Float32Array(n.length),e=[],r=[],s=[];for(let o=0;o<n.length;o+=4){const a=o/4*3;bt(r,t[a]||0,t[a+1]||0,t[a+2]||0),Ot(e,n[o]||0,n[o+1]||0,n[o+2]||0,n[o+3]||0),Jn(s,r,e),_t(i.subarray(o,o+4),s)}return i}(S.normals,t),S.tangents=t,_.push(t.buffer),delete S.normals}if(S.normals&&(S.normals=E?new Int8Array(S.normals):new Float32Array(S.normals),_.push(S.normals.buffer)),S.uvs){const t=S.uvs;S.uvs=new Float32Array(t),_.push(S.uvs.buffer)}const C=function(t,n,i,e){const r={};if(D(n.polygonFill)){const s={},o=w(n.polygonFill),a=new Uint8Array(4*e.length);for(let n=0;n<e.length;n++){const r=t[e[n]],h=r.properties||{};h.$layer=r.layer,h.$type=r.type;let u=o(i,h);if(delete h.$layer,delete h.$type,Array.isArray(u)||(u=s[u]=s[u]||Vn(u).array()),Array.isArray(u)){for(let t=0;t<u.length;t++)Hr[t]=255*u[t];3===u.length&&(Hr[3]=255)}a[4*n]=Hr[0],a[4*n+1]=Hr[1],a[4*n+2]=Hr[2],a[4*n+3]=Hr[3]}r.aColor=a}if(D(n.polygonOpacity)){const s=g(n.polygonOpacity),o=new Uint8Array(e.length);for(let n=0;n<e.length;n++){const r=t[e[n]],a=r.properties||{};a.$layer=r.layer,a.$type=r.type;const h=s(i,a);delete a.$layer,delete a.$type,o[n]=255*h}r.aOpacity=o}return r}(t,a,h,S.featureIndexes),j={data:{data:{aPosition:S.vertices,aNormal:S.normals,aTexCoord0:S.uvs,aTangent:S.tangents,aPickingId:S.pickingIds},indices:O,properties:{maxAltitude:S.maxAltitude}},buffers:_};return S.featureIds.length?(j.data.featureIds=S.featureIds,_.push(j.data.featureIds.buffer)):j.data.featureIds=[],C.aColor&&(j.data.data.aColor=C.aColor,j.buffers.push(C.aColor.buffer)),C.aOpacity&&(j.data.data.aOpacity=C.aOpacity,j.buffers.push(C.aOpacity.buffer)),j}const Hr=[];function Vr(t,n,{altitudeScale:i,altitudeProperty:e,defaultAltitude:r,heightProperty:s,minHeightProperty:o,defaultHeight:a,bottom:h}){const u=h,l=n/t[0].extent,c=2*function(t,n){let i=0;for(let e=0,r=t.length;e<r;e++){const r=t[e];if(P(r.geometry[0][0])){const t=3*r.geometry.length;i+=n?2*t-6:t}else for(let t=0,e=r.geometry.length;t<e;t++){let e=3*r.geometry[t].length;3===r.type&&(e-=3),i+=n?2*e-6:e}}return i}(t)+3*t.length*2,f=[],d=new Int16Array(c),y=[];function v(t,i,e){const r=i-t,s=d.subarray(t,i),o=d.subarray(i,i+r);o.set(s);for(let t=2,n=o.length;t<n;t+=3)o[t]=s[t]-e;const a=t/3,h=r/3;let l,c;for(let t=a,i=h+a;t<i;t++)t<i-1?(l=t,c=t+1):(l=t,c=a),ct(d,l,c,n)||(y.push(l,c),u&&y.push(l+h,c+h),Rr(d,l,n)||y.push(l,l+h));return i+r}let p=0,m=0;const g="__fea_idx".trim();for(let n=0,h=t.length;n<h;n++){const h=t[n],u=h.geometry,{altitude:c,height:w}=Dr.getFeaAltitudeAndHeight(h,i,e,r,s,a,o);m=Math.max(Math.abs(c),m);let M=p;for(let t=0,n=u.length;t<n;t++){let n=u[t];const i=n.length;n[0][0]===n[i-1][0]&&n[0][1]===n[i-1][1]&&(n=n.slice(0,i-1)),p=lt(d,M,n,l,c),p=v(M,p,w*l),M=p}const b=y.length-f.length;for(let t=0;t<b;t++)f.push(h[g])}const w=new(T(y.reduce((t,n)=>Math.max(t,n),0)))(y),M=L(t.length);return{aPosition:new(U(Math.max(512,m)))(d),indices:w,aPickingId:new M(f)}}function Rr(t,n,i){const e=t[3*n],r=t[3*n+1];return e<0||e>i||r<0||r>i}function $r(t,n,i){const e=Vr(t,i,n),r=[e.aPosition.buffer,e.indices.buffer,e.aPickingId.buffer],s=e.indices;return delete e.indices,{data:{data:e,indices:s},buffers:r}}class Wr{constructor(t,n,i,e,r){this.id=t,this.options=n,this.upload=i,this.ht(n.style),this.requests={},this.ut=0,this.lt=e,this.loadings=r}updateStyle(t,n){this.options.style=t,this.ht(t),this.ut++,n()}updateOptions(t,n){this.options=A(this.options,t),n()}loadTile(t,n){const i=this.loadings,e=t.tileInfo.url,r=this.options.debugTile;if(r){const{x:i,y:e,z:s}=t.tileInfo;if(s!==r.z||i!==r.x||e!==r.y)return void n()}if(this.lt.has(e)){const{features:r,layers:s}=this.lt.get(e),o=i[e];if(delete i[e],!r||!r.length)return this.ct(o),void n();if(o)for(let n=0;n<o.length;n++)this.ft.call(o[n].ref,t,o[n].callback,e,s,r);this.ft(t,n,e,s,r)}else i[e]?i[e].push({callback:n,ref:this}):(i[e]=[{callback:n,ref:this}],this.requests[e]=this.getTileFeatures(t.tileInfo,(n,r,s,o)=>{const a=i[e];if(delete i[e],this.checkIfCanceled(e))return delete this.requests[e],void this.ct(a,null,{canceled:!0});if(delete this.requests[e],this.options.debug&&r)for(let n=0;n<r.length;n++)r[n]._debug_info={index:n,tileId:t.tileInfo.id};if(n)return n.loading||this.lt.add(e,{features:[],layers:[]}),void this.ct(a,n);if(!r||!r.length)return this.lt.add(e,{features:[],layers:[]}),void this.ct(a);if(this.lt.add(e,{features:r,layers:s}),a)for(let n=0;n<a.length;n++)this.ft.call(a[n].ref,t,a[n].callback,e,s,r,o)}))}ft(t,n,i,e,r,s){this.dt(e,r,t).then(t=>{t.canceled?n(null,{canceled:!0}):(t.data.style=this.ut,s&&A(t.data,s),n(null,t.data,t.buffers))}).catch(t=>{n(t)})}abortTile(t,n){delete this.requests[t],this.yt(t),n()}yt(t){const n=this.loadings[t];if(n)for(let t=0;t<n.length;t++)n[t].callback(null,{canceled:!0});delete this.loadings[t]}ct(t,n,i){if(t)for(let e=0;e<t.length;e++)t[e].callback(n,i)}checkIfCanceled(t){return!this.requests[t]}fetchIconGlyphs(t,n,i){this.upload("fetchIconGlyphs",{icons:t,glyphs:n},null,i)}dt(t,n,{glScale:i,zScale:e,tileInfo:r}){if(!n.length)return Promise.resolve({data:null,buffers:[]});const s=!this.options.style.style.length&&!this.options.style.featureStyle.length;let o=this.pluginConfig.slice(0);s&&(o=this.vt(t)),this.featurePlugins&&I(o,this.featurePlugins);const a=n[0].extent,h=r.z,u={x:r.extent2d.xmin*i,y:r.extent2d.ymax*i},l=[],c=[],f=[],d=this.options,y=[],v={},p=[Promise.resolve(this.ut)];let m=0,g=-1;for(let t=0;t<o.length;t++){g++;const r=o[t];r.type!==m&&(g=0,m=r.type);const d=0===r.type?l:c;if(r.symbol&&!1===r.symbol.visible){d[g]=null;continue}const{tileFeatures:w,tileFeaIndexes:M}=this.pt(r.type,r.filter,n,v,t);if(!w.length){d[g]=null;continue}const b=T(M[M.length-1]);d[g]={styledFeatures:new b(M)},f.push({idx:t,typeIdx:g}),y.push(d[g].styledFeatures.buffer);let x=this.gt(w,r,{extent:a,tilePoint:u,glScale:i,zScale:e,zoom:h});s&&(x=x.then(t=>{if(!t)return null;if(t.data)t.data.layer=w[0].layer;else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]&&t[n].data&&(t[n].data.layer=w[0].layer);return t})),p.push(x)}return Promise.all(p).then(([i,...e])=>{function r(t,n){if(void 0===t.data.ref&&(t.data.type=o[f[n].idx].renderPlugin.dataConfig.type,t.data.filter=o[f[n].idx].filter.def,t.buffers&&t.buffers.length))for(let n=0;n<t.buffers.length;n++)y.push(t.buffers[n])}if(i!==this.ut)return{canceled:!0};for(let t=0;t<e.length;t++){if(!e[t])continue;const n=e[t],i=0===o[f[t].idx].type?l:c;if(Array.isArray(n)){const e=[];for(let i=0;i<n.length;i++)n[i]&&(r(n[i],t),(void 0===n[i].data.ref||n[n[i].data.ref])&&e.push(n[i].data));e.length&&(i[f[t].typeIdx].data=e)}else r(n,t),i[f[t].typeIdx].data=n.data}const s={},h=t;if(d.features||d.schema){let t;for(let i=0,e=n.length;i<e;i++)if(t=n[i],h[t.layer].properties||(h[t.layer].properties=Gr(t.properties)),d.features&&t&&v[i])if("id"===d.features)s[i]=t.id;else{const n=A({},t);d.pickingGeometry||delete n.geometry,delete n.extent,delete n.properties.$layer,delete n.properties.$type,delete n.__index,s[i]=n}}return{data:{schema:h,data:l,featureData:c,extent:a,features:s},buffers:y}})}gt(t,n,i){const e=n.renderPlugin.dataConfig,r=n.symbol,s=this.options.tileSize[0],{extent:o,glScale:a,zScale:h,zoom:u,tilePoint:l}=i,c=o/s,f=e.type,d=this.options.debugTile&&this.options.debugTile.index;if("3d-extrusion"===f){const n=Jr(r);return n&&(e.uv=1,2===n&&(e.tangent=1)),Promise.all([Promise.resolve(Nr(t,e,o,l,a,h,this.options.tileSize[1]/o,r,u,d))])}if("3d-wireframe"===f)return Promise.all([Promise.resolve($r(t,e,o))]);if("point"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),zoom:u,debugIndex:d}),i=mr.splitPointSymbol(r);return mr.needMerge(i[0])&&(t=mr.mergeLineFeatures(t,i[0],u)),Promise.all(i.map(i=>new mr(t,i,n).load(c)))}if("native-point"===f){const n=A({},e,{EXTENT:o,zoom:u,debugIndex:d});return Xr(t,r,n,_r,o/s)}if("line"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),tileRatio:c,zoom:u,debugIndex:d});return Xr(t,r,n,Mr)}if("native-line"===f){const n=A({},e,{EXTENT:o,zoom:u,debugIndex:d});return Xr(t,r,n,Pr)}if("fill"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),zoom:u,debugIndex:d});return Xr(t,r,n,zr)}if("line-extrusion"===f){delete r.lineGradientProperty,r.lineJoin="miter",r.lineCap="butt";const n=Jr(r);n&&(e.uv=1,2===n&&(e.tangent=1));const i=A({},e,{EXTENT:o,tileSize:s,zScale:h,glScale:a,zoom:u,debugIndex:d});if(n){const n=[];if(!1!==e.top){const e=A({},i);e.side=!1,n.push(new Ar(t,r,e))}return!1!==e.side&&(i.side=!0,i.top=!1,n.push(new Ar(t,r,i))),Promise.all(n.map(t=>t.load()))}return Promise.all([new Ar(t,r,i).load()])}return Promise.resolve([])}pt(t,n,i,e){const r="__fea_idx".trim(),s=[],o=[],a=i.length;for(let h=0;h<a;h++)if((1===t||void 0===i[h].id||!this.styledFeatures[i[h].id])&&((!n.def||"default"===n.def)&&!e[h]||!0===n.def||Array.isArray(n.def)&&n(i[h]))){e[h]=1;const n=A({},i[h]);if(n[r]=h,o.push(n),s.push(h),1===t)break}return{tileFeatures:o,tileFeaIndexes:s}}ht(t){const{style:n,featureStyle:i}=t,e={};i.forEach(t=>{Array.isArray(t.id)?(t.id.forEach(t=>{e[t]=1}),t.filter=["in","$id",...t.id]):(e[t.id]=1,t.filter=["==","$id",t.id])});const r=z(n);for(let t=0;t<n.length;t++)r[t].filter&&(r[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0),r[t].type=0;const s=[],o=z(i);for(let t=0;t<i.length;t++)o[t].type=1,o[t].filter.def=i[t].filter?i[t].filter.value||i[t].filter:void 0,o[t].renderPlugin&&s.push(o[t]);this.pluginConfig=r,this.featurePlugins=s,this.styledFeatures=e}vt(t){let n=this.wt;this.wt||(n=this.wt={});const e=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],r=[];for(const s in t){const o=s;if(!n[s]){const r=[];for(let n=0;n<t[s].types.length;n++){const a=t[s].types[n],h=["all",["==","$layer",o],["==","$type",e[a]]],u={filter:i(h),renderPlugin:qr(a),symbol:Br(a)};u.filter.def=h,u.type=0,r.push(u)}n[o]=r}r.push(...n[o])}return r}}function qr(t){switch(t){case 1:return{type:"native-point",dataConfig:{type:"native-point",only2D:!0}};case 2:return{type:"native-line",dataConfig:{type:"native-line",only2D:!0}};case 3:return{type:"fill",dataConfig:{type:"fill",only2D:!0}}}return null}function Br(t){switch(t){case 1:return{markerFill:"#f00",markerSize:10};case 2:return{lineColor:"#fff"};case 3:return{polygonFill:"#00f",polygonOpacity:.4}}return null}function Gr(t){if(Array.isArray(t)||!_(t))return{};const n={};for(const i in t){const e=t[i];k(e)?n[i]="string":P(e)?n[i]="number":!0===e||!1===e?n[i]="boolean":Array.isArray(e)?n[i]="array":n[i]="object"}return n}function Jr(t){if(!t)return 0;let n=0;for(const i in t){if(("normalTexture"===i||"bumpTexture"===i)&&t[i])return 2;if(i.indexOf("Texture")>0&&t[i])n=1;else if(_(t[i])){const e=Jr(t[i]);if(2===e)return e;1===e&&(n=1)}}return n}function Xr(t,n,i,e,r){const s={},o=Array.isArray(n)?n:[n];let a=-1;for(let t=0;t<o.length;t++)s[t]=Zr(o[t]),!s[t]&&o[t]&&-1===a&&(a=t);const h=[];for(let n=0;n<o.length;n++)o[n]&&(o[n].index={index:n},s[n]||n===a?h.push(new e(t,o[n],i).load(r)):h.push({data:{ref:a,symbolIndex:{index:n}}}));return Promise.all(h)}function Zr(t){if(!t)return 0;for(const n in t)if(D(t[n]))return 1;return 0}function Yr(t,n){Kr(t.geometry,n)}function Kr(t,n){if(t)switch(t.type){case"Point":Qr(t.coordinates,n);break;case"MultiPoint":case"LineString":ts(t.coordinates,n);break;case"MultiLineString":case"Polygon":ns(t.coordinates,n);break;case"MultiPolygon":!function(t,n){for(let i=0;i<t.length;i++)ns(t[i],n)}(t.coordinates,n);break;case"GeometryCollection":for(let i=0;i<t.geometries.length;i++)Kr(t.geometries[i],n)}}function Qr(t,n){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function ts(t,n){for(let i=0;i<t.length;i++)Qr(t[i],n)}function ns(t,n){for(let i=0;i<t.length;i++)ts(t[i],n)}class is extends Wr{constructor(t,n,i,e,r,s){super(t,n,i,e,r),(n=n||{}).extent||(n.extent=8192),this.zoomOffset=0,n.tileSize&&(this.zoomOffset=-function(t){if(Math.log2)return Math.log2(t);const n=Math.log(t)*Math.LOG2E,i=Math.round(n);return Math.abs(i-n)<1e-14?i:n}(n.tileSize[0]/256)),this.setData(n.data,s)}setData(t,n){if(delete this.index,!t)return void n();const i={maxZoom:24,tolerance:this.options.extent/this.options.tileSize[0]*1,extent:this.options.extent,buffer:this.options.tileBuffer||64,debug:0,lineMetrics:!0,indexMaxZoom:5,indexMaxPoints:1e5};if(k(t)&&"{"!=t.substring(0,1)||t.url)C.getJSON(t.url?t.url:t,t.url?t:{},(t,e)=>{if(t&&n(t),!e)return void n(null,{extent:null,idMap:{}});const r=e,{first1000:s,idMap:o}=this.Mt(r);this.bt(s,o,r,i,n)});else{"string"==typeof t&&(t=JSON.parse(t));const e=Array.isArray(t)?t:t.features;let r=e;e&&e.length>1e3&&(r=e.slice(0,1e3)),this.bt(r,null,t,i,n)}}bt(t,n,i,e,r){try{const s=t&&t.length?function(t){let n=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];switch(t.type){case"FeatureCollection":for(let i=0;i<t.features.length;i++)Yr(t.features[i],n);break;case"Feature":Yr(t,n);break;default:Kr(t,n)}return n}({type:"FeatureCollection",features:t}):null;this.index=function(t,n){return new ht(t,n)}(i,this.options.geojsonvt||e),r(null,{extent:s,idMap:n})}catch(t){console.warn(t),r({error:t.message})}}Mt(t){const n=[],i={};let e=0;function r(t){t&&("Feature"!==t.type||t.geometry)&&(void 0!==t.id&&null!==t.id||(t.id=e++),i[t.id]=A({},t),t.geometry?(i[t.id].geometry=A({},t.geometry),i[t.id].geometry.coordinates=null):t.coordinates&&(i[t.id].coordinates=null),n.length<1e3&&n.push(t))}return Array.isArray(t)?t.forEach(t=>{r(t)}):t.features&&t.features.forEach(t=>{r(t)}),{first1000:n,idMap:i}}getTileFeatures(t,n){const i=[];if(!this.index)return setTimeout((function(){n({loading:!0})}),1),1;const e=this.index.getTile(t.z+this.zoomOffset,t.x,t.y);if(!e||0===e.features.length)return setTimeout((function(){n(null,i,[])}),1),1;const r=[];for(let t=0,n=e.features.length;t<n;t++){const n=e.features[t];let s=n.layer;void 0===s&&(s="0"),r[s]={types:{}};r[s].types[n.type]=1,n.tags=n.tags||{},i.push({type:n.type,layer:s,id:n.id,geometry:n.geometry,properties:n.tags,extent:this.options.extent})}for(const t in r)r[t].types=Object.keys(r[t].types).map(t=>+t);return setTimeout((function(){n(null,i,r)}),1),1}onRemove(){delete this.index}}var es={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,n,i,e,r){var s,o,a=8*r-e-1,h=(1<<a)-1,u=h>>1,l=-7,c=i?r-1:0,f=i?-1:1,d=t[n+c];for(c+=f,s=d&(1<<-l)-1,d>>=-l,l+=a;l>0;s=256*s+t[n+c],c+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=e;l>0;o=256*o+t[n+c],c+=f,l-=8);if(0===s)s=1-u;else{if(s===h)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,e),s-=u}return(d?-1:1)*o*Math.pow(2,s-e)},write:function(t,n,i,e,r,s){var o,a,h,u=8*s-r-1,l=(1<<u)-1,c=l>>1,f=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=e?0:s-1,y=e?1:-1,v=n<0||0===n&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(a=isNaN(n)?1:0,o=l):(o=Math.floor(Math.log(n)/Math.LN2),n*(h=Math.pow(2,-o))<1&&(o--,h*=2),(n+=o+c>=1?f/h:f*Math.pow(2,1-c))*h>=2&&(o++,h/=2),o+c>=l?(a=0,o=l):o+c>=1?(a=(n*h-1)*Math.pow(2,r),o+=c):(a=n*Math.pow(2,c-1)*Math.pow(2,r),o=0));r>=8;t[i+d]=255&a,d+=y,a/=256,r-=8);for(o=o<<r|a,u+=r;u>0;t[i+d]=255&o,d+=y,o/=256,u-=8);t[i+d-y]|=128*v}},rs=os,ss=es;function os(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}os.Varint=0,os.Fixed64=1,os.Bytes=2,os.Fixed32=5;var as="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function hs(t){return t.type===os.Bytes?t.readVarint()+t.pos:t.pos+1}function us(t,n,i){return i?4294967296*n+(t>>>0):4294967296*(n>>>0)+(t>>>0)}function ls(t,n,i){var e=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));i.realloc(e);for(var r=i.pos-1;r>=t;r--)i.buf[r+e]=i.buf[r]}function cs(t,n){for(var i=0;i<t.length;i++)n.writeVarint(t[i])}function fs(t,n){for(var i=0;i<t.length;i++)n.writeSVarint(t[i])}function ds(t,n){for(var i=0;i<t.length;i++)n.writeFloat(t[i])}function ys(t,n){for(var i=0;i<t.length;i++)n.writeDouble(t[i])}function vs(t,n){for(var i=0;i<t.length;i++)n.writeBoolean(t[i])}function ps(t,n){for(var i=0;i<t.length;i++)n.writeFixed32(t[i])}function ms(t,n){for(var i=0;i<t.length;i++)n.writeSFixed32(t[i])}function gs(t,n){for(var i=0;i<t.length;i++)n.writeFixed64(t[i])}function ws(t,n){for(var i=0;i<t.length;i++)n.writeSFixed64(t[i])}function Ms(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+16777216*t[n+3]}function bs(t,n,i){t[i]=n,t[i+1]=n>>>8,t[i+2]=n>>>16,t[i+3]=n>>>24}function xs(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+(t[n+3]<<24)}os.prototype={destroy:function(){this.buf=null},readFields:function(t,n,i){for(i=i||this.length;this.pos<i;){var e=this.readVarint(),r=e>>3,s=this.pos;this.type=7&e,t(r,n,this),this.pos===s&&this.skip(e)}return n},readMessage:function(t,n){return this.readFields(t,n,this.readVarint()+this.pos)},readFixed32:function(){var t=Ms(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=xs(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ms(this.buf,this.pos)+4294967296*Ms(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=Ms(this.buf,this.pos)+4294967296*xs(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=ss.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=ss.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var n,i,e=this.buf;return n=127&(i=e[this.pos++]),i<128?n:(n|=(127&(i=e[this.pos++]))<<7,i<128?n:(n|=(127&(i=e[this.pos++]))<<14,i<128?n:(n|=(127&(i=e[this.pos++]))<<21,i<128?n:function(t,n,i){var e,r,s=i.buf;if(r=s[i.pos++],e=(112&r)>>4,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<3,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<10,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<17,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<24,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(1&r)<<31,r<128)return us(t,e,n);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(i=e[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,n=this.pos;return this.pos=t,t-n>=12&&as?function(t,n,i){return as.decode(t.subarray(n,i))}(this.buf,n,t):function(t,n,i){var e="",r=n;for(;r<i;){var s,o,a,h=t[r],u=null,l=h>239?4:h>223?3:h>191?2:1;if(r+l>i)break;1===l?h<128&&(u=h):2===l?128==(192&(s=t[r+1]))&&(u=(31&h)<<6|63&s)<=127&&(u=null):3===l?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&((u=(15&h)<<12|(63&s)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===l&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&((u=(15&h)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,l=1):u>65535&&(u-=65536,e+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),e+=String.fromCharCode(u),r+=l}return e}(this.buf,n,t)},readBytes:function(){var t=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,t);return this.pos=t,n},readPackedVarint:function(t,n){if(this.type!==os.Bytes)return t.push(this.readVarint(n));var i=hs(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(n));return t},readPackedSVarint:function(t){if(this.type!==os.Bytes)return t.push(this.readSVarint());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==os.Bytes)return t.push(this.readBoolean());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==os.Bytes)return t.push(this.readFloat());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==os.Bytes)return t.push(this.readDouble());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==os.Bytes)return t.push(this.readFixed32());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==os.Bytes)return t.push(this.readSFixed32());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==os.Bytes)return t.push(this.readFixed64());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==os.Bytes)return t.push(this.readSFixed64());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed64());return t},skip:function(t){var n=7&t;if(n===os.Varint)for(;this.buf[this.pos++]>127;);else if(n===os.Bytes)this.pos=this.readVarint()+this.pos;else if(n===os.Fixed32)this.pos+=4;else{if(n!==os.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(t,n){this.writeVarint(t<<3|n)},realloc:function(t){for(var n=this.length||16;n<this.pos+t;)n*=2;if(n!==this.length){var i=new Uint8Array(n);i.set(this.buf),this.buf=i,this.length=n}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),bs(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),bs(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),bs(this.buf,-1&t,this.pos),bs(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),bs(this.buf,-1&t,this.pos),bs(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,n){var i,e;t>=0?(i=t%4294967296|0,e=t/4294967296|0):(e=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,e=e+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn\'t fit into 10 bytes");n.realloc(10),function(t,n,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,n),function(t,n){var i=(7&t)<<4;if(n.buf[n.pos++]|=i|((t>>>=3)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;n.buf[n.pos++]=127&t}(e,n)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var n=this.pos;this.pos=function(t,n,i){for(var e,r,s=0;s<n.length;s++){if((e=n.charCodeAt(s))>55295&&e<57344){if(!r){e>56319||s+1===n.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=e;continue}if(e<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=e;continue}e=r-55296<<10|e-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);e<128?t[i++]=e:(e<2048?t[i++]=e>>6|192:(e<65536?t[i++]=e>>12|224:(t[i++]=e>>18|240,t[i++]=e>>12&63|128),t[i++]=e>>6&63|128),t[i++]=63&e|128)}return i}(this.buf,t,this.pos);var i=this.pos-n;i>=128&&ls(n,i,this),this.pos=n-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),ss.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),ss.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var n=t.length;this.writeVarint(n),this.realloc(n);for(var i=0;i<n;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,n){this.pos++;var i=this.pos;t(n,this);var e=this.pos-i;e>=128&&ls(i,e,this),this.pos=i-1,this.writeVarint(e),this.pos+=e},writeMessage:function(t,n,i){this.writeTag(t,os.Bytes),this.writeRawMessage(n,i)},writePackedVarint:function(t,n){n.length&&this.writeMessage(t,cs,n)},writePackedSVarint:function(t,n){n.length&&this.writeMessage(t,fs,n)},writePackedBoolean:function(t,n){n.length&&this.writeMessage(t,vs,n)},writePackedFloat:function(t,n){n.length&&this.writeMessage(t,ds,n)},writePackedDouble:function(t,n){n.length&&this.writeMessage(t,ys,n)},writePackedFixed32:function(t,n){n.length&&this.writeMessage(t,ps,n)},writePackedSFixed32:function(t,n){n.length&&this.writeMessage(t,ms,n)},writePackedFixed64:function(t,n){n.length&&this.writeMessage(t,gs,n)},writePackedSFixed64:function(t,n){n.length&&this.writeMessage(t,ws,n)},writeBytesField:function(t,n){this.writeTag(t,os.Bytes),this.writeBytes(n)},writeFixed32Field:function(t,n){this.writeTag(t,os.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(t,n){this.writeTag(t,os.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(t,n){this.writeTag(t,os.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(t,n){this.writeTag(t,os.Fixed64),this.writeSFixed64(n)},writeVarintField:function(t,n){this.writeTag(t,os.Varint),this.writeVarint(n)},writeSVarintField:function(t,n){this.writeTag(t,os.Varint),this.writeSVarint(n)},writeStringField:function(t,n){this.writeTag(t,os.Bytes),this.writeString(n)},writeFloatField:function(t,n){this.writeTag(t,os.Fixed32),this.writeFloat(n)},writeDoubleField:function(t,n){this.writeTag(t,os.Fixed64),this.writeDouble(n)},writeBooleanField:function(t,n){this.writeVarintField(t,Boolean(n))}};var Fs=Ht,As=ks;function ks(t,n,i,e,r){this.properties={},this.extent=i,this.type=0,this.xt=t,this.Ft=-1,this.At=e,this.kt=r,t.readFields(Ps,this,n)}function Ps(t,n,i){1==t?n.id=i.readVarint():2==t?function(t,n){var i=t.readVarint()+t.pos;for(;t.pos<i;){var e=n.At[t.readVarint()],r=n.kt[t.readVarint()];n.properties[e]=r}}(i,n):3==t?n.type=i.readVarint():4==t&&(n.Ft=i.pos)}function Ss(t){for(var n,i,e=0,r=0,s=t.length,o=s-1;r<s;o=r++)n=t[r],e+=((i=t[o]).x-n.x)*(n.y+i.y);return e}ks.types=["Unknown","Point","LineString","Polygon"],ks.prototype.loadGeometry=function(){var t=this.xt;t.pos=this.Ft;for(var n,i=t.readVarint()+t.pos,e=1,r=0,s=0,o=0,a=[];t.pos<i;){if(r<=0){var h=t.readVarint();e=7&h,r=h>>3}if(r--,1===e||2===e)s+=t.readSVarint(),o+=t.readSVarint(),1===e&&(n&&a.push(n),n=[]),n.push(new Fs(s,o));else{if(7!==e)throw new Error("unknown command "+e);n&&n.push(n[0].clone())}}return n&&a.push(n),a},ks.prototype.bbox=function(){var t=this.xt;t.pos=this.Ft;for(var n=t.readVarint()+t.pos,i=1,e=0,r=0,s=0,o=1/0,a=-1/0,h=1/0,u=-1/0;t.pos<n;){if(e<=0){var l=t.readVarint();i=7&l,e=l>>3}if(e--,1===i||2===i)(r+=t.readSVarint())<o&&(o=r),r>a&&(a=r),(s+=t.readSVarint())<h&&(h=s),s>u&&(u=s);else if(7!==i)throw new Error("unknown command "+i)}return[o,h,a,u]},ks.prototype.toGeoJSON=function(t,n,i){var e,r,s=this.extent*Math.pow(2,i),o=this.extent*t,a=this.extent*n,h=this.loadGeometry(),u=ks.types[this.type];function l(t){for(var n=0;n<t.length;n++){var i=t[n],e=180-360*(i.y+a)/s;t[n]=[360*(i.x+o)/s-180,360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90]}}switch(this.type){case 1:var c=[];for(e=0;e<h.length;e++)c[e]=h[e][0];l(h=c);break;case 2:for(e=0;e<h.length;e++)l(h[e]);break;case 3:for(h=function(t){var n=t.length;if(n<=1)return[t];for(var i,e,r=[],s=0;s<n;s++){var o=Ss(t[s]);0!==o&&(void 0===e&&(e=o<0),e===o<0?(i&&r.push(i),i=[t[s]]):i.push(t[s]))}i&&r.push(i);return r}(h),e=0;e<h.length;e++)for(r=0;r<h[e].length;r++)l(h[e][r])}1===h.length?h=h[0]:u="Multi"+u;var f={type:"Feature",geometry:{type:u,coordinates:h},properties:this.properties};return"id"in this&&(f.id=this.id),f};var _s=As,Os=Is;function Is(t,n){this.version=1,this.name=null,this.extent=4096,this.length=0,this.xt=t,this.At=[],this.kt=[],this.Pt=[],t.readFields(Ts,this,n),this.length=this.Pt.length}function Ts(t,n,i){15===t?n.version=i.readVarint():1===t?n.name=i.readString():5===t?n.extent=i.readVarint():2===t?n.Pt.push(i.pos):3===t?n.At.push(i.readString()):4===t&&n.kt.push(function(t){var n=null,i=t.readVarint()+t.pos;for(;t.pos<i;){var e=t.readVarint()>>3;n=1===e?t.readString():2===e?t.readFloat():3===e?t.readDouble():4===e?t.readVarint64():5===e?t.readVarint():6===e?t.readSVarint():7===e?t.readBoolean():null}return n}(i))}Is.prototype.feature=function(t){if(t<0||t>=this.Pt.length)throw new Error("feature index out of bounds");this.xt.pos=this.Pt[t];var n=this.xt.readVarint()+this.xt.pos;return new _s(this.xt,n,this.extent,this.At,this.kt)};var Ls=Os;function Us(t,n,i){if(3===t){var e=new Ls(i,i.readVarint()+i.pos);e.length&&(n[e.name]=e)}}var zs=function(t,n){this.layers=t.readFields(Us,{},n)};class Ds extends Wr{constructor(t,n,i,e,r,s){super(t,n,i,e,r),n=n||{},s()}getTileFeatures(t,n){const i=t.url;return C.getArrayBuffer(i,(t,i)=>{if(t)return void n(t);const e=new zs(new rs(i.data)),r=[];if(!e.layers)return void n(null,r,[]);const s={};let o;for(const n in e.layers)if(a=e.layers,h=n,Object.prototype.hasOwnProperty.call(a,h)){s[n]={types:{}};const i=s[n].types;for(let s=0,a=e.layers[n].length;s<a;s++)try{o=e.layers[n].feature(s),i[o.type]=1,r.push({type:o.type,layer:n,geometry:o.loadGeometry(),properties:o.properties,extent:o.extent})}catch(t){console.warn("error when load vt geometry:",t)}}var a,h;for(const t in s)s[t].types=Object.keys(s[t].types).map(t=>+t);n(null,r,s,{byteLength:i.data.byteLength})})}abortTile(t,n){const i=this.requests[t];delete this.requests[t],i&&i.abort&&i.abort(),this.yt(t),n()}onRemove(){for(const t in this.requests)this.requests[t].abort();this.requests={}}}let Es=0;const Cs=new class{constructor(t){this.max=t,this.reset()}reset(){return this.data={},this.order=[],this}clear(){this.reset()}add(t,n){return this.has(t)?(this.order.splice(this.order.indexOf(t),1),this.data[t]=n,this.order.push(t)):(this.data[t]=n,this.order.push(t),this.order.length>this.max&&this.getAndRemove(this.order[0])),this}has(t){return t in this.data}keys(){return this.order}getAndRemove(t){if(!this.has(t))return null;const n=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),n}get(t){return this.has(t)?this.data[t]:null}remove(t){return this.has(t)?(delete this.data[t],this.order.splice(this.order.indexOf(t),1),this):this}setMaxSize(t){for(this.max=t;this.order.length>this.max;)this.getAndRemove(this.order[0]);return this}}(128),js={};class Ns{constructor(t){this.St={},this._t={},this.workerId=t}addLayer({actorId:t,mapId:n,layerId:i,params:e},r){if(this.Ot(n,i))return;const s=this.It(n,i),o=e.type,a=e.options,h=this.send.bind(this,t);this.St[s]="GeoJSONVectorTileLayer"===o?new is(i,a,h,Cs,js,r):new Ds(i,a,h,Cs,js,r)}removeLayer({mapId:t,layerId:n},i){const e=this.Ot(t,n),r=this.It(t,n);delete this.St[r],e&&(e.onRemove(i),this.Tt())}loadTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.loadTile(i,e)}abortTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.abortTile&&r.abortTile(i.url,e)}removeTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.removeTile(i,e)}updateStyle({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.updateStyle(i,e),this.Tt())}updateOptions({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.updateOptions(i,e),this.Tt())}setData({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.setData(i.data,e),this.Tt())}receive(t){const n=t.callback,i=this._t[n];delete this._t[n],i&&t.error?i(new Error(t.error)):i&&i(null,t.data)}send(t,n,i,e,r){const s=r?`${t}-${Es++}`:null;r&&(this._t[s]=r),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:n,params:i,callback:String(s)},e||[])}It(t,n){return`${t}-${n}`}Ot(t,n){const i=this.It(t,n);return this.St[i]}Tt(){const t=Object.keys(js);for(let n=0;n<t.length;n++)delete js[t[n]];Cs.reset()}}t.initialize=function(){},t.onmessage=function(t,n){const i=t.data;if(this.dispatcher||(this.dispatcher=new Ns(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const e=i.command;this.dispatcher[e]({actorId:t.actorId,mapId:i.mapId,layerId:i.layerId,params:i.params},(t,i,r)=>{t&&console.error(e,t),n(t,i,r)})}},Object.defineProperty(t,"Lt",{value:!0})}';
|
|
30
|
+
const H = 'function(t){\n/*!\n Feature Filter by\n\n (c) mapbox 2016 and maptalks 2018\n www.mapbox.com | www.maptalks.org\n License: MIT, header required.\n */\nconst n=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function i(t){return new Function("f","var p = (f && f.properties || {}); return "+e(t))}function e(t){if(!t)return"true";const n=t[0];if(t.length<=1)return"any"===n?"false":"true";return`(${"=="===n?s(t[1],t[2],"===",!1):"!="===n?s(t[1],t[2],"!==",!1):"<"===n||">"===n||"<="===n||">="===n?s(t[1],t[2],n,!0):"any"===n?o(t.slice(1),"||"):"all"===n?o(t.slice(1),"&&"):"none"===n?u(o(t.slice(1),"||")):"in"===n?a(t[1],t.slice(2)):"!in"===n?u(a(t[1],t.slice(2))):"has"===n?h(t[1]):"!has"===n?u(h(t[1])):"true"})`}function r(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function s(t,i,e,s){const o=r(t),a="$type"===t?n.indexOf(i):JSON.stringify(i);return(s?`typeof ${o}=== typeof ${a}&&`:"")+o+e+a}function o(t,n){return t.map(e).join(n)}function a(t,i){"$type"===t&&(i=i.map(t=>n.indexOf(t)));const e=JSON.stringify(i.sort(l)),s=r(t);return i.length<=200?`${e}.indexOf(${s}) !== -1`:`function(v, a, i, j) {\\n while (i <= j) { var m = (i + j) >> 1;\\n if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;\\n }\\n return false; }(${s}, ${e},0,${i.length-1})`}function h(t){return"$id"===t?\'"id" in f\':JSON.stringify(t)+" in p"}function u(t){return`!(${t})`}function l(t,n){return t<n?-1:t>n?1:0}function c(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];for(const n in i)t[n]=i[n]}return t}function f(t,n){for(let i=0;i<t.stops.length;i++)if(n===t.stops[i][0])return t.stops[i][1];return t.default}function d(t,n){for(var i=0;i<t.stops.length&&!(n<t.stops[i][0]);i++);return t.stops[Math.max(i-1,0)][1]}function y(t,n){for(var i=void 0!==t.base?t.base:1,e=0;!(e>=t.stops.length||n<=t.stops[e][0]);)e++;return 0===e?t.stops[e][1]:e===t.stops.length?t.stops[e-1][1]:function t(n,i,e,r,s,o){return"function"==typeof s?function(){var a=s.apply(void 0,arguments),h=o.apply(void 0,arguments);return t(n,i,e,r,a,h)}:s.length?function(t,n,i,e,r,s){var o=[];for(let a=0;a<r.length;a++)o[a]=p(t,n,i,e,r[a],s[a]);return o}(n,i,e,r,s,o):p(n,i,e,r,s,o)}(n,i,t.stops[e-1][0],t.stops[e][0],t.stops[e-1][1],t.stops[e][1])}function v(t,n){return function(t,n,i){return void 0!==t?t:void 0!==n?n:void 0!==i?i:null}(n,t.default)}function p(t,n,i,e,r,s){var o,a=e-i,h=t-i;return r*(1-(o=1===n?h/a:(Math.pow(n,h)-1)/(Math.pow(n,a)-1)))+s*o}function m(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type)}function g(t){return b(t,"exponential")}function w(t){return b(t,"interval")}function M(t,n){if(!t)return null;var i=!1;if(Array.isArray(t)){var e,r=[];for(let s=0;s<t.length;s++)(e=M(t[s],n))?(r.push(e),i=!0):r.push(t[s]);return i?r:t}var s,o={__fn_types_loaded:!0},a=[];for(s in t)t.hasOwnProperty(s)&&a.push(s);const h=function(t){Object.defineProperty(o,t,{get:function(){return this["__fn_"+t]||(this["__fn_"+t]=g(this["_"+t])),this["__fn_"+t].apply(this,n())},set:function(n){this["_"+t]=n},configurable:!0,enumerable:!0})};for(let n=0,e=a.length;n<e;n++)m(t[s=a[n]])?(i=!0,o["_"+s]=t[s],h(s)):o[s]=t[s];return i?o:t}function b(t,n){if(!m(t))return function(){return t};let i=!0,e=!0;const r=(t=JSON.parse(JSON.stringify(t))).stops;if(r)for(let t=0;t<r.length;t++)if(m(r[t][1])){const s=b(r[t][1],n);i=i&&s.isZoomConstant,e=e&&s.isFeatureConstant,r[t]=[r[t][0],s]}const s=function t(n,i){var e,r,s;if(m(n)){var o,a=n.stops&&"object"==typeof n.stops[0][0],h=a||void 0!==n.property,u=a||!h,l=n.type||i||"exponential";if("exponential"===l)o=y;else if("interval"===l)o=d;else if("categorical"===l)o=f;else{if("identity"!==l)throw new Error(\'Unknown function type "\'+l+\'"\');o=v}if(a){var c={},p=[];for(let t=0;t<n.stops.length;t++){var g=n.stops[t];void 0===c[g[0].zoom]&&(c[g[0].zoom]={zoom:g[0].zoom,type:n.type,property:n.property,default:n.default,stops:[]}),c[g[0].zoom].stops.push([g[0].value,g[1]])}for(let n in c)p.push([c[n].zoom,t(c[n])]);e=function(t,i){const e=y({stops:p,base:n.base},t)(t,i);return"function"==typeof e?e(t,i):e},r=!1,s=!1}else u?(e=function(t){const i=o(n,t);return"function"==typeof i?i(t):i},r=!0,s=!1):(e=function(t,i){const e=o(n,i?i[n.property]:null);return"function"==typeof e?e(t,i):e},r=!1,s=!0)}else e=function(){return n},r=!0,s=!0;return e.isZoomConstant=s,e.isFeatureConstant=r,e}(t,n);return s.isZoomConstant=i&&s.isZoomConstant,s.isFeatureConstant=e&&s.isFeatureConstant,s}let x=0;const F="function"==typeof Object.assign;function A(t,...n){if(F)return Object.assign(t,...n),t;for(let i=0;i<n.length;i++){const e=n[i];for(const n in e)t[n]=e[n]}return t}function k(t){return!O(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function P(t){return"number"==typeof t&&!isNaN(t)}function S(t){return!O(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function _(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function O(t){return null==t}function I(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];if(i)for(let n=0,e=i.length;n<e;n++)t.push(i[n])}return t.length}function T(t){return t<65536?Uint16Array:Uint32Array}function L(t){return t<256?Uint8Array:t<65536?Uint16Array:Uint32Array}function U(t){return(t=Math.abs(t))<128?Int8Array:t<32768?Int16Array:Float32Array}function z(t){return function t(n){if(!Array.isArray(n))return t([n]);const e=[];for(let t=0;t<n.length;t++){let r;r=!0===n[t].filter?function(){return!0}:i(n[t].filter),e.push(c({},n[t],{filter:r}))}return e}(t=t.map(t=>{const n=A({},t);return n.filter&&n.filter.value&&(n.filter=n.filter.value),n}))}function D(t){return m(t)&&t.property}const E="function"==typeof fetch&&"function"==typeof AbortController,C={jsonp:function(t,n){const i="_maptalks_jsonp_"+x++;t.match(/\\?/)?t+="&callback="+i:t+="?callback="+i;let e=document.createElement("script");return e.type="text/javascript",e.src=t,window[i]=function(t){n(null,t),document.getElementsByTagName("head")[0].removeChild(e),e=null,delete window[i]},document.getElementsByTagName("head")[0].appendChild(e),this},get:function(t,n,i){if(S(n)){const t=i;i=n,n=t}(n=n||{}).method&&(n.method=n.method.toUpperCase());const e="POST"===n.method;if(E){const r=new AbortController,s={signal:r.signal,method:n.method||"GET",referrerPolicy:"origin"};return e&&(O(n.body)||(s.body=JSON.stringify(n.body))),O(n.headers)||(s.headers=n.headers),O(n.credentials)||(s.credentials=n.credentials),fetch(t,s).then(t=>{const e=this.t(t,n.returnJSON,n.responseType);e.message?i(e):e.then(e=>{"arraybuffer"===n.responseType?i(null,{data:e,cacheControl:t.headers.get("Cache-Control"),expires:t.headers.get("Expires"),contentType:t.headers.get("Content-Type")}):i(null,e)}).catch(t=>{t.code&&t.code===DOMException.ABORT_ERR||(console.error(t),i(t))})}).catch(t=>{t.code&&t.code===DOMException.ABORT_ERR||(console.error(t),i(t))}),r}{const r=C.s(i);if(r.open(n.method||"GET",t,!0),n){for(const t in n.headers)r.setRequestHeader(t,n.headers[t]);r.withCredentials="include"===n.credentials,n.responseType&&(r.responseType=n.responseType)}return r.send(e?n.body:null),r}},t:(t,n,i)=>200!==t.status?{status:t.status,statusText:t.statusText,message:`incorrect http request with status code(${t.status}): ${t.statusText}`}:"arraybuffer"===i?t.arrayBuffer():n?t.json():t.text(),o:function(t,n){return function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?n({status:200,statusText:t.statusText,message:"http status 200 returned without content."}):n(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else n(null,t.responseText);else n({status:t.status,statusText:t.statusText,message:`incorrect http request with status code(${t.status}): ${t.statusText}`})}},s:function(t){let n;try{n=new XMLHttpRequest}catch(t){try{n=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{n=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}return n.onreadystatechange=C.o(n,t),n},getArrayBuffer(t,n,i){if(S(n)){const t=i;i=n,n=t}return n||(n={}),n.responseType="arraybuffer",C.get(t,n,i)}};function j(t,n,i,e,r,s){var o=r-i,a=s-e;if(0!==o||0!==a){var h=((t-i)*o+(n-e)*a)/(o*o+a*a);h>1?(i=r,e=s):h>0&&(i+=o*h,e+=a*h)}return(o=t-i)*o+(a=n-e)*a}function N(t,n,i,e){var r={id:void 0===t?null:t,type:n,geometry:i,tags:e,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var n=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)H(t,n);else if("Polygon"===i||"MultiLineString"===i)for(var e=0;e<n.length;e++)H(t,n[e]);else if("MultiPolygon"===i)for(e=0;e<n.length;e++)for(var r=0;r<n[e].length;r++)H(t,n[e][r])}(r),r}function H(t,n){for(var i=0;i<n.length;i+=3)t.minX=Math.min(t.minX,n[i]),t.minY=Math.min(t.minY,n[i+1]),t.maxX=Math.max(t.maxX,n[i]),t.maxY=Math.max(t.maxY,n[i+1])}function V(t,n,i,e){if(n.geometry){var r=n.geometry.coordinates,s=n.geometry.type,o=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),a=[],h=n.id;if(i.promoteId?h=n.properties[i.promoteId]:i.generateId&&(h=e||0),"Point"===s)R(r,a);else if("MultiPoint"===s)for(var u=0;u<r.length;u++)R(r[u],a);else if("LineString"===s)$(r,a,o,!1);else if("MultiLineString"===s){if(i.lineMetrics){for(u=0;u<r.length;u++)a=[],$(r[u],a,o,!1),t.push(N(h,"LineString",a,n.properties));return}W(r,a,o,!1)}else if("Polygon"===s)W(r,a,o,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<n.geometry.geometries.length;u++)V(t,{id:h,geometry:n.geometry.geometries[u],properties:n.properties},i,e);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<r.length;u++){var l=[];W(r[u],l,o,!0),a.push(l)}}t.push(N(h,s,a,n.properties))}}function R(t,n){n.push(q(t[0])),n.push(B(t[1])),n.push(0)}function $(t,n,i,e){for(var r,s,o=0,a=0;a<t.length;a++){var h=q(t[a][0]),u=B(t[a][1]);n.push(h),n.push(u),n.push(0),a>0&&(o+=e?(r*u-h*s)/2:Math.sqrt(Math.pow(h-r,2)+Math.pow(u-s,2))),r=h,s=u}var l=n.length-3;n[2]=1,function t(n,i,e,r){for(var s,o=r,a=e-i>>1,h=e-i,u=n[i],l=n[i+1],c=n[e],f=n[e+1],d=i+3;d<e;d+=3){var y=j(n[d],n[d+1],u,l,c,f);if(y>o)s=d,o=y;else if(y===o){var v=Math.abs(d-a);v<h&&(s=d,h=v)}}o>r&&(s-i>3&&t(n,i,s,r),n[s+2]=o,e-s>3&&t(n,s,e,r))}(n,0,l,i),n[l+2]=1,n.size=Math.abs(o),n.start=0,n.end=n.size}function W(t,n,i,e){for(var r=0;r<t.length;r++){var s=[];$(t[r],s,i,e),n.push(s)}}function q(t){return t/360+.5}function B(t){var n=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+n)/(1-n))/Math.PI;return i<0?0:i>1?1:i}function G(t,n,i,e,r,s,o,a){if(e/=n,s>=(i/=n)&&o<e)return t;if(o<i||s>=e)return null;for(var h=[],u=0;u<t.length;u++){var l=t[u],c=l.geometry,f=l.type,d=0===r?l.minX:l.minY,y=0===r?l.maxX:l.maxY;if(d>=i&&y<e)h.push(l);else if(!(y<i||d>=e)){var v=[];if("Point"===f||"MultiPoint"===f)J(c,v,i,e,r);else if("LineString"===f)X(c,v,i,e,r,!1,a.lineMetrics);else if("MultiLineString"===f)Y(c,v,i,e,r,!1);else if("Polygon"===f)Y(c,v,i,e,r,!0);else if("MultiPolygon"===f)for(var p=0;p<c.length;p++){var m=[];Y(c[p],m,i,e,r,!0),m.length&&v.push(m)}if(v.length){if(a.lineMetrics&&"LineString"===f){for(p=0;p<v.length;p++)h.push(N(l.id,f,v[p],l.tags));continue}"LineString"!==f&&"MultiLineString"!==f||(1===v.length?(f="LineString",v=v[0]):f="MultiLineString"),"Point"!==f&&"MultiPoint"!==f||(f=3===v.length?"Point":"MultiPoint"),h.push(N(l.id,f,v,l.tags))}}}return h.length?h:null}function J(t,n,i,e,r){for(var s=0;s<t.length;s+=3){var o=t[s+r];o>=i&&o<=e&&(n.push(t[s]),n.push(t[s+1]),n.push(t[s+2]))}}function X(t,n,i,e,r,s,o){for(var a,h,u=Z(t),l=0===r?Q:tt,c=t.start,f=0;f<t.length-3;f+=3){var d=t[f],y=t[f+1],v=t[f+2],p=t[f+3],m=t[f+4],g=0===r?d:y,w=0===r?p:m,M=!1;o&&(a=Math.sqrt(Math.pow(d-p,2)+Math.pow(y-m,2))),g<i?w>i&&(h=l(u,d,y,p,m,i),o&&(u.start=c+a*h)):g>e?w<e&&(h=l(u,d,y,p,m,e),o&&(u.start=c+a*h)):K(u,d,y,v),w<i&&g>=i&&(h=l(u,d,y,p,m,i),M=!0),w>e&&g<=e&&(h=l(u,d,y,p,m,e),M=!0),!s&&M&&(o&&(u.end=c+a*h),n.push(u),u=Z(t)),o&&(c+=a)}var b=t.length-3;d=t[b],y=t[b+1],v=t[b+2],(g=0===r?d:y)>=i&&g<=e&&K(u,d,y,v),b=u.length-3,s&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&K(u,u[0],u[1],u[2]),u.length&&n.push(u)}function Z(t){var n=[];return n.size=t.size,n.start=t.start,n.end=t.end,n}function Y(t,n,i,e,r,s){for(var o=0;o<t.length;o++)X(t[o],n,i,e,r,s,!1)}function K(t,n,i,e){t.push(n),t.push(i),t.push(e)}function Q(t,n,i,e,r,s){var o=(s-n)/(e-n);return t.push(s),t.push(i+(r-i)*o),t.push(1),o}function tt(t,n,i,e,r,s){var o=(s-i)/(r-i);return t.push(n+(e-n)*o),t.push(s),t.push(1),o}function nt(t,n){for(var i=[],e=0;e<t.length;e++){var r,s=t[e],o=s.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)r=it(s.geometry,n);else if("MultiLineString"===o||"Polygon"===o){r=[];for(var a=0;a<s.geometry.length;a++)r.push(it(s.geometry[a],n))}else if("MultiPolygon"===o)for(r=[],a=0;a<s.geometry.length;a++){for(var h=[],u=0;u<s.geometry[a].length;u++)h.push(it(s.geometry[a][u],n));r.push(h)}i.push(N(s.id,o,r,s.tags))}return i}function it(t,n){var i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);for(var e=0;e<t.length;e+=3)i.push(t[e]+n,t[e+1],t[e+2]);return i}function et(t,n){if(t.transformed)return t;var i,e,r,s=1<<t.z,o=t.x,a=t.y;for(i=0;i<t.features.length;i++){var h=t.features[i],u=h.geometry,l=h.type;if(h.geometry=[],1===l)for(e=0;e<u.length;e+=2)h.geometry.push(rt(u[e],u[e+1],n,s,o,a));else for(e=0;e<u.length;e++){var c=[];for(r=0;r<u[e].length;r+=2)c.push(rt(u[e][r],u[e][r+1],n,s,o,a));h.geometry.push(c)}}return t.transformed=!0,t}function rt(t,n,i,e,r,s){return[Math.round(i*(t*e-r)),Math.round(i*(n*e-s))]}function st(t,n,i,e,r){for(var s=n===r.maxZoom?0:r.tolerance/((1<<n)*r.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:e,z:n,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},a=0;a<t.length;a++){o.numFeatures++,ot(o,t[a],s,r);var h=t[a].minX,u=t[a].minY,l=t[a].maxX,c=t[a].maxY;h<o.minX&&(o.minX=h),u<o.minY&&(o.minY=u),l>o.maxX&&(o.maxX=l),c>o.maxY&&(o.maxY=c)}return o}function ot(t,n,i,e){var r=n.geometry,s=n.type,o=[];if("Point"===s||"MultiPoint"===s)for(var a=0;a<r.length;a+=3)o.push(r[a]),o.push(r[a+1]),t.numPoints++,t.numSimplified++;else if("LineString"===s)at(o,r,t,i,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(a=0;a<r.length;a++)at(o,r[a],t,i,"Polygon"===s,0===a);else if("MultiPolygon"===s)for(var h=0;h<r.length;h++){var u=r[h];for(a=0;a<u.length;a++)at(o,u[a],t,i,!0,0===a)}if(o.length){var l=n.tags||null;if("LineString"===s&&e.lineMetrics){for(var c in l={},n.tags)l[c]=n.tags[c];l.mapbox_clip_start=r.start/r.size,l.mapbox_clip_end=r.end/r.size}var f={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:l};null!==n.id&&(f.id=n.id),t.features.push(f)}}function at(t,n,i,e,r,s){var o=e*e;if(e>0&&n.size<(r?o:e))i.numPoints+=n.length/3;else{for(var a=[],h=0;h<n.length;h+=3)(0===e||n[h+2]>o)&&(i.numSimplified++,a.push(n[h]),a.push(n[h+1])),i.numPoints++;r&&function(t,n){for(var i=0,e=0,r=t.length,s=r-2;e<r;s=e,e+=2)i+=(t[e]-t[s])*(t[e+1]+t[s+1]);if(i>0===n)for(e=0,r=t.length;e<r/2;e+=2){var o=t[e],a=t[e+1];t[e]=t[r-2-e],t[e+1]=t[r-1-e],t[r-2-e]=o,t[r-1-e]=a}}(a,s),t.push(a)}}function ht(t,n){var i=(n=this.options=function(t,n){for(var i in n)t[i]=n[i];return t}(Object.create(this.options),n)).debug;if(i&&console.time("preprocess data"),n.maxZoom<0||n.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(n.promoteId&&n.generateId)throw new Error("promoteId and generateId cannot be used together.");var e=function(t,n){var i=[];if("FeatureCollection"===t.type)for(var e=0;e<t.features.length;e++)V(i,t.features[e],n,e);else"Feature"===t.type?V(i,t,n):V(i,{geometry:t},n);return i}(t,n);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",n.indexMaxZoom,n.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(e=function(t,n){var i=n.buffer/n.extent,e=t,r=G(t,1,-1-i,i,0,-1,2,n),s=G(t,1,1-i,2+i,0,-1,2,n);return(r||s)&&(e=G(t,1,-i,1+i,0,-1,2,n)||[],r&&(e=nt(r,1).concat(e)),s&&(e=e.concat(nt(s,-1)))),e}(e,n)).length&&this.splitTile(e,0,0,0),i&&(e.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function ut(t,n,i){return 32*((1<<t)*i+n)+t}function lt(t,n,i,e,r,s){const o=i&&Array.isArray(i[0]);for(let a=0,h=i.length;a<h;a++){t[n]=Math.round((o?i[a][0]:i[a].x)*e),t[n+1]=Math.round((o?i[a][1]:i[a].y)*e);let u=r||0;Array.isArray(r)&&(u=r[a]),u=u?Math.round(e*u):0,t[n+2]=u,n+=3,s&&0!==a&&a!==h-1&&(t[n]=t[n-3],t[n+1]=t[n-2],t[n+2]=t[n-1],n+=3)}return n}function ct(t,n,i,e){const r=t[3*n],s=t[3*n+1],o=t[3*i],a=t[3*i+1];return r===o&&(r<0||r>e)||s===a&&(s<0||s>e)}C.getJSON=function(t,n,i){if(S(n)){const t=i;i=n,n=t}const e=function(t,n){const e="string"==typeof n?JSON.parse(n):n||null;i(t,e)};return n&&n.jsonp?C.jsonp(t,e):((n=n||{}).returnJSON=!0,C.get(t,n,e))},ht.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ht.prototype.splitTile=function(t,n,i,e,r,s,o){for(var a=[t,n,i,e],h=this.options,u=h.debug;a.length;){e=a.pop(),i=a.pop(),n=a.pop(),t=a.pop();var l=1<<n,c=ut(n,i,e),f=this.tiles[c];if(!f&&(u>1&&console.time("creation"),f=this.tiles[c]=st(t,n,i,e,h),this.tileCoords.push({z:n,x:i,y:e}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,i,e,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var d="z"+n;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(f.source=t,r){if(n===h.maxZoom||n===r)continue;var y=1<<r-n;if(i!==Math.floor(s/y)||e!==Math.floor(o/y))continue}else if(n===h.indexMaxZoom||f.numPoints<=h.indexMaxPoints)continue;if(f.source=null,0!==t.length){u>1&&console.time("clipping");var v,p,m,g,w,M,b=.5*h.buffer/h.extent,x=.5-b,F=.5+b,A=1+b;v=p=m=g=null,w=G(t,l,i-b,i+F,0,f.minX,f.maxX,h),M=G(t,l,i+x,i+A,0,f.minX,f.maxX,h),t=null,w&&(v=G(w,l,e-b,e+F,1,f.minY,f.maxY,h),p=G(w,l,e+x,e+A,1,f.minY,f.maxY,h),w=null),M&&(m=G(M,l,e-b,e+F,1,f.minY,f.maxY,h),g=G(M,l,e+x,e+A,1,f.minY,f.maxY,h),M=null),u>1&&console.timeEnd("clipping"),a.push(v||[],n+1,2*i,2*e),a.push(p||[],n+1,2*i,2*e+1),a.push(m||[],n+1,2*i+1,2*e),a.push(g||[],n+1,2*i+1,2*e+1)}}},ht.prototype.getTile=function(t,n,i){var e=this.options,r=e.extent,s=e.debug;if(t<0||t>24)return null;var o=1<<t,a=ut(t,n=(n%o+o)%o,i);if(this.tiles[a])return et(this.tiles[a],r);s>1&&console.log("drilling down to z%d-%d-%d",t,n,i);for(var h,u=t,l=n,c=i;!h&&u>0;)u--,l=Math.floor(l/2),c=Math.floor(c/2),h=this.tiles[ut(u,l,c)];return h&&h.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,l,c),s>1&&console.time("drilling down"),this.splitTile(h.source,u,l,c,t,n,i),s>1&&console.timeEnd("drilling down"),this.tiles[a]?et(this.tiles[a],r):null):null};class ft{constructor(t,n){this.x=t,this.y=n}clone(){return new ft(this.x,this.y)}normalize(){const t=this.length();this.x/=t,this.y/=t}negate(){this.x=-this.x,this.y=-this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}diff(t){return new ft(this.x-t.x,this.y-t.y)}distance(t){const n=this.x-t.x,i=this.y-t.y;return Math.sqrt(n*n+i*i)}dot(t){return this.x*t.x+this.y*t.y}equals(t){return this.x===t.x&&this.y===t.y}orthogonal(){return new ft(this.y,-this.x)}}function dt(t,n,i){const e=(n.x-t.x)*(i.y-t.y)-(n.y-t.y)*(i.x-t.x);return e>1e-5?1:e<-1e-5?2:0}function yt(t,n,i,e){const r=n.x*e.y-n.y*e.x,s=i.x-t.x,o=i.y-t.y,a=(s*e.y-o*e.x)/r;return new ft(t.x+a*n.x,t.y+a*n.y)}const vt=[];function pt(t,n,i){let e=0;const r=[];for(let s=n;s<i;s+=3)vt[e]?(vt[e].x=t[s],vt[e].y=t[s+1]):vt[e]=new ft(t[s],t[s+1]),r.push(vt[e]),e++;const s=function(t){let n;this.UpdateOmbb=function(t,i,e,r,s,o,a,h){const u=yt(t,i,s,o),l=yt(e,r,s,o),c=yt(a,h,t,i),f=yt(a,h,e,r),d=u.distance(l)*u.distance(c);d<this.BestObbArea&&(n=[u,c,f,l],this.BestObbArea=d)},this.BestObbArea=Number.MAX_VALUE;const i=[];for(let n=0;n<t.length;n++)i.push(t[(n+1)%t.length].diff(t[n])),i[n].normalize();const e=new ft(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),r=new ft(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let s,o,a,h;for(let n=0;n<t.length;n++){const i=t[n];i.x<e.x&&(e.x=i.x,s=n),i.x>r.x&&(r.x=i.x,o=n),i.y<e.y&&(e.y=i.y,h=n),i.y>r.y&&(r.y=i.y,a=n)}let u=new ft(0,-1),l=new ft(0,1),c=new ft(-1,0),f=new ft(1,0);for(let n=0;n<t.length;n++){const n=[Math.acos(u.dot(i[s])),Math.acos(l.dot(i[o])),Math.acos(c.dot(i[a])),Math.acos(f.dot(i[h]))];switch(n.indexOf(Math.min.apply(Math,n))){case 0:u=i[s].clone(),l=u.clone(),l.negate(),c=u.orthogonal(),f=c.clone(),f.negate(),s=(s+1)%t.length;break;case 1:l=i[o].clone(),u=l.clone(),u.negate(),c=u.orthogonal(),f=c.clone(),f.negate(),o=(o+1)%t.length;break;case 2:c=i[a].clone(),f=c.clone(),f.negate(),u=f.orthogonal(),l=u.clone(),l.negate(),a=(a+1)%t.length;break;case 3:f=i[h].clone(),c=f.clone(),c.negate(),u=f.orthogonal(),l=u.clone(),l.negate(),h=(h+1)%t.length}this.UpdateOmbb(t[s],u,t[o],l,t[a],c,t[h],f)}return n}(function(t){if(t.length<3)return t;let n=t[0];const i=[];for(let i=1;i<t.length;i++)(t[i].x<n.x||Math.abs(t[i].x-n.x)<1e-5&&t[i].y<n.y)&&(n=t[i]);let e=t[0];do{i.unshift(n.clone());for(let i=1;i<t.length;i++){const r=dt(n,e,t[i]);(e.equals(n)||1===r||0===r&&n.distance(t[i])>n.distance(e))&&(e=t[i])}n=e}while(!e.equals(i[i.length-1]));return i}(r)),o=s[0].distance(s[1]),a=s[1].distance(s[2]),h=s.map(t=>[t.x,t.y]);return h.push(+(a>o)),h}var mt="undefined"!=typeof Float32Array?Float32Array:Array;function gt(){var t=new mt(3);return mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function wt(t,n,i){var e=new mt(3);return e[0]=t,e[1]=n,e[2]=i,e}function Mt(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function bt(t,n,i,e){return t[0]=n,t[1]=i,t[2]=e,t}function xt(t,n,i){return t[0]=n[0]+i[0],t[1]=n[1]+i[1],t[2]=n[2]+i[2],t}function Ft(t,n,i){return t[0]=n[0]/i[0],t[1]=n[1]/i[1],t[2]=n[2]/i[2],t}function At(t,n){var i=n[0],e=n[1],r=n[2],s=i*i+e*e+r*r;return s>0&&(s=1/Math.sqrt(s),t[0]=n[0]*s,t[1]=n[1]*s,t[2]=n[2]*s),t}function kt(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Pt(t,n,i){var e=n[0],r=n[1],s=n[2],o=i[0],a=i[1],h=i[2];return t[0]=r*h-s*a,t[1]=s*o-e*h,t[2]=e*a-r*o,t}var St=function(t,n,i){return t[0]=n[0]-i[0],t[1]=n[1]-i[1],t[2]=n[2]-i[2],t};function _t(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function Ot(t,n,i,e,r){return t[0]=n,t[1]=i,t[2]=e,t[3]=r,t}function It(){var t=new mt(4);return mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Tt(t,n){var i=n[0]+n[4]+n[8],e=void 0;if(i>0)e=Math.sqrt(i+1),t[3]=.5*e,e=.5/e,t[0]=(n[5]-n[7])*e,t[1]=(n[6]-n[2])*e,t[2]=(n[1]-n[3])*e;else{var r=0;n[4]>n[0]&&(r=1),n[8]>n[3*r+r]&&(r=2);var s=(r+1)%3,o=(r+2)%3;e=Math.sqrt(n[3*r+r]-n[3*s+s]-n[3*o+o]+1),t[r]=.5*e,e=.5/e,t[3]=(n[3*s+o]-n[3*o+s])*e,t[s]=(n[3*s+r]+n[3*r+s])*e,t[o]=(n[3*o+r]+n[3*r+o])*e}return t}gt(),function(){var t,n=(t=new mt(4),mt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var Lt,Ut=function(t,n,i){return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=n[3]*i,t},zt=function(t,n){var i=n[0],e=n[1],r=n[2],s=n[3],o=i*i+e*e+r*r+s*s;return o>0&&(o=1/Math.sqrt(o),t[0]=i*o,t[1]=e*o,t[2]=r*o,t[3]=s*o),t};function Dt(t,n){var i=n[0]-t[0],e=n[1]-t[1];return Math.sqrt(i*i+e*e)}function Et(t,n,i,e,r,s,o,a,h,u){0===t?function(t,n,i,e,r,s,o,a,h){const u=[0,0];for(let r=t;r<n;r+=3){const t=r/3*2,n=e[r],l=e[r+1];i[t]=u[0]+n*s*o/a,i[t+1]=u[1]-l*s*o/h}}(n,i,e,r,0,o,a,h,u):1===t&&function(t,n,i,e){const r=pt(e,t,n),s=r[4],o=r[s],a=r[s+1],h=r[s+2],u=(a[1]-o[1])/(a[0]-o[0]),l=(h[1]-a[1])/(h[0]-a[0]),c=Dt(o,a),f=Dt(a,h);for(let r=t;r<n;r+=3){const t=r/3*2,n=e[r],s=e[r+1];i[t]=jt(n,s,o,u,c),i[t+1]=-jt(n,s,a,l,f)}}(n,i,e,r)}gt(),wt(1,0,0),wt(0,1,0),It(),It(),Lt=new mt(9),mt!=Float32Array&&(Lt[1]=0,Lt[2]=0,Lt[3]=0,Lt[5]=0,Lt[6]=0,Lt[7]=0),Lt[0]=1,Lt[4]=1,Lt[8]=1,function(){var t=function(){var t=new mt(2);return mt!=Float32Array&&(t[0]=0,t[1]=0),t}()}();const Ct=[];function jt(t,n,i,e,r){return Ct[0]=(e*e*i[0]+e*(n-i[1])+t)/(e*e+1),Ct[1]=e*(Ct[0]-i[0])+i[1],Dt(i,Ct)/r}function Nt(t,n,i,e,r){const s=3*n[i-1],o=3*n[i-1]+1,a=t[s],h=t[o];return u=e,l=r,c=a,f=h,Math.sqrt((c-u)*(c-u)+(f-l)*(f-l));var u,l,c,f}"undefined"!=typeof undefinedThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof undefined?global:"undefined"!=typeof self&&self;var Ht=Vt;function Vt(t,n){this.x=t,this.y=n}function Rt(t,n,i){i=i||{},this.w=t||64,this.h=n||64,this.autoResize=!!i.autoResize,this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0}function $t(t,n,i){this.x=0,this.y=t,this.w=this.free=n,this.h=i}function Wt(t,n,i,e,r,s,o){this.id=t,this.x=n,this.y=i,this.w=e,this.h=r,this.maxw=s||e,this.maxh=o||r,this.refcount=0}Vt.prototype={clone:function(){return new Vt(this.x,this.y)},add:function(t){return this.clone().u(t)},sub:function(t){return this.clone().v(t)},multByPoint:function(t){return this.clone().m(t)},divByPoint:function(t){return this.clone().M(t)},mult:function(t){return this.clone().F(t)},div:function(t){return this.clone().A(t)},rotate:function(t){return this.clone().k(t)},rotateAround:function(t,n){return this.clone().P(t,n)},matMult:function(t){return this.clone().S(t)},unit:function(){return this.clone()._()},perp:function(){return this.clone().O()},round:function(){return this.clone().I()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var n=t.x-this.x,i=t.y-this.y;return n*n+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},S:function(t){var n=t[0]*this.x+t[1]*this.y,i=t[2]*this.x+t[3]*this.y;return this.x=n,this.y=i,this},u:function(t){return this.x+=t.x,this.y+=t.y,this},v:function(t){return this.x-=t.x,this.y-=t.y,this},F:function(t){return this.x*=t,this.y*=t,this},A:function(t){return this.x/=t,this.y/=t,this},m:function(t){return this.x*=t.x,this.y*=t.y,this},M:function(t){return this.x/=t.x,this.y/=t.y,this},_:function(){return this.A(this.mag()),this},O:function(){var t=this.y;return this.y=this.x,this.x=-t,this},k:function(t){var n=Math.cos(t),i=Math.sin(t),e=n*this.x-i*this.y,r=i*this.x+n*this.y;return this.x=e,this.y=r,this},P:function(t,n){var i=Math.cos(t),e=Math.sin(t),r=n.x+i*(this.x-n.x)-e*(this.y-n.y),s=n.y+e*(this.x-n.x)+i*(this.y-n.y);return this.x=r,this.y=s,this},I:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Vt.convert=function(t){return t instanceof Vt?t:Array.isArray(t)?new Vt(t[0],t[1]):t},Rt.prototype.pack=function(t,n){t=[].concat(t),n=n||{};for(var i,e,r,s,o=[],a=0;a<t.length;a++)if(i=t[a].w||t[a].width,e=t[a].h||t[a].height,r=t[a].id,i&&e){if(!(s=this.packOne(i,e,r)))continue;n.inPlace&&(t[a].x=s.x,t[a].y=s.y,t[a].id=s.id),o.push(s)}return this.shrink(),o},Rt.prototype.packOne=function(t,n,i){var e,r,s,o,a,h,u,l,c={freebin:-1,shelf:-1,waste:1/0},f=0;if("string"==typeof i||"number"==typeof i){if(e=this.getBin(i))return this.ref(e),e;"number"==typeof i&&(this.maxId=Math.max(i,this.maxId))}else i=++this.maxId;for(o=0;o<this.freebins.length;o++){if(n===(e=this.freebins[o]).maxh&&t===e.maxw)return this.allocFreebin(o,t,n,i);n>e.maxh||t>e.maxw||n<=e.maxh&&t<=e.maxw&&(s=e.maxw*e.maxh-t*n)<c.waste&&(c.waste=s,c.freebin=o)}for(o=0;o<this.shelves.length;o++)if(f+=(r=this.shelves[o]).h,!(t>r.free)){if(n===r.h)return this.allocShelf(o,t,n,i);n>r.h||n<r.h&&(s=(r.h-n)*t)<c.waste&&(c.freebin=-1,c.waste=s,c.shelf=o)}return-1!==c.freebin?this.allocFreebin(c.freebin,t,n,i):-1!==c.shelf?this.allocShelf(c.shelf,t,n,i):n<=this.h-f&&t<=this.w?(r=new $t(f,this.w,n),this.allocShelf(this.shelves.push(r)-1,t,n,i)):this.autoResize?(a=h=this.h,((u=l=this.w)<=a||t>u)&&(l=2*Math.max(t,u)),(a<u||n>a)&&(h=2*Math.max(n,a)),this.resize(l,h),this.packOne(t,n,i)):null},Rt.prototype.allocFreebin=function(t,n,i,e){var r=this.freebins.splice(t,1)[0];return r.id=e,r.w=n,r.h=i,r.refcount=0,this.bins[e]=r,this.ref(r),r},Rt.prototype.allocShelf=function(t,n,i,e){var r=this.shelves[t].alloc(n,i,e);return this.bins[e]=r,this.ref(r),r},Rt.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,n=0,i=0;i<this.shelves.length;i++){var e=this.shelves[i];n+=e.h,t=Math.max(e.w-e.free,t)}this.resize(t,n)}},Rt.prototype.getBin=function(t){return this.bins[t]},Rt.prototype.ref=function(t){if(1==++t.refcount){var n=t.h;this.stats[n]=1+(0|this.stats[n])}return t.refcount},Rt.prototype.unref=function(t){return 0===t.refcount?0:(0==--t.refcount&&(this.stats[t.h]--,delete this.bins[t.id],this.freebins.push(t)),t.refcount)},Rt.prototype.clear=function(){this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0},Rt.prototype.resize=function(t,n){this.w=t,this.h=n;for(var i=0;i<this.shelves.length;i++)this.shelves[i].resize(t);return!0},$t.prototype.alloc=function(t,n,i){if(t>this.free||n>this.h)return null;var e=this.x;return this.x+=t,this.free-=t,new Wt(i,e,this.y,t,n,t,this.h)},$t.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0};var qt={exports:{}};qt.exports=function(){function t(t,n,i){var e=t[n];t[n]=t[i],t[i]=e}function n(t,n){return t<n?-1:t>n?1:0}return function(i,e,r,s,o){!function n(i,e,r,s,o){for(;s>r;){if(s-r>600){var a=s-r+1,h=e-r+1,u=Math.log(a),l=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*l*(a-l)/a)*(h-a/2<0?-1:1),f=Math.max(r,Math.floor(e-h*l/a+c)),d=Math.min(s,Math.floor(e+(a-h)*l/a+c));n(i,e,f,d,o)}var y=i[e],v=r,p=s;for(t(i,r,e),o(i[s],y)>0&&t(i,r,s);v<p;){for(t(i,v,p),v++,p--;o(i[v],y)<0;)v++;for(;o(i[p],y)>0;)p--}0===o(i[r],y)?t(i,r,p):(p++,t(i,p,s)),p<=e&&(r=p+1),e<=p&&(s=p-1)}}(i,e,r||0,s||i.length-1,o||n)}}();var Bt=qt.exports,Gt={exports:{}};function Jt(t,n){if(!(this instanceof Jt))return new Jt(t,n);if(this.data=t||[],this.length=this.data.length,this.compare=n||Xt,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this.T(i)}function Xt(t,n){return t<n?-1:t>n?1:0}Gt.exports=Jt,Gt.exports.default=Jt,Jt.prototype={push:function(t){this.data.push(t),this.length++,this.L(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this.T(0)),this.data.pop(),t}},peek:function(){return this.data[0]},L:function(t){for(var n=this.data,i=this.compare,e=n[t];t>0;){var r=t-1>>1,s=n[r];if(i(e,s)>=0)break;n[t]=s,t=r}n[t]=e},T:function(t){for(var n=this.data,i=this.compare,e=this.length>>1,r=n[t];t<e;){var s=1+(t<<1),o=s+1,a=n[s];if(o<this.length&&i(n[o],a)<0&&(s=o,a=n[o]),i(a,r)>=0)break;n[t]=a,t=s}n[t]=r}};var Zt=Gt.exports,Yt={exports:{}},Kt={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]},Qt={exports:{}},tn=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},nn=Array.prototype.concat,en=Array.prototype.slice,rn=Qt.exports=function(t){for(var n=[],i=0,e=t.length;i<e;i++){var r=t[i];tn(r)?n=nn.call(n,en.call(r)):n.push(r)}return n};rn.wrap=function(t){return function(){return t(rn(arguments))}};var sn=Kt,on=Qt.exports,an=Object.hasOwnProperty,hn={};for(var un in sn)an.call(sn,un)&&(hn[sn[un]]=un);var ln=Yt.exports={to:{},get:{}};function cn(t,n,i){return Math.min(Math.max(n,t),i)}function fn(t){var n=Math.round(t).toString(16).toUpperCase();return n.length<2?"0"+n:n}ln.get=function(t){var n,i;switch(t.substring(0,3).toLowerCase()){case"hsl":n=ln.get.hsl(t),i="hsl";break;case"hwb":n=ln.get.hwb(t),i="hwb";break;default:n=ln.get.rgb(t),i="rgb"}return n?{model:i,value:n}:null},ln.get.rgb=function(t){if(!t)return null;var n,i,e,r=[0,0,0,1];if(n=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(e=n[2],n=n[1],i=0;i<3;i++){var s=2*i;r[i]=parseInt(n.slice(s,s+2),16)}e&&(r[3]=parseInt(e,16)/255)}else if(n=t.match(/^#([a-f0-9]{3,4})$/i)){for(e=(n=n[1])[3],i=0;i<3;i++)r[i]=parseInt(n[i]+n[i],16);e&&(r[3]=parseInt(e+e,16)/255)}else if(n=t.match(/^rgba?\\(\\s*([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/)){for(i=0;i<3;i++)r[i]=parseInt(n[i+1],0);n[4]&&(n[5]?r[3]=.01*parseFloat(n[4]):r[3]=parseFloat(n[4]))}else{if(!(n=t.match(/^rgba?\\(\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*,?\\s*([+-]?[\\d\\.]+)\\%\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/)))return(n=t.match(/^(\\w+)$/))?"transparent"===n[1]?[0,0,0,0]:an.call(sn,n[1])?((r=sn[n[1]])[3]=1,r):null:null;for(i=0;i<3;i++)r[i]=Math.round(2.55*parseFloat(n[i+1]));n[4]&&(n[5]?r[3]=.01*parseFloat(n[4]):r[3]=parseFloat(n[4]))}for(i=0;i<3;i++)r[i]=cn(r[i],0,255);return r[3]=cn(r[3],0,1),r},ln.get.hsl=function(t){if(!t)return null;var n=t.match(/^hsla?\\(\\s*([+-]?(?:\\d{0,3}\\.)?\\d+)(?:deg)?\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*,?\\s*([+-]?[\\d\\.]+)%\\s*(?:[,|\\/]\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/);if(n){var i=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,cn(parseFloat(n[2]),0,100),cn(parseFloat(n[3]),0,100),cn(isNaN(i)?1:i,0,1)]}return null},ln.get.hwb=function(t){if(!t)return null;var n=t.match(/^hwb\\(\\s*([+-]?\\d{0,3}(?:\\.\\d+)?)(?:deg)?\\s*,\\s*([+-]?[\\d\\.]+)%\\s*,\\s*([+-]?[\\d\\.]+)%\\s*(?:,\\s*([+-]?(?=\\.\\d|\\d)(?:0|[1-9]\\d*)?(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)\\s*)?\\)$/);if(n){var i=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,cn(parseFloat(n[2]),0,100),cn(parseFloat(n[3]),0,100),cn(isNaN(i)?1:i,0,1)]}return null},ln.to.hex=function(){var t=on(arguments);return"#"+fn(t[0])+fn(t[1])+fn(t[2])+(t[3]<1?fn(Math.round(255*t[3])):"")},ln.to.rgb=function(){var t=on(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},ln.to.rgb.percent=function(){var t=on(arguments),n=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),e=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+n+"%, "+i+"%, "+e+"%)":"rgba("+n+"%, "+i+"%, "+e+"%, "+t[3]+")"},ln.to.hsl=function(){var t=on(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},ln.to.hwb=function(){var t=on(arguments),n="";return t.length>=4&&1!==t[3]&&(n=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+n+")"},ln.to.keyword=function(t){return hn[t.slice(0,3)]};var dn={exports:{}},yn=Kt,vn={};for(var pn in yn)yn.hasOwnProperty(pn)&&(vn[yn[pn]]=pn);var mn=dn.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var gn in mn)if(mn.hasOwnProperty(gn)){if(!("channels"in mn[gn]))throw new Error("missing channels property: "+gn);if(!("labels"in mn[gn]))throw new Error("missing channel labels property: "+gn);if(mn[gn].labels.length!==mn[gn].channels)throw new Error("channel and label counts mismatch: "+gn);var wn=mn[gn].channels,Mn=mn[gn].labels;delete mn[gn].channels,delete mn[gn].labels,Object.defineProperty(mn[gn],"channels",{value:wn}),Object.defineProperty(mn[gn],"labels",{value:Mn})}function bn(t,n){return Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2)+Math.pow(t[2]-n[2],2)}mn.rgb.hsl=function(t){var n,i,e=t[0]/255,r=t[1]/255,s=t[2]/255,o=Math.min(e,r,s),a=Math.max(e,r,s),h=a-o;return a===o?n=0:e===a?n=(r-s)/h:r===a?n=2+(s-e)/h:s===a&&(n=4+(e-r)/h),(n=Math.min(60*n,360))<0&&(n+=360),i=(o+a)/2,[n,100*(a===o?0:i<=.5?h/(a+o):h/(2-a-o)),100*i]},mn.rgb.hsv=function(t){var n,i,e,r,s,o=t[0]/255,a=t[1]/255,h=t[2]/255,u=Math.max(o,a,h),l=u-Math.min(o,a,h),c=function(t){return(u-t)/6/l+.5};return 0===l?r=s=0:(s=l/u,n=c(o),i=c(a),e=c(h),o===u?r=e-i:a===u?r=1/3+n-e:h===u&&(r=2/3+i-n),r<0?r+=1:r>1&&(r-=1)),[360*r,100*s,100*u]},mn.rgb.hwb=function(t){var n=t[0],i=t[1],e=t[2];return[mn.rgb.hsl(t)[0],100*(1/255*Math.min(n,Math.min(i,e))),100*(e=1-1/255*Math.max(n,Math.max(i,e)))]},mn.rgb.cmyk=function(t){var n,i=t[0]/255,e=t[1]/255,r=t[2]/255;return[100*((1-i-(n=Math.min(1-i,1-e,1-r)))/(1-n)||0),100*((1-e-n)/(1-n)||0),100*((1-r-n)/(1-n)||0),100*n]},mn.rgb.keyword=function(t){var n=vn[t];if(n)return n;var i,e=1/0;for(var r in yn)if(yn.hasOwnProperty(r)){var s=bn(t,yn[r]);s<e&&(e=s,i=r)}return i},mn.keyword.rgb=function(t){return yn[t]},mn.rgb.xyz=function(t){var n=t[0]/255,i=t[1]/255,e=t[2]/255;return[100*(.4124*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.3576*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)+.1805*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)),100*(.2126*n+.7152*i+.0722*e),100*(.0193*n+.1192*i+.9505*e)]},mn.rgb.lab=function(t){var n=mn.rgb.xyz(t),i=n[0],e=n[1],r=n[2];return e/=100,r/=108.883,i=(i/=95.047)>.008856?Math.pow(i,1/3):7.787*i+16/116,[116*(e=e>.008856?Math.pow(e,1/3):7.787*e+16/116)-16,500*(i-e),200*(e-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]},mn.hsl.rgb=function(t){var n,i,e,r,s,o=t[0]/360,a=t[1]/100,h=t[2]/100;if(0===a)return[s=255*h,s,s];n=2*h-(i=h<.5?h*(1+a):h+a-h*a),r=[0,0,0];for(var u=0;u<3;u++)(e=o+1/3*-(u-1))<0&&e++,e>1&&e--,s=6*e<1?n+6*(i-n)*e:2*e<1?i:3*e<2?n+(i-n)*(2/3-e)*6:n,r[u]=255*s;return r},mn.hsl.hsv=function(t){var n=t[0],i=t[1]/100,e=t[2]/100,r=i,s=Math.max(e,.01);return i*=(e*=2)<=1?e:2-e,r*=s<=1?s:2-s,[n,100*(0===e?2*r/(s+r):2*i/(e+i)),100*((e+i)/2)]},mn.hsv.rgb=function(t){var n=t[0]/60,i=t[1]/100,e=t[2]/100,r=Math.floor(n)%6,s=n-Math.floor(n),o=255*e*(1-i),a=255*e*(1-i*s),h=255*e*(1-i*(1-s));switch(e*=255,r){case 0:return[e,h,o];case 1:return[a,e,o];case 2:return[o,e,h];case 3:return[o,a,e];case 4:return[h,o,e];case 5:return[e,o,a]}},mn.hsv.hsl=function(t){var n,i,e,r=t[0],s=t[1]/100,o=t[2]/100,a=Math.max(o,.01);return e=(2-s)*o,i=s*a,[r,100*(i=(i/=(n=(2-s)*a)<=1?n:2-n)||0),100*(e/=2)]},mn.hwb.rgb=function(t){var n,i,e,r,s,o,a,h=t[0]/360,u=t[1]/100,l=t[2]/100,c=u+l;switch(c>1&&(u/=c,l/=c),e=6*h-(n=Math.floor(6*h)),0!=(1&n)&&(e=1-e),r=u+e*((i=1-l)-u),n){default:case 6:case 0:s=i,o=r,a=u;break;case 1:s=r,o=i,a=u;break;case 2:s=u,o=i,a=r;break;case 3:s=u,o=r,a=i;break;case 4:s=r,o=u,a=i;break;case 5:s=i,o=u,a=r}return[255*s,255*o,255*a]},mn.cmyk.rgb=function(t){var n=t[0]/100,i=t[1]/100,e=t[2]/100,r=t[3]/100;return[255*(1-Math.min(1,n*(1-r)+r)),255*(1-Math.min(1,i*(1-r)+r)),255*(1-Math.min(1,e*(1-r)+r))]},mn.xyz.rgb=function(t){var n,i,e,r=t[0]/100,s=t[1]/100,o=t[2]/100;return i=-.9689*r+1.8758*s+.0415*o,e=.0557*r+-.204*s+1.057*o,n=(n=3.2406*r+-1.5372*s+-.4986*o)>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:12.92*i,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,[255*(n=Math.min(Math.max(0,n),1)),255*(i=Math.min(Math.max(0,i),1)),255*(e=Math.min(Math.max(0,e),1))]},mn.xyz.lab=function(t){var n=t[0],i=t[1],e=t[2];return i/=100,e/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116)-16,500*(n-i),200*(i-(e=e>.008856?Math.pow(e,1/3):7.787*e+16/116))]},mn.lab.xyz=function(t){var n,i,e,r=t[0];n=t[1]/500+(i=(r+16)/116),e=i-t[2]/200;var s=Math.pow(i,3),o=Math.pow(n,3),a=Math.pow(e,3);return i=s>.008856?s:(i-16/116)/7.787,n=o>.008856?o:(n-16/116)/7.787,e=a>.008856?a:(e-16/116)/7.787,[n*=95.047,i*=100,e*=108.883]},mn.lab.lch=function(t){var n,i=t[0],e=t[1],r=t[2];return(n=360*Math.atan2(r,e)/2/Math.PI)<0&&(n+=360),[i,Math.sqrt(e*e+r*r),n]},mn.lch.lab=function(t){var n,i=t[0],e=t[1];return n=t[2]/360*2*Math.PI,[i,e*Math.cos(n),e*Math.sin(n)]},mn.rgb.ansi16=function(t){var n=t[0],i=t[1],e=t[2],r=1 in arguments?arguments[1]:mn.rgb.hsv(t)[2];if(0===(r=Math.round(r/50)))return 30;var s=30+(Math.round(e/255)<<2|Math.round(i/255)<<1|Math.round(n/255));return 2===r&&(s+=60),s},mn.hsv.ansi16=function(t){return mn.rgb.ansi16(mn.hsv.rgb(t),t[2])},mn.rgb.ansi256=function(t){var n=t[0],i=t[1],e=t[2];return n===i&&i===e?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(i/255*5)+Math.round(e/255*5)},mn.ansi16.rgb=function(t){var n=t%10;if(0===n||7===n)return t>50&&(n+=3.5),[n=n/10.5*255,n,n];var i=.5*(1+~~(t>50));return[(1&n)*i*255,(n>>1&1)*i*255,(n>>2&1)*i*255]},mn.ansi256.rgb=function(t){if(t>=232){var n=10*(t-232)+8;return[n,n,n]}var i;return t-=16,[Math.floor(t/36)/5*255,Math.floor((i=t%36)/6)/5*255,i%6/5*255]},mn.rgb.hex=function(t){var n=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(n.length)+n},mn.hex.rgb=function(t){var n=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!n)return[0,0,0];var i=n[0];3===n[0].length&&(i=i.split("").map((function(t){return t+t})).join(""));var e=parseInt(i,16);return[e>>16&255,e>>8&255,255&e]},mn.rgb.hcg=function(t){var n,i=t[0]/255,e=t[1]/255,r=t[2]/255,s=Math.max(Math.max(i,e),r),o=Math.min(Math.min(i,e),r),a=s-o;return n=a<=0?0:s===i?(e-r)/a%6:s===e?2+(r-i)/a:4+(i-e)/a+4,n/=6,[360*(n%=1),100*a,100*(a<1?o/(1-a):0)]},mn.hsl.hcg=function(t){var n=t[1]/100,i=t[2]/100,e=1,r=0;return(e=i<.5?2*n*i:2*n*(1-i))<1&&(r=(i-.5*e)/(1-e)),[t[0],100*e,100*r]},mn.hsv.hcg=function(t){var n=t[1]/100,i=t[2]/100,e=n*i,r=0;return e<1&&(r=(i-e)/(1-e)),[t[0],100*e,100*r]},mn.hcg.rgb=function(t){var n=t[0]/360,i=t[1]/100,e=t[2]/100;if(0===i)return[255*e,255*e,255*e];var r,s=[0,0,0],o=n%1*6,a=o%1,h=1-a;switch(Math.floor(o)){case 0:s[0]=1,s[1]=a,s[2]=0;break;case 1:s[0]=h,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=a;break;case 3:s[0]=0,s[1]=h,s[2]=1;break;case 4:s[0]=a,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=h}return r=(1-i)*e,[255*(i*s[0]+r),255*(i*s[1]+r),255*(i*s[2]+r)]},mn.hcg.hsv=function(t){var n=t[1]/100,i=n+t[2]/100*(1-n),e=0;return i>0&&(e=n/i),[t[0],100*e,100*i]},mn.hcg.hsl=function(t){var n=t[1]/100,i=t[2]/100*(1-n)+.5*n,e=0;return i>0&&i<.5?e=n/(2*i):i>=.5&&i<1&&(e=n/(2*(1-i))),[t[0],100*e,100*i]},mn.hcg.hwb=function(t){var n=t[1]/100,i=n+t[2]/100*(1-n);return[t[0],100*(i-n),100*(1-i)]},mn.hwb.hcg=function(t){var n=t[1]/100,i=1-t[2]/100,e=i-n,r=0;return e<1&&(r=(i-e)/(1-e)),[t[0],100*e,100*r]},mn.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},mn.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},mn.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},mn.gray.hsl=mn.gray.hsv=function(t){return[0,0,t[0]]},mn.gray.hwb=function(t){return[0,100,t[0]]},mn.gray.cmyk=function(t){return[0,0,0,t[0]]},mn.gray.lab=function(t){return[t[0],0,0]},mn.gray.hex=function(t){var n=255&Math.round(t[0]/100*255),i=((n<<16)+(n<<8)+n).toString(16).toUpperCase();return"000000".substring(i.length)+i},mn.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};var xn=dn.exports;function Fn(t){var n=function(){for(var t={},n=Object.keys(xn),i=n.length,e=0;e<i;e++)t[n[e]]={distance:-1,parent:null};return t}(),i=[t];for(n[t].distance=0;i.length;)for(var e=i.pop(),r=Object.keys(xn[e]),s=r.length,o=0;o<s;o++){var a=r[o],h=n[a];-1===h.distance&&(h.distance=n[e].distance+1,h.parent=e,i.unshift(a))}return n}function An(t,n){return function(i){return n(t(i))}}function kn(t,n){for(var i=[n[t].parent,t],e=xn[n[t].parent][t],r=n[t].parent;n[r].parent;)i.unshift(n[r].parent),e=An(xn[n[r].parent][r],e),r=n[r].parent;return e.conversion=i,e}var Pn=dn.exports,Sn=function(t){for(var n=Fn(t),i={},e=Object.keys(n),r=e.length,s=0;s<r;s++){var o=e[s];null!==n[o].parent&&(i[o]=kn(o,n))}return i},_n={};Object.keys(Pn).forEach((function(t){_n[t]={},Object.defineProperty(_n[t],"channels",{value:Pn[t].channels}),Object.defineProperty(_n[t],"labels",{value:Pn[t].labels});var n=Sn(t);Object.keys(n).forEach((function(i){var e=n[i];_n[t][i]=function(t){var n=function(n){if(null==n)return n;arguments.length>1&&(n=Array.prototype.slice.call(arguments));var i=t(n);if("object"==typeof i)for(var e=i.length,r=0;r<e;r++)i[r]=Math.round(i[r]);return i};return"conversion"in t&&(n.conversion=t.conversion),n}(e),_n[t][i].raw=function(t){var n=function(n){return null==n?n:(arguments.length>1&&(n=Array.prototype.slice.call(arguments)),t(n))};return"conversion"in t&&(n.conversion=t.conversion),n}(e)}))}));var On=_n,In=Yt.exports,Tn=On,Ln=[].slice,Un=["keyword","gray","hex"],zn={};Object.keys(Tn).forEach((function(t){zn[Ln.call(Tn[t].labels).sort().join("")]=t}));var Dn={};function En(t,n){if(!(this instanceof En))return new En(t,n);if(n&&n in Un&&(n=null),n&&!(n in Tn))throw new Error("Unknown model: "+n);var i,e;if(null==t)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(t instanceof En)this.model=t.model,this.color=t.color.slice(),this.valpha=t.valpha;else if("string"==typeof t){var r=In.get(t);if(null===r)throw new Error("Unable to parse color from string: "+t);this.model=r.model,e=Tn[this.model].channels,this.color=r.value.slice(0,e),this.valpha="number"==typeof r.value[e]?r.value[e]:1}else if(t.length){this.model=n||"rgb",e=Tn[this.model].channels;var s=Ln.call(t,0,e);this.color=Hn(s,e),this.valpha="number"==typeof t[e]?t[e]:1}else if("number"==typeof t)t&=16777215,this.model="rgb",this.color=[t>>16&255,t>>8&255,255&t],this.valpha=1;else{this.valpha=1;var o=Object.keys(t);"alpha"in t&&(o.splice(o.indexOf("alpha"),1),this.valpha="number"==typeof t.alpha?t.alpha:0);var a=o.sort().join("");if(!(a in zn))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=zn[a];var h=Tn[this.model].labels,u=[];for(i=0;i<h.length;i++)u.push(t[h[i]]);this.color=Hn(u)}if(Dn[this.model])for(e=Tn[this.model].channels,i=0;i<e;i++){var l=Dn[this.model][i];l&&(this.color[i]=l(this.color[i]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}function Cn(t,n,i){return(t=Array.isArray(t)?t:[t]).forEach((function(t){(Dn[t]||(Dn[t]=[]))[n]=i})),t=t[0],function(e){var r;return arguments.length?(i&&(e=i(e)),(r=this[t]()).color[n]=e,r):(r=this[t]().color[n],i&&(r=i(r)),r)}}function jn(t){return function(n){return Math.max(0,Math.min(t,n))}}function Nn(t){return Array.isArray(t)?t:[t]}function Hn(t,n){for(var i=0;i<n;i++)"number"!=typeof t[i]&&(t[i]=0);return t}En.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(t){var n=this.model in In.to?this:this.rgb(),i=1===(n=n.round("number"==typeof t?t:1)).valpha?n.color:n.color.concat(this.valpha);return In.to[n.model](i)},percentString:function(t){var n=this.rgb().round("number"==typeof t?t:1),i=1===n.valpha?n.color:n.color.concat(this.valpha);return In.to.rgb.percent(i)},array:function(){return 1===this.valpha?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var t={},n=Tn[this.model].channels,i=Tn[this.model].labels,e=0;e<n;e++)t[i[e]]=this.color[e];return 1!==this.valpha&&(t.alpha=this.valpha),t},unitArray:function(){var t=this.rgb().color;return t[0]/=255,t[1]/=255,t[2]/=255,1!==this.valpha&&t.push(this.valpha),t},unitObject:function(){var t=this.rgb().object();return t.r/=255,t.g/=255,t.b/=255,1!==this.valpha&&(t.alpha=this.valpha),t},round:function(t){return t=Math.max(t||0,0),new En(this.color.map(function(t){return function(n){return function(t,n){return Number(t.toFixed(n))}(n,t)}}(t)).concat(this.valpha),this.model)},alpha:function(t){return arguments.length?new En(this.color.concat(Math.max(0,Math.min(1,t))),this.model):this.valpha},red:Cn("rgb",0,jn(255)),green:Cn("rgb",1,jn(255)),blue:Cn("rgb",2,jn(255)),hue:Cn(["hsl","hsv","hsl","hwb","hcg"],0,(function(t){return(t%360+360)%360})),saturationl:Cn("hsl",1,jn(100)),lightness:Cn("hsl",2,jn(100)),saturationv:Cn("hsv",1,jn(100)),value:Cn("hsv",2,jn(100)),chroma:Cn("hcg",1,jn(100)),gray:Cn("hcg",2,jn(100)),white:Cn("hwb",1,jn(100)),wblack:Cn("hwb",2,jn(100)),cyan:Cn("cmyk",0,jn(100)),magenta:Cn("cmyk",1,jn(100)),yellow:Cn("cmyk",2,jn(100)),black:Cn("cmyk",3,jn(100)),x:Cn("xyz",0,jn(100)),y:Cn("xyz",1,jn(100)),z:Cn("xyz",2,jn(100)),l:Cn("lab",0,jn(100)),a:Cn("lab",1),b:Cn("lab",2),keyword:function(t){return arguments.length?new En(t):Tn[this.model].keyword(this.color)},hex:function(t){return arguments.length?new En(t):In.to.hex(this.rgb().round().color)},rgbNumber:function(){var t=this.rgb().color;return(255&t[0])<<16|(255&t[1])<<8|255&t[2]},luminosity:function(){for(var t=this.rgb().color,n=[],i=0;i<t.length;i++){var e=t[i]/255;n[i]=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}return.2126*n[0]+.7152*n[1]+.0722*n[2]},contrast:function(t){var n=this.luminosity(),i=t.luminosity();return n>i?(n+.05)/(i+.05):(i+.05)/(n+.05)},level:function(t){var n=this.contrast(t);return n>=7.1?"AAA":n>=4.5?"AA":""},isDark:function(){var t=this.rgb().color;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},isLight:function(){return!this.isDark()},negate:function(){for(var t=this.rgb(),n=0;n<3;n++)t.color[n]=255-t.color[n];return t},lighten:function(t){var n=this.hsl();return n.color[2]+=n.color[2]*t,n},darken:function(t){var n=this.hsl();return n.color[2]-=n.color[2]*t,n},saturate:function(t){var n=this.hsl();return n.color[1]+=n.color[1]*t,n},desaturate:function(t){var n=this.hsl();return n.color[1]-=n.color[1]*t,n},whiten:function(t){var n=this.hwb();return n.color[1]+=n.color[1]*t,n},blacken:function(t){var n=this.hwb();return n.color[2]+=n.color[2]*t,n},grayscale:function(){var t=this.rgb().color,n=.3*t[0]+.59*t[1]+.11*t[2];return En.rgb(n,n,n)},fade:function(t){return this.alpha(this.valpha-this.valpha*t)},opaquer:function(t){return this.alpha(this.valpha+this.valpha*t)},rotate:function(t){var n=this.hsl(),i=n.color[0];return i=(i=(i+t)%360)<0?360+i:i,n.color[0]=i,n},mix:function(t,n){if(!t||!t.rgb)throw new Error(\'Argument to "mix" was not a Color instance, but rather an instance of \'+typeof t);var i=t.rgb(),e=this.rgb(),r=void 0===n?.5:n,s=2*r-1,o=i.alpha()-e.alpha(),a=((s*o==-1?s:(s+o)/(1+s*o))+1)/2,h=1-a;return En.rgb(a*i.red()+h*e.red(),a*i.green()+h*e.green(),a*i.blue()+h*e.blue(),i.alpha()*r+e.alpha()*(1-r))}},Object.keys(Tn).forEach((function(t){if(-1===Un.indexOf(t)){var n=Tn[t].channels;En.prototype[t]=function(){if(this.model===t)return new En(this);if(arguments.length)return new En(arguments,t);var i="number"==typeof arguments[n]?n:this.valpha;return new En(Nn(Tn[this.model][t].raw(this.color)).concat(i),t)},En[t]=function(i){return"number"==typeof i&&(i=Hn(Ln.call(arguments),n)),new En(i,t)}}}));var Vn=En;class Rn{constructor(t,n){this.position=t,this.index=n,this.faces=[],this.neighbors=[]}addUniqueNeighbor(t){-1===this.neighbors.indexOf(t)&&this.neighbors.push(t)}}class $n{constructor(t,n,i,e){this.a=e.a,this.b=e.b,this.c=e.c,this.v1=t,this.v2=n,this.v3=i,this.normal=[],this.computeNormal(),t.faces.push(this),t.addUniqueNeighbor(n),t.addUniqueNeighbor(i),n.faces.push(this),n.addUniqueNeighbor(t),n.addUniqueNeighbor(i),i.faces.push(this),i.addUniqueNeighbor(t),i.addUniqueNeighbor(n)}computeNormal(){const t=this.v1.position,n=this.v2.position,i=this.v3.position,e=Pt([],St([],i,n),St([],t,n));At(this.normal,e)}hasVertex(t){return t===this.v1||t===this.v2||t===this.v3}}\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */const Wn=[],qn=[],Bn=[],Gn=[];function Jn(t,n,i){const e=Pt(qn,n,i);t=Tt(t,function(t,n,i,e,r,s,o,a,h,u){return t[0]=n,t[1]=i,t[2]=e,t[3]=r,t[4]=s,t[5]=o,t[6]=a,t[7]=h,t[8]=u,t}(Wn,i[0],i[1],i[2],...e,...n));if((t=function(t){return t[3]<0?Ut(t,t,-1):t}(t=zt(t,t)))[3]<1/32767){t[3]=1/32767;const n=Math.sqrt(.9999999990686206);t[0]*=n,t[1]*=n,t[2]*=n}const r=i[3]>0?Pt(Bn,i,n):Pt(Bn,n,i);return kt(Pt(Gn,i,n),r)<0&&Ut(t,t,-1),t}function Xn(t,n){const i=[],e=[];let r=0;for(r=0;r<t.length;r+=3){const n=new Rn([t[r],t[r+1],t[r+2]],r/3);i.push(n)}if(!n.length){const t=n;n=[];for(let i=0;i<t;i++)n.push(i)}for(r=0;r<n.length/3;r++){const t={a:n[3*r],b:n[3*r+1],c:n[3*r+2]};new $n(i[t.a],i[t.b],i[t.c],t)}const s=[],o=[0,0,0];for(r=0;r<i.length;r++){const t=i[r],n=t.index;bt(o,0,0,0);let a=t.faces.length;for(let n=0;n<a;n++)xt(o,o,t.faces[n].normal);a=a||1,bt(s,a,a,a),Ft(o,o,s),e[3*n]=o[0],e[3*n+1]=o[1],e[3*n+2]=o[2]}return e}\n/*!\n * Contains code from THREE.JS\n * https://github.com/mrdoob/three.js/\n * License MIT\n * \n * Generate tangents per vertex.\n */function Zn(t,n,i){return t[0]=n[i],t[1]=n[i+1],t[2]=n[i+2],t}function Yn(t,n,i){return t[0]=n[i],t[1]=n[i+1],t}var Kn={exports:{}};function Qn(t,n,i){i=i||2;var e,r,s,o,a,h,u,l=n&&n.length,c=l?n[0]*i:t.length,f=ti(t,0,c,i,!0),d=[];if(!f||f.next===f.prev)return d;if(l&&(f=function(t,n,i,e){var r,s,o,a,h,u=[];for(r=0,s=n.length;r<s;r++)o=n[r]*e,a=r<s-1?n[r+1]*e:t.length,(h=ti(t,o,a,e,!1))===h.next&&(h.steiner=!0),u.push(ci(h));for(u.sort(ai),r=0;r<u.length;r++)i=ni(i=hi(u[r],i),i.next);return i}(t,n,f,i)),t.length>80*i){e=s=t[0],r=o=t[1];for(var y=i;y<c;y+=i)(a=t[y])<e&&(e=a),(h=t[y+1])<r&&(r=h),a>s&&(s=a),h>o&&(o=h);u=0!==(u=Math.max(s-e,o-r))?1/u:0}return ii(f,d,i,e,r,u),d}function ti(t,n,i,e,r){var s,o;if(r===Ai(t,n,i,e)>0)for(s=n;s<i;s+=e)o=bi(s,t[s],t[s+1],o);else for(s=i-e;s>=n;s-=e)o=bi(s,t[s],t[s+1],o);return o&&vi(o,o.next)&&(xi(o),o=o.next),o}function ni(t,n){if(!t)return t;n||(n=t);var i,e=t;do{if(i=!1,e.steiner||!vi(e,e.next)&&0!==yi(e.prev,e,e.next))e=e.next;else{if(xi(e),(e=n=e.prev)===e.next)break;i=!0}}while(i||e!==n);return n}function ii(t,n,i,e,r,s,o){if(t){!o&&s&&function(t,n,i,e){var r=t;do{null===r.z&&(r.z=li(r.x,r.y,n,i,e)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var n,i,e,r,s,o,a,h,u=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,e=i,a=0,n=0;n<u&&(a++,e=e.nextZ);n++);for(h=u;a>0||h>0&&e;)0!==a&&(0===h||!e||i.z<=e.z)?(r=i,i=i.nextZ,a--):(r=e,e=e.nextZ,h--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=e}s.nextZ=null,u*=2}while(o>1)}(r)}(t,e,r,s);for(var a,h,u=t;t.prev!==t.next;)if(a=t.prev,h=t.next,s?ri(t,e,r,s):ei(t))n.push(a.i/i),n.push(t.i/i),n.push(h.i/i),xi(t),t=h.next,u=h.next;else if((t=h)===u){o?1===o?ii(t=si(ni(t),n,i),n,i,e,r,s,2):2===o&&oi(t,n,i,e,r,s):ii(ni(t),n,i,e,r,s,1);break}}}function ei(t){var n=t.prev,i=t,e=t.next;if(yi(n,i,e)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(fi(n.x,n.y,i.x,i.y,e.x,e.y,r.x,r.y)&&yi(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function ri(t,n,i,e){var r=t.prev,s=t,o=t.next;if(yi(r,s,o)>=0)return!1;for(var a=r.x<s.x?r.x<o.x?r.x:o.x:s.x<o.x?s.x:o.x,h=r.y<s.y?r.y<o.y?r.y:o.y:s.y<o.y?s.y:o.y,u=r.x>s.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,l=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,c=li(a,h,n,i,e),f=li(u,l,n,i,e),d=t.prevZ,y=t.nextZ;d&&d.z>=c&&y&&y.z<=f;){if(d!==t.prev&&d!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&yi(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,y!==t.prev&&y!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,y.x,y.y)&&yi(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,d.x,d.y)&&yi(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;y&&y.z<=f;){if(y!==t.prev&&y!==t.next&&fi(r.x,r.y,s.x,s.y,o.x,o.y,y.x,y.y)&&yi(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function si(t,n,i){var e=t;do{var r=e.prev,s=e.next.next;!vi(r,s)&&pi(r,e,e.next,s)&&wi(r,s)&&wi(s,r)&&(n.push(r.i/i),n.push(e.i/i),n.push(s.i/i),xi(e),xi(e.next),e=t=s),e=e.next}while(e!==t);return ni(e)}function oi(t,n,i,e,r,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&di(o,a)){var h=Mi(o,a);return o=ni(o,o.next),h=ni(h,h.next),ii(o,n,i,e,r,s),void ii(h,n,i,e,r,s)}a=a.next}o=o.next}while(o!==t)}function ai(t,n){return t.x-n.x}function hi(t,n){var i=function(t,n){var i,e=n,r=t.x,s=t.y,o=-1/0;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=r&&a>o){if(o=a,a===r){if(s===e.y)return e;if(s===e.next.y)return e.next}i=e.x<e.next.x?e:e.next}}e=e.next}while(e!==n);if(!i)return null;if(r===o)return i;var h,u=i,l=i.x,c=i.y,f=1/0;e=i;do{r>=e.x&&e.x>=l&&r!==e.x&&fi(s<c?r:o,s,l,c,s<c?o:r,s,e.x,e.y)&&(h=Math.abs(s-e.y)/(r-e.x),wi(e,t)&&(h<f||h===f&&(e.x>i.x||e.x===i.x&&ui(i,e)))&&(i=e,f=h)),e=e.next}while(e!==u);return i}(t,n);if(!i)return n;var e=Mi(i,t),r=ni(i,i.next);return ni(e,e.next),n===i?r:n}function ui(t,n){return yi(t.prev,t,n.prev)<0&&yi(n.next,t,t.next)<0}function li(t,n,i,e,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=32767*(n-e)*r)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function ci(t){var n=t,i=t;do{(n.x<i.x||n.x===i.x&&n.y<i.y)&&(i=n),n=n.next}while(n!==t);return i}function fi(t,n,i,e,r,s,o,a){return(r-o)*(n-a)-(t-o)*(s-a)>=0&&(t-o)*(e-a)-(i-o)*(n-a)>=0&&(i-o)*(s-a)-(r-o)*(e-a)>=0}function di(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==n.i&&i.next.i!==n.i&&pi(i,i.next,t,n))return!0;i=i.next}while(i!==t);return!1}(t,n)&&(wi(t,n)&&wi(n,t)&&function(t,n){var i=t,e=!1,r=(t.x+n.x)/2,s=(t.y+n.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(e=!e),i=i.next}while(i!==t);return e}(t,n)&&(yi(t.prev,t,n.prev)||yi(t,n.prev,n))||vi(t,n)&&yi(t.prev,t,t.next)>0&&yi(n.prev,n,n.next)>0)}function yi(t,n,i){return(n.y-t.y)*(i.x-n.x)-(n.x-t.x)*(i.y-n.y)}function vi(t,n){return t.x===n.x&&t.y===n.y}function pi(t,n,i,e){var r=gi(yi(t,n,i)),s=gi(yi(t,n,e)),o=gi(yi(i,e,t)),a=gi(yi(i,e,n));return r!==s&&o!==a||(!(0!==r||!mi(t,i,n))||(!(0!==s||!mi(t,e,n))||(!(0!==o||!mi(i,t,e))||!(0!==a||!mi(i,n,e)))))}function mi(t,n,i){return n.x<=Math.max(t.x,i.x)&&n.x>=Math.min(t.x,i.x)&&n.y<=Math.max(t.y,i.y)&&n.y>=Math.min(t.y,i.y)}function gi(t){return t>0?1:t<0?-1:0}function wi(t,n){return yi(t.prev,t,t.next)<0?yi(t,n,t.next)>=0&&yi(t,t.prev,n)>=0:yi(t,n,t.prev)<0||yi(t,t.next,n)<0}function Mi(t,n){var i=new Fi(t.i,t.x,t.y),e=new Fi(n.i,n.x,n.y),r=t.next,s=n.prev;return t.next=n,n.prev=t,i.next=r,r.prev=i,e.next=i,i.prev=e,s.next=e,e.prev=s,e}function bi(t,n,i,e){var r=new Fi(t,n,i);return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function xi(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Fi(t,n,i){this.i=t,this.x=n,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ai(t,n,i,e){for(var r=0,s=n,o=i-e;s<i;s+=e)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}Kn.exports=Qn,Kn.exports.default=Qn,Qn.deviation=function(t,n,i,e){var r=n&&n.length,s=r?n[0]*i:t.length,o=Math.abs(Ai(t,0,s,i));if(r)for(var a=0,h=n.length;a<h;a++){var u=n[a]*i,l=a<h-1?n[a+1]*i:t.length;o-=Math.abs(Ai(t,u,l,i))}var c=0;for(a=0;a<e.length;a+=3){var f=e[a]*i,d=e[a+1]*i,y=e[a+2]*i;c+=Math.abs((t[f]-t[y])*(t[d+1]-t[f+1])-(t[f]-t[d])*(t[y+1]-t[f+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},Qn.flatten=function(t){for(var n=t[0][0].length,i={vertices:[],holes:[],dimensions:n},e=0,r=0;r<t.length;r++){for(var s=0;s<t[r].length;s++)for(var o=0;o<n;o++)i.vertices.push(t[r][s][o]);r>0&&(e+=t[r-1].length,i.holes.push(e))}return i};var ki=Kn.exports;\n/*!\n * @maptalks/vector-packer v0.63.9\n * LICENSE : UNLICENSED\n * (c) 2016-2022 maptalks.com\n */const Pi={Point:1,LineString:2,Polygon:3,MultiPoint:4,MultiLineString:5,MultiPolygon:6};function Si(t,n={}){var i=[];if("FeatureCollection"===t.type)for(var e=0;e<t.features.length;e++)_i(i,t.features[e],n,e);else _i(i,"Feature"===t.type?t:{geometry:t},n);return i}function _i(t,n,i,e){if(n.geometry&&n.geometry.geometry){var r=n.geometry.coordinates,s=n.geometry.type,o=[],a=n.id;if(i.promoteId?a=n.properties[i.promoteId]:i.generateId&&(a=e||0),"Point"===s)Oi(r,o);else if("MultiPoint"===s)for(var h=0;h<r.length;h++)Oi(r[h],o);else if("LineString"===s)Ti([r],o);else if("MultiLineString"===s){if(i.lineMetrics){for(h=0;h<r.length;h++)Ii(r[h],o=[]),t.push(Li(a,"LineString",o,n.properties));return}Ti(r,o)}else if("Polygon"===s)Ti(r,o);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(h=0;h<n.geometry.geometries.length;h++)_i(t,{id:a,geometry:n.geometry.geometries[h],properties:n.properties},i,e);return}return void console.warn(`Input data type(${s}) is not a valid GeoJSON geometry type.`)}for(h=0;h<r.length;h++){var u=[];Ti(r[h],u),o.push(u)}}t.push(Li(a,s,o,n.properties))}}function Oi(t,n){n.push([new Ht(t[0],t[1])])}function Ii(t,n){for(var i=0;i<t.length;i++)n.push(new Ht(t[i][0],t[i][1]))}function Ti(t,n,i,e){for(var r=0;r<t.length;r++){var s=[];Ii(t[r],s),n.push(s)}}function Li(t,n,i,e){return{id:void 0===t?null:t,type:Pi[n],geometry:i,properties:e}}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */function Ui(t,{width:n,height:i},e,r){if(r){if(r.length!==n*i*e)throw new RangeError("mismatched image size")}else r=new Uint8Array(n*i*e);return t.width=n,t.height=i,t.data=r,t}function zi(t,{width:n,height:i},e){if(n===t.width&&i===t.height)return;const r=Ui({},{width:n,height:i},e);Di(t,r,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,i)},e),t.width=n,t.height=i,t.data=r.data}function Di(t,n,i,e,r,s){if(0===r.width||0===r.height)return n;if(r.width>t.width||r.height>t.height||i.x>t.width-r.width||i.y>t.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>n.width||r.height>n.height||e.x>n.width-r.width||e.y>n.height-r.height)throw new RangeError("out of range destination coordinates for image copy");const o=t.data,a=n.data;if(o===a)return n;for(let h=0;h<r.height;h++){const u=((i.y+h)*t.width+i.x)*s,l=((e.y+h)*n.width+e.x)*s;for(let t=0;t<r.width*s;t++)a[l+t]=o[u+t]}return n}class Ei{constructor(t,n){Ui(this,t,1,n)}resize(t){zi(this,t,1)}clone(){return new Ei({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,i,e,r){Di(t,n,i,e,r,1)}}class Ci{constructor(t,n){Ui(this,t,4,n)}resize(t){zi(this,t,4)}clone(){return new Ci({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,i,e,r){Di(t,n,i,e,r,4)}}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */class ji{constructor(t,{pixelRatio:n}){this.paddedRect=t,this.pixelRatio=n||1}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Ni{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n={},i=new Rt(0,0,{autoResize:!0}),e=[];for(const i in t){const r=t[i],s={x:0,y:0,w:r.data.width+2,h:r.data.height+2};e.push(s),n[i]=new ji(s,r)}if(i.pack(e,{inPlace:!0}),!Hi(i.w)||!Hi(i.h)){const t=Vi(i.w),n=Vi(i.h);i.resize(t,n)}const r=new Ci({width:i.w,height:i.h});for(const i in t){const e=t[i],s=n[i].paddedRect;Ci.copy(e.data,r,{x:0,y:0},{x:s.x+1,y:s.y+1},e.data)}this.image=r,this.positions=n}}function Hi(t){return 0==(t&t-1)&&0!==t}function Vi(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n * TODO 升级为potpack\n */class Ri{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n={},i=new Rt(0,0,{autoResize:!0}),e=[];for(const i in t){const r=t[i],s=n[i]={};for(const t in r){const n=r[+t];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const i={x:0,y:0,w:n.bitmap.width+2,h:n.bitmap.height+2};e.push(i),s[t]={rect:i,metrics:n.metrics}}}i.pack(e,{inPlace:!0});const r=new Ei({width:i.w,height:i.h});for(const i in t){const e=t[i];for(const t in e){const s=e[+t];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const o=n[i][t].rect;Ei.copy(s.bitmap,r,{x:0,y:0},{x:o.x+1,y:o.y+1},s.bitmap)}}this.image=r,this.positions=n}}function $i(t){return t<65536?Uint16Array:Uint32Array}function Wi(t){return(t=Math.abs(t))<128?Int8Array:t<32768?Int16Array:Float32Array}function qi(t){return t<256?Uint8Array:t<65536?Uint16Array:Float32Array}function Bi(t){const n=t.type,i=[];if(1===n||4===n)for(let n=0;n<t.geometry.length;n++)Oi(t.geometry[n],i);else if(2===n)Ti(t.geometry,i);else if(3===n)Ti(t.geometry,i);else if(5===n)Ti(t.geometry,i);else if(6===n)for(let n=0;n<t.geometry.length;n++){const e=[];Ti(t.geometry[n],e),i.push(e)}return t.geometry=i,t}function Gi(t){for(let n=1;n<arguments.length;n++){const i=arguments[n];for(const n in i)t[n]=i[n]}return t}function Ji(t){return null==t}function Xi(t){return"number"==typeof t&&!isNaN(t)}function Zi(t){return"object"==typeof t&&!!t}function Yi(t){return!Ji(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}const Ki=Object.prototype.hasOwnProperty;function Qi(t,n){return Ki.call(t,n)}function te(t){return m(t)&&t.property}function ne(t){let n=0;for(let i,e,r=0,s=t.length,o=s-1;r<s;o=r++)i=t[r],e=t[o],n+=void 0!==i.x?(e.x-i.x)*(i.y+e.y):(e[0]-i[0])*(i[1]+e[1]);return n}function ie(t,n,i,e,r){const s=t[n*e],o=t[n*e+1],a=t[i*e],h=t[i*e+1];return s===a&&(s<0||s>r)&&o!==h||o===h&&(o<0||o>r)&&s!==a}function ee(t,n,i){let e=i;return n&&t&&(e=t[n]),void 0===e&&(e=i),10*(e||0)}function re(t,n,i,e,r,s,o){n||0===n||(n=1);const a=ee(t.properties,i,e),h=a*n;let u=a;return r?u=ee(t.properties,r,s):o&&(u=a-ee(t.properties,o,0)),u*=n,{altitude:h,height:u}}function se(t,n){return n<1/0&&(t.x<0||t.x>n||t.y<0||t.y>n)}function oe(t){return null==t}function ae(t,n,i){if(t===i||t===n)return t;const e=i-n;return((t-n)%e+e)%e+n}class he{constructor(t,n,i,e){this.feature=t,this.symbol=n,this.fnTypes=i,this.options=e}getPolygonResource(){let t=this.symbol.polygonPatternFile;const{polygonPatternFileFn:n}=this.fnTypes;return this.U(t,n)}getLineResource(){let t=this.symbol.linePatternFile;const{linePatternFileFn:n}=this.fnTypes;return this.U(t,n)}U(t,n){return n&&(t=n(this.options.zoom,this.feature.properties)),t}}const ue={lineWidth:1,lineStrokeWidth:1,lineDx:1,lineDy:1,lineOpacity:1,linePatternAnimSpeed:1,markerWidth:1,markerHeight:1,markerDx:1,markerDy:1,markerSpacing:1,markerOpacity:1,markerRotation:1,textWrapWidth:1,textSpacing:1,textSize:1,textHaloRadius:1,textHaloOpacity:1,textDx:1,textDy:1,textOpacity:1,textRotation:1,polygonOpacity:1};class le{static isAtlasLoaded(t,n={}){const{iconAtlas:i}=n;return!!(!t||i&&i.positions[t])}static genFnTypes(t){const n={};for(const i in t)if(te(t[i])){const e=(i+"_Fn_0").trim(),r=(i+"Fn").trim();ue[i]?(n[e]=g(t[i]),n[r]=(t,i)=>{const r=n[e](t,i);return te(r)?g(r)(t,i):r}):(n[e]=w(t[i]),n[r]=(t,i)=>{const r=n[e](t,i);return te(r)?w(r)(t,i):r})}return n}constructor(t,n,i){this.options=i,this.features=this.D(t),this.symbolDef=n,this.symbol=M(n,()=>[i.zoom]),this.styledVectors=[],this.properties={},this.C=le.genFnTypes(this.symbolDef),te(this.symbolDef.visible)&&(this.j=g(this.symbolDef.visible)),i.atlas&&(this.iconAtlas=i.atlas.iconAtlas,this.glyphAtlas=i.atlas.glyphAtlas)}D(t){if(!t.length)return t;const n="__fea_idx".trim();let e,r=0,s=t[r];for(;!s.geometry;)r++,s=t[r];if(Array.isArray(s.geometry)&&s.properties){let n=s.geometry[0];for(;Array.isArray(n);)n=n[0];n instanceof Ht&&(e=t)}if(!e)if(e=[],Array.isArray(s.geometry))for(let n=0;n<t.length;n++){const i=Gi({},t[n]);e.push(Bi(i))}else for(let i=0;i<t.length;i++){const r=t[i],s=Si(r);for(let t=0;t<s.length;t++){const i=s[t];i[n]=r[n],e.push(i)}}const o=this.options.order;if(o){const t=[];for(let n=0;n<o.length;n++)o[n]&&t.push(i(o[n]));e=e.sort((n,i)=>{const e=t.length;let r=e,s=e;for(let o=0;o<e&&(t[o](n)&&(r=o),t[o](i)&&(s=o),!(r<e&&s<e));o++);return r-s})}return e}load(t=1){const n="__fea_idx".trim(),i="_debug_info".trim(),e=this.C,r=this.styledVectors;this.count=0;const s=this.features;if(!s||!s.length)return Promise.resolve(null);const o={},a={},h={zoom:this.options.zoom},u=M(this.symbolDef,()=>[h.zoom]);let l=0,c=s.length;const f=this.options.debugIndex;try{for(;l<c;l++){const t=s[l];if(!t||!t.geometry)continue;if(void 0!==f&&t[i].index!==f)continue;t.properties||(t.properties={}),t.properties.$layer=t.layer,t.properties.$type=t.type;const c=this.createStyledVector(t,u,e,h,o,a);c&&c.feature.geometry&&(c.featureIdx=void 0===t[n]?l:t[n],this.count++,r.push(c))}}catch(t){return Promise.reject(t)}return this.options.atlas?Promise.resolve(this.pack(t)):this.loadAtlas(o,a).then(()=>this.pack(t))}loadAtlas(t,n){return new Promise((i,e)=>{this.fetchAtlas(t,n,(t,n)=>{if(t)e(t);else{if(n){const{icons:t,glyphs:i}=n;if(t&&Object.keys(t).length){for(const n in t){const i=t[n],{width:e,height:r,data:s}=i.data;i.data=new Ci({width:e,height:r},s)}this.iconAtlas=new Ni(t)}if(i&&Object.keys(i).length){for(const t in i){const n=i[t];for(const t in n){const i=n[t],{width:e,height:r,data:s}=i.bitmap;i.bitmap=new Ei({width:e,height:r},s)}}this.glyphAtlas=new Ri(i)}}i({glyphAtlas:this.glyphAtlas,iconAtlas:this.iconAtlas})}})})}fetchAtlas(t,n,i){Object.keys(t).length>0||Object.keys(n).length>0?this.options.requestor(t,n,i):i()}pack(t){if(!this.count)return null;if(null==t)throw new Error("layout scale is undefined");const n=this.createDataPack(this.styledVectors,t);if(!n)return null;n.properties=this.properties,this.empty&&(n.empty=!0);const i=n.buffers;delete n.buffers;const e={data:n,buffers:i};if(this.iconAtlas){const t=e.data.iconAtlas=ce(this.iconAtlas);if(t.glyphMap)for(const n in t.glyphMap)i.push(t.glyphMap[n].data.data.buffer);i.push(e.data.iconAtlas.image.data.buffer)}return this.glyphAtlas&&(e.data.glyphAtlas=ce(this.glyphAtlas),i.push(e.data.glyphAtlas.image.data.buffer)),e}createStyledVector(t,n,i,e){return new he(t,n,i,e)}createDataPack(t,n){if(!t||!t.length)return null;this.maxIndex=0,this.maxPos=0,this.maxAltitude=0;const i=this.data={};let e=this.elements=[];const r=this.getFormat(Array.isArray(t[0])?t[0][0].symbol:t[0].symbol);for(let t=0;t<r.length;t++)i[r[t].name]=[];let s=[],o=0;const a=[];let h=0,u=!1;for(let e=0,r=t.length;e<r;e++){if(!t[e].feature.geometry)continue;const r=Array.isArray(t[e])?t[e][0].feature.id:t[e].feature.id;Xi(r)&&(Math.abs(r)>h&&(h=Math.abs(r)),r<0&&(u=!0));const l=this.data.aPosition.length;if(Array.isArray(t[e]))for(let i=0;i<t[e].length;i++)this.N(t[e][i],n);else this.N(t[e],n);const c=(i.aPosition.length-l)/3;for(let n=0;n<c;n++)s.push(t[e].featureIdx),Xi(r)&&a.push(r);o=Math.max(o,t[e].featureIdx)}if(this.hasElements()&&!e.length)return null;s=new(qi(o))(s),r[0].type=this.options.positionType?this.options.positionType:Wi(Math.max(this.maxPos,this.maxAltitude));const l=this.options.center;if(l&&(l[0]||l[1])){const t=i.aPosition;for(let n=0;n<t.length;n+=3)t[n]-=l[0],t[n+1]-=l[1]}const c=function(t,n){const i={};for(let e=0;e<t.length;e++){const r=t[e],s=r.type,o=r.name;i[o]=s===Array?n[o]:new s(n[o])}return i}(r,i);c.aPickingId=s;const f=[];for(const t in c)f.push(c[t].buffer);e=new($i(this.maxIndex))(e),f.push(e.buffer);const d={data:c,indices:this.hasElements()?e:null,positionSize:3,\n//!this.maxAltitude ? 2 : 3,\nbuffers:f,symbolIndex:this.symbolDef.index||{index:0}};if(a.length){const t=u?Wi(h):qi(h);d.featureIds=new t(a),f.push(d.featureIds.buffer)}else d.featureIds=[];return d}N(t,n){this.j&&this.j.isZoomConstant&&!this.j(null,t.feature.properties)||this.placeVector(t,n,this.formatWidth)}addElements(...t){this.maxIndex=Math.max(this.maxIndex,...t),this.elements.push(...t)}hasElements(){return!0}getAltitude(t){const{altitudeProperty:n,defaultAltitude:i,altitudeScale:e}=this.options;let r=ee(t,n,i);return e&&(r*=e),this.maxAltitude=Math.max(this.maxAltitude,Math.abs(r)),r}getIconAtlasMaxValue(){const t=this.iconAtlas.positions;let n=0;for(const i in t)if(Qi(t,i)){const{tl:e,displaySize:r}=t[i],s=Math.max(e[0],e[1],r[0]-1,r[1]-1);s>n&&(n=s)}return n}}function ce(t){let n=t.positions,i=t.image&&t.image.format||"alpha";if(t instanceof Ni){n={};for(const i in t.positions){const e=t.positions[i];n[i]={paddedRect:e.paddedRect,pixelRatio:e.pixelRatio,tl:e.tl,br:e.br,displaySize:e.displaySize}}i="rgba"}const e=t.image;return{image:{width:e.width,height:e.height,data:e.data,format:i},glyphMap:t.glyphMap,positions:n}}function fe(t,n,i,e){const r="__fn_textSize".trim();let s=t.textSize;if(Ji(n.textSize))return[16,16];t[r]&&(s=t[r]);const o=[];var a;return o[0]=Ji(a=s)||"function"!=typeof a&&(null===a.constructor||a.constructor!==Function)?s:s(e,i),o[1]=o[0],o}function de(t){const n=t.stops;let i=-1/0;for(let t=0;t<n.length;t++){let e=n[t][1];Zi(n[t][1])&&(e=de(n[t][1])),e>i&&(i=e)}return i}const ye=/\\{([\\w_]+)\\}/g;function ve(t,n){return Yi(t)?t.replace(ye,(function(t,i){if(!n)return"";const e=n[i];return Ji(e)?"":Array.isArray(e)?e.join():e})):t}const pe=t=>t>=11904&&t<=12031,me=t=>t>=12032&&t<=12255,ge=t=>t>=12272&&t<=12287,we=t=>t>=12288&&t<=12351,Me=t=>t>=12352&&t<=12447,be=t=>t>=12448&&t<=12543,xe=t=>t>=12544&&t<=12591,Fe=t=>t>=12704&&t<=12735,Ae=t=>t>=12736&&t<=12783,ke=t=>t>=12784&&t<=12799,Pe=t=>t>=12800&&t<=13055,Se=t=>t>=13056&&t<=13311,_e=t=>t>=13312&&t<=19903,Oe=t=>t>=19968&&t<=40959,Ie=t=>t>=40960&&t<=42127,Te=t=>t>=42128&&t<=42191,Le=t=>t>=63744&&t<=64255,Ue=t=>t>=64336&&t<=65023,ze=t=>t>=65040&&t<=65055,De=t=>t>=65072&&t<=65103,Ee=t=>t>=65104&&t<=65135,Ce=t=>t>=65136&&t<=65279,je=t=>t>=65280&&t<=65519;function Ne(t){return!((t=>t>=1536&&t<=1791)(t)||(t=>t>=1872&&t<=1919)(t)||(t=>t>=2208&&t<=2303)(t)||Ue(t)||Ce(t))}function He(t){return!!(746===t||747===t||!(t<4352)&&(Fe(t)||xe(t)||De(t)&&!(t>=65097&&t<=65103)||Le(t)||Se(t)||pe(t)||Ae(t)||!(!we(t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||_e(t)||Oe(t)||Pe(t)||(t=>t>=12592&&t<=12687)(t)||(t=>t>=43360&&t<=43391)(t)||(t=>t>=55216&&t<=55295)(t)||(t=>t>=4352&&t<=4607)(t)||(t=>t>=44032&&t<=55215)(t)||Me(t)||ge(t)||(t=>t>=12688&&t<=12703)(t)||me(t)||ke(t)||be(t)&&12540!==t||!(!je(t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Ee(t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(t=>t>=5120&&t<=5759)(t)||(t=>t>=6320&&t<=6399)(t)||ze(t)||(t=>t>=19904&&t<=19967)(t)||Ie(t)||Te(t)))}function Ve(t){return!(He(t)||function(t){return!!((t=>t>=128&&t<=255)(t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||(t=>t>=8192&&t<=8303)(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||(t=>t>=8448&&t<=8527)(t)||(t=>t>=8528&&t<=8591)(t)||(t=>t>=8960&&t<=9215)(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||(t=>t>=9216&&t<=9279)(t)&&9251!==t||(t=>t>=9280&&t<=9311)(t)||(t=>t>=9312&&t<=9471)(t)||(t=>t>=9632&&t<=9727)(t)||(t=>t>=9728&&t<=9983)(t)&&!(t>=9754&&t<=9759)||(t=>t>=11008&&t<=11263)(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||we(t)||be(t)||(t=>t>=57344&&t<=63743)(t)||De(t)||Ee(t)||je(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Re(t){return t>=1424&&t<=2303||Ue(t)||Ce(t)}const $e=[[9,9],[32,32],[5760,5760],[8192,8198],[8200,8202],[8287,12288],[6158,6158],[8203,8205]];function We(t){for(const n of $e)if(t>=n[0]&&t<=n[1])return!0;return!1}const qe={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\\\":"\","]":"﹈","^":"^",H:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function Be(t,n,i,e,r,s,o,a,h,u){let l=t.trim();2===u&&(l=function(t){let n="";for(let i=0;i<t.length;i++){const e=t.charCodeAt(i+1)||null,r=t.charCodeAt(i-1)||null;n+=e&&Ve(e)&&!qe[t[i+1]]||r&&Ve(r)&&!qe[t[i-1]]||!qe[t[i]]?t[i]:qe[t[i]]}return n}(l));const c=[],f={positionedGlyphs:c,text:l,top:a[1],bottom:a[1],left:a[0],right:a[0],writingMode:u};let d;return d=function(t,n){const i=[];let e=0;for(let r=0;r<n.length;r++){const s=n[r];i.push(t.substring(e,s)),e=s}return e<t.length&&i.push(t.substring(e,t.length)),i}(l,function(t,n,i,e){if(!i)return[];if(!t)return[];const r=[],s=function(t,n,i,e){let r=0;for(let i=0;i<t.length;i++){const s=e[t.charCodeAt(i)];s&&(r+=s.metrics.advance+n)}return r/Math.max(1,Math.ceil(r/i))}(t,n,i,e);let o=0;for(let i=0;i<t.length;i++){const h=t.charCodeAt(i),u=e[h];u&&!Ge[h]&&(o+=u.metrics.advance+n),i<t.length-1&&(Je[h]||!((a=h)<11904)&&(Fe(a)||xe(a)||De(a)||Le(a)||Se(a)||pe(a)||Ae(a)||we(a)||_e(a)||Oe(a)||Pe(a)||je(a)||Me(a)||ge(a)||me(a)||ke(a)||be(a)||ze(a)||Te(a)||Ie(a)))&&r.push(Ye(i+1,o,s,r,Ze(h,t.charCodeAt(i+1)),!1))}var a;return function t(n){return n?t(n.priorBreak).concat(n.index):[]}(Ye(t.length,o,s,r,0,!0))}(l,o,i,n)),function(t,n,i,e,r,s,o,a,h){let u=0,l=8,c=0;const f=t.positionedGlyphs,d="right"===s?1:"left"===s?0:.5;for(let t=0;t<i.length;t++){let r=i[t];if(r=r.trim(),!r.length){l-=e;continue}const s=f.length;for(let t=0;t<r.length;t++){const i=r.charCodeAt(t),e=n[i];e&&(He(i)&&1!==o?(32!==i&&f.push({glyph:i,x:u,y:0,vertical:!0}),u+=h+a):(32!==i&&f.push({glyph:i,x:u,y:l,vertical:!1}),u+=e.metrics.advance+a))}f.length!==s&&(c=Math.max(u-a,c),Qe(f,n,s,f.length-1,d)),u=0,l-=e}const{horizontalAlign:y,verticalAlign:v}=Ke(r);!function(t,n,i,e,r,s,o){const a=(n-i)*r,h=-(-e*o+.5)*s;if(a||h)for(let n=0;n<t.length;n++)t[n].x+=a,t[n].y+=h}(f,d,y,v,c,e,i.length);const p=i.length*e;t.top+=-v*p,t.bottom=t.top+p,t.left+=-y*c,t.right=t.left+c}(f,n,d,e,r,s,u,o,h),!!c.length&&f}const Ge={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Je={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Xe(t,n,i,e){const r=Math.pow(t-n,2);return e?t<n?r/2:2*r:r+Math.abs(i)*i}function Ze(t,n){let i=0;return 10===t&&(i-=1e4),40!==t&&65288!==t||(i+=50),41!==n&&65289!==n||(i+=50),i}function Ye(t,n,i,e,r,s){let o=null,a=Xe(n,i,r,s);for(let t=0;t<e.length;t++){const h=e[t],u=Xe(n-h.x,i,r,s)+h.badness;u<=a&&(o=h,a=u)}return{index:t,x:n,priorBreak:o,badness:a}}function Ke(t){let n=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":n=1;break;case"left":case"top-left":case"bottom-left":n=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:n,verticalAlign:i}}function Qe(t,n,i,e,r){if(!r)return;const s=n[t[e].glyph];if(s){const n=(t[e].x+s.metrics.advance)*r;if(!n)return;for(let r=i;r<=e;r++)t[r].x-=n}}function tr(t){if(!function(t){for(const n of t)if(Re(n.charCodeAt(0)))return!0;return!1}(t))return t;const n=[],i=[],e=[];let r=0,s=0,o=1,a=1;for(const h of t){const t=h.codePointAt(0);We(t)?(e.push(h),r++):(o=Re(t)?-1:1,a!==o?(s=r,i.length&&(a>0&&i.reverse(),n.push(...i)),e.length&&(n.splice(s,0,...e),e.length=0),a=o,i.length=0):e.length&&(i.push(...e),e.length=0),i.push(h),r++)}return e.length&&i.push(...e),i.length&&(a>0&&i.reverse(),n.push(...i)),n.reverse().join("")}const nr=/\\{ *([\\w_]+) *\\}/g;class ir{constructor(t,n,i,e,r){this.feature=t,this.symbolDef=n,this.symbol=i,this.options=r,this.V=this.R.bind(this),this.C=e}R(t,n){return this.feature.properties[n]||"default"}getShape(t,n){if(this.W)return this.W;const{textHorizontalAlignmentFn:i,textVerticalAlignmentFn:e,markerHorizontalAlignmentFn:r,markerVerticalAlignmentFn:s,textWrapWidthFn:o}=this.C;let a;const h=this.symbol,u=this.getIconAndGlyph(),l=this.feature.properties;if(u&&u.glyph){const{font:t,text:r}=u.glyph;if(""===r)return null;const s=this.size[0]/24,c=24,f=h.textKeepUpright,d="map"===h.textRotationAlignment&&"line"===h.textPlacement&&!h.isIconText,y=n.glyphMap[t],v=er(i?i(null,l):h.textHorizontalAlignment,e?e(null,l):h.textVerticalAlignment),p=1.2*c,m=function(t){for(let n=0;n<t.length;n++)if(!Ne(t.charAt(n).charCodeAt(0)))return!1;return!0}(r),g=m&&h.textLetterSpacing/s||0,w=[h.textDx/s||0,h.textDy/s||0],M=((o?o(null,l):h.textWrapWidth)||10*c)/s;a={},a.horizontal=Be(r,y,M,p,v,"center",g,w,c,1),m&&d&&f&&(a.vertical=Be(r,y,M,p,v,"center",g,w,c,2))}else if(u&&u.icon){if(!t.positions[u.icon.url])return null;const n=er(r?r(null,l):h.markerHorizontalAlignment,s?s(null,l):h.markerVerticalAlignment);a=function(t,n){const{horizontalAlign:i,verticalAlign:e}=Ke(n),r=-24*i,s=-24*e;return{image:t,top:s,bottom:s+24,left:r,right:r+24}}(t.positions[u.icon.url],n),this.size||(this.size=a.image.displaySize)}return this.W=a,a}getIconAndGlyph(){if(this.iconGlyph)return this.iconGlyph;const{markerFileFn:t,markerTypeFn:n,markerPathFn:i,markerWidthFn:e,markerHeightFn:r,markerFillFn:s,markerFillPatternFileFn:o,markerFillOpacityFn:a,markerTextFitFn:h,markerTextFitPaddingFn:u,markerLineColorFn:l,markerLineWidthFn:c,markerLineOpacityFn:f,markerLineDasharrayFn:d,markerLinePatternFileFn:y,markerPathWidthFn:v,markerPathHeightFn:p,textNameFn:w,textFaceNameFn:M,textStyleFn:b,textWeightFn:x}=this.C,{zoom:F}=this.options,A={},k=this.symbol,P=this.feature.properties,S=t?t(null,P):k.markerFile,_=n?n(null,P):k.markerType,O=S||_||k.markerPath,I=!Ji(this.symbolDef.textName);let T;if(O){T=function(t,n,i,e,r,s){if(Ji(n.markerWidth)&&Ji(n.markerHeight))return null;const o="__fn_markerWidth".trim(),a="__fn_markerHeight".trim();let h=n.markerWidth||0,u=n.markerHeight||0;return Zi(h)&&("identity"!==h.type?h=de(h):(h=t.markerWidth,t[o]&&(h=t[o](e,i)),Zi(h)&&(h="identity"===h.type?r(e,i):de(h)))),Zi(u)&&("identity"!==u.type?u=de(u):(u=t.markerHeight,t[a]&&(u=t[a](e,i)),Zi(u)&&(u="identity"===u.type?s(e,i):de(u)))),[h,u]}(k,this.symbolDef,P,F,e,r)||[0,0];let t=k.markerTextFit;if(h&&(t=h(F,P)),t&&t&&"none"!==t){const n=k.text.textSize;let i=k.text.textName;m(i)&&(i=g(i)(F,P));const e=ve(i,P);if(e){const i="__fn_textSize".trim(),r="__fn_textSize_0".trim();m(n)&&!k.text[i]&&(k.text[r]=g(n),k.text[i]=(t,n)=>{const i=k.text[r](t,n);return m(i)?g(i)(t,n):i});const s=fe(k.text,k.text,P,F);if("width"!==t&&"both"!==t||(T[0]=s[0]*e.length),"height"!==t&&"both"!==t||(T[1]=s[1]),s[0]&&s[1]){let t=k.markerTextFitPadding||[0,0,0,0];u&&(t=u(F,P)),T[0]+=t[1]+t[3],T[1]+=t[0]+t[2]}}else T[0]=T[1]=-1}}if(I&&(T=fe(k,this.symbolDef,P,F)),!T)return A;if(T[0]=Math.ceil(T[0]),T[1]=Math.ceil(T[1]),this.size=T,O&&T[0]>=0&&T[1]>=0){let t;if(_){const n={};if(n.markerType=_,"path"===_&&(n.markerPath=i?i(null,P):k.markerPath,n.markerPathWidth=v?v(null,P):k.markerPathWidth,n.markerPathHeight=p?p(null,P):k.markerPathHeight),e){const t=e(null,P);Ji(t)||(n.markerWidth=t)}else k.markerWidth>=0&&(n.markerWidth=k.markerWidth);if(r){const t=r(null,P);Ji(t)||(n.markerHeight=t)}else k.markerHeight>=0&&(n.markerHeight=k.markerHeight);if(s){const t=s(null,P);Ji(t)||(n.markerFill=t)}else k.markerFill&&(n.markerFill=k.markerFill);if(o){const t=o(null,P);Ji(t)||(n.markerFillPatternFile=t)}else k.markerFillPatternFile&&(n.markerFillPatternFile=k.markerFillPatternFile);if(a){const t=a(null,P);Ji(t)||(n.markerFillOpacity=t)}else k.markerFillOpacity>=0&&(n.markerFillOpacity=k.markerFillOpacity);if(l){const t=l(null,P);Ji(t)||(n.markerLineColor=t)}else k.markerLineColor&&(n.markerLineColor=k.markerLineColor);if(c){const t=c(null,P);Ji(t)||(n.markerLineWidth=t)}else k.markerLineWidth>=0&&(n.markerLineWidth=k.markerLineWidth);if(f){const t=f(null,P);Ji(t)||(n.markerLineOpacity=t)}else k.markerLineOpacity>=0&&(n.markerLineOpacity=k.markerLineOpacity);if(d){const t=d(null,P);Ji(t)||(n.markerLineDasharray=t)}else k.markerLineDasharray&&(n.markerLineDasharray=k.markerLineDasharray);if(y){const t=y(null,P);Ji(t)||(n.markerLinePatternFile=t)}else k.markerLinePatternFile&&(n.markerLinePatternFile=k.markerLinePatternFile);t="vector://"+JSON.stringify(n)}else t=S?S.replace(nr,this.V):k.markerPath?function(t,n,i){if(!t.markerPath)return null;let e=1;const r=function(t){const n={stroke:{stroke:t.markerLineColor,"stroke-width":t.markerLineWidth,"stroke-opacity":t.markerLineOpacity,"stroke-dasharray":null,"stroke-linecap":"butt","stroke-linejoin":"round"},fill:{fill:t.markerFill,"fill-opacity":t.markerFillOpacity}};return 0===n.stroke["stroke-width"]&&(n.stroke["stroke-opacity"]=0),n}(t);Xi(t.markerOpacity)&&(e=t.markerOpacity),Xi(t.opacity)&&(e*=t.opacity);const s={};if(r){for(const t in r.stroke)Qi(r.stroke,t)&&(Ji(r.stroke[t])||(s[t]=r.stroke[t]));for(const t in r.fill)Qi(r.fill,t)&&(Ji(r.fill[t])||(s[t]=r.fill[t]))}const o=Array.isArray(t.markerPath)?t.markerPath:[t.markerPath];let a;const h=[];for(let t=0;t<o.length;t++)a=Yi(o[t])?{path:o[t]}:o[t],a=Gi({},a,s),a.d=a.path,delete a.path,h.push(a);const u=[\'<svg version="1.1"\',\'xmlns="http://www.w3.org/2000/svg"\'];e<1&&u.push(\'opacity="\'+e+\'"\'),t.markerPathWidth&&t.markerPathHeight&&u.push(\'viewBox="0 0 \'+t.markerPathWidth+" "+t.markerPathHeight+\'"\'),u.push(\'preserveAspectRatio="none"\'),n&&u.push(\'width="\'+n+\'"\'),i&&u.push(\'height="\'+i+\'"\'),u.push("><defs></defs>");for(let t=0;t<h.length;t++){let n="<path ";for(const i in h[t])Qi(h[t],i)&&(n+=" "+i+\'="\'+h[t][i]+\'"\');n+="></path>",u.push(n)}return u.push("</svg>"),"data:image/svg+xml;base64,"+btoa(u.join(" "))}(k,T[0],T[1]):null;A.icon={url:t,size:T}}if(I){const t=w?w(null,P):k.textName;if(t||0===t){const n=function(t,n,i){return[n||"normal",i||"normal","24px",t||"monospace"].join(" ")}(M?M(null,P):k.textFaceName,b?b(null,P):k.textStyle,x?x(null,P):k.textWeight);let i=ve(t,P);i&&i.length&&(i=tr(i),A.glyph={font:n,text:i})}}return this.iconGlyph=A,A}}function er(t,n){n&&"middle"!==n||(n="center"),t&&"middle"!==t||(t="center");let i="center"!==n?n:"";return i+="center"!==t?(i.length?"-":"")+t:"",i\n/*!\n * From mapbox-gl-js\n * MIT License\n * https://github.com/mapbox/mapbox-gl-js\n */}function rr(t,n,i,e,r){const s=[];for(let o=0;o<t.length;o++){const a=t[o];let h;for(let t=0;t<a.length-1;t++){let o=a[t],u=a[t+1];o.x<n&&u.x<n||(o.x<n?o=new Ht(n,o.y+(n-o.x)/(u.x-o.x)*(u.y-o.y)).I():u.x<n&&(u=new Ht(n,o.y+(n-o.x)/(u.x-o.x)*(u.y-o.y)).I()),o.y<i&&u.y<i||(o.y<i?o=new Ht(o.x+(i-o.y)/(u.y-o.y)*(u.x-o.x),i).I():u.y<i&&(u=new Ht(o.x+(i-o.y)/(u.y-o.y)*(u.x-o.x),i).I()),o.x>=e&&u.x>=e||(o.x>=e?o=new Ht(e,o.y+(e-o.x)/(u.x-o.x)*(u.y-o.y)).I():u.x>=e&&(u=new Ht(e,o.y+(e-o.x)/(u.x-o.x)*(u.y-o.y)).I()),o.y>=r&&u.y>=r||(o.y>=r?o=new Ht(o.x+(r-o.y)/(u.y-o.y)*(u.x-o.x),r).I():u.y>=r&&(u=new Ht(o.x+(r-o.y)/(u.y-o.y)*(u.x-o.x),r).I()),h&&o.equals(h[h.length-1])||(h=[o],s.push(h)),h.push(u)))))}}return s}class sr extends Ht{constructor(t,n,i,e){super(t,n),this.angle=i,void 0!==e&&(this.segment=e)}clone(){return new sr(this.x,this.y,this.angle,this.segment)}}\n/*!\n * From mapbox-gl-js\n * MIT License\n * https://github.com/mapbox/mapbox-gl-js\n */function or(t,n,i,e,r){if(void 0===n.segment)return!0;let s=n,o=n.segment+1,a=0;for(;a>-i/2;){if(o--,o<0)return!1;a-=t[o].dist(s),s=t[o]}a+=t[o].dist(t[o+1]),o++;const h=[];let u=0;for(;a<i/2;){const n=t[o],i=t[o+1];if(!i)return!1;let s=t[o-1].angleTo(n)-n.angleTo(i);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),h.push({distance:a,angleDelta:s}),u+=s;a-h[0].distance>e;)u-=h.shift().angleDelta;if(u>r)return!1;o++,a+=n.dist(i)}return!0}function ar(t,n,i,e,r,s,o,a,h){const u=function(t,n,i){return t?.6*n*i:0}(e,s,o),l=function(t,n){return Math.max(t?t.right-t.left:0,n?n.right-n.left:0)}(e,r),c=0===t[0].x||t[0].x===h||0===t[0].y||t[0].y===h;return n-l*o<n/4&&(n=l*o+n/4),function t(n,i,e,r,s,o,a,h,u){const l=o/2,c=function(t){let n=0;for(let i=0;i<t.length-1;i++)n+=t[i].dist(t[i+1]);return n}(n);let f=0,d=i-e,y=[];for(let t=0;t<n.length-1;t++){const i=n[t],a=n[t+1],h=i.dist(a),v=a.angleTo(i);for(;d+e<f+h;){d+=e;const p=(d-f)/h,m=hr(i.x,a.x,p),g=hr(i.y,a.y,p);if(m>=0&&m<u&&g>=0&&g<u&&d-l>=0&&d+l<=c){const i=new sr(m,g,v,t);i.line=n,i.I(),r&&!or(n,i,o,r,s)||y.push(i)}}f+=h}return h||y.length||a||(y=t(n,f/2,e,r,s,o,a,!0,u)),y}(t,c?n/2*a%n:(l/2+2*s)*o*a%n,n,u,i,l*o,c,!1,h)}function hr(t,n,i){return t*(1-i)+n*i}function ur(t,n){const i=t.length;if(i<=1)return[t];const e=[];let r,s;for(let n=0;n<i;n++){const i=ne(t[n]);0!==i&&(t[n].area=Math.abs(i),void 0===s&&(s=i<0),s===i<0?(r&&e.push(r),r=[t[n]]):r.push(t[n]))}if(r&&e.push(r),n>1)for(let t=0;t<e.length;t++)e[t].length<=n||(Bt(e[t],n,1,e[t].length-1,lr),e[t]=e[t].slice(0,n));return e}function lr(t,n){return n.area-t.area}function cr(t,n,i){const e=n.distSqr(i);if(0===e)return t.distSqr(n);const r=((t.x-n.x)*(i.x-n.x)+(t.y-n.y)*(i.y-n.y))/e;return t.distSqr(r<0?n:r>1?i:i.sub(n).F(r).u(n))}function fr(t,n=1,i=!1){let e=1/0,r=1/0,s=-1/0,o=-1/0;const a=t[0];for(let t=0;t<a.length;t++){const n=a[t];(!t||n.x<e)&&(e=n.x),(!t||n.y<r)&&(r=n.y),(!t||n.x>s)&&(s=n.x),(!t||n.y>o)&&(o=n.y)}const h=Math.min(s-e,o-r);let u=h/2;const l=new Zt(null,dr);if(0===h)return new Ht(e,r);for(let n=e;n<s;n+=h)for(let i=r;i<o;i+=h)l.push(new yr(n+u,i+u,u,t));let c=function(t){let n=0,i=0,e=0;const r=t[0];for(let t=0,s=r.length,o=s-1;t<s;o=t++){const s=r[t],a=r[o],h=s.x*a.y-a.x*s.y;i+=(s.x+a.x)*h,e+=(s.y+a.y)*h,n+=3*h}return new yr(i/n,e/n,0,t)}(t),f=l.length;for(;l.length;){const e=l.pop();(e.d>c.d||!c.d)&&(c=e,i&&console.log("found best %d after %d probes",Math.round(1e4*e.d)/1e4,f)),e.max-c.d<=n||(u=e.h/2,l.push(new yr(e.p.x-u,e.p.y-u,u,t)),l.push(new yr(e.p.x+u,e.p.y-u,u,t)),l.push(new yr(e.p.x-u,e.p.y+u,u,t)),l.push(new yr(e.p.x+u,e.p.y+u,u,t)),f+=4)}return i&&(console.log("num probes: "+f),console.log("best distance: "+c.d)),c.p}function dr(t,n){return n.max-t.max}function yr(t,n,i,e){this.p=new Ht(t,n),this.h=i,this.d=function(t,n){let i=!1,e=1/0;for(let r=0;r<n.length;r++){const s=n[r];for(let n=0,r=s.length,o=r-1;n<r;o=n++){const r=s[n],a=s[o];r.y>t.y!=a.y>t.y&&t.x<(a.x-r.x)*(t.y-r.y)/(a.y-r.y)+r.x&&(i=!i),e=Math.min(e,cr(t,r,a))}}return(i?1:-1)*Math.sqrt(e)}(this.p,e),this.max=this.d+this.h*Math.SQRT2}const vr=45*Math.PI/100;function pr(t,n){const i={},e={},r=[];let s=0;function o(n){r.push(t[n]),s++}function a(t,n,i){const s=e[t];return delete e[t],e[n]=s,r[s].geometry[0].pop(),r[s].geometry[0]=r[s].geometry[0].concat(i[0]),s}function h(t,n,e){const s=i[n];return delete i[n],i[t]=s,r[s].geometry[0].shift(),r[s].geometry[0]=e[0].concat(r[s].geometry[0]),s}function u(t,n,i){const e=i?n[0][n[0].length-1]:n[0][0];return`${t}:${e.x}:${e.y}`}for(let l=0;l<t.length;l++){const c=t[l],f=c.geometry;if(!f)continue;const d=c.properties[n]?c.properties[n].toString():null;if(!d){o(l);continue}const y=u(d,f),v=u(d,f,!0);if(y in e&&v in i&&e[y]!==i[v]){const t=h(y,v,f),n=a(y,v,r[t].geometry);delete i[y],delete e[v],e[u(d,r[n].geometry,!0)]=n,r[t].geometry=null}else y in e?a(y,v,f):v in i?h(y,v,f):(o(l),i[y]=s-1,e[v]=s-1)}return r.filter(t=>t.geometry)}class mr extends le{static needMerge(t){return t.mergeOnProperty&&("line"===t.textPlacement||"line"===t.markerPlacement)}static mergeLineFeatures(t,n,i){const e="__index".trim(),r=function(t,n,i){const e="__index".trim(),r=le.genFnTypes(n),{mergeOnPropertyFn:s}=r;if(!n.mergeOnProperty||"line"!==n.textPlacement&&"line"!==n.markerPlacement)return[];if(!(oe(o=n.mergeOnProperty)||"string"!=typeof o&&(null===o.constructor||o.constructor!==String)||"line"!==n.textPlacement&&"line"!==n.markerPlacement))return[{features:t,property:n.mergeOnProperty}];var o;const a=[],h={},u=[];for(let r=0;r<t.length;r++){t[r][e]=r;const o=t[r].properties=t[r].properties||{};o.$layer=t[r].layer,o.$type=t[r].type;let l=n.markerPlacement;"line"!==l&&(l=n.textPlacement);const c=s?s(i,o):n.mergeOnProperty;"line"!==l||oe(c)?u.push(t[r]):(void 0===h[c]&&(h[c]=a.length,a.push({features:[],property:c})),a[h[c]].features.push(t[r]))}return u.length&&a.push({features:u}),a}(t,n,i);if(r.length){const n=[];for(let i=0;i<r.length;i++)n.push(r[i].property?pr(r[i].features,r[i].property):t);if(1===n.length)return n[0];{let t=[];for(let i=0;i<n.length;i++)t=t.concat(n[i]);return t.sort((t,n)=>t[e]-n[e]),t}}}static splitPointSymbol(t,n=0){const i=[];if(Array.isArray(t)){const n=t;for(let t=0;t<n.length;t++)n[t]&&i.push(...mr.splitPointSymbol(n[t],t));return i}let e=null,r=null;for(const n in t)0===n.indexOf("marker")?(e=e||{},e[n]=t[n]):0===n.indexOf("text")&&(r=r||{},r[n]=t[n]);return e&&(e.isIconText=!0,t.mergeOnProperty&&(e.mergeOnProperty=t.mergeOnProperty),i.push(e)),r&&(e&&(r.textPlacement=e.markerPlacement,r.textSpacing=e.markerSpacing,r.isIconText=!0),t.mergeOnProperty&&(r.mergeOnProperty=t.mergeOnProperty),i.push(r)),void 0!==t.visible&&(e&&(e.visible=t.visible),r&&(r.visible=t.visible)),e&&(e.markerTextFit&&r&&(e.text={},e.text.textName=r.textName,e.text.textSize=r.textSize),e.index={index:n,type:0}),r&&(r.index={index:n,type:1}),i}static isAtlasLoaded(t,n){const{icon:i,glyph:e}=t,{iconAtlas:r,glyphAtlas:s}=n;if(i&&(!r||!r.positions[i.url]))return!1;if(e){if(!s||!s.positions[e.font])return!1;const t=s.positions[e.font],{text:n}=e;for(let i=0;i<n.length;i++)if(!t[n.charCodeAt(i)])return!1}return!0}constructor(t,n,i){super(t,n,i)}createStyledVector(t,n,i,e,r,s){const o=new ir(t,this.symbolDef,n,i,e),a=o.getIconAndGlyph();if(a.icon&&!this.options.atlas){const{url:t,size:n}=a.icon;r[t]||(r[t]=a.icon.size),r[t][0]<n[0]&&(r[t][0]=n[0]),r[t][1]<n[1]&&(r[t][1]=n[1])}if(a.glyph&&!this.options.atlas){const{font:t,text:i}=a.glyph,e=s[t]=s[t]||{};for(let t=0;t<i.length;t++)e[i.charCodeAt(t)]=1;"line"===n.textPlacement&&(s.options={isCharsCompact:!1})}return this.options.allowEmptyPack||a.icon||a.glyph?o:null}getFormat(t){const n=void 0!==t.textName,i=n?function(t){return"line"!==t.textPlacement||t.isIconText?[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"},{type:Uint8Array,width:1,name:"aCount"}]:[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"},{type:Uint8Array,width:1,name:"aCount"},{type:Int16Array,width:2,name:"aGlyphOffset"},{type:Uint16Array,width:3,name:"aSegment"},{type:Uint8Array,width:1,name:"aVertical"}]}(t):[{type:Int16Array,width:3,name:"aPosition"},{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"}];n?i.push(...this.q()):i.push(...this.B());const{markerOpacityFn:e,textOpacityFn:r,markerPitchAlignmentFn:s,textPitchAlignmentFn:o,markerRotationAlignmentFn:a,textRotationAlignmentFn:h,markerRotationFn:u,textRotationFn:l,markerAllowOverlapFn:c,textAllowOverlapFn:f,markerIgnorePlacementFn:d,textIgnorePlacementFn:y}=this.C;return(e||r)&&i.push({type:Uint8Array,width:1,name:"aColorOpacity"}),(s||o)&&i.push({type:Uint8Array,width:1,name:"aPitchAlign"}),(a||h)&&i.push({type:Uint8Array,width:1,name:"aRotationAlign"}),(u||l)&&i.push({type:Uint16Array,width:1,name:"aRotation"}),(c||f||d||y)&&i.push({type:Uint8Array,width:1,name:"aOverlap"}),i}q(){const{textFillFn:t,textSizeFn:n,textHaloFillFn:i,textHaloRadiusFn:e,textHaloOpacityFn:r,textDxFn:s,textDyFn:o}=this.C,a=[];return t&&a.push({type:Uint8Array,width:4,name:"aTextFill"}),n&&a.push({type:Uint8Array,width:1,name:"aTextSize"}),i&&a.push({type:Uint8Array,width:4,name:"aTextHaloFill"}),e&&a.push({type:Uint8Array,width:1,name:"aTextHaloRadius"}),r&&a.push({type:Uint8Array,width:1,name:"aTextHaloOpacity"}),s&&a.push({type:Int8Array,width:1,name:"aTextDx"}),o&&a.push({type:Int8Array,width:1,name:"aTextDy"}),a}B(){const{markerWidthFn:t,markerHeightFn:n,markerDxFn:i,markerDyFn:e}=this.C,r=[];return t&&r.push({type:Uint8Array,width:1,name:"aMarkerWidth"}),n&&r.push({type:Uint8Array,width:1,name:"aMarkerHeight"}),i&&r.push({type:Int8Array,width:1,name:"aMarkerDx"}),e&&r.push({type:Int8Array,width:1,name:"aMarkerDy"}),r}createDataPack(){if(!this.iconAtlas&&!this.glyphAtlas){if(!this.options.allowEmptyPack)return null;this.empty=!0}this.lineVertex=[];const t=super.createDataPack.apply(this,arguments);return t?(t.lineVertex=new Int16Array(this.lineVertex),t.buffers.push(t.lineVertex.buffer),t):null}placeVector(t,n){const i=t.getShape(this.iconAtlas,this.glyphAtlas);if(!this.options.allowEmptyPack&&!i)return;const e=this.G(t,i,n);if(0===e.length)return;const r=this.data;let s=this.data.aPosition.length/3;const o=t.symbol,a=t.feature.properties,h="line"===o.textPlacement&&!o.isIconText,u=void 0!==o.textName,l=u&&h&&function(t){let n=0;for(let i=0;i<t.length;i++)if(He(t.charAt(i).charCodeAt(0)))n=0;else if(n++,n>=1)return!1;return!0}(t.getIconAndGlyph().glyph.text)?1:0,{textFillFn:c,textSizeFn:f,textHaloFillFn:d,textHaloRadiusFn:y,textHaloOpacityFn:v,textDxFn:p,textDyFn:g,textPitchAlignmentFn:w,textRotationAlignmentFn:M,textRotationFn:b,textAllowOverlapFn:x,textIgnorePlacementFn:F,textOpacityFn:A,markerWidthFn:k,markerHeightFn:P,markerDxFn:S,markerDyFn:_,markerPitchAlignmentFn:O,markerRotationAlignmentFn:I,markerRotationFn:T,markerAllowOverlapFn:L,markerIgnorePlacementFn:U,markerOpacityFn:z}=this.C;let D,E,C,j,N,H,V,R,$,W,q,B,G,J,X,Z,Y;if(u){const n=t.getIconAndGlyph().glyph.font;D=function(t,n,i){const e=t.positionedGlyphs,r=[];for(let s=0;s<e.length;s++){const o=e[s],a=i[o.glyph];if(!a)continue;const h=a.rect;if(!h)continue;const u=4,l=a.metrics.advance/2,c=a.metrics.height/2,f=n?[o.x+l,0]:[0,0],d=n?[0,o.y-c]:[o.x+l,o.y-c],y=a.metrics.left-u-l+d[0],v=a.metrics.top-u+d[1],p=y+h.w,m=v+h.h,g=new Ht(y,v),w=new Ht(p,v),M=new Ht(y,m),b=new Ht(p,m);if(n&&o.vertical){const t=new Ht(-l,l),n=-Math.PI/2,i=new Ht(5,0);g.P(n,t).u(i),w.P(n,t).u(i),M.P(n,t).u(i),b.P(n,t).u(i)}r.push({tl:g,tr:w,bl:M,br:b,tex:h,writingMode:t.writingMode,glyphOffset:f})}return r}(i.horizontal,h,this.glyphAtlas.positions[n]),c&&(E=c(null,a),m(E)?E=[0,0,0,0]:(E=Array.isArray(E)?E.map(t=>255*t):Vn(E).array(),3===E.length&&E.push(255))),f&&(C=f(this.options.zoom,a),oe(C)&&(C=14)),d&&(j=d(null,a),j=Array.isArray(j)?j.map(t=>255*t):Vn(j).array(),3===j.length&&j.push(255)),y&&(N=y(null,a)),v&&(H=255*v(null,a)),p&&(V=p(null,a)||0),g&&(R=g(null,a)||0),w&&(G=+("map"===w(null,a))),M&&(J=+("map"===M(null,a))),b&&(X=ae(b(null,a),0,360)*Math.PI/180)}else D=i?function(t){const n=t.image,i=t.top-1/n.pixelRatio,e=t.left-1/n.pixelRatio,r=t.bottom+1/n.pixelRatio,s=t.right+1/n.pixelRatio;let o,a,h,u;return o=new Ht(e,i),a=new Ht(s,i),h=new Ht(s,r),u=new Ht(e,r),[{tl:o,tr:a,bl:u,br:h,tex:{x:n.tl[0],y:n.tl[1],w:n.displaySize[0],h:n.displaySize[1]},writingMode:void 0,glyphOffset:[0,0]}]}(i):function(){const t=new Ht(0,0),n=new Ht(0,0),i=new Ht(0,0);return[{tl:t,tr:n,bl:new Ht(0,0),br:i,tex:{x:0,y:0,w:0,h:0},writingMode:void 0,glyphOffset:[0,0]}]}(),k&&($=k(null,a)),P&&(W=P(null,a)),S&&(q=S(null,a)),_&&(B=_(null,a)),O&&(G=+("map"===O(null,a))),I&&(J=+("map"===I(null,a))),T&&(X=ae(T(null,a),0,360)*Math.PI/180);const K=L||x;K&&(Z=K(null,a)||0);const Q=U||F;let tt;Q&&(Y=Q(null,a)||0);const nt=A||z;nt&&(tt=255*nt(this.options.zoom,a));const it=this.options.EXTENT,et=D.length,rt=this.getAltitude(t.feature.properties);for(let t=0;t<e.length;t++){const n=e[t];if(it!==1/0&&se(n,it))continue;const i=n.x,o=n.y,a=D.length;for(let t=0;t<a;t++){const e=D[t],{tl:a,tr:c,bl:f,br:d,tex:y}=e;this.J(r,i,o,rt,10*a.x,10*a.y,y.x,y.y+y.h),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*c.x,10*c.y,y.x+y.w,y.y+y.h),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*f.x,10*f.y,y.x,y.y),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.J(r,i,o,rt,10*d.x,10*d.y,y.x+y.w,y.y),u&&this.X(r,h,et,e.glyphOffset,n,l),this.Z(r,E,C,j,N,H,V,R,$,W,q,B,tt,G,J,X,Z,Y),this.addElements(s,s+1,s+2),this.addElements(s+1,s+2,s+3),s+=4;const v=Math.max(Math.abs(i),Math.abs(o),Math.abs(rt));v>this.maxPos&&(this.maxPos=v)}}}J(t,n,i,e,r,s,o,a){t.aPosition.push(n,i,e),t.aShape.push(r,s),t.aTexCoord.push(o,a)}X(t,n,i,e,r,s){if(t.aCount.push(i),n){t.aGlyphOffset.push(e[0],e[1]);const n=r.startIndex;t.aSegment.push(r.segment+n,n,r.line.length),t.aVertical.push(s)}}Z(t,n,i,e,r,s,o,a,h,u,l,c,f,d,y,v,p,m){const{textFillFn:g,textSizeFn:w,textHaloFillFn:M,textHaloRadiusFn:b,textHaloOpacityFn:x,textDxFn:F,textDyFn:A,textPitchAlignmentFn:k,textRotationAlignmentFn:P,textRotationFn:S,textAllowOverlapFn:_,textIgnorePlacementFn:O,textOpacityFn:I,markerWidthFn:T,markerHeightFn:L,markerDxFn:U,markerDyFn:z,markerPitchAlignmentFn:D,markerRotationAlignmentFn:E,markerRotationFn:C,markerAllowOverlapFn:j,markerIgnorePlacementFn:N,markerOpacityFn:H}=this.C;g&&t.aTextFill.push(...n),w&&t.aTextSize.push(i),M&&t.aTextHaloFill.push(...e),b&&t.aTextHaloRadius.push(r),x&&t.aTextHaloOpacity.push(s),F&&t.aTextDx.push(o),A&&t.aTextDy.push(a),T&&t.aMarkerWidth.push(h),L&&t.aMarkerHeight.push(u),U&&t.aMarkerDx.push(l),z&&t.aMarkerDy.push(c),(H||I)&&t.aColorOpacity.push(f),(k||D)&&t.aPitchAlign.push(d),(E||P)&&t.aRotationAlign.push(y),(C||S)&&t.aRotation.push(9362*v);const V=j||_,R=N||O;(V||R)&&t.aOverlap.push((V?8:0)+4*p+((R?2:0)+m)),r>0&&(this.properties.hasHalo=1)}G(t,n,i){const{feature:e,symbol:r}=t,s=this.Y(t,r),o=e.properties,{markerSpacingFn:a,textSpacingFn:h}=this.C,u=((a?a(null,o):r.markerSpacing)||(h?h(null,o):r.textSpacing)||250)*i;return function(t,n,i,e,r,s,o){const{feature:a,size:h,symbol:u}=t,l=h?24:0,c=e*(h?h[0]/l:1),f=[];if("line"===s){let t=a.geometry;r&&(t=rr(a.geometry,0,0,r,r));for(let e=0;e<t.length;e++){const s=ar(t[e],o,vr,u.isIconText?null:i.vertical||i.horizontal||i,null,l,u.isIconText?1:c,1,r||1/0);if(u.textPlacement&&!u.isIconText)for(let t=0;t<s.length;t++)s[t].startIndex=n.length/3;if(f.push.apply(f,s),u.textPlacement&&!u.isIconText)for(let i=0;i<t[e].length;i++)n.push(t[e][i].x,t[e][i].y,0)}}else if(3===a.type){const t=ur(a.geometry,0);for(let n=0;n<t.length;n++){const i=t[n];if("vertex"===s)for(let t=0;t<i.length;t++){const n=i[t];for(let t=0;t<n.length;t++)se(n[t],r)||f.push(n[t])}else{const t=fr(i,16);se(t,r)||f.push(t)}}}else if(2===a.type)for(let t=0;t<a.geometry.length;t++){const n=a.geometry[t];if("vertex"===s)for(let t=0;t<n.length;t++)se(n[t],r)||f.push(n[t]);else se(n[0],r)||f.push(n[0])}else if(1===a.type)for(let t=0;t<a.geometry.length;t++){const n=a.geometry[t];for(let t=0;t<n.length;t++){const i=n[t];se(i,r)||f.push(i)}}return f}(t,this.lineVertex,n,i,this.options.EXTENT,s,u)}Y(t,n){return this.C.markerPlacementFn?this.C.markerPlacementFn(this.options.zoom,t.feature.properties):n.markerPlacement||n.textPlacement}}const gr=Math.cos(Math.PI/180*37.5),wr=Math.pow(2,16)/1;class Mr extends le{constructor(t,n,i){super(t,n,i);let e=!1;const{lineDasharrayFn:r,lineDashColorFn:s}=this.C;r&&(e=function(t,n,i){for(let e=0;e<t.length;e++)if(i(n,t[e].properties))return!0;return!1}(t,this.options.zoom,r),e&&(this.dasharrayFn=r)),(Fr(this.symbol.lineDasharray)||e)&&s&&(this.dashColorFn=s)}createStyledVector(t,n,i,e,r){const s=new he(t,n,i,e),o=s.getLineResource();return!this.options.atlas&&o&&(r[o]=[0,0]),s}getFormat(){const{lineWidthFn:t,lineStrokeWidthFn:n,lineStrokeColorFn:i,lineColorFn:e,lineOpacityFn:r,lineDxFn:s,lineDyFn:o,linePatternAnimSpeedFn:a,linePatternGapFn:h}=this.C,u=[{type:Int16Array,width:3,name:"aPosition"}];if(u.push(this.options.center||this.iconAtlas?{type:Int8Array,width:3,name:"aExtrude"}:{type:Int8Array,width:2,name:"aExtrude"}),u.push({type:Uint16Array,width:1,name:"aLinesofar"}),t&&u.push({type:Uint8Array,width:1,name:"aLineWidth"}),n&&u.push({type:Uint8Array,width:1,name:"aLineStrokeWidth"}),e&&u.push({type:Uint8Array,width:4,name:"aColor"}),i&&u.push({type:Uint8Array,width:4,name:"aStrokeColor"}),r&&u.push({type:Uint8Array,width:1,name:"aOpacity"}),this.symbol.lineOffset&&u.push({type:Int8Array,width:2,name:"aExtrudeOffset"}),this.dasharrayFn&&u.push({type:Uint8Array,width:4,name:"aDasharray"}),this.dashColorFn&&u.push({type:Uint8Array,width:4,name:"aDashColor"}),this.iconAtlas){const t=this.getIconAtlasMaxValue();u.push({type:t>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return s&&u.push({type:Int8Array,width:1,name:"aLineDx"}),o&&u.push({type:Int8Array,width:1,name:"aLineDy"}),a&&u.push({type:Int8Array,width:1,name:"aLinePatternAnimSpeed"}),h&&u.push({type:Uint8Array,width:1,name:"aLinePatternGap"}),u}placeVector(t){const{lineJoinFn:n,lineCapFn:i,lineWidthFn:e,lineStrokeWidthFn:r,lineStrokeColorFn:s,lineColorFn:o,lineOpacityFn:a,lineJoinPatternModeFn:h,lineDxFn:u,lineDyFn:l,linePatternAnimSpeedFn:c,linePatternGapFn:f}=this.C,d=this.symbol,y=t.feature,v=3===y.type,p=y.properties,g=this.elements;v&&(this.elements=[]);let w=d.lineJoin||"miter",M=d.lineCap||"butt";if(n&&(w=n(this.options.zoom,p)||"miter"),i&&(M=i(this.options.zoom,p)||"butt"),e){let t=e(this.options.zoom,p);Ji(t)&&(t=4),this.feaLineWidth=t}else this.feaLineWidth=d.lineWidth;if(r){let t=r(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineStrokeWidth=t}else this.feaLineStrokeWidth=d.lineStrokeWidth||0;if(o&&(this.feaColor=o(this.options.zoom,p)||[0,0,0,255],m(this.feaColor)?this.feaColor=[0,0,0,0]:(this.feaColor=Array.isArray(this.feaColor)?this.feaColor.map(t=>255*t):Vn(this.feaColor).array(),3===this.feaColor.length&&this.feaColor.push(255))),s&&(this.feaStrokeColor=s(this.options.zoom,p)||[0,0,0,255],m(this.feaStrokeColor)?this.feaStrokeColor=[0,0,0,0]:(this.feaStrokeColor=Array.isArray(this.feaStrokeColor)?this.feaStrokeColor.map(t=>255*t):Vn(this.feaStrokeColor).array(),3===this.feaStrokeColor.length&&this.feaStrokeColor.push(255))),a){let t=a(this.options.zoom,p);Ji(t)&&(t=1),this.feaOpacity=255*t}if(this.dasharrayFn){let t=this.dasharrayFn(this.options.zoom,p)||[0,0,0,0];if(t.length<4){const n=t;1===t.length?t=[n[0],n[0],n[0],n[0]]:2===t.length?t=[n[0],n[1],n[0],n[1]]:3===t.length&&(t=[n[0],n[1],n[2],n[2]])}this.feaDash=t}if(this.dashColorFn){let t=(this.dashColorFn?this.dashColorFn(this.options.zoom,p):this.symbol.lineDashColor)||[0,0,0,0];t=Array.isArray(t)?t.map(t=>255*t):Vn(t).array(),3===t.length&&t.push(255),this.feaDashColor=t}if(this.iconAtlas){const n=t.getLineResource(),i=this.iconAtlas.glyphMap[n];if(this.feaTexInfo=this.feaTexInfo||[0,0,0,0],i){const{tl:t,displaySize:i}=this.iconAtlas.positions[n];this.feaTexInfo[0]=t[0]+1,this.feaTexInfo[1]=t[1]+1,this.feaTexInfo[2]=i[0]-3,this.feaTexInfo[3]=i[1]-3}else this.feaTexInfo[0]=this.feaTexInfo[1]=this.feaTexInfo[2]=this.feaTexInfo[3]=0;this.feaJoinPatternMode=h?h(this.options.zoom,p)||0:d.lineJoinPatternMode||0}if(u){let t=u(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineDx=t}if(l){let t=l(this.options.zoom,p);Ji(t)&&(t=0),this.feaLineDy=t}if(c){let t=c(this.options.zoom,p);Ji(t)&&(t=0),0!==t&&(this.properties.hasPatternAnim=1),this.feaPatternAnimSpeed=t}if(f){let t=f(this.options.zoom,p);Ji(t)&&(t=0),this.feaLinePatternGap=t}const b=this.options.EXTENT;let x=y.geometry;b!==1/0&&3!==y.type&&(x=rr(y.geometry,-1,-1,b+1,b+1));for(let t=0;t<x.length;t++)this.offset=this.data.aPosition.length/3,this.K(x[t],y,w,M,2,1.05),v&&(this.tt(g),this.elements=[]);v&&(this.elements=g)}nt(){return this.iconAtlas&&this.feaTexInfo[2]&&this.feaTexInfo[3]}K(t,n,i,e,r,s){const o=this.nt()||Fr(this.feaDash)||Fr(this.symbol.lineDasharray);this.overscaling=1;const a=this.options.EXTENT;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.symbol.lineGradientProperty&&n.properties&&Qi(n.properties,"mapbox_clip_start")&&Qi(n.properties,"mapbox_clip_end")){this.clipStart=+n.properties.mapbox_clip_start,this.clipEnd=+n.properties.mapbox_clip_end;for(let n=0;n<t.length-1;n++)this.totalDistance+=t[n].dist(t[n+1]);this.updateScaledDistance()}const h=3===n.type;let u=t.length;for(;u>=2&&t[u-1].equals(t[u-2]);)u--;let l=0;for(;l<u-1&&t[l].equals(t[l+1]);)l++;if(u<(h?3:2))return;"bevel"===i&&(r=1.05);const c=this.overscaling<=16?15*a/(512*this.overscaling):0,f={vertexLength:0,primitiveLength:0};let d,y,v,p,m;this.e1=this.e2=-1,h&&(d=t[u-2],m=t[l].sub(d)._().O());for(let n=l;n<u;n++){if(v=n===u-1?h?t[l+1]:void 0:t[n+1],v&&t[n].equals(v))continue;m&&(p=m),d&&(y=d),d=t[n],m=v?v.sub(d)._().O():p,p=p||m;let a=p.add(m);0===a.x&&0===a.y||a._();const g=p.x*m.x+p.y*m.y,w=a.x*m.x+a.y*m.y,M=0!==w?1/w:1/0,b=2*Math.sqrt(2-2*w),x=w<gr&&y&&v,F=p.x*m.y-p.y*m.x>0;if(!o&&x&&n>l){const t=d.dist(y);if(t>2*c){const n=d.sub(d.sub(y).F(c/t).I());this.updateDistance(y,n),this.addCurrentVertex(n,p,0,0,f),y=n}}const A=y&&v;let k=A?i:h?"butt":e;if(A&&"round"===k&&(M<s?k="miter":M<=2&&(k="fakeround")),"miter"===k&&M>r&&(k="bevel"),"bevel"===k&&(M>2&&(k="flipbevel"),M<r&&(k="miter")),y&&this.updateDistance(y,d),(n>l&&n<u-1||h&&n===u-1)&&o){const t=this.feaJoinPatternMode?0:-p.mag()*w;this.addCurrentVertex(d,p,t,t,f),this.it=1}if("miter"===k)a.F(M),this.addCurrentVertex(d,a,0,0,f);else if("flipbevel"===k){if(M>100)a=m.mult(-1);else{const t=M*p.add(m).mag()/p.sub(m).mag();a.O().F(t*(F?-1:1))}this.addCurrentVertex(d,a,0,0,f),this.addCurrentVertex(d,a.mult(-1),0,0,f)}else if("bevel"===k||"fakeround"===k){const t=-Math.sqrt(M*M-1),n=F?t:0,i=F?0:t;if(y&&this.addCurrentVertex(d,p,n,i,f),"fakeround"===k){const t=Math.round(180*b/Math.PI/20);for(let n=1;n<t;n++){let i=n/t;if(.5!==i){const t=i-.5;i+=i*t*(i-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*t*t+(.848013+g*(.215638*g-1.06021)))}const e=m.sub(p).F(i).u(p)._().F(F?-1:1);this.addHalfVertex(d,e.x,e.y,!1,F,0,f)}}v&&this.addCurrentVertex(d,m,-n,-i,f)}else if("butt"===k)this.addCurrentVertex(d,a,0,0,f);else if("square"===k){const t=y?1:-1;this.addCurrentVertex(d,a,t,t,f)}else"round"===k&&(y&&(this.addCurrentVertex(d,p,0,0,f),this.addCurrentVertex(d,p,1,1,f,!0)),v&&(this.addCurrentVertex(d,m,-1,-1,f,!0),this.addCurrentVertex(d,m,0,0,f)));if(!o&&x&&n<u-1){const t=d.dist(v);if(t>2*c){const n=d.add(v.sub(d).F(c/t).I());this.updateDistance(d,n),this.addCurrentVertex(n,m,0,0,f),d=n}}if((n>l&&n<u-1||h&&n===l)&&o){delete this.it;const t=this.feaJoinPatternMode?0:m.mag()*w;this.addCurrentVertex(d,m,t,t,f)}}}addCurrentVertex(t,n,i,e,r,s=!1){const o=n.y*e-n.x,a=-n.y-n.x*e;this.addHalfVertex(t,n.x+n.y*i,n.y-n.x*i,s,!1,i,r),this.addHalfVertex(t,o,a,s,!0,-e,r),this.distance>wr/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,n,i,e,r,s))}addHalfVertex({x:t,y:n},i,e,r,s,o,a){this.fillData(this.data,t,n,i,e,r,s,1*this.scaledDistance);const h=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.addElements(this.e1,this.e2,h),a.primitiveLength++),s?this.e2=h:this.e1=h}fillData(t,n,i,e,r,s,o,a){const{lineWidthFn:h,lineStrokeWidthFn:u,lineStrokeColorFn:l,lineColorFn:c,lineOpacityFn:f,lineDxFn:d,lineDyFn:y,linePatternAnimSpeedFn:v,linePatternGapFn:p}=this.C;if(this.options.center?t.aPosition.push(n,i,0):t.aPosition.push(n=(n<<1)+(s?1:0),i=(i<<1)+(o?1:0),0),t.aExtrude.push(63*e,63*r),this.options.center||this.iconAtlas){let n=0;this.options.center&&(n+=2*s+o),this.iconAtlas&&(n+=4*(this.it&&this.feaJoinPatternMode?1:0)),t.aExtrude.push(n)}t.aLinesofar.push(a),h&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),u&&t.aLineStrokeWidth.push(Math.round(2*this.feaLineStrokeWidth)),c&&t.aColor.push(...this.feaColor),l&&t.aStrokeColor.push(...this.feaStrokeColor),f&&t.aOpacity.push(this.feaOpacity),this.dasharrayFn&&t.aDasharray.push(...this.feaDash),this.dashColorFn&&t.aDashColor.push(...this.feaDashColor),this.iconAtlas&&t.aTexInfo.push(...this.feaTexInfo),d&&t.aLineDx.push(this.feaLineDx),y&&t.aLineDy.push(this.feaLineDy),v&&t.aLinePatternAnimSpeed.push(127*this.feaPatternAnimSpeed),p&&t.aLinePatternGap.push(10*this.feaLinePatternGap),this.maxPos=Math.max(this.maxPos,Math.abs(n)+1,Math.abs(i)+1)}addElements(t,n,i){super.addElements(this.offset+t,this.offset+n,this.offset+i)}tt(t){const n=this.options.EXTENT,i=this.elements;for(let e=0;e<i.length;e+=3)n!==1/0&&(xr(this.data.aPosition,i[e],i[e+1],3,n)||xr(this.data.aPosition,i[e+1],i[e+2],3,n))||t.push(i[e],i[e+1],i[e+2])}et(t){if(t.length<=1)return t;const n=[],i=this.options.EXTENT;let e,r=!0;for(e=0;e<t.length-1;e++){const s=br(t[e],t[e+1],i);s&&r||(n.push(t[e]),r=s)}return r||n.push(t[e]),n}updateDistance(t,n){this.distance+=t.dist(n),this.updateScaledDistance()}updateScaledDistance(){this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(wr-1):this.distance}}function br(t,n,i){return i!==1/0&&(t.x<0&&n.x<0||t.x>i&&n.x>i||t.y<0&&n.y<0||t.y>i&&n.y>i)}function xr(t,n,i,e,r){if(r===1/0)return!1;const s=Math.floor(.5*t[n*e]),o=Math.floor(.5*t[n*e+1]),a=Math.floor(.5*t[i*e]),h=Math.floor(.5*t[i*e+1]);return s===a&&(s<0||s>r)&&o!==h||o===h&&(o<0||o>r)&&s!==a}function Fr(t){if(!Array.isArray(t))return!1;for(let n=0;n<t.length;n++)if(t[n])return!0;return!1}class Ar extends Mr{constructor(t,n,i){super(t,n,i),this.rt=i.altitudeProperty}getFormat(){const{lineColorFn:t,lineWidthFn:n}=this.C,i=[{type:Int16Array,width:3,name:"aPosition"},{type:Uint16Array,width:1,name:"aLinesofar"},{type:Uint8Array,width:1,name:"aUp"},{type:Int16Array,width:3,name:"aExtrudedPosition"},{type:Int8Array,width:2,name:"aExtrude"}];return t&&i.push({type:Uint8Array,width:4,name:"aColor"}),n&&i.push({type:Uint8Array,width:1,name:"aLineWidth"}),this.rt&&i.push({type:Array,width:1,name:"aLineHeight"}),i}placeVector(t){const n=t.feature;if(this.rt){const{altitudeScale:t,altitudeProperty:i,defaultAltitude:e,heightProperty:r,defaultHeight:s,minHeightProperty:o}=this.options,{altitude:a,height:h}=re(n,t,i,e,r,s,o);this.feaAltitude=a,this.feaMinHeight=(a-h)/a*32767,a>this.maxAltitude&&(this.maxAltitude=a)}return super.placeVector(t)}K(t,n,i,e,r,s){const o=this.data.aPosition.length/3;super.K(t,n,i,e,r,s);const a=this.data.aPosition.length/3,h=this.data.aPosition.length/3-this.offset;if(3!==n.type&&h>0&&!1!==this.options.side){const t=!1!==this.options.top?1:0,n=t+4;let i=this.data.aPosition.length/3;for(const t in this.data){const n=this.data[t],e=n.length/i;for(let t=0;t<e;t++)n.push(n[o*e+3*e+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[o*r+r*n+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[o*r+r*(n+3)+t])}super.addElements(t+1,h+1,h),super.addElements(h,h+1,h+2);const e=this.data.aPosition.length/3-this.offset;i=this.data.aPosition.length/3;for(const t in this.data){const n=this.data[t],e=n.length/i;for(let t=0;t<e;t++)n.push(n[a*e-e+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[a*r-n*r-r+t])}i=this.data.aPosition.length/3;for(const t in this.data){const e=this.data[t],r=e.length/i;for(let t=0;t<r;t++)e.push(e[a*r-n*r-3*r+t])}super.addElements(e,h-3,e+1),super.addElements(h-3,e+2,e+1)}}fillData(t,n,i,e,r,s,o,a){const h=!1!==this.options.top,u=!1!==this.options.side,l=this.feaLineWidth||this.symbol.lineWidth/2*(this.options.EXTENT/this.options.tileSize),c=63*e,f=63*r,d=l*e+n,y=l*r+i;this.st(t,n,i,e,r,s,o,a,d,y,c,f),u&&(h&&this.st(t,n,i,e,r,s,o,a,d,y,c,f),this.st(t,n,i,e,r,s,o,a,d,y,c,f),this.ot(t,n,i,e,r,s,o,a,d,y,c,f),this.ot(t,n,i,e,r,s,o,a,d,y,c,f)),this.maxPos=Math.max(this.maxPos,Math.abs(n),Math.abs(i))}st(t,n,i,e,r,s,o,a,h,u,l,c){const{lineColorFn:f,lineWidthFn:d}=this.C;t.aPosition.push(n,i,32767),t.aLinesofar.push(a),t.aUp.push(+o),t.aExtrudedPosition.push(h,u,1),t.aExtrude.push(l,c),f&&t.aColor.push(...this.feaColor),d&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),this.rt&&t.aLineHeight.push(this.feaAltitude)}ot(t,n,i,e,r,s,o,a,h,u,l,c){const{lineColorFn:f,lineWidthFn:d}=this.C;t.aPosition.push(n,i,this.feaMinHeight||0),t.aLinesofar.push(a),t.aUp.push(+o),t.aExtrudedPosition.push(h,u,1),t.aExtrude.push(l,c),f&&t.aColor.push(...this.feaColor),d&&t.aLineWidth.push(Math.round(2*this.feaLineWidth)),this.rt&&t.aLineHeight.push(this.feaAltitude)}addElements(t,n,i){const e=!1!==this.options.top,r=!1!==this.options.side,s=(e?1:0)+(r?4:0);if(t*=s,n*=s,this.data.aUp[this.offset+(i*=s)+4]){if(e&&super.addElements(n,t,i),r){const t=e?1:0;super.addElements(n+t,i+t,i+t+2),super.addElements(n+t+1,i+t+1+2,n+t+1+2)}}else if(e&&super.addElements(t,i,n),r){const n=e?1:0;super.addElements(t+n,t+n+2,i+n),super.addElements(t+n+1+2,i+n+1+2,i+n+1)}}createDataPack(t,n){this.maxAltitude=0;const i=super.createDataPack(t,n);if(!i)return i;const{data:e,indices:r}=i;this.getFormat().reduce((t,n)=>(t[n.name]={size:n.width},t),{}).aPickingId={size:1};const{aExtrudedPosition:s,aPosition:o,aLinesofar:a,aUp:h,aExtrude:u,aColor:l,aLineHeight:c,aLineWidth:f}=e,d={},y=Xn(s,r);let v,p=!0;for(let t=0;t<y.length;t++)y[t]=-y[t],y[t]%1!=0&&(p=!1);if(!1!==this.options.top&&this.symbol.material&&function(t){for(const n in t)if(n.indexOf("Texture")>=0&&t[n])return!0;return!1}(this.symbol.material)&&(v=function(t,n,i){const e=[];for(let r=0;r<t.length;r+=3){const t=n[r/3];e.push(t/256,i[r/3]?1:0)}return e}(s,a,h)),d.aPosition=o,v&&(d.aTexCoord0=new Float32Array(v)),d.aNormal=p?new Int8Array(y):new Float32Array(y),d.aPickingId=e.aPickingId,d.aExtrude=u,l&&(d.aColor=l),f&&(d.aLineWidth=f),c){const t=Wi(this.maxAltitude);d.aLineHeight=new t(c)}const m=[];for(const t in d)m.push(d[t].buffer);return i.data=d,i.buffers=m,i}}const kr=Math.pow(2,16)/1;class Pr extends le{getFormat(){return[{type:Int16Array,width:3,name:"aPosition"}]}placeVector(t){const n=t.feature,i=3===n.type,e=n.geometry,r=this.elements;i&&(this.elements=[]);for(let t=0;t<e.length;t++)this.offset=this.data.aPosition.length/3,this.K(e[t],n),i&&(this.tt(r),this.elements=[]);i&&(this.elements=r)}K(t,n){const i=3===n.type;let e=t.length;for(;e>=2&&t[e-1].equals(t[e-2]);)e--;let r,s,o,a=0;for(;a<e-1&&t[a].equals(t[a+1]);)a++;if(!(e<(i?3:2))){this.distance=0,this.vertexLength=0,this.primitiveLength=0,this.e1=this.e2=this.e3=-1,i&&(r=t[e-2]);for(let n=a;n<e;n++)o=i&&n===e-1?t[a+1]:t[n+1],o&&t[n].equals(o)||(r&&(s=r),r=t[n],s&&(this.distance+=r.dist(s)),this.addCurrentVertex(r,this.distance))}}addCurrentVertex(t,n){const i=this.vertexLength++;this.addLineVertex(this.data,t,n),i>=1&&this.addElements(i-1,i),n>kr&&(this.distance=0,this.addCurrentVertex(t,this.distance))}addLineVertex(t,n){t.aPosition.push(n.x,n.y,0),this.maxPos=Math.max(this.maxPos,Math.abs(n.x),Math.abs(n.y))}addElements(t,n){super.addElements(this.offset+t,this.offset+n)}tt(t){const n=this.options.EXTENT,i=this.elements;for(let e=0;e<i.length;e+=2)ie(this.data.aPosition,i[e],i[e+1],3,n)||t.push(i[e],i[e+1])}}const Sr=45*Math.PI/100;class _r extends le{getFormat(){return[{type:Int16Array,width:3,name:"aPosition"}]}placeVector(t){const n=this.G(t,this.symbol.markerSpacing||250,this.symbol.markerPlacement||"point"),i=this.getAltitude(t.feature.properties);for(let t=0;t<n.length;t++){const e=n[t];this.data.aPosition.push(e.x,e.y),this.data.aPosition.push(i);const r=Math.max(Math.abs(e.x),Math.abs(e.y));r>this.maxPos&&(this.maxPos=r)}}G(t,n,i){const e=t.feature,r=t.feature.type,s=this.options.EXTENT,o=[];if("line"===i){let t=e.geometry;s&&(t=rr(e.geometry,0,0,s,s));for(let i=0;i<t.length;i++){const e=ar(t[i],n,Sr,null,null,24,1,1,s||1/0);o.push.apply(o,e)}}else if(3===r){const t=ur(e.geometry,0);for(let n=0;n<t.length;n++){const i=fr(t[n],16);se(i,s)||o.push(i)}}else if(2===e.type)for(let t=0;t<e.geometry.length;t++){const n=e.geometry[t];se(n[0],s)||o.push(n[0])}else if(1===e.type)for(let t=0;t<e.geometry.length;t++){const n=e.geometry[t];for(let t=0;t<n.length;t++){const i=n[t];se(i,s)||o.push(i)}}return o}hasElements(){return!1}}\n/*!\n * from @turf/bboxClip\n * https://github.com/Turfjs/turf\n * MIT LICENSE\n */const Or=[],Ir=[];function Tr(t,n){var i,e,r,s,o,a,h;for(e=1;e<=8;e*=2){for(i=[],s=!(Ur(r=t[t.length-1],n)&e),o=0;o<t.length;o++){if((h=!(Ur(a=t[o],n)&e))!==s){const t=Lr(r,a,e,n);i.push(void 0!==a.x?new Ht(t[0],t[1]):t)}h&&i.push(a),r=a,s=h}if(!(t=i).length)break}return i}function Lr(t,n,i,e){return Or[0]=void 0===t.x?t[0]:t.x,Or[1]=void 0===t.y?t[1]:t.y,t=Or,Ir[0]=void 0===n.x?n[0]:n.x,Ir[1]=void 0===n.y?n[1]:n.y,n=Ir,8&i?[t[0]+(n[0]-t[0])*(e[3]-t[1])/(n[1]-t[1]),e[3]]:4&i?[t[0]+(n[0]-t[0])*(e[1]-t[1])/(n[1]-t[1]),e[1]]:2&i?[e[2],t[1]+(n[1]-t[1])*(e[2]-t[0])/(n[0]-t[0])]:1&i?[e[0],t[1]+(n[1]-t[1])*(e[0]-t[0])/(n[0]-t[0])]:null}function Ur(t,n){Or[0]=void 0===t.x?t[0]:t.x,Or[1]=void 0===t.y?t[1]:t.y;var i=0;return(t=Or)[0]<n[0]?i|=1:t[0]>n[2]&&(i|=2),t[1]<n[1]?i|=4:t[1]>n[3]&&(i|=8),i}class zr extends le{constructor(...t){super(...t),this.lineElements=[]}createStyledVector(t,n,i,e,r){const s=new he(t,n,i,e),o=s.getPolygonResource();return!this.options.atlas&&o&&(r[o]=[0,0]),s}getFormat(){const t=[{type:Int16Array,width:3,name:"aPosition"}],{polygonFillFn:n,polygonOpacityFn:i,uvScaleFn:e,uvOffsetFn:r}=this.C;if(this.iconAtlas){const n=this.getIconAtlasMaxValue();t.push({type:n>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return n&&t.push({type:Uint8Array,width:4,name:"aColor"}),i&&t.push({type:Uint8Array,width:1,name:"aOpacity"}),e&&t.push({type:Uint16Array,width:2,name:"aUVScale"}),r&&t.push({type:Uint8Array,width:2,name:"aUVOffset"}),t}createDataPack(...t){this.maxLineIndex=0,this.lineElements=[];const n=super.createDataPack(...t);if(!n)return n;let i=this.lineElements;return i=new($i(this.maxLineIndex))(this.lineElements),n.lineIndices=i,n.buffers.push(i.buffer),n}placeVector(t,n){const i=t.feature;this.at(i.geometry,i,n)}at(t,n){let i,e,r,s;const{polygonFillFn:o,polygonOpacityFn:a,uvScaleFn:h,uvOffsetFn:u}=this.C,l=n.properties;o&&(i=o(this.options.zoom,l)||[255,255,255,255],m(i)?i=[0,0,0,0]:(i=Array.isArray(i)?i.map(t=>255*t):Vn(i).array(),3===i.length&&i.push(255))),a&&(e=a(this.options.zoom,l),Ji(e)&&(e=1),e*=255),h&&(r=h(this.options.zoom,l),Ji(r)&&(r=[1,1]),r=[255*r[0],255*r[1]]),u&&(s=u(this.options.zoom,l),Ji(s)&&(s=[0,0]),s=[255*s[0],255*s[1]]);const c=!!this.iconAtlas,f=ur(t,500),d=this.getAltitude(l),y=[0,0],v=[0,0];if(c){const{polygonPatternFileFn:t}=this.C,n=t?t(null,l):this.symbol.polygonPatternFile;if(this.iconAtlas.glyphMap[n]){const t=this.iconAtlas.positions[n];y[0]=t.tl[0]+1,y[1]=t.tl[1]+1,v[0]=t.displaySize[0]-3,v[1]=t.displaySize[1]-3}}const p=[-1,-1,n.extent+1,n.extent+1];for(let t=0;t<f.length;t++){const n=f[t],o=this.data.aPosition.length/3,a=[],h=[];for(let t=0;t<n.length;t++){let o=n[t];if(this.options.EXTENT!==1/0&&(o=Tr(o,p)),0===o.length)continue;0!==t&&h.push(a.length/2);const u=this.lineElements.length;this.data.aPosition.push(o[0].x,o[0].y,d),c&&this.data.aTexInfo.push(...y,...v),void 0!==i&&this.data.aColor.push(...i),void 0!==e&&this.data.aOpacity.push(e),void 0!==r&&this.data.aUVScale.push(...r),void 0!==s&&this.data.aUVOffset.push(...s),this.maxPos=Math.max(this.maxPos,Math.abs(o[0].x),Math.abs(o[0].y)),this.addLineElements(u+o.length-1,u),a.push(o[0].x),a.push(o[0].y);for(let t=1;t<o.length;t++)this.data.aPosition.push(o[t].x,o[t].y,d),c&&this.data.aTexInfo.push(...y,...v),void 0!==i&&this.data.aColor.push(...i),void 0!==e&&this.data.aOpacity.push(e),void 0!==r&&this.data.aUVScale.push(...r),void 0!==s&&this.data.aUVOffset.push(...s),this.maxPos=Math.max(this.maxPos,Math.abs(o[t].x),Math.abs(o[t].y)),this.addLineElements(u+t-1,u+t),a.push(o[t].x),a.push(o[t].y)}const u=ki(a,h);for(let t=0;t<u.length;t+=3)this.addElements(o+u[t],o+u[t+1],o+u[t+2])}}addLineElements(...t){this.maxLineIndex=Math.max(this.maxLineIndex,...t),this.lineElements.push(...t)}}var Dr=Object.freeze({__proto__:null,clipPolygon:Tr,calculateSignedArea:ne,getFeaAltitudeAndHeight:re,convertRTLText:tr});const Er={polygonPatternFile:1,markerFile:1,markerPlacement:1,markerSpacing:1,textName:1,textStyle:1,textFaceName:1,textWeight:1,textPlacement:1,textSpacing:1,lineJoin:1,lineCap:1,linePatternFile:1};Object.assign({visible:1,textHorizontalAlignment:1,textVerticalAlignment:1,textWrapWidth:1,markerHorizontalAlignment:1,markerVerticalAlignment:1},Er),Object.assign({lineDasharray:1},Er);function Cr(t,n,i,e,r,s,o,a,h,u,l,c,f,d,y){const v=n.length,p=r/3;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-s;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-o;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-s;r+=v;for(let i=2,e=v;i<e;i+=3)t[r+i-2]=n[i-2],t[r+i-1]=n[i-1],t[r+i-0]=n[i]-o;r+=v,(i=i||[]).push(v/3);for(let n=0;n<i.length;n++){jr(p+(i[n-1]||0),p+i[n],t,v/3,a,e,h,u,l,c,f,d,y)}return r}function jr(t,n,i,e,r,s,o,a,h,u,l,c,f){const d=s.length;let y,v;for(let o=t,a=n;o<a-1;o++)y=o,v=o+1,ct(i,y,v,r)||((o-t)%2==1&&(y+=2*e,v+=2*e),s.push(y+e,y,v),s.push(v,v+e,y+e));o&&function(t,n,i,e,r,s,o,a,h){let u,l=0,c=0,f=0,d=0;for(let y=e.length-1;y>=0;y--){const v=3*e[y],p=3*e[y]+1,m=3*e[y]+2,g=i[v],w=i[p],M=i[m];l||c||(l=Math.max(i[m],i[3*e[y-2]+2]),c=Math.min(i[m],i[3*e[y-2]+2]),u=l-c);let b=f;const x=y%6;0===t?(5===x&&(d=Nt(i,e,y,g,w)),b=2===x||3===x||4===x?f:f+d):1===t&&(2===x||3===x||4===x?b=0:5===x?(d=Nt(i,e,y,g,w),b=d):b=d);const F=b*o*a/r,A=M===l?0:u*h/s;n[v/3*2]=F,n[v/3*2+1]=-A,0===x&&(f+=d)}}(a,h,i,s.slice(d,s.length),u[0],u[1],l,c,f)}function Nr(t,n,i,e,r,s,o,a,h,u){void 0===n.top&&(n.top=!0),void 0===n.side&&(n.side=!0);const{altitudeScale:l,altitudeProperty:c,defaultAltitude:f,heightProperty:d,minHeightProperty:y,defaultHeight:v,tangent:p,uv:m,uvScale:M,topUVMode:b,sideUVMode:x,top:F,side:A,topThickness:k}=n,S=function(t,n,{altitudeScale:i,altitudeProperty:e,defaultAltitude:r,heightProperty:s,minHeightProperty:o,defaultHeight:a},{side:h,top:u,topThickness:l,uvOrigin:c,uv:f,uvSize:d,topUVMode:y,sideUVMode:v,glScale:p,localScale:m,vScale:g},w){const M=n/t[0].extent,b=[],x=[],F=[],A=[],k=[],S=[],_=!!f,O=!!u,T=!!h,z=_?[]:null;function D(t,i,e,r){if(O){const r=ki(A,e,3);if(0===r.length)return i;let s;I(k,A),i+=A.length;for(let n=2,i=r.length;n<i;n+=3)s=r[n-1],r[n-1]=r[n]+t/3,r[n]=s+t/3,r[n-2]+=t/3;I(S,r),_&&Et(y||0,t,i,z,k,0,p,m,d[0],d[1]),l>0&&!T&&(i=Cr(k,A,e,S,i,0,l,n,_,v||0,z,d,p,m,g))}return T&&(O&&(l=0),i=Cr(k,A,e,S,i,l,r,n,_,v||0,z,d,p,m,g)),i}let E=0,C=0;const j=[-1,-1,n+1,n+1];let N=0,H=t.length;void 0!==w&&(N=w,H=w+1);let V=0,R=!1;for(;N<H;N++){const h=t[N],u=h.id;P(u)&&(Math.abs(u)>V&&(V=Math.abs(u)),u<0&&(R=!0));const l=h.geometry,{altitude:c,height:f}=Dr.getFeaAltitudeAndHeight(h,i,e,r,s,a,o);E=Math.max(Math.abs(c),E);const d=k.length;let y=C,v=[];A.length=0;for(let t=0,i=l.length;t<i;t++){const e=Dr.calculateSignedArea(l[t])<0;!e&&t>0&&(C=D(y,C,v,f*M),A.length=0,v=[],y=C);let r=l[t];if(n!==1/0&&(r=Dr.clipPolygon(r,j)),!r.length){t===i-1&&(C=D(y,C,v,f*M));continue}const s=r.length;Array.isArray(r[0])?r[0][0]===r[s-1][0]&&r[0][1]===r[s-1][1]||r.push([r[0][0],r[0][1]]):r[0].x===r[s-1].x&&r[0].y===r[s-1].y||r.push(r[0]),e&&v.push(A.length/3),lt(A,A.length,r,M,c),t===i-1&&(C=D(y,C,v,f*M))}const p=k.length-d,m="__fea_idx".trim();for(let t=0;t<p/3;t++)x.push(void 0===h[m]?N:h[m]),b.push(N),P(u)&&F.push(u)}const $=L(x.length?x[x.length-1]:0),W={maxAltitude:E,vertices:new(U(Math.max(512,E)))(k),indices:S,pickingIds:new $(x),featureIndexes:b};if(F.length){const t=R?U(V):L(V);W.featureIds=new t(F)}else W.featureIds=[];return z&&(z.length=k.length/3*2,W.uvs=z),W}(t,i,{altitudeScale:l,altitudeProperty:c,defaultAltitude:f||0,heightProperty:d,minHeightProperty:y,defaultHeight:v||0},{top:F,side:A,topThickness:10*k||0,uv:m||p,uvSize:M?[.5*M[0],.5*M[1]]:[.5,.5],uvOrigin:e,topUVMode:b,sideUVMode:x,glScale:r,localScale:o,vScale:s},u),_=[],O=new(T(S.vertices.length/3))(S.indices);delete S.indices,_.push(O.buffer,S.vertices.buffer,S.pickingIds.buffer);const z=Xn(S.vertices,O);let E=!0;for(let t=0;t<z.length;t++)z[t]=-z[t],z[t]%1!=0&&(E=!1);if(S.normals=z,p){let t=function(t,n,i,e){const r=t.length/3,s=new Array(4*r),o=[],a=[];for(let t=0;t<r;t++)o[t]=[0,0,0],a[t]=[0,0,0];const h=[0,0,0],u=[0,0,0],l=[0,0,0],c=[0,0],f=[0,0],d=[0,0],y=[0,0,0],v=[0,0,0];function p(n,e,r){Zn(h,t,3*n),Zn(u,t,3*e),Zn(l,t,3*r),Yn(c,i,2*n),Yn(f,i,2*e),Yn(d,i,2*r);const s=u[0]-h[0],p=l[0]-h[0],m=u[1]-h[1],g=l[1]-h[1],w=u[2]-h[2],M=l[2]-h[2],b=f[0]-c[0],x=d[0]-c[0],F=f[1]-c[1],A=d[1]-c[1],k=1/(b*A-x*F);bt(y,(A*s-F*p)*k,(A*m-F*g)*k,(A*w-F*M)*k),bt(v,(b*p-x*s)*k,(b*g-x*m)*k,(b*M-x*w)*k),xt(o[n],o[n],y),xt(o[e],o[e],y),xt(o[r],o[r],y),xt(a[n],a[n],v),xt(a[e],a[e],v),xt(a[r],a[r],v)}for(let t=0,n=e.length;t<n;t+=3)p(e[t+0],e[t+1],e[t+2]);const m=[],g=[],w=[],M=[];let b,x,F;function A(t){Zn(w,n,3*t),Mt(M,w),x=o[t],Mt(m,x),St(m,m,function(t,n,i){return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t}(w,w,kt(w,x))),At(m,m),Pt(g,M,x),F=kt(g,a[t]),b=F<0?-1:1,s[4*t]=m[0],s[4*t+1]=m[1],s[4*t+2]=m[2],s[4*t+3]=b}for(let t=0,n=e.length;t<n;t+=3)A(e[t+0]),A(e[t+1]),A(e[t+2]);return s}(S.vertices,S.normals,S.uvs,O);t=function(t,n){const i=new Float32Array(n.length),e=[],r=[],s=[];for(let o=0;o<n.length;o+=4){const a=o/4*3;bt(r,t[a]||0,t[a+1]||0,t[a+2]||0),Ot(e,n[o]||0,n[o+1]||0,n[o+2]||0,n[o+3]||0),Jn(s,r,e),_t(i.subarray(o,o+4),s)}return i}(S.normals,t),S.tangents=t,_.push(t.buffer),delete S.normals}if(S.normals&&(S.normals=E?new Int8Array(S.normals):new Float32Array(S.normals),_.push(S.normals.buffer)),S.uvs){const t=S.uvs;S.uvs=new Float32Array(t),_.push(S.uvs.buffer)}const C=function(t,n,i,e){const r={};if(D(n.polygonFill)){const s={},o=w(n.polygonFill),a=new Uint8Array(4*e.length);for(let n=0;n<e.length;n++){const r=t[e[n]],h=r.properties||{};h.$layer=r.layer,h.$type=r.type;let u=o(i,h);if(delete h.$layer,delete h.$type,Array.isArray(u)||(u=s[u]=s[u]||Vn(u).array()),Array.isArray(u)){for(let t=0;t<u.length;t++)Hr[t]=255*u[t];3===u.length&&(Hr[3]=255)}a[4*n]=Hr[0],a[4*n+1]=Hr[1],a[4*n+2]=Hr[2],a[4*n+3]=Hr[3]}r.aColor=a}if(D(n.polygonOpacity)){const s=g(n.polygonOpacity),o=new Uint8Array(e.length);for(let n=0;n<e.length;n++){const r=t[e[n]],a=r.properties||{};a.$layer=r.layer,a.$type=r.type;const h=s(i,a);delete a.$layer,delete a.$type,o[n]=255*h}r.aOpacity=o}return r}(t,a,h,S.featureIndexes),j={data:{data:{aPosition:S.vertices,aNormal:S.normals,aTexCoord0:S.uvs,aTangent:S.tangents,aPickingId:S.pickingIds},indices:O,properties:{maxAltitude:S.maxAltitude}},buffers:_};return S.featureIds.length?(j.data.featureIds=S.featureIds,_.push(j.data.featureIds.buffer)):j.data.featureIds=[],C.aColor&&(j.data.data.aColor=C.aColor,j.buffers.push(C.aColor.buffer)),C.aOpacity&&(j.data.data.aOpacity=C.aOpacity,j.buffers.push(C.aOpacity.buffer)),j}const Hr=[];function Vr(t,n,{altitudeScale:i,altitudeProperty:e,defaultAltitude:r,heightProperty:s,minHeightProperty:o,defaultHeight:a,bottom:h}){const u=h,l=n/t[0].extent,c=2*function(t,n){let i=0;for(let e=0,r=t.length;e<r;e++){const r=t[e];if(P(r.geometry[0][0])){const t=3*r.geometry.length;i+=n?2*t-6:t}else for(let t=0,e=r.geometry.length;t<e;t++){let e=3*r.geometry[t].length;3===r.type&&(e-=3),i+=n?2*e-6:e}}return i}(t)+3*t.length*2,f=[],d=new Int16Array(c),y=[];function v(t,i,e){const r=i-t,s=d.subarray(t,i),o=d.subarray(i,i+r);o.set(s);for(let t=2,n=o.length;t<n;t+=3)o[t]=s[t]-e;const a=t/3,h=r/3;let l,c;for(let t=a,i=h+a;t<i;t++)t<i-1?(l=t,c=t+1):(l=t,c=a),ct(d,l,c,n)||(y.push(l,c),u&&y.push(l+h,c+h),Rr(d,l,n)||y.push(l,l+h));return i+r}let p=0,m=0;const g="__fea_idx".trim();for(let n=0,h=t.length;n<h;n++){const h=t[n],u=h.geometry,{altitude:c,height:w}=Dr.getFeaAltitudeAndHeight(h,i,e,r,s,a,o);m=Math.max(Math.abs(c),m);let M=p;for(let t=0,n=u.length;t<n;t++){let n=u[t];const i=n.length;n[0][0]===n[i-1][0]&&n[0][1]===n[i-1][1]&&(n=n.slice(0,i-1)),p=lt(d,M,n,l,c),p=v(M,p,w*l),M=p}const b=y.length-f.length;for(let t=0;t<b;t++)f.push(h[g])}const w=new(T(y.reduce((t,n)=>Math.max(t,n),0)))(y),M=L(t.length);return{aPosition:new(U(Math.max(512,m)))(d),indices:w,aPickingId:new M(f)}}function Rr(t,n,i){const e=t[3*n],r=t[3*n+1];return e<0||e>i||r<0||r>i}function $r(t,n,i){const e=Vr(t,i,n),r=[e.aPosition.buffer,e.indices.buffer,e.aPickingId.buffer],s=e.indices;return delete e.indices,{data:{data:e,indices:s},buffers:r}}class Wr{constructor(t,n,i,e,r){this.id=t,this.options=n,this.upload=i,this.ht(n.style),this.requests={},this.ut=0,this.lt=e,this.loadings=r}updateStyle(t,n){this.options.style=t,this.ht(t),this.ut++,n()}updateOptions(t,n){this.options=A(this.options,t),n()}loadTile(t,n){const i=this.loadings,e=t.tileInfo.url,r=this.options.debugTile;if(r){const{x:i,y:e,z:s}=t.tileInfo;if(s!==r.z||i!==r.x||e!==r.y)return void n()}if(this.lt.has(e)){const{features:r,layers:s}=this.lt.get(e),o=i[e];if(delete i[e],!r||!r.length)return this.ct(o),void n();if(o)for(let n=0;n<o.length;n++)this.ft.call(o[n].ref,t,o[n].callback,e,s,r);this.ft(t,n,e,s,r)}else i[e]?i[e].push({callback:n,ref:this}):(i[e]=[{callback:n,ref:this}],this.requests[e]=this.getTileFeatures(t.tileInfo,(n,r,s,o)=>{const a=i[e];if(delete i[e],this.checkIfCanceled(e))return delete this.requests[e],void this.ct(a,null,{canceled:!0});if(delete this.requests[e],this.options.debug&&r)for(let n=0;n<r.length;n++)r[n]._debug_info={index:n,tileId:t.tileInfo.id};if(n)return n.loading||this.lt.add(e,{features:[],layers:[]}),void this.ct(a,n);if(!r||!r.length)return this.lt.add(e,{features:[],layers:[]}),void this.ct(a);if(this.lt.add(e,{features:r,layers:s}),a)for(let n=0;n<a.length;n++)this.ft.call(a[n].ref,t,a[n].callback,e,s,r,o)}))}ft(t,n,i,e,r,s){this.dt(e,r,t).then(t=>{t.canceled?n(null,{canceled:!0}):(t.data.style=this.ut,s&&A(t.data,s),n(null,t.data,t.buffers))}).catch(t=>{n(t)})}abortTile(t,n){delete this.requests[t],this.yt(t),n()}yt(t){const n=this.loadings[t];if(n)for(let t=0;t<n.length;t++)n[t].callback(null,{canceled:!0});delete this.loadings[t]}ct(t,n,i){if(t)for(let e=0;e<t.length;e++)t[e].callback(n,i)}checkIfCanceled(t){return!this.requests[t]}fetchIconGlyphs(t,n,i){this.upload("fetchIconGlyphs",{icons:t,glyphs:n},null,i)}dt(t,n,{glScale:i,zScale:e,tileInfo:r}){if(!n.length)return Promise.resolve({data:null,buffers:[]});const s=!this.options.style.style.length&&!this.options.style.featureStyle.length;let o=this.pluginConfig.slice(0);s&&(o=this.vt(t)),this.featurePlugins&&I(o,this.featurePlugins);const a=n[0].extent,h=r.z,u={x:r.extent2d.xmin*i,y:r.extent2d.ymax*i},l=[],c=[],f=[],d=this.options,y=[],v={},p=[Promise.resolve(this.ut)];let m=0,g=-1;for(let t=0;t<o.length;t++){g++;const r=o[t];r.type!==m&&(g=0,m=r.type);const d=0===r.type?l:c;if(r.symbol&&!1===r.symbol.visible){d[g]=null;continue}const{tileFeatures:w,tileFeaIndexes:M}=this.pt(r.type,r.filter,n,v,t);if(!w.length){d[g]=null;continue}const b=T(M[M.length-1]);d[g]={styledFeatures:new b(M)},f.push({idx:t,typeIdx:g}),y.push(d[g].styledFeatures.buffer);let x=this.gt(w,r,{extent:a,tilePoint:u,glScale:i,zScale:e,zoom:h});s&&(x=x.then(t=>{if(!t)return null;if(t.data)t.data.layer=w[0].layer;else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]&&t[n].data&&(t[n].data.layer=w[0].layer);return t})),p.push(x)}return Promise.all(p).then(([i,...e])=>{function r(t,n){if(void 0===t.data.ref&&(t.data.type=o[f[n].idx].renderPlugin.dataConfig.type,t.data.filter=o[f[n].idx].filter.def,t.buffers&&t.buffers.length))for(let n=0;n<t.buffers.length;n++)y.push(t.buffers[n])}if(i!==this.ut)return{canceled:!0};for(let t=0;t<e.length;t++){if(!e[t])continue;const n=e[t],i=0===o[f[t].idx].type?l:c;if(Array.isArray(n)){const e=[];for(let i=0;i<n.length;i++)n[i]&&(r(n[i],t),(void 0===n[i].data.ref||n[n[i].data.ref])&&e.push(n[i].data));e.length&&(i[f[t].typeIdx].data=e)}else r(n,t),i[f[t].typeIdx].data=n.data}const s={},h=t;if(d.features||d.schema){let t;for(let i=0,e=n.length;i<e;i++)if(t=n[i],h[t.layer].properties||(h[t.layer].properties=Gr(t.properties)),d.features&&t&&v[i])if("id"===d.features)s[i]=t.id;else{const n=A({},t);d.pickingGeometry||delete n.geometry,delete n.extent,delete n.properties.$layer,delete n.properties.$type,delete n.__index,s[i]=n}}return{data:{schema:h,data:l,featureData:c,extent:a,features:s},buffers:y}})}gt(t,n,i){const e=n.renderPlugin.dataConfig,r=n.symbol,s=this.options.tileSize[0],{extent:o,glScale:a,zScale:h,zoom:u,tilePoint:l}=i,c=o/s,f=e.type,d=this.options.debugTile&&this.options.debugTile.index;if("3d-extrusion"===f){const n=Jr(r);return n&&(e.uv=1,2===n&&(e.tangent=1)),Promise.all([Promise.resolve(Nr(t,e,o,l,a,h,this.options.tileSize[1]/o,r,u,d))])}if("3d-wireframe"===f)return Promise.all([Promise.resolve($r(t,e,o))]);if("point"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),zoom:u,debugIndex:d}),i=mr.splitPointSymbol(r);return mr.needMerge(i[0])&&(t=mr.mergeLineFeatures(t,i[0],u)),Promise.all(i.map(i=>new mr(t,i,n).load(c)))}if("native-point"===f){const n=A({},e,{EXTENT:o,zoom:u,debugIndex:d});return Xr(t,r,n,_r,o/s)}if("line"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),tileRatio:c,zoom:u,debugIndex:d});return Xr(t,r,n,Mr)}if("native-line"===f){const n=A({},e,{EXTENT:o,zoom:u,debugIndex:d});return Xr(t,r,n,Pr)}if("fill"===f){const n=A({},e,{EXTENT:o,requestor:this.fetchIconGlyphs.bind(this),zoom:u,debugIndex:d});return Xr(t,r,n,zr)}if("line-extrusion"===f){delete r.lineGradientProperty,r.lineJoin="miter",r.lineCap="butt";const n=Jr(r);n&&(e.uv=1,2===n&&(e.tangent=1));const i=A({},e,{EXTENT:o,tileSize:s,zScale:h,glScale:a,zoom:u,debugIndex:d});if(n){const n=[];if(!1!==e.top){const e=A({},i);e.side=!1,n.push(new Ar(t,r,e))}return!1!==e.side&&(i.side=!0,i.top=!1,n.push(new Ar(t,r,i))),Promise.all(n.map(t=>t.load()))}return Promise.all([new Ar(t,r,i).load()])}return Promise.resolve([])}pt(t,n,i,e){const r="__fea_idx".trim(),s=[],o=[],a=i.length;for(let h=0;h<a;h++)if((1===t||void 0===i[h].id||!this.styledFeatures[i[h].id])&&((!n.def||"default"===n.def)&&!e[h]||!0===n.def||Array.isArray(n.def)&&n(i[h]))){e[h]=1;const n=A({},i[h]);if(n[r]=h,o.push(n),s.push(h),1===t)break}return{tileFeatures:o,tileFeaIndexes:s}}ht(t){const{style:n,featureStyle:i}=t,e={};i.forEach(t=>{Array.isArray(t.id)?(t.id.forEach(t=>{e[t]=1}),t.filter=["in","$id",...t.id]):(e[t.id]=1,t.filter=["==","$id",t.id])});const r=z(n);for(let t=0;t<n.length;t++)r[t].filter&&(r[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0),r[t].type=0;const s=[],o=z(i);for(let t=0;t<i.length;t++)o[t].type=1,o[t].filter.def=i[t].filter?i[t].filter.value||i[t].filter:void 0,o[t].renderPlugin&&s.push(o[t]);this.pluginConfig=r,this.featurePlugins=s,this.styledFeatures=e}vt(t){let n=this.wt;this.wt||(n=this.wt={});const e=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],r=[];for(const s in t){const o=s;if(!n[s]){const r=[];for(let n=0;n<t[s].types.length;n++){const a=t[s].types[n],h=["all",["==","$layer",o],["==","$type",e[a]]],u={filter:i(h),renderPlugin:qr(a),symbol:Br(a)};u.filter.def=h,u.type=0,r.push(u)}n[o]=r}r.push(...n[o])}return r}}function qr(t){switch(t){case 1:return{type:"native-point",dataConfig:{type:"native-point",only2D:!0}};case 2:return{type:"native-line",dataConfig:{type:"native-line",only2D:!0}};case 3:return{type:"fill",dataConfig:{type:"fill",only2D:!0}}}return null}function Br(t){switch(t){case 1:return{markerFill:"#f00",markerSize:10};case 2:return{lineColor:"#fff"};case 3:return{polygonFill:"#00f",polygonOpacity:.4}}return null}function Gr(t){if(Array.isArray(t)||!_(t))return{};const n={};for(const i in t){const e=t[i];k(e)?n[i]="string":P(e)?n[i]="number":!0===e||!1===e?n[i]="boolean":Array.isArray(e)?n[i]="array":n[i]="object"}return n}function Jr(t){if(!t)return 0;let n=0;for(const i in t){if(("normalTexture"===i||"bumpTexture"===i)&&t[i])return 2;if(i.indexOf("Texture")>0&&t[i])n=1;else if(_(t[i])){const e=Jr(t[i]);if(2===e)return e;1===e&&(n=1)}}return n}function Xr(t,n,i,e,r){const s={},o=Array.isArray(n)?n:[n];let a=-1;for(let t=0;t<o.length;t++)s[t]=Zr(o[t]),!s[t]&&o[t]&&-1===a&&(a=t);const h=[];for(let n=0;n<o.length;n++)o[n]&&(o[n].index={index:n},s[n]||n===a?h.push(new e(t,o[n],i).load(r)):h.push({data:{ref:a,symbolIndex:{index:n}}}));return Promise.all(h)}function Zr(t){if(!t)return 0;for(const n in t)if(D(t[n]))return 1;return 0}function Yr(t,n){Kr(t.geometry,n)}function Kr(t,n){if(t)switch(t.type){case"Point":Qr(t.coordinates,n);break;case"MultiPoint":case"LineString":ts(t.coordinates,n);break;case"MultiLineString":case"Polygon":ns(t.coordinates,n);break;case"MultiPolygon":!function(t,n){for(let i=0;i<t.length;i++)ns(t[i],n)}(t.coordinates,n);break;case"GeometryCollection":for(let i=0;i<t.geometries.length;i++)Kr(t.geometries[i],n)}}function Qr(t,n){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function ts(t,n){for(let i=0;i<t.length;i++)Qr(t[i],n)}function ns(t,n){for(let i=0;i<t.length;i++)ts(t[i],n)}class is extends Wr{constructor(t,n,i,e,r,s){super(t,n,i,e,r),(n=n||{}).extent||(n.extent=8192),this.zoomOffset=0,n.tileSize&&(this.zoomOffset=-function(t){if(Math.log2)return Math.log2(t);const n=Math.log(t)*Math.LOG2E,i=Math.round(n);return Math.abs(i-n)<1e-14?i:n}(n.tileSize[0]/256)),this.setData(n.data,s)}setData(t,n){if(delete this.index,!t)return void n();const i={maxZoom:24,tolerance:this.options.extent/this.options.tileSize[0]*1,extent:this.options.extent,buffer:this.options.tileBuffer||64,debug:0,lineMetrics:!0,indexMaxZoom:5,indexMaxPoints:1e5};if(k(t)&&"{"!=t.substring(0,1)||t.url)C.getJSON(t.url?t.url:t,t.url?t:{},(t,e)=>{if(t&&n(t),!e)return void n(null,{extent:null,idMap:{}});const r=e,{first1000:s,idMap:o}=this.Mt(r);this.bt(s,o,r,i,n)});else{"string"==typeof t&&(t=JSON.parse(t));const e=Array.isArray(t)?t:t.features;let r=e;e&&e.length>1e3&&(r=e.slice(0,1e3)),this.bt(r,null,t,i,n)}}bt(t,n,i,e,r){try{const s=t&&t.length?function(t){let n=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];switch(t.type){case"FeatureCollection":for(let i=0;i<t.features.length;i++)Yr(t.features[i],n);break;case"Feature":Yr(t,n);break;default:Kr(t,n)}return n}({type:"FeatureCollection",features:t}):null;this.index=function(t,n){return new ht(t,n)}(i,this.options.geojsonvt||e),r(null,{extent:s,idMap:n})}catch(t){console.warn(t),r({error:t.message})}}Mt(t){const n=[],i={};let e=0;function r(t){t&&("Feature"!==t.type||t.geometry)&&(void 0!==t.id&&null!==t.id||(t.id=e++),i[t.id]=A({},t),t.geometry?(i[t.id].geometry=A({},t.geometry),i[t.id].geometry.coordinates=null):t.coordinates&&(i[t.id].coordinates=null),n.length<1e3&&n.push(t))}return Array.isArray(t)?t.forEach(t=>{r(t)}):t.features&&t.features.forEach(t=>{r(t)}),{first1000:n,idMap:i}}getTileFeatures(t,n){const i=[];if(!this.index)return setTimeout((function(){n({loading:!0})}),1),1;const e=this.index.getTile(t.z+this.zoomOffset,t.x,t.y);if(!e||0===e.features.length)return setTimeout((function(){n(null,i,[])}),1),1;const r=[];for(let t=0,n=e.features.length;t<n;t++){const n=e.features[t];let s=n.layer;void 0===s&&(s="0"),r[s]={types:{}};r[s].types[n.type]=1,n.tags=n.tags||{},i.push({type:n.type,layer:s,id:n.id,geometry:n.geometry,properties:n.tags,extent:this.options.extent})}for(const t in r)r[t].types=Object.keys(r[t].types).map(t=>+t);return setTimeout((function(){n(null,i,r)}),1),1}onRemove(){delete this.index}}var es={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,n,i,e,r){var s,o,a=8*r-e-1,h=(1<<a)-1,u=h>>1,l=-7,c=i?r-1:0,f=i?-1:1,d=t[n+c];for(c+=f,s=d&(1<<-l)-1,d>>=-l,l+=a;l>0;s=256*s+t[n+c],c+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=e;l>0;o=256*o+t[n+c],c+=f,l-=8);if(0===s)s=1-u;else{if(s===h)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,e),s-=u}return(d?-1:1)*o*Math.pow(2,s-e)},write:function(t,n,i,e,r,s){var o,a,h,u=8*s-r-1,l=(1<<u)-1,c=l>>1,f=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=e?0:s-1,y=e?1:-1,v=n<0||0===n&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(a=isNaN(n)?1:0,o=l):(o=Math.floor(Math.log(n)/Math.LN2),n*(h=Math.pow(2,-o))<1&&(o--,h*=2),(n+=o+c>=1?f/h:f*Math.pow(2,1-c))*h>=2&&(o++,h/=2),o+c>=l?(a=0,o=l):o+c>=1?(a=(n*h-1)*Math.pow(2,r),o+=c):(a=n*Math.pow(2,c-1)*Math.pow(2,r),o=0));r>=8;t[i+d]=255&a,d+=y,a/=256,r-=8);for(o=o<<r|a,u+=r;u>0;t[i+d]=255&o,d+=y,o/=256,u-=8);t[i+d-y]|=128*v}},rs=os,ss=es;function os(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}os.Varint=0,os.Fixed64=1,os.Bytes=2,os.Fixed32=5;var as="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function hs(t){return t.type===os.Bytes?t.readVarint()+t.pos:t.pos+1}function us(t,n,i){return i?4294967296*n+(t>>>0):4294967296*(n>>>0)+(t>>>0)}function ls(t,n,i){var e=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));i.realloc(e);for(var r=i.pos-1;r>=t;r--)i.buf[r+e]=i.buf[r]}function cs(t,n){for(var i=0;i<t.length;i++)n.writeVarint(t[i])}function fs(t,n){for(var i=0;i<t.length;i++)n.writeSVarint(t[i])}function ds(t,n){for(var i=0;i<t.length;i++)n.writeFloat(t[i])}function ys(t,n){for(var i=0;i<t.length;i++)n.writeDouble(t[i])}function vs(t,n){for(var i=0;i<t.length;i++)n.writeBoolean(t[i])}function ps(t,n){for(var i=0;i<t.length;i++)n.writeFixed32(t[i])}function ms(t,n){for(var i=0;i<t.length;i++)n.writeSFixed32(t[i])}function gs(t,n){for(var i=0;i<t.length;i++)n.writeFixed64(t[i])}function ws(t,n){for(var i=0;i<t.length;i++)n.writeSFixed64(t[i])}function Ms(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+16777216*t[n+3]}function bs(t,n,i){t[i]=n,t[i+1]=n>>>8,t[i+2]=n>>>16,t[i+3]=n>>>24}function xs(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+(t[n+3]<<24)}os.prototype={destroy:function(){this.buf=null},readFields:function(t,n,i){for(i=i||this.length;this.pos<i;){var e=this.readVarint(),r=e>>3,s=this.pos;this.type=7&e,t(r,n,this),this.pos===s&&this.skip(e)}return n},readMessage:function(t,n){return this.readFields(t,n,this.readVarint()+this.pos)},readFixed32:function(){var t=Ms(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=xs(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ms(this.buf,this.pos)+4294967296*Ms(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=Ms(this.buf,this.pos)+4294967296*xs(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=ss.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=ss.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var n,i,e=this.buf;return n=127&(i=e[this.pos++]),i<128?n:(n|=(127&(i=e[this.pos++]))<<7,i<128?n:(n|=(127&(i=e[this.pos++]))<<14,i<128?n:(n|=(127&(i=e[this.pos++]))<<21,i<128?n:function(t,n,i){var e,r,s=i.buf;if(r=s[i.pos++],e=(112&r)>>4,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<3,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<10,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<17,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(127&r)<<24,r<128)return us(t,e,n);if(r=s[i.pos++],e|=(1&r)<<31,r<128)return us(t,e,n);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(i=e[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,n=this.pos;return this.pos=t,t-n>=12&&as?function(t,n,i){return as.decode(t.subarray(n,i))}(this.buf,n,t):function(t,n,i){var e="",r=n;for(;r<i;){var s,o,a,h=t[r],u=null,l=h>239?4:h>223?3:h>191?2:1;if(r+l>i)break;1===l?h<128&&(u=h):2===l?128==(192&(s=t[r+1]))&&(u=(31&h)<<6|63&s)<=127&&(u=null):3===l?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&((u=(15&h)<<12|(63&s)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===l&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&((u=(15&h)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,l=1):u>65535&&(u-=65536,e+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),e+=String.fromCharCode(u),r+=l}return e}(this.buf,n,t)},readBytes:function(){var t=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,t);return this.pos=t,n},readPackedVarint:function(t,n){if(this.type!==os.Bytes)return t.push(this.readVarint(n));var i=hs(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(n));return t},readPackedSVarint:function(t){if(this.type!==os.Bytes)return t.push(this.readSVarint());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==os.Bytes)return t.push(this.readBoolean());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==os.Bytes)return t.push(this.readFloat());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==os.Bytes)return t.push(this.readDouble());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==os.Bytes)return t.push(this.readFixed32());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==os.Bytes)return t.push(this.readSFixed32());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==os.Bytes)return t.push(this.readFixed64());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==os.Bytes)return t.push(this.readSFixed64());var n=hs(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed64());return t},skip:function(t){var n=7&t;if(n===os.Varint)for(;this.buf[this.pos++]>127;);else if(n===os.Bytes)this.pos=this.readVarint()+this.pos;else if(n===os.Fixed32)this.pos+=4;else{if(n!==os.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(t,n){this.writeVarint(t<<3|n)},realloc:function(t){for(var n=this.length||16;n<this.pos+t;)n*=2;if(n!==this.length){var i=new Uint8Array(n);i.set(this.buf),this.buf=i,this.length=n}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),bs(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),bs(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),bs(this.buf,-1&t,this.pos),bs(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),bs(this.buf,-1&t,this.pos),bs(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,n){var i,e;t>=0?(i=t%4294967296|0,e=t/4294967296|0):(e=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,e=e+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn\'t fit into 10 bytes");n.realloc(10),function(t,n,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,n),function(t,n){var i=(7&t)<<4;if(n.buf[n.pos++]|=i|((t>>>=3)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;n.buf[n.pos++]=127&t}(e,n)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var n=this.pos;this.pos=function(t,n,i){for(var e,r,s=0;s<n.length;s++){if((e=n.charCodeAt(s))>55295&&e<57344){if(!r){e>56319||s+1===n.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=e;continue}if(e<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=e;continue}e=r-55296<<10|e-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);e<128?t[i++]=e:(e<2048?t[i++]=e>>6|192:(e<65536?t[i++]=e>>12|224:(t[i++]=e>>18|240,t[i++]=e>>12&63|128),t[i++]=e>>6&63|128),t[i++]=63&e|128)}return i}(this.buf,t,this.pos);var i=this.pos-n;i>=128&&ls(n,i,this),this.pos=n-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),ss.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),ss.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var n=t.length;this.writeVarint(n),this.realloc(n);for(var i=0;i<n;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,n){this.pos++;var i=this.pos;t(n,this);var e=this.pos-i;e>=128&&ls(i,e,this),this.pos=i-1,this.writeVarint(e),this.pos+=e},writeMessage:function(t,n,i){this.writeTag(t,os.Bytes),this.writeRawMessage(n,i)},writePackedVarint:function(t,n){n.length&&this.writeMessage(t,cs,n)},writePackedSVarint:function(t,n){n.length&&this.writeMessage(t,fs,n)},writePackedBoolean:function(t,n){n.length&&this.writeMessage(t,vs,n)},writePackedFloat:function(t,n){n.length&&this.writeMessage(t,ds,n)},writePackedDouble:function(t,n){n.length&&this.writeMessage(t,ys,n)},writePackedFixed32:function(t,n){n.length&&this.writeMessage(t,ps,n)},writePackedSFixed32:function(t,n){n.length&&this.writeMessage(t,ms,n)},writePackedFixed64:function(t,n){n.length&&this.writeMessage(t,gs,n)},writePackedSFixed64:function(t,n){n.length&&this.writeMessage(t,ws,n)},writeBytesField:function(t,n){this.writeTag(t,os.Bytes),this.writeBytes(n)},writeFixed32Field:function(t,n){this.writeTag(t,os.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(t,n){this.writeTag(t,os.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(t,n){this.writeTag(t,os.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(t,n){this.writeTag(t,os.Fixed64),this.writeSFixed64(n)},writeVarintField:function(t,n){this.writeTag(t,os.Varint),this.writeVarint(n)},writeSVarintField:function(t,n){this.writeTag(t,os.Varint),this.writeSVarint(n)},writeStringField:function(t,n){this.writeTag(t,os.Bytes),this.writeString(n)},writeFloatField:function(t,n){this.writeTag(t,os.Fixed32),this.writeFloat(n)},writeDoubleField:function(t,n){this.writeTag(t,os.Fixed64),this.writeDouble(n)},writeBooleanField:function(t,n){this.writeVarintField(t,Boolean(n))}};var Fs=Ht,As=ks;function ks(t,n,i,e,r){this.properties={},this.extent=i,this.type=0,this.xt=t,this.Ft=-1,this.At=e,this.kt=r,t.readFields(Ps,this,n)}function Ps(t,n,i){1==t?n.id=i.readVarint():2==t?function(t,n){var i=t.readVarint()+t.pos;for(;t.pos<i;){var e=n.At[t.readVarint()],r=n.kt[t.readVarint()];n.properties[e]=r}}(i,n):3==t?n.type=i.readVarint():4==t&&(n.Ft=i.pos)}function Ss(t){for(var n,i,e=0,r=0,s=t.length,o=s-1;r<s;o=r++)n=t[r],e+=((i=t[o]).x-n.x)*(n.y+i.y);return e}ks.types=["Unknown","Point","LineString","Polygon"],ks.prototype.loadGeometry=function(){var t=this.xt;t.pos=this.Ft;for(var n,i=t.readVarint()+t.pos,e=1,r=0,s=0,o=0,a=[];t.pos<i;){if(r<=0){var h=t.readVarint();e=7&h,r=h>>3}if(r--,1===e||2===e)s+=t.readSVarint(),o+=t.readSVarint(),1===e&&(n&&a.push(n),n=[]),n.push(new Fs(s,o));else{if(7!==e)throw new Error("unknown command "+e);n&&n.push(n[0].clone())}}return n&&a.push(n),a},ks.prototype.bbox=function(){var t=this.xt;t.pos=this.Ft;for(var n=t.readVarint()+t.pos,i=1,e=0,r=0,s=0,o=1/0,a=-1/0,h=1/0,u=-1/0;t.pos<n;){if(e<=0){var l=t.readVarint();i=7&l,e=l>>3}if(e--,1===i||2===i)(r+=t.readSVarint())<o&&(o=r),r>a&&(a=r),(s+=t.readSVarint())<h&&(h=s),s>u&&(u=s);else if(7!==i)throw new Error("unknown command "+i)}return[o,h,a,u]},ks.prototype.toGeoJSON=function(t,n,i){var e,r,s=this.extent*Math.pow(2,i),o=this.extent*t,a=this.extent*n,h=this.loadGeometry(),u=ks.types[this.type];function l(t){for(var n=0;n<t.length;n++){var i=t[n],e=180-360*(i.y+a)/s;t[n]=[360*(i.x+o)/s-180,360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90]}}switch(this.type){case 1:var c=[];for(e=0;e<h.length;e++)c[e]=h[e][0];l(h=c);break;case 2:for(e=0;e<h.length;e++)l(h[e]);break;case 3:for(h=function(t){var n=t.length;if(n<=1)return[t];for(var i,e,r=[],s=0;s<n;s++){var o=Ss(t[s]);0!==o&&(void 0===e&&(e=o<0),e===o<0?(i&&r.push(i),i=[t[s]]):i.push(t[s]))}i&&r.push(i);return r}(h),e=0;e<h.length;e++)for(r=0;r<h[e].length;r++)l(h[e][r])}1===h.length?h=h[0]:u="Multi"+u;var f={type:"Feature",geometry:{type:u,coordinates:h},properties:this.properties};return"id"in this&&(f.id=this.id),f};var _s=As,Os=Is;function Is(t,n){this.version=1,this.name=null,this.extent=4096,this.length=0,this.xt=t,this.At=[],this.kt=[],this.Pt=[],t.readFields(Ts,this,n),this.length=this.Pt.length}function Ts(t,n,i){15===t?n.version=i.readVarint():1===t?n.name=i.readString():5===t?n.extent=i.readVarint():2===t?n.Pt.push(i.pos):3===t?n.At.push(i.readString()):4===t&&n.kt.push(function(t){var n=null,i=t.readVarint()+t.pos;for(;t.pos<i;){var e=t.readVarint()>>3;n=1===e?t.readString():2===e?t.readFloat():3===e?t.readDouble():4===e?t.readVarint64():5===e?t.readVarint():6===e?t.readSVarint():7===e?t.readBoolean():null}return n}(i))}Is.prototype.feature=function(t){if(t<0||t>=this.Pt.length)throw new Error("feature index out of bounds");this.xt.pos=this.Pt[t];var n=this.xt.readVarint()+this.xt.pos;return new _s(this.xt,n,this.extent,this.At,this.kt)};var Ls=Os;function Us(t,n,i){if(3===t){var e=new Ls(i,i.readVarint()+i.pos);e.length&&(n[e.name]=e)}}var zs=function(t,n){this.layers=t.readFields(Us,{},n)};class Ds extends Wr{constructor(t,n,i,e,r,s){super(t,n,i,e,r),n=n||{},s()}getTileFeatures(t,n){const i=t.url;return C.getArrayBuffer(i,(t,i)=>{if(t)return void n(t);const e=new zs(new rs(i.data)),r=[];if(!e.layers)return void n(null,r,[]);const s={};let o;for(const n in e.layers)if(a=e.layers,h=n,Object.prototype.hasOwnProperty.call(a,h)){s[n]={types:{}};const i=s[n].types;for(let s=0,a=e.layers[n].length;s<a;s++)try{o=e.layers[n].feature(s),i[o.type]=1,r.push({type:o.type,layer:n,geometry:o.loadGeometry(),properties:o.properties,extent:o.extent})}catch(t){console.warn("error when load vt geometry:",t)}}var a,h;for(const t in s)s[t].types=Object.keys(s[t].types).map(t=>+t);n(null,r,s,{byteLength:i.data.byteLength})})}abortTile(t,n){const i=this.requests[t];delete this.requests[t],i&&i.abort&&i.abort(),this.yt(t),n()}onRemove(){for(const t in this.requests)this.requests[t].abort();this.requests={}}}let Es=0;const Cs=new class{constructor(t){this.max=t,this.reset()}reset(){return this.data={},this.order=[],this}clear(){this.reset()}add(t,n){return this.has(t)?(this.order.splice(this.order.indexOf(t),1),this.data[t]=n,this.order.push(t)):(this.data[t]=n,this.order.push(t),this.order.length>this.max&&this.getAndRemove(this.order[0])),this}has(t){return t in this.data}keys(){return this.order}getAndRemove(t){if(!this.has(t))return null;const n=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),n}get(t){return this.has(t)?this.data[t]:null}remove(t){return this.has(t)?(delete this.data[t],this.order.splice(this.order.indexOf(t),1),this):this}setMaxSize(t){for(this.max=t;this.order.length>this.max;)this.getAndRemove(this.order[0]);return this}}(128),js={};class Ns{constructor(t){this.St={},this._t={},this.workerId=t}addLayer({actorId:t,mapId:n,layerId:i,params:e},r){if(this.Ot(n,i))return;const s=this.It(n,i),o=e.type,a=e.options,h=this.send.bind(this,t);this.St[s]="GeoJSONVectorTileLayer"===o?new is(i,a,h,Cs,js,r):new Ds(i,a,h,Cs,js,r)}removeLayer({mapId:t,layerId:n},i){const e=this.Ot(t,n),r=this.It(t,n);delete this.St[r],e&&(e.onRemove(i),this.Tt())}loadTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.loadTile(i,e)}abortTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.abortTile&&r.abortTile(i.url,e)}removeTile({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&r.removeTile(i,e)}updateStyle({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.updateStyle(i,e),this.Tt())}updateOptions({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.updateOptions(i,e),this.Tt())}setData({mapId:t,layerId:n,params:i},e){const r=this.Ot(t,n);r&&(r.setData(i.data,e),this.Tt())}receive(t){const n=t.callback,i=this._t[n];delete this._t[n],i&&t.error?i(new Error(t.error)):i&&i(null,t.data)}send(t,n,i,e,r){const s=r?`${t}-${Es++}`:null;r&&(this._t[s]=r),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:n,params:i,callback:String(s)},e||[])}It(t,n){return`${t}-${n}`}Ot(t,n){const i=this.It(t,n);return this.St[i]}Tt(){const t=Object.keys(js);for(let n=0;n<t.length;n++)delete js[t[n]];Cs.reset()}}t.initialize=function(){},t.onmessage=function(t,n){const i=t.data;if(this.dispatcher||(this.dispatcher=new Ns(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const e=i.command;this.dispatcher[e]({actorId:t.actorId,mapId:i.mapId,layerId:i.layerId,params:i.params},(t,i,r)=>{t&&console.error(e,t),n(t,i,r)})}},Object.defineProperty(t,"Lt",{value:!0})}';
|
|
31
31
|
|
|
32
32
|
let D = 0;
|
|
33
33
|
|
|
@@ -8191,7 +8191,7 @@ const Cr = Jt("water", gr);
|
|
|
8191
8191
|
|
|
8192
8192
|
Cr.registerAt(ct), At.registerPainter("lit", nr), At.registerPainter("icon", hi),
|
|
8193
8193
|
At.registerPainter("fill", Ne), At.registerPainter("line", Ve), At.registerPainter("line-gradient", je),
|
|
8194
|
-
At.registerPainter("water", gr), ct.VERSION = "0.63.
|
|
8194
|
+
At.registerPainter("water", gr), ct.VERSION = "0.63.9", At.VERSION = "0.63.9";
|
|
8195
8195
|
|
|
8196
8196
|
if (e.mat4.create(), e.transcoders) {
|
|
8197
8197
|
const n = t.Map.VERSION;
|
|
@@ -8205,4 +8205,4 @@ if (e.mat4.create(), e.transcoders) {
|
|
|
8205
8205
|
|
|
8206
8206
|
export { Ne as FillPainter, xr as FillPlugin, kr as GLTFPhongPlugin, Ir as GLTFStandardPlugin, vt as GeoJSONVectorTileLayer, Or as HeatmapPlugin, hi as IconPainter, wr as IconPlugin, Ar as LineGradientPlugin, Ve as LinePainter, br as LinePlugin, Ut as LineStringLayer, Tr as LitPlugin, mt as MapboxVectorTileLayer, Bi as NativeLinePainter, Sr as NativeLinePlugin, Gi as NativePointPainter, Ki as PhongPainter, Mr as PhongPlugin, jt as PointLayer, Gt as PolygonLayer, Li as TextPainter, _r as TextPlugin, At as Vector3DLayer, ct as VectorTileLayer, nt as VectorTileLayerRenderer, Cr as WaterPlugin, Qi as WireframePainter, Pr as WireframePlugin };
|
|
8207
8207
|
|
|
8208
|
-
"undefined" != typeof console && console.log("@maptalks/vt v0.63.
|
|
8208
|
+
"undefined" != typeof console && console.log("@maptalks/vt v0.63.9");
|