@mesh3d/cesium-vectortile-gl 0.5.1 → 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.
- package/Source/layers/FillRenderLayer.js +5 -0
- package/Source/layers/visualizers/FillLayerVisualizer.js +215 -7
- package/Source/style/StyleLayer.js +1 -0
- package/logo.svg +46 -46
- package/package.json +1 -1
- package/dist/THIRD-PARTY-LICENSES.txt +0 -772
- package/dist/cvt-gl-worker.js +0 -9274
- package/dist/cvt-gl-worker.js.map +0 -1
- package/dist/cvt-gl.js +0 -13871
- package/dist/cvt-gl.js.map +0 -1
- package/dist/cvt-gl.min.js +0 -135
- package/dist/cvt-gl.min.js.map +0 -1
package/dist/cvt-gl.min.js
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
(function(V,P){typeof exports=="object"&&typeof module<"u"?P(exports):typeof define=="function"&&define.amd?define(["exports"],P):(V=typeof globalThis<"u"?globalThis:V||self,P(V.CVT={}))})(this,(function(V){"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 Ve{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(Hs,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}}Ve.types=["Unknown","Point","LineString","Polygon"];function Hs(n,e,t){n===1?e.id=t.readVarint():n===2?Js(t,e):n===3?e.type=t.readVarint():n===4&&(e._geometry=t.pos)}function Js(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=Ks(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 Ks(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 Qs{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(eo,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 Ve(this._pbf,t,this.extent,this._keys,this._values)}}function eo(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(to(t))}function to(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 no{constructor(e,t){this.layers=e.readFields(ro,{},t)}}function ro(n,e,t){if(n===3){const r=new Qs(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 Oe{_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 Oe{}class Tn extends _t{getValueFromBuffer(e){return this.dataBuffer[e]}}class _n extends _t{getValueFromBuffer(e){return this.dataBuffer[e]}}class Gr extends Oe{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 Oe{constructor(e,t,r){super(e,Int32Array.of(t),r)}getValueFromBuffer(e){return this.dataBuffer[0]}}class io{_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},A={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 so{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 U(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]=fo(n,e);return r}function oo(n,e,t){const r=new Float64Array(e);for(let i=0;i<e;i++)r[i]=ao(n,t);return r}function ao(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,lo(t,n,e))}function lo(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 uo(n){for(let e=0;e<n.length;e++){const t=n[e];n[e]=t>>>1^-(t&1)}}function co(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 Ne(n){return n>>1n^-(n&1n)}function fo(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 ho(n,e,t){return t?vo(n,e.runs,e.numRleValues):$r(n,e.runs,e.numRleValues)}function po(n,e,t){return t?bo(n,e.runs,e.numRleValues):jr(n,e.runs,e.numRleValues)}function yo(n,e,t){return t?wo(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 mo(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 go(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 xo(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 vo(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 bo(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 wo(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 Co(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 To(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 _o(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 Io(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 Lo(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 So(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 Eo(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 zo(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 Ao(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 Fo(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 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 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 Mo(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 Vo(n,e,t,r){const i=e;return t?No(r,n,i.runs):Oo(r,n,i.runs)}function Oo(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 No(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 Do(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 Bo(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=Ne(l);for(let c=0;c<a;c++)s+=u,r[i++]=s}return r}function Ro(n){return n[1]}function qo(n){return Ie(n[1])}function Go(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 Uo(n){return n[1]}function $o(n){return Ne(n[1])}function jo(n){if(n.length==2){const r=Ne(n[1]);return[r,r]}const e=Ne(n[2]),t=Ne(n[3]);return[e,t]}var $;(function(n){n.PRESENT="PRESENT",n.DATA="DATA",n.OFFSET="OFFSET",n.LENGTH="LENGTH"})($||($={}));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 X(n,e){const t=Yo(n,e);return t.logicalLevelTechnique1===S.MORTON?Zo(t,n,e):(S.RLE===t.logicalLevelTechnique1||S.RLE===t.logicalLevelTechnique2)&&me.NONE!==t.physicalLevelTechnique?Xo(t,n,e):t}function Zo(n,e,t){const r=U(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 Xo(n,e,t){const r=U(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 Yo(n,e){const t=n[e.get()],r=Object.values($)[t>>4];let i=null;switch(r){case $.DATA:i=new En(Object.values(ae)[t&15]);break;case $.OFFSET:i=new En(null,Object.values(Le)[t&15]);break;case $.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=U(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 R;(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"})(R||(R={}));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 Y(n,e,t,r,i){const s=Et(n,e,t);return Ho(s,t,r)}function be(n,e,t){const r=Et(n,e,t);return Qo(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 U(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 zn(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?qo(i):Ro(i)}function Yr(n,e,t){const r=Et(n,e,t);return Go(r)}function Wr(n,e,t){const r=St(n,e,t.numValues);return jo(r)}function Hr(n,e,t,r){const i=St(n,e,t.numValues);return Jo(i,t,r)}function Wo(n,e,t,r){const i=oo(n,t.numValues,e);return Ko(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?Ne(s):s}return r?$o(i):Uo(i)}function Ho(n,e,t,r){switch(e.logicalLevelTechnique1){case S.DELTA:if(e.logicalLevelTechnique2===S.RLE){const i=e;return Do(n,i.runs,i.numRleValues)}return mo(n),n;case S.RLE:return ho(n,e,t);case S.MORTON:return Sn(n),n;case S.COMPONENTWISE_DELTA:return Xr(n),n;case S.NONE:return t&&uo(n),n;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}function Jo(n,e,t){switch(e.logicalLevelTechnique1){case S.DELTA:if(e.logicalLevelTechnique2===S.RLE){const r=e;return Bo(n,r.runs,r.numRleValues)}return go(n),n;case S.RLE:return po(n,e,t);case S.NONE:return t&&co(n),n;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}function Ko(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 xo(n),n;case S.RLE:return yo(n,e,t);case S.NONE:return n;default:throw new Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}function Qo(n,e){if(e.logicalLevelTechnique1===S.DELTA&&e.logicalLevelTechnique2===S.NONE)return Io(n);if(e.logicalLevelTechnique1===S.RLE&&e.logicalLevelTechnique2===S.NONE){const t=e;return So(n,t.runs,t.numRleValues)}if(e.logicalLevelTechnique1===S.NONE&&e.logicalLevelTechnique2===S.NONE){Co(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=Lo(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 An(n,e,t,r,i){const s=t.physicalLevelTechnique===me.FAST_PFOR?Ur(n,t.numValues,t.byteLength):U(n,e,t.numValues);return ta(s,t,r,i)}function ea(n,e,t,r,i){const s=St(n,e,t.numValues);return na(s,t,r,i)}function ta(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 To(r,n);case S.RLE:return ko(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?zo(r,n):Eo(r,n),n;default:throw new Error("The specified Logical level technique is not supported")}}function na(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 _o(r,n);case S.RLE:return Vo(n,e,t,r);case S.NONE:return n=t?Fo(r,n):Ao(r,n),n;default:throw new Error("The specified Logical level technique is not supported")}}function zt(n,e,t,r){const i=n.logicalLevelTechnique1;if(i===S.RLE)return n.runs===1?R.CONST:R.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 R.FLAT;if(a===1)return R.SEQUENCE;if(a===2){const u=r.get();let c;if(n.physicalLevelTechnique===me.VARINT)c=U(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 R.SEQUENCE}}return n.numValues===1?R.CONST:R.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 De{_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 q;(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"})(q||(q={}));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 ra{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 ra;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===q.POINT){if(!h||h.length===0){const x=m[a++],g=m[a++],b=new P(x,g);e[s++]=o.createPoint(b)}else if(n.vertexBufferType===ee.VEC_2){const x=h[l++]*2,g=m[x],b=m[x+1],T=new P(g,b);e[s++]=o.createPoint(T)}else{const x=h[l++],g=m[x],b=Fn(g,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===q.MULTIPOINT){const x=f[i]-f[i-1];i++;const g=new Array(x);if(!h||h.length===0){for(let b=0;b<x;b++){const T=m[a++],_=m[a++];g[b]=new P(T,_)}e[s++]=o.createMultiPoint(g)}else{for(let b=0;b<x;b++){const T=h[l++]*2,_=m[T],I=m[T+1];g[b]=new P(_,I)}e[s++]=o.createMultiPoint(g)}}else if(w===q.LINESTRING){let x=0;y?(x=d[r]-d[r-1],r++):x=p[t]-p[t-1],t++;let g;!h||h.length===0?(g=kn(m,a,x,!1),a+=x*2):(g=n.vertexBufferType===ee.VEC_2?Pn(m,h,l,x,!1):Mn(m,h,l,x,!1,u),l+=x),e[s++]=o.createLineString(g),f&&i++}else if(w===q.POLYGON){const x=p[t]-p[t-1];t++;const g=new Array(x-1);let b=d[r]-d[r-1];if(r++,!h||h.length===0){const T=At(m,a,b);a+=b*2;for(let _=0;_<g.length;_++)b=d[r]-d[r-1],r++,g[_]=At(m,a,b),a+=b*2;e[s++]=o.createPolygon(T,g)}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;_<g.length;_++)b=d[r]-d[r-1],r++,g[_]=n.vertexBufferType===ee.VEC_2?Ft(m,h,l,b):kt(m,h,l,b,o,u),l+=b;e[s++]=o.createPolygon(T,g)}f&&i++}else if(w===q.MULTILINESTRING){const x=f[i]-f[i-1];i++;const g=new Array(x);if(!h||h.length===0){for(let b=0;b<x;b++){let T=0;y?(T=d[r]-d[r-1],r++):T=p[t]-p[t-1],t++,g[b]=kn(m,a,T,!1),a+=T*2}e[s++]=o.createMultiLineString(g)}else{for(let b=0;b<x;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);g[b]=_,l+=T}e[s++]=o.createMultiLineString(g)}}else if(w===q.MULTIPOLYGON){const x=f[i]-f[i-1];i++;const g=new Array(x);let b=0;if(!h||h.length===0){for(let T=0;T<x;T++){const _=p[t]-p[t-1];t++;const I=new Array(_-1);b=d[r]-d[r-1],r++;const k=At(m,a,b);a+=b*2;for(let M=0;M<I.length;M++){const j=d[r]-d[r-1];r++,I[M]=At(m,a,j),a+=j*2}g[T]=o.createPolygon(k,I)}e[s++]=o.createMultiPolygon(g)}else{for(let T=0;T<x;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;g[T]=o.createPolygon(k,I)}e[s++]=o.createMultiPolygon(g)}}else throw new Error("The specified geometry type is currently not supported.")}return e}function At(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 ia(n,e,t,r,i){return new ii(n,e,ee.VEC_2,t,r,i)}function sa(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===q.POLYGON||this._geometryType===q.MULTIPOLYGON}containsSingleGeometryType(){return!0}}function oa(n,e,t,r){return new si(ee.VEC_2,n,e,t,r)}function aa(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)===q.POLYGON||this.geometryType(e)===q.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 q.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++],x=this._vertexBuffer[o++];m.push(new P(w,x))}m.length>0&&m.push(m[0]),d.push(m)}e[c]=d,s&&u++}break;case q.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 x=0;x<v;x++){const g=this._vertexBuffer[o++],b=this._vertexBuffer[o++];w.push(new P(g,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 la(n,e,t,r,i,s)}class la 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 ua(n,e,t,r,i)}class ua 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 ca(n,e,t,r,i){const s=X(n,t),o=zt(s,r,n,t);let a=null,l=null,u=null,c=null,f=null,p=null,d=null,h=null;if(o===R.CONST){const m=zn(n,t,s,!1);for(let v=0;v<e-1;v++){const w=X(n,t);switch(w.physicalStreamType){case $.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 $.OFFSET:{switch(w.logicalStreamType.offsetType){case Le.VERTEX:c=Y(n,t,w,!1);break;case Le.INDEX:h=Y(n,t,w,!1);break}break}case $.DATA:{if(ae.VERTEX===w.logicalStreamType.dictionaryType)f=Y(n,t,w,!0);else{const x=w;p={numBits:x.numBits,coordinateShift:x.coordinateShift},f=Y(n,t,w,!1)}break}}}if(h!==null){if(a!=null||l!=null){const v=new De(a,l,u);return ai(r,m,d,h,f,v)}return ai(r,m,d,h,f)}return p===null?ia(r,m,new De(a,l,u),c,f):sa(r,m,new De(a,l,u),c,f,p)}const y=Y(n,t,s,!1);for(let m=0;m<e-1;m++){const v=X(n,t);switch(v.physicalStreamType){case $.LENGTH:switch(v.logicalStreamType.lengthType){case Q.GEOMETRIES:a=Y(n,t,v,!1);break;case Q.PARTS:l=Y(n,t,v,!1);break;case Q.RINGS:u=Y(n,t,v,!1);break;case Q.TRIANGLES:d=be(n,t,v)}break;case $.OFFSET:switch(v.logicalStreamType.offsetType){case Le.VERTEX:c=Y(n,t,v,!1);break;case Le.INDEX:h=Y(n,t,v,!1);break}break;case $.DATA:if(ae.VERTEX===v.logicalStreamType.dictionaryType)f=Y(n,t,v,!0);else{const w=v;p={numBits:w.numBits,coordinateShift:w.coordinateShift},f=Y(n,t,v,!1)}break}}return h!==null&&l===null?li(y,d,h,f):(a!==null?(a=Vn(y,a,2),l!==null&&u!==null?(l=ui(y,a,l,!1),u=ha(y,a,l,u)):l!==null&&(l=fa(y,a,l))):l!==null&&u!==null?(l=Vn(y,l,1),u=ui(y,l,u,!0)):l!==null&&(l=Vn(y,l,0)),h!==null?li(y,d,h,f,new De(a,l,u)):p===null?oa(y,new De(a,l,u),c,f):aa(y,new De(a,l,u),c,f,p))}function Vn(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 fa(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 ha(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 pa extends Oe{dataVector;constructor(e,t,r){super(e,t.getBuffer(),r),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}}class da extends _t{getValueFromBuffer(e){return this.dataBuffer[e]}}class ci extends Oe{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 ya(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 ma(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 ga(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 xa(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 va(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 ba=12,wa=new TextDecoder;function On(n,e,t){return t-e>=ba?wa.decode(n.subarray(e,t)):Ca(n,e,t)}function Ca(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 Nn extends Oe{offsetBuffer;constructor(e,t,r,i){super(e,r,i),this.offsetBuffer=t}}class hi extends Nn{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 On(this.dataBuffer,t,r)}}class Be extends Nn{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 On(this.dataBuffer,r,i)}}function Ta(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 Nn{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=Ta(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const t=this.indexBuffer[e],r=this.offsetBuffer[t],i=this.offsetBuffer[t+1];return On(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 _a="default",Ia=":";function La(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=X(e,t);if(h.byteLength!==0)switch(h.physicalStreamType){case $.PRESENT:{const y=nt(e,h.numValues,t);c=new le(y,h.numValues);break}case $.OFFSET:{o=i!=null||c!=null?An(e,t,h,!1,i??c):Y(e,t,h,!1);break}case $.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 $.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 Sa(n,u,o,s,a,l,i??c)??Ea(n,a,o,s,i??c)??za(n,f,p,o,i??c)}function Sa(n,e,t,r,i,s,o){return e?new pi(n,t,r,i,s,e,o):null}function Ea(n,e,t,r,i){return e?i?new Be(n,t,r,e,i):new Be(n,t,r,e):null}function za(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 Aa(n,e,t,r,i){let s=null,o=null,a=null,l=null,u=!1;for(;!u;){const d=X(n,e);switch(d.physicalStreamType){case $.LENGTH:Q.DICTIONARY===d.logicalStreamType.lengthType?s=be(n,e,d):a=be(n,e,d);break;case $.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=U(n,e,1)[0];if(h==0)continue;const y=`${t.name}${d.name===_a?"":Ia+d.name}`;if(h!==2||d.type!=="scalarField"||d.scalarField.physicalType!==A.STRING)throw new Error("Currently only optional string fields are implemented for a struct.");const m=X(n,e),v=nt(n,m.numValues,e),w=X(n,e),b=w.decompressedCount!==r?An(n,e,w,!1,new le(v,m.numValues)):Y(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 Fa(n,e,t,r,i,s){return t.type==="scalarType"?ka(r,n,e,i,t.scalarType,t):r!=1?null:Aa(n,e,t,i)}function ka(n,e,t,r,i,s){let o=null,a=0;if(n===0)return null;if(s.nullable){const c=X(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 A.UINT_32:case A.INT_32:return Na(e,t,s,i,l);case A.STRING:const c=s.nullable?n-1:n;return La(s.name,e,t,c,o);case A.BOOLEAN:return Pa(e,t,s,r,l);case A.UINT_64:case A.INT_64:return Oa(e,t,s,l,i);case A.FLOAT:return Ma(e,t,s,l);case A.DOUBLE:return Va(e,t,s,l);default:throw new Error(`The specified data type for the field is currently not supported: ${i}`)}}function Pa(n,e,t,r,i){const s=X(n,e),o=s.numValues,a=e.get(),l=rt(i)?ya(n,o,e,i):nt(n,o,e);e.set(a+s.byteLength);const u=new le(l,o);return new pa(t.name,u,i)}function Ma(n,e,t,r){const i=X(n,e),s=rt(r)?xa(n,e,r,i.numValues):ma(n,e,i.numValues);return new da(t.name,s,r)}function Va(n,e,t,r){const i=X(n,e),s=rt(r)?va(n,e,r,i.numValues):ga(n,e,i.numValues);return new _n(t.name,s,r)}function Oa(n,e,t,r,i){const s=X(n,e),o=zt(s,r,n,e),a=i.physicalType===A.INT_64;if(o===R.FLAT){const l=rt(r)?ea(n,e,s,a,r):Hr(n,e,s,a);return new Kr(t.name,l,r)}else if(o===R.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 Na(n,e,t,r,i){const s=X(n,e),o=zt(s,i,n,e),a=r.physicalType===A.INT_32;if(o===R.FLAT){const l=rt(i)?An(n,e,s,a,i):Y(n,e,s,a);return new Tn(t.name,l,i)}else if(o===R.SEQUENCE){const l=Yr(n,e,s);return new In(t.name,l[0],l[1],s.numRleValues)}else{const l=zn(n,e,s,a);return new Ln(t.name,l,i)}}function rt(n){return n instanceof le}function Da(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?A.UINT_64:A.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 Ga(n)}}function Ba(n){return n>=10}function Ra(n){return n===30}function qa(n){if(n.name==="id")return!1;if(n.type==="scalarType"){const e=n.scalarType;if(e.type==="physicalType")switch(e.physicalType){case A.BOOLEAN:case A.INT_8:case A.UINT_8:case A.INT_32:case A.UINT_32:case A.INT_64:case A.UINT_64:case A.FLOAT:case A.DOUBLE:return!1;case A.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 Ga(n){let e=null;switch(n){case 10:case 11:e=A.BOOLEAN;break;case 12:case 13:e=A.INT_8;break;case 14:case 15:e=A.UINT_8;break;case 16:case 17:e=A.INT_32;break;case 18:case 19:e=A.UINT_32;break;case 20:case 21:e=A.INT_64;break;case 22:case 23:e=A.UINT_64;break;case 24:case 25:e=A.FLOAT;break;case 26:case 27:e=A.DOUBLE;break;case 28:case 29:e=A.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 Ua=new TextDecoder;function di(n,e){const t=U(n,e,1)[0];if(t===0)return"";const r=e.get(),i=r+t,s=n.subarray(r,i);return e.add(t),Ua.decode(s)}function yi(n,e){const t=U(n,e,1)[0]>>>0,r=(t&4)!==0,i=(t&2)!==0,s=U(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=U(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 $a(n,e){const t=U(n,e,1)[0]>>>0,r=Da(t);if(!r)throw new Error(`Unsupported column type code: ${t}`);if(Ba(t)?r.name=di(n,e):t>=0&&t<=3?r.name="id":t===4&&(r.name="geometry"),Ra(t)){const i=U(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 ja(n,e){const t={};t.featureTables=[];const r={};r.name=di(n,e);const i=U(n,e,1)[0]>>>0,s=U(n,e,1)[0]>>>0;r.columns=new Array(s);for(let o=0;o<s;o++)r.columns[o]=$a(n,e);return t.featureTables.push(r),[t,i]}const Za="id",Xa="geometry";function Ya(n,e,t=!0){const r=new so(0),i=[];for(;r.get()<n.length;){const s=U(n,r,1)[0]>>>0,a=r.get()+s;if(a>n.length)throw new Error(`Block overruns tile: ${a} > ${n.length}`);if(U(n,r,1)[0]>>>0!==1){r.set(a);continue}const u=ja(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 x=w.name;if(x===Za){let g=null;if(w.nullable){const T=X(n,r),_=r.get(),I=nt(n,T.numValues,r);r.set(_+T.byteLength),g=new le(I,T.numValues)}const b=X(n,r);m=b.decompressedCount,d=Wa(n,w,r,x,b,g??m,t)}else if(x===Xa){const g=U(n,r,1)[0];if(m===0){const b=r.get();m=X(n,r).decompressedCount,r.set(b)}h=ca(n,g,r,m)}else{const b=qa(w)?U(n,r,1)[0]:1;if(b===0&&w.type==="scalarType")continue;const T=Fa(n,r,w,b,m);if(T)if(Array.isArray(T))for(const _ of T)y.push(_);else y.push(T)}}const v=new io(p.name,h,d,y,f);i.push(v),r.set(a)}return i}function Wa(n,e,t,r,i,s,o=!1){const a=e.scalarType.physicalType,l=zt(i,s,n,t);if(a===A.UINT_32)switch(l){case R.FLAT:{const u=Y(n,t,i,!1);return new Tn(r,u,s)}case R.SEQUENCE:{const u=Yr(n,t,i);return new In(r,u[0],u[1],i.numRleValues)}case R.CONST:{const u=zn(n,t,i,!1);return new Ln(r,u,s)}}else switch(l){case R.FLAT:{if(o){const c=Wo(n,t,i,!1);return new _n(r,c,s)}const u=Hr(n,t,i,!1);return new Kr(r,u,s)}case R.SEQUENCE:{const u=Wr(n,t,i);return new Qr(r,u[0],u[1],i.numRleValues)}case R.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 Ha{constructor(e,t){switch(this._featureData=e,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case q.POINT:case q.MULTIPOINT:this.type=1;break;case q.LINESTRING:case q.MULTILINESTRING:this.type=2;break;case q.POLYGON:case q.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 Ja{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 Ha(this.features[e],this.extent)}}class Ka{constructor(e){this.layers={};const t=Ya(new Uint8Array(e));this.layers=t.reduce((r,i)=>({...r,[i.name]:new Ja(i)}),{})}}const Dn=65536*65536,mi=1/Dn,Qa=12,gi=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),Bn=0,Pt=1,it=2,Mt=5;class el{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)*Dn;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Dn;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,tl(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>=Qa&&gi?gi.decode(this.buf.subarray(t,e)):dl(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){nl(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=yl(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,sl,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,ol,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,ul,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,al,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,ll,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,cl,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,fl,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,hl,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,pl,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 tl(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 nl(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),rl(t,r,e),il(r,e)}function rl(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 il(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 sl(n,e){for(let t=0;t<n.length;t++)e.writeVarint(n[t])}function ol(n,e){for(let t=0;t<n.length;t++)e.writeSVarint(n[t])}function al(n,e){for(let t=0;t<n.length;t++)e.writeFloat(n[t])}function ll(n,e){for(let t=0;t<n.length;t++)e.writeDouble(n[t])}function ul(n,e){for(let t=0;t<n.length;t++)e.writeBoolean(n[t])}function cl(n,e){for(let t=0;t<n.length;t++)e.writeFixed32(n[t])}function fl(n,e){for(let t=0;t<n.length;t++)e.writeSFixed32(n[t])}function hl(n,e){for(let t=0;t<n.length;t++)e.writeFixed64(n[t])}function pl(n,e){for(let t=0;t<n.length;t++)e.writeSFixed64(n[t])}function dl(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 yl(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 Ka(o):new no(new el(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=ml(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 ml(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")Vt(i,t);else if(e==="Polygon")Vt(i,t[0]);else if(e==="MultiLineString")for(const s of t)Vt(i,s);else if(e==="MultiPolygon")for(const s of t)Vt(i,s[0]);return i}function Vt(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 gl(n,e){const t=[];if(n.type==="FeatureCollection")for(let r=0;r<n.features.length;r++)Ot(t,n.features[r],e,r);else n.type==="Feature"?Ot(t,n,e):Ot(t,{geometry:n},e);return t}function Ot(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)Ot(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")xl(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 xl(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?vl:bl;let u=n.start,c,f;for(let v=0;v<n.length-3;v+=3){const w=n[v],x=n[v+1],g=n[v+2],b=n[v+3],T=n[v+4],_=i===0?w:x,I=i===0?b:T;let k=!1;o&&(c=Math.sqrt(Math.pow(w-b,2)+Math.pow(x-T,2))),_<t?I>t&&(f=l(a,w,x,b,T,t),o&&(a.start=u+c*f)):_>r?I<r&&(f=l(a,w,x,b,T,r),o&&(a.start=u+c*f)):qe(a,w,x,g),I<t&&_>=t&&(f=l(a,w,x,b,T,t),k=!0),I>r&&_<=r&&(f=l(a,w,x,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 vl(n,e,t,r,i,s){const o=(s-e)/(r-e);return qe(n,s,t+(i-t)*o,1),o}function bl(n,e,t,r,i,s){const o=(s-t)/(i-t);return qe(n,e+(r-e)*o,s,1),o}function wl(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 Cl(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)Tl(o,a,s,i);return o}function Tl(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&&_l(a,s),n.push(a)}function _l(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 Il={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Ll{constructor(e,t){t=this.options=Sl(Object.create(Il),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=gl(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=wl(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]=Cl(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,x=null,g=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),x=ge(T,f,i+y,i+v,1,d.minY,d.maxY,u),T=null),_&&(g=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(x||[],t+1,r*2,i*2+1),l.push(g||[],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 Sl(n,e){for(const t in e)n[t]=e[t];return n}function El(n,e){return new Ll(n,e)}class zl{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 Al{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 zl(this.features[e],this.extent)}}const te=8192;class zi 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 El(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 Al(i.features,{extent:te}):void 0}catch(i){this.errorEvent.raiseEvent(i)}}}Cn("geojson",zi);var Fl=8,kl={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"}},Pl={"*":{type:"source"}},Ml=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],Vl={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:"*"}},Ol={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:"*"}},Nl={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:"*"}},Dl={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"}},Bl={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"}}},Rl={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"}}},ql={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"}},Gl=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],Ul={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},$l={"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"}},jl={"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"}},Zl={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},Xl={"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"}},Yl={"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"}},Wl={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},Hl={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},Jl={type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},Kl={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},Ql={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},eu={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},tu={type:"array",value:"expression_name",minimum:1},nu={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}},ru={"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}},iu={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},su={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},ou=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],au={"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"}},lu={"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"}},uu={"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"}},cu={"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"}},fu={"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"}},hu={"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"}},pu={"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"}},du={"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"}},yu={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},mu={"*":{type:"string"}},gu={type:"array",value:"interpolation_name",minimum:1},xu={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"}]}}}},Ai={$version:Fl,$root:kl,sources:Pl,source:Ml,source_vector:Vl,source_raster:Ol,source_raster_dem:Nl,source_geojson:Dl,source_video:Bl,source_image:Rl,layer:ql,layout:Gl,layout_background:Ul,layout_fill:$l,layout_circle:jl,layout_heatmap:Zl,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:Xl,layout_symbol:Yl,layout_raster:Wl,layout_hillshade:Hl,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:Jl,filter_operator:Kl,geometry_type:Ql,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:eu,expression:tu,light:nu,sky:ru,terrain:iu,projection:su,paint:ou,paint_fill:au,"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:lu,paint_circle:uu,paint_heatmap:cu,paint_symbol:fu,paint_raster:hu,paint_hillshade:pu,"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:du,transition:yu,"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:mu,interpolation:gu,interpolation_name:xu};function Fi(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 Nt={kind:"null"},C={kind:"number"},z={kind:"string"},E={kind:"boolean"},he={kind:"color"},Dt={kind:"projectionDefinition"},Se={kind:"object"},L={kind:"value"},vu={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 O(n){if(n.kind==="array"){const e=O(n.itemType);return typeof n.N=="number"?`array<${e}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${e}>`}else return n.kind}const bu=[Nt,C,z,E,he,Dt,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 bu)if(!lt(t,e))return null}}return`Expected ${O(n)} but found ${O(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 ki=.96422,Pi=1,Mi=.82521,Vi=4/29,Ge=6/29,Oi=3*Ge*Ge,wu=Ge*Ge*Ge,Cu=Math.PI/180,Tu=180/Math.PI;function Ni(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)/Pi);n===e&&e===t?i=s=o:(i=Hn((.4360747*n+.3850649*e+.1430804*t)/ki),s=Hn((.0139322*n+.0971045*e+.7141733*t)/Mi));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>wu?Math.pow(n,1/3):n/Oi+Vi}function Bi([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=Pi*Kn(i),s=ki*Kn(s),o=Mi*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-Vi)}function _u(n){const[e,t,r,i]=Di(n),s=Math.sqrt(t*t+r*r);return[Math.round(s*1e4)?Ni(Math.atan2(r,t)*Tu):NaN,s,e,i]}function Iu([n,e,t,r]){return n=isNaN(n)?0:n*Cu,Bi([t,Math.cos(n)*e,Math.sin(n)*e,r])}function Lu([n,e,t,r]){n=Ni(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 Su=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Ri(n,e){return Su(n,e)?n[e]:void 0}function Eu(n){if(n=n.toLowerCase().trim(),n==="transparent")return[0,0,0,0];const e=Ri(zu,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 x=[l,f,h].join(""),g=x==="%%%"?100:x===""?255:0;if(g){const b=[Ue(+a/g,0,1),Ue(+c/g,0,1),Ue(+d/g,0,1),m?qi(+m,v):1];if(Gi(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?qi(+f,p):1];if(Gi(h))return Lu(h)}}}function $t(n){return parseInt(n.padEnd(2,n),16)/255}function qi(n,e){return Ue(e?n/100:n,0,1)}function Ue(n,e,t){return Math.min(Math.max(e,n),t)}function Gi(n){return!n.some(Number.isNaN)}const zu={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 Au(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=Eu(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",_u(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 x=u-s;u>s&&x>180?x-=360:u<s&&s-u>180&&(x+=360),d=s+r*x}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]=Iu([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]=Bi($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 Fu=["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 Z{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Z)return e;if(typeof e=="string"){const r=F.parse(e);return r?new Z([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 Z(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 Z(s)}}class N extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const ku=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"||!ku.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 N(`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 N(`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 Ui(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 Z||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 G(n){if(n===null)return Nt;if(typeof n=="string")return z;if(typeof n=="boolean")return E;if(typeof n=="number")return C;if(n instanceof F)return he;if(n instanceof ie)return Dt;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 Z)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=G(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 Z||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=G(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:z,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,G(r))){if(t===this.args.length-1)throw new N(`Expected value to be of type ${O(this.type)}, but found ${O(G(r))} instead.`)}else return r}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const $i={"to-boolean":E,"to-color":he,"to-number":C,"to-string":z};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(!$i[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=$i[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=Ui(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 N(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 N(`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 N(`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=Z.parse(t);if(i)return i}throw new N(`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 N(`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 N(`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 Pu=["Unknown","Point","LineString","Polygon"];class ji{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"?Pu[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 ji;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 N(`Array index out of bounds: ${t} < 0.`);if(t>=r.length)throw new N(`Array index out of bounds: ${t} > ${r.length-1}.`);if(t!==Math.floor(t))throw new N(`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,z,C,Nt,L])?new nr(r,i):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${O(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 N(`Expected first argument to be of type boolean, string, number or null, but found ${O(G(t))} instead.`);if(!Ee(r,["string","array"]))throw new N(`Expected second argument to be of type array or string, but found ${O(G(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,z,C,Nt,L]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${O(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 N(`Expected first argument to be of type boolean, string, number or null, but found ${O(G(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 N(`Expected second argument to be of type array or string, but found ${O(G(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=G(h);else if(p.checkSubtype(r,G(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(G(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),z,L]))return t.error(`Expected first argument to be of type array or string, but found ${O(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 N(`Expected first argument to be of type array or string, but found ${O(G(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 N("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 Mu(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var sr,Zi;function Vu(){if(Zi)return sr;Zi=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 Ou=Vu(),Nu=Mu(Ou);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 Nu(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,Dt)&&!we(l,he)&&!we(l,qt)&&!we(l,Gt)&&!we(l,ot)&&!we(l,Ut)&&!we(l,ne(C))?t.error(`Type ${O(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 Z.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 Z.interpolate(c,f,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return F.interpolate(c,f,u,"lab");case"colorArray":return Z.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 Du={color:F.interpolate,number:Ce,padding:H.interpolate,numberArray:J.interpolate,colorArray:Z.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 Xi(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 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 Uu(n,e,t){return e<=t}function $u(n,e,t){return e>=t}function Yi(n,e,t,r){return r.compare(e,t)===0}function ju(n,e,t,r){return!Yi(n,e,t,r)}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 Yu(n,e,t,r){return r.compare(e,t)<=0}function Wu(n,e,t,r){return r.compare(e,t)>=0}function Ze(n,e,t){const r=n!=="=="&&n!=="!=";return class Ws{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(!Xi(a,l.type))return o.concat(1).error(`"${a}" comparisons are not supported for type '${O(l.type)}'.`);let u=o.parse(s[2],2,L);if(!u)return null;if(!Xi(a,u.type))return o.concat(2).error(`"${a}" comparisons are not supported for type '${O(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return o.error(`Cannot compare types '${O(l.type)}' and '${O(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 Ws(l,u,c)}evaluate(s){const o=this.lhs.evaluate(s),a=this.rhs.evaluate(s);if(r&&this.hasUntypedArgument){const l=G(o),u=G(a);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new N(`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=G(o),u=G(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 Hu=Ze("==",Bu,Yi),Ju=Ze("!=",Ru,ju),Ku=Ze("<",qu,Zu),Qu=Ze(">",Gu,Xu),ec=Ze("<=",Uu,Yu),tc=Ze(">=",$u,Wu);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,z),!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=z,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,z),!s))return null;let o=null;if(i.currency&&(o=t.parse(i.currency,1,z),!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(z)),!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"&&!Fu.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,z),!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 G(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,z);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 ${O(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 N(`Expected value to be of type string or array, but found ${O(G(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const ye=8192;function nc(n,e){const t=rc(n[0]),r=sc(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[ic(r),oc(i)]}function rc(n){return(180+n)/360}function ic(n){return n*360-180}function sc(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function oc(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 ac(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 lc(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 hc(s,i)===0?!1:!!(Hi(n,e,t,r)&&Hi(t,r,n,e))}function uc(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(lc(n,i[s],i[s+1]))return t;ac(n,i[s],i[s+1])&&(r=!r)}return r}function cc(n,e){for(const t of e)if(Xe(n,t))return!0;return!1}function Wi(n,e){for(const t of n)if(!Xe(t,e))return!1;for(let t=0;t<n.length-1;++t)if(uc(n[t],n[t+1],e))return!1;return!0}function fc(n,e){for(const t of e)if(Wi(n,t))return!0;return!1}function hc(n,e){return n[0]*e[1]-n[1]*e[0]}function Hi(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=nc(n[i][o],t);ht(e,a),s.push(a)}r.push(s)}return r}function Ji(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 Ki(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 pc(n){n[0]=n[1]=1/0,n[2]=n[3]=-1/0}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)for(const l of a){const u=[l.x+s[0],l.y+s[1]];Ki(u,e,t,i),o.push(u)}return o}function es(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){pc(e);for(const a of o)for(const l of a)Ki(l,e,t,i)}return o}function dc(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(!Xe(a,s))return!1}if(e.type==="MultiPolygon"){const s=Ji(e.coordinates,r,i),o=Qi(n.geometry(),t,r,i);if(!pt(t,r))return!1;for(const a of o)if(!cc(a,s))return!1}return!0}function yc(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=es(n.geometry(),t,r,i);if(!pt(t,r))return!1;for(const a of o)if(!Wi(a,s))return!1}if(e.type==="MultiPolygon"){const s=Ji(e.coordinates,r,i),o=es(n.geometry(),t,r,i);if(!pt(t,r))return!1;for(const a of o)if(!fc(a,s))return!1}return!0}class ze{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 ze(r,s)}}else if(r.type==="Feature"){const i=r.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new ze(r,r.geometry)}else if(r.type==="Polygon"||r.type==="MultiPolygon")return new ze(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 dc(e,this.geometries);if(e.geometryType()==="LineString")return yc(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class ts{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 mc(n,e){if(n.length<=1)return[n];const r=[];let i,s;for(const o of n){const a=gc(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 gc(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 xc=6378.137,ns=1/298.257223563,rs=ns*(2-ns),is=Math.PI/180;class pr{constructor(e){const t=is*xc*1e3,r=Math.cos(e*is),i=1/(1-rs*(1-r*r)),s=Math.sqrt(i);this.kx=t*s*r,this.ky=t*s*i*(1-rs)}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 ss(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 os(n){return n[0]!==-1/0&&n[1]!==-1/0&&n[2]!==1/0&&n[3]!==1/0}function vr(n,e,t){if(!os(n)||!os(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 Ae(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(Ae(n,[t,r],i),Ae(e,[t,r],i)),o=Math.min(Ae(t,[n,e],i),Ae(r,[n,e],i));return Math.min(s,o)}function vc(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 bc(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 wc(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,Ae(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 Cc(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 as(n,e){for(const t of n)for(const r of t)if(Xe(r,e,!0))return!0;return!1}function Tc(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(as(n,e))return 0}else if(as(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 ls(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 ts([[0,[0,n.length-1],[0,0]]],ss),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=Cc(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=wc(n[f],t,r);if(s=Math.min(s,p),s===0)return 0}}else{const f=mr(u,e);ls(o,s,r,n,a,f[0]),ls(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 ts([[0,[0,n.length-1],[0,t.length-1]]],ss);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=vc(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=Ae(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=Ae(n[y],h,i),o=Math.min(o,d),o===0)return o}else d=bc(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 _c(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 Ic(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 Lc(n,e){const t=n.geometry();if(t.length===0||t[0].length===0)return NaN;const r=mc(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,Tc(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 _c(e,this.geometries);if(e.geometryType()==="LineString")return Ic(e,this.geometries);if(e.geometryType()==="Polygon")return Lc(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:Ri(r,this.key)}eachChild(){}outputDefined(){return!1}}const Ye={"==":Hu,"!=":Ju,">":Qu,"<":Ku,">=":tc,"<=":ec,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:ze,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])=>Ec(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(O(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 us(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=Ui(e,t,r,s);if(o)throw new N(o);return new F(e/255,t/255,r/255,s,!1)}function cs(n,e){return n in e}function Cr(n,e){const t=e[n];return typeof t>"u"?null:t}function Sc(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:[vu,[z],(n,[e])=>{throw new N(e.evaluate(n))}],typeof:[z,[L],(n,[e])=>O(G(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],us],rgba:[he,[C,C,C,C],us],has:{type:E,overloads:[[[z],(n,[e])=>cs(e.evaluate(n),n.properties())],[[z,Se],(n,[e,t])=>cs(e.evaluate(n),t.evaluate(n))]]},get:{type:L,overloads:[[[z],(n,[e])=>Cr(e.evaluate(n),n.properties())],[[z,Se],(n,[e,t])=>Cr(e.evaluate(n),t.evaluate(n))]]},"feature-state":[L,[z],(n,[e])=>Cr(e.evaluate(n),n.featureState||{})],properties:[Se,[],n=>n.properties()],"geometry-type":[z,[],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,[z,L],(n,[e,t])=>n.properties()[e.value]===t.value],"filter-id-==":[E,[L],(n,[e])=>n.id()===e.value],"filter-type-==":[E,[z],(n,[e])=>n.geometryType()===e.value],"filter-<":[E,[z,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,[z,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,[z,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,[z,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(z)],(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,[z,ne(L)],(n,[e,t])=>t.value.indexOf(n.properties()[e.value])>=0],"filter-in-large":[E,[z,ne(L)],(n,[e,t])=>Sc(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,[z],(n,[e])=>{const t=n.globals&&n.globals.isSupportedScript;return t?t(e.evaluate(n)):!0}],upcase:[z,[z],(n,[e])=>e.evaluate(n).toUpperCase()],downcase:[z,[z],(n,[e])=>e.evaluate(n).toLowerCase()],concat:[z,ke(L),(n,e)=>e.map(t=>ct(t.evaluate(n))).join("")],"resolved-locale":[z,[Bt],(n,[e])=>e.evaluate(n).resolvedLocale()]});function Ec(n){return Array.isArray(n)?`(${n.map(O).join(", ")})`:`(${O(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 ze)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 ze||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 zc(n){return n["property-type"]==="data-driven"||n["property-type"]==="cross-faded-data-driven"}function Ac(n){return!!n.expression&&n.expression.parameters.indexOf("zoom")>-1}function fs(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 hs(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&G(n)===Se}function Fc(n){return n}function kc(n){switch(n.type){case"color":return F.parse;case"padding":return H.parse;case"numberArray":return J.parse;case"colorArray":return Z.parse;default:return null}}function Pc(n){switch(n){case"exponential":return ds;case"interval":return Vc;case"categorical":return Mc;case"identity":return Oc;default:throw new Error(`Unknown function type "${n}"`)}}function ps(n,e){const t=n.stops&&typeof n.stops[0][0]=="object",r=t||n.property!==void 0,i=t||!r,s=n.type||(fs(e)?"exponential":"interval"),o=kc(e);if(o&&(n=Fi({},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&&!Au(n.colorSpace))throw new Error(`Unknown color space: "${n.colorSpace}"`);const a=Pc(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,ps(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 ds({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 Mc(n,e,t,r,i){const s=typeof t===i?r[t]:void 0;return yt(s,n.default,e.default)}function Vc(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 ds(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=Nc(t,r,n.stops[s][0],n.stops[s+1][0]),a=n.stops[s][1],l=n.stops[s+1][1],u=Du[e.type]||Fc;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 Oc(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=Z.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 Nc(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 ji,this._defaultValue=t?qc(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 N(`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 ys(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in Ye}function zr(n,e,t){const r=new Zt(Ye,on,[],e?Rc(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 Dc(n){return n._styleExpression!==void 0}function ms(n,e,t){const r=zr(n,e,t);if(r.result==="error")return r;const i=r.value.expression,s=Tr(i);if(!s&&!zc(e))return We([new fe("","data expressions not supported")]);const o=Ir(i,["zoom"]);if(!o&&!Ac(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&&!fs(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,Fi(this,ps(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 Bc(n,e,t){if(hs(n))return new mt(n,e);if(ys(n)){const r=ms(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=Z.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 Rc(n){const e={color:he,string:z,number:C,enum:z,boolean:E,formatted:Rt,padding:qt,numberArray:Gt,colorArray:ot,projectionDefinition:Dt,resolvedImage:at,variableAnchorOffsetCollection:Ut};return n.type==="array"?ne(e[n.value]||L,n.length):e[n.type]}function qc(n){if(n.type==="color"&&hs(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 Z.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 Ar(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(!Ar(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Gc={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function gs(n,e){if(n==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Ar(n)||(n=fn(n));const t=zr(n,Gc,e);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));{const r=xs(n);return{filter:(i,s,o)=>t.value.evaluate(i,s,{},o),needGeometry:r,getGlobalStateRefs:()=>cn(t.value.expression)}}}function Uc(n,e){return n<e?-1:n>e?1:0}function xs(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(xs(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"?$c(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"?vs(n[1],n.slice(2)):e==="!in"?hn(vs(n[1],n.slice(2))):e==="has"?bs(n[1]):e==="!has"?hn(bs(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 $c(n){return["any"].concat(n.map(fn))}function vs(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(Uc)]]:["filter-in-small",n,["literal",e]]}}function bs(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function hn(n){return["!",n]}const ws={StyleExpression:Er,StylePropertyFunction:mt,ZoomConstantExpression:an,ZoomDependentExpression:ln,createExpression:zr,createPropertyExpression:ms,isExpression:ys,isExpressionFilter:Ar,isZoomExpression:Dc,normalizePropertyExpression:Bc};function jc(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var kr,Cs;function Zc(){if(Cs)return kr;Cs=1,kr=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))}},kr}var Xc=Zc();const Yc=jc(Xc);function Wc(n,e,t,r){const i=new Yc(n,e,t,r);return s=>i.solve(s)}Wc(.25,.1,.25,1);function Ts(n,e,t){return Math.min(t,Math.max(e,n))}const _s={};function B(n){_s[n]||(typeof console<"u"&&console.warn(n),_s[n]=!0)}class Pr{constructor(e,t={}){this.data=t,this.props=new Map,this.groupName=e;const r=Ai[e];for(const i in r)if(Object.hasOwnProperty.call(r,i)){const s=r[i],o=t[i],a=ws.normalizePropertyExpression(o===void 0?s.default:o,s);this.props.set(i,a)}}setProperty(e,t){const r=Ai[this.groupName];if(Object.hasOwnProperty.call(r,e)){const i=r[e];if(this.data[e]===t)return!1;const o=ws.normalizePropertyExpression(Cesium.defined(t)?t:i.default,i);return this.props.set(e,o),!0}else return B(`maplibre样式规范不支持属性:${this.groupName}.${e}`),!1}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 Is{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 Pr("paint_"+e.type,e.paint),this.layout=new Pr("layout_"+e.type,e.layout),e.filter&&(this.filter=gs(e.filter)),this.paintVersion=0}setLayoutProperty(e,t){return this.layout.setProperty(e,t)}setPaintProperty(e,t){const r=this.paint.setProperty(e,t);return r&&this.paintVersion++,r}setFilter(e){if(e){if(JSON.stringify(this.data.filter)!==JSON.stringify(e))return this.data.filter=e,this.filter=gs(e),!0}else{const t=Cesium.defined(this.filter);return this.filter=null,delete this.data.filter,t}return!1}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 Ls{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 Hc(n,e,t=2){const r=e&&e.length,i=r?e[0]*t:n.length;let s=Ss(n,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,u;if(r&&(s=tf(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 Ss(n,e,t,r,i){let s;if(i===pf(n,e,t,r)>0)for(let o=e;o<t;o+=r)s=Fs(o/r|0,n[o],n[o+1],s);else for(let o=t-r;o>=e;o-=r)s=Fs(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)||D(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&&af(n,r,i,s);let a=n;for(;n.prev!==n.next;){const l=n.prev,u=n.next;if(s?Kc(n,r,i,s):Jc(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=Qc(Pe(n),e),gt(n,e,t,r,i,s,2)):o===2&&ef(n,e,t,r,i,s):gt(Pe(n),e,t,r,i,s,1);break}}}function Jc(n){const e=n.prev,t=n,r=n.next;if(D(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)&&D(h.prev,h,h.next)>=0)return!1;h=h.next}return!0}function Kc(n,e,t,r){const i=n.prev,s=n,o=n.next;if(D(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=Mr(d,h,e,t,r),w=Mr(y,m,e,t,r);let x=n.prevZ,g=n.nextZ;for(;x&&x.z>=v&&g&&g.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)&&D(x.prev,x,x.next)>=0||(x=x.prevZ,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)&&D(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;x&&x.z>=v;){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)&&D(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;g&&g.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)&&D(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function Qc(n,e){let t=n;do{const r=t.prev,i=t.next.next;!Je(r,i)&&zs(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 ef(n,e,t,r,i,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&cf(o,a)){let l=As(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 tf(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=Ss(n,a,l,r,!1);u===u.next&&(u.steiner=!0),i.push(uf(u))}i.sort(nf);for(let s=0;s<i.length;s++)t=rf(i[s],t);return t}function nf(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 rf(n,e){const t=sf(n,e);if(!t)return e;const r=As(t,n);return Pe(r,r.next),Pe(t,t.next)}function sf(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&&Es(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&&of(o,t)))&&(o=t,c=f)}t=t.next}while(t!==a);return o}function of(n,e){return D(n.prev,n,e.prev)<0&&D(e.next,n,n.next)<0}function af(n,e,t,r){let i=n;do i.z===0&&(i.z=Mr(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,lf(i)}function lf(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 Mr(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 uf(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 Es(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)&&Es(n,e,t,r,i,s,o,a)}function cf(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!ff(n,e)&&(vt(n,e)&&vt(e,n)&&hf(n,e)&&(D(n.prev,n,e.prev)||D(n,e.prev,e))||Je(n,e)&&D(n.prev,n,n.next)>0&&D(e.prev,e,e.next)>0)}function D(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 zs(n,e,t,r){const i=dn(D(n,e,t)),s=dn(D(n,e,r)),o=dn(D(t,r,n)),a=dn(D(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 ff(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&&zs(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function vt(n,e){return D(n.prev,n,n.next)<0?D(n,e,n.next)>=0&&D(n,n.prev,e)>=0:D(n,e,n.prev)<0||D(n,n.next,e)<0}function hf(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 As(n,e){const t=Vr(n.i,n.x,n.y),r=Vr(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 Fs(n,e,t,r){const i=Vr(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 Vr(n,e,t){return{i:n,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function pf(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)}}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 ks={};function K(n,e,t={}){if(ks[n])throw new Error(`${n} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:n,writeable:!1}),ks[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,x=(s-u)/y,g=Math.min(w,x),b=Math.max(w,x);if(!v&&(g>=1||b<=0)||v&&(u<i||u>s)){f>=i&&f<=s&&o.push(r[(a+1)%3]);continue}if(!v&&g>0){const I=l+h*g,k=u+y*g;o.push(this._vertexToIndex(I,k))}const T=l+h*Math.max(g,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 x=Math.floor(Math.min(w,l)/this._granularityCellSize)+1,g=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,j=(c-a)/k,W=Math.min(M,j),ce=o+I*W;x=Math.floor(Math.min(ce,l)/this._granularityCellSize)+1,g=Math.ceil(Math.max(ce,l)/this._granularityCellSize)-1,b=l<ce}const _=f>0?c:u;if(b)for(let I=x;I<=g;I++){const k=I*this._granularityCellSize;e.push(this._vertexToIndex(k,_))}else for(let I=g;I>=x;I--){const k=I*this._granularityCellSize;e.push(this._vertexToIndex(k,_))}}_generateOutline(e){const t=[];for(const r of e){const i=Ps(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=Hc(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 Ps(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 x=y-d,g=m-h,b=Math.abs(x),T=Math.abs(g);let _=d,I=h;for(;;){const M=x>0?(Math.floor(_/o)+1)*o:(Math.ceil(_/o)-1)*o,j=g>0?(Math.floor(I/o)+1)*o:(Math.ceil(I/o)-1)*o,W=Math.abs(_-M),ce=Math.abs(I-j),tt=Math.abs(_-y),Vf=Math.abs(I-m),Xs=v?W/b:Number.POSITIVE_INFINITY,Ys=w?ce/T:Number.POSITIVE_INFINITY;if((tt<=W||!v)&&(Vf<=ce||!w))break;if(Xs<Ys&&v||!w){_=M,I=I+g*Xs;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{_=_+x*Ys,I=j;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 x=m-h,b=v-y,T=-x,_=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 x=e[l],g=e[o],b=e[a];x!==g&&x!==b&&g!==b&&t.push(b,g,x),o--,o<0&&(o=s-1)}else{const x=e[u],g=e[o],b=e[a];x!==g&&x!==b&&g!==b&&t.push(b,g,x),a++,a>=s&&(a=0)}if(l===u)break}}const Ms={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 Nr=null,Vs=0,Dr=null;function bf(n,e){return Dr===null&&(Dr=Cesium.TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap(e.ellipsoid,128,e.getNumberOfXTilesAtLevel(0))),Dr/(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(){Nr===null&&(Nr=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:Vs++,color:Cesium.Color.fromRgba(Vs-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||B("不支持图层类型"+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 x=0;x<w;x++){const g=v.feature(x);l.filter&&!l.filter.filter({zoom:this.z},g)||(g.toGeoJSON||(g.toGeoJSON=Ve.prototype.toGeoJSON),d.push(g))}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=Nr,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],x=h[m+1],g=h[m+2];if(o.push({key:v,x1:w-g,y1:x-g,x2:w+g,y2:x+g}),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 Os=100;let Ns=null,Ds=null;class _f{constructor(){Ns=new Cesium.Cartesian2,Ds=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*Os,s+2*Os,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,Ns);if(!m){y.vtPlaceable=!0;continue}const v=Cesium.Label.getScreenSpaceBoundingBox(y,m,Ds),w=v.x-h,x=v.y-h,g=w+v.width+h,b=x+v.height+h;if(a.hitTest(w,x,g,b,d,null))y.vtPlaceable=!1;else{const T={overlapMode:d};a.insert(T,w,x,g,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._styleLayerIndexMap=new Map,this._renderList=new Ls(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 Is(e.layers[o]),this._styleLayerIndexMap.set(e.layers[o].id,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&&B("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}}setLayoutProperty(e,t,r){const i=this._styleLayerIndexMap;if(!i.has(e))return B(`不存在图层:${e}`),!1;const s=i.get(e),a=this._styleLayers[s].setLayoutProperty(t,r);return a&&t!=="visibility"&&this._forceUpdate(),a}setPaintProperty(e,t,r){const i=this._styleLayerIndexMap;if(!i.has(e))return B(`不存在图层:${e}`),!1;const s=i.get(e);return this._styleLayers[s].setPaintProperty(t,r)}setFilter(e,t){const r=this._styleLayerIndexMap;if(!r.has(e))return B(`不存在图层:${e}`),!1;const i=r.get(e),o=this._styleLayers[i].setFilter(t);return o&&this._forceUpdate(),o}_forceUpdate(){for(const e of this._cacheTiles)e.unload();for(const e of this._tilesToRender)e.unload();for(const e of this._tilesToUpdate)e.unload();this._tilesToRender.length=0,this._tilesToUpdate.length=0}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",this.paintVersion=t.paintVersion}get id(){return this.style.id}get type(){return this.style.type}get paintNeedsUpdate(){return this.paintVersion!==this.style.paintVersion}set paintNeedsUpdate(e){e||(this.paintVersion=this.style.paintVersion)}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 Bs 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 B("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"){if(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}if(this.primitive&&this.paintNeedsUpdate){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);s.alpha*=o,this.primitive.appearance.material.uniforms.color=s,this.paintNeedsUpdate=!1}}}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),super.destroy()}}Tt("background",Bs);const Br=Math.pow(2,15-1)-1,Rs=-Br-1;function qs(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=Ts(a,Rs,Br),o.y=Ts(l,Rs,Br),(a<o.x||a>o.x+1||l<o.y||l>o.y+1)&&B("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return t}class zf 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=Ms.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=Ve.types[p.type],h=p.properties;if(d!=="Polygon")continue;if(s.paint.getDataValue("fill-pattern",o.z,p)){B("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),x=qs(p),g=qr(x);for(const b of g){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),t.features.push(_),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)}),x=Cesium.Cartographic.fromCartesian(w.boundingSphere.center);x.height=0;const g=Cesium.Cartographic.toCartesian(x,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:g,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 j=Cesium.Cartesian3.normalize(M,M);h[T*3]=j.x,h[T*3+1]=j.y,h[T*3+2]=j.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 x=Cesium.Cartographic.toCartesian(w,null,f),g=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:x,id:e.id,properties:e.properties})});r.push(g)}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;for(const t of this.layers)t._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){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}finally{e.commandList=r}i.length>0&&this.createLayerCommands(i,t),this.primitive._state===Cesium.PrimitiveState.FAILED&&this.setState("error"),this.geometryInstances=[]}this._batchTable&&this._batchTable._batchValuesDirty&&this._batchTable.update(e)}}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),this._batchTable=null,this.geometryInstances=null,super.destroy()}isDestroyed(){return!1}}class Gs extends Ct{update(e,t){if(this.paintNeedsUpdate){const r=this.style,i=this.tile,s=this._batchTable;for(const o of this.features){const a=r.convertColor(r.paint.getDataValue("fill-color",i.z,o)),l=r.paint.getDataValue("fill-opacity",i.z,o);o.fillColor=a,o.fillOpacity=l;const u=o.batchId,c=a.toBytes();c[3]=Math.floor(c[3]*l),s.setBatchedAttribute(u,0,{x:c[0],y:c[1],z:c[2],w:c[3]})}this.paintNeedsUpdate=!1}super.update(e,t)}}Tt("fill",Gs,zf);const Af=Ve.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=Ms.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&&B("line图层:line-dasharray 超过最大长度(8)")}function d(h,y,m,v,w,x){if(h.length<2)return;const g=a.length;f==0&&(t.firstBatchId=g),t.lastBatchId=g;const b={coordinates:h,featureId:f,lineColor:m,lineOpacity:v,lineWidth:y,properties:x,id:w,batchId:g};u.addFeature(b),t.features.push(b),f++}for(const h of e){const y=Ve.types[h.type];if(y==="Point"||y==="Unknown")continue;const m=h.properties,v=qs(h);for(let W=0;W<v.length;W++)v[W]=Ps(v[W],l);const w=Af.call({extent:te,type:h.type,properties:m,loadGeometry(){return v}},o.x,o.y,o.z);if(!w.geometry)continue;const x=h.id||m[c],g=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)){B("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"&&B("line图层:line-join 仅支持 miter 模式"),k!=="butt"&&B("line图层:line-cap 仅支持 butt 模式");const M=w.geometry.type,j=w.geometry.coordinates;if(M=="LineString")d(j,g,b,T,x,m);else if(M=="MultiLineString"||M=="Polygon")for(const W of j)d(W,g,b,T,x,m);else if(M=="MultiPolygon")for(const W of j)for(const ce of W)d(ce,g,b,T,x,m);else B("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 g=0;g<c.length;g+=3)y.push(new Cesium.Cartesian3(c[g],c[g+1],c[g+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),x=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(x)}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;for(const t of this.layers)t._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}finally{e.commandList=r}i.length>0&&this.createLayerCommands(i,t),this.primitive._state===Cesium.PrimitiveState.FAILED&&this.setState("error"),this.geometryInstances=[]}this.primitive&&e.camera.pitch>-1.309&&B("line图层:不支持透视,建议保持相机俯仰角(pitch)小于 -75 度"),this._batchTable&&this._batchTable._batchValuesDirty&&this._batchTable.update(e)}}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),this._batchTable=null,this.geometryInstances=null,super.destroy()}isDestroyed(){return!1}}class Us 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){if(this.paintNeedsUpdate){const r=this.style,i=this.tile,s=this._batchTable;for(const o of this.features){const a=r.paint.getDataValue("line-width",i.z,o),l=r.convertColor(r.paint.getDataValue("line-color",i.z,o)),u=r.paint.getDataValue("line-opacity",i.z,o);a!==o.lineWidth&&B("不支持动态修改 line 图层样式属性:line-width"),o.lineColor=l,o.lineOpacity=u,o.lineWidth=a;const c=o.batchId,f=l.toBytes();f[3]=Math.floor(f[3]*u),s.setBatchedAttribute(c,0,{x:f[0],y:f[1],z:f[2],w:f[3]})}this.paintNeedsUpdate=!1}super.update(e,t)}destroy(){this.primitive=this.primitive&&this.primitive.destroy(),super.destroy()}}Tt("line",Us,Ff);let Rr=null,$s=null;const kf=.1;class Pf extends xn{constructor(e,t){Rr===null&&(Rr=new Cesium.Cartesian3,$s=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,$s);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,x){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),t.features.push({text:f,font:p,textSize:d,textColor:h,outlineWidth:y,outlineColor:m,textOffset:v,textOrigin:w,properties:x})}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){B("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),x=s.layout.getDataValue("text-pitch-alignment",o.z,c);y.length>v&&B("symbol图层: 不支持 text-max-width,无自动换行效果"),w==="map"&&B("symbol图层:text-rotation-alignment 仅支持 viewport"),x==="map"&&B("symbol图层:text-pitch-alignment 仅支持 viewport");const g=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),_=js(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)),j=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,g,b,k,j,M,I,_,p):W=="MultiPoint"?ce.forEach(tt=>{u(tt,y,g,b,k,j,M,I,_,p)}):B("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=js(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 js(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 Zs extends Ct{constructor(e,t,r){super(e,t,r),this.labels=[]}update(e,t){if(this.paintNeedsUpdate){const r=this.style,i=this.tile;for(let s=0;s<this.features.length;s++){const o=this.features[s],a=this.labels[s],l=r.convertColor(r.paint.getDataValue("text-color",i.z,o)),u=r.convertColor(r.paint.getDataValue("text-halo-color",i.z,o)),c=r.paint.getDataValue("text-halo-width",i.z,o);o.textColor=l,o.outlineColor=u,o.outlineWidth=c,a.fillColor=l,a.style=c&&Cesium.LabelStyle.FILL_AND_OUTLINE,a.outlineWidth=c*o.textSize,a.outlineColor=u,a._baseFillColor=a.fillColor.clone(),a._baseOutlineColor=a.outlineColor.clone()}this.paintNeedsUpdate=!1}super.update(e,t)}}Tt("symbol",Zs,Pf);const Mf="cvt-gl-worker.js";V.BackgroundRenderLayer=Bs,V.DEFAULT_WORKER_FILENAME=Mf,V.FillRenderLayer=Gs,V.GeoJSONSource=zi,V.ILayerVisualizer=xn,V.IRenderLayer=Ct,V.ISource=bn,V.LayerVisualizers=et,V.LineRenderLayer=Us,V.RenderLayers=Qe,V.Sources=wn,V.StyleLayer=Is,V.StyleLayerProperties=Pr,V.SymbolRenderLayer=Zs,V.VectorSource=vi,V.VectorTileLOD=mn,V.VectorTileRenderList=Ls,V.VectorTileset=Lf,V.registerRenderLayer=Tt,V.registerSource=Cn,Object.defineProperty(V,Symbol.toStringTag,{value:"Module"})}));
|
|
135
|
-
//# sourceMappingURL=cvt-gl.min.js.map
|