isard 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/dist/basemap.worker.d.ts +7 -1
- package/dist/basemap.worker.js +2 -2
- package/dist/basemap.worker.js.map +8 -7
- package/dist/decoder.worker.js +4 -4
- package/dist/decoder.worker.js.map +6 -5
- package/dist/engine-loader.d.ts +1 -1
- package/dist/engine-loader.js.map +1 -1
- package/dist/geoplateforme.js +2 -1
- package/dist/geoplateforme.js.map +1 -1
- package/dist/glyphs.js +2 -1
- package/dist/glyphs.js.map +1 -1
- package/dist/icons.js +5 -1
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +2 -0
- package/dist/interaction.js +29 -2
- package/dist/interaction.js.map +1 -1
- package/dist/isard_bg.wasm +0 -0
- package/dist/isard_core_bg.wasm +0 -0
- package/dist/layers.d.ts +2 -0
- package/dist/layers.js +22 -4
- package/dist/layers.js.map +1 -1
- package/dist/loader.d.ts +2 -0
- package/dist/loader.js +10 -0
- package/dist/loader.js.map +1 -1
- package/dist/map.d.ts +38 -1
- package/dist/map.js +153 -2
- package/dist/map.js.map +1 -1
- package/dist/overlay.d.ts +40 -0
- package/dist/overlay.js +119 -0
- package/dist/overlay.js.map +1 -1
- package/dist/panoramas.d.ts +94 -0
- package/dist/panoramas.js +245 -0
- package/dist/panoramas.js.map +1 -0
- package/dist/pmtiles.js +3 -2
- package/dist/pmtiles.js.map +1 -1
- package/dist/pointclouds.js +1 -1
- package/dist/pointclouds.js.map +1 -1
- package/dist/protocol.d.ts +7 -1
- package/dist/protocol.js.map +1 -1
- package/dist/requests.d.ts +14 -0
- package/dist/requests.js +48 -0
- package/dist/requests.js.map +1 -0
- package/dist/resample.js +2 -1
- package/dist/resample.js.map +1 -1
- package/dist/style.js +1 -0
- package/dist/style.js.map +1 -1
- package/dist/terrain.d.ts +0 -5
- package/dist/terrain.js +2 -1
- package/dist/terrain.js.map +1 -1
- package/dist/types.d.ts +29 -1
- package/dist/types.js.map +1 -1
- package/dist/vectortiles.js +12 -1
- package/dist/vectortiles.js.map +1 -1
- package/dist/wasm/isard.d.ts +79 -5
- package/dist/wasm/isard.js +165 -7
- package/dist/wasm/isard_core.d.ts +38 -0
- package/dist/wasm/isard_core.js +99 -0
- package/dist/wmts.js +2 -1
- package/dist/wmts.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,45 @@
|
|
|
3
3
|
Every notable change of `isard` (published as `@ign-junn/isard` up to 0.1.1). The format follows [Keep a Changelog](https://keepachangelog.com), the
|
|
4
4
|
versions [Semantic Versioning](https://semver.org) (before 1.0.0, a minor version may change an API).
|
|
5
5
|
|
|
6
|
+
## [0.8.0] - 2026-10-21
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- `setRequestHeaders(prefix, headers)`: headers added to every request isard makes to the URLs starting with a prefix
|
|
11
|
+
(an access token for a private Géoplateforme stream, a server behind single sign-on), from the page, its workers
|
|
12
|
+
(vector tiles, 3D Tiles, point clouds) and its engine (raster tiles, tilesets): for the whole page, again with a
|
|
13
|
+
new token when it is renewed, without headers to stop.
|
|
14
|
+
- A color for 3D Tiles (`color` in `addTiles3d` and `setStyle`): it tints the textures of the meshes and colors the
|
|
15
|
+
untextured ones (light grey without it).
|
|
16
|
+
- 3D Tiles features picked (`pickFeature`, 'hoverfeature'): a building of a 3D Tiles layer comes with its
|
|
17
|
+
properties, from the tile's `EXT_mesh_features` feature IDs and `EXT_structural_metadata` property table (3D Tiles
|
|
18
|
+
1.1: scalars, booleans, strings, enums) or a b3dm's `_BATCHID` and batch table (1.0, its JSON arrays); the
|
|
19
|
+
Bâtiments 3D of the IGN give their BD TOPO attributes (cleabs, hauteur, nature, usage…).
|
|
20
|
+
- `geoid` for 3D Tiles whose heights are altitudes (NGF-IGN69) rather than heights above the ellipsoid, as the IGN's
|
|
21
|
+
Bâtiments 3D: each tile raised by the RAF20 geoid, onto the IGN relief (44 m under it in Paris without).
|
|
22
|
+
- Untextured 3D Tiles meshes shaded: each face by its slope to a light from the north-west and above, as maps shade
|
|
23
|
+
(the Bâtiments 3D were drawn flat); textured meshes keep the light of their photos.
|
|
24
|
+
- `map.elevationAt(lonLat)`: the altitude of the relief at a position, from the tiles the map keeps;
|
|
25
|
+
`map.metersPerPixel(point?)`: metres on the ground per CSS pixel at a screen point, for a scale bar;
|
|
26
|
+
`map.setDoubleClickZoom(enabled)`: a double click zooms or not (off while a drawing takes double clicks).
|
|
27
|
+
- `map.setSwipe({ position, layers, side })`: layers shown on one side of a vertical line only, the layers beneath
|
|
28
|
+
them on the other (comparing two states of a place, two basemaps): rasters cut in the ground's pass, the other
|
|
29
|
+
layers by a scissor; set again as the line moves.
|
|
30
|
+
- `Panel`: an element standing in 3D at a position (a video, a web page, a sign), `width` metres wide, facing
|
|
31
|
+
`heading`, leant back by `pitch`, `height` above the ground: placed after each frame by a CSS 3D transform from
|
|
32
|
+
the camera (`engine.localMatrix`), as the CSS3D objects of three.js.
|
|
33
|
+
- Panoramas (`map.addPanoramas`): the oriented images of a vehicle's cameras (Stereopolis, the iTowns immersive
|
|
34
|
+
format: positions and attitudes in GeoJSON, Lambert-93 by default, the cameras' calibration with MicMac's radial
|
|
35
|
+
distortion) projected onto the scene around the panorama shown, a backdrop sphere for the sky; `enter` walks from
|
|
36
|
+
panorama to panorama at street level (the drag turning the eye, a click going to the nearest panorama, Z and S to
|
|
37
|
+
the next and previous ones, the wheel to the nearest one ahead or behind), `exit` gives the camera back. Drawn by
|
|
38
|
+
the engine with 3D Tiles (`addPanoramas` loads it). Seen from above, a panorama colors the street around it only (40 m),
|
|
39
|
+
its backdrop shown at street level.
|
|
40
|
+
- A street-level camera (`map.setFirstPerson`): an eye above the ground looking any way, straight up included, its
|
|
41
|
+
own field of view; the drag turns it, the wheel narrows its view.
|
|
42
|
+
- Examples: panoramas, swipe (the orthophotos of 1950-1965 against today's), 3D Tiles features (picked, tinted), 3D
|
|
43
|
+
panels; the guide's page on panoramas and the street-level view, private sources, surfaces.
|
|
44
|
+
|
|
6
45
|
## [0.7.0] - 2026-10-20
|
|
7
46
|
|
|
8
47
|
### Added
|
|
@@ -33,6 +72,14 @@ versions [Semantic Versioning](https://semver.org) (before 1.0.0, a minor versio
|
|
|
33
72
|
|
|
34
73
|
### Fixed
|
|
35
74
|
|
|
75
|
+
- Finer relief arriving under the center during a frame is followed by one more frame: the camera follows the relief
|
|
76
|
+
before the frame's uploads, and a frame drawn from the former altitude could stay (the pitched Mars view of the
|
|
77
|
+
visual tests drawn either way).
|
|
78
|
+
- The camera settling onto finer relief after a move ends where the relief puts it whatever order its tiles arrived
|
|
79
|
+
in (each settle from the camera the move left, not from the last settle): the same view for the same relief, the
|
|
80
|
+
pitched scenes of the visual tests stable.
|
|
81
|
+
- A map rebuilding its engine (the engine with 3D Tiles loaded, a context restored) keeps its viewshed, its
|
|
82
|
+
panoramas shown and its street-level eye.
|
|
36
83
|
- 3D Tiles past their GPU memory budget no longer load without end: the tiles of the view that were not drawn yet
|
|
37
84
|
(loaded, waiting for their siblings, or parents of drawn tiles) were unloaded first, then asked again, and so on
|
|
38
85
|
(about 400 requests and 180 frames every 10 s over the Strasbourg mesh at zoom 18, pitch 70). The tiles of the view
|
package/dist/basemap.worker.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type HeaderRules } from './requests.ts';
|
|
1
2
|
import { type Job } from './resample.ts';
|
|
2
3
|
import { type PngEncoding } from './terrain.ts';
|
|
3
4
|
import { type LabelCandidate, type RasterSource, type StyleLayer } from './vectorstyle.ts';
|
|
@@ -34,7 +35,12 @@ export type BasemapWork = {
|
|
|
34
35
|
job: Job;
|
|
35
36
|
cached: number;
|
|
36
37
|
};
|
|
37
|
-
export type BasemapRequest =
|
|
38
|
+
export type BasemapRequest =
|
|
39
|
+
/** The page's request headers (`setRequestHeaders`) */
|
|
40
|
+
{
|
|
41
|
+
type: 'headers';
|
|
42
|
+
rules: HeaderRules;
|
|
43
|
+
} | {
|
|
38
44
|
type: 'init';
|
|
39
45
|
/** Renderers by key: each draws its own layers of the same source */
|
|
40
46
|
key: string;
|
package/dist/basemap.worker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function ve(e){return e*360-180}function ke(e){return Math.atan(Math.sinh(Math.PI*(1-2*e)))*180/Math.PI}class H{capacity;evict;entries=new Map;constructor(e,t){this.capacity=e;this.evict=t}get size(){return this.entries.size}get(e){let t=this.entries.get(e);if(t!==void 0)this.entries.delete(e),this.entries.set(e,t);return t}has(e){return this.entries.has(e)}set(e,t){this.entries.delete(e),this.entries.set(e,t);for(let[n,o]of this.entries){if(this.entries.size<=this.capacity)break;this.entries.delete(n),this.evict?.(o,n)}}delete(e){return this.entries.delete(e)}values(){return this.entries.values()}clear(){this.entries.clear()}}class le{buf;end;pos;constructor(e,t=0,n=e.length){this.buf=e;this.end=n;this.pos=t}varint(){let e=0;for(let t=0;t<70;t+=7){let n=this.buf[this.pos++]??0;if(e+=(n&127)*2**t,n<128)break}return e}int64(){let e=0,t=0;for(let n=0;n<10;n+=1){let o=this.buf[this.pos++]??0,r=o&127;if(n<4)e|=r<<7*n;else if(n===4)e|=(r&15)<<28,t|=r>>4;else t|=r<<7*n-32;if(o<128)break}return(t|0)*4294967296+(e>>>0)}sint(){let e=this.varint();return e%2===1?-(e+1)/2:e/2}sub(){let e=this.varint(),t=Math.min(this.pos+e,this.end),n=new le(this.buf,this.pos,t);return this.pos=t,n}string(){let e=this.varint(),t=Math.min(this.pos+e,this.end),n=Ze.decode(this.buf.subarray(this.pos,t));return this.pos=t,n}float(){let e=this.pos+4<=this.end?this.view().getFloat32(this.pos,!0):0;return this.pos+=4,e}double(){let e=this.pos+8<=this.end?this.view().getFloat64(this.pos,!0):0;return this.pos+=8,e}view(){return new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength)}skip(e){if(e===0)this.varint();else if(e===1)this.pos+=8;else if(e===2)this.pos+=this.varint();else if(e===5)this.pos+=4}get more(){return this.pos<this.end}}var Ze=new TextDecoder;function je(e){let t="";while(e.more){let n=e.varint();switch(n>>3){case 1:t=e.string();break;case 2:t=e.float();break;case 3:t=e.double();break;case 4:t=e.int64();break;case 5:t=e.varint();break;case 6:t=e.sint();break;case 7:t=e.varint()!==0;break;default:e.skip(n&7)}}return t}function _e(e){let t=[],n,[o,r]=[0,0];while(e.more){let i=e.varint(),a=i&7,s=i>>3;if(a===7){if(n&&n.length>=2)n.push(n[0]??0,n[1]??0);continue}for(let u=0;u<s&&e.more;u+=1){if(o+=e.sint(),r+=e.sint(),a===1)n=[],t.push(n);n?.push(o,r)}}return t}function ce(e,t){let n=new Map,o=new le(e);while(o.more){let r=o.varint();if(r>>3!==3){o.skip(r&7);continue}let i=o.sub(),a="",s=4096,u=[],l=[],c=[];while(i.more){let m=i.varint();switch(m>>3){case 1:a=i.string();break;case 2:c.push(i.sub());break;case 3:u.push(i.string());break;case 4:l.push(je(i.sub()));break;case 5:s=i.varint();break;default:i.skip(m&7)}}if(t&&!t.has(a))continue;let h=[];for(let m of c){let C=1,f={},b=[];while(m.more){let k=m.varint();switch(k>>3){case 2:{let d=m.sub();while(d.more){let L=u[d.varint()],J=l[d.varint()];if(L!==void 0&&J!==void 0)f[L]=J}break}case 3:C=Math.min(3,Math.max(1,m.varint()));break;case 4:b=_e(m.sub());break;default:m.skip(k&7)}}h.push({type:C,properties:f,geometry:b})}n.set(a,{extent:s,features:h})}return n}var Ke=127,Xe=16384,Ye=["unknown","mvt","png","jpeg","webp","avif"],Ge=(e)=>(4**e-1)/3;function Qe(e,t,n){if(e>26)throw Error(`isard: PMTiles level ${e} past 26`);let o=2**e;if(t<0||n<0||t>=o||n>=o)throw Error(`isard: PMTiles tile ${e}/${t}/${n} out of its level`);let[r,i]=[t,n],a=0;for(let s=o/2;s>=1;s/=2){let u=(r&s)>0?1:0,l=(i&s)>0?1:0;if(a+=s*s*(3*u^l),l===0){if(u===1)[r,i]=[s-1-r,s-1-i];[r,i]=[i,r]}}return Ge(e)+a}class Me{bytes;pos=0;constructor(e){this.bytes=e}next(){let e=0,t=1;for(;;){let n=this.bytes[this.pos++];if(n===void 0)throw Error("isard: PMTiles directory truncated");if(e+=(n&127)*t,n<128)return e;if(t*=128,t>9223372036854776000)throw Error("isard: PMTiles varint too long")}}}function Ae(e){let t=new Me(e),n=t.next();if(n>e.length)throw Error("isard: PMTiles directory larger than its bytes");let o=[],r=0;for(let i=0;i<n;i+=1)r+=t.next(),o.push({tileId:r,offset:0,length:0,runLength:1});for(let i of o)i.runLength=t.next();for(let i of o)i.length=t.next();return o.forEach((i,a)=>{let s=t.next(),u=o[a-1];i.offset=s===0&&u?u.offset+u.length:s-1}),o}function et(e,t){let[n,o]=[0,e.length-1];while(n<=o){let i=n+o>>1,a=e[i];if(a.tileId===t)return a;if(a.tileId<t)n=i+1;else o=i-1}let r=e[o];if(!r)return;if(r.runLength===0||t-r.tileId<r.runLength)return r;return}function tt(e){if(e.length<Ke||String.fromCharCode(...e.subarray(0,7))!=="PMTiles")throw Error("isard: not a PMTiles archive");if(e[7]!==3)throw Error(`isard: PMTiles version ${e[7]} (only 3 is read)`);let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=(r)=>Number(t.getBigUint64(r,!0)),o=(r)=>t.getInt32(r,!0)/1e7;return{rootDirectoryOffset:n(8),rootDirectoryLength:n(16),metadataOffset:n(24),metadataLength:n(32),leafDirectoryOffset:n(40),leafDirectoryLength:n(48),tileDataOffset:n(56),tileDataLength:n(64),internalCompression:t.getUint8(97),tileCompression:t.getUint8(98),tileType:Ye[t.getUint8(99)]??"unknown",minZoom:t.getUint8(100),maxZoom:t.getUint8(101),bounds:[o(102),o(106),o(110),o(114)],center:[o(119),o(123),t.getUint8(118)]}}async function G(e,t){if(t===0||t===1)return e;if(t!==2)throw Error(`isard: PMTiles compression ${t===3?"brotli":"zstd"} is not read (gzip only)`);let n=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip"));return new Uint8Array(await new Response(n).arrayBuffer())}var nt=67108864;class Pe{source;head;leaves=new H(64);whole;constructor(e){this.source=e}async range(e,t,n){if(typeof this.source!=="string")return new Uint8Array(await this.source.slice(e,e+t).arrayBuffer());if(this.whole)return(await this.whole).subarray(e,e+t);let o=await fetch(this.source,{headers:{Range:`bytes=${e}-${e+Math.max(t,1)-1}`},...n?{signal:n}:{}});if(!o.ok)throw Error(`${this.source}: HTTP ${o.status}`);if(o.status===206)return new Uint8Array(await o.arrayBuffer());if(Number(o.headers.get("Content-Length"))>nt)throw await o.body?.cancel(),Error(`${this.source}: the server ignores range requests (HTTP 206 expected)`);let i=o.arrayBuffer().then((a)=>new Uint8Array(a));return this.whole=i,i.catch(()=>{this.whole=void 0}),(await i).subarray(e,e+t)}load(){return this.head??=(async()=>{let e=await this.range(0,Xe),t=tt(e),{rootDirectoryOffset:n,rootDirectoryLength:o}=t,r=n+o<=e.length?e.subarray(n,n+o):await this.range(n,o),i=Ae(await G(r,t.internalCompression));return{header:t,root:i}})(),this.head.catch(()=>{this.head=void 0}),this.head}async header(){return(await this.load()).header}async metadata(){let{header:e}=await this.load();if(e.metadataLength===0)return{};let t=await this.range(e.metadataOffset,e.metadataLength),n=new TextDecoder().decode(await G(t,e.internalCompression)),o=JSON.parse(n);return o&&typeof o==="object"&&!Array.isArray(o)?o:{}}leaf(e,t){let n=e.leafDirectoryOffset+t.offset,o=this.leaves.get(n);if(!o)o=this.range(n,t.length).then(async(r)=>Ae(await G(r,e.internalCompression))),o.catch(()=>this.leaves.delete(n)),this.leaves.set(n,o);return o}async tile(e,t,n,o){let{header:r,root:i}=await this.load();if(e<r.minZoom||e>r.maxZoom)return;let a=Qe(e,t,n),s=i;for(let u=0;u<4;u+=1){let l=et(s,a);if(!l)return;if(l.runLength>0){let c=await this.range(r.tileDataOffset+l.offset,l.length,o);return G(c,r.tileCompression)}s=await this.leaf(r,l)}throw Error("isard: PMTiles directories nested too deep")}}var Se=new H(16);function rt(e){let t=Se.get(e);if(!t)t=new Pe(e),Se.set(e,t);return t}function fe(e,t){let n=/^pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)$/.exec(e);if(!n)return!1;let[,o="",r,i,a]=n;return rt(o).tile(Number(r),Number(i),Number(a),t)}var ot=96;function it(e,t,n,o,r,i){let a=new Uint8ClampedArray(i*i*4),s=i/r,u=r+1;for(let l=0;l<i;l+=1){let c=(l+0.5)/s,h=Math.min(r-1,Math.floor(c)),m=c-h;for(let C=0;C<i;C+=1){let f=(C+0.5)/s,b=Math.min(r-1,Math.floor(f)),k=f-b,d=2*(h*u+b),L=d+2*u,J=(1-k)*(1-m),W=k*(1-m),O=(1-k)*m,P=k*m,x=J*o[d]+W*o[d+2]+O*o[L]+P*o[L+2],v=J*o[d+1]+W*o[d+3]+O*o[L+1]+P*o[L+3],p=x-0.5,g=v-0.5;if(!(p>-1&&g>-1&&p<t&&g<n))continue;let S=Math.floor(p),y=Math.floor(g),I=p-S,A=g-y,R=0,E=0,M=0,T=0;for(let D=0;D<4;D+=1){let q=S+(D&1),F=y+(D>>1);if(q<0||F<0||q>=t||F>=n)continue;let B=4*(F*t+q),z=(D&1?I:1-I)*(D>>1?A:1-A)*e[B+3];R+=z*e[B],E+=z*e[B+1],M+=z*e[B+2],T+=z}if(T<=0)continue;let N=4*(l*i+C);a[N]=R/T,a[N+1]=E/T,a[N+2]=M/T,a[N+3]=T}}return a}function Ce(e=ot){let t=new Map,n=new Set,o=(l)=>{n.delete(l),l.then((c)=>c?.close(),()=>{return})},r=(l)=>{if(t.has(l))n.add(l);else o(l)},i=new H(e,r),a=(l)=>{let c=(t.get(l)??1)-1;if(c>0)t.set(l,c);else if(t.delete(l),n.has(l))o(l)},s=(l)=>{let c=i.get(l);if(!c)c=(async()=>{let h=await fetch(l);if(h.status===404||h.status===204||h.status===410)return null;if(!h.ok)throw Error(`isard: ${h.status} for a raster to reproject`);return createImageBitmap(await h.blob())})(),c.catch(()=>i.delete(l)),i.set(l,c);return t.set(c,(t.get(c)??0)+1),c};return{draw:async(l,c)=>{let h=l.sources.map((m)=>[m,s(m.url)]);try{let m=await Promise.all(h.map(async([d,L])=>[d,await L]));if(c.throwIfAborted(),!m.some(([,d])=>d))return null;let f=new OffscreenCanvas(l.width,l.height).getContext("2d",{willReadFrequently:!0});if(!f)throw Error("isard: no 2D canvas to reproject the tiles");for(let[d,L]of m)if(L)f.drawImage(L,d.x,d.y,d.w,d.h);let b=f.getImageData(0,0,l.width,l.height).data,k=it(b,l.width,l.height,l.mesh,l.n,l.size);return createImageBitmap(new ImageData(k,l.size,l.size),{premultiplyAlpha:"none"})}finally{for(let[,m]of h)a(m)}},cache:i,close:()=>{for(let l of i.values())r(l);i.clear()}}}function st(e,t,n=Number.NEGATIVE_INFINITY){let o=e.length>>2,r=new Float32Array(o);if(t==="terrarium")for(let i=0,a=0;i<o;i+=1,a+=4){let s=e[a]*256+e[a+1]+e[a+2]/256-32768;r[i]=s>n?s:n}else for(let i=0,a=0;i<o;i+=1,a+=4){let s=-1e4+(e[a]*65536+e[a+1]*256+e[a+2])*0.1;r[i]=s>n?s:n}return r}async function Ie(e,t,n,o,r){let i=await fetch(e,{signal:o});if(i.status===404||i.status===204||i.status===410)return null;if(!i.ok)throw Error(`${i.url}: ${i.status}`);let a=await createImageBitmap(await i.blob(),{premultiplyAlpha:"none",colorSpaceConversion:"none"});try{r.canvas??=new OffscreenCanvas(256,256);let s=r.canvas.getContext("2d",{willReadFrequently:!0});if(!s)throw Error("no 2D context");return s.imageSmoothingEnabled=!1,s.clearRect(0,0,256,256),s.drawImage(a,0,0,256,256),st(s.getImageData(0,0,256,256).data,t,n)}finally{a.close()}}var at="aliceblue f0f8ff antiquewhite faebd7 aqua 00ffff aquamarine 7fffd4 azure f0ffff beige f5f5dc bisque ffe4c4 black 000000 blanchedalmond ffebcd blue 0000ff blueviolet 8a2be2 brown a52a2a burlywood deb887 cadetblue 5f9ea0 chartreuse 7fff00 chocolate d2691e coral ff7f50 cornflowerblue 6495ed cornsilk fff8dc crimson dc143c cyan 00ffff darkblue 00008b darkcyan 008b8b darkgoldenrod b8860b darkgray a9a9a9 darkgreen 006400 darkgrey a9a9a9 darkkhaki bdb76b darkmagenta 8b008b darkolivegreen 556b2f darkorange ff8c00 darkorchid 9932cc darkred 8b0000 darksalmon e9967a darkseagreen 8fbc8f darkslateblue 483d8b darkslategray 2f4f4f darkslategrey 2f4f4f darkturquoise 00ced1 darkviolet 9400d3 deeppink ff1493 deepskyblue 00bfff dimgray 696969 dimgrey 696969 dodgerblue 1e90ff firebrick b22222 floralwhite fffaf0 forestgreen 228b22 fuchsia ff00ff gainsboro dcdcdc ghostwhite f8f8ff gold ffd700 goldenrod daa520 gray 808080 green 008000 greenyellow adff2f grey 808080 honeydew f0fff0 hotpink ff69b4 indianred cd5c5c indigo 4b0082 ivory fffff0 khaki f0e68c lavender e6e6fa lavenderblush fff0f5 lawngreen 7cfc00 lemonchiffon fffacd lightblue add8e6 lightcoral f08080 lightcyan e0ffff lightgoldenrodyellow fafad2 lightgray d3d3d3 lightgreen 90ee90 lightgrey d3d3d3 lightpink ffb6c1 lightsalmon ffa07a lightseagreen 20b2aa lightskyblue 87cefa lightslategray 778899 lightslategrey 778899 lightsteelblue b0c4de lightyellow ffffe0 lime 00ff00 limegreen 32cd32 linen faf0e6 magenta ff00ff maroon 800000 mediumaquamarine 66cdaa mediumblue 0000cd mediumorchid ba55d3 mediumpurple 9370db mediumseagreen 3cb371 mediumslateblue 7b68ee mediumspringgreen 00fa9a mediumturquoise 48d1cc mediumvioletred c71585 midnightblue 191970 mintcream f5fffa mistyrose ffe4e1 moccasin ffe4b5 navajowhite ffdead navy 000080 oldlace fdf5e6 olive 808000 olivedrab 6b8e23 orange ffa500 orangered ff4500 orchid da70d6 palegoldenrod eee8aa palegreen 98fb98 paleturquoise afeeee palevioletred db7093 papayawhip ffefd5 peachpuff ffdab9 peru cd853f pink ffc0cb plum dda0dd powderblue b0e0e6 purple 800080 rebeccapurple 663399 red ff0000 rosybrown bc8f8f royalblue 4169e1 saddlebrown 8b4513 salmon fa8072 sandybrown f4a460 seagreen 2e8b57 seashell fff5ee sienna a0522d silver c0c0c0 skyblue 87ceeb slateblue 6a5acd slategray 708090 slategrey 708090 snow fffafa springgreen 00ff7f steelblue 4682b4 tan d2b48c teal 008080 thistle d8bfd8 tomato ff6347 turquoise 40e0d0 violet ee82ee wheat f5deb3 white ffffff whitesmoke f5f5f5 yellow ffff00 yellowgreen 9acd32",Q;function ut(e){if(!Q){Q=new Map;let t=at.split(" ");for(let n=0;n+1<t.length;n+=2)Q.set(t[n],t[n+1])}return Q.get(e)}var ee=(e)=>Number.isFinite(e)?Math.max(0,Math.min(1,e)):0;function Le(e){if(!/^[0-9a-f]+$/.test(e)||![3,4,6,8].includes(e.length))return;let t=e.length<=4?[...e].map((o)=>o+o).join(""):e,n=(o)=>Number.parseInt(t.slice(o,o+2),16)/255;return[n(0),n(2),n(4),t.length===8?n(6):1]}function lt(e){if(e===void 0)return 1;return ee(e.endsWith("%")?Number.parseFloat(e)/100:Number.parseFloat(e))}function ct(e,t,n){let o=n<0.5?n*(1+t):n+t-n*t,r=2*n-o,i=(a)=>{let s=(a%1+1)%1;if(s<0.16666666666666666)return r+(o-r)*6*s;if(s<0.5)return o;if(s<0.6666666666666666)return r+(o-r)*(0.6666666666666666-s)*6;return r};return[i(e+0.3333333333333333),i(e),i(e-0.3333333333333333)]}function Ne(e){if(typeof e!=="string")return;let t=e.trim().toLowerCase();if(t.startsWith("#"))return Le(t.slice(1));if(t==="transparent")return[0,0,0,0];let n=ut(t);if(n)return Le(n);let o=/^(rgba?|hsla?)\(([^)]*)\)$/.exec(t);if(!o?.[1]||o[2]===void 0)return;let r=o[2].split(/[\s,/]+/).filter(Boolean);if(r.length<3||r.slice(0,3).some((c)=>Number.isNaN(Number.parseFloat(c))))return;let i=lt(r[3]);if(o[1].startsWith("rgb")){let c=(h)=>ee(h.endsWith("%")?Number.parseFloat(h)/100:Number.parseFloat(h)/255);return[c(r[0]),c(r[1]),c(r[2]),i]}let a=Number.parseFloat(r[0])/360,[s,u,l]=ct(a,ee(Number.parseFloat(r[1])/100),ee(Number.parseFloat(r[2])/100));return[s,u,l,i]}var ft=["Unknown","Point","LineString","Polygon"];function me(e,t){return{zoom:t,properties:e.properties,type:ft[e.type]??"Unknown"}}function _(e){return Ne(e)}function ne([e,t,n,o]){return`rgba(${Math.round(e*255)},${Math.round(t*255)},${Math.round(n*255)},${o})`}function Re(e,t,n,o=1){let r=n-t;if(r===0)return 0;let i=e-t;return o===1?i/r:(o**i-1)/(o**r-1)}function de(e,t,n){if(typeof e==="number"&&typeof t==="number")return e+(t-e)*n;let o=_(e),r=_(t);if(o&&r)return ne([0,1,2,3].map((i)=>(o[i]??0)+((r[i]??0)-(o[i]??0))*n));if(Array.isArray(e)&&Array.isArray(t))return e.map((i,a)=>de(i,t[a],n));return n<0.5?e:t}function Je(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)&&Array.isArray(e.stops)}function mt(e,t){let n=e.property===void 0?t.zoom:t.properties[e.property],o=e.stops,r=e.type??(e.property===void 0||typeof o[0]?.[0]==="number"?"exponential":"categorical");if(r==="identity")return n??e.default;if(r==="categorical")return o.find(([s])=>s===n)?.[1]??e.default;if(typeof n!=="number"||!o.length)return e.default??o[0]?.[1];let i=(s)=>typeof s[0]==="object"&&s[0]!==null?Number(s[0].zoom):Number(s[0]),a=o[0];if(!a)return e.default;if(n<=i(a))return a[1];for(let s=1;s<o.length;s+=1){let[u,l]=[o[s-1],o[s]];if(!u||!l)continue;if(n<i(l)){if(r==="interval")return u[1];return de(u[1],l[1],Re(n,i(u),i(l),e.base??1))}}return o.at(-1)?.[1]}function te(e,t){if(t==="$type")return e.type;return typeof t==="string"?e.properties[t]:void 0}var dt=new Set(["literal","zoom","get","has","!has","properties","id","geometry-type","concat","format","image","number-format","to-number","to-string","to-boolean","to-color","number","string","boolean","typeof","length","at","upcase","downcase","coalesce","!","all","any","==","!=","<","<=",">",">=","in","case","match","step","interpolate","interpolate-hcl","interpolate-lab","rgb","rgba","+","-","*","/","%","^","min","max","abs","round","floor","ceil","sqrt","ln","log10","log2","pi","e"]);function re(e){return Array.isArray(e)&&typeof e[0]==="string"&&dt.has(e[0])}var Te=new Set,K=(e)=>e===void 0||e===null?"":String(e);function U(e,t){if(Je(e))return mt(e,t);if(!Array.isArray(e))return e;let[n,...o]=e;if(typeof n!=="string")return e;let r=(s)=>U(o[s]??null,t),i=(s)=>Number(r(s)),a=()=>o.map((s,u)=>i(u));switch(n){case"literal":return o[0];case"zoom":return t.zoom;case"get":return te(t,r(0));case"has":return te(t,r(0))!==void 0;case"!has":return te(t,r(0))===void 0;case"properties":return t.properties;case"id":return null;case"geometry-type":return t.type;case"concat":return o.map((s,u)=>K(r(u))).join("");case"format":return o.map((s,u)=>s!==null&&typeof s==="object"&&!Array.isArray(s)?"":K(r(u))).join("");case"image":return r(0);case"number-format":{let s=o[1]??{},u=i(0);if(!Number.isFinite(u))return"";return u.toLocaleString(s.locale,{minimumFractionDigits:s["min-fraction-digits"],maximumFractionDigits:s["max-fraction-digits"]})}case"to-number":{for(let s=0;s<o.length;s+=1){let u=r(s),l=typeof u==="string"&&u.trim()===""?Number.NaN:Number(u);if(u!==null&&u!==void 0&&!Number.isNaN(l))return l}return 0}case"to-string":return K(r(0));case"to-boolean":{let s=r(0);return!(s===""||s===0||s===!1||s===null||s===void 0||Number.isNaN(s))}case"to-color":case"number":case"string":case"boolean":{let s={"to-color":(u)=>_(u)!==void 0,number:(u)=>typeof u==="number",string:(u)=>typeof u==="string",boolean:(u)=>typeof u==="boolean"};for(let u=0;u<o.length;u+=1){let l=r(u);if(s[n]?.(l))return l}return o.length?r(o.length-1):null}case"typeof":{let s=r(0);if(s===null||s===void 0)return"null";return Array.isArray(s)?"array":typeof s}case"length":{let s=r(0);return typeof s==="string"||Array.isArray(s)?s.length:0}case"at":{let s=r(1);return Array.isArray(s)?s[i(0)]??null:null}case"upcase":return K(r(0)).toUpperCase();case"downcase":return K(r(0)).toLowerCase();case"coalesce":for(let s=0;s<o.length;s+=1){let u=r(s);if(u!==void 0&&u!==null)return u}return null;case"!":return!r(0);case"all":return o.every((s,u)=>Boolean(r(u)));case"any":return o.some((s,u)=>Boolean(r(u)));case"==":return r(0)===r(1);case"!=":return r(0)!==r(1);case"<":return r(0)<r(1);case"<=":return r(0)<=r(1);case">":return r(0)>r(1);case">=":return r(0)>=r(1);case"in":{let s=r(1),u=r(0);if(typeof s==="string")return s.includes(String(u));return Array.isArray(s)&&s.includes(u)}case"case":{for(let s=0;s+1<o.length;s+=2)if(r(s))return r(s+1);return r(o.length-1)}case"match":{let s=r(0);for(let u=1;u+1<o.length;u+=2){let l=o[u];if(Array.isArray(l)?l.includes(s):l===s)return r(u+1)}return r(o.length-1)}case"step":{let s=i(0),u=r(1);for(let l=2;l+1<o.length;l+=2)if(s>=Number(o[l]))u=r(l+1);else break;return u}case"interpolate":case"interpolate-hcl":case"interpolate-lab":{let s=o[0],u=i(1),l=Array.isArray(s)&&s[0]==="exponential"?Number(s[1]):1,c=[];for(let m=2;m+1<o.length;m+=2)c.push([Number(o[m]),o[m+1]??null]);let h=c[0];if(!h)return null;if(u<=h[0])return U(h[1],t);for(let m=1;m<c.length;m+=1){let[C,f]=[c[m-1],c[m]];if(C&&f&&u<f[0])return de(U(C[1],t),U(f[1],t),Re(u,C[0],f[0],l))}return U(c.at(-1)?.[1]??null,t)}case"rgb":case"rgba":return ne([i(0)/255,i(1)/255,i(2)/255,o.length>3?i(3):1]);case"+":return a().reduce((s,u)=>s+u,0);case"*":return a().reduce((s,u)=>s*u,1);case"-":return o.length===1?-i(0):i(0)-i(1);case"/":return i(0)/i(1);case"%":return i(0)%i(1);case"^":return i(0)**i(1);case"min":return Math.min(...a());case"max":return Math.max(...a());case"abs":return Math.abs(i(0));case"round":return Math.sign(i(0))*Math.round(Math.abs(i(0)));case"floor":return Math.floor(i(0));case"ceil":return Math.ceil(i(0));case"sqrt":return Math.sqrt(i(0));case"ln":return Math.log(i(0));case"log10":return Math.log10(i(0));case"log2":return Math.log2(i(0));case"pi":return Math.PI;case"e":return Math.E;default:if(!Te.has(n))Te.add(n),console.warn(`isard: the style expression "${n}" is not supported`);return null}}var pt=new Set(["==","!=","<","<=",">",">="]);function bt(e){let[t,n,...o]=e;if(typeof t!=="string"||typeof n!=="string"||o.some(Array.isArray))return!1;if(pt.has(t))return e.length===3;if(t==="in")return e.length!==3||!Array.isArray(e[2]);return t==="!in"||t==="has"||t==="!has"}function ht(e,t){let[n,o,...r]=e,i=te(t,o);switch(n){case"==":return i===r[0];case"!=":return i!==r[0];case"<":return i<r[0];case"<=":return i<=r[0];case">":return i>r[0];case">=":return i>=r[0];case"in":return r.includes(i);case"!in":return!r.includes(i);case"has":return i!==void 0;case"!has":return i===void 0;default:return!0}}var Ee=new WeakMap;function Oe(e){if(!Array.isArray(e))return()=>Boolean(e);let t=Ee.get(e);if(t)return t;let n,o=e[0];if(o==="all"||o==="any"||o==="none"){let r=e.slice(1).map(Oe);if(o==="all")n=(i)=>r.every((a)=>a(i));else if(o==="any")n=(i)=>r.some((a)=>a(i));else n=(i)=>!r.some((a)=>a(i))}else if(bt(e))n=(r)=>ht(e,r);else n=(r)=>Boolean(U(e,r));return Ee.set(e,n),n}function pe(e,t){if(e===void 0||e===null)return!0;return Oe(e)(t)}function X(e){if(e!==void 0&&Je(e))return e.property!==void 0;if(!Array.isArray(e))return!1;if(["get","has","!has","geometry-type","properties","id"].includes(e[0]))return!0;return e.some((t)=>X(t))}function be(e,t){if(e===void 0||e===null)return"";if(typeof e==="string")return e.replace(/\{([^}]+)\}/g,(o,r)=>{let i=t.properties[r];return i===void 0?"":String(i)});let n=U(e,t);if(Array.isArray(n))return n.filter((o)=>typeof o==="string").join("");return n===void 0||n===null?"":String(n)}function De(e){return/Regular|Bold|Italic|Semibold|Light|Medium|Black/.test(e)?e:`${e} Regular`}function he(e){let t=new Set,n=(a)=>{if(!Array.isArray(a))return;let s=(u)=>Array.isArray(u)&&u[0]==="zoom";if((a[0]==="interpolate"||a[0]==="interpolate-hcl"||a[0]==="interpolate-lab")&&s(a[2]))for(let u=3;u<a.length;u+=2)t.add(Number(a[u]));else if(a[0]==="step"&&s(a[1]))for(let u=3;u<a.length;u+=2){let l=Number(a[u]);t.add(l),t.add(l-0.01)}for(let u of a)n(u)};n(e);let o=[...t].filter(Number.isFinite);if(o.length===0)o.push(0);let[r,i]=[Math.min(...o),Math.max(...o)];for(let a=Math.ceil(r);a<=Math.floor(i);a+=1)o.push(a);return[...new Set(o)].sort((a,s)=>a-s).map((a)=>[a,Number(U(e,{zoom:a,properties:{},type:"Unknown"}))])}function Be(e,t){for(let n of e.sprites){let o=n.icons[t];if(o)return{icon:o,image:n.image}}return}var oe=new Map,ze=96,ie=new H(ze);function gt(e){return Math.max(16,Math.ceil(ze/Math.max(1,e)))}var ge=new Set,Y=new Set,we=new Map,yt={},Fe=Ce(),ye=new H(64,(e)=>e.then((t)=>setTimeout(()=>t?.close(),0),()=>{return}));function wt(e,t="auto"){let n=ye.get(e);if(n)return n;let o=(async()=>{let r=fe(e);if(r){let s=await r;return s&&createImageBitmap(new Blob([s]))}let a=await fetch(e,{priority:t});if(a.status===404||a.status===204)return;if(!a.ok)throw Error(`${e}: ${a.status}`);return createImageBitmap(await a.blob())})();return o.catch(()=>ye.delete(e)),ye.set(e,o),o}function Ue(e,t="auto"){let n=ie.get(e);if(n)return n;let o=(async()=>{let r=fe(e);if(r){let i=await r;return i&&ce(i)}for(let i=0;;i+=1){let s=await fetch(e,{priority:t});if(s.status===404||s.status===204)return;if(s.ok)return ce(new Uint8Array(await s.arrayBuffer()));if(i>=2)throw Error(`${e}: ${s.status}`);await new Promise((u)=>setTimeout(u,400*(i+1)))}})();return o.catch(()=>ie.delete(e)),ie.set(e,o),o}function xt(e,t,n,o){let r=Math.max(0,Math.min(t-1,e.maxzoom)),i=t-r,a=2**Math.max(0,i),[s,u]=i>=0?[Math.floor(n/a),Math.floor(o/a)]:[n,o],l=e.tiles.replace("{z}",String(r)).replace("{x}",String(s)).replace("{y}",String(u)),c=1/a;return{url:l,vz:r,vx:s,vy:u,part:c,ox:n%a*c,oy:o%a*c}}var w=(e,t,n,o,r)=>{let i=e[t]?.[n];if(i===void 0)return r;let a=Array.isArray(i)&&!re(i)?i:U(i,o);return a===void 0||a===null?r:a};function Z(e,t){let n=_(e)??[0,0,0,1];return ne([n[0],n[1],n[2],n[3]*t])}function $e(e,t){if(e.layout?.visibility==="none")return!1;return t>=(e.minzoom??0)&&t<(e.maxzoom??24)}function vt(e,t){if(e.patterns.has(t))return e.patterns.get(t);let n=Be(e,t),o;if(n&&n.icon.width>0&&n.icon.height>0){let{icon:r}=n;o=new OffscreenCanvas(r.width,r.height),o.getContext("2d")?.drawImage(n.image,r.x,r.y,r.width,r.height,0,0,r.width,r.height)}return e.patterns.set(t,o),o}var xe=new Map;function kt(e){let t=xe.get(e)?.pop()??new OffscreenCanvas(e,e),n=t.getContext("2d",{willReadFrequently:!0});if(!n)throw Error("no 2D context");return n.setTransform(1,0,0,1,0,0),n.globalAlpha=1,n.setLineDash([]),n.clearRect(0,0,e,e),{canvas:t,g:n}}function At(e){let t=xe.get(e.width)??[];if(xe.set(e.width,t),t.length<4)t.push(e)}function St(e,t,n){if(n)return Promise.resolve(e.transferToImageBitmap());return createImageBitmap(t.getImageData(0,0,e.width,e.height),{premultiplyAlpha:"none"})}async function Mt(e,t,n,o,r,i,a){let s=xt(e,t,n,o),u=await Ue(s.url,a);if(Y.has(i))return;let{canvas:l,g:c}=kt(r);try{return await Pt(e,s,u,l,c,t,n,o,r,i,a)}finally{At(l)}}async function Pt(e,t,n,o,r,i,a,s,u,l,c){let h=Math.max(0,i-1),m=u/256,C=!1,f=!1;for(let b of e.layers){if(!$e(b,h))continue;let k={zoom:h,properties:{},type:"Unknown"};if(b.type==="background"){let v=w(b,"paint","background-color",k,"#000"),p=Number(w(b,"paint","background-opacity",k,1));if(r.fillStyle=Z(v,p),r.fillRect(0,0,u,u),(_(v)??[0,0,0,1])[3]*p>=1)f=!0;C=!0;continue}if(b.type==="raster"){let v=b.source===void 0?void 0:e.rasters[b.source];if(!v)continue;let p=Math.max(0,Math.min(i-(v.tileSize>=512?1:0),v.maxzoom)),g=2**(i-p),S=v.tiles.replace("{z}",String(p)).replace("{x}",String(Math.floor(a/g))).replace("{y}",String(Math.floor(s/g))),y=await wt(S,c).catch(()=>{return});if(Y.has(l))return;if(!y)continue;let[I,A]=[y.width/g,y.height/g];r.globalAlpha=Number(w(b,"paint","raster-opacity",k,1)),r.drawImage(y,a%g*I,s%g*A,I,A,0,0,u,u),r.globalAlpha=1,C=!0;continue}let d=n?.get(b["source-layer"]??"");if(!d)continue;let L=u/(d.extent*t.part),[J,W]=[t.ox*d.extent,t.oy*d.extent],O=(v,p)=>{r.beginPath();for(let g of v.geometry){for(let S=0;S+1<g.length;S+=2){let[y,I]=[((g[S]??0)-J)*L,((g[S+1]??0)-W)*L];if(S===0)r.moveTo(y,I);else r.lineTo(y,I)}if(p)r.closePath()}},P=new Map,x=(v,p,g,S)=>{let y=P.get(p);if(y===void 0)y=X(b[v]?.[p]),P.set(p,y);return w(b,v,p,y?g:k,S)};for(let v of d.features){let p=me(v,h);if(!pe(b.filter,p))continue;if(b.type==="fill-extrusion"&&v.type===3)O(v,!0),r.fillStyle=Z(x("paint","fill-extrusion-color",p,"#000"),Number(x("paint","fill-extrusion-opacity",p,1))),r.fill("evenodd"),C=!0;else if(b.type==="fill"&&v.type===3){let g=Number(x("paint","fill-opacity",p,1)),S=x("paint","fill-pattern",p,void 0);O(v,!0);let y=typeof S==="string"?Be(e,S)?.icon:void 0,I=y&&vt(e,S);if(y&&I){let A=r.createPattern(I,"repeat");if(A)A.setTransform(new DOMMatrix().scale(m/(y.pixelRatio??1))),r.globalAlpha=g,r.fillStyle=A,r.fill("evenodd"),r.globalAlpha=1}else{r.fillStyle=Z(x("paint","fill-color",p,"#000"),g),r.fill("evenodd");let A=x("paint","fill-outline-color",p,void 0);if(A!==void 0)r.strokeStyle=Z(A,g),r.lineWidth=m,r.setLineDash([]),r.stroke()}C=!0}else if(b.type==="line"&&v.type!==1){let g=Number(x("paint","line-width",p,1));if(g<=0)continue;let S=Number(x("paint","line-gap-width",p,0));r.strokeStyle=Z(x("paint","line-color",p,"#000"),Number(x("paint","line-opacity",p,1))),r.lineWidth=(S>0?S+2*g:g)*m,r.lineCap=String(x("layout","line-cap",p,"butt")),r.lineJoin=String(x("layout","line-join",p,"miter"));let y=x("paint","line-dasharray",p,void 0);r.setLineDash(Array.isArray(y)?y.map((I)=>Number(I)*g*m):[]),O(v,v.type===3),r.stroke(),C=!0}else if(b.type==="circle"&&v.type===1){let g=Number(x("paint","circle-radius",p,5))*m;r.fillStyle=Z(x("paint","circle-color",p,"#000"),Number(x("paint","circle-opacity",p,1)));let S=Number(x("paint","circle-stroke-width",p,0))*m;r.strokeStyle=Z(x("paint","circle-stroke-color",p,"#000"),Number(x("paint","circle-stroke-opacity",p,1))),r.lineWidth=S;for(let y of v.geometry)for(let I=0;I+1<y.length;I+=2)if(r.beginPath(),r.arc(((y[I]??0)-J)*L,((y[I+1]??0)-W)*L,g,0,2*Math.PI),r.fill(),S>0)r.stroke();C=!0}}}if(!C&&!n)return null;return St(o,r,f)}function qe(e,t,n){let o=Boolean(w(e,"layout",`${t}-allow-overlap`,n,!1)),r=Boolean(w(e,"layout",`${t}-ignore-placement`,n,!1));if(o&&r)return!0;if(o)return"allow";return r?"ignore":!1}function Ct(e,t){return Array.isArray(e)?[Number(e[0]??t[0]),Number(e[1]??t[1])]:t}function It(e){let t=(Array.isArray(e)?e:[e]).map((a)=>Number(a)||0),[n=0,o=n,r=n,i=o]=t;return[n,o,r,i]}function Lt(e,t){let n=0;for(let a=2;a+1<e.length;a+=2)n+=Math.hypot((e[a]??0)-(e[a-2]??0),(e[a+1]??0)-(e[a-1]??0));let o=[];if(!(n>0)||!(t>0))return o;let r=Math.min(t/2,n/2),i=0;for(let a=2;a+1<e.length;a+=2){let[s,u,l,c]=[e[a-2]??0,e[a-1]??0,e[a]??0,e[a+1]??0],h=Math.hypot(l-s,c-u);while(h>0&&r<=i+h){let m=(r-i)/h;o.push([s+(l-s)*m,u+(c-u)*m,s,u,l,c]),r+=t}i+=h}return o}function j(e,t,n,o,r,i){let a=2**e;return[ve((t+r/o)/a),ke((n+i/o)/a)]}function Nt(e,t,n,o,r){let i=w(e,"layout","icon-rotation-alignment",n,"auto"),a=String(w(e,"layout","icon-text-fit",n,"none")),s=w(e,"layout","icon-text-fit-padding",n,[0,0,0,0]);return{image:t,size:X(e.layout?.["icon-size"])?Number(w(e,"layout","icon-size",n,1)):r(e),anchor:String(w(e,"layout","icon-anchor",n,"center")),offset:Ct(w(e,"layout","icon-offset",n,[0,0]),[0,0]),rotate:Number(w(e,"layout","icon-rotate",n,0))||0,alignment:i==="map"||i==="auto"&&o==="line"?"map":"viewport",overlap:qe(e,"icon",n),optional:Boolean(w(e,"layout","icon-optional",n,!1)),fit:a==="width"||a==="height"||a==="both"?a:"none",padding:It(s),color:String(w(e,"paint","icon-color",n,"#000")),opacity:Number(w(e,"paint","icon-opacity",n,1))}}async function Tt(e,t,n,o,r,i,a=t){let s=e.tiles.replace("{z}",String(t)).replace("{x}",String(n)).replace("{y}",String(o)),u=await Ue(s,i);if(!u||Y.has(r))return[];let l=[],c=new Map,h=(f)=>{let b=c.get(f);if(b===void 0){let k=f.layout?.["text-size"]??16;b=re(k)?he(k):k,c.set(f,b)}return b},m=new Map,C=(f)=>{let b=m.get(f);if(b===void 0){let k=f.layout?.["icon-size"]??1;b=re(k)?he(k):k,m.set(f,b)}return b};return e.layers.forEach((f,b)=>{let k=f.layout??{};if(f.type!=="symbol"||!$e(f,a))return;if(k["text-field"]===void 0&&k["icon-image"]===void 0)return;let d=u.get(f["source-layer"]??"");if(!d)return;let L={zoom:a,properties:{},type:"Unknown"},J=w(f,"layout","symbol-placement",L,"point")==="line"?"line":"point",W=J==="line"&&w(f,"layout","text-rotation-alignment",L,"auto")!=="viewport";for(let O of d.features){let P=me(O,a);if(!pe(f.filter,P))continue;let x=be(k["text-field"],P).trim(),v=be(k["icon-image"],P).trim();if(!x&&!v)continue;let p=w(f,"layout","text-transform",P,"none");if(p==="uppercase")x=x.toUpperCase();else if(p==="lowercase")x=x.toLowerCase();let g=w(f,"layout","text-font",P,["Noto Sans Regular"]),S=De(Array.isArray(g)&&typeof g[0]==="string"?g[0]:"Noto Sans Regular"),y=w(f,"layout","text-offset",P,[0,0]),I={layer:b,text:x,font:S,size:X(f.layout?.["text-size"])?Number(w(f,"layout","text-size",P,16)):h(f),color:String(w(f,"paint","text-color",P,"#000")),haloColor:String(w(f,"paint","text-halo-color",P,"rgba(0,0,0,0)")),haloWidth:Number(w(f,"paint","text-halo-width",P,0)),anchor:String(w(f,"layout","text-anchor",P,"center")),offset:Array.isArray(y)?[Number(y[0]??0),Number(y[1]??0)]:[0,0],maxWidth:Number(w(f,"layout","text-max-width",P,10)),lineHeight:Number(w(f,"layout","text-line-height",P,1.2)),overlap:qe(f,"text",P),...W?{textAlong:W}:{},...w(f,"layout","text-optional",P,!1)?{textOptional:!0}:{},...v?{icon:Nt(f,v,P,J,C)}:{}};if(O.type===1)for(let A of O.geometry)for(let R=0;R+1<A.length;R+=2){let[E,M]=[A[R]??0,A[R+1]??0];if(E<0||M<0||E>=d.extent||M>=d.extent)continue;let[T,N]=j(t,n,o,d.extent,E,M);l.push({...I,lon:T,lat:N})}else if(!x&&J==="line"){let A=Number(w(f,"layout","symbol-spacing",P,250))*d.extent/(512*2**(a-t));for(let R of O.geometry)for(let[E=0,M=0,T=0,N=0,D=0,q=0]of Lt(R,Math.max(A,1))){if(E<0||M<0||E>=d.extent||M>=d.extent)continue;let[F,B]=j(t,n,o,d.extent,E,M),[z,se]=j(t,n,o,d.extent,D,q),[ae,ue]=j(t,n,o,d.extent,T,N);l.push({...I,lon:F,lat:B,along:[z-ae,se-ue]})}}else{let A,R=0;for(let M of O.geometry){let T=0;for(let N=2;N+1<M.length;N+=2)T+=Math.hypot((M[N]??0)-(M[N-2]??0),(M[N+1]??0)-(M[N-1]??0));if(T>R)R=T,A=M}if(!A||R<d.extent/32)continue;let E=R/2;for(let M=2;M+1<A.length;M+=2){let[T,N,D,q]=[A[M-2]??0,A[M-1]??0,A[M]??0,A[M+1]??0],F=Math.hypot(D-T,q-N);if(F>=E&&F>0){let[B,z]=[T+(D-T)*E/F,N+(q-N)*E/F];if(B<0||z<0||B>=d.extent||z>=d.extent)break;let[se,ae]=j(t,n,o,d.extent,B,z),[ue,He]=j(t,n,o,d.extent,D,q),[Ve,We]=j(t,n,o,d.extent,T,N);l.push({...I,lon:se,lat:ae,...J==="line"?{along:[ue-Ve,He-We]}:{}});break}E-=F}}}}),l}var V=(e,t=[])=>self.postMessage(e,t);self.onmessage=async({data:e})=>{if(e.type==="init"){if(e.workers!==void 0)ie.capacity=gt(e.workers);oe.set(e.key,{tiles:e.tiles,maxzoom:e.maxzoom,layers:e.layers,rasters:e.rasters??{},sprites:e.sprites??[],patterns:new Map});return}if(e.type==="drop"){for(let n of oe.get(e.key)?.sprites??[])n.image.close();oe.delete(e.key);return}if(e.type==="abort"){if(ge.has(e.id))Y.add(e.id);we.get(e.id)?.abort();return}if(e.type==="heights"||e.type==="reproject"){await Et(e);return}ge.add(e.id);let t=oe.get(e.key);try{if(!t)throw Error(`no renderer ${e.key}`);if(e.type==="render"){let n=await Mt(t,e.z,e.x,e.y,e.size,e.id,e.priority);if(n)V({id:e.id,image:n},[n]);else V({id:e.id,missing:!0})}else V({id:e.id,labels:await Tt(t,e.z,e.x,e.y,e.id,e.priority,e.zoom)})}catch(n){V({id:e.id,error:String(n)})}finally{ge.delete(e.id),Y.delete(e.id)}};async function Et(e){let t=new AbortController;we.set(e.id,t);try{if(e.type==="heights"){let n=await Ie(e.url,e.encoding,e.floor,t.signal,yt);if(n)V({id:e.id,heights:n},[n.buffer]);else V({id:e.id,missing:!0})}else{Fe.cache.capacity=e.cached;let n=await Fe.draw(e.job,t.signal);if(n)V({id:e.id,image:n},[n]);else V({id:e.id,missing:!0})}}catch(n){V({id:e.id,error:String(n)})}finally{we.delete(e.id)}}export{gt as cacheShare,Lt as lineAnchors,St as tileImage};
|
|
1
|
+
function Ae(e){return e*360-180}function Me(e){return Math.atan(Math.sinh(Math.PI*(1-2*e)))*180/Math.PI}class q{capacity;evict;entries=new Map;constructor(e,t){this.capacity=e;this.evict=t}get size(){return this.entries.size}get(e){let t=this.entries.get(e);if(t!==void 0)this.entries.delete(e),this.entries.set(e,t);return t}has(e){return this.entries.has(e)}set(e,t){this.entries.delete(e),this.entries.set(e,t);for(let[n,o]of this.entries){if(this.entries.size<=this.capacity)break;this.entries.delete(n),this.evict?.(o,n)}}delete(e){return this.entries.delete(e)}values(){return this.entries.values()}clear(){this.entries.clear()}}class fe{buf;end;pos;constructor(e,t=0,n=e.length){this.buf=e;this.end=n;this.pos=t}varint(){let e=0;for(let t=0;t<70;t+=7){let n=this.buf[this.pos++]??0;if(e+=(n&127)*2**t,n<128)break}return e}int64(){let e=0,t=0;for(let n=0;n<10;n+=1){let o=this.buf[this.pos++]??0,r=o&127;if(n<4)e|=r<<7*n;else if(n===4)e|=(r&15)<<28,t|=r>>4;else t|=r<<7*n-32;if(o<128)break}return(t|0)*4294967296+(e>>>0)}sint(){let e=this.varint();return e%2===1?-(e+1)/2:e/2}sub(){let e=this.varint(),t=Math.min(this.pos+e,this.end),n=new fe(this.buf,this.pos,t);return this.pos=t,n}string(){let e=this.varint(),t=Math.min(this.pos+e,this.end),n=Xe.decode(this.buf.subarray(this.pos,t));return this.pos=t,n}float(){let e=this.pos+4<=this.end?this.view().getFloat32(this.pos,!0):0;return this.pos+=4,e}double(){let e=this.pos+8<=this.end?this.view().getFloat64(this.pos,!0):0;return this.pos+=8,e}view(){return new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength)}skip(e){if(e===0)this.varint();else if(e===1)this.pos+=8;else if(e===2)this.pos+=this.varint();else if(e===5)this.pos+=4}get more(){return this.pos<this.end}}var Xe=new TextDecoder;function Ye(e){let t="";while(e.more){let n=e.varint();switch(n>>3){case 1:t=e.string();break;case 2:t=e.float();break;case 3:t=e.double();break;case 4:t=e.int64();break;case 5:t=e.varint();break;case 6:t=e.sint();break;case 7:t=e.varint()!==0;break;default:e.skip(n&7)}}return t}function Ge(e){let t=[],n,[o,r]=[0,0];while(e.more){let i=e.varint(),a=i&7,s=i>>3;if(a===7){if(n&&n.length>=2)n.push(n[0]??0,n[1]??0);continue}for(let u=0;u<s&&e.more;u+=1){if(o+=e.sint(),r+=e.sint(),a===1)n=[],t.push(n);n?.push(o,r)}}return t}function me(e,t){let n=new Map,o=new fe(e);while(o.more){let r=o.varint();if(r>>3!==3){o.skip(r&7);continue}let i=o.sub(),a="",s=4096,u=[],l=[],c=[];while(i.more){let m=i.varint();switch(m>>3){case 1:a=i.string();break;case 2:c.push(i.sub());break;case 3:u.push(i.string());break;case 4:l.push(Ye(i.sub()));break;case 5:s=i.varint();break;default:i.skip(m&7)}}if(t&&!t.has(a))continue;let h=[];for(let m of c){let C=1,f={},b=[];while(m.more){let k=m.varint();switch(k>>3){case 2:{let d=m.sub();while(d.more){let R=u[d.varint()],O=l[d.varint()];if(R!==void 0&&O!==void 0)f[R]=O}break}case 3:C=Math.min(3,Math.max(1,m.varint()));break;case 4:b=Ge(m.sub());break;default:m.skip(k&7)}}h.push({type:C,properties:f,geometry:b})}n.set(a,{extent:s,features:h})}return n}var Se=[];function Pe(e){Se=e}function W(e,t){let n=String(e),o=Se.filter(([i])=>n.startsWith(i));if(o.length===0)return t??{};let r=new Headers(t?.headers);for(let[,i]of o)for(let[a,s]of Object.entries(i))r.set(a,s);return{...t??{},headers:r}}var Qe=127,et=16384,tt=["unknown","mvt","png","jpeg","webp","avif"],nt=(e)=>(4**e-1)/3;function rt(e,t,n){if(e>26)throw Error(`isard: PMTiles level ${e} past 26`);let o=2**e;if(t<0||n<0||t>=o||n>=o)throw Error(`isard: PMTiles tile ${e}/${t}/${n} out of its level`);let[r,i]=[t,n],a=0;for(let s=o/2;s>=1;s/=2){let u=(r&s)>0?1:0,l=(i&s)>0?1:0;if(a+=s*s*(3*u^l),l===0){if(u===1)[r,i]=[s-1-r,s-1-i];[r,i]=[i,r]}}return nt(e)+a}class Re{bytes;pos=0;constructor(e){this.bytes=e}next(){let e=0,t=1;for(;;){let n=this.bytes[this.pos++];if(n===void 0)throw Error("isard: PMTiles directory truncated");if(e+=(n&127)*t,n<128)return e;if(t*=128,t>9223372036854776000)throw Error("isard: PMTiles varint too long")}}}function Ce(e){let t=new Re(e),n=t.next();if(n>e.length)throw Error("isard: PMTiles directory larger than its bytes");let o=[],r=0;for(let i=0;i<n;i+=1)r+=t.next(),o.push({tileId:r,offset:0,length:0,runLength:1});for(let i of o)i.runLength=t.next();for(let i of o)i.length=t.next();return o.forEach((i,a)=>{let s=t.next(),u=o[a-1];i.offset=s===0&&u?u.offset+u.length:s-1}),o}function ot(e,t){let[n,o]=[0,e.length-1];while(n<=o){let i=n+o>>1,a=e[i];if(a.tileId===t)return a;if(a.tileId<t)n=i+1;else o=i-1}let r=e[o];if(!r)return;if(r.runLength===0||t-r.tileId<r.runLength)return r;return}function it(e){if(e.length<Qe||String.fromCharCode(...e.subarray(0,7))!=="PMTiles")throw Error("isard: not a PMTiles archive");if(e[7]!==3)throw Error(`isard: PMTiles version ${e[7]} (only 3 is read)`);let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=(r)=>Number(t.getBigUint64(r,!0)),o=(r)=>t.getInt32(r,!0)/1e7;return{rootDirectoryOffset:n(8),rootDirectoryLength:n(16),metadataOffset:n(24),metadataLength:n(32),leafDirectoryOffset:n(40),leafDirectoryLength:n(48),tileDataOffset:n(56),tileDataLength:n(64),internalCompression:t.getUint8(97),tileCompression:t.getUint8(98),tileType:tt[t.getUint8(99)]??"unknown",minZoom:t.getUint8(100),maxZoom:t.getUint8(101),bounds:[o(102),o(106),o(110),o(114)],center:[o(119),o(123),t.getUint8(118)]}}async function ee(e,t){if(t===0||t===1)return e;if(t!==2)throw Error(`isard: PMTiles compression ${t===3?"brotli":"zstd"} is not read (gzip only)`);let n=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip"));return new Uint8Array(await new Response(n).arrayBuffer())}var st=67108864;class Te{source;head;leaves=new q(64);whole;constructor(e){this.source=e}async range(e,t,n){if(typeof this.source!=="string")return new Uint8Array(await this.source.slice(e,e+t).arrayBuffer());if(this.whole)return(await this.whole).subarray(e,e+t);let o=await fetch(this.source,W(this.source,{headers:{Range:`bytes=${e}-${e+Math.max(t,1)-1}`},...n?{signal:n}:{}}));if(!o.ok)throw Error(`${this.source}: HTTP ${o.status}`);if(o.status===206)return new Uint8Array(await o.arrayBuffer());if(Number(o.headers.get("Content-Length"))>st)throw await o.body?.cancel(),Error(`${this.source}: the server ignores range requests (HTTP 206 expected)`);let i=o.arrayBuffer().then((a)=>new Uint8Array(a));return this.whole=i,i.catch(()=>{this.whole=void 0}),(await i).subarray(e,e+t)}load(){return this.head??=(async()=>{let e=await this.range(0,et),t=it(e),{rootDirectoryOffset:n,rootDirectoryLength:o}=t,r=n+o<=e.length?e.subarray(n,n+o):await this.range(n,o),i=Ce(await ee(r,t.internalCompression));return{header:t,root:i}})(),this.head.catch(()=>{this.head=void 0}),this.head}async header(){return(await this.load()).header}async metadata(){let{header:e}=await this.load();if(e.metadataLength===0)return{};let t=await this.range(e.metadataOffset,e.metadataLength),n=new TextDecoder().decode(await ee(t,e.internalCompression)),o=JSON.parse(n);return o&&typeof o==="object"&&!Array.isArray(o)?o:{}}leaf(e,t){let n=e.leafDirectoryOffset+t.offset,o=this.leaves.get(n);if(!o)o=this.range(n,t.length).then(async(r)=>Ce(await ee(r,e.internalCompression))),o.catch(()=>this.leaves.delete(n)),this.leaves.set(n,o);return o}async tile(e,t,n,o){let{header:r,root:i}=await this.load();if(e<r.minZoom||e>r.maxZoom)return;let a=rt(e,t,n),s=i;for(let u=0;u<4;u+=1){let l=ot(s,a);if(!l)return;if(l.runLength>0){let c=await this.range(r.tileDataOffset+l.offset,l.length,o);return ee(c,r.tileCompression)}s=await this.leaf(r,l)}throw Error("isard: PMTiles directories nested too deep")}}var Le=new q(16);function at(e){let t=Le.get(e);if(!t)t=new Te(e),Le.set(e,t);return t}function de(e,t){let n=/^pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)$/.exec(e);if(!n)return!1;let[,o="",r,i,a]=n;return at(o).tile(Number(r),Number(i),Number(a),t)}var ut=96;function lt(e,t,n,o,r,i){let a=new Uint8ClampedArray(i*i*4),s=i/r,u=r+1;for(let l=0;l<i;l+=1){let c=(l+0.5)/s,h=Math.min(r-1,Math.floor(c)),m=c-h;for(let C=0;C<i;C+=1){let f=(C+0.5)/s,b=Math.min(r-1,Math.floor(f)),k=f-b,d=2*(h*u+b),R=d+2*u,O=(1-k)*(1-m),j=k*(1-m),J=(1-k)*m,P=k*m,x=O*o[d]+j*o[d+2]+J*o[R]+P*o[R+2],v=O*o[d+1]+j*o[d+3]+J*o[R+1]+P*o[R+3],p=x-0.5,g=v-0.5;if(!(p>-1&&g>-1&&p<t&&g<n))continue;let M=Math.floor(p),y=Math.floor(g),L=p-M,A=g-y,E=0,I=0,S=0,N=0;for(let D=0;D<4;D+=1){let H=M+(D&1),F=y+(D>>1);if(H<0||F<0||H>=t||F>=n)continue;let B=4*(F*t+H),U=(D&1?L:1-L)*(D>>1?A:1-A)*e[B+3];E+=U*e[B],I+=U*e[B+1],S+=U*e[B+2],N+=U}if(N<=0)continue;let T=4*(l*i+C);a[T]=E/N,a[T+1]=I/N,a[T+2]=S/N,a[T+3]=N}}return a}function Ne(e=ut){let t=new Map,n=new Set,o=(l)=>{n.delete(l),l.then((c)=>c?.close(),()=>{return})},r=(l)=>{if(t.has(l))n.add(l);else o(l)},i=new q(e,r),a=(l)=>{let c=(t.get(l)??1)-1;if(c>0)t.set(l,c);else if(t.delete(l),n.has(l))o(l)},s=(l)=>{let c=i.get(l);if(!c)c=(async()=>{let h=await fetch(l,W(l));if(h.status===404||h.status===204||h.status===410)return null;if(!h.ok)throw Error(`isard: ${h.status} for a raster to reproject`);return createImageBitmap(await h.blob())})(),c.catch(()=>i.delete(l)),i.set(l,c);return t.set(c,(t.get(c)??0)+1),c};return{draw:async(l,c)=>{let h=l.sources.map((m)=>[m,s(m.url)]);try{let m=await Promise.all(h.map(async([d,R])=>[d,await R]));if(c.throwIfAborted(),!m.some(([,d])=>d))return null;let f=new OffscreenCanvas(l.width,l.height).getContext("2d",{willReadFrequently:!0});if(!f)throw Error("isard: no 2D canvas to reproject the tiles");for(let[d,R]of m)if(R)f.drawImage(R,d.x,d.y,d.w,d.h);let b=f.getImageData(0,0,l.width,l.height).data,k=lt(b,l.width,l.height,l.mesh,l.n,l.size);return createImageBitmap(new ImageData(k,l.size,l.size),{premultiplyAlpha:"none"})}finally{for(let[,m]of h)a(m)}},cache:i,close:()=>{for(let l of i.values())r(l);i.clear()}}}var _=256;function ct(e,t,n=Number.NEGATIVE_INFINITY){let o=e.length>>2,r=new Float32Array(o);if(t==="terrarium")for(let i=0,a=0;i<o;i+=1,a+=4){let s=e[a]*256+e[a+1]+e[a+2]/256-32768;r[i]=s>n?s:n}else for(let i=0,a=0;i<o;i+=1,a+=4){let s=-1e4+(e[a]*65536+e[a+1]*256+e[a+2])*0.1;r[i]=s>n?s:n}return r}async function Ie(e,t,n,o,r){let i=await fetch(e,W(e,{signal:o}));if(i.status===404||i.status===204||i.status===410)return null;if(!i.ok)throw Error(`${i.url}: ${i.status}`);let a=await createImageBitmap(await i.blob(),{premultiplyAlpha:"none",colorSpaceConversion:"none"});try{r.canvas??=new OffscreenCanvas(_,_);let s=r.canvas.getContext("2d",{willReadFrequently:!0});if(!s)throw Error("no 2D context");return s.imageSmoothingEnabled=!1,s.clearRect(0,0,_,_),s.drawImage(a,0,0,_,_),ct(s.getImageData(0,0,_,_).data,t,n)}finally{a.close()}}var ft="aliceblue f0f8ff antiquewhite faebd7 aqua 00ffff aquamarine 7fffd4 azure f0ffff beige f5f5dc bisque ffe4c4 black 000000 blanchedalmond ffebcd blue 0000ff blueviolet 8a2be2 brown a52a2a burlywood deb887 cadetblue 5f9ea0 chartreuse 7fff00 chocolate d2691e coral ff7f50 cornflowerblue 6495ed cornsilk fff8dc crimson dc143c cyan 00ffff darkblue 00008b darkcyan 008b8b darkgoldenrod b8860b darkgray a9a9a9 darkgreen 006400 darkgrey a9a9a9 darkkhaki bdb76b darkmagenta 8b008b darkolivegreen 556b2f darkorange ff8c00 darkorchid 9932cc darkred 8b0000 darksalmon e9967a darkseagreen 8fbc8f darkslateblue 483d8b darkslategray 2f4f4f darkslategrey 2f4f4f darkturquoise 00ced1 darkviolet 9400d3 deeppink ff1493 deepskyblue 00bfff dimgray 696969 dimgrey 696969 dodgerblue 1e90ff firebrick b22222 floralwhite fffaf0 forestgreen 228b22 fuchsia ff00ff gainsboro dcdcdc ghostwhite f8f8ff gold ffd700 goldenrod daa520 gray 808080 green 008000 greenyellow adff2f grey 808080 honeydew f0fff0 hotpink ff69b4 indianred cd5c5c indigo 4b0082 ivory fffff0 khaki f0e68c lavender e6e6fa lavenderblush fff0f5 lawngreen 7cfc00 lemonchiffon fffacd lightblue add8e6 lightcoral f08080 lightcyan e0ffff lightgoldenrodyellow fafad2 lightgray d3d3d3 lightgreen 90ee90 lightgrey d3d3d3 lightpink ffb6c1 lightsalmon ffa07a lightseagreen 20b2aa lightskyblue 87cefa lightslategray 778899 lightslategrey 778899 lightsteelblue b0c4de lightyellow ffffe0 lime 00ff00 limegreen 32cd32 linen faf0e6 magenta ff00ff maroon 800000 mediumaquamarine 66cdaa mediumblue 0000cd mediumorchid ba55d3 mediumpurple 9370db mediumseagreen 3cb371 mediumslateblue 7b68ee mediumspringgreen 00fa9a mediumturquoise 48d1cc mediumvioletred c71585 midnightblue 191970 mintcream f5fffa mistyrose ffe4e1 moccasin ffe4b5 navajowhite ffdead navy 000080 oldlace fdf5e6 olive 808000 olivedrab 6b8e23 orange ffa500 orangered ff4500 orchid da70d6 palegoldenrod eee8aa palegreen 98fb98 paleturquoise afeeee palevioletred db7093 papayawhip ffefd5 peachpuff ffdab9 peru cd853f pink ffc0cb plum dda0dd powderblue b0e0e6 purple 800080 rebeccapurple 663399 red ff0000 rosybrown bc8f8f royalblue 4169e1 saddlebrown 8b4513 salmon fa8072 sandybrown f4a460 seagreen 2e8b57 seashell fff5ee sienna a0522d silver c0c0c0 skyblue 87ceeb slateblue 6a5acd slategray 708090 slategrey 708090 snow fffafa springgreen 00ff7f steelblue 4682b4 tan d2b48c teal 008080 thistle d8bfd8 tomato ff6347 turquoise 40e0d0 violet ee82ee wheat f5deb3 white ffffff whitesmoke f5f5f5 yellow ffff00 yellowgreen 9acd32",te;function mt(e){if(!te){te=new Map;let t=ft.split(" ");for(let n=0;n+1<t.length;n+=2)te.set(t[n],t[n+1])}return te.get(e)}var ne=(e)=>Number.isFinite(e)?Math.max(0,Math.min(1,e)):0;function Ee(e){if(!/^[0-9a-f]+$/.test(e)||![3,4,6,8].includes(e.length))return;let t=e.length<=4?[...e].map((o)=>o+o).join(""):e,n=(o)=>Number.parseInt(t.slice(o,o+2),16)/255;return[n(0),n(2),n(4),t.length===8?n(6):1]}function dt(e){if(e===void 0)return 1;return ne(e.endsWith("%")?Number.parseFloat(e)/100:Number.parseFloat(e))}function pt(e,t,n){let o=n<0.5?n*(1+t):n+t-n*t,r=2*n-o,i=(a)=>{let s=(a%1+1)%1;if(s<0.16666666666666666)return r+(o-r)*6*s;if(s<0.5)return o;if(s<0.6666666666666666)return r+(o-r)*(0.6666666666666666-s)*6;return r};return[i(e+0.3333333333333333),i(e),i(e-0.3333333333333333)]}function Oe(e){if(typeof e!=="string")return;let t=e.trim().toLowerCase();if(t.startsWith("#"))return Ee(t.slice(1));if(t==="transparent")return[0,0,0,0];let n=mt(t);if(n)return Ee(n);let o=/^(rgba?|hsla?)\(([^)]*)\)$/.exec(t);if(!o?.[1]||o[2]===void 0)return;let r=o[2].split(/[\s,/]+/).filter(Boolean);if(r.length<3||r.slice(0,3).some((c)=>Number.isNaN(Number.parseFloat(c))))return;let i=dt(r[3]);if(o[1].startsWith("rgb")){let c=(h)=>ne(h.endsWith("%")?Number.parseFloat(h)/100:Number.parseFloat(h)/255);return[c(r[0]),c(r[1]),c(r[2]),i]}let a=Number.parseFloat(r[0])/360,[s,u,l]=pt(a,ne(Number.parseFloat(r[1])/100),ne(Number.parseFloat(r[2])/100));return[s,u,l,i]}var bt=["Unknown","Point","LineString","Polygon"];function pe(e,t){return{zoom:t,properties:e.properties,type:bt[e.type]??"Unknown"}}function X(e){return Oe(e)}function oe([e,t,n,o]){return`rgba(${Math.round(e*255)},${Math.round(t*255)},${Math.round(n*255)},${o})`}function Fe(e,t,n,o=1){let r=n-t;if(r===0)return 0;let i=e-t;return o===1?i/r:(o**i-1)/(o**r-1)}function be(e,t,n){if(typeof e==="number"&&typeof t==="number")return e+(t-e)*n;let o=X(e),r=X(t);if(o&&r)return oe([0,1,2,3].map((i)=>(o[i]??0)+((r[i]??0)-(o[i]??0))*n));if(Array.isArray(e)&&Array.isArray(t))return e.map((i,a)=>be(i,t[a],n));return n<0.5?e:t}function Be(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)&&Array.isArray(e.stops)}function ht(e,t){let n=e.property===void 0?t.zoom:t.properties[e.property],o=e.stops,r=e.type??(e.property===void 0||typeof o[0]?.[0]==="number"?"exponential":"categorical");if(r==="identity")return n??e.default;if(r==="categorical")return o.find(([s])=>s===n)?.[1]??e.default;if(typeof n!=="number"||!o.length)return e.default??o[0]?.[1];let i=(s)=>typeof s[0]==="object"&&s[0]!==null?Number(s[0].zoom):Number(s[0]),a=o[0];if(!a)return e.default;if(n<=i(a))return a[1];for(let s=1;s<o.length;s+=1){let[u,l]=[o[s-1],o[s]];if(!u||!l)continue;if(n<i(l)){if(r==="interval")return u[1];return be(u[1],l[1],Fe(n,i(u),i(l),e.base??1))}}return o.at(-1)?.[1]}function re(e,t){if(t==="$type")return e.type;return typeof t==="string"?e.properties[t]:void 0}var gt=new Set(["literal","zoom","get","has","!has","properties","id","geometry-type","concat","format","image","number-format","to-number","to-string","to-boolean","to-color","number","string","boolean","typeof","length","at","upcase","downcase","coalesce","!","all","any","==","!=","<","<=",">",">=","in","case","match","step","interpolate","interpolate-hcl","interpolate-lab","rgb","rgba","+","-","*","/","%","^","min","max","abs","round","floor","ceil","sqrt","ln","log10","log2","pi","e"]);function ie(e){return Array.isArray(e)&&typeof e[0]==="string"&>.has(e[0])}var Je=new Set,Y=(e)=>e===void 0||e===null?"":String(e);function z(e,t){if(Be(e))return ht(e,t);if(!Array.isArray(e))return e;let[n,...o]=e;if(typeof n!=="string")return e;let r=(s)=>z(o[s]??null,t),i=(s)=>Number(r(s)),a=()=>o.map((s,u)=>i(u));switch(n){case"literal":return o[0];case"zoom":return t.zoom;case"get":return re(t,r(0));case"has":return re(t,r(0))!==void 0;case"!has":return re(t,r(0))===void 0;case"properties":return t.properties;case"id":return null;case"geometry-type":return t.type;case"concat":return o.map((s,u)=>Y(r(u))).join("");case"format":return o.map((s,u)=>s!==null&&typeof s==="object"&&!Array.isArray(s)?"":Y(r(u))).join("");case"image":return r(0);case"number-format":{let s=o[1]??{},u=i(0);if(!Number.isFinite(u))return"";return u.toLocaleString(s.locale,{minimumFractionDigits:s["min-fraction-digits"],maximumFractionDigits:s["max-fraction-digits"]})}case"to-number":{for(let s=0;s<o.length;s+=1){let u=r(s),l=typeof u==="string"&&u.trim()===""?Number.NaN:Number(u);if(u!==null&&u!==void 0&&!Number.isNaN(l))return l}return 0}case"to-string":return Y(r(0));case"to-boolean":{let s=r(0);return!(s===""||s===0||s===!1||s===null||s===void 0||Number.isNaN(s))}case"to-color":case"number":case"string":case"boolean":{let s={"to-color":(u)=>X(u)!==void 0,number:(u)=>typeof u==="number",string:(u)=>typeof u==="string",boolean:(u)=>typeof u==="boolean"};for(let u=0;u<o.length;u+=1){let l=r(u);if(s[n]?.(l))return l}return o.length?r(o.length-1):null}case"typeof":{let s=r(0);if(s===null||s===void 0)return"null";return Array.isArray(s)?"array":typeof s}case"length":{let s=r(0);return typeof s==="string"||Array.isArray(s)?s.length:0}case"at":{let s=r(1);return Array.isArray(s)?s[i(0)]??null:null}case"upcase":return Y(r(0)).toUpperCase();case"downcase":return Y(r(0)).toLowerCase();case"coalesce":for(let s=0;s<o.length;s+=1){let u=r(s);if(u!==void 0&&u!==null)return u}return null;case"!":return!r(0);case"all":return o.every((s,u)=>Boolean(r(u)));case"any":return o.some((s,u)=>Boolean(r(u)));case"==":return r(0)===r(1);case"!=":return r(0)!==r(1);case"<":return r(0)<r(1);case"<=":return r(0)<=r(1);case">":return r(0)>r(1);case">=":return r(0)>=r(1);case"in":{let s=r(1),u=r(0);if(typeof s==="string")return s.includes(String(u));return Array.isArray(s)&&s.includes(u)}case"case":{for(let s=0;s+1<o.length;s+=2)if(r(s))return r(s+1);return r(o.length-1)}case"match":{let s=r(0);for(let u=1;u+1<o.length;u+=2){let l=o[u];if(Array.isArray(l)?l.includes(s):l===s)return r(u+1)}return r(o.length-1)}case"step":{let s=i(0),u=r(1);for(let l=2;l+1<o.length;l+=2)if(s>=Number(o[l]))u=r(l+1);else break;return u}case"interpolate":case"interpolate-hcl":case"interpolate-lab":{let s=o[0],u=i(1),l=Array.isArray(s)&&s[0]==="exponential"?Number(s[1]):1,c=[];for(let m=2;m+1<o.length;m+=2)c.push([Number(o[m]),o[m+1]??null]);let h=c[0];if(!h)return null;if(u<=h[0])return z(h[1],t);for(let m=1;m<c.length;m+=1){let[C,f]=[c[m-1],c[m]];if(C&&f&&u<f[0])return be(z(C[1],t),z(f[1],t),Fe(u,C[0],f[0],l))}return z(c.at(-1)?.[1]??null,t)}case"rgb":case"rgba":return oe([i(0)/255,i(1)/255,i(2)/255,o.length>3?i(3):1]);case"+":return a().reduce((s,u)=>s+u,0);case"*":return a().reduce((s,u)=>s*u,1);case"-":return o.length===1?-i(0):i(0)-i(1);case"/":return i(0)/i(1);case"%":return i(0)%i(1);case"^":return i(0)**i(1);case"min":return Math.min(...a());case"max":return Math.max(...a());case"abs":return Math.abs(i(0));case"round":return Math.sign(i(0))*Math.round(Math.abs(i(0)));case"floor":return Math.floor(i(0));case"ceil":return Math.ceil(i(0));case"sqrt":return Math.sqrt(i(0));case"ln":return Math.log(i(0));case"log10":return Math.log10(i(0));case"log2":return Math.log2(i(0));case"pi":return Math.PI;case"e":return Math.E;default:if(!Je.has(n))Je.add(n),console.warn(`isard: the style expression "${n}" is not supported`);return null}}var yt=new Set(["==","!=","<","<=",">",">="]);function wt(e){let[t,n,...o]=e;if(typeof t!=="string"||typeof n!=="string"||o.some(Array.isArray))return!1;if(yt.has(t))return e.length===3;if(t==="in")return e.length!==3||!Array.isArray(e[2]);return t==="!in"||t==="has"||t==="!has"}function xt(e,t){let[n,o,...r]=e,i=re(t,o);switch(n){case"==":return i===r[0];case"!=":return i!==r[0];case"<":return i<r[0];case"<=":return i<=r[0];case">":return i>r[0];case">=":return i>=r[0];case"in":return r.includes(i);case"!in":return!r.includes(i);case"has":return i!==void 0;case"!has":return i===void 0;default:return!0}}var De=new WeakMap;function Ue(e){if(!Array.isArray(e))return()=>Boolean(e);let t=De.get(e);if(t)return t;let n,o=e[0];if(o==="all"||o==="any"||o==="none"){let r=e.slice(1).map(Ue);if(o==="all")n=(i)=>r.every((a)=>a(i));else if(o==="any")n=(i)=>r.some((a)=>a(i));else n=(i)=>!r.some((a)=>a(i))}else if(wt(e))n=(r)=>xt(e,r);else n=(r)=>Boolean(z(e,r));return De.set(e,n),n}function he(e,t){if(e===void 0||e===null)return!0;return Ue(e)(t)}function G(e){if(e!==void 0&&Be(e))return e.property!==void 0;if(!Array.isArray(e))return!1;if(["get","has","!has","geometry-type","properties","id"].includes(e[0]))return!0;return e.some((t)=>G(t))}function ge(e,t){if(e===void 0||e===null)return"";if(typeof e==="string")return e.replace(/\{([^}]+)\}/g,(o,r)=>{let i=t.properties[r];return i===void 0?"":String(i)});let n=z(e,t);if(Array.isArray(n))return n.filter((o)=>typeof o==="string").join("");return n===void 0||n===null?"":String(n)}function ze(e){return/Regular|Bold|Italic|Semibold|Light|Medium|Black/.test(e)?e:`${e} Regular`}function ye(e){let t=new Set,n=(a)=>{if(!Array.isArray(a))return;let s=(u)=>Array.isArray(u)&&u[0]==="zoom";if((a[0]==="interpolate"||a[0]==="interpolate-hcl"||a[0]==="interpolate-lab")&&s(a[2]))for(let u=3;u<a.length;u+=2)t.add(Number(a[u]));else if(a[0]==="step"&&s(a[1]))for(let u=3;u<a.length;u+=2){let l=Number(a[u]);t.add(l),t.add(l-0.01)}for(let u of a)n(u)};n(e);let o=[...t].filter(Number.isFinite);if(o.length===0)o.push(0);let[r,i]=[Math.min(...o),Math.max(...o)];for(let a=Math.ceil(r);a<=Math.floor(i);a+=1)o.push(a);return[...new Set(o)].sort((a,s)=>a-s).map((a)=>[a,Number(z(e,{zoom:a,properties:{},type:"Unknown"}))])}function $e(e,t){for(let n of e.sprites){let o=n.icons[t];if(o)return{icon:o,image:n.image}}return}var se=new Map,qe=96,ae=new q(qe);function vt(e){return Math.max(16,Math.ceil(qe/Math.max(1,e)))}var we=new Set,Q=new Set,ve=new Map,kt={},He=Ne(),xe=new q(64,(e)=>e.then((t)=>setTimeout(()=>t?.close(),0),()=>{return}));function At(e,t="auto"){let n=xe.get(e);if(n)return n;let o=(async()=>{let r=de(e);if(r){let s=await r;return s&&createImageBitmap(new Blob([s]))}let a=await fetch(e,W(e,{priority:t}));if(a.status===404||a.status===204)return;if(!a.ok)throw Error(`${e}: ${a.status}`);return createImageBitmap(await a.blob())})();return o.catch(()=>xe.delete(e)),xe.set(e,o),o}function We(e,t="auto"){let n=ae.get(e);if(n)return n;let o=(async()=>{let r=de(e);if(r){let i=await r;return i&&me(i)}for(let i=0;;i+=1){let s=await fetch(e,W(e,{priority:t}));if(s.status===404||s.status===204)return;if(s.ok)return me(new Uint8Array(await s.arrayBuffer()));if(i>=2)throw Error(`${e}: ${s.status}`);await new Promise((u)=>setTimeout(u,400*(i+1)))}})();return o.catch(()=>ae.delete(e)),ae.set(e,o),o}function Mt(e,t,n,o){let r=Math.max(0,Math.min(t-1,e.maxzoom)),i=t-r,a=2**Math.max(0,i),[s,u]=i>=0?[Math.floor(n/a),Math.floor(o/a)]:[n,o],l=e.tiles.replace("{z}",String(r)).replace("{x}",String(s)).replace("{y}",String(u)),c=1/a;return{url:l,vz:r,vx:s,vy:u,part:c,ox:n%a*c,oy:o%a*c}}var w=(e,t,n,o,r)=>{let i=e[t]?.[n];if(i===void 0)return r;let a=Array.isArray(i)&&!ie(i)?i:z(i,o);return a===void 0||a===null?r:a};function Z(e,t){let n=X(e)??[0,0,0,1];return oe([n[0],n[1],n[2],n[3]*t])}function Ve(e,t){if(e.layout?.visibility==="none")return!1;return t>=(e.minzoom??0)&&t<(e.maxzoom??24)}function St(e,t){if(e.patterns.has(t))return e.patterns.get(t);let n=$e(e,t),o;if(n&&n.icon.width>0&&n.icon.height>0){let{icon:r}=n;o=new OffscreenCanvas(r.width,r.height),o.getContext("2d")?.drawImage(n.image,r.x,r.y,r.width,r.height,0,0,r.width,r.height)}return e.patterns.set(t,o),o}var ke=new Map;function Pt(e){let t=ke.get(e)?.pop()??new OffscreenCanvas(e,e),n=t.getContext("2d",{willReadFrequently:!0});if(!n)throw Error("no 2D context");return n.setTransform(1,0,0,1,0,0),n.globalAlpha=1,n.setLineDash([]),n.clearRect(0,0,e,e),{canvas:t,g:n}}function Ct(e){let t=ke.get(e.width)??[];if(ke.set(e.width,t),t.length<4)t.push(e)}function Lt(e,t,n){if(n)return Promise.resolve(e.transferToImageBitmap());return createImageBitmap(t.getImageData(0,0,e.width,e.height),{premultiplyAlpha:"none"})}async function Rt(e,t,n,o,r,i,a){let s=Mt(e,t,n,o),u=await We(s.url,a);if(Q.has(i))return;let{canvas:l,g:c}=Pt(r);try{return await Tt(e,s,u,l,c,t,n,o,r,i,a)}finally{Ct(l)}}async function Tt(e,t,n,o,r,i,a,s,u,l,c){let h=Math.max(0,i-1),m=u/256,C=!1,f=!1;for(let b of e.layers){if(!Ve(b,h))continue;let k={zoom:h,properties:{},type:"Unknown"};if(b.type==="background"){let v=w(b,"paint","background-color",k,"#000"),p=Number(w(b,"paint","background-opacity",k,1));if(r.fillStyle=Z(v,p),r.fillRect(0,0,u,u),(X(v)??[0,0,0,1])[3]*p>=1)f=!0;C=!0;continue}if(b.type==="raster"){let v=b.source===void 0?void 0:e.rasters[b.source];if(!v)continue;let p=Math.max(0,Math.min(i-(v.tileSize>=512?1:0),v.maxzoom)),g=2**(i-p),M=v.tiles.replace("{z}",String(p)).replace("{x}",String(Math.floor(a/g))).replace("{y}",String(Math.floor(s/g))),y=await At(M,c).catch(()=>{return});if(Q.has(l))return;if(!y)continue;let[L,A]=[y.width/g,y.height/g];r.globalAlpha=Number(w(b,"paint","raster-opacity",k,1)),r.drawImage(y,a%g*L,s%g*A,L,A,0,0,u,u),r.globalAlpha=1,C=!0;continue}let d=n?.get(b["source-layer"]??"");if(!d)continue;let R=u/(d.extent*t.part),[O,j]=[t.ox*d.extent,t.oy*d.extent],J=(v,p)=>{r.beginPath();for(let g of v.geometry){for(let M=0;M+1<g.length;M+=2){let[y,L]=[((g[M]??0)-O)*R,((g[M+1]??0)-j)*R];if(M===0)r.moveTo(y,L);else r.lineTo(y,L)}if(p)r.closePath()}},P=new Map,x=(v,p,g,M)=>{let y=P.get(p);if(y===void 0)y=G(b[v]?.[p]),P.set(p,y);return w(b,v,p,y?g:k,M)};for(let v of d.features){let p=pe(v,h);if(!he(b.filter,p))continue;if(b.type==="fill-extrusion"&&v.type===3)J(v,!0),r.fillStyle=Z(x("paint","fill-extrusion-color",p,"#000"),Number(x("paint","fill-extrusion-opacity",p,1))),r.fill("evenodd"),C=!0;else if(b.type==="fill"&&v.type===3){let g=Number(x("paint","fill-opacity",p,1)),M=x("paint","fill-pattern",p,void 0);J(v,!0);let y=typeof M==="string"?$e(e,M)?.icon:void 0,L=y&&St(e,M);if(y&&L){let A=r.createPattern(L,"repeat");if(A)A.setTransform(new DOMMatrix().scale(m/(y.pixelRatio??1))),r.globalAlpha=g,r.fillStyle=A,r.fill("evenodd"),r.globalAlpha=1}else{r.fillStyle=Z(x("paint","fill-color",p,"#000"),g),r.fill("evenodd");let A=x("paint","fill-outline-color",p,void 0);if(A!==void 0)r.strokeStyle=Z(A,g),r.lineWidth=m,r.setLineDash([]),r.stroke()}C=!0}else if(b.type==="line"&&v.type!==1){let g=Number(x("paint","line-width",p,1));if(g<=0)continue;let M=Number(x("paint","line-gap-width",p,0));r.strokeStyle=Z(x("paint","line-color",p,"#000"),Number(x("paint","line-opacity",p,1))),r.lineWidth=(M>0?M+2*g:g)*m,r.lineCap=String(x("layout","line-cap",p,"butt")),r.lineJoin=String(x("layout","line-join",p,"miter"));let y=x("paint","line-dasharray",p,void 0);r.setLineDash(Array.isArray(y)?y.map((L)=>Number(L)*g*m):[]),J(v,v.type===3),r.stroke(),C=!0}else if(b.type==="circle"&&v.type===1){let g=Number(x("paint","circle-radius",p,5))*m;r.fillStyle=Z(x("paint","circle-color",p,"#000"),Number(x("paint","circle-opacity",p,1)));let M=Number(x("paint","circle-stroke-width",p,0))*m;r.strokeStyle=Z(x("paint","circle-stroke-color",p,"#000"),Number(x("paint","circle-stroke-opacity",p,1))),r.lineWidth=M;for(let y of v.geometry)for(let L=0;L+1<y.length;L+=2)if(r.beginPath(),r.arc(((y[L]??0)-O)*R,((y[L+1]??0)-j)*R,g,0,2*Math.PI),r.fill(),M>0)r.stroke();C=!0}}}if(!C&&!n)return null;return Lt(o,r,f)}function je(e,t,n){let o=Boolean(w(e,"layout",`${t}-allow-overlap`,n,!1)),r=Boolean(w(e,"layout",`${t}-ignore-placement`,n,!1));if(o&&r)return!0;if(o)return"allow";return r?"ignore":!1}function Nt(e,t){return Array.isArray(e)?[Number(e[0]??t[0]),Number(e[1]??t[1])]:t}function It(e){let t=(Array.isArray(e)?e:[e]).map((a)=>Number(a)||0),[n=0,o=n,r=n,i=o]=t;return[n,o,r,i]}function Et(e,t){let n=0;for(let a=2;a+1<e.length;a+=2)n+=Math.hypot((e[a]??0)-(e[a-2]??0),(e[a+1]??0)-(e[a-1]??0));let o=[];if(!(n>0)||!(t>0))return o;let r=Math.min(t/2,n/2),i=0;for(let a=2;a+1<e.length;a+=2){let[s,u,l,c]=[e[a-2]??0,e[a-1]??0,e[a]??0,e[a+1]??0],h=Math.hypot(l-s,c-u);while(h>0&&r<=i+h){let m=(r-i)/h;o.push([s+(l-s)*m,u+(c-u)*m,s,u,l,c]),r+=t}i+=h}return o}function K(e,t,n,o,r,i){let a=2**e;return[Ae((t+r/o)/a),Me((n+i/o)/a)]}function Ot(e,t,n,o,r){let i=w(e,"layout","icon-rotation-alignment",n,"auto"),a=String(w(e,"layout","icon-text-fit",n,"none")),s=w(e,"layout","icon-text-fit-padding",n,[0,0,0,0]);return{image:t,size:G(e.layout?.["icon-size"])?Number(w(e,"layout","icon-size",n,1)):r(e),anchor:String(w(e,"layout","icon-anchor",n,"center")),offset:Nt(w(e,"layout","icon-offset",n,[0,0]),[0,0]),rotate:Number(w(e,"layout","icon-rotate",n,0))||0,alignment:i==="map"||i==="auto"&&o==="line"?"map":"viewport",overlap:je(e,"icon",n),optional:Boolean(w(e,"layout","icon-optional",n,!1)),fit:a==="width"||a==="height"||a==="both"?a:"none",padding:It(s),color:String(w(e,"paint","icon-color",n,"#000")),opacity:Number(w(e,"paint","icon-opacity",n,1))}}async function Jt(e,t,n,o,r,i,a=t){let s=e.tiles.replace("{z}",String(t)).replace("{x}",String(n)).replace("{y}",String(o)),u=await We(s,i);if(!u||Q.has(r))return[];let l=[],c=new Map,h=(f)=>{let b=c.get(f);if(b===void 0){let k=f.layout?.["text-size"]??16;b=ie(k)?ye(k):k,c.set(f,b)}return b},m=new Map,C=(f)=>{let b=m.get(f);if(b===void 0){let k=f.layout?.["icon-size"]??1;b=ie(k)?ye(k):k,m.set(f,b)}return b};return e.layers.forEach((f,b)=>{let k=f.layout??{};if(f.type!=="symbol"||!Ve(f,a))return;if(k["text-field"]===void 0&&k["icon-image"]===void 0)return;let d=u.get(f["source-layer"]??"");if(!d)return;let R={zoom:a,properties:{},type:"Unknown"},O=w(f,"layout","symbol-placement",R,"point")==="line"?"line":"point",j=O==="line"&&w(f,"layout","text-rotation-alignment",R,"auto")!=="viewport";for(let J of d.features){let P=pe(J,a);if(!he(f.filter,P))continue;let x=ge(k["text-field"],P).trim(),v=ge(k["icon-image"],P).trim();if(!x&&!v)continue;let p=w(f,"layout","text-transform",P,"none");if(p==="uppercase")x=x.toUpperCase();else if(p==="lowercase")x=x.toLowerCase();let g=w(f,"layout","text-font",P,["Noto Sans Regular"]),M=ze(Array.isArray(g)&&typeof g[0]==="string"?g[0]:"Noto Sans Regular"),y=w(f,"layout","text-offset",P,[0,0]),L={layer:b,text:x,font:M,size:G(f.layout?.["text-size"])?Number(w(f,"layout","text-size",P,16)):h(f),color:String(w(f,"paint","text-color",P,"#000")),haloColor:String(w(f,"paint","text-halo-color",P,"rgba(0,0,0,0)")),haloWidth:Number(w(f,"paint","text-halo-width",P,0)),anchor:String(w(f,"layout","text-anchor",P,"center")),offset:Array.isArray(y)?[Number(y[0]??0),Number(y[1]??0)]:[0,0],maxWidth:Number(w(f,"layout","text-max-width",P,10)),lineHeight:Number(w(f,"layout","text-line-height",P,1.2)),overlap:je(f,"text",P),...j?{textAlong:j}:{},...w(f,"layout","text-optional",P,!1)?{textOptional:!0}:{},...v?{icon:Ot(f,v,P,O,C)}:{}};if(J.type===1)for(let A of J.geometry)for(let E=0;E+1<A.length;E+=2){let[I,S]=[A[E]??0,A[E+1]??0];if(I<0||S<0||I>=d.extent||S>=d.extent)continue;let[N,T]=K(t,n,o,d.extent,I,S);l.push({...L,lon:N,lat:T})}else if(!x&&O==="line"){let A=Number(w(f,"layout","symbol-spacing",P,250))*d.extent/(512*2**(a-t));for(let E of J.geometry)for(let[I=0,S=0,N=0,T=0,D=0,H=0]of Et(E,Math.max(A,1))){if(I<0||S<0||I>=d.extent||S>=d.extent)continue;let[F,B]=K(t,n,o,d.extent,I,S),[U,ue]=K(t,n,o,d.extent,D,H),[le,ce]=K(t,n,o,d.extent,N,T);l.push({...L,lon:F,lat:B,along:[U-le,ue-ce]})}}else{let A,E=0;for(let S of J.geometry){let N=0;for(let T=2;T+1<S.length;T+=2)N+=Math.hypot((S[T]??0)-(S[T-2]??0),(S[T+1]??0)-(S[T-1]??0));if(N>E)E=N,A=S}if(!A||E<d.extent/32)continue;let I=E/2;for(let S=2;S+1<A.length;S+=2){let[N,T,D,H]=[A[S-2]??0,A[S-1]??0,A[S]??0,A[S+1]??0],F=Math.hypot(D-N,H-T);if(F>=I&&F>0){let[B,U]=[N+(D-N)*I/F,T+(H-T)*I/F];if(B<0||U<0||B>=d.extent||U>=d.extent)break;let[ue,le]=K(t,n,o,d.extent,B,U),[ce,_e]=K(t,n,o,d.extent,D,H),[Ze,Ke]=K(t,n,o,d.extent,N,T);l.push({...L,lon:ue,lat:le,...O==="line"?{along:[ce-Ze,_e-Ke]}:{}});break}I-=F}}}}),l}var V=(e,t=[])=>self.postMessage(e,t);self.onmessage=async({data:e})=>{if(e.type==="headers"){Pe(e.rules);return}if(e.type==="init"){if(e.workers!==void 0)ae.capacity=vt(e.workers);se.set(e.key,{tiles:e.tiles,maxzoom:e.maxzoom,layers:e.layers,rasters:e.rasters??{},sprites:e.sprites??[],patterns:new Map});return}if(e.type==="drop"){for(let n of se.get(e.key)?.sprites??[])n.image.close();se.delete(e.key);return}if(e.type==="abort"){if(we.has(e.id))Q.add(e.id);ve.get(e.id)?.abort();return}if(e.type==="heights"||e.type==="reproject"){await Dt(e);return}we.add(e.id);let t=se.get(e.key);try{if(!t)throw Error(`no renderer ${e.key}`);if(e.type==="render"){let n=await Rt(t,e.z,e.x,e.y,e.size,e.id,e.priority);if(n)V({id:e.id,image:n},[n]);else V({id:e.id,missing:!0})}else V({id:e.id,labels:await Jt(t,e.z,e.x,e.y,e.id,e.priority,e.zoom)})}catch(n){V({id:e.id,error:String(n)})}finally{we.delete(e.id),Q.delete(e.id)}};async function Dt(e){let t=new AbortController;ve.set(e.id,t);try{if(e.type==="heights"){let n=await Ie(e.url,e.encoding,e.floor,t.signal,kt);if(n)V({id:e.id,heights:n},[n.buffer]);else V({id:e.id,missing:!0})}else{He.cache.capacity=e.cached;let n=await He.draw(e.job,t.signal);if(n)V({id:e.id,image:n},[n]);else V({id:e.id,missing:!0})}}catch(n){V({id:e.id,error:String(n)})}finally{ve.delete(e.id)}}export{vt as cacheShare,Et as lineAnchors,Lt as tileImage};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=5076A77936D7FFEB64756E2164756E21
|
|
4
4
|
//# sourceMappingURL=basemap.worker.js.map
|