tileserver-gl-light 4.10.3 → 4.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.husky/commit-msg +0 -3
- package/.husky/pre-push +0 -3
- package/docs/endpoints.rst +1 -1
- package/package.json +6 -6
- package/public/resources/maplibre-gl-inspect.css +39 -39
- package/public/resources/maplibre-gl-inspect.js +2857 -0
- package/public/resources/maplibre-gl-inspect.js.map +1 -0
- package/public/resources/maplibre-gl.css +1 -1
- package/public/resources/maplibre-gl.js +33 -22
- package/public/resources/maplibre-gl.js.map +1 -1
- package/public/templates/data.tmpl +1 -2
- package/public/templates/viewer.tmpl +1 -2
- package/src/serve_rendered.js +21 -10
- package/src/serve_style.js +78 -50
- package/src/utils.js +40 -1
- package/test/style.js +10 -0
- package/public/resources/maplibre-gl-inspect.min.js +0 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="stylesheet" type="text/css" href="{{public_url}}maplibre-gl.css{{&key_query}}" />
|
|
9
9
|
<link rel="stylesheet" type="text/css" href="{{public_url}}maplibre-gl-inspect.css{{&key_query}}" />
|
|
10
10
|
<script src="{{public_url}}maplibre-gl.js{{&key_query}}"></script>
|
|
11
|
-
<script src="{{public_url}}maplibre-gl-inspect.
|
|
11
|
+
<script src="{{public_url}}maplibre-gl-inspect.js{{&key_query}}"></script>
|
|
12
12
|
<style>
|
|
13
13
|
body {background:#fff;color:#333;font-family:Arial, sans-serif;}
|
|
14
14
|
#map {position:absolute;top:0;left:0;right:250px;bottom:0;}
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
var map = new maplibregl.Map({
|
|
53
53
|
container: 'map',
|
|
54
54
|
hash: true,
|
|
55
|
-
maplibreLogo: true,
|
|
56
55
|
maxPitch: 85,
|
|
57
56
|
style: {
|
|
58
57
|
version: 8,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="stylesheet" type="text/css" href="{{public_url}}maplibre-gl-inspect.css{{&key_query}}" />
|
|
9
9
|
<link rel="stylesheet" type="text/css" href="{{public_url}}leaflet.css{{&key_query}}" />
|
|
10
10
|
<script src="{{public_url}}maplibre-gl.js{{&key_query}}"></script>
|
|
11
|
-
<script src="{{public_url}}maplibre-gl-inspect.
|
|
11
|
+
<script src="{{public_url}}maplibre-gl-inspect.js{{&key_query}}"></script>
|
|
12
12
|
<script src="{{public_url}}leaflet.js{{&key_query}}"></script>
|
|
13
13
|
<script src="{{public_url}}leaflet-hash.js{{&key_query}}"></script>
|
|
14
14
|
<style>
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
container: 'map',
|
|
64
64
|
style: '{{public_url}}styles/{{id}}/style.json' + keyParam,
|
|
65
65
|
hash: true,
|
|
66
|
-
maplibreLogo: true,
|
|
67
66
|
maxPitch: 85
|
|
68
67
|
});
|
|
69
68
|
map.addControl(new maplibregl.NavigationControl({
|
package/src/serve_rendered.js
CHANGED
|
@@ -46,7 +46,7 @@ import { renderOverlay, renderWatermark, renderAttribution } from './render.js';
|
|
|
46
46
|
const FLOAT_PATTERN = '[+-]?(?:\\d+|\\d+.?\\d+)';
|
|
47
47
|
const PATH_PATTERN =
|
|
48
48
|
/^((fill|stroke|width)\:[^\|]+\|)*(enc:.+|-?\d+(\.\d*)?,-?\d+(\.\d*)?(\|-?\d+(\.\d*)?,-?\d+(\.\d*)?)+)/;
|
|
49
|
-
const httpTester = /^
|
|
49
|
+
const httpTester = /^https?:\/\//i;
|
|
50
50
|
|
|
51
51
|
const mercator = new SphericalMercator();
|
|
52
52
|
const getScale = (scale) => (scale || '@1x').slice(1, 2) | 0;
|
|
@@ -1045,16 +1045,27 @@ export const serve_rendered = {
|
|
|
1045
1045
|
return false;
|
|
1046
1046
|
}
|
|
1047
1047
|
|
|
1048
|
-
if (styleJSON.sprite
|
|
1049
|
-
styleJSON.sprite
|
|
1050
|
-
'
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1048
|
+
if (styleJSON.sprite) {
|
|
1049
|
+
if (!Array.isArray(styleJSON.sprite)) {
|
|
1050
|
+
styleJSON.sprite = [{ id: 'default', url: styleJSON.sprite }];
|
|
1051
|
+
}
|
|
1052
|
+
styleJSON.sprite.forEach((spriteItem) => {
|
|
1053
|
+
if (!httpTester.test(spriteItem.url)) {
|
|
1054
|
+
spriteItem.url =
|
|
1055
|
+
'sprites://' +
|
|
1056
|
+
spriteItem.url
|
|
1057
|
+
.replace('{style}', path.basename(styleFile, '.json'))
|
|
1058
|
+
.replace(
|
|
1059
|
+
'{styleJsonFolder}',
|
|
1060
|
+
path.relative(
|
|
1061
|
+
options.paths.sprites,
|
|
1062
|
+
path.dirname(styleJSONPath),
|
|
1063
|
+
),
|
|
1064
|
+
);
|
|
1065
|
+
}
|
|
1066
|
+
});
|
|
1057
1067
|
}
|
|
1068
|
+
|
|
1058
1069
|
if (styleJSON.glyphs && !httpTester.test(styleJSON.glyphs)) {
|
|
1059
1070
|
styleJSON.glyphs = `fonts://${styleJSON.glyphs}`;
|
|
1060
1071
|
}
|
package/src/serve_style.js
CHANGED
|
@@ -7,24 +7,11 @@ import clone from 'clone';
|
|
|
7
7
|
import express from 'express';
|
|
8
8
|
import { validateStyleMin } from '@maplibre/maplibre-gl-style-spec';
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
const httpTester = /^
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
if (!url || typeof url !== 'string' || url.indexOf('local://') !== 0) {
|
|
16
|
-
return url;
|
|
17
|
-
}
|
|
18
|
-
const queryParams = [];
|
|
19
|
-
if (req.query.key) {
|
|
20
|
-
queryParams.unshift(`key=${encodeURIComponent(req.query.key)}`);
|
|
21
|
-
}
|
|
22
|
-
let query = '';
|
|
23
|
-
if (queryParams.length) {
|
|
24
|
-
query = `?${queryParams.join('&')}`;
|
|
25
|
-
}
|
|
26
|
-
return url.replace('local://', getPublicUrl(publicUrl, req)) + query;
|
|
27
|
-
};
|
|
10
|
+
import { fixUrl, allowedOptions } from './utils.js';
|
|
11
|
+
|
|
12
|
+
const httpTester = /^https?:\/\//i;
|
|
13
|
+
const allowedSpriteScales = allowedOptions(['', '@2x', '@3x']);
|
|
14
|
+
const allowedSpriteFormats = allowedOptions(['png', 'json']);
|
|
28
15
|
|
|
29
16
|
export const serve_style = {
|
|
30
17
|
init: (options, repo) => {
|
|
@@ -42,7 +29,13 @@ export const serve_style = {
|
|
|
42
29
|
}
|
|
43
30
|
// mapbox-gl-js viewer cannot handle sprite urls with query
|
|
44
31
|
if (styleJSON_.sprite) {
|
|
45
|
-
|
|
32
|
+
if (Array.isArray(styleJSON_.sprite)) {
|
|
33
|
+
styleJSON_.sprite.forEach((spriteItem) => {
|
|
34
|
+
spriteItem.url = fixUrl(req, spriteItem.url, item.publicUrl);
|
|
35
|
+
});
|
|
36
|
+
} else {
|
|
37
|
+
styleJSON_.sprite = fixUrl(req, styleJSON_.sprite, item.publicUrl);
|
|
38
|
+
}
|
|
46
39
|
}
|
|
47
40
|
if (styleJSON_.glyphs) {
|
|
48
41
|
styleJSON_.glyphs = fixUrl(req, styleJSON_.glyphs, item.publicUrl);
|
|
@@ -50,25 +43,39 @@ export const serve_style = {
|
|
|
50
43
|
return res.send(styleJSON_);
|
|
51
44
|
});
|
|
52
45
|
|
|
53
|
-
app.get(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
46
|
+
app.get(
|
|
47
|
+
'/:id/sprite(/:spriteID)?:scale(@[23]x)?.:format([\\w]+)',
|
|
48
|
+
(req, res, next) => {
|
|
49
|
+
const { spriteID = 'default', id } = req.params;
|
|
50
|
+
const scale = allowedSpriteScales(req.params.scale) || '';
|
|
51
|
+
const format = allowedSpriteFormats(req.params.format);
|
|
52
|
+
|
|
53
|
+
if (format) {
|
|
54
|
+
const item = repo[id];
|
|
55
|
+
const sprite = item.spritePaths.find(
|
|
56
|
+
(sprite) => sprite.id === spriteID,
|
|
57
|
+
);
|
|
58
|
+
if (sprite) {
|
|
59
|
+
const filename = `${sprite.path + scale}.${format}`;
|
|
60
|
+
return fs.readFile(filename, (err, data) => {
|
|
61
|
+
if (err) {
|
|
62
|
+
console.log('Sprite load error:', filename);
|
|
63
|
+
return res.sendStatus(404);
|
|
64
|
+
} else {
|
|
65
|
+
if (format === 'json')
|
|
66
|
+
res.header('Content-type', 'application/json');
|
|
67
|
+
if (format === 'png') res.header('Content-type', 'image/png');
|
|
68
|
+
return res.send(data);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
} else {
|
|
72
|
+
return res.status(400).send('Bad Sprite ID or Scale');
|
|
73
|
+
}
|
|
65
74
|
} else {
|
|
66
|
-
|
|
67
|
-
if (format === 'png') res.header('Content-type', 'image/png');
|
|
68
|
-
return res.send(data);
|
|
75
|
+
return res.status(400).send('Bad Sprite Format');
|
|
69
76
|
}
|
|
70
|
-
}
|
|
71
|
-
|
|
77
|
+
},
|
|
78
|
+
);
|
|
72
79
|
|
|
73
80
|
return app;
|
|
74
81
|
},
|
|
@@ -135,27 +142,48 @@ export const serve_style = {
|
|
|
135
142
|
}
|
|
136
143
|
}
|
|
137
144
|
|
|
138
|
-
let
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
let spritePaths = [];
|
|
146
|
+
if (styleJSON.sprite) {
|
|
147
|
+
if (!Array.isArray(styleJSON.sprite)) {
|
|
148
|
+
if (!httpTester.test(styleJSON.sprite)) {
|
|
149
|
+
let spritePath = path.join(
|
|
150
|
+
options.paths.sprites,
|
|
151
|
+
styleJSON.sprite
|
|
152
|
+
.replace('{style}', path.basename(styleFile, '.json'))
|
|
153
|
+
.replace(
|
|
154
|
+
'{styleJsonFolder}',
|
|
155
|
+
path.relative(options.paths.sprites, path.dirname(styleFile)),
|
|
156
|
+
),
|
|
157
|
+
);
|
|
158
|
+
styleJSON.sprite = `local://styles/${id}/sprite`;
|
|
159
|
+
spritePaths.push({ id: 'default', path: spritePath });
|
|
160
|
+
}
|
|
161
|
+
} else {
|
|
162
|
+
for (let spriteItem of styleJSON.sprite) {
|
|
163
|
+
if (!httpTester.test(spriteItem.url)) {
|
|
164
|
+
let spritePath = path.join(
|
|
165
|
+
options.paths.sprites,
|
|
166
|
+
spriteItem.url
|
|
167
|
+
.replace('{style}', path.basename(styleFile, '.json'))
|
|
168
|
+
.replace(
|
|
169
|
+
'{styleJsonFolder}',
|
|
170
|
+
path.relative(options.paths.sprites, path.dirname(styleFile)),
|
|
171
|
+
),
|
|
172
|
+
);
|
|
173
|
+
spriteItem.url = `local://styles/${id}/sprite/` + spriteItem.id;
|
|
174
|
+
spritePaths.push({ id: spriteItem.id, path: spritePath });
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
151
178
|
}
|
|
179
|
+
|
|
152
180
|
if (styleJSON.glyphs && !httpTester.test(styleJSON.glyphs)) {
|
|
153
181
|
styleJSON.glyphs = 'local://fonts/{fontstack}/{range}.pbf';
|
|
154
182
|
}
|
|
155
183
|
|
|
156
184
|
repo[id] = {
|
|
157
185
|
styleJSON,
|
|
158
|
-
|
|
186
|
+
spritePaths,
|
|
159
187
|
publicUrl,
|
|
160
188
|
name: styleJSON.name,
|
|
161
189
|
};
|
package/src/utils.js
CHANGED
|
@@ -6,6 +6,38 @@ import fs, { existsSync } from 'node:fs';
|
|
|
6
6
|
import clone from 'clone';
|
|
7
7
|
import glyphCompose from '@mapbox/glyph-pbf-composite';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Restrict user input to an allowed set of options.
|
|
11
|
+
* @param opts
|
|
12
|
+
* @param root0
|
|
13
|
+
* @param root0.defaultValue
|
|
14
|
+
*/
|
|
15
|
+
export function allowedOptions(opts, { defaultValue } = {}) {
|
|
16
|
+
const values = Object.fromEntries(opts.map((key) => [key, key]));
|
|
17
|
+
return (value) => values[value] || defaultValue;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Replace local:// urls with public http(s):// urls
|
|
22
|
+
* @param req
|
|
23
|
+
* @param url
|
|
24
|
+
* @param publicUrl
|
|
25
|
+
*/
|
|
26
|
+
export function fixUrl(req, url, publicUrl) {
|
|
27
|
+
if (!url || typeof url !== 'string' || url.indexOf('local://') !== 0) {
|
|
28
|
+
return url;
|
|
29
|
+
}
|
|
30
|
+
const queryParams = [];
|
|
31
|
+
if (req.query.key) {
|
|
32
|
+
queryParams.unshift(`key=${encodeURIComponent(req.query.key)}`);
|
|
33
|
+
}
|
|
34
|
+
let query = '';
|
|
35
|
+
if (queryParams.length) {
|
|
36
|
+
query = `?${queryParams.join('&')}`;
|
|
37
|
+
}
|
|
38
|
+
return url.replace('local://', getPublicUrl(publicUrl, req)) + query;
|
|
39
|
+
}
|
|
40
|
+
|
|
9
41
|
/**
|
|
10
42
|
* Generate new URL object
|
|
11
43
|
* @param req
|
|
@@ -16,6 +48,12 @@ const getUrlObject = (req) => {
|
|
|
16
48
|
const urlObject = new URL(`${req.protocol}://${req.headers.host}/`);
|
|
17
49
|
// support overriding hostname by sending X-Forwarded-Host http header
|
|
18
50
|
urlObject.hostname = req.hostname;
|
|
51
|
+
|
|
52
|
+
// support add url prefix by sending X-Forwarded-Path http header
|
|
53
|
+
const xForwardedPath = req.get('X-Forwarded-Path');
|
|
54
|
+
if (xForwardedPath) {
|
|
55
|
+
urlObject.pathname = path.posix.join(xForwardedPath, urlObject.pathname);
|
|
56
|
+
}
|
|
19
57
|
return urlObject;
|
|
20
58
|
};
|
|
21
59
|
|
|
@@ -82,9 +120,10 @@ export const getTileUrls = (
|
|
|
82
120
|
|
|
83
121
|
const uris = [];
|
|
84
122
|
if (!publicUrl) {
|
|
123
|
+
let xForwardedPath = `${req.get('X-Forwarded-Path') ? '/' + req.get('X-Forwarded-Path') : ''}`;
|
|
85
124
|
for (const domain of domains) {
|
|
86
125
|
uris.push(
|
|
87
|
-
`${req.protocol}://${domain}/${path}/${tileParams}.${format}${query}`,
|
|
126
|
+
`${req.protocol}://${domain}${xForwardedPath}/${path}/${tileParams}.${format}${query}`,
|
|
88
127
|
);
|
|
89
128
|
}
|
|
90
129
|
} else {
|
package/test/style.js
CHANGED
|
@@ -41,6 +41,16 @@ describe('Styles', function () {
|
|
|
41
41
|
testIs('/styles/' + prefix + '/sprite.png', /image\/png/);
|
|
42
42
|
testIs('/styles/' + prefix + '/sprite@2x.png', /image\/png/);
|
|
43
43
|
});
|
|
44
|
+
|
|
45
|
+
describe('/styles/' + prefix + '/sprite/default[@2x].{format}', function () {
|
|
46
|
+
testIs('/styles/' + prefix + '/sprite/default.json', /application\/json/);
|
|
47
|
+
testIs(
|
|
48
|
+
'/styles/' + prefix + '/sprite/default@2x.json',
|
|
49
|
+
/application\/json/,
|
|
50
|
+
);
|
|
51
|
+
testIs('/styles/' + prefix + '/sprite/default.png', /image\/png/);
|
|
52
|
+
testIs('/styles/' + prefix + '/sprite/default@2x.png', /image\/png/);
|
|
53
|
+
});
|
|
44
54
|
});
|
|
45
55
|
|
|
46
56
|
describe('Fonts', function () {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).MaplibreInspect=t()}(function(){return function r(o,i,s){function a(e,t){if(!i[e]){if(!o[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(c)return c(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}n=i[e]={exports:{}},o[e][0].call(n.exports,function(t){return a(o[e][1][t]||t)},n,n.exports,r,o,i,s)}return i[e].exports}for(var c="function"==typeof require&&require,t=0;t<s.length;t++)a(s[t]);return a}({1:[function(t,e,n){t=t("./lib/MaplibreInspect");e.exports=t},{"./lib/MaplibreInspect":3}],2:[function(t,e,n){function r(t){var e,n;t=Object.assign({show:!0,onToggle(){}},t),this._btn=((e=document.createElement("button")).className="maplibregl-ctrl-icon maplibregl-ctrl-inspect",e.type="button",e["aria-label"]="Inspect",e),this._btn.onclick=t.onToggle,this.elem=(e=this._btn,t=t.show,(n=document.createElement("div")).className="maplibregl-ctrl maplibregl-ctrl-group",n.appendChild(e),t||(n.style.display="none"),n)}r.prototype.setInspectIcon=function(){this._btn.className="maplibregl-ctrl-icon maplibregl-ctrl-inspect"},r.prototype.setMapIcon=function(){this._btn.className="maplibregl-ctrl-icon maplibregl-ctrl-map"},e.exports=r},{}],3:[function(t,e,n){const r=t("./stylegen"),o=t("./InspectButton"),i=t("lodash.isequal"),s=t("./renderPopup"),a=t("./colors");function c(t){if(!(this instanceof c))throw new Error("MaplibreInspect needs to be called with the new keyword");let e=null;window.maplibregl?e=new window.maplibregl.Popup({closeButton:!1,closeOnClick:!1}):t.popup||console.error("Maplibre GL JS can not be found. Make sure to include it or pass an initialized MaplibreGL Popup to MaplibreInspect if you are using moduleis."),this.options=Object.assign({showInspectMap:!1,showInspectButton:!0,showInspectMapPopup:!0,showMapPopup:!1,showMapPopupOnHover:!0,showInspectMapPopupOnHover:!0,blockHoverPopupOnClick:!1,backgroundColor:"#fff",assignLayerColor:a.brightColor,buildInspectStyle:r.generateInspectStyle,renderPopup:s,popup:e,selectThreshold:5,useInspectStyle:!0,queryParameters:{},sources:{},toggleCallback(){}},t),this.sources=this.options.sources,this.assignLayerColor=this.options.assignLayerColor,this.toggleInspector=this.toggleInspector.bind(this),this._popup=this.options.popup,this._popupBlocked=!1,this._showInspectMap=this.options.showInspectMap,this._onSourceChange=this._onSourceChange.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onRightClick=this._onRightClick.bind(this),this._onStyleChange=this._onStyleChange.bind(this),this._originalStyle=null,this._toggle=new o({show:this.options.showInspectButton,onToggle:this.toggleInspector.bind(this)})}c.prototype.toggleInspector=function(){this._showInspectMap=!this._showInspectMap,this.options.toggleCallback(this._showInspectMap),this.render()},c.prototype._inspectStyle=function(){var t=r.generateColoredLayers(this.sources,this.assignLayerColor);return this.options.buildInspectStyle(this._map.getStyle(),t,{backgroundColor:this.options.backgroundColor})},c.prototype.render=function(){var t;this._showInspectMap?(this.options.useInspectStyle&&this._map.setStyle((t=this._inspectStyle(),Object.assign(t,{metadata:Object.assign({},t.metadata,{"maplibregl-inspect:inspect":!0})}))),this._toggle.setMapIcon()):this._originalStyle&&(this._popup&&this._popup.remove(),this.options.useInspectStyle&&this._map.setStyle(this._originalStyle),this._toggle.setInspectIcon())},c.prototype._onSourceChange=function(t){const r=this.sources,o=this._map;var e=o.getStyle();const n=Object.keys(e.sources);e=Object.assign({},r);"visibility"!==t.sourceDataType&&t.isSourceLoaded&&(Object.keys(o.style.sourceCaches).forEach(t=>{var e=o.style.sourceCaches[t]||{_source:{}},n=e._source.vectorLayerIds;n?r[t]=n:"geojson"===e._source.type&&(r[t]=[])}),Object.keys(r).forEach(t=>{-1===n.indexOf(t)&&delete r[t]}),!i(e,r))&&0<Object.keys(r).length&&this.render()},c.prototype._onStyleChange=function(){var t,e=this._map.getStyle();(t=e).metadata&&t.metadata["maplibregl-inspect:inspect"]||(this._originalStyle=e)},c.prototype._onRightClick=function(){this.options.showMapPopupOnHover||this.options.showInspectMapPopupOnHover||this.options.blockHoverPopupOnClick||this._popup&&this._popup.remove()},c.prototype._onMousemove=function(e){if(this._showInspectMap){if(!this.options.showInspectMapPopup)return;if("mousemove"===e.type&&!this.options.showInspectMapPopupOnHover)return;"click"===e.type&&this.options.showInspectMapPopupOnHover&&this.options.blockHoverPopupOnClick&&(this._popupBlocked=!this._popupBlocked)}else{if(!this.options.showMapPopup)return;if("mousemove"===e.type&&!this.options.showMapPopupOnHover)return;"click"===e.type&&this.options.showMapPopupOnHover&&this.options.blockHoverPopupOnClick&&(this._popupBlocked=!this._popupBlocked)}if(!this._popupBlocked&&this._popup){let t;t=0===this.options.selectThreshold?e.point:[[e.point.x-this.options.selectThreshold,e.point.y+this.options.selectThreshold],[e.point.x+this.options.selectThreshold,e.point.y-this.options.selectThreshold]];var n=this._map.queryRenderedFeatures(t,this.options.queryParameters)||[];this._map.getCanvas().style.cursor=n.length?"pointer":"",n.length?(this._popup.setLngLat(e.lngLat),"string"==typeof(e=this.options.renderPopup(n))?this._popup.setHTML(e):this._popup.setDOMContent(e),this._popup.addTo(this._map)):this._popup.remove()}},c.prototype.onAdd=function(t){return this._map=t,0===Object.keys(this.sources).length&&(t.on("tiledata",this._onSourceChange),t.on("sourcedata",this._onSourceChange)),t.on("styledata",this._onStyleChange),t.on("load",this._onStyleChange),t.on("mousemove",this._onMousemove),t.on("click",this._onMousemove),t.on("contextmenu",this._onRightClick),this._toggle.elem},c.prototype.onRemove=function(){this._map.off("styledata",this._onStyleChange),this._map.off("load",this._onStyleChange),this._map.off("tiledata",this._onSourceChange),this._map.off("sourcedata",this._onSourceChange),this._map.off("mousemove",this._onMousemove),this._map.off("click",this._onMousemove),this._map.off("contextmenu",this._onRightClick);var t=this._toggle.elem;t.parentNode.removeChild(t),this._map=void 0},e.exports=c},{"./InspectButton":2,"./colors":4,"./renderPopup":5,"./stylegen":6,"lodash.isequal":7}],4:[function(t,e,n){const o=t("randomcolor");n.brightColor=function(t,e){let n="bright",r=null;return/water|ocean|lake|sea|river/.test(t)&&(r="blue"),/state|country|place/.test(t)&&(r="pink"),/road|highway|transport|streets/.test(t)&&(r="orange"),/contour|building|earth/.test(t)&&(r="monochrome"),/building/.test(t)&&(n="dark"),/earth/.test(t)&&(n="light"),/contour|landuse/.test(t)&&(r="yellow"),/wood|forest|park|landcover|land|natural/.test(t)&&(r="green"),`rgba(${o({luminosity:n,hue:r,seed:t,format:"rgbArray"}).concat([e||1]).join(", ")})`}},{randomcolor:8}],5:[function(t,e,n){function o(t,e){return`<div class="maplibregl-inspect_property"><div class="maplibregl-inspect_property-name">${t}</div>`+`<div class="maplibregl-inspect_property-value">${t=e,null==t?t:t instanceof Date?t.toLocaleString():"object"==typeof t||"number"==typeof t||"string"==typeof t?t.toString():t}</div>`+"</div>"}function r(t){return t.map(t=>{return`<div class="maplibregl-inspect_feature">${e=t,t=`<div class="maplibregl-inspect_layer">${e.layer["source-layer"]||e.layer.source}</div>`,n=o("$type",e.geometry.type),r=Object.keys(e.properties).map(t=>o(t,e.properties[t])),[t,n].concat(r).join("")}</div>`;var e,n,r}).join("")}e.exports=function(t){return`<div class="maplibregl-inspect_popup">${r(t)}</div>`}},{}],6:[function(t,e,n){function a(t,e,n){e={id:[e,n,"circle"].join("_"),source:e,type:"circle",paint:{"circle-color":t,"circle-radius":2},filter:["==","$type","Point"]};return n&&(e["source-layer"]=n),e}function c(t,e,n,r){n={id:[n,r,"polygon"].join("_"),source:n,type:"fill",paint:{"fill-color":t,"fill-antialias":!0,"fill-outline-color":t},filter:["==","$type","Polygon"]};return r&&(n["source-layer"]=r),n}function u(t,e,n){e={id:[e,n,"line"].join("_"),source:e,layout:{"line-join":"round","line-cap":"round"},type:"line",paint:{"line-color":t},filter:["==","$type","LineString"]};return n&&(e["source-layer"]=n),e}n.polygonLayer=c,n.lineLayer=u,n.circleLayer=a,n.generateInspectStyle=function(n,t,e){e={id:"background",type:"background",paint:{"background-color":(e=Object.assign({backgroundColor:"#fff"},e)).backgroundColor}};const r={};return Object.keys(n.sources).forEach(t=>{var e=n.sources[t];"vector"!==e.type&&"geojson"!==e.type||(r[t]=e)}),Object.assign(n,{layers:[e].concat(t),sources:r})},n.generateColoredLayers=function(e,n){const r=[],o=[],i=[];function s(t){t=n.bind(null,t);return{circle:t(.8),line:t(.6),polygon:t(.3),polygonOutline:t(.6),default:t(1)}}return Object.keys(e).forEach(n=>{var t=e[n];t&&0!==t.length?t.forEach(t=>{var e=s(t);o.push(a(e.circle,n,t)),i.push(u(e.line,n,t)),r.push(c(e.polygon,e.polygonOutline,n,t))}):(t=s(n),o.push(a(t.circle,n)),i.push(u(t.line,n)),r.push(c(t.polygon,t.polygonOutline,n)))}),r.concat(i).concat(o)}},{}],7:[function(t,Bt,Ft){!function($t){!function(){var r="__lodash_hash_undefined__",T=1,J=2,O=9007199254740991,$="[object Arguments]",B="[object Array]",M="[object AsyncFunction]",X="[object Boolean]",K="[object Date]",Q="[object Error]",I="[object Function]",C="[object GeneratorFunction]",F="[object Map]",Y="[object Number]",S="[object Null]",H="[object Object]",A="[object Promise]",P="[object Proxy]",Z="[object RegExp]",N="[object Set]",tt="[object String]",et="[object Symbol]",z="[object Undefined]",n="[object WeakMap]",nt="[object ArrayBuffer]",q="[object DataView]",L=/^\[object .+?Constructor\]$/,x=/^(?:0|[1-9]\d*)$/,e={},t=(e["[object Float32Array]"]=e["[object Float64Array]"]=e["[object Int8Array]"]=e["[object Int16Array]"]=e["[object Int32Array]"]=e["[object Uint8Array]"]=e["[object Uint8ClampedArray]"]=e["[object Uint16Array]"]=e["[object Uint32Array]"]=!0,e[$]=e[B]=e[nt]=e[X]=e[q]=e[K]=e[Q]=e[I]=e[F]=e[Y]=e[H]=e[Z]=e[N]=e[tt]=e[n]=!1,"object"==typeof $t&&$t&&$t.Object===Object&&$t),o="object"==typeof self&&self&&self.Object===Object&&self,o=t||o||Function("return this")(),i="object"==typeof Ft&&Ft&&!Ft.nodeType&&Ft,s=i&&"object"==typeof Bt&&Bt&&!Bt.nodeType&&Bt,s=s&&s.exports===i,a=s&&t.process,i=function(){try{return a&&a.binding&&a.binding("util")}catch(t){}}(),t=i&&i.isTypedArray;function rt(t){var n=-1,r=Array(t.size);return t.forEach(function(t,e){r[++n]=[e,t]}),r}function ot(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var R,E,i=Array.prototype,c=Function.prototype,u=Object.prototype,l=o["__core-js_shared__"],it=c.toString,D=u.hasOwnProperty,st=(c=/[^.]+$/.exec(l&&l.keys&&l.keys.IE_PROTO||""))?"Symbol(src)_1."+c:"",at=u.toString,ct=RegExp("^"+it.call(D).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),l=s?o.Buffer:void 0,c=o.Symbol,ut=o.Uint8Array,lt=u.propertyIsEnumerable,pt=i.splice,p=c?c.toStringTag:void 0,ht=Object.getOwnPropertySymbols,s=l?l.isBuffer:void 0,ft=(R=Object.keys,E=Object,function(t){return R(E(t))}),i=j(o,"DataView"),h=j(o,"Map"),l=j(o,"Promise"),f=j(o,"Set"),o=j(o,"WeakMap"),d=j(Object,"create"),dt=k(i),gt=k(h),yt=k(l),_t=k(f),bt=k(o),c=c?c.prototype:void 0,vt=c?c.valueOf:void 0;function g(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function y(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function _(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function b(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new _;++e<n;)this.add(t[e])}function U(t){t=this.__data__=new y(t);this.size=t.size}function mt(t,e){var n,r,o,i=V(t),s=!i&&At(t),a=!i&&!s&&Pt(t),c=!i&&!s&&!a&&Et(t),u=i||s||a||c,l=u?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],p=l.length;for(n in t)!e&&!D.call(t,n)||u&&("length"==n||a&&("offset"==n||"parent"==n)||c&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||(r=n,(o=null==(o=p)?O:o)&&("number"==typeof r||x.test(r))&&-1<r&&r%1==0&&r<o))||l.push(n);return l}function v(t,e){for(var n=t.length;n--;)if(St(t[n][0],e))return n;return-1}function m(t){if(null==t)return void 0===t?z:S;if(p&&p in Object(t)){var e=t,n=D.call(e,p),r=e[p];try{var o=!(e[p]=void 0)}catch(t){}var i=at.call(e);return o&&(n?e[p]=r:delete e[p]),i}return at.call(t)}function wt(t){return W(t)&&m(t)==$}function jt(t,e,n,r,o){if(t===e)return!0;if(null==t||null==e||!W(t)&&!W(e))return t!=t&&e!=e;var i=jt,s=V(t),a=V(e),c=s?B:G(t),a=a?B:G(e),u=(c=c==$?H:c)==H,l=(a=a==$?H:a)==H;if((a=c==a)&&Pt(t)){if(!Pt(e))return!1;u=!(s=!0)}if(a&&!u){o=o||new U;if(s||Et(t))return Mt(t,e,n,r,i,o);else{var p=t;var h=e;var f=c;var d=n;var g=r;var y=i;var _=o;switch(f){case q:if(p.byteLength!=h.byteLength||p.byteOffset!=h.byteOffset)return!1;p=p.buffer,h=h.buffer;case nt:return p.byteLength==h.byteLength&&y(new ut(p),new ut(h))?!0:!1;case X:case K:case Y:return St(+p,+h);case Q:return p.name==h.name&&p.message==h.message;case Z:case tt:return p==h+"";case F:var b=rt;case N:var v=d&T;if(b=b||ot,p.size!=h.size&&!v)return!1;v=_.get(p);if(v)return v==h;d|=J,_.set(p,h);v=Mt(b(p),b(h),d,g,y,_);return _.delete(p),v;case et:if(vt)return vt.call(p)==vt.call(h)}return!1;return}}if(!(n&T)){var s=u&&D.call(t,"__wrapped__"),c=l&&D.call(e,"__wrapped__");if(s||c)return u=s?t.value():t,l=c?e.value():e,o=o||new U,i(u,l,n,r,o)}if(a){o=o||new U;var m=t,w=e,j=n,k=r,O=i,M=o,I=j&T,C=It(m),S=C.length,s=It(w).length;if(S!=s&&!I)return!1;for(var A=S;A--;){var P=C[A];if(!(I?P in w:D.call(w,P)))return!1}if((s=M.get(m))&&M.get(w))return s==w;for(var z=!0,L=(M.set(m,w),M.set(w,m),I);++A<S;){P=C[A];var x,R=m[P],E=w[P];if(!(void 0===(x=k?I?k(E,R,P,w,m,M):k(R,E,P,m,w,M):x)?R===E||O(R,E,j,k,M):x)){z=!1;break}L=L||"constructor"==P}return z&&!L&&(s=m.constructor,c=w.constructor,s!=c)&&"constructor"in m&&"constructor"in w&&!("function"==typeof s&&s instanceof s&&"function"==typeof c&&c instanceof c)&&(z=!1),M.delete(m),M.delete(w),z}return!1}function kt(t){var e;return xt(t)&&(e=t,!(st&&st in e))&&(zt(t)?ct:L).test(k(t))}function Ot(t){if(n="function"==typeof(n=(e=t)&&e.constructor)&&n.prototype||u,e!==n)return ft(t);var e,n,r,o=[];for(r in Object(t))D.call(t,r)&&"constructor"!=r&&o.push(r);return o}function Mt(t,e,n,r,o,i){var s=n&T,a=t.length,c=e.length;if(a!=c&&!(s&&a<c))return!1;c=i.get(t);if(c&&i.get(e))return c==e;var u=-1,l=!0,p=n&J?new b:void 0;for(i.set(t,e),i.set(e,t);++u<a;){var h,f=t[u],d=e[u];if(void 0!==(h=r?s?r(d,f,u,e,t,i):r(f,d,u,t,e,i):h)){if(h)continue;l=!1;break}if(p){if(!function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return 1}(e,function(t,e){return!p.has(e)&&(f===t||o(f,t,n,r,i))&&p.push(e)})){l=!1;break}}else if(f!==d&&!o(f,d,n,r,i)){l=!1;break}}return i.delete(t),i.delete(e),l}function It(t){var e=Tt,n=Ct;if(e=e(t),V(t))return e;for(var r=e,o=n(t),i=-1,s=o.length,a=r.length;++i<s;)r[a+i]=o[i];return r}function w(t,e){var n,r,t=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?t["string"==typeof e?"string":"hash"]:t.map}function j(t,e){e=e;t=null==(t=t)?void 0:t[e];return kt(t)?t:void 0}g.prototype.clear=function(){this.__data__=d?d(null):{},this.size=0},g.prototype.delete=function(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},g.prototype.get=function(t){var e,n=this.__data__;return d?(e=n[t])===r?void 0:e:D.call(n,t)?n[t]:void 0},g.prototype.has=function(t){var e=this.__data__;return d?void 0!==e[t]:D.call(e,t)},g.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=d&&void 0===e?r:e,this},y.prototype.clear=function(){this.__data__=[],this.size=0},y.prototype.delete=function(t){var e=this.__data__;return!((t=v(e,t))<0||(t==e.length-1?e.pop():pt.call(e,t,1),--this.size,0))},y.prototype.get=function(t){var e=this.__data__;return(t=v(e,t))<0?void 0:e[t][1]},y.prototype.has=function(t){return-1<v(this.__data__,t)},y.prototype.set=function(t,e){var n=this.__data__,r=v(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},_.prototype.clear=function(){this.size=0,this.__data__={hash:new g,map:new(h||y),string:new g}},_.prototype.delete=function(t){return t=w(this,t).delete(t),this.size-=t?1:0,t},_.prototype.get=function(t){return w(this,t).get(t)},_.prototype.has=function(t){return w(this,t).has(t)},_.prototype.set=function(t,e){var n=w(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},b.prototype.add=b.prototype.push=function(t){return this.__data__.set(t,r),this},b.prototype.has=function(t){return this.__data__.has(t)},U.prototype.clear=function(){this.__data__=new y,this.size=0},U.prototype.delete=function(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t},U.prototype.get=function(t){return this.__data__.get(t)},U.prototype.has=function(t){return this.__data__.has(t)},U.prototype.set=function(t,e){var n=this.__data__;if(n instanceof y){var r=n.__data__;if(!h||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new _(r)}return n.set(t,e),this.size=n.size,this};var Ct=ht?function(e){if(null==e)return[];e=Object(e);for(var t=ht(e),n=function(t){return lt.call(e,t)},r=-1,o=null==t?0:t.length,i=0,s=[];++r<o;){var a=t[r];n(a,r,t)&&(s[i++]=a)}return s}:function(){return[]},G=m;function k(t){if(null!=t){try{return it.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function St(t,e){return t===e||t!=t&&e!=e}(i&&G(new i(new ArrayBuffer(1)))!=q||h&&G(new h)!=F||l&&G(l.resolve())!=A||f&&G(new f)!=N||o&&G(new o)!=n)&&(G=function(t){var e=m(t),t=e==H?t.constructor:void 0,t=t?k(t):"";if(t)switch(t){case dt:return q;case gt:return F;case yt:return A;case _t:return N;case bt:return n}return e});var At=wt(function(){return arguments}())?wt:function(t){return W(t)&&D.call(t,"callee")&&!lt.call(t,"callee")},V=Array.isArray;var Pt=s||function(){return!1};function zt(t){if(xt(t))return(t=m(t))==I||t==C||t==M||t==P}function Lt(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=O}function xt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function W(t){return null!=t&&"object"==typeof t}var Rt,Et=t?(Rt=t,function(t){return Rt(t)}):function(t){return W(t)&&Lt(t.length)&&!!e[m(t)]};function Tt(t){return(null!=(e=t)&&Lt(e.length)&&!zt(e)?mt:Ot)(t);var e}Bt.exports=function(t,e){return jt(t,e)}}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],8:[function(t,e,n){var r,o,i;r=this,o=function(){function h(t){if(void 0!==(t=t||{}).seed&&null!==t.seed&&t.seed===parseInt(t.seed,10))f=t.seed;else if("string"==typeof t.seed)f=function(t){for(var e=0,n=0;n!==t.length&&!(e>=Number.MAX_SAFE_INTEGER);n++)e+=t.charCodeAt(n);return e}(t.seed);else{if(void 0!==t.seed&&null!==t.seed)throw new TypeError("The seed value must be an integer or string");f=null}var e,n;if(null!==t.count&&void 0!==t.count){for(var r=t.count,o=[],i=0;i<t.count;i++)g.push(!1);for(t.count=null;o.length<r;){var s=h(t);null!==f&&(t.seed=f),o.push(s)}return t.count=r,o}var a=function(t,e,n){var r=function(t,e){for(var n=y(t).lowerBounds,r=0;r<n.length-1;r++){var o=n[r][0],i=n[r][1],s=n[r+1][0],a=n[r+1][1];if(o<=e&&e<=s)return(a=(a-i)/(s-o))*e+(i-a*o)}return 0}(t,e),o=100;switch(n.luminosity){case"dark":o=r+20;break;case"light":r=(o+r)/2;break;case"random":r=0,o=100}return _([r,o])}(e=function(t){{var e,n,r,o,i;return e=0<g.length?(e=_(i=function(t){if(isNaN(t)){if("string"==typeof t)if(d[t]){var e=d[t];if(e.hueRange)return e.hueRange}else if(t.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i))return y(v(t)[0]).hueRange}else{e=parseInt(t);if(e<360&&0<e)return y(t).hueRange}return[0,360]}(t.hue)),n=(i[1]-i[0])/g.length,o=parseInt((e-i[0])/n),!0===g[o]?o=(o+2)%g.length:g[o]=!0,r=(i[0]+o*n)%359,o=(i[0]+(o+1)*n)%359,(e=_(i=[r,o]))<0?360+e:e):(i=function(t){if("number"==typeof parseInt(t)){var e=parseInt(t);if(e<360&&0<e)return[e,e]}if("string"==typeof t)if(d[t]){e=d[t];if(e.hueRange)return e.hueRange}else if(t.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i))return[e=v(t)[0],e];return[0,360]}(t.hue),(e=_(i))<0?360+e:e)}}(t),n=function(t,e){if("monochrome"===e.hue)return 0;if("random"===e.luminosity)return _([0,100]);var t=function(t){return y(t).saturationRange}(t),n=t[0],r=t[1];switch(e.luminosity){case"bright":n=55;break;case"dark":n=r-10;break;case"light":r=55}return _([n,r])}(e,t),t),c=[e,n,a],u=t;switch(u.format){case"hsvArray":return c;case"hslArray":return m(c);case"hsl":var l=m(c);return"hsl("+l[0]+", "+l[1]+"%, "+l[2]+"%)";case"hsla":var l=m(c),p=u.alpha||Math.random();return"hsla("+l[0]+", "+l[1]+"%, "+l[2]+"%, "+p+")";case"rgbArray":return b(c);case"rgb":return"rgb("+b(c).join(", ")+")";case"rgba":l=b(c),p=u.alpha||Math.random();return"rgba("+l.join(", ")+", "+p+")";default:return function(t){t=b(t);function e(t){t=t.toString(16);return 1==t.length?"0"+t:t}return"#"+e(t[0])+e(t[1])+e(t[2])}(c)}}var f=null,d={},g=(t("monochrome",null,[[0,0],[100,0]]),t("red",[-26,18],[[20,100],[30,92],[40,89],[50,85],[60,78],[70,70],[80,60],[90,55],[100,50]]),t("orange",[18,46],[[20,100],[30,93],[40,88],[50,86],[60,85],[70,70],[100,70]]),t("yellow",[46,62],[[25,100],[40,94],[50,89],[60,86],[70,84],[80,82],[90,80],[100,75]]),t("green",[62,178],[[30,100],[40,90],[50,85],[60,81],[70,74],[80,64],[90,50],[100,40]]),t("blue",[178,257],[[20,100],[30,86],[40,80],[50,74],[60,60],[70,52],[80,44],[90,39],[100,35]]),t("purple",[257,282],[[20,100],[30,87],[40,79],[50,70],[60,65],[70,59],[80,52],[90,45],[100,42]]),t("pink",[282,334],[[20,100],[30,90],[40,86],[60,84],[80,80],[90,75],[100,73]]),[]);function y(t){for(var e in 334<=t&&t<=360&&(t-=360),d){var n=d[e];if(n.hueRange&&t>=n.hueRange[0]&&t<=n.hueRange[1])return d[e]}return"Color not found"}function _(t){var e,n;return null===f?(e=(Math.random()+.618033988749895)%1,Math.floor(t[0]+e*(t[1]+1-t[0]))):(e=t[1]||1,t=t[0]||0,n=(f=(9301*f+49297)%233280)/233280,Math.floor(t+n*(e-t)))}function t(t,e,n){var r=n[0][0],o=n[n.length-1][0],i=n[n.length-1][1],s=n[0][1];d[t]={hueRange:e,lowerBounds:n,saturationRange:[r,o],brightnessRange:[i,s]}}function b(t){var e=t[0],n=(360===(e=0===e?1:e)&&(e=359),e/=360,t[1]/100),r=t[2]/100,t=Math.floor(6*e),e=6*e-t,o=r*(1-n),i=r*(1-e*n),s=r*(1-(1-e)*n),a=256,c=256,u=256;switch(t){case 0:a=r,c=s,u=o;break;case 1:a=i,c=r,u=o;break;case 2:a=o,c=r,u=s;break;case 3:a=o,c=i,u=r;break;case 4:a=s,c=o,u=r;break;case 5:a=r,c=o,u=i}return[Math.floor(255*a),Math.floor(255*c),Math.floor(255*u)]}function v(t){t=3===(t=t.replace(/^#/,"")).length?t.replace(/(.)/g,"$1$1"):t;var e=parseInt(t.substr(0,2),16)/255,n=parseInt(t.substr(2,2),16)/255,r=parseInt(t.substr(4,2),16)/255,o=Math.max(e,n,r),i=o-Math.min(e,n,r),s=o?i/o:0;switch(o){case e:return[(n-r)/i%6*60||0,s,o];case n:return[60*((r-e)/i+2)||0,s,o];case r:return[60*((e-n)/i+4)||0,s,o]}}function m(t){var e=t[0],n=t[1]/100,t=t[2]/100,r=(2-n)*t;return[e,Math.round(n*t/(r<1?r:2-r)*1e4)/100,r/2*100]}return h},"object"==typeof n?(i=o(),(n="object"==typeof e&&e&&e.exports?e.exports=i:n).randomColor=i):r.randomColor=o()},{}]},{},[1])(1)});
|