node-red-contrib-web-worldmap 4.2.0 → 4.3.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 +2 -0
- package/README.md +191 -176
- package/package.json +1 -1
- package/worldmap/index.html +1 -0
- package/worldmap/leaflet/protomaps-leaflet.min.js +9 -0
- package/worldmap/worldmap.js +70 -40
- package/worldmap.js +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
### Change Log for Node-RED Worldmap
|
|
2
2
|
|
|
3
|
+
- v4.3.0 - Add support for PMtiles files.
|
|
4
|
+
- v4.2.1 - Revert use of optional chaining to extend life slightly. Issue #252
|
|
3
5
|
- v4.2.0 - Let icons also be inline images data:image...
|
|
4
6
|
- v4.1.0 - Add optional SOG, COG, altft, altm input properties.
|
|
5
7
|
- v4.0.0 - Breaking - Better context menu variable substitution and retention
|
package/README.md
CHANGED
|
@@ -13,6 +13,8 @@ Feel free to [. See below.
|
|
70
72
|
- **building** : OSMbulding GeoJSON feature set to add 2.5D buildings to buildings layer. See below.
|
|
@@ -92,7 +94,7 @@ If you use the name without the fa- prefix (eg `male`) you will get the icon ins
|
|
|
92
94
|
|
|
93
95
|
You can also specify an emoji as the icon by using the :emoji name: syntax - for example `:smile:`. Here is a **[list of emojis](https://github.com/dceejay/RedMap/blob/master/emojilist.md)**.
|
|
94
96
|
|
|
95
|
-
Or you can specify an image to load as an icon by setting the icon to http(s)
|
|
97
|
+
Or you can specify an image to load as an icon by setting the icon to `http(s)://...` By default it will be scaled to 32x32 pixels. You can change the size by setting **iconSize** to a number - eg 64. Example icon - `"https://img.icons8.com/windows/32/000000/bird.png"` or you can use an inline image of the form `data:image/...` which uses a base64 encoded image.
|
|
96
98
|
|
|
97
99
|
There are also several special icons...
|
|
98
100
|
|
|
@@ -219,7 +221,7 @@ Defaults are shown above.
|
|
|
219
221
|
|
|
220
222
|
There are several ways to send GeoJSON to the map.
|
|
221
223
|
|
|
222
|
-
1)
|
|
224
|
+
1) If the msg.payload contains a **geojson** property, and no **lat** and **lon**, then
|
|
223
225
|
rather than draw a point it will render the geojson.
|
|
224
226
|
|
|
225
227
|
msg.payload = {
|
|
@@ -358,65 +360,6 @@ in addition existing male, female, fa-male and fa-female icons are all represent
|
|
|
358
360
|
- This view is a side project to the Node-RED Worldmap project so I'm happy to take PRs but it probably won't be actively developed.
|
|
359
361
|
|
|
360
362
|
|
|
361
|
-
## Events from the map
|
|
362
|
-
|
|
363
|
-
The **worldmap in** node can be used to receive various events from the map. Examples of messages coming FROM the map include:
|
|
364
|
-
|
|
365
|
-
{ "action": "connected" } // useful to trigger delivery or redraw of points
|
|
366
|
-
{ "action": "disconnect", "clients": 1 } // when a client disconnects - reports number remaining
|
|
367
|
-
{"action":"bounds", "south":50.55, "west":-1.48, "north":50.72, "east":-0.98} // reports the outer bounds of the hmap area when zoomed or moved
|
|
368
|
-
|
|
369
|
-
{ "action": "click", "name":"Jason", "layer":"gps", "icon":"male", "iconColor":"blue", "lat":51.024985, "lon":-1.39698 } // when a marker is clicked
|
|
370
|
-
{ "action": "move", "name":"Jason", "layer":"gps", "icon":"male", "iconColor":"blue", "lat":51.044632, "lon":-1.359901 } // when a marker is moved
|
|
371
|
-
{ "action": "delete", "name": "Jason" } // when a point or shape is deleted
|
|
372
|
-
|
|
373
|
-
{ "action": "point", "lat": "50.60634", "lon": "-1.66580", "point": "Jason,male,gps" }
|
|
374
|
-
{ "action": "draw", "type": "rectangle", "points": [ { "lat": 50.61243889044519, "lng": -1.5913009643554688 }, { "lat": 50.66665471366635, "lng": -1.5913009643554688 }, { "lat": 50.66665471366635, "lng": -1.4742279052734375 }, { "lat": 50.61243889044519, "lng": -1.4742279052734375 } ] }
|
|
375
|
-
|
|
376
|
-
{ "action": "layer", "name": "myLayer" } // when a map layer is changed
|
|
377
|
-
{ "action": "addlayer", "name": "myLayer" } // when a new map layer is added
|
|
378
|
-
{ "action": "dellayer", "name": "myLayer" } // when a new map layer is deleted
|
|
379
|
-
|
|
380
|
-
{ "action": "file", "name": "myfilename", "type":"image/jpeg", "lat":51, "lon":-1, "content":"....."} // when a file is dropped on the map - see below.
|
|
381
|
-
|
|
382
|
-
{ "action": "button", "name": "My Fancy Button" } // when a user defined button is clicked
|
|
383
|
-
|
|
384
|
-
{ "action": "feedback", "name": "some name", "value": "some value", "lat":51, "lon":0, "layer":"unknown" } // when a user calls the feedback function - see below
|
|
385
|
-
|
|
386
|
-
If File Drop is enabled - then the map can accept files of type gpx, kml, nvg, jpeg, png and geojson. The file content property will always be a binary buffer. The lat, lon of the cursor drop point will be included. Tracks will be locally rendered on the map. The `node-red-node-exif` node can be used to extract location information from a jpeg image and then geolocate it back on the map. Png images will be located where they are dropped but can then be dragged if required.
|
|
387
|
-
|
|
388
|
-
All actions also include a:
|
|
389
|
-
`msg._sessionid` property that indicates which client session they came from. Any msg sent out that includes this property will ONLY be sent to that session - so you can target map updates to specific sessions if required.
|
|
390
|
-
`msg._sessionip` property that shows the ip of the client that is connected to the session.
|
|
391
|
-
|
|
392
|
-
The "connected" action additionally includes a:
|
|
393
|
-
`msg.payload.parameters` property object that lists the parameters sent in the url.
|
|
394
|
-
`msg.payload.clientTimezone` property string showing the clients local Timezone. Returns bool of `false` if unable to retrive clients local Timezone.
|
|
395
|
-
`msg._clientheaders` property that shows the headers sent by the client to make a connection to the session.
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
### Utility functions
|
|
399
|
-
|
|
400
|
-
There are some internal functions available to make interacting with Node-RED easier (e.g. from inside a user defined popup., these include:
|
|
401
|
-
|
|
402
|
-
- **feedback()** : it takes 2, 3, or 4 parameters, name, value, and optionally an action name (defaults to "feedback"), and optional boolean to close the popup on calling this function, and can be used inside something like an input tag - `onchange='feedback(this.name,this.value,null,true)'`. Value can be a more complex object if required as long as it is serialisable. If used with a marker the name should be that of the marker - you can use `${name}` to let it be substituted automatically.
|
|
403
|
-
|
|
404
|
-
- **addToForm()** : takes a property name value pair to add to a variable called `form`. When used with contextmenu feedback (above) you can set the feedback value to `"_form"` to substitute this accumulated value. This allows you to do things like `onBlur='addToForm(this.name,this.value)'` over several different fields in the menu and then use `feedback(this.name,"_form")` to submit them all at once. For example a simple multiple line form could be as per the example below:
|
|
405
|
-
|
|
406
|
-
Also if you wish to retain the values between separate openings of this form you can assign property names to the value field in the form `value="${foo}`, etc. These will then appear as part of an **value** property on the worldmap-in node message.
|
|
407
|
-
|
|
408
|
-
```
|
|
409
|
-
var menu = 'Add some data <input name="foo" value="${foo}" onchange=\'addToForm(this.name,this.value)\'></input><br/>'
|
|
410
|
-
menu += 'Add more data <input name="bar" value="${bar}" onchange=\'addToForm(this.name,this.value)\'></input><br/>'
|
|
411
|
-
menu += '<button name="my_form" onclick=\'feedback(this.name,"_form",null,true)\'>Submit</button>'
|
|
412
|
-
msg.payload = { command: { "contextmenu":menu } }
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
- **delMarker()** : takes the name of the marker as a parameter. In a popup this can be specified as `${name}` for dynamic substitution.
|
|
416
|
-
|
|
417
|
-
- **editPoly()** : takes the name of the shape or line as a parameter. In a popup this can be specified as `${name}` for dynamic substitution.
|
|
418
|
-
|
|
419
|
-
|
|
420
363
|
## Controlling the map
|
|
421
364
|
|
|
422
365
|
You can also control the map via the node, by sending in a msg.payload containing a **command** object. Multiple parameters can be specified in one command.
|
|
@@ -467,62 +410,11 @@ You can also use the name "none" to completely remove the base layer,
|
|
|
467
410
|
|
|
468
411
|
msg.payload = { "command": { "layer":"none" }};
|
|
469
412
|
|
|
470
|
-
#### To
|
|
471
|
-
|
|
472
|
-
to add a button bottom right
|
|
473
|
-
|
|
474
|
-
msg.payload.command = { "button": { "name":"My Fancy Button", "icon": "fa-star", "position":"bottomright" } };
|
|
475
|
-
|
|
476
|
-
When clicked the button will send an event to the `worldmap in` node containing `{"action":"button", "name","My Fancy Button"}` - this can then be used to trigger other map commands or flows.
|
|
477
|
-
|
|
478
|
-
to remove
|
|
479
|
-
|
|
480
|
-
msg.payload.command = { "button": { "name":"My Fancy Button" } };
|
|
481
|
-
|
|
482
|
-
Multiple buttons can declared by using an array of button objects.
|
|
483
|
-
|
|
484
|
-
#### To add a custom popup or contextmenu
|
|
485
|
-
|
|
486
|
-
You can customise a marker's popup, or context menu (right click), by setting the
|
|
487
|
-
appropriate property to an html string. Often you will need some embedded javascript
|
|
488
|
-
in order to make it do something when you click a button for example. You need to be
|
|
489
|
-
careful escaping quotes, and that they remain matched.
|
|
490
|
-
|
|
491
|
-
For example a marker popup with a slider (note the \ escaping the internal ' )
|
|
492
|
-
|
|
493
|
-
popup: '<input name="slide1" type="range" min="1" max="100" value="50" onchange=\'feedback(${name},this.value,this.name)\' style="width:250px;">'
|
|
494
|
-
|
|
495
|
-
Or a marker contextmenu with an input box
|
|
496
|
-
|
|
497
|
-
contextmenu: '<input name="channel" type="text" value="5" onchange=\'feedback(${name},{"name":this.name,"value":this.value},"myFeedback")\' />'
|
|
498
|
-
|
|
499
|
-
Or you can add a contextmenu to the map. Simple contextmenu with a button
|
|
500
|
-
|
|
501
|
-
msg.payload.command = {
|
|
502
|
-
contextmenu: '<button name="Clicker" onclick=\'feedback(this.name,"ping!",null,true)\'>Click me</button>'
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
Or with an input box
|
|
506
|
-
|
|
507
|
-
msg.payload.command : {
|
|
508
|
-
contextmenu: '<input name="slide1" type="range" min="1" max="100" value="50" onchange=\'feedback(this.name,this.value,"myEventName")\' >'
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
Example simple form
|
|
512
|
-
|
|
513
|
-
```
|
|
514
|
-
[{"id":"7351100bacb1f5fe","type":"function","z":"4aa2ed2fd1b11362","name":"","func":"msg.payload = { command: {\ncontextmenu: String.raw`\nText <input type=\"text\" id=\"sometext\" value=\"hello\"><br/>\nNumber <input type=\"number\" id=\"somenum\" value=\"5\"><br/>\n<input type=\"button\" value=\"Send\" onclick=\n'feedback(\"myform\",{\n \"st\":document.getElementById(\"sometext\").value,\n \"sn\":document.getElementById(\"somenum\").value,\n})'\n>\n`\n}}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":360,"wires":[["a6a82f2e8efc44fc"]]},{"id":"7b595f0c8f6ac710","type":"worldmap in","z":"4aa2ed2fd1b11362","name":"","path":"/worldmap","events":"connect","x":195,"y":360,"wires":[["7351100bacb1f5fe"]]}]
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
See the section on **Utility Functions** for details of the feedback function.
|
|
518
|
-
|
|
519
|
-
#### To add and remove a legend
|
|
520
|
-
|
|
521
|
-
If you want to add a small legend overlay
|
|
413
|
+
#### To clear all markers from a layer, or an overlay from the map
|
|
522
414
|
|
|
523
|
-
msg.payload
|
|
415
|
+
msg.payload = { "command": { "clear: "name of the layer/overlay you wish to clear" }};
|
|
524
416
|
|
|
525
|
-
|
|
417
|
+
Feeding this into the tracks node will also remove the tracks stored for that layer.
|
|
526
418
|
|
|
527
419
|
#### To add a new base layer
|
|
528
420
|
|
|
@@ -536,23 +428,6 @@ may let your markers be more visible. (see overlay example below).
|
|
|
536
428
|
"opt":{ "maxZoom":19, "attribution":"© OpenStreetMap" }
|
|
537
429
|
};
|
|
538
430
|
|
|
539
|
-
#### To add a minimap
|
|
540
|
-
|
|
541
|
-
A minimap overview can be added by sending a suitable command. The "minimap" property
|
|
542
|
-
must specify the name of an existing base layer to use. The "opt" property can contain
|
|
543
|
-
valid options from the [minimap library options](https://github.com/Norkart/Leaflet-MiniMap#available-options).
|
|
544
|
-
|
|
545
|
-
msg.payload.command.map = {
|
|
546
|
-
minimap: "OSM",
|
|
547
|
-
opt: {
|
|
548
|
-
centerFixed: [51.05, -1.35],
|
|
549
|
-
toggleDisplay: true
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
};
|
|
553
|
-
|
|
554
|
-
Set `msg.payload.command.map.minimap = false;` to remove the minimap.
|
|
555
|
-
|
|
556
431
|
#### To remove base or overlay layers
|
|
557
432
|
|
|
558
433
|
To remove several layers, either base layers or overlays, you can pass an array of names as follows.
|
|
@@ -636,7 +511,7 @@ As per the geojson overlay you can also inject an ESRI ArcGIS FeatureLayer layer
|
|
|
636
511
|
|
|
637
512
|
NOTE: you can set various options as [specified here](https://developers.arcgis.com/esri-leaflet/api-reference/layers/feature-layer/#options).
|
|
638
513
|
|
|
639
|
-
In order to pass over **style**, **pointToLayer**, or **onEachFeature** functions they need to be serialised as follows
|
|
514
|
+
In order to pass over **style**, **pointToLayer**, or **onEachFeature** functions they need to be serialised as follows. For example
|
|
640
515
|
|
|
641
516
|
const style = function () {
|
|
642
517
|
return { color: "#910000", weight: 2 };
|
|
@@ -645,6 +520,18 @@ In order to pass over **style**, **pointToLayer**, or **onEachFeature** function
|
|
|
645
520
|
|
|
646
521
|
This may cause the function node setting them to be in error, for example if it references L.marker, which is unknown on the server side. The flow should still deploy and run ok.
|
|
647
522
|
|
|
523
|
+
#### To add an Image Overlay
|
|
524
|
+
|
|
525
|
+
You can overlay an image as long as you can specify the lower-left and upper-right corners. For example in a function node:
|
|
526
|
+
|
|
527
|
+
var imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]];
|
|
528
|
+
msg.payload = { command : { lat:40.74, lon:-74.175, zoom:13 } };
|
|
529
|
+
msg.payload.command.map = {
|
|
530
|
+
overlay: "New York Historical",
|
|
531
|
+
url: 'https://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg',
|
|
532
|
+
bounds: imageBounds,
|
|
533
|
+
opt: { opacity:0.8, attribution:"© University of Texas" }
|
|
534
|
+
};
|
|
648
535
|
|
|
649
536
|
#### To add a Velocity Grid Overlay
|
|
650
537
|
|
|
@@ -672,19 +559,6 @@ Or you can use try this docker image which uses the Canadian Meterological Servi
|
|
|
672
559
|
|
|
673
560
|
docker run -d -p 7000:7000 --name windserver theceejay/windserver:latest
|
|
674
561
|
|
|
675
|
-
#### To add an Image Overlay
|
|
676
|
-
|
|
677
|
-
in a function node:
|
|
678
|
-
|
|
679
|
-
var imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]];
|
|
680
|
-
msg.payload = { command : { lat:40.74, lon:-74.175, zoom:13 } };
|
|
681
|
-
msg.payload.command.map = {
|
|
682
|
-
overlay: "New York Historical",
|
|
683
|
-
url: 'https://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg',
|
|
684
|
-
bounds: imageBounds,
|
|
685
|
-
opt: { opacity:0.8, attribution:"© University of Texas" }
|
|
686
|
-
};
|
|
687
|
-
|
|
688
562
|
#### To add a Lat/Lon Graticule overlay
|
|
689
563
|
|
|
690
564
|
A graticule can be enabled via the node configuration, and can also be set dynamically,
|
|
@@ -697,11 +571,178 @@ for example in a function node:
|
|
|
697
571
|
|
|
698
572
|
see https://github.com/cloudybay/leaflet.latlng-graticule for more details about options and demo.
|
|
699
573
|
|
|
700
|
-
#### To
|
|
574
|
+
#### To add and remove a user defined button
|
|
701
575
|
|
|
702
|
-
|
|
576
|
+
to add a button bottom right
|
|
703
577
|
|
|
704
|
-
|
|
578
|
+
msg.payload.command = { "button": { "name":"My Fancy Button", "icon": "fa-star", "position":"bottomright" } };
|
|
579
|
+
|
|
580
|
+
When clicked the button will send an event to the `worldmap in` node containing `{"action":"button", "name","My Fancy Button"}` - this can then be used to trigger other map commands or flows.
|
|
581
|
+
|
|
582
|
+
to remove
|
|
583
|
+
|
|
584
|
+
msg.payload.command = { "button": { "name":"My Fancy Button" } };
|
|
585
|
+
|
|
586
|
+
Multiple buttons can declared by using an array of button objects.
|
|
587
|
+
|
|
588
|
+
#### To add a custom popup or contextmenu
|
|
589
|
+
|
|
590
|
+
You can customise a marker's popup, or context menu (right click), by setting the
|
|
591
|
+
appropriate property to an html string. Often you will need some embedded javascript
|
|
592
|
+
in order to make it do something when you click a button for example. You need to be
|
|
593
|
+
careful escaping quotes, and that they remain matched.
|
|
594
|
+
|
|
595
|
+
For example a marker popup with a slider (note the \ escaping the internal ' )
|
|
596
|
+
|
|
597
|
+
popup: '<input name="slide1" type="range" min="1" max="100" value="50" onchange=\'feedback(${name},this.value,this.name)\' style="width:250px;">'
|
|
598
|
+
|
|
599
|
+
Or a marker contextmenu with an input box
|
|
600
|
+
|
|
601
|
+
contextmenu: '<input name="channel" type="text" value="5" onchange=\'feedback(${name},{"name":this.name,"value":this.value},"myFeedback")\' />'
|
|
602
|
+
|
|
603
|
+
Or you can add a contextmenu to the map. Simple contextmenu with a button
|
|
604
|
+
|
|
605
|
+
msg.payload.command = {
|
|
606
|
+
contextmenu: '<button name="Clicker" onclick=\'feedback(this.name,"ping!",null,true)\'>Click me</button>'
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
Or with an input box
|
|
610
|
+
|
|
611
|
+
msg.payload.command : {
|
|
612
|
+
contextmenu: '<input name="slide1" type="range" min="1" max="100" value="50" onchange=\'feedback(this.name,this.value,"myEventName")\' >'
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
Example simple form
|
|
616
|
+
|
|
617
|
+
```
|
|
618
|
+
[{"id":"7351100bacb1f5fe","type":"function","z":"4aa2ed2fd1b11362","name":"","func":"msg.payload = { command: {\ncontextmenu: String.raw`\nText <input type=\"text\" id=\"sometext\" value=\"hello\"><br/>\nNumber <input type=\"number\" id=\"somenum\" value=\"5\"><br/>\n<input type=\"button\" value=\"Send\" onclick=\n'feedback(\"myform\",{\n \"st\":document.getElementById(\"sometext\").value,\n \"sn\":document.getElementById(\"somenum\").value,\n})'\n>\n`\n}}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":360,"wires":[["a6a82f2e8efc44fc"]]},{"id":"7b595f0c8f6ac710","type":"worldmap in","z":"4aa2ed2fd1b11362","name":"","path":"/worldmap","events":"connect","x":195,"y":360,"wires":[["7351100bacb1f5fe"]]}]
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
See the section on **Utility Functions** for details of the feedback function.
|
|
622
|
+
|
|
623
|
+
#### To add and remove a legend
|
|
624
|
+
|
|
625
|
+
If you want to add a small legend overlay
|
|
626
|
+
|
|
627
|
+
msg.payload.command = { "legend": "<b>Title</b></br><i style=\"background: #477AC2\"></i> Water<br><i style=\"background: #448D40\"></i> Forest<br>" };
|
|
628
|
+
|
|
629
|
+
To remove set the legend to an empty string `""`.
|
|
630
|
+
|
|
631
|
+
#### To add a minimap
|
|
632
|
+
|
|
633
|
+
A minimap overview can be added by sending a suitable command. The "minimap" property
|
|
634
|
+
must specify the name of an existing base layer to use. The "opt" property can contain
|
|
635
|
+
valid options from the [minimap library options](https://github.com/Norkart/Leaflet-MiniMap#available-options).
|
|
636
|
+
|
|
637
|
+
msg.payload.command.map = {
|
|
638
|
+
minimap: "OSM",
|
|
639
|
+
opt: {
|
|
640
|
+
centerFixed: [51.05, -1.35],
|
|
641
|
+
toggleDisplay: true
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
Set `msg.payload.command.map.minimap = false;` to remove the minimap.
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
## Events from the map
|
|
650
|
+
|
|
651
|
+
The **worldmap in** node can be used to receive various events from the map. Examples of messages coming FROM the map include:
|
|
652
|
+
|
|
653
|
+
{ "action": "connected" } // useful to trigger delivery or redraw of points
|
|
654
|
+
{ "action": "disconnect", "clients": 1 } // when a client disconnects - reports number remaining
|
|
655
|
+
{"action":"bounds", "south":50.55, "west":-1.48, "north":50.72, "east":-0.98} // reports the outer bounds of the hmap area when zoomed or moved
|
|
656
|
+
|
|
657
|
+
{ "action": "click", "name":"Jason", "layer":"gps", "icon":"male", "iconColor":"blue", "lat":51.024985, "lon":-1.39698 } // when a marker is clicked
|
|
658
|
+
{ "action": "move", "name":"Jason", "layer":"gps", "icon":"male", "iconColor":"blue", "lat":51.044632, "lon":-1.359901 } // when a marker is moved
|
|
659
|
+
{ "action": "delete", "name": "Jason" } // when a point or shape is deleted
|
|
660
|
+
|
|
661
|
+
{ "action": "point", "lat": "50.60634", "lon": "-1.66580", "point": "Jason,male,gps" }
|
|
662
|
+
{ "action": "draw", "type": "rectangle", "points": [ { "lat": 50.61243889044519, "lng": -1.5913009643554688 }, { "lat": 50.66665471366635, "lng": -1.5913009643554688 }, { "lat": 50.66665471366635, "lng": -1.4742279052734375 }, { "lat": 50.61243889044519, "lng": -1.4742279052734375 } ] }
|
|
663
|
+
|
|
664
|
+
{ "action": "layer", "name": "myLayer" } // when a map layer is changed
|
|
665
|
+
{ "action": "addlayer", "name": "myLayer" } // when a new map layer is added
|
|
666
|
+
{ "action": "dellayer", "name": "myLayer" } // when a new map layer is deleted
|
|
667
|
+
|
|
668
|
+
{ "action": "file", "name": "myfilename", "type":"image/jpeg", "lat":51, "lon":-1, "content":"....."} // when a file is dropped on the map - see below.
|
|
669
|
+
|
|
670
|
+
{ "action": "button", "name": "My Fancy Button" } // when a user defined button is clicked
|
|
671
|
+
|
|
672
|
+
{ "action": "feedback", "name": "some name", "value": "some value", "lat":51, "lon":0, "layer":"unknown" } // when a user calls the feedback function - see below
|
|
673
|
+
|
|
674
|
+
If File Drop is enabled - then the map can accept files of type gpx, kml, nvg, jpeg, png and geojson. The file content property will always be a binary buffer. The lat, lon of the cursor drop point will be included. Tracks will be locally rendered on the map. The `node-red-node-exif` node can be used to extract location information from a jpeg image and then geolocate it back on the map. Png images will be located where they are dropped but can then be dragged if required.
|
|
675
|
+
|
|
676
|
+
All actions also include a:
|
|
677
|
+
`msg._sessionid` property that indicates which client session they came from. Any msg sent out that includes this property will ONLY be sent to that session - so you can target map updates to specific sessions if required.
|
|
678
|
+
`msg._sessionip` property that shows the ip of the client that is connected to the session.
|
|
679
|
+
|
|
680
|
+
The "connected" action additionally includes a:
|
|
681
|
+
`msg.payload.parameters` property object that lists the parameters sent in the url.
|
|
682
|
+
`msg.payload.clientTimezone` property string showing the clients local Timezone. Returns bool of `false` if unable to retrive clients local Timezone.
|
|
683
|
+
`msg._clientheaders` property that shows the headers sent by the client to make a connection to the session.
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
### Utility functions
|
|
687
|
+
|
|
688
|
+
There are some internal functions available to make interacting with Node-RED easier (e.g. from inside a user defined popup., these include:
|
|
689
|
+
|
|
690
|
+
- **feedback()** : it takes 2, 3, or 4 parameters, name, value, and optionally an action name (defaults to "feedback"), and optional boolean to close the popup on calling this function, and can be used inside something like an input tag - `onchange='feedback(this.name,this.value,null,true)'`. Value can be a more complex object if required as long as it is serialisable. If used with a marker the name should be that of the marker - you can use `${name}` to let it be substituted automatically.
|
|
691
|
+
|
|
692
|
+
- **addToForm()** : takes a property name value pair to add to a variable called `form`. When used with contextmenu feedback (above) you can set the feedback value to `"_form"` to substitute this accumulated value. This allows you to do things like `onBlur='addToForm(this.name,this.value)'` over several different fields in the menu and then use `feedback(this.name,"_form")` to submit them all at once. For example a simple multiple line form could be as per the example below:
|
|
693
|
+
|
|
694
|
+
Also if you wish to retain the values between separate openings of this form you can assign property names to the value field in the form `value="${foo}`, etc. These will then appear as part of an **value** property on the worldmap-in node message.
|
|
695
|
+
|
|
696
|
+
```
|
|
697
|
+
var menu = 'Add some data <input name="foo" value="${foo}" onchange=\'addToForm(this.name,this.value)\'></input><br/>'
|
|
698
|
+
menu += 'Add more data <input name="bar" value="${bar}" onchange=\'addToForm(this.name,this.value)\'></input><br/>'
|
|
699
|
+
menu += '<button name="my_form" onclick=\'feedback(this.name,"_form",null,true)\'>Submit</button>'
|
|
700
|
+
msg.payload = { command: { "contextmenu":menu } }
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
- **delMarker()** : takes the name of the marker as a parameter. In a popup this can be specified as `${name}` for dynamic substitution.
|
|
704
|
+
|
|
705
|
+
- **editPoly()** : takes the name of the shape or line as a parameter. In a popup this can be specified as `${name}` for dynamic substitution.
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
## Serving maps
|
|
709
|
+
|
|
710
|
+
By default this node expects users to have access to the internet in order to access the map servers that provide all the built in mapping. As per above you are able to add your own sources of mapping and sometimes this includes the requirement for offline access, in which case maps must be served up locally. There are several ways to do this outlined below. My personal favourite is the Tileserver-gl docker option, but of course this does require Docker.
|
|
711
|
+
|
|
712
|
+
### Using PMtiles files
|
|
713
|
+
|
|
714
|
+
You can use a PMtiles format map archive file from [Protomaps](https://docs.protomaps.com/basemaps/downloads) as a base layer map.
|
|
715
|
+
|
|
716
|
+
**Note**: the whole planet file is over 100GB so be warned both for local storage and your download speed. You can download or extract just a portion of it if you use the **pmtiles** command line with the extract option. Use `pmtiles extract --help` to see the options.
|
|
717
|
+
|
|
718
|
+
Copy, or create an alias to, your .pmtiles file(s) into your `~/.node-red/node_modules/node-red-contrib-web-worldmap/worldmap/` directory. On re-starting Node-RED the node will detect the file(s) and add them to the base map layer menu, using the file name as the layer name.
|
|
719
|
+
|
|
720
|
+
### Using a Docker Map Server
|
|
721
|
+
|
|
722
|
+
I have found the easiest to use mapserver for decent generic map to be Tileserver-gl. It uses mbtiles format maps - for example from [MapTiler Data](https://data.maptiler.com/downloads/planet/). You can download your mbtiles file into a directory and then from that directory run
|
|
723
|
+
```
|
|
724
|
+
docker run --name maptiler -d -v $(pwd):/data -p 1884:8080 maptiler/tileserver-gl -p 8080 --mbtiles yourMapFile.mbtiles
|
|
725
|
+
```
|
|
726
|
+
and use a url like `"url": "http://localhost:1884/styles/basic-preview/{z}/{x}/{y}.png"`
|
|
727
|
+
|
|
728
|
+
Other more traditional map servers include containers like https://hub.docker.com/r/camptocamp/mapserver, then assuming you have the mapfile 'my-app.map' in the current working directory, you could mount it as:
|
|
729
|
+
```
|
|
730
|
+
docker run -d --name camptocamp -v $(pwd):/etc/mapserver/:ro -p 1881:80 camptocamp/mapserver
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
then the url should be of the form `"url": "http://localhost:1881/?map=/etc/mapserver/my-app.map"` where *my-app.map* is the name of your map file. A quick test of the server would be to browse to http://localhost:1881/?map=/etc/mapserver/my-app.map&mode=map
|
|
734
|
+
|
|
735
|
+
Or you can use a docker container like https://hub.docker.com/r/geodata/mapserver/ then assuming you have the mapfile 'my-app.map' in the current working directory, you could mount it as:
|
|
736
|
+
```
|
|
737
|
+
docker run -d --name mapserver -v $(pwd):/maps:ro -p 1882:80 geodata/mapserver
|
|
738
|
+
```
|
|
739
|
+
and use a url like `"url": "http://localhost:1882/?map=/maps/my-app.map",`
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
Other useful map servers include Geoserver, a somewhat larger image but fully featured.
|
|
743
|
+
```
|
|
744
|
+
docker run --name geoserver -d -v ${PWD}:/var/local/geoserver -p 1885:8080 oscarfonts/geoserver
|
|
745
|
+
```
|
|
705
746
|
|
|
706
747
|
### Using a local Map Server (WMS server)
|
|
707
748
|
|
|
@@ -735,32 +776,6 @@ You can then add a new WMS Base layer by injecting a message like
|
|
|
735
776
|
"wms": true // set to true for WMS type mapserver
|
|
736
777
|
}}}
|
|
737
778
|
|
|
738
|
-
#### Using a Docker Map Server
|
|
739
|
-
|
|
740
|
-
You can use a docker container like https://hub.docker.com/r/camptocamp/mapserver, then assuming you have the mapfile 'my-app.map' in the current working directory, you could mount it as:
|
|
741
|
-
```
|
|
742
|
-
docker run -d --name camptocamp -v $(pwd):/etc/mapserver/:ro -p 1881:80 camptocamp/mapserver
|
|
743
|
-
```
|
|
744
|
-
|
|
745
|
-
then the url should be of the form `"url": "http://localhost:1881/?map=/etc/mapserver/my-app.map"` where *my-app.map* is the name of your map file. A quick test of the server would be to browse to http://localhost:1881/?map=/etc/mapserver/my-app.map&mode=map
|
|
746
|
-
|
|
747
|
-
Or you can use a docker container like https://hub.docker.com/r/geodata/mapserver/ then assuming you have the mapfile 'my-app.map' in the current working directory, you could mount it as:
|
|
748
|
-
```
|
|
749
|
-
docker run -d --name mapserver -v $(pwd):/maps:ro -p 1882:80 geodata/mapserver
|
|
750
|
-
```
|
|
751
|
-
and use a url like `"url": "http://localhost:1882/?map=/maps/my-app.map",`
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
To use a vector mbtiles server like **MapTiler** then you can download your mbtiles file into a directory and then from that directory run
|
|
755
|
-
```
|
|
756
|
-
docker run --name maptiler -d -v $(pwd):/data -p 1884:8080 maptiler/tileserver-gl -p 8080 --mbtiles yourMapFile.mbtiles
|
|
757
|
-
```
|
|
758
|
-
and use a url like `"url": "http://localhost:1884/styles/basic-preview/{z}/{x}/{y}.png"`
|
|
759
|
-
|
|
760
|
-
Other useful map servers include Geoserver, a somewhat larger image but fully featured.
|
|
761
|
-
```
|
|
762
|
-
docker run --name geoserver -d -v ${PWD}:/var/local/geoserver -p 1885:8080 oscarfonts/geoserver
|
|
763
|
-
```
|
|
764
779
|
|
|
765
780
|
---
|
|
766
781
|
|
package/package.json
CHANGED
package/worldmap/index.html
CHANGED
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
<script src="leaflet/leaflet.latlng-graticule.js"></script>
|
|
77
77
|
<script src="leaflet/VectorTileLayer.umd.min.js"></script>
|
|
78
78
|
<script src="leaflet/esri-leaflet.js"></script>
|
|
79
|
+
<script src="leaflet/protomaps-leaflet.min.js"></script>
|
|
79
80
|
<script src="leaflet/Semicircle.js"></script>
|
|
80
81
|
<script src='leaflet/leaflet-arc.min.js'></script>
|
|
81
82
|
<script src='leaflet/leaflet.antimeridian-src.js'></script>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var protomapsL=(()=>{var bi=Object.create;var De=Object.defineProperty;var wi=Object.getOwnPropertyDescriptor;var vi=Object.getOwnPropertyNames,Jt=Object.getOwnPropertySymbols,_i=Object.getPrototypeOf,Gt=Object.prototype.hasOwnProperty,zi=Object.prototype.propertyIsEnumerable;var Qt=(t,e,r)=>e in t?De(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,er=(t,e)=>{for(var r in e||(e={}))Gt.call(e,r)&&Qt(t,r,e[r]);if(Jt)for(var r of Jt(e))zi.call(e,r)&&Qt(t,r,e[r]);return t};var tr=t=>De(t,"__esModule",{value:!0});var K=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ki=(t,e)=>{tr(t);for(var r in e)De(t,r,{get:e[r],enumerable:!0})},Li=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of vi(e))!Gt.call(t,i)&&i!=="default"&&De(t,i,{get:()=>e[i],enumerable:!(r=wi(e,i))||r.enumerable});return t},N=t=>Li(tr(De(t!=null?bi(_i(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var O=(t,e,r)=>new Promise((i,n)=>{var a=l=>{try{o(r.next(l))}catch(u){n(u)}},s=l=>{try{o(r.throw(l))}catch(u){n(u)}},o=l=>l.done?i(l.value):Promise.resolve(l.value).then(a,s);o((r=r.apply(t,e)).next())});var re=K((ca,rr)=>{"use strict";rr.exports=ge;function ge(t,e){this.x=t,this.y=e}ge.prototype={clone:function(){return new ge(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),i=e*this.x-r*this.y,n=r*this.x+e*this.y;return this.x=i,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),i=Math.sin(t),n=e.x+r*(this.x-e.x)-i*(this.y-e.y),a=e.y+i*(this.x-e.x)+r*(this.y-e.y);return this.x=n,this.y=a,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}};ge.convert=function(t){return t instanceof ge?t:Array.isArray(t)?new ge(t[0],t[1]):t}});var pt=K((ma,ir)=>{"use strict";var Si=re();ir.exports=be;function be(t,e,r,i,n){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=i,this._values=n,t.readFields(Fi,this,e)}function Fi(t,e,r){t==1?e.id=r.readVarint():t==2?Mi(r,e):t==3?e.type=r.readVarint():t==4&&(e._geometry=r.pos)}function Mi(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var i=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[i]=n}}be.types=["Unknown","Point","LineString","Polygon"];be.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,i=0,n=0,a=0,s=[],o;t.pos<e;){if(i<=0){var l=t.readVarint();r=l&7,i=l>>3}if(i--,r===1||r===2)n+=t.readSVarint(),a+=t.readSVarint(),r===1&&(o&&s.push(o),o=[]),o.push(new Si(n,a));else if(r===7)o&&o.push(o[0].clone());else throw new Error("unknown command "+r)}return o&&s.push(o),s};be.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,i=0,n=0,a=0,s=1/0,o=-1/0,l=1/0,u=-1/0;t.pos<e;){if(i<=0){var f=t.readVarint();r=f&7,i=f>>3}if(i--,r===1||r===2)n+=t.readSVarint(),a+=t.readSVarint(),n<s&&(s=n),n>o&&(o=n),a<l&&(l=a),a>u&&(u=a);else if(r!==7)throw new Error("unknown command "+r)}return[s,l,o,u]};be.prototype.toGeoJSON=function(t,e,r){var i=this.extent*Math.pow(2,r),n=this.extent*t,a=this.extent*e,s=this.loadGeometry(),o=be.types[this.type],l,u;function f(x){for(var w=0;w<x.length;w++){var z=x[w],h=180-(z.y+a)*360/i;x[w]=[(z.x+n)*360/i-180,360/Math.PI*Math.atan(Math.exp(h*Math.PI/180))-90]}}switch(this.type){case 1:var d=[];for(l=0;l<s.length;l++)d[l]=s[l][0];s=d,f(s);break;case 2:for(l=0;l<s.length;l++)f(s[l]);break;case 3:for(s=Ci(s),l=0;l<s.length;l++)for(u=0;u<s[l].length;u++)f(s[l][u]);break}s.length===1?s=s[0]:o="Multi"+o;var c={type:"Feature",geometry:{type:o,coordinates:s},properties:this.properties};return"id"in this&&(c.id=this.id),c};function Ci(t){var e=t.length;if(e<=1)return[t];for(var r=[],i,n,a=0;a<e;a++){var s=Ti(t[a]);s!==0&&(n===void 0&&(n=s<0),n===s<0?(i&&r.push(i),i=[t[a]]):i.push(t[a]))}return i&&r.push(i),r}function Ti(t){for(var e=0,r=0,i=t.length,n=i-1,a,s;r<i;n=r++)a=t[r],s=t[n],e+=(s.x-a.x)*(a.y+s.y);return e}});var yt=K((pa,ar)=>{"use strict";var Pi=pt();ar.exports=nr;function nr(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Di,this,e),this.length=this._features.length}function Di(t,e,r){t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(Ai(r))}function Ai(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var i=t.readVarint()>>3;e=i===1?t.readString():i===2?t.readFloat():i===3?t.readDouble():i===4?t.readVarint64():i===5?t.readVarint():i===6?t.readSVarint():i===7?t.readBoolean():null}return e}nr.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new Pi(this._pbf,e,this.extent,this._keys,this._values)}});var or=K((ya,sr)=>{"use strict";var Bi=yt();sr.exports=Ei;function Ei(t,e){this.layers=t.readFields(Ri,{},e)}function Ri(t,e,r){if(t===3){var i=new Bi(r,r.readVarint()+r.pos);i.length&&(e[i.name]=i)}}});var lr=K((xa,Ge)=>{Ge.exports.VectorTile=or();Ge.exports.VectorTileFeature=pt();Ge.exports.VectorTileLayer=yt()});var ur=K(xt=>{xt.read=function(t,e,r,i,n){var a,s,o=n*8-i-1,l=(1<<o)-1,u=l>>1,f=-7,d=r?n-1:0,c=r?-1:1,x=t[e+d];for(d+=c,a=x&(1<<-f)-1,x>>=-f,f+=o;f>0;a=a*256+t[e+d],d+=c,f-=8);for(s=a&(1<<-f)-1,a>>=-f,f+=i;f>0;s=s*256+t[e+d],d+=c,f-=8);if(a===0)a=1-u;else{if(a===l)return s?NaN:(x?-1:1)*(1/0);s=s+Math.pow(2,i),a=a-u}return(x?-1:1)*s*Math.pow(2,a-i)};xt.write=function(t,e,r,i,n,a){var s,o,l,u=a*8-n-1,f=(1<<u)-1,d=f>>1,c=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=i?0:a-1,w=i?1:-1,z=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+d>=1?e+=c/l:e+=c*Math.pow(2,1-d),e*l>=2&&(s++,l/=2),s+d>=f?(o=0,s=f):s+d>=1?(o=(e*l-1)*Math.pow(2,n),s=s+d):(o=e*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;t[r+x]=o&255,x+=w,o/=256,n-=8);for(s=s<<n|o,u+=n;u>0;t[r+x]=s&255,x+=w,s/=256,u-=8);t[r+x-w]|=z*128}});var pr=K((ba,mr)=>{"use strict";mr.exports=F;var Qe=ur();function F(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}F.Varint=0;F.Fixed64=1;F.Bytes=2;F.Fixed32=5;var gt=(1<<16)*(1<<16),hr=1/gt,Oi=12,fr=typeof TextDecoder=="undefined"?null:new TextDecoder("utf8");F.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var i=this.readVarint(),n=i>>3,a=this.pos;this.type=i&7,t(n,e,this),this.pos===a&&this.skip(i)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=et(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=cr(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=et(this.buf,this.pos)+et(this.buf,this.pos+4)*gt;return this.pos+=8,t},readSFixed64:function(){var t=et(this.buf,this.pos)+cr(this.buf,this.pos+4)*gt;return this.pos+=8,t},readFloat:function(){var t=Qe.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Qe.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e=this.buf,r,i;return i=e[this.pos++],r=i&127,i<128||(i=e[this.pos++],r|=(i&127)<<7,i<128)||(i=e[this.pos++],r|=(i&127)<<14,i<128)||(i=e[this.pos++],r|=(i&127)<<21,i<128)?r:(i=e[this.pos],r|=(i&15)<<28,Ii(r,t,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=Oi&&fr?Gi(this.buf,e,t):Ji(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==F.Bytes)return t.push(this.readVarint(e));var r=ae(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==F.Bytes)return t.push(this.readSVarint());var e=ae(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==F.Bytes)return t.push(this.readBoolean());var e=ae(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==F.Bytes)return t.push(this.readFloat());var e=ae(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==F.Bytes)return t.push(this.readDouble());var e=ae(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==F.Bytes)return t.push(this.readFixed32());var e=ae(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==F.Bytes)return t.push(this.readSFixed32());var e=ae(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==F.Bytes)return t.push(this.readFixed64());var e=ae(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==F.Bytes)return t.push(this.readSFixed64());var e=ae(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===F.Varint)for(;this.buf[this.pos++]>127;);else if(e===F.Bytes)this.pos=this.readVarint()+this.pos;else if(e===F.Fixed32)this.pos+=4;else if(e===F.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),ve(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),ve(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),ve(this.buf,t&-1,this.pos),ve(this.buf,Math.floor(t*hr),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),ve(this.buf,t&-1,this.pos),ve(this.buf,Math.floor(t*hr),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){Xi(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?-t*2-1:t*2)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(t.length*4),this.pos++;var e=this.pos;this.pos=Qi(this.buf,t,this.pos);var r=this.pos-e;r>=128&&dr(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Qe.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Qe.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var i=this.pos-r;i>=128&&dr(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i},writeMessage:function(t,e,r){this.writeTag(t,F.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Ui,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,ji,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Zi,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Ni,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,qi,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Wi,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,$i,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Hi,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Ki,e)},writeBytesField:function(t,e){this.writeTag(t,F.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,F.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,F.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,F.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,F.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,F.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,F.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,F.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,F.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,F.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};function Ii(t,e,r){var i=r.buf,n,a;if(a=i[r.pos++],n=(a&112)>>4,a<128||(a=i[r.pos++],n|=(a&127)<<3,a<128)||(a=i[r.pos++],n|=(a&127)<<10,a<128)||(a=i[r.pos++],n|=(a&127)<<17,a<128)||(a=i[r.pos++],n|=(a&127)<<24,a<128)||(a=i[r.pos++],n|=(a&1)<<31,a<128))return we(t,n,e);throw new Error("Expected varint not more than 10 bytes")}function ae(t){return t.type===F.Bytes?t.readVarint()+t.pos:t.pos+1}function we(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Xi(t,e){var r,i;if(t>=0?(r=t%4294967296|0,i=t/4294967296|0):(r=~(-t%4294967296),i=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,i=i+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),Vi(r,i,e),Yi(i,e)}function Vi(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function Yi(t,e){var r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),!!t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),!!t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),!!t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),!!t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),!!t&&(e.buf[e.pos++]=t&127)))))}function dr(t,e,r){var i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(i);for(var n=r.pos-1;n>=t;n--)r.buf[n+i]=r.buf[n]}function Ui(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function ji(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function Ni(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function qi(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function Zi(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function Wi(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function $i(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function Hi(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function Ki(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function et(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function ve(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function cr(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Ji(t,e,r){for(var i="",n=e;n<r;){var a=t[n],s=null,o=a>239?4:a>223?3:a>191?2:1;if(n+o>r)break;var l,u,f;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],f=t[n+3],(l&192)==128&&(u&192)==128&&(f&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|f&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function Gi(t,e,r){return fr.decode(t.subarray(e,r))}function Qi(t,e,r){for(var i=0,n,a;i<e.length;i++){if(n=e.charCodeAt(i),n>55295&&n<57344)if(a)if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,a=n;continue}else n=a-55296<<10|n-56320|65536,a=null;else{n>56319||i+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):a=n;continue}else a&&(t[r++]=239,t[r++]=191,t[r++]=189,a=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=n&63|128)}return r}});var jr=K((Ft,Mt)=>{(function(t,e){typeof Ft=="object"&&typeof Mt!="undefined"?Mt.exports=e():typeof define=="function"&&define.amd?define(e):(t=t||self).RBush=e()})(Ft,function(){"use strict";function t(h,m,p,b,y){(function g(v,_,k,S,D){for(;S>k;){if(S-k>600){var T=S-k+1,E=_-k+1,W=Math.log(T),$=.5*Math.exp(2*W/3),ie=.5*Math.sqrt(W*$*(T-$)/T)*(E-T/2<0?-1:1),V=Math.max(k,Math.floor(_-E*$/T+ie)),dt=Math.min(S,Math.floor(_+(T-E)*$/T+ie));g(v,_,V,dt,D)}var xe=v[_],ne=k,R=S;for(e(v,k,_),D(v[S],xe)>0&&e(v,k,S);ne<R;){for(e(v,ne,R),ne++,R--;D(v[ne],xe)<0;)ne++;for(;D(v[R],xe)>0;)R--}D(v[k],xe)===0?e(v,k,R):e(v,++R,S),R<=_&&(k=R+1),_<=R&&(S=R-1)}})(h,m,p||0,b||h.length-1,y||r)}function e(h,m,p){var b=h[m];h[m]=h[p],h[p]=b}function r(h,m){return h<m?-1:h>m?1:0}var i=function(h){h===void 0&&(h=9),this._maxEntries=Math.max(4,h),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function n(h,m,p){if(!p)return m.indexOf(h);for(var b=0;b<m.length;b++)if(p(h,m[b]))return b;return-1}function a(h,m){s(h,0,h.children.length,m,h)}function s(h,m,p,b,y){y||(y=w(null)),y.minX=1/0,y.minY=1/0,y.maxX=-1/0,y.maxY=-1/0;for(var g=m;g<p;g++){var v=h.children[g];o(y,h.leaf?b(v):v)}return y}function o(h,m){return h.minX=Math.min(h.minX,m.minX),h.minY=Math.min(h.minY,m.minY),h.maxX=Math.max(h.maxX,m.maxX),h.maxY=Math.max(h.maxY,m.maxY),h}function l(h,m){return h.minX-m.minX}function u(h,m){return h.minY-m.minY}function f(h){return(h.maxX-h.minX)*(h.maxY-h.minY)}function d(h){return h.maxX-h.minX+(h.maxY-h.minY)}function c(h,m){return h.minX<=m.minX&&h.minY<=m.minY&&m.maxX<=h.maxX&&m.maxY<=h.maxY}function x(h,m){return m.minX<=h.maxX&&m.minY<=h.maxY&&m.maxX>=h.minX&&m.maxY>=h.minY}function w(h){return{children:h,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function z(h,m,p,b,y){for(var g=[m,p];g.length;)if(!((p=g.pop())-(m=g.pop())<=b)){var v=m+Math.ceil((p-m)/b/2)*b;t(h,v,m,p,y),g.push(m,v,v,p)}}return i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(h){var m=this.data,p=[];if(!x(h,m))return p;for(var b=this.toBBox,y=[];m;){for(var g=0;g<m.children.length;g++){var v=m.children[g],_=m.leaf?b(v):v;x(h,_)&&(m.leaf?p.push(v):c(h,_)?this._all(v,p):y.push(v))}m=y.pop()}return p},i.prototype.collides=function(h){var m=this.data;if(!x(h,m))return!1;for(var p=[];m;){for(var b=0;b<m.children.length;b++){var y=m.children[b],g=m.leaf?this.toBBox(y):y;if(x(h,g)){if(m.leaf||c(h,g))return!0;p.push(y)}}m=p.pop()}return!1},i.prototype.load=function(h){if(!h||!h.length)return this;if(h.length<this._minEntries){for(var m=0;m<h.length;m++)this.insert(h[m]);return this}var p=this._build(h.slice(),0,h.length-1,0);if(this.data.children.length)if(this.data.height===p.height)this._splitRoot(this.data,p);else{if(this.data.height<p.height){var b=this.data;this.data=p,p=b}this._insert(p,this.data.height-p.height-1,!0)}else this.data=p;return this},i.prototype.insert=function(h){return h&&this._insert(h,this.data.height-1),this},i.prototype.clear=function(){return this.data=w([]),this},i.prototype.remove=function(h,m){if(!h)return this;for(var p,b,y,g=this.data,v=this.toBBox(h),_=[],k=[];g||_.length;){if(g||(g=_.pop(),b=_[_.length-1],p=k.pop(),y=!0),g.leaf){var S=n(h,g.children,m);if(S!==-1)return g.children.splice(S,1),_.push(g),this._condense(_),this}y||g.leaf||!c(g,v)?b?(p++,g=b.children[p],y=!1):g=null:(_.push(g),k.push(p),p=0,b=g,g=g.children[0])}return this},i.prototype.toBBox=function(h){return h},i.prototype.compareMinX=function(h,m){return h.minX-m.minX},i.prototype.compareMinY=function(h,m){return h.minY-m.minY},i.prototype.toJSON=function(){return this.data},i.prototype.fromJSON=function(h){return this.data=h,this},i.prototype._all=function(h,m){for(var p=[];h;)h.leaf?m.push.apply(m,h.children):p.push.apply(p,h.children),h=p.pop();return m},i.prototype._build=function(h,m,p,b){var y,g=p-m+1,v=this._maxEntries;if(g<=v)return a(y=w(h.slice(m,p+1)),this.toBBox),y;b||(b=Math.ceil(Math.log(g)/Math.log(v)),v=Math.ceil(g/Math.pow(v,b-1))),(y=w([])).leaf=!1,y.height=b;var _=Math.ceil(g/v),k=_*Math.ceil(Math.sqrt(v));z(h,m,p,k,this.compareMinX);for(var S=m;S<=p;S+=k){var D=Math.min(S+k-1,p);z(h,S,D,_,this.compareMinY);for(var T=S;T<=D;T+=_){var E=Math.min(T+_-1,D);y.children.push(this._build(h,T,E,b-1))}}return a(y,this.toBBox),y},i.prototype._chooseSubtree=function(h,m,p,b){for(;b.push(m),!m.leaf&&b.length-1!==p;){for(var y=1/0,g=1/0,v=void 0,_=0;_<m.children.length;_++){var k=m.children[_],S=f(k),D=(T=h,E=k,(Math.max(E.maxX,T.maxX)-Math.min(E.minX,T.minX))*(Math.max(E.maxY,T.maxY)-Math.min(E.minY,T.minY))-S);D<g?(g=D,y=S<y?S:y,v=k):D===g&&S<y&&(y=S,v=k)}m=v||m.children[0]}var T,E;return m},i.prototype._insert=function(h,m,p){var b=p?h:this.toBBox(h),y=[],g=this._chooseSubtree(b,this.data,m,y);for(g.children.push(h),o(g,b);m>=0&&y[m].children.length>this._maxEntries;)this._split(y,m),m--;this._adjustParentBBoxes(b,y,m)},i.prototype._split=function(h,m){var p=h[m],b=p.children.length,y=this._minEntries;this._chooseSplitAxis(p,y,b);var g=this._chooseSplitIndex(p,y,b),v=w(p.children.splice(g,p.children.length-g));v.height=p.height,v.leaf=p.leaf,a(p,this.toBBox),a(v,this.toBBox),m?h[m-1].children.push(v):this._splitRoot(p,v)},i.prototype._splitRoot=function(h,m){this.data=w([h,m]),this.data.height=h.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},i.prototype._chooseSplitIndex=function(h,m,p){for(var b,y,g,v,_,k,S,D=1/0,T=1/0,E=m;E<=p-m;E++){var W=s(h,0,E,this.toBBox),$=s(h,E,p,this.toBBox),ie=(y=W,g=$,v=void 0,_=void 0,k=void 0,S=void 0,v=Math.max(y.minX,g.minX),_=Math.max(y.minY,g.minY),k=Math.min(y.maxX,g.maxX),S=Math.min(y.maxY,g.maxY),Math.max(0,k-v)*Math.max(0,S-_)),V=f(W)+f($);ie<D?(D=ie,b=E,T=V<T?V:T):ie===D&&V<T&&(T=V,b=E)}return b||p-m},i.prototype._chooseSplitAxis=function(h,m,p){var b=h.leaf?this.compareMinX:l,y=h.leaf?this.compareMinY:u;this._allDistMargin(h,m,p,b)<this._allDistMargin(h,m,p,y)&&h.children.sort(b)},i.prototype._allDistMargin=function(h,m,p,b){h.children.sort(b);for(var y=this.toBBox,g=s(h,0,m,y),v=s(h,p-m,p,y),_=d(g)+d(v),k=m;k<p-m;k++){var S=h.children[k];o(g,h.leaf?y(S):S),_+=d(g)}for(var D=p-m-1;D>=m;D--){var T=h.children[D];o(v,h.leaf?y(T):T),_+=d(v)}return _},i.prototype._adjustParentBBoxes=function(h,m,p){for(var b=p;b>=0;b--)o(m[b],h)},i.prototype._condense=function(h){for(var m=h.length-1,p=void 0;m>=0;m--)h[m].children.length===0?m>0?(p=h[m-1].children).splice(p.indexOf(h[m]),1):this.clear():a(h[m],this.toBBox)},i})});var Kr=K(()=>{});var Jr=K((Pt,Dt)=>{(function(t,e){typeof Pt=="object"&&typeof Dt!="undefined"?Dt.exports=e():typeof define=="function"&&define.amd?define(e):(t=t||self,t.TinyQueue=e())})(Pt,function(){"use strict";var t=function(i,n){if(i===void 0&&(i=[]),n===void 0&&(n=e),this.data=i,this.length=this.data.length,this.compare=n,this.length>0)for(var a=(this.length>>1)-1;a>=0;a--)this._down(a)};t.prototype.push=function(i){this.data.push(i),this.length++,this._up(this.length-1)},t.prototype.pop=function(){if(this.length!==0){var i=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),i}},t.prototype.peek=function(){return this.data[0]},t.prototype._up=function(i){for(var n=this,a=n.data,s=n.compare,o=a[i];i>0;){var l=i-1>>1,u=a[l];if(s(o,u)>=0)break;a[i]=u,i=l}a[i]=o},t.prototype._down=function(i){for(var n=this,a=n.data,s=n.compare,o=this.length>>1,l=a[i];i<o;){var u=(i<<1)+1,f=a[u],d=u+1;if(d<this.length&&s(a[d],f)<0&&(u=d,f=a[d]),s(f,l)>=0)break;a[i]=f,i=u}a[i]=l};function e(r,i){return r<i?-1:r>i?1:0}return t})});var Qr=K((Ua,At)=>{"use strict";var ot=Jr();ot.default&&(ot=ot.default);At.exports=Gr;At.exports.default=Gr;function Gr(t,e,r){e=e||1;for(var i,n,a,s,o=0;o<t[0].length;o++){var l=t[0][o];(!o||l[0]<i)&&(i=l[0]),(!o||l[1]<n)&&(n=l[1]),(!o||l[0]>a)&&(a=l[0]),(!o||l[1]>s)&&(s=l[1])}var u=a-i,f=s-n,d=Math.min(u,f),c=d/2;if(d===0){var x=[i,n];return x.distance=0,x}for(var w=new ot(void 0,Wn),z=i;z<a;z+=d)for(var h=n;h<s;h+=d)w.push(new fe(z+c,h+c,c,t));var m=Hn(t),p=new fe(i+u/2,n+f/2,0,t);p.d>m.d&&(m=p);for(var b=w.length;w.length;){var y=w.pop();y.d>m.d&&(m=y,r&&console.log("found best %d after %d probes",Math.round(1e4*y.d)/1e4,b)),!(y.max-m.d<=e)&&(c=y.h/2,w.push(new fe(y.x-c,y.y-c,c,t)),w.push(new fe(y.x+c,y.y-c,c,t)),w.push(new fe(y.x-c,y.y+c,c,t)),w.push(new fe(y.x+c,y.y+c,c,t)),b+=4)}r&&(console.log("num probes: "+b),console.log("best distance: "+m.d));var g=[m.x,m.y];return g.distance=m.d,g}function Wn(t,e){return e.max-t.max}function fe(t,e,r,i){this.x=t,this.y=e,this.h=r,this.d=$n(t,e,i),this.max=this.d+this.h*Math.SQRT2}function $n(t,e,r){for(var i=!1,n=1/0,a=0;a<r.length;a++)for(var s=r[a],o=0,l=s.length,u=l-1;o<l;u=o++){var f=s[o],d=s[u];f[1]>e!=d[1]>e&&t<(d[0]-f[0])*(e-f[1])/(d[1]-f[1])+f[0]&&(i=!i),n=Math.min(n,Kn(t,e,f,d))}return n===0?0:(i?1:-1)*Math.sqrt(n)}function Hn(t){for(var e=0,r=0,i=0,n=t[0],a=0,s=n.length,o=s-1;a<s;o=a++){var l=n[a],u=n[o],f=l[0]*u[1]-u[0]*l[1];r+=(l[0]+u[0])*f,i+=(l[1]+u[1])*f,e+=f*3}return e===0?new fe(n[0][0],n[0][1],0,t):new fe(r/e,i/e,0,t)}function Kn(t,e,r,i){var n=r[0],a=r[1],s=i[0]-n,o=i[1]-a;if(s!==0||o!==0){var l=((t-n)*s+(e-a)*o)/(s*s+o*o);l>1?(n=i[0],a=i[1]):l>0&&(n+=s*l,a+=o*l)}return s=t-n,o=e-a,s*s+o*o}});var fa={};ki(fa,{CenteredSymbolizer:()=>It,CenteredTextSymbolizer:()=>U,CircleSymbolizer:()=>te,FlexSymbolizer:()=>$e,Font:()=>Ut,GeomType:()=>ee,GroupSymbolizer:()=>ye,IconSymbolizer:()=>li,Index:()=>Ct,Justify:()=>X,Labeler:()=>Ue,Labelers:()=>je,LineLabelPlacement:()=>Me,LineLabelSymbolizer:()=>ce,LineSymbolizer:()=>C,OffsetSymbolizer:()=>Xt,OffsetTextSymbolizer:()=>le,PMTiles:()=>rt,Padding:()=>hi,PmtilesSource:()=>Oe,PolygonLabelSymbolizer:()=>ue,PolygonSymbolizer:()=>A,Sheet:()=>gi,ShieldSymbolizer:()=>lt,Static:()=>pi,TextPlacements:()=>P,TextSymbolizer:()=>He,TileCache:()=>st,Toner:()=>ha,View:()=>St,ZxySource:()=>it,arr:()=>de,covering:()=>Zr,createPattern:()=>Ot,cubicBezier:()=>ta,dark:()=>Se,exp:()=>j,filterFn:()=>Je,getFont:()=>qt,getZoom:()=>Vt,isCCW:()=>Ir,isInRing:()=>Lt,json_style:()=>ua,labelRules:()=>Te,leafletLayer:()=>oa,light:()=>Le,linear:()=>ea,numberFn:()=>ft,numberOrFn:()=>jt,paintRules:()=>Ce,painter:()=>Ye,pointInPolygon:()=>Xr,pointMinDistToLines:()=>Yr,pointMinDistToPoints:()=>Vr,sourcesToViews:()=>Ve,step:()=>Qn,toIndex:()=>oe,transformGeom:()=>Ie,widthFn:()=>Nt,wrap:()=>Xe});var he=N(re());var pe=N(re());var ke=N(re()),Ar=N(lr()),Br=N(pr());var Y=(t,e,r)=>new Promise((i,n)=>{var a=l=>{try{o(r.next(l))}catch(u){n(u)}},s=l=>{try{o(r.throw(l))}catch(u){n(u)}},o=l=>l.done?i(l.value):Promise.resolve(l.value).then(a,s);o((r=r.apply(t,e)).next())}),q=Uint8Array,me=Uint16Array,yr=Uint32Array,xr=new q([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),gr=new q([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),en=new q([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),br=function(t,e){for(var r=new me(31),i=0;i<31;++i)r[i]=e+=1<<t[i-1];for(var n=new yr(r[30]),i=1;i<30;++i)for(var a=r[i];a<r[i+1];++a)n[a]=a-r[i]<<5|i;return[r,n]},wr=br(xr,2),vr=wr[0],tn=wr[1];vr[28]=258,tn[258]=28;var _r=br(gr,0),rn=_r[0],wa=_r[1],bt=new me(32768);for(M=0;M<32768;++M)se=(M&43690)>>>1|(M&21845)<<1,se=(se&52428)>>>2|(se&13107)<<2,se=(se&61680)>>>4|(se&3855)<<4,bt[M]=((se&65280)>>>8|(se&255)<<8)>>>1;var se,M,Ae=function(t,e,r){for(var i=t.length,n=0,a=new me(e);n<i;++n)t[n]&&++a[t[n]-1];var s=new me(e);for(n=0;n<e;++n)s[n]=s[n-1]+a[n-1]<<1;var o;if(r){o=new me(1<<e);var l=15-e;for(n=0;n<i;++n)if(t[n])for(var u=n<<4|t[n],f=e-t[n],d=s[t[n]-1]++<<f,c=d|(1<<f)-1;d<=c;++d)o[bt[d]>>>l]=u}else for(o=new me(i),n=0;n<i;++n)t[n]&&(o[n]=bt[s[t[n]-1]++]>>>15-t[n]);return o},Be=new q(288);for(M=0;M<144;++M)Be[M]=8;var M;for(M=144;M<256;++M)Be[M]=9;var M;for(M=256;M<280;++M)Be[M]=7;var M;for(M=280;M<288;++M)Be[M]=8;var M,zr=new q(32);for(M=0;M<32;++M)zr[M]=5;var M,nn=Ae(Be,9,1),an=Ae(zr,5,1),wt=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},J=function(t,e,r){var i=e/8|0;return(t[i]|t[i+1]<<8)>>(e&7)&r},vt=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(e&7)},sn=function(t){return(t+7)/8|0},on=function(t,e,r){(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length);var i=new(t.BYTES_PER_ELEMENT==2?me:t.BYTES_PER_ELEMENT==4?yr:q)(r-e);return i.set(t.subarray(e,r)),i},ln=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],G=function(t,e,r){var i=new Error(e||ln[t]);if(i.code=t,Error.captureStackTrace&&Error.captureStackTrace(i,G),!r)throw i;return i},_t=function(t,e,r){var i=t.length;if(!i||r&&r.f&&!r.l)return e||new q(0);var n=!e||r,a=!r||r.i;r||(r={}),e||(e=new q(i*3));var s=function($t){var Ht=e.length;if($t>Ht){var Kt=new q(Math.max(Ht*2,$t));Kt.set(e),e=Kt}},o=r.f||0,l=r.p||0,u=r.b||0,f=r.l,d=r.d,c=r.m,x=r.n,w=i*8;do{if(!f){o=J(t,l,1);var z=J(t,l+1,3);if(l+=3,z)if(z==1)f=nn,d=an,c=9,x=5;else if(z==2){var b=J(t,l,31)+257,y=J(t,l+10,15)+4,g=b+J(t,l+5,31)+1;l+=14;for(var v=new q(g),_=new q(19),k=0;k<y;++k)_[en[k]]=J(t,l+k*3,7);l+=y*3;for(var S=wt(_),D=(1<<S)-1,T=Ae(_,S,1),k=0;k<g;){var E=T[J(t,l,D)];l+=E&15;var h=E>>>4;if(h<16)v[k++]=h;else{var W=0,$=0;for(h==16?($=3+J(t,l,3),l+=2,W=v[k-1]):h==17?($=3+J(t,l,7),l+=3):h==18&&($=11+J(t,l,127),l+=7);$--;)v[k++]=W}}var ie=v.subarray(0,b),V=v.subarray(b);c=wt(ie),x=wt(V),f=Ae(ie,c,1),d=Ae(V,x,1)}else G(1);else{var h=sn(l)+4,m=t[h-4]|t[h-3]<<8,p=h+m;if(p>i){a&&G(0);break}n&&s(u+m),e.set(t.subarray(h,p),u),r.b=u+=m,r.p=l=p*8,r.f=o;continue}if(l>w){a&&G(0);break}}n&&s(u+131072);for(var dt=(1<<c)-1,xe=(1<<x)-1,ne=l;;ne=l){var W=f[vt(t,l)&dt],R=W>>>4;if(l+=W&15,l>w){a&&G(0);break}if(W||G(2),R<256)e[u++]=R;else if(R==256){ne=l,f=null;break}else{var Zt=R-254;if(R>264){var k=R-257,Pe=xr[k];Zt=J(t,l,(1<<Pe)-1)+vr[k],l+=Pe}var ct=d[vt(t,l)&xe],mt=ct>>>4;ct||G(3),l+=ct&15;var V=rn[mt];if(mt>3){var Pe=gr[mt];V+=vt(t,l)&(1<<Pe)-1,l+=Pe}if(l>w){a&&G(0);break}n&&s(u+131072);for(var Wt=u+Zt;u<Wt;u+=4)e[u]=e[u-V],e[u+1]=e[u+1-V],e[u+2]=e[u+2-V],e[u+3]=e[u+3-V];u=Wt}}r.l=f,r.p=ne,r.b=u,r.f=o,f&&(o=1,r.m=c,r.d=d,r.n=x)}while(!o);return u==e.length?e:on(e,0,u)},un=new q(0),hn=function(t){(t[0]!=31||t[1]!=139||t[2]!=8)&&G(6,"invalid gzip data");var e=t[3],r=10;e&4&&(r+=t[10]|(t[11]<<8)+2);for(var i=(e>>3&1)+(e>>4&1);i>0;i-=!t[r++]);return r+(e&2)},fn=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},dn=function(t){((t[0]&15)!=8||t[0]>>>4>7||(t[0]<<8|t[1])%31)&&G(6,"invalid zlib data"),t[1]&32&&G(6,"invalid zlib data: preset dictionaries not supported")};function cn(t,e){return _t(t,e)}function mn(t,e){return _t(t.subarray(hn(t),-8),e||new q(fn(t)))}function pn(t,e){return _t((dn(t),t.subarray(2,-4)),e)}function zt(t,e){return t[0]==31&&t[1]==139&&t[2]==8?mn(t,e):(t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31?cn(t,e):pn(t,e)}var yn=typeof TextDecoder!="undefined"&&new TextDecoder,xn=0;try{yn.decode(un,{stream:!0}),xn=1}catch(t){}var kr=(t,e)=>t*Math.pow(2,e),Ee=(t,e)=>Math.floor(t/Math.pow(2,e)),tt=(t,e)=>kr(t.getUint16(e+1,!0),8)+t.getUint8(e),Lr=(t,e)=>kr(t.getUint32(e+2,!0),16)+t.getUint16(e,!0),gn=(t,e,r,i,n)=>{if(t!=i.getUint8(n))return t-i.getUint8(n);let a=tt(i,n+1);if(e!=a)return e-a;let s=tt(i,n+4);return r!=s?r-s:0},bn=(t,e,r,i)=>{let n=Fr(t,e|128,r,i);return n?{z:e,x:r,y:i,offset:n[0],length:n[1],is_dir:!0}:null},Sr=(t,e,r,i)=>{let n=Fr(t,e,r,i);return n?{z:e,x:r,y:i,offset:n[0],length:n[1],is_dir:!1}:null},Fr=(t,e,r,i)=>{let n=0,a=t.byteLength/17-1;for(;n<=a;){let s=a+n>>1,o=gn(e,r,i,t,s*17);if(o>0)n=s+1;else if(o<0)a=s-1;else return[Lr(t,s*17+7),t.getUint32(s*17+13,!0)]}return null},wn=(t,e)=>t.is_dir&&!e.is_dir?1:!t.is_dir&&e.is_dir?-1:t.z!==e.z?t.z-e.z:t.x!==e.x?t.x-e.x:t.y-e.y,Mr=(t,e)=>{let r=t.getUint8(e*17);return{z:r&127,x:tt(t,e*17+1),y:tt(t,e*17+4),offset:Lr(t,e*17+7),length:t.getUint32(e*17+13,!0),is_dir:r>>7==1}},Cr=t=>{let e=[],r=new DataView(t);for(let i=0;i<r.byteLength/17;i++)e.push(Mr(r,i));return vn(e)},vn=t=>{t.sort(wn);let e=new ArrayBuffer(17*t.length),r=new Uint8Array(e);for(let i=0;i<t.length;i++){let n=t[i],a=n.z;n.is_dir&&(a=a|128),r[i*17]=a,r[i*17+1]=n.x&255,r[i*17+2]=n.x>>8&255,r[i*17+3]=n.x>>16&255,r[i*17+4]=n.y&255,r[i*17+5]=n.y>>8&255,r[i*17+6]=n.y>>16&255,r[i*17+7]=n.offset&255,r[i*17+8]=Ee(n.offset,8)&255,r[i*17+9]=Ee(n.offset,16)&255,r[i*17+10]=Ee(n.offset,24)&255,r[i*17+11]=Ee(n.offset,32)&255,r[i*17+12]=Ee(n.offset,48)&255,r[i*17+13]=n.length&255,r[i*17+14]=n.length>>8&255,r[i*17+15]=n.length>>16&255,r[i*17+16]=n.length>>24&255}return e},_n=(t,e)=>{if(t.byteLength<17)return null;let r=t.byteLength/17,i=Mr(t,r-1);if(i.is_dir){let n=i.z,a=e.z-n,s=Math.trunc(e.x/(1<<a)),o=Math.trunc(e.y/(1<<a));return{z:n,x:s,y:o}}return null};function zn(t){return Y(this,null,function*(){let e=yield t.getBytes(0,512e3),r=new DataView(e.data),i=r.getUint32(4,!0),n=r.getUint16(8,!0),a=new TextDecoder("utf-8"),s=JSON.parse(a.decode(new DataView(e.data,10,i))),o=0;s.compression==="gzip"&&(o=2);let l=0;"minzoom"in s&&(l=+s.minzoom);let u=0;"maxzoom"in s&&(u=+s.maxzoom);let f=0,d=0,c=0,x=-180,w=-85,z=180,h=85;if(s.bounds){let p=s.bounds.split(",");x=+p[0],w=+p[1],z=+p[2],h=+p[3]}if(s.center){let p=s.center.split(",");f=+p[0],d=+p[1],c=+p[2]}return{specVersion:r.getUint16(2,!0),rootDirectoryOffset:10+i,rootDirectoryLength:n*17,jsonMetadataOffset:10,jsonMetadataLength:i,leafDirectoryOffset:0,leafDirectoryLength:void 0,tileDataOffset:0,tileDataLength:void 0,numAddressedTiles:0,numTileEntries:0,numTileContents:0,clustered:!1,internalCompression:1,tileCompression:o,tileType:1,minZoom:l,maxZoom:u,minLon:x,minLat:w,maxLon:z,maxLat:h,centerZoom:c,centerLon:f,centerLat:d,etag:e.etag}})}function kn(t,e,r,i,n,a,s){return Y(this,null,function*(){let o=yield r.getArrayBuffer(e,t.rootDirectoryOffset,t.rootDirectoryLength,t);t.specVersion===1&&(o=Cr(o));let l=Sr(new DataView(o),i,n,a);if(l){let d=(yield e.getBytes(l.offset,l.length,s)).data,c=new DataView(d);return c.getUint8(0)==31&&c.getUint8(1)==139&&(d=zt(new Uint8Array(d))),{data:d}}let u=_n(new DataView(o),{z:i,x:n,y:a});if(u){let f=bn(new DataView(o),u.z,u.x,u.y);if(f){let d=yield r.getArrayBuffer(e,f.offset,f.length,t);t.specVersion===1&&(d=Cr(d));let c=Sr(new DataView(d),i,n,a);if(c){let w=(yield e.getBytes(c.offset,c.length,s)).data,z=new DataView(w);return z.getUint8(0)==31&&z.getUint8(1)==139&&(w=zt(new Uint8Array(w))),{data:w}}}}})}var Tr={getHeader:zn,getZxy:kn};function _e(t,e){return(e>>>0)*4294967296+(t>>>0)}function Ln(t,e){let r=e.buf,i,n;if(n=r[e.pos++],i=(n&112)>>4,n<128||(n=r[e.pos++],i|=(n&127)<<3,n<128)||(n=r[e.pos++],i|=(n&127)<<10,n<128)||(n=r[e.pos++],i|=(n&127)<<17,n<128)||(n=r[e.pos++],i|=(n&127)<<24,n<128)||(n=r[e.pos++],i|=(n&1)<<31,n<128))return _e(t,i);throw new Error("Expected varint not more than 10 bytes")}function Re(t){let e=t.buf,r,i;return i=e[t.pos++],r=i&127,i<128||(i=e[t.pos++],r|=(i&127)<<7,i<128)||(i=e[t.pos++],r|=(i&127)<<14,i<128)||(i=e[t.pos++],r|=(i&127)<<21,i<128)?r:(i=e[t.pos],r|=(i&15)<<28,Ln(r,t))}function Sn(t,e,r,i){if(i==0){r==1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);let n=e[0];e[0]=e[1],e[1]=n}}function Fn(t,e,r){if(t>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(e>Math.pow(2,t)-1||r>Math.pow(2,t)-1)throw Error("tile x/y outside zoom level bounds");let i=0,n=0;for(;n<t;)i+=Math.pow(2,n)*Math.pow(2,n),n++;let a=Math.pow(2,t),s=0,o=0,l=0,u=[e,r],f=a/2;for(;f>0;)s=(u[0]&f)>0?1:0,o=(u[1]&f)>0?1:0,l+=f*f*(3*s^o),Sn(f,u,s,o),f=f/2;return i+l}function Pr(t,e){return Y(this,null,function*(){if(e===1||e===0)return t;if(e===2)return zt(new Uint8Array(t));throw Error("Compression method not supported")})}var Mn=127;function Cn(t,e){let r=0,i=t.length-1;for(;r<=i;){let n=i+r>>1,a=e-t[n].tileId;if(a>0)r=n+1;else if(a<0)i=n-1;else return t[n]}return i>=0&&(t[i].runLength===0||e-t[i].tileId<t[i].runLength)?t[i]:null}var Tn=class{constructor(t){this.url=t}getKey(){return this.url}getBytes(t,e,r){return Y(this,null,function*(){let i;r||(i=new AbortController,r=i.signal);let n=yield fetch(this.url,{signal:r,headers:{Range:"bytes="+t+"-"+(t+e-1)}});if(n.status===416&&t===0){let o=n.headers.get("Content-Range");if(!o||!o.startsWith("bytes */"))throw Error("Missing content-length on 416 response");let l=+o.substr(8);n=yield fetch(this.url,{signal:r,headers:{Range:"bytes=0-"+(l-1)}})}if(n.status>=300)throw Error("Bad response code: "+n.status);let a=n.headers.get("Content-Length");if(n.status===200&&(!a||+a>e))throw i&&i.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield n.arrayBuffer(),etag:n.headers.get("ETag")||void 0,cacheControl:n.headers.get("Cache-Control")||void 0,expires:n.headers.get("Expires")||void 0}})}};function Q(t,e){let r=t.getUint32(e+4,!0),i=t.getUint32(e+0,!0);return r*Math.pow(2,32)+i}function Pn(t,e){let r=new DataView(t),i=r.getUint8(7);if(i>3)throw Error(`Archive is spec version ${i} but this library supports up to spec version 3`);return{specVersion:i,rootDirectoryOffset:Q(r,8),rootDirectoryLength:Q(r,16),jsonMetadataOffset:Q(r,24),jsonMetadataLength:Q(r,32),leafDirectoryOffset:Q(r,40),leafDirectoryLength:Q(r,48),tileDataOffset:Q(r,56),tileDataLength:Q(r,64),numAddressedTiles:Q(r,72),numTileEntries:Q(r,80),numTileContents:Q(r,88),clustered:r.getUint8(96)===1,internalCompression:r.getUint8(97),tileCompression:r.getUint8(98),tileType:r.getUint8(99),minZoom:r.getUint8(100),maxZoom:r.getUint8(101),minLon:r.getInt32(102,!0)/1e7,minLat:r.getInt32(106,!0)/1e7,maxLon:r.getInt32(110,!0)/1e7,maxLat:r.getInt32(114,!0)/1e7,centerZoom:r.getUint8(118),centerLon:r.getInt32(119,!0)/1e7,centerLat:r.getInt32(123,!0)/1e7,etag:e}}function Dr(t){let e={buf:new Uint8Array(t),pos:0},r=Re(e),i=[],n=0;for(let a=0;a<r;a++){let s=Re(e);i.push({tileId:n+s,offset:0,length:0,runLength:1}),n+=s}for(let a=0;a<r;a++)i[a].runLength=Re(e);for(let a=0;a<r;a++)i[a].length=Re(e);for(let a=0;a<r;a++){let s=Re(e);s===0&&a>0?i[a].offset=i[a-1].offset+i[a-1].length:i[a].offset=s-1}return i}function Dn(t){let e=new DataView(t);return e.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):e.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var ze=class extends Error{};function An(t,e,r,i){return Y(this,null,function*(){let n=yield t.getBytes(0,16384);if(new DataView(n.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(Dn(n.data)<3)return[yield Tr.getHeader(t)];let s=n.data.slice(0,Mn),o=n.etag;i&&n.etag!=i&&(console.warn("ETag conflict detected; your HTTP server might not support content-based ETag headers. ETags disabled for "+t.getKey()),o=void 0);let l=Pn(s,o);if(r){let u=n.data.slice(l.rootDirectoryOffset,l.rootDirectoryOffset+l.rootDirectoryLength),f=t.getKey()+"|"+(l.etag||"")+"|"+l.rootDirectoryOffset+"|"+l.rootDirectoryLength,d=Dr(yield e(u,l.internalCompression));return[l,[f,d.length,d]]}return[l,void 0]})}function Bn(t,e,r,i,n){return Y(this,null,function*(){let a=yield t.getBytes(r,i);if(n.etag&&n.etag!==a.etag)throw new ze(a.etag);let s=yield e(a.data,n.internalCompression),o=Dr(s);if(o.length===0)throw new Error("Empty directory is invalid");return o})}var En=class{constructor(t=100,e=!0,r=Pr){this.cache=new Map,this.maxCacheEntries=t,this.counter=1,this.prefetch=e,this.decompress=r}getHeader(t,e){return Y(this,null,function*(){let r=t.getKey();if(this.cache.has(r))return this.cache.get(r).lastUsed=this.counter++,yield this.cache.get(r).data;let i=new Promise((n,a)=>{An(t,this.decompress,this.prefetch,e).then(s=>{s[1]&&this.cache.set(s[1][0],{lastUsed:this.counter++,data:Promise.resolve(s[1][2])}),n(s[0]),this.prune()}).catch(s=>{a(s)})});return this.cache.set(r,{lastUsed:this.counter++,data:i}),i})}getDirectory(t,e,r,i){return Y(this,null,function*(){let n=t.getKey()+"|"+(i.etag||"")+"|"+e+"|"+r;if(this.cache.has(n))return this.cache.get(n).lastUsed=this.counter++,yield this.cache.get(n).data;let a=new Promise((s,o)=>{Bn(t,this.decompress,e,r,i).then(l=>{s(l),this.prune()}).catch(l=>{o(l)})});return this.cache.set(n,{lastUsed:this.counter++,data:a}),a})}getArrayBuffer(t,e,r,i){return Y(this,null,function*(){let n=t.getKey()+"|"+(i.etag||"")+"|"+e+"|"+r;if(this.cache.has(n))return this.cache.get(n).lastUsed=this.counter++,yield this.cache.get(n).data;let a=new Promise((s,o)=>{t.getBytes(e,r).then(l=>{if(i.etag&&i.etag!==l.etag)throw new ze(l.etag);s(l.data),this.cache.has(n),this.prune()}).catch(l=>{o(l)})});return this.cache.set(n,{lastUsed:this.counter++,data:a}),a})}prune(){if(this.cache.size>=this.maxCacheEntries){let t=1/0,e;this.cache.forEach((r,i)=>{r.lastUsed<t&&(t=r.lastUsed,e=i)}),e&&this.cache.delete(e)}}invalidate(t,e){return Y(this,null,function*(){this.cache.delete(t.getKey()),yield this.getHeader(t,e)})}},rt=class{constructor(t,e,r){typeof t=="string"?this.source=new Tn(t):this.source=t,r?this.decompress=r:this.decompress=Pr,e?this.cache=e:this.cache=new En}getHeader(){return Y(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(t,e,r,i){return Y(this,null,function*(){let n=Fn(t,e,r),a=yield this.cache.getHeader(this.source);if(a.specVersion<3)return Tr.getZxy(a,this.source,this.cache,t,e,r,i);if(t<a.minZoom||t>a.maxZoom)return;let s=a.rootDirectoryOffset,o=a.rootDirectoryLength;for(let l=0;l<=3;l++){let u=yield this.cache.getDirectory(this.source,s,o,a),f=Cn(u,n);if(f)if(f.runLength>0){let d=yield this.source.getBytes(a.tileDataOffset+f.offset,f.length,i);if(a.etag&&a.etag!==d.etag)throw new ze(d.etag);return{data:yield this.decompress(d.data,a.tileCompression),cacheControl:d.cacheControl,expires:d.expires}}else s=a.leafDirectoryOffset+f.offset,o=f.length;else return}throw Error("Maximum directory depth exceeded")})}getZxy(t,e,r,i){return Y(this,null,function*(){try{return yield this.getZxyAttempt(t,e,r,i)}catch(n){if(n instanceof ze)return this.cache.invalidate(this.source,n.message),yield this.getZxyAttempt(t,e,r,i);throw n}})}getMetadataAttempt(){return Y(this,null,function*(){let t=yield this.cache.getHeader(this.source),e=yield this.source.getBytes(t.jsonMetadataOffset,t.jsonMetadataLength);if(t.etag&&t.etag!==e.etag)throw new ze(e.etag);let r=yield this.decompress(e.data,t.internalCompression),i=new TextDecoder("utf-8");return JSON.parse(i.decode(r))})}getMetadata(){return Y(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(t){if(t instanceof ze)return this.cache.invalidate(this.source,t.message),yield this.getMetadataAttempt();throw t}})}};var ee;(function(i){i[i.Point=1]="Point",i[i.Line=2]="Line",i[i.Polygon=3]="Polygon"})(ee||(ee={}));function oe(t){return t.x+":"+t.y+":"+t.z}var Rn=(t,e,r)=>{t.pos=e;for(var i=t.readVarint()+t.pos,n=1,a=0,s=0,o=0,l=1/0,u=-1/0,f=1/0,d=-1/0,c=[],x=[];t.pos<i;){if(a<=0){var w=t.readVarint();n=w&7,a=w>>3}if(a--,n===1||n===2)s+=t.readSVarint()*r,o+=t.readSVarint()*r,s<l&&(l=s),s>u&&(u=s),o<f&&(f=o),o>d&&(d=o),n===1&&(x.length>0&&c.push(x),x=[]),x.push(new ke.default(s,o));else if(n===7)x&&x.push(x[0].clone());else throw new Error("unknown command "+n)}return x&&c.push(x),{geom:c,bbox:{minX:l,minY:f,maxX:u,maxY:d}}};function Er(t,e){let r=new Ar.VectorTile(new Br.default(t)),i=new Map;for(let[n,a]of Object.entries(r.layers)){let s=[],o=a;for(let l=0;l<o.length;l++){let u=Rn(o.feature(l)._pbf,o.feature(l)._geometry,e/o.extent),f=0;for(let d of u.geom)f+=d.length;s.push({id:o.feature(l).id,geomType:o.feature(l).type,geom:u.geom,numVertices:f,bbox:u.bbox,props:o.feature(l).properties})}i.set(n,s)}return i}var Oe=class{constructor(e,r){typeof e=="string"?this.p=new rt(e):this.p=e,this.controllers=[],this.shouldCancelZooms=r}get(e,r){return O(this,null,function*(){this.shouldCancelZooms&&(this.controllers=this.controllers.filter(s=>s[0]!=e.z?(s[1].abort(),!1):!0));let i=new AbortController;this.controllers.push([e.z,i]);let n=i.signal,a=yield this.p.getZxy(e.z,e.x,e.y,n);return a?Er(a.data,r):new Map})}},it=class{constructor(e,r){this.url=e,this.controllers=[],this.shouldCancelZooms=r}get(e,r){return O(this,null,function*(){this.shouldCancelZooms&&(this.controllers=this.controllers.filter(s=>s[0]!=e.z?(s[1].abort(),!1):!0));let i=this.url.replace("{z}",e.z.toString()).replace("{x}",e.x.toString()).replace("{y}",e.y.toString()),n=new AbortController;this.controllers.push([e.z,n]);let a=n.signal;return new Promise((s,o)=>{fetch(i,{signal:a}).then(l=>l.arrayBuffer()).then(l=>{let u=Er(l,r);s(u)}).catch(l=>{o(l)})})})}},kt=6378137,Rr=85.0511287798,nt=kt*Math.PI,On=t=>{let e=Math.PI/180,r=Math.max(Math.min(Rr,t[0]),-Rr),i=Math.sin(r*e);return new ke.default(kt*t[1]*e,kt*Math.log((1+i)/(1-i))/2)};function Or(t){return t*t}function at(t,e){return Or(t.x-e.x)+Or(t.y-e.y)}function In(t,e,r){var i=at(e,r);if(i===0)return at(t,e);var n=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/i;return n=Math.max(0,Math.min(1,n)),at(t,new ke.default(e.x+n*(r.x-e.x),e.y+n*(r.y-e.y)))}function Lt(t,e){for(var r=!1,i=0,n=e.length-1;i<e.length;n=i++){var a=e[i].x,s=e[i].y,o=e[n].x,l=e[n].y,u=s>t.y!=l>t.y&&t.x<(o-a)*(t.y-s)/(l-s)+a;u&&(r=!r)}return r}function Ir(t){for(var e=0,r=0;r<t.length;r++){let i=(r+1)%t.length;e+=t[r].x*t[i].y,e-=t[i].x*t[r].y}return e<0}function Xr(t,e){var r=!1;for(let i of e)if(Ir(i))Lt(t,i)&&(r=!1);else{if(r)return!0;Lt(t,i)&&(r=!0)}return r}function Vr(t,e){let r=1/0;for(let i of e){let n=Math.sqrt(at(t,i[0]));n<r&&(r=n)}return r}function Yr(t,e){let r=1/0;for(let n of e)for(var i=0;i<n.length-1;i++){let a=Math.sqrt(In(t,n[i],n[i+1]));a<r&&(r=a)}return r}var st=class{constructor(e,r){this.source=e,this.cache=new Map,this.inflight=new Map,this.tileSize=r}queryFeatures(e,r,i,n){let a=On([r,e]);var s=new ke.default((a.x+nt)/(nt*2),1-(a.y+nt)/(nt*2));s.x>1&&(s.x=s.x-Math.floor(s.x));let o=s.mult(1<<i),l=Math.floor(o.x),u=Math.floor(o.y),f=oe({z:i,x:l,y:u}),d=[],c=this.cache.get(f);if(c){let x=new ke.default((o.x-l)*this.tileSize,(o.y-u)*this.tileSize);for(let[w,z]of c.data.entries())for(let h of z)h.geomType==1?Vr(x,h.geom)<n&&d.push({feature:h,layerName:w}):h.geomType==2?Yr(x,h.geom)<n&&d.push({feature:h,layerName:w}):Xr(x,h.geom)&&d.push({feature:h,layerName:w})}return d}get(e){return O(this,null,function*(){let r=oe(e);return new Promise((i,n)=>{let a=this.cache.get(r);if(a)a.used=performance.now(),i(a.data);else{let s=this.inflight.get(r);s?s.push([i,n]):(this.inflight.set(r,[]),this.source.get(e,this.tileSize).then(o=>{this.cache.set(r,{used:performance.now(),data:o});let l=this.inflight.get(r);if(l&&l.forEach(u=>u[0](o)),this.inflight.delete(r),i(o),this.cache.size>=64){let u=1/0,f;this.cache.forEach((d,c)=>{d.used<u&&(u=d.used,f=c)}),f&&this.cache.delete(f)}}).catch(o=>{let l=this.inflight.get(r);l&&l.forEach(u=>u[1](o)),this.inflight.delete(r),n(o)}))}})})}};var Ie=(t,e,r)=>{let i=[];for(let n of t){let a=[];for(let s of n)a.push(s.clone().mult(e).add(r));i.push(a)}return i},Xe=(t,e)=>{let r=1<<e;return t<0&&(t=r+t),t>=r&&(t=t%r),t},St=class{constructor(e,r,i){this.tileCache=e,this.maxDataLevel=r,this.levelDiff=i}dataTilesForBounds(e,r){let i=Math.pow(2,e)/Math.pow(2,Math.ceil(e)),n=[];var a=1,s=this.tileCache.tileSize;if(e<this.levelDiff)a=1/(1<<this.levelDiff-e)*i,n.push({data_tile:{z:0,x:0,y:0},origin:new pe.default(0,0),scale:a,dim:s*a});else if(e<=this.levelDiff+this.maxDataLevel){let u=1<<this.levelDiff,f=256*i,d=Math.ceil(e)-this.levelDiff,c=Math.floor(r.minX/u/f),x=Math.floor(r.minY/u/f),w=Math.floor(r.maxX/u/f),z=Math.floor(r.maxY/u/f);for(var o=c;o<=w;o++)for(var l=x;l<=z;l++){let h=new pe.default(o*u*f,l*u*f);n.push({data_tile:{z:d,x:Xe(o,d),y:Xe(l,d)},origin:h,scale:i,dim:s*i})}}else{let u=1<<this.levelDiff;a=(1<<Math.ceil(e)-this.maxDataLevel-this.levelDiff)*i;let f=Math.floor(r.minX/u/256/a),d=Math.floor(r.minY/u/256/a),c=Math.floor(r.maxX/u/256/a),x=Math.floor(r.maxY/u/256/a);for(var o=f;o<=c;o++)for(var l=d;l<=x;l++){let h=new pe.default(o*u*256*a,l*u*256*a);n.push({data_tile:{z:this.maxDataLevel,x:Xe(o,this.maxDataLevel),y:Xe(l,this.maxDataLevel)},origin:h,scale:a,dim:s*a})}}return n}dataTileForDisplayTile(e){var r,i=1,n=this.tileCache.tileSize,a;if(e.z<this.levelDiff)r={z:0,x:0,y:0},i=1/(1<<this.levelDiff-e.z),a=new pe.default(0,0),n=n*i;else if(e.z<=this.levelDiff+this.maxDataLevel){let s=1<<this.levelDiff;r={z:e.z-this.levelDiff,x:Math.floor(e.x/s),y:Math.floor(e.y/s)},a=new pe.default(r.x*s*256,r.y*s*256)}else{i=1<<e.z-this.maxDataLevel-this.levelDiff;let s=1<<this.levelDiff;r={z:this.maxDataLevel,x:Math.floor(e.x/s/i),y:Math.floor(e.y/s/i)},a=new pe.default(r.x*s*i*256,r.y*s*i*256),n=n*i}return{data_tile:r,scale:i,origin:a,dim:n}}getBbox(e,r){return O(this,null,function*(){let i=this.dataTilesForBounds(e,r);return(yield Promise.all(i.map(a=>this.tileCache.get(a.data_tile)))).map((a,s)=>{let o=i[s];return{data:a,z:e,data_tile:o.data_tile,scale:o.scale,dim:o.dim,origin:o.origin}})})}getDisplayTile(e){return O(this,null,function*(){let r=this.dataTileForDisplayTile(e);return{data:yield this.tileCache.get(r.data_tile),z:e.z,data_tile:r.data_tile,scale:r.scale,origin:r.origin,dim:r.dim}})}queryFeatures(e,r,i){let n=Math.round(i),a=Math.min(n-this.levelDiff,this.maxDataLevel),s=16/(1<<n-a);return this.tileCache.queryFeatures(e,r,a,s)}},Ve=t=>{let e=i=>{let n=i.levelDiff===void 0?2:i.levelDiff,a=i.maxDataZoom||14,s;typeof i.url=="string"?i.url.endsWith(".pmtiles")?s=new Oe(i.url,!0):s=new it(i.url,!0):s=new Oe(i.url,!0);let o=new st(s,256*1<<n);return new St(o,a,n)},r=new Map;if(t.sources)for(let i in t.sources)r.set(i,e(t.sources[i]));else r.set("",e(t));return r};var Ur=N(re());function Ye(t,e,r,i,n,a,s,o,l){let u=performance.now();t.save(),t.miterLimit=2;for(var f of n){if(f.minzoom&&e<f.minzoom||f.maxzoom&&e>f.maxzoom)continue;let w=r.get(f.dataSource||"");if(!!w)for(let z of w){var d=z.data.get(f.dataLayer);if(d===void 0)continue;f.symbolizer.before&&f.symbolizer.before(t,z.z);let h=z.origin,m=z.dim,p=z.scale;if(t.save(),o){t.beginPath();let b=Math.max(h.x-s.x,a.minX-s.x),y=Math.max(h.y-s.y,a.minY-s.y),g=Math.min(h.x-s.x+m,a.maxX-s.x),v=Math.min(h.y-s.y+m,a.maxY-s.y);t.rect(b,y,g-b,v-y),t.clip()}t.translate(h.x-s.x,h.y-s.y);for(var c of d){let b=c.geom,y=c.bbox;y.maxX*p+h.x<a.minX||y.minX*p+h.x>a.maxX||y.minY*p+h.y>a.maxY||y.maxY*p+h.y<a.minY||f.filter&&!f.filter(z.z,c)||(p!=1&&(b=Ie(b,p,new Ur.default(0,0))),f.symbolizer.draw(t,b,z.z,c))}t.restore()}}if(o&&(t.beginPath(),t.rect(a.minX-s.x,a.minY-s.y,a.maxX-a.minX,a.maxY-a.minY),t.clip()),i){let w=i.searchBbox(a,1/0);for(var x of w)if(t.save(),t.translate(x.anchor.x-s.x,x.anchor.y-s.y),x.draw(t),t.restore(),l){t.lineWidth=.5,t.strokeStyle=l,t.fillStyle=l,t.globalAlpha=1,t.fillRect(x.anchor.x-s.x-2,x.anchor.y-s.y-2,4,4);for(let z of x.bboxes)t.strokeRect(z.minX-s.x,z.minY-s.y,z.maxX-z.minX,z.maxY-z.minY)}}return t.restore(),performance.now()-u}var Nr=N(re()),qr=N(jr());var Zr=(t,e,r)=>{let i=256,n=e/i,a=Math.floor(r.minX/i),s=Math.floor(r.minY/i),o=Math.floor(r.maxX/i),l=Math.floor(r.maxY/i),u=Math.log2(n),f=[];for(let d=a;d<=o;d++){let c=d%(1<<t);for(let x=s;x<=l;x++)f.push({display:oe({z:t,x:c,y:x}),key:oe({z:t-u,x:Math.floor(c/n),y:Math.floor(x/n)})})}return f},Ct=class{constructor(e,r){this.tree=new qr.default,this.current=new Map,this.dim=e,this.maxLabeledTiles=r}hasPrefix(e){for(let r of this.current.keys())if(r.startsWith(e))return!0;return!1}has(e){return this.current.has(e)}size(){return this.current.size}keys(){return this.current.keys()}searchBbox(e,r){let i=new Set;for(let n of this.tree.search(e))n.indexed_label.order<=r&&i.add(n.indexed_label);return i}searchLabel(e,r){let i=new Set;for(let n of e.bboxes)for(let a of this.tree.search(n))a.indexed_label.order<=r&&i.add(a.indexed_label);return i}bboxCollides(e,r){for(let i of this.tree.search(e))if(i.indexed_label.order<=r)return!0;return!1}labelCollides(e,r){for(let i of e.bboxes)for(let n of this.tree.search(i))if(n.indexed_label.order<=r)return!0;return!1}deduplicationCollides(e){if(!e.deduplicationKey||!e.deduplicationDistance)return!1;let r=e.deduplicationDistance,i={minX:e.anchor.x-r,minY:e.anchor.y-r,maxX:e.anchor.x+r,maxY:e.anchor.y+r};for(let n of this.tree.search(i))if(n.indexed_label.deduplicationKey===e.deduplicationKey&&n.indexed_label.anchor.dist(e.anchor)<r)return!0;return!1}makeEntry(e){this.current.get(e)&&console.log("consistency error 1");let r=new Set;this.current.set(e,r)}insert(e,r,i){let n={anchor:e.anchor,bboxes:e.bboxes,draw:e.draw,order:r,tileKey:i,deduplicationKey:e.deduplicationKey,deduplicationDistance:e.deduplicationDistance},a=this.current.get(i);if(!a){let d=new Set;this.current.set(i,d),a=d}a.add(n);var s=!1,o=!1;for(let d of e.bboxes){var l=d;l.indexed_label=n,this.tree.insert(l),d.minX<0&&(s=!0),d.maxX>this.dim&&(o=!0)}if(s||o){var u=s?this.dim:-this.dim,f=[];for(let x of e.bboxes)f.push({minX:x.minX+u,minY:x.minY,maxX:x.maxX+u,maxY:x.maxY});let d={anchor:new Nr.default(e.anchor.x+u,e.anchor.y),bboxes:f,draw:e.draw,order:r,tileKey:i},c=this.current.get(i);c&&c.add(d);for(let x of f){var l=x;l.indexed_label=d,this.tree.insert(l)}}}pruneOrNoop(e){let r=e.split(":"),i,n=0,a=0;for(var s of this.current.keys()){let o=s.split(":");if(o[3]===r[3]){a++;let l=Math.sqrt(Math.pow(+o[0]-+r[0],2)+Math.pow(+o[1]-+r[1],2));l>n&&(n=l,i=s)}i&&a>this.maxLabeledTiles&&this.pruneKey(i)}}pruneKey(e){let r=this.current.get(e);if(!r)return;let i=[];for(let n of this.tree.all())r.has(n.indexed_label)&&i.push(n);i.forEach(n=>{this.tree.remove(n)}),this.current.delete(e)}removeLabel(e){let r=[];for(let n of this.tree.all())e==n.indexed_label&&r.push(n);r.forEach(n=>{this.tree.remove(n)});let i=this.current.get(e.tileKey);i&&i.delete(e)}},Ue=class{constructor(e,r,i,n,a){this.index=new Ct(256*1<<e,n),this.z=e,this.scratch=r,this.labelRules=i,this.callback=a}layout(e){let r=performance.now(),i=new Set;for(let[o,l]of e)for(let u of l){let f=oe(u.data_tile)+":"+o;this.index.has(f)||(this.index.makeEntry(f),i.add(f))}let n=new Set;for(let[o,l]of this.labelRules.entries()){if(l.visible==!1||l.minzoom&&this.z<l.minzoom||l.maxzoom&&this.z>l.maxzoom)continue;let u=l.dataSource||"",f=e.get(u);if(!!f)for(let d of f){let c=oe(d.data_tile)+":"+u;if(!i.has(c))continue;let x=d.data.get(l.dataLayer);if(x===void 0)continue;let w=x;l.sort&&w.sort((h,m)=>l.sort?l.sort(h.props,m.props):0);let z={index:this.index,zoom:this.z,scratch:this.scratch,order:o,overzoom:this.z-d.data_tile.z};for(let h of w){if(l.filter&&!l.filter(this.z,h))continue;let m=Ie(h.geom,d.scale,d.origin),p=l.symbolizer.place(z,m,h);if(!!p)for(let b of p){var a=!1;if(!(b.deduplicationKey&&this.index.deduplicationCollides(b))){if(this.index.labelCollides(b,1/0)){if(!this.index.labelCollides(b,o)){let y=this.index.searchLabel(b,1/0);for(let g of y){this.index.removeLabel(g);for(let v of g.bboxes)this.findInvalidatedTiles(n,d.dim,v,c)}this.index.insert(b,o,c),a=!0}}else this.index.insert(b,o,c),a=!0;if(a)for(let y of b.bboxes)(y.maxX>d.origin.x+d.dim||y.minX<d.origin.x||y.minY<d.origin.y||y.maxY>d.origin.y+d.dim)&&this.findInvalidatedTiles(n,d.dim,y,c)}}}}}for(var s of i)this.index.pruneOrNoop(s);return n.size>0&&this.callback&&this.callback(n),performance.now()-r}findInvalidatedTiles(e,r,i,n){let a=Zr(this.z,r,i);for(let s of a)s.key!=n&&this.index.hasPrefix(s.key)&&e.add(s.display)}add(e){var r=!0;for(let[i,n]of e)for(let a of n)this.index.has(oe(a.data_tile)+":"+i)||(r=!1);return r?0:this.layout(e)}},je=class{constructor(e,r,i,n){this.labelers=new Map,this.scratch=e,this.labelRules=r,this.maxLabeledTiles=i,this.callback=n}add(e,r){var i=this.labelers.get(e);return i||(i=new Ue(e,this.scratch,this.labelRules,this.maxLabeledTiles,this.callback),this.labelers.set(e,i)),i.add(r)}getIndex(e){let r=this.labelers.get(e);if(r)return r.index}};var Le={earth:"#FFFBF6",glacier:"#ffffff",residential:"#F4F4F8",hospital:"#FFF6F6",cemetery:"#EFF2EE",school:"#F7F6FF",industrial:"#FFF9EF",wood:"#F4F9EF",grass:"#EBF9E3",park:"#E5F9D5",water:"#B7DFF2",sand:"#ebebeb",buildings:"#F2EDE8",highwayCasing:"#FFC3C3",majorRoadCasing:"#FFB9B9",mediumRoadCasing:"#FFCE8E",minorRoadCasing:"#cccccc",highway:"#FFCEBB",majorRoad:"#FFE4B3",mediumRoad:"#FFF2C8",minorRoad:"#ffffff",boundaries:"#9e9e9e",mask:"#dddddd",countryLabel:"#aaaaaa",cityLabel:"#6C6C6C",stateLabel:"#999999",neighbourhoodLabel:"#888888",landuseLabel:"#898989",waterLabel:"#41ABDC",naturalLabel:"#4B8F14",roadsLabel:"#888888",poisLabel:"#606060"};var Se={earth:"#151515",glacier:"#1c1c1c",residential:"#252B2F",hospital:"#3E2C2C",cemetery:"#36483D",school:"#2C3440",industrial:"#33312C",wood:"#3A3E38",grass:"#4E604D",park:"#2C4034",water:"#4D5B73",sand:"#777777",buildings:"#464545",highwayCasing:"#000000",majorRoadCasing:"#1C1B1B",mediumRoadCasing:"#3E3E3E",minorRoadCasing:"#000000",highway:"#5B5B5B",majorRoad:"#595959",mediumRoad:"#4F4F4F",minorRoad:"#393939",boundaries:"#666666",mask:"#dddddd",countryLabel:"#ffffff",cityLabel:"#FFFFFF",stateLabel:"#ffffff",neighbourhoodLabel:"#FDFDFD",landuseLabel:"#DDDDDD",waterLabel:"#707E95",naturalLabel:"#4c4c4c",roadsLabel:"#C4C4C4",poisLabel:"#959393"};function Ne(t,e,r){return Math.min(Math.max(t,r),e)}var Fe=class extends Error{constructor(e){super(`Failed to parse color: "${e}"`)}};function Xn(t){if(typeof t!="string")throw new Fe(t);if(t.trim().toLowerCase()==="transparent")return[0,0,0,0];let e=t.trim();e=qn.test(t)?function(s){let o=s.toLowerCase().trim(),l=Vn[function(u){let f=5381,d=u.length;for(;d;)f=33*f^u.charCodeAt(--d);return(f>>>0)%2341}(o)];if(!l)throw new Fe(s);return`#${l}`}(t):t;let r=Yn.exec(e);if(r){let s=Array.from(r).slice(1);return[...s.slice(0,3).map(o=>parseInt(qe(o,2),16)),parseInt(qe(s[3]||"f",2),16)/255]}let i=Un.exec(e);if(i){let s=Array.from(i).slice(1);return[...s.slice(0,3).map(o=>parseInt(o,16)),parseInt(s[3]||"ff",16)/255]}let n=jn.exec(e);if(n){let s=Array.from(n).slice(1);return[...s.slice(0,3).map(o=>parseInt(o,10)),parseFloat(s[3]||"1")]}let a=Nn.exec(e);if(a){let[s,o,l,u]=Array.from(a).slice(1).map(parseFloat);if(Ne(0,100,o)!==o)throw new Fe(t);if(Ne(0,100,l)!==l)throw new Fe(t);return[...Zn(s,o,l),u||1]}throw new Fe(t)}var Wr=t=>parseInt(t.replace(/_/g,""),36),Vn="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((t,e)=>{let r=Wr(e.substring(0,3)),i=Wr(e.substring(3)).toString(16),n="";for(let a=0;a<6-i.length;a++)n+="0";return t[r]=`${n}${i}`,t},{}),qe=(t,e)=>Array.from(Array(e)).map(()=>t).join(""),Yn=new RegExp(`^#${qe("([a-f0-9])",3)}([a-f0-9])?$`,"i"),Un=new RegExp(`^#${qe("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),jn=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${qe(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),Nn=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,qn=/^[a-z]+$/i,$r=t=>Math.round(255*t),Zn=(t,e,r)=>{let i=r/100;if(e===0)return[i,i,i].map($r);let n=(t%360+360)%360/60,a=(1-Math.abs(2*i-1))*(e/100),s=a*(1-Math.abs(n%2-1)),o=0,l=0,u=0;n>=0&&n<1?(o=a,l=s):n>=1&&n<2?(o=s,l=a):n>=2&&n<3?(l=a,u=s):n>=3&&n<4?(l=s,u=a):n>=4&&n<5?(o=s,u=a):n>=5&&n<6&&(o=a,u=s);let f=i-a/2;return[o+f,l+f,u+f].map($r)};function Tt(t){let[e,r,i,n]=Xn(t).map((u,f)=>f===3?u:u/255),a=Math.max(e,r,i),s=Math.min(e,r,i),o=(a+s)/2;if(a===s)return[0,0,o,n];let l=a-s;return[60*(e===a?(r-i)/l+(r<i?6:0):r===a?(i-e)/l+2:(e-r)/l+4),o>.5?l/(2-a-s):l/(a+s),o,n]}function Hr(t,e,r,i){return`hsla(${(t%360).toFixed()}, ${Ne(0,100,100*e).toFixed()}%, ${Ne(0,100,100*r).toFixed()}%, ${parseFloat(Ne(0,1,i).toFixed(3))})`}var Z=N(re()),ri=N(Kr()),ii=N(Qr());var I=class{constructor(e,r){this.str=e!=null?e:r,this.per_feature=typeof this.str=="function"&&this.str.length==2}get(e,r){return typeof this.str=="function"?this.str(e,r):this.str}},B=class{constructor(e,r=1){this.value=e!=null?e:r,this.per_feature=typeof this.value=="function"&&this.value.length==2}get(e,r){return typeof this.value=="function"?this.value(e,r):this.value}},Ze=class{constructor(e){var r;this.label_props=(r=e==null?void 0:e.label_props)!=null?r:["name"],this.textTransform=e==null?void 0:e.textTransform}get(e,r){let i,n;typeof this.label_props=="function"?n=this.label_props(e,r):n=this.label_props;for(let s of n)if(r.props.hasOwnProperty(s)&&typeof r.props[s]=="string"){i=r.props[s];break}let a;return typeof this.textTransform=="function"?a=this.textTransform(e,r):a=this.textTransform,i&&a==="uppercase"?i=i.toUpperCase():i&&a==="lowercase"?i=i.toLowerCase():i&&a==="capitalize"&&(i=i.toLowerCase().split(" ").map(l=>l[0].toUpperCase()+l.slice(1)).join(" ")),i}},We=class{constructor(e){var r,i;(e==null?void 0:e.font)?this.font=e.font:(this.family=(r=e==null?void 0:e.fontFamily)!=null?r:"sans-serif",this.size=(i=e==null?void 0:e.fontSize)!=null?i:12,this.weight=e==null?void 0:e.fontWeight,this.style=e==null?void 0:e.fontStyle)}get(e,r){if(this.font)return typeof this.font=="function"?this.font(e,r):this.font;var i="";this.style&&(typeof this.style=="function"?i=this.style(e,r)+" ":i=this.style+" ");var n="";this.weight&&(typeof this.weight=="function"?n=this.weight(e,r)+" ":n=this.weight+" ");var a;typeof this.size=="function"?a=this.size(e,r):a=this.size;var s;return typeof this.family=="function"?s=this.family(e,r):s=this.family,`${i}${n}${a}px ${s}`}},Bt=class{constructor(e,r=[]){this.value=e!=null?e:r,this.per_feature=typeof this.value=="function"&&this.value.length==2}get(e,r){return typeof this.value=="function"?this.value(e,r):this.value}};var Et=N(re()),Jn=(t,e,r)=>{var i=[],n,a,s,o=0,l=0,u=0,f=0,d=0,c=0,x=0,w=0,z=0,h=0,m=0,p=0;if(t.length<2)return[];if(t.length===2)return u=Math.sqrt(Math.pow(t[1].x-t[0].x,2)+Math.pow(t[1].y-t[0].y,2)),[{length:u,beginIndex:0,beginDistance:0,endIndex:2,endDistance:u}];for(f=Math.sqrt(Math.pow(t[1].x-t[0].x,2)+Math.pow(t[1].y-t[0].y,2)),o=1,l=t.length-1;o<l;o++)n=t[o-1],a=t[o],s=t[o+1],c=a.x-n.x,x=a.y-n.y,w=s.x-a.x,z=s.y-a.y,d=Math.sqrt(w*w+z*z),u+=f,h=Math.acos((c*w+x*z)/(f*d)),(h>e||u-p>r)&&(i.push({length:u-p,beginDistance:p,beginIndex:m,endIndex:o+1,endDistance:u}),m=o,p=u),f=d;return o-m>0&&i.push({length:u-p+d,beginIndex:m,beginDistance:p,endIndex:o+1,endDistance:u+d}),i};function ei(t,e,r,i){let n,a,s=0,o=[];var l=-1/0;for(let f of t){let d=Jn(f,Math.PI/45,e);for(let c of d)if(c.length>=e+i){let x=new Et.default(f[c.beginIndex].x,f[c.beginIndex].y),w=f[c.endIndex-1],z=new Et.default((w.x-x.x)/c.length,(w.y-x.y)/c.length);for(var u=i;u<c.length-e;u+=r)o.push({start:x.add(z.mult(u)),end:x.add(z.mult(u+e))})}}return o}function ti(t,e,r,i){let n=e.x-t.x,a=e.y-t.y,s=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),o=[];for(var l=0;l<r+i;l+=2*i){let u=l*1/s;o.push({x:t.x+u*n,y:t.y+u*a})}return o}function Rt(t,e){if(t.length<=e)return[t];let r=e-1,i=t.lastIndexOf(" ",r),n=t.indexOf(" ",r);if(i==-1&&n==-1)return[t];let a,s;return n==-1||i>=0&&r-i<n-r?(a=t.substring(0,i),s=t.substring(i+1,t.length)):(a=t.substring(0,n),s=t.substring(n+1,t.length)),[a,...Rt(s,e)]}var Gn="\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DB5\u4E00-\u9FEA\uF900-\uFA6D\uFA70-\uFAD9\u2000",qa=new RegExp("^["+Gn+"]+$");var ni=5400,X;(function(i){i[i.Left=1]="Left",i[i.Center=2]="Center",i[i.Right=3]="Right"})(X||(X={}));var P;(function(l){l[l.N=1]="N",l[l.NE=2]="NE",l[l.E=3]="E",l[l.SE=4]="SE",l[l.S=5]="S",l[l.SW=6]="SW",l[l.W=7]="W",l[l.NW=8]="NW"})(P||(P={}));var Ot=(t,e,r)=>{let i=document.createElement("canvas"),n=i.getContext("2d");return i.width=t,i.height=e,n!==null&&r(i,n),i},A=class{constructor(e){var r;this.pattern=e.pattern,this.fill=new I(e.fill,"black"),this.opacity=new B(e.opacity,1),this.stroke=new I(e.stroke,"black"),this.width=new B(e.width,0),this.per_feature=(r=this.fill.per_feature||this.opacity.per_feature||this.stroke.per_feature||this.width.per_feature||e.per_feature)!=null?r:!1,this.do_stroke=!1}before(e,r){if(!this.per_feature){e.globalAlpha=this.opacity.get(r),e.fillStyle=this.fill.get(r),e.strokeStyle=this.stroke.get(r);let i=this.width.get(r);i>0&&(this.do_stroke=!0),e.lineWidth=i}if(this.pattern){let i=e.createPattern(this.pattern,"repeat");i&&(e.fillStyle=i)}}draw(e,r,i,n){var a=!1;if(this.per_feature){e.globalAlpha=this.opacity.get(i,n),e.fillStyle=this.fill.get(i,n);var s=this.width.get(i,n);s&&(a=!0,e.strokeStyle=this.stroke.get(i,n),e.lineWidth=s)}let o=()=>{e.fill(),(a||this.do_stroke)&&e.stroke()};var l=0;e.beginPath();for(var u of r){l+u.length>ni&&(o(),l=0,e.beginPath());for(var f=0;f<u.length;f++){let d=u[f];f==0?e.moveTo(d.x,d.y):e.lineTo(d.x,d.y)}l+=u.length}l>0&&o()}};function de(t,e){return r=>{let i=r-t;return i>=0&&i<e.length?e[i]:0}}function ai(t,e){let r=0;for(;e[r+1][0]<t;)r++;return r}function si(t,e,r){return t*(r-e)+e}function oi(t,e,r,i){let n=i[e+1][0]-i[e][0],a=t-i[e][0];return n===0?0:r===1?a/n:(Math.pow(r,a)-1)/(Math.pow(r,n)-1)}function j(t,e){return r=>{if(e.length<1)return 0;if(r<=e[0][0])return e[0][1];if(r>=e[e.length-1][0])return e[e.length-1][1];let i=ai(r,e),n=oi(r,i,t,e);return si(n,e[i][1],e[i+1][1])}}function Qn(t,e){return r=>{if(e.length<1)return 0;let i=t;for(let n=0;n<e.length;n++)r>=e[n][0]&&(i=e[n][1]);return i}}function ea(t){return j(1,t)}function ta(t,e,r,i,n){return a=>{if(n.length<1)return 0;let s=new ri.default(t,e,r,i),o=ai(a,n),l=s.solve(oi(a,o,1,n));return si(l,n[o][1],n[o+1][1])}}var C=class{constructor(e){var r;this.color=new I(e.color,"black"),this.width=new B(e.width),this.opacity=new B(e.opacity),this.dash=e.dash?new Bt(e.dash):null,this.dashColor=new I(e.dashColor,"black"),this.dashWidth=new B(e.dashWidth,1),this.lineCap=new I(e.lineCap,"butt"),this.lineJoin=new I(e.lineJoin,"miter"),this.skip=!1,this.per_feature=!!(((r=this.dash)==null?void 0:r.per_feature)||this.color.per_feature||this.opacity.per_feature||this.width.per_feature||this.lineCap.per_feature||this.lineJoin.per_feature||e.per_feature)}before(e,r){this.per_feature||(e.strokeStyle=this.color.get(r),e.lineWidth=this.width.get(r),e.globalAlpha=this.opacity.get(r),e.lineCap=this.lineCap.get(r),e.lineJoin=this.lineJoin.get(r))}draw(e,r,i,n){if(this.skip)return;let a=()=>{this.per_feature&&(e.globalAlpha=this.opacity.get(i,n),e.lineCap=this.lineCap.get(i,n),e.lineJoin=this.lineJoin.get(i,n)),this.dash?(e.save(),this.per_feature?(e.lineWidth=this.dashWidth.get(i,n),e.strokeStyle=this.dashColor.get(i,n),e.setLineDash(this.dash.get(i,n))):e.setLineDash(this.dash.get(i)),e.stroke(),e.restore()):(e.save(),this.per_feature&&(e.lineWidth=this.width.get(i,n),e.strokeStyle=this.color.get(i,n)),e.stroke(),e.restore())};var s=0;e.beginPath();for(var o of r){s+o.length>ni&&(a(),s=0,e.beginPath());for(var l=0;l<o.length;l++){let u=o[l];l==0?e.moveTo(u.x,u.y):e.lineTo(u.x,u.y)}s+=o.length}s>0&&a()}},li=class{constructor(e){this.name=e.name,this.sheet=e.sheet,this.dpr=window.devicePixelRatio}place(e,r,i){let n=r[0],a=new Z.default(r[0][0].x,r[0][0].y),s=this.sheet.get(this.name),o=s.w/this.dpr,l=s.h/this.dpr,u={minX:a.x-o/2,minY:a.y-l/2,maxX:a.x+o/2,maxY:a.y+l/2};return[{anchor:a,bboxes:[u],draw:d=>{d.globalAlpha=1,d.drawImage(this.sheet.canvas,s.x,s.y,s.w,s.h,-s.w/2/this.dpr,-s.h/2/this.dpr,s.w/2,s.h/2)}}]}},te=class{constructor(e){this.radius=new B(e.radius,3),this.fill=new I(e.fill,"black"),this.stroke=new I(e.stroke,"white"),this.width=new B(e.width,0),this.opacity=new B(e.opacity)}draw(e,r,i,n){e.globalAlpha=this.opacity.get(i,n);let a=this.radius.get(i,n),s=this.width.get(i,n);s>0&&(e.strokeStyle=this.stroke.get(i,n),e.lineWidth=s,e.beginPath(),e.arc(r[0][0].x,r[0][0].y,a+s/2,0,2*Math.PI),e.stroke()),e.fillStyle=this.fill.get(i,n),e.beginPath(),e.arc(r[0][0].x,r[0][0].y,a,0,2*Math.PI),e.fill()}place(e,r,i){let n=r[0],a=new Z.default(r[0][0].x,r[0][0].y),s=this.radius.get(e.zoom,i),o={minX:a.x-s,minY:a.y-s,maxX:a.x+s,maxY:a.y+s};return[{anchor:a,bboxes:[o],draw:u=>{this.draw(u,[[new Z.default(0,0)]],e.zoom,i)}}]}},lt=class{constructor(e){this.font=new We(e),this.text=new Ze(e),this.fill=new I(e.fill,"black"),this.background=new I(e.background,"white"),this.padding=new B(e.padding,0)}place(e,r,i){let n=this.text.get(e.zoom,i);if(!n)return;let a=this.font.get(e.zoom,i);e.scratch.font=a;let s=e.scratch.measureText(n),o=s.width,l=s.actualBoundingBoxAscent,u=s.actualBoundingBoxDescent,f=r[0],d=new Z.default(r[0][0].x,r[0][0].y),c=this.padding.get(e.zoom,i),x={minX:d.x-o/2-c,minY:d.y-l-c,maxX:d.x+o/2+c,maxY:d.y+u+c};return[{anchor:d,bboxes:[x],draw:z=>{z.globalAlpha=1,z.fillStyle=this.background.get(e.zoom,i),z.fillRect(-o/2-c,-l-c,o+2*c,l+u+2*c),z.fillStyle=this.fill.get(e.zoom,i),z.font=a,z.fillText(n,-o/2,0)}}]}},$e=class{constructor(e){this.list=e}place(e,r,i){var n=this.list[0].place(e,r,i);if(!n)return;var a=n[0];let s=a.anchor,o=a.bboxes[0],l=o.maxY-o.minY,u=[{draw:a.draw,translate:{x:0,y:0}}],f=[[new Z.default(r[0][0].x,r[0][0].y+l)]];for(let c=1;c<this.list.length;c++)n=this.list[c].place(e,f,i),n&&(a=n[0],o=ui(o,a.bboxes[0]),u.push({draw:a.draw,translate:{x:0,y:l}}));return[{anchor:s,bboxes:[o],draw:c=>{for(let x of u)c.save(),c.translate(x.translate.x,x.translate.y),x.draw(c),c.restore()}}]}},ui=(t,e)=>({minX:Math.min(t.minX,e.minX),minY:Math.min(t.minY,e.minY),maxX:Math.max(t.maxX,e.maxX),maxY:Math.max(t.maxY,e.maxY)}),ye=class{constructor(e){this.list=e}place(e,r,i){let n=this.list[0];if(!n)return;var a=n.place(e,r,i);if(!a)return;var s=a[0];let o=s.anchor,l=s.bboxes[0],u=[s.draw];for(let d=1;d<this.list.length;d++){if(a=this.list[d].place(e,r,i),!a)return;s=a[0],l=ui(l,s.bboxes[0]),u.push(s.draw)}return[{anchor:o,bboxes:[l],draw:d=>{u.forEach(c=>c(d))}}]}},It=class{constructor(e){this.symbolizer=e}place(e,r,i){let n=r[0][0],a=this.symbolizer.place(e,[[new Z.default(0,0)]],i);if(!a||a.length==0)return;let s=a[0],o=s.bboxes[0],l=o.maxX-o.minX,u=o.maxY-o.minY,f={minX:n.x-l/2,maxX:n.x+l/2,minY:n.y-u/2,maxY:n.y+u/2};return[{anchor:n,bboxes:[f],draw:c=>{c.translate(-l/2,u/2-o.maxY),s.draw(c,{justify:2})}}]}},hi=class{constructor(e,r){this.padding=new B(e,0),this.symbolizer=r}place(e,r,i){let n=this.symbolizer.place(e,r,i);if(!n||n.length==0)return;let a=this.padding.get(e.zoom,i);for(var s of n)for(var o of s.bboxes)o.minX-=a,o.minY-=a,o.maxX+=a,o.maxY+=a;return n}},He=class{constructor(e){this.font=new We(e),this.text=new Ze(e),this.fill=new I(e.fill,"black"),this.stroke=new I(e.stroke,"black"),this.width=new B(e.width,0),this.lineHeight=new B(e.lineHeight,1),this.letterSpacing=new B(e.letterSpacing,0),this.maxLineCodeUnits=new B(e.maxLineChars,15),this.justify=e.justify}place(e,r,i){let n=this.text.get(e.zoom,i);if(!n)return;let a=this.font.get(e.zoom,i);e.scratch.font=a;let s=this.letterSpacing.get(e.zoom,i),o=Rt(n,this.maxLineCodeUnits.get(e.zoom,i));var l="",u=0;for(let p of o)p.length>u&&(u=p.length,l=p);let f=e.scratch.measureText(l),d=f.width+s*(u-1),c=f.actualBoundingBoxAscent,x=f.actualBoundingBoxDescent,w=(c+x)*this.lineHeight.get(e.zoom,i),z=new Z.default(r[0][0].x,r[0][0].y),h={minX:z.x,minY:z.y-c,maxX:z.x+d,maxY:z.y+x+(o.length-1)*w};return[{anchor:z,bboxes:[h],draw:(p,b)=>{p.globalAlpha=1,p.font=a,p.fillStyle=this.fill.get(e.zoom,i);let y=this.width.get(e.zoom,i);var g=0;for(let S of o){var v=0;if(this.justify==2||b&&b.justify==2?v=(d-p.measureText(S).width)/2:(this.justify==3||b&&b.justify==3)&&(v=d-p.measureText(S).width),y)if(p.lineWidth=y*2,p.strokeStyle=this.stroke.get(e.zoom,i),s>0){var _=v;for(var k of S)p.strokeText(k,_,g),_+=p.measureText(k).width+s}else p.strokeText(S,v,g);if(s>0){var _=v;for(var k of S)p.fillText(k,_,g),_+=p.measureText(k).width+s}else p.fillText(S,v,g);g+=w}}}]}},U=class{constructor(e){this.centered=new It(new He(e))}place(e,r,i){return this.centered.place(e,r,i)}},Xt=class{constructor(e,r){var i,n,a;this.symbolizer=e,this.offsetX=new B(r.offsetX,0),this.offsetY=new B(r.offsetY,0),this.justify=(i=r.justify)!=null?i:void 0,this.placements=(n=r.placements)!=null?n:[2,6,8,4,1,3,5,7],this.ddValues=(a=r.ddValues)!=null?a:()=>({})}place(e,r,i){if(i.geomType!==ee.Point)return;let n=r[0][0],a=this.symbolizer.place(e,[[new Z.default(0,0)]],i);if(!a||a.length==0)return;let s=a[0],o=s.bboxes[0],l=this.offsetX,u=this.offsetY,f=this.justify,d=this.placements,{offsetX:c,offsetY:x,justify:w,placements:z}=this.ddValues(e.zoom,i)||{};c&&(l=new B(c,0)),x&&(u=new B(x,0)),w&&(f=w),z&&(d=z);let h=l.get(e.zoom,i),m=u.get(e.zoom,i),p=(_,k)=>({minX:_.x+k.x+o.minX,minY:_.y+k.y+o.minY,maxX:_.x+k.x+o.maxX,maxY:_.y+k.y+o.maxY});var b=new Z.default(h,m),y;let g=_=>{_.translate(b.x,b.y),s.draw(_,{justify:y})},v=(_,k)=>{let S=p(_,k);if(!e.index.bboxCollides(S,e.order))return[{anchor:n,bboxes:[S],draw:g}]};for(let _ of d){let k=this.computeXAxisOffset(h,o,_),S=this.computeYAxisOffset(m,o,_);return y=this.computeJustify(f,_),b=new Z.default(k,S),v(n,b)}}computeXAxisOffset(e,r,i){let n=r.maxX,a=n/2;return[1,5].includes(i)?e-a:[8,7,6].includes(i)?e-n:e}computeYAxisOffset(e,r,i){let n=Math.abs(r.minY),a=r.maxY,s=(r.minY+r.maxY)/2;return[3,7].includes(i)?e-s:[8,2,1].includes(i)?e-a:[6,4,5].includes(i)?e+n:e}computeJustify(e,r){return e||([1,5].includes(r)?2:[2,3,4].includes(r)?1:3)}},le=class{constructor(e){this.symbolizer=new Xt(new He(e),e)}place(e,r,i){return this.symbolizer.place(e,r,i)}},Me;(function(i){i[i.Above=1]="Above",i[i.Center=2]="Center",i[i.Below=3]="Below"})(Me||(Me={}));var ce=class{constructor(e){var r;this.font=new We(e),this.text=new Ze(e),this.fill=new I(e.fill,"black"),this.stroke=new I(e.stroke,"black"),this.width=new B(e.width,0),this.offset=new B(e.offset,0),this.position=(r=e.position)!=null?r:1,this.maxLabelCodeUnits=new B(e.maxLabelChars,40),this.repeatDistance=new B(e.repeatDistance,250)}place(e,r,i){let n=this.text.get(e.zoom,i);if(!n||n.length>this.maxLabelCodeUnits.get(e.zoom,i))return;let a=20,s=i.bbox;if(s.maxY-s.minY<a&&s.maxX-s.minX<a)return;let o=this.font.get(e.zoom,i);e.scratch.font=o;let l=e.scratch.measureText(n),u=l.width,f=l.actualBoundingBoxAscent+l.actualBoundingBoxDescent;var d=this.repeatDistance.get(e.zoom,i);e.overzoom>4&&(d*=1<<e.overzoom-4);let c=f*2,x=ei(r,u,d,c);if(x.length==0)return;let w=[];for(let z of x){let h=z.end.x-z.start.x,m=z.end.y-z.start.y,b=ti(z.start,z.end,u,c/2).map(g=>({minX:g.x-c/2,minY:g.y-c/2,maxX:g.x+c/2,maxY:g.y+c/2})),y=g=>{g.globalAlpha=1,g.rotate(Math.atan2(m,h)),h<0&&(g.scale(-1,-1),g.translate(-u,0));let v=0;this.position===3?v+=f:this.position===2&&(v+=f/2),g.translate(0,v-this.offset.get(e.zoom,i)),g.font=o;let _=this.width.get(e.zoom,i);_&&(g.lineWidth=_,g.strokeStyle=this.stroke.get(e.zoom,i),g.strokeText(n,0,0)),g.fillStyle=this.fill.get(e.zoom,i),g.fillText(n,0,0)};w.push({anchor:z.start,bboxes:b,draw:y,deduplicationKey:n,deduplicationDistance:d})}return w}},ue=class{constructor(e){this.symbolizer=new He(e)}place(e,r,i){let n=i.bbox;if((n.maxY-n.minY)*(n.maxX-n.minX)<2e4)return;let s=this.symbolizer.place(e,[[new Z.default(0,0)]],i);if(!s||s.length==0)return;let o=s[0],l=o.bboxes[0],u=r[0],f=(0,ii.default)([u.map(w=>[w.x,w.y])]),d=new Z.default(f[0],f[1]),c={minX:d.x-(l.maxX-l.minX)/2,minY:d.y-(l.maxY-l.minY)/2,maxX:d.x+(l.maxX-l.minX)/2,maxY:d.y+(l.maxY-l.minY)/2};return[{anchor:d,bboxes:[c],draw:w=>{w.translate(o.anchor.x-(l.maxX-l.minX)/2,o.anchor.y),o.draw(w)}}]}};var fi=(t,e)=>{let r=Tt(e),i=er({},t);for(let[n,a]of Object.entries(t)){let s=Tt(a);i[n]=Hr(r[0],r[1],s[2],s[3])}return i},Ce=(t,e)=>(e&&(t=fi(t,e)),[{dataLayer:"earth",symbolizer:new A({fill:t.earth})},{dataLayer:"natural",symbolizer:new A({fill:t.glacier}),filter:(r,i)=>i.props.natural=="glacier"},{dataLayer:"landuse",symbolizer:new A({fill:t.residential}),filter:(r,i)=>i.props.landuse=="residential"||i.props.place=="neighbourhood"},{dataLayer:"landuse",symbolizer:new A({fill:t.hospital}),filter:(r,i)=>i.props.amenity=="hospital"},{dataLayer:"landuse",symbolizer:new A({fill:t.cemetery}),filter:(r,i)=>i.props.landuse=="cemetery"},{dataLayer:"landuse",symbolizer:new A({fill:t.school}),filter:(r,i)=>i.props.amenity=="school"||i.props.amenity=="kindergarten"||i.props.amenity=="university"||i.props.amenity=="college"},{dataLayer:"landuse",symbolizer:new A({fill:t.industrial}),filter:(r,i)=>i.props.landuse=="industrial"},{dataLayer:"natural",symbolizer:new A({fill:t.wood}),filter:(r,i)=>i.props.natural=="wood"},{dataLayer:"landuse",symbolizer:new A({fill:t.grass}),filter:(r,i)=>i.props.landuse=="grass"},{dataLayer:"landuse",symbolizer:new A({fill:t.park}),filter:(r,i)=>i.props.leisure=="park"},{dataLayer:"water",symbolizer:new A({fill:t.water})},{dataLayer:"natural",symbolizer:new A({fill:t.sand}),filter:(r,i)=>i.props.natural=="sand"},{dataLayer:"buildings",symbolizer:new A({fill:t.buildings})},{dataLayer:"roads",symbolizer:new C({color:t.highwayCasing,width:j(1.4,[[5,1.5],[11,4],[16,9],[20,40]])}),filter:(r,i)=>i.props["pmap:kind"]=="highway"},{dataLayer:"roads",symbolizer:new C({color:t.majorRoadCasing,width:j(1.4,[[9,3],[12,4],[17,8],[20,22]])}),filter:(r,i)=>i.props["pmap:kind"]=="major_road"},{dataLayer:"roads",symbolizer:new C({color:t.mediumRoadCasing,width:j(1.4,[[13,3],[17,6],[20,18]])}),filter:(r,i)=>i.props["pmap:kind"]=="medium_road"},{dataLayer:"roads",symbolizer:new C({color:t.minorRoadCasing,width:j(1.4,[[14,2],[17,5],[20,15]])}),filter:(r,i)=>i.props["pmap:kind"]=="minor_road"},{dataLayer:"roads",symbolizer:new C({color:t.minorRoad,width:j(1.4,[[14,1],[17,3],[20,13]])}),filter:(r,i)=>i.props["pmap:kind"]=="minor_road"},{dataLayer:"roads",symbolizer:new C({color:t.mediumRoad,width:j(1.4,[[13,2],[17,4],[20,15]])}),filter:(r,i)=>i.props["pmap:kind"]=="medium_road"},{dataLayer:"roads",symbolizer:new C({color:t.majorRoad,width:j(1.4,[[9,2],[12,3],[17,6],[20,20]])}),filter:(r,i)=>i.props["pmap:kind"]=="major_road"},{dataLayer:"roads",symbolizer:new C({color:t.highway,width:j(1.4,[[5,.5],[11,2.5],[16,7],[20,30]])}),filter:(r,i)=>i.props["pmap:kind"]=="highway"},{dataLayer:"boundaries",symbolizer:new C({color:t.boundaries,width:2,opacity:.4})},{dataLayer:"mask",symbolizer:new A({fill:t.mask})}]),Te=(t,e,r,i)=>{e&&(t=fi(t,e));var n=["name"];r&&(n=r);let a=(s,o)=>i?s instanceof le?new $e([s,new le({fill:o,label_props:i})]):new $e([s,new U({fill:o,label_props:i})]):s;return[{dataLayer:"places",symbolizer:a(new U({label_props:n,fill:t.countryLabel,lineHeight:1.5,font:(s,o)=>s<6?"200 14px sans-serif":"200 20px sans-serif",textTransform:"uppercase"}),t.countryLabel),filter:(s,o)=>o.props["pmap:kind"]=="country"},{dataLayer:"places",symbolizer:a(new U({label_props:n,fill:t.stateLabel,font:"300 16px sans-serif"}),t.stateLabel),filter:(s,o)=>o.props["pmap:kind"]=="state"},{id:"cities_high",dataLayer:"places",filter:(s,o)=>o.props["pmap:kind"]=="city",minzoom:7,symbolizer:a(new U({label_props:n,fill:t.cityLabel,font:(s,o)=>(o==null?void 0:o.props["pmap:rank"])===1?s>8?"600 20px sans-serif":"600 12px sans-serif":s>8?"600 16px sans-serif":"600 10px sans-serif"}),t.cityLabel),sort:(s,o)=>s["pmap:rank"]-o["pmap:rank"]},{id:"cities_low",dataLayer:"places",filter:(s,o)=>o.props["pmap:kind"]=="city",maxzoom:6,symbolizer:new ye([new te({radius:2,fill:t.cityLabel}),a(new le({label_props:n,fill:t.cityLabel,offsetX:2,offsetY:2,font:(s,o)=>(o==null?void 0:o.props["pmap:rank"])===1?s>8?"600 20px sans-serif":"600 12px sans-serif":s>8?"600 16px sans-serif":"600 10px sans-serif"}),t.cityLabel)]),sort:(s,o)=>s["pmap:rank"]-o["pmap:rank"]},{id:"neighbourhood",dataLayer:"places",symbolizer:a(new U({label_props:n,fill:t.neighbourhoodLabel,font:"500 10px sans-serif",textTransform:"uppercase"}),t.neighbourhoodLabel),filter:(s,o)=>o.props["pmap:kind"]=="neighbourhood"},{dataLayer:"landuse",symbolizer:a(new ue({label_props:n,fill:t.landuseLabel,font:"300 12px sans-serif"}),t.landuseLabel)},{dataLayer:"water",symbolizer:a(new ue({label_props:n,fill:t.waterLabel,font:"italic 600 12px sans-serif"}),t.waterLabel)},{dataLayer:"natural",symbolizer:a(new ue({label_props:n,fill:t.naturalLabel,font:"italic 300 12px sans-serif"}),t.naturalLabel)},{dataLayer:"roads",symbolizer:a(new ce({label_props:n,fill:t.roadsLabel,font:"500 12px sans-serif"}),t.roadsLabel),minzoom:12},{dataLayer:"roads",symbolizer:new lt({label_props:["ref"],font:"600 9px sans-serif",background:t.highway,padding:2,fill:t.neighbourhoodLabel}),filter:(s,o)=>o.props["pmap:kind"]=="highway"},{dataLayer:"pois",symbolizer:new ye([new te({radius:2,fill:t.poisLabel}),a(new le({label_props:n,fill:t.poisLabel,offsetX:2,offsetY:2,font:"300 10px sans-serif"}),t.poisLabel)])}]};var di=(t,e,r)=>[{dataSource:t,dataLayer:e,symbolizer:new te({opacity:.2,fill:r,radius:4}),filter:(i,n)=>n.geomType==ee.Point},{dataSource:t,dataLayer:e,symbolizer:new C({opacity:.2,color:r,width:2}),filter:(i,n)=>n.geomType==ee.Line},{dataSource:t,dataLayer:e,symbolizer:new A({opacity:.2,fill:r,stroke:r,width:1}),filter:(i,n)=>n.geomType==ee.Polygon}],ut=(t,e)=>{var r=[];for(var[i,n]of t)for(var a of n)for(var s of a.data.keys())i===e.dataSource&&s===e.dataLayer||(r=r.concat(di(i,s,"steelblue")));return r=r.concat(di(e.dataSource||"",e.dataLayer,"red")),r};var Ke=6378137,ci=85.0511287798,H=Ke*Math.PI,mi=t=>{let e=Math.PI/180,r=Math.max(Math.min(ci,t.y),-ci),i=Math.sin(r*e);return new he.default(Ke*t.x*e,Ke*Math.log((1+i)/(1-i))/2)},ra=t=>{var e=180/Math.PI;return{lat:(2*Math.atan(Math.exp(t.y/Ke))-Math.PI/2)*e,lng:t.x*e/Ke}},ia=(t,e)=>r=>{let i=mi(r);return new he.default((i.x+H)/(H*2),1-(i.y+H)/(H*2)).mult((1<<e)*256).sub(t)},na=(t,e)=>r=>{let i=new he.default(r.x,r.y).add(t).div((1<<e)*256),n=new he.default(i.x*(H*2)-H,(1-i.y)*(H*2)-H);return ra(n)},Vt=(t,e)=>{let r=e*(360/t);return Math.log2(r/256)},pi=class{constructor(e){let r=e.dark?Se:Le;this.paint_rules=e.paint_rules||Ce(r,e.shade),this.label_rules=e.label_rules||Te(r,e.shade,e.language1,e.language2),this.backgroundColor=e.backgroundColor,this.views=Ve(e),this.debug=e.debug||"",this.xray=e.xray}drawContext(e,r,i,n,a){return O(this,null,function*(){let s=mi(n),l=new he.default((s.x+H)/(H*2),1-(s.y+H)/(H*2)).clone().mult(Math.pow(2,a)*256).sub(new he.default(r/2,i/2)),u={minX:l.x,minY:l.y,maxX:l.x+r,maxY:l.y+i},f=[];for(let[p,b]of this.views){let y=b.getBbox(a,u);f.push({key:p,promise:y})}let d=yield Promise.all(f.map(p=>p.promise.then(b=>({status:"fulfilled",value:b,key:p.key}),b=>({status:"rejected",value:[],reason:b,key:p.key})))),c=new Map;for(let p of d)p.status==="fulfilled"&&c.set(p.key,p.value);let x=performance.now(),w=new Ue(a,e,this.label_rules,16,void 0),z=w.add(c);this.backgroundColor&&(e.save(),e.fillStyle=this.backgroundColor,e.fillRect(0,0,r,i),e.restore());let h=this.paint_rules;this.xray&&(h=ut(c,this.xray));let m=Ye(e,a,c,this.xray?null:w.index,h,u,l,!0,this.debug);if(this.debug){e.save(),e.translate(-l.x,-l.y),e.strokeStyle=this.debug,e.fillStyle=this.debug,e.font="12px sans-serif";let p=0;for(let[b,y]of c){for(let g of y){e.strokeRect(g.origin.x,g.origin.y,g.dim,g.dim);let v=g.data_tile;e.fillText(b+(b?" ":"")+v.z+" "+v.x+" "+v.y,g.origin.x+4,g.origin.y+14*(1+p))}p++}e.restore()}return{elapsed:performance.now()-x,project:ia(l,a),unproject:na(l,a)}})}drawCanvas(a,s,o){return O(this,arguments,function*(e,r,i,n={}){let l=window.devicePixelRatio,u=e.clientWidth,f=e.clientHeight;e.width==u*l&&e.height==f*l||(e.width=u*l,e.height=f*l),n.lang&&(e.lang=n.lang);let d=e.getContext("2d");return d.setTransform(l,0,0,l,0,0),this.drawContext(d,u,f,r,i)})}drawContextBounds(e,r,i,n,a){return O(this,null,function*(){let s=i.x-r.x,o=new he.default((r.x+i.x)/2,(r.y+i.y)/2);return this.drawContext(e,n,a,o,Vt(s,n))})}drawCanvasBounds(s,o,l,u){return O(this,arguments,function*(e,r,i,n,a={}){let f=i.x-r.x,d=new he.default((r.x+i.x)/2,(r.y+i.y)/2);return this.drawCanvas(e,d,Vt(f,n),a)})}};var yi=N(re());var aa=t=>new Promise((e,r)=>{setTimeout(()=>{e()},t)}),sa=t=>t.then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e})),oa=(t={})=>{class e extends L.GridLayer{constructor(i={}){i.noWrap&&!i.bounds&&(i.bounds=[[-90,-180],[90,180]]),i.attribution==null&&(i.attribution='<a href="https://protomaps.com">Protomaps</a> \xA9 <a href="https://openstreetmap.org/copyright">OpenStreetMap</a>'),super(i);let n=i.dark?Se:Le;this.paint_rules=i.paint_rules||Ce(n,i.shade),this.label_rules=i.label_rules||Te(n,i.shade,i.language1,i.language2),this.backgroundColor=i.backgroundColor,this.lastRequestedZ=void 0,this.xray=i.xray,this.tasks=i.tasks||[],this.views=Ve(i),this.debug=i.debug;let a=document.createElement("canvas").getContext("2d");this.scratch=a,this.onTilesInvalidated=s=>{s.forEach(o=>{this.rerenderTile(o)})},this.labelers=new je(this.scratch,this.label_rules,16,this.onTilesInvalidated),this.tile_size=256*window.devicePixelRatio,this.tileDelay=i.tileDelay||3,this.lang=i.lang,this.inspector=this.inspect(this)}setDefaultStyle(i,n,a,s){let o=i?Se:Le;this.paint_rules=Ce(o,n),this.label_rules=Te(o,n,a,s)}renderTile(i,n,a,s=()=>{}){return O(this,null,function*(){this.lastRequestedZ=i.z;let o=[];for(let[_,k]of this.views){let S=k.getDisplayTile(i);o.push({key:_,promise:S})}let l=yield Promise.all(o.map(_=>_.promise.then(k=>({status:"fulfilled",value:k,key:_.key}),k=>({status:"rejected",reason:k,key:_.key})))),u=new Map;for(let _ of l)_.status==="fulfilled"?u.set(_.key,[_.value]):_.reason.name==="AbortError"||console.error(_.reason);if(n.key!=a||this.lastRequestedZ!==i.z||(yield Promise.all(this.tasks.map(sa)),n.key!=a)||this.lastRequestedZ!==i.z)return;let f=this.labelers.add(i.z,u);if(n.key!=a||this.lastRequestedZ!==i.z)return;let d=this.labelers.getIndex(i.z);if(!this._map)return;let c=this._map.getCenter().wrap(),x=this._getTiledPixelBounds(c),w=this._pxBoundsToTileRange(x),z=w.getCenter(),h=i.distanceTo(z)*this.tileDelay;if(yield aa(h),n.key!=a||this.lastRequestedZ!==i.z)return;let m=16,p={minX:256*i.x-m,minY:256*i.y-m,maxX:256*(i.x+1)+m,maxY:256*(i.y+1)+m},b=new yi.default(256*i.x,256*i.y);n.width=this.tile_size,n.height=this.tile_size;let y=n.getContext("2d");y.setTransform(this.tile_size/256,0,0,this.tile_size/256,0,0),y.clearRect(0,0,256,256),this.backgroundColor&&(y.save(),y.fillStyle=this.backgroundColor,y.fillRect(0,0,256,256),y.restore());var g=0;let v=this.paint_rules;if(this.xray&&(v=ut(u,this.xray)),g=Ye(y,i.z,u,this.xray?null:d,v,p,b,!1,this.debug),this.debug){y.save(),y.fillStyle=this.debug,y.font="600 12px sans-serif",y.fillText(i.z+" "+i.x+" "+i.y,4,14),y.font="12px sans-serif";let _=28;for(let[k,S]of u){let D=S[0].data_tile;y.fillText(k+(k?" ":"")+D.z+" "+D.x+" "+D.y,4,_),_+=14}y.font="600 10px sans-serif",g>8&&(y.fillText(g.toFixed()+" ms paint",4,_),_+=14),f>8&&y.fillText(f.toFixed()+" ms layout",4,_),y.strokeStyle=this.debug,y.lineWidth=.5,y.beginPath(),y.moveTo(0,0),y.lineTo(0,256),y.stroke(),y.lineWidth=.5,y.beginPath(),y.moveTo(0,0),y.lineTo(256,0),y.stroke(),y.restore()}s()})}rerenderTile(i){for(let n in this._tiles){let a=this._wrapCoords(this._keyToTileCoords(n));i===this._tileCoordsToKey(a)&&this.renderTile(a,this._tiles[n].el,i)}}clearLayout(){this.labelers=new je(this.scratch,this.label_rules,16,this.onTilesInvalidated)}rerenderTiles(){for(let i in this._tiles){let n=this._wrapCoords(this._keyToTileCoords(i)),a=this._tileCoordsToKey(n);this.renderTile(n,this._tiles[i].el,a)}}createTile(i,n){let a=L.DomUtil.create("canvas","leaflet-tile");a.lang=this.lang;let s=this._tileCoordsToKey(i);return a.key=s,this.renderTile(i,a,s,()=>{n(null,a)}),a}_removeTile(i){let n=this._tiles[i];!n||(n.el.removed=!0,n.el.key=void 0,L.DomUtil.removeClass(n.el,"leaflet-tile-loaded"),n.el.width=n.el.height=0,L.DomUtil.remove(n.el),delete this._tiles[i],this.fire("tileunload",{tile:n.el,coords:this._keyToTileCoords(i)}))}queryFeatures(i,n){let a=new Map;for(var[s,o]of this.views)a.set(s,o.queryFeatures(i,n,this._map.getZoom()));return a}inspect(i){return n=>{let a=["\u25CE","\u27CD","\u25FB"],s=i._map.wrapLatLng(n.latlng),o=i.queryFeatures(s.lng,s.lat);var l="";let u=!0;for(var[f,d]of o)for(var c of d)if(!(this.xray&&this.xray!==!0&&!((this.xray.dataSource||"")===f&&this.xray.dataLayer===c.layerName))){l=l+`<div style="margin-top:${u?0:.5}em">${a[c.feature.geomType-1]} <b>${f} ${f?"/":""} ${c.layerName}</b> ${c.feature.id||""}</div>`;for(let x in c.feature.props)l=l+`<div style="font-size:0.9em">${x} = ${c.feature.props[x]}</div>`;u=!1}u&&(l="No features."),L.popup().setLatLng(n.latlng).setContent('<div style="max-height:400px;overflow-y:scroll;padding-right:8px">'+l+"</div>").openOn(i._map)}}addInspector(i){return i.on("click",this.inspector)}removeInspector(i){return i.off("click",this.inspector)}}return new e(t)};function Yt(t){let e=0,r=0;for(let o of t)e+=o.w*o.h,r=Math.max(r,o.w);t.sort((o,l)=>l.h-o.h);let i=Math.max(Math.ceil(Math.sqrt(e/.95)),r),n=[{x:0,y:0,w:i,h:1/0}],a=0,s=0;for(let o of t)for(let l=n.length-1;l>=0;l--){let u=n[l];if(!(o.w>u.w||o.h>u.h)){if(o.x=u.x,o.y=u.y,s=Math.max(s,o.y+o.h),a=Math.max(a,o.x+o.w),o.w===u.w&&o.h===u.h){let f=n.pop();l<n.length&&(n[l]=f)}else o.h===u.h?(u.x+=o.w,u.w-=o.w):o.w===u.w?(u.y+=o.h,u.h-=o.h):(n.push({x:u.x+o.w,y:u.y,w:u.w-o.w,h:o.h}),u.y+=o.h,u.h-=o.h);break}}return{w:a,h:s,fill:e/(a*s)||0}}var Ut=(t,e,r)=>{let i=new FontFace(t,"url("+e+")",{weight:r});return document.fonts.add(i),i.load()},xi=t=>O(void 0,null,function*(){return new Promise((e,r)=>{let i=new Image;i.onload=()=>e(i),i.onerror=()=>r("Invalid SVG"),i.src=t})}),la=`
|
|
2
|
+
<svg width="20px" height="20px" viewBox="0 0 50 50" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<rect width="50" height="50" fill="#cccccc"/>
|
|
4
|
+
<g transform="translate(5,5)">
|
|
5
|
+
<path fill="none" stroke="#666666" stroke-width="7" d="m11,12a8.5,8 0 1,1 17,0q0,4-4,6t-4.5,4.5-.4,4v.2m0,3v7"/>
|
|
6
|
+
</g>
|
|
7
|
+
</svg>
|
|
8
|
+
`,gi=class{constructor(e){this.src=e,this.canvas=document.createElement("canvas"),this.mapping=new Map,this.missingBox={x:0,y:0,w:0,h:0}}load(){return O(this,null,function*(){let e=this.src,r=window.devicePixelRatio;e.endsWith(".html")&&(e=yield(yield fetch(e)).text());let i=new window.DOMParser().parseFromString(e,"text/html"),n=Array.from(i.body.children),a=yield xi("data:image/svg+xml;base64,"+btoa(la)),s=[{w:a.width*r,h:a.height*r,img:a,id:""}],o=new XMLSerializer;for(let c of n){var l=btoa(o.serializeToString(c)),u="data:image/svg+xml;base64,"+l;let x=yield xi(u);s.push({w:x.width*r,h:x.height*r,img:x,id:c.id})}let f=Yt(s);this.canvas.width=f.w,this.canvas.height=f.h;let d=this.canvas.getContext("2d");if(d)for(let c of s)c.x!==void 0&&c.y!==void 0&&(d.drawImage(c.img,c.x,c.y,c.w,c.h),c.id?this.mapping.set(c.id,{x:c.x,y:c.y,w:c.w,h:c.h}):this.missingBox={x:c.x,y:c.y,w:c.w,h:c.h});return this})}get(e){let r=this.mapping.get(e);return r||(r=this.missingBox),r}};function ht(t,e){return typeof t=="number"?t:e}function Je(t){if(t.includes("$type"))return e=>!0;if(t[0]=="==")return(e,r)=>r.props[t[1]]===t[2];if(t[0]=="!=")return(e,r)=>r.props[t[1]]!==t[2];if(t[0]=="!"){let e=Je(t[1]);return(r,i)=>!e(r,i)}else{if(t[0]==="<")return(e,r)=>ht(r.props[t[1]],1/0)<t[2];if(t[0]==="<=")return(e,r)=>ht(r.props[t[1]],1/0)<=t[2];if(t[0]===">")return(e,r)=>ht(r.props[t[1]],-1/0)>t[2];if(t[0]===">=")return(e,r)=>ht(r.props[t[1]],-1/0)>=t[2];if(t[0]==="in")return(e,r)=>t.slice(2,t.length).includes(r.props[t[1]]);if(t[0]==="!in")return(e,r)=>!t.slice(2,t.length).includes(r.props[t[1]]);if(t[0]==="has")return(e,r)=>r.props.hasOwnProperty(t[1]);if(t[0]==="!has")return(e,r)=>!r.props.hasOwnProperty(t[1]);if(t[0]==="all"){let e=t.slice(1,t.length).map(r=>Je(r));return(r,i)=>e.every(n=>n(r,i))}else if(t[0]==="any"){let e=t.slice(1,t.length).map(r=>Je(r));return(r,i)=>e.some(n=>n(r,i))}else return console.log("Unimplemented filter: ",t[0]),e=>!1}}function ft(t){if(t.base&&t.stops)return r=>j(t.base,t.stops)(r-1);if(t[0]=="interpolate"&&t[1][0]=="exponential"&&t[2]=="zoom"){let r=t.slice(3),i=[];for(var e=0;e<r.length;e+=2)i.push([r[e],r[e+1]]);return n=>j(t[1][1],i)(n-1)}else if(t[0]=="step"&&t[1][0]=="get"){let r=t.slice(2),i=t[1][1];return(n,a)=>{let s=a==null?void 0:a.props[i];if(typeof s=="number"){if(s<r[1])return r[0];for(e=1;e<r.length;e+=2)if(s<=r[e])return r[e+1]}return r[r.length-1]}}else return console.log("Unimplemented numeric fn: ",t),r=>1}function jt(t,e=0){return t?typeof t=="number"?t:(r,i)=>i?ft(t)(r,i):e:e}function Nt(t,e){let r=jt(t,1),i=jt(e);return(n,a)=>{let s=typeof r=="number"?r:r(n,a);return i?s+(typeof i=="number"?i:i(n,a)):s}}function qt(t,e){let r=[];for(let o of t["text-font"])e.hasOwnProperty(o)&&r.push(e[o]);r.length===0&&r.push({face:"sans-serif"});let i=t["text-size"];var n="";r.length&&r[0].weight&&(n=r[0].weight+" ");var a="";if(r.length&&r[0].style&&(a=r[0].style+" "),typeof i=="number")return o=>`${a}${n}${i}px ${r.map(l=>l.face).join(", ")}`;if(i.stops){var s=1.4;i.base?s=i.base:i.base=s;let o=ft(i);return(l,u)=>`${a}${n}${o(l,u)}px ${r.map(f=>f.face).join(", ")}`}else if(i[0]=="step"){let o=ft(i);return(l,u)=>`${a}${n}${o(l,u)}px ${r.map(f=>f.face).join(", ")}`}else return console.log("Can't parse font: ",t),o=>"12px sans-serif"}function ua(t,e){let r=[],i=[],n=new Map;for(var a of t.layers){if(n.set(a.id,a),a.layout&&a.layout.visibility=="none")continue;if(a.ref){let u=n.get(a.ref);a.type=u.type,a.filter=u.filter,a.source=u.source,a["source-layer"]=u["source-layer"]}let l=a["source-layer"];var s,o=void 0;a.filter&&(o=Je(a.filter)),a.type=="fill"?r.push({dataLayer:a["source-layer"],filter:o,symbolizer:new A({fill:a.paint["fill-color"],opacity:a.paint["fill-opacity"]})}):a.type=="fill-extrusion"?r.push({dataLayer:a["source-layer"],filter:o,symbolizer:new A({fill:a.paint["fill-extrusion-color"],opacity:a.paint["fill-extrusion-opacity"]})}):a.type=="line"?a.paint["line-dasharray"]?r.push({dataLayer:a["source-layer"],filter:o,symbolizer:new C({width:Nt(a.paint["line-width"],a.paint["line-gap-width"]),dash:a.paint["line-dasharray"],dashColor:a.paint["line-color"]})}):r.push({dataLayer:a["source-layer"],filter:o,symbolizer:new C({color:a.paint["line-color"],width:Nt(a.paint["line-width"],a.paint["line-gap-width"])})}):a.type=="symbol"?a.layout["symbol-placement"]=="line"?i.push({dataLayer:a["source-layer"],filter:o,symbolizer:new ce({font:qt(a.layout,e),fill:a.paint["text-color"],width:a.paint["text-halo-width"],stroke:a.paint["text-halo-color"],textTransform:a.layout["text-transform"],label_props:a.layout["text-field"]?[a.layout["text-field"]]:void 0})}):i.push({dataLayer:a["source-layer"],filter:o,symbolizer:new U({font:qt(a.layout,e),fill:a.paint["text-color"],stroke:a.paint["text-halo-color"],width:a.paint["text-halo-width"],textTransform:a.layout["text-transform"],label_props:a.layout["text-field"]?[a.layout["text-field"]]:void 0})}):a.type=="circle"&&r.push({dataLayer:a["source-layer"],filter:o,symbolizer:new te({radius:a.paint["circle-radius"],fill:a.paint["circle-color"],stroke:a.paint["circle-stroke-color"],width:a.paint["circle-stroke-width"]})})}return i.reverse(),{paint_rules:r,label_rules:i,tasks:[]}}var ha=t=>{let e=Ot(4,4,s=>{var o=s.getContext("2d");o&&(o.beginPath(),o.rect(0,0,1,1),o.rect(2,2,1,1),o.fillStyle="black",o.fill())});var r="black";t==="lite"&&(r="#d9d9d9");let i=["name:en","name"],n=[{dataLayer:"earth",symbolizer:new A({fill:"white"})},{dataLayer:"landuse",symbolizer:new A({pattern:e}),filter:(s,o)=>o.props.leisure=="park"},{dataLayer:"water",symbolizer:new A({fill:r})},{dataLayer:"roads",symbolizer:new C({color:"#dddddd"}),filter:(s,o)=>o.props["pmap:kind"]==="minor_road"},{dataLayer:"roads",symbolizer:new C({color:"white",width:de(16,[7,9,17,20])}),filter:(s,o)=>o.props["pmap:kind"]==="medium_road"},{dataLayer:"roads",symbolizer:new C({color:"#cccccc",width:de(10,[.2,.2,.2,.4,.8,1.5,4,7,13,16])}),filter:(s,o)=>o.props["pmap:kind"]==="medium_road"},{dataLayer:"roads",symbolizer:new C({color:"white",width:de(11,[1.25,5,5,5,8,11,18,22,30])}),filter:(s,o)=>o.props["pmap:kind"]==="major_road"},{dataLayer:"roads",symbolizer:new C({color:"black",width:de(9,[.15,.5,.7,1,1.5,1.9,5,7,12,18,26])}),filter:(s,o)=>o.props["pmap:kind"]==="major_road"},{dataLayer:"roads",symbolizer:new C({color:"white",width:de(7,[2.25,3.25,4.25,5,6,7,8,9,11,14,24,42,49])}),filter:(s,o)=>o.props["pmap:kind"]==="highway"},{dataLayer:"roads",symbolizer:new C({color:"black",width:de(6,[.1,1.5,1.5,1.5,2,2.5,3,3,4,6,9,15,28,35])}),filter:(s,o)=>o.props["pmap:kind"]==="highway"},{dataLayer:"transit",symbolizer:new C({color:"#888888",dashColor:"#888888",dash:[1,4],dashWidth:3}),filter:(s,o)=>o.props["pmap:kind"]==="railway",minzoom:14},{dataLayer:"transit",symbolizer:new C({color:"#888888"}),filter:(s,o)=>o.props["pmap:kind"]==="railway",minzoom:14},{dataLayer:"buildings",symbolizer:new C({color:"#888888",width:.5})},{dataLayer:"boundaries",symbolizer:new C({color:"black",width:1}),maxzoom:6},{dataLayer:"boundaries",symbolizer:new C({color:"white",width:2.5,dash:[3,1],dashWidth:.3,dashColor:"black"}),minzoom:7}],a=[{dataLayer:"places",symbolizer:new U({label_props:i,fill:"black",stroke:"white",width:1.5,fontFamily:"Inter",fontWeight:300,fontSize:15,justify:X.Center}),filter:(s,o)=>o.props["pmap:kind"]=="country"},{dataLayer:"places",symbolizer:new U({label_props:i,fill:"black",stroke:"white",width:2,fontFamily:"Inter",fontWeight:300,fontSize:12,justify:X.Center}),filter:(s,o)=>o.props["pmap:kind"]=="state"},{dataLayer:"places",symbolizer:new ye([new te({radius:2,fill:"black",stroke:"white",width:2}),new le({label_props:i,offsetX:3,fill:"black",stroke:"white",width:1.5,fontFamily:"Inter",fontWeight:600,fontSize:(s,o)=>o.props["pmap:rank"]==1?15:13})]),sort:(s,o)=>s["pmap:rank"]-o["pmap:rank"],filter:(s,o)=>o.props["pmap:kind"]=="city",maxzoom:8},{dataLayer:"places",symbolizer:new U({label_props:i,justify:X.Center,fill:"black",stroke:"white",width:2,fontFamily:"Inter",fontWeight:600,fontSize:(s,o)=>o.props["pmap:rank"]==1?15:13}),sort:(s,o)=>s["pmap:rank"]-o["pmap:rank"],filter:(s,o)=>o.props["pmap:kind"]=="city",minzoom:9},{dataLayer:"water",symbolizer:new ue({label_props:i,fill:"white",stroke:"black",width:3,font:"italic 400 12px Inter"})},{dataLayer:"landuse",symbolizer:new ue({fill:"black",stroke:"white",width:2,font:"italic 400 12px Inter"})},{dataLayer:"physical_point",symbolizer:new U({label_props:i,fill:"white",stroke:"black",width:3,font:"italic 600 12px Inter",textTransform:"uppercase",justify:X.Center}),filter:(s,o)=>["ocean","sea"].includes(o.props.place)},{dataLayer:"roads",symbolizer:new ce({fill:"black",stroke:"white",width:2,font:"600 14px Inter",offset:4})}];return{tasks:[Ut("Inter","https://cdn.protomaps.com/fonts/woff2/Inter.var.woff2","100 900")],paint_rules:n,label_rules:a,attribution:'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>.'}};return fa;})();
|
|
9
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
package/worldmap/worldmap.js
CHANGED
|
@@ -38,6 +38,7 @@ var sendRoute;
|
|
|
38
38
|
var oldBounds = {ne:{lat:0, lng:0}, sw:{lat:0, lng:0}};
|
|
39
39
|
var edgeLayer = new L.layerGroup();
|
|
40
40
|
var edgeEnabled = true;
|
|
41
|
+
var pmtloaded = "";
|
|
41
42
|
|
|
42
43
|
var iconSz = {
|
|
43
44
|
"Team/Crew": 24,
|
|
@@ -93,7 +94,7 @@ var connect = function() {
|
|
|
93
94
|
document.getElementById("footer").innerHTML = "<font color='#494'>"+pagefoot+"</font>";
|
|
94
95
|
}
|
|
95
96
|
ws.send(JSON.stringify({action:"connected",parameters:Object.fromEntries((new URL(location)).searchParams),clientTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone || false}));
|
|
96
|
-
onoffline();
|
|
97
|
+
setTimeout(function() { onoffline(); }, 500);
|
|
97
98
|
};
|
|
98
99
|
ws.onclose = function() {
|
|
99
100
|
console.log("DISCONNECTED");
|
|
@@ -181,7 +182,8 @@ layers["_countries"] = omnivore.topojson('images/world-50m-flat.json',null,custo
|
|
|
181
182
|
overlays["countries"] = layers["_countries"];
|
|
182
183
|
|
|
183
184
|
var onoffline = function() { if (!navigator.onLine) {
|
|
184
|
-
|
|
185
|
+
if (pmtloaded !== "") { basemaps[pmtloaded].addTo(map); layercontrol._update(); }
|
|
186
|
+
else { map.addLayer(overlays["countries"]); }
|
|
185
187
|
} }
|
|
186
188
|
|
|
187
189
|
document.addEventListener ("keydown", function (ev) {
|
|
@@ -581,7 +583,7 @@ setInterval( function() { moveTerminator() }, 60000 );
|
|
|
581
583
|
|
|
582
584
|
// move the rainfall overlay (if enabled) every 10 minutes
|
|
583
585
|
function moveRainfall() {
|
|
584
|
-
if (navigator.onLine && map.hasLayer(overlays["rainfall"])) {
|
|
586
|
+
if (navigator.onLine && overlays.hasOwnProperty("rainfall") && map.hasLayer(overlays["rainfall"])) {
|
|
585
587
|
overlays["rainfall"]["_url"] = 'https://tilecache.rainviewer.com/v2/radar/' + parseInt(Date.now()/600000)*600 + '/256/{z}/{x}/{y}/2/1_1.png';
|
|
586
588
|
overlays["rainfall"].redraw();
|
|
587
589
|
}
|
|
@@ -1081,12 +1083,13 @@ var addBaseMaps = function(maplist,first) {
|
|
|
1081
1083
|
|
|
1082
1084
|
if (first) {
|
|
1083
1085
|
if (layerlookup[first]) { baselayername = layerlookup[first]; }
|
|
1084
|
-
else {
|
|
1086
|
+
else { baselayername = first; }
|
|
1087
|
+
if (!basemaps[baselayername]) { baselayername = Object.keys(basemaps)[0]; }
|
|
1085
1088
|
}
|
|
1086
1089
|
else {
|
|
1087
|
-
|
|
1090
|
+
baselayername = Object.keys(basemaps)[0];
|
|
1088
1091
|
}
|
|
1089
|
-
basemaps[baselayername].addTo(map);
|
|
1092
|
+
if (baselayername) { basemaps[baselayername].addTo(map); }
|
|
1090
1093
|
if (showLayerMenu) {
|
|
1091
1094
|
map.removeControl(layercontrol);
|
|
1092
1095
|
layercontrol = L.control.layers(basemaps, overlays).addTo(map);
|
|
@@ -2333,9 +2336,38 @@ function setMarker(data) {
|
|
|
2333
2336
|
if (p === true) { marker.openPopup(); }
|
|
2334
2337
|
}
|
|
2335
2338
|
|
|
2339
|
+
var custIco = function() {
|
|
2340
|
+
var col = cmd.map.iconColor ?? "#910000";
|
|
2341
|
+
var myMarker = L.VectorMarkers.icon({
|
|
2342
|
+
icon: "circle",
|
|
2343
|
+
markerColor: col,
|
|
2344
|
+
prefix: 'fa',
|
|
2345
|
+
iconColor: 'white'
|
|
2346
|
+
});
|
|
2347
|
+
if (cmd.map.hasOwnProperty("icon")) {
|
|
2348
|
+
myMarker = L.divIcon({
|
|
2349
|
+
className:"faicon",
|
|
2350
|
+
html: '<center><i class="fa fa-fw '+cmd.map.icon+'" style="color:'+col+'"></i></center>',
|
|
2351
|
+
iconSize: [16, 16],
|
|
2352
|
+
});
|
|
2353
|
+
}
|
|
2354
|
+
var customLayer = L.geoJson(null, {
|
|
2355
|
+
pointToLayer: function(geoJsonPoint, latlng) {
|
|
2356
|
+
//console.log("KML/GPX point",geoJsonPoint)
|
|
2357
|
+
var d = (geoJsonPoint.properties.description || "").trim();
|
|
2358
|
+
var mypop = '<b>'+geoJsonPoint.properties.name + '</b><br>'+d+'<br>lat,lon : ' + geoJsonPoint.geometry.coordinates[1] + ', ' + geoJsonPoint.geometry.coordinates[0];
|
|
2359
|
+
if (geoJsonPoint.geometry.coordinates[2]) {
|
|
2360
|
+
mypop = '<b>'+geoJsonPoint.properties.name + '</b><br>'+d+'<br>lat,lon.alt : ' + geoJsonPoint.geometry.coordinates[1] + ', ' + geoJsonPoint.geometry.coordinates[0] + ', ' + geoJsonPoint.geometry.coordinates[2];
|
|
2361
|
+
}
|
|
2362
|
+
return L.marker(latlng, {icon:myMarker, title:geoJsonPoint.properties.name}).bindPopup(mypop);
|
|
2363
|
+
}
|
|
2364
|
+
});
|
|
2365
|
+
return customLayer;
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2336
2368
|
// handle any incoming COMMANDS to control the map remotely
|
|
2337
2369
|
function doCommand(cmd) {
|
|
2338
|
-
//console.log("COMMAND",cmd);
|
|
2370
|
+
// console.log("COMMAND",cmd);
|
|
2339
2371
|
if (cmd.init && cmd.hasOwnProperty("maplist")) {
|
|
2340
2372
|
//basemaps = {};
|
|
2341
2373
|
addBaseMaps(cmd.maplist,cmd.layer);
|
|
@@ -2535,6 +2567,31 @@ function doCommand(cmd) {
|
|
|
2535
2567
|
basemaps[baselayername].addTo(map);
|
|
2536
2568
|
}
|
|
2537
2569
|
}
|
|
2570
|
+
// Add a new PMtiles/PBF feature layer
|
|
2571
|
+
if (cmd.map && cmd.map.hasOwnProperty("name") && cmd.map.hasOwnProperty("pmtiles") ) {
|
|
2572
|
+
try {
|
|
2573
|
+
if (basemaps.hasOwnProperty(cmd.map.name)) {
|
|
2574
|
+
basemaps[cmd.map.name].removeFrom(map);
|
|
2575
|
+
existsalready = true;
|
|
2576
|
+
}
|
|
2577
|
+
var opt = {};
|
|
2578
|
+
if (cmd.map.hasOwnProperty("opt")) { opt = cmd.map.opt; }
|
|
2579
|
+
opt.url = cmd.map.pmtiles;
|
|
2580
|
+
opt.attribution = opt.attribution || '© Protomaps';
|
|
2581
|
+
opt.maxDataZoom = opt.maxDataZoom || 15;
|
|
2582
|
+
opt.maxZoom = opt.maxZoom || 20;
|
|
2583
|
+
console.log("New PMtiles:",cmd.map.name,opt);
|
|
2584
|
+
basemaps[cmd.map.name] = protomapsL.leafletLayer(opt);
|
|
2585
|
+
if (!existsalready) {
|
|
2586
|
+
layercontrol.addBaseLayer(basemaps[cmd.map.name],cmd.map.name);
|
|
2587
|
+
}
|
|
2588
|
+
if (Object.keys(basemaps).length === 1) {
|
|
2589
|
+
baselayername = cmd.map.name;
|
|
2590
|
+
basemaps[baselayername].addTo(map);
|
|
2591
|
+
}
|
|
2592
|
+
if (pmtloaded === "") { pmtloaded = cmd.map.name; }
|
|
2593
|
+
} catch(e) { console.log(e); }
|
|
2594
|
+
}
|
|
2538
2595
|
// Add or swap new minimap layer
|
|
2539
2596
|
if (cmd.map && cmd.map.hasOwnProperty("minimap")) {
|
|
2540
2597
|
if (minimap) { map.removeControl(minimap); }
|
|
@@ -2696,36 +2753,6 @@ function doCommand(cmd) {
|
|
|
2696
2753
|
if (cmd.map.hasOwnProperty("fly") && cmd.map.fly === true) { map.flyToBounds(overlays[cmd.map.overlay].getBounds()); }
|
|
2697
2754
|
else if (cmd.map.hasOwnProperty("fit") && cmd.map.fit === true) { map.fitBounds(overlays[cmd.map.overlay].getBounds()); }
|
|
2698
2755
|
}
|
|
2699
|
-
|
|
2700
|
-
var custIco = function() {
|
|
2701
|
-
var col = cmd.map.iconColor ?? "#910000";
|
|
2702
|
-
var myMarker = L.VectorMarkers.icon({
|
|
2703
|
-
icon: "circle",
|
|
2704
|
-
markerColor: col,
|
|
2705
|
-
prefix: 'fa',
|
|
2706
|
-
iconColor: 'white'
|
|
2707
|
-
});
|
|
2708
|
-
if (cmd.map.hasOwnProperty("icon")) {
|
|
2709
|
-
myMarker = L.divIcon({
|
|
2710
|
-
className:"faicon",
|
|
2711
|
-
html: '<center><i class="fa fa-fw '+cmd.map.icon+'" style="color:'+col+'"></i></center>',
|
|
2712
|
-
iconSize: [16, 16],
|
|
2713
|
-
});
|
|
2714
|
-
}
|
|
2715
|
-
var customLayer = L.geoJson(null, {
|
|
2716
|
-
pointToLayer: function(geoJsonPoint, latlng) {
|
|
2717
|
-
//console.log("KML/GPX point",geoJsonPoint)
|
|
2718
|
-
var d = (geoJsonPoint.properties.description || "").trim();
|
|
2719
|
-
var mypop = '<b>'+geoJsonPoint.properties.name + '</b><br>'+d+'<br>lat,lon : ' + geoJsonPoint.geometry.coordinates[1] + ', ' + geoJsonPoint.geometry.coordinates[0];
|
|
2720
|
-
if (geoJsonPoint.geometry.coordinates[2]) {
|
|
2721
|
-
mypop = '<b>'+geoJsonPoint.properties.name + '</b><br>'+d+'<br>lat,lon.alt : ' + geoJsonPoint.geometry.coordinates[1] + ', ' + geoJsonPoint.geometry.coordinates[0] + ', ' + geoJsonPoint.geometry.coordinates[2];
|
|
2722
|
-
}
|
|
2723
|
-
return L.marker(latlng, {icon:myMarker, title:geoJsonPoint.properties.name}).bindPopup(mypop);
|
|
2724
|
-
}
|
|
2725
|
-
});
|
|
2726
|
-
return customLayer;
|
|
2727
|
-
}
|
|
2728
|
-
|
|
2729
2756
|
// Add a new KMZ overlay layer (or KML)
|
|
2730
2757
|
//if (cmd.map && cmd.map.hasOwnProperty("overlay") && cmd.map.hasOwnProperty("kmz")) {
|
|
2731
2758
|
if (cmd.map && cmd.map.hasOwnProperty("overlay") && ( cmd.map.hasOwnProperty("kmz") || cmd.map.hasOwnProperty("kml")) ) {
|
|
@@ -2813,7 +2840,7 @@ function doCommand(cmd) {
|
|
|
2813
2840
|
// var gp = new DOMParser().parseFromString(cmd.map.gpx, "text/xml");
|
|
2814
2841
|
// var json = window.toGeoJSON.gpx(gp);
|
|
2815
2842
|
// console.log("j",json)
|
|
2816
|
-
// doGeojson(json.features[0].properties.name,json,json.features[0].properties.type) //
|
|
2843
|
+
// doGeojson(json.features[0].properties.name,json,json.features[0].properties.type) // name,geojson,layer,options
|
|
2817
2844
|
overlays[cmd.map.overlay] = omnivore.gpx.parse(cmd.map.gpx, null, custIco());
|
|
2818
2845
|
if (!existsalready) {
|
|
2819
2846
|
layercontrol.addOverlay(overlays[cmd.map.overlay],cmd.map.overlay);
|
|
@@ -2939,6 +2966,7 @@ function doCommand(cmd) {
|
|
|
2939
2966
|
else { lockit = false; doLock(false); }
|
|
2940
2967
|
document.getElementById("lockit").checked = lockit;
|
|
2941
2968
|
}
|
|
2969
|
+
// if (cmd.hasOwnProperty("panlock") && lockit === true) { doLock(true); }
|
|
2942
2970
|
// Move to a new position
|
|
2943
2971
|
var clat = map.getCenter().lat;
|
|
2944
2972
|
var clon = map.getCenter().lng;
|
|
@@ -2962,6 +2990,7 @@ function doCommand(cmd) {
|
|
|
2962
2990
|
document.getElementById("setclus").value = cmd.cluster;
|
|
2963
2991
|
setCluster(clusterAt);
|
|
2964
2992
|
}
|
|
2993
|
+
// Set max age of markers
|
|
2965
2994
|
if (cmd.hasOwnProperty("maxage")) {
|
|
2966
2995
|
document.getElementById("maxage").value = cmd.maxage;
|
|
2967
2996
|
setMaxAge();
|
|
@@ -2974,7 +3003,7 @@ function doCommand(cmd) {
|
|
|
2974
3003
|
// document.getElementById("heatall").checked = !!cmd.heatmap;
|
|
2975
3004
|
// heat.redraw();
|
|
2976
3005
|
}
|
|
2977
|
-
|
|
3006
|
+
// Lock zoom controls
|
|
2978
3007
|
if (cmd.hasOwnProperty("zoomlock")) {
|
|
2979
3008
|
if (cmd.zoomlock == "true" || cmd.zoomlock == true) {
|
|
2980
3009
|
if (map.doubleClickZoom.enabled()) { map.removeControl(map.zoomControl); }
|
|
@@ -2989,7 +3018,8 @@ function doCommand(cmd) {
|
|
|
2989
3018
|
map.touchZoom.enable();
|
|
2990
3019
|
}
|
|
2991
3020
|
}
|
|
2992
|
-
|
|
3021
|
+
// Move/Zoom map to new bounds
|
|
3022
|
+
if (cmd.hasOwnProperty("bounds")) {
|
|
2993
3023
|
if (cmd.bounds.length === 2 && cmd.bounds[0].length === 2 && cmd.bounds[1].length === 2) {
|
|
2994
3024
|
if (cmd.hasOwnProperty("fly") && cmd.fly === true) {
|
|
2995
3025
|
map.flyToBounds(cmd.bounds);
|
package/worldmap.js
CHANGED
|
@@ -13,6 +13,7 @@ module.exports = function(RED) {
|
|
|
13
13
|
if (fs.existsSync((__dirname + '/mapserv'))) {
|
|
14
14
|
RED.httpNode.use("/cgi-bin/mapserv", require('cgi')(__dirname + '/mapserv'));
|
|
15
15
|
}
|
|
16
|
+
var pmtiles = fs.readdirSync(__dirname + '/worldmap').filter(fn => fn.endsWith('.pmtiles'));
|
|
16
17
|
|
|
17
18
|
function worldMap(node, n) {
|
|
18
19
|
var allPoints = {};
|
|
@@ -119,6 +120,9 @@ module.exports = function(RED) {
|
|
|
119
120
|
if (node.name) { c.toptitle = node.name; }
|
|
120
121
|
//console.log("INIT",c)
|
|
121
122
|
client.write(JSON.stringify({command:c}));
|
|
123
|
+
for (var p=0; p<pmtiles.length; p++) {
|
|
124
|
+
client.write(JSON.stringify({command: {map: {name:pmtiles[p].split('.')[0], pmtiles:pmtiles[p] }}}));
|
|
125
|
+
}
|
|
122
126
|
var o = Object.values(allPoints);
|
|
123
127
|
o.map(v => delete v.tout);
|
|
124
128
|
setTimeout(function() { client.write(JSON.stringify(o)) }, 250);
|
|
@@ -126,7 +130,7 @@ module.exports = function(RED) {
|
|
|
126
130
|
if (message.action === "draw") {
|
|
127
131
|
delete message.action;
|
|
128
132
|
delete message.type;
|
|
129
|
-
delete message.options
|
|
133
|
+
if (message.options) { delete message.options.pane; }
|
|
130
134
|
allPoints[message.name] = RED.util.cloneMessage(message);
|
|
131
135
|
sendToRest(message,client.id);
|
|
132
136
|
}
|