/*! * * ol-mapbox-style * Copyright 2016-present Boundless Spatial * Copyright© 2000-2018 SuperMap Software Co. Ltd * github: https://github.com/boundlessgeo/ol-mapbox-style * github: https://github.com/SuperMap/ol-mapbox-style * license: BSD 2-Clause "Simplified" License * version: v3.0.0-beta.7 * */ olms=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=35)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=function(e,t,n,o,f,p,y,m){if(!o){o=[];for(var O=78271.51696402048;o.length<21;O/=2)o.push(O)}if("string"==typeof t&&(t=JSON.parse(t)),8!=t.version)throw new Error("glStyle version 8 required.");if(p&&!y){var A=new Image;A.crossOrigin="anonymous",A.onload=function(){y=A,[A.width,A.height],e.changed()},A.src=p}var F=document.createElement("CANVAS").getContext("2d"),I={};function L(e,t,n){var o=n+","+t+","+e,r=I[o];if(!r){F.font=t;for(var a=F.measureText("M").width*n,i=e.split(" "),l="",s=[],u=0,c=i.length;u=I.maxzoom)){e.styleIds[p]=e.styleIds[p]||[];var z=I.filter,j=void 0,E=void 0;if(!z||C(G,z,b)){var Z=void 0,K=void 0,J=void 0,U=void 0,_=void 0,W=void 0,Y=F.index;if(3==m)if("fill-pattern"in B){var Q=x(G,B,"fill-pattern",p,n);if(Q&&(j=T(Q,n),y&&f&&f[j])){++O,-1===e.styleIds[p].indexOf(G)&&e.styleIds[p].push(G),(W=H[O])&&W.getFill()&&!W.getStroke()&&!W.getText()||(W=H[O]=new r.default({fill:new a.default})),J=W.getFill(),W.setZIndex(Y);var $=V[j];if(!$){var X=f[j],ee=document.createElement("canvas");ee.width=X.width,ee.height=X.height;var te=ee.getContext("2d");te.drawImage(y,X.x,X.y,X.width,X.height,0,0,X.width,X.height),$=te.createPattern(ee,"repeat"),V[j]=$}J.setColor($)}}else"fill-color"in B&&(K=x(G,B,"fill-opacity",p,n),(Z=P(x(G,B,"fill-color",p,n),K))&&(++O,-1===e.styleIds[p].indexOf(G)&&e.styleIds[p].push(G),(W=H[O])&&W.getFill()&&!W.getStroke()&&!W.getText()||(W=H[O]=new r.default({fill:new a.default})),(J=W.getFill()).setColor(Z),W.setZIndex(Y)),"fill-outline-color"in B?_=P(x(G,B,"fill-outline-color",p,n),K):"fill-antialias"in B&&(_=Z),_&&(++O,-1===e.styleIds[p].indexOf(G)&&e.styleIds[p].push(G),(W=H[O])&&W.getStroke()&&!W.getFill()&&!W.getText()||(W=H[O]=new r.default({stroke:new i.default})),(U=W.getStroke()).setLineCap(v["line-cap"]),U.setLineJoin(v["line-join"]),U.setMiterLimit(v["line-miter-limit"]),U.setColor(_),U.setWidth(1),U.setLineDash(null),W.setZIndex(Y)));1!=m&&function(){Z=!("line-pattern"in B)&&"line-color"in B?P(x(G,B,"line-color",p,n),x(G,B,"line-opacity",p,n)):void 0;var t=x(G,B,"line-width",p,n);Z&&t>0&&(++O,-1===e.styleIds[p].indexOf(G)&&e.styleIds[p].push(G),(W=H[O])&&W.getStroke()&&!W.getFill()&&!W.getText()||(W=H[O]=new r.default({stroke:new i.default})),(U=W.getStroke()).setLineCap(x(G,D,"line-cap",p,n)),U.setLineJoin(x(G,D,"line-join",p,n)),U.setMiterLimit(x(G,D,"line-miter-limit",p,n)),U.setColor(Z),U.setWidth(t),U.setLineDash(B["line-dasharray"]?x(G,B,"line-dasharray",p,n).map(function(e){return e*t}):null),W.setZIndex(Y))}();var ne=!1,oe=null,re=void 0;if((1==m||2==m)&&"icon-image"in D){var ae=x(G,D,"icon-image",p,n);if(ae){j=T(ae,n);var ie=void 0;if(y&&f&&f[j]){if(2==m){var le=e.getGeometry();if(le.getFlatMidpoint){var se=le.getExtent();Math.sqrt(Math.max(Math.pow((se[2]-se[0])/t,2),Math.pow((se[3]-se[1])/t,2)))>150&&(ie=new c.default(le.getFlatMidpoint()))}}if(2!==m||ie){++O,-1===e.styleIds[p].indexOf(G)&&e.styleIds[p].push(G),(W=H[O])&&W.getImage()&&!W.getFill()&&!W.getStroke()||(W=H[O]=new r.default),W.setGeometry(ie);var ue=x(G,D,"icon-size",p,n),ce=void 0!==B["icon-color"]?x(G,B,"icon-color",p,n):null,de=x(G,B,"icon-translate",p,n),fe=x(G,B,"icon-translate-anchor",p,n),pe=x(G,D,"icon-anchor",p,n),ge=x(G,D,"icon-offset",p,n),he=w(pe),ye=he.anchorOffset,me=he.iconAnchor,ve=void 0===me?pe:me,Se=j+"."+ue+"."+de+"."+fe+"."+ve+"."+ge;if(null!==ce&&(Se+="."+ce),!(E=q[Se])){var be=f[j],xe=document.createElement("canvas");xe.width=be.width,xe.height=be.height;var we=xe.getContext("2d");we.drawImage(y,be.x,be.y,be.width,be.height,0,0,be.width,be.height);var Oe=we.getImageData(0,0,xe.width,xe.height);if(null!==ce){Z=P(ce,1);for(var ke=0,Me=Oe.data.length;ke-1?(H.length=O+1,H):void 0}};return e.setStyle(U),e.set("mapbox-source",B),e.set("mapbox-layers",D),U};var r=y(n(27)),a=y(n(26)),i=y(n(25)),l=y(n(24)),s=y(n(23)),u=y(n(22)),c=y(n(21)),d=y(n(20)),f=y(n(2)),p=y(n(18)),g=y(n(1)),h=n(17);function y(e){return e&&e.__esModule?e:{default:e}}var m={"line-miter-limit":"interpolated","fill-opacity":"interpolated","line-opacity":"interpolated","line-width":"interpolated","text-halo-width":"interpolated","text-max-width":"interpolated","text-offset":"interpolated","text-opacity":"interpolated","text-rotate":"interpolated","text-size":"interpolated","icon-opacity":"interpolated","icon-rotate":"interpolated","icon-anchor":"interpolated","icon-offset":"interpolated","icon-translate":"interpolated","icon-translate-anchor":"interpolated","icon-size":"interpolated","icon-color":"interpolated","circle-radius":"interpolated","circle-opacity":"interpolated","circle-stroke-opacity":"interpolated","circle-stroke-width":"interpolated","circle-color":"interpolated","circle-stroke-color":"interpolated","text-halo-color":"interpolated","text-color":"interpolated","line-color":"interpolated","fill-outline-color":"interpolated","fill-color":"interpolated","icon-image":"piecewise-constant","line-cap":"piecewise-constant","line-join":"piecewise-constant","line-dasharray":"piecewise-constant","symbol-placement":"piecewise-constant","text-anchor":"piecewise-constant","text-field":"piecewise-constant","text-font":"piecewise-constant"},v={"fill-opacity":1,"line-cap":"butt","line-join":"miter","line-miter-limit":2,"line-opacity":1,"line-width":1,"symbol-placement":"point","text-anchor":"center","text-color":"#000000","text-font":["Open Sans Regular","Arial Unicode MS Regular"],"text-halo-color":"rgba(0, 0, 0, 0)","text-halo-width":0,"text-max-width":10,"text-offset":[0,0],"text-translate":[0,0],"text-opacity":1,"text-rotate":0,"text-size":16,"icon-opacity":1,"icon-rotate":0,"icon-offset":[0,0],"icon-translate":[0,0],"icon-translate-anchor":"map","icon-anchor":"center","icon-size":1,"circle-color":"#000000","circle-stroke-color":"#000000","circle-opacity":1,"circle-stroke-opacity":1,"circle-stroke-width":0},S={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},b={};function x(e,t,n,r,a){b[e]||(b[e]={});var i=b[e];if(!i[n]){var l=t[n];void 0===l&&(l=v[n]),i[n]=(0,f.default)(l,{function:m[n],type:-1!==n.indexOf("color")?"color":"object"==(void 0===l?"undefined":o(l))&&l.stops&&"number"==typeof l.stops[0][0]?"number":void 0})}return i[n](r,a)}function w(e){var t=[.5,.5];return["top-left","top-right","bottom-left","bottom-right"].includes(e)&&(t=[0,0]),"left"===e&&(e="top-left",t=[0,.5]),"right"===e&&(e="top-left",t=[1,.5]),"bottom"===e&&(e="top-left",t=[.5,1]),"top"===e&&(e="top-left",t=[.5,0]),{anchorOffset:t,iconAnchor:e}}var O={};function k(e,t){if(O[e])return O[e];if(t){for(var n=0,o=e.length;n=e.stops[o-1][0])return e.stops[o-1][1];var r=h(e.stops,n);return e.stops[r][1]}function p(e,t,n){var o=void 0!==e.base?e.base:1;if("number"!==l(n))return c(e.default,t.default);var r=e.stops.length;if(1===r)return e.stops[0][1];if(n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[r-1][0])return e.stops[r-1][1];var a=h(e.stops,n),i=m(n,o,e.stops[a][0],e.stops[a+1][0]),d=e.stops[a][1],f=e.stops[a+1][1],p=s[t.type]||u;return"function"==typeof d?function(){for(var e=arguments.length,t=Array(e),n=0;na&&tt&&(o=r-1)}return Math.max(r-1,0)}function y(e){return"object"===(void 0===e?"undefined":o(e))&&(e.stops||"identity"===e.type)}function m(e,t,n,o){var r=o-n,a=e-n;return 0===r?0:1===t?a/r:(Math.pow(t,a)-1)/(Math.pow(t,r)-1)}e.exports=function e(t,n){var l="color"===n.type,s=void 0;if(y(t)){var h=t.stops&&"object"===o(t.stops[0][0]),m=h||void 0!==t.property,v=h||!m,S=t.type||("interpolated"===n.function?"exponential":"interval");l&&((t=i({},t)).stops&&(t.stops=t.stops.map(function(e){return[e[0],a(e[1])]})),t.default?t.default=a(t.default):t.default=a(n.default));var b=void 0,x=void 0,w=void 0;if("exponential"===S)b=p;else if("interval"===S)b=f;else if("categorical"===S){b=d,x=Object.create(null);var O=!0,k=!1,M=void 0;try{for(var C,A=t.stops[Symbol.iterator]();!(O=(C=A.next()).done);O=!0){var P=C.value;x[P[0]]=P[1]}}catch(e){k=!0,M=e}finally{try{!O&&A.return&&A.return()}finally{if(k)throw M}}w=o(t.stops[0][0])}else{if("identity"!==S)throw new Error('Unknown function type "'+S+'"');b=g}var F=void 0;if(t.colorSpace&&"rgb"!==t.colorSpace){if(!r[t.colorSpace])throw new Error("Unknown color space: "+t.colorSpace);var T=r[t.colorSpace];t=JSON.parse(JSON.stringify(t));for(var R=0;R"===t||"<="===t||">="===t?i(e[1],e[2],t,!0):"any"===t?l(e.slice(1),"||"):"all"===t?l(e.slice(1),"&&"):"none"===t?c(l(e.slice(1),"||")):"in"===t?s(e[1],e.slice(2)):"!in"===t?c(s(e[1],e.slice(2))):"has"===t?u(e[1]):"!has"===t?c(u(e[1])):"true")+")"}function a(e){return"$type"===e?"f.type":"$id"===e?"f.id":"p["+JSON.stringify(e)+"]"}function i(e,t,n,r){var i=a(e),l="$type"===e?o.indexOf(t):JSON.stringify(t);return(r?"typeof "+i+"=== typeof "+l+"&&":"")+i+n+l}function l(e,t){return e.map(r).join(t)}function s(e,t){"$type"===e&&(t=t.map(function(e){return o.indexOf(e)}));var n=JSON.stringify(t.sort(d)),r=a(e);return t.length<=200?n+".indexOf("+r+") !== -1":"function(v, a, i, j) {while (i <= j) { var m = (i + j) >> 1; if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;}return false; }("+r+", "+n+",0,"+(t.length-1)+")"}function u(e){return"$id"===e?'"id" in f':JSON.stringify(e)+" in p"}function c(e){return"!("+e+")"}function d(e,t){return et?1:0}},function(e,t,n){"use strict";e.exports=["type","source","source-layer","minzoom","maxzoom","filter","layout"]},function(e,t,n){"use strict";var o=n(19);function r(e,t){var n={};for(var r in e)"ref"!==r&&(n[r]=e[r]);return o.forEach(function(e){e in t&&(n[e]=t[e])}),n}e.exports=function(e){e=e.slice();for(var t=Object.create(null),n=0;n1?t-1:0),o=1;o255?255:e}function a(e){return e<0?0:e>1?1:e}function i(e){return"%"===e[e.length-1]?r(parseFloat(e)/100*255):r(parseInt(e))}function l(e){return"%"===e[e.length-1]?a(parseFloat(e)/100):a(parseFloat(e))}function s(e,t,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?e+(t-e)*n*6:2*n<1?t:3*n<2?e+(t-e)*(2/3-n)*6:e}try{t.parseCSSColor=function(e){var t,n=e.replace(/ /g,"").toLowerCase();if(n in o)return o[n].slice();if("#"===n[0])return 4===n.length?(t=parseInt(n.substr(1),16))>=0&&t<=4095?[(3840&t)>>4|(3840&t)>>8,240&t|(240&t)>>4,15&t|(15&t)<<4,1]:null:7===n.length&&(t=parseInt(n.substr(1),16))>=0&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var a=n.indexOf("("),u=n.indexOf(")");if(-1!==a&&u+1===n.length){var c=n.substr(0,a),d=n.substr(a+1,u-(a+1)).split(","),f=1;switch(c){case"rgba":if(4!==d.length)return null;f=l(d.pop());case"rgb":return 3!==d.length?null:[i(d[0]),i(d[1]),i(d[2]),f];case"hsla":if(4!==d.length)return null;f=l(d.pop());case"hsl":if(3!==d.length)return null;var p=(parseFloat(d[0])%360+360)%360/360,g=l(d[1]),h=l(d[2]),y=h<=.5?h*(g+1):h+g-h*g,m=2*h-y;return[r(255*s(m,y,p+1/3)),r(255*s(m,y,p)),r(255*s(m,y,p-1/3)),f];default:return null}}return null}}catch(e){}},function(e,t,n){"use strict";var o=n(31).parseCSSColor;e.exports=function(e){if("string"==typeof e){var t=o(e);if(!t)return;return[t[0]/255*t[3],t[1]/255*t[3],t[2]/255*t[3],t[3]]}return Array.isArray(e)?e:void 0}},function(e,t,n){"use strict";var o=.95047,r=1,a=1.08883,i=4/29,l=6/29,s=3*l*l,u=l*l*l,c=Math.PI/180,d=180/Math.PI;function f(e){return e>u?Math.pow(e,1/3):e/s+i}function p(e){return e>l?e*e*e:s*(e-i)}function g(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function h(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function y(e){var t=h(e[0]),n=h(e[1]),i=h(e[2]),l=f((.4124564*t+.3575761*n+.1804375*i)/o),s=f((.2126729*t+.7151522*n+.072175*i)/r);return[116*s-16,500*(l-s),200*(s-f((.0193339*t+.119192*n+.9503041*i)/a)),e[3]]}function m(e){var t=(e[0]+16)/116,n=isNaN(e[1])?t:t+e[1]/500,i=isNaN(e[2])?t:t-e[2]/200;return t=r*p(t),[g(3.2404542*(n=o*p(n))-1.5371385*t-.4985314*(i=a*p(i))),g(-.969266*n+1.8760108*t+.041556*i),g(.0556434*n-.2040259*t+1.0572252*i),e[3]]}e.exports={lab:{forward:y,reverse:m},hcl:{forward:function(e){var t=y(e),n=t[0],o=t[1],r=t[2],a=Math.atan2(r,o)*d;return[a<0?a+360:a,Math.sqrt(o*o+r*r),n,e[3]]},reverse:function(e){var t=e[0]*c,n=e[1];return m([e[2],Math.cos(t)*n,Math.sin(t)*n,e[3]])}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.applyStyle=P,t.applyBackground=function(e,t){t.layers.some(function(t){if("background"==t.type)return F(e,t),!0})},t.apply=function(e,t){var n,o,r,a;n=o=r=a="",e instanceof d.default||(e=new d.default({target:e}));if("string"==typeof t){var i=t.match(M);i&&(o=i[1],n=i.length>2?i[2]:""),fetch(t,{credentials:"same-origin"}).then(function(e){return e.json()}).then(function(i){var l=document.createElement("A");l.href=t,a=l.pathname.split("/").slice(0,-1).join("/")+"/",r=t.substr(0,t.indexOf(a)),R(i,e,o,r,a,n)}).catch(function(e){throw console.error(e),new Error("Could not load "+t)})}else setTimeout(function(){R(t,e)},0);return e},t.getLayer=function(e,t){for(var n=e.getLayers().getArray(),o=0,r=n.length;o2?o[2]:""):e+n}function P(e,t,n,a,i){return new Promise(function(s,u){var c,d,f;if("object"!=(void 0===t?"undefined":o(t))&&(t=JSON.parse(t)),8!=t.version&&u(new Error("glStyle version 8 required.")),t.sprite){var p=.5==(window.devicePixelRatio>=1.5?.5:1)?"@2x":"",g=A(t.sprite,a,p+".json");fetch(g,{credentials:"same-origin"}).then(function(e){return 200===e.status?e.json():""!==p?(p="",g=A(t.sprite,a,".json"),fetch(g,{credentials:"same-origin"}).then(function(e){return e.json()})):void 0}).then(function(e){if(void 0===e)throw"No sprites found.";c=e,d=A(t.sprite,a,p+".png"),h()}).catch(function(e){console.error(e),u(new Error("Sprites cannot be loaded from "+g))})}function h(){f||t.sprite&&!c||r&&!(r.length>0)?f&&e.setStyle(f):(f=(0,l.default)(e,t,n,i,c,d,r),s())}if(e instanceof m.default||e instanceof y.default)try{for(var v=t.layers,S=0,b=v.length;S=0)&&k(v[S]);h()}catch(e){setTimeout(function(){u(e)},0)}})}function F(e,t){function n(){var n=e.getTargetElement();if(n){var o=t.layout||{},r=t.paint||{},i=e.getView().getZoom();if("background-color"in r){var l=(0,a.default)(r["background-color"],{function:"interpolated",type:"color"})(i);Array.isArray(l)&&(l="rgba("+Math.round(255*l[0])+","+Math.round(255*l[1])+","+Math.round(255*l[2])+","+(l[3]?l[3]:1)+")"),n.style.backgroundColor=l}"background-opacity"in r&&(n.style.backgroundOpacity=(0,a.default)(r["background-opacity"],{function:"interpolated",type:"number"})(i)),"none"==o.visibility&&(n.style.backgroundColor="",n.style.backgroundOpacity="")}}e.getTargetElement()&&n(),e.on(["change:resolution","change:target"],n)}function T(e,t){var n;return e.some(function(e){if(e.id==t)return n=e.source,!0}),n}function R(e,t,n,o,r,a){var i=t.getView();"center"in e&&!i.getCenter()&&i.setCenter((0,u.fromLonLat)(e.center)),"zoom"in e&&void 0===i.getZoom()&&i.setZoom(e.zoom),i.getCenter()&&void 0!==i.getZoom()||i.fit(i.getProjection().getExtent(),{nearest:!0,size:t.getSize()}),e.sprite&&(0==e.sprite.indexOf("mapbox://")?e.sprite=n+"/sprite"+a:0!=e.sprite.indexOf("http")&&(e.sprite=(o?o+r:"")+e.sprite+a));var l,s,d,w,O,k,M,A,R=e.layers,I=new f.default,L=[];function G(n){if(L.length>0){t.addLayer(n);var o=function(){P(n,e,L,r).then(function(){n.setVisible(!0)},function(e){console.error(e)})};n.getSource()?o():n.once("change:source",o)}}for(var N=0,D=R.length;N0?A.getResolution(A.getMinZoom()):void 0,source:new b.default({attributions:s.attribution,format:new p.default,tileGrid:A,urls:B}),visible:!1,zIndex:N})):function(){var e=new m.default({declutter:!0,visible:!1,zIndex:N}),t=new v.default({url:M}),n=t.on("change",function(){if("ready"==t.getState()){for(var o=t.getTileJSON(),r=Array.isArray(o.tiles)?o.tiles:[o.tiles],a=0,i=r.length;a0&&e.setMaxResolution(u.getResolution(u.getMinZoom())),(0,g.unByKey)(n)}});return e}();else if("raster"==s.type){var z;(z=s.tiles?new x.default({attributions:s.attribution,minZoom:s.minzoom,maxZoom:"maxzoom"in s?s.maxzoom:22,tileSize:s.tileSize||512,url:M,urls:s.tiles,crossOrigin:"anonymous"}):new v.default({url:M,crossOrigin:"anonymous"})).setTileLoadFunction(function(e,t){if(-1!=t.indexOf("{bbox-epsg-3857}")){var n=z.getTileGrid().getTileCoordExtent(e.getTileCoord());t=t.replace("{bbox-epsg-3857}",n.toString())}e.getImage().src=t}),O=new h.default({source:z,visible:!l.layout||"none"!==l.layout.visibility})}else if("geojson"==s.type){var j,E,Z=s.data;"string"==typeof Z?E=C(Z,r):j=I.readFeatures(Z,{featureProjection:"EPSG:3857"}),O=new y.default({source:new S.default({attributions:s.attribution,features:j,format:I,url:E}),visible:!1,zIndex:N})}d=w}L.push(l.id)}G(O),t.set("mapbox-style",e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=n(34),a=n(0),i=(o=a)&&o.__esModule?o:{default:o};t.default={apply:r.apply,applyBackground:r.applyBackground,applyStyle:r.applyStyle,stylefunction:i.default}}]).default;