@maptalks/vt 0.118.1 → 0.119.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * @maptalks/vt v0.118.1
2
+ * @maptalks/vt v0.119.0
3
3
  * LICENSE : undefined
4
- * (c) 2016-2025 maptalks.org
4
+ * (c) 2016-2026 maptalks.org
5
5
  */
6
6
  import * as e from "maptalks";
7
7
 
@@ -23,7 +23,7 @@ import { createFilter as R } from "@maptalks/feature-filter";
23
23
 
24
24
  import F from "@maptalks/vt-plugin";
25
25
 
26
- import { vec2 as E, vec3 as D, vec4 as H } from "gl-matrix";
26
+ import { vec2 as E, vec3 as H, vec4 as D } from "gl-matrix";
27
27
 
28
28
  import L from "earcut";
29
29
 
@@ -31,7 +31,7 @@ import { buildNormals as N, buildTangents as z, packTangentFrame as V } from "@m
31
31
 
32
32
  import U from "rbush";
33
33
 
34
- const G = "${", B = `function(t){let e;const n={width:100,height:10};let r=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),r=!0}catch(t){r=!1}function i(){if(!e){const{width:t,height:i}=n;r?e=new OffscreenCanvas(t,i):(e=document.createElement("canvas"),e.width=t,e.height=i)}return e}class o{constructor(t,e={}){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 e=0,n=t.length;e<n;e++){const n=t[e][0];r=Math.min(n,r),i=Math.max(n,i)}this.min=r,this.max=i,this.valueOffset=this.max-this.min,this.options=Object.assign({},n,e),this._initImgData()}getImageData(){return this.imgData}_initImgData(){const t=i(),{width:e,height:n}=this.options;t.width=e,t.height=n;const r=t.getContext("2d");r.clearRect(0,0,t.width,t.height);const o=r.createLinearGradient(0,0,t.width,0),{colors:s,valueOffset:a}=this;for(let t=0,e=s.length;t<e;t++){const[e,n]=s[t],r=(e-this.min)/a;o.addColorStop(r,n)}r.fillStyle=o,r.fillRect(0,0,t.width,t.height),this.imgData=r.getImageData(0,0,t.width,t.height)}getColor(t){t=Math.max(this.min,t);const e=((t=Math.min(t,this.max))-this.min)/this.valueOffset;let n=Math.round(e*this.imgData.width);n=Math.min(n,this.imgData.width-1);const r=4*n;return[this.imgData.data[r],this.imgData.data[r+1],this.imgData.data[r+2],this.imgData.data[r+3]]}}var s;function a(t){return null==t}function l(t){return!a(t)}function u(t){return""===t}function h(t,e){var n,r,i;if(w(t)){var o,s=t.stops&&"object"==typeof t.stops[0][0],a=s||l(t.property),u=s||!a,d=t.type||e||"exponential";if("exponential"===d)o=p;else if("interval"===d)o=f;else if("categorical"===d)o=c;else if("identity"===d)o=y;else if("color-interpolate"===d)o=g;else{if("calculate-expression"!==d)throw new Error('Unknown function type "'+d+'"');o=x}if(s){var m={},v=[];for(let e=0;e<t.stops.length;e++){var b=t.stops[e];void 0===m[b[0].zoom]&&(m[b[0].zoom]={zoom:b[0].zoom,type:t.type,property:t.property,default:t.default,stops:[]}),m[b[0].zoom].stops.push([b[0].value,b[1]])}for(let t in m)v.push([m[t].zoom,h(m[t])]);n=function(e,n){const r=p({stops:v,base:t.base},e)(e,n);return"function"==typeof r?r(e,n):r},r=!1,i=!1}else u?(n=function(e){const n=o(t,e);return"function"==typeof n?n(e):n},r=!0,i=!1):(n=function(e,n){const r=o(t,n?n[t.property]:null);return"function"==typeof r?r(e,n):r},r=!1,i=!0)}else n=function(){return t},r=!0,i=!0;return n.isZoomConstant=i,n.isFeatureConstant=r,n}function c(t,e){for(let n=0;n<t.stops.length;n++)if(e===t.stops[n][0])return t.stops[n][1];return t.default}function f(t,e){for(var n=0;n<t.stops.length&&!(e<t.stops[n][0]);n++);return t.stops[Math.max(n-1,0)][1]}function p(t,e){for(var n=l(t.base)&&!u(t.base)?t.base:1,r=0;!(r>=t.stops.length||e<=t.stops[r][0]);)r++;return 0===r?t.stops[r][1]:r===t.stops.length?t.stops[r-1][1]:m(e,n,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 d={width:100,height:1};function g(t,e){const n=t.stops;if(n&&n.length>1){let t;if(s){const e=JSON.stringify(n);if(!s.has(e)){const t=new o(n,d);s.set(e,t)}t=s.get(e)}else t=new o(n,d);const[r,i,a,l]=t.getColor(e);return[r/255,i/255,a/255,l/255]}return n&&1===n.length?n[0][1]:null}function y(t,e){return n=e,r=t.default,l(n)?n:l(r)?r:l(i)?i:null;var n,r,i}function x(t,e){const n=String(t.property),r=t.expression,i=e;function o(e){return a(e)||u(e)||isNaN(e)?t.default:e}if(!l(e)||u(e)||isNaN(e)||e<0)return o(t.default);{const e=function t(e,n,r){const i=Number(r),o=String(n);return Array.isArray(e)?e.map((e=>t(e,o,i))):e===o?i:e}(r,n,i);return o(function e(n){if(!Array.isArray(n)){if("number"==typeof n)return n;throw new Error("Invalid expression format")}{const r=n[0];if(!["+","-","*","/"].includes(r))throw new Error(\`Unknown operator: ${G}r}\`);const i=n.slice(1).map((t=>e(t)));switch(r){case"+":return i.reduce(((t,e)=>t+e),0);case"-":return i.reduce(((t,e)=>t-e));case"*":return i.reduce(((t,e)=>t*e),1);case"/":return i.some((t=>0===t))?t.default:i.reduce(((t,e)=>t/e));default:throw new Error(\`Unsupported operator: ${G}r}\`)}}}(e))}}function m(t,e,n,r,i,o){return"function"==typeof i?function(){var s=i.apply(void 0,arguments),a=o.apply(void 0,arguments);return m(t,e,n,r,s,a)}:i.length?function(t,e,n,r,i,o){var s=[];for(let a=0;a<i.length;a++)s[a]=v(t,e,n,r,i[a],o[a]);return s}(t,e,n,r,i,o):v(t,e,n,r,i,o)}function v(t,e,n,r,i,o){var s,a=r-n,l=t-n;return i*(1-(s=1===e?l/a:(Math.pow(e,l)-1)/(Math.pow(e,a)-1)))+o*s}function w(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type||t.expression&&"calculate-expression"===t.type)}function b(t){return M(t,"interval")}function M(t,e){if(!w(t))return function(){return t};let n=!0,r=!0;const i=(t=JSON.parse(JSON.stringify(t))).stops;if(i)for(let t=0;t<i.length;t++)if(w(i[t][1])){const o=M(i[t][1],e);n=n&&o.isZoomConstant,r=r&&o.isFeatureConstant,i[t]=[i[t][0],o]}const o=h(t,e);return o.isZoomConstant=n&&o.isZoomConstant,o.isFeatureConstant=r&&o.isFeatureConstant,o}let P=0;const _="function"==typeof Object.assign;function A(t,...e){if(_)return Object.assign(t,...e),t;for(let n=0;n<e.length;n++){const r=e[n];for(const e in r)t[e]=r[e]}return t}function I(t){return!k(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function S(t){return"number"==typeof t&&!isNaN(t)}function T(t){return!k(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function F(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function k(t){return null==t}function L(t){return w(t)&&t.property}const C=new TextEncoder;new TextDecoder;const B="function"==typeof fetch&&"function"==typeof AbortController,O={jsonp:function(t,e){const n="_maptalks_jsonp_"+P++;t.match(/\\?/)?t+="&callback="+n:t+="?callback="+n;let r=document.createElement("script");return r.type="text/javascript",r.src=t,window[n]=function(t){e(null,t),document.getElementsByTagName("head")[0].removeChild(r),r=null,delete window[n]},document.getElementsByTagName("head")[0].appendChild(r),this},get:function(t,e,n){if(T(e)){const t=n;n=e,e=t}let r=(e=e||{}).errorLog;k(r)&&(r=!0),e.method&&(e.method=e.method.toUpperCase());const i="POST"===e.method;if(B){const i=new AbortController,o=e;o.signal=i.signal,o.referrerPolicy=o.referrerPolicy||"origin",o.method=o.method||"GET";const s=new Request(t,o);return e.returnJSON&&s.headers.set("Accept","application/json"),fetch(s).then((i=>{const o=this._parseResponse(i,e.returnJSON,e.responseType);o.message?(o.url=t,n(o)):o.then((t=>{"arraybuffer"===e.responseType?n(null,{data:t,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),contentType:i.headers.get("Content-Type")}):n(null,t)})).catch((e=>{e.code&&e.code===DOMException.ABORT_ERR||(r&&console.error("Fetch error:",t,e),n(e))}))})).catch((e=>{e.code&&e.code===DOMException.ABORT_ERR||(r&&console.error("Fetch error:",t,e),n(e))})),i}{const r=O._getClient(n);if(r.open(e.method||"GET",t,!0),e){for(const t in e.headers)r.setRequestHeader(t,e.headers[t]);r.withCredentials="include"===e.credentials,e.responseType&&(r.responseType=e.responseType)}return r.send(i?e.body:null),r}},_parseResponse:(t,e,n)=>200!==t.status?{status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${G}t.status}): ${G}t.statusText}\`}:"arraybuffer"===n?t.arrayBuffer():e?t.json():t.text(),_wrapCallback:function(t,e){return function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?e({status:200,statusText:t.statusText,message:"http status 200 returned without content."}):e(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else e(null,t.responseText);else e({status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${G}t.status}): ${G}t.statusText}\`})}},_getClient:function(t){let e;try{e=new XMLHttpRequest}catch(t){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}return e.onreadystatechange=O._wrapCallback(e,t),e},getArrayBuffer(t,e,n){if(T(e)){const t=n;n=e,e=t}return e||(e={}),e.responseType="arraybuffer",O.get(t,e,n)}};function Y(t,e,n,r,i=3){let o=r;const s=n-e>>1;let a,l=n-e;const u=t[e],h=t[e+1],c=t[n],f=t[n+1];for(let r=e+i;r<n;r+=i){const e=V(t[r],t[r+1],u,h,c,f);if(e>o)a=r,o=e;else if(e===o){const t=Math.abs(r-s);t<l&&(a=r,l=t)}}o>r&&(a-e>i&&Y(t,e,a,r,i),t[a+2]=o,n-a>i&&Y(t,a,n,r,i))}function V(t,e,n,r,i,o){let s=i-n,a=o-r;if(0!==s||0!==a){const l=((t-n)*s+(e-r)*a)/(s*s+a*a);l>1?(n=i,r=o):l>0&&(n+=s*l,r+=a*l)}return s=t-n,a=e-r,s*s+a*a}function X(t,e,n,r,i,o){const s={id:null==t?null:t,type:e,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};i&&(s.layer=i);return function(t,e){const n=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)N(t,n,e);else if("Polygon"===r)N(t,n[0],e);else if("MultiLineString"===r)for(const r of n)N(t,r,e);else if("MultiPolygon"===r)for(const r of n)N(t,r[0],e)}(s,o?4:3),s}function N(t,e,n){for(let r=0;r<e.length;r+=n)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function E(t,e,n,r){if(r.layer=e,"FeatureCollection"===n.type)for(let e=0;e<n.features.length;e++)z(t,n.features[e],r,e);else"Feature"===n.type?z(t,n,r):z(t,{geometry:n},r)}function z(t,e,n,r){if(!e.geometry)return;const i=e.geometry.coordinates,o=e.geometry.type,s=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2);let a=[],l=e.id;if(n.promoteId?l=e.properties[n.promoteId]:n.generateId&&(l=r||0),"Point"===o)$(i,a,n);else if("MultiPoint"===o)for(const t of i)$(t,a,n);else if("LineString"===o)D(i,a,s,!1,n);else if("MultiLineString"===o){if(n.lineMetrics){for(const r of i)a=[],D(r,a,s,!1,n),t.push(X(l,"LineString",a,e.properties,n.layer,n.hasAltitude));return}q(i,a,s,!1,n)}else if("Polygon"===o)q(i,a,s,!0,n);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const i of e.geometry.geometries)z(t,{id:l,geometry:i,properties:e.properties},n,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const t of i){const e=[];q(t,e,s,!0,n),a.push(e)}}t.push(X(l,o,a,e.properties,n.layer,n.hasAltitude))}function $(t,e,n){e.push(G(t[0]),j(t[1],n.projection),0),n.hasAltitude&&(t.length>2?e.push(t[2]):e.push(0))}function D(t,e,n,r,i){let o,s,a=0;for(let n=0;n<t.length;n++){const l=G(t[n][0]),u=j(t[n][1],i.projection);e.push(l,u,0),i.hasAltitude&&(t[n].length>2?e.push(t[n][2]):e.push(0)),n>0&&(a+=r?(o*u-l*s)/2:Math.sqrt(Math.pow(l-o,2)+Math.pow(u-s,2))),o=l,s=u}const l=i.hasAltitude?4:3,u=e.length-l;e[2]=1,Y(e,0,u,n,l),e[u+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function q(t,e,n,r,i){for(let o=0;o<t.length;o++){const s=[];D(t[o],s,n,r,i),e.push(s)}}function G(t){return t/360+.5}function j(t,e){if("EPSG:4326"===e)return(90-t)/360;const n=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+n)/(1-n))/Math.PI;return r<0?0:r>1?1:r}function Z(t,e,n,r,i,o,s,a){if(r/=e,o>=(n/=e)&&s<r)return t;if(s<n||o>=r)return null;const l=[];for(const e of t){const t=e.geometry;let o=e.type;const s=0===i?e.minX:e.minY,u=0===i?e.maxX:e.maxY;if(s>=n&&u<r){l.push(e);continue}if(u<n||s>=r)continue;let h=[];if("Point"===o||"MultiPoint"===o)U(t,h,n,r,i,a.hasAltitude);else if("LineString"===o)R(t,h,n,r,i,!1,a.lineMetrics,a.hasAltitude);else if("MultiLineString"===o)H(t,h,n,r,i,!1,a.hasAltitude);else if("Polygon"===o)H(t,h,n,r,i,!0,a.hasAltitude);else if("MultiPolygon"===o)for(const e of t){const t=[];H(e,t,n,r,i,!0,a.hasAltitude),t.length&&h.push(t)}if(h.length){if(a.lineMetrics&&"LineString"===o){for(const t of h)l.push(X(e.id,o,t,e.tags,e.layer,a.hasAltitude));continue}"LineString"!==o&&"MultiLineString"!==o||(1===h.length?(o="LineString",h=h[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===h.length?"Point":"MultiPoint"),l.push(X(e.id,o,h,e.tags,e.layer,a.hasAltitude))}}return l.length?l:null}function U(t,e,n,r,i,o){const s=o?4:3;for(let a=0;a<t.length;a+=s){const s=t[a+i];s>=n&&s<=r&&(W(e,t[a],t[a+1],t[a+2]),o&&e.push(t[a+3]))}}function R(t,e,n,r,i,o,s,a){let l=J(t);const u=0===i?K:Q;let h,c,f=t.start;const p=a?4:3,d=o?t.length:t.length-p;for(let g=0;g<d;g+=p){const y=t[g],x=t[g+1],m=t[g+2];let v,w,b,M;o&&g===d-p?(v=t[0],w=t[1]):(v=t[g+p],w=t[g+p+1]),a&&(b=t[g+3],M=o&&g===d-p?t[3]:t[g+p+3]);const P=0===i?y:x,_=0===i?v:w;let A=!1;s&&(h=Math.sqrt(Math.pow(y-v,2)+Math.pow(x-w,2))),P<n?_>n&&(c=u(l,y,x,v,w,n),a&&l.push(tt(b,M,c)),s&&(l.start=f+h*c)):P>r?_<r&&(c=u(l,y,x,v,w,r),a&&l.push(tt(b,M,c)),s&&(l.start=f+h*c)):(W(l,y,x,m),a&&l.push(b)),_<n&&P>=n&&(c=u(l,y,x,v,w,n),a&&l.push(tt(b,M,c)),A=!0),_>r&&P<=r&&(c=u(l,y,x,v,w,r),a&&l.push(tt(b,M,c)),A=!0),!o&&A&&(s&&(l.end=f+h*c),e.push(l),l=J(t)),s&&(f+=h)}let g=t.length-p;if(!o){const e=t[g],o=t[g+1],s=t[g+2],u=0===i?e:o;if(u>=n&&u<=r&&W(l,e,o,s),u>=n&&u<=r&&a){const e=t[g+3];l.push(e)}}g=l.length-p,o&&g>=p&&(l[g]!==l[0]||l[g+1]!==l[1])&&(W(l,l[0],l[1],l[2]),a&&l.push(l[3])),l.length&&e.push(l)}function J(t){const e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function H(t,e,n,r,i,o,s){for(const a of t)R(a,e,n,r,i,o,!1,s)}function W(t,e,n,r){t.push(e,n,r)}function K(t,e,n,r,i,o){const s=(o-e)/(r-e);return W(t,o,n+(i-n)*s,1),s}function Q(t,e,n,r,i,o){const s=(o-n)/(i-n);return W(t,e+(r-e)*s,o,1),s}function tt(t,e,n){return t+(e-t)*n}function et(t,e,n){const r=[];for(let i=0;i<t.length;i++){const o=t[i],s=o.type;let a;if("Point"===s||"MultiPoint"===s||"LineString"===s)a=nt(o.geometry,e,n);else if("MultiLineString"===s||"Polygon"===s){a=[];for(const t of o.geometry)a.push(nt(t,e,n))}else if("MultiPolygon"===s){a=[];for(const t of o.geometry){const r=[];for(const i of t)r.push(nt(i,e,n));a.push(r)}}r.push(X(o.id,s,a,o.tags,o.layer,n))}return r}function nt(t,e,n){const r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);const i=n?4:3;for(let o=0;o<t.length;o+=i)r.push(t[o]+e,t[o+1],t[o+2]),n&&r.push(t[o+3]);return r}function rt(t,e,n){if(t.transformed)return t;const r=1<<t.z,i=t.x,o=t.y,s=n?3:2;for(const a of t.features){const t=a.geometry,l=a.type;if(a.geometry=[],1===l)for(let l=0;l<t.length;l+=s)a.geometry.push(it(t[l],t[l+1],e,r,i,o)),n&&a.geometry[a.geometry.length-1].push(t[l+2]);else for(let l=0;l<t.length;l++){const u=[];for(let a=0;a<t[l].length;a+=s)u.push(it(t[l][a],t[l][a+1],e,r,i,o)),n&&u[u.length-1].push(t[l][a+2]);a.geometry.push(u)}}return t.transformed=!0,t}function it(t,e,n,r,i,o){return[Math.round(n*(t*r-i)),Math.round(n*(e*r-o))]}function ot(t,e,n,r,i){const o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:n,y:r,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const e of t)st(s,e,o,i);return s}function st(t,e,n,r){const i=e.geometry,o=e.type,s=[],a=r.hasAltitude?4:3;if(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),"Point"===o||"MultiPoint"===o)for(let e=0;e<i.length;e+=a)s.push(i[e],i[e+1]),r.hasAltitude&&s.push(i[e+3]),t.numPoints++,t.numSimplified++;else if("LineString"===o)lt(s,i,t,n,!1,!1,r);else if("MultiLineString"===o||"Polygon"===o)for(let e=0;e<i.length;e++)lt(s,i[e],t,n,"Polygon"===o,0===e,r);else if("MultiPolygon"===o)for(let e=0;e<i.length;e++){const o=i[e];for(let e=0;e<o.length;e++)lt(s,o[e],t,n,!0,0===e,r)}if(s.length){let n=e.tags||null;if("LineString"===o&&r.lineMetrics){n={};for(const t in e.tags)n[t]=e.tags[t];n.mapbox_clip_start=i.start/i.size,n.mapbox_clip_end=i.end/i.size}const a={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:n};e.layer&&(a.layer=e.layer),null!==e.id&&(a.id=e.id),t.features.push(a)}}function at(t,e,n){return 0===t[e+2]&&t[e+3]>0&&n}function lt(t,e,n,r,i,o,s){const a=r*r,{hasAltitude:l,disableFilter:u}=s,h=l?4:3;if(!u&&r>0&&e.size<(i?a:r))return void(n.numPoints+=e.length/h);const c=[];for(let t=0;t<e.length;t+=h)(0===r||e[t+2]>a||at(e,t,l))&&(n.numSimplified++,c.push(e[t],e[t+1]),l&&c.push(e[t+3])),n.numPoints++;i&&function(t,e,n){const r=n?3:2;let i=0;for(let e=0,n=t.length,o=n-r;e<n;o=e,e+=r)i+=(t[e]-t[o])*(t[e+1]+t[o+1]);if(i>0===e){const e=r,i=r-1,o=r-2;for(let s=0,a=t.length;s<a/2;s+=r){const r=t[s],l=t[s+1];let u;n&&(u=t[s+2]),t[s]=t[a-e-s],t[s+1]=t[a-i-s],n&&(t[s+2]=t[a-o-s]),t[a-e-s]=r,t[a-i-s]=l,n&&(t[a-o-s]=u)}}}(c,o,l),t.push(c)}O.getJSON=function(t,e,n){if(T(e)){const t=n;n=e,e=t}const r=function(t,e){const r="string"==typeof e?JSON.parse(e):e||null;n(t,r)};return e&&e.jsonp?O.jsonp(t,r):((e=e||{}).returnJSON=!0,O.get(t,e,r))};const ut={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 ht{constructor(t,e){const n=(e=this.options=function(t,e){for(const n in e)t[n]=e[n];return t}(Object.create(ut),e)).debug;if(n&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=function(t,e){const n=[];if(Array.isArray(t)){for(let r=0;r<t.length;r++)E(n,t[r].layer,t[r].data,e);return n}if("FeatureCollection"===t.type)for(let r=0;r<t.features.length;r++)z(n,t.features[r],e,r);else"Feature"===t.type?z(n,t,e):z(n,{geometry:t},e);return n}(t,e);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(t,e){const n=e.buffer/e.extent;let r=t;const i=Z(t,1,-1-n,n,0,-1,2,e),o=Z(t,1,1-n,2+n,0,-1,2,e);return(i||o)&&(r=Z(t,1,-n,1+n,0,-1,2,e)||[],i&&(r=et(i,1,e.hasAltitude).concat(r)),o&&(r=r.concat(et(o,-1,e.hasAltitude)))),r}(r,e),r.length&&this.splitTile(r,0,0,0),n&&(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,e,n,r,i,o,s){const a=[t,e,n,r],l=this.options,u=l.debug;for(;a.length;){r=a.pop(),n=a.pop(),e=a.pop(),t=a.pop();const h=1<<e,c=ct(e,n,r);let f=this.tiles[c];if(!f&&(u>1&&console.time("creation"),f=this.tiles[c]=ot(t,e,n,r,l),this.tileCoords.push({z:e,x:n,y:r}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,n,r,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));const t=\`z${G}e}\`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(f.source=t,null==i){if(e===l.indexMaxZoom||f.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===i)continue;if(null!=i){const t=i-e;if(n!==o>>t||r!==s>>t)continue}}if(f.source=null,0===t.length)continue;u>1&&console.time("clipping");const p=.5*l.buffer/l.extent,d=.5-p,g=.5+p,y=1+p;let x=null,m=null,v=null,w=null,b=Z(t,h,n-p,n+g,0,f.minX,f.maxX,l),M=Z(t,h,n+d,n+y,0,f.minX,f.maxX,l);t=null,b&&(x=Z(b,h,r-p,r+g,1,f.minY,f.maxY,l),m=Z(b,h,r+d,r+y,1,f.minY,f.maxY,l),b=null),M&&(v=Z(M,h,r-p,r+g,1,f.minY,f.maxY,l),w=Z(M,h,r+d,r+y,1,f.minY,f.maxY,l),M=null),u>1&&console.timeEnd("clipping"),a.push(x||[],e+1,2*n,2*r),a.push(m||[],e+1,2*n,2*r+1),a.push(v||[],e+1,2*n+1,2*r),a.push(w||[],e+1,2*n+1,2*r+1)}}getTile(t,e,n){t=+t,e=+e,n=+n;const r=this.options,{extent:i,debug:o}=r,{hasAltitude:s,wrapX:a}=r;if(t<0||t>24)return null;if(a){const n=1<<t;e=e+n&n-1}const l=ct(t,e,n);if(this.tiles[l])return rt(this.tiles[l],i,s);o>1&&console.log("drilling down to z%d-%d-%d",t,e,n);let u,h=t,c=e,f=n;for(;!u&&h>0;)h--,c>>=1,f>>=1,u=this.tiles[ct(h,c,f)];return u&&u.source?(o>1&&(console.log("found parent tile z%d-%d-%d",h,c,f),console.time("drilling down")),this.splitTile(u.source,h,c,f,t,e,n),o>1&&console.timeEnd("drilling down"),this.tiles[l]?rt(this.tiles[l],i,s):null):null}}function ct(t,e,n){return 32*((1<<t)*n+e)+t}function ft(t,e,n,r,i,o,s){const a=n&&Array.isArray(n[0]);for(let l=0,u=n.length;l<u;l++){t[e]=(a?n[l][0]:n[l].x)*r,t[e+1]=(a?n[l][1]:n[l].y)*r,s!==Float32Array&&(t[e]=Math.round(t[e]),t[e+1]=Math.round(t[e+1]));let h=i||0;Array.isArray(i)&&(h=i[l]),h=h?Math.round(r*h):0,t[e+2]=h,e+=3,o&&0!==l&&l!==u-1&&(t[e]=t[e-3],t[e+1]=t[e-2],t[e+2]=t[e-1],e+=3)}return t.trySetLength&&t.trySetLength(e),e}function pt(t,e,n,r){const i=t[3*e],o=t[3*e+1],s=t[3*n],a=t[3*n+1];return i===s&&(i<0||i>r)||o===a&&(o<0||o>r)}var dt="undefined"!=typeof Float32Array?Float32Array:Array;function gt(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function yt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function xt(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t}function mt(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function vt(t,e,n){return t[0]=e,t[1]=n,t}function wt(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.hypot(n,r)}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),function(){var t,e=(t=new dt(3),dt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t)}(),function(){var t,e=(t=new dt(4),dt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}(),function(){var t,e=(t=new dt(2),dt!=Float32Array&&(t[0]=0,t[1]=0),t)}();const bt=Math.PI/180,Mt=6378137*Math.PI/180,Pt=85.0511287798;function _t(t,e,n){if("EPSG:3857"===n)return function(t,e){const n=Pt,r=e[0],i=Math.max(Math.min(n,e[1]),-n);let o;o=0===i?0:Math.log(Math.tan((90+i)*bt/2))/bt;return t[0]=r*Mt,t[1]=o*Mt,t}(t,e);if("EPSG:4326"===n||"EPSG:4490"===n||"identity"===n)return At(t,e);if("baidu"===n)return At(t,e);throw new Error("unsupported projection:"+n)}function At(t,e){return t[0]=e[0],t[1]=e[1],t}function It(t,e,n,r,i,o,s,a,l,u,h,c,f,p,d){0===t?function(t,e,n,r,i,o,s,a,l,u){const h=1/(100*o[0]),c=1/(100*o[1]),f=u&&u[0]||0,p=u&&u[1]||0,d=[0,0];for(let i=t;i<e;i+=3){const t=i/3*2,e=r[i]-f,o=r[i+1]-p;n[t]=d[0]+e/s*h/a,n[t+1]=d[1]-o/s*c/l}}(e,n,r,i,0,s,a,l,u,d):1===t&&function(t,e,n,r,i,o,s,a,l,u,h){if(!t)return;let c,f,p,d;0===t[4]?(c=t[0],f=t[1],p=t[2],d=t[3]):(c=t[1],f=t[2],p=t[3],d=t[0]);const g=wt(c,f),y=wt(f,p),x=[],m=[],v=[];for(let t=e;t<n;t+=3){const e=t/3*2;vt(x,(o.x/l+i[t]/s)*a,o.y/l*a+(h?i[t+1]:-i[t+1])/s*a),"EPSG:4326"!==u&&"EPSG:4490"!==u||_t(x,x,"EPSG:3857"),St(m,x,c,f),St(v,x,d,c),r[e]=wt(c,m)/g,r[e+1]=wt(c,v)/y}}(h,e,n,r,i,o,a,c,f,p,!!d)}function St(t,e,n,r){const i=n[0]-r[0],o=n[1]-r[1];let s=(e[0]-n[0])*(n[0]-r[0])+(e[1]-n[1])*(n[1]-r[1]);return s/=i*i+o*o,t[0]=n[0]+s*i,t[1]=n[1]+s*o,t}function Tt(t,e,n,r,i){const o=3*e[n-1],s=3*e[n-1]+1,a=t[o],l=t[s];return u=r,h=i,c=a,f=l,Math.sqrt((c-u)*(c-u)+(f-h)*(f-h));var u,h,c,f}function Ft(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let o=kt(t,0,i,n,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,u;if(r&&(o=function(t,e,n,r){const i=[];for(let n=0,o=e.length;n<o;n++){const s=kt(t,e[n]*r,n<o-1?e[n+1]*r:t.length,r,!1);s===s.next&&(s.steiner=!0),i.push($t(s))}i.sort(Xt);for(let t=0;t<i.length;t++)n=Nt(i[t],n);return n}(t,e,o,n)),t.length>80*n){a=1/0,l=1/0;let e=-1/0,r=-1/0;for(let o=n;o<i;o+=n){const n=t[o],i=t[o+1];n<a&&(a=n),i<l&&(l=i),n>e&&(e=n),i>r&&(r=i)}u=Math.max(e-a,r-l),u=0!==u?32767/u:0}return Ct(o,s,n,a,l,u,0),s}function kt(t,e,n,r,i){let o;if(i===function(t,e,n,r){let i=0;for(let o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}(t,e,n,r)>0)for(let i=e;i<n;i+=r)o=Kt(i/r|0,t[i],t[i+1],o);else for(let i=n-r;i>=e;i-=r)o=Kt(i/r|0,t[i],t[i+1],o);return o&&Zt(o,o.next)&&(Qt(o),o=o.next),o}function Lt(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!Zt(r,r.next)&&0!==jt(r.prev,r,r.next))r=r.next;else{if(Qt(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function Ct(t,e,n,r,i,o,s){if(!t)return;!s&&o&&function(t,e,n,r){let i=t;do{0===i.z&&(i.z=zt(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,n=1;do{let r,i=t;t=null;let o=null;for(e=0;i;){e++;let s=i,a=0;for(let t=0;t<n&&(a++,s=s.nextZ,s);t++);let l=n;for(;a>0||l>0&&s;)0!==a&&(0===l||!s||i.z<=s.z)?(r=i,i=i.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;i=s}o.nextZ=null,n*=2}while(e>1)}(i)}(t,r,i,o);let a=t;for(;t.prev!==t.next;){const l=t.prev,u=t.next;if(o?Ot(t,r,i,o):Bt(t))e.push(l.i,t.i,u.i),Qt(t),t=u.next,a=u.next;else if((t=u)===a){s?1===s?Ct(t=Yt(Lt(t),e),e,n,r,i,o,2):2===s&&Vt(t,e,n,r,i,o):Ct(Lt(t),e,n,r,i,o,1);break}}}function Bt(t){const e=t.prev,n=t,r=t.next;if(jt(e,n,r)>=0)return!1;const i=e.x,o=n.x,s=r.x,a=e.y,l=n.y,u=r.y,h=Math.min(i,o,s),c=Math.min(a,l,u),f=Math.max(i,o,s),p=Math.max(a,l,u);let d=r.next;for(;d!==e;){if(d.x>=h&&d.x<=f&&d.y>=c&&d.y<=p&&qt(i,a,o,l,s,u,d.x,d.y)&&jt(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Ot(t,e,n,r){const i=t.prev,o=t,s=t.next;if(jt(i,o,s)>=0)return!1;const a=i.x,l=o.x,u=s.x,h=i.y,c=o.y,f=s.y,p=Math.min(a,l,u),d=Math.min(h,c,f),g=Math.max(a,l,u),y=Math.max(h,c,f),x=zt(p,d,e,n,r),m=zt(g,y,e,n,r);let v=t.prevZ,w=t.nextZ;for(;v&&v.z>=x&&w&&w.z<=m;){if(v.x>=p&&v.x<=g&&v.y>=d&&v.y<=y&&v!==i&&v!==s&&qt(a,h,l,c,u,f,v.x,v.y)&&jt(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,w.x>=p&&w.x<=g&&w.y>=d&&w.y<=y&&w!==i&&w!==s&&qt(a,h,l,c,u,f,w.x,w.y)&&jt(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;v&&v.z>=x;){if(v.x>=p&&v.x<=g&&v.y>=d&&v.y<=y&&v!==i&&v!==s&&qt(a,h,l,c,u,f,v.x,v.y)&&jt(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;w&&w.z<=m;){if(w.x>=p&&w.x<=g&&w.y>=d&&w.y<=y&&w!==i&&w!==s&&qt(a,h,l,c,u,f,w.x,w.y)&&jt(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function Yt(t,e){let n=t;do{const r=n.prev,i=n.next.next;!Zt(r,i)&&Ut(r,n,n.next,i)&&Ht(r,i)&&Ht(i,r)&&(e.push(r.i,n.i,i.i),Qt(n),Qt(n.next),n=t=i),n=n.next}while(n!==t);return Lt(n)}function Vt(t,e,n,r,i,o){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&Gt(s,t)){let a=Wt(s,t);return s=Lt(s,s.next),a=Lt(a,a.next),Ct(s,e,n,r,i,o,0),void Ct(a,e,n,r,i,o,0)}t=t.next}s=s.next}while(s!==t)}function Xt(t,e){let n=t.x-e.x;if(0===n&&(n=t.y-e.y,0===n)){n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return n}function Nt(t,e){const n=function(t,e){let n=e;const r=t.x,i=t.y;let o,s=-1/0;if(Zt(t,n))return n;do{if(Zt(t,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>s&&(s=t,o=n.x<n.next.x?n:n.next,t===r))return o}n=n.next}while(n!==e);if(!o)return null;const a=o,l=o.x,u=o.y;let h=1/0;n=o;do{if(r>=n.x&&n.x>=l&&r!==n.x&&Dt(i<u?r:s,i,l,u,i<u?s:r,i,n.x,n.y)){const e=Math.abs(i-n.y)/(r-n.x);Ht(n,t)&&(e<h||e===h&&(n.x>o.x||n.x===o.x&&Et(o,n)))&&(o=n,h=e)}n=n.next}while(n!==a);return o}(t,e);if(!n)return e;const r=Wt(n,t);return Lt(r,r.next),Lt(n,n.next)}function Et(t,e){return jt(t.prev,t,e.prev)<0&&jt(e.next,t,t.next)<0}function zt(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function $t(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function Dt(t,e,n,r,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(r-a)>=(n-s)*(e-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function qt(t,e,n,r,i,o,s,a){return!(t===s&&e===a)&&Dt(t,e,n,r,i,o,s,a)}function Gt(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Ut(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Ht(t,e)&&Ht(e,t)&&function(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(jt(t.prev,t,e.prev)||jt(t,e.prev,e))||Zt(t,e)&&jt(t.prev,t,t.next)>0&&jt(e.prev,e,e.next)>0)}function jt(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Zt(t,e){return t.x===e.x&&t.y===e.y}function Ut(t,e,n,r){const i=Jt(jt(t,e,n)),o=Jt(jt(t,e,r)),s=Jt(jt(n,r,t)),a=Jt(jt(n,r,e));return i!==o&&s!==a||(!(0!==i||!Rt(t,n,e))||(!(0!==o||!Rt(t,r,e))||(!(0!==s||!Rt(n,t,r))||!(0!==a||!Rt(n,e,r)))))}function Rt(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Jt(t){return t>0?1:t<0?-1:0}function Ht(t,e){return jt(t.prev,t,t.next)<0?jt(t,e,t.next)>=0&&jt(t,t.prev,e)>=0:jt(t,e,t.prev)<0||jt(t,t.next,e)<0}function Wt(t,e){const n=te(t.i,t.x,t.y),r=te(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function Kt(t,e,n,r){const i=te(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Qt(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 te(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}const ee="__fea_idx";new Float32Array([-1e12])[0];const ne="maptalks_ombb";function re(){return function(){if("undefined"!=typeof undefinedThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof undefined)return global;throw new Error("unable to locate global object")}().maptalks_vt_packers}const{PackUtil:ie,ArrayPool:oe}=re();function se(t,e,n,r,i,o,s,a,l,u,h,c,f,p,d,g,y){const x=e.getLength(),m=i/3;for(let n=2,r=x;n<r;n+=3)t[i+n-2]=e[n-2],t[i+n-1]=e[n-1],t[i+n-0]=e[n]-s;i+=x;for(let n=2,r=x;n<r;n+=3)t[i+n-2]=e[n-2],t[i+n-1]=e[n-1],t[i+n-0]=e[n]-a;i+=x,t.trySetLength(i+x),t.copyWithin(i,i-2*x,i-x),i+=x,t.trySetLength(i+x),t.copyWithin(i,i-2*x,i-x),i+=x,(n=n||[]).push(x/3);const v=n.getLength();for(let e=0;e<v;e++){ae(m+(n[e-1]||0),m+n[e],t,x/3,l,r,u,h,c,f,o,p,d,g,y)}return i}function ae(t,e,n,r,i,o,s,a,l,u,h,c,f,p,d){const g=o.getLength();let y,x;for(let s=t,a=e;s<a-1;s++)if(y=s,x=s+1,i===1/0||!pt(n,y,x,i))if((s-t)%2==1&&(y+=2*r,x+=2*r),d){let t=o.currentIndex;o[t++]=y+r,o[t++]=x,o[t++]=y,o[t++]=x+r,o[t++]=x,o[t++]=y+r,o.currentIndex=t}else{let t=o.currentIndex;o[t++]=y+r,o[t++]=y,o[t++]=x,o[t++]=x,o[t++]=x+r,o[t++]=y+r,o.currentIndex=t}s&&function(t,e,n,r,i,o,s,a,l,u,h,c){let f,p=0,d=0,g=0,y=0;const x=c?[1,3,4]:[2,3,4];for(let c=o.getLength()-1;c>=s;c--){const s=o[c],m=3*s+1,v=3*s+2,w=i[3*s],b=i[m],M=i[v];p||d||(p=Math.max(i[v],i[3*o[c-3]+2]),d=Math.min(i[v],i[3*o[c-3]+2]),f=p-d);let P=g;const _=c%6;0===t?(5===_&&(y=Tt(i,o,c,w,b)),P=_===x[0]||_===x[1]||_===x[2]?g:g+y):1===t&&(_===x[0]||_===x[1]||_===x[2]?P=0:5===_?(y=Tt(i,o,c,w,b),P=y):P=y);const A=P/u*(1/(100*h))/a;let I;I=1===e?M===p?1:0:"bottom"===n?M===p?f/100/l:0:M===p?0:-f/100/l,r[2*s]=A,r[2*s+1]=I,0===_&&(g+=y)}}(a,l,u,h,n,o,g,c[0],c[1],f,p,d)}function le(t){const e=[t[0]];let n=t[0];for(let r=1;r<t.length;r++)Array.isArray(t[r])?t[r][0]===n[0]&&t[r][1]===n[1]&&t[r][2]===n[2]||e.push(t[r]):t[r].x===n.x&&t[r].y===n.y&&t[r].z===n.z||e.push(t[r]),n=t[r];return e}var ue="undefined"!=typeof Float32Array?Float32Array:Array;function he(){var t=new ue(3);return ue!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function ce(t,e,n){var r=new ue(3);return r[0]=t,r[1]=e,r[2]=n,r}function fe(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function pe(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function de(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function ge(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;return o>0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(t,e,n){var r=e[0],i=e[1],o=e[2],s=n[0],a=n[1],l=n[2];return t[0]=i*l-o*a,t[1]=o*s-r*l,t[2]=r*a-i*s,t}var me=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t};function ve(){var t=new ue(4);return ue!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function we(t,e){var n=e[0]+e[4]+e[8],r=void 0;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var o=(i+1)%3,s=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*s+s]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*o+s]-e[3*s+o])*r,t[o]=(e[3*o+i]+e[3*i+o])*r,t[s]=(e[3*s+i]+e[3*i+s])*r}return t}!function(){var t=he()}(),function(){var t,e=(t=new ue(4),ue!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var be,Me=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},Pe=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=n*n+r*r+i*i+o*o;return s>0&&(s=1/Math.sqrt(s),t[0]=n*s,t[1]=r*s,t[2]=i*s,t[3]=o*s),t};he(),ce(1,0,0),ce(0,1,0),ve(),ve(),be=new ue(9),ue!=Float32Array&&(be[1]=0,be[2]=0,be[3]=0,be[5]=0,be[6]=0,be[7]=0),be[0]=1,be[4]=1,be[8]=1;\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */\nconst _e=8,Ae=[],Ie=[],Se=[],Te=[];function Fe(t,e,n){const r=xe(Ie,e,n),i=function(t,e,n,r,i,o,s,a,l,u){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=s,t[6]=a,t[7]=l,t[8]=u,t}(Ae,n[0],n[1],n[2],...r,...e);t=we(t,i),t=function(t){return t[3]<0?Me(t,t,-1):t}(t=Pe(t,t));const o=1/((1<<2*_e-1)-1);if(t[3]<o){t[3]=o;const e=Math.sqrt(1-o*o);t[0]*=e,t[1]*=e,t[2]*=e}const s=n[3]>0?xe(Se,n,e):xe(Se,e,n);return ye(xe(Te,n,e),s)<0&&Me(t,t,-1),t}const ke=[];const Le=[],Ce=[],Be=[],Oe=[],Ye=[],Ve=[],Xe=[];function Ne(t,e,n,r,i,o){pe(Oe,t[3*e],t[3*e+1],t[3*e+2]),pe(Ye,t[3*n],t[3*n+1],t[3*n+2]),pe(Ve,t[3*r],t[3*r+1],t[3*r+2]);const s=me(Le,Ve,Ye),a=me(Ce,Oe,Ye),l=xe(Be,s,a);ge(Xe,l),i[3*e]=i[3*e]||0,i[3*n]=i[3*n]||0,i[3*r]=i[3*r]||0,i[3*e+1]=i[3*e+1]||0,i[3*n+1]=i[3*n+1]||0,i[3*r+1]=i[3*r+1]||0,i[3*e+2]=i[3*e+2]||0,i[3*n+2]=i[3*n+2]||0,i[3*r+2]=i[3*r+2]||0,i[3*e]+=Xe[0],i[3*n]+=Xe[0],i[3*r]+=Xe[0],i[3*e+1]+=Xe[1],i[3*n+1]+=Xe[1],i[3*r+1]+=Xe[1],i[3*e+2]+=Xe[2],i[3*n+2]+=Xe[2],i[3*r+2]+=Xe[2],o[e]+=1,o[n]+=1,o[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 Ee(t,e,n){return t[0]=e[n],t[1]=e[n+1],t[2]=e[n+2],t}function ze(t,e,n){return t[0]=e[n],t[1]=e[n+1],t}const{StyleUtil:$e,PackUtil:De,ArrayPool:qe}=re(),Ge=qe.getInstance();function je(t,e,n,r,i,o,s,a,l,u,h,c,f,p,d,g){void 0===e.top&&(e.top=!0),void 0===e.side&&(e.side=!0),Ge.reset();const{altitudeScale:y,altitudeProperty:x,defaultAltitude:m,heightProperty:v,minHeightProperty:P,defaultHeight:_,tangent:A,uv:I,topUVMode:T,sideUVMode:F,sideVerticalUVMode:k,top:C,side:B,textureYOrigin:O,topThickness:Y}=e,V=function(t,e,{altitudeScale:n,altitudeProperty:r,defaultAltitude:i,heightProperty:o,minHeightProperty:s,defaultHeight:a},{center:l,side:u,top:h,topThickness:c,uvOrigin:f,uv:p,uvSize:d,topUVMode:g,sideUVMode:y,sideVerticalUVMode:x,textureYOrigin:m,tileRatio:v,centimeterToPoint:w,verticalCentimeterToPoint:b,positionType:M,res:P,glScale:_,projectionCode:A},I,T){let F=e/t[0].extent;e===1/0&&(F=1);const k=e===1/0,L=T.get(),C=T.get(),B=T.get(),O=T.getProxy(),Y=T.get(),V=T.get(),X=T.get(),N=!!p,E=!!h,z=!!u,$=N?T.get():null;function D(t,n,r,i,o,s){let a=n;if(E){const u=Ft(O,r,3);if(0===u.length)return n;let h=O.getLength(),p=Y.currentIndex;for(let t=0;t<h;t++)Y[p++]=O[t];if(Y.currentIndex=p,n+=O.getLength(),s)for(let e=2,n=u.length;e<n;e+=3)u[e]+=t/3,u[e-1]+=t/3,u[e-2]+=t/3;else{let e;for(let n=2,r=u.length;n<r;n+=3)e=u[n-1],u[n-1]=u[n]+t/3,u[n]=e+t/3,u[n-2]+=t/3}h=u.length,p=V.currentIndex;for(let t=0;t<h;t++)V[p++]=u[t];V.currentIndex=p,N&&It(g||0,t,n,$,Y,f,w,v,d[0],d[1],o,P,_,A,l),c>0&&!z&&(n=se(Y,O,r,V,n,$,0,c,e,N,y||0,x||0,m,d,v,b,i<0?!s:s)),X.setLength(n/3),X.fill(1,a/3,n/3)}if(z){E&&(c=0),a=n,n=se(Y,O,r,V,n,$,c,i,e,N,y||0,x||0,m,d,v,b,i<0?!s:s),X.setLength(n/3);const t=O.getLength()/3;X.fill(1,a/3,a/3+t),X.fill(0,a/3+t,a/3+2*t),X.fill(1,a/3+2*t,a/3+3*t),X.fill(0,a/3+3*t,n/3)}return n}let q=-1/0,G=1/0,j=0;const Z=[-1,-1,e+1,e+1];let U=0,R=t.length;S(I)&&(U=I,R=I+1);let J=0,H=!1;const W=T.getProxy();let K,Q=!1;for(;U<R;U++){const l=t[U],u=l.id;S(u)&&(Math.abs(u)>J&&(J=Math.abs(u)),u<0&&(H=!0));const h=l.geometry,c=l.properties[ne];let f=Array.isArray(c&&c[0]&&c[0][0])?c[0]:c;const{altitude:p,height:d}=ie.getFeaAltitudeAndHeight(l,n,r,i,o,a,s);d<0?(Q=!0,G=Math.min(p,G),q=Math.max(p-d,q)):(q=Math.max(p,q),G=Math.min(p-d,G));const g=Y.getLength();let y=0,x=j;W.setLength(0),O.setLength(0);const m=ie.calculateSignedArea(h[0])<0;for(let t=0,n=h.length;t<n;t++){let r=h[t];m&&(r=r.reverse()),r=le(r);const i=ie.calculateSignedArea(r)<0;if(!i&&t>0&&(y++,f=c&&c[y],j=D(x,j,W,d*F,f,k),O.setLength(0),W.setLength(0),x=j),e!==1/0&&(r=ie.clipPolygon(r,Z)),!r.length){t===n-1&&(j=D(x,j,W,d*F,f,k));continue}const o=r.length;if(Array.isArray(r[0])?r[0][0]===r[o-1][0]&&r[0][1]===r[o-1][1]||r.push([r[0][0],r[0][1]]):r[0].x===r[o-1].x&&r[0].y===r[o-1].y||r.push(r[0]),i){let t=W.currentIndex;W[t++]=O.getLength()/3,W.currentIndex=t}ft(O,O.getLength(),r,F,p,!1,M),t===n-1&&(j=D(x,j,W,d*F,f,k))}const v=Y.getLength()-g,w=(ee+"").trim();for(let t=0;t<v/3;t++){let t=C.currentIndex;C[t++]=void 0===l[w]?U:l[w],C.currentIndex=t,t=L.currentIndex,L[t++]=U,L.currentIndex=t,S(u)&&(t=B.currentIndex,B[t++]=u,B.currentIndex=t)}}K=l?Float32Array:ie.getUnsignedArrayType(C.getLength()?C[C.getLength()-1]:0);const tt={hasNegativeHeight:Q,maxAltitude:q===-1/0?0:q,minAltitude:G===1/0?0:G,vertices:Y,verticeTypes:X,indices:V,pickingIds:oe.createTypedArray(C,K),featureIndexes:L};if(B.getLength()){const t=H?ie.getPosArrayType(J):ie.getUnsignedArrayType(J);tt.featureIds=oe.createTypedArray(B,t)}else tt.featureIds=[];return $&&($.setLength(Y.getLength()/3*2),tt.uvs=$),tt}(t,n,{altitudeScale:y,altitudeProperty:x,defaultAltitude:m||0,heightProperty:v,minHeightProperty:P,defaultHeight:_||0},{center:g,top:C,side:B,topThickness:10*Y||0,uv:I||A,uvSize:[i,i],uvOrigin:r,topUVMode:T,sideUVMode:F,sideVerticalUVMode:k,textureYOrigin:O,tileRatio:a,centimeterToPoint:l,verticalCentimeterToPoint:u,positionType:d,res:o,glScale:s,projectionCode:f},p,Ge),X=[],N=V.vertices.getLength()/3,E=De.getIndexArrayType(N),z=qe.createTypedArray(V.indices,E);delete V.indices,X.push(z.buffer,V.pickingIds.buffer);const $=Math.max(Math.abs(V.maxAltitude),Math.abs(V.minAltitude)),D=De.getPosArrayType(Math.max(512,$));V.vertices=qe.createTypedArray(V.vertices,D);const q=A?Ge.getProxy():new Float32Array(3*N);q.setLength&&q.setLength(3*N);const G=function(t,e,n){const r=n||[];r.setLength&&r.setLength(t.length);const i=ke;i.length<t.length/3&&(i.length=t.length/3),i.fill(0,0,t.length/3);const o=void 0===e.length?e:e.length;for(let n=0;n<o/3;n++)void 0===e.length?Ne(t,3*n,3*n+1,3*n+2,r,i):Ne(t,e[3*n],e[3*n+1],e[3*n+2],r,i);for(let t=0;t<r.length;t+=3){const e=i[t/3];0!==e?(r[t]/=e,r[t+1]/=e,r[t+2]/=e):(r[t]=0,r[t+1]=0,r[t+2]=0)}return r}(V.vertices,z,q);let j=!0;const Z=G.getLength?G.getLength():G.length;for(let t=0;t<Z;t++){G[t]=-G[t];const e=G[t]%1;1-Math.abs(e)>1e-6?j=!1:0!==e&&(G[t]=Math.round(G[t]))}if(V.normals=G,A){let t=Ge.get();t.setLength(4*N),t=function(t,e,n,r,i){const o=t.length/3,s=i||new Array(4*o),a=[],l=[];for(let t=0;t<o;t++)a[t]=[0,0,0],l[t]=[0,0,0];const u=[0,0,0],h=[0,0,0],c=[0,0,0],f=[0,0],p=[0,0],d=[0,0],g=[0,0,0],y=[0,0,0];function x(e,r,i){Ee(u,t,3*e),Ee(h,t,3*r),Ee(c,t,3*i),ze(f,n,2*e),ze(p,n,2*r),ze(d,n,2*i);const o=h[0]-u[0],s=c[0]-u[0],x=h[1]-u[1],m=c[1]-u[1],v=h[2]-u[2],w=c[2]-u[2],b=p[0]-f[0],M=d[0]-f[0],P=p[1]-f[1],_=d[1]-f[1],A=1/(b*_-M*P);pe(g,(_*o-P*s)*A,(_*x-P*m)*A,(_*v-P*w)*A),pe(y,(b*s-M*o)*A,(b*m-M*x)*A,(b*w-M*v)*A),de(a[e],a[e],g),de(a[r],a[r],g),de(a[i],a[i],g),de(l[e],l[e],y),de(l[r],l[r],y),de(l[i],l[i],y)}for(let t=0,e=r.length;t<e;t+=3)x(r[t+0],r[t+1],r[t+2]);const m=[],v=[],w=[],b=[];let M,P,_;function A(t){Ee(w,e,3*t),fe(b,w),P=a[t],fe(m,P),me(m,m,function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}(w,w,ye(w,P))),ge(m,m),xe(v,b,P),_=ye(v,l[t]),M=_<0?-1:1,s[4*t]=m[0],s[4*t+1]=m[1],s[4*t+2]=m[2],s[4*t+3]=M}for(let t=0,e=r.length;t<e;t+=3)A(r[t+0]),A(r[t+1]),A(r[t+2]);return s}(V.vertices,V.normals,V.uvs,z,t),t=function(t,e){const n=e.getLength(),r=new Float32Array(n),i=[],o=[],s=[];for(let a=0;a<n;a+=4){const n=a/4*3;gt(o,t[n]||0,t[n+1]||0,t[n+2]||0),xt(i,e[a]||0,e[a+1]||0,e[a+2]||0,e[a+3]||0),Fe(s,o,i),yt(r.subarray(a,a+4),s)}return r}(V.normals,t),V.tangents=t,X.push(t.buffer),delete V.normals}if(V.normals&&(j&&(V.normals=qe.createTypedArray(V.normals,Int8Array)),X.push(V.normals.buffer)),V.uvs){const t=V.uvs;V.uvs=qe.createTypedArray(t,Float32Array),X.push(V.uvs.buffer)}const U=function(t,e,n,r){const i={},o={},s=r.getLength();if(L(e.polygonFill)){let a=b(e.polygonFill);const l=new Uint8Array(4*s);l.fill(255);for(let e=0;e<s;e++){const o=t[r[e]],s=o.properties||{};s.$layer=o.layer,s.$type=o.type;let u=a(n,s);w(u)&&(i.aColor=1,a=b(u),u=a(n,s)),delete s.$layer,delete s.$type,$e.normalizeColor(Ze,u),l[4*e]=Ze[0],l[4*e+1]=Ze[1],l[4*e+2]=Ze[2],l[4*e+3]=Ze[3]}o.aColor=l}if(L(e.polygonOpacity)){let a=M(e.polygonOpacity,"exponential");const l=new Uint8Array(s);l.fill(255);for(let e=0;e<s;e++){const o=t[r[e]],s=o.properties||{};s.$layer=o.layer,s.$type=o.type;let u=a(n,s);w(u)&&(i.aOpacity=1,a=b(u),u=a(n,s)),delete s.$layer,delete s.$type,l[e]=255*u}o.aOpacity=l}return o.dynamicAttributes=i,o}(t,h,c,V.featureIndexes),R=function(t,e,n,r,i){const o=[[],[]],s=L(r.topPolygonFill),a=L(r.bottomPolygonFill),l=[255,255,255,255],u=e.getLength();if(s||a){let h=s&&b(r.topPolygonFill),c=a&&b(r.bottomPolygonFill),f=null,p=null,d=null,g=null;for(let r=0;r<u;r++){if(1===t[r]&&!s||0===t[r]&&!a)continue;const u=1===t[r];if(u&&e[r]===f){t[r]=d;continue}if(!u&&e[r]===p){t[r]=g;continue}const y=n[e[r]],x=y.properties||{};x.$layer=y.layer,x.$type=y.type;let m=u?h:c,v=m(i,x);w(v)&&(m=b(v),v=m(i,x)),delete x.$layer,delete x.$type,$e.normalizeColor(Ze,v),mt(Ze,Ze,l);let M=Ue(o,Ze);M<0&&(M=o.length,o.push(yt([],Ze))),t[r]=M,u?(f=e[r],d=M):(p=e[r],g=M)}}return o.slice(2)}(V.verticeTypes,V.featureIndexes,t,h,c),J={data:{data:{aVertexColorType:R.length<=252?qe.createTypedArray(V.verticeTypes,Uint8Array):qe.createTypedArray(V.verticeTypes,Uint16Array),aPosition:V.vertices,aNormal:V.normals,aTexCoord0:V.uvs,aTangent:V.tangents,aPickingId:V.pickingIds},indices:z,properties:{maxAltitude:V.maxAltitude/100,minAltitude:V.minAltitude/100,hasNegativeHeight:V.hasNegativeHeight},dynamicAttributes:U.dynamicAttributes,vertexColors:R},buffers:X};return V.featureIds.length?(J.data.featureIds=V.featureIds,X.push(J.data.featureIds.buffer)):J.data.featureIds=[],U.aColor&&(J.data.data.aColor=U.aColor,J.buffers.push(U.aColor.buffer)),U.aOpacity&&(J.data.data.aOpacity=U.aOpacity,J.buffers.push(U.aOpacity.buffer)),J.buffers.push(J.data.data.aPosition.buffer),J.data.pickingIdIndiceMap=De.generatePickingIndiceIndex(J.data.data.aPickingId,J.data.indices),J}const Ze=[];function Ue(t,e){for(let i=0;i<t.length;i++)if(n=e,r=t[i],n[0]===r[0]&&n[1]===r[1]&&n[2]===r[2]&&n[3]===r[3])return i;var n,r;return-1}const{PackUtil:Re,StyleUtil:Je,FilterUtil:He}=re();function We(t,e,n,r,{altitudeScale:i,altitudeProperty:o,defaultAltitude:s,heightProperty:a,minHeightProperty:l,defaultHeight:u,bottom:h}){const c=h,f=e/t[0].extent,p=2*function(t,e){let n=0;for(let e=0,r=t.length;e<r;e++){const r=t[e];if(S(r.geometry[0][0]))n+=3*r.geometry.length;else for(let t=0,e=r.geometry.length;t<e;t++){let e=3*r.geometry[t].length;3===r.type&&(e-=3),n+=e}}return n}(t)+3*t.length*2,d=[],g=new Int16Array(p),y=new Uint8Array(g.length/3*4);w(n)&&(n=He.compileFilter(n));const x=[];function m(t,n,r){const i=n-t,o=g.subarray(t,n),s=g.subarray(n,n+i);s.set(o);for(let t=2,e=s.length;t<e;t+=3)s[t]=o[t]-r;const a=t/3,l=i/3;let u,h;for(let t=a,n=l+a;t<n;t++)t<n-1?(u=t,h=t+1):(u=t,h=a),pt(g,u,h,e)||(x.push(u,h),c&&x.push(u+l,h+l),Ke(g,u,e)||x.push(u,u+l));return n+i}let v=0,b=-1/0,M=1/0;const P=(ee+"").trim(),_=[];for(let e=0,h=t.length;e<h;e++){const h=t[e],c=h.geometry;if(n){let t;t="function"==typeof n?n(h&&h.properties):n,Je.normalizeColor(_,t)}else gt(_,255,255,255);const p=v/3*4,{altitude:w,height:A}=Re.getFeaAltitudeAndHeight(h,i,o,s,a,u,l);A<0?(M=Math.min(w,M),b=Math.max(w-A,b)):(M=Math.min(w-A,M),b=Math.max(w,b));let I=v;for(let t=0,e=c.length;t<e;t++){let e=c[t];const n=e.length;e[0][0]===e[n-1][0]&&e[0][1]===e[n-1][1]&&(e=e.slice(0,n-1)),v=ft(g,I,e,f,w),v=m(I,v,A*f),I=v}const S=I/3*4;for(let t=p;t<S;t+=4)y[t]=_[0],y[t+1]=_[1],y[t+2]=_[2],y[t+3]=255*(r||1);const T=x.length-d.length;for(let t=0;t<T;t++)d.push(h[P])}const A=x.reduce(((t,e)=>Math.max(t,e)),0),I=new(Re.getIndexArrayType(A))(x),T=Math.max(Math.abs(b,Math.abs(M)));return{aPosition:new(Re.getPosArrayType(Math.max(512,T)))(g),indices:I,aPickingId:new Float32Array(d),aColor:y,maxAltitude:b===-1/0?0:b/100,minAltitude:M===1/0?0:M/100}}function Ke(t,e,n){const r=t[3*e],i=t[3*e+1];return r<0||r>n||i<0||i>n}function Qe(t,e,n,r){const i=We(t,e,n.lineColor,n.lineOpacity,r),{minAltitude:o,maxAltitude:s}=i;delete i.minAltitude,delete i.maxAltitude;const a=[i.aPosition.buffer,i.indices.buffer,i.aPickingId.buffer],l=i.indices;return delete i.indices,{data:{data:i,properties:{minAltitude:o,maxAltitude:s},indices:l},buffers:a}}\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 */const tn=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function en(t){if(!t)return"true";const e=t[0];if(t.length<=1)return"any"===e?"false":"true";return\`(${G}"=="===e?rn(t[1],t[2],"===",!1):"!="===e?rn(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?rn(t[1],t[2],e,!0):"any"===e?sn(t.slice(1),"||"):"all"===e?sn(t.slice(1),"&&"):"none"===e?un(sn(t.slice(1),"||")):"in"===e?an(t[1],t.slice(2)):"!in"===e?un(an(t[1],t.slice(2))):"has"===e?ln(t[1]):"!has"===e?un(ln(t[1])):"contains"===e?function(t,e,n){const r=nn(t);return void 0!==n?\`(${G}r} + '').indexOf("${G}e}") === ${G}n}\`:\`(${G}r} + '').indexOf("${G}e}") >= 0\`}(t[1],t[2],t[3]):"true"})\`}function nn(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function rn(t,e,n,r){if("object"==typeof(i=t)&&i&&t.op)return function(t,e,n,r){const i=t.property,o=t.op;let s=nn(i);return"length"!==o?(console.error(\`not support ${G}o} op\`),"false"):(s=\`((${G}s}+='').length)\`,on(s,i,e,n,r))}(t,e,n,r);var i;return on(nn(t),t,e,n,r)}function on(t,e,n,r,i){const o="$type"===e?tn.indexOf(n):JSON.stringify(n);return(i?\`typeof ${G}t}=== typeof ${G}o}&&\`:"")+t+r+o}function sn(t,e){return t.map(en).join(e)}function an(t,e){"$type"===t&&(e=e.map((t=>tn.indexOf(t))));const n=JSON.stringify(e.sort(hn)),r=nn(t);return e.length<=200?\`${G}n}.indexOf(${G}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; }(${G}r}, ${G}n},0,${G}e.length-1})\`}function ln(t){return"$id"===t?'"id" in f':\`${G}JSON.stringify(t)} in p\`}function un(t){return\`!(${G}t})\`}function hn(t,e){return t<e?-1:t>e?1:0}let cn=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),cn=!0}catch(t){cn=!1}var fn=cn;const{VectorPack:pn,PolygonPack:dn,NativeLinePack:gn,LinePack:yn,PointPack:xn,NativePointPack:mn,LineExtrusionPack:vn,CirclePack:wn,RoundTubePack:bn,SquareTubePack:Mn,FilterUtil:Pn,PackUtil:_n,StyleUtil:An,TextUtil:In,DEFAULT_TEX_WIDTH:Sn,GlyphRequestor:Tn}=re(),Fn="__original_properties",kn="__fn-type_properties";class Ln{constructor(t,e,n,r,i){this.id=t,this.options=e,this.upload=n,this._compileStyle(e.style),this.requests={},this._cache=r,this._styleCounter=1,this.loadings=i}updateStyle(t,e){this.options.style=t,this._styleCounter=t.styleCounter,this._compileStyle(t),e()}updateOptions(t,e){this.options=A(this.options,t),e()}loadTile(t,e){const n=this.loadings,r=t.tileInfo.url,i=this.options.debugTile;if(i){const{x:n,y:r,z:o}=t.tileInfo;let s=!1;for(let t=0;t<i.length;t++)if(n===i[t].x&&r===i[t].y&&o===i[t].z){s=!0;break}if(!s)return void e()}if(n[r])return void n[r].push({context:t,callback:e,ref:this});n[r]=[{context:t,callback:e,ref:this}];const o=this.options.featureIdProperty;this.requests[r]=this.getTileFeatures(t,((e,i,s,a)=>{const l=n[r];if(delete n[r],this.checkIfCanceled(r))return delete this.requests[r],void this._callWaitings(l,null,{canceled:!0});if(delete this.requests[r],(this.options.debug||o)&&i)for(let e=0;e<i.length;e++)if(this.options.debug&&(i[e]._debug_info={index:e,id:i[e].id,tileId:t.tileInfo.id}),o){const t=F(o)?o[i[e].layer]:o,n=i[e].properties;i[e].id=n&&n[t]||null}if(e)this._callWaitings(l,e);else if(i&&i.length){if(l)for(let t=0;t<l.length;t++)this._onTileLoad.call(l[t].ref,l[t].context,l[t].callback,r,s,i,a)}else this._callWaitings(l)}))}_onTileLoad(t,e,n,r,i,o){this._createTileData(r,i,t).then((n=>{if(n.canceled)return void e(null,{canceled:!0});n.data.styleCounter=t.styleCounter,o&&A(n.data,o);const r=n.data.features;if(r){const t={};for(const e in r){const n=r[e];t[n.id]=n}const e=function(t){try{const e=JSON.stringify(t);return C.encode(e)}catch(t){console.error("encode JSON to Uint8Array error:",t)}}(t);e&&(n.data.featuresTypeArray=e,n.buffers=n.buffer||[],n.buffers.push(e.buffer));const i="id"===this.options.features;for(const t in r){const n=r[t];e&&delete n.geometry,i&&(r[t]=n.id)}}e(null,n.data,n.buffers)})).catch((t=>{e(t)}))}abortTile(t,e){delete this.requests[t],this._cancelLoadings(t),e()}_cancelLoadings(t){const e=this.loadings[t];if(e)for(let t=0;t<e.length;t++)e[t].callback(null,{canceled:!0});delete this.loadings[t]}_callWaitings(t,e,n){if(t)for(let r=0;r<t.length;r++)t[r].callback(e,n)}checkIfCanceled(t){return!this.requests[t]}onRemove(){this.loadings={},this._cache&&this._cache.reset(),delete this._cache,this.requests={}}fetchIconGlyphs(t,e,n){if(this.options.workerGlyph&&fn){const r=[];if(t&&Object.keys(t).length){const e=new Promise((e=>{this.upload("fetchIconGlyphs",{icons:t},null,((t,n)=>{e({err:t,iconData:n})}))}));r.push(e)}if(e&&Object.keys(e).length){const t=new Promise((t=>{this._glyphRequestor||(this._glyphRequestor=new Tn),this._glyphRequestor.getGlyphs(e,((e,n)=>{t({err:e,glyphData:n})}))}));r.push(t)}Promise.all(r).then((t=>{const e={icons:null,glyphs:null};for(let r=0;r<t.length;r++){if(t[r].err)return void n(t[r].err);t[r].iconData?e.icons=t[r].iconData.icons:t[r].glyphData&&(e.glyphs=t[r].glyphData.glyphs)}return e})).then((t=>{n(null,t)}))}else this.upload("fetchIconGlyphs",{icons:t,glyphs:e},null,n)}_createTileData(t,e,n){if(!e.length)return Promise.resolve({data:null,buffers:[]});const{glScale:r,tileInfo:i}=n,o=!this.options.style.style.length&&!this.options.style.featureStyle.length;let s=this.pluginConfig.slice(0);o&&(s=this._updateLayerPluginConfig(t)),this.featurePlugins&&function(t){for(let e=1;e<arguments.length;e++){const n=arguments[e];if(n)for(let e=0,r=n.length;e<r;e++)t.push(n[e])}t.length}(s,this.featurePlugins);const a={};for(let t=0;t<s.length;t++)Nn(e,n.tileInfo.z,s[t],a);const l=[],u=[];for(let t=0;t<e.length;t++){const n=e[t],r=a[t];if(r){u.fill(null);let t=0;for(const e in r){let i=0;const o=r[e].values();for(const t of o){let r=u[i];r||(r=Dn(n),u[i]=r),r.properties[e]=t,i++}i>t&&(t=i)}for(let e=0;e<t;e++)l.push(u[e])}else l.push(n)}const h=(e=l)[0].extent,c=i.z,f={x:i.extent2d.xmin*r,y:i.extent2d.ymax*r},p=[],d=[],g=[],y=this.options,x=[],m={},v=[Promise.resolve(n.styleCounter)];let w=0,b=-1;const M=[];let P=!1;for(let t=0;t<s.length;t++){b++;const r=s[t];r.type!==w&&(b=0,w=r.type);const a=0===r.type?p:d;jn(r.symbol,M,t),P=P||M[t]&&M[t].size>0;const{tileFeatures:l,tileFeaIndexes:u}=this._filterFeatures(c,r.type,r.filter,e,m,t);if(!l.length){a[b]=null;continue}const y=u[u.length-1],_=_n.getIndexArrayType(y);a[b]={styledFeatures:new _(u)},g.push({idx:t,typeIdx:b}),x.push(a[b].styledFeatures.buffer);const I=A({},n,{extent:h,zoom:c,tilePoint:f});if(this.options.debugTile){const t=this.options.debugTile;for(let e=0;e<t.length;e++){const{x:n,y:r,z:o}=t[e];if(i.x===n&&i.y===r&&i.z===o){I.debugIndex=t[e].index;break}}}let S=this._createTileGeometry(l,r,I);o&&(S=S.then((t=>{if(!t)return null;if(t.data)t.data.layer=l[0].layer;else if(Array.isArray(t))for(let e=0;e<t.length;e++)t[e]&&t[e].data&&(t[e].data.layer=l[0].layer);return t}))),v.push(S)}return Promise.all(v).then((([n,...r])=>{if(n!==this._styleCounter)return{canceled:!0};function i(t,e){if(void 0!==t.data.ref)return;const n=s[g[e].idx],r=n.renderPlugin.dataConfig;if(t.data.type=r.type,t.data.filter=n.filter.def,r.altitudeOffset&&(t.data.properties.minAltitude+=r.altitudeOffset,t.data.properties.maxAltitude+=r.altitudeOffset),t.buffers&&t.buffers.length)for(let e=0;e<t.buffers.length;e++)x.push(t.buffers[e])}for(let t=0;t<r.length;t++){if(!r[t])continue;const e=r[t],n=0===s[g[t].idx].type?p:d;if(Array.isArray(e)){const r=[];for(let n=0;n<e.length;n++)e[n]&&(i(e[n],t),(void 0===e[n].data.ref||e[e[n].data.ref])&&r.push(e[n].data));r.length&&(n[g[t].typeIdx].data=r)}else i(e,t),n[g[t].typeIdx].data=e.data}const o={},a=t;if(y.features||y.schema||P){let t,n=!1;for(let r=0,i=e.length;r<i;r++)if(t=e[r],a[t.layer].properties||(a[t.layer].properties=On(t.properties)),t&&(y.features||P&&m[r])){delete t.extent,delete t.properties.$layer,delete t.properties.$type,delete t.__index;const e=t.originalFeature;if(e){const e=t.properties,n=A({},t.originalFeature);delete e[Fn],n.customProps=A({},e),t=n}const i=A({},t);if(P&&m[r]&&(!y.features||"transient"===y.features)){const i=m[r];for(let r=0;r<i.length;r++){const i=M[r];i&&i.forEach((r=>{const i=e?e.properties:t.properties;i[kn]||(i[kn]=new Set),i[kn].add(r),n=!0}))}}o[r]=i}if(n)for(const t in o){const e=o[t],n=e.properties[kn];if(n){delete e.properties[kn],"transient"===y.features&&(e.fnTypeProps=A({},e.properties));for(const t in e.properties)n.has(t)||("transient"===y.features?delete e.fnTypeProps[t]:delete e.properties[t])}}}return{data:{styleCounter:n,schema:a,data:p,featureData:d,extent:h,features:o},buffers:x}})).catch((t=>{console.error(t)}))}_createTileGeometry(t,e,n){let r=t;const i=e.renderPlugin.dataConfig,o=e.symbol,s=this.options.tileSize,{extent:a,glScale:l,zScale:u,zoom:h,tilePoint:c,centimeterToPoint:f,verticalCentimeterToPoint:p}=n,d=a/s,g=i.type,y=n.debugIndex;let x=A({},i,{EXTENT:a,zoom:h,debugIndex:y,features:this.options.features,isWebGPU:this.options.isWebGPU,isWebGL1:this.options.isWebGL1});if("3d-extrusion"===g){Yn(o)&&(i.uv=1);const t=this.options.projectionCode,e=o.material&&o.material.textureWidth||Sn;return Promise.all([Promise.resolve(je(r,i,a,c,e,n.tileInfo.res,l,a/this.options.tileSize,f,p,o,h,t,y))])}if("3d-wireframe"===g)return Promise.all([Promise.resolve(Qe(r,a,o,i))]);if("point"===g){x=A(x,{requestor:this.fetchIconGlyphs.bind(this),altitudeToTileScale:u*a/this.options.tileSize/l,pluginType:e.renderPlugin.type});let t=o;return Array.isArray(o)||(t=[o]),t=t.map(((t,e)=>(t&&(t.index={index:e},t.isIconText=function(t){return t.markerType||t.markerFile}(t)),t))).filter((t=>!!t)),Promise.all(t.map((t=>{x.defaultMarkerVerticalAlignment="middle";const e=pn.genFnTypes(t);let n=r;return xn.needMerge(t,e,h)&&(n=xn.mergeLineFeatures(r,t,e,h)),new xn(n,t,x).load(d)})))}if("native-point"===g){const t=u*a/this.options.tileSize/l;return x.altitudeToTileScale=t,Vn(r,o,x,mn,d)}if("line"===g)return x=A(x,{requestor:this.fetchIconGlyphs.bind(this),tileRatio:d}),Vn(r,o,x,yn,1,!0);if("native-line"===g)return Vn(r,o,x,gn,1,!0);if("fill"===g)return x=A(x,{requestor:this.fetchIconGlyphs.bind(this)}),Vn(r,o,x,dn);if("line-extrusion"===g){delete o.lineGradientProperty,o.lineJoin="miter",o.lineCap="butt";const t=Yn(o);if(t&&(i.uv=1),x=A(x,{tileSize:s,zScale:u,glScale:l}),o.mergeOnProperty){const t=pn.genFnTypes(o);r=yn.mergeLineFeatures(r,o,t,x.zoom)}if(t){const t=[];if(!1!==i.top){const e=A({},x);e.side=!1,t.push(new vn(r,o,e))}return!1!==i.side&&(x.side=!0,x.top=!1,t.push(new vn(r,o,x))),Promise.all(t.map((t=>t.load())))}return Promise.all([new vn(r,o,x).load()])}if("circle"===g)return Vn(r,o,x,wn);if("round-tube"===g||"square-tube"===g){const t="round-tube"===g?bn:Mn;return x=A(x,{requestor:this.fetchIconGlyphs.bind(this),radialSegments:"round-tube"===g?i.radialSegments||8:4,centimeterToPoint:f,verticalCentimeterToPoint:p,tileRatio:d,isTube:!0}),Vn(r,o,x,t)}return Promise.resolve([])}_filterFeatures(t,e,n,r,i,o){const s=(ee+"").trim(),a=[],l=[],u=r.length;for(let h=0;h<u;h++)if((1===e||void 0===r[h].id||!this.styledFeatures[r[h].id])&&((!n.def||"default"===n.def)&&!i[h]||!0===n.def||n.def&&(void 0!==n.def.condition||Array.isArray(n.def))&&n(r[h],t))){const t=r[h];if(void 0===t[s]&&(t[s]=h),i[h]||(i[h]=[]),i[h].push(o),l.push(t),a.push(h),1===e)break}return{tileFeatures:l,tileFeaIndexes:a}}_compileStyle(t){const{style:e,featureStyle:n}=t,r={};n.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=Pn.compileStyle(e);for(let t=0;t<e.length;t++)i[t].filter&&(i[t].filter.def=e[t].filter?e[t].filter.value||e[t].filter:void 0),i[t].type=0;const o=[],s=Pn.compileStyle(n);for(let t=0;t<n.length;t++)s[t].type=1,s[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0,s[t].renderPlugin&&o.push(s[t]);this.pluginConfig=i,this.featurePlugins=o,this.styledFeatures=r}_updateLayerPluginConfig(t){let e=this._layerPlugins;this._layerPlugins||(e=this._layerPlugins={});const n=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],r=[];for(const o in t){const s=o;if(!e[o]){const r=[];for(let e=0;e<t[o].types.length;e++){const a=t[o].types[e],l=["all",["==","$layer",s],["==","$type",n[a]]],u={filter:(i=l,new Function("f",\`var p = (f && f.properties || {}); return ${G}en(i)}\`)),renderPlugin:Cn(a),symbol:Bn(a)};u.filter.def=l,u.type=0,r.push(u)}e[s]=r}r.push(...e[s])}var i;return r}}function Cn(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 Bn(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 On(t){if(Array.isArray(t)||!F(t))return{};const e={};for(const n in t){const r=t[n];I(r)?e[n]="string":S(r)?e[n]="number":!0===r||!1===r?e[n]="boolean":Array.isArray(r)?e[n]="array":e[n]="object"}return e}function Yn(t){if(!t)return 0;let e=0;for(const n in t){if(("normalTexture"===n||"bumpTexture"===n)&&t[n])return 2;if(n.indexOf("Texture")>0&&t[n])e=1;else if(F(t[n])){const r=Yn(t[n]);if(2===r)return r;1===r&&(e=1)}}return e}function Vn(t,e,n,r,i,o){const s={},a=Array.isArray(e)?e:[e];let l=-1;for(let t=0;t<a.length;t++)s[t]=Xn(a[t]),!s[t]&&a[t]&&-1===l&&(l=t);const u=[];for(let e=0;e<a.length;e++){if(!a[e])continue;a[e].index={index:e};let h=t;if(o&&a[e].mergeOnProperty){const r=pn.genFnTypes(a[e]);h=yn.mergeLineFeatures(t,a[0],r,n.zoom)}s[e]||e===l?u.push(new r(h,a[e],n).load(i)):u.push({data:{ref:l,symbolIndex:{index:e}}})}return Promise.all(u)}function Xn(t){if(!t)return 0;for(const e in t)if(L(t[e]))return 1;return 0}function Nn(t,e,n,r){const i=n.customProperties;if(!i)return t;if(i)for(let t=0;t<i.length;t++)i[t].fn=Pn.compileFilter(i[t].filter);for(let n=0;n<i.length;n++)for(let o=0,s=t.length;o<s;o++)if(i[n].fn(t[o],e))for(const t in i[n].properties){const e=i[n].properties[t];k(e)||(r[o]||(r[o]={}),r[o][t]||(r[o][t]=new Set),r[o][t].add(e))}}const En={get:(t,e)=>e in t?t[e]:t.originalFeature[e],has:(t,e)=>e in t||e in t.originalFeature},zn={get:function(t,e){return e in t?t[e]:t[Fn][e]},has:(t,e)=>e in t||e in t[Fn]},$n={};function Dn(t){const e={};e.originalFeature=t;const n=new Proxy(e,En);return n.properties=new Proxy({},zn),n.properties[Fn]=t.properties||$n,n}function qn(t,e,n){t[e]||(t[e]=new Set),t[e].add(n)}const Gn=[];function jn(t,e,n){if(!t)return Gn;for(const r in t){if(!t[r]||!An.checkIfZoomFnTypeSymbol(r))continue;if(L(t[r]))qn(e,n,t[r].property);else{if("lineGradientProperty"===r){qn(e,n,t[r]);continue}if("textName"===r)if(I(t[r])){const i=In.resolveVarNames(t[r]);if(i)for(let t=0;t<i.length;t++)qn(e,n,i[t])}else if(Pn.isExpression(t[r])){const i=[];In.resolveExpVarNames(i,t[r]);for(let t=0;t<i.length;t++)qn(e,n,i[t])}}const i=t[r].stops;if(i&&i.length)for(let t=0;t<i.length;t++)L(i[t][1])&&qn(e,t,i[t][1].property)}return e[n]}function Zn(t,e){Un(t.geometry,e)}function Un(t,e){if(t)switch(t.type){case"Point":Rn(t.coordinates,e);break;case"MultiPoint":case"LineString":Jn(t.coordinates,e);break;case"MultiLineString":!function(t,e){for(let n=0,r=t.length;n<r;n++)Jn(t[n],e)}(t.coordinates,e);break;case"Polygon":Hn(t.coordinates,e);break;case"MultiPolygon":!function(t,e){for(let n=0,r=t.length;n<r;n++)Hn(t[n],e)}(t.coordinates,e);break;case"GeometryCollection":const n=t.geometries.length;for(let r=0;r<n;r++)Un(t.geometries[r],e)}}function Rn(t,e){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Jn(t,e){for(let n=0,r=t.length;n<r;n++)Rn(t[n],e)}function Hn(t,e){t.length&&Jn(t[0],e)}function Wn(t,e,n,r,i){Kn(t,e,n||0,r||t.length-1,i||tr)}function Kn(t,e,n,r,i){for(;r>n;){if(r-n>600){var o=r-n+1,s=e-n+1,a=Math.log(o),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);Kn(t,e,Math.max(n,Math.floor(e-s*l/o+u)),Math.min(r,Math.floor(e+(o-s)*l/o+u)),i)}var h=t[e],c=n,f=r;for(Qn(t,n,e),i(t[r],h)>0&&Qn(t,n,r);c<f;){for(Qn(t,c,f),c++,f--;i(t[c],h)<0;)c++;for(;i(t[f],h)>0;)f--}0===i(t[n],h)?Qn(t,n,f):Qn(t,++f,r),f<=e&&(n=f+1),e<=f&&(r=f-1)}}function Qn(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function tr(t,e){return t<e?-1:t>e?1:0}class er{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!fr(t,e))return n;const r=this.toBBox,i=[];for(;e;){for(let o=0;o<e.children.length;o++){const s=e.children[o],a=e.leaf?r(s):s;fr(t,a)&&(e.leaf?n.push(s):cr(t,a)?this._all(s,n):i.push(s))}e=i.pop()}return n}collides(t){let e=this.data;if(!fr(t,e))return!1;const n=[];for(;e;){for(let r=0;r<e.children.length;r++){const i=e.children[r],o=e.leaf?this.toBBox(i):i;if(fr(t,o)){if(e.leaf||cr(t,o))return!0;n.push(i)}}e=n.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=pr([]),this}remove(t,e){if(!t)return this;let n=this.data;const r=this.toBBox(t),i=[],o=[];let s,a,l;for(;n||i.length;){if(n||(n=i.pop(),a=i[i.length-1],s=o.pop(),l=!0),n.leaf){const r=nr(t,n.children,e);if(-1!==r)return n.children.splice(r,1),i.push(n),this._condense(i),this}l||n.leaf||!cr(n,r)?a?(s++,n=a.children[s],l=!1):n=null:(i.push(n),o.push(s),s=0,a=n,n=n.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,r){const i=n-e+1;let o,s=this._maxEntries;if(i<=s)return o=pr(t.slice(e,n+1)),rr(o,this.toBBox),o;r||(r=Math.ceil(Math.log(i)/Math.log(s)),s=Math.ceil(i/Math.pow(s,r-1))),o=pr([]),o.leaf=!1,o.height=r;const a=Math.ceil(i/s),l=a*Math.ceil(Math.sqrt(s));dr(t,e,n,l,this.compareMinX);for(let i=e;i<=n;i+=l){const e=Math.min(i+l-1,n);dr(t,i,e,a,this.compareMinY);for(let n=i;n<=e;n+=a){const i=Math.min(n+a-1,e);o.children.push(this._build(t,n,i,r-1))}}return rr(o,this.toBBox),o}_chooseSubtree(t,e,n,r){for(;r.push(e),!e.leaf&&r.length-1!==n;){let n,r=1/0,s=1/0;for(let a=0;a<e.children.length;a++){const l=e.children[a],u=lr(l),h=(i=t,o=l,(Math.max(o.maxX,i.maxX)-Math.min(o.minX,i.minX))*(Math.max(o.maxY,i.maxY)-Math.min(o.minY,i.minY))-u);h<s?(s=h,r=u<r?u:r,n=l):h===s&&u<r&&(r=u,n=l)}e=n||e.children[0]}var i,o;return e}_insert(t,e,n){const r=n?t:this.toBBox(t),i=[],o=this._chooseSubtree(r,this.data,e,i);for(o.children.push(t),or(o,r);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(r,i,e)}_split(t,e){const n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);const o=this._chooseSplitIndex(n,i,r),s=pr(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,rr(n,this.toBBox),rr(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)}_splitRoot(t,e){this.data=pr([t,e]),this.data.height=t.height+1,this.data.leaf=!1,rr(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let r,i=1/0,o=1/0;for(let s=e;s<=n-e;s++){const e=ir(t,0,s,this.toBBox),a=ir(t,s,n,this.toBBox),l=hr(e,a),u=lr(e)+lr(a);l<i?(i=l,r=s,o=u<o?u:o):l===i&&u<o&&(o=u,r=s)}return r||n-e}_chooseSplitAxis(t,e,n){const r=t.leaf?this.compareMinX:sr,i=t.leaf?this.compareMinY:ar;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)}_allDistMargin(t,e,n,r){t.children.sort(r);const i=this.toBBox,o=ir(t,0,e,i),s=ir(t,n-e,n,i);let a=ur(o)+ur(s);for(let r=e;r<n-e;r++){const e=t.children[r];or(o,t.leaf?i(e):e),a+=ur(o)}for(let r=n-e-1;r>=e;r--){const e=t.children[r];or(s,t.leaf?i(e):e),a+=ur(s)}return a}_adjustParentBBoxes(t,e,n){for(let r=n;r>=0;r--)or(e[r],t)}_condense(t){for(let e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children,e.splice(e.indexOf(t[n]),1)):this.clear():rr(t[n],this.toBBox)}}function nr(t,e,n){if(!n)return e.indexOf(t);for(let r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}function rr(t,e){ir(t,0,t.children.length,e,t)}function ir(t,e,n,r,i){i||(i=pr(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let o=e;o<n;o++){const e=t.children[o];or(i,t.leaf?r(e):e)}return i}function or(t,e){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),t.maxY=Math.max(t.maxY,e.maxY),t}function sr(t,e){return t.minX-e.minX}function ar(t,e){return t.minY-e.minY}function lr(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function ur(t){return t.maxX-t.minX+(t.maxY-t.minY)}function hr(t,e){const n=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,i-n)*Math.max(0,o-r)}function cr(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function fr(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function pr(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function dr(t,e,n,r,i){const o=[e,n];for(;o.length;){if((n=o.pop())-(e=o.pop())<=r)continue;const s=e+Math.ceil((n-e)/r/2)*r;Wn(t,s,e,n,i),o.push(e,s,s,n)}}class gr{constructor(t=[],e=yr){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:n}=this,r=e[t];for(;t>0;){const i=t-1>>1,o=e[i];if(n(r,o)>=0)break;e[t]=o,t=i}e[t]=r}_down(t){const{data:e,compare:n}=this,r=this.length>>1,i=e[t];for(;t<r;){let r=1+(t<<1),o=e[r];const s=r+1;if(s<this.length&&n(e[s],o)<0&&(r=s,o=e[s]),n(o,i)>=0)break;e[t]=o,t=r}e[t]=i}}function yr(t,e){return t<e?-1:t>e?1:0}function xr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var mr={exports:{}},vr=function(t,e,n,r){var i=t[0],o=t[1],s=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);for(var a=(r-n)/2,l=0,u=a-1;l<a;u=l++){var h=e[n+2*l+0],c=e[n+2*l+1],f=e[n+2*u+0],p=e[n+2*u+1];c>o!=p>o&&i<(f-h)*(o-c)/(p-c)+h&&(s=!s)}return s},wr=function(t,e,n,r){var i=t[0],o=t[1],s=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);for(var a=r-n,l=0,u=a-1;l<a;u=l++){var h=e[l+n][0],c=e[l+n][1],f=e[u+n][0],p=e[u+n][1];c>o!=p>o&&i<(f-h)*(o-c)/(p-c)+h&&(s=!s)}return s};mr.exports=function(t,e,n,r){return e.length>0&&Array.isArray(e[0])?wr(t,e,n,r):vr(t,e,n,r)};var br=mr.exports.nested=wr;mr.exports.flat=vr;const Mr=11102230246251565e-32,Pr=134217729,_r=(3+8*Mr)*Mr;function Ar(t,e,n,r,i){let o,s,a,l,u=e[0],h=r[0],c=0,f=0;h>u==h>-u?(o=u,u=e[++c]):(o=h,h=r[++f]);let p=0;if(c<t&&f<n)for(h>u==h>-u?(s=u+o,a=o-(s-u),u=e[++c]):(s=h+o,a=o-(s-h),h=r[++f]),o=s,0!==a&&(i[p++]=a);c<t&&f<n;)h>u==h>-u?(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c]):(s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++f]),o=s,0!==a&&(i[p++]=a);for(;c<t;)s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c],o=s,0!==a&&(i[p++]=a);for(;f<n;)s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++f],o=s,0!==a&&(i[p++]=a);return 0===o&&0!==p||(i[p++]=o),p}function Ir(t){return new Float64Array(t)}const Sr=33306690738754716e-32,Tr=22204460492503146e-32,Fr=11093356479670487e-47,kr=Ir(4),Lr=Ir(8),Cr=Ir(12),Br=Ir(16),Or=Ir(4);function Yr(t,e,n,r,i,o){const s=(e-o)*(n-i),a=(t-i)*(r-o),l=s-a;if(0===s||0===a||s>0!=a>0)return l;const u=Math.abs(s+a);return Math.abs(l)>=Sr*u?l:-function(t,e,n,r,i,o,s){let a,l,u,h,c,f,p,d,g,y,x,m,v,w,b,M,P,_;const A=t-i,I=n-i,S=e-o,T=r-o;w=A*T,f=Pr*A,p=f-(f-A),d=A-p,f=Pr*T,g=f-(f-T),y=T-g,b=d*y-(w-p*g-d*g-p*y),M=S*I,f=Pr*S,p=f-(f-S),d=S-p,f=Pr*I,g=f-(f-I),y=I-g,P=d*y-(M-p*g-d*g-p*y),x=b-P,c=b-x,kr[0]=b-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-M,c=v-x,kr[1]=v-(x+c)+(c-M),_=m+x,c=_-m,kr[2]=m-(_-c)+(x-c),kr[3]=_;let F=function(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}(4,kr),k=Tr*s;if(F>=k||-F>=k)return F;if(c=t-A,a=t-(A+c)+(c-i),c=n-I,u=n-(I+c)+(c-i),c=e-S,l=e-(S+c)+(c-o),c=r-T,h=r-(T+c)+(c-o),0===a&&0===l&&0===u&&0===h)return F;if(k=Fr*s+_r*Math.abs(F),F+=A*h+T*a-(S*u+I*l),F>=k||-F>=k)return F;w=a*T,f=Pr*a,p=f-(f-a),d=a-p,f=Pr*T,g=f-(f-T),y=T-g,b=d*y-(w-p*g-d*g-p*y),M=l*I,f=Pr*l,p=f-(f-l),d=l-p,f=Pr*I,g=f-(f-I),y=I-g,P=d*y-(M-p*g-d*g-p*y),x=b-P,c=b-x,Or[0]=b-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-M,c=v-x,Or[1]=v-(x+c)+(c-M),_=m+x,c=_-m,Or[2]=m-(_-c)+(x-c),Or[3]=_;const L=Ar(4,kr,4,Or,Lr);w=A*h,f=Pr*A,p=f-(f-A),d=A-p,f=Pr*h,g=f-(f-h),y=h-g,b=d*y-(w-p*g-d*g-p*y),M=S*u,f=Pr*S,p=f-(f-S),d=S-p,f=Pr*u,g=f-(f-u),y=u-g,P=d*y-(M-p*g-d*g-p*y),x=b-P,c=b-x,Or[0]=b-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-M,c=v-x,Or[1]=v-(x+c)+(c-M),_=m+x,c=_-m,Or[2]=m-(_-c)+(x-c),Or[3]=_;const C=Ar(L,Lr,4,Or,Cr);w=a*h,f=Pr*a,p=f-(f-a),d=a-p,f=Pr*h,g=f-(f-h),y=h-g,b=d*y-(w-p*g-d*g-p*y),M=l*u,f=Pr*l,p=f-(f-l),d=l-p,f=Pr*u,g=f-(f-u),y=u-g,P=d*y-(M-p*g-d*g-p*y),x=b-P,c=b-x,Or[0]=b-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-M,c=v-x,Or[1]=v-(x+c)+(c-M),_=m+x,c=_-m,Or[2]=m-(_-c)+(x-c),Or[3]=_;const B=Ar(C,Cr,4,Or,Br);return Br[B-1]}(t,e,n,r,i,o,u)}function Vr(t,e,n){e=Math.max(0,void 0===e?2:e),n=n||0;var r=function(t){for(var e=t[0],n=t[0],r=t[0],i=t[0],o=0;o<t.length;o++){var s=t[o];s[0]<e[0]&&(e=s),s[0]>r[0]&&(r=s),s[1]<n[1]&&(n=s),s[1]>i[1]&&(i=s)}var a=[e,n,r,i],l=a.slice();for(o=0;o<t.length;o++)br(t[o],a)||l.push(t[o]);return function(t){t.sort(Rr);for(var e=[],n=0;n<t.length;n++){for(;e.length>=2&&Dr(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}for(var r=[],i=t.length-1;i>=0;i--){for(;r.length>=2&&Dr(r[r.length-2],r[r.length-1],t[i])<=0;)r.pop();r.push(t[i])}return r.pop(),e.pop(),e.concat(r)}(l)}(t),i=new er(16);i.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},i.compareMinX=function(t,e){return t[0]-e[0]},i.compareMinY=function(t,e){return t[1]-e[1]},i.load(t);for(var o,s=[],a=0;a<r.length;a++){var l=r[a];i.remove(l),o=Gr(l,o),s.push(o)}var u=new er(16);for(a=0;a<s.length;a++)u.insert(qr(s[a]));for(var h=e*e,c=n*n;s.length;){var f=s.shift(),p=f.p,d=f.next.p,g=jr(p,d);if(!(g<c)){var y=g/h;(l=Xr(i,f.prev.p,p,d,f.next.next.p,y,u))&&Math.min(jr(l,p),jr(l,d))<=y&&(s.push(f),s.push(Gr(l,f)),i.remove(l),u.remove(f),u.insert(qr(f)),u.insert(qr(f.next)))}}f=o;var x=[];do{x.push(f.p),f=f.next}while(f!==o);return x.push(f.p),x}function Xr(t,e,n,r,i,o,s){for(var a=new gr([],Nr),l=t.data;l;){for(var u=0;u<l.children.length;u++){var h=l.children[u],c=l.leaf?Zr(h,n,r):Er(n,r,h);c>o||a.push({node:h,dist:c})}for(;a.length&&!a.peek().node.children;){var f=a.pop(),p=f.node,d=Zr(p,e,n),g=Zr(p,r,i);if(f.dist<d&&f.dist<g&&$r(n,p,s)&&$r(r,p,s))return p}(l=a.pop())&&(l=l.node)}return null}function Nr(t,e){return t.dist-e.dist}function Er(t,e,n){if(zr(t,n)||zr(e,n))return 0;var r=Ur(t[0],t[1],e[0],e[1],n.minX,n.minY,n.maxX,n.minY);if(0===r)return 0;var i=Ur(t[0],t[1],e[0],e[1],n.minX,n.minY,n.minX,n.maxY);if(0===i)return 0;var o=Ur(t[0],t[1],e[0],e[1],n.maxX,n.minY,n.maxX,n.maxY);if(0===o)return 0;var s=Ur(t[0],t[1],e[0],e[1],n.minX,n.maxY,n.maxX,n.maxY);return 0===s?0:Math.min(r,i,o,s)}function zr(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function $r(t,e,n){for(var r,i,o,s,a=Math.min(t[0],e[0]),l=Math.min(t[1],e[1]),u=Math.max(t[0],e[0]),h=Math.max(t[1],e[1]),c=n.search({minX:a,minY:l,maxX:u,maxY:h}),f=0;f<c.length;f++)if(r=c[f].p,i=c[f].next.p,o=t,r!==(s=e)&&i!==o&&Dr(r,i,o)>0!=Dr(r,i,s)>0&&Dr(o,s,r)>0!=Dr(o,s,i)>0)return!1;return!0}function Dr(t,e,n){return Yr(t[0],t[1],e[0],e[1],n[0],n[1])}function qr(t){var e=t.p,n=t.next.p;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]),t.maxY=Math.max(e[1],n[1]),t}function Gr(t,e){var n={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(n.next=e.next,n.prev=e,e.next.prev=n,e.next=n):(n.prev=n,n.next=n),n}function jr(t,e){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function Zr(t,e,n){var r=e[0],i=e[1],o=n[0]-r,s=n[1]-i;if(0!==o||0!==s){var a=((t[0]-r)*o+(t[1]-i)*s)/(o*o+s*s);a>1?(r=n[0],i=n[1]):a>0&&(r+=o*a,i+=s*a)}return(o=t[0]-r)*o+(s=t[1]-i)*s}function Ur(t,e,n,r,i,o,s,a){var l,u,h,c,f=n-t,p=r-e,d=s-i,g=a-o,y=t-i,x=e-o,m=f*f+p*p,v=f*d+p*g,w=d*d+g*g,b=f*y+p*x,M=d*y+g*x,P=m*w-v*v,_=P,A=P;0===P?(u=0,_=1,c=M,A=w):(c=m*M-v*b,(u=v*M-w*b)<0?(u=0,c=M,A=w):u>_&&(u=_,c=M+v,A=w)),c<0?(c=0,-b<0?u=0:-b>m?u=_:(u=-b,_=m)):c>A&&(c=A,-b+v<0?u=0:-b+v>m?u=_:(u=-b+v,_=m));var I=(1-(h=0===c?0:c/A))*i+h*s-((1-(l=0===u?0:u/_))*t+l*n),S=(1-h)*o+h*a-((1-l)*e+l*r);return I*I+S*S}function Rr(t,e){return t[0]===e[0]?t[1]-e[1]:t[0]-e[0]}const{PackUtil:Jr}=re();class Hr{constructor(t,e){this.x=t,this.y=e}clone(){return new Hr(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 Hr(this.x-t.x,this.y-t.y)}distance(t){const e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)}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 Hr(this.y,-this.x)}}function Wr(t,e,n,r){const i=e.x*r.y-e.y*r.x,o=n.x-t.x,s=n.y-t.y,a=(o*r.y-s*r.x)/i;return new Hr(t.x+a*e.x,t.y+a*e.y)}const Kr=[],Qr=[];function ti(t){if(S(t[0]&&t[0].x)){const e=[];let n=0;for(let r=0;r<t.length;r++)Qr[n]?(Qr[n][0]=t[r].x,Qr[n][1]=t[r].y):Qr[n]=[t[r].x,t[r].y],e.push(Qr[n]),n++;t=e}try{const e=Vr(t,1/0);let n=[1/0,1/0],r=[-1/0,-1/0];for(let t=0;t<e.length;t++)e[t][0]<n[0]&&(n[0]=e[t][0]),e[t][0]>r[0]&&(r[0]=e[t][0]),e[t][1]<n[1]&&(n[1]=e[t][1]),e[t][1]>r[1]&&(r[1]=e[t][1]);const i=[];let o=[],s=0;for(let t=0;t<e.length;t++)t===e.length-1&&e[t][0]===e[0][0]&&e[t][1]===e[0][1]||(_t(i,e[t],"EPSG:3857"),Kr[s]?(Kr[s].x=i[0],Kr[s].y=i[1]):Kr[s]=new Hr(i[0],i[1]),o.push(Kr[s]),s++);Jr.calculateSignedArea(o)<0&&(o=o.reverse());const a=function(t){let e,n=Number.MAX_VALUE;const r=function(t,r,i,o,s,a,l,u){var h=Wr(t,r,s,a),c=Wr(i,o,s,a),f=Wr(l,u,t,r),p=Wr(l,u,i,o),d=h.distance(c)*h.distance(f);0!==d&&d<n&&(e=[h,f,p,c],n=d)};var i=[];for(let e=0;e<t.length;e++)i.push(t[(e+1)%t.length].diff(t[e])),i[e].normalize();var o,s,a,l,u=new Hr(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new Hr(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let e=0;e<t.length;e++){var c=t[e];c.x<u.x&&(u.x=c.x,o=e),c.x>h.x&&(h.x=c.x,s=e),c.y<u.y&&(u.y=c.y,l=e),c.y>h.y&&(h.y=c.y,a=e)}var f=new Hr(0,-1),p=new Hr(0,1),d=new Hr(-1,0),g=new Hr(1,0);for(let e=0;e<t.length;e++){var y=[Math.acos(f.dot(i[o])),Math.acos(p.dot(i[s])),Math.acos(d.dot(i[a])),Math.acos(g.dot(i[l]))];switch(y.indexOf(Math.min.apply(Math,y))){case 0:(p=(f=i[o].clone()).clone()).negate(),(g=(d=f.orthogonal()).clone()).negate(),o=(o+1)%t.length;break;case 1:(f=(p=i[s].clone()).clone()).negate(),(g=(d=f.orthogonal()).clone()).negate(),s=(s+1)%t.length;break;case 2:(g=(d=i[a].clone()).clone()).negate(),(p=(f=g.orthogonal()).clone()).negate(),a=(a+1)%t.length;break;case 3:(d=(g=i[l].clone()).clone()).negate(),(p=(f=g.orthogonal()).clone()).negate(),l=(l+1)%t.length}r(t[o],f,t[s],p,t[a],d,t[l],g)}return e}(o);if(!a||4!==a.length)return null;const l=a[0].distance(a[1]),u=a[1].distance(a[2]),h=a.map((t=>[t.x,t.y]));return h.push(+(u>l)),h}catch(t){return null}}const ei=[];function ni(t,e){const n=Array.isArray(t&&t[0]&&t[0][0]);for(let r=0;r<t.length;r++)n?t[r]=ni(t[r]):(_t(ei,t[r],e),t[r][0]=ei[0],t[r][1]=ei[1]);return t}const{PackUtil:ri}=re();class ii extends Ln{constructor(t,e,n,r,i,o){super(t,e,n,r,i),(e=e||{}).extent||(e.extent=8192),this.setData(e.data,o)}clearData(){delete this.index}setData(t,e){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 e();const n={maxZoom:24,tolerance:this.options.simplifyTolerance,extent:this.options.extent,buffer:S(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&&(n.projection=this.options.projection,"EPSG:4490"===n.projection&&(n.projection="EPSG:4326")),I(t)&&"{"!=t.substring(0,1)||t.url){const r=t.url?t.url:t;O.getJSON(r,t.url?t:{},((t,i)=>{if(t&&(console.error("Failed to fetch geojson:"+r),e(t)),!i)return void e(null,{extent:null,idMap:new Map});let o=i;if(this.options.convertFn){o=new Function("data",this.options.convertFn+"\\nreturn convert(data)")(o)}const s=Array.isArray(o)?o:o.features;this._genOMBB(s);const{sample1000:a,idMap:l}=this._generateId(s);this._generate(a,l,o,n,e)}))}else{"string"==typeof t&&(t=JSON.parse(t));const r=Array.isArray(t)?t:t.features,i=r&&r.length;this._genOMBB(r);let o=r;if(r&&i>1e3){o=[];for(let t=0;t<i;t++)oi(r[t],o,t,i)}this._generate(o,null,t,n,e)}}_genOMBB(t){if(this.options.generateOMBB&&t)for(let e=0;e<t.length;e++){const n=t[e];if(n&&n.geometry&&n.geometry.coordinates)if("Polygon"===n.geometry.type){const t=n.geometry.coordinates[0];if(!t)continue;const e=ti(t,t.length);n.properties=n.properties||{},n.properties[ne]=e}else if("MultiPolygon"===n.geometry.type){const t=n.geometry.coordinates;for(let e=0;e<t.length;e++){if(!t[e])continue;const r=t[e][0];if(!r)continue;const i=ti(r,r.length);n.properties=n.properties||{},n.properties[ne]=n.properties[ne]||[],n.properties[ne][e]=i}}}}_generate(t,e,n,r,i){try{const o=t&&t.length?function(t){let e=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];switch(t.type){case"FeatureCollection":const n=t.features.length;for(let r=0;r<n;r++)Zn(t.features[r],e);break;case"Feature":Zn(t,e);break;default:Un(t,e)}return e}({type:"FeatureCollection",features:t}):null;this.index=function(t,e){return new ht(t,e)}(n,this.options.geojsonvt||r),i(null,{extent:o,idMap:e})}catch(t){console.warn(t),i({error:t.message})}}_generateId(t){const e=[],n=new Map;let r=0;const i=this.options.featureIdProperty;if(t){const o=t.length;t.forEach(((t,s)=>{!function(t,o,s){if(!t)return;if("Feature"===t.type&&!t.geometry)return;if(S(t.id)||(t.id=r++),i){let e=i;F(i)&&(e=i[t.layer||"0"]),t.id=t.properties[e]}const a=A({},t);t.geometry?(a.geometry=A({},t.geometry),a.geometry.coordinates=null):t.coordinates&&(a.coordinates=null),n.set(t.id,a),oi(t,e,o,s)}(t,s,o)}))}return{sample1000:e,idMap:n}}getTileFeatures(t,e){const n=t.tileInfo,r=[];if(!this.index)return this.empty?(setTimeout((function(){e(null,r,[])}),1),1):(setTimeout((function(){e({loading:!0})}),1),1);const i=this.index.getTile(n.z,n.x,n.y);if(!i||0===i.features.length)return setTimeout((function(){e(null,r,[])}),1),1;const o=[];for(let t=0,e=i.features.length;t<e;t++){const e=i.features[t];let n=e.layer;void 0===n&&(n="0"),o[n]={types:{}};o[n].types[e.type]=1,e.tags=e.tags||{},e.geometry.converted||(ri.convertGeometry(e),e.geometry.converted=1),r.push({type:e.type,layer:n,id:e.id,geometry:e.geometry,properties:e.tags,extent:this.options.extent})}for(const t in o)o[t].types=Object.keys(o[t].types).map((t=>+t));return setTimeout((function(){e(null,r,o)}),1),1}onRemove(){super.onRemove(),delete this.index}}function oi(t,e,n,r){const i=Math.floor(r/998);(0===n||n===r-1||(0===i||n%i==0)&&e.length<999)&&e.push(t)}var si={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,e,n,r,i){var o,s,a=8*i-r-1,l=(1<<a)-1,u=l>>1,h=-7,c=n?i-1:0,f=n?-1:1,p=t[e+c];for(c+=f,o=p&(1<<-h)-1,p>>=-h,h+=a;h>0;o=256*o+t[e+c],c+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+t[e+c],c+=f,h-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=u}return(p?-1:1)*s*Math.pow(2,o-r)},write:function(t,e,n,r,i,o){var s,a,l,u=8*o-i-1,h=(1<<u)-1,c=h>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+c>=1?f/l:f*Math.pow(2,1-c))*l>=2&&(s++,l/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(e*l-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[n+p]=255&s,p+=d,s/=256,u-=8);t[n+p-d]|=128*g}},ai=ui,li=si;function ui(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}ui.Varint=0,ui.Fixed64=1,ui.Bytes=2,ui.Fixed32=5;var hi=4294967296,ci=1/hi,fi="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function pi(t){return t.type===ui.Bytes?t.readVarint()+t.pos:t.pos+1}function di(t,e,n){return n?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function gi(t,e,n){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));n.realloc(r);for(var i=n.pos-1;i>=t;i--)n.buf[i+r]=n.buf[i]}function yi(t,e){for(var n=0;n<t.length;n++)e.writeVarint(t[n])}function xi(t,e){for(var n=0;n<t.length;n++)e.writeSVarint(t[n])}function mi(t,e){for(var n=0;n<t.length;n++)e.writeFloat(t[n])}function vi(t,e){for(var n=0;n<t.length;n++)e.writeDouble(t[n])}function wi(t,e){for(var n=0;n<t.length;n++)e.writeBoolean(t[n])}function bi(t,e){for(var n=0;n<t.length;n++)e.writeFixed32(t[n])}function Mi(t,e){for(var n=0;n<t.length;n++)e.writeSFixed32(t[n])}function Pi(t,e){for(var n=0;n<t.length;n++)e.writeFixed64(t[n])}function _i(t,e){for(var n=0;n<t.length;n++)e.writeSFixed64(t[n])}function Ai(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Ii(t,e,n){t[n]=e,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24}function Si(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}ui.prototype={destroy:function(){this.buf=null},readFields:function(t,e,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),i=r>>3,o=this.pos;this.type=7&r,t(i,e,this),this.pos===o&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Ai(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Si(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ai(this.buf,this.pos)+Ai(this.buf,this.pos+4)*hi;return this.pos+=8,t},readSFixed64:function(){var t=Ai(this.buf,this.pos)+Si(this.buf,this.pos+4)*hi;return this.pos+=8,t},readFloat:function(){var t=li.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=li.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,n,r=this.buf;return e=127&(n=r[this.pos++]),n<128?e:(e|=(127&(n=r[this.pos++]))<<7,n<128?e:(e|=(127&(n=r[this.pos++]))<<14,n<128?e:(e|=(127&(n=r[this.pos++]))<<21,n<128?e:function(t,e,n){var r,i,o=n.buf;if(i=o[n.pos++],r=(112&i)>>4,i<128)return di(t,r,e);if(i=o[n.pos++],r|=(127&i)<<3,i<128)return di(t,r,e);if(i=o[n.pos++],r|=(127&i)<<10,i<128)return di(t,r,e);if(i=o[n.pos++],r|=(127&i)<<17,i<128)return di(t,r,e);if(i=o[n.pos++],r|=(127&i)<<24,i<128)return di(t,r,e);if(i=o[n.pos++],r|=(1&i)<<31,i<128)return di(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(n=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,e=this.pos;return this.pos=t,t-e>=12&&fi?function(t,e,n){return fi.decode(t.subarray(e,n))}(this.buf,e,t):function(t,e,n){var r="",i=e;for(;i<n;){var o,s,a,l=t[i],u=null,h=l>239?4:l>223?3:l>191?2:1;if(i+h>n)break;1===h?l<128&&(u=l):2===h?128==(192&(o=t[i+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===h?(o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&((u=(15&l)<<12|(63&o)<<6|63&s)<=2047||u>=55296&&u<=57343)&&(u=null)):4===h&&(o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&((u=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,h=1):u>65535&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),i+=h}return r}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==ui.Bytes)return t.push(this.readVarint(e));var n=pi(this);for(t=t||[];this.pos<n;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==ui.Bytes)return t.push(this.readSVarint());var e=pi(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==ui.Bytes)return t.push(this.readBoolean());var e=pi(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==ui.Bytes)return t.push(this.readFloat());var e=pi(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==ui.Bytes)return t.push(this.readDouble());var e=pi(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==ui.Bytes)return t.push(this.readFixed32());var e=pi(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==ui.Bytes)return t.push(this.readSFixed32());var e=pi(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==ui.Bytes)return t.push(this.readFixed64());var e=pi(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==ui.Bytes)return t.push(this.readSFixed64());var e=pi(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===ui.Varint)for(;this.buf[this.pos++]>127;);else if(e===ui.Bytes)this.pos=this.readVarint()+this.pos;else if(e===ui.Fixed32)this.pos+=4;else{if(e!==ui.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var n=new Uint8Array(e);n.set(this.buf),this.buf=n,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Ii(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Ii(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Ii(this.buf,-1&t,this.pos),Ii(this.buf,Math.floor(t*ci),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Ii(this.buf,-1&t,this.pos),Ii(this.buf,Math.floor(t*ci),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var n,r;t>=0?(n=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(n=~(-t%4294967296))?n=n+1|0:(n=0,r=r+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,n){n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos]=127&t}(n,0,e),function(t,e){var n=(7&t)<<4;if(e.buf[e.pos++]|=n|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(r,e)}(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 e=this.pos;this.pos=function(t,e,n){for(var r,i,o=0;o<e.length;o++){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){r>56319||o+1===e.length?(t[n++]=239,t[n++]=191,t[n++]=189):i=r;continue}if(r<56320){t[n++]=239,t[n++]=191,t[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&(t[n++]=239,t[n++]=191,t[n++]=189,i=null);r<128?t[n++]=r:(r<2048?t[n++]=r>>6|192:(r<65536?t[n++]=r>>12|224:(t[n++]=r>>18|240,t[n++]=r>>12&63|128),t[n++]=r>>6&63|128),t[n++]=63&r|128)}return n}(this.buf,t,this.pos);var n=this.pos-e;n>=128&&gi(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n},writeFloat:function(t){this.realloc(4),li.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),li.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var n=0;n<e;n++)this.buf[this.pos++]=t[n]},writeRawMessage:function(t,e){this.pos++;var n=this.pos;t(e,this);var r=this.pos-n;r>=128&&gi(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,n){this.writeTag(t,ui.Bytes),this.writeRawMessage(e,n)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,yi,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,xi,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,wi,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,mi,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,vi,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,bi,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Mi,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Pi,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,_i,e)},writeBytesField:function(t,e){this.writeTag(t,ui.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,ui.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,ui.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,ui.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,ui.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,ui.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,ui.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,ui.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,ui.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,ui.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Ti=xr(ai),Fi=ki;function ki(t,e){this.x=t,this.y=e}ki.prototype={clone:function(){return new ki(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},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 e=t.x-this.x,n=t.y-this.y;return e*e+n*n},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,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),n=Math.sin(t),r=e*this.x-n*this.y,i=n*this.x+e*this.y;return this.x=r,this.y=i,this},_rotateAround:function(t,e){var n=Math.cos(t),r=Math.sin(t),i=e.x+n*(this.x-e.x)-r*(this.y-e.y),o=e.y+r*(this.x-e.x)+n*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},ki.convert=function(t){return t instanceof ki?t:Array.isArray(t)?new ki(t[0],t[1]):t};var Li=Fi,Ci=Bi;function Bi(t,e,n,r,i){this.properties={},this.extent=n,this.type=0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=i,t.readFields(Oi,this,e)}function Oi(t,e,n){1==t?e.id=n.readVarint():2==t?function(t,e){var n=t.readVarint()+t.pos;for(;t.pos<n;){var r=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[r]=i}}(n,e):3==t?e.type=n.readVarint():4==t&&(e._geometry=n.pos)}function Yi(t){for(var e,n,r=0,i=0,o=t.length,s=o-1;i<o;s=i++)e=t[i],r+=((n=t[s]).x-e.x)*(e.y+n.y);return r}Bi.types=["Unknown","Point","LineString","Polygon"],Bi.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,n=t.readVarint()+t.pos,r=1,i=0,o=0,s=0,a=[];t.pos<n;){if(i<=0){var l=t.readVarint();r=7&l,i=l>>3}if(i--,1===r||2===r)o+=t.readSVarint(),s+=t.readSVarint(),1===r&&(e&&a.push(e),e=[]),e.push(new Li(o,s));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&a.push(e),a},Bi.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,n=1,r=0,i=0,o=0,s=1/0,a=-1/0,l=1/0,u=-1/0;t.pos<e;){if(r<=0){var h=t.readVarint();n=7&h,r=h>>3}if(r--,1===n||2===n)(i+=t.readSVarint())<s&&(s=i),i>a&&(a=i),(o+=t.readSVarint())<l&&(l=o),o>u&&(u=o);else if(7!==n)throw new Error("unknown command "+n)}return[s,l,a,u]},Bi.prototype.toGeoJSON=function(t,e,n){var r,i,o=this.extent*Math.pow(2,n),s=this.extent*t,a=this.extent*e,l=this.loadGeometry(),u=Bi.types[this.type];function h(t){for(var e=0;e<t.length;e++){var n=t[e],r=180-360*(n.y+a)/o;t[e]=[360*(n.x+s)/o-180,360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90]}}switch(this.type){case 1:var c=[];for(r=0;r<l.length;r++)c[r]=l[r][0];h(l=c);break;case 2:for(r=0;r<l.length;r++)h(l[r]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var n,r,i=[],o=0;o<e;o++){var s=Yi(t[o]);0!==s&&(void 0===r&&(r=s<0),r===s<0?(n&&i.push(n),n=[t[o]]):n.push(t[o]))}n&&i.push(n);return i}(l),r=0;r<l.length;r++)for(i=0;i<l[r].length;i++)h(l[r][i])}1===l.length?l=l[0]:u="Multi"+u;var f={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(f.id=this.id),f};var Vi=Ci,Xi=Ni;function Ni(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Ei,this,e),this.length=this._features.length}function Ei(t,e,n){15===t?e.version=n.readVarint():1===t?e.name=n.readString():5===t?e.extent=n.readVarint():2===t?e._features.push(n.pos):3===t?e._keys.push(n.readString()):4===t&&e._values.push(function(t){var e=null,n=t.readVarint()+t.pos;for(;t.pos<n;){var r=t.readVarint()>>3;e=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 e}(n))}Ni.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new Vi(this._pbf,e,this.extent,this._keys,this._values)};var zi=Xi,$i=function(t,e){this.layers=t.readFields(Di,{},e)};function Di(t,e,n){if(3===t){var r=new zi(n,n.readVarint()+n.pos);r.length&&(e[r.name]=r)}}var qi=$i;const Gi=2,ji=new TextDecoder("utf-8");class Zi extends Ln{constructor(t,e,n,r,i,o){super(t,e,n,r,i),e=e||{},o()}clearData(){this._abortRequests()}getTileFeatures(t,e){const n=t.tileInfo.url,r=t.fetchOptions||{},{altitudePropertyName:i,disableAltitudeWarning:o}=t,s=this._cache.get(n);if(s&&s.cacheIndex===t.workerCacheIndex){const{err:t,data:r}=s;return setTimeout((()=>{this._readTile(n,i,o,t,r,e)}),1)}const{tileArrayBuffer:a}=t;if(a)return setTimeout((()=>{this._readTile(n,i,o,null,a,e)}),1);r.referrer=t.referrer,r.errorLog=t.loadTileErrorLog;const{loadTileCachMaxSize:l,loadTileCacheLog:u}=t;return O.getArrayBuffer(n,r,((r,s)=>{if(this._cache){if(r)r.loading||this._cache.add(n,{err:r,data:s&&s.data,cacheIndex:t.workerCacheIndex});else if(s&&s.data){let e=!0;if("number"==typeof(h=l)&&!isNaN(h)&&l>0){const t=(a=s.data)&&a instanceof ArrayBuffer?a.byteLength/1048576:0;t>l&&(e=!1,u&&console.warn(\`url:${G}n},loadTileCachMaxSize exceeded: ${G}t} > ${G}l},the tile will not be cached.\`))}e&&this._cache.add(n,{err:null,data:s.data,cacheIndex:t.workerCacheIndex})}var a,h;this._readTile(n,i,o,r,s&&s.data,e)}}))}_readTile(t,e,n,r,i,o){if(r)return void o(r);let s;try{s=new qi(new Ti(i))}catch(r){const e=ji.decode(i);return r.message+="\\n"+t+"\\n"+e,void o(r.message,[],[])}const a=[];if(!s.layers)return void o(null,a,[]);const l={};let u;for(const t in s.layers)if(h=s.layers,c=t,Object.prototype.hasOwnProperty.call(h,c)){l[t]={types:{}};const i=l[t].types;for(let o=0,l=s.layers[t].length;o<l;o++)try{u=s.layers[t].feature(o),i[u.type]=1;const r={type:u.type,layer:t,geometry:u.loadGeometry(),properties:u.properties,extent:u.extent};void 0!==u.id&&(r.id=u.id);let l=r.properties[ne];l&&(I(l)&&(l=JSON.parse(l)),r.properties[ne]=ni(l,"EPSG:3857"));const h=e&&r.properties[e];if(h){const t=Ui(h),e=[];Ri(r.geometry,t,e),e.length&&!n&&(console.warn("feature.geometry is not consistent with altitude values:"),console.warn(JSON.stringify(r,null,2)))}a.push(r)}catch(r){console.warn("error when load vt geometry:",r)}}var h,c;for(const t in l)l[t].types=Object.keys(l[t].types).map((t=>+t));o(null,a,l,{byteLength:i.byteLength})}abortTile(t,e){const n=this.requests[t];delete this.requests[t],n&&n.abort&&n.abort(),this._cancelLoadings(t),e()}onRemove(){super.onRemove(),this._abortRequests()}_abortRequests(){for(const t in this.requests){const e=this.requests[t];e&&e.abort&&e.abort()}this.requests={}}}function Ui(t){const e=atob(t),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return new Float32Array(n.buffer)}function Ri(t,e,n,r){r||(r={index:0});for(let i=0;i<t.length;i++)if(Array.isArray(t[i]))Ri(t[i],e,n,r);else{const o=r.index;k(e[o])?n.push(Gi):t[i].z=100*e[o],r.index++}}const{LRUCache:Ji}=re();let Hi=0;const Wi=new Ji(128);class Ki{constructor(t){this._layers={},this._callbacks={},this.workerId=t}addLayer({actorId:t,mapId:e,layerId:n,params:r},i){if(this._getLayerById(e,n))return;const o=this._genKey(e,n),s=r.type,a=r.options,l=this.send.bind(this,t);this._layers[o]="GeoJSONVectorTileLayer"===s?new ii(n,a,l,Wi,{},i):new Zi(n,a,l,Wi,{},i)}removeLayer({mapId:t,layerId:e},n){const r=this._getLayerById(t,e),i=this._genKey(t,e);delete this._layers[i],r&&r.onRemove(n)}loadTile({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.loadTile(n,r)}abortTile({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.abortTile&&i.abortTile(n.url,r)}removeTile({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.removeTile(n,r)}updateStyle({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.updateStyle(n,r)}updateOptions({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.updateOptions(n,r)}setData({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.setData(n.data,r)}clearData({mapId:t,layerId:e},n){const r=this._getLayerById(t,e);r&&(r.clearData(n),this._resetCache())}receive(t){const e=t.callback,n=this._callbacks[e];delete this._callbacks[e],n&&t.error?n(new Error(t.error)):n&&n(null,t.data)}send(t,e,n,r,i){const o=i?\`${G}t}-${G}Hi++}\`:null;i&&(this._callbacks[o]=i),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:e,params:n,callback:String(o)},r||[])}_genKey(t,e){return\`${G}t}-${G}e}\`}_getLayerById(t,e){const n=this._genKey(t,e);return this._layers[n]}_resetCache(){Wi.reset()}}t.initialize=function(){},t.onmessage=function(t,e){const n=t.data;if(this.dispatcher||(this.dispatcher=new Ki(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const r=n.command,i=(n.params||{}).loadTileErrorLog,o=(n.params||{}).loadTileErrorLogIgnoreCodes||[];this.dispatcher[r]({actorId:t.actorId,mapId:n.mapId,layerId:n.layerId,params:n.params},((t,n,s)=>{if(i&&t&&!t.loading){const e=t.status;S(e)&&-1===o.indexOf(e)&&console.error(r,t)}e(t,n,s)}))}}}`;
34
+ const G = "${", B = `function(t){let e;const n={width:100,height:10};let r=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),r=!0}catch(t){r=!1}function i(){if(!e){const{width:t,height:i}=n;r?e=new OffscreenCanvas(t,i):(e=document.createElement("canvas"),e.width=t,e.height=i)}return e}class o{constructor(t,e={}){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 e=0,n=t.length;e<n;e++){const n=t[e][0];r=Math.min(n,r),i=Math.max(n,i)}this.min=r,this.max=i,this.valueOffset=this.max-this.min,this.options=Object.assign({},n,e),this._initImgData()}getImageData(){return this.imgData}_initImgData(){const t=i(),{width:e,height:n}=this.options;t.width=e,t.height=n;const r=t.getContext("2d");r.clearRect(0,0,t.width,t.height);const o=r.createLinearGradient(0,0,t.width,0),{colors:s,valueOffset:a}=this;for(let t=0,e=s.length;t<e;t++){const[e,n]=s[t],r=(e-this.min)/a;o.addColorStop(r,n)}r.fillStyle=o,r.fillRect(0,0,t.width,t.height),this.imgData=r.getImageData(0,0,t.width,t.height)}getColor(t){t=Math.max(this.min,t);const e=((t=Math.min(t,this.max))-this.min)/this.valueOffset;let n=Math.round(e*this.imgData.width);n=Math.min(n,this.imgData.width-1);const r=4*n;return[this.imgData.data[r],this.imgData.data[r+1],this.imgData.data[r+2],this.imgData.data[r+3]]}}var s;function a(t){return null==t}function l(t){return!a(t)}function u(t){return""===t}function h(t,e){var n,r,i;if(w(t)){var o,s=t.stops&&"object"==typeof t.stops[0][0],a=s||l(t.property),u=s||!a,d=t.type||e||"exponential";if("exponential"===d)o=p;else if("interval"===d)o=f;else if("categorical"===d)o=c;else if("identity"===d)o=y;else if("color-interpolate"===d)o=g;else{if("calculate-expression"!==d)throw new Error('Unknown function type "'+d+'"');o=x}if(s){var m={},v=[];for(let e=0;e<t.stops.length;e++){var b=t.stops[e];void 0===m[b[0].zoom]&&(m[b[0].zoom]={zoom:b[0].zoom,type:t.type,property:t.property,default:t.default,stops:[]}),m[b[0].zoom].stops.push([b[0].value,b[1]])}for(let t in m)v.push([m[t].zoom,h(m[t])]);n=function(e,n){const r=p({stops:v,base:t.base},e)(e,n);return"function"==typeof r?r(e,n):r},r=!1,i=!1}else u?(n=function(e){const n=o(t,e);return"function"==typeof n?n(e):n},r=!0,i=!1):(n=function(e,n){const r=o(t,n?n[t.property]:null);return"function"==typeof r?r(e,n):r},r=!1,i=!0)}else n=function(){return t},r=!0,i=!0;return n.isZoomConstant=i,n.isFeatureConstant=r,n}function c(t,e){for(let n=0;n<t.stops.length;n++)if(e===t.stops[n][0])return t.stops[n][1];return t.default}function f(t,e){for(var n=0;n<t.stops.length&&!(e<t.stops[n][0]);n++);return t.stops[Math.max(n-1,0)][1]}function p(t,e){for(var n=l(t.base)&&!u(t.base)?t.base:1,r=0;!(r>=t.stops.length||e<=t.stops[r][0]);)r++;return 0===r?t.stops[r][1]:r===t.stops.length?t.stops[r-1][1]:m(e,n,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 d={width:100,height:1};function g(t,e){const n=t.stops;if(n&&n.length>1){let t;if(s){const e=JSON.stringify(n);if(!s.has(e)){const t=new o(n,d);s.set(e,t)}t=s.get(e)}else t=new o(n,d);const[r,i,a,l]=t.getColor(e);return[r/255,i/255,a/255,l/255]}return n&&1===n.length?n[0][1]:null}function y(t,e){return n=e,r=t.default,l(n)?n:l(r)?r:l(i)?i:null;var n,r,i}function x(t,e){const n=String(t.property),r=t.expression,i=e;function o(e){return a(e)||u(e)||isNaN(e)?t.default:e}if(!l(e)||u(e)||isNaN(e)||e<0)return o(t.default);{const e=function t(e,n,r){const i=Number(r),o=String(n);return Array.isArray(e)?e.map((e=>t(e,o,i))):e===o?i:e}(r,n,i);return o(function e(n){if(!Array.isArray(n)){if("number"==typeof n)return n;throw new Error("Invalid expression format")}{const r=n[0];if(!["+","-","*","/"].includes(r))throw new Error(\`Unknown operator: ${G}r}\`);const i=n.slice(1).map((t=>e(t)));switch(r){case"+":return i.reduce(((t,e)=>t+e),0);case"-":return i.reduce(((t,e)=>t-e));case"*":return i.reduce(((t,e)=>t*e),1);case"/":return i.some((t=>0===t))?t.default:i.reduce(((t,e)=>t/e));default:throw new Error(\`Unsupported operator: ${G}r}\`)}}}(e))}}function m(t,e,n,r,i,o){return"function"==typeof i?function(){var s=i.apply(void 0,arguments),a=o.apply(void 0,arguments);return m(t,e,n,r,s,a)}:i.length?function(t,e,n,r,i,o){var s=[];for(let a=0;a<i.length;a++)s[a]=v(t,e,n,r,i[a],o[a]);return s}(t,e,n,r,i,o):v(t,e,n,r,i,o)}function v(t,e,n,r,i,o){var s,a=r-n,l=t-n;return i*(1-(s=1===e?l/a:(Math.pow(e,l)-1)/(Math.pow(e,a)-1)))+o*s}function w(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type||t.expression&&"calculate-expression"===t.type)}function b(t){return M(t,"interval")}function M(t,e){if(!w(t))return function(){return t};let n=!0,r=!0;const i=(t=JSON.parse(JSON.stringify(t))).stops;if(i)for(let t=0;t<i.length;t++)if(w(i[t][1])){const o=M(i[t][1],e);n=n&&o.isZoomConstant,r=r&&o.isFeatureConstant,i[t]=[i[t][0],o]}const o=h(t,e);return o.isZoomConstant=n&&o.isZoomConstant,o.isFeatureConstant=r&&o.isFeatureConstant,o}let P=0;const _="function"==typeof Object.assign;function A(t,...e){if(_)return Object.assign(t,...e),t;for(let n=0;n<e.length;n++){const r=e[n];for(const e in r)t[e]=r[e]}return t}function I(t){return!k(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function S(t){return"number"==typeof t&&!isNaN(t)}function T(t){return!k(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function F(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function k(t){return null==t}function L(t){return w(t)&&t.property}const C=new TextEncoder;new TextDecoder;const B="function"==typeof fetch&&"function"==typeof AbortController,O={jsonp:function(t,e){const n="_maptalks_jsonp_"+P++;t.match(/\\?/)?t+="&callback="+n:t+="?callback="+n;let r=document.createElement("script");return r.type="text/javascript",r.src=t,window[n]=function(t){e(null,t),document.getElementsByTagName("head")[0].removeChild(r),r=null,delete window[n]},document.getElementsByTagName("head")[0].appendChild(r),this},get:function(t,e,n){if(T(e)){const t=n;n=e,e=t}let r=(e=e||{}).errorLog;k(r)&&(r=!0),e.method&&(e.method=e.method.toUpperCase());const i="POST"===e.method;if(B){const i=new AbortController,o=e;o.signal=i.signal,o.referrerPolicy=o.referrerPolicy||"origin",o.method=o.method||"GET";const s=new Request(t,o);return e.returnJSON&&s.headers.set("Accept","application/json"),fetch(s).then((i=>{const o=this._parseResponse(i,e.returnJSON,e.responseType);o.message?(o.url=t,n(o)):o.then((t=>{"arraybuffer"===e.responseType?n(null,{data:t,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),contentType:i.headers.get("Content-Type")}):n(null,t)})).catch((e=>{e.code&&e.code===DOMException.ABORT_ERR||(r&&console.error("Fetch error:",t,e),n(e))}))})).catch((e=>{e.code&&e.code===DOMException.ABORT_ERR||(r&&console.error("Fetch error:",t,e),n(e))})),i}{const r=O._getClient(n);if(r.open(e.method||"GET",t,!0),e){for(const t in e.headers)r.setRequestHeader(t,e.headers[t]);r.withCredentials="include"===e.credentials,e.responseType&&(r.responseType=e.responseType)}return r.send(i?e.body:null),r}},_parseResponse:(t,e,n)=>200!==t.status?{status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${G}t.status}): ${G}t.statusText}\`}:"arraybuffer"===n?t.arrayBuffer():e?t.json():t.text(),_wrapCallback:function(t,e){return function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?e({status:200,statusText:t.statusText,message:"http status 200 returned without content."}):e(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else e(null,t.responseText);else e({status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${G}t.status}): ${G}t.statusText}\`})}},_getClient:function(t){let e;try{e=new XMLHttpRequest}catch(t){try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}return e.onreadystatechange=O._wrapCallback(e,t),e},getArrayBuffer(t,e,n){if(T(e)){const t=n;n=e,e=t}return e||(e={}),e.responseType="arraybuffer",O.get(t,e,n)}};function Y(t,e,n,r,i=3){let o=r;const s=n-e>>1;let a,l=n-e;const u=t[e],h=t[e+1],c=t[n],f=t[n+1];for(let r=e+i;r<n;r+=i){const e=V(t[r],t[r+1],u,h,c,f);if(e>o)a=r,o=e;else if(e===o){const t=Math.abs(r-s);t<l&&(a=r,l=t)}}o>r&&(a-e>i&&Y(t,e,a,r,i),t[a+2]=o,n-a>i&&Y(t,a,n,r,i))}function V(t,e,n,r,i,o){let s=i-n,a=o-r;if(0!==s||0!==a){const l=((t-n)*s+(e-r)*a)/(s*s+a*a);l>1?(n=i,r=o):l>0&&(n+=s*l,r+=a*l)}return s=t-n,a=e-r,s*s+a*a}function X(t,e,n,r,i,o){const s={id:null==t?null:t,type:e,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};i&&(s.layer=i);return function(t,e){const n=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)N(t,n,e);else if("Polygon"===r)N(t,n[0],e);else if("MultiLineString"===r)for(const r of n)N(t,r,e);else if("MultiPolygon"===r)for(const r of n)N(t,r[0],e)}(s,o?4:3),s}function N(t,e,n){for(let r=0;r<e.length;r+=n)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function E(t,e,n,r){if(r.layer=e,"FeatureCollection"===n.type)for(let e=0;e<n.features.length;e++)z(t,n.features[e],r,e);else"Feature"===n.type?z(t,n,r):z(t,{geometry:n},r)}function z(t,e,n,r){if(!e.geometry)return;const i=e.geometry.coordinates,o=e.geometry.type,s=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2);let a=[],l=e.id;if(n.promoteId?l=e.properties[n.promoteId]:n.generateId&&(l=r||0),"Point"===o)$(i,a,n);else if("MultiPoint"===o)for(const t of i)$(t,a,n);else if("LineString"===o)D(i,a,s,!1,n);else if("MultiLineString"===o){if(n.lineMetrics){for(const r of i)a=[],D(r,a,s,!1,n),t.push(X(l,"LineString",a,e.properties,n.layer,n.hasAltitude));return}q(i,a,s,!1,n)}else if("Polygon"===o)q(i,a,s,!0,n);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const i of e.geometry.geometries)z(t,{id:l,geometry:i,properties:e.properties},n,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const t of i){const e=[];q(t,e,s,!0,n),a.push(e)}}t.push(X(l,o,a,e.properties,n.layer,n.hasAltitude))}function $(t,e,n){e.push(G(t[0]),j(t[1],n.projection),0),n.hasAltitude&&(t.length>2?e.push(t[2]):e.push(0))}function D(t,e,n,r,i){let o,s,a=0;for(let n=0;n<t.length;n++){const l=G(t[n][0]),u=j(t[n][1],i.projection);e.push(l,u,0),i.hasAltitude&&(t[n].length>2?e.push(t[n][2]):e.push(0)),n>0&&(a+=r?(o*u-l*s)/2:Math.sqrt(Math.pow(l-o,2)+Math.pow(u-s,2))),o=l,s=u}const l=i.hasAltitude?4:3,u=e.length-l;e[2]=1,Y(e,0,u,n,l),e[u+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function q(t,e,n,r,i){for(let o=0;o<t.length;o++){const s=[];D(t[o],s,n,r,i),e.push(s)}}function G(t){return t/360+.5}function j(t,e){if("EPSG:4326"===e)return(90-t)/360;const n=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+n)/(1-n))/Math.PI;return r<0?0:r>1?1:r}function Z(t,e,n,r,i,o,s,a){if(r/=e,o>=(n/=e)&&s<r)return t;if(s<n||o>=r)return null;const l=[];for(const e of t){const t=e.geometry;let o=e.type;const s=0===i?e.minX:e.minY,u=0===i?e.maxX:e.maxY;if(s>=n&&u<r){l.push(e);continue}if(u<n||s>=r)continue;let h=[];if("Point"===o||"MultiPoint"===o)U(t,h,n,r,i,a.hasAltitude);else if("LineString"===o)R(t,h,n,r,i,!1,a.lineMetrics,a.hasAltitude);else if("MultiLineString"===o)H(t,h,n,r,i,!1,a.hasAltitude);else if("Polygon"===o)H(t,h,n,r,i,!0,a.hasAltitude);else if("MultiPolygon"===o)for(const e of t){const t=[];H(e,t,n,r,i,!0,a.hasAltitude),t.length&&h.push(t)}if(h.length){if(a.lineMetrics&&"LineString"===o){for(const t of h)l.push(X(e.id,o,t,e.tags,e.layer,a.hasAltitude));continue}"LineString"!==o&&"MultiLineString"!==o||(1===h.length?(o="LineString",h=h[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===h.length?"Point":"MultiPoint"),l.push(X(e.id,o,h,e.tags,e.layer,a.hasAltitude))}}return l.length?l:null}function U(t,e,n,r,i,o){const s=o?4:3;for(let a=0;a<t.length;a+=s){const s=t[a+i];s>=n&&s<=r&&(W(e,t[a],t[a+1],t[a+2]),o&&e.push(t[a+3]))}}function R(t,e,n,r,i,o,s,a){let l=J(t);const u=0===i?K:Q;let h,c,f=t.start;const p=a?4:3,d=o?t.length:t.length-p;for(let g=0;g<d;g+=p){const y=t[g],x=t[g+1],m=t[g+2];let v,w,b,M;o&&g===d-p?(v=t[0],w=t[1]):(v=t[g+p],w=t[g+p+1]),a&&(b=t[g+3],M=o&&g===d-p?t[3]:t[g+p+3]);const P=0===i?y:x,_=0===i?v:w;let A=!1;s&&(h=Math.sqrt(Math.pow(y-v,2)+Math.pow(x-w,2))),P<n?_>n&&(c=u(l,y,x,v,w,n),a&&l.push(tt(b,M,c)),s&&(l.start=f+h*c)):P>r?_<r&&(c=u(l,y,x,v,w,r),a&&l.push(tt(b,M,c)),s&&(l.start=f+h*c)):(W(l,y,x,m),a&&l.push(b)),_<n&&P>=n&&(c=u(l,y,x,v,w,n),a&&l.push(tt(b,M,c)),A=!0),_>r&&P<=r&&(c=u(l,y,x,v,w,r),a&&l.push(tt(b,M,c)),A=!0),!o&&A&&(s&&(l.end=f+h*c),e.push(l),l=J(t)),s&&(f+=h)}let g=t.length-p;if(!o){const e=t[g],o=t[g+1],s=t[g+2],u=0===i?e:o;if(u>=n&&u<=r&&W(l,e,o,s),u>=n&&u<=r&&a){const e=t[g+3];l.push(e)}}g=l.length-p,o&&g>=p&&(l[g]!==l[0]||l[g+1]!==l[1])&&(W(l,l[0],l[1],l[2]),a&&l.push(l[3])),l.length&&e.push(l)}function J(t){const e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function H(t,e,n,r,i,o,s){for(const a of t)R(a,e,n,r,i,o,!1,s)}function W(t,e,n,r){t.push(e,n,r)}function K(t,e,n,r,i,o){const s=(o-e)/(r-e);return W(t,o,n+(i-n)*s,1),s}function Q(t,e,n,r,i,o){const s=(o-n)/(i-n);return W(t,e+(r-e)*s,o,1),s}function tt(t,e,n){return t+(e-t)*n}function et(t,e,n){const r=[];for(let i=0;i<t.length;i++){const o=t[i],s=o.type;let a;if("Point"===s||"MultiPoint"===s||"LineString"===s)a=nt(o.geometry,e,n);else if("MultiLineString"===s||"Polygon"===s){a=[];for(const t of o.geometry)a.push(nt(t,e,n))}else if("MultiPolygon"===s){a=[];for(const t of o.geometry){const r=[];for(const i of t)r.push(nt(i,e,n));a.push(r)}}r.push(X(o.id,s,a,o.tags,o.layer,n))}return r}function nt(t,e,n){const r=[];r.size=t.size,void 0!==t.start&&(r.start=t.start,r.end=t.end);const i=n?4:3;for(let o=0;o<t.length;o+=i)r.push(t[o]+e,t[o+1],t[o+2]),n&&r.push(t[o+3]);return r}function rt(t,e,n){if(t.transformed)return t;const r=1<<t.z,i=t.x,o=t.y,s=n?3:2;for(const a of t.features){const t=a.geometry,l=a.type;if(a.geometry=[],1===l)for(let l=0;l<t.length;l+=s)a.geometry.push(it(t[l],t[l+1],e,r,i,o)),n&&a.geometry[a.geometry.length-1].push(t[l+2]);else for(let l=0;l<t.length;l++){const u=[];for(let a=0;a<t[l].length;a+=s)u.push(it(t[l][a],t[l][a+1],e,r,i,o)),n&&u[u.length-1].push(t[l][a+2]);a.geometry.push(u)}}return t.transformed=!0,t}function it(t,e,n,r,i,o){return[Math.round(n*(t*r-i)),Math.round(n*(e*r-o))]}function ot(t,e,n,r,i){const o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:n,y:r,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const e of t)st(s,e,o,i);return s}function st(t,e,n,r){const i=e.geometry,o=e.type,s=[],a=r.hasAltitude?4:3;if(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),"Point"===o||"MultiPoint"===o)for(let e=0;e<i.length;e+=a)s.push(i[e],i[e+1]),r.hasAltitude&&s.push(i[e+3]),t.numPoints++,t.numSimplified++;else if("LineString"===o)lt(s,i,t,n,!1,!1,r);else if("MultiLineString"===o||"Polygon"===o)for(let e=0;e<i.length;e++)lt(s,i[e],t,n,"Polygon"===o,0===e,r);else if("MultiPolygon"===o)for(let e=0;e<i.length;e++){const o=i[e];for(let e=0;e<o.length;e++)lt(s,o[e],t,n,!0,0===e,r)}if(s.length){let n=e.tags||null;if("LineString"===o&&r.lineMetrics){n={};for(const t in e.tags)n[t]=e.tags[t];n.mapbox_clip_start=i.start/i.size,n.mapbox_clip_end=i.end/i.size}const a={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:n};e.layer&&(a.layer=e.layer),null!==e.id&&(a.id=e.id),t.features.push(a)}}function at(t,e,n){return 0===t[e+2]&&t[e+3]>0&&n}function lt(t,e,n,r,i,o,s){const a=r*r,{hasAltitude:l,disableFilter:u}=s,h=l?4:3;if(!u&&r>0&&e.size<(i?a:r))return void(n.numPoints+=e.length/h);const c=[];for(let t=0;t<e.length;t+=h)(0===r||e[t+2]>a||at(e,t,l))&&(n.numSimplified++,c.push(e[t],e[t+1]),l&&c.push(e[t+3])),n.numPoints++;i&&function(t,e,n){const r=n?3:2;let i=0;for(let e=0,n=t.length,o=n-r;e<n;o=e,e+=r)i+=(t[e]-t[o])*(t[e+1]+t[o+1]);if(i>0===e){const e=r,i=r-1,o=r-2;for(let s=0,a=t.length;s<a/2;s+=r){const r=t[s],l=t[s+1];let u;n&&(u=t[s+2]),t[s]=t[a-e-s],t[s+1]=t[a-i-s],n&&(t[s+2]=t[a-o-s]),t[a-e-s]=r,t[a-i-s]=l,n&&(t[a-o-s]=u)}}}(c,o,l),t.push(c)}O.getJSON=function(t,e,n){if(T(e)){const t=n;n=e,e=t}const r=function(t,e){const r="string"==typeof e?JSON.parse(e):e||null;n(t,r)};return e&&e.jsonp?O.jsonp(t,r):((e=e||{}).returnJSON=!0,O.get(t,e,r))};const ut={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 ht{constructor(t,e){const n=(e=this.options=function(t,e){for(const n in e)t[n]=e[n];return t}(Object.create(ut),e)).debug;if(n&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=function(t,e){const n=[];if(Array.isArray(t)){for(let r=0;r<t.length;r++)E(n,t[r].layer,t[r].data,e);return n}if("FeatureCollection"===t.type)for(let r=0;r<t.features.length;r++)z(n,t.features[r],e,r);else"Feature"===t.type?z(n,t,e):z(n,{geometry:t},e);return n}(t,e);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(t,e){const n=e.buffer/e.extent;let r=t;const i=Z(t,1,-1-n,n,0,-1,2,e),o=Z(t,1,1-n,2+n,0,-1,2,e);return(i||o)&&(r=Z(t,1,-n,1+n,0,-1,2,e)||[],i&&(r=et(i,1,e.hasAltitude).concat(r)),o&&(r=r.concat(et(o,-1,e.hasAltitude)))),r}(r,e),r.length&&this.splitTile(r,0,0,0),n&&(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,e,n,r,i,o,s){const a=[t,e,n,r],l=this.options,u=l.debug;for(;a.length;){r=a.pop(),n=a.pop(),e=a.pop(),t=a.pop();const h=1<<e,c=ct(e,n,r);let f=this.tiles[c];if(!f&&(u>1&&console.time("creation"),f=this.tiles[c]=ot(t,e,n,r,l),this.tileCoords.push({z:e,x:n,y:r}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,n,r,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));const t=\`z${G}e}\`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(f.source=t,null==i){if(e===l.indexMaxZoom||f.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===i)continue;if(null!=i){const t=i-e;if(n!==o>>t||r!==s>>t)continue}}if(f.source=null,0===t.length)continue;u>1&&console.time("clipping");const p=.5*l.buffer/l.extent,d=.5-p,g=.5+p,y=1+p;let x=null,m=null,v=null,w=null,b=Z(t,h,n-p,n+g,0,f.minX,f.maxX,l),M=Z(t,h,n+d,n+y,0,f.minX,f.maxX,l);t=null,b&&(x=Z(b,h,r-p,r+g,1,f.minY,f.maxY,l),m=Z(b,h,r+d,r+y,1,f.minY,f.maxY,l),b=null),M&&(v=Z(M,h,r-p,r+g,1,f.minY,f.maxY,l),w=Z(M,h,r+d,r+y,1,f.minY,f.maxY,l),M=null),u>1&&console.timeEnd("clipping"),a.push(x||[],e+1,2*n,2*r),a.push(m||[],e+1,2*n,2*r+1),a.push(v||[],e+1,2*n+1,2*r),a.push(w||[],e+1,2*n+1,2*r+1)}}getTile(t,e,n){t=+t,e=+e,n=+n;const r=this.options,{extent:i,debug:o}=r,{hasAltitude:s,wrapX:a}=r;if(t<0||t>24)return null;if(a){const n=1<<t;e=e+n&n-1}const l=ct(t,e,n);if(this.tiles[l])return rt(this.tiles[l],i,s);o>1&&console.log("drilling down to z%d-%d-%d",t,e,n);let u,h=t,c=e,f=n;for(;!u&&h>0;)h--,c>>=1,f>>=1,u=this.tiles[ct(h,c,f)];return u&&u.source?(o>1&&(console.log("found parent tile z%d-%d-%d",h,c,f),console.time("drilling down")),this.splitTile(u.source,h,c,f,t,e,n),o>1&&console.timeEnd("drilling down"),this.tiles[l]?rt(this.tiles[l],i,s):null):null}}function ct(t,e,n){return 32*((1<<t)*n+e)+t}function ft(t,e,n,r,i,o,s){const a=n&&Array.isArray(n[0]);for(let l=0,u=n.length;l<u;l++){t[e]=(a?n[l][0]:n[l].x)*r,t[e+1]=(a?n[l][1]:n[l].y)*r,s!==Float32Array&&(t[e]=Math.round(t[e]),t[e+1]=Math.round(t[e+1]));let h=i||0;Array.isArray(i)&&(h=i[l]),h=h?Math.round(r*h):0,t[e+2]=h,e+=3,o&&0!==l&&l!==u-1&&(t[e]=t[e-3],t[e+1]=t[e-2],t[e+2]=t[e-1],e+=3)}return t.trySetLength&&t.trySetLength(e),e}function pt(t,e,n,r){const i=t[3*e],o=t[3*e+1],s=t[3*n],a=t[3*n+1];return i===s&&(i<0||i>r)||o===a&&(o<0||o>r)}var dt="undefined"!=typeof Float32Array?Float32Array:Array;function gt(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function yt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function xt(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t}function mt(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t[3]=e[3]/n[3],t}function vt(t,e,n){return t[0]=e,t[1]=n,t}function wt(t,e){var n=e[0]-t[0],r=e[1]-t[1];return Math.hypot(n,r)}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),function(){var t,e=(t=new dt(3),dt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t)}(),function(){var t,e=(t=new dt(4),dt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}(),function(){var t,e=(t=new dt(2),dt!=Float32Array&&(t[0]=0,t[1]=0),t)}();const bt=Math.PI/180,Mt=6378137*Math.PI/180,Pt=85.0511287798;function _t(t,e,n){if("EPSG:3857"===n)return function(t,e){const n=Pt,r=e[0],i=Math.max(Math.min(n,e[1]),-n);let o;o=0===i?0:Math.log(Math.tan((90+i)*bt/2))/bt;return t[0]=r*Mt,t[1]=o*Mt,t}(t,e);if("EPSG:4326"===n||"EPSG:4490"===n||"identity"===n)return At(t,e);if("baidu"===n)return At(t,e);throw new Error("unsupported projection:"+n)}function At(t,e){return t[0]=e[0],t[1]=e[1],t}function It(t,e,n,r,i,o,s,a,l,u,h,c,f,p,d){0===t?function(t,e,n,r,i,o,s,a,l,u){const h=1/(100*o[0]),c=1/(100*o[1]),f=u&&u[0]||0,p=u&&u[1]||0,d=[0,0];for(let i=t;i<e;i+=3){const t=i/3*2,e=r[i]-f,o=r[i+1]-p;n[t]=d[0]+e/s*h/a,n[t+1]=d[1]-o/s*c/l}}(e,n,r,i,0,s,a,l,u,d):1===t&&function(t,e,n,r,i,o,s,a,l,u,h){if(!t)return;let c,f,p,d;0===t[4]?(c=t[0],f=t[1],p=t[2],d=t[3]):(c=t[1],f=t[2],p=t[3],d=t[0]);const g=wt(c,f),y=wt(f,p),x=[],m=[],v=[];for(let t=e;t<n;t+=3){const e=t/3*2;vt(x,(o.x/l+i[t]/s)*a,o.y/l*a+(h?i[t+1]:-i[t+1])/s*a),"EPSG:4326"!==u&&"EPSG:4490"!==u||_t(x,x,"EPSG:3857"),St(m,x,c,f),St(v,x,d,c),r[e]=wt(c,m)/g,r[e+1]=wt(c,v)/y}}(h,e,n,r,i,o,a,c,f,p,!!d)}function St(t,e,n,r){const i=n[0]-r[0],o=n[1]-r[1];let s=(e[0]-n[0])*(n[0]-r[0])+(e[1]-n[1])*(n[1]-r[1]);return s/=i*i+o*o,t[0]=n[0]+s*i,t[1]=n[1]+s*o,t}function Tt(t,e,n,r,i){const o=3*e[n-1],s=3*e[n-1]+1,a=t[o],l=t[s];return u=r,h=i,c=a,f=l,Math.sqrt((c-u)*(c-u)+(f-h)*(f-h));var u,h,c,f}function Ft(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let o=kt(t,0,i,n,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,u;if(r&&(o=function(t,e,n,r){const i=[];for(let n=0,o=e.length;n<o;n++){const s=kt(t,e[n]*r,n<o-1?e[n+1]*r:t.length,r,!1);s===s.next&&(s.steiner=!0),i.push($t(s))}i.sort(Xt);for(let t=0;t<i.length;t++)n=Nt(i[t],n);return n}(t,e,o,n)),t.length>80*n){a=1/0,l=1/0;let e=-1/0,r=-1/0;for(let o=n;o<i;o+=n){const n=t[o],i=t[o+1];n<a&&(a=n),i<l&&(l=i),n>e&&(e=n),i>r&&(r=i)}u=Math.max(e-a,r-l),u=0!==u?32767/u:0}return Ct(o,s,n,a,l,u,0),s}function kt(t,e,n,r,i){let o;if(i===function(t,e,n,r){let i=0;for(let o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}(t,e,n,r)>0)for(let i=e;i<n;i+=r)o=Kt(i/r|0,t[i],t[i+1],o);else for(let i=n-r;i>=e;i-=r)o=Kt(i/r|0,t[i],t[i+1],o);return o&&Zt(o,o.next)&&(Qt(o),o=o.next),o}function Lt(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!Zt(r,r.next)&&0!==jt(r.prev,r,r.next))r=r.next;else{if(Qt(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function Ct(t,e,n,r,i,o,s){if(!t)return;!s&&o&&function(t,e,n,r){let i=t;do{0===i.z&&(i.z=zt(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,n=1;do{let r,i=t;t=null;let o=null;for(e=0;i;){e++;let s=i,a=0;for(let t=0;t<n&&(a++,s=s.nextZ,s);t++);let l=n;for(;a>0||l>0&&s;)0!==a&&(0===l||!s||i.z<=s.z)?(r=i,i=i.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;i=s}o.nextZ=null,n*=2}while(e>1)}(i)}(t,r,i,o);let a=t;for(;t.prev!==t.next;){const l=t.prev,u=t.next;if(o?Ot(t,r,i,o):Bt(t))e.push(l.i,t.i,u.i),Qt(t),t=u.next,a=u.next;else if((t=u)===a){s?1===s?Ct(t=Yt(Lt(t),e),e,n,r,i,o,2):2===s&&Vt(t,e,n,r,i,o):Ct(Lt(t),e,n,r,i,o,1);break}}}function Bt(t){const e=t.prev,n=t,r=t.next;if(jt(e,n,r)>=0)return!1;const i=e.x,o=n.x,s=r.x,a=e.y,l=n.y,u=r.y,h=Math.min(i,o,s),c=Math.min(a,l,u),f=Math.max(i,o,s),p=Math.max(a,l,u);let d=r.next;for(;d!==e;){if(d.x>=h&&d.x<=f&&d.y>=c&&d.y<=p&&qt(i,a,o,l,s,u,d.x,d.y)&&jt(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Ot(t,e,n,r){const i=t.prev,o=t,s=t.next;if(jt(i,o,s)>=0)return!1;const a=i.x,l=o.x,u=s.x,h=i.y,c=o.y,f=s.y,p=Math.min(a,l,u),d=Math.min(h,c,f),g=Math.max(a,l,u),y=Math.max(h,c,f),x=zt(p,d,e,n,r),m=zt(g,y,e,n,r);let v=t.prevZ,w=t.nextZ;for(;v&&v.z>=x&&w&&w.z<=m;){if(v.x>=p&&v.x<=g&&v.y>=d&&v.y<=y&&v!==i&&v!==s&&qt(a,h,l,c,u,f,v.x,v.y)&&jt(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,w.x>=p&&w.x<=g&&w.y>=d&&w.y<=y&&w!==i&&w!==s&&qt(a,h,l,c,u,f,w.x,w.y)&&jt(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;v&&v.z>=x;){if(v.x>=p&&v.x<=g&&v.y>=d&&v.y<=y&&v!==i&&v!==s&&qt(a,h,l,c,u,f,v.x,v.y)&&jt(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;w&&w.z<=m;){if(w.x>=p&&w.x<=g&&w.y>=d&&w.y<=y&&w!==i&&w!==s&&qt(a,h,l,c,u,f,w.x,w.y)&&jt(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function Yt(t,e){let n=t;do{const r=n.prev,i=n.next.next;!Zt(r,i)&&Ut(r,n,n.next,i)&&Ht(r,i)&&Ht(i,r)&&(e.push(r.i,n.i,i.i),Qt(n),Qt(n.next),n=t=i),n=n.next}while(n!==t);return Lt(n)}function Vt(t,e,n,r,i,o){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&Gt(s,t)){let a=Wt(s,t);return s=Lt(s,s.next),a=Lt(a,a.next),Ct(s,e,n,r,i,o,0),void Ct(a,e,n,r,i,o,0)}t=t.next}s=s.next}while(s!==t)}function Xt(t,e){let n=t.x-e.x;if(0===n&&(n=t.y-e.y,0===n)){n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return n}function Nt(t,e){const n=function(t,e){let n=e;const r=t.x,i=t.y;let o,s=-1/0;if(Zt(t,n))return n;do{if(Zt(t,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const t=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>s&&(s=t,o=n.x<n.next.x?n:n.next,t===r))return o}n=n.next}while(n!==e);if(!o)return null;const a=o,l=o.x,u=o.y;let h=1/0;n=o;do{if(r>=n.x&&n.x>=l&&r!==n.x&&Dt(i<u?r:s,i,l,u,i<u?s:r,i,n.x,n.y)){const e=Math.abs(i-n.y)/(r-n.x);Ht(n,t)&&(e<h||e===h&&(n.x>o.x||n.x===o.x&&Et(o,n)))&&(o=n,h=e)}n=n.next}while(n!==a);return o}(t,e);if(!n)return e;const r=Wt(n,t);return Lt(r,r.next),Lt(n,n.next)}function Et(t,e){return jt(t.prev,t,e.prev)<0&&jt(e.next,t,t.next)<0}function zt(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function $t(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function Dt(t,e,n,r,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(r-a)>=(n-s)*(e-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function qt(t,e,n,r,i,o,s,a){return!(t===s&&e===a)&&Dt(t,e,n,r,i,o,s,a)}function Gt(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Ut(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Ht(t,e)&&Ht(e,t)&&function(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(jt(t.prev,t,e.prev)||jt(t,e.prev,e))||Zt(t,e)&&jt(t.prev,t,t.next)>0&&jt(e.prev,e,e.next)>0)}function jt(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Zt(t,e){return t.x===e.x&&t.y===e.y}function Ut(t,e,n,r){const i=Jt(jt(t,e,n)),o=Jt(jt(t,e,r)),s=Jt(jt(n,r,t)),a=Jt(jt(n,r,e));return i!==o&&s!==a||(!(0!==i||!Rt(t,n,e))||(!(0!==o||!Rt(t,r,e))||(!(0!==s||!Rt(n,t,r))||!(0!==a||!Rt(n,e,r)))))}function Rt(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Jt(t){return t>0?1:t<0?-1:0}function Ht(t,e){return jt(t.prev,t,t.next)<0?jt(t,e,t.next)>=0&&jt(t,t.prev,e)>=0:jt(t,e,t.prev)<0||jt(t,t.next,e)<0}function Wt(t,e){const n=te(t.i,t.x,t.y),r=te(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function Kt(t,e,n,r){const i=te(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Qt(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 te(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}const ee="__fea_idx";new Float32Array([-1e12])[0];const ne="maptalks_ombb";function re(){return function(){if("undefined"!=typeof undefinedThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof undefined)return global;throw new Error("unable to locate global object")}().maptalks_vt_packers}const{PackUtil:ie,ArrayPool:oe}=re();function se(t,e,n,r,i,o,s,a,l,u,h,c,f,p,d,g,y){const x=e.getLength(),m=i/3;for(let n=2,r=x;n<r;n+=3)t[i+n-2]=e[n-2],t[i+n-1]=e[n-1],t[i+n-0]=e[n]-s;i+=x;for(let n=2,r=x;n<r;n+=3)t[i+n-2]=e[n-2],t[i+n-1]=e[n-1],t[i+n-0]=e[n]-a;i+=x,t.trySetLength(i+x),t.copyWithin(i,i-2*x,i-x),i+=x,t.trySetLength(i+x),t.copyWithin(i,i-2*x,i-x),i+=x,(n=n||[]).push(x/3);const v=n.getLength();for(let e=0;e<v;e++){ae(m+(n[e-1]||0),m+n[e],t,x/3,l,r,u,h,c,f,o,p,d,g,y)}return i}function ae(t,e,n,r,i,o,s,a,l,u,h,c,f,p,d){const g=o.getLength();let y,x;for(let s=t,a=e;s<a-1;s++)if(y=s,x=s+1,i===1/0||!pt(n,y,x,i))if((s-t)%2==1&&(y+=2*r,x+=2*r),d){let t=o.currentIndex;o[t++]=y+r,o[t++]=x,o[t++]=y,o[t++]=x+r,o[t++]=x,o[t++]=y+r,o.currentIndex=t}else{let t=o.currentIndex;o[t++]=y+r,o[t++]=y,o[t++]=x,o[t++]=x,o[t++]=x+r,o[t++]=y+r,o.currentIndex=t}s&&function(t,e,n,r,i,o,s,a,l,u,h,c){let f,p=0,d=0,g=0,y=0;const x=c?[1,3,4]:[2,3,4];for(let c=o.getLength()-1;c>=s;c--){const s=o[c],m=3*s+1,v=3*s+2,w=i[3*s],b=i[m],M=i[v];p||d||(p=Math.max(i[v],i[3*o[c-3]+2]),d=Math.min(i[v],i[3*o[c-3]+2]),f=p-d);let P=g;const _=c%6;0===t?(5===_&&(y=Tt(i,o,c,w,b)),P=_===x[0]||_===x[1]||_===x[2]?g:g+y):1===t&&(_===x[0]||_===x[1]||_===x[2]?P=0:5===_?(y=Tt(i,o,c,w,b),P=y):P=y);const A=P/u*(1/(100*h))/a;let I;I=1===e?M===p?1:0:"bottom"===n?M===p?f/100/l:0:M===p?0:-f/100/l,r[2*s]=A,r[2*s+1]=I,0===_&&(g+=y)}}(a,l,u,h,n,o,g,c[0],c[1],f,p,d)}function le(t){const e=[t[0]];let n=t[0];for(let r=1;r<t.length;r++)Array.isArray(t[r])?t[r][0]===n[0]&&t[r][1]===n[1]&&t[r][2]===n[2]||e.push(t[r]):t[r].x===n.x&&t[r].y===n.y&&t[r].z===n.z||e.push(t[r]),n=t[r];return e}var ue="undefined"!=typeof Float32Array?Float32Array:Array;function he(){var t=new ue(3);return ue!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function ce(t,e,n){var r=new ue(3);return r[0]=t,r[1]=e,r[2]=n,r}function fe(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function pe(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function de(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function ge(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;return o>0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t}function ye(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xe(t,e,n){var r=e[0],i=e[1],o=e[2],s=n[0],a=n[1],l=n[2];return t[0]=i*l-o*a,t[1]=o*s-r*l,t[2]=r*a-i*s,t}var me=function(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t};function ve(){var t=new ue(4);return ue!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function we(t,e){var n=e[0]+e[4]+e[8],r=void 0;if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var o=(i+1)%3,s=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*s+s]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*o+s]-e[3*s+o])*r,t[o]=(e[3*o+i]+e[3*i+o])*r,t[s]=(e[3*s+i]+e[3*i+s])*r}return t}!function(){var t=he()}(),function(){var t,e=(t=new ue(4),ue!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var be,Me=function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t},Pe=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=n*n+r*r+i*i+o*o;return s>0&&(s=1/Math.sqrt(s),t[0]=n*s,t[1]=r*s,t[2]=i*s,t[3]=o*s),t};he(),ce(1,0,0),ce(0,1,0),ve(),ve(),be=new ue(9),ue!=Float32Array&&(be[1]=0,be[2]=0,be[3]=0,be[5]=0,be[6]=0,be[7]=0),be[0]=1,be[4]=1,be[8]=1;\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */\nconst _e=8,Ae=[],Ie=[],Se=[],Te=[];function Fe(t,e,n){const r=xe(Ie,e,n),i=function(t,e,n,r,i,o,s,a,l,u){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=s,t[6]=a,t[7]=l,t[8]=u,t}(Ae,n[0],n[1],n[2],...r,...e);t=we(t,i),t=function(t){return t[3]<0?Me(t,t,-1):t}(t=Pe(t,t));const o=1/((1<<2*_e-1)-1);if(t[3]<o){t[3]=o;const e=Math.sqrt(1-o*o);t[0]*=e,t[1]*=e,t[2]*=e}const s=n[3]>0?xe(Se,n,e):xe(Se,e,n);return ye(xe(Te,n,e),s)<0&&Me(t,t,-1),t}const ke=[];const Le=[],Ce=[],Be=[],Oe=[],Ye=[],Ve=[],Xe=[];function Ne(t,e,n,r,i,o){pe(Oe,t[3*e],t[3*e+1],t[3*e+2]),pe(Ye,t[3*n],t[3*n+1],t[3*n+2]),pe(Ve,t[3*r],t[3*r+1],t[3*r+2]);const s=me(Le,Ve,Ye),a=me(Ce,Oe,Ye),l=xe(Be,s,a);ge(Xe,l),i[3*e]=i[3*e]||0,i[3*n]=i[3*n]||0,i[3*r]=i[3*r]||0,i[3*e+1]=i[3*e+1]||0,i[3*n+1]=i[3*n+1]||0,i[3*r+1]=i[3*r+1]||0,i[3*e+2]=i[3*e+2]||0,i[3*n+2]=i[3*n+2]||0,i[3*r+2]=i[3*r+2]||0,i[3*e]+=Xe[0],i[3*n]+=Xe[0],i[3*r]+=Xe[0],i[3*e+1]+=Xe[1],i[3*n+1]+=Xe[1],i[3*r+1]+=Xe[1],i[3*e+2]+=Xe[2],i[3*n+2]+=Xe[2],i[3*r+2]+=Xe[2],o[e]+=1,o[n]+=1,o[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 Ee(t,e,n){return t[0]=e[n],t[1]=e[n+1],t[2]=e[n+2],t}function ze(t,e,n){return t[0]=e[n],t[1]=e[n+1],t}const{StyleUtil:$e,PackUtil:De,ArrayPool:qe}=re(),Ge=qe.getInstance();function je(t,e,n,r,i,o,s,a,l,u,h,c,f,p,d,g){void 0===e.top&&(e.top=!0),void 0===e.side&&(e.side=!0),Ge.reset();const{altitudeScale:y,altitudeProperty:x,defaultAltitude:m,heightProperty:v,minHeightProperty:P,defaultHeight:_,tangent:A,uv:I,topUVMode:T,sideUVMode:F,sideVerticalUVMode:k,top:C,side:B,textureYOrigin:O,topThickness:Y}=e,V=function(t,e,{altitudeScale:n,altitudeProperty:r,defaultAltitude:i,heightProperty:o,minHeightProperty:s,defaultHeight:a},{center:l,side:u,top:h,topThickness:c,uvOrigin:f,uv:p,uvSize:d,topUVMode:g,sideUVMode:y,sideVerticalUVMode:x,textureYOrigin:m,tileRatio:v,centimeterToPoint:w,verticalCentimeterToPoint:b,positionType:M,res:P,glScale:_,projectionCode:A},I,T){let F=e/t[0].extent;e===1/0&&(F=1);const k=e===1/0,L=T.get(),C=T.get(),B=T.get(),O=T.getProxy(),Y=T.get(),V=T.get(),X=T.get(),N=!!p,E=!!h,z=!!u,$=N?T.get():null;function D(t,n,r,i,o,s){let a=n;if(E){const u=Ft(O,r,3);if(0===u.length)return n;let h=O.getLength(),p=Y.currentIndex;for(let t=0;t<h;t++)Y[p++]=O[t];if(Y.currentIndex=p,n+=O.getLength(),s)for(let e=2,n=u.length;e<n;e+=3)u[e]+=t/3,u[e-1]+=t/3,u[e-2]+=t/3;else{let e;for(let n=2,r=u.length;n<r;n+=3)e=u[n-1],u[n-1]=u[n]+t/3,u[n]=e+t/3,u[n-2]+=t/3}h=u.length,p=V.currentIndex;for(let t=0;t<h;t++)V[p++]=u[t];V.currentIndex=p,N&&It(g||0,t,n,$,Y,f,w,v,d[0],d[1],o,P,_,A,l),c>0&&!z&&(n=se(Y,O,r,V,n,$,0,c,e,N,y||0,x||0,m,d,v,b,i<0?!s:s)),X.setLength(n/3),X.fill(1,a/3,n/3)}if(z){E&&(c=0),a=n,n=se(Y,O,r,V,n,$,c,i,e,N,y||0,x||0,m,d,v,b,i<0?!s:s),X.setLength(n/3);const t=O.getLength()/3;X.fill(1,a/3,a/3+t),X.fill(0,a/3+t,a/3+2*t),X.fill(1,a/3+2*t,a/3+3*t),X.fill(0,a/3+3*t,n/3)}return n}let q=-1/0,G=1/0,j=0;const Z=[-1,-1,e+1,e+1];let U=0,R=t.length;S(I)&&(U=I,R=I+1);let J=0,H=!1;const W=T.getProxy();let K,Q=!1;for(;U<R;U++){const l=t[U],u=l.id;S(u)&&(Math.abs(u)>J&&(J=Math.abs(u)),u<0&&(H=!0));const h=l.geometry,c=l.properties[ne];let f=Array.isArray(c&&c[0]&&c[0][0])?c[0]:c;const{altitude:p,height:d}=ie.getFeaAltitudeAndHeight(l,n,r,i,o,a,s);d<0?(Q=!0,G=Math.min(p,G),q=Math.max(p-d,q)):(q=Math.max(p,q),G=Math.min(p-d,G));const g=Y.getLength();let y=0,x=j;W.setLength(0),O.setLength(0);const m=ie.calculateSignedArea(h[0])<0;for(let t=0,n=h.length;t<n;t++){let r=h[t];m&&(r=r.reverse()),r=le(r);const i=ie.calculateSignedArea(r)<0;if(!i&&t>0&&(y++,f=c&&c[y],j=D(x,j,W,d*F,f,k),O.setLength(0),W.setLength(0),x=j),e!==1/0&&(r=ie.clipPolygon(r,Z)),!r.length){t===n-1&&(j=D(x,j,W,d*F,f,k));continue}const o=r.length;if(Array.isArray(r[0])?r[0][0]===r[o-1][0]&&r[0][1]===r[o-1][1]||r.push([r[0][0],r[0][1]]):r[0].x===r[o-1].x&&r[0].y===r[o-1].y||r.push(r[0]),i){let t=W.currentIndex;W[t++]=O.getLength()/3,W.currentIndex=t}ft(O,O.getLength(),r,F,p,!1,M),t===n-1&&(j=D(x,j,W,d*F,f,k))}const v=Y.getLength()-g,w=(ee+"").trim();for(let t=0;t<v/3;t++){let t=C.currentIndex;C[t++]=void 0===l[w]?U:l[w],C.currentIndex=t,t=L.currentIndex,L[t++]=U,L.currentIndex=t,S(u)&&(t=B.currentIndex,B[t++]=u,B.currentIndex=t)}}K=l?Float32Array:ie.getUnsignedArrayType(C.getLength()?C[C.getLength()-1]:0);const tt={hasNegativeHeight:Q,maxAltitude:q===-1/0?0:q,minAltitude:G===1/0?0:G,vertices:Y,verticeTypes:X,indices:V,pickingIds:oe.createTypedArray(C,K),featureIndexes:L};if(B.getLength()){const t=H?ie.getPosArrayType(J):ie.getUnsignedArrayType(J);tt.featureIds=oe.createTypedArray(B,t)}else tt.featureIds=[];return $&&($.setLength(Y.getLength()/3*2),tt.uvs=$),tt}(t,n,{altitudeScale:y,altitudeProperty:x,defaultAltitude:m||0,heightProperty:v,minHeightProperty:P,defaultHeight:_||0},{center:g,top:C,side:B,topThickness:10*Y||0,uv:I||A,uvSize:[i,i],uvOrigin:r,topUVMode:T,sideUVMode:F,sideVerticalUVMode:k,textureYOrigin:O,tileRatio:a,centimeterToPoint:l,verticalCentimeterToPoint:u,positionType:d,res:o,glScale:s,projectionCode:f},p,Ge),X=[],N=V.vertices.getLength()/3,E=De.getIndexArrayType(N),z=qe.createTypedArray(V.indices,E);delete V.indices,X.push(z.buffer,V.pickingIds.buffer);const $=Math.max(Math.abs(V.maxAltitude),Math.abs(V.minAltitude)),D=De.getPosArrayType(Math.max(512,$));V.vertices=qe.createTypedArray(V.vertices,D);const q=A?Ge.getProxy():new Float32Array(3*N);q.setLength&&q.setLength(3*N);const G=function(t,e,n){const r=n||[];r.setLength&&r.setLength(t.length);const i=ke;i.length<t.length/3&&(i.length=t.length/3),i.fill(0,0,t.length/3);const o=void 0===e.length?e:e.length;for(let n=0;n<o/3;n++)void 0===e.length?Ne(t,3*n,3*n+1,3*n+2,r,i):Ne(t,e[3*n],e[3*n+1],e[3*n+2],r,i);for(let t=0;t<r.length;t+=3){const e=i[t/3];0!==e?(r[t]/=e,r[t+1]/=e,r[t+2]/=e):(r[t]=0,r[t+1]=0,r[t+2]=0)}return r}(V.vertices,z,q);let j=!0;const Z=G.getLength?G.getLength():G.length;for(let t=0;t<Z;t++){G[t]=-G[t];const e=G[t]%1;1-Math.abs(e)>1e-6?j=!1:0!==e&&(G[t]=Math.round(G[t]))}if(V.normals=G,A){let t=Ge.get();t.setLength(4*N),t=function(t,e,n,r,i){const o=t.length/3,s=i||new Array(4*o),a=[],l=[];for(let t=0;t<o;t++)a[t]=[0,0,0],l[t]=[0,0,0];const u=[0,0,0],h=[0,0,0],c=[0,0,0],f=[0,0],p=[0,0],d=[0,0],g=[0,0,0],y=[0,0,0];function x(e,r,i){Ee(u,t,3*e),Ee(h,t,3*r),Ee(c,t,3*i),ze(f,n,2*e),ze(p,n,2*r),ze(d,n,2*i);const o=h[0]-u[0],s=c[0]-u[0],x=h[1]-u[1],m=c[1]-u[1],v=h[2]-u[2],w=c[2]-u[2],b=p[0]-f[0],M=d[0]-f[0],P=p[1]-f[1],_=d[1]-f[1],A=1/(b*_-M*P);pe(g,(_*o-P*s)*A,(_*x-P*m)*A,(_*v-P*w)*A),pe(y,(b*s-M*o)*A,(b*m-M*x)*A,(b*w-M*v)*A),de(a[e],a[e],g),de(a[r],a[r],g),de(a[i],a[i],g),de(l[e],l[e],y),de(l[r],l[r],y),de(l[i],l[i],y)}for(let t=0,e=r.length;t<e;t+=3)x(r[t+0],r[t+1],r[t+2]);const m=[],v=[],w=[],b=[];let M,P,_;function A(t){Ee(w,e,3*t),fe(b,w),P=a[t],fe(m,P),me(m,m,function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}(w,w,ye(w,P))),ge(m,m),xe(v,b,P),_=ye(v,l[t]),M=_<0?-1:1,s[4*t]=m[0],s[4*t+1]=m[1],s[4*t+2]=m[2],s[4*t+3]=M}for(let t=0,e=r.length;t<e;t+=3)A(r[t+0]),A(r[t+1]),A(r[t+2]);return s}(V.vertices,V.normals,V.uvs,z,t),t=function(t,e){const n=e.getLength(),r=new Float32Array(n),i=[],o=[],s=[];for(let a=0;a<n;a+=4){const n=a/4*3;gt(o,t[n]||0,t[n+1]||0,t[n+2]||0),xt(i,e[a]||0,e[a+1]||0,e[a+2]||0,e[a+3]||0),Fe(s,o,i),yt(r.subarray(a,a+4),s)}return r}(V.normals,t),V.tangents=t,X.push(t.buffer),delete V.normals}if(V.normals&&(j&&(V.normals=qe.createTypedArray(V.normals,Int8Array)),X.push(V.normals.buffer)),V.uvs){const t=V.uvs;V.uvs=qe.createTypedArray(t,Float32Array),X.push(V.uvs.buffer)}const U=function(t,e,n,r){const i={},o={},s=r.getLength();if(L(e.polygonFill)){let a=b(e.polygonFill);const l=new Uint8Array(4*s);l.fill(255);for(let e=0;e<s;e++){const o=t[r[e]],s=o.properties||{};s.$layer=o.layer,s.$type=o.type;let u=a(n,s);w(u)&&(i.aColor=1,a=b(u),u=a(n,s)),delete s.$layer,delete s.$type,$e.normalizeColor(Ze,u),l[4*e]=Ze[0],l[4*e+1]=Ze[1],l[4*e+2]=Ze[2],l[4*e+3]=Ze[3]}o.aColor=l}if(L(e.polygonOpacity)){let a=M(e.polygonOpacity,"exponential");const l=new Uint8Array(s);l.fill(255);for(let e=0;e<s;e++){const o=t[r[e]],s=o.properties||{};s.$layer=o.layer,s.$type=o.type;let u=a(n,s);w(u)&&(i.aOpacity=1,a=b(u),u=a(n,s)),delete s.$layer,delete s.$type,l[e]=255*u}o.aOpacity=l}return o.dynamicAttributes=i,o}(t,h,c,V.featureIndexes),R=function(t,e,n,r,i){const o=[[],[]],s=L(r.topPolygonFill),a=L(r.bottomPolygonFill),l=[255,255,255,255],u=e.getLength();if(s||a){let h=s&&b(r.topPolygonFill),c=a&&b(r.bottomPolygonFill),f=null,p=null,d=null,g=null;for(let r=0;r<u;r++){if(1===t[r]&&!s||0===t[r]&&!a)continue;const u=1===t[r];if(u&&e[r]===f){t[r]=d;continue}if(!u&&e[r]===p){t[r]=g;continue}const y=n[e[r]],x=y.properties||{};x.$layer=y.layer,x.$type=y.type;let m=u?h:c,v=m(i,x);w(v)&&(m=b(v),v=m(i,x)),delete x.$layer,delete x.$type,$e.normalizeColor(Ze,v),mt(Ze,Ze,l);let M=Ue(o,Ze);M<0&&(M=o.length,o.push(yt([],Ze))),t[r]=M,u?(f=e[r],d=M):(p=e[r],g=M)}}return o.slice(2)}(V.verticeTypes,V.featureIndexes,t,h,c),J={data:{data:{aVertexColorType:R.length<=252?qe.createTypedArray(V.verticeTypes,Uint8Array):qe.createTypedArray(V.verticeTypes,Uint16Array),aPosition:V.vertices,aNormal:V.normals,aTexCoord0:V.uvs,aTangent:V.tangents,aPickingId:V.pickingIds},indices:z,properties:{maxAltitude:V.maxAltitude/100,minAltitude:V.minAltitude/100,hasNegativeHeight:V.hasNegativeHeight},dynamicAttributes:U.dynamicAttributes,vertexColors:R},buffers:X};return V.featureIds.length?(J.data.featureIds=V.featureIds,X.push(J.data.featureIds.buffer)):J.data.featureIds=[],U.aColor&&(J.data.data.aColor=U.aColor,J.buffers.push(U.aColor.buffer)),U.aOpacity&&(J.data.data.aOpacity=U.aOpacity,J.buffers.push(U.aOpacity.buffer)),J.buffers.push(J.data.data.aPosition.buffer),J.data.pickingIdIndiceMap=De.generatePickingIndiceIndex(J.data.data.aPickingId,J.data.indices),J}const Ze=[];function Ue(t,e){for(let i=0;i<t.length;i++)if(n=e,r=t[i],n[0]===r[0]&&n[1]===r[1]&&n[2]===r[2]&&n[3]===r[3])return i;var n,r;return-1}const{PackUtil:Re,StyleUtil:Je,FilterUtil:He}=re();function We(t,e,n,r,{altitudeScale:i,altitudeProperty:o,defaultAltitude:s,heightProperty:a,minHeightProperty:l,defaultHeight:u,bottom:h}){const c=h,f=e/t[0].extent,p=2*function(t,e){let n=0;for(let e=0,r=t.length;e<r;e++){const r=t[e];if(S(r.geometry[0][0]))n+=3*r.geometry.length;else for(let t=0,e=r.geometry.length;t<e;t++){let e=3*r.geometry[t].length;3===r.type&&(e-=3),n+=e}}return n}(t)+3*t.length*2,d=[],g=new Int16Array(p),y=new Uint8Array(g.length/3*4);w(n)&&(n=He.compileFilter(n));const x=[];function m(t,n,r){const i=n-t,o=g.subarray(t,n),s=g.subarray(n,n+i);s.set(o);for(let t=2,e=s.length;t<e;t+=3)s[t]=o[t]-r;const a=t/3,l=i/3;let u,h;for(let t=a,n=l+a;t<n;t++)t<n-1?(u=t,h=t+1):(u=t,h=a),pt(g,u,h,e)||(x.push(u,h),c&&x.push(u+l,h+l),Ke(g,u,e)||x.push(u,u+l));return n+i}let v=0,b=-1/0,M=1/0;const P=(ee+"").trim(),_=[];for(let e=0,h=t.length;e<h;e++){const h=t[e],c=h.geometry;if(n){let t;t="function"==typeof n?n(h&&h.properties):n,Je.normalizeColor(_,t)}else gt(_,255,255,255);const p=v/3*4,{altitude:w,height:A}=Re.getFeaAltitudeAndHeight(h,i,o,s,a,u,l);A<0?(M=Math.min(w,M),b=Math.max(w-A,b)):(M=Math.min(w-A,M),b=Math.max(w,b));let I=v;for(let t=0,e=c.length;t<e;t++){let e=c[t];const n=e.length;e[0][0]===e[n-1][0]&&e[0][1]===e[n-1][1]&&(e=e.slice(0,n-1)),v=ft(g,I,e,f,w),v=m(I,v,A*f),I=v}const S=I/3*4;for(let t=p;t<S;t+=4)y[t]=_[0],y[t+1]=_[1],y[t+2]=_[2],y[t+3]=255*(r||1);const T=x.length-d.length;for(let t=0;t<T;t++)d.push(h[P])}const A=x.reduce(((t,e)=>Math.max(t,e)),0),I=new(Re.getIndexArrayType(A))(x),T=Math.max(Math.abs(b,Math.abs(M)));return{aPosition:new(Re.getPosArrayType(Math.max(512,T)))(g),indices:I,aPickingId:new Float32Array(d),aColor:y,maxAltitude:b===-1/0?0:b/100,minAltitude:M===1/0?0:M/100}}function Ke(t,e,n){const r=t[3*e],i=t[3*e+1];return r<0||r>n||i<0||i>n}function Qe(t,e,n,r){const i=We(t,e,n.lineColor,n.lineOpacity,r),{minAltitude:o,maxAltitude:s}=i;delete i.minAltitude,delete i.maxAltitude;const a=[i.aPosition.buffer,i.indices.buffer,i.aPickingId.buffer],l=i.indices;return delete i.indices,{data:{data:i,properties:{minAltitude:o,maxAltitude:s},indices:l},buffers:a}}\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 */const tn=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function en(t){if(!t)return"true";const e=t[0];if(t.length<=1)return"any"===e?"false":"true";return\`(${G}"=="===e?rn(t[1],t[2],"===",!1):"!="===e?rn(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?rn(t[1],t[2],e,!0):"any"===e?sn(t.slice(1),"||"):"all"===e?sn(t.slice(1),"&&"):"none"===e?un(sn(t.slice(1),"||")):"in"===e?an(t[1],t.slice(2)):"!in"===e?un(an(t[1],t.slice(2))):"has"===e?ln(t[1]):"!has"===e?un(ln(t[1])):"contains"===e?function(t,e,n){const r=nn(t);return void 0!==n?\`(${G}r} + '').indexOf("${G}e}") === ${G}n}\`:\`(${G}r} + '').indexOf("${G}e}") >= 0\`}(t[1],t[2],t[3]):"true"})\`}function nn(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function rn(t,e,n,r){if("object"==typeof(i=t)&&i&&t.op)return function(t,e,n,r){const i=t.property,o=t.op;let s=nn(i);return"length"!==o?(console.error(\`not support ${G}o} op\`),"false"):(s=\`((${G}s}+='').length)\`,on(s,i,e,n,r))}(t,e,n,r);var i;return on(nn(t),t,e,n,r)}function on(t,e,n,r,i){const o="$type"===e?tn.indexOf(n):JSON.stringify(n);return(i?\`typeof ${G}t}=== typeof ${G}o}&&\`:"")+t+r+o}function sn(t,e){return t.map(en).join(e)}function an(t,e){"$type"===t&&(e=e.map((t=>tn.indexOf(t))));const n=JSON.stringify(e.sort(hn)),r=nn(t);return e.length<=200?\`${G}n}.indexOf(${G}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; }(${G}r}, ${G}n},0,${G}e.length-1})\`}function ln(t){return"$id"===t?'"id" in f':\`${G}JSON.stringify(t)} in p\`}function un(t){return\`!(${G}t})\`}function hn(t,e){return t<e?-1:t>e?1:0}let cn=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),cn=!0}catch(t){cn=!1}var fn=cn;const{VectorPack:pn,PolygonPack:dn,NativeLinePack:gn,LinePack:yn,PointPack:xn,NativePointPack:mn,LineExtrusionPack:vn,CirclePack:wn,RoundTubePack:bn,SquareTubePack:Mn,FilterUtil:Pn,PackUtil:_n,StyleUtil:An,TextUtil:In,DEFAULT_TEX_WIDTH:Sn,GlyphRequestor:Tn}=re(),Fn="__original_properties",kn="__fn-type_properties";class Ln{constructor(t,e,n,r,i){this.id=t,this.options=e,this.upload=n,this._compileStyle(e.style),this.requests={},this._cache=r,this._styleCounter=1,this.loadings=i}updateStyle(t,e){this.options.style=t,this._styleCounter=t.styleCounter,this._compileStyle(t),e()}updateOptions(t,e){this.options=A(this.options,t),e()}loadTile(t,e){const n=this.loadings,r=t.tileInfo.url,i=this.options.debugTile;if(i){const{x:n,y:r,z:o}=t.tileInfo;let s=!1;for(let t=0;t<i.length;t++)if(n===i[t].x&&r===i[t].y&&o===i[t].z){s=!0;break}if(!s)return void e()}if(n[r])return void n[r].push({context:t,callback:e,ref:this});n[r]=[{context:t,callback:e,ref:this}];const o=this.options.featureIdProperty;this.requests[r]=this.getTileFeatures(t,((e,i,s,a)=>{const l=n[r];if(delete n[r],this.checkIfCanceled(r))return delete this.requests[r],void this._callWaitings(l,null,{canceled:!0});if(delete this.requests[r],(this.options.debug||o)&&i)for(let e=0;e<i.length;e++)if(this.options.debug&&(i[e]._debug_info={index:e,id:i[e].id,tileId:t.tileInfo.id}),o){const t=F(o)?o[i[e].layer]:o,n=i[e].properties;i[e].id=n&&n[t]||null}if(e)this._callWaitings(l,e);else if(i&&i.length){if(l)for(let t=0;t<l.length;t++)this._onTileLoad.call(l[t].ref,l[t].context,l[t].callback,r,s,i,a)}else this._callWaitings(l)}))}_onTileLoad(t,e,n,r,i,o){this._createTileData(r,i,t).then((n=>{if(n.canceled)return void e(null,{canceled:!0});n.data.styleCounter=t.styleCounter,o&&A(n.data,o);const r=n.data.features;if(r){const t={};for(const e in r){const n=r[e];t[n.id]=n}const e=function(t){try{const e=JSON.stringify(t);return C.encode(e)}catch(t){console.error("encode JSON to Uint8Array error:",t)}}(t);e&&(n.data.featuresTypeArray=e,n.buffers=n.buffer||[],n.buffers.push(e.buffer));const i="id"===this.options.features;for(const t in r){const n=r[t];e&&delete n.geometry,i&&(r[t]=n.id)}}e(null,n.data,n.buffers)})).catch((t=>{e(t)}))}abortTile(t,e){delete this.requests[t],this._cancelLoadings(t),e()}_cancelLoadings(t){const e=this.loadings[t];if(e)for(let t=0;t<e.length;t++)e[t].callback(null,{canceled:!0});delete this.loadings[t]}_callWaitings(t,e,n){if(t)for(let r=0;r<t.length;r++)t[r].callback(e,n)}checkIfCanceled(t){return!this.requests[t]}onRemove(){this.loadings={},this._cache&&this._cache.reset(),delete this._cache,this.requests={}}fetchIconGlyphs(t,e,n){if(this.options.workerGlyph&&fn){const r=[];if(t&&Object.keys(t).length){const e=new Promise((e=>{this.upload("fetchIconGlyphs",{icons:t},null,((t,n)=>{e({err:t,iconData:n})}))}));r.push(e)}if(e&&Object.keys(e).length){const t=new Promise((t=>{this._glyphRequestor||(this._glyphRequestor=new Tn),this._glyphRequestor.getGlyphs(e,((e,n)=>{t({err:e,glyphData:n})}))}));r.push(t)}Promise.all(r).then((t=>{const e={icons:null,glyphs:null};for(let r=0;r<t.length;r++){if(t[r].err)return void n(t[r].err);t[r].iconData?e.icons=t[r].iconData.icons:t[r].glyphData&&(e.glyphs=t[r].glyphData.glyphs)}return e})).then((t=>{n(null,t)}))}else this.upload("fetchIconGlyphs",{icons:t,glyphs:e},null,n)}_createTileData(t,e,n){if(!e.length)return Promise.resolve({data:null,buffers:[]});const{glScale:r,tileInfo:i}=n,o=!this.options.style.style.length&&!this.options.style.featureStyle.length;let s=this.pluginConfig.slice(0);o&&(s=this._updateLayerPluginConfig(t)),this.featurePlugins&&function(t){for(let e=1;e<arguments.length;e++){const n=arguments[e];if(n)for(let e=0,r=n.length;e<r;e++)t.push(n[e])}t.length}(s,this.featurePlugins);const a={};for(let t=0;t<s.length;t++)Nn(e,n.tileInfo.z,s[t],a);const l=[],u=[];for(let t=0;t<e.length;t++){const n=e[t],r=a[t];if(r){u.fill(null);let t=0;for(const e in r){let i=0;const o=r[e].values();for(const t of o){let r=u[i];r||(r=Dn(n),u[i]=r),r.properties[e]=t,i++}i>t&&(t=i)}for(let e=0;e<t;e++)l.push(u[e])}else l.push(n)}const h=(e=l)[0].extent,c=i.z,f={x:i.extent2d.xmin*r,y:i.extent2d.ymax*r},p=[],d=[],g=[],y=this.options,x=[],m={},v=[Promise.resolve(n.styleCounter)];let w=0,b=-1;const M=[];let P=!1;for(let t=0;t<s.length;t++){b++;const r=s[t];r.type!==w&&(b=0,w=r.type);const a=0===r.type?p:d;jn(r.symbol,M,t),P=P||M[t]&&M[t].size>0;const{tileFeatures:l,tileFeaIndexes:u}=this._filterFeatures(c,r.type,r.filter,e,m,t);if(!l.length){a[b]=null;continue}const y=u[u.length-1],_=_n.getIndexArrayType(y);a[b]={styledFeatures:new _(u)},g.push({idx:t,typeIdx:b}),x.push(a[b].styledFeatures.buffer);const I=A({},n,{extent:h,zoom:c,tilePoint:f});if(this.options.debugTile){const t=this.options.debugTile;for(let e=0;e<t.length;e++){const{x:n,y:r,z:o}=t[e];if(i.x===n&&i.y===r&&i.z===o){I.debugIndex=t[e].index;break}}}let S=this._createTileGeometry(l,r,I);o&&(S=S.then((t=>{if(!t)return null;if(t.data)t.data.layer=l[0].layer;else if(Array.isArray(t))for(let e=0;e<t.length;e++)t[e]&&t[e].data&&(t[e].data.layer=l[0].layer);return t}))),v.push(S)}return Promise.all(v).then((([n,...r])=>{if(n!==this._styleCounter)return{canceled:!0};function i(t,e){if(void 0!==t.data.ref)return;const n=s[g[e].idx],r=n.renderPlugin.dataConfig;if(t.data.type=r.type,t.data.filter=n.filter.def,r.altitudeOffset&&(t.data.properties.minAltitude+=r.altitudeOffset,t.data.properties.maxAltitude+=r.altitudeOffset),t.buffers&&t.buffers.length)for(let e=0;e<t.buffers.length;e++)x.push(t.buffers[e])}for(let t=0;t<r.length;t++){if(!r[t])continue;const e=r[t],n=0===s[g[t].idx].type?p:d;if(Array.isArray(e)){const r=[];for(let n=0;n<e.length;n++)e[n]&&(i(e[n],t),(void 0===e[n].data.ref||e[e[n].data.ref])&&r.push(e[n].data));r.length&&(n[g[t].typeIdx].data=r)}else i(e,t),n[g[t].typeIdx].data=e.data}const o={},a=t;if(y.features||y.schema||P){let t,n=!1;for(let r=0,i=e.length;r<i;r++)if(t=e[r],a[t.layer].properties||(a[t.layer].properties=On(t.properties)),t&&(y.features||P&&m[r])){delete t.extent,delete t.properties.$layer,delete t.properties.$type,delete t.__index;const e=t.originalFeature;if(e){const e=t.properties,n=A({},t.originalFeature);delete e[Fn],n.customProps=A({},e),t=n}const i=A({},t);if(P&&m[r]&&(!y.features||"transient"===y.features)){const i=m[r];for(let r=0;r<i.length;r++){const i=M[r];i&&i.forEach((r=>{const i=e?e.properties:t.properties;i[kn]||(i[kn]=new Set),i[kn].add(r),n=!0}))}}o[r]=i}if(n)for(const t in o){const e=o[t],n=e.properties[kn];if(n){delete e.properties[kn],"transient"===y.features&&(e.fnTypeProps=A({},e.properties));for(const t in e.properties)n.has(t)||("transient"===y.features?delete e.fnTypeProps[t]:delete e.properties[t])}}}return{data:{styleCounter:n,schema:a,data:p,featureData:d,extent:h,features:o},buffers:x}})).catch((t=>{console.error(t)}))}_createTileGeometry(t,e,n){let r=t;const i=e.renderPlugin.dataConfig,o=e.symbol,s=this.options.tileSize,{extent:a,glScale:l,zScale:u,zoom:h,tilePoint:c,centimeterToPoint:f,verticalCentimeterToPoint:p}=n,d=a/s,g=i.type,y=n.debugIndex;let x=A({},i,{EXTENT:a,zoom:h,debugIndex:y,features:this.options.features,isWebGPU:this.options.isWebGPU,isWebGL1:this.options.isWebGL1});if("3d-extrusion"===g){Yn(o)&&(i.uv=1);const t=this.options.projectionCode,e=o.material&&o.material.textureWidth||Sn;return Promise.all([Promise.resolve(je(r,i,a,c,e,n.tileInfo.res,l,a/this.options.tileSize,f,p,o,h,t,y))])}if("3d-wireframe"===g)return Promise.all([Promise.resolve(Qe(r,a,o,i))]);if("point"===g){x=A(x,{requestor:this.fetchIconGlyphs.bind(this),altitudeToTileScale:u*a/this.options.tileSize/l,pluginType:e.renderPlugin.type});let t=o;return Array.isArray(o)||(t=[o]),t=t.map(((t,e)=>(t&&(t.index={index:e},t.isIconText=function(t){return t.markerType||t.markerFile}(t)),t))).filter((t=>!!t)),Promise.all(t.map((t=>{x.defaultMarkerVerticalAlignment="middle";const e=pn.genFnTypes(t);let n=r;return xn.needMerge(t,e,h)&&(n=xn.mergeLineFeatures(r,t,e,h)),new xn(n,t,x).load(d)})))}if("native-point"===g){const t=u*a/this.options.tileSize/l;return x.altitudeToTileScale=t,Vn(r,o,x,mn,d)}if("line"===g)return x=A(x,{requestor:this.fetchIconGlyphs.bind(this),tileRatio:d}),Vn(r,o,x,yn,1,!0);if("native-line"===g)return Vn(r,o,x,gn,1,!0);if("fill"===g)return x=A(x,{requestor:this.fetchIconGlyphs.bind(this)}),Vn(r,o,x,dn);if("line-extrusion"===g){delete o.lineGradientProperty,o.lineJoin="miter",o.lineCap="butt";const t=Yn(o);if(t&&(i.uv=1),x=A(x,{tileSize:s,zScale:u,glScale:l}),o.mergeOnProperty){const t=pn.genFnTypes(o);r=yn.mergeLineFeatures(r,o,t,x.zoom)}if(t){const t=[];if(!1!==i.top){const e=A({},x);e.side=!1,t.push(new vn(r,o,e))}return!1!==i.side&&(x.side=!0,x.top=!1,t.push(new vn(r,o,x))),Promise.all(t.map((t=>t.load())))}return Promise.all([new vn(r,o,x).load()])}if("circle"===g)return Vn(r,o,x,wn);if("round-tube"===g||"square-tube"===g){const t="round-tube"===g?bn:Mn;return x=A(x,{requestor:this.fetchIconGlyphs.bind(this),radialSegments:"round-tube"===g?i.radialSegments||8:4,centimeterToPoint:f,verticalCentimeterToPoint:p,tileRatio:d,isTube:!0}),Vn(r,o,x,t)}return Promise.resolve([])}_filterFeatures(t,e,n,r,i,o){const s=(ee+"").trim(),a=[],l=[],u=r.length;for(let h=0;h<u;h++)if((1===e||void 0===r[h].id||!this.styledFeatures[r[h].id])&&((!n.def||"default"===n.def)&&!i[h]||!0===n.def||n.def&&(void 0!==n.def.condition||Array.isArray(n.def))&&n(r[h],t))){const t=r[h];if(void 0===t[s]&&(t[s]=h),i[h]||(i[h]=[]),i[h].push(o),l.push(t),a.push(h),1===e)break}return{tileFeatures:l,tileFeaIndexes:a}}_compileStyle(t){const{style:e,featureStyle:n}=t,r={};n.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=Pn.compileStyle(e);for(let t=0;t<e.length;t++)i[t].filter&&(i[t].filter.def=e[t].filter?e[t].filter.value||e[t].filter:void 0),i[t].type=0;const o=[],s=Pn.compileStyle(n);for(let t=0;t<n.length;t++)s[t].type=1,s[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0,s[t].renderPlugin&&o.push(s[t]);this.pluginConfig=i,this.featurePlugins=o,this.styledFeatures=r}_updateLayerPluginConfig(t){let e=this._layerPlugins;this._layerPlugins||(e=this._layerPlugins={});const n=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],r=[];for(const o in t){const s=o;if(!e[o]){const r=[];for(let e=0;e<t[o].types.length;e++){const a=t[o].types[e],l=["all",["==","$layer",s],["==","$type",n[a]]],u={filter:(i=l,new Function("f",\`var p = (f && f.properties || {}); return ${G}en(i)}\`)),renderPlugin:Cn(a),symbol:Bn(a)};u.filter.def=l,u.type=0,r.push(u)}e[s]=r}r.push(...e[s])}var i;return r}}function Cn(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 Bn(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 On(t){if(Array.isArray(t)||!F(t))return{};const e={};for(const n in t){const r=t[n];I(r)?e[n]="string":S(r)?e[n]="number":!0===r||!1===r?e[n]="boolean":Array.isArray(r)?e[n]="array":e[n]="object"}return e}function Yn(t){if(!t)return 0;let e=0;for(const n in t){if(("normalTexture"===n||"bumpTexture"===n)&&t[n])return 2;if(n.indexOf("Texture")>0&&t[n])e=1;else if(F(t[n])){const r=Yn(t[n]);if(2===r)return r;1===r&&(e=1)}}return e}function Vn(t,e,n,r,i,o){const s={},a=Array.isArray(e)?e:[e];let l=-1;for(let t=0;t<a.length;t++)s[t]=Xn(a[t]),!s[t]&&a[t]&&-1===l&&(l=t);const u=[];for(let e=0;e<a.length;e++){if(!a[e])continue;a[e].index={index:e};let h=t;if(o&&a[e].mergeOnProperty){const r=pn.genFnTypes(a[e]);h=yn.mergeLineFeatures(t,a[0],r,n.zoom)}s[e]||e===l?u.push(new r(h,a[e],n).load(i)):u.push({data:{ref:l,symbolIndex:{index:e}}})}return Promise.all(u)}function Xn(t){if(!t)return 0;for(const e in t)if(L(t[e]))return 1;return 0}function Nn(t,e,n,r){const i=n.customProperties;if(!i)return t;if(i)for(let t=0;t<i.length;t++)i[t].fn=Pn.compileFilter(i[t].filter);for(let n=0;n<i.length;n++)for(let o=0,s=t.length;o<s;o++)if(i[n].fn(t[o],e))for(const t in i[n].properties){const e=i[n].properties[t];k(e)||(r[o]||(r[o]={}),r[o][t]||(r[o][t]=new Set),r[o][t].add(e))}}const En={get:(t,e)=>e in t?t[e]:t.originalFeature[e],has:(t,e)=>e in t||e in t.originalFeature},zn={get:function(t,e){return e in t?t[e]:t[Fn][e]},has:(t,e)=>e in t||e in t[Fn]},$n={};function Dn(t){const e={};e.originalFeature=t;const n=new Proxy(e,En);return n.properties=new Proxy({},zn),n.properties[Fn]=t.properties||$n,n}function qn(t,e,n){t[e]||(t[e]=new Set),t[e].add(n)}const Gn=[];function jn(t,e,n){if(!t)return Gn;for(const r in t){if(!t[r]||!An.checkIfZoomFnTypeSymbol(r))continue;if(L(t[r]))qn(e,n,t[r].property);else{if("lineGradientProperty"===r){qn(e,n,t[r]);continue}if("textName"===r)if(I(t[r])){const i=In.resolveVarNames(t[r]);if(i)for(let t=0;t<i.length;t++)qn(e,n,i[t])}else if(Pn.isExpression(t[r])){const i=[];In.resolveExpVarNames(i,t[r]);for(let t=0;t<i.length;t++)qn(e,n,i[t])}}const i=t[r].stops;if(i&&i.length)for(let t=0;t<i.length;t++)L(i[t][1])&&qn(e,t,i[t][1].property)}return e[n]}function Zn(t,e){Un(t.geometry,e)}function Un(t,e){if(t)switch(t.type){case"Point":Rn(t.coordinates,e);break;case"MultiPoint":case"LineString":Jn(t.coordinates,e);break;case"MultiLineString":!function(t,e){for(let n=0,r=t.length;n<r;n++)Jn(t[n],e)}(t.coordinates,e);break;case"Polygon":Hn(t.coordinates,e);break;case"MultiPolygon":!function(t,e){for(let n=0,r=t.length;n<r;n++)Hn(t[n],e)}(t.coordinates,e);break;case"GeometryCollection":const n=t.geometries.length;for(let r=0;r<n;r++)Un(t.geometries[r],e)}}function Rn(t,e){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Jn(t,e){for(let n=0,r=t.length;n<r;n++)Rn(t[n],e)}function Hn(t,e){t.length&&Jn(t[0],e)}function Wn(t,e,n,r,i){Kn(t,e,n||0,r||t.length-1,i||tr)}function Kn(t,e,n,r,i){for(;r>n;){if(r-n>600){var o=r-n+1,s=e-n+1,a=Math.log(o),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);Kn(t,e,Math.max(n,Math.floor(e-s*l/o+u)),Math.min(r,Math.floor(e+(o-s)*l/o+u)),i)}var h=t[e],c=n,f=r;for(Qn(t,n,e),i(t[r],h)>0&&Qn(t,n,r);c<f;){for(Qn(t,c,f),c++,f--;i(t[c],h)<0;)c++;for(;i(t[f],h)>0;)f--}0===i(t[n],h)?Qn(t,n,f):Qn(t,++f,r),f<=e&&(n=f+1),e<=f&&(r=f-1)}}function Qn(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function tr(t,e){return t<e?-1:t>e?1:0}class er{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!fr(t,e))return n;const r=this.toBBox,i=[];for(;e;){for(let o=0;o<e.children.length;o++){const s=e.children[o],a=e.leaf?r(s):s;fr(t,a)&&(e.leaf?n.push(s):cr(t,a)?this._all(s,n):i.push(s))}e=i.pop()}return n}collides(t){let e=this.data;if(!fr(t,e))return!1;const n=[];for(;e;){for(let r=0;r<e.children.length;r++){const i=e.children[r],o=e.leaf?this.toBBox(i):i;if(fr(t,o)){if(e.leaf||cr(t,o))return!0;n.push(i)}}e=n.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=pr([]),this}remove(t,e){if(!t)return this;let n=this.data;const r=this.toBBox(t),i=[],o=[];let s,a,l;for(;n||i.length;){if(n||(n=i.pop(),a=i[i.length-1],s=o.pop(),l=!0),n.leaf){const r=nr(t,n.children,e);if(-1!==r)return n.children.splice(r,1),i.push(n),this._condense(i),this}l||n.leaf||!cr(n,r)?a?(s++,n=a.children[s],l=!1):n=null:(i.push(n),o.push(s),s=0,a=n,n=n.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,r){const i=n-e+1;let o,s=this._maxEntries;if(i<=s)return o=pr(t.slice(e,n+1)),rr(o,this.toBBox),o;r||(r=Math.ceil(Math.log(i)/Math.log(s)),s=Math.ceil(i/Math.pow(s,r-1))),o=pr([]),o.leaf=!1,o.height=r;const a=Math.ceil(i/s),l=a*Math.ceil(Math.sqrt(s));dr(t,e,n,l,this.compareMinX);for(let i=e;i<=n;i+=l){const e=Math.min(i+l-1,n);dr(t,i,e,a,this.compareMinY);for(let n=i;n<=e;n+=a){const i=Math.min(n+a-1,e);o.children.push(this._build(t,n,i,r-1))}}return rr(o,this.toBBox),o}_chooseSubtree(t,e,n,r){for(;r.push(e),!e.leaf&&r.length-1!==n;){let n,r=1/0,s=1/0;for(let a=0;a<e.children.length;a++){const l=e.children[a],u=lr(l),h=(i=t,o=l,(Math.max(o.maxX,i.maxX)-Math.min(o.minX,i.minX))*(Math.max(o.maxY,i.maxY)-Math.min(o.minY,i.minY))-u);h<s?(s=h,r=u<r?u:r,n=l):h===s&&u<r&&(r=u,n=l)}e=n||e.children[0]}var i,o;return e}_insert(t,e,n){const r=n?t:this.toBBox(t),i=[],o=this._chooseSubtree(r,this.data,e,i);for(o.children.push(t),or(o,r);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(r,i,e)}_split(t,e){const n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);const o=this._chooseSplitIndex(n,i,r),s=pr(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,rr(n,this.toBBox),rr(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)}_splitRoot(t,e){this.data=pr([t,e]),this.data.height=t.height+1,this.data.leaf=!1,rr(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let r,i=1/0,o=1/0;for(let s=e;s<=n-e;s++){const e=ir(t,0,s,this.toBBox),a=ir(t,s,n,this.toBBox),l=hr(e,a),u=lr(e)+lr(a);l<i?(i=l,r=s,o=u<o?u:o):l===i&&u<o&&(o=u,r=s)}return r||n-e}_chooseSplitAxis(t,e,n){const r=t.leaf?this.compareMinX:sr,i=t.leaf?this.compareMinY:ar;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)}_allDistMargin(t,e,n,r){t.children.sort(r);const i=this.toBBox,o=ir(t,0,e,i),s=ir(t,n-e,n,i);let a=ur(o)+ur(s);for(let r=e;r<n-e;r++){const e=t.children[r];or(o,t.leaf?i(e):e),a+=ur(o)}for(let r=n-e-1;r>=e;r--){const e=t.children[r];or(s,t.leaf?i(e):e),a+=ur(s)}return a}_adjustParentBBoxes(t,e,n){for(let r=n;r>=0;r--)or(e[r],t)}_condense(t){for(let e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children,e.splice(e.indexOf(t[n]),1)):this.clear():rr(t[n],this.toBBox)}}function nr(t,e,n){if(!n)return e.indexOf(t);for(let r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}function rr(t,e){ir(t,0,t.children.length,e,t)}function ir(t,e,n,r,i){i||(i=pr(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let o=e;o<n;o++){const e=t.children[o];or(i,t.leaf?r(e):e)}return i}function or(t,e){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),t.maxY=Math.max(t.maxY,e.maxY),t}function sr(t,e){return t.minX-e.minX}function ar(t,e){return t.minY-e.minY}function lr(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function ur(t){return t.maxX-t.minX+(t.maxY-t.minY)}function hr(t,e){const n=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,i-n)*Math.max(0,o-r)}function cr(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function fr(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function pr(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function dr(t,e,n,r,i){const o=[e,n];for(;o.length;){if((n=o.pop())-(e=o.pop())<=r)continue;const s=e+Math.ceil((n-e)/r/2)*r;Wn(t,s,e,n,i),o.push(e,s,s,n)}}class gr{constructor(t=[],e=yr){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:n}=this,r=e[t];for(;t>0;){const i=t-1>>1,o=e[i];if(n(r,o)>=0)break;e[t]=o,t=i}e[t]=r}_down(t){const{data:e,compare:n}=this,r=this.length>>1,i=e[t];for(;t<r;){let r=1+(t<<1),o=e[r];const s=r+1;if(s<this.length&&n(e[s],o)<0&&(r=s,o=e[s]),n(o,i)>=0)break;e[t]=o,t=r}e[t]=i}}function yr(t,e){return t<e?-1:t>e?1:0}function xr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var mr={exports:{}},vr=function(t,e,n,r){var i=t[0],o=t[1],s=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);for(var a=(r-n)/2,l=0,u=a-1;l<a;u=l++){var h=e[n+2*l+0],c=e[n+2*l+1],f=e[n+2*u+0],p=e[n+2*u+1];c>o!=p>o&&i<(f-h)*(o-c)/(p-c)+h&&(s=!s)}return s},wr=function(t,e,n,r){var i=t[0],o=t[1],s=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);for(var a=r-n,l=0,u=a-1;l<a;u=l++){var h=e[l+n][0],c=e[l+n][1],f=e[u+n][0],p=e[u+n][1];c>o!=p>o&&i<(f-h)*(o-c)/(p-c)+h&&(s=!s)}return s};mr.exports=function(t,e,n,r){return e.length>0&&Array.isArray(e[0])?wr(t,e,n,r):vr(t,e,n,r)};var br=mr.exports.nested=wr;mr.exports.flat=vr;const Mr=11102230246251565e-32,Pr=134217729,_r=(3+8*Mr)*Mr;function Ar(t,e,n,r,i){let o,s,a,l,u=e[0],h=r[0],c=0,f=0;h>u==h>-u?(o=u,u=e[++c]):(o=h,h=r[++f]);let p=0;if(c<t&&f<n)for(h>u==h>-u?(s=u+o,a=o-(s-u),u=e[++c]):(s=h+o,a=o-(s-h),h=r[++f]),o=s,0!==a&&(i[p++]=a);c<t&&f<n;)h>u==h>-u?(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c]):(s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++f]),o=s,0!==a&&(i[p++]=a);for(;c<t;)s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c],o=s,0!==a&&(i[p++]=a);for(;f<n;)s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++f],o=s,0!==a&&(i[p++]=a);return 0===o&&0!==p||(i[p++]=o),p}function Ir(t){return new Float64Array(t)}const Sr=33306690738754716e-32,Tr=22204460492503146e-32,Fr=11093356479670487e-47,kr=Ir(4),Lr=Ir(8),Cr=Ir(12),Br=Ir(16),Or=Ir(4);function Yr(t,e,n,r,i,o){const s=(e-o)*(n-i),a=(t-i)*(r-o),l=s-a;if(0===s||0===a||s>0!=a>0)return l;const u=Math.abs(s+a);return Math.abs(l)>=Sr*u?l:-function(t,e,n,r,i,o,s){let a,l,u,h,c,f,p,d,g,y,x,m,v,w,b,M,P,_;const A=t-i,I=n-i,S=e-o,T=r-o;w=A*T,f=Pr*A,p=f-(f-A),d=A-p,f=Pr*T,g=f-(f-T),y=T-g,b=d*y-(w-p*g-d*g-p*y),M=S*I,f=Pr*S,p=f-(f-S),d=S-p,f=Pr*I,g=f-(f-I),y=I-g,P=d*y-(M-p*g-d*g-p*y),x=b-P,c=b-x,kr[0]=b-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-M,c=v-x,kr[1]=v-(x+c)+(c-M),_=m+x,c=_-m,kr[2]=m-(_-c)+(x-c),kr[3]=_;let F=function(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}(4,kr),k=Tr*s;if(F>=k||-F>=k)return F;if(c=t-A,a=t-(A+c)+(c-i),c=n-I,u=n-(I+c)+(c-i),c=e-S,l=e-(S+c)+(c-o),c=r-T,h=r-(T+c)+(c-o),0===a&&0===l&&0===u&&0===h)return F;if(k=Fr*s+_r*Math.abs(F),F+=A*h+T*a-(S*u+I*l),F>=k||-F>=k)return F;w=a*T,f=Pr*a,p=f-(f-a),d=a-p,f=Pr*T,g=f-(f-T),y=T-g,b=d*y-(w-p*g-d*g-p*y),M=l*I,f=Pr*l,p=f-(f-l),d=l-p,f=Pr*I,g=f-(f-I),y=I-g,P=d*y-(M-p*g-d*g-p*y),x=b-P,c=b-x,Or[0]=b-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-M,c=v-x,Or[1]=v-(x+c)+(c-M),_=m+x,c=_-m,Or[2]=m-(_-c)+(x-c),Or[3]=_;const L=Ar(4,kr,4,Or,Lr);w=A*h,f=Pr*A,p=f-(f-A),d=A-p,f=Pr*h,g=f-(f-h),y=h-g,b=d*y-(w-p*g-d*g-p*y),M=S*u,f=Pr*S,p=f-(f-S),d=S-p,f=Pr*u,g=f-(f-u),y=u-g,P=d*y-(M-p*g-d*g-p*y),x=b-P,c=b-x,Or[0]=b-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-M,c=v-x,Or[1]=v-(x+c)+(c-M),_=m+x,c=_-m,Or[2]=m-(_-c)+(x-c),Or[3]=_;const C=Ar(L,Lr,4,Or,Cr);w=a*h,f=Pr*a,p=f-(f-a),d=a-p,f=Pr*h,g=f-(f-h),y=h-g,b=d*y-(w-p*g-d*g-p*y),M=l*u,f=Pr*l,p=f-(f-l),d=l-p,f=Pr*u,g=f-(f-u),y=u-g,P=d*y-(M-p*g-d*g-p*y),x=b-P,c=b-x,Or[0]=b-(x+c)+(c-P),m=w+x,c=m-w,v=w-(m-c)+(x-c),x=v-M,c=v-x,Or[1]=v-(x+c)+(c-M),_=m+x,c=_-m,Or[2]=m-(_-c)+(x-c),Or[3]=_;const B=Ar(C,Cr,4,Or,Br);return Br[B-1]}(t,e,n,r,i,o,u)}function Vr(t,e,n){e=Math.max(0,void 0===e?2:e),n=n||0;var r=function(t){for(var e=t[0],n=t[0],r=t[0],i=t[0],o=0;o<t.length;o++){var s=t[o];s[0]<e[0]&&(e=s),s[0]>r[0]&&(r=s),s[1]<n[1]&&(n=s),s[1]>i[1]&&(i=s)}var a=[e,n,r,i],l=a.slice();for(o=0;o<t.length;o++)br(t[o],a)||l.push(t[o]);return function(t){t.sort(Rr);for(var e=[],n=0;n<t.length;n++){for(;e.length>=2&&Dr(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}for(var r=[],i=t.length-1;i>=0;i--){for(;r.length>=2&&Dr(r[r.length-2],r[r.length-1],t[i])<=0;)r.pop();r.push(t[i])}return r.pop(),e.pop(),e.concat(r)}(l)}(t),i=new er(16);i.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},i.compareMinX=function(t,e){return t[0]-e[0]},i.compareMinY=function(t,e){return t[1]-e[1]},i.load(t);for(var o,s=[],a=0;a<r.length;a++){var l=r[a];i.remove(l),o=Gr(l,o),s.push(o)}var u=new er(16);for(a=0;a<s.length;a++)u.insert(qr(s[a]));for(var h=e*e,c=n*n;s.length;){var f=s.shift(),p=f.p,d=f.next.p,g=jr(p,d);if(!(g<c)){var y=g/h;(l=Xr(i,f.prev.p,p,d,f.next.next.p,y,u))&&Math.min(jr(l,p),jr(l,d))<=y&&(s.push(f),s.push(Gr(l,f)),i.remove(l),u.remove(f),u.insert(qr(f)),u.insert(qr(f.next)))}}f=o;var x=[];do{x.push(f.p),f=f.next}while(f!==o);return x.push(f.p),x}function Xr(t,e,n,r,i,o,s){for(var a=new gr([],Nr),l=t.data;l;){for(var u=0;u<l.children.length;u++){var h=l.children[u],c=l.leaf?Zr(h,n,r):Er(n,r,h);c>o||a.push({node:h,dist:c})}for(;a.length&&!a.peek().node.children;){var f=a.pop(),p=f.node,d=Zr(p,e,n),g=Zr(p,r,i);if(f.dist<d&&f.dist<g&&$r(n,p,s)&&$r(r,p,s))return p}(l=a.pop())&&(l=l.node)}return null}function Nr(t,e){return t.dist-e.dist}function Er(t,e,n){if(zr(t,n)||zr(e,n))return 0;var r=Ur(t[0],t[1],e[0],e[1],n.minX,n.minY,n.maxX,n.minY);if(0===r)return 0;var i=Ur(t[0],t[1],e[0],e[1],n.minX,n.minY,n.minX,n.maxY);if(0===i)return 0;var o=Ur(t[0],t[1],e[0],e[1],n.maxX,n.minY,n.maxX,n.maxY);if(0===o)return 0;var s=Ur(t[0],t[1],e[0],e[1],n.minX,n.maxY,n.maxX,n.maxY);return 0===s?0:Math.min(r,i,o,s)}function zr(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function $r(t,e,n){for(var r,i,o,s,a=Math.min(t[0],e[0]),l=Math.min(t[1],e[1]),u=Math.max(t[0],e[0]),h=Math.max(t[1],e[1]),c=n.search({minX:a,minY:l,maxX:u,maxY:h}),f=0;f<c.length;f++)if(r=c[f].p,i=c[f].next.p,o=t,r!==(s=e)&&i!==o&&Dr(r,i,o)>0!=Dr(r,i,s)>0&&Dr(o,s,r)>0!=Dr(o,s,i)>0)return!1;return!0}function Dr(t,e,n){return Yr(t[0],t[1],e[0],e[1],n[0],n[1])}function qr(t){var e=t.p,n=t.next.p;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]),t.maxY=Math.max(e[1],n[1]),t}function Gr(t,e){var n={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(n.next=e.next,n.prev=e,e.next.prev=n,e.next=n):(n.prev=n,n.next=n),n}function jr(t,e){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function Zr(t,e,n){var r=e[0],i=e[1],o=n[0]-r,s=n[1]-i;if(0!==o||0!==s){var a=((t[0]-r)*o+(t[1]-i)*s)/(o*o+s*s);a>1?(r=n[0],i=n[1]):a>0&&(r+=o*a,i+=s*a)}return(o=t[0]-r)*o+(s=t[1]-i)*s}function Ur(t,e,n,r,i,o,s,a){var l,u,h,c,f=n-t,p=r-e,d=s-i,g=a-o,y=t-i,x=e-o,m=f*f+p*p,v=f*d+p*g,w=d*d+g*g,b=f*y+p*x,M=d*y+g*x,P=m*w-v*v,_=P,A=P;0===P?(u=0,_=1,c=M,A=w):(c=m*M-v*b,(u=v*M-w*b)<0?(u=0,c=M,A=w):u>_&&(u=_,c=M+v,A=w)),c<0?(c=0,-b<0?u=0:-b>m?u=_:(u=-b,_=m)):c>A&&(c=A,-b+v<0?u=0:-b+v>m?u=_:(u=-b+v,_=m));var I=(1-(h=0===c?0:c/A))*i+h*s-((1-(l=0===u?0:u/_))*t+l*n),S=(1-h)*o+h*a-((1-l)*e+l*r);return I*I+S*S}function Rr(t,e){return t[0]===e[0]?t[1]-e[1]:t[0]-e[0]}const{PackUtil:Jr}=re();class Hr{constructor(t,e){this.x=t,this.y=e}clone(){return new Hr(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 Hr(this.x-t.x,this.y-t.y)}distance(t){const e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)}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 Hr(this.y,-this.x)}}function Wr(t,e,n,r){const i=e.x*r.y-e.y*r.x,o=n.x-t.x,s=n.y-t.y,a=(o*r.y-s*r.x)/i;return new Hr(t.x+a*e.x,t.y+a*e.y)}const Kr=[],Qr=[];function ti(t){if(S(t[0]&&t[0].x)){const e=[];let n=0;for(let r=0;r<t.length;r++)Qr[n]?(Qr[n][0]=t[r].x,Qr[n][1]=t[r].y):Qr[n]=[t[r].x,t[r].y],e.push(Qr[n]),n++;t=e}try{const e=Vr(t,1/0);let n=[1/0,1/0],r=[-1/0,-1/0];for(let t=0;t<e.length;t++)e[t][0]<n[0]&&(n[0]=e[t][0]),e[t][0]>r[0]&&(r[0]=e[t][0]),e[t][1]<n[1]&&(n[1]=e[t][1]),e[t][1]>r[1]&&(r[1]=e[t][1]);const i=[];let o=[],s=0;for(let t=0;t<e.length;t++)t===e.length-1&&e[t][0]===e[0][0]&&e[t][1]===e[0][1]||(_t(i,e[t],"EPSG:3857"),Kr[s]?(Kr[s].x=i[0],Kr[s].y=i[1]):Kr[s]=new Hr(i[0],i[1]),o.push(Kr[s]),s++);Jr.calculateSignedArea(o)<0&&(o=o.reverse());const a=function(t){let e,n=Number.MAX_VALUE;const r=function(t,r,i,o,s,a,l,u){var h=Wr(t,r,s,a),c=Wr(i,o,s,a),f=Wr(l,u,t,r),p=Wr(l,u,i,o),d=h.distance(c)*h.distance(f);0!==d&&d<n&&(e=[h,f,p,c],n=d)};var i=[];for(let e=0;e<t.length;e++)i.push(t[(e+1)%t.length].diff(t[e])),i[e].normalize();var o,s,a,l,u=new Hr(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new Hr(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let e=0;e<t.length;e++){var c=t[e];c.x<u.x&&(u.x=c.x,o=e),c.x>h.x&&(h.x=c.x,s=e),c.y<u.y&&(u.y=c.y,l=e),c.y>h.y&&(h.y=c.y,a=e)}var f=new Hr(0,-1),p=new Hr(0,1),d=new Hr(-1,0),g=new Hr(1,0);for(let e=0;e<t.length;e++){var y=[Math.acos(f.dot(i[o])),Math.acos(p.dot(i[s])),Math.acos(d.dot(i[a])),Math.acos(g.dot(i[l]))];switch(y.indexOf(Math.min.apply(Math,y))){case 0:(p=(f=i[o].clone()).clone()).negate(),(g=(d=f.orthogonal()).clone()).negate(),o=(o+1)%t.length;break;case 1:(f=(p=i[s].clone()).clone()).negate(),(g=(d=f.orthogonal()).clone()).negate(),s=(s+1)%t.length;break;case 2:(g=(d=i[a].clone()).clone()).negate(),(p=(f=g.orthogonal()).clone()).negate(),a=(a+1)%t.length;break;case 3:(d=(g=i[l].clone()).clone()).negate(),(p=(f=g.orthogonal()).clone()).negate(),l=(l+1)%t.length}r(t[o],f,t[s],p,t[a],d,t[l],g)}return e}(o);if(!a||4!==a.length)return null;const l=a[0].distance(a[1]),u=a[1].distance(a[2]),h=a.map((t=>[t.x,t.y]));return h.push(+(u>l)),h}catch(t){return null}}const ei=[];function ni(t,e){const n=Array.isArray(t&&t[0]&&t[0][0]);for(let r=0;r<t.length;r++)n?t[r]=ni(t[r]):(_t(ei,t[r],e),t[r][0]=ei[0],t[r][1]=ei[1]);return t}const{PackUtil:ri}=re();class ii extends Ln{constructor(t,e,n,r,i,o){super(t,e,n,r,i),(e=e||{}).extent||(e.extent=8192),this.setData(e.data,o)}clearData(){delete this.index}setData(t,e){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 e();const n={maxZoom:24,tolerance:this.options.simplifyTolerance,extent:this.options.extent,buffer:S(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&&(n.projection=this.options.projection,"EPSG:4490"===n.projection&&(n.projection="EPSG:4326")),I(t)&&"{"!=t.substring(0,1)||t.url){const r=t.url?t.url:t;O.getJSON(r,t.url?t:{},((t,i)=>{if(t&&(console.error("Failed to fetch geojson:"+r),e(t)),!i)return void e(null,{extent:null,idMap:new Map});let o=i;if(this.options.convertFn){o=new Function("data",this.options.convertFn+"\\nreturn convert(data)")(o)}const s=Array.isArray(o)?o:o.features;this._genOMBB(s);const{sample1000:a,idMap:l}=this._generateId(s);this._generate(a,l,o,n,e)}))}else{"string"==typeof t&&(t=JSON.parse(t));const r=Array.isArray(t)?t:t.features;this._genOMBB(r);let i=r;this._generate(i,null,t,n,e)}}_genOMBB(t){if(this.options.generateOMBB&&t)for(let e=0;e<t.length;e++){const n=t[e];if(n&&n.geometry&&n.geometry.coordinates)if("Polygon"===n.geometry.type){const t=n.geometry.coordinates[0];if(!t)continue;const e=ti(t,t.length);n.properties=n.properties||{},n.properties[ne]=e}else if("MultiPolygon"===n.geometry.type){const t=n.geometry.coordinates;for(let e=0;e<t.length;e++){if(!t[e])continue;const r=t[e][0];if(!r)continue;const i=ti(r,r.length);n.properties=n.properties||{},n.properties[ne]=n.properties[ne]||[],n.properties[ne][e]=i}}}}_generate(t,e,n,r,i){try{const o=t&&t.length?function(t){let e=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];switch(t.type){case"FeatureCollection":const n=t.features.length;for(let r=0;r<n;r++)Zn(t.features[r],e);break;case"Feature":Zn(t,e);break;default:Un(t,e)}return e}({type:"FeatureCollection",features:t}):null;this.index=function(t,e){return new ht(t,e)}(n,this.options.geojsonvt||r),i(null,{extent:o,idMap:e})}catch(t){console.warn(t),i({error:t.message})}}_generateId(t){const e=[],n=new Map;let r=0;const i=this.options.featureIdProperty;return t&&(t.length,t.forEach(((t,o)=>{!function(t,o,s){if(!t)return;if("Feature"===t.type&&!t.geometry)return;if(S(t.id)||(t.id=r++),i){let e=i;F(i)&&(e=i[t.layer||"0"]),t.id=t.properties[e]}const a=A({},t);t.geometry?(a.geometry=A({},t.geometry),a.geometry.coordinates=null):t.coordinates&&(a.coordinates=null),n.set(t.id,a),e.push(t)}(t)}))),{sample1000:e,idMap:n}}getTileFeatures(t,e){const n=t.tileInfo,r=[];if(!this.index)return this.empty?(setTimeout((function(){e(null,r,[])}),1),1):(setTimeout((function(){e({loading:!0})}),1),1);const i=this.index.getTile(n.z,n.x,n.y);if(!i||0===i.features.length)return setTimeout((function(){e(null,r,[])}),1),1;const o=[];for(let t=0,e=i.features.length;t<e;t++){const e=i.features[t];let n=e.layer;void 0===n&&(n="0"),o[n]={types:{}};o[n].types[e.type]=1,e.tags=e.tags||{},e.geometry.converted||(ri.convertGeometry(e),e.geometry.converted=1),r.push({type:e.type,layer:n,id:e.id,geometry:e.geometry,properties:e.tags,extent:this.options.extent})}for(const t in o)o[t].types=Object.keys(o[t].types).map((t=>+t));return setTimeout((function(){e(null,r,o)}),1),1}onRemove(){super.onRemove(),delete this.index}}var oi={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,e,n,r,i){var o,s,a=8*i-r-1,l=(1<<a)-1,u=l>>1,h=-7,c=n?i-1:0,f=n?-1:1,p=t[e+c];for(c+=f,o=p&(1<<-h)-1,p>>=-h,h+=a;h>0;o=256*o+t[e+c],c+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+t[e+c],c+=f,h-=8);if(0===o)o=1-u;else{if(o===l)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=u}return(p?-1:1)*s*Math.pow(2,o-r)},write:function(t,e,n,r,i,o){var s,a,l,u=8*o-i-1,h=(1<<u)-1,c=h>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+c>=1?f/l:f*Math.pow(2,1-c))*l>=2&&(s++,l/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(e*l-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[n+p]=255&s,p+=d,s/=256,u-=8);t[n+p-d]|=128*g}},si=li,ai=oi;function li(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}li.Varint=0,li.Fixed64=1,li.Bytes=2,li.Fixed32=5;var ui=4294967296,hi=1/ui,ci="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function fi(t){return t.type===li.Bytes?t.readVarint()+t.pos:t.pos+1}function pi(t,e,n){return n?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function di(t,e,n){var r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));n.realloc(r);for(var i=n.pos-1;i>=t;i--)n.buf[i+r]=n.buf[i]}function gi(t,e){for(var n=0;n<t.length;n++)e.writeVarint(t[n])}function yi(t,e){for(var n=0;n<t.length;n++)e.writeSVarint(t[n])}function xi(t,e){for(var n=0;n<t.length;n++)e.writeFloat(t[n])}function mi(t,e){for(var n=0;n<t.length;n++)e.writeDouble(t[n])}function vi(t,e){for(var n=0;n<t.length;n++)e.writeBoolean(t[n])}function wi(t,e){for(var n=0;n<t.length;n++)e.writeFixed32(t[n])}function bi(t,e){for(var n=0;n<t.length;n++)e.writeSFixed32(t[n])}function Mi(t,e){for(var n=0;n<t.length;n++)e.writeFixed64(t[n])}function Pi(t,e){for(var n=0;n<t.length;n++)e.writeSFixed64(t[n])}function _i(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Ai(t,e,n){t[n]=e,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24}function Ii(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}li.prototype={destroy:function(){this.buf=null},readFields:function(t,e,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),i=r>>3,o=this.pos;this.type=7&r,t(i,e,this),this.pos===o&&this.skip(r)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=_i(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Ii(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=_i(this.buf,this.pos)+_i(this.buf,this.pos+4)*ui;return this.pos+=8,t},readSFixed64:function(){var t=_i(this.buf,this.pos)+Ii(this.buf,this.pos+4)*ui;return this.pos+=8,t},readFloat:function(){var t=ai.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=ai.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,n,r=this.buf;return e=127&(n=r[this.pos++]),n<128?e:(e|=(127&(n=r[this.pos++]))<<7,n<128?e:(e|=(127&(n=r[this.pos++]))<<14,n<128?e:(e|=(127&(n=r[this.pos++]))<<21,n<128?e:function(t,e,n){var r,i,o=n.buf;if(i=o[n.pos++],r=(112&i)>>4,i<128)return pi(t,r,e);if(i=o[n.pos++],r|=(127&i)<<3,i<128)return pi(t,r,e);if(i=o[n.pos++],r|=(127&i)<<10,i<128)return pi(t,r,e);if(i=o[n.pos++],r|=(127&i)<<17,i<128)return pi(t,r,e);if(i=o[n.pos++],r|=(127&i)<<24,i<128)return pi(t,r,e);if(i=o[n.pos++],r|=(1&i)<<31,i<128)return pi(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(n=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,e=this.pos;return this.pos=t,t-e>=12&&ci?function(t,e,n){return ci.decode(t.subarray(e,n))}(this.buf,e,t):function(t,e,n){var r="",i=e;for(;i<n;){var o,s,a,l=t[i],u=null,h=l>239?4:l>223?3:l>191?2:1;if(i+h>n)break;1===h?l<128&&(u=l):2===h?128==(192&(o=t[i+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===h?(o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&((u=(15&l)<<12|(63&o)<<6|63&s)<=2047||u>=55296&&u<=57343)&&(u=null)):4===h&&(o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&((u=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,h=1):u>65535&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),i+=h}return r}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==li.Bytes)return t.push(this.readVarint(e));var n=fi(this);for(t=t||[];this.pos<n;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==li.Bytes)return t.push(this.readSVarint());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==li.Bytes)return t.push(this.readBoolean());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==li.Bytes)return t.push(this.readFloat());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==li.Bytes)return t.push(this.readDouble());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==li.Bytes)return t.push(this.readFixed32());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==li.Bytes)return t.push(this.readSFixed32());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==li.Bytes)return t.push(this.readFixed64());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==li.Bytes)return t.push(this.readSFixed64());var e=fi(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===li.Varint)for(;this.buf[this.pos++]>127;);else if(e===li.Bytes)this.pos=this.readVarint()+this.pos;else if(e===li.Fixed32)this.pos+=4;else{if(e!==li.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var n=new Uint8Array(e);n.set(this.buf),this.buf=n,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Ai(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Ai(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Ai(this.buf,-1&t,this.pos),Ai(this.buf,Math.floor(t*hi),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Ai(this.buf,-1&t,this.pos),Ai(this.buf,Math.floor(t*hi),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var n,r;t>=0?(n=t%4294967296|0,r=t/4294967296|0):(r=~(-t/4294967296),4294967295^(n=~(-t%4294967296))?n=n+1|0:(n=0,r=r+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,n){n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos]=127&t}(n,0,e),function(t,e){var n=(7&t)<<4;if(e.buf[e.pos++]|=n|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(r,e)}(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 e=this.pos;this.pos=function(t,e,n){for(var r,i,o=0;o<e.length;o++){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){r>56319||o+1===e.length?(t[n++]=239,t[n++]=191,t[n++]=189):i=r;continue}if(r<56320){t[n++]=239,t[n++]=191,t[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&(t[n++]=239,t[n++]=191,t[n++]=189,i=null);r<128?t[n++]=r:(r<2048?t[n++]=r>>6|192:(r<65536?t[n++]=r>>12|224:(t[n++]=r>>18|240,t[n++]=r>>12&63|128),t[n++]=r>>6&63|128),t[n++]=63&r|128)}return n}(this.buf,t,this.pos);var n=this.pos-e;n>=128&&di(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n},writeFloat:function(t){this.realloc(4),ai.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),ai.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var n=0;n<e;n++)this.buf[this.pos++]=t[n]},writeRawMessage:function(t,e){this.pos++;var n=this.pos;t(e,this);var r=this.pos-n;r>=128&&di(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,e,n){this.writeTag(t,li.Bytes),this.writeRawMessage(e,n)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,gi,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,yi,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,vi,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,xi,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,mi,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,wi,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,bi,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Mi,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Pi,e)},writeBytesField:function(t,e){this.writeTag(t,li.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,li.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,li.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,li.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,li.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,li.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,li.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,li.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,li.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,li.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Si=xr(si),Ti=Fi;function Fi(t,e){this.x=t,this.y=e}Fi.prototype={clone:function(){return new Fi(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},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 e=t.x-this.x,n=t.y-this.y;return e*e+n*n},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,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),n=Math.sin(t),r=e*this.x-n*this.y,i=n*this.x+e*this.y;return this.x=r,this.y=i,this},_rotateAround:function(t,e){var n=Math.cos(t),r=Math.sin(t),i=e.x+n*(this.x-e.x)-r*(this.y-e.y),o=e.y+r*(this.x-e.x)+n*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Fi.convert=function(t){return t instanceof Fi?t:Array.isArray(t)?new Fi(t[0],t[1]):t};var ki=Ti,Li=Ci;function Ci(t,e,n,r,i){this.properties={},this.extent=n,this.type=0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=i,t.readFields(Bi,this,e)}function Bi(t,e,n){1==t?e.id=n.readVarint():2==t?function(t,e){var n=t.readVarint()+t.pos;for(;t.pos<n;){var r=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[r]=i}}(n,e):3==t?e.type=n.readVarint():4==t&&(e._geometry=n.pos)}function Oi(t){for(var e,n,r=0,i=0,o=t.length,s=o-1;i<o;s=i++)e=t[i],r+=((n=t[s]).x-e.x)*(e.y+n.y);return r}Ci.types=["Unknown","Point","LineString","Polygon"],Ci.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,n=t.readVarint()+t.pos,r=1,i=0,o=0,s=0,a=[];t.pos<n;){if(i<=0){var l=t.readVarint();r=7&l,i=l>>3}if(i--,1===r||2===r)o+=t.readSVarint(),s+=t.readSVarint(),1===r&&(e&&a.push(e),e=[]),e.push(new ki(o,s));else{if(7!==r)throw new Error("unknown command "+r);e&&e.push(e[0].clone())}}return e&&a.push(e),a},Ci.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,n=1,r=0,i=0,o=0,s=1/0,a=-1/0,l=1/0,u=-1/0;t.pos<e;){if(r<=0){var h=t.readVarint();n=7&h,r=h>>3}if(r--,1===n||2===n)(i+=t.readSVarint())<s&&(s=i),i>a&&(a=i),(o+=t.readSVarint())<l&&(l=o),o>u&&(u=o);else if(7!==n)throw new Error("unknown command "+n)}return[s,l,a,u]},Ci.prototype.toGeoJSON=function(t,e,n){var r,i,o=this.extent*Math.pow(2,n),s=this.extent*t,a=this.extent*e,l=this.loadGeometry(),u=Ci.types[this.type];function h(t){for(var e=0;e<t.length;e++){var n=t[e],r=180-360*(n.y+a)/o;t[e]=[360*(n.x+s)/o-180,360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90]}}switch(this.type){case 1:var c=[];for(r=0;r<l.length;r++)c[r]=l[r][0];h(l=c);break;case 2:for(r=0;r<l.length;r++)h(l[r]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var n,r,i=[],o=0;o<e;o++){var s=Oi(t[o]);0!==s&&(void 0===r&&(r=s<0),r===s<0?(n&&i.push(n),n=[t[o]]):n.push(t[o]))}n&&i.push(n);return i}(l),r=0;r<l.length;r++)for(i=0;i<l[r].length;i++)h(l[r][i])}1===l.length?l=l[0]:u="Multi"+u;var f={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(f.id=this.id),f};var Yi=Li,Vi=Xi;function Xi(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Ni,this,e),this.length=this._features.length}function Ni(t,e,n){15===t?e.version=n.readVarint():1===t?e.name=n.readString():5===t?e.extent=n.readVarint():2===t?e._features.push(n.pos):3===t?e._keys.push(n.readString()):4===t&&e._values.push(function(t){var e=null,n=t.readVarint()+t.pos;for(;t.pos<n;){var r=t.readVarint()>>3;e=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 e}(n))}Xi.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new Yi(this._pbf,e,this.extent,this._keys,this._values)};var Ei=Vi,zi=function(t,e){this.layers=t.readFields($i,{},e)};function $i(t,e,n){if(3===t){var r=new Ei(n,n.readVarint()+n.pos);r.length&&(e[r.name]=r)}}var Di=zi;const qi=2,Gi=new TextDecoder("utf-8");class ji extends Ln{constructor(t,e,n,r,i,o){super(t,e,n,r,i),e=e||{},o()}clearData(){this._abortRequests()}getTileFeatures(t,e){const n=t.tileInfo.url,r=t.fetchOptions||{},{altitudePropertyName:i,disableAltitudeWarning:o}=t,s=this._cache.get(n);if(s&&s.cacheIndex===t.workerCacheIndex){const{err:t,data:r}=s;return setTimeout((()=>{this._readTile(n,i,o,t,r,e)}),1)}const{tileArrayBuffer:a}=t;if(a)return setTimeout((()=>{this._readTile(n,i,o,null,a,e)}),1);r.referrer=t.referrer,r.errorLog=t.loadTileErrorLog;const{loadTileCachMaxSize:l,loadTileCacheLog:u}=t;return O.getArrayBuffer(n,r,((r,s)=>{if(this._cache){if(r)r.loading||this._cache.add(n,{err:r,data:s&&s.data,cacheIndex:t.workerCacheIndex});else if(s&&s.data){let e=!0;if("number"==typeof(h=l)&&!isNaN(h)&&l>0){const t=(a=s.data)&&a instanceof ArrayBuffer?a.byteLength/1048576:0;t>l&&(e=!1,u&&console.warn(\`url:${G}n},loadTileCachMaxSize exceeded: ${G}t} > ${G}l},the tile will not be cached.\`))}e&&this._cache.add(n,{err:null,data:s.data,cacheIndex:t.workerCacheIndex})}var a,h;this._readTile(n,i,o,r,s&&s.data,e)}}))}_readTile(t,e,n,r,i,o){if(r)return void o(r);let s;try{s=new Di(new Si(i))}catch(r){const e=Gi.decode(i);return r.message+="\\n"+t+"\\n"+e,void o(r.message,[],[])}const a=[];if(!s.layers)return void o(null,a,[]);const l={};let u;for(const t in s.layers)if(h=s.layers,c=t,Object.prototype.hasOwnProperty.call(h,c)){l[t]={types:{}};const i=l[t].types;for(let o=0,l=s.layers[t].length;o<l;o++)try{u=s.layers[t].feature(o),i[u.type]=1;const r={type:u.type,layer:t,geometry:u.loadGeometry(),properties:u.properties,extent:u.extent};void 0!==u.id&&(r.id=u.id);let l=r.properties[ne];l&&(I(l)&&(l=JSON.parse(l)),r.properties[ne]=ni(l,"EPSG:3857"));const h=e&&r.properties[e];if(h){const t=Zi(h),e=[];Ui(r.geometry,t,e),e.length&&!n&&(console.warn("feature.geometry is not consistent with altitude values:"),console.warn(JSON.stringify(r,null,2)))}a.push(r)}catch(r){console.warn("error when load vt geometry:",r)}}var h,c;for(const t in l)l[t].types=Object.keys(l[t].types).map((t=>+t));o(null,a,l,{byteLength:i.byteLength})}abortTile(t,e){const n=this.requests[t];delete this.requests[t],n&&n.abort&&n.abort(),this._cancelLoadings(t),e()}onRemove(){super.onRemove(),this._abortRequests()}_abortRequests(){for(const t in this.requests){const e=this.requests[t];e&&e.abort&&e.abort()}this.requests={}}}function Zi(t){const e=atob(t),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return new Float32Array(n.buffer)}function Ui(t,e,n,r){r||(r={index:0});for(let i=0;i<t.length;i++)if(Array.isArray(t[i]))Ui(t[i],e,n,r);else{const o=r.index;k(e[o])?n.push(qi):t[i].z=100*e[o],r.index++}}const{LRUCache:Ri}=re();let Ji=0;const Hi=new Ri(128);class Wi{constructor(t){this._layers={},this._callbacks={},this.workerId=t}addLayer({actorId:t,mapId:e,layerId:n,params:r},i){if(this._getLayerById(e,n))return;const o=this._genKey(e,n),s=r.type,a=r.options,l=this.send.bind(this,t);this._layers[o]="GeoJSONVectorTileLayer"===s?new ii(n,a,l,Hi,{},i):new ji(n,a,l,Hi,{},i)}removeLayer({mapId:t,layerId:e},n){const r=this._getLayerById(t,e),i=this._genKey(t,e);delete this._layers[i],r&&r.onRemove(n)}loadTile({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.loadTile(n,r)}abortTile({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.abortTile&&i.abortTile(n.url,r)}removeTile({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.removeTile(n,r)}updateStyle({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.updateStyle(n,r)}updateOptions({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.updateOptions(n,r)}setData({mapId:t,layerId:e,params:n},r){const i=this._getLayerById(t,e);i&&i.setData(n.data,r)}clearData({mapId:t,layerId:e},n){const r=this._getLayerById(t,e);r&&(r.clearData(n),this._resetCache())}receive(t){const e=t.callback,n=this._callbacks[e];delete this._callbacks[e],n&&t.error?n(new Error(t.error)):n&&n(null,t.data)}send(t,e,n,r,i){const o=i?\`${G}t}-${G}Ji++}\`:null;i&&(this._callbacks[o]=i),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:e,params:n,callback:String(o)},r||[])}_genKey(t,e){return\`${G}t}-${G}e}\`}_getLayerById(t,e){const n=this._genKey(t,e);return this._layers[n]}_resetCache(){Hi.reset()}}t.initialize=function(){},t.onmessage=function(t,e){const n=t.data;if(this.dispatcher||(this.dispatcher=new Wi(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const r=n.command,i=(n.params||{}).loadTileErrorLog,o=(n.params||{}).loadTileErrorLogIgnoreCodes||[];this.dispatcher[r]({actorId:t.actorId,mapId:n.mapId,layerId:n.layerId,params:n.params},((t,n,s)=>{if(i&&t&&!t.loading){const e=t.status;S(e)&&-1===o.indexOf(e)&&console.error(r,t)}e(t,n,s)}))}}}`;
35
35
 
36
36
  function W(e) {
37
37
  const t = function() {
@@ -549,10 +549,10 @@ function W(e) {
549
549
  function E(e) {
550
550
  return e < 65536 ? Uint16Array : Uint32Array;
551
551
  }
552
- function D(e) {
552
+ function H(e) {
553
553
  return (e = Math.abs(e)) < 32768 ? Int16Array : Float32Array;
554
554
  }
555
- function H(e) {
555
+ function D(e) {
556
556
  return e < 65536 ? Uint16Array : Float32Array;
557
557
  }
558
558
  function L(e, t) {
@@ -1537,12 +1537,12 @@ function W(e) {
1537
1537
  return t(e(n));
1538
1538
  };
1539
1539
  }
1540
- function De(e, t) {
1540
+ function He(e, t) {
1541
1541
  for (var n = [ t[e].parent, e ], i = Fe[t[e].parent][e], r = t[e].parent; t[r].parent; ) n.unshift(t[r].parent),
1542
1542
  i = Ee(Fe[t[r].parent][r], i), r = t[r].parent;
1543
1543
  return i.conversion = n, i;
1544
1544
  }
1545
- var He = Re, Le = function(e) {
1545
+ var De = Re, Le = function(e) {
1546
1546
  for (var t = function(e) {
1547
1547
  var t = function() {
1548
1548
  for (var e = {}, t = Object.keys(Fe), n = t.length, i = 0; i < n; i++) e[t[i]] = {
@@ -1558,15 +1558,15 @@ function W(e) {
1558
1558
  return t;
1559
1559
  }(e), n = {}, i = Object.keys(t), r = i.length, o = 0; o < r; o++) {
1560
1560
  var s = i[o];
1561
- null !== t[s].parent && (n[s] = De(s, t));
1561
+ null !== t[s].parent && (n[s] = He(s, t));
1562
1562
  }
1563
1563
  return n;
1564
1564
  }, Ne = {};
1565
- Object.keys(He).forEach((function(e) {
1565
+ Object.keys(De).forEach((function(e) {
1566
1566
  Ne[e] = {}, Object.defineProperty(Ne[e], "channels", {
1567
- value: He[e].channels
1567
+ value: De[e].channels
1568
1568
  }), Object.defineProperty(Ne[e], "labels", {
1569
- value: He[e].labels
1569
+ value: De[e].labels
1570
1570
  });
1571
1571
  var t = Le(e);
1572
1572
  Object.keys(t).forEach((function(n) {
@@ -2170,9 +2170,9 @@ function W(e) {
2170
2170
  }
2171
2171
  }
2172
2172
  var Et = Ft;
2173
- const Dt = {
2173
+ const Ht = {
2174
2174
  kind: "null"
2175
- }, Ht = {
2175
+ }, Dt = {
2176
2176
  kind: "number"
2177
2177
  }, Lt = {
2178
2178
  kind: "string"
@@ -2205,7 +2205,7 @@ function W(e) {
2205
2205
  }
2206
2206
  return e.kind;
2207
2207
  }
2208
- const $t = [ Dt, Ht, Lt, Nt, zt, Bt, Vt, jt(Ut), Wt ];
2208
+ const $t = [ Ht, Dt, Lt, Nt, zt, Bt, Vt, jt(Ut), Wt ];
2209
2209
  function Yt(e, t) {
2210
2210
  if ("error" === t.kind) return null;
2211
2211
  if ("array" === e.kind) {
@@ -2543,10 +2543,10 @@ function W(e) {
2543
2543
  return !1;
2544
2544
  }
2545
2545
  function dn(e) {
2546
- if (null === e) return Dt;
2546
+ if (null === e) return Ht;
2547
2547
  if ("string" == typeof e) return Lt;
2548
2548
  if ("boolean" == typeof e) return Nt;
2549
- if ("number" == typeof e) return Ht;
2549
+ if ("number" == typeof e) return Dt;
2550
2550
  if (e instanceof sn) return zt;
2551
2551
  if (e instanceof an) return Gt;
2552
2552
  if (e instanceof hn) return Bt;
@@ -2605,7 +2605,7 @@ function W(e) {
2605
2605
  };
2606
2606
  const xn = {
2607
2607
  string: Lt,
2608
- number: Ht,
2608
+ number: Dt,
2609
2609
  boolean: Nt,
2610
2610
  object: Vt
2611
2611
  };
@@ -2681,7 +2681,7 @@ function W(e) {
2681
2681
  if (r && "object" == typeof o && !Array.isArray(o)) {
2682
2682
  r = !1;
2683
2683
  let e = null;
2684
- if (o["font-scale"] && (e = t.parse(o["font-scale"], 1, Ht), !e)) return null;
2684
+ if (o["font-scale"] && (e = t.parse(o["font-scale"], 1, Dt), !e)) return null;
2685
2685
  let n = null;
2686
2686
  if (o["text-font"] && (n = t.parse(o["text-font"], 1, jt(Lt)), !n)) return null;
2687
2687
  let s = null;
@@ -2754,7 +2754,7 @@ function W(e) {
2754
2754
  const Sn = {
2755
2755
  "to-boolean": Nt,
2756
2756
  "to-color": zt,
2757
- "to-number": Ht,
2757
+ "to-number": Dt,
2758
2758
  "to-string": Lt
2759
2759
  };
2760
2760
  class bn {
@@ -2958,16 +2958,16 @@ function W(e) {
2958
2958
  const o = Math.pow(2, t.z);
2959
2959
  return [ Math.round(n * o * kn), Math.round(i * o * kn) ];
2960
2960
  }
2961
- function Dn(e, t, n) {
2961
+ function Hn(e, t, n) {
2962
2962
  const i = e[0] - t[0], r = e[1] - t[1], o = e[0] - n[0], s = e[1] - n[1];
2963
2963
  return i * s - o * r == 0 && i * o <= 0 && r * s <= 0;
2964
2964
  }
2965
- function Hn(e, t) {
2965
+ function Dn(e, t) {
2966
2966
  let n = !1;
2967
2967
  for (let s = 0, a = t.length; s < a; s++) {
2968
2968
  const a = t[s];
2969
2969
  for (let t = 0, s = a.length; t < s - 1; t++) {
2970
- if (Dn(e, a[t], a[t + 1])) return !1;
2970
+ if (Hn(e, a[t], a[t + 1])) return !1;
2971
2971
  i = e, r = a[t], o = a[t + 1], r[1] > i[1] != o[1] > i[1] && i[0] < (o[0] - r[0]) * (i[1] - r[1]) / (o[1] - r[1]) + r[0] && (n = !n);
2972
2972
  }
2973
2973
  }
@@ -2975,7 +2975,7 @@ function W(e) {
2975
2975
  return n;
2976
2976
  }
2977
2977
  function Ln(e, t) {
2978
- for (let n = 0; n < t.length; n++) if (Hn(e, t[n])) return !0;
2978
+ for (let n = 0; n < t.length; n++) if (Dn(e, t[n])) return !0;
2979
2979
  return !1;
2980
2980
  }
2981
2981
  function Nn(e, t, n, i) {
@@ -2992,7 +2992,7 @@ function W(e) {
2992
2992
  return !1;
2993
2993
  }
2994
2994
  function Un(e, t) {
2995
- for (let n = 0; n < e.length; ++n) if (!Hn(e[n], t)) return !1;
2995
+ for (let n = 0; n < e.length; ++n) if (!Dn(e[n], t)) return !1;
2996
2996
  for (let n = 0; n < e.length - 1; ++n) if (Vn(e[n], e[n + 1], t)) return !1;
2997
2997
  return !0;
2998
2998
  }
@@ -3081,7 +3081,7 @@ function W(e) {
3081
3081
  if ("Polygon" === t.type) {
3082
3082
  const o = Bn(t.coordinates, i, r), s = Xn(e.geometry(), n, i, r);
3083
3083
  if (!Fn(n, i)) return !1;
3084
- for (const e of s) if (!Hn(e, o)) return !1;
3084
+ for (const e of s) if (!Dn(e, o)) return !1;
3085
3085
  }
3086
3086
  if ("MultiPolygon" === t.type) {
3087
3087
  const o = Wn(t.coordinates, i, r), s = Xn(e.geometry(), n, i, r);
@@ -3253,7 +3253,7 @@ function W(e) {
3253
3253
  static parse(e, t) {
3254
3254
  if (e.length - 1 < 4) return t.error(`Expected at least 4 arguments, but found only ${e.length - 1}.`);
3255
3255
  if ((e.length - 1) % 2 != 0) return t.error("Expected an even number of arguments.");
3256
- const n = t.parse(e[1], 1, Ht);
3256
+ const n = t.parse(e[1], 1, Dt);
3257
3257
  if (!n) return null;
3258
3258
  const i = [];
3259
3259
  let r = null;
@@ -3450,7 +3450,7 @@ function W(e) {
3450
3450
  }
3451
3451
  if (e.length - 1 < 4) return t.error(`Expected at least 4 arguments, but found only ${e.length - 1}.`);
3452
3452
  if ((e.length - 1) % 2 != 0) return t.error("Expected an even number of arguments.");
3453
- if (r = t.parse(r, 2, Ht), !r) return null;
3453
+ if (r = t.parse(r, 2, Dt), !r) return null;
3454
3454
  const s = [];
3455
3455
  let a = null;
3456
3456
  "interpolate-hcl" === n || "interpolate-lab" === n ? a = zt : t.expectedType && "value" !== t.expectedType.kind && (a = t.expectedType);
@@ -3571,17 +3571,17 @@ function W(e) {
3571
3571
  return e.push(this.result.serialize()), e;
3572
3572
  }
3573
3573
  }
3574
- var Di = Ei;
3575
- class Hi {
3574
+ var Hi = Ei;
3575
+ class Di {
3576
3576
  constructor(e, t, n) {
3577
3577
  this.type = e, this.index = t, this.input = n;
3578
3578
  }
3579
3579
  static parse(e, t) {
3580
3580
  if (3 !== e.length) return t.error(`Expected 2 arguments, but found ${e.length - 1} instead.`);
3581
- const n = t.parse(e[1], 1, Ht), i = t.parse(e[2], 2, jt(t.expectedType || Ut));
3581
+ const n = t.parse(e[1], 1, Dt), i = t.parse(e[2], 2, jt(t.expectedType || Ut));
3582
3582
  if (!n || !i) return null;
3583
3583
  const r = i.type;
3584
- return new Hi(r.itemType, n, i);
3584
+ return new Di(r.itemType, n, i);
3585
3585
  }
3586
3586
  evaluate(e) {
3587
3587
  const t = this.index.evaluate(e), n = this.input.evaluate(e);
@@ -3600,7 +3600,7 @@ function W(e) {
3600
3600
  return [ "at", this.index.serialize(), this.input.serialize() ];
3601
3601
  }
3602
3602
  }
3603
- var Li = Hi;
3603
+ var Li = Di;
3604
3604
  class Ni {
3605
3605
  constructor(e, t) {
3606
3606
  this.type = Nt, this.needle = e, this.haystack = t;
@@ -3608,7 +3608,7 @@ function W(e) {
3608
3608
  static parse(e, t) {
3609
3609
  if (3 !== e.length) return t.error(`Expected 2 arguments, but found ${e.length - 1} instead.`);
3610
3610
  const n = t.parse(e[1], 1, Ut), i = t.parse(e[2], 2, Ut);
3611
- return n && i ? Zt(n.type, [ Nt, Lt, Ht, Dt, Ut ]) ? new Ni(n, i) : t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Xt(n.type)} instead`) : null;
3611
+ return n && i ? Zt(n.type, [ Nt, Lt, Dt, Ht, Ut ]) ? new Ni(n, i) : t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Xt(n.type)} instead`) : null;
3612
3612
  }
3613
3613
  evaluate(e) {
3614
3614
  const t = this.needle.evaluate(e), n = this.haystack.evaluate(e);
@@ -3630,15 +3630,15 @@ function W(e) {
3630
3630
  var zi = Ni;
3631
3631
  class Vi {
3632
3632
  constructor(e, t, n) {
3633
- this.type = Ht, this.needle = e, this.haystack = t, this.fromIndex = n;
3633
+ this.type = Dt, this.needle = e, this.haystack = t, this.fromIndex = n;
3634
3634
  }
3635
3635
  static parse(e, t) {
3636
3636
  if (e.length <= 2 || e.length >= 5) return t.error(`Expected 3 or 4 arguments, but found ${e.length - 1} instead.`);
3637
3637
  const n = t.parse(e[1], 1, Ut), i = t.parse(e[2], 2, Ut);
3638
3638
  if (!n || !i) return null;
3639
- if (!Zt(n.type, [ Nt, Lt, Ht, Dt, Ut ])) return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Xt(n.type)} instead`);
3639
+ if (!Zt(n.type, [ Nt, Lt, Dt, Ht, Ut ])) return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Xt(n.type)} instead`);
3640
3640
  if (4 === e.length) {
3641
- const r = t.parse(e[3], 3, Ht);
3641
+ const r = t.parse(e[3], 3, Dt);
3642
3642
  return r ? new Vi(n, i, r) : null;
3643
3643
  }
3644
3644
  return new Vi(n, i);
@@ -3771,11 +3771,11 @@ function W(e) {
3771
3771
  }
3772
3772
  static parse(e, t) {
3773
3773
  if (e.length <= 2 || e.length >= 5) return t.error(`Expected 3 or 4 arguments, but found ${e.length - 1} instead.`);
3774
- const n = t.parse(e[1], 1, Ut), i = t.parse(e[2], 2, Ht);
3774
+ const n = t.parse(e[1], 1, Ut), i = t.parse(e[2], 2, Dt);
3775
3775
  if (!n || !i) return null;
3776
3776
  if (!Zt(n.type, [ jt(Ut), Lt, Ut ])) return t.error(`Expected first argument to be of type array or string, but found ${Xt(n.type)} instead`);
3777
3777
  if (4 === e.length) {
3778
- const r = t.parse(e[3], 3, Ht);
3778
+ const r = t.parse(e[3], 3, Dt);
3779
3779
  return r ? new Xi(n.type, n, i, r) : null;
3780
3780
  }
3781
3781
  return new Xi(n.type, n, i);
@@ -3890,7 +3890,7 @@ function W(e) {
3890
3890
  }
3891
3891
  static parse(e, t) {
3892
3892
  if (3 !== e.length) return t.error("Expected two arguments.");
3893
- const n = t.parse(e[1], 1, Ht);
3893
+ const n = t.parse(e[1], 1, Dt);
3894
3894
  if (!n) return null;
3895
3895
  const i = e[2];
3896
3896
  if ("object" != typeof i || Array.isArray(i)) return t.error("NumberFormat options argument must be an object.");
@@ -3901,9 +3901,9 @@ function W(e) {
3901
3901
  let s = null;
3902
3902
  if (i.unit && (s = t.parse(i.unit, 1, Lt), !s)) return null;
3903
3903
  let a = null;
3904
- if (i["min-fraction-digits"] && (a = t.parse(i["min-fraction-digits"], 1, Ht), !a)) return null;
3904
+ if (i["min-fraction-digits"] && (a = t.parse(i["min-fraction-digits"], 1, Dt), !a)) return null;
3905
3905
  let l = null;
3906
- return i["max-fraction-digits"] && (l = t.parse(i["max-fraction-digits"], 1, Ht),
3906
+ return i["max-fraction-digits"] && (l = t.parse(i["max-fraction-digits"], 1, Dt),
3907
3907
  !l) ? null : new ir(n, r, o, s, a, l);
3908
3908
  }
3909
3909
  evaluate(e) {
@@ -3933,7 +3933,7 @@ function W(e) {
3933
3933
  }
3934
3934
  class rr {
3935
3935
  constructor(e) {
3936
- this.type = Ht, this.input = e;
3936
+ this.type = Dt, this.input = e;
3937
3937
  }
3938
3938
  static parse(e, t) {
3939
3939
  if (2 !== e.length) return t.error(`Expected 1 argument, but found ${e.length - 1} instead.`);
@@ -3980,7 +3980,7 @@ function W(e) {
3980
3980
  "interpolate-hcl": ki,
3981
3981
  "interpolate-lab": ki,
3982
3982
  length: rr,
3983
- let: Di,
3983
+ let: Hi,
3984
3984
  literal: mn,
3985
3985
  match: Bi,
3986
3986
  number: vn,
@@ -4021,9 +4021,9 @@ function W(e) {
4021
4021
  throw new yn(t.evaluate(e));
4022
4022
  } ],
4023
4023
  typeof: [ Lt, [ Ut ], (e, [t]) => Xt(dn(t.evaluate(e))) ],
4024
- "to-rgba": [ jt(Ht, 4), [ zt ], (e, [t]) => t.evaluate(e).toArray() ],
4025
- rgb: [ zt, [ Ht, Ht, Ht ], sr ],
4026
- rgba: [ zt, [ Ht, Ht, Ht, Ht ], sr ],
4024
+ "to-rgba": [ jt(Dt, 4), [ zt ], (e, [t]) => t.evaluate(e).toArray() ],
4025
+ rgb: [ zt, [ Dt, Dt, Dt ], sr ],
4026
+ rgba: [ zt, [ Dt, Dt, Dt, Dt ], sr ],
4027
4027
  has: {
4028
4028
  type: Nt,
4029
4029
  overloads: [ [ [ Lt ], (e, [t]) => ar(t.evaluate(e), e.properties()) ], [ [ Lt, Vt ], (e, [t, n]) => ar(t.evaluate(e), n.evaluate(e)) ] ]
@@ -4036,52 +4036,52 @@ function W(e) {
4036
4036
  properties: [ Vt, [], e => e.properties() ],
4037
4037
  "geometry-type": [ Lt, [], e => e.geometryType() ],
4038
4038
  id: [ Ut, [], e => e.id() ],
4039
- zoom: [ Ht, [], e => e.globals.zoom ],
4040
- pitch: [ Ht, [], e => e.globals.pitch || 0 ],
4041
- "distance-from-center": [ Ht, [], e => e.distanceFromCenter() ],
4042
- "heatmap-density": [ Ht, [], e => e.globals.heatmapDensity || 0 ],
4043
- "line-progress": [ Ht, [], e => e.globals.lineProgress || 0 ],
4044
- "sky-radial-progress": [ Ht, [], e => e.globals.skyRadialProgress || 0 ],
4039
+ zoom: [ Dt, [], e => e.globals.zoom ],
4040
+ pitch: [ Dt, [], e => e.globals.pitch || 0 ],
4041
+ "distance-from-center": [ Dt, [], e => e.distanceFromCenter() ],
4042
+ "heatmap-density": [ Dt, [], e => e.globals.heatmapDensity || 0 ],
4043
+ "line-progress": [ Dt, [], e => e.globals.lineProgress || 0 ],
4044
+ "sky-radial-progress": [ Dt, [], e => e.globals.skyRadialProgress || 0 ],
4045
4045
  accumulated: [ Ut, [], e => void 0 === e.globals.accumulated ? null : e.globals.accumulated ],
4046
- "+": [ Ht, hr(Ht), (e, t) => {
4046
+ "+": [ Dt, hr(Dt), (e, t) => {
4047
4047
  let n = 0;
4048
4048
  for (const i of t) n += i.evaluate(e);
4049
4049
  return n;
4050
4050
  } ],
4051
- "*": [ Ht, hr(Ht), (e, t) => {
4051
+ "*": [ Dt, hr(Dt), (e, t) => {
4052
4052
  let n = 1;
4053
4053
  for (const i of t) n *= i.evaluate(e);
4054
4054
  return n;
4055
4055
  } ],
4056
4056
  "-": {
4057
- type: Ht,
4058
- overloads: [ [ [ Ht, Ht ], (e, [t, n]) => t.evaluate(e) - n.evaluate(e) ], [ [ Ht ], (e, [t]) => -t.evaluate(e) ] ]
4057
+ type: Dt,
4058
+ overloads: [ [ [ Dt, Dt ], (e, [t, n]) => t.evaluate(e) - n.evaluate(e) ], [ [ Dt ], (e, [t]) => -t.evaluate(e) ] ]
4059
4059
  },
4060
- "/": [ Ht, [ Ht, Ht ], (e, [t, n]) => t.evaluate(e) / n.evaluate(e) ],
4061
- "%": [ Ht, [ Ht, Ht ], (e, [t, n]) => t.evaluate(e) % n.evaluate(e) ],
4062
- ln2: [ Ht, [], () => Math.LN2 ],
4063
- pi: [ Ht, [], () => Math.PI ],
4064
- e: [ Ht, [], () => Math.E ],
4065
- "^": [ Ht, [ Ht, Ht ], (e, [t, n]) => Math.pow(t.evaluate(e), n.evaluate(e)) ],
4066
- sqrt: [ Ht, [ Ht ], (e, [t]) => Math.sqrt(t.evaluate(e)) ],
4067
- log10: [ Ht, [ Ht ], (e, [t]) => Math.log(t.evaluate(e)) / Math.LN10 ],
4068
- ln: [ Ht, [ Ht ], (e, [t]) => Math.log(t.evaluate(e)) ],
4069
- log2: [ Ht, [ Ht ], (e, [t]) => Math.log(t.evaluate(e)) / Math.LN2 ],
4070
- sin: [ Ht, [ Ht ], (e, [t]) => Math.sin(t.evaluate(e)) ],
4071
- cos: [ Ht, [ Ht ], (e, [t]) => Math.cos(t.evaluate(e)) ],
4072
- tan: [ Ht, [ Ht ], (e, [t]) => Math.tan(t.evaluate(e)) ],
4073
- asin: [ Ht, [ Ht ], (e, [t]) => Math.asin(t.evaluate(e)) ],
4074
- acos: [ Ht, [ Ht ], (e, [t]) => Math.acos(t.evaluate(e)) ],
4075
- atan: [ Ht, [ Ht ], (e, [t]) => Math.atan(t.evaluate(e)) ],
4076
- min: [ Ht, hr(Ht), (e, t) => Math.min(...t.map((t => t.evaluate(e)))) ],
4077
- max: [ Ht, hr(Ht), (e, t) => Math.max(...t.map((t => t.evaluate(e)))) ],
4078
- abs: [ Ht, [ Ht ], (e, [t]) => Math.abs(t.evaluate(e)) ],
4079
- round: [ Ht, [ Ht ], (e, [t]) => {
4060
+ "/": [ Dt, [ Dt, Dt ], (e, [t, n]) => t.evaluate(e) / n.evaluate(e) ],
4061
+ "%": [ Dt, [ Dt, Dt ], (e, [t, n]) => t.evaluate(e) % n.evaluate(e) ],
4062
+ ln2: [ Dt, [], () => Math.LN2 ],
4063
+ pi: [ Dt, [], () => Math.PI ],
4064
+ e: [ Dt, [], () => Math.E ],
4065
+ "^": [ Dt, [ Dt, Dt ], (e, [t, n]) => Math.pow(t.evaluate(e), n.evaluate(e)) ],
4066
+ sqrt: [ Dt, [ Dt ], (e, [t]) => Math.sqrt(t.evaluate(e)) ],
4067
+ log10: [ Dt, [ Dt ], (e, [t]) => Math.log(t.evaluate(e)) / Math.LN10 ],
4068
+ ln: [ Dt, [ Dt ], (e, [t]) => Math.log(t.evaluate(e)) ],
4069
+ log2: [ Dt, [ Dt ], (e, [t]) => Math.log(t.evaluate(e)) / Math.LN2 ],
4070
+ sin: [ Dt, [ Dt ], (e, [t]) => Math.sin(t.evaluate(e)) ],
4071
+ cos: [ Dt, [ Dt ], (e, [t]) => Math.cos(t.evaluate(e)) ],
4072
+ tan: [ Dt, [ Dt ], (e, [t]) => Math.tan(t.evaluate(e)) ],
4073
+ asin: [ Dt, [ Dt ], (e, [t]) => Math.asin(t.evaluate(e)) ],
4074
+ acos: [ Dt, [ Dt ], (e, [t]) => Math.acos(t.evaluate(e)) ],
4075
+ atan: [ Dt, [ Dt ], (e, [t]) => Math.atan(t.evaluate(e)) ],
4076
+ min: [ Dt, hr(Dt), (e, t) => Math.min(...t.map((t => t.evaluate(e)))) ],
4077
+ max: [ Dt, hr(Dt), (e, t) => Math.max(...t.map((t => t.evaluate(e)))) ],
4078
+ abs: [ Dt, [ Dt ], (e, [t]) => Math.abs(t.evaluate(e)) ],
4079
+ round: [ Dt, [ Dt ], (e, [t]) => {
4080
4080
  const n = t.evaluate(e);
4081
4081
  return n < 0 ? -Math.round(-n) : Math.round(n);
4082
4082
  } ],
4083
- floor: [ Ht, [ Ht ], (e, [t]) => Math.floor(t.evaluate(e)) ],
4084
- ceil: [ Ht, [ Ht ], (e, [t]) => Math.ceil(t.evaluate(e)) ],
4083
+ floor: [ Dt, [ Dt ], (e, [t]) => Math.floor(t.evaluate(e)) ],
4084
+ ceil: [ Dt, [ Dt ], (e, [t]) => Math.ceil(t.evaluate(e)) ],
4085
4085
  "filter-==": [ Nt, [ Lt, Ut ], (e, [t, n]) => e.properties()[t.value] === n.value ],
4086
4086
  "filter-id-==": [ Nt, [ Ut ], (e, [t]) => e.id() === t.value ],
4087
4087
  "filter-type-==": [ Nt, [ Lt ], (e, [t]) => e.geometryType() === t.value ],
@@ -4320,7 +4320,7 @@ function W(e) {
4320
4320
  const t = {
4321
4321
  color: zt,
4322
4322
  string: Lt,
4323
- number: Ht,
4323
+ number: Dt,
4324
4324
  enum: Lt,
4325
4325
  boolean: Nt,
4326
4326
  formatted: Bt,
@@ -4392,7 +4392,7 @@ function W(e) {
4392
4392
  }
4393
4393
  function Or(e) {
4394
4394
  let t = null;
4395
- if (e instanceof Di) t = Or(e.result); else if (e instanceof Fi) {
4395
+ if (e instanceof Hi) t = Or(e.result); else if (e instanceof Fi) {
4396
4396
  for (const n of e.args) if (t = Or(n), t) break;
4397
4397
  } else (e instanceof si || e instanceof ki) && e.input instanceof Cn && "zoom" === e.input.name && (t = e);
4398
4398
  return t instanceof Rt || e.eachChild((e => {
@@ -4421,7 +4421,7 @@ function W(e) {
4421
4421
  let i = !0;
4422
4422
  try {
4423
4423
  i = function(e) {
4424
- if (!Dr(e)) return e;
4424
+ if (!Hr(e)) return e;
4425
4425
  let t = kr(e);
4426
4426
  return Er(t), t = Fr(t), t;
4427
4427
  }(n);
@@ -4448,7 +4448,7 @@ function W(e) {
4448
4448
  function Fr(e) {
4449
4449
  if (!Array.isArray(e)) return e;
4450
4450
  const t = function(e) {
4451
- if (Hr.has(e[0])) for (let t = 1; t < e.length; t++) if (Dr(e[t])) return !0;
4451
+ if (Dr.has(e[0])) for (let t = 1; t < e.length; t++) if (Hr(e[t])) return !0;
4452
4452
  return e;
4453
4453
  }(e);
4454
4454
  return !0 === t ? t : t.map((e => Fr(e)));
@@ -4457,28 +4457,28 @@ function W(e) {
4457
4457
  let t = !1;
4458
4458
  const n = [];
4459
4459
  if ("case" === e[0]) {
4460
- for (let i = 1; i < e.length - 1; i += 2) t = t || Dr(e[i]), n.push(e[i + 1]);
4460
+ for (let i = 1; i < e.length - 1; i += 2) t = t || Hr(e[i]), n.push(e[i + 1]);
4461
4461
  n.push(e[e.length - 1]);
4462
4462
  } else if ("match" === e[0]) {
4463
- t = t || Dr(e[1]);
4463
+ t = t || Hr(e[1]);
4464
4464
  for (let t = 2; t < e.length - 1; t += 2) n.push(e[t + 1]);
4465
4465
  n.push(e[e.length - 1]);
4466
4466
  } else if ("step" === e[0]) {
4467
- t = t || Dr(e[1]);
4467
+ t = t || Hr(e[1]);
4468
4468
  for (let t = 1; t < e.length - 1; t += 2) n.push(e[t + 1]);
4469
4469
  }
4470
4470
  t && (e.length = 0, e.push("any", ...n));
4471
4471
  for (let t = 1; t < e.length; t++) Er(e[t]);
4472
4472
  }
4473
- function Dr(e) {
4473
+ function Hr(e) {
4474
4474
  if (!Array.isArray(e)) return !1;
4475
4475
  if (function(e) {
4476
4476
  return "pitch" === e || "distance-from-center" === e;
4477
4477
  }(e[0])) return !0;
4478
- for (let t = 1; t < e.length; t++) if (Dr(e[t])) return !0;
4478
+ for (let t = 1; t < e.length; t++) if (Hr(e[t])) return !0;
4479
4479
  return !1;
4480
4480
  }
4481
- const Hr = new Set([ "in", "==", "!=", ">", ">=", "<", "<=", "to-boolean" ]);
4481
+ const Dr = new Set([ "in", "==", "!=", ">", ">=", "<", "<=", "to-boolean" ]);
4482
4482
  function Lr(e) {
4483
4483
  if (!Array.isArray(e)) return !1;
4484
4484
  if ("within" === e[0]) return !0;
@@ -5036,7 +5036,7 @@ function W(e) {
5036
5036
  }
5037
5037
  if (this.countOutOfAngle > 0 && !po && (po = !0, console.warn("text anchor along line is ignored as anchor's line angle is bigger than textMaxAngle.")),
5038
5038
  this.hasElements() && !i.getLength()) return null;
5039
- s = oo.createTypedArray(s, Float32Array), this.options.positionType ? r[0].type = this.options.positionType : r[0].type = D(this.maxPos);
5039
+ s = oo.createTypedArray(s, Float32Array), this.options.positionType ? r[0].type = this.options.positionType : r[0].type = H(this.maxPos);
5040
5040
  const d = this.options.center;
5041
5041
  if (d && (d[0] || d[1])) {
5042
5042
  const e = n.aPosition, t = e.getLength();
@@ -5070,7 +5070,7 @@ function W(e) {
5070
5070
  };
5071
5071
  if (this._packMarkerPlacement && (y.markerPlacement = this._packMarkerPlacement),
5072
5072
  this._packTextPlacement && (y.textPlacement = this._packTextPlacement), l.getLength()) {
5073
- const e = c ? D(h) : H(h);
5073
+ const e = c ? H(h) : D(h);
5074
5074
  y.featureIds = oo.createTypedArray(l, e), g.push(y.featureIds.buffer);
5075
5075
  } else y.featureIds = [];
5076
5076
  return y.pickingIdIndiceMap = I(s, y.indices), y;
@@ -5320,12 +5320,12 @@ function W(e) {
5320
5320
  return !!(Oo["Latin-1 Supplement"](e) && (167 === e || 169 === e || 174 === e || 177 === e || 188 === e || 189 === e || 190 === e || 215 === e || 247 === e) || Oo["General Punctuation"](e) && (8214 === e || 8224 === e || 8225 === e || 8240 === e || 8241 === e || 8251 === e || 8252 === e || 8258 === e || 8263 === e || 8264 === e || 8265 === e || 8273 === e) || Oo["Letterlike Symbols"](e) || Oo["Number Forms"](e) || Oo["Miscellaneous Technical"](e) && (e >= 8960 && e <= 8967 || e >= 8972 && e <= 8991 || e >= 8996 && e <= 9e3 || 9003 === e || e >= 9085 && e <= 9114 || e >= 9150 && e <= 9165 || 9167 === e || e >= 9169 && e <= 9179 || e >= 9186 && e <= 9215) || Oo["Control Pictures"](e) && 9251 !== e || Oo["Optical Character Recognition"](e) || Oo["Enclosed Alphanumerics"](e) || Oo["Geometric Shapes"](e) || Oo["Miscellaneous Symbols"](e) && !(e >= 9754 && e <= 9759) || Oo["Miscellaneous Symbols and Arrows"](e) && (e >= 11026 && e <= 11055 || e >= 11088 && e <= 11097 || e >= 11192 && e <= 11243) || Oo["CJK Symbols and Punctuation"](e) || Oo.Katakana(e) || Oo["Private Use Area"](e) || Oo["CJK Compatibility Forms"](e) || Oo["Small Form Variants"](e) || Oo["Halfwidth and Fullwidth Forms"](e) || 8734 === e || 8756 === e || 8757 === e || e >= 9984 && e <= 10087 || e >= 10102 && e <= 10131 || 65532 === e || 65533 === e);
5321
5321
  }(e));
5322
5322
  }
5323
- function Do(e) {
5323
+ function Ho(e) {
5324
5324
  return e >= 1424 && e <= 2303 || Oo["Arabic Presentation Forms-A"](e) || Oo["Arabic Presentation Forms-B"](e);
5325
5325
  }
5326
- const Ho = [ [ 9, 9 ], [ 32, 32 ], [ 5760, 5760 ], [ 8192, 8198 ], [ 8200, 8202 ], [ 8287, 12288 ], [ 6158, 6158 ], [ 8203, 8205 ] ];
5326
+ const Do = [ [ 9, 9 ], [ 32, 32 ], [ 5760, 5760 ], [ 8192, 8198 ], [ 8200, 8202 ], [ 8287, 12288 ], [ 6158, 6158 ], [ 8203, 8205 ] ];
5327
5327
  function Lo(e) {
5328
- for (const t of Ho) if (e >= t[0] && e <= t[1]) return !0;
5328
+ for (const t of Do) if (e >= t[0] && e <= t[1]) return !0;
5329
5329
  return !1;
5330
5330
  }
5331
5331
  const No = {
@@ -5587,14 +5587,14 @@ function W(e) {
5587
5587
  }
5588
5588
  function qo(e) {
5589
5589
  if (!function(e) {
5590
- for (const t of e) if (Do(t.charCodeAt(0))) return !0;
5590
+ for (const t of e) if (Ho(t.charCodeAt(0))) return !0;
5591
5591
  return !1;
5592
5592
  }(e)) return e;
5593
5593
  const t = [], n = [], i = [];
5594
5594
  let r = 0, o = 0, s = 1, a = 1;
5595
5595
  for (const l of e) {
5596
5596
  const e = l.codePointAt(0);
5597
- Lo(e) ? (i.push(l), r++) : (s = Do(e) ? -1 : 1, a !== s ? (o = r, n.length && (a > 0 && n.reverse(),
5597
+ Lo(e) ? (i.push(l), r++) : (s = Ho(e) ? -1 : 1, a !== s ? (o = r, n.length && (a > 0 && n.reverse(),
5598
5598
  t.push(...n)), i.length && (t.splice(o, 0, ...i), i.length = 0), a = s, n.length = 0) : i.length && (n.push(...i),
5599
5599
  i.length = 0), n.push(l), r++);
5600
5600
  }
@@ -6359,7 +6359,7 @@ function W(e) {
6359
6359
  for (let n = 0; n < e.length; n++) if (Fo(e.charAt(n).charCodeAt(0))) t = 0; else if (t++,
6360
6360
  t >= 1) return !1;
6361
6361
  return !0;
6362
- }(e.getIconAndGlyph().glyph.text) ? 1 : 0, {textFillFn: x, textSizeFn: _, textHaloFillFn: v, textHaloRadiusFn: A, textHaloOpacityFn: T, textDxFn: S, textDyFn: I, textPitchAlignmentFn: C, textRotationAlignmentFn: O, textRotationFn: k, textAllowOverlapFn: R, textIgnorePlacementFn: F, textOpacityFn: E, markerWidthFn: D, markerHeightFn: H, markerDxFn: L, markerDyFn: N, markerPitchAlignmentFn: z, markerRotationAlignmentFn: V, markerRotationFn: U, markerAllowOverlapFn: G, markerIgnorePlacementFn: B, markerOpacityFn: W} = this._fnTypes;
6362
+ }(e.getIconAndGlyph().glyph.text) ? 1 : 0, {textFillFn: x, textSizeFn: _, textHaloFillFn: v, textHaloRadiusFn: A, textHaloOpacityFn: T, textDxFn: S, textDyFn: I, textPitchAlignmentFn: C, textRotationAlignmentFn: O, textRotationFn: k, textAllowOverlapFn: R, textIgnorePlacementFn: F, textOpacityFn: E, markerWidthFn: H, markerHeightFn: D, markerDxFn: L, markerDyFn: N, markerPitchAlignmentFn: z, markerRotationAlignmentFn: V, markerRotationFn: U, markerAllowOverlapFn: G, markerIgnorePlacementFn: B, markerOpacityFn: W} = this._fnTypes;
6363
6363
  let j, X, $, Y, Z, q = [ 0, 0, 0, 0 ], K = 14, J = [ 0, 0, 0, 0 ], Q = 0, ee = 0, te = 0, ne = 0, re = 0, oe = 0, se = 0, ae = 0, le = 0, he = 0, ce = 0, ue = 0, fe = 0, de = 0;
6364
6364
  if (g) {
6365
6365
  const t = e.getIconAndGlyph().glyph.font;
@@ -6426,7 +6426,7 @@ function W(e) {
6426
6426
  writingMode: void 0,
6427
6427
  glyphOffset: [ 0, 0 ]
6428
6428
  } ];
6429
- }(), D && (re = D(null, d)), w(re) && (re = Y[0].tex.w), H && (oe = H(null, d)),
6429
+ }(), H && (re = H(null, d)), w(re) && (re = Y[0].tex.w), D && (oe = D(null, d)),
6430
6430
  w(oe) && (oe = Y[0].tex.h), L && (se = L(null, d)), N && (ae = N(null, d)), z && (le = +("map" === z(null, d))),
6431
6431
  V && (ce = +("map" === V(null, d))), U && (fe = M(U(null, d), 0, 360) * Math.PI / 180)),
6432
6432
  ie(K) && (this.dynamicAttrs.aTextSize = 1), (ie(Q) || ie(ee)) && (this.dynamicAttrs.aTextHalo = 1),
@@ -6488,7 +6488,7 @@ function W(e) {
6488
6488
  }
6489
6489
  }
6490
6490
  _fillFnTypeData(e, t, n, i, r, o, s, a, l, h, c, u, f, d, p, g, m, y, x, _, v, A) {
6491
- const {textFillFn: T, textSizeFn: S, textHaloFillFn: b, textHaloRadiusFn: P, textDxFn: M, textDyFn: I, textPitchAlignmentFn: C, textRotationAlignmentFn: O, textRotationFn: k, textAllowOverlapFn: R, textIgnorePlacementFn: F, textOpacityFn: E, textHaloOpacityFn: D, markerWidthFn: H, markerHeightFn: L, markerDxFn: N, markerDyFn: z, markerPitchAlignmentFn: V, markerRotationAlignmentFn: U, markerRotationFn: G, markerAllowOverlapFn: B, markerIgnorePlacementFn: W, markerOpacityFn: j} = this._fnTypes;
6491
+ const {textFillFn: T, textSizeFn: S, textHaloFillFn: b, textHaloRadiusFn: P, textDxFn: M, textDyFn: I, textPitchAlignmentFn: C, textRotationAlignmentFn: O, textRotationFn: k, textAllowOverlapFn: R, textIgnorePlacementFn: F, textOpacityFn: E, textHaloOpacityFn: H, markerWidthFn: D, markerHeightFn: L, markerDxFn: N, markerDyFn: z, markerPitchAlignmentFn: V, markerRotationAlignmentFn: U, markerRotationFn: G, markerAllowOverlapFn: B, markerIgnorePlacementFn: W, markerOpacityFn: j} = this._fnTypes;
6492
6492
  if (T) {
6493
6493
  let n = e.aTextFill.currentIndex;
6494
6494
  e.aTextFill[n++] = t[0], e.aTextFill[n++] = t[1], e.aTextFill[n++] = t[2], e.aTextFill[n++] = t[3],
@@ -6503,7 +6503,7 @@ function W(e) {
6503
6503
  e.aTextHaloFill[t++] = i[0], e.aTextHaloFill[t++] = i[1], e.aTextHaloFill[t++] = i[2],
6504
6504
  e.aTextHaloFill[t++] = i[3], e.aTextHaloFill.currentIndex = t;
6505
6505
  }
6506
- if (P || D) {
6506
+ if (P || H) {
6507
6507
  let t = e.aTextHalo.currentIndex;
6508
6508
  e.aTextHalo[t++] = r || 0, e.aTextHalo.currentIndex = t, t = e.aTextHalo.currentIndex,
6509
6509
  e.aTextHalo[t++] = 255 * (w(o) ? 1 : o), e.aTextHalo.currentIndex = t;
@@ -6516,7 +6516,7 @@ function W(e) {
6516
6516
  let t = e.aTextDy.currentIndex;
6517
6517
  e.aTextDy[t++] = a, e.aTextDy.currentIndex = t;
6518
6518
  }
6519
- if (H) {
6519
+ if (D) {
6520
6520
  let t = e.aMarkerWidth.currentIndex;
6521
6521
  e.aMarkerWidth[t++] = l, e.aMarkerWidth.currentIndex = t;
6522
6522
  }
@@ -6722,7 +6722,7 @@ function W(e) {
6722
6722
  var e = new ws(2);
6723
6723
  ws != Float32Array && (e[0] = 0, e[1] = 0);
6724
6724
  }();
6725
- const Fs = 63, Es = Math.cos(Math.PI / 180 * 37.5), Ds = Math.pow(2, 16) / 1, Hs = new o, Ls = new o, Ns = new o;
6725
+ const Fs = 63, Es = Math.cos(Math.PI / 180 * 37.5), Hs = Math.pow(2, 16) / 1, Ds = new o, Ls = new o, Ns = new o;
6726
6726
  class zs extends mo {
6727
6727
  static mergeLineFeatures(e, t, n, i) {
6728
6728
  return Ts(e, t, n, i);
@@ -6978,15 +6978,15 @@ function W(e) {
6978
6978
  const s = t.x + t.y * n, a = t.y - t.x * n, l = -t.x + t.y * i, h = -t.y - t.x * i;
6979
6979
  let c = 0, u = 0;
6980
6980
  if (r.middleVertex) {
6981
- Hs.x = s, Hs.y = a;
6981
+ Ds.x = s, Ds.y = a;
6982
6982
  const e = r.currentNormal;
6983
- if (c = js(e, Hs, r.dir), 0 === n && 0 === i) u = -c; else {
6983
+ if (c = js(e, Ds, r.dir), 0 === n && 0 === i) u = -c; else {
6984
6984
  const t = Ls;
6985
6985
  t.x = e.x, t.y = e.y, t._mult(-1), Ns.x = l, Ns.y = h, u = js(t, Ns, r.dir);
6986
6986
  }
6987
6987
  }
6988
6988
  this.addHalfVertex(e, s, a, o, !1, n, r, c), this.addHalfVertex(e, l, h, o, !0, -i, r, u),
6989
- this.prevVertex && Xs(e, this.prevVertex) || (this.prevVertex = e), this.distance > Ds / 2 && 0 === this.totalDistance && (this.distance = 0,
6989
+ this.prevVertex && Xs(e, this.prevVertex) || (this.prevVertex = e), this.distance > Hs / 2 && 0 === this.totalDistance && (this.distance = 0,
6990
6990
  this.updateScaledDistance(), this.addCurrentVertex(e, t, n, i, r, o));
6991
6991
  }
6992
6992
  addHalfVertex({x: e, y: t, z: n}, i, r, o, s, a, l, h) {
@@ -7055,7 +7055,7 @@ function W(e) {
7055
7055
  this.updateScaledDistance();
7056
7056
  }
7057
7057
  updateScaledDistance() {
7058
- this.scaledDistance = this.totalDistance > 0 ? (this.clipStart + (this.clipEnd - this.clipStart) * this.distance / this.totalDistance) * (Ds - 1) : this.distance;
7058
+ this.scaledDistance = this.totalDistance > 0 ? (this.clipStart + (this.clipEnd - this.clipStart) * this.distance / this.totalDistance) * (Hs - 1) : this.distance;
7059
7059
  }
7060
7060
  }
7061
7061
  function Vs(e, t, n) {
@@ -7377,12 +7377,12 @@ function W(e) {
7377
7377
  };
7378
7378
  }
7379
7379
  const Fa = [], Ea = [];
7380
- function Da(e, t) {
7380
+ function Ha(e, t) {
7381
7381
  var n, i, r, s, a, l, h;
7382
7382
  for (i = 1; i <= 8; i *= 2) {
7383
7383
  for (n = [], s = !(La(r = e[e.length - 1], t) & i), a = 0; a < e.length; a++) {
7384
7384
  if ((h = !(La(l = e[a], t) & i)) !== s) {
7385
- const e = Ha(r, l, i, t);
7385
+ const e = Da(r, l, i, t);
7386
7386
  void 0 !== l.x ? n.push(new o(e[0], e[1])) : n.push(e);
7387
7387
  }
7388
7388
  h && n.push(l), r = l, s = h;
@@ -7391,7 +7391,7 @@ function W(e) {
7391
7391
  }
7392
7392
  return n;
7393
7393
  }
7394
- function Ha(e, t, n, i) {
7394
+ function Da(e, t, n, i) {
7395
7395
  return Fa[0] = void 0 === e.x ? e[0] : e.x, Fa[1] = void 0 === e.y ? e[1] : e.y,
7396
7396
  e = Fa, Ea[0] = void 0 === t.x ? t[0] : t.x, Ea[1] = void 0 === t.y ? t[1] : t.y,
7397
7397
  t = Ea, 8 & n ? [ e[0] + (t[0] - e[0]) * (i[3] - e[1]) / (t[1] - e[1]), i[3] ] : 4 & n ? [ e[0] + (t[0] - e[0]) * (i[1] - e[1]) / (t[1] - e[1]), i[1] ] : 2 & n ? [ i[2], e[1] + (t[1] - e[1]) * (i[2] - e[0]) / (t[0] - e[0]) ] : 1 & n ? [ i[0], e[1] + (t[1] - e[1]) * (i[0] - e[0]) / (t[0] - e[0]) ] : null;
@@ -7632,14 +7632,14 @@ function W(e) {
7632
7632
  var sl = Object.freeze({
7633
7633
  __proto__: null,
7634
7634
  calculateSignedArea: A,
7635
- clipPolygon: Da,
7635
+ clipPolygon: Ha,
7636
7636
  convertGeometry: N,
7637
7637
  convertRTLText: qo,
7638
7638
  generatePickingIndiceIndex: I,
7639
7639
  getFeaAltitudeAndHeight: b,
7640
7640
  getIndexArrayType: E,
7641
- getPosArrayType: D,
7642
- getUnsignedArrayType: H,
7641
+ getPosArrayType: H,
7642
+ getUnsignedArrayType: D,
7643
7643
  packPosition: pt,
7644
7644
  unpackPosition: function(e, t, n, i) {
7645
7645
  const r = (Math.sign(t) || 1) * (Math.abs(t) % gt), o = (Math.sign(n) || 1) * (Math.abs(n) % gt), s = Math.floor(Math.abs(t) / gt), a = Math.floor(Math.abs(n) / gt);
@@ -8200,7 +8200,7 @@ function W(e) {
8200
8200
  A.setLength(0), T.setLength(0);
8201
8201
  for (let e = 0; e < t.length; e++) {
8202
8202
  let s = t[e];
8203
- if (this.options.EXTENT !== 1 / 0 && 0 === this.maxPosZ && 0 === this.minPosZ && (s = Da(s, v)),
8203
+ if (this.options.EXTENT !== 1 / 0 && 0 === this.maxPosZ && 0 === this.minPosZ && (s = Ha(s, v)),
8204
8204
  0 === s.length) continue;
8205
8205
  0 !== e && T.push(A.length / 3), this.ensureDataCapacity(s.length);
8206
8206
  const a = this.data;
@@ -9047,21 +9047,21 @@ function Re(e, t, n) {
9047
9047
  (t || n) && (e.properties = e.properties || {}, K(e.properties, t || {}, n || {}));
9048
9048
  }
9049
9049
 
9050
- const Fe = "__original_properties", Ee = "__external_properties", De = {
9050
+ const Fe = "__original_properties", Ee = "__external_properties", He = {
9051
9051
  get: function(e, t) {
9052
9052
  return t in e ? e[t] : e[Fe][t] || e[Ee] && e[Ee][t];
9053
9053
  },
9054
9054
  has: function(e, t) {
9055
9055
  return t in e || t in e[Fe] || e[Ee] && t in e[Ee];
9056
9056
  }
9057
- }, He = {};
9057
+ }, De = {};
9058
9058
 
9059
9059
  function Le(e, t) {
9060
9060
  const n = e.properties;
9061
9061
  if (n && n[Fe]) return e;
9062
9062
  t && (e = K({}, e)), e.customProps = e.customProps || {};
9063
9063
  const i = e.customProps;
9064
- return i.$layer = e.layer, i.$type = e.type, i[Fe] = n || He, e.properties = new Proxy(i, De),
9064
+ return i.$layer = e.layer, i.$type = e.type, i[Fe] = n || De, e.properties = new Proxy(i, He),
9065
9065
  e;
9066
9066
  }
9067
9067
 
@@ -9430,10 +9430,15 @@ class ct extends(m(tt(nt))){
9430
9430
  const {url: n} = t, i = this._requestingMVT[n];
9431
9431
  if (i) i.keys[t.id] || (i.tiles.push(t), i.keys[t.id] = 1); else {
9432
9432
  const i = this.getMap(), r = ot.set(t.extent2d.xmin, t.extent2d.ymax), o = i.pointAtResToCoord(new e.Point(r), t.res), s = [ et(i, 1, o, t.res) / 100, et(i, 1, o, t.res, 1) / 100 ], a = this.getCentimeterToPoint(t.z), l = this.getTileGLScale(t.z);
9433
- this._requestingMVT[n] = {
9433
+ if (this._requestingMVT[n] = {
9434
9434
  keys: {},
9435
9435
  tiles: [ t ]
9436
- }, this._requestingMVT[n].keys[t.id] = 1;
9436
+ }, this._requestingMVT[n].keys[t.id] = 1, this.layer._dataExtent && this.layer._getTileBBox) {
9437
+ const i = this.layer._getTileBBox(t), r = this.layer._dataExtent.toBBOX(), o = e.BBOXUtil.bboxIntersect;
9438
+ if (i && r && !o(i, r)) return this._onReceiveMVTData(n, null, null), {
9439
+ _empty: !0
9440
+ };
9441
+ }
9437
9442
  const h = this.layer.options.fetchOptions, c = window && window.location.href, u = this.layer.options.altitudePropertyName, f = this.layer.options.disableAltitudeWarning, d = this.layer.options.loadTileErrorLog, p = this.layer.options.loadTileErrorLogIgnoreCodes, g = this.layer.options.loadTileCachMaxSize, m = this.layer.options.loadTileCacheLog, y = {
9438
9443
  tileInfo: {
9439
9444
  res: t.res,
@@ -10362,22 +10367,23 @@ function gt(e) {
10362
10367
  };
10363
10368
  }
10364
10369
 
10365
- function mt(e, t) {
10366
- if (!t.cache) return [];
10367
- for (const n in t.cache) {
10368
- const i = t.cache[n];
10369
- if (i.geometry) for (let n = 0; n < i.geometry.length; n++) {
10370
- const r = i.geometry[n] && i.geometry[n].geometry;
10371
- if (r && r.properties && r.properties.features) {
10372
- const n = r.properties.features.empty;
10373
- delete r.properties.features.empty;
10374
- const i = Object.values(r.properties.features);
10375
- return void 0 !== n && (r.properties.features.empty = n), le(e.options.features, t, i),
10376
- i;
10370
+ function mt(t, n) {
10371
+ if (!n.cache) return [];
10372
+ const i = [];
10373
+ for (const r in n.cache) {
10374
+ const o = n.cache[r];
10375
+ if (o.geometry) for (let r = 0; r < o.geometry.length; r++) {
10376
+ const s = o.geometry[r] && o.geometry[r].geometry;
10377
+ if (s && s.properties && s.properties.features) {
10378
+ const r = s.properties.features.empty;
10379
+ delete s.properties.features.empty;
10380
+ const o = Object.values(s.properties.features);
10381
+ void 0 !== r && (s.properties.features.empty = r), le(t.options.features, n, o),
10382
+ e.Util.pushIn(i, o);
10377
10383
  }
10378
10384
  }
10379
10385
  }
10380
- return [];
10386
+ return i;
10381
10387
  }
10382
10388
 
10383
10389
  function yt(t) {
@@ -11087,7 +11093,8 @@ St.prototype._getTileZoom = function(t) {
11087
11093
  loadTileErrorLog: !0,
11088
11094
  loadTileErrorLogIgnoreCodes: [ 404, 204 ],
11089
11095
  loadTileCachMaxSize: 0,
11090
- loadTileCacheLog: !0
11096
+ loadTileCacheLog: !0,
11097
+ renderBeforeTerrain: !1
11091
11098
  }), St.registerRenderer("gl", ct), St.registerRenderer("gpu", ct), St.registerRenderer("canvas", null);
11092
11099
 
11093
11100
  const Ot = new e.Size(1, 1);
@@ -11232,7 +11239,7 @@ const Rt = {
11232
11239
 
11233
11240
  let Et = 1;
11234
11241
 
11235
- function Dt(e, t) {
11242
+ function Ht(e, t) {
11236
11243
  const n = F.extend(e, {
11237
11244
  init: function() {
11238
11245
  this._meshCache = {};
@@ -11521,7 +11528,7 @@ function Dt(e, t) {
11521
11528
  return n;
11522
11529
  }
11523
11530
 
11524
- function Ht(e) {
11531
+ function Dt(e) {
11525
11532
  return !e || (void 0 !== e.empty || (e.empty = function(e) {
11526
11533
  for (const t in e) return !1;
11527
11534
  return !0;
@@ -11531,7 +11538,7 @@ function Ht(e) {
11531
11538
  const {StyleUtil: Lt} = j(), Nt = "_fn_type_", zt = "__current_fn_types";
11532
11539
 
11533
11540
  function Vt(e, t, n, i) {
11534
- if (!Ht(e.properties.features)) for (let r = 0; r < n.length; r++) {
11541
+ if (!Dt(e.properties.features)) for (let r = 0; r < n.length; r++) {
11535
11542
  const {symbolName: o} = n[r];
11536
11543
  (e[zt] = e[zt] || {})[o] = t[o], Ut(e, t, n[r], i);
11537
11544
  }
@@ -11594,7 +11601,7 @@ function Wt(e, t, n, i, r, o) {
11594
11601
  if (!r) return;
11595
11602
  const s = r.geometry;
11596
11603
  if (!s) return;
11597
- if (Ht(s.properties.features)) return;
11604
+ if (Dt(s.properties.features)) return;
11598
11605
  for (let a = 0; a < i.length; a++) {
11599
11606
  const l = i[a], h = l.attrName;
11600
11607
  if (!(jt(s, n, l) || t._isFeatureStateDirty && t._isFeatureStateDirty(r.geometry._featureTimestamp))) {
@@ -12593,7 +12600,7 @@ class On extends Mn {
12593
12600
  return o.properties = {
12594
12601
  features: t
12595
12602
  }, e.iconAtlas && (o.properties.iconAtlas = e.iconAtlas.image, o.properties.iconPositions = e.iconAtlas.positions),
12596
- e.glyphAtlas && (o.properties.glyphAtlas = e.glyphAtlas.image), Ht(t) || (o.properties.aFeaIds = e.featureIds,
12603
+ e.glyphAtlas && (o.properties.glyphAtlas = e.glyphAtlas.image), Dt(t) || (o.properties.aFeaIds = e.featureIds,
12597
12604
  this._prepareFeatureIds(o, e)), e.markerPlacement && (o.properties.markerPlacement = e.markerPlacement),
12598
12605
  e.textPlacement && (o.properties.textPlacement = e.textPlacement), Ne(o.properties, e.properties),
12599
12606
  {
@@ -12656,7 +12663,7 @@ function Rn(e, t, n, i) {
12656
12663
 
12657
12664
  const Fn = [ 0, 0 ], En = [];
12658
12665
 
12659
- function Dn(e) {
12666
+ function Hn(e) {
12660
12667
  if (!e.properties.iconPositions) return Fn;
12661
12668
  let t, n = 0;
12662
12669
  for (const i in e.properties.iconPositions) if (t = i, n++, n > 1) return Fn;
@@ -12665,7 +12672,7 @@ function Dn(e) {
12665
12672
  return En[0] = r, En[1] = o, En;
12666
12673
  }
12667
12674
 
12668
- function Hn(e) {
12675
+ function Dn(e) {
12669
12676
  const t = new Set;
12670
12677
  for (const n of e) if (n.includes("&&") || n.includes("||")) {
12671
12678
  const e = Ln(n);
@@ -12693,15 +12700,15 @@ function Nn(e, t, n, i, r) {
12693
12700
  return a;
12694
12701
  }
12695
12702
 
12696
- const zn = [ "HAS_ALTITUDE", "HAS_OFFSET_Z", "HAS_TEXT_SIZE", "HAS_MARKER_WIDTH", "HAS_MARKER_HEIGHT", "HAS_TEXT_FILL", "HAS_MARKER_DX || HAS_MARKER_DY || HAS_TEXT_DX || HAS_TEXT_DY", "HAS_OPACITY", "HAS_MARKER_PITCH_ALIGN || HAS_TEXT_PITCH_ALIGN", "HAS_MARKER_ROTATION_ALIGN || HAS_TEXT_ROTATION_ALIGN", "HAS_MARKER_ROTATION || HAS_TEXT_ROTATION", "HAS_TEXT_HALO_FILL", "HAS_HALO_ATTR || HAS_TEXT_HALO_RADIUS || HAS_TEXT_HALO_OPACITY" ], Vn = Hn(zn);
12703
+ const zn = [ "HAS_ALTITUDE", "HAS_OFFSET_Z", "HAS_TEXT_SIZE", "HAS_MARKER_WIDTH", "HAS_MARKER_HEIGHT", "HAS_TEXT_FILL", "HAS_MARKER_DX || HAS_MARKER_DY || HAS_TEXT_DX || HAS_TEXT_DY", "HAS_OPACITY", "HAS_MARKER_PITCH_ALIGN || HAS_TEXT_PITCH_ALIGN", "HAS_MARKER_ROTATION_ALIGN || HAS_TEXT_ROTATION_ALIGN", "HAS_MARKER_ROTATION || HAS_TEXT_ROTATION", "HAS_TEXT_HALO_FILL", "HAS_HALO_ATTR || HAS_TEXT_HALO_RADIUS || HAS_TEXT_HALO_OPACITY" ], Vn = Dn(zn);
12697
12704
 
12698
12705
  function Un(e, t) {
12699
12706
  return Nn(e, t, zn, Vn, 3);
12700
12707
  }
12701
12708
 
12702
- const Gn = [ "HAS_ALTITUDE", "HAS_COLOR", "HAS_OPACITY", "HAS_LINE_WIDTH", "HAS_PATTERN || HAS_DASHARRAY || HAS_GRADIENT || HAS_TRAIL", "HAS_PATTERN", "HAS_GRADIENT", "HAS_DASHARRAY && HAS_DASHARRAY_ATTR", "HAS_DASHARRAY && HAS_DASHARRAY_COLOR", "HAS_LINE_DX || HAS_LINE_DY", "HAS_STROKE_WIDTH", "HAS_STROKE_COLOR" ], Bn = Hn(Gn);
12709
+ const Gn = [ "HAS_ALTITUDE", "HAS_COLOR", "HAS_OPACITY", "HAS_LINE_WIDTH", "HAS_PATTERN || HAS_DASHARRAY || HAS_GRADIENT || HAS_TRAIL", "HAS_PATTERN", "HAS_GRADIENT", "HAS_DASHARRAY && HAS_DASHARRAY_ATTR", "HAS_DASHARRAY && HAS_DASHARRAY_COLOR", "HAS_LINE_DX || HAS_LINE_DY", "HAS_STROKE_WIDTH", "HAS_STROKE_COLOR" ], Bn = Dn(Gn);
12703
12710
 
12704
- const Wn = [ "HAS_ALTITUDE", "HAS_COLOR", "HAS_OPACITY", "HAS_PATTERN", "HAS_PATTERN && HAS_PATTERN_WIDTH", "HAS_PATTERN && HAS_PATTERN_ORIGIN", "HAS_PATTERN && HAS_PATTERN_OFFSET", "HAS_PATTERN && HAS_UV_SCALE", "HAS_PATTERN && HAS_UV_OFFSET", "HAS_PATTERN && HAS_TEX_COORD" ], jn = Hn(Wn);
12711
+ const Wn = [ "HAS_ALTITUDE", "HAS_COLOR", "HAS_OPACITY", "HAS_PATTERN", "HAS_PATTERN && HAS_PATTERN_WIDTH", "HAS_PATTERN && HAS_PATTERN_ORIGIN", "HAS_PATTERN && HAS_PATTERN_OFFSET", "HAS_PATTERN && HAS_UV_SCALE", "HAS_PATTERN && HAS_UV_OFFSET", "HAS_PATTERN && HAS_TEX_COORD" ], jn = Dn(Wn);
12705
12712
 
12706
12713
  const {INVALID_TEX_COORD: Xn} = j(), $n = g.identity([]), Yn = {
12707
12714
  polygonFill: [ 1, 1, 1, 1 ],
@@ -12808,7 +12815,7 @@ class ei extends On {
12808
12815
  _preparePatternWidth(e, t, n, i, r) {
12809
12816
  if (!(t = t && t.geometry)) return;
12810
12817
  const o = t.properties.features;
12811
- if (Ht(o)) return;
12818
+ if (Dt(o)) return;
12812
12819
  const s = e.polygonPatternFileWidth, a = e.polygonPatternFileHeight, l = I(e.polygonPatternFileOrigin);
12813
12820
  let h, c;
12814
12821
  M(s) && (h = I(s)), M(a) && (c = I(a));
@@ -12837,7 +12844,7 @@ class ei extends On {
12837
12844
  _preparePatternOffset(e, t, n, i) {
12838
12845
  if (!(t = t && t.geometry)) return;
12839
12846
  const r = t.properties.features;
12840
- if (Ht(r)) return;
12847
+ if (Dt(r)) return;
12841
12848
  const o = this.getMap();
12842
12849
  let s = M(e.uvOffsetInMeter) && C(e.uvOffsetInMeter);
12843
12850
  const a = I(e.uvOffset), l = I(e.polygonPatternFileOrigin), {aPickingId: h, aPatternOrigin: c} = t.data, u = h.length, f = new Float32Array(2 * u);
@@ -12864,7 +12871,7 @@ class ei extends On {
12864
12871
  _preparePatternOrigin(e, t, n, i) {
12865
12872
  if (!(t = t && t.geometry)) return;
12866
12873
  const r = t.properties.features;
12867
- if (Ht(r)) return;
12874
+ if (Dt(r)) return;
12868
12875
  const o = this.getMap(), s = I(e.polygonPatternFileOrigin), a = t.data.aPickingId, l = a.length, h = new Float32Array(2 * l);
12869
12876
  let c, u, f;
12870
12877
  for (let e = 0, t = a.length; e < t; e++) {
@@ -14480,14 +14487,14 @@ function Ri(e, t, n) {
14480
14487
 
14481
14488
  var Fi = "#include <gl2_vert>\n#define SHADER_NAME MARKER\n#define RAD 0.0174532925\n#ifdef HAS_ALTITUDE\nattribute vec2 aPosition;\nattribute float aAltitude;\n#else\nattribute vec3 aPosition;\n#endif\nattribute vec4 aShape;\n#ifdef ENABLE_COLLISION\nattribute float aOpacity;\n#endif\n#ifdef HAS_OPACITY\nattribute vec2 aColorOpacity;\n#endif\n#ifdef HAS_TEXT_SIZE\nattribute float aTextSize;\n#else\nuniform float textSize;\n#endif\n#if defined(HAS_TEXT_DX) || defined(HAS_TEXT_DY) || defined(HAS_MARKER_DX) || defined(HAS_MARKER_DY)\nattribute vec4 aDxDy;\n#endif\n#ifndef HAS_MARKER_DX\nuniform float markerDx;\n#endif\n#ifndef HAS_MARKER_DY\nuniform float markerDy;\n#endif\n#ifndef HAS_TEXT_DX\nuniform float textDx;\n#endif\n#ifndef HAS_TEXT_DY\nuniform float textDy;\n#endif\n#ifdef HAS_MARKER_WIDTH\nattribute float aMarkerWidth;\n#else\nuniform float markerWidth;\n#endif\n#ifdef HAS_MARKER_HEIGHT\nattribute float aMarkerHeight;\n#else\nuniform float markerHeight;\n#endif\n#if defined(HAS_MARKER_PITCH_ALIGN) || defined(HAS_TEXT_PITCH_ALIGN)\nattribute vec2 aPitchAlign;\n#endif\n#ifndef HAS_MARKER_PITCH_ALIGN\nuniform float markerPitchWithMap;\n#endif\n#ifndef HAS_TEXT_PITCH_ALIGN\nuniform float textPitchWithMap;\n#endif\n#if defined(HAS_MARKER_ROTATION_ALIGN) || defined(HAS_TEXT_ROTATION_ALIGN)\nattribute vec2 aRotationAlign;\n#endif\n#ifndef HAS_MARKER_ROTATION_ALIGN\nuniform float markerRotateWithMap;\n#endif\n#ifndef HAS_TEXT_ROTATION_ALIGN\nuniform float textRotateWithMap;\n#endif\nuniform float flipY;\n#if defined(HAS_MARKER_ROTATION) || defined(HAS_TEXT_ROTATION)\nattribute vec2 aRotation;\n#endif\n#ifndef HAS_MARKER_ROTATION\nuniform float markerRotation;\n#endif\n#ifndef HAS_TEXT_ROTATION\nuniform float textRotation;\n#endif\n#ifdef HAS_PAD_OFFSET\nattribute vec2 aPadOffset;\n#endif\nuniform float cameraToCenterDistance;\nuniform mat4 positionMatrix;\nuniform mat4 projViewModelMatrix;\nuniform float textPerspectiveRatio;\nuniform float markerPerspectiveRatio;\nuniform float glyphSize;\nuniform vec2 iconSize;\nuniform vec2 canvasSize;\nuniform vec2 iconTexSize;\nuniform vec2 glyphTexSize;\nuniform float mapPitch;\nuniform float mapRotation;\nuniform float zoomScale;\nuniform float tileRatio;\nuniform float layerScale;\nuniform float isRenderingTerrain;\n#include <vt_position_vert>\nvarying float vIsText;\n#ifndef PICKING_MODE\nvarying vec2 vTexCoord;\nvarying float vOpacity;\nvarying float vGammaScale;\nvarying float vTextSize;\nvarying float vHalo;\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#if defined(HAS_TEXT_HALO_RADIUS) || defined(HAS_TEXT_HALO_OPACITY)\nattribute vec2 aTextHalo;\nvarying vec2 vTextHalo;\n#endif\n#include <highlight_vert>\n#else\n#include <fbo_picking_vert>\n#endif\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 = aDxDy.z;\n#else\nfloat e = textDx;\n#endif\n#ifdef HAS_TEXT_DY\nfloat f = aDxDy.w;\n#else\nfloat f = textDy;\n#endif\n#ifdef HAS_MARKER_WIDTH\nfloat h = aMarkerWidth;\n#else\nfloat h = markerWidth;\n#endif\n#ifdef HAS_MARKER_HEIGHT\nfloat i = aMarkerHeight;\n#else\nfloat i = markerHeight;\n#endif\n#ifdef HAS_MARKER_DX\nfloat j = aDxDy.x;\n#else\nfloat j = markerDx;\n#endif\n#ifdef HAS_MARKER_DY\nfloat k = aDxDy.y;\n#else\nfloat k = markerDy;\n#endif\nfloat l = mod(aShape.z, 2.);\n float m;\n if(l > .5) {\n \n#ifdef HAS_TEXT_PITCH_ALIGN\nm = aPitchAlign.y;\n#else\nm = textPitchWithMap;\n#endif\n } else {\n \n#ifdef HAS_MARKER_PITCH_ALIGN\nm = aPitchAlign.x;\n#else\nm = markerPitchWithMap;\n#endif\n }\n float n;\n if(l > .5) {\n \n#ifdef HAS_TEXT_ROTATION_ALIGN\nn = aRotationAlign.y;\n#else\nn = textRotateWithMap;\n#endif\n } else {\n \n#ifdef HAS_MARKER_ROTATION_ALIGN\nn = aRotationAlign.x;\n#else\nn = markerRotateWithMap;\n#endif\n }\n gl_Position = projViewModelMatrix * positionMatrix * vec4(c, 1.);\n float o = gl_Position.w;\n float u;\n if(isRenderingTerrain == 1. && m == 1.) {\n u = 1.;\n } else {\n float v = (1. - cameraToCenterDistance / o) * markerPerspectiveRatio;\n u = clamp(.5 + .5 * (1. - v), .0, 4.);\n }\n float A;\n if(l > .5) {\n \n#ifdef HAS_TEXT_ROTATION\nA = -aRotation.y / 9362. - mapRotation * n;\n#else\nA = -textRotation - mapRotation * n;\n#endif\n } else {\n \n#ifdef HAS_MARKER_ROTATION\nA = -aRotation.x / 9362. - mapRotation * n;\n#else\nA = -markerRotation - mapRotation * n;\n#endif\n }\n if(m == 1.) {\n \n#ifdef REVERSE_MAP_ROTATION_ON_PITCH\nA += mapRotation;\n#else\nif(l > .5) {\n A -= mapRotation;\n } else {\n A += mapRotation;\n }\n#endif\n }\n float B = sin(A);\n float C = cos(A);\n mat2 D = mat2(C, -1. * B, B, C);\n vec2 E = (aShape.xy / 10.0);\n if(m == 1. && flipY == .0) {\n E *= vec2(1., -1.);\n }\n vIsText = l;\n if(l > .5) {\n E = E / glyphSize * d;\n } else {\n \n#ifdef HAS_PAD_OFFSET\nfloat F = aPadOffset.x - 1.;\n float G = aPadOffset.y;\n#else\nfloat F = .0;\n float G = .0;\n#endif\nE = (E / iconSize * vec2(h, i) + vec2(F, G)) * layerScale;\n }\n E = D * E;\n float H;\n if(isRenderingTerrain == 1.) {\n H = 1.;\n } else {\n H = o / cameraToCenterDistance;\n }\n if(m == .0) {\n vec2 I = E * 2. / canvasSize;\n gl_Position.xy += I * u * o;\n } else if(l > .5) {\n float J;\n if(isRenderingTerrain == 1.) {\n J = tileRatio / zoomScale;\n } else {\n J = tileRatio / zoomScale * H * u;\n }\n vec2 I = E;\n gl_Position = projViewModelMatrix * positionMatrix * vec4(c + vec3(I, .0) * J, 1.);\n } else {\n vec2 I = E;\n gl_Position = projViewModelMatrix * positionMatrix * vec4(c + vec3(I, .0) * tileRatio / zoomScale * H * u, 1.);\n }\n if(l > .5) {\n gl_Position.xy += vec2(e, -f) * 2. / canvasSize * o;\n } else {\n gl_Position.xy += vec2(j, -k) * 2. / canvasSize * o;\n }\n#ifndef PICKING_MODE\nif(m == .0) {\n vGammaScale = mix(1., H, textPerspectiveRatio);\n } else {\n vGammaScale = H + mapPitch / 4.;\n }\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vec2 K = floor(aShape.zw / 2.);\n if(l > .5) {\n vTexCoord = K / glyphTexSize;\n } else {\n vTexCoord = K / iconTexSize;\n }\n vHalo = mod(aShape.w, 2.);\n vTextSize = d;\n#ifdef ENABLE_COLLISION\nvOpacity = aOpacity / 255.;\n#else\nvOpacity = 1.;\n#endif\n#ifdef HAS_OPACITY\nif(l > .5) {\n vOpacity *= aColorOpacity.y / 255.;\n } else {\n vOpacity *= aColorOpacity.x / 255.;\n }\n#endif\n#ifdef HAS_TEXT_FILL\nvTextFill = aTextFill / 255.;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\nvTextHaloFill = aTextHaloFill / 255.;\n#endif\n#if defined(HAS_TEXT_HALO_RADIUS) || defined(HAS_TEXT_HALO_OPACITY)\nvTextHalo = aTextHalo;\n#endif\nhighlight_setVarying();\n#else\n#ifdef ENABLE_COLLISION\nbool L = aOpacity == 255.;\n#else\nbool L = true;\n#endif\nfbo_picking_setData(gl_Position.w, L);\n#endif\n}", Ei = "#define RAD 0.0174532925\nstruct MarkerUniforms {\n positionMatrix: mat4x4f,\n projViewModelMatrix: mat4x4f,\n textSize: f32,\n markerDx: f32,\n markerDy: f32,\n textDx: f32,\n textDy: f32,\n markerWidth: f32,\n markerHeight: f32,\n markerPitchWithMap: f32,\n textPitchWithMap: f32,\n markerRotateWithMap: f32,\n textRotateWithMap: f32,\n markerRotation: f32,\n textRotation: f32,\n flipY: f32,\n textPerspectiveRatio: f32,\n markerPerspectiveRatio: f32,\n iconTexSize: vec2f,\n glyphTexSize: vec2f,\n tileRatio: f32,\n zoomScale: f32\n}\nstruct ShaderUniforms {\n cameraToCenterDistance: f32,\n glyphSize: f32,\n iconSize: vec2f,\n canvasSize: vec2f,\n layerScale: f32,\n isRenderingTerrain: f32,\n mapPitch: f32,\n mapRotation: f32\n}\n@group(0) @binding($b) var<uniform> uniforms: MarkerUniforms;\n@group(0) @binding($b) var<uniform> shaderUniforms: ShaderUniforms;\nstruct VertexInput {\n#ifdef HAS_ALTITUDE\n @location($i) aPosition: POSITION_TYPE_2,\n @location($i) aAltitude: f32,\n#else\n @location($i) aPosition: POSITION_TYPE_3,\n#endif\n @location($i) aShape: vec4i,\n#ifdef ENABLE_COLLISION\n @location($i) aOpacity: u32,\n#endif\n#ifdef HAS_OPACITY\n @location($i) aColorOpacity: vec2u,\n#endif\n#ifdef HAS_TEXT_SIZE\n @location($i) aTextSize: u32,\n#endif\n#if HAS_TEXT_DX || HAS_TEXT_DY || HAS_MARKER_DX || HAS_MARKER_DY\n @location($i) aDxDy: vec4i,\n#endif\n#ifdef HAS_MARKER_WIDTH\n @location($i) aMarkerWidth: u32,\n#endif\n#ifdef HAS_MARKER_HEIGHT\n @location($i) aMarkerHeight: u32,\n#endif\n#if HAS_MARKER_PITCH_ALIGN || HAS_TEXT_PITCH_ALIGN\n @location($i) aPitchAlign: vec2u,\n#endif\n#if HAS_MARKER_ROTATION_ALIGN || HAS_TEXT_ROTATION_ALIGN\n @location($i) aRotationAlign: vec2u,\n#endif\n#if HAS_MARKER_ROTATION || HAS_TEXT_ROTATION\n @location($i) aRotation: vec2u,\n#endif\n#ifdef HAS_PAD_OFFSET\n @location($i) aPadOffset: vec2i,\n#endif\n#ifdef HAS_TEXT_FILL\n @location($i) aTextFill: vec4u,\n#endif\n#ifdef HAS_TEXT_HALO_FILL\n @location($i) aTextHaloFill: vec4u,\n#endif\n#if HAS_TEXT_HALO_RADIUS || HAS_TEXT_HALO_OPACITY\n @location($i) aTextHalo: vec2u,\n#endif\n};\nstruct VertexOutput {\n @builtin(position) position: vec4f,\n#ifndef PICKING_MODE\n @location($o) vTexCoord: vec2f,\n @location($o) vOpacity: f32,\n @location($o) vGammaScale: f32,\n @location($o) vTextSize: f32,\n @location($o) vHalo: f32,\n @location($o) vIsText: f32,\n #ifdef HAS_TEXT_FILL\n @location($o) vTextFill: vec4f,\n #endif\n #ifdef HAS_TEXT_HALO_FILL\n @location($o) vTextHaloFill: vec4f,\n #endif\n #if HAS_TEXT_HALO_RADIUS || HAS_TEXT_HALO_OPACITY\n @location($o) vTextHalo: vec2f,\n #endif\n#endif\n};\n#include <vt_position_vert>\n#ifndef PICKING_MODE\n#include <highlight_vert>\n#else\n#include <fbo_picking_vert>\n#endif\n@vertex\nfn main(vertexInput: VertexInput) -> VertexOutput {\n var output: VertexOutput;\n var position = unpackVTPosition(vertexInput);\n#ifdef HAS_TEXT_SIZE\n var myTextSize = f32(vertexInput.aTextSize) * shaderUniforms.layerScale;\n#else\n var myTextSize = uniforms.textSize * shaderUniforms.layerScale;\n#endif\n#ifdef HAS_TEXT_DX\n var myTextDx = f32(vertexInput.aDxDy.z);\n#else\n var myTextDx = uniforms.textDx;\n#endif\n#ifdef HAS_TEXT_DY\n var myTextDy = f32(vertexInput.aDxDy.w);\n#else\n var myTextDy = uniforms.textDy;\n#endif\n#ifdef HAS_MARKER_WIDTH\n var myMarkerWidth = f32(vertexInput.aMarkerWidth);\n#else\n var myMarkerWidth = uniforms.markerWidth;\n#endif\n#ifdef HAS_MARKER_HEIGHT\n var myMarkerHeight = f32(vertexInput.aMarkerHeight);\n#else\n var myMarkerHeight = uniforms.markerHeight;\n#endif\n#ifdef HAS_MARKER_DX\n var myMarkerDx = f32(vertexInput.aDxDy.x);\n#else\n var myMarkerDx = uniforms.markerDx;\n#endif\n#ifdef HAS_MARKER_DY\n var myMarkerDy = f32(vertexInput.aDxDy.y);\n#else\n var myMarkerDy = uniforms.markerDy;\n#endif\n var isText = f32(vertexInput.aShape.z) % 2.0;\n var isPitchWithMap: f32;\n if (isText > 0.5) {\n#ifdef HAS_TEXT_PITCH_ALIGN\n isPitchWithMap = f32(vertexInput.aPitchAlign.y);\n#else\n isPitchWithMap = uniforms.textPitchWithMap;\n#endif\n } else {\n#ifdef HAS_MARKER_PITCH_ALIGN\n isPitchWithMap = f32(vertexInput.aPitchAlign.x);\n#else\n isPitchWithMap = uniforms.markerPitchWithMap;\n#endif\n }\n var isRotateWithMap: f32;\n if (isText > 0.5) {\n#ifdef HAS_TEXT_ROTATION_ALIGN\n isRotateWithMap = f32(vertexInput.aRotationAlign.y);\n#else\n isRotateWithMap = uniforms.textRotateWithMap;\n#endif\n } else {\n#ifdef HAS_MARKER_ROTATION_ALIGN\n isRotateWithMap = f32(vertexInput.aRotationAlign.x);\n#else\n isRotateWithMap = uniforms.markerRotateWithMap;\n#endif\n }\n let positionMatrix = uniforms.positionMatrix;\n let projViewModelMatrix = uniforms.projViewModelMatrix;\n output.position = projViewModelMatrix * positionMatrix * vec4f(position, 1.0);\n var projDistance = output.position.w;\n var perspectiveRatio: f32;\n if (shaderUniforms.isRenderingTerrain == 1.0 && isPitchWithMap == 1.0) {\n perspectiveRatio = 1.0;\n } else {\n var distanceRatio = (1.0 - shaderUniforms.cameraToCenterDistance / projDistance) * uniforms.markerPerspectiveRatio;\n perspectiveRatio = clamp(\n 0.5 + 0.5 * (1.0 - distanceRatio),\n 0.0,\n 4.0);\n }\n var rotation: f32;\n let mapRotation = shaderUniforms.mapRotation;\n if (isText > 0.5) {\n#ifdef HAS_TEXT_ROTATION\n rotation = -f32(vertexInput.aRotation.y) / 9362.0 - mapRotation * isRotateWithMap;\n#else\n rotation = -uniforms.textRotation - mapRotation * isRotateWithMap;\n#endif\n } else {\n#ifdef HAS_MARKER_ROTATION\n rotation = -f32(vertexInput.aRotation.x) / 9362.0 - mapRotation * isRotateWithMap;\n#else\n rotation = -uniforms.markerRotation - mapRotation * isRotateWithMap;\n#endif\n }\n if (isPitchWithMap == 1.0) {\n#ifdef REVERSE_MAP_ROTATION_ON_PITCH\n rotation += mapRotation;\n#else\n if (isText > 0.5) {\n rotation -= mapRotation;\n } else {\n rotation += mapRotation;\n }\n#endif\n }\n var angleSin = sin(rotation);\n var angleCos = cos(rotation);\n var shapeMatrix = mat2x2f(angleCos, -1.0 * angleSin, angleSin, angleCos);\n var shape = vec2f(vertexInput.aShape.xy) / 10.0;\n if (isPitchWithMap == 1.0 && uniforms.flipY == 0.0) {\n shape *= vec2f(1.0, -1.0);\n }\n if (isText > 0.5) {\n shape = shape / shaderUniforms.glyphSize * myTextSize;\n } else {\n#ifdef HAS_PAD_OFFSET\n var padOffsetX = f32(vertexInput.aPadOffset.x) - 1.0;\n var padOffsetY = f32(vertexInput.aPadOffset.y);\n#else\n var padOffsetX = 0.0;\n var padOffsetY = 0.0;\n#endif\n shape = (shape / shaderUniforms.iconSize * vec2f(myMarkerWidth, myMarkerHeight) + vec2f(padOffsetX, padOffsetY)) * shaderUniforms.layerScale;\n }\n shape = shapeMatrix * shape;\n var cameraScale: f32;\n if (shaderUniforms.isRenderingTerrain == 1.0) {\n cameraScale = 1.0;\n } else {\n cameraScale = projDistance / shaderUniforms.cameraToCenterDistance;\n }\n let canvasSize = shaderUniforms.canvasSize;\n if (isPitchWithMap == 0.0) {\n var offset = shape * 2.0 / canvasSize;\n output.position.x += offset.x * perspectiveRatio * projDistance;\n output.position.y += offset.y * perspectiveRatio * projDistance;\n } else if (isText > 0.5) {\n var offsetScale: f32;\n if (shaderUniforms.isRenderingTerrain == 1.0) {\n offsetScale = uniforms.tileRatio / uniforms.zoomScale;\n } else {\n offsetScale = uniforms.tileRatio / uniforms.zoomScale * cameraScale * perspectiveRatio;\n }\n var offset = shape;\n output.position = projViewModelMatrix * positionMatrix * vec4f(position + vec3f(offset, 0.0) * offsetScale, 1.0);\n } else {\n var offset = shape;\n output.position = projViewModelMatrix * positionMatrix * vec4f(position + vec3f(offset, 0.0) * uniforms.tileRatio / uniforms.zoomScale * cameraScale * perspectiveRatio, 1.0);\n }\n if (isText > 0.5) {\n output.position.x += myTextDx * 2.0 / canvasSize.x * projDistance;\n output.position.y += -myTextDy * 2.0 / canvasSize.y * projDistance;\n } else {\n output.position.x += myMarkerDx * 2.0 / canvasSize.x * projDistance;\n output.position.y += -myMarkerDy * 2.0 / canvasSize.y * projDistance;\n }\n#ifndef PICKING_MODE\n output.vIsText = isText;\n if (isPitchWithMap == 0.0) {\n output.vGammaScale = mix(1.0, cameraScale, uniforms.textPerspectiveRatio);\n } else {\n output.vGammaScale = cameraScale + shaderUniforms.mapPitch / 4.0;\n }\n output.vGammaScale = clamp(output.vGammaScale, 0.0, 1.0);\n var texCoord = floor(vec2f(vertexInput.aShape.zw) / 2.0);\n if (isText > 0.5) {\n output.vTexCoord = texCoord / uniforms.glyphTexSize;\n } else {\n output.vTexCoord = texCoord / uniforms.iconTexSize;\n }\n output.vHalo = f32(vertexInput.aShape.w) % 2.0;\n output.vTextSize = myTextSize;\n#ifdef ENABLE_COLLISION\n output.vOpacity = f32(vertexInput.aOpacity) / 255.0;\n#else\n output.vOpacity = 1.0;\n#endif\n#ifdef HAS_OPACITY\n if (isText > 0.5) {\n output.vOpacity *= f32(vertexInput.aColorOpacity.y) / 255.0;\n } else {\n output.vOpacity *= f32(vertexInput.aColorOpacity.x) / 255.0;\n }\n#endif\n#ifdef HAS_TEXT_FILL\n output.vTextFill = vec4f(vertexInput.aTextFill) / 255.0;\n#endif\n#ifdef HAS_TEXT_HALO_FILL\n output.vTextHaloFill = vec4f(vertexInput.aTextHaloFill) / 255.0;\n#endif\n#if HAS_TEXT_HALO_RADIUS || HAS_TEXT_HALO_OPACITY\n output.vTextHalo = vec2f(vertexInput.aTextHalo);\n#endif\n#if HAS_HIGHLIGHT_COLOR || HAS_HIGHLIGHT_OPACITY\n highlight_setVarying(vertexInput, output);\n#endif\n#else\n#ifdef ENABLE_COLLISION\n var visible = f32(vertexInput.aOpacity) == 255.0;\n#else\n var visible = true;\n#endif\n fbo_picking_setData(vertexInput, &output, output.position.w, visible);\n#endif\n return output;\n}";
14482
14489
 
14483
- const Di = [], Hi = [], Li = [], Ni = [], zi = [], Vi = [];
14490
+ const Hi = [], Di = [], Li = [], Ni = [], zi = [], Vi = [];
14484
14491
 
14485
14492
  function Ui(e, t, n, i, r, o, s, a, l, h, c, u, f, d) {
14486
14493
  const {tileRatio: g, tileResolution: m} = l, y = g / (m / h.getResolution()) * (c / h.cameraToCenterDistance) * u;
14487
- v.scale(n, n, y), v.scale(i, i, y), v.scale(r, r, y), v.scale(o, o, y), p.set(Di, n[0], n[1], f ? n[2] / d : 0),
14488
- p.set(Hi, i[0], i[1], f ? i[2] / d : 0), p.set(Li, r[0], r[1], f ? r[2] / d : 0),
14489
- p.set(Ni, o[0], o[1], f ? o[2] / d : 0), p.add(Di, Di, t), p.add(Hi, Hi, t), p.add(Li, Li, t),
14490
- p.add(Ni, Ni, t), rn(n, Di, s, h.width, h.height), rn(i, Hi, s, h.width, h.height),
14494
+ v.scale(n, n, y), v.scale(i, i, y), v.scale(r, r, y), v.scale(o, o, y), p.set(Hi, n[0], n[1], f ? n[2] / d : 0),
14495
+ p.set(Di, i[0], i[1], f ? i[2] / d : 0), p.set(Li, r[0], r[1], f ? r[2] / d : 0),
14496
+ p.set(Ni, o[0], o[1], f ? o[2] / d : 0), p.add(Hi, Hi, t), p.add(Di, Di, t), p.add(Li, Li, t),
14497
+ p.add(Ni, Ni, t), rn(n, Hi, s, h.width, h.height), rn(i, Di, s, h.width, h.height),
14491
14498
  rn(r, Li, s, h.width, h.height), rn(o, Ni, s, h.width, h.height), v.set(zi, Math.min(n[0], i[0], r[0], o[0]), Math.min(n[1], i[1], r[1], o[1])),
14492
14499
  v.set(Vi, Math.max(n[0], i[0], r[0], o[0]), Math.max(n[1], i[1], r[1], o[1])), x.set(e, zi[0] + a[0], zi[1] + a[1], Vi[0] + a[0], Vi[1] + a[1]);
14493
14500
  }
@@ -14519,25 +14526,25 @@ function or(e, t, n, r, o) {
14519
14526
  x = ze(.5 + .5 * (1 - (1 - l / y) * a.markerPerspectiveRatio), 0, 4);
14520
14527
  }
14521
14528
  const {aShape: _, aMarkerDx: A, aMarkerDy: T, aMarkerWidth: S, aMarkerHeight: b, aPitchAlign: P, aRotationAlign: w, aRotation: M} = h, I = A ? A[n] : c.markerDx, C = T ? T[n] : c.markerDy, O = P ? P[2 * n] : a.markerPitchWithMap, k = w ? w[2 * n] : a.markerRotateWithMap, R = v.set(nr, I || 0, -(C || 0));
14522
- let F = v.set(Ji, _[2 * n] / 10, _[2 * n + 1] / 10), E = v.set(Qi, _[2 * n + 2] / 10, _[2 * n + 3] / 10), D = v.set(er, _[2 * n + 4] / 10, _[2 * n + 5] / 10), H = v.set(tr, _[2 * n + 6] / 10, _[2 * n + 7] / 10);
14523
- 0 === a.flipY && 1 === O && (v.multiply(F, F, ir), v.multiply(E, E, ir), v.multiply(D, D, ir),
14524
- v.multiply(H, H, ir));
14525
- const [L, N] = Dn(t.geometry);
14529
+ let F = v.set(Ji, _[2 * n] / 10, _[2 * n + 1] / 10), E = v.set(Qi, _[2 * n + 2] / 10, _[2 * n + 3] / 10), H = v.set(er, _[2 * n + 4] / 10, _[2 * n + 5] / 10), D = v.set(tr, _[2 * n + 6] / 10, _[2 * n + 7] / 10);
14530
+ 0 === a.flipY && 1 === O && (v.multiply(F, F, ir), v.multiply(E, E, ir), v.multiply(H, H, ir),
14531
+ v.multiply(D, D, ir));
14532
+ const [L, N] = Hn(t.geometry);
14526
14533
  let z = S ? S[n] : c.markerWidth;
14527
14534
  Ue(z) && (z = L || Wi);
14528
14535
  let V = b ? b[n] : c.markerHeight;
14529
14536
  Ue(V) && (V = N || ji);
14530
14537
  const U = v.set(rr, z / Xi, V / Xi);
14531
14538
  let G;
14532
- v.mul(F, F, U), v.mul(E, E, U), v.mul(D, D, U), v.mul(H, H, U), G = M ? M[2 * n] / 9362 : -(c.markerRotation || 0) * Math.PI / 180;
14539
+ v.mul(F, F, U), v.mul(E, E, U), v.mul(H, H, U), v.mul(D, D, U), G = M ? M[2 * n] / 9362 : -(c.markerRotation || 0) * Math.PI / 180;
14533
14540
  const B = -G, W = (s ? s.bearing : o.geBearing()) * Math.PI / 180;
14534
14541
  if (W * k || B) {
14535
14542
  const e = Bi(Ki, B, W, k, O);
14536
- F = v.transformMat2(F, F, e), E = v.transformMat2(E, E, e), D = v.transformMat2(D, D, e),
14537
- H = v.transformMat2(H, H, e);
14543
+ F = v.transformMat2(F, F, e), E = v.transformMat2(E, E, e), H = v.transformMat2(H, H, e),
14544
+ D = v.transformMat2(D, D, e);
14538
14545
  }
14539
- 1 === O ? Ui(e, d, F, E, D, H, r, R, a, o, y, x) : (v.multiply(F, F, ir), v.multiply(E, E, ir),
14540
- v.multiply(D, D, ir), v.multiply(H, H, ir), Gi(e, m, F, E, D, H, R, x));
14546
+ 1 === O ? Ui(e, d, F, E, H, D, r, R, a, o, y, x) : (v.multiply(F, F, ir), v.multiply(E, E, ir),
14547
+ v.multiply(H, H, ir), v.multiply(D, D, ir), Gi(e, m, F, E, H, D, R, x));
14541
14548
  const j = s ? s.devicePixelRatio : o.getDevicePixelRatio();
14542
14549
  return 1 !== j && (e[0] *= j, e[1] *= j, e[2] *= j, e[3] *= j), e;
14543
14550
  }
@@ -14584,8 +14591,8 @@ function gr(e, t, n, r, o, s, a, l, h) {
14584
14591
  v.scale(s, s, S), v.scale(u, u, S), v.scale(p, p, S), v.scale(A, A, S), 1 === k ? Ui(e, t, s, u, p, A, l, E, c, h, x, _) : Gi(e, n, s, u, p, A, E, _);
14585
14592
  }
14586
14593
  s = s || 0, e[0] -= s + ar, e[1] -= s + ar, e[2] += s + ar, e[3] += s + ar;
14587
- const D = m ? m.devicePixelRatio : h.getDevicePixelRatio();
14588
- return 1 !== D && (e[0] *= D, e[1] *= D, e[2] *= D, e[3] *= D), e;
14594
+ const H = m ? m.devicePixelRatio : h.getDevicePixelRatio();
14595
+ return 1 !== H && (e[0] *= H, e[1] *= H, e[2] *= H, e[3] *= H), e;
14589
14596
  }
14590
14597
 
14591
14598
  function mr(e, t, n) {
@@ -15040,7 +15047,7 @@ function Rr(e, t) {
15040
15047
 
15041
15048
  const Fr = [], Er = [];
15042
15049
 
15043
- const Dr = 6, Hr = 4, Lr = new Uint16Array(1), Nr = new Int8Array(1);
15050
+ const Hr = 6, Dr = 4, Lr = new Uint16Array(1), Nr = new Int8Array(1);
15044
15051
 
15045
15052
  function zr(e, t, n, i, r, o, s, a, l) {
15046
15053
  if (t.isDisposed() || 0 === t.data.aPosition.length) return null;
@@ -15110,7 +15117,7 @@ function Vr(e) {
15110
15117
  }
15111
15118
 
15112
15119
  function Ur(e, t, n, i) {
15113
- const [r, o] = Dn(n);
15120
+ const [r, o] = Hn(n);
15114
15121
  Be(e, "markerOpacity", i, "markerOpacity", 1), Be(e, "markerPerspectiveRatio", i, "markerPerspectiveRatio", i.markerTextFit ? 0 : 1),
15115
15122
  Be(e, "markerWidth", i, "markerWidth", r || Wi), Be(e, "markerHeight", i, "markerHeight", o || ji),
15116
15123
  Be(e, "markerDx", i, "markerDx", 0), Be(e, "markerDy", i, "markerDy", 0), Be(e, "markerRotation", i, "markerRotation", 0, (e => e * Math.PI / 180)),
@@ -15391,27 +15398,27 @@ function jr(e, t, n) {
15391
15398
  u = {
15392
15399
  pickingId: l[f],
15393
15400
  start: 0,
15394
- end: h[f] * Dr
15401
+ end: h[f] * Hr
15395
15402
  };
15396
15403
  let d = !1, p = !1, g = 0;
15397
15404
  const m = new Set;
15398
- for (let e = 0; e < o.length; e += Dr) {
15405
+ for (let e = 0; e < o.length; e += Hr) {
15399
15406
  const f = s[o[e]];
15400
15407
  if (!d && u) for (;u.pickingId < f && u.end < a.length; ) {
15401
15408
  const e = u.end, t = a[e];
15402
- u.start = e, u.end = e + h[t] * Dr, u.pickingId = l[t];
15409
+ u.start = e, u.end = e + h[t] * Hr, u.pickingId = l[t];
15403
15410
  }
15404
15411
  if (!d && u && u.pickingId < f && (d = !0, !i)) {
15405
15412
  if (!p) return [];
15406
- for (let t = e; t < o.length; t += Dr) r[g++] = [ -1, -1 ];
15413
+ for (let t = e; t < o.length; t += Hr) r[g++] = [ -1, -1 ];
15407
15414
  return r;
15408
15415
  }
15409
15416
  const y = c[f] && c[f].feature, x = y && y.properties || {}, _ = n ? n(null, x) : t;
15410
15417
  if (u && f === u.pickingId) {
15411
15418
  r[g++] = [ u.start, u.end ];
15412
15419
  const e = u.end, t = a[e];
15413
- u.start = e, u.end = e + h[t] * Dr, u.pickingId = l[t], p = !0;
15414
- } else if (_ && "none" !== _) for (let t = e; t < e + Dr; t++) m.add(t); else r[g++] = [ -1, -1 ];
15420
+ u.start = e, u.end = e + h[t] * Hr, u.pickingId = l[t], p = !0;
15421
+ } else if (_ && "none" !== _) for (let t = e; t < e + Hr; t++) m.add(t); else r[g++] = [ -1, -1 ];
15415
15422
  }
15416
15423
  if (m.size) if (m.size === o.length) e.setElements([]); else {
15417
15424
  const t = [];
@@ -15456,14 +15463,14 @@ function Xr(e, t) {
15456
15463
  e || (e = t.properties.textFitFn = I(n.markerTextFit));
15457
15464
  const {features: i} = t.properties, a = t.properties.iconElements, {aPickingId: l} = t.data, h = [], c = [];
15458
15465
  let u = !0;
15459
- for (let t = 0; t < a.length; t += Dr) {
15466
+ for (let t = 0; t < a.length; t += Hr) {
15460
15467
  const n = i[l[a[t]]], r = (n && n.feature || {}).properties || {};
15461
15468
  let o = e(null, r);
15462
15469
  if (M(o)) {
15463
15470
  o = (r.textFitFn = r.textFitFn || I(o))(null, r);
15464
15471
  }
15465
- "both" === o ? (h.push(t / Dr), c.push(t / Dr)) : "width" === o ? (u = !1, h.push(t / Dr)) : "height" === o && (u = !1,
15466
- c.push(t / Dr));
15472
+ "both" === o ? (h.push(t / Hr), c.push(t / Hr)) : "width" === o ? (u = !1, h.push(t / Hr)) : "height" === o && (u = !1,
15473
+ c.push(t / Hr));
15467
15474
  }
15468
15475
  u ? (r.fitIcons = h, o = !0, s = !0) : (h.length && (r.fitWidthIcons = h, o = !0),
15469
15476
  c.length && (r.fitHeightIcons = c, s = !0));
@@ -15523,20 +15530,20 @@ function Yr(e, t) {
15523
15530
  if (b = b || $r, b[0] === b[2] && b[1] === b[3] || (S = r.aPadOffset, S || (S = r.aPadOffset = new Int16Array(2 * g.length))),
15524
15531
  g && n) {
15525
15532
  const t = Math.abs((f - o) / 10 * T) + (b[1] + b[3] || 0);
15526
- if (Lr[0] = t, g[e] !== Lr[0] && (Ye(g, Lr[0], e, e + Hr), g.dirty = !0), S) {
15533
+ if (Lr[0] = t, g[e] !== Lr[0] && (Ye(g, Lr[0], e, e + Dr), g.dirty = !0), S) {
15527
15534
  const t = (b[1] + b[3]) / 2 - b[3];
15528
15535
  if (Nr[0] = t, S[2 * e] !== Nr[0]) {
15529
- for (let n = e; n < e + Hr; n++) S[2 * n] = t;
15536
+ for (let n = e; n < e + Dr; n++) S[2 * n] = t;
15530
15537
  S.dirty = !0;
15531
15538
  }
15532
15539
  }
15533
15540
  }
15534
15541
  if (m && i) {
15535
15542
  const t = Math.abs((d - c) / 10 * T) + (b[0] + b[2] || 0);
15536
- if (Lr[0] = t, m[e] !== Lr[0] && (Ye(m, Lr[0], e, e + Hr), m.dirty = !0), S) {
15543
+ if (Lr[0] = t, m[e] !== Lr[0] && (Ye(m, Lr[0], e, e + Dr), m.dirty = !0), S) {
15537
15544
  const t = b[0] - (b[0] + b[2]) / 2;
15538
15545
  if (Nr[0] = t, S[2 * e + 1] !== Nr[0]) {
15539
- for (let n = e; n < e + Hr; n++) S[2 * n + 1] = t;
15546
+ for (let n = e; n < e + Dr; n++) S[2 * n + 1] = t;
15540
15547
  S.dirty = !0;
15541
15548
  }
15542
15549
  }
@@ -15545,19 +15552,19 @@ function Yr(e, t) {
15545
15552
  if (f || d || p) {
15546
15553
  if (f) for (let e = 0; e < f.length; e++) {
15547
15554
  const t = f[e];
15548
- A(x[t * Dr], t, !0, !0);
15555
+ A(x[t * Hr], t, !0, !0);
15549
15556
  } else if (d || p) {
15550
15557
  if (d) for (let e = 0; e < d.length; e++) {
15551
15558
  const t = d[e];
15552
- A(x[t * Dr], t, !0, !1);
15559
+ A(x[t * Hr], t, !0, !1);
15553
15560
  }
15554
15561
  if (p) for (let e = 0; e < p.length; e++) {
15555
15562
  const t = p[e];
15556
- A(x[t * Dr], t, !1, !0);
15563
+ A(x[t * Hr], t, !1, !0);
15557
15564
  }
15558
15565
  }
15559
- } else for (let e = 0; e < x.length; e += Dr) {
15560
- const t = e / Dr;
15566
+ } else for (let e = 0; e < x.length; e += Hr) {
15567
+ const t = e / Hr;
15561
15568
  A(x[e], t, !0, !0);
15562
15569
  }
15563
15570
  const {aPadOffset: T} = r;
@@ -15639,11 +15646,11 @@ class to extends Ii {
15639
15646
  if (!n) return void (e.properties.collideBoxIndex = o);
15640
15647
  let s = 0, a = n[0], l = 0, h = t[a], c = r[0], u = 1;
15641
15648
  i && (u = i[n[l]]);
15642
- for (let e = 0; e <= n.length; e += Dr) if (a = n[e], t[a] !== h || c !== r[a] || e === n.length) {
15649
+ for (let e = 0; e <= n.length; e += Hr) if (a = n[e], t[a] !== h || c !== r[a] || e === n.length) {
15643
15650
  o[h] || (o[h] = []);
15644
15651
  const f = e;
15645
15652
  let d = l;
15646
- 1 === c && (d = l + (f - l) / 2), o[h].push([ d, f, (f - d) / (u * Dr), s++, l ]),
15653
+ 1 === c && (d = l + (f - l) / 2), o[h].push([ d, f, (f - d) / (u * Hr), s++, l ]),
15647
15654
  h = t[a], c = r[a], l = e, i && (u = i[n[l]]);
15648
15655
  }
15649
15656
  e.properties.collideBoxIndex = o;
@@ -15670,7 +15677,7 @@ class to extends Ii {
15670
15677
  r < e.length && s.fill(t++, r, e.length);
15671
15678
  } else {
15672
15679
  let t = 0;
15673
- for (let n = 0; n < e.length; n += Hr) s.fill(t++, n, n + Hr);
15680
+ for (let n = 0; n < e.length; n += Dr) s.fill(t++, n, n + Dr);
15674
15681
  }
15675
15682
  t.properties.collideIds = s, t.properties.uniqueCollideIds = Je(s, !n);
15676
15683
  } else if (a) {
@@ -15678,8 +15685,8 @@ class to extends Ii {
15678
15685
  if (!i) return;
15679
15686
  let r = 0, o = i[0];
15680
15687
  for (let t = 0; t < e.length; ) {
15681
- const n = t + o * Hr;
15682
- e.fill(r++, t, n), t += o * Hr, n < e.length && (o = i[n]);
15688
+ const n = t + o * Dr;
15689
+ e.fill(r++, t, n), t += o * Dr, n < e.length && (o = i[n]);
15683
15690
  }
15684
15691
  t.properties.uniqueCollideIds = Je(e, !n);
15685
15692
  }
@@ -15787,7 +15794,7 @@ class to extends Ii {
15787
15794
  const [t, s, h] = a[e];
15788
15795
  let c = 1;
15789
15796
  o && (c = o[r[t]]);
15790
- const u = t + 0 * c * Dr;
15797
+ const u = t + 0 * c * Hr;
15791
15798
  l[f].mesh = n, l[f].start = u, l[f].end = s, l[f].boxStart = a[e][4], l[f].boxCount = i.glyphAtlas ? c : h,
15792
15799
  l[f].allElements = r, f++;
15793
15800
  }
@@ -15834,7 +15841,7 @@ class to extends Ii {
15834
15841
  }
15835
15842
  const a = this.getMap(), {boxes: l, collision: h} = this._getCollideBoxes(e, i);
15836
15843
  let c = 0, u = 0, f = 0;
15837
- for (let n = i; n < r; n += Dr) {
15844
+ for (let n = i; n < r; n += Hr) {
15838
15845
  const i = l[f] = l[f] || [];
15839
15846
  f++;
15840
15847
  const r = or.call(this, i, e, t[n], o, a);
@@ -15992,16 +15999,16 @@ function so(e, t, n, i, r, o, s, a, l, h, c, u, f) {
15992
15999
  M.x = w.x, M.y = w.y, C.x = I.x, C.y = I.y, w.x = n[3 * P], w.y = n[3 * P + 1],
15993
16000
  I.x = x[3 * P], I.y = x[3 * P + 1], O += k, k = M.dist(w) / d;
15994
16001
  }
15995
- const R = (b - O) / k, F = g && g.getRenderer(), E = F && F.getTerrainHelper(), D = t.properties.tile.terrainTileInfos;
16002
+ const R = (b - O) / k, F = g && g.getRenderer(), E = F && F.getTerrainHelper(), H = t.properties.tile.terrainTileInfos;
15996
16003
  if (!y && E) {
15997
16004
  const {extent: n} = t.properties.tile, i = g.getTileSize().width / n, r = g.getMap();
15998
16005
  let o = I.sub(C).mult(R)._add(C);
15999
- w = un(on, r, t, I, i, g, m, D), M = un(sn, r, t, C, i, g, m, D), o = un(an, r, t, o, i, g, m, D);
16006
+ w = un(on, r, t, I, i, g, m, H), M = un(sn, r, t, C, i, g, m, H), o = un(an, r, t, o, i, g, m, H);
16000
16007
  const s = T + Math.atan2(w[1] - M[1], w[0] - M[0]);
16001
16008
  return e[0] = (o[0] - p[0]) / d, e[1] = (o[1] - p[1]) / d, e[2] = s, e;
16002
16009
  }
16003
- const H = w.sub(M), L = H.mult(R)._add(M);
16004
- L._add(H._unit()._perp()._mult(a * A));
16010
+ const D = w.sub(M), L = D.mult(R)._add(M);
16011
+ L._add(D._unit()._perp()._mult(a * A));
16005
16012
  const N = T + Math.atan2(w.y - M.y, w.x - M.x);
16006
16013
  return e[0] = (L.x - i[0]) / d, e[1] = (L.y - i[1]) / d, e[2] = N, e;
16007
16014
  }(e, t, i, o, s, b, S[0], S[1], P[0], P[1], P[2], n / 24, l, a, h, c, u, f);
@@ -16038,7 +16045,7 @@ const {TextUtil: yo, PackUtil: xo, FilterUtil: _o, TEXT_MAX_ANGLE: vo} = j(), Ao
16038
16045
  }, bo = function(e) {
16039
16046
  const t = this.layer.getRenderer(), n = e.properties.tile.z, i = t.getCurrentTileZoom();
16040
16047
  return !this._isHalo0(e) && !t.isForeground(e) && "line" === e.geometry.properties.textPlacement && n < i;
16041
- }, Po = [ 0, 0, 3 ], wo = [], Mo = [], Io = [], Co = [], Oo = [], ko = [], Ro = [], Fo = [], Eo = [ 1, -1 ], Do = new Int16Array(3), Ho = [], Lo = [], No = [], zo = [], Vo = [], Uo = [], Go = [], Bo = {}, Wo = {}, jo = {}, Xo = [], $o = [], Yo = g.identity([]), Zo = [];
16048
+ }, Po = [ 0, 0, 3 ], wo = [], Mo = [], Io = [], Co = [], Oo = [], ko = [], Ro = [], Fo = [], Eo = [ 1, -1 ], Ho = new Int16Array(3), Do = [], Lo = [], No = [], zo = [], Vo = [], Uo = [], Go = [], Bo = {}, Wo = {}, jo = {}, Xo = [], $o = [], Yo = g.identity([]), Zo = [];
16042
16049
 
16043
16050
  class qo extends Ii {
16044
16051
  static getBloomSymbol() {
@@ -16271,8 +16278,8 @@ class qo extends Ii {
16271
16278
  if (e === Ie) return w[3 * C] = Me, w[3 * C + 1] = Me, w[3 * C + 2] = Me, !1;
16272
16279
  e ? (E = p.set($o, ...k), E[2] = 100 * e, E = rn(E, E, s, d.width, d.height)) : E = R;
16273
16280
  } else E = R;
16274
- const D = i[d.id], H = D ? D.devicePixelRatio : d.getdevicePixelRatio();
16275
- if (x.scale(Zo, E, 1 / H), d.isOffscreen(Zo)) return f || Ko(A, t, n, r), w[3 * C] = Me,
16281
+ const H = i[d.id], D = H ? H.devicePixelRatio : d.getdevicePixelRatio();
16282
+ if (x.scale(Zo, E, 1 / D), d.isOffscreen(Zo)) return f || Ko(A, t, n, r), w[3 * C] = Me,
16276
16283
  w[3 * C + 1] = Me, w[3 * C + 2] = Me, !1;
16277
16284
  I && (k = R), w[3 * C] = E[0], w[3 * C + 1] = E[1], w[3 * C + 2] = E[2];
16278
16285
  const L = I ? 1 : m.properties.tileExtent / this.layer.getTileSize().width;
@@ -16296,7 +16303,7 @@ class qo extends Ii {
16296
16303
  p.set(zo, P[3 * a], P[3 * a + 1], 0);
16297
16304
  const e = p.normalize(zo, zo), t = -P[3 * a + 2];
16298
16305
  if (t) {
16299
- const n = T.setAxisAngle(Ho, e, t);
16306
+ const n = T.setAxisAngle(Do, e, t);
16300
16307
  g.fromTranslation(Lo, Po), g.fromQuat(No, n), x = g.multiply(No, No, Lo);
16301
16308
  }
16302
16309
  }
@@ -16304,10 +16311,10 @@ class qo extends Ii {
16304
16311
  const t = 2 * (a + e);
16305
16312
  v.set(Ro, _[t] / 10, _[t + 1] / 10), v.scale(Ro, Ro, U / 24), v.transformMat2(Ro, Ro, m),
16306
16313
  c ? (v.multiply(Ro, Ro, Eo), v.add(Fo, Ro, l), y && (Fo[2] = 0, x && p.transformMat4(Fo, Fo, x))) : (v.multiply(Fo, l, Eo),
16307
- v.add(Fo, Ro, Fo)), Do[0] = 10 * Fo[0], Do[1] = 10 * Fo[1], y && (Do[2] = 10 * Fo[2]);
16314
+ v.add(Fo, Ro, Fo)), Ho[0] = 10 * Fo[0], Ho[1] = 10 * Fo[1], y && (Ho[2] = 10 * Fo[2]);
16308
16315
  const n = (y ? 3 : 2) * (a + e);
16309
- (A[n] !== Do[0] || A[n + 1] !== Do[1] || y && A[n + 2] !== Do[2]) && (A.dirty = !0,
16310
- A[n] = Do[0], A[n + 1] = Do[1], y && (A[n + 2] = Do[2]));
16316
+ (A[n] !== Ho[0] || A[n + 1] !== Ho[1] || y && A[n + 2] !== Ho[2]) && (A.dirty = !0,
16317
+ A[n] = Ho[0], A[n + 1] = Ho[1], y && (A[n + 2] = Ho[2]));
16311
16318
  }
16312
16319
  }
16313
16320
  return N;
@@ -17575,7 +17582,7 @@ class ks extends On {
17575
17582
  }
17576
17583
  }
17577
17584
 
17578
- const Rs = d.ShaderLib.get("mesh_picking_vert"), Fs = d.WgslShaderLib.get("mesh_picking").vert, {PackUtil: Es} = j(), Ds = [], Hs = [], Ls = [], Ns = [], zs = [], Vs = [], Us = [], Gs = [ 0, 0, 0 ], Bs = [ 0, 0, 0 ], Ws = [ 1, 1, 1 ], js = [], Xs = [ 1, 1, 1, 1 ], $s = [], Ys = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], Zs = e => class extends e {
17585
+ const Rs = d.ShaderLib.get("mesh_picking_vert"), Fs = d.WgslShaderLib.get("mesh_picking").vert, {PackUtil: Es} = j(), Hs = [], Ds = [], Ls = [], Ns = [], zs = [], Vs = [], Us = [], Gs = [ 0, 0, 0 ], Bs = [ 0, 0, 0 ], Ws = [ 1, 1, 1 ], js = [], Xs = [ 1, 1, 1, 1 ], $s = [], Ys = [ 1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1 ], Zs = e => class extends e {
17579
17586
  constructor(e, t, n, i, r, o) {
17580
17587
  super(e, t, n, i, r, o), this._ready = !1;
17581
17588
  const s = i.fetchOptions || {};
@@ -17662,47 +17669,54 @@ const Rs = d.ShaderLib.get("mesh_picking_vert"), Fs = d.WgslShaderLib.get("mesh_
17662
17669
  const s = this._calAnchorTranslation(o, t);
17663
17670
  Math.abs(s) > Math.abs(c) && (c = s);
17664
17671
  }));
17665
- const A = [ 0, 0, c ], P = i.map(((i, v) => {
17666
- const {geometry: T, materialInfo: S, morphWeights: b, extraInfo: P, nodeIndex: w} = i;
17672
+ const A = [ 0, 0, c ], w = i.map(((i, v) => {
17673
+ const {geometry: T, materialInfo: S, morphWeights: b, extraInfo: w, nodeIndex: M} = i;
17667
17674
  t.alphaTest && (S.alphaTest = t.alphaTest);
17668
- const M = new (this.getMaterialClazz(S))(S), I = {}, C = new d.InstancedMesh(y, u, T, M, {
17675
+ const I = new (this.getMaterialClazz(S))(S), C = {}, O = new d.InstancedMesh(y, u, T, I, {
17669
17676
  transparent: !1,
17670
17677
  picking: !0
17671
17678
  });
17672
17679
  if (r.hasSkinAnimation()) {
17673
- const t = this._updateAnimation(C, e, 0)[w];
17674
- C.setUniform("jointTexture", t.jointTexture), C.setUniform("jointTextureSize", t.jointTextureSize),
17675
- C.setUniform("numJoints", t.numJoints), C.setUniform("skinAnimation", +this._isSkinAnimating(e)),
17676
- C.properties.startTime = o, I.HAS_SKIN = 1;
17680
+ const t = this._updateAnimation(O, e, 0)[M];
17681
+ O.setUniform("jointTexture", t.jointTexture), O.setUniform("jointTextureSize", t.jointTextureSize),
17682
+ O.setUniform("numJoints", t.numJoints), O.setUniform("skinAnimation", +this._isSkinAnimating(e)),
17683
+ O.properties.startTime = o, C.HAS_SKIN = 1;
17684
+ }
17685
+ b && (O.setUniform("morphWeights", b), C.HAS_MORPH = 1);
17686
+ let k = t.markerOpacity;
17687
+ k || 0 === k || (k = 1);
17688
+ let R = t.markerFill;
17689
+ if (R && J(R) && R.startsWith("rgba")) {
17690
+ k *= P(R).alpha();
17677
17691
  }
17678
- b && (C.setUniform("morphWeights", b), I.HAS_MORPH = 1), C.setUniform("hasAlpha", P.alphaMode && "BLEND" === P.alphaMode.toUpperCase()),
17679
- Be(C.uniforms, "polygonFill", t, "markerFill", Xs, Xe(this.colorCache)), Be(C.uniforms, "polygonOpacity", t, "markerOpacity", 1);
17680
- const O = [];
17681
- C.setPositionMatrix((() => {
17682
- const t = this._getMeshNodeMatrix(e, v, w);
17683
- g.multiply(O, Ys, t), g.multiply(O, h, O);
17692
+ O.setUniform("hasAlpha", w.alphaMode && "BLEND" === w.alphaMode.toUpperCase() || k < 1),
17693
+ Be(O.uniforms, "polygonFill", t, "markerFill", Xs, Xe(this.colorCache)), Be(O.uniforms, "polygonOpacity", t, "markerOpacity", 1);
17694
+ const F = [];
17695
+ O.setPositionMatrix((() => {
17696
+ const t = this._getMeshNodeMatrix(e, v, M);
17697
+ g.multiply(F, Ys, t), g.multiply(F, h, F);
17684
17698
  const n = g.identity($s);
17685
- if (0 !== c && (g.fromTranslation(n, A), g.multiply(O, n, O)), Ze(l)) {
17699
+ if (0 !== c && (g.fromTranslation(n, A), g.multiply(F, n, F)), Ze(l)) {
17686
17700
  const e = s.getGLScale() / s.getGLScale(l);
17687
- return p.set(Ds, e, e, e), g.fromScaling(n, Ds), g.multiply(n, n, O);
17701
+ return p.set(Hs, e, e, e), g.fromScaling(n, Hs), g.multiply(n, n, F);
17688
17702
  }
17689
- return O;
17703
+ return F;
17690
17704
  }));
17691
- const k = this.layer.getRenderer().getZScale(), R = [], F = [];
17692
- return C.setLocalTransform((() => {
17705
+ const E = this.layer.getRenderer().getZScale(), H = [], D = [];
17706
+ return O.setLocalTransform((() => {
17693
17707
  const e = this.layer.options.altitude || 0;
17694
- return p.copy(F, m), F[2] += 100 * e * k, g.translate(R, n, F), R;
17708
+ return p.copy(D, m), D[2] += 100 * e * E, g.translate(H, n, D), H;
17695
17709
  })), T.generateBuffers(this.regl, {
17696
17710
  excludeElementsInVAO: !0
17697
- }), f.instance_color && (I.HAS_INSTANCE_COLOR = 1), f.aTerrainAltitude && (I.HAS_INSTANCE_TERRAIN_ALTITUDE = 1,
17698
- C.setUniform("terrainAltitudeScale", 100 * this.layer.getRenderer().getZScale())),
17699
- I.HAS_LAYER_OPACITY = 1, Ne(C.properties, a.properties), C.properties.aPickingId = x,
17700
- C.properties.nodeIndex = w, C.properties.pickingIdIndiceMap = _, C.setDefines(I),
17701
- C.properties.symbolIndex = {
17711
+ }), f.instance_color && (C.HAS_INSTANCE_COLOR = 1), f.aTerrainAltitude && (C.HAS_INSTANCE_TERRAIN_ALTITUDE = 1,
17712
+ O.setUniform("terrainAltitudeScale", 100 * this.layer.getRenderer().getZScale())),
17713
+ C.HAS_LAYER_OPACITY = 1, Ne(O.properties, a.properties), O.properties.aPickingId = x,
17714
+ O.properties.nodeIndex = M, O.properties.pickingIdIndiceMap = _, O.setDefines(C),
17715
+ O.properties.symbolIndex = {
17702
17716
  index: e
17703
- }, C;
17717
+ }, O;
17704
17718
  }));
17705
- S.push(...P);
17719
+ S.push(...w);
17706
17720
  }
17707
17721
  return S.insContext = {
17708
17722
  instanceData: f,
@@ -17734,11 +17748,11 @@ const Rs = d.ShaderLib.get("mesh_picking_vert"), Fs = d.WgslShaderLib.get("mesh_
17734
17748
  const [i, r, o] = b;
17735
17749
  let s = e + a;
17736
17750
  d ? p.set(P, f[s], f[s + 1], d[s / a]) : Es.unpackPosition(P, f[s], f[s + 1], f[s + 2]);
17737
- const [h, O, k] = P, R = g[e / a], F = m.set(i * w, r * w, o * M), E = y.set(h * w, O * w, k * M), D = F.distanceTo(E);
17751
+ const [h, O, k] = P, R = g[e / a], F = m.set(i * w, r * w, o * M), E = y.set(h * w, O * w, k * M), H = F.distanceTo(E);
17738
17752
  this._getSymbolRotationScaleMatrix(C, n, g, e / a);
17739
- const H = u.arrangeAlongLine(F, E, D, l, 1, C, c);
17740
- for (let e = 0; e < H.length; e++) {
17741
- const t = H[e];
17753
+ const D = u.arrangeAlongLine(F, E, H, l, 1, C, c);
17754
+ for (let e = 0; e < D.length; e++) {
17755
+ const t = D[e];
17742
17756
  m.set(i, r, o), y.set(h, O, k);
17743
17757
  const n = qs(m, y, t.t);
17744
17758
  x.push(n.x, n.y), _.push(n.z), v.push(R), A.push(-t.rotationZ * Math.PI / 180),
@@ -17835,7 +17849,7 @@ const Rs = d.ShaderLib.get("mesh_picking_vert"), Fs = d.WgslShaderLib.get("mesh_
17835
17849
  const v = c && c[t] || 0, A = u && u[t] || 0;
17836
17850
  if (v || A) {
17837
17851
  g.fromRotation(k, A, F);
17838
- const e = p.set(Ds, Math.cos(A), Math.sin(A), 0), t = p.rotateZ(e, e, E, 90 * Math.PI / 180);
17852
+ const e = p.set(Hs, Math.cos(A), Math.sin(A), 0), t = p.rotateZ(e, e, E, 90 * Math.PI / 180);
17839
17853
  g.rotate(k, k, v, t), d && g.multiply(k, k, Vs);
17840
17854
  const n = g.fromTranslation($s, r);
17841
17855
  g.multiply(k, n, k);
@@ -17868,7 +17882,7 @@ const Rs = d.ShaderLib.get("mesh_picking_vert"), Fs = d.WgslShaderLib.get("mesh_
17868
17882
  const _ = n && n[r], v = t && t[_], A = i[s.id], T = A ? A.zoom : s.getZoom(), S = v && v.feature && v.feature.properties, b = this._getModelHeightScale(T, S);
17869
17883
  o || (this._txFn && (h = this._txFn(T, S)), this._tyFn && (c = this._tyFn(T, S)),
17870
17884
  this._tzFn && (u = this._tzFn(T, S)));
17871
- const P = p.set(Hs, h * l, c * l, u * l);
17885
+ const P = p.set(Ds, h * l, c * l, u * l);
17872
17886
  this._rxFn && (f = this._rxFn(T, S)), this._ryFn && (d = this._ryFn(T, S)), this._rzFn && (g = this._rzFn(T, S));
17873
17887
  const w = p.set(Ls, f, d, g);
17874
17888
  this._sxFn && (m = this._sxFn(T, S)), this._syFn && (y = this._syFn(T, S)), this._szFn && (x = this._szFn(T, S));
@@ -17960,7 +17974,7 @@ const Rs = d.ShaderLib.get("mesh_picking_vert"), Fs = d.WgslShaderLib.get("mesh_
17960
17974
  delete this._nodeMatrixMap;
17961
17975
  }
17962
17976
  _getGLTFMatrix(e, t, n, i) {
17963
- const r = p.set(Ds, ...t || Gs), o = n || Bs, s = i || Ws, a = T.fromEuler(Us, o[0], o[1], o[2]);
17977
+ const r = p.set(Hs, ...t || Gs), o = n || Bs, s = i || Ws, a = T.fromEuler(Us, o[0], o[1], o[2]);
17964
17978
  return g.fromRotationTranslationScale(e, a, r, s);
17965
17979
  }
17966
17980
  shouldDrawParentTile() {
@@ -18435,7 +18449,7 @@ class _a extends On {
18435
18449
  });
18436
18450
  if (!e || !ee(e.source)) return super.needToRedraw();
18437
18451
  const t = this.layer.getRenderer().getCurrentTiles();
18438
- if (!t || Ht(t)) return super.needToRedraw();
18452
+ if (!t || Dt(t)) return super.needToRedraw();
18439
18453
  return this._checkIfSourceUpdated() || super.needToRedraw();
18440
18454
  }
18441
18455
  _checkIfSourceUpdated() {
@@ -18790,57 +18804,57 @@ class Ta extends On {
18790
18804
  }
18791
18805
  }
18792
18806
 
18793
- const Sa = Dt("fill", ei);
18807
+ const Sa = Ht("fill", ei);
18794
18808
 
18795
18809
  Sa.registerAt(St);
18796
18810
 
18797
- const ba = Dt("line", oi);
18811
+ const ba = Ht("line", oi);
18798
18812
 
18799
18813
  ba.registerAt(St);
18800
18814
 
18801
- const Pa = Dt("line-gradient", yi);
18815
+ const Pa = Ht("line-gradient", yi);
18802
18816
 
18803
18817
  Pa.registerAt(St);
18804
18818
 
18805
- const wa = Dt("icon", to);
18819
+ const wa = Ht("icon", to);
18806
18820
 
18807
18821
  wa.registerAt(St);
18808
18822
 
18809
- const Ma = Dt("text", qo);
18823
+ const Ma = Ht("text", qo);
18810
18824
 
18811
18825
  Ma.registerAt(St);
18812
18826
 
18813
- const Ia = Dt("native-line", os);
18827
+ const Ia = Ht("native-line", os);
18814
18828
 
18815
18829
  Ia.registerAt(St);
18816
18830
 
18817
- Dt("native-point", ts).registerAt(St);
18831
+ Ht("native-point", ts).registerAt(St);
18818
18832
 
18819
- const Ca = Dt("phong", As);
18833
+ const Ca = Ht("phong", As);
18820
18834
 
18821
18835
  Ca.registerAt(St);
18822
18836
 
18823
- const Oa = Dt("wireframe", Ss);
18837
+ const Oa = Ht("wireframe", Ss);
18824
18838
 
18825
18839
  Oa.registerAt(St);
18826
18840
 
18827
- const ka = Dt("lit", Ms);
18841
+ const ka = Ht("lit", Ms);
18828
18842
 
18829
18843
  ka.registerAt(St);
18830
18844
 
18831
- const Ra = Dt("tube", ks);
18845
+ const Ra = Ht("tube", ks);
18832
18846
 
18833
18847
  Ra.registerAt(St);
18834
18848
 
18835
- const Fa = Dt("gltf-phong", Js);
18849
+ const Fa = Ht("gltf-phong", Js);
18836
18850
 
18837
18851
  Fa.registerAt(St);
18838
18852
 
18839
- const Ea = Dt("gltf-lit", Qs);
18853
+ const Ea = Ht("gltf-lit", Qs);
18840
18854
 
18841
18855
  Ea.registerAt(St);
18842
18856
 
18843
- const Da = Dt("heatmap", class extends On {
18857
+ const Ha = Ht("heatmap", class extends On {
18844
18858
  createFnTypeConfig(e, t) {
18845
18859
  const n = I(t.heatmapWeight), r = new Int16Array(1);
18846
18860
  return [ {
@@ -18904,17 +18918,17 @@ const Da = Dt("heatmap", class extends On {
18904
18918
  }
18905
18919
  });
18906
18920
 
18907
- Da.registerAt(St);
18921
+ Ha.registerAt(St);
18908
18922
 
18909
- const Ha = Dt("water", sa);
18923
+ const Da = Ht("water", sa);
18910
18924
 
18911
- Ha.registerAt(St);
18925
+ Da.registerAt(St);
18912
18926
 
18913
- const La = Dt("billboard", _a);
18927
+ const La = Ht("billboard", _a);
18914
18928
 
18915
18929
  La.registerAt(St);
18916
18930
 
18917
- const Na = Dt("terrain-flat-mask", Ta);
18931
+ const Na = Ht("terrain-flat-mask", Ta);
18918
18932
 
18919
18933
  Na.registerAt(St), kt.registerPainter("lit", Ms), kt.registerPainter("icon", to),
18920
18934
  kt.registerPainter("fill", ei), kt.registerPainter("line", oi), kt.registerPainter("line-gradient", yi),
@@ -19729,7 +19743,7 @@ class ol extends(m(Wa)){
19729
19743
  }
19730
19744
  onGeometryPropertiesChange(e) {
19731
19745
  const t = e.target._getParent() || e.target, n = t[fi];
19732
- void 0 !== n && this.painter && (this.features[n] = gi(t, this._kidGen), this._refreshFeatures(this.features[n], n),
19746
+ void 0 !== n && this.features[n] && (this.features[n] = gi(t, this._kidGen), this._refreshFeatures(this.features[n], n),
19733
19747
  this._markerMeshes && this._markerMeshes.length && this._markerPainter.needRebuildOnGometryPropertiesChanged() || this._lineMeshes && this._lineMeshes.length && this._linePainter.needRebuildOnGometryPropertiesChanged() || this.meshes && this.meshes.length && this.painter.needRebuildOnGometryPropertiesChanged() ? this.markRebuild() : this.meshes && this.painter.onFeatureChange(this.features[n], this.meshes),
19734
19748
  sl(this));
19735
19749
  }
@@ -20165,7 +20179,7 @@ function El(e, t, n, i, r) {
20165
20179
  var h, c, u, f;
20166
20180
  }
20167
20181
 
20168
- const {PackUtil: Dl, ArrayPool: Hl} = j();
20182
+ const {PackUtil: Hl, ArrayPool: Dl} = j();
20169
20183
 
20170
20184
  function Ll(e, t, n, i, r, o, s, a, l, h, c, u, f, d, p, g, m) {
20171
20185
  const y = t.getLength(), x = r / 3;
@@ -20230,7 +20244,7 @@ function Wl(e, t, n, i, r, o, s, a, l, h, c, u, f, d, p, g) {
20230
20244
  const {altitudeScale: m, altitudeProperty: y, defaultAltitude: x, heightProperty: _, minHeightProperty: v, defaultHeight: A, tangent: T, uv: S, topUVMode: b, sideUVMode: P, sideVerticalUVMode: w, top: O, side: k, textureYOrigin: R, topThickness: F} = t, E = !!g, U = function(e, t, {altitudeScale: n, altitudeProperty: i, defaultAltitude: r, heightProperty: o, minHeightProperty: s, defaultHeight: a}, {center: l, side: h, top: c, topThickness: u, uvOrigin: f, uv: d, uvSize: p, topUVMode: g, sideUVMode: m, sideVerticalUVMode: y, textureYOrigin: x, tileRatio: _, centimeterToPoint: v, verticalCentimeterToPoint: A, positionType: T, res: S, glScale: b, projectionCode: P}, w, M) {
20231
20245
  let I = t / e[0].extent;
20232
20246
  t === 1 / 0 && (I = 1);
20233
- const C = t === 1 / 0, O = M.get(), k = M.get(), R = M.get(), F = M.getProxy(), E = M.get(), D = M.get(), H = M.get(), N = !!d, z = !!c, V = !!h, U = N ? M.get() : null;
20247
+ const C = t === 1 / 0, O = M.get(), k = M.get(), R = M.get(), F = M.getProxy(), E = M.get(), H = M.get(), D = M.get(), N = !!d, z = !!c, V = !!h, U = N ? M.get() : null;
20234
20248
  function G(e, n, i, r, o, s) {
20235
20249
  let a = n;
20236
20250
  if (z) {
@@ -20244,18 +20258,18 @@ function Wl(e, t, n, i, r, o, s, a, l, h, c, u, f, d, p, g) {
20244
20258
  for (let n = 2, i = h.length; n < i; n += 3) t = h[n - 1], h[n - 1] = h[n] + e / 3,
20245
20259
  h[n] = t + e / 3, h[n - 2] += e / 3;
20246
20260
  }
20247
- c = h.length, d = D.currentIndex;
20248
- for (let e = 0; e < c; e++) D[d++] = h[e];
20249
- D.currentIndex = d, N && Rl(g || 0, e, n, U, E, f, v, _, p[0], p[1], o, S, b, P, l),
20250
- u > 0 && !V && (n = Ll(E, F, i, D, n, U, 0, u, t, N, m || 0, y || 0, x, p, _, A, r < 0 ? !s : s)),
20251
- H.setLength(n / 3), H.fill(1, a / 3, n / 3);
20261
+ c = h.length, d = H.currentIndex;
20262
+ for (let e = 0; e < c; e++) H[d++] = h[e];
20263
+ H.currentIndex = d, N && Rl(g || 0, e, n, U, E, f, v, _, p[0], p[1], o, S, b, P, l),
20264
+ u > 0 && !V && (n = Ll(E, F, i, H, n, U, 0, u, t, N, m || 0, y || 0, x, p, _, A, r < 0 ? !s : s)),
20265
+ D.setLength(n / 3), D.fill(1, a / 3, n / 3);
20252
20266
  }
20253
20267
  if (V) {
20254
- z && (u = 0), a = n, n = Ll(E, F, i, D, n, U, u, r, t, N, m || 0, y || 0, x, p, _, A, r < 0 ? !s : s),
20255
- H.setLength(n / 3);
20268
+ z && (u = 0), a = n, n = Ll(E, F, i, H, n, U, u, r, t, N, m || 0, y || 0, x, p, _, A, r < 0 ? !s : s),
20269
+ D.setLength(n / 3);
20256
20270
  const e = F.getLength() / 3;
20257
- H.fill(1, a / 3, a / 3 + e), H.fill(0, a / 3 + e, a / 3 + 2 * e), H.fill(1, a / 3 + 2 * e, a / 3 + 3 * e),
20258
- H.fill(0, a / 3 + 3 * e, n / 3);
20271
+ D.fill(1, a / 3, a / 3 + e), D.fill(0, a / 3 + e, a / 3 + 2 * e), D.fill(1, a / 3 + 2 * e, a / 3 + 3 * e),
20272
+ D.fill(0, a / 3 + 3 * e, n / 3);
20259
20273
  }
20260
20274
  return n;
20261
20275
  }
@@ -20271,19 +20285,19 @@ function Wl(e, t, n, i, r, o, s, a, l, h, c, u, f, d, p, g) {
20271
20285
  Q(h) && (Math.abs(h) > Z && (Z = Math.abs(h)), h < 0 && (q = !0));
20272
20286
  const c = l.geometry, u = l.properties[Ce];
20273
20287
  let f = Array.isArray(u && u[0] && u[0][0]) ? u[0] : u;
20274
- const {altitude: d, height: p} = Dl.getFeaAltitudeAndHeight(l, n, i, r, o, a, s);
20288
+ const {altitude: d, height: p} = Hl.getFeaAltitudeAndHeight(l, n, i, r, o, a, s);
20275
20289
  p < 0 ? (ee = !0, W = Math.min(d, W), B = Math.max(d - p, B)) : (B = Math.max(d, B),
20276
20290
  W = Math.min(d - p, W));
20277
20291
  const g = E.getLength();
20278
20292
  let m = 0, y = j;
20279
20293
  K.setLength(0), F.setLength(0);
20280
- const x = Dl.calculateSignedArea(c[0]) < 0;
20294
+ const x = Hl.calculateSignedArea(c[0]) < 0;
20281
20295
  for (let e = 0, n = c.length; e < n; e++) {
20282
20296
  let i = c[e];
20283
20297
  x && (i = i.reverse()), i = zl(i);
20284
- const r = Dl.calculateSignedArea(i) < 0;
20298
+ const r = Hl.calculateSignedArea(i) < 0;
20285
20299
  if (!r && e > 0 && (m++, f = u && u[m], j = G(y, j, K, p * I, f, C), F.setLength(0),
20286
- K.setLength(0), y = j), t !== 1 / 0 && (i = Dl.clipPolygon(i, X)), !i.length) {
20300
+ K.setLength(0), y = j), t !== 1 / 0 && (i = Hl.clipPolygon(i, X)), !i.length) {
20287
20301
  e === n - 1 && (j = G(y, j, K, p * I, f, C));
20288
20302
  continue;
20289
20303
  }
@@ -20302,20 +20316,20 @@ function Wl(e, t, n, i, r, o, s, a, l, h, c, u, f, d, p, g) {
20302
20316
  O.currentIndex = e, Q(h) && (e = R.currentIndex, R[e++] = h, R.currentIndex = e);
20303
20317
  }
20304
20318
  }
20305
- J = l ? Float32Array : Dl.getUnsignedArrayType(k.getLength() ? k[k.getLength() - 1] : 0);
20319
+ J = l ? Float32Array : Hl.getUnsignedArrayType(k.getLength() ? k[k.getLength() - 1] : 0);
20306
20320
  const te = {
20307
20321
  hasNegativeHeight: ee,
20308
20322
  maxAltitude: B === -1 / 0 ? 0 : B,
20309
20323
  minAltitude: W === 1 / 0 ? 0 : W,
20310
20324
  vertices: E,
20311
- verticeTypes: H,
20312
- indices: D,
20313
- pickingIds: Hl.createTypedArray(k, J),
20325
+ verticeTypes: D,
20326
+ indices: H,
20327
+ pickingIds: Dl.createTypedArray(k, J),
20314
20328
  featureIndexes: O
20315
20329
  };
20316
20330
  if (R.getLength()) {
20317
- const e = q ? Dl.getPosArrayType(Z) : Dl.getUnsignedArrayType(Z);
20318
- te.featureIds = Hl.createTypedArray(R, e);
20331
+ const e = q ? Hl.getPosArrayType(Z) : Hl.getUnsignedArrayType(Z);
20332
+ te.featureIds = Dl.createTypedArray(R, e);
20319
20333
  } else te.featureIds = [];
20320
20334
  return U && (U.setLength(E.getLength() / 3 * 2), te.uvs = U), te;
20321
20335
  }(e, n, {
@@ -20364,8 +20378,8 @@ function Wl(e, t, n, i, r, o, s, a, l, h, c, u, f, d, p, g) {
20364
20378
  const n = t.getLength(), i = new Float32Array(n), r = [], o = [], s = [];
20365
20379
  for (let a = 0; a < n; a += 4) {
20366
20380
  const n = a / 4 * 3;
20367
- D.set(o, e[n] || 0, e[n + 1] || 0, e[n + 2] || 0), H.set(r, t[a] || 0, t[a + 1] || 0, t[a + 2] || 0, t[a + 3] || 0),
20368
- V(s, o, r), H.copy(i.subarray(a, a + 4), s);
20381
+ H.set(o, e[n] || 0, e[n + 1] || 0, e[n + 2] || 0), D.set(r, t[a] || 0, t[a + 1] || 0, t[a + 2] || 0, t[a + 3] || 0),
20382
+ V(s, o, r), D.copy(i.subarray(a, a + 4), s);
20369
20383
  }
20370
20384
  return i;
20371
20385
  }(U.normals, e), U.tangents = e, G.push(e.buffer), delete U.normals;
@@ -20428,9 +20442,9 @@ function Wl(e, t, n, i, r, o, s, a, l, h, c, u, f, d, p, g) {
20428
20442
  y.$layer = m.layer, y.$type = m.type;
20429
20443
  let x = h ? c : u, _ = x(r, y);
20430
20444
  M(_) && (x = C(_), _ = x(r, y)), delete y.$layer, delete y.$type, Vl.normalizeColor(jl, _),
20431
- H.divide(jl, jl, l);
20445
+ D.divide(jl, jl, l);
20432
20446
  let v = Xl(o, jl);
20433
- v < 0 && (v = o.length, o.push(H.copy([], jl))), e[i] = v, h ? (f = t[i], p = v) : (d = t[i],
20447
+ v < 0 && (v = o.length, o.push(D.copy([], jl))), e[i] = v, h ? (f = t[i], p = v) : (d = t[i],
20434
20448
  g = v);
20435
20449
  }
20436
20450
  }
@@ -20466,7 +20480,7 @@ function Wl(e, t, n, i, r, o, s, a, l, h, c, u, f, d, p, g) {
20466
20480
  const jl = [];
20467
20481
 
20468
20482
  function Xl(e, t) {
20469
- for (let n = 0; n < e.length; n++) if (H.exactEquals(t, e[n])) return n;
20483
+ for (let n = 0; n < e.length; n++) if (D.exactEquals(t, e[n])) return n;
20470
20484
  return -1;
20471
20485
  }
20472
20486
 
@@ -20920,7 +20934,7 @@ Eh.registerJSONType("ExtrudePolygonLayer"), Eh.mergeOptions({
20920
20934
  castShadow: !0
20921
20935
  });
20922
20936
 
20923
- const Dh = {
20937
+ const Hh = {
20924
20938
  polygonFill: {
20925
20939
  type: "identity",
20926
20940
  default: [ 1, 1, 1, 1 ],
@@ -20941,7 +20955,7 @@ const Dh = {
20941
20955
  default: [ 1, 1, 1, 1 ],
20942
20956
  property: "_symbol_bottomPolygonFill"
20943
20957
  }
20944
- }, Hh = {
20958
+ }, Dh = {
20945
20959
  altitudeProperty: "height",
20946
20960
  minHeightProperty: "min_height",
20947
20961
  defaultAltitude: 20
@@ -20984,8 +20998,8 @@ class Nh extends Pl {
20984
20998
  }
20985
20999
  createPainter() {
20986
21000
  const e = kt.get3DPainterClass("lit");
20987
- this.painterSymbol = K({}, Dh), this.sidePainterSymbol = K({}, Dh), this._defineSymbolBloom(this.painterSymbol, e.getBloomSymbol(), "enablePolygonBloom");
20988
- const t = this.layer, n = K({}, Hh, t.options.dataConfig || {});
21001
+ this.painterSymbol = K({}, Hh), this.sidePainterSymbol = K({}, Hh), this._defineSymbolBloom(this.painterSymbol, e.getBloomSymbol(), "enablePolygonBloom");
21002
+ const t = this.layer, n = K({}, Dh, t.options.dataConfig || {});
20989
21003
  t.options.material && (this.painterSymbol.material = t.options.material), t.options.sideMaterial ? this.sidePainterSymbol.material = t.options.sideMaterial : this.sidePainterSymbol.material = t.options.material;
20990
21004
  const i = {
20991
21005
  cullFace: t.options.cullFace
@@ -21037,8 +21051,8 @@ class Nh extends Pl {
21037
21051
  }
21038
21052
  _createPackData(e, t, n, o) {
21039
21053
  const s = this.getMap();
21040
- t = Dh;
21041
- const l = this._extrudeCenter, h = 1 / 0, c = i[s.id], u = c ? c.zoom : s.getZoom(), f = new a(0, 0), d = new r(0, 0), p = K({}, Hh, this.layer.options.dataConfig);
21054
+ t = Hh;
21055
+ const l = this._extrudeCenter, h = 1 / 0, c = i[s.id], u = c ? c.zoom : s.getZoom(), f = new a(0, 0), d = new r(0, 0), p = K({}, Dh, this.layer.options.dataConfig);
21042
21056
  if (p.uv = !0, p.top && (p.top = n), p.side && (p.side = o), !1 === p.top && !1 === p.side) return null;
21043
21057
  if (!e.length) return null;
21044
21058
  const g = s.getGLRes(), m = s.getProjection().code, y = n ? this.painterSymbol && this.painterSymbol.material : this.sidePainterSymbol && this.sidePainterSymbol.material, x = y && y.textureWidth || Fh, _ = [ et(s, 1, d, g) / 100, et(s, 1, d, g, 1) / 100 ];
@@ -21116,7 +21130,7 @@ if (f.transcoders) {
21116
21130
  }));
21117
21131
  } else e.registerWorkerAdapter("@maptalks/vt", Bh);
21118
21132
 
21119
- export { _a as BillBoardPainter, La as BillBoardPlugin, Eh as ExtrudePolygonLayer, ei as FillPainter, Sa as FillPlugin, Vh as FilterUtil, Fa as GLTFPhongPlugin, Ea as GLTFStandardPlugin, Ua as GeoJSONVectorTileLayer, Da as HeatmapPlugin, to as IconPainter, wa as IconPlugin, Pa as LineGradientPlugin, oi as LinePainter, ba as LinePlugin, _l as LineStringLayer, ka as LitPlugin, za as MapboxVectorTileLayer, os as NativeLinePainter, Ia as NativeLinePlugin, ts as NativePointPainter, zh as PackUtil, As as PhongPainter, Ca as PhongPlugin, ml as PointLayer, yl as PointLayerRenderer, Sl as PolygonLayer, Gh as SYMBOLS_NEED_REBUILD_IN_VECTOR, Uh as SYMBOLS_NEED_REBUILD_IN_VT, Ta as TerrainFlatMaskPainter, Na as TerrainFlatMaskPlugin, qo as TextPainter, Ma as TextPlugin, Ra as TubePlugin, kt as Vector3DLayer, St as VectorTileLayer, ct as VectorTileLayerRenderer, Ha as WaterPlugin, Ss as WireframePainter, Oa as WireframePlugin, j as getVectorPacker };
21133
+ export { _a as BillBoardPainter, La as BillBoardPlugin, Eh as ExtrudePolygonLayer, ei as FillPainter, Sa as FillPlugin, Vh as FilterUtil, Fa as GLTFPhongPlugin, Ea as GLTFStandardPlugin, Ua as GeoJSONVectorTileLayer, Ha as HeatmapPlugin, to as IconPainter, wa as IconPlugin, Pa as LineGradientPlugin, oi as LinePainter, ba as LinePlugin, _l as LineStringLayer, ka as LitPlugin, za as MapboxVectorTileLayer, os as NativeLinePainter, Ia as NativeLinePlugin, ts as NativePointPainter, zh as PackUtil, As as PhongPainter, Ca as PhongPlugin, ml as PointLayer, yl as PointLayerRenderer, Sl as PolygonLayer, Gh as SYMBOLS_NEED_REBUILD_IN_VECTOR, Uh as SYMBOLS_NEED_REBUILD_IN_VT, Ta as TerrainFlatMaskPainter, Na as TerrainFlatMaskPlugin, qo as TextPainter, Ma as TextPlugin, Ra as TubePlugin, kt as Vector3DLayer, St as VectorTileLayer, ct as VectorTileLayerRenderer, Da as WaterPlugin, Ss as WireframePainter, Oa as WireframePlugin, j as getVectorPacker };
21120
21134
 
21121
- "undefined" != typeof console && console.log("@maptalks/vt v0.118.1");
21135
+ "undefined" != typeof console && console.log("@maptalks/vt v0.119.0");
21122
21136
  //# sourceMappingURL=maptalks.vt.es.js.map