@maptalks/vt 0.103.0 → 0.103.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/maptalks.vt.d.ts +1 -1
- package/dist/maptalks.vt.es.js +3 -3
- package/dist/maptalks.vt.js +3 -3
- package/package.json +1 -1
package/dist/maptalks.vt.d.ts
CHANGED
package/dist/maptalks.vt.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @maptalks/vt v0.103.
|
|
2
|
+
* @maptalks/vt v0.103.1
|
|
3
3
|
* LICENSE : undefined
|
|
4
4
|
* (c) 2016-2024 maptalks.org
|
|
5
5
|
*/
|
|
@@ -31,7 +31,7 @@ import { buildNormals as I, buildTangents as k, packTangentFrame as F } from "@m
|
|
|
31
31
|
|
|
32
32
|
import C from "rbush";
|
|
33
33
|
|
|
34
|
-
const E = "${", R = `function(t){let n;const e={width:100,height:10};let i=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),i=!0}catch(t){i=!1}function r(){if(!n){const{width:t,height:r}=e;i?n=new OffscreenCanvas(t,r):(n=document.createElement("canvas"),n.width=t,n.height=r)}return n}class o{constructor(t,n={}){if(!Array.isArray(t))return void console.error("colors is not array");if(t.length<2)return void console.error("colors.length should >1");this.colors=t;let i=1/0,r=-1/0;for(let n=0,e=t.length;n<e;n++){const e=t[n][0];i=Math.min(e,i),r=Math.max(e,r)}this.min=i,this.max=r,this.valueOffset=this.max-this.min,this.options=Object.assign({},e,n),this.t()}getImageData(){return this.imgData}t(){const t=r(),{width:n,height:e}=this.options;t.width=n,t.height=e;const i=t.getContext("2d");i.clearRect(0,0,t.width,t.height);const o=i.createLinearGradient(0,0,t.width,0),{colors:s,valueOffset:u}=this;for(let t=0,n=s.length;t<n;t++){const[n,e]=s[t],i=(n-this.min)/u;o.addColorStop(i,e)}i.fillStyle=o,i.fillRect(0,0,t.width,t.height),this.imgData=i.getImageData(0,0,t.width,t.height)}getColor(t){t=Math.max(this.min,t);const n=((t=Math.min(t,this.max))-this.min)/this.valueOffset;let e=Math.round(n*this.imgData.width);e=Math.min(e,this.imgData.width-1);const i=4*e;return[this.imgData.data[i],this.imgData.data[i+1],this.imgData.data[i+2],this.imgData.data[i+3]]}}var s;function u(t,n){var e,i,r;if(M(t)){var o,s=t.stops&&"object"==typeof t.stops[0][0],l=s||void 0!==t.property,y=s||!l,p=t.type||n||"exponential";if("exponential"===p)o=a;else if("interval"===p)o=f;else if("categorical"===p)o=c;else if("identity"===p)o=d;else if("color-interpolate"===p)o=h;else{if("calculate-expression"!==p)throw new Error('Unknown function type "'+p+'"');o=v}if(s){var w={},m=[];for(let n=0;n<t.stops.length;n++){var g=t.stops[n];void 0===w[g[0].zoom]&&(w[g[0].zoom]={zoom:g[0].zoom,type:t.type,property:t.property,default:t.default,stops:[]}),w[g[0].zoom].stops.push([g[0].value,g[1]])}for(let t in w)m.push([w[t].zoom,u(w[t])]);e=function(n,e){const i=a({stops:m,base:t.base},n)(n,e);return"function"==typeof i?i(n,e):i},i=!1,r=!1}else y?(e=function(n){const e=o(t,n);return"function"==typeof e?e(n):e},i=!0,r=!1):(e=function(n,e){const i=o(t,e?e[t.property]:null);return"function"==typeof i?i(n,e):i},i=!1,r=!0)}else e=function(){return t},i=!0,r=!0;return e.isZoomConstant=r,e.isFeatureConstant=i,e}function c(t,n){for(let e=0;e<t.stops.length;e++)if(n===t.stops[e][0])return t.stops[e][1];return t.default}function f(t,n){for(var e=0;e<t.stops.length&&!(n<t.stops[e][0]);e++);return t.stops[Math.max(e-1,0)][1]}function a(t,n){for(var e=void 0!==t.base?t.base:1,i=0;!(i>=t.stops.length||n<=t.stops[i][0]);)i++;return 0===i?t.stops[i][1]:i===t.stops.length?t.stops[i-1][1]:y(n,e,t.stops[i-1][0],t.stops[i][0],t.stops[i-1][1],t.stops[i][1])}"function"==typeof Map&&(s=new Map);const l={width:100,height:1};function h(t,n){const e=t.stops;if(e&&e.length>1){let t;if(s){const n=JSON.stringify(e);if(!s.has(n)){const t=new o(e,l);s.set(n,t)}t=s.get(n)}else t=new o(e,l);const[i,r,u,c]=t.getColor(n);return[i/255,r/255,u/255,c/255]}return e&&1===e.length?e[0][1]:null}function d(t,n){return e=n,i=t.default,void 0!==e?e:void 0!==i?i:null;var e,i}function v(t,n){const e=String(t.property),i=t.expression,r=n;function o(n){return null==n||""===n||isNaN(n)?t.default:n}if(null==n||""===n||isNaN(n)||n<0)return o(t.default);{const n=function t(n,e,i){const r=Number(i),o=String(e);return Array.isArray(n)?n.map((n=>t(n,o,r))):n===o?r:n}(i,e,r);return o(function n(e){if(!Array.isArray(e)){if("number"==typeof e)return e;throw new Error("Invalid expression format")}{const i=e[0];if(!["+","-","*","/"].includes(i))throw new Error(\`Unknown operator: ${E}i}\`);const r=e.slice(1).map((t=>n(t)));switch(i){case"+":return r.reduce(((t,n)=>t+n),0);case"-":return r.reduce(((t,n)=>t-n));case"*":return r.reduce(((t,n)=>t*n),1);case"/":return r.some((t=>0===t))?t.default:r.reduce(((t,n)=>t/n));default:throw new Error(\`Unsupported operator: ${E}i}\`)}}}(n))}}function y(t,n,e,i,r,o){return"function"==typeof r?function(){var s=r.apply(void 0,arguments),u=o.apply(void 0,arguments);return y(t,n,e,i,s,u)}:r.length?function(t,n,e,i,r,o){var s=[];for(let u=0;u<r.length;u++)s[u]=p(t,n,e,i,r[u],o[u]);return s}(t,n,e,i,r,o):p(t,n,e,i,r,o)}function p(t,n,e,i,r,o){var s,u=i-e,c=t-e;return r*(1-(s=1===n?c/u:(Math.pow(n,c)-1)/(Math.pow(n,u)-1)))+o*s}function M(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type||t.expression&&"calculate-expression"===t.type)}function w(t){return m(t,"interval")}function m(t,n){if(!M(t))return function(){return t};let e=!0,i=!0;const r=(t=JSON.parse(JSON.stringify(t))).stops;if(r)for(let t=0;t<r.length;t++)if(M(r[t][1])){const o=m(r[t][1],n);e=e&&o.isZoomConstant,i=i&&o.isFeatureConstant,r[t]=[r[t][0],o]}const o=u(t,n);return o.isZoomConstant=e&&o.isZoomConstant,o.isFeatureConstant=i&&o.isFeatureConstant,o}let g=0;const P="function"==typeof Object.assign;function x(t,...n){if(P)return Object.assign(t,...n),t;for(let e=0;e<n.length;e++){const i=n[e];for(const n in i)t[n]=i[n]}return t}function b(t){return!k(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function S(t){return"number"==typeof t&&!isNaN(t)}function F(t){return!k(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function A(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function k(t){return null==t}function T(t){return M(t)&&t.property}const _="function"==typeof fetch&&"function"==typeof AbortController,I={jsonp:function(t,n){const e="_maptalks_jsonp_"+g++;t.match(/\\?/)?t+="&callback="+e:t+="?callback="+e;let i=document.createElement("script");return i.type="text/javascript",i.src=t,window[e]=function(t){n(null,t),document.getElementsByTagName("head")[0].removeChild(i),i=null,delete window[e]},document.getElementsByTagName("head")[0].appendChild(i),this},get:function(t,n,e){if(F(n)){const t=e;e=n,n=t}(n=n||{}).method&&(n.method=n.method.toUpperCase());const i="POST"===n.method;if(_){const i=new AbortController,r=n;r.signal=i.signal,r.referrerPolicy=r.referrerPolicy||"origin",r.method=r.method||"GET";const o=new Request(t,r);return n.returnJSON&&o.headers.set("Accept","application/json"),fetch(o).then((i=>{const r=this.o(i,n.returnJSON,n.responseType);r.message?(r.url=t,e(r)):r.then((t=>{"arraybuffer"===n.responseType?e(null,{data:t,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),contentType:i.headers.get("Content-Type")}):e(null,t)})).catch((n=>{n.code&&n.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,n),e(n))}))})).catch((n=>{n.code&&n.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,n),e(n))})),i}{const r=I.u(e);if(r.open(n.method||"GET",t,!0),n){for(const t in n.headers)r.setRequestHeader(t,n.headers[t]);r.withCredentials="include"===n.credentials,n.responseType&&(r.responseType=n.responseType)}return r.send(i?n.body:null),r}},o:(t,n,e)=>200!==t.status?{status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${E}t.status}): ${E}t.statusText}\`}:"arraybuffer"===e?t.arrayBuffer():n?t.json():t.text(),l:function(t,n){return function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?n({status:200,statusText:t.statusText,message:"http status 200 returned without content."}):n(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else n(null,t.responseText);else n({status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${E}t.status}): ${E}t.statusText}\`})}},u:function(t){let n;try{n=new XMLHttpRequest}catch(t){try{n=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{n=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}return n.onreadystatechange=I.l(n,t),n},getArrayBuffer(t,n,e){if(F(n)){const t=e;e=n,n=t}return n||(n={}),n.responseType="arraybuffer",I.get(t,n,e)}};function O(t,n,e,i,r=3){let o=i;const s=e-n>>1;let u,c=e-n;const f=t[n],a=t[n+1],l=t[e],h=t[e+1];for(let i=n+r;i<e;i+=r){const n=N(t[i],t[i+1],f,a,l,h);if(n>o)u=i,o=n;else if(n===o){const t=Math.abs(i-s);t<c&&(u=i,c=t)}}o>i&&(u-n>r&&O(t,n,u,i,r),t[u+2]=o,e-u>r&&O(t,u,e,i,r))}function N(t,n,e,i,r,o){let s=r-e,u=o-i;if(0!==s||0!==u){const c=((t-e)*s+(n-i)*u)/(s*s+u*u);c>1?(e=r,i=o):c>0&&(e+=s*c,i+=u*c)}return s=t-e,u=n-i,s*s+u*u}function C(t,n,e,i,r,o){const s={id:null==t?null:t,type:n,geometry:e,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};r&&(s.layer=r);return function(t,n){const e=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)L(t,e,n);else if("Polygon"===i)L(t,e[0],n);else if("MultiLineString"===i)for(const i of e)L(t,i,n);else if("MultiPolygon"===i)for(const i of e)L(t,i[0],n)}(s,o?4:3),s}function L(t,n,e){for(let i=0;i<n.length;i+=e)t.minX=Math.min(t.minX,n[i]),t.minY=Math.min(t.minY,n[i+1]),t.maxX=Math.max(t.maxX,n[i]),t.maxY=Math.max(t.maxY,n[i+1])}function E(t,n,e,i){if(i.layer=n,"FeatureCollection"===e.type)for(let n=0;n<e.features.length;n++)U(t,e.features[n],i,n);else"Feature"===e.type?U(t,e,i):U(t,{geometry:e},i)}function U(t,n,e,i){if(!n.geometry)return;const r=n.geometry.coordinates,o=n.geometry.type,s=Math.pow(e.tolerance/((1<<e.maxZoom)*e.extent),2);let u=[],c=n.id;if(e.promoteId?c=n.properties[e.promoteId]:e.generateId&&(c=i||0),"Point"===o)$(r,u,e);else if("MultiPoint"===o)for(const t of r)$(t,u,e);else if("LineString"===o)j(r,u,s,!1,e);else if("MultiLineString"===o){if(e.lineMetrics){for(const i of r)u=[],j(i,u,s,!1,e),t.push(C(c,"LineString",u,n.properties,e.layer,e.hasAltitude));return}B(r,u,s,!1,e)}else if("Polygon"===o)B(r,u,s,!0,e);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const r of n.geometry.geometries)U(t,{id:c,geometry:r,properties:n.properties},e,i);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const t of r){const n=[];B(t,n,s,!0,e),u.push(n)}}t.push(C(c,o,u,n.properties,e.layer,e.hasAltitude))}function $(t,n,e){n.push(V(t[0]),G(t[1],e.projection),0),e.hasAltitude&&(t.length>2?n.push(t[2]):n.push(0))}function j(t,n,e,i,r){let o,s,u=0;for(let e=0;e<t.length;e++){const c=V(t[e][0]),f=G(t[e][1],r.projection);n.push(c,f,0),r.hasAltitude&&(t[e].length>2?n.push(t[e][2]):n.push(0)),e>0&&(u+=i?(o*f-c*s)/2:Math.sqrt(Math.pow(c-o,2)+Math.pow(f-s,2))),o=c,s=f}const c=r.hasAltitude?4:3,f=n.length-c;n[2]=1,O(n,0,f,e,c),n[f+2]=1,n.size=Math.abs(u),n.start=0,n.end=n.size}function B(t,n,e,i,r){for(let o=0;o<t.length;o++){const s=[];j(t[o],s,e,i,r),n.push(s)}}function V(t){return t/360+.5}function G(t,n){if("EPSG:4326"===n)return(90-t)/360;const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function D(t,n,e,i,r,o,s,u){if(i/=n,o>=(e/=n)&&s<i)return t;if(s<e||o>=i)return null;const c=[];for(const n of t){const t=n.geometry;let o=n.type;const s=0===r?n.minX:n.minY,f=0===r?n.maxX:n.maxY;if(s>=e&&f<i){c.push(n);continue}if(f<e||s>=i)continue;let a=[];if("Point"===o||"MultiPoint"===o)X(t,a,e,i,r,u.hasAltitude);else if("LineString"===o)z(t,a,e,i,r,!1,u.lineMetrics,u.hasAltitude);else if("MultiLineString"===o)Y(t,a,e,i,r,!1,u.hasAltitude);else if("Polygon"===o)Y(t,a,e,i,r,!0,u.hasAltitude);else if("MultiPolygon"===o)for(const n of t){const t=[];Y(n,t,e,i,r,!0,u.hasAltitude),t.length&&a.push(t)}if(a.length){if(u.lineMetrics&&"LineString"===o){for(const t of a)c.push(C(n.id,o,t,n.tags,n.layer,u.hasAltitude));continue}"LineString"!==o&&"MultiLineString"!==o||(1===a.length?(o="LineString",a=a[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===a.length?"Point":"MultiPoint"),c.push(C(n.id,o,a,n.tags,n.layer,u.hasAltitude))}}return c.length?c:null}function X(t,n,e,i,r,o){const s=o?4:3;for(let u=0;u<t.length;u+=s){const s=t[u+r];s>=e&&s<=i&&(q(n,t[u],t[u+1],t[u+2]),o&&n.push(t[u+3]))}}function z(t,n,e,i,r,o,s,u){let c=J(t);const f=0===r?R:H;let a,l,h=t.start;const d=u?4:3,v=o?t.length:t.length-d;for(let y=0;y<v;y+=d){const p=t[y],M=t[y+1],w=t[y+2];let m,g,P,x;o&&y===v-d?(m=t[0],g=t[1]):(m=t[y+d],g=t[y+d+1]),u&&(P=t[y+3],x=o&&y===v-d?t[3]:t[y+d+3]);const b=0===r?p:M,S=0===r?m:g;let F=!1;s&&(a=Math.sqrt(Math.pow(p-m,2)+Math.pow(M-g,2))),b<e?S>e&&(l=f(c,p,M,m,g,e),u&&c.push(Z(P,x,l)),s&&(c.start=h+a*l)):b>i?S<i&&(l=f(c,p,M,m,g,i),u&&c.push(Z(P,x,l)),s&&(c.start=h+a*l)):(q(c,p,M,w),u&&c.push(P)),S<e&&b>=e&&(l=f(c,p,M,m,g,e),u&&c.push(Z(P,x,l)),F=!0),S>i&&b<=i&&(l=f(c,p,M,m,g,i),u&&c.push(Z(P,x,l)),F=!0),!o&&F&&(s&&(c.end=h+a*l),n.push(c),c=J(t)),s&&(h+=a)}let y=t.length-d;if(!o){const n=t[y],o=t[y+1],s=t[y+2],f=0===r?n:o;if(f>=e&&f<=i&&q(c,n,o,s),f>=e&&f<=i&&u){const n=t[y+3];c.push(n)}}y=c.length-d,o&&y>=d&&(c[y]!==c[0]||c[y+1]!==c[1])&&(q(c,c[0],c[1],c[2]),u&&c.push(c[3])),c.length&&n.push(c)}function J(t){const n=[];return n.size=t.size,n.start=t.start,n.end=t.end,n}function Y(t,n,e,i,r,o,s){for(const u of t)z(u,n,e,i,r,o,!1,s)}function q(t,n,e,i){t.push(n,e,i)}function R(t,n,e,i,r,o){const s=(o-n)/(i-n);return q(t,o,e+(r-e)*s,1),s}function H(t,n,e,i,r,o){const s=(o-e)/(r-e);return q(t,n+(i-n)*s,o,1),s}function Z(t,n,e){return t+(n-t)*e}function W(t,n,e){const i=[];for(let r=0;r<t.length;r++){const o=t[r],s=o.type;let u;if("Point"===s||"MultiPoint"===s||"LineString"===s)u=K(o.geometry,n,e);else if("MultiLineString"===s||"Polygon"===s){u=[];for(const t of o.geometry)u.push(K(t,n,e))}else if("MultiPolygon"===s){u=[];for(const t of o.geometry){const i=[];for(const r of t)i.push(K(r,n,e));u.push(i)}}i.push(C(o.id,s,u,o.tags,o.layer,e))}return i}function K(t,n,e){const i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);const r=e?4:3;for(let o=0;o<t.length;o+=r)i.push(t[o]+n,t[o+1],t[o+2]),e&&i.push(t[o+3]);return i}function Q(t,n,e){if(t.transformed)return t;const i=1<<t.z,r=t.x,o=t.y,s=e?3:2;for(const u of t.features){const t=u.geometry,c=u.type;if(u.geometry=[],1===c)for(let c=0;c<t.length;c+=s)u.geometry.push(tt(t[c],t[c+1],n,i,r,o)),e&&u.geometry[u.geometry.length-1].push(t[c+2]);else for(let c=0;c<t.length;c++){const f=[];for(let u=0;u<t[c].length;u+=s)f.push(tt(t[c][u],t[c][u+1],n,i,r,o)),e&&f[f.length-1].push(t[c][u+2]);u.geometry.push(f)}}return t.transformed=!0,t}function tt(t,n,e,i,r,o){return[Math.round(e*(t*i-r)),Math.round(e*(n*i-o))]}function nt(t,n,e,i,r){const o=n===r.maxZoom?0:r.tolerance/((1<<n)*r.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:e,y:i,z:n,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const n of t)et(s,n,o,r);return s}function et(t,n,e,i){const r=n.geometry,o=n.type,s=[],u=i.hasAltitude?4:3;if(t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),"Point"===o||"MultiPoint"===o)for(let n=0;n<r.length;n+=u)s.push(r[n],r[n+1]),i.hasAltitude&&s.push(r[n+3]),t.numPoints++,t.numSimplified++;else if("LineString"===o)rt(s,r,t,e,!1,!1,i);else if("MultiLineString"===o||"Polygon"===o)for(let n=0;n<r.length;n++)rt(s,r[n],t,e,"Polygon"===o,0===n,i);else if("MultiPolygon"===o)for(let n=0;n<r.length;n++){const o=r[n];for(let n=0;n<o.length;n++)rt(s,o[n],t,e,!0,0===n,i)}if(s.length){let e=n.tags||null;if("LineString"===o&&i.lineMetrics){e={};for(const t in n.tags)e[t]=n.tags[t];e.mapbox_clip_start=r.start/r.size,e.mapbox_clip_end=r.end/r.size}const u={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:e};n.layer&&(u.layer=n.layer),null!==n.id&&(u.id=n.id),t.features.push(u)}}function it(t,n,e){return 0===t[n+2]&&t[n+3]>0&&e}function rt(t,n,e,i,r,o,s){const u=i*i,{hasAltitude:c,disableFilter:f}=s,a=c?4:3;if(!f&&i>0&&n.size<(r?u:i))return void(e.numPoints+=n.length/a);const l=[];for(let t=0;t<n.length;t+=a)(0===i||n[t+2]>u||it(n,t,c))&&(e.numSimplified++,l.push(n[t],n[t+1]),c&&l.push(n[t+3])),e.numPoints++;r&&function(t,n,e){const i=e?3:2;let r=0;for(let n=0,e=t.length,o=e-i;n<e;o=n,n+=i)r+=(t[n]-t[o])*(t[n+1]+t[o+1]);if(r>0===n){const n=i,r=i-1,o=i-2;for(let s=0,u=t.length;s<u/2;s+=i){const i=t[s],c=t[s+1];let f;e&&(f=t[s+2]),t[s]=t[u-n-s],t[s+1]=t[u-r-s],e&&(t[s+2]=t[u-o-s]),t[u-n-s]=i,t[u-r-s]=c,e&&(t[u-o-s]=f)}}}(l,o,c),t.push(l)}I.getJSON=function(t,n,e){if(F(n)){const t=e;e=n,n=t}const i=function(t,n){const i="string"==typeof n?JSON.parse(n):n||null;e(t,i)};return n&&n.jsonp?I.jsonp(t,i):((n=n||{}).returnJSON=!0,I.get(t,n,i))};const ot={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 st{constructor(t,n){const e=(n=this.options=function(t,n){for(const e in n)t[e]=n[e];return t}(Object.create(ot),n)).debug;if(e&&console.time("preprocess data"),n.maxZoom<0||n.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(n.promoteId&&n.generateId)throw new Error("promoteId and generateId cannot be used together.");let i=function(t,n){const e=[];if(Array.isArray(t)){for(let i=0;i<t.length;i++)E(e,t[i].layer,t[i].data,n);return e}if("FeatureCollection"===t.type)for(let i=0;i<t.features.length;i++)U(e,t.features[i],n,i);else"Feature"===t.type?U(e,t,n):U(e,{geometry:t},n);return e}(t,n);this.tiles={},this.tileCoords=[],e&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",n.indexMaxZoom,n.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=function(t,n){const e=n.buffer/n.extent;let i=t;const r=D(t,1,-1-e,e,0,-1,2,n),o=D(t,1,1-e,2+e,0,-1,2,n);return(r||o)&&(i=D(t,1,-e,1+e,0,-1,2,n)||[],r&&(i=W(r,1,n.hasAltitude).concat(i)),o&&(i=i.concat(W(o,-1,n.hasAltitude)))),i}(i,n),i.length&&this.splitTile(i,0,0,0),e&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(t,n,e,i,r,o,s){const u=[t,n,e,i],c=this.options,f=c.debug;for(;u.length;){i=u.pop(),e=u.pop(),n=u.pop(),t=u.pop();const a=1<<n,l=ut(n,e,i);let h=this.tiles[l];if(!h&&(f>1&&console.time("creation"),h=this.tiles[l]=nt(t,n,e,i,c),this.tileCoords.push({z:n,x:e,y:i}),f)){f>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,e,i,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));const t=\`z${E}n}\`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(h.source=t,null==r){if(n===c.indexMaxZoom||h.numPoints<=c.indexMaxPoints)continue}else{if(n===c.maxZoom||n===r)continue;if(null!=r){const t=r-n;if(e!==o>>t||i!==s>>t)continue}}if(h.source=null,0===t.length)continue;f>1&&console.time("clipping");const d=.5*c.buffer/c.extent,v=.5-d,y=.5+d,p=1+d;let M=null,w=null,m=null,g=null,P=D(t,a,e-d,e+y,0,h.minX,h.maxX,c),x=D(t,a,e+v,e+p,0,h.minX,h.maxX,c);t=null,P&&(M=D(P,a,i-d,i+y,1,h.minY,h.maxY,c),w=D(P,a,i+v,i+p,1,h.minY,h.maxY,c),P=null),x&&(m=D(x,a,i-d,i+y,1,h.minY,h.maxY,c),g=D(x,a,i+v,i+p,1,h.minY,h.maxY,c),x=null),f>1&&console.timeEnd("clipping"),u.push(M||[],n+1,2*e,2*i),u.push(w||[],n+1,2*e,2*i+1),u.push(m||[],n+1,2*e+1,2*i),u.push(g||[],n+1,2*e+1,2*i+1)}}getTile(t,n,e){t=+t,n=+n,e=+e;const i=this.options,{extent:r,debug:o}=i,{hasAltitude:s,wrapX:u}=i;if(t<0||t>24)return null;if(u){const e=1<<t;n=n+e&e-1}const c=ut(t,n,e);if(this.tiles[c])return Q(this.tiles[c],r,s);o>1&&console.log("drilling down to z%d-%d-%d",t,n,e);let f,a=t,l=n,h=e;for(;!f&&a>0;)a--,l>>=1,h>>=1,f=this.tiles[ut(a,l,h)];return f&&f.source?(o>1&&(console.log("found parent tile z%d-%d-%d",a,l,h),console.time("drilling down")),this.splitTile(f.source,a,l,h,t,n,e),o>1&&console.timeEnd("drilling down"),this.tiles[c]?Q(this.tiles[c],r,s):null):null}}function ut(t,n,e){return 32*((1<<t)*e+n)+t}function ct(t,n,e,i,r,o,s){const u=e&&Array.isArray(e[0]);for(let c=0,f=e.length;c<f;c++){t[n]=(u?e[c][0]:e[c].x)*i,t[n+1]=(u?e[c][1]:e[c].y)*i,s!==Float32Array&&(t[n]=Math.round(t[n]),t[n+1]=Math.round(t[n+1]));let a=r||0;Array.isArray(r)&&(a=r[c]),a=a?Math.round(i*a):0,t[n+2]=a,n+=3,o&&0!==c&&c!==f-1&&(t[n]=t[n-3],t[n+1]=t[n-2],t[n+2]=t[n-1],n+=3)}return t.trySetLength&&t.trySetLength(n),n}function ft(t,n,e,i){const r=t[3*n],o=t[3*n+1],s=t[3*e],u=t[3*e+1];return r===s&&(r<0||r>i)||o===u&&(o<0||o>i)}var at="undefined"!=typeof Float32Array?Float32Array:Array;function lt(t,n,e,i){return t[0]=n,t[1]=e,t[2]=i,t}function ht(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function dt(t,n,e,i,r){return t[0]=n,t[1]=e,t[2]=i,t[3]=r,t}function vt(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t[3]=n[3]/e[3],t}function yt(t,n,e){return t[0]=n,t[1]=e,t}function pt(t,n){var e=n[0]-t[0],i=n[1]-t[1];return Math.hypot(e,i)}Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)}),function(){var t,n=(t=new at(3),at!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t)}(),function(){var t,n=(t=new at(4),at!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}(),function(){var t,n=(t=new at(2),at!=Float32Array&&(t[0]=0,t[1]=0),t)}();const Mt=Math.PI/180,wt=6378137*Math.PI/180,mt=85.0511287798;function gt(t,n,e){if("EPSG:3857"===e)return function(t,n){const e=mt,i=n[0],r=Math.max(Math.min(e,n[1]),-e);let o;o=0===r?0:Math.log(Math.tan((90+r)*Mt/2))/Mt;return t[0]=i*wt,t[1]=o*wt,t}(t,n);if("EPSG:4326"===e||"EPSG:4490"===e||"identity"===e)return Pt(t,n);if("baidu"===e)return Pt(t,n);throw new Error("unsupported projection:"+e)}function Pt(t,n){return t[0]=n[0],t[1]=n[1],t}function xt(t,n,e,i,r,o,s,u,c,f,a,l,h,d,v){0===t?function(t,n,e,i,r,o,s,u,c,f){const a=1/(100*o[0]),l=1/(100*o[1]),h=f&&f[0]||0,d=f&&f[1]||0,v=[0,0];for(let r=t;r<n;r+=3){const t=r/3*2,n=i[r]-h,o=i[r+1]-d;e[t]=v[0]+n/s*a/u,e[t+1]=v[1]-o/s*l/c}}(n,e,i,r,0,s,u,c,f,v):1===t&&function(t,n,e,i,r,o,s,u,c,f,a){if(!t)return;let l,h,d,v;0===t[4]?(l=t[0],h=t[1],d=t[2],v=t[3]):(l=t[1],h=t[2],d=t[3],v=t[0]);const y=pt(l,h),p=pt(h,d),M=[],w=[],m=[];for(let t=n;t<e;t+=3){const n=t/3*2;yt(M,(o.x/c+r[t]/s)*u,o.y/c*u+(a?r[t+1]:-r[t+1])/s*u),"EPSG:4326"!==f&&"EPSG:4490"!==f||gt(M,M,"EPSG:3857"),bt(w,M,l,h),bt(m,M,v,l),i[n]=pt(l,w)/y,i[n+1]=pt(l,m)/p}}(a,n,e,i,r,o,u,l,h,d,!!v)}function bt(t,n,e,i){const r=e[0]-i[0],o=e[1]-i[1];let s=(n[0]-e[0])*(e[0]-i[0])+(n[1]-e[1])*(e[1]-i[1]);return s/=r*r+o*o,t[0]=e[0]+s*r,t[1]=e[1]+s*o,t}function St(t,n,e,i,r){const o=3*n[e-1],s=3*n[e-1]+1,u=t[o],c=t[s];return f=i,a=r,l=u,h=c,Math.sqrt((l-f)*(l-f)+(h-a)*(h-a));var f,a,l,h}function Ft(t){return t&&t.h&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var At={exports:{}};function kt(t,n,e){e=e||2;var i,r,o,s,u,c,f,a=n&&n.length,l=a?n[0]*e:t.length,h=Tt(t,0,l,e,!0),d=[];if(!h||h.next===h.prev)return d;if(a&&(h=function(t,n,e,i){var r,o,s,u=[];for(r=0,o=n.length;r<o;r++)(s=Tt(t,n[r]*i,r<o-1?n[r+1]*i:t.length,i,!1))===s.next&&(s.steiner=!0),u.push(Bt(s));for(u.sort(Et),r=0;r<u.length;r++)e=Ut(u[r],e);return e}(t,n,h,e)),t.length>80*e){i=o=t[0],r=s=t[1];for(var v=e;v<l;v+=e)(u=t[v])<i&&(i=u),(c=t[v+1])<r&&(r=c),u>o&&(o=u),c>s&&(s=c);f=0!==(f=Math.max(o-i,s-r))?32767/f:0}return It(h,d,e,i,r,f,0),d}function Tt(t,n,e,i,r){var o,s;if(r===Kt(t,n,e,i)>0)for(o=n;o<e;o+=i)s=Ht(o,t[o],t[o+1],s);else for(o=e-i;o>=n;o-=i)s=Ht(o,t[o],t[o+1],s);return s&&Xt(s,s.next)&&(Zt(s),s=s.next),s}function _t(t,n){if(!t)return t;n||(n=t);var e,i=t;do{if(e=!1,i.steiner||!Xt(i,i.next)&&0!==Dt(i.prev,i,i.next))i=i.next;else{if(Zt(i),(i=n=i.prev)===i.next)break;e=!0}}while(e||i!==n);return n}function It(t,n,e,i,r,o,s){if(t){!s&&o&&function(t,n,e,i){var r=t;do{0===r.z&&(r.z=jt(r.x,r.y,n,e,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var n,e,i,r,o,s,u,c,f=1;do{for(e=t,t=null,o=null,s=0;e;){for(s++,i=e,u=0,n=0;n<f&&(u++,i=i.nextZ);n++);for(c=f;u>0||c>0&&i;)0!==u&&(0===c||!i||e.z<=i.z)?(r=e,e=e.nextZ,u--):(r=i,i=i.nextZ,c--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;e=i}o.nextZ=null,f*=2}while(s>1)}(r)}(t,i,r,o);for(var u,c,f=t;t.prev!==t.next;)if(u=t.prev,c=t.next,o?Nt(t,i,r,o):Ot(t))n.push(u.i/e|0),n.push(t.i/e|0),n.push(c.i/e|0),Zt(t),t=c.next,f=c.next;else if((t=c)===f){s?1===s?It(t=Ct(_t(t),n,e),n,e,i,r,o,2):2===s&&Lt(t,n,e,i,r,o):It(_t(t),n,e,i,r,o,1);break}}}function Ot(t){var n=t.prev,e=t,i=t.next;if(Dt(n,e,i)>=0)return!1;for(var r=n.x,o=e.x,s=i.x,u=n.y,c=e.y,f=i.y,a=r<o?r<s?r:s:o<s?o:s,l=u<c?u<f?u:f:c<f?c:f,h=r>o?r>s?r:s:o>s?o:s,d=u>c?u>f?u:f:c>f?c:f,v=i.next;v!==n;){if(v.x>=a&&v.x<=h&&v.y>=l&&v.y<=d&&Vt(r,u,o,c,s,f,v.x,v.y)&&Dt(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function Nt(t,n,e,i){var r=t.prev,o=t,s=t.next;if(Dt(r,o,s)>=0)return!1;for(var u=r.x,c=o.x,f=s.x,a=r.y,l=o.y,h=s.y,d=u<c?u<f?u:f:c<f?c:f,v=a<l?a<h?a:h:l<h?l:h,y=u>c?u>f?u:f:c>f?c:f,p=a>l?a>h?a:h:l>h?l:h,M=jt(d,v,n,e,i),w=jt(y,p,n,e,i),m=t.prevZ,g=t.nextZ;m&&m.z>=M&&g&&g.z<=w;){if(m.x>=d&&m.x<=y&&m.y>=v&&m.y<=p&&m!==r&&m!==s&&Vt(u,a,c,l,f,h,m.x,m.y)&&Dt(m.prev,m,m.next)>=0)return!1;if(m=m.prevZ,g.x>=d&&g.x<=y&&g.y>=v&&g.y<=p&&g!==r&&g!==s&&Vt(u,a,c,l,f,h,g.x,g.y)&&Dt(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;m&&m.z>=M;){if(m.x>=d&&m.x<=y&&m.y>=v&&m.y<=p&&m!==r&&m!==s&&Vt(u,a,c,l,f,h,m.x,m.y)&&Dt(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;g&&g.z<=w;){if(g.x>=d&&g.x<=y&&g.y>=v&&g.y<=p&&g!==r&&g!==s&&Vt(u,a,c,l,f,h,g.x,g.y)&&Dt(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function Ct(t,n,e){var i=t;do{var r=i.prev,o=i.next.next;!Xt(r,o)&&zt(r,i,i.next,o)&&qt(r,o)&&qt(o,r)&&(n.push(r.i/e|0),n.push(i.i/e|0),n.push(o.i/e|0),Zt(i),Zt(i.next),i=t=o),i=i.next}while(i!==t);return _t(i)}function Lt(t,n,e,i,r,o){var s=t;do{for(var u=s.next.next;u!==s.prev;){if(s.i!==u.i&&Gt(s,u)){var c=Rt(s,u);return s=_t(s,s.next),c=_t(c,c.next),It(s,n,e,i,r,o,0),void It(c,n,e,i,r,o,0)}u=u.next}s=s.next}while(s!==t)}function Et(t,n){return t.x-n.x}function Ut(t,n){var e=function(t,n){var e,i=n,r=t.x,o=t.y,s=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var u=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(u<=r&&u>s&&(s=u,e=i.x<i.next.x?i:i.next,u===r))return e}i=i.next}while(i!==n);if(!e)return null;var c,f=e,a=e.x,l=e.y,h=1/0;i=e;do{r>=i.x&&i.x>=a&&r!==i.x&&Vt(o<l?r:s,o,a,l,o<l?s:r,o,i.x,i.y)&&(c=Math.abs(o-i.y)/(r-i.x),qt(i,t)&&(c<h||c===h&&(i.x>e.x||i.x===e.x&&$t(e,i)))&&(e=i,h=c)),i=i.next}while(i!==f);return e}(t,n);if(!e)return n;var i=Rt(e,t);return _t(i,i.next),_t(e,e.next)}function $t(t,n){return Dt(t.prev,t,n.prev)<0&&Dt(n.next,t,t.next)<0}function jt(t,n,e,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-e)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-i)*r|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function Bt(t){var n=t,e=t;do{(n.x<e.x||n.x===e.x&&n.y<e.y)&&(e=n),n=n.next}while(n!==t);return e}function Vt(t,n,e,i,r,o,s,u){return(r-s)*(n-u)>=(t-s)*(o-u)&&(t-s)*(i-u)>=(e-s)*(n-u)&&(e-s)*(o-u)>=(r-s)*(i-u)}function Gt(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==n.i&&e.next.i!==n.i&&zt(e,e.next,t,n))return!0;e=e.next}while(e!==t);return!1}(t,n)&&(qt(t,n)&&qt(n,t)&&function(t,n){var e=t,i=!1,r=(t.x+n.x)/2,o=(t.y+n.y)/2;do{e.y>o!=e.next.y>o&&e.next.y!==e.y&&r<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next}while(e!==t);return i}(t,n)&&(Dt(t.prev,t,n.prev)||Dt(t,n.prev,n))||Xt(t,n)&&Dt(t.prev,t,t.next)>0&&Dt(n.prev,n,n.next)>0)}function Dt(t,n,e){return(n.y-t.y)*(e.x-n.x)-(n.x-t.x)*(e.y-n.y)}function Xt(t,n){return t.x===n.x&&t.y===n.y}function zt(t,n,e,i){var r=Yt(Dt(t,n,e)),o=Yt(Dt(t,n,i)),s=Yt(Dt(e,i,t)),u=Yt(Dt(e,i,n));return r!==o&&s!==u||(!(0!==r||!Jt(t,e,n))||(!(0!==o||!Jt(t,i,n))||(!(0!==s||!Jt(e,t,i))||!(0!==u||!Jt(e,n,i)))))}function Jt(t,n,e){return n.x<=Math.max(t.x,e.x)&&n.x>=Math.min(t.x,e.x)&&n.y<=Math.max(t.y,e.y)&&n.y>=Math.min(t.y,e.y)}function Yt(t){return t>0?1:t<0?-1:0}function qt(t,n){return Dt(t.prev,t,t.next)<0?Dt(t,n,t.next)>=0&&Dt(t,t.prev,n)>=0:Dt(t,n,t.prev)<0||Dt(t,t.next,n)<0}function Rt(t,n){var e=new Wt(t.i,t.x,t.y),i=new Wt(n.i,n.x,n.y),r=t.next,o=n.prev;return t.next=n,n.prev=t,e.next=r,r.prev=e,i.next=e,e.prev=i,o.next=i,i.prev=o,i}function Ht(t,n,e,i){var r=new Wt(t,n,e);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Zt(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 Wt(t,n,e){this.i=t,this.x=n,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Kt(t,n,e,i){for(var r=0,o=n,s=e-i;o<e;o+=i)r+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return r}At.exports=kt,At.exports.default=kt,kt.deviation=function(t,n,e,i){var r=n&&n.length,o=r?n[0]*e:t.length,s=Math.abs(Kt(t,0,o,e));if(r)for(var u=0,c=n.length;u<c;u++){var f=n[u]*e,a=u<c-1?n[u+1]*e:t.length;s-=Math.abs(Kt(t,f,a,e))}var l=0;for(u=0;u<i.length;u+=3){var h=i[u]*e,d=i[u+1]*e,v=i[u+2]*e;l+=Math.abs((t[h]-t[v])*(t[d+1]-t[h+1])-(t[h]-t[d])*(t[v+1]-t[h+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},kt.flatten=function(t){for(var n=t[0][0].length,e={vertices:[],holes:[],dimensions:n},i=0,r=0;r<t.length;r++){for(var o=0;o<t[r].length;o++)for(var s=0;s<n;s++)e.vertices.push(t[r][o][s]);r>0&&(i+=t[r-1].length,e.holes.push(i))}return e};var Qt=Ft(At.exports);const tn="__fea_idx";new Float32Array([-1e12])[0];const nn="maptalks_ombb";function en(){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:rn,ArrayPool:on}=en();function sn(t,n,e,i,r,o,s,u,c,f,a,l,h,d,v,y,p){const M=n.getLength(),w=r/3;for(let e=2,i=M;e<i;e+=3)t[r+e-2]=n[e-2],t[r+e-1]=n[e-1],t[r+e-0]=n[e]-s;r+=M;for(let e=2,i=M;e<i;e+=3)t[r+e-2]=n[e-2],t[r+e-1]=n[e-1],t[r+e-0]=n[e]-u;r+=M,t.trySetLength(r+M),t.copyWithin(r,r-2*M,r-M),r+=M,t.trySetLength(r+M),t.copyWithin(r,r-2*M,r-M),r+=M,(e=e||[]).push(M/3);const m=e.getLength();for(let n=0;n<m;n++){un(w+(e[n-1]||0),w+e[n],t,M/3,c,i,f,a,l,h,o,d,v,y,p)}return r}function un(t,n,e,i,r,o,s,u,c,f,a,l,h,d,v){const y=o.getLength();let p,M;for(let s=t,u=n;s<u-1;s++)if(p=s,M=s+1,r===1/0||!ft(e,p,M,r))if((s-t)%2==1&&(p+=2*i,M+=2*i),v){let t=o.currentIndex;o[t++]=p+i,o[t++]=M,o[t++]=p,o[t++]=M+i,o[t++]=M,o[t++]=p+i,o.currentIndex=t}else{let t=o.currentIndex;o[t++]=p+i,o[t++]=p,o[t++]=M,o[t++]=M,o[t++]=M+i,o[t++]=p+i,o.currentIndex=t}s&&function(t,n,e,i,r,o,s,u,c,f,a,l){let h,d=0,v=0,y=0,p=0;const M=l?[1,3,4]:[2,3,4];for(let l=o.getLength()-1;l>=s;l--){const s=o[l],w=3*s+1,m=3*s+2,g=r[3*s],P=r[w],x=r[m];d||v||(d=Math.max(r[m],r[3*o[l-3]+2]),v=Math.min(r[m],r[3*o[l-3]+2]),h=d-v);let b=y;const S=l%6;0===t?(5===S&&(p=St(r,o,l,g,P)),b=S===M[0]||S===M[1]||S===M[2]?y:y+p):1===t&&(S===M[0]||S===M[1]||S===M[2]?b=0:5===S?(p=St(r,o,l,g,P),b=p):b=p);const F=b/f*(1/(100*a))/u;let A;A=1===n?x===d?1:0:"bottom"===e?x===d?h/100/c:0:x===d?0:-h/100/c,i[2*s]=F,i[2*s+1]=A,0===S&&(y+=p)}}(u,c,f,a,e,o,y,l[0],l[1],h,d,v)}function cn(t){const n=[t[0]];let e=t[0];for(let i=1;i<t.length;i++)Array.isArray(t[i])?t[i][0]===e[0]&&t[i][1]===e[1]&&t[i][2]===e[2]||n.push(t[i]):t[i].x===e.x&&t[i].y===e.y&&t[i].z===e.z||n.push(t[i]),e=t[i];return n}var fn="undefined"!=typeof Float32Array?Float32Array:Array;function an(){var t=new fn(3);return fn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function ln(t,n,e){var i=new fn(3);return i[0]=t,i[1]=n,i[2]=e,i}function hn(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function dn(t,n,e,i){return t[0]=n,t[1]=e,t[2]=i,t}function vn(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t}function yn(t,n){var e=n[0],i=n[1],r=n[2],o=e*e+i*i+r*r;return o>0&&(o=1/Math.sqrt(o),t[0]=n[0]*o,t[1]=n[1]*o,t[2]=n[2]*o),t}function pn(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Mn(t,n,e){var i=n[0],r=n[1],o=n[2],s=e[0],u=e[1],c=e[2];return t[0]=r*c-o*u,t[1]=o*s-i*c,t[2]=i*u-r*s,t}var wn=function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t};function mn(){var t=new fn(4);return fn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function gn(t,n){var e=n[0]+n[4]+n[8],i=void 0;if(e>0)i=Math.sqrt(e+1),t[3]=.5*i,i=.5/i,t[0]=(n[5]-n[7])*i,t[1]=(n[6]-n[2])*i,t[2]=(n[1]-n[3])*i;else{var r=0;n[4]>n[0]&&(r=1),n[8]>n[3*r+r]&&(r=2);var o=(r+1)%3,s=(r+2)%3;i=Math.sqrt(n[3*r+r]-n[3*o+o]-n[3*s+s]+1),t[r]=.5*i,i=.5/i,t[3]=(n[3*o+s]-n[3*s+o])*i,t[o]=(n[3*o+r]+n[3*r+o])*i,t[s]=(n[3*s+r]+n[3*r+s])*i}return t}!function(){var t=an()}(),function(){var t,n=(t=new fn(4),fn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var Pn,xn=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},bn=function(t,n){var e=n[0],i=n[1],r=n[2],o=n[3],s=e*e+i*i+r*r+o*o;return s>0&&(s=1/Math.sqrt(s),t[0]=e*s,t[1]=i*s,t[2]=r*s,t[3]=o*s),t};an(),ln(1,0,0),ln(0,1,0),mn(),mn(),Pn=new fn(9),fn!=Float32Array&&(Pn[1]=0,Pn[2]=0,Pn[3]=0,Pn[5]=0,Pn[6]=0,Pn[7]=0),Pn[0]=1,Pn[4]=1,Pn[8]=1;\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */\nconst Sn=8,Fn=[],An=[],kn=[],Tn=[];function _n(t,n,e){const i=Mn(An,n,e),r=function(t,n,e,i,r,o,s,u,c,f){return t[0]=n,t[1]=e,t[2]=i,t[3]=r,t[4]=o,t[5]=s,t[6]=u,t[7]=c,t[8]=f,t}(Fn,e[0],e[1],e[2],...i,...n);t=gn(t,r),t=function(t){return t[3]<0?xn(t,t,-1):t}(t=bn(t,t));const o=1/((1<<2*Sn-1)-1);if(t[3]<o){t[3]=o;const n=Math.sqrt(1-o*o);t[0]*=n,t[1]*=n,t[2]*=n}const s=e[3]>0?Mn(kn,e,n):Mn(kn,n,e);return pn(Mn(Tn,e,n),s)<0&&xn(t,t,-1),t}const In=[];const On=[],Nn=[],Cn=[],Ln=[],En=[],Un=[],$n=[];function jn(t,n,e,i,r,o){dn(Ln,t[3*n],t[3*n+1],t[3*n+2]),dn(En,t[3*e],t[3*e+1],t[3*e+2]),dn(Un,t[3*i],t[3*i+1],t[3*i+2]);const s=wn(On,Un,En),u=wn(Nn,Ln,En),c=Mn(Cn,s,u);yn($n,c),r[3*n]=r[3*n]||0,r[3*e]=r[3*e]||0,r[3*i]=r[3*i]||0,r[3*n+1]=r[3*n+1]||0,r[3*e+1]=r[3*e+1]||0,r[3*i+1]=r[3*i+1]||0,r[3*n+2]=r[3*n+2]||0,r[3*e+2]=r[3*e+2]||0,r[3*i+2]=r[3*i+2]||0,r[3*n]+=$n[0],r[3*e]+=$n[0],r[3*i]+=$n[0],r[3*n+1]+=$n[1],r[3*e+1]+=$n[1],r[3*i+1]+=$n[1],r[3*n+2]+=$n[2],r[3*e+2]+=$n[2],r[3*i+2]+=$n[2],o[n]+=1,o[e]+=1,o[i]+=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 Bn(t,n,e){return t[0]=n[e],t[1]=n[e+1],t[2]=n[e+2],t}function Vn(t,n,e){return t[0]=n[e],t[1]=n[e+1],t}const{StyleUtil:Gn,PackUtil:Dn,ArrayPool:Xn}=en(),zn=Xn.getInstance();function Jn(t,n,e,i,r,o,s,u,c,f,a,l,h,d,v,y){void 0===n.top&&(n.top=!0),void 0===n.side&&(n.side=!0),zn.reset();const{altitudeScale:p,altitudeProperty:g,defaultAltitude:P,heightProperty:x,minHeightProperty:b,defaultHeight:F,tangent:A,uv:k,topUVMode:_,sideUVMode:I,sideVerticalUVMode:O,top:N,side:C,textureYOrigin:L,topThickness:E}=n,U=function(t,n,{altitudeScale:e,altitudeProperty:i,defaultAltitude:r,heightProperty:o,minHeightProperty:s,defaultHeight:u},{center:c,side:f,top:a,topThickness:l,uvOrigin:h,uv:d,uvSize:v,topUVMode:y,sideUVMode:p,sideVerticalUVMode:M,textureYOrigin:w,tileRatio:m,centimeterToPoint:g,verticalCentimeterToPoint:P,positionType:x,res:b,glScale:F,projectionCode:A},k,T){let _=n/t[0].extent;n===1/0&&(_=1);const I=n===1/0,O=T.get(),N=T.get(),C=T.get(),L=T.getProxy(),E=T.get(),U=T.get(),$=T.get(),j=!!d,B=!!a,V=!!f,G=j?T.get():null;function D(t,e,i,r,o,s){let u=e;if(B){const f=Qt(L,i,3);if(0===f.length)return e;let a=L.getLength(),d=E.currentIndex;for(let t=0;t<a;t++)E[d++]=L[t];if(E.currentIndex=d,e+=L.getLength(),s)for(let n=2,e=f.length;n<e;n+=3)f[n]+=t/3,f[n-1]+=t/3,f[n-2]+=t/3;else{let n;for(let e=2,i=f.length;e<i;e+=3)n=f[e-1],f[e-1]=f[e]+t/3,f[e]=n+t/3,f[e-2]+=t/3}a=f.length,d=U.currentIndex;for(let t=0;t<a;t++)U[d++]=f[t];U.currentIndex=d,j&&xt(y||0,t,e,G,E,h,g,m,v[0],v[1],o,b,F,A,c),l>0&&!V&&(e=sn(E,L,i,U,e,G,0,l,n,j,p||0,M||0,w,v,m,P,r<0?!s:s)),$.setLength(e/3),$.fill(1,u/3,e/3)}if(V){B&&(l=0),u=e,e=sn(E,L,i,U,e,G,l,r,n,j,p||0,M||0,w,v,m,P,r<0?!s:s),$.setLength(e/3);const t=L.getLength()/3;$.fill(1,u/3,u/3+t),$.fill(0,u/3+t,u/3+2*t),$.fill(1,u/3+2*t,u/3+3*t),$.fill(0,u/3+3*t,e/3)}return e}let X=0,z=0;const J=[-1,-1,n+1,n+1];let Y=0,q=t.length;S(k)&&(Y=k,q=k+1);let R=0,H=!1;const Z=T.getProxy();let W=!1;for(;Y<q;Y++){const c=t[Y],f=c.id;S(f)&&(Math.abs(f)>R&&(R=Math.abs(f)),f<0&&(H=!0));const a=c.geometry,l=c.properties[nn];let h=Array.isArray(l&&l[0]&&l[0][0])?l[0]:l;const{altitude:d,height:v}=rn.getFeaAltitudeAndHeight(c,e,i,r,o,u,s);v<0&&(W=!0),X=Math.max(Math.abs(d),X);const y=E.getLength();let p=0,M=z;Z.setLength(0),L.setLength(0);const w=rn.calculateSignedArea(a[0])<0;for(let t=0,e=a.length;t<e;t++){let i=a[t];w&&(i=i.reverse()),i=cn(i);const r=rn.calculateSignedArea(i)<0;if(!r&&t>0&&(p++,h=l&&l[p],z=D(M,z,Z,v*_,h,I),L.setLength(0),Z.setLength(0),M=z),n!==1/0&&(i=rn.clipPolygon(i,J)),!i.length){t===e-1&&(z=D(M,z,Z,v*_,h,I));continue}const o=i.length;if(Array.isArray(i[0])?i[0][0]===i[o-1][0]&&i[0][1]===i[o-1][1]||i.push([i[0][0],i[0][1]]):i[0].x===i[o-1].x&&i[0].y===i[o-1].y||i.push(i[0]),r){let t=Z.currentIndex;Z[t++]=L.getLength()/3,Z.currentIndex=t}ct(L,L.getLength(),i,_,d,!1,x),t===e-1&&(z=D(M,z,Z,v*_,h,I))}const m=E.getLength()-y,g=(tn+"").trim();for(let t=0;t<m/3;t++){let t=N.currentIndex;N[t++]=void 0===c[g]?Y:c[g],N.currentIndex=t,t=O.currentIndex,O[t++]=Y,O.currentIndex=t,S(f)&&(t=C.currentIndex,C[t++]=f,C.currentIndex=t)}}const K=rn.getUnsignedArrayType(N.getLength()?N[N.getLength()-1]:0),Q={hasNegativeHeight:W,maxAltitude:X,vertices:E,verticeTypes:$,indices:U,pickingIds:on.createTypedArray(N,K),featureIndexes:O};if(C.getLength()){const t=H?rn.getPosArrayType(R):rn.getUnsignedArrayType(R);Q.featureIds=on.createTypedArray(C,t)}else Q.featureIds=[];return G&&(G.setLength(E.getLength()/3*2),Q.uvs=G),Q}(t,e,{altitudeScale:p,altitudeProperty:g,defaultAltitude:P||0,heightProperty:x,minHeightProperty:b,defaultHeight:F||0},{center:y,top:N,side:C,topThickness:10*E||0,uv:k||A,uvSize:[r,r],uvOrigin:i,topUVMode:_,sideUVMode:I,sideVerticalUVMode:O,textureYOrigin:L,tileRatio:u,centimeterToPoint:c,verticalCentimeterToPoint:f,positionType:v,res:o,glScale:s,projectionCode:h},d,zn),$=[],j=U.vertices.getLength()/3,B=Dn.getIndexArrayType(j),V=Xn.createTypedArray(U.indices,B);delete U.indices,$.push(V.buffer,U.pickingIds.buffer);const G=Dn.getPosArrayType(Math.max(512,U.maxAltitude));U.vertices=Xn.createTypedArray(U.vertices,G);const D=A?zn.getProxy():new Float32Array(3*j);D.setLength&&D.setLength(3*j);const X=function(t,n,e){const i=e||[];i.setLength&&i.setLength(t.length);const r=In;r.length<t.length/3&&(r.length=t.length/3),r.fill(0,0,t.length/3);const o=void 0===n.length?n:n.length;for(let e=0;e<o/3;e++)void 0===n.length?jn(t,3*e,3*e+1,3*e+2,i,r):jn(t,n[3*e],n[3*e+1],n[3*e+2],i,r);for(let t=0;t<i.length;t+=3){const n=r[t/3];0!==n?(i[t]/=n,i[t+1]/=n,i[t+2]/=n):(i[t]=0,i[t+1]=0,i[t+2]=0)}return i}(U.vertices,V,D);let z=!0;const J=X.getLength?X.getLength():X.length;for(let t=0;t<J;t++){X[t]=-X[t];const n=X[t]%1;1-Math.abs(n)>1e-6?z=!1:0!==n&&(X[t]=Math.round(X[t]))}if(U.normals=X,A){let t=zn.get();t.setLength(4*j),t=function(t,n,e,i,r){const o=t.length/3,s=r||new Array(4*o),u=[],c=[];for(let t=0;t<o;t++)u[t]=[0,0,0],c[t]=[0,0,0];const f=[0,0,0],a=[0,0,0],l=[0,0,0],h=[0,0],d=[0,0],v=[0,0],y=[0,0,0],p=[0,0,0];function M(n,i,r){Bn(f,t,3*n),Bn(a,t,3*i),Bn(l,t,3*r),Vn(h,e,2*n),Vn(d,e,2*i),Vn(v,e,2*r);const o=a[0]-f[0],s=l[0]-f[0],M=a[1]-f[1],w=l[1]-f[1],m=a[2]-f[2],g=l[2]-f[2],P=d[0]-h[0],x=v[0]-h[0],b=d[1]-h[1],S=v[1]-h[1],F=1/(P*S-x*b);dn(y,(S*o-b*s)*F,(S*M-b*w)*F,(S*m-b*g)*F),dn(p,(P*s-x*o)*F,(P*w-x*M)*F,(P*g-x*m)*F),vn(u[n],u[n],y),vn(u[i],u[i],y),vn(u[r],u[r],y),vn(c[n],c[n],p),vn(c[i],c[i],p),vn(c[r],c[r],p)}for(let t=0,n=i.length;t<n;t+=3)M(i[t+0],i[t+1],i[t+2]);const w=[],m=[],g=[],P=[];let x,b,S;function F(t){Bn(g,n,3*t),hn(P,g),b=u[t],hn(w,b),wn(w,w,function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t}(g,g,pn(g,b))),yn(w,w),Mn(m,P,b),S=pn(m,c[t]),x=S<0?-1:1,s[4*t]=w[0],s[4*t+1]=w[1],s[4*t+2]=w[2],s[4*t+3]=x}for(let t=0,n=i.length;t<n;t+=3)F(i[t+0]),F(i[t+1]),F(i[t+2]);return s}(U.vertices,U.normals,U.uvs,V,t),t=function(t,n){const e=n.getLength(),i=new Float32Array(e),r=[],o=[],s=[];for(let u=0;u<e;u+=4){const e=u/4*3;lt(o,t[e]||0,t[e+1]||0,t[e+2]||0),dt(r,n[u]||0,n[u+1]||0,n[u+2]||0,n[u+3]||0),_n(s,o,r),ht(i.subarray(u,u+4),s)}return i}(U.normals,t),U.tangents=t,$.push(t.buffer),delete U.normals}if(U.normals&&(z&&(U.normals=Xn.createTypedArray(U.normals,Int8Array)),$.push(U.normals.buffer)),U.uvs){const t=U.uvs;U.uvs=Xn.createTypedArray(t,Float32Array),$.push(U.uvs.buffer)}const Y=function(t,n,e,i){const r={},o={},s=i.getLength();if(T(n.polygonFill)){let u=w(n.polygonFill);const c=new Uint8Array(4*s);c.fill(255);for(let n=0;n<s;n++){const o=t[i[n]],s=o.properties||{};s.$layer=o.layer,s.$type=o.type;let f=u(e,s);M(f)&&(r.aColor=1,u=w(f),f=u(e,s)),delete s.$layer,delete s.$type,Gn.normalizeColor(Yn,f),c[4*n]=Yn[0],c[4*n+1]=Yn[1],c[4*n+2]=Yn[2],c[4*n+3]=Yn[3]}o.aColor=c}if(T(n.polygonOpacity)){let u=m(n.polygonOpacity,"exponential");const c=new Uint8Array(s);c.fill(255);for(let n=0;n<s;n++){const o=t[i[n]],s=o.properties||{};s.$layer=o.layer,s.$type=o.type;let f=u(e,s);M(f)&&(r.aOpacity=1,u=w(f),f=u(e,s)),delete s.$layer,delete s.$type,c[n]=255*f}o.aOpacity=c}return o.dynamicAttributes=r,o}(t,a,l,U.featureIndexes),q=function(t,n,e,i,r){const o=[[],[]],s=T(i.topPolygonFill),u=T(i.bottomPolygonFill),c=[255,255,255,255],f=n.getLength();if(s||u){let a=s&&w(i.topPolygonFill),l=u&&w(i.bottomPolygonFill),h=null,d=null,v=null,y=null;for(let i=0;i<f;i++){if(1===t[i]&&!s||0===t[i]&&!u)continue;const f=1===t[i];if(f&&n[i]===h){t[i]=v;continue}if(!f&&n[i]===d){t[i]=y;continue}const p=e[n[i]],m=p.properties||{};m.$layer=p.layer,m.$type=p.type;let g=f?a:l,P=g(r,m);M(P)&&(g=w(P),P=g(r,m)),delete m.$layer,delete m.$type,Gn.normalizeColor(Yn,P),vt(Yn,Yn,c);let x=qn(o,Yn);x<0&&(x=o.length,o.push(ht([],Yn))),t[i]=x,f?(h=n[i],v=x):(d=n[i],y=x)}}return o.slice(2)}(U.verticeTypes,U.featureIndexes,t,a,l),R={data:{data:{aVertexColorType:q.length<=252?Xn.createTypedArray(U.verticeTypes,Uint8Array):Xn.createTypedArray(U.verticeTypes,Uint16Array),aPosition:U.vertices,aNormal:U.normals,aTexCoord0:U.uvs,aTangent:U.tangents,aPickingId:U.pickingIds},indices:V,properties:{maxAltitude:U.maxAltitude,hasNegativeHeight:U.hasNegativeHeight},dynamicAttributes:Y.dynamicAttributes,vertexColors:q},buffers:$};return U.featureIds.length?(R.data.featureIds=U.featureIds,$.push(R.data.featureIds.buffer)):R.data.featureIds=[],Y.aColor&&(R.data.data.aColor=Y.aColor,R.buffers.push(Y.aColor.buffer)),Y.aOpacity&&(R.data.data.aOpacity=Y.aOpacity,R.buffers.push(Y.aOpacity.buffer)),R.buffers.push(R.data.data.aPosition.buffer),R.data.pickingIdIndiceMap=Dn.generatePickingIndiceIndex(R.data.data.aPickingId,R.data.indices),R}const Yn=[];function qn(t,n){for(let r=0;r<t.length;r++)if(e=n,i=t[r],e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3])return r;var e,i;return-1}const{PackUtil:Rn,StyleUtil:Hn,FilterUtil:Zn}=en();function Wn(t,n,e,i,{altitudeScale:r,altitudeProperty:o,defaultAltitude:s,heightProperty:u,minHeightProperty:c,defaultHeight:f,bottom:a}){const l=a,h=n/t[0].extent,d=2*function(t,n){let e=0;for(let n=0,i=t.length;n<i;n++){const i=t[n];if(S(i.geometry[0][0]))e+=3*i.geometry.length;else for(let t=0,n=i.geometry.length;t<n;t++){let n=3*i.geometry[t].length;3===i.type&&(n-=3),e+=n}}return e}(t)+3*t.length*2,v=[],y=new Int16Array(d),p=new Uint8Array(y.length/3*4);M(e)&&(e=Zn.compileFilter(e));const w=[];function m(t,e,i){const r=e-t,o=y.subarray(t,e),s=y.subarray(e,e+r);s.set(o);for(let t=2,n=s.length;t<n;t+=3)s[t]=o[t]-i;const u=t/3,c=r/3;let f,a;for(let t=u,e=c+u;t<e;t++)t<e-1?(f=t,a=t+1):(f=t,a=u),ft(y,f,a,n)||(w.push(f,a),l&&w.push(f+c,a+c),Kn(y,f,n)||w.push(f,f+c));return e+r}let g=0,P=0;const x=(tn+"").trim(),b=[];for(let n=0,a=t.length;n<a;n++){const a=t[n],l=a.geometry;if(e){let t;t="function"==typeof e?e(a&&a.properties):e,Hn.normalizeColor(b,t)}else lt(b,255,255,255);const d=g/3*4,{altitude:M,height:S}=Rn.getFeaAltitudeAndHeight(a,r,o,s,u,f,c);P=Math.max(Math.abs(M),P);let F=g;for(let t=0,n=l.length;t<n;t++){let n=l[t];const e=n.length;n[0][0]===n[e-1][0]&&n[0][1]===n[e-1][1]&&(n=n.slice(0,e-1)),g=ct(y,F,n,h,M),g=m(F,g,S*h),F=g}const A=F/3*4;for(let t=d;t<A;t+=4)p[t]=b[0],p[t+1]=b[1],p[t+2]=b[2],p[t+3]=255*(i||1);const k=w.length-v.length;for(let t=0;t<k;t++)v.push(a[x])}const F=w.reduce(((t,n)=>Math.max(t,n)),0),A=new(Rn.getIndexArrayType(F))(w),k=Rn.getUnsignedArrayType(t.length);return{aPosition:new(Rn.getPosArrayType(Math.max(512,P)))(y),indices:A,aPickingId:new k(v),aColor:p}}function Kn(t,n,e){const i=t[3*n],r=t[3*n+1];return i<0||i>e||r<0||r>e}function Qn(t,n,e,i){const r=Wn(t,n,e.lineColor,e.lineOpacity,i),o=[r.aPosition.buffer,r.indices.buffer,r.aPickingId.buffer],s=r.indices;return delete r.indices,{data:{data:r,indices:s},buffers:o}}\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 te=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function ne(t){if(!t)return"true";const n=t[0];if(t.length<=1)return"any"===n?"false":"true";return\`(${E}"=="===n?ie(t[1],t[2],"===",!1):"!="===n?ie(t[1],t[2],"!==",!1):"<"===n||">"===n||"<="===n||">="===n?ie(t[1],t[2],n,!0):"any"===n?oe(t.slice(1),"||"):"all"===n?oe(t.slice(1),"&&"):"none"===n?ce(oe(t.slice(1),"||")):"in"===n?se(t[1],t.slice(2)):"!in"===n?ce(se(t[1],t.slice(2))):"has"===n?ue(t[1]):"!has"===n?ce(ue(t[1])):"contains"===n?function(t,n,e){const i=ee(t);return void 0!==e?\`(${E}i} + '').indexOf("${E}n}") === ${E}e}\`:\`(${E}i} + '').indexOf("${E}n}") >= 0\`}(t[1],t[2],t[3]):"true"})\`}function ee(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function ie(t,n,e,i){if("object"==typeof(r=t)&&r&&t.op)return function(t,n,e,i){const r=t.property,o=t.op;let s=ee(r);return"length"!==o?(console.error(\`not support ${E}o} op\`),"false"):(s=\`((${E}s}+='').length)\`,re(s,r,n,e,i))}(t,n,e,i);var r;return re(ee(t),t,n,e,i)}function re(t,n,e,i,r){const o="$type"===n?te.indexOf(e):JSON.stringify(e);return(r?\`typeof ${E}t}=== typeof ${E}o}&&\`:"")+t+i+o}function oe(t,n){return t.map(ne).join(n)}function se(t,n){"$type"===t&&(n=n.map((t=>te.indexOf(t))));const e=JSON.stringify(n.sort(fe)),i=ee(t);return n.length<=200?\`${E}e}.indexOf(${E}i}) !== -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; }(${E}i}, ${E}e},0,${E}n.length-1})\`}function ue(t){return"$id"===t?'"id" in f':\`${E}JSON.stringify(t)} in p\`}function ce(t){return\`!(${E}t})\`}function fe(t,n){return t<n?-1:t>n?1:0}let ae=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),ae=!0}catch(t){ae=!1}var le=ae;const{VectorPack:he,PolygonPack:de,NativeLinePack:ve,LinePack:ye,PointPack:pe,NativePointPack:Me,LineExtrusionPack:we,CirclePack:me,RoundTubePack:ge,SquareTubePack:Pe,FilterUtil:xe,PackUtil:be,StyleUtil:Se,TextUtil:Fe,DEFAULT_TEX_WIDTH:Ae,GlyphRequestor:ke}=en(),Te="__original_properties",_e="__fn-type_properties";class Ie{constructor(t,n,e,i,r){this.id=t,this.options=n,this.upload=e,this.v(n.style),this.requests={},this.M=i,this.m=1,this.loadings=r}updateStyle(t,n){this.options.style=t,this.m=t.styleCounter,this.v(t),n()}updateOptions(t,n){this.options=x(this.options,t),n()}loadTile(t,n){const e=this.loadings,i=t.tileInfo.url,r=this.options.debugTile;if(r){const{x:e,y:i,z:o}=t.tileInfo;let s=!1;for(let t=0;t<r.length;t++)if(e===r[t].x&&i===r[t].y&&o===r[t].z){s=!0;break}if(!s)return void n()}if(e[i])return void e[i].push({context:t,callback:n,ref:this});e[i]=[{context:t,callback:n,ref:this}];const o=this.options.featureIdProperty;this.requests[i]=this.getTileFeatures(t,((n,r,s,u)=>{const c=e[i];if(delete e[i],this.checkIfCanceled(i))return delete this.requests[i],void this.P(c,null,{canceled:!0});if(delete this.requests[i],(this.options.debug||o)&&r)for(let n=0;n<r.length;n++)if(this.options.debug&&(r[n]._debug_info={index:n,id:r[n].id,tileId:t.tileInfo.id}),o){const t=A(o)?o[r[n].layer]:o,e=r[n].properties;r[n].id=e&&e[t]||null}if(n)this.P(c,n);else if(r&&r.length){if(c)for(let t=0;t<c.length;t++)this.S.call(c[t].ref,c[t].context,c[t].callback,i,s,r,u)}else this.P(c)}))}S(t,n,e,i,r,o){this.F(i,r,t).then((e=>{e.canceled?n(null,{canceled:!0}):(e.data.styleCounter=t.styleCounter,o&&x(e.data,o),n(null,e.data,e.buffers))})).catch((t=>{n(t)}))}abortTile(t,n){delete this.requests[t],this.A(t),n()}A(t){const n=this.loadings[t];if(n)for(let t=0;t<n.length;t++)n[t].callback(null,{canceled:!0});delete this.loadings[t]}P(t,n,e){if(t)for(let i=0;i<t.length;i++)t[i].callback(n,e)}checkIfCanceled(t){return!this.requests[t]}onRemove(){this.loadings={},delete this.M,this.requests={}}fetchIconGlyphs(t,n,e){if(this.options.workerGlyph&&le){const i=[];if(t&&Object.keys(t).length){const n=new Promise((n=>{this.upload("fetchIconGlyphs",{icons:t},null,((t,e)=>{n({err:t,iconData:e})}))}));i.push(n)}if(n&&Object.keys(n).length){const t=new Promise((t=>{this.k||(this.k=new ke),this.k.getGlyphs(n,((n,e)=>{t({err:n,glyphData:e})}))}));i.push(t)}Promise.all(i).then((t=>{const n={icons:null,glyphs:null};for(let i=0;i<t.length;i++){if(t[i].err)return void e(t[i].err);t[i].iconData?n.icons=t[i].iconData.icons:t[i].glyphData&&(n.glyphs=t[i].glyphData.glyphs)}return n})).then((t=>{e(null,t)}))}else this.upload("fetchIconGlyphs",{icons:t,glyphs:n},null,e)}F(t,n,e){if(!n.length)return Promise.resolve({data:null,buffers:[]});const{glScale:i,tileInfo:r}=e,o=!this.options.style.style.length&&!this.options.style.featureStyle.length;let s=this.pluginConfig.slice(0);o&&(s=this.T(t)),this.featurePlugins&&function(t){for(let n=1;n<arguments.length;n++){const e=arguments[n];if(e)for(let n=0,i=e.length;n<i;n++)t.push(e[n])}t.length}(s,this.featurePlugins);const u={};for(let t=0;t<s.length;t++)$e(n,e.tileInfo.z,s[t],u);const c=[],f=[];for(let t=0;t<n.length;t++){const e=n[t],i=u[t];if(i){f.fill(null);let t=0;for(const n in i){let r=0;const o=i[n].values();for(const t of o){let i=f[r];i||(i=Ge(e),f[r]=i),i.properties[n]=t,r++}r>t&&(t=r)}for(let n=0;n<t;n++)c.push(f[n])}else c.push(e)}const a=(n=c)[0].extent,l=r.z,h={x:r.extent2d.xmin*i,y:r.extent2d.ymax*i},d=[],v=[],y=[],p=this.options,M=[],w={},m=[Promise.resolve(e.styleCounter)];let g=0,P=-1;const b=[];let S=!1;for(let t=0;t<s.length;t++){P++;const i=s[t];i.type!==g&&(P=0,g=i.type);const u=0===i.type?d:v;if(i.symbol&&!1===i.symbol.visible){u[P]=null;continue}ze(i.symbol,b,t),S=S||b[t]&&b[t].size>0;const{tileFeatures:c,tileFeaIndexes:f}=this._(l,i.type,i.filter,n,w,t);if(!c.length){u[P]=null;continue}const p=f[f.length-1],F=be.getIndexArrayType(p);u[P]={styledFeatures:new F(f)},y.push({idx:t,typeIdx:P}),M.push(u[P].styledFeatures.buffer);const A=x({},e,{extent:a,zoom:l,tilePoint:h});if(this.options.debugTile){const t=this.options.debugTile;for(let n=0;n<t.length;n++){const{x:e,y:i,z:o}=t[n];if(r.x===e&&r.y===i&&r.z===o){A.debugIndex=t[n].index;break}}}let k=this.I(c,i,A);o&&(k=k.then((t=>{if(!t)return null;if(t.data)t.data.layer=c[0].layer;else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]&&t[n].data&&(t[n].data.layer=c[0].layer);return t}))),m.push(k)}return Promise.all(m).then((([e,...i])=>{if(e!==this.m)return{canceled:!0};function r(t,n){if(void 0===t.data.ref&&(t.data.type=s[y[n].idx].renderPlugin.dataConfig.type,t.data.filter=s[y[n].idx].filter.def,t.buffers&&t.buffers.length))for(let n=0;n<t.buffers.length;n++)M.push(t.buffers[n])}for(let t=0;t<i.length;t++){if(!i[t])continue;const n=i[t],e=0===s[y[t].idx].type?d:v;if(Array.isArray(n)){const i=[];for(let e=0;e<n.length;e++)n[e]&&(r(n[e],t),(void 0===n[e].data.ref||n[n[e].data.ref])&&i.push(n[e].data));i.length&&(e[y[t].typeIdx].data=i)}else r(n,t),e[y[t].typeIdx].data=n.data}const o={},u=t;if(p.features||p.schema||S){let t,e=!1;for(let i=0,r=n.length;i<r;i++)if(t=n[i],u[t.layer].properties||(u[t.layer].properties=Ce(t.properties)),t&&(p.features||S&&w[i]))if("id"===p.features)o[i]=t.id;else{p.pickingGeometry||delete t.geometry,delete t.extent,delete t.properties.$layer,delete t.properties.$type,delete t.__index;const n=t.originalFeature;if(n){const n=t.properties,e=x({},t.originalFeature);delete n[Te],e.customProps=x({},n),t=e}const r=x({},t);if(S&&w[i]&&(!p.features||"transient"===p.features)){const r=w[i];for(let i=0;i<r.length;i++){const r=b[i];r&&r.forEach((i=>{const r=n?n.properties:t.properties;r[_e]||(r[_e]=new Set),r[_e].add(i),e=!0}))}}o[i]=r}if(e)for(const t in o){const n=o[t],e=n.properties[_e];if(e){delete n.properties[_e],"transient"===p.features&&(n.fnTypeProps=x({},n.properties));for(const t in n.properties)e.has(t)||("transient"===p.features?delete n.fnTypeProps[t]:delete n.properties[t])}}}return{data:{styleCounter:e,schema:u,data:d,featureData:v,extent:a,features:o},buffers:M}})).catch((t=>{console.error(t)}))}I(t,n,e){let i=t;const r=n.renderPlugin.dataConfig,o=n.symbol,s=this.options.tileSize,{extent:u,glScale:c,zScale:f,zoom:a,tilePoint:l,centimeterToPoint:h,verticalCentimeterToPoint:d}=e,v=u/s,y=r.type,p=e.debugIndex;let M=x({},r,{EXTENT:u,zoom:a,debugIndex:p,features:this.options.features});if("3d-extrusion"===y){Le(o)&&(r.uv=1);const t=this.options.projectionCode,n=o.material&&o.material.textureWidth||Ae;return Promise.all([Promise.resolve(Jn(i,r,u,l,n,e.tileInfo.res,c,u/this.options.tileSize,h,d,o,a,t,p))])}if("3d-wireframe"===y)return Promise.all([Promise.resolve(Qn(i,u,o,r))]);if("point"===y){M=x(M,{requestor:this.fetchIconGlyphs.bind(this),altitudeToTileScale:f*u/this.options.tileSize/c});const t=pe.splitPointSymbol(o),n=he.genFnTypes(t[0]);return pe.needMerge(t[0],n,a)&&(i=pe.mergeLineFeatures(i,t[0],n,a)),Promise.all(t.map(((t,e)=>(0===e?M.fnTypes=n:delete M.fnTypes,new pe(i,t,M).load(v)))))}if("native-point"===y){const t=f*u/this.options.tileSize/c;return M.altitudeToTileScale=t,Ee(i,o,M,Me,u/s)}if("line"===y)return M=x(M,{requestor:this.fetchIconGlyphs.bind(this),tileRatio:v}),Ee(i,o,M,ye,1,!0);if("native-line"===y)return Ee(i,o,M,ve,1,!0);if("fill"===y)return M=x(M,{requestor:this.fetchIconGlyphs.bind(this)}),Ee(i,o,M,de);if("line-extrusion"===y){delete o.lineGradientProperty,o.lineJoin="miter",o.lineCap="butt";const t=Le(o);if(t&&(r.uv=1),M=x(M,{tileSize:s,zScale:f,glScale:c}),o.mergeOnProperty){const t=he.genFnTypes(o);i=ye.mergeLineFeatures(i,o,t,M.zoom)}if(t){const t=[];if(!1!==r.top){const n=x({},M);n.side=!1,t.push(new we(i,o,n))}return!1!==r.side&&(M.side=!0,M.top=!1,t.push(new we(i,o,M))),Promise.all(t.map((t=>t.load())))}return Promise.all([new we(i,o,M).load()])}if("circle"===y)return Ee(i,o,M,me);if("round-tube"===y||"square-tube"===y){const t="round-tube"===y?ge:Pe;return M=x(M,{requestor:this.fetchIconGlyphs.bind(this),radialSegments:"round-tube"===y?r.radialSegments||8:4,centimeterToPoint:h,verticalCentimeterToPoint:d,tileRatio:v,isTube:!0}),Ee(i,o,M,t)}return Promise.resolve([])}_(t,n,e,i,r,o){const s=(tn+"").trim(),u=[],c=[],f=i.length;for(let a=0;a<f;a++)if((1===n||void 0===i[a].id||!this.styledFeatures[i[a].id])&&((!e.def||"default"===e.def)&&!r[a]||!0===e.def||e.def&&(void 0!==e.def.condition||Array.isArray(e.def))&&e(i[a],t))){const t=i[a];if(void 0===t[s]&&(t[s]=a),r[a]||(r[a]=[]),r[a].push(o),c.push(t),u.push(a),1===n)break}return{tileFeatures:c,tileFeaIndexes:u}}v(t){const{style:n,featureStyle:e}=t,i={};e.forEach((t=>{Array.isArray(t.id)?(t.id.forEach((t=>{i[t]=1})),t.filter=["in","$id",...t.id]):(i[t.id]=1,t.filter=["==","$id",t.id])}));const r=xe.compileStyle(n);for(let t=0;t<n.length;t++)r[t].filter&&(r[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0),r[t].type=0;const o=[],s=xe.compileStyle(e);for(let t=0;t<e.length;t++)s[t].type=1,s[t].filter.def=e[t].filter?e[t].filter.value||e[t].filter:void 0,s[t].renderPlugin&&o.push(s[t]);this.pluginConfig=r,this.featurePlugins=o,this.styledFeatures=i}T(t){let n=this.O;this.O||(n=this.O={});const e=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],i=[];for(const o in t){const s=o;if(!n[o]){const i=[];for(let n=0;n<t[o].types.length;n++){const u=t[o].types[n],c=["all",["==","$layer",s],["==","$type",e[u]]],f={filter:(r=c,new Function("f",\`var p = (f && f.properties || {}); return ${E}ne(r)}\`)),renderPlugin:Oe(u),symbol:Ne(u)};f.filter.def=c,f.type=0,i.push(f)}n[s]=i}i.push(...n[s])}var r;return i}}function Oe(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 Ne(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 Ce(t){if(Array.isArray(t)||!A(t))return{};const n={};for(const e in t){const i=t[e];b(i)?n[e]="string":S(i)?n[e]="number":!0===i||!1===i?n[e]="boolean":Array.isArray(i)?n[e]="array":n[e]="object"}return n}function Le(t){if(!t)return 0;let n=0;for(const e in t){if(("normalTexture"===e||"bumpTexture"===e)&&t[e])return 2;if(e.indexOf("Texture")>0&&t[e])n=1;else if(A(t[e])){const i=Le(t[e]);if(2===i)return i;1===i&&(n=1)}}return n}function Ee(t,n,e,i,r,o){const s={},u=Array.isArray(n)?n:[n];let c=-1;for(let t=0;t<u.length;t++)s[t]=Ue(u[t]),!s[t]&&u[t]&&-1===c&&(c=t);const f=[];for(let n=0;n<u.length;n++){if(!u[n])continue;u[n].index={index:n};let a=t;if(o&&u[n].mergeOnProperty){const i=he.genFnTypes(u[n]);a=ye.mergeLineFeatures(t,u[0],i,e.zoom)}s[n]||n===c?f.push(new i(a,u[n],e).load(r)):f.push({data:{ref:c,symbolIndex:{index:n}}})}return Promise.all(f)}function Ue(t){if(!t)return 0;for(const n in t)if(T(t[n]))return 1;return 0}function $e(t,n,e,i){const r=e.customProperties;if(!r)return t;if(r)for(let t=0;t<r.length;t++)r[t].fn=xe.compileFilter(r[t].filter);for(let e=0;e<r.length;e++)for(let o=0,s=t.length;o<s;o++)if(r[e].fn(t[o],n))for(const t in r[e].properties){const n=r[e].properties[t];k(n)||(i[o]||(i[o]={}),i[o][t]||(i[o][t]=new Set),i[o][t].add(n))}}const je={get:(t,n)=>n in t?t[n]:t.originalFeature[n],has:(t,n)=>n in t||n in t.originalFeature},Be={get:function(t,n){return n in t?t[n]:t[Te][n]},has:(t,n)=>n in t||n in t[Te]},Ve={};function Ge(t){const n={};n.originalFeature=t;const e=new Proxy(n,je);return e.properties=new Proxy({},Be),e.properties[Te]=t.properties||Ve,e}function De(t,n,e){t[n]||(t[n]=new Set),t[n].add(e)}const Xe=[];function ze(t,n,e){if(!t)return Xe;for(const i in t){if(!t[i]||!Se.checkIfZoomFnTypeSymbol(i))continue;if(T(t[i]))De(n,e,t[i].property);else{if("lineGradientProperty"===i){De(n,e,t[i]);continue}if("textName"===i)if(b(t[i])){const r=Fe.resolveVarNames(t[i]);if(r)for(let t=0;t<r.length;t++)De(n,e,r[t])}else if(xe.isExpression(t[i])){const r=[];Fe.resolveExpVarNames(r,t[i]);for(let t=0;t<r.length;t++)De(n,e,r[t])}}const r=t[i].stops;if(r&&r.length)for(let t=0;t<r.length;t++)T(r[t][1])&&De(n,t,r[t][1].property)}return n[e]}function Je(t,n){Ye(t.geometry,n)}function Ye(t,n){if(t)switch(t.type){case"Point":qe(t.coordinates,n);break;case"MultiPoint":case"LineString":Re(t.coordinates,n);break;case"MultiLineString":!function(t,n){for(let e=0,i=t.length;e<i;e++)Re(t[e],n)}(t.coordinates,n);break;case"Polygon":He(t.coordinates,n);break;case"MultiPolygon":!function(t,n){for(let e=0,i=t.length;e<i;e++)He(t[e],n)}(t.coordinates,n);break;case"GeometryCollection":const e=t.geometries.length;for(let i=0;i<e;i++)Ye(t.geometries[i],n)}}function qe(t,n){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function Re(t,n){for(let e=0,i=t.length;e<i;e++)qe(t[e],n)}function He(t,n){t.length&&Re(t[0],n)}function Ze(t,n,e,i,r){We(t,n,e||0,i||t.length-1,r||Qe)}function We(t,n,e,i,r){for(;i>e;){if(i-e>600){var o=i-e+1,s=n-e+1,u=Math.log(o),c=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*c*(o-c)/o)*(s-o/2<0?-1:1);We(t,n,Math.max(e,Math.floor(n-s*c/o+f)),Math.min(i,Math.floor(n+(o-s)*c/o+f)),r)}var a=t[n],l=e,h=i;for(Ke(t,e,n),r(t[i],a)>0&&Ke(t,e,i);l<h;){for(Ke(t,l,h),l++,h--;r(t[l],a)<0;)l++;for(;r(t[h],a)>0;)h--}0===r(t[e],a)?Ke(t,e,h):Ke(t,++h,i),h<=n&&(e=h+1),n<=h&&(i=h-1)}}function Ke(t,n,e){var i=t[n];t[n]=t[e],t[e]=i}function Qe(t,n){return t<n?-1:t>n?1:0}class ti{constructor(t=9){this.N=Math.max(4,t),this.C=Math.max(2,Math.ceil(.4*this.N)),this.clear()}all(){return this.L(this.data,[])}search(t){let n=this.data;const e=[];if(!li(t,n))return e;const i=this.toBBox,r=[];for(;n;){for(let o=0;o<n.children.length;o++){const s=n.children[o],u=n.leaf?i(s):s;li(t,u)&&(n.leaf?e.push(s):ai(t,u)?this.L(s,e):r.push(s))}n=r.pop()}return e}collides(t){let n=this.data;if(!li(t,n))return!1;const e=[];for(;n;){for(let i=0;i<n.children.length;i++){const r=n.children[i],o=n.leaf?this.toBBox(r):r;if(li(t,o)){if(n.leaf||ai(t,o))return!0;e.push(r)}}n=e.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this.C){for(let n=0;n<t.length;n++)this.insert(t[n]);return this}let n=this.U(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this.$(this.data,n);else{if(this.data.height<n.height){const t=this.data;this.data=n,n=t}this.j(n,this.data.height-n.height-1,!0)}else this.data=n;return this}insert(t){return t&&this.j(t,this.data.height-1),this}clear(){return this.data=hi([]),this}remove(t,n){if(!t)return this;let e=this.data;const i=this.toBBox(t),r=[],o=[];let s,u,c;for(;e||r.length;){if(e||(e=r.pop(),u=r[r.length-1],s=o.pop(),c=!0),e.leaf){const i=ni(t,e.children,n);if(-1!==i)return e.children.splice(i,1),r.push(e),this.B(r),this}c||e.leaf||!ai(e,i)?u?(s++,e=u.children[s],c=!1):e=null:(r.push(e),o.push(s),s=0,u=e,e=e.children[0])}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}L(t,n){const e=[];for(;t;)t.leaf?n.push(...t.children):e.push(...t.children),t=e.pop();return n}U(t,n,e,i){const r=e-n+1;let o,s=this.N;if(r<=s)return o=hi(t.slice(n,e+1)),ei(o,this.toBBox),o;i||(i=Math.ceil(Math.log(r)/Math.log(s)),s=Math.ceil(r/Math.pow(s,i-1))),o=hi([]),o.leaf=!1,o.height=i;const u=Math.ceil(r/s),c=u*Math.ceil(Math.sqrt(s));di(t,n,e,c,this.compareMinX);for(let r=n;r<=e;r+=c){const n=Math.min(r+c-1,e);di(t,r,n,u,this.compareMinY);for(let e=r;e<=n;e+=u){const r=Math.min(e+u-1,n);o.children.push(this.U(t,e,r,i-1))}}return ei(o,this.toBBox),o}V(t,n,e,i){for(;i.push(n),!n.leaf&&i.length-1!==e;){let e,i=1/0,s=1/0;for(let u=0;u<n.children.length;u++){const c=n.children[u],f=ui(c),a=(r=t,o=c,(Math.max(o.maxX,r.maxX)-Math.min(o.minX,r.minX))*(Math.max(o.maxY,r.maxY)-Math.min(o.minY,r.minY))-f);a<s?(s=a,i=f<i?f:i,e=c):a===s&&f<i&&(i=f,e=c)}n=e||n.children[0]}var r,o;return n}j(t,n,e){const i=e?t:this.toBBox(t),r=[],o=this.V(i,this.data,n,r);for(o.children.push(t),ri(o,i);n>=0&&r[n].children.length>this.N;)this.G(r,n),n--;this.D(i,r,n)}G(t,n){const e=t[n],i=e.children.length,r=this.C;this.X(e,r,i);const o=this.J(e,r,i),s=hi(e.children.splice(o,e.children.length-o));s.height=e.height,s.leaf=e.leaf,ei(e,this.toBBox),ei(s,this.toBBox),n?t[n-1].children.push(s):this.$(e,s)}$(t,n){this.data=hi([t,n]),this.data.height=t.height+1,this.data.leaf=!1,ei(this.data,this.toBBox)}J(t,n,e){let i,r=1/0,o=1/0;for(let s=n;s<=e-n;s++){const n=ii(t,0,s,this.toBBox),u=ii(t,s,e,this.toBBox),c=fi(n,u),f=ui(n)+ui(u);c<r?(r=c,i=s,o=f<o?f:o):c===r&&f<o&&(o=f,i=s)}return i||e-n}X(t,n,e){const i=t.leaf?this.compareMinX:oi,r=t.leaf?this.compareMinY:si;this.Y(t,n,e,i)<this.Y(t,n,e,r)&&t.children.sort(i)}Y(t,n,e,i){t.children.sort(i);const r=this.toBBox,o=ii(t,0,n,r),s=ii(t,e-n,e,r);let u=ci(o)+ci(s);for(let i=n;i<e-n;i++){const n=t.children[i];ri(o,t.leaf?r(n):n),u+=ci(o)}for(let i=e-n-1;i>=n;i--){const n=t.children[i];ri(s,t.leaf?r(n):n),u+=ci(s)}return u}D(t,n,e){for(let i=e;i>=0;i--)ri(n[i],t)}B(t){for(let n,e=t.length-1;e>=0;e--)0===t[e].children.length?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():ei(t[e],this.toBBox)}}function ni(t,n,e){if(!e)return n.indexOf(t);for(let i=0;i<n.length;i++)if(e(t,n[i]))return i;return-1}function ei(t,n){ii(t,0,t.children.length,n,t)}function ii(t,n,e,i,r){r||(r=hi(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let o=n;o<e;o++){const n=t.children[o];ri(r,t.leaf?i(n):n)}return r}function ri(t,n){return t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),t}function oi(t,n){return t.minX-n.minX}function si(t,n){return t.minY-n.minY}function ui(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function ci(t){return t.maxX-t.minX+(t.maxY-t.minY)}function fi(t,n){const e=Math.max(t.minX,n.minX),i=Math.max(t.minY,n.minY),r=Math.min(t.maxX,n.maxX),o=Math.min(t.maxY,n.maxY);return Math.max(0,r-e)*Math.max(0,o-i)}function ai(t,n){return t.minX<=n.minX&&t.minY<=n.minY&&n.maxX<=t.maxX&&n.maxY<=t.maxY}function li(t,n){return n.minX<=t.maxX&&n.minY<=t.maxY&&n.maxX>=t.minX&&n.maxY>=t.minY}function hi(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function di(t,n,e,i,r){const o=[n,e];for(;o.length;){if((e=o.pop())-(n=o.pop())<=i)continue;const s=n+Math.ceil((e-n)/i/2)*i;Ze(t,s,n,e,r),o.push(n,s,s,e)}}class vi{constructor(t=[],n=yi){if(this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this.q(t)}push(t){this.data.push(t),this.length++,this.R(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this.q(0)),t}peek(){return this.data[0]}R(t){const{data:n,compare:e}=this,i=n[t];for(;t>0;){const r=t-1>>1,o=n[r];if(e(i,o)>=0)break;n[t]=o,t=r}n[t]=i}q(t){const{data:n,compare:e}=this,i=this.length>>1,r=n[t];for(;t<i;){let i=1+(t<<1),o=n[i];const s=i+1;if(s<this.length&&e(n[s],o)<0&&(i=s,o=n[s]),e(o,r)>=0)break;n[t]=o,t=i}n[t]=r}}function yi(t,n){return t<n?-1:t>n?1:0}var pi={exports:{}},Mi=function(t,n,e,i){var r=t[0],o=t[1],s=!1;void 0===e&&(e=0),void 0===i&&(i=n.length);for(var u=(i-e)/2,c=0,f=u-1;c<u;f=c++){var a=n[e+2*c+0],l=n[e+2*c+1],h=n[e+2*f+0],d=n[e+2*f+1];l>o!=d>o&&r<(h-a)*(o-l)/(d-l)+a&&(s=!s)}return s},wi=function(t,n,e,i){var r=t[0],o=t[1],s=!1;void 0===e&&(e=0),void 0===i&&(i=n.length);for(var u=i-e,c=0,f=u-1;c<u;f=c++){var a=n[c+e][0],l=n[c+e][1],h=n[f+e][0],d=n[f+e][1];l>o!=d>o&&r<(h-a)*(o-l)/(d-l)+a&&(s=!s)}return s};pi.exports=function(t,n,e,i){return n.length>0&&Array.isArray(n[0])?wi(t,n,e,i):Mi(t,n,e,i)};var mi=pi.exports.nested=wi;pi.exports.flat=Mi;const gi=11102230246251565e-32,Pi=134217729,xi=(3+8*gi)*gi;function bi(t,n,e,i,r){let o,s,u,c,f=n[0],a=i[0],l=0,h=0;a>f==a>-f?(o=f,f=n[++l]):(o=a,a=i[++h]);let d=0;if(l<t&&h<e)for(a>f==a>-f?(s=f+o,u=o-(s-f),f=n[++l]):(s=a+o,u=o-(s-a),a=i[++h]),o=s,0!==u&&(r[d++]=u);l<t&&h<e;)a>f==a>-f?(s=o+f,c=s-o,u=o-(s-c)+(f-c),f=n[++l]):(s=o+a,c=s-o,u=o-(s-c)+(a-c),a=i[++h]),o=s,0!==u&&(r[d++]=u);for(;l<t;)s=o+f,c=s-o,u=o-(s-c)+(f-c),f=n[++l],o=s,0!==u&&(r[d++]=u);for(;h<e;)s=o+a,c=s-o,u=o-(s-c)+(a-c),a=i[++h],o=s,0!==u&&(r[d++]=u);return 0===o&&0!==d||(r[d++]=o),d}function Si(t){return new Float64Array(t)}const Fi=33306690738754716e-32,Ai=22204460492503146e-32,ki=11093356479670487e-47,Ti=Si(4),_i=Si(8),Ii=Si(12),Oi=Si(16),Ni=Si(4);function Ci(t,n,e,i,r,o){const s=(n-o)*(e-r),u=(t-r)*(i-o),c=s-u;if(0===s||0===u||s>0!=u>0)return c;const f=Math.abs(s+u);return Math.abs(c)>=Fi*f?c:-function(t,n,e,i,r,o,s){let u,c,f,a,l,h,d,v,y,p,M,w,m,g,P,x,b,S;const F=t-r,A=e-r,k=n-o,T=i-o;g=F*T,h=Pi*F,d=h-(h-F),v=F-d,h=Pi*T,y=h-(h-T),p=T-y,P=v*p-(g-d*y-v*y-d*p),x=k*A,h=Pi*k,d=h-(h-k),v=k-d,h=Pi*A,y=h-(h-A),p=A-y,b=v*p-(x-d*y-v*y-d*p),M=P-b,l=P-M,Ti[0]=P-(M+l)+(l-b),w=g+M,l=w-g,m=g-(w-l)+(M-l),M=m-x,l=m-M,Ti[1]=m-(M+l)+(l-x),S=w+M,l=S-w,Ti[2]=w-(S-l)+(M-l),Ti[3]=S;let _=function(t,n){let e=n[0];for(let i=1;i<t;i++)e+=n[i];return e}(4,Ti),I=Ai*s;if(_>=I||-_>=I)return _;if(l=t-F,u=t-(F+l)+(l-r),l=e-A,f=e-(A+l)+(l-r),l=n-k,c=n-(k+l)+(l-o),l=i-T,a=i-(T+l)+(l-o),0===u&&0===c&&0===f&&0===a)return _;if(I=ki*s+xi*Math.abs(_),_+=F*a+T*u-(k*f+A*c),_>=I||-_>=I)return _;g=u*T,h=Pi*u,d=h-(h-u),v=u-d,h=Pi*T,y=h-(h-T),p=T-y,P=v*p-(g-d*y-v*y-d*p),x=c*A,h=Pi*c,d=h-(h-c),v=c-d,h=Pi*A,y=h-(h-A),p=A-y,b=v*p-(x-d*y-v*y-d*p),M=P-b,l=P-M,Ni[0]=P-(M+l)+(l-b),w=g+M,l=w-g,m=g-(w-l)+(M-l),M=m-x,l=m-M,Ni[1]=m-(M+l)+(l-x),S=w+M,l=S-w,Ni[2]=w-(S-l)+(M-l),Ni[3]=S;const O=bi(4,Ti,4,Ni,_i);g=F*a,h=Pi*F,d=h-(h-F),v=F-d,h=Pi*a,y=h-(h-a),p=a-y,P=v*p-(g-d*y-v*y-d*p),x=k*f,h=Pi*k,d=h-(h-k),v=k-d,h=Pi*f,y=h-(h-f),p=f-y,b=v*p-(x-d*y-v*y-d*p),M=P-b,l=P-M,Ni[0]=P-(M+l)+(l-b),w=g+M,l=w-g,m=g-(w-l)+(M-l),M=m-x,l=m-M,Ni[1]=m-(M+l)+(l-x),S=w+M,l=S-w,Ni[2]=w-(S-l)+(M-l),Ni[3]=S;const N=bi(O,_i,4,Ni,Ii);g=u*a,h=Pi*u,d=h-(h-u),v=u-d,h=Pi*a,y=h-(h-a),p=a-y,P=v*p-(g-d*y-v*y-d*p),x=c*f,h=Pi*c,d=h-(h-c),v=c-d,h=Pi*f,y=h-(h-f),p=f-y,b=v*p-(x-d*y-v*y-d*p),M=P-b,l=P-M,Ni[0]=P-(M+l)+(l-b),w=g+M,l=w-g,m=g-(w-l)+(M-l),M=m-x,l=m-M,Ni[1]=m-(M+l)+(l-x),S=w+M,l=S-w,Ni[2]=w-(S-l)+(M-l),Ni[3]=S;const C=bi(N,Ii,4,Ni,Oi);return Oi[C-1]}(t,n,e,i,r,o,f)}function Li(t,n,e){n=Math.max(0,void 0===n?2:n),e=e||0;var i=function(t){for(var n=t[0],e=t[0],i=t[0],r=t[0],o=0;o<t.length;o++){var s=t[o];s[0]<n[0]&&(n=s),s[0]>i[0]&&(i=s),s[1]<e[1]&&(e=s),s[1]>r[1]&&(r=s)}var u=[n,e,i,r],c=u.slice();for(o=0;o<t.length;o++)mi(t[o],u)||c.push(t[o]);return function(t){t.sort(Yi);for(var n=[],e=0;e<t.length;e++){for(;n.length>=2&&Vi(n[n.length-2],n[n.length-1],t[e])<=0;)n.pop();n.push(t[e])}for(var i=[],r=t.length-1;r>=0;r--){for(;i.length>=2&&Vi(i[i.length-2],i[i.length-1],t[r])<=0;)i.pop();i.push(t[r])}return i.pop(),n.pop(),n.concat(i)}(c)}(t),r=new ti(16);r.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},r.compareMinX=function(t,n){return t[0]-n[0]},r.compareMinY=function(t,n){return t[1]-n[1]},r.load(t);for(var o,s=[],u=0;u<i.length;u++){var c=i[u];r.remove(c),o=Di(c,o),s.push(o)}var f=new ti(16);for(u=0;u<s.length;u++)f.insert(Gi(s[u]));for(var a=n*n,l=e*e;s.length;){var h=s.shift(),d=h.p,v=h.next.p,y=Xi(d,v);if(!(y<l)){var p=y/a;(c=Ei(r,h.prev.p,d,v,h.next.next.p,p,f))&&Math.min(Xi(c,d),Xi(c,v))<=p&&(s.push(h),s.push(Di(c,h)),r.remove(c),f.remove(h),f.insert(Gi(h)),f.insert(Gi(h.next)))}}h=o;var M=[];do{M.push(h.p),h=h.next}while(h!==o);return M.push(h.p),M}function Ei(t,n,e,i,r,o,s){for(var u=new vi([],Ui),c=t.data;c;){for(var f=0;f<c.children.length;f++){var a=c.children[f],l=c.leaf?zi(a,e,i):$i(e,i,a);l>o||u.push({node:a,dist:l})}for(;u.length&&!u.peek().node.children;){var h=u.pop(),d=h.node,v=zi(d,n,e),y=zi(d,i,r);if(h.dist<v&&h.dist<y&&Bi(e,d,s)&&Bi(i,d,s))return d}(c=u.pop())&&(c=c.node)}return null}function Ui(t,n){return t.dist-n.dist}function $i(t,n,e){if(ji(t,e)||ji(n,e))return 0;var i=Ji(t[0],t[1],n[0],n[1],e.minX,e.minY,e.maxX,e.minY);if(0===i)return 0;var r=Ji(t[0],t[1],n[0],n[1],e.minX,e.minY,e.minX,e.maxY);if(0===r)return 0;var o=Ji(t[0],t[1],n[0],n[1],e.maxX,e.minY,e.maxX,e.maxY);if(0===o)return 0;var s=Ji(t[0],t[1],n[0],n[1],e.minX,e.maxY,e.maxX,e.maxY);return 0===s?0:Math.min(i,r,o,s)}function ji(t,n){return t[0]>=n.minX&&t[0]<=n.maxX&&t[1]>=n.minY&&t[1]<=n.maxY}function Bi(t,n,e){for(var i,r,o,s,u=Math.min(t[0],n[0]),c=Math.min(t[1],n[1]),f=Math.max(t[0],n[0]),a=Math.max(t[1],n[1]),l=e.search({minX:u,minY:c,maxX:f,maxY:a}),h=0;h<l.length;h++)if(i=l[h].p,r=l[h].next.p,o=t,i!==(s=n)&&r!==o&&Vi(i,r,o)>0!=Vi(i,r,s)>0&&Vi(o,s,i)>0!=Vi(o,s,r)>0)return!1;return!0}function Vi(t,n,e){return Ci(t[0],t[1],n[0],n[1],e[0],e[1])}function Gi(t){var n=t.p,e=t.next.p;return t.minX=Math.min(n[0],e[0]),t.minY=Math.min(n[1],e[1]),t.maxX=Math.max(n[0],e[0]),t.maxY=Math.max(n[1],e[1]),t}function Di(t,n){var e={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return n?(e.next=n.next,e.prev=n,n.next.prev=e,n.next=e):(e.prev=e,e.next=e),e}function Xi(t,n){var e=t[0]-n[0],i=t[1]-n[1];return e*e+i*i}function zi(t,n,e){var i=n[0],r=n[1],o=e[0]-i,s=e[1]-r;if(0!==o||0!==s){var u=((t[0]-i)*o+(t[1]-r)*s)/(o*o+s*s);u>1?(i=e[0],r=e[1]):u>0&&(i+=o*u,r+=s*u)}return(o=t[0]-i)*o+(s=t[1]-r)*s}function Ji(t,n,e,i,r,o,s,u){var c,f,a,l,h=e-t,d=i-n,v=s-r,y=u-o,p=t-r,M=n-o,w=h*h+d*d,m=h*v+d*y,g=v*v+y*y,P=h*p+d*M,x=v*p+y*M,b=w*g-m*m,S=b,F=b;0===b?(f=0,S=1,l=x,F=g):(l=w*x-m*P,(f=m*x-g*P)<0?(f=0,l=x,F=g):f>S&&(f=S,l=x+m,F=g)),l<0?(l=0,-P<0?f=0:-P>w?f=S:(f=-P,S=w)):l>F&&(l=F,-P+m<0?f=0:-P+m>w?f=S:(f=-P+m,S=w));var A=(1-(a=0===l?0:l/F))*r+a*s-((1-(c=0===f?0:f/S))*t+c*e),k=(1-a)*o+a*u-((1-c)*n+c*i);return A*A+k*k}function Yi(t,n){return t[0]===n[0]?t[1]-n[1]:t[0]-n[0]}const{PackUtil:qi}=en();class Ri{constructor(t,n){this.x=t,this.y=n}clone(){return new Ri(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 Ri(this.x-t.x,this.y-t.y)}distance(t){const n=this.x-t.x,e=this.y-t.y;return Math.sqrt(n*n+e*e)}dot(t){return this.x*t.x+this.y*t.y}equals(t){return this.x===t.x&&this.y===t.y}orthogonal(){return new Ri(this.y,-this.x)}}function Hi(t,n,e,i){const r=n.x*i.y-n.y*i.x,o=e.x-t.x,s=e.y-t.y,u=(o*i.y-s*i.x)/r;return new Ri(t.x+u*n.x,t.y+u*n.y)}const Zi=[],Wi=[];function Ki(t){if(S(t[0]&&t[0].x)){const n=[];let e=0;for(let i=0;i<t.length;i++)Wi[e]?(Wi[e][0]=t[i].x,Wi[e][1]=t[i].y):Wi[e]=[t[i].x,t[i].y],n.push(Wi[e]),e++;t=n}try{const n=Li(t,1/0);let e=[1/0,1/0],i=[-1/0,-1/0];for(let t=0;t<n.length;t++)n[t][0]<e[0]&&(e[0]=n[t][0]),n[t][0]>i[0]&&(i[0]=n[t][0]),n[t][1]<e[1]&&(e[1]=n[t][1]),n[t][1]>i[1]&&(i[1]=n[t][1]);const r=[];let o=[],s=0;for(let t=0;t<n.length;t++)t===n.length-1&&n[t][0]===n[0][0]&&n[t][1]===n[0][1]||(gt(r,n[t],"EPSG:3857"),Zi[s]?(Zi[s].x=r[0],Zi[s].y=r[1]):Zi[s]=new Ri(r[0],r[1]),o.push(Zi[s]),s++);qi.calculateSignedArea(o)<0&&(o=o.reverse());const u=function(t){let n,e=Number.MAX_VALUE;const i=function(t,i,r,o,s,u,c,f){var a=Hi(t,i,s,u),l=Hi(r,o,s,u),h=Hi(c,f,t,i),d=Hi(c,f,r,o),v=a.distance(l)*a.distance(h);0!==v&&v<e&&(n=[a,h,d,l],e=v)};var r=[];for(let n=0;n<t.length;n++)r.push(t[(n+1)%t.length].diff(t[n])),r[n].normalize();var o,s,u,c,f=new Ri(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),a=new Ri(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let n=0;n<t.length;n++){var l=t[n];l.x<f.x&&(f.x=l.x,o=n),l.x>a.x&&(a.x=l.x,s=n),l.y<f.y&&(f.y=l.y,c=n),l.y>a.y&&(a.y=l.y,u=n)}var h=new Ri(0,-1),d=new Ri(0,1),v=new Ri(-1,0),y=new Ri(1,0);for(let n=0;n<t.length;n++){var p=[Math.acos(h.dot(r[o])),Math.acos(d.dot(r[s])),Math.acos(v.dot(r[u])),Math.acos(y.dot(r[c]))];switch(p.indexOf(Math.min.apply(Math,p))){case 0:(d=(h=r[o].clone()).clone()).negate(),(y=(v=h.orthogonal()).clone()).negate(),o=(o+1)%t.length;break;case 1:(h=(d=r[s].clone()).clone()).negate(),(y=(v=h.orthogonal()).clone()).negate(),s=(s+1)%t.length;break;case 2:(y=(v=r[u].clone()).clone()).negate(),(d=(h=y.orthogonal()).clone()).negate(),u=(u+1)%t.length;break;case 3:(v=(y=r[c].clone()).clone()).negate(),(d=(h=y.orthogonal()).clone()).negate(),c=(c+1)%t.length}i(t[o],h,t[s],d,t[u],v,t[c],y)}return n}(o);if(!u||4!==u.length)return null;const c=u[0].distance(u[1]),f=u[1].distance(u[2]),a=u.map((t=>[t.x,t.y]));return a.push(+(f>c)),a}catch(t){return null}}const Qi=[];function tr(t,n){const e=Array.isArray(t&&t[0]&&t[0][0]);for(let i=0;i<t.length;i++)e?t[i]=tr(t[i]):(gt(Qi,t[i],n),t[i][0]=Qi[0],t[i][1]=Qi[1]);return t}const{PackUtil:nr}=en();class er extends Ie{constructor(t,n,e,i,r,o){super(t,n,e,i,r),(n=n||{}).extent||(n.extent=8192),this.setData(n.data,o)}setData(t,n){if(delete this.index,function(t){if(!t)return!0;if(Array.isArray(t)&&!t.length)return!0;if(t.features&&!t.features.length)return!0;return!1}(t))return this.empty=!0,void n();const e={maxZoom:24,tolerance:this.options.simplifyTolerance,extent:this.options.extent,buffer: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&&(e.projection=this.options.projection,"EPSG:4490"===e.projection&&(e.projection="EPSG:4326")),b(t)&&"{"!=t.substring(0,1)||t.url){const i=t.url?t.url:t;I.getJSON(i,t.url?t:{},((t,r)=>{if(t&&(console.error("Failed to fetch geojson:"+i),n(t)),!r)return void n(null,{extent:null,idMap:{}});let o=r;if(this.options.convertFn){o=new Function("data",this.options.convertFn+"\\nreturn convert(data)")(o)}const s=Array.isArray(o)?o:o.features;this.H(s);const{sample1000:u,idMap:c}=this.Z(s);this.W(u,c,o,e,n)}))}else{"string"==typeof t&&(t=JSON.parse(t));const i=Array.isArray(t)?t:t.features,r=i&&i.length;this.H(i);let o=i;if(i&&r>1e3){o=[];for(let t=0;t<r;t++)ir(i[t],o,t,r)}this.W(o,null,t,e,n)}}H(t){if(this.options.generateOMBB&&t)for(let n=0;n<t.length;n++){const e=t[n];if(e&&e.geometry&&e.geometry.coordinates)if("Polygon"===e.geometry.type){const t=e.geometry.coordinates[0];if(!t)continue;const n=Ki(t,t.length);e.properties=e.properties||{},e.properties[nn]=n}else if("MultiPolygon"===e.geometry.type){const t=e.geometry.coordinates;for(let n=0;n<t.length;n++){if(!t[n])continue;const i=t[n][0];if(!i)continue;const r=Ki(i,i.length);e.properties=e.properties||{},e.properties[nn]=e.properties[nn]||[],e.properties[nn][n]=r}}}}W(t,n,e,i,r){try{const o=t&&t.length?function(t){let n=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];switch(t.type){case"FeatureCollection":const e=t.features.length;for(let i=0;i<e;i++)Je(t.features[i],n);break;case"Feature":Je(t,n);break;default:Ye(t,n)}return n}({type:"FeatureCollection",features:t}):null;this.index=function(t,n){return new st(t,n)}(e,this.options.geojsonvt||i),r(null,{extent:o,idMap:n})}catch(t){console.warn(t),r({error:t.message})}}Z(t){const n=[],e={};let i=0;const r=this.options.featureIdProperty;if(t){const o=t.length;t.forEach(((t,s)=>{!function(t,o,s){if(t&&("Feature"!==t.type||t.geometry)){if(S(t.id)||(t.id=i++),r){let n=r;A(r)&&(n=r[t.layer||"0"]),t.id=t.properties[n]}e[t.id]=x({},t),t.geometry?(e[t.id].geometry=x({},t.geometry),e[t.id].geometry.coordinates=null):t.coordinates&&(e[t.id].coordinates=null),ir(t,n,o,s)}}(t,s,o)}))}return{sample1000:n,idMap:e}}getTileFeatures(t,n){const e=t.tileInfo,i=[];if(!this.index)return this.empty?(setTimeout((function(){n(null,i,[])}),1),1):(setTimeout((function(){n({loading:!0})}),1),1);const r=this.index.getTile(e.z,e.x,e.y);if(!r||0===r.features.length)return setTimeout((function(){n(null,i,[])}),1),1;const o=[];for(let t=0,n=r.features.length;t<n;t++){const n=r.features[t];let e=n.layer;void 0===e&&(e="0"),o[e]={types:{}};o[e].types[n.type]=1,n.tags=n.tags||{},n.geometry.converted||(nr.convertGeometry(n),n.geometry.converted=1),i.push({type:n.type,layer:e,id:n.id,geometry:n.geometry,properties:n.tags,extent:this.options.extent})}for(const t in o)o[t].types=Object.keys(o[t].types).map((t=>+t));return setTimeout((function(){n(null,i,o)}),1),1}onRemove(){super.onRemove(),delete this.index}}function ir(t,n,e,i){const r=Math.floor(i/998);(0===e||e===i-1||(0===r||e%r==0)&&n.length<999)&&n.push(t)}var rr={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,n,e,i,r){var o,s,u=8*r-i-1,c=(1<<u)-1,f=c>>1,a=-7,l=e?r-1:0,h=e?-1:1,d=t[n+l];for(l+=h,o=d&(1<<-a)-1,d>>=-a,a+=u;a>0;o=256*o+t[n+l],l+=h,a-=8);for(s=o&(1<<-a)-1,o>>=-a,a+=i;a>0;s=256*s+t[n+l],l+=h,a-=8);if(0===o)o=1-f;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),o-=f}return(d?-1:1)*s*Math.pow(2,o-i)},write:function(t,n,e,i,r,o){var s,u,c,f=8*o-r-1,a=(1<<f)-1,l=a>>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:o-1,v=i?1:-1,y=n<0||0===n&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(u=isNaN(n)?1:0,s=a):(s=Math.floor(Math.log(n)/Math.LN2),n*(c=Math.pow(2,-s))<1&&(s--,c*=2),(n+=s+l>=1?h/c:h*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=a?(u=0,s=a):s+l>=1?(u=(n*c-1)*Math.pow(2,r),s+=l):(u=n*Math.pow(2,l-1)*Math.pow(2,r),s=0));r>=8;t[e+d]=255&u,d+=v,u/=256,r-=8);for(s=s<<r|u,f+=r;f>0;t[e+d]=255&s,d+=v,s/=256,f-=8);t[e+d-v]|=128*y}},or=ur,sr=rr;function ur(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}ur.Varint=0,ur.Fixed64=1,ur.Bytes=2,ur.Fixed32=5;var cr=4294967296,fr=1/cr,ar="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function lr(t){return t.type===ur.Bytes?t.readVarint()+t.pos:t.pos+1}function hr(t,n,e){return e?4294967296*n+(t>>>0):4294967296*(n>>>0)+(t>>>0)}function dr(t,n,e){var i=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));e.realloc(i);for(var r=e.pos-1;r>=t;r--)e.buf[r+i]=e.buf[r]}function vr(t,n){for(var e=0;e<t.length;e++)n.writeVarint(t[e])}function yr(t,n){for(var e=0;e<t.length;e++)n.writeSVarint(t[e])}function pr(t,n){for(var e=0;e<t.length;e++)n.writeFloat(t[e])}function Mr(t,n){for(var e=0;e<t.length;e++)n.writeDouble(t[e])}function wr(t,n){for(var e=0;e<t.length;e++)n.writeBoolean(t[e])}function mr(t,n){for(var e=0;e<t.length;e++)n.writeFixed32(t[e])}function gr(t,n){for(var e=0;e<t.length;e++)n.writeSFixed32(t[e])}function Pr(t,n){for(var e=0;e<t.length;e++)n.writeFixed64(t[e])}function xr(t,n){for(var e=0;e<t.length;e++)n.writeSFixed64(t[e])}function br(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+16777216*t[n+3]}function Sr(t,n,e){t[e]=n,t[e+1]=n>>>8,t[e+2]=n>>>16,t[e+3]=n>>>24}function Fr(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+(t[n+3]<<24)}ur.prototype={destroy:function(){this.buf=null},readFields:function(t,n,e){for(e=e||this.length;this.pos<e;){var i=this.readVarint(),r=i>>3,o=this.pos;this.type=7&i,t(r,n,this),this.pos===o&&this.skip(i)}return n},readMessage:function(t,n){return this.readFields(t,n,this.readVarint()+this.pos)},readFixed32:function(){var t=br(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Fr(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=br(this.buf,this.pos)+br(this.buf,this.pos+4)*cr;return this.pos+=8,t},readSFixed64:function(){var t=br(this.buf,this.pos)+Fr(this.buf,this.pos+4)*cr;return this.pos+=8,t},readFloat:function(){var t=sr.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=sr.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var n,e,i=this.buf;return n=127&(e=i[this.pos++]),e<128?n:(n|=(127&(e=i[this.pos++]))<<7,e<128?n:(n|=(127&(e=i[this.pos++]))<<14,e<128?n:(n|=(127&(e=i[this.pos++]))<<21,e<128?n:function(t,n,e){var i,r,o=e.buf;if(r=o[e.pos++],i=(112&r)>>4,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(127&r)<<3,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(127&r)<<10,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(127&r)<<17,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(127&r)<<24,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(1&r)<<31,r<128)return hr(t,i,n);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(e=i[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,n=this.pos;return this.pos=t,t-n>=12&&ar?function(t,n,e){return ar.decode(t.subarray(n,e))}(this.buf,n,t):function(t,n,e){var i="",r=n;for(;r<e;){var o,s,u,c=t[r],f=null,a=c>239?4:c>223?3:c>191?2:1;if(r+a>e)break;1===a?c<128&&(f=c):2===a?128==(192&(o=t[r+1]))&&(f=(31&c)<<6|63&o)<=127&&(f=null):3===a?(o=t[r+1],s=t[r+2],128==(192&o)&&128==(192&s)&&((f=(15&c)<<12|(63&o)<<6|63&s)<=2047||f>=55296&&f<=57343)&&(f=null)):4===a&&(o=t[r+1],s=t[r+2],u=t[r+3],128==(192&o)&&128==(192&s)&&128==(192&u)&&((f=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&u)<=65535||f>=1114112)&&(f=null)),null===f?(f=65533,a=1):f>65535&&(f-=65536,i+=String.fromCharCode(f>>>10&1023|55296),f=56320|1023&f),i+=String.fromCharCode(f),r+=a}return i}(this.buf,n,t)},readBytes:function(){var t=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,t);return this.pos=t,n},readPackedVarint:function(t,n){if(this.type!==ur.Bytes)return t.push(this.readVarint(n));var e=lr(this);for(t=t||[];this.pos<e;)t.push(this.readVarint(n));return t},readPackedSVarint:function(t){if(this.type!==ur.Bytes)return t.push(this.readSVarint());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==ur.Bytes)return t.push(this.readBoolean());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==ur.Bytes)return t.push(this.readFloat());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==ur.Bytes)return t.push(this.readDouble());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==ur.Bytes)return t.push(this.readFixed32());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==ur.Bytes)return t.push(this.readSFixed32());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==ur.Bytes)return t.push(this.readFixed64());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==ur.Bytes)return t.push(this.readSFixed64());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed64());return t},skip:function(t){var n=7&t;if(n===ur.Varint)for(;this.buf[this.pos++]>127;);else if(n===ur.Bytes)this.pos=this.readVarint()+this.pos;else if(n===ur.Fixed32)this.pos+=4;else{if(n!==ur.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(t,n){this.writeVarint(t<<3|n)},realloc:function(t){for(var n=this.length||16;n<this.pos+t;)n*=2;if(n!==this.length){var e=new Uint8Array(n);e.set(this.buf),this.buf=e,this.length=n}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Sr(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Sr(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Sr(this.buf,-1&t,this.pos),Sr(this.buf,Math.floor(t*fr),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Sr(this.buf,-1&t,this.pos),Sr(this.buf,Math.floor(t*fr),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,n){var e,i;t>=0?(e=t%4294967296|0,i=t/4294967296|0):(i=~(-t/4294967296),4294967295^(e=~(-t%4294967296))?e=e+1|0:(e=0,i=i+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");n.realloc(10),function(t,n,e){e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos]=127&t}(e,0,n),function(t,n){var e=(7&t)<<4;if(n.buf[n.pos++]|=e|((t>>>=3)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;n.buf[n.pos++]=127&t}(i,n)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var n=this.pos;this.pos=function(t,n,e){for(var i,r,o=0;o<n.length;o++){if((i=n.charCodeAt(o))>55295&&i<57344){if(!r){i>56319||o+1===n.length?(t[e++]=239,t[e++]=191,t[e++]=189):r=i;continue}if(i<56320){t[e++]=239,t[e++]=191,t[e++]=189,r=i;continue}i=r-55296<<10|i-56320|65536,r=null}else r&&(t[e++]=239,t[e++]=191,t[e++]=189,r=null);i<128?t[e++]=i:(i<2048?t[e++]=i>>6|192:(i<65536?t[e++]=i>>12|224:(t[e++]=i>>18|240,t[e++]=i>>12&63|128),t[e++]=i>>6&63|128),t[e++]=63&i|128)}return e}(this.buf,t,this.pos);var e=this.pos-n;e>=128&&dr(n,e,this),this.pos=n-1,this.writeVarint(e),this.pos+=e},writeFloat:function(t){this.realloc(4),sr.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),sr.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var n=t.length;this.writeVarint(n),this.realloc(n);for(var e=0;e<n;e++)this.buf[this.pos++]=t[e]},writeRawMessage:function(t,n){this.pos++;var e=this.pos;t(n,this);var i=this.pos-e;i>=128&&dr(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeMessage:function(t,n,e){this.writeTag(t,ur.Bytes),this.writeRawMessage(n,e)},writePackedVarint:function(t,n){n.length&&this.writeMessage(t,vr,n)},writePackedSVarint:function(t,n){n.length&&this.writeMessage(t,yr,n)},writePackedBoolean:function(t,n){n.length&&this.writeMessage(t,wr,n)},writePackedFloat:function(t,n){n.length&&this.writeMessage(t,pr,n)},writePackedDouble:function(t,n){n.length&&this.writeMessage(t,Mr,n)},writePackedFixed32:function(t,n){n.length&&this.writeMessage(t,mr,n)},writePackedSFixed32:function(t,n){n.length&&this.writeMessage(t,gr,n)},writePackedFixed64:function(t,n){n.length&&this.writeMessage(t,Pr,n)},writePackedSFixed64:function(t,n){n.length&&this.writeMessage(t,xr,n)},writeBytesField:function(t,n){this.writeTag(t,ur.Bytes),this.writeBytes(n)},writeFixed32Field:function(t,n){this.writeTag(t,ur.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(t,n){this.writeTag(t,ur.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(t,n){this.writeTag(t,ur.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(t,n){this.writeTag(t,ur.Fixed64),this.writeSFixed64(n)},writeVarintField:function(t,n){this.writeTag(t,ur.Varint),this.writeVarint(n)},writeSVarintField:function(t,n){this.writeTag(t,ur.Varint),this.writeSVarint(n)},writeStringField:function(t,n){this.writeTag(t,ur.Bytes),this.writeString(n)},writeFloatField:function(t,n){this.writeTag(t,ur.Fixed32),this.writeFloat(n)},writeDoubleField:function(t,n){this.writeTag(t,ur.Fixed64),this.writeDouble(n)},writeBooleanField:function(t,n){this.writeVarintField(t,Boolean(n))}};var Ar=Ft(or),kr=Tr;function Tr(t,n){this.x=t,this.y=n}Tr.prototype={clone:function(){return new Tr(this.x,this.y)},add:function(t){return this.clone().K(t)},sub:function(t){return this.clone().tt(t)},multByPoint:function(t){return this.clone().nt(t)},divByPoint:function(t){return this.clone().et(t)},mult:function(t){return this.clone().it(t)},div:function(t){return this.clone().rt(t)},rotate:function(t){return this.clone().ot(t)},rotateAround:function(t,n){return this.clone().st(t,n)},matMult:function(t){return this.clone().ut(t)},unit:function(){return this.clone().ct()},perp:function(){return this.clone().ft()},round:function(){return this.clone().lt()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var n=t.x-this.x,e=t.y-this.y;return n*n+e*e},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},ut:function(t){var n=t[0]*this.x+t[1]*this.y,e=t[2]*this.x+t[3]*this.y;return this.x=n,this.y=e,this},K:function(t){return this.x+=t.x,this.y+=t.y,this},tt:function(t){return this.x-=t.x,this.y-=t.y,this},it:function(t){return this.x*=t,this.y*=t,this},rt:function(t){return this.x/=t,this.y/=t,this},nt:function(t){return this.x*=t.x,this.y*=t.y,this},et:function(t){return this.x/=t.x,this.y/=t.y,this},ct:function(){return this.rt(this.mag()),this},ft:function(){var t=this.y;return this.y=this.x,this.x=-t,this},ot:function(t){var n=Math.cos(t),e=Math.sin(t),i=n*this.x-e*this.y,r=e*this.x+n*this.y;return this.x=i,this.y=r,this},st:function(t,n){var e=Math.cos(t),i=Math.sin(t),r=n.x+e*(this.x-n.x)-i*(this.y-n.y),o=n.y+i*(this.x-n.x)+e*(this.y-n.y);return this.x=r,this.y=o,this},lt:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Tr.convert=function(t){return t instanceof Tr?t:Array.isArray(t)?new Tr(t[0],t[1]):t};var _r=kr,Ir=Or;function Or(t,n,e,i,r){this.properties={},this.extent=e,this.type=0,this.ht=t,this.dt=-1,this.vt=i,this.yt=r,t.readFields(Nr,this,n)}function Nr(t,n,e){1==t?n.id=e.readVarint():2==t?function(t,n){var e=t.readVarint()+t.pos;for(;t.pos<e;){var i=n.vt[t.readVarint()],r=n.yt[t.readVarint()];n.properties[i]=r}}(e,n):3==t?n.type=e.readVarint():4==t&&(n.dt=e.pos)}function Cr(t){for(var n,e,i=0,r=0,o=t.length,s=o-1;r<o;s=r++)n=t[r],i+=((e=t[s]).x-n.x)*(n.y+e.y);return i}Or.types=["Unknown","Point","LineString","Polygon"],Or.prototype.loadGeometry=function(){var t=this.ht;t.pos=this.dt;for(var n,e=t.readVarint()+t.pos,i=1,r=0,o=0,s=0,u=[];t.pos<e;){if(r<=0){var c=t.readVarint();i=7&c,r=c>>3}if(r--,1===i||2===i)o+=t.readSVarint(),s+=t.readSVarint(),1===i&&(n&&u.push(n),n=[]),n.push(new _r(o,s));else{if(7!==i)throw new Error("unknown command "+i);n&&n.push(n[0].clone())}}return n&&u.push(n),u},Or.prototype.bbox=function(){var t=this.ht;t.pos=this.dt;for(var n=t.readVarint()+t.pos,e=1,i=0,r=0,o=0,s=1/0,u=-1/0,c=1/0,f=-1/0;t.pos<n;){if(i<=0){var a=t.readVarint();e=7&a,i=a>>3}if(i--,1===e||2===e)(r+=t.readSVarint())<s&&(s=r),r>u&&(u=r),(o+=t.readSVarint())<c&&(c=o),o>f&&(f=o);else if(7!==e)throw new Error("unknown command "+e)}return[s,c,u,f]},Or.prototype.toGeoJSON=function(t,n,e){var i,r,o=this.extent*Math.pow(2,e),s=this.extent*t,u=this.extent*n,c=this.loadGeometry(),f=Or.types[this.type];function a(t){for(var n=0;n<t.length;n++){var e=t[n],i=180-360*(e.y+u)/o;t[n]=[360*(e.x+s)/o-180,360/Math.PI*Math.atan(Math.exp(i*Math.PI/180))-90]}}switch(this.type){case 1:var l=[];for(i=0;i<c.length;i++)l[i]=c[i][0];a(c=l);break;case 2:for(i=0;i<c.length;i++)a(c[i]);break;case 3:for(c=function(t){var n=t.length;if(n<=1)return[t];for(var e,i,r=[],o=0;o<n;o++){var s=Cr(t[o]);0!==s&&(void 0===i&&(i=s<0),i===s<0?(e&&r.push(e),e=[t[o]]):e.push(t[o]))}e&&r.push(e);return r}(c),i=0;i<c.length;i++)for(r=0;r<c[i].length;r++)a(c[i][r])}1===c.length?c=c[0]:f="Multi"+f;var h={type:"Feature",geometry:{type:f,coordinates:c},properties:this.properties};return"id"in this&&(h.id=this.id),h};var Lr=Ir,Er=Ur;function Ur(t,n){this.version=1,this.name=null,this.extent=4096,this.length=0,this.ht=t,this.vt=[],this.yt=[],this.Mt=[],t.readFields($r,this,n),this.length=this.Mt.length}function $r(t,n,e){15===t?n.version=e.readVarint():1===t?n.name=e.readString():5===t?n.extent=e.readVarint():2===t?n.Mt.push(e.pos):3===t?n.vt.push(e.readString()):4===t&&n.yt.push(function(t){var n=null,e=t.readVarint()+t.pos;for(;t.pos<e;){var i=t.readVarint()>>3;n=1===i?t.readString():2===i?t.readFloat():3===i?t.readDouble():4===i?t.readVarint64():5===i?t.readVarint():6===i?t.readSVarint():7===i?t.readBoolean():null}return n}(e))}Ur.prototype.feature=function(t){if(t<0||t>=this.Mt.length)throw new Error("feature index out of bounds");this.ht.pos=this.Mt[t];var n=this.ht.readVarint()+this.ht.pos;return new Lr(this.ht,n,this.extent,this.vt,this.yt)};var jr=Er,Br=function(t,n){this.layers=t.readFields(Vr,{},n)};function Vr(t,n,e){if(3===t){var i=new jr(e,e.readVarint()+e.pos);i.length&&(n[i.name]=i)}}var Gr=Br;const Dr=2;class Xr extends Ie{constructor(t,n,e,i,r,o){super(t,n,e,i,r),n=n||{},o()}getTileFeatures(t,n){const e=t.tileInfo.url,i=t.fetchOptions||{},{altitudePropertyName:r,disableAltitudeWarning:o}=t,s=this.M.get(e);if(s&&s.cacheIndex===t.workerCacheIndex){const{err:t,data:i}=s;return setTimeout((()=>{this.wt(e,t,i,n)}),1)}const{tileArrayBuffer:u}=t;return u?setTimeout((()=>{this.wt(e,r,o,null,u,n)}),1):(i.referrer=t.referrer,I.getArrayBuffer(e,i,((i,s)=>{this.M&&(i?i.loading||this.M.add(e,{err:i,data:s&&s.data,cacheIndex:t.workerCacheIndex}):s&&s.data&&this.M.add(e,{err:null,data:s.data,cacheIndex:t.workerCacheIndex}),this.wt(e,r,o,i,s&&s.data,n))})))}wt(t,n,e,i,r,o){if(i)return void o(i);let s;try{s=new Gr(new Ar(r))}catch(i){return void o(i.message,[],[])}const u=[];if(!s.layers)return void o(null,u,[]);const c={};let f;for(const t in s.layers)if(a=s.layers,l=t,Object.prototype.hasOwnProperty.call(a,l)){c[t]={types:{}};const r=c[t].types;for(let o=0,c=s.layers[t].length;o<c;o++)try{f=s.layers[t].feature(o),r[f.type]=1;const i={type:f.type,layer:t,geometry:f.loadGeometry(),properties:f.properties,extent:f.extent};void 0!==f.id&&(i.id=f.id);let c=i.properties[nn];c&&(b(c)&&(c=JSON.parse(c)),i.properties[nn]=tr(c,"EPSG:3857")),console.log(i.properties);const a=n&&i.properties[n];if(a){const t=zr(a),n=[];Jr(i.geometry,t,n),n.length&&!e&&(console.warn("feature.geometry is not consistent with altitude values:"),console.warn(JSON.stringify(i,null,2)))}u.push(i)}catch(i){console.warn("error when load vt geometry:",i)}}var a,l;for(const t in c)c[t].types=Object.keys(c[t].types).map((t=>+t));o(null,u,c,{byteLength:r.byteLength})}abortTile(t,n){const e=this.requests[t];delete this.requests[t],e&&e.abort&&e.abort(),this.A(t),n()}onRemove(){super.onRemove();for(const t in this.requests){const n=this.requests[t];n&&n.abort&&n.abort()}this.requests={}}}function zr(t){const n=atob(t),e=new Uint8Array(n.length);for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return new Float32Array(e.buffer)}function Jr(t,n,e,i){i||(i={index:0});for(let r=0;r<t.length;r++)if(Array.isArray(t[r]))Jr(t[r],n,e,i);else{const o=i.index;k(n[o])?e.push(Dr):t[r].z=100*n[o],i.index++}}const{LRUCache:Yr}=en();let qr=0;const Rr=new Yr(128);class Hr{constructor(t){this.gt={},this.Pt={},this.workerId=t}addLayer({actorId:t,mapId:n,layerId:e,params:i},r){if(this.xt(n,e))return;const o=this.bt(n,e),s=i.type,u=i.options,c=this.send.bind(this,t);this.gt[o]="GeoJSONVectorTileLayer"===s?new er(e,u,c,Rr,{},r):new Xr(e,u,c,Rr,{},r)}removeLayer({mapId:t,layerId:n},e){const i=this.xt(t,n),r=this.bt(t,n);delete this.gt[r],i&&i.onRemove(e)}loadTile({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.loadTile(e,i)}abortTile({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.abortTile&&r.abortTile(e.url,i)}removeTile({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.removeTile(e,i)}updateStyle({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.updateStyle(e,i)}updateOptions({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.updateOptions(e,i)}setData({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.setData(e.data,i)}receive(t){const n=t.callback,e=this.Pt[n];delete this.Pt[n],e&&t.error?e(new Error(t.error)):e&&e(null,t.data)}send(t,n,e,i,r){const o=r?\`${E}t}-${E}qr++}\`:null;r&&(this.Pt[o]=r),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:n,params:e,callback:String(o)},i||[])}bt(t,n){return\`${E}t}-${E}n}\`}xt(t,n){const e=this.bt(t,n);return this.gt[e]}St(){Rr.reset()}}t.initialize=function(){},t.onmessage=function(t,n){const e=t.data;if(this.dispatcher||(this.dispatcher=new Hr(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const i=e.command;this.dispatcher[i]({actorId:t.actorId,mapId:e.mapId,layerId:e.layerId,params:e.params},((t,e,r)=>{t&&404!==t.status&&204!==t.status&&!t.loading&&console.error(i,t),n(t,e,r)}))}}}`;
|
|
34
|
+
const E = "${", R = `function(t){let n;const e={width:100,height:10};let i=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),i=!0}catch(t){i=!1}function r(){if(!n){const{width:t,height:r}=e;i?n=new OffscreenCanvas(t,r):(n=document.createElement("canvas"),n.width=t,n.height=r)}return n}class o{constructor(t,n={}){if(!Array.isArray(t))return void console.error("colors is not array");if(t.length<2)return void console.error("colors.length should >1");this.colors=t;let i=1/0,r=-1/0;for(let n=0,e=t.length;n<e;n++){const e=t[n][0];i=Math.min(e,i),r=Math.max(e,r)}this.min=i,this.max=r,this.valueOffset=this.max-this.min,this.options=Object.assign({},e,n),this.t()}getImageData(){return this.imgData}t(){const t=r(),{width:n,height:e}=this.options;t.width=n,t.height=e;const i=t.getContext("2d");i.clearRect(0,0,t.width,t.height);const o=i.createLinearGradient(0,0,t.width,0),{colors:s,valueOffset:u}=this;for(let t=0,n=s.length;t<n;t++){const[n,e]=s[t],i=(n-this.min)/u;o.addColorStop(i,e)}i.fillStyle=o,i.fillRect(0,0,t.width,t.height),this.imgData=i.getImageData(0,0,t.width,t.height)}getColor(t){t=Math.max(this.min,t);const n=((t=Math.min(t,this.max))-this.min)/this.valueOffset;let e=Math.round(n*this.imgData.width);e=Math.min(e,this.imgData.width-1);const i=4*e;return[this.imgData.data[i],this.imgData.data[i+1],this.imgData.data[i+2],this.imgData.data[i+3]]}}var s;function u(t,n){var e,i,r;if(M(t)){var o,s=t.stops&&"object"==typeof t.stops[0][0],l=s||void 0!==t.property,y=s||!l,p=t.type||n||"exponential";if("exponential"===p)o=a;else if("interval"===p)o=f;else if("categorical"===p)o=c;else if("identity"===p)o=d;else if("color-interpolate"===p)o=h;else{if("calculate-expression"!==p)throw new Error('Unknown function type "'+p+'"');o=v}if(s){var w={},m=[];for(let n=0;n<t.stops.length;n++){var g=t.stops[n];void 0===w[g[0].zoom]&&(w[g[0].zoom]={zoom:g[0].zoom,type:t.type,property:t.property,default:t.default,stops:[]}),w[g[0].zoom].stops.push([g[0].value,g[1]])}for(let t in w)m.push([w[t].zoom,u(w[t])]);e=function(n,e){const i=a({stops:m,base:t.base},n)(n,e);return"function"==typeof i?i(n,e):i},i=!1,r=!1}else y?(e=function(n){const e=o(t,n);return"function"==typeof e?e(n):e},i=!0,r=!1):(e=function(n,e){const i=o(t,e?e[t.property]:null);return"function"==typeof i?i(n,e):i},i=!1,r=!0)}else e=function(){return t},i=!0,r=!0;return e.isZoomConstant=r,e.isFeatureConstant=i,e}function c(t,n){for(let e=0;e<t.stops.length;e++)if(n===t.stops[e][0])return t.stops[e][1];return t.default}function f(t,n){for(var e=0;e<t.stops.length&&!(n<t.stops[e][0]);e++);return t.stops[Math.max(e-1,0)][1]}function a(t,n){for(var e=void 0!==t.base?t.base:1,i=0;!(i>=t.stops.length||n<=t.stops[i][0]);)i++;return 0===i?t.stops[i][1]:i===t.stops.length?t.stops[i-1][1]:y(n,e,t.stops[i-1][0],t.stops[i][0],t.stops[i-1][1],t.stops[i][1])}"function"==typeof Map&&(s=new Map);const l={width:100,height:1};function h(t,n){const e=t.stops;if(e&&e.length>1){let t;if(s){const n=JSON.stringify(e);if(!s.has(n)){const t=new o(e,l);s.set(n,t)}t=s.get(n)}else t=new o(e,l);const[i,r,u,c]=t.getColor(n);return[i/255,r/255,u/255,c/255]}return e&&1===e.length?e[0][1]:null}function d(t,n){return e=n,i=t.default,void 0!==e?e:void 0!==i?i:null;var e,i}function v(t,n){const e=String(t.property),i=t.expression,r=n;function o(n){return null==n||""===n||isNaN(n)?t.default:n}if(null==n||""===n||isNaN(n)||n<0)return o(t.default);{const n=function t(n,e,i){const r=Number(i),o=String(e);return Array.isArray(n)?n.map((n=>t(n,o,r))):n===o?r:n}(i,e,r);return o(function n(e){if(!Array.isArray(e)){if("number"==typeof e)return e;throw new Error("Invalid expression format")}{const i=e[0];if(!["+","-","*","/"].includes(i))throw new Error(\`Unknown operator: ${E}i}\`);const r=e.slice(1).map((t=>n(t)));switch(i){case"+":return r.reduce(((t,n)=>t+n),0);case"-":return r.reduce(((t,n)=>t-n));case"*":return r.reduce(((t,n)=>t*n),1);case"/":return r.some((t=>0===t))?t.default:r.reduce(((t,n)=>t/n));default:throw new Error(\`Unsupported operator: ${E}i}\`)}}}(n))}}function y(t,n,e,i,r,o){return"function"==typeof r?function(){var s=r.apply(void 0,arguments),u=o.apply(void 0,arguments);return y(t,n,e,i,s,u)}:r.length?function(t,n,e,i,r,o){var s=[];for(let u=0;u<r.length;u++)s[u]=p(t,n,e,i,r[u],o[u]);return s}(t,n,e,i,r,o):p(t,n,e,i,r,o)}function p(t,n,e,i,r,o){var s,u=i-e,c=t-e;return r*(1-(s=1===n?c/u:(Math.pow(n,c)-1)/(Math.pow(n,u)-1)))+o*s}function M(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type||t.expression&&"calculate-expression"===t.type)}function w(t){return m(t,"interval")}function m(t,n){if(!M(t))return function(){return t};let e=!0,i=!0;const r=(t=JSON.parse(JSON.stringify(t))).stops;if(r)for(let t=0;t<r.length;t++)if(M(r[t][1])){const o=m(r[t][1],n);e=e&&o.isZoomConstant,i=i&&o.isFeatureConstant,r[t]=[r[t][0],o]}const o=u(t,n);return o.isZoomConstant=e&&o.isZoomConstant,o.isFeatureConstant=i&&o.isFeatureConstant,o}let g=0;const P="function"==typeof Object.assign;function x(t,...n){if(P)return Object.assign(t,...n),t;for(let e=0;e<n.length;e++){const i=n[e];for(const n in i)t[n]=i[n]}return t}function b(t){return!k(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function S(t){return"number"==typeof t&&!isNaN(t)}function F(t){return!k(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function A(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function k(t){return null==t}function T(t){return M(t)&&t.property}const _="function"==typeof fetch&&"function"==typeof AbortController,I={jsonp:function(t,n){const e="_maptalks_jsonp_"+g++;t.match(/\\?/)?t+="&callback="+e:t+="?callback="+e;let i=document.createElement("script");return i.type="text/javascript",i.src=t,window[e]=function(t){n(null,t),document.getElementsByTagName("head")[0].removeChild(i),i=null,delete window[e]},document.getElementsByTagName("head")[0].appendChild(i),this},get:function(t,n,e){if(F(n)){const t=e;e=n,n=t}(n=n||{}).method&&(n.method=n.method.toUpperCase());const i="POST"===n.method;if(_){const i=new AbortController,r=n;r.signal=i.signal,r.referrerPolicy=r.referrerPolicy||"origin",r.method=r.method||"GET";const o=new Request(t,r);return n.returnJSON&&o.headers.set("Accept","application/json"),fetch(o).then((i=>{const r=this.o(i,n.returnJSON,n.responseType);r.message?(r.url=t,e(r)):r.then((t=>{"arraybuffer"===n.responseType?e(null,{data:t,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),contentType:i.headers.get("Content-Type")}):e(null,t)})).catch((n=>{n.code&&n.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,n),e(n))}))})).catch((n=>{n.code&&n.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,n),e(n))})),i}{const r=I.u(e);if(r.open(n.method||"GET",t,!0),n){for(const t in n.headers)r.setRequestHeader(t,n.headers[t]);r.withCredentials="include"===n.credentials,n.responseType&&(r.responseType=n.responseType)}return r.send(i?n.body:null),r}},o:(t,n,e)=>200!==t.status?{status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${E}t.status}): ${E}t.statusText}\`}:"arraybuffer"===e?t.arrayBuffer():n?t.json():t.text(),l:function(t,n){return function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?n({status:200,statusText:t.statusText,message:"http status 200 returned without content."}):n(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else n(null,t.responseText);else n({status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${E}t.status}): ${E}t.statusText}\`})}},u:function(t){let n;try{n=new XMLHttpRequest}catch(t){try{n=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{n=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}return n.onreadystatechange=I.l(n,t),n},getArrayBuffer(t,n,e){if(F(n)){const t=e;e=n,n=t}return n||(n={}),n.responseType="arraybuffer",I.get(t,n,e)}};function O(t,n,e,i,r=3){let o=i;const s=e-n>>1;let u,c=e-n;const f=t[n],a=t[n+1],l=t[e],h=t[e+1];for(let i=n+r;i<e;i+=r){const n=N(t[i],t[i+1],f,a,l,h);if(n>o)u=i,o=n;else if(n===o){const t=Math.abs(i-s);t<c&&(u=i,c=t)}}o>i&&(u-n>r&&O(t,n,u,i,r),t[u+2]=o,e-u>r&&O(t,u,e,i,r))}function N(t,n,e,i,r,o){let s=r-e,u=o-i;if(0!==s||0!==u){const c=((t-e)*s+(n-i)*u)/(s*s+u*u);c>1?(e=r,i=o):c>0&&(e+=s*c,i+=u*c)}return s=t-e,u=n-i,s*s+u*u}function C(t,n,e,i,r,o){const s={id:null==t?null:t,type:n,geometry:e,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};r&&(s.layer=r);return function(t,n){const e=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)L(t,e,n);else if("Polygon"===i)L(t,e[0],n);else if("MultiLineString"===i)for(const i of e)L(t,i,n);else if("MultiPolygon"===i)for(const i of e)L(t,i[0],n)}(s,o?4:3),s}function L(t,n,e){for(let i=0;i<n.length;i+=e)t.minX=Math.min(t.minX,n[i]),t.minY=Math.min(t.minY,n[i+1]),t.maxX=Math.max(t.maxX,n[i]),t.maxY=Math.max(t.maxY,n[i+1])}function E(t,n,e,i){if(i.layer=n,"FeatureCollection"===e.type)for(let n=0;n<e.features.length;n++)U(t,e.features[n],i,n);else"Feature"===e.type?U(t,e,i):U(t,{geometry:e},i)}function U(t,n,e,i){if(!n.geometry)return;const r=n.geometry.coordinates,o=n.geometry.type,s=Math.pow(e.tolerance/((1<<e.maxZoom)*e.extent),2);let u=[],c=n.id;if(e.promoteId?c=n.properties[e.promoteId]:e.generateId&&(c=i||0),"Point"===o)$(r,u,e);else if("MultiPoint"===o)for(const t of r)$(t,u,e);else if("LineString"===o)j(r,u,s,!1,e);else if("MultiLineString"===o){if(e.lineMetrics){for(const i of r)u=[],j(i,u,s,!1,e),t.push(C(c,"LineString",u,n.properties,e.layer,e.hasAltitude));return}B(r,u,s,!1,e)}else if("Polygon"===o)B(r,u,s,!0,e);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const r of n.geometry.geometries)U(t,{id:c,geometry:r,properties:n.properties},e,i);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const t of r){const n=[];B(t,n,s,!0,e),u.push(n)}}t.push(C(c,o,u,n.properties,e.layer,e.hasAltitude))}function $(t,n,e){n.push(V(t[0]),G(t[1],e.projection),0),e.hasAltitude&&(t.length>2?n.push(t[2]):n.push(0))}function j(t,n,e,i,r){let o,s,u=0;for(let e=0;e<t.length;e++){const c=V(t[e][0]),f=G(t[e][1],r.projection);n.push(c,f,0),r.hasAltitude&&(t[e].length>2?n.push(t[e][2]):n.push(0)),e>0&&(u+=i?(o*f-c*s)/2:Math.sqrt(Math.pow(c-o,2)+Math.pow(f-s,2))),o=c,s=f}const c=r.hasAltitude?4:3,f=n.length-c;n[2]=1,O(n,0,f,e,c),n[f+2]=1,n.size=Math.abs(u),n.start=0,n.end=n.size}function B(t,n,e,i,r){for(let o=0;o<t.length;o++){const s=[];j(t[o],s,e,i,r),n.push(s)}}function V(t){return t/360+.5}function G(t,n){if("EPSG:4326"===n)return(90-t)/360;const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function D(t,n,e,i,r,o,s,u){if(i/=n,o>=(e/=n)&&s<i)return t;if(s<e||o>=i)return null;const c=[];for(const n of t){const t=n.geometry;let o=n.type;const s=0===r?n.minX:n.minY,f=0===r?n.maxX:n.maxY;if(s>=e&&f<i){c.push(n);continue}if(f<e||s>=i)continue;let a=[];if("Point"===o||"MultiPoint"===o)X(t,a,e,i,r,u.hasAltitude);else if("LineString"===o)z(t,a,e,i,r,!1,u.lineMetrics,u.hasAltitude);else if("MultiLineString"===o)Y(t,a,e,i,r,!1,u.hasAltitude);else if("Polygon"===o)Y(t,a,e,i,r,!0,u.hasAltitude);else if("MultiPolygon"===o)for(const n of t){const t=[];Y(n,t,e,i,r,!0,u.hasAltitude),t.length&&a.push(t)}if(a.length){if(u.lineMetrics&&"LineString"===o){for(const t of a)c.push(C(n.id,o,t,n.tags,n.layer,u.hasAltitude));continue}"LineString"!==o&&"MultiLineString"!==o||(1===a.length?(o="LineString",a=a[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===a.length?"Point":"MultiPoint"),c.push(C(n.id,o,a,n.tags,n.layer,u.hasAltitude))}}return c.length?c:null}function X(t,n,e,i,r,o){const s=o?4:3;for(let u=0;u<t.length;u+=s){const s=t[u+r];s>=e&&s<=i&&(q(n,t[u],t[u+1],t[u+2]),o&&n.push(t[u+3]))}}function z(t,n,e,i,r,o,s,u){let c=J(t);const f=0===r?R:H;let a,l,h=t.start;const d=u?4:3,v=o?t.length:t.length-d;for(let y=0;y<v;y+=d){const p=t[y],M=t[y+1],w=t[y+2];let m,g,P,x;o&&y===v-d?(m=t[0],g=t[1]):(m=t[y+d],g=t[y+d+1]),u&&(P=t[y+3],x=o&&y===v-d?t[3]:t[y+d+3]);const b=0===r?p:M,S=0===r?m:g;let F=!1;s&&(a=Math.sqrt(Math.pow(p-m,2)+Math.pow(M-g,2))),b<e?S>e&&(l=f(c,p,M,m,g,e),u&&c.push(Z(P,x,l)),s&&(c.start=h+a*l)):b>i?S<i&&(l=f(c,p,M,m,g,i),u&&c.push(Z(P,x,l)),s&&(c.start=h+a*l)):(q(c,p,M,w),u&&c.push(P)),S<e&&b>=e&&(l=f(c,p,M,m,g,e),u&&c.push(Z(P,x,l)),F=!0),S>i&&b<=i&&(l=f(c,p,M,m,g,i),u&&c.push(Z(P,x,l)),F=!0),!o&&F&&(s&&(c.end=h+a*l),n.push(c),c=J(t)),s&&(h+=a)}let y=t.length-d;if(!o){const n=t[y],o=t[y+1],s=t[y+2],f=0===r?n:o;if(f>=e&&f<=i&&q(c,n,o,s),f>=e&&f<=i&&u){const n=t[y+3];c.push(n)}}y=c.length-d,o&&y>=d&&(c[y]!==c[0]||c[y+1]!==c[1])&&(q(c,c[0],c[1],c[2]),u&&c.push(c[3])),c.length&&n.push(c)}function J(t){const n=[];return n.size=t.size,n.start=t.start,n.end=t.end,n}function Y(t,n,e,i,r,o,s){for(const u of t)z(u,n,e,i,r,o,!1,s)}function q(t,n,e,i){t.push(n,e,i)}function R(t,n,e,i,r,o){const s=(o-n)/(i-n);return q(t,o,e+(r-e)*s,1),s}function H(t,n,e,i,r,o){const s=(o-e)/(r-e);return q(t,n+(i-n)*s,o,1),s}function Z(t,n,e){return t+(n-t)*e}function W(t,n,e){const i=[];for(let r=0;r<t.length;r++){const o=t[r],s=o.type;let u;if("Point"===s||"MultiPoint"===s||"LineString"===s)u=K(o.geometry,n,e);else if("MultiLineString"===s||"Polygon"===s){u=[];for(const t of o.geometry)u.push(K(t,n,e))}else if("MultiPolygon"===s){u=[];for(const t of o.geometry){const i=[];for(const r of t)i.push(K(r,n,e));u.push(i)}}i.push(C(o.id,s,u,o.tags,o.layer,e))}return i}function K(t,n,e){const i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);const r=e?4:3;for(let o=0;o<t.length;o+=r)i.push(t[o]+n,t[o+1],t[o+2]),e&&i.push(t[o+3]);return i}function Q(t,n,e){if(t.transformed)return t;const i=1<<t.z,r=t.x,o=t.y,s=e?3:2;for(const u of t.features){const t=u.geometry,c=u.type;if(u.geometry=[],1===c)for(let c=0;c<t.length;c+=s)u.geometry.push(tt(t[c],t[c+1],n,i,r,o)),e&&u.geometry[u.geometry.length-1].push(t[c+2]);else for(let c=0;c<t.length;c++){const f=[];for(let u=0;u<t[c].length;u+=s)f.push(tt(t[c][u],t[c][u+1],n,i,r,o)),e&&f[f.length-1].push(t[c][u+2]);u.geometry.push(f)}}return t.transformed=!0,t}function tt(t,n,e,i,r,o){return[Math.round(e*(t*i-r)),Math.round(e*(n*i-o))]}function nt(t,n,e,i,r){const o=n===r.maxZoom?0:r.tolerance/((1<<n)*r.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:e,y:i,z:n,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const n of t)et(s,n,o,r);return s}function et(t,n,e,i){const r=n.geometry,o=n.type,s=[],u=i.hasAltitude?4:3;if(t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),"Point"===o||"MultiPoint"===o)for(let n=0;n<r.length;n+=u)s.push(r[n],r[n+1]),i.hasAltitude&&s.push(r[n+3]),t.numPoints++,t.numSimplified++;else if("LineString"===o)rt(s,r,t,e,!1,!1,i);else if("MultiLineString"===o||"Polygon"===o)for(let n=0;n<r.length;n++)rt(s,r[n],t,e,"Polygon"===o,0===n,i);else if("MultiPolygon"===o)for(let n=0;n<r.length;n++){const o=r[n];for(let n=0;n<o.length;n++)rt(s,o[n],t,e,!0,0===n,i)}if(s.length){let e=n.tags||null;if("LineString"===o&&i.lineMetrics){e={};for(const t in n.tags)e[t]=n.tags[t];e.mapbox_clip_start=r.start/r.size,e.mapbox_clip_end=r.end/r.size}const u={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:e};n.layer&&(u.layer=n.layer),null!==n.id&&(u.id=n.id),t.features.push(u)}}function it(t,n,e){return 0===t[n+2]&&t[n+3]>0&&e}function rt(t,n,e,i,r,o,s){const u=i*i,{hasAltitude:c,disableFilter:f}=s,a=c?4:3;if(!f&&i>0&&n.size<(r?u:i))return void(e.numPoints+=n.length/a);const l=[];for(let t=0;t<n.length;t+=a)(0===i||n[t+2]>u||it(n,t,c))&&(e.numSimplified++,l.push(n[t],n[t+1]),c&&l.push(n[t+3])),e.numPoints++;r&&function(t,n,e){const i=e?3:2;let r=0;for(let n=0,e=t.length,o=e-i;n<e;o=n,n+=i)r+=(t[n]-t[o])*(t[n+1]+t[o+1]);if(r>0===n){const n=i,r=i-1,o=i-2;for(let s=0,u=t.length;s<u/2;s+=i){const i=t[s],c=t[s+1];let f;e&&(f=t[s+2]),t[s]=t[u-n-s],t[s+1]=t[u-r-s],e&&(t[s+2]=t[u-o-s]),t[u-n-s]=i,t[u-r-s]=c,e&&(t[u-o-s]=f)}}}(l,o,c),t.push(l)}I.getJSON=function(t,n,e){if(F(n)){const t=e;e=n,n=t}const i=function(t,n){const i="string"==typeof n?JSON.parse(n):n||null;e(t,i)};return n&&n.jsonp?I.jsonp(t,i):((n=n||{}).returnJSON=!0,I.get(t,n,i))};const ot={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 st{constructor(t,n){const e=(n=this.options=function(t,n){for(const e in n)t[e]=n[e];return t}(Object.create(ot),n)).debug;if(e&&console.time("preprocess data"),n.maxZoom<0||n.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(n.promoteId&&n.generateId)throw new Error("promoteId and generateId cannot be used together.");let i=function(t,n){const e=[];if(Array.isArray(t)){for(let i=0;i<t.length;i++)E(e,t[i].layer,t[i].data,n);return e}if("FeatureCollection"===t.type)for(let i=0;i<t.features.length;i++)U(e,t.features[i],n,i);else"Feature"===t.type?U(e,t,n):U(e,{geometry:t},n);return e}(t,n);this.tiles={},this.tileCoords=[],e&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",n.indexMaxZoom,n.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=function(t,n){const e=n.buffer/n.extent;let i=t;const r=D(t,1,-1-e,e,0,-1,2,n),o=D(t,1,1-e,2+e,0,-1,2,n);return(r||o)&&(i=D(t,1,-e,1+e,0,-1,2,n)||[],r&&(i=W(r,1,n.hasAltitude).concat(i)),o&&(i=i.concat(W(o,-1,n.hasAltitude)))),i}(i,n),i.length&&this.splitTile(i,0,0,0),e&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(t,n,e,i,r,o,s){const u=[t,n,e,i],c=this.options,f=c.debug;for(;u.length;){i=u.pop(),e=u.pop(),n=u.pop(),t=u.pop();const a=1<<n,l=ut(n,e,i);let h=this.tiles[l];if(!h&&(f>1&&console.time("creation"),h=this.tiles[l]=nt(t,n,e,i,c),this.tileCoords.push({z:n,x:e,y:i}),f)){f>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,e,i,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));const t=\`z${E}n}\`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(h.source=t,null==r){if(n===c.indexMaxZoom||h.numPoints<=c.indexMaxPoints)continue}else{if(n===c.maxZoom||n===r)continue;if(null!=r){const t=r-n;if(e!==o>>t||i!==s>>t)continue}}if(h.source=null,0===t.length)continue;f>1&&console.time("clipping");const d=.5*c.buffer/c.extent,v=.5-d,y=.5+d,p=1+d;let M=null,w=null,m=null,g=null,P=D(t,a,e-d,e+y,0,h.minX,h.maxX,c),x=D(t,a,e+v,e+p,0,h.minX,h.maxX,c);t=null,P&&(M=D(P,a,i-d,i+y,1,h.minY,h.maxY,c),w=D(P,a,i+v,i+p,1,h.minY,h.maxY,c),P=null),x&&(m=D(x,a,i-d,i+y,1,h.minY,h.maxY,c),g=D(x,a,i+v,i+p,1,h.minY,h.maxY,c),x=null),f>1&&console.timeEnd("clipping"),u.push(M||[],n+1,2*e,2*i),u.push(w||[],n+1,2*e,2*i+1),u.push(m||[],n+1,2*e+1,2*i),u.push(g||[],n+1,2*e+1,2*i+1)}}getTile(t,n,e){t=+t,n=+n,e=+e;const i=this.options,{extent:r,debug:o}=i,{hasAltitude:s,wrapX:u}=i;if(t<0||t>24)return null;if(u){const e=1<<t;n=n+e&e-1}const c=ut(t,n,e);if(this.tiles[c])return Q(this.tiles[c],r,s);o>1&&console.log("drilling down to z%d-%d-%d",t,n,e);let f,a=t,l=n,h=e;for(;!f&&a>0;)a--,l>>=1,h>>=1,f=this.tiles[ut(a,l,h)];return f&&f.source?(o>1&&(console.log("found parent tile z%d-%d-%d",a,l,h),console.time("drilling down")),this.splitTile(f.source,a,l,h,t,n,e),o>1&&console.timeEnd("drilling down"),this.tiles[c]?Q(this.tiles[c],r,s):null):null}}function ut(t,n,e){return 32*((1<<t)*e+n)+t}function ct(t,n,e,i,r,o,s){const u=e&&Array.isArray(e[0]);for(let c=0,f=e.length;c<f;c++){t[n]=(u?e[c][0]:e[c].x)*i,t[n+1]=(u?e[c][1]:e[c].y)*i,s!==Float32Array&&(t[n]=Math.round(t[n]),t[n+1]=Math.round(t[n+1]));let a=r||0;Array.isArray(r)&&(a=r[c]),a=a?Math.round(i*a):0,t[n+2]=a,n+=3,o&&0!==c&&c!==f-1&&(t[n]=t[n-3],t[n+1]=t[n-2],t[n+2]=t[n-1],n+=3)}return t.trySetLength&&t.trySetLength(n),n}function ft(t,n,e,i){const r=t[3*n],o=t[3*n+1],s=t[3*e],u=t[3*e+1];return r===s&&(r<0||r>i)||o===u&&(o<0||o>i)}var at="undefined"!=typeof Float32Array?Float32Array:Array;function lt(t,n,e,i){return t[0]=n,t[1]=e,t[2]=i,t}function ht(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function dt(t,n,e,i,r){return t[0]=n,t[1]=e,t[2]=i,t[3]=r,t}function vt(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t[3]=n[3]/e[3],t}function yt(t,n,e){return t[0]=n,t[1]=e,t}function pt(t,n){var e=n[0]-t[0],i=n[1]-t[1];return Math.hypot(e,i)}Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)}),function(){var t,n=(t=new at(3),at!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t)}(),function(){var t,n=(t=new at(4),at!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}(),function(){var t,n=(t=new at(2),at!=Float32Array&&(t[0]=0,t[1]=0),t)}();const Mt=Math.PI/180,wt=6378137*Math.PI/180,mt=85.0511287798;function gt(t,n,e){if("EPSG:3857"===e)return function(t,n){const e=mt,i=n[0],r=Math.max(Math.min(e,n[1]),-e);let o;o=0===r?0:Math.log(Math.tan((90+r)*Mt/2))/Mt;return t[0]=i*wt,t[1]=o*wt,t}(t,n);if("EPSG:4326"===e||"EPSG:4490"===e||"identity"===e)return Pt(t,n);if("baidu"===e)return Pt(t,n);throw new Error("unsupported projection:"+e)}function Pt(t,n){return t[0]=n[0],t[1]=n[1],t}function xt(t,n,e,i,r,o,s,u,c,f,a,l,h,d,v){0===t?function(t,n,e,i,r,o,s,u,c,f){const a=1/(100*o[0]),l=1/(100*o[1]),h=f&&f[0]||0,d=f&&f[1]||0,v=[0,0];for(let r=t;r<n;r+=3){const t=r/3*2,n=i[r]-h,o=i[r+1]-d;e[t]=v[0]+n/s*a/u,e[t+1]=v[1]-o/s*l/c}}(n,e,i,r,0,s,u,c,f,v):1===t&&function(t,n,e,i,r,o,s,u,c,f,a){if(!t)return;let l,h,d,v;0===t[4]?(l=t[0],h=t[1],d=t[2],v=t[3]):(l=t[1],h=t[2],d=t[3],v=t[0]);const y=pt(l,h),p=pt(h,d),M=[],w=[],m=[];for(let t=n;t<e;t+=3){const n=t/3*2;yt(M,(o.x/c+r[t]/s)*u,o.y/c*u+(a?r[t+1]:-r[t+1])/s*u),"EPSG:4326"!==f&&"EPSG:4490"!==f||gt(M,M,"EPSG:3857"),bt(w,M,l,h),bt(m,M,v,l),i[n]=pt(l,w)/y,i[n+1]=pt(l,m)/p}}(a,n,e,i,r,o,u,l,h,d,!!v)}function bt(t,n,e,i){const r=e[0]-i[0],o=e[1]-i[1];let s=(n[0]-e[0])*(e[0]-i[0])+(n[1]-e[1])*(e[1]-i[1]);return s/=r*r+o*o,t[0]=e[0]+s*r,t[1]=e[1]+s*o,t}function St(t,n,e,i,r){const o=3*n[e-1],s=3*n[e-1]+1,u=t[o],c=t[s];return f=i,a=r,l=u,h=c,Math.sqrt((l-f)*(l-f)+(h-a)*(h-a));var f,a,l,h}function Ft(t){return t&&t.h&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var At={exports:{}};function kt(t,n,e){e=e||2;var i,r,o,s,u,c,f,a=n&&n.length,l=a?n[0]*e:t.length,h=Tt(t,0,l,e,!0),d=[];if(!h||h.next===h.prev)return d;if(a&&(h=function(t,n,e,i){var r,o,s,u=[];for(r=0,o=n.length;r<o;r++)(s=Tt(t,n[r]*i,r<o-1?n[r+1]*i:t.length,i,!1))===s.next&&(s.steiner=!0),u.push(Bt(s));for(u.sort(Et),r=0;r<u.length;r++)e=Ut(u[r],e);return e}(t,n,h,e)),t.length>80*e){i=o=t[0],r=s=t[1];for(var v=e;v<l;v+=e)(u=t[v])<i&&(i=u),(c=t[v+1])<r&&(r=c),u>o&&(o=u),c>s&&(s=c);f=0!==(f=Math.max(o-i,s-r))?32767/f:0}return It(h,d,e,i,r,f,0),d}function Tt(t,n,e,i,r){var o,s;if(r===Kt(t,n,e,i)>0)for(o=n;o<e;o+=i)s=Ht(o,t[o],t[o+1],s);else for(o=e-i;o>=n;o-=i)s=Ht(o,t[o],t[o+1],s);return s&&Xt(s,s.next)&&(Zt(s),s=s.next),s}function _t(t,n){if(!t)return t;n||(n=t);var e,i=t;do{if(e=!1,i.steiner||!Xt(i,i.next)&&0!==Dt(i.prev,i,i.next))i=i.next;else{if(Zt(i),(i=n=i.prev)===i.next)break;e=!0}}while(e||i!==n);return n}function It(t,n,e,i,r,o,s){if(t){!s&&o&&function(t,n,e,i){var r=t;do{0===r.z&&(r.z=jt(r.x,r.y,n,e,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var n,e,i,r,o,s,u,c,f=1;do{for(e=t,t=null,o=null,s=0;e;){for(s++,i=e,u=0,n=0;n<f&&(u++,i=i.nextZ);n++);for(c=f;u>0||c>0&&i;)0!==u&&(0===c||!i||e.z<=i.z)?(r=e,e=e.nextZ,u--):(r=i,i=i.nextZ,c--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;e=i}o.nextZ=null,f*=2}while(s>1)}(r)}(t,i,r,o);for(var u,c,f=t;t.prev!==t.next;)if(u=t.prev,c=t.next,o?Nt(t,i,r,o):Ot(t))n.push(u.i/e|0),n.push(t.i/e|0),n.push(c.i/e|0),Zt(t),t=c.next,f=c.next;else if((t=c)===f){s?1===s?It(t=Ct(_t(t),n,e),n,e,i,r,o,2):2===s&&Lt(t,n,e,i,r,o):It(_t(t),n,e,i,r,o,1);break}}}function Ot(t){var n=t.prev,e=t,i=t.next;if(Dt(n,e,i)>=0)return!1;for(var r=n.x,o=e.x,s=i.x,u=n.y,c=e.y,f=i.y,a=r<o?r<s?r:s:o<s?o:s,l=u<c?u<f?u:f:c<f?c:f,h=r>o?r>s?r:s:o>s?o:s,d=u>c?u>f?u:f:c>f?c:f,v=i.next;v!==n;){if(v.x>=a&&v.x<=h&&v.y>=l&&v.y<=d&&Vt(r,u,o,c,s,f,v.x,v.y)&&Dt(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function Nt(t,n,e,i){var r=t.prev,o=t,s=t.next;if(Dt(r,o,s)>=0)return!1;for(var u=r.x,c=o.x,f=s.x,a=r.y,l=o.y,h=s.y,d=u<c?u<f?u:f:c<f?c:f,v=a<l?a<h?a:h:l<h?l:h,y=u>c?u>f?u:f:c>f?c:f,p=a>l?a>h?a:h:l>h?l:h,M=jt(d,v,n,e,i),w=jt(y,p,n,e,i),m=t.prevZ,g=t.nextZ;m&&m.z>=M&&g&&g.z<=w;){if(m.x>=d&&m.x<=y&&m.y>=v&&m.y<=p&&m!==r&&m!==s&&Vt(u,a,c,l,f,h,m.x,m.y)&&Dt(m.prev,m,m.next)>=0)return!1;if(m=m.prevZ,g.x>=d&&g.x<=y&&g.y>=v&&g.y<=p&&g!==r&&g!==s&&Vt(u,a,c,l,f,h,g.x,g.y)&&Dt(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;m&&m.z>=M;){if(m.x>=d&&m.x<=y&&m.y>=v&&m.y<=p&&m!==r&&m!==s&&Vt(u,a,c,l,f,h,m.x,m.y)&&Dt(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;g&&g.z<=w;){if(g.x>=d&&g.x<=y&&g.y>=v&&g.y<=p&&g!==r&&g!==s&&Vt(u,a,c,l,f,h,g.x,g.y)&&Dt(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function Ct(t,n,e){var i=t;do{var r=i.prev,o=i.next.next;!Xt(r,o)&&zt(r,i,i.next,o)&&qt(r,o)&&qt(o,r)&&(n.push(r.i/e|0),n.push(i.i/e|0),n.push(o.i/e|0),Zt(i),Zt(i.next),i=t=o),i=i.next}while(i!==t);return _t(i)}function Lt(t,n,e,i,r,o){var s=t;do{for(var u=s.next.next;u!==s.prev;){if(s.i!==u.i&&Gt(s,u)){var c=Rt(s,u);return s=_t(s,s.next),c=_t(c,c.next),It(s,n,e,i,r,o,0),void It(c,n,e,i,r,o,0)}u=u.next}s=s.next}while(s!==t)}function Et(t,n){return t.x-n.x}function Ut(t,n){var e=function(t,n){var e,i=n,r=t.x,o=t.y,s=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var u=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(u<=r&&u>s&&(s=u,e=i.x<i.next.x?i:i.next,u===r))return e}i=i.next}while(i!==n);if(!e)return null;var c,f=e,a=e.x,l=e.y,h=1/0;i=e;do{r>=i.x&&i.x>=a&&r!==i.x&&Vt(o<l?r:s,o,a,l,o<l?s:r,o,i.x,i.y)&&(c=Math.abs(o-i.y)/(r-i.x),qt(i,t)&&(c<h||c===h&&(i.x>e.x||i.x===e.x&&$t(e,i)))&&(e=i,h=c)),i=i.next}while(i!==f);return e}(t,n);if(!e)return n;var i=Rt(e,t);return _t(i,i.next),_t(e,e.next)}function $t(t,n){return Dt(t.prev,t,n.prev)<0&&Dt(n.next,t,t.next)<0}function jt(t,n,e,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-e)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-i)*r|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function Bt(t){var n=t,e=t;do{(n.x<e.x||n.x===e.x&&n.y<e.y)&&(e=n),n=n.next}while(n!==t);return e}function Vt(t,n,e,i,r,o,s,u){return(r-s)*(n-u)>=(t-s)*(o-u)&&(t-s)*(i-u)>=(e-s)*(n-u)&&(e-s)*(o-u)>=(r-s)*(i-u)}function Gt(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==n.i&&e.next.i!==n.i&&zt(e,e.next,t,n))return!0;e=e.next}while(e!==t);return!1}(t,n)&&(qt(t,n)&&qt(n,t)&&function(t,n){var e=t,i=!1,r=(t.x+n.x)/2,o=(t.y+n.y)/2;do{e.y>o!=e.next.y>o&&e.next.y!==e.y&&r<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next}while(e!==t);return i}(t,n)&&(Dt(t.prev,t,n.prev)||Dt(t,n.prev,n))||Xt(t,n)&&Dt(t.prev,t,t.next)>0&&Dt(n.prev,n,n.next)>0)}function Dt(t,n,e){return(n.y-t.y)*(e.x-n.x)-(n.x-t.x)*(e.y-n.y)}function Xt(t,n){return t.x===n.x&&t.y===n.y}function zt(t,n,e,i){var r=Yt(Dt(t,n,e)),o=Yt(Dt(t,n,i)),s=Yt(Dt(e,i,t)),u=Yt(Dt(e,i,n));return r!==o&&s!==u||(!(0!==r||!Jt(t,e,n))||(!(0!==o||!Jt(t,i,n))||(!(0!==s||!Jt(e,t,i))||!(0!==u||!Jt(e,n,i)))))}function Jt(t,n,e){return n.x<=Math.max(t.x,e.x)&&n.x>=Math.min(t.x,e.x)&&n.y<=Math.max(t.y,e.y)&&n.y>=Math.min(t.y,e.y)}function Yt(t){return t>0?1:t<0?-1:0}function qt(t,n){return Dt(t.prev,t,t.next)<0?Dt(t,n,t.next)>=0&&Dt(t,t.prev,n)>=0:Dt(t,n,t.prev)<0||Dt(t,t.next,n)<0}function Rt(t,n){var e=new Wt(t.i,t.x,t.y),i=new Wt(n.i,n.x,n.y),r=t.next,o=n.prev;return t.next=n,n.prev=t,e.next=r,r.prev=e,i.next=e,e.prev=i,o.next=i,i.prev=o,i}function Ht(t,n,e,i){var r=new Wt(t,n,e);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Zt(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 Wt(t,n,e){this.i=t,this.x=n,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Kt(t,n,e,i){for(var r=0,o=n,s=e-i;o<e;o+=i)r+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return r}At.exports=kt,At.exports.default=kt,kt.deviation=function(t,n,e,i){var r=n&&n.length,o=r?n[0]*e:t.length,s=Math.abs(Kt(t,0,o,e));if(r)for(var u=0,c=n.length;u<c;u++){var f=n[u]*e,a=u<c-1?n[u+1]*e:t.length;s-=Math.abs(Kt(t,f,a,e))}var l=0;for(u=0;u<i.length;u+=3){var h=i[u]*e,d=i[u+1]*e,v=i[u+2]*e;l+=Math.abs((t[h]-t[v])*(t[d+1]-t[h+1])-(t[h]-t[d])*(t[v+1]-t[h+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},kt.flatten=function(t){for(var n=t[0][0].length,e={vertices:[],holes:[],dimensions:n},i=0,r=0;r<t.length;r++){for(var o=0;o<t[r].length;o++)for(var s=0;s<n;s++)e.vertices.push(t[r][o][s]);r>0&&(i+=t[r-1].length,e.holes.push(i))}return e};var Qt=Ft(At.exports);const tn="__fea_idx";new Float32Array([-1e12])[0];const nn="maptalks_ombb";function en(){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:rn,ArrayPool:on}=en();function sn(t,n,e,i,r,o,s,u,c,f,a,l,h,d,v,y,p){const M=n.getLength(),w=r/3;for(let e=2,i=M;e<i;e+=3)t[r+e-2]=n[e-2],t[r+e-1]=n[e-1],t[r+e-0]=n[e]-s;r+=M;for(let e=2,i=M;e<i;e+=3)t[r+e-2]=n[e-2],t[r+e-1]=n[e-1],t[r+e-0]=n[e]-u;r+=M,t.trySetLength(r+M),t.copyWithin(r,r-2*M,r-M),r+=M,t.trySetLength(r+M),t.copyWithin(r,r-2*M,r-M),r+=M,(e=e||[]).push(M/3);const m=e.getLength();for(let n=0;n<m;n++){un(w+(e[n-1]||0),w+e[n],t,M/3,c,i,f,a,l,h,o,d,v,y,p)}return r}function un(t,n,e,i,r,o,s,u,c,f,a,l,h,d,v){const y=o.getLength();let p,M;for(let s=t,u=n;s<u-1;s++)if(p=s,M=s+1,r===1/0||!ft(e,p,M,r))if((s-t)%2==1&&(p+=2*i,M+=2*i),v){let t=o.currentIndex;o[t++]=p+i,o[t++]=M,o[t++]=p,o[t++]=M+i,o[t++]=M,o[t++]=p+i,o.currentIndex=t}else{let t=o.currentIndex;o[t++]=p+i,o[t++]=p,o[t++]=M,o[t++]=M,o[t++]=M+i,o[t++]=p+i,o.currentIndex=t}s&&function(t,n,e,i,r,o,s,u,c,f,a,l){let h,d=0,v=0,y=0,p=0;const M=l?[1,3,4]:[2,3,4];for(let l=o.getLength()-1;l>=s;l--){const s=o[l],w=3*s+1,m=3*s+2,g=r[3*s],P=r[w],x=r[m];d||v||(d=Math.max(r[m],r[3*o[l-3]+2]),v=Math.min(r[m],r[3*o[l-3]+2]),h=d-v);let b=y;const S=l%6;0===t?(5===S&&(p=St(r,o,l,g,P)),b=S===M[0]||S===M[1]||S===M[2]?y:y+p):1===t&&(S===M[0]||S===M[1]||S===M[2]?b=0:5===S?(p=St(r,o,l,g,P),b=p):b=p);const F=b/f*(1/(100*a))/u;let A;A=1===n?x===d?1:0:"bottom"===e?x===d?h/100/c:0:x===d?0:-h/100/c,i[2*s]=F,i[2*s+1]=A,0===S&&(y+=p)}}(u,c,f,a,e,o,y,l[0],l[1],h,d,v)}function cn(t){const n=[t[0]];let e=t[0];for(let i=1;i<t.length;i++)Array.isArray(t[i])?t[i][0]===e[0]&&t[i][1]===e[1]&&t[i][2]===e[2]||n.push(t[i]):t[i].x===e.x&&t[i].y===e.y&&t[i].z===e.z||n.push(t[i]),e=t[i];return n}var fn="undefined"!=typeof Float32Array?Float32Array:Array;function an(){var t=new fn(3);return fn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function ln(t,n,e){var i=new fn(3);return i[0]=t,i[1]=n,i[2]=e,i}function hn(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function dn(t,n,e,i){return t[0]=n,t[1]=e,t[2]=i,t}function vn(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t}function yn(t,n){var e=n[0],i=n[1],r=n[2],o=e*e+i*i+r*r;return o>0&&(o=1/Math.sqrt(o),t[0]=n[0]*o,t[1]=n[1]*o,t[2]=n[2]*o),t}function pn(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Mn(t,n,e){var i=n[0],r=n[1],o=n[2],s=e[0],u=e[1],c=e[2];return t[0]=r*c-o*u,t[1]=o*s-i*c,t[2]=i*u-r*s,t}var wn=function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t};function mn(){var t=new fn(4);return fn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function gn(t,n){var e=n[0]+n[4]+n[8],i=void 0;if(e>0)i=Math.sqrt(e+1),t[3]=.5*i,i=.5/i,t[0]=(n[5]-n[7])*i,t[1]=(n[6]-n[2])*i,t[2]=(n[1]-n[3])*i;else{var r=0;n[4]>n[0]&&(r=1),n[8]>n[3*r+r]&&(r=2);var o=(r+1)%3,s=(r+2)%3;i=Math.sqrt(n[3*r+r]-n[3*o+o]-n[3*s+s]+1),t[r]=.5*i,i=.5/i,t[3]=(n[3*o+s]-n[3*s+o])*i,t[o]=(n[3*o+r]+n[3*r+o])*i,t[s]=(n[3*s+r]+n[3*r+s])*i}return t}!function(){var t=an()}(),function(){var t,n=(t=new fn(4),fn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var Pn,xn=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},bn=function(t,n){var e=n[0],i=n[1],r=n[2],o=n[3],s=e*e+i*i+r*r+o*o;return s>0&&(s=1/Math.sqrt(s),t[0]=e*s,t[1]=i*s,t[2]=r*s,t[3]=o*s),t};an(),ln(1,0,0),ln(0,1,0),mn(),mn(),Pn=new fn(9),fn!=Float32Array&&(Pn[1]=0,Pn[2]=0,Pn[3]=0,Pn[5]=0,Pn[6]=0,Pn[7]=0),Pn[0]=1,Pn[4]=1,Pn[8]=1;\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */\nconst Sn=8,Fn=[],An=[],kn=[],Tn=[];function _n(t,n,e){const i=Mn(An,n,e),r=function(t,n,e,i,r,o,s,u,c,f){return t[0]=n,t[1]=e,t[2]=i,t[3]=r,t[4]=o,t[5]=s,t[6]=u,t[7]=c,t[8]=f,t}(Fn,e[0],e[1],e[2],...i,...n);t=gn(t,r),t=function(t){return t[3]<0?xn(t,t,-1):t}(t=bn(t,t));const o=1/((1<<2*Sn-1)-1);if(t[3]<o){t[3]=o;const n=Math.sqrt(1-o*o);t[0]*=n,t[1]*=n,t[2]*=n}const s=e[3]>0?Mn(kn,e,n):Mn(kn,n,e);return pn(Mn(Tn,e,n),s)<0&&xn(t,t,-1),t}const In=[];const On=[],Nn=[],Cn=[],Ln=[],En=[],Un=[],$n=[];function jn(t,n,e,i,r,o){dn(Ln,t[3*n],t[3*n+1],t[3*n+2]),dn(En,t[3*e],t[3*e+1],t[3*e+2]),dn(Un,t[3*i],t[3*i+1],t[3*i+2]);const s=wn(On,Un,En),u=wn(Nn,Ln,En),c=Mn(Cn,s,u);yn($n,c),r[3*n]=r[3*n]||0,r[3*e]=r[3*e]||0,r[3*i]=r[3*i]||0,r[3*n+1]=r[3*n+1]||0,r[3*e+1]=r[3*e+1]||0,r[3*i+1]=r[3*i+1]||0,r[3*n+2]=r[3*n+2]||0,r[3*e+2]=r[3*e+2]||0,r[3*i+2]=r[3*i+2]||0,r[3*n]+=$n[0],r[3*e]+=$n[0],r[3*i]+=$n[0],r[3*n+1]+=$n[1],r[3*e+1]+=$n[1],r[3*i+1]+=$n[1],r[3*n+2]+=$n[2],r[3*e+2]+=$n[2],r[3*i+2]+=$n[2],o[n]+=1,o[e]+=1,o[i]+=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 Bn(t,n,e){return t[0]=n[e],t[1]=n[e+1],t[2]=n[e+2],t}function Vn(t,n,e){return t[0]=n[e],t[1]=n[e+1],t}const{StyleUtil:Gn,PackUtil:Dn,ArrayPool:Xn}=en(),zn=Xn.getInstance();function Jn(t,n,e,i,r,o,s,u,c,f,a,l,h,d,v,y){void 0===n.top&&(n.top=!0),void 0===n.side&&(n.side=!0),zn.reset();const{altitudeScale:p,altitudeProperty:g,defaultAltitude:P,heightProperty:x,minHeightProperty:b,defaultHeight:F,tangent:A,uv:k,topUVMode:_,sideUVMode:I,sideVerticalUVMode:O,top:N,side:C,textureYOrigin:L,topThickness:E}=n,U=function(t,n,{altitudeScale:e,altitudeProperty:i,defaultAltitude:r,heightProperty:o,minHeightProperty:s,defaultHeight:u},{center:c,side:f,top:a,topThickness:l,uvOrigin:h,uv:d,uvSize:v,topUVMode:y,sideUVMode:p,sideVerticalUVMode:M,textureYOrigin:w,tileRatio:m,centimeterToPoint:g,verticalCentimeterToPoint:P,positionType:x,res:b,glScale:F,projectionCode:A},k,T){let _=n/t[0].extent;n===1/0&&(_=1);const I=n===1/0,O=T.get(),N=T.get(),C=T.get(),L=T.getProxy(),E=T.get(),U=T.get(),$=T.get(),j=!!d,B=!!a,V=!!f,G=j?T.get():null;function D(t,e,i,r,o,s){let u=e;if(B){const f=Qt(L,i,3);if(0===f.length)return e;let a=L.getLength(),d=E.currentIndex;for(let t=0;t<a;t++)E[d++]=L[t];if(E.currentIndex=d,e+=L.getLength(),s)for(let n=2,e=f.length;n<e;n+=3)f[n]+=t/3,f[n-1]+=t/3,f[n-2]+=t/3;else{let n;for(let e=2,i=f.length;e<i;e+=3)n=f[e-1],f[e-1]=f[e]+t/3,f[e]=n+t/3,f[e-2]+=t/3}a=f.length,d=U.currentIndex;for(let t=0;t<a;t++)U[d++]=f[t];U.currentIndex=d,j&&xt(y||0,t,e,G,E,h,g,m,v[0],v[1],o,b,F,A,c),l>0&&!V&&(e=sn(E,L,i,U,e,G,0,l,n,j,p||0,M||0,w,v,m,P,r<0?!s:s)),$.setLength(e/3),$.fill(1,u/3,e/3)}if(V){B&&(l=0),u=e,e=sn(E,L,i,U,e,G,l,r,n,j,p||0,M||0,w,v,m,P,r<0?!s:s),$.setLength(e/3);const t=L.getLength()/3;$.fill(1,u/3,u/3+t),$.fill(0,u/3+t,u/3+2*t),$.fill(1,u/3+2*t,u/3+3*t),$.fill(0,u/3+3*t,e/3)}return e}let X=0,z=0;const J=[-1,-1,n+1,n+1];let Y=0,q=t.length;S(k)&&(Y=k,q=k+1);let R=0,H=!1;const Z=T.getProxy();let W=!1;for(;Y<q;Y++){const c=t[Y],f=c.id;S(f)&&(Math.abs(f)>R&&(R=Math.abs(f)),f<0&&(H=!0));const a=c.geometry,l=c.properties[nn];let h=Array.isArray(l&&l[0]&&l[0][0])?l[0]:l;const{altitude:d,height:v}=rn.getFeaAltitudeAndHeight(c,e,i,r,o,u,s);v<0&&(W=!0),X=Math.max(Math.abs(d),X);const y=E.getLength();let p=0,M=z;Z.setLength(0),L.setLength(0);const w=rn.calculateSignedArea(a[0])<0;for(let t=0,e=a.length;t<e;t++){let i=a[t];w&&(i=i.reverse()),i=cn(i);const r=rn.calculateSignedArea(i)<0;if(!r&&t>0&&(p++,h=l&&l[p],z=D(M,z,Z,v*_,h,I),L.setLength(0),Z.setLength(0),M=z),n!==1/0&&(i=rn.clipPolygon(i,J)),!i.length){t===e-1&&(z=D(M,z,Z,v*_,h,I));continue}const o=i.length;if(Array.isArray(i[0])?i[0][0]===i[o-1][0]&&i[0][1]===i[o-1][1]||i.push([i[0][0],i[0][1]]):i[0].x===i[o-1].x&&i[0].y===i[o-1].y||i.push(i[0]),r){let t=Z.currentIndex;Z[t++]=L.getLength()/3,Z.currentIndex=t}ct(L,L.getLength(),i,_,d,!1,x),t===e-1&&(z=D(M,z,Z,v*_,h,I))}const m=E.getLength()-y,g=(tn+"").trim();for(let t=0;t<m/3;t++){let t=N.currentIndex;N[t++]=void 0===c[g]?Y:c[g],N.currentIndex=t,t=O.currentIndex,O[t++]=Y,O.currentIndex=t,S(f)&&(t=C.currentIndex,C[t++]=f,C.currentIndex=t)}}const K=rn.getUnsignedArrayType(N.getLength()?N[N.getLength()-1]:0),Q={hasNegativeHeight:W,maxAltitude:X,vertices:E,verticeTypes:$,indices:U,pickingIds:on.createTypedArray(N,K),featureIndexes:O};if(C.getLength()){const t=H?rn.getPosArrayType(R):rn.getUnsignedArrayType(R);Q.featureIds=on.createTypedArray(C,t)}else Q.featureIds=[];return G&&(G.setLength(E.getLength()/3*2),Q.uvs=G),Q}(t,e,{altitudeScale:p,altitudeProperty:g,defaultAltitude:P||0,heightProperty:x,minHeightProperty:b,defaultHeight:F||0},{center:y,top:N,side:C,topThickness:10*E||0,uv:k||A,uvSize:[r,r],uvOrigin:i,topUVMode:_,sideUVMode:I,sideVerticalUVMode:O,textureYOrigin:L,tileRatio:u,centimeterToPoint:c,verticalCentimeterToPoint:f,positionType:v,res:o,glScale:s,projectionCode:h},d,zn),$=[],j=U.vertices.getLength()/3,B=Dn.getIndexArrayType(j),V=Xn.createTypedArray(U.indices,B);delete U.indices,$.push(V.buffer,U.pickingIds.buffer);const G=Dn.getPosArrayType(Math.max(512,U.maxAltitude));U.vertices=Xn.createTypedArray(U.vertices,G);const D=A?zn.getProxy():new Float32Array(3*j);D.setLength&&D.setLength(3*j);const X=function(t,n,e){const i=e||[];i.setLength&&i.setLength(t.length);const r=In;r.length<t.length/3&&(r.length=t.length/3),r.fill(0,0,t.length/3);const o=void 0===n.length?n:n.length;for(let e=0;e<o/3;e++)void 0===n.length?jn(t,3*e,3*e+1,3*e+2,i,r):jn(t,n[3*e],n[3*e+1],n[3*e+2],i,r);for(let t=0;t<i.length;t+=3){const n=r[t/3];0!==n?(i[t]/=n,i[t+1]/=n,i[t+2]/=n):(i[t]=0,i[t+1]=0,i[t+2]=0)}return i}(U.vertices,V,D);let z=!0;const J=X.getLength?X.getLength():X.length;for(let t=0;t<J;t++){X[t]=-X[t];const n=X[t]%1;1-Math.abs(n)>1e-6?z=!1:0!==n&&(X[t]=Math.round(X[t]))}if(U.normals=X,A){let t=zn.get();t.setLength(4*j),t=function(t,n,e,i,r){const o=t.length/3,s=r||new Array(4*o),u=[],c=[];for(let t=0;t<o;t++)u[t]=[0,0,0],c[t]=[0,0,0];const f=[0,0,0],a=[0,0,0],l=[0,0,0],h=[0,0],d=[0,0],v=[0,0],y=[0,0,0],p=[0,0,0];function M(n,i,r){Bn(f,t,3*n),Bn(a,t,3*i),Bn(l,t,3*r),Vn(h,e,2*n),Vn(d,e,2*i),Vn(v,e,2*r);const o=a[0]-f[0],s=l[0]-f[0],M=a[1]-f[1],w=l[1]-f[1],m=a[2]-f[2],g=l[2]-f[2],P=d[0]-h[0],x=v[0]-h[0],b=d[1]-h[1],S=v[1]-h[1],F=1/(P*S-x*b);dn(y,(S*o-b*s)*F,(S*M-b*w)*F,(S*m-b*g)*F),dn(p,(P*s-x*o)*F,(P*w-x*M)*F,(P*g-x*m)*F),vn(u[n],u[n],y),vn(u[i],u[i],y),vn(u[r],u[r],y),vn(c[n],c[n],p),vn(c[i],c[i],p),vn(c[r],c[r],p)}for(let t=0,n=i.length;t<n;t+=3)M(i[t+0],i[t+1],i[t+2]);const w=[],m=[],g=[],P=[];let x,b,S;function F(t){Bn(g,n,3*t),hn(P,g),b=u[t],hn(w,b),wn(w,w,function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t}(g,g,pn(g,b))),yn(w,w),Mn(m,P,b),S=pn(m,c[t]),x=S<0?-1:1,s[4*t]=w[0],s[4*t+1]=w[1],s[4*t+2]=w[2],s[4*t+3]=x}for(let t=0,n=i.length;t<n;t+=3)F(i[t+0]),F(i[t+1]),F(i[t+2]);return s}(U.vertices,U.normals,U.uvs,V,t),t=function(t,n){const e=n.getLength(),i=new Float32Array(e),r=[],o=[],s=[];for(let u=0;u<e;u+=4){const e=u/4*3;lt(o,t[e]||0,t[e+1]||0,t[e+2]||0),dt(r,n[u]||0,n[u+1]||0,n[u+2]||0,n[u+3]||0),_n(s,o,r),ht(i.subarray(u,u+4),s)}return i}(U.normals,t),U.tangents=t,$.push(t.buffer),delete U.normals}if(U.normals&&(z&&(U.normals=Xn.createTypedArray(U.normals,Int8Array)),$.push(U.normals.buffer)),U.uvs){const t=U.uvs;U.uvs=Xn.createTypedArray(t,Float32Array),$.push(U.uvs.buffer)}const Y=function(t,n,e,i){const r={},o={},s=i.getLength();if(T(n.polygonFill)){let u=w(n.polygonFill);const c=new Uint8Array(4*s);c.fill(255);for(let n=0;n<s;n++){const o=t[i[n]],s=o.properties||{};s.$layer=o.layer,s.$type=o.type;let f=u(e,s);M(f)&&(r.aColor=1,u=w(f),f=u(e,s)),delete s.$layer,delete s.$type,Gn.normalizeColor(Yn,f),c[4*n]=Yn[0],c[4*n+1]=Yn[1],c[4*n+2]=Yn[2],c[4*n+3]=Yn[3]}o.aColor=c}if(T(n.polygonOpacity)){let u=m(n.polygonOpacity,"exponential");const c=new Uint8Array(s);c.fill(255);for(let n=0;n<s;n++){const o=t[i[n]],s=o.properties||{};s.$layer=o.layer,s.$type=o.type;let f=u(e,s);M(f)&&(r.aOpacity=1,u=w(f),f=u(e,s)),delete s.$layer,delete s.$type,c[n]=255*f}o.aOpacity=c}return o.dynamicAttributes=r,o}(t,a,l,U.featureIndexes),q=function(t,n,e,i,r){const o=[[],[]],s=T(i.topPolygonFill),u=T(i.bottomPolygonFill),c=[255,255,255,255],f=n.getLength();if(s||u){let a=s&&w(i.topPolygonFill),l=u&&w(i.bottomPolygonFill),h=null,d=null,v=null,y=null;for(let i=0;i<f;i++){if(1===t[i]&&!s||0===t[i]&&!u)continue;const f=1===t[i];if(f&&n[i]===h){t[i]=v;continue}if(!f&&n[i]===d){t[i]=y;continue}const p=e[n[i]],m=p.properties||{};m.$layer=p.layer,m.$type=p.type;let g=f?a:l,P=g(r,m);M(P)&&(g=w(P),P=g(r,m)),delete m.$layer,delete m.$type,Gn.normalizeColor(Yn,P),vt(Yn,Yn,c);let x=qn(o,Yn);x<0&&(x=o.length,o.push(ht([],Yn))),t[i]=x,f?(h=n[i],v=x):(d=n[i],y=x)}}return o.slice(2)}(U.verticeTypes,U.featureIndexes,t,a,l),R={data:{data:{aVertexColorType:q.length<=252?Xn.createTypedArray(U.verticeTypes,Uint8Array):Xn.createTypedArray(U.verticeTypes,Uint16Array),aPosition:U.vertices,aNormal:U.normals,aTexCoord0:U.uvs,aTangent:U.tangents,aPickingId:U.pickingIds},indices:V,properties:{maxAltitude:U.maxAltitude,hasNegativeHeight:U.hasNegativeHeight},dynamicAttributes:Y.dynamicAttributes,vertexColors:q},buffers:$};return U.featureIds.length?(R.data.featureIds=U.featureIds,$.push(R.data.featureIds.buffer)):R.data.featureIds=[],Y.aColor&&(R.data.data.aColor=Y.aColor,R.buffers.push(Y.aColor.buffer)),Y.aOpacity&&(R.data.data.aOpacity=Y.aOpacity,R.buffers.push(Y.aOpacity.buffer)),R.buffers.push(R.data.data.aPosition.buffer),R.data.pickingIdIndiceMap=Dn.generatePickingIndiceIndex(R.data.data.aPickingId,R.data.indices),R}const Yn=[];function qn(t,n){for(let r=0;r<t.length;r++)if(e=n,i=t[r],e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3])return r;var e,i;return-1}const{PackUtil:Rn,StyleUtil:Hn,FilterUtil:Zn}=en();function Wn(t,n,e,i,{altitudeScale:r,altitudeProperty:o,defaultAltitude:s,heightProperty:u,minHeightProperty:c,defaultHeight:f,bottom:a}){const l=a,h=n/t[0].extent,d=2*function(t,n){let e=0;for(let n=0,i=t.length;n<i;n++){const i=t[n];if(S(i.geometry[0][0]))e+=3*i.geometry.length;else for(let t=0,n=i.geometry.length;t<n;t++){let n=3*i.geometry[t].length;3===i.type&&(n-=3),e+=n}}return e}(t)+3*t.length*2,v=[],y=new Int16Array(d),p=new Uint8Array(y.length/3*4);M(e)&&(e=Zn.compileFilter(e));const w=[];function m(t,e,i){const r=e-t,o=y.subarray(t,e),s=y.subarray(e,e+r);s.set(o);for(let t=2,n=s.length;t<n;t+=3)s[t]=o[t]-i;const u=t/3,c=r/3;let f,a;for(let t=u,e=c+u;t<e;t++)t<e-1?(f=t,a=t+1):(f=t,a=u),ft(y,f,a,n)||(w.push(f,a),l&&w.push(f+c,a+c),Kn(y,f,n)||w.push(f,f+c));return e+r}let g=0,P=0;const x=(tn+"").trim(),b=[];for(let n=0,a=t.length;n<a;n++){const a=t[n],l=a.geometry;if(e){let t;t="function"==typeof e?e(a&&a.properties):e,Hn.normalizeColor(b,t)}else lt(b,255,255,255);const d=g/3*4,{altitude:M,height:S}=Rn.getFeaAltitudeAndHeight(a,r,o,s,u,f,c);P=Math.max(Math.abs(M),P);let F=g;for(let t=0,n=l.length;t<n;t++){let n=l[t];const e=n.length;n[0][0]===n[e-1][0]&&n[0][1]===n[e-1][1]&&(n=n.slice(0,e-1)),g=ct(y,F,n,h,M),g=m(F,g,S*h),F=g}const A=F/3*4;for(let t=d;t<A;t+=4)p[t]=b[0],p[t+1]=b[1],p[t+2]=b[2],p[t+3]=255*(i||1);const k=w.length-v.length;for(let t=0;t<k;t++)v.push(a[x])}const F=w.reduce(((t,n)=>Math.max(t,n)),0),A=new(Rn.getIndexArrayType(F))(w),k=Rn.getUnsignedArrayType(t.length);return{aPosition:new(Rn.getPosArrayType(Math.max(512,P)))(y),indices:A,aPickingId:new k(v),aColor:p}}function Kn(t,n,e){const i=t[3*n],r=t[3*n+1];return i<0||i>e||r<0||r>e}function Qn(t,n,e,i){const r=Wn(t,n,e.lineColor,e.lineOpacity,i),o=[r.aPosition.buffer,r.indices.buffer,r.aPickingId.buffer],s=r.indices;return delete r.indices,{data:{data:r,indices:s},buffers:o}}\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 te=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function ne(t){if(!t)return"true";const n=t[0];if(t.length<=1)return"any"===n?"false":"true";return\`(${E}"=="===n?ie(t[1],t[2],"===",!1):"!="===n?ie(t[1],t[2],"!==",!1):"<"===n||">"===n||"<="===n||">="===n?ie(t[1],t[2],n,!0):"any"===n?oe(t.slice(1),"||"):"all"===n?oe(t.slice(1),"&&"):"none"===n?ce(oe(t.slice(1),"||")):"in"===n?se(t[1],t.slice(2)):"!in"===n?ce(se(t[1],t.slice(2))):"has"===n?ue(t[1]):"!has"===n?ce(ue(t[1])):"contains"===n?function(t,n,e){const i=ee(t);return void 0!==e?\`(${E}i} + '').indexOf("${E}n}") === ${E}e}\`:\`(${E}i} + '').indexOf("${E}n}") >= 0\`}(t[1],t[2],t[3]):"true"})\`}function ee(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function ie(t,n,e,i){if("object"==typeof(r=t)&&r&&t.op)return function(t,n,e,i){const r=t.property,o=t.op;let s=ee(r);return"length"!==o?(console.error(\`not support ${E}o} op\`),"false"):(s=\`((${E}s}+='').length)\`,re(s,r,n,e,i))}(t,n,e,i);var r;return re(ee(t),t,n,e,i)}function re(t,n,e,i,r){const o="$type"===n?te.indexOf(e):JSON.stringify(e);return(r?\`typeof ${E}t}=== typeof ${E}o}&&\`:"")+t+i+o}function oe(t,n){return t.map(ne).join(n)}function se(t,n){"$type"===t&&(n=n.map((t=>te.indexOf(t))));const e=JSON.stringify(n.sort(fe)),i=ee(t);return n.length<=200?\`${E}e}.indexOf(${E}i}) !== -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; }(${E}i}, ${E}e},0,${E}n.length-1})\`}function ue(t){return"$id"===t?'"id" in f':\`${E}JSON.stringify(t)} in p\`}function ce(t){return\`!(${E}t})\`}function fe(t,n){return t<n?-1:t>n?1:0}let ae=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),ae=!0}catch(t){ae=!1}var le=ae;const{VectorPack:he,PolygonPack:de,NativeLinePack:ve,LinePack:ye,PointPack:pe,NativePointPack:Me,LineExtrusionPack:we,CirclePack:me,RoundTubePack:ge,SquareTubePack:Pe,FilterUtil:xe,PackUtil:be,StyleUtil:Se,TextUtil:Fe,DEFAULT_TEX_WIDTH:Ae,GlyphRequestor:ke}=en(),Te="__original_properties",_e="__fn-type_properties";class Ie{constructor(t,n,e,i,r){this.id=t,this.options=n,this.upload=e,this.v(n.style),this.requests={},this.M=i,this.m=1,this.loadings=r}updateStyle(t,n){this.options.style=t,this.m=t.styleCounter,this.v(t),n()}updateOptions(t,n){this.options=x(this.options,t),n()}loadTile(t,n){const e=this.loadings,i=t.tileInfo.url,r=this.options.debugTile;if(r){const{x:e,y:i,z:o}=t.tileInfo;let s=!1;for(let t=0;t<r.length;t++)if(e===r[t].x&&i===r[t].y&&o===r[t].z){s=!0;break}if(!s)return void n()}if(e[i])return void e[i].push({context:t,callback:n,ref:this});e[i]=[{context:t,callback:n,ref:this}];const o=this.options.featureIdProperty;this.requests[i]=this.getTileFeatures(t,((n,r,s,u)=>{const c=e[i];if(delete e[i],this.checkIfCanceled(i))return delete this.requests[i],void this.P(c,null,{canceled:!0});if(delete this.requests[i],(this.options.debug||o)&&r)for(let n=0;n<r.length;n++)if(this.options.debug&&(r[n]._debug_info={index:n,id:r[n].id,tileId:t.tileInfo.id}),o){const t=A(o)?o[r[n].layer]:o,e=r[n].properties;r[n].id=e&&e[t]||null}if(n)this.P(c,n);else if(r&&r.length){if(c)for(let t=0;t<c.length;t++)this.S.call(c[t].ref,c[t].context,c[t].callback,i,s,r,u)}else this.P(c)}))}S(t,n,e,i,r,o){this.F(i,r,t).then((e=>{e.canceled?n(null,{canceled:!0}):(e.data.styleCounter=t.styleCounter,o&&x(e.data,o),n(null,e.data,e.buffers))})).catch((t=>{n(t)}))}abortTile(t,n){delete this.requests[t],this.A(t),n()}A(t){const n=this.loadings[t];if(n)for(let t=0;t<n.length;t++)n[t].callback(null,{canceled:!0});delete this.loadings[t]}P(t,n,e){if(t)for(let i=0;i<t.length;i++)t[i].callback(n,e)}checkIfCanceled(t){return!this.requests[t]}onRemove(){this.loadings={},delete this.M,this.requests={}}fetchIconGlyphs(t,n,e){if(this.options.workerGlyph&&le){const i=[];if(t&&Object.keys(t).length){const n=new Promise((n=>{this.upload("fetchIconGlyphs",{icons:t},null,((t,e)=>{n({err:t,iconData:e})}))}));i.push(n)}if(n&&Object.keys(n).length){const t=new Promise((t=>{this.k||(this.k=new ke),this.k.getGlyphs(n,((n,e)=>{t({err:n,glyphData:e})}))}));i.push(t)}Promise.all(i).then((t=>{const n={icons:null,glyphs:null};for(let i=0;i<t.length;i++){if(t[i].err)return void e(t[i].err);t[i].iconData?n.icons=t[i].iconData.icons:t[i].glyphData&&(n.glyphs=t[i].glyphData.glyphs)}return n})).then((t=>{e(null,t)}))}else this.upload("fetchIconGlyphs",{icons:t,glyphs:n},null,e)}F(t,n,e){if(!n.length)return Promise.resolve({data:null,buffers:[]});const{glScale:i,tileInfo:r}=e,o=!this.options.style.style.length&&!this.options.style.featureStyle.length;let s=this.pluginConfig.slice(0);o&&(s=this.T(t)),this.featurePlugins&&function(t){for(let n=1;n<arguments.length;n++){const e=arguments[n];if(e)for(let n=0,i=e.length;n<i;n++)t.push(e[n])}t.length}(s,this.featurePlugins);const u={};for(let t=0;t<s.length;t++)$e(n,e.tileInfo.z,s[t],u);const c=[],f=[];for(let t=0;t<n.length;t++){const e=n[t],i=u[t];if(i){f.fill(null);let t=0;for(const n in i){let r=0;const o=i[n].values();for(const t of o){let i=f[r];i||(i=Ge(e),f[r]=i),i.properties[n]=t,r++}r>t&&(t=r)}for(let n=0;n<t;n++)c.push(f[n])}else c.push(e)}const a=(n=c)[0].extent,l=r.z,h={x:r.extent2d.xmin*i,y:r.extent2d.ymax*i},d=[],v=[],y=[],p=this.options,M=[],w={},m=[Promise.resolve(e.styleCounter)];let g=0,P=-1;const b=[];let S=!1;for(let t=0;t<s.length;t++){P++;const i=s[t];i.type!==g&&(P=0,g=i.type);const u=0===i.type?d:v;if(i.symbol&&!1===i.symbol.visible){u[P]=null;continue}ze(i.symbol,b,t),S=S||b[t]&&b[t].size>0;const{tileFeatures:c,tileFeaIndexes:f}=this._(l,i.type,i.filter,n,w,t);if(!c.length){u[P]=null;continue}const p=f[f.length-1],F=be.getIndexArrayType(p);u[P]={styledFeatures:new F(f)},y.push({idx:t,typeIdx:P}),M.push(u[P].styledFeatures.buffer);const A=x({},e,{extent:a,zoom:l,tilePoint:h});if(this.options.debugTile){const t=this.options.debugTile;for(let n=0;n<t.length;n++){const{x:e,y:i,z:o}=t[n];if(r.x===e&&r.y===i&&r.z===o){A.debugIndex=t[n].index;break}}}let k=this.I(c,i,A);o&&(k=k.then((t=>{if(!t)return null;if(t.data)t.data.layer=c[0].layer;else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]&&t[n].data&&(t[n].data.layer=c[0].layer);return t}))),m.push(k)}return Promise.all(m).then((([e,...i])=>{if(e!==this.m)return{canceled:!0};function r(t,n){if(void 0===t.data.ref&&(t.data.type=s[y[n].idx].renderPlugin.dataConfig.type,t.data.filter=s[y[n].idx].filter.def,t.buffers&&t.buffers.length))for(let n=0;n<t.buffers.length;n++)M.push(t.buffers[n])}for(let t=0;t<i.length;t++){if(!i[t])continue;const n=i[t],e=0===s[y[t].idx].type?d:v;if(Array.isArray(n)){const i=[];for(let e=0;e<n.length;e++)n[e]&&(r(n[e],t),(void 0===n[e].data.ref||n[n[e].data.ref])&&i.push(n[e].data));i.length&&(e[y[t].typeIdx].data=i)}else r(n,t),e[y[t].typeIdx].data=n.data}const o={},u=t;if(p.features||p.schema||S){let t,e=!1;for(let i=0,r=n.length;i<r;i++)if(t=n[i],u[t.layer].properties||(u[t.layer].properties=Ce(t.properties)),t&&(p.features||S&&w[i]))if("id"===p.features)o[i]=t.id;else{p.pickingGeometry||delete t.geometry,delete t.extent,delete t.properties.$layer,delete t.properties.$type,delete t.__index;const n=t.originalFeature;if(n){const n=t.properties,e=x({},t.originalFeature);delete n[Te],e.customProps=x({},n),t=e}const r=x({},t);if(S&&w[i]&&(!p.features||"transient"===p.features)){const r=w[i];for(let i=0;i<r.length;i++){const r=b[i];r&&r.forEach((i=>{const r=n?n.properties:t.properties;r[_e]||(r[_e]=new Set),r[_e].add(i),e=!0}))}}o[i]=r}if(e)for(const t in o){const n=o[t],e=n.properties[_e];if(e){delete n.properties[_e],"transient"===p.features&&(n.fnTypeProps=x({},n.properties));for(const t in n.properties)e.has(t)||("transient"===p.features?delete n.fnTypeProps[t]:delete n.properties[t])}}}return{data:{styleCounter:e,schema:u,data:d,featureData:v,extent:a,features:o},buffers:M}})).catch((t=>{console.error(t)}))}I(t,n,e){let i=t;const r=n.renderPlugin.dataConfig,o=n.symbol,s=this.options.tileSize,{extent:u,glScale:c,zScale:f,zoom:a,tilePoint:l,centimeterToPoint:h,verticalCentimeterToPoint:d}=e,v=u/s,y=r.type,p=e.debugIndex;let M=x({},r,{EXTENT:u,zoom:a,debugIndex:p,features:this.options.features});if("3d-extrusion"===y){Le(o)&&(r.uv=1);const t=this.options.projectionCode,n=o.material&&o.material.textureWidth||Ae;return Promise.all([Promise.resolve(Jn(i,r,u,l,n,e.tileInfo.res,c,u/this.options.tileSize,h,d,o,a,t,p))])}if("3d-wireframe"===y)return Promise.all([Promise.resolve(Qn(i,u,o,r))]);if("point"===y){M=x(M,{requestor:this.fetchIconGlyphs.bind(this),altitudeToTileScale:f*u/this.options.tileSize/c});const t=pe.splitPointSymbol(o),n=he.genFnTypes(t[0]);return pe.needMerge(t[0],n,a)&&(i=pe.mergeLineFeatures(i,t[0],n,a)),Promise.all(t.map(((t,e)=>(0===e?M.fnTypes=n:delete M.fnTypes,new pe(i,t,M).load(v)))))}if("native-point"===y){const t=f*u/this.options.tileSize/c;return M.altitudeToTileScale=t,Ee(i,o,M,Me,u/s)}if("line"===y)return M=x(M,{requestor:this.fetchIconGlyphs.bind(this),tileRatio:v}),Ee(i,o,M,ye,1,!0);if("native-line"===y)return Ee(i,o,M,ve,1,!0);if("fill"===y)return M=x(M,{requestor:this.fetchIconGlyphs.bind(this)}),Ee(i,o,M,de);if("line-extrusion"===y){delete o.lineGradientProperty,o.lineJoin="miter",o.lineCap="butt";const t=Le(o);if(t&&(r.uv=1),M=x(M,{tileSize:s,zScale:f,glScale:c}),o.mergeOnProperty){const t=he.genFnTypes(o);i=ye.mergeLineFeatures(i,o,t,M.zoom)}if(t){const t=[];if(!1!==r.top){const n=x({},M);n.side=!1,t.push(new we(i,o,n))}return!1!==r.side&&(M.side=!0,M.top=!1,t.push(new we(i,o,M))),Promise.all(t.map((t=>t.load())))}return Promise.all([new we(i,o,M).load()])}if("circle"===y)return Ee(i,o,M,me);if("round-tube"===y||"square-tube"===y){const t="round-tube"===y?ge:Pe;return M=x(M,{requestor:this.fetchIconGlyphs.bind(this),radialSegments:"round-tube"===y?r.radialSegments||8:4,centimeterToPoint:h,verticalCentimeterToPoint:d,tileRatio:v,isTube:!0}),Ee(i,o,M,t)}return Promise.resolve([])}_(t,n,e,i,r,o){const s=(tn+"").trim(),u=[],c=[],f=i.length;for(let a=0;a<f;a++)if((1===n||void 0===i[a].id||!this.styledFeatures[i[a].id])&&((!e.def||"default"===e.def)&&!r[a]||!0===e.def||e.def&&(void 0!==e.def.condition||Array.isArray(e.def))&&e(i[a],t))){const t=i[a];if(void 0===t[s]&&(t[s]=a),r[a]||(r[a]=[]),r[a].push(o),c.push(t),u.push(a),1===n)break}return{tileFeatures:c,tileFeaIndexes:u}}v(t){const{style:n,featureStyle:e}=t,i={};e.forEach((t=>{Array.isArray(t.id)?(t.id.forEach((t=>{i[t]=1})),t.filter=["in","$id",...t.id]):(i[t.id]=1,t.filter=["==","$id",t.id])}));const r=xe.compileStyle(n);for(let t=0;t<n.length;t++)r[t].filter&&(r[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0),r[t].type=0;const o=[],s=xe.compileStyle(e);for(let t=0;t<e.length;t++)s[t].type=1,s[t].filter.def=e[t].filter?e[t].filter.value||e[t].filter:void 0,s[t].renderPlugin&&o.push(s[t]);this.pluginConfig=r,this.featurePlugins=o,this.styledFeatures=i}T(t){let n=this.O;this.O||(n=this.O={});const e=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],i=[];for(const o in t){const s=o;if(!n[o]){const i=[];for(let n=0;n<t[o].types.length;n++){const u=t[o].types[n],c=["all",["==","$layer",s],["==","$type",e[u]]],f={filter:(r=c,new Function("f",\`var p = (f && f.properties || {}); return ${E}ne(r)}\`)),renderPlugin:Oe(u),symbol:Ne(u)};f.filter.def=c,f.type=0,i.push(f)}n[s]=i}i.push(...n[s])}var r;return i}}function Oe(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 Ne(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 Ce(t){if(Array.isArray(t)||!A(t))return{};const n={};for(const e in t){const i=t[e];b(i)?n[e]="string":S(i)?n[e]="number":!0===i||!1===i?n[e]="boolean":Array.isArray(i)?n[e]="array":n[e]="object"}return n}function Le(t){if(!t)return 0;let n=0;for(const e in t){if(("normalTexture"===e||"bumpTexture"===e)&&t[e])return 2;if(e.indexOf("Texture")>0&&t[e])n=1;else if(A(t[e])){const i=Le(t[e]);if(2===i)return i;1===i&&(n=1)}}return n}function Ee(t,n,e,i,r,o){const s={},u=Array.isArray(n)?n:[n];let c=-1;for(let t=0;t<u.length;t++)s[t]=Ue(u[t]),!s[t]&&u[t]&&-1===c&&(c=t);const f=[];for(let n=0;n<u.length;n++){if(!u[n])continue;u[n].index={index:n};let a=t;if(o&&u[n].mergeOnProperty){const i=he.genFnTypes(u[n]);a=ye.mergeLineFeatures(t,u[0],i,e.zoom)}s[n]||n===c?f.push(new i(a,u[n],e).load(r)):f.push({data:{ref:c,symbolIndex:{index:n}}})}return Promise.all(f)}function Ue(t){if(!t)return 0;for(const n in t)if(T(t[n]))return 1;return 0}function $e(t,n,e,i){const r=e.customProperties;if(!r)return t;if(r)for(let t=0;t<r.length;t++)r[t].fn=xe.compileFilter(r[t].filter);for(let e=0;e<r.length;e++)for(let o=0,s=t.length;o<s;o++)if(r[e].fn(t[o],n))for(const t in r[e].properties){const n=r[e].properties[t];k(n)||(i[o]||(i[o]={}),i[o][t]||(i[o][t]=new Set),i[o][t].add(n))}}const je={get:(t,n)=>n in t?t[n]:t.originalFeature[n],has:(t,n)=>n in t||n in t.originalFeature},Be={get:function(t,n){return n in t?t[n]:t[Te][n]},has:(t,n)=>n in t||n in t[Te]},Ve={};function Ge(t){const n={};n.originalFeature=t;const e=new Proxy(n,je);return e.properties=new Proxy({},Be),e.properties[Te]=t.properties||Ve,e}function De(t,n,e){t[n]||(t[n]=new Set),t[n].add(e)}const Xe=[];function ze(t,n,e){if(!t)return Xe;for(const i in t){if(!t[i]||!Se.checkIfZoomFnTypeSymbol(i))continue;if(T(t[i]))De(n,e,t[i].property);else{if("lineGradientProperty"===i){De(n,e,t[i]);continue}if("textName"===i)if(b(t[i])){const r=Fe.resolveVarNames(t[i]);if(r)for(let t=0;t<r.length;t++)De(n,e,r[t])}else if(xe.isExpression(t[i])){const r=[];Fe.resolveExpVarNames(r,t[i]);for(let t=0;t<r.length;t++)De(n,e,r[t])}}const r=t[i].stops;if(r&&r.length)for(let t=0;t<r.length;t++)T(r[t][1])&&De(n,t,r[t][1].property)}return n[e]}function Je(t,n){Ye(t.geometry,n)}function Ye(t,n){if(t)switch(t.type){case"Point":qe(t.coordinates,n);break;case"MultiPoint":case"LineString":Re(t.coordinates,n);break;case"MultiLineString":!function(t,n){for(let e=0,i=t.length;e<i;e++)Re(t[e],n)}(t.coordinates,n);break;case"Polygon":He(t.coordinates,n);break;case"MultiPolygon":!function(t,n){for(let e=0,i=t.length;e<i;e++)He(t[e],n)}(t.coordinates,n);break;case"GeometryCollection":const e=t.geometries.length;for(let i=0;i<e;i++)Ye(t.geometries[i],n)}}function qe(t,n){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function Re(t,n){for(let e=0,i=t.length;e<i;e++)qe(t[e],n)}function He(t,n){t.length&&Re(t[0],n)}function Ze(t,n,e,i,r){We(t,n,e||0,i||t.length-1,r||Qe)}function We(t,n,e,i,r){for(;i>e;){if(i-e>600){var o=i-e+1,s=n-e+1,u=Math.log(o),c=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*c*(o-c)/o)*(s-o/2<0?-1:1);We(t,n,Math.max(e,Math.floor(n-s*c/o+f)),Math.min(i,Math.floor(n+(o-s)*c/o+f)),r)}var a=t[n],l=e,h=i;for(Ke(t,e,n),r(t[i],a)>0&&Ke(t,e,i);l<h;){for(Ke(t,l,h),l++,h--;r(t[l],a)<0;)l++;for(;r(t[h],a)>0;)h--}0===r(t[e],a)?Ke(t,e,h):Ke(t,++h,i),h<=n&&(e=h+1),n<=h&&(i=h-1)}}function Ke(t,n,e){var i=t[n];t[n]=t[e],t[e]=i}function Qe(t,n){return t<n?-1:t>n?1:0}class ti{constructor(t=9){this.N=Math.max(4,t),this.C=Math.max(2,Math.ceil(.4*this.N)),this.clear()}all(){return this.L(this.data,[])}search(t){let n=this.data;const e=[];if(!li(t,n))return e;const i=this.toBBox,r=[];for(;n;){for(let o=0;o<n.children.length;o++){const s=n.children[o],u=n.leaf?i(s):s;li(t,u)&&(n.leaf?e.push(s):ai(t,u)?this.L(s,e):r.push(s))}n=r.pop()}return e}collides(t){let n=this.data;if(!li(t,n))return!1;const e=[];for(;n;){for(let i=0;i<n.children.length;i++){const r=n.children[i],o=n.leaf?this.toBBox(r):r;if(li(t,o)){if(n.leaf||ai(t,o))return!0;e.push(r)}}n=e.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this.C){for(let n=0;n<t.length;n++)this.insert(t[n]);return this}let n=this.U(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this.$(this.data,n);else{if(this.data.height<n.height){const t=this.data;this.data=n,n=t}this.j(n,this.data.height-n.height-1,!0)}else this.data=n;return this}insert(t){return t&&this.j(t,this.data.height-1),this}clear(){return this.data=hi([]),this}remove(t,n){if(!t)return this;let e=this.data;const i=this.toBBox(t),r=[],o=[];let s,u,c;for(;e||r.length;){if(e||(e=r.pop(),u=r[r.length-1],s=o.pop(),c=!0),e.leaf){const i=ni(t,e.children,n);if(-1!==i)return e.children.splice(i,1),r.push(e),this.B(r),this}c||e.leaf||!ai(e,i)?u?(s++,e=u.children[s],c=!1):e=null:(r.push(e),o.push(s),s=0,u=e,e=e.children[0])}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}L(t,n){const e=[];for(;t;)t.leaf?n.push(...t.children):e.push(...t.children),t=e.pop();return n}U(t,n,e,i){const r=e-n+1;let o,s=this.N;if(r<=s)return o=hi(t.slice(n,e+1)),ei(o,this.toBBox),o;i||(i=Math.ceil(Math.log(r)/Math.log(s)),s=Math.ceil(r/Math.pow(s,i-1))),o=hi([]),o.leaf=!1,o.height=i;const u=Math.ceil(r/s),c=u*Math.ceil(Math.sqrt(s));di(t,n,e,c,this.compareMinX);for(let r=n;r<=e;r+=c){const n=Math.min(r+c-1,e);di(t,r,n,u,this.compareMinY);for(let e=r;e<=n;e+=u){const r=Math.min(e+u-1,n);o.children.push(this.U(t,e,r,i-1))}}return ei(o,this.toBBox),o}V(t,n,e,i){for(;i.push(n),!n.leaf&&i.length-1!==e;){let e,i=1/0,s=1/0;for(let u=0;u<n.children.length;u++){const c=n.children[u],f=ui(c),a=(r=t,o=c,(Math.max(o.maxX,r.maxX)-Math.min(o.minX,r.minX))*(Math.max(o.maxY,r.maxY)-Math.min(o.minY,r.minY))-f);a<s?(s=a,i=f<i?f:i,e=c):a===s&&f<i&&(i=f,e=c)}n=e||n.children[0]}var r,o;return n}j(t,n,e){const i=e?t:this.toBBox(t),r=[],o=this.V(i,this.data,n,r);for(o.children.push(t),ri(o,i);n>=0&&r[n].children.length>this.N;)this.G(r,n),n--;this.D(i,r,n)}G(t,n){const e=t[n],i=e.children.length,r=this.C;this.X(e,r,i);const o=this.J(e,r,i),s=hi(e.children.splice(o,e.children.length-o));s.height=e.height,s.leaf=e.leaf,ei(e,this.toBBox),ei(s,this.toBBox),n?t[n-1].children.push(s):this.$(e,s)}$(t,n){this.data=hi([t,n]),this.data.height=t.height+1,this.data.leaf=!1,ei(this.data,this.toBBox)}J(t,n,e){let i,r=1/0,o=1/0;for(let s=n;s<=e-n;s++){const n=ii(t,0,s,this.toBBox),u=ii(t,s,e,this.toBBox),c=fi(n,u),f=ui(n)+ui(u);c<r?(r=c,i=s,o=f<o?f:o):c===r&&f<o&&(o=f,i=s)}return i||e-n}X(t,n,e){const i=t.leaf?this.compareMinX:oi,r=t.leaf?this.compareMinY:si;this.Y(t,n,e,i)<this.Y(t,n,e,r)&&t.children.sort(i)}Y(t,n,e,i){t.children.sort(i);const r=this.toBBox,o=ii(t,0,n,r),s=ii(t,e-n,e,r);let u=ci(o)+ci(s);for(let i=n;i<e-n;i++){const n=t.children[i];ri(o,t.leaf?r(n):n),u+=ci(o)}for(let i=e-n-1;i>=n;i--){const n=t.children[i];ri(s,t.leaf?r(n):n),u+=ci(s)}return u}D(t,n,e){for(let i=e;i>=0;i--)ri(n[i],t)}B(t){for(let n,e=t.length-1;e>=0;e--)0===t[e].children.length?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():ei(t[e],this.toBBox)}}function ni(t,n,e){if(!e)return n.indexOf(t);for(let i=0;i<n.length;i++)if(e(t,n[i]))return i;return-1}function ei(t,n){ii(t,0,t.children.length,n,t)}function ii(t,n,e,i,r){r||(r=hi(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let o=n;o<e;o++){const n=t.children[o];ri(r,t.leaf?i(n):n)}return r}function ri(t,n){return t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),t}function oi(t,n){return t.minX-n.minX}function si(t,n){return t.minY-n.minY}function ui(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function ci(t){return t.maxX-t.minX+(t.maxY-t.minY)}function fi(t,n){const e=Math.max(t.minX,n.minX),i=Math.max(t.minY,n.minY),r=Math.min(t.maxX,n.maxX),o=Math.min(t.maxY,n.maxY);return Math.max(0,r-e)*Math.max(0,o-i)}function ai(t,n){return t.minX<=n.minX&&t.minY<=n.minY&&n.maxX<=t.maxX&&n.maxY<=t.maxY}function li(t,n){return n.minX<=t.maxX&&n.minY<=t.maxY&&n.maxX>=t.minX&&n.maxY>=t.minY}function hi(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function di(t,n,e,i,r){const o=[n,e];for(;o.length;){if((e=o.pop())-(n=o.pop())<=i)continue;const s=n+Math.ceil((e-n)/i/2)*i;Ze(t,s,n,e,r),o.push(n,s,s,e)}}class vi{constructor(t=[],n=yi){if(this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this.q(t)}push(t){this.data.push(t),this.length++,this.R(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this.q(0)),t}peek(){return this.data[0]}R(t){const{data:n,compare:e}=this,i=n[t];for(;t>0;){const r=t-1>>1,o=n[r];if(e(i,o)>=0)break;n[t]=o,t=r}n[t]=i}q(t){const{data:n,compare:e}=this,i=this.length>>1,r=n[t];for(;t<i;){let i=1+(t<<1),o=n[i];const s=i+1;if(s<this.length&&e(n[s],o)<0&&(i=s,o=n[s]),e(o,r)>=0)break;n[t]=o,t=i}n[t]=r}}function yi(t,n){return t<n?-1:t>n?1:0}var pi={exports:{}},Mi=function(t,n,e,i){var r=t[0],o=t[1],s=!1;void 0===e&&(e=0),void 0===i&&(i=n.length);for(var u=(i-e)/2,c=0,f=u-1;c<u;f=c++){var a=n[e+2*c+0],l=n[e+2*c+1],h=n[e+2*f+0],d=n[e+2*f+1];l>o!=d>o&&r<(h-a)*(o-l)/(d-l)+a&&(s=!s)}return s},wi=function(t,n,e,i){var r=t[0],o=t[1],s=!1;void 0===e&&(e=0),void 0===i&&(i=n.length);for(var u=i-e,c=0,f=u-1;c<u;f=c++){var a=n[c+e][0],l=n[c+e][1],h=n[f+e][0],d=n[f+e][1];l>o!=d>o&&r<(h-a)*(o-l)/(d-l)+a&&(s=!s)}return s};pi.exports=function(t,n,e,i){return n.length>0&&Array.isArray(n[0])?wi(t,n,e,i):Mi(t,n,e,i)};var mi=pi.exports.nested=wi;pi.exports.flat=Mi;const gi=11102230246251565e-32,Pi=134217729,xi=(3+8*gi)*gi;function bi(t,n,e,i,r){let o,s,u,c,f=n[0],a=i[0],l=0,h=0;a>f==a>-f?(o=f,f=n[++l]):(o=a,a=i[++h]);let d=0;if(l<t&&h<e)for(a>f==a>-f?(s=f+o,u=o-(s-f),f=n[++l]):(s=a+o,u=o-(s-a),a=i[++h]),o=s,0!==u&&(r[d++]=u);l<t&&h<e;)a>f==a>-f?(s=o+f,c=s-o,u=o-(s-c)+(f-c),f=n[++l]):(s=o+a,c=s-o,u=o-(s-c)+(a-c),a=i[++h]),o=s,0!==u&&(r[d++]=u);for(;l<t;)s=o+f,c=s-o,u=o-(s-c)+(f-c),f=n[++l],o=s,0!==u&&(r[d++]=u);for(;h<e;)s=o+a,c=s-o,u=o-(s-c)+(a-c),a=i[++h],o=s,0!==u&&(r[d++]=u);return 0===o&&0!==d||(r[d++]=o),d}function Si(t){return new Float64Array(t)}const Fi=33306690738754716e-32,Ai=22204460492503146e-32,ki=11093356479670487e-47,Ti=Si(4),_i=Si(8),Ii=Si(12),Oi=Si(16),Ni=Si(4);function Ci(t,n,e,i,r,o){const s=(n-o)*(e-r),u=(t-r)*(i-o),c=s-u;if(0===s||0===u||s>0!=u>0)return c;const f=Math.abs(s+u);return Math.abs(c)>=Fi*f?c:-function(t,n,e,i,r,o,s){let u,c,f,a,l,h,d,v,y,p,M,w,m,g,P,x,b,S;const F=t-r,A=e-r,k=n-o,T=i-o;g=F*T,h=Pi*F,d=h-(h-F),v=F-d,h=Pi*T,y=h-(h-T),p=T-y,P=v*p-(g-d*y-v*y-d*p),x=k*A,h=Pi*k,d=h-(h-k),v=k-d,h=Pi*A,y=h-(h-A),p=A-y,b=v*p-(x-d*y-v*y-d*p),M=P-b,l=P-M,Ti[0]=P-(M+l)+(l-b),w=g+M,l=w-g,m=g-(w-l)+(M-l),M=m-x,l=m-M,Ti[1]=m-(M+l)+(l-x),S=w+M,l=S-w,Ti[2]=w-(S-l)+(M-l),Ti[3]=S;let _=function(t,n){let e=n[0];for(let i=1;i<t;i++)e+=n[i];return e}(4,Ti),I=Ai*s;if(_>=I||-_>=I)return _;if(l=t-F,u=t-(F+l)+(l-r),l=e-A,f=e-(A+l)+(l-r),l=n-k,c=n-(k+l)+(l-o),l=i-T,a=i-(T+l)+(l-o),0===u&&0===c&&0===f&&0===a)return _;if(I=ki*s+xi*Math.abs(_),_+=F*a+T*u-(k*f+A*c),_>=I||-_>=I)return _;g=u*T,h=Pi*u,d=h-(h-u),v=u-d,h=Pi*T,y=h-(h-T),p=T-y,P=v*p-(g-d*y-v*y-d*p),x=c*A,h=Pi*c,d=h-(h-c),v=c-d,h=Pi*A,y=h-(h-A),p=A-y,b=v*p-(x-d*y-v*y-d*p),M=P-b,l=P-M,Ni[0]=P-(M+l)+(l-b),w=g+M,l=w-g,m=g-(w-l)+(M-l),M=m-x,l=m-M,Ni[1]=m-(M+l)+(l-x),S=w+M,l=S-w,Ni[2]=w-(S-l)+(M-l),Ni[3]=S;const O=bi(4,Ti,4,Ni,_i);g=F*a,h=Pi*F,d=h-(h-F),v=F-d,h=Pi*a,y=h-(h-a),p=a-y,P=v*p-(g-d*y-v*y-d*p),x=k*f,h=Pi*k,d=h-(h-k),v=k-d,h=Pi*f,y=h-(h-f),p=f-y,b=v*p-(x-d*y-v*y-d*p),M=P-b,l=P-M,Ni[0]=P-(M+l)+(l-b),w=g+M,l=w-g,m=g-(w-l)+(M-l),M=m-x,l=m-M,Ni[1]=m-(M+l)+(l-x),S=w+M,l=S-w,Ni[2]=w-(S-l)+(M-l),Ni[3]=S;const N=bi(O,_i,4,Ni,Ii);g=u*a,h=Pi*u,d=h-(h-u),v=u-d,h=Pi*a,y=h-(h-a),p=a-y,P=v*p-(g-d*y-v*y-d*p),x=c*f,h=Pi*c,d=h-(h-c),v=c-d,h=Pi*f,y=h-(h-f),p=f-y,b=v*p-(x-d*y-v*y-d*p),M=P-b,l=P-M,Ni[0]=P-(M+l)+(l-b),w=g+M,l=w-g,m=g-(w-l)+(M-l),M=m-x,l=m-M,Ni[1]=m-(M+l)+(l-x),S=w+M,l=S-w,Ni[2]=w-(S-l)+(M-l),Ni[3]=S;const C=bi(N,Ii,4,Ni,Oi);return Oi[C-1]}(t,n,e,i,r,o,f)}function Li(t,n,e){n=Math.max(0,void 0===n?2:n),e=e||0;var i=function(t){for(var n=t[0],e=t[0],i=t[0],r=t[0],o=0;o<t.length;o++){var s=t[o];s[0]<n[0]&&(n=s),s[0]>i[0]&&(i=s),s[1]<e[1]&&(e=s),s[1]>r[1]&&(r=s)}var u=[n,e,i,r],c=u.slice();for(o=0;o<t.length;o++)mi(t[o],u)||c.push(t[o]);return function(t){t.sort(Yi);for(var n=[],e=0;e<t.length;e++){for(;n.length>=2&&Vi(n[n.length-2],n[n.length-1],t[e])<=0;)n.pop();n.push(t[e])}for(var i=[],r=t.length-1;r>=0;r--){for(;i.length>=2&&Vi(i[i.length-2],i[i.length-1],t[r])<=0;)i.pop();i.push(t[r])}return i.pop(),n.pop(),n.concat(i)}(c)}(t),r=new ti(16);r.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},r.compareMinX=function(t,n){return t[0]-n[0]},r.compareMinY=function(t,n){return t[1]-n[1]},r.load(t);for(var o,s=[],u=0;u<i.length;u++){var c=i[u];r.remove(c),o=Di(c,o),s.push(o)}var f=new ti(16);for(u=0;u<s.length;u++)f.insert(Gi(s[u]));for(var a=n*n,l=e*e;s.length;){var h=s.shift(),d=h.p,v=h.next.p,y=Xi(d,v);if(!(y<l)){var p=y/a;(c=Ei(r,h.prev.p,d,v,h.next.next.p,p,f))&&Math.min(Xi(c,d),Xi(c,v))<=p&&(s.push(h),s.push(Di(c,h)),r.remove(c),f.remove(h),f.insert(Gi(h)),f.insert(Gi(h.next)))}}h=o;var M=[];do{M.push(h.p),h=h.next}while(h!==o);return M.push(h.p),M}function Ei(t,n,e,i,r,o,s){for(var u=new vi([],Ui),c=t.data;c;){for(var f=0;f<c.children.length;f++){var a=c.children[f],l=c.leaf?zi(a,e,i):$i(e,i,a);l>o||u.push({node:a,dist:l})}for(;u.length&&!u.peek().node.children;){var h=u.pop(),d=h.node,v=zi(d,n,e),y=zi(d,i,r);if(h.dist<v&&h.dist<y&&Bi(e,d,s)&&Bi(i,d,s))return d}(c=u.pop())&&(c=c.node)}return null}function Ui(t,n){return t.dist-n.dist}function $i(t,n,e){if(ji(t,e)||ji(n,e))return 0;var i=Ji(t[0],t[1],n[0],n[1],e.minX,e.minY,e.maxX,e.minY);if(0===i)return 0;var r=Ji(t[0],t[1],n[0],n[1],e.minX,e.minY,e.minX,e.maxY);if(0===r)return 0;var o=Ji(t[0],t[1],n[0],n[1],e.maxX,e.minY,e.maxX,e.maxY);if(0===o)return 0;var s=Ji(t[0],t[1],n[0],n[1],e.minX,e.maxY,e.maxX,e.maxY);return 0===s?0:Math.min(i,r,o,s)}function ji(t,n){return t[0]>=n.minX&&t[0]<=n.maxX&&t[1]>=n.minY&&t[1]<=n.maxY}function Bi(t,n,e){for(var i,r,o,s,u=Math.min(t[0],n[0]),c=Math.min(t[1],n[1]),f=Math.max(t[0],n[0]),a=Math.max(t[1],n[1]),l=e.search({minX:u,minY:c,maxX:f,maxY:a}),h=0;h<l.length;h++)if(i=l[h].p,r=l[h].next.p,o=t,i!==(s=n)&&r!==o&&Vi(i,r,o)>0!=Vi(i,r,s)>0&&Vi(o,s,i)>0!=Vi(o,s,r)>0)return!1;return!0}function Vi(t,n,e){return Ci(t[0],t[1],n[0],n[1],e[0],e[1])}function Gi(t){var n=t.p,e=t.next.p;return t.minX=Math.min(n[0],e[0]),t.minY=Math.min(n[1],e[1]),t.maxX=Math.max(n[0],e[0]),t.maxY=Math.max(n[1],e[1]),t}function Di(t,n){var e={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return n?(e.next=n.next,e.prev=n,n.next.prev=e,n.next=e):(e.prev=e,e.next=e),e}function Xi(t,n){var e=t[0]-n[0],i=t[1]-n[1];return e*e+i*i}function zi(t,n,e){var i=n[0],r=n[1],o=e[0]-i,s=e[1]-r;if(0!==o||0!==s){var u=((t[0]-i)*o+(t[1]-r)*s)/(o*o+s*s);u>1?(i=e[0],r=e[1]):u>0&&(i+=o*u,r+=s*u)}return(o=t[0]-i)*o+(s=t[1]-r)*s}function Ji(t,n,e,i,r,o,s,u){var c,f,a,l,h=e-t,d=i-n,v=s-r,y=u-o,p=t-r,M=n-o,w=h*h+d*d,m=h*v+d*y,g=v*v+y*y,P=h*p+d*M,x=v*p+y*M,b=w*g-m*m,S=b,F=b;0===b?(f=0,S=1,l=x,F=g):(l=w*x-m*P,(f=m*x-g*P)<0?(f=0,l=x,F=g):f>S&&(f=S,l=x+m,F=g)),l<0?(l=0,-P<0?f=0:-P>w?f=S:(f=-P,S=w)):l>F&&(l=F,-P+m<0?f=0:-P+m>w?f=S:(f=-P+m,S=w));var A=(1-(a=0===l?0:l/F))*r+a*s-((1-(c=0===f?0:f/S))*t+c*e),k=(1-a)*o+a*u-((1-c)*n+c*i);return A*A+k*k}function Yi(t,n){return t[0]===n[0]?t[1]-n[1]:t[0]-n[0]}const{PackUtil:qi}=en();class Ri{constructor(t,n){this.x=t,this.y=n}clone(){return new Ri(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 Ri(this.x-t.x,this.y-t.y)}distance(t){const n=this.x-t.x,e=this.y-t.y;return Math.sqrt(n*n+e*e)}dot(t){return this.x*t.x+this.y*t.y}equals(t){return this.x===t.x&&this.y===t.y}orthogonal(){return new Ri(this.y,-this.x)}}function Hi(t,n,e,i){const r=n.x*i.y-n.y*i.x,o=e.x-t.x,s=e.y-t.y,u=(o*i.y-s*i.x)/r;return new Ri(t.x+u*n.x,t.y+u*n.y)}const Zi=[],Wi=[];function Ki(t){if(S(t[0]&&t[0].x)){const n=[];let e=0;for(let i=0;i<t.length;i++)Wi[e]?(Wi[e][0]=t[i].x,Wi[e][1]=t[i].y):Wi[e]=[t[i].x,t[i].y],n.push(Wi[e]),e++;t=n}try{const n=Li(t,1/0);let e=[1/0,1/0],i=[-1/0,-1/0];for(let t=0;t<n.length;t++)n[t][0]<e[0]&&(e[0]=n[t][0]),n[t][0]>i[0]&&(i[0]=n[t][0]),n[t][1]<e[1]&&(e[1]=n[t][1]),n[t][1]>i[1]&&(i[1]=n[t][1]);const r=[];let o=[],s=0;for(let t=0;t<n.length;t++)t===n.length-1&&n[t][0]===n[0][0]&&n[t][1]===n[0][1]||(gt(r,n[t],"EPSG:3857"),Zi[s]?(Zi[s].x=r[0],Zi[s].y=r[1]):Zi[s]=new Ri(r[0],r[1]),o.push(Zi[s]),s++);qi.calculateSignedArea(o)<0&&(o=o.reverse());const u=function(t){let n,e=Number.MAX_VALUE;const i=function(t,i,r,o,s,u,c,f){var a=Hi(t,i,s,u),l=Hi(r,o,s,u),h=Hi(c,f,t,i),d=Hi(c,f,r,o),v=a.distance(l)*a.distance(h);0!==v&&v<e&&(n=[a,h,d,l],e=v)};var r=[];for(let n=0;n<t.length;n++)r.push(t[(n+1)%t.length].diff(t[n])),r[n].normalize();var o,s,u,c,f=new Ri(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),a=new Ri(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let n=0;n<t.length;n++){var l=t[n];l.x<f.x&&(f.x=l.x,o=n),l.x>a.x&&(a.x=l.x,s=n),l.y<f.y&&(f.y=l.y,c=n),l.y>a.y&&(a.y=l.y,u=n)}var h=new Ri(0,-1),d=new Ri(0,1),v=new Ri(-1,0),y=new Ri(1,0);for(let n=0;n<t.length;n++){var p=[Math.acos(h.dot(r[o])),Math.acos(d.dot(r[s])),Math.acos(v.dot(r[u])),Math.acos(y.dot(r[c]))];switch(p.indexOf(Math.min.apply(Math,p))){case 0:(d=(h=r[o].clone()).clone()).negate(),(y=(v=h.orthogonal()).clone()).negate(),o=(o+1)%t.length;break;case 1:(h=(d=r[s].clone()).clone()).negate(),(y=(v=h.orthogonal()).clone()).negate(),s=(s+1)%t.length;break;case 2:(y=(v=r[u].clone()).clone()).negate(),(d=(h=y.orthogonal()).clone()).negate(),u=(u+1)%t.length;break;case 3:(v=(y=r[c].clone()).clone()).negate(),(d=(h=y.orthogonal()).clone()).negate(),c=(c+1)%t.length}i(t[o],h,t[s],d,t[u],v,t[c],y)}return n}(o);if(!u||4!==u.length)return null;const c=u[0].distance(u[1]),f=u[1].distance(u[2]),a=u.map((t=>[t.x,t.y]));return a.push(+(f>c)),a}catch(t){return null}}const Qi=[];function tr(t,n){const e=Array.isArray(t&&t[0]&&t[0][0]);for(let i=0;i<t.length;i++)e?t[i]=tr(t[i]):(gt(Qi,t[i],n),t[i][0]=Qi[0],t[i][1]=Qi[1]);return t}const{PackUtil:nr}=en();class er extends Ie{constructor(t,n,e,i,r,o){super(t,n,e,i,r),(n=n||{}).extent||(n.extent=8192),this.setData(n.data,o)}setData(t,n){if(delete this.index,function(t){if(!t)return!0;if(Array.isArray(t)&&!t.length)return!0;if(t.features&&!t.features.length)return!0;return!1}(t))return this.empty=!0,void n();const e={maxZoom:24,tolerance:this.options.simplifyTolerance,extent:this.options.extent,buffer: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&&(e.projection=this.options.projection,"EPSG:4490"===e.projection&&(e.projection="EPSG:4326")),b(t)&&"{"!=t.substring(0,1)||t.url){const i=t.url?t.url:t;I.getJSON(i,t.url?t:{},((t,r)=>{if(t&&(console.error("Failed to fetch geojson:"+i),n(t)),!r)return void n(null,{extent:null,idMap:{}});let o=r;if(this.options.convertFn){o=new Function("data",this.options.convertFn+"\\nreturn convert(data)")(o)}const s=Array.isArray(o)?o:o.features;this.H(s);const{sample1000:u,idMap:c}=this.Z(s);this.W(u,c,o,e,n)}))}else{"string"==typeof t&&(t=JSON.parse(t));const i=Array.isArray(t)?t:t.features,r=i&&i.length;this.H(i);let o=i;if(i&&r>1e3){o=[];for(let t=0;t<r;t++)ir(i[t],o,t,r)}this.W(o,null,t,e,n)}}H(t){if(this.options.generateOMBB&&t)for(let n=0;n<t.length;n++){const e=t[n];if(e&&e.geometry&&e.geometry.coordinates)if("Polygon"===e.geometry.type){const t=e.geometry.coordinates[0];if(!t)continue;const n=Ki(t,t.length);e.properties=e.properties||{},e.properties[nn]=n}else if("MultiPolygon"===e.geometry.type){const t=e.geometry.coordinates;for(let n=0;n<t.length;n++){if(!t[n])continue;const i=t[n][0];if(!i)continue;const r=Ki(i,i.length);e.properties=e.properties||{},e.properties[nn]=e.properties[nn]||[],e.properties[nn][n]=r}}}}W(t,n,e,i,r){try{const o=t&&t.length?function(t){let n=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];switch(t.type){case"FeatureCollection":const e=t.features.length;for(let i=0;i<e;i++)Je(t.features[i],n);break;case"Feature":Je(t,n);break;default:Ye(t,n)}return n}({type:"FeatureCollection",features:t}):null;this.index=function(t,n){return new st(t,n)}(e,this.options.geojsonvt||i),r(null,{extent:o,idMap:n})}catch(t){console.warn(t),r({error:t.message})}}Z(t){const n=[],e={};let i=0;const r=this.options.featureIdProperty;if(t){const o=t.length;t.forEach(((t,s)=>{!function(t,o,s){if(t&&("Feature"!==t.type||t.geometry)){if(S(t.id)||(t.id=i++),r){let n=r;A(r)&&(n=r[t.layer||"0"]),t.id=t.properties[n]}e[t.id]=x({},t),t.geometry?(e[t.id].geometry=x({},t.geometry),e[t.id].geometry.coordinates=null):t.coordinates&&(e[t.id].coordinates=null),ir(t,n,o,s)}}(t,s,o)}))}return{sample1000:n,idMap:e}}getTileFeatures(t,n){const e=t.tileInfo,i=[];if(!this.index)return this.empty?(setTimeout((function(){n(null,i,[])}),1),1):(setTimeout((function(){n({loading:!0})}),1),1);const r=this.index.getTile(e.z,e.x,e.y);if(!r||0===r.features.length)return setTimeout((function(){n(null,i,[])}),1),1;const o=[];for(let t=0,n=r.features.length;t<n;t++){const n=r.features[t];let e=n.layer;void 0===e&&(e="0"),o[e]={types:{}};o[e].types[n.type]=1,n.tags=n.tags||{},n.geometry.converted||(nr.convertGeometry(n),n.geometry.converted=1),i.push({type:n.type,layer:e,id:n.id,geometry:n.geometry,properties:n.tags,extent:this.options.extent})}for(const t in o)o[t].types=Object.keys(o[t].types).map((t=>+t));return setTimeout((function(){n(null,i,o)}),1),1}onRemove(){super.onRemove(),delete this.index}}function ir(t,n,e,i){const r=Math.floor(i/998);(0===e||e===i-1||(0===r||e%r==0)&&n.length<999)&&n.push(t)}var rr={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,n,e,i,r){var o,s,u=8*r-i-1,c=(1<<u)-1,f=c>>1,a=-7,l=e?r-1:0,h=e?-1:1,d=t[n+l];for(l+=h,o=d&(1<<-a)-1,d>>=-a,a+=u;a>0;o=256*o+t[n+l],l+=h,a-=8);for(s=o&(1<<-a)-1,o>>=-a,a+=i;a>0;s=256*s+t[n+l],l+=h,a-=8);if(0===o)o=1-f;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),o-=f}return(d?-1:1)*s*Math.pow(2,o-i)},write:function(t,n,e,i,r,o){var s,u,c,f=8*o-r-1,a=(1<<f)-1,l=a>>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:o-1,v=i?1:-1,y=n<0||0===n&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(u=isNaN(n)?1:0,s=a):(s=Math.floor(Math.log(n)/Math.LN2),n*(c=Math.pow(2,-s))<1&&(s--,c*=2),(n+=s+l>=1?h/c:h*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=a?(u=0,s=a):s+l>=1?(u=(n*c-1)*Math.pow(2,r),s+=l):(u=n*Math.pow(2,l-1)*Math.pow(2,r),s=0));r>=8;t[e+d]=255&u,d+=v,u/=256,r-=8);for(s=s<<r|u,f+=r;f>0;t[e+d]=255&s,d+=v,s/=256,f-=8);t[e+d-v]|=128*y}},or=ur,sr=rr;function ur(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}ur.Varint=0,ur.Fixed64=1,ur.Bytes=2,ur.Fixed32=5;var cr=4294967296,fr=1/cr,ar="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function lr(t){return t.type===ur.Bytes?t.readVarint()+t.pos:t.pos+1}function hr(t,n,e){return e?4294967296*n+(t>>>0):4294967296*(n>>>0)+(t>>>0)}function dr(t,n,e){var i=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));e.realloc(i);for(var r=e.pos-1;r>=t;r--)e.buf[r+i]=e.buf[r]}function vr(t,n){for(var e=0;e<t.length;e++)n.writeVarint(t[e])}function yr(t,n){for(var e=0;e<t.length;e++)n.writeSVarint(t[e])}function pr(t,n){for(var e=0;e<t.length;e++)n.writeFloat(t[e])}function Mr(t,n){for(var e=0;e<t.length;e++)n.writeDouble(t[e])}function wr(t,n){for(var e=0;e<t.length;e++)n.writeBoolean(t[e])}function mr(t,n){for(var e=0;e<t.length;e++)n.writeFixed32(t[e])}function gr(t,n){for(var e=0;e<t.length;e++)n.writeSFixed32(t[e])}function Pr(t,n){for(var e=0;e<t.length;e++)n.writeFixed64(t[e])}function xr(t,n){for(var e=0;e<t.length;e++)n.writeSFixed64(t[e])}function br(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+16777216*t[n+3]}function Sr(t,n,e){t[e]=n,t[e+1]=n>>>8,t[e+2]=n>>>16,t[e+3]=n>>>24}function Fr(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+(t[n+3]<<24)}ur.prototype={destroy:function(){this.buf=null},readFields:function(t,n,e){for(e=e||this.length;this.pos<e;){var i=this.readVarint(),r=i>>3,o=this.pos;this.type=7&i,t(r,n,this),this.pos===o&&this.skip(i)}return n},readMessage:function(t,n){return this.readFields(t,n,this.readVarint()+this.pos)},readFixed32:function(){var t=br(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Fr(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=br(this.buf,this.pos)+br(this.buf,this.pos+4)*cr;return this.pos+=8,t},readSFixed64:function(){var t=br(this.buf,this.pos)+Fr(this.buf,this.pos+4)*cr;return this.pos+=8,t},readFloat:function(){var t=sr.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=sr.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var n,e,i=this.buf;return n=127&(e=i[this.pos++]),e<128?n:(n|=(127&(e=i[this.pos++]))<<7,e<128?n:(n|=(127&(e=i[this.pos++]))<<14,e<128?n:(n|=(127&(e=i[this.pos++]))<<21,e<128?n:function(t,n,e){var i,r,o=e.buf;if(r=o[e.pos++],i=(112&r)>>4,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(127&r)<<3,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(127&r)<<10,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(127&r)<<17,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(127&r)<<24,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(1&r)<<31,r<128)return hr(t,i,n);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(e=i[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,n=this.pos;return this.pos=t,t-n>=12&&ar?function(t,n,e){return ar.decode(t.subarray(n,e))}(this.buf,n,t):function(t,n,e){var i="",r=n;for(;r<e;){var o,s,u,c=t[r],f=null,a=c>239?4:c>223?3:c>191?2:1;if(r+a>e)break;1===a?c<128&&(f=c):2===a?128==(192&(o=t[r+1]))&&(f=(31&c)<<6|63&o)<=127&&(f=null):3===a?(o=t[r+1],s=t[r+2],128==(192&o)&&128==(192&s)&&((f=(15&c)<<12|(63&o)<<6|63&s)<=2047||f>=55296&&f<=57343)&&(f=null)):4===a&&(o=t[r+1],s=t[r+2],u=t[r+3],128==(192&o)&&128==(192&s)&&128==(192&u)&&((f=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&u)<=65535||f>=1114112)&&(f=null)),null===f?(f=65533,a=1):f>65535&&(f-=65536,i+=String.fromCharCode(f>>>10&1023|55296),f=56320|1023&f),i+=String.fromCharCode(f),r+=a}return i}(this.buf,n,t)},readBytes:function(){var t=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,t);return this.pos=t,n},readPackedVarint:function(t,n){if(this.type!==ur.Bytes)return t.push(this.readVarint(n));var e=lr(this);for(t=t||[];this.pos<e;)t.push(this.readVarint(n));return t},readPackedSVarint:function(t){if(this.type!==ur.Bytes)return t.push(this.readSVarint());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==ur.Bytes)return t.push(this.readBoolean());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==ur.Bytes)return t.push(this.readFloat());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==ur.Bytes)return t.push(this.readDouble());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==ur.Bytes)return t.push(this.readFixed32());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==ur.Bytes)return t.push(this.readSFixed32());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==ur.Bytes)return t.push(this.readFixed64());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==ur.Bytes)return t.push(this.readSFixed64());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed64());return t},skip:function(t){var n=7&t;if(n===ur.Varint)for(;this.buf[this.pos++]>127;);else if(n===ur.Bytes)this.pos=this.readVarint()+this.pos;else if(n===ur.Fixed32)this.pos+=4;else{if(n!==ur.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(t,n){this.writeVarint(t<<3|n)},realloc:function(t){for(var n=this.length||16;n<this.pos+t;)n*=2;if(n!==this.length){var e=new Uint8Array(n);e.set(this.buf),this.buf=e,this.length=n}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Sr(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Sr(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Sr(this.buf,-1&t,this.pos),Sr(this.buf,Math.floor(t*fr),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Sr(this.buf,-1&t,this.pos),Sr(this.buf,Math.floor(t*fr),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,n){var e,i;t>=0?(e=t%4294967296|0,i=t/4294967296|0):(i=~(-t/4294967296),4294967295^(e=~(-t%4294967296))?e=e+1|0:(e=0,i=i+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");n.realloc(10),function(t,n,e){e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos]=127&t}(e,0,n),function(t,n){var e=(7&t)<<4;if(n.buf[n.pos++]|=e|((t>>>=3)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;n.buf[n.pos++]=127&t}(i,n)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var n=this.pos;this.pos=function(t,n,e){for(var i,r,o=0;o<n.length;o++){if((i=n.charCodeAt(o))>55295&&i<57344){if(!r){i>56319||o+1===n.length?(t[e++]=239,t[e++]=191,t[e++]=189):r=i;continue}if(i<56320){t[e++]=239,t[e++]=191,t[e++]=189,r=i;continue}i=r-55296<<10|i-56320|65536,r=null}else r&&(t[e++]=239,t[e++]=191,t[e++]=189,r=null);i<128?t[e++]=i:(i<2048?t[e++]=i>>6|192:(i<65536?t[e++]=i>>12|224:(t[e++]=i>>18|240,t[e++]=i>>12&63|128),t[e++]=i>>6&63|128),t[e++]=63&i|128)}return e}(this.buf,t,this.pos);var e=this.pos-n;e>=128&&dr(n,e,this),this.pos=n-1,this.writeVarint(e),this.pos+=e},writeFloat:function(t){this.realloc(4),sr.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),sr.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var n=t.length;this.writeVarint(n),this.realloc(n);for(var e=0;e<n;e++)this.buf[this.pos++]=t[e]},writeRawMessage:function(t,n){this.pos++;var e=this.pos;t(n,this);var i=this.pos-e;i>=128&&dr(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeMessage:function(t,n,e){this.writeTag(t,ur.Bytes),this.writeRawMessage(n,e)},writePackedVarint:function(t,n){n.length&&this.writeMessage(t,vr,n)},writePackedSVarint:function(t,n){n.length&&this.writeMessage(t,yr,n)},writePackedBoolean:function(t,n){n.length&&this.writeMessage(t,wr,n)},writePackedFloat:function(t,n){n.length&&this.writeMessage(t,pr,n)},writePackedDouble:function(t,n){n.length&&this.writeMessage(t,Mr,n)},writePackedFixed32:function(t,n){n.length&&this.writeMessage(t,mr,n)},writePackedSFixed32:function(t,n){n.length&&this.writeMessage(t,gr,n)},writePackedFixed64:function(t,n){n.length&&this.writeMessage(t,Pr,n)},writePackedSFixed64:function(t,n){n.length&&this.writeMessage(t,xr,n)},writeBytesField:function(t,n){this.writeTag(t,ur.Bytes),this.writeBytes(n)},writeFixed32Field:function(t,n){this.writeTag(t,ur.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(t,n){this.writeTag(t,ur.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(t,n){this.writeTag(t,ur.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(t,n){this.writeTag(t,ur.Fixed64),this.writeSFixed64(n)},writeVarintField:function(t,n){this.writeTag(t,ur.Varint),this.writeVarint(n)},writeSVarintField:function(t,n){this.writeTag(t,ur.Varint),this.writeSVarint(n)},writeStringField:function(t,n){this.writeTag(t,ur.Bytes),this.writeString(n)},writeFloatField:function(t,n){this.writeTag(t,ur.Fixed32),this.writeFloat(n)},writeDoubleField:function(t,n){this.writeTag(t,ur.Fixed64),this.writeDouble(n)},writeBooleanField:function(t,n){this.writeVarintField(t,Boolean(n))}};var Ar=Ft(or),kr=Tr;function Tr(t,n){this.x=t,this.y=n}Tr.prototype={clone:function(){return new Tr(this.x,this.y)},add:function(t){return this.clone().K(t)},sub:function(t){return this.clone().tt(t)},multByPoint:function(t){return this.clone().nt(t)},divByPoint:function(t){return this.clone().et(t)},mult:function(t){return this.clone().it(t)},div:function(t){return this.clone().rt(t)},rotate:function(t){return this.clone().ot(t)},rotateAround:function(t,n){return this.clone().st(t,n)},matMult:function(t){return this.clone().ut(t)},unit:function(){return this.clone().ct()},perp:function(){return this.clone().ft()},round:function(){return this.clone().lt()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var n=t.x-this.x,e=t.y-this.y;return n*n+e*e},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},ut:function(t){var n=t[0]*this.x+t[1]*this.y,e=t[2]*this.x+t[3]*this.y;return this.x=n,this.y=e,this},K:function(t){return this.x+=t.x,this.y+=t.y,this},tt:function(t){return this.x-=t.x,this.y-=t.y,this},it:function(t){return this.x*=t,this.y*=t,this},rt:function(t){return this.x/=t,this.y/=t,this},nt:function(t){return this.x*=t.x,this.y*=t.y,this},et:function(t){return this.x/=t.x,this.y/=t.y,this},ct:function(){return this.rt(this.mag()),this},ft:function(){var t=this.y;return this.y=this.x,this.x=-t,this},ot:function(t){var n=Math.cos(t),e=Math.sin(t),i=n*this.x-e*this.y,r=e*this.x+n*this.y;return this.x=i,this.y=r,this},st:function(t,n){var e=Math.cos(t),i=Math.sin(t),r=n.x+e*(this.x-n.x)-i*(this.y-n.y),o=n.y+i*(this.x-n.x)+e*(this.y-n.y);return this.x=r,this.y=o,this},lt:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Tr.convert=function(t){return t instanceof Tr?t:Array.isArray(t)?new Tr(t[0],t[1]):t};var _r=kr,Ir=Or;function Or(t,n,e,i,r){this.properties={},this.extent=e,this.type=0,this.ht=t,this.dt=-1,this.vt=i,this.yt=r,t.readFields(Nr,this,n)}function Nr(t,n,e){1==t?n.id=e.readVarint():2==t?function(t,n){var e=t.readVarint()+t.pos;for(;t.pos<e;){var i=n.vt[t.readVarint()],r=n.yt[t.readVarint()];n.properties[i]=r}}(e,n):3==t?n.type=e.readVarint():4==t&&(n.dt=e.pos)}function Cr(t){for(var n,e,i=0,r=0,o=t.length,s=o-1;r<o;s=r++)n=t[r],i+=((e=t[s]).x-n.x)*(n.y+e.y);return i}Or.types=["Unknown","Point","LineString","Polygon"],Or.prototype.loadGeometry=function(){var t=this.ht;t.pos=this.dt;for(var n,e=t.readVarint()+t.pos,i=1,r=0,o=0,s=0,u=[];t.pos<e;){if(r<=0){var c=t.readVarint();i=7&c,r=c>>3}if(r--,1===i||2===i)o+=t.readSVarint(),s+=t.readSVarint(),1===i&&(n&&u.push(n),n=[]),n.push(new _r(o,s));else{if(7!==i)throw new Error("unknown command "+i);n&&n.push(n[0].clone())}}return n&&u.push(n),u},Or.prototype.bbox=function(){var t=this.ht;t.pos=this.dt;for(var n=t.readVarint()+t.pos,e=1,i=0,r=0,o=0,s=1/0,u=-1/0,c=1/0,f=-1/0;t.pos<n;){if(i<=0){var a=t.readVarint();e=7&a,i=a>>3}if(i--,1===e||2===e)(r+=t.readSVarint())<s&&(s=r),r>u&&(u=r),(o+=t.readSVarint())<c&&(c=o),o>f&&(f=o);else if(7!==e)throw new Error("unknown command "+e)}return[s,c,u,f]},Or.prototype.toGeoJSON=function(t,n,e){var i,r,o=this.extent*Math.pow(2,e),s=this.extent*t,u=this.extent*n,c=this.loadGeometry(),f=Or.types[this.type];function a(t){for(var n=0;n<t.length;n++){var e=t[n],i=180-360*(e.y+u)/o;t[n]=[360*(e.x+s)/o-180,360/Math.PI*Math.atan(Math.exp(i*Math.PI/180))-90]}}switch(this.type){case 1:var l=[];for(i=0;i<c.length;i++)l[i]=c[i][0];a(c=l);break;case 2:for(i=0;i<c.length;i++)a(c[i]);break;case 3:for(c=function(t){var n=t.length;if(n<=1)return[t];for(var e,i,r=[],o=0;o<n;o++){var s=Cr(t[o]);0!==s&&(void 0===i&&(i=s<0),i===s<0?(e&&r.push(e),e=[t[o]]):e.push(t[o]))}e&&r.push(e);return r}(c),i=0;i<c.length;i++)for(r=0;r<c[i].length;r++)a(c[i][r])}1===c.length?c=c[0]:f="Multi"+f;var h={type:"Feature",geometry:{type:f,coordinates:c},properties:this.properties};return"id"in this&&(h.id=this.id),h};var Lr=Ir,Er=Ur;function Ur(t,n){this.version=1,this.name=null,this.extent=4096,this.length=0,this.ht=t,this.vt=[],this.yt=[],this.Mt=[],t.readFields($r,this,n),this.length=this.Mt.length}function $r(t,n,e){15===t?n.version=e.readVarint():1===t?n.name=e.readString():5===t?n.extent=e.readVarint():2===t?n.Mt.push(e.pos):3===t?n.vt.push(e.readString()):4===t&&n.yt.push(function(t){var n=null,e=t.readVarint()+t.pos;for(;t.pos<e;){var i=t.readVarint()>>3;n=1===i?t.readString():2===i?t.readFloat():3===i?t.readDouble():4===i?t.readVarint64():5===i?t.readVarint():6===i?t.readSVarint():7===i?t.readBoolean():null}return n}(e))}Ur.prototype.feature=function(t){if(t<0||t>=this.Mt.length)throw new Error("feature index out of bounds");this.ht.pos=this.Mt[t];var n=this.ht.readVarint()+this.ht.pos;return new Lr(this.ht,n,this.extent,this.vt,this.yt)};var jr=Er,Br=function(t,n){this.layers=t.readFields(Vr,{},n)};function Vr(t,n,e){if(3===t){var i=new jr(e,e.readVarint()+e.pos);i.length&&(n[i.name]=i)}}var Gr=Br;const Dr=2;class Xr extends Ie{constructor(t,n,e,i,r,o){super(t,n,e,i,r),n=n||{},o()}getTileFeatures(t,n){const e=t.tileInfo.url,i=t.fetchOptions||{},{altitudePropertyName:r,disableAltitudeWarning:o}=t,s=this.M.get(e);if(s&&s.cacheIndex===t.workerCacheIndex){const{err:t,data:i}=s;return setTimeout((()=>{this.wt(e,t,i,n)}),1)}const{tileArrayBuffer:u}=t;return u?setTimeout((()=>{this.wt(e,r,o,null,u,n)}),1):(i.referrer=t.referrer,I.getArrayBuffer(e,i,((i,s)=>{this.M&&(i?i.loading||this.M.add(e,{err:i,data:s&&s.data,cacheIndex:t.workerCacheIndex}):s&&s.data&&this.M.add(e,{err:null,data:s.data,cacheIndex:t.workerCacheIndex}),this.wt(e,r,o,i,s&&s.data,n))})))}wt(t,n,e,i,r,o){if(i)return void o(i);let s;try{s=new Gr(new Ar(r))}catch(i){return void o(i.message,[],[])}const u=[];if(!s.layers)return void o(null,u,[]);const c={};let f;for(const t in s.layers)if(a=s.layers,l=t,Object.prototype.hasOwnProperty.call(a,l)){c[t]={types:{}};const r=c[t].types;for(let o=0,c=s.layers[t].length;o<c;o++)try{f=s.layers[t].feature(o),r[f.type]=1;const i={type:f.type,layer:t,geometry:f.loadGeometry(),properties:f.properties,extent:f.extent};void 0!==f.id&&(i.id=f.id);let c=i.properties[nn];c&&(b(c)&&(c=JSON.parse(c)),i.properties[nn]=tr(c,"EPSG:3857"));const a=n&&i.properties[n];if(a){const t=zr(a),n=[];Jr(i.geometry,t,n),n.length&&!e&&(console.warn("feature.geometry is not consistent with altitude values:"),console.warn(JSON.stringify(i,null,2)))}u.push(i)}catch(i){console.warn("error when load vt geometry:",i)}}var a,l;for(const t in c)c[t].types=Object.keys(c[t].types).map((t=>+t));o(null,u,c,{byteLength:r.byteLength})}abortTile(t,n){const e=this.requests[t];delete this.requests[t],e&&e.abort&&e.abort(),this.A(t),n()}onRemove(){super.onRemove();for(const t in this.requests){const n=this.requests[t];n&&n.abort&&n.abort()}this.requests={}}}function zr(t){const n=atob(t),e=new Uint8Array(n.length);for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return new Float32Array(e.buffer)}function Jr(t,n,e,i){i||(i={index:0});for(let r=0;r<t.length;r++)if(Array.isArray(t[r]))Jr(t[r],n,e,i);else{const o=i.index;k(n[o])?e.push(Dr):t[r].z=100*n[o],i.index++}}const{LRUCache:Yr}=en();let qr=0;const Rr=new Yr(128);class Hr{constructor(t){this.gt={},this.Pt={},this.workerId=t}addLayer({actorId:t,mapId:n,layerId:e,params:i},r){if(this.xt(n,e))return;const o=this.bt(n,e),s=i.type,u=i.options,c=this.send.bind(this,t);this.gt[o]="GeoJSONVectorTileLayer"===s?new er(e,u,c,Rr,{},r):new Xr(e,u,c,Rr,{},r)}removeLayer({mapId:t,layerId:n},e){const i=this.xt(t,n),r=this.bt(t,n);delete this.gt[r],i&&i.onRemove(e)}loadTile({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.loadTile(e,i)}abortTile({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.abortTile&&r.abortTile(e.url,i)}removeTile({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.removeTile(e,i)}updateStyle({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.updateStyle(e,i)}updateOptions({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.updateOptions(e,i)}setData({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.setData(e.data,i)}receive(t){const n=t.callback,e=this.Pt[n];delete this.Pt[n],e&&t.error?e(new Error(t.error)):e&&e(null,t.data)}send(t,n,e,i,r){const o=r?\`${E}t}-${E}qr++}\`:null;r&&(this.Pt[o]=r),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:n,params:e,callback:String(o)},i||[])}bt(t,n){return\`${E}t}-${E}n}\`}xt(t,n){const e=this.bt(t,n);return this.gt[e]}St(){Rr.reset()}}t.initialize=function(){},t.onmessage=function(t,n){const e=t.data;if(this.dispatcher||(this.dispatcher=new Hr(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const i=e.command;this.dispatcher[i]({actorId:t.actorId,mapId:e.mapId,layerId:e.layerId,params:e.params},((t,e,r)=>{t&&404!==t.status&&204!==t.status&&!t.loading&&console.error(i,t),n(t,e,r)}))}}}`;
|
|
35
35
|
|
|
36
36
|
function N(t) {
|
|
37
37
|
const e = function() {
|
|
@@ -19686,5 +19686,5 @@ if (i.transcoders) {
|
|
|
19686
19686
|
|
|
19687
19687
|
export { pl as ExtrudePolygonLayer, Tn as FillPainter, ho as FillPlugin, xl as FilterUtil, bo as GLTFPhongPlugin, wo as GLTFStandardPlugin, To as GeoJSONVectorTileLayer, Ao as HeatmapPlugin, br as IconPainter, fo as IconPlugin, co as LineGradientPlugin, kn as LinePainter, uo as LinePlugin, ea as LineStringLayer, vo as LitPlugin, Mo as MapboxVectorTileLayer, ms as NativeLinePainter, yo as NativeLinePlugin, ds as NativePointPainter, vl as PackUtil, ks as PhongPainter, mo as PhongPlugin, Qo as PointLayer, ra as PolygonLayer, wl as SYMBOLS_NEED_REBUILD_IN_VECTOR, bl as SYMBOLS_NEED_REBUILD_IN_VT, ls as TextPainter, po as TextPlugin, xo as TubePlugin, de as Vector3DLayer, oe as VectorTileLayer, Yt as VectorTileLayerRenderer, _o as WaterPlugin, Cs as WireframePainter, go as WireframePlugin };
|
|
19688
19688
|
|
|
19689
|
-
"undefined" != typeof console && console.log("@maptalks/vt v0.103.
|
|
19689
|
+
"undefined" != typeof console && console.log("@maptalks/vt v0.103.1");
|
|
19690
19690
|
//# sourceMappingURL=maptalks.vt.es.js.map
|
package/dist/maptalks.vt.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @maptalks/vt v0.103.
|
|
2
|
+
* @maptalks/vt v0.103.1
|
|
3
3
|
* LICENSE : undefined
|
|
4
4
|
* (c) 2016-2024 maptalks.org
|
|
5
5
|
*/
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
})), e.default = t, Object.freeze(e);
|
|
22
22
|
}
|
|
23
23
|
var r = i(e), s = i(n);
|
|
24
|
-
const o = "${", a = `function(t){let n;const e={width:100,height:10};let i=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),i=!0}catch(t){i=!1}function r(){if(!n){const{width:t,height:r}=e;i?n=new OffscreenCanvas(t,r):(n=document.createElement("canvas"),n.width=t,n.height=r)}return n}class o{constructor(t,n={}){if(!Array.isArray(t))return void console.error("colors is not array");if(t.length<2)return void console.error("colors.length should >1");this.colors=t;let i=1/0,r=-1/0;for(let n=0,e=t.length;n<e;n++){const e=t[n][0];i=Math.min(e,i),r=Math.max(e,r)}this.min=i,this.max=r,this.valueOffset=this.max-this.min,this.options=Object.assign({},e,n),this.t()}getImageData(){return this.imgData}t(){const t=r(),{width:n,height:e}=this.options;t.width=n,t.height=e;const i=t.getContext("2d");i.clearRect(0,0,t.width,t.height);const o=i.createLinearGradient(0,0,t.width,0),{colors:s,valueOffset:u}=this;for(let t=0,n=s.length;t<n;t++){const[n,e]=s[t],i=(n-this.min)/u;o.addColorStop(i,e)}i.fillStyle=o,i.fillRect(0,0,t.width,t.height),this.imgData=i.getImageData(0,0,t.width,t.height)}getColor(t){t=Math.max(this.min,t);const n=((t=Math.min(t,this.max))-this.min)/this.valueOffset;let e=Math.round(n*this.imgData.width);e=Math.min(e,this.imgData.width-1);const i=4*e;return[this.imgData.data[i],this.imgData.data[i+1],this.imgData.data[i+2],this.imgData.data[i+3]]}}var s;function u(t,n){var e,i,r;if(M(t)){var o,s=t.stops&&"object"==typeof t.stops[0][0],l=s||void 0!==t.property,y=s||!l,p=t.type||n||"exponential";if("exponential"===p)o=a;else if("interval"===p)o=f;else if("categorical"===p)o=c;else if("identity"===p)o=d;else if("color-interpolate"===p)o=h;else{if("calculate-expression"!==p)throw new Error('Unknown function type "'+p+'"');o=v}if(s){var w={},m=[];for(let n=0;n<t.stops.length;n++){var g=t.stops[n];void 0===w[g[0].zoom]&&(w[g[0].zoom]={zoom:g[0].zoom,type:t.type,property:t.property,default:t.default,stops:[]}),w[g[0].zoom].stops.push([g[0].value,g[1]])}for(let t in w)m.push([w[t].zoom,u(w[t])]);e=function(n,e){const i=a({stops:m,base:t.base},n)(n,e);return"function"==typeof i?i(n,e):i},i=!1,r=!1}else y?(e=function(n){const e=o(t,n);return"function"==typeof e?e(n):e},i=!0,r=!1):(e=function(n,e){const i=o(t,e?e[t.property]:null);return"function"==typeof i?i(n,e):i},i=!1,r=!0)}else e=function(){return t},i=!0,r=!0;return e.isZoomConstant=r,e.isFeatureConstant=i,e}function c(t,n){for(let e=0;e<t.stops.length;e++)if(n===t.stops[e][0])return t.stops[e][1];return t.default}function f(t,n){for(var e=0;e<t.stops.length&&!(n<t.stops[e][0]);e++);return t.stops[Math.max(e-1,0)][1]}function a(t,n){for(var e=void 0!==t.base?t.base:1,i=0;!(i>=t.stops.length||n<=t.stops[i][0]);)i++;return 0===i?t.stops[i][1]:i===t.stops.length?t.stops[i-1][1]:y(n,e,t.stops[i-1][0],t.stops[i][0],t.stops[i-1][1],t.stops[i][1])}"function"==typeof Map&&(s=new Map);const l={width:100,height:1};function h(t,n){const e=t.stops;if(e&&e.length>1){let t;if(s){const n=JSON.stringify(e);if(!s.has(n)){const t=new o(e,l);s.set(n,t)}t=s.get(n)}else t=new o(e,l);const[i,r,u,c]=t.getColor(n);return[i/255,r/255,u/255,c/255]}return e&&1===e.length?e[0][1]:null}function d(t,n){return e=n,i=t.default,void 0!==e?e:void 0!==i?i:null;var e,i}function v(t,n){const e=String(t.property),i=t.expression,r=n;function o(n){return null==n||""===n||isNaN(n)?t.default:n}if(null==n||""===n||isNaN(n)||n<0)return o(t.default);{const n=function t(n,e,i){const r=Number(i),o=String(e);return Array.isArray(n)?n.map((n=>t(n,o,r))):n===o?r:n}(i,e,r);return o(function n(e){if(!Array.isArray(e)){if("number"==typeof e)return e;throw new Error("Invalid expression format")}{const i=e[0];if(!["+","-","*","/"].includes(i))throw new Error(\`Unknown operator: ${o}i}\`);const r=e.slice(1).map((t=>n(t)));switch(i){case"+":return r.reduce(((t,n)=>t+n),0);case"-":return r.reduce(((t,n)=>t-n));case"*":return r.reduce(((t,n)=>t*n),1);case"/":return r.some((t=>0===t))?t.default:r.reduce(((t,n)=>t/n));default:throw new Error(\`Unsupported operator: ${o}i}\`)}}}(n))}}function y(t,n,e,i,r,o){return"function"==typeof r?function(){var s=r.apply(void 0,arguments),u=o.apply(void 0,arguments);return y(t,n,e,i,s,u)}:r.length?function(t,n,e,i,r,o){var s=[];for(let u=0;u<r.length;u++)s[u]=p(t,n,e,i,r[u],o[u]);return s}(t,n,e,i,r,o):p(t,n,e,i,r,o)}function p(t,n,e,i,r,o){var s,u=i-e,c=t-e;return r*(1-(s=1===n?c/u:(Math.pow(n,c)-1)/(Math.pow(n,u)-1)))+o*s}function M(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type||t.expression&&"calculate-expression"===t.type)}function w(t){return m(t,"interval")}function m(t,n){if(!M(t))return function(){return t};let e=!0,i=!0;const r=(t=JSON.parse(JSON.stringify(t))).stops;if(r)for(let t=0;t<r.length;t++)if(M(r[t][1])){const o=m(r[t][1],n);e=e&&o.isZoomConstant,i=i&&o.isFeatureConstant,r[t]=[r[t][0],o]}const o=u(t,n);return o.isZoomConstant=e&&o.isZoomConstant,o.isFeatureConstant=i&&o.isFeatureConstant,o}let g=0;const P="function"==typeof Object.assign;function x(t,...n){if(P)return Object.assign(t,...n),t;for(let e=0;e<n.length;e++){const i=n[e];for(const n in i)t[n]=i[n]}return t}function b(t){return!k(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function S(t){return"number"==typeof t&&!isNaN(t)}function F(t){return!k(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function A(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function k(t){return null==t}function T(t){return M(t)&&t.property}const _="function"==typeof fetch&&"function"==typeof AbortController,I={jsonp:function(t,n){const e="_maptalks_jsonp_"+g++;t.match(/\\?/)?t+="&callback="+e:t+="?callback="+e;let i=document.createElement("script");return i.type="text/javascript",i.src=t,window[e]=function(t){n(null,t),document.getElementsByTagName("head")[0].removeChild(i),i=null,delete window[e]},document.getElementsByTagName("head")[0].appendChild(i),this},get:function(t,n,e){if(F(n)){const t=e;e=n,n=t}(n=n||{}).method&&(n.method=n.method.toUpperCase());const i="POST"===n.method;if(_){const i=new AbortController,r=n;r.signal=i.signal,r.referrerPolicy=r.referrerPolicy||"origin",r.method=r.method||"GET";const o=new Request(t,r);return n.returnJSON&&o.headers.set("Accept","application/json"),fetch(o).then((i=>{const r=this.o(i,n.returnJSON,n.responseType);r.message?(r.url=t,e(r)):r.then((t=>{"arraybuffer"===n.responseType?e(null,{data:t,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),contentType:i.headers.get("Content-Type")}):e(null,t)})).catch((n=>{n.code&&n.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,n),e(n))}))})).catch((n=>{n.code&&n.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,n),e(n))})),i}{const r=I.u(e);if(r.open(n.method||"GET",t,!0),n){for(const t in n.headers)r.setRequestHeader(t,n.headers[t]);r.withCredentials="include"===n.credentials,n.responseType&&(r.responseType=n.responseType)}return r.send(i?n.body:null),r}},o:(t,n,e)=>200!==t.status?{status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${o}t.status}): ${o}t.statusText}\`}:"arraybuffer"===e?t.arrayBuffer():n?t.json():t.text(),l:function(t,n){return function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?n({status:200,statusText:t.statusText,message:"http status 200 returned without content."}):n(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else n(null,t.responseText);else n({status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${o}t.status}): ${o}t.statusText}\`})}},u:function(t){let n;try{n=new XMLHttpRequest}catch(t){try{n=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{n=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}return n.onreadystatechange=I.l(n,t),n},getArrayBuffer(t,n,e){if(F(n)){const t=e;e=n,n=t}return n||(n={}),n.responseType="arraybuffer",I.get(t,n,e)}};function O(t,n,e,i,r=3){let o=i;const s=e-n>>1;let u,c=e-n;const f=t[n],a=t[n+1],l=t[e],h=t[e+1];for(let i=n+r;i<e;i+=r){const n=N(t[i],t[i+1],f,a,l,h);if(n>o)u=i,o=n;else if(n===o){const t=Math.abs(i-s);t<c&&(u=i,c=t)}}o>i&&(u-n>r&&O(t,n,u,i,r),t[u+2]=o,e-u>r&&O(t,u,e,i,r))}function N(t,n,e,i,r,o){let s=r-e,u=o-i;if(0!==s||0!==u){const c=((t-e)*s+(n-i)*u)/(s*s+u*u);c>1?(e=r,i=o):c>0&&(e+=s*c,i+=u*c)}return s=t-e,u=n-i,s*s+u*u}function C(t,n,e,i,r,o){const s={id:null==t?null:t,type:n,geometry:e,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};r&&(s.layer=r);return function(t,n){const e=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)L(t,e,n);else if("Polygon"===i)L(t,e[0],n);else if("MultiLineString"===i)for(const i of e)L(t,i,n);else if("MultiPolygon"===i)for(const i of e)L(t,i[0],n)}(s,o?4:3),s}function L(t,n,e){for(let i=0;i<n.length;i+=e)t.minX=Math.min(t.minX,n[i]),t.minY=Math.min(t.minY,n[i+1]),t.maxX=Math.max(t.maxX,n[i]),t.maxY=Math.max(t.maxY,n[i+1])}function E(t,n,e,i){if(i.layer=n,"FeatureCollection"===e.type)for(let n=0;n<e.features.length;n++)U(t,e.features[n],i,n);else"Feature"===e.type?U(t,e,i):U(t,{geometry:e},i)}function U(t,n,e,i){if(!n.geometry)return;const r=n.geometry.coordinates,o=n.geometry.type,s=Math.pow(e.tolerance/((1<<e.maxZoom)*e.extent),2);let u=[],c=n.id;if(e.promoteId?c=n.properties[e.promoteId]:e.generateId&&(c=i||0),"Point"===o)$(r,u,e);else if("MultiPoint"===o)for(const t of r)$(t,u,e);else if("LineString"===o)j(r,u,s,!1,e);else if("MultiLineString"===o){if(e.lineMetrics){for(const i of r)u=[],j(i,u,s,!1,e),t.push(C(c,"LineString",u,n.properties,e.layer,e.hasAltitude));return}B(r,u,s,!1,e)}else if("Polygon"===o)B(r,u,s,!0,e);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const r of n.geometry.geometries)U(t,{id:c,geometry:r,properties:n.properties},e,i);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const t of r){const n=[];B(t,n,s,!0,e),u.push(n)}}t.push(C(c,o,u,n.properties,e.layer,e.hasAltitude))}function $(t,n,e){n.push(V(t[0]),G(t[1],e.projection),0),e.hasAltitude&&(t.length>2?n.push(t[2]):n.push(0))}function j(t,n,e,i,r){let o,s,u=0;for(let e=0;e<t.length;e++){const c=V(t[e][0]),f=G(t[e][1],r.projection);n.push(c,f,0),r.hasAltitude&&(t[e].length>2?n.push(t[e][2]):n.push(0)),e>0&&(u+=i?(o*f-c*s)/2:Math.sqrt(Math.pow(c-o,2)+Math.pow(f-s,2))),o=c,s=f}const c=r.hasAltitude?4:3,f=n.length-c;n[2]=1,O(n,0,f,e,c),n[f+2]=1,n.size=Math.abs(u),n.start=0,n.end=n.size}function B(t,n,e,i,r){for(let o=0;o<t.length;o++){const s=[];j(t[o],s,e,i,r),n.push(s)}}function V(t){return t/360+.5}function G(t,n){if("EPSG:4326"===n)return(90-t)/360;const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function D(t,n,e,i,r,o,s,u){if(i/=n,o>=(e/=n)&&s<i)return t;if(s<e||o>=i)return null;const c=[];for(const n of t){const t=n.geometry;let o=n.type;const s=0===r?n.minX:n.minY,f=0===r?n.maxX:n.maxY;if(s>=e&&f<i){c.push(n);continue}if(f<e||s>=i)continue;let a=[];if("Point"===o||"MultiPoint"===o)X(t,a,e,i,r,u.hasAltitude);else if("LineString"===o)z(t,a,e,i,r,!1,u.lineMetrics,u.hasAltitude);else if("MultiLineString"===o)Y(t,a,e,i,r,!1,u.hasAltitude);else if("Polygon"===o)Y(t,a,e,i,r,!0,u.hasAltitude);else if("MultiPolygon"===o)for(const n of t){const t=[];Y(n,t,e,i,r,!0,u.hasAltitude),t.length&&a.push(t)}if(a.length){if(u.lineMetrics&&"LineString"===o){for(const t of a)c.push(C(n.id,o,t,n.tags,n.layer,u.hasAltitude));continue}"LineString"!==o&&"MultiLineString"!==o||(1===a.length?(o="LineString",a=a[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===a.length?"Point":"MultiPoint"),c.push(C(n.id,o,a,n.tags,n.layer,u.hasAltitude))}}return c.length?c:null}function X(t,n,e,i,r,o){const s=o?4:3;for(let u=0;u<t.length;u+=s){const s=t[u+r];s>=e&&s<=i&&(q(n,t[u],t[u+1],t[u+2]),o&&n.push(t[u+3]))}}function z(t,n,e,i,r,o,s,u){let c=J(t);const f=0===r?R:H;let a,l,h=t.start;const d=u?4:3,v=o?t.length:t.length-d;for(let y=0;y<v;y+=d){const p=t[y],M=t[y+1],w=t[y+2];let m,g,P,x;o&&y===v-d?(m=t[0],g=t[1]):(m=t[y+d],g=t[y+d+1]),u&&(P=t[y+3],x=o&&y===v-d?t[3]:t[y+d+3]);const b=0===r?p:M,S=0===r?m:g;let F=!1;s&&(a=Math.sqrt(Math.pow(p-m,2)+Math.pow(M-g,2))),b<e?S>e&&(l=f(c,p,M,m,g,e),u&&c.push(Z(P,x,l)),s&&(c.start=h+a*l)):b>i?S<i&&(l=f(c,p,M,m,g,i),u&&c.push(Z(P,x,l)),s&&(c.start=h+a*l)):(q(c,p,M,w),u&&c.push(P)),S<e&&b>=e&&(l=f(c,p,M,m,g,e),u&&c.push(Z(P,x,l)),F=!0),S>i&&b<=i&&(l=f(c,p,M,m,g,i),u&&c.push(Z(P,x,l)),F=!0),!o&&F&&(s&&(c.end=h+a*l),n.push(c),c=J(t)),s&&(h+=a)}let y=t.length-d;if(!o){const n=t[y],o=t[y+1],s=t[y+2],f=0===r?n:o;if(f>=e&&f<=i&&q(c,n,o,s),f>=e&&f<=i&&u){const n=t[y+3];c.push(n)}}y=c.length-d,o&&y>=d&&(c[y]!==c[0]||c[y+1]!==c[1])&&(q(c,c[0],c[1],c[2]),u&&c.push(c[3])),c.length&&n.push(c)}function J(t){const n=[];return n.size=t.size,n.start=t.start,n.end=t.end,n}function Y(t,n,e,i,r,o,s){for(const u of t)z(u,n,e,i,r,o,!1,s)}function q(t,n,e,i){t.push(n,e,i)}function R(t,n,e,i,r,o){const s=(o-n)/(i-n);return q(t,o,e+(r-e)*s,1),s}function H(t,n,e,i,r,o){const s=(o-e)/(r-e);return q(t,n+(i-n)*s,o,1),s}function Z(t,n,e){return t+(n-t)*e}function W(t,n,e){const i=[];for(let r=0;r<t.length;r++){const o=t[r],s=o.type;let u;if("Point"===s||"MultiPoint"===s||"LineString"===s)u=K(o.geometry,n,e);else if("MultiLineString"===s||"Polygon"===s){u=[];for(const t of o.geometry)u.push(K(t,n,e))}else if("MultiPolygon"===s){u=[];for(const t of o.geometry){const i=[];for(const r of t)i.push(K(r,n,e));u.push(i)}}i.push(C(o.id,s,u,o.tags,o.layer,e))}return i}function K(t,n,e){const i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);const r=e?4:3;for(let o=0;o<t.length;o+=r)i.push(t[o]+n,t[o+1],t[o+2]),e&&i.push(t[o+3]);return i}function Q(t,n,e){if(t.transformed)return t;const i=1<<t.z,r=t.x,o=t.y,s=e?3:2;for(const u of t.features){const t=u.geometry,c=u.type;if(u.geometry=[],1===c)for(let c=0;c<t.length;c+=s)u.geometry.push(tt(t[c],t[c+1],n,i,r,o)),e&&u.geometry[u.geometry.length-1].push(t[c+2]);else for(let c=0;c<t.length;c++){const f=[];for(let u=0;u<t[c].length;u+=s)f.push(tt(t[c][u],t[c][u+1],n,i,r,o)),e&&f[f.length-1].push(t[c][u+2]);u.geometry.push(f)}}return t.transformed=!0,t}function tt(t,n,e,i,r,o){return[Math.round(e*(t*i-r)),Math.round(e*(n*i-o))]}function nt(t,n,e,i,r){const o=n===r.maxZoom?0:r.tolerance/((1<<n)*r.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:e,y:i,z:n,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const n of t)et(s,n,o,r);return s}function et(t,n,e,i){const r=n.geometry,o=n.type,s=[],u=i.hasAltitude?4:3;if(t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),"Point"===o||"MultiPoint"===o)for(let n=0;n<r.length;n+=u)s.push(r[n],r[n+1]),i.hasAltitude&&s.push(r[n+3]),t.numPoints++,t.numSimplified++;else if("LineString"===o)rt(s,r,t,e,!1,!1,i);else if("MultiLineString"===o||"Polygon"===o)for(let n=0;n<r.length;n++)rt(s,r[n],t,e,"Polygon"===o,0===n,i);else if("MultiPolygon"===o)for(let n=0;n<r.length;n++){const o=r[n];for(let n=0;n<o.length;n++)rt(s,o[n],t,e,!0,0===n,i)}if(s.length){let e=n.tags||null;if("LineString"===o&&i.lineMetrics){e={};for(const t in n.tags)e[t]=n.tags[t];e.mapbox_clip_start=r.start/r.size,e.mapbox_clip_end=r.end/r.size}const u={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:e};n.layer&&(u.layer=n.layer),null!==n.id&&(u.id=n.id),t.features.push(u)}}function it(t,n,e){return 0===t[n+2]&&t[n+3]>0&&e}function rt(t,n,e,i,r,o,s){const u=i*i,{hasAltitude:c,disableFilter:f}=s,a=c?4:3;if(!f&&i>0&&n.size<(r?u:i))return void(e.numPoints+=n.length/a);const l=[];for(let t=0;t<n.length;t+=a)(0===i||n[t+2]>u||it(n,t,c))&&(e.numSimplified++,l.push(n[t],n[t+1]),c&&l.push(n[t+3])),e.numPoints++;r&&function(t,n,e){const i=e?3:2;let r=0;for(let n=0,e=t.length,o=e-i;n<e;o=n,n+=i)r+=(t[n]-t[o])*(t[n+1]+t[o+1]);if(r>0===n){const n=i,r=i-1,o=i-2;for(let s=0,u=t.length;s<u/2;s+=i){const i=t[s],c=t[s+1];let f;e&&(f=t[s+2]),t[s]=t[u-n-s],t[s+1]=t[u-r-s],e&&(t[s+2]=t[u-o-s]),t[u-n-s]=i,t[u-r-s]=c,e&&(t[u-o-s]=f)}}}(l,o,c),t.push(l)}I.getJSON=function(t,n,e){if(F(n)){const t=e;e=n,n=t}const i=function(t,n){const i="string"==typeof n?JSON.parse(n):n||null;e(t,i)};return n&&n.jsonp?I.jsonp(t,i):((n=n||{}).returnJSON=!0,I.get(t,n,i))};const ot={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 st{constructor(t,n){const e=(n=this.options=function(t,n){for(const e in n)t[e]=n[e];return t}(Object.create(ot),n)).debug;if(e&&console.time("preprocess data"),n.maxZoom<0||n.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(n.promoteId&&n.generateId)throw new Error("promoteId and generateId cannot be used together.");let i=function(t,n){const e=[];if(Array.isArray(t)){for(let i=0;i<t.length;i++)E(e,t[i].layer,t[i].data,n);return e}if("FeatureCollection"===t.type)for(let i=0;i<t.features.length;i++)U(e,t.features[i],n,i);else"Feature"===t.type?U(e,t,n):U(e,{geometry:t},n);return e}(t,n);this.tiles={},this.tileCoords=[],e&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",n.indexMaxZoom,n.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=function(t,n){const e=n.buffer/n.extent;let i=t;const r=D(t,1,-1-e,e,0,-1,2,n),o=D(t,1,1-e,2+e,0,-1,2,n);return(r||o)&&(i=D(t,1,-e,1+e,0,-1,2,n)||[],r&&(i=W(r,1,n.hasAltitude).concat(i)),o&&(i=i.concat(W(o,-1,n.hasAltitude)))),i}(i,n),i.length&&this.splitTile(i,0,0,0),e&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(t,n,e,i,r,o,s){const u=[t,n,e,i],c=this.options,f=c.debug;for(;u.length;){i=u.pop(),e=u.pop(),n=u.pop(),t=u.pop();const a=1<<n,l=ut(n,e,i);let h=this.tiles[l];if(!h&&(f>1&&console.time("creation"),h=this.tiles[l]=nt(t,n,e,i,c),this.tileCoords.push({z:n,x:e,y:i}),f)){f>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,e,i,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));const t=\`z${o}n}\`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(h.source=t,null==r){if(n===c.indexMaxZoom||h.numPoints<=c.indexMaxPoints)continue}else{if(n===c.maxZoom||n===r)continue;if(null!=r){const t=r-n;if(e!==o>>t||i!==s>>t)continue}}if(h.source=null,0===t.length)continue;f>1&&console.time("clipping");const d=.5*c.buffer/c.extent,v=.5-d,y=.5+d,p=1+d;let M=null,w=null,m=null,g=null,P=D(t,a,e-d,e+y,0,h.minX,h.maxX,c),x=D(t,a,e+v,e+p,0,h.minX,h.maxX,c);t=null,P&&(M=D(P,a,i-d,i+y,1,h.minY,h.maxY,c),w=D(P,a,i+v,i+p,1,h.minY,h.maxY,c),P=null),x&&(m=D(x,a,i-d,i+y,1,h.minY,h.maxY,c),g=D(x,a,i+v,i+p,1,h.minY,h.maxY,c),x=null),f>1&&console.timeEnd("clipping"),u.push(M||[],n+1,2*e,2*i),u.push(w||[],n+1,2*e,2*i+1),u.push(m||[],n+1,2*e+1,2*i),u.push(g||[],n+1,2*e+1,2*i+1)}}getTile(t,n,e){t=+t,n=+n,e=+e;const i=this.options,{extent:r,debug:o}=i,{hasAltitude:s,wrapX:u}=i;if(t<0||t>24)return null;if(u){const e=1<<t;n=n+e&e-1}const c=ut(t,n,e);if(this.tiles[c])return Q(this.tiles[c],r,s);o>1&&console.log("drilling down to z%d-%d-%d",t,n,e);let f,a=t,l=n,h=e;for(;!f&&a>0;)a--,l>>=1,h>>=1,f=this.tiles[ut(a,l,h)];return f&&f.source?(o>1&&(console.log("found parent tile z%d-%d-%d",a,l,h),console.time("drilling down")),this.splitTile(f.source,a,l,h,t,n,e),o>1&&console.timeEnd("drilling down"),this.tiles[c]?Q(this.tiles[c],r,s):null):null}}function ut(t,n,e){return 32*((1<<t)*e+n)+t}function ct(t,n,e,i,r,o,s){const u=e&&Array.isArray(e[0]);for(let c=0,f=e.length;c<f;c++){t[n]=(u?e[c][0]:e[c].x)*i,t[n+1]=(u?e[c][1]:e[c].y)*i,s!==Float32Array&&(t[n]=Math.round(t[n]),t[n+1]=Math.round(t[n+1]));let a=r||0;Array.isArray(r)&&(a=r[c]),a=a?Math.round(i*a):0,t[n+2]=a,n+=3,o&&0!==c&&c!==f-1&&(t[n]=t[n-3],t[n+1]=t[n-2],t[n+2]=t[n-1],n+=3)}return t.trySetLength&&t.trySetLength(n),n}function ft(t,n,e,i){const r=t[3*n],o=t[3*n+1],s=t[3*e],u=t[3*e+1];return r===s&&(r<0||r>i)||o===u&&(o<0||o>i)}var at="undefined"!=typeof Float32Array?Float32Array:Array;function lt(t,n,e,i){return t[0]=n,t[1]=e,t[2]=i,t}function ht(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function dt(t,n,e,i,r){return t[0]=n,t[1]=e,t[2]=i,t[3]=r,t}function vt(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t[3]=n[3]/e[3],t}function yt(t,n,e){return t[0]=n,t[1]=e,t}function pt(t,n){var e=n[0]-t[0],i=n[1]-t[1];return Math.hypot(e,i)}Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)}),function(){var t,n=(t=new at(3),at!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t)}(),function(){var t,n=(t=new at(4),at!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}(),function(){var t,n=(t=new at(2),at!=Float32Array&&(t[0]=0,t[1]=0),t)}();const Mt=Math.PI/180,wt=6378137*Math.PI/180,mt=85.0511287798;function gt(t,n,e){if("EPSG:3857"===e)return function(t,n){const e=mt,i=n[0],r=Math.max(Math.min(e,n[1]),-e);let o;o=0===r?0:Math.log(Math.tan((90+r)*Mt/2))/Mt;return t[0]=i*wt,t[1]=o*wt,t}(t,n);if("EPSG:4326"===e||"EPSG:4490"===e||"identity"===e)return Pt(t,n);if("baidu"===e)return Pt(t,n);throw new Error("unsupported projection:"+e)}function Pt(t,n){return t[0]=n[0],t[1]=n[1],t}function xt(t,n,e,i,r,o,s,u,c,f,a,l,h,d,v){0===t?function(t,n,e,i,r,o,s,u,c,f){const a=1/(100*o[0]),l=1/(100*o[1]),h=f&&f[0]||0,d=f&&f[1]||0,v=[0,0];for(let r=t;r<n;r+=3){const t=r/3*2,n=i[r]-h,o=i[r+1]-d;e[t]=v[0]+n/s*a/u,e[t+1]=v[1]-o/s*l/c}}(n,e,i,r,0,s,u,c,f,v):1===t&&function(t,n,e,i,r,o,s,u,c,f,a){if(!t)return;let l,h,d,v;0===t[4]?(l=t[0],h=t[1],d=t[2],v=t[3]):(l=t[1],h=t[2],d=t[3],v=t[0]);const y=pt(l,h),p=pt(h,d),M=[],w=[],m=[];for(let t=n;t<e;t+=3){const n=t/3*2;yt(M,(o.x/c+r[t]/s)*u,o.y/c*u+(a?r[t+1]:-r[t+1])/s*u),"EPSG:4326"!==f&&"EPSG:4490"!==f||gt(M,M,"EPSG:3857"),bt(w,M,l,h),bt(m,M,v,l),i[n]=pt(l,w)/y,i[n+1]=pt(l,m)/p}}(a,n,e,i,r,o,u,l,h,d,!!v)}function bt(t,n,e,i){const r=e[0]-i[0],o=e[1]-i[1];let s=(n[0]-e[0])*(e[0]-i[0])+(n[1]-e[1])*(e[1]-i[1]);return s/=r*r+o*o,t[0]=e[0]+s*r,t[1]=e[1]+s*o,t}function St(t,n,e,i,r){const o=3*n[e-1],s=3*n[e-1]+1,u=t[o],c=t[s];return f=i,a=r,l=u,h=c,Math.sqrt((l-f)*(l-f)+(h-a)*(h-a));var f,a,l,h}function Ft(t){return t&&t.h&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var At={exports:{}};function kt(t,n,e){e=e||2;var i,r,o,s,u,c,f,a=n&&n.length,l=a?n[0]*e:t.length,h=Tt(t,0,l,e,!0),d=[];if(!h||h.next===h.prev)return d;if(a&&(h=function(t,n,e,i){var r,o,s,u=[];for(r=0,o=n.length;r<o;r++)(s=Tt(t,n[r]*i,r<o-1?n[r+1]*i:t.length,i,!1))===s.next&&(s.steiner=!0),u.push(Bt(s));for(u.sort(Et),r=0;r<u.length;r++)e=Ut(u[r],e);return e}(t,n,h,e)),t.length>80*e){i=o=t[0],r=s=t[1];for(var v=e;v<l;v+=e)(u=t[v])<i&&(i=u),(c=t[v+1])<r&&(r=c),u>o&&(o=u),c>s&&(s=c);f=0!==(f=Math.max(o-i,s-r))?32767/f:0}return It(h,d,e,i,r,f,0),d}function Tt(t,n,e,i,r){var o,s;if(r===Kt(t,n,e,i)>0)for(o=n;o<e;o+=i)s=Ht(o,t[o],t[o+1],s);else for(o=e-i;o>=n;o-=i)s=Ht(o,t[o],t[o+1],s);return s&&Xt(s,s.next)&&(Zt(s),s=s.next),s}function _t(t,n){if(!t)return t;n||(n=t);var e,i=t;do{if(e=!1,i.steiner||!Xt(i,i.next)&&0!==Dt(i.prev,i,i.next))i=i.next;else{if(Zt(i),(i=n=i.prev)===i.next)break;e=!0}}while(e||i!==n);return n}function It(t,n,e,i,r,o,s){if(t){!s&&o&&function(t,n,e,i){var r=t;do{0===r.z&&(r.z=jt(r.x,r.y,n,e,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var n,e,i,r,o,s,u,c,f=1;do{for(e=t,t=null,o=null,s=0;e;){for(s++,i=e,u=0,n=0;n<f&&(u++,i=i.nextZ);n++);for(c=f;u>0||c>0&&i;)0!==u&&(0===c||!i||e.z<=i.z)?(r=e,e=e.nextZ,u--):(r=i,i=i.nextZ,c--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;e=i}o.nextZ=null,f*=2}while(s>1)}(r)}(t,i,r,o);for(var u,c,f=t;t.prev!==t.next;)if(u=t.prev,c=t.next,o?Nt(t,i,r,o):Ot(t))n.push(u.i/e|0),n.push(t.i/e|0),n.push(c.i/e|0),Zt(t),t=c.next,f=c.next;else if((t=c)===f){s?1===s?It(t=Ct(_t(t),n,e),n,e,i,r,o,2):2===s&&Lt(t,n,e,i,r,o):It(_t(t),n,e,i,r,o,1);break}}}function Ot(t){var n=t.prev,e=t,i=t.next;if(Dt(n,e,i)>=0)return!1;for(var r=n.x,o=e.x,s=i.x,u=n.y,c=e.y,f=i.y,a=r<o?r<s?r:s:o<s?o:s,l=u<c?u<f?u:f:c<f?c:f,h=r>o?r>s?r:s:o>s?o:s,d=u>c?u>f?u:f:c>f?c:f,v=i.next;v!==n;){if(v.x>=a&&v.x<=h&&v.y>=l&&v.y<=d&&Vt(r,u,o,c,s,f,v.x,v.y)&&Dt(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function Nt(t,n,e,i){var r=t.prev,o=t,s=t.next;if(Dt(r,o,s)>=0)return!1;for(var u=r.x,c=o.x,f=s.x,a=r.y,l=o.y,h=s.y,d=u<c?u<f?u:f:c<f?c:f,v=a<l?a<h?a:h:l<h?l:h,y=u>c?u>f?u:f:c>f?c:f,p=a>l?a>h?a:h:l>h?l:h,M=jt(d,v,n,e,i),w=jt(y,p,n,e,i),m=t.prevZ,g=t.nextZ;m&&m.z>=M&&g&&g.z<=w;){if(m.x>=d&&m.x<=y&&m.y>=v&&m.y<=p&&m!==r&&m!==s&&Vt(u,a,c,l,f,h,m.x,m.y)&&Dt(m.prev,m,m.next)>=0)return!1;if(m=m.prevZ,g.x>=d&&g.x<=y&&g.y>=v&&g.y<=p&&g!==r&&g!==s&&Vt(u,a,c,l,f,h,g.x,g.y)&&Dt(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;m&&m.z>=M;){if(m.x>=d&&m.x<=y&&m.y>=v&&m.y<=p&&m!==r&&m!==s&&Vt(u,a,c,l,f,h,m.x,m.y)&&Dt(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;g&&g.z<=w;){if(g.x>=d&&g.x<=y&&g.y>=v&&g.y<=p&&g!==r&&g!==s&&Vt(u,a,c,l,f,h,g.x,g.y)&&Dt(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function Ct(t,n,e){var i=t;do{var r=i.prev,o=i.next.next;!Xt(r,o)&&zt(r,i,i.next,o)&&qt(r,o)&&qt(o,r)&&(n.push(r.i/e|0),n.push(i.i/e|0),n.push(o.i/e|0),Zt(i),Zt(i.next),i=t=o),i=i.next}while(i!==t);return _t(i)}function Lt(t,n,e,i,r,o){var s=t;do{for(var u=s.next.next;u!==s.prev;){if(s.i!==u.i&&Gt(s,u)){var c=Rt(s,u);return s=_t(s,s.next),c=_t(c,c.next),It(s,n,e,i,r,o,0),void It(c,n,e,i,r,o,0)}u=u.next}s=s.next}while(s!==t)}function Et(t,n){return t.x-n.x}function Ut(t,n){var e=function(t,n){var e,i=n,r=t.x,o=t.y,s=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var u=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(u<=r&&u>s&&(s=u,e=i.x<i.next.x?i:i.next,u===r))return e}i=i.next}while(i!==n);if(!e)return null;var c,f=e,a=e.x,l=e.y,h=1/0;i=e;do{r>=i.x&&i.x>=a&&r!==i.x&&Vt(o<l?r:s,o,a,l,o<l?s:r,o,i.x,i.y)&&(c=Math.abs(o-i.y)/(r-i.x),qt(i,t)&&(c<h||c===h&&(i.x>e.x||i.x===e.x&&$t(e,i)))&&(e=i,h=c)),i=i.next}while(i!==f);return e}(t,n);if(!e)return n;var i=Rt(e,t);return _t(i,i.next),_t(e,e.next)}function $t(t,n){return Dt(t.prev,t,n.prev)<0&&Dt(n.next,t,t.next)<0}function jt(t,n,e,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-e)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-i)*r|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function Bt(t){var n=t,e=t;do{(n.x<e.x||n.x===e.x&&n.y<e.y)&&(e=n),n=n.next}while(n!==t);return e}function Vt(t,n,e,i,r,o,s,u){return(r-s)*(n-u)>=(t-s)*(o-u)&&(t-s)*(i-u)>=(e-s)*(n-u)&&(e-s)*(o-u)>=(r-s)*(i-u)}function Gt(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==n.i&&e.next.i!==n.i&&zt(e,e.next,t,n))return!0;e=e.next}while(e!==t);return!1}(t,n)&&(qt(t,n)&&qt(n,t)&&function(t,n){var e=t,i=!1,r=(t.x+n.x)/2,o=(t.y+n.y)/2;do{e.y>o!=e.next.y>o&&e.next.y!==e.y&&r<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next}while(e!==t);return i}(t,n)&&(Dt(t.prev,t,n.prev)||Dt(t,n.prev,n))||Xt(t,n)&&Dt(t.prev,t,t.next)>0&&Dt(n.prev,n,n.next)>0)}function Dt(t,n,e){return(n.y-t.y)*(e.x-n.x)-(n.x-t.x)*(e.y-n.y)}function Xt(t,n){return t.x===n.x&&t.y===n.y}function zt(t,n,e,i){var r=Yt(Dt(t,n,e)),o=Yt(Dt(t,n,i)),s=Yt(Dt(e,i,t)),u=Yt(Dt(e,i,n));return r!==o&&s!==u||(!(0!==r||!Jt(t,e,n))||(!(0!==o||!Jt(t,i,n))||(!(0!==s||!Jt(e,t,i))||!(0!==u||!Jt(e,n,i)))))}function Jt(t,n,e){return n.x<=Math.max(t.x,e.x)&&n.x>=Math.min(t.x,e.x)&&n.y<=Math.max(t.y,e.y)&&n.y>=Math.min(t.y,e.y)}function Yt(t){return t>0?1:t<0?-1:0}function qt(t,n){return Dt(t.prev,t,t.next)<0?Dt(t,n,t.next)>=0&&Dt(t,t.prev,n)>=0:Dt(t,n,t.prev)<0||Dt(t,t.next,n)<0}function Rt(t,n){var e=new Wt(t.i,t.x,t.y),i=new Wt(n.i,n.x,n.y),r=t.next,o=n.prev;return t.next=n,n.prev=t,e.next=r,r.prev=e,i.next=e,e.prev=i,o.next=i,i.prev=o,i}function Ht(t,n,e,i){var r=new Wt(t,n,e);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Zt(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 Wt(t,n,e){this.i=t,this.x=n,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Kt(t,n,e,i){for(var r=0,o=n,s=e-i;o<e;o+=i)r+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return r}At.exports=kt,At.exports.default=kt,kt.deviation=function(t,n,e,i){var r=n&&n.length,o=r?n[0]*e:t.length,s=Math.abs(Kt(t,0,o,e));if(r)for(var u=0,c=n.length;u<c;u++){var f=n[u]*e,a=u<c-1?n[u+1]*e:t.length;s-=Math.abs(Kt(t,f,a,e))}var l=0;for(u=0;u<i.length;u+=3){var h=i[u]*e,d=i[u+1]*e,v=i[u+2]*e;l+=Math.abs((t[h]-t[v])*(t[d+1]-t[h+1])-(t[h]-t[d])*(t[v+1]-t[h+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},kt.flatten=function(t){for(var n=t[0][0].length,e={vertices:[],holes:[],dimensions:n},i=0,r=0;r<t.length;r++){for(var o=0;o<t[r].length;o++)for(var s=0;s<n;s++)e.vertices.push(t[r][o][s]);r>0&&(i+=t[r-1].length,e.holes.push(i))}return e};var Qt=Ft(At.exports);const tn="__fea_idx";new Float32Array([-1e12])[0];const nn="maptalks_ombb";function en(){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:rn,ArrayPool:on}=en();function sn(t,n,e,i,r,o,s,u,c,f,a,l,h,d,v,y,p){const M=n.getLength(),w=r/3;for(let e=2,i=M;e<i;e+=3)t[r+e-2]=n[e-2],t[r+e-1]=n[e-1],t[r+e-0]=n[e]-s;r+=M;for(let e=2,i=M;e<i;e+=3)t[r+e-2]=n[e-2],t[r+e-1]=n[e-1],t[r+e-0]=n[e]-u;r+=M,t.trySetLength(r+M),t.copyWithin(r,r-2*M,r-M),r+=M,t.trySetLength(r+M),t.copyWithin(r,r-2*M,r-M),r+=M,(e=e||[]).push(M/3);const m=e.getLength();for(let n=0;n<m;n++){un(w+(e[n-1]||0),w+e[n],t,M/3,c,i,f,a,l,h,o,d,v,y,p)}return r}function un(t,n,e,i,r,o,s,u,c,f,a,l,h,d,v){const y=o.getLength();let p,M;for(let s=t,u=n;s<u-1;s++)if(p=s,M=s+1,r===1/0||!ft(e,p,M,r))if((s-t)%2==1&&(p+=2*i,M+=2*i),v){let t=o.currentIndex;o[t++]=p+i,o[t++]=M,o[t++]=p,o[t++]=M+i,o[t++]=M,o[t++]=p+i,o.currentIndex=t}else{let t=o.currentIndex;o[t++]=p+i,o[t++]=p,o[t++]=M,o[t++]=M,o[t++]=M+i,o[t++]=p+i,o.currentIndex=t}s&&function(t,n,e,i,r,o,s,u,c,f,a,l){let h,d=0,v=0,y=0,p=0;const M=l?[1,3,4]:[2,3,4];for(let l=o.getLength()-1;l>=s;l--){const s=o[l],w=3*s+1,m=3*s+2,g=r[3*s],P=r[w],x=r[m];d||v||(d=Math.max(r[m],r[3*o[l-3]+2]),v=Math.min(r[m],r[3*o[l-3]+2]),h=d-v);let b=y;const S=l%6;0===t?(5===S&&(p=St(r,o,l,g,P)),b=S===M[0]||S===M[1]||S===M[2]?y:y+p):1===t&&(S===M[0]||S===M[1]||S===M[2]?b=0:5===S?(p=St(r,o,l,g,P),b=p):b=p);const F=b/f*(1/(100*a))/u;let A;A=1===n?x===d?1:0:"bottom"===e?x===d?h/100/c:0:x===d?0:-h/100/c,i[2*s]=F,i[2*s+1]=A,0===S&&(y+=p)}}(u,c,f,a,e,o,y,l[0],l[1],h,d,v)}function cn(t){const n=[t[0]];let e=t[0];for(let i=1;i<t.length;i++)Array.isArray(t[i])?t[i][0]===e[0]&&t[i][1]===e[1]&&t[i][2]===e[2]||n.push(t[i]):t[i].x===e.x&&t[i].y===e.y&&t[i].z===e.z||n.push(t[i]),e=t[i];return n}var fn="undefined"!=typeof Float32Array?Float32Array:Array;function an(){var t=new fn(3);return fn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function ln(t,n,e){var i=new fn(3);return i[0]=t,i[1]=n,i[2]=e,i}function hn(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function dn(t,n,e,i){return t[0]=n,t[1]=e,t[2]=i,t}function vn(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t}function yn(t,n){var e=n[0],i=n[1],r=n[2],o=e*e+i*i+r*r;return o>0&&(o=1/Math.sqrt(o),t[0]=n[0]*o,t[1]=n[1]*o,t[2]=n[2]*o),t}function pn(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Mn(t,n,e){var i=n[0],r=n[1],o=n[2],s=e[0],u=e[1],c=e[2];return t[0]=r*c-o*u,t[1]=o*s-i*c,t[2]=i*u-r*s,t}var wn=function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t};function mn(){var t=new fn(4);return fn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function gn(t,n){var e=n[0]+n[4]+n[8],i=void 0;if(e>0)i=Math.sqrt(e+1),t[3]=.5*i,i=.5/i,t[0]=(n[5]-n[7])*i,t[1]=(n[6]-n[2])*i,t[2]=(n[1]-n[3])*i;else{var r=0;n[4]>n[0]&&(r=1),n[8]>n[3*r+r]&&(r=2);var o=(r+1)%3,s=(r+2)%3;i=Math.sqrt(n[3*r+r]-n[3*o+o]-n[3*s+s]+1),t[r]=.5*i,i=.5/i,t[3]=(n[3*o+s]-n[3*s+o])*i,t[o]=(n[3*o+r]+n[3*r+o])*i,t[s]=(n[3*s+r]+n[3*r+s])*i}return t}!function(){var t=an()}(),function(){var t,n=(t=new fn(4),fn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var Pn,xn=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},bn=function(t,n){var e=n[0],i=n[1],r=n[2],o=n[3],s=e*e+i*i+r*r+o*o;return s>0&&(s=1/Math.sqrt(s),t[0]=e*s,t[1]=i*s,t[2]=r*s,t[3]=o*s),t};an(),ln(1,0,0),ln(0,1,0),mn(),mn(),Pn=new fn(9),fn!=Float32Array&&(Pn[1]=0,Pn[2]=0,Pn[3]=0,Pn[5]=0,Pn[6]=0,Pn[7]=0),Pn[0]=1,Pn[4]=1,Pn[8]=1;\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */\nconst Sn=8,Fn=[],An=[],kn=[],Tn=[];function _n(t,n,e){const i=Mn(An,n,e),r=function(t,n,e,i,r,o,s,u,c,f){return t[0]=n,t[1]=e,t[2]=i,t[3]=r,t[4]=o,t[5]=s,t[6]=u,t[7]=c,t[8]=f,t}(Fn,e[0],e[1],e[2],...i,...n);t=gn(t,r),t=function(t){return t[3]<0?xn(t,t,-1):t}(t=bn(t,t));const o=1/((1<<2*Sn-1)-1);if(t[3]<o){t[3]=o;const n=Math.sqrt(1-o*o);t[0]*=n,t[1]*=n,t[2]*=n}const s=e[3]>0?Mn(kn,e,n):Mn(kn,n,e);return pn(Mn(Tn,e,n),s)<0&&xn(t,t,-1),t}const In=[];const On=[],Nn=[],Cn=[],Ln=[],En=[],Un=[],$n=[];function jn(t,n,e,i,r,o){dn(Ln,t[3*n],t[3*n+1],t[3*n+2]),dn(En,t[3*e],t[3*e+1],t[3*e+2]),dn(Un,t[3*i],t[3*i+1],t[3*i+2]);const s=wn(On,Un,En),u=wn(Nn,Ln,En),c=Mn(Cn,s,u);yn($n,c),r[3*n]=r[3*n]||0,r[3*e]=r[3*e]||0,r[3*i]=r[3*i]||0,r[3*n+1]=r[3*n+1]||0,r[3*e+1]=r[3*e+1]||0,r[3*i+1]=r[3*i+1]||0,r[3*n+2]=r[3*n+2]||0,r[3*e+2]=r[3*e+2]||0,r[3*i+2]=r[3*i+2]||0,r[3*n]+=$n[0],r[3*e]+=$n[0],r[3*i]+=$n[0],r[3*n+1]+=$n[1],r[3*e+1]+=$n[1],r[3*i+1]+=$n[1],r[3*n+2]+=$n[2],r[3*e+2]+=$n[2],r[3*i+2]+=$n[2],o[n]+=1,o[e]+=1,o[i]+=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 Bn(t,n,e){return t[0]=n[e],t[1]=n[e+1],t[2]=n[e+2],t}function Vn(t,n,e){return t[0]=n[e],t[1]=n[e+1],t}const{StyleUtil:Gn,PackUtil:Dn,ArrayPool:Xn}=en(),zn=Xn.getInstance();function Jn(t,n,e,i,r,o,s,u,c,f,a,l,h,d,v,y){void 0===n.top&&(n.top=!0),void 0===n.side&&(n.side=!0),zn.reset();const{altitudeScale:p,altitudeProperty:g,defaultAltitude:P,heightProperty:x,minHeightProperty:b,defaultHeight:F,tangent:A,uv:k,topUVMode:_,sideUVMode:I,sideVerticalUVMode:O,top:N,side:C,textureYOrigin:L,topThickness:E}=n,U=function(t,n,{altitudeScale:e,altitudeProperty:i,defaultAltitude:r,heightProperty:o,minHeightProperty:s,defaultHeight:u},{center:c,side:f,top:a,topThickness:l,uvOrigin:h,uv:d,uvSize:v,topUVMode:y,sideUVMode:p,sideVerticalUVMode:M,textureYOrigin:w,tileRatio:m,centimeterToPoint:g,verticalCentimeterToPoint:P,positionType:x,res:b,glScale:F,projectionCode:A},k,T){let _=n/t[0].extent;n===1/0&&(_=1);const I=n===1/0,O=T.get(),N=T.get(),C=T.get(),L=T.getProxy(),E=T.get(),U=T.get(),$=T.get(),j=!!d,B=!!a,V=!!f,G=j?T.get():null;function D(t,e,i,r,o,s){let u=e;if(B){const f=Qt(L,i,3);if(0===f.length)return e;let a=L.getLength(),d=E.currentIndex;for(let t=0;t<a;t++)E[d++]=L[t];if(E.currentIndex=d,e+=L.getLength(),s)for(let n=2,e=f.length;n<e;n+=3)f[n]+=t/3,f[n-1]+=t/3,f[n-2]+=t/3;else{let n;for(let e=2,i=f.length;e<i;e+=3)n=f[e-1],f[e-1]=f[e]+t/3,f[e]=n+t/3,f[e-2]+=t/3}a=f.length,d=U.currentIndex;for(let t=0;t<a;t++)U[d++]=f[t];U.currentIndex=d,j&&xt(y||0,t,e,G,E,h,g,m,v[0],v[1],o,b,F,A,c),l>0&&!V&&(e=sn(E,L,i,U,e,G,0,l,n,j,p||0,M||0,w,v,m,P,r<0?!s:s)),$.setLength(e/3),$.fill(1,u/3,e/3)}if(V){B&&(l=0),u=e,e=sn(E,L,i,U,e,G,l,r,n,j,p||0,M||0,w,v,m,P,r<0?!s:s),$.setLength(e/3);const t=L.getLength()/3;$.fill(1,u/3,u/3+t),$.fill(0,u/3+t,u/3+2*t),$.fill(1,u/3+2*t,u/3+3*t),$.fill(0,u/3+3*t,e/3)}return e}let X=0,z=0;const J=[-1,-1,n+1,n+1];let Y=0,q=t.length;S(k)&&(Y=k,q=k+1);let R=0,H=!1;const Z=T.getProxy();let W=!1;for(;Y<q;Y++){const c=t[Y],f=c.id;S(f)&&(Math.abs(f)>R&&(R=Math.abs(f)),f<0&&(H=!0));const a=c.geometry,l=c.properties[nn];let h=Array.isArray(l&&l[0]&&l[0][0])?l[0]:l;const{altitude:d,height:v}=rn.getFeaAltitudeAndHeight(c,e,i,r,o,u,s);v<0&&(W=!0),X=Math.max(Math.abs(d),X);const y=E.getLength();let p=0,M=z;Z.setLength(0),L.setLength(0);const w=rn.calculateSignedArea(a[0])<0;for(let t=0,e=a.length;t<e;t++){let i=a[t];w&&(i=i.reverse()),i=cn(i);const r=rn.calculateSignedArea(i)<0;if(!r&&t>0&&(p++,h=l&&l[p],z=D(M,z,Z,v*_,h,I),L.setLength(0),Z.setLength(0),M=z),n!==1/0&&(i=rn.clipPolygon(i,J)),!i.length){t===e-1&&(z=D(M,z,Z,v*_,h,I));continue}const o=i.length;if(Array.isArray(i[0])?i[0][0]===i[o-1][0]&&i[0][1]===i[o-1][1]||i.push([i[0][0],i[0][1]]):i[0].x===i[o-1].x&&i[0].y===i[o-1].y||i.push(i[0]),r){let t=Z.currentIndex;Z[t++]=L.getLength()/3,Z.currentIndex=t}ct(L,L.getLength(),i,_,d,!1,x),t===e-1&&(z=D(M,z,Z,v*_,h,I))}const m=E.getLength()-y,g=(tn+"").trim();for(let t=0;t<m/3;t++){let t=N.currentIndex;N[t++]=void 0===c[g]?Y:c[g],N.currentIndex=t,t=O.currentIndex,O[t++]=Y,O.currentIndex=t,S(f)&&(t=C.currentIndex,C[t++]=f,C.currentIndex=t)}}const K=rn.getUnsignedArrayType(N.getLength()?N[N.getLength()-1]:0),Q={hasNegativeHeight:W,maxAltitude:X,vertices:E,verticeTypes:$,indices:U,pickingIds:on.createTypedArray(N,K),featureIndexes:O};if(C.getLength()){const t=H?rn.getPosArrayType(R):rn.getUnsignedArrayType(R);Q.featureIds=on.createTypedArray(C,t)}else Q.featureIds=[];return G&&(G.setLength(E.getLength()/3*2),Q.uvs=G),Q}(t,e,{altitudeScale:p,altitudeProperty:g,defaultAltitude:P||0,heightProperty:x,minHeightProperty:b,defaultHeight:F||0},{center:y,top:N,side:C,topThickness:10*E||0,uv:k||A,uvSize:[r,r],uvOrigin:i,topUVMode:_,sideUVMode:I,sideVerticalUVMode:O,textureYOrigin:L,tileRatio:u,centimeterToPoint:c,verticalCentimeterToPoint:f,positionType:v,res:o,glScale:s,projectionCode:h},d,zn),$=[],j=U.vertices.getLength()/3,B=Dn.getIndexArrayType(j),V=Xn.createTypedArray(U.indices,B);delete U.indices,$.push(V.buffer,U.pickingIds.buffer);const G=Dn.getPosArrayType(Math.max(512,U.maxAltitude));U.vertices=Xn.createTypedArray(U.vertices,G);const D=A?zn.getProxy():new Float32Array(3*j);D.setLength&&D.setLength(3*j);const X=function(t,n,e){const i=e||[];i.setLength&&i.setLength(t.length);const r=In;r.length<t.length/3&&(r.length=t.length/3),r.fill(0,0,t.length/3);const o=void 0===n.length?n:n.length;for(let e=0;e<o/3;e++)void 0===n.length?jn(t,3*e,3*e+1,3*e+2,i,r):jn(t,n[3*e],n[3*e+1],n[3*e+2],i,r);for(let t=0;t<i.length;t+=3){const n=r[t/3];0!==n?(i[t]/=n,i[t+1]/=n,i[t+2]/=n):(i[t]=0,i[t+1]=0,i[t+2]=0)}return i}(U.vertices,V,D);let z=!0;const J=X.getLength?X.getLength():X.length;for(let t=0;t<J;t++){X[t]=-X[t];const n=X[t]%1;1-Math.abs(n)>1e-6?z=!1:0!==n&&(X[t]=Math.round(X[t]))}if(U.normals=X,A){let t=zn.get();t.setLength(4*j),t=function(t,n,e,i,r){const o=t.length/3,s=r||new Array(4*o),u=[],c=[];for(let t=0;t<o;t++)u[t]=[0,0,0],c[t]=[0,0,0];const f=[0,0,0],a=[0,0,0],l=[0,0,0],h=[0,0],d=[0,0],v=[0,0],y=[0,0,0],p=[0,0,0];function M(n,i,r){Bn(f,t,3*n),Bn(a,t,3*i),Bn(l,t,3*r),Vn(h,e,2*n),Vn(d,e,2*i),Vn(v,e,2*r);const o=a[0]-f[0],s=l[0]-f[0],M=a[1]-f[1],w=l[1]-f[1],m=a[2]-f[2],g=l[2]-f[2],P=d[0]-h[0],x=v[0]-h[0],b=d[1]-h[1],S=v[1]-h[1],F=1/(P*S-x*b);dn(y,(S*o-b*s)*F,(S*M-b*w)*F,(S*m-b*g)*F),dn(p,(P*s-x*o)*F,(P*w-x*M)*F,(P*g-x*m)*F),vn(u[n],u[n],y),vn(u[i],u[i],y),vn(u[r],u[r],y),vn(c[n],c[n],p),vn(c[i],c[i],p),vn(c[r],c[r],p)}for(let t=0,n=i.length;t<n;t+=3)M(i[t+0],i[t+1],i[t+2]);const w=[],m=[],g=[],P=[];let x,b,S;function F(t){Bn(g,n,3*t),hn(P,g),b=u[t],hn(w,b),wn(w,w,function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t}(g,g,pn(g,b))),yn(w,w),Mn(m,P,b),S=pn(m,c[t]),x=S<0?-1:1,s[4*t]=w[0],s[4*t+1]=w[1],s[4*t+2]=w[2],s[4*t+3]=x}for(let t=0,n=i.length;t<n;t+=3)F(i[t+0]),F(i[t+1]),F(i[t+2]);return s}(U.vertices,U.normals,U.uvs,V,t),t=function(t,n){const e=n.getLength(),i=new Float32Array(e),r=[],o=[],s=[];for(let u=0;u<e;u+=4){const e=u/4*3;lt(o,t[e]||0,t[e+1]||0,t[e+2]||0),dt(r,n[u]||0,n[u+1]||0,n[u+2]||0,n[u+3]||0),_n(s,o,r),ht(i.subarray(u,u+4),s)}return i}(U.normals,t),U.tangents=t,$.push(t.buffer),delete U.normals}if(U.normals&&(z&&(U.normals=Xn.createTypedArray(U.normals,Int8Array)),$.push(U.normals.buffer)),U.uvs){const t=U.uvs;U.uvs=Xn.createTypedArray(t,Float32Array),$.push(U.uvs.buffer)}const Y=function(t,n,e,i){const r={},o={},s=i.getLength();if(T(n.polygonFill)){let u=w(n.polygonFill);const c=new Uint8Array(4*s);c.fill(255);for(let n=0;n<s;n++){const o=t[i[n]],s=o.properties||{};s.$layer=o.layer,s.$type=o.type;let f=u(e,s);M(f)&&(r.aColor=1,u=w(f),f=u(e,s)),delete s.$layer,delete s.$type,Gn.normalizeColor(Yn,f),c[4*n]=Yn[0],c[4*n+1]=Yn[1],c[4*n+2]=Yn[2],c[4*n+3]=Yn[3]}o.aColor=c}if(T(n.polygonOpacity)){let u=m(n.polygonOpacity,"exponential");const c=new Uint8Array(s);c.fill(255);for(let n=0;n<s;n++){const o=t[i[n]],s=o.properties||{};s.$layer=o.layer,s.$type=o.type;let f=u(e,s);M(f)&&(r.aOpacity=1,u=w(f),f=u(e,s)),delete s.$layer,delete s.$type,c[n]=255*f}o.aOpacity=c}return o.dynamicAttributes=r,o}(t,a,l,U.featureIndexes),q=function(t,n,e,i,r){const o=[[],[]],s=T(i.topPolygonFill),u=T(i.bottomPolygonFill),c=[255,255,255,255],f=n.getLength();if(s||u){let a=s&&w(i.topPolygonFill),l=u&&w(i.bottomPolygonFill),h=null,d=null,v=null,y=null;for(let i=0;i<f;i++){if(1===t[i]&&!s||0===t[i]&&!u)continue;const f=1===t[i];if(f&&n[i]===h){t[i]=v;continue}if(!f&&n[i]===d){t[i]=y;continue}const p=e[n[i]],m=p.properties||{};m.$layer=p.layer,m.$type=p.type;let g=f?a:l,P=g(r,m);M(P)&&(g=w(P),P=g(r,m)),delete m.$layer,delete m.$type,Gn.normalizeColor(Yn,P),vt(Yn,Yn,c);let x=qn(o,Yn);x<0&&(x=o.length,o.push(ht([],Yn))),t[i]=x,f?(h=n[i],v=x):(d=n[i],y=x)}}return o.slice(2)}(U.verticeTypes,U.featureIndexes,t,a,l),R={data:{data:{aVertexColorType:q.length<=252?Xn.createTypedArray(U.verticeTypes,Uint8Array):Xn.createTypedArray(U.verticeTypes,Uint16Array),aPosition:U.vertices,aNormal:U.normals,aTexCoord0:U.uvs,aTangent:U.tangents,aPickingId:U.pickingIds},indices:V,properties:{maxAltitude:U.maxAltitude,hasNegativeHeight:U.hasNegativeHeight},dynamicAttributes:Y.dynamicAttributes,vertexColors:q},buffers:$};return U.featureIds.length?(R.data.featureIds=U.featureIds,$.push(R.data.featureIds.buffer)):R.data.featureIds=[],Y.aColor&&(R.data.data.aColor=Y.aColor,R.buffers.push(Y.aColor.buffer)),Y.aOpacity&&(R.data.data.aOpacity=Y.aOpacity,R.buffers.push(Y.aOpacity.buffer)),R.buffers.push(R.data.data.aPosition.buffer),R.data.pickingIdIndiceMap=Dn.generatePickingIndiceIndex(R.data.data.aPickingId,R.data.indices),R}const Yn=[];function qn(t,n){for(let r=0;r<t.length;r++)if(e=n,i=t[r],e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3])return r;var e,i;return-1}const{PackUtil:Rn,StyleUtil:Hn,FilterUtil:Zn}=en();function Wn(t,n,e,i,{altitudeScale:r,altitudeProperty:o,defaultAltitude:s,heightProperty:u,minHeightProperty:c,defaultHeight:f,bottom:a}){const l=a,h=n/t[0].extent,d=2*function(t,n){let e=0;for(let n=0,i=t.length;n<i;n++){const i=t[n];if(S(i.geometry[0][0]))e+=3*i.geometry.length;else for(let t=0,n=i.geometry.length;t<n;t++){let n=3*i.geometry[t].length;3===i.type&&(n-=3),e+=n}}return e}(t)+3*t.length*2,v=[],y=new Int16Array(d),p=new Uint8Array(y.length/3*4);M(e)&&(e=Zn.compileFilter(e));const w=[];function m(t,e,i){const r=e-t,o=y.subarray(t,e),s=y.subarray(e,e+r);s.set(o);for(let t=2,n=s.length;t<n;t+=3)s[t]=o[t]-i;const u=t/3,c=r/3;let f,a;for(let t=u,e=c+u;t<e;t++)t<e-1?(f=t,a=t+1):(f=t,a=u),ft(y,f,a,n)||(w.push(f,a),l&&w.push(f+c,a+c),Kn(y,f,n)||w.push(f,f+c));return e+r}let g=0,P=0;const x=(tn+"").trim(),b=[];for(let n=0,a=t.length;n<a;n++){const a=t[n],l=a.geometry;if(e){let t;t="function"==typeof e?e(a&&a.properties):e,Hn.normalizeColor(b,t)}else lt(b,255,255,255);const d=g/3*4,{altitude:M,height:S}=Rn.getFeaAltitudeAndHeight(a,r,o,s,u,f,c);P=Math.max(Math.abs(M),P);let F=g;for(let t=0,n=l.length;t<n;t++){let n=l[t];const e=n.length;n[0][0]===n[e-1][0]&&n[0][1]===n[e-1][1]&&(n=n.slice(0,e-1)),g=ct(y,F,n,h,M),g=m(F,g,S*h),F=g}const A=F/3*4;for(let t=d;t<A;t+=4)p[t]=b[0],p[t+1]=b[1],p[t+2]=b[2],p[t+3]=255*(i||1);const k=w.length-v.length;for(let t=0;t<k;t++)v.push(a[x])}const F=w.reduce(((t,n)=>Math.max(t,n)),0),A=new(Rn.getIndexArrayType(F))(w),k=Rn.getUnsignedArrayType(t.length);return{aPosition:new(Rn.getPosArrayType(Math.max(512,P)))(y),indices:A,aPickingId:new k(v),aColor:p}}function Kn(t,n,e){const i=t[3*n],r=t[3*n+1];return i<0||i>e||r<0||r>e}function Qn(t,n,e,i){const r=Wn(t,n,e.lineColor,e.lineOpacity,i),o=[r.aPosition.buffer,r.indices.buffer,r.aPickingId.buffer],s=r.indices;return delete r.indices,{data:{data:r,indices:s},buffers:o}}\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 te=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function ne(t){if(!t)return"true";const n=t[0];if(t.length<=1)return"any"===n?"false":"true";return\`(${o}"=="===n?ie(t[1],t[2],"===",!1):"!="===n?ie(t[1],t[2],"!==",!1):"<"===n||">"===n||"<="===n||">="===n?ie(t[1],t[2],n,!0):"any"===n?oe(t.slice(1),"||"):"all"===n?oe(t.slice(1),"&&"):"none"===n?ce(oe(t.slice(1),"||")):"in"===n?se(t[1],t.slice(2)):"!in"===n?ce(se(t[1],t.slice(2))):"has"===n?ue(t[1]):"!has"===n?ce(ue(t[1])):"contains"===n?function(t,n,e){const i=ee(t);return void 0!==e?\`(${o}i} + '').indexOf("${o}n}") === ${o}e}\`:\`(${o}i} + '').indexOf("${o}n}") >= 0\`}(t[1],t[2],t[3]):"true"})\`}function ee(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function ie(t,n,e,i){if("object"==typeof(r=t)&&r&&t.op)return function(t,n,e,i){const r=t.property,o=t.op;let s=ee(r);return"length"!==o?(console.error(\`not support ${o}o} op\`),"false"):(s=\`((${o}s}+='').length)\`,re(s,r,n,e,i))}(t,n,e,i);var r;return re(ee(t),t,n,e,i)}function re(t,n,e,i,r){const o="$type"===n?te.indexOf(e):JSON.stringify(e);return(r?\`typeof ${o}t}=== typeof ${o}o}&&\`:"")+t+i+o}function oe(t,n){return t.map(ne).join(n)}function se(t,n){"$type"===t&&(n=n.map((t=>te.indexOf(t))));const e=JSON.stringify(n.sort(fe)),i=ee(t);return n.length<=200?\`${o}e}.indexOf(${o}i}) !== -1\`:\`function(v, a, i, j) {\\n while (i <= j) { var m = (i + j) >> 1;\\n if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;\\n }\\n return false; }(${o}i}, ${o}e},0,${o}n.length-1})\`}function ue(t){return"$id"===t?'"id" in f':\`${o}JSON.stringify(t)} in p\`}function ce(t){return\`!(${o}t})\`}function fe(t,n){return t<n?-1:t>n?1:0}let ae=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),ae=!0}catch(t){ae=!1}var le=ae;const{VectorPack:he,PolygonPack:de,NativeLinePack:ve,LinePack:ye,PointPack:pe,NativePointPack:Me,LineExtrusionPack:we,CirclePack:me,RoundTubePack:ge,SquareTubePack:Pe,FilterUtil:xe,PackUtil:be,StyleUtil:Se,TextUtil:Fe,DEFAULT_TEX_WIDTH:Ae,GlyphRequestor:ke}=en(),Te="__original_properties",_e="__fn-type_properties";class Ie{constructor(t,n,e,i,r){this.id=t,this.options=n,this.upload=e,this.v(n.style),this.requests={},this.M=i,this.m=1,this.loadings=r}updateStyle(t,n){this.options.style=t,this.m=t.styleCounter,this.v(t),n()}updateOptions(t,n){this.options=x(this.options,t),n()}loadTile(t,n){const e=this.loadings,i=t.tileInfo.url,r=this.options.debugTile;if(r){const{x:e,y:i,z:o}=t.tileInfo;let s=!1;for(let t=0;t<r.length;t++)if(e===r[t].x&&i===r[t].y&&o===r[t].z){s=!0;break}if(!s)return void n()}if(e[i])return void e[i].push({context:t,callback:n,ref:this});e[i]=[{context:t,callback:n,ref:this}];const o=this.options.featureIdProperty;this.requests[i]=this.getTileFeatures(t,((n,r,s,u)=>{const c=e[i];if(delete e[i],this.checkIfCanceled(i))return delete this.requests[i],void this.P(c,null,{canceled:!0});if(delete this.requests[i],(this.options.debug||o)&&r)for(let n=0;n<r.length;n++)if(this.options.debug&&(r[n]._debug_info={index:n,id:r[n].id,tileId:t.tileInfo.id}),o){const t=A(o)?o[r[n].layer]:o,e=r[n].properties;r[n].id=e&&e[t]||null}if(n)this.P(c,n);else if(r&&r.length){if(c)for(let t=0;t<c.length;t++)this.S.call(c[t].ref,c[t].context,c[t].callback,i,s,r,u)}else this.P(c)}))}S(t,n,e,i,r,o){this.F(i,r,t).then((e=>{e.canceled?n(null,{canceled:!0}):(e.data.styleCounter=t.styleCounter,o&&x(e.data,o),n(null,e.data,e.buffers))})).catch((t=>{n(t)}))}abortTile(t,n){delete this.requests[t],this.A(t),n()}A(t){const n=this.loadings[t];if(n)for(let t=0;t<n.length;t++)n[t].callback(null,{canceled:!0});delete this.loadings[t]}P(t,n,e){if(t)for(let i=0;i<t.length;i++)t[i].callback(n,e)}checkIfCanceled(t){return!this.requests[t]}onRemove(){this.loadings={},delete this.M,this.requests={}}fetchIconGlyphs(t,n,e){if(this.options.workerGlyph&&le){const i=[];if(t&&Object.keys(t).length){const n=new Promise((n=>{this.upload("fetchIconGlyphs",{icons:t},null,((t,e)=>{n({err:t,iconData:e})}))}));i.push(n)}if(n&&Object.keys(n).length){const t=new Promise((t=>{this.k||(this.k=new ke),this.k.getGlyphs(n,((n,e)=>{t({err:n,glyphData:e})}))}));i.push(t)}Promise.all(i).then((t=>{const n={icons:null,glyphs:null};for(let i=0;i<t.length;i++){if(t[i].err)return void e(t[i].err);t[i].iconData?n.icons=t[i].iconData.icons:t[i].glyphData&&(n.glyphs=t[i].glyphData.glyphs)}return n})).then((t=>{e(null,t)}))}else this.upload("fetchIconGlyphs",{icons:t,glyphs:n},null,e)}F(t,n,e){if(!n.length)return Promise.resolve({data:null,buffers:[]});const{glScale:i,tileInfo:r}=e,o=!this.options.style.style.length&&!this.options.style.featureStyle.length;let s=this.pluginConfig.slice(0);o&&(s=this.T(t)),this.featurePlugins&&function(t){for(let n=1;n<arguments.length;n++){const e=arguments[n];if(e)for(let n=0,i=e.length;n<i;n++)t.push(e[n])}t.length}(s,this.featurePlugins);const u={};for(let t=0;t<s.length;t++)$e(n,e.tileInfo.z,s[t],u);const c=[],f=[];for(let t=0;t<n.length;t++){const e=n[t],i=u[t];if(i){f.fill(null);let t=0;for(const n in i){let r=0;const o=i[n].values();for(const t of o){let i=f[r];i||(i=Ge(e),f[r]=i),i.properties[n]=t,r++}r>t&&(t=r)}for(let n=0;n<t;n++)c.push(f[n])}else c.push(e)}const a=(n=c)[0].extent,l=r.z,h={x:r.extent2d.xmin*i,y:r.extent2d.ymax*i},d=[],v=[],y=[],p=this.options,M=[],w={},m=[Promise.resolve(e.styleCounter)];let g=0,P=-1;const b=[];let S=!1;for(let t=0;t<s.length;t++){P++;const i=s[t];i.type!==g&&(P=0,g=i.type);const u=0===i.type?d:v;if(i.symbol&&!1===i.symbol.visible){u[P]=null;continue}ze(i.symbol,b,t),S=S||b[t]&&b[t].size>0;const{tileFeatures:c,tileFeaIndexes:f}=this._(l,i.type,i.filter,n,w,t);if(!c.length){u[P]=null;continue}const p=f[f.length-1],F=be.getIndexArrayType(p);u[P]={styledFeatures:new F(f)},y.push({idx:t,typeIdx:P}),M.push(u[P].styledFeatures.buffer);const A=x({},e,{extent:a,zoom:l,tilePoint:h});if(this.options.debugTile){const t=this.options.debugTile;for(let n=0;n<t.length;n++){const{x:e,y:i,z:o}=t[n];if(r.x===e&&r.y===i&&r.z===o){A.debugIndex=t[n].index;break}}}let k=this.I(c,i,A);o&&(k=k.then((t=>{if(!t)return null;if(t.data)t.data.layer=c[0].layer;else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]&&t[n].data&&(t[n].data.layer=c[0].layer);return t}))),m.push(k)}return Promise.all(m).then((([e,...i])=>{if(e!==this.m)return{canceled:!0};function r(t,n){if(void 0===t.data.ref&&(t.data.type=s[y[n].idx].renderPlugin.dataConfig.type,t.data.filter=s[y[n].idx].filter.def,t.buffers&&t.buffers.length))for(let n=0;n<t.buffers.length;n++)M.push(t.buffers[n])}for(let t=0;t<i.length;t++){if(!i[t])continue;const n=i[t],e=0===s[y[t].idx].type?d:v;if(Array.isArray(n)){const i=[];for(let e=0;e<n.length;e++)n[e]&&(r(n[e],t),(void 0===n[e].data.ref||n[n[e].data.ref])&&i.push(n[e].data));i.length&&(e[y[t].typeIdx].data=i)}else r(n,t),e[y[t].typeIdx].data=n.data}const o={},u=t;if(p.features||p.schema||S){let t,e=!1;for(let i=0,r=n.length;i<r;i++)if(t=n[i],u[t.layer].properties||(u[t.layer].properties=Ce(t.properties)),t&&(p.features||S&&w[i]))if("id"===p.features)o[i]=t.id;else{p.pickingGeometry||delete t.geometry,delete t.extent,delete t.properties.$layer,delete t.properties.$type,delete t.__index;const n=t.originalFeature;if(n){const n=t.properties,e=x({},t.originalFeature);delete n[Te],e.customProps=x({},n),t=e}const r=x({},t);if(S&&w[i]&&(!p.features||"transient"===p.features)){const r=w[i];for(let i=0;i<r.length;i++){const r=b[i];r&&r.forEach((i=>{const r=n?n.properties:t.properties;r[_e]||(r[_e]=new Set),r[_e].add(i),e=!0}))}}o[i]=r}if(e)for(const t in o){const n=o[t],e=n.properties[_e];if(e){delete n.properties[_e],"transient"===p.features&&(n.fnTypeProps=x({},n.properties));for(const t in n.properties)e.has(t)||("transient"===p.features?delete n.fnTypeProps[t]:delete n.properties[t])}}}return{data:{styleCounter:e,schema:u,data:d,featureData:v,extent:a,features:o},buffers:M}})).catch((t=>{console.error(t)}))}I(t,n,e){let i=t;const r=n.renderPlugin.dataConfig,o=n.symbol,s=this.options.tileSize,{extent:u,glScale:c,zScale:f,zoom:a,tilePoint:l,centimeterToPoint:h,verticalCentimeterToPoint:d}=e,v=u/s,y=r.type,p=e.debugIndex;let M=x({},r,{EXTENT:u,zoom:a,debugIndex:p,features:this.options.features});if("3d-extrusion"===y){Le(o)&&(r.uv=1);const t=this.options.projectionCode,n=o.material&&o.material.textureWidth||Ae;return Promise.all([Promise.resolve(Jn(i,r,u,l,n,e.tileInfo.res,c,u/this.options.tileSize,h,d,o,a,t,p))])}if("3d-wireframe"===y)return Promise.all([Promise.resolve(Qn(i,u,o,r))]);if("point"===y){M=x(M,{requestor:this.fetchIconGlyphs.bind(this),altitudeToTileScale:f*u/this.options.tileSize/c});const t=pe.splitPointSymbol(o),n=he.genFnTypes(t[0]);return pe.needMerge(t[0],n,a)&&(i=pe.mergeLineFeatures(i,t[0],n,a)),Promise.all(t.map(((t,e)=>(0===e?M.fnTypes=n:delete M.fnTypes,new pe(i,t,M).load(v)))))}if("native-point"===y){const t=f*u/this.options.tileSize/c;return M.altitudeToTileScale=t,Ee(i,o,M,Me,u/s)}if("line"===y)return M=x(M,{requestor:this.fetchIconGlyphs.bind(this),tileRatio:v}),Ee(i,o,M,ye,1,!0);if("native-line"===y)return Ee(i,o,M,ve,1,!0);if("fill"===y)return M=x(M,{requestor:this.fetchIconGlyphs.bind(this)}),Ee(i,o,M,de);if("line-extrusion"===y){delete o.lineGradientProperty,o.lineJoin="miter",o.lineCap="butt";const t=Le(o);if(t&&(r.uv=1),M=x(M,{tileSize:s,zScale:f,glScale:c}),o.mergeOnProperty){const t=he.genFnTypes(o);i=ye.mergeLineFeatures(i,o,t,M.zoom)}if(t){const t=[];if(!1!==r.top){const n=x({},M);n.side=!1,t.push(new we(i,o,n))}return!1!==r.side&&(M.side=!0,M.top=!1,t.push(new we(i,o,M))),Promise.all(t.map((t=>t.load())))}return Promise.all([new we(i,o,M).load()])}if("circle"===y)return Ee(i,o,M,me);if("round-tube"===y||"square-tube"===y){const t="round-tube"===y?ge:Pe;return M=x(M,{requestor:this.fetchIconGlyphs.bind(this),radialSegments:"round-tube"===y?r.radialSegments||8:4,centimeterToPoint:h,verticalCentimeterToPoint:d,tileRatio:v,isTube:!0}),Ee(i,o,M,t)}return Promise.resolve([])}_(t,n,e,i,r,o){const s=(tn+"").trim(),u=[],c=[],f=i.length;for(let a=0;a<f;a++)if((1===n||void 0===i[a].id||!this.styledFeatures[i[a].id])&&((!e.def||"default"===e.def)&&!r[a]||!0===e.def||e.def&&(void 0!==e.def.condition||Array.isArray(e.def))&&e(i[a],t))){const t=i[a];if(void 0===t[s]&&(t[s]=a),r[a]||(r[a]=[]),r[a].push(o),c.push(t),u.push(a),1===n)break}return{tileFeatures:c,tileFeaIndexes:u}}v(t){const{style:n,featureStyle:e}=t,i={};e.forEach((t=>{Array.isArray(t.id)?(t.id.forEach((t=>{i[t]=1})),t.filter=["in","$id",...t.id]):(i[t.id]=1,t.filter=["==","$id",t.id])}));const r=xe.compileStyle(n);for(let t=0;t<n.length;t++)r[t].filter&&(r[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0),r[t].type=0;const o=[],s=xe.compileStyle(e);for(let t=0;t<e.length;t++)s[t].type=1,s[t].filter.def=e[t].filter?e[t].filter.value||e[t].filter:void 0,s[t].renderPlugin&&o.push(s[t]);this.pluginConfig=r,this.featurePlugins=o,this.styledFeatures=i}T(t){let n=this.O;this.O||(n=this.O={});const e=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],i=[];for(const o in t){const s=o;if(!n[o]){const i=[];for(let n=0;n<t[o].types.length;n++){const u=t[o].types[n],c=["all",["==","$layer",s],["==","$type",e[u]]],f={filter:(r=c,new Function("f",\`var p = (f && f.properties || {}); return ${o}ne(r)}\`)),renderPlugin:Oe(u),symbol:Ne(u)};f.filter.def=c,f.type=0,i.push(f)}n[s]=i}i.push(...n[s])}var r;return i}}function Oe(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 Ne(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 Ce(t){if(Array.isArray(t)||!A(t))return{};const n={};for(const e in t){const i=t[e];b(i)?n[e]="string":S(i)?n[e]="number":!0===i||!1===i?n[e]="boolean":Array.isArray(i)?n[e]="array":n[e]="object"}return n}function Le(t){if(!t)return 0;let n=0;for(const e in t){if(("normalTexture"===e||"bumpTexture"===e)&&t[e])return 2;if(e.indexOf("Texture")>0&&t[e])n=1;else if(A(t[e])){const i=Le(t[e]);if(2===i)return i;1===i&&(n=1)}}return n}function Ee(t,n,e,i,r,o){const s={},u=Array.isArray(n)?n:[n];let c=-1;for(let t=0;t<u.length;t++)s[t]=Ue(u[t]),!s[t]&&u[t]&&-1===c&&(c=t);const f=[];for(let n=0;n<u.length;n++){if(!u[n])continue;u[n].index={index:n};let a=t;if(o&&u[n].mergeOnProperty){const i=he.genFnTypes(u[n]);a=ye.mergeLineFeatures(t,u[0],i,e.zoom)}s[n]||n===c?f.push(new i(a,u[n],e).load(r)):f.push({data:{ref:c,symbolIndex:{index:n}}})}return Promise.all(f)}function Ue(t){if(!t)return 0;for(const n in t)if(T(t[n]))return 1;return 0}function $e(t,n,e,i){const r=e.customProperties;if(!r)return t;if(r)for(let t=0;t<r.length;t++)r[t].fn=xe.compileFilter(r[t].filter);for(let e=0;e<r.length;e++)for(let o=0,s=t.length;o<s;o++)if(r[e].fn(t[o],n))for(const t in r[e].properties){const n=r[e].properties[t];k(n)||(i[o]||(i[o]={}),i[o][t]||(i[o][t]=new Set),i[o][t].add(n))}}const je={get:(t,n)=>n in t?t[n]:t.originalFeature[n],has:(t,n)=>n in t||n in t.originalFeature},Be={get:function(t,n){return n in t?t[n]:t[Te][n]},has:(t,n)=>n in t||n in t[Te]},Ve={};function Ge(t){const n={};n.originalFeature=t;const e=new Proxy(n,je);return e.properties=new Proxy({},Be),e.properties[Te]=t.properties||Ve,e}function De(t,n,e){t[n]||(t[n]=new Set),t[n].add(e)}const Xe=[];function ze(t,n,e){if(!t)return Xe;for(const i in t){if(!t[i]||!Se.checkIfZoomFnTypeSymbol(i))continue;if(T(t[i]))De(n,e,t[i].property);else{if("lineGradientProperty"===i){De(n,e,t[i]);continue}if("textName"===i)if(b(t[i])){const r=Fe.resolveVarNames(t[i]);if(r)for(let t=0;t<r.length;t++)De(n,e,r[t])}else if(xe.isExpression(t[i])){const r=[];Fe.resolveExpVarNames(r,t[i]);for(let t=0;t<r.length;t++)De(n,e,r[t])}}const r=t[i].stops;if(r&&r.length)for(let t=0;t<r.length;t++)T(r[t][1])&&De(n,t,r[t][1].property)}return n[e]}function Je(t,n){Ye(t.geometry,n)}function Ye(t,n){if(t)switch(t.type){case"Point":qe(t.coordinates,n);break;case"MultiPoint":case"LineString":Re(t.coordinates,n);break;case"MultiLineString":!function(t,n){for(let e=0,i=t.length;e<i;e++)Re(t[e],n)}(t.coordinates,n);break;case"Polygon":He(t.coordinates,n);break;case"MultiPolygon":!function(t,n){for(let e=0,i=t.length;e<i;e++)He(t[e],n)}(t.coordinates,n);break;case"GeometryCollection":const e=t.geometries.length;for(let i=0;i<e;i++)Ye(t.geometries[i],n)}}function qe(t,n){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function Re(t,n){for(let e=0,i=t.length;e<i;e++)qe(t[e],n)}function He(t,n){t.length&&Re(t[0],n)}function Ze(t,n,e,i,r){We(t,n,e||0,i||t.length-1,r||Qe)}function We(t,n,e,i,r){for(;i>e;){if(i-e>600){var o=i-e+1,s=n-e+1,u=Math.log(o),c=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*c*(o-c)/o)*(s-o/2<0?-1:1);We(t,n,Math.max(e,Math.floor(n-s*c/o+f)),Math.min(i,Math.floor(n+(o-s)*c/o+f)),r)}var a=t[n],l=e,h=i;for(Ke(t,e,n),r(t[i],a)>0&&Ke(t,e,i);l<h;){for(Ke(t,l,h),l++,h--;r(t[l],a)<0;)l++;for(;r(t[h],a)>0;)h--}0===r(t[e],a)?Ke(t,e,h):Ke(t,++h,i),h<=n&&(e=h+1),n<=h&&(i=h-1)}}function Ke(t,n,e){var i=t[n];t[n]=t[e],t[e]=i}function Qe(t,n){return t<n?-1:t>n?1:0}class ti{constructor(t=9){this.N=Math.max(4,t),this.C=Math.max(2,Math.ceil(.4*this.N)),this.clear()}all(){return this.L(this.data,[])}search(t){let n=this.data;const e=[];if(!li(t,n))return e;const i=this.toBBox,r=[];for(;n;){for(let o=0;o<n.children.length;o++){const s=n.children[o],u=n.leaf?i(s):s;li(t,u)&&(n.leaf?e.push(s):ai(t,u)?this.L(s,e):r.push(s))}n=r.pop()}return e}collides(t){let n=this.data;if(!li(t,n))return!1;const e=[];for(;n;){for(let i=0;i<n.children.length;i++){const r=n.children[i],o=n.leaf?this.toBBox(r):r;if(li(t,o)){if(n.leaf||ai(t,o))return!0;e.push(r)}}n=e.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this.C){for(let n=0;n<t.length;n++)this.insert(t[n]);return this}let n=this.U(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this.$(this.data,n);else{if(this.data.height<n.height){const t=this.data;this.data=n,n=t}this.j(n,this.data.height-n.height-1,!0)}else this.data=n;return this}insert(t){return t&&this.j(t,this.data.height-1),this}clear(){return this.data=hi([]),this}remove(t,n){if(!t)return this;let e=this.data;const i=this.toBBox(t),r=[],o=[];let s,u,c;for(;e||r.length;){if(e||(e=r.pop(),u=r[r.length-1],s=o.pop(),c=!0),e.leaf){const i=ni(t,e.children,n);if(-1!==i)return e.children.splice(i,1),r.push(e),this.B(r),this}c||e.leaf||!ai(e,i)?u?(s++,e=u.children[s],c=!1):e=null:(r.push(e),o.push(s),s=0,u=e,e=e.children[0])}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}L(t,n){const e=[];for(;t;)t.leaf?n.push(...t.children):e.push(...t.children),t=e.pop();return n}U(t,n,e,i){const r=e-n+1;let o,s=this.N;if(r<=s)return o=hi(t.slice(n,e+1)),ei(o,this.toBBox),o;i||(i=Math.ceil(Math.log(r)/Math.log(s)),s=Math.ceil(r/Math.pow(s,i-1))),o=hi([]),o.leaf=!1,o.height=i;const u=Math.ceil(r/s),c=u*Math.ceil(Math.sqrt(s));di(t,n,e,c,this.compareMinX);for(let r=n;r<=e;r+=c){const n=Math.min(r+c-1,e);di(t,r,n,u,this.compareMinY);for(let e=r;e<=n;e+=u){const r=Math.min(e+u-1,n);o.children.push(this.U(t,e,r,i-1))}}return ei(o,this.toBBox),o}V(t,n,e,i){for(;i.push(n),!n.leaf&&i.length-1!==e;){let e,i=1/0,s=1/0;for(let u=0;u<n.children.length;u++){const c=n.children[u],f=ui(c),a=(r=t,o=c,(Math.max(o.maxX,r.maxX)-Math.min(o.minX,r.minX))*(Math.max(o.maxY,r.maxY)-Math.min(o.minY,r.minY))-f);a<s?(s=a,i=f<i?f:i,e=c):a===s&&f<i&&(i=f,e=c)}n=e||n.children[0]}var r,o;return n}j(t,n,e){const i=e?t:this.toBBox(t),r=[],o=this.V(i,this.data,n,r);for(o.children.push(t),ri(o,i);n>=0&&r[n].children.length>this.N;)this.G(r,n),n--;this.D(i,r,n)}G(t,n){const e=t[n],i=e.children.length,r=this.C;this.X(e,r,i);const o=this.J(e,r,i),s=hi(e.children.splice(o,e.children.length-o));s.height=e.height,s.leaf=e.leaf,ei(e,this.toBBox),ei(s,this.toBBox),n?t[n-1].children.push(s):this.$(e,s)}$(t,n){this.data=hi([t,n]),this.data.height=t.height+1,this.data.leaf=!1,ei(this.data,this.toBBox)}J(t,n,e){let i,r=1/0,o=1/0;for(let s=n;s<=e-n;s++){const n=ii(t,0,s,this.toBBox),u=ii(t,s,e,this.toBBox),c=fi(n,u),f=ui(n)+ui(u);c<r?(r=c,i=s,o=f<o?f:o):c===r&&f<o&&(o=f,i=s)}return i||e-n}X(t,n,e){const i=t.leaf?this.compareMinX:oi,r=t.leaf?this.compareMinY:si;this.Y(t,n,e,i)<this.Y(t,n,e,r)&&t.children.sort(i)}Y(t,n,e,i){t.children.sort(i);const r=this.toBBox,o=ii(t,0,n,r),s=ii(t,e-n,e,r);let u=ci(o)+ci(s);for(let i=n;i<e-n;i++){const n=t.children[i];ri(o,t.leaf?r(n):n),u+=ci(o)}for(let i=e-n-1;i>=n;i--){const n=t.children[i];ri(s,t.leaf?r(n):n),u+=ci(s)}return u}D(t,n,e){for(let i=e;i>=0;i--)ri(n[i],t)}B(t){for(let n,e=t.length-1;e>=0;e--)0===t[e].children.length?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():ei(t[e],this.toBBox)}}function ni(t,n,e){if(!e)return n.indexOf(t);for(let i=0;i<n.length;i++)if(e(t,n[i]))return i;return-1}function ei(t,n){ii(t,0,t.children.length,n,t)}function ii(t,n,e,i,r){r||(r=hi(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let o=n;o<e;o++){const n=t.children[o];ri(r,t.leaf?i(n):n)}return r}function ri(t,n){return t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),t}function oi(t,n){return t.minX-n.minX}function si(t,n){return t.minY-n.minY}function ui(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function ci(t){return t.maxX-t.minX+(t.maxY-t.minY)}function fi(t,n){const e=Math.max(t.minX,n.minX),i=Math.max(t.minY,n.minY),r=Math.min(t.maxX,n.maxX),o=Math.min(t.maxY,n.maxY);return Math.max(0,r-e)*Math.max(0,o-i)}function ai(t,n){return t.minX<=n.minX&&t.minY<=n.minY&&n.maxX<=t.maxX&&n.maxY<=t.maxY}function li(t,n){return n.minX<=t.maxX&&n.minY<=t.maxY&&n.maxX>=t.minX&&n.maxY>=t.minY}function hi(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function di(t,n,e,i,r){const o=[n,e];for(;o.length;){if((e=o.pop())-(n=o.pop())<=i)continue;const s=n+Math.ceil((e-n)/i/2)*i;Ze(t,s,n,e,r),o.push(n,s,s,e)}}class vi{constructor(t=[],n=yi){if(this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this.q(t)}push(t){this.data.push(t),this.length++,this.R(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this.q(0)),t}peek(){return this.data[0]}R(t){const{data:n,compare:e}=this,i=n[t];for(;t>0;){const r=t-1>>1,o=n[r];if(e(i,o)>=0)break;n[t]=o,t=r}n[t]=i}q(t){const{data:n,compare:e}=this,i=this.length>>1,r=n[t];for(;t<i;){let i=1+(t<<1),o=n[i];const s=i+1;if(s<this.length&&e(n[s],o)<0&&(i=s,o=n[s]),e(o,r)>=0)break;n[t]=o,t=i}n[t]=r}}function yi(t,n){return t<n?-1:t>n?1:0}var pi={exports:{}},Mi=function(t,n,e,i){var r=t[0],o=t[1],s=!1;void 0===e&&(e=0),void 0===i&&(i=n.length);for(var u=(i-e)/2,c=0,f=u-1;c<u;f=c++){var a=n[e+2*c+0],l=n[e+2*c+1],h=n[e+2*f+0],d=n[e+2*f+1];l>o!=d>o&&r<(h-a)*(o-l)/(d-l)+a&&(s=!s)}return s},wi=function(t,n,e,i){var r=t[0],o=t[1],s=!1;void 0===e&&(e=0),void 0===i&&(i=n.length);for(var u=i-e,c=0,f=u-1;c<u;f=c++){var a=n[c+e][0],l=n[c+e][1],h=n[f+e][0],d=n[f+e][1];l>o!=d>o&&r<(h-a)*(o-l)/(d-l)+a&&(s=!s)}return s};pi.exports=function(t,n,e,i){return n.length>0&&Array.isArray(n[0])?wi(t,n,e,i):Mi(t,n,e,i)};var mi=pi.exports.nested=wi;pi.exports.flat=Mi;const gi=11102230246251565e-32,Pi=134217729,xi=(3+8*gi)*gi;function bi(t,n,e,i,r){let o,s,u,c,f=n[0],a=i[0],l=0,h=0;a>f==a>-f?(o=f,f=n[++l]):(o=a,a=i[++h]);let d=0;if(l<t&&h<e)for(a>f==a>-f?(s=f+o,u=o-(s-f),f=n[++l]):(s=a+o,u=o-(s-a),a=i[++h]),o=s,0!==u&&(r[d++]=u);l<t&&h<e;)a>f==a>-f?(s=o+f,c=s-o,u=o-(s-c)+(f-c),f=n[++l]):(s=o+a,c=s-o,u=o-(s-c)+(a-c),a=i[++h]),o=s,0!==u&&(r[d++]=u);for(;l<t;)s=o+f,c=s-o,u=o-(s-c)+(f-c),f=n[++l],o=s,0!==u&&(r[d++]=u);for(;h<e;)s=o+a,c=s-o,u=o-(s-c)+(a-c),a=i[++h],o=s,0!==u&&(r[d++]=u);return 0===o&&0!==d||(r[d++]=o),d}function Si(t){return new Float64Array(t)}const Fi=33306690738754716e-32,Ai=22204460492503146e-32,ki=11093356479670487e-47,Ti=Si(4),_i=Si(8),Ii=Si(12),Oi=Si(16),Ni=Si(4);function Ci(t,n,e,i,r,o){const s=(n-o)*(e-r),u=(t-r)*(i-o),c=s-u;if(0===s||0===u||s>0!=u>0)return c;const f=Math.abs(s+u);return Math.abs(c)>=Fi*f?c:-function(t,n,e,i,r,o,s){let u,c,f,a,l,h,d,v,y,p,M,w,m,g,P,x,b,S;const F=t-r,A=e-r,k=n-o,T=i-o;g=F*T,h=Pi*F,d=h-(h-F),v=F-d,h=Pi*T,y=h-(h-T),p=T-y,P=v*p-(g-d*y-v*y-d*p),x=k*A,h=Pi*k,d=h-(h-k),v=k-d,h=Pi*A,y=h-(h-A),p=A-y,b=v*p-(x-d*y-v*y-d*p),M=P-b,l=P-M,Ti[0]=P-(M+l)+(l-b),w=g+M,l=w-g,m=g-(w-l)+(M-l),M=m-x,l=m-M,Ti[1]=m-(M+l)+(l-x),S=w+M,l=S-w,Ti[2]=w-(S-l)+(M-l),Ti[3]=S;let _=function(t,n){let e=n[0];for(let i=1;i<t;i++)e+=n[i];return e}(4,Ti),I=Ai*s;if(_>=I||-_>=I)return _;if(l=t-F,u=t-(F+l)+(l-r),l=e-A,f=e-(A+l)+(l-r),l=n-k,c=n-(k+l)+(l-o),l=i-T,a=i-(T+l)+(l-o),0===u&&0===c&&0===f&&0===a)return _;if(I=ki*s+xi*Math.abs(_),_+=F*a+T*u-(k*f+A*c),_>=I||-_>=I)return _;g=u*T,h=Pi*u,d=h-(h-u),v=u-d,h=Pi*T,y=h-(h-T),p=T-y,P=v*p-(g-d*y-v*y-d*p),x=c*A,h=Pi*c,d=h-(h-c),v=c-d,h=Pi*A,y=h-(h-A),p=A-y,b=v*p-(x-d*y-v*y-d*p),M=P-b,l=P-M,Ni[0]=P-(M+l)+(l-b),w=g+M,l=w-g,m=g-(w-l)+(M-l),M=m-x,l=m-M,Ni[1]=m-(M+l)+(l-x),S=w+M,l=S-w,Ni[2]=w-(S-l)+(M-l),Ni[3]=S;const O=bi(4,Ti,4,Ni,_i);g=F*a,h=Pi*F,d=h-(h-F),v=F-d,h=Pi*a,y=h-(h-a),p=a-y,P=v*p-(g-d*y-v*y-d*p),x=k*f,h=Pi*k,d=h-(h-k),v=k-d,h=Pi*f,y=h-(h-f),p=f-y,b=v*p-(x-d*y-v*y-d*p),M=P-b,l=P-M,Ni[0]=P-(M+l)+(l-b),w=g+M,l=w-g,m=g-(w-l)+(M-l),M=m-x,l=m-M,Ni[1]=m-(M+l)+(l-x),S=w+M,l=S-w,Ni[2]=w-(S-l)+(M-l),Ni[3]=S;const N=bi(O,_i,4,Ni,Ii);g=u*a,h=Pi*u,d=h-(h-u),v=u-d,h=Pi*a,y=h-(h-a),p=a-y,P=v*p-(g-d*y-v*y-d*p),x=c*f,h=Pi*c,d=h-(h-c),v=c-d,h=Pi*f,y=h-(h-f),p=f-y,b=v*p-(x-d*y-v*y-d*p),M=P-b,l=P-M,Ni[0]=P-(M+l)+(l-b),w=g+M,l=w-g,m=g-(w-l)+(M-l),M=m-x,l=m-M,Ni[1]=m-(M+l)+(l-x),S=w+M,l=S-w,Ni[2]=w-(S-l)+(M-l),Ni[3]=S;const C=bi(N,Ii,4,Ni,Oi);return Oi[C-1]}(t,n,e,i,r,o,f)}function Li(t,n,e){n=Math.max(0,void 0===n?2:n),e=e||0;var i=function(t){for(var n=t[0],e=t[0],i=t[0],r=t[0],o=0;o<t.length;o++){var s=t[o];s[0]<n[0]&&(n=s),s[0]>i[0]&&(i=s),s[1]<e[1]&&(e=s),s[1]>r[1]&&(r=s)}var u=[n,e,i,r],c=u.slice();for(o=0;o<t.length;o++)mi(t[o],u)||c.push(t[o]);return function(t){t.sort(Yi);for(var n=[],e=0;e<t.length;e++){for(;n.length>=2&&Vi(n[n.length-2],n[n.length-1],t[e])<=0;)n.pop();n.push(t[e])}for(var i=[],r=t.length-1;r>=0;r--){for(;i.length>=2&&Vi(i[i.length-2],i[i.length-1],t[r])<=0;)i.pop();i.push(t[r])}return i.pop(),n.pop(),n.concat(i)}(c)}(t),r=new ti(16);r.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},r.compareMinX=function(t,n){return t[0]-n[0]},r.compareMinY=function(t,n){return t[1]-n[1]},r.load(t);for(var o,s=[],u=0;u<i.length;u++){var c=i[u];r.remove(c),o=Di(c,o),s.push(o)}var f=new ti(16);for(u=0;u<s.length;u++)f.insert(Gi(s[u]));for(var a=n*n,l=e*e;s.length;){var h=s.shift(),d=h.p,v=h.next.p,y=Xi(d,v);if(!(y<l)){var p=y/a;(c=Ei(r,h.prev.p,d,v,h.next.next.p,p,f))&&Math.min(Xi(c,d),Xi(c,v))<=p&&(s.push(h),s.push(Di(c,h)),r.remove(c),f.remove(h),f.insert(Gi(h)),f.insert(Gi(h.next)))}}h=o;var M=[];do{M.push(h.p),h=h.next}while(h!==o);return M.push(h.p),M}function Ei(t,n,e,i,r,o,s){for(var u=new vi([],Ui),c=t.data;c;){for(var f=0;f<c.children.length;f++){var a=c.children[f],l=c.leaf?zi(a,e,i):$i(e,i,a);l>o||u.push({node:a,dist:l})}for(;u.length&&!u.peek().node.children;){var h=u.pop(),d=h.node,v=zi(d,n,e),y=zi(d,i,r);if(h.dist<v&&h.dist<y&&Bi(e,d,s)&&Bi(i,d,s))return d}(c=u.pop())&&(c=c.node)}return null}function Ui(t,n){return t.dist-n.dist}function $i(t,n,e){if(ji(t,e)||ji(n,e))return 0;var i=Ji(t[0],t[1],n[0],n[1],e.minX,e.minY,e.maxX,e.minY);if(0===i)return 0;var r=Ji(t[0],t[1],n[0],n[1],e.minX,e.minY,e.minX,e.maxY);if(0===r)return 0;var o=Ji(t[0],t[1],n[0],n[1],e.maxX,e.minY,e.maxX,e.maxY);if(0===o)return 0;var s=Ji(t[0],t[1],n[0],n[1],e.minX,e.maxY,e.maxX,e.maxY);return 0===s?0:Math.min(i,r,o,s)}function ji(t,n){return t[0]>=n.minX&&t[0]<=n.maxX&&t[1]>=n.minY&&t[1]<=n.maxY}function Bi(t,n,e){for(var i,r,o,s,u=Math.min(t[0],n[0]),c=Math.min(t[1],n[1]),f=Math.max(t[0],n[0]),a=Math.max(t[1],n[1]),l=e.search({minX:u,minY:c,maxX:f,maxY:a}),h=0;h<l.length;h++)if(i=l[h].p,r=l[h].next.p,o=t,i!==(s=n)&&r!==o&&Vi(i,r,o)>0!=Vi(i,r,s)>0&&Vi(o,s,i)>0!=Vi(o,s,r)>0)return!1;return!0}function Vi(t,n,e){return Ci(t[0],t[1],n[0],n[1],e[0],e[1])}function Gi(t){var n=t.p,e=t.next.p;return t.minX=Math.min(n[0],e[0]),t.minY=Math.min(n[1],e[1]),t.maxX=Math.max(n[0],e[0]),t.maxY=Math.max(n[1],e[1]),t}function Di(t,n){var e={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return n?(e.next=n.next,e.prev=n,n.next.prev=e,n.next=e):(e.prev=e,e.next=e),e}function Xi(t,n){var e=t[0]-n[0],i=t[1]-n[1];return e*e+i*i}function zi(t,n,e){var i=n[0],r=n[1],o=e[0]-i,s=e[1]-r;if(0!==o||0!==s){var u=((t[0]-i)*o+(t[1]-r)*s)/(o*o+s*s);u>1?(i=e[0],r=e[1]):u>0&&(i+=o*u,r+=s*u)}return(o=t[0]-i)*o+(s=t[1]-r)*s}function Ji(t,n,e,i,r,o,s,u){var c,f,a,l,h=e-t,d=i-n,v=s-r,y=u-o,p=t-r,M=n-o,w=h*h+d*d,m=h*v+d*y,g=v*v+y*y,P=h*p+d*M,x=v*p+y*M,b=w*g-m*m,S=b,F=b;0===b?(f=0,S=1,l=x,F=g):(l=w*x-m*P,(f=m*x-g*P)<0?(f=0,l=x,F=g):f>S&&(f=S,l=x+m,F=g)),l<0?(l=0,-P<0?f=0:-P>w?f=S:(f=-P,S=w)):l>F&&(l=F,-P+m<0?f=0:-P+m>w?f=S:(f=-P+m,S=w));var A=(1-(a=0===l?0:l/F))*r+a*s-((1-(c=0===f?0:f/S))*t+c*e),k=(1-a)*o+a*u-((1-c)*n+c*i);return A*A+k*k}function Yi(t,n){return t[0]===n[0]?t[1]-n[1]:t[0]-n[0]}const{PackUtil:qi}=en();class Ri{constructor(t,n){this.x=t,this.y=n}clone(){return new Ri(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 Ri(this.x-t.x,this.y-t.y)}distance(t){const n=this.x-t.x,e=this.y-t.y;return Math.sqrt(n*n+e*e)}dot(t){return this.x*t.x+this.y*t.y}equals(t){return this.x===t.x&&this.y===t.y}orthogonal(){return new Ri(this.y,-this.x)}}function Hi(t,n,e,i){const r=n.x*i.y-n.y*i.x,o=e.x-t.x,s=e.y-t.y,u=(o*i.y-s*i.x)/r;return new Ri(t.x+u*n.x,t.y+u*n.y)}const Zi=[],Wi=[];function Ki(t){if(S(t[0]&&t[0].x)){const n=[];let e=0;for(let i=0;i<t.length;i++)Wi[e]?(Wi[e][0]=t[i].x,Wi[e][1]=t[i].y):Wi[e]=[t[i].x,t[i].y],n.push(Wi[e]),e++;t=n}try{const n=Li(t,1/0);let e=[1/0,1/0],i=[-1/0,-1/0];for(let t=0;t<n.length;t++)n[t][0]<e[0]&&(e[0]=n[t][0]),n[t][0]>i[0]&&(i[0]=n[t][0]),n[t][1]<e[1]&&(e[1]=n[t][1]),n[t][1]>i[1]&&(i[1]=n[t][1]);const r=[];let o=[],s=0;for(let t=0;t<n.length;t++)t===n.length-1&&n[t][0]===n[0][0]&&n[t][1]===n[0][1]||(gt(r,n[t],"EPSG:3857"),Zi[s]?(Zi[s].x=r[0],Zi[s].y=r[1]):Zi[s]=new Ri(r[0],r[1]),o.push(Zi[s]),s++);qi.calculateSignedArea(o)<0&&(o=o.reverse());const u=function(t){let n,e=Number.MAX_VALUE;const i=function(t,i,r,o,s,u,c,f){var a=Hi(t,i,s,u),l=Hi(r,o,s,u),h=Hi(c,f,t,i),d=Hi(c,f,r,o),v=a.distance(l)*a.distance(h);0!==v&&v<e&&(n=[a,h,d,l],e=v)};var r=[];for(let n=0;n<t.length;n++)r.push(t[(n+1)%t.length].diff(t[n])),r[n].normalize();var o,s,u,c,f=new Ri(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),a=new Ri(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let n=0;n<t.length;n++){var l=t[n];l.x<f.x&&(f.x=l.x,o=n),l.x>a.x&&(a.x=l.x,s=n),l.y<f.y&&(f.y=l.y,c=n),l.y>a.y&&(a.y=l.y,u=n)}var h=new Ri(0,-1),d=new Ri(0,1),v=new Ri(-1,0),y=new Ri(1,0);for(let n=0;n<t.length;n++){var p=[Math.acos(h.dot(r[o])),Math.acos(d.dot(r[s])),Math.acos(v.dot(r[u])),Math.acos(y.dot(r[c]))];switch(p.indexOf(Math.min.apply(Math,p))){case 0:(d=(h=r[o].clone()).clone()).negate(),(y=(v=h.orthogonal()).clone()).negate(),o=(o+1)%t.length;break;case 1:(h=(d=r[s].clone()).clone()).negate(),(y=(v=h.orthogonal()).clone()).negate(),s=(s+1)%t.length;break;case 2:(y=(v=r[u].clone()).clone()).negate(),(d=(h=y.orthogonal()).clone()).negate(),u=(u+1)%t.length;break;case 3:(v=(y=r[c].clone()).clone()).negate(),(d=(h=y.orthogonal()).clone()).negate(),c=(c+1)%t.length}i(t[o],h,t[s],d,t[u],v,t[c],y)}return n}(o);if(!u||4!==u.length)return null;const c=u[0].distance(u[1]),f=u[1].distance(u[2]),a=u.map((t=>[t.x,t.y]));return a.push(+(f>c)),a}catch(t){return null}}const Qi=[];function tr(t,n){const e=Array.isArray(t&&t[0]&&t[0][0]);for(let i=0;i<t.length;i++)e?t[i]=tr(t[i]):(gt(Qi,t[i],n),t[i][0]=Qi[0],t[i][1]=Qi[1]);return t}const{PackUtil:nr}=en();class er extends Ie{constructor(t,n,e,i,r,o){super(t,n,e,i,r),(n=n||{}).extent||(n.extent=8192),this.setData(n.data,o)}setData(t,n){if(delete this.index,function(t){if(!t)return!0;if(Array.isArray(t)&&!t.length)return!0;if(t.features&&!t.features.length)return!0;return!1}(t))return this.empty=!0,void n();const e={maxZoom:24,tolerance:this.options.simplifyTolerance,extent:this.options.extent,buffer: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&&(e.projection=this.options.projection,"EPSG:4490"===e.projection&&(e.projection="EPSG:4326")),b(t)&&"{"!=t.substring(0,1)||t.url){const i=t.url?t.url:t;I.getJSON(i,t.url?t:{},((t,r)=>{if(t&&(console.error("Failed to fetch geojson:"+i),n(t)),!r)return void n(null,{extent:null,idMap:{}});let o=r;if(this.options.convertFn){o=new Function("data",this.options.convertFn+"\\nreturn convert(data)")(o)}const s=Array.isArray(o)?o:o.features;this.H(s);const{sample1000:u,idMap:c}=this.Z(s);this.W(u,c,o,e,n)}))}else{"string"==typeof t&&(t=JSON.parse(t));const i=Array.isArray(t)?t:t.features,r=i&&i.length;this.H(i);let o=i;if(i&&r>1e3){o=[];for(let t=0;t<r;t++)ir(i[t],o,t,r)}this.W(o,null,t,e,n)}}H(t){if(this.options.generateOMBB&&t)for(let n=0;n<t.length;n++){const e=t[n];if(e&&e.geometry&&e.geometry.coordinates)if("Polygon"===e.geometry.type){const t=e.geometry.coordinates[0];if(!t)continue;const n=Ki(t,t.length);e.properties=e.properties||{},e.properties[nn]=n}else if("MultiPolygon"===e.geometry.type){const t=e.geometry.coordinates;for(let n=0;n<t.length;n++){if(!t[n])continue;const i=t[n][0];if(!i)continue;const r=Ki(i,i.length);e.properties=e.properties||{},e.properties[nn]=e.properties[nn]||[],e.properties[nn][n]=r}}}}W(t,n,e,i,r){try{const o=t&&t.length?function(t){let n=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];switch(t.type){case"FeatureCollection":const e=t.features.length;for(let i=0;i<e;i++)Je(t.features[i],n);break;case"Feature":Je(t,n);break;default:Ye(t,n)}return n}({type:"FeatureCollection",features:t}):null;this.index=function(t,n){return new st(t,n)}(e,this.options.geojsonvt||i),r(null,{extent:o,idMap:n})}catch(t){console.warn(t),r({error:t.message})}}Z(t){const n=[],e={};let i=0;const r=this.options.featureIdProperty;if(t){const o=t.length;t.forEach(((t,s)=>{!function(t,o,s){if(t&&("Feature"!==t.type||t.geometry)){if(S(t.id)||(t.id=i++),r){let n=r;A(r)&&(n=r[t.layer||"0"]),t.id=t.properties[n]}e[t.id]=x({},t),t.geometry?(e[t.id].geometry=x({},t.geometry),e[t.id].geometry.coordinates=null):t.coordinates&&(e[t.id].coordinates=null),ir(t,n,o,s)}}(t,s,o)}))}return{sample1000:n,idMap:e}}getTileFeatures(t,n){const e=t.tileInfo,i=[];if(!this.index)return this.empty?(setTimeout((function(){n(null,i,[])}),1),1):(setTimeout((function(){n({loading:!0})}),1),1);const r=this.index.getTile(e.z,e.x,e.y);if(!r||0===r.features.length)return setTimeout((function(){n(null,i,[])}),1),1;const o=[];for(let t=0,n=r.features.length;t<n;t++){const n=r.features[t];let e=n.layer;void 0===e&&(e="0"),o[e]={types:{}};o[e].types[n.type]=1,n.tags=n.tags||{},n.geometry.converted||(nr.convertGeometry(n),n.geometry.converted=1),i.push({type:n.type,layer:e,id:n.id,geometry:n.geometry,properties:n.tags,extent:this.options.extent})}for(const t in o)o[t].types=Object.keys(o[t].types).map((t=>+t));return setTimeout((function(){n(null,i,o)}),1),1}onRemove(){super.onRemove(),delete this.index}}function ir(t,n,e,i){const r=Math.floor(i/998);(0===e||e===i-1||(0===r||e%r==0)&&n.length<999)&&n.push(t)}var rr={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,n,e,i,r){var o,s,u=8*r-i-1,c=(1<<u)-1,f=c>>1,a=-7,l=e?r-1:0,h=e?-1:1,d=t[n+l];for(l+=h,o=d&(1<<-a)-1,d>>=-a,a+=u;a>0;o=256*o+t[n+l],l+=h,a-=8);for(s=o&(1<<-a)-1,o>>=-a,a+=i;a>0;s=256*s+t[n+l],l+=h,a-=8);if(0===o)o=1-f;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),o-=f}return(d?-1:1)*s*Math.pow(2,o-i)},write:function(t,n,e,i,r,o){var s,u,c,f=8*o-r-1,a=(1<<f)-1,l=a>>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:o-1,v=i?1:-1,y=n<0||0===n&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(u=isNaN(n)?1:0,s=a):(s=Math.floor(Math.log(n)/Math.LN2),n*(c=Math.pow(2,-s))<1&&(s--,c*=2),(n+=s+l>=1?h/c:h*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=a?(u=0,s=a):s+l>=1?(u=(n*c-1)*Math.pow(2,r),s+=l):(u=n*Math.pow(2,l-1)*Math.pow(2,r),s=0));r>=8;t[e+d]=255&u,d+=v,u/=256,r-=8);for(s=s<<r|u,f+=r;f>0;t[e+d]=255&s,d+=v,s/=256,f-=8);t[e+d-v]|=128*y}},or=ur,sr=rr;function ur(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}ur.Varint=0,ur.Fixed64=1,ur.Bytes=2,ur.Fixed32=5;var cr=4294967296,fr=1/cr,ar="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function lr(t){return t.type===ur.Bytes?t.readVarint()+t.pos:t.pos+1}function hr(t,n,e){return e?4294967296*n+(t>>>0):4294967296*(n>>>0)+(t>>>0)}function dr(t,n,e){var i=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));e.realloc(i);for(var r=e.pos-1;r>=t;r--)e.buf[r+i]=e.buf[r]}function vr(t,n){for(var e=0;e<t.length;e++)n.writeVarint(t[e])}function yr(t,n){for(var e=0;e<t.length;e++)n.writeSVarint(t[e])}function pr(t,n){for(var e=0;e<t.length;e++)n.writeFloat(t[e])}function Mr(t,n){for(var e=0;e<t.length;e++)n.writeDouble(t[e])}function wr(t,n){for(var e=0;e<t.length;e++)n.writeBoolean(t[e])}function mr(t,n){for(var e=0;e<t.length;e++)n.writeFixed32(t[e])}function gr(t,n){for(var e=0;e<t.length;e++)n.writeSFixed32(t[e])}function Pr(t,n){for(var e=0;e<t.length;e++)n.writeFixed64(t[e])}function xr(t,n){for(var e=0;e<t.length;e++)n.writeSFixed64(t[e])}function br(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+16777216*t[n+3]}function Sr(t,n,e){t[e]=n,t[e+1]=n>>>8,t[e+2]=n>>>16,t[e+3]=n>>>24}function Fr(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+(t[n+3]<<24)}ur.prototype={destroy:function(){this.buf=null},readFields:function(t,n,e){for(e=e||this.length;this.pos<e;){var i=this.readVarint(),r=i>>3,o=this.pos;this.type=7&i,t(r,n,this),this.pos===o&&this.skip(i)}return n},readMessage:function(t,n){return this.readFields(t,n,this.readVarint()+this.pos)},readFixed32:function(){var t=br(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Fr(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=br(this.buf,this.pos)+br(this.buf,this.pos+4)*cr;return this.pos+=8,t},readSFixed64:function(){var t=br(this.buf,this.pos)+Fr(this.buf,this.pos+4)*cr;return this.pos+=8,t},readFloat:function(){var t=sr.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=sr.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var n,e,i=this.buf;return n=127&(e=i[this.pos++]),e<128?n:(n|=(127&(e=i[this.pos++]))<<7,e<128?n:(n|=(127&(e=i[this.pos++]))<<14,e<128?n:(n|=(127&(e=i[this.pos++]))<<21,e<128?n:function(t,n,e){var i,r,o=e.buf;if(r=o[e.pos++],i=(112&r)>>4,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(127&r)<<3,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(127&r)<<10,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(127&r)<<17,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(127&r)<<24,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(1&r)<<31,r<128)return hr(t,i,n);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(e=i[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,n=this.pos;return this.pos=t,t-n>=12&&ar?function(t,n,e){return ar.decode(t.subarray(n,e))}(this.buf,n,t):function(t,n,e){var i="",r=n;for(;r<e;){var o,s,u,c=t[r],f=null,a=c>239?4:c>223?3:c>191?2:1;if(r+a>e)break;1===a?c<128&&(f=c):2===a?128==(192&(o=t[r+1]))&&(f=(31&c)<<6|63&o)<=127&&(f=null):3===a?(o=t[r+1],s=t[r+2],128==(192&o)&&128==(192&s)&&((f=(15&c)<<12|(63&o)<<6|63&s)<=2047||f>=55296&&f<=57343)&&(f=null)):4===a&&(o=t[r+1],s=t[r+2],u=t[r+3],128==(192&o)&&128==(192&s)&&128==(192&u)&&((f=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&u)<=65535||f>=1114112)&&(f=null)),null===f?(f=65533,a=1):f>65535&&(f-=65536,i+=String.fromCharCode(f>>>10&1023|55296),f=56320|1023&f),i+=String.fromCharCode(f),r+=a}return i}(this.buf,n,t)},readBytes:function(){var t=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,t);return this.pos=t,n},readPackedVarint:function(t,n){if(this.type!==ur.Bytes)return t.push(this.readVarint(n));var e=lr(this);for(t=t||[];this.pos<e;)t.push(this.readVarint(n));return t},readPackedSVarint:function(t){if(this.type!==ur.Bytes)return t.push(this.readSVarint());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==ur.Bytes)return t.push(this.readBoolean());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==ur.Bytes)return t.push(this.readFloat());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==ur.Bytes)return t.push(this.readDouble());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==ur.Bytes)return t.push(this.readFixed32());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==ur.Bytes)return t.push(this.readSFixed32());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==ur.Bytes)return t.push(this.readFixed64());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==ur.Bytes)return t.push(this.readSFixed64());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed64());return t},skip:function(t){var n=7&t;if(n===ur.Varint)for(;this.buf[this.pos++]>127;);else if(n===ur.Bytes)this.pos=this.readVarint()+this.pos;else if(n===ur.Fixed32)this.pos+=4;else{if(n!==ur.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(t,n){this.writeVarint(t<<3|n)},realloc:function(t){for(var n=this.length||16;n<this.pos+t;)n*=2;if(n!==this.length){var e=new Uint8Array(n);e.set(this.buf),this.buf=e,this.length=n}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Sr(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Sr(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Sr(this.buf,-1&t,this.pos),Sr(this.buf,Math.floor(t*fr),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Sr(this.buf,-1&t,this.pos),Sr(this.buf,Math.floor(t*fr),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,n){var e,i;t>=0?(e=t%4294967296|0,i=t/4294967296|0):(i=~(-t/4294967296),4294967295^(e=~(-t%4294967296))?e=e+1|0:(e=0,i=i+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");n.realloc(10),function(t,n,e){e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos]=127&t}(e,0,n),function(t,n){var e=(7&t)<<4;if(n.buf[n.pos++]|=e|((t>>>=3)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;n.buf[n.pos++]=127&t}(i,n)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var n=this.pos;this.pos=function(t,n,e){for(var i,r,o=0;o<n.length;o++){if((i=n.charCodeAt(o))>55295&&i<57344){if(!r){i>56319||o+1===n.length?(t[e++]=239,t[e++]=191,t[e++]=189):r=i;continue}if(i<56320){t[e++]=239,t[e++]=191,t[e++]=189,r=i;continue}i=r-55296<<10|i-56320|65536,r=null}else r&&(t[e++]=239,t[e++]=191,t[e++]=189,r=null);i<128?t[e++]=i:(i<2048?t[e++]=i>>6|192:(i<65536?t[e++]=i>>12|224:(t[e++]=i>>18|240,t[e++]=i>>12&63|128),t[e++]=i>>6&63|128),t[e++]=63&i|128)}return e}(this.buf,t,this.pos);var e=this.pos-n;e>=128&&dr(n,e,this),this.pos=n-1,this.writeVarint(e),this.pos+=e},writeFloat:function(t){this.realloc(4),sr.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),sr.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var n=t.length;this.writeVarint(n),this.realloc(n);for(var e=0;e<n;e++)this.buf[this.pos++]=t[e]},writeRawMessage:function(t,n){this.pos++;var e=this.pos;t(n,this);var i=this.pos-e;i>=128&&dr(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeMessage:function(t,n,e){this.writeTag(t,ur.Bytes),this.writeRawMessage(n,e)},writePackedVarint:function(t,n){n.length&&this.writeMessage(t,vr,n)},writePackedSVarint:function(t,n){n.length&&this.writeMessage(t,yr,n)},writePackedBoolean:function(t,n){n.length&&this.writeMessage(t,wr,n)},writePackedFloat:function(t,n){n.length&&this.writeMessage(t,pr,n)},writePackedDouble:function(t,n){n.length&&this.writeMessage(t,Mr,n)},writePackedFixed32:function(t,n){n.length&&this.writeMessage(t,mr,n)},writePackedSFixed32:function(t,n){n.length&&this.writeMessage(t,gr,n)},writePackedFixed64:function(t,n){n.length&&this.writeMessage(t,Pr,n)},writePackedSFixed64:function(t,n){n.length&&this.writeMessage(t,xr,n)},writeBytesField:function(t,n){this.writeTag(t,ur.Bytes),this.writeBytes(n)},writeFixed32Field:function(t,n){this.writeTag(t,ur.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(t,n){this.writeTag(t,ur.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(t,n){this.writeTag(t,ur.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(t,n){this.writeTag(t,ur.Fixed64),this.writeSFixed64(n)},writeVarintField:function(t,n){this.writeTag(t,ur.Varint),this.writeVarint(n)},writeSVarintField:function(t,n){this.writeTag(t,ur.Varint),this.writeSVarint(n)},writeStringField:function(t,n){this.writeTag(t,ur.Bytes),this.writeString(n)},writeFloatField:function(t,n){this.writeTag(t,ur.Fixed32),this.writeFloat(n)},writeDoubleField:function(t,n){this.writeTag(t,ur.Fixed64),this.writeDouble(n)},writeBooleanField:function(t,n){this.writeVarintField(t,Boolean(n))}};var Ar=Ft(or),kr=Tr;function Tr(t,n){this.x=t,this.y=n}Tr.prototype={clone:function(){return new Tr(this.x,this.y)},add:function(t){return this.clone().K(t)},sub:function(t){return this.clone().tt(t)},multByPoint:function(t){return this.clone().nt(t)},divByPoint:function(t){return this.clone().et(t)},mult:function(t){return this.clone().it(t)},div:function(t){return this.clone().rt(t)},rotate:function(t){return this.clone().ot(t)},rotateAround:function(t,n){return this.clone().st(t,n)},matMult:function(t){return this.clone().ut(t)},unit:function(){return this.clone().ct()},perp:function(){return this.clone().ft()},round:function(){return this.clone().lt()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var n=t.x-this.x,e=t.y-this.y;return n*n+e*e},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},ut:function(t){var n=t[0]*this.x+t[1]*this.y,e=t[2]*this.x+t[3]*this.y;return this.x=n,this.y=e,this},K:function(t){return this.x+=t.x,this.y+=t.y,this},tt:function(t){return this.x-=t.x,this.y-=t.y,this},it:function(t){return this.x*=t,this.y*=t,this},rt:function(t){return this.x/=t,this.y/=t,this},nt:function(t){return this.x*=t.x,this.y*=t.y,this},et:function(t){return this.x/=t.x,this.y/=t.y,this},ct:function(){return this.rt(this.mag()),this},ft:function(){var t=this.y;return this.y=this.x,this.x=-t,this},ot:function(t){var n=Math.cos(t),e=Math.sin(t),i=n*this.x-e*this.y,r=e*this.x+n*this.y;return this.x=i,this.y=r,this},st:function(t,n){var e=Math.cos(t),i=Math.sin(t),r=n.x+e*(this.x-n.x)-i*(this.y-n.y),o=n.y+i*(this.x-n.x)+e*(this.y-n.y);return this.x=r,this.y=o,this},lt:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Tr.convert=function(t){return t instanceof Tr?t:Array.isArray(t)?new Tr(t[0],t[1]):t};var _r=kr,Ir=Or;function Or(t,n,e,i,r){this.properties={},this.extent=e,this.type=0,this.ht=t,this.dt=-1,this.vt=i,this.yt=r,t.readFields(Nr,this,n)}function Nr(t,n,e){1==t?n.id=e.readVarint():2==t?function(t,n){var e=t.readVarint()+t.pos;for(;t.pos<e;){var i=n.vt[t.readVarint()],r=n.yt[t.readVarint()];n.properties[i]=r}}(e,n):3==t?n.type=e.readVarint():4==t&&(n.dt=e.pos)}function Cr(t){for(var n,e,i=0,r=0,o=t.length,s=o-1;r<o;s=r++)n=t[r],i+=((e=t[s]).x-n.x)*(n.y+e.y);return i}Or.types=["Unknown","Point","LineString","Polygon"],Or.prototype.loadGeometry=function(){var t=this.ht;t.pos=this.dt;for(var n,e=t.readVarint()+t.pos,i=1,r=0,o=0,s=0,u=[];t.pos<e;){if(r<=0){var c=t.readVarint();i=7&c,r=c>>3}if(r--,1===i||2===i)o+=t.readSVarint(),s+=t.readSVarint(),1===i&&(n&&u.push(n),n=[]),n.push(new _r(o,s));else{if(7!==i)throw new Error("unknown command "+i);n&&n.push(n[0].clone())}}return n&&u.push(n),u},Or.prototype.bbox=function(){var t=this.ht;t.pos=this.dt;for(var n=t.readVarint()+t.pos,e=1,i=0,r=0,o=0,s=1/0,u=-1/0,c=1/0,f=-1/0;t.pos<n;){if(i<=0){var a=t.readVarint();e=7&a,i=a>>3}if(i--,1===e||2===e)(r+=t.readSVarint())<s&&(s=r),r>u&&(u=r),(o+=t.readSVarint())<c&&(c=o),o>f&&(f=o);else if(7!==e)throw new Error("unknown command "+e)}return[s,c,u,f]},Or.prototype.toGeoJSON=function(t,n,e){var i,r,o=this.extent*Math.pow(2,e),s=this.extent*t,u=this.extent*n,c=this.loadGeometry(),f=Or.types[this.type];function a(t){for(var n=0;n<t.length;n++){var e=t[n],i=180-360*(e.y+u)/o;t[n]=[360*(e.x+s)/o-180,360/Math.PI*Math.atan(Math.exp(i*Math.PI/180))-90]}}switch(this.type){case 1:var l=[];for(i=0;i<c.length;i++)l[i]=c[i][0];a(c=l);break;case 2:for(i=0;i<c.length;i++)a(c[i]);break;case 3:for(c=function(t){var n=t.length;if(n<=1)return[t];for(var e,i,r=[],o=0;o<n;o++){var s=Cr(t[o]);0!==s&&(void 0===i&&(i=s<0),i===s<0?(e&&r.push(e),e=[t[o]]):e.push(t[o]))}e&&r.push(e);return r}(c),i=0;i<c.length;i++)for(r=0;r<c[i].length;r++)a(c[i][r])}1===c.length?c=c[0]:f="Multi"+f;var h={type:"Feature",geometry:{type:f,coordinates:c},properties:this.properties};return"id"in this&&(h.id=this.id),h};var Lr=Ir,Er=Ur;function Ur(t,n){this.version=1,this.name=null,this.extent=4096,this.length=0,this.ht=t,this.vt=[],this.yt=[],this.Mt=[],t.readFields($r,this,n),this.length=this.Mt.length}function $r(t,n,e){15===t?n.version=e.readVarint():1===t?n.name=e.readString():5===t?n.extent=e.readVarint():2===t?n.Mt.push(e.pos):3===t?n.vt.push(e.readString()):4===t&&n.yt.push(function(t){var n=null,e=t.readVarint()+t.pos;for(;t.pos<e;){var i=t.readVarint()>>3;n=1===i?t.readString():2===i?t.readFloat():3===i?t.readDouble():4===i?t.readVarint64():5===i?t.readVarint():6===i?t.readSVarint():7===i?t.readBoolean():null}return n}(e))}Ur.prototype.feature=function(t){if(t<0||t>=this.Mt.length)throw new Error("feature index out of bounds");this.ht.pos=this.Mt[t];var n=this.ht.readVarint()+this.ht.pos;return new Lr(this.ht,n,this.extent,this.vt,this.yt)};var jr=Er,Br=function(t,n){this.layers=t.readFields(Vr,{},n)};function Vr(t,n,e){if(3===t){var i=new jr(e,e.readVarint()+e.pos);i.length&&(n[i.name]=i)}}var Gr=Br;const Dr=2;class Xr extends Ie{constructor(t,n,e,i,r,o){super(t,n,e,i,r),n=n||{},o()}getTileFeatures(t,n){const e=t.tileInfo.url,i=t.fetchOptions||{},{altitudePropertyName:r,disableAltitudeWarning:o}=t,s=this.M.get(e);if(s&&s.cacheIndex===t.workerCacheIndex){const{err:t,data:i}=s;return setTimeout((()=>{this.wt(e,t,i,n)}),1)}const{tileArrayBuffer:u}=t;return u?setTimeout((()=>{this.wt(e,r,o,null,u,n)}),1):(i.referrer=t.referrer,I.getArrayBuffer(e,i,((i,s)=>{this.M&&(i?i.loading||this.M.add(e,{err:i,data:s&&s.data,cacheIndex:t.workerCacheIndex}):s&&s.data&&this.M.add(e,{err:null,data:s.data,cacheIndex:t.workerCacheIndex}),this.wt(e,r,o,i,s&&s.data,n))})))}wt(t,n,e,i,r,o){if(i)return void o(i);let s;try{s=new Gr(new Ar(r))}catch(i){return void o(i.message,[],[])}const u=[];if(!s.layers)return void o(null,u,[]);const c={};let f;for(const t in s.layers)if(a=s.layers,l=t,Object.prototype.hasOwnProperty.call(a,l)){c[t]={types:{}};const r=c[t].types;for(let o=0,c=s.layers[t].length;o<c;o++)try{f=s.layers[t].feature(o),r[f.type]=1;const i={type:f.type,layer:t,geometry:f.loadGeometry(),properties:f.properties,extent:f.extent};void 0!==f.id&&(i.id=f.id);let c=i.properties[nn];c&&(b(c)&&(c=JSON.parse(c)),i.properties[nn]=tr(c,"EPSG:3857")),console.log(i.properties);const a=n&&i.properties[n];if(a){const t=zr(a),n=[];Jr(i.geometry,t,n),n.length&&!e&&(console.warn("feature.geometry is not consistent with altitude values:"),console.warn(JSON.stringify(i,null,2)))}u.push(i)}catch(i){console.warn("error when load vt geometry:",i)}}var a,l;for(const t in c)c[t].types=Object.keys(c[t].types).map((t=>+t));o(null,u,c,{byteLength:r.byteLength})}abortTile(t,n){const e=this.requests[t];delete this.requests[t],e&&e.abort&&e.abort(),this.A(t),n()}onRemove(){super.onRemove();for(const t in this.requests){const n=this.requests[t];n&&n.abort&&n.abort()}this.requests={}}}function zr(t){const n=atob(t),e=new Uint8Array(n.length);for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return new Float32Array(e.buffer)}function Jr(t,n,e,i){i||(i={index:0});for(let r=0;r<t.length;r++)if(Array.isArray(t[r]))Jr(t[r],n,e,i);else{const o=i.index;k(n[o])?e.push(Dr):t[r].z=100*n[o],i.index++}}const{LRUCache:Yr}=en();let qr=0;const Rr=new Yr(128);class Hr{constructor(t){this.gt={},this.Pt={},this.workerId=t}addLayer({actorId:t,mapId:n,layerId:e,params:i},r){if(this.xt(n,e))return;const o=this.bt(n,e),s=i.type,u=i.options,c=this.send.bind(this,t);this.gt[o]="GeoJSONVectorTileLayer"===s?new er(e,u,c,Rr,{},r):new Xr(e,u,c,Rr,{},r)}removeLayer({mapId:t,layerId:n},e){const i=this.xt(t,n),r=this.bt(t,n);delete this.gt[r],i&&i.onRemove(e)}loadTile({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.loadTile(e,i)}abortTile({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.abortTile&&r.abortTile(e.url,i)}removeTile({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.removeTile(e,i)}updateStyle({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.updateStyle(e,i)}updateOptions({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.updateOptions(e,i)}setData({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.setData(e.data,i)}receive(t){const n=t.callback,e=this.Pt[n];delete this.Pt[n],e&&t.error?e(new Error(t.error)):e&&e(null,t.data)}send(t,n,e,i,r){const o=r?\`${o}t}-${o}qr++}\`:null;r&&(this.Pt[o]=r),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:n,params:e,callback:String(o)},i||[])}bt(t,n){return\`${o}t}-${o}n}\`}xt(t,n){const e=this.bt(t,n);return this.gt[e]}St(){Rr.reset()}}t.initialize=function(){},t.onmessage=function(t,n){const e=t.data;if(this.dispatcher||(this.dispatcher=new Hr(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const i=e.command;this.dispatcher[i]({actorId:t.actorId,mapId:e.mapId,layerId:e.layerId,params:e.params},((t,e,r)=>{t&&404!==t.status&&204!==t.status&&!t.loading&&console.error(i,t),n(t,e,r)}))}}}`;
|
|
24
|
+
const o = "${", a = `function(t){let n;const e={width:100,height:10};let i=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),i=!0}catch(t){i=!1}function r(){if(!n){const{width:t,height:r}=e;i?n=new OffscreenCanvas(t,r):(n=document.createElement("canvas"),n.width=t,n.height=r)}return n}class o{constructor(t,n={}){if(!Array.isArray(t))return void console.error("colors is not array");if(t.length<2)return void console.error("colors.length should >1");this.colors=t;let i=1/0,r=-1/0;for(let n=0,e=t.length;n<e;n++){const e=t[n][0];i=Math.min(e,i),r=Math.max(e,r)}this.min=i,this.max=r,this.valueOffset=this.max-this.min,this.options=Object.assign({},e,n),this.t()}getImageData(){return this.imgData}t(){const t=r(),{width:n,height:e}=this.options;t.width=n,t.height=e;const i=t.getContext("2d");i.clearRect(0,0,t.width,t.height);const o=i.createLinearGradient(0,0,t.width,0),{colors:s,valueOffset:u}=this;for(let t=0,n=s.length;t<n;t++){const[n,e]=s[t],i=(n-this.min)/u;o.addColorStop(i,e)}i.fillStyle=o,i.fillRect(0,0,t.width,t.height),this.imgData=i.getImageData(0,0,t.width,t.height)}getColor(t){t=Math.max(this.min,t);const n=((t=Math.min(t,this.max))-this.min)/this.valueOffset;let e=Math.round(n*this.imgData.width);e=Math.min(e,this.imgData.width-1);const i=4*e;return[this.imgData.data[i],this.imgData.data[i+1],this.imgData.data[i+2],this.imgData.data[i+3]]}}var s;function u(t,n){var e,i,r;if(M(t)){var o,s=t.stops&&"object"==typeof t.stops[0][0],l=s||void 0!==t.property,y=s||!l,p=t.type||n||"exponential";if("exponential"===p)o=a;else if("interval"===p)o=f;else if("categorical"===p)o=c;else if("identity"===p)o=d;else if("color-interpolate"===p)o=h;else{if("calculate-expression"!==p)throw new Error('Unknown function type "'+p+'"');o=v}if(s){var w={},m=[];for(let n=0;n<t.stops.length;n++){var g=t.stops[n];void 0===w[g[0].zoom]&&(w[g[0].zoom]={zoom:g[0].zoom,type:t.type,property:t.property,default:t.default,stops:[]}),w[g[0].zoom].stops.push([g[0].value,g[1]])}for(let t in w)m.push([w[t].zoom,u(w[t])]);e=function(n,e){const i=a({stops:m,base:t.base},n)(n,e);return"function"==typeof i?i(n,e):i},i=!1,r=!1}else y?(e=function(n){const e=o(t,n);return"function"==typeof e?e(n):e},i=!0,r=!1):(e=function(n,e){const i=o(t,e?e[t.property]:null);return"function"==typeof i?i(n,e):i},i=!1,r=!0)}else e=function(){return t},i=!0,r=!0;return e.isZoomConstant=r,e.isFeatureConstant=i,e}function c(t,n){for(let e=0;e<t.stops.length;e++)if(n===t.stops[e][0])return t.stops[e][1];return t.default}function f(t,n){for(var e=0;e<t.stops.length&&!(n<t.stops[e][0]);e++);return t.stops[Math.max(e-1,0)][1]}function a(t,n){for(var e=void 0!==t.base?t.base:1,i=0;!(i>=t.stops.length||n<=t.stops[i][0]);)i++;return 0===i?t.stops[i][1]:i===t.stops.length?t.stops[i-1][1]:y(n,e,t.stops[i-1][0],t.stops[i][0],t.stops[i-1][1],t.stops[i][1])}"function"==typeof Map&&(s=new Map);const l={width:100,height:1};function h(t,n){const e=t.stops;if(e&&e.length>1){let t;if(s){const n=JSON.stringify(e);if(!s.has(n)){const t=new o(e,l);s.set(n,t)}t=s.get(n)}else t=new o(e,l);const[i,r,u,c]=t.getColor(n);return[i/255,r/255,u/255,c/255]}return e&&1===e.length?e[0][1]:null}function d(t,n){return e=n,i=t.default,void 0!==e?e:void 0!==i?i:null;var e,i}function v(t,n){const e=String(t.property),i=t.expression,r=n;function o(n){return null==n||""===n||isNaN(n)?t.default:n}if(null==n||""===n||isNaN(n)||n<0)return o(t.default);{const n=function t(n,e,i){const r=Number(i),o=String(e);return Array.isArray(n)?n.map((n=>t(n,o,r))):n===o?r:n}(i,e,r);return o(function n(e){if(!Array.isArray(e)){if("number"==typeof e)return e;throw new Error("Invalid expression format")}{const i=e[0];if(!["+","-","*","/"].includes(i))throw new Error(\`Unknown operator: ${o}i}\`);const r=e.slice(1).map((t=>n(t)));switch(i){case"+":return r.reduce(((t,n)=>t+n),0);case"-":return r.reduce(((t,n)=>t-n));case"*":return r.reduce(((t,n)=>t*n),1);case"/":return r.some((t=>0===t))?t.default:r.reduce(((t,n)=>t/n));default:throw new Error(\`Unsupported operator: ${o}i}\`)}}}(n))}}function y(t,n,e,i,r,o){return"function"==typeof r?function(){var s=r.apply(void 0,arguments),u=o.apply(void 0,arguments);return y(t,n,e,i,s,u)}:r.length?function(t,n,e,i,r,o){var s=[];for(let u=0;u<r.length;u++)s[u]=p(t,n,e,i,r[u],o[u]);return s}(t,n,e,i,r,o):p(t,n,e,i,r,o)}function p(t,n,e,i,r,o){var s,u=i-e,c=t-e;return r*(1-(s=1===n?c/u:(Math.pow(n,c)-1)/(Math.pow(n,u)-1)))+o*s}function M(t){return t&&"object"==typeof t&&(t.stops||t.property&&"identity"===t.type||t.expression&&"calculate-expression"===t.type)}function w(t){return m(t,"interval")}function m(t,n){if(!M(t))return function(){return t};let e=!0,i=!0;const r=(t=JSON.parse(JSON.stringify(t))).stops;if(r)for(let t=0;t<r.length;t++)if(M(r[t][1])){const o=m(r[t][1],n);e=e&&o.isZoomConstant,i=i&&o.isFeatureConstant,r[t]=[r[t][0],o]}const o=u(t,n);return o.isZoomConstant=e&&o.isZoomConstant,o.isFeatureConstant=i&&o.isFeatureConstant,o}let g=0;const P="function"==typeof Object.assign;function x(t,...n){if(P)return Object.assign(t,...n),t;for(let e=0;e<n.length;e++){const i=n[e];for(const n in i)t[n]=i[n]}return t}function b(t){return!k(t)&&("string"==typeof t||null!==t.constructor&&t.constructor===String)}function S(t){return"number"==typeof t&&!isNaN(t)}function F(t){return!k(t)&&("function"==typeof t||null!==t.constructor&&t.constructor===Function)}function A(t){return!Array.isArray(t)&&"object"==typeof t&&!!t}function k(t){return null==t}function T(t){return M(t)&&t.property}const _="function"==typeof fetch&&"function"==typeof AbortController,I={jsonp:function(t,n){const e="_maptalks_jsonp_"+g++;t.match(/\\?/)?t+="&callback="+e:t+="?callback="+e;let i=document.createElement("script");return i.type="text/javascript",i.src=t,window[e]=function(t){n(null,t),document.getElementsByTagName("head")[0].removeChild(i),i=null,delete window[e]},document.getElementsByTagName("head")[0].appendChild(i),this},get:function(t,n,e){if(F(n)){const t=e;e=n,n=t}(n=n||{}).method&&(n.method=n.method.toUpperCase());const i="POST"===n.method;if(_){const i=new AbortController,r=n;r.signal=i.signal,r.referrerPolicy=r.referrerPolicy||"origin",r.method=r.method||"GET";const o=new Request(t,r);return n.returnJSON&&o.headers.set("Accept","application/json"),fetch(o).then((i=>{const r=this.o(i,n.returnJSON,n.responseType);r.message?(r.url=t,e(r)):r.then((t=>{"arraybuffer"===n.responseType?e(null,{data:t,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),contentType:i.headers.get("Content-Type")}):e(null,t)})).catch((n=>{n.code&&n.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,n),e(n))}))})).catch((n=>{n.code&&n.code===DOMException.ABORT_ERR||(console.error("Fetch error:",t,n),e(n))})),i}{const r=I.u(e);if(r.open(n.method||"GET",t,!0),n){for(const t in n.headers)r.setRequestHeader(t,n.headers[t]);r.withCredentials="include"===n.credentials,n.responseType&&(r.responseType=n.responseType)}return r.send(i?n.body:null),r}},o:(t,n,e)=>200!==t.status?{status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${o}t.status}): ${o}t.statusText}\`}:"arraybuffer"===e?t.arrayBuffer():n?t.json():t.text(),l:function(t,n){return function(){if(4===t.readyState)if(200===t.status)if("arraybuffer"===t.responseType){0===t.response.byteLength?n({status:200,statusText:t.statusText,message:"http status 200 returned without content."}):n(null,{data:t.response,cacheControl:t.getResponseHeader("Cache-Control"),expires:t.getResponseHeader("Expires"),contentType:t.getResponseHeader("Content-Type")})}else n(null,t.responseText);else n({status:t.status,statusText:t.statusText,message:\`incorrect http request with status code(${o}t.status}): ${o}t.statusText}\`})}},u:function(t){let n;try{n=new XMLHttpRequest}catch(t){try{n=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{n=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}}return n.onreadystatechange=I.l(n,t),n},getArrayBuffer(t,n,e){if(F(n)){const t=e;e=n,n=t}return n||(n={}),n.responseType="arraybuffer",I.get(t,n,e)}};function O(t,n,e,i,r=3){let o=i;const s=e-n>>1;let u,c=e-n;const f=t[n],a=t[n+1],l=t[e],h=t[e+1];for(let i=n+r;i<e;i+=r){const n=N(t[i],t[i+1],f,a,l,h);if(n>o)u=i,o=n;else if(n===o){const t=Math.abs(i-s);t<c&&(u=i,c=t)}}o>i&&(u-n>r&&O(t,n,u,i,r),t[u+2]=o,e-u>r&&O(t,u,e,i,r))}function N(t,n,e,i,r,o){let s=r-e,u=o-i;if(0!==s||0!==u){const c=((t-e)*s+(n-i)*u)/(s*s+u*u);c>1?(e=r,i=o):c>0&&(e+=s*c,i+=u*c)}return s=t-e,u=n-i,s*s+u*u}function C(t,n,e,i,r,o){const s={id:null==t?null:t,type:n,geometry:e,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};r&&(s.layer=r);return function(t,n){const e=t.geometry,i=t.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)L(t,e,n);else if("Polygon"===i)L(t,e[0],n);else if("MultiLineString"===i)for(const i of e)L(t,i,n);else if("MultiPolygon"===i)for(const i of e)L(t,i[0],n)}(s,o?4:3),s}function L(t,n,e){for(let i=0;i<n.length;i+=e)t.minX=Math.min(t.minX,n[i]),t.minY=Math.min(t.minY,n[i+1]),t.maxX=Math.max(t.maxX,n[i]),t.maxY=Math.max(t.maxY,n[i+1])}function E(t,n,e,i){if(i.layer=n,"FeatureCollection"===e.type)for(let n=0;n<e.features.length;n++)U(t,e.features[n],i,n);else"Feature"===e.type?U(t,e,i):U(t,{geometry:e},i)}function U(t,n,e,i){if(!n.geometry)return;const r=n.geometry.coordinates,o=n.geometry.type,s=Math.pow(e.tolerance/((1<<e.maxZoom)*e.extent),2);let u=[],c=n.id;if(e.promoteId?c=n.properties[e.promoteId]:e.generateId&&(c=i||0),"Point"===o)$(r,u,e);else if("MultiPoint"===o)for(const t of r)$(t,u,e);else if("LineString"===o)j(r,u,s,!1,e);else if("MultiLineString"===o){if(e.lineMetrics){for(const i of r)u=[],j(i,u,s,!1,e),t.push(C(c,"LineString",u,n.properties,e.layer,e.hasAltitude));return}B(r,u,s,!1,e)}else if("Polygon"===o)B(r,u,s,!0,e);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const r of n.geometry.geometries)U(t,{id:c,geometry:r,properties:n.properties},e,i);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const t of r){const n=[];B(t,n,s,!0,e),u.push(n)}}t.push(C(c,o,u,n.properties,e.layer,e.hasAltitude))}function $(t,n,e){n.push(V(t[0]),G(t[1],e.projection),0),e.hasAltitude&&(t.length>2?n.push(t[2]):n.push(0))}function j(t,n,e,i,r){let o,s,u=0;for(let e=0;e<t.length;e++){const c=V(t[e][0]),f=G(t[e][1],r.projection);n.push(c,f,0),r.hasAltitude&&(t[e].length>2?n.push(t[e][2]):n.push(0)),e>0&&(u+=i?(o*f-c*s)/2:Math.sqrt(Math.pow(c-o,2)+Math.pow(f-s,2))),o=c,s=f}const c=r.hasAltitude?4:3,f=n.length-c;n[2]=1,O(n,0,f,e,c),n[f+2]=1,n.size=Math.abs(u),n.start=0,n.end=n.size}function B(t,n,e,i,r){for(let o=0;o<t.length;o++){const s=[];j(t[o],s,e,i,r),n.push(s)}}function V(t){return t/360+.5}function G(t,n){if("EPSG:4326"===n)return(90-t)/360;const e=Math.sin(t*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function D(t,n,e,i,r,o,s,u){if(i/=n,o>=(e/=n)&&s<i)return t;if(s<e||o>=i)return null;const c=[];for(const n of t){const t=n.geometry;let o=n.type;const s=0===r?n.minX:n.minY,f=0===r?n.maxX:n.maxY;if(s>=e&&f<i){c.push(n);continue}if(f<e||s>=i)continue;let a=[];if("Point"===o||"MultiPoint"===o)X(t,a,e,i,r,u.hasAltitude);else if("LineString"===o)z(t,a,e,i,r,!1,u.lineMetrics,u.hasAltitude);else if("MultiLineString"===o)Y(t,a,e,i,r,!1,u.hasAltitude);else if("Polygon"===o)Y(t,a,e,i,r,!0,u.hasAltitude);else if("MultiPolygon"===o)for(const n of t){const t=[];Y(n,t,e,i,r,!0,u.hasAltitude),t.length&&a.push(t)}if(a.length){if(u.lineMetrics&&"LineString"===o){for(const t of a)c.push(C(n.id,o,t,n.tags,n.layer,u.hasAltitude));continue}"LineString"!==o&&"MultiLineString"!==o||(1===a.length?(o="LineString",a=a[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===a.length?"Point":"MultiPoint"),c.push(C(n.id,o,a,n.tags,n.layer,u.hasAltitude))}}return c.length?c:null}function X(t,n,e,i,r,o){const s=o?4:3;for(let u=0;u<t.length;u+=s){const s=t[u+r];s>=e&&s<=i&&(q(n,t[u],t[u+1],t[u+2]),o&&n.push(t[u+3]))}}function z(t,n,e,i,r,o,s,u){let c=J(t);const f=0===r?R:H;let a,l,h=t.start;const d=u?4:3,v=o?t.length:t.length-d;for(let y=0;y<v;y+=d){const p=t[y],M=t[y+1],w=t[y+2];let m,g,P,x;o&&y===v-d?(m=t[0],g=t[1]):(m=t[y+d],g=t[y+d+1]),u&&(P=t[y+3],x=o&&y===v-d?t[3]:t[y+d+3]);const b=0===r?p:M,S=0===r?m:g;let F=!1;s&&(a=Math.sqrt(Math.pow(p-m,2)+Math.pow(M-g,2))),b<e?S>e&&(l=f(c,p,M,m,g,e),u&&c.push(Z(P,x,l)),s&&(c.start=h+a*l)):b>i?S<i&&(l=f(c,p,M,m,g,i),u&&c.push(Z(P,x,l)),s&&(c.start=h+a*l)):(q(c,p,M,w),u&&c.push(P)),S<e&&b>=e&&(l=f(c,p,M,m,g,e),u&&c.push(Z(P,x,l)),F=!0),S>i&&b<=i&&(l=f(c,p,M,m,g,i),u&&c.push(Z(P,x,l)),F=!0),!o&&F&&(s&&(c.end=h+a*l),n.push(c),c=J(t)),s&&(h+=a)}let y=t.length-d;if(!o){const n=t[y],o=t[y+1],s=t[y+2],f=0===r?n:o;if(f>=e&&f<=i&&q(c,n,o,s),f>=e&&f<=i&&u){const n=t[y+3];c.push(n)}}y=c.length-d,o&&y>=d&&(c[y]!==c[0]||c[y+1]!==c[1])&&(q(c,c[0],c[1],c[2]),u&&c.push(c[3])),c.length&&n.push(c)}function J(t){const n=[];return n.size=t.size,n.start=t.start,n.end=t.end,n}function Y(t,n,e,i,r,o,s){for(const u of t)z(u,n,e,i,r,o,!1,s)}function q(t,n,e,i){t.push(n,e,i)}function R(t,n,e,i,r,o){const s=(o-n)/(i-n);return q(t,o,e+(r-e)*s,1),s}function H(t,n,e,i,r,o){const s=(o-e)/(r-e);return q(t,n+(i-n)*s,o,1),s}function Z(t,n,e){return t+(n-t)*e}function W(t,n,e){const i=[];for(let r=0;r<t.length;r++){const o=t[r],s=o.type;let u;if("Point"===s||"MultiPoint"===s||"LineString"===s)u=K(o.geometry,n,e);else if("MultiLineString"===s||"Polygon"===s){u=[];for(const t of o.geometry)u.push(K(t,n,e))}else if("MultiPolygon"===s){u=[];for(const t of o.geometry){const i=[];for(const r of t)i.push(K(r,n,e));u.push(i)}}i.push(C(o.id,s,u,o.tags,o.layer,e))}return i}function K(t,n,e){const i=[];i.size=t.size,void 0!==t.start&&(i.start=t.start,i.end=t.end);const r=e?4:3;for(let o=0;o<t.length;o+=r)i.push(t[o]+n,t[o+1],t[o+2]),e&&i.push(t[o+3]);return i}function Q(t,n,e){if(t.transformed)return t;const i=1<<t.z,r=t.x,o=t.y,s=e?3:2;for(const u of t.features){const t=u.geometry,c=u.type;if(u.geometry=[],1===c)for(let c=0;c<t.length;c+=s)u.geometry.push(tt(t[c],t[c+1],n,i,r,o)),e&&u.geometry[u.geometry.length-1].push(t[c+2]);else for(let c=0;c<t.length;c++){const f=[];for(let u=0;u<t[c].length;u+=s)f.push(tt(t[c][u],t[c][u+1],n,i,r,o)),e&&f[f.length-1].push(t[c][u+2]);u.geometry.push(f)}}return t.transformed=!0,t}function tt(t,n,e,i,r,o){return[Math.round(e*(t*i-r)),Math.round(e*(n*i-o))]}function nt(t,n,e,i,r){const o=n===r.maxZoom?0:r.tolerance/((1<<n)*r.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:t.length,source:null,x:e,y:i,z:n,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const n of t)et(s,n,o,r);return s}function et(t,n,e,i){const r=n.geometry,o=n.type,s=[],u=i.hasAltitude?4:3;if(t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),"Point"===o||"MultiPoint"===o)for(let n=0;n<r.length;n+=u)s.push(r[n],r[n+1]),i.hasAltitude&&s.push(r[n+3]),t.numPoints++,t.numSimplified++;else if("LineString"===o)rt(s,r,t,e,!1,!1,i);else if("MultiLineString"===o||"Polygon"===o)for(let n=0;n<r.length;n++)rt(s,r[n],t,e,"Polygon"===o,0===n,i);else if("MultiPolygon"===o)for(let n=0;n<r.length;n++){const o=r[n];for(let n=0;n<o.length;n++)rt(s,o[n],t,e,!0,0===n,i)}if(s.length){let e=n.tags||null;if("LineString"===o&&i.lineMetrics){e={};for(const t in n.tags)e[t]=n.tags[t];e.mapbox_clip_start=r.start/r.size,e.mapbox_clip_end=r.end/r.size}const u={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:e};n.layer&&(u.layer=n.layer),null!==n.id&&(u.id=n.id),t.features.push(u)}}function it(t,n,e){return 0===t[n+2]&&t[n+3]>0&&e}function rt(t,n,e,i,r,o,s){const u=i*i,{hasAltitude:c,disableFilter:f}=s,a=c?4:3;if(!f&&i>0&&n.size<(r?u:i))return void(e.numPoints+=n.length/a);const l=[];for(let t=0;t<n.length;t+=a)(0===i||n[t+2]>u||it(n,t,c))&&(e.numSimplified++,l.push(n[t],n[t+1]),c&&l.push(n[t+3])),e.numPoints++;r&&function(t,n,e){const i=e?3:2;let r=0;for(let n=0,e=t.length,o=e-i;n<e;o=n,n+=i)r+=(t[n]-t[o])*(t[n+1]+t[o+1]);if(r>0===n){const n=i,r=i-1,o=i-2;for(let s=0,u=t.length;s<u/2;s+=i){const i=t[s],c=t[s+1];let f;e&&(f=t[s+2]),t[s]=t[u-n-s],t[s+1]=t[u-r-s],e&&(t[s+2]=t[u-o-s]),t[u-n-s]=i,t[u-r-s]=c,e&&(t[u-o-s]=f)}}}(l,o,c),t.push(l)}I.getJSON=function(t,n,e){if(F(n)){const t=e;e=n,n=t}const i=function(t,n){const i="string"==typeof n?JSON.parse(n):n||null;e(t,i)};return n&&n.jsonp?I.jsonp(t,i):((n=n||{}).returnJSON=!0,I.get(t,n,i))};const ot={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 st{constructor(t,n){const e=(n=this.options=function(t,n){for(const e in n)t[e]=n[e];return t}(Object.create(ot),n)).debug;if(e&&console.time("preprocess data"),n.maxZoom<0||n.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(n.promoteId&&n.generateId)throw new Error("promoteId and generateId cannot be used together.");let i=function(t,n){const e=[];if(Array.isArray(t)){for(let i=0;i<t.length;i++)E(e,t[i].layer,t[i].data,n);return e}if("FeatureCollection"===t.type)for(let i=0;i<t.features.length;i++)U(e,t.features[i],n,i);else"Feature"===t.type?U(e,t,n):U(e,{geometry:t},n);return e}(t,n);this.tiles={},this.tileCoords=[],e&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",n.indexMaxZoom,n.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=function(t,n){const e=n.buffer/n.extent;let i=t;const r=D(t,1,-1-e,e,0,-1,2,n),o=D(t,1,1-e,2+e,0,-1,2,n);return(r||o)&&(i=D(t,1,-e,1+e,0,-1,2,n)||[],r&&(i=W(r,1,n.hasAltitude).concat(i)),o&&(i=i.concat(W(o,-1,n.hasAltitude)))),i}(i,n),i.length&&this.splitTile(i,0,0,0),e&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(t,n,e,i,r,o,s){const u=[t,n,e,i],c=this.options,f=c.debug;for(;u.length;){i=u.pop(),e=u.pop(),n=u.pop(),t=u.pop();const a=1<<n,l=ut(n,e,i);let h=this.tiles[l];if(!h&&(f>1&&console.time("creation"),h=this.tiles[l]=nt(t,n,e,i,c),this.tileCoords.push({z:n,x:e,y:i}),f)){f>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,e,i,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));const t=\`z${o}n}\`;this.stats[t]=(this.stats[t]||0)+1,this.total++}if(h.source=t,null==r){if(n===c.indexMaxZoom||h.numPoints<=c.indexMaxPoints)continue}else{if(n===c.maxZoom||n===r)continue;if(null!=r){const t=r-n;if(e!==o>>t||i!==s>>t)continue}}if(h.source=null,0===t.length)continue;f>1&&console.time("clipping");const d=.5*c.buffer/c.extent,v=.5-d,y=.5+d,p=1+d;let M=null,w=null,m=null,g=null,P=D(t,a,e-d,e+y,0,h.minX,h.maxX,c),x=D(t,a,e+v,e+p,0,h.minX,h.maxX,c);t=null,P&&(M=D(P,a,i-d,i+y,1,h.minY,h.maxY,c),w=D(P,a,i+v,i+p,1,h.minY,h.maxY,c),P=null),x&&(m=D(x,a,i-d,i+y,1,h.minY,h.maxY,c),g=D(x,a,i+v,i+p,1,h.minY,h.maxY,c),x=null),f>1&&console.timeEnd("clipping"),u.push(M||[],n+1,2*e,2*i),u.push(w||[],n+1,2*e,2*i+1),u.push(m||[],n+1,2*e+1,2*i),u.push(g||[],n+1,2*e+1,2*i+1)}}getTile(t,n,e){t=+t,n=+n,e=+e;const i=this.options,{extent:r,debug:o}=i,{hasAltitude:s,wrapX:u}=i;if(t<0||t>24)return null;if(u){const e=1<<t;n=n+e&e-1}const c=ut(t,n,e);if(this.tiles[c])return Q(this.tiles[c],r,s);o>1&&console.log("drilling down to z%d-%d-%d",t,n,e);let f,a=t,l=n,h=e;for(;!f&&a>0;)a--,l>>=1,h>>=1,f=this.tiles[ut(a,l,h)];return f&&f.source?(o>1&&(console.log("found parent tile z%d-%d-%d",a,l,h),console.time("drilling down")),this.splitTile(f.source,a,l,h,t,n,e),o>1&&console.timeEnd("drilling down"),this.tiles[c]?Q(this.tiles[c],r,s):null):null}}function ut(t,n,e){return 32*((1<<t)*e+n)+t}function ct(t,n,e,i,r,o,s){const u=e&&Array.isArray(e[0]);for(let c=0,f=e.length;c<f;c++){t[n]=(u?e[c][0]:e[c].x)*i,t[n+1]=(u?e[c][1]:e[c].y)*i,s!==Float32Array&&(t[n]=Math.round(t[n]),t[n+1]=Math.round(t[n+1]));let a=r||0;Array.isArray(r)&&(a=r[c]),a=a?Math.round(i*a):0,t[n+2]=a,n+=3,o&&0!==c&&c!==f-1&&(t[n]=t[n-3],t[n+1]=t[n-2],t[n+2]=t[n-1],n+=3)}return t.trySetLength&&t.trySetLength(n),n}function ft(t,n,e,i){const r=t[3*n],o=t[3*n+1],s=t[3*e],u=t[3*e+1];return r===s&&(r<0||r>i)||o===u&&(o<0||o>i)}var at="undefined"!=typeof Float32Array?Float32Array:Array;function lt(t,n,e,i){return t[0]=n,t[1]=e,t[2]=i,t}function ht(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function dt(t,n,e,i,r){return t[0]=n,t[1]=e,t[2]=i,t[3]=r,t}function vt(t,n,e){return t[0]=n[0]/e[0],t[1]=n[1]/e[1],t[2]=n[2]/e[2],t[3]=n[3]/e[3],t}function yt(t,n,e){return t[0]=n,t[1]=e,t}function pt(t,n){var e=n[0]-t[0],i=n[1]-t[1];return Math.hypot(e,i)}Math.hypot||(Math.hypot=function(){for(var t=0,n=arguments.length;n--;)t+=arguments[n]*arguments[n];return Math.sqrt(t)}),function(){var t,n=(t=new at(3),at!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t)}(),function(){var t,n=(t=new at(4),at!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}(),function(){var t,n=(t=new at(2),at!=Float32Array&&(t[0]=0,t[1]=0),t)}();const Mt=Math.PI/180,wt=6378137*Math.PI/180,mt=85.0511287798;function gt(t,n,e){if("EPSG:3857"===e)return function(t,n){const e=mt,i=n[0],r=Math.max(Math.min(e,n[1]),-e);let o;o=0===r?0:Math.log(Math.tan((90+r)*Mt/2))/Mt;return t[0]=i*wt,t[1]=o*wt,t}(t,n);if("EPSG:4326"===e||"EPSG:4490"===e||"identity"===e)return Pt(t,n);if("baidu"===e)return Pt(t,n);throw new Error("unsupported projection:"+e)}function Pt(t,n){return t[0]=n[0],t[1]=n[1],t}function xt(t,n,e,i,r,o,s,u,c,f,a,l,h,d,v){0===t?function(t,n,e,i,r,o,s,u,c,f){const a=1/(100*o[0]),l=1/(100*o[1]),h=f&&f[0]||0,d=f&&f[1]||0,v=[0,0];for(let r=t;r<n;r+=3){const t=r/3*2,n=i[r]-h,o=i[r+1]-d;e[t]=v[0]+n/s*a/u,e[t+1]=v[1]-o/s*l/c}}(n,e,i,r,0,s,u,c,f,v):1===t&&function(t,n,e,i,r,o,s,u,c,f,a){if(!t)return;let l,h,d,v;0===t[4]?(l=t[0],h=t[1],d=t[2],v=t[3]):(l=t[1],h=t[2],d=t[3],v=t[0]);const y=pt(l,h),p=pt(h,d),M=[],w=[],m=[];for(let t=n;t<e;t+=3){const n=t/3*2;yt(M,(o.x/c+r[t]/s)*u,o.y/c*u+(a?r[t+1]:-r[t+1])/s*u),"EPSG:4326"!==f&&"EPSG:4490"!==f||gt(M,M,"EPSG:3857"),bt(w,M,l,h),bt(m,M,v,l),i[n]=pt(l,w)/y,i[n+1]=pt(l,m)/p}}(a,n,e,i,r,o,u,l,h,d,!!v)}function bt(t,n,e,i){const r=e[0]-i[0],o=e[1]-i[1];let s=(n[0]-e[0])*(e[0]-i[0])+(n[1]-e[1])*(e[1]-i[1]);return s/=r*r+o*o,t[0]=e[0]+s*r,t[1]=e[1]+s*o,t}function St(t,n,e,i,r){const o=3*n[e-1],s=3*n[e-1]+1,u=t[o],c=t[s];return f=i,a=r,l=u,h=c,Math.sqrt((l-f)*(l-f)+(h-a)*(h-a));var f,a,l,h}function Ft(t){return t&&t.h&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var At={exports:{}};function kt(t,n,e){e=e||2;var i,r,o,s,u,c,f,a=n&&n.length,l=a?n[0]*e:t.length,h=Tt(t,0,l,e,!0),d=[];if(!h||h.next===h.prev)return d;if(a&&(h=function(t,n,e,i){var r,o,s,u=[];for(r=0,o=n.length;r<o;r++)(s=Tt(t,n[r]*i,r<o-1?n[r+1]*i:t.length,i,!1))===s.next&&(s.steiner=!0),u.push(Bt(s));for(u.sort(Et),r=0;r<u.length;r++)e=Ut(u[r],e);return e}(t,n,h,e)),t.length>80*e){i=o=t[0],r=s=t[1];for(var v=e;v<l;v+=e)(u=t[v])<i&&(i=u),(c=t[v+1])<r&&(r=c),u>o&&(o=u),c>s&&(s=c);f=0!==(f=Math.max(o-i,s-r))?32767/f:0}return It(h,d,e,i,r,f,0),d}function Tt(t,n,e,i,r){var o,s;if(r===Kt(t,n,e,i)>0)for(o=n;o<e;o+=i)s=Ht(o,t[o],t[o+1],s);else for(o=e-i;o>=n;o-=i)s=Ht(o,t[o],t[o+1],s);return s&&Xt(s,s.next)&&(Zt(s),s=s.next),s}function _t(t,n){if(!t)return t;n||(n=t);var e,i=t;do{if(e=!1,i.steiner||!Xt(i,i.next)&&0!==Dt(i.prev,i,i.next))i=i.next;else{if(Zt(i),(i=n=i.prev)===i.next)break;e=!0}}while(e||i!==n);return n}function It(t,n,e,i,r,o,s){if(t){!s&&o&&function(t,n,e,i){var r=t;do{0===r.z&&(r.z=jt(r.x,r.y,n,e,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var n,e,i,r,o,s,u,c,f=1;do{for(e=t,t=null,o=null,s=0;e;){for(s++,i=e,u=0,n=0;n<f&&(u++,i=i.nextZ);n++);for(c=f;u>0||c>0&&i;)0!==u&&(0===c||!i||e.z<=i.z)?(r=e,e=e.nextZ,u--):(r=i,i=i.nextZ,c--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;e=i}o.nextZ=null,f*=2}while(s>1)}(r)}(t,i,r,o);for(var u,c,f=t;t.prev!==t.next;)if(u=t.prev,c=t.next,o?Nt(t,i,r,o):Ot(t))n.push(u.i/e|0),n.push(t.i/e|0),n.push(c.i/e|0),Zt(t),t=c.next,f=c.next;else if((t=c)===f){s?1===s?It(t=Ct(_t(t),n,e),n,e,i,r,o,2):2===s&&Lt(t,n,e,i,r,o):It(_t(t),n,e,i,r,o,1);break}}}function Ot(t){var n=t.prev,e=t,i=t.next;if(Dt(n,e,i)>=0)return!1;for(var r=n.x,o=e.x,s=i.x,u=n.y,c=e.y,f=i.y,a=r<o?r<s?r:s:o<s?o:s,l=u<c?u<f?u:f:c<f?c:f,h=r>o?r>s?r:s:o>s?o:s,d=u>c?u>f?u:f:c>f?c:f,v=i.next;v!==n;){if(v.x>=a&&v.x<=h&&v.y>=l&&v.y<=d&&Vt(r,u,o,c,s,f,v.x,v.y)&&Dt(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function Nt(t,n,e,i){var r=t.prev,o=t,s=t.next;if(Dt(r,o,s)>=0)return!1;for(var u=r.x,c=o.x,f=s.x,a=r.y,l=o.y,h=s.y,d=u<c?u<f?u:f:c<f?c:f,v=a<l?a<h?a:h:l<h?l:h,y=u>c?u>f?u:f:c>f?c:f,p=a>l?a>h?a:h:l>h?l:h,M=jt(d,v,n,e,i),w=jt(y,p,n,e,i),m=t.prevZ,g=t.nextZ;m&&m.z>=M&&g&&g.z<=w;){if(m.x>=d&&m.x<=y&&m.y>=v&&m.y<=p&&m!==r&&m!==s&&Vt(u,a,c,l,f,h,m.x,m.y)&&Dt(m.prev,m,m.next)>=0)return!1;if(m=m.prevZ,g.x>=d&&g.x<=y&&g.y>=v&&g.y<=p&&g!==r&&g!==s&&Vt(u,a,c,l,f,h,g.x,g.y)&&Dt(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;m&&m.z>=M;){if(m.x>=d&&m.x<=y&&m.y>=v&&m.y<=p&&m!==r&&m!==s&&Vt(u,a,c,l,f,h,m.x,m.y)&&Dt(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;g&&g.z<=w;){if(g.x>=d&&g.x<=y&&g.y>=v&&g.y<=p&&g!==r&&g!==s&&Vt(u,a,c,l,f,h,g.x,g.y)&&Dt(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function Ct(t,n,e){var i=t;do{var r=i.prev,o=i.next.next;!Xt(r,o)&&zt(r,i,i.next,o)&&qt(r,o)&&qt(o,r)&&(n.push(r.i/e|0),n.push(i.i/e|0),n.push(o.i/e|0),Zt(i),Zt(i.next),i=t=o),i=i.next}while(i!==t);return _t(i)}function Lt(t,n,e,i,r,o){var s=t;do{for(var u=s.next.next;u!==s.prev;){if(s.i!==u.i&&Gt(s,u)){var c=Rt(s,u);return s=_t(s,s.next),c=_t(c,c.next),It(s,n,e,i,r,o,0),void It(c,n,e,i,r,o,0)}u=u.next}s=s.next}while(s!==t)}function Et(t,n){return t.x-n.x}function Ut(t,n){var e=function(t,n){var e,i=n,r=t.x,o=t.y,s=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var u=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(u<=r&&u>s&&(s=u,e=i.x<i.next.x?i:i.next,u===r))return e}i=i.next}while(i!==n);if(!e)return null;var c,f=e,a=e.x,l=e.y,h=1/0;i=e;do{r>=i.x&&i.x>=a&&r!==i.x&&Vt(o<l?r:s,o,a,l,o<l?s:r,o,i.x,i.y)&&(c=Math.abs(o-i.y)/(r-i.x),qt(i,t)&&(c<h||c===h&&(i.x>e.x||i.x===e.x&&$t(e,i)))&&(e=i,h=c)),i=i.next}while(i!==f);return e}(t,n);if(!e)return n;var i=Rt(e,t);return _t(i,i.next),_t(e,e.next)}function $t(t,n){return Dt(t.prev,t,n.prev)<0&&Dt(n.next,t,t.next)<0}function jt(t,n,e,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-e)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-i)*r|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function Bt(t){var n=t,e=t;do{(n.x<e.x||n.x===e.x&&n.y<e.y)&&(e=n),n=n.next}while(n!==t);return e}function Vt(t,n,e,i,r,o,s,u){return(r-s)*(n-u)>=(t-s)*(o-u)&&(t-s)*(i-u)>=(e-s)*(n-u)&&(e-s)*(o-u)>=(r-s)*(i-u)}function Gt(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==n.i&&e.next.i!==n.i&&zt(e,e.next,t,n))return!0;e=e.next}while(e!==t);return!1}(t,n)&&(qt(t,n)&&qt(n,t)&&function(t,n){var e=t,i=!1,r=(t.x+n.x)/2,o=(t.y+n.y)/2;do{e.y>o!=e.next.y>o&&e.next.y!==e.y&&r<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next}while(e!==t);return i}(t,n)&&(Dt(t.prev,t,n.prev)||Dt(t,n.prev,n))||Xt(t,n)&&Dt(t.prev,t,t.next)>0&&Dt(n.prev,n,n.next)>0)}function Dt(t,n,e){return(n.y-t.y)*(e.x-n.x)-(n.x-t.x)*(e.y-n.y)}function Xt(t,n){return t.x===n.x&&t.y===n.y}function zt(t,n,e,i){var r=Yt(Dt(t,n,e)),o=Yt(Dt(t,n,i)),s=Yt(Dt(e,i,t)),u=Yt(Dt(e,i,n));return r!==o&&s!==u||(!(0!==r||!Jt(t,e,n))||(!(0!==o||!Jt(t,i,n))||(!(0!==s||!Jt(e,t,i))||!(0!==u||!Jt(e,n,i)))))}function Jt(t,n,e){return n.x<=Math.max(t.x,e.x)&&n.x>=Math.min(t.x,e.x)&&n.y<=Math.max(t.y,e.y)&&n.y>=Math.min(t.y,e.y)}function Yt(t){return t>0?1:t<0?-1:0}function qt(t,n){return Dt(t.prev,t,t.next)<0?Dt(t,n,t.next)>=0&&Dt(t,t.prev,n)>=0:Dt(t,n,t.prev)<0||Dt(t,t.next,n)<0}function Rt(t,n){var e=new Wt(t.i,t.x,t.y),i=new Wt(n.i,n.x,n.y),r=t.next,o=n.prev;return t.next=n,n.prev=t,e.next=r,r.prev=e,i.next=e,e.prev=i,o.next=i,i.prev=o,i}function Ht(t,n,e,i){var r=new Wt(t,n,e);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Zt(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 Wt(t,n,e){this.i=t,this.x=n,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Kt(t,n,e,i){for(var r=0,o=n,s=e-i;o<e;o+=i)r+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return r}At.exports=kt,At.exports.default=kt,kt.deviation=function(t,n,e,i){var r=n&&n.length,o=r?n[0]*e:t.length,s=Math.abs(Kt(t,0,o,e));if(r)for(var u=0,c=n.length;u<c;u++){var f=n[u]*e,a=u<c-1?n[u+1]*e:t.length;s-=Math.abs(Kt(t,f,a,e))}var l=0;for(u=0;u<i.length;u+=3){var h=i[u]*e,d=i[u+1]*e,v=i[u+2]*e;l+=Math.abs((t[h]-t[v])*(t[d+1]-t[h+1])-(t[h]-t[d])*(t[v+1]-t[h+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},kt.flatten=function(t){for(var n=t[0][0].length,e={vertices:[],holes:[],dimensions:n},i=0,r=0;r<t.length;r++){for(var o=0;o<t[r].length;o++)for(var s=0;s<n;s++)e.vertices.push(t[r][o][s]);r>0&&(i+=t[r-1].length,e.holes.push(i))}return e};var Qt=Ft(At.exports);const tn="__fea_idx";new Float32Array([-1e12])[0];const nn="maptalks_ombb";function en(){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:rn,ArrayPool:on}=en();function sn(t,n,e,i,r,o,s,u,c,f,a,l,h,d,v,y,p){const M=n.getLength(),w=r/3;for(let e=2,i=M;e<i;e+=3)t[r+e-2]=n[e-2],t[r+e-1]=n[e-1],t[r+e-0]=n[e]-s;r+=M;for(let e=2,i=M;e<i;e+=3)t[r+e-2]=n[e-2],t[r+e-1]=n[e-1],t[r+e-0]=n[e]-u;r+=M,t.trySetLength(r+M),t.copyWithin(r,r-2*M,r-M),r+=M,t.trySetLength(r+M),t.copyWithin(r,r-2*M,r-M),r+=M,(e=e||[]).push(M/3);const m=e.getLength();for(let n=0;n<m;n++){un(w+(e[n-1]||0),w+e[n],t,M/3,c,i,f,a,l,h,o,d,v,y,p)}return r}function un(t,n,e,i,r,o,s,u,c,f,a,l,h,d,v){const y=o.getLength();let p,M;for(let s=t,u=n;s<u-1;s++)if(p=s,M=s+1,r===1/0||!ft(e,p,M,r))if((s-t)%2==1&&(p+=2*i,M+=2*i),v){let t=o.currentIndex;o[t++]=p+i,o[t++]=M,o[t++]=p,o[t++]=M+i,o[t++]=M,o[t++]=p+i,o.currentIndex=t}else{let t=o.currentIndex;o[t++]=p+i,o[t++]=p,o[t++]=M,o[t++]=M,o[t++]=M+i,o[t++]=p+i,o.currentIndex=t}s&&function(t,n,e,i,r,o,s,u,c,f,a,l){let h,d=0,v=0,y=0,p=0;const M=l?[1,3,4]:[2,3,4];for(let l=o.getLength()-1;l>=s;l--){const s=o[l],w=3*s+1,m=3*s+2,g=r[3*s],P=r[w],x=r[m];d||v||(d=Math.max(r[m],r[3*o[l-3]+2]),v=Math.min(r[m],r[3*o[l-3]+2]),h=d-v);let b=y;const S=l%6;0===t?(5===S&&(p=St(r,o,l,g,P)),b=S===M[0]||S===M[1]||S===M[2]?y:y+p):1===t&&(S===M[0]||S===M[1]||S===M[2]?b=0:5===S?(p=St(r,o,l,g,P),b=p):b=p);const F=b/f*(1/(100*a))/u;let A;A=1===n?x===d?1:0:"bottom"===e?x===d?h/100/c:0:x===d?0:-h/100/c,i[2*s]=F,i[2*s+1]=A,0===S&&(y+=p)}}(u,c,f,a,e,o,y,l[0],l[1],h,d,v)}function cn(t){const n=[t[0]];let e=t[0];for(let i=1;i<t.length;i++)Array.isArray(t[i])?t[i][0]===e[0]&&t[i][1]===e[1]&&t[i][2]===e[2]||n.push(t[i]):t[i].x===e.x&&t[i].y===e.y&&t[i].z===e.z||n.push(t[i]),e=t[i];return n}var fn="undefined"!=typeof Float32Array?Float32Array:Array;function an(){var t=new fn(3);return fn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function ln(t,n,e){var i=new fn(3);return i[0]=t,i[1]=n,i[2]=e,i}function hn(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function dn(t,n,e,i){return t[0]=n,t[1]=e,t[2]=i,t}function vn(t,n,e){return t[0]=n[0]+e[0],t[1]=n[1]+e[1],t[2]=n[2]+e[2],t}function yn(t,n){var e=n[0],i=n[1],r=n[2],o=e*e+i*i+r*r;return o>0&&(o=1/Math.sqrt(o),t[0]=n[0]*o,t[1]=n[1]*o,t[2]=n[2]*o),t}function pn(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Mn(t,n,e){var i=n[0],r=n[1],o=n[2],s=e[0],u=e[1],c=e[2];return t[0]=r*c-o*u,t[1]=o*s-i*c,t[2]=i*u-r*s,t}var wn=function(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t};function mn(){var t=new fn(4);return fn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function gn(t,n){var e=n[0]+n[4]+n[8],i=void 0;if(e>0)i=Math.sqrt(e+1),t[3]=.5*i,i=.5/i,t[0]=(n[5]-n[7])*i,t[1]=(n[6]-n[2])*i,t[2]=(n[1]-n[3])*i;else{var r=0;n[4]>n[0]&&(r=1),n[8]>n[3*r+r]&&(r=2);var o=(r+1)%3,s=(r+2)%3;i=Math.sqrt(n[3*r+r]-n[3*o+o]-n[3*s+s]+1),t[r]=.5*i,i=.5/i,t[3]=(n[3*o+s]-n[3*s+o])*i,t[o]=(n[3*o+r]+n[3*r+o])*i,t[s]=(n[3*s+r]+n[3*r+s])*i}return t}!function(){var t=an()}(),function(){var t,n=(t=new fn(4),fn!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();var Pn,xn=function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t[3]=n[3]*e,t},bn=function(t,n){var e=n[0],i=n[1],r=n[2],o=n[3],s=e*e+i*i+r*r+o*o;return s>0&&(s=1/Math.sqrt(s),t[0]=e*s,t[1]=i*s,t[2]=r*s,t[3]=o*s),t};an(),ln(1,0,0),ln(0,1,0),mn(),mn(),Pn=new fn(9),fn!=Float32Array&&(Pn[1]=0,Pn[2]=0,Pn[3]=0,Pn[5]=0,Pn[6]=0,Pn[7]=0),Pn[0]=1,Pn[4]=1,Pn[8]=1;\n/*!\n * Contains code from google filament\n * https://github.com/google/filament/\n * License Apache-2.0\n */\nconst Sn=8,Fn=[],An=[],kn=[],Tn=[];function _n(t,n,e){const i=Mn(An,n,e),r=function(t,n,e,i,r,o,s,u,c,f){return t[0]=n,t[1]=e,t[2]=i,t[3]=r,t[4]=o,t[5]=s,t[6]=u,t[7]=c,t[8]=f,t}(Fn,e[0],e[1],e[2],...i,...n);t=gn(t,r),t=function(t){return t[3]<0?xn(t,t,-1):t}(t=bn(t,t));const o=1/((1<<2*Sn-1)-1);if(t[3]<o){t[3]=o;const n=Math.sqrt(1-o*o);t[0]*=n,t[1]*=n,t[2]*=n}const s=e[3]>0?Mn(kn,e,n):Mn(kn,n,e);return pn(Mn(Tn,e,n),s)<0&&xn(t,t,-1),t}const In=[];const On=[],Nn=[],Cn=[],Ln=[],En=[],Un=[],$n=[];function jn(t,n,e,i,r,o){dn(Ln,t[3*n],t[3*n+1],t[3*n+2]),dn(En,t[3*e],t[3*e+1],t[3*e+2]),dn(Un,t[3*i],t[3*i+1],t[3*i+2]);const s=wn(On,Un,En),u=wn(Nn,Ln,En),c=Mn(Cn,s,u);yn($n,c),r[3*n]=r[3*n]||0,r[3*e]=r[3*e]||0,r[3*i]=r[3*i]||0,r[3*n+1]=r[3*n+1]||0,r[3*e+1]=r[3*e+1]||0,r[3*i+1]=r[3*i+1]||0,r[3*n+2]=r[3*n+2]||0,r[3*e+2]=r[3*e+2]||0,r[3*i+2]=r[3*i+2]||0,r[3*n]+=$n[0],r[3*e]+=$n[0],r[3*i]+=$n[0],r[3*n+1]+=$n[1],r[3*e+1]+=$n[1],r[3*i+1]+=$n[1],r[3*n+2]+=$n[2],r[3*e+2]+=$n[2],r[3*i+2]+=$n[2],o[n]+=1,o[e]+=1,o[i]+=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 Bn(t,n,e){return t[0]=n[e],t[1]=n[e+1],t[2]=n[e+2],t}function Vn(t,n,e){return t[0]=n[e],t[1]=n[e+1],t}const{StyleUtil:Gn,PackUtil:Dn,ArrayPool:Xn}=en(),zn=Xn.getInstance();function Jn(t,n,e,i,r,o,s,u,c,f,a,l,h,d,v,y){void 0===n.top&&(n.top=!0),void 0===n.side&&(n.side=!0),zn.reset();const{altitudeScale:p,altitudeProperty:g,defaultAltitude:P,heightProperty:x,minHeightProperty:b,defaultHeight:F,tangent:A,uv:k,topUVMode:_,sideUVMode:I,sideVerticalUVMode:O,top:N,side:C,textureYOrigin:L,topThickness:E}=n,U=function(t,n,{altitudeScale:e,altitudeProperty:i,defaultAltitude:r,heightProperty:o,minHeightProperty:s,defaultHeight:u},{center:c,side:f,top:a,topThickness:l,uvOrigin:h,uv:d,uvSize:v,topUVMode:y,sideUVMode:p,sideVerticalUVMode:M,textureYOrigin:w,tileRatio:m,centimeterToPoint:g,verticalCentimeterToPoint:P,positionType:x,res:b,glScale:F,projectionCode:A},k,T){let _=n/t[0].extent;n===1/0&&(_=1);const I=n===1/0,O=T.get(),N=T.get(),C=T.get(),L=T.getProxy(),E=T.get(),U=T.get(),$=T.get(),j=!!d,B=!!a,V=!!f,G=j?T.get():null;function D(t,e,i,r,o,s){let u=e;if(B){const f=Qt(L,i,3);if(0===f.length)return e;let a=L.getLength(),d=E.currentIndex;for(let t=0;t<a;t++)E[d++]=L[t];if(E.currentIndex=d,e+=L.getLength(),s)for(let n=2,e=f.length;n<e;n+=3)f[n]+=t/3,f[n-1]+=t/3,f[n-2]+=t/3;else{let n;for(let e=2,i=f.length;e<i;e+=3)n=f[e-1],f[e-1]=f[e]+t/3,f[e]=n+t/3,f[e-2]+=t/3}a=f.length,d=U.currentIndex;for(let t=0;t<a;t++)U[d++]=f[t];U.currentIndex=d,j&&xt(y||0,t,e,G,E,h,g,m,v[0],v[1],o,b,F,A,c),l>0&&!V&&(e=sn(E,L,i,U,e,G,0,l,n,j,p||0,M||0,w,v,m,P,r<0?!s:s)),$.setLength(e/3),$.fill(1,u/3,e/3)}if(V){B&&(l=0),u=e,e=sn(E,L,i,U,e,G,l,r,n,j,p||0,M||0,w,v,m,P,r<0?!s:s),$.setLength(e/3);const t=L.getLength()/3;$.fill(1,u/3,u/3+t),$.fill(0,u/3+t,u/3+2*t),$.fill(1,u/3+2*t,u/3+3*t),$.fill(0,u/3+3*t,e/3)}return e}let X=0,z=0;const J=[-1,-1,n+1,n+1];let Y=0,q=t.length;S(k)&&(Y=k,q=k+1);let R=0,H=!1;const Z=T.getProxy();let W=!1;for(;Y<q;Y++){const c=t[Y],f=c.id;S(f)&&(Math.abs(f)>R&&(R=Math.abs(f)),f<0&&(H=!0));const a=c.geometry,l=c.properties[nn];let h=Array.isArray(l&&l[0]&&l[0][0])?l[0]:l;const{altitude:d,height:v}=rn.getFeaAltitudeAndHeight(c,e,i,r,o,u,s);v<0&&(W=!0),X=Math.max(Math.abs(d),X);const y=E.getLength();let p=0,M=z;Z.setLength(0),L.setLength(0);const w=rn.calculateSignedArea(a[0])<0;for(let t=0,e=a.length;t<e;t++){let i=a[t];w&&(i=i.reverse()),i=cn(i);const r=rn.calculateSignedArea(i)<0;if(!r&&t>0&&(p++,h=l&&l[p],z=D(M,z,Z,v*_,h,I),L.setLength(0),Z.setLength(0),M=z),n!==1/0&&(i=rn.clipPolygon(i,J)),!i.length){t===e-1&&(z=D(M,z,Z,v*_,h,I));continue}const o=i.length;if(Array.isArray(i[0])?i[0][0]===i[o-1][0]&&i[0][1]===i[o-1][1]||i.push([i[0][0],i[0][1]]):i[0].x===i[o-1].x&&i[0].y===i[o-1].y||i.push(i[0]),r){let t=Z.currentIndex;Z[t++]=L.getLength()/3,Z.currentIndex=t}ct(L,L.getLength(),i,_,d,!1,x),t===e-1&&(z=D(M,z,Z,v*_,h,I))}const m=E.getLength()-y,g=(tn+"").trim();for(let t=0;t<m/3;t++){let t=N.currentIndex;N[t++]=void 0===c[g]?Y:c[g],N.currentIndex=t,t=O.currentIndex,O[t++]=Y,O.currentIndex=t,S(f)&&(t=C.currentIndex,C[t++]=f,C.currentIndex=t)}}const K=rn.getUnsignedArrayType(N.getLength()?N[N.getLength()-1]:0),Q={hasNegativeHeight:W,maxAltitude:X,vertices:E,verticeTypes:$,indices:U,pickingIds:on.createTypedArray(N,K),featureIndexes:O};if(C.getLength()){const t=H?rn.getPosArrayType(R):rn.getUnsignedArrayType(R);Q.featureIds=on.createTypedArray(C,t)}else Q.featureIds=[];return G&&(G.setLength(E.getLength()/3*2),Q.uvs=G),Q}(t,e,{altitudeScale:p,altitudeProperty:g,defaultAltitude:P||0,heightProperty:x,minHeightProperty:b,defaultHeight:F||0},{center:y,top:N,side:C,topThickness:10*E||0,uv:k||A,uvSize:[r,r],uvOrigin:i,topUVMode:_,sideUVMode:I,sideVerticalUVMode:O,textureYOrigin:L,tileRatio:u,centimeterToPoint:c,verticalCentimeterToPoint:f,positionType:v,res:o,glScale:s,projectionCode:h},d,zn),$=[],j=U.vertices.getLength()/3,B=Dn.getIndexArrayType(j),V=Xn.createTypedArray(U.indices,B);delete U.indices,$.push(V.buffer,U.pickingIds.buffer);const G=Dn.getPosArrayType(Math.max(512,U.maxAltitude));U.vertices=Xn.createTypedArray(U.vertices,G);const D=A?zn.getProxy():new Float32Array(3*j);D.setLength&&D.setLength(3*j);const X=function(t,n,e){const i=e||[];i.setLength&&i.setLength(t.length);const r=In;r.length<t.length/3&&(r.length=t.length/3),r.fill(0,0,t.length/3);const o=void 0===n.length?n:n.length;for(let e=0;e<o/3;e++)void 0===n.length?jn(t,3*e,3*e+1,3*e+2,i,r):jn(t,n[3*e],n[3*e+1],n[3*e+2],i,r);for(let t=0;t<i.length;t+=3){const n=r[t/3];0!==n?(i[t]/=n,i[t+1]/=n,i[t+2]/=n):(i[t]=0,i[t+1]=0,i[t+2]=0)}return i}(U.vertices,V,D);let z=!0;const J=X.getLength?X.getLength():X.length;for(let t=0;t<J;t++){X[t]=-X[t];const n=X[t]%1;1-Math.abs(n)>1e-6?z=!1:0!==n&&(X[t]=Math.round(X[t]))}if(U.normals=X,A){let t=zn.get();t.setLength(4*j),t=function(t,n,e,i,r){const o=t.length/3,s=r||new Array(4*o),u=[],c=[];for(let t=0;t<o;t++)u[t]=[0,0,0],c[t]=[0,0,0];const f=[0,0,0],a=[0,0,0],l=[0,0,0],h=[0,0],d=[0,0],v=[0,0],y=[0,0,0],p=[0,0,0];function M(n,i,r){Bn(f,t,3*n),Bn(a,t,3*i),Bn(l,t,3*r),Vn(h,e,2*n),Vn(d,e,2*i),Vn(v,e,2*r);const o=a[0]-f[0],s=l[0]-f[0],M=a[1]-f[1],w=l[1]-f[1],m=a[2]-f[2],g=l[2]-f[2],P=d[0]-h[0],x=v[0]-h[0],b=d[1]-h[1],S=v[1]-h[1],F=1/(P*S-x*b);dn(y,(S*o-b*s)*F,(S*M-b*w)*F,(S*m-b*g)*F),dn(p,(P*s-x*o)*F,(P*w-x*M)*F,(P*g-x*m)*F),vn(u[n],u[n],y),vn(u[i],u[i],y),vn(u[r],u[r],y),vn(c[n],c[n],p),vn(c[i],c[i],p),vn(c[r],c[r],p)}for(let t=0,n=i.length;t<n;t+=3)M(i[t+0],i[t+1],i[t+2]);const w=[],m=[],g=[],P=[];let x,b,S;function F(t){Bn(g,n,3*t),hn(P,g),b=u[t],hn(w,b),wn(w,w,function(t,n,e){return t[0]=n[0]*e,t[1]=n[1]*e,t[2]=n[2]*e,t}(g,g,pn(g,b))),yn(w,w),Mn(m,P,b),S=pn(m,c[t]),x=S<0?-1:1,s[4*t]=w[0],s[4*t+1]=w[1],s[4*t+2]=w[2],s[4*t+3]=x}for(let t=0,n=i.length;t<n;t+=3)F(i[t+0]),F(i[t+1]),F(i[t+2]);return s}(U.vertices,U.normals,U.uvs,V,t),t=function(t,n){const e=n.getLength(),i=new Float32Array(e),r=[],o=[],s=[];for(let u=0;u<e;u+=4){const e=u/4*3;lt(o,t[e]||0,t[e+1]||0,t[e+2]||0),dt(r,n[u]||0,n[u+1]||0,n[u+2]||0,n[u+3]||0),_n(s,o,r),ht(i.subarray(u,u+4),s)}return i}(U.normals,t),U.tangents=t,$.push(t.buffer),delete U.normals}if(U.normals&&(z&&(U.normals=Xn.createTypedArray(U.normals,Int8Array)),$.push(U.normals.buffer)),U.uvs){const t=U.uvs;U.uvs=Xn.createTypedArray(t,Float32Array),$.push(U.uvs.buffer)}const Y=function(t,n,e,i){const r={},o={},s=i.getLength();if(T(n.polygonFill)){let u=w(n.polygonFill);const c=new Uint8Array(4*s);c.fill(255);for(let n=0;n<s;n++){const o=t[i[n]],s=o.properties||{};s.$layer=o.layer,s.$type=o.type;let f=u(e,s);M(f)&&(r.aColor=1,u=w(f),f=u(e,s)),delete s.$layer,delete s.$type,Gn.normalizeColor(Yn,f),c[4*n]=Yn[0],c[4*n+1]=Yn[1],c[4*n+2]=Yn[2],c[4*n+3]=Yn[3]}o.aColor=c}if(T(n.polygonOpacity)){let u=m(n.polygonOpacity,"exponential");const c=new Uint8Array(s);c.fill(255);for(let n=0;n<s;n++){const o=t[i[n]],s=o.properties||{};s.$layer=o.layer,s.$type=o.type;let f=u(e,s);M(f)&&(r.aOpacity=1,u=w(f),f=u(e,s)),delete s.$layer,delete s.$type,c[n]=255*f}o.aOpacity=c}return o.dynamicAttributes=r,o}(t,a,l,U.featureIndexes),q=function(t,n,e,i,r){const o=[[],[]],s=T(i.topPolygonFill),u=T(i.bottomPolygonFill),c=[255,255,255,255],f=n.getLength();if(s||u){let a=s&&w(i.topPolygonFill),l=u&&w(i.bottomPolygonFill),h=null,d=null,v=null,y=null;for(let i=0;i<f;i++){if(1===t[i]&&!s||0===t[i]&&!u)continue;const f=1===t[i];if(f&&n[i]===h){t[i]=v;continue}if(!f&&n[i]===d){t[i]=y;continue}const p=e[n[i]],m=p.properties||{};m.$layer=p.layer,m.$type=p.type;let g=f?a:l,P=g(r,m);M(P)&&(g=w(P),P=g(r,m)),delete m.$layer,delete m.$type,Gn.normalizeColor(Yn,P),vt(Yn,Yn,c);let x=qn(o,Yn);x<0&&(x=o.length,o.push(ht([],Yn))),t[i]=x,f?(h=n[i],v=x):(d=n[i],y=x)}}return o.slice(2)}(U.verticeTypes,U.featureIndexes,t,a,l),R={data:{data:{aVertexColorType:q.length<=252?Xn.createTypedArray(U.verticeTypes,Uint8Array):Xn.createTypedArray(U.verticeTypes,Uint16Array),aPosition:U.vertices,aNormal:U.normals,aTexCoord0:U.uvs,aTangent:U.tangents,aPickingId:U.pickingIds},indices:V,properties:{maxAltitude:U.maxAltitude,hasNegativeHeight:U.hasNegativeHeight},dynamicAttributes:Y.dynamicAttributes,vertexColors:q},buffers:$};return U.featureIds.length?(R.data.featureIds=U.featureIds,$.push(R.data.featureIds.buffer)):R.data.featureIds=[],Y.aColor&&(R.data.data.aColor=Y.aColor,R.buffers.push(Y.aColor.buffer)),Y.aOpacity&&(R.data.data.aOpacity=Y.aOpacity,R.buffers.push(Y.aOpacity.buffer)),R.buffers.push(R.data.data.aPosition.buffer),R.data.pickingIdIndiceMap=Dn.generatePickingIndiceIndex(R.data.data.aPickingId,R.data.indices),R}const Yn=[];function qn(t,n){for(let r=0;r<t.length;r++)if(e=n,i=t[r],e[0]===i[0]&&e[1]===i[1]&&e[2]===i[2]&&e[3]===i[3])return r;var e,i;return-1}const{PackUtil:Rn,StyleUtil:Hn,FilterUtil:Zn}=en();function Wn(t,n,e,i,{altitudeScale:r,altitudeProperty:o,defaultAltitude:s,heightProperty:u,minHeightProperty:c,defaultHeight:f,bottom:a}){const l=a,h=n/t[0].extent,d=2*function(t,n){let e=0;for(let n=0,i=t.length;n<i;n++){const i=t[n];if(S(i.geometry[0][0]))e+=3*i.geometry.length;else for(let t=0,n=i.geometry.length;t<n;t++){let n=3*i.geometry[t].length;3===i.type&&(n-=3),e+=n}}return e}(t)+3*t.length*2,v=[],y=new Int16Array(d),p=new Uint8Array(y.length/3*4);M(e)&&(e=Zn.compileFilter(e));const w=[];function m(t,e,i){const r=e-t,o=y.subarray(t,e),s=y.subarray(e,e+r);s.set(o);for(let t=2,n=s.length;t<n;t+=3)s[t]=o[t]-i;const u=t/3,c=r/3;let f,a;for(let t=u,e=c+u;t<e;t++)t<e-1?(f=t,a=t+1):(f=t,a=u),ft(y,f,a,n)||(w.push(f,a),l&&w.push(f+c,a+c),Kn(y,f,n)||w.push(f,f+c));return e+r}let g=0,P=0;const x=(tn+"").trim(),b=[];for(let n=0,a=t.length;n<a;n++){const a=t[n],l=a.geometry;if(e){let t;t="function"==typeof e?e(a&&a.properties):e,Hn.normalizeColor(b,t)}else lt(b,255,255,255);const d=g/3*4,{altitude:M,height:S}=Rn.getFeaAltitudeAndHeight(a,r,o,s,u,f,c);P=Math.max(Math.abs(M),P);let F=g;for(let t=0,n=l.length;t<n;t++){let n=l[t];const e=n.length;n[0][0]===n[e-1][0]&&n[0][1]===n[e-1][1]&&(n=n.slice(0,e-1)),g=ct(y,F,n,h,M),g=m(F,g,S*h),F=g}const A=F/3*4;for(let t=d;t<A;t+=4)p[t]=b[0],p[t+1]=b[1],p[t+2]=b[2],p[t+3]=255*(i||1);const k=w.length-v.length;for(let t=0;t<k;t++)v.push(a[x])}const F=w.reduce(((t,n)=>Math.max(t,n)),0),A=new(Rn.getIndexArrayType(F))(w),k=Rn.getUnsignedArrayType(t.length);return{aPosition:new(Rn.getPosArrayType(Math.max(512,P)))(y),indices:A,aPickingId:new k(v),aColor:p}}function Kn(t,n,e){const i=t[3*n],r=t[3*n+1];return i<0||i>e||r<0||r>e}function Qn(t,n,e,i){const r=Wn(t,n,e.lineColor,e.lineOpacity,i),o=[r.aPosition.buffer,r.indices.buffer,r.aPickingId.buffer],s=r.indices;return delete r.indices,{data:{data:r,indices:s},buffers:o}}\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 te=["Unknown","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"];function ne(t){if(!t)return"true";const n=t[0];if(t.length<=1)return"any"===n?"false":"true";return\`(${o}"=="===n?ie(t[1],t[2],"===",!1):"!="===n?ie(t[1],t[2],"!==",!1):"<"===n||">"===n||"<="===n||">="===n?ie(t[1],t[2],n,!0):"any"===n?oe(t.slice(1),"||"):"all"===n?oe(t.slice(1),"&&"):"none"===n?ce(oe(t.slice(1),"||")):"in"===n?se(t[1],t.slice(2)):"!in"===n?ce(se(t[1],t.slice(2))):"has"===n?ue(t[1]):"!has"===n?ce(ue(t[1])):"contains"===n?function(t,n,e){const i=ee(t);return void 0!==e?\`(${o}i} + '').indexOf("${o}n}") === ${o}e}\`:\`(${o}i} + '').indexOf("${o}n}") >= 0\`}(t[1],t[2],t[3]):"true"})\`}function ee(t){return"$"===t[0]?"f."+t.substring(1):"p["+JSON.stringify(t)+"]"}function ie(t,n,e,i){if("object"==typeof(r=t)&&r&&t.op)return function(t,n,e,i){const r=t.property,o=t.op;let s=ee(r);return"length"!==o?(console.error(\`not support ${o}o} op\`),"false"):(s=\`((${o}s}+='').length)\`,re(s,r,n,e,i))}(t,n,e,i);var r;return re(ee(t),t,n,e,i)}function re(t,n,e,i,r){const o="$type"===n?te.indexOf(e):JSON.stringify(e);return(r?\`typeof ${o}t}=== typeof ${o}o}&&\`:"")+t+i+o}function oe(t,n){return t.map(ne).join(n)}function se(t,n){"$type"===t&&(n=n.map((t=>te.indexOf(t))));const e=JSON.stringify(n.sort(fe)),i=ee(t);return n.length<=200?\`${o}e}.indexOf(${o}i}) !== -1\`:\`function(v, a, i, j) {\\n while (i <= j) { var m = (i + j) >> 1;\\n if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;\\n }\\n return false; }(${o}i}, ${o}e},0,${o}n.length-1})\`}function ue(t){return"$id"===t?'"id" in f':\`${o}JSON.stringify(t)} in p\`}function ce(t){return\`!(${o}t})\`}function fe(t,n){return t<n?-1:t>n?1:0}let ae=!1;try{const t=new OffscreenCanvas(1,1);t.getContext("2d").fillText("hello",0,0),ae=!0}catch(t){ae=!1}var le=ae;const{VectorPack:he,PolygonPack:de,NativeLinePack:ve,LinePack:ye,PointPack:pe,NativePointPack:Me,LineExtrusionPack:we,CirclePack:me,RoundTubePack:ge,SquareTubePack:Pe,FilterUtil:xe,PackUtil:be,StyleUtil:Se,TextUtil:Fe,DEFAULT_TEX_WIDTH:Ae,GlyphRequestor:ke}=en(),Te="__original_properties",_e="__fn-type_properties";class Ie{constructor(t,n,e,i,r){this.id=t,this.options=n,this.upload=e,this.v(n.style),this.requests={},this.M=i,this.m=1,this.loadings=r}updateStyle(t,n){this.options.style=t,this.m=t.styleCounter,this.v(t),n()}updateOptions(t,n){this.options=x(this.options,t),n()}loadTile(t,n){const e=this.loadings,i=t.tileInfo.url,r=this.options.debugTile;if(r){const{x:e,y:i,z:o}=t.tileInfo;let s=!1;for(let t=0;t<r.length;t++)if(e===r[t].x&&i===r[t].y&&o===r[t].z){s=!0;break}if(!s)return void n()}if(e[i])return void e[i].push({context:t,callback:n,ref:this});e[i]=[{context:t,callback:n,ref:this}];const o=this.options.featureIdProperty;this.requests[i]=this.getTileFeatures(t,((n,r,s,u)=>{const c=e[i];if(delete e[i],this.checkIfCanceled(i))return delete this.requests[i],void this.P(c,null,{canceled:!0});if(delete this.requests[i],(this.options.debug||o)&&r)for(let n=0;n<r.length;n++)if(this.options.debug&&(r[n]._debug_info={index:n,id:r[n].id,tileId:t.tileInfo.id}),o){const t=A(o)?o[r[n].layer]:o,e=r[n].properties;r[n].id=e&&e[t]||null}if(n)this.P(c,n);else if(r&&r.length){if(c)for(let t=0;t<c.length;t++)this.S.call(c[t].ref,c[t].context,c[t].callback,i,s,r,u)}else this.P(c)}))}S(t,n,e,i,r,o){this.F(i,r,t).then((e=>{e.canceled?n(null,{canceled:!0}):(e.data.styleCounter=t.styleCounter,o&&x(e.data,o),n(null,e.data,e.buffers))})).catch((t=>{n(t)}))}abortTile(t,n){delete this.requests[t],this.A(t),n()}A(t){const n=this.loadings[t];if(n)for(let t=0;t<n.length;t++)n[t].callback(null,{canceled:!0});delete this.loadings[t]}P(t,n,e){if(t)for(let i=0;i<t.length;i++)t[i].callback(n,e)}checkIfCanceled(t){return!this.requests[t]}onRemove(){this.loadings={},delete this.M,this.requests={}}fetchIconGlyphs(t,n,e){if(this.options.workerGlyph&&le){const i=[];if(t&&Object.keys(t).length){const n=new Promise((n=>{this.upload("fetchIconGlyphs",{icons:t},null,((t,e)=>{n({err:t,iconData:e})}))}));i.push(n)}if(n&&Object.keys(n).length){const t=new Promise((t=>{this.k||(this.k=new ke),this.k.getGlyphs(n,((n,e)=>{t({err:n,glyphData:e})}))}));i.push(t)}Promise.all(i).then((t=>{const n={icons:null,glyphs:null};for(let i=0;i<t.length;i++){if(t[i].err)return void e(t[i].err);t[i].iconData?n.icons=t[i].iconData.icons:t[i].glyphData&&(n.glyphs=t[i].glyphData.glyphs)}return n})).then((t=>{e(null,t)}))}else this.upload("fetchIconGlyphs",{icons:t,glyphs:n},null,e)}F(t,n,e){if(!n.length)return Promise.resolve({data:null,buffers:[]});const{glScale:i,tileInfo:r}=e,o=!this.options.style.style.length&&!this.options.style.featureStyle.length;let s=this.pluginConfig.slice(0);o&&(s=this.T(t)),this.featurePlugins&&function(t){for(let n=1;n<arguments.length;n++){const e=arguments[n];if(e)for(let n=0,i=e.length;n<i;n++)t.push(e[n])}t.length}(s,this.featurePlugins);const u={};for(let t=0;t<s.length;t++)$e(n,e.tileInfo.z,s[t],u);const c=[],f=[];for(let t=0;t<n.length;t++){const e=n[t],i=u[t];if(i){f.fill(null);let t=0;for(const n in i){let r=0;const o=i[n].values();for(const t of o){let i=f[r];i||(i=Ge(e),f[r]=i),i.properties[n]=t,r++}r>t&&(t=r)}for(let n=0;n<t;n++)c.push(f[n])}else c.push(e)}const a=(n=c)[0].extent,l=r.z,h={x:r.extent2d.xmin*i,y:r.extent2d.ymax*i},d=[],v=[],y=[],p=this.options,M=[],w={},m=[Promise.resolve(e.styleCounter)];let g=0,P=-1;const b=[];let S=!1;for(let t=0;t<s.length;t++){P++;const i=s[t];i.type!==g&&(P=0,g=i.type);const u=0===i.type?d:v;if(i.symbol&&!1===i.symbol.visible){u[P]=null;continue}ze(i.symbol,b,t),S=S||b[t]&&b[t].size>0;const{tileFeatures:c,tileFeaIndexes:f}=this._(l,i.type,i.filter,n,w,t);if(!c.length){u[P]=null;continue}const p=f[f.length-1],F=be.getIndexArrayType(p);u[P]={styledFeatures:new F(f)},y.push({idx:t,typeIdx:P}),M.push(u[P].styledFeatures.buffer);const A=x({},e,{extent:a,zoom:l,tilePoint:h});if(this.options.debugTile){const t=this.options.debugTile;for(let n=0;n<t.length;n++){const{x:e,y:i,z:o}=t[n];if(r.x===e&&r.y===i&&r.z===o){A.debugIndex=t[n].index;break}}}let k=this.I(c,i,A);o&&(k=k.then((t=>{if(!t)return null;if(t.data)t.data.layer=c[0].layer;else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]&&t[n].data&&(t[n].data.layer=c[0].layer);return t}))),m.push(k)}return Promise.all(m).then((([e,...i])=>{if(e!==this.m)return{canceled:!0};function r(t,n){if(void 0===t.data.ref&&(t.data.type=s[y[n].idx].renderPlugin.dataConfig.type,t.data.filter=s[y[n].idx].filter.def,t.buffers&&t.buffers.length))for(let n=0;n<t.buffers.length;n++)M.push(t.buffers[n])}for(let t=0;t<i.length;t++){if(!i[t])continue;const n=i[t],e=0===s[y[t].idx].type?d:v;if(Array.isArray(n)){const i=[];for(let e=0;e<n.length;e++)n[e]&&(r(n[e],t),(void 0===n[e].data.ref||n[n[e].data.ref])&&i.push(n[e].data));i.length&&(e[y[t].typeIdx].data=i)}else r(n,t),e[y[t].typeIdx].data=n.data}const o={},u=t;if(p.features||p.schema||S){let t,e=!1;for(let i=0,r=n.length;i<r;i++)if(t=n[i],u[t.layer].properties||(u[t.layer].properties=Ce(t.properties)),t&&(p.features||S&&w[i]))if("id"===p.features)o[i]=t.id;else{p.pickingGeometry||delete t.geometry,delete t.extent,delete t.properties.$layer,delete t.properties.$type,delete t.__index;const n=t.originalFeature;if(n){const n=t.properties,e=x({},t.originalFeature);delete n[Te],e.customProps=x({},n),t=e}const r=x({},t);if(S&&w[i]&&(!p.features||"transient"===p.features)){const r=w[i];for(let i=0;i<r.length;i++){const r=b[i];r&&r.forEach((i=>{const r=n?n.properties:t.properties;r[_e]||(r[_e]=new Set),r[_e].add(i),e=!0}))}}o[i]=r}if(e)for(const t in o){const n=o[t],e=n.properties[_e];if(e){delete n.properties[_e],"transient"===p.features&&(n.fnTypeProps=x({},n.properties));for(const t in n.properties)e.has(t)||("transient"===p.features?delete n.fnTypeProps[t]:delete n.properties[t])}}}return{data:{styleCounter:e,schema:u,data:d,featureData:v,extent:a,features:o},buffers:M}})).catch((t=>{console.error(t)}))}I(t,n,e){let i=t;const r=n.renderPlugin.dataConfig,o=n.symbol,s=this.options.tileSize,{extent:u,glScale:c,zScale:f,zoom:a,tilePoint:l,centimeterToPoint:h,verticalCentimeterToPoint:d}=e,v=u/s,y=r.type,p=e.debugIndex;let M=x({},r,{EXTENT:u,zoom:a,debugIndex:p,features:this.options.features});if("3d-extrusion"===y){Le(o)&&(r.uv=1);const t=this.options.projectionCode,n=o.material&&o.material.textureWidth||Ae;return Promise.all([Promise.resolve(Jn(i,r,u,l,n,e.tileInfo.res,c,u/this.options.tileSize,h,d,o,a,t,p))])}if("3d-wireframe"===y)return Promise.all([Promise.resolve(Qn(i,u,o,r))]);if("point"===y){M=x(M,{requestor:this.fetchIconGlyphs.bind(this),altitudeToTileScale:f*u/this.options.tileSize/c});const t=pe.splitPointSymbol(o),n=he.genFnTypes(t[0]);return pe.needMerge(t[0],n,a)&&(i=pe.mergeLineFeatures(i,t[0],n,a)),Promise.all(t.map(((t,e)=>(0===e?M.fnTypes=n:delete M.fnTypes,new pe(i,t,M).load(v)))))}if("native-point"===y){const t=f*u/this.options.tileSize/c;return M.altitudeToTileScale=t,Ee(i,o,M,Me,u/s)}if("line"===y)return M=x(M,{requestor:this.fetchIconGlyphs.bind(this),tileRatio:v}),Ee(i,o,M,ye,1,!0);if("native-line"===y)return Ee(i,o,M,ve,1,!0);if("fill"===y)return M=x(M,{requestor:this.fetchIconGlyphs.bind(this)}),Ee(i,o,M,de);if("line-extrusion"===y){delete o.lineGradientProperty,o.lineJoin="miter",o.lineCap="butt";const t=Le(o);if(t&&(r.uv=1),M=x(M,{tileSize:s,zScale:f,glScale:c}),o.mergeOnProperty){const t=he.genFnTypes(o);i=ye.mergeLineFeatures(i,o,t,M.zoom)}if(t){const t=[];if(!1!==r.top){const n=x({},M);n.side=!1,t.push(new we(i,o,n))}return!1!==r.side&&(M.side=!0,M.top=!1,t.push(new we(i,o,M))),Promise.all(t.map((t=>t.load())))}return Promise.all([new we(i,o,M).load()])}if("circle"===y)return Ee(i,o,M,me);if("round-tube"===y||"square-tube"===y){const t="round-tube"===y?ge:Pe;return M=x(M,{requestor:this.fetchIconGlyphs.bind(this),radialSegments:"round-tube"===y?r.radialSegments||8:4,centimeterToPoint:h,verticalCentimeterToPoint:d,tileRatio:v,isTube:!0}),Ee(i,o,M,t)}return Promise.resolve([])}_(t,n,e,i,r,o){const s=(tn+"").trim(),u=[],c=[],f=i.length;for(let a=0;a<f;a++)if((1===n||void 0===i[a].id||!this.styledFeatures[i[a].id])&&((!e.def||"default"===e.def)&&!r[a]||!0===e.def||e.def&&(void 0!==e.def.condition||Array.isArray(e.def))&&e(i[a],t))){const t=i[a];if(void 0===t[s]&&(t[s]=a),r[a]||(r[a]=[]),r[a].push(o),c.push(t),u.push(a),1===n)break}return{tileFeatures:c,tileFeaIndexes:u}}v(t){const{style:n,featureStyle:e}=t,i={};e.forEach((t=>{Array.isArray(t.id)?(t.id.forEach((t=>{i[t]=1})),t.filter=["in","$id",...t.id]):(i[t.id]=1,t.filter=["==","$id",t.id])}));const r=xe.compileStyle(n);for(let t=0;t<n.length;t++)r[t].filter&&(r[t].filter.def=n[t].filter?n[t].filter.value||n[t].filter:void 0),r[t].type=0;const o=[],s=xe.compileStyle(e);for(let t=0;t<e.length;t++)s[t].type=1,s[t].filter.def=e[t].filter?e[t].filter.value||e[t].filter:void 0,s[t].renderPlugin&&o.push(s[t]);this.pluginConfig=r,this.featurePlugins=o,this.styledFeatures=i}T(t){let n=this.O;this.O||(n=this.O={});const e=["","Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon"],i=[];for(const o in t){const s=o;if(!n[o]){const i=[];for(let n=0;n<t[o].types.length;n++){const u=t[o].types[n],c=["all",["==","$layer",s],["==","$type",e[u]]],f={filter:(r=c,new Function("f",\`var p = (f && f.properties || {}); return ${o}ne(r)}\`)),renderPlugin:Oe(u),symbol:Ne(u)};f.filter.def=c,f.type=0,i.push(f)}n[s]=i}i.push(...n[s])}var r;return i}}function Oe(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 Ne(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 Ce(t){if(Array.isArray(t)||!A(t))return{};const n={};for(const e in t){const i=t[e];b(i)?n[e]="string":S(i)?n[e]="number":!0===i||!1===i?n[e]="boolean":Array.isArray(i)?n[e]="array":n[e]="object"}return n}function Le(t){if(!t)return 0;let n=0;for(const e in t){if(("normalTexture"===e||"bumpTexture"===e)&&t[e])return 2;if(e.indexOf("Texture")>0&&t[e])n=1;else if(A(t[e])){const i=Le(t[e]);if(2===i)return i;1===i&&(n=1)}}return n}function Ee(t,n,e,i,r,o){const s={},u=Array.isArray(n)?n:[n];let c=-1;for(let t=0;t<u.length;t++)s[t]=Ue(u[t]),!s[t]&&u[t]&&-1===c&&(c=t);const f=[];for(let n=0;n<u.length;n++){if(!u[n])continue;u[n].index={index:n};let a=t;if(o&&u[n].mergeOnProperty){const i=he.genFnTypes(u[n]);a=ye.mergeLineFeatures(t,u[0],i,e.zoom)}s[n]||n===c?f.push(new i(a,u[n],e).load(r)):f.push({data:{ref:c,symbolIndex:{index:n}}})}return Promise.all(f)}function Ue(t){if(!t)return 0;for(const n in t)if(T(t[n]))return 1;return 0}function $e(t,n,e,i){const r=e.customProperties;if(!r)return t;if(r)for(let t=0;t<r.length;t++)r[t].fn=xe.compileFilter(r[t].filter);for(let e=0;e<r.length;e++)for(let o=0,s=t.length;o<s;o++)if(r[e].fn(t[o],n))for(const t in r[e].properties){const n=r[e].properties[t];k(n)||(i[o]||(i[o]={}),i[o][t]||(i[o][t]=new Set),i[o][t].add(n))}}const je={get:(t,n)=>n in t?t[n]:t.originalFeature[n],has:(t,n)=>n in t||n in t.originalFeature},Be={get:function(t,n){return n in t?t[n]:t[Te][n]},has:(t,n)=>n in t||n in t[Te]},Ve={};function Ge(t){const n={};n.originalFeature=t;const e=new Proxy(n,je);return e.properties=new Proxy({},Be),e.properties[Te]=t.properties||Ve,e}function De(t,n,e){t[n]||(t[n]=new Set),t[n].add(e)}const Xe=[];function ze(t,n,e){if(!t)return Xe;for(const i in t){if(!t[i]||!Se.checkIfZoomFnTypeSymbol(i))continue;if(T(t[i]))De(n,e,t[i].property);else{if("lineGradientProperty"===i){De(n,e,t[i]);continue}if("textName"===i)if(b(t[i])){const r=Fe.resolveVarNames(t[i]);if(r)for(let t=0;t<r.length;t++)De(n,e,r[t])}else if(xe.isExpression(t[i])){const r=[];Fe.resolveExpVarNames(r,t[i]);for(let t=0;t<r.length;t++)De(n,e,r[t])}}const r=t[i].stops;if(r&&r.length)for(let t=0;t<r.length;t++)T(r[t][1])&&De(n,t,r[t][1].property)}return n[e]}function Je(t,n){Ye(t.geometry,n)}function Ye(t,n){if(t)switch(t.type){case"Point":qe(t.coordinates,n);break;case"MultiPoint":case"LineString":Re(t.coordinates,n);break;case"MultiLineString":!function(t,n){for(let e=0,i=t.length;e<i;e++)Re(t[e],n)}(t.coordinates,n);break;case"Polygon":He(t.coordinates,n);break;case"MultiPolygon":!function(t,n){for(let e=0,i=t.length;e<i;e++)He(t[e],n)}(t.coordinates,n);break;case"GeometryCollection":const e=t.geometries.length;for(let i=0;i<e;i++)Ye(t.geometries[i],n)}}function qe(t,n){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function Re(t,n){for(let e=0,i=t.length;e<i;e++)qe(t[e],n)}function He(t,n){t.length&&Re(t[0],n)}function Ze(t,n,e,i,r){We(t,n,e||0,i||t.length-1,r||Qe)}function We(t,n,e,i,r){for(;i>e;){if(i-e>600){var o=i-e+1,s=n-e+1,u=Math.log(o),c=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*c*(o-c)/o)*(s-o/2<0?-1:1);We(t,n,Math.max(e,Math.floor(n-s*c/o+f)),Math.min(i,Math.floor(n+(o-s)*c/o+f)),r)}var a=t[n],l=e,h=i;for(Ke(t,e,n),r(t[i],a)>0&&Ke(t,e,i);l<h;){for(Ke(t,l,h),l++,h--;r(t[l],a)<0;)l++;for(;r(t[h],a)>0;)h--}0===r(t[e],a)?Ke(t,e,h):Ke(t,++h,i),h<=n&&(e=h+1),n<=h&&(i=h-1)}}function Ke(t,n,e){var i=t[n];t[n]=t[e],t[e]=i}function Qe(t,n){return t<n?-1:t>n?1:0}class ti{constructor(t=9){this.N=Math.max(4,t),this.C=Math.max(2,Math.ceil(.4*this.N)),this.clear()}all(){return this.L(this.data,[])}search(t){let n=this.data;const e=[];if(!li(t,n))return e;const i=this.toBBox,r=[];for(;n;){for(let o=0;o<n.children.length;o++){const s=n.children[o],u=n.leaf?i(s):s;li(t,u)&&(n.leaf?e.push(s):ai(t,u)?this.L(s,e):r.push(s))}n=r.pop()}return e}collides(t){let n=this.data;if(!li(t,n))return!1;const e=[];for(;n;){for(let i=0;i<n.children.length;i++){const r=n.children[i],o=n.leaf?this.toBBox(r):r;if(li(t,o)){if(n.leaf||ai(t,o))return!0;e.push(r)}}n=e.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this.C){for(let n=0;n<t.length;n++)this.insert(t[n]);return this}let n=this.U(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this.$(this.data,n);else{if(this.data.height<n.height){const t=this.data;this.data=n,n=t}this.j(n,this.data.height-n.height-1,!0)}else this.data=n;return this}insert(t){return t&&this.j(t,this.data.height-1),this}clear(){return this.data=hi([]),this}remove(t,n){if(!t)return this;let e=this.data;const i=this.toBBox(t),r=[],o=[];let s,u,c;for(;e||r.length;){if(e||(e=r.pop(),u=r[r.length-1],s=o.pop(),c=!0),e.leaf){const i=ni(t,e.children,n);if(-1!==i)return e.children.splice(i,1),r.push(e),this.B(r),this}c||e.leaf||!ai(e,i)?u?(s++,e=u.children[s],c=!1):e=null:(r.push(e),o.push(s),s=0,u=e,e=e.children[0])}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}L(t,n){const e=[];for(;t;)t.leaf?n.push(...t.children):e.push(...t.children),t=e.pop();return n}U(t,n,e,i){const r=e-n+1;let o,s=this.N;if(r<=s)return o=hi(t.slice(n,e+1)),ei(o,this.toBBox),o;i||(i=Math.ceil(Math.log(r)/Math.log(s)),s=Math.ceil(r/Math.pow(s,i-1))),o=hi([]),o.leaf=!1,o.height=i;const u=Math.ceil(r/s),c=u*Math.ceil(Math.sqrt(s));di(t,n,e,c,this.compareMinX);for(let r=n;r<=e;r+=c){const n=Math.min(r+c-1,e);di(t,r,n,u,this.compareMinY);for(let e=r;e<=n;e+=u){const r=Math.min(e+u-1,n);o.children.push(this.U(t,e,r,i-1))}}return ei(o,this.toBBox),o}V(t,n,e,i){for(;i.push(n),!n.leaf&&i.length-1!==e;){let e,i=1/0,s=1/0;for(let u=0;u<n.children.length;u++){const c=n.children[u],f=ui(c),a=(r=t,o=c,(Math.max(o.maxX,r.maxX)-Math.min(o.minX,r.minX))*(Math.max(o.maxY,r.maxY)-Math.min(o.minY,r.minY))-f);a<s?(s=a,i=f<i?f:i,e=c):a===s&&f<i&&(i=f,e=c)}n=e||n.children[0]}var r,o;return n}j(t,n,e){const i=e?t:this.toBBox(t),r=[],o=this.V(i,this.data,n,r);for(o.children.push(t),ri(o,i);n>=0&&r[n].children.length>this.N;)this.G(r,n),n--;this.D(i,r,n)}G(t,n){const e=t[n],i=e.children.length,r=this.C;this.X(e,r,i);const o=this.J(e,r,i),s=hi(e.children.splice(o,e.children.length-o));s.height=e.height,s.leaf=e.leaf,ei(e,this.toBBox),ei(s,this.toBBox),n?t[n-1].children.push(s):this.$(e,s)}$(t,n){this.data=hi([t,n]),this.data.height=t.height+1,this.data.leaf=!1,ei(this.data,this.toBBox)}J(t,n,e){let i,r=1/0,o=1/0;for(let s=n;s<=e-n;s++){const n=ii(t,0,s,this.toBBox),u=ii(t,s,e,this.toBBox),c=fi(n,u),f=ui(n)+ui(u);c<r?(r=c,i=s,o=f<o?f:o):c===r&&f<o&&(o=f,i=s)}return i||e-n}X(t,n,e){const i=t.leaf?this.compareMinX:oi,r=t.leaf?this.compareMinY:si;this.Y(t,n,e,i)<this.Y(t,n,e,r)&&t.children.sort(i)}Y(t,n,e,i){t.children.sort(i);const r=this.toBBox,o=ii(t,0,n,r),s=ii(t,e-n,e,r);let u=ci(o)+ci(s);for(let i=n;i<e-n;i++){const n=t.children[i];ri(o,t.leaf?r(n):n),u+=ci(o)}for(let i=e-n-1;i>=n;i--){const n=t.children[i];ri(s,t.leaf?r(n):n),u+=ci(s)}return u}D(t,n,e){for(let i=e;i>=0;i--)ri(n[i],t)}B(t){for(let n,e=t.length-1;e>=0;e--)0===t[e].children.length?e>0?(n=t[e-1].children,n.splice(n.indexOf(t[e]),1)):this.clear():ei(t[e],this.toBBox)}}function ni(t,n,e){if(!e)return n.indexOf(t);for(let i=0;i<n.length;i++)if(e(t,n[i]))return i;return-1}function ei(t,n){ii(t,0,t.children.length,n,t)}function ii(t,n,e,i,r){r||(r=hi(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let o=n;o<e;o++){const n=t.children[o];ri(r,t.leaf?i(n):n)}return r}function ri(t,n){return t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),t}function oi(t,n){return t.minX-n.minX}function si(t,n){return t.minY-n.minY}function ui(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function ci(t){return t.maxX-t.minX+(t.maxY-t.minY)}function fi(t,n){const e=Math.max(t.minX,n.minX),i=Math.max(t.minY,n.minY),r=Math.min(t.maxX,n.maxX),o=Math.min(t.maxY,n.maxY);return Math.max(0,r-e)*Math.max(0,o-i)}function ai(t,n){return t.minX<=n.minX&&t.minY<=n.minY&&n.maxX<=t.maxX&&n.maxY<=t.maxY}function li(t,n){return n.minX<=t.maxX&&n.minY<=t.maxY&&n.maxX>=t.minX&&n.maxY>=t.minY}function hi(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function di(t,n,e,i,r){const o=[n,e];for(;o.length;){if((e=o.pop())-(n=o.pop())<=i)continue;const s=n+Math.ceil((e-n)/i/2)*i;Ze(t,s,n,e,r),o.push(n,s,s,e)}}class vi{constructor(t=[],n=yi){if(this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this.q(t)}push(t){this.data.push(t),this.length++,this.R(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this.q(0)),t}peek(){return this.data[0]}R(t){const{data:n,compare:e}=this,i=n[t];for(;t>0;){const r=t-1>>1,o=n[r];if(e(i,o)>=0)break;n[t]=o,t=r}n[t]=i}q(t){const{data:n,compare:e}=this,i=this.length>>1,r=n[t];for(;t<i;){let i=1+(t<<1),o=n[i];const s=i+1;if(s<this.length&&e(n[s],o)<0&&(i=s,o=n[s]),e(o,r)>=0)break;n[t]=o,t=i}n[t]=r}}function yi(t,n){return t<n?-1:t>n?1:0}var pi={exports:{}},Mi=function(t,n,e,i){var r=t[0],o=t[1],s=!1;void 0===e&&(e=0),void 0===i&&(i=n.length);for(var u=(i-e)/2,c=0,f=u-1;c<u;f=c++){var a=n[e+2*c+0],l=n[e+2*c+1],h=n[e+2*f+0],d=n[e+2*f+1];l>o!=d>o&&r<(h-a)*(o-l)/(d-l)+a&&(s=!s)}return s},wi=function(t,n,e,i){var r=t[0],o=t[1],s=!1;void 0===e&&(e=0),void 0===i&&(i=n.length);for(var u=i-e,c=0,f=u-1;c<u;f=c++){var a=n[c+e][0],l=n[c+e][1],h=n[f+e][0],d=n[f+e][1];l>o!=d>o&&r<(h-a)*(o-l)/(d-l)+a&&(s=!s)}return s};pi.exports=function(t,n,e,i){return n.length>0&&Array.isArray(n[0])?wi(t,n,e,i):Mi(t,n,e,i)};var mi=pi.exports.nested=wi;pi.exports.flat=Mi;const gi=11102230246251565e-32,Pi=134217729,xi=(3+8*gi)*gi;function bi(t,n,e,i,r){let o,s,u,c,f=n[0],a=i[0],l=0,h=0;a>f==a>-f?(o=f,f=n[++l]):(o=a,a=i[++h]);let d=0;if(l<t&&h<e)for(a>f==a>-f?(s=f+o,u=o-(s-f),f=n[++l]):(s=a+o,u=o-(s-a),a=i[++h]),o=s,0!==u&&(r[d++]=u);l<t&&h<e;)a>f==a>-f?(s=o+f,c=s-o,u=o-(s-c)+(f-c),f=n[++l]):(s=o+a,c=s-o,u=o-(s-c)+(a-c),a=i[++h]),o=s,0!==u&&(r[d++]=u);for(;l<t;)s=o+f,c=s-o,u=o-(s-c)+(f-c),f=n[++l],o=s,0!==u&&(r[d++]=u);for(;h<e;)s=o+a,c=s-o,u=o-(s-c)+(a-c),a=i[++h],o=s,0!==u&&(r[d++]=u);return 0===o&&0!==d||(r[d++]=o),d}function Si(t){return new Float64Array(t)}const Fi=33306690738754716e-32,Ai=22204460492503146e-32,ki=11093356479670487e-47,Ti=Si(4),_i=Si(8),Ii=Si(12),Oi=Si(16),Ni=Si(4);function Ci(t,n,e,i,r,o){const s=(n-o)*(e-r),u=(t-r)*(i-o),c=s-u;if(0===s||0===u||s>0!=u>0)return c;const f=Math.abs(s+u);return Math.abs(c)>=Fi*f?c:-function(t,n,e,i,r,o,s){let u,c,f,a,l,h,d,v,y,p,M,w,m,g,P,x,b,S;const F=t-r,A=e-r,k=n-o,T=i-o;g=F*T,h=Pi*F,d=h-(h-F),v=F-d,h=Pi*T,y=h-(h-T),p=T-y,P=v*p-(g-d*y-v*y-d*p),x=k*A,h=Pi*k,d=h-(h-k),v=k-d,h=Pi*A,y=h-(h-A),p=A-y,b=v*p-(x-d*y-v*y-d*p),M=P-b,l=P-M,Ti[0]=P-(M+l)+(l-b),w=g+M,l=w-g,m=g-(w-l)+(M-l),M=m-x,l=m-M,Ti[1]=m-(M+l)+(l-x),S=w+M,l=S-w,Ti[2]=w-(S-l)+(M-l),Ti[3]=S;let _=function(t,n){let e=n[0];for(let i=1;i<t;i++)e+=n[i];return e}(4,Ti),I=Ai*s;if(_>=I||-_>=I)return _;if(l=t-F,u=t-(F+l)+(l-r),l=e-A,f=e-(A+l)+(l-r),l=n-k,c=n-(k+l)+(l-o),l=i-T,a=i-(T+l)+(l-o),0===u&&0===c&&0===f&&0===a)return _;if(I=ki*s+xi*Math.abs(_),_+=F*a+T*u-(k*f+A*c),_>=I||-_>=I)return _;g=u*T,h=Pi*u,d=h-(h-u),v=u-d,h=Pi*T,y=h-(h-T),p=T-y,P=v*p-(g-d*y-v*y-d*p),x=c*A,h=Pi*c,d=h-(h-c),v=c-d,h=Pi*A,y=h-(h-A),p=A-y,b=v*p-(x-d*y-v*y-d*p),M=P-b,l=P-M,Ni[0]=P-(M+l)+(l-b),w=g+M,l=w-g,m=g-(w-l)+(M-l),M=m-x,l=m-M,Ni[1]=m-(M+l)+(l-x),S=w+M,l=S-w,Ni[2]=w-(S-l)+(M-l),Ni[3]=S;const O=bi(4,Ti,4,Ni,_i);g=F*a,h=Pi*F,d=h-(h-F),v=F-d,h=Pi*a,y=h-(h-a),p=a-y,P=v*p-(g-d*y-v*y-d*p),x=k*f,h=Pi*k,d=h-(h-k),v=k-d,h=Pi*f,y=h-(h-f),p=f-y,b=v*p-(x-d*y-v*y-d*p),M=P-b,l=P-M,Ni[0]=P-(M+l)+(l-b),w=g+M,l=w-g,m=g-(w-l)+(M-l),M=m-x,l=m-M,Ni[1]=m-(M+l)+(l-x),S=w+M,l=S-w,Ni[2]=w-(S-l)+(M-l),Ni[3]=S;const N=bi(O,_i,4,Ni,Ii);g=u*a,h=Pi*u,d=h-(h-u),v=u-d,h=Pi*a,y=h-(h-a),p=a-y,P=v*p-(g-d*y-v*y-d*p),x=c*f,h=Pi*c,d=h-(h-c),v=c-d,h=Pi*f,y=h-(h-f),p=f-y,b=v*p-(x-d*y-v*y-d*p),M=P-b,l=P-M,Ni[0]=P-(M+l)+(l-b),w=g+M,l=w-g,m=g-(w-l)+(M-l),M=m-x,l=m-M,Ni[1]=m-(M+l)+(l-x),S=w+M,l=S-w,Ni[2]=w-(S-l)+(M-l),Ni[3]=S;const C=bi(N,Ii,4,Ni,Oi);return Oi[C-1]}(t,n,e,i,r,o,f)}function Li(t,n,e){n=Math.max(0,void 0===n?2:n),e=e||0;var i=function(t){for(var n=t[0],e=t[0],i=t[0],r=t[0],o=0;o<t.length;o++){var s=t[o];s[0]<n[0]&&(n=s),s[0]>i[0]&&(i=s),s[1]<e[1]&&(e=s),s[1]>r[1]&&(r=s)}var u=[n,e,i,r],c=u.slice();for(o=0;o<t.length;o++)mi(t[o],u)||c.push(t[o]);return function(t){t.sort(Yi);for(var n=[],e=0;e<t.length;e++){for(;n.length>=2&&Vi(n[n.length-2],n[n.length-1],t[e])<=0;)n.pop();n.push(t[e])}for(var i=[],r=t.length-1;r>=0;r--){for(;i.length>=2&&Vi(i[i.length-2],i[i.length-1],t[r])<=0;)i.pop();i.push(t[r])}return i.pop(),n.pop(),n.concat(i)}(c)}(t),r=new ti(16);r.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},r.compareMinX=function(t,n){return t[0]-n[0]},r.compareMinY=function(t,n){return t[1]-n[1]},r.load(t);for(var o,s=[],u=0;u<i.length;u++){var c=i[u];r.remove(c),o=Di(c,o),s.push(o)}var f=new ti(16);for(u=0;u<s.length;u++)f.insert(Gi(s[u]));for(var a=n*n,l=e*e;s.length;){var h=s.shift(),d=h.p,v=h.next.p,y=Xi(d,v);if(!(y<l)){var p=y/a;(c=Ei(r,h.prev.p,d,v,h.next.next.p,p,f))&&Math.min(Xi(c,d),Xi(c,v))<=p&&(s.push(h),s.push(Di(c,h)),r.remove(c),f.remove(h),f.insert(Gi(h)),f.insert(Gi(h.next)))}}h=o;var M=[];do{M.push(h.p),h=h.next}while(h!==o);return M.push(h.p),M}function Ei(t,n,e,i,r,o,s){for(var u=new vi([],Ui),c=t.data;c;){for(var f=0;f<c.children.length;f++){var a=c.children[f],l=c.leaf?zi(a,e,i):$i(e,i,a);l>o||u.push({node:a,dist:l})}for(;u.length&&!u.peek().node.children;){var h=u.pop(),d=h.node,v=zi(d,n,e),y=zi(d,i,r);if(h.dist<v&&h.dist<y&&Bi(e,d,s)&&Bi(i,d,s))return d}(c=u.pop())&&(c=c.node)}return null}function Ui(t,n){return t.dist-n.dist}function $i(t,n,e){if(ji(t,e)||ji(n,e))return 0;var i=Ji(t[0],t[1],n[0],n[1],e.minX,e.minY,e.maxX,e.minY);if(0===i)return 0;var r=Ji(t[0],t[1],n[0],n[1],e.minX,e.minY,e.minX,e.maxY);if(0===r)return 0;var o=Ji(t[0],t[1],n[0],n[1],e.maxX,e.minY,e.maxX,e.maxY);if(0===o)return 0;var s=Ji(t[0],t[1],n[0],n[1],e.minX,e.maxY,e.maxX,e.maxY);return 0===s?0:Math.min(i,r,o,s)}function ji(t,n){return t[0]>=n.minX&&t[0]<=n.maxX&&t[1]>=n.minY&&t[1]<=n.maxY}function Bi(t,n,e){for(var i,r,o,s,u=Math.min(t[0],n[0]),c=Math.min(t[1],n[1]),f=Math.max(t[0],n[0]),a=Math.max(t[1],n[1]),l=e.search({minX:u,minY:c,maxX:f,maxY:a}),h=0;h<l.length;h++)if(i=l[h].p,r=l[h].next.p,o=t,i!==(s=n)&&r!==o&&Vi(i,r,o)>0!=Vi(i,r,s)>0&&Vi(o,s,i)>0!=Vi(o,s,r)>0)return!1;return!0}function Vi(t,n,e){return Ci(t[0],t[1],n[0],n[1],e[0],e[1])}function Gi(t){var n=t.p,e=t.next.p;return t.minX=Math.min(n[0],e[0]),t.minY=Math.min(n[1],e[1]),t.maxX=Math.max(n[0],e[0]),t.maxY=Math.max(n[1],e[1]),t}function Di(t,n){var e={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return n?(e.next=n.next,e.prev=n,n.next.prev=e,n.next=e):(e.prev=e,e.next=e),e}function Xi(t,n){var e=t[0]-n[0],i=t[1]-n[1];return e*e+i*i}function zi(t,n,e){var i=n[0],r=n[1],o=e[0]-i,s=e[1]-r;if(0!==o||0!==s){var u=((t[0]-i)*o+(t[1]-r)*s)/(o*o+s*s);u>1?(i=e[0],r=e[1]):u>0&&(i+=o*u,r+=s*u)}return(o=t[0]-i)*o+(s=t[1]-r)*s}function Ji(t,n,e,i,r,o,s,u){var c,f,a,l,h=e-t,d=i-n,v=s-r,y=u-o,p=t-r,M=n-o,w=h*h+d*d,m=h*v+d*y,g=v*v+y*y,P=h*p+d*M,x=v*p+y*M,b=w*g-m*m,S=b,F=b;0===b?(f=0,S=1,l=x,F=g):(l=w*x-m*P,(f=m*x-g*P)<0?(f=0,l=x,F=g):f>S&&(f=S,l=x+m,F=g)),l<0?(l=0,-P<0?f=0:-P>w?f=S:(f=-P,S=w)):l>F&&(l=F,-P+m<0?f=0:-P+m>w?f=S:(f=-P+m,S=w));var A=(1-(a=0===l?0:l/F))*r+a*s-((1-(c=0===f?0:f/S))*t+c*e),k=(1-a)*o+a*u-((1-c)*n+c*i);return A*A+k*k}function Yi(t,n){return t[0]===n[0]?t[1]-n[1]:t[0]-n[0]}const{PackUtil:qi}=en();class Ri{constructor(t,n){this.x=t,this.y=n}clone(){return new Ri(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 Ri(this.x-t.x,this.y-t.y)}distance(t){const n=this.x-t.x,e=this.y-t.y;return Math.sqrt(n*n+e*e)}dot(t){return this.x*t.x+this.y*t.y}equals(t){return this.x===t.x&&this.y===t.y}orthogonal(){return new Ri(this.y,-this.x)}}function Hi(t,n,e,i){const r=n.x*i.y-n.y*i.x,o=e.x-t.x,s=e.y-t.y,u=(o*i.y-s*i.x)/r;return new Ri(t.x+u*n.x,t.y+u*n.y)}const Zi=[],Wi=[];function Ki(t){if(S(t[0]&&t[0].x)){const n=[];let e=0;for(let i=0;i<t.length;i++)Wi[e]?(Wi[e][0]=t[i].x,Wi[e][1]=t[i].y):Wi[e]=[t[i].x,t[i].y],n.push(Wi[e]),e++;t=n}try{const n=Li(t,1/0);let e=[1/0,1/0],i=[-1/0,-1/0];for(let t=0;t<n.length;t++)n[t][0]<e[0]&&(e[0]=n[t][0]),n[t][0]>i[0]&&(i[0]=n[t][0]),n[t][1]<e[1]&&(e[1]=n[t][1]),n[t][1]>i[1]&&(i[1]=n[t][1]);const r=[];let o=[],s=0;for(let t=0;t<n.length;t++)t===n.length-1&&n[t][0]===n[0][0]&&n[t][1]===n[0][1]||(gt(r,n[t],"EPSG:3857"),Zi[s]?(Zi[s].x=r[0],Zi[s].y=r[1]):Zi[s]=new Ri(r[0],r[1]),o.push(Zi[s]),s++);qi.calculateSignedArea(o)<0&&(o=o.reverse());const u=function(t){let n,e=Number.MAX_VALUE;const i=function(t,i,r,o,s,u,c,f){var a=Hi(t,i,s,u),l=Hi(r,o,s,u),h=Hi(c,f,t,i),d=Hi(c,f,r,o),v=a.distance(l)*a.distance(h);0!==v&&v<e&&(n=[a,h,d,l],e=v)};var r=[];for(let n=0;n<t.length;n++)r.push(t[(n+1)%t.length].diff(t[n])),r[n].normalize();var o,s,u,c,f=new Ri(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),a=new Ri(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let n=0;n<t.length;n++){var l=t[n];l.x<f.x&&(f.x=l.x,o=n),l.x>a.x&&(a.x=l.x,s=n),l.y<f.y&&(f.y=l.y,c=n),l.y>a.y&&(a.y=l.y,u=n)}var h=new Ri(0,-1),d=new Ri(0,1),v=new Ri(-1,0),y=new Ri(1,0);for(let n=0;n<t.length;n++){var p=[Math.acos(h.dot(r[o])),Math.acos(d.dot(r[s])),Math.acos(v.dot(r[u])),Math.acos(y.dot(r[c]))];switch(p.indexOf(Math.min.apply(Math,p))){case 0:(d=(h=r[o].clone()).clone()).negate(),(y=(v=h.orthogonal()).clone()).negate(),o=(o+1)%t.length;break;case 1:(h=(d=r[s].clone()).clone()).negate(),(y=(v=h.orthogonal()).clone()).negate(),s=(s+1)%t.length;break;case 2:(y=(v=r[u].clone()).clone()).negate(),(d=(h=y.orthogonal()).clone()).negate(),u=(u+1)%t.length;break;case 3:(v=(y=r[c].clone()).clone()).negate(),(d=(h=y.orthogonal()).clone()).negate(),c=(c+1)%t.length}i(t[o],h,t[s],d,t[u],v,t[c],y)}return n}(o);if(!u||4!==u.length)return null;const c=u[0].distance(u[1]),f=u[1].distance(u[2]),a=u.map((t=>[t.x,t.y]));return a.push(+(f>c)),a}catch(t){return null}}const Qi=[];function tr(t,n){const e=Array.isArray(t&&t[0]&&t[0][0]);for(let i=0;i<t.length;i++)e?t[i]=tr(t[i]):(gt(Qi,t[i],n),t[i][0]=Qi[0],t[i][1]=Qi[1]);return t}const{PackUtil:nr}=en();class er extends Ie{constructor(t,n,e,i,r,o){super(t,n,e,i,r),(n=n||{}).extent||(n.extent=8192),this.setData(n.data,o)}setData(t,n){if(delete this.index,function(t){if(!t)return!0;if(Array.isArray(t)&&!t.length)return!0;if(t.features&&!t.features.length)return!0;return!1}(t))return this.empty=!0,void n();const e={maxZoom:24,tolerance:this.options.simplifyTolerance,extent:this.options.extent,buffer: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&&(e.projection=this.options.projection,"EPSG:4490"===e.projection&&(e.projection="EPSG:4326")),b(t)&&"{"!=t.substring(0,1)||t.url){const i=t.url?t.url:t;I.getJSON(i,t.url?t:{},((t,r)=>{if(t&&(console.error("Failed to fetch geojson:"+i),n(t)),!r)return void n(null,{extent:null,idMap:{}});let o=r;if(this.options.convertFn){o=new Function("data",this.options.convertFn+"\\nreturn convert(data)")(o)}const s=Array.isArray(o)?o:o.features;this.H(s);const{sample1000:u,idMap:c}=this.Z(s);this.W(u,c,o,e,n)}))}else{"string"==typeof t&&(t=JSON.parse(t));const i=Array.isArray(t)?t:t.features,r=i&&i.length;this.H(i);let o=i;if(i&&r>1e3){o=[];for(let t=0;t<r;t++)ir(i[t],o,t,r)}this.W(o,null,t,e,n)}}H(t){if(this.options.generateOMBB&&t)for(let n=0;n<t.length;n++){const e=t[n];if(e&&e.geometry&&e.geometry.coordinates)if("Polygon"===e.geometry.type){const t=e.geometry.coordinates[0];if(!t)continue;const n=Ki(t,t.length);e.properties=e.properties||{},e.properties[nn]=n}else if("MultiPolygon"===e.geometry.type){const t=e.geometry.coordinates;for(let n=0;n<t.length;n++){if(!t[n])continue;const i=t[n][0];if(!i)continue;const r=Ki(i,i.length);e.properties=e.properties||{},e.properties[nn]=e.properties[nn]||[],e.properties[nn][n]=r}}}}W(t,n,e,i,r){try{const o=t&&t.length?function(t){let n=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];switch(t.type){case"FeatureCollection":const e=t.features.length;for(let i=0;i<e;i++)Je(t.features[i],n);break;case"Feature":Je(t,n);break;default:Ye(t,n)}return n}({type:"FeatureCollection",features:t}):null;this.index=function(t,n){return new st(t,n)}(e,this.options.geojsonvt||i),r(null,{extent:o,idMap:n})}catch(t){console.warn(t),r({error:t.message})}}Z(t){const n=[],e={};let i=0;const r=this.options.featureIdProperty;if(t){const o=t.length;t.forEach(((t,s)=>{!function(t,o,s){if(t&&("Feature"!==t.type||t.geometry)){if(S(t.id)||(t.id=i++),r){let n=r;A(r)&&(n=r[t.layer||"0"]),t.id=t.properties[n]}e[t.id]=x({},t),t.geometry?(e[t.id].geometry=x({},t.geometry),e[t.id].geometry.coordinates=null):t.coordinates&&(e[t.id].coordinates=null),ir(t,n,o,s)}}(t,s,o)}))}return{sample1000:n,idMap:e}}getTileFeatures(t,n){const e=t.tileInfo,i=[];if(!this.index)return this.empty?(setTimeout((function(){n(null,i,[])}),1),1):(setTimeout((function(){n({loading:!0})}),1),1);const r=this.index.getTile(e.z,e.x,e.y);if(!r||0===r.features.length)return setTimeout((function(){n(null,i,[])}),1),1;const o=[];for(let t=0,n=r.features.length;t<n;t++){const n=r.features[t];let e=n.layer;void 0===e&&(e="0"),o[e]={types:{}};o[e].types[n.type]=1,n.tags=n.tags||{},n.geometry.converted||(nr.convertGeometry(n),n.geometry.converted=1),i.push({type:n.type,layer:e,id:n.id,geometry:n.geometry,properties:n.tags,extent:this.options.extent})}for(const t in o)o[t].types=Object.keys(o[t].types).map((t=>+t));return setTimeout((function(){n(null,i,o)}),1),1}onRemove(){super.onRemove(),delete this.index}}function ir(t,n,e,i){const r=Math.floor(i/998);(0===e||e===i-1||(0===r||e%r==0)&&n.length<999)&&n.push(t)}var rr={\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nread:function(t,n,e,i,r){var o,s,u=8*r-i-1,c=(1<<u)-1,f=c>>1,a=-7,l=e?r-1:0,h=e?-1:1,d=t[n+l];for(l+=h,o=d&(1<<-a)-1,d>>=-a,a+=u;a>0;o=256*o+t[n+l],l+=h,a-=8);for(s=o&(1<<-a)-1,o>>=-a,a+=i;a>0;s=256*s+t[n+l],l+=h,a-=8);if(0===o)o=1-f;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),o-=f}return(d?-1:1)*s*Math.pow(2,o-i)},write:function(t,n,e,i,r,o){var s,u,c,f=8*o-r-1,a=(1<<f)-1,l=a>>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:o-1,v=i?1:-1,y=n<0||0===n&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(u=isNaN(n)?1:0,s=a):(s=Math.floor(Math.log(n)/Math.LN2),n*(c=Math.pow(2,-s))<1&&(s--,c*=2),(n+=s+l>=1?h/c:h*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=a?(u=0,s=a):s+l>=1?(u=(n*c-1)*Math.pow(2,r),s+=l):(u=n*Math.pow(2,l-1)*Math.pow(2,r),s=0));r>=8;t[e+d]=255&u,d+=v,u/=256,r-=8);for(s=s<<r|u,f+=r;f>0;t[e+d]=255&s,d+=v,s/=256,f-=8);t[e+d-v]|=128*y}},or=ur,sr=rr;function ur(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}ur.Varint=0,ur.Fixed64=1,ur.Bytes=2,ur.Fixed32=5;var cr=4294967296,fr=1/cr,ar="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function lr(t){return t.type===ur.Bytes?t.readVarint()+t.pos:t.pos+1}function hr(t,n,e){return e?4294967296*n+(t>>>0):4294967296*(n>>>0)+(t>>>0)}function dr(t,n,e){var i=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));e.realloc(i);for(var r=e.pos-1;r>=t;r--)e.buf[r+i]=e.buf[r]}function vr(t,n){for(var e=0;e<t.length;e++)n.writeVarint(t[e])}function yr(t,n){for(var e=0;e<t.length;e++)n.writeSVarint(t[e])}function pr(t,n){for(var e=0;e<t.length;e++)n.writeFloat(t[e])}function Mr(t,n){for(var e=0;e<t.length;e++)n.writeDouble(t[e])}function wr(t,n){for(var e=0;e<t.length;e++)n.writeBoolean(t[e])}function mr(t,n){for(var e=0;e<t.length;e++)n.writeFixed32(t[e])}function gr(t,n){for(var e=0;e<t.length;e++)n.writeSFixed32(t[e])}function Pr(t,n){for(var e=0;e<t.length;e++)n.writeFixed64(t[e])}function xr(t,n){for(var e=0;e<t.length;e++)n.writeSFixed64(t[e])}function br(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+16777216*t[n+3]}function Sr(t,n,e){t[e]=n,t[e+1]=n>>>8,t[e+2]=n>>>16,t[e+3]=n>>>24}function Fr(t,n){return(t[n]|t[n+1]<<8|t[n+2]<<16)+(t[n+3]<<24)}ur.prototype={destroy:function(){this.buf=null},readFields:function(t,n,e){for(e=e||this.length;this.pos<e;){var i=this.readVarint(),r=i>>3,o=this.pos;this.type=7&i,t(r,n,this),this.pos===o&&this.skip(i)}return n},readMessage:function(t,n){return this.readFields(t,n,this.readVarint()+this.pos)},readFixed32:function(){var t=br(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Fr(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=br(this.buf,this.pos)+br(this.buf,this.pos+4)*cr;return this.pos+=8,t},readSFixed64:function(){var t=br(this.buf,this.pos)+Fr(this.buf,this.pos+4)*cr;return this.pos+=8,t},readFloat:function(){var t=sr.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=sr.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var n,e,i=this.buf;return n=127&(e=i[this.pos++]),e<128?n:(n|=(127&(e=i[this.pos++]))<<7,e<128?n:(n|=(127&(e=i[this.pos++]))<<14,e<128?n:(n|=(127&(e=i[this.pos++]))<<21,e<128?n:function(t,n,e){var i,r,o=e.buf;if(r=o[e.pos++],i=(112&r)>>4,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(127&r)<<3,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(127&r)<<10,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(127&r)<<17,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(127&r)<<24,r<128)return hr(t,i,n);if(r=o[e.pos++],i|=(1&r)<<31,r<128)return hr(t,i,n);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(e=i[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,n=this.pos;return this.pos=t,t-n>=12&&ar?function(t,n,e){return ar.decode(t.subarray(n,e))}(this.buf,n,t):function(t,n,e){var i="",r=n;for(;r<e;){var o,s,u,c=t[r],f=null,a=c>239?4:c>223?3:c>191?2:1;if(r+a>e)break;1===a?c<128&&(f=c):2===a?128==(192&(o=t[r+1]))&&(f=(31&c)<<6|63&o)<=127&&(f=null):3===a?(o=t[r+1],s=t[r+2],128==(192&o)&&128==(192&s)&&((f=(15&c)<<12|(63&o)<<6|63&s)<=2047||f>=55296&&f<=57343)&&(f=null)):4===a&&(o=t[r+1],s=t[r+2],u=t[r+3],128==(192&o)&&128==(192&s)&&128==(192&u)&&((f=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&u)<=65535||f>=1114112)&&(f=null)),null===f?(f=65533,a=1):f>65535&&(f-=65536,i+=String.fromCharCode(f>>>10&1023|55296),f=56320|1023&f),i+=String.fromCharCode(f),r+=a}return i}(this.buf,n,t)},readBytes:function(){var t=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,t);return this.pos=t,n},readPackedVarint:function(t,n){if(this.type!==ur.Bytes)return t.push(this.readVarint(n));var e=lr(this);for(t=t||[];this.pos<e;)t.push(this.readVarint(n));return t},readPackedSVarint:function(t){if(this.type!==ur.Bytes)return t.push(this.readSVarint());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==ur.Bytes)return t.push(this.readBoolean());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==ur.Bytes)return t.push(this.readFloat());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==ur.Bytes)return t.push(this.readDouble());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==ur.Bytes)return t.push(this.readFixed32());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==ur.Bytes)return t.push(this.readSFixed32());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==ur.Bytes)return t.push(this.readFixed64());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==ur.Bytes)return t.push(this.readSFixed64());var n=lr(this);for(t=t||[];this.pos<n;)t.push(this.readSFixed64());return t},skip:function(t){var n=7&t;if(n===ur.Varint)for(;this.buf[this.pos++]>127;);else if(n===ur.Bytes)this.pos=this.readVarint()+this.pos;else if(n===ur.Fixed32)this.pos+=4;else{if(n!==ur.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(t,n){this.writeVarint(t<<3|n)},realloc:function(t){for(var n=this.length||16;n<this.pos+t;)n*=2;if(n!==this.length){var e=new Uint8Array(n);e.set(this.buf),this.buf=e,this.length=n}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Sr(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Sr(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Sr(this.buf,-1&t,this.pos),Sr(this.buf,Math.floor(t*fr),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Sr(this.buf,-1&t,this.pos),Sr(this.buf,Math.floor(t*fr),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,n){var e,i;t>=0?(e=t%4294967296|0,i=t/4294967296|0):(i=~(-t/4294967296),4294967295^(e=~(-t%4294967296))?e=e+1|0:(e=0,i=i+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");n.realloc(10),function(t,n,e){e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos]=127&t}(e,0,n),function(t,n){var e=(7&t)<<4;if(n.buf[n.pos++]|=e|((t>>>=3)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(n.buf[n.pos++]=127&t|((t>>>=7)?128:0),!t)return;n.buf[n.pos++]=127&t}(i,n)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var n=this.pos;this.pos=function(t,n,e){for(var i,r,o=0;o<n.length;o++){if((i=n.charCodeAt(o))>55295&&i<57344){if(!r){i>56319||o+1===n.length?(t[e++]=239,t[e++]=191,t[e++]=189):r=i;continue}if(i<56320){t[e++]=239,t[e++]=191,t[e++]=189,r=i;continue}i=r-55296<<10|i-56320|65536,r=null}else r&&(t[e++]=239,t[e++]=191,t[e++]=189,r=null);i<128?t[e++]=i:(i<2048?t[e++]=i>>6|192:(i<65536?t[e++]=i>>12|224:(t[e++]=i>>18|240,t[e++]=i>>12&63|128),t[e++]=i>>6&63|128),t[e++]=63&i|128)}return e}(this.buf,t,this.pos);var e=this.pos-n;e>=128&&dr(n,e,this),this.pos=n-1,this.writeVarint(e),this.pos+=e},writeFloat:function(t){this.realloc(4),sr.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),sr.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var n=t.length;this.writeVarint(n),this.realloc(n);for(var e=0;e<n;e++)this.buf[this.pos++]=t[e]},writeRawMessage:function(t,n){this.pos++;var e=this.pos;t(n,this);var i=this.pos-e;i>=128&&dr(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeMessage:function(t,n,e){this.writeTag(t,ur.Bytes),this.writeRawMessage(n,e)},writePackedVarint:function(t,n){n.length&&this.writeMessage(t,vr,n)},writePackedSVarint:function(t,n){n.length&&this.writeMessage(t,yr,n)},writePackedBoolean:function(t,n){n.length&&this.writeMessage(t,wr,n)},writePackedFloat:function(t,n){n.length&&this.writeMessage(t,pr,n)},writePackedDouble:function(t,n){n.length&&this.writeMessage(t,Mr,n)},writePackedFixed32:function(t,n){n.length&&this.writeMessage(t,mr,n)},writePackedSFixed32:function(t,n){n.length&&this.writeMessage(t,gr,n)},writePackedFixed64:function(t,n){n.length&&this.writeMessage(t,Pr,n)},writePackedSFixed64:function(t,n){n.length&&this.writeMessage(t,xr,n)},writeBytesField:function(t,n){this.writeTag(t,ur.Bytes),this.writeBytes(n)},writeFixed32Field:function(t,n){this.writeTag(t,ur.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(t,n){this.writeTag(t,ur.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(t,n){this.writeTag(t,ur.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(t,n){this.writeTag(t,ur.Fixed64),this.writeSFixed64(n)},writeVarintField:function(t,n){this.writeTag(t,ur.Varint),this.writeVarint(n)},writeSVarintField:function(t,n){this.writeTag(t,ur.Varint),this.writeSVarint(n)},writeStringField:function(t,n){this.writeTag(t,ur.Bytes),this.writeString(n)},writeFloatField:function(t,n){this.writeTag(t,ur.Fixed32),this.writeFloat(n)},writeDoubleField:function(t,n){this.writeTag(t,ur.Fixed64),this.writeDouble(n)},writeBooleanField:function(t,n){this.writeVarintField(t,Boolean(n))}};var Ar=Ft(or),kr=Tr;function Tr(t,n){this.x=t,this.y=n}Tr.prototype={clone:function(){return new Tr(this.x,this.y)},add:function(t){return this.clone().K(t)},sub:function(t){return this.clone().tt(t)},multByPoint:function(t){return this.clone().nt(t)},divByPoint:function(t){return this.clone().et(t)},mult:function(t){return this.clone().it(t)},div:function(t){return this.clone().rt(t)},rotate:function(t){return this.clone().ot(t)},rotateAround:function(t,n){return this.clone().st(t,n)},matMult:function(t){return this.clone().ut(t)},unit:function(){return this.clone().ct()},perp:function(){return this.clone().ft()},round:function(){return this.clone().lt()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var n=t.x-this.x,e=t.y-this.y;return n*n+e*e},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},ut:function(t){var n=t[0]*this.x+t[1]*this.y,e=t[2]*this.x+t[3]*this.y;return this.x=n,this.y=e,this},K:function(t){return this.x+=t.x,this.y+=t.y,this},tt:function(t){return this.x-=t.x,this.y-=t.y,this},it:function(t){return this.x*=t,this.y*=t,this},rt:function(t){return this.x/=t,this.y/=t,this},nt:function(t){return this.x*=t.x,this.y*=t.y,this},et:function(t){return this.x/=t.x,this.y/=t.y,this},ct:function(){return this.rt(this.mag()),this},ft:function(){var t=this.y;return this.y=this.x,this.x=-t,this},ot:function(t){var n=Math.cos(t),e=Math.sin(t),i=n*this.x-e*this.y,r=e*this.x+n*this.y;return this.x=i,this.y=r,this},st:function(t,n){var e=Math.cos(t),i=Math.sin(t),r=n.x+e*(this.x-n.x)-i*(this.y-n.y),o=n.y+i*(this.x-n.x)+e*(this.y-n.y);return this.x=r,this.y=o,this},lt:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Tr.convert=function(t){return t instanceof Tr?t:Array.isArray(t)?new Tr(t[0],t[1]):t};var _r=kr,Ir=Or;function Or(t,n,e,i,r){this.properties={},this.extent=e,this.type=0,this.ht=t,this.dt=-1,this.vt=i,this.yt=r,t.readFields(Nr,this,n)}function Nr(t,n,e){1==t?n.id=e.readVarint():2==t?function(t,n){var e=t.readVarint()+t.pos;for(;t.pos<e;){var i=n.vt[t.readVarint()],r=n.yt[t.readVarint()];n.properties[i]=r}}(e,n):3==t?n.type=e.readVarint():4==t&&(n.dt=e.pos)}function Cr(t){for(var n,e,i=0,r=0,o=t.length,s=o-1;r<o;s=r++)n=t[r],i+=((e=t[s]).x-n.x)*(n.y+e.y);return i}Or.types=["Unknown","Point","LineString","Polygon"],Or.prototype.loadGeometry=function(){var t=this.ht;t.pos=this.dt;for(var n,e=t.readVarint()+t.pos,i=1,r=0,o=0,s=0,u=[];t.pos<e;){if(r<=0){var c=t.readVarint();i=7&c,r=c>>3}if(r--,1===i||2===i)o+=t.readSVarint(),s+=t.readSVarint(),1===i&&(n&&u.push(n),n=[]),n.push(new _r(o,s));else{if(7!==i)throw new Error("unknown command "+i);n&&n.push(n[0].clone())}}return n&&u.push(n),u},Or.prototype.bbox=function(){var t=this.ht;t.pos=this.dt;for(var n=t.readVarint()+t.pos,e=1,i=0,r=0,o=0,s=1/0,u=-1/0,c=1/0,f=-1/0;t.pos<n;){if(i<=0){var a=t.readVarint();e=7&a,i=a>>3}if(i--,1===e||2===e)(r+=t.readSVarint())<s&&(s=r),r>u&&(u=r),(o+=t.readSVarint())<c&&(c=o),o>f&&(f=o);else if(7!==e)throw new Error("unknown command "+e)}return[s,c,u,f]},Or.prototype.toGeoJSON=function(t,n,e){var i,r,o=this.extent*Math.pow(2,e),s=this.extent*t,u=this.extent*n,c=this.loadGeometry(),f=Or.types[this.type];function a(t){for(var n=0;n<t.length;n++){var e=t[n],i=180-360*(e.y+u)/o;t[n]=[360*(e.x+s)/o-180,360/Math.PI*Math.atan(Math.exp(i*Math.PI/180))-90]}}switch(this.type){case 1:var l=[];for(i=0;i<c.length;i++)l[i]=c[i][0];a(c=l);break;case 2:for(i=0;i<c.length;i++)a(c[i]);break;case 3:for(c=function(t){var n=t.length;if(n<=1)return[t];for(var e,i,r=[],o=0;o<n;o++){var s=Cr(t[o]);0!==s&&(void 0===i&&(i=s<0),i===s<0?(e&&r.push(e),e=[t[o]]):e.push(t[o]))}e&&r.push(e);return r}(c),i=0;i<c.length;i++)for(r=0;r<c[i].length;r++)a(c[i][r])}1===c.length?c=c[0]:f="Multi"+f;var h={type:"Feature",geometry:{type:f,coordinates:c},properties:this.properties};return"id"in this&&(h.id=this.id),h};var Lr=Ir,Er=Ur;function Ur(t,n){this.version=1,this.name=null,this.extent=4096,this.length=0,this.ht=t,this.vt=[],this.yt=[],this.Mt=[],t.readFields($r,this,n),this.length=this.Mt.length}function $r(t,n,e){15===t?n.version=e.readVarint():1===t?n.name=e.readString():5===t?n.extent=e.readVarint():2===t?n.Mt.push(e.pos):3===t?n.vt.push(e.readString()):4===t&&n.yt.push(function(t){var n=null,e=t.readVarint()+t.pos;for(;t.pos<e;){var i=t.readVarint()>>3;n=1===i?t.readString():2===i?t.readFloat():3===i?t.readDouble():4===i?t.readVarint64():5===i?t.readVarint():6===i?t.readSVarint():7===i?t.readBoolean():null}return n}(e))}Ur.prototype.feature=function(t){if(t<0||t>=this.Mt.length)throw new Error("feature index out of bounds");this.ht.pos=this.Mt[t];var n=this.ht.readVarint()+this.ht.pos;return new Lr(this.ht,n,this.extent,this.vt,this.yt)};var jr=Er,Br=function(t,n){this.layers=t.readFields(Vr,{},n)};function Vr(t,n,e){if(3===t){var i=new jr(e,e.readVarint()+e.pos);i.length&&(n[i.name]=i)}}var Gr=Br;const Dr=2;class Xr extends Ie{constructor(t,n,e,i,r,o){super(t,n,e,i,r),n=n||{},o()}getTileFeatures(t,n){const e=t.tileInfo.url,i=t.fetchOptions||{},{altitudePropertyName:r,disableAltitudeWarning:o}=t,s=this.M.get(e);if(s&&s.cacheIndex===t.workerCacheIndex){const{err:t,data:i}=s;return setTimeout((()=>{this.wt(e,t,i,n)}),1)}const{tileArrayBuffer:u}=t;return u?setTimeout((()=>{this.wt(e,r,o,null,u,n)}),1):(i.referrer=t.referrer,I.getArrayBuffer(e,i,((i,s)=>{this.M&&(i?i.loading||this.M.add(e,{err:i,data:s&&s.data,cacheIndex:t.workerCacheIndex}):s&&s.data&&this.M.add(e,{err:null,data:s.data,cacheIndex:t.workerCacheIndex}),this.wt(e,r,o,i,s&&s.data,n))})))}wt(t,n,e,i,r,o){if(i)return void o(i);let s;try{s=new Gr(new Ar(r))}catch(i){return void o(i.message,[],[])}const u=[];if(!s.layers)return void o(null,u,[]);const c={};let f;for(const t in s.layers)if(a=s.layers,l=t,Object.prototype.hasOwnProperty.call(a,l)){c[t]={types:{}};const r=c[t].types;for(let o=0,c=s.layers[t].length;o<c;o++)try{f=s.layers[t].feature(o),r[f.type]=1;const i={type:f.type,layer:t,geometry:f.loadGeometry(),properties:f.properties,extent:f.extent};void 0!==f.id&&(i.id=f.id);let c=i.properties[nn];c&&(b(c)&&(c=JSON.parse(c)),i.properties[nn]=tr(c,"EPSG:3857"));const a=n&&i.properties[n];if(a){const t=zr(a),n=[];Jr(i.geometry,t,n),n.length&&!e&&(console.warn("feature.geometry is not consistent with altitude values:"),console.warn(JSON.stringify(i,null,2)))}u.push(i)}catch(i){console.warn("error when load vt geometry:",i)}}var a,l;for(const t in c)c[t].types=Object.keys(c[t].types).map((t=>+t));o(null,u,c,{byteLength:r.byteLength})}abortTile(t,n){const e=this.requests[t];delete this.requests[t],e&&e.abort&&e.abort(),this.A(t),n()}onRemove(){super.onRemove();for(const t in this.requests){const n=this.requests[t];n&&n.abort&&n.abort()}this.requests={}}}function zr(t){const n=atob(t),e=new Uint8Array(n.length);for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return new Float32Array(e.buffer)}function Jr(t,n,e,i){i||(i={index:0});for(let r=0;r<t.length;r++)if(Array.isArray(t[r]))Jr(t[r],n,e,i);else{const o=i.index;k(n[o])?e.push(Dr):t[r].z=100*n[o],i.index++}}const{LRUCache:Yr}=en();let qr=0;const Rr=new Yr(128);class Hr{constructor(t){this.gt={},this.Pt={},this.workerId=t}addLayer({actorId:t,mapId:n,layerId:e,params:i},r){if(this.xt(n,e))return;const o=this.bt(n,e),s=i.type,u=i.options,c=this.send.bind(this,t);this.gt[o]="GeoJSONVectorTileLayer"===s?new er(e,u,c,Rr,{},r):new Xr(e,u,c,Rr,{},r)}removeLayer({mapId:t,layerId:n},e){const i=this.xt(t,n),r=this.bt(t,n);delete this.gt[r],i&&i.onRemove(e)}loadTile({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.loadTile(e,i)}abortTile({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.abortTile&&r.abortTile(e.url,i)}removeTile({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.removeTile(e,i)}updateStyle({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.updateStyle(e,i)}updateOptions({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.updateOptions(e,i)}setData({mapId:t,layerId:n,params:e},i){const r=this.xt(t,n);r&&r.setData(e.data,i)}receive(t){const n=t.callback,e=this.Pt[n];delete this.Pt[n],e&&t.error?e(new Error(t.error)):e&&e(null,t.data)}send(t,n,e,i,r){const o=r?\`${o}t}-${o}qr++}\`:null;r&&(this.Pt[o]=r),postMessage({type:"<request>",workerId:this.workerId,actorId:t,command:n,params:e,callback:String(o)},i||[])}bt(t,n){return\`${o}t}-${o}n}\`}xt(t,n){const e=this.bt(t,n);return this.gt[e]}St(){Rr.reset()}}t.initialize=function(){},t.onmessage=function(t,n){const e=t.data;if(this.dispatcher||(this.dispatcher=new Hr(t.workerId)),"<response>"===t.type)this.dispatcher.workerId===t.workerId&&this.dispatcher.receive(t);else{const i=e.command;this.dispatcher[i]({actorId:t.actorId,mapId:e.mapId,layerId:e.layerId,params:e.params},((t,e,r)=>{t&&404!==t.status&&204!==t.status&&!t.loading&&console.error(i,t),n(t,e,r)}))}}}`;
|
|
25
25
|
function l(t) {
|
|
26
26
|
const e = function() {
|
|
27
27
|
return "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : "undefined" != typeof window ? window : "undefined" != typeof global ? global : void 0;
|
|
@@ -21593,6 +21593,6 @@
|
|
|
21593
21593
|
t.PointLayer = pl, t.PolygonLayer = bl, t.SYMBOLS_NEED_REBUILD_IN_VECTOR = dc, t.SYMBOLS_NEED_REBUILD_IN_VT = fc,
|
|
21594
21594
|
t.TextPainter = _o, t.TextPlugin = Oa, t.TubePlugin = Na, t.Vector3DLayer = nn,
|
|
21595
21595
|
t.VectorTileLayer = qe, t.VectorTileLayerRenderer = He, t.WaterPlugin = La, t.WireframePainter = Yo,
|
|
21596
|
-
t.WireframePlugin = Ca, "undefined" != typeof console && console.log("@maptalks/vt v0.103.
|
|
21596
|
+
t.WireframePlugin = Ca, "undefined" != typeof console && console.log("@maptalks/vt v0.103.1");
|
|
21597
21597
|
}));
|
|
21598
21598
|
//# sourceMappingURL=maptalks.vt.js.map
|