isard 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +76 -14
- package/dist/basemap.worker.d.ts +10 -0
- package/dist/basemap.worker.js +2 -2
- package/dist/basemap.worker.js.map +3 -3
- package/dist/basemaps.d.ts +5 -3
- package/dist/basemaps.js +5 -3
- package/dist/basemaps.js.map +1 -1
- package/dist/decoder.worker.js +3 -3
- package/dist/decoder.worker.js.map +3 -3
- package/dist/equirectangular.d.ts +6 -6
- package/dist/equirectangular.js +54 -24
- package/dist/equirectangular.js.map +1 -1
- package/dist/extrusions.js +11 -2
- package/dist/extrusions.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +3 -0
- package/dist/interaction.js +19 -3
- 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 +4 -1
- package/dist/layers.js +14 -5
- package/dist/layers.js.map +1 -1
- package/dist/map.d.ts +10 -2
- package/dist/map.js +172 -33
- package/dist/map.js.map +1 -1
- package/dist/terrain.js +30 -18
- package/dist/terrain.js.map +1 -1
- package/dist/types.d.ts +11 -3
- package/dist/types.js.map +1 -1
- package/dist/vectortiles.d.ts +3 -0
- package/dist/vectortiles.js +21 -5
- package/dist/vectortiles.js.map +1 -1
- package/dist/wasm/isard.d.ts +6 -5
- package/dist/wasm/isard.js +27 -10
- package/dist/wasm/isard_core.d.ts +6 -5
- package/dist/wasm/isard_core.js +35 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,57 @@
|
|
|
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.2.1] - 2026-10-18
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
|
|
10
|
+
- A mouse moving over a map with no `hover` nor `hoverfeature` listener draws nothing (it drew a frame per move);
|
|
11
|
+
the position under the pointer is computed only for `hover` listeners.
|
|
12
|
+
- Vector basemap workers: each keeps its share of the pool's decoded tiles (96 in all, instead of 96 each); an opaque
|
|
13
|
+
tile is moved out of its canvas instead of being copied; their canvases are reused. Images no longer used (evicted
|
|
14
|
+
source tiles of equirectangular rasters and of a style's raster layers, a style's sprite) are freed at once.
|
|
15
|
+
- The pointer's position no longer reads the layout at every move; the Terrarium and Terrain-RGB relief decodes
|
|
16
|
+
faster.
|
|
17
|
+
- `RasterLayer.setStyle(opacity, saturation)` is deprecated: `setStyle({ opacity, saturation })`, either value alone
|
|
18
|
+
(the positional form still works, and still sets the saturation back to 1 when it is not given).
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- `tiles3d: 'preload'`: the engine with 3D Tiles downloaded and compiled once the map is idle, for its first 3D Tiles
|
|
23
|
+
layer; the map is rebuilt on it in a task of its own.
|
|
24
|
+
- `RasterLayer.setStyle({ opacity, saturation })` (`RasterStyle`), either value alone.
|
|
25
|
+
- NASA's relief of the Moon and Mars is credited by the attribution control (`terrain: true` there).
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- A WebGL context restored while the engine with 3D Tiles loads, or after it failed to, no longer throws: the 3D
|
|
30
|
+
Tiles layers wait for it, the others are created again; a layer that fails to be created again is reported and the
|
|
31
|
+
others are created. Buildings linked to a network above them keep the link after a context loss or the move onto
|
|
32
|
+
the engine with 3D Tiles.
|
|
33
|
+
- A destroyed map stays destroyed when its context comes back (no engine rebuilt, no tiles fetched), and glyphs
|
|
34
|
+
arriving after `destroy` no longer reach the freed engine.
|
|
35
|
+
- An equirectangular raster with a `minZoom` has no holes at its first levels.
|
|
36
|
+
- The hover picking stops polling when the engine cannot pick, and gives up an answer that never comes.
|
|
37
|
+
- `VectorTiles` no longer changes the style object it is given; `destroy()` removes its raster and label layers
|
|
38
|
+
from the map, and the map forgets it and a removed labels layer.
|
|
39
|
+
- An unknown basemap name throws `isard: unknown basemap '…'` (it failed on an undefined); a `'terrarium'` or
|
|
40
|
+
`'mapbox'` relief given an image service or a `{bbox}` URL throws instead of fetching the template, and every
|
|
41
|
+
`{z}`, `{x}`, `{y}` of its URL is replaced.
|
|
42
|
+
- A layer removed twice is removed once from the engine.
|
|
43
|
+
- Values that are not numbers or out of range no longer stop the engine: a minimum zoom above the maximum, a pitch
|
|
44
|
+
limit, camera, size or pick radius that is not a number (ignored); an infinite point in a circle, line or network
|
|
45
|
+
layer (left out); index arrays of lines, fills and labels pointing past their data.
|
|
46
|
+
- A 3D Tiles glb reusing one accessor in many primitives, or a tileset grafting itself, is an error instead of using
|
|
47
|
+
up the memory; a texture of the wrong size or format is left out instead of drawing black.
|
|
48
|
+
- More features than the GPU's textures hold throw an error instead of drawing black; a failed restyle or relabel
|
|
49
|
+
keeps the layer drawable.
|
|
50
|
+
- The relief's altitudes near the antimeridian are read on the right side of it; the RAF20 geoid is applied only when
|
|
51
|
+
asked (`geoid: true`) and only on the Earth.
|
|
52
|
+
- Tiles of a page's loader at another size are resized; lines and buildings of translucent colors no longer darken
|
|
53
|
+
where their pieces overlap.
|
|
54
|
+
- Browsing over a regional raster source no longer remembers every missing tile; 3D Tiles siblings are no longer
|
|
55
|
+
prefetched near the memory budget, only to be unloaded again.
|
|
56
|
+
|
|
6
57
|
## [0.2.0] - 2026-10-18
|
|
7
58
|
|
|
8
59
|
### Changed
|
|
@@ -25,6 +76,17 @@ versions [Semantic Versioning](https://semver.org) (before 1.0.0, a minor versio
|
|
|
25
76
|
the IGN only for the Géoplateforme's data, the Terrain Tiles (`OPENFREEMAP_ATTRIBUTION`, `IGN_ATTRIBUTION`,
|
|
26
77
|
`TERRAIN_TILES_ATTRIBUTION`; `DEFAULT_ATTRIBUTION` deprecated).
|
|
27
78
|
- Licence: © 2026 Kevin Graff.
|
|
79
|
+
- Fewer GPU readbacks (zoom anchored on the relief from the CPU), labels placed only when something moved, layers
|
|
80
|
+
out of view not drawn, an LRU for raster tiles.
|
|
81
|
+
- The vector basemap and the vector tiles of a map share one pool of workers and their decoded tiles; raster, vector
|
|
82
|
+
and 3D Tiles near the center of the view are fetched first (fetch priority).
|
|
83
|
+
- Circles and fills drawn by the squares in view only.
|
|
84
|
+
- The package ships its modules as they are (an application's bundler keeps what it uses), the workers and the
|
|
85
|
+
engine next to them; releases are published from the Release workflow, with provenance.
|
|
86
|
+
- A map without 3D Tiles downloads a third less WebAssembly: maps load the engine without 3D Tiles
|
|
87
|
+
(`isard_core_bg.wasm`, 220 KB gzipped instead of 330 KB) and the full one for their first 3D Tiles layer only
|
|
88
|
+
(`tiles3d: true` to load it from the start, `coreWasmUrl` for bundlers). Given `wasmUrl` alone, a map loads the full
|
|
89
|
+
engine from the start, as before.
|
|
28
90
|
|
|
29
91
|
### Added
|
|
30
92
|
|
|
@@ -34,7 +96,6 @@ versions [Semantic Versioning](https://semver.org) (before 1.0.0, a minor versio
|
|
|
34
96
|
- Relief tiles of PNG encodings: `terrain.encoding`, `'terrarium'` or `'mapbox'` (Terrain-RGB), decoded in the page.
|
|
35
97
|
- Vector basemaps: the raster layers of a style (its shaded relief), extrusions drawn flat, `line-gap-width`, text
|
|
36
98
|
sizes of zoom expressions; a text written over its icon (a road shield's number) is left out, icons not being drawn.
|
|
37
|
-
|
|
38
99
|
- 3D Tiles: implicit tiling (quadtree and octree, binary or JSON subtrees), several contents per tile, sparse and
|
|
39
100
|
zero-filled accessors, `texCoord` sets, content recognized by its bytes; horizon culling on the globe.
|
|
40
101
|
- Style expressions of vector basemaps: arithmetic, `format`, conversions, `coalesce`, `length`, `at`… (an unknown
|
|
@@ -76,19 +137,20 @@ versions [Semantic Versioning](https://semver.org) (before 1.0.0, a minor versio
|
|
|
76
137
|
- Lines, circles, labels and networks no longer jitter at high zoom over large layers.
|
|
77
138
|
- Circles and labels past the horizon of the globe are hidden instead of showing through it.
|
|
78
139
|
|
|
79
|
-
###
|
|
80
|
-
|
|
81
|
-
-
|
|
82
|
-
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
140
|
+
### Migrating from @ign-junn/isard 0.1.1
|
|
141
|
+
|
|
142
|
+
- The package: `npm install isard`, `import … from 'isard'` (instead of `@ign-junn/isard`).
|
|
143
|
+
- The basemaps: the default is `'osm-positron'` (OpenFreeMap), no longer PLAN.IGN; the Géoplateforme's are
|
|
144
|
+
`'ign-plan'`, `'ign-plan-grey'`, `'ign-ortho'`, `'ign-plan-vector'`, `'ign-plan-grey-vector'` (the former names
|
|
145
|
+
still work, with a warning). `basemap: 'ign-plan-grey'` brings back the former default (`'plan-grey'`).
|
|
146
|
+
- The hillshade: `setBasemap(basemap)` and the `hillshade` option default to 0 (0.4 before): pass `0.4` to keep the
|
|
147
|
+
IGN hillshade.
|
|
148
|
+
- The relief: `terrain: { exaggeration }` without `url` (and `terrain: true`) is now the worldwide Terrain Tiles;
|
|
149
|
+
`terrain: 'ign'` or `{ model: 'ign' }` for the IGN's model. A custom `terrain.url` no longer gets the RAF20 geoid by
|
|
150
|
+
default: add `geoid: true` to keep it.
|
|
151
|
+
- The credits: `AttributionControl` shows those of the sources in use (OpenFreeMap and OpenStreetMap, the IGN only
|
|
152
|
+
for its data, the Terrain Tiles, NASA); `DEFAULT_ATTRIBUTION` is deprecated (`IGN_ATTRIBUTION`); credit your own
|
|
153
|
+
rasters with `RasterOptions.attribution`, other data with `customAttribution`.
|
|
92
154
|
|
|
93
155
|
## [0.1.1] - 2026-10-16
|
|
94
156
|
|
package/dist/basemap.worker.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ export type BasemapRequest = {
|
|
|
30
30
|
rasters?: Record<string, RasterSource>;
|
|
31
31
|
/** The style's sprite, for the fill patterns (loaded once by the page) */
|
|
32
32
|
sprite?: Sprite;
|
|
33
|
+
/** Workers of the pool: each keeps its share of the decoded tiles */
|
|
34
|
+
workers?: number;
|
|
33
35
|
} | (BasemapWork & {
|
|
34
36
|
id: number;
|
|
35
37
|
}) | {
|
|
@@ -64,3 +66,11 @@ export interface Sprite {
|
|
|
64
66
|
pixelRatio?: number;
|
|
65
67
|
}>;
|
|
66
68
|
}
|
|
69
|
+
/** The decoded tiles one worker of `workers` keeps */
|
|
70
|
+
export declare function cacheShare(workers: number): number;
|
|
71
|
+
/**
|
|
72
|
+
* The image of a drawn canvas, its alpha straight (the engine blends straight alpha). An opaque tile (a background
|
|
73
|
+
* of full opacity, as a basemap's) is moved out of the canvas as it is, premultiplied and straight being the same
|
|
74
|
+
* there; another one is read back unpremultiplied, copied
|
|
75
|
+
*/
|
|
76
|
+
export declare function tileImage(canvas: OffscreenCanvas, g: OffscreenCanvasRenderingContext2D, opaque: boolean): Promise<ImageBitmap>;
|
package/dist/basemap.worker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class K{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 i=this.buf[this.pos++]??0,r=i&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(i<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 K(this.buf,this.pos,t);return this.pos=t,n}string(){let e=this.varint(),t=Math.min(this.pos+e,this.end),n=ve.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 ve=new TextDecoder;function Se(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 Me(e){let t=[],n,[i,r]=[0,0];while(e.more){let s=e.varint(),u=s&7,o=s>>3;if(u===7){if(n&&n.length>=2)n.push(n[0]??0,n[1]??0);continue}for(let a=0;a<o&&e.more;a+=1){if(i+=e.sint(),r+=e.sint(),u===1)n=[],t.push(n);n?.push(i,r)}}return t}function re(e,t){let n=new Map,i=new K(e);while(i.more){let r=i.varint();if(r>>3!==3){i.skip(r&7);continue}let s=i.sub(),u="",o=4096,a=[],p=[],w=[];while(s.more){let l=s.varint();switch(l>>3){case 1:u=s.string();break;case 2:w.push(s.sub());break;case 3:a.push(s.string());break;case 4:p.push(Se(s.sub()));break;case 5:o=s.varint();break;default:s.skip(l&7)}}if(t&&!t.has(u))continue;let d=[];for(let l of w){let h=1,S={},x=[];while(l.more){let k=l.varint();switch(k>>3){case 2:{let M=l.sub();while(M.more){let C=a[M.varint()],R=p[M.varint()];if(C!==void 0&&R!==void 0)S[C]=R}break}case 3:h=Math.min(3,Math.max(1,l.varint()));break;case 4:x=Me(l.sub());break;default:l.skip(k&7)}}d.push({type:h,properties:S,geometry:x})}n.set(u,{extent:o,features:d})}return n}var Ae="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",D;function Ne(e){if(!D){D=new Map;let t=Ae.split(" ");for(let n=0;n+1<t.length;n+=2)D.set(t[n],t[n+1])}return D.get(e)}var O=(e)=>Number.isFinite(e)?Math.max(0,Math.min(1,e)):0;function ie(e){if(!/^[0-9a-f]+$/.test(e)||![3,4,6,8].includes(e.length))return;let t=e.length<=4?[...e].map((i)=>i+i).join(""):e,n=(i)=>Number.parseInt(t.slice(i,i+2),16)/255;return[n(0),n(2),n(4),t.length===8?n(6):1]}function Ce(e){if(e===void 0)return 1;return O(e.endsWith("%")?Number.parseFloat(e)/100:Number.parseFloat(e))}function Le(e,t,n){let i=n<0.5?n*(1+t):n+t-n*t,r=2*n-i,s=(u)=>{let o=(u%1+1)%1;if(o<0.16666666666666666)return r+(i-r)*6*o;if(o<0.5)return i;if(o<0.6666666666666666)return r+(i-r)*(0.6666666666666666-o)*6;return r};return[s(e+0.3333333333333333),s(e),s(e-0.3333333333333333)]}function oe(e){if(typeof e!=="string")return;let t=e.trim().toLowerCase();if(t.startsWith("#"))return ie(t.slice(1));if(t==="transparent")return[0,0,0,0];let n=Ne(t);if(n)return ie(n);let i=/^(rgba?|hsla?)\(([^)]*)\)$/.exec(t);if(!i?.[1]||i[2]===void 0)return;let r=i[2].split(/[\s,/]+/).filter(Boolean);if(r.length<3||r.slice(0,3).some((w)=>Number.isNaN(Number.parseFloat(w))))return;let s=Ce(r[3]);if(i[1].startsWith("rgb")){let w=(d)=>O(d.endsWith("%")?Number.parseFloat(d)/100:Number.parseFloat(d)/255);return[w(r[0]),w(r[1]),w(r[2]),s]}let u=Number.parseFloat(r[0])/360,[o,a,p]=Le(u,O(Number.parseFloat(r[1])/100),O(Number.parseFloat(r[2])/100));return[o,a,p,s]}var Re=["Unknown","Point","LineString","Polygon"];function Q(e,t){return{zoom:t,properties:e.properties,type:Re[e.type]??"Unknown"}}function q(e){return oe(e)}function j([e,t,n,i]){return`rgba(${Math.round(e*255)},${Math.round(t*255)},${Math.round(n*255)},${i})`}function ue(e,t,n,i=1){let r=n-t;if(r===0)return 0;let s=e-t;return i===1?s/r:(i**s-1)/(i**r-1)}function X(e,t,n){if(typeof e==="number"&&typeof t==="number")return e+(t-e)*n;let i=q(e),r=q(t);if(i&&r)return j([0,1,2,3].map((s)=>(i[s]??0)+((r[s]??0)-(i[s]??0))*n));if(Array.isArray(e)&&Array.isArray(t))return e.map((s,u)=>X(s,t[u],n));return n<0.5?e:t}function le(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)&&Array.isArray(e.stops)}function Je(e,t){let n=e.property===void 0?t.zoom:t.properties[e.property],i=e.stops,r=e.type??(e.property===void 0||typeof i[0]?.[0]==="number"?"exponential":"categorical");if(r==="identity")return n??e.default;if(r==="categorical")return i.find(([o])=>o===n)?.[1]??e.default;if(typeof n!=="number"||!i.length)return e.default??i[0]?.[1];let s=(o)=>typeof o[0]==="object"&&o[0]!==null?Number(o[0].zoom):Number(o[0]),u=i[0];if(!u)return e.default;if(n<=s(u))return u[1];for(let o=1;o<i.length;o+=1){let[a,p]=[i[o-1],i[o]];if(!a||!p)continue;if(n<s(p)){if(r==="interval")return a[1];return X(a[1],p[1],ue(n,s(a),s(p),e.base??1))}}return i.at(-1)?.[1]}function V(e,t){if(t==="$type")return e.type;return typeof t==="string"?e.properties[t]:void 0}var Pe=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 Z(e){return Array.isArray(e)&&typeof e[0]==="string"&&Pe.has(e[0])}var se=new Set,B=(e)=>e===void 0||e===null?"":String(e);function L(e,t){if(le(e))return Je(e,t);if(!Array.isArray(e))return e;let[n,...i]=e;if(typeof n!=="string")return e;let r=(o)=>L(i[o]??null,t),s=(o)=>Number(r(o)),u=()=>i.map((o,a)=>s(a));switch(n){case"literal":return i[0];case"zoom":return t.zoom;case"get":return V(t,r(0));case"has":return V(t,r(0))!==void 0;case"!has":return V(t,r(0))===void 0;case"properties":return t.properties;case"id":return null;case"geometry-type":return t.type;case"concat":return i.map((o,a)=>B(r(a))).join("");case"format":return i.map((o,a)=>o!==null&&typeof o==="object"&&!Array.isArray(o)?"":B(r(a))).join("");case"image":return r(0);case"number-format":{let o=i[1]??{},a=s(0);if(!Number.isFinite(a))return"";return a.toLocaleString(o.locale,{minimumFractionDigits:o["min-fraction-digits"],maximumFractionDigits:o["max-fraction-digits"]})}case"to-number":{for(let o=0;o<i.length;o+=1){let a=r(o),p=typeof a==="string"&&a.trim()===""?Number.NaN:Number(a);if(a!==null&&a!==void 0&&!Number.isNaN(p))return p}return 0}case"to-string":return B(r(0));case"to-boolean":{let o=r(0);return!(o===""||o===0||o===!1||o===null||o===void 0||Number.isNaN(o))}case"to-color":case"number":case"string":case"boolean":{let o={"to-color":(a)=>q(a)!==void 0,number:(a)=>typeof a==="number",string:(a)=>typeof a==="string",boolean:(a)=>typeof a==="boolean"};for(let a=0;a<i.length;a+=1){let p=r(a);if(o[n]?.(p))return p}return i.length?r(i.length-1):null}case"typeof":{let o=r(0);if(o===null||o===void 0)return"null";return Array.isArray(o)?"array":typeof o}case"length":{let o=r(0);return typeof o==="string"||Array.isArray(o)?o.length:0}case"at":{let o=r(1);return Array.isArray(o)?o[s(0)]??null:null}case"upcase":return B(r(0)).toUpperCase();case"downcase":return B(r(0)).toLowerCase();case"coalesce":for(let o=0;o<i.length;o+=1){let a=r(o);if(a!==void 0&&a!==null)return a}return null;case"!":return!r(0);case"all":return i.every((o,a)=>Boolean(r(a)));case"any":return i.some((o,a)=>Boolean(r(a)));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 o=r(1),a=r(0);if(typeof o==="string")return o.includes(String(a));return Array.isArray(o)&&o.includes(a)}case"case":{for(let o=0;o+1<i.length;o+=2)if(r(o))return r(o+1);return r(i.length-1)}case"match":{let o=r(0);for(let a=1;a+1<i.length;a+=2){let p=i[a];if(Array.isArray(p)?p.includes(o):p===o)return r(a+1)}return r(i.length-1)}case"step":{let o=s(0),a=r(1);for(let p=2;p+1<i.length;p+=2)if(o>=Number(i[p]))a=r(p+1);else break;return a}case"interpolate":case"interpolate-hcl":case"interpolate-lab":{let o=i[0],a=s(1),p=Array.isArray(o)&&o[0]==="exponential"?Number(o[1]):1,w=[];for(let l=2;l+1<i.length;l+=2)w.push([Number(i[l]),i[l+1]??null]);let d=w[0];if(!d)return null;if(a<=d[0])return L(d[1],t);for(let l=1;l<w.length;l+=1){let[h,S]=[w[l-1],w[l]];if(h&&S&&a<S[0])return X(L(h[1],t),L(S[1],t),ue(a,h[0],S[0],p))}return L(w.at(-1)?.[1]??null,t)}case"rgb":case"rgba":return j([s(0)/255,s(1)/255,s(2)/255,i.length>3?s(3):1]);case"+":return u().reduce((o,a)=>o+a,0);case"*":return u().reduce((o,a)=>o*a,1);case"-":return i.length===1?-s(0):s(0)-s(1);case"/":return s(0)/s(1);case"%":return s(0)%s(1);case"^":return s(0)**s(1);case"min":return Math.min(...u());case"max":return Math.max(...u());case"abs":return Math.abs(s(0));case"round":return Math.sign(s(0))*Math.round(Math.abs(s(0)));case"floor":return Math.floor(s(0));case"ceil":return Math.ceil(s(0));case"sqrt":return Math.sqrt(s(0));case"ln":return Math.log(s(0));case"log10":return Math.log10(s(0));case"log2":return Math.log2(s(0));case"pi":return Math.PI;case"e":return Math.E;default:if(!se.has(n))se.add(n),console.warn(`isard: the style expression "${n}" is not supported`);return null}}var Fe=new Set(["==","!=","<","<=",">",">="]);function ze(e){let[t,n,...i]=e;if(typeof t!=="string"||typeof n!=="string"||i.some(Array.isArray))return!1;if(Fe.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 Te(e,t){let[n,i,...r]=e,s=V(t,i);switch(n){case"==":return s===r[0];case"!=":return s!==r[0];case"<":return s<r[0];case"<=":return s<=r[0];case">":return s>r[0];case">=":return s>=r[0];case"in":return r.includes(s);case"!in":return!r.includes(s);case"has":return s!==void 0;case"!has":return s===void 0;default:return!0}}var ae=new WeakMap;function ce(e){if(!Array.isArray(e))return()=>Boolean(e);let t=ae.get(e);if(t)return t;let n,i=e[0];if(i==="all"||i==="any"||i==="none"){let r=e.slice(1).map(ce);if(i==="all")n=(s)=>r.every((u)=>u(s));else if(i==="any")n=(s)=>r.some((u)=>u(s));else n=(s)=>!r.some((u)=>u(s))}else if(ze(e))n=(r)=>Te(e,r);else n=(r)=>Boolean(L(e,r));return ae.set(e,n),n}function ee(e,t){if(e===void 0||e===null)return!0;return ce(e)(t)}function U(e){if(e!==void 0&&le(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)=>U(t))}function fe(e,t){if(e===void 0||e===null)return"";if(typeof e==="string")return e.replace(/\{([^}]+)\}/g,(i,r)=>{let s=t.properties[r];return s===void 0?"":String(s)});let n=L(e,t);if(Array.isArray(n))return n.filter((i)=>typeof i==="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 me(e){let t=new Set,n=(u)=>{if(!Array.isArray(u))return;let o=(a)=>Array.isArray(a)&&a[0]==="zoom";if((u[0]==="interpolate"||u[0]==="interpolate-hcl"||u[0]==="interpolate-lab")&&o(u[2]))for(let a=3;a<u.length;a+=2)t.add(Number(u[a]));else if(u[0]==="step"&&o(u[1]))for(let a=3;a<u.length;a+=2){let p=Number(u[a]);t.add(p),t.add(p-0.01)}for(let a of u)n(a)};n(e);let i=[...t].filter(Number.isFinite);if(i.length===0)i.push(0);let[r,s]=[Math.min(...i),Math.max(...i)];for(let u=Math.ceil(r);u<=Math.floor(s);u+=1)i.push(u);return[...new Set(i)].sort((u,o)=>u-o).map((u)=>[u,Number(L(e,{zoom:u,properties:{},type:"Unknown"}))])}var te=new Map,J=new Map,Ie=96,ne=new Set,E=new Set,P=new Map,Be=64;function qe(e,t="auto"){let n=P.get(e);if(n)return P.delete(e),P.set(e,n),n;let i=(async()=>{let s=await fetch(e,{priority:t});if(s.status===404||s.status===204)return;if(!s.ok)throw Error(`${e}: ${s.status}`);return createImageBitmap(await s.blob())})();i.catch(()=>P.delete(e)),P.set(e,i);while(P.size>Be){let r=P.keys().next().value;if(r===void 0)break;P.delete(r)}return i}function pe(e,t="auto"){let n=J.get(e);if(n)return J.delete(e),J.set(e,n),n;let i=(async()=>{for(let r=0;;r+=1){let u=await fetch(e,{priority:t});if(u.status===404||u.status===204)return;if(u.ok)return re(new Uint8Array(await u.arrayBuffer()));if(r>=2)throw Error(`${e}: ${u.status}`);await new Promise((o)=>setTimeout(o,400*(r+1)))}})();i.catch(()=>J.delete(e)),J.set(e,i);while(J.size>Ie){let r=J.keys().next().value;if(r===void 0)break;J.delete(r)}return i}function Ee(e,t,n,i){let r=Math.max(0,Math.min(t-1,e.maxzoom)),s=t-r,u=2**Math.max(0,s),[o,a]=s>=0?[Math.floor(n/u),Math.floor(i/u)]:[n,i],p=e.tiles.replace("{z}",String(r)).replace("{x}",String(o)).replace("{y}",String(a)),w=1/u;return{url:p,vz:r,vx:o,vy:a,part:w,ox:n%u*w,oy:i%u*w}}var A=(e,t,n,i,r)=>{let s=e[t]?.[n];if(s===void 0)return r;let u=Array.isArray(s)&&!Z(s)?s:L(s,i);return u===void 0||u===null?r:u};function z(e,t){let n=q(e)??[0,0,0,1];return j([n[0],n[1],n[2],n[3]*t])}function be(e,t){if(e.layout?.visibility==="none")return!1;return t>=(e.minzoom??0)&&t<(e.maxzoom??24)}function We(e,t){if(e.patterns.has(t))return e.patterns.get(t);let n=e.sprite?.icons[t],i;if(e.sprite&&n&&n.width>0&&n.height>0)i=new OffscreenCanvas(n.width,n.height),i.getContext("2d")?.drawImage(e.sprite.image,n.x,n.y,n.width,n.height,0,0,n.width,n.height);return e.patterns.set(t,i),i}async function $e(e,t,n,i,r,s,u){let o=Ee(e,t,n,i),a=await pe(o.url,u);if(E.has(s))return;let p=e.sprite,w=Math.max(0,t-1),l=new OffscreenCanvas(r,r).getContext("2d",{willReadFrequently:!0});if(!l)throw Error("no 2D context");let h=r/256,S=!1;for(let x of e.layers){if(!be(x,w))continue;let k={zoom:w,properties:{},type:"Unknown"};if(x.type==="background"){l.fillStyle=z(A(x,"paint","background-color",k,"#000"),Number(A(x,"paint","background-opacity",k,1))),l.fillRect(0,0,r,r),S=!0;continue}if(x.type==="raster"){let g=x.source===void 0?void 0:e.rasters[x.source];if(!g)continue;let f=Math.max(0,Math.min(t-(g.tileSize>=512?1:0),g.maxzoom)),c=2**(t-f),y=g.tiles.replace("{z}",String(f)).replace("{x}",String(Math.floor(n/c))).replace("{y}",String(Math.floor(i/c))),m=await qe(y,u).catch(()=>{return});if(E.has(s))return;if(!m)continue;let[v,N]=[m.width/c,m.height/c];l.globalAlpha=Number(A(x,"paint","raster-opacity",k,1)),l.drawImage(m,n%c*v,i%c*N,v,N,0,0,r,r),l.globalAlpha=1,S=!0;continue}let M=a?.get(x["source-layer"]??"");if(!M)continue;let C=r/(M.extent*o.part),[R,W]=[o.ox*M.extent,o.oy*M.extent],F=(g,f)=>{l.beginPath();for(let c of g.geometry){for(let y=0;y+1<c.length;y+=2){let[m,v]=[((c[y]??0)-R)*C,((c[y+1]??0)-W)*C];if(y===0)l.moveTo(m,v);else l.lineTo(m,v)}if(f)l.closePath()}},T=new Map,b=(g,f,c,y)=>{let m=T.get(f);if(m===void 0)m=U(x[g]?.[f]),T.set(f,m);return A(x,g,f,m?c:k,y)};for(let g of M.features){let f=Q(g,w);if(!ee(x.filter,f))continue;if(x.type==="fill-extrusion"&&g.type===3)F(g,!0),l.fillStyle=z(b("paint","fill-extrusion-color",f,"#000"),Number(b("paint","fill-extrusion-opacity",f,1))),l.fill("evenodd"),S=!0;else if(x.type==="fill"&&g.type===3){let c=Number(b("paint","fill-opacity",f,1)),y=b("paint","fill-pattern",f,void 0);F(g,!0);let m=typeof y==="string"?p?.icons[y]:void 0,v=m&&We(e,y);if(m&&v){let N=l.createPattern(v,"repeat");if(N)N.setTransform(new DOMMatrix().scale(h/(m.pixelRatio??1))),l.globalAlpha=c,l.fillStyle=N,l.fill("evenodd"),l.globalAlpha=1}else{l.fillStyle=z(b("paint","fill-color",f,"#000"),c),l.fill("evenodd");let N=b("paint","fill-outline-color",f,void 0);if(N!==void 0)l.strokeStyle=z(N,c),l.lineWidth=h,l.setLineDash([]),l.stroke()}S=!0}else if(x.type==="line"&&g.type!==1){let c=Number(b("paint","line-width",f,1));if(c<=0)continue;let y=Number(b("paint","line-gap-width",f,0));l.strokeStyle=z(b("paint","line-color",f,"#000"),Number(b("paint","line-opacity",f,1))),l.lineWidth=(y>0?y+2*c:c)*h,l.lineCap=String(b("layout","line-cap",f,"butt")),l.lineJoin=String(b("layout","line-join",f,"miter"));let m=b("paint","line-dasharray",f,void 0);l.setLineDash(Array.isArray(m)?m.map((v)=>Number(v)*c*h):[]),F(g,g.type===3),l.stroke(),S=!0}else if(x.type==="circle"&&g.type===1){let c=Number(b("paint","circle-radius",f,5))*h;l.fillStyle=z(b("paint","circle-color",f,"#000"),Number(b("paint","circle-opacity",f,1)));let y=Number(b("paint","circle-stroke-width",f,0))*h;l.strokeStyle=z(b("paint","circle-stroke-color",f,"#000"),Number(b("paint","circle-stroke-opacity",f,1))),l.lineWidth=y;for(let m of g.geometry)for(let v=0;v+1<m.length;v+=2)if(l.beginPath(),l.arc(((m[v]??0)-R)*C,((m[v+1]??0)-W)*C,c,0,2*Math.PI),l.fill(),y>0)l.stroke();S=!0}}}if(!S&&!a)return null;return createImageBitmap(l.getImageData(0,0,r,r),{premultiplyAlpha:"none"})}function De(e){let{layout:t={},paint:n={}}=e;return t["icon-image"]!==void 0&&n["text-halo-width"]===void 0&&n["text-halo-color"]===void 0&&t["text-offset"]===void 0&&(t["text-anchor"]??"center")==="center"}function _(e,t,n,i,r,s){let u=2**e,o=(t+r/i)/u,a=(n+s/i)/u;return[o*360-180,Math.atan(Math.sinh(Math.PI*(1-2*a)))*180/Math.PI]}async function Oe(e,t,n,i,r,s){let u=e.tiles.replace("{z}",String(t)).replace("{x}",String(n)).replace("{y}",String(i)),o=await pe(u,s);if(!o||E.has(r))return[];let a=[],p=new Map,w=(d)=>{let l=p.get(d);if(l===void 0){let h=d.layout?.["text-size"]??16;l=Z(h)?me(h):h,p.set(d,l)}return l};return e.layers.forEach((d,l)=>{if(d.type!=="symbol"||!be(d,t)||d.layout?.["text-field"]===void 0)return;if(De(d))return;let h=o.get(d["source-layer"]??"");if(!h)return;let S=d.layout?.["symbol-placement"]==="line"?"line":"point";for(let x of h.features){let k=Q(x,t);if(!ee(d.filter,k))continue;let M=fe(d.layout?.["text-field"],k).trim();if(!M)continue;let C=A(d,"layout","text-transform",k,"none");if(C==="uppercase")M=M.toUpperCase();else if(C==="lowercase")M=M.toLowerCase();let R=A(d,"layout","text-font",k,["Noto Sans Regular"]),W=de(Array.isArray(R)&&typeof R[0]==="string"?R[0]:"Noto Sans Regular"),F=A(d,"layout","text-offset",k,[0,0]),T={layer:l,text:M,font:W,size:U(d.layout?.["text-size"])?Number(A(d,"layout","text-size",k,16)):w(d),color:String(A(d,"paint","text-color",k,"#000")),haloColor:String(A(d,"paint","text-halo-color",k,"rgba(0,0,0,0)")),haloWidth:Number(A(d,"paint","text-halo-width",k,0)),anchor:String(A(d,"layout","text-anchor",k,"center")),offset:Array.isArray(F)?[Number(F[0]??0),Number(F[1]??0)]:[0,0],maxWidth:Number(A(d,"layout","text-max-width",k,10)),lineHeight:Number(A(d,"layout","text-line-height",k,1.2)),overlap:Boolean(A(d,"layout","text-allow-overlap",k,!1))};if(x.type===1)for(let b of x.geometry)for(let g=0;g+1<b.length;g+=2){let[f,c]=[b[g]??0,b[g+1]??0];if(f<0||c<0||f>=h.extent||c>=h.extent)continue;let[y,m]=_(t,n,i,h.extent,f,c);a.push({...T,lon:y,lat:m})}else{let b,g=0;for(let c of x.geometry){let y=0;for(let m=2;m+1<c.length;m+=2)y+=Math.hypot((c[m]??0)-(c[m-2]??0),(c[m+1]??0)-(c[m-1]??0));if(y>g)g=y,b=c}if(!b||g<h.extent/32)continue;let f=g/2;for(let c=2;c+1<b.length;c+=2){let[y,m,v,N]=[b[c-2]??0,b[c-1]??0,b[c]??0,b[c+1]??0],I=Math.hypot(v-y,N-m);if(I>=f&&I>0){let[G,Y]=[y+(v-y)*f/I,m+(N-m)*f/I];if(G<0||Y<0||G>=h.extent||Y>=h.extent)break;let[ge,ye]=_(t,n,i,h.extent,G,Y),[he,we]=_(t,n,i,h.extent,v,N),[xe,ke]=_(t,n,i,h.extent,y,m);a.push({...T,lon:ge,lat:ye,...S==="line"?{along:[he-xe,we-ke]}:{}});break}f-=I}}}}),a}var H=(e,t=[])=>self.postMessage(e,t);self.onmessage=async({data:e})=>{if(e.type==="init"){te.set(e.key,{tiles:e.tiles,maxzoom:e.maxzoom,layers:e.layers,rasters:e.rasters??{},sprite:e.sprite,patterns:new Map});return}if(e.type==="drop"){te.delete(e.key);return}if(e.type==="abort"){if(ne.has(e.id))E.add(e.id);return}ne.add(e.id);let t=te.get(e.key);try{if(!t)throw Error(`no renderer ${e.key}`);if(e.type==="render"){let n=await $e(t,e.z,e.x,e.y,e.size,e.id,e.priority);if(n)H({id:e.id,image:n},[n]);else H({id:e.id,missing:!0})}else H({id:e.id,labels:await Oe(t,e.z,e.x,e.y,e.id,e.priority)})}catch(n){H({id:e.id,error:String(n)})}finally{ne.delete(e.id),E.delete(e.id)}};
|
|
1
|
+
class Q{buf;end;pos;constructor(e,n=0,r=e.length){this.buf=e;this.end=r;this.pos=n}varint(){let e=0;for(let n=0;n<70;n+=7){let r=this.buf[this.pos++]??0;if(e+=(r&127)*2**n,r<128)break}return e}int64(){let e=0,n=0;for(let r=0;r<10;r+=1){let i=this.buf[this.pos++]??0,t=i&127;if(r<4)e|=t<<7*r;else if(r===4)e|=(t&15)<<28,n|=t>>4;else n|=t<<7*r-32;if(i<128)break}return(n|0)*4294967296+(e>>>0)}sint(){let e=this.varint();return e%2===1?-(e+1)/2:e/2}sub(){let e=this.varint(),n=Math.min(this.pos+e,this.end),r=new Q(this.buf,this.pos,n);return this.pos=n,r}string(){let e=this.varint(),n=Math.min(this.pos+e,this.end),r=Ae.decode(this.buf.subarray(this.pos,n));return this.pos=n,r}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 Ae=new TextDecoder;function Ce(e){let n="";while(e.more){let r=e.varint();switch(r>>3){case 1:n=e.string();break;case 2:n=e.float();break;case 3:n=e.double();break;case 4:n=e.int64();break;case 5:n=e.varint();break;case 6:n=e.sint();break;case 7:n=e.varint()!==0;break;default:e.skip(r&7)}}return n}function Ne(e){let n=[],r,[i,t]=[0,0];while(e.more){let s=e.varint(),u=s&7,o=s>>3;if(u===7){if(r&&r.length>=2)r.push(r[0]??0,r[1]??0);continue}for(let a=0;a<o&&e.more;a+=1){if(i+=e.sint(),t+=e.sint(),u===1)r=[],n.push(r);r?.push(i,t)}}return n}function ie(e,n){let r=new Map,i=new Q(e);while(i.more){let t=i.varint();if(t>>3!==3){i.skip(t&7);continue}let s=i.sub(),u="",o=4096,a=[],c=[],x=[];while(s.more){let g=s.varint();switch(g>>3){case 1:u=s.string();break;case 2:x.push(s.sub());break;case 3:a.push(s.string());break;case 4:c.push(Ce(s.sub()));break;case 5:o=s.varint();break;default:s.skip(g&7)}}if(n&&!n.has(u))continue;let f=[];for(let g of x){let h=1,v={},L=[];while(g.more){let d=g.varint();switch(d>>3){case 2:{let S=g.sub();while(S.more){let N=a[S.varint()],R=c[S.varint()];if(N!==void 0&&R!==void 0)v[N]=R}break}case 3:h=Math.min(3,Math.max(1,g.varint()));break;case 4:L=Ne(g.sub());break;default:g.skip(d&7)}}f.push({type:h,properties:v,geometry:L})}r.set(u,{extent:o,features:f})}return r}var Re="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",E;function Le(e){if(!E){E=new Map;let n=Re.split(" ");for(let r=0;r+1<n.length;r+=2)E.set(n[r],n[r+1])}return E.get(e)}var W=(e)=>Number.isFinite(e)?Math.max(0,Math.min(1,e)):0;function oe(e){if(!/^[0-9a-f]+$/.test(e)||![3,4,6,8].includes(e.length))return;let n=e.length<=4?[...e].map((i)=>i+i).join(""):e,r=(i)=>Number.parseInt(n.slice(i,i+2),16)/255;return[r(0),r(2),r(4),n.length===8?r(6):1]}function Je(e){if(e===void 0)return 1;return W(e.endsWith("%")?Number.parseFloat(e)/100:Number.parseFloat(e))}function Pe(e,n,r){let i=r<0.5?r*(1+n):r+n-r*n,t=2*r-i,s=(u)=>{let o=(u%1+1)%1;if(o<0.16666666666666666)return t+(i-t)*6*o;if(o<0.5)return i;if(o<0.6666666666666666)return t+(i-t)*(0.6666666666666666-o)*6;return t};return[s(e+0.3333333333333333),s(e),s(e-0.3333333333333333)]}function se(e){if(typeof e!=="string")return;let n=e.trim().toLowerCase();if(n.startsWith("#"))return oe(n.slice(1));if(n==="transparent")return[0,0,0,0];let r=Le(n);if(r)return oe(r);let i=/^(rgba?|hsla?)\(([^)]*)\)$/.exec(n);if(!i?.[1]||i[2]===void 0)return;let t=i[2].split(/[\s,/]+/).filter(Boolean);if(t.length<3||t.slice(0,3).some((x)=>Number.isNaN(Number.parseFloat(x))))return;let s=Je(t[3]);if(i[1].startsWith("rgb")){let x=(f)=>W(f.endsWith("%")?Number.parseFloat(f)/100:Number.parseFloat(f)/255);return[x(t[0]),x(t[1]),x(t[2]),s]}let u=Number.parseFloat(t[0])/360,[o,a,c]=Pe(u,W(Number.parseFloat(t[1])/100),W(Number.parseFloat(t[2])/100));return[o,a,c,s]}var Fe=["Unknown","Point","LineString","Polygon"];function X(e,n){return{zoom:n,properties:e.properties,type:Fe[e.type]??"Unknown"}}function B(e){return se(e)}function j([e,n,r,i]){return`rgba(${Math.round(e*255)},${Math.round(n*255)},${Math.round(r*255)},${i})`}function le(e,n,r,i=1){let t=r-n;if(t===0)return 0;let s=e-n;return i===1?s/t:(i**s-1)/(i**t-1)}function Z(e,n,r){if(typeof e==="number"&&typeof n==="number")return e+(n-e)*r;let i=B(e),t=B(n);if(i&&t)return j([0,1,2,3].map((s)=>(i[s]??0)+((t[s]??0)-(i[s]??0))*r));if(Array.isArray(e)&&Array.isArray(n))return e.map((s,u)=>Z(s,n[u],r));return r<0.5?e:n}function ce(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)&&Array.isArray(e.stops)}function ze(e,n){let r=e.property===void 0?n.zoom:n.properties[e.property],i=e.stops,t=e.type??(e.property===void 0||typeof i[0]?.[0]==="number"?"exponential":"categorical");if(t==="identity")return r??e.default;if(t==="categorical")return i.find(([o])=>o===r)?.[1]??e.default;if(typeof r!=="number"||!i.length)return e.default??i[0]?.[1];let s=(o)=>typeof o[0]==="object"&&o[0]!==null?Number(o[0].zoom):Number(o[0]),u=i[0];if(!u)return e.default;if(r<=s(u))return u[1];for(let o=1;o<i.length;o+=1){let[a,c]=[i[o-1],i[o]];if(!a||!c)continue;if(r<s(c)){if(t==="interval")return a[1];return Z(a[1],c[1],le(r,s(a),s(c),e.base??1))}}return i.at(-1)?.[1]}function V(e,n){if(n==="$type")return e.type;return typeof n==="string"?e.properties[n]:void 0}var Te=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 ee(e){return Array.isArray(e)&&typeof e[0]==="string"&&Te.has(e[0])}var ae=new Set,O=(e)=>e===void 0||e===null?"":String(e);function J(e,n){if(ce(e))return ze(e,n);if(!Array.isArray(e))return e;let[r,...i]=e;if(typeof r!=="string")return e;let t=(o)=>J(i[o]??null,n),s=(o)=>Number(t(o)),u=()=>i.map((o,a)=>s(a));switch(r){case"literal":return i[0];case"zoom":return n.zoom;case"get":return V(n,t(0));case"has":return V(n,t(0))!==void 0;case"!has":return V(n,t(0))===void 0;case"properties":return n.properties;case"id":return null;case"geometry-type":return n.type;case"concat":return i.map((o,a)=>O(t(a))).join("");case"format":return i.map((o,a)=>o!==null&&typeof o==="object"&&!Array.isArray(o)?"":O(t(a))).join("");case"image":return t(0);case"number-format":{let o=i[1]??{},a=s(0);if(!Number.isFinite(a))return"";return a.toLocaleString(o.locale,{minimumFractionDigits:o["min-fraction-digits"],maximumFractionDigits:o["max-fraction-digits"]})}case"to-number":{for(let o=0;o<i.length;o+=1){let a=t(o),c=typeof a==="string"&&a.trim()===""?Number.NaN:Number(a);if(a!==null&&a!==void 0&&!Number.isNaN(c))return c}return 0}case"to-string":return O(t(0));case"to-boolean":{let o=t(0);return!(o===""||o===0||o===!1||o===null||o===void 0||Number.isNaN(o))}case"to-color":case"number":case"string":case"boolean":{let o={"to-color":(a)=>B(a)!==void 0,number:(a)=>typeof a==="number",string:(a)=>typeof a==="string",boolean:(a)=>typeof a==="boolean"};for(let a=0;a<i.length;a+=1){let c=t(a);if(o[r]?.(c))return c}return i.length?t(i.length-1):null}case"typeof":{let o=t(0);if(o===null||o===void 0)return"null";return Array.isArray(o)?"array":typeof o}case"length":{let o=t(0);return typeof o==="string"||Array.isArray(o)?o.length:0}case"at":{let o=t(1);return Array.isArray(o)?o[s(0)]??null:null}case"upcase":return O(t(0)).toUpperCase();case"downcase":return O(t(0)).toLowerCase();case"coalesce":for(let o=0;o<i.length;o+=1){let a=t(o);if(a!==void 0&&a!==null)return a}return null;case"!":return!t(0);case"all":return i.every((o,a)=>Boolean(t(a)));case"any":return i.some((o,a)=>Boolean(t(a)));case"==":return t(0)===t(1);case"!=":return t(0)!==t(1);case"<":return t(0)<t(1);case"<=":return t(0)<=t(1);case">":return t(0)>t(1);case">=":return t(0)>=t(1);case"in":{let o=t(1),a=t(0);if(typeof o==="string")return o.includes(String(a));return Array.isArray(o)&&o.includes(a)}case"case":{for(let o=0;o+1<i.length;o+=2)if(t(o))return t(o+1);return t(i.length-1)}case"match":{let o=t(0);for(let a=1;a+1<i.length;a+=2){let c=i[a];if(Array.isArray(c)?c.includes(o):c===o)return t(a+1)}return t(i.length-1)}case"step":{let o=s(0),a=t(1);for(let c=2;c+1<i.length;c+=2)if(o>=Number(i[c]))a=t(c+1);else break;return a}case"interpolate":case"interpolate-hcl":case"interpolate-lab":{let o=i[0],a=s(1),c=Array.isArray(o)&&o[0]==="exponential"?Number(o[1]):1,x=[];for(let g=2;g+1<i.length;g+=2)x.push([Number(i[g]),i[g+1]??null]);let f=x[0];if(!f)return null;if(a<=f[0])return J(f[1],n);for(let g=1;g<x.length;g+=1){let[h,v]=[x[g-1],x[g]];if(h&&v&&a<v[0])return Z(J(h[1],n),J(v[1],n),le(a,h[0],v[0],c))}return J(x.at(-1)?.[1]??null,n)}case"rgb":case"rgba":return j([s(0)/255,s(1)/255,s(2)/255,i.length>3?s(3):1]);case"+":return u().reduce((o,a)=>o+a,0);case"*":return u().reduce((o,a)=>o*a,1);case"-":return i.length===1?-s(0):s(0)-s(1);case"/":return s(0)/s(1);case"%":return s(0)%s(1);case"^":return s(0)**s(1);case"min":return Math.min(...u());case"max":return Math.max(...u());case"abs":return Math.abs(s(0));case"round":return Math.sign(s(0))*Math.round(Math.abs(s(0)));case"floor":return Math.floor(s(0));case"ceil":return Math.ceil(s(0));case"sqrt":return Math.sqrt(s(0));case"ln":return Math.log(s(0));case"log10":return Math.log10(s(0));case"log2":return Math.log2(s(0));case"pi":return Math.PI;case"e":return Math.E;default:if(!ae.has(r))ae.add(r),console.warn(`isard: the style expression "${r}" is not supported`);return null}}var Ie=new Set(["==","!=","<","<=",">",">="]);function Be(e){let[n,r,...i]=e;if(typeof n!=="string"||typeof r!=="string"||i.some(Array.isArray))return!1;if(Ie.has(n))return e.length===3;if(n==="in")return e.length!==3||!Array.isArray(e[2]);return n==="!in"||n==="has"||n==="!has"}function Oe(e,n){let[r,i,...t]=e,s=V(n,i);switch(r){case"==":return s===t[0];case"!=":return s!==t[0];case"<":return s<t[0];case"<=":return s<=t[0];case">":return s>t[0];case">=":return s>=t[0];case"in":return t.includes(s);case"!in":return!t.includes(s);case"has":return s!==void 0;case"!has":return s===void 0;default:return!0}}var ue=new WeakMap;function fe(e){if(!Array.isArray(e))return()=>Boolean(e);let n=ue.get(e);if(n)return n;let r,i=e[0];if(i==="all"||i==="any"||i==="none"){let t=e.slice(1).map(fe);if(i==="all")r=(s)=>t.every((u)=>u(s));else if(i==="any")r=(s)=>t.some((u)=>u(s));else r=(s)=>!t.some((u)=>u(s))}else if(Be(e))r=(t)=>Oe(e,t);else r=(t)=>Boolean(J(e,t));return ue.set(e,r),r}function te(e,n){if(e===void 0||e===null)return!0;return fe(e)(n)}function U(e){if(e!==void 0&&ce(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((n)=>U(n))}function me(e,n){if(e===void 0||e===null)return"";if(typeof e==="string")return e.replace(/\{([^}]+)\}/g,(i,t)=>{let s=n.properties[t];return s===void 0?"":String(s)});let r=J(e,n);if(Array.isArray(r))return r.filter((i)=>typeof i==="string").join("");return r===void 0||r===null?"":String(r)}function de(e){return/Regular|Bold|Italic|Semibold|Light|Medium|Black/.test(e)?e:`${e} Regular`}function pe(e){let n=new Set,r=(u)=>{if(!Array.isArray(u))return;let o=(a)=>Array.isArray(a)&&a[0]==="zoom";if((u[0]==="interpolate"||u[0]==="interpolate-hcl"||u[0]==="interpolate-lab")&&o(u[2]))for(let a=3;a<u.length;a+=2)n.add(Number(u[a]));else if(u[0]==="step"&&o(u[1]))for(let a=3;a<u.length;a+=2){let c=Number(u[a]);n.add(c),n.add(c-0.01)}for(let a of u)r(a)};r(e);let i=[...n].filter(Number.isFinite);if(i.length===0)i.push(0);let[t,s]=[Math.min(...i),Math.max(...i)];for(let u=Math.ceil(t);u<=Math.floor(s);u+=1)i.push(u);return[...new Set(i)].sort((u,o)=>u-o).map((u)=>[u,Number(J(e,{zoom:u,properties:{},type:"Unknown"}))])}var _=new Map,P=new Map,be=96,ge=be;function qe(e){return Math.max(16,Math.ceil(be/Math.max(1,e)))}var ne=new Set,q=new Set,F=new Map,De=64;function Ee(e,n="auto"){let r=F.get(e);if(r)return F.delete(e),F.set(e,r),r;let i=(async()=>{let s=await fetch(e,{priority:n});if(s.status===404||s.status===204)return;if(!s.ok)throw Error(`${e}: ${s.status}`);return createImageBitmap(await s.blob())})();i.catch(()=>F.delete(e)),F.set(e,i);while(F.size>De){let[t,s]=F.entries().next().value??[];if(t===void 0||s===void 0)break;F.delete(t),s.then((u)=>setTimeout(()=>u?.close(),0),()=>{return})}return i}function he(e,n="auto"){let r=P.get(e);if(r)return P.delete(e),P.set(e,r),r;let i=(async()=>{for(let t=0;;t+=1){let u=await fetch(e,{priority:n});if(u.status===404||u.status===204)return;if(u.ok)return ie(new Uint8Array(await u.arrayBuffer()));if(t>=2)throw Error(`${e}: ${u.status}`);await new Promise((o)=>setTimeout(o,400*(t+1)))}})();i.catch(()=>P.delete(e)),P.set(e,i);while(P.size>ge){let t=P.keys().next().value;if(t===void 0)break;P.delete(t)}return i}function We(e,n,r,i){let t=Math.max(0,Math.min(n-1,e.maxzoom)),s=n-t,u=2**Math.max(0,s),[o,a]=s>=0?[Math.floor(r/u),Math.floor(i/u)]:[r,i],c=e.tiles.replace("{z}",String(t)).replace("{x}",String(o)).replace("{y}",String(a)),x=1/u;return{url:c,vz:t,vx:o,vy:a,part:x,ox:r%u*x,oy:i%u*x}}var A=(e,n,r,i,t)=>{let s=e[n]?.[r];if(s===void 0)return t;let u=Array.isArray(s)&&!ee(s)?s:J(s,i);return u===void 0||u===null?t:u};function z(e,n){let r=B(e)??[0,0,0,1];return j([r[0],r[1],r[2],r[3]*n])}function ye(e,n){if(e.layout?.visibility==="none")return!1;return n>=(e.minzoom??0)&&n<(e.maxzoom??24)}function $e(e,n){if(e.patterns.has(n))return e.patterns.get(n);let r=e.sprite?.icons[n],i;if(e.sprite&&r&&r.width>0&&r.height>0)i=new OffscreenCanvas(r.width,r.height),i.getContext("2d")?.drawImage(e.sprite.image,r.x,r.y,r.width,r.height,0,0,r.width,r.height);return e.patterns.set(n,i),i}var re=new Map;function Ve(e){let n=re.get(e)?.pop()??new OffscreenCanvas(e,e),r=n.getContext("2d",{willReadFrequently:!0});if(!r)throw Error("no 2D context");return r.setTransform(1,0,0,1,0,0),r.globalAlpha=1,r.setLineDash([]),r.clearRect(0,0,e,e),{canvas:n,g:r}}function je(e){let n=re.get(e.width)??[];if(re.set(e.width,n),n.length<4)n.push(e)}function Ue(e,n,r){if(r)return Promise.resolve(e.transferToImageBitmap());return createImageBitmap(n.getImageData(0,0,e.width,e.height),{premultiplyAlpha:"none"})}async function _e(e,n,r,i,t,s,u){let o=We(e,n,r,i),a=await he(o.url,u);if(q.has(s))return;let{canvas:c,g:x}=Ve(t);try{return await He(e,o,a,c,x,n,r,i,t,s,u)}finally{je(c)}}async function He(e,n,r,i,t,s,u,o,a,c,x){let f=e.sprite,g=Math.max(0,s-1),h=a/256,v=!1,L=!1;for(let d of e.layers){if(!ye(d,g))continue;let S={zoom:g,properties:{},type:"Unknown"};if(d.type==="background"){let b=A(d,"paint","background-color",S,"#000"),l=Number(A(d,"paint","background-opacity",S,1));if(t.fillStyle=z(b,l),t.fillRect(0,0,a,a),(B(b)??[0,0,0,1])[3]*l>=1)L=!0;v=!0;continue}if(d.type==="raster"){let b=d.source===void 0?void 0:e.rasters[d.source];if(!b)continue;let l=Math.max(0,Math.min(s-(b.tileSize>=512?1:0),b.maxzoom)),m=2**(s-l),p=b.tiles.replace("{z}",String(l)).replace("{x}",String(Math.floor(u/m))).replace("{y}",String(Math.floor(o/m))),w=await Ee(p,x).catch(()=>{return});if(q.has(c))return;if(!w)continue;let[k,M]=[w.width/m,w.height/m];t.globalAlpha=Number(A(d,"paint","raster-opacity",S,1)),t.drawImage(w,u%m*k,o%m*M,k,M,0,0,a,a),t.globalAlpha=1,v=!0;continue}let N=r?.get(d["source-layer"]??"");if(!N)continue;let R=a/(N.extent*n.part),[D,T]=[n.ox*N.extent,n.oy*N.extent],I=(b,l)=>{t.beginPath();for(let m of b.geometry){for(let p=0;p+1<m.length;p+=2){let[w,k]=[((m[p]??0)-D)*R,((m[p+1]??0)-T)*R];if(p===0)t.moveTo(w,k);else t.lineTo(w,k)}if(l)t.closePath()}},C=new Map,y=(b,l,m,p)=>{let w=C.get(l);if(w===void 0)w=U(d[b]?.[l]),C.set(l,w);return A(d,b,l,w?m:S,p)};for(let b of N.features){let l=X(b,g);if(!te(d.filter,l))continue;if(d.type==="fill-extrusion"&&b.type===3)I(b,!0),t.fillStyle=z(y("paint","fill-extrusion-color",l,"#000"),Number(y("paint","fill-extrusion-opacity",l,1))),t.fill("evenodd"),v=!0;else if(d.type==="fill"&&b.type===3){let m=Number(y("paint","fill-opacity",l,1)),p=y("paint","fill-pattern",l,void 0);I(b,!0);let w=typeof p==="string"?f?.icons[p]:void 0,k=w&&$e(e,p);if(w&&k){let M=t.createPattern(k,"repeat");if(M)M.setTransform(new DOMMatrix().scale(h/(w.pixelRatio??1))),t.globalAlpha=m,t.fillStyle=M,t.fill("evenodd"),t.globalAlpha=1}else{t.fillStyle=z(y("paint","fill-color",l,"#000"),m),t.fill("evenodd");let M=y("paint","fill-outline-color",l,void 0);if(M!==void 0)t.strokeStyle=z(M,m),t.lineWidth=h,t.setLineDash([]),t.stroke()}v=!0}else if(d.type==="line"&&b.type!==1){let m=Number(y("paint","line-width",l,1));if(m<=0)continue;let p=Number(y("paint","line-gap-width",l,0));t.strokeStyle=z(y("paint","line-color",l,"#000"),Number(y("paint","line-opacity",l,1))),t.lineWidth=(p>0?p+2*m:m)*h,t.lineCap=String(y("layout","line-cap",l,"butt")),t.lineJoin=String(y("layout","line-join",l,"miter"));let w=y("paint","line-dasharray",l,void 0);t.setLineDash(Array.isArray(w)?w.map((k)=>Number(k)*m*h):[]),I(b,b.type===3),t.stroke(),v=!0}else if(d.type==="circle"&&b.type===1){let m=Number(y("paint","circle-radius",l,5))*h;t.fillStyle=z(y("paint","circle-color",l,"#000"),Number(y("paint","circle-opacity",l,1)));let p=Number(y("paint","circle-stroke-width",l,0))*h;t.strokeStyle=z(y("paint","circle-stroke-color",l,"#000"),Number(y("paint","circle-stroke-opacity",l,1))),t.lineWidth=p;for(let w of b.geometry)for(let k=0;k+1<w.length;k+=2)if(t.beginPath(),t.arc(((w[k]??0)-D)*R,((w[k+1]??0)-T)*R,m,0,2*Math.PI),t.fill(),p>0)t.stroke();v=!0}}}if(!v&&!r)return null;return Ue(i,t,L)}function Ge(e){let{layout:n={},paint:r={}}=e;return n["icon-image"]!==void 0&&r["text-halo-width"]===void 0&&r["text-halo-color"]===void 0&&n["text-offset"]===void 0&&(n["text-anchor"]??"center")==="center"}function H(e,n,r,i,t,s){let u=2**e,o=(n+t/i)/u,a=(r+s/i)/u;return[o*360-180,Math.atan(Math.sinh(Math.PI*(1-2*a)))*180/Math.PI]}async function Ye(e,n,r,i,t,s){let u=e.tiles.replace("{z}",String(n)).replace("{x}",String(r)).replace("{y}",String(i)),o=await he(u,s);if(!o||q.has(t))return[];let a=[],c=new Map,x=(f)=>{let g=c.get(f);if(g===void 0){let h=f.layout?.["text-size"]??16;g=ee(h)?pe(h):h,c.set(f,g)}return g};return e.layers.forEach((f,g)=>{if(f.type!=="symbol"||!ye(f,n)||f.layout?.["text-field"]===void 0)return;if(Ge(f))return;let h=o.get(f["source-layer"]??"");if(!h)return;let v=f.layout?.["symbol-placement"]==="line"?"line":"point";for(let L of h.features){let d=X(L,n);if(!te(f.filter,d))continue;let S=me(f.layout?.["text-field"],d).trim();if(!S)continue;let N=A(f,"layout","text-transform",d,"none");if(N==="uppercase")S=S.toUpperCase();else if(N==="lowercase")S=S.toLowerCase();let R=A(f,"layout","text-font",d,["Noto Sans Regular"]),D=de(Array.isArray(R)&&typeof R[0]==="string"?R[0]:"Noto Sans Regular"),T=A(f,"layout","text-offset",d,[0,0]),I={layer:g,text:S,font:D,size:U(f.layout?.["text-size"])?Number(A(f,"layout","text-size",d,16)):x(f),color:String(A(f,"paint","text-color",d,"#000")),haloColor:String(A(f,"paint","text-halo-color",d,"rgba(0,0,0,0)")),haloWidth:Number(A(f,"paint","text-halo-width",d,0)),anchor:String(A(f,"layout","text-anchor",d,"center")),offset:Array.isArray(T)?[Number(T[0]??0),Number(T[1]??0)]:[0,0],maxWidth:Number(A(f,"layout","text-max-width",d,10)),lineHeight:Number(A(f,"layout","text-line-height",d,1.2)),overlap:Boolean(A(f,"layout","text-allow-overlap",d,!1))};if(L.type===1)for(let C of L.geometry)for(let y=0;y+1<C.length;y+=2){let[b,l]=[C[y]??0,C[y+1]??0];if(b<0||l<0||b>=h.extent||l>=h.extent)continue;let[m,p]=H(n,r,i,h.extent,b,l);a.push({...I,lon:m,lat:p})}else{let C,y=0;for(let l of L.geometry){let m=0;for(let p=2;p+1<l.length;p+=2)m+=Math.hypot((l[p]??0)-(l[p-2]??0),(l[p+1]??0)-(l[p-1]??0));if(m>y)y=m,C=l}if(!C||y<h.extent/32)continue;let b=y/2;for(let l=2;l+1<C.length;l+=2){let[m,p,w,k]=[C[l-2]??0,C[l-1]??0,C[l]??0,C[l+1]??0],M=Math.hypot(w-m,k-p);if(M>=b&&M>0){let[Y,K]=[m+(w-m)*b/M,p+(k-p)*b/M];if(Y<0||K<0||Y>=h.extent||K>=h.extent)break;let[we,xe]=H(n,r,i,h.extent,Y,K),[ke,ve]=H(n,r,i,h.extent,w,k),[Se,Me]=H(n,r,i,h.extent,m,p);a.push({...I,lon:we,lat:xe,...v==="line"?{along:[ke-Se,ve-Me]}:{}});break}b-=M}}}}),a}var G=(e,n=[])=>self.postMessage(e,n);self.onmessage=async({data:e})=>{if(e.type==="init"){if(e.workers!==void 0)ge=qe(e.workers);_.set(e.key,{tiles:e.tiles,maxzoom:e.maxzoom,layers:e.layers,rasters:e.rasters??{},sprite:e.sprite,patterns:new Map});return}if(e.type==="drop"){_.get(e.key)?.sprite?.image.close(),_.delete(e.key);return}if(e.type==="abort"){if(ne.has(e.id))q.add(e.id);return}ne.add(e.id);let n=_.get(e.key);try{if(!n)throw Error(`no renderer ${e.key}`);if(e.type==="render"){let r=await _e(n,e.z,e.x,e.y,e.size,e.id,e.priority);if(r)G({id:e.id,image:r},[r]);else G({id:e.id,missing:!0})}else G({id:e.id,labels:await Ye(n,e.z,e.x,e.y,e.id,e.priority)})}catch(r){G({id:e.id,error:String(r)})}finally{ne.delete(e.id),q.delete(e.id)}};export{qe as cacheShare,Ue as tileImage};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=01D6BC7A49684B7264756E2164756E21
|
|
4
4
|
//# sourceMappingURL=basemap.worker.js.map
|