@mesh3d/cesium-vectortile-gl 0.4.6 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,135 +0,0 @@
1
- (function(O,P){typeof exports=="object"&&typeof module<"u"?P(exports):typeof define=="function"&&define.amd?define(["exports"],P):(O=typeof globalThis<"u"?globalThis:O||self,P(O.CVT={}))})(this,(function(O){"use strict";function P(n,e){this.x=n,this.y=e}P.prototype={clone(){return new P(this.x,this.y)},add(n){return this.clone()._add(n)},sub(n){return this.clone()._sub(n)},multByPoint(n){return this.clone()._multByPoint(n)},divByPoint(n){return this.clone()._divByPoint(n)},mult(n){return this.clone()._mult(n)},div(n){return this.clone()._div(n)},rotate(n){return this.clone()._rotate(n)},rotateAround(n,e){return this.clone()._rotateAround(n,e)},matMult(n){return this.clone()._matMult(n)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(n){return this.x===n.x&&this.y===n.y},dist(n){return Math.sqrt(this.distSqr(n))},distSqr(n){const e=n.x-this.x,t=n.y-this.y;return e*e+t*t},angle(){return Math.atan2(this.y,this.x)},angleTo(n){return Math.atan2(this.y-n.y,this.x-n.x)},angleWith(n){return this.angleWithSep(n.x,n.y)},angleWithSep(n,e){return Math.atan2(this.x*e-this.y*n,this.x*n+this.y*e)},_matMult(n){const e=n[0]*this.x+n[1]*this.y,t=n[2]*this.x+n[3]*this.y;return this.x=e,this.y=t,this},_add(n){return this.x+=n.x,this.y+=n.y,this},_sub(n){return this.x-=n.x,this.y-=n.y,this},_mult(n){return this.x*=n,this.y*=n,this},_div(n){return this.x/=n,this.y/=n,this},_multByPoint(n){return this.x*=n.x,this.y*=n.y,this},_divByPoint(n){return this.x/=n.x,this.y/=n.y,this},_unit(){return this._div(this.mag()),this},_perp(){const n=this.y;return this.y=this.x,this.x=-n,this},_rotate(n){const e=Math.cos(n),t=Math.sin(n),r=e*this.x-t*this.y,i=t*this.x+e*this.y;return this.x=r,this.y=i,this},_rotateAround(n,e){const t=Math.cos(n),r=Math.sin(n),i=e.x+t*(this.x-e.x)-r*(this.y-e.y),s=e.y+r*(this.x-e.x)+t*(this.y-e.y);return this.x=i,this.y=s,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:P},P.convert=function(n){if(n instanceof P)return n;if(Array.isArray(n))return new P(+n[0],+n[1]);if(n.x!==void 0&&n.y!==void 0)return new P(+n.x,+n.y);throw new Error("Expected [x, y] or {x, y} point format")};class Oe{constructor(e,t,r,i,s){this.properties={},this.extent=r,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=s,e.readFields(Xs,this,t)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,r=[];let i,s=1,o=0,a=0,l=0;for(;e.pos<t;){if(o<=0){const u=e.readVarint();s=u&7,o=u>>3}if(o--,s===1||s===2)a+=e.readSVarint(),l+=e.readSVarint(),s===1&&(i&&r.push(i),i=[]),i&&i.push(new P(a,l));else if(s===7)i&&i.push(i[0].clone());else throw new Error(`unknown command ${s}`)}return i&&r.push(i),r}bbox(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let r=1,i=0,s=0,o=0,a=1/0,l=-1/0,u=1/0,c=-1/0;for(;e.pos<t;){if(i<=0){const f=e.readVarint();r=f&7,i=f>>3}if(i--,r===1||r===2)s+=e.readSVarint(),o+=e.readSVarint(),s<a&&(a=s),s>l&&(l=s),o<u&&(u=o),o>c&&(c=o);else if(r!==7)throw new Error(`unknown command ${r}`)}return[a,u,l,c]}toGeoJSON(e,t,r){const i=this.extent*Math.pow(2,r),s=this.extent*e,o=this.extent*t,a=this.loadGeometry();function l(p){return[(p.x+s)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(p.y+o)*2/i)*Math.PI))-90]}function u(p){return p.map(l)}let c;if(this.type===1){const p=[];for(const h of a)p.push(h[0]);const d=u(p);c=p.length===1?{type:"Point",coordinates:d[0]}:{type:"MultiPoint",coordinates:d}}else if(this.type===2){const p=a.map(u);c=p.length===1?{type:"LineString",coordinates:p[0]}:{type:"MultiLineString",coordinates:p}}else if(this.type===3){const p=qr(a),d=[];for(const h of p)d.push(h.map(u));c=d.length===1?{type:"Polygon",coordinates:d[0]}:{type:"MultiPolygon",coordinates:d}}else throw new Error("unknown feature type");const f={type:"Feature",geometry:c,properties:this.properties};return this.id!=null&&(f.id=this.id),f}}Oe.types=["Unknown","Point","LineString","Polygon"];function Xs(n,e,t){n===1?e.id=t.readVarint():n===2?Ys(t,e):n===3?e.type=t.readVarint():n===4&&(e._geometry=t.pos)}function Ys(n,e){const t=n.readVarint()+n.pos;for(;n.pos<t;){const r=e._keys[n.readVarint()],i=e._values[n.readVarint()];e.properties[r]=i}}function qr(n){const e=n.length;if(e<=1)return[n];const t=[];let r,i;for(let s=0;s<e;s++){const o=Ws(n[s]);o!==0&&(i===void 0&&(i=o<0),i===o<0?(r&&t.push(r),r=[n[s]]):r&&r.push(n[s]))}return r&&t.push(r),t}function Ws(n){let e=0;for(let t=0,r=n.length,i=r-1,s,o;t<r;i=t++)s=n[t],o=n[i],e+=(o.x-s.x)*(s.y+o.y);return e}class Hs{constructor(e,t){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Js,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new Oe(this._pbf,t,this.extent,this._keys,this._values)}}function Js(n,e,t){n===15?e.version=t.readVarint():n===1?e.name=t.readString():n===5?e.extent=t.readVarint():n===2?e._features.push(t.pos):n===3?e._keys.push(t.readString()):n===4&&e._values.push(Ks(t))}function Ks(n){let e=null;const t=n.readVarint()+n.pos;for(;n.pos<t;){const r=n.readVarint()>>3;e=r===1?n.readString():r===2?n.readFloat():r===3?n.readDouble():r===4?n.readVarint64():r===5?n.readVarint():r===6?n.readSVarint():r===7?n.readBoolean():null}if(e==null)throw new Error("unknown feature value");return e}class Qs{constructor(e,t){this.layers=e.readFields(eo,{},t)}}function eo(n,e,t){if(n===3){const r=new Hs(t,t.readVarint()+t.pos);r.length&&(e[r.name]=r)}}class bn{constructor(e,t=""){this.type=e.type,this.styleSource=e,this.path=t,this.errorEvent=new Cesium.Event}async init(){}requestTile(e,t,r){}destroy(){this.styleSource=null,this.errorEvent=null}}const wn={};function Cn(n,e){wn[n]=e}class Ve{_name;dataBuffer;nullabilityBuffer;_size;constructor(e,t,r){this._name=e,this.dataBuffer=t,typeof r=="number"?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer&&this.nullabilityBuffer.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class _t extends Ve{}class Tn extends _t{getValueFromBuffer(e){return this.dataBuffer[e]}}class _n extends _t{getValueFromBuffer(e){return this.dataBuffer[e]}}class Gr extends Ve{delta;constructor(e,t,r,i){super(e,t,i),this.delta=r}}class In extends Gr{constructor(e,t,r,i){super(e,Int32Array.of(t),r,i)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class Ln extends Ve{constructor(e,t,r){super(e,Int32Array.of(t),r)}getValueFromBuffer(e){return this.dataBuffer[0]}}class to{_name;_geometryVector;_idVector;_propertyVectors;_extent;propertyVectorsMap;constructor(e,t,r,i,s=4096){this._name=e,this._geometryVector=t,this._idVector=r,this._propertyVectors=i,this._extent=s}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map(t=>[t.name,t]))),this.propertyVectorsMap.get(e)}*[Symbol.iterator](){const e=this.geometryVector[Symbol.iterator]();let t=0;for(;t<this.numFeatures;){let r;this.idVector&&(r=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(t)):this.idVector.getValue(t));const i=e?.next().value,s={};for(const o of this.propertyVectors){if(!o)continue;const a=o.name,l=o.getValue(t);l!==null&&(s[a]=l)}t++,yield{id:r,geometry:i,properties:s}}}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const e=[],t=this.geometryVector.getGeometries();for(let r=0;r<this.numFeatures;r++){let i;this.idVector&&(i=this.containsMaxSaveIntegerValues(this.idVector)?Number(this.idVector.getValue(r)):this.idVector.getValue(r));const s={coordinates:t[r],type:this.geometryVector.geometryType(r)},o={};for(const a of this.propertyVectors){if(!a)continue;const l=a.name,u=a.getValue(r);u!==null&&(o[l]=u)}e.push({id:i,geometry:s,properties:o})}return e}containsMaxSaveIntegerValues(e){return e instanceof Tn||e instanceof Ln&&e instanceof In||e instanceof _n}}const It={FEATURE:0},z={BOOLEAN:0,INT_8:1,UINT_8:2,INT_32:3,UINT_32:4,INT_64:5,UINT_64:6,FLOAT:7,DOUBLE:8,STRING:9},Lt={GEOMETRY:0,STRUCT:1};class no{value;constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var S;(function(n){n.NONE="NONE",n.DELTA="DELTA",n.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",n.RLE="RLE",n.MORTON="MORTON",n.PDE="PDE"})(S||(S={}));var me;(function(n){n.NONE="NONE",n.FAST_PFOR="FAST_PFOR",n.VARINT="VARINT",n.ALP="ALP"})(me||(me={}));function G(n,e,t){const r=new Int32Array(t);let i=0,s=e.get();for(let o=0;o<r.length;o++){let a=n[s++],l=a&127;if(a<128){r[i++]=l;continue}if(a=n[s++],l|=(a&127)<<7,a<128){r[i++]=l;continue}if(a=n[s++],l|=(a&127)<<14,a<128){r[i++]=l;continue}if(a=n[s++],l|=(a&127)<<21,a<128){r[i++]=l;continue}a=n[s++],l|=(a&15)<<28,r[i++]=l}return e.set(s),r}function St(n,e,t){const r=new BigInt64Array(t);for(let i=0;i<r.length;i++)r[i]=lo(n,e);return r}function ro(n,e,t){const r=new Float64Array(e);for(let i=0;i<e;i++)r[i]=io(n,t);return r}function io(n,e){let t,r;return r=n[e.get()],e.increment(),t=r&127,r<128||(r=n[e.get()],e.increment(),t|=(r&127)<<7,r<128)||(r=n[e.get()],e.increment(),t|=(r&127)<<14,r<128)||(r=n[e.get()],e.increment(),t|=(r&127)<<21,r<128)?t:(r=n[e.get()],t|=(r&15)<<28,so(t,n,e))}function so(n,e,t){let r,i;if(i=e[t.get()],t.increment(),r=(i&112)>>4,i<128||(i=e[t.get()],t.increment(),r|=(i&127)<<3,i<128)||(i=e[t.get()],t.increment(),r|=(i&127)<<10,i<128)||(i=e[t.get()],t.increment(),r|=(i&127)<<17,i<128)||(i=e[t.get()],t.increment(),r|=(i&127)<<24,i<128)||(i=e[t.get()],t.increment(),r|=(i&1)<<31,i<128))return r*4294967296+(n>>>0);throw new Error("Expected varint not more than 10 bytes")}function Ur(n,e,t,r){throw new Error("FastPFor is not implemented yet.")}function oo(n){for(let e=0;e<n.length;e++){const t=n[e];n[e]=t>>>1^-(t&1)}}function ao(n){for(let e=0;e<n.length;e++){const t=n[e];n[e]=t>>1n^-(t&1n)}}function Ie(n){return n>>>1^-(n&1)}function De(n){return n>>1n^-(n&1n)}function lo(n,e){let t=0n,r=0,i=e.get();for(;i<n.length;){const s=n[i++];if(t|=BigInt(s&127)<<BigInt(r),(s&128)===0)break;if(r+=7,r>=64)throw new Error("Varint too long")}return e.set(i),t}function uo(n,e,t){return t?mo(n,e.runs,e.numRleValues):$r(n,e.runs,e.numRleValues)}function co(n,e,t){return t?go(n,e.runs,e.numRleValues):jr(n,e.runs,e.numRleValues)}function fo(n,e,t){return t?xo(n,e.runs,e.numRleValues):Zr(n,e.runs,e.numRleValues)}function $r(n,e,t){const r=new Int32Array(t);let i=0;for(let s=0;s<e;s++){const o=n[s],a=n[s+e];r.fill(a,i,i+o),i+=o}return r}function jr(n,e,t){const r=new BigInt64Array(t);let i=0;for(let s=0;s<e;s++){const o=Number(n[s]),a=n[s+e];r.fill(a,i,i+o),i+=o}return r}function Zr(n,e,t){const r=new Float64Array(t);let i=0;for(let s=0;s<e;s++){const o=n[s],a=n[s+e];r.fill(a,i,i+o),i+=o}return r}function ho(n){n[0]=n[0]>>>1^-(n[0]&1);const e=n.length/4*4;let t=1;if(e>=4)for(;t<e-4;t+=4){const r=n[t],i=n[t+1],s=n[t+2],o=n[t+3];n[t]=(r>>>1^-(r&1))+n[t-1],n[t+1]=(i>>>1^-(i&1))+n[t],n[t+2]=(s>>>1^-(s&1))+n[t+1],n[t+3]=(o>>>1^-(o&1))+n[t+2]}for(;t!=n.length;++t)n[t]=(n[t]>>>1^-(n[t]&1))+n[t-1]}function po(n){n[0]=n[0]>>1n^-(n[0]&1n);const e=n.length/4*4;let t=1;if(e>=4)for(;t<e-4;t+=4){const r=n[t],i=n[t+1],s=n[t+2],o=n[t+3];n[t]=(r>>1n^-(r&1n))+n[t-1],n[t+1]=(i>>1n^-(i&1n))+n[t],n[t+2]=(s>>1n^-(s&1n))+n[t+1],n[t+3]=(o>>1n^-(o&1n))+n[t+2]}for(;t!=n.length;++t)n[t]=(n[t]>>1n^-(n[t]&1n))+n[t-1]}function yo(n){n[0]=n[0]%2===1?(n[0]+1)/-2:n[0]/2;const e=n.length/4*4;let t=1;if(e>=4)for(;t<e-4;t+=4){const r=n[t],i=n[t+1],s=n[t+2],o=n[t+3];n[t]=(r%2===1?(r+1)/-2:r/2)+n[t-1],n[t+1]=(i%2===1?(i+1)/-2:i/2)+n[t],n[t+2]=(s%2===1?(s+1)/-2:s/2)+n[t+1],n[t+3]=(o%2===1?(o+1)/-2:o/2)+n[t+2]}for(;t!=n.length;++t)n[t]=(n[t]%2===1?(n[t]+1)/-2:n[t]/2)+n[t-1]}function mo(n,e,t){const r=new Int32Array(t);let i=0;for(let s=0;s<e;s++){const o=n[s];let a=n[s+e];a=a>>>1^-(a&1),r.fill(a,i,i+o),i+=o}return r}function go(n,e,t){const r=new BigInt64Array(t);let i=0;for(let s=0;s<e;s++){const o=Number(n[s]);let a=n[s+e];a=a>>1n^-(a&1n),r.fill(a,i,i+o),i+=o}return r}function xo(n,e,t){const r=new Float64Array(t);let i=0;for(let s=0;s<e;s++){const o=n[s];let a=n[s+e];a=a%2===1?(a+1)/-2:a/2,r.fill(a,i,i+o),i+=o}return r}function Sn(n){const e=n.length/4*4;let t=1;if(e>=4)for(let r=n[0];t<e-4;t+=4)r=n[t]+=r,r=n[t+1]+=r,r=n[t+2]+=r,r=n[t+3]+=r;for(;t!=n.length;)n[t]+=n[t-1],++t}function vo(n){let e=0;for(let t=0;t<n.length;t++)n[t]+=e,e=n[t]}function Xr(n){n[0]=n[0]>>>1^-(n[0]&1),n[1]=n[1]>>>1^-(n[1]&1);const e=n.length/4*4;let t=2;if(e>=4)for(;t<e-4;t+=4){const r=n[t],i=n[t+1],s=n[t+2],o=n[t+3];n[t]=(r>>>1^-(r&1))+n[t-2],n[t+1]=(i>>>1^-(i&1))+n[t-1],n[t+2]=(s>>>1^-(s&1))+n[t],n[t+3]=(o>>>1^-(o&1))+n[t+1]}for(;t!=n.length;t+=2)n[t]=(n[t]>>>1^-(n[t]&1))+n[t-2],n[t+1]=(n[t+1]>>>1^-(n[t+1]&1))+n[t-1]}function bo(n,e){const t=new Int32Array(n.size());let r=0;n.get(0)?(t[0]=n.get(0)?e[0]>>>1^-(e[0]&1):0,r=1):t[0]=0;let i=1;for(;i!=t.length;++i)t[i]=n.get(i)?t[i-1]+(e[r]>>>1^-(e[r++]&1)):t[i-1];return t}function wo(n,e){const t=new BigInt64Array(n.size());let r=0;n.get(0)?(t[0]=n.get(0)?e[0]>>1n^-(e[0]&1n):0n,r=1):t[0]=0n;let i=1;for(;i!=t.length;++i)t[i]=n.get(i)?t[i-1]+(e[r]>>1n^-(e[r++]&1n)):t[i-1];return t}function Co(n){const e=new Int32Array(n.length+1);e[0]=0,e[1]=Ie(n[0]);let t=e[1],r=2;for(;r!=e.length;++r){const i=n[r-1],s=i>>>1^-(i&1);t+=s,e[r]=e[r-1]+t}return e}function To(n,e,t){const r=new Int32Array(t+1);r[0]=0;let i=1,s=r[0];for(let o=0;o<e;o++){const a=n[o];let l=n[o+e];l=l>>>1^-(l&1);for(let u=i;u<i+a;u++)r[u]=l+s,s=r[u];i+=a}return r}function _o(n,e,t){const r=new Int32Array(t+1);r[0]=0;let i=1,s=r[0];for(let o=0;o<e;o++){const a=n[o],l=n[o+e];for(let u=i;u<i+a;u++)r[u]=l+s,s=r[u];i+=a}return r}function Io(n,e){const t=new Int32Array(n.size());let r=0,i=0;for(;i!=t.length;++i)t[i]=n.get(i)?e[r++]:0;return t}function Lo(n,e){const t=new Int32Array(n.size());let r=0,i=0;for(;i!=t.length;++i)if(n.get(i)){const s=e[r++];t[i]=s>>>1^-(s&1)}else t[i]=0;return t}function So(n,e){const t=new BigInt64Array(n.size());let r=0,i=0;for(;i!=t.length;++i)t[i]=n.get(i)?e[r++]:0n;return t}function Eo(n,e){const t=new BigInt64Array(n.size());let r=0,i=0;for(;i!=t.length;++i)if(n.get(i)){const s=e[r++];t[i]=s>>1n^-(s&1n)}else t[i]=0n;return t}function Ao(n,e,t,r){const i=e;return t?Fo(r,n,i.runs):zo(r,n,i.runs)}function zo(n,e,t){const r=new Int32Array(n.size());let i=0;for(let s=0;s<t;s++){const o=e[s],a=e[s+t];for(let l=i;l<i+o;l++)n.get(l)?r[l]=a:(r[l]=0,i++);i+=o}return r}function Fo(n,e,t){const r=new Int32Array(n.size());let i=0;for(let s=0;s<t;s++){const o=e[s];let a=e[s+t];a=a>>>1^-(a&1);for(let l=i;l<i+o;l++)n.get(l)?r[l]=a:(r[l]=0,i++);i+=o}return r}function ko(n,e,t,r){const i=e;return t?Mo(r,n,i.runs):Po(r,n,i.runs)}function Po(n,e,t){const r=new BigInt64Array(n.size());let i=0;for(let s=0;s<t;s++){const o=Number(e[s]),a=e[s+t];for(let l=i;l<i+o;l++)n.get(l)?r[l]=a:(r[l]=0n,i++);i+=o}return r}function Mo(n,e,t){const r=new BigInt64Array(n.size());let i=0;for(let s=0;s<t;s++){const o=Number(e[s]);let a=e[s+t];a=a>>1n^-(a&1n);for(let l=i;l<i+o;l++)n.get(l)?r[l]=a:(r[l]=0n,i++);i+=o}return r}function Oo(n,e,t){const r=new Int32Array(t);let i=0,s=0;for(let o=0;o<e;o++){const a=n[o],l=n[o+e],u=Ie(l);for(let c=0;c<a;c++)s+=u,r[i++]=s}return r}function Vo(n,e,t){const r=new BigInt64Array(t);let i=0,s=0n;for(let o=0;o<e;o++){const a=Number(n[o]),l=n[o+e],u=De(l);for(let c=0;c<a;c++)s+=u,r[i++]=s}return r}function Do(n){return n[1]}function No(n){return Ie(n[1])}function Bo(n){if(n.length==2){const r=Ie(n[1]);return[r,r]}const e=Ie(n[2]),t=Ie(n[3]);return[e,t]}function Ro(n){return n[1]}function qo(n){return De(n[1])}function Go(n){if(n.length==2){const r=De(n[1]);return[r,r]}const e=De(n[2]),t=De(n[3]);return[e,t]}var U;(function(n){n.PRESENT="PRESENT",n.DATA="DATA",n.OFFSET="OFFSET",n.LENGTH="LENGTH"})(U||(U={}));class En{_dictionaryType;_offsetType;_lengthType;constructor(e,t,r){this._dictionaryType=e,this._offsetType=t,this._lengthType=r}get dictionaryType(){return this._dictionaryType}get offsetType(){return this._offsetType}get lengthType(){return this._lengthType}}var ae;(function(n){n.NONE="NONE",n.SINGLE="SINGLE",n.SHARED="SHARED",n.VERTEX="VERTEX",n.MORTON="MORTON",n.FSST="FSST"})(ae||(ae={}));var Le;(function(n){n.VERTEX="VERTEX",n.INDEX="INDEX",n.STRING="STRING",n.KEY="KEY"})(Le||(Le={}));var Q;(function(n){n.VAR_BINARY="VAR_BINARY",n.GEOMETRIES="GEOMETRIES",n.PARTS="PARTS",n.RINGS="RINGS",n.TRIANGLES="TRIANGLES",n.SYMBOL="SYMBOL",n.DICTIONARY="DICTIONARY"})(Q||(Q={}));function Z(n,e){const t=jo(n,e);return t.logicalLevelTechnique1===S.MORTON?Uo(t,n,e):(S.RLE===t.logicalLevelTechnique1||S.RLE===t.logicalLevelTechnique2)&&me.NONE!==t.physicalLevelTechnique?$o(t,n,e):t}function Uo(n,e,t){const r=G(e,t,2);return{physicalStreamType:n.physicalStreamType,logicalStreamType:n.logicalStreamType,logicalLevelTechnique1:n.logicalLevelTechnique1,logicalLevelTechnique2:n.logicalLevelTechnique2,physicalLevelTechnique:n.physicalLevelTechnique,numValues:n.numValues,byteLength:n.byteLength,decompressedCount:n.decompressedCount,numBits:r[0],coordinateShift:r[1]}}function $o(n,e,t){const r=G(e,t,2);return{physicalStreamType:n.physicalStreamType,logicalStreamType:n.logicalStreamType,logicalLevelTechnique1:n.logicalLevelTechnique1,logicalLevelTechnique2:n.logicalLevelTechnique2,physicalLevelTechnique:n.physicalLevelTechnique,numValues:n.numValues,byteLength:n.byteLength,decompressedCount:r[1],runs:r[0],numRleValues:r[1]}}function jo(n,e){const t=n[e.get()],r=Object.values(U)[t>>4];let i=null;switch(r){case U.DATA:i=new En(Object.values(ae)[t&15]);break;case U.OFFSET:i=new En(null,Object.values(Le)[t&15]);break;case U.LENGTH:i=new En(null,null,Object.values(Q)[t&15]);break}e.increment();const s=n[e.get()],o=Object.values(S)[s>>5],a=Object.values(S)[s>>2&7],l=Object.values(me)[s&3];e.increment();const u=G(n,e,2),c=u[0],f=u[1];return{physicalStreamType:r,logicalStreamType:i,logicalLevelTechnique1:o,logicalLevelTechnique2:a,physicalLevelTechnique:l,numValues:c,byteLength:f,decompressedCount:c}}var B;(function(n){n[n.FLAT=0]="FLAT",n[n.CONST=1]="CONST",n[n.SEQUENCE=2]="SEQUENCE",n[n.DICTIONARY=3]="DICTIONARY",n[n.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(B||(B={}));class le{values;_size;constructor(e,t){this.values=e,this._size=t}get(e){const t=Math.floor(e/8),r=e%8;return(this.values[t]>>r&1)===1}set(e,t){const r=Math.floor(e/8),i=e%8;this.values[r]=this.values[r]|(t?1:0)<<i}getInt(e){const t=Math.floor(e/8),r=e%8;return this.values[t]>>r&1}size(){return this._size}getBuffer(){return this.values}}function X(n,e,t,r,i){const s=Et(n,e,t);return Xo(s,t,r)}function be(n,e,t){const r=Et(n,e,t);return Ho(r,t)}function Et(n,e,t){const r=t.physicalLevelTechnique;if(r===me.FAST_PFOR)return Ur(n,t.numValues,t.byteLength);if(r===me.VARINT)return G(n,e,t.numValues);if(r===me.NONE){const i=e.get(),s=t.byteLength;e.add(s);const o=n.subarray(i,e.get());return new Int32Array(o)}throw new Error("Specified physicalLevelTechnique is not supported (yet).")}function An(n,e,t,r){const i=Et(n,e,t);if(i.length===1){const s=i[0];return r?Ie(s):s}return r?No(i):Do(i)}function Yr(n,e,t){const r=Et(n,e,t);return Bo(r)}function Wr(n,e,t){const r=St(n,e,t.numValues);return Go(r)}function Hr(n,e,t,r){const i=St(n,e,t.numValues);return Yo(i,t,r)}function Zo(n,e,t,r){const i=ro(n,t.numValues,e);return Wo(i,t,r)}function Jr(n,e,t,r){const i=St(n,e,t.numValues);if(i.length===1){const s=i[0];return r?De(s):s}return r?qo(i):Ro(i)}function Xo(n,e,t,r){switch(e.logicalLevelTechnique1){case S.DELTA:if(e.logicalLevelTechnique2===S.RLE){const i=e;return Oo(n,i.runs,i.numRleValues)}return ho(n),n;case S.RLE:return uo(n,e,t);case S.MORTON:return Sn(n),n;case S.COMPONENTWISE_DELTA:return Xr(n),n;case S.NONE:return t&&oo(n),n;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}function Yo(n,e,t){switch(e.logicalLevelTechnique1){case S.DELTA:if(e.logicalLevelTechnique2===S.RLE){const r=e;return Vo(n,r.runs,r.numRleValues)}return po(n),n;case S.RLE:return co(n,e,t);case S.NONE:return t&&ao(n),n;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}function Wo(n,e,t){switch(e.logicalLevelTechnique1){case S.DELTA:if(e.logicalLevelTechnique2===S.RLE){const r=e;n=Zr(n,r.runs,r.numRleValues)}return yo(n),n;case S.RLE:return fo(n,e,t);case S.NONE:return n;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}function Ho(n,e){if(e.logicalLevelTechnique1===S.DELTA&&e.logicalLevelTechnique2===S.NONE)return Co(n);if(e.logicalLevelTechnique1===S.RLE&&e.logicalLevelTechnique2===S.NONE){const t=e;return _o(n,t.runs,t.numRleValues)}if(e.logicalLevelTechnique1===S.NONE&&e.logicalLevelTechnique2===S.NONE){vo(n);const t=new Int32Array(e.numValues+1);return t[0]=0,t.set(n,1),t}if(e.logicalLevelTechnique1===S.DELTA&&e.logicalLevelTechnique2===S.RLE){const t=e,r=To(n,t.runs,t.numRleValues);return Sn(r),r}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")}function zn(n,e,t,r,i){const s=t.physicalLevelTechnique===me.FAST_PFOR?Ur(n,t.numValues,t.byteLength):G(n,e,t.numValues);return Ko(s,t,r,i)}function Jo(n,e,t,r,i){const s=St(n,e,t.numValues);return Qo(s,t,r,i)}function Ko(n,e,t,r){switch(e.logicalLevelTechnique1){case S.DELTA:if(e.logicalLevelTechnique2===S.RLE){const i=e;n=$r(n,i.runs,i.numRleValues)}return bo(r,n);case S.RLE:return Ao(n,e,t,r);case S.MORTON:return Sn(n),n;case S.COMPONENTWISE_DELTA:return Xr(n),n;case S.NONE:return n=t?Lo(r,n):Io(r,n),n;default:throw new Error("The specified Logical level technique is not supported")}}function Qo(n,e,t,r){switch(e.logicalLevelTechnique1){case S.DELTA:if(e.logicalLevelTechnique2===S.RLE){const i=e;n=jr(n,i.runs,i.numRleValues)}return wo(r,n);case S.RLE:return ko(n,e,t,r);case S.NONE:return n=t?Eo(r,n):So(r,n),n;default:throw new Error("The specified Logical level technique is not supported")}}function At(n,e,t,r){const i=n.logicalLevelTechnique1;if(i===S.RLE)return n.runs===1?B.CONST:B.FLAT;const s=e instanceof le?e.size():e;if(i===S.DELTA&&n.logicalLevelTechnique2===S.RLE){const o=n,a=o.runs,l=2;if(o.numRleValues!==s)return B.FLAT;if(a===1)return B.SEQUENCE;if(a===2){const u=r.get();let c;if(n.physicalLevelTechnique===me.VARINT)c=G(t,r,4);else{const f=r.get();c=new Int32Array(t.buffer,t.byteOffset+f,4)}if(r.set(u),c[2]===l&&c[3]===l)return B.SEQUENCE}}return n.numValues===1?B.CONST:B.FLAT}class Kr extends _t{getValueFromBuffer(e){return this.dataBuffer[e]}}class Qr extends Gr{constructor(e,t,r,i){super(e,BigInt64Array.of(t),r,i)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}class Ne{_geometryOffsets;_partOffsets;_ringOffsets;constructor(e,t,r){this._geometryOffsets=e,this._partOffsets=t,this._ringOffsets=r}get geometryOffsets(){return this._geometryOffsets}get partOffsets(){return this._partOffsets}get ringOffsets(){return this._ringOffsets}}function Fn(n,e,t){const r=ei(n,e)-t,i=ei(n>>1,e)-t;return{x:r,y:i}}function ei(n,e){let t=0;for(let r=0;r<e;r++)t|=(n&1<<2*r)>>r;return t}var R;(function(n){n[n.POINT=0]="POINT",n[n.LINESTRING=1]="LINESTRING",n[n.POLYGON=2]="POLYGON",n[n.MULTIPOINT=3]="MULTIPOINT",n[n.MULTILINESTRING=4]="MULTILINESTRING",n[n.MULTIPOLYGON=5]="MULTIPOLYGON"})(R||(R={}));var ti;(function(n){n[n.POINT=0]="POINT",n[n.LINESTRING=1]="LINESTRING",n[n.POLYGON=2]="POLYGON"})(ti||(ti={}));var ee;(function(n){n[n.MORTON=0]="MORTON",n[n.VEC_2=1]="VEC_2",n[n.VEC_3=2]="VEC_3"})(ee||(ee={}));class ea{createPoint(e){return[[e]]}createMultiPoint(e){return e.map(t=>[t])}createLineString(e){return[e]}createMultiLineString(e){return e}createPolygon(e,t){return[e].concat(t)}createMultiPolygon(e){return e.flat()}}function ni(n){const e=new Array(n.numGeometries);let t=1,r=1,i=1,s=0;const o=new ea;let a=0,l=0;const u=n.mortonSettings,c=n.topologyVector,f=c.geometryOffsets,p=c.partOffsets,d=c.ringOffsets,h=n.vertexOffsets,y=n.containsPolygonGeometry(),m=n.vertexBuffer;for(let v=0;v<n.numGeometries;v++){const w=n.geometryType(v);if(w===R.POINT){if(!h||h.length===0){const g=m[a++],x=m[a++],b=new P(g,x);e[s++]=o.createPoint(b)}else if(n.vertexBufferType===ee.VEC_2){const g=h[l++]*2,x=m[g],b=m[g+1],T=new P(x,b);e[s++]=o.createPoint(T)}else{const g=h[l++],x=m[g],b=Fn(x,u.numBits,u.coordinateShift),T=new P(b.x,b.y);e[s++]=o.createPoint(T)}f&&i++,p&&t++,d&&r++}else if(w===R.MULTIPOINT){const g=f[i]-f[i-1];i++;const x=new Array(g);if(!h||h.length===0){for(let b=0;b<g;b++){const T=m[a++],_=m[a++];x[b]=new P(T,_)}e[s++]=o.createMultiPoint(x)}else{for(let b=0;b<g;b++){const T=h[l++]*2,_=m[T],I=m[T+1];x[b]=new P(_,I)}e[s++]=o.createMultiPoint(x)}}else if(w===R.LINESTRING){let g=0;y?(g=d[r]-d[r-1],r++):g=p[t]-p[t-1],t++;let x;!h||h.length===0?(x=kn(m,a,g,!1),a+=g*2):(x=n.vertexBufferType===ee.VEC_2?Pn(m,h,l,g,!1):Mn(m,h,l,g,!1,u),l+=g),e[s++]=o.createLineString(x),f&&i++}else if(w===R.POLYGON){const g=p[t]-p[t-1];t++;const x=new Array(g-1);let b=d[r]-d[r-1];if(r++,!h||h.length===0){const T=zt(m,a,b);a+=b*2;for(let _=0;_<x.length;_++)b=d[r]-d[r-1],r++,x[_]=zt(m,a,b),a+=b*2;e[s++]=o.createPolygon(T,x)}else{const T=n.vertexBufferType===ee.VEC_2?Ft(m,h,l,b):kt(m,h,l,b,o,u);l+=b;for(let _=0;_<x.length;_++)b=d[r]-d[r-1],r++,x[_]=n.vertexBufferType===ee.VEC_2?Ft(m,h,l,b):kt(m,h,l,b,o,u),l+=b;e[s++]=o.createPolygon(T,x)}f&&i++}else if(w===R.MULTILINESTRING){const g=f[i]-f[i-1];i++;const x=new Array(g);if(!h||h.length===0){for(let b=0;b<g;b++){let T=0;y?(T=d[r]-d[r-1],r++):T=p[t]-p[t-1],t++,x[b]=kn(m,a,T,!1),a+=T*2}e[s++]=o.createMultiLineString(x)}else{for(let b=0;b<g;b++){let T=0;y?(T=d[r]-d[r-1],r++):T=p[t]-p[t-1],t++;const _=n.vertexBufferType===ee.VEC_2?Pn(m,h,l,T,!1):Mn(m,h,l,T,!1,u);x[b]=_,l+=T}e[s++]=o.createMultiLineString(x)}}else if(w===R.MULTIPOLYGON){const g=f[i]-f[i-1];i++;const x=new Array(g);let b=0;if(!h||h.length===0){for(let T=0;T<g;T++){const _=p[t]-p[t-1];t++;const I=new Array(_-1);b=d[r]-d[r-1],r++;const k=zt(m,a,b);a+=b*2;for(let M=0;M<I.length;M++){const $=d[r]-d[r-1];r++,I[M]=zt(m,a,$),a+=$*2}x[T]=o.createPolygon(k,I)}e[s++]=o.createMultiPolygon(x)}else{for(let T=0;T<g;T++){const _=p[t]-p[t-1];t++;const I=new Array(_-1);b=d[r]-d[r-1],r++;const k=n.vertexBufferType===ee.VEC_2?Ft(m,h,l,b):kt(m,h,l,b,o,u);l+=b;for(let M=0;M<I.length;M++)b=d[r]-d[r-1],r++,I[M]=n.vertexBufferType===ee.VEC_2?Ft(m,h,l,b):kt(m,h,l,b,o,u),l+=b;x[T]=o.createPolygon(k,I)}e[s++]=o.createMultiPolygon(x)}}else throw new Error("The specified geometry type is currently not supported.")}return e}function zt(n,e,t){return kn(n,e,t,!0)}function Ft(n,e,t,r){return Pn(n,e,t,r,!0)}function kt(n,e,t,r,i,s){return Mn(n,e,t,r,!0,s)}function kn(n,e,t,r){const i=new Array(r?t+1:t);for(let s=0;s<t*2;s+=2){const o=n[e+s],a=n[e+s+1];i[s/2]=new P(o,a)}return r&&(i[i.length-1]=i[0]),i}function Pn(n,e,t,r,i){const s=new Array(i?r+1:r);for(let o=0;o<r*2;o+=2){const a=e[t+o/2]*2,l=n[a],u=n[a+1];s[o/2]=new P(l,u)}return i&&(s[s.length-1]=s[0]),s}function Mn(n,e,t,r,i,s){const o=new Array(i?r+1:r);for(let a=0;a<r;a++){const l=e[t+a],u=n[l],c=Fn(u,s.numBits,s.coordinateShift);o[a]=new P(c.x,c.y)}return i&&(o[o.length-1]=o[0]),o}class ri{_vertexBufferType;_topologyVector;_vertexOffsets;_vertexBuffer;_mortonSettings;constructor(e,t,r,i,s){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=r,this._vertexBuffer=i,this._mortonSettings=s}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}*[Symbol.iterator](){const e=ni(this);let t=0;for(;t<this.numGeometries;)yield{coordinates:e[t],type:this.geometryType(t)},t++}getSimpleEncodedVertex(e){const t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2,r=this.vertexBuffer[t],i=this.vertexBuffer[t+1];return[r,i]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){const s=this.vertexOffsets[e],o=this.vertexBuffer[s],a=Fn(o,this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[a.x,a.y]}const t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2,r=this.vertexBuffer[t],i=this.vertexBuffer[t+1];return[r,i]}getGeometries(){return ni(this)}get mortonSettings(){return this._mortonSettings}}function ta(n,e,t,r,i){return new ii(n,e,ee.VEC_2,t,r,i)}function na(n,e,t,r,i,s){return new ii(n,e,ee.MORTON,t,r,i,s)}class ii extends ri{_numGeometries;_geometryType;constructor(e,t,r,i,s,o,a){super(r,i,s,o,a),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===R.POLYGON||this._geometryType===R.MULTIPOLYGON}containsSingleGeometryType(){return!0}}function ra(n,e,t,r){return new si(ee.VEC_2,n,e,t,r)}function ia(n,e,t,r,i){return new si(ee.MORTON,n,e,t,r,i)}class si extends ri{_geometryTypes;constructor(e,t,r,i,s,o){super(e,r,i,s,o),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===R.POLYGON||this.geometryType(e)===R.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class oi{_triangleOffsets;_indexBuffer;_vertexBuffer;_topologyVector;constructor(e,t,r,i){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=r,this._topologyVector=i}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw new Error("Cannot convert GpuVector to coordinates without topology information");const e=new Array(this.numGeometries),t=this._topologyVector,r=t.partOffsets,i=t.ringOffsets,s=t.geometryOffsets;let o=0,a=1,l=1,u=1;for(let c=0;c<this.numGeometries;c++)switch(this.geometryType(c)){case R.POLYGON:{const p=r[a]-r[a-1];a++;const d=[];for(let h=0;h<p;h++){const y=i[l]-i[l-1];l++;const m=[];for(let v=0;v<y;v++){const w=this._vertexBuffer[o++],g=this._vertexBuffer[o++];m.push(new P(w,g))}m.length>0&&m.push(m[0]),d.push(m)}e[c]=d,s&&u++}break;case R.MULTIPOLYGON:{const p=s[u]-s[u-1];u++;const d=[];for(let h=0;h<p;h++){const y=r[a]-r[a-1];a++;for(let m=0;m<y;m++){const v=i[l]-i[l-1];l++;const w=[];for(let g=0;g<v;g++){const x=this._vertexBuffer[o++],b=this._vertexBuffer[o++];w.push(new P(x,b))}w.length>0&&w.push(w[0]),d.push(w)}}e[c]=d}break}return e}[Symbol.iterator](){return null}}function ai(n,e,t,r,i,s){return new sa(n,e,t,r,i,s)}class sa extends oi{_numGeometries;_geometryType;constructor(e,t,r,i,s,o){super(r,i,s,o),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function li(n,e,t,r,i){return new oa(n,e,t,r,i)}class oa extends oi{_geometryTypes;constructor(e,t,r,i,s){super(t,r,i,s),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function aa(n,e,t,r,i){const s=Z(n,t),o=At(s,r,n,t);let a=null,l=null,u=null,c=null,f=null,p=null,d=null,h=null;if(o===B.CONST){const m=An(n,t,s,!1);for(let v=0;v<e-1;v++){const w=Z(n,t);switch(w.physicalStreamType){case U.LENGTH:switch(w.logicalStreamType.lengthType){case Q.GEOMETRIES:a=be(n,t,w);break;case Q.PARTS:l=be(n,t,w);break;case Q.RINGS:u=be(n,t,w);break;case Q.TRIANGLES:d=be(n,t,w)}break;case U.OFFSET:{switch(w.logicalStreamType.offsetType){case Le.VERTEX:c=X(n,t,w,!1);break;case Le.INDEX:h=X(n,t,w,!1);break}break}case U.DATA:{if(ae.VERTEX===w.logicalStreamType.dictionaryType)f=X(n,t,w,!0);else{const g=w;p={numBits:g.numBits,coordinateShift:g.coordinateShift},f=X(n,t,w,!1)}break}}}if(h!==null){if(a!=null||l!=null){const v=new Ne(a,l,u);return ai(r,m,d,h,f,v)}return ai(r,m,d,h,f)}return p===null?ta(r,m,new Ne(a,l,u),c,f):na(r,m,new Ne(a,l,u),c,f,p)}const y=X(n,t,s,!1);for(let m=0;m<e-1;m++){const v=Z(n,t);switch(v.physicalStreamType){case U.LENGTH:switch(v.logicalStreamType.lengthType){case Q.GEOMETRIES:a=X(n,t,v,!1);break;case Q.PARTS:l=X(n,t,v,!1);break;case Q.RINGS:u=X(n,t,v,!1);break;case Q.TRIANGLES:d=be(n,t,v)}break;case U.OFFSET:switch(v.logicalStreamType.offsetType){case Le.VERTEX:c=X(n,t,v,!1);break;case Le.INDEX:h=X(n,t,v,!1);break}break;case U.DATA:if(ae.VERTEX===v.logicalStreamType.dictionaryType)f=X(n,t,v,!0);else{const w=v;p={numBits:w.numBits,coordinateShift:w.coordinateShift},f=X(n,t,v,!1)}break}}return h!==null&&l===null?li(y,d,h,f):(a!==null?(a=On(y,a,2),l!==null&&u!==null?(l=ui(y,a,l,!1),u=ua(y,a,l,u)):l!==null&&(l=la(y,a,l))):l!==null&&u!==null?(l=On(y,l,1),u=ui(y,l,u,!0)):l!==null&&(l=On(y,l,0)),h!==null?li(y,d,h,f,new Ne(a,l,u)):p===null?ra(y,new Ne(a,l,u),c,f):ia(y,new Ne(a,l,u),c,f,p))}function On(n,e,t){const r=new Int32Array(n.length+1);let i=0;r[0]=i;let s=0;for(let o=0;o<n.length;o++)i=r[o+1]=i+(n[o]>t?e[s++]:1);return r}function ui(n,e,t,r){const i=new Int32Array(e[e.length-1]+1);let s=0;i[0]=s;let o=1,a=0;for(let l=0;l<n.length;l++){const u=n[l],c=e[l+1]-e[l];if(u===5||u===2||r&&(u===4||u===1))for(let f=0;f<c;f++)s=i[o++]=s+t[a++];else for(let f=0;f<c;f++)i[o++]=++s}return i}function la(n,e,t){const r=new Int32Array(e[e.length-1]+1);let i=0;r[0]=i;let s=1,o=0;for(let a=0;a<n.length;a++){const l=n[a],u=e[a+1]-e[a];if(l===4||l===1)for(let c=0;c<u;c++)i=r[s++]=i+t[o++];else for(let c=0;c<u;c++)r[s++]=++i}return r}function ua(n,e,t,r){const i=new Int32Array(t[t.length-1]+1);let s=0;i[0]=s;let o=1,a=1,l=0;for(let u=0;u<n.length;u++){const c=n[u],f=e[u+1]-e[u];if(c!==0&&c!==3)for(let p=0;p<f;p++){const d=t[o]-t[o-1];o++;for(let h=0;h<d;h++)s=i[a++]=s+r[l++]}else for(let p=0;p<f;p++)i[a++]=++s,o++}return i}class ca extends Ve{dataVector;constructor(e,t,r){super(e,t.getBuffer(),r),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}}class fa extends _t{getValueFromBuffer(e){return this.dataBuffer[e]}}class ci extends Ve{constructor(e,t,r){super(e,BigInt64Array.of(t),r)}getValueFromBuffer(e){return this.dataBuffer[0]}}function nt(n,e,t){const r=Math.ceil(e/8);return fi(n,r,t)}function ha(n,e,t,r){const i=Math.ceil(e/8),s=fi(n,i,t),o=new le(s,e),a=r.size(),l=new le(new Uint8Array(a),a);let u=0;for(let c=0;c<r.size();c++){const f=r.get(c)?o.get(u++):!1;l.set(c,f)}return l.getBuffer()}function fi(n,e,t){const r=new Uint8Array(e);let i=0;for(;i<e;){const s=n[t.increment()];if(s<=127){const o=s+3,a=n[t.increment()],l=i+o;r.fill(a,i,l),i=l}else{const o=256-s;for(let a=0;a<o;a++)r[i++]=n[t.increment()]}}return r}function pa(n,e,t){const r=e.get(),i=r+t*Float32Array.BYTES_PER_ELEMENT,s=new Uint8Array(n.subarray(r,i)).buffer,o=new Float32Array(s);return e.set(i),o}function da(n,e,t){const r=e.get(),i=r+t*Float64Array.BYTES_PER_ELEMENT,s=new Uint8Array(n.subarray(r,i)).buffer,o=new Float64Array(s);return e.set(i),o}function ya(n,e,t,r){const i=e.get(),s=i+r*Float32Array.BYTES_PER_ELEMENT,o=new Uint8Array(n.subarray(i,s)).buffer,a=new Float32Array(o);e.set(s);const l=t.size(),u=new Float32Array(l);let c=0;for(let f=0;f<l;f++)u[f]=t.get(f)?a[c++]:0;return u}function ma(n,e,t,r){const i=e.get(),s=i+r*Float64Array.BYTES_PER_ELEMENT,o=new Uint8Array(n.subarray(i,s)).buffer,a=new Float64Array(o);e.set(s);const l=t.size(),u=new Float64Array(l);let c=0;for(let f=0;f<l;f++)u[f]=t.get(f)?a[c++]:0;return u}const ga=12,xa=new TextDecoder;function Vn(n,e,t){return t-e>=ga?xa.decode(n.subarray(e,t)):va(n,e,t)}function va(n,e,t){let r="",i=e;for(;i<t;){const s=n[i];let o=null,a=s>239?4:s>223?3:s>191?2:1;if(i+a>t)break;let l,u,c;a===1?s<128&&(o=s):a===2?(l=n[i+1],(l&192)===128&&(o=(s&31)<<6|l&63,o<=127&&(o=null))):a===3?(l=n[i+1],u=n[i+2],(l&192)===128&&(u&192)===128&&(o=(s&15)<<12|(l&63)<<6|u&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):a===4&&(l=n[i+1],u=n[i+2],c=n[i+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(o=(s&15)<<18|(l&63)<<12|(u&63)<<6|c&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,a=1):o>65535&&(o-=65536,r+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),r+=String.fromCharCode(o),i+=a}return r}class Dn extends Ve{offsetBuffer;constructor(e,t,r,i){super(e,r,i),this.offsetBuffer=t}}class hi extends Dn{textEncoder;constructor(e,t,r,i){super(e,t,r,i??t.length-1),this.textEncoder=new TextEncoder}getValueFromBuffer(e){const t=this.offsetBuffer[e],r=this.offsetBuffer[e+1];return Vn(this.dataBuffer,t,r)}}class Be extends Dn{indexBuffer;textEncoder;constructor(e,t,r,i,s){super(e,r,i,s??t.length),this.indexBuffer=t,this.indexBuffer=t,this.textEncoder=new TextEncoder}getValueFromBuffer(e){const t=this.indexBuffer[e],r=this.offsetBuffer[t],i=this.offsetBuffer[t+1];return Vn(this.dataBuffer,r,i)}}function ba(n,e,t){const r=[],i=new Array(e.length).fill(0);for(let s=1;s<e.length;s++)i[s]=i[s-1]+e[s-1];for(let s=0;s<t.length;s++)if(t[s]===255)r.push(t[++s]);else{const o=e[t[s]],a=i[t[s]];for(let l=0;l<o;l++)r.push(n[a+l])}return new Uint8Array(r)}class pi extends Dn{indexBuffer;symbolOffsetBuffer;symbolTableBuffer;textEncoder;symbolLengthBuffer;lengthBuffer;decodedDictionary;constructor(e,t,r,i,s,o,a){super(e,r,i,a),this.indexBuffer=t,this.symbolOffsetBuffer=s,this.symbolTableBuffer=o,this.textEncoder=new TextEncoder}getValueFromBuffer(e){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer),this.lengthBuffer=this.offsetToLengthBuffer(this.offsetBuffer)),this.decodedDictionary=ba(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const t=this.indexBuffer[e],r=this.offsetBuffer[t],i=this.offsetBuffer[t+1];return Vn(this.decodedDictionary,r,i)}offsetToLengthBuffer(e){const t=new Uint32Array(e.length-1);let r=e[0];for(let i=1;i<e.length;i++){const s=e[i];t[i-1]=s-r,r=s}return t}}const wa="default",Ca=":";function Ta(n,e,t,r,i){let s=null,o=null,a=null,l=null,u=null,c=null,f=null,p=null;for(let d=0;d<r;d++){const h=Z(e,t);if(h.byteLength!==0)switch(h.physicalStreamType){case U.PRESENT:{const y=nt(e,h.numValues,t);c=new le(y,h.numValues);break}case U.OFFSET:{o=i!=null||c!=null?zn(e,t,h,!1,i??c):X(e,t,h,!1);break}case U.LENGTH:{const y=be(e,t,h);Q.DICTIONARY===h.logicalStreamType.lengthType?s=y:Q.SYMBOL===h.logicalStreamType.lengthType?l=y:f=y;break}case U.DATA:{const y=e.subarray(t.get(),t.get()+h.byteLength);t.add(h.byteLength);const m=h.logicalStreamType.dictionaryType;ae.FSST===m?u=y:ae.SINGLE===m||ae.SHARED===m?a=y:ae.NONE===m&&(p=y);break}}}return _a(n,u,o,s,a,l,i??c)??Ia(n,a,o,s,i??c)??La(n,f,p,o,i??c)}function _a(n,e,t,r,i,s,o){return e?new pi(n,t,r,i,s,e,o):null}function Ia(n,e,t,r,i){return e?i?new Be(n,t,r,e,i):new Be(n,t,r,e):null}function La(n,e,t,r,i){if(!e||!t)return null;if(r)return i?new Be(n,r,e,t,i):new Be(n,r,e,t);if(i&&i.size()!==e.length-1){const s=new Int32Array(i.size());let o=0;for(let a=0;a<i.size();a++)i.get(a)?s[a]=o++:s[a]=0;return new Be(n,s,e,t,i)}return i?new hi(n,e,t,i):new hi(n,e,t)}function Sa(n,e,t,r,i){let s=null,o=null,a=null,l=null,u=!1;for(;!u;){const d=Z(n,e);switch(d.physicalStreamType){case U.LENGTH:Q.DICTIONARY===d.logicalStreamType.lengthType?s=be(n,e,d):a=be(n,e,d);break;case U.DATA:ae.SINGLE===d.logicalStreamType.dictionaryType||ae.SHARED===d.logicalStreamType.dictionaryType?(o=n.subarray(e.get(),e.get()+d.byteLength),u=!0):l=n.subarray(e.get(),e.get()+d.byteLength),e.add(d.byteLength);break}}const c=t.complexType.children,f=[];let p=0;for(const d of c){const h=G(n,e,1)[0];if(h==0)continue;const y=`${t.name}${d.name===wa?"":Ca+d.name}`;if(h!==2||d.type!=="scalarField"||d.scalarField.physicalType!==z.STRING)throw new Error("Currently only optional string fields are implemented for a struct.");const m=Z(n,e),v=nt(n,m.numValues,e),w=Z(n,e),b=w.decompressedCount!==r?zn(n,e,w,!1,new le(v,m.numValues)):X(n,e,w,!1);f[p++]=l?new pi(y,b,s,o,a,l,new le(v,m.numValues)):new Be(y,b,s,o,new le(v,m.numValues))}return f}function Ea(n,e,t,r,i,s){return t.type==="scalarType"?Aa(r,n,e,i,t.scalarType,t):r!=1?null:Sa(n,e,t,i)}function Aa(n,e,t,r,i,s){let o=null,a=0;if(n===0)return null;if(s.nullable){const c=Z(e,t);a=c.numValues;const f=t.get(),p=nt(e,a,t);t.set(f+c.byteLength),o=new le(p,c.numValues)}const l=o??r;switch(i.physicalType){case z.UINT_32:case z.INT_32:return Ma(e,t,s,i,l);case z.STRING:const c=s.nullable?n-1:n;return Ta(s.name,e,t,c,o);case z.BOOLEAN:return za(e,t,s,r,l);case z.UINT_64:case z.INT_64:return Pa(e,t,s,l,i);case z.FLOAT:return Fa(e,t,s,l);case z.DOUBLE:return ka(e,t,s,l);default:throw new Error(`The specified data type for the field is currently not supported: ${i}`)}}function za(n,e,t,r,i){const s=Z(n,e),o=s.numValues,a=e.get(),l=rt(i)?ha(n,o,e,i):nt(n,o,e);e.set(a+s.byteLength);const u=new le(l,o);return new ca(t.name,u,i)}function Fa(n,e,t,r){const i=Z(n,e),s=rt(r)?ya(n,e,r,i.numValues):pa(n,e,i.numValues);return new fa(t.name,s,r)}function ka(n,e,t,r){const i=Z(n,e),s=rt(r)?ma(n,e,r,i.numValues):da(n,e,i.numValues);return new _n(t.name,s,r)}function Pa(n,e,t,r,i){const s=Z(n,e),o=At(s,r,n,e),a=i.physicalType===z.INT_64;if(o===B.FLAT){const l=rt(r)?Jo(n,e,s,a,r):Hr(n,e,s,a);return new Kr(t.name,l,r)}else if(o===B.SEQUENCE){const l=Wr(n,e,s);return new Qr(t.name,l[0],l[1],s.numRleValues)}else{const l=Jr(n,e,s,a);return new ci(t.name,l,r)}}function Ma(n,e,t,r,i){const s=Z(n,e),o=At(s,i,n,e),a=r.physicalType===z.INT_32;if(o===B.FLAT){const l=rt(i)?zn(n,e,s,a,i):X(n,e,s,a);return new Tn(t.name,l,i)}else if(o===B.SEQUENCE){const l=Yr(n,e,s);return new In(t.name,l[0],l[1],s.numRleValues)}else{const l=An(n,e,s,a);return new Ln(t.name,l,i)}}function rt(n){return n instanceof le}function Oa(n){switch(n){case 0:case 1:case 2:case 3:{const e={};e.nullable=(n&1)!==0,e.columnScope=It.FEATURE;const t={},r=n>1?z.UINT_64:z.UINT_32;return t.physicalType=r,t.type="physicalType",e.scalarType=t,e.type="scalarType",e}case 4:{const e={};e.nullable=!1,e.columnScope=It.FEATURE;const t={};return t.type="physicalType",t.physicalType=Lt.GEOMETRY,e.type="complexType",e.complexType=t,e}case 30:{const e={};e.nullable=!1,e.columnScope=It.FEATURE;const t={};return t.type="physicalType",t.physicalType=Lt.STRUCT,e.type="complexType",e.complexType=t,e}default:return Ba(n)}}function Va(n){return n>=10}function Da(n){return n===30}function Na(n){if(n.name==="id")return!1;if(n.type==="scalarType"){const e=n.scalarType;if(e.type==="physicalType")switch(e.physicalType){case z.BOOLEAN:case z.INT_8:case z.UINT_8:case z.INT_32:case z.UINT_32:case z.INT_64:case z.UINT_64:case z.FLOAT:case z.DOUBLE:return!1;case z.STRING:return!0;default:return!1}else if(e.type==="logicalType")return!1}else if(n.type==="complexType"){const e=n.complexType;if(e.type==="physicalType")switch(e.physicalType){case Lt.GEOMETRY:case Lt.STRUCT:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",n),!1}function Ba(n){let e=null;switch(n){case 10:case 11:e=z.BOOLEAN;break;case 12:case 13:e=z.INT_8;break;case 14:case 15:e=z.UINT_8;break;case 16:case 17:e=z.INT_32;break;case 18:case 19:e=z.UINT_32;break;case 20:case 21:e=z.INT_64;break;case 22:case 23:e=z.UINT_64;break;case 24:case 25:e=z.FLOAT;break;case 26:case 27:e=z.DOUBLE;break;case 28:case 29:e=z.STRING;break;default:return null}const t={};t.nullable=(n&1)!==0,t.columnScope=It.FEATURE;const r={};return r.type="physicalType",r.physicalType=e,t.type="scalarType",t.scalarType=r,t}const Ra=new TextDecoder;function di(n,e){const t=G(n,e,1)[0];if(t===0)return"";const r=e.get(),i=r+t,s=n.subarray(r,i);return e.add(t),Ra.decode(s)}function yi(n,e){const t=G(n,e,1)[0]>>>0,r=(t&4)!==0,i=(t&2)!==0,s=G(n,e,1)[0]>>>0,o={};if((t&1)!==0&&(o.nullable=!0),i){const a={};if(r?(a.type="logicalType",a.logicalType=s):(a.type="physicalType",a.physicalType=s),(t&8)!==0){const l=G(n,e,1)[0]>>>0;a.children=new Array(l);for(let u=0;u<l;u++)a.children[u]=yi(n,e)}o.type="complexField",o.complexField=a}else{const a={};r?(a.type="logicalType",a.logicalType=s):(a.type="physicalType",a.physicalType=s),o.type="scalarField",o.scalarField=a}return o}function qa(n,e){const t=G(n,e,1)[0]>>>0,r=Oa(t);if(!r)throw new Error(`Unsupported column type code: ${t}`);if(Va(t)?r.name=di(n,e):t>=0&&t<=3?r.name="id":t===4&&(r.name="geometry"),Da(t)){const i=G(n,e,1)[0]>>>0,s=r.complexType;s.children=new Array(i);for(let o=0;o<i;o++)s.children[o]=yi(n,e)}return r}function Ga(n,e){const t={};t.featureTables=[];const r={};r.name=di(n,e);const i=G(n,e,1)[0]>>>0,s=G(n,e,1)[0]>>>0;r.columns=new Array(s);for(let o=0;o<s;o++)r.columns[o]=qa(n,e);return t.featureTables.push(r),[t,i]}const Ua="id",$a="geometry";function ja(n,e,t=!0){const r=new no(0),i=[];for(;r.get()<n.length;){const s=G(n,r,1)[0]>>>0,a=r.get()+s;if(a>n.length)throw new Error(`Block overruns tile: ${a} > ${n.length}`);if(G(n,r,1)[0]>>>0!==1){r.set(a);continue}const u=Ga(n,r),c=u[0],f=u[1],p=c.featureTables[0];let d=null,h=null;const y=[];let m=0;for(const w of p.columns){const g=w.name;if(g===Ua){let x=null;if(w.nullable){const T=Z(n,r),_=r.get(),I=nt(n,T.numValues,r);r.set(_+T.byteLength),x=new le(I,T.numValues)}const b=Z(n,r);m=b.decompressedCount,d=Za(n,w,r,g,b,x??m,t)}else if(g===$a){const x=G(n,r,1)[0];if(m===0){const b=r.get();m=Z(n,r).decompressedCount,r.set(b)}h=aa(n,x,r,m)}else{const b=Na(w)?G(n,r,1)[0]:1;if(b===0&&w.type==="scalarType")continue;const T=Ea(n,r,w,b,m);if(T)if(Array.isArray(T))for(const _ of T)y.push(_);else y.push(T)}}const v=new to(p.name,h,d,y,f);i.push(v),r.set(a)}return i}function Za(n,e,t,r,i,s,o=!1){const a=e.scalarType.physicalType,l=At(i,s,n,t);if(a===z.UINT_32)switch(l){case B.FLAT:{const u=X(n,t,i,!1);return new Tn(r,u,s)}case B.SEQUENCE:{const u=Yr(n,t,i);return new In(r,u[0],u[1],i.numRleValues)}case B.CONST:{const u=An(n,t,i,!1);return new Ln(r,u,s)}}else switch(l){case B.FLAT:{if(o){const c=Zo(n,t,i,!1);return new _n(r,c,s)}const u=Hr(n,t,i,!1);return new Kr(r,u,s)}case B.SEQUENCE:{const u=Wr(n,t,i);return new Qr(r,u[0],u[1],i.numRleValues)}case B.CONST:{const u=Jr(n,t,i,!1);return new ci(r,u,s)}}throw new Error("Vector type not supported for id column.")}class Xa{constructor(e,t){switch(this._featureData=e,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case R.POINT:case R.MULTIPOINT:this.type=1;break;case R.LINESTRING:case R.MULTILINESTRING:this.type=2;break;case R.POLYGON:case R.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){const e=[];for(const t of this._featureData.geometry.coordinates){const r=[];for(const i of t)r.push(new P(i.x,i.y));e.push(r)}return e}}class Ya{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new Xa(this.features[e],this.extent)}}class Wa{constructor(e){this.layers={};const t=ja(new Uint8Array(e));this.layers=t.reduce((r,i)=>({...r,[i.name]:new Ya(i)}),{})}}const Nn=65536*65536,mi=1/Nn,Ha=12,gi=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),Bn=0,Pt=1,it=2,Mt=5;class Ja{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,r=this.length){for(;this.pos<r;){const i=this.readVarint(),s=i>>3,o=this.pos;this.type=i&7,e(s,t,this),this.pos===o&&this.skip(i)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Nn;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Nn;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let r,i;return i=t[this.pos++],r=i&127,i<128||(i=t[this.pos++],r|=(i&127)<<7,i<128)||(i=t[this.pos++],r|=(i&127)<<14,i<128)||(i=t[this.pos++],r|=(i&127)<<21,i<128)?r:(i=t[this.pos],r|=(i&15)<<28,Ka(r,e,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2===1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=Ha&&gi?gi.decode(this.buf.subarray(t,e)):fl(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===it?this.readVarint()+this.pos:this.pos+1}skip(e){const t=e&7;if(t===Bn)for(;this.buf[this.pos++]>127;);else if(t===it)this.pos=this.readVarint()+this.pos;else if(t===Mt)this.pos+=4;else if(t===Pt)this.pos+=8;else throw new Error(`Unimplemented type: ${t}`)}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.dataView=new DataView(r.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*mi),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*mi),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){Qa(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))}writeSVarint(e){this.writeVarint(e<0?-e*2-1:e*2)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(e.length*4),this.pos++;const t=this.pos;this.pos=hl(this.buf,e,this.pos);const r=this.pos-t;r>=128&&xi(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let r=0;r<t;r++)this.buf[this.pos++]=e[r]}writeRawMessage(e,t){this.pos++;const r=this.pos;e(t,this);const i=this.pos-r;i>=128&&xi(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i}writeMessage(e,t,r){this.writeTag(e,it),this.writeRawMessage(t,r)}writePackedVarint(e,t){t.length&&this.writeMessage(e,nl,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,rl,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,ol,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,il,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,sl,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,al,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,ll,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,ul,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,cl,t)}writeBytesField(e,t){this.writeTag(e,it),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,Mt),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,Mt),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,Pt),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,Pt),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,Bn),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,Bn),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,it),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,Mt),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,Pt),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function Ka(n,e,t){const r=t.buf;let i,s;if(s=r[t.pos++],i=(s&112)>>4,s<128||(s=r[t.pos++],i|=(s&127)<<3,s<128)||(s=r[t.pos++],i|=(s&127)<<10,s<128)||(s=r[t.pos++],i|=(s&127)<<17,s<128)||(s=r[t.pos++],i|=(s&127)<<24,s<128)||(s=r[t.pos++],i|=(s&1)<<31,s<128))return Re(n,i,e);throw new Error("Expected varint not more than 10 bytes")}function Re(n,e,t){return t?e*4294967296+(n>>>0):(e>>>0)*4294967296+(n>>>0)}function Qa(n,e){let t,r;if(n>=0?(t=n%4294967296|0,r=n/4294967296|0):(t=~(-n%4294967296),r=~(-n/4294967296),t^4294967295?t=t+1|0:(t=0,r=r+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),el(t,r,e),tl(r,e)}function el(n,e,t){t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos]=n&127}function tl(n,e){const t=(n&7)<<4;e.buf[e.pos++]|=t|((n>>>=3)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127)))))}function xi(n,e,t){const r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(r);for(let i=t.pos-1;i>=n;i--)t.buf[i+r]=t.buf[i]}function nl(n,e){for(let t=0;t<n.length;t++)e.writeVarint(n[t])}function rl(n,e){for(let t=0;t<n.length;t++)e.writeSVarint(n[t])}function il(n,e){for(let t=0;t<n.length;t++)e.writeFloat(n[t])}function sl(n,e){for(let t=0;t<n.length;t++)e.writeDouble(n[t])}function ol(n,e){for(let t=0;t<n.length;t++)e.writeBoolean(n[t])}function al(n,e){for(let t=0;t<n.length;t++)e.writeFixed32(n[t])}function ll(n,e){for(let t=0;t<n.length;t++)e.writeSFixed32(n[t])}function ul(n,e){for(let t=0;t<n.length;t++)e.writeFixed64(n[t])}function cl(n,e){for(let t=0;t<n.length;t++)e.writeSFixed64(n[t])}function fl(n,e,t){let r="",i=e;for(;i<t;){const s=n[i];let o=null,a=s>239?4:s>223?3:s>191?2:1;if(i+a>t)break;let l,u,c;a===1?s<128&&(o=s):a===2?(l=n[i+1],(l&192)===128&&(o=(s&31)<<6|l&63,o<=127&&(o=null))):a===3?(l=n[i+1],u=n[i+2],(l&192)===128&&(u&192)===128&&(o=(s&15)<<12|(l&63)<<6|u&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):a===4&&(l=n[i+1],u=n[i+2],c=n[i+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(o=(s&15)<<18|(l&63)<<12|(u&63)<<6|c&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,a=1):o>65535&&(o-=65536,r+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),r+=String.fromCharCode(o),i+=a}return r}function hl(n,e,t){for(let r=0,i,s;r<e.length;r++){if(i=e.charCodeAt(r),i>55295&&i<57344)if(s)if(i<56320){n[t++]=239,n[t++]=191,n[t++]=189,s=i;continue}else i=s-55296<<10|i-56320|65536,s=null;else{i>56319||r+1===e.length?(n[t++]=239,n[t++]=191,n[t++]=189):s=i;continue}else s&&(n[t++]=239,n[t++]=191,n[t++]=189,s=null);i<128?n[t++]=i:(i<2048?n[t++]=i>>6|192:(i<65536?n[t++]=i>>12|224:(n[t++]=i>>18|240,n[t++]=i>>12&63|128),n[t++]=i>>6&63|128),n[t++]=i&63|128)}return t}class vi extends bn{constructor(e,t){super(e,t),this.tilingScheme=new Cesium.WebMercatorTilingScheme}async init(){const e=this.styleSource;let t=e.url;if(t&&!e.tiles){t=/^((http)|(https)|(data:)|\/)/.test(t)?t:this.path+e.url;try{const r=await Cesium.Resource.fetchJson(t);for(const i in r)e[i]||(e[i]=r[i])}catch(r){this.errorEvent.raiseEvent(r)}}}async requestTile(e,t,r){const i=this.styleSource;if(!i.tiles||!i.tiles.length)return;i.scheme==="tms"&&(t=this.tilingScheme.getNumberOfYTilesAtLevel(r)-t-1);let s=i.tiles[0].replace("{x}",e).replace("{y}",t).replace("{z}",r);s=/^((http)|(https)|(data:)|\/)/.test(s)?s:this.path+s;try{const o=await fetch(s).then(l=>l.arrayBuffer());return i.encoding=="mlt"?new Wa(o):new Qs(new Ja(o))}catch(o){this.errorEvent.raiseEvent(o)}}async requestTileBuffer(e,t,r,i){const s=this.styleSource;if(!s.tiles||!s.tiles.length)return;s.scheme==="tms"&&(t=this.tilingScheme.getNumberOfYTilesAtLevel(r)-t-1);let o=s.tiles[0].replace("{x}",e).replace("{y}",t).replace("{z}",r);o=/^((http)|(https)|(data:)|\/)/.test(o)?o:this.path+o;try{const a=await fetch(o).then(u=>u.arrayBuffer()),l=s.encoding==="mlt"?"mlt":"mvt";return{buffer:a,encoding:l}}catch(a){this.errorEvent.raiseEvent(a)}}}Cn("vector",vi);function Rn(n,e,t,r){let i=r;const s=e+(t-e>>1);let o=t-e,a;const l=n[e],u=n[e+1],c=n[t],f=n[t+1];for(let p=e+3;p<t;p+=3){const d=pl(n[p],n[p+1],l,u,c,f);if(d>i)a=p,i=d;else if(d===i){const h=Math.abs(p-s);h<o&&(a=p,o=h)}}i>r&&(a-e>3&&Rn(n,e,a,r),n[a+2]=i,t-a>3&&Rn(n,a,t,r))}function pl(n,e,t,r,i,s){let o=i-t,a=s-r;if(o!==0||a!==0){const l=((n-t)*o+(e-r)*a)/(o*o+a*a);l>1?(t=i,r=s):l>0&&(t+=o*l,r+=a*l)}return o=n-t,a=e-r,o*o+a*a}function st(n,e,t,r){const i={id:n??null,type:e,geometry:t,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(e==="Point"||e==="MultiPoint"||e==="LineString")Ot(i,t);else if(e==="Polygon")Ot(i,t[0]);else if(e==="MultiLineString")for(const s of t)Ot(i,s);else if(e==="MultiPolygon")for(const s of t)Ot(i,s[0]);return i}function Ot(n,e){for(let t=0;t<e.length;t+=3)n.minX=Math.min(n.minX,e[t]),n.minY=Math.min(n.minY,e[t+1]),n.maxX=Math.max(n.maxX,e[t]),n.maxY=Math.max(n.maxY,e[t+1])}function dl(n,e){const t=[];if(n.type==="FeatureCollection")for(let r=0;r<n.features.length;r++)Vt(t,n.features[r],e,r);else n.type==="Feature"?Vt(t,n,e):Vt(t,{geometry:n},e);return t}function Vt(n,e,t,r){if(!e.geometry)return;const i=e.geometry.coordinates;if(i&&i.length===0)return;const s=e.geometry.type,o=Math.pow(t.tolerance/((1<<t.maxZoom)*t.extent),2);let a=[],l=e.id;if(t.promoteId?l=e.properties[t.promoteId]:t.generateId&&(l=r||0),s==="Point")bi(i,a);else if(s==="MultiPoint")for(const u of i)bi(u,a);else if(s==="LineString")qn(i,a,o,!1);else if(s==="MultiLineString")if(t.lineMetrics){for(const u of i)a=[],qn(u,a,o,!1),n.push(st(l,"LineString",a,e.properties));return}else Gn(i,a,o,!1);else if(s==="Polygon")Gn(i,a,o,!0);else if(s==="MultiPolygon")for(const u of i){const c=[];Gn(u,c,o,!0),a.push(c)}else if(s==="GeometryCollection"){for(const u of e.geometry.geometries)Vt(n,{id:l,geometry:u,properties:e.properties},t,r);return}else throw new Error("Input data is not a valid GeoJSON object.");n.push(st(l,s,a,e.properties))}function bi(n,e){e.push(wi(n[0]),Ci(n[1]),0)}function qn(n,e,t,r){let i,s,o=0;for(let l=0;l<n.length;l++){const u=wi(n[l][0]),c=Ci(n[l][1]);e.push(u,c,0),l>0&&(r?o+=(i*c-u*s)/2:o+=Math.sqrt(Math.pow(u-i,2)+Math.pow(c-s,2))),i=u,s=c}const a=e.length-3;e[2]=1,Rn(e,0,a,t),e[a+2]=1,e.size=Math.abs(o),e.start=0,e.end=e.size}function Gn(n,e,t,r){for(let i=0;i<n.length;i++){const s=[];qn(n[i],s,t,r),e.push(s)}}function wi(n){return n/360+.5}function Ci(n){const e=Math.sin(n*Math.PI/180),t=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return t<0?0:t>1?1:t}function ge(n,e,t,r,i,s,o,a){if(t/=e,r/=e,s>=t&&o<r)return n;if(o<t||s>=r)return null;const l=[];for(const u of n){const c=u.geometry;let f=u.type;const p=i===0?u.minX:u.minY,d=i===0?u.maxX:u.maxY;if(p>=t&&d<r){l.push(u);continue}else if(d<t||p>=r)continue;let h=[];if(f==="Point"||f==="MultiPoint")yl(c,h,t,r,i);else if(f==="LineString")Ti(c,h,t,r,i,!1,a.lineMetrics);else if(f==="MultiLineString")Un(c,h,t,r,i,!1);else if(f==="Polygon")Un(c,h,t,r,i,!0);else if(f==="MultiPolygon")for(const y of c){const m=[];Un(y,m,t,r,i,!0),m.length&&h.push(m)}if(h.length){if(a.lineMetrics&&f==="LineString"){for(const y of h)l.push(st(u.id,f,y,u.tags));continue}(f==="LineString"||f==="MultiLineString")&&(h.length===1?(f="LineString",h=h[0]):f="MultiLineString"),(f==="Point"||f==="MultiPoint")&&(f=h.length===3?"Point":"MultiPoint"),l.push(st(u.id,f,h,u.tags))}}return l.length?l:null}function yl(n,e,t,r,i){for(let s=0;s<n.length;s+=3){const o=n[s+i];o>=t&&o<=r&&qe(e,n[s],n[s+1],n[s+2])}}function Ti(n,e,t,r,i,s,o){let a=_i(n);const l=i===0?ml:gl;let u=n.start,c,f;for(let v=0;v<n.length-3;v+=3){const w=n[v],g=n[v+1],x=n[v+2],b=n[v+3],T=n[v+4],_=i===0?w:g,I=i===0?b:T;let k=!1;o&&(c=Math.sqrt(Math.pow(w-b,2)+Math.pow(g-T,2))),_<t?I>t&&(f=l(a,w,g,b,T,t),o&&(a.start=u+c*f)):_>r?I<r&&(f=l(a,w,g,b,T,r),o&&(a.start=u+c*f)):qe(a,w,g,x),I<t&&_>=t&&(f=l(a,w,g,b,T,t),k=!0),I>r&&_<=r&&(f=l(a,w,g,b,T,r),k=!0),!s&&k&&(o&&(a.end=u+c*f),e.push(a),a=_i(n)),o&&(u+=c)}let p=n.length-3;const d=n[p],h=n[p+1],y=n[p+2],m=i===0?d:h;m>=t&&m<=r&&qe(a,d,h,y),p=a.length-3,s&&p>=3&&(a[p]!==a[0]||a[p+1]!==a[1])&&qe(a,a[0],a[1],a[2]),a.length&&e.push(a)}function _i(n){const e=[];return e.size=n.size,e.start=n.start,e.end=n.end,e}function Un(n,e,t,r,i,s){for(const o of n)Ti(o,e,t,r,i,s,!1)}function qe(n,e,t,r){n.push(e,t,r)}function ml(n,e,t,r,i,s){const o=(s-e)/(r-e);return qe(n,s,t+(i-t)*o,1),o}function gl(n,e,t,r,i,s){const o=(s-t)/(i-t);return qe(n,e+(r-e)*o,s,1),o}function xl(n,e){const t=e.buffer/e.extent;let r=n;const i=ge(n,1,-1-t,t,0,-1,2,e),s=ge(n,1,1-t,2+t,0,-1,2,e);return(i||s)&&(r=ge(n,1,-t,1+t,0,-1,2,e)||[],i&&(r=Ii(i,1).concat(r)),s&&(r=r.concat(Ii(s,-1)))),r}function Ii(n,e){const t=[];for(let r=0;r<n.length;r++){const i=n[r],s=i.type;let o;if(s==="Point"||s==="MultiPoint"||s==="LineString")o=$n(i.geometry,e);else if(s==="MultiLineString"||s==="Polygon"){o=[];for(const a of i.geometry)o.push($n(a,e))}else if(s==="MultiPolygon"){o=[];for(const a of i.geometry){const l=[];for(const u of a)l.push($n(u,e));o.push(l)}}t.push(st(i.id,s,o,i.tags))}return t}function $n(n,e){const t=[];t.size=n.size,n.start!==void 0&&(t.start=n.start,t.end=n.end);for(let r=0;r<n.length;r+=3)t.push(n[r]+e,n[r+1],n[r+2]);return t}function Li(n,e){if(n.transformed)return n;const t=1<<n.z,r=n.x,i=n.y;for(const s of n.features){const o=s.geometry,a=s.type;if(s.geometry=[],a===1)for(let l=0;l<o.length;l+=2)s.geometry.push(Si(o[l],o[l+1],e,t,r,i));else for(let l=0;l<o.length;l++){const u=[];for(let c=0;c<o[l].length;c+=2)u.push(Si(o[l][c],o[l][c+1],e,t,r,i));s.geometry.push(u)}}return n.transformed=!0,n}function Si(n,e,t,r,i,s){return[Math.round(t*(n*r-i)),Math.round(t*(e*r-s))]}function vl(n,e,t,r,i){const s=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:n.length,source:null,x:t,y:r,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const a of n)bl(o,a,s,i);return o}function bl(n,e,t,r){const i=e.geometry,s=e.type,o=[];if(n.minX=Math.min(n.minX,e.minX),n.minY=Math.min(n.minY,e.minY),n.maxX=Math.max(n.maxX,e.maxX),n.maxY=Math.max(n.maxY,e.maxY),s==="Point"||s==="MultiPoint")for(let a=0;a<i.length;a+=3)o.push(i[a],i[a+1]),n.numPoints++,n.numSimplified++;else if(s==="LineString")jn(o,i,n,t,!1,!1);else if(s==="MultiLineString"||s==="Polygon")for(let a=0;a<i.length;a++)jn(o,i[a],n,t,s==="Polygon",a===0);else if(s==="MultiPolygon")for(let a=0;a<i.length;a++){const l=i[a];for(let u=0;u<l.length;u++)jn(o,l[u],n,t,!0,u===0)}if(o.length){let a=e.tags||null;if(s==="LineString"&&r.lineMetrics){a={};for(const u in e.tags)a[u]=e.tags[u];a.mapbox_clip_start=i.start/i.size,a.mapbox_clip_end=i.end/i.size}const l={geometry:o,type:s==="Polygon"||s==="MultiPolygon"?3:s==="LineString"||s==="MultiLineString"?2:1,tags:a};e.id!==null&&(l.id=e.id),n.features.push(l)}}function jn(n,e,t,r,i,s){const o=r*r;if(r>0&&e.size<(i?o:r)){t.numPoints+=e.length/3;return}const a=[];for(let l=0;l<e.length;l+=3)(r===0||e[l+2]>o)&&(t.numSimplified++,a.push(e[l],e[l+1])),t.numPoints++;i&&wl(a,s),n.push(a)}function wl(n,e){let t=0;for(let r=0,i=n.length,s=i-2;r<i;s=r,r+=2)t+=(n[r]-n[s])*(n[r+1]+n[s+1]);if(t>0===e)for(let r=0,i=n.length;r<i/2;r+=2){const s=n[r],o=n[r+1];n[r]=n[i-2-r],n[r+1]=n[i-1-r],n[i-2-r]=s,n[i-1-r]=o}}const Cl={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Tl{constructor(e,t){t=this.options=_l(Object.create(Cl),t);const r=t.debug;if(r&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let i=dl(e,t);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=xl(i,t),i.length&&this.splitTile(i,0,0,0),r&&(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(e,t,r,i,s,o,a){const l=[e,t,r,i],u=this.options,c=u.debug;for(;l.length;){i=l.pop(),r=l.pop(),t=l.pop(),e=l.pop();const f=1<<t,p=Zn(t,r,i);let d=this.tiles[p];if(!d&&(c>1&&console.time("creation"),d=this.tiles[p]=vl(e,t,r,i,u),this.tileCoords.push({z:t,x:r,y:i}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,r,i,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd("creation"));const I=`z${t}`;this.stats[I]=(this.stats[I]||0)+1,this.total++}if(d.source=e,s==null){if(t===u.indexMaxZoom||d.numPoints<=u.indexMaxPoints)continue}else{if(t===u.maxZoom||t===s)continue;if(s!=null){const I=s-t;if(r!==o>>I||i!==a>>I)continue}}if(d.source=null,e.length===0)continue;c>1&&console.time("clipping");const h=.5*u.buffer/u.extent,y=.5-h,m=.5+h,v=1+h;let w=null,g=null,x=null,b=null,T=ge(e,f,r-h,r+m,0,d.minX,d.maxX,u),_=ge(e,f,r+y,r+v,0,d.minX,d.maxX,u);e=null,T&&(w=ge(T,f,i-h,i+m,1,d.minY,d.maxY,u),g=ge(T,f,i+y,i+v,1,d.minY,d.maxY,u),T=null),_&&(x=ge(_,f,i-h,i+m,1,d.minY,d.maxY,u),b=ge(_,f,i+y,i+v,1,d.minY,d.maxY,u),_=null),c>1&&console.timeEnd("clipping"),l.push(w||[],t+1,r*2,i*2),l.push(g||[],t+1,r*2,i*2+1),l.push(x||[],t+1,r*2+1,i*2),l.push(b||[],t+1,r*2+1,i*2+1)}}getTile(e,t,r){e=+e,t=+t,r=+r;const i=this.options,{extent:s,debug:o}=i;if(e<0||e>24)return null;const a=1<<e;t=t+a&a-1;const l=Zn(e,t,r);if(this.tiles[l])return Li(this.tiles[l],s);o>1&&console.log("drilling down to z%d-%d-%d",e,t,r);let u=e,c=t,f=r,p;for(;!p&&u>0;)u--,c=c>>1,f=f>>1,p=this.tiles[Zn(u,c,f)];return!p||!p.source?null:(o>1&&(console.log("found parent tile z%d-%d-%d",u,c,f),console.time("drilling down")),this.splitTile(p.source,u,c,f,e,t,r),o>1&&console.timeEnd("drilling down"),this.tiles[l]?Li(this.tiles[l],s):null)}}function Zn(n,e,t){return((1<<n)*t+e)*32+n}function _l(n,e){for(const t in e)n[t]=e[t];return n}function Il(n,e){return new Tl(n,e)}class Ll{constructor(e,t){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=t,"id"in e&&(typeof e.id=="string"?this.id=parseInt(e.id,10):typeof e.id!="number"||isNaN(e.id)||(this.id=e.id))}loadGeometry(){const e=[],t=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(const r of t){const i=[];for(const s of r)i.push(new P(s[0],s[1]));e.push(i)}return e}}const Ei="_geojsonTileLayer";class Sl{constructor(e,t){this.layers={[Ei]:this},this.name=Ei,this.version=t?t.version:1,this.extent=t?t.extent:4096,this.length=e.length,this.features=e}feature(e){return new Ll(this.features[e],this.extent)}}const te=8192;class Ai extends bn{constructor(e,t){super(e,t)}async init(){const e=this.styleSource;let t=e.data;if(typeof t=="string"){const r=/^((http)|(https)|(data:)|\/)/.test(t)?t:this.path+t;try{t=await Cesium.Resource.fetchJson(r)}catch(i){this.errorEvent.raiseEvent(i)}}t&&t.features?.length&&(this.tileIndex=new Il(t,{extent:te,buffer:e.buffer===void 0?128:e.buffer,tolerance:e.tolerance===e.tolerance?.375:e.tolerance}))}async requestTile(e,t,r){if(this.tileIndex)try{const i=this.tileIndex.getTile(r,e,t);return i?new Sl(i.features,{extent:te}):void 0}catch(i){this.errorEvent.raiseEvent(i)}}}Cn("geojson",Ai);var El=8,Al={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},zl={"*":{type:"source"}},Fl=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],kl={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},Pl={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Ml={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Ol={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},Vl={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},Dl={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},Nl={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},Bl=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],Rl={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},ql={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},Gl={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},Ul={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},$l={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},jl={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},Zl={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},Xl={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},Yl={type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},Wl={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},Hl={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},Jl={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},Kl={type:"array",value:"expression_name",minimum:1},Ql={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},eu={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},tu={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},nu={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},ru=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],iu={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},su={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},ou={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},au={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},lu={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},uu={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},cu={"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},fu={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},hu={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},pu={"*":{type:"string"}},du={type:"array",value:"interpolation_name",minimum:1},yu={type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}},mu={$version:El,$root:Al,sources:zl,source:Fl,source_vector:kl,source_raster:Pl,source_raster_dem:Ml,source_geojson:Ol,source_video:Vl,source_image:Dl,layer:Nl,layout:Bl,layout_background:Rl,layout_fill:ql,layout_circle:Gl,layout_heatmap:Ul,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:$l,layout_symbol:jl,layout_raster:Zl,layout_hillshade:Xl,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:Yl,filter_operator:Wl,geometry_type:Hl,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:Jl,expression:Kl,light:Ql,sky:eu,terrain:tu,projection:nu,paint:ru,paint_fill:iu,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:su,paint_circle:ou,paint_heatmap:au,paint_symbol:lu,paint_raster:uu,paint_hillshade:cu,"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},paint_background:fu,transition:hu,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:pu,interpolation:du,interpolation_name:yu};function zi(n,...e){for(const t of e)for(const r in t)n[r]=t[r];return n}class fe extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class Xn{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[r,i]of t)this.bindings[r]=i}concat(e){return new Xn(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}}const Dt={kind:"null"},C={kind:"number"},A={kind:"string"},E={kind:"boolean"},he={kind:"color"},Nt={kind:"projectionDefinition"},Se={kind:"object"},L={kind:"value"},gu={kind:"error"},Bt={kind:"collator"},Rt={kind:"formatted"},qt={kind:"padding"},ot={kind:"colorArray"},Gt={kind:"numberArray"},at={kind:"resolvedImage"},Ut={kind:"variableAnchorOffsetCollection"};function ne(n,e){return{kind:"array",itemType:n,N:e}}function V(n){if(n.kind==="array"){const e=V(n.itemType);return typeof n.N=="number"?`array<${e}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${e}>`}else return n.kind}const xu=[Dt,C,A,E,he,Nt,Rt,Se,ne(L),qt,Gt,ot,at,Ut];function lt(n,e){if(e.kind==="error")return null;if(n.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!lt(n.itemType,e.itemType))&&(typeof n.N!="number"||n.N===e.N))return null}else{if(n.kind===e.kind)return null;if(n.kind==="value"){for(const t of xu)if(!lt(t,e))return null}}return`Expected ${V(n)} but found ${V(e)} instead.`}function Yn(n,e){return e.some(t=>t.kind===n.kind)}function Ee(n,e){return e.some(t=>t==="null"?n===null:t==="array"?Array.isArray(n):t==="object"?n&&!Array.isArray(n)&&typeof n=="object":t===typeof n)}function we(n,e){return n.kind==="array"&&e.kind==="array"?n.itemType.kind===e.itemType.kind&&typeof n.N=="number":n.kind===e.kind}const Fi=.96422,ki=1,Pi=.82521,Mi=4/29,Ge=6/29,Oi=3*Ge*Ge,vu=Ge*Ge*Ge,bu=Math.PI/180,wu=180/Math.PI;function Vi(n){return n=n%360,n<0&&(n+=360),n}function Di([n,e,t,r]){n=Wn(n),e=Wn(e),t=Wn(t);let i,s;const o=Hn((.2225045*n+.7168786*e+.0606169*t)/ki);n===e&&e===t?i=s=o:(i=Hn((.4360747*n+.3850649*e+.1430804*t)/Fi),s=Hn((.0139322*n+.0971045*e+.7141733*t)/Pi));const a=116*o-16;return[a<0?0:a,500*(i-o),200*(o-s),r]}function Wn(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Hn(n){return n>vu?Math.pow(n,1/3):n/Oi+Mi}function Ni([n,e,t,r]){let i=(n+16)/116,s=isNaN(e)?i:i+e/500,o=isNaN(t)?i:i-t/200;return i=ki*Kn(i),s=Fi*Kn(s),o=Pi*Kn(o),[Jn(3.1338561*s-1.6168667*i-.4906146*o),Jn(-.9787684*s+1.9161415*i+.033454*o),Jn(.0719453*s-.2289914*i+1.4052427*o),r]}function Jn(n){return n=n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055,n<0?0:n>1?1:n}function Kn(n){return n>Ge?n*n*n:Oi*(n-Mi)}function Cu(n){const[e,t,r,i]=Di(n),s=Math.sqrt(t*t+r*r);return[Math.round(s*1e4)?Vi(Math.atan2(r,t)*wu):NaN,s,e,i]}function Tu([n,e,t,r]){return n=isNaN(n)?0:n*bu,Ni([t,Math.cos(n)*e,Math.sin(n)*e,r])}function _u([n,e,t,r]){n=Vi(n),e/=100,t/=100;function i(s){const o=(s+n/30)%12,a=e*Math.min(t,1-t);return t-a*Math.max(-1,Math.min(o-3,9-o,1))}return[i(0),i(8),i(4),r]}const Iu=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Bi(n,e){return Iu(n,e)?n[e]:void 0}function Lu(n){if(n=n.toLowerCase().trim(),n==="transparent")return[0,0,0,0];const e=Bi(Su,n);if(e){const[i,s,o]=e;return[i/255,s/255,o/255,1]}if(n.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(n)){const s=n.length<6?1:2;let o=1;return[$t(n.slice(o,o+=s)),$t(n.slice(o,o+=s)),$t(n.slice(o,o+=s)),$t(n.slice(o,o+s)||"ff")]}if(n.startsWith("rgb")){const i=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,s=n.match(i);if(s){const[o,a,l,u,c,f,p,d,h,y,m,v]=s,w=[u||" ",p||" ",y].join("");if(w===" "||w===" /"||w===",,"||w===",,,"){const g=[l,f,h].join(""),x=g==="%%%"?100:g===""?255:0;if(x){const b=[Ue(+a/x,0,1),Ue(+c/x,0,1),Ue(+d/x,0,1),m?Ri(+m,v):1];if(qi(b))return b}}return}}const t=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,r=n.match(t);if(r){const[i,s,o,a,l,u,c,f,p]=r,d=[o||" ",l||" ",c].join("");if(d===" "||d===" /"||d===",,"||d===",,,"){const h=[+s,Ue(+a,0,100),Ue(+u,0,100),f?Ri(+f,p):1];if(qi(h))return _u(h)}}}function $t(n){return parseInt(n.padEnd(2,n),16)/255}function Ri(n,e){return Ue(e?n/100:n,0,1)}function Ue(n,e,t){return Math.min(Math.max(e,n),t)}function qi(n){return!n.some(Number.isNaN)}const Su={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Ce(n,e,t){return n+t*(e-n)}function $e(n,e,t){return n.map((r,i)=>Ce(r,e[i],t))}function Eu(n){return n==="rgb"||n==="hcl"||n==="lab"}class F{constructor(e,t,r,i=1,s=!0){this.r=e,this.g=t,this.b=r,this.a=i,s||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[e,t,r,i]))}static parse(e){if(e instanceof F)return e;if(typeof e!="string")return;const t=Lu(e);if(t)return new F(...t,!1)}get rgb(){const{r:e,g:t,b:r,a:i}=this,s=i||1/0;return this.overwriteGetter("rgb",[e/s,t/s,r/s,i])}get hcl(){return this.overwriteGetter("hcl",Cu(this.rgb))}get lab(){return this.overwriteGetter("lab",Di(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,r,i]=this.rgb;return`rgba(${[e,t,r].map(s=>Math.round(s*255)).join(",")},${i})`}static interpolate(e,t,r,i="rgb"){switch(i){case"rgb":{const[s,o,a,l]=$e(e.rgb,t.rgb,r);return new F(s,o,a,l,!1)}case"hcl":{const[s,o,a,l]=e.hcl,[u,c,f,p]=t.hcl;let d,h;if(!isNaN(s)&&!isNaN(u)){let g=u-s;u>s&&g>180?g-=360:u<s&&s-u>180&&(g+=360),d=s+r*g}else isNaN(s)?isNaN(u)?d=NaN:(d=u,(a===1||a===0)&&(h=c)):(d=s,(f===1||f===0)&&(h=o));const[y,m,v,w]=Tu([d,h??Ce(o,c,r),Ce(a,f,r),Ce(l,p,r)]);return new F(y,m,v,w,!1)}case"lab":{const[s,o,a,l]=Ni($e(e.lab,t.lab,r));return new F(s,o,a,l,!1)}}}}F.black=new F(0,0,0,1),F.white=new F(1,1,1,1),F.transparent=new F(0,0,0,0),F.red=new F(1,0,0,1);class Qn{constructor(e,t,r){e?this.sensitivity=t?"variant":"case":this.sensitivity=t?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Au=["bottom","center","top"];class er{constructor(e,t,r,i,s,o){this.text=e,this.image=t,this.scale=r,this.fontStack=i,this.textColor=s,this.verticalAlign=o}}class pe{constructor(e){this.sections=e}static fromString(e){return new pe([new er(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof pe?e:pe.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class H{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof H)return e;if(typeof e=="number")return new H([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const t of e)if(typeof t!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new H(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){return new H($e(e.values,t.values,r))}}class J{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof J)return e;if(typeof e=="number")return new J([e]);if(Array.isArray(e)){for(const t of e)if(typeof t!="number")return;return new J(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){return new J($e(e.values,t.values,r))}}class j{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof j)return e;if(typeof e=="string"){const r=F.parse(e);return r?new j([r]):void 0}if(!Array.isArray(e))return;const t=[];for(const r of e){if(typeof r!="string")return;const i=F.parse(r);if(!i)return;t.push(i)}return new j(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r,i="rgb"){const s=[];if(e.values.length!=t.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let o=0;o<e.values.length;o++)s.push(F.interpolate(e.values[o],t.values[o],r,i));return new j(s)}}class D extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const zu=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class re{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof re)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let t=0;t<e.length;t+=2){const r=e[t],i=e[t+1];if(typeof r!="string"||!zu.has(r)||!Array.isArray(i)||i.length!==2||typeof i[0]!="number"||typeof i[1]!="number")return}return new re(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,r){const i=e.values,s=t.values;if(i.length!==s.length)throw new D(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);const o=[];for(let a=0;a<i.length;a+=2){if(i[a]!==s[a])throw new D(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${i[a]}, to[${a}]: ${s[a]}`);o.push(i[a]);const[l,u]=i[a+1],[c,f]=s[a+1];o.push([Ce(l,c,r),Ce(u,f,r)])}return new re(o)}}class de{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new de({name:e,available:!1}):null}}class ie{constructor(e,t,r){this.from=e,this.to=t,this.transition=r}static interpolate(e,t,r){return new ie(e,t,r)}static parse(e){if(e instanceof ie)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number")return new ie(e[0],e[1],e[2]);if(typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number")return new ie(e.from,e.to,e.transition);if(typeof e=="string")return new ie(e,e,1)}}function Gi(n,e,t,r){return typeof n=="number"&&n>=0&&n<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255?typeof r>"u"||typeof r=="number"&&r>=0&&r<=1?null:`Invalid rgba value [${[n,e,t,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof r=="number"?[n,e,t,r]:[n,e,t]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ut(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof ie||n instanceof F||n instanceof Qn||n instanceof pe||n instanceof H||n instanceof J||n instanceof j||n instanceof re||n instanceof de)return!0;if(Array.isArray(n)){for(const e of n)if(!ut(e))return!1;return!0}else if(typeof n=="object"){for(const e in n)if(!ut(n[e]))return!1;return!0}else return!1}function q(n){if(n===null)return Dt;if(typeof n=="string")return A;if(typeof n=="boolean")return E;if(typeof n=="number")return C;if(n instanceof F)return he;if(n instanceof ie)return Nt;if(n instanceof Qn)return Bt;if(n instanceof pe)return Rt;if(n instanceof H)return qt;if(n instanceof J)return Gt;if(n instanceof j)return ot;if(n instanceof re)return Ut;if(n instanceof de)return at;if(Array.isArray(n)){const e=n.length;let t;for(const r of n){const i=q(r);if(!t)t=i;else{if(t===i)continue;t=L;break}}return ne(t||L,e)}else return Se}function ct(n){const e=typeof n;return n===null?"":e==="string"||e==="number"||e==="boolean"?String(n):n instanceof F||n instanceof ie||n instanceof pe||n instanceof H||n instanceof J||n instanceof j||n instanceof re||n instanceof de?n.toString():JSON.stringify(n)}class je{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ut(e[1]))return t.error("invalid value");const r=e[1];let i=q(r);const s=t.expectedType;return i.kind==="array"&&i.N===0&&s&&s.kind==="array"&&(typeof s.N!="number"||s.N===0)&&(i=s),new je(i,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const jt={string:A,number:C,boolean:E,object:Se};class ue{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let r=1,i;const s=e[0];if(s==="array"){let a;if(e.length>2){const u=e[1];if(typeof u!="string"||!(u in jt)||u==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);a=jt[u],r++}else a=L;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);l=e[2],r++}i=ne(a,l)}else{if(!jt[s])throw new Error(`Types doesn't contain name = ${s}`);i=jt[s]}const o=[];for(;r<e.length;r++){const a=t.parse(e[r],r,L);if(!a)return null;o.push(a)}return new ue(i,o)}evaluate(e){for(let t=0;t<this.args.length;t++){const r=this.args[t].evaluate(e);if(lt(this.type,q(r))){if(t===this.args.length-1)throw new D(`Expected value to be of type ${V(this.type)}, but found ${V(q(r))} instead.`)}else return r}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Ui={"to-boolean":E,"to-color":he,"to-number":C,"to-string":A};class Te{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const r=e[0];if(!Ui[r])throw new Error(`Can't parse ${r} as it is not part of the known types`);if((r==="to-boolean"||r==="to-string")&&e.length!==2)return t.error("Expected one argument.");const i=Ui[r],s=[];for(let o=1;o<e.length;o++){const a=t.parse(e[o],o,L);if(!a)return null;s.push(a)}return new Te(i,s)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,r;for(const i of this.args){if(t=i.evaluate(e),r=null,t instanceof F)return t;if(typeof t=="string"){const s=e.parseColor(t);if(s)return s}else if(Array.isArray(t)&&(t.length<3||t.length>4?r=`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:r=Gi(t[0],t[1],t[2],t[3]),!r))return new F(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new D(r||`Could not parse color from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const r of this.args){t=r.evaluate(e);const i=H.parse(t);if(i)return i}throw new D(`Could not parse padding from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const r of this.args){t=r.evaluate(e);const i=J.parse(t);if(i)return i}throw new D(`Could not parse numberArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const r of this.args){t=r.evaluate(e);const i=j.parse(t);if(i)return i}throw new D(`Could not parse colorArray from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const r of this.args){t=r.evaluate(e);const i=re.parse(t);if(i)return i}throw new D(`Could not parse variableAnchorOffsetCollection from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const r of this.args){if(t=r.evaluate(e),t===null)return 0;const i=Number(t);if(!isNaN(i))return i}throw new D(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return pe.fromString(ct(this.args[0].evaluate(e)));case"resolvedImage":return de.fromString(ct(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return ct(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Fu=["Unknown","Point","LineString","Polygon"];class $i{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Fu[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache.get(e);return t||(t=F.parse(e),this._parseColorCache.set(e,t)),t}}class Zt{constructor(e,t,r=[],i,s=new Xn,o=[]){this.registry=e,this.path=r,this.key=r.map(a=>`[${a}]`).join(""),this.scope=s,this.errors=o,this.expectedType=i,this._isConstant=t}parse(e,t,r,i,s={}){return t?this.concat(t,r,i)._parse(e,s):this._parse(e,s)}_parse(e,t){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function r(i,s,o){return o==="assert"?new ue(s,[i]):o==="coerce"?new Te(s,[i]):i}if(Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const i=e[0];if(typeof i!="string")return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const s=this.registry[i];if(s){let o=s.parse(e,this);if(!o)return null;if(this.expectedType){const a=this.expectedType,l=o.type;if((a.kind==="string"||a.kind==="number"||a.kind==="boolean"||a.kind==="object"||a.kind==="array")&&l.kind==="value")o=r(o,a,t.typeAnnotation||"assert");else if(a.kind==="projectionDefinition"&&["string","array"].includes(l.kind)||["color","formatted","resolvedImage"].includes(a.kind)&&["value","string"].includes(l.kind)||["padding","numberArray"].includes(a.kind)&&["value","number","array"].includes(l.kind)||a.kind==="colorArray"&&["value","string","array"].includes(l.kind)||a.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(l.kind))o=r(o,a,t.typeAnnotation||"coerce");else if(this.checkSubtype(a,l))return null}if(!(o instanceof je)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){const a=new $i;try{o=new je(o.type,o.evaluate(a))}catch(l){return this.error(l.message),null}}return o}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):typeof e=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,t,r){const i=typeof e=="number"?this.path.concat(e):this.path,s=r?this.scope.concat(r):this.scope;return new Zt(this.registry,this._isConstant,i,t||null,s,this.errors)}error(e,...t){const r=`${this.key}${t.map(i=>`[${i}]`).join("")}`;this.errors.push(new fe(r,e))}checkSubtype(e,t){const r=lt(e,t);return r&&this.error(r),r}}class Xt{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const r=[];for(let s=1;s<e.length-1;s+=2){const o=e[s];if(typeof o!="string")return t.error(`Expected string, but found ${typeof o} instead.`,s);if(/[^a-zA-Z0-9_]/.test(o))return t.error("Variable names must contain only alphanumeric characters or '_'.",s);const a=t.parse(e[s+1],s+1);if(!a)return null;r.push([o,a])}const i=t.parse(e[e.length-1],e.length-1,t.expectedType,r);return i?new Xt(r,i):null}outputDefined(){return this.result.outputDefined()}}class Yt{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");const r=e[1];return t.scope.has(r)?new Yt(r,t.scope.get(r)):t.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class tr{constructor(e,t,r){this.type=e,this.index=t,this.input=r}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,C),i=t.parse(e[2],2,ne(t.expectedType||L));if(!r||!i)return null;const s=i.type;return new tr(s.itemType,r,i)}evaluate(e){const t=this.index.evaluate(e),r=this.input.evaluate(e);if(t<0)throw new D(`Array index out of bounds: ${t} < 0.`);if(t>=r.length)throw new D(`Array index out of bounds: ${t} > ${r.length-1}.`);if(t!==Math.floor(t))throw new D(`Array index must be an integer, but found ${t} instead.`);return r[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class nr{constructor(e,t){this.type=E,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,L),i=t.parse(e[2],2,L);return!r||!i?null:Yn(r.type,[E,A,C,Dt,L])?new nr(r,i):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${V(r.type)} instead`)}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!r)return!1;if(!Ee(t,["boolean","string","number","null"]))throw new D(`Expected first argument to be of type boolean, string, number or null, but found ${V(q(t))} instead.`);if(!Ee(r,["string","array"]))throw new D(`Expected second argument to be of type array or string, but found ${V(q(r))} instead.`);return r.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Wt{constructor(e,t,r){this.type=C,this.needle=e,this.haystack=t,this.fromIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,L),i=t.parse(e[2],2,L);if(!r||!i)return null;if(!Yn(r.type,[E,A,C,Dt,L]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${V(r.type)} instead`);if(e.length===4){const s=t.parse(e[3],3,C);return s?new Wt(r,i,s):null}else return new Wt(r,i)}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!Ee(t,["boolean","string","number","null"]))throw new D(`Expected first argument to be of type boolean, string, number or null, but found ${V(q(t))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),Ee(r,["string"])){const s=r.indexOf(t,i);return s===-1?-1:[...r.slice(0,s)].length}else{if(Ee(r,["array"]))return r.indexOf(t,i);throw new D(`Expected second argument to be of type array or string, but found ${V(q(r))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class rr{constructor(e,t,r,i,s,o){this.inputType=e,this.type=t,this.input=r,this.cases=i,this.outputs=s,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return t.error("Expected an even number of arguments.");let r,i;t.expectedType&&t.expectedType.kind!=="value"&&(i=t.expectedType);const s={},o=[];for(let u=2;u<e.length-1;u+=2){let c=e[u];const f=e[u+1];Array.isArray(c)||(c=[c]);const p=t.concat(u);if(c.length===0)return p.error("Expected at least one branch label.");for(const h of c){if(typeof h!="number"&&typeof h!="string")return p.error("Branch labels must be numbers or strings.");if(typeof h=="number"&&Math.abs(h)>Number.MAX_SAFE_INTEGER)return p.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof h=="number"&&Math.floor(h)!==h)return p.error("Numeric branch labels must be integer values.");if(!r)r=q(h);else if(p.checkSubtype(r,q(h)))return null;if(typeof s[String(h)]<"u")return p.error("Branch labels must be unique.");s[String(h)]=o.length}const d=t.parse(f,u,i);if(!d)return null;i=i||d.type,o.push(d)}const a=t.parse(e[1],1,L);if(!a)return null;const l=t.parse(e[e.length-1],e.length-1,i);return!l||a.type.kind!=="value"&&t.concat(1).checkSubtype(r,a.type)?null:new rr(r,i,a,s,o,l)}evaluate(e){const t=this.input.evaluate(e);return(q(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class ir{constructor(e,t,r){this.type=e,this.branches=t,this.otherwise=r}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return t.error("Expected an odd number of arguments.");let r;t.expectedType&&t.expectedType.kind!=="value"&&(r=t.expectedType);const i=[];for(let o=1;o<e.length-1;o+=2){const a=t.parse(e[o],o,E);if(!a)return null;const l=t.parse(e[o+1],o+1,r);if(!l)return null;i.push([a,l]),r=r||l.type}const s=t.parse(e[e.length-1],e.length-1,r);if(!s)return null;if(!r)throw new Error("Can't infer output type");return new ir(r,i,s)}evaluate(e){for(const[t,r]of this.branches)if(t.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,r]of this.branches)e(t),e(r);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}}class Ht{constructor(e,t,r,i){this.type=e,this.input=t,this.beginIndex=r,this.endIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,L),i=t.parse(e[2],2,C);if(!r||!i)return null;if(!Yn(r.type,[ne(L),A,L]))return t.error(`Expected first argument to be of type array or string, but found ${V(r.type)} instead`);if(e.length===4){const s=t.parse(e[3],3,C);return s?new Ht(r.type,r,i,s):null}else return new Ht(r.type,r,i)}evaluate(e){const t=this.input.evaluate(e),r=this.beginIndex.evaluate(e);let i;if(this.endIndex&&(i=this.endIndex.evaluate(e)),Ee(t,["string"]))return[...t].slice(r,i).join("");if(Ee(t,["array"]))return t.slice(r,i);throw new D(`Expected first argument to be of type array or string, but found ${V(q(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Jt(n,e){const t=n.length-1;let r=0,i=t,s=0,o,a;for(;r<=i;)if(s=Math.floor((r+i)/2),o=n[s],a=n[s+1],o<=e){if(s===t||e<a)return s;r=s+1}else if(o>e)i=s-1;else throw new D("Input is not a number.");return 0}class Kt{constructor(e,t,r){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[i,s]of r)this.labels.push(i),this.outputs.push(s)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");const r=t.parse(e[1],1,C);if(!r)return null;const i=[];let s=null;t.expectedType&&t.expectedType.kind!=="value"&&(s=t.expectedType);for(let o=1;o<e.length;o+=2){const a=o===1?-1/0:e[o],l=e[o+1],u=o,c=o+1;if(typeof a!="number")return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(i.length&&i[i.length-1][0]>=a)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);const f=t.parse(l,c,s);if(!f)return null;s=s||f.type,i.push([a,f])}return new Kt(s,r,i)}evaluate(e){const t=this.labels,r=this.outputs;if(t.length===1)return r[0].evaluate(e);const i=this.input.evaluate(e);if(i<=t[0])return r[0].evaluate(e);const s=t.length;if(i>=t[s-1])return r[s-1].evaluate(e);const o=Jt(t,i);return r[o].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function ku(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var sr,ji;function Pu(){if(ji)return sr;ji=1,sr=n;function n(e,t,r,i){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(i-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=i}return n.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,i=0;i<8;i++){var s=this.sampleCurveX(r)-e;if(Math.abs(s)<t)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r=r-s/o}var a=0,l=1;for(r=e,i=0;i<20&&(s=this.sampleCurveX(r),!(Math.abs(s-e)<t));i++)e>s?a=r:l=r,r=(l-a)*.5+a;return r},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},sr}var Mu=Pu(),Ou=ku(Mu);class se{constructor(e,t,r,i,s){this.type=e,this.operator=t,this.interpolation=r,this.input=i,this.labels=[],this.outputs=[];for(const[o,a]of s)this.labels.push(o),this.outputs.push(a)}static interpolationFactor(e,t,r,i){let s=0;if(e.name==="exponential")s=or(t,e.base,r,i);else if(e.name==="linear")s=or(t,1,r,i);else if(e.name==="cubic-bezier"){const o=e.controlPoints;s=new Ou(o[0],o[1],o[2],o[3]).solve(or(t,1,r,i))}return s}static parse(e,t){let[r,i,s,...o]=e;if(!Array.isArray(i)||i.length===0)return t.error("Expected an interpolation type expression.",1);if(i[0]==="linear")i={name:"linear"};else if(i[0]==="exponential"){const u=i[1];if(typeof u!="number")return t.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:u}}else if(i[0]==="cubic-bezier"){const u=i.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:u}}else return t.error(`Unknown interpolation type ${String(i[0])}`,1,0);if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");if(s=t.parse(s,2,C),!s)return null;const a=[];let l=null;(r==="interpolate-hcl"||r==="interpolate-lab")&&t.expectedType!=ot?l=he:t.expectedType&&t.expectedType.kind!=="value"&&(l=t.expectedType);for(let u=0;u<o.length;u+=2){const c=o[u],f=o[u+1],p=u+3,d=u+4;if(typeof c!="number")return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',p);if(a.length&&a[a.length-1][0]>=c)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',p);const h=t.parse(f,d,l);if(!h)return null;l=l||h.type,a.push([c,h])}return!we(l,C)&&!we(l,Nt)&&!we(l,he)&&!we(l,qt)&&!we(l,Gt)&&!we(l,ot)&&!we(l,Ut)&&!we(l,ne(C))?t.error(`Type ${V(l)} is not interpolatable.`):new se(l,r,i,s,a)}evaluate(e){const t=this.labels,r=this.outputs;if(t.length===1)return r[0].evaluate(e);const i=this.input.evaluate(e);if(i<=t[0])return r[0].evaluate(e);const s=t.length;if(i>=t[s-1])return r[s-1].evaluate(e);const o=Jt(t,i),a=t[o],l=t[o+1],u=se.interpolationFactor(this.interpolation,i,a,l),c=r[o].evaluate(e),f=r[o+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Ce(c,f,u);case"color":return F.interpolate(c,f,u);case"padding":return H.interpolate(c,f,u);case"colorArray":return j.interpolate(c,f,u);case"numberArray":return J.interpolate(c,f,u);case"variableAnchorOffsetCollection":return re.interpolate(c,f,u);case"array":return $e(c,f,u);case"projectionDefinition":return ie.interpolate(c,f,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return F.interpolate(c,f,u,"hcl");case"colorArray":return j.interpolate(c,f,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return F.interpolate(c,f,u,"lab");case"colorArray":return j.interpolate(c,f,u,"lab")}}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function or(n,e,t,r){const i=r-t,s=n-t;return i===0?0:e===1?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}const Vu={color:F.interpolate,number:Ce,padding:H.interpolate,numberArray:J.interpolate,colorArray:j.interpolate,variableAnchorOffsetCollection:re.interpolate,array:$e};class ft{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let r=null;const i=t.expectedType;i&&i.kind!=="value"&&(r=i);const s=[];for(const a of e.slice(1)){const l=t.parse(a,1+s.length,r,void 0,{typeAnnotation:"omit"});if(!l)return null;r=r||l.type,s.push(l)}if(!r)throw new Error("No output type");return i&&s.some(a=>lt(i,a.type))?new ft(L,s):new ft(r,s)}evaluate(e){let t=null,r=0,i;for(const s of this.args)if(r++,t=s.evaluate(e),t&&t instanceof de&&!t.available&&(i||(i=t.name),t=null,r===this.args.length&&(t=i)),t!==null)break;return t}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}function Zi(n,e){return n==="=="||n==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Du(n,e,t){return e===t}function Nu(n,e,t){return e!==t}function Bu(n,e,t){return e<t}function Ru(n,e,t){return e>t}function qu(n,e,t){return e<=t}function Gu(n,e,t){return e>=t}function Xi(n,e,t,r){return r.compare(e,t)===0}function Uu(n,e,t,r){return!Xi(n,e,t,r)}function $u(n,e,t,r){return r.compare(e,t)<0}function ju(n,e,t,r){return r.compare(e,t)>0}function Zu(n,e,t,r){return r.compare(e,t)<=0}function Xu(n,e,t,r){return r.compare(e,t)>=0}function Ze(n,e,t){const r=n!=="=="&&n!=="!=";return class Zs{constructor(s,o,a){this.type=E,this.lhs=s,this.rhs=o,this.collator=a,this.hasUntypedArgument=s.type.kind==="value"||o.type.kind==="value"}static parse(s,o){if(s.length!==3&&s.length!==4)return o.error("Expected two or three arguments.");const a=s[0];let l=o.parse(s[1],1,L);if(!l)return null;if(!Zi(a,l.type))return o.concat(1).error(`"${a}" comparisons are not supported for type '${V(l.type)}'.`);let u=o.parse(s[2],2,L);if(!u)return null;if(!Zi(a,u.type))return o.concat(2).error(`"${a}" comparisons are not supported for type '${V(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error(`Cannot compare types '${V(l.type)}' and '${V(u.type)}'.`);r&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new ue(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new ue(l.type,[u])));let c=null;if(s.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error("Cannot use collator to compare non-string types.");if(c=o.parse(s[3],3,Bt),!c)return null}return new Zs(l,u,c)}evaluate(s){const o=this.lhs.evaluate(s),a=this.rhs.evaluate(s);if(r&&this.hasUntypedArgument){const l=q(o),u=q(a);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new D(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const l=q(o),u=q(a);if(l.kind!=="string"||u.kind!=="string")return e(s,o,a)}return this.collator?t(s,o,a,this.collator.evaluate(s)):e(s,o,a)}eachChild(s){s(this.lhs),s(this.rhs),this.collator&&s(this.collator)}outputDefined(){return!0}}}const Yu=Ze("==",Du,Xi),Wu=Ze("!=",Nu,Uu),Hu=Ze("<",Bu,$u),Ju=Ze(">",Ru,ju),Ku=Ze("<=",qu,Zu),Qu=Ze(">=",Gu,Xu);class Qt{constructor(e,t,r){this.type=Bt,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument.");const r=e[1];if(typeof r!="object"||Array.isArray(r))return t.error("Collator options argument must be an object.");const i=t.parse(r["case-sensitive"]===void 0?!1:r["case-sensitive"],1,E);if(!i)return null;const s=t.parse(r["diacritic-sensitive"]===void 0?!1:r["diacritic-sensitive"],1,E);if(!s)return null;let o=null;return r.locale&&(o=t.parse(r.locale,1,A),!o)?null:new Qt(i,s,o)}evaluate(e){return new Qn(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class ar{constructor(e,t,r,i,s){this.type=A,this.number=e,this.locale=t,this.currency=r,this.minFractionDigits=i,this.maxFractionDigits=s}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");const r=t.parse(e[1],1,C);if(!r)return null;const i=e[2];if(typeof i!="object"||Array.isArray(i))return t.error("NumberFormat options argument must be an object.");let s=null;if(i.locale&&(s=t.parse(i.locale,1,A),!s))return null;let o=null;if(i.currency&&(o=t.parse(i.currency,1,A),!o))return null;let a=null;if(i["min-fraction-digits"]&&(a=t.parse(i["min-fraction-digits"],1,C),!a))return null;let l=null;return i["max-fraction-digits"]&&(l=t.parse(i["max-fraction-digits"],1,C),!l)?null:new ar(r,s,o,a,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class lr{constructor(e){this.type=Rt,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const r=e[1];if(!Array.isArray(r)&&typeof r=="object")return t.error("First argument must be an image or text section.");const i=[];let s=!1;for(let o=1;o<=e.length-1;++o){const a=e[o];if(s&&typeof a=="object"&&!Array.isArray(a)){s=!1;let l=null;if(a["font-scale"]&&(l=t.parse(a["font-scale"],1,C),!l))return null;let u=null;if(a["text-font"]&&(u=t.parse(a["text-font"],1,ne(A)),!u))return null;let c=null;if(a["text-color"]&&(c=t.parse(a["text-color"],1,he),!c))return null;let f=null;if(a["vertical-align"]){if(typeof a["vertical-align"]=="string"&&!Au.includes(a["vertical-align"]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${a["vertical-align"]}' instead.`);if(f=t.parse(a["vertical-align"],1,A),!f)return null}const p=i[i.length-1];p.scale=l,p.font=u,p.textColor=c,p.verticalAlign=f}else{const l=t.parse(e[o],1,L);if(!l)return null;const u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");s=!0,i.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new lr(i)}evaluate(e){const t=r=>{const i=r.content.evaluate(e);return q(i)===at?new er("",i,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(e):null):new er(ct(i),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null,r.verticalAlign?r.verticalAlign.evaluate(e):null)};return new pe(this.sections.map(t))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class ur{constructor(e){this.type=at,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected two arguments.");const r=t.parse(e[1],1,A);return r?new ur(r):t.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),r=de.fromString(t);return r&&e.availableImages&&(r.available=e.availableImages.indexOf(t)>-1),r}eachChild(e){e(this.input)}outputDefined(){return!1}}class cr{constructor(e){this.type=C,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const r=t.parse(e[1],1);return r?r.type.kind!=="array"&&r.type.kind!=="string"&&r.type.kind!=="value"?t.error(`Expected argument of type string or array, but found ${V(r.type)} instead.`):new cr(r):null}evaluate(e){const t=this.input.evaluate(e);if(typeof t=="string")return[...t].length;if(Array.isArray(t))return t.length;throw new D(`Expected value to be of type string or array, but found ${V(q(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const ye=8192;function ec(n,e){const t=tc(n[0]),r=rc(n[1]),i=Math.pow(2,e.z);return[Math.round(t*i*ye),Math.round(r*i*ye)]}function fr(n,e){const t=Math.pow(2,e.z),r=(n[0]/ye+e.x)/t,i=(n[1]/ye+e.y)/t;return[nc(r),ic(i)]}function tc(n){return(180+n)/360}function nc(n){return n*360-180}function rc(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function ic(n){return 360/Math.PI*Math.atan(Math.exp((180-n*360)*Math.PI/180))-90}function ht(n,e){n[0]=Math.min(n[0],e[0]),n[1]=Math.min(n[1],e[1]),n[2]=Math.max(n[2],e[0]),n[3]=Math.max(n[3],e[1])}function pt(n,e){return!(n[0]<=e[0]||n[2]>=e[2]||n[1]<=e[1]||n[3]>=e[3])}function sc(n,e,t){return e[1]>n[1]!=t[1]>n[1]&&n[0]<(t[0]-e[0])*(n[1]-e[1])/(t[1]-e[1])+e[0]}function oc(n,e,t){const r=n[0]-e[0],i=n[1]-e[1],s=n[0]-t[0],o=n[1]-t[1];return r*o-s*i===0&&r*s<=0&&i*o<=0}function en(n,e,t,r){const i=[e[0]-n[0],e[1]-n[1]],s=[r[0]-t[0],r[1]-t[1]];return cc(s,i)===0?!1:!!(Wi(n,e,t,r)&&Wi(t,r,n,e))}function ac(n,e,t){for(const r of t)for(let i=0;i<r.length-1;++i)if(en(n,e,r[i],r[i+1]))return!0;return!1}function Xe(n,e,t=!1){let r=!1;for(const i of e)for(let s=0;s<i.length-1;s++){if(oc(n,i[s],i[s+1]))return t;sc(n,i[s],i[s+1])&&(r=!r)}return r}function lc(n,e){for(const t of e)if(Xe(n,t))return!0;return!1}function Yi(n,e){for(const t of n)if(!Xe(t,e))return!1;for(let t=0;t<n.length-1;++t)if(ac(n[t],n[t+1],e))return!1;return!0}function uc(n,e){for(const t of e)if(Yi(n,t))return!0;return!1}function cc(n,e){return n[0]*e[1]-n[1]*e[0]}function Wi(n,e,t,r){const i=n[0]-t[0],s=n[1]-t[1],o=e[0]-t[0],a=e[1]-t[1],l=r[0]-t[0],u=r[1]-t[1],c=i*u-l*s,f=o*u-l*a;return c>0&&f<0||c<0&&f>0}function hr(n,e,t){const r=[];for(let i=0;i<n.length;i++){const s=[];for(let o=0;o<n[i].length;o++){const a=ec(n[i][o],t);ht(e,a),s.push(a)}r.push(s)}return r}function Hi(n,e,t){const r=[];for(let i=0;i<n.length;i++){const s=hr(n[i],e,t);r.push(s)}return r}function Ji(n,e,t,r){if(n[0]<t[0]||n[0]>t[2]){const i=r*.5;let s=n[0]-t[0]>i?-r:t[0]-n[0]>i?r:0;s===0&&(s=n[0]-t[2]>i?-r:t[2]-n[0]>i?r:0),n[0]+=s}ht(e,n)}function fc(n){n[0]=n[1]=1/0,n[2]=n[3]=-1/0}function Ki(n,e,t,r){const i=Math.pow(2,r.z)*ye,s=[r.x*ye,r.y*ye],o=[];for(const a of n)for(const l of a){const u=[l.x+s[0],l.y+s[1]];Ji(u,e,t,i),o.push(u)}return o}function Qi(n,e,t,r){const i=Math.pow(2,r.z)*ye,s=[r.x*ye,r.y*ye],o=[];for(const a of n){const l=[];for(const u of a){const c=[u.x+s[0],u.y+s[1]];ht(e,c),l.push(c)}o.push(l)}if(e[2]-e[0]<=i/2){fc(e);for(const a of o)for(const l of a)Ji(l,e,t,i)}return o}function hc(n,e){const t=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=n.canonicalID();if(e.type==="Polygon"){const s=hr(e.coordinates,r,i),o=Ki(n.geometry(),t,r,i);if(!pt(t,r))return!1;for(const a of o)if(!Xe(a,s))return!1}if(e.type==="MultiPolygon"){const s=Hi(e.coordinates,r,i),o=Ki(n.geometry(),t,r,i);if(!pt(t,r))return!1;for(const a of o)if(!lc(a,s))return!1}return!0}function pc(n,e){const t=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=n.canonicalID();if(e.type==="Polygon"){const s=hr(e.coordinates,r,i),o=Qi(n.geometry(),t,r,i);if(!pt(t,r))return!1;for(const a of o)if(!Yi(a,s))return!1}if(e.type==="MultiPolygon"){const s=Hi(e.coordinates,r,i),o=Qi(n.geometry(),t,r,i);if(!pt(t,r))return!1;for(const a of o)if(!uc(a,s))return!1}return!0}class Ae{constructor(e,t){this.type=E,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ut(e[1])){const r=e[1];if(r.type==="FeatureCollection"){const i=[];for(const s of r.features){const{type:o,coordinates:a}=s.geometry;o==="Polygon"&&i.push(a),o==="MultiPolygon"&&i.push(...a)}if(i.length){const s={type:"MultiPolygon",coordinates:i};return new Ae(r,s)}}else if(r.type==="Feature"){const i=r.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new Ae(r,r.geometry)}else if(r.type==="Polygon"||r.type==="MultiPolygon")return new Ae(r,r)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return hc(e,this.geometries);if(e.geometryType()==="LineString")return pc(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class es{constructor(e=[],t=(r,i)=>r<i?-1:r>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:r}=this,i=t[e];for(;e>0;){const s=e-1>>1,o=t[s];if(r(i,o)>=0)break;t[e]=o,e=s}t[e]=i}_down(e){const{data:t,compare:r}=this,i=this.length>>1,s=t[e];for(;e<i;){let o=(e<<1)+1;const a=o+1;if(a<this.length&&r(t[a],t[o])<0&&(o=a),r(t[o],s)>=0)break;t[e]=t[o],e=o}t[e]=s}}function dc(n,e){if(n.length<=1)return[n];const r=[];let i,s;for(const o of n){const a=yc(o);a!==0&&(o.area=Math.abs(a),s===void 0&&(s=a<0),s===a<0?(i&&r.push(i),i=[o]):i.push(o))}return i&&r.push(i),r}function yc(n){let e=0;for(let t=0,r=n.length,i=r-1,s,o;t<r;i=t++)s=n[t],o=n[i],e+=(o.x-s.x)*(s.y+o.y);return e}const mc=6378.137,ts=1/298.257223563,ns=ts*(2-ts),rs=Math.PI/180;class pr{constructor(e){const t=rs*mc*1e3,r=Math.cos(e*rs),i=1/(1-ns*(1-r*r)),s=Math.sqrt(i);this.kx=t*s*r,this.ky=t*s*i*(1-ns)}distance(e,t){const r=this.wrap(e[0]-t[0])*this.kx,i=(e[1]-t[1])*this.ky;return Math.sqrt(r*r+i*i)}pointOnLine(e,t){let r=1/0,i,s,o,a;for(let l=0;l<e.length-1;l++){let u=e[l][0],c=e[l][1],f=this.wrap(e[l+1][0]-u)*this.kx,p=(e[l+1][1]-c)*this.ky,d=0;(f!==0||p!==0)&&(d=(this.wrap(t[0]-u)*this.kx*f+(t[1]-c)*this.ky*p)/(f*f+p*p),d>1?(u=e[l+1][0],c=e[l+1][1]):d>0&&(u+=f/this.kx*d,c+=p/this.ky*d)),f=this.wrap(t[0]-u)*this.kx,p=(t[1]-c)*this.ky;const h=f*f+p*p;h<r&&(r=h,i=u,s=c,o=l,a=d)}return{point:[i,s],index:o,t:Math.max(0,Math.min(1,a))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}const dr=100,yr=50;function is(n,e){return e[0]-n[0]}function tn(n){return n[1]-n[0]+1}function xe(n,e){return n[1]>=n[0]&&n[1]<e}function mr(n,e){if(n[0]>n[1])return[null,null];const t=tn(n);if(e){if(t===2)return[n,null];const i=Math.floor(t/2);return[[n[0],n[0]+i],[n[0]+i,n[1]]]}if(t===1)return[n,null];const r=Math.floor(t/2)-1;return[[n[0],n[0]+r],[n[0]+r+1,n[1]]]}function gr(n,e){if(!xe(e,n.length))return[1/0,1/0,-1/0,-1/0];const t=[1/0,1/0,-1/0,-1/0];for(let r=e[0];r<=e[1];++r)ht(t,n[r]);return t}function xr(n){const e=[1/0,1/0,-1/0,-1/0];for(const t of n)for(const r of t)ht(e,r);return e}function ss(n){return n[0]!==-1/0&&n[1]!==-1/0&&n[2]!==1/0&&n[3]!==1/0}function vr(n,e,t){if(!ss(n)||!ss(e))return NaN;let r=0,i=0;return n[2]<e[0]&&(r=e[0]-n[2]),n[0]>e[2]&&(r=n[0]-e[2]),n[1]>e[3]&&(i=n[1]-e[3]),n[3]<e[1]&&(i=e[1]-n[3]),t.distance([0,0],[r,i])}function ze(n,e,t){const r=t.pointOnLine(e,n);return t.distance(n,r.point)}function br(n,e,t,r,i){const s=Math.min(ze(n,[t,r],i),ze(e,[t,r],i)),o=Math.min(ze(t,[n,e],i),ze(r,[n,e],i));return Math.min(s,o)}function gc(n,e,t,r,i){if(!(xe(e,n.length)&&xe(r,t.length)))return 1/0;let o=1/0;for(let a=e[0];a<e[1];++a){const l=n[a],u=n[a+1];for(let c=r[0];c<r[1];++c){const f=t[c],p=t[c+1];if(en(l,u,f,p))return 0;o=Math.min(o,br(l,u,f,p,i))}}return o}function xc(n,e,t,r,i){if(!(xe(e,n.length)&&xe(r,t.length)))return NaN;let o=1/0;for(let a=e[0];a<=e[1];++a)for(let l=r[0];l<=r[1];++l)if(o=Math.min(o,i.distance(n[a],t[l])),o===0)return o;return o}function vc(n,e,t){if(Xe(n,e,!0))return 0;let r=1/0;for(const i of e){const s=i[0],o=i[i.length-1];if(s!==o&&(r=Math.min(r,ze(n,[o,s],t)),r===0))return r;const a=t.pointOnLine(i,n);if(r=Math.min(r,t.distance(n,a.point)),r===0)return r}return r}function bc(n,e,t,r){if(!xe(e,n.length))return NaN;for(let s=e[0];s<=e[1];++s)if(Xe(n[s],t,!0))return 0;let i=1/0;for(let s=e[0];s<e[1];++s){const o=n[s],a=n[s+1];for(const l of t)for(let u=0,c=l.length,f=c-1;u<c;f=u++){const p=l[f],d=l[u];if(en(o,a,p,d))return 0;i=Math.min(i,br(o,a,p,d,r))}}return i}function os(n,e){for(const t of n)for(const r of t)if(Xe(r,e,!0))return!0;return!1}function wc(n,e,t,r=1/0){const i=xr(n),s=xr(e);if(r!==1/0&&vr(i,s,t)>=r)return r;if(pt(i,s)){if(os(n,e))return 0}else if(os(e,n))return 0;let o=1/0;for(const a of n)for(let l=0,u=a.length,c=u-1;l<u;c=l++){const f=a[c],p=a[l];for(const d of e)for(let h=0,y=d.length,m=y-1;h<y;m=h++){const v=d[m],w=d[h];if(en(f,p,v,w))return 0;o=Math.min(o,br(f,p,v,w,t))}}return o}function as(n,e,t,r,i,s){if(!s)return;const o=vr(gr(r,s),i,t);o<e&&n.push([o,s,[0,0]])}function nn(n,e,t,r,i,s,o){if(!s||!o)return;const a=vr(gr(r,s),gr(i,o),t);a<e&&n.push([a,s,o])}function rn(n,e,t,r,i=1/0){let s=Math.min(r.distance(n[0],t[0][0]),i);if(s===0)return s;const o=new es([[0,[0,n.length-1],[0,0]]],is),a=xr(t);for(;o.length>0;){const l=o.pop();if(l[0]>=s)continue;const u=l[1],c=e?yr:dr;if(tn(u)<=c){if(!xe(u,n.length))return NaN;if(e){const f=bc(n,u,t,r);if(isNaN(f)||f===0)return f;s=Math.min(s,f)}else for(let f=u[0];f<=u[1];++f){const p=vc(n[f],t,r);if(s=Math.min(s,p),s===0)return 0}}else{const f=mr(u,e);as(o,s,r,n,a,f[0]),as(o,s,r,n,a,f[1])}}return s}function sn(n,e,t,r,i,s=1/0){let o=Math.min(s,i.distance(n[0],t[0]));if(o===0)return o;const a=new es([[0,[0,n.length-1],[0,t.length-1]]],is);for(;a.length>0;){const l=a.pop();if(l[0]>=o)continue;const u=l[1],c=l[2],f=e?yr:dr,p=r?yr:dr;if(tn(u)<=f&&tn(c)<=p){if(!xe(u,n.length)&&xe(c,t.length))return NaN;let d;if(e&&r)d=gc(n,u,t,c,i),o=Math.min(o,d);else if(e&&!r){const h=n.slice(u[0],u[1]+1);for(let y=c[0];y<=c[1];++y)if(d=ze(t[y],h,i),o=Math.min(o,d),o===0)return o}else if(!e&&r){const h=t.slice(c[0],c[1]+1);for(let y=u[0];y<=u[1];++y)if(d=ze(n[y],h,i),o=Math.min(o,d),o===0)return o}else d=xc(n,u,t,c,i),o=Math.min(o,d)}else{const d=mr(u,e),h=mr(c,r);nn(a,o,i,n,t,d[0],h[0]),nn(a,o,i,n,t,d[0],h[1]),nn(a,o,i,n,t,d[1],h[0]),nn(a,o,i,n,t,d[1],h[1])}}return o}function Cc(n,e){const t=n.geometry(),r=t.flat().map(o=>fr([o.x,o.y],n.canonical));if(t.length===0)return NaN;const i=new pr(r[0][1]);let s=1/0;for(const o of e){switch(o.type){case"Point":s=Math.min(s,sn(r,!1,[o.coordinates],!1,i,s));break;case"LineString":s=Math.min(s,sn(r,!1,o.coordinates,!0,i,s));break;case"Polygon":s=Math.min(s,rn(r,!1,o.coordinates,i,s));break}if(s===0)return s}return s}function Tc(n,e){const t=n.geometry(),r=t.flat().map(o=>fr([o.x,o.y],n.canonical));if(t.length===0)return NaN;const i=new pr(r[0][1]);let s=1/0;for(const o of e){switch(o.type){case"Point":s=Math.min(s,sn(r,!0,[o.coordinates],!1,i,s));break;case"LineString":s=Math.min(s,sn(r,!0,o.coordinates,!0,i,s));break;case"Polygon":s=Math.min(s,rn(r,!0,o.coordinates,i,s));break}if(s===0)return s}return s}function _c(n,e){const t=n.geometry();if(t.length===0||t[0].length===0)return NaN;const r=dc(t).map(o=>o.map(a=>a.map(l=>fr([l.x,l.y],n.canonical)))),i=new pr(r[0][0][0][1]);let s=1/0;for(const o of e)for(const a of r){switch(o.type){case"Point":s=Math.min(s,rn([o.coordinates],!1,a,i,s));break;case"LineString":s=Math.min(s,rn(o.coordinates,!0,a,i,s));break;case"Polygon":s=Math.min(s,wc(a,o.coordinates,i,s));break}if(s===0)return s}return s}function wr(n){return n.type==="MultiPolygon"?n.coordinates.map(e=>({type:"Polygon",coordinates:e})):n.type==="MultiLineString"?n.coordinates.map(e=>({type:"LineString",coordinates:e})):n.type==="MultiPoint"?n.coordinates.map(e=>({type:"Point",coordinates:e})):[n]}class Fe{constructor(e,t){this.type=C,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ut(e[1])){const r=e[1];if(r.type==="FeatureCollection")return new Fe(r,r.features.map(i=>wr(i.geometry)).flat());if(r.type==="Feature")return new Fe(r,wr(r.geometry));if("type"in r&&"coordinates"in r)return new Fe(r,wr(r))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return Cc(e,this.geometries);if(e.geometryType()==="LineString")return Tc(e,this.geometries);if(e.geometryType()==="Polygon")return _c(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class dt{constructor(e){this.type=L,this.key=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const r=e[1];return r==null?t.error("Global state property must be defined."):typeof r!="string"?t.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new dt(r)}evaluate(e){var t;const r=(t=e.globals)===null||t===void 0?void 0:t.globalState;return!r||Object.keys(r).length===0?null:Bi(r,this.key)}eachChild(){}outputDefined(){return!1}}const Ye={"==":Yu,"!=":Wu,">":Ju,"<":Hu,">=":Qu,"<=":Ku,array:ue,at:tr,boolean:ue,case:ir,coalesce:ft,collator:Qt,format:lr,image:ur,in:nr,"index-of":Wt,interpolate:se,"interpolate-hcl":se,"interpolate-lab":se,length:cr,let:Xt,literal:je,match:rr,number:ue,"number-format":ar,object:ue,slice:Ht,step:Kt,string:ue,"to-boolean":Te,"to-color":Te,"to-number":Te,"to-string":Te,var:Yt,within:Ae,distance:Fe,"global-state":dt};class oe{constructor(e,t,r,i){this.name=e,this.type=t,this._evaluate=r,this.args=i}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){const r=e[0],i=oe.definitions[r];if(!i)return t.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const s=Array.isArray(i)?i[0]:i.type,o=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,a=o.filter(([u])=>!Array.isArray(u)||u.length===e.length-1);let l=null;for(const[u,c]of a){l=new Zt(t.registry,on,t.path,null,t.scope);const f=[];let p=!1;for(let d=1;d<e.length;d++){const h=e[d],y=Array.isArray(u)?u[d-1]:u.type,m=l.parse(h,1+f.length,y);if(!m){p=!0;break}f.push(m)}if(!p){if(Array.isArray(u)&&u.length!==f.length){l.error(`Expected ${u.length} arguments, but found ${f.length} instead.`);continue}for(let d=0;d<f.length;d++){const h=Array.isArray(u)?u[d]:u.type,y=f[d];l.concat(d+1).checkSubtype(h,y.type)}if(l.errors.length===0)return new oe(r,s,c,f)}}if(a.length===1)t.errors.push(...l.errors);else{const c=(a.length?a:o).map(([p])=>Lc(p)).join(" | "),f=[];for(let p=1;p<e.length;p++){const d=t.parse(e[p],1+f.length);if(!d)return null;f.push(V(d.type))}t.error(`Expected arguments of type ${c}, but found (${f.join(", ")}) instead.`)}return null}static register(e,t){oe.definitions=t;for(const r in t)e[r]=oe}}function ls(n,[e,t,r,i]){e=e.evaluate(n),t=t.evaluate(n),r=r.evaluate(n);const s=i?i.evaluate(n):1,o=Gi(e,t,r,s);if(o)throw new D(o);return new F(e/255,t/255,r/255,s,!1)}function us(n,e){return n in e}function Cr(n,e){const t=e[n];return typeof t>"u"?null:t}function Ic(n,e,t,r){for(;t<=r;){const i=t+r>>1;if(e[i]===n)return!0;e[i]>n?r=i-1:t=i+1}return!1}function ke(n){return{type:n}}oe.register(Ye,{error:[gu,[A],(n,[e])=>{throw new D(e.evaluate(n))}],typeof:[A,[L],(n,[e])=>V(q(e.evaluate(n)))],"to-rgba":[ne(C,4),[he],(n,[e])=>{const[t,r,i,s]=e.evaluate(n).rgb;return[t*255,r*255,i*255,s]}],rgb:[he,[C,C,C],ls],rgba:[he,[C,C,C,C],ls],has:{type:E,overloads:[[[A],(n,[e])=>us(e.evaluate(n),n.properties())],[[A,Se],(n,[e,t])=>us(e.evaluate(n),t.evaluate(n))]]},get:{type:L,overloads:[[[A],(n,[e])=>Cr(e.evaluate(n),n.properties())],[[A,Se],(n,[e,t])=>Cr(e.evaluate(n),t.evaluate(n))]]},"feature-state":[L,[A],(n,[e])=>Cr(e.evaluate(n),n.featureState||{})],properties:[Se,[],n=>n.properties()],"geometry-type":[A,[],n=>n.geometryType()],id:[L,[],n=>n.id()],zoom:[C,[],n=>n.globals.zoom],"heatmap-density":[C,[],n=>n.globals.heatmapDensity||0],elevation:[C,[],n=>n.globals.elevation||0],"line-progress":[C,[],n=>n.globals.lineProgress||0],accumulated:[L,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[C,ke(C),(n,e)=>{let t=0;for(const r of e)t+=r.evaluate(n);return t}],"*":[C,ke(C),(n,e)=>{let t=1;for(const r of e)t*=r.evaluate(n);return t}],"-":{type:C,overloads:[[[C,C],(n,[e,t])=>e.evaluate(n)-t.evaluate(n)],[[C],(n,[e])=>-e.evaluate(n)]]},"/":[C,[C,C],(n,[e,t])=>e.evaluate(n)/t.evaluate(n)],"%":[C,[C,C],(n,[e,t])=>e.evaluate(n)%t.evaluate(n)],ln2:[C,[],()=>Math.LN2],pi:[C,[],()=>Math.PI],e:[C,[],()=>Math.E],"^":[C,[C,C],(n,[e,t])=>Math.pow(e.evaluate(n),t.evaluate(n))],sqrt:[C,[C],(n,[e])=>Math.sqrt(e.evaluate(n))],log10:[C,[C],(n,[e])=>Math.log(e.evaluate(n))/Math.LN10],ln:[C,[C],(n,[e])=>Math.log(e.evaluate(n))],log2:[C,[C],(n,[e])=>Math.log(e.evaluate(n))/Math.LN2],sin:[C,[C],(n,[e])=>Math.sin(e.evaluate(n))],cos:[C,[C],(n,[e])=>Math.cos(e.evaluate(n))],tan:[C,[C],(n,[e])=>Math.tan(e.evaluate(n))],asin:[C,[C],(n,[e])=>Math.asin(e.evaluate(n))],acos:[C,[C],(n,[e])=>Math.acos(e.evaluate(n))],atan:[C,[C],(n,[e])=>Math.atan(e.evaluate(n))],min:[C,ke(C),(n,e)=>Math.min(...e.map(t=>t.evaluate(n)))],max:[C,ke(C),(n,e)=>Math.max(...e.map(t=>t.evaluate(n)))],abs:[C,[C],(n,[e])=>Math.abs(e.evaluate(n))],round:[C,[C],(n,[e])=>{const t=e.evaluate(n);return t<0?-Math.round(-t):Math.round(t)}],floor:[C,[C],(n,[e])=>Math.floor(e.evaluate(n))],ceil:[C,[C],(n,[e])=>Math.ceil(e.evaluate(n))],"filter-==":[E,[A,L],(n,[e,t])=>n.properties()[e.value]===t.value],"filter-id-==":[E,[L],(n,[e])=>n.id()===e.value],"filter-type-==":[E,[A],(n,[e])=>n.geometryType()===e.value],"filter-<":[E,[A,L],(n,[e,t])=>{const r=n.properties()[e.value],i=t.value;return typeof r==typeof i&&r<i}],"filter-id-<":[E,[L],(n,[e])=>{const t=n.id(),r=e.value;return typeof t==typeof r&&t<r}],"filter->":[E,[A,L],(n,[e,t])=>{const r=n.properties()[e.value],i=t.value;return typeof r==typeof i&&r>i}],"filter-id->":[E,[L],(n,[e])=>{const t=n.id(),r=e.value;return typeof t==typeof r&&t>r}],"filter-<=":[E,[A,L],(n,[e,t])=>{const r=n.properties()[e.value],i=t.value;return typeof r==typeof i&&r<=i}],"filter-id-<=":[E,[L],(n,[e])=>{const t=n.id(),r=e.value;return typeof t==typeof r&&t<=r}],"filter->=":[E,[A,L],(n,[e,t])=>{const r=n.properties()[e.value],i=t.value;return typeof r==typeof i&&r>=i}],"filter-id->=":[E,[L],(n,[e])=>{const t=n.id(),r=e.value;return typeof t==typeof r&&t>=r}],"filter-has":[E,[L],(n,[e])=>e.value in n.properties()],"filter-has-id":[E,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[E,[ne(A)],(n,[e])=>e.value.indexOf(n.geometryType())>=0],"filter-id-in":[E,[ne(L)],(n,[e])=>e.value.indexOf(n.id())>=0],"filter-in-small":[E,[A,ne(L)],(n,[e,t])=>t.value.indexOf(n.properties()[e.value])>=0],"filter-in-large":[E,[A,ne(L)],(n,[e,t])=>Ic(n.properties()[e.value],t.value,0,t.value.length-1)],all:{type:E,overloads:[[[E,E],(n,[e,t])=>e.evaluate(n)&&t.evaluate(n)],[ke(E),(n,e)=>{for(const t of e)if(!t.evaluate(n))return!1;return!0}]]},any:{type:E,overloads:[[[E,E],(n,[e,t])=>e.evaluate(n)||t.evaluate(n)],[ke(E),(n,e)=>{for(const t of e)if(t.evaluate(n))return!0;return!1}]]},"!":[E,[E],(n,[e])=>!e.evaluate(n)],"is-supported-script":[E,[A],(n,[e])=>{const t=n.globals&&n.globals.isSupportedScript;return t?t(e.evaluate(n)):!0}],upcase:[A,[A],(n,[e])=>e.evaluate(n).toUpperCase()],downcase:[A,[A],(n,[e])=>e.evaluate(n).toLowerCase()],concat:[A,ke(L),(n,e)=>e.map(t=>ct(t.evaluate(n))).join("")],"resolved-locale":[A,[Bt],(n,[e])=>e.evaluate(n).resolvedLocale()]});function Lc(n){return Array.isArray(n)?`(${n.map(V).join(", ")})`:`(${V(n.type)}...)`}function on(n){if(n instanceof Yt)return on(n.boundExpression);if(n instanceof oe&&n.name==="error")return!1;if(n instanceof Qt)return!1;if(n instanceof Ae)return!1;if(n instanceof Fe)return!1;if(n instanceof dt)return!1;const e=n instanceof Te||n instanceof ue;let t=!0;return n.eachChild(r=>{e?t=t&&on(r):t=t&&r instanceof je}),t?Tr(n)&&Ir(n,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Tr(n){if(n instanceof oe){if(n.name==="get"&&n.args.length===1)return!1;if(n.name==="feature-state")return!1;if(n.name==="has"&&n.args.length===1)return!1;if(n.name==="properties"||n.name==="geometry-type"||n.name==="id")return!1;if(/^filter-/.test(n.name))return!1}if(n instanceof Ae||n instanceof Fe)return!1;let e=!0;return n.eachChild(t=>{e&&!Tr(t)&&(e=!1)}),e}function _r(n){if(n instanceof oe&&n.name==="feature-state")return!1;let e=!0;return n.eachChild(t=>{e&&!_r(t)&&(e=!1)}),e}function Ir(n,e){if(n instanceof oe&&e.indexOf(n.name)>=0)return!1;let t=!0;return n.eachChild(r=>{t&&!Ir(r,e)&&(t=!1)}),t}function Lr(n){return{result:"success",value:n}}function We(n){return{result:"error",value:n}}function Sc(n){return n["property-type"]==="data-driven"||n["property-type"]==="cross-faded-data-driven"}function Ec(n){return!!n.expression&&n.expression.parameters.indexOf("zoom")>-1}function cs(n){return!!n.expression&&n.expression.interpolated}function Sr(n){return n instanceof Number?"number":n instanceof String?"string":n instanceof Boolean?"boolean":Array.isArray(n)?"array":n===null?"null":typeof n}function fs(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&q(n)===Se}function Ac(n){return n}function zc(n){switch(n.type){case"color":return F.parse;case"padding":return H.parse;case"numberArray":return J.parse;case"colorArray":return j.parse;default:return null}}function Fc(n){switch(n){case"exponential":return ps;case"interval":return Pc;case"categorical":return kc;case"identity":return Mc;default:throw new Error(`Unknown function type "${n}"`)}}function hs(n,e){const t=n.stops&&typeof n.stops[0][0]=="object",r=t||n.property!==void 0,i=t||!r,s=n.type||(cs(e)?"exponential":"interval"),o=zc(e);if(o&&(n=zi({},n),n.stops&&(n.stops=n.stops.map(c=>[c[0],o(c[1])])),n.default?n.default=o(n.default):n.default=o(e.default)),n.colorSpace&&!Eu(n.colorSpace))throw new Error(`Unknown color space: "${n.colorSpace}"`);const a=Fc(s);let l,u;if(s==="categorical"){l=Object.create(null);for(const c of n.stops)l[c[0]]=c[1];u=typeof n.stops[0][0]}if(t){const c={},f=[];for(let h=0;h<n.stops.length;h++){const y=n.stops[h],m=y[0].zoom;c[m]===void 0&&(c[m]={zoom:m,type:n.type,property:n.property,default:n.default,stops:[]},f.push(m)),c[m].stops.push([y[0].value,y[1]])}const p=[];for(const h of f)p.push([c[h].zoom,hs(c[h],e)]);const d={name:"linear"};return{kind:"composite",interpolationType:d,interpolationFactor:se.interpolationFactor.bind(void 0,d),zoomStops:p.map(h=>h[0]),evaluate({zoom:h},y){return ps({stops:p,base:n.base},e,h).evaluate(h,y)}}}else if(i){const c=s==="exponential"?{name:"exponential",base:n.base!==void 0?n.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:se.interpolationFactor.bind(void 0,c),zoomStops:n.stops.map(f=>f[0]),evaluate:({zoom:f})=>a(n,e,f,l,u)}}else return{kind:"source",evaluate(c,f){const p=f&&f.properties?f.properties[n.property]:void 0;return p===void 0?yt(n.default,e.default):a(n,e,p,l,u)}}}function yt(n,e,t){if(n!==void 0)return n;if(e!==void 0)return e;if(t!==void 0)return t}function kc(n,e,t,r,i){const s=typeof t===i?r[t]:void 0;return yt(s,n.default,e.default)}function Pc(n,e,t){if(Sr(t)!=="number")return yt(n.default,e.default);const r=n.stops.length;if(r===1||t<=n.stops[0][0])return n.stops[0][1];if(t>=n.stops[r-1][0])return n.stops[r-1][1];const i=Jt(n.stops.map(s=>s[0]),t);return n.stops[i][1]}function ps(n,e,t){const r=n.base!==void 0?n.base:1;if(Sr(t)!=="number")return yt(n.default,e.default);const i=n.stops.length;if(i===1||t<=n.stops[0][0])return n.stops[0][1];if(t>=n.stops[i-1][0])return n.stops[i-1][1];const s=Jt(n.stops.map(c=>c[0]),t),o=Oc(t,r,n.stops[s][0],n.stops[s+1][0]),a=n.stops[s][1],l=n.stops[s+1][1],u=Vu[e.type]||Ac;return typeof a.evaluate=="function"?{evaluate(...c){const f=a.evaluate.apply(void 0,c),p=l.evaluate.apply(void 0,c);if(!(f===void 0||p===void 0))return u(f,p,o,n.colorSpace)}}:u(a,l,o,n.colorSpace)}function Mc(n,e,t){switch(e.type){case"color":t=F.parse(t);break;case"formatted":t=pe.fromString(t.toString());break;case"resolvedImage":t=de.fromString(t.toString());break;case"padding":t=H.parse(t);break;case"colorArray":t=j.parse(t);break;case"numberArray":t=J.parse(t);break;default:Sr(t)!==e.type&&(e.type!=="enum"||!e.values[t])&&(t=void 0)}return yt(t,n.default,e.default)}function Oc(n,e,t,r){const i=r-t,s=n-t;return i===0?0:e===1?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}class Er{constructor(e,t,r){this.expression=e,this._warningHistory={},this._evaluator=new $i,this._defaultValue=t?Bc(t):null,this._enumValues=t&&t.type==="enum"?t.values:null,this._globalState=r}evaluateWithoutErrorHandling(e,t,r,i,s,o){return this._globalState&&(e=He(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(e,t,r,i,s,o){this._globalState&&(e=He(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=o||null;try{const a=this.expression.evaluate(this._evaluator);if(a==null||typeof a=="number"&&a!==a)return this._defaultValue;if(this._enumValues&&!(a in this._enumValues))throw new D(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(a)} instead.`);return a}catch(a){return this._warningHistory[a.message]||(this._warningHistory[a.message]=!0,typeof console<"u"&&console.warn(a.message)),this._defaultValue}}}function ds(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in Ye}function Ar(n,e,t){const r=new Zt(Ye,on,[],e?Nc(e):void 0),i=r.parse(n,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return i?Lr(new Er(i,e,t)):We(r.errors)}class an{constructor(e,t,r){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!_r(t.expression),this.globalStateRefs=cn(t.expression),this._globalState=r}evaluateWithoutErrorHandling(e,t,r,i,s,o){return this._globalState&&(e=He(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,s,o)}evaluate(e,t,r,i,s,o){return this._globalState&&(e=He(e,this._globalState)),this._styleExpression.evaluate(e,t,r,i,s,o)}}class ln{constructor(e,t,r,i,s){this.kind=e,this.zoomStops=r,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!_r(t.expression),this.globalStateRefs=cn(t.expression),this.interpolationType=i,this._globalState=s}evaluateWithoutErrorHandling(e,t,r,i,s,o){return this._globalState&&(e=He(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,s,o)}evaluate(e,t,r,i,s,o){return this._globalState&&(e=He(e,this._globalState)),this._styleExpression.evaluate(e,t,r,i,s,o)}interpolationFactor(e,t,r){return this.interpolationType?se.interpolationFactor(this.interpolationType,e,t,r):0}}function Vc(n){return n._styleExpression!==void 0}function ys(n,e,t){const r=Ar(n,e,t);if(r.result==="error")return r;const i=r.value.expression,s=Tr(i);if(!s&&!Sc(e))return We([new fe("","data expressions not supported")]);const o=Ir(i,["zoom"]);if(!o&&!Ec(e))return We([new fe("","zoom expressions not supported")]);const a=un(i);if(!a&&!o)return We([new fe("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof fe)return We([a]);if(a instanceof se&&!cs(e))return We([new fe("",'"interpolate" expressions cannot be used with this property')]);if(!a)return Lr(s?new an("constant",r.value,t):new an("source",r.value,t));const l=a instanceof se?a.interpolation:void 0;return Lr(s?new ln("camera",r.value,a.labels,l,t):new ln("composite",r.value,a.labels,l,t))}class mt{constructor(e,t){this._parameters=e,this._specification=t,zi(this,hs(this._parameters,this._specification))}static deserialize(e){return new mt(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Dc(n,e,t){if(fs(n))return new mt(n,e);if(ds(n)){const r=ys(n,e,t);if(r.result==="error")throw new Error(r.value.map(i=>`${i.key}: ${i.message}`).join(", "));return r.value}else{let r=n;return e.type==="color"&&typeof n=="string"?r=F.parse(n):e.type==="padding"&&(typeof n=="number"||Array.isArray(n))?r=H.parse(n):e.type==="numberArray"&&(typeof n=="number"||Array.isArray(n))?r=J.parse(n):e.type==="colorArray"&&(typeof n=="string"||Array.isArray(n))?r=j.parse(n):e.type==="variableAnchorOffsetCollection"&&Array.isArray(n)?r=re.parse(n):e.type==="projectionDefinition"&&typeof n=="string"&&(r=ie.parse(n)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>r}}}function un(n){let e=null;if(n instanceof Xt)e=un(n.result);else if(n instanceof ft){for(const t of n.args)if(e=un(t),e)break}else(n instanceof Kt||n instanceof se)&&n.input instanceof oe&&n.input.name==="zoom"&&(e=n);return e instanceof fe||n.eachChild(t=>{const r=un(t);r instanceof fe?e=r:!e&&r?e=new fe("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new fe("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function cn(n,e=new Set){return n instanceof dt&&e.add(n.key),n.eachChild(t=>{cn(t,e)}),e}function Nc(n){const e={color:he,string:A,number:C,enum:A,boolean:E,formatted:Rt,padding:qt,numberArray:Gt,colorArray:ot,projectionDefinition:Nt,resolvedImage:at,variableAnchorOffsetCollection:Ut};return n.type==="array"?ne(e[n.value]||L,n.length):e[n.type]}function Bc(n){if(n.type==="color"&&fs(n.default))return new F(0,0,0,0);switch(n.type){case"color":return F.parse(n.default)||null;case"padding":return H.parse(n.default)||null;case"numberArray":return J.parse(n.default)||null;case"colorArray":return j.parse(n.default)||null;case"variableAnchorOffsetCollection":return re.parse(n.default)||null;case"projectionDefinition":return ie.parse(n.default)||null;default:return n.default===void 0?null:n.default}}function He(n,e){const{zoom:t,heatmapDensity:r,elevation:i,lineProgress:s,isSupportedScript:o,accumulated:a}=n??{};return{zoom:t,heatmapDensity:r,elevation:i,lineProgress:s,isSupportedScript:o,accumulated:a,globalState:e}}function zr(n){if(n===!0||n===!1)return!0;if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const e of n.slice(1))if(!zr(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Rc={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function qc(n,e){if(n==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};zr(n)||(n=fn(n));const t=Ar(n,Rc,e);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));{const r=ms(n);return{filter:(i,s,o)=>t.value.evaluate(i,s,{},o),needGeometry:r,getGlobalStateRefs:()=>cn(t.value.expression)}}}function Gc(n,e){return n<e?-1:n>e?1:0}function ms(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let e=1;e<n.length;e++)if(ms(n[e]))return!0;return!1}function fn(n){if(!n)return!0;const e=n[0];return n.length<=1?e!=="any":e==="=="?Fr(n[1],n[2],"=="):e==="!="?hn(Fr(n[1],n[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Fr(n[1],n[2],e):e==="any"?Uc(n.slice(1)):e==="all"?["all"].concat(n.slice(1).map(fn)):e==="none"?["all"].concat(n.slice(1).map(fn).map(hn)):e==="in"?gs(n[1],n.slice(2)):e==="!in"?hn(gs(n[1],n.slice(2))):e==="has"?xs(n[1]):e==="!has"?hn(xs(n[1])):!0}function Fr(n,e,t){switch(n){case"$type":return[`filter-type-${t}`,e];case"$id":return[`filter-id-${t}`,e];default:return[`filter-${t}`,n,e]}}function Uc(n){return["any"].concat(n.map(fn))}function gs(n,e){if(e.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",n,["literal",e.sort(Gc)]]:["filter-in-small",n,["literal",e]]}}function xs(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function hn(n){return["!",n]}const $c={StyleExpression:Er,StylePropertyFunction:mt,ZoomConstantExpression:an,ZoomDependentExpression:ln,createExpression:Ar,createPropertyExpression:ys,isExpression:ds,isExpressionFilter:zr,isZoomExpression:Vc,normalizePropertyExpression:Dc};class kr{constructor(e,t={}){this.data=t,this.props=new Map;const r=mu[e];for(const i in r)if(Object.hasOwnProperty.call(r,i)){const s=r[i],o=t[i],a=$c.normalizePropertyExpression(o===void 0?s.default:o,s);this.props.set(i,a)}}resolveTokens(e,t){return t.replace(/{([^{}]+)}/g,(r,i)=>e&&i in e?String(e[i]):"")}getDataConstValue(e,t){const r=this.props.get(e);return r&&r.evaluate({zoom:t})}getDataValue(e,t,r){const i=this.props.get(e);return i&&i.evaluate({zoom:t},r)}}class vs{constructor(e){this.data=e,this.type=e.type,this.id=e.id,this.minzoom=e.minzoom||0,this.maxzoom=e.maxzoom||24,this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=null,this.paint=new kr("paint_"+e.type,e.paint),this.layout=new kr("layout_"+e.type,e.layout),e.filter&&(this.filter=qc(e.filter))}convertColor(e,t){const r=e.a>0?1/e.a:1;return t||(t=new Cesium.Color),t.red=e.r*r,t.green=e.g*r,t.blue=e.b*r,t.alpha=e.a,t}}class bs{constructor(e){this.styleLayers=e,this.renderLayers=[],this.layerIndexMap={},this.list=[],this.tileIdCommands=[],this.tileCommands=[],this.visualizers=[]}init(){const{styleLayers:e,renderLayers:t,layerIndexMap:r}=this;for(let i=0;i<e.length;i++){const s=e[i];t[i]=[],r[s.id]=i}this.tileIdCommands.length=0,this.tileCommands.length=0,this.visualizers.length=0}beginFrame(){const e=this.renderLayers;for(const t of e)t.length=0;this.tileIdCommands.length=0,this.tileCommands.length=0,this.visualizers.length=0}push(e){const t=this.layerIndexMap[e.id];this.renderLayers[t].push(e)}getList(){const e=this.list;e.length=0;const t=this.renderLayers;for(const r of t)r&&e.push(...r);return e}destroy(){this.styleLayers.length=0,this.renderLayers.length=0,this.layerIndexMap=null,this.init()}}function jc(n,e,t=2){const r=e&&e.length,i=r?e[0]*t:n.length;let s=ws(n,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,u;if(r&&(s=Hc(n,e,s,t)),n.length>80*t){a=n[0],l=n[1];let c=a,f=l;for(let p=t;p<i;p+=t){const d=n[p],h=n[p+1];d<a&&(a=d),h<l&&(l=h),d>c&&(c=d),h>f&&(f=h)}u=Math.max(c-a,f-l),u=u!==0?32767/u:0}return gt(s,o,t,a,l,u,0),o}function ws(n,e,t,r,i){let s;if(i===lf(n,e,t,r)>0)for(let o=e;o<t;o+=r)s=Is(o/r|0,n[o],n[o+1],s);else for(let o=t-r;o>=e;o-=r)s=Is(o/r|0,n[o],n[o+1],s);return s&&Je(s,s.next)&&(bt(s),s=s.next),s}function Pe(n,e){if(!n)return n;e||(e=n);let t=n,r;do if(r=!1,!t.steiner&&(Je(t,t.next)||N(t.prev,t,t.next)===0)){if(bt(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function gt(n,e,t,r,i,s,o){if(!n)return;!o&&s&&tf(n,r,i,s);let a=n;for(;n.prev!==n.next;){const l=n.prev,u=n.next;if(s?Xc(n,r,i,s):Zc(n)){e.push(l.i,n.i,u.i),bt(n),n=u.next,a=u.next;continue}if(n=u,n===a){o?o===1?(n=Yc(Pe(n),e),gt(n,e,t,r,i,s,2)):o===2&&Wc(n,e,t,r,i,s):gt(Pe(n),e,t,r,i,s,1);break}}}function Zc(n){const e=n.prev,t=n,r=n.next;if(N(e,t,r)>=0)return!1;const i=e.x,s=t.x,o=r.x,a=e.y,l=t.y,u=r.y,c=Math.min(i,s,o),f=Math.min(a,l,u),p=Math.max(i,s,o),d=Math.max(a,l,u);let h=r.next;for(;h!==e;){if(h.x>=c&&h.x<=p&&h.y>=f&&h.y<=d&&xt(i,a,s,l,o,u,h.x,h.y)&&N(h.prev,h,h.next)>=0)return!1;h=h.next}return!0}function Xc(n,e,t,r){const i=n.prev,s=n,o=n.next;if(N(i,s,o)>=0)return!1;const a=i.x,l=s.x,u=o.x,c=i.y,f=s.y,p=o.y,d=Math.min(a,l,u),h=Math.min(c,f,p),y=Math.max(a,l,u),m=Math.max(c,f,p),v=Pr(d,h,e,t,r),w=Pr(y,m,e,t,r);let g=n.prevZ,x=n.nextZ;for(;g&&g.z>=v&&x&&x.z<=w;){if(g.x>=d&&g.x<=y&&g.y>=h&&g.y<=m&&g!==i&&g!==o&&xt(a,c,l,f,u,p,g.x,g.y)&&N(g.prev,g,g.next)>=0||(g=g.prevZ,x.x>=d&&x.x<=y&&x.y>=h&&x.y<=m&&x!==i&&x!==o&&xt(a,c,l,f,u,p,x.x,x.y)&&N(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;g&&g.z>=v;){if(g.x>=d&&g.x<=y&&g.y>=h&&g.y<=m&&g!==i&&g!==o&&xt(a,c,l,f,u,p,g.x,g.y)&&N(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;x&&x.z<=w;){if(x.x>=d&&x.x<=y&&x.y>=h&&x.y<=m&&x!==i&&x!==o&&xt(a,c,l,f,u,p,x.x,x.y)&&N(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Yc(n,e){let t=n;do{const r=t.prev,i=t.next.next;!Je(r,i)&&Ts(r,t,t.next,i)&&vt(r,i)&&vt(i,r)&&(e.push(r.i,t.i,i.i),bt(t),bt(t.next),t=n=i),t=t.next}while(t!==n);return Pe(t)}function Wc(n,e,t,r,i,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&sf(o,a)){let l=_s(o,a);o=Pe(o,o.next),l=Pe(l,l.next),gt(o,e,t,r,i,s,0),gt(l,e,t,r,i,s,0);return}a=a.next}o=o.next}while(o!==n)}function Hc(n,e,t,r){const i=[];for(let s=0,o=e.length;s<o;s++){const a=e[s]*r,l=s<o-1?e[s+1]*r:n.length,u=ws(n,a,l,r,!1);u===u.next&&(u.steiner=!0),i.push(rf(u))}i.sort(Jc);for(let s=0;s<i.length;s++)t=Kc(i[s],t);return t}function Jc(n,e){let t=n.x-e.x;if(t===0&&(t=n.y-e.y,t===0)){const r=(n.next.y-n.y)/(n.next.x-n.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=r-i}return t}function Kc(n,e){const t=Qc(n,e);if(!t)return e;const r=_s(t,n);return Pe(r,r.next),Pe(t,t.next)}function Qc(n,e){let t=e;const r=n.x,i=n.y;let s=-1/0,o;if(Je(n,t))return t;do{if(Je(n,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const f=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=r&&f>s&&(s=f,o=t.x<t.next.x?t:t.next,f===r))return o}t=t.next}while(t!==e);if(!o)return null;const a=o,l=o.x,u=o.y;let c=1/0;t=o;do{if(r>=t.x&&t.x>=l&&r!==t.x&&Cs(i<u?r:s,i,l,u,i<u?s:r,i,t.x,t.y)){const f=Math.abs(i-t.y)/(r-t.x);vt(t,n)&&(f<c||f===c&&(t.x>o.x||t.x===o.x&&ef(o,t)))&&(o=t,c=f)}t=t.next}while(t!==a);return o}function ef(n,e){return N(n.prev,n,e.prev)<0&&N(e.next,n,n.next)<0}function tf(n,e,t,r){let i=n;do i.z===0&&(i.z=Pr(i.x,i.y,e,t,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==n);i.prevZ.nextZ=null,i.prevZ=null,nf(i)}function nf(n){let e,t=1;do{let r=n,i;n=null;let s=null;for(e=0;r;){e++;let o=r,a=0;for(let u=0;u<t&&(a++,o=o.nextZ,!!o);u++);let l=t;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,a--):(i=o,o=o.nextZ,l--),s?s.nextZ=i:n=i,i.prevZ=s,s=i;r=o}s.nextZ=null,t*=2}while(e>1);return n}function Pr(n,e,t,r,i){return n=(n-t)*i|0,e=(e-r)*i|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function rf(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function Cs(n,e,t,r,i,s,o,a){return(i-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(r-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(r-a)}function xt(n,e,t,r,i,s,o,a){return!(n===o&&e===a)&&Cs(n,e,t,r,i,s,o,a)}function sf(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!of(n,e)&&(vt(n,e)&&vt(e,n)&&af(n,e)&&(N(n.prev,n,e.prev)||N(n,e.prev,e))||Je(n,e)&&N(n.prev,n,n.next)>0&&N(e.prev,e,e.next)>0)}function N(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Je(n,e){return n.x===e.x&&n.y===e.y}function Ts(n,e,t,r){const i=dn(N(n,e,t)),s=dn(N(n,e,r)),o=dn(N(t,r,n)),a=dn(N(t,r,e));return!!(i!==s&&o!==a||i===0&&pn(n,t,e)||s===0&&pn(n,r,e)||o===0&&pn(t,n,r)||a===0&&pn(t,e,r))}function pn(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function dn(n){return n>0?1:n<0?-1:0}function of(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&Ts(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function vt(n,e){return N(n.prev,n,n.next)<0?N(n,e,n.next)>=0&&N(n,n.prev,e)>=0:N(n,e,n.prev)<0||N(n,n.next,e)<0}function af(n,e){let t=n,r=!1;const i=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==n);return r}function _s(n,e){const t=Mr(n.i,n.x,n.y),r=Mr(e.i,e.x,e.y),i=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=i,i.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function Is(n,e,t,r){const i=Mr(n,e,t);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function bt(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Mr(n,e,t){return{i:n,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function lf(n,e,t,r){let i=0;for(let s=e,o=t-r;s<t;s+=r)i+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return i}class ve{constructor(e,t){if(t>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){const t=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/t),this._minGranularity,1)}}const vn=class vn{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}};vn.noSubdivision=new vn({fill:new ve(0,0),line:new ve(0,0),tile:new ve(0,0),stencil:new ve(0,0),circle:1});let yn=vn;const _e=3;class Or{constructor(e,t,r){const i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const o=new Int32Array(this.arrayBuffer);e=o[0],t=o[1],r=o[2],this.d=t+2*r;for(let u=0;u<this.d*this.d;u++){const c=o[_e+u],f=o[_e+u+1];i.push(c===f?null:o.subarray(c,f))}const a=o[_e+i.length],l=o[_e+i.length+1];this.keys=o.subarray(a,l),this.bboxes=o.subarray(l),this.insert=this._insertReadonly}else{this.d=t+2*r;for(let o=0;o<this.d*this.d;o++)i.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=r,this.scale=t/e,this.uid=0;const s=r/t*e;this.min=-s,this.max=e+s}insert(e,t,r,i,s){this._forEachCell(t,r,i,s,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(s)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,r,i,s,o){this.cells[s].push(o)}query(e,t,r,i,s){const o=this.min,a=this.max;if(e<=o&&t<=o&&a<=r&&a<=i&&!s)return Array.prototype.slice.call(this.keys);{const l=[],u={};return this._forEachCell(e,t,r,i,this._queryCell,l,u,s),l}}_queryCell(e,t,r,i,s,o,a,l){const u=this.cells[s];if(u!==null){const c=this.keys,f=this.bboxes;for(let p=0;p<u.length;p++){const d=u[p];if(a[d]===void 0){const h=d*4;(l?l(f[h+0],f[h+1],f[h+2],f[h+3]):e<=f[h+2]&&t<=f[h+3]&&r>=f[h+0]&&i>=f[h+1])?(a[d]=!0,o.push(c[d])):a[d]=!1}}}}_forEachCell(e,t,r,i,s,o,a,l){const u=this._convertToCellCoord(e),c=this._convertToCellCoord(t),f=this._convertToCellCoord(r),p=this._convertToCellCoord(i);for(let d=u;d<=f;d++)for(let h=c;h<=p;h++){const y=this.d*h+d;if(!(l&&!l(this._convertFromCellCoord(d),this._convertFromCellCoord(h),this._convertFromCellCoord(d+1),this._convertFromCellCoord(h+1)))&&s.call(this,e,t,r,i,y,o,a,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,t=_e+this.cells.length+1+1;let r=0;for(let o=0;o<this.cells.length;o++)r+=this.cells[o].length;const i=new Int32Array(t+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let s=t;for(let o=0;o<e.length;o++){const a=e[o];i[_e+o]=s,i.set(a,s),s+=a.length}return i[_e+e.length]=s,i.set(this.keys,s),s+=this.keys.length,i[_e+e.length+1]=s,i.set(this.bboxes,s),s+=this.bboxes.length,i.buffer}static serialize(e,t){const r=e.toArrayBuffer();return t&&t.push(r),{buffer:r}}static deserialize(e){return new Or(e.buffer)}}function uf(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Vr,Ls;function cf(){if(Ls)return Vr;Ls=1,Vr=n;function n(e,t,r,i){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(i-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=i}return n.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,i=0;i<8;i++){var s=this.sampleCurveX(r)-e;if(Math.abs(s)<t)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r=r-s/o}var a=0,l=1;for(r=e,i=0;i<20&&(s=this.sampleCurveX(r),!(Math.abs(s-e)<t));i++)e>s?a=r:l=r,r=(l-a)*.5+a;return r},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},Vr}var ff=cf();const hf=uf(ff);function pf(n,e,t,r){const i=new hf(n,e,t,r);return s=>i.solve(s)}pf(.25,.1,.25,1);function Ss(n,e,t){return Math.min(t,Math.max(e,n))}const Es={};function Y(n){Es[n]||(typeof console<"u"&&console.warn(n),Es[n]=!0)}class df extends Error{constructor(e,t,r,i){super(`AJAXError: ${t} (${e}): ${r}`),this.status=e,this.statusText=t,this.url=r,this.body=i}}const As={};function K(n,e,t={}){if(As[n])throw new Error(`${n} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:n,writeable:!1}),As[n]={klass:e,omit:t.omit||[],shallow:t.shallow||[]}}K("Object",Object),K("Set",Set),K("TransferableGridIndex",Or),K("Color",F),K("Error",Error),K("AJAXError",df),K("ResolvedImage",de),K("StylePropertyFunction",mt),K("StyleExpression",Er,{omit:["_evaluator"]}),K("ZoomDependentExpression",ln),K("ZoomConstantExpression",an),K("CompoundExpression",oe,{omit:["_evaluate"]});for(const n in Ye)Ye[n]._classRegistryKey||K(`Expression_${n}`,Ye[n]);K("SubdivisionGranularityExpression",ve),K("SubdivisionGranularitySetting",yn);const Ke=-32768,wt=32767;class yf{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=te/e,this._canonical=t}_getKey(e,t){return e=e+32768,t=t+32768,e<<16|t<<0}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const r=Math.round(e)|0,i=Math.round(t)|0,s=this._getKey(r,i);if(this._vertexDictionary.has(s))return this._vertexDictionary.get(s);const o=this._vertexBuffer.length/2;return this._vertexDictionary.set(s,o),this._vertexBuffer.push(r,i),o}_subdivideTrianglesScanline(e){if(this._granularity<2)return xf(this._vertexBuffer,e);const t=[],r=e.length;for(let i=0;i<r;i+=3){const s=[e[i+0],e[i+1],e[i+2]],o=[this._vertexBuffer[e[i+0]*2+0],this._vertexBuffer[e[i+0]*2+1],this._vertexBuffer[e[i+1]*2+0],this._vertexBuffer[e[i+1]*2+1],this._vertexBuffer[e[i+2]*2+0],this._vertexBuffer[e[i+2]*2+1]];let a=1/0,l=1/0,u=-1/0,c=-1/0;for(let y=0;y<3;y++){const m=o[y*2],v=o[y*2+1];a=Math.min(a,m),u=Math.max(u,m),l=Math.min(l,v),c=Math.max(c,v)}if(a===u||l===c)continue;const f=Math.floor(a/this._granularityCellSize),p=Math.ceil(u/this._granularityCellSize),d=Math.floor(l/this._granularityCellSize),h=Math.ceil(c/this._granularityCellSize);if(f===p&&d===h){t.push(...s);continue}for(let y=d;y<h;y++){const m=this._scanlineGenerateVertexRingForCellRow(y,o,s);vf(this._vertexBuffer,m,t)}}return t}_scanlineGenerateVertexRingForCellRow(e,t,r){const i=e*this._granularityCellSize,s=i+this._granularityCellSize,o=[];for(let a=0;a<3;a++){const l=t[a*2],u=t[a*2+1],c=t[(a+1)*2%6],f=t[((a+1)*2+1)%6],p=t[(a+2)*2%6],d=t[((a+2)*2+1)%6],h=c-l,y=f-u,m=h===0,v=y===0,w=(i-u)/y,g=(s-u)/y,x=Math.min(w,g),b=Math.max(w,g);if(!v&&(x>=1||b<=0)||v&&(u<i||u>s)){f>=i&&f<=s&&o.push(r[(a+1)%3]);continue}if(!v&&x>0){const I=l+h*x,k=u+y*x;o.push(this._vertexToIndex(I,k))}const T=l+h*Math.max(x,0),_=l+h*Math.min(b,1);if(m||this._generateIntraEdgeVertices(o,l,u,c,f,T,_),!v&&b<1){const I=l+h*b,k=u+y*b;o.push(this._vertexToIndex(I,k))}(v||f>=i&&f<=s)&&o.push(r[(a+1)%3]),!v&&(f<=i||f>=s)&&this._generateInterEdgeVertices(o,l,u,c,f,p,d,_,i,s)}return o}_generateIntraEdgeVertices(e,t,r,i,s,o,a){const l=i-t,u=s-r,c=u===0,f=c?Math.min(t,i):Math.min(o,a),p=c?Math.max(t,i):Math.max(o,a),d=Math.floor(f/this._granularityCellSize)+1,h=Math.ceil(p/this._granularityCellSize)-1;if(c?t<i:o<a)for(let m=d;m<=h;m++){const v=m*this._granularityCellSize,w=r+u*(v-t)/l;e.push(this._vertexToIndex(v,w))}else for(let m=h;m>=d;m--){const v=m*this._granularityCellSize,w=r+u*(v-t)/l;e.push(this._vertexToIndex(v,w))}}_generateInterEdgeVertices(e,t,r,i,s,o,a,l,u,c){const f=s-r,p=o-i,d=a-s,h=(u-s)/d,y=(c-s)/d,m=Math.min(h,y),v=Math.max(h,y),w=i+p*m;let g=Math.floor(Math.min(w,l)/this._granularityCellSize)+1,x=Math.ceil(Math.max(w,l)/this._granularityCellSize)-1,b=l<w;const T=d===0;if(T&&(a===u||a===c))return;if(T||m>=1||v<=0){const I=t-o,k=r-a,M=(u-a)/k,$=(c-a)/k,W=Math.min(M,$),ce=o+I*W;g=Math.floor(Math.min(ce,l)/this._granularityCellSize)+1,x=Math.ceil(Math.max(ce,l)/this._granularityCellSize)-1,b=l<ce}const _=f>0?c:u;if(b)for(let I=g;I<=x;I++){const k=I*this._granularityCellSize;e.push(this._vertexToIndex(k,_))}else for(let I=x;I>=g;I--){const k=I*this._granularityCellSize;e.push(this._vertexToIndex(k,_))}}_generateOutline(e){const t=[];for(const r of e){const i=zs(r,this._granularity,!0),s=this._pointArrayToIndices(i),o=[];for(let a=1;a<s.length;a++)o.push(s[a-1]),o.push(s[a]);t.push(o)}return t}_handlePoles(e){let t=!1,r=!1;this._canonical&&(this._canonical.y===0&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(t||r)&&this._fillPoles(e,t,r)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){const r=e[t+1];r===Ke&&(e[t+1]=Ke+1),r===wt&&(e[t+1]=wt-1)}}_generatePoleQuad(e,t,r,i,s,o){i>s!=(o===Ke)?(e.push(t),e.push(r),e.push(this._vertexToIndex(i,o)),e.push(r),e.push(this._vertexToIndex(s,o)),e.push(this._vertexToIndex(i,o))):(e.push(r),e.push(t),e.push(this._vertexToIndex(i,o)),e.push(this._vertexToIndex(s,o)),e.push(r),e.push(this._vertexToIndex(i,o)))}_fillPoles(e,t,r){const i=this._vertexBuffer,s=0,o=te,a=e.length;for(let l=2;l<a;l+=3){const u=e[l-2],c=e[l-1],f=e[l],p=i[u*2],d=i[u*2+1],h=i[c*2],y=i[c*2+1],m=i[f*2],v=i[f*2+1];t&&(d===s&&y===s&&this._generatePoleQuad(e,u,c,p,h,Ke),y===s&&v===s&&this._generatePoleQuad(e,c,f,h,m,Ke),v===s&&d===s&&this._generatePoleQuad(e,f,u,m,p,Ke)),r&&(d===o&&y===o&&this._generatePoleQuad(e,u,c,p,h,wt),y===o&&v===o&&this._generatePoleQuad(e,c,f,h,m,wt),v===o&&d===o&&this._generatePoleQuad(e,f,u,m,p,wt))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:r,holeIndices:i}=gf(e);this._initializeVertices(r);let s;try{const a=jc(r,i),l=this._convertIndices(r,a);s=this._subdivideTrianglesScanline(l)}catch(a){console.error(a)}let o=[];return t&&(o=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(s),{verticesFlattened:this._vertexBuffer,indicesTriangles:s,indicesLineList:o}}_convertIndices(e,t){const r=[];for(let i=0;i<t.length;i++){const s=e[t[i]*2],o=e[t[i]*2+1];r.push(this._vertexToIndex(s,o))}return r}_pointArrayToIndices(e){const t=[];for(let r=0;r<e.length;r++){const i=e[r];t.push(this._vertexToIndex(i.x,i.y))}return t}}function mf(n,e,t,r=!0){return new yf(t,e).subdividePolygonInternal(n,r)}function zs(n,e,t=!1){if(!n||n.length<1)return[];if(n.length<2)return[];const r=n[0],i=n[n.length-1],s=t&&(r.x!==i.x||r.y!==i.y);if(e<2)return s?[...n,n[0]]:[...n];const o=Math.floor(te/e),a=[];a.push(new P(n[0].x,n[0].y));const l=n.length,u=s?l:l-1;for(let c=0;c<u;c++){const f=n[c],p=c<l-1?n[c+1]:n[0],d=f.x,h=f.y,y=p.x,m=p.y,v=d!==y,w=h!==m;if(!v&&!w)continue;const g=y-d,x=m-h,b=Math.abs(g),T=Math.abs(x);let _=d,I=h;for(;;){const M=g>0?(Math.floor(_/o)+1)*o:(Math.ceil(_/o)-1)*o,$=x>0?(Math.floor(I/o)+1)*o:(Math.ceil(I/o)-1)*o,W=Math.abs(_-M),ce=Math.abs(I-$),tt=Math.abs(_-y),Of=Math.abs(I-m),$s=v?W/b:Number.POSITIVE_INFINITY,js=w?ce/T:Number.POSITIVE_INFINITY;if((tt<=W||!v)&&(Of<=ce||!w))break;if($s<js&&v||!w){_=M,I=I+x*$s;const Me=new P(_,Math.round(I));(a[a.length-1].x!==Me.x||a[a.length-1].y!==Me.y)&&a.push(Me)}else{_=_+g*js,I=$;const Me=new P(Math.round(_),I);(a[a.length-1].x!==Me.x||a[a.length-1].y!==Me.y)&&a.push(Me)}}const k=new P(y,m);(a[a.length-1].x!==k.x||a[a.length-1].y!==k.y)&&a.push(k)}return a}function gf(n){const e=[],t=[];for(const r of n)if(r.length!==0){r!==n[0]&&e.push(t.length/2);for(let i=0;i<r.length;i++)t.push(r[i].x),t.push(r[i].y)}return{flattened:t,holeIndices:e}}function xf(n,e){const t=[];for(let r=0;r<e.length;r+=3){const i=e[r],s=e[r+1],o=e[r+2],a=n[i*2],l=n[i*2+1],u=n[s*2],c=n[s*2+1],f=n[o*2],p=n[o*2+1],d=u-a,h=c-l,y=f-a,m=p-l;d*m-h*y>0?(t.push(i),t.push(o),t.push(s)):(t.push(i),t.push(s),t.push(o))}return t}function vf(n,e,t){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let r=0,i=n[e[0]*2];for(let l=1;l<e.length;l++){const u=n[e[l]*2];u<i&&(i=u,r=l)}const s=e.length;let o=r,a=(o+1)%s;for(;;){const l=o-1>=0?o-1:s-1,u=(a+1)%s,c=n[e[l]*2],f=n[e[l]*2+1],p=n[e[u]*2],d=n[e[u]*2+1],h=n[e[o]*2],y=n[e[o]*2+1],m=n[e[a]*2],v=n[e[a]*2+1];let w=!1;if(c<p)w=!0;else if(c>p)w=!1;else{const g=m-h,b=v-y,T=-g,_=y<v?1:-1,I=((c-h)*b+(f-y)*T)*_,k=((p-h)*b+(d-y)*T)*_;I>k&&(w=!0)}if(w){const g=e[l],x=e[o],b=e[a];g!==x&&g!==b&&x!==b&&t.push(b,x,g),o--,o<0&&(o=s-1)}else{const g=e[u],x=e[o],b=e[a];g!==x&&g!==b&&x!==b&&t.push(b,x,g),a++,a>=s&&(a=0)}if(l===u)break}}const Fs={globe:new yn({fill:new ve(128,2),line:new ve(512,0),tile:new ve(128,32),stencil:new ve(128,1),circle:3})};let Dr=null,ks=0,Nr=null;function bf(n,e){return Nr===null&&(Nr=Cesium.TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(e.ellipsoid,128,e.getNumberOfXTilesAtLevel(0))),Nr/(1<<n)}function wf(n,e){const t=bf(e.z,e.tilingScheme),r=e.distanceToCamera,i=n.context.drawingBufferHeight,s=n.camera.frustum.sseDenominator;let o=t*i/(r*s);return n.fog.enabled&&(o-=Cesium.Math.fog(r,n.fog.density)*n.fog.sse),o/=n.pixelRatio,o}function Cf(){Dr===null&&(Dr=Cesium.RenderState.fromCache({id:"vt_tile-depth",blending:Cesium.BlendingState.DISABLED,depthTest:{enabled:!0},depthMask:!0,cull:{enabled:!0},stencilMask:Cesium.StencilConstants.CESIUM_3D_TILE_MASK,stencilTest:{backFunction:519,backOperation:{fail:7680,zFail:7680,zPass:7681},enabled:!0,frontFunction:519,frontOperation:{fail:7680,zFail:7680,zPass:7681},mask:128,reference:128},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}))}class mn{constructor(e){Cf(),this.x=e.x,this.y=e.y,this.z=e.z,this.parent=e.parent,this.children=[],this.tilingScheme=e.tilingScheme,this.rectangle=this.tilingScheme.tileXYToRectangle(this.x,this.y,this.z),this.tileBoundingRegion=new Cesium.TileBoundingRegion({rectangle:this.rectangle,minimumHeight:0,maximumHeight:0,ellipsoid:this.tilingScheme.ellipsoid,computeBoundingVolumes:!0}),this.layers=[],this.visualizers=[],this.sources={},this.tileId=null,this.lastVisitTime=0,this.state="none",this.renderable=!1,this.tileId={x:this.x,y:this.y,z:this.z,key:ks++,color:Cesium.Color.fromRgba(ks-1),tileColor:Cesium.Color.fromRandom({alpha:1})};const t=te*Math.pow(2,this.z),r=te*this.x,i=te*this.y;this.transformPoint=function(s,o,a){return a[0]=(s+r)*360/t-180,a[1]=360/Math.PI*Math.atan(Math.exp((1-(o+i)*2/t)*Math.PI))-90,a}}createChildren(){var e=[{x:this.x*2,y:this.y*2+1,z:this.z+1},{x:this.x*2+1,y:this.y*2+1,z:this.z+1},{x:this.x*2,y:this.y*2,z:this.z+1},{x:this.x*2+1,y:this.y*2,z:this.z+1}];for(const{x:r,y:i,z:s}of e){var t=new mn({x:r,y:i,z:s,tilingScheme:this.tilingScheme,parent:this});this.children.push(t)}}visit(e,t){const r=this.tileBoundingRegion;if(this.distanceToCamera=r.distanceToCamera(e),this.visibility=e.cullingVolume.computeVisibility(r),this.visibility==Cesium.Intersect.OUTSIDE)return;const i=e.maximumScreenSpaceError;wf(e,this)>=i?t.visitChildren(this):t.accept(this)}async getSources(e){const t={},r=e._styleJson;for(const s of r.layers){const o=s.source,a=e.sources[o];a&&!t[o]&&(t[o]=a)}if(e._taskProcessor&&Object.values(t).every(s=>s.type==="vector")){for(const s in t){const o=t[s];try{const a=await o.requestTileBuffer(this.x,this.y,this.z,e);a&&a.buffer&&(this.sources[s]=a)}catch{}}this._workerBuffers=!0}else for(const s in t){const o=t[s];try{const a=await o.requestTile(this.x,this.y,this.z,e);a&&(this.sources[s]=a)}catch{}}e.numLoading--,this.state="loaded"}async createRenderLayers(e,t){const r=this.sources,i=t._styleLayers,s=this.layers,o=this.visualizers,a={};for(const l of i){const u=r[l.source],c=Qe[l.type],f=et[l.type],p=l.type==="background";if(c||Y("不支持图层类型"+l.type),!p&&!u||!c)continue;const d=[];if(!p){const m=(l.source&&t.sources[l.source].type)=="geojson"?"_geojsonTileLayer":l.sourceLayer,v=u.layers[m];if(!v)continue;const w=v.length;for(let g=0;g<w;g++){const x=v.feature(g);l.filter&&!l.filter.filter({zoom:this.z},x)||(x.toGeoJSON||(x.toGeoJSON=Oe.prototype.toGeoJSON),d.push(x))}if(!d.length)continue}const h=new c(d,l,this);if(s.push(h),f){let y=a[l.type];y||(y=new f(this),a[l.type]=y,o.push(y)),y.addLayer(d,h,e,t)}}this.state="ready"}createRenderLayersFromWorkerResult(e,t,r){if(e.error){this.state="error";return}const i=r._styleLayers,s=this.layers,o=this.visualizers,a={};for(const l of e.fill||[]){const u=i.find(h=>h.id===l.layerId);if(!u)continue;const c=Qe.fill,f=et.fill,p=new c([],u,this);s.push(p);let d=a.fill;d||(d=new f(this),a.fill=d,o.push(d)),d.addLayerFromWorkerResult(l,p,t,r)}for(const l of e.line||[]){const u=i.find(h=>h.id===l.layerId);if(!u)continue;const c=Qe.line,f=et.line,p=new c([],u,this);s.push(p);let d=a.line;d||(d=new f(this),a.line=d,o.push(d)),d.addLayerFromWorkerResult(l,p,t,r)}for(const l of e.symbol||[]){const u=i.find(h=>h.id===l.layerId);if(!u)continue;const c=Qe.symbol,f=et.symbol,p=new c([],u,this);s.push(p);let d=a.symbol;d||(d=new f(this),a.symbol=d,o.push(d)),d.addLayerFromWorkerResult(l,p,t,r)}this.state="ready"}update(e,t,r){this.primitive||(this.primitive=new Cesium.Primitive({geometryInstances:new Cesium.GeometryInstance({geometry:new Cesium.RectangleGeometry({rectangle:this.rectangle})}),compressVertices:!1,asynchronous:!1,appearance:new Cesium.MaterialAppearance({flat:!0,translucent:!1,material:Cesium.Material.fromType("Color",{color:Cesium.Color.fromAlpha(this.tileId.tileColor,.25)}),renderState:{blending:Cesium.BlendingState.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},cull:{enabled:!1}}})}),this.primitive.name="_tile-color_");const i=this.commandList||[],s=this.tileIdCommands||[],o=this.tileDepthCommands||[];if(!i.length){const a=e.commandList;if(e.commandList=i,this.primitive.update(e),i.length){const l=this.tileId.color;for(const u of i){u.pass=Cesium.Pass.CESIUM_3D_TILE;const c=Cesium.DrawCommand.shallowClone(u);c.renderState=Cesium.RenderState.fromCache({id:"tileId",blending:{enabled:!1},depthTest:{enabled:!1},depthMask:!0,cull:{enabled:!0}}),c.layerType="tile-id",c.uniformMap={...u.uniformMap},c.uniformMap.color_0=function(){return l},s.push(c);const f=Cesium.DrawCommand.shallowClone(u);f.pass=Cesium.Pass.CESIUM_3D_TILE,f.renderState=Dr,o.layerType="tile-depth",o.push(f)}this.tileIdCommands=s,this.tileDepthCommands=o}this.commandList=i,e.commandList=a}if(r.showTileColor&&i.length&&t.tileCommands.push(...i),this.state=="none"&&r.numLoading<=r.maxLoading&&(r.numLoading++,this.state="loading",this.getSources(r)),this.state==="loaded"&&r.numInitializing<r.maxInitializing)if(this._workerBuffers&&r._taskProcessor){const a={sources:{},x:this.x,y:this.y,z:this.z,extent:te,styleLayers:r._styleLayers.map(c=>({id:c.id,type:c.type,source:c.source,sourceLayer:c.sourceLayer??c.data["source-layer"],filter:c.data.filter,paint:c.data.paint,layout:c.data.layout}))},l=[];for(const c in this.sources){const f=this.sources[c];f&&f.buffer&&(a.sources[c]={buffer:f.buffer,encoding:f.encoding||"mvt"},l.push(f.buffer))}const u=r._taskProcessor.scheduleTask(a,l);Cesium.defined(u)&&(this.state="initializing",r.numInitializing++,u.then(c=>{this.createRenderLayersFromWorkerResult(c,e,r)}).catch(()=>{this.state="error"}))}else this.state="initializing",r.numInitializing++,this.createRenderLayers(e,r);if(this.state==="ready"){let a=!0,l=!0;for(const u of this.visualizers)u.update(e,r),u.state==="none"&&(a=!1);for(const u of this.layers)u.update(e,r),u.visibility!="none"&&u.state=="none"&&(l=!1);this.renderable=a&&l}}render(e,t,r){if(!this.renderable)return;this.commandList;const i=this.tileIdCommands,s=this.tileDepthCommands;for(const o of this.layers)t.push(o);for(const o of this.visualizers)t.visualizers.push(o);for(const o of i)t.tileIdCommands.push(o);s.length&&t.tileCommands.push(...s)}unload(){this.primitive&&(this.primitive.destroy(),this.primitive=null),this.tileGeometry=null,this.commandList&&(this.commandList.length=0),this.tileIdCommands&&(this.tileIdCommands.length=0),this.tileDepthCommands&&(this.tileDepthCommands.length=0);for(const e of this.visualizers)e.destroy();this.visualizers.length=0;for(const e of this.layers)e.destroy();this.layers.length=0,this.sources={},this.state="none"}destroy(){if(this.unload(),this.tileId=null,this.tilingScheme=null,this.parent=null,this.children){for(const e of this.children)e.destroy();this.children.length=0,this.children=null}}}function gn(n,e){let t=!0;return n==="always"||(n==="never"||e==="never")&&(t=!1),t}class Tf{constructor(e,t,r){const i=this.boxCells=[],s=this.circleCells=[];this.xCellCount=Math.ceil(e/r),this.yCellCount=Math.ceil(t/r);for(let o=0;o<this.xCellCount*this.yCellCount;o++)i.push([]),s.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,r,i,s){this._forEachCell(t,r,i,s,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(s)}insertCircle(e,t,r,i){this._forEachCell(t-i,r-i,t+i,r+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(r),this.circles.push(i)}_insertBoxCell(e,t,r,i,s,o){this.boxCells[s].push(o)}_insertCircleCell(e,t,r,i,s,o){this.circleCells[s].push(o)}_query(e,t,r,i,s,o,a){if(r<0||e>this.width||i<0||t>this.height)return[];const l=[];if(e<=0&&t<=0&&this.width<=r&&this.height<=i){if(s)return[{key:null,x1:e,y1:t,x2:r,y2:i}];for(let u=0;u<this.boxKeys.length;u++)l.push({key:this.boxKeys[u],x1:this.bboxes[u*4],y1:this.bboxes[u*4+1],x2:this.bboxes[u*4+2],y2:this.bboxes[u*4+3]});for(let u=0;u<this.circleKeys.length;u++){const c=this.circles[u*3],f=this.circles[u*3+1],p=this.circles[u*3+2];l.push({key:this.circleKeys[u],x1:c-p,y1:f-p,x2:c+p,y2:f+p})}}else{const u={hitTest:s,overlapMode:o,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,r,i,this._queryCell,l,u,a)}return l}query(e,t,r,i){return this._query(e,t,r,i,!1,null)}hitTest(e,t,r,i,s,o){return this._query(e,t,r,i,!0,s,o).length>0}hitTestCircle(e,t,r,i,s){const o=e-r,a=e+r,l=t-r,u=t+r;if(a<0||o>this.width||u<0||l>this.height)return!1;const c=[],f={hitTest:!0,overlapMode:i,circle:{x:e,y:t,radius:r},seenUids:{box:{},circle:{}}};return this._forEachCell(o,l,a,u,this._queryCellCircle,c,f,s),c.length>0}_queryCell(e,t,r,i,s,o,a,l){const{seenUids:u,hitTest:c,overlapMode:f}=a,p=this.boxCells[s];if(p!==null){const h=this.bboxes;for(const y of p)if(!u.box[y]){u.box[y]=!0;const m=y*4,v=this.boxKeys[y];if(e<=h[m+2]&&t<=h[m+3]&&r>=h[m+0]&&i>=h[m+1]&&(!l||l(v))&&(!c||!gn(f,v.overlapMode))&&(o.push({key:v,x1:h[m],y1:h[m+1],x2:h[m+2],y2:h[m+3]}),c))return!0}}const d=this.circleCells[s];if(d!==null){const h=this.circles;for(const y of d)if(!u.circle[y]){u.circle[y]=!0;const m=y*3,v=this.circleKeys[y];if(this._circleAndRectCollide(h[m],h[m+1],h[m+2],e,t,r,i)&&(!l||l(v))&&(!c||!gn(f,v.overlapMode))){const w=h[m],g=h[m+1],x=h[m+2];if(o.push({key:v,x1:w-x,y1:g-x,x2:w+x,y2:g+x}),c)return!0}}}return!1}_queryCellCircle(e,t,r,i,s,o,a,l){const{circle:u,seenUids:c,overlapMode:f}=a,p=this.boxCells[s];if(p!==null){const h=this.bboxes;for(const y of p)if(!c.box[y]){c.box[y]=!0;const m=y*4,v=this.boxKeys[y];if(this._circleAndRectCollide(u.x,u.y,u.radius,h[m+0],h[m+1],h[m+2],h[m+3])&&(!l||l(v))&&!gn(f,v.overlapMode))return o.push(!0),!0}}const d=this.circleCells[s];if(d!==null){const h=this.circles;for(const y of d)if(!c.circle[y]){c.circle[y]=!0;const m=y*3,v=this.circleKeys[y];if(this._circlesCollide(h[m],h[m+1],h[m+2],u.x,u.y,u.radius)&&(!l||l(v))&&!gn(f,v.overlapMode))return o.push(!0),!0}}}_forEachCell(e,t,r,i,s,o,a,l){const u=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),f=this._convertToXCellCoord(r),p=this._convertToYCellCoord(i);for(let d=u;d<=f;d++)for(let h=c;h<=p;h++){const y=this.xCellCount*h+d;if(s.call(this,e,t,r,i,y,o,a,l))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,r,i,s,o){const a=i-e,l=s-t,u=r+o;return u*u>a*a+l*l}_circleAndRectCollide(e,t,r,i,s,o,a){const l=(o-i)/2,u=Math.abs(e-(i+l));if(u>l+r)return!1;const c=(a-s)/2,f=Math.abs(t-(s+c));if(f>c+r)return!1;if(u<=l||f<=c)return!0;const p=u-l,d=f-c;return p*p+d*d<=r*r}}const Ps=100;let Ms=null,Os=null;class _f{constructor(){Ms=new Cesium.Cartesian2,Os=new Cesium.BoundingRectangle}update(e,t,r){const i=e.context.drawingBufferWidth/e.pixelRatio,s=e.context.drawingBufferHeight/e.pixelRatio,o=e.camera._scene,a=new Tf(i+2*Ps,s+2*Ps,25);for(const l of t){const u=l.style,c=l.labels;if(l.type!=="symbol"||l.visibility==="none"||r<u.minzoom||r>=u.maxzoom||!Cesium.defined(c)||!c.length)continue;const f=u.layout.getDataConstValue("text-allow-overlap",l.tile.z),p=u.layout.getDataConstValue("text-overlap",l.tile.z),d=If(p,f),h=u.layout.getDataConstValue("text-padding",l.tile.z);for(const y of c){const m=y.computeScreenSpacePosition(o,Ms);if(!m){y.vtPlaceable=!0;continue}const v=Cesium.Label.getScreenSpaceBoundingBox(y,m,Os),w=v.x-h,g=v.y-h,x=w+v.width+h,b=g+v.height+h;if(a.hitTest(w,g,x,b,d,null))y.vtPlaceable=!1;else{const T={overlapMode:d};a.insert(T,w,g,x,b),y.vtPlaceable=!0}}}}}function If(n,e){let t="never";return n?t=n:e&&(t="always"),t}class Lf{constructor(e){this.maximumLevel=24,this.show=!0,this.showTileColor=!!e.showTileColor,this.ready=!1,this.tilingScheme=new Cesium.WebMercatorTilingScheme,this.readyEvent=new Cesium.Event,this.errorEvent=new Cesium.Event,this._styleJson=null,this._style=e.style,this._rootTiles=[],this._cacheTiles=[],this._tilesToUpdate=[],this._tilesToRender=[],this._styleLayers=[],this._renderList=new bs(this._styleLayers),this.numLoading=0,this.maxLoading=6,this.numInitializing=0,this.maxInitializing=6,this._taskProcessor=null,this._workerUrl=e.workerUrl||null,this._maximumActiveTasks=e.maximumActiveTasks??4,this.tileIdTexture=null,this.zoom=0,this._symbolPlacements=new _f,requestAnimationFrame(()=>{this.init()})}async init(){let e=this._style;if(!e){this.errorEvent.raiseEvent(new Error("请传入 style 参数"));return}this.path="",typeof e=="string"&&(this.path=e.split("/").slice(0,-1).join("/"),this.path&&(this.path+="/"),e=await Cesium.Resource.fetchJson(e)),this.sources={};for(const o in e.sources){const a=e.sources[o],l=wn[a.type];if(l){this.sources[o]=new l(a,this.path);try{await this.sources[o].init(),this.maximumLevel=Math.min(a.maxzoom||24,this.maximumLevel)}catch(u){this.errorEvent.raiseEvent(u)}}}for(let o=0;o<e.layers.length;o++)this._styleLayers[o]=new vs(e.layers[o]);const t=this.tilingScheme.getNumberOfXTilesAtLevel(0),r=this.tilingScheme.getNumberOfYTilesAtLevel(0);let i=0;for(let o=0;o<r;o++)for(let a=0;a<t;a++){var s=new mn({parent:this,x:a,y:o,z:0,tilingScheme:this.tilingScheme});s.createChildren(),this._rootTiles[i++]=s}this._renderList.init(),this._workerUrl&&typeof Cesium.TaskProcessor<"u"&&(this._taskProcessor=new Cesium.TaskProcessor(this._workerUrl,Math.min(this._maximumActiveTasks,this.maxInitializing))),this._styleJson=e,this.ready=!0,this.readyEvent.raiseEvent(this)}executeTileIdCommands(e){const t=this._renderList.tileIdCommands;if(t.length>0){const r=e.context;let i=this._tileIdFbo;i||(i=new Cesium.FramebufferManager({depthStencil:!0,supportsDepthTexture:!0}),this._tileIdFbo=i,this._idClearCommand=new Cesium.ClearCommand({color:new Cesium.Color(0,0,0,0),depth:1,stencil:0}));const s=r.floatingPointTexture?Cesium.PixelDatatype.FLOAT:Cesium.PixelDatatype.UNSIGNED_BYTE,o=r.drawingBufferWidth,a=r.drawingBufferHeight;i.update(r,o,a,1,s),i.clear(r,this._idClearCommand);const l=i.framebuffer;for(const u of t)u.framebuffer=l,u.execute(r);this.tileIdTexture=i.getColorTexture(0)}}update(e){if(!this.ready||!this.show)return;e.context.webgl2&&Y("webgl2模式下贴地线面的支持将导致性能下降");const t=this._renderList;t.beginFrame(),this.numInitializing=0;const r=e.camera._scene,s=r.globe._surface._debug.suspendLodUpdate;this.scene=r;const o=Sf(e,this);s||o.sort((c,f)=>c.distanceToCamera-f.distanceToCamera);for(const c of o)c.lastVisitTime=e.frameNumber,c.expired=!1,c.update(e,t,this);const a=s?this._tilesToRender:Ef(o,this._tilesToRender);s||a.sort((c,f)=>c.distanceToCamera-f.distanceToCamera);for(const c of a)c.lastVisitTime=e.frameNumber,c.expired=!1,c.render(e,t,this);const l=t.getList();this._symbolPlacements.update(e,l,this.zoom);for(const c of l)c.render(e,this);for(const c of t.visualizers)c.render(e,this);e.commandList.push(...t.tileCommands),this.executeTileIdCommands(e);const u=[];for(const c of this._cacheTiles)c.lastVisitTime<e.frameNumber&&(c.expired||u.push(c));if(u.sort((c,f)=>c.lastVisitTime-f.lastVisitTime),u.length>100){for(const c of u)if(c.unload(),c.expired=!0,u.length<=50)break}}destroy(){const e=this.scene,t=this._rootTiles;if(this.scene=null,e&&e.primitives.contains(this)&&e.primitives.remove(this),t){for(const r of t)r.destroy();t.length=0,this._rootTiles=null}if(this._cacheTiles&&(this._cacheTiles.length=0,this._cacheTiles=null),this.sources){for(const r in this.sources)Object.hasOwnProperty.call(this.sources,r)&&this.sources[r].destroy();this.sources=null}this._styleLayers=null,this._renderList&&(this._renderList.destroy(),this._renderList=null),this._taskProcessor&&!this._taskProcessor.isDestroyed()&&(this._taskProcessor.destroy(),this._taskProcessor=null),this._tilesToUpdate&&(this._tilesToUpdate.length=0,this._tilesToUpdate=null),this._tilesToRender&&(this._tilesToRender.length=0,this._tilesToRender=null),this._tileIdFbo&&(this._tileIdFbo.destroy(),this.tileIdTexture=null,this._tileIdFbo=null,this._idClearCommand=null),this._styleJson=null}isDestroyed(){return!1}}function Sf(n,e){const t=[...e._rootTiles],r=e._tilesToUpdate;let i=24,s=1/0;const o={visitChildren(a){if(a.z>=e.maximumLevel)return a.distanceToCamera<s&&(s=a.distanceToCamera,i=a.z),r.push(a);if(a.children.length==0){a.createChildren();for(const l of a.children)e._cacheTiles.push(l)}for(const l of a.children)t.push(l)},accept(a){a.distanceToCamera<s&&(s=a.distanceToCamera,i=a.z),r.push(a)}};r.length=0;do t.shift().visit(n,o);while(t.length>0);return e.zoom=i,r}function Ef(n,e){const t=new Map;for(const s of n)s.renderable&&t.set(s,!0);const r=[];for(let s=0;s<e.length;s++){const o=e[s];if(o.renderable=t.has(o),o.renderable)continue;const a={tiles:[],total:0,renderable:0};r[s]=a;for(const l of n){const u=l.z-o.z;if(u!==0)if(u>0){const c=Math.pow(2,u),f=Math.floor(l.x/c),p=Math.floor(l.y/c);f===o.x&&p===o.y&&(a.total++,a.tiles.push(l),l.renderable&&a.renderable++)}else{const c=Math.pow(2,-u),f=Math.floor(o.x/c),p=Math.floor(o.y/c);f===l.x&&p===l.y&&(o.renderable=!l.renderable)}}}for(let s=0;s<e.length;s++){const o=e[s],a=r[s];if(a&&a.total){const l=a.total===a.renderable;o.renderable=!l;for(const u of a.tiles)u.renderable=l}}t.clear();let i=e.length;for(let s=0;s<i;s++){const o=e.shift();o.renderable&&(e.push(o),t.set(o,!0))}i=n.length;for(let s=0;s<i;s++){const o=n[s];o.renderable&&!t.has(o)&&(e.push(o),t.set(o,!0))}return e}class Ct{constructor(e,t,r){this.sourceFeatures=e,this.style=t,this.tile=r,this.features=[],this.firstBatchId=-1,this.lastBatchId=-1,this.offsets=[],this.counts=[],this.commandList=[],this.visibility="visible",this.state="none"}get id(){return this.style.id}get type(){return this.style.type}update(e,t){const r=this.style.layout.getDataConstValue("visibility",this.tile.z);this.visibility=r}render(e,t){const r=this.style,i=t.zoom;if(this.visibility==="none"||i<r.minzoom||i>=r.maxzoom)return;const s=this.commandList;if(s&&s.length)for(const o of s)e.commandList.push(o)}isDestroyed(){return!1}destroy(){this.commandList&&(this.commandList.length=0),this.sourceFeatures&&(this.sourceFeatures.length=0),this.style=null,this.offsets=null,this.counts=null,this.tile=null,this.isDestroyed=function(){return!0}}}class xn{constructor(e,t=[]){this.tile=e,this.layers=t,this.state="none",this.commandList=[]}addLayer(e,t,r,i){}setState(e){for(const t of this.layers)t.state=e;this.state=e}update(e,t){}render(e){const t=this.commandList;if(t&&t.length)for(const r of t)e.commandList.push(r)}destroy(){this.tile=null,this.layers.length=0,this.isDestroyed=function(){return!0}}isDestroyed(){return!1}}const Qe={},et={};function Tt(n,e,t){Qe[n]=e,et[n]=t}class Vs extends Ct{createPrimitve(e,t){const r=this.style,i=this.tile,s=r.convertColor(r.paint.getDataConstValue("background-color",i.z)),o=r.paint.getDataConstValue("background-opacity",i.z);if(r.paint.getDataConstValue("background-pattern",i.z))return Y("background图层:不支持纹理填充");s.alpha*=o;const l=new Cesium.Primitive({geometryInstances:new Cesium.GeometryInstance({geometry:new Cesium.RectangleGeometry({rectangle:this.tile.rectangle})}),compressVertices:!1,asynchronous:!1,appearance:new Cesium.MaterialAppearance({translucent:!1,material:Cesium.Material.fromType("Color",{color:s}),flat:!0})});this.primitive=l}update(e,t){if(super.update(e,t),this.visibility!="none"&&(this.primitive||this.createPrimitve(e,t),this.primitive&&!this.commandList.length)){const r=e.commandList,i=e.commandList=this.commandList;if(this.primitive.update(e),i.length>0){const s=Cesium.RenderState.fromCache({blending:Cesium.BlendingState.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},cull:{enabled:!0}});for(const o of i)o.renderState=s,o.pass=Cesium.Pass.CESIUM_3D_TILE;this.state="done"}this.primitive._state===Cesium.PrimitiveState.FAILED&&(this.state="error"),e.commandList=r}}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),super.destroy()}}Tt("background",Vs);const Br=Math.pow(2,15-1)-1,Ds=-Br-1;function Ns(n){const e=te/n.extent,t=n.loadGeometry();for(let r=0;r<t.length;r++){const i=t[r];for(let s=0;s<i.length;s++){const o=i[s],a=Math.round(o.x*e),l=Math.round(o.y*e);o.x=Ss(a,Ds,Br),o.y=Ss(l,Ds,Br),(a<o.x||a>o.x+1||l<o.y||l>o.y+1)&&Y("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return t}class Af extends xn{constructor(e,t){super(e,t),this.geometryInstances=[],this.primitive=null,this.commandsReady=!1}addLayer(e,t,r,i){const s=t.style,{tile:o,geometryInstances:a}=this,l=Fs.globe.line.getGranularityForZoomLevel(o.z)/2,u=this;let c=0;const f=i.sources[t.style.source].styleSource.promoteId;for(const p of e){const d=Oe.types[p.type],h=p.properties;if(d!=="Polygon")continue;if(s.paint.getDataValue("fill-pattern",o.z,p)){Y("fill图层:不支持纹理填充(fill-pattern)");continue}const m=p.id||h[f],v=s.convertColor(s.paint.getDataValue("fill-color",o.z,p)),w=s.paint.getDataValue("fill-opacity",o.z,p),g=Ns(p),x=qr(g);for(const b of x){if(b.some(I=>I.length<3))continue;const T=a.length;c==0&&(t.firstBatchId=T),t.lastBatchId=T;const _={coordinates:b,featureId:c,fillColor:v,fillOpacity:w,properties:h,id:m,batchId:T};u.addFeature(_,l),c++}}t.offsets=[],t.counts=[],this.layers.push(t)}addLayerFromWorkerResult(e,t,r,i){const{batches:s,firstBatchId:o,lastBatchId:a}=e,l=this.geometryInstances,u=new Cesium.Cartesian3;for(const c of s){const{positions:f,normals:p,st:d,indices:h,colorBytes:y,id:m,properties:v}=c;f.length/3;const w=new Cesium.Geometry({attributes:{position:{componentDatatype:Cesium.ComponentDatatype.DOUBLE,componentsPerAttribute:3,normalize:!1,values:f},normal:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:3,normalize:!1,values:p},st:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:2,normalize:!1,values:d}},primitiveType:Cesium.PrimitiveType.TRIANGLES,indices:h,boundingSphere:Cesium.BoundingSphere.fromVertices(f)}),g=Cesium.Cartographic.fromCartesian(w.boundingSphere.center);g.height=0;const x=Cesium.Cartographic.toCartesian(g,null,u),b=new Cesium.GeometryInstance({geometry:w,attributes:{color:new Cesium.GeometryInstanceAttribute({componentDatatype:Cesium.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,value:Array.from(y)})},id:new Cesium.Entity({position:x,id:m,properties:v})});l.push(b)}t.firstBatchId=o,t.lastBatchId=a,t.offsets=[],t.counts=[],this.layers.push(t)}addFeature(e,t){const r=this.geometryInstances,{coordinates:i,fillColor:s,fillOpacity:o}=e,a=s.toBytes();a[3]=Math.floor(a[3]*o);const l=mf(i,this.tile,t,!1),u=l.verticesFlattened,c=[0,0],f=new Cesium.Cartesian3,p=u.length/2,d=new Float64Array(p*3),h=new Float32Array(p*3),y=new Float32Array(p*2);for(let b=0,T=0;b<u.length;b+=2,T++){const _=u[b],I=u[b+1],k=this.tile.transformPoint(_,I,c),M=Cesium.Cartesian3.fromDegrees(k[0],k[1],0,null,f);d[T*3]=M.x,d[T*3+1]=M.y,d[T*3+2]=M.z;const $=Cesium.Cartesian3.normalize(M,M);h[T*3]=$.x,h[T*3+1]=$.y,h[T*3+2]=$.z,y[T*2]=_/te,y[T*2+1]=I/te}const m=new(p>65535?Uint32Array:p>255?Uint16Array:Uint8Array)(l.indicesTriangles),v=new Cesium.Geometry({attributes:{position:{componentDatatype:Cesium.ComponentDatatype.DOUBLE,componentsPerAttribute:3,normalize:!1,values:d},normal:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:3,normalize:!1,values:h},st:{componentDatatype:Cesium.ComponentDatatype.FLOAT,componentsPerAttribute:2,normalize:!1,values:y}},primitiveType:Cesium.PrimitiveType.TRIANGLES,indices:m,boundingSphere:Cesium.BoundingSphere.fromVertices(d)}),w=Cesium.Cartographic.fromCartesian(v.boundingSphere.center);w.height=0;const g=Cesium.Cartographic.toCartesian(w,null,f),x=new Cesium.GeometryInstance({geometry:v,attributes:{color:new Cesium.GeometryInstanceAttribute({componentDatatype:Cesium.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,value:a})},id:new Cesium.Entity({position:g,id:e.id,properties:e.properties})});r.push(x)}createPrimitive(){const e=new Cesium.Primitive({geometryInstances:this.geometryInstances,asynchronous:!(this.geometryInstances[0].geometry instanceof Cesium.Geometry),appearance:new Cesium.PerInstanceColorAppearance({flat:!0,translucent:!1,renderState:{depthMask:!1},fragmentShaderSource:`
2
- in vec4 v_color;
3
-
4
- uniform vec4 tileId;
5
- uniform sampler2D tileIdTexture;
6
-
7
- void main()
8
- {
9
- vec2 id_st = gl_FragCoord.xy / czm_viewport.zw;
10
- vec4 bgId = texture(tileIdTexture, id_st);
11
- if (!all(equal(bgId, tileId)))
12
- {
13
- discard;
14
- }
15
- out_FragColor = v_color;
16
- }
17
- `})});let t=this;Object.defineProperties(e,{_geometries:{get(){return this._geometries_},set(r){this._geometries_=r,r?t.onGeometriesLoaded(r):t=null}},_batchTable:{get(){return this._batchTable_},set(r){this._batchTable_=r,r&&t.onBatchTableCreated(r)}}}),this.primitive=e}onGeometriesLoaded(e){for(let t=0;t<e.length;t++){const r={},i=e[t],s=i.attributes.batchId.values,o=i.indices;let a=-1,l=null;for(let u=0;u<o.length;u++){const c=o[u],f=s[c];a!==f&&(a=f,l=r[a]={begin:u,end:u}),l.end=u}for(const u of this.layers){const{firstBatchId:c,lastBatchId:f}=u;if(c===-1||f===-1)continue;let p=-1,d=-1;for(let h=c;h<=f;h++){const y=r[h];y&&(p===-1&&(p=y.begin),d=y.end)}p===-1||d===-1||(u.offsets[t]=p,u.counts[t]=d-p+1)}}}onBatchTableCreated(e){this._batchTable=e}createLayerCommands(e,t){const r=Cesium.RenderState.fromCache({id:"fill",blending:Cesium.BlendingState.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},cull:{enabled:!0}}),i=this.tile.tileId;this.renderState=r;for(let s=0;s<this.layers.length;s++){const o=this.layers[s],a=o.commandList=[];for(let l=0;l<e.length;l++){const u=o.offsets[l],c=o.counts[l];if(typeof u!="number"||typeof c!="number")continue;const f=e[l];f.uniformMap.tileIdTexture=function(){return t.tileIdTexture},f.uniformMap.tileId=function(){return i.color},f.pass=Cesium.Pass.CESIUM_3D_TILE;const p=Cesium.DrawCommand.shallowClone(f);p.pass=Cesium.Pass.CESIUM_3D_TILE,p.renderState=r,p.layerType="fill",p.offset=u,p.count=c,a.push(p)}o.state="done"}this.state="done"}update(e,t){if(this.geometryInstances&&(super.update(e,t),!this.primitive&&this.geometryInstances.length&&this.createPrimitive(),this.primitive&&this.state!=="done"&&this.state!=="error")){const r=e.commandList,i=e.commandList=[];try{this.primitive.update(e)}catch(s){this.geometryInstances=[],this.setState("error"),s.stack?console.trace(s.stack):console.error(s);return}i.length>0&&this.createLayerCommands(i,t),this.primitive._state===Cesium.PrimitiveState.FAILED&&this.setState("error"),e.commandList=r,this.geometryInstances=[]}}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),this._batchTable=null,this.geometryInstances=null,super.destroy()}isDestroyed(){return!1}}class Bs extends Ct{update(e,t){super.update(e,t)}}Tt("fill",Bs,Af);const zf=Oe.prototype.toGeoJSON;class Ff extends xn{constructor(e,t){super(e,t),this.geometryInstances=[],this.primitive=null,this.commandsReady=!1}addLayer(e,t,r,i){const s=t.style,{tile:o,geometryInstances:a}=this,l=Fs.globe.line.getGranularityForZoomLevel(o.z),u=this,c=i.sources[t.style.source].styleSource.promoteId;let f=0;const p=s.paint.getDataConstValue("line-dasharray",o.z);if(p&&p.length){p.length%2>0&&p.push(0),t.dashLength=0;for(let h=0;h<p.length;h++)t.dashLength+=p[h];t.dasharray=p,p.length>8&&Y("line图层:line-dasharray 超过最大长度(8)")}function d(h,y,m,v,w,g){if(h.length<2)return;const x=a.length;f==0&&(t.firstBatchId=x),t.lastBatchId=x;const b={coordinates:h,featureId:f,lineColor:m,lineOpacity:v,lineWidth:y,properties:g,id:w,batchId:x};u.addFeature(b),f++}for(const h of e){const y=Oe.types[h.type];if(y==="Point"||y==="Unknown")continue;const m=h.properties,v=Ns(h);for(let W=0;W<v.length;W++)v[W]=zs(v[W],l);const w=zf.call({extent:te,type:h.type,properties:m,loadGeometry(){return v}},o.x,o.y,o.z);if(!w.geometry)continue;const g=h.id||m[c],x=s.paint.getDataValue("line-width",o.z,h),b=s.convertColor(s.paint.getDataValue("line-color",o.z,h)),T=s.paint.getDataValue("line-opacity",o.z,h);if(s.paint.getDataValue("line-pattern",o.z,h)){Y("line图层:不支持纹理填充(line-pattern)");continue}const I=s.paint.getDataValue("line-join",o.z,h),k=s.paint.getDataValue("line-cap",o.z,h);I!=="miter"&&Y("line图层:line-join 仅支持 miter 模式"),k!=="butt"&&Y("line图层:line-cap 仅支持 butt 模式");const M=w.geometry.type,$=w.geometry.coordinates;if(M=="LineString")d($,x,b,T,g,m);else if(M=="MultiLineString"||M=="Polygon")for(const W of $)d(W,x,b,T,g,m);else if(M=="MultiPolygon")for(const W of $)for(const ce of W)d(ce,x,b,T,g,m);else Y("line图层:不支持几何类型:"+M)}t.offsets=[],t.counts=[],this.layers.push(t)}addLayerFromWorkerResult(e,t,r,i){const{batches:s,firstBatchId:o,lastBatchId:a}=e,l=this.geometryInstances;for(const u of s){const{positions:c,colorBytes:f,lineWidth:p,id:d,properties:h}=u,y=[];for(let x=0;x<c.length;x+=3)y.push(new Cesium.Cartesian3(c[x],c[x+1],c[x+2]));const m=Cesium.BoundingSphere.fromPoints(y),v=Cesium.Cartographic.fromCartesian(m.center);v.height=0;const w=Cesium.Cartographic.toCartesian(v,null,new Cesium.Cartesian3),g=new Cesium.GeometryInstance({geometry:new Cesium.PolylineGeometry({positions:y,width:p}),attributes:{color:new Cesium.GeometryInstanceAttribute({componentDatatype:Cesium.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,value:Array.from(f)})},id:new Cesium.Entity({position:w,id:d,properties:h})});l.push(g)}t.firstBatchId=o,t.lastBatchId=a,t.offsets=[],t.counts=[],this.layers.push(t)}addFeature(e){const t=this.geometryInstances,{coordinates:r,lineColor:i,lineWidth:s,lineOpacity:o}=e,a=i.toBytes();a[3]=Math.floor(a[3]*o);const l=r.map(d=>Cesium.Cartesian3.fromDegrees(d[0],d[1])),u=Cesium.BoundingSphere.fromPoints(l),c=Cesium.Cartographic.fromCartesian(u.center);c.height=0;const f=Cesium.Cartographic.toCartesian(c,null,new Cesium.Cartesian3),p=new Cesium.GeometryInstance({geometry:new Cesium.PolylineGeometry({positions:l,width:s}),attributes:{color:new Cesium.GeometryInstanceAttribute({componentDatatype:Cesium.ComponentDatatype.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0,value:a})},id:new Cesium.Entity({position:f,id:e.id,properties:e.properties})});t.push(p)}createPrimitive(){const e=new Cesium.Primitive({geometryInstances:this.geometryInstances,asynchronous:!0,appearance:new Cesium.PolylineMaterialAppearance({flat:!0,translucent:!1,vertexShaderSource:`
18
- ${Cesium._shadersPolylineCommon}
19
-
20
- in vec4 color;
21
- out vec4 v_color;
22
- in vec3 position3DHigh;
23
- in vec3 position3DLow;
24
- in vec3 prevPosition3DHigh;
25
- in vec3 prevPosition3DLow;
26
- in vec3 nextPosition3DHigh;
27
- in vec3 nextPosition3DLow;
28
- in vec2 expandAndWidth;
29
- in vec2 st;
30
- in float batchId;
31
-
32
- out float v_width;
33
- out vec2 v_st;
34
- out float v_polylineAngle;
35
-
36
- void main()
37
- {
38
- float expandDir = expandAndWidth.x;
39
- float width = abs(expandAndWidth.y) + 0.5;
40
- bool usePrev = expandAndWidth.y < 0.0;
41
-
42
- vec4 p = czm_computePosition();
43
- vec4 prev = czm_computePrevPosition();
44
- vec4 next = czm_computeNextPosition();
45
-
46
- float angle;
47
- vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);
48
- gl_Position = czm_viewportOrthographic * positionWC;
49
-
50
- v_width = width;
51
- v_st.s = st.s;
52
- v_st.t = czm_writeNonPerspective(st.t, gl_Position.w);
53
- v_polylineAngle = angle;
54
- v_color = color;
55
- }
56
- `,fragmentShaderSource:`
57
- in vec2 v_st;
58
-
59
- uniform vec4 tileId;
60
- uniform sampler2D tileIdTexture;
61
-
62
- void main()
63
- {
64
- vec2 id_st = gl_FragCoord.xy / czm_viewport.zw;
65
- vec4 bgId = texture(tileIdTexture, id_st);
66
- if (all(equal(bgId, tileId)) == false)
67
- {
68
- discard;
69
- }
70
-
71
- czm_materialInput materialInput;
72
-
73
- vec2 st = v_st;
74
- st.t = czm_readNonPerspective(st.t, gl_FragCoord.w);
75
-
76
- materialInput.s = st.s;
77
- materialInput.st = st;
78
- materialInput.str = vec3(st, 0.0);
79
-
80
- czm_material material = czm_getMaterial(materialInput);
81
- out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
82
-
83
- czm_writeLogDepth();
84
- }
85
- `,material:new Cesium.Material({fabric:{source:`
86
- const int maxArrayLength = 8;
87
-
88
- in float v_width;
89
- in vec4 v_color;
90
- uniform float dashLength;
91
- uniform float arrayLength;
92
- uniform float dasharray[maxArrayLength];
93
- in float v_polylineAngle;
94
-
95
- mat2 rotate(float rad) {
96
- float c = cos(rad);
97
- float s = sin(rad);
98
- return mat2(
99
- c, s,
100
- -s, c
101
- );
102
- }
103
-
104
- czm_material czm_getMaterial(czm_materialInput materialInput)
105
- {
106
- czm_material material = czm_getDefaultMaterial(materialInput);
107
-
108
- vec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;
109
-
110
- // Get the relative position within the dash from 0 to 1
111
- float dashPosition = fract(pos.x / (v_width * dashLength * czm_pixelRatio));
112
-
113
- float currDashPos = 0.;
114
- for (int i = 0; i < maxArrayLength; i += 2) {
115
- if(float(i) >= arrayLength) break;
116
-
117
- float gapStart = currDashPos + dasharray[i] / dashLength;
118
- float gapEnd = gapStart + dasharray[i + 1] / dashLength;
119
-
120
- if(dashPosition > gapStart && dashPosition < gapEnd) {
121
- discard;
122
- break;
123
- }
124
-
125
- currDashPos = gapEnd;
126
- }
127
-
128
- vec4 fragColor = v_color;
129
- fragColor = czm_gammaCorrect(fragColor);
130
- material.emission = fragColor.rgb;
131
- material.alpha = fragColor.a;
132
- return material;
133
- }
134
- `}})})});let t=this;Object.defineProperties(e,{_geometries:{get(){return this._geometries_},set(r){this._geometries_=r,r?t.onGeometriesLoaded(r):t=null}},_batchTable:{get(){return this._batchTable_},set(r){this._batchTable_=r,r&&t.onBatchTableCreated(r)}}}),this.primitive=e}onGeometriesLoaded(e){for(let t=0;t<e.length;t++){const r={},i=e[t],s=i.attributes.batchId.values,o=i.indices;let a=-1,l=null;for(let u=0;u<o.length;u++){const c=o[u],f=s[c];a!==f&&(a=f,l=r[a]={begin:u,end:u}),l.end=u}for(const u of this.layers){const{firstBatchId:c,lastBatchId:f}=u;if(c===-1||f===-1)continue;let p=-1,d=-1;for(let h=c;h<=f;h++){const y=r[h];y&&(p===-1&&(p=y.begin),d=y.end)}p===-1||d===-1||(u.offsets[t]=p,u.counts[t]=d-p+1)}}}onBatchTableCreated(e){this._batchTable=e}createLayerCommands(e,t){const r=Cesium.RenderState.fromCache({id:"line",blending:Cesium.BlendingState.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},cull:{enabled:!0},colorMask:{red:!0,green:!0,blue:!0,alpha:!0}}),i=this.tile.tileId;function s(o,a){return o={...o},o.tileIdTexture=function(){return t.tileIdTexture},o.tileId=function(){return i.color},o.dasharray=function(){return a.dasharray},o.dashLength=function(){return a.dashLength},o.arrayLength=function(){return a.dasharray.length},o}for(let o=0;o<this.layers.length;o++){const a=this.layers[o],l=a.commandList=[];for(let u=0;u<e.length;u++){const c=a.offsets[u],f=a.counts[u];if(typeof c!="number"||typeof f!="number")continue;const p=e[u],d=Cesium.DrawCommand.shallowClone(p);d.pass=Cesium.Pass.CESIUM_3D_TILE,d.uniformMap=s(d.uniformMap,a),d.renderState=r,d.offset=c,d.count=f,l.push(d)}a.state="done"}this.state="done"}update(e,t){if(this.geometryInstances){if(super.update(e,t),!this.primitive&&this.geometryInstances.length&&this.createPrimitive(),this.primitive&&this.state!=="done"&&this.state!=="error"){const r=e.commandList,i=e.commandList=[];try{this.primitive.update(e)}catch(s){this.geometryInstances=[],this.setState("error"),s.stack?console.trace(s.stack):console.error(s);return}i.length>0&&this.createLayerCommands(i,t),this.primitive._state===Cesium.PrimitiveState.FAILED&&this.setState("error"),e.commandList=r,this.geometryInstances=[]}this.primitive&&e.camera.pitch>-1.309&&Y("line图层:不支持透视,建议保持相机俯仰角(pitch)小于 -75 度")}}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),this._batchTable=null,this.geometryInstances=null,super.destroy()}isDestroyed(){return!1}}class Rs extends Ct{constructor(e,t,r){super(e,t,r),this.primitive=null,this.dasharray=[],this.dashLength=0}createPrimitve(e,t){const r=new Cesium.PolylineCollection,i=this.sourceFeatures,s=this.style,o=this.tile;function a(l,u,c){if(l.length<2)return;const f=l.map(p=>Cesium.Cartesian3.fromDegrees(p[0],p[1]));r.add({positions:f,width:u,material:Cesium.Material.fromType("Color",{color:s.convertColor(c)})})}for(const l of i){const u=l.toGeoJSON(o.x,o.y,o.z);if(!u.geometry)continue;const c=s.paint.getDataValue("line-width",o.z,l),f=s.paint.getDataValue("line-color",o.z,l),p=u.geometry.type,d=u.geometry.coordinates;if(p=="LineString")a(d,c,f);else if(p=="MultiLineString"||p=="Polygon")for(const h of d)a(h,c,f);else if(p=="MultiPolygon")for(const h of d)for(const y of h)a(y,c,f);else console.log("暂不支持几何类型:"+p)}this.primitive=r}update(e,t){super.update(e,t)}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),super.destroy()}}Tt("line",Rs,Ff);let Rr=null,qs=null;const kf=.1;class Pf extends xn{constructor(e,t){Rr===null&&(Rr=new Cesium.Cartesian3,qs=new Cesium.Cartesian3),super(e,t),this.labels=[],this.primitive=null,this.dotCutOff=.0035}isOccluded(e,t){const r=Cesium.Cartesian3.subtract(e,t,Rr);Cesium.Cartesian3.normalize(r,r);const i=Cesium.Cartesian3.normalize(t,qs);return Cesium.Cartesian3.dot(r,i)<this.dotCutOff}addLayer(e,t,r,i){const s=t.style,{tile:o,labels:a}=this,l=o.rectangle;function u(c,f,p,d,h,y,m,v,w){if(!Cesium.Rectangle.contains(l,Cesium.Cartographic.fromDegrees(c[0],c[1]))||!f)return;const g=new Cesium.Label({position:Cesium.Cartesian3.fromDegrees(c[0],c[1]),text:f,font:d+"px "+p,fillColor:h,style:y&&Cesium.LabelStyle.FILL_AND_OUTLINE,outlineWidth:y*d,outlineColor:m,disableDepthTestDistance:1/0,pixelOffset:new Cesium.Cartesian2(v[0]*d,v[1]*d),horizontalOrigin:w.horizontal,verticalOrigin:w.vertical});g._baseFillColor=g.fillColor.clone(),g._baseOutlineColor=g.outlineColor.clone(),g.vtAlpha=0,g.batchId=a.length,a.push(g),t.labels.push(g)}for(const c of e){const f=c.toGeoJSON(o.x,o.y,o.z);if(!f.geometry)continue;const p=c.properties,d=s.layout.getDataValue("icon-image",o.z,c),h=s.layout.getDataValue("text-field",o.z,c);let y=h;if(typeof y=="string")y=s.layout.resolveTokens(p,h);else if(y&&y.sections){for(const tt of y.sections)tt.text=s.layout.resolveTokens(p,tt.text);y=y.toString()}if(d){Y("symbol图层:不支持图标");continue}if(!y)continue;const m=s.layout.getDataValue("text-transform",o.z,c);m==="uppercase"?y=String(y).toUpperCase():m==="lowercase"&&(y=String(y).toLowerCase());const v=s.layout.getDataValue("text-max-width",o.z,c)*3,w=s.layout.getDataValue("text-rotation-alignment",o.z,c),g=s.layout.getDataValue("text-pitch-alignment",o.z,c);y.length>v&&Y("symbol图层: 不支持 text-max-width,无自动换行效果"),w==="map"&&Y("symbol图层:text-rotation-alignment 仅支持 viewport"),g==="map"&&Y("symbol图层:text-pitch-alignment 仅支持 viewport");const x=s.layout.getDataValue("text-font",o.z,c),b=s.layout.getDataValue("text-size",o.z,c),T=s.layout.getDataValue("text-anchor",o.z,c),_=Gs(T),I=s.layout.getDataValue("text-offset",o.z,c),k=s.convertColor(s.paint.getDataValue("text-color",o.z,c)),M=s.convertColor(s.paint.getDataValue("text-halo-color",o.z,c)),$=s.paint.getDataValue("text-halo-width",o.z,c);if(!b||!isFinite(b)||Number(b)<=0)continue;const W=f.geometry.type,ce=f.geometry.coordinates;W=="Point"?u(ce,y,x,b,k,$,M,I,_):W=="MultiPoint"?ce.forEach(tt=>{u(tt,y,x,b,k,$,M,I,_)}):Y("symbol图层:不支持符号沿线布局")}this.layers.push(t)}addLayerFromWorkerResult(e,t,r,i){const{placements:s}=e,{labels:o}=this,a=this.tile.rectangle;for(const l of s||[]){if(!Cesium.Rectangle.contains(a,Cesium.Cartographic.fromDegrees(l.coord[0],l.coord[1])))continue;const u=Cesium.Color.fromBytes(l.textColorBytes[0],l.textColorBytes[1],l.textColorBytes[2],l.textColorBytes[3]),c=Cesium.Color.fromBytes(l.outlineColorBytes[0],l.outlineColorBytes[1],l.outlineColorBytes[2],l.outlineColorBytes[3]),f=Gs(l.textAnchor),p=new Cesium.Label({position:Cesium.Cartesian3.fromDegrees(l.coord[0],l.coord[1]),text:l.text,font:l.textSize+"px "+l.font,fillColor:u,style:l.outlineWidth>0?Cesium.LabelStyle.FILL_AND_OUTLINE:Cesium.LabelStyle.FILL,outlineWidth:l.outlineWidth*l.textSize,outlineColor:c,disableDepthTestDistance:1/0,pixelOffset:new Cesium.Cartesian2((l.textOffset[0]||0)*l.textSize,(l.textOffset[1]||0)*l.textSize),horizontalOrigin:f.horizontal,verticalOrigin:f.vertical});p._baseFillColor=p.fillColor.clone(),p._baseOutlineColor=p.outlineColor.clone(),p.vtAlpha=0,p.batchId=o.length,o.push(p),t.labels.push(p)}this.layers.push(t)}createPrimitive(){const e=new Cesium.LabelCollection;for(let r=0;r<this.labels.length;r++)this.labels[r]=e.add(this.labels[r]);const t=this.layers;for(const r of t)for(let i=0;i<r.labels.length;i++)r.labels[i]=this.labels[r.labels[i].batchId];this.primitive=e}update(e,t){if(this.state==="none")if(!this.primitive&&this.labels?.length&&this.createPrimitive(),this.primitive){this.commandList.length=0;const r=e.commandList;e.commandList=this.commandList,this.primitive.update(e),e.commandList=r;for(const i of this.labels){const s=i._glyphs;if(s){let o=i.text,a=[],l=[],u=!1;for(let c=0;c<s.length;c++){const f=s[c],p=f.dimensions;p&&isFinite(p.width)&&isFinite(p.height)?(l.push(o[c]),a.push(f)):u=!0}u&&(i._glyphs=a,i.text=l.join(""))}}this.state==="none"&&r.length>0&&this.setState("done"),this.primitive._state===Cesium.PrimitiveState.FAILED&&this.setState("error")}else this.state==="none"&&this.labels.length===0&&this.setState("done")}render(e,t){if(this.state!=="done")return;const r=e.camera.positionWC,i=this.layers;for(const s of i)for(let o=0;o<s.labels.length;o++){const a=s.style,l=t.zoom;if(s.visibility==="none"||l<a.minzoom||l>=a.maxzoom)s.labels[o].show=!1;else{const u=s.labels[o];u._baseFillColor||(u._baseFillColor=u.fillColor.clone(),u._baseOutlineColor=u.outlineColor.clone(),u.vtAlpha==null&&(u.vtAlpha=u.vtPlaceable?1:0));const c=u.vtPlaceable?1:0;u.vtAlpha=Cesium.Math.lerp(u.vtAlpha??0,c,kf),u.vtAlpha<.001?(u.vtAlpha=0,u.show=!1):(u.show=!0,u.fillColor=u._baseFillColor.withAlpha(u._baseFillColor.alpha*u.vtAlpha),u.outlineColor=u._baseOutlineColor.withAlpha(u._baseOutlineColor.alpha*u.vtAlpha))}}for(const s of this.labels)s.show&&(s.show=!this.isOccluded(r,s.position));if(this.primitive){this.commandList.length=0;const s=e.commandList;e.commandList=this.commandList,this.primitive.update(e),e.commandList=s}super.render(e)}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),super.destroy()}isDestroyed(){return!1}}function Gs(n){let e=Cesium.HorizontalOrigin.CENTER,t=Cesium.VerticalOrigin.CENTER;switch(n){case"left":e=Cesium.HorizontalOrigin.LEFT;break;case"right":e=Cesium.HorizontalOrigin.RIGHT;break;case"top":t=Cesium.VerticalOrigin.TOP;break;case"bottom":t=Cesium.VerticalOrigin.BOTTOM;break;case"top-left":t=Cesium.VerticalOrigin.TOP,e=Cesium.HorizontalOrigin.LEFT;break;case"top-right":t=Cesium.VerticalOrigin.TOP,e=Cesium.HorizontalOrigin.RIGHT;break;case"bottom-left":t=Cesium.VerticalOrigin.BOTTOM,e=Cesium.HorizontalOrigin.LEFT;break;case"bottom-right":t=Cesium.VerticalOrigin.BOTTOM,e=Cesium.HorizontalOrigin.RIGHT;break}return{horizontal:e,vertical:t}}class Us extends Ct{constructor(e,t,r){super(e,t,r),this.labels=[]}update(e,t){super.update(e,t)}}Tt("symbol",Us,Pf);const Mf="cvt-gl-worker.js";O.BackgroundRenderLayer=Vs,O.DEFAULT_WORKER_FILENAME=Mf,O.FillRenderLayer=Bs,O.GeoJSONSource=Ai,O.ILayerVisualizer=xn,O.IRenderLayer=Ct,O.ISource=bn,O.LayerVisualizers=et,O.LineRenderLayer=Rs,O.RenderLayers=Qe,O.Sources=wn,O.StyleLayer=vs,O.StyleLayerProperties=kr,O.SymbolRenderLayer=Us,O.VectorSource=vi,O.VectorTileLOD=mn,O.VectorTileRenderList=bs,O.VectorTileset=Lf,O.registerRenderLayer=Tt,O.registerSource=Cn,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})}));
135
- //# sourceMappingURL=cvt-gl.min.js.map