tileserver-gl-light 4.4.8 → 4.4.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tileserver-gl-light",
3
- "version": "4.4.8",
3
+ "version": "4.4.10",
4
4
  "description": "Map tile server for JSON GL styles - serving vector tiles",
5
5
  "main": "src/main.js",
6
6
  "bin": "src/main.js",
@@ -34,7 +34,7 @@
34
34
  "http-shutdown": "1.2.2",
35
35
  "morgan": "1.10.0",
36
36
  "pbf": "3.2.1",
37
- "proj4": "2.8.1",
37
+ "proj4": "2.9.0",
38
38
  "request": "2.88.2",
39
39
  "sanitize-filename": "1.6.3",
40
40
  "tileserver-gl-styles": "2.0.0"
@@ -1 +1 @@
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(u)return u(e,!0);throw(n=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",n}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 u="function"==typeof require&&require,t=0;t<s.length;t++)a(s[t]);return a}({1:[function(t,e,n){"use strict";t=t("./lib/MaplibreInspect");e.exports=t},{"./lib/MaplibreInspect":3}],2:[function(t,e,n){"use strict";function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function o(t){var e,n;t=r({show:!0,onToggle:function(){}},t),this._btn=((n=document.createElement("button")).className="maplibregl-ctrl-icon maplibregl-ctrl-inspect",n.type="button",n["aria-label"]="Inspect",n),this._btn.onclick=t.onToggle,this.elem=(e=this._btn,n=t.show,(t=document.createElement("div")).className="maplibregl-ctrl maplibregl-ctrl-group",t.appendChild(e),n||(t.style.display="none"),t)}o.prototype.setInspectIcon=function(){this._btn.className="maplibregl-ctrl-icon maplibregl-ctrl-inspect"},o.prototype.setMapIcon=function(){this._btn.className="maplibregl-ctrl-icon maplibregl-ctrl-map"},e.exports=o},{}],3:[function(t,e,n){"use strict";function i(){return(i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}var r=t("./stylegen"),o=t("./InspectButton"),s=t("lodash.isequal"),a=t("./renderPopup"),u=t("./colors");function c(t){if(!(this instanceof c))throw new Error("MaplibreInspect needs to be called with the new keyword");var 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=i({showInspectMap:!1,showInspectButton:!0,showInspectMapPopup:!0,showMapPopup:!1,showMapPopupOnHover:!0,showInspectMapPopupOnHover:!0,blockHoverPopupOnClick:!1,backgroundColor:"#fff",assignLayerColor:u.brightColor,buildInspectStyle:r.generateInspectStyle,renderPopup:a,popup:e,selectThreshold:5,useInspectStyle:!0,queryParameters:{},sources:{}},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.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(i(t=this._inspectStyle(),{metadata:i({},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){var r=this.sources,o=this._map,e=o.getStyle(),n=Object.keys(e.sources),e=i({},r);"visibility"!==t.sourceDataType&&t.isSourceLoaded&&(Object.keys(o.style.sourceCaches).forEach(function(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(function(t){-1===n.indexOf(t)&&delete r[t]}),!s(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(t){if(this._showInspectMap){if(!this.options.showInspectMapPopup)return;if("mousemove"===t.type&&!this.options.showInspectMapPopupOnHover)return;"click"===t.type&&this.options.showInspectMapPopupOnHover&&this.options.blockHoverPopupOnClick&&(this._popupBlocked=!this._popupBlocked)}else{if(!this.options.showMapPopup)return;if("mousemove"===t.type&&!this.options.showMapPopupOnHover)return;"click"===t.type&&this.options.showMapPopupOnHover&&this.options.blockHoverPopupOnClick&&(this._popupBlocked=!this._popupBlocked)}var e;!this._popupBlocked&&this._popup&&(e=0===this.options.selectThreshold?t.point:[[t.point.x-this.options.selectThreshold,t.point.y+this.options.selectThreshold],[t.point.x+this.options.selectThreshold,t.point.y-this.options.selectThreshold]],e=this._map.queryRenderedFeatures(e,this.options.queryParameters)||[],this._map.getCanvas().style.cursor=e.length?"pointer":"",e.length?(this._popup.setLngLat(t.lngLat),"string"==typeof(e=this.options.renderPopup(e))?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){"use strict";var o=t("randomcolor");n.brightColor=function(t,e){var n="bright",r=null;return/water|ocean|lake|sea|river/.test(t)&&(r="blue"),/state|country|place/.test(t)&&(r="pink"),/road|highway|transport/.test(t)&&(r="orange"),/contour|building/.test(t)&&(r="monochrome"),/building/.test(t)&&(n="dark"),/contour|landuse/.test(t)&&(r="yellow"),/wood|forest|park|landcover/.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){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){return'<div class="maplibregl-inspect_property"><div class="maplibregl-inspect_property-name">'+t+'</div><div class="maplibregl-inspect_property-value">'+(null==(e=e)?e:e instanceof Date?e.toLocaleString():"object"===r(e)||"number"==typeof e||"string"==typeof e?e.toString():e)+"</div></div>"}function i(t){return t.map(function(t){return'<div class="maplibregl-inspect_feature">'+(n='<div class="maplibregl-inspect_layer">'+((e=t).layer["source-layer"]||e.layer.source)+"</div>",r=o("$type",e.geometry.type),t=Object.keys(e.properties).map(function(t){return o(t,e.properties[t])}),[n,r].concat(t).join(""))+"</div>";var e,n,r}).join("")}e.exports=function(t){return'<div class="maplibregl-inspect_popup">'+i(t)+"</div>"}},{}],6:[function(t,e,n){"use strict";function o(){return(o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function a(t,e,n){t={id:[e,n,"circle"].join("_"),source:e,type:"circle",paint:{"circle-color":t,"circle-radius":2},filter:["==","$type","Point"]};return n&&(t["source-layer"]=n),t}function u(t,e,n,r){t={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&&(t["source-layer"]=r),t}function c(t,e,n){t={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&&(t["source-layer"]=n),t}n.polygonLayer=u,n.lineLayer=c,n.circleLayer=a,n.generateInspectStyle=function(n,t,e){var e={id:"background",type:"background",paint:{"background-color":(e=o({backgroundColor:"#fff"},e)).backgroundColor}},r={};return Object.keys(n.sources).forEach(function(t){var e=n.sources[t];"vector"!==e.type&&"geojson"!==e.type||(r[t]=e)}),o(n,{layers:[e].concat(t),soources:r})},n.generateColoredLayers=function(e,n){var 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(function(n){var t=e[n];t&&0!==t.length?t.forEach(function(t){var e=s(t);o.push(a(e.circle,n,t)),i.push(c(e.line,n,t)),r.push(u(e.polygon,e.polygonOutline,n,t))}):(t=s(n),o.push(a(t.circle,n)),i.push(c(t.line,n)),r.push(u(t.polygon,t.polygonOutline,n)))}),r.concat(i).concat(o)}},{}],7:[function(t,Ft,Ht){!function($t){!function(){var r="__lodash_hash_undefined__",b=1,d=2,h=9007199254740991,p="[object Arguments]",f="[object Array]",e="[object AsyncFunction]",y="[object Boolean]",g="[object Date]",_="[object Error]",n="[object Function]",o="[object GeneratorFunction]",v="[object Map]",m="[object Number]",i="[object Null]",w="[object Object]",s="[object Promise]",a="[object Proxy]",j="[object RegExp]",k="[object Set]",O="[object String]",M="[object Symbol]",u="[object Undefined]",c="[object WeakMap]",I="[object ArrayBuffer]",S="[object DataView]",l=/^\[object .+?Constructor\]$/,C=/^(?:0|[1-9]\d*)$/,P={};P["[object Float32Array]"]=P["[object Float64Array]"]=P["[object Int8Array]"]=P["[object Int16Array]"]=P["[object Int32Array]"]=P["[object Uint8Array]"]=P["[object Uint8ClampedArray]"]=P["[object Uint16Array]"]=P["[object Uint32Array]"]=!0,P[p]=P[f]=P[I]=P[y]=P[S]=P[g]=P[_]=P[n]=P[v]=P[m]=P[w]=P[j]=P[k]=P[O]=P[c]=!1;var t="object"==typeof $t&&$t&&$t.Object===Object&&$t,A="object"==typeof self&&self&&self.Object===Object&&self,z=t||A||Function("return this")(),L="object"==typeof Ht&&Ht&&!Ht.nodeType&&Ht,x=L&&"object"==typeof Ft&&Ft&&!Ft.nodeType&&Ft,R=x&&x.exports===L,E=R&&t.process,T=function(){try{return E&&E.binding&&E.binding("util")}catch(t){}}(),A=T&&T.isTypedArray;function B(t){var n=-1,r=Array(t.size);return t.forEach(function(t,e){r[++n]=[e,t]}),r}function $(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var F,H,x=Array.prototype,L=Function.prototype,N=Object.prototype,t=z["__core-js_shared__"],q=L.toString,D=N.hasOwnProperty,U=(T=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+T:"",G=N.toString,V=RegExp("^"+q.call(D).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),L=R?z.Buffer:void 0,t=z.Symbol,W=z.Uint8Array,J=N.propertyIsEnumerable,X=x.splice,K=t?t.toStringTag:void 0,Q=Object.getOwnPropertySymbols,T=L?L.isBuffer:void 0,Y=(F=Object.keys,H=Object,function(t){return F(H(t))}),R=kt(z,"DataView"),Z=kt(z,"Map"),x=kt(z,"Promise"),L=kt(z,"Set"),z=kt(z,"WeakMap"),tt=kt(Object,"create"),et=It(R),nt=It(Z),rt=It(x),ot=It(L),it=It(z),t=t?t.prototype:void 0,st=t?t.valueOf:void 0;function at(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 ut(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 ct(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 lt(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new ct;++e<n;)this.add(t[e])}function pt(t){t=this.__data__=new ut(t);this.size=t.size}function ht(t,e){var n,r,o,i=Pt(t),s=!i&&Ct(t),a=!i&&!s&&At(t),u=!i&&!s&&!a&&Tt(t),c=i||s||a||u,l=c?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)||c&&("length"==n||a&&("offset"==n||"parent"==n)||u&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||(r=n,!!(o=null==(o=p)?h:o)&&("number"==typeof r||C.test(r))&&-1<r&&r%1==0&&r<o))||l.push(n);return l}function ft(t,e){for(var n=t.length;n--;)if(St(t[n][0],e))return n;return-1}function yt(t,e,n){e=e(t);return Pt(t)?e:function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}(e,n(t))}function dt(t){return null==t?void 0===t?u:i:K&&K in Object(t)?function(t){var e=D.call(t,K),n=t[K];try{var r=!(t[K]=void 0)}catch(t){}var o=G.call(t);r&&(e?t[K]=n:delete t[K]);return o}(t):G.call(t)}function gt(t){return Rt(t)&&dt(t)==p}function _t(t,e,n,r,o){return t===e||(null==t||null==e||!Rt(t)&&!Rt(e)?t!=t&&e!=e:function(t,e,n,r,o,i){var s=Pt(t),a=Pt(e),u=s?f:Mt(t),c=a?f:Mt(e),l=(u=u==p?w:u)==w,a=(c=c==p?w:c)==w,c=u==c;if(c&&At(t)){if(!At(e))return!1;l=!(s=!0)}if(c&&!l)return i=i||new pt,s||Tt(t)?mt(t,e,n,r,o,i):function(t,e,n,r,o,i,s){switch(n){case S:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case I:return t.byteLength==e.byteLength&&i(new W(t),new W(e))?!0:!1;case y:case g:case m:return St(+t,+e);case _:return t.name==e.name&&t.message==e.message;case j:case O:return t==e+"";case v:var a=B;case k:var u=r&b;if(a=a||$,t.size!=e.size&&!u)return!1;u=s.get(t);if(u)return u==e;r|=d,s.set(t,e);a=mt(a(t),a(e),r,o,i,s);return s.delete(t),a;case M:if(st)return st.call(t)==st.call(e)}return!1}(t,e,u,n,r,o,i);if(!(n&b)){l=l&&D.call(t,"__wrapped__"),a=a&&D.call(e,"__wrapped__");if(l||a){l=l?t.value():t,a=a?e.value():e;return i=i||new pt,o(l,a,n,r,i)}}return c&&(i=i||new pt,function(t,e,n,r,o,i){var s=n&b,a=wt(t),u=a.length,c=wt(e).length;if(u!=c&&!s)return!1;var l=u;for(;l--;){var p=a[l];if(!(s?p in e:D.call(e,p)))return!1}var h=i.get(t);if(h&&i.get(e))return h==e;var f=!0;i.set(t,e),i.set(e,t);var y=s;for(;++l<u;){p=a[l];var d,g=t[p],_=e[p];if(!(void 0===(d=r?s?r(_,g,p,e,t,i):r(g,_,p,t,e,i):d)?g===_||o(g,_,n,r,i):d)){f=!1;break}y=y||"constructor"==p}f&&!y&&(c=t.constructor,h=e.constructor,c!=h&&"constructor"in t&&"constructor"in e&&!("function"==typeof c&&c instanceof c&&"function"==typeof h&&h instanceof h)&&(f=!1));return i.delete(t),i.delete(e),f}(t,e,n,r,o,i))}(t,e,n,r,_t,o))}function bt(t){var e;return xt(t)&&(e=t,!(U&&U in e))&&(zt(t)?V:l).test(It(t))}function vt(t){if(n="function"==typeof(n=(e=t)&&e.constructor)&&n.prototype||N,e!==n)return Y(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&b,a=t.length,u=e.length;if(a!=u&&!(s&&a<u))return!1;u=i.get(t);if(u&&i.get(e))return u==e;var c=-1,l=!0,p=n&d?new lt:void 0;for(i.set(t,e),i.set(e,t);++c<a;){var h,f=t[c],y=e[c];if(void 0!==(h=r?s?r(y,f,c,e,t,i):r(f,y,c,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!==y&&!o(f,y,n,r,i)){l=!1;break}}return i.delete(t),i.delete(e),l}function wt(t){return yt(t,Bt,Ot)}function jt(t,e){var n,r=t.__data__;return("string"==(t=typeof(n=e))||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==n:null===n)?r["string"==typeof e?"string":"hash"]:r.map}function kt(t,e){e=e,e=null==(t=t)?void 0:t[e];return bt(e)?e:void 0}at.prototype.clear=function(){this.__data__=tt?tt(null):{},this.size=0},at.prototype.delete=function(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},at.prototype.get=function(t){var e=this.__data__;if(tt){var n=e[t];return n===r?void 0:n}return D.call(e,t)?e[t]:void 0},at.prototype.has=function(t){var e=this.__data__;return tt?void 0!==e[t]:D.call(e,t)},at.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=tt&&void 0===e?r:e,this},ut.prototype.clear=function(){this.__data__=[],this.size=0},ut.prototype.delete=function(t){var e=this.__data__;return!((t=ft(e,t))<0)&&(t==e.length-1?e.pop():X.call(e,t,1),--this.size,!0)},ut.prototype.get=function(t){var e=this.__data__;return(t=ft(e,t))<0?void 0:e[t][1]},ut.prototype.has=function(t){return-1<ft(this.__data__,t)},ut.prototype.set=function(t,e){var n=this.__data__,r=ft(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},ct.prototype.clear=function(){this.size=0,this.__data__={hash:new at,map:new(Z||ut),string:new at}},ct.prototype.delete=function(t){return t=jt(this,t).delete(t),this.size-=t?1:0,t},ct.prototype.get=function(t){return jt(this,t).get(t)},ct.prototype.has=function(t){return jt(this,t).has(t)},ct.prototype.set=function(t,e){var n=jt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},lt.prototype.add=lt.prototype.push=function(t){return this.__data__.set(t,r),this},lt.prototype.has=function(t){return this.__data__.has(t)},pt.prototype.clear=function(){this.__data__=new ut,this.size=0},pt.prototype.delete=function(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t},pt.prototype.get=function(t){return this.__data__.get(t)},pt.prototype.has=function(t){return this.__data__.has(t)},pt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof ut){var r=n.__data__;if(!Z||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new ct(r)}return n.set(t,e),this.size=n.size,this};var Ot=Q?function(e){return null==e?[]:(e=Object(e),function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var s=t[n];e(s,n,t)&&(i[o++]=s)}return i}(Q(e),function(t){return J.call(e,t)}))}:function(){return[]},Mt=dt;function It(t){if(null!=t){try{return q.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function St(t,e){return t===e||t!=t&&e!=e}(R&&Mt(new R(new ArrayBuffer(1)))!=S||Z&&Mt(new Z)!=v||x&&Mt(x.resolve())!=s||L&&Mt(new L)!=k||z&&Mt(new z)!=c)&&(Mt=function(t){var e=dt(t),t=e==w?t.constructor:void 0,t=t?It(t):"";if(t)switch(t){case et:return S;case nt:return v;case rt:return s;case ot:return k;case it:return c}return e});var Ct=gt(function(){return arguments}())?gt:function(t){return Rt(t)&&D.call(t,"callee")&&!J.call(t,"callee")},Pt=Array.isArray;var At=T||function(){return!1};function zt(t){if(xt(t)){t=dt(t);return t==n||t==o||t==e||t==a}}function Lt(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=h}function xt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Rt(t){return null!=t&&"object"==typeof t}var Et,Tt=A?(Et=A,function(t){return Et(t)}):function(t){return Rt(t)&&Lt(t.length)&&!!P[dt(t)]};function Bt(t){return(null!=(e=t)&&Lt(e.length)&&!zt(e)?ht:vt)(t);var e}Ft.exports=function(t,e){return _t(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(){var a=null,u={};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 c(t){if(void 0!==(t=t||{}).seed&&null!==t.seed&&t.seed===parseInt(t.seed,10))a=t.seed;else if("string"==typeof t.seed)a=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");a=null}var e,n;if(null===t.count||void 0===t.count)return function(t,e){switch(e.format){case"hsvArray":return t;case"hslArray":return d(t);case"hsl":var n=d(t);return"hsl("+n[0]+", "+n[1]+"%, "+n[2]+"%)";case"hsla":var r=d(t),o=e.alpha||Math.random();return"hsla("+r[0]+", "+r[1]+"%, "+r[2]+"%, "+o+")";case"rgbArray":return f(t);case"rgb":return"rgb("+f(t).join(", ")+")";case"rgba":r=f(t),o=e.alpha||Math.random();return"rgba("+r.join(", ")+", "+o+")";default:return function(t){t=f(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])}(t)}}([e=function(t){{if(0<l.length){var e=h(i=function(t){if(isNaN(t)){if("string"==typeof t)if(u[t]){var e=u[t];if(e.hueRange)return e.hueRange}else if(t.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i))return p(y(t)[0]).hueRange}else{e=parseInt(t);if(e<360&&0<e)return p(t).hueRange}return[0,360]}(t.hue)),n=(i[1]-i[0])/l.length,r=parseInt((e-i[0])/n);!0===l[r]?r=(r+2)%l.length:l[r]=!0;var o=(i[0]+r*n)%359,n=(i[0]+(r+1)*n)%359;return e=(e=h(i=[o,n]))<0?360+e:e}var 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(u[t]){e=u[t];if(e.hueRange)return e.hueRange}else if(t.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i)){t=y(t)[0];return[t,t]}return[0,360]}(t.hue);return e=(e=h(i))<0?360+e:e}}(t),n=function(t,e){if("monochrome"===e.hue)return 0;if("random"===e.luminosity)return h([0,100]);var t=function(t){return p(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 h([n,r])}(e,t),function(t,e,n){var r=function(t,e){for(var n=p(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){s=(a-i)/(s-o);return s*e+(i-s*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 h([r,o])}(e,n,t)],t);for(var r=t.count,o=[],i=0;i<t.count;i++)l.push(!1);for(t.count=null;r>o.length;){var s=c(t);null!==a&&(t.seed=a),o.push(s)}return t.count=r,o}var l=[];function p(t){for(var e in 334<=t&&t<=360&&(t-=360),u){var n=u[e];if(n.hueRange&&t>=n.hueRange[0]&&t<=n.hueRange[1])return u[e]}return"Color not found"}function h(t){if(null===a){var e=Math.random();return e+=.618033988749895,e%=1,Math.floor(t[0]+e*(t[1]+1-t[0]))}var n=t[1]||1,e=t[0]||0,t=(a=(9301*a+49297)%233280)/233280;return Math.floor(e+t*(n-e))}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];u[t]={hueRange:e,lowerBounds:n,saturationRange:[r,o],brightnessRange:[i,s]}}function f(t){var e=t[0];360===(e=0===e?1:e)&&(e=359),e/=360;var n=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,u=256,c=256;switch(t){case 0:a=r,u=s,c=o;break;case 1:a=i,u=r,c=o;break;case 2:a=o,u=r,c=s;break;case 3:a=o,u=i,c=r;break;case 4:a=s,u=o,c=r;break;case 5:a=r,u=o,c=i}return[Math.floor(255*a),Math.floor(255*u),Math.floor(255*c)]}function y(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 d(t){var e=t[0],n=t[1]/100,r=t[2]/100,t=(2-n)*r;return[e,Math.round(n*r/(t<1?t:2-t)*1e4)/100,t/2*100]}return c},"object"==typeof n?(i=o(),(n="object"==typeof e&&e&&e.exports?e.exports=i:n).randomColor=i):r.randomColor=o()},{}]},{},[1])(1)});
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){"use strict";t=t("./lib/MaplibreInspect");e.exports=t},{"./lib/MaplibreInspect":3}],2:[function(t,e,n){"use strict";function r(){return(r=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function o(t){var e,n;t=r({show:!0,onToggle:function(){}},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)}o.prototype.setInspectIcon=function(){this._btn.className="maplibregl-ctrl-icon maplibregl-ctrl-inspect"},o.prototype.setMapIcon=function(){this._btn.className="maplibregl-ctrl-icon maplibregl-ctrl-map"},e.exports=o},{}],3:[function(t,e,n){"use strict";function i(){return(i=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}var r=t("./stylegen"),o=t("./InspectButton"),s=t("lodash.isequal"),a=t("./renderPopup"),c=t("./colors");function u(t){if(!(this instanceof u))throw new Error("MaplibreInspect needs to be called with the new keyword");var 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=i({showInspectMap:!1,showInspectButton:!0,showInspectMapPopup:!0,showMapPopup:!1,showMapPopupOnHover:!0,showInspectMapPopupOnHover:!0,blockHoverPopupOnClick:!1,backgroundColor:"#fff",assignLayerColor:c.brightColor,buildInspectStyle:r.generateInspectStyle,renderPopup:a,popup:e,selectThreshold:5,useInspectStyle:!0,queryParameters:{},sources:{},toggleCallback:function(){}},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)})}u.prototype.toggleInspector=function(){this._showInspectMap=!this._showInspectMap,this.options.toggleCallback(this._showInspectMap),this.render()},u.prototype._inspectStyle=function(){var t=r.generateColoredLayers(this.sources,this.assignLayerColor);return this.options.buildInspectStyle(this._map.getStyle(),t,{backgroundColor:this.options.backgroundColor})},u.prototype.render=function(){var t;this._showInspectMap?(this.options.useInspectStyle&&this._map.setStyle(i(t=this._inspectStyle(),{metadata:i({},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())},u.prototype._onSourceChange=function(t){var r=this.sources,o=this._map,e=o.getStyle(),n=Object.keys(e.sources),e=i({},r);"visibility"!==t.sourceDataType&&t.isSourceLoaded&&(Object.keys(o.style.sourceCaches).forEach(function(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(function(t){-1===n.indexOf(t)&&delete r[t]}),!s(e,r))&&0<Object.keys(r).length&&this.render()},u.prototype._onStyleChange=function(){var t,e=this._map.getStyle();(t=e).metadata&&t.metadata["maplibregl-inspect:inspect"]||(this._originalStyle=e)},u.prototype._onRightClick=function(){this.options.showMapPopupOnHover||this.options.showInspectMapPopupOnHover||this.options.blockHoverPopupOnClick||this._popup&&this._popup.remove()},u.prototype._onMousemove=function(t){if(this._showInspectMap){if(!this.options.showInspectMapPopup)return;if("mousemove"===t.type&&!this.options.showInspectMapPopupOnHover)return;"click"===t.type&&this.options.showInspectMapPopupOnHover&&this.options.blockHoverPopupOnClick&&(this._popupBlocked=!this._popupBlocked)}else{if(!this.options.showMapPopup)return;if("mousemove"===t.type&&!this.options.showMapPopupOnHover)return;"click"===t.type&&this.options.showMapPopupOnHover&&this.options.blockHoverPopupOnClick&&(this._popupBlocked=!this._popupBlocked)}var e;!this._popupBlocked&&this._popup&&(e=0===this.options.selectThreshold?t.point:[[t.point.x-this.options.selectThreshold,t.point.y+this.options.selectThreshold],[t.point.x+this.options.selectThreshold,t.point.y-this.options.selectThreshold]],e=this._map.queryRenderedFeatures(e,this.options.queryParameters)||[],this._map.getCanvas().style.cursor=e.length?"pointer":"",e.length?(this._popup.setLngLat(t.lngLat),"string"==typeof(t=this.options.renderPopup(e))?this._popup.setHTML(t):this._popup.setDOMContent(t),this._popup.addTo(this._map)):this._popup.remove())},u.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},u.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=u},{"./InspectButton":2,"./colors":4,"./renderPopup":5,"./stylegen":6,"lodash.isequal":7}],4:[function(t,e,n){"use strict";var o=t("randomcolor");n.brightColor=function(t,e){var 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/.test(t)&&(r="monochrome"),/building/.test(t)&&(n="dark"),/contour|landuse/.test(t)&&(r="yellow"),/wood|forest|park|landcover|land/.test(t)&&(r="green"),n=o({luminosity:n,hue:r,seed:t,format:"rgbArray"}).concat([e||1]),"rgba(".concat(n.join(", "),")")}},{randomcolor:8}],5:[function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){return"".concat('<div class="maplibregl-inspect_property"><div class="maplibregl-inspect_property-name">').concat(t,"</div>")+'<div class="maplibregl-inspect_property-value">'.concat(null==(t=e)?t:t instanceof Date?t.toLocaleString():"object"===r(t)||"number"==typeof t||"string"==typeof t?t.toString():t,"</div>")+"</div>"}function i(t){return t.map(function(t){return'<div class="maplibregl-inspect_feature">'.concat((e=t,t='<div class="maplibregl-inspect_layer">'.concat(e.layer["source-layer"]||e.layer.source,"</div>"),n=o("$type",e.geometry.type),r=Object.keys(e.properties).map(function(t){return 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">'.concat(i(t),"</div>")}},{}],6:[function(t,e,n){"use strict";function o(){return(o=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}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){var e={id:"background",type:"background",paint:{"background-color":(e=o({backgroundColor:"#fff"},e)).backgroundColor}},r={};return Object.keys(n.sources).forEach(function(t){var e=n.sources[t];"vector"!==e.type&&"geojson"!==e.type||(r[t]=e)}),o(n,{layers:[e].concat(t),sources:r})},n.generateColoredLayers=function(e,n){var 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(function(n){var t=e[n];t&&0!==t.length?t.forEach(function(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,$t,Ft){!function(Bt){!function(){var r="__lodash_hash_undefined__",T=1,J=2,O=9007199254740991,B="[object Arguments]",$="[object Array]",M="[object AsyncFunction]",X="[object Boolean]",K="[object Date]",Q="[object Error]",I="[object Function]",S="[object GeneratorFunction]",F="[object Map]",Y="[object Number]",C="[object Null]",H="[object Object]",P="[object Promise]",A="[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[B]=e[$]=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 Bt&&Bt&&Bt.Object===Object&&Bt),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 $t&&$t&&!$t.nodeType&&$t,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"),y=j(Object,"create"),yt=k(i),dt=k(h),gt=k(l),_t=k(f),bt=k(o),c=c?c.prototype:void 0,vt=c?c.valueOf:void 0;function d(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 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 _(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 g(t);this.size=t.size}function mt(t,e){var n,r,o,i=V(t),s=!i&&Pt(t),a=!i&&!s&&At(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(Ct(t[n][0],e))return n;return-1}function m(t){if(null==t)return void 0===t?z:C;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)==B}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?$:G(t),a=a?$:G(e),u=(c=c==B?H:c)==H,l=(a=a==B?H:a)==H;if((a=c==a)&&At(t)){if(!At(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 y=n;var d=r;var g=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&&g(new ut(p),new ut(h))?!0:!1;case X:case K:case Y:return Ct(+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=y&T;if(b=b||ot,p.size!=h.size&&!v)return!1;v=_.get(p);if(v)return v==h;y|=J,_.set(p,h);v=Mt(b(p),b(h),y,d,g,_);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,S=It(m),C=S.length,s=It(w).length;if(C!=s&&!I)return!1;for(var P=C;P--;){var A=S[P];if(!(I?A in w:D.call(w,A)))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);++P<C;){A=S[P];var x,R=m[A],E=w[A];if(!(void 0===(x=k?I?k(E,R,A,w,m,M):k(R,E,A,m,w,M):x)?R===E||O(R,E,j,k,M):x)){z=!1;break}L=L||"constructor"==A}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],y=e[u];if(void 0!==(h=r?s?r(y,f,u,e,t,i):r(f,y,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!==y&&!o(f,y,n,r,i)){l=!1;break}}return i.delete(t),i.delete(e),l}function It(t){var e=Tt,n=St;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}d.prototype.clear=function(){this.__data__=y?y(null):{},this.size=0},d.prototype.delete=function(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},d.prototype.get=function(t){var e,n=this.__data__;return y?(e=n[t])===r?void 0:e:D.call(n,t)?n[t]:void 0},d.prototype.has=function(t){var e=this.__data__;return y?void 0!==e[t]:D.call(e,t)},d.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=y&&void 0===e?r:e,this},g.prototype.clear=function(){this.__data__=[],this.size=0},g.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))},g.prototype.get=function(t){var e=this.__data__;return(t=v(e,t))<0?void 0:e[t][1]},g.prototype.has=function(t){return-1<v(this.__data__,t)},g.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 d,map:new(h||g),string:new d}},_.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 g,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 g){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 St=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 Ct(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())!=P||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 yt:return q;case dt:return F;case gt:return P;case _t:return N;case bt:return n}return e});var Pt=wt(function(){return arguments}())?wt:function(t){return W(t)&&D.call(t,"callee")&&!lt.call(t,"callee")},V=Array.isArray;var At=s||function(){return!1};function zt(t){if(xt(t))return(t=m(t))==I||t==S||t==M||t==A}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}$t.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++)d.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=g(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<d.length?(e=_(i=function(t){if(isNaN(t)){if("string"==typeof t)if(y[t]){var e=y[t];if(e.hueRange)return e.hueRange}else if(t.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i))return g(v(t)[0]).hueRange}else{e=parseInt(t);if(e<360&&0<e)return g(t).hueRange}return[0,360]}(t.hue)),n=(i[1]-i[0])/d.length,o=parseInt((e-i[0])/n),!0===d[o]?o=(o+2)%d.length:d[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(y[t]){e=y[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 g(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,y={},d=(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 g(t){for(var e in 334<=t&&t<=360&&(t-=360),y){var n=y[e];if(n.hueRange&&t>=n.hueRange[0]&&t<=n.hueRange[1])return y[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];y[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)});
@@ -1 +1 @@
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(u)return u(e,!0);throw(n=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",n}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 u="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:function(){}},t),this._btn=((n=document.createElement("button")).className="maplibregl-ctrl-icon maplibregl-ctrl-inspect",n.type="button",n["aria-label"]="Inspect",n),this._btn.onclick=t.onToggle,this.elem=(e=this._btn,n=t.show,(t=document.createElement("div")).className="maplibregl-ctrl maplibregl-ctrl-group",t.appendChild(e),n||(t.style.display="none"),t)}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){var r=t("./stylegen"),o=t("./InspectButton"),i=t("lodash.isequal"),s=t("./renderPopup"),a=t("./colors");function u(t){if(!(this instanceof u))throw new Error("MaplibreInspect needs to be called with the new keyword");var 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:{}},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)})}u.prototype.toggleInspector=function(){this._showInspectMap=!this._showInspectMap,this.render()},u.prototype._inspectStyle=function(){var t=r.generateColoredLayers(this.sources,this.assignLayerColor);return this.options.buildInspectStyle(this._map.getStyle(),t,{backgroundColor:this.options.backgroundColor})},u.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())},u.prototype._onSourceChange=function(t){var r=this.sources,o=this._map,e=o.getStyle(),n=Object.keys(e.sources),e=Object.assign({},r);"visibility"!==t.sourceDataType&&t.isSourceLoaded&&(Object.keys(o.style.sourceCaches).forEach(function(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(function(t){-1===n.indexOf(t)&&delete r[t]}),!i(e,r)&&0<Object.keys(r).length&&this.render())},u.prototype._onStyleChange=function(){var t,e=this._map.getStyle();(t=e).metadata&&t.metadata["maplibregl-inspect:inspect"]||(this._originalStyle=e)},u.prototype._onRightClick=function(){this.options.showMapPopupOnHover||this.options.showInspectMapPopupOnHover||this.options.blockHoverPopupOnClick||this._popup&&this._popup.remove()},u.prototype._onMousemove=function(t){if(this._showInspectMap){if(!this.options.showInspectMapPopup)return;if("mousemove"===t.type&&!this.options.showInspectMapPopupOnHover)return;"click"===t.type&&this.options.showInspectMapPopupOnHover&&this.options.blockHoverPopupOnClick&&(this._popupBlocked=!this._popupBlocked)}else{if(!this.options.showMapPopup)return;if("mousemove"===t.type&&!this.options.showMapPopupOnHover)return;"click"===t.type&&this.options.showMapPopupOnHover&&this.options.blockHoverPopupOnClick&&(this._popupBlocked=!this._popupBlocked)}var e;!this._popupBlocked&&this._popup&&(e=0===this.options.selectThreshold?t.point:[[t.point.x-this.options.selectThreshold,t.point.y+this.options.selectThreshold],[t.point.x+this.options.selectThreshold,t.point.y-this.options.selectThreshold]],e=this._map.queryRenderedFeatures(e,this.options.queryParameters)||[],this._map.getCanvas().style.cursor=e.length?"pointer":"",e.length?(this._popup.setLngLat(t.lngLat),"string"==typeof(e=this.options.renderPopup(e))?this._popup.setHTML(e):this._popup.setDOMContent(e),this._popup.addTo(this._map)):this._popup.remove())},u.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},u.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=u},{"./InspectButton":2,"./colors":4,"./renderPopup":5,"./stylegen":6,"lodash.isequal":7}],4:[function(t,e,n){var o=t("randomcolor");n.brightColor=function(t,e){var n="bright",r=null;return/water|ocean|lake|sea|river/.test(t)&&(r="blue"),/state|country|place/.test(t)&&(r="pink"),/road|highway|transport/.test(t)&&(r="orange"),/contour|building/.test(t)&&(r="monochrome"),/building/.test(t)&&(n="dark"),/contour|landuse/.test(t)&&(r="yellow"),/wood|forest|park|landcover/.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">'+(null==(e=e)?e:e instanceof Date?e.toLocaleString():"object"==typeof e||"number"==typeof e||"string"==typeof e?e.toString():e)+"</div></div>"}function r(t){return t.map(function(t){return'<div class="maplibregl-inspect_feature">'+(n='<div class="maplibregl-inspect_layer">'+((e=t).layer["source-layer"]||e.layer.source)+"</div>",r=o("$type",e.geometry.type),t=Object.keys(e.properties).map(function(t){return o(t,e.properties[t])}),[n,r].concat(t).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){t={id:[e,n,"circle"].join("_"),source:e,type:"circle",paint:{"circle-color":t,"circle-radius":2},filter:["==","$type","Point"]};return n&&(t["source-layer"]=n),t}function u(t,e,n,r){t={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&&(t["source-layer"]=r),t}function c(t,e,n){t={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&&(t["source-layer"]=n),t}n.polygonLayer=u,n.lineLayer=c,n.circleLayer=a,n.generateInspectStyle=function(n,t,e){var e={id:"background",type:"background",paint:{"background-color":(e=Object.assign({backgroundColor:"#fff"},e)).backgroundColor}},r={};return Object.keys(n.sources).forEach(function(t){var e=n.sources[t];"vector"!==e.type&&"geojson"!==e.type||(r[t]=e)}),Object.assign(n,{layers:[e].concat(t),soources:r})},n.generateColoredLayers=function(e,n){var 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(function(n){var t=e[n];t&&0!==t.length?t.forEach(function(t){var e=s(t);o.push(a(e.circle,n,t)),i.push(c(e.line,n,t)),r.push(u(e.polygon,e.polygonOutline,n,t))}):(t=s(n),o.push(a(t.circle,n)),i.push(c(t.line,n)),r.push(u(t.polygon,t.polygonOutline,n)))}),r.concat(i).concat(o)}},{}],7:[function(t,Ft,Ht){!function($t){!function(){var r="__lodash_hash_undefined__",b=1,y=2,h=9007199254740991,p="[object Arguments]",f="[object Array]",e="[object AsyncFunction]",d="[object Boolean]",g="[object Date]",_="[object Error]",n="[object Function]",o="[object GeneratorFunction]",v="[object Map]",m="[object Number]",i="[object Null]",w="[object Object]",s="[object Promise]",a="[object Proxy]",j="[object RegExp]",k="[object Set]",O="[object String]",M="[object Symbol]",u="[object Undefined]",c="[object WeakMap]",I="[object ArrayBuffer]",C="[object DataView]",l=/^\[object .+?Constructor\]$/,S=/^(?:0|[1-9]\d*)$/,A={};A["[object Float32Array]"]=A["[object Float64Array]"]=A["[object Int8Array]"]=A["[object Int16Array]"]=A["[object Int32Array]"]=A["[object Uint8Array]"]=A["[object Uint8ClampedArray]"]=A["[object Uint16Array]"]=A["[object Uint32Array]"]=!0,A[p]=A[f]=A[I]=A[d]=A[C]=A[g]=A[_]=A[n]=A[v]=A[m]=A[w]=A[j]=A[k]=A[O]=A[c]=!1;var t="object"==typeof $t&&$t&&$t.Object===Object&&$t,P="object"==typeof self&&self&&self.Object===Object&&self,z=t||P||Function("return this")(),L="object"==typeof Ht&&Ht&&!Ht.nodeType&&Ht,x=L&&"object"==typeof Ft&&Ft&&!Ft.nodeType&&Ft,R=x&&x.exports===L,E=R&&t.process,T=function(){try{return E&&E.binding&&E.binding("util")}catch(t){}}(),P=T&&T.isTypedArray;function B(t){var n=-1,r=Array(t.size);return t.forEach(function(t,e){r[++n]=[e,t]}),r}function $(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}var F,H,x=Array.prototype,L=Function.prototype,N=Object.prototype,t=z["__core-js_shared__"],q=L.toString,D=N.hasOwnProperty,U=(T=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+T:"",G=N.toString,V=RegExp("^"+q.call(D).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),L=R?z.Buffer:void 0,t=z.Symbol,W=z.Uint8Array,J=N.propertyIsEnumerable,X=x.splice,K=t?t.toStringTag:void 0,Q=Object.getOwnPropertySymbols,T=L?L.isBuffer:void 0,Y=(F=Object.keys,H=Object,function(t){return F(H(t))}),R=kt(z,"DataView"),Z=kt(z,"Map"),x=kt(z,"Promise"),L=kt(z,"Set"),z=kt(z,"WeakMap"),tt=kt(Object,"create"),et=It(R),nt=It(Z),rt=It(x),ot=It(L),it=It(z),t=t?t.prototype:void 0,st=t?t.valueOf:void 0;function at(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 ut(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 ct(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 lt(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new ct;++e<n;)this.add(t[e])}function pt(t){t=this.__data__=new ut(t);this.size=t.size}function ht(t,e){var n,r,o,i=At(t),s=!i&&St(t),a=!i&&!s&&Pt(t),u=!i&&!s&&!a&&Tt(t),c=i||s||a||u,l=c?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)||c&&("length"==n||a&&("offset"==n||"parent"==n)||u&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||(r=n,!!(o=null==(o=p)?h:o)&&("number"==typeof r||S.test(r))&&-1<r&&r%1==0&&r<o))||l.push(n);return l}function ft(t,e){for(var n=t.length;n--;)if(Ct(t[n][0],e))return n;return-1}function dt(t,e,n){e=e(t);return At(t)?e:function(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}(e,n(t))}function yt(t){return null==t?void 0===t?u:i:K&&K in Object(t)?function(t){var e=D.call(t,K),n=t[K];try{var r=!(t[K]=void 0)}catch(t){}var o=G.call(t);r&&(e?t[K]=n:delete t[K]);return o}(t):G.call(t)}function gt(t){return Rt(t)&&yt(t)==p}function _t(t,e,n,r,o){return t===e||(null==t||null==e||!Rt(t)&&!Rt(e)?t!=t&&e!=e:function(t,e,n,r,o,i){var s=At(t),a=At(e),u=s?f:Mt(t),c=a?f:Mt(e),l=(u=u==p?w:u)==w,a=(c=c==p?w:c)==w,c=u==c;if(c&&Pt(t)){if(!Pt(e))return!1;l=!(s=!0)}if(c&&!l)return i=i||new pt,s||Tt(t)?mt(t,e,n,r,o,i):function(t,e,n,r,o,i,s){switch(n){case C:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case I:return t.byteLength==e.byteLength&&i(new W(t),new W(e))?!0:!1;case d:case g:case m:return Ct(+t,+e);case _:return t.name==e.name&&t.message==e.message;case j:case O:return t==e+"";case v:var a=B;case k:var u=r&b;if(a=a||$,t.size!=e.size&&!u)return!1;u=s.get(t);if(u)return u==e;r|=y,s.set(t,e);a=mt(a(t),a(e),r,o,i,s);return s.delete(t),a;case M:if(st)return st.call(t)==st.call(e)}return!1}(t,e,u,n,r,o,i);if(!(n&b)){l=l&&D.call(t,"__wrapped__"),a=a&&D.call(e,"__wrapped__");if(l||a){l=l?t.value():t,a=a?e.value():e;return i=i||new pt,o(l,a,n,r,i)}}return c&&(i=i||new pt,function(t,e,n,r,o,i){var s=n&b,a=wt(t),u=a.length,c=wt(e).length;if(u!=c&&!s)return!1;var l=u;for(;l--;){var p=a[l];if(!(s?p in e:D.call(e,p)))return!1}var h=i.get(t);if(h&&i.get(e))return h==e;var f=!0;i.set(t,e),i.set(e,t);var d=s;for(;++l<u;){p=a[l];var y,g=t[p],_=e[p];if(!(void 0===(y=r?s?r(_,g,p,e,t,i):r(g,_,p,t,e,i):y)?g===_||o(g,_,n,r,i):y)){f=!1;break}d=d||"constructor"==p}f&&!d&&(c=t.constructor,h=e.constructor,c!=h&&"constructor"in t&&"constructor"in e&&!("function"==typeof c&&c instanceof c&&"function"==typeof h&&h instanceof h)&&(f=!1));return i.delete(t),i.delete(e),f}(t,e,n,r,o,i))}(t,e,n,r,_t,o))}function bt(t){var e;return xt(t)&&(e=t,!(U&&U in e))&&(zt(t)?V:l).test(It(t))}function vt(t){if(n="function"==typeof(n=(e=t)&&e.constructor)&&n.prototype||N,e!==n)return Y(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&b,a=t.length,u=e.length;if(a!=u&&!(s&&a<u))return!1;u=i.get(t);if(u&&i.get(e))return u==e;var c=-1,l=!0,p=n&y?new lt:void 0;for(i.set(t,e),i.set(e,t);++c<a;){var h,f=t[c],d=e[c];if(void 0!==(h=r?s?r(d,f,c,e,t,i):r(f,d,c,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 wt(t){return dt(t,Bt,Ot)}function jt(t,e){var n,r=t.__data__;return("string"==(t=typeof(n=e))||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==n:null===n)?r["string"==typeof e?"string":"hash"]:r.map}function kt(t,e){e=e,e=null==(t=t)?void 0:t[e];return bt(e)?e:void 0}at.prototype.clear=function(){this.__data__=tt?tt(null):{},this.size=0},at.prototype.delete=function(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},at.prototype.get=function(t){var e=this.__data__;if(tt){var n=e[t];return n===r?void 0:n}return D.call(e,t)?e[t]:void 0},at.prototype.has=function(t){var e=this.__data__;return tt?void 0!==e[t]:D.call(e,t)},at.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=tt&&void 0===e?r:e,this},ut.prototype.clear=function(){this.__data__=[],this.size=0},ut.prototype.delete=function(t){var e=this.__data__;return!((t=ft(e,t))<0)&&(t==e.length-1?e.pop():X.call(e,t,1),--this.size,!0)},ut.prototype.get=function(t){var e=this.__data__;return(t=ft(e,t))<0?void 0:e[t][1]},ut.prototype.has=function(t){return-1<ft(this.__data__,t)},ut.prototype.set=function(t,e){var n=this.__data__,r=ft(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},ct.prototype.clear=function(){this.size=0,this.__data__={hash:new at,map:new(Z||ut),string:new at}},ct.prototype.delete=function(t){return t=jt(this,t).delete(t),this.size-=t?1:0,t},ct.prototype.get=function(t){return jt(this,t).get(t)},ct.prototype.has=function(t){return jt(this,t).has(t)},ct.prototype.set=function(t,e){var n=jt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},lt.prototype.add=lt.prototype.push=function(t){return this.__data__.set(t,r),this},lt.prototype.has=function(t){return this.__data__.has(t)},pt.prototype.clear=function(){this.__data__=new ut,this.size=0},pt.prototype.delete=function(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t},pt.prototype.get=function(t){return this.__data__.get(t)},pt.prototype.has=function(t){return this.__data__.has(t)},pt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof ut){var r=n.__data__;if(!Z||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new ct(r)}return n.set(t,e),this.size=n.size,this};var Ot=Q?function(e){return null==e?[]:(e=Object(e),function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var s=t[n];e(s,n,t)&&(i[o++]=s)}return i}(Q(e),function(t){return J.call(e,t)}))}:function(){return[]},Mt=yt;function It(t){if(null!=t){try{return q.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Ct(t,e){return t===e||t!=t&&e!=e}(R&&Mt(new R(new ArrayBuffer(1)))!=C||Z&&Mt(new Z)!=v||x&&Mt(x.resolve())!=s||L&&Mt(new L)!=k||z&&Mt(new z)!=c)&&(Mt=function(t){var e=yt(t),t=e==w?t.constructor:void 0,t=t?It(t):"";if(t)switch(t){case et:return C;case nt:return v;case rt:return s;case ot:return k;case it:return c}return e});var St=gt(function(){return arguments}())?gt:function(t){return Rt(t)&&D.call(t,"callee")&&!J.call(t,"callee")},At=Array.isArray;var Pt=T||function(){return!1};function zt(t){if(xt(t)){t=yt(t);return t==n||t==o||t==e||t==a}}function Lt(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=h}function xt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Rt(t){return null!=t&&"object"==typeof t}var Et,Tt=P?(Et=P,function(t){return Et(t)}):function(t){return Rt(t)&&Lt(t.length)&&!!A[yt(t)]};function Bt(t){return(null!=(e=t)&&Lt(e.length)&&!zt(e)?ht:vt)(t);var e}Ft.exports=function(t,e){return _t(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(){var a=null,u={};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 c(t){if(void 0!==(t=t||{}).seed&&null!==t.seed&&t.seed===parseInt(t.seed,10))a=t.seed;else if("string"==typeof t.seed)a=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");a=null}var e,n;if(null===t.count||void 0===t.count)return function(t,e){switch(e.format){case"hsvArray":return t;case"hslArray":return y(t);case"hsl":var n=y(t);return"hsl("+n[0]+", "+n[1]+"%, "+n[2]+"%)";case"hsla":var r=y(t),o=e.alpha||Math.random();return"hsla("+r[0]+", "+r[1]+"%, "+r[2]+"%, "+o+")";case"rgbArray":return f(t);case"rgb":return"rgb("+f(t).join(", ")+")";case"rgba":r=f(t),o=e.alpha||Math.random();return"rgba("+r.join(", ")+", "+o+")";default:return function(t){t=f(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])}(t)}}([e=function(t){{if(0<l.length){var e=h(i=function(t){if(isNaN(t)){if("string"==typeof t)if(u[t]){var e=u[t];if(e.hueRange)return e.hueRange}else if(t.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i))return p(d(t)[0]).hueRange}else{e=parseInt(t);if(e<360&&0<e)return p(t).hueRange}return[0,360]}(t.hue)),n=(i[1]-i[0])/l.length,r=parseInt((e-i[0])/n);!0===l[r]?r=(r+2)%l.length:l[r]=!0;var o=(i[0]+r*n)%359,n=(i[0]+(r+1)*n)%359;return e=(e=h(i=[o,n]))<0?360+e:e}var 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(u[t]){e=u[t];if(e.hueRange)return e.hueRange}else if(t.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i)){t=d(t)[0];return[t,t]}return[0,360]}(t.hue);return e=(e=h(i))<0?360+e:e}}(t),n=function(t,e){if("monochrome"===e.hue)return 0;if("random"===e.luminosity)return h([0,100]);var t=function(t){return p(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 h([n,r])}(e,t),function(t,e,n){var r=function(t,e){for(var n=p(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){s=(a-i)/(s-o);return s*e+(i-s*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 h([r,o])}(e,n,t)],t);for(var r=t.count,o=[],i=0;i<t.count;i++)l.push(!1);for(t.count=null;r>o.length;){var s=c(t);null!==a&&(t.seed=a),o.push(s)}return t.count=r,o}var l=[];function p(t){for(var e in 334<=t&&t<=360&&(t-=360),u){var n=u[e];if(n.hueRange&&t>=n.hueRange[0]&&t<=n.hueRange[1])return u[e]}return"Color not found"}function h(t){if(null===a){var e=Math.random();return e+=.618033988749895,e%=1,Math.floor(t[0]+e*(t[1]+1-t[0]))}var n=t[1]||1,e=t[0]||0,t=(a=(9301*a+49297)%233280)/233280;return Math.floor(e+t*(n-e))}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];u[t]={hueRange:e,lowerBounds:n,saturationRange:[r,o],brightnessRange:[i,s]}}function f(t){var e=t[0];360===(e=0===e?1:e)&&(e=359),e/=360;var n=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,u=256,c=256;switch(t){case 0:a=r,u=s,c=o;break;case 1:a=i,u=r,c=o;break;case 2:a=o,u=r,c=s;break;case 3:a=o,u=i,c=r;break;case 4:a=s,u=o,c=r;break;case 5:a=r,u=o,c=i}return[Math.floor(255*a),Math.floor(255*u),Math.floor(255*c)]}function d(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 y(t){var e=t[0],n=t[1]/100,r=t[2]/100,t=(2-n)*r;return[e,Math.round(n*r/(t<1?t:2-t)*1e4)/100,t/2*100]}return c},"object"==typeof n?(i=o(),(n="object"==typeof e&&e&&e.exports?e.exports=i:n).randomColor=i):r.randomColor=o()},{}]},{},[1])(1)});
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 o(r,i,s){function a(e,t){if(!i[e]){if(!r[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:{}},r[e][0].call(n.exports,function(t){return a(r[e][1][t]||t)},n,n.exports,o,r,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 o(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)}o.prototype.setInspectIcon=function(){this._btn.className="maplibregl-ctrl-icon maplibregl-ctrl-inspect"},o.prototype.setMapIcon=function(){this._btn.className="maplibregl-ctrl-icon maplibregl-ctrl-map"},e.exports=o},{}],3:[function(t,e,n){const o=t("./stylegen"),r=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:o.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 r({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=o.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 o=this.sources,r=this._map;var e=r.getStyle();const n=Object.keys(e.sources);e=Object.assign({},o);"visibility"!==t.sourceDataType&&t.isSourceLoaded&&(Object.keys(r.style.sourceCaches).forEach(t=>{var e=r.style.sourceCaches[t]||{_source:{}},n=e._source.vectorLayerIds;n?o[t]=n:"geojson"===e._source.type&&(o[t]=[])}),Object.keys(o).forEach(t=>{-1===n.indexOf(t)&&delete o[t]}),!i(e,o))&&0<Object.keys(o).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 r=t("randomcolor");n.brightColor=function(t,e){let n="bright",o=null;return/water|ocean|lake|sea|river/.test(t)&&(o="blue"),/state|country|place/.test(t)&&(o="pink"),/road|highway|transport|streets/.test(t)&&(o="orange"),/contour|building/.test(t)&&(o="monochrome"),/building/.test(t)&&(n="dark"),/contour|landuse/.test(t)&&(o="yellow"),/wood|forest|park|landcover|land/.test(t)&&(o="green"),`rgba(${r({luminosity:n,hue:o,seed:t,format:"rgbArray"}).concat([e||1]).join(", ")})`}},{randomcolor:8}],5:[function(t,e,n){function r(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 o(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=r("$type",e.geometry.type),o=Object.keys(e.properties).map(t=>r(t,e.properties[t])),[t,n].concat(o).join("")}</div>`;var e,n,o}).join("")}e.exports=function(t){return`<div class="maplibregl-inspect_popup">${o(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,o){n={id:[n,o,"polygon"].join("_"),source:n,type:"fill",paint:{"fill-color":t,"fill-antialias":!0,"fill-outline-color":t},filter:["==","$type","Polygon"]};return o&&(n["source-layer"]=o),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 o={};return Object.keys(n.sources).forEach(t=>{var e=n.sources[t];"vector"!==e.type&&"geojson"!==e.type||(o[t]=e)}),Object.assign(n,{layers:[e].concat(t),sources:o})},n.generateColoredLayers=function(e,n){const o=[],r=[],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);r.push(a(e.circle,n,t)),i.push(u(e.line,n,t)),o.push(c(e.polygon,e.polygonOutline,n,t))}):(t=s(n),r.push(a(t.circle,n)),i.push(u(t.line,n)),o.push(c(t.polygon,t.polygonOutline,n)))}),o.concat(i).concat(r)}},{}],7:[function(t,Bt,Ft){!function($t){!function(){var o="__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),r="object"==typeof self&&self&&self.Object===Object&&self,r=t||r||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 ot(t){var n=-1,o=Array(t.size);return t.forEach(function(t,e){o[++n]=[e,t]}),o}function rt(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=r["__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?r.Buffer:void 0,c=r.Symbol,ut=r.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(r,"DataView"),h=j(r,"Map"),l=j(r,"Promise"),f=j(r,"Set"),r=j(r,"WeakMap"),d=j(Object,"create"),dt=k(i),gt=k(h),yt=k(l),_t=k(f),bt=k(r),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 o=t[e];this.set(o[0],o[1])}}function y(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[1])}}function _(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var o=t[e];this.set(o[0],o[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,o,r,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,o=Array(t);++n<t;)o[n]=e(n);return o}(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)||(o=n,(r=null==(r=p)?O:r)&&("number"==typeof o||x.test(o))&&-1<o&&o%1==0&&o<r))||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),o=e[p];try{var r=!(e[p]=void 0)}catch(t){}var i=at.call(e);return r&&(n?e[p]=o:delete e[p]),i}return at.call(t)}function wt(t){return W(t)&&m(t)==$}function jt(t,e,n,o,r){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){r=r||new U;if(s||Et(t))return Mt(t,e,n,o,i,r);else{var p=t;var h=e;var f=c;var d=n;var g=o;var y=i;var _=r;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=ot;case N:var v=d&T;if(b=b||rt,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,r=r||new U,i(u,l,n,o,r)}if(a){r=r||new U;var m=t,w=e,j=n,k=o,O=i,M=r,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,o,r=[];for(o in Object(t))D.call(t,o)&&"constructor"!=o&&r.push(o);return r}function Mt(t,e,n,o,r,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=o?s?o(d,f,u,e,t,i):o(f,d,u,t,e,i):h)){if(h)continue;l=!1;break}if(p){if(!function(t,e){for(var n=-1,o=null==t?0:t.length;++n<o;)if(e(t[n],n,t))return 1}(e,function(t,e){return!p.has(e)&&(f===t||r(f,t,n,o,i))&&p.push(e)})){l=!1;break}}else if(f!==d&&!r(f,d,n,o,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 o=e,r=n(t),i=-1,s=r.length,a=o.length;++i<s;)o[a+i]=r[i];return o}function w(t,e){var n,o,t=t.__data__;return("string"==(o=typeof(n=e))||"number"==o||"symbol"==o||"boolean"==o?"__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])===o?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?o: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__,o=v(n,t);return o<0?(++this.size,n.push([t,e])):n[o][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),o=n.size;return n.set(t,e),this.size+=n.size==o?0:1,this},b.prototype.add=b.prototype.push=function(t){return this.__data__.set(t,o),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 o=n.__data__;if(!h||o.length<199)return o.push([t,e]),this.size=++n.size,this;n=this.__data__=new _(o)}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)},o=-1,r=null==t?0:t.length,i=0,s=[];++o<r;){var a=t[o];n(a,o,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||r&&G(new r)!=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 o,r,i;o=this,r=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 o=t.count,r=[],i=0;i<t.count;i++)g.push(!1);for(t.count=null;r.length<o;){var s=h(t);null!==f&&(t.seed=f),r.push(s)}return t.count=o,r}var a=function(t,e,n){var o=function(t,e){for(var n=y(t).lowerBounds,o=0;o<n.length-1;o++){var r=n[o][0],i=n[o][1],s=n[o+1][0],a=n[o+1][1];if(r<=e&&e<=s)return(a=(a-i)/(s-r))*e+(i-a*r)}return 0}(t,e),r=100;switch(n.luminosity){case"dark":r=o+20;break;case"light":o=(r+o)/2;break;case"random":o=0,r=100}return _([o,r])}(e=function(t){{var e,n,o,r,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,r=parseInt((e-i[0])/n),!0===g[r]?r=(r+2)%g.length:g[r]=!0,o=(i[0]+r*n)%359,r=(i[0]+(r+1)*n)%359,(e=_(i=[o,r]))<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],o=t[1];switch(e.luminosity){case"bright":n=55;break;case"dark":n=o-10;break;case"light":o=55}return _([n,o])}(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 o=n[0][0],r=n[n.length-1][0],i=n[n.length-1][1],s=n[0][1];d[t]={hueRange:e,lowerBounds:n,saturationRange:[o,r],brightnessRange:[i,s]}}function b(t){var e=t[0],n=(360===(e=0===e?1:e)&&(e=359),e/=360,t[1]/100),o=t[2]/100,t=Math.floor(6*e),e=6*e-t,r=o*(1-n),i=o*(1-e*n),s=o*(1-(1-e)*n),a=256,c=256,u=256;switch(t){case 0:a=o,c=s,u=r;break;case 1:a=i,c=o,u=r;break;case 2:a=r,c=o,u=s;break;case 3:a=r,c=i,u=o;break;case 4:a=s,c=r,u=o;break;case 5:a=o,c=r,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,o=parseInt(t.substr(4,2),16)/255,r=Math.max(e,n,o),i=r-Math.min(e,n,o),s=r?i/r:0;switch(r){case e:return[(n-o)/i%6*60||0,s,r];case n:return[60*((o-e)/i+2)||0,s,r];case o:return[60*((e-n)/i+4)||0,s,r]}}function m(t){var e=t[0],n=t[1]/100,t=t[2]/100,o=(2-n)*t;return[e,Math.round(n*t/(o<1?o:2-o)*1e4)/100,o/2*100]}return h},"object"==typeof n?(i=r(),(n="object"==typeof e&&e&&e.exports?e.exports=i:n).randomColor=i):o.randomColor=r()},{}]},{},[1])(1)});
@@ -61,52 +61,52 @@
61
61
  selectThreshold: 5
62
62
  }));
63
63
  } else {
64
- var map = L.map('map', { zoomControl: false });
65
- new L.Control.Zoom({ position: 'topright' }).addTo(map);
66
-
67
- var tile_urls = [], tile_attribution, tile_minzoom, tile_maxzoom;
68
- var url = '{{public_url}}styles/{{id}}.json' + keyParam;
69
- var req = new XMLHttpRequest();
70
- req.overrideMimeType("application/json");
71
- req.open('GET', url, true);
72
- req.onload = function() {
73
- var jsonResponse = JSON.parse(req.responseText);
74
- for (key in jsonResponse) {
75
- var keyl = key.toLowerCase();
76
- switch(keyl) {
77
- case "tiles":
78
- tile_urls = jsonResponse[key];
79
- break;
80
- case "attribution":
81
- tile_attribution = jsonResponse[key];
82
- break;
83
- case "minzoom":
84
- tile_minzoom = jsonResponse[key];
85
- break;
86
- case "maxzoom":
87
- tile_maxzoom = jsonResponse[key];
88
- break;
89
- }
90
- }
64
+ var map = L.map('map', { zoomControl: false });
65
+ new L.Control.Zoom({ position: 'topright' }).addTo(map);
66
+
67
+ var tile_urls = [], tile_attribution, tile_minzoom, tile_maxzoom;
68
+ var url = '{{public_url}}styles/{{id}}.json' + keyParam;
69
+ var req = new XMLHttpRequest();
70
+ req.overrideMimeType("application/json");
71
+ req.open('GET', url, true);
72
+ req.onload = function() {
73
+ var jsonResponse = JSON.parse(req.responseText);
74
+ for (key in jsonResponse) {
75
+ var keyl = key.toLowerCase();
76
+ switch(keyl) {
77
+ case "tiles":
78
+ tile_urls = jsonResponse[key];
79
+ break;
80
+ case "attribution":
81
+ tile_attribution = jsonResponse[key];
82
+ break;
83
+ case "minzoom":
84
+ tile_minzoom = jsonResponse[key];
85
+ break;
86
+ case "maxzoom":
87
+ tile_maxzoom = jsonResponse[key];
88
+ break;
89
+ }
90
+ }
91
91
 
92
- for (tile_url in tile_urls) {
93
- L.tileLayer(tile_urls[tile_url], {
94
- minZoom: tile_minzoom,
95
- maxZoom: tile_maxzoom,
96
- attribution: tile_attribution
97
- }).addTo(map);
98
- }
99
-
100
- map.eachLayer(function(layer) {
101
- // do not add scale prefix even if retina display is detected
102
- layer.scalePrefix = '.';
103
- });
104
- };
105
- req.send(null);
92
+ for (tile_url in tile_urls) {
93
+ L.tileLayer(tile_urls[tile_url], {
94
+ minZoom: tile_minzoom,
95
+ maxZoom: tile_maxzoom,
96
+ attribution: tile_attribution
97
+ }).addTo(map);
98
+ }
99
+
100
+ map.eachLayer(function(layer) {
101
+ // do not add scale prefix even if retina display is detected
102
+ layer.scalePrefix = '.';
103
+ });
104
+ };
105
+ req.send(null);
106
106
 
107
- setTimeout(function() {
108
- new L.Hash(map);
109
- }, 0);
107
+ setTimeout(function() {
108
+ new L.Hash(map);
109
+ }, 0);
110
110
  }
111
111
  </script>
112
112
  </body>