@maptalks/vt 0.96.0 → 0.96.2

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @maptalks/vt v0.96.0
2
+ * @maptalks/vt v0.96.2
3
3
  * LICENSE : undefined
4
4
  * (c) 2016-2024 maptalks.org
5
5
  */
@@ -21,7 +21,7 @@
21
21
  })), e.default = t, Object.freeze(e);
22
22
  }
23
23
  var r = i(e), s = i(n);
24
- const o = "${", a = `function(t){let n;const e={width:100,height:10};function r(){if(!n){const{width:t,height:r}=e;OffscreenCanvas?n=new OffscreenCanvas(t,r):(n=document.createElement("canvas"),n.width=t,n.height=r)}return n}class i{constructor(t,n={}){if(!Array.isArray(t))return void console.error("colors is not array");if(t.length<2)return void console.error("colors.length should >1");this.colors=t;let r=1/0,i=-1/0;for(let n=0,e=t.length;n<e;n++){const e=t[n][0];r=Math.min(e,r),i=Math.max(e,i)}this.min=r,this.max=i,this.valueOffset=this.max-this.min,this.options=Object.assign({},e,n),this.t()}getImageData(){return this.imgData}t(){const t=r(),{width:n,height:e}=this.options;t.width=n,t.height=e;const i=t.getContext("2d");i.clearRect(0,0,t.width,t.height);const s=i.createLinearGradient(0,0,t.width,0),{colors:o,valueOffset:a}=this;for(let t=0,n=o.length;t<n;t++){const[n,e]=o[t],r=(n-this.min)/a;s.addColorStop(r,e)}i.fillStyle=s,i.fillRect(0,0,t.width,t.height),this.imgData=i.getImageData(0,0,t.width,t.height)}getColor(t){t=Math.max(this.min,t);const n=((t=Math.min(t,this.max))-this.min)/this.valueOffset;let e=Math.round(n*this.imgData.width);e=Math.min(e,this.imgData.width-1);const r=4*e;return[this.imgData.data[r],this.imgData.data[r+1],this.imgData.data[r+2],this.imgData.data[r+3]]}}var s;function o(t,n){var e,r,i;if(y(t)){var s,h=t.stops&&"object"==typeof t.stops[0][0],d=h||void 0!==t.property,p=h||!d,m=t.type||n||"exponential";if("exponential"===m)s=l;else if("interval"===m)s=u;else if("categorical"===m)s=a;else if("identity"===m)s=f;else{if("color-interpolate"!==m)throw new Error('Unknown function type "'+m+'"');s=c}if(h){var g={},v=[];for(let n=0;n<t.stops.length;n++){var b=t.stops[n];void 0===g[b[0].zoom]&&(g[b[0].zoom]={zoom:b[0].zoom,type:t.type,property:t.property,default:t.default,stops:[]}),g[b[0].zoom].stops.push([b[0].value,b[1]])}for(let t in g)v.push([g[t].zoom,o(g[t])]);e=function(n,e){const r=l({stops:v,base:t.base},n)(n,e);return"function"==typeof r?r(n,e):r},r=!1,i=!1}else p?(e=function(n){const e=s(t,n);return"function"==typeof e?e(n):e},r=!0,i=!1):(e=function(n,e){const r=s(t,e?e[t.property]:null);return"function"==typeof r?r(n,e):r},r=!1,i=!0)}else e=function(){return t},r=!0,i=!0;return e.isZoomConstant=i,e.isFeatureConstant=r,e}function a(t,n){for(let e=0;e<t.stops.length;e++)if(n===t.stops[e][0])return t.stops[e][1];return t.default}function u(t,n){for(var e=0;e<t.stops.length&&!(n<t.stops[e][0]);e++);return t.stops[Math.max(e-1,0)][1]}function l(t,n){for(var e=void 0!==t.base?t.base:1,r=0;!(r>=t.stops.length||n<=t.stops[r][0]);)r++;return 0===r?t.stops[r][1]:r===t.stops.length?t.stops[r-1][1]:d(n,e,t.stops[r-1][0],t.stops[r][0],t.stops[r-1][1],t.stops[r][1])}"function"==typeof Map&&(s=new Map);const h={width:100,height:1};function c(t,n){const e=t.stops;if(e&&e.length>1){let t;if(s){const n=JSON.stringify(e);if(!s.has(n)){const t=new i(e,h);s.set(n,t)}t=s.get(n)}else t=new i(e,h);const[r,o,a,u]=t.getColor(n);return[r/255,o/255,a/255,u/255]}return e&&1===e.length?e[0][1]:null}function f(t,n){return function(t,n,e){return void 0!==t?t:void 0!==n?n:null}(n,t.default)}function d(t,n,e,r,i,s){return"function"==typeof i?function(){var o=i.apply(void 0,arguments),a=s.apply(void 0,arguments);return d(t,n,e,r,o,a)}:i.length?function(t,n,e,r,i,s){var o=[];for(let a=0;a<i.length;a++)o[a]=p(t,n,e,r,i[a],s[a]);return o}(t,n,e,r,i,s):p(t,n,e,r,i,s)}function p(t,n,e,r,i,s){var o,a=r-e,u=t-e;return i*(1-(o=1===n?u/a:(Math.pow(n,u)-1)/(Math.pow(n,a)-1)))+s*o}function y(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type)}function m(t){return b(t,"exponential")}function g(t){return b(t,"interval")}function v(t,n){if(!t)return null;var e=!1;if(Array.isArray(t)){var r,i=[];for(let s=0;s<t.length;s++)(r=v(t[s],n))?(i.push(r),e=!0):i.push(t[s]);return e?i:t}var s,o={__fn_types_loaded:!0},a=[];for(s in t)t.hasOwnProperty(s)&&a.push(s);const u=function(t){Object.defineProperty(o,t,{get:function(){return this["__fn_"+t]||(this["__fn_"+t]=m(this["_"+t])),this["__fn_"+t].apply(this,n())},set:function(n){this["_"+t]=n},configurable:!0,enumerable:!0})};for(let n=0,r=a.length;n<r;n++)y(t[s=a[n]])?(e=!0,o["_"+s]=t[s],u(s)):o[s]=t[s];return e?o:t}function b(t,n){if(!y(t))return function(){return t};let e=!0,r=!0;const i=(t=JSON.parse(JSON.stringify(t))).stops;if(i)for(let t=0;t<i.length;t++)if(y(i[t][1])){const s=b(i[t][1],n);e=e&&s.isZoomConstant,r=r&&s.isFeatureConstant,i[t]=[i[t][0],s]}const s=o(t,n);return s.isZoomConstant=e&&s.isZoomConstant,s.isFeatureConstant=r&&s.isFeatureConstant,s}let w=0;const M="function"==typeof Object.assign;function x(t,...n){if(M)return Object.assign(t,...n),t;for(let e=0;e<n.length;e++){const r=n[e];for(const n in r)t[n]=r[n]}return t}function F(t){return!S(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function k(t){return"number"==typeof t&&!isNaN(t)}function A(t){return!S(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function P(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function S(t){return null==t}function _(t){return y(t)&&t.property}const O="function"==typeof fetch&&"function"==typeof AbortController,C={jsonp:function(t,n){const e="_maptalks_jsonp_"+w++;t.match(/\\?/)?t+="&callback="+e:t+="?callback="+e;let r=document.createElement("script");return r.type="text/javascript",r.src=t,window[e]=function(t){n(null,t),document.getElementsByTagName("head")[0].removeChild(r),r=null,delete window[e]},document.getElementsByTagName("head")[0].appendChild(r),this},get:function(t,n,e){if(A(n)){const t=e;e=n,n=t}(n=n||{}).method&&(n.method=n.method.toUpperCase());const r="POST"===n.method;if(O){const r=new AbortController,i=n;i.signal=r.signal,i.referrerPolicy=i.referrerPolicy||"origin",i.method=i.method||"GET";const s=new Request(t,i);return n.returnJSON&&s.headers.set("Accept","application/json"),fetch(s).then((r=>{const i=this.o(r,n.returnJSON,n.responseType);i.message?(i.url=t,e(i)):i.then((t=>{"arraybuffer"===n.responseType?e(null,{data:t,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires"),contentType:r.headers.get("Content-Type")}):e(null,t)})).catch((n=>{n.code&&n.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,n),e(n))}))})).catch((n=>{n.code&&n.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,n),e(n))})),r}{const i=C.u(e);if(i.open(n.method||"GET",t,!0),n){for(const t in n.headers)i.setRequestHeader(t,n.headers[t]);i.withCredentials="include"===n.credentials,n.responseType&&(i.responseType=n.responseType)}return i.send(r?n.body:null),i}},o:(t,n,e)=>200!==t.status?{status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${o}t.status}): ${o}t.statusText}\`}:"arraybuffer"===e?t.arrayBuffer():n?t.json():t.text(),m: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(${o}t.status}): ${o}t.statusText}\`})}},u: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.m(n,t),n},getArrayBuffer(t,n,e){if(A(n)){const t=e;e=n,n=t}return n||(n={}),n.responseType="arraybuffer",C.get(t,n,e)}};function E(t,n,e,r,i=3){let s=r;const o=e-n>>1;let a,u=e-n;const l=t[n],h=t[n+1],c=t[e],f=t[e+1];for(let r=n+i;r<e;r+=i){const n=I(t[r],t[r+1],l,h,c,f);if(n>s)a=r,s=n;else if(n===s){const t=Math.abs(r-o);t<u&&(a=r,u=t)}}s>r&&(a-n>i&&E(t,n,a,r,i),t[a+2]=s,e-a>i&&E(t,a,e,r,i))}function I(t,n,e,r,i,s){let o=i-e,a=s-r;if(0!==o||0!==a){const u=((t-e)*o+(n-r)*a)/(o*o+a*a);u>1?(e=i,r=s):u>0&&(e+=o*u,r+=a*u)}return o=t-e,a=n-r,o*o+a*a}function $(t,n,e,r,i,s){const o={id:null==t?null:t,type:n,geometry:e,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};i&&(o.layer=i);return function(t,n){const e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)T(t,e,n);else if("Polygon"===r)T(t,e[0],n);else if("MultiLineString"===r)for(const r of e)T(t,r,n);else if("MultiPolygon"===r)for(const r of e)T(t,r[0],n)}(o,s?4:3),o}function T(t,n,e){for(let r=0;r<n.length;r+=e)t.minX=Math.min(t.minX,n[r]),t.minY=Math.min(t.minY,n[r+1]),t.maxX=Math.max(t.maxX,n[r]),t.maxY=Math.max(t.maxY,n[r+1])}function D(t,n,e,r){if(r.layer=n,"FeatureCollection"===e.type)for(let n=0;n<e.features.length;n++)z(t,e.features[n],r,n);else"Feature"===e.type?z(t,e,r):z(t,{geometry:e},r)}function z(t,n,e,r){if(!n.geometry)return;const i=n.geometry.coordinates,s=n.geometry.type,o=Math.pow(e.tolerance/((1<<e.maxZoom)*e.extent),2);let a=[],u=n.id;if(e.promoteId?u=n.properties[e.promoteId]:e.generateId&&(u=r||0),"Point"===s)j(i,a,e);else if("MultiPoint"===s)for(const t of i)j(t,a,e);else if("LineString"===s)U(i,a,o,!1,e);else if("MultiLineString"===s){if(e.lineMetrics){for(const r of i)a=[],U(r,a,o,!1,e),t.push($(u,"LineString",a,n.properties,e.layer,e.hasAltitude));return}N(i,a,o,!1,e)}else if("Polygon"===s)N(i,a,o,!0,e);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(const i of n.geometry.geometries)z(t,{id:u,geometry:i,properties:n.properties},e,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const t of i){const n=[];N(t,n,o,!0,e),a.push(n)}}t.push($(u,s,a,n.properties,e.layer,e.hasAltitude))}function j(t,n,e){n.push(L(t[0]),R(t[1],e.projection),0),e.hasAltitude&&(t.length>2?n.push(t[2]):n.push(0))}function U(t,n,e,r,i){let s,o,a=0;for(let e=0;e<t.length;e++){const u=L(t[e][0]),l=R(t[e][1],i.projection);n.push(u,l,0),i.hasAltitude&&(t[e].length>2?n.push(t[e][2]):n.push(0)),e>0&&(a+=r?(s*l-u*o)/2:Math.sqrt(Math.pow(u-s,2)+Math.pow(l-o,2))),s=u,o=l}const u=i.hasAltitude?4:3,l=n.length-u;n[2]=1,E(n,0,l,e,u),n[l+2]=1,n.size=Math.abs(a),n.start=0,n.end=n.size}function N(t,n,e,r,i){for(let s=0;s<t.length;s++){const o=[];U(t[s],o,e,r,i),n.push(o)}}function L(t){return t/360+.5}function R(t,n){if("EPSG:4326"===n)return(90-t)/360;const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function V(t,n,e,r,i,s,o,a){if(r/=n,s>=(e/=n)&&o<r)return t;if(o<e||s>=r)return null;const u=[];for(const n of t){const t=n.geometry;let s=n.type;const o=0===i?n.minX:n.minY,l=0===i?n.maxX:n.maxY;if(o>=e&&l<r){u.push(n);continue}if(l<e||o>=r)continue;let h=[];if("Point"===s||"MultiPoint"===s)H(t,h,e,r,i,a.hasAltitude);else if("LineString"===s)q(t,h,e,r,i,!1,a.lineMetrics,a.hasAltitude);else if("MultiLineString"===s)J(t,h,e,r,i,!1,a.hasAltitude);else if("Polygon"===s)J(t,h,e,r,i,!0,a.hasAltitude);else if("MultiPolygon"===s)for(const n of t){const t=[];J(n,t,e,r,i,!0,a.hasAltitude),t.length&&h.push(t)}if(h.length){if(a.lineMetrics&&"LineString"===s){for(const t of h)u.push($(n.id,s,t,n.tags,n.layer,a.hasAltitude));continue}"LineString"!==s&&"MultiLineString"!==s||(1===h.length?(s="LineString",h=h[0]):s="MultiLineString"),"Point"!==s&&"MultiPoint"!==s||(s=3===h.length?"Point":"MultiPoint"),u.push($(n.id,s,h,n.tags,n.layer,a.hasAltitude))}}return u.length?u:null}function H(t,n,e,r,i,s){const o=s?4:3;for(let a=0;a<t.length;a+=o){const o=t[a+i];o>=e&&o<=r&&(W(n,t[a],t[a+1],t[a+2]),s&&n.push(t[a+3]))}}function q(t,n,e,r,i,s,o,a){let u=G(t);const l=0===i?B:X;let h,c,f=t.start;const d=a?4:3,p=s?t.length:t.length-d;for(let y=0;y<p;y+=d){const m=t[y],g=t[y+1],v=t[y+2];let b,w,M,x;s&&y===p-d?(b=t[0],w=t[1]):(b=t[y+d],w=t[y+d+1]),a&&(M=t[y+3],x=s&&y===p-d?t[3]:t[y+d+3]);const F=0===i?m:g,k=0===i?b:w;let A=!1;o&&(h=Math.sqrt(Math.pow(m-b,2)+Math.pow(g-w,2))),F<e?k>e&&(c=l(u,m,g,b,w,e),a&&u.push(Y(M,x,c)),o&&(u.start=f+h*c)):F>r?k<r&&(c=l(u,m,g,b,w,r),a&&u.push(Y(M,x,c)),o&&(u.start=f+h*c)):(W(u,m,g,v),a&&u.push(M)),k<e&&F>=e&&(c=l(u,m,g,b,w,e),a&&u.push(Y(M,x,c)),A=!0),k>r&&F<=r&&(c=l(u,m,g,b,w,r),a&&u.push(Y(M,x,c)),A=!0),!s&&A&&(o&&(u.end=f+h*c),n.push(u),u=G(t)),o&&(f+=h)}let y=t.length-d;if(!s){const n=t[y],s=t[y+1],o=t[y+2],l=0===i?n:s;if(l>=e&&l<=r&&W(u,n,s,o),l>=e&&l<=r&&a){const n=t[y+3];u.push(n)}}y=u.length-d,s&&y>=d&&(u[y]!==u[0]||u[y+1]!==u[1])&&(W(u,u[0],u[1],u[2]),a&&u.push(u[3])),u.length&&n.push(u)}function G(t){const n=[];return n.size=t.size,n.start=t.start,n.end=t.end,n}function J(t,n,e,r,i,s,o){for(const a of t)q(a,n,e,r,i,s,!1,o)}function W(t,n,e,r){t.push(n,e,r)}function B(t,n,e,r,i,s){const o=(s-n)/(r-n);return W(t,s,e+(i-e)*o,1),o}function X(t,n,e,r,i,s){const o=(s-e)/(i-e);return W(t,n+(r-n)*o,s,1),o}function Y(t,n,e){return t+(n-t)*e}function K(t,n,e){const r=[];for(let i=0;i<t.length;i++){const s=t[i],o=s.type;let a;if("Point"===o||"MultiPoint"===o||"LineString"===o)a=Z(s.geometry,n,e);else if("MultiLineString"===o||"Polygon"===o){a=[];for(const t of s.geometry)a.push(Z(t,n,e))}else if("MultiPolygon"===o){a=[];for(const t of s.geometry){const r=[];for(const i of t)r.push(Z(i,n,e));a.push(r)}}r.push($(s.id,o,a,s.tags,s.layer,e))}return r}function Z(t,n,e){const r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);const i=e?4:3;for(let s=0;s<t.length;s+=i)r.push(t[s]+n,t[s+1],t[s+2]),e&&r.push(t[s+3]);return r}function Q(t,n,e){if(t.transformed)return t;const r=1<<t.z,i=t.x,s=t.y,o=e?3:2;for(const a of t.features){const t=a.geometry,u=a.type;if(a.geometry=[],1===u)for(let u=0;u<t.length;u+=o)a.geometry.push(tt(t[u],t[u+1],n,r,i,s)),e&&a.geometry[a.geometry.length-1].push(t[u+2]);else for(let u=0;u<t.length;u++){const l=[];for(let a=0;a<t[u].length;a+=o)l.push(tt(t[u][a],t[u][a+1],n,r,i,s)),e&&l[l.length-1].push(t[u][a+2]);a.geometry.push(l)}}return t.transformed=!0,t}function tt(t,n,e,r,i,s){return[Math.round(e*(t*r-i)),Math.round(e*(n*r-s))]}function nt(t,n,e,r,i){const s=n===i.maxZoom?0:i.tolerance/((1<<n)*i.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:e,y:r,z:n,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const n of t)et(o,n,s,i);return o}function et(t,n,e,r){const i=n.geometry,s=n.type,o=[],a=r.hasAltitude?4:3;if(t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),"Point"===s||"MultiPoint"===s)for(let n=0;n<i.length;n+=a)o.push(i[n],i[n+1]),r.hasAltitude&&o.push(i[n+3]),t.numPoints++,t.numSimplified++;else if("LineString"===s)it(o,i,t,e,!1,!1,r);else if("MultiLineString"===s||"Polygon"===s)for(let n=0;n<i.length;n++)it(o,i[n],t,e,"Polygon"===s,0===n,r);else if("MultiPolygon"===s)for(let n=0;n<i.length;n++){const s=i[n];for(let n=0;n<s.length;n++)it(o,s[n],t,e,!0,0===n,r)}if(o.length){let e=n.tags||null;if("LineString"===s&&r.lineMetrics){e={};for(const t in n.tags)e[t]=n.tags[t];e.mapbox_clip_start=i.start/i.size,e.mapbox_clip_end=i.end/i.size}const a={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:e};n.layer&&(a.layer=n.layer),null!==n.id&&(a.id=n.id),t.features.push(a)}}function rt(t,n,e){return 0===t[n+2]&&t[n+3]>0&&e}function it(t,n,e,r,i,s,o){const a=r*r,{hasAltitude:u,disableFilter:l}=o,h=u?4:3;if(!l&&r>0&&n.size<(i?a:r))return void(e.numPoints+=n.length/h);const c=[];for(let t=0;t<n.length;t+=h)(0===r||n[t+2]>a||rt(n,t,u))&&(e.numSimplified++,c.push(n[t],n[t+1]),u&&c.push(n[t+3])),e.numPoints++;i&&function(t,n,e){const r=e?3:2;let i=0;for(let n=0,e=t.length,s=e-r;n<e;s=n,n+=r)i+=(t[n]-t[s])*(t[n+1]+t[s+1]);if(i>0===n){const n=r,i=r-1,s=r-2;for(let o=0,a=t.length;o<a/2;o+=r){const r=t[o],u=t[o+1];let l;e&&(l=t[o+2]),t[o]=t[a-n-o],t[o+1]=t[a-i-o],e&&(t[o+2]=t[a-s-o]),t[a-n-o]=r,t[a-i-o]=u,e&&(t[a-s-o]=l)}}}(c,s,u),t.push(c)}C.getJSON=function(t,n,e){if(A(n)){const t=e;e=n,n=t}const r=function(t,n){const r="string"==typeof n?JSON.parse(n):n||null;e(t,r)};return n&&n.jsonp?C.jsonp(t,r):((n=n||{}).returnJSON=!0,C.get(t,n,r))};const st={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,hasAltitude:!1,disableFilter:!1,debug:0};class ot{constructor(t,n){const e=(n=this.options=function(t,n){for(const e in n)t[e]=n[e];return t}(Object.create(st),n)).debug;if(e&&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.");let r=function(t,n){const e=[];if(Array.isArray(t)){for(let r=0;r<t.length;r++)D(e,t[r].layer,t[r].data,n);return e}if("FeatureCollection"===t.type)for(let r=0;r<t.features.length;r++)z(e,t.features[r],n,r);else"Feature"===t.type?z(e,t,n):z(e,{geometry:t},n);return e}(t,n);this.tiles={},this.tileCoords=[],e&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",n.indexMaxZoom,n.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(t,n){const e=n.buffer/n.extent;let r=t;const i=V(t,1,-1-e,e,0,-1,2,n),s=V(t,1,1-e,2+e,0,-1,2,n);return(i||s)&&(r=V(t,1,-e,1+e,0,-1,2,n)||[],i&&(r=K(i,1,n.hasAltitude).concat(r)),s&&(r=r.concat(K(s,-1,n.hasAltitude)))),r}(r,n),r.length&&this.splitTile(r,0,0,0),e&&(r.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)))}splitTile(t,n,e,r,i,s,o){const a=[t,n,e,r],u=this.options,l=u.debug;for(;a.length;){r=a.pop(),e=a.pop(),n=a.pop(),t=a.pop();const h=1<<n,c=at(n,e,r);let f=this.tiles[c];if(!f&&(l>1&&console.time("creation"),f=this.tiles[c]=nt(t,n,e,r,u),this.tileCoords.push({z:n,x:e,y:r}),l)){l>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,e,r,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));const t=\`z${o}n}\`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(f.source=t,null==i){if(n===u.indexMaxZoom||f.numPoints<=u.indexMaxPoints)continue}else{if(n===u.maxZoom||n===i)continue;if(null!=i){const t=i-n;if(e!==s>>t||r!==o>>t)continue}}if(f.source=null,0===t.length)continue;l>1&&console.time("clipping");const d=.5*u.buffer/u.extent,p=.5-d,y=.5+d,m=1+d;let g=null,v=null,b=null,w=null,M=V(t,h,e-d,e+y,0,f.minX,f.maxX,u),x=V(t,h,e+p,e+m,0,f.minX,f.maxX,u);t=null,M&&(g=V(M,h,r-d,r+y,1,f.minY,f.maxY,u),v=V(M,h,r+p,r+m,1,f.minY,f.maxY,u),M=null),x&&(b=V(x,h,r-d,r+y,1,f.minY,f.maxY,u),w=V(x,h,r+p,r+m,1,f.minY,f.maxY,u),x=null),l>1&&console.timeEnd("clipping"),a.push(g||[],n+1,2*e,2*r),a.push(v||[],n+1,2*e,2*r+1),a.push(b||[],n+1,2*e+1,2*r),a.push(w||[],n+1,2*e+1,2*r+1)}}getTile(t,n,e){t=+t,n=+n,e=+e;const r=this.options,{extent:i,debug:s}=r,{hasAltitude:o,wrapX:a}=r;if(t<0||t>24)return null;if(a){const e=1<<t;n=n+e&e-1}const u=at(t,n,e);if(this.tiles[u])return Q(this.tiles[u],i,o);s>1&&console.log("drilling down to z%d-%d-%d",t,n,e);let l,h=t,c=n,f=e;for(;!l&&h>0;)h--,c>>=1,f>>=1,l=this.tiles[at(h,c,f)];return l&&l.source?(s>1&&(console.log("found parent tile z%d-%d-%d",h,c,f),console.time("drilling down")),this.splitTile(l.source,h,c,f,t,n,e),s>1&&console.timeEnd("drilling down"),this.tiles[u]?Q(this.tiles[u],i,o):null):null}}function at(t,n,e){return 32*((1<<t)*e+n)+t}function ut(t,n,e,r,i,s,o){const a=e&&Array.isArray(e[0]);for(let u=0,l=e.length;u<l;u++){t[n]=(a?e[u][0]:e[u].x)*r,t[n+1]=(a?e[u][1]:e[u].y)*r,o!==Float32Array&&(t[n]=Math.round(t[n]),t[n+1]=Math.round(t[n+1]));let h=i||0;Array.isArray(i)&&(h=i[u]),h=h?Math.round(r*h):0,t[n+2]=h,n+=3,s&&0!==u&&u!==l-1&&(t[n]=t[n-3],t[n+1]=t[n-2],t[n+2]=t[n-1],n+=3)}return t.trySetLength&&t.trySetLength(n),n}function lt(t,n,e,r){const i=t[3*n],s=t[3*n+1],o=t[3*e],a=t[3*e+1];return i===o&&(i<0||i>r)||s===a&&(s<0||s>r)}"undefined"!=typeof undefinedThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof undefined?global:"undefined"!=typeof self&&self;function ht(t){return t&&t.M&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ct=ft;function ft(t,n){this.x=t,this.y=n}ft.prototype={clone:function(){return new ft(this.x,this.y)},add:function(t){return this.clone().F(t)},sub:function(t){return this.clone().k(t)},multByPoint:function(t){return this.clone().A(t)},divByPoint:function(t){return this.clone().P(t)},mult:function(t){return this.clone().S(t)},div:function(t){return this.clone()._(t)},rotate:function(t){return this.clone().O(t)},rotateAround:function(t,n){return this.clone().C(t,n)},matMult:function(t){return this.clone().I(t)},unit:function(){return this.clone().T()},perp:function(){return this.clone().D()},round:function(){return this.clone().j()},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,e=t.y-this.y;return n*n+e*e},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)},I:function(t){var n=t[0]*this.x+t[1]*this.y,e=t[2]*this.x+t[3]*this.y;return this.x=n,this.y=e,this},F:function(t){return this.x+=t.x,this.y+=t.y,this},k:function(t){return this.x-=t.x,this.y-=t.y,this},S:function(t){return this.x*=t,this.y*=t,this},_:function(t){return this.x/=t,this.y/=t,this},A:function(t){return this.x*=t.x,this.y*=t.y,this},P:function(t){return this.x/=t.x,this.y/=t.y,this},T:function(){return this._(this.mag()),this},D:function(){var t=this.y;return this.y=this.x,this.x=-t,this},O:function(t){var n=Math.cos(t),e=Math.sin(t),r=n*this.x-e*this.y,i=e*this.x+n*this.y;return this.x=r,this.y=i,this},C:function(t,n){var e=Math.cos(t),r=Math.sin(t),i=n.x+e*(this.x-n.x)-r*(this.y-n.y),s=n.y+r*(this.x-n.x)+e*(this.y-n.y);return this.x=i,this.y=s,this},j:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ft.convert=function(t){return t instanceof ft?t:Array.isArray(t)?new ft(t[0],t[1]):t};var dt=ht(ct);function pt(t,n,e){e=e||{},this.w=t||64,this.h=n||64,this.autoResize=!!e.autoResize,this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0}function yt(t,n,e){this.x=0,this.y=t,this.w=this.free=n,this.h=e}function mt(t,n,e,r,i,s,o){this.id=t,this.x=n,this.y=e,this.w=r,this.h=i,this.maxw=s||r,this.maxh=o||i,this.refcount=0}pt.prototype.pack=function(t,n){t=[].concat(t),n=n||{};for(var e,r,i,s,o=[],a=0;a<t.length;a++)if(e=t[a].w||t[a].width,r=t[a].h||t[a].height,i=t[a].id,e&&r){if(!(s=this.packOne(e,r,i)))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},pt.prototype.packOne=function(t,n,e){var r,i,s,o,a,u,l,h,c={freebin:-1,shelf:-1,waste:1/0},f=0;if("string"==typeof e||"number"==typeof e){if(r=this.getBin(e))return this.ref(r),r;"number"==typeof e&&(this.maxId=Math.max(e,this.maxId))}else e=++this.maxId;for(o=0;o<this.freebins.length;o++){if(n===(r=this.freebins[o]).maxh&&t===r.maxw)return this.allocFreebin(o,t,n,e);n>r.maxh||t>r.maxw||n<=r.maxh&&t<=r.maxw&&(s=r.maxw*r.maxh-t*n)<c.waste&&(c.waste=s,c.freebin=o)}for(o=0;o<this.shelves.length;o++)if(f+=(i=this.shelves[o]).h,!(t>i.free)){if(n===i.h)return this.allocShelf(o,t,n,e);n>i.h||n<i.h&&(s=(i.h-n)*t)<c.waste&&(c.freebin=-1,c.waste=s,c.shelf=o)}return-1!==c.freebin?this.allocFreebin(c.freebin,t,n,e):-1!==c.shelf?this.allocShelf(c.shelf,t,n,e):n<=this.h-f&&t<=this.w?(i=new yt(f,this.w,n),this.allocShelf(this.shelves.push(i)-1,t,n,e)):this.autoResize?(a=u=this.h,((l=h=this.w)<=a||t>l)&&(h=2*Math.max(t,l)),(a<l||n>a)&&(u=2*Math.max(n,a)),this.resize(h,u),this.packOne(t,n,e)):null},pt.prototype.allocFreebin=function(t,n,e,r){var i=this.freebins.splice(t,1)[0];return i.id=r,i.w=n,i.h=e,i.refcount=0,this.bins[r]=i,this.ref(i),i},pt.prototype.allocShelf=function(t,n,e,r){var i=this.shelves[t].alloc(n,e,r);return this.bins[r]=i,this.ref(i),i},pt.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,n=0,e=0;e<this.shelves.length;e++){var r=this.shelves[e];n+=r.h,t=Math.max(r.w-r.free,t)}this.resize(t,n)}},pt.prototype.getBin=function(t){return this.bins[t]},pt.prototype.ref=function(t){if(1==++t.refcount){var n=t.h;this.stats[n]=1+(0|this.stats[n])}return t.refcount},pt.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)},pt.prototype.clear=function(){this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0},pt.prototype.resize=function(t,n){this.w=t,this.h=n;for(var e=0;e<this.shelves.length;e++)this.shelves[e].resize(t);return!0},yt.prototype.alloc=function(t,n,e){if(t>this.free||n>this.h)return null;var r=this.x;return this.x+=t,this.free-=t,new mt(e,r,this.y,t,n,t,this.h)},yt.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0};var gt={exports:{}},vt={exports:{}},bt=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))},wt=Array.prototype.concat,Mt=Array.prototype.slice,xt=vt.exports=function(t){for(var n=[],e=0,r=t.length;e<r;e++){var i=t[e];bt(i)?n=wt.call(n,Mt.call(i)):n.push(i)}return n};xt.wrap=function(t){return function(){return t(xt(arguments))}};var Ft=vt.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]},At=Ft,Pt=Object.hasOwnProperty,St=Object.create(null);for(var _t in kt)Pt.call(kt,_t)&&(St[kt[_t]]=_t);var Ot=gt.exports={to:{},get:{}};function Ct(t,n,e){return Math.min(Math.max(n,t),e)}function Et(t){var n=Math.round(t).toString(16).toUpperCase();return n.length<2?"0"+n:n}Ot.get=function(t){var n,e;switch(t.substring(0,3).toLowerCase()){case"hsl":n=Ot.get.hsl(t),e="hsl";break;case"hwb":n=Ot.get.hwb(t),e="hwb";break;default:n=Ot.get.rgb(t),e="rgb"}return n?{model:e,value:n}:null},Ot.get.rgb=function(t){if(!t)return null;var n,e,r,i=[0,0,0,1];if(n=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(r=n[2],n=n[1],e=0;e<3;e++){var s=2*e;i[e]=parseInt(n.slice(s,s+2),16)}r&&(i[3]=parseInt(r,16)/255)}else if(n=t.match(/^#([a-f0-9]{3,4})$/i)){for(r=(n=n[1])[3],e=0;e<3;e++)i[e]=parseInt(n[e]+n[e],16);r&&(i[3]=parseInt(r+r,16)/255)}else if(n=t.match(/^rgba?\\(\\s*([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/)){for(e=0;e<3;e++)i[e]=parseInt(n[e+1],0);n[4]&&(n[5]?i[3]=.01*parseFloat(n[4]):i[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]:Pt.call(kt,n[1])?((i=kt[n[1]])[3]=1,i):null:null;for(e=0;e<3;e++)i[e]=Math.round(2.55*parseFloat(n[e+1]));n[4]&&(n[5]?i[3]=.01*parseFloat(n[4]):i[3]=parseFloat(n[4]))}for(e=0;e<3;e++)i[e]=Ct(i[e],0,255);return i[3]=Ct(i[3],0,1),i},Ot.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 e=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,Ct(parseFloat(n[2]),0,100),Ct(parseFloat(n[3]),0,100),Ct(isNaN(e)?1:e,0,1)]}return null},Ot.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 e=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,Ct(parseFloat(n[2]),0,100),Ct(parseFloat(n[3]),0,100),Ct(isNaN(e)?1:e,0,1)]}return null},Ot.to.hex=function(){var t=At(arguments);return"#"+Et(t[0])+Et(t[1])+Et(t[2])+(t[3]<1?Et(Math.round(255*t[3])):"")},Ot.to.rgb=function(){var t=At(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]+")"},Ot.to.rgb.percent=function(){var t=At(arguments),n=Math.round(t[0]/255*100),e=Math.round(t[1]/255*100),r=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+n+"%, "+e+"%, "+r+"%)":"rgba("+n+"%, "+e+"%, "+r+"%, "+t[3]+")"},Ot.to.hsl=function(){var t=At(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},Ot.to.hwb=function(){var t=At(arguments),n="";return t.length>=4&&1!==t[3]&&(n=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+n+")"},Ot.to.keyword=function(t){return St[t.slice(0,3)]};var It=gt.exports,$t={exports:{}},Tt={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]},Dt={};for(var zt in Tt)Tt.hasOwnProperty(zt)&&(Dt[Tt[zt]]=zt);var jt=$t.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 Ut in jt)if(jt.hasOwnProperty(Ut)){if(!("channels"in jt[Ut]))throw new Error("missing channels property: "+Ut);if(!("labels"in jt[Ut]))throw new Error("missing channel labels property: "+Ut);if(jt[Ut].labels.length!==jt[Ut].channels)throw new Error("channel and label counts mismatch: "+Ut);var Nt=jt[Ut].channels,Lt=jt[Ut].labels;delete jt[Ut].channels,delete jt[Ut].labels,Object.defineProperty(jt[Ut],"channels",{value:Nt}),Object.defineProperty(jt[Ut],"labels",{value:Lt})}function Rt(t,n){return Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2)+Math.pow(t[2]-n[2],2)}jt.rgb.hsl=function(t){var n,e,r=t[0]/255,i=t[1]/255,s=t[2]/255,o=Math.min(r,i,s),a=Math.max(r,i,s),u=a-o;return a===o?n=0:r===a?n=(i-s)/u:i===a?n=2+(s-r)/u:s===a&&(n=4+(r-i)/u),(n=Math.min(60*n,360))<0&&(n+=360),e=(o+a)/2,[n,100*(a===o?0:e<=.5?u/(a+o):u/(2-a-o)),100*e]},jt.rgb.hsv=function(t){var n,e,r,i,s,o=t[0]/255,a=t[1]/255,u=t[2]/255,l=Math.max(o,a,u),h=l-Math.min(o,a,u),c=function(t){return(l-t)/6/h+.5};return 0===h?i=s=0:(s=h/l,n=c(o),e=c(a),r=c(u),o===l?i=r-e:a===l?i=1/3+n-r:u===l&&(i=2/3+e-n),i<0?i+=1:i>1&&(i-=1)),[360*i,100*s,100*l]},jt.rgb.hwb=function(t){var n=t[0],e=t[1],r=t[2];return[jt.rgb.hsl(t)[0],100*(1/255*Math.min(n,Math.min(e,r))),100*(r=1-1/255*Math.max(n,Math.max(e,r)))]},jt.rgb.cmyk=function(t){var n,e=t[0]/255,r=t[1]/255,i=t[2]/255;return[100*((1-e-(n=Math.min(1-e,1-r,1-i)))/(1-n)||0),100*((1-r-n)/(1-n)||0),100*((1-i-n)/(1-n)||0),100*n]},jt.rgb.keyword=function(t){var n=Dt[t];if(n)return n;var e,r=1/0;for(var i in Tt)if(Tt.hasOwnProperty(i)){var s=Rt(t,Tt[i]);s<r&&(r=s,e=i)}return e},jt.keyword.rgb=function(t){return Tt[t]},jt.rgb.xyz=function(t){var n=t[0]/255,e=t[1]/255,r=t[2]/255;return[100*(.4124*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.3576*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.1805*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)),100*(.2126*n+.7152*e+.0722*r),100*(.0193*n+.1192*e+.9505*r)]},jt.rgb.lab=function(t){var n=jt.rgb.xyz(t),e=n[0],r=n[1],i=n[2];return r/=100,i/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(e-r),200*(r-(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116))]},jt.hsl.rgb=function(t){var n,e,r,i,s,o=t[0]/360,a=t[1]/100,u=t[2]/100;if(0===a)return[s=255*u,s,s];n=2*u-(e=u<.5?u*(1+a):u+a-u*a),i=[0,0,0];for(var l=0;l<3;l++)(r=o+1/3*-(l-1))<0&&r++,r>1&&r--,s=6*r<1?n+6*(e-n)*r:2*r<1?e:3*r<2?n+(e-n)*(2/3-r)*6:n,i[l]=255*s;return i},jt.hsl.hsv=function(t){var n=t[0],e=t[1]/100,r=t[2]/100,i=e,s=Math.max(r,.01);return e*=(r*=2)<=1?r:2-r,i*=s<=1?s:2-s,[n,100*(0===r?2*i/(s+i):2*e/(r+e)),100*((r+e)/2)]},jt.hsv.rgb=function(t){var n=t[0]/60,e=t[1]/100,r=t[2]/100,i=Math.floor(n)%6,s=n-Math.floor(n),o=255*r*(1-e),a=255*r*(1-e*s),u=255*r*(1-e*(1-s));switch(r*=255,i){case 0:return[r,u,o];case 1:return[a,r,o];case 2:return[o,r,u];case 3:return[o,a,r];case 4:return[u,o,r];case 5:return[r,o,a]}},jt.hsv.hsl=function(t){var n,e,r,i=t[0],s=t[1]/100,o=t[2]/100,a=Math.max(o,.01);return r=(2-s)*o,e=s*a,[i,100*(e=(e/=(n=(2-s)*a)<=1?n:2-n)||0),100*(r/=2)]},jt.hwb.rgb=function(t){var n,e,r,i,s,o,a,u=t[0]/360,l=t[1]/100,h=t[2]/100,c=l+h;switch(c>1&&(l/=c,h/=c),r=6*u-(n=Math.floor(6*u)),1&n&&(r=1-r),i=l+r*((e=1-h)-l),n){default:case 6:case 0:s=e,o=i,a=l;break;case 1:s=i,o=e,a=l;break;case 2:s=l,o=e,a=i;break;case 3:s=l,o=i,a=e;break;case 4:s=i,o=l,a=e;break;case 5:s=e,o=l,a=i}return[255*s,255*o,255*a]},jt.cmyk.rgb=function(t){var n=t[0]/100,e=t[1]/100,r=t[2]/100,i=t[3]/100;return[255*(1-Math.min(1,n*(1-i)+i)),255*(1-Math.min(1,e*(1-i)+i)),255*(1-Math.min(1,r*(1-i)+i))]},jt.xyz.rgb=function(t){var n,e,r,i=t[0]/100,s=t[1]/100,o=t[2]/100;return e=-.9689*i+1.8758*s+.0415*o,r=.0557*i+-.204*s+1.057*o,n=(n=3.2406*i+-1.5372*s+-.4986*o)>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,[255*(n=Math.min(Math.max(0,n),1)),255*(e=Math.min(Math.max(0,e),1)),255*(r=Math.min(Math.max(0,r),1))]},jt.xyz.lab=function(t){var n=t[0],e=t[1],r=t[2];return e/=100,r/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(e=e>.008856?Math.pow(e,1/3):7.787*e+16/116)-16,500*(n-e),200*(e-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]},jt.lab.xyz=function(t){var n,e,r,i=t[0];n=t[1]/500+(e=(i+16)/116),r=e-t[2]/200;var s=Math.pow(e,3),o=Math.pow(n,3),a=Math.pow(r,3);return e=s>.008856?s:(e-16/116)/7.787,n=o>.008856?o:(n-16/116)/7.787,r=a>.008856?a:(r-16/116)/7.787,[n*=95.047,e*=100,r*=108.883]},jt.lab.lch=function(t){var n,e=t[0],r=t[1],i=t[2];return(n=360*Math.atan2(i,r)/2/Math.PI)<0&&(n+=360),[e,Math.sqrt(r*r+i*i),n]},jt.lch.lab=function(t){var n,e=t[0],r=t[1];return n=t[2]/360*2*Math.PI,[e,r*Math.cos(n),r*Math.sin(n)]},jt.rgb.ansi16=function(t){var n=t[0],e=t[1],r=t[2],i=1 in arguments?arguments[1]:jt.rgb.hsv(t)[2];if(0===(i=Math.round(i/50)))return 30;var s=30+(Math.round(r/255)<<2|Math.round(e/255)<<1|Math.round(n/255));return 2===i&&(s+=60),s},jt.hsv.ansi16=function(t){return jt.rgb.ansi16(jt.hsv.rgb(t),t[2])},jt.rgb.ansi256=function(t){var n=t[0],e=t[1],r=t[2];return n===e&&e===r?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(e/255*5)+Math.round(r/255*5)},jt.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 e=.5*(1+~~(t>50));return[(1&n)*e*255,(n>>1&1)*e*255,(n>>2&1)*e*255]},jt.ansi256.rgb=function(t){if(t>=232){var n=10*(t-232)+8;return[n,n,n]}var e;return t-=16,[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},jt.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},jt.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 e=n[0];3===n[0].length&&(e=e.split("").map((function(t){return t+t})).join(""));var r=parseInt(e,16);return[r>>16&255,r>>8&255,255&r]},jt.rgb.hcg=function(t){var n,e=t[0]/255,r=t[1]/255,i=t[2]/255,s=Math.max(Math.max(e,r),i),o=Math.min(Math.min(e,r),i),a=s-o;return n=a<=0?0:s===e?(r-i)/a%6:s===r?2+(i-e)/a:4+(e-r)/a+4,n/=6,[360*(n%=1),100*a,100*(a<1?o/(1-a):0)]},jt.hsl.hcg=function(t){var n=t[1]/100,e=t[2]/100,r=1,i=0;return(r=e<.5?2*n*e:2*n*(1-e))<1&&(i=(e-.5*r)/(1-r)),[t[0],100*r,100*i]},jt.hsv.hcg=function(t){var n=t[1]/100,e=t[2]/100,r=n*e,i=0;return r<1&&(i=(e-r)/(1-r)),[t[0],100*r,100*i]},jt.hcg.rgb=function(t){var n=t[0]/360,e=t[1]/100,r=t[2]/100;if(0===e)return[255*r,255*r,255*r];var i,s=[0,0,0],o=n%1*6,a=o%1,u=1-a;switch(Math.floor(o)){case 0:s[0]=1,s[1]=a,s[2]=0;break;case 1:s[0]=u,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]=u,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]=u}return i=(1-e)*r,[255*(e*s[0]+i),255*(e*s[1]+i),255*(e*s[2]+i)]},jt.hcg.hsv=function(t){var n=t[1]/100,e=n+t[2]/100*(1-n),r=0;return e>0&&(r=n/e),[t[0],100*r,100*e]},jt.hcg.hsl=function(t){var n=t[1]/100,e=t[2]/100*(1-n)+.5*n,r=0;return e>0&&e<.5?r=n/(2*e):e>=.5&&e<1&&(r=n/(2*(1-e))),[t[0],100*r,100*e]},jt.hcg.hwb=function(t){var n=t[1]/100,e=n+t[2]/100*(1-n);return[t[0],100*(e-n),100*(1-e)]},jt.hwb.hcg=function(t){var n=t[1]/100,e=1-t[2]/100,r=e-n,i=0;return r<1&&(i=(e-r)/(1-r)),[t[0],100*r,100*i]},jt.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},jt.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},jt.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},jt.gray.hsl=jt.gray.hsv=function(t){return[0,0,t[0]]},jt.gray.hwb=function(t){return[0,100,t[0]]},jt.gray.cmyk=function(t){return[0,0,0,t[0]]},jt.gray.lab=function(t){return[t[0],0,0]},jt.gray.hex=function(t){var n=255&Math.round(t[0]/100*255),e=((n<<16)+(n<<8)+n).toString(16).toUpperCase();return"000000".substring(e.length)+e},jt.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};var Vt=$t.exports,Ht=Vt;function qt(t){var n=function(){for(var t={},n=Object.keys(Ht),e=n.length,r=0;r<e;r++)t[n[r]]={distance:-1,parent:null};return t}(),e=[t];for(n[t].distance=0;e.length;)for(var r=e.pop(),i=Object.keys(Ht[r]),s=i.length,o=0;o<s;o++){var a=i[o],u=n[a];-1===u.distance&&(u.distance=n[r].distance+1,u.parent=r,e.unshift(a))}return n}function Gt(t,n){return function(e){return n(t(e))}}function Jt(t,n){for(var e=[n[t].parent,t],r=Ht[n[t].parent][t],i=n[t].parent;n[i].parent;)e.unshift(n[i].parent),r=Gt(Ht[n[i].parent][i],r),i=n[i].parent;return r.conversion=e,r}var Wt=Vt,Bt=function(t){for(var n=qt(t),e={},r=Object.keys(n),i=r.length,s=0;s<i;s++){var o=r[s];null!==n[o].parent&&(e[o]=Jt(o,n))}return e},Xt={};Object.keys(Wt).forEach((function(t){Xt[t]={},Object.defineProperty(Xt[t],"channels",{value:Wt[t].channels}),Object.defineProperty(Xt[t],"labels",{value:Wt[t].labels});var n=Bt(t);Object.keys(n).forEach((function(e){var r=n[e];Xt[t][e]=function(t){var n=function(n){if(null==n)return n;arguments.length>1&&(n=Array.prototype.slice.call(arguments));var e=t(n);if("object"==typeof e)for(var r=e.length,i=0;i<r;i++)e[i]=Math.round(e[i]);return e};return"conversion"in t&&(n.conversion=t.conversion),n}(r),Xt[t][e].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}(r)}))}));var Yt=It,Kt=Xt,Zt=[].slice,Qt=["keyword","gray","hex"],tn={};Object.keys(Kt).forEach((function(t){tn[Zt.call(Kt[t].labels).sort().join("")]=t}));var nn={};function en(t,n){if(!(this instanceof en))return new en(t,n);if(n&&n in Qt&&(n=null),n&&!(n in Kt))throw new Error("Unknown model: "+n);var e,r;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 i=Yt.get(t);if(null===i)throw new Error("Unable to parse color from string: "+t);this.model=i.model,r=Kt[this.model].channels,this.color=i.value.slice(0,r),this.valpha="number"==typeof i.value[r]?i.value[r]:1}else if(t.length){this.model=n||"rgb",r=Kt[this.model].channels;var s=Zt.call(t,0,r);this.color=on(s,r),this.valpha="number"==typeof t[r]?t[r]: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 tn))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=tn[a];var u=Kt[this.model].labels,l=[];for(e=0;e<u.length;e++)l.push(t[u[e]]);this.color=on(l)}if(nn[this.model])for(r=Kt[this.model].channels,e=0;e<r;e++){var h=nn[this.model][e];h&&(this.color[e]=h(this.color[e]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}function rn(t,n,e){return(t=Array.isArray(t)?t:[t]).forEach((function(t){(nn[t]||(nn[t]=[]))[n]=e})),t=t[0],function(r){var i;return arguments.length?(e&&(r=e(r)),(i=this[t]()).color[n]=r,i):(i=this[t]().color[n],e&&(i=e(i)),i)}}function sn(t){return function(n){return Math.max(0,Math.min(t,n))}}function on(t,n){for(var e=0;e<n;e++)"number"!=typeof t[e]&&(t[e]=0);return t}en.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(t){var n=this.model in Yt.to?this:this.rgb(),e=1===(n=n.round("number"==typeof t?t:1)).valpha?n.color:n.color.concat(this.valpha);return Yt.to[n.model](e)},percentString:function(t){var n=this.rgb().round("number"==typeof t?t:1),e=1===n.valpha?n.color:n.color.concat(this.valpha);return Yt.to.rgb.percent(e)},array:function(){return 1===this.valpha?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var t={},n=Kt[this.model].channels,e=Kt[this.model].labels,r=0;r<n;r++)t[e[r]]=this.color[r];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:rn("rgb",0,sn(255)),green:rn("rgb",1,sn(255)),blue:rn("rgb",2,sn(255)),hue:rn(["hsl","hsv","hsl","hwb","hcg"],0,(function(t){return(t%360+360)%360})),saturationl:rn("hsl",1,sn(100)),lightness:rn("hsl",2,sn(100)),saturationv:rn("hsv",1,sn(100)),value:rn("hsv",2,sn(100)),chroma:rn("hcg",1,sn(100)),gray:rn("hcg",2,sn(100)),white:rn("hwb",1,sn(100)),wblack:rn("hwb",2,sn(100)),cyan:rn("cmyk",0,sn(100)),magenta:rn("cmyk",1,sn(100)),yellow:rn("cmyk",2,sn(100)),black:rn("cmyk",3,sn(100)),x:rn("xyz",0,sn(100)),y:rn("xyz",1,sn(100)),z:rn("xyz",2,sn(100)),l:rn("lab",0,sn(100)),a:rn("lab",1),b:rn("lab",2),keyword:function(t){return arguments.length?new en(t):Kt[this.model].keyword(this.color)},hex:function(t){return arguments.length?new en(t):Yt.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=[],e=0;e<t.length;e++){var r=t[e]/255;n[e]=r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4)}return.2126*n[0]+.7152*n[1]+.0722*n[2]},contrast:function(t){var n=this.luminosity(),e=t.luminosity();return n>e?(n+.05)/(e+.05):(e+.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(),e=n.color[0];return e=(e=(e+t)%360)<0?360+e:e,n.color[0]=e,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 e=t.rgb(),r=this.rgb(),i=void 0===n?.5:n,s=2*i-1,o=e.alpha()-r.alpha(),a=((s*o==-1?s:(s+o)/(1+s*o))+1)/2,u=1-a;return en.rgb(a*e.red()+u*r.red(),a*e.green()+u*r.green(),a*e.blue()+u*r.blue(),e.alpha()*i+r.alpha()*(1-i))}},Object.keys(Kt).forEach((function(t){if(-1===Qt.indexOf(t)){var n=Kt[t].channels;en.prototype[t]=function(){if(this.model===t)return new en(this);if(arguments.length)return new en(arguments,t);var e,r="number"==typeof arguments[n]?n:this.valpha;return new en((e=Kt[this.model][t].raw(this.color),Array.isArray(e)?e:[e]).concat(r),t)},en[t]=function(e){return"number"==typeof e&&(e=on(Zt.call(arguments),n)),new en(e,t)}}}));var an=ht(en);\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 un=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function ln(t){return new Function("f",\`var p = (f && f.properties || {}); return ${o}cn(t)}\`)}function hn(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":case"!has":return 2===t.length&&("string"==typeof t[1]||t[1].property&&t[1].op);case"in":case"!in":return t.length>=2&&("string"==typeof t[1]||t[1].property&&t[1].op);case"==":case"!=":case">":case">=":case"<":case"<=":return 3===t.length&&("string"==typeof t[1]||t[1].property&&t[1].op);case"none":case"any":case"all":for(const n of t.slice(1))if(!hn(n)&&"boolean"!=typeof n)return!1;return!0;case"contains":return!0;default:return!1}}function cn(t){if(!t)return"true";const n=t[0];if(t.length<=1)return"any"===n?"false":"true";return\`(${o}"=="===n?dn(t[1],t[2],"===",!1):"!="===n?dn(t[1],t[2],"!==",!1):"<"===n||">"===n||"<="===n||">="===n?dn(t[1],t[2],n,!0):"any"===n?yn(t.slice(1),"||"):"all"===n?yn(t.slice(1),"&&"):"none"===n?vn(yn(t.slice(1),"||")):"in"===n?mn(t[1],t.slice(2)):"!in"===n?vn(mn(t[1],t.slice(2))):"has"===n?gn(t[1]):"!has"===n?vn(gn(t[1])):"contains"===n?function(t,n,e){const r=fn(t);return void 0!==e?\`(${o}r} + '').indexOf("${o}n}") === ${o}e}\`:\`(${o}r} + '').indexOf("${o}n}") >= 0\`}(t[1],t[2],t[3]):"true"})\`}function fn(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function dn(t,n,e,r){if("object"==typeof(i=t)&&i&&t.op)return function(t,n,e,r){const i=t.property,s=t.op;let o=fn(i);return"length"!==s?(console.error(\`not support ${o}s} op\`),"false"):(o=\`((${o}o}+='').length)\`,pn(o,i,n,e,r))}(t,n,e,r);var i;return pn(fn(t),t,n,e,r)}function pn(t,n,e,r,i){const s="$type"===n?un.indexOf(e):JSON.stringify(e);return(i?\`typeof ${o}t}=== typeof ${o}s}&&\`:"")+t+r+s}function yn(t,n){return t.map(cn).join(n)}function mn(t,n){"$type"===t&&(n=n.map((t=>un.indexOf(t))));const e=JSON.stringify(n.sort(bn)),r=fn(t);return n.length<=200?\`${o}e}.indexOf(${o}r}) !== -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; }(${o}r}, ${o}e},0,${o}n.length-1})\`}function gn(t){return"$id"===t?'"id" in f':\`${o}JSON.stringify(t)} in p\`}function vn(t){return\`!(${o}t})\`}function bn(t,n){return t<n?-1:t>n?1:0}var wn={exports:{}};wn.exports=function(){function t(t,e,i,s,o){n(t,e,i||0,s||t.length-1,o||r)}function n(t,r,i,s,o){for(;s>i;){if(s-i>600){var a=s-i+1,u=r-i+1,l=Math.log(a),h=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*h*(a-h)/a)*(u-a/2<0?-1:1);n(t,r,Math.max(i,Math.floor(r-u*h/a+c)),Math.min(s,Math.floor(r+(a-u)*h/a+c)),o)}var f=t[r],d=i,p=s;for(e(t,i,r),o(t[s],f)>0&&e(t,i,s);d<p;){for(e(t,d,p),d++,p--;o(t[d],f)<0;)d++;for(;o(t[p],f)>0;)p--}0===o(t[i],f)?e(t,i,p):e(t,++p,s),p<=r&&(i=p+1),r<=p&&(s=p-1)}}function e(t,n,e){var r=t[n];t[n]=t[e],t[e]=r}function r(t,n){return t<n?-1:t>n?1:0}return t}();var Mn=ht(wn.exports);class xn{constructor(t=[],n=Fn){if(this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this.U(t)}push(t){this.data.push(t),this.length++,this.L(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this.U(0)),t}peek(){return this.data[0]}L(t){const{data:n,compare:e}=this,r=n[t];for(;t>0;){const i=t-1>>1,s=n[i];if(e(r,s)>=0)break;n[t]=s,t=i}n[t]=r}U(t){const{data:n,compare:e}=this,r=this.length>>1,i=n[t];for(;t<r;){let r=1+(t<<1),s=n[r];const o=r+1;if(o<this.length&&e(n[o],s)<0&&(r=o,s=n[o]),e(s,i)>=0)break;n[t]=s,t=r}n[t]=i}}function Fn(t,n){return t<n?-1:t>n?1:0}var kn="undefined"!=typeof Float32Array?Float32Array:Array;function An(){var t=new kn(3);return kn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Pn(t,n,e){var r=new kn(3);return r[0]=t,r[1]=n,r[2]=e,r}function Sn(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function _n(t,n,e,r){return t[0]=n,t[1]=e,t[2]=r,t}function On(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t}function Cn(t,n){var e=n[0],r=n[1],i=n[2],s=e*e+r*r+i*i;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 En(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function In(t,n,e){var r=n[0],i=n[1],s=n[2],o=e[0],a=e[1],u=e[2];return t[0]=i*u-s*a,t[1]=s*o-r*u,t[2]=r*a-i*o,t}var $n=function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t};function Tn(){var t=new kn(4);return kn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Dn(t,n){var e=n[0]+n[4]+n[8],r=void 0;if(e>0)r=Math.sqrt(e+1),t[3]=.5*r,r=.5/r,t[0]=(n[5]-n[7])*r,t[1]=(n[6]-n[2])*r,t[2]=(n[1]-n[3])*r;else{var i=0;n[4]>n[0]&&(i=1),n[8]>n[3*i+i]&&(i=2);var s=(i+1)%3,o=(i+2)%3;r=Math.sqrt(n[3*i+i]-n[3*s+s]-n[3*o+o]+1),t[i]=.5*r,r=.5/r,t[3]=(n[3*s+o]-n[3*o+s])*r,t[s]=(n[3*s+i]+n[3*i+s])*r,t[o]=(n[3*o+i]+n[3*i+o])*r}return t}!function(){var t=An()}(),function(){var t,n=(t=new kn(4),kn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var zn,jn=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},Un=function(t,n){var e=n[0],r=n[1],i=n[2],s=n[3],o=e*e+r*r+i*i+s*s;return o>0&&(o=1/Math.sqrt(o),t[0]=e*o,t[1]=r*o,t[2]=i*o,t[3]=s*o),t};An(),Pn(1,0,0),Pn(0,1,0),Tn(),Tn(),zn=new kn(9),kn!=Float32Array&&(zn[1]=0,zn[2]=0,zn[3]=0,zn[5]=0,zn[6]=0,zn[7]=0),zn[0]=1,zn[4]=1,zn[8]=1;\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */\nconst Nn=8,Ln=[],Rn=[],Vn=[],Hn=[];function qn(t,n,e){const r=In(Rn,n,e),i=function(t,n,e,r,i,s,o,a,u,l){return t[0]=n,t[1]=e,t[2]=r,t[3]=i,t[4]=s,t[5]=o,t[6]=a,t[7]=u,t[8]=l,t}(Ln,e[0],e[1],e[2],...r,...n);t=Dn(t,i),t=function(t){return t[3]<0?jn(t,t,-1):t}(t=Un(t,t));const s=1/((1<<2*Nn-1)-1);if(t[3]<s){t[3]=s;const n=Math.sqrt(1-s*s);t[0]*=n,t[1]*=n,t[2]*=n}const o=e[3]>0?In(Vn,e,n):In(Vn,n,e);return En(In(Hn,e,n),o)<0&&jn(t,t,-1),t}const Gn=[];function Jn(t,n,e){const r=e||[];r.setLength&&r.setLength(t.length);const i=Gn;i.length<t.length/3&&(i.length=t.length/3),i.fill(0,0,t.length/3);const s=void 0===n.length?n:n.length;for(let e=0;e<s/3;e++)void 0===n.length?te(t,3*e,3*e+1,3*e+2,r,i):te(t,n[3*e],n[3*e+1],n[3*e+2],r,i);const o=r.getLength?r.getLength():r.length;for(let t=0;t<o;t+=3){const n=i[t/3];0!==n?(r[t]/=n,r[t+1]/=n,r[t+2]/=n):(r[t]=0,r[t+1]=0,r[t+2]=0)}return r}const Wn=[],Bn=[],Xn=[],Yn=[],Kn=[],Zn=[],Qn=[];function te(t,n,e,r,i,s){_n(Yn,t[3*n],t[3*n+1],t[3*n+2]),_n(Kn,t[3*e],t[3*e+1],t[3*e+2]),_n(Zn,t[3*r],t[3*r+1],t[3*r+2]);const o=$n(Wn,Zn,Kn),a=$n(Bn,Yn,Kn),u=In(Xn,o,a);Cn(Qn,u),i[3*n]=i[3*n]||0,i[3*e]=i[3*e]||0,i[3*r]=i[3*r]||0,i[3*n+1]=i[3*n+1]||0,i[3*e+1]=i[3*e+1]||0,i[3*r+1]=i[3*r+1]||0,i[3*n+2]=i[3*n+2]||0,i[3*e+2]=i[3*e+2]||0,i[3*r+2]=i[3*r+2]||0,i[3*n]+=Qn[0],i[3*e]+=Qn[0],i[3*r]+=Qn[0],i[3*n+1]+=Qn[1],i[3*e+1]+=Qn[1],i[3*r+1]+=Qn[1],i[3*n+2]+=Qn[2],i[3*e+2]+=Qn[2],i[3*r+2]+=Qn[2],s[n]+=1,s[e]+=1,s[r]+=1}\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 ne(t,n,e){return t[0]=n[e],t[1]=n[e+1],t[2]=n[e+2],t}function ee(t,n,e){return t[0]=n[e],t[1]=n[e+1],t}var re={exports:{}};function ie(t,n,e){e=e||2;var r,i,s,o,a,u,l,h=n&&n.length,c=h?n[0]*e:t.length,f=se(t,0,c,e,!0),d=[];if(!f||f.next===f.prev)return d;if(h&&(f=function(t,n,e,r){var i,s,o,a=[];for(i=0,s=n.length;i<s;i++)(o=se(t,n[i]*r,i<s-1?n[i+1]*r:t.length,r,!1))===o.next&&(o.steiner=!0),a.push(me(o));for(a.sort(fe),i=0;i<a.length;i++)e=de(a[i],e);return e}(t,n,f,e)),t.length>80*e){r=s=t[0],i=o=t[1];for(var p=e;p<c;p+=e)(a=t[p])<r&&(r=a),(u=t[p+1])<i&&(i=u),a>s&&(s=a),u>o&&(o=u);l=0!==(l=Math.max(s-r,o-i))?32767/l:0}return ae(f,d,e,r,i,l,0),d}function se(t,n,e,r,i){var s,o;if(i===Oe(t,n,e,r)>0)for(s=n;s<e;s+=r)o=Pe(s,t[s],t[s+1],o);else for(s=e-r;s>=n;s-=r)o=Pe(s,t[s],t[s+1],o);return o&&we(o,o.next)&&(Se(o),o=o.next),o}function oe(t,n){if(!t)return t;n||(n=t);var e,r=t;do{if(e=!1,r.steiner||!we(r,r.next)&&0!==be(r.prev,r,r.next))r=r.next;else{if(Se(r),(r=n=r.prev)===r.next)break;e=!0}}while(e||r!==n);return n}function ae(t,n,e,r,i,s,o){if(t){!o&&s&&function(t,n,e,r){var i=t;do{0===i.z&&(i.z=ye(i.x,i.y,n,e,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var n,e,r,i,s,o,a,u,l=1;do{for(e=t,t=null,s=null,o=0;e;){for(o++,r=e,a=0,n=0;n<l&&(a++,r=r.nextZ);n++);for(u=l;a>0||u>0&&r;)0!==a&&(0===u||!r||e.z<=r.z)?(i=e,e=e.nextZ,a--):(i=r,r=r.nextZ,u--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;e=r}s.nextZ=null,l*=2}while(o>1)}(i)}(t,r,i,s);for(var a,u,l=t;t.prev!==t.next;)if(a=t.prev,u=t.next,s?le(t,r,i,s):ue(t))n.push(a.i/e|0),n.push(t.i/e|0),n.push(u.i/e|0),Se(t),t=u.next,l=u.next;else if((t=u)===l){o?1===o?ae(t=he(oe(t),n,e),n,e,r,i,s,2):2===o&&ce(t,n,e,r,i,s):ae(oe(t),n,e,r,i,s,1);break}}}function ue(t){var n=t.prev,e=t,r=t.next;if(be(n,e,r)>=0)return!1;for(var i=n.x,s=e.x,o=r.x,a=n.y,u=e.y,l=r.y,h=i<s?i<o?i:o:s<o?s:o,c=a<u?a<l?a:l:u<l?u:l,f=i>s?i>o?i:o:s>o?s:o,d=a>u?a>l?a:l:u>l?u:l,p=r.next;p!==n;){if(p.x>=h&&p.x<=f&&p.y>=c&&p.y<=d&&ge(i,a,s,u,o,l,p.x,p.y)&&be(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function le(t,n,e,r){var i=t.prev,s=t,o=t.next;if(be(i,s,o)>=0)return!1;for(var a=i.x,u=s.x,l=o.x,h=i.y,c=s.y,f=o.y,d=a<u?a<l?a:l:u<l?u:l,p=h<c?h<f?h:f:c<f?c:f,y=a>u?a>l?a:l:u>l?u:l,m=h>c?h>f?h:f:c>f?c:f,g=ye(d,p,n,e,r),v=ye(y,m,n,e,r),b=t.prevZ,w=t.nextZ;b&&b.z>=g&&w&&w.z<=v;){if(b.x>=d&&b.x<=y&&b.y>=p&&b.y<=m&&b!==i&&b!==o&&ge(a,h,u,c,l,f,b.x,b.y)&&be(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,w.x>=d&&w.x<=y&&w.y>=p&&w.y<=m&&w!==i&&w!==o&&ge(a,h,u,c,l,f,w.x,w.y)&&be(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;b&&b.z>=g;){if(b.x>=d&&b.x<=y&&b.y>=p&&b.y<=m&&b!==i&&b!==o&&ge(a,h,u,c,l,f,b.x,b.y)&&be(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;w&&w.z<=v;){if(w.x>=d&&w.x<=y&&w.y>=p&&w.y<=m&&w!==i&&w!==o&&ge(a,h,u,c,l,f,w.x,w.y)&&be(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function he(t,n,e){var r=t;do{var i=r.prev,s=r.next.next;!we(i,s)&&Me(i,r,r.next,s)&&ke(i,s)&&ke(s,i)&&(n.push(i.i/e|0),n.push(r.i/e|0),n.push(s.i/e|0),Se(r),Se(r.next),r=t=s),r=r.next}while(r!==t);return oe(r)}function ce(t,n,e,r,i,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&ve(o,a)){var u=Ae(o,a);return o=oe(o,o.next),u=oe(u,u.next),ae(o,n,e,r,i,s,0),void ae(u,n,e,r,i,s,0)}a=a.next}o=o.next}while(o!==t)}function fe(t,n){return t.x-n.x}function de(t,n){var e=function(t,n){var e,r=n,i=t.x,s=t.y,o=-1/0;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var a=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>o&&(o=a,e=r.x<r.next.x?r:r.next,a===i))return e}r=r.next}while(r!==n);if(!e)return null;var u,l=e,h=e.x,c=e.y,f=1/0;r=e;do{i>=r.x&&r.x>=h&&i!==r.x&&ge(s<c?i:o,s,h,c,s<c?o:i,s,r.x,r.y)&&(u=Math.abs(s-r.y)/(i-r.x),ke(r,t)&&(u<f||u===f&&(r.x>e.x||r.x===e.x&&pe(e,r)))&&(e=r,f=u)),r=r.next}while(r!==l);return e}(t,n);if(!e)return n;var r=Ae(e,t);return oe(r,r.next),oe(e,e.next)}function pe(t,n){return be(t.prev,t,n.prev)<0&&be(n.next,t,t.next)<0}function ye(t,n,e,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-e)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-r)*i|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function me(t){var n=t,e=t;do{(n.x<e.x||n.x===e.x&&n.y<e.y)&&(e=n),n=n.next}while(n!==t);return e}function ge(t,n,e,r,i,s,o,a){return(i-o)*(n-a)>=(t-o)*(s-a)&&(t-o)*(r-a)>=(e-o)*(n-a)&&(e-o)*(s-a)>=(i-o)*(r-a)}function ve(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==n.i&&e.next.i!==n.i&&Me(e,e.next,t,n))return!0;e=e.next}while(e!==t);return!1}(t,n)&&(ke(t,n)&&ke(n,t)&&function(t,n){var e=t,r=!1,i=(t.x+n.x)/2,s=(t.y+n.y)/2;do{e.y>s!=e.next.y>s&&e.next.y!==e.y&&i<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next}while(e!==t);return r}(t,n)&&(be(t.prev,t,n.prev)||be(t,n.prev,n))||we(t,n)&&be(t.prev,t,t.next)>0&&be(n.prev,n,n.next)>0)}function be(t,n,e){return(n.y-t.y)*(e.x-n.x)-(n.x-t.x)*(e.y-n.y)}function we(t,n){return t.x===n.x&&t.y===n.y}function Me(t,n,e,r){var i=Fe(be(t,n,e)),s=Fe(be(t,n,r)),o=Fe(be(e,r,t)),a=Fe(be(e,r,n));return i!==s&&o!==a||(!(0!==i||!xe(t,e,n))||(!(0!==s||!xe(t,r,n))||(!(0!==o||!xe(e,t,r))||!(0!==a||!xe(e,n,r)))))}function xe(t,n,e){return n.x<=Math.max(t.x,e.x)&&n.x>=Math.min(t.x,e.x)&&n.y<=Math.max(t.y,e.y)&&n.y>=Math.min(t.y,e.y)}function Fe(t){return t>0?1:t<0?-1:0}function ke(t,n){return be(t.prev,t,t.next)<0?be(t,n,t.next)>=0&&be(t,t.prev,n)>=0:be(t,n,t.prev)<0||be(t,t.next,n)<0}function Ae(t,n){var e=new _e(t.i,t.x,t.y),r=new _e(n.i,n.x,n.y),i=t.next,s=n.prev;return t.next=n,n.prev=t,e.next=i,i.prev=e,r.next=e,e.prev=r,s.next=r,r.prev=s,r}function Pe(t,n,e,r){var i=new _e(t,n,e);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Se(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 _e(t,n,e){this.i=t,this.x=n,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Oe(t,n,e,r){for(var i=0,s=n,o=e-r;s<e;s+=r)i+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return i}re.exports=ie,re.exports.default=ie,ie.deviation=function(t,n,e,r){var i=n&&n.length,s=i?n[0]*e:t.length,o=Math.abs(Oe(t,0,s,e));if(i)for(var a=0,u=n.length;a<u;a++){var l=n[a]*e,h=a<u-1?n[a+1]*e:t.length;o-=Math.abs(Oe(t,l,h,e))}var c=0;for(a=0;a<r.length;a+=3){var f=r[a]*e,d=r[a+1]*e,p=r[a+2]*e;c+=Math.abs((t[f]-t[p])*(t[d+1]-t[f+1])-(t[f]-t[d])*(t[p+1]-t[f+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},ie.flatten=function(t){for(var n=t[0][0].length,e={vertices:[],holes:[],dimensions:n},r=0,i=0;i<t.length;i++){for(var s=0;s<t[i].length;s++)for(var o=0;o<n;o++)e.vertices.push(t[i][s][o]);i>0&&(r+=t[i-1].length,e.holes.push(r))}return e};var Ce=ht(re.exports),Ee="undefined"!=typeof Float32Array?Float32Array:Array;function Ie(t,n,e,r){return t[0]=n,t[1]=e,t[2]=r,t}function $e(t,n){var e=n[0],r=n[1],i=n[2],s=e*e+r*r+i*i;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 Te(t,n,e){var r=n[0],i=n[1],s=n[2],o=e[0],a=e[1],u=e[2];return t[0]=i*u-s*a,t[1]=s*o-r*u,t[2]=r*a-i*o,t}function De(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function ze(t,n,e,r,i){return t[0]=n,t[1]=e,t[2]=r,t[3]=i,t}function je(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t[3]=n[3]/e[3],t}function Ue(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t}function Ne(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]}function Le(t,n,e){return t[0]=n,t[1]=e,t}function Re(t,n){var e=n[0]-t[0],r=n[1]-t[1];return Math.hypot(e,r)}Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)}),function(){var t=function(){var t=new Ee(3);return Ee!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}()}(),function(){var t=function(){var t=new Ee(4);return Ee!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}()}();var Ve=function(t){var n=t[0],e=t[1];return Math.hypot(n,e)};!function(){var t=function(){var t=new Ee(2);return Ee!=Float32Array&&(t[0]=0,t[1]=0),t}()}();\n/*!\n * @maptalks/vector-packer v0.96.0\n * LICENSE : UNLICENSED\n * (c) 2016-2024 maptalks.com\n */\nconst He={Point:1,LineString:2,Polygon:3,MultiPoint:4,MultiLineString:5,MultiPolygon:6};function qe(t,n={}){var e=[];if("FeatureCollection"===t.type)for(var r=0;r<t.features.length;r++)Ge(e,t.features[r],n,r);else Ge(e,"Feature"===t.type?t:{geometry:t},n);return e}function Ge(t,n,e,r){if(n.geometry&&n.geometry.geometry){var i=n.geometry.coordinates,s=n.geometry.type,o=[],a=n.id;if(e.promoteId?a=n.properties[e.promoteId]:e.generateId&&(a=r||0),"Point"===s)Je(i,o);else if("MultiPoint"===s)for(var u=0;u<i.length;u++)Je(i[u],o);else if("LineString"===s)Be([i],o);else if("MultiLineString"===s){if(e.lineMetrics){for(u=0;u<i.length;u++)We(i[u],o=[]),t.push(Xe(a,"LineString",o,n.properties));return}Be(i,o)}else if("Polygon"===s)Be(i,o);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<n.geometry.geometries.length;u++)Ge(t,{id:a,geometry:n.geometry.geometries[u],properties:n.properties},e,r);return}return void console.warn(\`Input data type(${o}s}) is not a valid GeoJSON geometry type.\`)}for(u=0;u<i.length;u++){var l=[];Be(i[u],l),o.push(l)}}t.push(Xe(a,s,o,n.properties))}}function Je(t,n){const e=new dt(t[0],t[1]);e.z=100*(t[2]||0),n.push([e])}function We(t,n){for(let e=0;e<t.length;e++){const r=new dt(t[e][0],t[e][1]);r.z=100*(t[e][2]||0),n.push(r)}}function Be(t,n,e,r){for(var i=0;i<t.length;i++){var s=[];We(t[i],s),n.push(s)}}function Xe(t,n,e,r){return{id:void 0===t?null:t,type:He[n],geometry:e,properties:r}}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */function Ye(t,{width:n,height:e},r,i){if(i){if(i.length!==n*e*r)throw new RangeError("mismatched image size")}else i=new Uint8Array(n*e*r);return t.width=n,t.height=e,t.data=i,t}function Ke(t,{width:n,height:e},r){if(n===t.width&&e===t.height)return;const i=Ye({},{width:n,height:e},r);Ze(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,e)},r),t.width=n,t.height=e,t.data=i.data}function Ze(t,n,e,r,i,s){if(0===i.width||0===i.height)return n;if(i.width>t.width||i.height>t.height||e.x>t.width-i.width||e.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>n.width||i.height>n.height||r.x>n.width-i.width||r.y>n.height-i.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 u=0;u<i.height;u++){const l=((e.y+u)*t.width+e.x)*s,h=((r.y+u)*n.width+r.x)*s;for(let t=0;t<i.width*s;t++)a[h+t]=o[l+t]}return n}class Qe{constructor(t,n){Ye(this,t,1,n)}resize(t){Ke(this,t,1)}clone(){return new Qe({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,e,r,i){Ze(t,n,e,r,i,1)}}class tr{constructor(t,n){Ye(this,t,4,n)}resize(t){Ke(this,t,4)}clone(){return new tr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,e,r,i){Ze(t,n,e,r,i,4)}}function nr(t){let n=0;for(let e,r,i=0,s=t.length,o=s-1;i<s;o=i++)if(e=t[i],r=t[o],void 0!==e.x){if(e.z||r.z)return 1;n+=(r.x-e.x)*(e.y+r.y)}else{if(e[2]||r[2])return 1;n+=(r[0]-e[0])*(e[1]+r[1])}return n}function er(t,n,e,r,i){const s=t[n*r],o=t[n*r+1],a=t[e*r],u=t[e*r+1];return s===a&&(s<0||s>i)&&o!==u||o===u&&(o<0||o>i)&&s!==a}function rr(t,n,e){let r=e;return n&&t&&(r=+t[n]),isNaN(r)&&(r=e||0),100*r}function ir(t,n,e,r,i,s,o){n||0===n||(n=1);const a=rr(t.properties,e,r),u=a*n;let l=(s?100*s:0)||a;return i?l=rr(t.properties,i,s):o&&(l=a-rr(t.properties,o,s)),l*=n,{altitude:u,height:l}}function sr(t,n){return n<1/0&&(t.x<0||t.x>n||t.y<0||t.y>n)}function or(t){return null==t}function ar(t,n,e){if(t===e||t===n)return t;const r=e-n;return((t-n)%r+r)%r+n}function ur(t,n){if(!n)return null;const e=new Map;for(let r=0;r<n.length;r++){const i=n[r],s=t[i];let o=e.get(s);o||(o=[],e.set(s,o)),o.push(i)}return e}function lr(t){return!(t&t-1)&&0!==t}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */class hr{constructor(t,n,{pixelRatio:e}){this.paddedRect=t,this.pixelRatio=e||1,this.padding=n}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.pixelRatio,(this.paddedRect.h-2*this.padding)/this.pixelRatio]}}class cr{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n=Object.keys(t).length,e={},r=new pt(0,0,{autoResize:!0}),i=[],s=n>1?1:0;for(const n in t){const r=t[n],o={x:0,y:0,w:r.data.width+2*s,h:r.data.height+2*s};i.push(o),e[n]=new hr(o,s,r)}if(r.pack(i,{inPlace:!0}),!lr(r.w)||!lr(r.h)){const t=fr(r.w),n=fr(r.h);r.resize(t,n)}const o=new tr({width:r.w,height:r.h});for(const n in t){const r=t[n],i=e[n].paddedRect;tr.copy(r.data,o,{x:0,y:0},{x:i.x+s,y:i.y+s},r.data)}this.image=o,this.positions=e}}function fr(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 dr{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n={},e=new pt(0,0,{autoResize:!0}),r=[];for(const e in t){const i=t[e],s=n[e]={};for(const t in i){const n=i[+t];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const e={x:0,y:0,w:n.bitmap.width+2,h:n.bitmap.height+2};r.push(e),s[t]={rect:e,metrics:n.metrics}}}e.pack(r,{inPlace:!0});const i=new Qe({width:e.w,height:e.h});for(const e in t){const r=t[e];for(const t in r){const s=r[+t];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const o=n[e][t].rect;Qe.copy(s.bitmap,i,{x:0,y:0},{x:o.x+1,y:o.y+1},s.bitmap)}}this.image=i,this.positions=n}}function pr(t){return t<65536?Uint16Array:Uint32Array}function yr(t){return(t=Math.abs(t))<128?Int8Array:t<32768?Int16Array:Float32Array}function mr(t){return t<256?Uint8Array:t<65536?Uint16Array:Float32Array}function gr(t,n){const e=t.getLength?t.getLength():t.length;if(t instanceof n)return t.slice(0,e);const r=new n(e);t=t.R||t;for(let n=0;n<e;n++)r[n]=t[n]||0;return r}function vr(t){const n=t.type,e=[];if(1===n||4===n)for(let n=0;n<t.geometry.length;n++)Je(t.geometry[n],e);else if(2===n)Be(t.geometry,e);else if(3===n)Be(t.geometry,e);else if(5===n)Be(t.geometry,e);else if(6===n)for(let n=0;n<t.geometry.length;n++){const r=[];Be(t.geometry[n],r),e.push(r)}return t.geometry=e,t}function br(t){for(let n=1;n<arguments.length;n++){const e=arguments[n];for(const n in e)t[n]=e[n]}return t}function wr(t){return null==t}function Mr(t){return"number"==typeof t&&!isNaN(t)}function xr(t){return"object"==typeof t&&!!t}function Fr(t){return!wr(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function kr(t){return!wr(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}const Ar=Object.prototype.hasOwnProperty;function Pr(t,n){return Ar.call(t,n)}const Sr=Math.PI/180;function _r(t){return t&&y(t)&&t.property}function Or(t){const{verticalCentimeterToPoint:n,tileRatio:e}=t;return n*e}function Cr(t){return"centimeter"===t||"cm"===t?1:"millimeter"===t||"mm"===t?.1:100}const Er={};function Ir(t,n){if(!Array.isArray(n)){if(n&&void 0!==n.r&&void 0!==n.g&&void 0!==n.b)return t[0]=255*n.r,t[1]=255*n.g,t[2]=255*n.b,t[3]=void 0!==n.a?255*n.a:255,t;n=Er[n]=Er[n]||an(n).unitArray()}for(let e=0;e<n.length;e++)t[e]=255*n[e];return 3===n.length&&(t[3]=255),t}const $r={textFill:1,textSize:1,textOpacity:1,textDx:1,textDy:1,markerWidth:1,markerHeight:1,markerOpacity:1,markerDx:1,markerDy:1,lineWidth:1,lineColor:1,lineOpacity:1,polygonFill:1,polygonOpacity:1,polygonPatternFileWidth:1,polygonPatternFileOrigin:1,rotationX:1,rotationY:1,rotationZ:1,scaleX:1,scaleY:1,scaleZ:1,translationX:1,translationY:1,translationZ:1},Tr={textName:1,markerTextFitPadding:1,markerTextFit:1,lineGradientProperty:1};var Dr=Object.freeze({__proto__:null,checkIfIdentityZoomDependent:function(t,n,e){if(Array.isArray(e)||(e=Object.values(e)),!e||!e.length)return!1;if(!$r[t])return!1;for(let t=0;t<e.length;t++){const r=e[t]&&(e[t].feature||e[t]);if(!r)continue;const i=r.properties&&r.properties[n];if(i&&y(i)&&!m(i).isZoomConstant)return!0}return!1},checkIfZoomFnTypeSymbol:function(t){return!!$r[t]||!!Tr[t]},evaluate:function(t,n,e){return kr(t)?t(void 0!==e?e:null,n):t},extend:br,getAltitudeToLocal:Or,getTubeSizeScale:Cr,hasOwn:Pr,isFnTypeSymbol:_r,isFunction:kr,isInteger:function(t){return(0|t)===t},isNil:wr,isNumber:Mr,isObject:xr,isString:Fr,join:function(t,n){return t.join?t.join(n||","):Array.prototype.join.call(t,n||",")},normalizeColor:Ir,now:function(){return Date.now()},toDegree:function(t){return t/Sr},toRadian:function(t){return t*Sr}});class zr{constructor(t,n,e,r){this.feature=t,this.symbol=n,this.fnTypes=e,this.options=r}getPolygonResource(){let t=this.symbol.polygonPatternFile;const{polygonPatternFileFn:n}=this.fnTypes;return this.V(t,n)}getLineResource(){let t=this.symbol.linePatternFile;const{linePatternFileFn:n}=this.fnTypes;return this.V(t,n)}V(t,n){return n&&(t=n(this.options.zoom,this.feature.properties)),t}}function jr(t,n,e,r){const i=Math.abs(r)>>15,s=i>>1,o=i%2;let a=r%Math.pow(2,15);const u=n+(s<<14)*Math.sign(n),l=e+(o<<14)*Math.sign(e);return t[0]=u,t[1]=l,a=Math.round(a),t[2]=0===a?r<0?-1:0:a,t}const Ur=Math.pow(2,14),Nr=Math.pow(2,15);\n/*!\n * a compact version of mapbox-gl-style-spec\n * based on mapbox-gl-style-spec@13.28.0\n * https://github.com/mapbox/mapbox-gl-js/tree/main/src/style-spec\n * LICENSE : ISC\n */var Lr,Rr,Vr="undefined"!=typeof undefinedThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof undefined?global:"undefined"!=typeof self?self:{},Hr={exports:{}};function qr(t,...n){for(const e of n)for(const n in e)t[n]=e[n];return t}\n/*! https://mths.be/punycode v1.3.2 by @mathias */Lr=Hr,Rr=Hr.exports,function(t){var n=Rr&&!Rr.nodeType&&Rr,e=Lr&&!Lr.nodeType&&Lr,r="object"==typeof Vr&&Vr;r.global!==r&&r.window!==r&&r.self!==r||(t=r);var i,s,o=2147483647,a=36,u=26,l=38,h=700,c=/^xn--/,f=/[^\\x20-\\x7E]/,d=/[\\x2E\\u3002\\uFF0E\\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=a-1,m=Math.floor,g=String.fromCharCode;function v(t){throw RangeError(p[t])}function b(t,n){for(var e=t.length,r=[];e--;)r[e]=n(t[e]);return r}function w(t,n){var e=t.split("@"),r="";return e.length>1&&(r=e[0]+"@",t=e[1]),r+b((t=t.replace(d,".")).split("."),n).join(".")}function M(t){for(var n,e,r=[],i=0,s=t.length;i<s;)(n=t.charCodeAt(i++))>=55296&&n<=56319&&i<s?56320==(64512&(e=t.charCodeAt(i++)))?r.push(((1023&n)<<10)+(1023&e)+65536):(r.push(n),i--):r.push(n);return r}function x(t){return b(t,(function(t){var n="";return t>65535&&(n+=g((t-=65536)>>>10&1023|55296),t=56320|1023&t),n+g(t)})).join("")}function F(t,n){return t+22+75*(t<26)-((0!=n)<<5)}function k(t,n,e){var r=0;for(t=e?m(t/h):t>>1,t+=m(t/n);t>y*u>>1;r+=a)t=m(t/y);return m(r+(y+1)*t/(t+l))}function A(t){var n,e,r,i,s,l,h,c,f,d,p,y=[],g=t.length,b=0,w=128,M=72;for((e=t.lastIndexOf("-"))<0&&(e=0),r=0;r<e;++r)t.charCodeAt(r)>=128&&v("not-basic"),y.push(t.charCodeAt(r));for(i=e>0?e+1:0;i<g;){for(s=b,l=1,h=a;i>=g&&v("invalid-input"),((c=(p=t.charCodeAt(i++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:a)>=a||c>m((o-b)/l))&&v("overflow"),b+=c*l,!(c<(f=h<=M?1:h>=M+u?u:h-M));h+=a)l>m(o/(d=a-f))&&v("overflow"),l*=d;M=k(b-s,n=y.length+1,0==s),m(b/n)>o-w&&v("overflow"),w+=m(b/n),b%=n,y.splice(b++,0,w)}return x(y)}function P(t){var n,e,r,i,s,l,h,c,f,d,p,y,b,w,x,A=[];for(y=(t=M(t)).length,n=128,e=0,s=72,l=0;l<y;++l)(p=t[l])<128&&A.push(g(p));for(r=i=A.length,i&&A.push("-");r<y;){for(h=o,l=0;l<y;++l)(p=t[l])>=n&&p<h&&(h=p);for(h-n>m((o-e)/(b=r+1))&&v("overflow"),e+=(h-n)*b,n=h,l=0;l<y;++l)if((p=t[l])<n&&++e>o&&v("overflow"),p==n){for(c=e,f=a;!(c<(d=f<=s?1:f>=s+u?u:f-s));f+=a)A.push(g(F(d+(x=c-d)%(w=a-d),0))),c=m(x/w);A.push(g(F(c,0))),s=k(e,b,r==i),e=0,++r}++e,++n}return A.join("")}if(i={version:"1.3.2",ucs2:{decode:M,encode:x},decode:A,encode:P,toASCII:function(t){return w(t,(function(t){return f.test(t)?"xn--"+P(t):t}))},toUnicode:function(t){return w(t,(function(t){return c.test(t)?A(t.slice(4).toLowerCase()):t}))}},n&&e)if(Lr.exports==n)e.exports=i;else for(s in i)i.hasOwnProperty(s)&&(n[s]=i[s]);else t.punycode=i}(Vr);class Gr extends Error{constructor(t,n){super(n),this.message=n,this.key=t}}var Jr=Gr;class Wr{constructor(t,n=[]){this.parent=t,this.bindings={};for(const[t,e]of n)this.bindings[t]=e}concat(t){return new Wr(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(\`${o}t} not found in scope.\`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}var Br=Wr;const Xr={kind:"null"},Yr={kind:"number"},Kr={kind:"string"},Zr={kind:"boolean"},Qr={kind:"color"},ti={kind:"object"},ni={kind:"value"},ei={kind:"collator"},ri={kind:"formatted"},ii={kind:"resolvedImage"};function si(t,n){return{kind:"array",itemType:t,N:n}}function oi(t){if("array"===t.kind){const n=oi(t.itemType);return"number"==typeof t.N?\`array<${o}n}, ${o}t.N}>\`:"value"===t.itemType.kind?"array":\`array<${o}n}>\`}return t.kind}const ai=[Xr,Yr,Kr,Zr,Qr,ri,ti,si(ni),ii];function ui(t,n){if("error"===n.kind)return null;if("array"===t.kind){if("array"===n.kind&&(0===n.N&&"value"===n.itemType.kind||!ui(t.itemType,n.itemType))&&("number"!=typeof t.N||t.N===n.N))return null}else{if(t.kind===n.kind)return null;if("value"===t.kind)for(const t of ai)if(!ui(t,n))return null}return\`Expected ${o}oi(t)} but found ${o}oi(n)} instead.\`}function li(t,n){return n.some((n=>n.kind===t.kind))}function hi(t,n){return n.some((n=>"null"===n?null===t:"array"===n?Array.isArray(t):"object"===n?t&&!Array.isArray(t)&&"object"==typeof t:n===typeof t))}var ci,fi={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function di(t){return(t=Math.round(t))<0?0:t>255?255:t}function pi(t){return di("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function yi(t){return function(t){return t<0?0:t>1?1:t}("%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))}function mi(t,n,e){return e<0?e+=1:e>1&&(e-=1),6*e<1?t+(n-t)*e*6:2*e<1?n:3*e<2?t+(n-t)*(2/3-e)*6:t}try{ci={}.parseCSSColor=function(t){var n,e=t.replace(/ /g,"").toLowerCase();if(e in fi)return fi[e].slice();if("#"===e[0])return 4===e.length?(n=parseInt(e.substr(1),16))>=0&&n<=4095?[(3840&n)>>4|(3840&n)>>8,240&n|(240&n)>>4,15&n|(15&n)<<4,1]:null:7===e.length&&(n=parseInt(e.substr(1),16))>=0&&n<=16777215?[(16711680&n)>>16,(65280&n)>>8,255&n,1]:null;var r=e.indexOf("("),i=e.indexOf(")");if(-1!==r&&i+1===e.length){var s=e.substr(0,r),o=e.substr(r+1,i-(r+1)).split(","),a=1;switch(s){case"rgba":if(4!==o.length)return null;a=yi(o.pop());case"rgb":return 3!==o.length?null:[pi(o[0]),pi(o[1]),pi(o[2]),a];case"hsla":if(4!==o.length)return null;a=yi(o.pop());case"hsl":if(3!==o.length)return null;var u=(parseFloat(o[0])%360+360)%360/360,l=yi(o[1]),h=yi(o[2]),c=h<=.5?h*(l+1):h+l-h*l,f=2*h-c;return[di(255*mi(f,c,u+1/3)),di(255*mi(f,c,u)),di(255*mi(f,c,u-1/3)),a];default:return null}}return null}}catch(dt){}class gi{constructor(t,n,e,r=1){this.r=t,this.g=n,this.b=e,this.a=r}static parse(t){if(!t)return;if(t instanceof gi)return t;if("string"!=typeof t)return;const n=ci(t);return n?new gi(n[0]/255*n[3],n[1]/255*n[3],n[2]/255*n[3],n[3]):void 0}toString(){const[t,n,e,r]=this.toArray();return\`rgba(${o}Math.round(t)},${o}Math.round(n)},${o}Math.round(e)},${o}r})\`}toArray(){const{r:t,g:n,b:e,a:r}=this;return 0===r?[0,0,0,0]:[255*t/r,255*n/r,255*e/r,r]}toArray01(){const{r:t,g:n,b:e,a:r}=this;return 0===r?[0,0,0,0]:[t/r,n/r,e/r,r]}toArray01PremultipliedAlpha(){const{r:t,g:n,b:e,a:r}=this;return[t,n,e,r]}}gi.black=new gi(0,0,0,1),gi.white=new gi(1,1,1,1),gi.transparent=new gi(0,0,0,0),gi.red=new gi(1,0,0,1),gi.blue=new gi(0,0,1,1);var vi=gi;class bi{constructor(t,n,e){this.sensitivity=t?n?"variant":"case":n?"accent":"base",this.locale=e,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,n){return this.collator.compare(t,n)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class wi{constructor(t,n,e,r,i){this.text=t.normalize?t.normalize():t,this.image=n,this.scale=e,this.fontStack=r,this.textColor=i}}class Mi{constructor(t){this.sections=t}static fromString(t){return new Mi([new wi(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof Mi?t:Mi.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}serialize(){const t=["format"];for(const n of this.sections){if(n.image){t.push(["image",n.image.name]);continue}t.push(n.text);const e={};n.fontStack&&(e["text-font"]=["literal",n.fontStack.split(",")]),n.scale&&(e["font-scale"]=n.scale),n.textColor&&(e["text-color"]=["rgba"].concat(n.textColor.toArray())),t.push(e)}return t}}class xi{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new xi({name:t,available:!1}):null}serialize(){return["image",this.name]}}function Fi(t,n,e,r){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof n&&n>=0&&n<=255&&"number"==typeof e&&e>=0&&e<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:\`Invalid rgba value [${o}[t,n,e,r].join(", ")}]: 'a' must be between 0 and 1.\`:\`Invalid rgba value [${o}("number"==typeof r?[t,n,e,r]:[t,n,e]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.\`}function ki(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof vi)return!0;if(t instanceof bi)return!0;if(t instanceof Mi)return!0;if(t instanceof xi)return!0;if(Array.isArray(t)){for(const n of t)if(!ki(n))return!1;return!0}if("object"==typeof t){for(const n in t)if(!ki(t[n]))return!1;return!0}return!1}function Ai(t){if(null===t)return Xr;if("string"==typeof t)return Kr;if("boolean"==typeof t)return Zr;if("number"==typeof t)return Yr;if(t instanceof vi)return Qr;if(t instanceof bi)return ei;if(t instanceof Mi)return ri;if(t instanceof xi)return ii;if(Array.isArray(t)){const n=t.length;let e;for(const n of t){const t=Ai(n);if(e){if(e===t)continue;e=ni;break}e=t}return si(e||ni,n)}return ti}function Pi(t){const n=typeof t;return null===t?"":"string"===n||"number"===n||"boolean"===n?String(t):t instanceof vi||t instanceof Mi||t instanceof xi?t.toString():JSON.stringify(t)}class Si{constructor(t,n){this.type=t,this.value=n}static parse(t,n){if(2!==t.length)return n.error(\`'literal' expression requires exactly one argument, but found ${o}t.length-1} instead.\`);if(!ki(t[1]))return n.error("invalid value");const e=t[1];let r=Ai(e);const i=n.expectedType;return"array"!==r.kind||0!==r.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(r=i),new Si(r,e)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof vi?["rgba"].concat(this.value.toArray()):this.value instanceof Mi?this.value.serialize():this.value}}var _i=Si,Oi=class{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}};const Ci={string:Kr,number:Yr,boolean:Zr,object:ti};class Ei{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let e,r=1;const i=t[0];if("array"===i){let i,s;if(t.length>2){const e=t[1];if("string"!=typeof e||!(e in Ci)||"object"===e)return n.error('The item type argument of "array" must be one of string, number, boolean',1);i=Ci[e],r++}else i=ni;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return n.error('The length argument to "array" must be a positive integer literal',2);s=t[2],r++}e=si(i,s)}else e=Ci[i];const s=[];for(;r<t.length;r++){const e=n.parse(t[r],r,ni);if(!e)return null;s.push(e)}return new Ei(e,s)}evaluate(t){for(let n=0;n<this.args.length;n++){const e=this.args[n].evaluate(t);if(!ui(this.type,Ai(e)))return e;if(n===this.args.length-1)throw new Oi(\`Expected value to be of type ${o}oi(this.type)}, but found ${o}oi(Ai(e))} instead.\`)}return null}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=this.type,n=[t.kind];if("array"===t.kind){const e=t.itemType;if("string"===e.kind||"number"===e.kind||"boolean"===e.kind){n.push(e.kind);const r=t.N;("number"==typeof r||this.args.length>1)&&n.push(r)}}return n.concat(this.args.map((t=>t.serialize())))}}var Ii=Ei;class $i{constructor(t){this.type=ri,this.sections=t}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const e=t[1];if(!Array.isArray(e)&&"object"==typeof e)return n.error("First argument must be an image or text section.");const r=[];let i=!1;for(let e=1;e<=t.length-1;++e){const s=t[e];if(i&&"object"==typeof s&&!Array.isArray(s)){i=!1;let t=null;if(s["font-scale"]&&(t=n.parse(s["font-scale"],1,Yr),!t))return null;let e=null;if(s["text-font"]&&(e=n.parse(s["text-font"],1,si(Kr)),!e))return null;let o=null;if(s["text-color"]&&(o=n.parse(s["text-color"],1,Qr),!o))return null;const a=r[r.length-1];a.scale=t,a.font=e,a.textColor=o}else{const s=n.parse(t[e],1,ni);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return n.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,r.push({content:s,scale:null,font:null,textColor:null})}}return new $i(r)}evaluate(t){return new Mi(this.sections.map((n=>{const e=n.content.evaluate(t);return Ai(e)===ii?new wi("",e,null,null,null):new wi(Pi(e),null,n.scale?n.scale.evaluate(t):null,n.font?n.font.evaluate(t).join(","):null,n.textColor?n.textColor.evaluate(t):null)})))}eachChild(t){for(const n of this.sections)t(n.content),n.scale&&t(n.scale),n.font&&t(n.font),n.textColor&&t(n.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const n of this.sections){t.push(n.content.serialize());const e={};n.scale&&(e["font-scale"]=n.scale.serialize()),n.font&&(e["text-font"]=n.font.serialize()),n.textColor&&(e["text-color"]=n.textColor.serialize()),t.push(e)}return t}}class Ti{constructor(t){this.type=ii,this.input=t}static parse(t,n){if(2!==t.length)return n.error("Expected two arguments.");const e=n.parse(t[1],1,Kr);return e?new Ti(e):n.error("No image name provided.")}evaluate(t){const n=this.input.evaluate(t),e=xi.fromString(n);return e&&t.availableImages&&(e.available=t.availableImages.indexOf(n)>-1),e}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Di={"to-boolean":Zr,"to-color":Qr,"to-number":Yr,"to-string":Kr};class zi{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const e=t[0];if(("to-boolean"===e||"to-string"===e)&&2!==t.length)return n.error("Expected one argument.");const r=Di[e],i=[];for(let e=1;e<t.length;e++){const r=n.parse(t[e],e,ni);if(!r)return null;i.push(r)}return new zi(r,i)}evaluate(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){let n,e;for(const r of this.args){if(n=r.evaluate(t),e=null,n instanceof vi)return n;if("string"==typeof n){const e=t.parseColor(n);if(e)return e}else if(Array.isArray(n)&&(e=n.length<3||n.length>4?\`Invalid rbga value ${o}JSON.stringify(n)}: expected an array containing either three or four numeric values.\`:Fi(n[0],n[1],n[2],n[3]),!e))return new vi(n[0]/255,n[1]/255,n[2]/255,n[3])}throw new Oi(e||\`Could not parse color from value '${o}"string"==typeof n?n:String(JSON.stringify(n))}'\`)}if("number"===this.type.kind){let n=null;for(const e of this.args){if(n=e.evaluate(t),null===n)return 0;const r=Number(n);if(!isNaN(r))return r}throw new Oi(\`Could not convert ${o}JSON.stringify(n)} to number.\`)}return"formatted"===this.type.kind?Mi.fromString(Pi(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?xi.fromString(Pi(this.args[0].evaluate(t))):Pi(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new $i([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Ti(this.args[0]).serialize();const t=[\`to-${o}this.type.kind}\`];return this.eachChild((n=>{t.push(n.serialize())})),t}}var ji=zi;const Ui=["Unknown","Point","LineString","Polygon"];var Ni=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this.H={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Ui[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const t=this.featureDistanceData.center,n=this.featureDistanceData.scale,{x:e,y:r}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(e*n-t[0])+this.featureDistanceData.bearing[1]*(r*n-t[1])}return 0}parseColor(t){let n=this.H[t];return n||(n=this.H[t]=vi.parse(t)),n}};class Li{constructor(t,n,e,r){this.name=t,this.type=n,this.q=e,this.args=r}evaluate(t){return this.q(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,n){const e=t[0],r=Li.definitions[e];if(!r)return n.error(\`Unknown expression "${o}e}". If you wanted a literal array, use ["literal", [...]].\`,0);const i=Array.isArray(r)?r[0]:r.type,s=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,o=s.filter((([n])=>!Array.isArray(n)||n.length===t.length-1));let a=null;for(const[r,s]of o){a=new ds(n.registry,n.path,null,n.scope);const o=[];let u=!1;for(let n=1;n<t.length;n++){const e=t[n],i=Array.isArray(r)?r[n-1]:r.type,s=a.parse(e,1+o.length,i);if(!s){u=!0;break}o.push(s)}if(!u)if(Array.isArray(r)&&r.length!==o.length)a.error(\`Expected ${o}r.length} arguments, but found ${o}o.length} instead.\`);else{for(let t=0;t<o.length;t++){const n=Array.isArray(r)?r[t]:r.type,e=o[t];a.concat(t+1).checkSubtype(n,e.type)}if(0===a.errors.length)return new Li(e,i,s,o)}}if(1===o.length)n.errors.push(...a.errors);else{const e=(o.length?o:s).map((([t])=>{return n=t,Array.isArray(n)?\`(${o}n.map(oi).join(", ")})\`:\`(${o}oi(n.type)}...)\`;var n})).join(" | "),r=[];for(let e=1;e<t.length;e++){const i=n.parse(t[e],1+r.length);if(!i)return null;r.push(oi(i.type))}n.error(\`Expected arguments of type ${o}e}, but found (${o}r.join(", ")}) instead.\`)}return null}static register(t,n){Li.definitions=n;for(const e in n)t[e]=Li}}var Ri=Li;class Vi{constructor(t,n,e){this.type=ei,this.locale=e,this.caseSensitive=t,this.diacriticSensitive=n}static parse(t,n){if(2!==t.length)return n.error("Expected one argument.");const e=t[1];if("object"!=typeof e||Array.isArray(e))return n.error("Collator options argument must be an object.");const r=n.parse(void 0!==e["case-sensitive"]&&e["case-sensitive"],1,Zr);if(!r)return null;const i=n.parse(void 0!==e["diacritic-sensitive"]&&e["diacritic-sensitive"],1,Zr);if(!i)return null;let s=null;return e.locale&&(s=n.parse(e.locale,1,Kr),!s)?null:new Vi(r,i,s)}evaluate(t){return new bi(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}serialize(){const t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]}}const Hi=8192;function qi(t,n){t[0]=Math.min(t[0],n[0]),t[1]=Math.min(t[1],n[1]),t[2]=Math.max(t[2],n[0]),t[3]=Math.max(t[3],n[1])}function Gi(t,n){return!(t[0]<=n[0]||t[2]>=n[2]||t[1]<=n[1]||t[3]>=n[3])}function Ji(t,n){const e=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,n.z);return[Math.round(e*i*Hi),Math.round(r*i*Hi)]}function Wi(t,n,e){const r=t[0]-n[0],i=t[1]-n[1],s=t[0]-e[0],o=t[1]-e[1];return r*o-s*i==0&&r*s<=0&&i*o<=0}function Bi(t,n){let e=!1;for(let o=0,a=n.length;o<a;o++){const a=n[o];for(let n=0,o=a.length;n<o-1;n++){if(Wi(t,a[n],a[n+1]))return!1;(i=a[n])[1]>(r=t)[1]!=(s=a[n+1])[1]>r[1]&&r[0]<(s[0]-i[0])*(r[1]-i[1])/(s[1]-i[1])+i[0]&&(e=!e)}}var r,i,s;return e}function Xi(t,n){for(let e=0;e<n.length;e++)if(Bi(t,n[e]))return!0;return!1}function Yi(t,n,e,r){const i=r[0]-e[0],s=r[1]-e[1],o=(t[0]-e[0])*s-i*(t[1]-e[1]),a=(n[0]-e[0])*s-i*(n[1]-e[1]);return o>0&&a<0||o<0&&a>0}function Ki(t,n,e){for(const l of e)for(let e=0;e<l.length-1;++e)if(void 0,void 0,0!=(a=[(o=l[e+1])[0]-(s=l[e])[0],o[1]-s[1]])[0]*(u=[(i=n)[0]-(r=t)[0],i[1]-r[1]])[1]-a[1]*u[0]&&Yi(r,i,s,o)&&Yi(s,o,r,i))return!0;var r,i,s,o,a,u;return!1}function Zi(t,n){for(let e=0;e<t.length;++e)if(!Bi(t[e],n))return!1;for(let e=0;e<t.length-1;++e)if(Ki(t[e],t[e+1],n))return!1;return!0}function Qi(t,n){for(let e=0;e<n.length;e++)if(Zi(t,n[e]))return!0;return!1}function ts(t,n,e){const r=[];for(let i=0;i<t.length;i++){const s=[];for(let r=0;r<t[i].length;r++){const o=Ji(t[i][r],e);qi(n,o),s.push(o)}r.push(s)}return r}function ns(t,n,e){const r=[];for(let i=0;i<t.length;i++){const s=ts(t[i],n,e);r.push(s)}return r}function es(t,n,e,r){if(t[0]<e[0]||t[0]>e[2]){const n=.5*r;let i=t[0]-e[0]>n?-r:e[0]-t[0]>n?r:0;0===i&&(i=t[0]-e[2]>n?-r:e[2]-t[0]>n?r:0),t[0]+=i}qi(n,t)}function rs(t,n,e,r){const i=Math.pow(2,r.z)*Hi,s=[r.x*Hi,r.y*Hi],o=[];if(!t)return o;for(const r of t)for(const t of r){const r=[t.x+s[0],t.y+s[1]];es(r,n,e,i),o.push(r)}return o}function is(t,n,e,r){const i=Math.pow(2,r.z)*Hi,s=[r.x*Hi,r.y*Hi],o=[];if(!t)return o;for(const e of t){const t=[];for(const r of e){const e=[r.x+s[0],r.y+s[1]];qi(n,e),t.push(e)}o.push(t)}if(n[2]-n[0]<=i/2){(a=n)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const r of t)es(r,n,e,i)}var a;return o}class ss{constructor(t,n){this.type=Zr,this.geojson=t,this.geometries=n}static parse(t,n){if(2!==t.length)return n.error(\`'within' expression requires exactly one argument, but found ${o}t.length-1} instead.\`);if(ki(t[1])){const n=t[1];if("FeatureCollection"===n.type)for(let t=0;t<n.features.length;++t){const e=n.features[t].geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new ss(n,n.features[t].geometry)}else if("Feature"===n.type){const t=n.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new ss(n,n.geometry)}else if("Polygon"===n.type||"MultiPolygon"===n.type)return new ss(n,n)}return n.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,n){const e=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(!i)return!1;if("Polygon"===n.type){const s=ts(n.coordinates,r,i),o=rs(t.geometry(),e,r,i);if(!Gi(e,r))return!1;for(const t of o)if(!Bi(t,s))return!1}if("MultiPolygon"===n.type){const s=ns(n.coordinates,r,i),o=rs(t.geometry(),e,r,i);if(!Gi(e,r))return!1;for(const t of o)if(!Xi(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,n){const e=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(!i)return!1;if("Polygon"===n.type){const s=ts(n.coordinates,r,i),o=is(t.geometry(),e,r,i);if(!Gi(e,r))return!1;for(const t of o)if(!Zi(t,s))return!1}if("MultiPolygon"===n.type){const s=ns(n.coordinates,r,i),o=is(t.geometry(),e,r,i);if(!Gi(e,r))return!1;for(const t of o)if(!Qi(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}var os=ss;function as(t){if(t instanceof Ri){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof os)return!1;let n=!0;return t.eachChild((t=>{n&&!as(t)&&(n=!1)})),n}function us(t){if(t instanceof Ri&&"feature-state"===t.name)return!1;let n=!0;return t.eachChild((t=>{n&&!us(t)&&(n=!1)})),n}function ls(t,n){if(t instanceof Ri&&n.indexOf(t.name)>=0)return!1;let e=!0;return t.eachChild((t=>{e&&!ls(t,n)&&(e=!1)})),e}class hs{constructor(t,n){this.type=n.type,this.name=t,this.boundExpression=n}static parse(t,n){if(2!==t.length||"string"!=typeof t[1])return n.error("'var' expression requires exactly one string literal argument.");const e=t[1];return n.scope.has(e)?new hs(e,n.scope.get(e)):n.error(\`Unknown variable "${o}e}". Make sure "${o}e}" has been bound in an enclosing "let" expression before using it.\`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var cs=hs;class fs{constructor(t,n=[],e,r=new Br,i=[]){this.registry=t,this.path=n,this.key=n.map((t=>\`[${o}t}]\`)).join(""),this.scope=r,this.errors=i,this.expectedType=e}parse(t,n,e,r,i={}){return n?this.concat(n,e,r).G(t,i):this.G(t,i)}G(t,n){function e(t,n,e){return"assert"===e?new Ii(n,[t]):"coerce"===e?new ji(n,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=t[0];if("string"!=typeof r)return this.error(\`Expression name must be a string, but found ${o}typeof r} instead. If you wanted a literal array, use ["literal", [...]].\`,0),null;const i=this.registry[r];if(i){let r=i.parse(t,this);if(!r)return null;if(this.expectedType){const t=this.expectedType,i=r.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==i.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==i.kind&&"string"!==i.kind){if(this.checkSubtype(t,i))return null}else r=e(r,t,n.typeAnnotation||"coerce");else r=e(r,t,n.typeAnnotation||"assert")}if(!(r instanceof _i)&&"resolvedImage"!==r.type.kind&&ps(r)){const n=new Ni;try{r=new _i(r.type,r.evaluate(n))}catch(t){return this.error(t.message),null}}return r}return this.error(\`Unknown expression "${o}r}". If you wanted a literal array, use ["literal", [...]].\`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':\`Expected an array, but found ${o}typeof t} instead.\`)}concat(t,n,e){const r="number"==typeof t?this.path.concat(t):this.path,i=e?this.scope.concat(e):this.scope;return new fs(this.registry,r,n||null,i,this.errors)}error(t,...n){const e=\`${o}this.key}${o}n.map((t=>\`[${o}t}]\`)).join("")}\`;this.errors.push(new Jr(e,t))}checkSubtype(t,n){const e=ui(t,n);return e&&this.error(e),e}}var ds=fs;function ps(t){if(t instanceof cs)return ps(t.boundExpression);if(t instanceof Ri&&"error"===t.name)return!1;if(t instanceof Vi)return!1;if(t instanceof os)return!1;const n=t instanceof ji||t instanceof Ii;let e=!0;return t.eachChild((t=>{e=n?e&&ps(t):e&&t instanceof _i})),!!e&&as(t)&&ls(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function ys(t,n){const e=t.length-1;let r,i,s=0,o=e,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),r=t[a],i=t[a+1],r<=n){if(a===e||n<i)return a;s=a+1}else{if(!(r>n))throw new Oi("Input is not a number.");o=a-1}return 0}class ms{constructor(t,n,e){this.type=t,this.input=n,this.labels=[],this.outputs=[];for(const[t,n]of e)this.labels.push(t),this.outputs.push(n)}static parse(t,n){if(t.length-1<4)return n.error(\`Expected at least 4 arguments, but found only ${o}t.length-1}.\`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");const e=n.parse(t[1],1,Yr);if(!e)return null;const r=[];let i=null;n.expectedType&&"value"!==n.expectedType.kind&&(i=n.expectedType);for(let e=1;e<t.length;e+=2){const s=1===e?-1/0:t[e],o=t[e+1],a=e,u=e+1;if("number"!=typeof s)return n.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(r.length&&r[r.length-1][0]>=s)return n.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const l=n.parse(o,u,i);if(!l)return null;i=i||l.type,r.push([s,l])}return new ms(i,e,r)}evaluate(t){const n=this.labels,e=this.outputs;if(1===n.length)return e[0].evaluate(t);const r=this.input.evaluate(t);if(r<=n[0])return e[0].evaluate(t);const i=n.length;return r>=n[i-1]?e[i-1].evaluate(t):e[ys(n,r)].evaluate(t)}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=["step",this.input.serialize()];for(let n=0;n<this.labels.length;n++)n>0&&t.push(this.labels[n]),t.push(this.outputs[n].serialize());return t}}var gs=ms,vs=bs;function bs(t,n,e,r){this.cx=3*t,this.bx=3*(e-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(r-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=e,this.p2y=r}function ws(t,n,e){return t*(1-e)+n*e}bs.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,n){if(void 0===n&&(n=1e-6),t<0)return 0;if(t>1)return 1;for(var e=t,r=0;r<8;r++){var i=this.sampleCurveX(e)-t;if(Math.abs(i)<n)return e;var s=this.sampleCurveDerivativeX(e);if(Math.abs(s)<1e-6)break;e-=i/s}var o=0,a=1;for(e=t,r=0;r<20&&(i=this.sampleCurveX(e),!(Math.abs(i-t)<n));r++)t>i?o=e:a=e,e=.5*(a-o)+o;return e},solve:function(t,n){return this.sampleCurveY(this.solveCurveX(t,n))}};var Ms=Object.freeze({__proto__:null,number:ws,color:function(t,n,e){return new vi(ws(t.r,n.r,e),ws(t.g,n.g,e),ws(t.b,n.b,e),ws(t.a,n.a,e))},array:function(t,n,e){return t.map(((t,r)=>ws(t,n[r],e)))}});const xs=.95047,Fs=1.08883,ks=4/29,As=6/29,Ps=3*As*As,Ss=As*As*As,_s=Math.PI/180,Os=180/Math.PI;function Cs(t){return t>Ss?Math.pow(t,1/3):t/Ps+ks}function Es(t){return t>As?t*t*t:Ps*(t-ks)}function Is(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function $s(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ts(t){const n=$s(t.r),e=$s(t.g),r=$s(t.b),i=Cs((.4124564*n+.3575761*e+.1804375*r)/xs),s=Cs((.2126729*n+.7151522*e+.072175*r)/1);return{l:116*s-16,a:500*(i-s),b:200*(s-Cs((.0193339*n+.119192*e+.9503041*r)/Fs)),alpha:t.a}}function Ds(t){let n=(t.l+16)/116,e=isNaN(t.a)?n:n+t.a/500,r=isNaN(t.b)?n:n-t.b/200;return n=1*Es(n),e=xs*Es(e),r=Fs*Es(r),new vi(Is(3.2404542*e-1.5371385*n-.4985314*r),Is(-.969266*e+1.8760108*n+.041556*r),Is(.0556434*e-.2040259*n+1.0572252*r),t.alpha)}function zs(t,n,e){const r=n-t;return t+e*(r>180||r<-180?r-360*Math.round(r/360):r)}const js={forward:Ts,reverse:Ds,interpolate:function(t,n,e){return{l:ws(t.l,n.l,e),a:ws(t.a,n.a,e),b:ws(t.b,n.b,e),alpha:ws(t.alpha,n.alpha,e)}}},Us={forward:function(t){const{l:n,a:e,b:r}=Ts(t),i=Math.atan2(r,e)*Os;return{h:i<0?i+360:i,c:Math.sqrt(e*e+r*r),l:n,alpha:t.a}},reverse:function(t){const n=t.h*_s,e=t.c;return Ds({l:t.l,a:Math.cos(n)*e,b:Math.sin(n)*e,alpha:t.alpha})},interpolate:function(t,n,e){return{h:zs(t.h,n.h,e),c:ws(t.c,n.c,e),l:ws(t.l,n.l,e),alpha:ws(t.alpha,n.alpha,e)}}};var Ns=Object.freeze({__proto__:null,lab:js,hcl:Us});class Ls{constructor(t,n,e,r,i){this.type=t,this.operator=n,this.interpolation=e,this.input=r,this.labels=[],this.outputs=[];for(const[t,n]of i)this.labels.push(t),this.outputs.push(n)}static interpolationFactor(t,n,e,r){let i=0;if("exponential"===t.name)i=Rs(n,t.base,e,r);else if("linear"===t.name)i=Rs(n,1,e,r);else if("cubic-bezier"===t.name){const s=t.controlPoints;i=new vs(s[0],s[1],s[2],s[3]).solve(Rs(n,1,e,r))}return i}static parse(t,n){let[e,r,i,...s]=t;if(!Array.isArray(r)||0===r.length)return n.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const t=r[1];if("number"!=typeof t)return n.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:t}}else{if("cubic-bezier"!==r[0])return n.error(\`Unknown interpolation type ${o}String(r[0])}\`,1,0);{const t=r.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return n.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return n.error(\`Expected at least 4 arguments, but found only ${o}t.length-1}.\`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");if(i=n.parse(i,2,Yr),!i)return null;const o=[];let a=null;"interpolate-hcl"===e||"interpolate-lab"===e?a=Qr:n.expectedType&&"value"!==n.expectedType.kind&&(a=n.expectedType);for(let t=0;t<s.length;t+=2){const e=s[t],r=s[t+1],i=t+3,u=t+4;if("number"!=typeof e)return n.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(o.length&&o[o.length-1][0]>=e)return n.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const l=n.parse(r,u,a);if(!l)return null;a=a||l.type,o.push([e,l])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new Ls(a,e,r,i,o):n.error(\`Type ${o}oi(a)} is not interpolatable.\`)}evaluate(t){const n=this.labels,e=this.outputs;if(1===n.length)return e[0].evaluate(t);const r=this.input.evaluate(t);if(r<=n[0])return e[0].evaluate(t);const i=n.length;if(r>=n[i-1])return e[i-1].evaluate(t);const s=ys(n,r),o=Ls.interpolationFactor(this.interpolation,r,n[s],n[s+1]),a=e[s].evaluate(t),u=e[s+1].evaluate(t);return"interpolate"===this.operator?Ms[this.type.kind.toLowerCase()](a,u,o):"interpolate-hcl"===this.operator?Us.reverse(Us.interpolate(Us.forward(a),Us.forward(u),o)):js.reverse(js.interpolate(js.forward(a),js.forward(u),o))}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const n=[this.operator,t,this.input.serialize()];for(let t=0;t<this.labels.length;t++)n.push(this.labels[t],this.outputs[t].serialize());return n}}function Rs(t,n,e,r){const i=r-e,s=t-e;return 0===i?0:1===n?s/i:(Math.pow(n,s)-1)/(Math.pow(n,i)-1)}var Vs=Ls;class Hs{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expectected at least one argument.");let e=null;const r=n.expectedType;r&&"value"!==r.kind&&(e=r);const i=[];for(const r of t.slice(1)){const t=n.parse(r,1+i.length,e,void 0,{typeAnnotation:"omit"});if(!t)return null;e=e||t.type,i.push(t)}const s=r&&i.some((t=>ui(r,t.type)));return new Hs(s?ni:e,i)}evaluate(t){let n,e=null,r=0;for(const i of this.args){if(r++,e=i.evaluate(t),e&&e instanceof xi&&!e.available&&(n||(n=e),e=null,r===this.args.length))return n;if(null!==e)break}return e}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=["coalesce"];return this.eachChild((n=>{t.push(n.serialize())})),t}}var qs=Hs;class Gs{constructor(t,n){this.type=n.type,this.bindings=[].concat(t),this.result=n}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const n of this.bindings)t(n[1]);t(this.result)}static parse(t,n){if(t.length<4)return n.error(\`Expected at least 3 arguments, but found ${o}t.length-1} instead.\`);const e=[];for(let r=1;r<t.length-1;r+=2){const i=t[r];if("string"!=typeof i)return n.error(\`Expected string, but found ${o}typeof i} instead.\`,r);if(/[^a-zA-Z0-9_]/.test(i))return n.error("Variable names must contain only alphanumeric characters or '_'.",r);const s=n.parse(t[r+1],r+1);if(!s)return null;e.push([i,s])}const r=n.parse(t[t.length-1],t.length-1,n.expectedType,e);return r?new Gs(e,r):null}outputDefined(){return this.result.outputDefined()}serialize(){const t=["let"];for(const[n,e]of this.bindings)t.push(n,e.serialize());return t.push(this.result.serialize()),t}}var Js=Gs;class Ws{constructor(t,n,e){this.type=t,this.index=n,this.input=e}static parse(t,n){if(3!==t.length)return n.error(\`Expected 2 arguments, but found ${o}t.length-1} instead.\`);const e=n.parse(t[1],1,Yr),r=n.parse(t[2],2,si(n.expectedType||ni));return e&&r?new Ws(r.type.itemType,e,r):null}evaluate(t){const n=this.index.evaluate(t),e=this.input.evaluate(t);if(n<0)throw new Oi(\`Array index out of bounds: ${o}n} < 0.\`);if(n>=e.length)throw new Oi(\`Array index out of bounds: ${o}n} > ${o}e.length-1}.\`);if(n!==Math.floor(n))throw new Oi(\`Array index must be an integer, but found ${o}n} instead.\`);return e[n]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var Bs=Ws;class Xs{constructor(t,n){this.type=Zr,this.needle=t,this.haystack=n}static parse(t,n){if(3!==t.length)return n.error(\`Expected 2 arguments, but found ${o}t.length-1} instead.\`);const e=n.parse(t[1],1,ni),r=n.parse(t[2],2,ni);return e&&r?li(e.type,[Zr,Kr,Yr,Xr,ni])?new Xs(e,r):n.error(\`Expected first argument to be of type boolean, string, number or null, but found ${o}oi(e.type)} instead\`):null}evaluate(t){const n=this.needle.evaluate(t),e=this.haystack.evaluate(t);if(null==e)return!1;if(!hi(n,["boolean","string","number","null"]))throw new Oi(\`Expected first argument to be of type boolean, string, number or null, but found ${o}oi(Ai(n))} instead.\`);if(!hi(e,["string","array"]))throw new Oi(\`Expected second argument to be of type array or string, but found ${o}oi(Ai(e))} instead.\`);return e.indexOf(n)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var Ys=Xs;class Ks{constructor(t,n,e){this.type=Yr,this.needle=t,this.haystack=n,this.fromIndex=e}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(\`Expected 3 or 4 arguments, but found ${o}t.length-1} instead.\`);const e=n.parse(t[1],1,ni),r=n.parse(t[2],2,ni);if(!e||!r)return null;if(!li(e.type,[Zr,Kr,Yr,Xr,ni]))return n.error(\`Expected first argument to be of type boolean, string, number or null, but found ${o}oi(e.type)} instead\`);if(4===t.length){const i=n.parse(t[3],3,Yr);return i?new Ks(e,r,i):null}return new Ks(e,r)}evaluate(t){const n=this.needle.evaluate(t),e=this.haystack.evaluate(t);if(!hi(n,["boolean","string","number","null"]))throw new Oi(\`Expected first argument to be of type boolean, string, number or null, but found ${o}oi(Ai(n))} instead.\`);if(!hi(e,["string","array"]))throw new Oi(\`Expected second argument to be of type array or string, but found ${o}oi(Ai(e))} instead.\`);if(this.fromIndex){const r=this.fromIndex.evaluate(t);return e.indexOf(n,r)}return e.indexOf(n)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var Zs=Ks;class Qs{constructor(t,n,e,r,i,s){this.inputType=t,this.type=n,this.input=e,this.cases=r,this.outputs=i,this.otherwise=s}static parse(t,n){if(t.length<5)return n.error(\`Expected at least 4 arguments, but found only ${o}t.length-1}.\`);if(t.length%2!=1)return n.error("Expected an even number of arguments.");let e,r;n.expectedType&&"value"!==n.expectedType.kind&&(r=n.expectedType);const i={},s=[];for(let o=2;o<t.length-1;o+=2){let a=t[o];const u=t[o+1];Array.isArray(a)||(a=[a]);const l=n.concat(o);if(0===a.length)return l.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return l.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return l.error(\`Branch labels must be integers no larger than ${o}Number.MAX_SAFE_INTEGER}.\`);if("number"==typeof t&&Math.floor(t)!==t)return l.error("Numeric branch labels must be integer values.");if(e){if(l.checkSubtype(e,Ai(t)))return null}else e=Ai(t);if(void 0!==i[String(t)])return l.error("Branch labels must be unique.");i[String(t)]=s.length}const h=n.parse(u,o,r);if(!h)return null;r=r||h.type,s.push(h)}const o=n.parse(t[1],1,ni);if(!o)return null;const a=n.parse(t[t.length-1],t.length-1,r);return a?"value"!==o.type.kind&&n.concat(1).checkSubtype(e,o.type)?null:new Qs(e,r,o,i,s,a):null}evaluate(t){const n=this.input.evaluate(t);return(Ai(n)===this.inputType&&this.outputs[this.cases[n]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],n=Object.keys(this.cases).sort(),e=[],r={};for(const t of n){const n=r[this.cases[t]];void 0===n?(r[this.cases[t]]=e.length,e.push([this.cases[t],[t]])):e[n][1].push(t)}const i=t=>"number"===this.inputType.kind?Number(t):t;for(const[n,r]of e)t.push(1===r.length?i(r[0]):r.map(i)),t.push(this.outputs[n].serialize());return t.push(this.otherwise.serialize()),t}}var to=Qs;class no{constructor(t,n,e){this.type=t,this.branches=n,this.otherwise=e}static parse(t,n){if(t.length<4)return n.error(\`Expected at least 3 arguments, but found only ${o}t.length-1}.\`);if(t.length%2!=0)return n.error("Expected an odd number of arguments.");let e;n.expectedType&&"value"!==n.expectedType.kind&&(e=n.expectedType);const r=[];for(let i=1;i<t.length-1;i+=2){const s=n.parse(t[i],i,Zr);if(!s)return null;const o=n.parse(t[i+1],i+1,e);if(!o)return null;r.push([s,o]),e=e||o.type}const i=n.parse(t[t.length-1],t.length-1,e);return i?new no(e,r,i):null}evaluate(t){for(const[n,e]of this.branches)if(n.evaluate(t))return e.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[n,e]of this.branches)t(n),t(e);t(this.otherwise)}outputDefined(){return this.branches.every((([t,n])=>n.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((n=>{t.push(n.serialize())})),t}}var eo=no;class ro{constructor(t,n,e,r){this.type=t,this.input=n,this.beginIndex=e,this.endIndex=r}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(\`Expected 3 or 4 arguments, but found ${o}t.length-1} instead.\`);const e=n.parse(t[1],1,ni),r=n.parse(t[2],2,Yr);if(!e||!r)return null;if(!li(e.type,[si(ni),Kr,ni]))return n.error(\`Expected first argument to be of type array or string, but found ${o}oi(e.type)} instead\`);if(4===t.length){const i=n.parse(t[3],3,Yr);return i?new ro(e.type,e,r,i):null}return new ro(e.type,e,r)}evaluate(t){const n=this.input.evaluate(t),e=this.beginIndex.evaluate(t);if(!hi(n,["string","array"]))throw new Oi(\`Expected first argument to be of type array or string, but found ${o}oi(Ai(n))} instead.\`);if(this.endIndex){const r=this.endIndex.evaluate(t);return n.slice(e,r)}return n.slice(e)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var io=ro;function so(t,n){return"=="===t||"!="===t?"boolean"===n.kind||"string"===n.kind||"number"===n.kind||"null"===n.kind||"value"===n.kind:"string"===n.kind||"number"===n.kind||"value"===n.kind}function oo(t,n,e,r){return 0===r.compare(n,e)}function ao(t,n,e){const r="=="!==t&&"!="!==t;return class i{constructor(t,n,e){this.type=Zr,this.lhs=t,this.rhs=n,this.collator=e,this.hasUntypedArgument="value"===t.type.kind||"value"===n.type.kind}static parse(t,n){if(3!==t.length&&4!==t.length)return n.error("Expected two or three arguments.");const e=t[0];let s=n.parse(t[1],1,ni);if(!s)return null;if(!so(e,s.type))return n.concat(1).error(\`"${o}e}" comparisons are not supported for type '${o}oi(s.type)}'.\`);let o=n.parse(t[2],2,ni);if(!o)return null;if(!so(e,o.type))return n.concat(2).error(\`"${o}e}" comparisons are not supported for type '${o}oi(o.type)}'.\`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return n.error(\`Cannot compare types '${o}oi(s.type)}' and '${o}oi(o.type)}'.\`);r&&("value"===s.type.kind&&"value"!==o.type.kind?s=new Ii(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new Ii(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return n.error("Cannot use collator to compare non-string types.");if(a=n.parse(t[3],3,ei),!a)return null}return new i(s,o,a)}evaluate(i){const s=this.lhs.evaluate(i),o=this.rhs.evaluate(i);if(r&&this.hasUntypedArgument){const n=Ai(s),e=Ai(o);if(n.kind!==e.kind||"string"!==n.kind&&"number"!==n.kind)throw new Oi(\`Expected arguments for "${o}t}" to be (string, string) or (number, number), but found (${o}n.kind}, ${o}e.kind}) instead.\`)}if(this.collator&&!r&&this.hasUntypedArgument){const t=Ai(s),e=Ai(o);if("string"!==t.kind||"string"!==e.kind)return n(i,s,o)}return this.collator?e(i,s,o,this.collator.evaluate(i)):n(i,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const n=[t];return this.eachChild((t=>{n.push(t.serialize())})),n}}}const uo=ao("==",(function(t,n,e){return n===e}),oo),lo=ao("!=",(function(t,n,e){return n!==e}),(function(t,n,e,r){return!oo(0,n,e,r)})),ho=ao("<",(function(t,n,e){return n<e}),(function(t,n,e,r){return r.compare(n,e)<0})),co=ao(">",(function(t,n,e){return n>e}),(function(t,n,e,r){return r.compare(n,e)>0})),fo=ao("<=",(function(t,n,e){return n<=e}),(function(t,n,e,r){return r.compare(n,e)<=0})),po=ao(">=",(function(t,n,e){return n>=e}),(function(t,n,e,r){return r.compare(n,e)>=0}));class yo{constructor(t,n,e,r,i,s){this.type=Kr,this.number=t,this.locale=n,this.currency=e,this.unit=r,this.minFractionDigits=i,this.maxFractionDigits=s}static parse(t,n){if(3!==t.length)return n.error("Expected two arguments.");const e=n.parse(t[1],1,Yr);if(!e)return null;const r=t[2];if("object"!=typeof r||Array.isArray(r))return n.error("NumberFormat options argument must be an object.");let i=null;if(r.locale&&(i=n.parse(r.locale,1,Kr),!i))return null;let s=null;if(r.currency&&(s=n.parse(r.currency,1,Kr),!s))return null;let o=null;if(r.unit&&(o=n.parse(r.unit,1,Kr),!o))return null;let a=null;if(r["min-fraction-digits"]&&(a=n.parse(r["min-fraction-digits"],1,Yr),!a))return null;let u=null;return r["max-fraction-digits"]&&(u=n.parse(r["max-fraction-digits"],1,Yr),!u)?null:new yo(e,i,s,o,a,u)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.unit&&(t.unit=this.unit.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class mo{constructor(t){this.type=Yr,this.input=t}static parse(t,n){if(2!==t.length)return n.error(\`Expected 1 argument, but found ${o}t.length-1} instead.\`);const e=n.parse(t[1],1);return e?"array"!==e.type.kind&&"string"!==e.type.kind&&"value"!==e.type.kind?n.error(\`Expected argument of type string or array, but found ${o}oi(e.type)} instead.\`):new mo(e):null}evaluate(t){const n=this.input.evaluate(t);if("string"==typeof n)return n.length;if(Array.isArray(n))return n.length;throw new Oi(\`Expected value to be of type string or array, but found ${o}oi(Ai(n))} instead.\`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((n=>{t.push(n.serialize())})),t}}const go={"==":uo,"!=":lo,">":co,"<":ho,">=":po,"<=":fo,array:Ii,at:Bs,boolean:Ii,case:eo,coalesce:qs,collator:Vi,format:$i,image:Ti,in:Ys,"index-of":Zs,interpolate:Vs,"interpolate-hcl":Vs,"interpolate-lab":Vs,length:mo,let:Js,literal:_i,match:to,number:Ii,"number-format":yo,object:Ii,slice:io,step:gs,string:Ii,"to-boolean":ji,"to-color":ji,"to-number":ji,"to-string":ji,var:cs,within:os};function vo(t,[n,e,r,i]){n=n.evaluate(t),e=e.evaluate(t),r=r.evaluate(t);const s=i?i.evaluate(t):1,o=Fi(n,e,r,s);if(o)throw new Oi(o);return new vi(n/255*s,e/255*s,r/255*s,s)}function bo(t,n){return t in n}function wo(t,n){const e=n[t];return void 0===e?null:e}function Mo(t){return{type:t}}Ri.register(go,{error:[{kind:"error"},[Kr],(t,[n])=>{throw new Oi(n.evaluate(t))}],typeof:[Kr,[ni],(t,[n])=>oi(Ai(n.evaluate(t)))],"to-rgba":[si(Yr,4),[Qr],(t,[n])=>n.evaluate(t).toArray()],rgb:[Qr,[Yr,Yr,Yr],vo],rgba:[Qr,[Yr,Yr,Yr,Yr],vo],has:{type:Zr,overloads:[[[Kr],(t,[n])=>bo(n.evaluate(t),t.properties())],[[Kr,ti],(t,[n,e])=>bo(n.evaluate(t),e.evaluate(t))]]},get:{type:ni,overloads:[[[Kr],(t,[n])=>wo(n.evaluate(t),t.properties())],[[Kr,ti],(t,[n,e])=>wo(n.evaluate(t),e.evaluate(t))]]},"feature-state":[ni,[Kr],(t,[n])=>wo(n.evaluate(t),t.featureState||{})],properties:[ti,[],t=>t.properties()],"geometry-type":[Kr,[],t=>t.geometryType()],id:[ni,[],t=>t.id()],zoom:[Yr,[],t=>t.globals.zoom],pitch:[Yr,[],t=>t.globals.pitch||0],"distance-from-center":[Yr,[],t=>t.distanceFromCenter()],"heatmap-density":[Yr,[],t=>t.globals.heatmapDensity||0],"line-progress":[Yr,[],t=>t.globals.lineProgress||0],"sky-radial-progress":[Yr,[],t=>t.globals.skyRadialProgress||0],accumulated:[ni,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[Yr,Mo(Yr),(t,n)=>{let e=0;for(const r of n)e+=r.evaluate(t);return e}],"*":[Yr,Mo(Yr),(t,n)=>{let e=1;for(const r of n)e*=r.evaluate(t);return e}],"-":{type:Yr,overloads:[[[Yr,Yr],(t,[n,e])=>n.evaluate(t)-e.evaluate(t)],[[Yr],(t,[n])=>-n.evaluate(t)]]},"/":[Yr,[Yr,Yr],(t,[n,e])=>n.evaluate(t)/e.evaluate(t)],"%":[Yr,[Yr,Yr],(t,[n,e])=>n.evaluate(t)%e.evaluate(t)],ln2:[Yr,[],()=>Math.LN2],pi:[Yr,[],()=>Math.PI],e:[Yr,[],()=>Math.E],"^":[Yr,[Yr,Yr],(t,[n,e])=>Math.pow(n.evaluate(t),e.evaluate(t))],sqrt:[Yr,[Yr],(t,[n])=>Math.sqrt(n.evaluate(t))],log10:[Yr,[Yr],(t,[n])=>Math.log(n.evaluate(t))/Math.LN10],ln:[Yr,[Yr],(t,[n])=>Math.log(n.evaluate(t))],log2:[Yr,[Yr],(t,[n])=>Math.log(n.evaluate(t))/Math.LN2],sin:[Yr,[Yr],(t,[n])=>Math.sin(n.evaluate(t))],cos:[Yr,[Yr],(t,[n])=>Math.cos(n.evaluate(t))],tan:[Yr,[Yr],(t,[n])=>Math.tan(n.evaluate(t))],asin:[Yr,[Yr],(t,[n])=>Math.asin(n.evaluate(t))],acos:[Yr,[Yr],(t,[n])=>Math.acos(n.evaluate(t))],atan:[Yr,[Yr],(t,[n])=>Math.atan(n.evaluate(t))],min:[Yr,Mo(Yr),(t,n)=>Math.min(...n.map((n=>n.evaluate(t))))],max:[Yr,Mo(Yr),(t,n)=>Math.max(...n.map((n=>n.evaluate(t))))],abs:[Yr,[Yr],(t,[n])=>Math.abs(n.evaluate(t))],round:[Yr,[Yr],(t,[n])=>{const e=n.evaluate(t);return e<0?-Math.round(-e):Math.round(e)}],floor:[Yr,[Yr],(t,[n])=>Math.floor(n.evaluate(t))],ceil:[Yr,[Yr],(t,[n])=>Math.ceil(n.evaluate(t))],"filter-==":[Zr,[Kr,ni],(t,[n,e])=>t.properties()[n.value]===e.value],"filter-id-==":[Zr,[ni],(t,[n])=>t.id()===n.value],"filter-type-==":[Zr,[Kr],(t,[n])=>t.geometryType()===n.value],"filter-<":[Zr,[Kr,ni],(t,[n,e])=>{const r=t.properties()[n.value],i=e.value;return typeof r==typeof i&&r<i}],"filter-id-<":[Zr,[ni],(t,[n])=>{const e=t.id(),r=n.value;return typeof e==typeof r&&e<r}],"filter->":[Zr,[Kr,ni],(t,[n,e])=>{const r=t.properties()[n.value],i=e.value;return typeof r==typeof i&&r>i}],"filter-id->":[Zr,[ni],(t,[n])=>{const e=t.id(),r=n.value;return typeof e==typeof r&&e>r}],"filter-<=":[Zr,[Kr,ni],(t,[n,e])=>{const r=t.properties()[n.value],i=e.value;return typeof r==typeof i&&r<=i}],"filter-id-<=":[Zr,[ni],(t,[n])=>{const e=t.id(),r=n.value;return typeof e==typeof r&&e<=r}],"filter->=":[Zr,[Kr,ni],(t,[n,e])=>{const r=t.properties()[n.value],i=e.value;return typeof r==typeof i&&r>=i}],"filter-id->=":[Zr,[ni],(t,[n])=>{const e=t.id(),r=n.value;return typeof e==typeof r&&e>=r}],"filter-has":[Zr,[ni],(t,[n])=>n.value in t.properties()],"filter-has-id":[Zr,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[Zr,[si(Kr)],(t,[n])=>n.value.indexOf(t.geometryType())>=0],"filter-id-in":[Zr,[si(ni)],(t,[n])=>n.value.indexOf(t.id())>=0],"filter-in-small":[Zr,[Kr,si(ni)],(t,[n,e])=>e.value.indexOf(t.properties()[n.value])>=0],"filter-in-large":[Zr,[Kr,si(ni)],(t,[n,e])=>function(t,n,e,r){for(;e<=r;){const i=e+r>>1;if(n[i]===t)return!0;n[i]>t?r=i-1:e=i+1}return!1}(t.properties()[n.value],e.value,0,e.value.length-1)],all:{type:Zr,overloads:[[[Zr,Zr],(t,[n,e])=>n.evaluate(t)&&e.evaluate(t)],[Mo(Zr),(t,n)=>{for(const e of n)if(!e.evaluate(t))return!1;return!0}]]},any:{type:Zr,overloads:[[[Zr,Zr],(t,[n,e])=>n.evaluate(t)||e.evaluate(t)],[Mo(Zr),(t,n)=>{for(const e of n)if(e.evaluate(t))return!0;return!1}]]},"!":[Zr,[Zr],(t,[n])=>!n.evaluate(t)],"is-supported-script":[Zr,[Kr],(t,[n])=>{const e=t.globals&&t.globals.isSupportedScript;return!e||e(n.evaluate(t))}],upcase:[Kr,[Kr],(t,[n])=>n.evaluate(t).toUpperCase()],downcase:[Kr,[Kr],(t,[n])=>n.evaluate(t).toLowerCase()],concat:[Kr,Mo(ni),(t,n)=>n.map((n=>Pi(n.evaluate(t)))).join("")],"resolved-locale":[Kr,[ei],(t,[n])=>n.evaluate(t).resolvedLocale()]});var xo=go;function Fo(t){return{result:"success",value:t}}function ko(t){return{result:"error",value:t}}function Ao(t){return!!t.expression&&t.expression.interpolated}function Po(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function So(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function _o(t){return t}function Oo(t,n){const e="color"===n.type,r=t.stops&&"object"==typeof t.stops[0][0],i=r||!(r||void 0!==t.property),s=t.type||(Ao(n)?"exponential":"interval");if(e&&((t=qr({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],vi.parse(t[1])]))),t.default=vi.parse(t.default?t.default:n.default)),t.colorSpace&&"rgb"!==t.colorSpace&&!Ns[t.colorSpace])throw new Error(\`Unknown color space: ${o}t.colorSpace}\`);let o,a,u;if("exponential"===s)o=$o;else if("interval"===s)o=Io;else if("categorical"===s){o=Eo,a=Object.create(null);for(const n of t.stops)a[n[0]]=n[1];u=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error(\`Unknown function type "${o}s}"\`);o=To}if(r){const e={},r=[];for(let n=0;n<t.stops.length;n++){const i=t.stops[n],s=i[0].zoom;void 0===e[s]&&(e[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},r.push(s)),e[s].stops.push([i[0].value,i[1]])}const i=[];for(const t of r)i.push([e[t].zoom,Oo(e[t],n)]);const s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:Vs.interpolationFactor.bind(void 0,s),zoomStops:i.map((t=>t[0])),evaluate:({zoom:e},r)=>$o({stops:i,base:t.base},n,e).evaluate(e,r)}}if(i){const e="exponential"===s?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:e,interpolationFactor:Vs.interpolationFactor.bind(void 0,e),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:e})=>o(t,n,e,a,u)}}return{kind:"source",evaluate(e,r){const i=r&&r.properties?r.properties[t.property]:void 0;return void 0===i?Co(t.default,n.default):o(t,n,i,a,u)}}}function Co(t,n,e){return void 0!==t?t:void 0!==n?n:void 0!==e?e:void 0}function Eo(t,n,e,r,i){return Co(typeof e===i?r[e]:void 0,t.default,n.default)}function Io(t,n,e){if("number"!==Po(e))return Co(t.default,n.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(e<=t.stops[0][0])return t.stops[0][1];if(e>=t.stops[r-1][0])return t.stops[r-1][1];const i=ys(t.stops.map((t=>t[0])),e);return t.stops[i][1]}function $o(t,n,e){const r=void 0!==t.base?t.base:1;if("number"!==Po(e))return Co(t.default,n.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(e<=t.stops[0][0])return t.stops[0][1];if(e>=t.stops[i-1][0])return t.stops[i-1][1];const s=ys(t.stops.map((t=>t[0])),e),o=function(t,n,e,r){const i=r-e,s=t-e;return 0===i?0:1===n?s/i:(Math.pow(n,s)-1)/(Math.pow(n,i)-1)}(e,r,t.stops[s][0],t.stops[s+1][0]),a=t.stops[s][1],u=t.stops[s+1][1];let l=Ms[n.type]||_o;if(t.colorSpace&&"rgb"!==t.colorSpace){const n=Ns[t.colorSpace];l=(t,e)=>n.reverse(n.interpolate(n.forward(t),n.forward(e),o))}return"function"==typeof a.evaluate?{evaluate(...t){const n=a.evaluate.apply(void 0,t),e=u.evaluate.apply(void 0,t);if(void 0!==n&&void 0!==e)return l(n,e,o)}}:l(a,u,o)}function To(t,n,e){return"color"===n.type?e=vi.parse(e):"formatted"===n.type?e=Mi.fromString(e.toString()):"resolvedImage"===n.type?e=xi.fromString(e.toString()):Po(e)===n.type||"enum"===n.type&&n.values[e]||(e=void 0),Co(e,t.default,n.default)}class Do{constructor(t,n){this.expression=t,this.J={},this.W=new Ni,this.B=n?function(t){return"color"===t.type&&(So(t.default)||Array.isArray(t.default))?new vi(0,0,0,0):"color"===t.type?vi.parse(t.default)||null:void 0===t.default?null:t.default}(n):null,this.X=n&&"enum"===n.type?n.values:null}evaluateWithoutErrorHandling(t,n,e,r,i,s,o,a){return this.W.globals=t,this.W.feature=n,this.W.featureState=e,this.W.canonical=r||null,this.W.availableImages=i||null,this.W.formattedSection=s,this.W.featureTileCoord=o||null,this.W.featureDistanceData=a||null,this.expression.evaluate(this.W)}evaluate(t,n,e,r,i,s,o,a){this.W.globals=t,this.W.feature=n||null,this.W.featureState=e||null,this.W.canonical=r||null,this.W.availableImages=i||null,this.W.formattedSection=s||null,this.W.featureTileCoord=o||null,this.W.featureDistanceData=a||null;try{const t=this.expression.evaluate(this.W);if(null==t||"number"==typeof t&&t!=t)return this.B;if(this.X&&!(t in this.X))throw new Oi(\`Expected value to be one of ${o}Object.keys(this.X).map((t=>JSON.stringify(t))).join(", ")}, but found ${o}JSON.stringify(t)} instead.\`);return t}catch(t){return this.J[t.message]||(this.J[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this.B}}}function zo(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in xo}function jo(t,n){const e=new ds(xo,[],n?function(t){const n={color:Qr,string:Kr,number:Yr,enum:Kr,boolean:Zr,formatted:ri,resolvedImage:ii};return"array"===t.type?si(n[t.value]||ni,t.length):n[t.type]}(n):void 0),r=e.parse(t,void 0,void 0,void 0,n&&"string"===n.type?{typeAnnotation:"coerce"}:void 0);return r?Fo(new Do(r,n)):ko(e.errors)}class Uo{constructor(t,n){this.kind=t,this.Y=n,this.isStateDependent="constant"!==t&&!us(n.expression)}evaluateWithoutErrorHandling(t,n,e,r,i,s){return this.Y.evaluateWithoutErrorHandling(t,n,e,r,i,s)}evaluate(t,n,e,r,i,s){return this.Y.evaluate(t,n,e,r,i,s)}}class No{constructor(t,n,e,r){this.kind=t,this.zoomStops=e,this.Y=n,this.isStateDependent="camera"!==t&&!us(n.expression),this.interpolationType=r}evaluateWithoutErrorHandling(t,n,e,r,i,s){return this.Y.evaluateWithoutErrorHandling(t,n,e,r,i,s)}evaluate(t,n,e,r,i,s){return this.Y.evaluate(t,n,e,r,i,s)}interpolationFactor(t,n,e){return this.interpolationType?Vs.interpolationFactor(this.interpolationType,t,n,e):0}}function Lo(t,n){if("error"===(t=jo(t,n)).result)return t;const e=t.value.expression,r=as(e);if(!r&&!function(t){return"data-driven"===t["property-type"]}(n))return ko([new Jr("","data expressions not supported")]);const i=ls(e,["zoom","pitch","distance-from-center"]);if(!i&&!function(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}(n))return ko([new Jr("","zoom expressions not supported")]);const s=Vo(e);if(!s&&!i)return ko([new Jr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof Jr)return ko([s]);if(s instanceof Vs&&!Ao(n))return ko([new Jr("",'"interpolate" expressions cannot be used with this property')]);if(!s)return Fo(new Uo(r?"constant":"source",t.value));const o=s instanceof Vs?s.interpolation:void 0;return Fo(new No(r?"camera":"composite",t.value,s.labels,o))}class Ro{constructor(t,n){this.K=t,this.Z=n,qr(this,Oo(this.K,this.Z))}static deserialize(t){return new Ro(t.K,t.Z)}static serialize(t){return{K:t.K,Z:t.Z}}}function Vo(t){let n=null;if(t instanceof Js)n=Vo(t.result);else if(t instanceof qs){for(const e of t.args)if(n=Vo(e),n)break}else(t instanceof gs||t instanceof Vs)&&t.input instanceof Ri&&"zoom"===t.input.name&&(n=t);return n instanceof Jr||t.eachChild((t=>{const e=Vo(t);e instanceof Jr?n=e:!n&&e?n=new Jr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&e&&n!==e&&(n=new Jr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),n}function Ho(t){if(Array.isArray(t))return t.map(Ho);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const n={};for(const e in t)n[e]=Ho(t[e]);return n}return function(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}(t)}function qo(t,n="fill"){if(null==t)return{filter:()=>!0,needGeometry:!1,needFeature:!1};const e=t;let r=!0;try{r=function(t){if(!Wo(t))return t;let n=Ho(t);return Jo(n),n=Go(n),n}(e)}catch(t){console.warn(\`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\\nand paste the contents of this message in the report.\\nThank you!\\nFilter Expression:\\n${o}JSON.stringify(e,null,2)}\\n \`)}const i=jo(r,null);let s=null;if("error"===i.result)throw new Error(i.value.map((t=>\`${o}t.key}: ${o}t.message}\`)).join(", "));s=(t,n,e)=>i.value.evaluate(t,n,{},e);let o=null,a=null;if(r!==e){const t=jo(e,null);if("error"===t.result)throw new Error(t.value.map((t=>\`${o}t.key}: ${o}t.message}\`)).join(", "));o=(n,e,r,i,s)=>t.value.evaluate(n,e,{},r,void 0,void 0,i,s),a=!as(t.value.expression)}return{filter:s,dynamicFilter:o||void 0,needGeometry:Xo(r),needFeature:!!a}}function Go(t){if(!Array.isArray(t))return t;const n=function(t){if(Bo.has(t[0]))for(let n=1;n<t.length;n++)if(Wo(t[n]))return!0;return t}(t);return!0===n?n:n.map((t=>Go(t)))}function Jo(t){let n=!1;const e=[];if("case"===t[0]){for(let r=1;r<t.length-1;r+=2)n=n||Wo(t[r]),e.push(t[r+1]);e.push(t[t.length-1])}else if("match"===t[0]){n=n||Wo(t[1]);for(let n=2;n<t.length-1;n+=2)e.push(t[n+1]);e.push(t[t.length-1])}else if("step"===t[0]){n=n||Wo(t[1]);for(let n=1;n<t.length-1;n+=2)e.push(t[n+1])}n&&(t.length=0,t.push("any",...e));for(let n=1;n<t.length;n++)Jo(t[n])}function Wo(t){if(!Array.isArray(t))return!1;if(function(t){return"pitch"===t||"distance-from-center"===t}(t[0]))return!0;for(let n=1;n<t.length;n++)if(Wo(t[n]))return!0;return!1}const Bo=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Xo(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let n=1;n<t.length;n++)if(Xo(t[n]))return!0;return!1}const Yo={StyleExpression:Do,isExpression:zo,isExpressionFilter:function t(n){if(!0===n||!1===n)return!0;if(!Array.isArray(n)||0===n.length)return!1;switch(n[0]){case"has":return n.length>=2&&"$id"!==n[1]&&"$type"!==n[1];case"in":return n.length>=3&&("string"!=typeof n[1]||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==n.length||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const e of n.slice(1))if(!t(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}},createExpression:jo,createPropertyExpression:Lo,normalizePropertyExpression:function(t,n){if(So(t))return new Ro(t,n);if(zo(t)){const e=Lo(t,n);if("error"===e.result)throw new Error(e.value.map((t=>\`${o}t.key}: ${o}t.message}\`)).join(", "));return e.value}{let e=t;return"string"==typeof t&&"color"===n.type&&(e=vi.parse(t)),{kind:"constant",evaluate:()=>e}}},ZoomConstantExpression:Uo,ZoomDependentExpression:No,StylePropertyFunction:Ro},{isExpression:Ko,createExpression:Zo}=Yo,Qo={};function ta(t){if(!Array.isArray(t))return ta([t]);const n=[];for(let e=0;e<t.length;e++){let r;r=!0===t[e].filter?function(){return!0}:na(t[e].filter),n.push(br({},t[e],{filter:r}))}return n}function na(t){if(!0===t)return function(){return!0};if(t&&t.condition){if("any"===t.type){const n=t.condition,e=[];for(let t=0;t<n.length;t++)e.push(na(n[t]));return(t,n)=>{for(let r=0;r<e.length;r++)if(e[r](t,n))return!0;return!1}}const n=na(t.condition);if(wr(t.layer))return n;const e=n=>n.layer===t.layer;return(t,r)=>e(t)&&n(t,r)}if(hn(t))return ln(t);{let n=qo(t);n=n&&n.filter;const e=(t,e)=>(Qo.zoom=e,n&&n(Qo,t));return e}}const ea={type:"number","property-type":"data-driven",expression:{parameters:["zoom","feature"]}};function ra(t,n){ea.type=n||"number";const e=Zo(t,ea);if("success"!==e.result)throw new Error(\`Invalid maplibre spec expression: ${o}JSON.stringify(t)} (${o}e.value})\`);return e.value}function ia(t){return Ko(t)}const sa={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};function oa(t){return sa[t]}const aa={markerPlacement:1,markerFile:1,mergeOnProperty:1,markerTextFit:1,markerType:1,markerHorizontalAlignment:1,markerVerticalAlignment:1,markerRotationAlignment:1,markerPitchAlignment:1,markerFillPatternFile:1,markerLinePatternFile:1,textName:1,textPlacement:1,textFaceName:1,textStyle:1,textHorizontalAlignment:1,textVerticalAlignment:1,textRotationAlignment:1,textPitchAlignment:1,lineJoin:1,lineCap:1,linePatternFile:1,polygonPatternFile:1},ua={lineDasharray:1,markerLineDasharray:1,uvScale:1,uvOffset:1};function la(t){return aa[t]?"string":oa(t)?"number":ua[t]?"array":"color"}var ha=Object.freeze({__proto__:null,compileFilter:na,compileStyle:function(t=[]){return ta(t=t.map((t=>{const n=br({},t);return n.filter&&n.filter.value&&(n.filter=n.filter.value),n})))},createExpression:ra,getExpressionType:la,isExpression:ia,isInterpolated:oa});const ca="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,fa=function(t){return class extends t{pushIn(...t){const n=t.length;for(let e=0;e<n;e++)this[this.currentIndex++]=t[e]}fill(t,n,e){super.fill(t,n,e),e>this.currentIndex&&(this.currentIndex=e)}set(t,n){t>=this.currentIndex&&(this.currentIndex=t+1),this[t]=n}getLength(){return this.currentIndex}setLength(t){this.currentIndex=t,super.length<t&&(super.length=t)}trySetLength(t){t>this.currentIndex&&this.setLength(t)}reset(){this.currentIndex=0}slice(t,n){const e=super.slice(t,n);return e.currentIndex=n-t,e}}},da=fa(Array),pa={get:function(t,n){return"length"===n?t.getLength():t[n]}};class ya extends Array{setLength(t){this.length=t,this.currentIndex=t}trySetLength(t){this.length=t,this.currentIndex=t}getLength(){return this.length}}let ma;class ga{static createTypedArray(t,n){return gr(t,n)}static getInstance(){return ma}static ensureCapacity(t,n){if(!t.BYTES_PER_ELEMENT)return t;if(t.length>=n)return t;const e=new t.constructor(n+Math.ceil(.5*n)),r=t.getLength();for(let n=0;n<r;n++)e[n]=t[n];return e.currentIndex=t.currentIndex,e}static getArray(t){let n;if(t){const e=fa(t);n=new e(1048576/e.BYTES_PER_ELEMENT)}else n=new da;return n.push=(...t)=>{n.pushIn(...t)},n}static getProxyArray(){const t=new da,n=new Proxy(t,pa);return n.push=(...n)=>{t.pushIn(...n)},n.R=t,n}constructor(){this.tt=[],this.nt=0,this.et=[],this.rt=0,this.it={}}getProxy(){if(!ca){const t=new ya;return t.currentIndex=0,t}const t=this.et[this.rt]=this.et[this.rt]||ga.getProxyArray();return t.reset(),this.rt++,t}get(t){if(!ca){const t=new ya;return t.currentIndex=0,t}if(t){const n=t.name;let e=this.it[n];e||(e=this.it[n]={arrays:[],index:0});const r=e.index,i=e.arrays[r]=e.arrays[r]||ga.getArray(t);return i.reset(),e.index++,i}const n=this.tt[this.nt]=this.tt[this.nt]||ga.getArray();return n.reset(),this.nt++,n}reset(){this.nt=0,this.rt=0;for(const t in this.it)this.it[t].index=0}}ma=new ga;const va="__fea_idx",ba=[],wa={},Ma={},xa={},Fa=[],ka=ga.getInstance(),Aa=Math.pow(2,17);class Pa{static isAtlasLoaded(t,n={}){const{iconAtlas:e}=n;return!!(!t||e&&e.positions[t])}static genFnTypes(t){const n={};for(const e in t)if(ia(t[e])){const r=(e+"_Fn_0").trim(),i=(e+"Fn").trim(),s=la(e);n[r]=ra(t[e],s),n[i]=(t,e)=>{let i;wa.zoom=t,Ma.properties=e;try{i=n[r].evaluateWithoutErrorHandling(wa,Ma,xa,null,Fa)}catch(t){return null}return i}}else if(_r(t[e])){const r=(e+"_Fn_0").trim(),i=(e+"Fn").trim();oa(e)?(n[r]=m(t[e]),n[i]=(t,e)=>{const i=n[r](t,e);return _r(i)?m(i)(t,e):i}):(n[r]=g(t[e]),n[i]=(t,e)=>{const i=n[r](t,e);return _r(i)?g(i)(t,e):i})}return n}constructor(t,n,e){this.options=e;const r=[];this.symbolDef=n,this.symbol=v(n,(()=>(r[0]=e.zoom,r))),this.styledVectors=[],this.properties={},this.st=e.fnTypes||Pa.genFnTypes(this.symbolDef),_r(this.symbolDef.visible)&&(this.ot=m(this.symbolDef.visible)),e.atlas&&(this.iconAtlas=e.atlas.iconAtlas,this.glyphAtlas=e.atlas.glyphAtlas),this.features=this.ut(t)}needAltitudeAttribute(){return this.options.forceAltitudeAttribute||this.maxPosZ>=Aa||this.options.positionType===Float32Array}getPositionFormat(){return this.needAltitudeAttribute()?[{type:Int16Array,width:2,name:"aPosition"},{type:Float32Array,width:1,name:"aAltitude"}]:[{type:Float32Array,width:3,name:"aPosition"}]}fillPosition(t,n,e,r){if(n<this.lt&&(this.lt=n),n>this.ht&&(this.ht=n),e<this.ct&&(this.ct=e),e>this.ft&&(this.ft=e),this.needAltitudeAttribute()){let i=t.aPosition.currentIndex;t.aPosition[i++]=n,t.aPosition[i++]=e,t.aPosition.currentIndex=i,i=t.aAltitude.currentIndex,t.aAltitude[i++]=r,t.aAltitude.currentIndex=i}else{jr(ba,n,e,r);let i=t.aPosition.currentIndex;t.aPosition[i++]=ba[0],t.aPosition[i++]=ba[1],t.aPosition[i++]=ba[2],t.aPosition.currentIndex=i}}ut(t){if(!t.length)return t;const n=(va+"").trim();let e,r=0,i=t[r];for(;!i.geometry;)r++,i=t[r];if(Array.isArray(i.geometry)&&i.properties){let n=i.geometry[0];for(;Array.isArray(n);)n=n[0];n instanceof dt&&(e=t)}if(!e)if(e=[],Array.isArray(i.geometry))for(let n=0;n<t.length;n++){const r=br({},t[n]);e.push(vr(r))}else for(let r=0;r<t.length;r++){const i=t[r],s=qe(i);for(let t=0;t<s.length;t++){const r=s[t];r[n]=i[n],e.push(r)}}if(this.maxPosZ=0,!this.options.forceAltitudeAttribute){const t="line"===this.symbolDef.textPlacement;let n=0,r=!1;const{textPitchAlignmentFn:i}=this.st;!i&&t&&"map"===this.symbolDef.textPitchAlignment&&(r=!0);for(let s=0;s<e.length;s++){const o=_a(e[s]&&e[s].geometry);if(o>n&&(n=o),t&&!r&&i&&e[s].properties){const t=i(null,e[s].properties);"map"===t&&(r=t)}}this.hasMapPitchAlign=r,this.maxPosZ=n}const s=this.options.order;if(s){const t=[];for(let n=0;n<s.length;n++)s[n]&&t.push(na(s[n]));e=e.sort(((n,e)=>{const r=t.length;let i=-1,s=-1;for(let o=0;o<r&&(t[o](n)&&(i=o),t[o](e)&&(s=o),!(i>=0&&i<r&&s>=0&&s<r));o++);return i-s}))}return e}load(t=1){const n=(va+"").trim(),e="_debug_info".trim(),r=this.st,i=this.styledVectors;this.count=0;const s=this.features;if(!s||!s.length)return Promise.resolve(null);const o={},a={},u={zoom:this.options.zoom,isVector3D:!!this.options.center},l=[],h=v(this.symbolDef,(()=>(l[0]=u.zoom,l)));let c=0,f=s.length;const d=this.options.debugIndex;try{for(;c<f;c++){const t=s[c];if(!t||!t.geometry)continue;if(Mr(d)&&t[e].index!==d)continue;t.properties||(t.properties={}),t.properties.$layer=t.layer,t.properties.$type=t.type;const l=this.createStyledVector(t,h,r,u,o,a);l&&l.feature.geometry&&(l.featureIdx=void 0===t[n]?c:t[n],this.count++,i.push(l))}}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(((e,r)=>{this.fetchAtlas(t,n,((t,n)=>{if(t)r(t);else{if(n){const{icons:t,glyphs:e}=n;if(t&&Object.keys(t).length){for(const n in t){const e=t[n],{width:r,height:i,data:s}=e.data;e.data=new tr({width:r,height:i},s)}this.iconAtlas=new cr(t)}if(e&&Object.keys(e).length){for(const t in e){const n=e[t];for(const t in n){const e=n[t],{width:r,height:i,data:s}=e.bitmap;e.bitmap=new Qe({width:r,height:i},s)}}this.glyphAtlas=new dr(e)}}e({glyphAtlas:this.glyphAtlas,iconAtlas:this.iconAtlas})}}))}))}fetchAtlas(t,n,e){Object.keys(t).length>0||Object.keys(n).length>0?this.options.requestor(t,n,e):e()}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 e=n.buffers;delete n.buffers;const r={data:n,buffers:e};if(this.iconAtlas){const t=r.data.iconAtlas=Sa(this.iconAtlas);if(t.glyphMap)for(const n in t.glyphMap)e.push(t.glyphMap[n].data.data.buffer);e.push(r.data.iconAtlas.image.data.buffer)}return this.glyphAtlas&&(r.data.glyphAtlas=Sa(this.glyphAtlas),e.push(r.data.glyphAtlas.image.data.buffer)),r}createStyledVector(t,n,e,r){return new zr(t,n,e,r)}createDataPack(t,n){if(!t||!t.length)return null;this.maxIndex=0,this.maxPos=0,this.lt=this.ct=1/0,this.ht=this.ft=-1/0,this.maxAltitude=0,this.dynamicAttrs={};const e=this.data={};this.dt=ka,ka.reset();let r=this.elements=ka.get();const i=this.yt=this.getFormat(Array.isArray(t[0])?t[0][0].symbol:t[0].symbol),s=this.needAltitudeAttribute()?2:3;for(let t=0;t<i.length;t++)e[i[t].name]=ka.get(i[t].type);let o=ka.get(),a=0;const u=ka.get();let l=0,h=!1,c=!0;const f=new Set;for(let r=0,i=t.length;r<i;r++){if(!t[r].feature.geometry)continue;const i=Array.isArray(t[r])?t[r][0].feature.id:t[r].feature.id;c&&(void 0!==Ma.id?f&&(f.has(Ma.id)?c=!1:f.add(Ma.id)):c=!1),Mr(i)&&(Math.abs(i)>l&&(l=Math.abs(i)),i<0&&(h=!0));const d=this.data.aPosition.getLength();if(Array.isArray(t[r]))for(let e=0;e<t[r].length;e++)this.gt(t[r][e],n);else this.gt(t[r],n);const p=(e.aPosition.getLength()-d)/s;for(let n=0;n<p;n++)o.push(t[r].featureIdx),Mr(i)&&u.push(i);a=Math.max(a,t[r].featureIdx)}if(this.countOutOfAngle>0&&console.warn("text anchor along line is ignored as anchor's line angle is bigger than textMaxAngle."),this.hasElements()&&!r.getLength())return null;const d=this.options.center?Float32Array:mr(a);o=ga.createTypedArray(o,d),i[0].type=this.options.positionType?this.options.positionType:yr(this.maxPos);const p=this.options.center;if(p&&(p[0]||p[1])){const t=e.aPosition,n=t.getLength();for(let e=0;e<n;e+=s)t[e]-=p[0],t[e+1]-=p[1]}const y=function(t,n){const e={};for(let r=0;r<t.length;r++){const i=t[r],s=i.type,o=i.name;e[o]=s===Array?n[o]:gr(n[o],s)}return e}(i,e);y.aPickingId=o;const m=[];for(const t in y)m.push(y[t].buffer);const g=pr(this.maxIndex);r=ga.createTypedArray(r,g),m.push(r.buffer);const v={data:y,isIdUnique:c,is2D:0===this.maxPosZ,indices:this.hasElements()?r:null,positionSize:s,positionBounding:[this.lt,this.ct,this.ht,this.ft],buffers:m,symbolIndex:this.symbolDef.index||{index:0},dynamicAttributes:this.dynamicAttrs};if(this.vt&&(v.markerPlacement=this.vt),this.bt&&(v.textPlacement=this.bt),u.getLength()){const t=h?yr(l):mr(l);v.featureIds=ga.createTypedArray(u,t),m.push(v.featureIds.buffer)}else v.featureIds=[];return v.pickingIdIndiceMap=ur(o,v.indices),v}gt(t,n){this.ot&&!this.ot(this.options.zoom,t.feature.properties)||this.placeVector(t,n,this.formatWidth)}addElements(t,n,e){this.maxIndex=Math.max(this.maxIndex,t,n,e);let r=this.elements.currentIndex;this.elements[r++]=t,this.elements[r++]=n,this.elements[r++]=e,this.elements.currentIndex=r}hasElements(){return!0}getAltitude(t){const{altitudeProperty:n,defaultAltitude:e,altitudeScale:r}=this.options;let i=rr(t,n,e);return r&&(i*=r),this.maxAltitude=Math.max(this.maxAltitude,Math.abs(i)),i}getIconAtlasMaxValue(){const t=this.iconAtlas.positions;let n=0;for(const e in t)if(Pr(t,e)){const{tl:r,displaySize:i}=t[e],s=Math.max(r[0],r[1],i[0]-1,i[1]-1);s>n&&(n=s)}return n}ensureDataCapacity(t,n){const e=this.yt;for(let r=0;r<e.length;r++){const i=this.data[e[r].name];if(!i)continue;const s=e[r].width*t,o=i.getLength();this.data[e[r].name]=ga.ensureCapacity(i,o+s*n)}}}function Sa(t){let n=t.positions,e=t.image&&t.image.format||"alpha";if(t instanceof cr){n={};for(const e in t.positions){const r=t.positions[e];n[e]={paddedRect:r.paddedRect,pixelRatio:r.pixelRatio,tl:r.tl,br:r.br,displaySize:r.displaySize}}e="rgba"}const r=t.image;return{image:{width:r.width,height:r.height,data:r.data,format:e},glyphMap:t.glyphMap,positions:n}}function _a(t){if(!t)return 0;let n=0;if(Array.isArray(t))for(let e=0;e<t.length;e++)if(Array.isArray(t[e])){const r=_a(t[e]);r>n&&(n=r)}else{const r=Math.abs(t[e].z||0);r>n&&(n=r)}else{const e=Math.abs(t.z||0);e>n&&(n=e)}return n}const Oa="___fn_in_stops";function Ca(t,n,e,r){const i="__fn_textSize".trim();let s=t.textSize;if(wr(n.textSize))return[16,16];t[i]&&(s=t[i]);const o=[];if(o[0]=kr(s)?s(r,e):s,y(o[0])){const n=o[0].wt=o[0].wt||JSON.stringify(o[0]);t[Oa]||(t[Oa]={}),t[Oa][n]||(t[Oa][n]=m(o[0])),o[0]=(0,t[Oa][n])(r,e)}return o[1]=o[0],o}function Ea(t){const n=t.stops;let e=-1/0;for(let t=0;t<n.length;t++){let r=n[t][1];xr(n[t][1])&&(r=Ea(n[t][1])),r>e&&(e=r)}return e}function Ia(t){return t||"Open Sans Regular"}const $a=/\\{[\\w-]+(?:\\|[\\w-]+)*\\}/g;function Ta(t,n){return Fr(t)?t.replace($a,(function(t){if(!n)return"";if((t=t.substring(1,t.length-1)).indexOf("|")>0){const e=t.split("|");for(let t=0;t<e.length;t++){const r=n[e[t]];if(!wr(r))return r}return""}const e=n[t];return wr(e)?"":Array.isArray(e)?e.join():e})):t}var Da=Object.freeze({__proto__:null,getSDFFont:Ia,resolveExpVarNames:function t(n,e){if(2!==e.length||"get"!==e[0])for(let r=0;r<e.length;r++)2===e[r].length&&"get"===e[r][0]?n.push(e[r][1]):Array.isArray(e[r])&&t(n,e[r]);else n.push(e[1])},resolveText:Ta,resolveVarNames:function(t){return t.match($a)}});const za={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function ja(t){return!(za.Arabic(t)||za["Arabic Supplement"](t)||za["Arabic Extended-A"](t)||za["Arabic Presentation Forms-A"](t)||za["Arabic Presentation Forms-B"](t))}function Ua(t){return!!(!(t<11904)&&(za["Bopomofo Extended"](t)||za.Bopomofo(t)||za["CJK Compatibility Forms"](t)||za["CJK Compatibility Ideographs"](t)||za["CJK Compatibility"](t)||za["CJK Radicals Supplement"](t)||za["CJK Strokes"](t)||za["CJK Symbols and Punctuation"](t)||za["CJK Unified Ideographs Extension A"](t)||za["CJK Unified Ideographs"](t)||za["Enclosed CJK Letters and Months"](t)||za["Halfwidth and Fullwidth Forms"](t)||za.Hiragana(t)||za["Ideographic Description Characters"](t)||za["Kangxi Radicals"](t)||za["Katakana Phonetic Extensions"](t)||za.Katakana(t)||za["Vertical Forms"](t)||za["Yi Radicals"](t)||za["Yi Syllables"](t)))}function Na(t){return!!(746===t||747===t||!(t<4352)&&(za["Bopomofo Extended"](t)||za.Bopomofo(t)||za["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||za["CJK Compatibility Ideographs"](t)||za["CJK Compatibility"](t)||za["CJK Radicals Supplement"](t)||za["CJK Strokes"](t)||!(!za["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||za["CJK Unified Ideographs Extension A"](t)||za["CJK Unified Ideographs"](t)||za["Enclosed CJK Letters and Months"](t)||za["Hangul Compatibility Jamo"](t)||za["Hangul Jamo Extended-A"](t)||za["Hangul Jamo Extended-B"](t)||za["Hangul Jamo"](t)||za["Hangul Syllables"](t)||za.Hiragana(t)||za["Ideographic Description Characters"](t)||za.Kanbun(t)||za["Kangxi Radicals"](t)||za["Katakana Phonetic Extensions"](t)||za.Katakana(t)&&12540!==t||!(!za["Halfwidth and Fullwidth Forms"](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)||!(!za["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||za["Unified Canadian Aboriginal Syllabics"](t)||za["Unified Canadian Aboriginal Syllabics Extended"](t)||za["Vertical Forms"](t)||za["Yijing Hexagram Symbols"](t)||za["Yi Syllables"](t)||za["Yi Radicals"](t)))}function La(t){return!(Na(t)||function(t){return!!(za["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||za["General Punctuation"](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)||za["Letterlike Symbols"](t)||za["Number Forms"](t)||za["Miscellaneous Technical"](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)||za["Control Pictures"](t)&&9251!==t||za["Optical Character Recognition"](t)||za["Enclosed Alphanumerics"](t)||za["Geometric Shapes"](t)||za["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||za["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||za["CJK Symbols and Punctuation"](t)||za.Katakana(t)||za["Private Use Area"](t)||za["CJK Compatibility Forms"](t)||za["Small Form Variants"](t)||za["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Ra(t){return t>=1424&&t<=2303||za["Arabic Presentation Forms-A"](t)||za["Arabic Presentation Forms-B"](t)}const Va=[[9,9],[32,32],[5760,5760],[8192,8198],[8200,8202],[8287,12288],[6158,6158],[8203,8205]];function Ha(t){for(const n of Va)if(t>=n[0]&&t<=n[1])return!0;return!1}const qa={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\\\":"\","]":"﹈","^":"^",Mt:"︳","\`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},Ga=1,Ja=2;function Wa(t,n,e,r,i,s,o,a,u,l){let h=t.trim();l===Ja&&(h=function(t){let n="";const e=Array.from(t);for(let t=0;t<e.length;t++){const r=e[t+1].codePointAt(0)||null,i=e[t-1].codePointAt(0)||null;n+=r&&La(r)&&!qa[e[t+1]]||i&&La(i)&&!qa[e[t-1]]||!qa[e[t]]?e[t]:qa[e[t]]}return n}(h));const c=[],f={positionedGlyphs:c,text:h,top:a[1],bottom:a[1],left:a[0],right:a[0],writingMode:l};let d;return d=function(t,n){const e=[];let r=0;for(let i=0;i<n.length;i++){const s=n[i];e.push(t.substring(r,s)),r=s}return r<t.length&&e.push(t.substring(r,t.length)),e}(h,function(t,n,e,r){if(!e)return[];if(!t)return[];const i=[],s=function(t,n,e,r){let i=0;for(let e=0;e<t.length;e++){const s=r[t.codePointAt(e)];s&&(i+=s.metrics.advance+n)}return i/Math.max(1,Math.ceil(i/e))}(t,n,e,r);let o=0;for(let e=0;e<t.length;e++){const a=t.codePointAt(e),u=r[a];u&&(u&&!Ba[a]&&(o+=u.metrics.advance+n),e<t.length-1&&(Xa[a]||Ua(a))&&i.push(Za(e+1,o,s,i,Ka(a,t.codePointAt(e+1)),!1)))}return Qa(Za(t.length,o,s,i,0,!0))}(h,o,e,n)),function(t,n,e,r,i,s,o,a,u,l){let h=0,c=0,f=0;const d=t.positionedGlyphs;for(let t=0;t<e.length;t++){let i=e[t];if(i=i.trim(),!i.length){c-=r;continue}const s=d.length;for(let t=0;t<i.length;t++){const e=i.codePointAt(t),r=n[e];r&&(Na(e)&&o!==Ga?(32!==e&&d.push({glyph:e,x:h,y:0,vertical:!0}),h+=u+a):(32!==e&&d.push({glyph:e,x:h,y:c,vertical:!1}),h+=r.metrics.advance+a))}d.length!==s&&(f=Math.max(h-a,f),nu(d,n,s,d.length-1,.5)),h=0,c-=r}const{horizontalAlign:p,verticalAlign:y}=tu(i,void 0);!function(t,n,e,r,i,s,o){const a=(.5-e)*i,u=-(-r*o+.5)*s;if(a||u)for(let n=0;n<t.length;n++)t[n].x+=a,t[n].y+=u}(d,0,p,y,f,r,e.length);const m=e.length*r;t.top+=-y*m,t.bottom=t.top+m,t.left+=-p*f,t.right=t.left+f}(f,n,d,r,i,0,l,o,u),!!c.length&&f}const Ba={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Xa={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 Ya(t,n,e,r){const i=Math.pow(t-n,2);return r?t<n?i/2:2*i:i+Math.abs(e)*e}function Ka(t,n){let e=0;return 10===t&&(e-=1e4),40!==t&&65288!==t||(e+=50),41!==n&&65289!==n||(e+=50),e}function Za(t,n,e,r,i,s){let o=null,a=Ya(n,e,i,s);for(let t=0;t<r.length;t++){const u=r[t],l=Ya(n-u.x,e,i,s)+u.badness;l<=a&&(o=u,a=l)}return{index:t,x:n,priorBreak:o,badness:a}}function Qa(t){return t?Qa(t.priorBreak).concat(t.index):[]}function tu(t,n){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=n?1:0;break;case"left":case"top-left":case"bottom-left":e=n?0:1}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=n?1:0;break;case"top":case"top-right":case"top-left":r=n?0:1}return{horizontalAlign:e,verticalAlign:r}}function nu(t,n,e,r,i){const s=n[t[r].glyph];if(s){const n=(t[r].x+s.metrics.advance)*i;if(!n)return;for(let i=e;i<=r;i++)t[i].x-=n}}function eu(t){if(!function(t){for(const n of t)if(Ra(n.charCodeAt(0)))return!0;return!1}(t))return t;const n=[],e=[],r=[];let i=0,s=0,o=1,a=1;for(const u of t){const t=u.codePointAt(0);Ha(t)?(r.push(u),i++):(o=Ra(t)?-1:1,a!==o?(s=i,e.length&&(a>0&&e.reverse(),n.push(...e)),r.length&&(n.splice(s,0,...r),r.length=0),a=o,e.length=0):r.length&&(e.push(...r),r.length=0),e.push(u),i++)}return r.length&&e.push(...r),e.length&&(a>0&&e.reverse(),n.push(...e)),n.reverse().join("")}const ru=/\\{ *([\\w_]+) *\\}/g;class iu{constructor(t,n,e,r,i){this.feature=t,this.symbolDef=n,this.symbol=e,this.options=i,this.xt=this.Ft.bind(this),this.st=r}Ft(t,n){return this.feature.properties[n]||""}getShape(t,n){if(this.kt)return this.kt;const{textHorizontalAlignmentFn:e,textVerticalAlignmentFn:r,markerHorizontalAlignmentFn:i,markerVerticalAlignmentFn:s,textWrapWidthFn:o}=this.st;let a;const u=this.symbol,l=this.getIconAndGlyph(),h=this.feature.properties;if(l&&l.glyph){const{font:t,text:i}=l.glyph;if(""===i)return null;const s=this.size[0]/24,c=24,f=u.textKeepUpright,d="map"===u.textRotationAlignment&&"line"===u.textPlacement&&!u.isIconText,p=n.glyphMap[t],y=su(e?e(null,h):u.textHorizontalAlignment,r?r(null,h):u.textVerticalAlignment),m=1.2*c,g=function(t){for(let n=0;n<t.length;n++)if(!ja(t.charAt(n).charCodeAt(0)))return!1;return!0}(i),v=g&&u.textLetterSpacing/s||0,b=[u.textDx/s||0,u.textDy/s||0],w=((o?o(null,h):u.textWrapWidth)||10*c)/s;a={},a.horizontal=Wa(i,p,w,m,y,0,v,b,c,Ga),g&&d&&f&&(a.vertical=Wa(i,p,w,m,y,0,v,b,c,Ja))}else if(l&&l.icon){if(!t||!t.positions[l.icon.url])return null;const n=su(i?i(null,h):u.markerHorizontalAlignment,s?s(null,h):u.markerVerticalAlignment);a=function(t,n,e){let{horizontalAlign:r,verticalAlign:i}=tu(n,e);e?r=1-r:i=1-i;const s=-2048*r,o=-2048*i;return{image:t,top:o,bottom:o+2048,left:s,right:s+2048}}(t.positions[l.icon.url],n,this.options.isVector3D),this.size||(this.size=a.image.displaySize)}return this.kt=a,a}getIconAndGlyph(){if(this.iconGlyph)return this.iconGlyph;const{markerFileFn:t,markerTypeFn:n,markerPathFn:e,markerWidthFn:r,markerHeightFn:i,markerFillFn:s,markerFillPatternFileFn:o,markerFillOpacityFn:a,markerTextFitFn:u,markerTextFitPaddingFn:l,markerLineColorFn:h,markerLineWidthFn:c,markerLineOpacityFn:f,markerLineDasharrayFn:d,markerLinePatternFileFn:p,markerPathWidthFn:g,markerPathHeightFn:v,textNameFn:b,textFaceNameFn:w}=this.st,{zoom:M}=this.options,x={},F=this.symbol,k=this.feature.properties,A=t?t(null,k):F.markerFile,P=n?n(null,k):F.markerType,S=A||P||F.markerPath,_=!wr(this.symbolDef.textName);let O;if(S){O=function(t,n,e,r,i,s){if(wr(n.markerWidth)&&wr(n.markerHeight))return null;const o="__fn_markerWidth".trim(),a="__fn_markerHeight".trim();let u=n.markerWidth||0,l=n.markerHeight||0;return xr(u)&&("identity"!==u.type?u=Ea(u):(u=t.markerWidth,t[o]&&(u=t[o](r,e)),xr(u)&&(u="identity"===u.type?i(r,e):Ea(u)))),xr(l)&&("identity"!==l.type?l=Ea(l):(l=t.markerHeight,t[a]&&(l=t[a](r,e)),xr(l)&&(l="identity"===l.type?s(r,e):Ea(l)))),[u,l]}(F,this.symbolDef,k,M,r,i)||[0,0];let t=F.markerTextFit;if(u&&(t=u(M,k)),t&&F.text&&"none"!==t){const n=F.text.textSize;let e=F.text.textName;y(e)&&(e=m(e)(M,k));const r=Ta(e,k);if(r){const e="__fn_textSize".trim(),i="__fn_textSize_0".trim();y(n)&&!F.text[e]&&(F.text[i]=m(n),F.text[e]=(t,n)=>{const e=F.text[i](t,n);return y(e)?m(e)(t,n):e});const s=Ca(F.text,F.text,k,M);if("width"!==t&&"both"!==t||(O[0]=s[0]*r.length),"height"!==t&&"both"!==t||(O[1]=s[1]),s[0]&&s[1]){let t=F.markerTextFitPadding||[0,0,0,0];l&&(t=l(M,k)),O[0]+=t[1]+t[3],O[1]+=t[0]+t[2]}}else O[0]=O[1]=-1}}if(_&&(O=Ca(F,this.symbolDef,k,M)),!O)return x;if(O[0]=Math.ceil(O[0]),O[1]=Math.ceil(O[1]),this.size=O,S&&O[0]>=0&&O[1]>=0){let t;if(P){const n={};if(n.markerType=P,"path"===P&&(n.markerPath=e?e(null,k):F.markerPath,n.markerPathWidth=g?g(null,k):F.markerPathWidth,n.markerPathHeight=v?v(null,k):F.markerPathHeight),r){const t=r(null,k);wr(t)||(n.markerWidth=t)}else F.markerWidth>=0&&(n.markerWidth=F.markerWidth);if(i){const t=i(null,k);wr(t)||(n.markerHeight=t)}else F.markerHeight>=0&&(n.markerHeight=F.markerHeight);if(s){const t=s(null,k);wr(t)||(n.markerFill=t)}else F.markerFill&&(n.markerFill=F.markerFill);if(o){const t=o(null,k);wr(t)||(n.markerFillPatternFile=t)}else F.markerFillPatternFile&&(n.markerFillPatternFile=F.markerFillPatternFile);if(a){const t=a(null,k);wr(t)||(n.markerFillOpacity=t)}else F.markerFillOpacity>=0&&(n.markerFillOpacity=F.markerFillOpacity);if(h){const t=h(null,k);wr(t)||(n.markerLineColor=t)}else F.markerLineColor&&(n.markerLineColor=F.markerLineColor);if(c){const t=c(null,k);wr(t)||(n.markerLineWidth=t)}else F.markerLineWidth>=0&&(n.markerLineWidth=F.markerLineWidth);if(f){const t=f(null,k);wr(t)||(n.markerLineOpacity=t)}else F.markerLineOpacity>=0&&(n.markerLineOpacity=F.markerLineOpacity);if(d){const t=d(null,k);wr(t)||(n.markerLineDasharray=t)}else F.markerLineDasharray&&(n.markerLineDasharray=F.markerLineDasharray);if(p){const t=p(null,k);wr(t)||(n.markerLinePatternFile=t)}else F.markerLinePatternFile&&(n.markerLinePatternFile=F.markerLinePatternFile);t="vector://"+JSON.stringify(n)}else t=A?A.replace(ru,this.xt):F.markerPath?function(t,n,e){if(!t.markerPath)return null;let r=1;const i=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);Mr(t.markerOpacity)&&(r=t.markerOpacity),Mr(t.opacity)&&(r*=t.opacity);const s={};if(i){for(const t in i.stroke)Pr(i.stroke,t)&&(wr(i.stroke[t])||(s[t]=i.stroke[t]));for(const t in i.fill)Pr(i.fill,t)&&(wr(i.fill[t])||(s[t]=i.fill[t]))}const o=Array.isArray(t.markerPath)?t.markerPath:[t.markerPath];let a;const u=[];for(let t=0;t<o.length;t++)a=Fr(o[t])?{path:o[t]}:o[t],a=br({},a,s),a.d=a.path,delete a.path,u.push(a);const l=['<svg version="1.1"','xmlns="http://www.w3.org/2000/svg"'];r<1&&l.push('opacity="'+r+'"'),t.markerPathWidth&&t.markerPathHeight&&l.push('viewBox="0 0 '+t.markerPathWidth+" "+t.markerPathHeight+'"'),l.push('preserveAspectRatio="none"'),n&&l.push('width="'+n+'"'),e&&l.push('height="'+e+'"'),l.push("><defs></defs>");for(let t=0;t<u.length;t++){let n="<path ";for(const e in u[t])Pr(u[t],e)&&(n+=" "+e+'="'+u[t][e]+'"');n+="></path>",l.push(n)}return l.push("</svg>"),"data:image/svg+xml;base64,"+btoa(l.join(" "))}(F,O[0],O[1]):null;x.icon={url:t,size:O}}if(_){const t=b?b(this.options.zoom,k):F.textName;if(t||0===t){const n=Ia(w?w(null,k):F.textFaceName);let e=Ta(t,k);e&&e.length&&(e=eu(e),x.glyph={font:n,text:e})}}return this.iconGlyph=x,x}}function su(t,n){n&&"middle"!==n||(n="center"),t&&"middle"!==t||(t="center");let e="center"!==n?n:"";return e+="center"!==t?(e.length?"-":"")+t:"",e\n/*!\n * From mapbox-gl-js\n * MIT License\n * https://github.com/mapbox/mapbox-gl-js\n */}function ou(t,n,e,r,i){const s=[];let o;for(let a=0;a<t.length;a++){const u=t[a];let l,h=!1;for(let t=0;t<u.length-1;t++){let a=u[t],c=u[t+1];a.x<n&&c.x<n||(a.x<n?(o=a,a=new dt(n,a.y+(n-a.x)/(c.x-a.x)*(c.y-a.y)).j(),a.z=o.z+(n-o.x)/(c.x-o.x)*(c.z-o.z),h=!0):c.x<n&&(o=c,c=new dt(n,a.y+(n-a.x)/(c.x-a.x)*(c.y-a.y)).j(),c.z=a.z+(n-a.x)/(o.x-a.x)*(o.z-a.z),h=!0),a.y<e&&c.y<e||(a.y<e?(o=a,a=new dt(a.x+(e-a.y)/(c.y-a.y)*(c.x-a.x),e).j(),a.z=o.z+(e-o.y)/(c.y-o.y)*(c.z-o.z),h=!0):c.y<e&&(o=c,c=new dt(a.x+(e-a.y)/(c.y-a.y)*(c.x-a.x),e).j(),c.z=a.z+(e-a.y)/(o.y-a.y)*(o.z-a.z),h=!0),a.x>=r&&c.x>=r||(a.x>=r?(o=a,a=new dt(r,a.y+(r-a.x)/(c.x-a.x)*(c.y-a.y)).j(),a.z=o.z+(r-o.x)/(c.x-o.x)*(c.z-o.z),h=!0):c.x>=r&&(o=c,c=new dt(r,a.y+(r-a.x)/(c.x-a.x)*(c.y-a.y)).j(),c.z=a.z+(r-a.x)/(o.x-a.x)*(o.z-a.z),h=!0),a.y>=i&&c.y>=i||(a.y>=i?(o=a,a=new dt(a.x+(i-a.y)/(c.y-a.y)*(c.x-a.x),i).j(),a.z=o.z+(i-o.y)/(c.y-o.y)*(c.z-o.z),h=!0):c.y>=i&&(o=c,c=new dt(a.x+(i-a.y)/(c.y-a.y)*(c.x-a.x),i).j(),c.z=a.z+(i-a.y)/(o.y-a.y)*(o.z-a.z),h=!0),l&&a.equals(l[l.length-1])||(l=[a],s.push(l)),h&&(l.clipped=!0),l.push(c)))))}}return s}class au extends dt{constructor(t,n,e,r){super(t,n),this.angle=e,void 0!==r&&(this.segment=r)}clone(){return new au(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 uu(t,n,e,r,i){if(void 0===n.segment)return!0;let s=n,o=n.segment+1,a=0;for(;a>-e/2;){if(o--,o<0)return!1;a-=t[o].dist(s),s=t[o]}a+=t[o].dist(t[o+1]),o++;const u=[];let l=0;for(;a<e/2;){const n=t[o],e=t[o+1];if(!e)return!1;let s=t[o-1].angleTo(n)-n.angleTo(e);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),u.push({distance:a,angleDelta:s}),l+=s;a-u[0].distance>r;)l-=u.shift().angleDelta;if(l>i)return!1;o++,a+=n.dist(e)}return!0}function lu(t,n,e,r,i,s,o,a,u,l,h){const c=function(t,n,e){return t?.6*n*e:0}(r,s,o),f=function(t,n){return Math.max(t?t.right-t.left:0,0)}(r),d=0===t[0].x||t[0].x===u||0===t[0].y||t[0].y===u;return n-f*o<n/4&&(n=f*o+n/4),hu(t,d?n/2*a%n:(f/2+2*s)*o*a%n,n,c,e,f*o,d,!1,u,l,h)}function hu(t,n,e,r,i,s,o,a,u,l,h){let c=0;const f=s/2,d=function(t){let n=0;for(let e=0;e<t.length-1;e++)n+=t[e].dist(t[e+1]);return n}(t);let p=0,y=n-e,m=[];for(let n=0;n<t.length-1;n++){const o=t[n],a=t[n+1],g=o.dist(a),v=a.angleTo(o);for(;y+e<p+g;){y+=e;const b=(y-p)/g,w=cu(o.x,a.x,b),M=cu(o.y,a.y,b),x=cu(o.z||0,a.z||0,b);if(w>=0&&w<u&&M>=0&&M<u&&y-f>=0&&y+f<=d){const e=new au(w,M,v,n);e.z=x,l&&(e.axis=[o.y-M,w-o.x],e.angleR=x===(o.z||0)?0:Math.atan(.9*(x-(o.z||0))*h/o.dist(e))),e.line=t,e.j(),!r||uu(t,e,s,r,i)?m.push(e):r&&c++}}p+=g}return a||m.length||o||(m=hu(t,p/2,e,r,i,s,o,!0,u,l,h)),m.countOutOfAngle=c,m}function cu(t,n,e){return t*(1-e)+n*e}function fu(t,n){const e=t.length;if(e<=1)return[t];const r=[];let i,s;for(let n=0;n<e;n++){const e=nr(t[n]);0!==e&&(t[n].area=Math.abs(e),void 0===s&&(s=e<0),s===e<0?(i&&r.push(i),i=[t[n]]):i.push(t[n]))}if(i&&r.push(i),n>1)for(let t=0;t<r.length;t++)r[t].length<=n||(Mn(r[t],n,1,r[t].length-1,du),r[t]=r[t].slice(0,n));return r}function du(t,n){return n.area-t.area}function pu(t,n,e){const r=n.distSqr(e);if(0===r)return t.distSqr(n);const i=((t.x-n.x)*(e.x-n.x)+(t.y-n.y)*(e.y-n.y))/r;return t.distSqr(i<0?n:i>1?e:e.sub(n).S(i).F(n))}function yu(t,n=1,e=!1){let r=1/0,i=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<r)&&(r=n.x),(!t||n.y<i)&&(i=n.y),(!t||n.x>s)&&(s=n.x),(!t||n.y>o)&&(o=n.y)}const u=Math.min(s-r,o-i);let l=u/2;const h=new xn([],mu);if(0===u)return new dt(r,i);for(let n=r;n<s;n+=u)for(let e=i;e<o;e+=u)h.push(new gu(n+l,e+l,l,t));let c=function(t){let n=0,e=0,r=0;const i=t[0];for(let t=0,s=i.length,o=s-1;t<s;o=t++){const s=i[t],a=i[o],u=s.x*a.y-a.x*s.y;e+=(s.x+a.x)*u,r+=(s.y+a.y)*u,n+=3*u}return new gu(e/n,r/n,0,t)}(t),f=h.length;for(;h.length;){const r=h.pop();(r.d>c.d||!c.d)&&(c=r,e&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,f)),r.max-c.d<=n||(l=r.h/2,h.push(new gu(r.p.x-l,r.p.y-l,l,t)),h.push(new gu(r.p.x+l,r.p.y-l,l,t)),h.push(new gu(r.p.x-l,r.p.y+l,l,t)),h.push(new gu(r.p.x+l,r.p.y+l,l,t)),f+=4)}return e&&(console.log(\`num probes: ${o}f}\`),console.log(\`best distance: ${o}c.d}\`)),c.p}function mu(t,n){return n.max-t.max}function gu(t,n,e,r){this.p=new dt(t,n),this.h=e,this.d=function(t,n){let e=!1,r=1/0;for(let i=0;i<n.length;i++){const s=n[i];for(let n=0,i=s.length,o=i-1;n<i;o=n++){const i=s[n],a=s[o];i.y>t.y!=a.y>t.y&&t.x<(a.x-i.x)*(t.y-i.y)/(a.y-i.y)+i.x&&(e=!e),r=Math.min(r,pu(t,i,a))}}return(e?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}function vu(t,n,e,r,i,s,o,a,u,l){const{feature:h,size:c,symbol:f}=t,d=c?24:0,p=i*(c?c[0]/d:1);if("line"===o){const t=[];t.countOutOfAngle=0;let i=h.geometry;s&&(i=ou(h.geometry,0,0,s,s));for(let o=0;o<i.length;o++){const h=lu(i[o],a,e,f.isIconText?null:r&&r.vertical||r&&r.horizontal||r,0,d,f.isIconText?1:p,1,s||1/0,u,l);if(f.textPlacement&&!f.isIconText)for(let t=0;t<h.length;t++)h[t].startIndex=n.length/3;if(t.push.apply(t,h),f.textPlacement&&!f.isIconText)for(let t=0;t<i[o].length;t++)n.push(i[o][t].x,i[o][t].y,i[o][t].z||0);t.countOutOfAngle+=h.countOutOfAngle||0}return t}return bu(h,o,s)}function bu(t,n,e,r,i){const s=[];if(3===t.type){const o=fu(t.geometry,0);for(let t=0;t<o.length;t++){const a=o[t];if("vertex"===n)for(let t=0;t<a.length;t++){const n=a[t];for(let o=0;o<n.length;o++)sr(n[o],e)||(s.push(n[o]),r&&(0===o?wu(n[o],n[o],n[t+1],i):wu(n[o],n[o-1],n[o],i)))}else if("vertex-first"===n){const t=a[0];t&&t[0]&&!sr(t[0],e)&&(s.push(t[0]),r&&wu(t[0],t[0],t[1],i))}else if("vertex-last"===n||"vertex-firstlast"===n){const t=a[0];if("vertex-firstlast"===n&&t&&t[0]&&!sr(t[0],e)&&(s.push(t[0]),r&&wu(t[0],t[0],t[1],i)),t&&t[t.length-1]&&!sr(t[t.length-1],e)){const n=t.length-1;s.push(t[n]),r&&wu(t[n],t[n-1],t[n],i)}}else{const t=yu(a,16);sr(t,e)||s.push(t)}}}else if(2===t.type)for(let o=0;o<t.geometry.length;o++){const a=t.geometry[o];if("vertex"===n)for(let t=0;t<a.length;t++)sr(a[t],e)||(s.push(a[t]),r&&(0===t?wu(a[t],a[t],a[t+1],i):wu(a[t],a[t-1],a[t],i)));else if("vertex-last"===n||"vertex-firstlast"===n){if("vertex-firstlast"!==n||sr(a[0],e)||(s.push(a[0]),r&&wu(a[0],a[0],a[1],i)),a&&a[a.length-1]&&!sr(a[a.length-1],e)){const t=a.length-1;s.push(a[t]),r&&wu(a[t],a[t-1],a[t],i)}}else sr(a[0],e)||(s.push(a[0]),r&&wu(a[0],a[0],a[1],i))}else if(1===t.type)for(let n=0;n<t.geometry.length;n++){const i=t.geometry[n];for(let t=0;t<i.length;t++){const n=i[t];sr(n,e)||(r&&(n.xRotation=0,n.yRotation=0,n.zRotation=0),s.push(n))}}return s}function wu(t,n,e,r){if(t.xRotation||t.yRotation||t.zRotation)return t;const i=e.x-n.x,s=n.y-e.y,o=(e.z-n.z)*r,a=Math.atan2(s,i);t.zRotation=a;const u=Math.atan2(o,Math.sqrt(i*i+s*s));return t.xyRotation=u,t}function Mu(t,n){const e={},r={},i=[];let s=0;function o(n){i.push(t[n]),s++}function a(t,n,e){const s=r[t];return delete r[t],r[n]=s,i[s].geometry[0].pop(),i[s].geometry[0]=i[s].geometry[0].concat(e[0]),s}function u(t,n,r){const s=e[n];return delete e[n],e[t]=s,i[s].geometry[0].shift(),i[s].geometry[0]=r[0].concat(i[s].geometry[0]),s}function l(t,n,e){const r=e?n[0][n[0].length-1]:n[0][0];return\`${o}t}:${o}r.x}:${o}r.y}\`}for(let h=0;h<t.length;h++){const c=t[h],f=c.geometry;if(!f)continue;const d=c.properties[n]?c.properties[n].toString():null;if(!d){o(h);continue}const p=l(d,f),y=l(d,f,!0);if(p in r&&y in e&&r[p]!==e[y]){const t=u(p,y,f),n=a(p,y,i[t].geometry);delete e[p],delete r[y],r[l(d,i[n].geometry,!0)]=n,i[t].geometry=null}else p in r?a(p,y,f):y in e?u(p,y,f):(o(h),e[p]=s-1,r[y]=s-1)}return i.filter((t=>t.geometry))}const xu="__index";function Fu(t,n,e,r){const i=(xu+"").trim(),s=function(t,n,e,r){const i=(xu+"").trim(),{mergeOnPropertyFn:s}=e;if(!n.mergeOnProperty)return[];if(!or(o=n.mergeOnProperty)&&("string"==typeof o||null!==o.constructor&&o.constructor===String))return[{features:t,property:n.mergeOnProperty}];var o;const a=[],u={},l=[];for(let e=0;e<t.length;e++){t[e][i]=e;const o=t[e].properties=t[e].properties||{};o.$layer=t[e].layer,o.$type=t[e].type;const h=s?s(r,o):n.mergeOnProperty;or(h)?l.push(t[e]):(void 0===u[h]&&(u[h]=a.length,a.push({features:[],property:h})),a[u[h]].features.push(t[e]))}return l.length&&a.push({features:l}),a}(t,n,e,r);if(s.length){const n=[];for(let e=0;e<s.length;e++)n.push(s[e].property?Mu(s[e].features,s[e].property):t);if(1===n.length)return n[0];{let t=[];for(let e=0;e<n.length;e++)t=t.concat(n[e]);return t.sort(((t,n)=>t[i]-n[i])),t}}return[]}class ku extends Pa{static needMerge(t,n,e){if(!t)return!1;let r="line"===t.textPlacement||"line"===t.markerPlacement;return r||(n.textPlacementFn&&(r="line"===n.textPlacementFn(e)),n.markerPlacementFn&&(r="line"===n.markerPlacementFn(e))),t.mergeOnProperty&&r}static mergeLineFeatures(t,n,e,r){let i=n.textPlacement,s=n.markerPlacement;return e.textPlacementFn&&(i=e.textPlacementFn(r)),e.markerPlacementFn&&(s=e.markerPlacementFn(r)),"line"!==i&&"line"!==s?t:Fu(t,n,e,r)}static splitPointSymbol(t,n=0){const e=[];if(Array.isArray(t)){const n=t;for(let t=0;t<n.length;t++)n[t]&&e.push(...ku.splitPointSymbol(n[t],t));return e}let r=null,i=null;for(const n in t)0===n.indexOf("marker")?(r=r||{},r[n]=t[n]):0===n.indexOf("text")&&(i=i||{},i[n]=t[n]);return r&&(r.isIconText=!0,t.mergeOnProperty&&(r.mergeOnProperty=t.mergeOnProperty),e.push(r)),i&&(r&&(i.textPlacement=r.markerPlacement,i.textSpacing=r.markerSpacing,i.isIconText=!0),t.mergeOnProperty&&(i.mergeOnProperty=t.mergeOnProperty),e.push(i)),void 0!==t.visible&&(r&&(r.visible=t.visible),i&&(i.visible=t.visible)),r&&(r.markerTextFit&&i&&(r.text={},r.text.textName=i.textName,r.text.textSize=i.textSize),r.index={index:n,type:0}),i&&(i.index={index:n,type:1}),e}static isAtlasLoaded(t,n){const{icon:e,glyph:r}=t,{iconAtlas:i,glyphAtlas:s}=n;if(e&&(!i||!i.positions[e.url]))return!1;if(r){if(!s||!s.positions[r.font])return!1;const t=s.positions[r.font],{text:n}=r;for(const e of n)if(!t[e.codePointAt(0)])return!1}return!0}constructor(t,n,e){super(t,n,e),this.At=n.textPlacement,this.st.textPlacementFn&&(this.At=this.st.textPlacementFn(this.options.zoom))}createStyledVector(t,n,e,r,i,s){const o=new iu(t,this.symbolDef,n,e,r),a=o.getIconAndGlyph();if(a.icon&&!this.options.atlas){const{url:t,size:n}=a.icon;i[t]||(i[t]=a.icon.size),i[t][0]<n[0]&&(i[t][0]=n[0]),i[t][1]<n[1]&&(i[t][1]=n[1])}if(a.glyph&&!this.options.atlas){const{font:t,text:n}=a.glyph,e=s[t]=s[t]||{};for(const t of n)e[t.codePointAt(0)]=1;"line"===this.At&&(s.options={isCharsCompact:!1})}return this.options.allowEmptyPack||a.icon||a.glyph?o:null}getFormat(t){const n=void 0!==t.textName,e=n?this.getPackSDFFormat(t):this.getPackMarkerFormat();n?e.push(...this.Pt()):e.push(...this.St());const{markerOpacityFn:r,textOpacityFn:i,markerPitchAlignmentFn:s,textPitchAlignmentFn:o,markerRotationAlignmentFn:a,textRotationAlignmentFn:u,markerRotationFn:l,textRotationFn:h,markerAllowOverlapFn:c,textAllowOverlapFn:f,markerIgnorePlacementFn:d,textIgnorePlacementFn:p}=this.st;return(r||i)&&e.push({type:Uint8Array,width:1,name:"aColorOpacity"}),(s||o)&&e.push({type:Uint8Array,width:1,name:"aPitchAlign"}),(a||u)&&e.push({type:Uint8Array,width:1,name:"aRotationAlign"}),(l||h)&&e.push({type:Uint16Array,width:1,name:"aRotation"}),(c||f||d||p)&&e.push({type:Uint8Array,width:1,name:"aOverlap"}),e}_t(){return this.hasMapPitchAlign}Pt(){const{textFillFn:t,textSizeFn:n,textHaloFillFn:e,textHaloRadiusFn:r,textHaloOpacityFn:i,textDxFn:s,textDyFn:o}=this.st,a=[];return t&&a.push({type:Uint8Array,width:4,name:"aTextFill"}),n&&a.push({type:Uint8Array,width:1,name:"aTextSize"}),e&&a.push({type:Uint8Array,width:4,name:"aTextHaloFill"}),r&&a.push({type:Uint8Array,width:1,name:"aTextHaloRadius"}),i&&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}St(){const{markerWidthFn:t,markerHeightFn:n,markerDxFn:e,markerDyFn:r}=this.st,i=[];return t&&i.push({type:this.options.markerWidthType||Uint8Array,width:1,name:"aMarkerWidth"}),n&&i.push({type:this.options.markerHeightType||Uint8Array,width:1,name:"aMarkerHeight"}),e&&i.push({type:Int8Array,width:1,name:"aMarkerDx"}),r&&i.push({type:Int8Array,width:1,name:"aMarkerDy"}),i}createDataPack(){if(!this.iconAtlas&&!this.glyphAtlas){if(!this.options.allowEmptyPack)return null;this.empty=!0}this.countOutOfAngle=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 e=t.getShape(this.iconAtlas,this.glyphAtlas);if(!(this.options.allowEmptyPack||e&&e.image||e&&(e.horizontal||e.vertical)))return;const r=this.Ot(t,e,n);if(this.countOutOfAngle+=r.countOutOfAngle||0,0===r.length)return;const i=this.data,s=this.needAltitudeAttribute()?2:3;let o=this.data.aPosition.getLength()/s;const a=t.symbol,u=t.feature.properties,l="line"===this.At&&!a.isIconText,h=void 0!==a.textName,c=h&&l&&function(t){let n=0;for(let e=0;e<t.length;e++)if(Na(t.charAt(e).charCodeAt(0)))n=0;else if(n++,n>=1)return!1;return!0}(t.getIconAndGlyph().glyph.text)?1:0,{textFillFn:f,textSizeFn:d,textHaloFillFn:p,textHaloRadiusFn:m,textHaloOpacityFn:g,textDxFn:v,textDyFn:b,textPitchAlignmentFn:w,textRotationAlignmentFn:M,textRotationFn:x,textAllowOverlapFn:F,textIgnorePlacementFn:k,textOpacityFn:A,markerWidthFn:P,markerHeightFn:S,markerDxFn:_,markerDyFn:O,markerPitchAlignmentFn:C,markerRotationAlignmentFn:E,markerRotationFn:I,markerAllowOverlapFn:$,markerIgnorePlacementFn:T,markerOpacityFn:D}=this.st;let z,j,U,N,L,R,V,H,q,G,J,W,B,X,Y,K,Z;if(h){const n=t.getIconAndGlyph().glyph.font;z=function(t,n,e){const r=t.positionedGlyphs,i=[];for(let s=0;s<r.length;s++){const o=r[s],a=e[o.glyph];if(!a)continue;const u=a.rect;if(!u)continue;const l=4,h=a.metrics.advance/2,c=a.metrics.height/2,f=n?[o.x+h,0]:[0,0],d=n?[0,o.y-c]:[o.x+h,o.y-c],p=a.metrics.left-l-h+d[0],y=a.metrics.top-l+d[1],m=p+u.w,g=y+u.h,v=new dt(p,y),b=new dt(m,y),w=new dt(p,g),M=new dt(m,g);if(n&&o.vertical){const t=new dt(-h,h),n=-Math.PI/2,e=new dt(5,0);v.C(n,t).F(e),b.C(n,t).F(e),w.C(n,t).F(e),M.C(n,t).F(e)}i.push({tl:v,tr:b,bl:w,br:M,tex:u,writingMode:t.writingMode,glyphOffset:f})}return i}(e.horizontal,l,this.glyphAtlas.positions[n]),f&&(j=f(null,u),y(j)?(this.dynamicAttrs.aTextFill=1,j=[0,0,0,0]):j=Ir([],j)),d&&(U=d(this.options.zoom,u),or(U)&&(U=14)),p&&(N=p(null,u),y(N)?(this.dynamicAttrs.aTextHaloFill=1,N=[0,0,0,0]):N=Ir([],N)),m&&(L=m(null,u)),g&&(R=255*g(null,u)),v&&(V=v(null,u)||0),b&&(H=b(null,u)||0),w&&(B=+("map"===w(null,u))),M&&(X=+("map"===M(null,u))),x&&(Y=ar(x(null,u),0,360)*Math.PI/180)}else z=e?function(t){const n=t.image,e=t.top-1/n.pixelRatio,r=t.left-1/n.pixelRatio,i=t.bottom+1/n.pixelRatio,s=t.right+1/n.pixelRatio;let o,a,u,l;return o=new dt(r,e),a=new dt(s,e),u=new dt(s,i),l=new dt(r,i),[{tl:o,tr:a,bl:l,br:u,tex:{x:n.tl[0],y:n.tl[1],w:n.displaySize[0],h:n.displaySize[1]},writingMode:void 0,glyphOffset:[0,0]}]}(e):function(){const t=new dt(0,0),n=new dt(0,0),e=new dt(0,0);return[{tl:t,tr:n,bl:new dt(0,0),br:e,tex:{x:0,y:0,w:0,h:0},writingMode:void 0,glyphOffset:[0,0]}]}(),P&&(q=P(null,u)),or(q)&&(q=z[0].tex.w),S&&(G=S(null,u)),or(G)&&(G=z[0].tex.h),_&&(J=_(null,u)),O&&(W=O(null,u)),C&&(B=+("map"===C(null,u))),E&&(X=+("map"===E(null,u))),I&&(Y=ar(I(null,u),0,360)*Math.PI/180);y(U)&&(this.dynamicAttrs.aTextSize=1),y(L)&&(this.dynamicAttrs.aTextHaloRadius=1),y(R)&&(this.dynamicAttrs.aTextHaloOpacity=1),y(V)&&(this.dynamicAttrs.aTextDx=1),y(H)&&(this.dynamicAttrs.aTextDy=1),y(q)&&(this.dynamicAttrs.aMarkerWidth=1),y(G)&&(this.dynamicAttrs.aMarkerHeight=1),y(J)&&(this.dynamicAttrs.aMarkerDx=1),y(W)&&(this.dynamicAttrs.aMarkerDy=1),y(B)&&(this.dynamicAttrs.aPitchAlign=1),y(X)&&(this.dynamicAttrs.aRotationAlign=1),y(Y)&&(this.dynamicAttrs.aRotation=1);const Q=$||F;Q&&(K=Q(null,u)||0);const tt=T||k;let nt;tt&&(Z=tt(null,u)||0);const et=A||D;et&&(nt=255*et(this.options.zoom,u));const rt=z.length;this.ensureDataCapacity(4*rt,r.length);const it=this.options.EXTENT,{altitudeScale:st,altitudeProperty:ot,defaultAltitude:at}=this.options,{altitude:ut}=ir(t.feature,st,ot,at);for(let t=0;t<r.length;t++){const n=r[t],e=n.z||ut||0;if(it!==1/0&&sr(n,it))continue;const s=n.x,a=n.y,u=z.length;for(let t=0;t<u;t++){const r=z[t],{tl:u,tr:f,bl:d,br:p,tex:y}=r;this.Ct(i,s,a,e,10*u.x,10*u.y,y.x,y.y+y.h),h&&this.Et(i,l,rt,r.glyphOffset,n,c,n.axis,n.angleR),this.It(i,j,U,N,L,R,V,H,q,G,J,W,nt,B,X,Y,K,Z),this.Ct(i,s,a,e,10*f.x,10*f.y,y.x+y.w,y.y+y.h),h&&this.Et(i,l,rt,r.glyphOffset,n,c,n.axis,n.angleR),this.It(i,j,U,N,L,R,V,H,q,G,J,W,nt,B,X,Y,K,Z),this.Ct(i,s,a,e,10*d.x,10*d.y,y.x,y.y),h&&this.Et(i,l,rt,r.glyphOffset,n,c,n.axis,n.angleR),this.It(i,j,U,N,L,R,V,H,q,G,J,W,nt,B,X,Y,K,Z),this.Ct(i,s,a,e,10*p.x,10*p.y,y.x+y.w,y.y),h&&this.Et(i,l,rt,r.glyphOffset,n,c,n.axis,n.angleR),this.It(i,j,U,N,L,R,V,H,q,G,J,W,nt,B,X,Y,K,Z),this.addElements(o,o+1,o+2),this.addElements(o+1,o+2,o+3),o+=4;const m=Math.max(Math.abs(s),Math.abs(a),Math.abs(e));m>this.maxPos&&(this.maxPos=m)}}}Ct(t,n,e,r,i,s,o,a){this.fillPosition(t,n,e,r);let u=t.aShape.currentIndex;t.aShape[u++]=i,t.aShape[u++]=s,t.aShape.currentIndex=u,u=t.aTexCoord.currentIndex,t.aTexCoord[u++]=o,t.aTexCoord[u++]=a,t.aTexCoord.currentIndex=u}Et(t,n,e,r,i,s,o,a){let u=t.aCount.currentIndex;if(t.aCount[u++]=e,t.aCount.currentIndex=u,n){u=t.aGlyphOffset.currentIndex,t.aGlyphOffset[u++]=r[0],t.aGlyphOffset[u++]=r[1],t.aGlyphOffset.currentIndex=u,this._t()&&(u=t.aPitchRotation.currentIndex,t.aPitchRotation[u++]=o[0],t.aPitchRotation[u++]=o[1],t.aPitchRotation[u++]=a,t.aPitchRotation.currentIndex=u);const n=i.startIndex;u=t.aSegment.currentIndex,t.aSegment[u++]=i.segment+n,t.aSegment[u++]=n,t.aSegment[u++]=i.line.length,t.aSegment.currentIndex=u,u=t.aVertical.currentIndex,t.aVertical[u++]=s,t.aVertical.currentIndex=u}}It(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p,y,m,g){const{textFillFn:v,textSizeFn:b,textHaloFillFn:w,textHaloRadiusFn:M,textHaloOpacityFn:x,textDxFn:F,textDyFn:k,textPitchAlignmentFn:A,textRotationAlignmentFn:P,textRotationFn:S,textAllowOverlapFn:_,textIgnorePlacementFn:O,textOpacityFn:C,markerWidthFn:E,markerHeightFn:I,markerDxFn:$,markerDyFn:T,markerPitchAlignmentFn:D,markerRotationAlignmentFn:z,markerRotationFn:j,markerAllowOverlapFn:U,markerIgnorePlacementFn:N,markerOpacityFn:L}=this.st;if(v){let e=t.aTextFill.currentIndex;t.aTextFill[e++]=n[0],t.aTextFill[e++]=n[1],t.aTextFill[e++]=n[2],t.aTextFill[e++]=n[3],t.aTextFill.currentIndex=e}if(b){let n=t.aTextSize.currentIndex;t.aTextSize[n++]=e,t.aTextSize.currentIndex=n}if(w){let n=t.aTextHaloFill.currentIndex;t.aTextHaloFill[n++]=r[0],t.aTextHaloFill[n++]=r[1],t.aTextHaloFill[n++]=r[2],t.aTextHaloFill[n++]=r[3],t.aTextHaloFill.currentIndex=n}if(M){let n=t.aTextHaloRadius.currentIndex;t.aTextHaloRadius[n++]=i,t.aTextHaloRadius.currentIndex=n}if(x){let n=t.aTextHaloOpacity.currentIndex;t.aTextHaloOpacity[n++]=s,t.aTextHaloOpacity.currentIndex=n}if(F){let n=t.aTextDx.currentIndex;t.aTextDx[n++]=o,t.aTextDx.currentIndex=n}if(k){let n=t.aTextDy.currentIndex;t.aTextDy[n++]=a,t.aTextDy.currentIndex=n}if(E){let n=t.aMarkerWidth.currentIndex;t.aMarkerWidth[n++]=u,t.aMarkerWidth.currentIndex=n}if(I){let n=t.aMarkerHeight.currentIndex;t.aMarkerHeight[n++]=l,t.aMarkerHeight.currentIndex=n}if($){let n=t.aMarkerDx.currentIndex;t.aMarkerDx[n++]=h,t.aMarkerDx.currentIndex=n}if(T){let n=t.aMarkerDy.currentIndex;t.aMarkerDy[n++]=c,t.aMarkerDy.currentIndex=n}if(L||C){let n=t.aColorOpacity.currentIndex;t.aColorOpacity[n++]=f,t.aColorOpacity.currentIndex=n}if(A||D){let n=t.aPitchAlign.currentIndex;t.aPitchAlign[n++]=d,t.aPitchAlign.currentIndex=n}if(z||P){let n=t.aRotationAlign.currentIndex;t.aRotationAlign[n++]=p,t.aRotationAlign.currentIndex=n}if(j||S){let n=t.aRotation.currentIndex;t.aRotation[n++]=9362*y,t.aRotation.currentIndex=n}const R=U||_,V=N||O;if(R||V){let n=t.aOverlap.currentIndex;t.aOverlap[n++]=(R?8:0)+4*m+((V?2:0)+g),t.aOverlap.currentIndex=n}i>0&&(this.properties.hasHalo=1)}Ot(t,n,e){const{feature:r,symbol:i}=t,s=this.$t(t,i),o=r.properties,{markerSpacingFn:a,textSpacingFn:u,textMaxAngleFn:l}=this.st,h=((a?a(null,o):i.markerSpacing)||(u?u(null,o):i.textSpacing)||250)*e;let c=l?l(this.options.zoom,o):i.textMaxAngle;or(c)&&(c=80),c*=Math.PI/180;const f=this.options.EXTENT,d=this.options.altitudeToTileScale,p=this._t();return vu(t,this.lineVertex,c,n,e,f,s,h,p,d)}$t(t,n){let e;return e=this.st.markerPlacementFn?this.st.markerPlacementFn(this.options.zoom,t.feature.properties):n.markerPlacement||this.At,this.vt||!n.markerPlacement&&!n.isIconText||(this.vt=e),!this.At||n.isIconText||this.bt||(this.bt=e),e}getPackSDFFormat(t){if("line"!==this.At||t.isIconText)return[...this.getPositionFormat(),{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"},{type:Uint8Array,width:1,name:"aCount"}];{const t=[...this.getPositionFormat(),{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"}];return this._t()&&t.push({type:Float32Array,width:3,name:"aPitchRotation"}),t}}getPackMarkerFormat(){return[...this.getPositionFormat(),{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"}]}}class Au{constructor(t){this.x=t.x,this.y=t.y,this.z=t.z||0}clone(){return new Au(this)}T(){return this._(this.mag()),this}_(t){return this.x/=t,this.y/=t,this.z/=t,this}D(){var t=this.y;return this.y=this.x,this.x=-t,this}mag(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}add(t){return this.clone().F(t)}sub(t){return this.clone().k(t)}F(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}k(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}equals(t){return this.x===t.x&&this.y===t.y&&this.z===t.z}mult(t){return this.clone().S(t)}S(t){return this.x*=t,this.y*=t,this.z*=t,this}dist(t){return Math.sqrt(this.distSqr(t))}distSqr(t){var n=t.x-this.x,e=t.y-this.y,r=t.z-this.z;return n*n+e*e+r*r}j(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)}}const Pu=63,Su=Math.cos(Math.PI/180*37.5),_u=Math.pow(2,16)/1,Ou=new dt,Cu=new dt,Eu=new dt;class Iu extends Pa{static mergeLineFeatures(t,n,e,r){return Fu(t,n,e,r)}constructor(t,n,e){super(t,n,e);let r=!1;const{lineDasharrayFn:i,lineDashColorFn:s}=this.st;this.hasGradient=this.symbol.lineGradientProperty,i&&(r=function(t,n,e){for(let r=0;r<t.length;r++)if(e(n,t[r].properties))return!0;return!1}(t,this.options.zoom,i),r&&(this.dasharrayFn=i)),this.hasDasharray=Du(this.symbol.lineDasharray)||r,this.hasDasharray&&s&&(this.dashColorFn=s)}createStyledVector(t,n,e,r,i){const s=new zr(t,n,e,r),o=s.getLineResource();return!this.options.atlas&&o&&(i[o]=[0,0]),s}getFormat(){const{lineWidthFn:t,lineStrokeWidthFn:n,lineStrokeColorFn:e,lineColorFn:r,lineOpacityFn:i,lineDxFn:s,lineDyFn:o,linePatternAnimSpeedFn:a,linePatternGapFn:u}=this.st,l=[...this.getPositionFormat()];if(l.push(this.iconAtlas||this.hasDasharray?{type:Int8Array,width:3,name:"aExtrude"}:{type:Int8Array,width:2,name:"aExtrude"}),l.push({type:this.options.positionType||Uint16Array,width:1,name:"aLinesofar"}),t&&l.push({type:Uint8Array,width:1,name:"aLineWidth"}),n&&l.push({type:Uint8Array,width:1,name:"aLineStrokeWidth"}),r&&l.push({type:Uint8Array,width:4,name:"aColor"}),e&&l.push({type:Uint8Array,width:4,name:"aStrokeColor"}),i&&l.push({type:Uint8Array,width:1,name:"aOpacity"}),this.dasharrayFn&&l.push({type:Uint8Array,width:4,name:"aDasharray"}),this.dashColorFn&&l.push({type:Uint8Array,width:4,name:"aDashColor"}),this.iconAtlas){const t=this.getIconAtlasMaxValue();l.push({type:t>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return(s||o)&&l.push({type:Int8Array,width:2,name:"aLineDxDy"}),(a||u)&&l.push({type:Int8Array,width:2,name:"aLinePattern"}),l}placeVector(t){const{lineJoinFn:n,lineCapFn:e,lineWidthFn:r,lineHeightFn:i,lineStrokeWidthFn:s,lineStrokeColorFn:o,lineColorFn:a,lineOpacityFn:u,lineDxFn:l,lineDyFn:h,linePatternAnimSpeedFn:c,linePatternGapFn:f}=this.st,d=this.symbol,p=t.feature,m=p.properties;let g=d.lineJoin||"miter",v=d.lineCap||"butt";if(n&&(g=n(this.options.zoom,m)||"miter"),e&&(v=e(this.options.zoom,m)||"butt"),r){let t=r(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineWidth=1,t=4),wr(t)&&(t=4),this.feaLineWidth=+t}else this.feaLineWidth=+d.lineWidth;if(i){let t=i(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineHeight=1),wr(t)&&(t=this.feaLineWidth),this.feaLineHeight=+t}else this.feaLineHeight=+d.lineHeight||this.feaLineWidth;if(s){let t=s(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineStrokeWidth=1,t=0),wr(t)&&(t=0),this.feaLineStrokeWidth=t}else this.feaLineStrokeWidth=d.lineStrokeWidth||0;if(a&&(this.feaColor=a(this.options.zoom,m)||[255,255,255,255],y(this.feaColor)?(this.dynamicAttrs.aColor=1,this.feaColor=[0,0,0,0]):this.feaColor=Ir([],this.feaColor)),o&&(this.feaStrokeColor=o(this.options.zoom,m)||[0,0,0,255],y(this.feaStrokeColor)?(this.dynamicAttrs.aStrokeColor=1,this.feaStrokeColor=[0,0,0,0]):this.feaStrokeColor=Ir([],this.feaStrokeColor)),u){let t=u(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aOpacity=1,t=1),wr(t)&&(t=1),this.feaOpacity=255*t}if(this.dasharrayFn){let t=this.dasharrayFn(this.options.zoom,m)||[0,0,0,0];if(y(t)&&(this.dynamicAttrs.aDasharray=1,t=[0,0,0,0]),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,m):this.symbol.lineDashColor)||[0,0,0,0];y(t)&&(this.dynamicAttrs.aDashColor=1,t=[0,0,0,0]),t=Ir([],t),this.feaDashColor=t}if(this.iconAtlas){const n=t.getLineResource(),e=this.iconAtlas.glyphMap[n];if(this.feaTexInfo=this.feaTexInfo||[0,0,0,0],e){const{tl:t,displaySize:e}=this.iconAtlas.positions[n];this.feaTexInfo[0]=t[0]+1,this.feaTexInfo[1]=t[1]+1,this.feaTexInfo[2]=e[0]-3,this.feaTexInfo[3]=e[1]-3}else this.feaTexInfo[0]=this.feaTexInfo[1]=this.feaTexInfo[2]=this.feaTexInfo[3]=0}if(l){let t=l(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineDxDy=1,t=0),wr(t)&&(t=0),this.feaLineDx=t}if(h){let t=h(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineDxDy=1,t=0),wr(t)&&(t=0),this.feaLineDy=t}if(c){let t=c(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLinePatternAnimSpeed=1,t=0),wr(t)&&(t=0),0!==t&&(this.properties.hasPatternAnim=1),this.feaPatternAnimSpeed=t}if(f){let t=f(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLinePatternGap=1,t=0),wr(t)&&(t=0),this.feaLinePatternGap=t}const b=this.options.EXTENT;let w=p.geometry;if(b!==1/0){w=[];const t=[];for(let n=0;n<p.geometry.length;n++){t[0]=p.geometry[n];const e=ou(t,-1,-1,b+1,b+1);if(3===p.type&&e.length>1){const t=e[0],n=e[e.length-1];Uu(t[0],n[n.length-1])&&(e[0]=n.concat(t.slice(1)),e.length=e.length-1)}w.push(...e)}}const M=this.needAltitudeAttribute()?2:3;for(let t=0;t<w.length;t++)this.offset=this.data.aPosition.getLength()/M,this.Tt(w[t],p,g,v,2,1.05)}Dt(){return this.iconAtlas&&this.feaTexInfo[2]&&this.feaTexInfo[3]}Tt(t,n,e,r,i,s){const o=this.Dt()||Du(this.feaDash)||Du(this.symbol.lineDasharray),a=this.options.isTube;a&&(t=t.map((t=>new Au(t)))),this.overscaling=1;const u=this.options.EXTENT;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.prevVertex=null,this.symbol.lineGradientProperty&&n.properties&&Mr(n.properties.mapbox_clip_start)&&Mr(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 l=3===n.type&&!t.clipped;let h=t.length;for(;h>=2&&Uu(t[h-1],t[h-2]);)h--;let c=0;for(;c<h-1&&Uu(t[c],t[c+1]);)c++;if(h<(l?3:2))return;"bevel"===e&&(i=1.05);const f=this.overscaling<=16?15*u/(512*this.overscaling):0,d={vertexLength:0,primitiveLength:0,currentNormal:null};let p,y,m,g,v;this.e1=this.e2=-1,l&&(p=t[h-2],v=t[c].sub(p).T().D()),this.ensureDataCapacity(e,h,360,2);for(let n=c;n<h;n++){if(m=n===h-1?l?t[c+1]:void 0:t[n+1],m&&Uu(t[n],m))continue;v&&(g=v),p&&(y=p),p=t[n],m&&p.x===m.x&&p.y===m.y&&(p.x+=1e-4),v=m?m.sub(p).T().D():g,d.dir=y?p.sub(y).T():m.sub(p).T(),g=g||v,d.currentNormal=g;let u=g.add(v);0===u.x&&0===u.y||u.T();const b=g.x*v.x+g.y*v.y,w=u.x*v.x+u.y*v.y,M=0!==w?1/w:1/0,x=2*Math.sqrt(2-2*w),F=w<Su&&y&&m,k=g.x*v.y-g.y*v.x>0;if(!a&&F&&n>c){const t=p.dist(y);if(t>2*f){const n=p.sub(p.sub(y).S(f/t).j());n.z=p.z,this.updateDistance(y,n),this.addCurrentVertex(n,g,0,0,d),y=n}}const A=y&&m;d.middleVertex=A;let P=A?e:l?"butt":r;if(A&&"round"===P&&(M<s?P="miter":M<=2&&(P="fakeround")),"miter"===P&&M>i&&!a&&(P="bevel"),"bevel"===P&&(M>2&&(P="flipbevel"),M<i&&(P="miter")),y&&this.updateDistance(y,p),"miter"===P)a?(this.addCurrentVertex(p,g,0,0,d),d.dir=m.sub(p).T(),this.addCurrentVertex(p,v,0,0,d)):(u.S(M),this.addCurrentVertex(p,u,0,0,d),o&&(d.currentNormal=v,this.addCurrentVertex(p,u,0,0,d)));else if("flipbevel"===P){if(M>100)u=v.mult(-1);else{const t=M*g.add(v).mag()/g.sub(v).mag();u.D().S(t*(k?-1:1))}this.addCurrentVertex(p,u,0,0,d),this.addCurrentVertex(p,u.mult(-1),0,0,d)}else if("bevel"===P||"fakeround"===P){const t=-Math.sqrt(M*M-1),n=k?t:0,e=k?0:t;if(y&&this.addCurrentVertex(p,g,n,e,d),"fakeround"===P){const t=Math.round(180*x/Math.PI/20);for(let n=1;n<t;n++){let e=n/t;if(.5!==e){const t=e-.5;e+=e*t*(e-1)*((1.0904+b*(b*(3.55645-1.43519*b)-3.2452))*t*t+(.848013+b*(.215638*b-1.06021)))}const r=v.sub(g).S(e).F(g).T().S(k?-1:1);this.addHalfVertex(p,r.x,r.y,!1,k,0,d)}}m&&(d.currentNormal=v,this.addCurrentVertex(p,v,-n,-e,d))}else if("butt"===P)this.addCurrentVertex(p,u,0,0,d);else if("square"===P){const t=y?1:-1;this.addCurrentVertex(p,u,t,t,d)}else"round"===P&&(y&&(this.addCurrentVertex(p,g,0,0,d),this.addCurrentVertex(p,g,1,1,d,!0)),m&&(this.addCurrentVertex(p,v,-1,-1,d,!0),this.addCurrentVertex(p,v,0,0,d)));if(!a&&F&&n<h-1){const t=p.dist(m);if(t>2*f){const n=p.add(m.sub(p).S(f/t).j());n.z=p.z,this.updateDistance(p,n),this.addCurrentVertex(n,v,0,0,d),p=n}}}}ensureDataCapacity(t,n,e,r){const i="round"===t?Math.round(e/20)-1:0;super.ensureDataCapacity((6+i)*r,n)}addCurrentVertex(t,n,e,r,i,s=!1){const o=n.x+n.y*e,a=n.y-n.x*e,u=n.y*r-n.x,l=-n.y-n.x*r;let h=0,c=0;if(i.middleVertex){Ou.x=o,Ou.y=a,Cu.x=u,Cu.y=l;const t=i.currentNormal;if(h=ju(t,Ou),0===e&&0===r)c=-h;else{const n=Eu;n.x=t.x,n.y=t.y,n.S(-1),c=ju(n,Cu)}}this.addHalfVertex(t,o,a,s,!1,e,i,h),this.addHalfVertex(t,u,l,s,!0,-r,i,c),this.prevVertex&&Uu(t,this.prevVertex)||(this.prevVertex=t),this.distance>_u/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,n,e,r,i,s))}addHalfVertex({x:t,y:n,z:e},r,i,s,o,a,u,l){this.fillData(this.data,t,n,e||0,r,i,s,o,1*this.scaledDistance,l);const h=u.vertexLength++;this.e1>=0&&this.e2>=0&&(this.addElements(this.e1,this.e2,h),u.primitiveLength++),o?this.e2=h:this.e1=h}fillData(t,n,e,r,i,s,o,a,u,l){const{lineWidthFn:h,lineStrokeWidthFn:c,lineStrokeColorFn:f,lineColorFn:d,lineOpacityFn:p,lineDxFn:y,lineDyFn:m,linePatternAnimSpeedFn:g,linePatternGapFn:v}=this.st;this.fillPosition(t,n,e,r);let b=Pu*i;b=(Math.sign(b)||1)*((Math.floor(Math.abs(b))>>1<<1)+ +o);let w=Pu*s;w=(Math.sign(w)||1)*((Math.floor(Math.abs(w))>>1<<1)+ +a);let M=t.aExtrude.currentIndex;t.aExtrude[M++]=b,t.aExtrude[M++]=w,(this.iconAtlas||this.hasDasharray)&&(t.aExtrude[M++]=Pu*l),t.aExtrude.currentIndex=M,M=t.aLinesofar.currentIndex,t.aLinesofar[M++]=u,t.aLinesofar.currentIndex=M,h&&(M=t.aLineWidth.currentIndex,t.aLineWidth[M++]=Math.round(2*this.feaLineWidth),t.aLineWidth.currentIndex=M),c&&(M=t.aLineStrokeWidth.currentIndex,t.aLineStrokeWidth[M++]=Math.round(2*this.feaLineStrokeWidth),t.aLineStrokeWidth.currentIndex=M),d&&(M=t.aColor.currentIndex,t.aColor[M++]=this.feaColor[0],t.aColor[M++]=this.feaColor[1],t.aColor[M++]=this.feaColor[2],t.aColor[M++]=this.feaColor[3],t.aColor.currentIndex=M),f&&(M=t.aStrokeColor.currentIndex,t.aStrokeColor[M++]=this.feaStrokeColor[0],t.aStrokeColor[M++]=this.feaStrokeColor[1],t.aStrokeColor[M++]=this.feaStrokeColor[2],t.aStrokeColor[M++]=this.feaStrokeColor[3],t.aStrokeColor.currentIndex=M),p&&(M=t.aOpacity.currentIndex,t.aOpacity[M++]=this.feaOpacity,t.aOpacity.currentIndex=M),this.dasharrayFn&&(M=t.aDasharray.currentIndex,t.aDasharray[M++]=this.feaDash[0],t.aDasharray[M++]=this.feaDash[1],t.aDasharray[M++]=this.feaDash[2],t.aDasharray[M++]=this.feaDash[3],t.aDasharray.currentIndex=M),this.dashColorFn&&(M=t.aDashColor.currentIndex,t.aDashColor[M++]=this.feaDashColor[0],t.aDashColor[M++]=this.feaDashColor[1],t.aDashColor[M++]=this.feaDashColor[2],t.aDashColor[M++]=this.feaDashColor[3],t.aDashColor.currentIndex=M),this.iconAtlas&&(M=t.aTexInfo.currentIndex,t.aTexInfo[M++]=this.feaTexInfo[0],t.aTexInfo[M++]=this.feaTexInfo[1],t.aTexInfo[M++]=this.feaTexInfo[2],t.aTexInfo[M++]=this.feaTexInfo[3],t.aTexInfo.currentIndex=M),(y||m)&&(M=t.aLineDxDy.currentIndex,t.aLineDxDy[M++]=this.feaLineDx||0,t.aLineDxDy[M++]=this.feaLineDy||0,t.aLineDxDy.currentIndex=M),(g||v)&&(M=t.aLinePattern.currentIndex,t.aLinePattern[M++]=127*(this.feaPatternAnimSpeed||0),t.aLinePattern[M++]=10*(this.feaLinePatternGap||0),t.aLinePattern.currentIndex=M),this.maxPos=Math.max(this.maxPos,Math.abs(n)+1,Math.abs(e)+1)}addElements(t,n,e){super.addElements(this.offset+t,this.offset+n,this.offset+e)}zt(t){const n=this.options.EXTENT,e=this.elements;for(let r=0;r<e.length;r+=3)if(n===1/0||!Tu(this.data.aPosition,e[r],e[r+1],3,n)&&!Tu(this.data.aPosition,e[r+1],e[r+2],3,n)){let n=t.currentIndex;t[n++]=e[r],t[n++]=e[r+1],t[n++]=e[r+2],t.currentIndex=n}}jt(t){if(t.length<=1)return t;const n=[],e=this.options.EXTENT;let r,i=!0;for(r=0;r<t.length-1;r++){const s=$u(t[r],t[r+1],e);s&&i||(n.push(t[r]),i=s)}return i||n.push(t[r]),n}updateDistance(t,n){if(this.options.isTube){const e=t.dist(n),r=Or(this.options)*(n.z-t.z);this.distance+=Math.sqrt(e*e+r*r)}else this.distance+=t.dist(n);this.updateScaledDistance()}updateScaledDistance(){this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(_u-1):this.distance}}function $u(t,n,e){return e!==1/0&&(t.x<0&&n.x<0||t.x>e&&n.x>e||t.y<0&&n.y<0||t.y>e&&n.y>e)}function Tu(t,n,e,r,i){if(i===1/0)return!1;const s=Math.floor(.5*t[n*r]),o=Math.floor(.5*t[n*r+1]),a=Math.floor(.5*t[e*r]),u=Math.floor(.5*t[e*r+1]);return s===a&&(s<0||s>i)&&o!==u||o===u&&(o<0||o>i)&&s!==a}function Du(t){if(!Array.isArray(t))return!1;for(let n=0;n<t.length;n++)if(t[n])return!0;return!1}const zu=new dt(0,0);function ju(t,n){const e=t.mag(),r=n.mag(),i=t.angleTo(zu),s=n.angleTo(zu);return Math.sign(s-i)*Math.sqrt(r*r-e*e)}function Uu(t,n){return t.equals(n)&&t.z===n.z}class Nu extends Iu{constructor(t,n,e){super(t,n,e),this.Ut=e.altitudeProperty}getFormat(){const{lineColorFn:t,lineWidthFn:n}=this.st,e=[{type:this.maxPosZ>=Math.pow(2,15)?Float32Array: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&&e.push({type:Uint8Array,width:4,name:"aColor"}),n&&e.push({type:Uint8Array,width:1,name:"aLineWidth"}),this.Ut&&e.push({type:Float32Array,width:1,name:"aLineHeight"}),e}placeVector(t){const n=t.feature;if(this.Ut){const{altitudeScale:t,altitudeProperty:e,defaultAltitude:r,heightProperty:i,defaultHeight:s,minHeightProperty:o}=this.options,{altitude:a,height:u}=ir(n,t,e,r,i,s,o);this.feaAltitude=a,this.feaMinHeight=(a-u)/a*32767,a>this.maxAltitude&&(this.maxAltitude=a)}return super.placeVector(t)}needAltitudeAttribute(){return!1}Tt(t,n,e,r,i,s){const o=this.data.aPosition.getLength()/3;super.Tt(t,n,e,r,i,s);const a=this.data.aPosition.getLength()/3,u=this.data.aPosition.getLength()/3-this.offset;if(3!==n.type&&u>0&&!1!==this.options.side){const t=!1!==this.options.top?1:0,n=t+4;let e=this.data.aPosition.getLength()/3;for(const t in this.data){const n=this.data[t],r=n.getLength()/e;let i=n.currentIndex;for(let t=0;t<r;t++)n[i++]=n[o*r+3*r+t];n.currentIndex=i}e=this.data.aPosition.getLength()/3;for(const t in this.data){const r=this.data[t],i=r.getLength()/e;let s=r.currentIndex;for(let t=0;t<i;t++)r[s++]=r[o*i+i*n+t];r.currentIndex=s}e=this.data.aPosition.getLength()/3;for(const t in this.data){const r=this.data[t],i=r.getLength()/e;let s=r.currentIndex;for(let t=0;t<i;t++)r[s++]=r[o*i+i*(n+3)+t];r.currentIndex=s}super.addElements(t+1,u+1,u),super.addElements(u,u+1,u+2);const r=this.data.aPosition.getLength()/3-this.offset;e=this.data.aPosition.getLength()/3;for(const t in this.data){const n=this.data[t],r=n.getLength()/e;let i=n.currentIndex;for(let t=0;t<r;t++)n[i++]=n[a*r-r+t];n.currentIndex=i}e=this.data.aPosition.getLength()/3;for(const t in this.data){const r=this.data[t],i=r.getLength()/e;let s=r.currentIndex;for(let t=0;t<i;t++)r[s++]=r[a*i-n*i-i+t];r.currentIndex=s}e=this.data.aPosition.getLength()/3;for(const t in this.data){const r=this.data[t],i=r.getLength()/e;let s=r.currentIndex;for(let t=0;t<i;t++)r[s++]=r[a*i-n*i-3*i+t];r.currentIndex=s}super.addElements(r,u-3,r+1),super.addElements(u-3,r+2,r+1)}}fillData(t,n,e,r,i,s,o,a,u){const l=!1!==this.options.top,h=!1!==this.options.side,c=this.feaLineWidth||this.symbol.lineWidth/2*(this.options.EXTENT/this.options.tileSize),f=Pu*i,d=Pu*s,p=c*i+n,y=c*s+e;this.Nt(t,n,e,i,s,o,a,u,p,y,f,d),h&&(l&&this.Nt(t,n,e,i,s,o,a,u,p,y,f,d),this.Nt(t,n,e,i,s,o,a,u,p,y,f,d),this.Lt(t,n,e,i,s,o,a,u,p,y,f,d),this.Lt(t,n,e,i,s,o,a,u,p,y,f,d)),this.maxPos=Math.max(this.maxPos,Math.abs(n),Math.abs(e))}Nt(t,n,e,r,i,s,o,a,u,l,h,c){const{lineColorFn:f,lineWidthFn:d}=this.st;let p=t.aPosition.currentIndex;t.aPosition[p++]=n,t.aPosition[p++]=e,t.aPosition[p++]=32767,t.aPosition.currentIndex=p,p=t.aLinesofar.currentIndex,t.aLinesofar[p++]=a,t.aLinesofar.currentIndex=p,p=t.aUp.currentIndex,t.aUp[p++]=+o,t.aUp.currentIndex=p,p=t.aExtrudedPosition.currentIndex,t.aExtrudedPosition[p++]=u,t.aExtrudedPosition[p++]=l,t.aExtrudedPosition[p++]=1,t.aExtrudedPosition.currentIndex=p,p=t.aExtrude.currentIndex,t.aExtrude[p++]=h,t.aExtrude[p++]=c,t.aExtrude.push(h,c),f&&(p=t.aColor.currentIndex,t.aColor[p++]=this.feaColor[0],t.aColor[p++]=this.feaColor[1],t.aColor[p++]=this.feaColor[2],t.aColor[p++]=this.feaColor[3],t.aColor.currentIndex=p),d&&(p=t.aLineWidth.currentIndex,t.aLineWidth[p++]=Math.round(2*this.feaLineWidth),t.aLineWidth.currentIndex=p),this.Ut&&(p=t.aLineHeight.currentIndex,t.aLineHeight[p++]=this.feaAltitude,t.aLineHeight.currentIndex=p)}Lt(t,n,e,r,i,s,o,a,u,l,h,c){const{lineColorFn:f,lineWidthFn:d}=this.st;let p=t.aPosition.currentIndex;t.aPosition[p++]=n,t.aPosition[p++]=e,t.aPosition[p++]=this.feaMinHeight||0,t.aPosition.currentIndex=p,p=t.aLinesofar.currentIndex,t.aLinesofar[p++]=a,t.aLinesofar.currentIndex=p,p=t.aUp.currentIndex,t.aUp[p++]=+o,t.aUp.currentIndex=p,p=t.aExtrudedPosition.currentIndex,t.aExtrudedPosition[p++]=u,t.aExtrudedPosition[p++]=l,t.aExtrudedPosition[p++]=1,t.aExtrudedPosition.currentIndex=p,p=t.aExtrude.currentIndex,t.aExtrude[p++]=h,t.aExtrude[p++]=c,t.aExtrude.push(h,c),f&&(p=t.aColor.currentIndex,t.aColor[p++]=this.feaColor[0],t.aColor[p++]=this.feaColor[1],t.aColor[p++]=this.feaColor[2],t.aColor[p++]=this.feaColor[3],t.aColor.currentIndex=p),d&&(p=t.aLineWidth.currentIndex,t.aLineWidth[p++]=Math.round(2*this.feaLineWidth),t.aLineWidth.currentIndex=p),this.Ut&&(p=t.aLineHeight.currentIndex,t.aLineHeight[p++]=this.feaAltitude,t.aLineHeight.currentIndex=p)}addElements(t,n,e){const r=!1!==this.options.top,i=!1!==this.options.side,s=(r?1:0)+(i?4:0);if(t*=s,n*=s,this.data.aUp[this.offset+(e*=s)+4]){if(r&&super.addElements(n,t,e),i){const t=r?1:0;super.addElements(n+t,e+t,e+t+2),super.addElements(n+t+1,e+t+1+2,n+t+1+2)}}else if(r&&super.addElements(t,e,n),i){const n=r?1:0;super.addElements(t+n,t+n+2,e+n),super.addElements(t+n+1+2,e+n+1+2,e+n+1)}}createDataPack(t,n){this.maxAltitude=0;const e=super.createDataPack(t,n);if(!e)return e;const{data:r,indices:i}=e;this.getFormat().reduce(((t,n)=>(t[n.name]={size:n.width},t)),{}).aPickingId={size:1};const{aExtrudedPosition:s,aPosition:o,aLinesofar:a,aUp:u,aExtrude:l,aColor:h,aLineHeight:c,aLineWidth:f}=r,d={},p=Jn(s,i);let y,m=!0;for(let t=0;t<p.length;t++)p[t]=-p[t],p[t]%1!=0&&(m=!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)&&(y=function(t,n,e){const r=[];for(let i=0;i<t.length;i+=3){const t=n[i/3];r.push(t/256,e[i/3]?1:0)}return r}(s,a,u)),d.aPosition=o,y&&(d.aTexCoord0=new Float32Array(y)),d.aNormal=m?new Int8Array(p):new Float32Array(p),d.aPickingId=r.aPickingId,d.aExtrude=l,h&&(d.aColor=h),f&&(d.aLineWidth=f),c){const t=yr(this.maxAltitude);d.aLineHeight=new t(c)}const g=[];for(const t in d)g.push(d[t].buffer);return e.data=d,e.buffers=g,e}}const Lu=Math.pow(2,16)/1;class Ru extends Pa{getFormat(){return[...this.getPositionFormat()]}placeVector(t){const n=t.feature,e=3===n.type,r=n.geometry,i=this.elements;e&&(this.elements=this.dt.get());const s=this.needAltitudeAttribute()?2:3;for(let t=0;t<r.length;t++)this.offset=this.data.aPosition.getLength()/s,this.Tt(r[t],n),e&&(this.zt(i),this.elements=this.dt.get());e&&(this.elements=i)}Tt(t,n){const e=3===n.type;let r=t.length;for(;r>=2&&t[r-1].equals(t[r-2]);)r--;let i,s,o,a=0;for(;a<r-1&&t[a].equals(t[a+1]);)a++;if(!(r<(e?3:2))){this.distance=0,this.vertexLength=0,this.primitiveLength=0,this.e1=this.e2=this.e3=-1,e&&(i=t[r-2]);for(let n=a;n<r;n++)o=e&&n===r-1?t[a+1]:t[n+1],o&&t[n].equals(o)||(i&&(s=i),i=t[n],s&&(this.distance+=i.dist(s)),this.addCurrentVertex(i,this.distance))}}addCurrentVertex(t,n){const e=this.vertexLength++;this.addLineVertex(this.data,t,n),e>=1&&this.addElements(e-1,e),n>Lu&&(this.distance=0,this.addCurrentVertex(t,this.distance))}addLineVertex(t,n){this.fillPosition(t,n.x,n.y,n.z||0),this.maxPos=Math.max(this.maxPos,Math.abs(n.x),Math.abs(n.y))}addElements(t,n){this.maxIndex=Math.max(this.maxIndex,this.offset+t,this.offset+n);let e=this.elements.currentIndex;this.elements[e++]=this.offset+t,this.elements[e++]=this.offset+n,this.elements.currentIndex=e}zt(t){const n=this.options.EXTENT,e=this.elements,r=e.getLength();for(let i=0;i<r;i+=2)if(!er(this.data.aPosition,e[i],e[i+1],3,n)){let n=t.currentIndex;t[n++]=e[i],t[n++]=e[i+1],t.currentIndex=n}}}const Vu=45*Math.PI/100;class Hu extends Pa{getFormat(){const{markerFillFn:t}=this.st;let n;return n="line"===this.symbol.markerRotationAlignment?[...this.getPositionFormat(),{type:Float32Array,width:1,name:"aXYRotation"},{type:Float32Array,width:1,name:"aZRotation"}]:[...this.getPositionFormat()],t&&n.push({type:Uint8Array,width:4,name:"aColor"}),n}placeVector(t){const n=t.feature.properties,{markerFillFn:e}=this.st;let r;e&&(r=e(this.options.zoom,n)||[255,255,255,255],y(r)?(this.dynamicAttrs.aColor=1,r=[0,0,0,0]):r=Ir([],r));const i=this.data,s="line"===this.symbol.markerRotationAlignment,o=this.Ot(t,this.symbol.markerSpacing||250,this.symbol.markerPlacement||"point",s);for(let t=0;t<o.length;t++){const n=o[t];if(this.fillPosition(this.data,n.x,n.y,n.z),s){let t=i.aXYRotation.currentIndex;i.aXYRotation[t++]=n.xyRotation||0,i.aXYRotation.currentIndex=t,t=i.aZRotation.currentIndex,i.aZRotation[t++]=n.zRotation||0,i.aZRotation.currentIndex=t}if(r){let t=i.aColor.currentIndex;i.aColor[t++]=r[0],i.aColor[t++]=r[1],i.aColor[t++]=r[2],i.aColor[t++]=r[3],i.aColor.currentIndex=t}const e=Math.max(Math.abs(n.x),Math.abs(n.y));e>this.maxPos&&(this.maxPos=e)}}Ot(t,n,e,r){const i=t.feature,s=this.options.EXTENT;if("line"===e){const t=[];let e=i.geometry;s&&(e=ou(i.geometry,0,0,s,s));for(let r=0;r<e.length;r++){const i=lu(e[r],n,Vu,null,0,24,1,1,s||1/0);t.push.apply(t,i)}return t}return bu(i,e,s,r,this.options.altitudeToTileScale)}hasElements(){return!1}}\n/*!\n * from @turf/bboxClip\n * https://github.com/Turfjs/turf\n * MIT LICENSE\n */const qu=[],Gu=[];function Ju(t,n){var e,r,i,s,o,a,u;for(r=1;r<=8;r*=2){for(e=[],s=!(Bu(i=t[t.length-1],n)&r),o=0;o<t.length;o++){if((u=!(Bu(a=t[o],n)&r))!==s){const t=Wu(i,a,r,n);e.push(void 0!==a.x?new dt(t[0],t[1]):t)}u&&e.push(a),i=a,s=u}if(!(t=e).length)break}return e}function Wu(t,n,e,r){return qu[0]=void 0===t.x?t[0]:t.x,qu[1]=void 0===t.y?t[1]:t.y,t=qu,Gu[0]=void 0===n.x?n[0]:n.x,Gu[1]=void 0===n.y?n[1]:n.y,n=Gu,8&e?[t[0]+(n[0]-t[0])*(r[3]-t[1])/(n[1]-t[1]),r[3]]:4&e?[t[0]+(n[0]-t[0])*(r[1]-t[1])/(n[1]-t[1]),r[1]]:2&e?[r[2],t[1]+(n[1]-t[1])*(r[2]-t[0])/(n[0]-t[0])]:1&e?[r[0],t[1]+(n[1]-t[1])*(r[0]-t[0])/(n[0]-t[0])]:null}function Bu(t,n){qu[0]=void 0===t.x?t[0]:t.x,qu[1]=void 0===t.y?t[1]:t.y;var e=0;return(t=qu)[0]<n[0]?e|=1:t[0]>n[2]&&(e|=2),t[1]<n[1]?e|=4:t[1]>n[3]&&(e|=8),e}const Xu=[0,0,0,0],Yu=-9999999;class Ku extends Pa{constructor(...t){super(...t),this.lineElements=[]}createStyledVector(t,n,e,r,i){const s=new zr(t,n,e,r),o=s.getPolygonResource();return!this.options.atlas&&o&&(i[o]=[0,0]),s}getFormat(){const t=[...this.getPositionFormat()],{polygonFillFn:n,polygonOpacityFn:e,uvScaleFn:r,uvOffsetFn:i,polygonPatternUVFn:s}=this.st;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"}),e&&t.push({type:Uint8Array,width:1,name:"aOpacity"}),r&&t.push({type:Uint16Array,width:2,name:"aUVScale"}),i&&t.push({type:Uint8Array,width:2,name:"aUVOffset"}),s&&t.push({type:Float32Array,width:2,name:"aTexCoord"}),t}placeVector(t,n){const e=t.feature;this.Rt(e.geometry,e,n)}Rt(t,n){let e,r,i,s;const{polygonFillFn:o,polygonOpacityFn:a,uvScaleFn:u,uvOffsetFn:l,uvOffsetInMeterFn:h,polygonPatternUVFn:c}=this.st,f=n.properties;o&&(e=o(this.options.zoom,f)||ze([],255,255,255,255),y(e)?(this.dynamicAttrs.aColor=1,e=Xu):e=Ir([],e)),a&&(r=a(this.options.zoom,f),y(r)?(this.dynamicAttrs.aOpacity=1,r=255):(wr(r)&&(r=1),r*=255)),u&&(i=u(this.options.zoom,f),y(i)?(i=[255,255],this.dynamicAttrs.aUVScale=1):(wr(i)&&(i=[1,1]),i=[255*i[0],255*i[1]])),l&&(h&&h(null,f)?s=[0,0]:(s=l(this.options.zoom,f),y(s)?(s=[0,0],this.dynamicAttrs.aUVOffset=1):(wr(s)&&(s=[0,0]),s=[255*s[0],255*s[1]])));const d=!!this.iconAtlas,p=fu(t,500),m=[0,0],g=[0,0];if(d){const{polygonPatternFileFn:t}=this.st,n=t?t(null,f):this.symbol.polygonPatternFile;if(this.iconAtlas.glyphMap[n]){const t=this.iconAtlas.positions[n],e=!lr(t.displaySize[0])||!lr(t.displaySize[1]);m[0]=t.tl[0]+(e?1:0),m[1]=t.tl[1]+(e?1:0),g[0]=t.displaySize[0]-1-(e?2:0),g[1]=t.displaySize[1]-1-(e?2:0)}}let v,b=0;c&&(v=c(this.options.zoom,f));const w=this.needAltitudeAttribute()?2:3,M=[-1,-1,n.extent+1,n.extent+1],x=this.Vt=this.Vt||this.dt.getProxy(),F=this.Ht=this.Ht||this.dt.getProxy();for(let t=0;t<p.length;t++){const n=p[t],o=this.data.aPosition.getLength()/w;x.setLength(0),F.setLength(0);for(let t=0;t<n.length;t++){let o=n[t];if(this.options.EXTENT!==1/0&&0===this.maxPosZ&&(o=Ju(o,M)),0===o.length)continue;0!==t&&F.push(x.length/3),this.ensureDataCapacity(o.length);const a=this.data;for(let t=0;t<o.length;t++){const n=o[t].x,u=o[t].y,l=o[t].z||0;if(this.fillPosition(this.data,n,u,l),d){let t=a.aTexInfo.currentIndex;a.aTexInfo[t++]=m[0],a.aTexInfo[t++]=m[1],a.aTexInfo[t++]=g[0],a.aTexInfo[t++]=g[1],a.aTexInfo.currentIndex=t}if(void 0!==e){let t=a.aColor.currentIndex;a.aColor[t++]=e[0],a.aColor[t++]=e[1],a.aColor[t++]=e[2],a.aColor[t++]=e[3],a.aColor.currentIndex=t}if(void 0!==r){let t=a.aOpacity.currentIndex;a.aOpacity[t++]=r,a.aOpacity.currentIndex=t}if(void 0!==i){let t=a.aUVScale.currentIndex;a.aUVScale[t++]=i[0],a.aUVScale[t++]=i[1],a.aUVScale.currentIndex=t}if(void 0!==s){let t=a.aUVOffset.currentIndex;a.aUVOffset[t++]=s[0],a.aUVOffset[t++]=s[1],a.aUVOffset.currentIndex=t}if(c){let t=a.aTexCoord.currentIndex;if(v){const n=wr(v[2*b])?v[0]:v[2*b],e=wr(v[2*b]+1)?v[1]:v[2*b+1];a.aTexCoord[t++]=n,a.aTexCoord[t++]=e}else a.aTexCoord[t++]=Yu,a.aTexCoord[t++]=Yu;a.aTexCoord.currentIndex=t,b++}const h=Math.abs(n),f=Math.abs(u);h>this.maxPos&&(this.maxPos=h),f>this.maxPos&&(this.maxPos=f),x.push(n,u,l)}}let a=Ce(x,F,3);if(x.length&&!a.length){const t=[];for(let n=0;n<x.length;n+=3)t[n]=x[n],t[n+1]=x[n+2],t[n+2]=x[n+1];if(a=Ce(t,F,3),!a.length){for(let n=0;n<x.length;n+=3)t[n]=x[n+1],t[n+1]=x[n+2],t[n+2]=x[n];a=Ce(t,F,3)}}for(let t=0;t<a.length;t+=3)this.addElements(o+a[t],o+a[t+1],o+a[t+2])}}ensureDataCapacity(t){super.ensureDataCapacity(1,t)}}const Zu=[{type:Int16Array,width:3,name:"aPosition"}];class Qu extends Pa{getFormat(){return Zu}placeVector(t,n){const e=this.Ot(t,n);if(0===e.length)return;const r=this.data,i=this.getAltitude(t.feature.properties);let s=r.aPosition.getLength()/Zu[0].width;for(let t=0;t<e.length;t++){const n=e[t];r.aPosition.push(2*n.x+0,2*n.y+0,i),r.aPosition.push(2*n.x+1,2*n.y+0,i),r.aPosition.push(2*n.x+1,2*n.y+1,i),r.aPosition.push(2*n.x+0,2*n.y+1,i),this.addElements(s,s+1,s+2),this.addElements(s,s+2,s+3),s+=4;const o=Math.max(Math.abs(2*n.x+1),Math.abs(2*n.y+1));o>this.maxPos&&(this.maxPos=o)}}Ot(t,n){const{feature:e,symbol:r}=t,i=this.$t(t,r),s=e.properties,{markerSpacingFn:o}=this.st,a=((o?o(null,s):r.markerSpacing)||250)*n;return vu(t,null,null,n,this.options.EXTENT,i,a)}$t(t,n){return this.st.markerPlacementFn?this.st.markerPlacementFn(this.options.zoom,t.feature.properties):n.markerPlacement}}class tl extends Iu{constructor(t,n,e){(n=br({},n)).lineJoin="miter",n.lineCap="butt",super(t,n,e),this.options.radialSegments%2==1&&this.options.radialSegments--}getFormat(){const{lineWidthFn:t,lineColorFn:n,lineOpacityFn:e,linePatternAnimSpeedFn:r,linePatternGapFn:i}=this.st,s=[...this.getPositionFormat(),{type:Int8Array,width:4,name:"aTubeNormal"},{type:this.options.positionType||Uint16Array,width:1,name:"aLinesofar"}];if(this.iconAtlas){s.push({type:Int8Array,width:1,name:"aNormalDistance"});const t=this.getIconAtlasMaxValue();s.push({type:t>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return t&&s.push({type:Uint16Array,width:1,name:"aLineWidth"}),n&&s.push({type:Uint8Array,width:4,name:"aColor"}),e&&s.push({type:Uint8Array,width:1,name:"aOpacity"}),r&&s.push({type:Int8Array,width:1,name:"aLinePatternAnimSpeed"}),i&&s.push({type:Int8Array,width:1,name:"aLinePatternGap"}),s}ensureDataCapacity(t,n,e,r){return super.ensureDataCapacity(t,n,e,r*(this.options.radialSegments/2))}addHalfVertex(t,n,e,r,i,s,o,a){const{x:u,y:l,z:h}=t,c=1*this.scaledDistance,f=this.options.radialSegments/2,{x:d,y:p,z:y}=o.dir,m=function(t,n,e,r,i,s,o,a){Ie(nl,e,r,i),Ie(el,s,o,0),Te(rl,nl,el),$e(el,el),$e(rl,rl),il[n]||(il[n]=[]);const u=il[n];for(var l=0;l<n;l++){const t=Math.PI*l/n,e=1-Math.abs(t-0)/(Math.PI/2);u[l]=u[l]||[],sl(el,rl,u[l],1,t,e*(a?-1:1))}return u}(0,f,d,p,y,n,e,i);this.prevVertex&&this.fillTubeElements(i),this.fillData(this.data,u,l,h||0,m,i,c,a)}fillTubeElements(t){const n=this.options.radialSegments/2,e=this.needAltitudeAttribute()?2:3,r=this.data.aPosition.getLength()/e;for(let e=0;e<n;e++){const i=e+r-2*n;let s,o;e===n-1&&t?(s=e+r-2*n+1,o=e+r-2*n-2*n+1):(s=e+r+1,o=e+r+1-2*n),super.addElements(e+r-this.offset,s-this.offset,i-this.offset),super.addElements(i-this.offset,s-this.offset,o-this.offset)}}fillData(t,n,e,r,i,s,o,a){const{lineWidthFn:u,lineColorFn:l,lineOpacityFn:h,linePatternAnimSpeedFn:c,linePatternGapFn:f}=this.st,d=i.length;for(let s=0;s<d;s++){this.fillPosition(t,n,e,r),Ue(i[s],i[s],Pu);let d=t.aTubeNormal.currentIndex;for(let n=0;n<i[s].length;n++)t.aTubeNormal[d++]=i[s][n];if(t.aTubeNormal.currentIndex=d,d=t.aLinesofar.currentIndex,t.aLinesofar[d++]=o,t.aLinesofar.currentIndex=d,this.iconAtlas&&(d=t.aNormalDistance.currentIndex,t.aNormalDistance[d++]=Pu*a,t.aNormalDistance.currentIndex=d,d=t.aTexInfo.currentIndex,t.aTexInfo[d++]=this.feaTexInfo[0],t.aTexInfo[d++]=this.feaTexInfo[1],t.aTexInfo[d++]=this.feaTexInfo[2],t.aTexInfo[d++]=this.feaTexInfo[3],t.aTexInfo.currentIndex=d),u){const n=Cr(this.options.metric);let e=this.feaLineWidth*n;isNaN(e)&&(e=0),d=t.aLineWidth.currentIndex,t.aLineWidth[d++]=Math.round(e),t.aLineWidth.currentIndex=d}l&&(d=t.aColor.currentIndex,t.aColor[d++]=this.feaColor[0],t.aColor[d++]=this.feaColor[1],t.aColor[d++]=this.feaColor[2],t.aColor[d++]=this.feaColor[3],t.aColor.currentIndex=d),h&&(d=t.aOpacity.currentIndex,t.aOpacity[d++]=this.feaOpacity,t.aOpacity.currentIndex=d),c&&(d=t.aLinePatternAnimSpeed.currentIndex,t.aLinePatternAnimSpeed[d++]=127*(this.feaPatternAnimSpeed||0),t.aLinePatternAnimSpeed.currentIndex=d),f&&(d=t.aLinePatternGap.currentIndex,t.aLinePatternGap[d++]=10*(this.feaLinePatternGap||0),t.aLinePatternGap.currentIndex=d)}this.maxPos=Math.max(this.maxPos,Math.abs(n)+1,Math.abs(e)+1)}createDataPack(t,n){const e=super.createDataPack(t,n);return e&&(e.is2D=!1),e}}const nl=[],el=[],rl=[],il={};function sl(t,n,e,r,i,s){return ze(e,r*(Math.cos(i)*t[0]+Math.sin(i)*n[0]),r*(Math.cos(i)*t[1]+Math.sin(i)*n[1]),r*(Math.cos(i)*t[2]+Math.sin(i)*n[2]),s),e}class ol extends tl{addHalfVertex(t,n,e,r,i,s,o,a){const{x:u,y:l,z:h}=t,c=1*this.scaledDistance,{x:f,y:d,z:p}=o.dir,y=function(t,n,e,r,i,s,o,a){Ie(ul,e,r,i),Ie(ll,s,o,0),Te(hl,ul,ll),$e(ll,ll),$e(hl,hl),Le(al,t,n);const u=Ve(al)/t,l=Math.atan(n/t);let h=Math.PI/2+(Math.PI/2-l);return cl[0]||(cl[0]=[]),sl(ll,hl,cl[0],u,h,a?1:-1),h+=2*l,cl[1]||(cl[1]=[]),sl(ll,hl,cl[1],u,h,a?1:-1),cl}(this.feaLineWidth,this.feaLineHeight,f,d,p,n,e,i);this.prevVertex&&this.fillTubeElements(i),this.fillData(this.data,u,l,h||0,y,i,c,a)}ensureDataCapacity(t,n,e,r){return super.ensureDataCapacity(t,n,e,2*r)}}const al=[],ul=[],ll=[],hl=[],cl=[];class fl{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}}\n/*!\n * based on @mapbox/tiny-sdf\n * https://github.com/mapbox/tiny-sdf\n * @License BSD 2-Clause\n */var dl=1e20;function pl(t,n,e,r,i,s,o){this.fontSize=t||24,this.buffer=void 0===n?3:n,this.cutoff=r||.25,this.fontFamily=i||"sans-serif",this.fontWeight=s||"normal",this.fontStyle=o||"normal",this.radius=e||8;var a=this.size=this.fontSize+2*this.buffer;this.canvas="undefined"==typeof document?new OffscreenCanvas(a,a):document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d",{willReadFrequently:!0}),this.ctx.font=this.fontStyle+" "+this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a),this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function yl(t,n,e,r,i,s){for(var o=0;o<n;o++)ml(t,o,n,e,r,i,s);for(var a=0;a<e;a++)ml(t,a*n,1,n,r,i,s)}function ml(t,n,e,r,i,s,o){var a,u,l,h;for(s[0]=0,o[0]=-dl,o[1]=dl,a=0;a<r;a++)i[a]=t[n+a*e];for(a=1,u=0,l=0;a<r;a++){do{l=(i[a]-i[h=s[u]]+a*a-h*h)/(a-h)/2}while(l<=o[u]&&--u>-1);s[++u]=a,o[u]=l,o[u+1]=dl}for(a=0,u=0;a<r;a++){for(;o[u+1]<a;)u++;t[n+a*e]=i[h=s[u]]+(a-h)*(a-h)}}pl.prototype.draw=function(t,n,e){this.ctx.clearRect(0,0,this.size,this.size),this.ctx.textBaseline="top",this.ctx.fillText(t,this.buffer,this.buffer);for(var r=this.ctx.getImageData(0,0,n,e),i=new Uint8ClampedArray(n*e),s=0;s<n*e;s++){var o=r.data[4*s+3]/255;this.gridOuter[s]=1===o?0:0===o?dl:Math.pow(Math.max(0,.5-o),2),this.gridInner[s]=1===o?dl:0===o?0:Math.pow(Math.max(0,o-.5),2)}for(yl(this.gridOuter,n,e,this.f,this.v,this.z),yl(this.gridInner,n,e,this.f,this.v,this.z),s=0;s<n*e;s++){var a=Math.sqrt(this.gridOuter[s])-Math.sqrt(this.gridInner[s]);i[s]=Math.round(255-255*(a/this.radius+this.cutoff))}return i};let gl=0;class vl{constructor(t,n=15,e,r){this.entries={},this.qt={},this.Gt=new fl(2048,(function(){})),this.Jt=t,this.Wt=n,this.Bt=e,this.Xt=r}Yt(t){return t&&t.indexOf("{stack}")>=0&&t.indexOf("{range}")>0}getGlyphs(t,n){if(!t||!Object.keys(t).length)return void n(null,{glyphs:null});if(this.Yt(this.Xt))return void this.Kt(t,n);const e=this.entries,r=t.options;let i=!0;r&&(i=!1!==r.isCharsCompact),i=i||this.Bt;const s=(r,s,a)=>{let u=0,l=0;for(const n in t)if("options"!==n){e[n]=e[n]||{},s[n]=s[n]||{};for(const h in t[n]){if(l++,l<=r)continue;const t=i&&!Na(+h),c=n+":"+h+":"+t;let f;if(this.Gt.has(c)?f=this.Gt.get(c):(f=this.Zt(e[n],n,h,t),this.Gt.add(c,f),u++),f=bl(f),s[n][h]=f,a.push(f.bitmap.data.buffer),this.Jt&&u>this.Wt)return void this.Jt(o(l,s,a))}}n(null,{glyphs:s,buffers:a})};function o(t,n,e){return()=>{s(t,n,e)}}s(0,{},[])}Kt(t,n){const e=[];for(const n in t)for(const r of t[n])e.push(this.Qt(n,r));Promise.all(e).then((t=>{n(null,t)}))}Qt(t,n){let e=this.entries[t];e||(e=this.entries[t]={glyphs:{},requests:{},ranges:{}});let r=e.glyphs[n];if(r)return Promise.resolve({font:t,charCode:n,glyph:r});const i=Math.floor(n/256);if(256*i>65535)return Promise.reject(new Error("glyphs > 65535 not supported"));e.requests[i].push(((t,n)=>{if(t)return t;n&&fnCallback(null,{stack:stack,id:id,glyph:n.glyphs[id]||null})}))}Zt(t,n,e,r){const i=n;let s=t.tinySDF;const o=r?-1:2;if(!s){let n="400";/bolder/i.test(i)?n="1000":/bold/i.test(i)?n="900":/medium/i.test(i)?n="500":/light/i.test(i)&&(n="200"),s=t.tinySDF=new pl(24,2,8,.25,i,n)}const a=String.fromCodePoint(e),u=s.ctx.measureText(a),l=Math.round(u.width),h=s.draw(a,l+4,28);if(gl<4){const t="undefined"!=typeof document&&document.getElementById("sdf-debug-"+gl++);t&&(t.width=l+4,t.height=s.canvas.height,t.getContext("2d").drawImage(s.canvas,0,0))}return{charCode:e,bitmap:{width:l+4,height:28,data:h},metrics:{width:l,height:24,left:1,top:-2,advance:l+2+o}}}}function bl(t){const n={width:t.bitmap.width,height:t.bitmap.height,data:new Uint8ClampedArray(t.bitmap.data)};return{charCode:t.charCode,bitmap:n,metrics:br({},t.metrics)}}var wl=Object.freeze({__proto__:null,calculateSignedArea:nr,clipPolygon:Ju,convertGeometry:vr,convertRTLText:eu,generatePickingIndiceIndex:ur,getFeaAltitudeAndHeight:ir,getIndexArrayType:pr,getPosArrayType:yr,getUnsignedArrayType:mr,packPosition:jr,unpackPosition:function(t,n,e,r){const i=(Math.sign(n)||1)*(Math.abs(n)%Ur),s=(Math.sign(e)||1)*(Math.abs(e)%Ur),o=Math.floor(Math.abs(n)/Ur),a=Math.floor(Math.abs(e)/Ur);return t[0]=i,t[1]=s,t[2]=Math.sign(r+1e-5)*(2*o+a)*Nr+r,t}});var Ml={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,n,e,r,i){var s,o,a=8*i-r-1,u=(1<<a)-1,l=u>>1,h=-7,c=e?i-1:0,f=e?-1:1,d=t[n+c];for(c+=f,s=d&(1<<-h)-1,d>>=-h,h+=a;h>0;s=256*s+t[n+c],c+=f,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=r;h>0;o=256*o+t[n+c],c+=f,h-=8);if(0===s)s=1-l;else{if(s===u)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),s-=l}return(d?-1:1)*o*Math.pow(2,s-r)},write:function(t,n,e,r,i,s){var o,a,u,l=8*s-i-1,h=(1<<l)-1,c=h>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:s-1,p=r?1:-1,y=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=h):(o=Math.floor(Math.log(n)/Math.LN2),n*(u=Math.pow(2,-o))<1&&(o--,u*=2),(n+=o+c>=1?f/u:f*Math.pow(2,1-c))*u>=2&&(o++,u/=2),o+c>=h?(a=0,o=h):o+c>=1?(a=(n*u-1)*Math.pow(2,i),o+=c):(a=n*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;t[e+d]=255&a,d+=p,a/=256,i-=8);for(o=o<<i|a,l+=i;l>0;t[e+d]=255&o,d+=p,o/=256,l-=8);t[e+d-p]|=128*y}},xl=kl,Fl=Ml;function kl(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}kl.Varint=0,kl.Fixed64=1,kl.Bytes=2,kl.Fixed32=5;var Al=4294967296,Pl=1/Al,Sl="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function _l(t){return t.type===kl.Bytes?t.readVarint()+t.pos:t.pos+1}function Ol(t,n,e){return e?4294967296*n+(t>>>0):4294967296*(n>>>0)+(t>>>0)}function Cl(t,n,e){var r=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));e.realloc(r);for(var i=e.pos-1;i>=t;i--)e.buf[i+r]=e.buf[i]}function El(t,n){for(var e=0;e<t.length;e++)n.writeVarint(t[e])}function Il(t,n){for(var e=0;e<t.length;e++)n.writeSVarint(t[e])}function $l(t,n){for(var e=0;e<t.length;e++)n.writeFloat(t[e])}function Tl(t,n){for(var e=0;e<t.length;e++)n.writeDouble(t[e])}function Dl(t,n){for(var e=0;e<t.length;e++)n.writeBoolean(t[e])}function zl(t,n){for(var e=0;e<t.length;e++)n.writeFixed32(t[e])}function jl(t,n){for(var e=0;e<t.length;e++)n.writeSFixed32(t[e])}function Ul(t,n){for(var e=0;e<t.length;e++)n.writeFixed64(t[e])}function Nl(t,n){for(var e=0;e<t.length;e++)n.writeSFixed64(t[e])}function Ll(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+16777216*t[n+3]}function Rl(t,n,e){t[e]=n,t[e+1]=n>>>8,t[e+2]=n>>>16,t[e+3]=n>>>24}function Vl(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+(t[n+3]<<24)}kl.prototype={destroy:function(){this.buf=null},readFields:function(t,n,e){for(e=e||this.length;this.pos<e;){var r=this.readVarint(),i=r>>3,s=this.pos;this.type=7&r,t(i,n,this),this.pos===s&&this.skip(r)}return n},readMessage:function(t,n){return this.readFields(t,n,this.readVarint()+this.pos)},readFixed32:function(){var t=Ll(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Vl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ll(this.buf,this.pos)+Ll(this.buf,this.pos+4)*Al;return this.pos+=8,t},readSFixed64:function(){var t=Ll(this.buf,this.pos)+Vl(this.buf,this.pos+4)*Al;return this.pos+=8,t},readFloat:function(){var t=Fl.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Fl.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var n,e,r=this.buf;return n=127&(e=r[this.pos++]),e<128?n:(n|=(127&(e=r[this.pos++]))<<7,e<128?n:(n|=(127&(e=r[this.pos++]))<<14,e<128?n:(n|=(127&(e=r[this.pos++]))<<21,e<128?n:function(t,n,e){var r,i,s=e.buf;if(r=(112&(i=s[e.pos++]))>>4,i<128)return Ol(t,r,n);if(r|=(127&(i=s[e.pos++]))<<3,i<128)return Ol(t,r,n);if(r|=(127&(i=s[e.pos++]))<<10,i<128)return Ol(t,r,n);if(r|=(127&(i=s[e.pos++]))<<17,i<128)return Ol(t,r,n);if(r|=(127&(i=s[e.pos++]))<<24,i<128)return Ol(t,r,n);if(r|=(1&(i=s[e.pos++]))<<31,i<128)return Ol(t,r,n);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(e=r[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&&Sl?function(t,n,e){return Sl.decode(t.subarray(n,e))}(this.buf,n,t):function(t,n,e){for(var r="",i=n;i<e;){var s,o,a,u=t[i],l=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h>e)break;1===h?u<128&&(l=u):2===h?128==(192&(s=t[i+1]))&&(l=(31&u)<<6|63&s)<=127&&(l=null):3===h?(o=t[i+2],128==(192&(s=t[i+1]))&&128==(192&o)&&((l=(15&u)<<12|(63&s)<<6|63&o)<=2047||l>=55296&&l<=57343)&&(l=null)):4===h&&(o=t[i+2],a=t[i+3],128==(192&(s=t[i+1]))&&128==(192&o)&&128==(192&a)&&((l=(15&u)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||l>=1114112)&&(l=null)),null===l?(l=65533,h=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),i+=h}return r}(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!==kl.Bytes)return t.push(this.readVarint(n));var e=_l(this);for(t=t||[];this.pos<e;)t.push(this.readVarint(n));return t},readPackedSVarint:function(t){if(this.type!==kl.Bytes)return t.push(this.readSVarint());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==kl.Bytes)return t.push(this.readBoolean());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==kl.Bytes)return t.push(this.readFloat());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==kl.Bytes)return t.push(this.readDouble());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==kl.Bytes)return t.push(this.readFixed32());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==kl.Bytes)return t.push(this.readSFixed32());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==kl.Bytes)return t.push(this.readFixed64());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==kl.Bytes)return t.push(this.readSFixed64());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed64());return t},skip:function(t){var n=7&t;if(n===kl.Varint)for(;this.buf[this.pos++]>127;);else if(n===kl.Bytes)this.pos=this.readVarint()+this.pos;else if(n===kl.Fixed32)this.pos+=4;else{if(n!==kl.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 e=new Uint8Array(n);e.set(this.buf),this.buf=e,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),Rl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Rl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Rl(this.buf,-1&t,this.pos),Rl(this.buf,Math.floor(t*Pl),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Rl(this.buf,-1&t,this.pos),Rl(this.buf,Math.floor(t*Pl),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,n){var e,r;if(t>=0?(e=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(e=~(-t%4294967296))?e=e+1|0:(e=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");n.realloc(10),function(t,n,e){e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos]=127&t}(e,0,n),function(t,n){var e=(7&t)<<4;n.buf[n.pos++]|=e|((t>>>=3)?128:0),t&&(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),t&&(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),t&&(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),t&&(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),t&&(n.buf[n.pos++]=127&t)))))}(r,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,e){for(var r,i,s=0;s<n.length;s++){if((r=n.charCodeAt(s))>55295&&r<57344){if(!i){r>56319||s+1===n.length?(t[e++]=239,t[e++]=191,t[e++]=189):i=r;continue}if(r<56320){t[e++]=239,t[e++]=191,t[e++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&(t[e++]=239,t[e++]=191,t[e++]=189,i=null);r<128?t[e++]=r:(r<2048?t[e++]=r>>6|192:(r<65536?t[e++]=r>>12|224:(t[e++]=r>>18|240,t[e++]=r>>12&63|128),t[e++]=r>>6&63|128),t[e++]=63&r|128)}return e}(this.buf,t,this.pos);var e=this.pos-n;e>=128&&Cl(n,e,this),this.pos=n-1,this.writeVarint(e),this.pos+=e},writeFloat:function(t){this.realloc(4),Fl.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Fl.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 e=0;e<n;e++)this.buf[this.pos++]=t[e]},writeRawMessage:function(t,n){this.pos++;var e=this.pos;t(n,this);var r=this.pos-e;r>=128&&Cl(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,n,e){this.writeTag(t,kl.Bytes),this.writeRawMessage(n,e)},writePackedVarint:function(t,n){n.length&&this.writeMessage(t,El,n)},writePackedSVarint:function(t,n){n.length&&this.writeMessage(t,Il,n)},writePackedBoolean:function(t,n){n.length&&this.writeMessage(t,Dl,n)},writePackedFloat:function(t,n){n.length&&this.writeMessage(t,$l,n)},writePackedDouble:function(t,n){n.length&&this.writeMessage(t,Tl,n)},writePackedFixed32:function(t,n){n.length&&this.writeMessage(t,zl,n)},writePackedSFixed32:function(t,n){n.length&&this.writeMessage(t,jl,n)},writePackedFixed64:function(t,n){n.length&&this.writeMessage(t,Ul,n)},writePackedSFixed64:function(t,n){n.length&&this.writeMessage(t,Nl,n)},writeBytesField:function(t,n){this.writeTag(t,kl.Bytes),this.writeBytes(n)},writeFixed32Field:function(t,n){this.writeTag(t,kl.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(t,n){this.writeTag(t,kl.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(t,n){this.writeTag(t,kl.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(t,n){this.writeTag(t,kl.Fixed64),this.writeSFixed64(n)},writeVarintField:function(t,n){this.writeTag(t,kl.Varint),this.writeVarint(n)},writeSVarintField:function(t,n){this.writeTag(t,kl.Varint),this.writeSVarint(n)},writeStringField:function(t,n){this.writeTag(t,kl.Bytes),this.writeString(n)},writeFloatField:function(t,n){this.writeTag(t,kl.Fixed32),this.writeFloat(n)},writeDoubleField:function(t,n){this.writeTag(t,kl.Fixed64),this.writeDouble(n)},writeBooleanField:function(t,n){this.writeVarintField(t,Boolean(n))}};var Hl=function(t){return t&&t.M&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}(xl);const ql={polygonPatternFile:1,markerFile:1,markerPlacement:1,markerSpacing:1,textName:1,textFaceName: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},ql),Object.assign({lineDasharray:1,topPolygonFill:1,bottomPolygonFill:1},ql);const Gl=Math.PI/180,Jl=6378137*Math.PI/180,Wl=85.0511287798;function Bl(t,n,e){if("EPSG:3857"===e)return function(t,n){const e=Wl,r=n[0],i=Math.max(Math.min(e,n[1]),-e);let s;s=0===i?0:Math.log(Math.tan((90+i)*Gl/2))/Gl;return t[0]=r*Jl,t[1]=s*Jl,t}(t,n);if("EPSG:4326"===e||"EPSG:4490"===e||"identity"===e)return Xl(t,n);if("baidu"===e)return Xl(t,n);throw new Error("unsupported projection:"+e)}function Xl(t,n){return t[0]=n[0],t[1]=n[1],t}function Yl(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p){0===t?function(t,n,e,r,i,s,o,a,u,l){const h=1/(100*s[0]),c=1/(100*s[1]),f=l&&l[0]||0,d=l&&l[1]||0,p=[0,0];for(let i=t;i<n;i+=3){const t=i/3*2,n=r[i]-f,s=r[i+1]-d;e[t]=p[0]+n/o*h/a,e[t+1]=p[1]-s/o*c/u}}(n,e,r,i,0,o,a,u,l,p):1===t&&function(t,n,e,r,i,s,o,a,u,l,h){if(!t)return;let c,f,d,p;0===t[4]?(c=t[0],f=t[1],d=t[2],p=t[3]):(c=t[1],f=t[2],d=t[3],p=t[0]);const y=Re(c,f),m=Re(f,d),g=[],v=[],b=[];for(let t=n;t<e;t+=3){const n=t/3*2;Le(g,(s.x/u+i[t]/o)*a,s.y/u*a+(h?i[t+1]:-i[t+1])/o*a),"EPSG:4326"!==l&&"EPSG:4490"!==l||Bl(g,g,"EPSG:3857"),Kl(v,g,c,f),Kl(b,g,p,c),r[n]=Re(c,v)/y,r[n+1]=Re(c,b)/m}}(h,n,e,r,i,s,a,c,f,d,!!p)}function Kl(t,n,e,r){const i=e[0]-r[0],s=e[1]-r[1];let o=(n[0]-e[0])*(e[0]-r[0])+(n[1]-e[1])*(e[1]-r[1]);return o/=i*i+s*s,t[0]=e[0]+o*i,t[1]=e[1]+o*s,t}function Zl(t,n,e,r,i){const s=3*n[e-1],o=3*n[e-1]+1,a=t[s],u=t[o];return l=r,h=i,c=a,f=u,Math.sqrt((c-l)*(c-l)+(f-h)*(f-h));var l,h,c,f}const Ql="__fea_idx";new Float32Array([-1e12])[0];const th="maptalks_ombb";function nh(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p,y,m){const g=n.getLength(),v=i/3;for(let e=2,r=g;e<r;e+=3)t[i+e-2]=n[e-2],t[i+e-1]=n[e-1],t[i+e-0]=n[e]-o;i+=g;for(let e=2,r=g;e<r;e+=3)t[i+e-2]=n[e-2],t[i+e-1]=n[e-1],t[i+e-0]=n[e]-a;i+=g,t.trySetLength(i+g),t.copyWithin(i,i-2*g,i-g),i+=g,t.trySetLength(i+g),t.copyWithin(i,i-2*g,i-g),i+=g,(e=e||[]).push(g/3);const b=e.getLength();for(let n=0;n<b;n++){eh(v+(e[n-1]||0),v+e[n],t,g/3,u,r,l,h,c,f,s,d,p,y,m)}return i}function eh(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p){const y=s.getLength();let m,g;for(let o=t,a=n;o<a-1;o++)if(m=o,g=o+1,i===1/0||!lt(e,m,g,i))if((o-t)%2==1&&(m+=2*r,g+=2*r),p){let t=s.currentIndex;s[t++]=m+r,s[t++]=g,s[t++]=m,s[t++]=g+r,s[t++]=g,s[t++]=m+r,s.currentIndex=t}else{let t=s.currentIndex;s[t++]=m+r,s[t++]=m,s[t++]=g,s[t++]=g,s[t++]=g+r,s[t++]=m+r,s.currentIndex=t}o&&function(t,n,e,r,i,s,o,a,u,l,h,c){let f,d=0,p=0,y=0,m=0;const g=c?[1,3,4]:[2,3,4];for(let c=s.getLength()-1;c>=o;c--){const o=s[c],v=3*o+1,b=3*o+2,w=i[3*o],M=i[v],x=i[b];d||p||(d=Math.max(i[b],i[3*s[c-3]+2]),p=Math.min(i[b],i[3*s[c-3]+2]),f=d-p);let F=y;const k=c%6;0===t?(5===k&&(m=Zl(i,s,c,w,M)),F=k===g[0]||k===g[1]||k===g[2]?y:y+m):1===t&&(k===g[0]||k===g[1]||k===g[2]?F=0:5===k?(m=Zl(i,s,c,w,M),F=m):F=m);const A=F/l*(1/(100*h))/a;let P;P=1===n?x===d?1:0:"bottom"===e?x===d?f/100/u:0:x===d?0:-f/100/u,r[2*o]=A,r[2*o+1]=P,0===k&&(y+=m)}}(a,u,l,h,e,s,y,c[0],c[1],f,d,p)}function rh(t){const n=[t[0]];let e=t[0];for(let r=1;r<t.length;r++)Array.isArray(t[r])?t[r][0]===e[0]&&t[r][1]===e[1]&&t[r][2]===e[2]||n.push(t[r]):t[r].x===e.x&&t[r].y===e.y&&t[r].z===e.z||n.push(t[r]),e=t[r];return n}const ih=ga.getInstance();function sh(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p,v){void 0===n.top&&(n.top=!0),void 0===n.side&&(n.side=!0),ih.reset();const{altitudeScale:b,altitudeProperty:w,defaultAltitude:M,heightProperty:x,minHeightProperty:F,defaultHeight:A,tangent:P,uv:S,topUVMode:O,sideUVMode:C,sideVerticalUVMode:E,top:I,side:$,textureYOrigin:T,topThickness:D}=n,z=function(t,n,{altitudeScale:e,altitudeProperty:r,defaultAltitude:i,heightProperty:s,minHeightProperty:o,defaultHeight:a},{center:u,side:l,top:h,topThickness:c,uvOrigin:f,uv:d,uvSize:p,topUVMode:y,sideUVMode:m,sideVerticalUVMode:g,textureYOrigin:v,tileRatio:b,centimeterToPoint:w,verticalCentimeterToPoint:M,positionType:x,res:F,glScale:A,projectionCode:P},S,_){let O=n/t[0].extent;n===1/0&&(O=1);const C=n===1/0,E=_.get(),I=_.get(),$=_.get(),T=_.getProxy(),D=_.get(),z=_.get(),j=_.get(),U=!!d,N=!!h,L=!!l,R=U?_.get():null;function V(t,e,r,i,s,o){let a=e;if(N){const i=Ce(T,r,3);if(0===i.length)return e;let l=T.getLength(),h=D.currentIndex;for(let t=0;t<l;t++)D[h++]=T[t];if(D.currentIndex=h,e+=T.getLength(),o)for(let n=2,e=i.length;n<e;n+=3)i[n]+=t/3,i[n-1]+=t/3,i[n-2]+=t/3;else{let n;for(let e=2,r=i.length;e<r;e+=3)n=i[e-1],i[e-1]=i[e]+t/3,i[e]=n+t/3,i[e-2]+=t/3}l=i.length,h=z.currentIndex;for(let t=0;t<l;t++)z[h++]=i[t];z.currentIndex=h,U&&Yl(y||0,t,e,R,D,f,w,b,p[0],p[1],s,F,A,P,u),c>0&&!L&&(e=nh(D,T,r,z,e,R,0,c,n,U,m||0,g||0,v,p,b,M,o)),j.setLength(e/3),j.fill(1,a/3,e/3)}if(L){N&&(c=0),a=e,e=nh(D,T,r,z,e,R,c,i,n,U,m||0,g||0,v,p,b,M,o),j.setLength(e/3);const t=T.getLength()/3;j.fill(1,a/3,a/3+t),j.fill(0,a/3+t,a/3+2*t),j.fill(1,a/3+2*t,a/3+3*t),j.fill(0,a/3+3*t,e/3)}return e}let H=0,q=0;const G=[-1,-1,n+1,n+1];let J=0,W=t.length;k(S)&&(J=S,W=S+1);let B=0,X=!1;const Y=_.getProxy();for(;J<W;J++){const u=t[J],l=u.id;k(l)&&(Math.abs(l)>B&&(B=Math.abs(l)),l<0&&(X=!0));const h=u.geometry,c=u.properties[th];let f=Array.isArray(c&&c[0]&&c[0][0])?c[0]:c;const{altitude:d,height:p}=wl.getFeaAltitudeAndHeight(u,e,r,i,s,a,o);H=Math.max(Math.abs(d),H);const y=D.getLength();let m=0,g=q;Y.setLength(0),T.setLength(0);const v=wl.calculateSignedArea(h[0])<0;for(let t=0,e=h.length;t<e;t++){let r=h[t];v&&(r=r.reverse()),r=rh(r);const i=wl.calculateSignedArea(r)<0;if(!i&&t>0&&(m++,f=c&&c[m],q=V(g,q,Y,p*O,f,C),T.setLength(0),Y.setLength(0),g=q),n!==1/0&&(r=wl.clipPolygon(r,G)),!r.length){t===e-1&&(q=V(g,q,Y,p*O,f,C));continue}const s=r.length;if(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]),i){let t=Y.currentIndex;Y[t++]=T.getLength()/3,Y.currentIndex=t}ut(T,T.getLength(),r,O,d,!1,x),t===e-1&&(q=V(g,q,Y,p*O,f,C))}const b=D.getLength()-y,w=(Ql+"").trim();for(let t=0;t<b/3;t++){let t=I.currentIndex;I[t++]=void 0===u[w]?J:u[w],I.currentIndex=t,t=E.currentIndex,E[t++]=J,E.currentIndex=t,k(l)&&(t=$.currentIndex,$[t++]=l,$.currentIndex=t)}}const K=wl.getUnsignedArrayType(I.getLength()?I[I.getLength()-1]:0),Z={maxAltitude:H,vertices:D,verticeTypes:j,indices:z,pickingIds:ga.createTypedArray(I,K),featureIndexes:E};if($.getLength()){const t=X?wl.getPosArrayType(B):wl.getUnsignedArrayType(B);Z.featureIds=ga.createTypedArray($,t)}else Z.featureIds=[];return R&&(R.setLength(D.getLength()/3*2),Z.uvs=R),Z}(t,e,{altitudeScale:b,altitudeProperty:w,defaultAltitude:M||0,heightProperty:x,minHeightProperty:F,defaultHeight:A||0},{center:v,top:I,side:$,topThickness:10*D||0,uv:S||P,uvSize:[i,i],uvOrigin:r,topUVMode:O,sideUVMode:C,sideVerticalUVMode:E,textureYOrigin:T,tileRatio:a,centimeterToPoint:u,verticalCentimeterToPoint:l,positionType:p,res:s,glScale:o,projectionCode:f},d,ih),j=[],U=z.vertices.getLength()/3,N=wl.getIndexArrayType(U),L=ga.createTypedArray(z.indices,N);delete z.indices,j.push(L.buffer,z.pickingIds.buffer);const R=wl.getPosArrayType(Math.max(512,z.maxAltitude));z.vertices=ga.createTypedArray(z.vertices,R);const V=P?ih.getProxy():new Float32Array(3*U);V.setLength&&V.setLength(3*U);const H=Jn(z.vertices,L,V);let q=!0;const G=H.getLength?H.getLength():H.length;for(let t=0;t<G;t++){H[t]=-H[t];const n=H[t]%1;1-Math.abs(n)>1e-6?q=!1:0!==n&&(H[t]=Math.round(H[t]))}if(z.normals=H,P){let t=ih.get();t.setLength(4*U),t=function(t,n,e,r,i){const s=(t.getLength?t.getLength():t.length)/3,o=i||new Array(4*s),a=[],u=[];for(let t=0;t<s;t++)a[t]=[0,0,0],u[t]=[0,0,0];const l=[0,0,0],h=[0,0,0],c=[0,0,0],f=[0,0],d=[0,0],p=[0,0],y=[0,0,0],m=[0,0,0];function g(n,r,i){ne(l,t,3*n),ne(h,t,3*r),ne(c,t,3*i),ee(f,e,2*n),ee(d,e,2*r),ee(p,e,2*i);const s=h[0]-l[0],o=c[0]-l[0],g=h[1]-l[1],v=c[1]-l[1],b=h[2]-l[2],w=c[2]-l[2],M=d[0]-f[0],x=p[0]-f[0],F=d[1]-f[1],k=p[1]-f[1],A=1/(M*k-x*F);_n(y,(k*s-F*o)*A,(k*g-F*v)*A,(k*b-F*w)*A),_n(m,(M*o-x*s)*A,(M*v-x*g)*A,(M*w-x*b)*A),On(a[n],a[n],y),On(a[r],a[r],y),On(a[i],a[i],y),On(u[n],u[n],m),On(u[r],u[r],m),On(u[i],u[i],m)}for(let t=0,n=r.length;t<n;t+=3)g(r[t+0],r[t+1],r[t+2]);const v=[],b=[],w=[],M=[];let x,F,k;function A(t){ne(w,n,3*t),Sn(M,w),F=a[t],Sn(v,F),$n(v,v,function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t}(w,w,En(w,F))),Cn(v,v),In(b,M,F),k=En(b,u[t]),x=k<0?-1:1,o[4*t]=v[0],o[4*t+1]=v[1],o[4*t+2]=v[2],o[4*t+3]=x}for(let t=0,n=r.length;t<n;t+=3)A(r[t+0]),A(r[t+1]),A(r[t+2]);return o}(z.vertices,z.normals,z.uvs,L,t),t=function(t,n){const e=n.getLength(),r=new Float32Array(e),i=[],s=[],o=[];for(let a=0;a<e;a+=4){const e=a/4*3;Ie(s,t[e]||0,t[e+1]||0,t[e+2]||0),ze(i,n[a]||0,n[a+1]||0,n[a+2]||0,n[a+3]||0),qn(o,s,i),De(r.subarray(a,a+4),o)}return r}(z.normals,t),z.tangents=t,j.push(t.buffer),delete z.normals}if(z.normals&&(q&&(z.normals=ga.createTypedArray(z.normals,Int8Array)),j.push(z.normals.buffer)),z.uvs){const t=z.uvs;z.uvs=ga.createTypedArray(t,Float32Array),j.push(z.uvs.buffer)}const J=function(t,n,e,r){const i={},s={},o=r.getLength();if(_(n.polygonFill)){let a=g(n.polygonFill);const u=new Uint8Array(4*o);u.fill(255);for(let n=0;n<o;n++){const s=t[r[n]],o=s.properties||{};o.$layer=s.layer,o.$type=s.type;let l=a(e,o);y(l)&&(i.aColor=1,a=g(l),l=a(e,o)),delete o.$layer,delete o.$type,Dr.normalizeColor(oh,l),u[4*n]=oh[0],u[4*n+1]=oh[1],u[4*n+2]=oh[2],u[4*n+3]=oh[3]}s.aColor=u}if(_(n.polygonOpacity)){let a=m(n.polygonOpacity);const u=new Uint8Array(o);u.fill(255);for(let n=0;n<o;n++){const s=t[r[n]],o=s.properties||{};o.$layer=s.layer,o.$type=s.type;let l=a(e,o);y(l)&&(i.aOpacity=1,a=g(l),l=a(e,o)),delete o.$layer,delete o.$type,u[n]=255*l}s.aOpacity=u}return s.dynamicAttributes=i,s}(t,h,c,z.featureIndexes),W=function(t,n,e,r,i){const s=[[],[]],o=_(r.topPolygonFill),a=_(r.bottomPolygonFill),u=[255,255,255,255],l=n.getLength();if(o||a){let h=o&&g(r.topPolygonFill),c=a&&g(r.bottomPolygonFill),f=null,d=null,p=null,m=null;for(let r=0;r<l;r++){if(1===t[r]&&!o||0===t[r]&&!a)continue;const l=1===t[r];if(l&&n[r]===f){t[r]=p;continue}if(!l&&n[r]===d){t[r]=m;continue}const v=e[n[r]],b=v.properties||{};b.$layer=v.layer,b.$type=v.type;let w=l?h:c,M=w(i,b);y(M)&&(w=g(M),M=w(i,b)),delete b.$layer,delete b.$type,Dr.normalizeColor(oh,M),je(oh,oh,u);let x=ah(s,oh);x<0&&(x=s.length,s.push(De([],oh))),t[r]=x,l?(f=n[r],p=x):(d=n[r],m=x)}}return s.slice(2)}(z.verticeTypes,z.featureIndexes,t,h,c),B={data:{data:{aVertexColorType:W.length<=252?ga.createTypedArray(z.verticeTypes,Uint8Array):ga.createTypedArray(z.verticeTypes,Uint16Array),aPosition:z.vertices,aNormal:z.normals,aTexCoord0:z.uvs,aTangent:z.tangents,aPickingId:z.pickingIds},indices:L,properties:{maxAltitude:z.maxAltitude},dynamicAttributes:J.dynamicAttributes,vertexColors:W},buffers:j};return z.featureIds.length?(B.data.featureIds=z.featureIds,j.push(B.data.featureIds.buffer)):B.data.featureIds=[],J.aColor&&(B.data.data.aColor=J.aColor,B.buffers.push(J.aColor.buffer)),J.aOpacity&&(B.data.data.aOpacity=J.aOpacity,B.buffers.push(J.aOpacity.buffer)),B.buffers.push(B.data.data.aPosition.buffer),B.data.pickingIdIndiceMap=wl.generatePickingIndiceIndex(B.data.data.aPickingId,B.data.indices),B}const oh=[];function ah(t,n){for(let e=0;e<t.length;e++)if(Ne(n,t[e]))return e;return-1}function uh(t,n,e,r,{altitudeScale:i,altitudeProperty:s,defaultAltitude:o,heightProperty:a,minHeightProperty:u,defaultHeight:l,bottom:h}){const c=h,f=n/t[0].extent,d=2*function(t,n){let e=0;for(let n=0,r=t.length;n<r;n++){const r=t[n];if(k(r.geometry[0][0]))e+=3*r.geometry.length;else for(let t=0,n=r.geometry.length;t<n;t++){let n=3*r.geometry[t].length;3===r.type&&(n-=3),e+=n}}return e}(t)+3*t.length*2,p=[],m=new Int16Array(d),g=new Uint8Array(m.length/3*4);y(e)&&(e=ha.compileFilter(e));const v=[];function b(t,e,r){const i=e-t,s=m.subarray(t,e),o=m.subarray(e,e+i);o.set(s);for(let t=2,n=o.length;t<n;t+=3)o[t]=s[t]-r;const a=t/3,u=i/3;let l,h;for(let t=a,e=u+a;t<e;t++)t<e-1?(l=t,h=t+1):(l=t,h=a),lt(m,l,h,n)||(v.push(l,h),c&&v.push(l+u,h+u),lh(m,l,n)||v.push(l,l+u));return e+i}let w=0,M=0;const x=(Ql+"").trim(),F=[];for(let n=0,h=t.length;n<h;n++){const h=t[n],c=h.geometry;if(e){let t;t="function"==typeof e?e(h&&h.properties):e,Dr.normalizeColor(F,t)}else Ie(F,255,255,255);const d=w/3*4,{altitude:y,height:k}=wl.getFeaAltitudeAndHeight(h,i,s,o,a,l,u);M=Math.max(Math.abs(y),M);let A=w;for(let t=0,n=c.length;t<n;t++){let n=c[t];const e=n.length;n[0][0]===n[e-1][0]&&n[0][1]===n[e-1][1]&&(n=n.slice(0,e-1)),w=ut(m,A,n,f,y),w=b(A,w,k*f),A=w}const P=A/3*4;for(let t=d;t<P;t+=4)g[t]=F[0],g[t+1]=F[1],g[t+2]=F[2],g[t+3]=255*(r||1);const S=v.length-p.length;for(let t=0;t<S;t++)p.push(h[x])}const A=v.reduce(((t,n)=>Math.max(t,n)),0),P=new(wl.getIndexArrayType(A))(v),S=wl.getUnsignedArrayType(t.length);return{aPosition:new(wl.getPosArrayType(Math.max(512,M)))(m),indices:P,aPickingId:new S(p),aColor:g}}function lh(t,n,e){const r=t[3*n],i=t[3*n+1];return r<0||r>e||i<0||i>e}function hh(t,n,e,r){const i=uh(t,n,e.lineColor,e.lineOpacity,r),s=[i.aPosition.buffer,i.indices.buffer,i.aPickingId.buffer],o=i.indices;return delete i.indices,{data:{data:i,indices:o},buffers:s}}let ch=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),ch=!0}catch(t){ch=!1}var fh=ch;const dh="__original_properties",ph="__fn-type_properties";class yh{constructor(t,n,e,r,i){this.id=t,this.options=n,this.upload=e,this.tn(n.style),this.requests={},this.Gt=r,this.nn=1,this.loadings=i}updateStyle(t,n){this.options.style=t,this.nn=t.styleCounter,this.tn(t),n()}updateOptions(t,n){this.options=x(this.options,t),n()}loadTile(t,n){const e=this.loadings,r=t.tileInfo.url,i=this.options.debugTile;if(i){const{x:e,y:r,z:s}=t.tileInfo;let o=!1;for(let t=0;t<i.length;t++)if(e===i[t].x&&r===i[t].y&&s===i[t].z){o=!0;break}if(!o)return void n()}if(e[r])return void e[r].push({context:t,callback:n,ref:this});e[r]=[{context:t,callback:n,ref:this}];const s=this.options.featureIdProperty;this.requests[r]=this.getTileFeatures(t,((n,i,o,a)=>{const u=e[r];if(delete e[r],this.checkIfCanceled(r))return delete this.requests[r],void this.en(u,null,{canceled:!0});if(delete this.requests[r],(this.options.debug||s)&&i)for(let n=0;n<i.length;n++)if(this.options.debug&&(i[n]._debug_info={index:n,id:i[n].id,tileId:t.tileInfo.id}),s){const t=P(s)?s[i[n].layer]:s,e=i[n].properties;i[n].id=e&&e[t]||null}if(n)this.en(u,n);else if(i&&i.length){if(u)for(let t=0;t<u.length;t++)this.rn.call(u[t].ref,u[t].context,u[t].callback,r,o,i,a)}else this.en(u)}))}rn(t,n,e,r,i,s){this.sn(r,i,t).then((e=>{e.canceled?n(null,{canceled:!0}):(e.data.styleCounter=t.styleCounter,s&&x(e.data,s),n(null,e.data,e.buffers))})).catch((t=>{n(t)}))}abortTile(t,n){delete this.requests[t],this.an(t),n()}an(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]}en(t,n,e){if(t)for(let r=0;r<t.length;r++)t[r].callback(n,e)}checkIfCanceled(t){return!this.requests[t]}onRemove(){this.loadings={},delete this.Gt,this.requests={}}fetchIconGlyphs(t,n,e){if(this.options.workerGlyph&&fh){const r=[];if(t&&Object.keys(t).length){const n=new Promise((n=>{this.upload("fetchIconGlyphs",{icons:t},null,((t,e)=>{n({err:t,iconData:e})}))}));r.push(n)}if(n&&Object.keys(n).length){const t=new Promise((t=>{this.un||(this.un=new vl),this.un.getGlyphs(n,((n,e)=>{t({err:n,glyphData:e})}))}));r.push(t)}Promise.all(r).then((t=>{const n={icons:null,glyphs:null};for(let r=0;r<t.length;r++){if(t[r].err)return void e(t[r].err);t[r].iconData?n.icons=t[r].iconData.icons:t[r].glyphData&&(n.glyphs=t[r].glyphData.glyphs)}return n})).then((t=>{e(null,t)}))}else this.upload("fetchIconGlyphs",{icons:t,glyphs:n},null,e)}sn(t,n,e){if(!n.length)return Promise.resolve({data:null,buffers:[]});const{glScale:r,tileInfo:i}=e,s=!this.options.style.style.length&&!this.options.style.featureStyle.length;let o=this.pluginConfig.slice(0);s&&(o=this.hn(t)),this.featurePlugins&&function(t){for(let n=1;n<arguments.length;n++){const e=arguments[n];if(e)for(let n=0,r=e.length;n<r;n++)t.push(e[n])}t.length}(o,this.featurePlugins);const a={};for(let t=0;t<o.length;t++)xh(n,e.tileInfo.z,o[t],a);const u=[],l=[];for(let t=0;t<n.length;t++){const e=n[t],r=a[t];if(r){l.fill(null);let t=0;for(const n in r){let i=0;const s=r[n].values();for(const t of s){let r=l[i];r||(r=Ph(e),l[i]=r),r.properties[n]=t,i++}i>t&&(t=i)}for(let n=0;n<t;n++)u.push(l[n])}else u.push(e)}const h=(n=u)[0].extent,c=i.z,f={x:i.extent2d.xmin*r,y:i.extent2d.ymax*r},d=[],p=[],y=[],m=this.options,g=[],v={},b=[Promise.resolve(e.styleCounter)];let w=0,M=-1;const F=[];let k=!1;for(let t=0;t<o.length;t++){M++;const r=o[t];r.type!==w&&(M=0,w=r.type);const a=0===r.type?d:p;if(r.symbol&&!1===r.symbol.visible){a[M]=null;continue}Oh(r.symbol,F,t),k=k||F[t]&&F[t].size>0;const{tileFeatures:u,tileFeaIndexes:l}=this.cn(c,r.type,r.filter,n,v,t);if(!u.length){a[M]=null;continue}const m=l[l.length-1],A=wl.getIndexArrayType(m);a[M]={styledFeatures:new A(l)},y.push({idx:t,typeIdx:M}),g.push(a[M].styledFeatures.buffer);const P=x({},e,{extent:h,zoom:c,tilePoint:f});if(this.options.debugTile){const t=this.options.debugTile;for(let n=0;n<t.length;n++){const{x:e,y:r,z:s}=t[n];if(i.x===e&&i.y===r&&i.z===s){P.debugIndex=t[n].index;break}}}let S=this.dn(u,r,P);s&&(S=S.then((t=>{if(!t)return null;if(t.data)t.data.layer=u[0].layer;else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]&&t[n].data&&(t[n].data.layer=u[0].layer);return t}))),b.push(S)}return Promise.all(b).then((([e,...r])=>{if(e!==this.nn)return{canceled:!0};function i(t,n){if(void 0===t.data.ref&&(t.data.type=o[y[n].idx].renderPlugin.dataConfig.type,t.data.filter=o[y[n].idx].filter.def,t.buffers&&t.buffers.length))for(let n=0;n<t.buffers.length;n++)g.push(t.buffers[n])}for(let t=0;t<r.length;t++){if(!r[t])continue;const n=r[t],e=0===o[y[t].idx].type?d:p;if(Array.isArray(n)){const r=[];for(let e=0;e<n.length;e++)n[e]&&(i(n[e],t),(void 0===n[e].data.ref||n[n[e].data.ref])&&r.push(n[e].data));r.length&&(e[y[t].typeIdx].data=r)}else i(n,t),e[y[t].typeIdx].data=n.data}const s={},a=t;if(m.features||m.schema||k){let t,e=!1;for(let r=0,i=n.length;r<i;r++)if(t=n[r],a[t.layer].properties||(a[t.layer].properties=vh(t.properties)),t&&(m.features||k&&v[r]))if("id"===m.features)s[r]=t.id;else{m.pickingGeometry||delete t.geometry,delete t.extent,delete t.properties.$layer,delete t.properties.$type,delete t.__index;const n=t.originalFeature;if(n){const n=t.properties,e=x({},t.originalFeature);delete n[dh],e.customProps=x({},n),t=e}const i=x({},t);if(k&&v[r]&&(!m.features||"transient"===m.features)){const i=v[r];for(let r=0;r<i.length;r++){const i=F[r];i&&i.forEach((r=>{const i=n?n.properties:t.properties;i[ph]||(i[ph]=new Set),i[ph].add(r),e=!0}))}}s[r]=i}if(e)for(const t in s){const n=s[t],e=n.properties[ph];if(e){delete n.properties[ph],"transient"===m.features&&(n.fnTypeProps=x({},n.properties));for(const t in n.properties)e.has(t)||("transient"===m.features?delete n.fnTypeProps[t]:delete n.properties[t])}}}return{data:{styleCounter:e,schema:a,data:d,featureData:p,extent:h,features:s},buffers:g}})).catch((t=>{console.error(t)}))}dn(t,n,e){let r=t;const i=n.renderPlugin.dataConfig,s=n.symbol,o=this.options.tileSize,{extent:a,glScale:u,zScale:l,zoom:h,tilePoint:c,centimeterToPoint:f,verticalCentimeterToPoint:d}=e,p=a/o,y=i.type,m=e.debugIndex;let g=x({},i,{EXTENT:a,zoom:h,debugIndex:m,features:this.options.features});if("3d-extrusion"===y){bh(s)&&(i.uv=1);const t=this.options.projectionCode,n=s.material&&s.material.textureWidth||23.25;return Promise.all([Promise.resolve(sh(r,i,a,c,n,e.tileInfo.res,u,a/this.options.tileSize,f,d,s,h,t,m))])}if("3d-wireframe"===y)return Promise.all([Promise.resolve(hh(r,a,s,i))]);if("point"===y){g=x(g,{requestor:this.fetchIconGlyphs.bind(this),altitudeToTileScale:l*a/this.options.tileSize/u});const t=ku.splitPointSymbol(s),n=Pa.genFnTypes(t[0]);return ku.needMerge(t[0],n,h)&&(r=ku.mergeLineFeatures(r,t[0],n,h)),Promise.all(t.map(((t,e)=>(0===e?g.fnTypes=n:delete g.fnTypes,new ku(r,t,g).load(p)))))}if("native-point"===y){const t=l*a/this.options.tileSize/u;return g.altitudeToTileScale=t,wh(r,s,g,Hu,a/o)}if("line"===y)return g=x(g,{requestor:this.fetchIconGlyphs.bind(this),tileRatio:p}),wh(r,s,g,Iu,1,!0);if("native-line"===y)return wh(r,s,g,Ru,1,!0);if("fill"===y)return g=x(g,{requestor:this.fetchIconGlyphs.bind(this)}),wh(r,s,g,Ku);if("line-extrusion"===y){delete s.lineGradientProperty,s.lineJoin="miter",s.lineCap="butt";const t=bh(s);if(t&&(i.uv=1),g=x(g,{tileSize:o,zScale:l,glScale:u}),s.mergeOnProperty){const t=Pa.genFnTypes(s);r=Iu.mergeLineFeatures(r,s,t,g.zoom)}if(t){const t=[];if(!1!==i.top){const n=x({},g);n.side=!1,t.push(new Nu(r,s,n))}return!1!==i.side&&(g.side=!0,g.top=!1,t.push(new Nu(r,s,g))),Promise.all(t.map((t=>t.load())))}return Promise.all([new Nu(r,s,g).load()])}if("circle"===y)return wh(r,s,g,Qu);if("round-tube"===y||"square-tube"===y){const t="round-tube"===y?tl:ol;return g=x(g,{requestor:this.fetchIconGlyphs.bind(this),radialSegments:"round-tube"===y?i.radialSegments||8:4,centimeterToPoint:f,verticalCentimeterToPoint:d,tileRatio:p,isTube:!0}),wh(r,s,g,t)}return Promise.resolve([])}cn(t,n,e,r,i,s){const o=(Ql+"").trim(),a=[],u=[],l=r.length;for(let h=0;h<l;h++)if((1===n||void 0===r[h].id||!this.styledFeatures[r[h].id])&&((!e.def||"default"===e.def)&&!i[h]||!0===e.def||e.def&&(void 0!==e.def.condition||Array.isArray(e.def))&&e(r[h],t))){const t=r[h];if(void 0===t[o]&&(t[o]=h),i[h]||(i[h]=[]),i[h].push(s),u.push(t),a.push(h),1===n)break}return{tileFeatures:u,tileFeaIndexes:a}}tn(t){const{style:n,featureStyle:e}=t,r={};e.forEach((t=>{Array.isArray(t.id)?(t.id.forEach((t=>{r[t]=1})),t.filter=["in","$id",...t.id]):(r[t.id]=1,t.filter=["==","$id",t.id])}));const i=ha.compileStyle(n);for(let t=0;t<n.length;t++)i[t].filter&&(i[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0),i[t].type=0;const s=[],o=ha.compileStyle(e);for(let t=0;t<e.length;t++)o[t].type=1,o[t].filter.def=e[t].filter?e[t].filter.value||e[t].filter:void 0,o[t].renderPlugin&&s.push(o[t]);this.pluginConfig=i,this.featurePlugins=s,this.styledFeatures=r}hn(t){let n=this.pn;this.pn||(n=this.pn={});const e=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],r=[];for(const i in t){const s=i;if(!n[i]){const r=[];for(let n=0;n<t[i].types.length;n++){const o=t[i].types[n],a=["all",["==","$layer",s],["==","$type",e[o]]],u={filter:ln(a),renderPlugin:mh(o),symbol:gh(o)};u.filter.def=a,u.type=0,r.push(u)}n[s]=r}r.push(...n[s])}return r}}function mh(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 gh(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 vh(t){if(Array.isArray(t)||!P(t))return{};const n={};for(const e in t){const r=t[e];F(r)?n[e]="string":k(r)?n[e]="number":!0===r||!1===r?n[e]="boolean":Array.isArray(r)?n[e]="array":n[e]="object"}return n}function bh(t){if(!t)return 0;let n=0;for(const e in t){if(("normalTexture"===e||"bumpTexture"===e)&&t[e])return 2;if(e.indexOf("Texture")>0&&t[e])n=1;else if(P(t[e])){const r=bh(t[e]);if(2===r)return r;1===r&&(n=1)}}return n}function wh(t,n,e,r,i,s){const o={},a=Array.isArray(n)?n:[n];let u=-1;for(let t=0;t<a.length;t++)o[t]=Mh(a[t]),!o[t]&&a[t]&&-1===u&&(u=t);const l=[];for(let n=0;n<a.length;n++){if(!a[n])continue;a[n].index={index:n};let h=t;if(s&&a[n].mergeOnProperty){const r=Pa.genFnTypes(a[n]);h=Iu.mergeLineFeatures(t,a[0],r,e.zoom)}o[n]||n===u?l.push(new r(h,a[n],e).load(i)):l.push({data:{ref:u,symbolIndex:{index:n}}})}return Promise.all(l)}function Mh(t){if(!t)return 0;for(const n in t)if(_(t[n]))return 1;return 0}function xh(t,n,e,r){const i=e.customProperties;if(!i)return t;if(i)for(let t=0;t<i.length;t++)i[t].fn=ha.compileFilter(i[t].filter);for(let e=0;e<i.length;e++)for(let s=0,o=t.length;s<o;s++)if(i[e].fn(t[s],n))for(const t in i[e].properties){const n=i[e].properties[t];S(n)||(r[s]||(r[s]={}),r[s][t]||(r[s][t]=new Set),r[s][t].add(n))}}const Fh={get:(t,n)=>n in t?t[n]:t.originalFeature[n],has:(t,n)=>n in t||n in t.originalFeature},kh={get:function(t,n){return n in t?t[n]:t[dh][n]},has:(t,n)=>n in t||n in t[dh]},Ah={};function Ph(t){const n={};n.originalFeature=t;const e=new Proxy(n,Fh);return e.properties=new Proxy({},kh),e.properties[dh]=t.properties||Ah,e}function Sh(t,n,e){t[n]||(t[n]=new Set),t[n].add(e)}const _h=[];function Oh(t,n,e){if(!t)return _h;for(const r in t){if(!t[r]||!Dr.checkIfZoomFnTypeSymbol(r))continue;if(_(t[r]))Sh(n,e,t[r].property);else{if("lineGradientProperty"===r){Sh(n,e,t[r]);continue}if("textName"===r)if(F(t[r])){const i=Da.resolveVarNames(t[r]);if(i)for(let t=0;t<i.length;t++)Sh(n,e,i[t])}else if(ha.isExpression(t[r])){const i=[];Da.resolveExpVarNames(i,t[r]);for(let t=0;t<i.length;t++)Sh(n,e,i[t])}}const i=t[r].stops;if(i&&i.length)for(let t=0;t<i.length;t++)_(i[t][1])&&Sh(n,t,i[t][1].property)}return n[e]}function Ch(t,n){Eh(t.geometry,n)}function Eh(t,n){if(t)switch(t.type){case"Point":Ih(t.coordinates,n);break;case"MultiPoint":case"LineString":$h(t.coordinates,n);break;case"MultiLineString":!function(t,n){for(let e=0,r=t.length;e<r;e++)$h(t[e],n)}(t.coordinates,n);break;case"Polygon":Th(t.coordinates,n);break;case"MultiPolygon":!function(t,n){for(let e=0,r=t.length;e<r;e++)Th(t[e],n)}(t.coordinates,n);break;case"GeometryCollection":const e=t.geometries.length;for(let r=0;r<e;r++)Eh(t.geometries[r],n)}}function Ih(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 $h(t,n){for(let e=0,r=t.length;e<r;e++)Ih(t[e],n)}function Th(t,n){t.length&&$h(t[0],n)}function Dh(t,n,e,r,i){zh(t,n,e||0,r||t.length-1,i||Uh)}function zh(t,n,e,r,i){for(;r>e;){if(r-e>600){var s=r-e+1,o=n-e+1,a=Math.log(s),u=.5*Math.exp(2*a/3),l=.5*Math.sqrt(a*u*(s-u)/s)*(o-s/2<0?-1:1);zh(t,n,Math.max(e,Math.floor(n-o*u/s+l)),Math.min(r,Math.floor(n+(s-o)*u/s+l)),i)}var h=t[n],c=e,f=r;for(jh(t,e,n),i(t[r],h)>0&&jh(t,e,r);c<f;){for(jh(t,c,f),c++,f--;i(t[c],h)<0;)c++;for(;i(t[f],h)>0;)f--}0===i(t[e],h)?jh(t,e,f):jh(t,++f,r),f<=n&&(e=f+1),n<=f&&(r=f-1)}}function jh(t,n,e){var r=t[n];t[n]=t[e],t[e]=r}function Uh(t,n){return t<n?-1:t>n?1:0}class Nh{constructor(t=9){this.yn=Math.max(4,t),this.mn=Math.max(2,Math.ceil(.4*this.yn)),this.clear()}all(){return this.gn(this.data,[])}search(t){let n=this.data;const e=[];if(!Kh(t,n))return e;const r=this.toBBox,i=[];for(;n;){for(let s=0;s<n.children.length;s++){const o=n.children[s],a=n.leaf?r(o):o;Kh(t,a)&&(n.leaf?e.push(o):Yh(t,a)?this.gn(o,e):i.push(o))}n=i.pop()}return e}collides(t){let n=this.data;if(!Kh(t,n))return!1;const e=[];for(;n;){for(let r=0;r<n.children.length;r++){const i=n.children[r],s=n.leaf?this.toBBox(i):i;if(Kh(t,s)){if(n.leaf||Yh(t,s))return!0;e.push(i)}}n=e.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this.mn){for(let n=0;n<t.length;n++)this.insert(t[n]);return this}let n=this.vn(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this.bn(this.data,n);else{if(this.data.height<n.height){const t=this.data;this.data=n,n=t}this.wn(n,this.data.height-n.height-1,!0)}else this.data=n;return this}insert(t){return t&&this.wn(t,this.data.height-1),this}clear(){return this.data=Zh([]),this}remove(t,n){if(!t)return this;let e=this.data;const r=this.toBBox(t),i=[],s=[];let o,a,u;for(;e||i.length;){if(e||(e=i.pop(),a=i[i.length-1],o=s.pop(),u=!0),e.leaf){const r=Lh(t,e.children,n);if(-1!==r)return e.children.splice(r,1),i.push(e),this.Mn(i),this}u||e.leaf||!Yh(e,r)?a?(o++,e=a.children[o],u=!1):e=null:(i.push(e),s.push(o),o=0,a=e,e=e.children[0])}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}gn(t,n){const e=[];for(;t;)t.leaf?n.push(...t.children):e.push(...t.children),t=e.pop();return n}vn(t,n,e,r){const i=e-n+1;let s,o=this.yn;if(i<=o)return s=Zh(t.slice(n,e+1)),Rh(s,this.toBBox),s;r||(r=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,r-1))),s=Zh([]),s.leaf=!1,s.height=r;const a=Math.ceil(i/o),u=a*Math.ceil(Math.sqrt(o));Qh(t,n,e,u,this.compareMinX);for(let i=n;i<=e;i+=u){const n=Math.min(i+u-1,e);Qh(t,i,n,a,this.compareMinY);for(let e=i;e<=n;e+=a){const i=Math.min(e+a-1,n);s.children.push(this.vn(t,e,i,r-1))}}return Rh(s,this.toBBox),s}xn(t,n,e,r){for(;r.push(n),!n.leaf&&r.length-1!==e;){let e,r=1/0,i=1/0;for(let s=0;s<n.children.length;s++){const o=n.children[s],a=Jh(o),u=Bh(t,o)-a;u<i?(i=u,r=a<r?a:r,e=o):u===i&&a<r&&(r=a,e=o)}n=e||n.children[0]}return n}wn(t,n,e){const r=e?t:this.toBBox(t),i=[],s=this.xn(r,this.data,n,i);for(s.children.push(t),Hh(s,r);n>=0&&i[n].children.length>this.yn;)this.Fn(i,n),n--;this.kn(r,i,n)}Fn(t,n){const e=t[n],r=e.children.length,i=this.mn;this.An(e,i,r);const s=this.Pn(e,i,r),o=Zh(e.children.splice(s,e.children.length-s));o.height=e.height,o.leaf=e.leaf,Rh(e,this.toBBox),Rh(o,this.toBBox),n?t[n-1].children.push(o):this.bn(e,o)}bn(t,n){this.data=Zh([t,n]),this.data.height=t.height+1,this.data.leaf=!1,Rh(this.data,this.toBBox)}Pn(t,n,e){let r,i=1/0,s=1/0;for(let o=n;o<=e-n;o++){const n=Vh(t,0,o,this.toBBox),a=Vh(t,o,e,this.toBBox),u=Xh(n,a),l=Jh(n)+Jh(a);u<i?(i=u,r=o,s=l<s?l:s):u===i&&l<s&&(s=l,r=o)}return r||e-n}An(t,n,e){const r=t.leaf?this.compareMinX:qh,i=t.leaf?this.compareMinY:Gh;this.Sn(t,n,e,r)<this.Sn(t,n,e,i)&&t.children.sort(r)}Sn(t,n,e,r){t.children.sort(r);const i=this.toBBox,s=Vh(t,0,n,i),o=Vh(t,e-n,e,i);let a=Wh(s)+Wh(o);for(let r=n;r<e-n;r++){const n=t.children[r];Hh(s,t.leaf?i(n):n),a+=Wh(s)}for(let r=e-n-1;r>=n;r--){const n=t.children[r];Hh(o,t.leaf?i(n):n),a+=Wh(o)}return a}kn(t,n,e){for(let r=e;r>=0;r--)Hh(n[r],t)}Mn(t){for(let n,e=t.length-1;e>=0;e--)0===t[e].children.length?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():Rh(t[e],this.toBBox)}}function Lh(t,n,e){if(!e)return n.indexOf(t);for(let r=0;r<n.length;r++)if(e(t,n[r]))return r;return-1}function Rh(t,n){Vh(t,0,t.children.length,n,t)}function Vh(t,n,e,r,i){i||(i=Zh(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let s=n;s<e;s++){const n=t.children[s];Hh(i,t.leaf?r(n):n)}return i}function Hh(t,n){return t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),t}function qh(t,n){return t.minX-n.minX}function Gh(t,n){return t.minY-n.minY}function Jh(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Wh(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Bh(t,n){return(Math.max(n.maxX,t.maxX)-Math.min(n.minX,t.minX))*(Math.max(n.maxY,t.maxY)-Math.min(n.minY,t.minY))}function Xh(t,n){const e=Math.max(t.minX,n.minX),r=Math.max(t.minY,n.minY),i=Math.min(t.maxX,n.maxX),s=Math.min(t.maxY,n.maxY);return Math.max(0,i-e)*Math.max(0,s-r)}function Yh(t,n){return t.minX<=n.minX&&t.minY<=n.minY&&n.maxX<=t.maxX&&n.maxY<=t.maxY}function Kh(t,n){return n.minX<=t.maxX&&n.minY<=t.maxY&&n.maxX>=t.minX&&n.maxY>=t.minY}function Zh(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Qh(t,n,e,r,i){const s=[n,e];for(;s.length;){if((e=s.pop())-(n=s.pop())<=r)continue;const o=n+Math.ceil((e-n)/r/2)*r;Dh(t,o,n,e,i),s.push(n,o,o,e)}}var tc={exports:{}},nc=function(t,n,e,r){var i=t[0],s=t[1],o=!1;void 0===e&&(e=0),void 0===r&&(r=n.length);for(var a=(r-e)/2,u=0,l=a-1;u<a;l=u++){var h=n[e+2*u+0],c=n[e+2*u+1],f=n[e+2*l+0],d=n[e+2*l+1];c>s!=d>s&&i<(f-h)*(s-c)/(d-c)+h&&(o=!o)}return o},ec=function(t,n,e,r){var i=t[0],s=t[1],o=!1;void 0===e&&(e=0),void 0===r&&(r=n.length);for(var a=r-e,u=0,l=a-1;u<a;l=u++){var h=n[u+e][0],c=n[u+e][1],f=n[l+e][0],d=n[l+e][1];c>s!=d>s&&i<(f-h)*(s-c)/(d-c)+h&&(o=!o)}return o};tc.exports=function(t,n,e,r){return n.length>0&&Array.isArray(n[0])?ec(t,n,e,r):nc(t,n,e,r)};var rc=tc.exports.nested=ec;tc.exports.flat=nc;const ic=11102230246251565e-32,sc=134217729,oc=(3+8*ic)*ic;function ac(t,n,e,r,i){let s,o,a,u,l=n[0],h=r[0],c=0,f=0;h>l==h>-l?(s=l,l=n[++c]):(s=h,h=r[++f]);let d=0;if(c<t&&f<e)for(h>l==h>-l?(o=l+s,a=s-(o-l),l=n[++c]):(o=h+s,a=s-(o-h),h=r[++f]),s=o,0!==a&&(i[d++]=a);c<t&&f<e;)h>l==h>-l?(o=s+l,u=o-s,a=s-(o-u)+(l-u),l=n[++c]):(o=s+h,u=o-s,a=s-(o-u)+(h-u),h=r[++f]),s=o,0!==a&&(i[d++]=a);for(;c<t;)o=s+l,u=o-s,a=s-(o-u)+(l-u),l=n[++c],s=o,0!==a&&(i[d++]=a);for(;f<e;)o=s+h,u=o-s,a=s-(o-u)+(h-u),h=r[++f],s=o,0!==a&&(i[d++]=a);return 0===s&&0!==d||(i[d++]=s),d}function uc(t){return new Float64Array(t)}const lc=33306690738754716e-32,hc=22204460492503146e-32,cc=11093356479670487e-47,fc=uc(4),dc=uc(8),pc=uc(12),yc=uc(16),mc=uc(4);function gc(t,n,e,r,i,s){const o=(n-s)*(e-i),a=(t-i)*(r-s),u=o-a;if(0===o||0===a||o>0!=a>0)return u;const l=Math.abs(o+a);return Math.abs(u)>=lc*l?u:-function(t,n,e,r,i,s,o){let a,u,l,h,c,f,d,p,y,m,g,v,b,w,M,x,F,k;const A=t-i,P=e-i,S=n-s,_=r-s;w=A*_,f=sc*A,d=f-(f-A),p=A-d,f=sc*_,y=f-(f-_),m=_-y,M=p*m-(w-d*y-p*y-d*m),x=S*P,f=sc*S,d=f-(f-S),p=S-d,f=sc*P,y=f-(f-P),m=P-y,F=p*m-(x-d*y-p*y-d*m),g=M-F,c=M-g,fc[0]=M-(g+c)+(c-F),v=w+g,c=v-w,b=w-(v-c)+(g-c),g=b-x,c=b-g,fc[1]=b-(g+c)+(c-x),k=v+g,c=k-v,fc[2]=v-(k-c)+(g-c),fc[3]=k;let O=function(t,n){let e=n[0];for(let r=1;r<t;r++)e+=n[r];return e}(4,fc),C=hc*o;if(O>=C||-O>=C)return O;if(c=t-A,a=t-(A+c)+(c-i),c=e-P,l=e-(P+c)+(c-i),c=n-S,u=n-(S+c)+(c-s),c=r-_,h=r-(_+c)+(c-s),0===a&&0===u&&0===l&&0===h)return O;if(C=cc*o+oc*Math.abs(O),O+=A*h+_*a-(S*l+P*u),O>=C||-O>=C)return O;w=a*_,f=sc*a,d=f-(f-a),p=a-d,f=sc*_,y=f-(f-_),m=_-y,M=p*m-(w-d*y-p*y-d*m),x=u*P,f=sc*u,d=f-(f-u),p=u-d,f=sc*P,y=f-(f-P),m=P-y,F=p*m-(x-d*y-p*y-d*m),g=M-F,c=M-g,mc[0]=M-(g+c)+(c-F),v=w+g,c=v-w,b=w-(v-c)+(g-c),g=b-x,c=b-g,mc[1]=b-(g+c)+(c-x),k=v+g,c=k-v,mc[2]=v-(k-c)+(g-c),mc[3]=k;const E=ac(4,fc,4,mc,dc);w=A*h,f=sc*A,d=f-(f-A),p=A-d,f=sc*h,y=f-(f-h),m=h-y,M=p*m-(w-d*y-p*y-d*m),x=S*l,f=sc*S,d=f-(f-S),p=S-d,f=sc*l,y=f-(f-l),m=l-y,F=p*m-(x-d*y-p*y-d*m),g=M-F,c=M-g,mc[0]=M-(g+c)+(c-F),v=w+g,c=v-w,b=w-(v-c)+(g-c),g=b-x,c=b-g,mc[1]=b-(g+c)+(c-x),k=v+g,c=k-v,mc[2]=v-(k-c)+(g-c),mc[3]=k;const I=ac(E,dc,4,mc,pc);w=a*h,f=sc*a,d=f-(f-a),p=a-d,f=sc*h,y=f-(f-h),m=h-y,M=p*m-(w-d*y-p*y-d*m),x=u*l,f=sc*u,d=f-(f-u),p=u-d,f=sc*l,y=f-(f-l),m=l-y,F=p*m-(x-d*y-p*y-d*m),g=M-F,c=M-g,mc[0]=M-(g+c)+(c-F),v=w+g,c=v-w,b=w-(v-c)+(g-c),g=b-x,c=b-g,mc[1]=b-(g+c)+(c-x),k=v+g,c=k-v,mc[2]=v-(k-c)+(g-c),mc[3]=k;const $=ac(I,pc,4,mc,yc);return yc[$-1]}(t,n,e,r,i,s,l)}function vc(t,n,e){n=Math.max(0,void 0===n?2:n),e=e||0;var r=function(t){for(var n=t[0],e=t[0],r=t[0],i=t[0],s=0;s<t.length;s++){var o=t[s];o[0]<n[0]&&(n=o),o[0]>r[0]&&(r=o),o[1]<e[1]&&(e=o),o[1]>i[1]&&(i=o)}var a=[n,e,r,i],u=a.slice();for(s=0;s<t.length;s++)rc(t[s],a)||u.push(t[s]);return function(t){t.sort(Cc);for(var n=[],e=0;e<t.length;e++){for(;n.length>=2&&kc(n[n.length-2],n[n.length-1],t[e])<=0;)n.pop();n.push(t[e])}for(var r=[],i=t.length-1;i>=0;i--){for(;r.length>=2&&kc(r[r.length-2],r[r.length-1],t[i])<=0;)r.pop();r.push(t[i])}return r.pop(),n.pop(),n.concat(r)}(u)}(t),i=new Nh(16);i.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},i.compareMinX=function(t,n){return t[0]-n[0]},i.compareMinY=function(t,n){return t[1]-n[1]},i.load(t);for(var s,o=[],a=0;a<r.length;a++){var u=r[a];i.remove(u),s=Pc(u,s),o.push(s)}var l=new Nh(16);for(a=0;a<o.length;a++)l.insert(Ac(o[a]));for(var h=n*n,c=e*e;o.length;){var f=o.shift(),d=f.p,p=f.next.p,y=Sc(d,p);if(!(y<c)){var m=y/h;(u=bc(i,f.prev.p,d,p,f.next.next.p,m,l))&&Math.min(Sc(u,d),Sc(u,p))<=m&&(o.push(f),o.push(Pc(u,f)),i.remove(u),l.remove(f),l.insert(Ac(f)),l.insert(Ac(f.next)))}}f=s;var g=[];do{g.push(f.p),f=f.next}while(f!==s);return g.push(f.p),g}function bc(t,n,e,r,i,s,o){for(var a=new xn([],wc),u=t.data;u;){for(var l=0;l<u.children.length;l++){var h=u.children[l],c=u.leaf?_c(h,e,r):Mc(e,r,h);c>s||a.push({node:h,dist:c})}for(;a.length&&!a.peek().node.children;){var f=a.pop(),d=f.node,p=_c(d,n,e),y=_c(d,r,i);if(f.dist<p&&f.dist<y&&Fc(e,d,o)&&Fc(r,d,o))return d}(u=a.pop())&&(u=u.node)}return null}function wc(t,n){return t.dist-n.dist}function Mc(t,n,e){if(xc(t,e)||xc(n,e))return 0;var r=Oc(t[0],t[1],n[0],n[1],e.minX,e.minY,e.maxX,e.minY);if(0===r)return 0;var i=Oc(t[0],t[1],n[0],n[1],e.minX,e.minY,e.minX,e.maxY);if(0===i)return 0;var s=Oc(t[0],t[1],n[0],n[1],e.maxX,e.minY,e.maxX,e.maxY);if(0===s)return 0;var o=Oc(t[0],t[1],n[0],n[1],e.minX,e.maxY,e.maxX,e.maxY);return 0===o?0:Math.min(r,i,s,o)}function xc(t,n){return t[0]>=n.minX&&t[0]<=n.maxX&&t[1]>=n.minY&&t[1]<=n.maxY}function Fc(t,n,e){for(var r,i,s,o,a=Math.min(t[0],n[0]),u=Math.min(t[1],n[1]),l=Math.max(t[0],n[0]),h=Math.max(t[1],n[1]),c=e.search({minX:a,minY:u,maxX:l,maxY:h}),f=0;f<c.length;f++)if(r=c[f].p,i=c[f].next.p,s=t,r!==(o=n)&&i!==s&&kc(r,i,s)>0!=kc(r,i,o)>0&&kc(s,o,r)>0!=kc(s,o,i)>0)return!1;return!0}function kc(t,n,e){return gc(t[0],t[1],n[0],n[1],e[0],e[1])}function Ac(t){var n=t.p,e=t.next.p;return t.minX=Math.min(n[0],e[0]),t.minY=Math.min(n[1],e[1]),t.maxX=Math.max(n[0],e[0]),t.maxY=Math.max(n[1],e[1]),t}function Pc(t,n){var e={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return n?(e.next=n.next,e.prev=n,n.next.prev=e,n.next=e):(e.prev=e,e.next=e),e}function Sc(t,n){var e=t[0]-n[0],r=t[1]-n[1];return e*e+r*r}function _c(t,n,e){var r=n[0],i=n[1],s=e[0]-r,o=e[1]-i;if(0!==s||0!==o){var a=((t[0]-r)*s+(t[1]-i)*o)/(s*s+o*o);a>1?(r=e[0],i=e[1]):a>0&&(r+=s*a,i+=o*a)}return(s=t[0]-r)*s+(o=t[1]-i)*o}function Oc(t,n,e,r,i,s,o,a){var u,l,h,c,f=e-t,d=r-n,p=o-i,y=a-s,m=t-i,g=n-s,v=f*f+d*d,b=f*p+d*y,w=p*p+y*y,M=f*m+d*g,x=p*m+y*g,F=v*w-b*b,k=F,A=F;0===F?(l=0,k=1,c=x,A=w):(c=v*x-b*M,(l=b*x-w*M)<0?(l=0,c=x,A=w):l>k&&(l=k,c=x+b,A=w)),c<0?(c=0,-M<0?l=0:-M>v?l=k:(l=-M,k=v)):c>A&&(c=A,-M+b<0?l=0:-M+b>v?l=k:(l=-M+b,k=v));var P=(1-(h=0===c?0:c/A))*i+h*o-((1-(u=0===l?0:l/k))*t+u*e),S=(1-h)*s+h*a-((1-u)*n+u*r);return P*P+S*S}function Cc(t,n){return t[0]===n[0]?t[1]-n[1]:t[0]-n[0]}class Ec{constructor(t,n){this.x=t,this.y=n}clone(){return new Ec(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 Ec(this.x-t.x,this.y-t.y)}distance(t){const n=this.x-t.x,e=this.y-t.y;return Math.sqrt(n*n+e*e)}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 Ec(this.y,-this.x)}}function Ic(t,n,e,r){const i=n.x*r.y-n.y*r.x,s=e.x-t.x,o=e.y-t.y,a=(s*r.y-o*r.x)/i;return new Ec(t.x+a*n.x,t.y+a*n.y)}const $c=[],Tc=[];function Dc(t){if(k(t[0]&&t[0].x)){const n=[];let e=0;for(let r=0;r<t.length;r++)Tc[e]?(Tc[e][0]=t[r].x,Tc[e][1]=t[r].y):Tc[e]=[t[r].x,t[r].y],n.push(Tc[e]),e++;t=n}try{const n=vc(t,1/0);let e=[1/0,1/0],r=[-1/0,-1/0];for(let t=0;t<n.length;t++)n[t][0]<e[0]&&(e[0]=n[t][0]),n[t][0]>r[0]&&(r[0]=n[t][0]),n[t][1]<e[1]&&(e[1]=n[t][1]),n[t][1]>r[1]&&(r[1]=n[t][1]);const i=[];let s=[],o=0;for(let t=0;t<n.length;t++)t===n.length-1&&n[t][0]===n[0][0]&&n[t][1]===n[0][1]||(Bl(i,n[t],"EPSG:3857"),$c[o]?($c[o].x=i[0],$c[o].y=i[1]):$c[o]=new Ec(i[0],i[1]),s.push($c[o]),o++);wl.calculateSignedArea(s)<0&&(s=s.reverse());const a=function(t){let n,e=Number.MAX_VALUE;const r=function(t,r,i,s,o,a,u,l){var h=Ic(t,r,o,a),c=Ic(i,s,o,a),f=Ic(u,l,t,r),d=Ic(u,l,i,s),p=h.distance(c)*h.distance(f);0!==p&&p<e&&(n=[h,f,d,c],e=p)};var i=[];for(let n=0;n<t.length;n++)i.push(t[(n+1)%t.length].diff(t[n])),i[n].normalize();var s,o,a,u,l=new Ec(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new Ec(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let n=0;n<t.length;n++){var c=t[n];c.x<l.x&&(l.x=c.x,s=n),c.x>h.x&&(h.x=c.x,o=n),c.y<l.y&&(l.y=c.y,u=n),c.y>h.y&&(h.y=c.y,a=n)}var f=new Ec(0,-1),d=new Ec(0,1),p=new Ec(-1,0),y=new Ec(1,0);for(let n=0;n<t.length;n++){var m=[Math.acos(f.dot(i[s])),Math.acos(d.dot(i[o])),Math.acos(p.dot(i[a])),Math.acos(y.dot(i[u]))];switch(m.indexOf(Math.min.apply(Math,m))){case 0:(d=(f=i[s].clone()).clone()).negate(),(y=(p=f.orthogonal()).clone()).negate(),s=(s+1)%t.length;break;case 1:(f=(d=i[o].clone()).clone()).negate(),(y=(p=f.orthogonal()).clone()).negate(),o=(o+1)%t.length;break;case 2:(y=(p=i[a].clone()).clone()).negate(),(d=(f=y.orthogonal()).clone()).negate(),a=(a+1)%t.length;break;case 3:(p=(y=i[u].clone()).clone()).negate(),(d=(f=y.orthogonal()).clone()).negate(),u=(u+1)%t.length}r(t[s],f,t[o],d,t[a],p,t[u],y)}return n}(s);if(!a||4!==a.length)return null;const u=a[0].distance(a[1]),l=a[1].distance(a[2]),h=a.map((t=>[t.x,t.y]));return h.push(+(l>u)),h}catch(t){return null}}const zc=[];function jc(t,n){const e=Array.isArray(t&&t[0]&&t[0][0]);for(let r=0;r<t.length;r++)e?t[r]=jc(t[r]):(Bl(zc,t[r],n),t[r][0]=zc[0],t[r][1]=zc[1]);return t}class Uc extends yh{constructor(t,n,e,r,i,s){super(t,n,e,r,i),(n=n||{}).extent||(n.extent=8192),this.setData(n.data,s)}setData(t,n){if(delete this.index,function(t){if(!t)return!0;if(Array.isArray(t)&&!t.length)return!0;if(t.features&&!t.features.length)return!0;return!1}(t))return this.empty=!0,void n();const e={maxZoom:24,tolerance:this.options.simplifyTolerance,extent:this.options.extent,buffer:k(this.options.tileBuffer)?this.options.tileBuffer:64,hasAltitude:!!this.options.hasAltitude,debug:0,lineMetrics:!0,indexMaxZoom:5,indexMaxPoints:1e5,disableFilter:!0};if(this.options.projection&&(e.projection=this.options.projection,"EPSG:4490"===e.projection&&(e.projection="EPSG:4326")),F(t)&&"{"!=t.substring(0,1)||t.url){const r=t.url?t.url:t;C.getJSON(r,t.url?t:{},((t,i)=>{if(t&&(console.error("Failed to fetch geojson:"+r),n(t)),!i)return void n(null,{extent:null,idMap:{}});let s=i;if(this.options.convertFn){s=new Function("data",this.options.convertFn+"\\nreturn convert(data)")(s)}const o=Array.isArray(s)?s:s.features;this._n(o);const{sample1000:a,idMap:u}=this.On(o);this.Cn(a,u,s,e,n)}))}else{"string"==typeof t&&(t=JSON.parse(t));const r=Array.isArray(t)?t:t.features,i=r&&r.length;this._n(r);let s=r;if(r&&i>1e3){s=[];for(let t=0;t<i;t++)Nc(r[t],s,t,i)}this.Cn(s,null,t,e,n)}}_n(t){if(this.options.generateOMBB&&t)for(let n=0;n<t.length;n++){const e=t[n];if(e&&e.geometry&&e.geometry.coordinates)if("Polygon"===e.geometry.type){const t=e.geometry.coordinates[0];if(!t)continue;const n=Dc(t,t.length);e.properties=e.properties||{},e.properties[th]=n}else if("MultiPolygon"===e.geometry.type){const t=e.geometry.coordinates;for(let n=0;n<t.length;n++){if(!t[n])continue;const r=t[n][0];if(!r)continue;const i=Dc(r,r.length);e.properties=e.properties||{},e.properties[th]=e.properties[th]||[],e.properties[th][n]=i}}}}Cn(t,n,e,r,i){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":const e=t.features.length;for(let r=0;r<e;r++)Ch(t.features[r],n);break;case"Feature":Ch(t,n);break;default:Eh(t,n)}return n}({type:"FeatureCollection",features:t}):null;this.index=function(t,n){return new ot(t,n)}(e,this.options.geojsonvt||r),i(null,{extent:s,idMap:n})}catch(t){console.warn(t),i({error:t.message})}}On(t){const n=[],e={};let r=0;const i=this.options.featureIdProperty;if(t){const s=t.length;t.forEach(((t,o)=>{!function(t,s,o){if(t&&("Feature"!==t.type||t.geometry)){if(k(t.id)||(t.id=r++),i){let n=i;P(i)&&(n=i[t.layer||"0"]),t.id=t.properties[n]}e[t.id]=x({},t),t.geometry?(e[t.id].geometry=x({},t.geometry),e[t.id].geometry.coordinates=null):t.coordinates&&(e[t.id].coordinates=null),Nc(t,n,s,o)}}(t,o,s)}))}return{sample1000:n,idMap:e}}getTileFeatures(t,n){const e=t.tileInfo,r=[];if(!this.index)return this.empty?(setTimeout((function(){n(null,r,[])}),1),1):(setTimeout((function(){n({loading:!0})}),1),1);const i=this.index.getTile(e.z,e.x,e.y);if(!i||0===i.features.length)return setTimeout((function(){n(null,r,[])}),1),1;const s=[];for(let t=0,n=i.features.length;t<n;t++){const n=i.features[t];let e=n.layer;void 0===e&&(e="0"),s[e]={types:{}};s[e].types[n.type]=1,n.tags=n.tags||{},n.geometry.converted||(wl.convertGeometry(n),n.geometry.converted=1),r.push({type:n.type,layer:e,id:n.id,geometry:n.geometry,properties:n.tags,extent:this.options.extent})}for(const t in s)s[t].types=Object.keys(s[t].types).map((t=>+t));return setTimeout((function(){n(null,r,s)}),1),1}onRemove(){super.onRemove(),delete this.index}}function Nc(t,n,e,r){const i=Math.floor(r/998);(0===e||e===r-1||(0===i||e%i==0)&&n.length<999)&&n.push(t)}var Lc=ct,Rc=Vc;function Vc(t,n,e,r,i){this.properties={},this.extent=e,this.type=0,this.En=t,this.In=-1,this.$n=r,this.Tn=i,t.readFields(Hc,this,n)}function Hc(t,n,e){1==t?n.id=e.readVarint():2==t?function(t,n){var e=t.readVarint()+t.pos;for(;t.pos<e;){var r=n.$n[t.readVarint()],i=n.Tn[t.readVarint()];n.properties[r]=i}}(e,n):3==t?n.type=e.readVarint():4==t&&(n.In=e.pos)}function qc(t){for(var n,e,r=0,i=0,s=t.length,o=s-1;i<s;o=i++)n=t[i],r+=((e=t[o]).x-n.x)*(n.y+e.y);return r}Vc.types=["Unknown","Point","LineString","Polygon"],Vc.prototype.loadGeometry=function(){var t=this.En;t.pos=this.In;for(var n,e=t.readVarint()+t.pos,r=1,i=0,s=0,o=0,a=[];t.pos<e;){if(i<=0){var u=t.readVarint();r=7&u,i=u>>3}if(i--,1===r||2===r)s+=t.readSVarint(),o+=t.readSVarint(),1===r&&(n&&a.push(n),n=[]),n.push(new Lc(s,o));else{if(7!==r)throw new Error("unknown command "+r);n&&n.push(n[0].clone())}}return n&&a.push(n),a},Vc.prototype.bbox=function(){var t=this.En;t.pos=this.In;for(var n=t.readVarint()+t.pos,e=1,r=0,i=0,s=0,o=1/0,a=-1/0,u=1/0,l=-1/0;t.pos<n;){if(r<=0){var h=t.readVarint();e=7&h,r=h>>3}if(r--,1===e||2===e)(i+=t.readSVarint())<o&&(o=i),i>a&&(a=i),(s+=t.readSVarint())<u&&(u=s),s>l&&(l=s);else if(7!==e)throw new Error("unknown command "+e)}return[o,u,a,l]},Vc.prototype.toGeoJSON=function(t,n,e){var r,i,s=this.extent*Math.pow(2,e),o=this.extent*t,a=this.extent*n,u=this.loadGeometry(),l=Vc.types[this.type];function h(t){for(var n=0;n<t.length;n++){var e=t[n],r=180-360*(e.y+a)/s;t[n]=[360*(e.x+o)/s-180,360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90]}}switch(this.type){case 1:var c=[];for(r=0;r<u.length;r++)c[r]=u[r][0];h(u=c);break;case 2:for(r=0;r<u.length;r++)h(u[r]);break;case 3:for(u=function(t){var n=t.length;if(n<=1)return[t];for(var e,r,i=[],s=0;s<n;s++){var o=qc(t[s]);0!==o&&(void 0===r&&(r=o<0),r===o<0?(e&&i.push(e),e=[t[s]]):e.push(t[s]))}e&&i.push(e);return i}(u),r=0;r<u.length;r++)for(i=0;i<u[r].length;i++)h(u[r][i])}1===u.length?u=u[0]:l="Multi"+l;var f={type:"Feature",geometry:{type:l,coordinates:u},properties:this.properties};return"id"in this&&(f.id=this.id),f};var Gc=Rc,Jc=Wc;function Wc(t,n){this.version=1,this.name=null,this.extent=4096,this.length=0,this.En=t,this.$n=[],this.Tn=[],this.Dn=[],t.readFields(Bc,this,n),this.length=this.Dn.length}function Bc(t,n,e){15===t?n.version=e.readVarint():1===t?n.name=e.readString():5===t?n.extent=e.readVarint():2===t?n.Dn.push(e.pos):3===t?n.$n.push(e.readString()):4===t&&n.Tn.push(function(t){var n=null,e=t.readVarint()+t.pos;for(;t.pos<e;){var r=t.readVarint()>>3;n=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return n}(e))}Wc.prototype.feature=function(t){if(t<0||t>=this.Dn.length)throw new Error("feature index out of bounds");this.En.pos=this.Dn[t];var n=this.En.readVarint()+this.En.pos;return new Gc(this.En,n,this.extent,this.$n,this.Tn)};var Xc=Jc;function Yc(t,n,e){if(3===t){var r=new Xc(e,e.readVarint()+e.pos);r.length&&(n[r.name]=r)}}var Kc=function(t,n){this.layers=t.readFields(Yc,{},n)};class Zc extends yh{constructor(t,n,e,r,i,s){super(t,n,e,r,i),n=n||{},s()}getTileFeatures(t,n){const e=t.tileInfo.url,r=t.fetchOptions||{};if(this.Gt.has(e)){const{err:t,data:r}=this.Gt.get(e);return setTimeout((()=>{this.zn(e,t,r,n)}),1)}return r.referrer=t.referrer,C.getArrayBuffer(e,r,((t,r)=>{this.Gt&&(t?t.loading||this.Gt.add(e,{err:t,data:r&&r.data}):r&&r.data&&this.Gt.add(e,{err:null,data:r.data}),this.zn(e,t,r&&r.data,n))}))}zn(t,n,e,r){if(n)return void r(n);let i;try{i=new Kc(new Hl(e))}catch(n){return void r(n.message,[],[])}const s=[];if(!i.layers)return void r(null,s,[]);const o={};let a;for(const t in i.layers)if(u=i.layers,l=t,Object.prototype.hasOwnProperty.call(u,l)){o[t]={types:{}};const e=o[t].types;for(let r=0,o=i.layers[t].length;r<o;r++)try{a=i.layers[t].feature(r),e[a.type]=1;const n={type:a.type,layer:t,geometry:a.loadGeometry(),properties:a.properties,extent:a.extent};void 0!==a.id&&(n.id=a.id);let o=n.properties[th];o&&(F(o)&&(o=JSON.parse(o)),n.properties[th]=jc(o,"EPSG:3857")),s.push(n)}catch(n){console.warn("error when load vt geometry:",n)}}var u,l;for(const t in o)o[t].types=Object.keys(o[t].types).map((t=>+t));r(null,s,o,{byteLength:e.byteLength})}abortTile(t,n){const e=this.requests[t];delete this.requests[t],e&&e.abort&&e.abort(),this.an(t),n()}onRemove(){super.onRemove();for(const t in this.requests){const n=this.requests[t];n&&n.abort&&n.abort()}this.requests={}}}let Qc=0;const tf=new fl(128);class nf{constructor(t){this.jn={},this.Un={},this.workerId=t}addLayer({actorId:t,mapId:n,layerId:e,params:r},i){if(this.Nn(n,e))return;const s=this.Ln(n,e),o=r.type,a=r.options,u=this.send.bind(this,t);this.jn[s]="GeoJSONVectorTileLayer"===o?new Uc(e,a,u,tf,{},i):new Zc(e,a,u,tf,{},i)}removeLayer({mapId:t,layerId:n},e){const r=this.Nn(t,n),i=this.Ln(t,n);delete this.jn[i],r&&r.onRemove(e)}loadTile({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.loadTile(e,r)}abortTile({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.abortTile&&i.abortTile(e.url,r)}removeTile({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.removeTile(e,r)}updateStyle({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.updateStyle(e,r)}updateOptions({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.updateOptions(e,r)}setData({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.setData(e.data,r)}receive(t){const n=t.callback,e=this.Un[n];delete this.Un[n],e&&t.error?e(new Error(t.error)):e&&e(null,t.data)}send(t,n,e,r,i){const s=i?\`${o}t}-${o}Qc++}\`:null;i&&(this.Un[s]=i),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:n,params:e,callback:String(s)},r||[])}Ln(t,n){return\`${o}t}-${o}n}\`}Nn(t,n){const e=this.Ln(t,n);return this.jn[e]}Rn(){tf.reset()}}t.initialize=function(){},t.onmessage=function(t,n){const e=t.data;if(this.dispatcher||(this.dispatcher=new nf(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const r=e.command;this.dispatcher[r]({actorId:t.actorId,mapId:e.mapId,layerId:e.layerId,params:e.params},((t,e,i)=>{t&&404!==t.status&&204!==t.status&&!t.loading&&console.error(r,t),n(t,e,i)}))}}}`;
24
+ const o = "${", a = `function(t){let n;const e={width:100,height:10};function r(){if(!n){const{width:t,height:r}=e;OffscreenCanvas?n=new OffscreenCanvas(t,r):(n=document.createElement("canvas"),n.width=t,n.height=r)}return n}class i{constructor(t,n={}){if(!Array.isArray(t))return void console.error("colors is not array");if(t.length<2)return void console.error("colors.length should >1");this.colors=t;let r=1/0,i=-1/0;for(let n=0,e=t.length;n<e;n++){const e=t[n][0];r=Math.min(e,r),i=Math.max(e,i)}this.min=r,this.max=i,this.valueOffset=this.max-this.min,this.options=Object.assign({},e,n),this.t()}getImageData(){return this.imgData}t(){const t=r(),{width:n,height:e}=this.options;t.width=n,t.height=e;const i=t.getContext("2d");i.clearRect(0,0,t.width,t.height);const s=i.createLinearGradient(0,0,t.width,0),{colors:o,valueOffset:a}=this;for(let t=0,n=o.length;t<n;t++){const[n,e]=o[t],r=(n-this.min)/a;s.addColorStop(r,e)}i.fillStyle=s,i.fillRect(0,0,t.width,t.height),this.imgData=i.getImageData(0,0,t.width,t.height)}getColor(t){t=Math.max(this.min,t);const n=((t=Math.min(t,this.max))-this.min)/this.valueOffset;let e=Math.round(n*this.imgData.width);e=Math.min(e,this.imgData.width-1);const r=4*e;return[this.imgData.data[r],this.imgData.data[r+1],this.imgData.data[r+2],this.imgData.data[r+3]]}}var s;function o(t,n){var e,r,i;if(y(t)){var s,h=t.stops&&"object"==typeof t.stops[0][0],d=h||void 0!==t.property,p=h||!d,m=t.type||n||"exponential";if("exponential"===m)s=l;else if("interval"===m)s=u;else if("categorical"===m)s=a;else if("identity"===m)s=f;else{if("color-interpolate"!==m)throw new Error('Unknown function type "'+m+'"');s=c}if(h){var g={},v=[];for(let n=0;n<t.stops.length;n++){var b=t.stops[n];void 0===g[b[0].zoom]&&(g[b[0].zoom]={zoom:b[0].zoom,type:t.type,property:t.property,default:t.default,stops:[]}),g[b[0].zoom].stops.push([b[0].value,b[1]])}for(let t in g)v.push([g[t].zoom,o(g[t])]);e=function(n,e){const r=l({stops:v,base:t.base},n)(n,e);return"function"==typeof r?r(n,e):r},r=!1,i=!1}else p?(e=function(n){const e=s(t,n);return"function"==typeof e?e(n):e},r=!0,i=!1):(e=function(n,e){const r=s(t,e?e[t.property]:null);return"function"==typeof r?r(n,e):r},r=!1,i=!0)}else e=function(){return t},r=!0,i=!0;return e.isZoomConstant=i,e.isFeatureConstant=r,e}function a(t,n){for(let e=0;e<t.stops.length;e++)if(n===t.stops[e][0])return t.stops[e][1];return t.default}function u(t,n){for(var e=0;e<t.stops.length&&!(n<t.stops[e][0]);e++);return t.stops[Math.max(e-1,0)][1]}function l(t,n){for(var e=void 0!==t.base?t.base:1,r=0;!(r>=t.stops.length||n<=t.stops[r][0]);)r++;return 0===r?t.stops[r][1]:r===t.stops.length?t.stops[r-1][1]:d(n,e,t.stops[r-1][0],t.stops[r][0],t.stops[r-1][1],t.stops[r][1])}"function"==typeof Map&&(s=new Map);const h={width:100,height:1};function c(t,n){const e=t.stops;if(e&&e.length>1){let t;if(s){const n=JSON.stringify(e);if(!s.has(n)){const t=new i(e,h);s.set(n,t)}t=s.get(n)}else t=new i(e,h);const[r,o,a,u]=t.getColor(n);return[r/255,o/255,a/255,u/255]}return e&&1===e.length?e[0][1]:null}function f(t,n){return function(t,n,e){return void 0!==t?t:void 0!==n?n:null}(n,t.default)}function d(t,n,e,r,i,s){return"function"==typeof i?function(){var o=i.apply(void 0,arguments),a=s.apply(void 0,arguments);return d(t,n,e,r,o,a)}:i.length?function(t,n,e,r,i,s){var o=[];for(let a=0;a<i.length;a++)o[a]=p(t,n,e,r,i[a],s[a]);return o}(t,n,e,r,i,s):p(t,n,e,r,i,s)}function p(t,n,e,r,i,s){var o,a=r-e,u=t-e;return i*(1-(o=1===n?u/a:(Math.pow(n,u)-1)/(Math.pow(n,a)-1)))+s*o}function y(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type)}function m(t){return b(t,"exponential")}function g(t){return b(t,"interval")}function v(t,n){if(!t)return null;var e=!1;if(Array.isArray(t)){var r,i=[];for(let s=0;s<t.length;s++)(r=v(t[s],n))?(i.push(r),e=!0):i.push(t[s]);return e?i:t}var s,o={__fn_types_loaded:!0},a=[];for(s in t)t.hasOwnProperty(s)&&a.push(s);const u=function(t){Object.defineProperty(o,t,{get:function(){return this["__fn_"+t]||(this["__fn_"+t]=m(this["_"+t])),this["__fn_"+t].apply(this,n())},set:function(n){this["_"+t]=n},configurable:!0,enumerable:!0})};for(let n=0,r=a.length;n<r;n++)y(t[s=a[n]])?(e=!0,o["_"+s]=t[s],u(s)):o[s]=t[s];return e?o:t}function b(t,n){if(!y(t))return function(){return t};let e=!0,r=!0;const i=(t=JSON.parse(JSON.stringify(t))).stops;if(i)for(let t=0;t<i.length;t++)if(y(i[t][1])){const s=b(i[t][1],n);e=e&&s.isZoomConstant,r=r&&s.isFeatureConstant,i[t]=[i[t][0],s]}const s=o(t,n);return s.isZoomConstant=e&&s.isZoomConstant,s.isFeatureConstant=r&&s.isFeatureConstant,s}let w=0;const M="function"==typeof Object.assign;function x(t,...n){if(M)return Object.assign(t,...n),t;for(let e=0;e<n.length;e++){const r=n[e];for(const n in r)t[n]=r[n]}return t}function F(t){return!S(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function k(t){return"number"==typeof t&&!isNaN(t)}function A(t){return!S(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function P(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function S(t){return null==t}function _(t){return y(t)&&t.property}const O="function"==typeof fetch&&"function"==typeof AbortController,C={jsonp:function(t,n){const e="_maptalks_jsonp_"+w++;t.match(/\\?/)?t+="&callback="+e:t+="?callback="+e;let r=document.createElement("script");return r.type="text/javascript",r.src=t,window[e]=function(t){n(null,t),document.getElementsByTagName("head")[0].removeChild(r),r=null,delete window[e]},document.getElementsByTagName("head")[0].appendChild(r),this},get:function(t,n,e){if(A(n)){const t=e;e=n,n=t}(n=n||{}).method&&(n.method=n.method.toUpperCase());const r="POST"===n.method;if(O){const r=new AbortController,i=n;i.signal=r.signal,i.referrerPolicy=i.referrerPolicy||"origin",i.method=i.method||"GET";const s=new Request(t,i);return n.returnJSON&&s.headers.set("Accept","application/json"),fetch(s).then((r=>{const i=this.o(r,n.returnJSON,n.responseType);i.message?(i.url=t,e(i)):i.then((t=>{"arraybuffer"===n.responseType?e(null,{data:t,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires"),contentType:r.headers.get("Content-Type")}):e(null,t)})).catch((n=>{n.code&&n.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,n),e(n))}))})).catch((n=>{n.code&&n.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,n),e(n))})),r}{const i=C.u(e);if(i.open(n.method||"GET",t,!0),n){for(const t in n.headers)i.setRequestHeader(t,n.headers[t]);i.withCredentials="include"===n.credentials,n.responseType&&(i.responseType=n.responseType)}return i.send(r?n.body:null),i}},o:(t,n,e)=>200!==t.status?{status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${o}t.status}): ${o}t.statusText}\`}:"arraybuffer"===e?t.arrayBuffer():n?t.json():t.text(),m: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(${o}t.status}): ${o}t.statusText}\`})}},u: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.m(n,t),n},getArrayBuffer(t,n,e){if(A(n)){const t=e;e=n,n=t}return n||(n={}),n.responseType="arraybuffer",C.get(t,n,e)}};function E(t,n,e,r,i=3){let s=r;const o=e-n>>1;let a,u=e-n;const l=t[n],h=t[n+1],c=t[e],f=t[e+1];for(let r=n+i;r<e;r+=i){const n=I(t[r],t[r+1],l,h,c,f);if(n>s)a=r,s=n;else if(n===s){const t=Math.abs(r-o);t<u&&(a=r,u=t)}}s>r&&(a-n>i&&E(t,n,a,r,i),t[a+2]=s,e-a>i&&E(t,a,e,r,i))}function I(t,n,e,r,i,s){let o=i-e,a=s-r;if(0!==o||0!==a){const u=((t-e)*o+(n-r)*a)/(o*o+a*a);u>1?(e=i,r=s):u>0&&(e+=o*u,r+=a*u)}return o=t-e,a=n-r,o*o+a*a}function $(t,n,e,r,i,s){const o={id:null==t?null:t,type:n,geometry:e,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};i&&(o.layer=i);return function(t,n){const e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)T(t,e,n);else if("Polygon"===r)T(t,e[0],n);else if("MultiLineString"===r)for(const r of e)T(t,r,n);else if("MultiPolygon"===r)for(const r of e)T(t,r[0],n)}(o,s?4:3),o}function T(t,n,e){for(let r=0;r<n.length;r+=e)t.minX=Math.min(t.minX,n[r]),t.minY=Math.min(t.minY,n[r+1]),t.maxX=Math.max(t.maxX,n[r]),t.maxY=Math.max(t.maxY,n[r+1])}function D(t,n,e,r){if(r.layer=n,"FeatureCollection"===e.type)for(let n=0;n<e.features.length;n++)z(t,e.features[n],r,n);else"Feature"===e.type?z(t,e,r):z(t,{geometry:e},r)}function z(t,n,e,r){if(!n.geometry)return;const i=n.geometry.coordinates,s=n.geometry.type,o=Math.pow(e.tolerance/((1<<e.maxZoom)*e.extent),2);let a=[],u=n.id;if(e.promoteId?u=n.properties[e.promoteId]:e.generateId&&(u=r||0),"Point"===s)j(i,a,e);else if("MultiPoint"===s)for(const t of i)j(t,a,e);else if("LineString"===s)U(i,a,o,!1,e);else if("MultiLineString"===s){if(e.lineMetrics){for(const r of i)a=[],U(r,a,o,!1,e),t.push($(u,"LineString",a,n.properties,e.layer,e.hasAltitude));return}N(i,a,o,!1,e)}else if("Polygon"===s)N(i,a,o,!0,e);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(const i of n.geometry.geometries)z(t,{id:u,geometry:i,properties:n.properties},e,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const t of i){const n=[];N(t,n,o,!0,e),a.push(n)}}t.push($(u,s,a,n.properties,e.layer,e.hasAltitude))}function j(t,n,e){n.push(L(t[0]),R(t[1],e.projection),0),e.hasAltitude&&(t.length>2?n.push(t[2]):n.push(0))}function U(t,n,e,r,i){let s,o,a=0;for(let e=0;e<t.length;e++){const u=L(t[e][0]),l=R(t[e][1],i.projection);n.push(u,l,0),i.hasAltitude&&(t[e].length>2?n.push(t[e][2]):n.push(0)),e>0&&(a+=r?(s*l-u*o)/2:Math.sqrt(Math.pow(u-s,2)+Math.pow(l-o,2))),s=u,o=l}const u=i.hasAltitude?4:3,l=n.length-u;n[2]=1,E(n,0,l,e,u),n[l+2]=1,n.size=Math.abs(a),n.start=0,n.end=n.size}function N(t,n,e,r,i){for(let s=0;s<t.length;s++){const o=[];U(t[s],o,e,r,i),n.push(o)}}function L(t){return t/360+.5}function R(t,n){if("EPSG:4326"===n)return(90-t)/360;const e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function V(t,n,e,r,i,s,o,a){if(r/=n,s>=(e/=n)&&o<r)return t;if(o<e||s>=r)return null;const u=[];for(const n of t){const t=n.geometry;let s=n.type;const o=0===i?n.minX:n.minY,l=0===i?n.maxX:n.maxY;if(o>=e&&l<r){u.push(n);continue}if(l<e||o>=r)continue;let h=[];if("Point"===s||"MultiPoint"===s)H(t,h,e,r,i,a.hasAltitude);else if("LineString"===s)q(t,h,e,r,i,!1,a.lineMetrics,a.hasAltitude);else if("MultiLineString"===s)J(t,h,e,r,i,!1,a.hasAltitude);else if("Polygon"===s)J(t,h,e,r,i,!0,a.hasAltitude);else if("MultiPolygon"===s)for(const n of t){const t=[];J(n,t,e,r,i,!0,a.hasAltitude),t.length&&h.push(t)}if(h.length){if(a.lineMetrics&&"LineString"===s){for(const t of h)u.push($(n.id,s,t,n.tags,n.layer,a.hasAltitude));continue}"LineString"!==s&&"MultiLineString"!==s||(1===h.length?(s="LineString",h=h[0]):s="MultiLineString"),"Point"!==s&&"MultiPoint"!==s||(s=3===h.length?"Point":"MultiPoint"),u.push($(n.id,s,h,n.tags,n.layer,a.hasAltitude))}}return u.length?u:null}function H(t,n,e,r,i,s){const o=s?4:3;for(let a=0;a<t.length;a+=o){const o=t[a+i];o>=e&&o<=r&&(W(n,t[a],t[a+1],t[a+2]),s&&n.push(t[a+3]))}}function q(t,n,e,r,i,s,o,a){let u=G(t);const l=0===i?B:X;let h,c,f=t.start;const d=a?4:3,p=s?t.length:t.length-d;for(let y=0;y<p;y+=d){const m=t[y],g=t[y+1],v=t[y+2];let b,w,M,x;s&&y===p-d?(b=t[0],w=t[1]):(b=t[y+d],w=t[y+d+1]),a&&(M=t[y+3],x=s&&y===p-d?t[3]:t[y+d+3]);const F=0===i?m:g,k=0===i?b:w;let A=!1;o&&(h=Math.sqrt(Math.pow(m-b,2)+Math.pow(g-w,2))),F<e?k>e&&(c=l(u,m,g,b,w,e),a&&u.push(Y(M,x,c)),o&&(u.start=f+h*c)):F>r?k<r&&(c=l(u,m,g,b,w,r),a&&u.push(Y(M,x,c)),o&&(u.start=f+h*c)):(W(u,m,g,v),a&&u.push(M)),k<e&&F>=e&&(c=l(u,m,g,b,w,e),a&&u.push(Y(M,x,c)),A=!0),k>r&&F<=r&&(c=l(u,m,g,b,w,r),a&&u.push(Y(M,x,c)),A=!0),!s&&A&&(o&&(u.end=f+h*c),n.push(u),u=G(t)),o&&(f+=h)}let y=t.length-d;if(!s){const n=t[y],s=t[y+1],o=t[y+2],l=0===i?n:s;if(l>=e&&l<=r&&W(u,n,s,o),l>=e&&l<=r&&a){const n=t[y+3];u.push(n)}}y=u.length-d,s&&y>=d&&(u[y]!==u[0]||u[y+1]!==u[1])&&(W(u,u[0],u[1],u[2]),a&&u.push(u[3])),u.length&&n.push(u)}function G(t){const n=[];return n.size=t.size,n.start=t.start,n.end=t.end,n}function J(t,n,e,r,i,s,o){for(const a of t)q(a,n,e,r,i,s,!1,o)}function W(t,n,e,r){t.push(n,e,r)}function B(t,n,e,r,i,s){const o=(s-n)/(r-n);return W(t,s,e+(i-e)*o,1),o}function X(t,n,e,r,i,s){const o=(s-e)/(i-e);return W(t,n+(r-n)*o,s,1),o}function Y(t,n,e){return t+(n-t)*e}function K(t,n,e){const r=[];for(let i=0;i<t.length;i++){const s=t[i],o=s.type;let a;if("Point"===o||"MultiPoint"===o||"LineString"===o)a=Z(s.geometry,n,e);else if("MultiLineString"===o||"Polygon"===o){a=[];for(const t of s.geometry)a.push(Z(t,n,e))}else if("MultiPolygon"===o){a=[];for(const t of s.geometry){const r=[];for(const i of t)r.push(Z(i,n,e));a.push(r)}}r.push($(s.id,o,a,s.tags,s.layer,e))}return r}function Z(t,n,e){const r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);const i=e?4:3;for(let s=0;s<t.length;s+=i)r.push(t[s]+n,t[s+1],t[s+2]),e&&r.push(t[s+3]);return r}function Q(t,n,e){if(t.transformed)return t;const r=1<<t.z,i=t.x,s=t.y,o=e?3:2;for(const a of t.features){const t=a.geometry,u=a.type;if(a.geometry=[],1===u)for(let u=0;u<t.length;u+=o)a.geometry.push(tt(t[u],t[u+1],n,r,i,s)),e&&a.geometry[a.geometry.length-1].push(t[u+2]);else for(let u=0;u<t.length;u++){const l=[];for(let a=0;a<t[u].length;a+=o)l.push(tt(t[u][a],t[u][a+1],n,r,i,s)),e&&l[l.length-1].push(t[u][a+2]);a.geometry.push(l)}}return t.transformed=!0,t}function tt(t,n,e,r,i,s){return[Math.round(e*(t*r-i)),Math.round(e*(n*r-s))]}function nt(t,n,e,r,i){const s=n===i.maxZoom?0:i.tolerance/((1<<n)*i.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:e,y:r,z:n,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const n of t)et(o,n,s,i);return o}function et(t,n,e,r){const i=n.geometry,s=n.type,o=[],a=r.hasAltitude?4:3;if(t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),"Point"===s||"MultiPoint"===s)for(let n=0;n<i.length;n+=a)o.push(i[n],i[n+1]),r.hasAltitude&&o.push(i[n+3]),t.numPoints++,t.numSimplified++;else if("LineString"===s)it(o,i,t,e,!1,!1,r);else if("MultiLineString"===s||"Polygon"===s)for(let n=0;n<i.length;n++)it(o,i[n],t,e,"Polygon"===s,0===n,r);else if("MultiPolygon"===s)for(let n=0;n<i.length;n++){const s=i[n];for(let n=0;n<s.length;n++)it(o,s[n],t,e,!0,0===n,r)}if(o.length){let e=n.tags||null;if("LineString"===s&&r.lineMetrics){e={};for(const t in n.tags)e[t]=n.tags[t];e.mapbox_clip_start=i.start/i.size,e.mapbox_clip_end=i.end/i.size}const a={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:e};n.layer&&(a.layer=n.layer),null!==n.id&&(a.id=n.id),t.features.push(a)}}function rt(t,n,e){return 0===t[n+2]&&t[n+3]>0&&e}function it(t,n,e,r,i,s,o){const a=r*r,{hasAltitude:u,disableFilter:l}=o,h=u?4:3;if(!l&&r>0&&n.size<(i?a:r))return void(e.numPoints+=n.length/h);const c=[];for(let t=0;t<n.length;t+=h)(0===r||n[t+2]>a||rt(n,t,u))&&(e.numSimplified++,c.push(n[t],n[t+1]),u&&c.push(n[t+3])),e.numPoints++;i&&function(t,n,e){const r=e?3:2;let i=0;for(let n=0,e=t.length,s=e-r;n<e;s=n,n+=r)i+=(t[n]-t[s])*(t[n+1]+t[s+1]);if(i>0===n){const n=r,i=r-1,s=r-2;for(let o=0,a=t.length;o<a/2;o+=r){const r=t[o],u=t[o+1];let l;e&&(l=t[o+2]),t[o]=t[a-n-o],t[o+1]=t[a-i-o],e&&(t[o+2]=t[a-s-o]),t[a-n-o]=r,t[a-i-o]=u,e&&(t[a-s-o]=l)}}}(c,s,u),t.push(c)}C.getJSON=function(t,n,e){if(A(n)){const t=e;e=n,n=t}const r=function(t,n){const r="string"==typeof n?JSON.parse(n):n||null;e(t,r)};return n&&n.jsonp?C.jsonp(t,r):((n=n||{}).returnJSON=!0,C.get(t,n,r))};const st={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,hasAltitude:!1,disableFilter:!1,debug:0};class ot{constructor(t,n){const e=(n=this.options=function(t,n){for(const e in n)t[e]=n[e];return t}(Object.create(st),n)).debug;if(e&&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.");let r=function(t,n){const e=[];if(Array.isArray(t)){for(let r=0;r<t.length;r++)D(e,t[r].layer,t[r].data,n);return e}if("FeatureCollection"===t.type)for(let r=0;r<t.features.length;r++)z(e,t.features[r],n,r);else"Feature"===t.type?z(e,t,n):z(e,{geometry:t},n);return e}(t,n);this.tiles={},this.tileCoords=[],e&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",n.indexMaxZoom,n.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(t,n){const e=n.buffer/n.extent;let r=t;const i=V(t,1,-1-e,e,0,-1,2,n),s=V(t,1,1-e,2+e,0,-1,2,n);return(i||s)&&(r=V(t,1,-e,1+e,0,-1,2,n)||[],i&&(r=K(i,1,n.hasAltitude).concat(r)),s&&(r=r.concat(K(s,-1,n.hasAltitude)))),r}(r,n),r.length&&this.splitTile(r,0,0,0),e&&(r.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)))}splitTile(t,n,e,r,i,s,o){const a=[t,n,e,r],u=this.options,l=u.debug;for(;a.length;){r=a.pop(),e=a.pop(),n=a.pop(),t=a.pop();const h=1<<n,c=at(n,e,r);let f=this.tiles[c];if(!f&&(l>1&&console.time("creation"),f=this.tiles[c]=nt(t,n,e,r,u),this.tileCoords.push({z:n,x:e,y:r}),l)){l>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,e,r,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));const t=\`z${o}n}\`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(f.source=t,null==i){if(n===u.indexMaxZoom||f.numPoints<=u.indexMaxPoints)continue}else{if(n===u.maxZoom||n===i)continue;if(null!=i){const t=i-n;if(e!==s>>t||r!==o>>t)continue}}if(f.source=null,0===t.length)continue;l>1&&console.time("clipping");const d=.5*u.buffer/u.extent,p=.5-d,y=.5+d,m=1+d;let g=null,v=null,b=null,w=null,M=V(t,h,e-d,e+y,0,f.minX,f.maxX,u),x=V(t,h,e+p,e+m,0,f.minX,f.maxX,u);t=null,M&&(g=V(M,h,r-d,r+y,1,f.minY,f.maxY,u),v=V(M,h,r+p,r+m,1,f.minY,f.maxY,u),M=null),x&&(b=V(x,h,r-d,r+y,1,f.minY,f.maxY,u),w=V(x,h,r+p,r+m,1,f.minY,f.maxY,u),x=null),l>1&&console.timeEnd("clipping"),a.push(g||[],n+1,2*e,2*r),a.push(v||[],n+1,2*e,2*r+1),a.push(b||[],n+1,2*e+1,2*r),a.push(w||[],n+1,2*e+1,2*r+1)}}getTile(t,n,e){t=+t,n=+n,e=+e;const r=this.options,{extent:i,debug:s}=r,{hasAltitude:o,wrapX:a}=r;if(t<0||t>24)return null;if(a){const e=1<<t;n=n+e&e-1}const u=at(t,n,e);if(this.tiles[u])return Q(this.tiles[u],i,o);s>1&&console.log("drilling down to z%d-%d-%d",t,n,e);let l,h=t,c=n,f=e;for(;!l&&h>0;)h--,c>>=1,f>>=1,l=this.tiles[at(h,c,f)];return l&&l.source?(s>1&&(console.log("found parent tile z%d-%d-%d",h,c,f),console.time("drilling down")),this.splitTile(l.source,h,c,f,t,n,e),s>1&&console.timeEnd("drilling down"),this.tiles[u]?Q(this.tiles[u],i,o):null):null}}function at(t,n,e){return 32*((1<<t)*e+n)+t}function ut(t,n,e,r,i,s,o){const a=e&&Array.isArray(e[0]);for(let u=0,l=e.length;u<l;u++){t[n]=(a?e[u][0]:e[u].x)*r,t[n+1]=(a?e[u][1]:e[u].y)*r,o!==Float32Array&&(t[n]=Math.round(t[n]),t[n+1]=Math.round(t[n+1]));let h=i||0;Array.isArray(i)&&(h=i[u]),h=h?Math.round(r*h):0,t[n+2]=h,n+=3,s&&0!==u&&u!==l-1&&(t[n]=t[n-3],t[n+1]=t[n-2],t[n+2]=t[n-1],n+=3)}return t.trySetLength&&t.trySetLength(n),n}function lt(t,n,e,r){const i=t[3*n],s=t[3*n+1],o=t[3*e],a=t[3*e+1];return i===o&&(i<0||i>r)||s===a&&(s<0||s>r)}"undefined"!=typeof undefinedThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof undefined?global:"undefined"!=typeof self&&self;function ht(t){return t&&t.M&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ct=ft;function ft(t,n){this.x=t,this.y=n}ft.prototype={clone:function(){return new ft(this.x,this.y)},add:function(t){return this.clone().F(t)},sub:function(t){return this.clone().k(t)},multByPoint:function(t){return this.clone().A(t)},divByPoint:function(t){return this.clone().P(t)},mult:function(t){return this.clone().S(t)},div:function(t){return this.clone()._(t)},rotate:function(t){return this.clone().O(t)},rotateAround:function(t,n){return this.clone().C(t,n)},matMult:function(t){return this.clone().I(t)},unit:function(){return this.clone().T()},perp:function(){return this.clone().D()},round:function(){return this.clone().j()},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,e=t.y-this.y;return n*n+e*e},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)},I:function(t){var n=t[0]*this.x+t[1]*this.y,e=t[2]*this.x+t[3]*this.y;return this.x=n,this.y=e,this},F:function(t){return this.x+=t.x,this.y+=t.y,this},k:function(t){return this.x-=t.x,this.y-=t.y,this},S:function(t){return this.x*=t,this.y*=t,this},_:function(t){return this.x/=t,this.y/=t,this},A:function(t){return this.x*=t.x,this.y*=t.y,this},P:function(t){return this.x/=t.x,this.y/=t.y,this},T:function(){return this._(this.mag()),this},D:function(){var t=this.y;return this.y=this.x,this.x=-t,this},O:function(t){var n=Math.cos(t),e=Math.sin(t),r=n*this.x-e*this.y,i=e*this.x+n*this.y;return this.x=r,this.y=i,this},C:function(t,n){var e=Math.cos(t),r=Math.sin(t),i=n.x+e*(this.x-n.x)-r*(this.y-n.y),s=n.y+r*(this.x-n.x)+e*(this.y-n.y);return this.x=i,this.y=s,this},j:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ft.convert=function(t){return t instanceof ft?t:Array.isArray(t)?new ft(t[0],t[1]):t};var dt=ht(ct);function pt(t,n,e){e=e||{},this.w=t||64,this.h=n||64,this.autoResize=!!e.autoResize,this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0}function yt(t,n,e){this.x=0,this.y=t,this.w=this.free=n,this.h=e}function mt(t,n,e,r,i,s,o){this.id=t,this.x=n,this.y=e,this.w=r,this.h=i,this.maxw=s||r,this.maxh=o||i,this.refcount=0}pt.prototype.pack=function(t,n){t=[].concat(t),n=n||{};for(var e,r,i,s,o=[],a=0;a<t.length;a++)if(e=t[a].w||t[a].width,r=t[a].h||t[a].height,i=t[a].id,e&&r){if(!(s=this.packOne(e,r,i)))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},pt.prototype.packOne=function(t,n,e){var r,i,s,o,a,u,l,h,c={freebin:-1,shelf:-1,waste:1/0},f=0;if("string"==typeof e||"number"==typeof e){if(r=this.getBin(e))return this.ref(r),r;"number"==typeof e&&(this.maxId=Math.max(e,this.maxId))}else e=++this.maxId;for(o=0;o<this.freebins.length;o++){if(n===(r=this.freebins[o]).maxh&&t===r.maxw)return this.allocFreebin(o,t,n,e);n>r.maxh||t>r.maxw||n<=r.maxh&&t<=r.maxw&&(s=r.maxw*r.maxh-t*n)<c.waste&&(c.waste=s,c.freebin=o)}for(o=0;o<this.shelves.length;o++)if(f+=(i=this.shelves[o]).h,!(t>i.free)){if(n===i.h)return this.allocShelf(o,t,n,e);n>i.h||n<i.h&&(s=(i.h-n)*t)<c.waste&&(c.freebin=-1,c.waste=s,c.shelf=o)}return-1!==c.freebin?this.allocFreebin(c.freebin,t,n,e):-1!==c.shelf?this.allocShelf(c.shelf,t,n,e):n<=this.h-f&&t<=this.w?(i=new yt(f,this.w,n),this.allocShelf(this.shelves.push(i)-1,t,n,e)):this.autoResize?(a=u=this.h,((l=h=this.w)<=a||t>l)&&(h=2*Math.max(t,l)),(a<l||n>a)&&(u=2*Math.max(n,a)),this.resize(h,u),this.packOne(t,n,e)):null},pt.prototype.allocFreebin=function(t,n,e,r){var i=this.freebins.splice(t,1)[0];return i.id=r,i.w=n,i.h=e,i.refcount=0,this.bins[r]=i,this.ref(i),i},pt.prototype.allocShelf=function(t,n,e,r){var i=this.shelves[t].alloc(n,e,r);return this.bins[r]=i,this.ref(i),i},pt.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,n=0,e=0;e<this.shelves.length;e++){var r=this.shelves[e];n+=r.h,t=Math.max(r.w-r.free,t)}this.resize(t,n)}},pt.prototype.getBin=function(t){return this.bins[t]},pt.prototype.ref=function(t){if(1==++t.refcount){var n=t.h;this.stats[n]=1+(0|this.stats[n])}return t.refcount},pt.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)},pt.prototype.clear=function(){this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0},pt.prototype.resize=function(t,n){this.w=t,this.h=n;for(var e=0;e<this.shelves.length;e++)this.shelves[e].resize(t);return!0},yt.prototype.alloc=function(t,n,e){if(t>this.free||n>this.h)return null;var r=this.x;return this.x+=t,this.free-=t,new mt(e,r,this.y,t,n,t,this.h)},yt.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0};var gt={exports:{}},vt={exports:{}},bt=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))},wt=Array.prototype.concat,Mt=Array.prototype.slice,xt=vt.exports=function(t){for(var n=[],e=0,r=t.length;e<r;e++){var i=t[e];bt(i)?n=wt.call(n,Mt.call(i)):n.push(i)}return n};xt.wrap=function(t){return function(){return t(xt(arguments))}};var Ft=vt.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]},At=Ft,Pt=Object.hasOwnProperty,St=Object.create(null);for(var _t in kt)Pt.call(kt,_t)&&(St[kt[_t]]=_t);var Ot=gt.exports={to:{},get:{}};function Ct(t,n,e){return Math.min(Math.max(n,t),e)}function Et(t){var n=Math.round(t).toString(16).toUpperCase();return n.length<2?"0"+n:n}Ot.get=function(t){var n,e;switch(t.substring(0,3).toLowerCase()){case"hsl":n=Ot.get.hsl(t),e="hsl";break;case"hwb":n=Ot.get.hwb(t),e="hwb";break;default:n=Ot.get.rgb(t),e="rgb"}return n?{model:e,value:n}:null},Ot.get.rgb=function(t){if(!t)return null;var n,e,r,i=[0,0,0,1];if(n=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(r=n[2],n=n[1],e=0;e<3;e++){var s=2*e;i[e]=parseInt(n.slice(s,s+2),16)}r&&(i[3]=parseInt(r,16)/255)}else if(n=t.match(/^#([a-f0-9]{3,4})$/i)){for(r=(n=n[1])[3],e=0;e<3;e++)i[e]=parseInt(n[e]+n[e],16);r&&(i[3]=parseInt(r+r,16)/255)}else if(n=t.match(/^rgba?\\(\\s*([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)(?=[\\s,])\\s*(?:,\\s*)?([+-]?\\d+)\\s*(?:[,|\\/]\\s*([+-]?[\\d\\.]+)(%?)\\s*)?\\)$/)){for(e=0;e<3;e++)i[e]=parseInt(n[e+1],0);n[4]&&(n[5]?i[3]=.01*parseFloat(n[4]):i[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]:Pt.call(kt,n[1])?((i=kt[n[1]])[3]=1,i):null:null;for(e=0;e<3;e++)i[e]=Math.round(2.55*parseFloat(n[e+1]));n[4]&&(n[5]?i[3]=.01*parseFloat(n[4]):i[3]=parseFloat(n[4]))}for(e=0;e<3;e++)i[e]=Ct(i[e],0,255);return i[3]=Ct(i[3],0,1),i},Ot.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 e=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,Ct(parseFloat(n[2]),0,100),Ct(parseFloat(n[3]),0,100),Ct(isNaN(e)?1:e,0,1)]}return null},Ot.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 e=parseFloat(n[4]);return[(parseFloat(n[1])%360+360)%360,Ct(parseFloat(n[2]),0,100),Ct(parseFloat(n[3]),0,100),Ct(isNaN(e)?1:e,0,1)]}return null},Ot.to.hex=function(){var t=At(arguments);return"#"+Et(t[0])+Et(t[1])+Et(t[2])+(t[3]<1?Et(Math.round(255*t[3])):"")},Ot.to.rgb=function(){var t=At(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]+")"},Ot.to.rgb.percent=function(){var t=At(arguments),n=Math.round(t[0]/255*100),e=Math.round(t[1]/255*100),r=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+n+"%, "+e+"%, "+r+"%)":"rgba("+n+"%, "+e+"%, "+r+"%, "+t[3]+")"},Ot.to.hsl=function(){var t=At(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},Ot.to.hwb=function(){var t=At(arguments),n="";return t.length>=4&&1!==t[3]&&(n=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+n+")"},Ot.to.keyword=function(t){return St[t.slice(0,3)]};var It=gt.exports,$t={exports:{}},Tt={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]},Dt={};for(var zt in Tt)Tt.hasOwnProperty(zt)&&(Dt[Tt[zt]]=zt);var jt=$t.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 Ut in jt)if(jt.hasOwnProperty(Ut)){if(!("channels"in jt[Ut]))throw new Error("missing channels property: "+Ut);if(!("labels"in jt[Ut]))throw new Error("missing channel labels property: "+Ut);if(jt[Ut].labels.length!==jt[Ut].channels)throw new Error("channel and label counts mismatch: "+Ut);var Nt=jt[Ut].channels,Lt=jt[Ut].labels;delete jt[Ut].channels,delete jt[Ut].labels,Object.defineProperty(jt[Ut],"channels",{value:Nt}),Object.defineProperty(jt[Ut],"labels",{value:Lt})}function Rt(t,n){return Math.pow(t[0]-n[0],2)+Math.pow(t[1]-n[1],2)+Math.pow(t[2]-n[2],2)}jt.rgb.hsl=function(t){var n,e,r=t[0]/255,i=t[1]/255,s=t[2]/255,o=Math.min(r,i,s),a=Math.max(r,i,s),u=a-o;return a===o?n=0:r===a?n=(i-s)/u:i===a?n=2+(s-r)/u:s===a&&(n=4+(r-i)/u),(n=Math.min(60*n,360))<0&&(n+=360),e=(o+a)/2,[n,100*(a===o?0:e<=.5?u/(a+o):u/(2-a-o)),100*e]},jt.rgb.hsv=function(t){var n,e,r,i,s,o=t[0]/255,a=t[1]/255,u=t[2]/255,l=Math.max(o,a,u),h=l-Math.min(o,a,u),c=function(t){return(l-t)/6/h+.5};return 0===h?i=s=0:(s=h/l,n=c(o),e=c(a),r=c(u),o===l?i=r-e:a===l?i=1/3+n-r:u===l&&(i=2/3+e-n),i<0?i+=1:i>1&&(i-=1)),[360*i,100*s,100*l]},jt.rgb.hwb=function(t){var n=t[0],e=t[1],r=t[2];return[jt.rgb.hsl(t)[0],100*(1/255*Math.min(n,Math.min(e,r))),100*(r=1-1/255*Math.max(n,Math.max(e,r)))]},jt.rgb.cmyk=function(t){var n,e=t[0]/255,r=t[1]/255,i=t[2]/255;return[100*((1-e-(n=Math.min(1-e,1-r,1-i)))/(1-n)||0),100*((1-r-n)/(1-n)||0),100*((1-i-n)/(1-n)||0),100*n]},jt.rgb.keyword=function(t){var n=Dt[t];if(n)return n;var e,r=1/0;for(var i in Tt)if(Tt.hasOwnProperty(i)){var s=Rt(t,Tt[i]);s<r&&(r=s,e=i)}return e},jt.keyword.rgb=function(t){return Tt[t]},jt.rgb.xyz=function(t){var n=t[0]/255,e=t[1]/255,r=t[2]/255;return[100*(.4124*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.3576*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.1805*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)),100*(.2126*n+.7152*e+.0722*r),100*(.0193*n+.1192*e+.9505*r)]},jt.rgb.lab=function(t){var n=jt.rgb.xyz(t),e=n[0],r=n[1],i=n[2];return r/=100,i/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(e-r),200*(r-(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116))]},jt.hsl.rgb=function(t){var n,e,r,i,s,o=t[0]/360,a=t[1]/100,u=t[2]/100;if(0===a)return[s=255*u,s,s];n=2*u-(e=u<.5?u*(1+a):u+a-u*a),i=[0,0,0];for(var l=0;l<3;l++)(r=o+1/3*-(l-1))<0&&r++,r>1&&r--,s=6*r<1?n+6*(e-n)*r:2*r<1?e:3*r<2?n+(e-n)*(2/3-r)*6:n,i[l]=255*s;return i},jt.hsl.hsv=function(t){var n=t[0],e=t[1]/100,r=t[2]/100,i=e,s=Math.max(r,.01);return e*=(r*=2)<=1?r:2-r,i*=s<=1?s:2-s,[n,100*(0===r?2*i/(s+i):2*e/(r+e)),100*((r+e)/2)]},jt.hsv.rgb=function(t){var n=t[0]/60,e=t[1]/100,r=t[2]/100,i=Math.floor(n)%6,s=n-Math.floor(n),o=255*r*(1-e),a=255*r*(1-e*s),u=255*r*(1-e*(1-s));switch(r*=255,i){case 0:return[r,u,o];case 1:return[a,r,o];case 2:return[o,r,u];case 3:return[o,a,r];case 4:return[u,o,r];case 5:return[r,o,a]}},jt.hsv.hsl=function(t){var n,e,r,i=t[0],s=t[1]/100,o=t[2]/100,a=Math.max(o,.01);return r=(2-s)*o,e=s*a,[i,100*(e=(e/=(n=(2-s)*a)<=1?n:2-n)||0),100*(r/=2)]},jt.hwb.rgb=function(t){var n,e,r,i,s,o,a,u=t[0]/360,l=t[1]/100,h=t[2]/100,c=l+h;switch(c>1&&(l/=c,h/=c),r=6*u-(n=Math.floor(6*u)),1&n&&(r=1-r),i=l+r*((e=1-h)-l),n){default:case 6:case 0:s=e,o=i,a=l;break;case 1:s=i,o=e,a=l;break;case 2:s=l,o=e,a=i;break;case 3:s=l,o=i,a=e;break;case 4:s=i,o=l,a=e;break;case 5:s=e,o=l,a=i}return[255*s,255*o,255*a]},jt.cmyk.rgb=function(t){var n=t[0]/100,e=t[1]/100,r=t[2]/100,i=t[3]/100;return[255*(1-Math.min(1,n*(1-i)+i)),255*(1-Math.min(1,e*(1-i)+i)),255*(1-Math.min(1,r*(1-i)+i))]},jt.xyz.rgb=function(t){var n,e,r,i=t[0]/100,s=t[1]/100,o=t[2]/100;return e=-.9689*i+1.8758*s+.0415*o,r=.0557*i+-.204*s+1.057*o,n=(n=3.2406*i+-1.5372*s+-.4986*o)>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,[255*(n=Math.min(Math.max(0,n),1)),255*(e=Math.min(Math.max(0,e),1)),255*(r=Math.min(Math.max(0,r),1))]},jt.xyz.lab=function(t){var n=t[0],e=t[1],r=t[2];return e/=100,r/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(e=e>.008856?Math.pow(e,1/3):7.787*e+16/116)-16,500*(n-e),200*(e-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]},jt.lab.xyz=function(t){var n,e,r,i=t[0];n=t[1]/500+(e=(i+16)/116),r=e-t[2]/200;var s=Math.pow(e,3),o=Math.pow(n,3),a=Math.pow(r,3);return e=s>.008856?s:(e-16/116)/7.787,n=o>.008856?o:(n-16/116)/7.787,r=a>.008856?a:(r-16/116)/7.787,[n*=95.047,e*=100,r*=108.883]},jt.lab.lch=function(t){var n,e=t[0],r=t[1],i=t[2];return(n=360*Math.atan2(i,r)/2/Math.PI)<0&&(n+=360),[e,Math.sqrt(r*r+i*i),n]},jt.lch.lab=function(t){var n,e=t[0],r=t[1];return n=t[2]/360*2*Math.PI,[e,r*Math.cos(n),r*Math.sin(n)]},jt.rgb.ansi16=function(t){var n=t[0],e=t[1],r=t[2],i=1 in arguments?arguments[1]:jt.rgb.hsv(t)[2];if(0===(i=Math.round(i/50)))return 30;var s=30+(Math.round(r/255)<<2|Math.round(e/255)<<1|Math.round(n/255));return 2===i&&(s+=60),s},jt.hsv.ansi16=function(t){return jt.rgb.ansi16(jt.hsv.rgb(t),t[2])},jt.rgb.ansi256=function(t){var n=t[0],e=t[1],r=t[2];return n===e&&e===r?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(e/255*5)+Math.round(r/255*5)},jt.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 e=.5*(1+~~(t>50));return[(1&n)*e*255,(n>>1&1)*e*255,(n>>2&1)*e*255]},jt.ansi256.rgb=function(t){if(t>=232){var n=10*(t-232)+8;return[n,n,n]}var e;return t-=16,[Math.floor(t/36)/5*255,Math.floor((e=t%36)/6)/5*255,e%6/5*255]},jt.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},jt.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 e=n[0];3===n[0].length&&(e=e.split("").map((function(t){return t+t})).join(""));var r=parseInt(e,16);return[r>>16&255,r>>8&255,255&r]},jt.rgb.hcg=function(t){var n,e=t[0]/255,r=t[1]/255,i=t[2]/255,s=Math.max(Math.max(e,r),i),o=Math.min(Math.min(e,r),i),a=s-o;return n=a<=0?0:s===e?(r-i)/a%6:s===r?2+(i-e)/a:4+(e-r)/a+4,n/=6,[360*(n%=1),100*a,100*(a<1?o/(1-a):0)]},jt.hsl.hcg=function(t){var n=t[1]/100,e=t[2]/100,r=1,i=0;return(r=e<.5?2*n*e:2*n*(1-e))<1&&(i=(e-.5*r)/(1-r)),[t[0],100*r,100*i]},jt.hsv.hcg=function(t){var n=t[1]/100,e=t[2]/100,r=n*e,i=0;return r<1&&(i=(e-r)/(1-r)),[t[0],100*r,100*i]},jt.hcg.rgb=function(t){var n=t[0]/360,e=t[1]/100,r=t[2]/100;if(0===e)return[255*r,255*r,255*r];var i,s=[0,0,0],o=n%1*6,a=o%1,u=1-a;switch(Math.floor(o)){case 0:s[0]=1,s[1]=a,s[2]=0;break;case 1:s[0]=u,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]=u,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]=u}return i=(1-e)*r,[255*(e*s[0]+i),255*(e*s[1]+i),255*(e*s[2]+i)]},jt.hcg.hsv=function(t){var n=t[1]/100,e=n+t[2]/100*(1-n),r=0;return e>0&&(r=n/e),[t[0],100*r,100*e]},jt.hcg.hsl=function(t){var n=t[1]/100,e=t[2]/100*(1-n)+.5*n,r=0;return e>0&&e<.5?r=n/(2*e):e>=.5&&e<1&&(r=n/(2*(1-e))),[t[0],100*r,100*e]},jt.hcg.hwb=function(t){var n=t[1]/100,e=n+t[2]/100*(1-n);return[t[0],100*(e-n),100*(1-e)]},jt.hwb.hcg=function(t){var n=t[1]/100,e=1-t[2]/100,r=e-n,i=0;return r<1&&(i=(e-r)/(1-r)),[t[0],100*r,100*i]},jt.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},jt.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},jt.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},jt.gray.hsl=jt.gray.hsv=function(t){return[0,0,t[0]]},jt.gray.hwb=function(t){return[0,100,t[0]]},jt.gray.cmyk=function(t){return[0,0,0,t[0]]},jt.gray.lab=function(t){return[t[0],0,0]},jt.gray.hex=function(t){var n=255&Math.round(t[0]/100*255),e=((n<<16)+(n<<8)+n).toString(16).toUpperCase();return"000000".substring(e.length)+e},jt.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]};var Vt=$t.exports,Ht=Vt;function qt(t){var n=function(){for(var t={},n=Object.keys(Ht),e=n.length,r=0;r<e;r++)t[n[r]]={distance:-1,parent:null};return t}(),e=[t];for(n[t].distance=0;e.length;)for(var r=e.pop(),i=Object.keys(Ht[r]),s=i.length,o=0;o<s;o++){var a=i[o],u=n[a];-1===u.distance&&(u.distance=n[r].distance+1,u.parent=r,e.unshift(a))}return n}function Gt(t,n){return function(e){return n(t(e))}}function Jt(t,n){for(var e=[n[t].parent,t],r=Ht[n[t].parent][t],i=n[t].parent;n[i].parent;)e.unshift(n[i].parent),r=Gt(Ht[n[i].parent][i],r),i=n[i].parent;return r.conversion=e,r}var Wt=Vt,Bt=function(t){for(var n=qt(t),e={},r=Object.keys(n),i=r.length,s=0;s<i;s++){var o=r[s];null!==n[o].parent&&(e[o]=Jt(o,n))}return e},Xt={};Object.keys(Wt).forEach((function(t){Xt[t]={},Object.defineProperty(Xt[t],"channels",{value:Wt[t].channels}),Object.defineProperty(Xt[t],"labels",{value:Wt[t].labels});var n=Bt(t);Object.keys(n).forEach((function(e){var r=n[e];Xt[t][e]=function(t){var n=function(n){if(null==n)return n;arguments.length>1&&(n=Array.prototype.slice.call(arguments));var e=t(n);if("object"==typeof e)for(var r=e.length,i=0;i<r;i++)e[i]=Math.round(e[i]);return e};return"conversion"in t&&(n.conversion=t.conversion),n}(r),Xt[t][e].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}(r)}))}));var Yt=It,Kt=Xt,Zt=[].slice,Qt=["keyword","gray","hex"],tn={};Object.keys(Kt).forEach((function(t){tn[Zt.call(Kt[t].labels).sort().join("")]=t}));var nn={};function en(t,n){if(!(this instanceof en))return new en(t,n);if(n&&n in Qt&&(n=null),n&&!(n in Kt))throw new Error("Unknown model: "+n);var e,r;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 i=Yt.get(t);if(null===i)throw new Error("Unable to parse color from string: "+t);this.model=i.model,r=Kt[this.model].channels,this.color=i.value.slice(0,r),this.valpha="number"==typeof i.value[r]?i.value[r]:1}else if(t.length){this.model=n||"rgb",r=Kt[this.model].channels;var s=Zt.call(t,0,r);this.color=on(s,r),this.valpha="number"==typeof t[r]?t[r]: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 tn))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=tn[a];var u=Kt[this.model].labels,l=[];for(e=0;e<u.length;e++)l.push(t[u[e]]);this.color=on(l)}if(nn[this.model])for(r=Kt[this.model].channels,e=0;e<r;e++){var h=nn[this.model][e];h&&(this.color[e]=h(this.color[e]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}function rn(t,n,e){return(t=Array.isArray(t)?t:[t]).forEach((function(t){(nn[t]||(nn[t]=[]))[n]=e})),t=t[0],function(r){var i;return arguments.length?(e&&(r=e(r)),(i=this[t]()).color[n]=r,i):(i=this[t]().color[n],e&&(i=e(i)),i)}}function sn(t){return function(n){return Math.max(0,Math.min(t,n))}}function on(t,n){for(var e=0;e<n;e++)"number"!=typeof t[e]&&(t[e]=0);return t}en.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(t){var n=this.model in Yt.to?this:this.rgb(),e=1===(n=n.round("number"==typeof t?t:1)).valpha?n.color:n.color.concat(this.valpha);return Yt.to[n.model](e)},percentString:function(t){var n=this.rgb().round("number"==typeof t?t:1),e=1===n.valpha?n.color:n.color.concat(this.valpha);return Yt.to.rgb.percent(e)},array:function(){return 1===this.valpha?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var t={},n=Kt[this.model].channels,e=Kt[this.model].labels,r=0;r<n;r++)t[e[r]]=this.color[r];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:rn("rgb",0,sn(255)),green:rn("rgb",1,sn(255)),blue:rn("rgb",2,sn(255)),hue:rn(["hsl","hsv","hsl","hwb","hcg"],0,(function(t){return(t%360+360)%360})),saturationl:rn("hsl",1,sn(100)),lightness:rn("hsl",2,sn(100)),saturationv:rn("hsv",1,sn(100)),value:rn("hsv",2,sn(100)),chroma:rn("hcg",1,sn(100)),gray:rn("hcg",2,sn(100)),white:rn("hwb",1,sn(100)),wblack:rn("hwb",2,sn(100)),cyan:rn("cmyk",0,sn(100)),magenta:rn("cmyk",1,sn(100)),yellow:rn("cmyk",2,sn(100)),black:rn("cmyk",3,sn(100)),x:rn("xyz",0,sn(100)),y:rn("xyz",1,sn(100)),z:rn("xyz",2,sn(100)),l:rn("lab",0,sn(100)),a:rn("lab",1),b:rn("lab",2),keyword:function(t){return arguments.length?new en(t):Kt[this.model].keyword(this.color)},hex:function(t){return arguments.length?new en(t):Yt.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=[],e=0;e<t.length;e++){var r=t[e]/255;n[e]=r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4)}return.2126*n[0]+.7152*n[1]+.0722*n[2]},contrast:function(t){var n=this.luminosity(),e=t.luminosity();return n>e?(n+.05)/(e+.05):(e+.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(),e=n.color[0];return e=(e=(e+t)%360)<0?360+e:e,n.color[0]=e,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 e=t.rgb(),r=this.rgb(),i=void 0===n?.5:n,s=2*i-1,o=e.alpha()-r.alpha(),a=((s*o==-1?s:(s+o)/(1+s*o))+1)/2,u=1-a;return en.rgb(a*e.red()+u*r.red(),a*e.green()+u*r.green(),a*e.blue()+u*r.blue(),e.alpha()*i+r.alpha()*(1-i))}},Object.keys(Kt).forEach((function(t){if(-1===Qt.indexOf(t)){var n=Kt[t].channels;en.prototype[t]=function(){if(this.model===t)return new en(this);if(arguments.length)return new en(arguments,t);var e,r="number"==typeof arguments[n]?n:this.valpha;return new en((e=Kt[this.model][t].raw(this.color),Array.isArray(e)?e:[e]).concat(r),t)},en[t]=function(e){return"number"==typeof e&&(e=on(Zt.call(arguments),n)),new en(e,t)}}}));var an=ht(en);\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 un=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function ln(t){return new Function("f",\`var p = (f && f.properties || {}); return ${o}cn(t)}\`)}function hn(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":case"!has":return 2===t.length&&("string"==typeof t[1]||t[1].property&&t[1].op);case"in":case"!in":return t.length>=2&&("string"==typeof t[1]||t[1].property&&t[1].op);case"==":case"!=":case">":case">=":case"<":case"<=":return 3===t.length&&("string"==typeof t[1]||t[1].property&&t[1].op);case"none":case"any":case"all":for(const n of t.slice(1))if(!hn(n)&&"boolean"!=typeof n)return!1;return!0;case"contains":return!0;default:return!1}}function cn(t){if(!t)return"true";const n=t[0];if(t.length<=1)return"any"===n?"false":"true";return\`(${o}"=="===n?dn(t[1],t[2],"===",!1):"!="===n?dn(t[1],t[2],"!==",!1):"<"===n||">"===n||"<="===n||">="===n?dn(t[1],t[2],n,!0):"any"===n?yn(t.slice(1),"||"):"all"===n?yn(t.slice(1),"&&"):"none"===n?vn(yn(t.slice(1),"||")):"in"===n?mn(t[1],t.slice(2)):"!in"===n?vn(mn(t[1],t.slice(2))):"has"===n?gn(t[1]):"!has"===n?vn(gn(t[1])):"contains"===n?function(t,n,e){const r=fn(t);return void 0!==e?\`(${o}r} + '').indexOf("${o}n}") === ${o}e}\`:\`(${o}r} + '').indexOf("${o}n}") >= 0\`}(t[1],t[2],t[3]):"true"})\`}function fn(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function dn(t,n,e,r){if("object"==typeof(i=t)&&i&&t.op)return function(t,n,e,r){const i=t.property,s=t.op;let o=fn(i);return"length"!==s?(console.error(\`not support ${o}s} op\`),"false"):(o=\`((${o}o}+='').length)\`,pn(o,i,n,e,r))}(t,n,e,r);var i;return pn(fn(t),t,n,e,r)}function pn(t,n,e,r,i){const s="$type"===n?un.indexOf(e):JSON.stringify(e);return(i?\`typeof ${o}t}=== typeof ${o}s}&&\`:"")+t+r+s}function yn(t,n){return t.map(cn).join(n)}function mn(t,n){"$type"===t&&(n=n.map((t=>un.indexOf(t))));const e=JSON.stringify(n.sort(bn)),r=fn(t);return n.length<=200?\`${o}e}.indexOf(${o}r}) !== -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; }(${o}r}, ${o}e},0,${o}n.length-1})\`}function gn(t){return"$id"===t?'"id" in f':\`${o}JSON.stringify(t)} in p\`}function vn(t){return\`!(${o}t})\`}function bn(t,n){return t<n?-1:t>n?1:0}var wn={exports:{}};wn.exports=function(){function t(t,e,i,s,o){n(t,e,i||0,s||t.length-1,o||r)}function n(t,r,i,s,o){for(;s>i;){if(s-i>600){var a=s-i+1,u=r-i+1,l=Math.log(a),h=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*h*(a-h)/a)*(u-a/2<0?-1:1);n(t,r,Math.max(i,Math.floor(r-u*h/a+c)),Math.min(s,Math.floor(r+(a-u)*h/a+c)),o)}var f=t[r],d=i,p=s;for(e(t,i,r),o(t[s],f)>0&&e(t,i,s);d<p;){for(e(t,d,p),d++,p--;o(t[d],f)<0;)d++;for(;o(t[p],f)>0;)p--}0===o(t[i],f)?e(t,i,p):e(t,++p,s),p<=r&&(i=p+1),r<=p&&(s=p-1)}}function e(t,n,e){var r=t[n];t[n]=t[e],t[e]=r}function r(t,n){return t<n?-1:t>n?1:0}return t}();var Mn=ht(wn.exports);class xn{constructor(t=[],n=Fn){if(this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this.U(t)}push(t){this.data.push(t),this.length++,this.L(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this.U(0)),t}peek(){return this.data[0]}L(t){const{data:n,compare:e}=this,r=n[t];for(;t>0;){const i=t-1>>1,s=n[i];if(e(r,s)>=0)break;n[t]=s,t=i}n[t]=r}U(t){const{data:n,compare:e}=this,r=this.length>>1,i=n[t];for(;t<r;){let r=1+(t<<1),s=n[r];const o=r+1;if(o<this.length&&e(n[o],s)<0&&(r=o,s=n[o]),e(s,i)>=0)break;n[t]=s,t=r}n[t]=i}}function Fn(t,n){return t<n?-1:t>n?1:0}var kn="undefined"!=typeof Float32Array?Float32Array:Array;function An(){var t=new kn(3);return kn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Pn(t,n,e){var r=new kn(3);return r[0]=t,r[1]=n,r[2]=e,r}function Sn(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function _n(t,n,e,r){return t[0]=n,t[1]=e,t[2]=r,t}function On(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t}function Cn(t,n){var e=n[0],r=n[1],i=n[2],s=e*e+r*r+i*i;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 En(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function In(t,n,e){var r=n[0],i=n[1],s=n[2],o=e[0],a=e[1],u=e[2];return t[0]=i*u-s*a,t[1]=s*o-r*u,t[2]=r*a-i*o,t}var $n=function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t};function Tn(){var t=new kn(4);return kn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Dn(t,n){var e=n[0]+n[4]+n[8],r=void 0;if(e>0)r=Math.sqrt(e+1),t[3]=.5*r,r=.5/r,t[0]=(n[5]-n[7])*r,t[1]=(n[6]-n[2])*r,t[2]=(n[1]-n[3])*r;else{var i=0;n[4]>n[0]&&(i=1),n[8]>n[3*i+i]&&(i=2);var s=(i+1)%3,o=(i+2)%3;r=Math.sqrt(n[3*i+i]-n[3*s+s]-n[3*o+o]+1),t[i]=.5*r,r=.5/r,t[3]=(n[3*s+o]-n[3*o+s])*r,t[s]=(n[3*s+i]+n[3*i+s])*r,t[o]=(n[3*o+i]+n[3*i+o])*r}return t}!function(){var t=An()}(),function(){var t,n=(t=new kn(4),kn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var zn,jn=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},Un=function(t,n){var e=n[0],r=n[1],i=n[2],s=n[3],o=e*e+r*r+i*i+s*s;return o>0&&(o=1/Math.sqrt(o),t[0]=e*o,t[1]=r*o,t[2]=i*o,t[3]=s*o),t};An(),Pn(1,0,0),Pn(0,1,0),Tn(),Tn(),zn=new kn(9),kn!=Float32Array&&(zn[1]=0,zn[2]=0,zn[3]=0,zn[5]=0,zn[6]=0,zn[7]=0),zn[0]=1,zn[4]=1,zn[8]=1;\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */\nconst Nn=8,Ln=[],Rn=[],Vn=[],Hn=[];function qn(t,n,e){const r=In(Rn,n,e),i=function(t,n,e,r,i,s,o,a,u,l){return t[0]=n,t[1]=e,t[2]=r,t[3]=i,t[4]=s,t[5]=o,t[6]=a,t[7]=u,t[8]=l,t}(Ln,e[0],e[1],e[2],...r,...n);t=Dn(t,i),t=function(t){return t[3]<0?jn(t,t,-1):t}(t=Un(t,t));const s=1/((1<<2*Nn-1)-1);if(t[3]<s){t[3]=s;const n=Math.sqrt(1-s*s);t[0]*=n,t[1]*=n,t[2]*=n}const o=e[3]>0?In(Vn,e,n):In(Vn,n,e);return En(In(Hn,e,n),o)<0&&jn(t,t,-1),t}const Gn=[];function Jn(t,n,e){const r=e||[];r.setLength&&r.setLength(t.length);const i=Gn;i.length<t.length/3&&(i.length=t.length/3),i.fill(0,0,t.length/3);const s=void 0===n.length?n:n.length;for(let e=0;e<s/3;e++)void 0===n.length?te(t,3*e,3*e+1,3*e+2,r,i):te(t,n[3*e],n[3*e+1],n[3*e+2],r,i);const o=r.getLength?r.getLength():r.length;for(let t=0;t<o;t+=3){const n=i[t/3];0!==n?(r[t]/=n,r[t+1]/=n,r[t+2]/=n):(r[t]=0,r[t+1]=0,r[t+2]=0)}return r}const Wn=[],Bn=[],Xn=[],Yn=[],Kn=[],Zn=[],Qn=[];function te(t,n,e,r,i,s){_n(Yn,t[3*n],t[3*n+1],t[3*n+2]),_n(Kn,t[3*e],t[3*e+1],t[3*e+2]),_n(Zn,t[3*r],t[3*r+1],t[3*r+2]);const o=$n(Wn,Zn,Kn),a=$n(Bn,Yn,Kn),u=In(Xn,o,a);Cn(Qn,u),i[3*n]=i[3*n]||0,i[3*e]=i[3*e]||0,i[3*r]=i[3*r]||0,i[3*n+1]=i[3*n+1]||0,i[3*e+1]=i[3*e+1]||0,i[3*r+1]=i[3*r+1]||0,i[3*n+2]=i[3*n+2]||0,i[3*e+2]=i[3*e+2]||0,i[3*r+2]=i[3*r+2]||0,i[3*n]+=Qn[0],i[3*e]+=Qn[0],i[3*r]+=Qn[0],i[3*n+1]+=Qn[1],i[3*e+1]+=Qn[1],i[3*r+1]+=Qn[1],i[3*n+2]+=Qn[2],i[3*e+2]+=Qn[2],i[3*r+2]+=Qn[2],s[n]+=1,s[e]+=1,s[r]+=1}\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 ne(t,n,e){return t[0]=n[e],t[1]=n[e+1],t[2]=n[e+2],t}function ee(t,n,e){return t[0]=n[e],t[1]=n[e+1],t}var re={exports:{}};function ie(t,n,e){e=e||2;var r,i,s,o,a,u,l,h=n&&n.length,c=h?n[0]*e:t.length,f=se(t,0,c,e,!0),d=[];if(!f||f.next===f.prev)return d;if(h&&(f=function(t,n,e,r){var i,s,o,a=[];for(i=0,s=n.length;i<s;i++)(o=se(t,n[i]*r,i<s-1?n[i+1]*r:t.length,r,!1))===o.next&&(o.steiner=!0),a.push(me(o));for(a.sort(fe),i=0;i<a.length;i++)e=de(a[i],e);return e}(t,n,f,e)),t.length>80*e){r=s=t[0],i=o=t[1];for(var p=e;p<c;p+=e)(a=t[p])<r&&(r=a),(u=t[p+1])<i&&(i=u),a>s&&(s=a),u>o&&(o=u);l=0!==(l=Math.max(s-r,o-i))?32767/l:0}return ae(f,d,e,r,i,l,0),d}function se(t,n,e,r,i){var s,o;if(i===Oe(t,n,e,r)>0)for(s=n;s<e;s+=r)o=Pe(s,t[s],t[s+1],o);else for(s=e-r;s>=n;s-=r)o=Pe(s,t[s],t[s+1],o);return o&&we(o,o.next)&&(Se(o),o=o.next),o}function oe(t,n){if(!t)return t;n||(n=t);var e,r=t;do{if(e=!1,r.steiner||!we(r,r.next)&&0!==be(r.prev,r,r.next))r=r.next;else{if(Se(r),(r=n=r.prev)===r.next)break;e=!0}}while(e||r!==n);return n}function ae(t,n,e,r,i,s,o){if(t){!o&&s&&function(t,n,e,r){var i=t;do{0===i.z&&(i.z=ye(i.x,i.y,n,e,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var n,e,r,i,s,o,a,u,l=1;do{for(e=t,t=null,s=null,o=0;e;){for(o++,r=e,a=0,n=0;n<l&&(a++,r=r.nextZ);n++);for(u=l;a>0||u>0&&r;)0!==a&&(0===u||!r||e.z<=r.z)?(i=e,e=e.nextZ,a--):(i=r,r=r.nextZ,u--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;e=r}s.nextZ=null,l*=2}while(o>1)}(i)}(t,r,i,s);for(var a,u,l=t;t.prev!==t.next;)if(a=t.prev,u=t.next,s?le(t,r,i,s):ue(t))n.push(a.i/e|0),n.push(t.i/e|0),n.push(u.i/e|0),Se(t),t=u.next,l=u.next;else if((t=u)===l){o?1===o?ae(t=he(oe(t),n,e),n,e,r,i,s,2):2===o&&ce(t,n,e,r,i,s):ae(oe(t),n,e,r,i,s,1);break}}}function ue(t){var n=t.prev,e=t,r=t.next;if(be(n,e,r)>=0)return!1;for(var i=n.x,s=e.x,o=r.x,a=n.y,u=e.y,l=r.y,h=i<s?i<o?i:o:s<o?s:o,c=a<u?a<l?a:l:u<l?u:l,f=i>s?i>o?i:o:s>o?s:o,d=a>u?a>l?a:l:u>l?u:l,p=r.next;p!==n;){if(p.x>=h&&p.x<=f&&p.y>=c&&p.y<=d&&ge(i,a,s,u,o,l,p.x,p.y)&&be(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function le(t,n,e,r){var i=t.prev,s=t,o=t.next;if(be(i,s,o)>=0)return!1;for(var a=i.x,u=s.x,l=o.x,h=i.y,c=s.y,f=o.y,d=a<u?a<l?a:l:u<l?u:l,p=h<c?h<f?h:f:c<f?c:f,y=a>u?a>l?a:l:u>l?u:l,m=h>c?h>f?h:f:c>f?c:f,g=ye(d,p,n,e,r),v=ye(y,m,n,e,r),b=t.prevZ,w=t.nextZ;b&&b.z>=g&&w&&w.z<=v;){if(b.x>=d&&b.x<=y&&b.y>=p&&b.y<=m&&b!==i&&b!==o&&ge(a,h,u,c,l,f,b.x,b.y)&&be(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,w.x>=d&&w.x<=y&&w.y>=p&&w.y<=m&&w!==i&&w!==o&&ge(a,h,u,c,l,f,w.x,w.y)&&be(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;b&&b.z>=g;){if(b.x>=d&&b.x<=y&&b.y>=p&&b.y<=m&&b!==i&&b!==o&&ge(a,h,u,c,l,f,b.x,b.y)&&be(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;w&&w.z<=v;){if(w.x>=d&&w.x<=y&&w.y>=p&&w.y<=m&&w!==i&&w!==o&&ge(a,h,u,c,l,f,w.x,w.y)&&be(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function he(t,n,e){var r=t;do{var i=r.prev,s=r.next.next;!we(i,s)&&Me(i,r,r.next,s)&&ke(i,s)&&ke(s,i)&&(n.push(i.i/e|0),n.push(r.i/e|0),n.push(s.i/e|0),Se(r),Se(r.next),r=t=s),r=r.next}while(r!==t);return oe(r)}function ce(t,n,e,r,i,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&ve(o,a)){var u=Ae(o,a);return o=oe(o,o.next),u=oe(u,u.next),ae(o,n,e,r,i,s,0),void ae(u,n,e,r,i,s,0)}a=a.next}o=o.next}while(o!==t)}function fe(t,n){return t.x-n.x}function de(t,n){var e=function(t,n){var e,r=n,i=t.x,s=t.y,o=-1/0;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var a=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>o&&(o=a,e=r.x<r.next.x?r:r.next,a===i))return e}r=r.next}while(r!==n);if(!e)return null;var u,l=e,h=e.x,c=e.y,f=1/0;r=e;do{i>=r.x&&r.x>=h&&i!==r.x&&ge(s<c?i:o,s,h,c,s<c?o:i,s,r.x,r.y)&&(u=Math.abs(s-r.y)/(i-r.x),ke(r,t)&&(u<f||u===f&&(r.x>e.x||r.x===e.x&&pe(e,r)))&&(e=r,f=u)),r=r.next}while(r!==l);return e}(t,n);if(!e)return n;var r=Ae(e,t);return oe(r,r.next),oe(e,e.next)}function pe(t,n){return be(t.prev,t,n.prev)<0&&be(n.next,t,t.next)<0}function ye(t,n,e,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-e)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-r)*i|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function me(t){var n=t,e=t;do{(n.x<e.x||n.x===e.x&&n.y<e.y)&&(e=n),n=n.next}while(n!==t);return e}function ge(t,n,e,r,i,s,o,a){return(i-o)*(n-a)>=(t-o)*(s-a)&&(t-o)*(r-a)>=(e-o)*(n-a)&&(e-o)*(s-a)>=(i-o)*(r-a)}function ve(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==n.i&&e.next.i!==n.i&&Me(e,e.next,t,n))return!0;e=e.next}while(e!==t);return!1}(t,n)&&(ke(t,n)&&ke(n,t)&&function(t,n){var e=t,r=!1,i=(t.x+n.x)/2,s=(t.y+n.y)/2;do{e.y>s!=e.next.y>s&&e.next.y!==e.y&&i<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next}while(e!==t);return r}(t,n)&&(be(t.prev,t,n.prev)||be(t,n.prev,n))||we(t,n)&&be(t.prev,t,t.next)>0&&be(n.prev,n,n.next)>0)}function be(t,n,e){return(n.y-t.y)*(e.x-n.x)-(n.x-t.x)*(e.y-n.y)}function we(t,n){return t.x===n.x&&t.y===n.y}function Me(t,n,e,r){var i=Fe(be(t,n,e)),s=Fe(be(t,n,r)),o=Fe(be(e,r,t)),a=Fe(be(e,r,n));return i!==s&&o!==a||(!(0!==i||!xe(t,e,n))||(!(0!==s||!xe(t,r,n))||(!(0!==o||!xe(e,t,r))||!(0!==a||!xe(e,n,r)))))}function xe(t,n,e){return n.x<=Math.max(t.x,e.x)&&n.x>=Math.min(t.x,e.x)&&n.y<=Math.max(t.y,e.y)&&n.y>=Math.min(t.y,e.y)}function Fe(t){return t>0?1:t<0?-1:0}function ke(t,n){return be(t.prev,t,t.next)<0?be(t,n,t.next)>=0&&be(t,t.prev,n)>=0:be(t,n,t.prev)<0||be(t,t.next,n)<0}function Ae(t,n){var e=new _e(t.i,t.x,t.y),r=new _e(n.i,n.x,n.y),i=t.next,s=n.prev;return t.next=n,n.prev=t,e.next=i,i.prev=e,r.next=e,e.prev=r,s.next=r,r.prev=s,r}function Pe(t,n,e,r){var i=new _e(t,n,e);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Se(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 _e(t,n,e){this.i=t,this.x=n,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Oe(t,n,e,r){for(var i=0,s=n,o=e-r;s<e;s+=r)i+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return i}re.exports=ie,re.exports.default=ie,ie.deviation=function(t,n,e,r){var i=n&&n.length,s=i?n[0]*e:t.length,o=Math.abs(Oe(t,0,s,e));if(i)for(var a=0,u=n.length;a<u;a++){var l=n[a]*e,h=a<u-1?n[a+1]*e:t.length;o-=Math.abs(Oe(t,l,h,e))}var c=0;for(a=0;a<r.length;a+=3){var f=r[a]*e,d=r[a+1]*e,p=r[a+2]*e;c+=Math.abs((t[f]-t[p])*(t[d+1]-t[f+1])-(t[f]-t[d])*(t[p+1]-t[f+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},ie.flatten=function(t){for(var n=t[0][0].length,e={vertices:[],holes:[],dimensions:n},r=0,i=0;i<t.length;i++){for(var s=0;s<t[i].length;s++)for(var o=0;o<n;o++)e.vertices.push(t[i][s][o]);i>0&&(r+=t[i-1].length,e.holes.push(r))}return e};var Ce=ht(re.exports),Ee="undefined"!=typeof Float32Array?Float32Array:Array;function Ie(t,n,e,r){return t[0]=n,t[1]=e,t[2]=r,t}function $e(t,n){var e=n[0],r=n[1],i=n[2],s=e*e+r*r+i*i;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 Te(t,n,e){var r=n[0],i=n[1],s=n[2],o=e[0],a=e[1],u=e[2];return t[0]=i*u-s*a,t[1]=s*o-r*u,t[2]=r*a-i*o,t}function De(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function ze(t,n,e,r,i){return t[0]=n,t[1]=e,t[2]=r,t[3]=i,t}function je(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t[3]=n[3]/e[3],t}function Ue(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t}function Ne(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]}function Le(t,n,e){return t[0]=n,t[1]=e,t}function Re(t,n){var e=n[0]-t[0],r=n[1]-t[1];return Math.hypot(e,r)}Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)}),function(){var t=function(){var t=new Ee(3);return Ee!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}()}(),function(){var t=function(){var t=new Ee(4);return Ee!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}()}();var Ve=function(t){var n=t[0],e=t[1];return Math.hypot(n,e)};!function(){var t=function(){var t=new Ee(2);return Ee!=Float32Array&&(t[0]=0,t[1]=0),t}()}();\n/*!\n * @maptalks/vector-packer v0.96.2\n * LICENSE : UNLICENSED\n * (c) 2016-2024 maptalks.com\n */\nconst He={Point:1,LineString:2,Polygon:3,MultiPoint:4,MultiLineString:5,MultiPolygon:6};function qe(t,n={}){var e=[];if("FeatureCollection"===t.type)for(var r=0;r<t.features.length;r++)Ge(e,t.features[r],n,r);else Ge(e,"Feature"===t.type?t:{geometry:t},n);return e}function Ge(t,n,e,r){if(n.geometry&&n.geometry.geometry){var i=n.geometry.coordinates,s=n.geometry.type,o=[],a=n.id;if(e.promoteId?a=n.properties[e.promoteId]:e.generateId&&(a=r||0),"Point"===s)Je(i,o);else if("MultiPoint"===s)for(var u=0;u<i.length;u++)Je(i[u],o);else if("LineString"===s)Be([i],o);else if("MultiLineString"===s){if(e.lineMetrics){for(u=0;u<i.length;u++)We(i[u],o=[]),t.push(Xe(a,"LineString",o,n.properties));return}Be(i,o)}else if("Polygon"===s)Be(i,o);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(u=0;u<n.geometry.geometries.length;u++)Ge(t,{id:a,geometry:n.geometry.geometries[u],properties:n.properties},e,r);return}return void console.warn(\`Input data type(${o}s}) is not a valid GeoJSON geometry type.\`)}for(u=0;u<i.length;u++){var l=[];Be(i[u],l),o.push(l)}}t.push(Xe(a,s,o,n.properties))}}function Je(t,n){const e=new dt(t[0],t[1]);e.z=100*(t[2]||0),n.push([e])}function We(t,n){for(let e=0;e<t.length;e++){const r=new dt(t[e][0],t[e][1]);r.z=100*(t[e][2]||0),n.push(r)}}function Be(t,n,e,r){for(var i=0;i<t.length;i++){var s=[];We(t[i],s),n.push(s)}}function Xe(t,n,e,r){return{id:void 0===t?null:t,type:He[n],geometry:e,properties:r}}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */function Ye(t,{width:n,height:e},r,i){if(i){if(i.length!==n*e*r)throw new RangeError("mismatched image size")}else i=new Uint8Array(n*e*r);return t.width=n,t.height=e,t.data=i,t}function Ke(t,{width:n,height:e},r){if(n===t.width&&e===t.height)return;const i=Ye({},{width:n,height:e},r);Ze(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,e)},r),t.width=n,t.height=e,t.data=i.data}function Ze(t,n,e,r,i,s){if(0===i.width||0===i.height)return n;if(i.width>t.width||i.height>t.height||e.x>t.width-i.width||e.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>n.width||i.height>n.height||r.x>n.width-i.width||r.y>n.height-i.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 u=0;u<i.height;u++){const l=((e.y+u)*t.width+e.x)*s,h=((r.y+u)*n.width+r.x)*s;for(let t=0;t<i.width*s;t++)a[h+t]=o[l+t]}return n}class Qe{constructor(t,n){Ye(this,t,1,n)}resize(t){Ke(this,t,1)}clone(){return new Qe({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,e,r,i){Ze(t,n,e,r,i,1)}}class tr{constructor(t,n){Ye(this,t,4,n)}resize(t){Ke(this,t,4)}clone(){return new tr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,e,r,i){Ze(t,n,e,r,i,4)}}function nr(t){let n=0;for(let e,r,i=0,s=t.length,o=s-1;i<s;o=i++)if(e=t[i],r=t[o],void 0!==e.x){if(e.z||r.z)return 1;n+=(r.x-e.x)*(e.y+r.y)}else{if(e[2]||r[2])return 1;n+=(r[0]-e[0])*(e[1]+r[1])}return n}function er(t,n,e,r,i){const s=t[n*r],o=t[n*r+1],a=t[e*r],u=t[e*r+1];return s===a&&(s<0||s>i)&&o!==u||o===u&&(o<0||o>i)&&s!==a}function rr(t,n,e){let r=e;return n&&t&&(r=+t[n]),isNaN(r)&&(r=e||0),100*r}function ir(t,n,e,r,i,s,o){n||0===n||(n=1);const a=rr(t.properties,e,r),u=a*n;let l=(s?100*s:0)||a;return i?l=rr(t.properties,i,s):o&&(l=a-rr(t.properties,o,s)),l*=n,{altitude:u,height:l}}function sr(t,n){return n<1/0&&(t.x<0||t.x>n||t.y<0||t.y>n)}function or(t){return null==t}function ar(t,n,e){if(t===e||t===n)return t;const r=e-n;return((t-n)%r+r)%r+n}function ur(t,n){if(!n)return null;const e=new Map;for(let r=0;r<n.length;r++){const i=n[r],s=t[i];let o=e.get(s);o||(o=[],e.set(s,o)),o.push(i)}return e}function lr(t){return!(t&t-1)&&0!==t}\n/*!\n * Codes from mapbox-gl-js\n * github.com/mapbox/mapbox-gl-js\n * MIT License\n */class hr{constructor(t,n,{pixelRatio:e}){this.paddedRect=t,this.pixelRatio=e||1,this.padding=n}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.pixelRatio,(this.paddedRect.h-2*this.padding)/this.pixelRatio]}}class cr{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n=Object.keys(t).length,e={},r=new pt(0,0,{autoResize:!0}),i=[],s=n>1?1:0;for(const n in t){const r=t[n],o={x:0,y:0,w:r.data.width+2*s,h:r.data.height+2*s};i.push(o),e[n]=new hr(o,s,r)}if(r.pack(i,{inPlace:!0}),!lr(r.w)||!lr(r.h)){const t=fr(r.w),n=fr(r.h);r.resize(t,n)}const o=new tr({width:r.w,height:r.h});for(const n in t){const r=t[n],i=e[n].paddedRect;tr.copy(r.data,o,{x:0,y:0},{x:i.x+s,y:i.y+s},r.data)}this.image=o,this.positions=e}}function fr(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 dr{constructor(t){this.glyphMap=t,this.build()}build(){const t=this.glyphMap,n={},e=new pt(0,0,{autoResize:!0}),r=[];for(const e in t){const i=t[e],s=n[e]={};for(const t in i){const n=i[+t];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const e={x:0,y:0,w:n.bitmap.width+2,h:n.bitmap.height+2};r.push(e),s[t]={rect:e,metrics:n.metrics}}}e.pack(r,{inPlace:!0});const i=new Qe({width:e.w,height:e.h});for(const e in t){const r=t[e];for(const t in r){const s=r[+t];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const o=n[e][t].rect;Qe.copy(s.bitmap,i,{x:0,y:0},{x:o.x+1,y:o.y+1},s.bitmap)}}this.image=i,this.positions=n}}function pr(t){return t<65536?Uint16Array:Uint32Array}function yr(t){return(t=Math.abs(t))<128?Int8Array:t<32768?Int16Array:Float32Array}function mr(t){return t<256?Uint8Array:t<65536?Uint16Array:Float32Array}function gr(t,n){const e=t.getLength?t.getLength():t.length;if(t instanceof n)return t.slice(0,e);const r=new n(e);t=t.R||t;for(let n=0;n<e;n++)r[n]=t[n]||0;return r}function vr(t){const n=t.type,e=[];if(1===n||4===n)for(let n=0;n<t.geometry.length;n++)Je(t.geometry[n],e);else if(2===n)Be(t.geometry,e);else if(3===n)Be(t.geometry,e);else if(5===n)Be(t.geometry,e);else if(6===n)for(let n=0;n<t.geometry.length;n++){const r=[];Be(t.geometry[n],r),e.push(r)}return t.geometry=e,t}function br(t){for(let n=1;n<arguments.length;n++){const e=arguments[n];for(const n in e)t[n]=e[n]}return t}function wr(t){return null==t}function Mr(t){return"number"==typeof t&&!isNaN(t)}function xr(t){return"object"==typeof t&&!!t}function Fr(t){return!wr(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function kr(t){return!wr(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}const Ar=Object.prototype.hasOwnProperty;function Pr(t,n){return Ar.call(t,n)}const Sr=Math.PI/180;function _r(t){return t&&y(t)&&t.property}function Or(t){const{verticalCentimeterToPoint:n,tileRatio:e}=t;return n*e}function Cr(t){return"centimeter"===t||"cm"===t?1:"millimeter"===t||"mm"===t?.1:100}const Er={};function Ir(t,n){if(!Array.isArray(n)){if(n&&void 0!==n.r&&void 0!==n.g&&void 0!==n.b)return t[0]=255*n.r,t[1]=255*n.g,t[2]=255*n.b,t[3]=void 0!==n.a?255*n.a:255,t;n=Er[n]=Er[n]||an(n).unitArray()}for(let e=0;e<n.length;e++)t[e]=255*n[e];return 3===n.length&&(t[3]=255),t}const $r={textFill:1,textSize:1,textOpacity:1,textDx:1,textDy:1,markerWidth:1,markerHeight:1,markerOpacity:1,markerDx:1,markerDy:1,lineWidth:1,lineColor:1,lineOpacity:1,polygonFill:1,polygonOpacity:1,polygonPatternFileWidth:1,polygonPatternFileOrigin:1,rotationX:1,rotationY:1,rotationZ:1,scaleX:1,scaleY:1,scaleZ:1,translationX:1,translationY:1,translationZ:1},Tr={textName:1,markerTextFitPadding:1,markerTextFit:1,lineGradientProperty:1};var Dr=Object.freeze({__proto__:null,checkIfIdentityZoomDependent:function(t,n,e){if(Array.isArray(e)||(e=Object.values(e)),!e||!e.length)return!1;if(!$r[t])return!1;for(let t=0;t<e.length;t++){const r=e[t]&&(e[t].feature||e[t]);if(!r)continue;const i=r.properties&&r.properties[n];if(i&&y(i)&&!m(i).isZoomConstant)return!0}return!1},checkIfZoomFnTypeSymbol:function(t){return!!$r[t]||!!Tr[t]},evaluate:function(t,n,e){return kr(t)?t(void 0!==e?e:null,n):t},extend:br,getAltitudeToLocal:Or,getTubeSizeScale:Cr,hasOwn:Pr,isFnTypeSymbol:_r,isFunction:kr,isInteger:function(t){return(0|t)===t},isNil:wr,isNumber:Mr,isObject:xr,isString:Fr,join:function(t,n){return t.join?t.join(n||","):Array.prototype.join.call(t,n||",")},normalizeColor:Ir,now:function(){return Date.now()},toDegree:function(t){return t/Sr},toRadian:function(t){return t*Sr}});class zr{constructor(t,n,e,r){this.feature=t,this.symbol=n,this.fnTypes=e,this.options=r}getPolygonResource(){let t=this.symbol.polygonPatternFile;const{polygonPatternFileFn:n}=this.fnTypes;return this.V(t,n)}getLineResource(){let t=this.symbol.linePatternFile;const{linePatternFileFn:n}=this.fnTypes;return this.V(t,n)}V(t,n){return n&&(t=n(this.options.zoom,this.feature.properties)),t}}function jr(t,n,e,r){const i=Math.abs(r)>>15,s=i>>1,o=i%2;let a=r%Math.pow(2,15);const u=n+(s<<14)*Math.sign(n),l=e+(o<<14)*Math.sign(e);return t[0]=u,t[1]=l,a=Math.round(a),t[2]=0===a?r<0?-1:0:a,t}const Ur=Math.pow(2,14),Nr=Math.pow(2,15);\n/*!\n * a compact version of mapbox-gl-style-spec\n * based on mapbox-gl-style-spec@13.28.0\n * https://github.com/mapbox/mapbox-gl-js/tree/main/src/style-spec\n * LICENSE : ISC\n */var Lr,Rr,Vr="undefined"!=typeof undefinedThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof undefined?global:"undefined"!=typeof self?self:{},Hr={exports:{}};function qr(t,...n){for(const e of n)for(const n in e)t[n]=e[n];return t}\n/*! https://mths.be/punycode v1.3.2 by @mathias */Lr=Hr,Rr=Hr.exports,function(t){var n=Rr&&!Rr.nodeType&&Rr,e=Lr&&!Lr.nodeType&&Lr,r="object"==typeof Vr&&Vr;r.global!==r&&r.window!==r&&r.self!==r||(t=r);var i,s,o=2147483647,a=36,u=26,l=38,h=700,c=/^xn--/,f=/[^\\x20-\\x7E]/,d=/[\\x2E\\u3002\\uFF0E\\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=a-1,m=Math.floor,g=String.fromCharCode;function v(t){throw RangeError(p[t])}function b(t,n){for(var e=t.length,r=[];e--;)r[e]=n(t[e]);return r}function w(t,n){var e=t.split("@"),r="";return e.length>1&&(r=e[0]+"@",t=e[1]),r+b((t=t.replace(d,".")).split("."),n).join(".")}function M(t){for(var n,e,r=[],i=0,s=t.length;i<s;)(n=t.charCodeAt(i++))>=55296&&n<=56319&&i<s?56320==(64512&(e=t.charCodeAt(i++)))?r.push(((1023&n)<<10)+(1023&e)+65536):(r.push(n),i--):r.push(n);return r}function x(t){return b(t,(function(t){var n="";return t>65535&&(n+=g((t-=65536)>>>10&1023|55296),t=56320|1023&t),n+g(t)})).join("")}function F(t,n){return t+22+75*(t<26)-((0!=n)<<5)}function k(t,n,e){var r=0;for(t=e?m(t/h):t>>1,t+=m(t/n);t>y*u>>1;r+=a)t=m(t/y);return m(r+(y+1)*t/(t+l))}function A(t){var n,e,r,i,s,l,h,c,f,d,p,y=[],g=t.length,b=0,w=128,M=72;for((e=t.lastIndexOf("-"))<0&&(e=0),r=0;r<e;++r)t.charCodeAt(r)>=128&&v("not-basic"),y.push(t.charCodeAt(r));for(i=e>0?e+1:0;i<g;){for(s=b,l=1,h=a;i>=g&&v("invalid-input"),((c=(p=t.charCodeAt(i++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:a)>=a||c>m((o-b)/l))&&v("overflow"),b+=c*l,!(c<(f=h<=M?1:h>=M+u?u:h-M));h+=a)l>m(o/(d=a-f))&&v("overflow"),l*=d;M=k(b-s,n=y.length+1,0==s),m(b/n)>o-w&&v("overflow"),w+=m(b/n),b%=n,y.splice(b++,0,w)}return x(y)}function P(t){var n,e,r,i,s,l,h,c,f,d,p,y,b,w,x,A=[];for(y=(t=M(t)).length,n=128,e=0,s=72,l=0;l<y;++l)(p=t[l])<128&&A.push(g(p));for(r=i=A.length,i&&A.push("-");r<y;){for(h=o,l=0;l<y;++l)(p=t[l])>=n&&p<h&&(h=p);for(h-n>m((o-e)/(b=r+1))&&v("overflow"),e+=(h-n)*b,n=h,l=0;l<y;++l)if((p=t[l])<n&&++e>o&&v("overflow"),p==n){for(c=e,f=a;!(c<(d=f<=s?1:f>=s+u?u:f-s));f+=a)A.push(g(F(d+(x=c-d)%(w=a-d),0))),c=m(x/w);A.push(g(F(c,0))),s=k(e,b,r==i),e=0,++r}++e,++n}return A.join("")}if(i={version:"1.3.2",ucs2:{decode:M,encode:x},decode:A,encode:P,toASCII:function(t){return w(t,(function(t){return f.test(t)?"xn--"+P(t):t}))},toUnicode:function(t){return w(t,(function(t){return c.test(t)?A(t.slice(4).toLowerCase()):t}))}},n&&e)if(Lr.exports==n)e.exports=i;else for(s in i)i.hasOwnProperty(s)&&(n[s]=i[s]);else t.punycode=i}(Vr);class Gr extends Error{constructor(t,n){super(n),this.message=n,this.key=t}}var Jr=Gr;class Wr{constructor(t,n=[]){this.parent=t,this.bindings={};for(const[t,e]of n)this.bindings[t]=e}concat(t){return new Wr(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(\`${o}t} not found in scope.\`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}var Br=Wr;const Xr={kind:"null"},Yr={kind:"number"},Kr={kind:"string"},Zr={kind:"boolean"},Qr={kind:"color"},ti={kind:"object"},ni={kind:"value"},ei={kind:"collator"},ri={kind:"formatted"},ii={kind:"resolvedImage"};function si(t,n){return{kind:"array",itemType:t,N:n}}function oi(t){if("array"===t.kind){const n=oi(t.itemType);return"number"==typeof t.N?\`array<${o}n}, ${o}t.N}>\`:"value"===t.itemType.kind?"array":\`array<${o}n}>\`}return t.kind}const ai=[Xr,Yr,Kr,Zr,Qr,ri,ti,si(ni),ii];function ui(t,n){if("error"===n.kind)return null;if("array"===t.kind){if("array"===n.kind&&(0===n.N&&"value"===n.itemType.kind||!ui(t.itemType,n.itemType))&&("number"!=typeof t.N||t.N===n.N))return null}else{if(t.kind===n.kind)return null;if("value"===t.kind)for(const t of ai)if(!ui(t,n))return null}return\`Expected ${o}oi(t)} but found ${o}oi(n)} instead.\`}function li(t,n){return n.some((n=>n.kind===t.kind))}function hi(t,n){return n.some((n=>"null"===n?null===t:"array"===n?Array.isArray(t):"object"===n?t&&!Array.isArray(t)&&"object"==typeof t:n===typeof t))}var ci,fi={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function di(t){return(t=Math.round(t))<0?0:t>255?255:t}function pi(t){return di("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function yi(t){return function(t){return t<0?0:t>1?1:t}("%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))}function mi(t,n,e){return e<0?e+=1:e>1&&(e-=1),6*e<1?t+(n-t)*e*6:2*e<1?n:3*e<2?t+(n-t)*(2/3-e)*6:t}try{ci={}.parseCSSColor=function(t){var n,e=t.replace(/ /g,"").toLowerCase();if(e in fi)return fi[e].slice();if("#"===e[0])return 4===e.length?(n=parseInt(e.substr(1),16))>=0&&n<=4095?[(3840&n)>>4|(3840&n)>>8,240&n|(240&n)>>4,15&n|(15&n)<<4,1]:null:7===e.length&&(n=parseInt(e.substr(1),16))>=0&&n<=16777215?[(16711680&n)>>16,(65280&n)>>8,255&n,1]:null;var r=e.indexOf("("),i=e.indexOf(")");if(-1!==r&&i+1===e.length){var s=e.substr(0,r),o=e.substr(r+1,i-(r+1)).split(","),a=1;switch(s){case"rgba":if(4!==o.length)return null;a=yi(o.pop());case"rgb":return 3!==o.length?null:[pi(o[0]),pi(o[1]),pi(o[2]),a];case"hsla":if(4!==o.length)return null;a=yi(o.pop());case"hsl":if(3!==o.length)return null;var u=(parseFloat(o[0])%360+360)%360/360,l=yi(o[1]),h=yi(o[2]),c=h<=.5?h*(l+1):h+l-h*l,f=2*h-c;return[di(255*mi(f,c,u+1/3)),di(255*mi(f,c,u)),di(255*mi(f,c,u-1/3)),a];default:return null}}return null}}catch(dt){}class gi{constructor(t,n,e,r=1){this.r=t,this.g=n,this.b=e,this.a=r}static parse(t){if(!t)return;if(t instanceof gi)return t;if("string"!=typeof t)return;const n=ci(t);return n?new gi(n[0]/255*n[3],n[1]/255*n[3],n[2]/255*n[3],n[3]):void 0}toString(){const[t,n,e,r]=this.toArray();return\`rgba(${o}Math.round(t)},${o}Math.round(n)},${o}Math.round(e)},${o}r})\`}toArray(){const{r:t,g:n,b:e,a:r}=this;return 0===r?[0,0,0,0]:[255*t/r,255*n/r,255*e/r,r]}toArray01(){const{r:t,g:n,b:e,a:r}=this;return 0===r?[0,0,0,0]:[t/r,n/r,e/r,r]}toArray01PremultipliedAlpha(){const{r:t,g:n,b:e,a:r}=this;return[t,n,e,r]}}gi.black=new gi(0,0,0,1),gi.white=new gi(1,1,1,1),gi.transparent=new gi(0,0,0,0),gi.red=new gi(1,0,0,1),gi.blue=new gi(0,0,1,1);var vi=gi;class bi{constructor(t,n,e){this.sensitivity=t?n?"variant":"case":n?"accent":"base",this.locale=e,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,n){return this.collator.compare(t,n)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class wi{constructor(t,n,e,r,i){this.text=t.normalize?t.normalize():t,this.image=n,this.scale=e,this.fontStack=r,this.textColor=i}}class Mi{constructor(t){this.sections=t}static fromString(t){return new Mi([new wi(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof Mi?t:Mi.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}serialize(){const t=["format"];for(const n of this.sections){if(n.image){t.push(["image",n.image.name]);continue}t.push(n.text);const e={};n.fontStack&&(e["text-font"]=["literal",n.fontStack.split(",")]),n.scale&&(e["font-scale"]=n.scale),n.textColor&&(e["text-color"]=["rgba"].concat(n.textColor.toArray())),t.push(e)}return t}}class xi{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new xi({name:t,available:!1}):null}serialize(){return["image",this.name]}}function Fi(t,n,e,r){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof n&&n>=0&&n<=255&&"number"==typeof e&&e>=0&&e<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:\`Invalid rgba value [${o}[t,n,e,r].join(", ")}]: 'a' must be between 0 and 1.\`:\`Invalid rgba value [${o}("number"==typeof r?[t,n,e,r]:[t,n,e]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.\`}function ki(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof vi)return!0;if(t instanceof bi)return!0;if(t instanceof Mi)return!0;if(t instanceof xi)return!0;if(Array.isArray(t)){for(const n of t)if(!ki(n))return!1;return!0}if("object"==typeof t){for(const n in t)if(!ki(t[n]))return!1;return!0}return!1}function Ai(t){if(null===t)return Xr;if("string"==typeof t)return Kr;if("boolean"==typeof t)return Zr;if("number"==typeof t)return Yr;if(t instanceof vi)return Qr;if(t instanceof bi)return ei;if(t instanceof Mi)return ri;if(t instanceof xi)return ii;if(Array.isArray(t)){const n=t.length;let e;for(const n of t){const t=Ai(n);if(e){if(e===t)continue;e=ni;break}e=t}return si(e||ni,n)}return ti}function Pi(t){const n=typeof t;return null===t?"":"string"===n||"number"===n||"boolean"===n?String(t):t instanceof vi||t instanceof Mi||t instanceof xi?t.toString():JSON.stringify(t)}class Si{constructor(t,n){this.type=t,this.value=n}static parse(t,n){if(2!==t.length)return n.error(\`'literal' expression requires exactly one argument, but found ${o}t.length-1} instead.\`);if(!ki(t[1]))return n.error("invalid value");const e=t[1];let r=Ai(e);const i=n.expectedType;return"array"!==r.kind||0!==r.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(r=i),new Si(r,e)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof vi?["rgba"].concat(this.value.toArray()):this.value instanceof Mi?this.value.serialize():this.value}}var _i=Si,Oi=class{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}};const Ci={string:Kr,number:Yr,boolean:Zr,object:ti};class Ei{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let e,r=1;const i=t[0];if("array"===i){let i,s;if(t.length>2){const e=t[1];if("string"!=typeof e||!(e in Ci)||"object"===e)return n.error('The item type argument of "array" must be one of string, number, boolean',1);i=Ci[e],r++}else i=ni;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return n.error('The length argument to "array" must be a positive integer literal',2);s=t[2],r++}e=si(i,s)}else e=Ci[i];const s=[];for(;r<t.length;r++){const e=n.parse(t[r],r,ni);if(!e)return null;s.push(e)}return new Ei(e,s)}evaluate(t){for(let n=0;n<this.args.length;n++){const e=this.args[n].evaluate(t);if(!ui(this.type,Ai(e)))return e;if(n===this.args.length-1)throw new Oi(\`Expected value to be of type ${o}oi(this.type)}, but found ${o}oi(Ai(e))} instead.\`)}return null}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=this.type,n=[t.kind];if("array"===t.kind){const e=t.itemType;if("string"===e.kind||"number"===e.kind||"boolean"===e.kind){n.push(e.kind);const r=t.N;("number"==typeof r||this.args.length>1)&&n.push(r)}}return n.concat(this.args.map((t=>t.serialize())))}}var Ii=Ei;class $i{constructor(t){this.type=ri,this.sections=t}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const e=t[1];if(!Array.isArray(e)&&"object"==typeof e)return n.error("First argument must be an image or text section.");const r=[];let i=!1;for(let e=1;e<=t.length-1;++e){const s=t[e];if(i&&"object"==typeof s&&!Array.isArray(s)){i=!1;let t=null;if(s["font-scale"]&&(t=n.parse(s["font-scale"],1,Yr),!t))return null;let e=null;if(s["text-font"]&&(e=n.parse(s["text-font"],1,si(Kr)),!e))return null;let o=null;if(s["text-color"]&&(o=n.parse(s["text-color"],1,Qr),!o))return null;const a=r[r.length-1];a.scale=t,a.font=e,a.textColor=o}else{const s=n.parse(t[e],1,ni);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return n.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,r.push({content:s,scale:null,font:null,textColor:null})}}return new $i(r)}evaluate(t){return new Mi(this.sections.map((n=>{const e=n.content.evaluate(t);return Ai(e)===ii?new wi("",e,null,null,null):new wi(Pi(e),null,n.scale?n.scale.evaluate(t):null,n.font?n.font.evaluate(t).join(","):null,n.textColor?n.textColor.evaluate(t):null)})))}eachChild(t){for(const n of this.sections)t(n.content),n.scale&&t(n.scale),n.font&&t(n.font),n.textColor&&t(n.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const n of this.sections){t.push(n.content.serialize());const e={};n.scale&&(e["font-scale"]=n.scale.serialize()),n.font&&(e["text-font"]=n.font.serialize()),n.textColor&&(e["text-color"]=n.textColor.serialize()),t.push(e)}return t}}class Ti{constructor(t){this.type=ii,this.input=t}static parse(t,n){if(2!==t.length)return n.error("Expected two arguments.");const e=n.parse(t[1],1,Kr);return e?new Ti(e):n.error("No image name provided.")}evaluate(t){const n=this.input.evaluate(t),e=xi.fromString(n);return e&&t.availableImages&&(e.available=t.availableImages.indexOf(n)>-1),e}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Di={"to-boolean":Zr,"to-color":Qr,"to-number":Yr,"to-string":Kr};class zi{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const e=t[0];if(("to-boolean"===e||"to-string"===e)&&2!==t.length)return n.error("Expected one argument.");const r=Di[e],i=[];for(let e=1;e<t.length;e++){const r=n.parse(t[e],e,ni);if(!r)return null;i.push(r)}return new zi(r,i)}evaluate(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){let n,e;for(const r of this.args){if(n=r.evaluate(t),e=null,n instanceof vi)return n;if("string"==typeof n){const e=t.parseColor(n);if(e)return e}else if(Array.isArray(n)&&(e=n.length<3||n.length>4?\`Invalid rbga value ${o}JSON.stringify(n)}: expected an array containing either three or four numeric values.\`:Fi(n[0],n[1],n[2],n[3]),!e))return new vi(n[0]/255,n[1]/255,n[2]/255,n[3])}throw new Oi(e||\`Could not parse color from value '${o}"string"==typeof n?n:String(JSON.stringify(n))}'\`)}if("number"===this.type.kind){let n=null;for(const e of this.args){if(n=e.evaluate(t),null===n)return 0;const r=Number(n);if(!isNaN(r))return r}throw new Oi(\`Could not convert ${o}JSON.stringify(n)} to number.\`)}return"formatted"===this.type.kind?Mi.fromString(Pi(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?xi.fromString(Pi(this.args[0].evaluate(t))):Pi(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new $i([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Ti(this.args[0]).serialize();const t=[\`to-${o}this.type.kind}\`];return this.eachChild((n=>{t.push(n.serialize())})),t}}var ji=zi;const Ui=["Unknown","Point","LineString","Polygon"];var Ni=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this.H={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Ui[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const t=this.featureDistanceData.center,n=this.featureDistanceData.scale,{x:e,y:r}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(e*n-t[0])+this.featureDistanceData.bearing[1]*(r*n-t[1])}return 0}parseColor(t){let n=this.H[t];return n||(n=this.H[t]=vi.parse(t)),n}};class Li{constructor(t,n,e,r){this.name=t,this.type=n,this.q=e,this.args=r}evaluate(t){return this.q(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,n){const e=t[0],r=Li.definitions[e];if(!r)return n.error(\`Unknown expression "${o}e}". If you wanted a literal array, use ["literal", [...]].\`,0);const i=Array.isArray(r)?r[0]:r.type,s=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,o=s.filter((([n])=>!Array.isArray(n)||n.length===t.length-1));let a=null;for(const[r,s]of o){a=new ds(n.registry,n.path,null,n.scope);const o=[];let u=!1;for(let n=1;n<t.length;n++){const e=t[n],i=Array.isArray(r)?r[n-1]:r.type,s=a.parse(e,1+o.length,i);if(!s){u=!0;break}o.push(s)}if(!u)if(Array.isArray(r)&&r.length!==o.length)a.error(\`Expected ${o}r.length} arguments, but found ${o}o.length} instead.\`);else{for(let t=0;t<o.length;t++){const n=Array.isArray(r)?r[t]:r.type,e=o[t];a.concat(t+1).checkSubtype(n,e.type)}if(0===a.errors.length)return new Li(e,i,s,o)}}if(1===o.length)n.errors.push(...a.errors);else{const e=(o.length?o:s).map((([t])=>{return n=t,Array.isArray(n)?\`(${o}n.map(oi).join(", ")})\`:\`(${o}oi(n.type)}...)\`;var n})).join(" | "),r=[];for(let e=1;e<t.length;e++){const i=n.parse(t[e],1+r.length);if(!i)return null;r.push(oi(i.type))}n.error(\`Expected arguments of type ${o}e}, but found (${o}r.join(", ")}) instead.\`)}return null}static register(t,n){Li.definitions=n;for(const e in n)t[e]=Li}}var Ri=Li;class Vi{constructor(t,n,e){this.type=ei,this.locale=e,this.caseSensitive=t,this.diacriticSensitive=n}static parse(t,n){if(2!==t.length)return n.error("Expected one argument.");const e=t[1];if("object"!=typeof e||Array.isArray(e))return n.error("Collator options argument must be an object.");const r=n.parse(void 0!==e["case-sensitive"]&&e["case-sensitive"],1,Zr);if(!r)return null;const i=n.parse(void 0!==e["diacritic-sensitive"]&&e["diacritic-sensitive"],1,Zr);if(!i)return null;let s=null;return e.locale&&(s=n.parse(e.locale,1,Kr),!s)?null:new Vi(r,i,s)}evaluate(t){return new bi(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}serialize(){const t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]}}const Hi=8192;function qi(t,n){t[0]=Math.min(t[0],n[0]),t[1]=Math.min(t[1],n[1]),t[2]=Math.max(t[2],n[0]),t[3]=Math.max(t[3],n[1])}function Gi(t,n){return!(t[0]<=n[0]||t[2]>=n[2]||t[1]<=n[1]||t[3]>=n[3])}function Ji(t,n){const e=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,n.z);return[Math.round(e*i*Hi),Math.round(r*i*Hi)]}function Wi(t,n,e){const r=t[0]-n[0],i=t[1]-n[1],s=t[0]-e[0],o=t[1]-e[1];return r*o-s*i==0&&r*s<=0&&i*o<=0}function Bi(t,n){let e=!1;for(let o=0,a=n.length;o<a;o++){const a=n[o];for(let n=0,o=a.length;n<o-1;n++){if(Wi(t,a[n],a[n+1]))return!1;(i=a[n])[1]>(r=t)[1]!=(s=a[n+1])[1]>r[1]&&r[0]<(s[0]-i[0])*(r[1]-i[1])/(s[1]-i[1])+i[0]&&(e=!e)}}var r,i,s;return e}function Xi(t,n){for(let e=0;e<n.length;e++)if(Bi(t,n[e]))return!0;return!1}function Yi(t,n,e,r){const i=r[0]-e[0],s=r[1]-e[1],o=(t[0]-e[0])*s-i*(t[1]-e[1]),a=(n[0]-e[0])*s-i*(n[1]-e[1]);return o>0&&a<0||o<0&&a>0}function Ki(t,n,e){for(const l of e)for(let e=0;e<l.length-1;++e)if(void 0,void 0,0!=(a=[(o=l[e+1])[0]-(s=l[e])[0],o[1]-s[1]])[0]*(u=[(i=n)[0]-(r=t)[0],i[1]-r[1]])[1]-a[1]*u[0]&&Yi(r,i,s,o)&&Yi(s,o,r,i))return!0;var r,i,s,o,a,u;return!1}function Zi(t,n){for(let e=0;e<t.length;++e)if(!Bi(t[e],n))return!1;for(let e=0;e<t.length-1;++e)if(Ki(t[e],t[e+1],n))return!1;return!0}function Qi(t,n){for(let e=0;e<n.length;e++)if(Zi(t,n[e]))return!0;return!1}function ts(t,n,e){const r=[];for(let i=0;i<t.length;i++){const s=[];for(let r=0;r<t[i].length;r++){const o=Ji(t[i][r],e);qi(n,o),s.push(o)}r.push(s)}return r}function ns(t,n,e){const r=[];for(let i=0;i<t.length;i++){const s=ts(t[i],n,e);r.push(s)}return r}function es(t,n,e,r){if(t[0]<e[0]||t[0]>e[2]){const n=.5*r;let i=t[0]-e[0]>n?-r:e[0]-t[0]>n?r:0;0===i&&(i=t[0]-e[2]>n?-r:e[2]-t[0]>n?r:0),t[0]+=i}qi(n,t)}function rs(t,n,e,r){const i=Math.pow(2,r.z)*Hi,s=[r.x*Hi,r.y*Hi],o=[];if(!t)return o;for(const r of t)for(const t of r){const r=[t.x+s[0],t.y+s[1]];es(r,n,e,i),o.push(r)}return o}function is(t,n,e,r){const i=Math.pow(2,r.z)*Hi,s=[r.x*Hi,r.y*Hi],o=[];if(!t)return o;for(const e of t){const t=[];for(const r of e){const e=[r.x+s[0],r.y+s[1]];qi(n,e),t.push(e)}o.push(t)}if(n[2]-n[0]<=i/2){(a=n)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const r of t)es(r,n,e,i)}var a;return o}class ss{constructor(t,n){this.type=Zr,this.geojson=t,this.geometries=n}static parse(t,n){if(2!==t.length)return n.error(\`'within' expression requires exactly one argument, but found ${o}t.length-1} instead.\`);if(ki(t[1])){const n=t[1];if("FeatureCollection"===n.type)for(let t=0;t<n.features.length;++t){const e=n.features[t].geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new ss(n,n.features[t].geometry)}else if("Feature"===n.type){const t=n.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new ss(n,n.geometry)}else if("Polygon"===n.type||"MultiPolygon"===n.type)return new ss(n,n)}return n.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,n){const e=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(!i)return!1;if("Polygon"===n.type){const s=ts(n.coordinates,r,i),o=rs(t.geometry(),e,r,i);if(!Gi(e,r))return!1;for(const t of o)if(!Bi(t,s))return!1}if("MultiPolygon"===n.type){const s=ns(n.coordinates,r,i),o=rs(t.geometry(),e,r,i);if(!Gi(e,r))return!1;for(const t of o)if(!Xi(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,n){const e=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(!i)return!1;if("Polygon"===n.type){const s=ts(n.coordinates,r,i),o=is(t.geometry(),e,r,i);if(!Gi(e,r))return!1;for(const t of o)if(!Zi(t,s))return!1}if("MultiPolygon"===n.type){const s=ns(n.coordinates,r,i),o=is(t.geometry(),e,r,i);if(!Gi(e,r))return!1;for(const t of o)if(!Qi(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}var os=ss;function as(t){if(t instanceof Ri){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof os)return!1;let n=!0;return t.eachChild((t=>{n&&!as(t)&&(n=!1)})),n}function us(t){if(t instanceof Ri&&"feature-state"===t.name)return!1;let n=!0;return t.eachChild((t=>{n&&!us(t)&&(n=!1)})),n}function ls(t,n){if(t instanceof Ri&&n.indexOf(t.name)>=0)return!1;let e=!0;return t.eachChild((t=>{e&&!ls(t,n)&&(e=!1)})),e}class hs{constructor(t,n){this.type=n.type,this.name=t,this.boundExpression=n}static parse(t,n){if(2!==t.length||"string"!=typeof t[1])return n.error("'var' expression requires exactly one string literal argument.");const e=t[1];return n.scope.has(e)?new hs(e,n.scope.get(e)):n.error(\`Unknown variable "${o}e}". Make sure "${o}e}" has been bound in an enclosing "let" expression before using it.\`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var cs=hs;class fs{constructor(t,n=[],e,r=new Br,i=[]){this.registry=t,this.path=n,this.key=n.map((t=>\`[${o}t}]\`)).join(""),this.scope=r,this.errors=i,this.expectedType=e}parse(t,n,e,r,i={}){return n?this.concat(n,e,r).G(t,i):this.G(t,i)}G(t,n){function e(t,n,e){return"assert"===e?new Ii(n,[t]):"coerce"===e?new ji(n,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r=t[0];if("string"!=typeof r)return this.error(\`Expression name must be a string, but found ${o}typeof r} instead. If you wanted a literal array, use ["literal", [...]].\`,0),null;const i=this.registry[r];if(i){let r=i.parse(t,this);if(!r)return null;if(this.expectedType){const t=this.expectedType,i=r.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==i.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==i.kind&&"string"!==i.kind){if(this.checkSubtype(t,i))return null}else r=e(r,t,n.typeAnnotation||"coerce");else r=e(r,t,n.typeAnnotation||"assert")}if(!(r instanceof _i)&&"resolvedImage"!==r.type.kind&&ps(r)){const n=new Ni;try{r=new _i(r.type,r.evaluate(n))}catch(t){return this.error(t.message),null}}return r}return this.error(\`Unknown expression "${o}r}". If you wanted a literal array, use ["literal", [...]].\`,0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':\`Expected an array, but found ${o}typeof t} instead.\`)}concat(t,n,e){const r="number"==typeof t?this.path.concat(t):this.path,i=e?this.scope.concat(e):this.scope;return new fs(this.registry,r,n||null,i,this.errors)}error(t,...n){const e=\`${o}this.key}${o}n.map((t=>\`[${o}t}]\`)).join("")}\`;this.errors.push(new Jr(e,t))}checkSubtype(t,n){const e=ui(t,n);return e&&this.error(e),e}}var ds=fs;function ps(t){if(t instanceof cs)return ps(t.boundExpression);if(t instanceof Ri&&"error"===t.name)return!1;if(t instanceof Vi)return!1;if(t instanceof os)return!1;const n=t instanceof ji||t instanceof Ii;let e=!0;return t.eachChild((t=>{e=n?e&&ps(t):e&&t instanceof _i})),!!e&&as(t)&&ls(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function ys(t,n){const e=t.length-1;let r,i,s=0,o=e,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),r=t[a],i=t[a+1],r<=n){if(a===e||n<i)return a;s=a+1}else{if(!(r>n))throw new Oi("Input is not a number.");o=a-1}return 0}class ms{constructor(t,n,e){this.type=t,this.input=n,this.labels=[],this.outputs=[];for(const[t,n]of e)this.labels.push(t),this.outputs.push(n)}static parse(t,n){if(t.length-1<4)return n.error(\`Expected at least 4 arguments, but found only ${o}t.length-1}.\`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");const e=n.parse(t[1],1,Yr);if(!e)return null;const r=[];let i=null;n.expectedType&&"value"!==n.expectedType.kind&&(i=n.expectedType);for(let e=1;e<t.length;e+=2){const s=1===e?-1/0:t[e],o=t[e+1],a=e,u=e+1;if("number"!=typeof s)return n.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(r.length&&r[r.length-1][0]>=s)return n.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const l=n.parse(o,u,i);if(!l)return null;i=i||l.type,r.push([s,l])}return new ms(i,e,r)}evaluate(t){const n=this.labels,e=this.outputs;if(1===n.length)return e[0].evaluate(t);const r=this.input.evaluate(t);if(r<=n[0])return e[0].evaluate(t);const i=n.length;return r>=n[i-1]?e[i-1].evaluate(t):e[ys(n,r)].evaluate(t)}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=["step",this.input.serialize()];for(let n=0;n<this.labels.length;n++)n>0&&t.push(this.labels[n]),t.push(this.outputs[n].serialize());return t}}var gs=ms,vs=bs;function bs(t,n,e,r){this.cx=3*t,this.bx=3*(e-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(r-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=e,this.p2y=r}function ws(t,n,e){return t*(1-e)+n*e}bs.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,n){if(void 0===n&&(n=1e-6),t<0)return 0;if(t>1)return 1;for(var e=t,r=0;r<8;r++){var i=this.sampleCurveX(e)-t;if(Math.abs(i)<n)return e;var s=this.sampleCurveDerivativeX(e);if(Math.abs(s)<1e-6)break;e-=i/s}var o=0,a=1;for(e=t,r=0;r<20&&(i=this.sampleCurveX(e),!(Math.abs(i-t)<n));r++)t>i?o=e:a=e,e=.5*(a-o)+o;return e},solve:function(t,n){return this.sampleCurveY(this.solveCurveX(t,n))}};var Ms=Object.freeze({__proto__:null,number:ws,color:function(t,n,e){return new vi(ws(t.r,n.r,e),ws(t.g,n.g,e),ws(t.b,n.b,e),ws(t.a,n.a,e))},array:function(t,n,e){return t.map(((t,r)=>ws(t,n[r],e)))}});const xs=.95047,Fs=1.08883,ks=4/29,As=6/29,Ps=3*As*As,Ss=As*As*As,_s=Math.PI/180,Os=180/Math.PI;function Cs(t){return t>Ss?Math.pow(t,1/3):t/Ps+ks}function Es(t){return t>As?t*t*t:Ps*(t-ks)}function Is(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function $s(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ts(t){const n=$s(t.r),e=$s(t.g),r=$s(t.b),i=Cs((.4124564*n+.3575761*e+.1804375*r)/xs),s=Cs((.2126729*n+.7151522*e+.072175*r)/1);return{l:116*s-16,a:500*(i-s),b:200*(s-Cs((.0193339*n+.119192*e+.9503041*r)/Fs)),alpha:t.a}}function Ds(t){let n=(t.l+16)/116,e=isNaN(t.a)?n:n+t.a/500,r=isNaN(t.b)?n:n-t.b/200;return n=1*Es(n),e=xs*Es(e),r=Fs*Es(r),new vi(Is(3.2404542*e-1.5371385*n-.4985314*r),Is(-.969266*e+1.8760108*n+.041556*r),Is(.0556434*e-.2040259*n+1.0572252*r),t.alpha)}function zs(t,n,e){const r=n-t;return t+e*(r>180||r<-180?r-360*Math.round(r/360):r)}const js={forward:Ts,reverse:Ds,interpolate:function(t,n,e){return{l:ws(t.l,n.l,e),a:ws(t.a,n.a,e),b:ws(t.b,n.b,e),alpha:ws(t.alpha,n.alpha,e)}}},Us={forward:function(t){const{l:n,a:e,b:r}=Ts(t),i=Math.atan2(r,e)*Os;return{h:i<0?i+360:i,c:Math.sqrt(e*e+r*r),l:n,alpha:t.a}},reverse:function(t){const n=t.h*_s,e=t.c;return Ds({l:t.l,a:Math.cos(n)*e,b:Math.sin(n)*e,alpha:t.alpha})},interpolate:function(t,n,e){return{h:zs(t.h,n.h,e),c:ws(t.c,n.c,e),l:ws(t.l,n.l,e),alpha:ws(t.alpha,n.alpha,e)}}};var Ns=Object.freeze({__proto__:null,lab:js,hcl:Us});class Ls{constructor(t,n,e,r,i){this.type=t,this.operator=n,this.interpolation=e,this.input=r,this.labels=[],this.outputs=[];for(const[t,n]of i)this.labels.push(t),this.outputs.push(n)}static interpolationFactor(t,n,e,r){let i=0;if("exponential"===t.name)i=Rs(n,t.base,e,r);else if("linear"===t.name)i=Rs(n,1,e,r);else if("cubic-bezier"===t.name){const s=t.controlPoints;i=new vs(s[0],s[1],s[2],s[3]).solve(Rs(n,1,e,r))}return i}static parse(t,n){let[e,r,i,...s]=t;if(!Array.isArray(r)||0===r.length)return n.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const t=r[1];if("number"!=typeof t)return n.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:t}}else{if("cubic-bezier"!==r[0])return n.error(\`Unknown interpolation type ${o}String(r[0])}\`,1,0);{const t=r.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return n.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return n.error(\`Expected at least 4 arguments, but found only ${o}t.length-1}.\`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");if(i=n.parse(i,2,Yr),!i)return null;const o=[];let a=null;"interpolate-hcl"===e||"interpolate-lab"===e?a=Qr:n.expectedType&&"value"!==n.expectedType.kind&&(a=n.expectedType);for(let t=0;t<s.length;t+=2){const e=s[t],r=s[t+1],i=t+3,u=t+4;if("number"!=typeof e)return n.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(o.length&&o[o.length-1][0]>=e)return n.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const l=n.parse(r,u,a);if(!l)return null;a=a||l.type,o.push([e,l])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new Ls(a,e,r,i,o):n.error(\`Type ${o}oi(a)} is not interpolatable.\`)}evaluate(t){const n=this.labels,e=this.outputs;if(1===n.length)return e[0].evaluate(t);const r=this.input.evaluate(t);if(r<=n[0])return e[0].evaluate(t);const i=n.length;if(r>=n[i-1])return e[i-1].evaluate(t);const s=ys(n,r),o=Ls.interpolationFactor(this.interpolation,r,n[s],n[s+1]),a=e[s].evaluate(t),u=e[s+1].evaluate(t);return"interpolate"===this.operator?Ms[this.type.kind.toLowerCase()](a,u,o):"interpolate-hcl"===this.operator?Us.reverse(Us.interpolate(Us.forward(a),Us.forward(u),o)):js.reverse(js.interpolate(js.forward(a),js.forward(u),o))}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const n=[this.operator,t,this.input.serialize()];for(let t=0;t<this.labels.length;t++)n.push(this.labels[t],this.outputs[t].serialize());return n}}function Rs(t,n,e,r){const i=r-e,s=t-e;return 0===i?0:1===n?s/i:(Math.pow(n,s)-1)/(Math.pow(n,i)-1)}var Vs=Ls;class Hs{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expectected at least one argument.");let e=null;const r=n.expectedType;r&&"value"!==r.kind&&(e=r);const i=[];for(const r of t.slice(1)){const t=n.parse(r,1+i.length,e,void 0,{typeAnnotation:"omit"});if(!t)return null;e=e||t.type,i.push(t)}const s=r&&i.some((t=>ui(r,t.type)));return new Hs(s?ni:e,i)}evaluate(t){let n,e=null,r=0;for(const i of this.args){if(r++,e=i.evaluate(t),e&&e instanceof xi&&!e.available&&(n||(n=e),e=null,r===this.args.length))return n;if(null!==e)break}return e}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=["coalesce"];return this.eachChild((n=>{t.push(n.serialize())})),t}}var qs=Hs;class Gs{constructor(t,n){this.type=n.type,this.bindings=[].concat(t),this.result=n}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const n of this.bindings)t(n[1]);t(this.result)}static parse(t,n){if(t.length<4)return n.error(\`Expected at least 3 arguments, but found ${o}t.length-1} instead.\`);const e=[];for(let r=1;r<t.length-1;r+=2){const i=t[r];if("string"!=typeof i)return n.error(\`Expected string, but found ${o}typeof i} instead.\`,r);if(/[^a-zA-Z0-9_]/.test(i))return n.error("Variable names must contain only alphanumeric characters or '_'.",r);const s=n.parse(t[r+1],r+1);if(!s)return null;e.push([i,s])}const r=n.parse(t[t.length-1],t.length-1,n.expectedType,e);return r?new Gs(e,r):null}outputDefined(){return this.result.outputDefined()}serialize(){const t=["let"];for(const[n,e]of this.bindings)t.push(n,e.serialize());return t.push(this.result.serialize()),t}}var Js=Gs;class Ws{constructor(t,n,e){this.type=t,this.index=n,this.input=e}static parse(t,n){if(3!==t.length)return n.error(\`Expected 2 arguments, but found ${o}t.length-1} instead.\`);const e=n.parse(t[1],1,Yr),r=n.parse(t[2],2,si(n.expectedType||ni));return e&&r?new Ws(r.type.itemType,e,r):null}evaluate(t){const n=this.index.evaluate(t),e=this.input.evaluate(t);if(n<0)throw new Oi(\`Array index out of bounds: ${o}n} < 0.\`);if(n>=e.length)throw new Oi(\`Array index out of bounds: ${o}n} > ${o}e.length-1}.\`);if(n!==Math.floor(n))throw new Oi(\`Array index must be an integer, but found ${o}n} instead.\`);return e[n]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var Bs=Ws;class Xs{constructor(t,n){this.type=Zr,this.needle=t,this.haystack=n}static parse(t,n){if(3!==t.length)return n.error(\`Expected 2 arguments, but found ${o}t.length-1} instead.\`);const e=n.parse(t[1],1,ni),r=n.parse(t[2],2,ni);return e&&r?li(e.type,[Zr,Kr,Yr,Xr,ni])?new Xs(e,r):n.error(\`Expected first argument to be of type boolean, string, number or null, but found ${o}oi(e.type)} instead\`):null}evaluate(t){const n=this.needle.evaluate(t),e=this.haystack.evaluate(t);if(null==e)return!1;if(!hi(n,["boolean","string","number","null"]))throw new Oi(\`Expected first argument to be of type boolean, string, number or null, but found ${o}oi(Ai(n))} instead.\`);if(!hi(e,["string","array"]))throw new Oi(\`Expected second argument to be of type array or string, but found ${o}oi(Ai(e))} instead.\`);return e.indexOf(n)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var Ys=Xs;class Ks{constructor(t,n,e){this.type=Yr,this.needle=t,this.haystack=n,this.fromIndex=e}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(\`Expected 3 or 4 arguments, but found ${o}t.length-1} instead.\`);const e=n.parse(t[1],1,ni),r=n.parse(t[2],2,ni);if(!e||!r)return null;if(!li(e.type,[Zr,Kr,Yr,Xr,ni]))return n.error(\`Expected first argument to be of type boolean, string, number or null, but found ${o}oi(e.type)} instead\`);if(4===t.length){const i=n.parse(t[3],3,Yr);return i?new Ks(e,r,i):null}return new Ks(e,r)}evaluate(t){const n=this.needle.evaluate(t),e=this.haystack.evaluate(t);if(!hi(n,["boolean","string","number","null"]))throw new Oi(\`Expected first argument to be of type boolean, string, number or null, but found ${o}oi(Ai(n))} instead.\`);if(!hi(e,["string","array"]))throw new Oi(\`Expected second argument to be of type array or string, but found ${o}oi(Ai(e))} instead.\`);if(this.fromIndex){const r=this.fromIndex.evaluate(t);return e.indexOf(n,r)}return e.indexOf(n)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var Zs=Ks;class Qs{constructor(t,n,e,r,i,s){this.inputType=t,this.type=n,this.input=e,this.cases=r,this.outputs=i,this.otherwise=s}static parse(t,n){if(t.length<5)return n.error(\`Expected at least 4 arguments, but found only ${o}t.length-1}.\`);if(t.length%2!=1)return n.error("Expected an even number of arguments.");let e,r;n.expectedType&&"value"!==n.expectedType.kind&&(r=n.expectedType);const i={},s=[];for(let o=2;o<t.length-1;o+=2){let a=t[o];const u=t[o+1];Array.isArray(a)||(a=[a]);const l=n.concat(o);if(0===a.length)return l.error("Expected at least one branch label.");for(const t of a){if("number"!=typeof t&&"string"!=typeof t)return l.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return l.error(\`Branch labels must be integers no larger than ${o}Number.MAX_SAFE_INTEGER}.\`);if("number"==typeof t&&Math.floor(t)!==t)return l.error("Numeric branch labels must be integer values.");if(e){if(l.checkSubtype(e,Ai(t)))return null}else e=Ai(t);if(void 0!==i[String(t)])return l.error("Branch labels must be unique.");i[String(t)]=s.length}const h=n.parse(u,o,r);if(!h)return null;r=r||h.type,s.push(h)}const o=n.parse(t[1],1,ni);if(!o)return null;const a=n.parse(t[t.length-1],t.length-1,r);return a?"value"!==o.type.kind&&n.concat(1).checkSubtype(e,o.type)?null:new Qs(e,r,o,i,s,a):null}evaluate(t){const n=this.input.evaluate(t);return(Ai(n)===this.inputType&&this.outputs[this.cases[n]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],n=Object.keys(this.cases).sort(),e=[],r={};for(const t of n){const n=r[this.cases[t]];void 0===n?(r[this.cases[t]]=e.length,e.push([this.cases[t],[t]])):e[n][1].push(t)}const i=t=>"number"===this.inputType.kind?Number(t):t;for(const[n,r]of e)t.push(1===r.length?i(r[0]):r.map(i)),t.push(this.outputs[n].serialize());return t.push(this.otherwise.serialize()),t}}var to=Qs;class no{constructor(t,n,e){this.type=t,this.branches=n,this.otherwise=e}static parse(t,n){if(t.length<4)return n.error(\`Expected at least 3 arguments, but found only ${o}t.length-1}.\`);if(t.length%2!=0)return n.error("Expected an odd number of arguments.");let e;n.expectedType&&"value"!==n.expectedType.kind&&(e=n.expectedType);const r=[];for(let i=1;i<t.length-1;i+=2){const s=n.parse(t[i],i,Zr);if(!s)return null;const o=n.parse(t[i+1],i+1,e);if(!o)return null;r.push([s,o]),e=e||o.type}const i=n.parse(t[t.length-1],t.length-1,e);return i?new no(e,r,i):null}evaluate(t){for(const[n,e]of this.branches)if(n.evaluate(t))return e.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[n,e]of this.branches)t(n),t(e);t(this.otherwise)}outputDefined(){return this.branches.every((([t,n])=>n.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((n=>{t.push(n.serialize())})),t}}var eo=no;class ro{constructor(t,n,e,r){this.type=t,this.input=n,this.beginIndex=e,this.endIndex=r}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(\`Expected 3 or 4 arguments, but found ${o}t.length-1} instead.\`);const e=n.parse(t[1],1,ni),r=n.parse(t[2],2,Yr);if(!e||!r)return null;if(!li(e.type,[si(ni),Kr,ni]))return n.error(\`Expected first argument to be of type array or string, but found ${o}oi(e.type)} instead\`);if(4===t.length){const i=n.parse(t[3],3,Yr);return i?new ro(e.type,e,r,i):null}return new ro(e.type,e,r)}evaluate(t){const n=this.input.evaluate(t),e=this.beginIndex.evaluate(t);if(!hi(n,["string","array"]))throw new Oi(\`Expected first argument to be of type array or string, but found ${o}oi(Ai(n))} instead.\`);if(this.endIndex){const r=this.endIndex.evaluate(t);return n.slice(e,r)}return n.slice(e)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var io=ro;function so(t,n){return"=="===t||"!="===t?"boolean"===n.kind||"string"===n.kind||"number"===n.kind||"null"===n.kind||"value"===n.kind:"string"===n.kind||"number"===n.kind||"value"===n.kind}function oo(t,n,e,r){return 0===r.compare(n,e)}function ao(t,n,e){const r="=="!==t&&"!="!==t;return class i{constructor(t,n,e){this.type=Zr,this.lhs=t,this.rhs=n,this.collator=e,this.hasUntypedArgument="value"===t.type.kind||"value"===n.type.kind}static parse(t,n){if(3!==t.length&&4!==t.length)return n.error("Expected two or three arguments.");const e=t[0];let s=n.parse(t[1],1,ni);if(!s)return null;if(!so(e,s.type))return n.concat(1).error(\`"${o}e}" comparisons are not supported for type '${o}oi(s.type)}'.\`);let o=n.parse(t[2],2,ni);if(!o)return null;if(!so(e,o.type))return n.concat(2).error(\`"${o}e}" comparisons are not supported for type '${o}oi(o.type)}'.\`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return n.error(\`Cannot compare types '${o}oi(s.type)}' and '${o}oi(o.type)}'.\`);r&&("value"===s.type.kind&&"value"!==o.type.kind?s=new Ii(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new Ii(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return n.error("Cannot use collator to compare non-string types.");if(a=n.parse(t[3],3,ei),!a)return null}return new i(s,o,a)}evaluate(i){const s=this.lhs.evaluate(i),o=this.rhs.evaluate(i);if(r&&this.hasUntypedArgument){const n=Ai(s),e=Ai(o);if(n.kind!==e.kind||"string"!==n.kind&&"number"!==n.kind)throw new Oi(\`Expected arguments for "${o}t}" to be (string, string) or (number, number), but found (${o}n.kind}, ${o}e.kind}) instead.\`)}if(this.collator&&!r&&this.hasUntypedArgument){const t=Ai(s),e=Ai(o);if("string"!==t.kind||"string"!==e.kind)return n(i,s,o)}return this.collator?e(i,s,o,this.collator.evaluate(i)):n(i,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const n=[t];return this.eachChild((t=>{n.push(t.serialize())})),n}}}const uo=ao("==",(function(t,n,e){return n===e}),oo),lo=ao("!=",(function(t,n,e){return n!==e}),(function(t,n,e,r){return!oo(0,n,e,r)})),ho=ao("<",(function(t,n,e){return n<e}),(function(t,n,e,r){return r.compare(n,e)<0})),co=ao(">",(function(t,n,e){return n>e}),(function(t,n,e,r){return r.compare(n,e)>0})),fo=ao("<=",(function(t,n,e){return n<=e}),(function(t,n,e,r){return r.compare(n,e)<=0})),po=ao(">=",(function(t,n,e){return n>=e}),(function(t,n,e,r){return r.compare(n,e)>=0}));class yo{constructor(t,n,e,r,i,s){this.type=Kr,this.number=t,this.locale=n,this.currency=e,this.unit=r,this.minFractionDigits=i,this.maxFractionDigits=s}static parse(t,n){if(3!==t.length)return n.error("Expected two arguments.");const e=n.parse(t[1],1,Yr);if(!e)return null;const r=t[2];if("object"!=typeof r||Array.isArray(r))return n.error("NumberFormat options argument must be an object.");let i=null;if(r.locale&&(i=n.parse(r.locale,1,Kr),!i))return null;let s=null;if(r.currency&&(s=n.parse(r.currency,1,Kr),!s))return null;let o=null;if(r.unit&&(o=n.parse(r.unit,1,Kr),!o))return null;let a=null;if(r["min-fraction-digits"]&&(a=n.parse(r["min-fraction-digits"],1,Yr),!a))return null;let u=null;return r["max-fraction-digits"]&&(u=n.parse(r["max-fraction-digits"],1,Yr),!u)?null:new yo(e,i,s,o,a,u)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.unit&&(t.unit=this.unit.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class mo{constructor(t){this.type=Yr,this.input=t}static parse(t,n){if(2!==t.length)return n.error(\`Expected 1 argument, but found ${o}t.length-1} instead.\`);const e=n.parse(t[1],1);return e?"array"!==e.type.kind&&"string"!==e.type.kind&&"value"!==e.type.kind?n.error(\`Expected argument of type string or array, but found ${o}oi(e.type)} instead.\`):new mo(e):null}evaluate(t){const n=this.input.evaluate(t);if("string"==typeof n)return n.length;if(Array.isArray(n))return n.length;throw new Oi(\`Expected value to be of type string or array, but found ${o}oi(Ai(n))} instead.\`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((n=>{t.push(n.serialize())})),t}}const go={"==":uo,"!=":lo,">":co,"<":ho,">=":po,"<=":fo,array:Ii,at:Bs,boolean:Ii,case:eo,coalesce:qs,collator:Vi,format:$i,image:Ti,in:Ys,"index-of":Zs,interpolate:Vs,"interpolate-hcl":Vs,"interpolate-lab":Vs,length:mo,let:Js,literal:_i,match:to,number:Ii,"number-format":yo,object:Ii,slice:io,step:gs,string:Ii,"to-boolean":ji,"to-color":ji,"to-number":ji,"to-string":ji,var:cs,within:os};function vo(t,[n,e,r,i]){n=n.evaluate(t),e=e.evaluate(t),r=r.evaluate(t);const s=i?i.evaluate(t):1,o=Fi(n,e,r,s);if(o)throw new Oi(o);return new vi(n/255*s,e/255*s,r/255*s,s)}function bo(t,n){return t in n}function wo(t,n){const e=n[t];return void 0===e?null:e}function Mo(t){return{type:t}}Ri.register(go,{error:[{kind:"error"},[Kr],(t,[n])=>{throw new Oi(n.evaluate(t))}],typeof:[Kr,[ni],(t,[n])=>oi(Ai(n.evaluate(t)))],"to-rgba":[si(Yr,4),[Qr],(t,[n])=>n.evaluate(t).toArray()],rgb:[Qr,[Yr,Yr,Yr],vo],rgba:[Qr,[Yr,Yr,Yr,Yr],vo],has:{type:Zr,overloads:[[[Kr],(t,[n])=>bo(n.evaluate(t),t.properties())],[[Kr,ti],(t,[n,e])=>bo(n.evaluate(t),e.evaluate(t))]]},get:{type:ni,overloads:[[[Kr],(t,[n])=>wo(n.evaluate(t),t.properties())],[[Kr,ti],(t,[n,e])=>wo(n.evaluate(t),e.evaluate(t))]]},"feature-state":[ni,[Kr],(t,[n])=>wo(n.evaluate(t),t.featureState||{})],properties:[ti,[],t=>t.properties()],"geometry-type":[Kr,[],t=>t.geometryType()],id:[ni,[],t=>t.id()],zoom:[Yr,[],t=>t.globals.zoom],pitch:[Yr,[],t=>t.globals.pitch||0],"distance-from-center":[Yr,[],t=>t.distanceFromCenter()],"heatmap-density":[Yr,[],t=>t.globals.heatmapDensity||0],"line-progress":[Yr,[],t=>t.globals.lineProgress||0],"sky-radial-progress":[Yr,[],t=>t.globals.skyRadialProgress||0],accumulated:[ni,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[Yr,Mo(Yr),(t,n)=>{let e=0;for(const r of n)e+=r.evaluate(t);return e}],"*":[Yr,Mo(Yr),(t,n)=>{let e=1;for(const r of n)e*=r.evaluate(t);return e}],"-":{type:Yr,overloads:[[[Yr,Yr],(t,[n,e])=>n.evaluate(t)-e.evaluate(t)],[[Yr],(t,[n])=>-n.evaluate(t)]]},"/":[Yr,[Yr,Yr],(t,[n,e])=>n.evaluate(t)/e.evaluate(t)],"%":[Yr,[Yr,Yr],(t,[n,e])=>n.evaluate(t)%e.evaluate(t)],ln2:[Yr,[],()=>Math.LN2],pi:[Yr,[],()=>Math.PI],e:[Yr,[],()=>Math.E],"^":[Yr,[Yr,Yr],(t,[n,e])=>Math.pow(n.evaluate(t),e.evaluate(t))],sqrt:[Yr,[Yr],(t,[n])=>Math.sqrt(n.evaluate(t))],log10:[Yr,[Yr],(t,[n])=>Math.log(n.evaluate(t))/Math.LN10],ln:[Yr,[Yr],(t,[n])=>Math.log(n.evaluate(t))],log2:[Yr,[Yr],(t,[n])=>Math.log(n.evaluate(t))/Math.LN2],sin:[Yr,[Yr],(t,[n])=>Math.sin(n.evaluate(t))],cos:[Yr,[Yr],(t,[n])=>Math.cos(n.evaluate(t))],tan:[Yr,[Yr],(t,[n])=>Math.tan(n.evaluate(t))],asin:[Yr,[Yr],(t,[n])=>Math.asin(n.evaluate(t))],acos:[Yr,[Yr],(t,[n])=>Math.acos(n.evaluate(t))],atan:[Yr,[Yr],(t,[n])=>Math.atan(n.evaluate(t))],min:[Yr,Mo(Yr),(t,n)=>Math.min(...n.map((n=>n.evaluate(t))))],max:[Yr,Mo(Yr),(t,n)=>Math.max(...n.map((n=>n.evaluate(t))))],abs:[Yr,[Yr],(t,[n])=>Math.abs(n.evaluate(t))],round:[Yr,[Yr],(t,[n])=>{const e=n.evaluate(t);return e<0?-Math.round(-e):Math.round(e)}],floor:[Yr,[Yr],(t,[n])=>Math.floor(n.evaluate(t))],ceil:[Yr,[Yr],(t,[n])=>Math.ceil(n.evaluate(t))],"filter-==":[Zr,[Kr,ni],(t,[n,e])=>t.properties()[n.value]===e.value],"filter-id-==":[Zr,[ni],(t,[n])=>t.id()===n.value],"filter-type-==":[Zr,[Kr],(t,[n])=>t.geometryType()===n.value],"filter-<":[Zr,[Kr,ni],(t,[n,e])=>{const r=t.properties()[n.value],i=e.value;return typeof r==typeof i&&r<i}],"filter-id-<":[Zr,[ni],(t,[n])=>{const e=t.id(),r=n.value;return typeof e==typeof r&&e<r}],"filter->":[Zr,[Kr,ni],(t,[n,e])=>{const r=t.properties()[n.value],i=e.value;return typeof r==typeof i&&r>i}],"filter-id->":[Zr,[ni],(t,[n])=>{const e=t.id(),r=n.value;return typeof e==typeof r&&e>r}],"filter-<=":[Zr,[Kr,ni],(t,[n,e])=>{const r=t.properties()[n.value],i=e.value;return typeof r==typeof i&&r<=i}],"filter-id-<=":[Zr,[ni],(t,[n])=>{const e=t.id(),r=n.value;return typeof e==typeof r&&e<=r}],"filter->=":[Zr,[Kr,ni],(t,[n,e])=>{const r=t.properties()[n.value],i=e.value;return typeof r==typeof i&&r>=i}],"filter-id->=":[Zr,[ni],(t,[n])=>{const e=t.id(),r=n.value;return typeof e==typeof r&&e>=r}],"filter-has":[Zr,[ni],(t,[n])=>n.value in t.properties()],"filter-has-id":[Zr,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[Zr,[si(Kr)],(t,[n])=>n.value.indexOf(t.geometryType())>=0],"filter-id-in":[Zr,[si(ni)],(t,[n])=>n.value.indexOf(t.id())>=0],"filter-in-small":[Zr,[Kr,si(ni)],(t,[n,e])=>e.value.indexOf(t.properties()[n.value])>=0],"filter-in-large":[Zr,[Kr,si(ni)],(t,[n,e])=>function(t,n,e,r){for(;e<=r;){const i=e+r>>1;if(n[i]===t)return!0;n[i]>t?r=i-1:e=i+1}return!1}(t.properties()[n.value],e.value,0,e.value.length-1)],all:{type:Zr,overloads:[[[Zr,Zr],(t,[n,e])=>n.evaluate(t)&&e.evaluate(t)],[Mo(Zr),(t,n)=>{for(const e of n)if(!e.evaluate(t))return!1;return!0}]]},any:{type:Zr,overloads:[[[Zr,Zr],(t,[n,e])=>n.evaluate(t)||e.evaluate(t)],[Mo(Zr),(t,n)=>{for(const e of n)if(e.evaluate(t))return!0;return!1}]]},"!":[Zr,[Zr],(t,[n])=>!n.evaluate(t)],"is-supported-script":[Zr,[Kr],(t,[n])=>{const e=t.globals&&t.globals.isSupportedScript;return!e||e(n.evaluate(t))}],upcase:[Kr,[Kr],(t,[n])=>n.evaluate(t).toUpperCase()],downcase:[Kr,[Kr],(t,[n])=>n.evaluate(t).toLowerCase()],concat:[Kr,Mo(ni),(t,n)=>n.map((n=>Pi(n.evaluate(t)))).join("")],"resolved-locale":[Kr,[ei],(t,[n])=>n.evaluate(t).resolvedLocale()]});var xo=go;function Fo(t){return{result:"success",value:t}}function ko(t){return{result:"error",value:t}}function Ao(t){return!!t.expression&&t.expression.interpolated}function Po(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function So(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function _o(t){return t}function Oo(t,n){const e="color"===n.type,r=t.stops&&"object"==typeof t.stops[0][0],i=r||!(r||void 0!==t.property),s=t.type||(Ao(n)?"exponential":"interval");if(e&&((t=qr({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],vi.parse(t[1])]))),t.default=vi.parse(t.default?t.default:n.default)),t.colorSpace&&"rgb"!==t.colorSpace&&!Ns[t.colorSpace])throw new Error(\`Unknown color space: ${o}t.colorSpace}\`);let o,a,u;if("exponential"===s)o=$o;else if("interval"===s)o=Io;else if("categorical"===s){o=Eo,a=Object.create(null);for(const n of t.stops)a[n[0]]=n[1];u=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error(\`Unknown function type "${o}s}"\`);o=To}if(r){const e={},r=[];for(let n=0;n<t.stops.length;n++){const i=t.stops[n],s=i[0].zoom;void 0===e[s]&&(e[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},r.push(s)),e[s].stops.push([i[0].value,i[1]])}const i=[];for(const t of r)i.push([e[t].zoom,Oo(e[t],n)]);const s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:Vs.interpolationFactor.bind(void 0,s),zoomStops:i.map((t=>t[0])),evaluate:({zoom:e},r)=>$o({stops:i,base:t.base},n,e).evaluate(e,r)}}if(i){const e="exponential"===s?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:e,interpolationFactor:Vs.interpolationFactor.bind(void 0,e),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:e})=>o(t,n,e,a,u)}}return{kind:"source",evaluate(e,r){const i=r&&r.properties?r.properties[t.property]:void 0;return void 0===i?Co(t.default,n.default):o(t,n,i,a,u)}}}function Co(t,n,e){return void 0!==t?t:void 0!==n?n:void 0!==e?e:void 0}function Eo(t,n,e,r,i){return Co(typeof e===i?r[e]:void 0,t.default,n.default)}function Io(t,n,e){if("number"!==Po(e))return Co(t.default,n.default);const r=t.stops.length;if(1===r)return t.stops[0][1];if(e<=t.stops[0][0])return t.stops[0][1];if(e>=t.stops[r-1][0])return t.stops[r-1][1];const i=ys(t.stops.map((t=>t[0])),e);return t.stops[i][1]}function $o(t,n,e){const r=void 0!==t.base?t.base:1;if("number"!==Po(e))return Co(t.default,n.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(e<=t.stops[0][0])return t.stops[0][1];if(e>=t.stops[i-1][0])return t.stops[i-1][1];const s=ys(t.stops.map((t=>t[0])),e),o=function(t,n,e,r){const i=r-e,s=t-e;return 0===i?0:1===n?s/i:(Math.pow(n,s)-1)/(Math.pow(n,i)-1)}(e,r,t.stops[s][0],t.stops[s+1][0]),a=t.stops[s][1],u=t.stops[s+1][1];let l=Ms[n.type]||_o;if(t.colorSpace&&"rgb"!==t.colorSpace){const n=Ns[t.colorSpace];l=(t,e)=>n.reverse(n.interpolate(n.forward(t),n.forward(e),o))}return"function"==typeof a.evaluate?{evaluate(...t){const n=a.evaluate.apply(void 0,t),e=u.evaluate.apply(void 0,t);if(void 0!==n&&void 0!==e)return l(n,e,o)}}:l(a,u,o)}function To(t,n,e){return"color"===n.type?e=vi.parse(e):"formatted"===n.type?e=Mi.fromString(e.toString()):"resolvedImage"===n.type?e=xi.fromString(e.toString()):Po(e)===n.type||"enum"===n.type&&n.values[e]||(e=void 0),Co(e,t.default,n.default)}class Do{constructor(t,n){this.expression=t,this.J={},this.W=new Ni,this.B=n?function(t){return"color"===t.type&&(So(t.default)||Array.isArray(t.default))?new vi(0,0,0,0):"color"===t.type?vi.parse(t.default)||null:void 0===t.default?null:t.default}(n):null,this.X=n&&"enum"===n.type?n.values:null}evaluateWithoutErrorHandling(t,n,e,r,i,s,o,a){return this.W.globals=t,this.W.feature=n,this.W.featureState=e,this.W.canonical=r||null,this.W.availableImages=i||null,this.W.formattedSection=s,this.W.featureTileCoord=o||null,this.W.featureDistanceData=a||null,this.expression.evaluate(this.W)}evaluate(t,n,e,r,i,s,o,a){this.W.globals=t,this.W.feature=n||null,this.W.featureState=e||null,this.W.canonical=r||null,this.W.availableImages=i||null,this.W.formattedSection=s||null,this.W.featureTileCoord=o||null,this.W.featureDistanceData=a||null;try{const t=this.expression.evaluate(this.W);if(null==t||"number"==typeof t&&t!=t)return this.B;if(this.X&&!(t in this.X))throw new Oi(\`Expected value to be one of ${o}Object.keys(this.X).map((t=>JSON.stringify(t))).join(", ")}, but found ${o}JSON.stringify(t)} instead.\`);return t}catch(t){return this.J[t.message]||(this.J[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this.B}}}function zo(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in xo}function jo(t,n){const e=new ds(xo,[],n?function(t){const n={color:Qr,string:Kr,number:Yr,enum:Kr,boolean:Zr,formatted:ri,resolvedImage:ii};return"array"===t.type?si(n[t.value]||ni,t.length):n[t.type]}(n):void 0),r=e.parse(t,void 0,void 0,void 0,n&&"string"===n.type?{typeAnnotation:"coerce"}:void 0);return r?Fo(new Do(r,n)):ko(e.errors)}class Uo{constructor(t,n){this.kind=t,this.Y=n,this.isStateDependent="constant"!==t&&!us(n.expression)}evaluateWithoutErrorHandling(t,n,e,r,i,s){return this.Y.evaluateWithoutErrorHandling(t,n,e,r,i,s)}evaluate(t,n,e,r,i,s){return this.Y.evaluate(t,n,e,r,i,s)}}class No{constructor(t,n,e,r){this.kind=t,this.zoomStops=e,this.Y=n,this.isStateDependent="camera"!==t&&!us(n.expression),this.interpolationType=r}evaluateWithoutErrorHandling(t,n,e,r,i,s){return this.Y.evaluateWithoutErrorHandling(t,n,e,r,i,s)}evaluate(t,n,e,r,i,s){return this.Y.evaluate(t,n,e,r,i,s)}interpolationFactor(t,n,e){return this.interpolationType?Vs.interpolationFactor(this.interpolationType,t,n,e):0}}function Lo(t,n){if("error"===(t=jo(t,n)).result)return t;const e=t.value.expression,r=as(e);if(!r&&!function(t){return"data-driven"===t["property-type"]}(n))return ko([new Jr("","data expressions not supported")]);const i=ls(e,["zoom","pitch","distance-from-center"]);if(!i&&!function(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}(n))return ko([new Jr("","zoom expressions not supported")]);const s=Vo(e);if(!s&&!i)return ko([new Jr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof Jr)return ko([s]);if(s instanceof Vs&&!Ao(n))return ko([new Jr("",'"interpolate" expressions cannot be used with this property')]);if(!s)return Fo(new Uo(r?"constant":"source",t.value));const o=s instanceof Vs?s.interpolation:void 0;return Fo(new No(r?"camera":"composite",t.value,s.labels,o))}class Ro{constructor(t,n){this.K=t,this.Z=n,qr(this,Oo(this.K,this.Z))}static deserialize(t){return new Ro(t.K,t.Z)}static serialize(t){return{K:t.K,Z:t.Z}}}function Vo(t){let n=null;if(t instanceof Js)n=Vo(t.result);else if(t instanceof qs){for(const e of t.args)if(n=Vo(e),n)break}else(t instanceof gs||t instanceof Vs)&&t.input instanceof Ri&&"zoom"===t.input.name&&(n=t);return n instanceof Jr||t.eachChild((t=>{const e=Vo(t);e instanceof Jr?n=e:!n&&e?n=new Jr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&e&&n!==e&&(n=new Jr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),n}function Ho(t){if(Array.isArray(t))return t.map(Ho);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const n={};for(const e in t)n[e]=Ho(t[e]);return n}return function(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}(t)}function qo(t,n="fill"){if(null==t)return{filter:()=>!0,needGeometry:!1,needFeature:!1};const e=t;let r=!0;try{r=function(t){if(!Wo(t))return t;let n=Ho(t);return Jo(n),n=Go(n),n}(e)}catch(t){console.warn(\`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\\nand paste the contents of this message in the report.\\nThank you!\\nFilter Expression:\\n${o}JSON.stringify(e,null,2)}\\n \`)}const i=jo(r,null);let s=null;if("error"===i.result)throw new Error(i.value.map((t=>\`${o}t.key}: ${o}t.message}\`)).join(", "));s=(t,n,e)=>i.value.evaluate(t,n,{},e);let o=null,a=null;if(r!==e){const t=jo(e,null);if("error"===t.result)throw new Error(t.value.map((t=>\`${o}t.key}: ${o}t.message}\`)).join(", "));o=(n,e,r,i,s)=>t.value.evaluate(n,e,{},r,void 0,void 0,i,s),a=!as(t.value.expression)}return{filter:s,dynamicFilter:o||void 0,needGeometry:Xo(r),needFeature:!!a}}function Go(t){if(!Array.isArray(t))return t;const n=function(t){if(Bo.has(t[0]))for(let n=1;n<t.length;n++)if(Wo(t[n]))return!0;return t}(t);return!0===n?n:n.map((t=>Go(t)))}function Jo(t){let n=!1;const e=[];if("case"===t[0]){for(let r=1;r<t.length-1;r+=2)n=n||Wo(t[r]),e.push(t[r+1]);e.push(t[t.length-1])}else if("match"===t[0]){n=n||Wo(t[1]);for(let n=2;n<t.length-1;n+=2)e.push(t[n+1]);e.push(t[t.length-1])}else if("step"===t[0]){n=n||Wo(t[1]);for(let n=1;n<t.length-1;n+=2)e.push(t[n+1])}n&&(t.length=0,t.push("any",...e));for(let n=1;n<t.length;n++)Jo(t[n])}function Wo(t){if(!Array.isArray(t))return!1;if(function(t){return"pitch"===t||"distance-from-center"===t}(t[0]))return!0;for(let n=1;n<t.length;n++)if(Wo(t[n]))return!0;return!1}const Bo=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Xo(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let n=1;n<t.length;n++)if(Xo(t[n]))return!0;return!1}const Yo={StyleExpression:Do,isExpression:zo,isExpressionFilter:function t(n){if(!0===n||!1===n)return!0;if(!Array.isArray(n)||0===n.length)return!1;switch(n[0]){case"has":return n.length>=2&&"$id"!==n[1]&&"$type"!==n[1];case"in":return n.length>=3&&("string"!=typeof n[1]||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==n.length||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const e of n.slice(1))if(!t(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}},createExpression:jo,createPropertyExpression:Lo,normalizePropertyExpression:function(t,n){if(So(t))return new Ro(t,n);if(zo(t)){const e=Lo(t,n);if("error"===e.result)throw new Error(e.value.map((t=>\`${o}t.key}: ${o}t.message}\`)).join(", "));return e.value}{let e=t;return"string"==typeof t&&"color"===n.type&&(e=vi.parse(t)),{kind:"constant",evaluate:()=>e}}},ZoomConstantExpression:Uo,ZoomDependentExpression:No,StylePropertyFunction:Ro},{isExpression:Ko,createExpression:Zo}=Yo,Qo={};function ta(t){if(!Array.isArray(t))return ta([t]);const n=[];for(let e=0;e<t.length;e++){let r;r=!0===t[e].filter?function(){return!0}:na(t[e].filter),n.push(br({},t[e],{filter:r}))}return n}function na(t){if(!0===t)return function(){return!0};if(t&&t.condition){if("any"===t.type){const n=t.condition,e=[];for(let t=0;t<n.length;t++)e.push(na(n[t]));return(t,n)=>{for(let r=0;r<e.length;r++)if(e[r](t,n))return!0;return!1}}const n=na(t.condition);if(wr(t.layer))return n;const e=n=>n.layer===t.layer;return(t,r)=>e(t)&&n(t,r)}if(hn(t))return ln(t);{let n=qo(t);n=n&&n.filter;const e=(t,e)=>(Qo.zoom=e,n&&n(Qo,t));return e}}const ea={type:"number","property-type":"data-driven",expression:{parameters:["zoom","feature"]}};function ra(t,n){ea.type=n||"number";const e=Zo(t,ea);if("success"!==e.result)throw new Error(\`Invalid maplibre spec expression: ${o}JSON.stringify(t)} (${o}e.value})\`);return e.value}function ia(t){return Ko(t)}const sa={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};function oa(t){return sa[t]}const aa={markerPlacement:1,markerFile:1,mergeOnProperty:1,markerTextFit:1,markerType:1,markerHorizontalAlignment:1,markerVerticalAlignment:1,markerRotationAlignment:1,markerPitchAlignment:1,markerFillPatternFile:1,markerLinePatternFile:1,textName:1,textPlacement:1,textFaceName:1,textStyle:1,textHorizontalAlignment:1,textVerticalAlignment:1,textRotationAlignment:1,textPitchAlignment:1,lineJoin:1,lineCap:1,linePatternFile:1,polygonPatternFile:1},ua={lineDasharray:1,markerLineDasharray:1,uvScale:1,uvOffset:1};function la(t){return aa[t]?"string":oa(t)?"number":ua[t]?"array":"color"}var ha=Object.freeze({__proto__:null,compileFilter:na,compileStyle:function(t=[]){return ta(t=t.map((t=>{const n=br({},t);return n.filter&&n.filter.value&&(n.filter=n.filter.value),n})))},createExpression:ra,getExpressionType:la,isExpression:ia,isInterpolated:oa});const ca="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,fa=function(t){return class extends t{pushIn(...t){const n=t.length;for(let e=0;e<n;e++)this[this.currentIndex++]=t[e]}fill(t,n,e){super.fill(t,n,e),e>this.currentIndex&&(this.currentIndex=e)}set(t,n){t>=this.currentIndex&&(this.currentIndex=t+1),this[t]=n}getLength(){return this.currentIndex}setLength(t){this.currentIndex=t,super.length<t&&(super.length=t)}trySetLength(t){t>this.currentIndex&&this.setLength(t)}reset(){this.currentIndex=0}slice(t,n){const e=super.slice(t,n);return e.currentIndex=n-t,e}}},da=fa(Array),pa={get:function(t,n){return"length"===n?t.getLength():t[n]}};class ya extends Array{setLength(t){this.length=t,this.currentIndex=t}trySetLength(t){this.length=t,this.currentIndex=t}getLength(){return this.length}}let ma;class ga{static createTypedArray(t,n){return gr(t,n)}static getInstance(){return ma}static ensureCapacity(t,n){if(!t.BYTES_PER_ELEMENT)return t;if(t.length>=n)return t;const e=new t.constructor(n+Math.ceil(.5*n)),r=t.getLength();for(let n=0;n<r;n++)e[n]=t[n];return e.currentIndex=t.currentIndex,e}static getArray(t){let n;if(t){const e=fa(t);n=new e(1048576/e.BYTES_PER_ELEMENT)}else n=new da;return n.push=(...t)=>{n.pushIn(...t)},n}static getProxyArray(){const t=new da,n=new Proxy(t,pa);return n.push=(...n)=>{t.pushIn(...n)},n.R=t,n}constructor(){this.tt=[],this.nt=0,this.et=[],this.rt=0,this.it={}}getProxy(){if(!ca){const t=new ya;return t.currentIndex=0,t}const t=this.et[this.rt]=this.et[this.rt]||ga.getProxyArray();return t.reset(),this.rt++,t}get(t){if(!ca){const t=new ya;return t.currentIndex=0,t}if(t){const n=t.name;let e=this.it[n];e||(e=this.it[n]={arrays:[],index:0});const r=e.index,i=e.arrays[r]=e.arrays[r]||ga.getArray(t);return i.reset(),e.index++,i}const n=this.tt[this.nt]=this.tt[this.nt]||ga.getArray();return n.reset(),this.nt++,n}reset(){this.nt=0,this.rt=0;for(const t in this.it)this.it[t].index=0}}ma=new ga;const va="__fea_idx",ba=[],wa={},Ma={},xa={},Fa=[],ka=ga.getInstance(),Aa=Math.pow(2,17);class Pa{static isAtlasLoaded(t,n={}){const{iconAtlas:e}=n;return!!(!t||e&&e.positions[t])}static genFnTypes(t){const n={};for(const e in t)if(ia(t[e])){const r=(e+"_Fn_0").trim(),i=(e+"Fn").trim(),s=la(e);n[r]=ra(t[e],s),n[i]=(t,e)=>{let i;wa.zoom=t,Ma.properties=e;try{i=n[r].evaluateWithoutErrorHandling(wa,Ma,xa,null,Fa)}catch(t){return null}return i}}else if(_r(t[e])){const r=(e+"_Fn_0").trim(),i=(e+"Fn").trim();oa(e)?(n[r]=m(t[e]),n[i]=(t,e)=>{const i=n[r](t,e);return _r(i)?m(i)(t,e):i}):(n[r]=g(t[e]),n[i]=(t,e)=>{const i=n[r](t,e);return _r(i)?g(i)(t,e):i})}return n}constructor(t,n,e){this.options=e;const r=[];this.symbolDef=n,this.symbol=v(n,(()=>(r[0]=e.zoom,r))),this.styledVectors=[],this.properties={},this.st=e.fnTypes||Pa.genFnTypes(this.symbolDef),_r(this.symbolDef.visible)&&(this.ot=m(this.symbolDef.visible)),e.atlas&&(this.iconAtlas=e.atlas.iconAtlas,this.glyphAtlas=e.atlas.glyphAtlas),this.features=this.ut(t)}needAltitudeAttribute(){return this.options.forceAltitudeAttribute||this.maxPosZ>=Aa||this.options.positionType===Float32Array}getPositionFormat(){return this.needAltitudeAttribute()?[{type:Int16Array,width:2,name:"aPosition"},{type:Float32Array,width:1,name:"aAltitude"}]:[{type:Float32Array,width:3,name:"aPosition"}]}fillPosition(t,n,e,r){if(n<this.lt&&(this.lt=n),n>this.ht&&(this.ht=n),e<this.ct&&(this.ct=e),e>this.ft&&(this.ft=e),this.needAltitudeAttribute()){let i=t.aPosition.currentIndex;t.aPosition[i++]=n,t.aPosition[i++]=e,t.aPosition.currentIndex=i,i=t.aAltitude.currentIndex,t.aAltitude[i++]=r,t.aAltitude.currentIndex=i}else{jr(ba,n,e,r);let i=t.aPosition.currentIndex;t.aPosition[i++]=ba[0],t.aPosition[i++]=ba[1],t.aPosition[i++]=ba[2],t.aPosition.currentIndex=i}}ut(t){if(!t.length)return t;const n=(va+"").trim();let e,r=0,i=t[r];for(;!i.geometry;)r++,i=t[r];if(Array.isArray(i.geometry)&&i.properties){let n=i.geometry[0];for(;Array.isArray(n);)n=n[0];n instanceof dt&&(e=t)}if(!e)if(e=[],Array.isArray(i.geometry))for(let n=0;n<t.length;n++){const r=br({},t[n]);e.push(vr(r))}else for(let r=0;r<t.length;r++){const i=t[r],s=qe(i);for(let t=0;t<s.length;t++){const r=s[t];r[n]=i[n],e.push(r)}}if(this.maxPosZ=0,!this.options.forceAltitudeAttribute){const t="line"===this.symbolDef.textPlacement;let n=0,r=!1;const{textPitchAlignmentFn:i}=this.st;!i&&t&&"map"===this.symbolDef.textPitchAlignment&&(r=!0);for(let s=0;s<e.length;s++){const o=_a(e[s]&&e[s].geometry);if(o>n&&(n=o),t&&!r&&i&&e[s].properties){const t=i(null,e[s].properties);"map"===t&&(r=t)}}this.hasMapPitchAlign=r,this.maxPosZ=n}const s=this.options.order;if(s){const t=[];for(let n=0;n<s.length;n++)s[n]&&t.push(na(s[n]));e=e.sort(((n,e)=>{const r=t.length;let i=-1,s=-1;for(let o=0;o<r&&(t[o](n)&&(i=o),t[o](e)&&(s=o),!(i>=0&&i<r&&s>=0&&s<r));o++);return i-s}))}return e}load(t=1){const n=(va+"").trim(),e="_debug_info".trim(),r=this.st,i=this.styledVectors;this.count=0;const s=this.features;if(!s||!s.length)return Promise.resolve(null);const o={},a={},u={zoom:this.options.zoom,isVector3D:!!this.options.center},l=[],h=v(this.symbolDef,(()=>(l[0]=u.zoom,l)));let c=0,f=s.length;const d=this.options.debugIndex;try{for(;c<f;c++){const t=s[c];if(!t||!t.geometry)continue;if(Mr(d)&&t[e].index!==d)continue;t.properties||(t.properties={}),t.properties.$layer=t.layer,t.properties.$type=t.type;const l=this.createStyledVector(t,h,r,u,o,a);l&&l.feature.geometry&&(l.featureIdx=void 0===t[n]?c:t[n],this.count++,i.push(l))}}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(((e,r)=>{this.fetchAtlas(t,n,((t,n)=>{if(t)r(t);else{if(n){const{icons:t,glyphs:e}=n;if(t&&Object.keys(t).length){for(const n in t){const e=t[n],{width:r,height:i,data:s}=e.data;e.data=new tr({width:r,height:i},s)}this.iconAtlas=new cr(t)}if(e&&Object.keys(e).length){for(const t in e){const n=e[t];for(const t in n){const e=n[t],{width:r,height:i,data:s}=e.bitmap;e.bitmap=new Qe({width:r,height:i},s)}}this.glyphAtlas=new dr(e)}}e({glyphAtlas:this.glyphAtlas,iconAtlas:this.iconAtlas})}}))}))}fetchAtlas(t,n,e){Object.keys(t).length>0||Object.keys(n).length>0?this.options.requestor(t,n,e):e()}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 e=n.buffers;delete n.buffers;const r={data:n,buffers:e};if(this.iconAtlas){const t=r.data.iconAtlas=Sa(this.iconAtlas);if(t.glyphMap)for(const n in t.glyphMap)e.push(t.glyphMap[n].data.data.buffer);e.push(r.data.iconAtlas.image.data.buffer)}return this.glyphAtlas&&(r.data.glyphAtlas=Sa(this.glyphAtlas),e.push(r.data.glyphAtlas.image.data.buffer)),r}createStyledVector(t,n,e,r){return new zr(t,n,e,r)}createDataPack(t,n){if(!t||!t.length)return null;this.maxIndex=0,this.maxPos=0,this.lt=this.ct=1/0,this.ht=this.ft=-1/0,this.maxAltitude=0,this.dynamicAttrs={};const e=this.data={};this.dt=ka,ka.reset();let r=this.elements=ka.get();const i=this.yt=this.getFormat(Array.isArray(t[0])?t[0][0].symbol:t[0].symbol),s=this.needAltitudeAttribute()?2:3;for(let t=0;t<i.length;t++)e[i[t].name]=ka.get(i[t].type);let o=ka.get(),a=0;const u=ka.get();let l=0,h=!1,c=!0;const f=new Set;for(let r=0,i=t.length;r<i;r++){if(!t[r].feature.geometry)continue;const i=Array.isArray(t[r])?t[r][0].feature.id:t[r].feature.id;c&&(void 0!==Ma.id?f&&(f.has(Ma.id)?c=!1:f.add(Ma.id)):c=!1),Mr(i)&&(Math.abs(i)>l&&(l=Math.abs(i)),i<0&&(h=!0));const d=this.data.aPosition.getLength();if(Array.isArray(t[r]))for(let e=0;e<t[r].length;e++)this.gt(t[r][e],n);else this.gt(t[r],n);const p=(e.aPosition.getLength()-d)/s;for(let n=0;n<p;n++)o.push(t[r].featureIdx),Mr(i)&&u.push(i);a=Math.max(a,t[r].featureIdx)}if(this.countOutOfAngle>0&&console.warn("text anchor along line is ignored as anchor's line angle is bigger than textMaxAngle."),this.hasElements()&&!r.getLength())return null;const d=this.options.center?Float32Array:mr(a);o=ga.createTypedArray(o,d),i[0].type=this.options.positionType?this.options.positionType:yr(this.maxPos);const p=this.options.center;if(p&&(p[0]||p[1])){const t=e.aPosition,n=t.getLength();for(let e=0;e<n;e+=s)t[e]-=p[0],t[e+1]-=p[1]}const y=function(t,n){const e={};for(let r=0;r<t.length;r++){const i=t[r],s=i.type,o=i.name;e[o]=s===Array?n[o]:gr(n[o],s)}return e}(i,e);y.aPickingId=o;const m=[];for(const t in y)m.push(y[t].buffer);const g=pr(this.maxIndex);r=ga.createTypedArray(r,g),m.push(r.buffer);const v={data:y,isIdUnique:c,is2D:0===this.maxPosZ,indices:this.hasElements()?r:null,positionSize:s,positionBounding:[this.lt,this.ct,this.ht,this.ft],buffers:m,symbolIndex:this.symbolDef.index||{index:0},dynamicAttributes:this.dynamicAttrs};if(this.vt&&(v.markerPlacement=this.vt),this.bt&&(v.textPlacement=this.bt),u.getLength()){const t=h?yr(l):mr(l);v.featureIds=ga.createTypedArray(u,t),m.push(v.featureIds.buffer)}else v.featureIds=[];return v.pickingIdIndiceMap=ur(o,v.indices),v}gt(t,n){this.ot&&!this.ot(this.options.zoom,t.feature.properties)||this.placeVector(t,n,this.formatWidth)}addElements(t,n,e){this.maxIndex=Math.max(this.maxIndex,t,n,e);let r=this.elements.currentIndex;this.elements[r++]=t,this.elements[r++]=n,this.elements[r++]=e,this.elements.currentIndex=r}hasElements(){return!0}getAltitude(t){const{altitudeProperty:n,defaultAltitude:e,altitudeScale:r}=this.options;let i=rr(t,n,e);return r&&(i*=r),this.maxAltitude=Math.max(this.maxAltitude,Math.abs(i)),i}getIconAtlasMaxValue(){const t=this.iconAtlas.positions;let n=0;for(const e in t)if(Pr(t,e)){const{tl:r,displaySize:i}=t[e],s=Math.max(r[0],r[1],i[0]-1,i[1]-1);s>n&&(n=s)}return n}ensureDataCapacity(t,n){const e=this.yt;for(let r=0;r<e.length;r++){const i=this.data[e[r].name];if(!i)continue;const s=e[r].width*t,o=i.getLength();this.data[e[r].name]=ga.ensureCapacity(i,o+s*n)}}}function Sa(t){let n=t.positions,e=t.image&&t.image.format||"alpha";if(t instanceof cr){n={};for(const e in t.positions){const r=t.positions[e];n[e]={paddedRect:r.paddedRect,pixelRatio:r.pixelRatio,tl:r.tl,br:r.br,displaySize:r.displaySize}}e="rgba"}const r=t.image;return{image:{width:r.width,height:r.height,data:r.data,format:e},glyphMap:t.glyphMap,positions:n}}function _a(t){if(!t)return 0;let n=0;if(Array.isArray(t))for(let e=0;e<t.length;e++)if(Array.isArray(t[e])){const r=_a(t[e]);r>n&&(n=r)}else{const r=Math.abs(t[e].z||0);r>n&&(n=r)}else{const e=Math.abs(t.z||0);e>n&&(n=e)}return n}const Oa="___fn_in_stops";function Ca(t,n,e,r){const i="__fn_textSize".trim();let s=t.textSize;if(wr(n.textSize))return[16,16];t[i]&&(s=t[i]);const o=[];if(o[0]=kr(s)?s(r,e):s,y(o[0])){const n=o[0].wt=o[0].wt||JSON.stringify(o[0]);t[Oa]||(t[Oa]={}),t[Oa][n]||(t[Oa][n]=m(o[0])),o[0]=(0,t[Oa][n])(r,e)}return o[1]=o[0],o}function Ea(t){const n=t.stops;let e=-1/0;for(let t=0;t<n.length;t++){let r=n[t][1];xr(n[t][1])&&(r=Ea(n[t][1])),r>e&&(e=r)}return e}function Ia(t){return t||"Open Sans Regular"}const $a=/\\{[\\w-]+(?:\\|[\\w-]+)*\\}/g;function Ta(t,n){return Fr(t)?t.replace($a,(function(t){if(!n)return"";if((t=t.substring(1,t.length-1)).indexOf("|")>0){const e=t.split("|");for(let t=0;t<e.length;t++){const r=n[e[t]];if(!wr(r))return r}return""}const e=n[t];return wr(e)?"":Array.isArray(e)?e.join():e})):t}var Da=Object.freeze({__proto__:null,getSDFFont:Ia,resolveExpVarNames:function t(n,e){if(2!==e.length||"get"!==e[0])for(let r=0;r<e.length;r++)2===e[r].length&&"get"===e[r][0]?n.push(e[r][1]):Array.isArray(e[r])&&t(n,e[r]);else n.push(e[1])},resolveText:Ta,resolveVarNames:function(t){return t.match($a)}});const za={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function ja(t){return!(za.Arabic(t)||za["Arabic Supplement"](t)||za["Arabic Extended-A"](t)||za["Arabic Presentation Forms-A"](t)||za["Arabic Presentation Forms-B"](t))}function Ua(t){return!!(!(t<11904)&&(za["Bopomofo Extended"](t)||za.Bopomofo(t)||za["CJK Compatibility Forms"](t)||za["CJK Compatibility Ideographs"](t)||za["CJK Compatibility"](t)||za["CJK Radicals Supplement"](t)||za["CJK Strokes"](t)||za["CJK Symbols and Punctuation"](t)||za["CJK Unified Ideographs Extension A"](t)||za["CJK Unified Ideographs"](t)||za["Enclosed CJK Letters and Months"](t)||za["Halfwidth and Fullwidth Forms"](t)||za.Hiragana(t)||za["Ideographic Description Characters"](t)||za["Kangxi Radicals"](t)||za["Katakana Phonetic Extensions"](t)||za.Katakana(t)||za["Vertical Forms"](t)||za["Yi Radicals"](t)||za["Yi Syllables"](t)))}function Na(t){return!!(746===t||747===t||!(t<4352)&&(za["Bopomofo Extended"](t)||za.Bopomofo(t)||za["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||za["CJK Compatibility Ideographs"](t)||za["CJK Compatibility"](t)||za["CJK Radicals Supplement"](t)||za["CJK Strokes"](t)||!(!za["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||za["CJK Unified Ideographs Extension A"](t)||za["CJK Unified Ideographs"](t)||za["Enclosed CJK Letters and Months"](t)||za["Hangul Compatibility Jamo"](t)||za["Hangul Jamo Extended-A"](t)||za["Hangul Jamo Extended-B"](t)||za["Hangul Jamo"](t)||za["Hangul Syllables"](t)||za.Hiragana(t)||za["Ideographic Description Characters"](t)||za.Kanbun(t)||za["Kangxi Radicals"](t)||za["Katakana Phonetic Extensions"](t)||za.Katakana(t)&&12540!==t||!(!za["Halfwidth and Fullwidth Forms"](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)||!(!za["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||za["Unified Canadian Aboriginal Syllabics"](t)||za["Unified Canadian Aboriginal Syllabics Extended"](t)||za["Vertical Forms"](t)||za["Yijing Hexagram Symbols"](t)||za["Yi Syllables"](t)||za["Yi Radicals"](t)))}function La(t){return!(Na(t)||function(t){return!!(za["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||za["General Punctuation"](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)||za["Letterlike Symbols"](t)||za["Number Forms"](t)||za["Miscellaneous Technical"](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)||za["Control Pictures"](t)&&9251!==t||za["Optical Character Recognition"](t)||za["Enclosed Alphanumerics"](t)||za["Geometric Shapes"](t)||za["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||za["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||za["CJK Symbols and Punctuation"](t)||za.Katakana(t)||za["Private Use Area"](t)||za["CJK Compatibility Forms"](t)||za["Small Form Variants"](t)||za["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Ra(t){return t>=1424&&t<=2303||za["Arabic Presentation Forms-A"](t)||za["Arabic Presentation Forms-B"](t)}const Va=[[9,9],[32,32],[5760,5760],[8192,8198],[8200,8202],[8287,12288],[6158,6158],[8203,8205]];function Ha(t){for(const n of Va)if(t>=n[0]&&t<=n[1])return!0;return!1}const qa={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\\\":"\","]":"﹈","^":"^",Mt:"︳","\`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},Ga=1,Ja=2;function Wa(t,n,e,r,i,s,o,a,u,l){let h=t.trim();l===Ja&&(h=function(t){let n="";const e=Array.from(t);for(let t=0;t<e.length;t++){const r=e[t+1].codePointAt(0)||null,i=e[t-1].codePointAt(0)||null;n+=r&&La(r)&&!qa[e[t+1]]||i&&La(i)&&!qa[e[t-1]]||!qa[e[t]]?e[t]:qa[e[t]]}return n}(h));const c=[],f={positionedGlyphs:c,text:h,top:a[1],bottom:a[1],left:a[0],right:a[0],writingMode:l};let d;return d=function(t,n){const e=[];let r=0;for(let i=0;i<n.length;i++){const s=n[i];e.push(t.substring(r,s)),r=s}return r<t.length&&e.push(t.substring(r,t.length)),e}(h,function(t,n,e,r){if(!e)return[];if(!t)return[];const i=[],s=function(t,n,e,r){let i=0;for(let e=0;e<t.length;e++){const s=r[t.codePointAt(e)];s&&(i+=s.metrics.advance+n)}return i/Math.max(1,Math.ceil(i/e))}(t,n,e,r);let o=0;for(let e=0;e<t.length;e++){const a=t.codePointAt(e),u=r[a];u&&(u&&!Ba[a]&&(o+=u.metrics.advance+n),e<t.length-1&&(Xa[a]||Ua(a))&&i.push(Za(e+1,o,s,i,Ka(a,t.codePointAt(e+1)),!1)))}return Qa(Za(t.length,o,s,i,0,!0))}(h,o,e,n)),function(t,n,e,r,i,s,o,a,u,l){let h=0,c=0,f=0;const d=t.positionedGlyphs;for(let t=0;t<e.length;t++){let i=e[t];if(i=i.trim(),!i.length){c-=r;continue}const s=d.length;for(let t=0;t<i.length;t++){const e=i.codePointAt(t),r=n[e];r&&(Na(e)&&o!==Ga?(32!==e&&d.push({glyph:e,x:h,y:0,vertical:!0}),h+=u+a):(32!==e&&d.push({glyph:e,x:h,y:c,vertical:!1}),h+=r.metrics.advance+a))}d.length!==s&&(f=Math.max(h-a,f),nu(d,n,s,d.length-1,.5)),h=0,c-=r}const{horizontalAlign:p,verticalAlign:y}=tu(i,void 0);!function(t,n,e,r,i,s,o){const a=(.5-e)*i,u=-(-r*o+.5)*s;if(a||u)for(let n=0;n<t.length;n++)t[n].x+=a,t[n].y+=u}(d,0,p,y,f,r,e.length);const m=e.length*r;t.top+=-y*m,t.bottom=t.top+m,t.left+=-p*f,t.right=t.left+f}(f,n,d,r,i,0,l,o,u),!!c.length&&f}const Ba={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Xa={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 Ya(t,n,e,r){const i=Math.pow(t-n,2);return r?t<n?i/2:2*i:i+Math.abs(e)*e}function Ka(t,n){let e=0;return 10===t&&(e-=1e4),40!==t&&65288!==t||(e+=50),41!==n&&65289!==n||(e+=50),e}function Za(t,n,e,r,i,s){let o=null,a=Ya(n,e,i,s);for(let t=0;t<r.length;t++){const u=r[t],l=Ya(n-u.x,e,i,s)+u.badness;l<=a&&(o=u,a=l)}return{index:t,x:n,priorBreak:o,badness:a}}function Qa(t){return t?Qa(t.priorBreak).concat(t.index):[]}function tu(t,n){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=n?1:0;break;case"left":case"top-left":case"bottom-left":e=n?0:1}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=n?1:0;break;case"top":case"top-right":case"top-left":r=n?0:1}return{horizontalAlign:e,verticalAlign:r}}function nu(t,n,e,r,i){const s=n[t[r].glyph];if(s){const n=(t[r].x+s.metrics.advance)*i;if(!n)return;for(let i=e;i<=r;i++)t[i].x-=n}}function eu(t){if(!function(t){for(const n of t)if(Ra(n.charCodeAt(0)))return!0;return!1}(t))return t;const n=[],e=[],r=[];let i=0,s=0,o=1,a=1;for(const u of t){const t=u.codePointAt(0);Ha(t)?(r.push(u),i++):(o=Ra(t)?-1:1,a!==o?(s=i,e.length&&(a>0&&e.reverse(),n.push(...e)),r.length&&(n.splice(s,0,...r),r.length=0),a=o,e.length=0):r.length&&(e.push(...r),r.length=0),e.push(u),i++)}return r.length&&e.push(...r),e.length&&(a>0&&e.reverse(),n.push(...e)),n.reverse().join("")}const ru=/\\{ *([\\w_]+) *\\}/g;class iu{constructor(t,n,e,r,i){this.feature=t,this.symbolDef=n,this.symbol=e,this.options=i,this.xt=this.Ft.bind(this),this.st=r}Ft(t,n){return this.feature.properties[n]||""}getShape(t,n){if(this.kt)return this.kt;const{textHorizontalAlignmentFn:e,textVerticalAlignmentFn:r,markerHorizontalAlignmentFn:i,markerVerticalAlignmentFn:s,textWrapWidthFn:o}=this.st;let a;const u=this.symbol,l=this.getIconAndGlyph(),h=this.feature.properties;if(l&&l.glyph){const{font:t,text:i}=l.glyph;if(""===i)return null;const s=this.size[0]/24,c=24,f=u.textKeepUpright,d="map"===u.textRotationAlignment&&"line"===u.textPlacement&&!u.isIconText,p=n.glyphMap[t],y=su(e?e(null,h):u.textHorizontalAlignment,r?r(null,h):u.textVerticalAlignment),m=1.2*c,g=function(t){for(let n=0;n<t.length;n++)if(!ja(t.charAt(n).charCodeAt(0)))return!1;return!0}(i),v=g&&u.textLetterSpacing/s||0,b=[u.textDx/s||0,u.textDy/s||0],w=((o?o(null,h):u.textWrapWidth)||10*c)/s;a={},a.horizontal=Wa(i,p,w,m,y,0,v,b,c,Ga),g&&d&&f&&(a.vertical=Wa(i,p,w,m,y,0,v,b,c,Ja))}else if(l&&l.icon){if(!t||!t.positions[l.icon.url])return null;const n=su(i?i(null,h):u.markerHorizontalAlignment,s?s(null,h):u.markerVerticalAlignment);a=function(t,n,e){let{horizontalAlign:r,verticalAlign:i}=tu(n,e);e?r=1-r:i=1-i;const s=-2048*r,o=-2048*i;return{image:t,top:o,bottom:o+2048,left:s,right:s+2048}}(t.positions[l.icon.url],n,this.options.isVector3D),this.size||(this.size=a.image.displaySize)}return this.kt=a,a}getIconAndGlyph(){if(this.iconGlyph)return this.iconGlyph;const{markerFileFn:t,markerTypeFn:n,markerPathFn:e,markerWidthFn:r,markerHeightFn:i,markerFillFn:s,markerFillPatternFileFn:o,markerFillOpacityFn:a,markerTextFitFn:u,markerTextFitPaddingFn:l,markerLineColorFn:h,markerLineWidthFn:c,markerLineOpacityFn:f,markerLineDasharrayFn:d,markerLinePatternFileFn:p,markerPathWidthFn:g,markerPathHeightFn:v,textNameFn:b,textFaceNameFn:w}=this.st,{zoom:M}=this.options,x={},F=this.symbol,k=this.feature.properties,A=t?t(null,k):F.markerFile,P=n?n(null,k):F.markerType,S=A||P||F.markerPath,_=!wr(this.symbolDef.textName);let O;if(S){O=function(t,n,e,r,i,s){if(wr(n.markerWidth)&&wr(n.markerHeight))return null;const o="__fn_markerWidth".trim(),a="__fn_markerHeight".trim();let u=n.markerWidth||0,l=n.markerHeight||0;return xr(u)&&("identity"!==u.type?u=Ea(u):(u=t.markerWidth,t[o]&&(u=t[o](r,e)),xr(u)&&(u="identity"===u.type?i(r,e):Ea(u)))),xr(l)&&("identity"!==l.type?l=Ea(l):(l=t.markerHeight,t[a]&&(l=t[a](r,e)),xr(l)&&(l="identity"===l.type?s(r,e):Ea(l)))),[u,l]}(F,this.symbolDef,k,M,r,i)||[0,0];let t=F.markerTextFit;if(u&&(t=u(M,k)),t&&F.text&&"none"!==t){const n=F.text.textSize;let e=F.text.textName;y(e)&&(e=m(e)(M,k));const r=Ta(e,k);if(r){const e="__fn_textSize".trim(),i="__fn_textSize_0".trim();y(n)&&!F.text[e]&&(F.text[i]=m(n),F.text[e]=(t,n)=>{const e=F.text[i](t,n);return y(e)?m(e)(t,n):e});const s=Ca(F.text,F.text,k,M);if("width"!==t&&"both"!==t||(O[0]=s[0]*r.length),"height"!==t&&"both"!==t||(O[1]=s[1]),s[0]&&s[1]){let t=F.markerTextFitPadding||[0,0,0,0];l&&(t=l(M,k)),O[0]+=t[1]+t[3],O[1]+=t[0]+t[2]}}else O[0]=O[1]=-1}}if(_&&(O=Ca(F,this.symbolDef,k,M)),!O)return x;if(O[0]=Math.ceil(O[0]),O[1]=Math.ceil(O[1]),this.size=O,S&&O[0]>=0&&O[1]>=0){let t;if(P){const n={};if(n.markerType=P,"path"===P&&(n.markerPath=e?e(null,k):F.markerPath,n.markerPathWidth=g?g(null,k):F.markerPathWidth,n.markerPathHeight=v?v(null,k):F.markerPathHeight),r){const t=r(null,k);wr(t)||(n.markerWidth=t)}else F.markerWidth>=0&&(n.markerWidth=F.markerWidth);if(i){const t=i(null,k);wr(t)||(n.markerHeight=t)}else F.markerHeight>=0&&(n.markerHeight=F.markerHeight);if(s){const t=s(null,k);wr(t)||(n.markerFill=t)}else F.markerFill&&(n.markerFill=F.markerFill);if(o){const t=o(null,k);wr(t)||(n.markerFillPatternFile=t)}else F.markerFillPatternFile&&(n.markerFillPatternFile=F.markerFillPatternFile);if(a){const t=a(null,k);wr(t)||(n.markerFillOpacity=t)}else F.markerFillOpacity>=0&&(n.markerFillOpacity=F.markerFillOpacity);if(h){const t=h(null,k);wr(t)||(n.markerLineColor=t)}else F.markerLineColor&&(n.markerLineColor=F.markerLineColor);if(c){const t=c(null,k);wr(t)||(n.markerLineWidth=t)}else F.markerLineWidth>=0&&(n.markerLineWidth=F.markerLineWidth);if(f){const t=f(null,k);wr(t)||(n.markerLineOpacity=t)}else F.markerLineOpacity>=0&&(n.markerLineOpacity=F.markerLineOpacity);if(d){const t=d(null,k);wr(t)||(n.markerLineDasharray=t)}else F.markerLineDasharray&&(n.markerLineDasharray=F.markerLineDasharray);if(p){const t=p(null,k);wr(t)||(n.markerLinePatternFile=t)}else F.markerLinePatternFile&&(n.markerLinePatternFile=F.markerLinePatternFile);t="vector://"+JSON.stringify(n)}else t=A?A.replace(ru,this.xt):F.markerPath?function(t,n,e){if(!t.markerPath)return null;let r=1;const i=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);Mr(t.markerOpacity)&&(r=t.markerOpacity),Mr(t.opacity)&&(r*=t.opacity);const s={};if(i){for(const t in i.stroke)Pr(i.stroke,t)&&(wr(i.stroke[t])||(s[t]=i.stroke[t]));for(const t in i.fill)Pr(i.fill,t)&&(wr(i.fill[t])||(s[t]=i.fill[t]))}const o=Array.isArray(t.markerPath)?t.markerPath:[t.markerPath];let a;const u=[];for(let t=0;t<o.length;t++)a=Fr(o[t])?{path:o[t]}:o[t],a=br({},a,s),a.d=a.path,delete a.path,u.push(a);const l=['<svg version="1.1"','xmlns="http://www.w3.org/2000/svg"'];r<1&&l.push('opacity="'+r+'"'),t.markerPathWidth&&t.markerPathHeight&&l.push('viewBox="0 0 '+t.markerPathWidth+" "+t.markerPathHeight+'"'),l.push('preserveAspectRatio="none"'),n&&l.push('width="'+n+'"'),e&&l.push('height="'+e+'"'),l.push("><defs></defs>");for(let t=0;t<u.length;t++){let n="<path ";for(const e in u[t])Pr(u[t],e)&&(n+=" "+e+'="'+u[t][e]+'"');n+="></path>",l.push(n)}return l.push("</svg>"),"data:image/svg+xml;base64,"+btoa(l.join(" "))}(F,O[0],O[1]):null;x.icon={url:t,size:O}}if(_){const t=b?b(this.options.zoom,k):F.textName;if(t||0===t){const n=Ia(w?w(null,k):F.textFaceName);let e=Ta(t,k);e&&e.length&&(e=eu(e),x.glyph={font:n,text:e})}}return this.iconGlyph=x,x}}function su(t,n){n&&"middle"!==n||(n="center"),t&&"middle"!==t||(t="center");let e="center"!==n?n:"";return e+="center"!==t?(e.length?"-":"")+t:"",e\n/*!\n * From mapbox-gl-js\n * MIT License\n * https://github.com/mapbox/mapbox-gl-js\n */}function ou(t,n,e,r,i){const s=[];let o;for(let a=0;a<t.length;a++){const u=t[a];let l,h=!1;for(let t=0;t<u.length-1;t++){let a=u[t],c=u[t+1];a.x<n&&c.x<n||(a.x<n?(o=a,a=new dt(n,a.y+(n-a.x)/(c.x-a.x)*(c.y-a.y)).j(),a.z=o.z+(n-o.x)/(c.x-o.x)*(c.z-o.z),h=!0):c.x<n&&(o=c,c=new dt(n,a.y+(n-a.x)/(c.x-a.x)*(c.y-a.y)).j(),c.z=a.z+(n-a.x)/(o.x-a.x)*(o.z-a.z),h=!0),a.y<e&&c.y<e||(a.y<e?(o=a,a=new dt(a.x+(e-a.y)/(c.y-a.y)*(c.x-a.x),e).j(),a.z=o.z+(e-o.y)/(c.y-o.y)*(c.z-o.z),h=!0):c.y<e&&(o=c,c=new dt(a.x+(e-a.y)/(c.y-a.y)*(c.x-a.x),e).j(),c.z=a.z+(e-a.y)/(o.y-a.y)*(o.z-a.z),h=!0),a.x>=r&&c.x>=r||(a.x>=r?(o=a,a=new dt(r,a.y+(r-a.x)/(c.x-a.x)*(c.y-a.y)).j(),a.z=o.z+(r-o.x)/(c.x-o.x)*(c.z-o.z),h=!0):c.x>=r&&(o=c,c=new dt(r,a.y+(r-a.x)/(c.x-a.x)*(c.y-a.y)).j(),c.z=a.z+(r-a.x)/(o.x-a.x)*(o.z-a.z),h=!0),a.y>=i&&c.y>=i||(a.y>=i?(o=a,a=new dt(a.x+(i-a.y)/(c.y-a.y)*(c.x-a.x),i).j(),a.z=o.z+(i-o.y)/(c.y-o.y)*(c.z-o.z),h=!0):c.y>=i&&(o=c,c=new dt(a.x+(i-a.y)/(c.y-a.y)*(c.x-a.x),i).j(),c.z=a.z+(i-a.y)/(o.y-a.y)*(o.z-a.z),h=!0),l&&a.equals(l[l.length-1])||(l=[a],s.push(l)),h&&(l.clipped=!0),l.push(c)))))}}return s}class au extends dt{constructor(t,n,e,r){super(t,n),this.angle=e,void 0!==r&&(this.segment=r)}clone(){return new au(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 uu(t,n,e,r,i){if(void 0===n.segment)return!0;let s=n,o=n.segment+1,a=0;for(;a>-e/2;){if(o--,o<0)return!1;a-=t[o].dist(s),s=t[o]}a+=t[o].dist(t[o+1]),o++;const u=[];let l=0;for(;a<e/2;){const n=t[o],e=t[o+1];if(!e)return!1;let s=t[o-1].angleTo(n)-n.angleTo(e);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),u.push({distance:a,angleDelta:s}),l+=s;a-u[0].distance>r;)l-=u.shift().angleDelta;if(l>i)return!1;o++,a+=n.dist(e)}return!0}function lu(t,n,e,r,i,s,o,a,u,l,h){const c=function(t,n,e){return t?.6*n*e:0}(r,s,o),f=function(t,n){return Math.max(t?t.right-t.left:0,0)}(r),d=0===t[0].x||t[0].x===u||0===t[0].y||t[0].y===u;return n-f*o<n/4&&(n=f*o+n/4),hu(t,d?n/2*a%n:(f/2+2*s)*o*a%n,n,c,e,f*o,d,!1,u,l,h)}function hu(t,n,e,r,i,s,o,a,u,l,h){let c=0;const f=s/2,d=function(t){let n=0;for(let e=0;e<t.length-1;e++)n+=t[e].dist(t[e+1]);return n}(t);let p=0,y=n-e,m=[];for(let n=0;n<t.length-1;n++){const o=t[n],a=t[n+1],g=o.dist(a),v=a.angleTo(o);for(;y+e<p+g;){y+=e;const b=(y-p)/g,w=cu(o.x,a.x,b),M=cu(o.y,a.y,b),x=cu(o.z||0,a.z||0,b);if(w>=0&&w<u&&M>=0&&M<u&&y-f>=0&&y+f<=d){const e=new au(w,M,v,n);e.z=x,l&&(e.axis=[o.y-M,w-o.x],e.angleR=x===(o.z||0)?0:Math.atan(.9*(x-(o.z||0))*h/o.dist(e))),e.line=t,e.j(),!r||uu(t,e,s,r,i)?m.push(e):r&&c++}}p+=g}return a||m.length||o||(m=hu(t,p/2,e,r,i,s,o,!0,u,l,h)),m.countOutOfAngle=c,m}function cu(t,n,e){return t*(1-e)+n*e}function fu(t,n){const e=t.length;if(e<=1)return[t];const r=[];let i,s;for(let n=0;n<e;n++){const e=nr(t[n]);0!==e&&(t[n].area=Math.abs(e),void 0===s&&(s=e<0),s===e<0?(i&&r.push(i),i=[t[n]]):i.push(t[n]))}if(i&&r.push(i),n>1)for(let t=0;t<r.length;t++)r[t].length<=n||(Mn(r[t],n,1,r[t].length-1,du),r[t]=r[t].slice(0,n));return r}function du(t,n){return n.area-t.area}function pu(t,n,e){const r=n.distSqr(e);if(0===r)return t.distSqr(n);const i=((t.x-n.x)*(e.x-n.x)+(t.y-n.y)*(e.y-n.y))/r;return t.distSqr(i<0?n:i>1?e:e.sub(n).S(i).F(n))}function yu(t,n=1,e=!1){let r=1/0,i=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<r)&&(r=n.x),(!t||n.y<i)&&(i=n.y),(!t||n.x>s)&&(s=n.x),(!t||n.y>o)&&(o=n.y)}const u=Math.min(s-r,o-i);let l=u/2;const h=new xn([],mu);if(0===u)return new dt(r,i);for(let n=r;n<s;n+=u)for(let e=i;e<o;e+=u)h.push(new gu(n+l,e+l,l,t));let c=function(t){let n=0,e=0,r=0;const i=t[0];for(let t=0,s=i.length,o=s-1;t<s;o=t++){const s=i[t],a=i[o],u=s.x*a.y-a.x*s.y;e+=(s.x+a.x)*u,r+=(s.y+a.y)*u,n+=3*u}return new gu(e/n,r/n,0,t)}(t),f=h.length;for(;h.length;){const r=h.pop();(r.d>c.d||!c.d)&&(c=r,e&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,f)),r.max-c.d<=n||(l=r.h/2,h.push(new gu(r.p.x-l,r.p.y-l,l,t)),h.push(new gu(r.p.x+l,r.p.y-l,l,t)),h.push(new gu(r.p.x-l,r.p.y+l,l,t)),h.push(new gu(r.p.x+l,r.p.y+l,l,t)),f+=4)}return e&&(console.log(\`num probes: ${o}f}\`),console.log(\`best distance: ${o}c.d}\`)),c.p}function mu(t,n){return n.max-t.max}function gu(t,n,e,r){this.p=new dt(t,n),this.h=e,this.d=function(t,n){let e=!1,r=1/0;for(let i=0;i<n.length;i++){const s=n[i];for(let n=0,i=s.length,o=i-1;n<i;o=n++){const i=s[n],a=s[o];i.y>t.y!=a.y>t.y&&t.x<(a.x-i.x)*(t.y-i.y)/(a.y-i.y)+i.x&&(e=!e),r=Math.min(r,pu(t,i,a))}}return(e?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}function vu(t,n,e,r,i,s,o,a,u,l){const{feature:h,size:c,symbol:f}=t,d=c?24:0,p=i*(c?c[0]/d:1);if("line"===o){const t=[];t.countOutOfAngle=0;let i=h.geometry;s&&(i=ou(h.geometry,0,0,s,s));for(let o=0;o<i.length;o++){const h=lu(i[o],a,e,f.isIconText?null:r&&r.vertical||r&&r.horizontal||r,0,d,f.isIconText?1:p,1,s||1/0,u,l);if(f.textPlacement&&!f.isIconText)for(let t=0;t<h.length;t++)h[t].startIndex=n.length/3;if(t.push.apply(t,h),f.textPlacement&&!f.isIconText)for(let t=0;t<i[o].length;t++)n.push(i[o][t].x,i[o][t].y,i[o][t].z||0);t.countOutOfAngle+=h.countOutOfAngle||0}return t}return bu(h,o,s)}function bu(t,n,e,r,i){const s=[];if(3===t.type){const o=fu(t.geometry,0);for(let t=0;t<o.length;t++){const a=o[t];if("vertex"===n)for(let t=0;t<a.length;t++){const n=a[t];for(let o=0;o<n.length;o++)sr(n[o],e)||(s.push(n[o]),r&&(0===o?wu(n[o],n[o],n[t+1],i):wu(n[o],n[o-1],n[o],i)))}else if("vertex-first"===n){const t=a[0];t&&t[0]&&!sr(t[0],e)&&(s.push(t[0]),r&&wu(t[0],t[0],t[1],i))}else if("vertex-last"===n||"vertex-firstlast"===n){const t=a[0];if("vertex-firstlast"===n&&t&&t[0]&&!sr(t[0],e)&&(s.push(t[0]),r&&wu(t[0],t[0],t[1],i)),t&&t[t.length-1]&&!sr(t[t.length-1],e)){const n=t.length-1;s.push(t[n]),r&&wu(t[n],t[n-1],t[n],i)}}else{const t=yu(a,16);sr(t,e)||s.push(t)}}}else if(2===t.type)for(let o=0;o<t.geometry.length;o++){const a=t.geometry[o];if("vertex"===n)for(let t=0;t<a.length;t++)sr(a[t],e)||(s.push(a[t]),r&&(0===t?wu(a[t],a[t],a[t+1],i):wu(a[t],a[t-1],a[t],i)));else if("vertex-last"===n||"vertex-firstlast"===n){if("vertex-firstlast"!==n||sr(a[0],e)||(s.push(a[0]),r&&wu(a[0],a[0],a[1],i)),a&&a[a.length-1]&&!sr(a[a.length-1],e)){const t=a.length-1;s.push(a[t]),r&&wu(a[t],a[t-1],a[t],i)}}else sr(a[0],e)||(s.push(a[0]),r&&wu(a[0],a[0],a[1],i))}else if(1===t.type)for(let n=0;n<t.geometry.length;n++){const i=t.geometry[n];for(let t=0;t<i.length;t++){const n=i[t];sr(n,e)||(r&&(n.xRotation=0,n.yRotation=0,n.zRotation=0),s.push(n))}}return s}function wu(t,n,e,r){if(t.xRotation||t.yRotation||t.zRotation)return t;const i=e.x-n.x,s=n.y-e.y,o=(e.z-n.z)*r,a=Math.atan2(s,i);t.zRotation=a;const u=Math.atan2(o,Math.sqrt(i*i+s*s));return t.xyRotation=u,t}function Mu(t,n){const e={},r={},i=[];let s=0;function o(n){i.push(t[n]),s++}function a(t,n,e){const s=r[t];return delete r[t],r[n]=s,i[s].geometry[0].pop(),i[s].geometry[0]=i[s].geometry[0].concat(e[0]),s}function u(t,n,r){const s=e[n];return delete e[n],e[t]=s,i[s].geometry[0].shift(),i[s].geometry[0]=r[0].concat(i[s].geometry[0]),s}function l(t,n,e){const r=e?n[0][n[0].length-1]:n[0][0];return\`${o}t}:${o}r.x}:${o}r.y}\`}for(let h=0;h<t.length;h++){const c=t[h],f=c.geometry;if(!f)continue;const d=c.properties[n]?c.properties[n].toString():null;if(!d){o(h);continue}const p=l(d,f),y=l(d,f,!0);if(p in r&&y in e&&r[p]!==e[y]){const t=u(p,y,f),n=a(p,y,i[t].geometry);delete e[p],delete r[y],r[l(d,i[n].geometry,!0)]=n,i[t].geometry=null}else p in r?a(p,y,f):y in e?u(p,y,f):(o(h),e[p]=s-1,r[y]=s-1)}return i.filter((t=>t.geometry))}const xu="__index";function Fu(t,n,e,r){const i=(xu+"").trim(),s=function(t,n,e,r){const i=(xu+"").trim(),{mergeOnPropertyFn:s}=e;if(!n.mergeOnProperty)return[];if(!or(o=n.mergeOnProperty)&&("string"==typeof o||null!==o.constructor&&o.constructor===String))return[{features:t,property:n.mergeOnProperty}];var o;const a=[],u={},l=[];for(let e=0;e<t.length;e++){t[e][i]=e;const o=t[e].properties=t[e].properties||{};o.$layer=t[e].layer,o.$type=t[e].type;const h=s?s(r,o):n.mergeOnProperty;or(h)?l.push(t[e]):(void 0===u[h]&&(u[h]=a.length,a.push({features:[],property:h})),a[u[h]].features.push(t[e]))}return l.length&&a.push({features:l}),a}(t,n,e,r);if(s.length){const n=[];for(let e=0;e<s.length;e++)n.push(s[e].property?Mu(s[e].features,s[e].property):t);if(1===n.length)return n[0];{let t=[];for(let e=0;e<n.length;e++)t=t.concat(n[e]);return t.sort(((t,n)=>t[i]-n[i])),t}}return[]}class ku extends Pa{static needMerge(t,n,e){if(!t)return!1;let r="line"===t.textPlacement||"line"===t.markerPlacement;return r||(n.textPlacementFn&&(r="line"===n.textPlacementFn(e)),n.markerPlacementFn&&(r="line"===n.markerPlacementFn(e))),t.mergeOnProperty&&r}static mergeLineFeatures(t,n,e,r){let i=n.textPlacement,s=n.markerPlacement;return e.textPlacementFn&&(i=e.textPlacementFn(r)),e.markerPlacementFn&&(s=e.markerPlacementFn(r)),"line"!==i&&"line"!==s?t:Fu(t,n,e,r)}static splitPointSymbol(t,n=0){const e=[];if(Array.isArray(t)){const n=t;for(let t=0;t<n.length;t++)n[t]&&e.push(...ku.splitPointSymbol(n[t],t));return e}let r=null,i=null;for(const n in t)0===n.indexOf("marker")?(r=r||{},r[n]=t[n]):0===n.indexOf("text")&&(i=i||{},i[n]=t[n]);return r&&(r.isIconText=!0,t.mergeOnProperty&&(r.mergeOnProperty=t.mergeOnProperty),e.push(r)),i&&(r&&(i.textPlacement=r.markerPlacement,i.textSpacing=r.markerSpacing,i.isIconText=!0),t.mergeOnProperty&&(i.mergeOnProperty=t.mergeOnProperty),e.push(i)),void 0!==t.visible&&(r&&(r.visible=t.visible),i&&(i.visible=t.visible)),r&&(r.markerTextFit&&i&&(r.text={},r.text.textName=i.textName,r.text.textSize=i.textSize),r.index={index:n,type:0}),i&&(i.index={index:n,type:1}),e}static isAtlasLoaded(t,n){const{icon:e,glyph:r}=t,{iconAtlas:i,glyphAtlas:s}=n;if(e&&(!i||!i.positions[e.url]))return!1;if(r){if(!s||!s.positions[r.font])return!1;const t=s.positions[r.font],{text:n}=r;for(const e of n)if(!t[e.codePointAt(0)])return!1}return!0}constructor(t,n,e){super(t,n,e),this.At=n.textPlacement,this.st.textPlacementFn&&(this.At=this.st.textPlacementFn(this.options.zoom))}createStyledVector(t,n,e,r,i,s){const o=new iu(t,this.symbolDef,n,e,r),a=o.getIconAndGlyph();if(a.icon&&!this.options.atlas){const{url:t,size:n}=a.icon;i[t]||(i[t]=a.icon.size),i[t][0]<n[0]&&(i[t][0]=n[0]),i[t][1]<n[1]&&(i[t][1]=n[1])}if(a.glyph&&!this.options.atlas){const{font:t,text:n}=a.glyph,e=s[t]=s[t]||{};for(const t of n)e[t.codePointAt(0)]=1;"line"===this.At&&(s.options={isCharsCompact:!1})}return this.options.allowEmptyPack||a.icon||a.glyph?o:null}getFormat(t){const n=void 0!==t.textName,e=n?this.getPackSDFFormat(t):this.getPackMarkerFormat();n?e.push(...this.Pt()):e.push(...this.St());const{markerOpacityFn:r,textOpacityFn:i,markerPitchAlignmentFn:s,textPitchAlignmentFn:o,markerRotationAlignmentFn:a,textRotationAlignmentFn:u,markerRotationFn:l,textRotationFn:h,markerAllowOverlapFn:c,textAllowOverlapFn:f,markerIgnorePlacementFn:d,textIgnorePlacementFn:p}=this.st;return(r||i)&&e.push({type:Uint8Array,width:1,name:"aColorOpacity"}),(s||o)&&e.push({type:Uint8Array,width:1,name:"aPitchAlign"}),(a||u)&&e.push({type:Uint8Array,width:1,name:"aRotationAlign"}),(l||h)&&e.push({type:Uint16Array,width:1,name:"aRotation"}),(c||f||d||p)&&e.push({type:Uint8Array,width:1,name:"aOverlap"}),e}_t(){return this.hasMapPitchAlign}Pt(){const{textFillFn:t,textSizeFn:n,textHaloFillFn:e,textHaloRadiusFn:r,textHaloOpacityFn:i,textDxFn:s,textDyFn:o}=this.st,a=[];return t&&a.push({type:Uint8Array,width:4,name:"aTextFill"}),n&&a.push({type:Uint8Array,width:1,name:"aTextSize"}),e&&a.push({type:Uint8Array,width:4,name:"aTextHaloFill"}),r&&a.push({type:Uint8Array,width:1,name:"aTextHaloRadius"}),i&&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}St(){const{markerWidthFn:t,markerHeightFn:n,markerDxFn:e,markerDyFn:r}=this.st,i=[];return t&&i.push({type:this.options.markerWidthType||Uint8Array,width:1,name:"aMarkerWidth"}),n&&i.push({type:this.options.markerHeightType||Uint8Array,width:1,name:"aMarkerHeight"}),e&&i.push({type:Int8Array,width:1,name:"aMarkerDx"}),r&&i.push({type:Int8Array,width:1,name:"aMarkerDy"}),i}createDataPack(){if(!this.iconAtlas&&!this.glyphAtlas){if(!this.options.allowEmptyPack)return null;this.empty=!0}this.countOutOfAngle=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 e=t.getShape(this.iconAtlas,this.glyphAtlas);if(!(this.options.allowEmptyPack||e&&e.image||e&&(e.horizontal||e.vertical)))return;const r=this.Ot(t,e,n);if(this.countOutOfAngle+=r.countOutOfAngle||0,0===r.length)return;const i=this.data,s=this.needAltitudeAttribute()?2:3;let o=this.data.aPosition.getLength()/s;const a=t.symbol,u=t.feature.properties,l="line"===this.At&&!a.isIconText,h=void 0!==a.textName,c=h&&l&&function(t){let n=0;for(let e=0;e<t.length;e++)if(Na(t.charAt(e).charCodeAt(0)))n=0;else if(n++,n>=1)return!1;return!0}(t.getIconAndGlyph().glyph.text)?1:0,{textFillFn:f,textSizeFn:d,textHaloFillFn:p,textHaloRadiusFn:m,textHaloOpacityFn:g,textDxFn:v,textDyFn:b,textPitchAlignmentFn:w,textRotationAlignmentFn:M,textRotationFn:x,textAllowOverlapFn:F,textIgnorePlacementFn:k,textOpacityFn:A,markerWidthFn:P,markerHeightFn:S,markerDxFn:_,markerDyFn:O,markerPitchAlignmentFn:C,markerRotationAlignmentFn:E,markerRotationFn:I,markerAllowOverlapFn:$,markerIgnorePlacementFn:T,markerOpacityFn:D}=this.st;let z,j,U,N,L,R,V,H,q,G,J,W,B,X,Y,K,Z;if(h){const n=t.getIconAndGlyph().glyph.font;z=function(t,n,e){const r=t.positionedGlyphs,i=[];for(let s=0;s<r.length;s++){const o=r[s],a=e[o.glyph];if(!a)continue;const u=a.rect;if(!u)continue;const l=4,h=a.metrics.advance/2,c=a.metrics.height/2,f=n?[o.x+h,0]:[0,0],d=n?[0,o.y-c]:[o.x+h,o.y-c],p=a.metrics.left-l-h+d[0],y=a.metrics.top-l+d[1],m=p+u.w,g=y+u.h,v=new dt(p,y),b=new dt(m,y),w=new dt(p,g),M=new dt(m,g);if(n&&o.vertical){const t=new dt(-h,h),n=-Math.PI/2,e=new dt(5,0);v.C(n,t).F(e),b.C(n,t).F(e),w.C(n,t).F(e),M.C(n,t).F(e)}i.push({tl:v,tr:b,bl:w,br:M,tex:u,writingMode:t.writingMode,glyphOffset:f})}return i}(e.horizontal,l,this.glyphAtlas.positions[n]),f&&(j=f(null,u),y(j)?(this.dynamicAttrs.aTextFill=1,j=[0,0,0,0]):j=Ir([],j)),d&&(U=d(this.options.zoom,u),or(U)&&(U=14)),p&&(N=p(null,u),y(N)?(this.dynamicAttrs.aTextHaloFill=1,N=[0,0,0,0]):N=Ir([],N)),m&&(L=m(null,u)),g&&(R=255*g(null,u)),v&&(V=v(null,u)||0),b&&(H=b(null,u)||0),w&&(B=+("map"===w(null,u))),M&&(X=+("map"===M(null,u))),x&&(Y=ar(x(null,u),0,360)*Math.PI/180)}else z=e?function(t){const n=t.image,e=t.top-1/n.pixelRatio,r=t.left-1/n.pixelRatio,i=t.bottom+1/n.pixelRatio,s=t.right+1/n.pixelRatio;let o,a,u,l;return o=new dt(r,e),a=new dt(s,e),u=new dt(s,i),l=new dt(r,i),[{tl:o,tr:a,bl:l,br:u,tex:{x:n.tl[0],y:n.tl[1],w:n.displaySize[0],h:n.displaySize[1]},writingMode:void 0,glyphOffset:[0,0]}]}(e):function(){const t=new dt(0,0),n=new dt(0,0),e=new dt(0,0);return[{tl:t,tr:n,bl:new dt(0,0),br:e,tex:{x:0,y:0,w:0,h:0},writingMode:void 0,glyphOffset:[0,0]}]}(),P&&(q=P(null,u)),or(q)&&(q=z[0].tex.w),S&&(G=S(null,u)),or(G)&&(G=z[0].tex.h),_&&(J=_(null,u)),O&&(W=O(null,u)),C&&(B=+("map"===C(null,u))),E&&(X=+("map"===E(null,u))),I&&(Y=ar(I(null,u),0,360)*Math.PI/180);y(U)&&(this.dynamicAttrs.aTextSize=1),y(L)&&(this.dynamicAttrs.aTextHaloRadius=1),y(R)&&(this.dynamicAttrs.aTextHaloOpacity=1),y(V)&&(this.dynamicAttrs.aTextDx=1),y(H)&&(this.dynamicAttrs.aTextDy=1),y(q)&&(this.dynamicAttrs.aMarkerWidth=1),y(G)&&(this.dynamicAttrs.aMarkerHeight=1),y(J)&&(this.dynamicAttrs.aMarkerDx=1),y(W)&&(this.dynamicAttrs.aMarkerDy=1),y(B)&&(this.dynamicAttrs.aPitchAlign=1),y(X)&&(this.dynamicAttrs.aRotationAlign=1),y(Y)&&(this.dynamicAttrs.aRotation=1);const Q=$||F;Q&&(K=Q(null,u)||0);const tt=T||k;let nt;tt&&(Z=tt(null,u)||0);const et=A||D;et&&(nt=255*et(this.options.zoom,u));const rt=z.length;this.ensureDataCapacity(4*rt,r.length);const it=this.options.EXTENT,{altitudeScale:st,altitudeProperty:ot,defaultAltitude:at}=this.options,{altitude:ut}=ir(t.feature,st,ot,at);for(let t=0;t<r.length;t++){const n=r[t],e=n.z||ut||0;if(it!==1/0&&sr(n,it))continue;const s=n.x,a=n.y,u=z.length;for(let t=0;t<u;t++){const r=z[t],{tl:u,tr:f,bl:d,br:p,tex:y}=r;this.Ct(i,s,a,e,10*u.x,10*u.y,y.x,y.y+y.h),h&&this.Et(i,l,rt,r.glyphOffset,n,c,n.axis,n.angleR),this.It(i,j,U,N,L,R,V,H,q,G,J,W,nt,B,X,Y,K,Z),this.Ct(i,s,a,e,10*f.x,10*f.y,y.x+y.w,y.y+y.h),h&&this.Et(i,l,rt,r.glyphOffset,n,c,n.axis,n.angleR),this.It(i,j,U,N,L,R,V,H,q,G,J,W,nt,B,X,Y,K,Z),this.Ct(i,s,a,e,10*d.x,10*d.y,y.x,y.y),h&&this.Et(i,l,rt,r.glyphOffset,n,c,n.axis,n.angleR),this.It(i,j,U,N,L,R,V,H,q,G,J,W,nt,B,X,Y,K,Z),this.Ct(i,s,a,e,10*p.x,10*p.y,y.x+y.w,y.y),h&&this.Et(i,l,rt,r.glyphOffset,n,c,n.axis,n.angleR),this.It(i,j,U,N,L,R,V,H,q,G,J,W,nt,B,X,Y,K,Z),this.addElements(o,o+1,o+2),this.addElements(o+1,o+2,o+3),o+=4;const m=Math.max(Math.abs(s),Math.abs(a),Math.abs(e));m>this.maxPos&&(this.maxPos=m)}}}Ct(t,n,e,r,i,s,o,a){this.fillPosition(t,n,e,r);let u=t.aShape.currentIndex;t.aShape[u++]=i,t.aShape[u++]=s,t.aShape.currentIndex=u,u=t.aTexCoord.currentIndex,t.aTexCoord[u++]=o,t.aTexCoord[u++]=a,t.aTexCoord.currentIndex=u}Et(t,n,e,r,i,s,o,a){let u=t.aCount.currentIndex;if(t.aCount[u++]=e,t.aCount.currentIndex=u,n){u=t.aGlyphOffset.currentIndex,t.aGlyphOffset[u++]=r[0],t.aGlyphOffset[u++]=r[1],t.aGlyphOffset.currentIndex=u,this._t()&&(u=t.aPitchRotation.currentIndex,t.aPitchRotation[u++]=o[0],t.aPitchRotation[u++]=o[1],t.aPitchRotation[u++]=a,t.aPitchRotation.currentIndex=u);const n=i.startIndex;u=t.aSegment.currentIndex,t.aSegment[u++]=i.segment+n,t.aSegment[u++]=n,t.aSegment[u++]=i.line.length,t.aSegment.currentIndex=u,u=t.aVertical.currentIndex,t.aVertical[u++]=s,t.aVertical.currentIndex=u}}It(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p,y,m,g){const{textFillFn:v,textSizeFn:b,textHaloFillFn:w,textHaloRadiusFn:M,textHaloOpacityFn:x,textDxFn:F,textDyFn:k,textPitchAlignmentFn:A,textRotationAlignmentFn:P,textRotationFn:S,textAllowOverlapFn:_,textIgnorePlacementFn:O,textOpacityFn:C,markerWidthFn:E,markerHeightFn:I,markerDxFn:$,markerDyFn:T,markerPitchAlignmentFn:D,markerRotationAlignmentFn:z,markerRotationFn:j,markerAllowOverlapFn:U,markerIgnorePlacementFn:N,markerOpacityFn:L}=this.st;if(v){let e=t.aTextFill.currentIndex;t.aTextFill[e++]=n[0],t.aTextFill[e++]=n[1],t.aTextFill[e++]=n[2],t.aTextFill[e++]=n[3],t.aTextFill.currentIndex=e}if(b){let n=t.aTextSize.currentIndex;t.aTextSize[n++]=e,t.aTextSize.currentIndex=n}if(w){let n=t.aTextHaloFill.currentIndex;t.aTextHaloFill[n++]=r[0],t.aTextHaloFill[n++]=r[1],t.aTextHaloFill[n++]=r[2],t.aTextHaloFill[n++]=r[3],t.aTextHaloFill.currentIndex=n}if(M){let n=t.aTextHaloRadius.currentIndex;t.aTextHaloRadius[n++]=i,t.aTextHaloRadius.currentIndex=n}if(x){let n=t.aTextHaloOpacity.currentIndex;t.aTextHaloOpacity[n++]=s,t.aTextHaloOpacity.currentIndex=n}if(F){let n=t.aTextDx.currentIndex;t.aTextDx[n++]=o,t.aTextDx.currentIndex=n}if(k){let n=t.aTextDy.currentIndex;t.aTextDy[n++]=a,t.aTextDy.currentIndex=n}if(E){let n=t.aMarkerWidth.currentIndex;t.aMarkerWidth[n++]=u,t.aMarkerWidth.currentIndex=n}if(I){let n=t.aMarkerHeight.currentIndex;t.aMarkerHeight[n++]=l,t.aMarkerHeight.currentIndex=n}if($){let n=t.aMarkerDx.currentIndex;t.aMarkerDx[n++]=h,t.aMarkerDx.currentIndex=n}if(T){let n=t.aMarkerDy.currentIndex;t.aMarkerDy[n++]=c,t.aMarkerDy.currentIndex=n}if(L||C){let n=t.aColorOpacity.currentIndex;t.aColorOpacity[n++]=f,t.aColorOpacity.currentIndex=n}if(A||D){let n=t.aPitchAlign.currentIndex;t.aPitchAlign[n++]=d,t.aPitchAlign.currentIndex=n}if(z||P){let n=t.aRotationAlign.currentIndex;t.aRotationAlign[n++]=p,t.aRotationAlign.currentIndex=n}if(j||S){let n=t.aRotation.currentIndex;t.aRotation[n++]=9362*y,t.aRotation.currentIndex=n}const R=U||_,V=N||O;if(R||V){let n=t.aOverlap.currentIndex;t.aOverlap[n++]=(R?8:0)+4*m+((V?2:0)+g),t.aOverlap.currentIndex=n}i>0&&(this.properties.hasHalo=1)}Ot(t,n,e){const{feature:r,symbol:i}=t,s=this.$t(t,i),o=r.properties,{markerSpacingFn:a,textSpacingFn:u,textMaxAngleFn:l}=this.st,h=((a?a(null,o):i.markerSpacing)||(u?u(null,o):i.textSpacing)||250)*e;let c=l?l(this.options.zoom,o):i.textMaxAngle;or(c)&&(c=80),c*=Math.PI/180;const f=this.options.EXTENT,d=this.options.altitudeToTileScale,p=this._t();return vu(t,this.lineVertex,c,n,e,f,s,h,p,d)}$t(t,n){let e;return e=this.st.markerPlacementFn?this.st.markerPlacementFn(this.options.zoom,t.feature.properties):n.markerPlacement||this.At,this.vt||!n.markerPlacement&&!n.isIconText||(this.vt=e),!this.At||n.isIconText||this.bt||(this.bt=e),e}getPackSDFFormat(t){if("line"!==this.At||t.isIconText)return[...this.getPositionFormat(),{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"},{type:Uint8Array,width:1,name:"aCount"}];{const t=[...this.getPositionFormat(),{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"}];return this._t()&&t.push({type:Float32Array,width:3,name:"aPitchRotation"}),t}}getPackMarkerFormat(){return[...this.getPositionFormat(),{type:Int16Array,width:2,name:"aShape"},{type:Uint16Array,width:2,name:"aTexCoord"}]}}class Au{constructor(t){this.x=t.x,this.y=t.y,this.z=t.z||0}clone(){return new Au(this)}T(){return this._(this.mag()),this}_(t){return this.x/=t,this.y/=t,this.z/=t,this}D(){var t=this.y;return this.y=this.x,this.x=-t,this}mag(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}add(t){return this.clone().F(t)}sub(t){return this.clone().k(t)}F(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}k(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}equals(t){return this.x===t.x&&this.y===t.y&&this.z===t.z}mult(t){return this.clone().S(t)}S(t){return this.x*=t,this.y*=t,this.z*=t,this}dist(t){return Math.sqrt(this.distSqr(t))}distSqr(t){var n=t.x-this.x,e=t.y-this.y,r=t.z-this.z;return n*n+e*e+r*r}j(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)}}const Pu=63,Su=Math.cos(Math.PI/180*37.5),_u=Math.pow(2,16)/1,Ou=new dt,Cu=new dt,Eu=new dt;class Iu extends Pa{static mergeLineFeatures(t,n,e,r){return Fu(t,n,e,r)}constructor(t,n,e){super(t,n,e);let r=!1;const{lineDasharrayFn:i,lineDashColorFn:s}=this.st;this.hasGradient=this.symbol.lineGradientProperty,i&&(r=function(t,n,e){for(let r=0;r<t.length;r++)if(e(n,t[r].properties))return!0;return!1}(t,this.options.zoom,i),r&&(this.dasharrayFn=i)),this.hasDasharray=Du(this.symbol.lineDasharray)||r,this.hasDasharray&&s&&(this.dashColorFn=s)}createStyledVector(t,n,e,r,i){const s=new zr(t,n,e,r),o=s.getLineResource();return!this.options.atlas&&o&&(i[o]=[0,0]),s}getFormat(){const{lineWidthFn:t,lineStrokeWidthFn:n,lineStrokeColorFn:e,lineColorFn:r,lineOpacityFn:i,lineDxFn:s,lineDyFn:o,linePatternAnimSpeedFn:a,linePatternGapFn:u}=this.st,l=[...this.getPositionFormat()];if(l.push(this.iconAtlas||this.hasDasharray?{type:Int8Array,width:3,name:"aExtrude"}:{type:Int8Array,width:2,name:"aExtrude"}),l.push({type:this.options.positionType||Uint16Array,width:1,name:"aLinesofar"}),t&&l.push({type:Uint8Array,width:1,name:"aLineWidth"}),n&&l.push({type:Uint8Array,width:1,name:"aLineStrokeWidth"}),r&&l.push({type:Uint8Array,width:4,name:"aColor"}),e&&l.push({type:Uint8Array,width:4,name:"aStrokeColor"}),i&&l.push({type:Uint8Array,width:1,name:"aOpacity"}),this.dasharrayFn&&l.push({type:Uint8Array,width:4,name:"aDasharray"}),this.dashColorFn&&l.push({type:Uint8Array,width:4,name:"aDashColor"}),this.iconAtlas){const t=this.getIconAtlasMaxValue();l.push({type:t>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return(s||o)&&l.push({type:Int8Array,width:2,name:"aLineDxDy"}),(a||u)&&l.push({type:Int8Array,width:2,name:"aLinePattern"}),l}placeVector(t){const{lineJoinFn:n,lineCapFn:e,lineWidthFn:r,lineHeightFn:i,lineStrokeWidthFn:s,lineStrokeColorFn:o,lineColorFn:a,lineOpacityFn:u,lineDxFn:l,lineDyFn:h,linePatternAnimSpeedFn:c,linePatternGapFn:f}=this.st,d=this.symbol,p=t.feature,m=p.properties;let g=d.lineJoin||"miter",v=d.lineCap||"butt";if(n&&(g=n(this.options.zoom,m)||"miter"),e&&(v=e(this.options.zoom,m)||"butt"),r){let t=r(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineWidth=1,t=4),wr(t)&&(t=4),this.feaLineWidth=+t}else this.feaLineWidth=+d.lineWidth;if(i){let t=i(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineHeight=1),wr(t)&&(t=this.feaLineWidth),this.feaLineHeight=+t}else this.feaLineHeight=+d.lineHeight||this.feaLineWidth;if(s){let t=s(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineStrokeWidth=1,t=0),wr(t)&&(t=0),this.feaLineStrokeWidth=t}else this.feaLineStrokeWidth=d.lineStrokeWidth||0;if(a&&(this.feaColor=a(this.options.zoom,m)||[255,255,255,255],y(this.feaColor)?(this.dynamicAttrs.aColor=1,this.feaColor=[0,0,0,0]):this.feaColor=Ir([],this.feaColor)),o&&(this.feaStrokeColor=o(this.options.zoom,m)||[0,0,0,255],y(this.feaStrokeColor)?(this.dynamicAttrs.aStrokeColor=1,this.feaStrokeColor=[0,0,0,0]):this.feaStrokeColor=Ir([],this.feaStrokeColor)),u){let t=u(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aOpacity=1,t=1),wr(t)&&(t=1),this.feaOpacity=255*t}if(this.dasharrayFn){let t=this.dasharrayFn(this.options.zoom,m)||[0,0,0,0];if(y(t)&&(this.dynamicAttrs.aDasharray=1,t=[0,0,0,0]),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,m):this.symbol.lineDashColor)||[0,0,0,0];y(t)&&(this.dynamicAttrs.aDashColor=1,t=[0,0,0,0]),t=Ir([],t),this.feaDashColor=t}if(this.iconAtlas){const n=t.getLineResource(),e=this.iconAtlas.glyphMap[n];if(this.feaTexInfo=this.feaTexInfo||[0,0,0,0],e){const{tl:t,displaySize:e}=this.iconAtlas.positions[n];this.feaTexInfo[0]=t[0]+1,this.feaTexInfo[1]=t[1]+1,this.feaTexInfo[2]=e[0]-3,this.feaTexInfo[3]=e[1]-3}else this.feaTexInfo[0]=this.feaTexInfo[1]=this.feaTexInfo[2]=this.feaTexInfo[3]=0}if(l){let t=l(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineDxDy=1,t=0),wr(t)&&(t=0),this.feaLineDx=t}if(h){let t=h(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLineDxDy=1,t=0),wr(t)&&(t=0),this.feaLineDy=t}if(c){let t=c(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLinePatternAnimSpeed=1,t=0),wr(t)&&(t=0),0!==t&&(this.properties.hasPatternAnim=1),this.feaPatternAnimSpeed=t}if(f){let t=f(this.options.zoom,m);y(t)&&(this.dynamicAttrs.aLinePatternGap=1,t=0),wr(t)&&(t=0),this.feaLinePatternGap=t}const b=this.options.EXTENT;let w=p.geometry;if(b!==1/0){w=[];const t=[];for(let n=0;n<p.geometry.length;n++){t[0]=p.geometry[n];const e=ou(t,-1,-1,b+1,b+1);if(3===p.type&&e.length>1){const t=e[0],n=e[e.length-1];Uu(t[0],n[n.length-1])&&(e[0]=n.concat(t.slice(1)),e.length=e.length-1)}w.push(...e)}}const M=this.needAltitudeAttribute()?2:3;for(let t=0;t<w.length;t++)this.offset=this.data.aPosition.getLength()/M,this.Tt(w[t],p,g,v,2,1.05)}Dt(){return this.iconAtlas&&this.feaTexInfo[2]&&this.feaTexInfo[3]}Tt(t,n,e,r,i,s){const o=this.Dt()||Du(this.feaDash)||Du(this.symbol.lineDasharray),a=this.options.isTube;a&&(t=t.map((t=>new Au(t)))),this.overscaling=1;const u=this.options.EXTENT;if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.prevVertex=null,this.symbol.lineGradientProperty&&n.properties&&Mr(n.properties.mapbox_clip_start)&&Mr(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 l=3===n.type&&!t.clipped;let h=t.length;for(;h>=2&&Uu(t[h-1],t[h-2]);)h--;let c=0;for(;c<h-1&&Uu(t[c],t[c+1]);)c++;if(h<(l?3:2))return;"bevel"===e&&(i=1.05);const f=this.overscaling<=16?15*u/(512*this.overscaling):0,d={vertexLength:0,primitiveLength:0,currentNormal:null};let p,y,m,g,v;this.e1=this.e2=-1,l&&(p=t[h-2],v=t[c].sub(p).T().D()),this.ensureDataCapacity(e,h,360,2);for(let n=c;n<h;n++){if(m=n===h-1?l?t[c+1]:void 0:t[n+1],m&&Uu(t[n],m))continue;v&&(g=v),p&&(y=p),p=t[n],m&&p.x===m.x&&p.y===m.y&&(p.x+=1e-4),v=m?m.sub(p).T().D():g,d.dir=y?p.sub(y).T():m.sub(p).T(),g=g||v,d.currentNormal=g;let u=g.add(v);0===u.x&&0===u.y||u.T();const b=g.x*v.x+g.y*v.y,w=u.x*v.x+u.y*v.y,M=0!==w?1/w:1/0,x=2*Math.sqrt(2-2*w),F=w<Su&&y&&m,k=g.x*v.y-g.y*v.x>0;if(!a&&F&&n>c){const t=p.dist(y);if(t>2*f){const n=p.sub(p.sub(y).S(f/t).j());n.z=p.z,this.updateDistance(y,n),this.addCurrentVertex(n,g,0,0,d),y=n}}const A=y&&m;d.middleVertex=A;let P=A?e:l?"butt":r;if(A&&"round"===P&&(M<s?P="miter":M<=2&&(P="fakeround")),"miter"===P&&M>i&&!a&&(P="bevel"),"bevel"===P&&(M>2&&(P="flipbevel"),M<i&&(P="miter")),y&&this.updateDistance(y,p),"miter"===P)a?(this.addCurrentVertex(p,g,0,0,d),d.dir=m.sub(p).T(),this.addCurrentVertex(p,v,0,0,d)):(u.S(M),this.addCurrentVertex(p,u,0,0,d),o&&(d.currentNormal=v,this.addCurrentVertex(p,u,0,0,d)));else if("flipbevel"===P){if(M>100)u=v.mult(-1);else{const t=M*g.add(v).mag()/g.sub(v).mag();u.D().S(t*(k?-1:1))}this.addCurrentVertex(p,u,0,0,d),this.addCurrentVertex(p,u.mult(-1),0,0,d)}else if("bevel"===P||"fakeround"===P){const t=-Math.sqrt(M*M-1),n=k?t:0,e=k?0:t;if(y&&this.addCurrentVertex(p,g,n,e,d),"fakeround"===P){const t=Math.round(180*x/Math.PI/20);for(let n=1;n<t;n++){let e=n/t;if(.5!==e){const t=e-.5;e+=e*t*(e-1)*((1.0904+b*(b*(3.55645-1.43519*b)-3.2452))*t*t+(.848013+b*(.215638*b-1.06021)))}const r=v.sub(g).S(e).F(g).T().S(k?-1:1);this.addHalfVertex(p,r.x,r.y,!1,k,0,d)}}m&&(d.currentNormal=v,this.addCurrentVertex(p,v,-n,-e,d))}else if("butt"===P)this.addCurrentVertex(p,u,0,0,d);else if("square"===P){const t=y?1:-1;this.addCurrentVertex(p,u,t,t,d)}else"round"===P&&(y&&(this.addCurrentVertex(p,g,0,0,d),this.addCurrentVertex(p,g,1,1,d,!0)),m&&(this.addCurrentVertex(p,v,-1,-1,d,!0),this.addCurrentVertex(p,v,0,0,d)));if(!a&&F&&n<h-1){const t=p.dist(m);if(t>2*f){const n=p.add(m.sub(p).S(f/t).j());n.z=p.z,this.updateDistance(p,n),this.addCurrentVertex(n,v,0,0,d),p=n}}}}ensureDataCapacity(t,n,e,r){const i="round"===t?Math.round(e/20)-1:0;super.ensureDataCapacity((6+i)*r,n)}addCurrentVertex(t,n,e,r,i,s=!1){const o=n.x+n.y*e,a=n.y-n.x*e,u=n.y*r-n.x,l=-n.y-n.x*r;let h=0,c=0;if(i.middleVertex){Ou.x=o,Ou.y=a,Cu.x=u,Cu.y=l;const t=i.currentNormal;if(h=ju(t,Ou),0===e&&0===r)c=-h;else{const n=Eu;n.x=t.x,n.y=t.y,n.S(-1),c=ju(n,Cu)}}this.addHalfVertex(t,o,a,s,!1,e,i,h),this.addHalfVertex(t,u,l,s,!0,-r,i,c),this.prevVertex&&Uu(t,this.prevVertex)||(this.prevVertex=t),this.distance>_u/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,n,e,r,i,s))}addHalfVertex({x:t,y:n,z:e},r,i,s,o,a,u,l){this.fillData(this.data,t,n,e||0,r,i,s,o,1*this.scaledDistance,l);const h=u.vertexLength++;this.e1>=0&&this.e2>=0&&(this.addElements(this.e1,this.e2,h),u.primitiveLength++),o?this.e2=h:this.e1=h}fillData(t,n,e,r,i,s,o,a,u,l){const{lineWidthFn:h,lineStrokeWidthFn:c,lineStrokeColorFn:f,lineColorFn:d,lineOpacityFn:p,lineDxFn:y,lineDyFn:m,linePatternAnimSpeedFn:g,linePatternGapFn:v}=this.st;this.fillPosition(t,n,e,r);let b=Pu*i;b=(Math.sign(b)||1)*((Math.floor(Math.abs(b))>>1<<1)+ +o);let w=Pu*s;w=(Math.sign(w)||1)*((Math.floor(Math.abs(w))>>1<<1)+ +a);let M=t.aExtrude.currentIndex;t.aExtrude[M++]=b,t.aExtrude[M++]=w,(this.iconAtlas||this.hasDasharray)&&(t.aExtrude[M++]=Pu*l),t.aExtrude.currentIndex=M,M=t.aLinesofar.currentIndex,t.aLinesofar[M++]=u,t.aLinesofar.currentIndex=M,h&&(M=t.aLineWidth.currentIndex,t.aLineWidth[M++]=Math.round(2*this.feaLineWidth),t.aLineWidth.currentIndex=M),c&&(M=t.aLineStrokeWidth.currentIndex,t.aLineStrokeWidth[M++]=Math.round(2*this.feaLineStrokeWidth),t.aLineStrokeWidth.currentIndex=M),d&&(M=t.aColor.currentIndex,t.aColor[M++]=this.feaColor[0],t.aColor[M++]=this.feaColor[1],t.aColor[M++]=this.feaColor[2],t.aColor[M++]=this.feaColor[3],t.aColor.currentIndex=M),f&&(M=t.aStrokeColor.currentIndex,t.aStrokeColor[M++]=this.feaStrokeColor[0],t.aStrokeColor[M++]=this.feaStrokeColor[1],t.aStrokeColor[M++]=this.feaStrokeColor[2],t.aStrokeColor[M++]=this.feaStrokeColor[3],t.aStrokeColor.currentIndex=M),p&&(M=t.aOpacity.currentIndex,t.aOpacity[M++]=this.feaOpacity,t.aOpacity.currentIndex=M),this.dasharrayFn&&(M=t.aDasharray.currentIndex,t.aDasharray[M++]=this.feaDash[0],t.aDasharray[M++]=this.feaDash[1],t.aDasharray[M++]=this.feaDash[2],t.aDasharray[M++]=this.feaDash[3],t.aDasharray.currentIndex=M),this.dashColorFn&&(M=t.aDashColor.currentIndex,t.aDashColor[M++]=this.feaDashColor[0],t.aDashColor[M++]=this.feaDashColor[1],t.aDashColor[M++]=this.feaDashColor[2],t.aDashColor[M++]=this.feaDashColor[3],t.aDashColor.currentIndex=M),this.iconAtlas&&(M=t.aTexInfo.currentIndex,t.aTexInfo[M++]=this.feaTexInfo[0],t.aTexInfo[M++]=this.feaTexInfo[1],t.aTexInfo[M++]=this.feaTexInfo[2],t.aTexInfo[M++]=this.feaTexInfo[3],t.aTexInfo.currentIndex=M),(y||m)&&(M=t.aLineDxDy.currentIndex,t.aLineDxDy[M++]=this.feaLineDx||0,t.aLineDxDy[M++]=this.feaLineDy||0,t.aLineDxDy.currentIndex=M),(g||v)&&(M=t.aLinePattern.currentIndex,t.aLinePattern[M++]=127*(this.feaPatternAnimSpeed||0),t.aLinePattern[M++]=10*(this.feaLinePatternGap||0),t.aLinePattern.currentIndex=M),this.maxPos=Math.max(this.maxPos,Math.abs(n)+1,Math.abs(e)+1)}addElements(t,n,e){super.addElements(this.offset+t,this.offset+n,this.offset+e)}zt(t){const n=this.options.EXTENT,e=this.elements;for(let r=0;r<e.length;r+=3)if(n===1/0||!Tu(this.data.aPosition,e[r],e[r+1],3,n)&&!Tu(this.data.aPosition,e[r+1],e[r+2],3,n)){let n=t.currentIndex;t[n++]=e[r],t[n++]=e[r+1],t[n++]=e[r+2],t.currentIndex=n}}jt(t){if(t.length<=1)return t;const n=[],e=this.options.EXTENT;let r,i=!0;for(r=0;r<t.length-1;r++){const s=$u(t[r],t[r+1],e);s&&i||(n.push(t[r]),i=s)}return i||n.push(t[r]),n}updateDistance(t,n){if(this.options.isTube){const e=t.dist(n),r=Or(this.options)*(n.z-t.z);this.distance+=Math.sqrt(e*e+r*r)}else this.distance+=t.dist(n);this.updateScaledDistance()}updateScaledDistance(){this.scaledDistance=this.totalDistance>0?(this.clipStart+(this.clipEnd-this.clipStart)*this.distance/this.totalDistance)*(_u-1):this.distance}}function $u(t,n,e){return e!==1/0&&(t.x<0&&n.x<0||t.x>e&&n.x>e||t.y<0&&n.y<0||t.y>e&&n.y>e)}function Tu(t,n,e,r,i){if(i===1/0)return!1;const s=Math.floor(.5*t[n*r]),o=Math.floor(.5*t[n*r+1]),a=Math.floor(.5*t[e*r]),u=Math.floor(.5*t[e*r+1]);return s===a&&(s<0||s>i)&&o!==u||o===u&&(o<0||o>i)&&s!==a}function Du(t){if(!Array.isArray(t))return!1;for(let n=0;n<t.length;n++)if(t[n])return!0;return!1}const zu=new dt(0,0);function ju(t,n){const e=t.mag(),r=n.mag(),i=t.angleTo(zu),s=n.angleTo(zu);return Math.sign(s-i)*Math.sqrt(r*r-e*e)}function Uu(t,n){return t.equals(n)&&t.z===n.z}class Nu extends Iu{constructor(t,n,e){super(t,n,e),this.Ut=e.altitudeProperty}getFormat(){const{lineColorFn:t,lineWidthFn:n}=this.st,e=[{type:this.maxPosZ>=Math.pow(2,15)?Float32Array: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&&e.push({type:Uint8Array,width:4,name:"aColor"}),n&&e.push({type:Uint8Array,width:1,name:"aLineWidth"}),this.Ut&&e.push({type:Float32Array,width:1,name:"aLineHeight"}),e}placeVector(t){const n=t.feature;if(this.Ut){const{altitudeScale:t,altitudeProperty:e,defaultAltitude:r,heightProperty:i,defaultHeight:s,minHeightProperty:o}=this.options,{altitude:a,height:u}=ir(n,t,e,r,i,s,o);this.feaAltitude=a,this.feaMinHeight=(a-u)/a*32767,a>this.maxAltitude&&(this.maxAltitude=a)}return super.placeVector(t)}needAltitudeAttribute(){return!1}Tt(t,n,e,r,i,s){const o=this.data.aPosition.getLength()/3;super.Tt(t,n,e,r,i,s);const a=this.data.aPosition.getLength()/3,u=this.data.aPosition.getLength()/3-this.offset;if(3!==n.type&&u>0&&!1!==this.options.side){const t=!1!==this.options.top?1:0,n=t+4;let e=this.data.aPosition.getLength()/3;for(const t in this.data){const n=this.data[t],r=n.getLength()/e;let i=n.currentIndex;for(let t=0;t<r;t++)n[i++]=n[o*r+3*r+t];n.currentIndex=i}e=this.data.aPosition.getLength()/3;for(const t in this.data){const r=this.data[t],i=r.getLength()/e;let s=r.currentIndex;for(let t=0;t<i;t++)r[s++]=r[o*i+i*n+t];r.currentIndex=s}e=this.data.aPosition.getLength()/3;for(const t in this.data){const r=this.data[t],i=r.getLength()/e;let s=r.currentIndex;for(let t=0;t<i;t++)r[s++]=r[o*i+i*(n+3)+t];r.currentIndex=s}super.addElements(t+1,u+1,u),super.addElements(u,u+1,u+2);const r=this.data.aPosition.getLength()/3-this.offset;e=this.data.aPosition.getLength()/3;for(const t in this.data){const n=this.data[t],r=n.getLength()/e;let i=n.currentIndex;for(let t=0;t<r;t++)n[i++]=n[a*r-r+t];n.currentIndex=i}e=this.data.aPosition.getLength()/3;for(const t in this.data){const r=this.data[t],i=r.getLength()/e;let s=r.currentIndex;for(let t=0;t<i;t++)r[s++]=r[a*i-n*i-i+t];r.currentIndex=s}e=this.data.aPosition.getLength()/3;for(const t in this.data){const r=this.data[t],i=r.getLength()/e;let s=r.currentIndex;for(let t=0;t<i;t++)r[s++]=r[a*i-n*i-3*i+t];r.currentIndex=s}super.addElements(r,u-3,r+1),super.addElements(u-3,r+2,r+1)}}fillData(t,n,e,r,i,s,o,a,u){const l=!1!==this.options.top,h=!1!==this.options.side,c=this.feaLineWidth||this.symbol.lineWidth/2*(this.options.EXTENT/this.options.tileSize),f=Pu*i,d=Pu*s,p=c*i+n,y=c*s+e;this.Nt(t,n,e,i,s,o,a,u,p,y,f,d),h&&(l&&this.Nt(t,n,e,i,s,o,a,u,p,y,f,d),this.Nt(t,n,e,i,s,o,a,u,p,y,f,d),this.Lt(t,n,e,i,s,o,a,u,p,y,f,d),this.Lt(t,n,e,i,s,o,a,u,p,y,f,d)),this.maxPos=Math.max(this.maxPos,Math.abs(n),Math.abs(e))}Nt(t,n,e,r,i,s,o,a,u,l,h,c){const{lineColorFn:f,lineWidthFn:d}=this.st;let p=t.aPosition.currentIndex;t.aPosition[p++]=n,t.aPosition[p++]=e,t.aPosition[p++]=32767,t.aPosition.currentIndex=p,p=t.aLinesofar.currentIndex,t.aLinesofar[p++]=a,t.aLinesofar.currentIndex=p,p=t.aUp.currentIndex,t.aUp[p++]=+o,t.aUp.currentIndex=p,p=t.aExtrudedPosition.currentIndex,t.aExtrudedPosition[p++]=u,t.aExtrudedPosition[p++]=l,t.aExtrudedPosition[p++]=1,t.aExtrudedPosition.currentIndex=p,p=t.aExtrude.currentIndex,t.aExtrude[p++]=h,t.aExtrude[p++]=c,t.aExtrude.push(h,c),f&&(p=t.aColor.currentIndex,t.aColor[p++]=this.feaColor[0],t.aColor[p++]=this.feaColor[1],t.aColor[p++]=this.feaColor[2],t.aColor[p++]=this.feaColor[3],t.aColor.currentIndex=p),d&&(p=t.aLineWidth.currentIndex,t.aLineWidth[p++]=Math.round(2*this.feaLineWidth),t.aLineWidth.currentIndex=p),this.Ut&&(p=t.aLineHeight.currentIndex,t.aLineHeight[p++]=this.feaAltitude,t.aLineHeight.currentIndex=p)}Lt(t,n,e,r,i,s,o,a,u,l,h,c){const{lineColorFn:f,lineWidthFn:d}=this.st;let p=t.aPosition.currentIndex;t.aPosition[p++]=n,t.aPosition[p++]=e,t.aPosition[p++]=this.feaMinHeight||0,t.aPosition.currentIndex=p,p=t.aLinesofar.currentIndex,t.aLinesofar[p++]=a,t.aLinesofar.currentIndex=p,p=t.aUp.currentIndex,t.aUp[p++]=+o,t.aUp.currentIndex=p,p=t.aExtrudedPosition.currentIndex,t.aExtrudedPosition[p++]=u,t.aExtrudedPosition[p++]=l,t.aExtrudedPosition[p++]=1,t.aExtrudedPosition.currentIndex=p,p=t.aExtrude.currentIndex,t.aExtrude[p++]=h,t.aExtrude[p++]=c,t.aExtrude.push(h,c),f&&(p=t.aColor.currentIndex,t.aColor[p++]=this.feaColor[0],t.aColor[p++]=this.feaColor[1],t.aColor[p++]=this.feaColor[2],t.aColor[p++]=this.feaColor[3],t.aColor.currentIndex=p),d&&(p=t.aLineWidth.currentIndex,t.aLineWidth[p++]=Math.round(2*this.feaLineWidth),t.aLineWidth.currentIndex=p),this.Ut&&(p=t.aLineHeight.currentIndex,t.aLineHeight[p++]=this.feaAltitude,t.aLineHeight.currentIndex=p)}addElements(t,n,e){const r=!1!==this.options.top,i=!1!==this.options.side,s=(r?1:0)+(i?4:0);if(t*=s,n*=s,this.data.aUp[this.offset+(e*=s)+4]){if(r&&super.addElements(n,t,e),i){const t=r?1:0;super.addElements(n+t,e+t,e+t+2),super.addElements(n+t+1,e+t+1+2,n+t+1+2)}}else if(r&&super.addElements(t,e,n),i){const n=r?1:0;super.addElements(t+n,t+n+2,e+n),super.addElements(t+n+1+2,e+n+1+2,e+n+1)}}createDataPack(t,n){this.maxAltitude=0;const e=super.createDataPack(t,n);if(!e)return e;const{data:r,indices:i}=e;this.getFormat().reduce(((t,n)=>(t[n.name]={size:n.width},t)),{}).aPickingId={size:1};const{aExtrudedPosition:s,aPosition:o,aLinesofar:a,aUp:u,aExtrude:l,aColor:h,aLineHeight:c,aLineWidth:f}=r,d={},p=Jn(s,i);let y,m=!0;for(let t=0;t<p.length;t++)p[t]=-p[t],p[t]%1!=0&&(m=!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)&&(y=function(t,n,e){const r=[];for(let i=0;i<t.length;i+=3){const t=n[i/3];r.push(t/256,e[i/3]?1:0)}return r}(s,a,u)),d.aPosition=o,y&&(d.aTexCoord0=new Float32Array(y)),d.aNormal=m?new Int8Array(p):new Float32Array(p),d.aPickingId=r.aPickingId,d.aExtrude=l,h&&(d.aColor=h),f&&(d.aLineWidth=f),c){const t=yr(this.maxAltitude);d.aLineHeight=new t(c)}const g=[];for(const t in d)g.push(d[t].buffer);return e.data=d,e.buffers=g,e}}const Lu=Math.pow(2,16)/1;class Ru extends Pa{getFormat(){return[...this.getPositionFormat()]}placeVector(t){const n=t.feature,e=3===n.type,r=n.geometry,i=this.elements;e&&(this.elements=this.dt.get());const s=this.needAltitudeAttribute()?2:3;for(let t=0;t<r.length;t++)this.offset=this.data.aPosition.getLength()/s,this.Tt(r[t],n),e&&(this.zt(i),this.elements=this.dt.get());e&&(this.elements=i)}Tt(t,n){const e=3===n.type;let r=t.length;for(;r>=2&&t[r-1].equals(t[r-2]);)r--;let i,s,o,a=0;for(;a<r-1&&t[a].equals(t[a+1]);)a++;if(!(r<(e?3:2))){this.distance=0,this.vertexLength=0,this.primitiveLength=0,this.e1=this.e2=this.e3=-1,e&&(i=t[r-2]);for(let n=a;n<r;n++)o=e&&n===r-1?t[a+1]:t[n+1],o&&t[n].equals(o)||(i&&(s=i),i=t[n],s&&(this.distance+=i.dist(s)),this.addCurrentVertex(i,this.distance))}}addCurrentVertex(t,n){const e=this.vertexLength++;this.addLineVertex(this.data,t,n),e>=1&&this.addElements(e-1,e),n>Lu&&(this.distance=0,this.addCurrentVertex(t,this.distance))}addLineVertex(t,n){this.fillPosition(t,n.x,n.y,n.z||0),this.maxPos=Math.max(this.maxPos,Math.abs(n.x),Math.abs(n.y))}addElements(t,n){this.maxIndex=Math.max(this.maxIndex,this.offset+t,this.offset+n);let e=this.elements.currentIndex;this.elements[e++]=this.offset+t,this.elements[e++]=this.offset+n,this.elements.currentIndex=e}zt(t){const n=this.options.EXTENT,e=this.elements,r=e.getLength();for(let i=0;i<r;i+=2)if(!er(this.data.aPosition,e[i],e[i+1],3,n)){let n=t.currentIndex;t[n++]=e[i],t[n++]=e[i+1],t.currentIndex=n}}}const Vu=45*Math.PI/100;class Hu extends Pa{getFormat(){const{markerFillFn:t}=this.st;let n;return n="line"===this.symbol.markerRotationAlignment?[...this.getPositionFormat(),{type:Float32Array,width:1,name:"aXYRotation"},{type:Float32Array,width:1,name:"aZRotation"}]:[...this.getPositionFormat()],t&&n.push({type:Uint8Array,width:4,name:"aColor"}),n}placeVector(t){const n=t.feature.properties,{markerFillFn:e}=this.st;let r;e&&(r=e(this.options.zoom,n)||[255,255,255,255],y(r)?(this.dynamicAttrs.aColor=1,r=[0,0,0,0]):r=Ir([],r));const i=this.data,s="line"===this.symbol.markerRotationAlignment,o=this.Ot(t,this.symbol.markerSpacing||250,this.symbol.markerPlacement||"point",s);for(let t=0;t<o.length;t++){const n=o[t];if(this.fillPosition(this.data,n.x,n.y,n.z),s){let t=i.aXYRotation.currentIndex;i.aXYRotation[t++]=n.xyRotation||0,i.aXYRotation.currentIndex=t,t=i.aZRotation.currentIndex,i.aZRotation[t++]=n.zRotation||0,i.aZRotation.currentIndex=t}if(r){let t=i.aColor.currentIndex;i.aColor[t++]=r[0],i.aColor[t++]=r[1],i.aColor[t++]=r[2],i.aColor[t++]=r[3],i.aColor.currentIndex=t}const e=Math.max(Math.abs(n.x),Math.abs(n.y));e>this.maxPos&&(this.maxPos=e)}}Ot(t,n,e,r){const i=t.feature,s=this.options.EXTENT;if("line"===e){const t=[];let e=i.geometry;s&&(e=ou(i.geometry,0,0,s,s));for(let r=0;r<e.length;r++){const i=lu(e[r],n,Vu,null,0,24,1,1,s||1/0);t.push.apply(t,i)}return t}return bu(i,e,s,r,this.options.altitudeToTileScale)}hasElements(){return!1}}\n/*!\n * from @turf/bboxClip\n * https://github.com/Turfjs/turf\n * MIT LICENSE\n */const qu=[],Gu=[];function Ju(t,n){var e,r,i,s,o,a,u;for(r=1;r<=8;r*=2){for(e=[],s=!(Bu(i=t[t.length-1],n)&r),o=0;o<t.length;o++){if((u=!(Bu(a=t[o],n)&r))!==s){const t=Wu(i,a,r,n);e.push(void 0!==a.x?new dt(t[0],t[1]):t)}u&&e.push(a),i=a,s=u}if(!(t=e).length)break}return e}function Wu(t,n,e,r){return qu[0]=void 0===t.x?t[0]:t.x,qu[1]=void 0===t.y?t[1]:t.y,t=qu,Gu[0]=void 0===n.x?n[0]:n.x,Gu[1]=void 0===n.y?n[1]:n.y,n=Gu,8&e?[t[0]+(n[0]-t[0])*(r[3]-t[1])/(n[1]-t[1]),r[3]]:4&e?[t[0]+(n[0]-t[0])*(r[1]-t[1])/(n[1]-t[1]),r[1]]:2&e?[r[2],t[1]+(n[1]-t[1])*(r[2]-t[0])/(n[0]-t[0])]:1&e?[r[0],t[1]+(n[1]-t[1])*(r[0]-t[0])/(n[0]-t[0])]:null}function Bu(t,n){qu[0]=void 0===t.x?t[0]:t.x,qu[1]=void 0===t.y?t[1]:t.y;var e=0;return(t=qu)[0]<n[0]?e|=1:t[0]>n[2]&&(e|=2),t[1]<n[1]?e|=4:t[1]>n[3]&&(e|=8),e}const Xu=[0,0,0,0],Yu=-9999999;class Ku extends Pa{constructor(...t){super(...t),this.lineElements=[]}createStyledVector(t,n,e,r,i){const s=new zr(t,n,e,r),o=s.getPolygonResource();return!this.options.atlas&&o&&(i[o]=[0,0]),s}getFormat(){const t=[...this.getPositionFormat()],{polygonFillFn:n,polygonOpacityFn:e,uvScaleFn:r,uvOffsetFn:i,polygonPatternUVFn:s}=this.st;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"}),e&&t.push({type:Uint8Array,width:1,name:"aOpacity"}),r&&t.push({type:Uint16Array,width:2,name:"aUVScale"}),i&&t.push({type:Uint8Array,width:2,name:"aUVOffset"}),s&&t.push({type:Float32Array,width:2,name:"aTexCoord"}),t}placeVector(t,n){const e=t.feature;this.Rt(e.geometry,e,n)}Rt(t,n){let e,r,i,s;const{polygonFillFn:o,polygonOpacityFn:a,uvScaleFn:u,uvOffsetFn:l,uvOffsetInMeterFn:h,polygonPatternUVFn:c}=this.st,f=n.properties;o&&(e=o(this.options.zoom,f)||ze([],255,255,255,255),y(e)?(this.dynamicAttrs.aColor=1,e=Xu):e=Ir([],e)),a&&(r=a(this.options.zoom,f),y(r)?(this.dynamicAttrs.aOpacity=1,r=255):(wr(r)&&(r=1),r*=255)),u&&(i=u(this.options.zoom,f),y(i)?(i=[255,255],this.dynamicAttrs.aUVScale=1):(wr(i)&&(i=[1,1]),i=[255*i[0],255*i[1]])),l&&(h&&h(null,f)?s=[0,0]:(s=l(this.options.zoom,f),y(s)?(s=[0,0],this.dynamicAttrs.aUVOffset=1):(wr(s)&&(s=[0,0]),s=[255*s[0],255*s[1]])));const d=!!this.iconAtlas,p=fu(t,500),m=[0,0],g=[0,0];if(d){const{polygonPatternFileFn:t}=this.st,n=t?t(null,f):this.symbol.polygonPatternFile;if(this.iconAtlas.glyphMap[n]){const t=this.iconAtlas.positions[n],e=!lr(t.displaySize[0])||!lr(t.displaySize[1]);m[0]=t.tl[0]+(e?1:0),m[1]=t.tl[1]+(e?1:0),g[0]=t.displaySize[0]-1-(e?2:0),g[1]=t.displaySize[1]-1-(e?2:0)}}let v,b=0;c&&(v=c(this.options.zoom,f));const w=this.needAltitudeAttribute()?2:3,M=[-1,-1,n.extent+1,n.extent+1],x=this.Vt=this.Vt||this.dt.getProxy(),F=this.Ht=this.Ht||this.dt.getProxy();for(let t=0;t<p.length;t++){const n=p[t],o=this.data.aPosition.getLength()/w;x.setLength(0),F.setLength(0);for(let t=0;t<n.length;t++){let o=n[t];if(this.options.EXTENT!==1/0&&0===this.maxPosZ&&(o=Ju(o,M)),0===o.length)continue;0!==t&&F.push(x.length/3),this.ensureDataCapacity(o.length);const a=this.data;for(let t=0;t<o.length;t++){const n=o[t].x,u=o[t].y,l=o[t].z||0;if(this.fillPosition(this.data,n,u,l),d){let t=a.aTexInfo.currentIndex;a.aTexInfo[t++]=m[0],a.aTexInfo[t++]=m[1],a.aTexInfo[t++]=g[0],a.aTexInfo[t++]=g[1],a.aTexInfo.currentIndex=t}if(void 0!==e){let t=a.aColor.currentIndex;a.aColor[t++]=e[0],a.aColor[t++]=e[1],a.aColor[t++]=e[2],a.aColor[t++]=e[3],a.aColor.currentIndex=t}if(void 0!==r){let t=a.aOpacity.currentIndex;a.aOpacity[t++]=r,a.aOpacity.currentIndex=t}if(void 0!==i){let t=a.aUVScale.currentIndex;a.aUVScale[t++]=i[0],a.aUVScale[t++]=i[1],a.aUVScale.currentIndex=t}if(void 0!==s){let t=a.aUVOffset.currentIndex;a.aUVOffset[t++]=s[0],a.aUVOffset[t++]=s[1],a.aUVOffset.currentIndex=t}if(c){let t=a.aTexCoord.currentIndex;if(v){const n=wr(v[2*b])?v[0]:v[2*b],e=wr(v[2*b]+1)?v[1]:v[2*b+1];a.aTexCoord[t++]=n,a.aTexCoord[t++]=e}else a.aTexCoord[t++]=Yu,a.aTexCoord[t++]=Yu;a.aTexCoord.currentIndex=t,b++}const h=Math.abs(n),f=Math.abs(u);h>this.maxPos&&(this.maxPos=h),f>this.maxPos&&(this.maxPos=f),x.push(n,u,l)}}let a=Ce(x,F,3);if(x.length&&!a.length){const t=[];for(let n=0;n<x.length;n+=3)t[n]=x[n],t[n+1]=x[n+2],t[n+2]=x[n+1];if(a=Ce(t,F,3),!a.length){for(let n=0;n<x.length;n+=3)t[n]=x[n+1],t[n+1]=x[n+2],t[n+2]=x[n];a=Ce(t,F,3)}}for(let t=0;t<a.length;t+=3)this.addElements(o+a[t],o+a[t+1],o+a[t+2])}}ensureDataCapacity(t){super.ensureDataCapacity(1,t)}}const Zu=[{type:Int16Array,width:3,name:"aPosition"}];class Qu extends Pa{getFormat(){return Zu}placeVector(t,n){const e=this.Ot(t,n);if(0===e.length)return;const r=this.data,i=this.getAltitude(t.feature.properties);let s=r.aPosition.getLength()/Zu[0].width;for(let t=0;t<e.length;t++){const n=e[t];r.aPosition.push(2*n.x+0,2*n.y+0,i),r.aPosition.push(2*n.x+1,2*n.y+0,i),r.aPosition.push(2*n.x+1,2*n.y+1,i),r.aPosition.push(2*n.x+0,2*n.y+1,i),this.addElements(s,s+1,s+2),this.addElements(s,s+2,s+3),s+=4;const o=Math.max(Math.abs(2*n.x+1),Math.abs(2*n.y+1));o>this.maxPos&&(this.maxPos=o)}}Ot(t,n){const{feature:e,symbol:r}=t,i=this.$t(t,r),s=e.properties,{markerSpacingFn:o}=this.st,a=((o?o(null,s):r.markerSpacing)||250)*n;return vu(t,null,null,n,this.options.EXTENT,i,a)}$t(t,n){return this.st.markerPlacementFn?this.st.markerPlacementFn(this.options.zoom,t.feature.properties):n.markerPlacement}}class tl extends Iu{constructor(t,n,e){(n=br({},n)).lineJoin="miter",n.lineCap="butt",super(t,n,e),this.options.radialSegments%2==1&&this.options.radialSegments--}getFormat(){const{lineWidthFn:t,lineColorFn:n,lineOpacityFn:e,linePatternAnimSpeedFn:r,linePatternGapFn:i}=this.st,s=[...this.getPositionFormat(),{type:Int8Array,width:4,name:"aTubeNormal"},{type:this.options.positionType||Uint16Array,width:1,name:"aLinesofar"}];if(this.iconAtlas){s.push({type:Int8Array,width:1,name:"aNormalDistance"});const t=this.getIconAtlasMaxValue();s.push({type:t>255?Uint16Array:Uint8Array,width:4,name:"aTexInfo"})}return t&&s.push({type:Uint16Array,width:1,name:"aLineWidth"}),n&&s.push({type:Uint8Array,width:4,name:"aColor"}),e&&s.push({type:Uint8Array,width:1,name:"aOpacity"}),r&&s.push({type:Int8Array,width:1,name:"aLinePatternAnimSpeed"}),i&&s.push({type:Int8Array,width:1,name:"aLinePatternGap"}),s}ensureDataCapacity(t,n,e,r){return super.ensureDataCapacity(t,n,e,r*(this.options.radialSegments/2))}addHalfVertex(t,n,e,r,i,s,o,a){const{x:u,y:l,z:h}=t,c=1*this.scaledDistance,f=this.options.radialSegments/2,{x:d,y:p,z:y}=o.dir,m=function(t,n,e,r,i,s,o,a){Ie(nl,e,r,i),Ie(el,s,o,0),Te(rl,nl,el),$e(el,el),$e(rl,rl),il[n]||(il[n]=[]);const u=il[n];for(var l=0;l<n;l++){const t=Math.PI*l/n,e=1-Math.abs(t-0)/(Math.PI/2);u[l]=u[l]||[],sl(el,rl,u[l],1,t,e*(a?-1:1))}return u}(0,f,d,p,y,n,e,i);this.prevVertex&&this.fillTubeElements(i),this.fillData(this.data,u,l,h||0,m,i,c,a)}fillTubeElements(t){const n=this.options.radialSegments/2,e=this.needAltitudeAttribute()?2:3,r=this.data.aPosition.getLength()/e;for(let e=0;e<n;e++){const i=e+r-2*n;let s,o;e===n-1&&t?(s=e+r-2*n+1,o=e+r-2*n-2*n+1):(s=e+r+1,o=e+r+1-2*n),super.addElements(e+r-this.offset,s-this.offset,i-this.offset),super.addElements(i-this.offset,s-this.offset,o-this.offset)}}fillData(t,n,e,r,i,s,o,a){const{lineWidthFn:u,lineColorFn:l,lineOpacityFn:h,linePatternAnimSpeedFn:c,linePatternGapFn:f}=this.st,d=i.length;for(let s=0;s<d;s++){this.fillPosition(t,n,e,r),Ue(i[s],i[s],Pu);let d=t.aTubeNormal.currentIndex;for(let n=0;n<i[s].length;n++)t.aTubeNormal[d++]=i[s][n];if(t.aTubeNormal.currentIndex=d,d=t.aLinesofar.currentIndex,t.aLinesofar[d++]=o,t.aLinesofar.currentIndex=d,this.iconAtlas&&(d=t.aNormalDistance.currentIndex,t.aNormalDistance[d++]=Pu*a,t.aNormalDistance.currentIndex=d,d=t.aTexInfo.currentIndex,t.aTexInfo[d++]=this.feaTexInfo[0],t.aTexInfo[d++]=this.feaTexInfo[1],t.aTexInfo[d++]=this.feaTexInfo[2],t.aTexInfo[d++]=this.feaTexInfo[3],t.aTexInfo.currentIndex=d),u){const n=Cr(this.options.metric);let e=this.feaLineWidth*n;isNaN(e)&&(e=0),d=t.aLineWidth.currentIndex,t.aLineWidth[d++]=Math.round(e),t.aLineWidth.currentIndex=d}l&&(d=t.aColor.currentIndex,t.aColor[d++]=this.feaColor[0],t.aColor[d++]=this.feaColor[1],t.aColor[d++]=this.feaColor[2],t.aColor[d++]=this.feaColor[3],t.aColor.currentIndex=d),h&&(d=t.aOpacity.currentIndex,t.aOpacity[d++]=this.feaOpacity,t.aOpacity.currentIndex=d),c&&(d=t.aLinePatternAnimSpeed.currentIndex,t.aLinePatternAnimSpeed[d++]=127*(this.feaPatternAnimSpeed||0),t.aLinePatternAnimSpeed.currentIndex=d),f&&(d=t.aLinePatternGap.currentIndex,t.aLinePatternGap[d++]=10*(this.feaLinePatternGap||0),t.aLinePatternGap.currentIndex=d)}this.maxPos=Math.max(this.maxPos,Math.abs(n)+1,Math.abs(e)+1)}createDataPack(t,n){const e=super.createDataPack(t,n);return e&&(e.is2D=!1),e}}const nl=[],el=[],rl=[],il={};function sl(t,n,e,r,i,s){return ze(e,r*(Math.cos(i)*t[0]+Math.sin(i)*n[0]),r*(Math.cos(i)*t[1]+Math.sin(i)*n[1]),r*(Math.cos(i)*t[2]+Math.sin(i)*n[2]),s),e}class ol extends tl{addHalfVertex(t,n,e,r,i,s,o,a){const{x:u,y:l,z:h}=t,c=1*this.scaledDistance,{x:f,y:d,z:p}=o.dir,y=function(t,n,e,r,i,s,o,a){Ie(ul,e,r,i),Ie(ll,s,o,0),Te(hl,ul,ll),$e(ll,ll),$e(hl,hl),Le(al,t,n);const u=Ve(al)/t,l=Math.atan(n/t);let h=Math.PI/2+(Math.PI/2-l);return cl[0]||(cl[0]=[]),sl(ll,hl,cl[0],u,h,a?1:-1),h+=2*l,cl[1]||(cl[1]=[]),sl(ll,hl,cl[1],u,h,a?1:-1),cl}(this.feaLineWidth,this.feaLineHeight,f,d,p,n,e,i);this.prevVertex&&this.fillTubeElements(i),this.fillData(this.data,u,l,h||0,y,i,c,a)}ensureDataCapacity(t,n,e,r){return super.ensureDataCapacity(t,n,e,2*r)}}const al=[],ul=[],ll=[],hl=[],cl=[];class fl{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}}\n/*!\n * based on @mapbox/tiny-sdf\n * https://github.com/mapbox/tiny-sdf\n * @License BSD 2-Clause\n */var dl=1e20;function pl(t,n,e,r,i,s,o){this.fontSize=t||24,this.buffer=void 0===n?3:n,this.cutoff=r||.25,this.fontFamily=i||"sans-serif",this.fontWeight=s||"normal",this.fontStyle=o||"normal",this.radius=e||8;var a=this.size=this.fontSize+2*this.buffer;this.canvas="undefined"==typeof document?new OffscreenCanvas(a,a):document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d",{willReadFrequently:!0}),this.ctx.font=this.fontStyle+" "+this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a),this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function yl(t,n,e,r,i,s){for(var o=0;o<n;o++)ml(t,o,n,e,r,i,s);for(var a=0;a<e;a++)ml(t,a*n,1,n,r,i,s)}function ml(t,n,e,r,i,s,o){var a,u,l,h;for(s[0]=0,o[0]=-dl,o[1]=dl,a=0;a<r;a++)i[a]=t[n+a*e];for(a=1,u=0,l=0;a<r;a++){do{l=(i[a]-i[h=s[u]]+a*a-h*h)/(a-h)/2}while(l<=o[u]&&--u>-1);s[++u]=a,o[u]=l,o[u+1]=dl}for(a=0,u=0;a<r;a++){for(;o[u+1]<a;)u++;t[n+a*e]=i[h=s[u]]+(a-h)*(a-h)}}pl.prototype.draw=function(t,n,e){this.ctx.clearRect(0,0,this.size,this.size),this.ctx.textBaseline="top",this.ctx.fillText(t,this.buffer,this.buffer);for(var r=this.ctx.getImageData(0,0,n,e),i=new Uint8ClampedArray(n*e),s=0;s<n*e;s++){var o=r.data[4*s+3]/255;this.gridOuter[s]=1===o?0:0===o?dl:Math.pow(Math.max(0,.5-o),2),this.gridInner[s]=1===o?dl:0===o?0:Math.pow(Math.max(0,o-.5),2)}for(yl(this.gridOuter,n,e,this.f,this.v,this.z),yl(this.gridInner,n,e,this.f,this.v,this.z),s=0;s<n*e;s++){var a=Math.sqrt(this.gridOuter[s])-Math.sqrt(this.gridInner[s]);i[s]=Math.round(255-255*(a/this.radius+this.cutoff))}return i};let gl=0;class vl{constructor(t,n=15,e,r){this.entries={},this.qt={},this.Gt=new fl(2048,(function(){})),this.Jt=t,this.Wt=n,this.Bt=e,this.Xt=r}Yt(t){return t&&t.indexOf("{stack}")>=0&&t.indexOf("{range}")>0}getGlyphs(t,n){if(!t||!Object.keys(t).length)return void n(null,{glyphs:null});if(this.Yt(this.Xt))return void this.Kt(t,n);const e=this.entries,r=t.options;let i=!0;r&&(i=!1!==r.isCharsCompact),i=i||this.Bt;const s=(r,s,a)=>{let u=0,l=0;for(const n in t)if("options"!==n){e[n]=e[n]||{},s[n]=s[n]||{};for(const h in t[n]){if(l++,l<=r)continue;const t=i&&!Na(+h),c=n+":"+h+":"+t;let f;if(this.Gt.has(c)?f=this.Gt.get(c):(f=this.Zt(e[n],n,h,t),this.Gt.add(c,f),u++),f=bl(f),s[n][h]=f,a.push(f.bitmap.data.buffer),this.Jt&&u>this.Wt)return void this.Jt(o(l,s,a))}}n(null,{glyphs:s,buffers:a})};function o(t,n,e){return()=>{s(t,n,e)}}s(0,{},[])}Kt(t,n){const e=[];for(const n in t)for(const r of t[n])e.push(this.Qt(n,r));Promise.all(e).then((t=>{n(null,t)}))}Qt(){return Promise.resolve(null)}Zt(t,n,e,r){const i=n;let s=t.tinySDF;const o=r?-1:2;if(!s){let n="400";/bolder/i.test(i)?n="1000":/bold/i.test(i)?n="900":/medium/i.test(i)?n="500":/light/i.test(i)&&(n="200"),s=t.tinySDF=new pl(24,2,8,.25,i,n)}const a=String.fromCodePoint(e),u=s.ctx.measureText(a),l=Math.round(u.width),h=s.draw(a,l+4,28);if(gl<4){const t="undefined"!=typeof document&&document.getElementById("sdf-debug-"+gl++);t&&(t.width=l+4,t.height=s.canvas.height,t.getContext("2d").drawImage(s.canvas,0,0))}return{charCode:e,bitmap:{width:l+4,height:28,data:h},metrics:{width:l,height:24,left:1,top:-2,advance:l+2+o}}}}function bl(t){const n={width:t.bitmap.width,height:t.bitmap.height,data:new Uint8ClampedArray(t.bitmap.data)};return{charCode:t.charCode,bitmap:n,metrics:br({},t.metrics)}}var wl=Object.freeze({__proto__:null,calculateSignedArea:nr,clipPolygon:Ju,convertGeometry:vr,convertRTLText:eu,generatePickingIndiceIndex:ur,getFeaAltitudeAndHeight:ir,getIndexArrayType:pr,getPosArrayType:yr,getUnsignedArrayType:mr,packPosition:jr,unpackPosition:function(t,n,e,r){const i=(Math.sign(n)||1)*(Math.abs(n)%Ur),s=(Math.sign(e)||1)*(Math.abs(e)%Ur),o=Math.floor(Math.abs(n)/Ur),a=Math.floor(Math.abs(e)/Ur);return t[0]=i,t[1]=s,t[2]=Math.sign(r+1e-5)*(2*o+a)*Nr+r,t}});var Ml={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,n,e,r,i){var s,o,a=8*i-r-1,u=(1<<a)-1,l=u>>1,h=-7,c=e?i-1:0,f=e?-1:1,d=t[n+c];for(c+=f,s=d&(1<<-h)-1,d>>=-h,h+=a;h>0;s=256*s+t[n+c],c+=f,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=r;h>0;o=256*o+t[n+c],c+=f,h-=8);if(0===s)s=1-l;else{if(s===u)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),s-=l}return(d?-1:1)*o*Math.pow(2,s-r)},write:function(t,n,e,r,i,s){var o,a,u,l=8*s-i-1,h=(1<<l)-1,c=h>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:s-1,p=r?1:-1,y=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=h):(o=Math.floor(Math.log(n)/Math.LN2),n*(u=Math.pow(2,-o))<1&&(o--,u*=2),(n+=o+c>=1?f/u:f*Math.pow(2,1-c))*u>=2&&(o++,u/=2),o+c>=h?(a=0,o=h):o+c>=1?(a=(n*u-1)*Math.pow(2,i),o+=c):(a=n*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;t[e+d]=255&a,d+=p,a/=256,i-=8);for(o=o<<i|a,l+=i;l>0;t[e+d]=255&o,d+=p,o/=256,l-=8);t[e+d-p]|=128*y}},xl=kl,Fl=Ml;function kl(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}kl.Varint=0,kl.Fixed64=1,kl.Bytes=2,kl.Fixed32=5;var Al=4294967296,Pl=1/Al,Sl="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function _l(t){return t.type===kl.Bytes?t.readVarint()+t.pos:t.pos+1}function Ol(t,n,e){return e?4294967296*n+(t>>>0):4294967296*(n>>>0)+(t>>>0)}function Cl(t,n,e){var r=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));e.realloc(r);for(var i=e.pos-1;i>=t;i--)e.buf[i+r]=e.buf[i]}function El(t,n){for(var e=0;e<t.length;e++)n.writeVarint(t[e])}function Il(t,n){for(var e=0;e<t.length;e++)n.writeSVarint(t[e])}function $l(t,n){for(var e=0;e<t.length;e++)n.writeFloat(t[e])}function Tl(t,n){for(var e=0;e<t.length;e++)n.writeDouble(t[e])}function Dl(t,n){for(var e=0;e<t.length;e++)n.writeBoolean(t[e])}function zl(t,n){for(var e=0;e<t.length;e++)n.writeFixed32(t[e])}function jl(t,n){for(var e=0;e<t.length;e++)n.writeSFixed32(t[e])}function Ul(t,n){for(var e=0;e<t.length;e++)n.writeFixed64(t[e])}function Nl(t,n){for(var e=0;e<t.length;e++)n.writeSFixed64(t[e])}function Ll(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+16777216*t[n+3]}function Rl(t,n,e){t[e]=n,t[e+1]=n>>>8,t[e+2]=n>>>16,t[e+3]=n>>>24}function Vl(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+(t[n+3]<<24)}kl.prototype={destroy:function(){this.buf=null},readFields:function(t,n,e){for(e=e||this.length;this.pos<e;){var r=this.readVarint(),i=r>>3,s=this.pos;this.type=7&r,t(i,n,this),this.pos===s&&this.skip(r)}return n},readMessage:function(t,n){return this.readFields(t,n,this.readVarint()+this.pos)},readFixed32:function(){var t=Ll(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Vl(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ll(this.buf,this.pos)+Ll(this.buf,this.pos+4)*Al;return this.pos+=8,t},readSFixed64:function(){var t=Ll(this.buf,this.pos)+Vl(this.buf,this.pos+4)*Al;return this.pos+=8,t},readFloat:function(){var t=Fl.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Fl.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var n,e,r=this.buf;return n=127&(e=r[this.pos++]),e<128?n:(n|=(127&(e=r[this.pos++]))<<7,e<128?n:(n|=(127&(e=r[this.pos++]))<<14,e<128?n:(n|=(127&(e=r[this.pos++]))<<21,e<128?n:function(t,n,e){var r,i,s=e.buf;if(r=(112&(i=s[e.pos++]))>>4,i<128)return Ol(t,r,n);if(r|=(127&(i=s[e.pos++]))<<3,i<128)return Ol(t,r,n);if(r|=(127&(i=s[e.pos++]))<<10,i<128)return Ol(t,r,n);if(r|=(127&(i=s[e.pos++]))<<17,i<128)return Ol(t,r,n);if(r|=(127&(i=s[e.pos++]))<<24,i<128)return Ol(t,r,n);if(r|=(1&(i=s[e.pos++]))<<31,i<128)return Ol(t,r,n);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(e=r[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&&Sl?function(t,n,e){return Sl.decode(t.subarray(n,e))}(this.buf,n,t):function(t,n,e){for(var r="",i=n;i<e;){var s,o,a,u=t[i],l=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h>e)break;1===h?u<128&&(l=u):2===h?128==(192&(s=t[i+1]))&&(l=(31&u)<<6|63&s)<=127&&(l=null):3===h?(o=t[i+2],128==(192&(s=t[i+1]))&&128==(192&o)&&((l=(15&u)<<12|(63&s)<<6|63&o)<=2047||l>=55296&&l<=57343)&&(l=null)):4===h&&(o=t[i+2],a=t[i+3],128==(192&(s=t[i+1]))&&128==(192&o)&&128==(192&a)&&((l=(15&u)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||l>=1114112)&&(l=null)),null===l?(l=65533,h=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),i+=h}return r}(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!==kl.Bytes)return t.push(this.readVarint(n));var e=_l(this);for(t=t||[];this.pos<e;)t.push(this.readVarint(n));return t},readPackedSVarint:function(t){if(this.type!==kl.Bytes)return t.push(this.readSVarint());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==kl.Bytes)return t.push(this.readBoolean());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==kl.Bytes)return t.push(this.readFloat());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==kl.Bytes)return t.push(this.readDouble());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==kl.Bytes)return t.push(this.readFixed32());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==kl.Bytes)return t.push(this.readSFixed32());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==kl.Bytes)return t.push(this.readFixed64());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==kl.Bytes)return t.push(this.readSFixed64());var n=_l(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed64());return t},skip:function(t){var n=7&t;if(n===kl.Varint)for(;this.buf[this.pos++]>127;);else if(n===kl.Bytes)this.pos=this.readVarint()+this.pos;else if(n===kl.Fixed32)this.pos+=4;else{if(n!==kl.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 e=new Uint8Array(n);e.set(this.buf),this.buf=e,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),Rl(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Rl(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Rl(this.buf,-1&t,this.pos),Rl(this.buf,Math.floor(t*Pl),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Rl(this.buf,-1&t,this.pos),Rl(this.buf,Math.floor(t*Pl),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,n){var e,r;if(t>=0?(e=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(e=~(-t%4294967296))?e=e+1|0:(e=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");n.realloc(10),function(t,n,e){e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos]=127&t}(e,0,n),function(t,n){var e=(7&t)<<4;n.buf[n.pos++]|=e|((t>>>=3)?128:0),t&&(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),t&&(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),t&&(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),t&&(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),t&&(n.buf[n.pos++]=127&t)))))}(r,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,e){for(var r,i,s=0;s<n.length;s++){if((r=n.charCodeAt(s))>55295&&r<57344){if(!i){r>56319||s+1===n.length?(t[e++]=239,t[e++]=191,t[e++]=189):i=r;continue}if(r<56320){t[e++]=239,t[e++]=191,t[e++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&(t[e++]=239,t[e++]=191,t[e++]=189,i=null);r<128?t[e++]=r:(r<2048?t[e++]=r>>6|192:(r<65536?t[e++]=r>>12|224:(t[e++]=r>>18|240,t[e++]=r>>12&63|128),t[e++]=r>>6&63|128),t[e++]=63&r|128)}return e}(this.buf,t,this.pos);var e=this.pos-n;e>=128&&Cl(n,e,this),this.pos=n-1,this.writeVarint(e),this.pos+=e},writeFloat:function(t){this.realloc(4),Fl.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Fl.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 e=0;e<n;e++)this.buf[this.pos++]=t[e]},writeRawMessage:function(t,n){this.pos++;var e=this.pos;t(n,this);var r=this.pos-e;r>=128&&Cl(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,n,e){this.writeTag(t,kl.Bytes),this.writeRawMessage(n,e)},writePackedVarint:function(t,n){n.length&&this.writeMessage(t,El,n)},writePackedSVarint:function(t,n){n.length&&this.writeMessage(t,Il,n)},writePackedBoolean:function(t,n){n.length&&this.writeMessage(t,Dl,n)},writePackedFloat:function(t,n){n.length&&this.writeMessage(t,$l,n)},writePackedDouble:function(t,n){n.length&&this.writeMessage(t,Tl,n)},writePackedFixed32:function(t,n){n.length&&this.writeMessage(t,zl,n)},writePackedSFixed32:function(t,n){n.length&&this.writeMessage(t,jl,n)},writePackedFixed64:function(t,n){n.length&&this.writeMessage(t,Ul,n)},writePackedSFixed64:function(t,n){n.length&&this.writeMessage(t,Nl,n)},writeBytesField:function(t,n){this.writeTag(t,kl.Bytes),this.writeBytes(n)},writeFixed32Field:function(t,n){this.writeTag(t,kl.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(t,n){this.writeTag(t,kl.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(t,n){this.writeTag(t,kl.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(t,n){this.writeTag(t,kl.Fixed64),this.writeSFixed64(n)},writeVarintField:function(t,n){this.writeTag(t,kl.Varint),this.writeVarint(n)},writeSVarintField:function(t,n){this.writeTag(t,kl.Varint),this.writeSVarint(n)},writeStringField:function(t,n){this.writeTag(t,kl.Bytes),this.writeString(n)},writeFloatField:function(t,n){this.writeTag(t,kl.Fixed32),this.writeFloat(n)},writeDoubleField:function(t,n){this.writeTag(t,kl.Fixed64),this.writeDouble(n)},writeBooleanField:function(t,n){this.writeVarintField(t,Boolean(n))}};var Hl=function(t){return t&&t.M&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}(xl);const ql={polygonPatternFile:1,markerFile:1,markerPlacement:1,markerSpacing:1,textName:1,textFaceName: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},ql),Object.assign({lineDasharray:1,topPolygonFill:1,bottomPolygonFill:1},ql);const Gl=Math.PI/180,Jl=6378137*Math.PI/180,Wl=85.0511287798;function Bl(t,n,e){if("EPSG:3857"===e)return function(t,n){const e=Wl,r=n[0],i=Math.max(Math.min(e,n[1]),-e);let s;s=0===i?0:Math.log(Math.tan((90+i)*Gl/2))/Gl;return t[0]=r*Jl,t[1]=s*Jl,t}(t,n);if("EPSG:4326"===e||"EPSG:4490"===e||"identity"===e)return Xl(t,n);if("baidu"===e)return Xl(t,n);throw new Error("unsupported projection:"+e)}function Xl(t,n){return t[0]=n[0],t[1]=n[1],t}function Yl(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p){0===t?function(t,n,e,r,i,s,o,a,u,l){const h=1/(100*s[0]),c=1/(100*s[1]),f=l&&l[0]||0,d=l&&l[1]||0,p=[0,0];for(let i=t;i<n;i+=3){const t=i/3*2,n=r[i]-f,s=r[i+1]-d;e[t]=p[0]+n/o*h/a,e[t+1]=p[1]-s/o*c/u}}(n,e,r,i,0,o,a,u,l,p):1===t&&function(t,n,e,r,i,s,o,a,u,l,h){if(!t)return;let c,f,d,p;0===t[4]?(c=t[0],f=t[1],d=t[2],p=t[3]):(c=t[1],f=t[2],d=t[3],p=t[0]);const y=Re(c,f),m=Re(f,d),g=[],v=[],b=[];for(let t=n;t<e;t+=3){const n=t/3*2;Le(g,(s.x/u+i[t]/o)*a,s.y/u*a+(h?i[t+1]:-i[t+1])/o*a),"EPSG:4326"!==l&&"EPSG:4490"!==l||Bl(g,g,"EPSG:3857"),Kl(v,g,c,f),Kl(b,g,p,c),r[n]=Re(c,v)/y,r[n+1]=Re(c,b)/m}}(h,n,e,r,i,s,a,c,f,d,!!p)}function Kl(t,n,e,r){const i=e[0]-r[0],s=e[1]-r[1];let o=(n[0]-e[0])*(e[0]-r[0])+(n[1]-e[1])*(e[1]-r[1]);return o/=i*i+s*s,t[0]=e[0]+o*i,t[1]=e[1]+o*s,t}function Zl(t,n,e,r,i){const s=3*n[e-1],o=3*n[e-1]+1,a=t[s],u=t[o];return l=r,h=i,c=a,f=u,Math.sqrt((c-l)*(c-l)+(f-h)*(f-h));var l,h,c,f}const Ql="__fea_idx";new Float32Array([-1e12])[0];const th="maptalks_ombb";function nh(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p,y,m){const g=n.getLength(),v=i/3;for(let e=2,r=g;e<r;e+=3)t[i+e-2]=n[e-2],t[i+e-1]=n[e-1],t[i+e-0]=n[e]-o;i+=g;for(let e=2,r=g;e<r;e+=3)t[i+e-2]=n[e-2],t[i+e-1]=n[e-1],t[i+e-0]=n[e]-a;i+=g,t.trySetLength(i+g),t.copyWithin(i,i-2*g,i-g),i+=g,t.trySetLength(i+g),t.copyWithin(i,i-2*g,i-g),i+=g,(e=e||[]).push(g/3);const b=e.getLength();for(let n=0;n<b;n++){eh(v+(e[n-1]||0),v+e[n],t,g/3,u,r,l,h,c,f,s,d,p,y,m)}return i}function eh(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p){const y=s.getLength();let m,g;for(let o=t,a=n;o<a-1;o++)if(m=o,g=o+1,i===1/0||!lt(e,m,g,i))if((o-t)%2==1&&(m+=2*r,g+=2*r),p){let t=s.currentIndex;s[t++]=m+r,s[t++]=g,s[t++]=m,s[t++]=g+r,s[t++]=g,s[t++]=m+r,s.currentIndex=t}else{let t=s.currentIndex;s[t++]=m+r,s[t++]=m,s[t++]=g,s[t++]=g,s[t++]=g+r,s[t++]=m+r,s.currentIndex=t}o&&function(t,n,e,r,i,s,o,a,u,l,h,c){let f,d=0,p=0,y=0,m=0;const g=c?[1,3,4]:[2,3,4];for(let c=s.getLength()-1;c>=o;c--){const o=s[c],v=3*o+1,b=3*o+2,w=i[3*o],M=i[v],x=i[b];d||p||(d=Math.max(i[b],i[3*s[c-3]+2]),p=Math.min(i[b],i[3*s[c-3]+2]),f=d-p);let F=y;const k=c%6;0===t?(5===k&&(m=Zl(i,s,c,w,M)),F=k===g[0]||k===g[1]||k===g[2]?y:y+m):1===t&&(k===g[0]||k===g[1]||k===g[2]?F=0:5===k?(m=Zl(i,s,c,w,M),F=m):F=m);const A=F/l*(1/(100*h))/a;let P;P=1===n?x===d?1:0:"bottom"===e?x===d?f/100/u:0:x===d?0:-f/100/u,r[2*o]=A,r[2*o+1]=P,0===k&&(y+=m)}}(a,u,l,h,e,s,y,c[0],c[1],f,d,p)}function rh(t){const n=[t[0]];let e=t[0];for(let r=1;r<t.length;r++)Array.isArray(t[r])?t[r][0]===e[0]&&t[r][1]===e[1]&&t[r][2]===e[2]||n.push(t[r]):t[r].x===e.x&&t[r].y===e.y&&t[r].z===e.z||n.push(t[r]),e=t[r];return n}const ih=ga.getInstance();function sh(t,n,e,r,i,s,o,a,u,l,h,c,f,d,p,v){void 0===n.top&&(n.top=!0),void 0===n.side&&(n.side=!0),ih.reset();const{altitudeScale:b,altitudeProperty:w,defaultAltitude:M,heightProperty:x,minHeightProperty:F,defaultHeight:A,tangent:P,uv:S,topUVMode:O,sideUVMode:C,sideVerticalUVMode:E,top:I,side:$,textureYOrigin:T,topThickness:D}=n,z=function(t,n,{altitudeScale:e,altitudeProperty:r,defaultAltitude:i,heightProperty:s,minHeightProperty:o,defaultHeight:a},{center:u,side:l,top:h,topThickness:c,uvOrigin:f,uv:d,uvSize:p,topUVMode:y,sideUVMode:m,sideVerticalUVMode:g,textureYOrigin:v,tileRatio:b,centimeterToPoint:w,verticalCentimeterToPoint:M,positionType:x,res:F,glScale:A,projectionCode:P},S,_){let O=n/t[0].extent;n===1/0&&(O=1);const C=n===1/0,E=_.get(),I=_.get(),$=_.get(),T=_.getProxy(),D=_.get(),z=_.get(),j=_.get(),U=!!d,N=!!h,L=!!l,R=U?_.get():null;function V(t,e,r,i,s,o){let a=e;if(N){const i=Ce(T,r,3);if(0===i.length)return e;let l=T.getLength(),h=D.currentIndex;for(let t=0;t<l;t++)D[h++]=T[t];if(D.currentIndex=h,e+=T.getLength(),o)for(let n=2,e=i.length;n<e;n+=3)i[n]+=t/3,i[n-1]+=t/3,i[n-2]+=t/3;else{let n;for(let e=2,r=i.length;e<r;e+=3)n=i[e-1],i[e-1]=i[e]+t/3,i[e]=n+t/3,i[e-2]+=t/3}l=i.length,h=z.currentIndex;for(let t=0;t<l;t++)z[h++]=i[t];z.currentIndex=h,U&&Yl(y||0,t,e,R,D,f,w,b,p[0],p[1],s,F,A,P,u),c>0&&!L&&(e=nh(D,T,r,z,e,R,0,c,n,U,m||0,g||0,v,p,b,M,o)),j.setLength(e/3),j.fill(1,a/3,e/3)}if(L){N&&(c=0),a=e,e=nh(D,T,r,z,e,R,c,i,n,U,m||0,g||0,v,p,b,M,o),j.setLength(e/3);const t=T.getLength()/3;j.fill(1,a/3,a/3+t),j.fill(0,a/3+t,a/3+2*t),j.fill(1,a/3+2*t,a/3+3*t),j.fill(0,a/3+3*t,e/3)}return e}let H=0,q=0;const G=[-1,-1,n+1,n+1];let J=0,W=t.length;k(S)&&(J=S,W=S+1);let B=0,X=!1;const Y=_.getProxy();for(;J<W;J++){const u=t[J],l=u.id;k(l)&&(Math.abs(l)>B&&(B=Math.abs(l)),l<0&&(X=!0));const h=u.geometry,c=u.properties[th];let f=Array.isArray(c&&c[0]&&c[0][0])?c[0]:c;const{altitude:d,height:p}=wl.getFeaAltitudeAndHeight(u,e,r,i,s,a,o);H=Math.max(Math.abs(d),H);const y=D.getLength();let m=0,g=q;Y.setLength(0),T.setLength(0);const v=wl.calculateSignedArea(h[0])<0;for(let t=0,e=h.length;t<e;t++){let r=h[t];v&&(r=r.reverse()),r=rh(r);const i=wl.calculateSignedArea(r)<0;if(!i&&t>0&&(m++,f=c&&c[m],q=V(g,q,Y,p*O,f,C),T.setLength(0),Y.setLength(0),g=q),n!==1/0&&(r=wl.clipPolygon(r,G)),!r.length){t===e-1&&(q=V(g,q,Y,p*O,f,C));continue}const s=r.length;if(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]),i){let t=Y.currentIndex;Y[t++]=T.getLength()/3,Y.currentIndex=t}ut(T,T.getLength(),r,O,d,!1,x),t===e-1&&(q=V(g,q,Y,p*O,f,C))}const b=D.getLength()-y,w=(Ql+"").trim();for(let t=0;t<b/3;t++){let t=I.currentIndex;I[t++]=void 0===u[w]?J:u[w],I.currentIndex=t,t=E.currentIndex,E[t++]=J,E.currentIndex=t,k(l)&&(t=$.currentIndex,$[t++]=l,$.currentIndex=t)}}const K=wl.getUnsignedArrayType(I.getLength()?I[I.getLength()-1]:0),Z={maxAltitude:H,vertices:D,verticeTypes:j,indices:z,pickingIds:ga.createTypedArray(I,K),featureIndexes:E};if($.getLength()){const t=X?wl.getPosArrayType(B):wl.getUnsignedArrayType(B);Z.featureIds=ga.createTypedArray($,t)}else Z.featureIds=[];return R&&(R.setLength(D.getLength()/3*2),Z.uvs=R),Z}(t,e,{altitudeScale:b,altitudeProperty:w,defaultAltitude:M||0,heightProperty:x,minHeightProperty:F,defaultHeight:A||0},{center:v,top:I,side:$,topThickness:10*D||0,uv:S||P,uvSize:[i,i],uvOrigin:r,topUVMode:O,sideUVMode:C,sideVerticalUVMode:E,textureYOrigin:T,tileRatio:a,centimeterToPoint:u,verticalCentimeterToPoint:l,positionType:p,res:s,glScale:o,projectionCode:f},d,ih),j=[],U=z.vertices.getLength()/3,N=wl.getIndexArrayType(U),L=ga.createTypedArray(z.indices,N);delete z.indices,j.push(L.buffer,z.pickingIds.buffer);const R=wl.getPosArrayType(Math.max(512,z.maxAltitude));z.vertices=ga.createTypedArray(z.vertices,R);const V=P?ih.getProxy():new Float32Array(3*U);V.setLength&&V.setLength(3*U);const H=Jn(z.vertices,L,V);let q=!0;const G=H.getLength?H.getLength():H.length;for(let t=0;t<G;t++){H[t]=-H[t];const n=H[t]%1;1-Math.abs(n)>1e-6?q=!1:0!==n&&(H[t]=Math.round(H[t]))}if(z.normals=H,P){let t=ih.get();t.setLength(4*U),t=function(t,n,e,r,i){const s=(t.getLength?t.getLength():t.length)/3,o=i||new Array(4*s),a=[],u=[];for(let t=0;t<s;t++)a[t]=[0,0,0],u[t]=[0,0,0];const l=[0,0,0],h=[0,0,0],c=[0,0,0],f=[0,0],d=[0,0],p=[0,0],y=[0,0,0],m=[0,0,0];function g(n,r,i){ne(l,t,3*n),ne(h,t,3*r),ne(c,t,3*i),ee(f,e,2*n),ee(d,e,2*r),ee(p,e,2*i);const s=h[0]-l[0],o=c[0]-l[0],g=h[1]-l[1],v=c[1]-l[1],b=h[2]-l[2],w=c[2]-l[2],M=d[0]-f[0],x=p[0]-f[0],F=d[1]-f[1],k=p[1]-f[1],A=1/(M*k-x*F);_n(y,(k*s-F*o)*A,(k*g-F*v)*A,(k*b-F*w)*A),_n(m,(M*o-x*s)*A,(M*v-x*g)*A,(M*w-x*b)*A),On(a[n],a[n],y),On(a[r],a[r],y),On(a[i],a[i],y),On(u[n],u[n],m),On(u[r],u[r],m),On(u[i],u[i],m)}for(let t=0,n=r.length;t<n;t+=3)g(r[t+0],r[t+1],r[t+2]);const v=[],b=[],w=[],M=[];let x,F,k;function A(t){ne(w,n,3*t),Sn(M,w),F=a[t],Sn(v,F),$n(v,v,function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t}(w,w,En(w,F))),Cn(v,v),In(b,M,F),k=En(b,u[t]),x=k<0?-1:1,o[4*t]=v[0],o[4*t+1]=v[1],o[4*t+2]=v[2],o[4*t+3]=x}for(let t=0,n=r.length;t<n;t+=3)A(r[t+0]),A(r[t+1]),A(r[t+2]);return o}(z.vertices,z.normals,z.uvs,L,t),t=function(t,n){const e=n.getLength(),r=new Float32Array(e),i=[],s=[],o=[];for(let a=0;a<e;a+=4){const e=a/4*3;Ie(s,t[e]||0,t[e+1]||0,t[e+2]||0),ze(i,n[a]||0,n[a+1]||0,n[a+2]||0,n[a+3]||0),qn(o,s,i),De(r.subarray(a,a+4),o)}return r}(z.normals,t),z.tangents=t,j.push(t.buffer),delete z.normals}if(z.normals&&(q&&(z.normals=ga.createTypedArray(z.normals,Int8Array)),j.push(z.normals.buffer)),z.uvs){const t=z.uvs;z.uvs=ga.createTypedArray(t,Float32Array),j.push(z.uvs.buffer)}const J=function(t,n,e,r){const i={},s={},o=r.getLength();if(_(n.polygonFill)){let a=g(n.polygonFill);const u=new Uint8Array(4*o);u.fill(255);for(let n=0;n<o;n++){const s=t[r[n]],o=s.properties||{};o.$layer=s.layer,o.$type=s.type;let l=a(e,o);y(l)&&(i.aColor=1,a=g(l),l=a(e,o)),delete o.$layer,delete o.$type,Dr.normalizeColor(oh,l),u[4*n]=oh[0],u[4*n+1]=oh[1],u[4*n+2]=oh[2],u[4*n+3]=oh[3]}s.aColor=u}if(_(n.polygonOpacity)){let a=m(n.polygonOpacity);const u=new Uint8Array(o);u.fill(255);for(let n=0;n<o;n++){const s=t[r[n]],o=s.properties||{};o.$layer=s.layer,o.$type=s.type;let l=a(e,o);y(l)&&(i.aOpacity=1,a=g(l),l=a(e,o)),delete o.$layer,delete o.$type,u[n]=255*l}s.aOpacity=u}return s.dynamicAttributes=i,s}(t,h,c,z.featureIndexes),W=function(t,n,e,r,i){const s=[[],[]],o=_(r.topPolygonFill),a=_(r.bottomPolygonFill),u=[255,255,255,255],l=n.getLength();if(o||a){let h=o&&g(r.topPolygonFill),c=a&&g(r.bottomPolygonFill),f=null,d=null,p=null,m=null;for(let r=0;r<l;r++){if(1===t[r]&&!o||0===t[r]&&!a)continue;const l=1===t[r];if(l&&n[r]===f){t[r]=p;continue}if(!l&&n[r]===d){t[r]=m;continue}const v=e[n[r]],b=v.properties||{};b.$layer=v.layer,b.$type=v.type;let w=l?h:c,M=w(i,b);y(M)&&(w=g(M),M=w(i,b)),delete b.$layer,delete b.$type,Dr.normalizeColor(oh,M),je(oh,oh,u);let x=ah(s,oh);x<0&&(x=s.length,s.push(De([],oh))),t[r]=x,l?(f=n[r],p=x):(d=n[r],m=x)}}return s.slice(2)}(z.verticeTypes,z.featureIndexes,t,h,c),B={data:{data:{aVertexColorType:W.length<=252?ga.createTypedArray(z.verticeTypes,Uint8Array):ga.createTypedArray(z.verticeTypes,Uint16Array),aPosition:z.vertices,aNormal:z.normals,aTexCoord0:z.uvs,aTangent:z.tangents,aPickingId:z.pickingIds},indices:L,properties:{maxAltitude:z.maxAltitude},dynamicAttributes:J.dynamicAttributes,vertexColors:W},buffers:j};return z.featureIds.length?(B.data.featureIds=z.featureIds,j.push(B.data.featureIds.buffer)):B.data.featureIds=[],J.aColor&&(B.data.data.aColor=J.aColor,B.buffers.push(J.aColor.buffer)),J.aOpacity&&(B.data.data.aOpacity=J.aOpacity,B.buffers.push(J.aOpacity.buffer)),B.buffers.push(B.data.data.aPosition.buffer),B.data.pickingIdIndiceMap=wl.generatePickingIndiceIndex(B.data.data.aPickingId,B.data.indices),B}const oh=[];function ah(t,n){for(let e=0;e<t.length;e++)if(Ne(n,t[e]))return e;return-1}function uh(t,n,e,r,{altitudeScale:i,altitudeProperty:s,defaultAltitude:o,heightProperty:a,minHeightProperty:u,defaultHeight:l,bottom:h}){const c=h,f=n/t[0].extent,d=2*function(t,n){let e=0;for(let n=0,r=t.length;n<r;n++){const r=t[n];if(k(r.geometry[0][0]))e+=3*r.geometry.length;else for(let t=0,n=r.geometry.length;t<n;t++){let n=3*r.geometry[t].length;3===r.type&&(n-=3),e+=n}}return e}(t)+3*t.length*2,p=[],m=new Int16Array(d),g=new Uint8Array(m.length/3*4);y(e)&&(e=ha.compileFilter(e));const v=[];function b(t,e,r){const i=e-t,s=m.subarray(t,e),o=m.subarray(e,e+i);o.set(s);for(let t=2,n=o.length;t<n;t+=3)o[t]=s[t]-r;const a=t/3,u=i/3;let l,h;for(let t=a,e=u+a;t<e;t++)t<e-1?(l=t,h=t+1):(l=t,h=a),lt(m,l,h,n)||(v.push(l,h),c&&v.push(l+u,h+u),lh(m,l,n)||v.push(l,l+u));return e+i}let w=0,M=0;const x=(Ql+"").trim(),F=[];for(let n=0,h=t.length;n<h;n++){const h=t[n],c=h.geometry;if(e){let t;t="function"==typeof e?e(h&&h.properties):e,Dr.normalizeColor(F,t)}else Ie(F,255,255,255);const d=w/3*4,{altitude:y,height:k}=wl.getFeaAltitudeAndHeight(h,i,s,o,a,l,u);M=Math.max(Math.abs(y),M);let A=w;for(let t=0,n=c.length;t<n;t++){let n=c[t];const e=n.length;n[0][0]===n[e-1][0]&&n[0][1]===n[e-1][1]&&(n=n.slice(0,e-1)),w=ut(m,A,n,f,y),w=b(A,w,k*f),A=w}const P=A/3*4;for(let t=d;t<P;t+=4)g[t]=F[0],g[t+1]=F[1],g[t+2]=F[2],g[t+3]=255*(r||1);const S=v.length-p.length;for(let t=0;t<S;t++)p.push(h[x])}const A=v.reduce(((t,n)=>Math.max(t,n)),0),P=new(wl.getIndexArrayType(A))(v),S=wl.getUnsignedArrayType(t.length);return{aPosition:new(wl.getPosArrayType(Math.max(512,M)))(m),indices:P,aPickingId:new S(p),aColor:g}}function lh(t,n,e){const r=t[3*n],i=t[3*n+1];return r<0||r>e||i<0||i>e}function hh(t,n,e,r){const i=uh(t,n,e.lineColor,e.lineOpacity,r),s=[i.aPosition.buffer,i.indices.buffer,i.aPickingId.buffer],o=i.indices;return delete i.indices,{data:{data:i,indices:o},buffers:s}}let ch=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),ch=!0}catch(t){ch=!1}var fh=ch;const dh="__original_properties",ph="__fn-type_properties";class yh{constructor(t,n,e,r,i){this.id=t,this.options=n,this.upload=e,this.tn(n.style),this.requests={},this.Gt=r,this.nn=1,this.loadings=i}updateStyle(t,n){this.options.style=t,this.nn=t.styleCounter,this.tn(t),n()}updateOptions(t,n){this.options=x(this.options,t),n()}loadTile(t,n){const e=this.loadings,r=t.tileInfo.url,i=this.options.debugTile;if(i){const{x:e,y:r,z:s}=t.tileInfo;let o=!1;for(let t=0;t<i.length;t++)if(e===i[t].x&&r===i[t].y&&s===i[t].z){o=!0;break}if(!o)return void n()}if(e[r])return void e[r].push({context:t,callback:n,ref:this});e[r]=[{context:t,callback:n,ref:this}];const s=this.options.featureIdProperty;this.requests[r]=this.getTileFeatures(t,((n,i,o,a)=>{const u=e[r];if(delete e[r],this.checkIfCanceled(r))return delete this.requests[r],void this.en(u,null,{canceled:!0});if(delete this.requests[r],(this.options.debug||s)&&i)for(let n=0;n<i.length;n++)if(this.options.debug&&(i[n]._debug_info={index:n,id:i[n].id,tileId:t.tileInfo.id}),s){const t=P(s)?s[i[n].layer]:s,e=i[n].properties;i[n].id=e&&e[t]||null}if(n)this.en(u,n);else if(i&&i.length){if(u)for(let t=0;t<u.length;t++)this.rn.call(u[t].ref,u[t].context,u[t].callback,r,o,i,a)}else this.en(u)}))}rn(t,n,e,r,i,s){this.sn(r,i,t).then((e=>{e.canceled?n(null,{canceled:!0}):(e.data.styleCounter=t.styleCounter,s&&x(e.data,s),n(null,e.data,e.buffers))})).catch((t=>{n(t)}))}abortTile(t,n){delete this.requests[t],this.an(t),n()}an(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]}en(t,n,e){if(t)for(let r=0;r<t.length;r++)t[r].callback(n,e)}checkIfCanceled(t){return!this.requests[t]}onRemove(){this.loadings={},delete this.Gt,this.requests={}}fetchIconGlyphs(t,n,e){if(this.options.workerGlyph&&fh){const r=[];if(t&&Object.keys(t).length){const n=new Promise((n=>{this.upload("fetchIconGlyphs",{icons:t},null,((t,e)=>{n({err:t,iconData:e})}))}));r.push(n)}if(n&&Object.keys(n).length){const t=new Promise((t=>{this.un||(this.un=new vl),this.un.getGlyphs(n,((n,e)=>{t({err:n,glyphData:e})}))}));r.push(t)}Promise.all(r).then((t=>{const n={icons:null,glyphs:null};for(let r=0;r<t.length;r++){if(t[r].err)return void e(t[r].err);t[r].iconData?n.icons=t[r].iconData.icons:t[r].glyphData&&(n.glyphs=t[r].glyphData.glyphs)}return n})).then((t=>{e(null,t)}))}else this.upload("fetchIconGlyphs",{icons:t,glyphs:n},null,e)}sn(t,n,e){if(!n.length)return Promise.resolve({data:null,buffers:[]});const{glScale:r,tileInfo:i}=e,s=!this.options.style.style.length&&!this.options.style.featureStyle.length;let o=this.pluginConfig.slice(0);s&&(o=this.hn(t)),this.featurePlugins&&function(t){for(let n=1;n<arguments.length;n++){const e=arguments[n];if(e)for(let n=0,r=e.length;n<r;n++)t.push(e[n])}t.length}(o,this.featurePlugins);const a={};for(let t=0;t<o.length;t++)xh(n,e.tileInfo.z,o[t],a);const u=[],l=[];for(let t=0;t<n.length;t++){const e=n[t],r=a[t];if(r){l.fill(null);let t=0;for(const n in r){let i=0;const s=r[n].values();for(const t of s){let r=l[i];r||(r=Ph(e),l[i]=r),r.properties[n]=t,i++}i>t&&(t=i)}for(let n=0;n<t;n++)u.push(l[n])}else u.push(e)}const h=(n=u)[0].extent,c=i.z,f={x:i.extent2d.xmin*r,y:i.extent2d.ymax*r},d=[],p=[],y=[],m=this.options,g=[],v={},b=[Promise.resolve(e.styleCounter)];let w=0,M=-1;const F=[];let k=!1;for(let t=0;t<o.length;t++){M++;const r=o[t];r.type!==w&&(M=0,w=r.type);const a=0===r.type?d:p;if(r.symbol&&!1===r.symbol.visible){a[M]=null;continue}Oh(r.symbol,F,t),k=k||F[t]&&F[t].size>0;const{tileFeatures:u,tileFeaIndexes:l}=this.cn(c,r.type,r.filter,n,v,t);if(!u.length){a[M]=null;continue}const m=l[l.length-1],A=wl.getIndexArrayType(m);a[M]={styledFeatures:new A(l)},y.push({idx:t,typeIdx:M}),g.push(a[M].styledFeatures.buffer);const P=x({},e,{extent:h,zoom:c,tilePoint:f});if(this.options.debugTile){const t=this.options.debugTile;for(let n=0;n<t.length;n++){const{x:e,y:r,z:s}=t[n];if(i.x===e&&i.y===r&&i.z===s){P.debugIndex=t[n].index;break}}}let S=this.dn(u,r,P);s&&(S=S.then((t=>{if(!t)return null;if(t.data)t.data.layer=u[0].layer;else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]&&t[n].data&&(t[n].data.layer=u[0].layer);return t}))),b.push(S)}return Promise.all(b).then((([e,...r])=>{if(e!==this.nn)return{canceled:!0};function i(t,n){if(void 0===t.data.ref&&(t.data.type=o[y[n].idx].renderPlugin.dataConfig.type,t.data.filter=o[y[n].idx].filter.def,t.buffers&&t.buffers.length))for(let n=0;n<t.buffers.length;n++)g.push(t.buffers[n])}for(let t=0;t<r.length;t++){if(!r[t])continue;const n=r[t],e=0===o[y[t].idx].type?d:p;if(Array.isArray(n)){const r=[];for(let e=0;e<n.length;e++)n[e]&&(i(n[e],t),(void 0===n[e].data.ref||n[n[e].data.ref])&&r.push(n[e].data));r.length&&(e[y[t].typeIdx].data=r)}else i(n,t),e[y[t].typeIdx].data=n.data}const s={},a=t;if(m.features||m.schema||k){let t,e=!1;for(let r=0,i=n.length;r<i;r++)if(t=n[r],a[t.layer].properties||(a[t.layer].properties=vh(t.properties)),t&&(m.features||k&&v[r]))if("id"===m.features)s[r]=t.id;else{m.pickingGeometry||delete t.geometry,delete t.extent,delete t.properties.$layer,delete t.properties.$type,delete t.__index;const n=t.originalFeature;if(n){const n=t.properties,e=x({},t.originalFeature);delete n[dh],e.customProps=x({},n),t=e}const i=x({},t);if(k&&v[r]&&(!m.features||"transient"===m.features)){const i=v[r];for(let r=0;r<i.length;r++){const i=F[r];i&&i.forEach((r=>{const i=n?n.properties:t.properties;i[ph]||(i[ph]=new Set),i[ph].add(r),e=!0}))}}s[r]=i}if(e)for(const t in s){const n=s[t],e=n.properties[ph];if(e){delete n.properties[ph],"transient"===m.features&&(n.fnTypeProps=x({},n.properties));for(const t in n.properties)e.has(t)||("transient"===m.features?delete n.fnTypeProps[t]:delete n.properties[t])}}}return{data:{styleCounter:e,schema:a,data:d,featureData:p,extent:h,features:s},buffers:g}})).catch((t=>{console.error(t)}))}dn(t,n,e){let r=t;const i=n.renderPlugin.dataConfig,s=n.symbol,o=this.options.tileSize,{extent:a,glScale:u,zScale:l,zoom:h,tilePoint:c,centimeterToPoint:f,verticalCentimeterToPoint:d}=e,p=a/o,y=i.type,m=e.debugIndex;let g=x({},i,{EXTENT:a,zoom:h,debugIndex:m,features:this.options.features});if("3d-extrusion"===y){bh(s)&&(i.uv=1);const t=this.options.projectionCode,n=s.material&&s.material.textureWidth||23.25;return Promise.all([Promise.resolve(sh(r,i,a,c,n,e.tileInfo.res,u,a/this.options.tileSize,f,d,s,h,t,m))])}if("3d-wireframe"===y)return Promise.all([Promise.resolve(hh(r,a,s,i))]);if("point"===y){g=x(g,{requestor:this.fetchIconGlyphs.bind(this),altitudeToTileScale:l*a/this.options.tileSize/u});const t=ku.splitPointSymbol(s),n=Pa.genFnTypes(t[0]);return ku.needMerge(t[0],n,h)&&(r=ku.mergeLineFeatures(r,t[0],n,h)),Promise.all(t.map(((t,e)=>(0===e?g.fnTypes=n:delete g.fnTypes,new ku(r,t,g).load(p)))))}if("native-point"===y){const t=l*a/this.options.tileSize/u;return g.altitudeToTileScale=t,wh(r,s,g,Hu,a/o)}if("line"===y)return g=x(g,{requestor:this.fetchIconGlyphs.bind(this),tileRatio:p}),wh(r,s,g,Iu,1,!0);if("native-line"===y)return wh(r,s,g,Ru,1,!0);if("fill"===y)return g=x(g,{requestor:this.fetchIconGlyphs.bind(this)}),wh(r,s,g,Ku);if("line-extrusion"===y){delete s.lineGradientProperty,s.lineJoin="miter",s.lineCap="butt";const t=bh(s);if(t&&(i.uv=1),g=x(g,{tileSize:o,zScale:l,glScale:u}),s.mergeOnProperty){const t=Pa.genFnTypes(s);r=Iu.mergeLineFeatures(r,s,t,g.zoom)}if(t){const t=[];if(!1!==i.top){const n=x({},g);n.side=!1,t.push(new Nu(r,s,n))}return!1!==i.side&&(g.side=!0,g.top=!1,t.push(new Nu(r,s,g))),Promise.all(t.map((t=>t.load())))}return Promise.all([new Nu(r,s,g).load()])}if("circle"===y)return wh(r,s,g,Qu);if("round-tube"===y||"square-tube"===y){const t="round-tube"===y?tl:ol;return g=x(g,{requestor:this.fetchIconGlyphs.bind(this),radialSegments:"round-tube"===y?i.radialSegments||8:4,centimeterToPoint:f,verticalCentimeterToPoint:d,tileRatio:p,isTube:!0}),wh(r,s,g,t)}return Promise.resolve([])}cn(t,n,e,r,i,s){const o=(Ql+"").trim(),a=[],u=[],l=r.length;for(let h=0;h<l;h++)if((1===n||void 0===r[h].id||!this.styledFeatures[r[h].id])&&((!e.def||"default"===e.def)&&!i[h]||!0===e.def||e.def&&(void 0!==e.def.condition||Array.isArray(e.def))&&e(r[h],t))){const t=r[h];if(void 0===t[o]&&(t[o]=h),i[h]||(i[h]=[]),i[h].push(s),u.push(t),a.push(h),1===n)break}return{tileFeatures:u,tileFeaIndexes:a}}tn(t){const{style:n,featureStyle:e}=t,r={};e.forEach((t=>{Array.isArray(t.id)?(t.id.forEach((t=>{r[t]=1})),t.filter=["in","$id",...t.id]):(r[t.id]=1,t.filter=["==","$id",t.id])}));const i=ha.compileStyle(n);for(let t=0;t<n.length;t++)i[t].filter&&(i[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0),i[t].type=0;const s=[],o=ha.compileStyle(e);for(let t=0;t<e.length;t++)o[t].type=1,o[t].filter.def=e[t].filter?e[t].filter.value||e[t].filter:void 0,o[t].renderPlugin&&s.push(o[t]);this.pluginConfig=i,this.featurePlugins=s,this.styledFeatures=r}hn(t){let n=this.pn;this.pn||(n=this.pn={});const e=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],r=[];for(const i in t){const s=i;if(!n[i]){const r=[];for(let n=0;n<t[i].types.length;n++){const o=t[i].types[n],a=["all",["==","$layer",s],["==","$type",e[o]]],u={filter:ln(a),renderPlugin:mh(o),symbol:gh(o)};u.filter.def=a,u.type=0,r.push(u)}n[s]=r}r.push(...n[s])}return r}}function mh(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 gh(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 vh(t){if(Array.isArray(t)||!P(t))return{};const n={};for(const e in t){const r=t[e];F(r)?n[e]="string":k(r)?n[e]="number":!0===r||!1===r?n[e]="boolean":Array.isArray(r)?n[e]="array":n[e]="object"}return n}function bh(t){if(!t)return 0;let n=0;for(const e in t){if(("normalTexture"===e||"bumpTexture"===e)&&t[e])return 2;if(e.indexOf("Texture")>0&&t[e])n=1;else if(P(t[e])){const r=bh(t[e]);if(2===r)return r;1===r&&(n=1)}}return n}function wh(t,n,e,r,i,s){const o={},a=Array.isArray(n)?n:[n];let u=-1;for(let t=0;t<a.length;t++)o[t]=Mh(a[t]),!o[t]&&a[t]&&-1===u&&(u=t);const l=[];for(let n=0;n<a.length;n++){if(!a[n])continue;a[n].index={index:n};let h=t;if(s&&a[n].mergeOnProperty){const r=Pa.genFnTypes(a[n]);h=Iu.mergeLineFeatures(t,a[0],r,e.zoom)}o[n]||n===u?l.push(new r(h,a[n],e).load(i)):l.push({data:{ref:u,symbolIndex:{index:n}}})}return Promise.all(l)}function Mh(t){if(!t)return 0;for(const n in t)if(_(t[n]))return 1;return 0}function xh(t,n,e,r){const i=e.customProperties;if(!i)return t;if(i)for(let t=0;t<i.length;t++)i[t].fn=ha.compileFilter(i[t].filter);for(let e=0;e<i.length;e++)for(let s=0,o=t.length;s<o;s++)if(i[e].fn(t[s],n))for(const t in i[e].properties){const n=i[e].properties[t];S(n)||(r[s]||(r[s]={}),r[s][t]||(r[s][t]=new Set),r[s][t].add(n))}}const Fh={get:(t,n)=>n in t?t[n]:t.originalFeature[n],has:(t,n)=>n in t||n in t.originalFeature},kh={get:function(t,n){return n in t?t[n]:t[dh][n]},has:(t,n)=>n in t||n in t[dh]},Ah={};function Ph(t){const n={};n.originalFeature=t;const e=new Proxy(n,Fh);return e.properties=new Proxy({},kh),e.properties[dh]=t.properties||Ah,e}function Sh(t,n,e){t[n]||(t[n]=new Set),t[n].add(e)}const _h=[];function Oh(t,n,e){if(!t)return _h;for(const r in t){if(!t[r]||!Dr.checkIfZoomFnTypeSymbol(r))continue;if(_(t[r]))Sh(n,e,t[r].property);else{if("lineGradientProperty"===r){Sh(n,e,t[r]);continue}if("textName"===r)if(F(t[r])){const i=Da.resolveVarNames(t[r]);if(i)for(let t=0;t<i.length;t++)Sh(n,e,i[t])}else if(ha.isExpression(t[r])){const i=[];Da.resolveExpVarNames(i,t[r]);for(let t=0;t<i.length;t++)Sh(n,e,i[t])}}const i=t[r].stops;if(i&&i.length)for(let t=0;t<i.length;t++)_(i[t][1])&&Sh(n,t,i[t][1].property)}return n[e]}function Ch(t,n){Eh(t.geometry,n)}function Eh(t,n){if(t)switch(t.type){case"Point":Ih(t.coordinates,n);break;case"MultiPoint":case"LineString":$h(t.coordinates,n);break;case"MultiLineString":!function(t,n){for(let e=0,r=t.length;e<r;e++)$h(t[e],n)}(t.coordinates,n);break;case"Polygon":Th(t.coordinates,n);break;case"MultiPolygon":!function(t,n){for(let e=0,r=t.length;e<r;e++)Th(t[e],n)}(t.coordinates,n);break;case"GeometryCollection":const e=t.geometries.length;for(let r=0;r<e;r++)Eh(t.geometries[r],n)}}function Ih(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 $h(t,n){for(let e=0,r=t.length;e<r;e++)Ih(t[e],n)}function Th(t,n){t.length&&$h(t[0],n)}function Dh(t,n,e,r,i){zh(t,n,e||0,r||t.length-1,i||Uh)}function zh(t,n,e,r,i){for(;r>e;){if(r-e>600){var s=r-e+1,o=n-e+1,a=Math.log(s),u=.5*Math.exp(2*a/3),l=.5*Math.sqrt(a*u*(s-u)/s)*(o-s/2<0?-1:1);zh(t,n,Math.max(e,Math.floor(n-o*u/s+l)),Math.min(r,Math.floor(n+(s-o)*u/s+l)),i)}var h=t[n],c=e,f=r;for(jh(t,e,n),i(t[r],h)>0&&jh(t,e,r);c<f;){for(jh(t,c,f),c++,f--;i(t[c],h)<0;)c++;for(;i(t[f],h)>0;)f--}0===i(t[e],h)?jh(t,e,f):jh(t,++f,r),f<=n&&(e=f+1),n<=f&&(r=f-1)}}function jh(t,n,e){var r=t[n];t[n]=t[e],t[e]=r}function Uh(t,n){return t<n?-1:t>n?1:0}class Nh{constructor(t=9){this.yn=Math.max(4,t),this.mn=Math.max(2,Math.ceil(.4*this.yn)),this.clear()}all(){return this.gn(this.data,[])}search(t){let n=this.data;const e=[];if(!Kh(t,n))return e;const r=this.toBBox,i=[];for(;n;){for(let s=0;s<n.children.length;s++){const o=n.children[s],a=n.leaf?r(o):o;Kh(t,a)&&(n.leaf?e.push(o):Yh(t,a)?this.gn(o,e):i.push(o))}n=i.pop()}return e}collides(t){let n=this.data;if(!Kh(t,n))return!1;const e=[];for(;n;){for(let r=0;r<n.children.length;r++){const i=n.children[r],s=n.leaf?this.toBBox(i):i;if(Kh(t,s)){if(n.leaf||Yh(t,s))return!0;e.push(i)}}n=e.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this.mn){for(let n=0;n<t.length;n++)this.insert(t[n]);return this}let n=this.vn(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this.bn(this.data,n);else{if(this.data.height<n.height){const t=this.data;this.data=n,n=t}this.wn(n,this.data.height-n.height-1,!0)}else this.data=n;return this}insert(t){return t&&this.wn(t,this.data.height-1),this}clear(){return this.data=Zh([]),this}remove(t,n){if(!t)return this;let e=this.data;const r=this.toBBox(t),i=[],s=[];let o,a,u;for(;e||i.length;){if(e||(e=i.pop(),a=i[i.length-1],o=s.pop(),u=!0),e.leaf){const r=Lh(t,e.children,n);if(-1!==r)return e.children.splice(r,1),i.push(e),this.Mn(i),this}u||e.leaf||!Yh(e,r)?a?(o++,e=a.children[o],u=!1):e=null:(i.push(e),s.push(o),o=0,a=e,e=e.children[0])}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}gn(t,n){const e=[];for(;t;)t.leaf?n.push(...t.children):e.push(...t.children),t=e.pop();return n}vn(t,n,e,r){const i=e-n+1;let s,o=this.yn;if(i<=o)return s=Zh(t.slice(n,e+1)),Rh(s,this.toBBox),s;r||(r=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,r-1))),s=Zh([]),s.leaf=!1,s.height=r;const a=Math.ceil(i/o),u=a*Math.ceil(Math.sqrt(o));Qh(t,n,e,u,this.compareMinX);for(let i=n;i<=e;i+=u){const n=Math.min(i+u-1,e);Qh(t,i,n,a,this.compareMinY);for(let e=i;e<=n;e+=a){const i=Math.min(e+a-1,n);s.children.push(this.vn(t,e,i,r-1))}}return Rh(s,this.toBBox),s}xn(t,n,e,r){for(;r.push(n),!n.leaf&&r.length-1!==e;){let e,r=1/0,i=1/0;for(let s=0;s<n.children.length;s++){const o=n.children[s],a=Jh(o),u=Bh(t,o)-a;u<i?(i=u,r=a<r?a:r,e=o):u===i&&a<r&&(r=a,e=o)}n=e||n.children[0]}return n}wn(t,n,e){const r=e?t:this.toBBox(t),i=[],s=this.xn(r,this.data,n,i);for(s.children.push(t),Hh(s,r);n>=0&&i[n].children.length>this.yn;)this.Fn(i,n),n--;this.kn(r,i,n)}Fn(t,n){const e=t[n],r=e.children.length,i=this.mn;this.An(e,i,r);const s=this.Pn(e,i,r),o=Zh(e.children.splice(s,e.children.length-s));o.height=e.height,o.leaf=e.leaf,Rh(e,this.toBBox),Rh(o,this.toBBox),n?t[n-1].children.push(o):this.bn(e,o)}bn(t,n){this.data=Zh([t,n]),this.data.height=t.height+1,this.data.leaf=!1,Rh(this.data,this.toBBox)}Pn(t,n,e){let r,i=1/0,s=1/0;for(let o=n;o<=e-n;o++){const n=Vh(t,0,o,this.toBBox),a=Vh(t,o,e,this.toBBox),u=Xh(n,a),l=Jh(n)+Jh(a);u<i?(i=u,r=o,s=l<s?l:s):u===i&&l<s&&(s=l,r=o)}return r||e-n}An(t,n,e){const r=t.leaf?this.compareMinX:qh,i=t.leaf?this.compareMinY:Gh;this.Sn(t,n,e,r)<this.Sn(t,n,e,i)&&t.children.sort(r)}Sn(t,n,e,r){t.children.sort(r);const i=this.toBBox,s=Vh(t,0,n,i),o=Vh(t,e-n,e,i);let a=Wh(s)+Wh(o);for(let r=n;r<e-n;r++){const n=t.children[r];Hh(s,t.leaf?i(n):n),a+=Wh(s)}for(let r=e-n-1;r>=n;r--){const n=t.children[r];Hh(o,t.leaf?i(n):n),a+=Wh(o)}return a}kn(t,n,e){for(let r=e;r>=0;r--)Hh(n[r],t)}Mn(t){for(let n,e=t.length-1;e>=0;e--)0===t[e].children.length?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():Rh(t[e],this.toBBox)}}function Lh(t,n,e){if(!e)return n.indexOf(t);for(let r=0;r<n.length;r++)if(e(t,n[r]))return r;return-1}function Rh(t,n){Vh(t,0,t.children.length,n,t)}function Vh(t,n,e,r,i){i||(i=Zh(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let s=n;s<e;s++){const n=t.children[s];Hh(i,t.leaf?r(n):n)}return i}function Hh(t,n){return t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),t}function qh(t,n){return t.minX-n.minX}function Gh(t,n){return t.minY-n.minY}function Jh(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Wh(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Bh(t,n){return(Math.max(n.maxX,t.maxX)-Math.min(n.minX,t.minX))*(Math.max(n.maxY,t.maxY)-Math.min(n.minY,t.minY))}function Xh(t,n){const e=Math.max(t.minX,n.minX),r=Math.max(t.minY,n.minY),i=Math.min(t.maxX,n.maxX),s=Math.min(t.maxY,n.maxY);return Math.max(0,i-e)*Math.max(0,s-r)}function Yh(t,n){return t.minX<=n.minX&&t.minY<=n.minY&&n.maxX<=t.maxX&&n.maxY<=t.maxY}function Kh(t,n){return n.minX<=t.maxX&&n.minY<=t.maxY&&n.maxX>=t.minX&&n.maxY>=t.minY}function Zh(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Qh(t,n,e,r,i){const s=[n,e];for(;s.length;){if((e=s.pop())-(n=s.pop())<=r)continue;const o=n+Math.ceil((e-n)/r/2)*r;Dh(t,o,n,e,i),s.push(n,o,o,e)}}var tc={exports:{}},nc=function(t,n,e,r){var i=t[0],s=t[1],o=!1;void 0===e&&(e=0),void 0===r&&(r=n.length);for(var a=(r-e)/2,u=0,l=a-1;u<a;l=u++){var h=n[e+2*u+0],c=n[e+2*u+1],f=n[e+2*l+0],d=n[e+2*l+1];c>s!=d>s&&i<(f-h)*(s-c)/(d-c)+h&&(o=!o)}return o},ec=function(t,n,e,r){var i=t[0],s=t[1],o=!1;void 0===e&&(e=0),void 0===r&&(r=n.length);for(var a=r-e,u=0,l=a-1;u<a;l=u++){var h=n[u+e][0],c=n[u+e][1],f=n[l+e][0],d=n[l+e][1];c>s!=d>s&&i<(f-h)*(s-c)/(d-c)+h&&(o=!o)}return o};tc.exports=function(t,n,e,r){return n.length>0&&Array.isArray(n[0])?ec(t,n,e,r):nc(t,n,e,r)};var rc=tc.exports.nested=ec;tc.exports.flat=nc;const ic=11102230246251565e-32,sc=134217729,oc=(3+8*ic)*ic;function ac(t,n,e,r,i){let s,o,a,u,l=n[0],h=r[0],c=0,f=0;h>l==h>-l?(s=l,l=n[++c]):(s=h,h=r[++f]);let d=0;if(c<t&&f<e)for(h>l==h>-l?(o=l+s,a=s-(o-l),l=n[++c]):(o=h+s,a=s-(o-h),h=r[++f]),s=o,0!==a&&(i[d++]=a);c<t&&f<e;)h>l==h>-l?(o=s+l,u=o-s,a=s-(o-u)+(l-u),l=n[++c]):(o=s+h,u=o-s,a=s-(o-u)+(h-u),h=r[++f]),s=o,0!==a&&(i[d++]=a);for(;c<t;)o=s+l,u=o-s,a=s-(o-u)+(l-u),l=n[++c],s=o,0!==a&&(i[d++]=a);for(;f<e;)o=s+h,u=o-s,a=s-(o-u)+(h-u),h=r[++f],s=o,0!==a&&(i[d++]=a);return 0===s&&0!==d||(i[d++]=s),d}function uc(t){return new Float64Array(t)}const lc=33306690738754716e-32,hc=22204460492503146e-32,cc=11093356479670487e-47,fc=uc(4),dc=uc(8),pc=uc(12),yc=uc(16),mc=uc(4);function gc(t,n,e,r,i,s){const o=(n-s)*(e-i),a=(t-i)*(r-s),u=o-a;if(0===o||0===a||o>0!=a>0)return u;const l=Math.abs(o+a);return Math.abs(u)>=lc*l?u:-function(t,n,e,r,i,s,o){let a,u,l,h,c,f,d,p,y,m,g,v,b,w,M,x,F,k;const A=t-i,P=e-i,S=n-s,_=r-s;w=A*_,f=sc*A,d=f-(f-A),p=A-d,f=sc*_,y=f-(f-_),m=_-y,M=p*m-(w-d*y-p*y-d*m),x=S*P,f=sc*S,d=f-(f-S),p=S-d,f=sc*P,y=f-(f-P),m=P-y,F=p*m-(x-d*y-p*y-d*m),g=M-F,c=M-g,fc[0]=M-(g+c)+(c-F),v=w+g,c=v-w,b=w-(v-c)+(g-c),g=b-x,c=b-g,fc[1]=b-(g+c)+(c-x),k=v+g,c=k-v,fc[2]=v-(k-c)+(g-c),fc[3]=k;let O=function(t,n){let e=n[0];for(let r=1;r<t;r++)e+=n[r];return e}(4,fc),C=hc*o;if(O>=C||-O>=C)return O;if(c=t-A,a=t-(A+c)+(c-i),c=e-P,l=e-(P+c)+(c-i),c=n-S,u=n-(S+c)+(c-s),c=r-_,h=r-(_+c)+(c-s),0===a&&0===u&&0===l&&0===h)return O;if(C=cc*o+oc*Math.abs(O),O+=A*h+_*a-(S*l+P*u),O>=C||-O>=C)return O;w=a*_,f=sc*a,d=f-(f-a),p=a-d,f=sc*_,y=f-(f-_),m=_-y,M=p*m-(w-d*y-p*y-d*m),x=u*P,f=sc*u,d=f-(f-u),p=u-d,f=sc*P,y=f-(f-P),m=P-y,F=p*m-(x-d*y-p*y-d*m),g=M-F,c=M-g,mc[0]=M-(g+c)+(c-F),v=w+g,c=v-w,b=w-(v-c)+(g-c),g=b-x,c=b-g,mc[1]=b-(g+c)+(c-x),k=v+g,c=k-v,mc[2]=v-(k-c)+(g-c),mc[3]=k;const E=ac(4,fc,4,mc,dc);w=A*h,f=sc*A,d=f-(f-A),p=A-d,f=sc*h,y=f-(f-h),m=h-y,M=p*m-(w-d*y-p*y-d*m),x=S*l,f=sc*S,d=f-(f-S),p=S-d,f=sc*l,y=f-(f-l),m=l-y,F=p*m-(x-d*y-p*y-d*m),g=M-F,c=M-g,mc[0]=M-(g+c)+(c-F),v=w+g,c=v-w,b=w-(v-c)+(g-c),g=b-x,c=b-g,mc[1]=b-(g+c)+(c-x),k=v+g,c=k-v,mc[2]=v-(k-c)+(g-c),mc[3]=k;const I=ac(E,dc,4,mc,pc);w=a*h,f=sc*a,d=f-(f-a),p=a-d,f=sc*h,y=f-(f-h),m=h-y,M=p*m-(w-d*y-p*y-d*m),x=u*l,f=sc*u,d=f-(f-u),p=u-d,f=sc*l,y=f-(f-l),m=l-y,F=p*m-(x-d*y-p*y-d*m),g=M-F,c=M-g,mc[0]=M-(g+c)+(c-F),v=w+g,c=v-w,b=w-(v-c)+(g-c),g=b-x,c=b-g,mc[1]=b-(g+c)+(c-x),k=v+g,c=k-v,mc[2]=v-(k-c)+(g-c),mc[3]=k;const $=ac(I,pc,4,mc,yc);return yc[$-1]}(t,n,e,r,i,s,l)}function vc(t,n,e){n=Math.max(0,void 0===n?2:n),e=e||0;var r=function(t){for(var n=t[0],e=t[0],r=t[0],i=t[0],s=0;s<t.length;s++){var o=t[s];o[0]<n[0]&&(n=o),o[0]>r[0]&&(r=o),o[1]<e[1]&&(e=o),o[1]>i[1]&&(i=o)}var a=[n,e,r,i],u=a.slice();for(s=0;s<t.length;s++)rc(t[s],a)||u.push(t[s]);return function(t){t.sort(Cc);for(var n=[],e=0;e<t.length;e++){for(;n.length>=2&&kc(n[n.length-2],n[n.length-1],t[e])<=0;)n.pop();n.push(t[e])}for(var r=[],i=t.length-1;i>=0;i--){for(;r.length>=2&&kc(r[r.length-2],r[r.length-1],t[i])<=0;)r.pop();r.push(t[i])}return r.pop(),n.pop(),n.concat(r)}(u)}(t),i=new Nh(16);i.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},i.compareMinX=function(t,n){return t[0]-n[0]},i.compareMinY=function(t,n){return t[1]-n[1]},i.load(t);for(var s,o=[],a=0;a<r.length;a++){var u=r[a];i.remove(u),s=Pc(u,s),o.push(s)}var l=new Nh(16);for(a=0;a<o.length;a++)l.insert(Ac(o[a]));for(var h=n*n,c=e*e;o.length;){var f=o.shift(),d=f.p,p=f.next.p,y=Sc(d,p);if(!(y<c)){var m=y/h;(u=bc(i,f.prev.p,d,p,f.next.next.p,m,l))&&Math.min(Sc(u,d),Sc(u,p))<=m&&(o.push(f),o.push(Pc(u,f)),i.remove(u),l.remove(f),l.insert(Ac(f)),l.insert(Ac(f.next)))}}f=s;var g=[];do{g.push(f.p),f=f.next}while(f!==s);return g.push(f.p),g}function bc(t,n,e,r,i,s,o){for(var a=new xn([],wc),u=t.data;u;){for(var l=0;l<u.children.length;l++){var h=u.children[l],c=u.leaf?_c(h,e,r):Mc(e,r,h);c>s||a.push({node:h,dist:c})}for(;a.length&&!a.peek().node.children;){var f=a.pop(),d=f.node,p=_c(d,n,e),y=_c(d,r,i);if(f.dist<p&&f.dist<y&&Fc(e,d,o)&&Fc(r,d,o))return d}(u=a.pop())&&(u=u.node)}return null}function wc(t,n){return t.dist-n.dist}function Mc(t,n,e){if(xc(t,e)||xc(n,e))return 0;var r=Oc(t[0],t[1],n[0],n[1],e.minX,e.minY,e.maxX,e.minY);if(0===r)return 0;var i=Oc(t[0],t[1],n[0],n[1],e.minX,e.minY,e.minX,e.maxY);if(0===i)return 0;var s=Oc(t[0],t[1],n[0],n[1],e.maxX,e.minY,e.maxX,e.maxY);if(0===s)return 0;var o=Oc(t[0],t[1],n[0],n[1],e.minX,e.maxY,e.maxX,e.maxY);return 0===o?0:Math.min(r,i,s,o)}function xc(t,n){return t[0]>=n.minX&&t[0]<=n.maxX&&t[1]>=n.minY&&t[1]<=n.maxY}function Fc(t,n,e){for(var r,i,s,o,a=Math.min(t[0],n[0]),u=Math.min(t[1],n[1]),l=Math.max(t[0],n[0]),h=Math.max(t[1],n[1]),c=e.search({minX:a,minY:u,maxX:l,maxY:h}),f=0;f<c.length;f++)if(r=c[f].p,i=c[f].next.p,s=t,r!==(o=n)&&i!==s&&kc(r,i,s)>0!=kc(r,i,o)>0&&kc(s,o,r)>0!=kc(s,o,i)>0)return!1;return!0}function kc(t,n,e){return gc(t[0],t[1],n[0],n[1],e[0],e[1])}function Ac(t){var n=t.p,e=t.next.p;return t.minX=Math.min(n[0],e[0]),t.minY=Math.min(n[1],e[1]),t.maxX=Math.max(n[0],e[0]),t.maxY=Math.max(n[1],e[1]),t}function Pc(t,n){var e={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return n?(e.next=n.next,e.prev=n,n.next.prev=e,n.next=e):(e.prev=e,e.next=e),e}function Sc(t,n){var e=t[0]-n[0],r=t[1]-n[1];return e*e+r*r}function _c(t,n,e){var r=n[0],i=n[1],s=e[0]-r,o=e[1]-i;if(0!==s||0!==o){var a=((t[0]-r)*s+(t[1]-i)*o)/(s*s+o*o);a>1?(r=e[0],i=e[1]):a>0&&(r+=s*a,i+=o*a)}return(s=t[0]-r)*s+(o=t[1]-i)*o}function Oc(t,n,e,r,i,s,o,a){var u,l,h,c,f=e-t,d=r-n,p=o-i,y=a-s,m=t-i,g=n-s,v=f*f+d*d,b=f*p+d*y,w=p*p+y*y,M=f*m+d*g,x=p*m+y*g,F=v*w-b*b,k=F,A=F;0===F?(l=0,k=1,c=x,A=w):(c=v*x-b*M,(l=b*x-w*M)<0?(l=0,c=x,A=w):l>k&&(l=k,c=x+b,A=w)),c<0?(c=0,-M<0?l=0:-M>v?l=k:(l=-M,k=v)):c>A&&(c=A,-M+b<0?l=0:-M+b>v?l=k:(l=-M+b,k=v));var P=(1-(h=0===c?0:c/A))*i+h*o-((1-(u=0===l?0:l/k))*t+u*e),S=(1-h)*s+h*a-((1-u)*n+u*r);return P*P+S*S}function Cc(t,n){return t[0]===n[0]?t[1]-n[1]:t[0]-n[0]}class Ec{constructor(t,n){this.x=t,this.y=n}clone(){return new Ec(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 Ec(this.x-t.x,this.y-t.y)}distance(t){const n=this.x-t.x,e=this.y-t.y;return Math.sqrt(n*n+e*e)}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 Ec(this.y,-this.x)}}function Ic(t,n,e,r){const i=n.x*r.y-n.y*r.x,s=e.x-t.x,o=e.y-t.y,a=(s*r.y-o*r.x)/i;return new Ec(t.x+a*n.x,t.y+a*n.y)}const $c=[],Tc=[];function Dc(t){if(k(t[0]&&t[0].x)){const n=[];let e=0;for(let r=0;r<t.length;r++)Tc[e]?(Tc[e][0]=t[r].x,Tc[e][1]=t[r].y):Tc[e]=[t[r].x,t[r].y],n.push(Tc[e]),e++;t=n}try{const n=vc(t,1/0);let e=[1/0,1/0],r=[-1/0,-1/0];for(let t=0;t<n.length;t++)n[t][0]<e[0]&&(e[0]=n[t][0]),n[t][0]>r[0]&&(r[0]=n[t][0]),n[t][1]<e[1]&&(e[1]=n[t][1]),n[t][1]>r[1]&&(r[1]=n[t][1]);const i=[];let s=[],o=0;for(let t=0;t<n.length;t++)t===n.length-1&&n[t][0]===n[0][0]&&n[t][1]===n[0][1]||(Bl(i,n[t],"EPSG:3857"),$c[o]?($c[o].x=i[0],$c[o].y=i[1]):$c[o]=new Ec(i[0],i[1]),s.push($c[o]),o++);wl.calculateSignedArea(s)<0&&(s=s.reverse());const a=function(t){let n,e=Number.MAX_VALUE;const r=function(t,r,i,s,o,a,u,l){var h=Ic(t,r,o,a),c=Ic(i,s,o,a),f=Ic(u,l,t,r),d=Ic(u,l,i,s),p=h.distance(c)*h.distance(f);0!==p&&p<e&&(n=[h,f,d,c],e=p)};var i=[];for(let n=0;n<t.length;n++)i.push(t[(n+1)%t.length].diff(t[n])),i[n].normalize();var s,o,a,u,l=new Ec(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new Ec(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let n=0;n<t.length;n++){var c=t[n];c.x<l.x&&(l.x=c.x,s=n),c.x>h.x&&(h.x=c.x,o=n),c.y<l.y&&(l.y=c.y,u=n),c.y>h.y&&(h.y=c.y,a=n)}var f=new Ec(0,-1),d=new Ec(0,1),p=new Ec(-1,0),y=new Ec(1,0);for(let n=0;n<t.length;n++){var m=[Math.acos(f.dot(i[s])),Math.acos(d.dot(i[o])),Math.acos(p.dot(i[a])),Math.acos(y.dot(i[u]))];switch(m.indexOf(Math.min.apply(Math,m))){case 0:(d=(f=i[s].clone()).clone()).negate(),(y=(p=f.orthogonal()).clone()).negate(),s=(s+1)%t.length;break;case 1:(f=(d=i[o].clone()).clone()).negate(),(y=(p=f.orthogonal()).clone()).negate(),o=(o+1)%t.length;break;case 2:(y=(p=i[a].clone()).clone()).negate(),(d=(f=y.orthogonal()).clone()).negate(),a=(a+1)%t.length;break;case 3:(p=(y=i[u].clone()).clone()).negate(),(d=(f=y.orthogonal()).clone()).negate(),u=(u+1)%t.length}r(t[s],f,t[o],d,t[a],p,t[u],y)}return n}(s);if(!a||4!==a.length)return null;const u=a[0].distance(a[1]),l=a[1].distance(a[2]),h=a.map((t=>[t.x,t.y]));return h.push(+(l>u)),h}catch(t){return null}}const zc=[];function jc(t,n){const e=Array.isArray(t&&t[0]&&t[0][0]);for(let r=0;r<t.length;r++)e?t[r]=jc(t[r]):(Bl(zc,t[r],n),t[r][0]=zc[0],t[r][1]=zc[1]);return t}class Uc extends yh{constructor(t,n,e,r,i,s){super(t,n,e,r,i),(n=n||{}).extent||(n.extent=8192),this.setData(n.data,s)}setData(t,n){if(delete this.index,function(t){if(!t)return!0;if(Array.isArray(t)&&!t.length)return!0;if(t.features&&!t.features.length)return!0;return!1}(t))return this.empty=!0,void n();const e={maxZoom:24,tolerance:this.options.simplifyTolerance,extent:this.options.extent,buffer:k(this.options.tileBuffer)?this.options.tileBuffer:64,hasAltitude:!!this.options.hasAltitude,debug:0,lineMetrics:!0,indexMaxZoom:5,indexMaxPoints:1e5,disableFilter:!0};if(this.options.projection&&(e.projection=this.options.projection,"EPSG:4490"===e.projection&&(e.projection="EPSG:4326")),F(t)&&"{"!=t.substring(0,1)||t.url){const r=t.url?t.url:t;C.getJSON(r,t.url?t:{},((t,i)=>{if(t&&(console.error("Failed to fetch geojson:"+r),n(t)),!i)return void n(null,{extent:null,idMap:{}});let s=i;if(this.options.convertFn){s=new Function("data",this.options.convertFn+"\\nreturn convert(data)")(s)}const o=Array.isArray(s)?s:s.features;this._n(o);const{sample1000:a,idMap:u}=this.On(o);this.Cn(a,u,s,e,n)}))}else{"string"==typeof t&&(t=JSON.parse(t));const r=Array.isArray(t)?t:t.features,i=r&&r.length;this._n(r);let s=r;if(r&&i>1e3){s=[];for(let t=0;t<i;t++)Nc(r[t],s,t,i)}this.Cn(s,null,t,e,n)}}_n(t){if(this.options.generateOMBB&&t)for(let n=0;n<t.length;n++){const e=t[n];if(e&&e.geometry&&e.geometry.coordinates)if("Polygon"===e.geometry.type){const t=e.geometry.coordinates[0];if(!t)continue;const n=Dc(t,t.length);e.properties=e.properties||{},e.properties[th]=n}else if("MultiPolygon"===e.geometry.type){const t=e.geometry.coordinates;for(let n=0;n<t.length;n++){if(!t[n])continue;const r=t[n][0];if(!r)continue;const i=Dc(r,r.length);e.properties=e.properties||{},e.properties[th]=e.properties[th]||[],e.properties[th][n]=i}}}}Cn(t,n,e,r,i){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":const e=t.features.length;for(let r=0;r<e;r++)Ch(t.features[r],n);break;case"Feature":Ch(t,n);break;default:Eh(t,n)}return n}({type:"FeatureCollection",features:t}):null;this.index=function(t,n){return new ot(t,n)}(e,this.options.geojsonvt||r),i(null,{extent:s,idMap:n})}catch(t){console.warn(t),i({error:t.message})}}On(t){const n=[],e={};let r=0;const i=this.options.featureIdProperty;if(t){const s=t.length;t.forEach(((t,o)=>{!function(t,s,o){if(t&&("Feature"!==t.type||t.geometry)){if(k(t.id)||(t.id=r++),i){let n=i;P(i)&&(n=i[t.layer||"0"]),t.id=t.properties[n]}e[t.id]=x({},t),t.geometry?(e[t.id].geometry=x({},t.geometry),e[t.id].geometry.coordinates=null):t.coordinates&&(e[t.id].coordinates=null),Nc(t,n,s,o)}}(t,o,s)}))}return{sample1000:n,idMap:e}}getTileFeatures(t,n){const e=t.tileInfo,r=[];if(!this.index)return this.empty?(setTimeout((function(){n(null,r,[])}),1),1):(setTimeout((function(){n({loading:!0})}),1),1);const i=this.index.getTile(e.z,e.x,e.y);if(!i||0===i.features.length)return setTimeout((function(){n(null,r,[])}),1),1;const s=[];for(let t=0,n=i.features.length;t<n;t++){const n=i.features[t];let e=n.layer;void 0===e&&(e="0"),s[e]={types:{}};s[e].types[n.type]=1,n.tags=n.tags||{},n.geometry.converted||(wl.convertGeometry(n),n.geometry.converted=1),r.push({type:n.type,layer:e,id:n.id,geometry:n.geometry,properties:n.tags,extent:this.options.extent})}for(const t in s)s[t].types=Object.keys(s[t].types).map((t=>+t));return setTimeout((function(){n(null,r,s)}),1),1}onRemove(){super.onRemove(),delete this.index}}function Nc(t,n,e,r){const i=Math.floor(r/998);(0===e||e===r-1||(0===i||e%i==0)&&n.length<999)&&n.push(t)}var Lc=ct,Rc=Vc;function Vc(t,n,e,r,i){this.properties={},this.extent=e,this.type=0,this.En=t,this.In=-1,this.$n=r,this.Tn=i,t.readFields(Hc,this,n)}function Hc(t,n,e){1==t?n.id=e.readVarint():2==t?function(t,n){var e=t.readVarint()+t.pos;for(;t.pos<e;){var r=n.$n[t.readVarint()],i=n.Tn[t.readVarint()];n.properties[r]=i}}(e,n):3==t?n.type=e.readVarint():4==t&&(n.In=e.pos)}function qc(t){for(var n,e,r=0,i=0,s=t.length,o=s-1;i<s;o=i++)n=t[i],r+=((e=t[o]).x-n.x)*(n.y+e.y);return r}Vc.types=["Unknown","Point","LineString","Polygon"],Vc.prototype.loadGeometry=function(){var t=this.En;t.pos=this.In;for(var n,e=t.readVarint()+t.pos,r=1,i=0,s=0,o=0,a=[];t.pos<e;){if(i<=0){var u=t.readVarint();r=7&u,i=u>>3}if(i--,1===r||2===r)s+=t.readSVarint(),o+=t.readSVarint(),1===r&&(n&&a.push(n),n=[]),n.push(new Lc(s,o));else{if(7!==r)throw new Error("unknown command "+r);n&&n.push(n[0].clone())}}return n&&a.push(n),a},Vc.prototype.bbox=function(){var t=this.En;t.pos=this.In;for(var n=t.readVarint()+t.pos,e=1,r=0,i=0,s=0,o=1/0,a=-1/0,u=1/0,l=-1/0;t.pos<n;){if(r<=0){var h=t.readVarint();e=7&h,r=h>>3}if(r--,1===e||2===e)(i+=t.readSVarint())<o&&(o=i),i>a&&(a=i),(s+=t.readSVarint())<u&&(u=s),s>l&&(l=s);else if(7!==e)throw new Error("unknown command "+e)}return[o,u,a,l]},Vc.prototype.toGeoJSON=function(t,n,e){var r,i,s=this.extent*Math.pow(2,e),o=this.extent*t,a=this.extent*n,u=this.loadGeometry(),l=Vc.types[this.type];function h(t){for(var n=0;n<t.length;n++){var e=t[n],r=180-360*(e.y+a)/s;t[n]=[360*(e.x+o)/s-180,360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90]}}switch(this.type){case 1:var c=[];for(r=0;r<u.length;r++)c[r]=u[r][0];h(u=c);break;case 2:for(r=0;r<u.length;r++)h(u[r]);break;case 3:for(u=function(t){var n=t.length;if(n<=1)return[t];for(var e,r,i=[],s=0;s<n;s++){var o=qc(t[s]);0!==o&&(void 0===r&&(r=o<0),r===o<0?(e&&i.push(e),e=[t[s]]):e.push(t[s]))}e&&i.push(e);return i}(u),r=0;r<u.length;r++)for(i=0;i<u[r].length;i++)h(u[r][i])}1===u.length?u=u[0]:l="Multi"+l;var f={type:"Feature",geometry:{type:l,coordinates:u},properties:this.properties};return"id"in this&&(f.id=this.id),f};var Gc=Rc,Jc=Wc;function Wc(t,n){this.version=1,this.name=null,this.extent=4096,this.length=0,this.En=t,this.$n=[],this.Tn=[],this.Dn=[],t.readFields(Bc,this,n),this.length=this.Dn.length}function Bc(t,n,e){15===t?n.version=e.readVarint():1===t?n.name=e.readString():5===t?n.extent=e.readVarint():2===t?n.Dn.push(e.pos):3===t?n.$n.push(e.readString()):4===t&&n.Tn.push(function(t){var n=null,e=t.readVarint()+t.pos;for(;t.pos<e;){var r=t.readVarint()>>3;n=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}return n}(e))}Wc.prototype.feature=function(t){if(t<0||t>=this.Dn.length)throw new Error("feature index out of bounds");this.En.pos=this.Dn[t];var n=this.En.readVarint()+this.En.pos;return new Gc(this.En,n,this.extent,this.$n,this.Tn)};var Xc=Jc;function Yc(t,n,e){if(3===t){var r=new Xc(e,e.readVarint()+e.pos);r.length&&(n[r.name]=r)}}var Kc=function(t,n){this.layers=t.readFields(Yc,{},n)};class Zc extends yh{constructor(t,n,e,r,i,s){super(t,n,e,r,i),n=n||{},s()}getTileFeatures(t,n){const e=t.tileInfo.url,r=t.fetchOptions||{};if(this.Gt.has(e)){const{err:t,data:r}=this.Gt.get(e);return setTimeout((()=>{this.zn(e,t,r,n)}),1)}return r.referrer=t.referrer,C.getArrayBuffer(e,r,((t,r)=>{this.Gt&&(t?t.loading||this.Gt.add(e,{err:t,data:r&&r.data}):r&&r.data&&this.Gt.add(e,{err:null,data:r.data}),this.zn(e,t,r&&r.data,n))}))}zn(t,n,e,r){if(n)return void r(n);let i;try{i=new Kc(new Hl(e))}catch(n){return void r(n.message,[],[])}const s=[];if(!i.layers)return void r(null,s,[]);const o={};let a;for(const t in i.layers)if(u=i.layers,l=t,Object.prototype.hasOwnProperty.call(u,l)){o[t]={types:{}};const e=o[t].types;for(let r=0,o=i.layers[t].length;r<o;r++)try{a=i.layers[t].feature(r),e[a.type]=1;const n={type:a.type,layer:t,geometry:a.loadGeometry(),properties:a.properties,extent:a.extent};void 0!==a.id&&(n.id=a.id);let o=n.properties[th];o&&(F(o)&&(o=JSON.parse(o)),n.properties[th]=jc(o,"EPSG:3857")),s.push(n)}catch(n){console.warn("error when load vt geometry:",n)}}var u,l;for(const t in o)o[t].types=Object.keys(o[t].types).map((t=>+t));r(null,s,o,{byteLength:e.byteLength})}abortTile(t,n){const e=this.requests[t];delete this.requests[t],e&&e.abort&&e.abort(),this.an(t),n()}onRemove(){super.onRemove();for(const t in this.requests){const n=this.requests[t];n&&n.abort&&n.abort()}this.requests={}}}let Qc=0;const tf=new fl(128);class nf{constructor(t){this.jn={},this.Un={},this.workerId=t}addLayer({actorId:t,mapId:n,layerId:e,params:r},i){if(this.Nn(n,e))return;const s=this.Ln(n,e),o=r.type,a=r.options,u=this.send.bind(this,t);this.jn[s]="GeoJSONVectorTileLayer"===o?new Uc(e,a,u,tf,{},i):new Zc(e,a,u,tf,{},i)}removeLayer({mapId:t,layerId:n},e){const r=this.Nn(t,n),i=this.Ln(t,n);delete this.jn[i],r&&r.onRemove(e)}loadTile({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.loadTile(e,r)}abortTile({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.abortTile&&i.abortTile(e.url,r)}removeTile({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.removeTile(e,r)}updateStyle({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.updateStyle(e,r)}updateOptions({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.updateOptions(e,r)}setData({mapId:t,layerId:n,params:e},r){const i=this.Nn(t,n);i&&i.setData(e.data,r)}receive(t){const n=t.callback,e=this.Un[n];delete this.Un[n],e&&t.error?e(new Error(t.error)):e&&e(null,t.data)}send(t,n,e,r,i){const s=i?\`${o}t}-${o}Qc++}\`:null;i&&(this.Un[s]=i),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:n,params:e,callback:String(s)},r||[])}Ln(t,n){return\`${o}t}-${o}n}\`}Nn(t,n){const e=this.Ln(t,n);return this.jn[e]}Rn(){tf.reset()}}t.initialize=function(){},t.onmessage=function(t,n){const e=t.data;if(this.dispatcher||(this.dispatcher=new nf(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const r=e.command;this.dispatcher[r]({actorId:t.actorId,mapId:e.mapId,layerId:e.layerId,params:e.params},((t,e,i)=>{t&&404!==t.status&&204!==t.status&&!t.loading&&console.error(r,t),n(t,e,i)}))}}}`;
25
25
  "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self && self;
26
26
  function l(t) {
27
27
  return t && t.t && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
@@ -1962,7 +1962,7 @@
1962
1962
  }();
1963
1963
  }();
1964
1964
  /*!
1965
- * @maptalks/vector-packer v0.96.0
1965
+ * @maptalks/vector-packer v0.96.2
1966
1966
  * LICENSE : UNLICENSED
1967
1967
  * (c) 2016-2024 maptalks.com
1968
1968
  */
@@ -7541,29 +7541,8 @@
7541
7541
  e(null, t);
7542
7542
  }));
7543
7543
  }
7544
- Yt(t, e) {
7545
- let n = this.entries[t];
7546
- n || (n = this.entries[t] = {
7547
- glyphs: {},
7548
- requests: {},
7549
- ranges: {}
7550
- });
7551
- let i = n.glyphs[e];
7552
- if (i) return Promise.resolve({
7553
- font: t,
7554
- charCode: e,
7555
- glyph: i
7556
- });
7557
- const r = Math.floor(e / 256);
7558
- if (256 * r > 65535) return Promise.reject(new Error("glyphs > 65535 not supported"));
7559
- n.requests[r].push(((t, e) => {
7560
- if (t) return t;
7561
- e && fnCallback(null, {
7562
- stack: stack,
7563
- id: id,
7564
- glyph: e.glyphs[id] || null
7565
- });
7566
- }));
7544
+ Yt() {
7545
+ return Promise.resolve(null);
7567
7546
  }
7568
7547
  $t(t, e, n, i) {
7569
7548
  const r = e;
@@ -13878,8 +13857,8 @@
13878
13857
  }
13879
13858
  const Qf = [], td = [];
13880
13859
  var ed = "#define SHADER_NAME TEXT_VERT\n#define RAD 0.0174532925\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec2 aShape;\nattribute vec2 aTexCoord;\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute float aColorOpacity;\n#endif\n#ifdef HAS_TEXT_SIZE\nattribute float aTextSize;\n#else\nuniform float textSize;\n#endif\n#ifdef HAS_TEXT_DX\nattribute float aTextDx;\n#else\nuniform float textDx;\n#endif\n#ifdef HAS_TEXT_DY\nattribute float aTextDy;\n#else\nuniform float textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nattribute float aPitchAlign;\n#else\nuniform float pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nattribute float aRotationAlign;\n#else\nuniform float rotateWithMap;\n#endif\nuniform float flipY;\n#if defined(HAS_ROTATION)\nattribute float aRotation;\n#else\nuniform float textRotation;\n#endif\nuniform float cameraToCenterDistance;\nuniform mat4 positionMatrix;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform vec2 texSize;\nuniform vec2 canvasSize;\nuniform float glyphSize;\nuniform float mapPitch;\nuniform float mapRotation;\nuniform float zoomScale;\nuniform float tileRatio;\nuniform float layerScale;\nuniform float isRenderingTerrain;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vSize;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nattribute vec4 aTextFill;\nvarying vec4 vTextFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nattribute vec4 aTextHaloFill;\nvarying vec4 vTextHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nattribute float aTextHaloRadius;\nvarying float vTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nattribute float aTextHaloOpacity;\nvarying float vTextHaloOpacity;\n#endif\n#include <highlight_vert>\n#else\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n#ifdef HAS_TEXT_SIZE\nfloat d = aTextSize * layerScale;\n#else\nfloat d = textSize * layerScale;\n#endif\n#ifdef HAS_TEXT_DX\nfloat e = aTextDx;\n#else\nfloat e = textDx;\n#endif\n#ifdef HAS_TEXT_DY\nfloat f = aTextDy;\n#else\nfloat f = textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nfloat h = aPitchAlign;\n#else\nfloat h = pitchWithMap;\n#endif\n#if defined(HAS_ROTATION_ALIGN)\nfloat i = aRotationAlign;\n#else\nfloat i = rotateWithMap;\n#endif\nvec2 j = aShape / 10.0;\n if(h == 1. && flipY == .0) {\n j = j * vec2(1., -1.);\n }\n vec2 k = aTexCoord;\n gl_Position = projViewModelMatrix * positionMatrix * vec4(c, 1.);\n float l = gl_Position.w;\n float m;\n if(isRenderingTerrain == 1. && h == 1.) {\n m = 1.;\n } else {\n float n = (1. - cameraToCenterDistance / l) * textPerspectiveRatio;\n m = clamp(.5 + .5 * (1. - n), .0, 4.);\n }\n#ifdef HAS_ROTATION\nfloat o = -aRotation / 9362. - mapRotation * i;\n#else\nfloat o = -textRotation - mapRotation * i;\n#endif\nif(h == 1.) {\n \n#ifdef REVERSE_MAP_ROTATION_ON_PITCH\no += mapRotation;\n#else\no -= mapRotation;\n#endif\n }\n float u = sin(o);\n float v = cos(o);\n mat2 A = mat2(v, -1. * u, u, v);\n j = A * (j / glyphSize * d);\n float B;\n if(isRenderingTerrain == 1.) {\n B = 1.;\n } else {\n B = l / cameraToCenterDistance;\n }\n if(h == .0) {\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * m * l;\n } else {\n float D;\n if(isRenderingTerrain == 1.) {\n D = tileRatio / zoomScale;\n } else {\n D = tileRatio / zoomScale * B * m;\n }\n vec2 C = j;\n gl_Position = projViewModelMatrix * positionMatrix * vec4(c + vec3(C, .0) * D, 1.);\n }\n gl_Position.xy += vec2(e, -f) * 2. / canvasSize * l;\n#ifndef PICKING_MODE\nif(h == .0) {\n vGammaScale = mix(1., B, textPerspectiveRatio);\n } else {\n vGammaScale = B + mapPitch / 4.;\n }\n vTexCoord = k / texSize;\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vSize = d;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity *= aColorOpacity / 255.;\n#endif\n#ifdef HAS_TEXT_FILL\nvTextFill = aTextFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvTextHaloFill = aTextHaloFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nvTextHaloRadius = aTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nvTextHaloOpacity = aTextHaloOpacity;\n#endif\nhighlight_setVarying();\n#else\n#ifdef ENABLE_COLLISION\nbool E = aOpacity == 255.;\n#else\nbool E = true;\n#endif\nfbo_picking_setData(gl_Position.w, E);\n#endif\n}", nd = "#define SHADER_NAME TEXT_FRAG\n#define HAS_HIGHLIGHT_COLOR_POINT 1\n#define SDF_PX 8.0\n#define DEVICE_PIXEL_RATIO 1.0\n#define EDGE_GAMMA 0.105 / DEVICE_PIXEL_RATIO\nprecision mediump float;\nuniform sampler2D texture;\nuniform float textOpacity;\nuniform highp float gammaScale;\nuniform int isHalo;\nuniform highp float textHaloBlur;\nuniform float alphaTest;\n#ifdef HAS_TEXT_HALO_OPACITY\nvarying float vTextHaloOpacity;\n#else\nuniform float textHaloOpacity;\n#endif\nuniform float layerOpacity;\nvarying vec2 vTexCoord;\nvarying float vSize;\nvarying float vGammaScale;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nvarying vec4 vTextFill;\n#else\nuniform vec4 textFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvarying vec4 vTextHaloFill;\n#else\nuniform vec4 textHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nvarying float vTextHaloRadius;\n#else\nuniform highp float textHaloRadius;\n#endif\n#include <highlight_frag>\nvoid main() {\n \n#ifdef HAS_TEXT_FILL\nvec4 c = vTextFill;\n#else\nvec4 c = textFill;\n#endif\nfloat d = vSize / 24.;\n lowp vec4 e = c;\n highp float f = EDGE_GAMMA / (d * gammaScale);\n lowp float h = 185. / 256.;\n if(isHalo == 1) {\n \n#ifdef HAS_TEXT_HALO_FILL\nvec4 i = vTextHaloFill;\n#else\nvec4 i = textHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nfloat j = vTextHaloRadius;\n#else\nfloat j = textHaloRadius;\n#endif\ne = i;\n f = (textHaloBlur * 1.19 / SDF_PX + EDGE_GAMMA) / (d * gammaScale);\n h = (6. - j / d) / SDF_PX;\n#ifdef HAS_TEXT_HALO_OPACITY\nfloat k = vTextHaloOpacity / 255.;\n#else\nfloat k = textHaloOpacity;\n#endif\ne *= k * 1.25;\n }\n float l = texture2D(texture, vTexCoord).a;\n highp float m = f * vGammaScale * .7;\n float n = clamp(smoothstep(h - m, h + m, l), .0, 1.);\n gl_FragColor = e * (n * textOpacity * vOpacity * layerOpacity);\n if(gl_FragColor.a < alphaTest) {\n discard;\n }\n gl_FragColor = highlight_blendColor(gl_FragColor);\n}";
13881
- const rd = 6, sd = 4, od = new Uint16Array(1), ad = new Int8Array(1);
13882
- function ld(t, e, n) {
13860
+ const id = 6, rd = 4, sd = new Uint16Array(1), od = new Int8Array(1);
13861
+ function ad(t, e, n) {
13883
13862
  Uu(t, e, n), function(t) {
13884
13863
  const {aMarkerWidth: e, aMarkerHeight: n, aMarkerDx: i, aMarkerDy: r, aPitchAlign: s, aRotationAlign: o, aRotation: a, aOverlap: l} = t.data;
13885
13864
  if (e) {
@@ -13916,7 +13895,7 @@
13916
13895
  }
13917
13896
  }(t);
13918
13897
  }
13919
- function hd(t, e) {
13898
+ function ld(t, e) {
13920
13899
  const n = F(e.markerWidth), i = F(e.markerHeight), r = F(e.markerDx), s = F(e.markerDy), o = F(e.markerOpacity), a = F(e.markerTextFit), l = O(e.markerPitchAlignment), h = O(e.markerRotationAlignment), u = F(e.markerRotation), c = O(e.markerAllowOverlapFn), f = O(e.markerIgnorePlacement), d = new Int16Array(1), p = new Uint16Array(1);
13921
13900
  return [ {
13922
13901
  attrName: "aMarkerWidth",
@@ -14016,7 +13995,7 @@
14016
13995
  }
14017
13996
  } ];
14018
13997
  }
14019
- function ud(t, e, n, i) {
13998
+ function hd(t, e, n, i) {
14020
13999
  if (!n || !i || "none" === i) return;
14021
14000
  const r = function(t, e, n) {
14022
14001
  let i = t.properties.textFitFn;
@@ -14031,28 +14010,28 @@
14031
14010
  f = {
14032
14011
  pickingId: h[t],
14033
14012
  start: 0,
14034
- end: u[t] * rd
14013
+ end: u[t] * id
14035
14014
  };
14036
14015
  }
14037
14016
  let d = !1, p = !1, y = 0;
14038
14017
  const m = new Set;
14039
- for (let t = 0; t < o.length; t += rd) {
14018
+ for (let t = 0; t < o.length; t += id) {
14040
14019
  const e = a[o[t]];
14041
14020
  if (!d && f) for (;f.pickingId < e && f.end < l.length; ) {
14042
14021
  const t = f.end, e = l[t];
14043
- f.start = t, f.end = t + u[e] * rd, f.pickingId = h[e];
14022
+ f.start = t, f.end = t + u[e] * id, f.pickingId = h[e];
14044
14023
  }
14045
14024
  if (!d && f && f.pickingId < e && (d = !0, !r)) {
14046
14025
  if (!p) return [];
14047
- for (let e = t; e < o.length; e += rd) s[y++] = [ -1, -1 ];
14026
+ for (let e = t; e < o.length; e += id) s[y++] = [ -1, -1 ];
14048
14027
  return s;
14049
14028
  }
14050
14029
  const g = c[e] && c[e].feature, v = g && g.properties || {}, x = i ? i(null, v) : n;
14051
14030
  if (f && e === f.pickingId) {
14052
14031
  s[y++] = [ f.start, f.end ];
14053
14032
  const t = f.end, e = l[t];
14054
- f.start = t, f.end = t + u[e] * rd, f.pickingId = h[e], p = !0;
14055
- } else if (x && "none" !== x) for (let e = t; e < t + rd; e++) m.add(e); else s[y++] = [ -1, -1 ];
14033
+ f.start = t, f.end = t + u[e] * id, f.pickingId = h[e], p = !0;
14034
+ } else if (x && "none" !== x) for (let e = t; e < t + id; e++) m.add(e); else s[y++] = [ -1, -1 ];
14056
14035
  }
14057
14036
  if (m.size) if (m.size === o.length) t.setElements([]); else {
14058
14037
  const e = [];
@@ -14085,10 +14064,10 @@
14085
14064
  if (!s) return [];
14086
14065
  return n;
14087
14066
  }(e, n);
14088
- i.length && (e.properties.labelShape = i, cd.call(this, t, e, n));
14067
+ i.length && (e.properties.labelShape = i, ud.call(this, t, e, n));
14089
14068
  }
14090
14069
  }
14091
- function cd(t, e) {
14070
+ function ud(t, e) {
14092
14071
  const n = this.getSymbolDef(e.properties.symbolIndex), i = n.markerTextFit, r = e.properties;
14093
14072
  let s = "both" === i || "width" === i, o = "both" === i || "height" === i;
14094
14073
  if (I(n.markerTextFit)) {
@@ -14096,14 +14075,14 @@
14096
14075
  t || (t = e.properties.textFitFn = F(n.markerTextFit));
14097
14076
  const {features: i} = e.properties, a = e.properties.elements || e.elements, {aPickingId: l} = e.data, h = [], u = [];
14098
14077
  let c = !0;
14099
- for (let e = 0; e < a.length; e += rd) {
14078
+ for (let e = 0; e < a.length; e += id) {
14100
14079
  const n = i[l[a[e]]], r = (n && n.feature || {}).properties || {};
14101
14080
  let s = t(null, r);
14102
14081
  if (I(s)) {
14103
14082
  s = (r.textFitFn = r.textFitFn || F(s))(null, r);
14104
14083
  }
14105
- "both" === s ? (h.push(e / rd), u.push(e / rd)) : "width" === s ? (c = !1, h.push(e / rd)) : "height" === s && (c = !1,
14106
- u.push(e / rd));
14084
+ "both" === s ? (h.push(e / id), u.push(e / id)) : "width" === s ? (c = !1, h.push(e / id)) : "height" === s && (c = !1,
14085
+ u.push(e / id));
14107
14086
  }
14108
14087
  c ? (r.fitIcons = h, s = !0, o = !0) : (h.length && (r.fitWidthIcons = h, s = !0),
14109
14088
  u.length && (r.fitHeightIcons = u, o = !0));
@@ -14131,10 +14110,10 @@
14131
14110
  e.data.aMarkerHeight = new Uint16Array(u);
14132
14111
  }
14133
14112
  const c = this.getSymbolDef(e.properties.textGeo.properties.symbolIndex), f = F(c.textSize);
14134
- dd.call(this, t, e), (!I(c.textSize) || f.isZoomConstant && f.isFeatureConstant) && (r.isFitConstant = !0);
14113
+ fd.call(this, t, e), (!I(c.textSize) || f.isZoomConstant && f.isFeatureConstant) && (r.isFitConstant = !0);
14135
14114
  }
14136
- const fd = [ 0, 0, 0, 0 ];
14137
- function dd(t, e) {
14115
+ const cd = [ 0, 0, 0, 0 ];
14116
+ function fd(t, e) {
14138
14117
  const n = e.properties.textGeo;
14139
14118
  if (!n) return;
14140
14119
  const i = n.properties, r = e.properties;
@@ -14142,7 +14121,7 @@
14142
14121
  const s = this.getSymbolDef(e.properties.symbolIndex), o = this.getSymbolDef(n.properties.symbolIndex).textSize;
14143
14122
  let a;
14144
14123
  I(o) && (a = i.Ds ? i.Ds : i.Ds = F(o));
14145
- const l = s.markerTextFitPadding || fd;
14124
+ const l = s.markerTextFitPadding || cd;
14146
14125
  let h;
14147
14126
  I(l) && (h = r.zs ? r.zs : r.zs = O(l));
14148
14127
  const u = t.getZoom(), {fitIcons: c, fitWidthIcons: f, fitHeightIcons: d} = r, {aMarkerWidth: p, aMarkerHeight: y, labelShape: m} = r, g = r.elements || e.elements, {features: v, aPickingId: x} = r, b = (t, e, n, i) => {
@@ -14158,67 +14137,67 @@
14158
14137
  if (I(_)) {
14159
14138
  _ = (w.fitPaddingFn = w.fitPaddingFn || O(_))(u, w);
14160
14139
  }
14161
- if (_ = _ || fd, _[0] === _[2] && _[1] === _[3] || (M = r.aPadOffsetX, S = r.aPadOffsetY,
14140
+ if (_ = _ || cd, _[0] === _[2] && _[1] === _[3] || (M = r.aPadOffsetX, S = r.aPadOffsetY,
14162
14141
  M || (M = r.aPadOffsetX = new Int8Array(p.length), S = r.aPadOffsetY = new Int8Array(p.length))),
14163
14142
  p && n) {
14164
14143
  const e = Math.abs((f - s) / 10 * A) + (_[1] + _[3] || 0);
14165
- if (od[0] = e, p[t] !== od[0] && (Hh(p, od[0], t, t + sd), p.dirty = !0), M) {
14144
+ if (sd[0] = e, p[t] !== sd[0] && (Hh(p, sd[0], t, t + rd), p.dirty = !0), M) {
14166
14145
  const e = (_[1] + _[3]) / 2 - _[3];
14167
- ad[0] = e, M[t] !== ad[0] && (Hh(M, e, t, t + sd), M.dirty = !0);
14146
+ od[0] = e, M[t] !== od[0] && (Hh(M, e, t, t + rd), M.dirty = !0);
14168
14147
  }
14169
14148
  }
14170
14149
  if (y && i) {
14171
14150
  const e = Math.abs((d - c) / 10 * A) + (_[0] + _[2] || 0);
14172
- if (od[0] = e, y[t] !== od[0] && (Hh(y, od[0], t, t + sd), y.dirty = !0), S) {
14151
+ if (sd[0] = e, y[t] !== sd[0] && (Hh(y, sd[0], t, t + rd), y.dirty = !0), S) {
14173
14152
  const e = _[0] - (_[0] + _[2]) / 2;
14174
- ad[0] = e, S[t] !== ad[0] && (Hh(S, e, t, t + sd), S.dirty = !0);
14153
+ od[0] = e, S[t] !== od[0] && (Hh(S, e, t, t + rd), S.dirty = !0);
14175
14154
  }
14176
14155
  }
14177
14156
  };
14178
14157
  if (c || f || d) {
14179
14158
  if (c) for (let t = 0; t < c.length; t++) {
14180
14159
  const e = c[t];
14181
- b(g[e * rd], e, !0, !0);
14160
+ b(g[e * id], e, !0, !0);
14182
14161
  } else if (f || d) {
14183
14162
  if (f) for (let t = 0; t < f.length; t++) {
14184
14163
  const e = f[t];
14185
- b(g[e * rd], e, !0, !1);
14164
+ b(g[e * id], e, !0, !1);
14186
14165
  }
14187
14166
  if (d) for (let t = 0; t < d.length; t++) {
14188
14167
  const e = d[t];
14189
- b(g[e * rd], e, !1, !0);
14168
+ b(g[e * id], e, !1, !0);
14190
14169
  }
14191
14170
  }
14192
- } else for (let t = 0; t < g.length; t += rd) {
14193
- const e = t / rd;
14171
+ } else for (let t = 0; t < g.length; t += id) {
14172
+ const e = t / id;
14194
14173
  b(g[t], e, !0, !0);
14195
14174
  }
14196
14175
  const {aPadOffsetX: w, aPadOffsetY: A} = r;
14197
14176
  w && (e.data.aPadOffsetX = w, e.data.aPadOffsetY = A);
14198
14177
  }
14199
- const pd = function(t) {
14178
+ const dd = function(t) {
14200
14179
  const e = this.layer.getRenderer();
14201
14180
  return !this.Es(t) && e.isForeground(t) && !!t.geometry.properties.iconAtlas && !t.geometry.properties.isEmpty;
14202
- }, yd = function(t) {
14181
+ }, pd = function(t) {
14203
14182
  const e = this.layer.getRenderer();
14204
14183
  return !(this.Es(t) || e.isForeground(t) || !t.geometry.properties.iconAtlas || t.geometry.properties.isEmpty);
14205
- }, md = function(t) {
14184
+ }, yd = function(t) {
14206
14185
  const e = this.layer.getRenderer();
14207
14186
  return !this.Es(t) && e.isForeground(t) && !!t.geometry.properties.glyphAtlas;
14208
- }, gd = function(t) {
14187
+ }, md = function(t) {
14209
14188
  const e = this.layer.getRenderer();
14210
14189
  return !this.Es(t) && !e.isForeground(t) && !!t.geometry.properties.glyphAtlas;
14211
- }, vd = [], xd = {
14190
+ }, gd = [], vd = {
14212
14191
  collides: -1
14213
- }, bd = [ gf, gf ], wd = n.mat4.identity([]), Ad = [];
14214
- class Md extends ef {
14192
+ }, xd = [ gf, gf ], bd = n.mat4.identity([]), wd = [];
14193
+ class Ad extends ef {
14215
14194
  static getBloomSymbol() {
14216
14195
  return [ "markerBloom", "textBloom" ];
14217
14196
  }
14218
14197
  constructor(t, e, n, i, r, s) {
14219
14198
  super(t, e, n, i, r, s), this.propAllowOverlap = "markerAllowOverlap", this.propIgnorePlacement = "markerIgnorePlacement",
14220
- this.nr = {}, this.isLabelCollides = Kf.bind(this), this.Ls = pd.bind(this), this.Rs = yd.bind(this),
14221
- this.Ns = md.bind(this), this.Hs = gd.bind(this), this.js = [];
14199
+ this.nr = {}, this.isLabelCollides = Kf.bind(this), this.Ls = dd.bind(this), this.Rs = pd.bind(this),
14200
+ this.Ns = yd.bind(this), this.Hs = md.bind(this), this.js = [];
14222
14201
  }
14223
14202
  needToRefreshTerrainTileOnZooming() {
14224
14203
  for (let t = 0; t < this.symbolDef.length; t++) {
@@ -14238,7 +14217,7 @@
14238
14217
  }
14239
14218
  createFnTypeConfig(t, e) {
14240
14219
  return {
14241
- icon: hd.call(this, t, e),
14220
+ icon: ld.call(this, t, e),
14242
14221
  text: $f.call(this, t, e)
14243
14222
  };
14244
14223
  }
@@ -14254,13 +14233,13 @@
14254
14233
  postCreateGeometry(t, e) {
14255
14234
  const {geometry: n, symbolIndex: i} = t, r = this.getSymbolDef(i), s = this.getFnTypeConfig(i);
14256
14235
  if (this.Us(n)) n.properties.iconAtlas ? this.drawDebugAtlas(n.properties.iconAtlas) : n.properties.isEmpty = !0,
14257
- ld(n, r, s.icon); else if (this.Gs(n) && Vh(r)) {
14236
+ ad(n, r, s.icon); else if (this.Gs(n) && Vh(r)) {
14258
14237
  const t = e[e.length - 1];
14259
14238
  if (t) {
14260
14239
  const {geometry: e, symbolIndex: s} = t;
14261
14240
  if (e && s.index === i.index) {
14262
14241
  const t = this.getMap(), i = r.markerTextFit;
14263
- e.properties.textGeo = n, ud.call(this, t, e, n, i);
14242
+ e.properties.textGeo = n, hd.call(this, t, e, n, i);
14264
14243
  }
14265
14244
  }
14266
14245
  }
@@ -14272,7 +14251,7 @@
14272
14251
  if (!n) return void (t.properties.collideBoxIndex = s);
14273
14252
  let o = 0, a = n[0], l = 0, h = r[a], u = 1;
14274
14253
  i && (u = i[n[l]]);
14275
- for (let t = 0; t <= n.length; t += rd) a = n[t], r[a] === h && t !== n.length || (s[h] = [ l, t, (t - l) / (u * rd), o++ ],
14254
+ for (let t = 0; t <= n.length; t += id) a = n[t], r[a] === h && t !== n.length || (s[h] = [ l, t, (t - l) / (u * id), o++ ],
14276
14255
  h = r[a], l = t, i && (u = i[n[l]]));
14277
14256
  t.properties.collideBoxIndex = s;
14278
14257
  }
@@ -14339,7 +14318,7 @@
14339
14318
  const n = this.layer instanceof r.TileLayer, {collideIds: i} = t.properties, s = new Uint16Array(i.length);
14340
14319
  if (this.Us(t)) {
14341
14320
  let r = 0;
14342
- for (let t = 0; t < i.length; t += sd) s.fill(r++, t, t + sd);
14321
+ for (let t = 0; t < i.length; t += rd) s.fill(r++, t, t + rd);
14343
14322
  t.properties.collideIds = s, t.properties.uniqueCollideIds = Gh(s, !n), e.markerCollideMap = {
14344
14323
  old: i,
14345
14324
  new: s
@@ -14353,15 +14332,15 @@
14353
14332
  for (let t = 0; t < i.length; ) {
14354
14333
  const n = i[t];
14355
14334
  l !== n && (l = n, h = e.markerCollideMap.old.indexOf(l), a = 0);
14356
- const s = -1 === h ? ++o : e.markerCollideMap.new[h + a * sd], c = t + u * sd;
14357
- i.fill(s, t, c), t += u * sd, a++, c < i.length && (u = r[c]);
14335
+ const s = -1 === h ? ++o : e.markerCollideMap.new[h + a * rd], c = t + u * rd;
14336
+ i.fill(s, t, c), t += u * rd, a++, c < i.length && (u = r[c]);
14358
14337
  }
14359
14338
  t.properties.uniqueCollideIds = Gh(i, !n);
14360
14339
  } else {
14361
14340
  let e = 0, s = r[0];
14362
14341
  for (let t = 0; t < i.length; ) {
14363
- const n = t + s * sd;
14364
- i.fill(e++, t, n), t += s * sd, n < i.length && (s = r[n]);
14342
+ const n = t + s * rd;
14343
+ i.fill(e++, t, n), t += s * rd, n < i.length && (s = r[n]);
14365
14344
  }
14366
14345
  t.properties.uniqueCollideIds = Gh(i, !n);
14367
14346
  }
@@ -14376,7 +14355,7 @@
14376
14355
  for (let e = 0; e < t.length; e++) {
14377
14356
  if (!this.isMeshIterable(t[e])) continue;
14378
14357
  const n = t[e].geometry, {symbolIndex: i} = n.properties;
14379
- Vh(this.getSymbolDef(i)) && dd.call(this, this.getMap(), n);
14358
+ Vh(this.getSymbolDef(i)) && fd.call(this, this.getMap(), n);
14380
14359
  }
14381
14360
  const e = this.getMap().getZoom();
14382
14361
  for (let n = 0; n < t.length; n++) {
@@ -14420,7 +14399,7 @@
14420
14399
  }
14421
14400
  Ys(t) {
14422
14401
  const e = this.layer.getRenderer();
14423
- t = t.sort(Sd);
14402
+ t = t.sort(Md);
14424
14403
  for (let n = 0; n < t.length; n++) {
14425
14404
  const i = t[n];
14426
14405
  if (!i || !i.meshes.length) continue;
@@ -14453,7 +14432,7 @@
14453
14432
  Zs(t, e, i, r) {
14454
14433
  const s = this.getMap(), {collideBoxIndex: o} = t.meshes[0].geometry.properties;
14455
14434
  if (!(o && o[e])) return !1;
14456
- const a = n.mat4.multiply(vd, s.projViewMatrix, t.meshes[0].localTransform);
14435
+ const a = n.mat4.multiply(gd, s.projViewMatrix, t.meshes[0].localTransform);
14457
14436
  let l, h = !1;
14458
14437
  const u = t.meshes;
14459
14438
  let c = 0;
@@ -14474,7 +14453,7 @@
14474
14453
  const [c, d, p] = a;
14475
14454
  let y = 1;
14476
14455
  s && (y = s[r[c]]);
14477
- const m = c + 0 * y * rd;
14456
+ const m = c + 0 * y * id;
14478
14457
  l[f].mesh = u[t], l[f].start = m, l[f].end = d, l[f].boxCount = i.glyphAtlas ? y : p,
14479
14458
  l[f].allElements = r, f++;
14480
14459
  }
@@ -14514,14 +14493,14 @@
14514
14493
  }
14515
14494
  isBoxCollides(t, e, n, i, r, s) {
14516
14495
  if (this.Gs(t.geometry)) return Kf.call(this, 0, t, e, n, i, r, s);
14517
- if (t.geometry.properties.isEmpty) return xd;
14496
+ if (t.geometry.properties.isEmpty) return vd;
14518
14497
  const {aTerrainAltitude: o} = t.geometry.properties;
14519
14498
  if (o) {
14520
- if (o[2 * e[i]] === bh) return xd;
14499
+ if (o[2 * e[i]] === bh) return vd;
14521
14500
  }
14522
14501
  const a = this.getMap(), {boxes: l, collision: h} = this.Fs(t, i);
14523
14502
  let u = 0, c = 0, f = 0;
14524
- for (let n = i; n < r; n += rd) {
14503
+ for (let n = i; n < r; n += id) {
14525
14504
  const i = l[f] = l[f] || [];
14526
14505
  f++;
14527
14506
  const r = Ff.call(this, i, t, e[n], s, a);
@@ -14635,7 +14614,7 @@
14635
14614
  }
14636
14615
  }
14637
14616
  getUniformValues(t, e) {
14638
- const i = e && e.isRenderingTerrainSkin, s = this.layer.getTileSize().width, o = i ? wd : t.projViewMatrix, a = t.cameraToCenterDistance, l = n.vec2.set(Ad, t.width, t.height);
14617
+ const i = e && e.isRenderingTerrainSkin, s = this.layer.getTileSize().width, o = i ? bd : t.projViewMatrix, a = t.cameraToCenterDistance, l = n.vec2.set(wd, t.width, t.height);
14639
14618
  i && n.vec2.set(l, s, s);
14640
14619
  const h = this.getBlendFunc(), u = r.Util.isFunction(h.src) ? h.src() : h.src;
14641
14620
  return {
@@ -14645,7 +14624,7 @@
14645
14624
  projViewMatrix: o,
14646
14625
  cameraToCenterDistance: a,
14647
14626
  canvasSize: l,
14648
- iconSize: bd,
14627
+ iconSize: xd,
14649
14628
  resolution: t.getResolution(),
14650
14629
  glyphSize: vf,
14651
14630
  gammaScale: 1,
@@ -14668,12 +14647,12 @@
14668
14647
  return 1 === e.type;
14669
14648
  }
14670
14649
  }
14671
- function Sd(t, e) {
14650
+ function Md(t, e) {
14672
14651
  return t.properties.level - e.properties.level || t.properties.meshKey - e.properties.meshKey;
14673
14652
  }
14674
- const _d = [], kd = [], Pd = [];
14675
- function Td(t, e, i, r, s, o, a, l, h, u, f, d, p) {
14676
- const {aGlyphOffset: y, aSegment: m, aTextDx: g, aTextDy: v, symbolIndex: x} = e.geometry.properties, b = this.getSymbol(x), w = g ? g[s] : b.textDx, A = v ? v[s] : b.textDy, M = n.vec2.set(Pd, w || 0, A || 0), S = n.vec2.set(_d, y[2 * s], y[2 * s + 1]), _ = n.vec3.set(kd, m[3 * s], m[3 * s + 1], m[3 * s + 2]), k = function(t, e, n, i, r, s, o, a, l, h, u, f, d, p, y, m, g, v) {
14653
+ const Sd = [], _d = [], kd = [];
14654
+ function Pd(t, e, i, r, s, o, a, l, h, u, f, d, p) {
14655
+ const {aGlyphOffset: y, aSegment: m, aTextDx: g, aTextDy: v, symbolIndex: x} = e.geometry.properties, b = this.getSymbol(x), w = g ? g[s] : b.textDx, A = v ? v[s] : b.textDy, M = n.vec2.set(kd, w || 0, A || 0), S = n.vec2.set(Sd, y[2 * s], y[2 * s + 1]), _ = n.vec3.set(_d, m[3 * s], m[3 * s + 1], m[3 * s + 2]), k = function(t, e, n, i, r, s, o, a, l, h, u, f, d, p, y, m, g, v) {
14677
14656
  y || (y = i);
14678
14657
  const x = e.geometry.properties.line, b = s[0] * f, w = d ? b - o : b + o;
14679
14658
  let A = w > 0 ? 1 : -1, M = 0;
@@ -14700,41 +14679,41 @@
14700
14679
  }(t, e, r, o, a, S, M[0], M[1], _[0], _[1], _[2], i / 24, h, l, u, f, d, p);
14701
14680
  return k;
14702
14681
  }
14703
- const Id = [], Fd = [];
14704
- function Od(t, e, i, r, s, o, a, l, h, u, c, f) {
14682
+ const Td = [], Id = [];
14683
+ function Fd(t, e, i, r, s, o, a, l, h, u, c, f) {
14705
14684
  const {aVertical: d} = i.geometry.properties, p = d[o];
14706
- let y, m, g = Td.call(this, Id, i, r, s, o, l, h, u, !1);
14685
+ let y, m, g = Pd.call(this, Td, i, r, s, o, l, h, u, !1);
14707
14686
  if (!g) return null;
14708
- if (n.vec3.copy(t, g), g = Td.call(this, Fd, i, r, s, a, l, h, u, !1), !g) return null;
14709
- if (n.vec3.copy(e, g), f && (n.vec2.transformMat2(Id, Id, f), n.vec2.transformMat2(Fd, Fd, f)),
14687
+ if (n.vec3.copy(t, g), g = Pd.call(this, Id, i, r, s, a, l, h, u, !1), !g) return null;
14688
+ if (n.vec3.copy(e, g), f && (n.vec2.transformMat2(Td, Td, f), n.vec2.transformMat2(Id, Id, f)),
14710
14689
  p) {
14711
- const t = Math.abs(Fd[1] - Id[1]), e = Math.abs(Fd[0] - Id[0]) * c;
14712
- m = Id[0] > Fd[0] ? 1 : 0, t > e ? (y = 1, m = Id[1] < Fd[1] ? 0 : 1) : y = 0;
14713
- } else y = 0, m = Id[0] > Fd[0] ? 1 : 0;
14690
+ const t = Math.abs(Id[1] - Td[1]), e = Math.abs(Id[0] - Td[0]) * c;
14691
+ m = Td[0] > Id[0] ? 1 : 0, t > e ? (y = 1, m = Td[1] < Id[1] ? 0 : 1) : y = 0;
14692
+ } else y = 0, m = Td[0] > Id[0] ? 1 : 0;
14714
14693
  return 2 * m + y;
14715
14694
  }
14716
- var Cd = "#define SHADER_NAME TEXT_LINE\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec2 aTexCoord;\n#ifdef HAS_OFFSET_Z\nattribute vec3 aOffset;\nuniform float altitudeScale;\n#else\nattribute vec2 aOffset;\n#endif\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute float aColorOpacity;\n#endif\n#ifdef HAS_TEXT_SIZE\nattribute float aTextSize;\n#else\nuniform float textSize;\n#endif\n#ifdef HAS_TEXT_DX\nattribute float aTextDx;\n#else\nuniform float textDx;\n#endif\n#ifdef HAS_TEXT_DY\nattribute float aTextDy;\n#else\nuniform float textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nattribute float aPitchAlign;\n#else\nuniform float pitchWithMap;\n#endif\nuniform float zoomScale;\nuniform float cameraToCenterDistance;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform float mapPitch;\nuniform vec2 texSize;\nuniform vec2 canvasSize;\nuniform float tileRatio;\nuniform float layerScale;\nuniform float isRenderingTerrain;\nuniform float textPitchFilter;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vSize;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nattribute vec4 aTextFill;\nvarying vec4 vTextFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nattribute vec4 aTextHaloFill;\nvarying vec4 vTextHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nattribute float aTextHaloRadius;\nvarying float vTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nattribute float aTextHaloOpacity;\nvarying float vTextHaloOpacity;\n#endif\n#include <highlight_vert>\n#else\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n#ifdef HAS_TEXT_DX\nfloat d = aTextDx;\n#else\nfloat d = textDx;\n#endif\n#ifdef HAS_TEXT_DY\nfloat e = aTextDy;\n#else\nfloat e = textDy;\n#endif\n#ifdef HAS_TEXT_SIZE\nfloat f = aTextSize * layerScale;\n#else\nfloat f = textSize * layerScale;\n#endif\n#ifdef HAS_PITCH_ALIGN\nfloat h = aPitchAlign;\n#else\nfloat h = pitchWithMap;\n#endif\ngl_Position = projViewModelMatrix * vec4(c, 1.);\n float i = gl_Position.w;\n float j = i / cameraToCenterDistance;\n float k;\n if(isRenderingTerrain == 1.) {\n k = 1.;\n } else {\n float l = (1. - cameraToCenterDistance / i) * textPerspectiveRatio;\n k = clamp(.5 + .5 * (1. - l), .0, 4.);\n }\n#ifdef HAS_OFFSET_Z\nvec3 m = aOffset / 10.0;\n m[2] /= altitudeScale;\n#else\nvec3 m = vec3(aOffset / 10.0, .0);\n#endif\nvec2 n = aTexCoord;\n if(h == 1.) {\n float o;\n if(isRenderingTerrain == 1.) {\n o = tileRatio;\n } else {\n o = tileRatio / zoomScale * j * k;\n }\n m.xy *= o;\n gl_Position = projViewModelMatrix * vec4(c + m, 1.);\n } else {\n gl_Position.xy += m.xy * 2. / canvasSize * k * i;\n }\n gl_Position.xy += vec2(d, -e) * 2. / canvasSize * i;\n if(textPitchFilter > .0) {\n if(textPitchFilter == 1. && h == .0 || textPitchFilter == 2. && h == 1.) {\n gl_Position = vec4(-9999., -9999., .0, 1.);\n }\n }\n#ifndef PICKING_MODE\nif(h == 1.) {\n vGammaScale = j + mapPitch / 4.;\n } else {\n vGammaScale = mix(1., j, textPerspectiveRatio);\n }\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vTexCoord = n / texSize;\n vSize = f;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity *= aColorOpacity / 255.;\n#endif\n#ifdef HAS_TEXT_FILL\nvTextFill = aTextFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvTextHaloFill = aTextHaloFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nvTextHaloRadius = aTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nvTextHaloOpacity = aTextHaloOpacity;\n#endif\nhighlight_setVarying();\n#else\n#ifdef ENABLE_COLLISION\nbool u = aOpacity == 255.;\n#else\nbool u = true;\n#endif\nfbo_picking_setData(gl_Position.w, u);\n#endif\n}";
14717
- const Ed = function(t) {
14695
+ var Od = "#define SHADER_NAME TEXT_LINE\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec2 aTexCoord;\n#ifdef HAS_OFFSET_Z\nattribute vec3 aOffset;\nuniform float altitudeScale;\n#else\nattribute vec2 aOffset;\n#endif\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute float aColorOpacity;\n#endif\n#ifdef HAS_TEXT_SIZE\nattribute float aTextSize;\n#else\nuniform float textSize;\n#endif\n#ifdef HAS_TEXT_DX\nattribute float aTextDx;\n#else\nuniform float textDx;\n#endif\n#ifdef HAS_TEXT_DY\nattribute float aTextDy;\n#else\nuniform float textDy;\n#endif\n#if defined(HAS_PITCH_ALIGN)\nattribute float aPitchAlign;\n#else\nuniform float pitchWithMap;\n#endif\nuniform float zoomScale;\nuniform float cameraToCenterDistance;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform float mapPitch;\nuniform vec2 texSize;\nuniform vec2 canvasSize;\nuniform float tileRatio;\nuniform float layerScale;\nuniform float isRenderingTerrain;\nuniform float textPitchFilter;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vGammaScale;\nvarying float vSize;\nvarying float vOpacity;\n#ifdef HAS_TEXT_FILL\nattribute vec4 aTextFill;\nvarying vec4 vTextFill;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nattribute vec4 aTextHaloFill;\nvarying vec4 vTextHaloFill;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nattribute float aTextHaloRadius;\nvarying float vTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nattribute float aTextHaloOpacity;\nvarying float vTextHaloOpacity;\n#endif\n#include <highlight_vert>\n#else\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n#ifdef HAS_TEXT_DX\nfloat d = aTextDx;\n#else\nfloat d = textDx;\n#endif\n#ifdef HAS_TEXT_DY\nfloat e = aTextDy;\n#else\nfloat e = textDy;\n#endif\n#ifdef HAS_TEXT_SIZE\nfloat f = aTextSize * layerScale;\n#else\nfloat f = textSize * layerScale;\n#endif\n#ifdef HAS_PITCH_ALIGN\nfloat h = aPitchAlign;\n#else\nfloat h = pitchWithMap;\n#endif\ngl_Position = projViewModelMatrix * vec4(c, 1.);\n float i = gl_Position.w;\n float j = i / cameraToCenterDistance;\n float k;\n if(isRenderingTerrain == 1.) {\n k = 1.;\n } else {\n float l = (1. - cameraToCenterDistance / i) * textPerspectiveRatio;\n k = clamp(.5 + .5 * (1. - l), .0, 4.);\n }\n#ifdef HAS_OFFSET_Z\nvec3 m = aOffset / 10.0;\n m[2] /= altitudeScale;\n#else\nvec3 m = vec3(aOffset / 10.0, .0);\n#endif\nvec2 n = aTexCoord;\n if(h == 1.) {\n float o;\n if(isRenderingTerrain == 1.) {\n o = tileRatio;\n } else {\n o = tileRatio / zoomScale * j * k;\n }\n m.xy *= o;\n gl_Position = projViewModelMatrix * vec4(c + m, 1.);\n } else {\n gl_Position.xy += m.xy * 2. / canvasSize * k * i;\n }\n gl_Position.xy += vec2(d, -e) * 2. / canvasSize * i;\n if(textPitchFilter > .0) {\n if(textPitchFilter == 1. && h == .0 || textPitchFilter == 2. && h == 1.) {\n gl_Position = vec4(-9999., -9999., .0, 1.);\n }\n }\n#ifndef PICKING_MODE\nif(h == 1.) {\n vGammaScale = j + mapPitch / 4.;\n } else {\n vGammaScale = mix(1., j, textPerspectiveRatio);\n }\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vTexCoord = n / texSize;\n vSize = f;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity *= aColorOpacity / 255.;\n#endif\n#ifdef HAS_TEXT_FILL\nvTextFill = aTextFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvTextHaloFill = aTextHaloFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_RADIUS\nvTextHaloRadius = aTextHaloRadius;\n#endif\n#ifdef HAS_TEXT_HALO_OPACITY\nvTextHaloOpacity = aTextHaloOpacity;\n#endif\nhighlight_setVarying();\n#else\n#ifdef ENABLE_COLLISION\nbool u = aOpacity == 255.;\n#else\nbool u = true;\n#endif\nfbo_picking_setData(gl_Position.w, u);\n#endif\n}";
14696
+ const Cd = function(t) {
14718
14697
  const e = this.layer.getRenderer();
14719
14698
  return !this.Es(t) && e.isTileNearCamera(t) && "line" !== t.geometry.properties.textPlacement;
14720
- }, Dd = function(t) {
14699
+ }, Ed = function(t) {
14721
14700
  const e = this.layer.getRenderer();
14722
14701
  return !this.Es(t) && !e.isForeground(t) && "line" !== t.geometry.properties.textPlacement;
14723
- }, zd = function(t) {
14702
+ }, Dd = function(t) {
14724
14703
  const e = this.layer.getRenderer();
14725
14704
  return !this.Es(t) && e.isTileNearCamera(t) && "line" === t.geometry.properties.textPlacement;
14726
- }, Ld = function(t) {
14705
+ }, zd = function(t) {
14727
14706
  const e = this.layer.getRenderer(), n = t.properties.tile.z, i = e.getCurrentTileZoom();
14728
14707
  return !this.Es(t) && !e.isForeground(t) && "line" === t.geometry.properties.textPlacement && n < i;
14729
- }, Rd = [ 0, 0, 3 ], Nd = [], Hd = [], jd = [], Vd = [], Ud = [], Gd = [], Wd = [], Bd = [], $d = [ 1, -1 ], Yd = new Int16Array(3), Xd = [], qd = [], Jd = [], Kd = [], Zd = [], Qd = [], tp = [], ep = {}, np = {}, ip = {}, rp = [], sp = [], op = n.mat4.identity([]), ap = [];
14730
- class lp extends ef {
14708
+ }, Ld = [ 0, 0, 3 ], Rd = [], Nd = [], Hd = [], jd = [], Vd = [], Ud = [], Gd = [], Wd = [], Bd = [ 1, -1 ], $d = new Int16Array(3), Yd = [], Xd = [], qd = [], Jd = [], Kd = [], Zd = [], Qd = [], tp = {}, ep = {}, np = {}, ip = [], rp = [], sp = n.mat4.identity([]), op = [];
14709
+ class ap extends ef {
14731
14710
  static getBloomSymbol() {
14732
14711
  return [ "textBloom" ];
14733
14712
  }
14734
14713
  constructor(t, e, n, i, r, s) {
14735
14714
  super(t, e, n, i, r, s), this.propAllowOverlap = "textAllowOverlap", this.propIgnorePlacement = "textIgnorePlacement",
14736
- this.colorCache = {}, this.eo = Ed.bind(this), this.no = Dd.bind(this), this.io = zd.bind(this),
14737
- this.ro = Ld.bind(this), this.isLabelCollides = Kf.bind(this), this.so();
14715
+ this.colorCache = {}, this.eo = Cd.bind(this), this.no = Ed.bind(this), this.io = Dd.bind(this),
14716
+ this.ro = zd.bind(this), this.isLabelCollides = Kf.bind(this), this.so();
14738
14717
  }
14739
14718
  prepareRender(...t) {
14740
14719
  super.prepareRender(...t);
@@ -14775,9 +14754,9 @@
14775
14754
  const n = bo.createExpression(e.textName, "string");
14776
14755
  this.lo[t] = (t, e) => {
14777
14756
  let i;
14778
- ep.zoom = t, np.properties = e;
14757
+ tp.zoom = t, ep.properties = e;
14779
14758
  try {
14780
- i = n.evaluateWithoutErrorHandling(ep, np, ip, null, rp);
14759
+ i = n.evaluateWithoutErrorHandling(tp, ep, np, null, ip);
14781
14760
  } catch (t) {
14782
14761
  i = null;
14783
14762
  }
@@ -14795,7 +14774,7 @@
14795
14774
  return $f(t, e);
14796
14775
  }
14797
14776
  isBloom(t) {
14798
- return !!this.getSymbol(t.properties.symbolIndex)[lp.getBloomSymbol()[0]];
14777
+ return !!this.getSymbol(t.properties.symbolIndex)[ap.getBloomSymbol()[0]];
14799
14778
  }
14800
14779
  createGeometry(t, e, n) {
14801
14780
  const i = t;
@@ -14838,7 +14817,7 @@
14838
14817
  fo() {
14839
14818
  let t = this.scene.getMeshes();
14840
14819
  if (!t || !t.length) return;
14841
- const e = -this.getMap().getBearing() * Math.PI / 180, i = n.mat2.fromRotation(jd, e), r = (t, e, n, i) => {
14820
+ const e = -this.getMap().getBearing() * Math.PI / 180, i = n.mat2.fromRotation(Hd, e), r = (t, e, n, i) => {
14842
14821
  const {start: r, end: s, mesh: o, allElements: a} = e[0];
14843
14822
  if (this.updateBoxCollisionFading(!0, o, e, n, i)) {
14844
14823
  let e = t.count;
@@ -14846,7 +14825,7 @@
14846
14825
  t.count = e;
14847
14826
  }
14848
14827
  }, s = this.isEnableCollision(), o = this.layer.getRenderer();
14849
- t = t.sort(up);
14828
+ t = t.sort(hp);
14850
14829
  for (let e = 0; e < t.length; e++) {
14851
14830
  const n = t[e];
14852
14831
  if (!this.isMeshIterable(n)) continue;
@@ -14891,7 +14870,7 @@
14891
14870
  if (!o) return;
14892
14871
  const a = i.getPitch(), l = i.getBearing(), {lineTextPitch: h, lineTextBearing: u} = t.properties, c = 1 === t.material.uniforms.pitchWithMap, f = s.elements;
14893
14872
  if (!c) {
14894
- const e = n.mat4.multiply(Nd, i.projViewMatrix, t.localTransform), r = o.id + "-" + e.join();
14873
+ const e = n.mat4.multiply(Rd, i.projViewMatrix, t.localTransform), r = o.id + "-" + e.join();
14895
14874
  let a;
14896
14875
  this.co[r] ? o = this.co[r] : (a = s.projectedLine = s.projectedLine || new Array(o.length),
14897
14876
  o = this.yo(a, o, e, i.width, i.height), this.co[r] = a);
@@ -14921,7 +14900,7 @@
14921
14900
  return o;
14922
14901
  }
14923
14902
  forEachBox(t, e) {
14924
- const i = this.getMap(), r = n.mat4.multiply(Nd, i.projViewMatrix, t.properties.tileVectorTransform), {collideIds: s, aCount: o, features: a, elements: l} = t.geometry.properties, h = s;
14903
+ const i = this.getMap(), r = n.mat4.multiply(Rd, i.projViewMatrix, t.properties.tileVectorTransform), {collideIds: s, aCount: o, features: a, elements: l} = t.geometry.properties, h = s;
14925
14904
  if (!h) return;
14926
14905
  const u = this.isEnableUniquePlacement(), c = this.Os(1);
14927
14906
  c[0].allElements = l, c[0].mesh = t;
@@ -14944,58 +14923,58 @@
14944
14923
  w || (w = p.properties.aProjectedAnchor = new Array(v.length / y * 3));
14945
14924
  const A = p.properties.aTextSize, M = !a, S = e[i], _ = S * y;
14946
14925
  let k;
14947
- k = p.data.aAltitude ? n.vec3.set(Vd, v[_], v[_ + 1], x[S]) : ul.unpackPosition(Vd, v[_], v[_ + 1], v[_ + 2]);
14948
- const P = ec(Ud, k, o, d.width, d.height), T = p.properties.aTerrainAltitude;
14926
+ k = p.data.aAltitude ? n.vec3.set(jd, v[_], v[_ + 1], x[S]) : ul.unpackPosition(jd, v[_], v[_ + 1], v[_ + 2]);
14927
+ const P = ec(Vd, k, o, d.width, d.height), T = p.properties.aTerrainAltitude;
14949
14928
  let I;
14950
14929
  if (T) {
14951
14930
  const t = T[S];
14952
14931
  if (t === bh) return w[3 * S] = xh, w[3 * S + 1] = xh, w[3 * S + 2] = xh, !1;
14953
- t ? (I = n.vec3.set(sp, ...k), I[2] = 100 * t, I = ec(I, I, o, d.width, d.height)) : I = P;
14932
+ t ? (I = n.vec3.set(rp, ...k), I[2] = 100 * t, I = ec(I, I, o, d.width, d.height)) : I = P;
14954
14933
  } else I = P;
14955
14934
  const F = d.getDevicePixelRatio();
14956
- if (n.vec4.scale(ap, I, 1 / F), d.isOffscreen(ap)) return f || hp(g, e, i, r), w[3 * S] = xh,
14935
+ if (n.vec4.scale(op, I, 1 / F), d.isOffscreen(op)) return f || lp(g, e, i, r), w[3 * S] = xh,
14957
14936
  w[3 * S + 1] = xh, w[3 * S + 2] = xh, !1;
14958
14937
  M && (k = P), w[3 * S] = I[0], w[3 * S + 1] = I[1], w[3 * S + 2] = I[2];
14959
14938
  const O = M ? 1 : p.properties.tileExtent / this.layer.getTileSize().width;
14960
14939
  let C = !0;
14961
- const E = e[i], D = e[r - 1], z = A ? A[E] : t.properties.textSize, L = this.vo(t, z, s, E, D, k, Vd, O, a);
14962
- if (null === L) return hp(g, e, i, r), !1;
14940
+ const E = e[i], D = e[r - 1], z = A ? A[E] : t.properties.textSize, L = this.vo(t, z, s, E, D, k, jd, O, a);
14941
+ if (null === L) return lp(g, e, i, r), !1;
14963
14942
  const R = D - E <= 3, N = Math.floor(L / 2), H = L % 2;
14964
14943
  for (let a = i; a < r; a += 6) {
14965
14944
  const l = e[a];
14966
14945
  let d;
14967
- if (d = N || a !== i || R || c ? N || a !== r - 6 || R || c ? Td.call(this, Hd, t, z, s, l, k, Vd, O, N, I, this.layer, o, u) : tp : Qd,
14946
+ if (d = N || a !== i || R || c ? N || a !== r - 6 || R || c ? Pd.call(this, Nd, t, z, s, l, k, jd, O, N, I, this.layer, o, u) : Qd : Zd,
14968
14947
  !d) {
14969
- C = !1, f || hp(g, e, i, r);
14948
+ C = !1, f || lp(g, e, i, r);
14970
14949
  break;
14971
14950
  }
14972
14951
  let p = d[2];
14973
14952
  H && (p -= Math.PI / 2);
14974
- const y = mf(Gd, p, 0, h.rotateWithMap, h.pitchWithMap), v = g.length > m.length;
14953
+ const y = mf(Ud, p, 0, h.rotateWithMap, h.pitchWithMap), v = g.length > m.length;
14975
14954
  let x;
14976
14955
  if (v) {
14977
- n.vec3.set(Kd, b[3 * l], b[3 * l + 1], 0);
14978
- const t = n.vec3.normalize(Kd, Kd), e = -b[3 * l + 2];
14956
+ n.vec3.set(Jd, b[3 * l], b[3 * l + 1], 0);
14957
+ const t = n.vec3.normalize(Jd, Jd), e = -b[3 * l + 2];
14979
14958
  if (e) {
14980
- const i = n.quat.setAxisAngle(Xd, t, e);
14981
- n.mat4.fromTranslation(qd, Rd), n.mat4.fromQuat(Jd, i), x = n.mat4.multiply(Jd, Jd, qd);
14959
+ const i = n.quat.setAxisAngle(Yd, t, e);
14960
+ n.mat4.fromTranslation(Xd, Ld), n.mat4.fromQuat(qd, i), x = n.mat4.multiply(qd, qd, Xd);
14982
14961
  }
14983
14962
  }
14984
14963
  for (let t = 0; t < 4; t++) {
14985
14964
  const e = 2 * (l + t);
14986
- n.vec2.set(Wd, m[e] / 10, m[e + 1] / 10), n.vec2.scale(Wd, Wd, z / 24), n.vec2.transformMat2(Wd, Wd, y),
14987
- u ? (n.vec2.multiply(Wd, Wd, $d), n.vec2.add(Bd, Wd, d), v && (Bd[2] = 0, x && n.vec3.transformMat4(Bd, Bd, x))) : (n.vec2.multiply(Bd, d, $d),
14988
- n.vec2.add(Bd, Wd, Bd)), Yd[0] = 10 * Bd[0], Yd[1] = 10 * Bd[1], v && (Yd[2] = 10 * Bd[2]);
14965
+ n.vec2.set(Gd, m[e] / 10, m[e + 1] / 10), n.vec2.scale(Gd, Gd, z / 24), n.vec2.transformMat2(Gd, Gd, y),
14966
+ u ? (n.vec2.multiply(Gd, Gd, Bd), n.vec2.add(Wd, Gd, d), v && (Wd[2] = 0, x && n.vec3.transformMat4(Wd, Wd, x))) : (n.vec2.multiply(Wd, d, Bd),
14967
+ n.vec2.add(Wd, Gd, Wd)), $d[0] = 10 * Wd[0], $d[1] = 10 * Wd[1], v && ($d[2] = 10 * Wd[2]);
14989
14968
  const i = (v ? 3 : 2) * (l + t);
14990
- (g[i] !== Yd[0] || g[i + 1] !== Yd[1] || v && g[i + 2] !== Yd[2]) && (g.dirty = !0,
14991
- g[i] = Yd[0], g[i + 1] = Yd[1], v && (g[i + 2] = Yd[2]));
14969
+ (g[i] !== $d[0] || g[i + 1] !== $d[1] || v && g[i + 2] !== $d[2]) && (g.dirty = !0,
14970
+ g[i] = $d[0], g[i + 1] = $d[1], v && (g[i + 2] = $d[2]));
14992
14971
  }
14993
14972
  }
14994
14973
  return C;
14995
14974
  }
14996
14975
  vo(t, e, n, i, r, s, o, a, l) {
14997
14976
  const h = r - i <= 3, u = this.getMap();
14998
- return h ? 0 : Od.call(this, Qd, tp, t, e, n, i, r, s, o, a, u.width / u.height, l);
14977
+ return h ? 0 : Fd.call(this, Zd, Qd, t, e, n, i, r, s, o, a, u.width / u.height, l);
14999
14978
  }
15000
14979
  isBoxCollides(t, e, n, i, r, s) {
15001
14980
  return this.isLabelCollides(0, t, e, n, i, r, s);
@@ -15033,7 +15012,7 @@
15033
15012
  if (this.layer.getRenderer().isEnableWorkAround("win-intel-gpu-crash") && (o = Ih({}, i),
15034
15013
  o.stencil = Ih({}, i.stencil), o.stencil.enable = !0, o.stencil.func.cmp = "<",
15035
15014
  o.stencil.func.ref = (t, e) => 2 * e.level + (e.isHalo || 0) + 1), this.do = new n.reshader.MeshShader({
15036
- vert: Cd,
15015
+ vert: Od,
15037
15016
  frag: nd,
15038
15017
  uniforms: e,
15039
15018
  extraCommandProps: o
@@ -15050,7 +15029,7 @@
15050
15029
  return "line" !== this.getSymbol(e).textPlacement;
15051
15030
  };
15052
15031
  const i = new n.reshader.FBORayPicking(this.renderer, {
15053
- vert: "#define PICKING_MODE 1\n" + Cd,
15032
+ vert: "#define PICKING_MODE 1\n" + Od,
15054
15033
  uniforms: e,
15055
15034
  extraCommandProps: {
15056
15035
  viewport: this.pickingViewport
@@ -15060,7 +15039,7 @@
15060
15039
  }
15061
15040
  }
15062
15041
  getUniformValues(t, e) {
15063
- const i = e && e.isRenderingTerrainSkin, r = this.layer.getTileSize().width, s = i ? op : t.projViewMatrix, o = t.cameraToCenterDistance, a = n.vec2.set(Zd, t.width, t.height);
15042
+ const i = e && e.isRenderingTerrainSkin, r = this.layer.getTileSize().width, s = i ? sp : t.projViewMatrix, o = t.cameraToCenterDistance, a = n.vec2.set(Kd, t.width, t.height);
15064
15043
  i && n.vec2.set(a, r, r);
15065
15044
  const l = rh(t.getResolution(), t);
15066
15045
  return {
@@ -15081,7 +15060,7 @@
15081
15060
  };
15082
15061
  }
15083
15062
  }
15084
- function hp(t, e, n, i) {
15063
+ function lp(t, e, n, i) {
15085
15064
  for (let r = n; r < i; r += 6) {
15086
15065
  const n = e[r];
15087
15066
  for (let e = 0; e < 4; e++) {
@@ -15090,17 +15069,17 @@
15090
15069
  }
15091
15070
  }
15092
15071
  }
15093
- function up(t, e) {
15072
+ function hp(t, e) {
15094
15073
  const n = t.properties.level - e.properties.level;
15095
15074
  return 0 === n ? t.properties.meshKey - e.properties.meshKey : n;
15096
15075
  }
15097
- var cp = "#define SHADER_NAME NATIVE_POINT\n#include <gl2_vert>\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\n#ifdef HAS_COLOR\nattribute vec4 aColor;\nvarying vec4 vColor;\n#endif\nuniform mat4 positionMatrix;\nuniform mat4 projViewModelMatrix;\nuniform float markerSize;\n#ifdef PICKING_MODE\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n gl_Position = projViewModelMatrix * positionMatrix * vec4(c, 1.);\n gl_PointSize = markerSize;\n#ifdef HAS_COLOR\nvColor = aColor / 255.;\n#endif\n#ifdef PICKING_MODE\nfbo_picking_setData(gl_Position.w, true);\n#endif\n}";
15098
- const fp = {
15076
+ var up = "#define SHADER_NAME NATIVE_POINT\n#include <gl2_vert>\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\n#ifdef HAS_COLOR\nattribute vec4 aColor;\nvarying vec4 vColor;\n#endif\nuniform mat4 positionMatrix;\nuniform mat4 projViewModelMatrix;\nuniform float markerSize;\n#ifdef PICKING_MODE\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n gl_Position = projViewModelMatrix * positionMatrix * vec4(c, 1.);\n gl_PointSize = markerSize;\n#ifdef HAS_COLOR\nvColor = aColor / 255.;\n#endif\n#ifdef PICKING_MODE\nfbo_picking_setData(gl_Position.w, true);\n#endif\n}";
15077
+ const cp = {
15099
15078
  markerFill: [ 0, 0, 0 ],
15100
15079
  markerOpacity: 1,
15101
15080
  markerSize: 10
15102
15081
  };
15103
- class dp extends Sc {
15082
+ class fp extends Sc {
15104
15083
  getPrimitive() {
15105
15084
  return "points";
15106
15085
  }
@@ -15121,7 +15100,7 @@
15121
15100
  const a = {};
15122
15101
  Dh(a, "markerOpacity", o, "markerOpacity", 1), Dh(a, "markerSize", o, "markerSize", 10),
15123
15102
  Dh(a, "markerFill", o, "markerFill", "#000", Rh(this.colorCache, 3));
15124
- const l = new n.reshader.Material(a, fp);
15103
+ const l = new n.reshader.Material(a, cp);
15125
15104
  l.createDefines = () => "square" !== o.markerType ? {
15126
15105
  USE_CIRCLE: 1
15127
15106
  } : null, l.appendDefines = t => ("square" !== o.markerType && (t.USE_CIRCLE = 1),
@@ -15153,7 +15132,7 @@
15153
15132
  const t = this.regl;
15154
15133
  this.renderer = new n.reshader.Renderer(t);
15155
15134
  const e = [], i = {
15156
- vert: cp,
15135
+ vert: up,
15157
15136
  frag: "#define SHADER_NAME NATIVE_POINT\nprecision mediump float;\n#include <gl2_frag>\n#ifdef USE_CIRCLE\n#if __VERSION__ == 100\n#ifdef GL_OES_standard_derivatives\n#define STANDARD_DERIVATIVES_ENABLED 1\n#extension GL_OES_standard_derivatives : enable\n#endif\n#else\n#define STANDARD_DERIVATIVES_ENABLED 1\n#endif\n#endif\n#ifdef HAS_COLOR\nvarying vec4 vColor;\n#else\nuniform vec3 markerFill;\n#endif\nuniform float markerOpacity;\nuniform float layerOpacity;\nvoid main() {\n float c = 1.;\n#ifdef USE_CIRCLE\nfloat r = .0, d = .0;\n vec2 e = 2. * gl_PointCoord - 1.;\n r = dot(e, e);\n if(r > 1.) {\n discard;\n }\n#ifdef STANDARD_DERIVATIVES_ENABLED\nd = fwidth(r);\n c = 1. - smoothstep(1. - d, 1. + d, r);\n#endif\n#endif\n#ifdef HAS_COLOR\nvec4 f = vColor;\n#else\nvec4 f = vec4(markerFill, 1.);\n#endif\nglFragColor = f * markerOpacity * c * layerOpacity;\n#if __VERSION__ == 100\ngl_FragColor = glFragColor;\n#endif\n}",
15158
15137
  uniforms: [ {
15159
15138
  name: "projViewModelMatrix",
@@ -15186,7 +15165,7 @@
15186
15165
  if (this.shader = new n.reshader.MeshShader(i), this.shader.version = 300, this.pickingFBO) {
15187
15166
  const t = [];
15188
15167
  this.picking = [ new n.reshader.FBORayPicking(this.renderer, {
15189
- vert: "#define PICKING_MODE 1\n" + cp,
15168
+ vert: "#define PICKING_MODE 1\n" + up,
15190
15169
  uniforms: [ {
15191
15170
  name: "projViewModelMatrix",
15192
15171
  type: "function",
@@ -15206,9 +15185,9 @@
15206
15185
  };
15207
15186
  }
15208
15187
  }
15209
- var pp = "#define SHADER_NAME NATIVE_LINE\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nuniform mat4 projViewModelMatrix;\n#ifndef PICKING_MODE\n#if defined(HAS_COLOR)\nattribute vec4 aColor;\nvarying vec4 vColor;\n#endif\n#else\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n gl_Position = projViewModelMatrix * vec4(c, 1.);\n#ifndef PICKING_MODE\n#if defined(HAS_COLOR)\nvColor = aColor / 255.;\n#endif\n#else\nfbo_picking_setData(gl_Position.w, true);\n#endif\n}";
15210
- const yp = n.mat4.identity([]);
15211
- class mp extends Sc {
15188
+ var dp = "#define SHADER_NAME NATIVE_LINE\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nuniform mat4 projViewModelMatrix;\n#ifndef PICKING_MODE\n#if defined(HAS_COLOR)\nattribute vec4 aColor;\nvarying vec4 vColor;\n#endif\n#else\n#include <fbo_picking_vert>\n#endif\n#include <vt_position_vert>\nvoid main() {\n vec3 c = unpackVTPosition();\n gl_Position = projViewModelMatrix * vec4(c, 1.);\n#ifndef PICKING_MODE\n#if defined(HAS_COLOR)\nvColor = aColor / 255.;\n#endif\n#else\nfbo_picking_setData(gl_Position.w, true);\n#endif\n}";
15189
+ const pp = n.mat4.identity([]);
15190
+ class yp extends Sc {
15212
15191
  constructor(t, e, n, i, r, s) {
15213
15192
  if (super(t, e, n, i, r, s), this.primitive = "lines", I(this.symbolDef.lineColor)) {
15214
15193
  const t = e.getMap(), n = O(this.symbolDef.lineColor);
@@ -15253,7 +15232,7 @@
15253
15232
  return n.mat4.multiply(i, e.projViewMatrix, e.modelMatrix), i;
15254
15233
  }
15255
15234
  } ], o = this.sceneConfig.depthRange, a = {
15256
- vert: pp,
15235
+ vert: dp,
15257
15236
  frag: "#define SHADER_NAME NATIVE_LINE\nprecision mediump float;\nuniform float lineOpacity;\nuniform vec4 lineColor;\nuniform float layerOpacity;\n#if defined(HAS_COLOR)\nvarying vec4 vColor;\n#endif\nvoid main() {\n gl_FragColor = lineColor * lineOpacity;\n#if defined(HAS_COLOR)\ngl_FragColor *= vColor;\n#endif\ngl_FragColor *= layerOpacity;\n}",
15258
15237
  uniforms: s,
15259
15238
  defines: null,
@@ -15290,7 +15269,7 @@
15290
15269
  }
15291
15270
  };
15292
15271
  this.shader = new n.reshader.MeshShader(a), this.pickingFBO && (this.picking = [ new n.reshader.FBORayPicking(this.renderer, {
15293
- vert: "#define PICKING_MODE 1\n" + pp,
15272
+ vert: "#define PICKING_MODE 1\n" + dp,
15294
15273
  uniforms: s,
15295
15274
  extraCommandProps: {
15296
15275
  viewport: this.pickingViewport
@@ -15300,7 +15279,7 @@
15300
15279
  getUniformValues(t, e) {
15301
15280
  const n = e && e.isRenderingTerrainSkin;
15302
15281
  return {
15303
- projViewMatrix: n ? yp : t.projViewMatrix,
15282
+ projViewMatrix: n ? pp : t.projViewMatrix,
15304
15283
  viewport: n && e && e.viewport
15305
15284
  };
15306
15285
  }
@@ -15308,8 +15287,8 @@
15308
15287
  return "lines";
15309
15288
  }
15310
15289
  }
15311
- const gp = [ 1, 1, 1 ], vp = [ 1, 1, 1, 1 ], xp = [ 0, 0 ], bp = [ 1, 1 ], wp = [], Ap = new r.Coordinate(0, 0), Mp = new r.Coordinate(0, 0), Sp = [], _p = [];
15312
- class kp extends wc {
15290
+ const mp = [ 1, 1, 1 ], gp = [ 1, 1, 1, 1 ], vp = [ 0, 0 ], xp = [ 1, 1 ], bp = [], wp = new r.Coordinate(0, 0), Ap = new r.Coordinate(0, 0), Mp = [], Sp = [];
15291
+ class _p extends wc {
15313
15292
  supportRenderMode(t) {
15314
15293
  return this.isAnimating() ? "fxaa" === t || "fxaaAfterTaa" === t : "taa" === t || "fxaa" === t;
15315
15294
  }
@@ -15326,9 +15305,9 @@
15326
15305
  if (!this.material) return this.setToRedraw(), null;
15327
15306
  const {geometry: s, symbolIndex: o} = t, a = this.layer instanceof r.TileLayer, l = new n.reshader.Mesh(s, this.material);
15328
15307
  if (this.sceneConfig.animation) {
15329
- gp[2] = .01;
15308
+ mp[2] = .01;
15330
15309
  const t = [];
15331
- n.mat4.fromScaling(t, gp), n.mat4.multiply(t, e, t), e = t;
15310
+ n.mat4.fromScaling(t, mp), n.mat4.multiply(t, e, t), e = t;
15332
15311
  }
15333
15312
  const h = this.getSymbolDef(o), u = this.getFnTypeConfig(o);
15334
15313
  Uu(s, h, u);
@@ -15350,12 +15329,12 @@
15350
15329
  }
15351
15330
  });
15352
15331
  } else {
15353
- Dh(l.uniforms, "polygonFill", d, "polygonFill", vp, p), Dh(l.uniforms, "polygonOpacity", d, "polygonOpacity", 1);
15332
+ Dh(l.uniforms, "polygonFill", d, "polygonFill", gp, p), Dh(l.uniforms, "polygonOpacity", d, "polygonOpacity", 1);
15354
15333
  const t = [];
15355
15334
  Object.defineProperty(l.uniforms, "vertexColorsOfType", {
15356
15335
  enumerable: !0,
15357
15336
  get: () => {
15358
- const e = p(d.bottomPolygonFill || vp), n = p(d.topPolygonFill || vp);
15337
+ const e = p(d.bottomPolygonFill || gp), n = p(d.topPolygonFill || gp);
15359
15338
  t[0] = e[0], t[1] = e[1], t[2] = e[2], t[3] = e[3], t[4] = n[0], t[5] = n[1], t[6] = n[2],
15360
15339
  t[7] = n[3];
15361
15340
  const i = l.geometry.properties.vertexColors;
@@ -15412,13 +15391,13 @@
15412
15391
  if (1 === this.dataConfig.topUVMode) return t[0] = 0, t[1] = 0, t;
15413
15392
  const a = this.getMap(), l = this.getSymbol(e).material;
15414
15393
  let h = i;
15415
- !this.dataConfig.side && l && l.textureOrigin && (Ap.set(l.textureOrigin[0], l.textureOrigin[1]),
15416
- a.coordToPointAtRes(Ap, r, Mp), h = n.vec2.set(Sp, i[0] - Mp.x, i[1] - Mp.y));
15394
+ !this.dataConfig.side && l && l.textureOrigin && (wp.set(l.textureOrigin[0], l.textureOrigin[1]),
15395
+ a.coordToPointAtRes(wp, r, Ap), h = n.vec2.set(Mp, i[0] - Ap.x, i[1] - Ap.y));
15417
15396
  const u = !!l && l.uvOffsetInMeter;
15418
- let c = l && l.uvOffset || xp;
15397
+ let c = l && l.uvOffset || vp;
15419
15398
  const f = this.getUVOffsetAnim();
15420
15399
  f && (c = this.getUVOffset(f));
15421
- const d = l && l.uvScale || bp;
15400
+ const d = l && l.uvScale || xp;
15422
15401
  let p = this.dataConfig.side ? 0 : h[0], y = this.dataConfig.side ? 0 : h[1];
15423
15402
  const m = l && l.textureWidth || 23.25, g = m * d[1] / d[0];
15424
15403
  u && (p += c[0] / s, y += c[1] / s);
@@ -15431,7 +15410,7 @@
15431
15410
  super.callShader(t, e);
15432
15411
  }
15433
15412
  getShadowMeshes() {
15434
- if (!this.isVisible()) return wp;
15413
+ if (!this.isVisible()) return bp;
15435
15414
  this.shadowCount = this.scene.getMeshes().length;
15436
15415
  const t = this.scene.getMeshes().filter((t => 0 === t.properties.level));
15437
15416
  for (let e = 0; e < t.length; e++) {
@@ -15445,7 +15424,7 @@
15445
15424
  return t.material && t.material.uvOffsetAnim;
15446
15425
  }
15447
15426
  getUVOffset(t) {
15448
- const e = this.getSymbols()[0], i = e.material && e.material.uvOffset || xp, r = !!e.material && e.material.uvOffsetInMeter, s = performance.now() / 1e3, o = n.vec2.set(_p, i[0], i[1]);
15427
+ const e = this.getSymbols()[0], i = e.material && e.material.uvOffset || vp, r = !!e.material && e.material.uvOffsetInMeter, s = performance.now() / 1e3, o = n.vec2.set(Sp, i[0], i[1]);
15449
15428
  return o[0] = s * t[0], o[1] = s * t[0], r || (o[0] %= 1, o[1] %= 1), o;
15450
15429
  }
15451
15430
  needPolygonOffset() {
@@ -15462,7 +15441,7 @@
15462
15441
  Pr(t, e) {
15463
15442
  if (null !== e) {
15464
15443
  const i = t.localTransform;
15465
- 0 === e && (e = .01), gp[2] = e, n.mat4.fromScaling(i, gp), n.mat4.multiply(i, t.properties.tileTransform, i),
15444
+ 0 === e && (e = .01), mp[2] = e, n.mat4.fromScaling(i, mp), n.mat4.multiply(i, t.properties.tileTransform, i),
15466
15445
  t.setLocalTransform(i);
15467
15446
  } else t.setLocalTransform(t.properties.tileTransform);
15468
15447
  t.material !== this.material && t.setMaterial(this.material), t.geometry.properties.maxAltitude <= 0 && (this.wo = !0),
@@ -15517,26 +15496,26 @@
15517
15496
  updateSymbol(t, e) {
15518
15497
  let n = !1;
15519
15498
  t && t.material && (n = function(t, e) {
15520
- for (const n in e) if (Tp[n] && e[n] !== t[n] && (!t[n] || !e[n])) return !0;
15499
+ for (const n in e) if (Pp[n] && e[n] !== t[n] && (!t[n] || !e[n])) return !0;
15521
15500
  return !1;
15522
15501
  }(this.symbolDef[0].material || {}, t.material));
15523
15502
  const i = super.updateSymbol(t, e);
15524
15503
  return t && t.material && this.Ao(t.material), n || i;
15525
15504
  }
15526
15505
  ir(t, e) {
15527
- return Pp(t) !== Pp(e);
15506
+ return kp(t) !== kp(e);
15528
15507
  }
15529
15508
  }
15530
- function Pp(t) {
15509
+ function kp(t) {
15531
15510
  if (!t || !t.material) return !1;
15532
15511
  for (const e in t.material) if (e.indexOf("Texture") > 0 && t.material[e]) return !0;
15533
15512
  return !1;
15534
15513
  }
15535
- const Tp = {
15514
+ const Pp = {
15536
15515
  normalTexture: 1,
15537
15516
  bumpTexture: 1
15538
15517
  };
15539
- class Ip extends kp {
15518
+ class Tp extends _p {
15540
15519
  createGeometry(t) {
15541
15520
  const e = t.data, i = this.getSymbols()[0];
15542
15521
  if (i.material && i.material.extrusionOpacity) {
@@ -15668,8 +15647,8 @@
15668
15647
  };
15669
15648
  }
15670
15649
  }
15671
- const Fp = [ 1, 1, 1 ];
15672
- class Op extends wc {
15650
+ const Ip = [ 1, 1, 1 ];
15651
+ class Fp extends wc {
15673
15652
  createGeometry(t) {
15674
15653
  const {data: e, indices: i} = t, r = new n.reshader.Geometry(e, i, 0, {
15675
15654
  primitive: "lines"
@@ -15684,9 +15663,9 @@
15684
15663
  createMesh(t, e) {
15685
15664
  const {geometry: i} = t, r = new n.reshader.Mesh(i);
15686
15665
  if (r.castShadow = !1, this.sceneConfig.animation) {
15687
- Fp[2] = .01;
15666
+ Ip[2] = .01;
15688
15667
  const t = [];
15689
- n.mat4.fromScaling(t, Fp), n.mat4.multiply(t, e, t), e = t;
15668
+ n.mat4.fromScaling(t, Ip), n.mat4.multiply(t, e, t), e = t;
15690
15669
  }
15691
15670
  return r.setLocalTransform(e), r.properties.symbolIndex = {
15692
15671
  index: 0
@@ -15695,7 +15674,7 @@
15695
15674
  addMesh(t, e) {
15696
15675
  if (!t.length) return this;
15697
15676
  let i;
15698
- null !== e ? (0 === e && (e = .01), i = t[0].localTransform, Fp[2] = e, n.mat4.fromScaling(i, Fp),
15677
+ null !== e ? (0 === e && (e = .01), i = t[0].localTransform, Ip[2] = e, n.mat4.fromScaling(i, Ip),
15699
15678
  n.mat4.multiply(i, t[0].properties.tileTransform, i)) : i = t[0].properties.tileTransform;
15700
15679
  for (let e = 0; e < t.length; e++) t[e].setLocalTransform(i);
15701
15680
  return this.scene.addMesh(t), this;
@@ -15751,8 +15730,8 @@
15751
15730
  };
15752
15731
  }
15753
15732
  }
15754
- const {getPBRUniforms: Cp} = n.reshader.pbr.PBRUtils;
15755
- class Ep extends kp {
15733
+ const {getPBRUniforms: Op} = n.reshader.pbr.PBRUtils;
15734
+ class Cp extends _p {
15756
15735
  constructor(...t) {
15757
15736
  super(...t), this._o = new n.reshader.ResourceLoader(null, this.layer.getURLModifier()),
15758
15737
  this.scene.sortFunction = this.sortByCommandKey;
@@ -15928,7 +15907,7 @@
15928
15907
  return this.shader;
15929
15908
  }
15930
15909
  getUniformValues(t, e) {
15931
- const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r = Cp(t, n, i, e && e.ssr, e && e.jitter);
15910
+ const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r = Op(t, n, i, e && e.ssr, e && e.jitter);
15932
15911
  return this.setIncludeUniformValues(r, e), r;
15933
15912
  }
15934
15913
  zo(t) {
@@ -15940,9 +15919,9 @@
15940
15919
  this.zo(t), this.shader.shaderDefines = t;
15941
15920
  }
15942
15921
  }
15943
- var Dp = "#include <gl2_vert>\n#define EXTRUDE_SCALE 63.0\n#define EXTRUDE_MOD 64.0\n#define MAX_LINE_DISTANCE 65535.0\nuniform mat4 projViewModelMatrix;\nuniform vec2 centiMeterToLocal;\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec4 aTubeNormal;\n#ifdef HAS_LINE_WIDTH\nattribute float aLineWidth;\n#else\nuniform float lineWidth;\n#endif\n#include <vt_position_vert>\n#ifdef PICKING_MODE\n#include <fbo_picking_vert>\n#else\nuniform mat4 modelViewMatrix;\nuniform mat3 modelNormalMatrix;\nuniform mat4 modelMatrix;\n#if defined(HAS_PATTERN)\nuniform float resolution;\nuniform float tileResolution;\nuniform float tileRatio;\nattribute float aLinesofar;\nvarying highp float vLinesofar;\nattribute vec4 aTexInfo;\nvarying vec4 vTexInfo;\nvarying float vNormalY;\nvarying float vPatternHeight;\nattribute float aNormalDistance;\n#if defined(HAS_PATTERN_ANIM)\nattribute float aLinePatternAnimSpeed;\nvarying float vLinePatternAnimSpeed;\n#endif\n#if defined(HAS_PATTERN_GAP)\nattribute float aLinePatternGap;\nvarying float vLinePatternGap;\n#endif\n#endif\n#ifdef HAS_COLOR\nattribute vec4 aColor;\nvarying vec4 vColor;\n#endif\n#ifdef HAS_OPACITY\nattribute float aOpacity;\n#endif\nvarying float vOpacity;\nvarying vec3 vModelNormal;\nvarying vec4 vViewVertex;\nvarying vec3 vModelVertex;\n#endif\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\n#include <vsm_shadow_vert>\n#endif\n#include <highlight_vert>\nvoid main() {\n \n#ifdef HAS_LINE_WIDTH\nfloat c = aLineWidth;\n#else\nfloat c = lineWidth;\n#endif\nfloat d = c / 2.;\n vec3 e = aTubeNormal.xyz / EXTRUDE_SCALE;\n vec3 f = unpackVTPosition();\n vec4 h = vec4(f, 1.);\n h.xy += e.xy * d * centiMeterToLocal;\n h.z += e.z * d;\n gl_Position = projViewModelMatrix * h;\n#ifdef PICKING_MODE\nfbo_picking_setData(gl_Position.w, true);\n#else\nvViewVertex = modelViewMatrix * h;\n vec3 i = normalize(e);\n vModelNormal = modelNormalMatrix * i;\n vModelVertex = (modelMatrix * h).xyz;\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\nshadow_computeShadowPars(h);\n#endif\n#ifdef HAS_COLOR\nvColor = aColor / 255.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_PATTERN\nfloat j = tileResolution / resolution;\n float k = aLinesofar - d * centiMeterToLocal.y * aNormalDistance / EXTRUDE_SCALE;\n vLinesofar = k / tileRatio * j;\n vTexInfo = vec4(aTexInfo.xy, aTexInfo.zw + 1.);\n vPatternHeight = c * centiMeterToLocal.x / tileRatio * j;\n vNormalY = aTubeNormal.w / EXTRUDE_SCALE;\n#if defined(HAS_PATTERN_ANIM)\nvLinePatternAnimSpeed = aLinePatternAnimSpeed / 127.;\n#endif\n#if defined(HAS_PATTERN_GAP)\nvLinePatternGap = aLinePatternGap / 10.0;\n#endif\n#endif\nhighlight_setVarying();\n#endif\n}";
15944
- const {getPBRUniforms: zp} = n.reshader.pbr.PBRUtils;
15945
- class Lp extends Sc {
15922
+ var Ep = "#include <gl2_vert>\n#define EXTRUDE_SCALE 63.0\n#define EXTRUDE_MOD 64.0\n#define MAX_LINE_DISTANCE 65535.0\nuniform mat4 projViewModelMatrix;\nuniform vec2 centiMeterToLocal;\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec4 aTubeNormal;\n#ifdef HAS_LINE_WIDTH\nattribute float aLineWidth;\n#else\nuniform float lineWidth;\n#endif\n#include <vt_position_vert>\n#ifdef PICKING_MODE\n#include <fbo_picking_vert>\n#else\nuniform mat4 modelViewMatrix;\nuniform mat3 modelNormalMatrix;\nuniform mat4 modelMatrix;\n#if defined(HAS_PATTERN)\nuniform float resolution;\nuniform float tileResolution;\nuniform float tileRatio;\nattribute float aLinesofar;\nvarying highp float vLinesofar;\nattribute vec4 aTexInfo;\nvarying vec4 vTexInfo;\nvarying float vNormalY;\nvarying float vPatternHeight;\nattribute float aNormalDistance;\n#if defined(HAS_PATTERN_ANIM)\nattribute float aLinePatternAnimSpeed;\nvarying float vLinePatternAnimSpeed;\n#endif\n#if defined(HAS_PATTERN_GAP)\nattribute float aLinePatternGap;\nvarying float vLinePatternGap;\n#endif\n#endif\n#ifdef HAS_COLOR\nattribute vec4 aColor;\nvarying vec4 vColor;\n#endif\n#ifdef HAS_OPACITY\nattribute float aOpacity;\n#endif\nvarying float vOpacity;\nvarying vec3 vModelNormal;\nvarying vec4 vViewVertex;\nvarying vec3 vModelVertex;\n#endif\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\n#include <vsm_shadow_vert>\n#endif\n#include <highlight_vert>\nvoid main() {\n \n#ifdef HAS_LINE_WIDTH\nfloat c = aLineWidth;\n#else\nfloat c = lineWidth;\n#endif\nfloat d = c / 2.;\n vec3 e = aTubeNormal.xyz / EXTRUDE_SCALE;\n vec3 f = unpackVTPosition();\n vec4 h = vec4(f, 1.);\n h.xy += e.xy * d * centiMeterToLocal;\n h.z += e.z * d;\n gl_Position = projViewModelMatrix * h;\n#ifdef PICKING_MODE\nfbo_picking_setData(gl_Position.w, true);\n#else\nvViewVertex = modelViewMatrix * h;\n vec3 i = normalize(e);\n vModelNormal = modelNormalMatrix * i;\n vModelVertex = (modelMatrix * h).xyz;\n#if defined(HAS_SHADOWING) && !defined(HAS_BLOOM)\nshadow_computeShadowPars(h);\n#endif\n#ifdef HAS_COLOR\nvColor = aColor / 255.;\n#endif\n#ifdef HAS_OPACITY\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_PATTERN\nfloat j = tileResolution / resolution;\n float k = aLinesofar - d * centiMeterToLocal.y * aNormalDistance / EXTRUDE_SCALE;\n vLinesofar = k / tileRatio * j;\n vTexInfo = vec4(aTexInfo.xy, aTexInfo.zw + 1.);\n vPatternHeight = c * centiMeterToLocal.x / tileRatio * j;\n vNormalY = aTubeNormal.w / EXTRUDE_SCALE;\n#if defined(HAS_PATTERN_ANIM)\nvLinePatternAnimSpeed = aLinePatternAnimSpeed / 127.;\n#endif\n#if defined(HAS_PATTERN_GAP)\nvLinePatternGap = aLinePatternGap / 10.0;\n#endif\n#endif\nhighlight_setVarying();\n#endif\n}";
15923
+ const {getPBRUniforms: Dp} = n.reshader.pbr.PBRUtils;
15924
+ class zp extends Sc {
15946
15925
  needToRedraw() {
15947
15926
  return super.needToRedraw() || this.isAnimating();
15948
15927
  }
@@ -16016,7 +15995,7 @@
16016
15995
  if (this.renderer = new n.reshader.Renderer(e), this.createShader(t), this.pickingFBO) {
16017
15996
  const t = [];
16018
15997
  this.picking = [ new n.reshader.FBORayPicking(this.renderer, {
16019
- vert: "#define PICKING_MODE 1\n" + Dp,
15998
+ vert: "#define PICKING_MODE 1\n" + Ep,
16020
15999
  uniforms: [ {
16021
16000
  name: "projViewModelMatrix",
16022
16001
  type: "function",
@@ -16044,7 +16023,7 @@
16044
16023
  return n.mat4.multiply(i, e.projViewMatrix, e.modelMatrix), i;
16045
16024
  }
16046
16025
  }), this.shader = new n.reshader.pbr.StandardShader({
16047
- vert: Dp,
16026
+ vert: Ep,
16048
16027
  uniforms: e,
16049
16028
  defines: this.zo(i),
16050
16029
  extraCommandProps: this.getExtraCommandProps()
@@ -16093,7 +16072,7 @@
16093
16072
  };
16094
16073
  }
16095
16074
  getUniformValues(t, e) {
16096
- const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r = zp(t, n, i, null, e && e.jitter), s = t.projViewMatrix, o = t.viewMatrix;
16075
+ const {iblTexes: n, dfgLUT: i} = this.getIBLRes(), r = Dp(t, n, i, null, e && e.jitter), s = t.projViewMatrix, o = t.viewMatrix;
16097
16076
  return r.projViewMatrix = s, r.viewMatrix = o, r.resolution = t.getResolution(),
16098
16077
  r.currentTime = this.layer.getRenderer().getFrameTimestamp() || 0, this.setIncludeUniformValues(r, e),
16099
16078
  r;
@@ -16174,7 +16153,7 @@
16174
16153
  delete this.shader);
16175
16154
  }
16176
16155
  }
16177
- const Rp = [], Np = [], Hp = [], jp = [], Vp = [], Up = [ 0, 0, 0 ], Gp = [ 0, 0, 0 ], Wp = [ 1, 1, 1 ], Bp = [], $p = [ 1, 1, 1, 1 ], Yp = [], Xp = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], qp = t => class extends t {
16156
+ const Lp = [], Rp = [], Np = [], Hp = [], jp = [], Vp = [ 0, 0, 0 ], Up = [ 0, 0, 0 ], Gp = [ 1, 1, 1 ], Wp = [], Bp = [ 1, 1, 1, 1 ], $p = [], Yp = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], Xp = t => class extends t {
16178
16157
  constructor(t, e, i, r, s, o) {
16179
16158
  super(t, e, i, r, s, o), this.Lo = !1, this.scene.sortFunction = this.sortByCommandKey;
16180
16159
  const a = r.fetchOptions || {};
@@ -16209,7 +16188,7 @@
16209
16188
  };
16210
16189
  }
16211
16190
  getFnTypeConfig() {
16212
- return Bp;
16191
+ return Wp;
16213
16192
  }
16214
16193
  createMesh(t, e, {tileTranslationMatrix: i, tileExtent: r}, {timestamp: s}) {
16215
16194
  if (!this.Lo) return null;
@@ -16242,8 +16221,8 @@
16242
16221
  let c = 0;
16243
16222
  r.forEach((t => {
16244
16223
  const {geometry: i, nodeMatrix: r} = t;
16245
- n.mat4.multiply(Yp, Xp, r), n.mat4.multiply(Yp, u, Yp);
16246
- const s = n.mat4.multiply(Yp, w, Yp), o = i.boundingBox.copy();
16224
+ n.mat4.multiply($p, Yp, r), n.mat4.multiply($p, u, $p);
16225
+ const s = n.mat4.multiply($p, w, $p), o = i.boundingBox.copy();
16247
16226
  o.transform(s);
16248
16227
  const a = this.Yo(o, e);
16249
16228
  Math.abs(a) > Math.abs(c) && (c = a);
@@ -16262,15 +16241,15 @@
16262
16241
  k.properties.startTime = s, _.HAS_SKIN = 1;
16263
16242
  }
16264
16243
  b && (k.setUniform("morphWeights", b), _.HAS_MORPH = 1), k.setUniform("hasAlpha", A.alphaMode && "BLEND" === A.alphaMode.toUpperCase()),
16265
- Dh(k.uniforms, "polygonFill", e, "markerFill", $p, Rh(this.colorCache)), Dh(k.uniforms, "polygonOpacity", e, "markerOpacity", 1);
16244
+ Dh(k.uniforms, "polygonFill", e, "markerFill", Bp, Rh(this.colorCache)), Dh(k.uniforms, "polygonOpacity", e, "markerOpacity", 1);
16266
16245
  const P = [];
16267
16246
  k.setPositionMatrix((() => {
16268
16247
  const e = this.qo(t, d, M);
16269
- n.mat4.multiply(P, Xp, e), n.mat4.multiply(P, u, P), n.mat4.multiply(P, w, P);
16270
- const i = n.mat4.identity(Yp);
16248
+ n.mat4.multiply(P, Yp, e), n.mat4.multiply(P, u, P), n.mat4.multiply(P, w, P);
16249
+ const i = n.mat4.identity($p);
16271
16250
  if (0 !== c && (n.mat4.fromTranslation(i, f), n.mat4.multiply(P, i, P)), jh(h)) {
16272
16251
  const t = o.getGLScale() / o.getGLScale(h);
16273
- return n.vec3.set(Rp, t, t, t), n.mat4.fromScaling(i, Rp), n.mat4.multiply(i, i, P);
16252
+ return n.vec3.set(Lp, t, t, t), n.mat4.fromScaling(i, Lp), n.mat4.multiply(i, i, P);
16274
16253
  }
16275
16254
  return P;
16276
16255
  }));
@@ -16342,7 +16321,7 @@
16342
16321
  n && this.setToRedraw(!0), super.prepareRender(t);
16343
16322
  }
16344
16323
  getShadowMeshes() {
16345
- if (!this.isVisible()) return Bp;
16324
+ if (!this.isVisible()) return Wp;
16346
16325
  this.shadowCount = this.scene.getMeshes().length;
16347
16326
  return this.scene.getMeshes().filter((t => 0 === t.properties.level));
16348
16327
  }
@@ -16369,13 +16348,13 @@
16369
16348
  const i = S[0], r = S[1], d = n.vec3.set(M, i * p - _, -r * p - k, (S[2] + m) * y - P), g = a && a[e] || 0, v = l && l[e] || 0;
16370
16349
  if (g || v) {
16371
16350
  n.mat4.fromRotation(T, v, F);
16372
- const t = n.vec3.set(Rp, i, r, 0), e = n.vec3.normalize(t, n.vec3.cross(t, t, F));
16351
+ const t = n.vec3.set(Lp, i, r, 0), e = n.vec3.normalize(t, n.vec3.cross(t, t, F));
16373
16352
  n.mat4.rotate(T, T, g, e);
16374
- const s = n.mat4.fromTranslation(Yp, d);
16353
+ const s = n.mat4.fromTranslation($p, d);
16375
16354
  n.mat4.multiply(T, s, T);
16376
16355
  } else n.mat4.fromTranslation(T, d);
16377
16356
  if (I) {
16378
- const t = this.$o(Yp, c, u, e);
16357
+ const t = this.$o($p, c, u, e);
16379
16358
  n.mat4.multiply(T, T, t);
16380
16359
  }
16381
16360
  f("instance_vectorA", e, T, 0), f("instance_vectorB", e, T, 1), f("instance_vectorC", e, T, 2),
@@ -16395,11 +16374,11 @@
16395
16374
  let l = o.translationX || 0, h = o.translationY || 0, u = o.translationZ || 0, c = o.rotationX || 0, f = o.rotationY || 0, d = o.rotationZ || 0, p = o.scaleX || 1, y = o.scaleY || 1, m = o.scaleZ || 1;
16396
16375
  const g = i && i[r], v = e && e[g], x = s.getZoom(), b = v && v.feature && v.feature.properties, w = this.ta(x, b);
16397
16376
  this.ea && (l = this.ea(x, b)), this.na && (h = this.na(x, b)), this.ia && (u = this.ia(x, b));
16398
- const A = n.vec3.set(Np, l * a, h * a, u * a);
16377
+ const A = n.vec3.set(Rp, l * a, h * a, u * a);
16399
16378
  this.ra && (c = this.ra(x, b)), this.sa && (f = this.sa(x, b)), this.oa && (d = this.oa(x, b));
16400
- const M = n.vec3.set(Hp, c, f, d);
16379
+ const M = n.vec3.set(Np, c, f, d);
16401
16380
  this.aa && (p = this.aa(x, b)), this.la && (y = this.la(x, b)), this.ha && (m = this.ha(x, b));
16402
- const S = n.vec3.set(jp, p * w, y * w, m * w);
16381
+ const S = n.vec3.set(Hp, p * w, y * w, m * w);
16403
16382
  return this.ua(t, A, M, S);
16404
16383
  }
16405
16384
  ta(t, e) {
@@ -16482,27 +16461,27 @@
16482
16461
  delete this.Jo;
16483
16462
  }
16484
16463
  ua(t, e, i, r) {
16485
- const s = n.vec3.set(Rp, ...e || Up), o = i || Gp, a = r || Wp, l = n.quat.fromEuler(Vp, o[0], o[1], o[2]);
16464
+ const s = n.vec3.set(Lp, ...e || Vp), o = i || Up, a = r || Gp, l = n.quat.fromEuler(jp, o[0], o[1], o[2]);
16486
16465
  return n.mat4.fromRotationTranslationScale(t, l, s, a);
16487
16466
  }
16488
16467
  };
16489
- class Jp extends(qp(Ip)){
16468
+ class qp extends(Xp(Tp)){
16490
16469
  getMaterialClazz(t) {
16491
16470
  return t.diffuseFactor ? n.reshader.PhongSpecularGlossinessMaterial : n.reshader.PhongMaterial;
16492
16471
  }
16493
16472
  }
16494
- class Kp extends(qp(Ep)){
16473
+ class Jp extends(Xp(Cp)){
16495
16474
  getMaterialClazz(t) {
16496
16475
  return t.specularGlossinessTexture || t.diffuseTexture ? n.reshader.pbr.StandardSpecularGlossinessMaterial : n.reshader.pbr.StandardMaterial;
16497
16476
  }
16498
16477
  }
16499
- const {getPBRUniforms: Zp} = n.reshader.pbr.PBRUtils, Qp = {
16478
+ const {getPBRUniforms: Kp} = n.reshader.pbr.PBRUtils, Zp = {
16500
16479
  color: [ 2.0303, 2.028, 2.028 ],
16501
16480
  direction: [ 0, -.2717, -1 ]
16502
- }, ty = .3737, ey = {
16481
+ }, Qp = .3737, ty = {
16503
16482
  index: 0
16504
- }, ny = [ 0, 0, 0 ], iy = [ 2, 2 ];
16505
- class ry extends Sc {
16483
+ }, ey = [ 0, 0, 0 ], ny = [ 2, 2 ];
16484
+ class iy extends Sc {
16506
16485
  supportRenderMode(t) {
16507
16486
  return "fxaa" === t || "fxaaBeforeTaa" === t;
16508
16487
  }
@@ -16517,7 +16496,7 @@
16517
16496
  }
16518
16497
  needToRedraw() {
16519
16498
  if (super.needToRedraw()) return !0;
16520
- return this.getSymbol(ey).animation;
16499
+ return this.getSymbol(ty).animation;
16521
16500
  }
16522
16501
  createMesh(t, e) {
16523
16502
  const {geometry: i} = t;
@@ -16526,7 +16505,7 @@
16526
16505
  castShadow: !1,
16527
16506
  picking: !0
16528
16507
  });
16529
- return r.properties.symbolIndex = ey, r.setLocalTransform(e), r;
16508
+ return r.properties.symbolIndex = ty, r.setLocalTransform(e), r;
16530
16509
  }
16531
16510
  callShader(t, e) {
16532
16511
  super.callShader(t, e), this.transformWater();
@@ -16537,13 +16516,13 @@
16537
16516
  this.Pr(t, e), super.addMesh(...arguments);
16538
16517
  }
16539
16518
  Pr(t) {
16540
- const e = this.getSymbol(ey).ssr;
16519
+ const e = this.getSymbol(ty).ssr;
16541
16520
  for (let n = 0; n < t.length; n++) t[n].ssr = e ? 1 : 0;
16542
16521
  }
16543
16522
  paint(t) {
16544
16523
  t.states && t.states.includesChanged && (this.shader.dispose(), this.ya.dispose(),
16545
16524
  this.Sr(t));
16546
- const e = !!t.ssr && this.getSymbol(ey).ssr, n = this.ya, i = n.shaderDefines;
16525
+ const e = !!t.ssr && this.getSymbol(ty).ssr, n = this.ya, i = n.shaderDefines;
16547
16526
  if (e) {
16548
16527
  const e = Ih({}, i, t.ssr.defines);
16549
16528
  n.shaderDefines = e;
@@ -16638,7 +16617,7 @@
16638
16617
  return n.mat3.fromRotation(i, Math.PI * r / 180);
16639
16618
  }
16640
16619
  } ], s = {
16641
- TIME_NOISE_TEXTURE_REPEAT: ty
16620
+ TIME_NOISE_TEXTURE_REPEAT: Qp
16642
16621
  };
16643
16622
  this.fillIncludes(s, r, t);
16644
16623
  const o = {
@@ -16720,24 +16699,24 @@
16720
16699
  };
16721
16700
  }
16722
16701
  pa(t, e) {
16723
- const {iblTexes: i, dfgLUT: r} = this.getIBLRes(), s = Zp(t, i, r, e && e.ssr, e && e.jitter), o = t.getLightManager();
16702
+ const {iblTexes: i, dfgLUT: r} = this.getIBLRes(), s = Kp(t, i, r, e && e.ssr, e && e.jitter), o = t.getLightManager();
16724
16703
  let a = o && o.getDirectionalLight() || {};
16725
- const l = o && o.getAmbientLight() || {}, h = this.getSymbol(ey), u = this.Ma = this.Ma || [], c = this.Sa = this.Sa || [];
16704
+ const l = o && o.getAmbientLight() || {}, h = this.getSymbol(ty), u = this.Ma = this.Ma || [], c = this.Sa = this.Sa || [];
16726
16705
  n.vec4.set(c, .09, h.uvScale || 3, .03, -.5);
16727
16706
  Ih(s, {
16728
16707
  ambientColor: l.color || [ .2, .2, .2 ],
16729
16708
  viewMatrix: t.viewMatrix,
16730
- lightDirection: a.direction || Qp.direction,
16731
- lightColor: a.color || Qp.color,
16709
+ lightDirection: a.direction || Zp.direction,
16710
+ lightColor: a.color || Zp.color,
16732
16711
  camPos: t.cameraPosition,
16733
16712
  timeElapsed: h.animation ? (this.layer.getRenderer().getFrameTimestamp() || 0) / (1 / (h.waterSpeed || 1) * 1e4) : 0,
16734
16713
  normalTexture: this.ba || this.xa,
16735
16714
  heightTexture: this.Aa || this.xa,
16736
16715
  waveParams: c,
16737
- waterDir: sy(u, h.waterDirection || 0),
16716
+ waterDir: ry(u, h.waterDirection || 0),
16738
16717
  waterBaseColor: h.waterBaseColor || [ .1451, .2588, .4863, 1 ],
16739
16718
  contrast: h.contrast || 1,
16740
- hsv: h.hsv || ny
16719
+ hsv: h.hsv || ey
16741
16720
  });
16742
16721
  const f = this.layer.getRenderer();
16743
16722
  return s.layerOpacity = f.Yn(), this.setIncludeUniformValues(s, e), e && e.ssr && e.ssr.renderUniforms && Ih(s, e.ssr.renderUniforms),
@@ -16759,42 +16738,42 @@
16759
16738
  transformWater() {
16760
16739
  const t = this.getMap(), e = n.GroundPainter.getGroundTransform(this.ga.localTransform, t);
16761
16740
  this.ga.setLocalTransform(e);
16762
- const i = t._get2DExtentAtRes(t.getGLRes()), r = i.getWidth(), s = i.getHeight(), o = t.cameraLookAt, a = o[0] - r, l = o[1] + s, h = a / iy[0], u = l / iy[1], c = h % 1, f = u % 1, d = h * ty % 1, p = u * ty % 1, y = r / iy[0] * 2, m = s / iy[1] * 2;
16741
+ const i = t._get2DExtentAtRes(t.getGLRes()), r = i.getWidth(), s = i.getHeight(), o = t.cameraLookAt, a = o[0] - r, l = o[1] + s, h = a / ny[0], u = l / ny[1], c = h % 1, f = u % 1, d = h * Qp % 1, p = u * Qp % 1, y = r / ny[0] * 2, m = s / ny[1] * 2;
16763
16742
  this.ga.setUniform("uvOffset", [ c, f ]), this.ga.setUniform("noiseUvOffset", [ d, p ]),
16764
16743
  this.ga.setUniform("uvScale", [ y, -m ]);
16765
16744
  }
16766
16745
  }
16767
- function sy(t, e) {
16746
+ function ry(t, e) {
16768
16747
  return e = function(t) {
16769
16748
  return Math.PI * t / 180;
16770
16749
  }(e), t[0] = Math.sin(e), t[1] = Math.cos(e), t;
16771
16750
  }
16772
- const oy = Nu("fill", Rc);
16751
+ const sy = Nu("fill", Rc);
16752
+ sy.registerAt(hu);
16753
+ const oy = Nu("line", Vc);
16773
16754
  oy.registerAt(hu);
16774
- const ay = Nu("line", Vc);
16755
+ const ay = Nu("line-gradient", Uc);
16775
16756
  ay.registerAt(hu);
16776
- const ly = Nu("line-gradient", Uc);
16757
+ const ly = Nu("icon", Ad);
16777
16758
  ly.registerAt(hu);
16778
- const hy = Nu("icon", Md);
16759
+ const hy = Nu("text", ap);
16779
16760
  hy.registerAt(hu);
16780
- const uy = Nu("text", lp);
16761
+ const uy = Nu("native-line", yp);
16781
16762
  uy.registerAt(hu);
16782
- const cy = Nu("native-line", mp);
16763
+ Nu("native-point", fp).registerAt(hu);
16764
+ const cy = Nu("phong", Tp);
16783
16765
  cy.registerAt(hu);
16784
- Nu("native-point", dp).registerAt(hu);
16785
- const fy = Nu("phong", Ip);
16766
+ const fy = Nu("wireframe", Fp);
16786
16767
  fy.registerAt(hu);
16787
- const dy = Nu("wireframe", Op);
16768
+ const dy = Nu("lit", Cp);
16788
16769
  dy.registerAt(hu);
16789
- const py = Nu("lit", Ep);
16770
+ const py = Nu("tube", zp);
16790
16771
  py.registerAt(hu);
16791
- const yy = Nu("tube", Lp);
16772
+ const yy = Nu("gltf-phong", qp);
16792
16773
  yy.registerAt(hu);
16793
- const my = Nu("gltf-phong", Jp);
16774
+ const my = Nu("gltf-lit", Jp);
16794
16775
  my.registerAt(hu);
16795
- const gy = Nu("gltf-lit", Kp);
16796
- gy.registerAt(hu);
16797
- const vy = Nu("heatmap", class extends Sc {
16776
+ const gy = Nu("heatmap", class extends Sc {
16798
16777
  createFnTypeConfig(t, e) {
16799
16778
  const n = F(e.heatmapWeight), i = new Int16Array(1);
16800
16779
  return [ {
@@ -16857,25 +16836,25 @@
16857
16836
  this._a = new n.HeatmapProcess(this.regl, this.sceneConfig, this.layer, i.heatmapColor, null, e);
16858
16837
  }
16859
16838
  });
16860
- vy.registerAt(hu);
16861
- const xy = Nu("water", ry);
16862
- xy.registerAt(hu), gu.registerPainter("lit", Ep), gu.registerPainter("icon", Md),
16839
+ gy.registerAt(hu);
16840
+ const vy = Nu("water", iy);
16841
+ vy.registerAt(hu), gu.registerPainter("lit", Cp), gu.registerPainter("icon", Ad),
16863
16842
  gu.registerPainter("fill", Rc), gu.registerPainter("line", Vc), gu.registerPainter("line-gradient", Uc),
16864
- gu.registerPainter("water", ry), gu.registerPainter("tube", Lp);
16865
- class by extends hu {
16843
+ gu.registerPainter("water", iy), gu.registerPainter("tube", zp);
16844
+ class xy extends hu {
16866
16845
  getTileUrl(t, e, n) {
16867
16846
  const i = this.getMap().getResolution(n);
16868
16847
  return super.getTileUrl(t, e, function(t) {
16869
- return 19 - Math.log(t / wy) / Math.LN2;
16848
+ return 19 - Math.log(t / by) / Math.LN2;
16870
16849
  }(i));
16871
16850
  }
16872
16851
  static fromJSON(t) {
16873
- return t && "MapboxVectorTileLayer" === t.type ? new by(t.id, t.options) : null;
16852
+ return t && "MapboxVectorTileLayer" === t.type ? new xy(t.id, t.options) : null;
16874
16853
  }
16875
16854
  }
16876
- by.registerJSONType("MapboxVectorTileLayer");
16877
- const wy = 12756274 * Math.PI / (256 * Math.pow(2, 20));
16878
- class Ay extends hu {
16855
+ xy.registerJSONType("MapboxVectorTileLayer");
16856
+ const by = 12756274 * Math.PI / (256 * Math.pow(2, 20));
16857
+ class wy extends hu {
16879
16858
  constructor(t, e) {
16880
16859
  (e = e || {
16881
16860
  urlTemplate: null
@@ -16920,7 +16899,7 @@
16920
16899
  getWorkerOptions() {
16921
16900
  const t = super.getWorkerOptions();
16922
16901
  let e = this.options.data;
16923
- return Jl(e) || e && e.url ? (e.url && (e = JSON.parse(JSON.stringify(e))), e = Sy(e, this.getURLModifier())) : e = this.features,
16902
+ return Jl(e) || e && e.url ? (e.url && (e = JSON.parse(JSON.stringify(e))), e = My(e, this.getURLModifier())) : e = this.features,
16924
16903
  t.data = e, t.tileBuffer = this.options.tileBuffer, t.extent = this.options.extent,
16925
16904
  t.hasAltitude = this.options.enableAltitude, t.simplifyTolerance = this.options.simplifyTolerance,
16926
16905
  t.projection = this.getSpatialReference().getProjection().code, t.generateOMBB = this.options.generateOMBB,
@@ -16944,7 +16923,7 @@
16944
16923
  const e = t.getWorkerConnection();
16945
16924
  if (e) {
16946
16925
  let n = this.options.data;
16947
- Jl(n) || n && n.url ? (n.url && (n = JSON.parse(JSON.stringify(n))), n = Sy(n, this.getURLModifier())) : n = this.features,
16926
+ Jl(n) || n && n.url ? (n.url && (n = JSON.parse(JSON.stringify(n))), n = My(n, this.getURLModifier())) : n = this.features,
16948
16927
  e.setData(n, ((e, n) => {
16949
16928
  t.clear(), this.onWorkerReady(null, n), t.setToRedraw(), setTimeout((() => {
16950
16929
  t.setToRedraw();
@@ -16979,7 +16958,7 @@
16979
16958
  return this.Oa[t];
16980
16959
  }
16981
16960
  static fromJSON(t) {
16982
- return t && "GeoJSONVectorTileLayer" === t.type ? new Ay(t.id, t.options) : null;
16961
+ return t && "GeoJSONVectorTileLayer" === t.type ? new wy(t.id, t.options) : null;
16983
16962
  }
16984
16963
  Ta() {
16985
16964
  if (!this.features) return;
@@ -17006,14 +16985,14 @@
17006
16985
  }));
17007
16986
  }
17008
16987
  }
17009
- function My(t) {
16988
+ function Ay(t) {
17010
16989
  let e = document.createElement("a");
17011
16990
  return e.href = t, t = e.href, e = null, t;
17012
16991
  }
17013
- function Sy(t, e) {
17014
- return t.url ? t.url = e ? e(t.url) : My(t.url) : t = e ? e(t) : My(t), t;
16992
+ function My(t, e) {
16993
+ return t.url ? t.url = e ? e(t.url) : Ay(t.url) : t = e ? e(t) : Ay(t), t;
17015
16994
  }
17016
- Ay.registerJSONType("GeoJSONVectorTileLayer"), Ay.mergeOptions({
16995
+ wy.registerJSONType("GeoJSONVectorTileLayer"), wy.mergeOptions({
17017
16996
  features: "id",
17018
16997
  tileBuffer: 64,
17019
16998
  extent: 8192,
@@ -17022,7 +17001,7 @@
17022
17001
  tileStackDepth: 0,
17023
17002
  generateOMBB: !0
17024
17003
  });
17025
- const _y = {
17004
+ const Sy = {
17026
17005
  markerFile: {
17027
17006
  type: "identity",
17028
17007
  default: null,
@@ -17168,7 +17147,7 @@
17168
17147
  default: "point",
17169
17148
  property: "_symbol_markerPlacement"
17170
17149
  }
17171
- }, ky = {
17150
+ }, _y = {
17172
17151
  textName: {
17173
17152
  type: "identity",
17174
17153
  default: null,
@@ -17269,7 +17248,7 @@
17269
17248
  default: "point",
17270
17249
  property: "_symbol_textPlacement"
17271
17250
  }
17272
- }, Py = {
17251
+ }, ky = {
17273
17252
  lineWidth: {
17274
17253
  type: "identity",
17275
17254
  default: 2,
@@ -17340,21 +17319,21 @@
17340
17319
  default: null,
17341
17320
  property: "_symbol_lineDashColor"
17342
17321
  }
17343
- }, Ty = "_line_gradient_property", Iy = new r.Point(0, 0), Fy = "_vector3dlayer_id", Oy = (Ty + "").trim();
17344
- function Cy(t, e, n) {
17322
+ }, Py = "_line_gradient_property", Ty = new r.Point(0, 0), Iy = "_vector3dlayer_id", Fy = (Py + "").trim();
17323
+ function Oy(t, e, n) {
17345
17324
  const i = (vh + "").trim(), s = t.getMap(), o = s.getGLRes();
17346
17325
  let a = t.getCoordinates();
17347
17326
  const l = [], h = [];
17348
17327
  let u = 1;
17349
17328
  if (t instanceof r.Marker || t instanceof r.MultiPoint) {
17350
17329
  t instanceof r.Marker && (a = [ a ]);
17351
- for (let t = 0; t < a.length; t++) s.coordToPointAtRes(a[t], o, Iy), l.push([ Iy.x, Iy.y, a[t].z || 0 ]),
17330
+ for (let t = 0; t < a.length; t++) s.coordToPointAtRes(a[t], o, Ty), l.push([ Ty.x, Ty.y, a[t].z || 0 ]),
17352
17331
  h.push([ a[t].x, a[t].y ]);
17353
17332
  } else if (t instanceof r.LineString || t instanceof r.MultiLineString) {
17354
17333
  u = 2, t instanceof r.LineString && (a = [ a ]);
17355
17334
  for (let t = 0; t < a.length; t++) {
17356
17335
  l[t] = [], h[t] = [];
17357
- for (let e = 0; e < a[t].length; e++) s.coordToPointAtRes(a[t][e], o, Iy), l[t].push([ Iy.x, Iy.y, a[t][e].z || 0 ]),
17336
+ for (let e = 0; e < a[t].length; e++) s.coordToPointAtRes(a[t][e], o, Ty), l[t].push([ Ty.x, Ty.y, a[t][e].z || 0 ]),
17358
17337
  h[t].push([ a[t][e].x, a[t][e].y ]);
17359
17338
  }
17360
17339
  } else if (t instanceof r.Polygon || t instanceof r.MultiPolygon) {
@@ -17363,9 +17342,9 @@
17363
17342
  for (let t = 0; t < a.length; t++) {
17364
17343
  let n = !1;
17365
17344
  for (let i = 0; i < a[t].length; i++) {
17366
- if (l[e] = [], h[e] = [], n) for (let n = a[t][i].length - 1; n >= 0; n--) s.coordToPointAtRes(a[t][i][n], o, Iy),
17367
- l[e].push([ Iy.x, Iy.y, a[t][i][n].z || 0 ]), h[e].push([ a[t][i][n].x, a[t][i][n].y ]); else for (let n = 0; n < a[t][i].length; n++) s.coordToPointAtRes(a[t][i][n], o, Iy),
17368
- l[e].push([ Iy.x, Iy.y, a[t][i][n].z || 0 ]), h[e].push([ a[t][i][n].x, a[t][i][n].y ]);
17345
+ if (l[e] = [], h[e] = [], n) for (let n = a[t][i].length - 1; n >= 0; n--) s.coordToPointAtRes(a[t][i][n], o, Ty),
17346
+ l[e].push([ Ty.x, Ty.y, a[t][i][n].z || 0 ]), h[e].push([ a[t][i][n].x, a[t][i][n].y ]); else for (let n = 0; n < a[t][i].length; n++) s.coordToPointAtRes(a[t][i][n], o, Ty),
17347
+ l[e].push([ Ty.x, Ty.y, a[t][i][n].z || 0 ]), h[e].push([ a[t][i][n].x, a[t][i][n].y ]);
17369
17348
  0 === i && (n = ul.calculateSignedArea(l[e]) < 0, n && (l[e] = l[e].reverse(), h[e] = h[e].reverse())),
17370
17349
  e++;
17371
17350
  }
@@ -17391,7 +17370,7 @@
17391
17370
  if (Array.isArray(f) && f.length) {
17392
17371
  const r = [], s = f.length;
17393
17372
  for (let o = 0; o < s; o++) {
17394
- const a = o === s - 1 ? c : ql({}, c), p = Ey(f[o], a);
17373
+ const a = o === s - 1 ? c : ql({}, c), p = Cy(f[o], a);
17395
17374
  for (const t in f[o]) if (ih(f[o], t)) {
17396
17375
  a[("_symbol_" + t).trim()] = f[o][t];
17397
17376
  }
@@ -17410,7 +17389,7 @@
17410
17389
  return r;
17411
17390
  }
17412
17391
  if (f) {
17413
- const t = Ey(f, c);
17392
+ const t = Cy(f, c);
17414
17393
  for (const t in f) if (ih(f, t)) {
17415
17394
  c[("_symbol_" + t).trim()] = f[t];
17416
17395
  }
@@ -17427,16 +17406,16 @@
17427
17406
  };
17428
17407
  return y[i] = p, y;
17429
17408
  }
17430
- function Ey(t, e) {
17409
+ function Cy(t, e) {
17431
17410
  const n = t.lineGradientProperty;
17432
- return n && (e[Oy] = e[n], e.mapbox_clip_start = 0, e.mapbox_clip_end = 1, delete e[n]),
17411
+ return n && (e[Fy] = e[n], e.mapbox_clip_start = 0, e.mapbox_clip_end = 1, delete e[n]),
17433
17412
  n;
17434
17413
  }
17435
- let Dy = 1;
17436
- const zy = "_symbol_".trim(), Ly = (vh + "").trim();
17437
- let Ry = new Float32Array(1);
17438
- const Ny = [];
17439
- class Hy extends r.renderer.CanvasRenderer {
17414
+ let Ey = 1;
17415
+ const Dy = "_symbol_".trim(), zy = (vh + "").trim();
17416
+ let Ly = new Float32Array(1);
17417
+ const Ry = [];
17418
+ class Ny extends r.renderer.CanvasRenderer {
17440
17419
  constructor(...t) {
17441
17420
  super(...t), this.features = {}, this.Ea = {}, this.Se = 0, this.Da = {}, this.za = {},
17442
17421
  this.La = {}, this.Ra = {}, this.Na = {}, this.Ha = !0, this.ja = {
@@ -17458,7 +17437,7 @@
17458
17437
  return t || (this.painter && this.painter.needToRedraw() || this.Ua && this.Ua.needToRedraw() || this.Ga && this.Ga.needToRedraw());
17459
17438
  }
17460
17439
  getAnalysisMeshes() {
17461
- return this.painter && this.painter.getAnalysisMeshes() || Ny;
17440
+ return this.painter && this.painter.getAnalysisMeshes() || Ry;
17462
17441
  }
17463
17442
  getRayCastData() {
17464
17443
  return null;
@@ -17551,16 +17530,16 @@
17551
17530
  this.layer._sortGeometries();
17552
17531
  const r = this.layer.getGeometries();
17553
17532
  for (let s = 0; s < r.length; s++) {
17554
- const o = r[s][Fy];
17533
+ const o = r[s][Iy];
17555
17534
  if (!this.features[o]) continue;
17556
17535
  const a = this.features[o];
17557
17536
  if (Array.isArray(a)) for (let r = 0; r < a.length; r++) {
17558
- const s = a[r], o = s[Ly];
17537
+ const s = a[r], o = s[zy];
17559
17538
  (!t || t[o] || e && (!e || e[o])) && (s.visible || (this.Qa = !0), this.al(s.geometry, i, s.coordinates),
17560
17539
  n.push(s));
17561
17540
  } else {
17562
17541
  a.visible || (this.Qa = !0);
17563
- const r = a[Ly];
17542
+ const r = a[zy];
17564
17543
  if (t && !t[r] && (!e || e && !e[r])) continue;
17565
17544
  this.al(a.geometry, i, a.coordinates), n.push(a);
17566
17545
  }
@@ -17630,7 +17609,7 @@
17630
17609
  }), n.tileRatio = 1, n.z = 1, n.tileExtent = 1, n.elements = t.elements, n.aPickingId = t.data.aPickingId;
17631
17610
  }
17632
17611
  ul(t) {
17633
- return "win-intel-gpu-crash" === t && (this.layer.options.workarounds["win-intel-gpu-crash"] && Vy(this.gl));
17612
+ return "win-intel-gpu-crash" === t && (this.layer.options.workarounds["win-intel-gpu-crash"] && jy(this.gl));
17634
17613
  }
17635
17614
  prepareRequestors() {
17636
17615
  if (this.ae) return;
@@ -17675,7 +17654,7 @@
17675
17654
  delete this.Ka));
17676
17655
  const {features: r, center: s} = this.ol(this.La, this.Ra), o = [], a = [];
17677
17656
  for (let t = 0; t < r.length; t++) {
17678
- const e = r[t][Ly];
17657
+ const e = r[t][zy];
17679
17658
  this.La[e] && o.push(r[t]), this.Ra[e] && a.push(r[t]);
17680
17659
  }
17681
17660
  if (!o.length && !a.length) return void (this.Ka && (this.Ua.deleteMesh(this.Ka),
@@ -17696,7 +17675,7 @@
17696
17675
  n.mat4.translate(o, o, n.vec3.set(c, s[0], s[1], 0)), n.mat4.scale(o, o, n.vec3.set(u, 1, 1, this.rn));
17697
17676
  const a = this.Ua.createMeshes(e, o);
17698
17677
  for (let t = 0; t < a.length; t++) a[t].geometry.properties.originElements = a[t].geometry.properties.elements.slice(),
17699
- a[t].properties.level = 0, a[t].material.set("flipY", 1), a[t].properties.meshKey = Dy++;
17678
+ a[t].properties.level = 0, a[t].material.set("flipY", 1), a[t].properties.meshKey = Ey++;
17700
17679
  this.Ka = a, l && (this.Qa = !0), this.ml = !1, this.setToRedraw(), this.layer.fire("buildmarkermesh");
17701
17680
  }));
17702
17681
  }
@@ -17751,7 +17730,7 @@
17751
17730
  !1;
17752
17731
  }
17753
17732
  for (let t = 0; t < r.length; t++) {
17754
- const e = r[t][Ly];
17733
+ const e = r[t][zy];
17755
17734
  this.La[e] && o.push(r[t]), this.Ra[e] && a.push(r[t]);
17756
17735
  }
17757
17736
  const c = r[0].id, f = this.yl(o, a, this.qa, this.pl), d = this.Ka;
@@ -17773,14 +17752,14 @@
17773
17752
  })), !0;
17774
17753
  }
17775
17754
  Sl(t) {
17776
- return this._l(t, this.Za, this.Ja, this.kl, this.Ga, Ha, Py, this.Pl);
17755
+ return this._l(t, this.Za, this.Ja, this.kl, this.Ga, Ha, ky, this.Pl);
17777
17756
  }
17778
17757
  _l(t, e, n, i, r, s, o, a) {
17779
17758
  if (!e) return !1;
17780
17759
  if (!n) return this.Ml(), this.setToRedraw(), !1;
17781
17760
  const l = t._getInternalSymbol(), h = {
17782
17761
  zoom: this.getMap().getZoom()
17783
- }, u = t[Fy];
17762
+ }, u = t[Iy];
17784
17763
  let c = this.features[u];
17785
17764
  Array.isArray(c) || (c = [ c ]);
17786
17765
  const f = [];
@@ -17825,7 +17804,7 @@
17825
17804
  let n = r + 1;
17826
17805
  for (;i[n] === e; ) n++;
17827
17806
  const s = n - r, o = t.geometry.desc.positionSize;
17828
- Ry.length !== 3 * s && (Ry = new Float32Array(s * o), Ry.fill(-1 / 0, 0)), t.geometry.updateSubData(t.geometry.desc.positionAttribute, Ry, r * o);
17807
+ Ly.length !== 3 * s && (Ly = new Float32Array(s * o), Ly.fill(-1 / 0, 0)), t.geometry.updateSubData(t.geometry.desc.positionAttribute, Ly, r * o);
17829
17808
  }
17830
17809
  this.layer.fire("updatemesh"), this.setToRedraw();
17831
17810
  }
@@ -17837,7 +17816,7 @@
17837
17816
  if (!e.length) return;
17838
17817
  const i = this.Qa;
17839
17818
  this.kl = n;
17840
- const r = this.Pl(e), s = ql({}, Py), o = r.map(((e, i) => this.createMesh(this.Ga, Ha, s, e, t && t[i], n)));
17819
+ const r = this.Pl(e), s = ql({}, ky), o = r.map(((e, i) => this.createMesh(this.Ga, Ha, s, e, t && t[i], n)));
17841
17820
  this.Il = !0, Promise.all(o).then((t => {
17842
17821
  this.Za && this.Ga.deleteMesh(this.Za);
17843
17822
  const e = [], n = [];
@@ -17856,10 +17835,10 @@
17856
17835
  }));
17857
17836
  }
17858
17837
  Pl(t) {
17859
- const e = (zy + "lineDasharray").trim(), n = (zy + "linePatternFile").trim(), i = [], r = [], s = [];
17838
+ const e = (Dy + "lineDasharray").trim(), n = (Dy + "linePatternFile").trim(), i = [], r = [], s = [];
17860
17839
  for (let o = 0; o < t.length; o++) {
17861
17840
  const a = t[o], l = a.properties && a.properties[e];
17862
- l && Yy(l) ? s.push(a) : a.properties && a.properties[n] ? r.push(a) : i.push(a);
17841
+ l && $y(l) ? s.push(a) : a.properties && a.properties[n] ? r.push(a) : i.push(a);
17863
17842
  }
17864
17843
  return [ i, r, s ];
17865
17844
  }
@@ -17883,9 +17862,9 @@
17883
17862
  }
17884
17863
  }
17885
17864
  Al(t) {
17886
- void 0 === t[Fy] && (t[Fy] = this.Se++);
17887
- const e = t[Fy];
17888
- this.features[e] && this.Cl(e), this.features[e] = Cy(t, this.ja, this.features[e]);
17865
+ void 0 === t[Iy] && (t[Iy] = this.Se++);
17866
+ const e = t[Iy];
17867
+ this.features[e] && this.Cl(e), this.features[e] = Oy(t, this.ja, this.features[e]);
17889
17868
  const n = this.features[e];
17890
17869
  return this.El(n, e), this.Ea[e] = t, e;
17891
17870
  }
@@ -17893,21 +17872,21 @@
17893
17872
  if (!t) return;
17894
17873
  const n = Array.isArray(t) ? t[0].id : t.id;
17895
17874
  if (this.za[n] = t, Array.isArray(t)) for (let n = 0; n < t.length; n++) {
17896
- const i = t[n][Ly];
17897
- if (t[n][Fy] = e, this.Da[i] = {
17875
+ const i = t[n][zy];
17876
+ if (t[n][Iy] = e, this.Da[i] = {
17898
17877
  feature: t[n]
17899
- }, this.Da[i][Fy] = e, !this.needCheckPointLineSymbols()) continue;
17878
+ }, this.Da[i][Iy] = e, !this.needCheckPointLineSymbols()) continue;
17900
17879
  const r = {
17901
17880
  feature: t[n]
17902
17881
  };
17903
- (Uy(t[n]) || Gy(t[n])) && (this.La[i] = r), Gy(t[n]) && (this.Ra[i] = r), $y(t[n]) && (this.Na[i] = r);
17882
+ (Vy(t[n]) || Uy(t[n])) && (this.La[i] = r), Uy(t[n]) && (this.Ra[i] = r), By(t[n]) && (this.Na[i] = r);
17904
17883
  } else {
17905
- t[Fy] = e;
17884
+ t[Iy] = e;
17906
17885
  const n = {
17907
17886
  feature: t
17908
- }, i = t[Ly];
17887
+ }, i = t[zy];
17909
17888
  if (this.Da[i] = n, !this.needCheckPointLineSymbols()) return;
17910
- (Uy(t) || Gy(t)) && (this.La[i] = n), Gy(t) && (this.Ra[i] = n), $y(t) && (this.Na[i] = n);
17889
+ (Vy(t) || Uy(t)) && (this.La[i] = n), Uy(t) && (this.Ra[i] = n), By(t) && (this.Na[i] = n);
17911
17890
  }
17912
17891
  }
17913
17892
  needCheckPointLineSymbols() {
@@ -17916,10 +17895,10 @@
17916
17895
  Cl(t) {
17917
17896
  const e = this.features[t];
17918
17897
  if (e) if (Array.isArray(e)) for (let t = 0; t < e.length; t++) {
17919
- const n = e[t][Ly], i = e[t].id;
17898
+ const n = e[t][zy], i = e[t].id;
17920
17899
  delete this.za[i], delete this.Da[n], delete this.La[n], delete this.Ra[n], delete this.Na[n];
17921
17900
  } else {
17922
- const t = e[Ly], n = e.id;
17901
+ const t = e[zy], n = e.id;
17923
17902
  delete this.za[n], delete this.Da[t], delete this.La[t], delete this.Ra[t], delete this.Na[t];
17924
17903
  }
17925
17904
  }
@@ -17930,15 +17909,15 @@
17930
17909
  if (!r) return;
17931
17910
  const s = r.pick(t, e, n.tolerance);
17932
17911
  if (s && s.data && s.data.feature) {
17933
- const t = s.data.feature, e = this.Ea[t[Fy]];
17912
+ const t = s.data.feature, e = this.Ea[t[Iy]];
17934
17913
  n && n.includeInternals ? i.push(e) : (s.geometry = e, delete s.plugin, delete s.data,
17935
17914
  delete s.point, i.push(s));
17936
17915
  }
17937
17916
  })), i;
17938
17917
  }
17939
17918
  Dl(t) {
17940
- const e = t[Fy], n = this.features[e];
17941
- return Array.isArray(n) ? n[0][Ly] : n[Ly];
17919
+ const e = t[Iy], n = this.features[e];
17920
+ return Array.isArray(n) ? n[0][zy] : n[zy];
17942
17921
  }
17943
17922
  nl() {
17944
17923
  let t = !1;
@@ -17957,25 +17936,25 @@
17957
17936
  t = t || e;
17958
17937
  }
17959
17938
  }
17960
- this.Va = {}, t && (jy(this), this.layer.fire("partialupdate"));
17939
+ this.Va = {}, t && (Hy(this), this.layer.fire("partialupdate"));
17961
17940
  }
17962
17941
  Ll(t) {
17963
- this.Al(t), this.Ml(), jy(this);
17942
+ this.Al(t), this.Ml(), Hy(this);
17964
17943
  }
17965
17944
  onGeometryAdd(t) {
17966
- this.setToRedraw(), this.canvas && t && t.length && (this.Ol(t), this.Ml(), jy(this));
17945
+ this.setToRedraw(), this.canvas && t && t.length && (this.Ol(t), this.Ml(), Hy(this));
17967
17946
  }
17968
17947
  onGeometryRemove(t) {
17969
17948
  if (t && t.length) {
17970
17949
  for (let e = 0; e < t.length; e++) {
17971
- const n = t[e][Fy];
17950
+ const n = t[e][Iy];
17972
17951
  void 0 !== n && (delete this.Ea[n], this.Cl(n), delete this.features[n]);
17973
17952
  }
17974
- this.Ml(), jy(this);
17953
+ this.Ml(), Hy(this);
17975
17954
  }
17976
17955
  }
17977
17956
  onGeometrySymbolChange(t) {
17978
- const e = t.target._getParent() || t.target, n = e[Fy];
17957
+ const e = t.target._getParent() || t.target, n = e[Iy];
17979
17958
  if (void 0 === n) return;
17980
17959
  let i = t.properties;
17981
17960
  if (Array.isArray(i)) {
@@ -17993,30 +17972,30 @@
17993
17972
  return Array.isArray(t) ? !!Array.isArray(e) && t.length === e.length : !Array.isArray(e);
17994
17973
  }(r, s)) {
17995
17974
  if (Array.isArray(r)) for (let t = 0; t < r.length; t++) {
17996
- if (!Xy(r[t], s[t])) return void this.Ll(e);
17997
- } else if (!Xy(r, s)) return void this.Ll(e);
17975
+ if (!Yy(r[t], s[t])) return void this.Ll(e);
17976
+ } else if (!Yy(r, s)) return void this.Ll(e);
17998
17977
  this.onGeometryPositionChange(t);
17999
17978
  } else this.Ll(e); else this.Ll(e);
18000
17979
  }
18001
17980
  onGeometryShapeChange(t) {
18002
17981
  const e = t.target._getParent() || t.target;
18003
- void 0 !== e[Fy] && (this.Ol([ e ]), this.Fl(), jy(this));
17982
+ void 0 !== e[Iy] && (this.Ol([ e ]), this.Fl(), Hy(this));
18004
17983
  }
18005
17984
  onGeometryPositionChange(t) {
18006
- const e = t.target._getParent() || t.target, n = e[Fy];
18007
- void 0 !== n && (this.Ol([ e ]), this.Va[n] = e, jy(this));
17985
+ const e = t.target._getParent() || t.target, n = e[Iy];
17986
+ void 0 !== n && (this.Ol([ e ]), this.Va[n] = e, Hy(this));
18008
17987
  }
18009
17988
  onGeometryZIndexChange(t) {
18010
- void 0 !== (t.target._getParent() || t.target)[Fy] && this.Ml();
17989
+ void 0 !== (t.target._getParent() || t.target)[Iy] && this.Ml();
18011
17990
  }
18012
17991
  onGeometryShow(t) {
18013
- void 0 !== (t.target._getParent() || t.target)[Fy] && this.Rl(t);
17992
+ void 0 !== (t.target._getParent() || t.target)[Iy] && this.Rl(t);
18014
17993
  }
18015
17994
  onGeometryHide(t) {
18016
- void 0 !== (t.target._getParent() || t.target)[Fy] && this.Rl(t);
17995
+ void 0 !== (t.target._getParent() || t.target)[Iy] && this.Rl(t);
18017
17996
  }
18018
17997
  Rl(t) {
18019
- const e = t.target._getParent() || t.target, n = e[Fy], i = this.features[n];
17998
+ const e = t.target._getParent() || t.target, n = e[Iy], i = this.features[n];
18020
17999
  if (i) {
18021
18000
  const t = e.isVisible();
18022
18001
  if (Array.isArray(i)) {
@@ -18026,16 +18005,16 @@
18026
18005
  if (t === i.visible) return;
18027
18006
  i.visible = t;
18028
18007
  }
18029
- this.Nl(), jy(this);
18008
+ this.Nl(), Hy(this);
18030
18009
  }
18031
18010
  }
18032
18011
  Nl() {
18033
18012
  this.Qa = !0;
18034
18013
  }
18035
18014
  onGeometryPropertiesChange(t) {
18036
- const e = t.target._getParent() || t.target, n = e[Fy];
18037
- void 0 !== n && (this.features[n] = Cy(e, this.ja), this.El(this.features[n], n),
18038
- this.Ml(), jy(this));
18015
+ const e = t.target._getParent() || t.target, n = e[Iy];
18016
+ void 0 !== n && (this.features[n] = Oy(e, this.ja), this.El(this.features[n], n),
18017
+ this.Ml(), Hy(this));
18039
18018
  }
18040
18019
  createContext() {
18041
18020
  const t = this.canvas.gl && this.canvas.gl.wrap;
@@ -18045,14 +18024,14 @@
18045
18024
  this.painter = this.createPainter();
18046
18025
  const e = gu.get3DPainterClass("icon");
18047
18026
  let n = e.getBloomSymbol();
18048
- const i = ql({}, _y, ky);
18027
+ const i = ql({}, Sy, _y);
18049
18028
  i.markerPerspectiveRatio = this.layer.options.markerPerspectiveRatio || 0, this.Hl(i, n),
18050
18029
  this.xl = i;
18051
18030
  const r = ql({}, ch, this.layer.options.sceneConfig || {});
18052
18031
  this.Ua = new e(this.regl, this.layer, i, r, 0), this.Ua.setTextShaderDefines({
18053
18032
  REVERSE_MAP_ROTATION_ON_PITCH: 1
18054
18033
  });
18055
- const s = gu.get3DPainterClass("line"), o = ql({}, Py);
18034
+ const s = gu.get3DPainterClass("line"), o = ql({}, ky);
18056
18035
  n = s.getBloomSymbol(), this.Hl(o, n), this.jl = o;
18057
18036
  const a = ql({}, this.layer.options.sceneConfig || {});
18058
18037
  void 0 === a.depthMask && (a.depthMask = !0), this.Ga = new s(this.regl, this.layer, o, a, 0),
@@ -18131,7 +18110,7 @@
18131
18110
  for (let n = 0; n < t.length; n++) {
18132
18111
  const i = this.layer.getGeometryById(t[n]);
18133
18112
  if (i) {
18134
- const t = this.features[i[Fy]];
18113
+ const t = this.features[i[Iy]];
18135
18114
  if (Array.isArray(t)) for (let n = 0; n < t.length; n++) e.push(t[n].id); else e.push(t.id);
18136
18115
  }
18137
18116
  }
@@ -18141,7 +18120,7 @@
18141
18120
  delete this.mn, delete this.Ul, this.setToRedraw();
18142
18121
  }
18143
18122
  isEnableWorkAround(t) {
18144
- return "win-intel-gpu-crash" === t && (this.layer.options.workarounds["win-intel-gpu-crash"] && Vy(this.gl));
18123
+ return "win-intel-gpu-crash" === t && (this.layer.options.workarounds["win-intel-gpu-crash"] && jy(this.gl));
18145
18124
  }
18146
18125
  sn(t) {
18147
18126
  return rh(t, this.getMap());
@@ -18155,10 +18134,10 @@
18155
18134
  return this.Xe() ? th(t) ? 1 : t : 1;
18156
18135
  }
18157
18136
  }
18158
- function jy(t) {
18137
+ function Hy(t) {
18159
18138
  t.setToRedraw();
18160
18139
  }
18161
- function Vy(t) {
18140
+ function jy(t) {
18162
18141
  const e = t.getExtension("WEBGL_debug_renderer_info");
18163
18142
  if (e && "undefined" != typeof navigator) {
18164
18143
  const n = t.getParameter(e.UNMASKED_RENDERER_WEBGL), i = "Win32" === navigator.platform || "Win64" === navigator.platform;
@@ -18166,32 +18145,32 @@
18166
18145
  }
18167
18146
  return !1;
18168
18147
  }
18169
- function Uy({properties: t}) {
18170
- const e = (zy + "markerFile").trim(), n = (zy + "markerType").trim();
18148
+ function Vy({properties: t}) {
18149
+ const e = (Dy + "markerFile").trim(), n = (Dy + "markerType").trim();
18171
18150
  return t[e] || t[n];
18172
18151
  }
18173
- function Gy({properties: t}) {
18174
- return t[(zy + "textName").trim()];
18152
+ function Uy({properties: t}) {
18153
+ return t[(Dy + "textName").trim()];
18175
18154
  }
18176
- const Wy = (zy + "lineWidth").trim(), By = (Ty + "").trim();
18177
- function $y(t) {
18178
- return 2 === t.type && !t.properties[By] || 3 === t.type && void 0 !== t.properties[Wy];
18155
+ const Gy = (Dy + "lineWidth").trim(), Wy = (Py + "").trim();
18156
+ function By(t) {
18157
+ return 2 === t.type && !t.properties[Wy] || 3 === t.type && void 0 !== t.properties[Gy];
18179
18158
  }
18180
- function Yy(t) {
18159
+ function $y(t) {
18181
18160
  if (!Array.isArray(t)) return 0;
18182
18161
  let e = 0;
18183
18162
  for (let n = 0; n < t.length; n++) e += t[n];
18184
18163
  return e;
18185
18164
  }
18186
- function Xy(t, e) {
18187
- if (Object.keys(t).sort().join() !== Object.keys(e.properties || {}).filter((t => 0 === t.indexOf(zy))).map((t => t.substring(zy.length))).sort().join()) return !1;
18165
+ function Yy(t, e) {
18166
+ if (Object.keys(t).sort().join() !== Object.keys(e.properties || {}).filter((t => 0 === t.indexOf(Dy))).map((t => t.substring(Dy.length))).sort().join()) return !1;
18188
18167
  for (const n in t) if (ih(t, n)) {
18189
- const i = (zy + n).trim();
18168
+ const i = (Dy + n).trim();
18190
18169
  if (I(t[n]) !== I(e.properties[i])) return !1;
18191
18170
  }
18192
18171
  return !0;
18193
18172
  }
18194
- function qy(t, e, n) {
18173
+ function Xy(t, e, n) {
18195
18174
  if (!t || t.type !== e) return null;
18196
18175
  const i = new n(t.id, t.options), s = t.geometries, o = [];
18197
18176
  for (let t = 0; t < s.length; t++) {
@@ -18200,9 +18179,9 @@
18200
18179
  }
18201
18180
  return i.addGeometry(o), i;
18202
18181
  }
18203
- class Jy extends gu {
18182
+ class qy extends gu {
18204
18183
  static fromJSON(t) {
18205
- return qy(t, "PointLayer", Jy);
18184
+ return Xy(t, "PointLayer", qy);
18206
18185
  }
18207
18186
  constructor(...t) {
18208
18187
  super(...t), this.options.sceneConfig || (this.options.sceneConfig = ql({}, ch));
@@ -18214,7 +18193,7 @@
18214
18193
  return 0;
18215
18194
  }
18216
18195
  }
18217
- Jy.mergeOptions({
18196
+ qy.mergeOptions({
18218
18197
  glyphSdfLimitPerFrame: 15,
18219
18198
  iconErrorUrl: null,
18220
18199
  workarounds: {
@@ -18222,8 +18201,8 @@
18222
18201
  },
18223
18202
  collision: !1,
18224
18203
  collisionFrameLimit: 1
18225
- }), Jy.registerJSONType("PointLayer"), Jy.registerRenderer("canvas", null);
18226
- Jy.registerRenderer("gl", class extends Hy {
18204
+ }), qy.registerJSONType("PointLayer"), qy.registerRenderer("canvas", null);
18205
+ qy.registerRenderer("gl", class extends Ny {
18227
18206
  constructor(...t) {
18228
18207
  super(...t), this.GeometryTypes = [ r.Marker, r.MultiPoint ];
18229
18208
  }
@@ -18233,31 +18212,31 @@
18233
18212
  })) : t.options.maxMarkerWidth = t.options.maxMarkerHeight = 255, super.onGeometryAdd(t));
18234
18213
  }
18235
18214
  });
18236
- class Ky extends gu {
18215
+ class Jy extends gu {
18237
18216
  static fromJSON(t) {
18238
- return qy(t, "LineStringLayer", Ky);
18217
+ return Xy(t, "LineStringLayer", Jy);
18239
18218
  }
18240
18219
  }
18241
- Ky.mergeOptions({
18220
+ Jy.mergeOptions({
18242
18221
  meshRenderOrder: 1
18243
- }), Ky.registerJSONType("LineStringLayer");
18244
- const Zy = (Ty + "").trim();
18245
- Ky.registerRenderer("gl", class extends Hy {
18222
+ }), Jy.registerJSONType("LineStringLayer");
18223
+ const Ky = (Py + "").trim();
18224
+ Jy.registerRenderer("gl", class extends Ny {
18246
18225
  constructor(...t) {
18247
18226
  super(...t), this.GeometryTypes = [ r.LineString, r.MultiLineString ];
18248
18227
  }
18249
18228
  createPainter() {
18250
18229
  const t = gu.get3DPainterClass("line-gradient");
18251
18230
  this.painterSymbol = ql({}, {
18252
- lineGradientProperty: Zy
18253
- }, Py), this.Hl(this.painterSymbol, t.getBloomSymbol());
18231
+ lineGradientProperty: Ky
18232
+ }, ky), this.Hl(this.painterSymbol, t.getBloomSymbol());
18254
18233
  const e = ql({}, this.layer.options.sceneConfig || {});
18255
18234
  void 0 === e.depthMask && (e.depthMask = !0);
18256
18235
  return new t(this.regl, this.layer, this.painterSymbol, e, 0);
18257
18236
  }
18258
18237
  buildMesh() {
18259
18238
  let {features: t, center: e} = this.ol();
18260
- if (t = t.filter((t => !!t.properties[Zy])), !t.length) return;
18239
+ if (t = t.filter((t => !!t.properties[Ky])), !t.length) return;
18261
18240
  const n = this.Qa;
18262
18241
  this.Gl = e;
18263
18242
  const i = ql({}, this.painterSymbol), r = this.createMesh(this.painter, Ha, i, t, null, e);
@@ -18271,14 +18250,14 @@
18271
18250
  this.meshes = e, n && (this.Qa = n), this.zl = !1, this.setToRedraw();
18272
18251
  }));
18273
18252
  }
18274
- }), Ky.registerRenderer("canvas", null);
18275
- class Qy extends gu {
18253
+ }), Jy.registerRenderer("canvas", null);
18254
+ class Zy extends gu {
18276
18255
  static fromJSON(t) {
18277
- return qy(t, "PolygonLayer", Qy);
18256
+ return Xy(t, "PolygonLayer", Zy);
18278
18257
  }
18279
18258
  }
18280
- Qy.registerJSONType("PolygonLayer");
18281
- const tm = {
18259
+ Zy.registerJSONType("PolygonLayer");
18260
+ const Qy = {
18282
18261
  polygonFill: {
18283
18262
  type: "identity",
18284
18263
  default: [ 1, 1, 1, 1 ],
@@ -18330,7 +18309,7 @@
18330
18309
  property: "_symbol_polygonPatternUV"
18331
18310
  }
18332
18311
  };
18333
- class em extends Hy {
18312
+ class tm extends Ny {
18334
18313
  constructor() {
18335
18314
  super(...arguments), this.GeometryTypes = [ r.Polygon, r.MultiPolygon ];
18336
18315
  }
@@ -18342,7 +18321,7 @@
18342
18321
  if (!e.length) return;
18343
18322
  const i = this.Qa;
18344
18323
  this.Gl = n;
18345
- const r = this.Wl(e), s = ql({}, tm), o = r.map(((e, i) => this.createMesh(this.painter, Qa, s, e, t && t[i], n)));
18324
+ const r = this.Wl(e), s = ql({}, Qy), o = r.map(((e, i) => this.createMesh(this.painter, Qa, s, e, t && t[i], n)));
18346
18325
  this.zl = !0, Promise.all(o).then((t => {
18347
18326
  this.meshes && this.painter.deleteMesh(this.meshes), t = function(t) {
18348
18327
  const e = [];
@@ -18366,7 +18345,7 @@
18366
18345
  getRayCastData(t, e) {
18367
18346
  const n = this.painter.getRayCastData(t, e);
18368
18347
  if (!n || !n.feature) return null;
18369
- const i = n.feature[Fy];
18348
+ const i = n.feature[Iy];
18370
18349
  return this.Ea[i];
18371
18350
  }
18372
18351
  Wl(t) {
@@ -18378,15 +18357,15 @@
18378
18357
  return [ e, n ];
18379
18358
  }
18380
18359
  createPainter() {
18381
- const t = gu.get3DPainterClass("fill"), e = this.painterSymbol = ql({}, tm);
18360
+ const t = gu.get3DPainterClass("fill"), e = this.painterSymbol = ql({}, Qy);
18382
18361
  this.Hl(e, t.getBloomSymbol());
18383
18362
  return new t(this.regl, this.layer, e, this.layer.options.sceneConfig, 0);
18384
18363
  }
18385
18364
  updateMesh(t) {
18386
- return this._l(t, this.meshes, this.atlas, this.Gl, this.painter, Qa, tm, this.Wl);
18365
+ return this._l(t, this.meshes, this.atlas, this.Gl, this.painter, Qa, Qy, this.Wl);
18387
18366
  }
18388
18367
  }
18389
- function nm(t, e, n, i, r, s, o) {
18368
+ function em(t, e, n, i, r, s, o) {
18390
18369
  const a = n && Array.isArray(n[0]);
18391
18370
  for (let s = 0, l = n.length; s < l; s++) {
18392
18371
  t[e] = (a ? n[s][0] : n[s].x) * i, t[e + 1] = (a ? n[s][1] : n[s].y) * i, o !== Float32Array && (t[e] = Math.round(t[e]),
@@ -18396,21 +18375,21 @@
18396
18375
  }
18397
18376
  return t.trySetLength && t.trySetLength(e), e;
18398
18377
  }
18399
- function im(t, e, n, i) {
18378
+ function nm(t, e, n, i) {
18400
18379
  const r = t[3 * e], s = t[3 * e + 1], o = t[3 * n], a = t[3 * n + 1];
18401
18380
  return r === o && (r < 0 || r > i) || s === a && (s < 0 || s > i);
18402
18381
  }
18403
- Qy.registerRenderer("gl", em), Qy.registerRenderer("canvas", null);
18404
- const rm = Math.PI / 180, sm = 6378137 * Math.PI / 180, om = 85.0511287798;
18405
- function am(t, e, n) {
18382
+ Zy.registerRenderer("gl", tm), Zy.registerRenderer("canvas", null);
18383
+ const im = Math.PI / 180, rm = 6378137 * Math.PI / 180, sm = 85.0511287798;
18384
+ function om(t, e, n) {
18406
18385
  return function(t, e) {
18407
- const n = om, i = e[0], r = Math.max(Math.min(n, e[1]), -n);
18386
+ const n = sm, i = e[0], r = Math.max(Math.min(n, e[1]), -n);
18408
18387
  let s;
18409
- s = 0 === r ? 0 : Math.log(Math.tan((90 + r) * rm / 2)) / rm;
18410
- return t[0] = i * sm, t[1] = s * sm, t;
18388
+ s = 0 === r ? 0 : Math.log(Math.tan((90 + r) * im / 2)) / im;
18389
+ return t[0] = i * rm, t[1] = s * rm, t;
18411
18390
  }(t, e);
18412
18391
  }
18413
- function lm(t, e, n, i, r, s, o, a, l, h, u, c, f, d, p) {
18392
+ function am(t, e, n, i, r, s, o, a, l, h, u, c, f, d, p) {
18414
18393
  0 === t ? function(t, e, n, i, r, s, o, a, l, h) {
18415
18394
  const u = 1 / (100 * s[0]), c = 1 / (100 * s[1]), f = h && h[0] || 0, d = h && h[1] || 0, p = [ 0, 0 ];
18416
18395
  for (let r = t; r < e; r += 3) {
@@ -18426,22 +18405,22 @@
18426
18405
  for (let t = e; t < n; t += 3) {
18427
18406
  const e = t / 3 * 2;
18428
18407
  Ze(g, (s.x / l + r[t] / o) * a, s.y / l * a + (u ? r[t + 1] : -r[t + 1]) / o * a),
18429
- "EPSG:4326" !== h && "EPSG:4490" !== h || am(g, g), hm(v, g, c, f), hm(x, g, p, c),
18408
+ "EPSG:4326" !== h && "EPSG:4490" !== h || om(g, g), lm(v, g, c, f), lm(x, g, p, c),
18430
18409
  i[e] = Qe(c, v) / y, i[e + 1] = Qe(c, x) / m;
18431
18410
  }
18432
18411
  }(u, e, n, i, r, s, a, c, f, d, !!p);
18433
18412
  }
18434
- function hm(t, e, n, i) {
18413
+ function lm(t, e, n, i) {
18435
18414
  const r = n[0] - i[0], s = n[1] - i[1];
18436
18415
  let o = (e[0] - n[0]) * (n[0] - i[0]) + (e[1] - n[1]) * (n[1] - i[1]);
18437
18416
  return o /= r * r + s * s, t[0] = n[0] + o * r, t[1] = n[1] + o * s, t;
18438
18417
  }
18439
- function um(t, e, n, i, r) {
18418
+ function hm(t, e, n, i, r) {
18440
18419
  const s = 3 * e[n - 1], o = 3 * e[n - 1] + 1, a = t[s], l = t[o];
18441
18420
  return h = i, u = r, c = a, f = l, Math.sqrt((c - h) * (c - h) + (f - u) * (f - u));
18442
18421
  var h, u, c, f;
18443
18422
  }
18444
- function cm(t, e, n, i, r, s, o, a, l, h, u, c, f, d, p, y, m) {
18423
+ function um(t, e, n, i, r, s, o, a, l, h, u, c, f, d, p, y, m) {
18445
18424
  const g = e.getLength(), v = r / 3;
18446
18425
  for (let n = 2, i = g; n < i; n += 3) t[r + n - 2] = e[n - 2], t[r + n - 1] = e[n - 1],
18447
18426
  t[r + n - 0] = e[n] - o;
@@ -18452,14 +18431,14 @@
18452
18431
  t.copyWithin(r, r - 2 * g, r - g), r += g, (n = n || []).push(g / 3);
18453
18432
  const x = n.getLength();
18454
18433
  for (let e = 0; e < x; e++) {
18455
- fm(v + (n[e - 1] || 0), v + n[e], t, g / 3, l, i, h, u, c, f, s, d, p, y, m);
18434
+ cm(v + (n[e - 1] || 0), v + n[e], t, g / 3, l, i, h, u, c, f, s, d, p, y, m);
18456
18435
  }
18457
18436
  return r;
18458
18437
  }
18459
- function fm(t, e, n, i, r, s, o, a, l, h, u, c, f, d, p) {
18438
+ function cm(t, e, n, i, r, s, o, a, l, h, u, c, f, d, p) {
18460
18439
  const y = s.getLength();
18461
18440
  let m, g;
18462
- for (let o = t, a = e; o < a - 1; o++) if (m = o, g = o + 1, r === 1 / 0 || !im(n, m, g, r)) if ((o - t) % 2 == 1 && (m += 2 * i,
18441
+ for (let o = t, a = e; o < a - 1; o++) if (m = o, g = o + 1, r === 1 / 0 || !nm(n, m, g, r)) if ((o - t) % 2 == 1 && (m += 2 * i,
18463
18442
  g += 2 * i), p) {
18464
18443
  let t = s.currentIndex;
18465
18444
  s[t++] = m + i, s[t++] = g, s[t++] = m, s[t++] = g + i, s[t++] = g, s[t++] = m + i,
@@ -18478,7 +18457,7 @@
18478
18457
  f = d - p);
18479
18458
  let M = y;
18480
18459
  const S = c % 6;
18481
- 0 === t ? (5 === S && (m = um(r, s, c, b, w)), M = S === g[0] || S === g[1] || S === g[2] ? y : y + m) : 1 === t && (S === g[0] || S === g[1] || S === g[2] ? M = 0 : 5 === S ? (m = um(r, s, c, b, w),
18460
+ 0 === t ? (5 === S && (m = hm(r, s, c, b, w)), M = S === g[0] || S === g[1] || S === g[2] ? y : y + m) : 1 === t && (S === g[0] || S === g[1] || S === g[2] ? M = 0 : 5 === S ? (m = hm(r, s, c, b, w),
18482
18461
  M = m) : M = m);
18483
18462
  const _ = M / h * (1 / (100 * u)) / a;
18484
18463
  let k;
@@ -18487,16 +18466,16 @@
18487
18466
  }
18488
18467
  }(a, l, h, u, n, s, y, c[0], c[1], f, d, p);
18489
18468
  }
18490
- function dm(t) {
18469
+ function fm(t) {
18491
18470
  const e = [ t[0] ];
18492
18471
  let n = t[0];
18493
18472
  for (let i = 1; i < t.length; i++) Array.isArray(t[i]) ? t[i][0] === n[0] && t[i][1] === n[1] && t[i][2] === n[2] || e.push(t[i]) : t[i].x === n.x && t[i].y === n.y && t[i].z === n.z || e.push(t[i]),
18494
18473
  n = t[i];
18495
18474
  return e;
18496
18475
  }
18497
- const pm = Po.getInstance();
18498
- function ym(t, e, n, i, r, s, o, a, l, h, u, c, f, d, p, y) {
18499
- void 0 === e.top && (e.top = !0), void 0 === e.side && (e.side = !0), pm.reset();
18476
+ const dm = Po.getInstance();
18477
+ function pm(t, e, n, i, r, s, o, a, l, h, u, c, f, d, p, y) {
18478
+ void 0 === e.top && (e.top = !0), void 0 === e.side && (e.side = !0), dm.reset();
18500
18479
  const {altitudeScale: m, altitudeProperty: g, defaultAltitude: v, heightProperty: x, minHeightProperty: b, defaultHeight: w, tangent: A, uv: M, topUVMode: S, sideUVMode: _, sideVerticalUVMode: k, top: P, side: T, textureYOrigin: C, topThickness: E} = e, D = !!y, z = function(t, e, {altitudeScale: n, altitudeProperty: i, defaultAltitude: r, heightProperty: s, minHeightProperty: o, defaultHeight: a}, {center: l, side: h, top: u, topThickness: c, uvOrigin: f, uv: d, uvSize: p, topUVMode: y, sideUVMode: m, sideVerticalUVMode: g, textureYOrigin: v, tileRatio: x, centimeterToPoint: b, verticalCentimeterToPoint: w, positionType: A, res: M, glScale: S, projectionCode: _}, k, P) {
18501
18480
  let T = e / t[0].extent;
18502
18481
  e === 1 / 0 && (T = 1);
@@ -18516,12 +18495,12 @@
18516
18495
  }
18517
18496
  h = r.length, u = z.currentIndex;
18518
18497
  for (let t = 0; t < h; t++) z[u++] = r[t];
18519
- z.currentIndex = u, R && lm(y || 0, t, n, j, D, f, b, x, p[0], p[1], s, M, S, _, l),
18520
- c > 0 && !H && (n = cm(D, E, i, z, n, j, 0, c, e, R, m || 0, g || 0, v, p, x, w, o)),
18498
+ z.currentIndex = u, R && am(y || 0, t, n, j, D, f, b, x, p[0], p[1], s, M, S, _, l),
18499
+ c > 0 && !H && (n = um(D, E, i, z, n, j, 0, c, e, R, m || 0, g || 0, v, p, x, w, o)),
18521
18500
  L.setLength(n / 3), L.fill(1, a / 3, n / 3);
18522
18501
  }
18523
18502
  if (H) {
18524
- N && (c = 0), a = n, n = cm(D, E, i, z, n, j, c, r, e, R, m || 0, g || 0, v, p, x, w, o),
18503
+ N && (c = 0), a = n, n = um(D, E, i, z, n, j, c, r, e, R, m || 0, g || 0, v, p, x, w, o),
18525
18504
  L.setLength(n / 3);
18526
18505
  const t = E.getLength() / 3;
18527
18506
  L.fill(1, a / 3, a / 3 + t), L.fill(0, a / 3 + t, a / 3 + 2 * t), L.fill(1, a / 3 + 2 * t, a / 3 + 3 * t),
@@ -18548,7 +18527,7 @@
18548
18527
  const v = ul.calculateSignedArea(u[0]) < 0;
18549
18528
  for (let t = 0, n = u.length; t < n; t++) {
18550
18529
  let i = u[t];
18551
- v && (i = i.reverse()), i = dm(i);
18530
+ v && (i = i.reverse()), i = fm(i);
18552
18531
  const r = ul.calculateSignedArea(i) < 0;
18553
18532
  if (!r && t > 0 && (m++, f = c && c[m], G = V(g, G, q, p * T, f, I), E.setLength(0),
18554
18533
  q.setLength(0), g = G), e !== 1 / 0 && (i = ul.clipPolygon(i, W)), !i.length) {
@@ -18561,7 +18540,7 @@
18561
18540
  let t = q.currentIndex;
18562
18541
  q[t++] = E.getLength() / 3, q.currentIndex = t;
18563
18542
  }
18564
- nm(E, E.getLength(), i, T, d, 0, A), t === n - 1 && (G = V(g, G, q, p * T, f, I));
18543
+ em(E, E.getLength(), i, T, d, 0, A), t === n - 1 && (G = V(g, G, q, p * T, f, I));
18565
18544
  }
18566
18545
  const x = D.getLength() - y, b = (vh + "").trim();
18567
18546
  for (let t = 0; t < x / 3; t++) {
@@ -18609,11 +18588,11 @@
18609
18588
  res: s,
18610
18589
  glScale: o,
18611
18590
  projectionCode: f
18612
- }, d, pm), L = [], R = z.vertices.getLength() / 3, N = ul.getIndexArrayType(R), H = Po.createTypedArray(z.indices, N);
18591
+ }, d, dm), L = [], R = z.vertices.getLength() / 3, N = ul.getIndexArrayType(R), H = Po.createTypedArray(z.indices, N);
18613
18592
  delete z.indices, L.push(H.buffer, z.pickingIds.buffer);
18614
18593
  const j = p || ul.getPosArrayType(Math.max(512, z.maxAltitude));
18615
18594
  z.vertices = Po.createTypedArray(z.vertices, j);
18616
- const V = A ? pm.getProxy() : new Float32Array(3 * R);
18595
+ const V = A ? dm.getProxy() : new Float32Array(3 * R);
18617
18596
  V.setLength && V.setLength(3 * R);
18618
18597
  const U = function(t, e, n) {
18619
18598
  const i = n || [];
@@ -18637,7 +18616,7 @@
18637
18616
  1 - Math.abs(e) > 1e-6 ? G = !1 : 0 !== e && (U[t] = Math.round(U[t]));
18638
18617
  }
18639
18618
  if (z.normals = U, A) {
18640
- let t = pm.get();
18619
+ let t = dm.get();
18641
18620
  t.setLength(4 * R), t = function(t, e, n, i, r) {
18642
18621
  const s = (t.getLength ? t.getLength() : t.length) / 3, o = r || new Array(4 * s), a = [], l = [];
18643
18622
  for (let t = 0; t < s; t++) a[t] = [ 0, 0, 0 ], l[t] = [ 0, 0, 0 ];
@@ -18691,8 +18670,8 @@
18691
18670
  o.$layer = s.layer, o.$type = s.type;
18692
18671
  let h = a(n, o);
18693
18672
  I(h) && (r.aColor = 1, a = O(h), h = a(n, o)), delete o.$layer, delete o.$type,
18694
- Bn.normalizeColor(mm, h), l[4 * e] = mm[0], l[4 * e + 1] = mm[1], l[4 * e + 2] = mm[2],
18695
- l[4 * e + 3] = mm[3];
18673
+ Bn.normalizeColor(ym, h), l[4 * e] = ym[0], l[4 * e + 1] = ym[1], l[4 * e + 2] = ym[2],
18674
+ l[4 * e + 3] = ym[3];
18696
18675
  }
18697
18676
  s.aColor = l;
18698
18677
  }
@@ -18728,10 +18707,10 @@
18728
18707
  const m = n[e[i]], g = m.properties || {};
18729
18708
  g.$layer = m.layer, g.$type = m.type;
18730
18709
  let v = h ? u : c, x = v(r, g);
18731
- I(x) && (v = O(x), x = v(r, g)), delete g.$layer, delete g.$type, Bn.normalizeColor(mm, x),
18732
- Je(mm, mm, l);
18733
- let b = gm(s, mm);
18734
- b < 0 && (b = s.length, s.push(Xe([], mm))), t[i] = b, h ? (f = e[i], p = b) : (d = e[i],
18710
+ I(x) && (v = O(x), x = v(r, g)), delete g.$layer, delete g.$type, Bn.normalizeColor(ym, x),
18711
+ Je(ym, ym, l);
18712
+ let b = mm(s, ym);
18713
+ b < 0 && (b = s.length, s.push(Xe([], ym))), t[i] = b, h ? (f = e[i], p = b) : (d = e[i],
18735
18714
  y = b);
18736
18715
  }
18737
18716
  }
@@ -18761,36 +18740,36 @@
18761
18740
  Y.data.pickingIdIndiceMap = ul.generatePickingIndiceIndex(Y.data.data.aPickingId, Y.data.indices),
18762
18741
  Y;
18763
18742
  }
18764
- const mm = [];
18765
- function gm(t, e) {
18743
+ const ym = [];
18744
+ function mm(t, e) {
18766
18745
  for (let n = 0; n < t.length; n++) if (Ke(e, t[n])) return n;
18767
18746
  return -1;
18768
18747
  }
18769
- function vm(t, e, n, i, r) {
18770
- xm(t, e, n || 0, i || t.length - 1, r || wm);
18748
+ function gm(t, e, n, i, r) {
18749
+ vm(t, e, n || 0, i || t.length - 1, r || bm);
18771
18750
  }
18772
- function xm(t, e, n, i, r) {
18751
+ function vm(t, e, n, i, r) {
18773
18752
  for (;i > n; ) {
18774
18753
  if (i - n > 600) {
18775
18754
  var s = i - n + 1, o = e - n + 1, a = Math.log(s), l = .5 * Math.exp(2 * a / 3), h = .5 * Math.sqrt(a * l * (s - l) / s) * (o - s / 2 < 0 ? -1 : 1);
18776
- xm(t, e, Math.max(n, Math.floor(e - o * l / s + h)), Math.min(i, Math.floor(e + (s - o) * l / s + h)), r);
18755
+ vm(t, e, Math.max(n, Math.floor(e - o * l / s + h)), Math.min(i, Math.floor(e + (s - o) * l / s + h)), r);
18777
18756
  }
18778
18757
  var u = t[e], c = n, f = i;
18779
- for (bm(t, n, e), r(t[i], u) > 0 && bm(t, n, i); c < f; ) {
18780
- for (bm(t, c, f), c++, f--; r(t[c], u) < 0; ) c++;
18758
+ for (xm(t, n, e), r(t[i], u) > 0 && xm(t, n, i); c < f; ) {
18759
+ for (xm(t, c, f), c++, f--; r(t[c], u) < 0; ) c++;
18781
18760
  for (;r(t[f], u) > 0; ) f--;
18782
18761
  }
18783
- 0 === r(t[n], u) ? bm(t, n, f) : bm(t, ++f, i), f <= e && (n = f + 1), e <= f && (i = f - 1);
18762
+ 0 === r(t[n], u) ? xm(t, n, f) : xm(t, ++f, i), f <= e && (n = f + 1), e <= f && (i = f - 1);
18784
18763
  }
18785
18764
  }
18786
- function bm(t, e, n) {
18765
+ function xm(t, e, n) {
18787
18766
  var i = t[e];
18788
18767
  t[e] = t[n], t[n] = i;
18789
18768
  }
18790
- function wm(t, e) {
18769
+ function bm(t, e) {
18791
18770
  return t < e ? -1 : t > e ? 1 : 0;
18792
18771
  }
18793
- class Am {
18772
+ class wm {
18794
18773
  constructor(t = 9) {
18795
18774
  this.Bl = Math.max(4, t), this.$l = Math.max(2, Math.ceil(.4 * this.Bl)), this.clear();
18796
18775
  }
@@ -18800,12 +18779,12 @@
18800
18779
  search(t) {
18801
18780
  let e = this.data;
18802
18781
  const n = [];
18803
- if (!Dm(t, e)) return n;
18782
+ if (!Em(t, e)) return n;
18804
18783
  const i = this.toBBox, r = [];
18805
18784
  for (;e; ) {
18806
18785
  for (let s = 0; s < e.children.length; s++) {
18807
18786
  const o = e.children[s], a = e.leaf ? i(o) : o;
18808
- Dm(t, a) && (e.leaf ? n.push(o) : Em(t, a) ? this.Yl(o, n) : r.push(o));
18787
+ Em(t, a) && (e.leaf ? n.push(o) : Cm(t, a) ? this.Yl(o, n) : r.push(o));
18809
18788
  }
18810
18789
  e = r.pop();
18811
18790
  }
@@ -18813,13 +18792,13 @@
18813
18792
  }
18814
18793
  collides(t) {
18815
18794
  let e = this.data;
18816
- if (!Dm(t, e)) return !1;
18795
+ if (!Em(t, e)) return !1;
18817
18796
  const n = [];
18818
18797
  for (;e; ) {
18819
18798
  for (let i = 0; i < e.children.length; i++) {
18820
18799
  const r = e.children[i], s = e.leaf ? this.toBBox(r) : r;
18821
- if (Dm(t, s)) {
18822
- if (e.leaf || Em(t, s)) return !0;
18800
+ if (Em(t, s)) {
18801
+ if (e.leaf || Cm(t, s)) return !0;
18823
18802
  n.push(r);
18824
18803
  }
18825
18804
  }
@@ -18847,7 +18826,7 @@
18847
18826
  return t && this.Jl(t, this.data.height - 1), this;
18848
18827
  }
18849
18828
  clear() {
18850
- return this.data = zm([]), this;
18829
+ return this.data = Dm([]), this;
18851
18830
  }
18852
18831
  remove(t, e) {
18853
18832
  if (!t) return this;
@@ -18856,10 +18835,10 @@
18856
18835
  let o, a, l;
18857
18836
  for (;n || r.length; ) {
18858
18837
  if (n || (n = r.pop(), a = r[r.length - 1], o = s.pop(), l = !0), n.leaf) {
18859
- const i = Mm(t, n.children, e);
18838
+ const i = Am(t, n.children, e);
18860
18839
  if (-1 !== i) return n.children.splice(i, 1), r.push(n), this.Kl(r), this;
18861
18840
  }
18862
- l || n.leaf || !Em(n, i) ? a ? (o++, n = a.children[o], l = !1) : n = null : (r.push(n),
18841
+ l || n.leaf || !Cm(n, i) ? a ? (o++, n = a.children[o], l = !1) : n = null : (r.push(n),
18863
18842
  s.push(o), o = 0, a = n, n = n.children[0]);
18864
18843
  }
18865
18844
  return this;
@@ -18887,26 +18866,26 @@
18887
18866
  Xl(t, e, n, i) {
18888
18867
  const r = n - e + 1;
18889
18868
  let s, o = this.Bl;
18890
- if (r <= o) return s = zm(t.slice(e, n + 1)), Sm(s, this.toBBox), s;
18869
+ if (r <= o) return s = Dm(t.slice(e, n + 1)), Mm(s, this.toBBox), s;
18891
18870
  i || (i = Math.ceil(Math.log(r) / Math.log(o)), o = Math.ceil(r / Math.pow(o, i - 1))),
18892
- s = zm([]), s.leaf = !1, s.height = i;
18871
+ s = Dm([]), s.leaf = !1, s.height = i;
18893
18872
  const a = Math.ceil(r / o), l = a * Math.ceil(Math.sqrt(o));
18894
- Lm(t, e, n, l, this.compareMinX);
18873
+ zm(t, e, n, l, this.compareMinX);
18895
18874
  for (let r = e; r <= n; r += l) {
18896
18875
  const e = Math.min(r + l - 1, n);
18897
- Lm(t, r, e, a, this.compareMinY);
18876
+ zm(t, r, e, a, this.compareMinY);
18898
18877
  for (let n = r; n <= e; n += a) {
18899
18878
  const r = Math.min(n + a - 1, e);
18900
18879
  s.children.push(this.Xl(t, n, r, i - 1));
18901
18880
  }
18902
18881
  }
18903
- return Sm(s, this.toBBox), s;
18882
+ return Mm(s, this.toBBox), s;
18904
18883
  }
18905
18884
  Zl(t, e, n, i) {
18906
18885
  for (;i.push(e), !e.leaf && i.length - 1 !== n; ) {
18907
18886
  let n, i = 1 / 0, r = 1 / 0;
18908
18887
  for (let s = 0; s < e.children.length; s++) {
18909
- const o = e.children[s], a = Im(o), l = Om(t, o) - a;
18888
+ const o = e.children[s], a = Tm(o), l = Fm(t, o) - a;
18910
18889
  l < r ? (r = l, i = a < i ? a : i, n = o) : l === r && a < i && (i = a, n = o);
18911
18890
  }
18912
18891
  e = n || e.children[0];
@@ -18915,100 +18894,100 @@
18915
18894
  }
18916
18895
  Jl(t, e, n) {
18917
18896
  const i = n ? t : this.toBBox(t), r = [], s = this.Zl(i, this.data, e, r);
18918
- for (s.children.push(t), km(s, i); e >= 0 && r[e].children.length > this.Bl; ) this.Ql(r, e),
18897
+ for (s.children.push(t), _m(s, i); e >= 0 && r[e].children.length > this.Bl; ) this.Ql(r, e),
18919
18898
  e--;
18920
18899
  this.th(i, r, e);
18921
18900
  }
18922
18901
  Ql(t, e) {
18923
18902
  const n = t[e], i = n.children.length, r = this.$l;
18924
18903
  this.eh(n, r, i);
18925
- const s = this.nh(n, r, i), o = zm(n.children.splice(s, n.children.length - s));
18926
- o.height = n.height, o.leaf = n.leaf, Sm(n, this.toBBox), Sm(o, this.toBBox), e ? t[e - 1].children.push(o) : this.ql(n, o);
18904
+ const s = this.nh(n, r, i), o = Dm(n.children.splice(s, n.children.length - s));
18905
+ o.height = n.height, o.leaf = n.leaf, Mm(n, this.toBBox), Mm(o, this.toBBox), e ? t[e - 1].children.push(o) : this.ql(n, o);
18927
18906
  }
18928
18907
  ql(t, e) {
18929
- this.data = zm([ t, e ]), this.data.height = t.height + 1, this.data.leaf = !1,
18930
- Sm(this.data, this.toBBox);
18908
+ this.data = Dm([ t, e ]), this.data.height = t.height + 1, this.data.leaf = !1,
18909
+ Mm(this.data, this.toBBox);
18931
18910
  }
18932
18911
  nh(t, e, n) {
18933
18912
  let i, r = 1 / 0, s = 1 / 0;
18934
18913
  for (let o = e; o <= n - e; o++) {
18935
- const e = _m(t, 0, o, this.toBBox), a = _m(t, o, n, this.toBBox), l = Cm(e, a), h = Im(e) + Im(a);
18914
+ const e = Sm(t, 0, o, this.toBBox), a = Sm(t, o, n, this.toBBox), l = Om(e, a), h = Tm(e) + Tm(a);
18936
18915
  l < r ? (r = l, i = o, s = h < s ? h : s) : l === r && h < s && (s = h, i = o);
18937
18916
  }
18938
18917
  return i || n - e;
18939
18918
  }
18940
18919
  eh(t, e, n) {
18941
- const i = t.leaf ? this.compareMinX : Pm, r = t.leaf ? this.compareMinY : Tm;
18920
+ const i = t.leaf ? this.compareMinX : km, r = t.leaf ? this.compareMinY : Pm;
18942
18921
  this.ih(t, e, n, i) < this.ih(t, e, n, r) && t.children.sort(i);
18943
18922
  }
18944
18923
  ih(t, e, n, i) {
18945
18924
  t.children.sort(i);
18946
- const r = this.toBBox, s = _m(t, 0, e, r), o = _m(t, n - e, n, r);
18947
- let a = Fm(s) + Fm(o);
18925
+ const r = this.toBBox, s = Sm(t, 0, e, r), o = Sm(t, n - e, n, r);
18926
+ let a = Im(s) + Im(o);
18948
18927
  for (let i = e; i < n - e; i++) {
18949
18928
  const e = t.children[i];
18950
- km(s, t.leaf ? r(e) : e), a += Fm(s);
18929
+ _m(s, t.leaf ? r(e) : e), a += Im(s);
18951
18930
  }
18952
18931
  for (let i = n - e - 1; i >= e; i--) {
18953
18932
  const e = t.children[i];
18954
- km(o, t.leaf ? r(e) : e), a += Fm(o);
18933
+ _m(o, t.leaf ? r(e) : e), a += Im(o);
18955
18934
  }
18956
18935
  return a;
18957
18936
  }
18958
18937
  th(t, e, n) {
18959
- for (let i = n; i >= 0; i--) km(e[i], t);
18938
+ for (let i = n; i >= 0; i--) _m(e[i], t);
18960
18939
  }
18961
18940
  Kl(t) {
18962
18941
  for (let e, n = t.length - 1; n >= 0; n--) 0 === t[n].children.length ? n > 0 ? (e = t[n - 1].children,
18963
- e.splice(e.indexOf(t[n]), 1)) : this.clear() : Sm(t[n], this.toBBox);
18942
+ e.splice(e.indexOf(t[n]), 1)) : this.clear() : Mm(t[n], this.toBBox);
18964
18943
  }
18965
18944
  }
18966
- function Mm(t, e, n) {
18945
+ function Am(t, e, n) {
18967
18946
  if (!n) return e.indexOf(t);
18968
18947
  for (let i = 0; i < e.length; i++) if (n(t, e[i])) return i;
18969
18948
  return -1;
18970
18949
  }
18971
- function Sm(t, e) {
18972
- _m(t, 0, t.children.length, e, t);
18950
+ function Mm(t, e) {
18951
+ Sm(t, 0, t.children.length, e, t);
18973
18952
  }
18974
- function _m(t, e, n, i, r) {
18975
- r || (r = zm(null)), r.minX = 1 / 0, r.minY = 1 / 0, r.maxX = -1 / 0, r.maxY = -1 / 0;
18953
+ function Sm(t, e, n, i, r) {
18954
+ r || (r = Dm(null)), r.minX = 1 / 0, r.minY = 1 / 0, r.maxX = -1 / 0, r.maxY = -1 / 0;
18976
18955
  for (let s = e; s < n; s++) {
18977
18956
  const e = t.children[s];
18978
- km(r, t.leaf ? i(e) : e);
18957
+ _m(r, t.leaf ? i(e) : e);
18979
18958
  }
18980
18959
  return r;
18981
18960
  }
18982
- function km(t, e) {
18961
+ function _m(t, e) {
18983
18962
  return t.minX = Math.min(t.minX, e.minX), t.minY = Math.min(t.minY, e.minY), t.maxX = Math.max(t.maxX, e.maxX),
18984
18963
  t.maxY = Math.max(t.maxY, e.maxY), t;
18985
18964
  }
18986
- function Pm(t, e) {
18965
+ function km(t, e) {
18987
18966
  return t.minX - e.minX;
18988
18967
  }
18989
- function Tm(t, e) {
18968
+ function Pm(t, e) {
18990
18969
  return t.minY - e.minY;
18991
18970
  }
18992
- function Im(t) {
18971
+ function Tm(t) {
18993
18972
  return (t.maxX - t.minX) * (t.maxY - t.minY);
18994
18973
  }
18995
- function Fm(t) {
18974
+ function Im(t) {
18996
18975
  return t.maxX - t.minX + (t.maxY - t.minY);
18997
18976
  }
18998
- function Om(t, e) {
18977
+ function Fm(t, e) {
18999
18978
  return (Math.max(e.maxX, t.maxX) - Math.min(e.minX, t.minX)) * (Math.max(e.maxY, t.maxY) - Math.min(e.minY, t.minY));
19000
18979
  }
19001
- function Cm(t, e) {
18980
+ function Om(t, e) {
19002
18981
  const n = Math.max(t.minX, e.minX), i = Math.max(t.minY, e.minY), r = Math.min(t.maxX, e.maxX), s = Math.min(t.maxY, e.maxY);
19003
18982
  return Math.max(0, r - n) * Math.max(0, s - i);
19004
18983
  }
19005
- function Em(t, e) {
18984
+ function Cm(t, e) {
19006
18985
  return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;
19007
18986
  }
19008
- function Dm(t, e) {
18987
+ function Em(t, e) {
19009
18988
  return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY;
19010
18989
  }
19011
- function zm(t) {
18990
+ function Dm(t) {
19012
18991
  return {
19013
18992
  children: t,
19014
18993
  height: 1,
@@ -19019,17 +18998,17 @@
19019
18998
  maxY: -1 / 0
19020
18999
  };
19021
19000
  }
19022
- function Lm(t, e, n, i, r) {
19001
+ function zm(t, e, n, i, r) {
19023
19002
  const s = [ e, n ];
19024
19003
  for (;s.length; ) {
19025
19004
  if ((n = s.pop()) - (e = s.pop()) <= i) continue;
19026
19005
  const o = e + Math.ceil((n - e) / i / 2) * i;
19027
- vm(t, o, e, n, r), s.push(e, o, o, n);
19006
+ gm(t, o, e, n, r), s.push(e, o, o, n);
19028
19007
  }
19029
19008
  }
19030
- var Rm = {
19009
+ var Lm = {
19031
19010
  exports: {}
19032
- }, Nm = function(t, e, n, i) {
19011
+ }, Rm = function(t, e, n, i) {
19033
19012
  var r = t[0], s = t[1], o = !1;
19034
19013
  void 0 === n && (n = 0), void 0 === i && (i = e.length);
19035
19014
  for (var a = (i - n) / 2, l = 0, h = a - 1; l < a; h = l++) {
@@ -19037,7 +19016,7 @@
19037
19016
  c > s != d > s && r < (f - u) * (s - c) / (d - c) + u && (o = !o);
19038
19017
  }
19039
19018
  return o;
19040
- }, Hm = function(t, e, n, i) {
19019
+ }, Nm = function(t, e, n, i) {
19041
19020
  var r = t[0], s = t[1], o = !1;
19042
19021
  void 0 === n && (n = 0), void 0 === i && (i = e.length);
19043
19022
  for (var a = i - n, l = 0, h = a - 1; l < a; h = l++) {
@@ -19046,13 +19025,13 @@
19046
19025
  }
19047
19026
  return o;
19048
19027
  };
19049
- Rm.exports = function(t, e, n, i) {
19050
- return e.length > 0 && Array.isArray(e[0]) ? Hm(t, e, n, i) : Nm(t, e, n, i);
19028
+ Lm.exports = function(t, e, n, i) {
19029
+ return e.length > 0 && Array.isArray(e[0]) ? Nm(t, e, n, i) : Rm(t, e, n, i);
19051
19030
  };
19052
- var jm = Rm.exports.nested = Hm;
19053
- Rm.exports.flat = Nm;
19054
- const Vm = 11102230246251565e-32, Um = 134217729, Gm = (3 + 8 * Vm) * Vm;
19055
- function Wm(t, e, n, i, r) {
19031
+ var Hm = Lm.exports.nested = Nm;
19032
+ Lm.exports.flat = Rm;
19033
+ const jm = 11102230246251565e-32, Vm = 134217729, Um = (3 + 8 * jm) * jm;
19034
+ function Gm(t, e, n, i, r) {
19056
19035
  let s, o, a, l, h = e[0], u = i[0], c = 0, f = 0;
19057
19036
  u > h == u > -h ? (s = h, h = e[++c]) : (s = u, u = i[++f]);
19058
19037
  let d = 0;
@@ -19066,57 +19045,57 @@
19066
19045
  0 !== a && (r[d++] = a);
19067
19046
  return 0 === s && 0 !== d || (r[d++] = s), d;
19068
19047
  }
19069
- function Bm(t) {
19048
+ function Wm(t) {
19070
19049
  return new Float64Array(t);
19071
19050
  }
19072
- const $m = 33306690738754716e-32, Ym = 22204460492503146e-32, Xm = 11093356479670487e-47, qm = Bm(4), Jm = Bm(8), Km = Bm(12), Zm = Bm(16), Qm = Bm(4);
19073
- function tg(t, e, n, i, r, s) {
19051
+ const Bm = 33306690738754716e-32, $m = 22204460492503146e-32, Ym = 11093356479670487e-47, Xm = Wm(4), qm = Wm(8), Jm = Wm(12), Km = Wm(16), Zm = Wm(4);
19052
+ function Qm(t, e, n, i, r, s) {
19074
19053
  const o = (e - s) * (n - r), a = (t - r) * (i - s), l = o - a;
19075
19054
  if (0 === o || 0 === a || o > 0 != a > 0) return l;
19076
19055
  const h = Math.abs(o + a);
19077
- return Math.abs(l) >= $m * h ? l : -function(t, e, n, i, r, s, o) {
19056
+ return Math.abs(l) >= Bm * h ? l : -function(t, e, n, i, r, s, o) {
19078
19057
  let a, l, h, u, c, f, d, p, y, m, g, v, x, b, w, A, M, S;
19079
19058
  const _ = t - r, k = n - r, P = e - s, T = i - s;
19080
- b = _ * T, f = Um * _, d = f - (f - _), p = _ - d, f = Um * T, y = f - (f - T),
19081
- m = T - y, w = p * m - (b - d * y - p * y - d * m), A = P * k, f = Um * P, d = f - (f - P),
19082
- p = P - d, f = Um * k, y = f - (f - k), m = k - y, M = p * m - (A - d * y - p * y - d * m),
19083
- g = w - M, c = w - g, qm[0] = w - (g + c) + (c - M), v = b + g, c = v - b, x = b - (v - c) + (g - c),
19084
- g = x - A, c = x - g, qm[1] = x - (g + c) + (c - A), S = v + g, c = S - v, qm[2] = v - (S - c) + (g - c),
19085
- qm[3] = S;
19059
+ b = _ * T, f = Vm * _, d = f - (f - _), p = _ - d, f = Vm * T, y = f - (f - T),
19060
+ m = T - y, w = p * m - (b - d * y - p * y - d * m), A = P * k, f = Vm * P, d = f - (f - P),
19061
+ p = P - d, f = Vm * k, y = f - (f - k), m = k - y, M = p * m - (A - d * y - p * y - d * m),
19062
+ g = w - M, c = w - g, Xm[0] = w - (g + c) + (c - M), v = b + g, c = v - b, x = b - (v - c) + (g - c),
19063
+ g = x - A, c = x - g, Xm[1] = x - (g + c) + (c - A), S = v + g, c = S - v, Xm[2] = v - (S - c) + (g - c),
19064
+ Xm[3] = S;
19086
19065
  let I = function(t, e) {
19087
19066
  let n = e[0];
19088
19067
  for (let i = 1; i < t; i++) n += e[i];
19089
19068
  return n;
19090
- }(4, qm), F = Ym * o;
19069
+ }(4, Xm), F = $m * o;
19091
19070
  if (I >= F || -I >= F) return I;
19092
19071
  if (c = t - _, a = t - (_ + c) + (c - r), c = n - k, h = n - (k + c) + (c - r),
19093
19072
  c = e - P, l = e - (P + c) + (c - s), c = i - T, u = i - (T + c) + (c - s), 0 === a && 0 === l && 0 === h && 0 === u) return I;
19094
- if (F = Xm * o + Gm * Math.abs(I), I += _ * u + T * a - (P * h + k * l), I >= F || -I >= F) return I;
19095
- b = a * T, f = Um * a, d = f - (f - a), p = a - d, f = Um * T, y = f - (f - T),
19096
- m = T - y, w = p * m - (b - d * y - p * y - d * m), A = l * k, f = Um * l, d = f - (f - l),
19097
- p = l - d, f = Um * k, y = f - (f - k), m = k - y, M = p * m - (A - d * y - p * y - d * m),
19098
- g = w - M, c = w - g, Qm[0] = w - (g + c) + (c - M), v = b + g, c = v - b, x = b - (v - c) + (g - c),
19099
- g = x - A, c = x - g, Qm[1] = x - (g + c) + (c - A), S = v + g, c = S - v, Qm[2] = v - (S - c) + (g - c),
19100
- Qm[3] = S;
19101
- const O = Wm(4, qm, 4, Qm, Jm);
19102
- b = _ * u, f = Um * _, d = f - (f - _), p = _ - d, f = Um * u, y = f - (f - u),
19103
- m = u - y, w = p * m - (b - d * y - p * y - d * m), A = P * h, f = Um * P, d = f - (f - P),
19104
- p = P - d, f = Um * h, y = f - (f - h), m = h - y, M = p * m - (A - d * y - p * y - d * m),
19105
- g = w - M, c = w - g, Qm[0] = w - (g + c) + (c - M), v = b + g, c = v - b, x = b - (v - c) + (g - c),
19106
- g = x - A, c = x - g, Qm[1] = x - (g + c) + (c - A), S = v + g, c = S - v, Qm[2] = v - (S - c) + (g - c),
19107
- Qm[3] = S;
19108
- const C = Wm(O, Jm, 4, Qm, Km);
19109
- b = a * u, f = Um * a, d = f - (f - a), p = a - d, f = Um * u, y = f - (f - u),
19110
- m = u - y, w = p * m - (b - d * y - p * y - d * m), A = l * h, f = Um * l, d = f - (f - l),
19111
- p = l - d, f = Um * h, y = f - (f - h), m = h - y, M = p * m - (A - d * y - p * y - d * m),
19112
- g = w - M, c = w - g, Qm[0] = w - (g + c) + (c - M), v = b + g, c = v - b, x = b - (v - c) + (g - c),
19113
- g = x - A, c = x - g, Qm[1] = x - (g + c) + (c - A), S = v + g, c = S - v, Qm[2] = v - (S - c) + (g - c),
19114
- Qm[3] = S;
19115
- const E = Wm(C, Km, 4, Qm, Zm);
19116
- return Zm[E - 1];
19073
+ if (F = Ym * o + Um * Math.abs(I), I += _ * u + T * a - (P * h + k * l), I >= F || -I >= F) return I;
19074
+ b = a * T, f = Vm * a, d = f - (f - a), p = a - d, f = Vm * T, y = f - (f - T),
19075
+ m = T - y, w = p * m - (b - d * y - p * y - d * m), A = l * k, f = Vm * l, d = f - (f - l),
19076
+ p = l - d, f = Vm * k, y = f - (f - k), m = k - y, M = p * m - (A - d * y - p * y - d * m),
19077
+ g = w - M, c = w - g, Zm[0] = w - (g + c) + (c - M), v = b + g, c = v - b, x = b - (v - c) + (g - c),
19078
+ g = x - A, c = x - g, Zm[1] = x - (g + c) + (c - A), S = v + g, c = S - v, Zm[2] = v - (S - c) + (g - c),
19079
+ Zm[3] = S;
19080
+ const O = Gm(4, Xm, 4, Zm, qm);
19081
+ b = _ * u, f = Vm * _, d = f - (f - _), p = _ - d, f = Vm * u, y = f - (f - u),
19082
+ m = u - y, w = p * m - (b - d * y - p * y - d * m), A = P * h, f = Vm * P, d = f - (f - P),
19083
+ p = P - d, f = Vm * h, y = f - (f - h), m = h - y, M = p * m - (A - d * y - p * y - d * m),
19084
+ g = w - M, c = w - g, Zm[0] = w - (g + c) + (c - M), v = b + g, c = v - b, x = b - (v - c) + (g - c),
19085
+ g = x - A, c = x - g, Zm[1] = x - (g + c) + (c - A), S = v + g, c = S - v, Zm[2] = v - (S - c) + (g - c),
19086
+ Zm[3] = S;
19087
+ const C = Gm(O, qm, 4, Zm, Jm);
19088
+ b = a * u, f = Vm * a, d = f - (f - a), p = a - d, f = Vm * u, y = f - (f - u),
19089
+ m = u - y, w = p * m - (b - d * y - p * y - d * m), A = l * h, f = Vm * l, d = f - (f - l),
19090
+ p = l - d, f = Vm * h, y = f - (f - h), m = h - y, M = p * m - (A - d * y - p * y - d * m),
19091
+ g = w - M, c = w - g, Zm[0] = w - (g + c) + (c - M), v = b + g, c = v - b, x = b - (v - c) + (g - c),
19092
+ g = x - A, c = x - g, Zm[1] = x - (g + c) + (c - A), S = v + g, c = S - v, Zm[2] = v - (S - c) + (g - c),
19093
+ Zm[3] = S;
19094
+ const E = Gm(C, Jm, 4, Zm, Km);
19095
+ return Km[E - 1];
19117
19096
  }(t, e, n, i, r, s, h);
19118
19097
  }
19119
- function eg(t, e, n) {
19098
+ function tg(t, e, n) {
19120
19099
  e = Math.max(0, void 0 === e ? 2 : e), n = n || 0;
19121
19100
  var i = function(t) {
19122
19101
  for (var e = t[0], n = t[0], i = t[0], r = t[0], s = 0; s < t.length; s++) {
@@ -19124,20 +19103,20 @@
19124
19103
  o[0] < e[0] && (e = o), o[0] > i[0] && (i = o), o[1] < n[1] && (n = o), o[1] > r[1] && (r = o);
19125
19104
  }
19126
19105
  var a = [ e, n, i, r ], l = a.slice();
19127
- for (s = 0; s < t.length; s++) jm(t[s], a) || l.push(t[s]);
19106
+ for (s = 0; s < t.length; s++) Hm(t[s], a) || l.push(t[s]);
19128
19107
  return function(t) {
19129
- t.sort(dg);
19108
+ t.sort(fg);
19130
19109
  for (var e = [], n = 0; n < t.length; n++) {
19131
- for (;e.length >= 2 && ag(e[e.length - 2], e[e.length - 1], t[n]) <= 0; ) e.pop();
19110
+ for (;e.length >= 2 && og(e[e.length - 2], e[e.length - 1], t[n]) <= 0; ) e.pop();
19132
19111
  e.push(t[n]);
19133
19112
  }
19134
19113
  for (var i = [], r = t.length - 1; r >= 0; r--) {
19135
- for (;i.length >= 2 && ag(i[i.length - 2], i[i.length - 1], t[r]) <= 0; ) i.pop();
19114
+ for (;i.length >= 2 && og(i[i.length - 2], i[i.length - 1], t[r]) <= 0; ) i.pop();
19136
19115
  i.push(t[r]);
19137
19116
  }
19138
19117
  return i.pop(), e.pop(), e.concat(i);
19139
19118
  }(l);
19140
- }(t), r = new Am(16);
19119
+ }(t), r = new wm(16);
19141
19120
  r.toBBox = function(t) {
19142
19121
  return {
19143
19122
  minX: t[0],
@@ -19152,16 +19131,16 @@
19152
19131
  }, r.load(t);
19153
19132
  for (var s, o = [], a = 0; a < i.length; a++) {
19154
19133
  var l = i[a];
19155
- r.remove(l), s = hg(l, s), o.push(s);
19134
+ r.remove(l), s = lg(l, s), o.push(s);
19156
19135
  }
19157
- var h = new Am(16);
19158
- for (a = 0; a < o.length; a++) h.insert(lg(o[a]));
19136
+ var h = new wm(16);
19137
+ for (a = 0; a < o.length; a++) h.insert(ag(o[a]));
19159
19138
  for (var u = e * e, c = n * n; o.length; ) {
19160
- var f = o.shift(), d = f.p, p = f.next.p, y = ug(d, p);
19139
+ var f = o.shift(), d = f.p, p = f.next.p, y = hg(d, p);
19161
19140
  if (!(y < c)) {
19162
19141
  var m = y / u;
19163
- (l = ng(r, f.prev.p, d, p, f.next.next.p, m, h)) && Math.min(ug(l, d), ug(l, p)) <= m && (o.push(f),
19164
- o.push(hg(l, f)), r.remove(l), h.remove(f), h.insert(lg(f)), h.insert(lg(f.next)));
19142
+ (l = eg(r, f.prev.p, d, p, f.next.next.p, m, h)) && Math.min(hg(l, d), hg(l, p)) <= m && (o.push(f),
19143
+ o.push(lg(l, f)), r.remove(l), h.remove(f), h.insert(ag(f)), h.insert(ag(f.next)));
19165
19144
  }
19166
19145
  }
19167
19146
  f = s;
@@ -19171,58 +19150,58 @@
19171
19150
  } while (f !== s);
19172
19151
  return g.push(f.p), g;
19173
19152
  }
19174
- function ng(t, e, n, i, r, s, o) {
19175
- for (var a = new Nt([], ig), l = t.data; l; ) {
19153
+ function eg(t, e, n, i, r, s, o) {
19154
+ for (var a = new Nt([], ng), l = t.data; l; ) {
19176
19155
  for (var h = 0; h < l.children.length; h++) {
19177
- var u = l.children[h], c = l.leaf ? cg(u, n, i) : rg(n, i, u);
19156
+ var u = l.children[h], c = l.leaf ? ug(u, n, i) : ig(n, i, u);
19178
19157
  c > s || a.push({
19179
19158
  node: u,
19180
19159
  dist: c
19181
19160
  });
19182
19161
  }
19183
19162
  for (;a.length && !a.peek().node.children; ) {
19184
- var f = a.pop(), d = f.node, p = cg(d, e, n), y = cg(d, i, r);
19185
- if (f.dist < p && f.dist < y && og(n, d, o) && og(i, d, o)) return d;
19163
+ var f = a.pop(), d = f.node, p = ug(d, e, n), y = ug(d, i, r);
19164
+ if (f.dist < p && f.dist < y && sg(n, d, o) && sg(i, d, o)) return d;
19186
19165
  }
19187
19166
  (l = a.pop()) && (l = l.node);
19188
19167
  }
19189
19168
  return null;
19190
19169
  }
19191
- function ig(t, e) {
19170
+ function ng(t, e) {
19192
19171
  return t.dist - e.dist;
19193
19172
  }
19194
- function rg(t, e, n) {
19195
- if (sg(t, n) || sg(e, n)) return 0;
19196
- var i = fg(t[0], t[1], e[0], e[1], n.minX, n.minY, n.maxX, n.minY);
19173
+ function ig(t, e, n) {
19174
+ if (rg(t, n) || rg(e, n)) return 0;
19175
+ var i = cg(t[0], t[1], e[0], e[1], n.minX, n.minY, n.maxX, n.minY);
19197
19176
  if (0 === i) return 0;
19198
- var r = fg(t[0], t[1], e[0], e[1], n.minX, n.minY, n.minX, n.maxY);
19177
+ var r = cg(t[0], t[1], e[0], e[1], n.minX, n.minY, n.minX, n.maxY);
19199
19178
  if (0 === r) return 0;
19200
- var s = fg(t[0], t[1], e[0], e[1], n.maxX, n.minY, n.maxX, n.maxY);
19179
+ var s = cg(t[0], t[1], e[0], e[1], n.maxX, n.minY, n.maxX, n.maxY);
19201
19180
  if (0 === s) return 0;
19202
- var o = fg(t[0], t[1], e[0], e[1], n.minX, n.maxY, n.maxX, n.maxY);
19181
+ var o = cg(t[0], t[1], e[0], e[1], n.minX, n.maxY, n.maxX, n.maxY);
19203
19182
  return 0 === o ? 0 : Math.min(i, r, s, o);
19204
19183
  }
19205
- function sg(t, e) {
19184
+ function rg(t, e) {
19206
19185
  return t[0] >= e.minX && t[0] <= e.maxX && t[1] >= e.minY && t[1] <= e.maxY;
19207
19186
  }
19208
- function og(t, e, n) {
19187
+ function sg(t, e, n) {
19209
19188
  for (var i, r, s, o, a = Math.min(t[0], e[0]), l = Math.min(t[1], e[1]), h = Math.max(t[0], e[0]), u = Math.max(t[1], e[1]), c = n.search({
19210
19189
  minX: a,
19211
19190
  minY: l,
19212
19191
  maxX: h,
19213
19192
  maxY: u
19214
- }), f = 0; f < c.length; f++) if (i = c[f].p, r = c[f].next.p, s = t, i !== (o = e) && r !== s && ag(i, r, s) > 0 != ag(i, r, o) > 0 && ag(s, o, i) > 0 != ag(s, o, r) > 0) return !1;
19193
+ }), f = 0; f < c.length; f++) if (i = c[f].p, r = c[f].next.p, s = t, i !== (o = e) && r !== s && og(i, r, s) > 0 != og(i, r, o) > 0 && og(s, o, i) > 0 != og(s, o, r) > 0) return !1;
19215
19194
  return !0;
19216
19195
  }
19217
- function ag(t, e, n) {
19218
- return tg(t[0], t[1], e[0], e[1], n[0], n[1]);
19196
+ function og(t, e, n) {
19197
+ return Qm(t[0], t[1], e[0], e[1], n[0], n[1]);
19219
19198
  }
19220
- function lg(t) {
19199
+ function ag(t) {
19221
19200
  var e = t.p, n = t.next.p;
19222
19201
  return t.minX = Math.min(e[0], n[0]), t.minY = Math.min(e[1], n[1]), t.maxX = Math.max(e[0], n[0]),
19223
19202
  t.maxY = Math.max(e[1], n[1]), t;
19224
19203
  }
19225
- function hg(t, e) {
19204
+ function lg(t, e) {
19226
19205
  var n = {
19227
19206
  p: t,
19228
19207
  prev: null,
@@ -19235,11 +19214,11 @@
19235
19214
  return e ? (n.next = e.next, n.prev = e, e.next.prev = n, e.next = n) : (n.prev = n,
19236
19215
  n.next = n), n;
19237
19216
  }
19238
- function ug(t, e) {
19217
+ function hg(t, e) {
19239
19218
  var n = t[0] - e[0], i = t[1] - e[1];
19240
19219
  return n * n + i * i;
19241
19220
  }
19242
- function cg(t, e, n) {
19221
+ function ug(t, e, n) {
19243
19222
  var i = e[0], r = e[1], s = n[0] - i, o = n[1] - r;
19244
19223
  if (0 !== s || 0 !== o) {
19245
19224
  var a = ((t[0] - i) * s + (t[1] - r) * o) / (s * s + o * o);
@@ -19247,7 +19226,7 @@
19247
19226
  }
19248
19227
  return (s = t[0] - i) * s + (o = t[1] - r) * o;
19249
19228
  }
19250
- function fg(t, e, n, i, r, s, o, a) {
19229
+ function cg(t, e, n, i, r, s, o, a) {
19251
19230
  var l, h, u, c, f = n - t, d = i - e, p = o - r, y = a - s, m = t - r, g = e - s, v = f * f + d * d, x = f * p + d * y, b = p * p + y * y, w = f * m + d * g, A = p * m + y * g, M = v * b - x * x, S = M, _ = M;
19252
19231
  0 === M ? (h = 0, S = 1, c = A, _ = b) : (c = v * A - x * w, (h = x * A - b * w) < 0 ? (h = 0,
19253
19232
  c = A, _ = b) : h > S && (h = S, c = A + x, _ = b)), c < 0 ? (c = 0, -w < 0 ? h = 0 : -w > v ? h = S : (h = -w,
@@ -19256,15 +19235,15 @@
19256
19235
  var k = (1 - (u = 0 === c ? 0 : c / _)) * r + u * o - ((1 - (l = 0 === h ? 0 : h / S)) * t + l * n), P = (1 - u) * s + u * a - ((1 - l) * e + l * i);
19257
19236
  return k * k + P * P;
19258
19237
  }
19259
- function dg(t, e) {
19238
+ function fg(t, e) {
19260
19239
  return t[0] === e[0] ? t[1] - e[1] : t[0] - e[0];
19261
19240
  }
19262
- class pg {
19241
+ class dg {
19263
19242
  constructor(t, e) {
19264
19243
  this.x = t, this.y = e;
19265
19244
  }
19266
19245
  clone() {
19267
- return new pg(this.x, this.y);
19246
+ return new dg(this.x, this.y);
19268
19247
  }
19269
19248
  normalize() {
19270
19249
  const t = this.length();
@@ -19277,7 +19256,7 @@
19277
19256
  return Math.sqrt(this.x * this.x + this.y * this.y);
19278
19257
  }
19279
19258
  diff(t) {
19280
- return new pg(this.x - t.x, this.y - t.y);
19259
+ return new dg(this.x - t.x, this.y - t.y);
19281
19260
  }
19282
19261
  distance(t) {
19283
19262
  const e = this.x - t.x, n = this.y - t.y;
@@ -19290,48 +19269,48 @@
19290
19269
  return this.x === t.x && this.y === t.y;
19291
19270
  }
19292
19271
  orthogonal() {
19293
- return new pg(this.y, -this.x);
19272
+ return new dg(this.y, -this.x);
19294
19273
  }
19295
19274
  }
19296
- function yg(t, e, n, i) {
19275
+ function pg(t, e, n, i) {
19297
19276
  const r = e.x * i.y - e.y * i.x, s = n.x - t.x, o = n.y - t.y, a = (s * i.y - o * i.x) / r;
19298
- return new pg(t.x + a * e.x, t.y + a * e.y);
19277
+ return new dg(t.x + a * e.x, t.y + a * e.y);
19299
19278
  }
19300
- const mg = [], gg = [];
19301
- function vg(t) {
19279
+ const yg = [], mg = [];
19280
+ function gg(t) {
19302
19281
  if (Kl(t[0] && t[0].x)) {
19303
19282
  const e = [];
19304
19283
  let n = 0;
19305
- for (let i = 0; i < t.length; i++) gg[n] ? (gg[n][0] = t[i].x, gg[n][1] = t[i].y) : gg[n] = [ t[i].x, t[i].y ],
19306
- e.push(gg[n]), n++;
19284
+ for (let i = 0; i < t.length; i++) mg[n] ? (mg[n][0] = t[i].x, mg[n][1] = t[i].y) : mg[n] = [ t[i].x, t[i].y ],
19285
+ e.push(mg[n]), n++;
19307
19286
  t = e;
19308
19287
  }
19309
19288
  try {
19310
- const e = eg(t, 1 / 0);
19289
+ const e = tg(t, 1 / 0);
19311
19290
  let n = [ 1 / 0, 1 / 0 ], i = [ -1 / 0, -1 / 0 ];
19312
19291
  for (let t = 0; t < e.length; t++) e[t][0] < n[0] && (n[0] = e[t][0]), e[t][0] > i[0] && (i[0] = e[t][0]),
19313
19292
  e[t][1] < n[1] && (n[1] = e[t][1]), e[t][1] > i[1] && (i[1] = e[t][1]);
19314
19293
  const r = [];
19315
19294
  let s = [], o = 0;
19316
- for (let t = 0; t < e.length; t++) t === e.length - 1 && e[t][0] === e[0][0] && e[t][1] === e[0][1] || (am(r, e[t]),
19317
- mg[o] ? (mg[o].x = r[0], mg[o].y = r[1]) : mg[o] = new pg(r[0], r[1]), s.push(mg[o]),
19295
+ for (let t = 0; t < e.length; t++) t === e.length - 1 && e[t][0] === e[0][0] && e[t][1] === e[0][1] || (om(r, e[t]),
19296
+ yg[o] ? (yg[o].x = r[0], yg[o].y = r[1]) : yg[o] = new dg(r[0], r[1]), s.push(yg[o]),
19318
19297
  o++);
19319
19298
  ul.calculateSignedArea(s) < 0 && (s = s.reverse());
19320
19299
  const a = function(t) {
19321
19300
  let e, n = Number.MAX_VALUE;
19322
19301
  const i = function(t, i, r, s, o, a, l, h) {
19323
- var u = yg(t, i, o, a), c = yg(r, s, o, a), f = yg(l, h, t, i), d = yg(l, h, r, s), p = u.distance(c) * u.distance(f);
19302
+ var u = pg(t, i, o, a), c = pg(r, s, o, a), f = pg(l, h, t, i), d = pg(l, h, r, s), p = u.distance(c) * u.distance(f);
19324
19303
  0 !== p && p < n && (e = [ u, f, d, c ], n = p);
19325
19304
  };
19326
19305
  var r = [];
19327
19306
  for (let e = 0; e < t.length; e++) r.push(t[(e + 1) % t.length].diff(t[e])), r[e].normalize();
19328
- var s, o, a, l, h = new pg(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY), u = new pg(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY);
19307
+ var s, o, a, l, h = new dg(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY), u = new dg(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY);
19329
19308
  for (let e = 0; e < t.length; e++) {
19330
19309
  var c = t[e];
19331
19310
  c.x < h.x && (h.x = c.x, s = e), c.x > u.x && (u.x = c.x, o = e), c.y < h.y && (h.y = c.y,
19332
19311
  l = e), c.y > u.y && (u.y = c.y, a = e);
19333
19312
  }
19334
- var f = new pg(0, -1), d = new pg(0, 1), p = new pg(-1, 0), y = new pg(1, 0);
19313
+ var f = new dg(0, -1), d = new dg(0, 1), p = new dg(-1, 0), y = new dg(1, 0);
19335
19314
  for (let e = 0; e < t.length; e++) {
19336
19315
  var m = [ Math.acos(f.dot(r[s])), Math.acos(d.dot(r[o])), Math.acos(p.dot(r[a])), Math.acos(y.dot(r[l])) ];
19337
19316
  switch (m.indexOf(Math.min.apply(Math, m))) {
@@ -19365,9 +19344,9 @@
19365
19344
  return null;
19366
19345
  }
19367
19346
  }
19368
- class xg extends gu {
19347
+ class vg extends gu {
19369
19348
  static fromJSON(t) {
19370
- return qy(t, "ExtrudePolygonLayer", xg);
19349
+ return Xy(t, "ExtrudePolygonLayer", vg);
19371
19350
  }
19372
19351
  getPolygonOffsetCount() {
19373
19352
  return 0;
@@ -19399,11 +19378,11 @@
19399
19378
  return n && n.updateDataConfig(t, e), this;
19400
19379
  }
19401
19380
  }
19402
- xg.registerJSONType("ExtrudePolygonLayer"), xg.mergeOptions({
19381
+ vg.registerJSONType("ExtrudePolygonLayer"), vg.mergeOptions({
19403
19382
  cullFace: !1,
19404
19383
  castShadow: !0
19405
19384
  });
19406
- const bg = {
19385
+ const xg = {
19407
19386
  polygonFill: {
19408
19387
  type: "identity",
19409
19388
  default: [ 1, 1, 1, 1 ],
@@ -19424,10 +19403,10 @@
19424
19403
  default: [ 1, 1, 1, 1 ],
19425
19404
  property: "_symbol_bottomPolygonFill"
19426
19405
  }
19427
- }, wg = {
19406
+ }, bg = {
19428
19407
  defaultAltitude: 20
19429
- }, Ag = t => 1 === t.properties.top;
19430
- xg.registerRenderer("gl", class extends em {
19408
+ }, wg = t => 1 === t.properties.top;
19409
+ vg.registerRenderer("gl", class extends tm {
19431
19410
  constructor(...t) {
19432
19411
  super(...t), this.GeometryTypes = [ r.Polygon, r.MultiPolygon ];
19433
19412
  }
@@ -19464,8 +19443,8 @@
19464
19443
  }
19465
19444
  createPainter() {
19466
19445
  const t = gu.get3DPainterClass("lit");
19467
- this.painterSymbol = ql({}, bg), this.sidePainterSymbol = ql({}, bg), this.Hl(this.painterSymbol, t.getBloomSymbol());
19468
- const e = this.layer, n = ql({}, wg, e.options.dataConfig || {});
19446
+ this.painterSymbol = ql({}, xg), this.sidePainterSymbol = ql({}, xg), this.Hl(this.painterSymbol, t.getBloomSymbol());
19447
+ const e = this.layer, n = ql({}, bg, e.options.dataConfig || {});
19469
19448
  e.options.material && (this.painterSymbol.material = e.options.material), e.options.sideMaterial ? this.sidePainterSymbol.material = e.options.sideMaterial : this.sidePainterSymbol.material = e.options.material;
19470
19449
  const i = {
19471
19450
  cullFace: e.options.cullFace
@@ -19490,9 +19469,9 @@
19490
19469
  }
19491
19470
  il(...t) {
19492
19471
  const e = t[0], n = e.sceneFilter;
19493
- e.sceneFilter = t => (!n || n(t)) && Ag(t);
19472
+ e.sceneFilter = t => (!n || n(t)) && wg(t);
19494
19473
  const i = super.il(...t);
19495
- e.sceneFilter = t => (!n || n(t)) && Ag(t);
19474
+ e.sceneFilter = t => (!n || n(t)) && wg(t);
19496
19475
  const r = this.painter;
19497
19476
  this.painter = this.sidePainter;
19498
19477
  const s = e.sceneFilter = t => (!n || n(t)) && (t => 1 === t.properties.side)(t);
@@ -19517,15 +19496,15 @@
19517
19496
  }
19518
19497
  oh(t, e, n, i) {
19519
19498
  const s = this.getMap();
19520
- e = bg;
19521
- const o = this.sh, a = 1 / 0, l = s.getZoom(), h = new r.Point(0, 0), u = new r.Coordinate(0, 0), c = ql({}, wg, this.layer.options.dataConfig);
19499
+ e = xg;
19500
+ const o = this.sh, a = 1 / 0, l = s.getZoom(), h = new r.Point(0, 0), u = new r.Coordinate(0, 0), c = ql({}, bg, this.layer.options.dataConfig);
19522
19501
  if (c.uv = !0, c.top && (c.top = n), c.side && (c.side = i), !1 === c.top && !1 === c.side) return null;
19523
19502
  if (!t.length) return null;
19524
19503
  const f = s.getGLRes(), d = s.getProjection().code, p = n ? this.painterSymbol && this.painterSymbol.material : this.sidePainterSymbol && this.sidePainterSymbol.material, y = p && p.textureWidth || 23.25, m = [ Bh(s, 1, u, f) / 100, Bh(s, 1, u, f, 1) / 100 ];
19525
- return ym(t, c, a, h, y, s.getGLRes(), 1, 1, m, this.rn, e, l, d, undefined, Float32Array, o);
19504
+ return pm(t, c, a, h, y, s.getGLRes(), 1, 1, m, this.rn, e, l, d, undefined, Float32Array, o);
19526
19505
  }
19527
19506
  updateMesh(t) {
19528
- const e = t[Fy];
19507
+ const e = t[Iy];
19529
19508
  let n = this.features[e];
19530
19509
  if (!n || !this.meshes) return;
19531
19510
  const i = this.oh([ n ], this.painterSymbol, !0, !1);
@@ -19541,11 +19520,11 @@
19541
19520
  const n = [];
19542
19521
  for (let t = 0; t < e.length; t++) {
19543
19522
  const i = e[t] && e[t][0];
19544
- n[t] = vg(i);
19523
+ n[t] = gg(i);
19545
19524
  }
19546
19525
  t.getProperties()[wh] = n;
19547
19526
  } else {
19548
- const n = vg(e[0]);
19527
+ const n = gg(e[0]);
19549
19528
  t.getProperties()[wh] = n;
19550
19529
  }
19551
19530
  }
@@ -19564,7 +19543,7 @@
19564
19543
  getShadowMeshes() {
19565
19544
  return this.painter ? this.painter.getShadowMeshes() : [];
19566
19545
  }
19567
- }), xg.registerRenderer("canvas", null), n.reshader.ShaderLib.register("vt_position_vert", "#ifdef HAS_TERRAIN_ALTITUDE\n attribute float aTerrainAltitude;\n#endif\nuniform float minAltitude;\n#ifdef HAS_ALTITUDE\n vec3 unpackVTPosition() {\n float altitude = aAltitude;\n #ifdef HAS_TERRAIN_ALTITUDE\n altitude += aTerrainAltitude * 100.0;\n #endif\n altitude += minAltitude * 100.0;\n return vec3(aPosition, altitude);\n }\n#else\n float position_modValue = 16384.0;\n float position_delta = 0.00001;\n vec3 unpackVTPosition() {\n float z = aPosition.z;\n vec2 pos = sign(aPosition.xy + position_delta) * mod(abs(aPosition.xy), position_modValue);\n vec2 highs = floor(abs(aPosition.xy) / position_modValue);\n float altitude = sign(z + position_delta) * (highs.x * 2.0 + highs.y) * pow(2.0, 15.0) + z;\n #ifdef HAS_TERRAIN_ALTITUDE\n altitude += aTerrainAltitude * 100.0;\n #endif\n altitude += minAltitude * 100.0;\n return vec3(pos, altitude);\n }\n#endif");
19546
+ }), vg.registerRenderer("canvas", null), n.reshader.ShaderLib.register("vt_position_vert", "#ifdef HAS_TERRAIN_ALTITUDE\n attribute float aTerrainAltitude;\n#endif\nuniform float minAltitude;\n#ifdef HAS_ALTITUDE\n vec3 unpackVTPosition() {\n float altitude = aAltitude;\n #ifdef HAS_TERRAIN_ALTITUDE\n altitude += aTerrainAltitude * 100.0;\n #endif\n altitude += minAltitude * 100.0;\n return vec3(aPosition, altitude);\n }\n#else\n float position_modValue = 16384.0;\n float position_delta = 0.00001;\n vec3 unpackVTPosition() {\n float z = aPosition.z;\n vec2 pos = sign(aPosition.xy + position_delta) * mod(abs(aPosition.xy), position_modValue);\n vec2 highs = floor(abs(aPosition.xy) / position_modValue);\n float altitude = sign(z + position_delta) * (highs.x * 2.0 + highs.y) * pow(2.0, 15.0) + z;\n #ifdef HAS_TERRAIN_ALTITUDE\n altitude += aTerrainAltitude * 100.0;\n #endif\n altitude += minAltitude * 100.0;\n return vec3(pos, altitude);\n }\n#endif");
19568
19547
  if (s.mat4.create(), s.transcoders) {
19569
19548
  const t = r.Map.VERSION;
19570
19549
  if (t.indexOf("1.0.0-beta") >= 0 || t.indexOf("1.0.0-alpha") >= 0) {
@@ -19574,15 +19553,15 @@
19574
19553
  return s.transcoders.inject(a);
19575
19554
  }));
19576
19555
  } else r.registerWorkerAdapter("@maptalks/vt", a);
19577
- t.ExtrudePolygonLayer = xg, t.FillPainter = Rc, t.FillPlugin = oy, t.FilterUtil = bo,
19578
- t.GLTFPhongPlugin = my, t.GLTFStandardPlugin = gy, t.GeoJSONVectorTileLayer = Ay,
19579
- t.HeatmapPlugin = vy, t.IconPainter = Md, t.IconPlugin = hy, t.LineGradientPlugin = ly,
19580
- t.LinePainter = Vc, t.LinePlugin = ay, t.LineStringLayer = Ky, t.LitPlugin = py,
19581
- t.MapboxVectorTileLayer = by, t.NativeLinePainter = mp, t.NativeLinePlugin = cy,
19582
- t.NativePointPainter = dp, t.PackUtil = ul, t.PhongPainter = Ip, t.PhongPlugin = fy,
19583
- t.PointLayer = Jy, t.PolygonLayer = Qy, t.SYMBOLS_NEED_REBUILD_IN_VECTOR = jl, t.SYMBOLS_NEED_REBUILD_IN_VT = Hl,
19584
- t.TextPainter = lp, t.TextPlugin = uy, t.TubePlugin = yy, t.Vector3DLayer = gu,
19585
- t.VectorTileLayer = hu, t.VectorTileLayerRenderer = Zh, t.WaterPlugin = xy, t.WireframePainter = Op,
19586
- t.WireframePlugin = dy, "undefined" != typeof console && console.log("@maptalks/vt v0.96.0");
19556
+ t.ExtrudePolygonLayer = vg, t.FillPainter = Rc, t.FillPlugin = sy, t.FilterUtil = bo,
19557
+ t.GLTFPhongPlugin = yy, t.GLTFStandardPlugin = my, t.GeoJSONVectorTileLayer = wy,
19558
+ t.HeatmapPlugin = gy, t.IconPainter = Ad, t.IconPlugin = ly, t.LineGradientPlugin = ay,
19559
+ t.LinePainter = Vc, t.LinePlugin = oy, t.LineStringLayer = Jy, t.LitPlugin = dy,
19560
+ t.MapboxVectorTileLayer = xy, t.NativeLinePainter = yp, t.NativeLinePlugin = uy,
19561
+ t.NativePointPainter = fp, t.PackUtil = ul, t.PhongPainter = Tp, t.PhongPlugin = cy,
19562
+ t.PointLayer = qy, t.PolygonLayer = Zy, t.SYMBOLS_NEED_REBUILD_IN_VECTOR = jl, t.SYMBOLS_NEED_REBUILD_IN_VT = Hl,
19563
+ t.TextPainter = ap, t.TextPlugin = hy, t.TubePlugin = py, t.Vector3DLayer = gu,
19564
+ t.VectorTileLayer = hu, t.VectorTileLayerRenderer = Zh, t.WaterPlugin = vy, t.WireframePainter = Fp,
19565
+ t.WireframePlugin = fy, "undefined" != typeof console && console.log("@maptalks/vt v0.96.2");
19587
19566
  }));
19588
19567
  //# sourceMappingURL=maptalks.vt.js.map