1!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).mapboxgl=t()}(this,(function(){"use strict";var e,t,i;function r(r,n){if(e)if(t){var o="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+e+")(sharedChunk); ("+t+")(sharedChunk); self.onerror = null;",s={};e(s);i=n(s);"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(i.workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"})))}else t=n;else e=n}r(0,(function(e){var t="3.6.0";let i;const r={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==i){const e=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{i=null!=process.env.API_URL_REGEX?new RegExp(process.env.API_URL_REGEX):e}catch(t){i=e}}return i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!r.API_URL)return null;try{const e=new URL(r.API_URL);return"api.mapbox.cn"===e.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===e.hostname?"https://events.mapbox.com/events/v2":null}catch(e){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function n(e){return r.API_URL_REGEX.test(e)}function o(e){return 0===e.indexOf("mapbox:")}function s(e){return r.API_CDN_URL_REGEX.test(e)}function a(e){return r.API_SPRITE_REGEX.test(e)}function l(e){return r.API_STYLE_REGEX.test(e)&&!a(e)}const c={create:"create",load:"load",fullLoad:"fullLoad"},u={mark(e){performance.mark(e)},measure(e,t,i){performance.measure(e,t,i)}};function h(e){const t=e.name.split("?")[0];return s(t)&&t.includes("mapbox-gl.js")?"javascript":s(t)&&t.includes("mapbox-gl.css")?"css":function(e){return r.API_FONTS_REGEX.test(e)}(t)?"fontRange":a(t)?"sprite":l(t)?"style":function(e){return r.API_TILEJSON_REGEX.test(e)}(t)?"tilejson":"other"}function p(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d={},f={};Object.defineProperty(f,"__esModule",{value:!0}),f.setMatrixArrayType=function(e){f.ARRAY_TYPE=_=e},f.toRadian=function(e){return e*y},f.equals=function(e,t){return Math.abs(e-t)<=m*Math.max(1,Math.abs(e),Math.abs(t))},f.RANDOM=f.ARRAY_TYPE=f.EPSILON=void 0;var m=1e-6;f.EPSILON=m;var _="undefined"!=typeof Float32Array?Float32Array:Array;f.ARRAY_TYPE=_;var g=Math.random;f.RANDOM=g;var y=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var v={};function x(e){return x="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},x(e)}Object.defineProperty(v,"__esModule",{value:!0}),v.create=function(){var e=new b.ARRAY_TYPE(4);return b.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e},v.clone=function(e){var t=new b.ARRAY_TYPE(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},v.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},v.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e},v.fromValues=function(e,t,i,r){var n=new b.ARRAY_TYPE(4);return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n},v.set=function(e,t,i,r,n){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e},v.transpose=function(e,t){if(e===t){var i=t[1];e[1]=t[2],e[2]=i}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e},v.invert=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=i*o-n*r;return s?(e[0]=o*(s=1/s),e[1]=-r*s,e[2]=-n*s,e[3]=i*s,e):null},v.adjoint=function(e,t){var i=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=i,e},v.determinant=function(e){return e[0]*e[3]-e[2]*e[1]},v.multiply=T,v.rotate=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=r*l+o*a,e[1]=n*l+s*a,e[2]=r*-a+o*l,e[3]=n*-a+s*l,e},v.scale=function(e,t,i){var r=t[1],n=t[2],o=t[3],s=i[0],a=i[1];return e[0]=t[0]*s,e[1]=r*s,e[2]=n*a,e[3]=o*a,e},v.fromRotation=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=-i,e[3]=r,e},v.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e},v.str=function(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},v.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},v.LDU=function(e,t,i,r){return e[2]=r[2]/r[0],i[0]=r[0],i[1]=r[1],i[3]=r[3]-e[2]*i[1],[e,t,i]},v.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e},v.subtract=M,v.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},v.equals=function(e,t){var i=e[0],r=e[1],n=e[2],o=e[3],s=t[0],a=t[1],l=t[2],c=t[3];return Math.abs(i-s)<=b.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(r-a)<=b.EPSILON*Math.max(1,Math.abs(r),Math.abs(a)
1)&&Math.abs(n-l)<=b.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(o-c)<=b.EPSILON*Math.max(1,Math.abs(o),Math.abs(c))},v.multiplyScalar=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e},v.multiplyScalarAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e},v.sub=v.mul=void 0;var b=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==x(e)&&"function"!=typeof e)return{default:e};var i=w(void 0);if(i&&i.has(e))return i.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,i&&i.set(e,r),r}(f);function w(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(w=function(e){return e?i:t})(e)}function T(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=i[0],l=i[1],c=i[2],u=i[3];return e[0]=r*a+o*l,e[1]=n*a+s*l,e[2]=r*c+o*u,e[3]=n*c+s*u,e}function M(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e}v.mul=T,v.sub=M;var E={};function S(e){return S="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},S(e)}Object.defineProperty(E,"__esModule",{value:!0}),E.create=function(){var e=new C.ARRAY_TYPE(6);return C.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[4]=0,e[5]=0),e[0]=1,e[3]=1,e},E.clone=function(e){var t=new C.ARRAY_TYPE(6);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},E.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},E.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e},E.fromValues=function(e,t,i,r,n,o){var s=new C.ARRAY_TYPE(6);return s[0]=e,s[1]=t,s[2]=i,s[3]=r,s[4]=n,s[5]=o,s},E.set=function(e,t,i,r,n,o,s){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=o,e[5]=s,e},E.invert=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=i*o-r*n;return l?(e[0]=o*(l=1/l),e[1]=-r*l,e[2]=-n*l,e[3]=i*l,e[4]=(n*a-o*s)*l,e[5]=(r*s-i*a)*l,e):null},E.determinant=function(e){return e[0]*e[3]-e[1]*e[2]},E.multiply=I,E.rotate=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=Math.sin(i),u=Math.cos(i);return e[0]=r*u+o*c,e[1]=n*u+s*c,e[2]=r*-c+o*u,e[3]=n*-c+s*u,e[4]=a,e[5]=l,e},E.scale=function(e,t,i){var r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=i[0],c=i[1];return e[0]=t[0]*l,e[1]=r*l,e[2]=n*c,e[3]=o*c,e[4]=s,e[5]=a,e},E.translate=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=i[0],u=i[1];return e[0]=r,e[1]=n,e[2]=o,e[3]=s,e[4]=r*c+o*u+a,e[5]=n*c+s*u+l,e},E.fromRotation=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=-i,e[3]=r,e[4]=0,e[5]=0,e},E.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e[4]=0,e[5]=0,e},E.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0],e[5]=t[1],e},E.str=function(e){return"mat2d("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+")"},E.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],1)},E.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e},E.subtract=k,E.multiplyScalar=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e},E.multiplyScalarAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e[4]=t[4]+i[4]*r,e[5]=t[5]+i[5]*r,e},E.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]},E.equals=function(e,t){var i=e[0],r=e[1],n=e[2],o=e[3],s=e[4],a=e[5],l=t[0],c=t[1],u=t[2],h=t[3],p=t[4],d=t[5];return Math.abs(i-l)<=C.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(r-c)<=C.EPSILON*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(n-u)<=C.EPSILON*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(o-h)<=C.EPSILON*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(s-p)<=C.EPSILON*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(a-d)<=C.EPSILON*Math.max(1,Math.abs(a),Math.abs(d))},E.sub=E.mul=void 0;
1var C=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==S(e)&&"function"!=typeof e)return{default:e};var i=A(void 0);if(i&&i.has(e))return i.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,i&&i.set(e,r),r}(f);function A(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(A=function(e){return e?i:t})(e)}function I(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=i[0],u=i[1],h=i[2],p=i[3],d=i[4],f=i[5];return e[0]=r*c+o*u,e[1]=n*c+s*u,e[2]=r*h+o*p,e[3]=n*h+s*p,e[4]=r*d+o*f+a,e[5]=n*d+s*f+l,e}function k(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e[4]=t[4]-i[4],e[5]=t[5]-i[5],e}E.mul=I,E.sub=k;var L={};function P(e){return P="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},P(e)}Object.defineProperty(L,"__esModule",{value:!0}),L.create=function(){var e=new R.ARRAY_TYPE(9);return R.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e},L.fromMat4=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e},L.clone=function(e){var t=new R.ARRAY_TYPE(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},L.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},L.fromValues=function(e,t,i,r,n,o,s,a,l){var c=new R.ARRAY_TYPE(9);return c[0]=e,c[1]=t,c[2]=i,c[3]=r,c[4]=n,c[5]=o,c[6]=s,c[7]=a,c[8]=l,c},L.set=function(e,t,i,r,n,o,s,a,l,c){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=o,e[5]=s,e[6]=a,e[7]=l,e[8]=c,e},L.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},L.transpose=function(e,t){if(e===t){var i=t[1],r=t[2],n=t[5];e[1]=t[3],e[2]=t[6],e[3]=i,e[5]=t[7],e[6]=r,e[7]=n}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e},L.invert=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=u*s-a*c,p=-u*o+a*l,d=c*o-s*l,f=i*h+r*p+n*d;return f?(e[0]=h*(f=1/f),e[1]=(-u*r+n*c)*f,e[2]=(a*r-n*s)*f,e[3]=p*f,e[4]=(u*i-n*l)*f,e[5]=(-a*i+n*o)*f,e[6]=d*f,e[7]=(-c*i+r*l)*f,e[8]=(s*i-r*o)*f,e):null},L.adjoint=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8];return e[0]=s*u-a*c,e[1]=n*c-r*u,e[2]=r*a-n*s,e[3]=a*l-o*u,e[4]=i*u-n*l,e[5]=n*o-i*a,e[6]=o*c-s*l,e[7]=r*l-i*c,e[8]=i*s-r*o,e},L.determinant=function(e){var t=e[3],i=e[4],r=e[5],n=e[6],o=e[7],s=e[8];return e[0]*(s*i-r*o)+e[1]*(-s*t+r*n)+e[2]*(o*t-i*n)},L.multiply=O,L.translate=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],p=i[0],d=i[1];return e[0]=r,e[1]=n,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=p*r+d*s+c,e[7]=p*n+d*a+u,e[8]=p*o+d*l+h,e},L.rotate=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],p=Math.sin(i),d=Math.cos(i);return e[0]=d*r+p*s,e[1]=d*n+p*a,e[2]=d*o+p*l,e[3]=d*s-p*r,e[4]=d*a-p*n,e[5]=d*l-p*o,e[6]=c,e[7]=u,e[8]=h,e},L.scale=function(e,t,i){var r=i[0],n=i[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=n*t[3],e[4]=n*t[4],e[5]=n*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},L.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e},L.fromRotation=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},L.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},L.fromMat2d=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e},L.fromQuat=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=i+i,a=r+r,l=n+n,c=i*s,u=r*s,h=r*a,p=n*s,d=n*a,f=n*l,m=o*s,_=o*a,g=o*l;return e[0]=1-h-f,e[3]=u-g,e[6]=p+_,e[1]=u+g,e[4]=1-c-f,e[7]=d-m,e[2]=p-_,e[5]=d+m,e[8]=1-c-h,e},L.normalFromMat4=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],p=t[10],d=t[11],f=t[12],m=t[13],_=t[14],g=t[15],y=i*a-r*s,v=i*l-n*s,x=i*c-o*s,b=r*l-n*a,w=r*c-o*a,T=n*c-o*l,M=u*m-h*f,E=u*_-p*f,S=u*g-d*f,C=h*_-p*m,A=h*g-d*m,I=p*g-d*_,k=y*I-v*A+x*C+b*S-w*E+T*M;return k?(e[0]=(a*I-l*A+c*C)*(k=1/k),e[1]=(l*S-s*I-c*E)*k,e[2]=(s*A-a*S+c*M)*k,e[3]=(n*A-r*I-o
vendor: 1,425 bytes, line 1
1*C)*k,e[4]=(i*I-n*S+o*E)*k,e[5]=(r*S-i*A-o*M)*k,e[6]=(m*T-_*w+g*b)*k,e[7]=(_*x-f*T-g*v)*k,e[8]=(f*w-m*x+g*y)*k,e):null},L.projection=function(e,t,i){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/i,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e},L.str=function(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"},L.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},L.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e[6]=t[6]+i[6],e[7]=t[7]+i[7],e[8]=t[8]+i[8],e},L.subtract=D,L.multiplyScalar=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*i,e},L.multiplyScalarAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e[4]=t[4]+i[4]*r,e[5]=t[5]+i[5]*r,e[6]=t[6]+i[6]*r,e[7]=t[7]+i[7]*r,e[8]=t[8]+i[8]*r,e},L.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},L.equals=function(e,t){var i=e[0],r=e[1],n=e[2],o=e[3],s=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=t[0],p=t[1],d=t[2],f=t[3],m=t[4],_=t[5],g=t[6],y=t[7],v=t[8];return Math.abs(i-h)<=R.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(r-p)<=R.EPSILON*Math.max(1,Math.abs(r),Math.abs(p))&&Math.abs(n-d)<=R.EPS
1ILON*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(o-f)<=R.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(s-m)<=R.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(a-_)<=R.EPSILON*Math.max(1,Math.abs(a),Math.abs(_))&&Math.abs(l-g)<=R.EPSILON*Math.max(1,Math.abs(l),Math.abs(g))&&Math.abs(c-y)<=R.EPSILON*Math.max(1,Math.abs(c),Math.abs(y))&&Math.abs(u-v)<=R.EPSILON*Math.max(1,Math.abs(u),Math.abs(v))},L.sub=L.mul=void 0;var R=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==P(e)&&"function"!=typeof e)return{default:e};var i=z(void 0);if(i&&i.has(e))return i.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,i&&i.set(e,r),r}(f);function z(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(z=function(e){return e?i:t})(e)}function O(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],p=i[0],d=i[1],f=i[2],m=i[3],_=i[4],g=i[5],y=i[6],v=i[7],x=i[8];return e[0]=p*r+d*s+f*c,e[1]=p*n+d*a+f*u,e[2]=p*o+d*l+f*h,e[3]=m*r+_*s+g*c,e[4]=m*n+_*a+g*u,e[5]=m*o+_*l+g*h,e[6]=y*r+v*s+x*c,e[7]=y*n+v*a+x*u,e[8]=y*o+v*l+x*h,e}function D(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e[4]=t[4]-i[4],e[5]=t[5]-i[5],e[6]=t[6]-i[6],e[7]=t[7]-i[7],e[8]=t[8]-i[8],e}L.mul=O,L.sub=D;var F={};function B(e){return B="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},B(e)}Object.defineProperty(F,"__esModule",{value:!0}),F.create=function(){var e=new N.ARRAY_TYPE(16);return N.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},F.clone=function(e){var t=new N.ARRAY_TYPE(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},F.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},F.fromValues=function(e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m){var _=new N.ARRAY_TYPE(16);return _[0]=e,_[1]=t,_[2]=i,_[3]=r,_[4]=n,_[5]=o,_[6]=s,_[7]=a,_[8]=l,_[9]=c,_[10]=u,_[11]=h,_[12]=p,_[13]=d,_[14]=f,_[15]=m,_},F.set=function(e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=o,e[5]=s,e[6]=a,e[7]=l,e[8]=c,e[9]=u,e[10]=h,e[11]=p,e[12]=d,e[13]=f,e[14]=m,e[15]=_,e},F.identity=U,F.transpose=function(e,t){if(e===t){var i=t[1],r=t[2],n=t[3],o=t[6],s=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=i,e[6]=t[9],e[7]=t[13],e[8]=r,e[9]=o,e[11]=t[14],e[12]=n,e[13]=s,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e},F.invert=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],p=t[10],d=t[11],f=t[12],m=t[13],_=t[14],g=t[15],y=i*a-r*s,v=i*l-n*s,x=i*c-o*s,b=r*l-n*a,w=r*c-o*a,T=n*c-o*l,M=u*m-h*f,E=u*_-p*f,S=u*g-d*f,C=h*_-p*m,A=h*g-d*m,I=p*g-d*_,k=y*I-v*A+x*C+b*S-w*E+T*M;return k?(e[0]=(a*I-l*A+c*C)*(k=1/k),e[1]=(n*A-r*I-o*C)*k,e[2]=(m*T-_*w+g*b)*k,e[3]=(p*w-h*T-d*b)*k,e[4]=(l*S-s*I-c*E)*k,e[5]=(i*I-n*S+o*E)*k,e[6]=(_*x-f*T-g*v)*k,e[7]=(u*T-p*x+d*v)*k,e[8]=(s*A-a*S+c*M)*k,e[9]=(r*S-i*A-o*M)*k,e[10]=(f*w-m*x+g*y)*k,e[11]=(h*x-u*w-d*y)*k,e[12]=(a*E-s*C-l*M)*k,e[13]=(i*C-r*E+n*M)*k,e[14]=(m*v-f*b-_*y)*k,e[15]=(u*b-h*v+p*y)*k,e):null},F.adjoint=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],p=t[10],d=t[11],f=t[12],m=t[13],_=t[14],g=t[15];return e[0]=a*(p*g-d*_)-h*(l*g-c*_)+m*(l*d-c*p),e[1]=-(r*(p*g-d*_)-h*(n*g-o*_)+m*(n*d-o*p)),e[2]=r*(l*g-c*_)-a*(n*g-o*_)+m*(n*c-o*l),e[3]=-(r*(l*d-c*p)-a*(n*d-o*p)+h*(n*c-o*l)),e[4]=-(s*(p*g-d*_)-u*(l*g-c*_)+f*(l*d-c*p)),e[5]=i*(p*g-d*_)-u*(n*g-o*_)+f*(n*d-o*p),e[6]=-(i*(l*g-c*_)-s*(n*g-o*_)+f*(n*c-o*l)),e[7]=i*(l*d-c*p)-s*(n*d-o*p)+u*(n*c-o*l),e[8]=s*(h*g-d*m)-u*(a*g-c*m)+f*(a*d-c*h),e[9]=-(i*(h*g-d*m)-u*(r*g-o*m)+f*(r*d-o*h)),e[10]=i*(a*g-c*m)-s*(r*g-o*m)+f*(r*c-o*a),e[11]=-(i*(a*d-c*h)-s*(r*d-o*h)+u*(r*c-o*a)),e[12]=-(s*(h*_-p*m)-u*(a*_-l*m)+f*(a*p-l*h)),e[13]=i*(h*_-p*m)-u*(r*_-n*m)+f*(r*p-n*h),e[14]=-(i*(a*_-l*m)-s*(r*_-n*m)+f*(r*l-n*a)),e[15]=i*(a*p-l*h)-s*(r*p-n*h)+u*(r*l-n*a),e},F.determinant=function(e){var t=e[0],i=e[1],r=e[2],n=e[3],o=e[4],s=e[5],a=e[6],l=e[7],c=e[8],u=e[9],h=e[10],p=e[11],d=e[12],f=e[13],m=e[14],_=e[15];return(t*s-i*o)*(h*_-p*m)-(t*a-r*o)*(u*_-p*f)+(t*l-n*o)*(u*m-h*f)+(i*a-r*s)*(c*_-p*d)-(i*l-n*s)*(c*m-h*d)+(r*l-n*a)*(c*f-u*d)},F.multiply=V,F.translate=function(e,t,i){var r,n,o,s,a,l,c,u,h,p,d,f,m=i[0],_=i[1],g=i[2];return t===e?(e[12]=t[0]*m+t[4]*_+t[8]*g+t[12],e[13]=t[1]*m+t[5]*_+t[9]*g+t[13],e[14]=t[2]*m+t[6]*_+t[10]*g+t[14],e[15]=t[3]*m+t[7]*_+t[11]*g+t[15]):(n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],p=t[9],d=t[10
1],f=t[11],e[0]=r=t[0],e[1]=n,e[2]=o,e[3]=s,e[4]=a,e[5]=l,e[6]=c,e[7]=u,e[8]=h,e[9]=p,e[10]=d,e[11]=f,e[12]=r*m+a*_+h*g+t[12],e[13]=n*m+l*_+p*g+t[13],e[14]=o*m+c*_+d*g+t[14],e[15]=s*m+u*_+f*g+t[15]),e},F.scale=function(e,t,i){var r=i[0],n=i[1],o=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},F.rotate=function(e,t,i,r){var n,o,s,a,l,c,u,h,p,d,f,m,_,g,y,v,x,b,w,T,M,E,S,C,A=r[0],I=r[1],k=r[2],L=Math.hypot(A,I,k);return L<N.EPSILON?null:(A*=L=1/L,I*=L,k*=L,n=Math.sin(i),o=Math.cos(i),l=t[1],c=t[2],u=t[3],p=t[5],d=t[6],f=t[7],_=t[9],g=t[10],y=t[11],v=A*A*(s=1-o)+o,w=A*I*s-k*n,T=I*I*s+o,M=k*I*s+A*n,E=A*k*s+I*n,S=I*k*s-A*n,C=k*k*s+o,e[0]=(a=t[0])*v+(h=t[4])*(x=I*A*s+k*n)+(m=t[8])*(b=k*A*s-I*n),e[1]=l*v+p*x+_*b,e[2]=c*v+d*x+g*b,e[3]=u*v+f*x+y*b,e[4]=a*w+h*T+m*M,e[5]=l*w+p*T+_*M,e[6]=c*w+d*T+g*M,e[7]=u*w+f*T+y*M,e[8]=a*E+h*S+m*C,e[9]=l*E+p*S+_*C,e[10]=c*E+d*S+g*C,e[11]=u*E+f*S+y*C,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)},F.rotateX=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[4],s=t[5],a=t[6],l=t[7],c=t[8],u=t[9],h=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*n+c*r,e[5]=s*n+u*r,e[6]=a*n+h*r,e[7]=l*n+p*r,e[8]=c*n-o*r,e[9]=u*n-s*r,e[10]=h*n-a*r,e[11]=p*n-l*r,e},F.rotateY=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[0],s=t[1],a=t[2],l=t[3],c=t[8],u=t[9],h=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*n-c*r,e[1]=s*n-u*r,e[2]=a*n-h*r,e[3]=l*n-p*r,e[8]=o*r+c*n,e[9]=s*r
vendor: 4,750 bytes, line 1
1+u*n,e[10]=a*r+h*n,e[11]=l*r+p*n,e},F.rotateZ=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),o=t[0],s=t[1],a=t[2],l=t[3],c=t[4],u=t[5],h=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*n+c*r,e[1]=s*n+u*r,e[2]=a*n+h*r,e[3]=l*n+p*r,e[4]=c*n-o*r,e[5]=u*n-s*r,e[6]=h*n-a*r,e[7]=p*n-l*r,e},F.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e},F.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},F.fromRotation=function(e,t,i){var r,n,o,s=i[0],a=i[1],l=i[2],c=Math.hypot(s,a,l);return c<N.EPSILON?null:(s*=c=1/c,a*=c,l*=c,r=Math.sin(t),n=Math.cos(t),e[0]=s*s*(o=1-n)+n,e[1]=a*s*o+l*r,e[2]=l*s*o-a*r,e[3]=0,e[4]=s*a*o-l*r,e[5]=a*a*o+n,e[6]=l*a*o+s*r,e[7]=0,e[8]=s*l*o+a*r,e[9]=a*l*o-s*r,e[10]=l*l*o+n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)},F.fromXRotation=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=i,e[7]=0,e[8]=0,e[9]=-i,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},F.fromYRotation=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=0,e[2]=-i,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=i,e[9]=0,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},F.fromZRotation=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=0,e[4]=-i,e[5]=r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},F.fromRotationTranslation=$,F.fromQuat2=function(e,t){var i=new N.ARRAY_TYPE(3),r=-t[0],n=-t[1],o=-t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=r*r+n*n+o*o+s*s;return h>0?(i[0]=2*(a*s+u*r+l*o-c*n)/h,i[1]=2*(l*s+u*n+c*r-a*o)/h,i[2]=2*(c*s+u*o+a*n-l*r)/h):(i[0]=2*(a*s+u*r+l*o-c*n),i[1]=2*(l*s+u*n+c*r-a*o),i[2]=2*(c*s+u*o+a*n-l*r)),$(e,t,i),e},F.getTranslation=function(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e},F.getScaling=G,F.getRotation=function(e,t){var i=new N.ARRAY_TYPE(3);G(i,t);var r=1/i[0],n=1/i[1],o=1/i[2],s=t[0]*r,a=t[1]*n,l=t[2]*o,c=t[4]*r,u=t[5]*n,h=t[6]*o,p=t[8]*r,d=t[9]*n,f=t[10]*o,m=s+u+f,_=0;return m>0?(_=2*Math.sqrt(m+1),e[3]=.25*_,e[0]=(h-d)/_,e[1]=(p-l)/_,e[2]=(a-c)/_):s>u&&s>f?(_=2*Math.sqrt(1+s-u-f),e[3]=(h-d)/_,e[0]=.25*_,e[1]=(a+c)/_,e[2]=(p+l)/_):u>f?(_=2*Math.sqrt(1+u-s-f),e[3]=(p-l)/_,e[0]=(a+c)/_,e[1]=.25*_,e[2]=(h+d)/_):(_=2*Math.sqrt(1+f-s-u),e[3]=(a-c)/_,e[0]=(p+l)/_,e[1]=(h+d)/_,e[2]=.25*_),e},F.fromRotationTranslationScale=function(e,t,i,r){var n=t[0],o=t[1],s=t[2],a=t[3],l=n+n,c=o+o,u=s+s,h=n*l,p=n*c,d=n*u,f=o*c,m=o*u,_=s*u,g=a*l,y=a*c,v=a*u,x=r[0],b=r[1],w=r[2];return e[0]=(1-(f+_))*x,e[1]=(p+v)*x,e[2]=(d-y)*x,e[3]=0,e[4]=(p-v)*b,e[5]=(1-(h+_))*b,e[6]=(m+g)*b,e[7]=0,e[8]=(d+y)*w,e[9]=(m-g)*w,e[10]=(1-(h+f))*w,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e},F.fromRotationTranslationScaleOrigin=function(e,t,i,r,n){var o=t[0],s=t[1],a=t[2],l=t[3],c=o+o,u=s+s,h=a+a,p=o*c,d=o*u,f=o*h,m=s*u,_=s*h,g=a*h,y=l*c,v=l*u,x=l*h,b=r[0],w=r[1],T=r[2],M=n[0],E=n[1],S=n[2],C=(1-(m+g))*b,A=(d+x)*b,I=(f-v)*b,k=(d-x)*w,L=(1-(p+g))*w,P=(_+y)*w,R=(f+v)*T,z=(_-y)*T,O=(1-(p+m))*T;return e[0]=C,e[1]=A,e[2]=I,e[3]=0,e[4]=k,e[5]=L,e[6]=P,e[7]=0,e[8]=R,e[9]=z,e[10]=O,e[11]=0,e[12]=i[0]+M-(C*M+k*E+R*S),e[13]=i[1]+E-(A*M+L*E+z*S),e[14]=i[2]+S-(I*M+P*E+O*S),e[15]=1,e},F.fromQuat=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=i+i,a=r+r,l=n+n,c=i*s,u=r*s,h=r*a,p=n*s,d=n*a,f=n*l,m=o*s,_=o*a,g=o*l;return e[0]=1-h-f,e[1]=u+g,e[2]=p-_,e[3]=0,e[4]=u-g,e[5]=1-c-f,e[6]=d+m,e[7]=0,e[8]=p+_,e[9]=d-m,e[10]=1-c-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},F.frustum=function(e,t,i,r,n,o,s){var a=1/(i-t),l=1/(n-r),c=1/(o-s);return e[0]=2*o*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*o*l,e[6]=0,e[7]=0,e[8]=(i+t)*a,e[9]=(n+r)*l,e[10]=(s+o)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*o*2*c,e[15]=0,e},F.perspectiveNO=q,F.perspectiveZO=function(e,t,i,r,n){var o,s=1/Math.tan(t/2);return e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=n*(o=1/(r-n)),e[14]=n*r*o):(e[10]=-1,e[14]=-r),e},F.perspectiveFromFieldOfView=function(e,t,i,r){var n=Math.tan(t.upDegrees*Math.PI/180),o=Math.tan(t.downDegrees*Math.PI/180),s=Math.tan(t.leftDegrees*Math.PI/180),a=Math.tan(t.rightDegrees*Math.PI/180),l=2/(s+a),c=2/(n+o);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=-(s-a)*l*.5,e[9]=(n-o)*c*.5,e[10]=r/(i-r),e[11]=-1,e[12]=0,e[13]=0,e[14]=r*i/(i-r),e[15]=0,e},F.orthoNO=H,F.orthoZO=function(e,t,i,r,n,o,s){var a=1/(t-i),l=1/(r-n),c=1/(o-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10
1]=c,e[11]=0,e[12]=(t+i)*a,e[13]=(n+r)*l,e[14]=o*c,e[15]=1,e},F.lookAt=function(e,t,i,r){var n,o,s,a,l,c,u,h,p,d,f=t[0],m=t[1],_=t[2],g=r[0],y=r[1],v=r[2],x=i[0],b=i[1],w=i[2];return Math.abs(f-x)<N.EPSILON&&Math.abs(m-b)<N.EPSILON&&Math.abs(_-w)<N.EPSILON?U(e):(u=f-x,h=m-b,p=_-w,n=y*(p*=d=1/Math.hypot(u,h,p))-v*(h*=d),o=v*(u*=d)-g*p,s=g*h-y*u,(d=Math.hypot(n,o,s))?(n*=d=1/d,o*=d,s*=d):(n=0,o=0,s=0),a=h*s-p*o,l=p*n-u*s,c=u*o-h*n,(d=Math.hypot(a,l,c))?(a*=d=1/d,l*=d,c*=d):(a=0,l=0,c=0),e[0]=n,e[1]=a,e[2]=u,e[3]=0,e[4]=o,e[5]=l,e[6]=h,e[7]=0,e[8]=s,e[9]=c,e[10]=p,e[11]=0,e[12]=-(n*f+o*m+s*_),e[13]=-(a*f+l*m+c*_),e[14]=-(u*f+h*m+p*_),e[15]=1,e)},F.targetTo=function(e,t,i,r){var n=t[0],o=t[1],s=t[2],a=r[0],l=r[1],c=r[2],u=n-i[0],h=o-i[1],p=s-i[2],d=u*u+h*h+p*p;d>0&&(u*=d=1/Math.sqrt(d),h*=d,p*=d);var f=l*p-c*h,m=c*u-a*p,_=a*h-l*u;return(d=f*f+m*m+_*_)>0&&(f*=d=1/Math.sqrt(d),m*=d,_*=d),e[0]=f,e[1]=m,e[2]=_,e[3]=0,e[4]=h*_-p*m,e[5]=p*f-u*_,e[6]=u*m-h*f,e[7]=0,e[8]=u,e[9]=h,e[10]=p,e[11]=0,e[12]=n,e[13]=o,e[14]=s,e[15]=1,e},F.str=function(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"},F.frob=function(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},F.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e[6]=t[6]+i[6],e[7]=t[7]+i[7],e[8]=t[8]+i[8],e[9]=t[9]+i[9],e[10]=t[10]+i[10],e[11]=t[11]+i[11],e[12]=t[12]+i[12],e[13]=t[13]+i[13],e[14]=t[14]+i[14],e[15]=t[15]+i[15],e},F.subtract=Z,F.multiplyScalar=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12]*i,e[13]=t[13]*i,e[14]=t[14]*i,e[15]=t[15]*i,e},F.multiplyScalarAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e[4]=t[4]+i[4]*r,e[5]=t[5]+i[5]*r,e[6]=t[6]+i[6]*r,e[7]=t[7]+i[7]*r,e[8]=t[8]+i[8]*r,e[9]=t[9]+i[9]*r,e[10]=t[10]+i[10]*r,e[11]=t[11]+i[11]*r,e[12]=t[12]+i[12]*r,e[13]=t[13]+i[13]*r,e[14]=t[14]+i[14]*r,e[15]=t[15]+i[15]*r,e},F.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]},F.equals=function(e,t){var i=e[0],r=e[1],n=e[2],o=e[3],s=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],p=e[10],d=e[11],f=e[12],m=e[13],_=e[14],g=e[15],y=t[0],v=t[1],x=t[2],b=t[3],w=t[4],T=t[5],M=t[6],E=t[7],S=t[8],C=t[9],A=t[10],I=t[11],k=t[12],L=t[13],P=t[14],R=t[15];return Math.abs(i-y)<=N.EPSILON*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(r-v)<=N.EPSILON*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(n-x)<=N.EPSILON*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(o-b)<=N.EPSILON*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(s-w)<=N.EPSILON*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(a-T)<=N.EPSILON*Math.max(1,Math.abs(a),Math.abs(T))&&Math.abs(l-M)<=N.EPSILON*Math.max(1,Math.abs(l),Math.abs(M))&&Math.abs(c-E)<=N.EPSILON*Math.max(1,Math.abs(c),Math.abs(E))&&Math.abs(u-S)<=N.EPSILON*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(h-C)<=N.EPSILON*Math.max(1,Math.abs(h),Math.abs(C))&&Math.abs(p-A)<=N.EPSILON*Math.max(1,Math.abs(p),Math.abs(A))&&Math.abs(d-I)<=N.EPSILON*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(f-k)<=N.EPSILON*Math.max(1,Math.abs(f),Math.abs(k))&&Math.abs(m-L)<=N.EPSILON*Math.max(1,Math.abs(m),Math.abs(L))&&Math.abs(_-P)<=N.EPSILON*Math.max(1,Math.abs(_),Math.abs(P))&&Math.abs(g-R)<=N.EPSILON*Math.max(1,Math.abs(g),Math.abs(R))},F.sub=F.mul=F.ortho=F.perspective=void 0;var N=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==B(e)&&"function"!=typeof e)return{default:e};var i=j(void 0);if(i&&i.has(e))return i.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,i&&i.set(e,r),r}(f);function j(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(j=function(e){return e?i:t})(e)}function U(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10
vendor: 5,329 bytes, line 1
1]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function V(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],p=t[9],d=t[10],f=t[11],m=t[12],_=t[13],g=t[14],y=t[15],v=i[0],x=i[1],b=i[2],w=i[3];return e[0]=v*r+x*a+b*h+w*m,e[1]=v*n+x*l+b*p+w*_,e[2]=v*o+x*c+b*d+w*g,e[3]=v*s+x*u+b*f+w*y,e[4]=(v=i[4])*r+(x=i[5])*a+(b=i[6])*h+(w=i[7])*m,e[5]=v*n+x*l+b*p+w*_,e[6]=v*o+x*c+b*d+w*g,e[7]=v*s+x*u+b*f+w*y,e[8]=(v=i[8])*r+(x=i[9])*a+(b=i[10])*h+(w=i[11])*m,e[9]=v*n+x*l+b*p+w*_,e[10]=v*o+x*c+b*d+w*g,e[11]=v*s+x*u+b*f+w*y,e[12]=(v=i[12])*r+(x=i[13])*a+(b=i[14])*h+(w=i[15])*m,e[13]=v*n+x*l+b*p+w*_,e[14]=v*o+x*c+b*d+w*g,e[15]=v*s+x*u+b*f+w*y,e}function $(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=r+r,l=n+n,c=o+o,u=r*a,h=r*l,p=r*c,d=n*l,f=n*c,m=o*c,_=s*a,g=s*l,y=s*c;return e[0]=1-(d+m),e[1]=h+y,e[2]=p-g,e[3]=0,e[4]=h-y,e[5]=1-(u+m),e[6]=f+_,e[7]=0,e[8]=p+g,e[9]=f-_,e[10]=1-(u+d),e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function G(e,t){var i=t[4],r=t[5],n=t[6],o=t[8],s=t[9],a=t[10];return e[0]=Math.hypot(t[0],t[1],t[2]),e[1]=Math.hypot(i,r,n),e[2]=Math.hypot(o,s,a),e}function q(e,t,i,r,n){var o,s=1/Math.tan(t/2);return e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=(n+r)*(o=1/(r-n)),e[14]=2*n*r*o):(e[10]=-1,e[14]=-2*r),e}function H(e,t,i,r,n,o,s){var a=1/(t-i),l=1/(r-n),c=1/(o-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+i)*a,e[13]=(n+r)*l,e[14]=(s+o)*c,e[15]=1,e}function Z(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e[4]=t[4]-i[4],e[5]=t[5]-i[5],e[6]=t[6]-i[6],e[7]=t[7]-i[7],e[8]=t[8]-i[8],e[9]=t[9]-i[9],e[10]=t[10]-i[10],e[11]=t[11]-i[11],e[12]=t[12]-i[12],e[13]=t[13]-i[13],e[14]=t[14]-i[14],e[15]=t[15]-i[15],e}F.perspective=q,F.ortho=H,F.mul=V,F.sub=Z;var W={},X={};function Q(e){return Q="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},Q(e)}Object.defineProperty(X,"__esModule",{value:!0}),X.create=K,X.clone=function(e){var t=new Y.ARRAY_TYPE(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},X.length=ee,X.fromValues=function(e,t,i){var r=new Y.ARRAY_TYPE(3);return r[0]=e,r[1]=t,r[2]=i,r},X.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},X.set=function(e,t,i,r){return e[0]=t,e[1]=i,e[2]=r,e},X.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e},X.subtract=te,X.multiply=ie,X.divide=re,X.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e},X.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e},X.min=function(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e},X.max=function(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e},X.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e},X.scale=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e},X.scaleAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e},X.distance=ne,X.squaredDistance=oe,X.squaredLength=se,X.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e},X.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e},X.normalize=function(e,t){var i=t[0],r=t[1],n=t[2],o=i*i+r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e},X.dot=ae,X.cross=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=i[0],a=i[1],l=i[2];return e[0]=n*l-o*a,e[1]=o*s-r*l,e[2]=r*a-n*s,e},X.lerp=function(e,t,i,r){var n=t[0],o=t[1],s=t[2];return e[0]=n+r*(i[0]-n),e[1]=o+r*(i[1]-o),e[2]=s+r*(i[2]-s),e},X.hermite=function(e,t,i,r,n,o){var s=o*o,a=s*(2*o-3)+1,l=s*(o-2)+o,c=s*(o-1),u=s*(3-2*o);return e[0]=t[0]*a+i[0]*l+r[0]*c+n[0]*u,e[1]=t[1]*a+i[1]*l+r[1]*c+n[1]*u,e[2]=t[2]*a+i[2]*l+r[2]*c+n[2]*u,e},X.bezier=function(e,t,i,r,n,o){var s=1-o,a=s*s,l=o*o,c=a*s,u=3*o*a,h=3*l*s,p=l*o;return e[0]=t[0]*c+i[0]*u+r[0]*h+n[0]*p,e[1]=t[1]*c+i[1]*u+r[1]*h+n[1]*p,e[2]=t[2]*c+i[2]*u+r[2]*h+n[2]*p,e},X.random=function(e,t){t=t||1;var i=2*Y.RANDOM()*Math.PI,r=2*Y.RANDOM()-1,n=Math.sqrt(1-r*r)*t;return e[0]=Math.cos(i)*n,e[1]=Math.sin(i)*n,e[2]=r*t,e},X.transformMat4=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=i[3]*r+i[7]*n+i[11]*o+i[15];return e[0]=(i[0]*r+i[4]*n+i[8]*o+i[12])/(s=s||1),e[1]=(i[1]*r+i[5]*n+i[9]*o+i[13])/s,e[2]=(i[2]*r+i[6]*n+i[10]*o+i[14])/s,e},X.transformMat3=function(e,t,i){var r=t[0],n=t[1],o=t[2];return e[0]=r*i[0]+n*i[3]+o*i[6],e[1]=r*i[1]+n*i[4]+o*i[7],e[2]=r*i[2]+n*i[5]+o*i[8],e},X.transformQuat=function(e,t,i){var r=i[0],n=i[1],o=i[2],s=t[0],a=t[1],l=t[2],c=n*l-o*a,u=o*s-r*l,h=r*a-n*s,p=n*h-o*u,d=o*c-r*h,f=r*u-n*c,m=2*i[3];return u*=m,h*=m,d*=2,f*=2,e[0]=s+(c*=m)+(p*=2),e[1]=a+u+d,e[2]=l+h+f,e},X.rotateX=function(e,t,i,r){var n=[],o=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],o[0]=n[0],o[1]=n[1]*Math.cos(r)-n[2]*Math.sin(r),o[2]=n[1]*Math.sin(r)+n[2]*Math.cos(r),e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e},X.rotateY=function(e,t,i,r){var n=[],o=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],o[0]=n[2]*Math.sin(r)+n[0]*Math.cos(r),o[1]=n[1],o[2]=n[2]*
1Math.cos(r)-n[0]*Math.sin(r),e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e},X.rotateZ=function(e,t,i,r){var n=[],o=[];return n[0]=t[0]-i[0],n[1]=t[1]-i[1],n[2]=t[2]-i[2],o[0]=n[0]*Math.cos(r)-n[1]*Math.sin(r),o[1]=n[0]*Math.sin(r)+n[1]*Math.cos(r),o[2]=n[2],e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e},X.angle=function(e,t){var i=e[0],r=e[1],n=e[2],o=t[0],s=t[1],a=t[2],l=Math.sqrt(i*i+r*r+n*n)*Math.sqrt(o*o+s*s+a*a),c=l&&ae(e,t)/l;return Math.acos(Math.min(Math.max(c,-1),1))},X.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e},X.str=function(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"},X.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},X.equals=function(e,t){var i=e[0],r=e[1],n=e[2],o=t[0],s=t[1],a=t[2];return Math.abs(i-o)<=Y.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-s)<=Y.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-a)<=Y.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))},X.forEach=X.sqrLen=X.len=X.sqrDist=X.dist=X.div=X.mul=X.sub=void 0;var Y=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==Q(e)&&"function"!=typeof e)return{default:e};var i=J(void 0);if(i&&i.has(e))return i.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,i&&i.set(e,r),r}(f);function J(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(J=function(e){return e?i:t})(e)}function K(){var e=new Y.ARRAY_TYPE(3);return Y.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function ee(e){return Math.hypot(e[0],e[1],e[2])}function te(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function ie(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e}function re(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e}function ne(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2])}function oe(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2];return i*i+r*r+n*n}function se(e){var t=e[0],i=e[1],r=e[2];return t*t+i*i+r*r}function ae(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}X.sub=te,X.mul=ie,X.div=re,X.dist=ne,X.sqrDist=oe,X.len=ee,X.sqrLen=se;var le,ce=(le=K(),function(e,t,i,r,n,o){var s,a;for(t||(t=3),i||(i=0),a=r?Math.min(r*t+i,e.length):e.length,s=i;s<a;s+=t)le[0]=e[s],le[1]=e[s+1],le[2]=e[s+2],n(le,le,o),e[s]=le[0],e[s+1]=le[1],e[s+2]=le[2];return e});X.forEach=ce;var ue={};function he(e){return he="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},he(e)}Object.defineProperty(ue,"__esModule",{value:!0}),ue.create=fe,ue.clone=function(e){var t=new pe.ARRAY_TYPE(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},ue.fromValues=function(e,t,i,r){var n=new pe.ARRAY_TYPE(4);return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n},ue.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},ue.set=function(e,t,i,r,n){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e},ue.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e},ue.subtract=me,ue.multiply=_e,ue.divide=ge,ue.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e},ue.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e},ue.min=function(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e[3]=Math.min(t[3],i[3]),e},ue.max=function(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e[3]=Math.max(t[3],i[3]),e},ue.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e},ue.scale=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e},ue.scaleAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e[3]=t[3]+i[3]*r,e},ue.distance=ye,ue.squaredDistance=ve,ue.length=xe,ue.squaredLength=be,ue.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e},ue.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e},ue.normalize=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=i*i+r*r+n*n+o*o;return s>0&&(s=1/Math.sqrt(s)),e[0]=i*s,e[1]=r*s,e[2]=n*s,e[3]=o*s,e},ue.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},ue.cross=function(e,t,i,r){var n=i[0]*r[1]-i[1]*r[0],o=i[0]*r[2]-i[2]*r[0],s=i[0]*r[3]-i[3]*r[0],a=i[1]*r[2]-i[2]*r[1],l=i[1]*r[3]-i[3]*r[1],c=i[2]*r[3]-i[3]*r[2],u=t[0],h=t[1],p=t[2],d=t[3];return e[0]=h*c-p*l+d*a,e[1]=-u*c+p*s-d*o,e[2]=u*l-h*s+d*n,e[3]=-u*a+h*o-p*n,e},ue.lerp=function(e,t,i,r){var n=t[0],o=t[1],s=t[2],a=t[3];return e[0]=n+r*(i[0]-n),e[1]=o+r*(i[1]-o),e[2]=s+r*(i[2]-s),e[3]=a+r*(i[3]-a),e},ue.random=function(e,t){var i,r,n,o,s,a;t=t||1;do{s=(i=2*pe.RANDOM()-1)*i+(r=2*pe.RANDOM()-1)*r}while(s>=1);do{a=(n=2*pe.RANDOM()-1)*n+(o=2*pe.RANDOM()-1)*o}while(a>=1);var l=Math.sqrt((1-s)/a);return e[0]=t*i,e[1]=t*r,e[2]=t*n*l,e[3]=t*o*l,e},ue.transformMat4=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3];return e[0]=i[0]*r+i[4]*n+i[8]*o+i[12]*s,e[1]=i[1]*r+i[5]*n+i[9]*o+i[13]*s,e[2]=i[2]*r+i[6]*n+i[10]*o+i[14]*s,e[3]=i[3]*r+i[7]*n+i[11]*o+i[15]*s,e},ue.transformQuat=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=i[0],a=i[1],l=i[2],c=i[3],u=c*r+a*o-l*n,h=c*n+l*r-s*o,p=c*o+s*n-a*r,d=-s*r-a*n-l*o;return e[0]=u*c+d*-s+h*-l-p*-a,e[1]=h*c+d*-a+p*-s-u*-l,e[2]=p*c+d*-l+u*-a-h*-s,e[3]=t[3],e},ue.zero=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e},ue.str=function(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},ue.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},ue.equals=function(e,t){var i=e[0],r=e[1],n=e[2],o=e[3],s=t[0],a=t[1],l=t[2],c=t[3];return Math.abs(i-s)<=pe.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(r-a)<=pe.EPSILON*Math.max(1,Math.abs(r),Math.abs(a)
1)&&Math.abs(n-l)<=pe.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(o-c)<=pe.EPSILON*Math.max(1,Math.abs(o),Math.abs(c))},ue.forEach=ue.sqrLen=ue.len=ue.sqrDist=ue.dist=ue.div=ue.mul=ue.sub=void 0;var pe=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==he(e)&&"function"!=typeof e)return{default:e};var i=de(void 0);if(i&&i.has(e))return i.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,i&&i.set(e,r),r}(f);function de(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(de=function(e){return e?i:t})(e)}function fe(){var e=new pe.ARRAY_TYPE(4);return pe.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function me(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e}function _e(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e}function ge(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e[3]=t[3]/i[3],e}function ye(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2],t[3]-e[3])}function ve(e,t){var i=t[0]-e[0],r=t[1]-e[1],n=t[2]-e[2],o=t[3]-e[3];return i*i+r*r+n*n+o*o}function xe(e){return Math.hypot(e[0],e[1],e[2],e[3])}function be(e){var t=e[0],i=e[1],r=e[2],n=e[3];return t*t+i*i+r*r+n*n}ue.sub=me,ue.mul=_e,ue.div=ge,ue.dist=ye,ue.sqrDist=ve,ue.len=xe,ue.sqrLen=be;var we=function(){var e=fe();return function(t,i,r,n,o,s){var a,l;for(i||(i=4),r||(r=0),l=n?Math.min(n*i+r,t.length):t.length,a=r;a<l;a+=i)e[0]=t[a],e[1]=t[a+1],e[2]=t[a+2],e[3]=t[a+3],o(e,e,s),t[a]=e[0],t[a+1]=e[1],t[a+2]=e[2],t[a+3]=e[3];return t}}();function Te(e){return Te="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},Te(e)}ue.forEach=we,Object.defineProperty(W,"__esModule",{value:!0}),W.create=ke,W.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},W.setAxisAngle=Le,W.getAxisAngle=function(e,t){var i=2*Math.acos(t[3]),r=Math.sin(i/2);return r>Me.EPSILON?(e[0]=t[0]/r,e[1]=t[1]/r,e[2]=t[2]/r):(e[0]=1,e[1]=0,e[2]=0),i},W.getAngle=function(e,t){var i=Be(e,t);return Math.acos(2*i*i-1)},W.multiply=Pe,W.rotateX=function(e,t,i){i*=.5;var r=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=r*l+s*a,e[1]=n*l+o*a,e[2]=o*l-n*a,e[3]=s*l-r*a,e},W.rotateY=function(e,t,i){i*=.5;var r=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=r*l-o*a,e[1]=n*l+s*a,e[2]=o*l+r*a,e[3]=s*l-n*a,e},W.rotateZ=function(e,t,i){i*=.5;var r=t[0],n=t[1],o=t[2],s=t[3],a=Math.sin(i),l=Math.cos(i);return e[0]=r*l+n*a,e[1]=n*l-r*a,e[2]=o*l+s*a,e[3]=s*l-o*a,e},W.calculateW=function(e,t){var i=t[0],r=t[1],n=t[2];return e[0]=i,e[1]=r,e[2]=n,e[3]=Math.sqrt(Math.abs(1-i*i-r*r-n*n)),e},W.exp=Re,W.ln=ze,W.pow=function(e,t,i){return ze(e,t),Fe(e,e,i),Re(e,e),e},W.slerp=Oe,W.random=function(e){var t=Me.RANDOM(),i=Me.RANDOM(),r=Me.RANDOM(),n=Math.sqrt(1-t),o=Math.sqrt(t);return e[0]=n*Math.sin(2*Math.PI*i),e[1]=n*Math.cos(2*Math.PI*i),e[2]=o*Math.sin(2*Math.PI*r),e[3]=o*Math.cos(2*Math.PI*r),e},W.invert=function(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=i*i+r*r+n*n+o*o,a=s?1/s:0;return e[0]=-i*a,e[1]=-r*a,e[2]=-n*a,e[3]=o*a,e},W.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},W.fromMat3=De,W.fromEuler=function(e,t,i,r){var n=.5*Math.PI/180;t*=n,i*=n,r*=n;var o=Math.sin(t),s=Math.cos(t),a=Math.sin(i),l=Math.cos(i),c=Math.sin(r),u=Math.cos(r);return e[0]=o*l*u-s*a*c,e[1]=s*a*u+o*l*c,e[2]=s*l*c-o*a*u,e[3]=s*l*u+o*a*c,e},W.str=function(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},W.setAxes=W.sqlerp=W.rotationTo=W.equals=W.exactEquals=W.normalize=W.sqrLen=W.squaredLength=W.len=W.length=W.lerp=W.dot=W.scale=W.mul=W.add=W.set=W.copy=W.fromValues=W.clone=void 0;var Me=Ie(f),Ee=Ie(L),Se=Ie(X),Ce=Ie(ue);function Ae(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(Ae=function(e){return e?i:t})(e)}
1function Ie(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==Te(e)&&"function"!=typeof e)return{default:e};var i=Ae(t);if(i&&i.has(e))return i.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,i&&i.set(e,r),r}function ke(){var e=new Me.ARRAY_TYPE(4);return Me.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Le(e,t,i){i*=.5;var r=Math.sin(i);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(i),e}function Pe(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=i[0],l=i[1],c=i[2],u=i[3];return e[0]=r*u+s*a+n*c-o*l,e[1]=n*u+s*l+o*a-r*c,e[2]=o*u+s*c+r*l-n*a,e[3]=s*u-r*a-n*l-o*c,e}function Re(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=Math.sqrt(i*i+r*r+n*n),a=Math.exp(o),l=s>0?a*Math.sin(s)/s:0;return e[0]=i*l,e[1]=r*l,e[2]=n*l,e[3]=a*Math.cos(s),e}function ze(e,t){var i=t[0],r=t[1],n=t[2],o=t[3],s=Math.sqrt(i*i+r*r+n*n),a=s>0?Math.atan2(s,o)/s:0;return e[0]=i*a,e[1]=r*a,e[2]=n*a,e[3]=.5*Math.log(i*i+r*r+n*n+o*o),e}function Oe(e,t,i,r){var n,o,s,a,l,c=t[0],u=t[1],h=t[2],p=t[3],d=i[0],f=i[1],m=i[2],_=i[3];return(o=c*d+u*f+h*m+p*_)<0&&(o=-o,d=-d,f=-f,m=-m,_=-_),1-o>Me.EPSILON?(n=Math.acos(o),s=Math.sin(n),a=Math.sin((1-r)*n)/s,l=Math.sin(r*n)/s):(a=1-r,l=r),e[0]=a*c+l*d,e[1]=a*u+l*f,e[2]=a*h+l*m,e[3]=a*p+l*_,e}function De(e,t){var i,r=t[0]+t[4]+t[8];if(r>0)i=Math.sqrt(r+1),e[3]=.5*i,e[0]=(t[5]-t[7])*(i=.5/i),e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{var n=0;t[4]>t[0]&&(n=1),t[8]>t[3*n+n]&&(n=2);var o=(n+1)%3,s=(n+2)%3;i=Math.sqrt(t[3*n+n]-t[3*o+o]-t[3*s+s]+1),e[n]=.5*i,e[3]=(t[3*o+s]-t[3*s+o])*(i=.5/i),e[o]=(t[3*o+n]+t[3*n+o])*i,e[s]=(t[3*s+n]+t[3*n+s])*i}return e}W.clone=Ce.clone,W.fromValues=Ce.fromValues,W.copy=Ce.copy,W.set=Ce.set,W.add=Ce.add,W.mul=Pe;var Fe=Ce.scale;W.scale=Fe;var Be=Ce.dot;W.dot=Be,W.lerp=Ce.lerp;var Ne=Ce.length;W.length=Ne,W.len=Ne;var je=Ce.squaredLength;W.squaredLength=je,W.sqrLen=je;var Ue=Ce.normalize;W.normalize=Ue,W.exactEquals=Ce.exactEquals,W.equals=Ce.equals;var Ve,$e,Ge,qe=(Ve=Se.create(),$e=Se.fromValues(1,0,0),Ge=Se.fromValues(0,1,0),function(e,t,i){var r=Se.dot(t,i);return r<-.999999?(Se.cross(Ve,$e,t),Se.len(Ve)<1e-6&&Se.cross(Ve,Ge,t),Se.normalize(Ve,Ve),Le(e,Ve,Math.PI),e):r>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(Se.cross(Ve,t,i),e[0]=Ve[0],e[1]=Ve[1],e[2]=Ve[2],e[3]=1+r,Ue(e,e))});W.rotationTo=qe;var He,Ze,We=(He=ke(),Ze=ke(),function(e,t,i,r,n,o){return Oe(He,t,n,o),Oe(Ze,i,r,o),Oe(e,He,Ze,2*o*(1-o)),e});W.sqlerp=We;var Xe,Qe=(Xe=Ee.create(),function(e,t,i,r){return Xe[0]=i[0],Xe[3]=i[1],Xe[6]=i[2],Xe[1]=r[0],Xe[4]=r[1],Xe[7]=r[2],Xe[2]=-t[0],Xe[5]=-t[1],Xe[8]=-t[2],Ue(e,De(e,Xe))});W.setAxes=Qe;var Ye={};function Je(e){return Je="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},Je(e)}Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.create=function(){var e=new Ke.ARRAY_TYPE(8);return Ke.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[4]=0,e[5]=0,e[6]=0,e[7]=0),e[3]=1,e},Ye.clone=function(e){var t=new Ke.ARRAY_TYPE(8);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t},Ye.fromValues=function(e,t,i,r,n,o,s,a){var l=new Ke.ARRAY_TYPE(8);return l[0]=e,l[1]=t,l[2]=i,l[3]=r,l[4]=n,l[5]=o,l[6]=s,l[7]=a,l},Ye.fromRotationTranslationValues=function(e,t,i,r,n,o,s){var a=new Ke.ARRAY_TYPE(8);a[0]=e,a[1]=t,a[2]=i,a[3]=r;var l=.5*n,c=.5*o,u=.5*s;return a[4]=l*r+c*i-u*t,a[5]=c*r+u*e-l*i,a[6]=u*r+l*t-c*e,a[7]=-l*e-c*t-u*i,a},Ye.fromRotationTranslation=nt,Ye.fromTranslation=function(e,t){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=.5*t[0],e[5]=.5*t[1],e[6]=.5*t[2],e[7]=0,e},Ye.fromRotation=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=0,e[5]=0,e[6]=0,e[7]=0,e},Ye.fromMat4=function(e,t){var i=et.create();tt.getRotation(i,t);var r=new Ke.ARRAY_TYPE(3);return tt.getTranslation(r,t),nt(e,i,r),e},Ye.copy=ot,Ye.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e},Ye.set=function(e,t,i,r,n,o,s,a,l){return e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=o,e[5]=s,e[6]=a,e[7]=l,e},Ye.getDual=function(e,t){return e[0]=t[4],e[1]=t[5],e[2]=t[6],e[3]=t[7],e},Ye.setDual=function(e,t){return e[4]=t[0],e[5]=t[1],e[6]=t[2],e[7]=t[3],e},Ye.getTranslation=function(e,t){var i=t[4],r=t[5],n=t[6],o=t[7],s=-t[0],a=-t[1],l=-t[2],c=t[3];return e[0]=2*(i*c+o*s+r*l-n*a),e[1]=2*(r*c+o*a+n*s-i*l),e[2]=2*(n*c+o
1*l+i*a-r*s),e},Ye.translate=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=.5*i[0],l=.5*i[1],c=.5*i[2],u=t[4],h=t[5],p=t[6],d=t[7];return e[0]=r,e[1]=n,e[2]=o,e[3]=s,e[4]=s*a+n*c-o*l+u,e[5]=s*l+o*a-r*c+h,e[6]=s*c+r*l-n*a+p,e[7]=-r*a-n*l-o*c+d,e},Ye.rotateX=function(e,t,i){var r=-t[0],n=-t[1],o=-t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=a*s+u*r+l*o-c*n,p=l*s+u*n+c*r-a*o,d=c*s+u*o+a*n-l*r,f=u*s-a*r-l*n-c*o;return et.rotateX(e,t,i),e[4]=h*(s=e[3])+f*(r=e[0])+p*(o=e[2])-d*(n=e[1]),e[5]=p*s+f*n+d*r-h*o,e[6]=d*s+f*o+h*n-p*r,e[7]=f*s-h*r-p*n-d*o,e},Ye.rotateY=function(e,t,i){var r=-t[0],n=-t[1],o=-t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=a*s+u*r+l*o-c*n,p=l*s+u*n+c*r-a*o,d=c*s+u*o+a*n-l*r,f=u*s-a*r-l*n-c*o;return et.rotateY(e,t,i),e[4]=h*(s=e[3])+f*(r=e[0])+p*(o=e[2])-d*(n=e[1]),e[5]=p*s+f*n+d*r-h*o,e[6]=d*s+f*o+h*n-p*r,e[7]=f*s-h*r-p*n-d*o,e},Ye.rotateZ=function(e,t,i){var r=-t[0],n=-t[1],o=-t[2],s=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=a*s+u*r+l*o-c*n,p=l*s+u*n+c*r-a*o,d=c*s+u*o+a*n-l*r,f=u*s-a*r-l*n-c*o;return et.rotateZ(e,t,i),e[4]=h*(s=e[3])+f*(r=e[0])+p*(o=e[2])-d*(n=e[1]),e[5]=p*s+f*n+d*r-h*o,e[6]=d*s+f*o+h*n-p*r,e[7]=f*s-h*r-p*n-d*o,e},Ye.rotateByQuatAppend=function(e,t,i){var r=i[0],n=i[1],o=i[2],s=i[3],a=t[0],l=t[1],c=t[2],u=t[3];return e[0]=a*s+u*r+l*o-c*n,e[1]=l*s+u*n+c*r-a*o,e[2]=c*s+u*o+a*n-l*r,e[3]=u*s-a*r-l*n-c*o,e[4]=(a=t[4])*s+(u=t[7])*r+(l=t[5])*o-(c=t[6])*n,e[5]=l*s+u*n+c*r-a*o,e[6]=c*s+u*o+a*n-l*r,e[7]=u*s-a*r-l*n-c*o,e},Ye.rotateByQuatPrepend=function(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=i[0],l=i[1],c=i[2],u=i[3];return e[0]=r*u+s*a+n*c-o*l,e[1]=n*u+s*l+o*a-r*c,e[2]=o*u+s*c+r*l-n*a,e[3]=s*u-r*a-n*l-o*c,e[4]=r*(u=i[7])+s*(a=i[4])+n*(c=i[6])-o*(l=i[5]),e[5]=n*u+s*l+o*a-r*c,e[6]=o*u+s*c+r*l-n*a,e[7]=s*u-r*a-n*l-o*c,e},Ye.rotateAroundAxis=function(e,t,i,r){if(Math.abs(r)<Ke.EPSILON)return ot(e,t);var n=Math.hypot(i[0],i[1],i[2]);r*=.5;var o=Math.sin(r),s=o*i[0]/n,a=o*i[1]/n,l=o*i[2]/n,c=Math.cos(r),u=t[0],h=t[1],p=t[2],d=t[3];e[0]=u*c+d*s+h*l-p*a,e[1]=h*c+d*a+p*s-u*l,e[2]=p*c+d*l+u*a-h*s,e[3]=d*c-u*s-h*a-p*l;var f=t[4],m=t[5],_=t[6],g=t[7];return e[4]=f*c+g*s+m*l-_*a,e[5]=m*c+g*a+_*s-f*l,e[6]=_*c+g*l+f*a-m*s,e[7]=g*c-f*s-m*a-_*l,e},Ye.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e[6]=t[6]+i[6],e[7]=t[7]+i[7],e},Ye.multiply=st,Ye.scale=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e},Ye.lerp=function(e,t,i,r){var n=1-r;return at(t,i)<0&&(r=-r),e[0]=t[0]*n+i[0]*r,e[1]=t[1]*n+i[1]*r,e[2]=t[2]*n+i[2]*r,e[3]=t[3]*n+i[3]*r,e[4]=t[4]*n+i[4]*r,e[5]=t[5]*n+i[5]*r,e[6]=t[6]*n+i[6]*r,e[7]=t[7]*n+i[7]*r,e},Ye.invert=function(e,t){var i=ct(t);return e[0]=-t[0]/i,e[1]=-t[1]/i,e[2]=-t[2]/i,e[3]=t[3]/i,e[4]=-t[4]/i,e[5]=-t[5]/i,e[6]=-t[6]/i,e[7]=t[7]/i,e},Ye.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=t[7],e},Ye.normalize=function(e,t){var i=ct(t);if(i>0){i=Math.sqrt(i);var r=t[0]/i,n=t[1]/i,o=t[2]/i,s=t[3]/i,a=t[4],l=t[5],c=t[6],u=t[7],h=r*a+n*l+o*c+s*u;e[0]=r,e[1]=n,e[2]=o,e[3]=s,e[4]=(a-r*h)/i,e[5]=(l-n*h)/i,e[6]=(c-o*h)/i,e[7]=(u-s*h)/i}return e},Ye.str=function(e){return"quat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+")"},Ye.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]},Ye.equals=function(e,t){var i=e[0],r=e[1],n=e[2],o=e[3],s=e[4],a=e[5],l=e[6],c=e[7],u=t[0],h=t[1],p=t[2],d=t[3],f=t[4],m=t[5],_=t[6],g=t[7];return Math.abs(i-u)<=Ke.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(r-h)<=Ke.EPSILON*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(n-p)<=Ke.EPSILON*Math.max(1,Math.abs(n),Math.abs(p))&&Math.abs(o-d)<=Ke.EPSILON*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(s-f)<=Ke.EPSILON*Math.max(1,Math.abs(s),Math.abs(f))&&Math.abs(a-m)<=Ke.EPSILON*Math.max(1,Math.abs(a),Math.abs(m))&&Math.abs(l-_)<=Ke.EPSILON*Math.max(1,Math.abs(l),Math.abs(_))&&Math.abs(c-g)<=Ke.EPSILON*Math.max(1,Math.abs(c),Math.abs(g))},Ye.sqrLen=Ye.squaredLength=Ye.len=Ye.length=Ye.dot=Ye.mul=Ye.setReal=Ye.getReal=void 0;var Ke=rt(f),et=rt(W),tt=rt(F);function it(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(it=function(e){return e?i:t})(e)}
vendor: 4,238 bytes, line 1
1function rt(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==Je(e)&&"function"!=typeof e)return{default:e};var i=it(t);if(i&&i.has(e))return i.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,i&&i.set(e,r),r}function nt(e,t,i){var r=.5*i[0],n=.5*i[1],o=.5*i[2],s=t[0],a=t[1],l=t[2],c=t[3];return e[0]=s,e[1]=a,e[2]=l,e[3]=c,e[4]=r*c+n*l-o*a,e[5]=n*c+o*s-r*l,e[6]=o*c+r*a-n*s,e[7]=-r*s-n*a-o*l,e}function ot(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e}function st(e,t,i){var r=t[0],n=t[1],o=t[2],s=t[3],a=i[4],l=i[5],c=i[6],u=i[7],h=t[4],p=t[5],d=t[6],f=t[7],m=i[0],_=i[1],g=i[2],y=i[3];return e[0]=r*y+s*m+n*g-o*_,e[1]=n*y+s*_+o*m-r*g,e[2]=o*y+s*g+r*_-n*m,e[3]=s*y-r*m-n*_-o*g,e[4]=r*u+s*a+n*c-o*l+h*y+f*m+p*g-d*_,e[5]=n*u+s*l+o*a-r*c+p*y+f*_+d*m-h*g,e[6]=o*u+s*c+r*l-n*a+d*y+f*g+h*_-p*m,e[7]=s*u-r*a-n*l-o*c+f*y-h*m-p*_-d*g,e}Ye.getReal=et.copy,Ye.setReal=et.copy,Ye.mul=st;var at=et.dot;Ye.dot=at;var lt=et.length;Ye.length=lt,Ye.len=lt;var ct=et.squaredLength;Ye.squaredLength=ct,Ye.sqrLen=ct;var ut={};function ht(e){return ht="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},ht(e)}Object.defineProperty(ut,"__esModule",{value:!0}),ut.create=ft,ut.clone=function(e){var t=new pt.ARRAY_TYPE(2);return t[0]=e[0],t[1]=e[1],t},ut.fromValues=function(e,t){var i=new pt.ARRAY_TYPE(2);return i[0]=e,i[1]=t,i},ut.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e},ut.set=function(e,t,i){return e[0]=t,e[1]=i,e},ut.add=function(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e},ut.subtract=mt,ut.multiply=_t,ut.divide=gt,ut.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e},ut.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e},ut.min=function(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e},ut.max=function(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e},ut.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e},ut.scale=function(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e},ut.scaleAndAdd=function(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e},ut.distance=yt,ut.squaredDistance=vt,ut.length=xt,ut.squaredLength=bt,ut.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e},ut.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e},ut.normalize=function(e,t){var i=t[0],r=t[1],n=i*i+r*r;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e},ut.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]},ut.cross=function(e,t,i){var r=t[0]*i[1]-t[1]*i[0];return e[0]=e[1]=0,e[2]=r,e},ut.lerp=function(e,t,i,r){var n=t[0],o=t[1];return e[0]=n+r*(i[0]-n),e[1]=o+r*(i[1]-o),e},ut.random=function(e,t){t=t||1;var i=2*pt.RANDOM()*Math.PI;return e[0]=Math.cos(i)*t,e[1]=Math.sin(i)*t,e},ut.transformMat2=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[2]*n,e[1]=i[1]*r+i[3]*n,e},ut.transformMat2d=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[2]*n+i[4],e[1]=i[1]*r+i[3]*n+i[5],e},ut.transformMat3=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[3]*n+i[6],e[1]=i[1]*r+i[4]*n+i[7],e},ut.transformMat4=function(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e},ut.rotate=function(e,t,i,r){var n=t[0]-i[0],o=t[1]-i[1],s=Math.sin(r),a=Math.cos(r);return e[0]=n*a-o*s+i[0],e[1]=n*s+o*a+i[1],e},ut.angle=function(e,t){var i=e[0],r=e[1],n=t[0],o=t[1],s=Math.sqrt(i*i+r*r)*Math.sqrt(n*n+o*o);return Math.acos(Math.min(Math.max(s&&(i*n+r*o)/s,-1),1))},ut.zero=function(e){return e[0]=0,e[1]=0,e},ut.str=function(e){return"vec2("+e[0]+", "+e[1]+")"},ut.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ut.equals=function(e,t){var i=e[0],r=e[1],n=t[0],o=t[1];return Math.abs(i-n)<=pt.EPSILON*Math.max(1,Math.abs(i),Math.abs(n))&&Math.abs(r-o)<=pt.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))},ut.forEach=ut.sqrLen=ut.sqrDist=ut.dist=ut.div=ut.mul=ut.sub=ut.len=void 0;
1var pt=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==ht(e)&&"function"!=typeof e)return{default:e};var i=dt(void 0);if(i&&i.has(e))return i.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,i&&i.set(e,r),r}(f);function dt(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(dt=function(e){return e?i:t})(e)}function ft(){var e=new pt.ARRAY_TYPE(2);return pt.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0),e}function mt(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e}function _t(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e}function gt(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e}function yt(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1])}function vt(e,t){var i=t[0]-e[0],r=t[1]-e[1];return i*i+r*r}function xt(e){return Math.hypot(e[0],e[1])}function bt(e){var t=e[0],i=e[1];return t*t+i*i}ut.len=xt,ut.sub=mt,ut.mul=_t,ut.div=gt,ut.dist=yt,ut.sqrDist=vt,ut.sqrLen=bt;var wt=function(){var e=ft();return function(t,i,r,n,o,s){var a,l;for(i||(i=2),r||(r=0),l=n?Math.min(n*i+r,t.length):t.length,a=r;a<l;a+=i)e[0]=t[a],e[1]=t[a+1],o(e,e,s),t[a]=e[0],t[a+1]=e[1];return t}}();function Tt(e){return Tt="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},Tt(e)}ut.forEach=wt,Object.defineProperty(d,"__esModule",{value:!0}),e.aB=d.vec4=e.$=d.vec3=d.vec2=d.quat2=e.aw=d.quat=e.ae=d.mat4=e.bE=d.mat3=d.mat2d=e.aD=d.mat2=d.glMatrix=void 0;var Mt=Ot(f);d.glMatrix=Mt;var Et=Ot(v);e.aD=d.mat2=Et;var St=Ot(E);d.mat2d=St;var Ct=Ot(L);e.bE=d.mat3=Ct;var At=Ot(F);e.ae=d.mat4=At;var It=Ot(W);e.aw=d.quat=It;var kt=Ot(Ye);d.quat2=kt;var Lt=Ot(ut);d.vec2=Lt;var Pt=Ot(X);e.$=d.vec3=Pt;var Rt=Ot(ue);function zt(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,i=new WeakMap;return(zt=function(e){return e?i:t})(e)}function Ot(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!==Tt(e)&&"function"!=typeof e)return{default:e};var i=zt(t);if(i&&i.has(e))return i.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=n?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(r,o,s):r[o]=e[o]}return r.default=e,i&&i.set(e,r),r}e.aB=d.vec4=Rt;var Dt=Ft;function Ft(e,t,i,r){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}Ft.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)<t)return i;var o=this.sampleCurveDerivativeX(i);if(Math.abs(o)<1e-6)break;i-=n/o}var s=0,a=1;for(i=e,r=0;r<20&&(n=this.sampleCurveX(i),!(Math.abs(n-e)<t));r++)e>n?s=i:a=i,i=.5*(a-s)+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};var Bt=p(Dt),Nt=jt;function jt(e,t){this.x=e,this.y=t}jt.prototype={clone:function(){return new jt(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this}
1,_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),i=Math.sin(e),r=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=r,this},_rotateAround:function(e,t){var i=Math.cos(e),r=Math.sin(e),n=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-r*(this.y-t.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},jt.convert=function(e){return e instanceof jt?e:Array.isArray(e)?new jt(e[0],e[1]):e};var Ut=p(Nt);function Vt(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!Vt(e[i],t[i]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(!Vt(e[i],t[i]))return!1;return!0}return e===t}const $t=Math.PI/180,Gt=180/Math.PI;function qt(e){return e*$t}function Ht(e){return e*Gt}const Zt=[[0,0],[1,0],[1,1],[0,1]];function Wt(e){if(e<=0)return 0;if(e>=1)return 1;const t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function Xt(e,t,i,r){const n=new Bt(e,t,i,r);return function(e){return n.solve(e)}}const Qt=Xt(.25,.1,.25,1);function Yt(e,t,i){return Math.min(i,Math.max(t,e))}function Jt(e,t,i){return(i=Yt((i-e)/(t-e),0,1))*i*(3-2*i)}function Kt(e,t,i){const r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function ei(e,t,i){if(!e.length)return i(null,[]);let r=e.length;const n=new Array(e.length);let o=null;e.forEach(((e,s)=>{t(e,((e,t)=>{e&&(o=e),n[s]=t,0==--r&&i(o,n)}))}))}function ti(e){const t=[];for(const i in e)t.push(e[i]);return t}function ii(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}let ri=1;function ni(){return ri++}function oi(){return function e(t){return t?(t^Math.random()*(16>>t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()}function si(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function ai(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function li(e,t){e.forEach((e=>{t[e]&&(t[e]=t[e].bind(t))}))}function ci(e,t){return-1!==e.indexOf(t,e.length-t.length)}function ui(e,t,i){const r={};for(const i in e)r[i]=t.call(this,e[i],i,e);return r}function hi(e,t,i){const r={};for(const i in e)t.call(this,e[i],i,e)&&(r[i]=e[i]);return r}function pi(e){return Array.isArray(e)?e.map(pi):"object"==typeof e&&e?ui(e,pi):e}const di={};function fi(e){di[e]||("undefined"!=typeof console&&console.warn(e),di[e]=!0)}function mi(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function _i(e){let t=0;for(let i,r,n=0,o=e.length,s=o-1;n<o;s=n++)i=e[n],r=e[s],t+=(r.x-i.x)*(i.y+r.y);return t}function gi([e,t,i]){const r=qt(t+90),n=qt(i);return{x:e*Math.cos(r)*Math.sin(n),y:e*Math.sin(r)*Math.sin(n),z:e*Math.cos(n),azimuthal:t,polar:i}}function yi(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function vi(e){const t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,i,r,n)=>{const o=r||n;return t[i]=!o||o.toLowerCase(),""})),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}let xi,bi,wi,Ti,Mi,Ei,Si=null;function Ci(e){try{const t=self[e];return t.setItem("_mapbox_test_",1),t.removeItem("_mapbox_test_"),!0}catch(e){return!1}}function Ai(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}function Ii(e,t,i,r){for(;t<i;){const n=t+i>>1;e[n]<r?t=n+1:i=n}return t}function ki(e,t,i,r){for(;t<i;){const n=t+i>>1;e[n]<=r?t=n+1:i=n}return t}function Li(e){return e>0?1/(1.001-e):1+e}function Pi(e){return e>0?1-1/(1.001-e):-e}function Ri(){return null==xi&&(xi=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),xi}const zi={now:()=>void 0!==Ti?Ti:performance.now(),setNow(e){Ti=e},restoreNow(){Ti=void 0},frame(e){const t=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(e,t=0){const{width:i,height:r}=e;Mi||(Mi=document.createElement("canvas"));const n=Mi.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return(i>Mi.width||r>Mi.height)&&(Mi.width=i,Mi.height=r),n.clearRect(-t,-t,i+2*t,r+2*t),n.drawImage(e,0,0,i,r),n.getImageData(-t,-t,i+2*t,r+2*t)},resolveURL:e=>(bi||(bi=document.createElement("a")),bi.href=e,bi.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(null==wi&&(wi=window.matchMedia("(prefers-reduced-motion: reduce)")),wi.matches)},hasCanvasFingerprintNoise(){if(void 0!==Ei)return Ei;if(!Ri())return Ei=!1,!1;const e=new OffscreenCanvas(85,1),t=e.getContext("2d",{willReadFrequently:!0});let i=0;for(let r=0;r<e.width;++r)t.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,t.fillRect(r,0,1,1);const r=t.getImageData(0,0,e.width,e.height);i=0;for(let e=0;e<r.data.length;++e)if(e%4!=3&&i++!==r.data[e])return Ei=!0,!0;return Ei=!1,!1}};function Oi(e,t){const i=e.indexOf("?");if(i<0)return`${e}?${new URLSearchParams(t).toString()}`;
1const r=new URLSearchParams(e.slice(i));for(const e in t)r.set(e,t[e]);return`${e.slice(0,i)}?${r.toString()}`}function Di(e,t={persistentParams:[]}){const i=e.indexOf("?");if(i<0)return e;const r=new URLSearchParams,n=new URLSearchParams(e.slice(i));for(const e of t.persistentParams){const t=n.get(e);t&&r.set(e,t)}const o=r.toString();return`${e.slice(0,i)}${o.length>0?`?${o}`:""}`}const Fi="mapbox-tiles";let Bi=500,Ni=50;const ji=["language","worldview","jobid"];let Ui,Vi;function $i(){try{return caches}catch(e){}}function Gi(){const e=$i();e&&!Ui&&(Ui=e.open(Fi))}let qi=1/0;const Hi={supported:!1,testSupport:function(e){!Xi&&Wi&&(Qi?Ji(e):Zi=e)}};let Zi,Wi,Xi=!1,Qi=!1;const Yi="undefined"!=typeof self?self:{};function Ji(e){const t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,Wi),e.isContextLost())return;Hi.supported=!0}catch(e){}e.deleteTexture(t),Xi=!0}Yi.document&&(Wi=Yi.document.createElement("img"),Wi.onload=function(){Zi&&Ji(Zi),Zi=null,Qi=!0},Wi.onerror=function(){Xi=!0,Zi=null},Wi.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Ki={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image",Model:"Model"};"function"==typeof Object.freeze&&Object.freeze(Ki);class er extends Error{constructor(e,t,i){401===t&&n(i)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=t,this.url=i}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const tr=yi()?()=>self.worker&&self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,ir=function(e,t){if(!(/^file:/.test(i=e.url)||/^file:/.test(tr())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(e,t){const i=new AbortController,r=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:tr(),referrerPolicy:e.referrerPolicy,signal:i.signal});let o=!1,s=!1;const a=(l=r.url).indexOf("sku=")>0&&n(l);var l;"json"===e.type&&r.headers.set("Accept","application/json");const c=(i,n,o)=>{if(s)return;if(i&&"SecurityError"!==i.message&&fi(i.toString()),n&&o)return u(n);const l=Date.now();fetch(r).then((i=>{if(i.ok){const e=a?i.clone():null;return u(i,e,l)}return t(new er(i.statusText,i.status,e.url))})).catch((i=>{"AbortError"!==i.name&&t(new Error(`${i.message} ${e.url}`))}))},u=(i,n,a)=>{("arrayBuffer"===e.type?i.arrayBuffer():"json"===e.type?i.json():i.text()).then((e=>{s||(n&&a&&function(e,t,i){if(Gi(),!Ui)return;const r=vi(t.headers.get("Cache-Control")||"");if(r["no-store"])return;const n={status:t.status,statusText:t.statusText,headers:new Headers};t.headers.forEach(((e,t)=>n.headers.set(t,e))),r["max-age"]&&n.headers.set("Expires",new Date(i+1e3*r["max-age"]).toUTCString());const o=n.headers.get("Expires");if(!o)return;if(new Date(o).getTime()-i<42e4)return;
1let s=Di(e.url,{persistentParams:ji});if(206===t.status){const t=e.headers.get("Range");if(!t)return;n.status=200,s=Oi(s,{range:t})}!function(e,t){if(void 0===Vi)try{new Response(new ReadableStream),Vi=!0}catch(e){Vi=!1}Vi?t(e.body):e.blob().then(t)}(t,(e=>{const i=new Response(200!==(r=t.status)&&404!==r&&[101,103,204,205,304].includes(r)?null:e,n);var r;Gi(),Ui&&Ui.then((e=>e.put(s,i))).catch((e=>fi(e.message)))}))}(r,n,a),o=!0,t(null,e,i.headers.get("Cache-Control"),i.headers.get("Expires")))})).catch((e=>{s||t(new Error(e.message))}))};return a?function(e,t){if(Gi(),!Ui)return t(null);Ui.then((i=>{let r=Di(e.url,{persistentParams:ji});const n=e.headers.get("Range");n&&(r=Oi(r,{range:n})),i.match(r).then((e=>{const n=function(e){if(!e)return!1;const t=new Date(e.headers.get("Expires")||0),i=vi(e.headers.get("Cache-Control")||"");return t>Date.now()&&!i["no-cache"]}(e);i.delete(r),n&&i.put(r,e.clone()),t(null,e,n)})).catch(t)})).catch(t)}(r,c):c(null,null),{cancel:()=>{s=!0,o||i.abort()}}}(e,t);if(yi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,t,void 0,!0)}var i;return function(e,t){const i=new XMLHttpRequest;i.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(i.responseType="arraybuffer");for(const t in e.headers)i.setRequestHeader(t,e.headers[t]);return"json"===e.type&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials="include"===e.credentials,i.onerror=()=>{t(new Error(i.statusText))},i.onload=()=>{if((i.status>=200&&i.status<300||0===i.status)&&null!==i.response){let r=i.response;if("json"===e.type)try{r=JSON.parse(i.response)}catch(e){return t(e)}t(null,r,i.getResponseHeader("Cache-Control"),i.getResponseHeader("Expires"))}else t(new er(i.statusText,i.status,e.url))},i.send(e.body),{cancel:()=>i.abort()}}(e,t)},rr=function(e,t){return ir(ii(e,{type:"arrayBuffer"}),t)};function nr(e){const t=document.createElement("a");return t.href=e,t.protocol===location.protocol&&t.host===location.host}const or="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let sr,ar;sr=[],ar=0;const lr=function(e,t){if(Hi.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),ar>=r.MAX_PARALLEL_IMAGE_REQUESTS){const i={requestParameters:e,callback:t,cancelled:!1,cancel(){this.cancelled=!0}};return sr.push(i),i}ar++;let i=!1;const n=()=>
1{if(!i)for(i=!0,ar--;sr.length&&ar<r.MAX_PARALLEL_IMAGE_REQUESTS;){const e=sr.shift(),{requestParameters:t,callback:i,cancelled:r}=e;r||(e.cancel=lr(t,i).cancel)}},o=rr(e,((e,i,r,o)=>{n(),e?t(e):i&&(self.createImageBitmap?function(e,t){const i=new Blob([new Uint8Array(e)],{type:"image/png"});createImageBitmap(i).then((e=>{t(null,e)})).catch((e=>{t(new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))}(i,((e,i)=>t(e,i,r,o))):function(e,t){const i=new Image;i.onload=()=>{t(null,i),URL.revokeObjectURL(i.src),i.onload=null,requestAnimationFrame((()=>{i.src=or}))},i.onerror=()=>t(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const r=new Blob([new Uint8Array(e)],{type:"image/png"});i.src=e.byteLength?URL.createObjectURL(r):or}(i,((e,i)=>t(e,i,r,o))))}));return{cancel:()=>{o.cancel(),n()}}},cr="01",ur="NO_ACCESS_TOKEN",hr=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function pr(e){const t=e.match(hr);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function dr(e){const t=e.params.length?`?${e.params.join("&")}`:"";return`${e.protocol}://${e.authority}${e.path}${t}`}const fr="mapbox.eventData";function mr(e){if(!e)return null;const t=e.split(".");if(!t||3!==t.length)return null;try{return JSON.parse(decodeURIComponent(atob(t[1]).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join("")))}catch(e){return null}}class _r{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(e){const t=mr(r.ACCESS_TOKEN);let i="";return i=t&&t.u?btoa(encodeURIComponent(t.u).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(Number("0x"+t))))):r.ACCESS_TOKEN||"",e?`${fr}.${e}:${i}`:`${fr}:${i}`}fetchEventData(){const e=Ci("localStorage"),t=this.getStorageKey(),i=this.getStorageKey("uuid");if(e)try{const e=localStorage.getItem(t);e&&(this.eventData=JSON.parse(e));const r=localStorage.getItem(i);r&&(this.anonId=r)}catch(e){fi("Unable to read from LocalStorage")}}saveEventData(){const e=Ci("localStorage"),t=this.getStorageKey(),i=this.getStorageKey("uuid"),r=this.anonId;if(e&&r)try{localStorage.setItem(i,r),Object.keys(this.eventData).length>=1&&localStorage.setItem(t,JSON.stringify(this.eventData))}catch(e){fi("Unable to write to LocalStorage")}}processRequests(e){}postEvent(e,t,i,n){if(!r.EVENTS_URL)return;const o=pr(r.EVENTS_URL);o.params.push(`access_token=${n||r.ACCESS_TOKEN||""}`);const s={event:this.type,created:new Date(e).toISOString()},a=t?ii(s,t):s,l={url:dr(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([a])};this.pendingRequest=function(e,t){return ir(ii(e,{method:"POST"}),t)}(l,(e=>{this.pendingRequest=null,i(e),this.saveEventData(),this.processRequests(n)}))}queueRequest(e,t){this.queue.push(e),this.processRequests(t)}}const gr=new class extends _r{constructor(e){super("appUserTurnstile"),this._customAccessToken=e}postTurnstileEvent(e,t){r.EVENTS_URL&&r.ACCESS_TOKEN&&Array.isArray(e)&&e.some((e=>o(e)||n(e)))&&this.queueRequest(Date.now(),t)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const i=mr(r.ACCESS_TOKEN),n=i?i.u:r.ACCESS_TOKEN;let o=n!==this.eventData.tokenU;ai(this.anonId)||(this.anonId=oi(),o=!0);const s=this.queue.shift();if(this.eventData.lastSuccess){const e=new Date(this.eventData.lastSuccess),t=new Date(s),i=(s-this.eventData.lastSuccess)/864e5;o=o||i>=1||i<-1||e.getDate()!==t.getDate()}else o=!0;o?this.postEvent(s,{sdkIdentifier:"mapbox-gl-js",sdkVersion:t,skuId:cr,"enabled.telemetry":!1,userId:this.anonId},(e=>{e||(this.eventData.lastSuccess=s,this.eventData.tokenU=n)}),e):this.processRequests()}},yr=gr.postTurnstileEvent.bind(gr),vr=new class extends _r{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(e,t,i,n){this.skuToken=t,this.errorCb=n,r.EVENTS_URL&&(i||r.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(ur)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:i,timestamp:r}=this.queue.shift();i&&this.success[i]||(this.anonId||this.fetchEventData(),ai(this.anonId)||(this.anonId=oi()),this.postEvent(r,{sdkIdentifier:"mapbox-gl-js",sdkVersion:t,skuId:cr,skuToken:this.skuToken,userId:this.anonId},(e=>{e?this.errorCb(e):i&&(this.success[i]=!0)}),e))}remove(){this.errorCb=null}},xr=vr.postMapLoadEvent.bind(vr),br=new class extends _r{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(e){let t=this.mapInstanceIdMap.get(e);return t||(t=oi(),this.mapInstanceIdMap.set(e,t)),t}getEventId(e){const t=this.eventIdPerMapInstanceMap.get(e)||0;return this.eventIdPerMapInstanceMap.set(e,t+1),t}postStyleLoadEvent(e,t){const{map:i,style:n,importedStyles:o}=t;if(!r.EVENTS_URL||!e&&!r.ACCESS_TOKEN)return;const s=this.getMapInstanceId(i),a={mapInstanceId:s,eventId:this.getEventId(s),style:n};o.length&&(a.importedStyles=o),this.queueRequest({timestamp:Date.now(),payload:a},e)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:t,payload:i}=this.queue.shift();this.postEvent(t,i,(()=>{}),e)}},wr=br.postStyleLoadEvent.bind(br),Tr=new class extends _r{constructor(){super("gljs.performance")}postPerformanceEvent(e,t){r.EVENTS_URL&&(e||r.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},e)}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{timestamp:i,performanceData:r}=this.queue.shift(),n=function(e){const i=performance.getEntriesByType("resource"),r=performance.getEntriesByType("mark"),n=function(e){const t={};if(e)for(const i in e)if("other"!==i)for(const r of e[i]){const e=`${i}ResolveRangeMin`,n=`${i}ResolveRangeMax`,o=`${i}RequestCount`,s=`${i}RequestCachedCount`;t[e]=Math.min(t[e]||1/0,r.startTime),t[n]=Math.max(t[n]||-1/0,r.responseEnd);const a=e=>{void 0===t[e]&&(t[e]=0),++t[e]};void 0!==r.transferSize&&0===r.transferSize&&a(s),a(o)}return t}(function(e,t){const i={};if(e)for(const r of e){const e=t(r);void 0===i[e]&&(i[e]=[]),i[e].push(r)}return i}(i,h)),o=window.devicePixelRatio,s=navigator.connection||navigator.mozConnection||navigator.webkitConnection,a=s?s.effectiveType:void 0,u={counters:[],metadata:[],attributes:[]},p=(e,t,i)=>{null!=i&&e.push({name:t,value:i.toString()})};for(const e in n)p(u.counters,e,n[e]);if(e.interactionRange[0]!==1/0&&e.interactionRange[1]!==-1/0&&(p(u.counters,"interactionRangeMin",e.interactionRange[0]),p(u.counters,"interactionRangeMax",e.interactionRange[1])),r)for(const e of Object.keys(c)){const t=c[e],i=r.find((e=>e.name===t));i&&p(u.counters,t,i.startTime)}return p(u.counters,"visibilityHidden",e.visibilityHidden),p(u.attributes,"style",function(e){if(e)for(const t of e){const e=t.name.split("?")[0];if(l(e)){const t=e.split("/").slice(-2);if(2===t.length)return`mapbox://styles/${t[0]}/${t[1]}`}}}(i)),p(u.attributes,"terrainEnabled",e.terrainEnabled?"true":"false"),p(u.attributes,"fogEnabled",e.fogEnabled?"true":"false"),p(u.attributes,"projection",e.projection),p(u.attributes,"zoom",e.zoom),p(u.metadata,"devicePixelRatio",o),p(u.metadata,"connectionEffectiveType",a),p(u.metadata,"navigatorUserAgent",navigator.userAgent),p(u.metadata,"screenWidth",window.screen.width),p(u.metadata,"screenHeight",window.screen.height),p(u.metadata,"windowWidth",window.innerWidth),p(u.metadata,"windowHeight",window.innerHeight),p(u.metadata,"mapWidth",e.width/o),p(u.metadata,"mapHeight",e.height/o),p(u.metadata,"webglRenderer",e.renderer),p(u.metadata,"webglVendor",e.vendor),p(u.metadata,"sdkVersion",t),p(u.metadata,"sdkIdentifier","mapbox-gl-js"),u}(r);for(const e of n.metadata);for(const e of n.counters);for(const e of n.attributes);this.postEvent(i,n,(()=>{}),e)}},Mr=Tr.postPerformanceEvent.bind(Tr),Er=new class extends _r{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(e,t,i,n){if(!r.API_URL||!r.SESSION_PATH)return;const o=pr(r.API_URL+r.SESSION_PATH);o.params.push(`sku=${t||""}`),o.params.push(`access_token=${n||r.ACCESS_TOKEN||""}`);const s={url:dr(o),headers:{"Content-Type":"text/plain"}};this.pendingRequest=function(e,t){return ir(ii(e,{method:"GET"}),t)}(s,(e=>{this.pendingRequest=null,i(e),this.saveEventData(),this.processRequests(n)}))}getSessionAPI(e,t,i,n){this.skuToken=t,this.errorCb=n,r.SESSION_PATH&&r.API_URL&&(i||r.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(ur)))}processRequests(e){if(this.pendingRequest||0===this.queue.length)return;const{id:t,timestamp:i}=this.queue.shift();
vendor: 1,069 bytes, line 1
1t&&this.success[t]||this.getSession(i,this.skuToken,(e=>{e?this.errorCb(e):t&&(this.success[t]=!0)}),e)}remove(){this.errorCb=null}},Sr=Er.getSessionAPI.bind(Er),Cr=new Set;var Ar={exports:{}},Ir={exports:function(e,t){for(var i,r=e.length,n=t^r,o=0;r>=4;)i=1540483477*(65535&(i=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++o;switch(r){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}},kr=function(e,t){var i,r,n,o,s,a,l,c;for(r=e.length-(i=3&e.length),n=t,s=3432918353,a=461845907,c=0;c<r;)l=255&e.charCodeAt(c)|(255&e.charCodeAt(++c))<<8|(255&e.charCodeAt(++c))<<16|(255&e.charCodeAt(++c))<<24,++c,n=27492+(65535&(o=5*(65535&(n=(n^=l=(6
15535&(l=(l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&e.charCodeAt(c+2))<<16;case 2:l^=(255&e.charCodeAt(c+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(c)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return n^=e.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0},Lr=Ir.exports;Ar.exports=kr,Ar.exports.murmur3=kr,Ar.exports.murmur2=Lr;var Pr=p(Ar.exports);class Rr{constructor(e,...t){ii(this,t[0]||{}),this.type=e}}class zr extends Rr{constructor(e,t={}){super("error",ii({error:e},t))}}function Or(e,t,i){i[e]&&-1!==i[e].indexOf(t)||(i[e]=i[e]||[],i[e].push(t))}function Dr(e,t,i){if(i&&i[e]){const r=i[e].indexOf(t);-1!==r&&i[e].splice(r,1)}}class Fr{on(e,t){return this._listeners=this._listeners||{},Or(e,t,this._listeners),this}off(e,t){return Dr(e,t,this._listeners),Dr(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},Or(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){const i="string"==typeof e?new Rr(e,t):e,r=i.type;if(this.listens(r)){i.target=this;const e=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const t of e)t.call(this,i);const t=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const e of t)Dr(r,e,this._oneTimeListeners),e.call(this,i);const n=this._eventedParent;n&&(ii(i,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(i))}else i instanceof zr&&console.error(i.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}e.G=void 0;var Br={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Nr(e){return(e=Math.round(e))<0?0:e>255?255:e}function jr(e){return Nr("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function Ur(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function Vr(e,t,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?e+(t-e)*i*6:2*i<1?t:3*i<2?e+(t-e)*(2/3-i)*6:e}try{e.G={}.parseCSSColor=function(e){var t,i=e.replace(/ /g,"").toLowerCase();if(i in Br)return Br[i].slice();if("#"===i[0])return 4===i.length?(t=parseInt(i.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===i.length&&(t=parseInt(i.substr(1),16))>=0&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var r=i.indexOf("("),n=i.indexOf(")");if(-1!==r&&n+1===i.length){var o=i.substr(0,r),s=i.substr(r+1,n-(r+1)).split(","),a=1;switch(o){case"rgba":if(4!==s.length)return null;a=Ur(s.pop());case"rgb":return 3!==s.length?null:[jr(s[0]),jr(s[1]),jr(s[2]),a];case"hsla":if(4!==s.length)return null;a=Ur(s.pop());case"hsl":if(3!==s.length)return null;var l=(parseFloat(s[0])%360+360)%360/360,c=Ur(s[1]),u=Ur(s[2]),h=u<=.5?u*(c+1):u+c-u*c,p=2*u-h;return[Nr(255*Vr(p,h,l+1/3)),Nr(255*Vr(p,h,l)),Nr(255*Vr(p,h,l-1/3)),a];default:return null}}return null}}catch(e){}class $r{constructor(e,t,i,r=1){this.r=e,this.g=t,this.b=i,this.a=r}static parse(t){if(!t)return;if(t instanceof $r)return t;if("string"!=typeof t)return;const i=e.G(t);return i?new $r(i[0]/255*i[3],i[1]/255*i[3],i[2]/255*i[3],i[3]):void 0}toString(){const[e,t,i,r]=0===this.a?[0,0,0,0]:[255*this.r/this.a,255*this.g/this.a,255*this.b/this.a,this.a];return`rgba(${Math.round(e)},${Math.round(t)},${Math.round(i)},${r})`}toRenderColor(e){const{r:t,g:i,b:r,a:n}=this;return new Gr(e,t,i,r,n)}}class Gr{constructor(e,t,i,r,n){if(e){const o=e.image.height,s=o*o;t=0===n?0:t/n*(o-1),i=0===n?0:i/n*(o-1),r=0===n?0:r/n*(o-1);const a=Math.floor(t),l=Math.floor(i),c=Math.floor(r),u=Math.ceil(t),h=Math.ceil(i),p=Math.ceil(r),d=t-a,f=i-l,m=r-c,_=e.image.data,g=4*(a+l*s+c*o),y=4*(a+l*s+p*o),v=4*(a+h*s+c*o),x=4*(a+h*s+p*o),b=4*(u+l*s+c*o),w=4*(u+l*s+p*o),T=4*(u+h*s+c*o),M=4*(u+h*s+p*o);if(g<0||M>=_.length)throw new Error("out of range");this.r=qr(qr(qr(_[g],_[y],m),qr(_[v],_[x],m),f),qr(qr(_[b],_[w],m),qr(_[T],_[M],m),f),d)/255*n,this.g=qr(qr(qr(_[g+1],_[y+1],m),qr(_[v+1],_[x+1],m),f),qr(qr(_[b+1],_[w+1],m),qr(_[T+1],_[M+1],m),f),d)/255*n,this.b=qr(qr(qr(_[g+2],_[y+2],m),qr(_[v+2],_[x+2],m),f),qr(qr(_[b+2],_[w+2],m),qr(_[T+2],_[M+2],m),f),d)/255*n,this.a=n}else this.r=t,this.g=i,this.b=r,this.a=n}toArray(){const{r:e,g:t,b:i,a:r}=this;return 0===r?[0,0,0,0]:[255*e/r,255*t/r,255*i/r,r]}toArray01(){const{r:e,g:t,b:i,a:r}=this;return 0===r?[0,0,0,0]:[e/r,t/r,i/r,r]}toArray01Scaled(e){const{r:t,g:i,b:r,a:n}=this;return 0===n?[0,0,0]:[t/n*e,i/n*e,r/n*e]}toArray01PremultipliedAlpha(){const{r:e,g:t,b:i,a:r}=this;return[e,t,i,r]}toArray01Linear(){const{r:e,g:t,b:i,a:r}=this;return 0===r?[0,0,0,0]:[Math.pow(e/r,2.2),Math.pow(t/r,2.2),Math.pow(i/r,2.2),r]}}function qr(e,t,i){return e*(1-i)+t*i}function Hr(e,t,i){return e.map(((e,r)=>qr(e,t[r],i)))}$r.black=new $r(0,0,0,1),$r.white=new $r(1,1,1,1),$r.transparent=new $r(0,0,0,0),$r.red=new $r(1,0,0,1),$r.blue=new $r(0,0,1,1);var Zr=Object.freeze({__proto__:null,array:Hr,color:function(e,t,i){return new $r(qr(e.r,t.r,i),qr(e.g,t.g,i),qr(e.b,t.b,i),qr(e.a,t.a,i))},number:qr});function Wr(e,...t){for(const i of t)for(const t in i)e[t]=i[t];return e}
vendor: 9,618 bytes, line 1
1class Xr extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class Qr{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[e,i]of t)this.bindings[e]=i}concat(e){return new Qr(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Yr={kind:"null"},Jr={kind:"number"},Kr={kind:"string"},en={kind:"boolean"},tn={kind:"color"},rn={kind:"object"},nn={kind:"value"},on={kind:"collator"},sn={kind:"formatted"},an={kind:"resolvedImage"};function ln(e,t){return{kind:"array",itemType:e,N:t}}function cn(e){if("array"===e.kind){const t=cn(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const un=[Yr,Jr,Kr,en,tn,sn,rn,ln(nn),an];function hn(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!hn(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of un)if(!hn(e,t))return null}return`Expected ${cn(e)} but found ${cn(t)} instead.`}function pn(e,t){return t.some((t=>t.kind===e.kind))}function dn(e,t){return t.some((t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e))}class fn{constructor(e,t,i){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class mn{constructor(e,t,i,r,n){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=n}}class _n{constructor(e){this.sections=e}static fromString(e){return new _n([new mn(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((e=>0!==e.text.length||e.image&&0!==e.image.namePrimary.length))}static factory(e){return e instanceof _n?e:_n.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}serialize(){const e=["format"];for(const t of this.sections){if(t.image){e.push(["image",t.image.namePrimary]);continue}e.push(t.text);const i={};t.fontStack&&(i["text-font"]=["literal",t.fontStack.split(",")]),t.scale&&(i["font-scale"]=t.scale),t.textColor&&(i["text-color"]=["rgba"].concat(t.textColor.toRenderColor(null).toArray())),e.push(i)}return e}}class gn{constructor(e){this.namePrimary=e.namePrimary,e.nameSecondary&&(this.nameSecondary=e.nameSecondary),this.available=e.available}toString(){return this.nameSecondary?`[${this.namePrimary},${this.nameSecondary}]`:this.namePrimary}static fromString(e,t){return e?new gn({namePrimary:e,nameSecondary:t,available:!1}):null}serialize(){return this.nameSecondary?["image",this.namePrimary,this.nameSecondary]:["image",this.namePrimary]}}function yn(e,t,i,r){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function vn(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof $r)return!0;if(e instanceof fn)return!0;if(e instanceof _n)return!0;if(e instanceof gn)return!0;if(Array.isArray(e)){for(const t of e)if(!vn(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!vn(e[t]))return!1;return!0}return!1}function xn(e){if(null===e)return Yr;if("string"==typeof e)return Kr;if("boolean"==typeof e)return en;if("number"==typeof e)return Jr;if(e instanceof $r)return tn;if(e instanceof fn)return on;if(e instanceof _n)return sn;if(e instanceof gn)return an;if(Array.isArray(e)){const t=e.length;let i;for(const t of e){const e=xn(t);if(i){if(i===e)continue;i=nn;break}i=e}return ln(i||nn,t)}return rn}function bn(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof $r||e instanceof _n||e instanceof gn?e.toString():JSON.stringify(e)}class wn{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!vn(e[1]))return t.error("invalid value");const i=e[1];let r=xn(i);const n=t.expectedType;return"array"!==r.kind||0!==r.N||!n||"array"!==n.kind||"number"==typeof n.N&&0!==n.N||(r=n),new wn(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof $r?["rgba"].concat(this.value.toRenderColor(null).toArray()):this.value instanceof _n?this.value.serialize():this.value}}class Tn{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Mn={string:Kr,number:Jr,boolean:en,object:rn};class En{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i,r=1;const n=e[0];if("array"===n){let n,o;if(e.length>2){const i=e[1];if("string"!=typeof i||!(i in Mn)||"object"===i)return t.error('The item type argument of "array" must be one of string, number, boolean',1);n=Mn[i],r++}else n=nn;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);o=e[2],r++}i=ln(n,o)}else i=Mn[n];const o=[];for(;r<e.length;r++){const i=t.parse(e[r],r,nn);if(!i)return null;o.push(i)}return new En(i,o)}evaluate(e){for(let t=0;t<this.args.length;t++){const i=this.args[t].evaluate(e);if(!hn(this.type,xn(i)))return i;if(t===this.args.length-1)throw new Tn(`The expression ${JSON.stringify(this.args[t].serialize())} evaluated to ${cn(xn(i))} but was expected to be of type ${cn(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){const e=this.type,t=[e.kind];if("array"===e.kind){const i=e.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){t.push(i.kind);const r=e.N;("number"==typeof r||this.args.length>1)&&t.push(r)}}return t.concat(this.args.map((e=>e.serialize())))}}class Sn{constructor(e){this.type=sn,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[1];if(!Array.isArray(i)&&"object"==typeof i)return t.error("First argument must be an image or text section.");const r=[];let n=!1;for(let i=1;i<=e.length-1;++i){const o=e[i];if(n&&"object"==typeof o&&!Array.isArray(o)){n=!1;let e=null;if(o["font-scale"]&&(e=t.parse(o["font-scale"],1,Jr),!e))return null;let i=null;if(o["text-font"]&&(i=t.parse(o["text-font"],1,ln(Kr)),!i))return null;let s=null;if(o["text-color"]&&(s=t.parse(o["text-color"],1,tn),!s))return null;const a=r[r.length-1];a.scale=e,a.font=i,a.textColor=s}else{const o=t.parse(e[i],1,nn);if(!o)return null;const s=o.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:o,scale:null,font:null,textColor:null})}}return new Sn(r)}evaluate(e){return new _n(this.sections.map((t=>{const i=t.content.evaluate(e);return xn(i)===an?new mn("",i,null,null,null):new mn(bn(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)})))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const t of this.sections){e.push(t.content.serialize());const i={};t.scale&&(i["font-scale"]=t.scale.serialize()),t.font&&(i["text-font"]=t.font.serialize()),t.textColor&&(i["text-color"]=t.textColor.serialize()),e.push(i)}return e}}class Cn{constructor(e,t){this.type=an,this.inputPrimary=e,this.inputSecondary=t}static parse(e,t){if(e.length<2)return t.error("Expected two or more arguments.");const i=t.parse(e[1],1,Kr);if(!i)return t.error("No image name provided.");if(2===e.length)return new Cn(i);const r=t.parse(e[2],1,Kr);return r?new Cn(i,r):t.error("Secondary image variant is not a string.")}evaluate(e){const t=gn.fromString(this.inputPrimary.evaluate(e),this.inputSecondary?this.inputSecondary.evaluate(e):void 0);return t&&e.availableImages&&(t.available=e.availableImages.indexOf(t.namePrimary)>-1,t.nameSecondary&&t.available&&e.availableImages&&(t.available=e.availableImages.indexOf(t.nameSecondary)>-1)),t}eachChild(e){e(this.inputPrimary),this.inputSecondary&&e(this.inputSecondary)}outputDefined(){return!1}serialize(){return this.inputSecondary?["image",this.inputPrimary.serialize(),this.inputSecondary.serialize()]:["image",this.inputPrimary.serialize()]}}function An(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}const In={"to-boolean":en,"to-color":tn,"to-number":Jr,"to-string":Kr};class kn{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const i=e[0],r=[];let n=Yr;
vendor: 8,588 bytes, line 1
1if("to-array"===i){if(!Array.isArray(e[1]))return null;const i=e[1].length;if(t.expectedType){if("array"!==t.expectedType.kind)return t.error(`Expected ${t.expectedType.kind} but found array.`);n=ln(t.expectedType.itemType,i)}else{if(!(i>0&&vn(e[1][0])))return null;n=ln(xn(e[1][0]),i)}for(let o=0;o<i;o++){const i=e[1][o];let s;if("array"===An(i))s=t.parse(i,void 0,n.itemType);else{const e=An(i);if(e!==n.itemType.kind)return t.error(`Expected ${n.itemType.kind} but found ${e}.`);s=t.registry.literal.parse(["literal",void 0===i?null:i],t)}if(!s)return null;r.push(s)}}else{if(("to-boolean"===i||"to-string"===i)&&2!==e.length)return t.error("Expected one argument.");n=In[i];for(let i=1;i<e.length;i++){const n=t.parse(e[i],i,nn);if(!n)return null;r.push(n)}}return new kn(n,r)}evaluate(e){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(e));if("color"===this.type.kind){let t,i;for(const r of this.args){if(t=r.evaluate(e),i=null,t instanceof $r)return t;if("string"==typeof t){const i=e.parseColor(t);if(i)return i}else if(Array.isArray(t)&&(i=t.length<3||t.length>4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:yn(t[0],t[1],t[2],t[3]),!i))return new $r(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Tn(i||`Could not parse color from value '${"string"==typeof t?t:String(JSON.stringify(t))}'`)}if("number"===this.type.kind){let t=null;for(const i of this.args){if(t=i.evaluate(e),null===t)return 0;const r=Number(t);if(!isNaN(r))return r}throw new Tn(`Could not convert ${JSON.stringify(t)} to number.`)}return"formatted"===this.type.kind?_n.fromString(bn(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?gn.fromString(bn(this.args[0].evaluate(e))):"array"===this.type.kind?this.args.map((t=>t.evaluate(e))):bn(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new Sn([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Cn(this.args[0]).serialize();const e="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild((t=>{e.push(t.serialize())})),e}}const Ln=["Unknown","Point","LineString","Polygon"];class Pn{constructor(e,t){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=t}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Ln[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,t=this.featureDistanceData.scale,{x:i,y:r}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(i*t-e[0])+this.featureDistanceData.bearing[1]*(r*t-e[1])}return 0}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=$r.parse(e)),t}getConfig(e){return this.options?this.options.get(e):null}}class Rn{constructor(e,t,i,r,n){this.name=e,this.type=t,this._evaluate=i,this.args=r,this._overloadIndex=n}evaluate(e){if(!this._evaluate){const e=Rn.definitions[this.name];this._evaluate=Array.isArray(e)?e[2]:e.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((e=>e.serialize())))}static parse(e,t){const i=e[0],r=Rn.definitions[i];if(!r)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,s=[];let a=null,l=-1;for(const[r,c]of o){if(Array.isArray(r)&&r.length!==e.length-1)continue;s.push(r),l++,a=new es(t.registry,t.path,null,t.scope,void 0,t._scope,t.options);const o=[];let u=!1;for(let t=1;t<e.length;t++){const i=e[t],n=Array.isArray(r)?r[t-1]:r.type,s=a.parse(i,1+o.length,n);if(!s){u=!0;break}o.push(s)}if(!u)if(Array.isArray(r)&&r.length!==o.length)a.error(`Expected ${r.length} arguments, but found ${o.length} instead.`);else{for(let e=0;e<o.length;e++){const t=Array.isArray(r)?r[e]:r.type,i=o[e];a.concat(e+1).checkSubtype(t,i.type)}if(0===a.errors.length)return new Rn(i,n,c,o,l)}}if(1===s.length)t.errors.push(...a.errors);else{const i=(s.length?s:o.map((([e])=>e))).map(zn).join(" | "),r=[];for(let i=1;i<e.length;i++){const n=t.parse(e[i],1+r.length);if(!n)return null;r.push(cn(n.type))}t.error(`Expected arguments of type ${i}, but found (${r.join(", ")}) instead.`)}return null}static register(e,t){Rn.definitions=t;for(const i in t)e[i]=Rn}}function zn(e){return Array.isArray(e)?`(${e.map(cn).join(", ")})`:`(${cn(e.type)}...)`}class On{constructor(e,t,i){this.type=on,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument.");const i=e[1];if("object"!=typeof i||Array.isArray(i))return t.error("Collator options argument must be an object.");const r=t.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,en);if(!r)return null;const n=t.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,en);if(!n)return null;let o=null;return i.locale&&(o=t.parse(i.locale,1,Kr),!o)?null:new On(r,n,o)}evaluate(e){return new fn(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function Dn(e,t,i=0,r=e.length-1,n=Bn){for(;r>i;){if(r-i>600){const o=r-i+1,s=t-i+1,a=Math.log(o),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(o-l)/o)*(s-o/2<0?-1:1);Dn(e,t,Math.max(i,Math.floor(t-s*l/o+c)),Math.min(r,Math.floor(t+(o-s)*l/o+c)),n)}const o=e[t];let s=i,a=r;for(Fn(e,i,t),n(e[r],o)>0&&Fn(e,i,r);s<a;){for(Fn(e,s,a),s++,a--;n(e[s],o)<0;)s++;for(;n(e[a],o)>0;)a--}0===n(e[i],o)?Fn(e,i,a):(a++,Fn(e,a,r)),a<=t&&(i=a+1),t<=a&&(r=a-1)}}function Fn(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function Bn(e,t){return e<t?-1:e>t?1:0}function Nn(e){let t=0;for(let i,r,n=0,o=e.length,s=o-1;n<o;s=n++)i=e[n],r=e[s],t+=(r.x-i.x)*(i.y+r.y);return t}function jn(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Un(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Vn(e,t,i){const r=e[0]-t[0],n=e[1]-t[1],o=e[0]-i[0],s=e[1]-i[1];return r*s-o*n==0&&r*o<=0&&n*s<=0}function $n(e,t,i=!1){let r=!1;for(let a=0,l=t.length;a<l;a++){const l=t[a];for(let t=0,a=l.length,c=a-1;t<a;c=t++){const a=l[c],u=l[t];if(Vn(e,a,u))return i;(o=a)[1]>(n=e)[1]!=(s=u)[1]>n[1]&&n[0]<(s[0]-o[0])*(n[1]-o[1])/(s[1]-o[1])+o[0]&&(r=!r)}}var n,o,s;return r}function Gn(e,t,i,r){const n=r[0]-i[0],o=r[1]-i[1],s=(e[0]-i[0])*o-n*(e[1]-i[1]),a=(t[0]-i[0])*o-n*(t[1]-i[1]);return s>0&&a<0||s<0&&a>0}function qn(e,t,i,r){return 0!=(n=[r[0]-i[0],r[1]-i[1]])[0]*(o=[t[0]-e[0],t[1]-e[1]])[1]-n[1]*o[0]&&!(!Gn(e,t,i,r)||!Gn(i,r,e,t));var n,o}const Hn=8192;function Zn(e,t){const i=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,n=Math.pow(2,t.z);return[Math.round(i*n*Hn),Math.round(r*n*Hn)]}function Wn(e,t){for(let i=0;i<t.length;i++)if($n(e,t[i]))return!0;return!1}function Xn(e,t,i){for(const r of i)for(let i=0,n=r.length,o=n-1;i<n;o=i++)if(qn(e,t,r[o],r[i]))return!0;return!1}function Qn(e,t){for(let i=0;i<e.length;++i)if(!$n(e[i],t))return!1;for(let i=0;i<e.length-1;++i)if(Xn(e[i],e[i+1],t))return!1;return!0}function Yn(e,t){for(let i=0;i<t.length;i++)if(Qn(e,t[i]))return!0;return!1}function Jn(e,t,i){const r=[];for(let n=0;n<e.length;n++){const o=[];for(let r=0;r<e[n].length;r++){const s=Zn(e[n][r],i);jn(t,s),o.push(s)}r.push(o)}return r}function Kn(e,t,i){const r=[];for(let n=0;n<e.length;n++){const o=Jn(e[n],t,i);r.push(o)}return r}function eo(e,t,i,r){if(e[0]<i[0]||e[0]>i[2]){const t=.5*r;let n=e[0]-i[0]>t?-r:i[0]-e[0]>
1t?r:0;0===n&&(n=e[0]-i[2]>t?-r:i[2]-e[0]>t?r:0),e[0]+=n}jn(t,e)}function to(e,t,i,r){const n=Math.pow(2,r.z)*Hn,o=[r.x*Hn,r.y*Hn],s=[];if(!e)return s;for(const r of e)for(const e of r){const r=[e.x+o[0],e.y+o[1]];eo(r,t,i,n),s.push(r)}return s}function io(e,t,i,r){const n=Math.pow(2,r.z)*Hn,o=[r.x*Hn,r.y*Hn],s=[];if(!e)return s;for(const i of e){const e=[];for(const r of i){const i=[r.x+o[0],r.y+o[1]];jn(t,i),e.push(i)}s.push(e)}if(t[2]-t[0]<=n/2){(a=t)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const e of s)for(const r of e)eo(r,t,i,n)}var a;return s}class ro{constructor(e,t){this.type=en,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(vn(e[1])){const t=e[1];if("FeatureCollection"===t.type)for(let e=0;e<t.features.length;++e){const i=t.features[e].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new ro(t,t.features[e].geometry)}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new ro(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new ro(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===t.type){const o=Jn(t.coordinates,r,n),s=to(e.geometry(),i,r,n);if(!Un(i,r))return!1;for(const e of s)if(!$n(e,o))return!1}if("MultiPolygon"===t.type){const o=Kn(t.coordinates,r,n),s=to(e.geometry(),i,r,n);if(!Un(i,r))return!1;for(const e of s)if(!Wn(e,o))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===t.type){const o=Jn(t.coordinates,r,n),s=io(e.geometry(),i,r,n);if(!Un(i,r))return!1;for(const e of s)if(!Qn(e,o))return!1}if("MultiPolygon"===t.type){const o=Kn(t.coordinates,r,n),s=io(e.geometry(),i,r,n);if(!Un(i,r))return!1;for(const e of s)if(!Yn(e,o))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const no={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},oo=1/298.257223563,so=oo*(2-oo),ao=Math.PI/180;class lo{static fromTile(e,t,i){const r=Math.PI*(1-2*(e+.5)/Math.pow(2,t)),n=Math.atan(.5*(Math.exp(r)-Math.exp(-r)))/ao;return new lo(n,i)}static get units(){return no}constructor(e,t){if(void 0===e)throw new Error("No latitude given.");if(t&&!no[t])throw new Error(`Unknown unit ${t}. Use one of: ${Object.keys(no).join(", ")}`);const i=6378.137*ao*(t?no[t]:1),r=Math.cos(e*ao),n=1/(1-so*(1-r*r)),o=Math.sqrt(n);this.kx=i*o*r,this.ky=i*o*n*(1-so)}distance(e,t){const i=ho(e[0]-t[0])*this.kx,r=(e[1]-t[1])*this.ky;return Math.sqrt(i*i+r*r)}bearing(e,t){const i=ho(t[0]-e[0])*this.kx;return Math.atan2(i,(t[1]-e[1])*this.ky)/ao}destination(e,t,i){const r=i*ao;return this.offset(e,Math.sin(r)*t,Math.cos(r)*t)}offset(e,t,i){return[e[0]+t/this.kx,e[1]+i/this.ky]}lineDistance(e){let t=0;for(let i=0;i<e.length-1;i++)t+=this.distance(e[i],e[i+1]);return t}area(e){let t=0;for(let i=0;i<e.length;i++){const r=e[i];for(let e=0,n=r.length,o=n-1;e<n;o=e++)t+=ho(r[e][0]-r[o][0])*(r[e][1]+r[o][1])*(i?-1:1)}return Math.abs(t)/2*this.kx*this.ky}along(e,t){let i=0;if(t<=0)return e[0];for(let r=0;r<e.length-1;r++){const n=e[r],o=e[r+1],s=this.distance(n,o);if(i+=s,i>t)return uo(n,o,(t-(i-s))/s)}return e[e.length-1]}pointToSegmentDistance(e,t,i){let[r,n]=t,o=ho(i[0]-r)*this.kx,s=(i[1]-n)*this.ky;if(0!==o||0!==s){const t=(ho(e[0]-r)*this.kx*o+(e[1]-n)*this.ky*s)/(o*o+s*s);t>1?(r=i[0],n=i[1]):t>0&&(r+=o/this.kx*t,n+=s/this.ky*t)}return o=ho(e[0]-r)*this.kx,s=(e[1]-n)*this.ky,Math.sqrt(o*o+s*s)}pointOnLine(e,t){let i=1/0,r=e[0][0],n=e[0][1],o=0,s=0;for(let a=0;a<e.length-1;a++){let l=e[a][0],c=e[a][1],u=ho(e[a+1][0]-l)*this.kx,h=(e[a+1][1]-c)*this.ky,p=0;0===u&&0===h||(p=(ho(t[0]-l)*this.kx*u+(t[1]-c)*this.ky*h)/(u*u+h*h),p>1?(l=e[a+1][0],c=e[a+1][1]):p>0&&(l+=u/this.kx*p,c+=h/this.ky*p)),u=ho(t[0]-l)*this.kx,h=(t[1]-c)*this.ky;const d=u*u+h*h;d<i&&(i=d,r=l,n=c,o=a,s=p)}return{point:[r,n],index:o,t:Math.max(0,Math.min(1,s))}}lineSlice(e,t,i){let r=this.pointOnLine(i,e),n=this.pointOnLine(i,t);if(r.index>n.index||r.index===n.index&&r.t>n.t){const e=r;r=n,n=e}const o=[r.point],s=r.index+1,a=n.index;!co(i[s],o[0])&&s<=a&&o.push(i[s]);for(let e=s+1;e<=a;e++)o.push(i[e]);return co(i[a],n.point)||o.push(n.point),o}lineSliceAlong(e,t,i){let r=0;const n=[];for(let o=0;o<i.length-1;o++){const s=i[o],a=i[o+1],l=this.distance(s,a);if(r+=l,r>e&&0===n.length&&n.push(uo(s,a,(e-(r-l))/l)),r>=t)return n.push(uo(s,a,(t-(r-l))/l)),n;r>e&&n.push(a)}return n}bufferPoint(e,t){const i=t/this.ky,r=t/this.kx;return[e[0]-r,e[1]-i,e[0]+r,e[1]+i]}bufferBBox(e,t){const i=t/this.ky,r=t/this.kx;return[e[0]-r,e[1]-i,e[2]+r,e[3]+i]}insideBBox(e,t){return ho(e[0]-t[0])>=0&&ho(e[0]-t[2])<=0&&e[1]>=t[1]&&e[1]<=t[3]}}function co(e,t){return e[0]===t[0]&&e[1]===t[1]}function uo(e,t,i){const r=ho(t[0]-e[0]);return[e[0]+r*i,e[1]+(t[1]-e[1])*i]}function ho(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}class po{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,r=t[e];for(;e>0;){const n=e-1>>1,o=t[n];if(i(r,o)>=0)break;t[e]=o,e=n}t[e]=r}_down(e){const{data:t,compare:i}=this,r=this.length>>1,n=t[e];for(;e<r;){let r=1+(e<<1);const o=r+1;if(o<this.length&&i(t[o],t[r])<0&&(r=o),i(t[r],n)>=0)break;t[e]=t[r],e=r}t[e]=n}}var fo=8192;function mo(e,t){return t.dist-e.dist}const _o=100,go=50;function yo(e){const t=[1/0,1/0,-1/0,-1/0];if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}function vo(e){return e[1]-e[0]+1}function xo(e,t){const i=e[1]>=e[0]&&e[1]<t;return i||console.warn("Distance Expression: Index is out of range"),i}function bo(e,t){if(e[0]>
1e[1])return[null,null];const i=vo(e);if(t){if(2===i)return[e,null];const t=Math.floor(i/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}{if(1===i)return[e,null];const t=Math.floor(i/2)-1;return[[e[0],e[0]+t],[e[0]+t+1,e[1]]]}}function wo(e,t){const i=[1/0,1/0,-1/0,-1/0];if(!xo(t,e.length))return i;for(let r=t[0];r<=t[1];++r)jn(i,e[r]);return i}function To(e){const t=[1/0,1/0,-1/0,-1/0];for(let i=0;i<e.length;++i)for(let r=0;r<e[i].length;++r)jn(t,e[i][r]);return t}function Mo(e,t,i){if(yo(e)||yo(t))return NaN;let r=0,n=0;return e[2]<t[0]&&(r=t[0]-e[2]),e[0]>t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]<t[1]&&(n=t[1]-e[3]),i.distance([0,0],[r,n])}function Eo(e){return 360*e-180}function So(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function Co(e,t){const i=Math.pow(2,t.z),r=(e.y/fo+t.y)/i;return[Eo((e.x/fo+t.x)/i),So(r)]}function Ao(e,t){const i=[];for(let r=0;r<e.length;++r)i.push(Co(e[r],t));return i}function Io(e,t,i){const r=i.pointOnLine(t,e).point;return i.distance(e,r)}function ko(e,t,i,r,n){const o=i.slice(r[0],r[1]+1);let s=1/0;for(let i=t[0];i<=t[1];++i)if(0===(s=Math.min(s,Io(e[i],o,n))))return 0;return s}function Lo(e,t,i,r,n){const o=Math.min(n.pointToSegmentDistance(e,i,r),n.pointToSegmentDistance(t,i,r)),s=Math.min(n.pointToSegmentDistance(i,e,t),n.pointToSegmentDistance(r,e,t));return Math.min(o,s)}function Po(e,t,i,r,n){if(!xo(t,e.length)||!xo(r,i.length))return NaN;let o=1/0;for(let s=t[0];s<t[1];++s)for(let t=r[0];t<r[1];++t){if(qn(e[s],e[s+1],i[t],i[t+1]))return 0;o=Math.min(o,Lo(e[s],e[s+1],i[t],i[t+1],n))}return o}function Ro(e,t,i,r,n){if(!xo(t,e.length)||!xo(r,i.length))return NaN;let o=1/0;for(let s=t[0];s<=t[1];++s)for(let t=r[0];t<=r[1];++t)if(0===(o=Math.min(o,n.distance(e[s],i[t]))))return o;return o}function zo(e,t,i){if($n(e,t,!0))return 0;let r=1/0;for(const n of t){const t=n.length;if(t<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(n[0]!==n[t-1]&&0===(r=Math.min(r,i.pointToSegmentDistance(e,n[t-1],n[0]))))return r;if(0===(r=Math.min(r,Io(e,n,i))))return r}return r}function Oo(e,t,i,r){if(!xo(t,e.length))return NaN;for(let r=t[0];r<=t[1];++r)if($n(e[r],i,!0))return 0;let n=1/0;for(let o=t[0];o<t[1];++o)for(const t of i)for(let i=0,s=t.length,a=s-1;i<s;a=i++){if(qn(e[o],e[o+1],t[a],t[i]))return 0;n=Math.min(n,Lo(e[o],e[o+1],t[a],t[i],r))}return n}function Do(e,t){for(const i of e)for(let e=0;e<=i.length-1;++e)if($n(i[e],t,!0))return!0;return!1}function Fo(e,t,i,r=1/0){const n=To(e),o=To(t);if(r!==1/0&&Mo(n,o,i)>=r)return r;if(Un(n,o)){if(Do(e,t))return 0}else if(Do(t,e))return 0;let s=r;for(const r of e)for(let e=0,n=r.length,o=n-1;e<n;o=e++)for(const n of t)for(let t=0,a=n.length,l=a-1;t<a;l=t++){if(qn(r[o],r[e],n[l],n[t]))return 0;s=Math.min(s,Lo(r[o],r[e],n[l],n[t],i))}return s}function Bo(e,t,i,r,n,o,s){if(null===o||null===s)return;const a=Mo(wo(r,o),wo(n,s),i);a<t&&e.push({dist:a,range1:o,range2:s})}function No(e,t,i,r,n=1/0){let o=Math.min(r.distance(e[0],i[0][0]),n);if(0===o)return o;const s=new po([{dist:0,range1:[0,e.length-1],range2:[0,0]}],mo),a=t?go:_o,l=To(i);for(;s.length;){const n=s.pop();if(n.dist>=o)continue;const c=n.range1;if(vo(c)<=a){if(!xo(c,e.length))return NaN;if(t){const t=Oo(e,c,i,r);if(0===(o=Math.min(o,t)))return o}else for(let t=c[0];t<=c[1];++t){const n=zo(e[t],i,r);if(0===(o=Math.min(o,n)))return o}}else{const i=bo(c,t);if(null!==i[0]){const t=Mo(wo(e,i[0]),l,r);t<o&&s.push({dist:t,range1:i[0],range2:[0,0]})}if(null!==i[1]){const t=Mo(wo(e,i[1]),l,r);t<o&&s.push({dist:t,range1:i[1],range2:[0,0]})}}}return o}function jo(e,t,i,r,n,o=1/0){let s=Math.min(o,n.distance(e[0],i[0]));if(0===s)return s;const a=new po([{dist:0,range1:[0,e.length-1],range2:[0,i.length-1]}],mo),l=t?go:_o,c=r?go:_o;for(;a.length;){const o=a.pop();if(o.dist>=s)continue;const u=o.range1,h=o.range2;if(vo(u)<=l&&vo(h)<=c){if(!xo(u,e.length)||!xo(h,i.length))return NaN;if(t&&r?s=Math.min(s,Po(e,u,i,h,n)):t||r?t&&!r?s=Math.min(s,ko(i,h,e,u,n)):!t&&r&&(s=Math.min(s,ko(e,u,i,h,n))):s=Math.min(s,Ro(e,u,i,h,n)),0===s)return s}else{const o=bo(u,t),l=bo(h,r);Bo(a,s,n,e,i,o[0],l[0]),Bo(a,s,n,e,i,o[0],l[1]),Bo(a,s,n,e,i,o[1],l[0]),Bo(a,s,n,e,i,o[1],l[1])}}return s}function Uo(e,t,i,r,n=1/0){let o=n;const s=wo(e,[0,e.length-1]);for(const n of i)if(!(o!==1/0&&Mo(s,wo(n,[0,n.length-1]),r)>=o)&&(o=Math.min(o,jo(e,t,n,!0,r,o)),0===o))return o;return o}function Vo(e,t,i,r,n=1/0){let o=n;const s=wo(e,[0,e.length-1]);for(const n of i){if(o!==1/0&&Mo(s,To(n),r)>=o)continue;const i=No(e,t,n,r,o);if(isNaN(i))return i;if(0===(o=Math.min(o,i)))return o}return o}function $o(e){return"Point"===e||"MultiPoint"===e||"LineString"===e||"MultiLineString"===e||"Polygon"===e||"MultiPolygon"===e}class Go{constructor(e,t){this.type=Jr,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(vn(e[1])){const t=e[1];if("FeatureCollection"===t.type){for(let e=0;e<t.features.length;++e)if($o(t.features[e].geometry.type))return new Go(t,t.features[e].geometry)}else if("Feature"===t.type){if($o(t.geometry.type))return new Go(t,t.geometry)}else if($o(t.type))return new Go(t,t)}return t.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const t=e.geometry(),i=e.canonicalID();if(null!=t&&null!=i){if("Point"===e.geometryType())return function(e,t,i){const r=[];for(const i of e)for(const e of i)r.push(Co(e,t));const n=new lo(r[0][1],"meters");return"Point"===i.type||"MultiPoint"===i.type||"LineString"===i.type?jo(r,!1,"Point"===i.type?[i.coordinates]:i.coordinates,"LineString"===i.type,n):"MultiLineString"===i.type?Uo(r,!1,i.coordinates,n):"Polygon"===i.t
1ype||"MultiPolygon"===i.type?Vo(r,!1,"Polygon"===i.type?[i.coordinates]:i.coordinates,n):null}(t,i,this.geometries);if("LineString"===e.geometryType())return function(e,t,i){const r=[];for(const i of e){const e=[];for(const r of i)e.push(Co(r,t));r.push(e)}const n=new lo(r[0][0][1],"meters");if("Point"===i.type||"MultiPoint"===i.type||"LineString"===i.type)return Uo("Point"===i.type?[i.coordinates]:i.coordinates,"LineString"===i.type,r,n);if("MultiLineString"===i.type){let e=1/0;for(let t=0;t<i.coordinates.length;t++){const o=Uo(i.coordinates[t],!0,r,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))return e}return e}if("Polygon"===i.type||"MultiPolygon"===i.type){let e=1/0;for(let t=0;t<r.length;t++){const o=Vo(r[t],!0,"Polygon"===i.type?[i.coordinates]:i.coordinates,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))return e}return e}return null}(t,i,this.geometries);if("Polygon"===e.geometryType())return function(e,t,i){const r=[];for(const i of function(e,t){const i=e.length;if(i<=1)return[e];const r=[];let n,o;for(let t=0;t<i;t++){const i=Nn(e[t]);0!==i&&(e[t].area=Math.abs(i),void 0===o&&(o=i<0),o===i<0?(n&&r.push(n),n=[e[t]]):n.push(e[t]))}return n&&r.push(n),r}(e)){const e=[];for(let r=0;r<i.length;++r)e.push(Ao(i[r],t));r.push(e)}const n=new lo(r[0][0][0][1],"meters");if("Point"===i.type||"MultiPoint"===i.type||"LineString"===i.type)return Vo("Point"===i.type?[i.coordinates]:i.coordinates,"LineString"===i.type,r,n);if("MultiLineString"===i.type){let e=1/0;for(let t=0;t<i.coordinates.length;t++){const o=Vo(i.coordinates[t],!0,r,n,e);if(isNaN(o))return o;if(0===(e=Math.min(e,o)))return e}return e}return"Polygon"===i.type||"MultiPolygon"===i.type?function(e,t,i){let r=1/0;for(const n of e)for(const e of t){const t=Fo(n,e,i,r);if(isNaN(t))return t;if(0===(r=Math.min(r,t)))return r}return r}("Polygon"===i.type?[i.coordinates]:i.coordinates,r,n):null}(t,i,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function qo(e,t){switch(e){case"string":return bn(t);case"number":return+t;case"boolean":return!!t;case"color":return $r.parse(t);case"formatted":return _n.fromString(bn(t));case"resolvedImage":return gn.fromString(bn(t))}return t}function Ho(e,t,i,r){return void 0!==r&&(e=r*Math.round(e/r)),void 0!==t&&e<t&&(e=t),void 0!==i&&e>i&&(e=i),e}class Zo{constructor(e,t,i){this.type=e,this.key=t,this.scope=i}static parse(e,t){let i=t.expectedType;if(null==i&&(i=nn),e.length<2||e.length>3)return t.error("Invalid number of arguments for 'config' expression.");const r=t.parse(e[1],1);if(!(r instanceof wn))return t.error("Key name of 'config' expression must be a string literal.");if(e.length>=3){const n=t.parse(e[2],2);return n instanceof wn?new Zo(i,bn(r.value),bn(n.value)):t.error("Scope of 'config' expression must be a string literal.")}return new Zo(i,bn(r.value))}evaluate(e){const t=[this.key,this.scope,e.scope].filter(Boolean).join("�"),i=e.getConfig(t);if(!i)return null;const{type:r,value:n,values:o,minValue:s,maxValue:a,stepValue:l}=i,c=i.default.evaluate(e);let u=c;if(n){const t=e.scope;e.scope=(t||"").split("�").slice(1).join("�"),u=n.evaluate(e),e.scope=t}return r&&(u=qo(r,u)),void 0===u||void 0===s&&void 0===a&&void 0===l||("number"==typeof u?u=Ho(u,s,a,l):Array.isArray(u)&&(u=u.map((e=>"number"==typeof e?Ho(e,s,a,l):e)))),void 0!==n&&void 0!==u&&o&&!o.includes(u)&&(u=c,r&&(u=qo(r,u))),(r&&r!==this.type||void 0!==u&&xn(u)!==this.type)&&(u=qo(this.type.kind,u)),u}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.key),e}}function Wo(e){if(e instanceof Rn){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof ro)return!1;if(e instanceof Go)return!1;let t=!0;return e.eachChild((e=>{t&&!Wo(e)&&(t=!1)})),t}function Xo(e){if(e instanceof Rn&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild((e=>{t&&!Xo(e)&&(t=!1)})),t}function Qo(e){if(e instanceof Zo)return new Set([e.key]);let t=new Set;return e.eachChild((e=>{t=new Set([...t,...Qo(e)])}
vendor: 38,879 bytes, line 1
1)),t}function Yo(e,t){if(e instanceof Rn&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild((e=>{i&&!Yo(e,t)&&(i=!1)})),i}class Jo{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const i=e[1];return t.scope.has(i)?new Jo(i,t.scope.get(i)):t.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Ko{constructor(e,t=[],i,r=new Qr,n=[],o,s){this.registry=e,this.path=t,this.key=t.map((e=>`[${e}]`)).join(""),this.scope=r,this.errors=n,this.expectedType=i,this._scope=o,this.options=s}parse(e,t,i,r,n={}){return t||i?this.concat(t,i,r)._parse(e,n):this._parse(e,n)}_parse(e,t){function i(e,t,i){return"assert"===i?new En(t,[e]):"coerce"===i?new kn(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const r="string"==typeof e[0]?this.registry[e[0]]:void 0;if(r){let n=r.parse(e,this);if(!n)return null;if(this.expectedType){const e=this.expectedType,r=n.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==r.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==r.kind&&"string"!==r.kind){if(this.checkSubtype(e,r))return null}else n=i(n,e,t.typeAnnotation||"coerce");else n=i(n,e,t.typeAnnotation||"assert")}if(!(n instanceof wn)&&"resolvedImage"!==n.type.kind&&ts(n)){const t=new Pn(this._scope,this.options);try{n=new wn(n.type,n.evaluate(t))}catch(e){return this.error(e.message),null}}return n}return kn.parse(["to-array",e],this)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i){const r="number"==typeof e?this.path.concat(e):this.path,n=i?this.scope.concat(i):this.scope;return new Ko(this.registry,r,t||null,n,this.errors,this._scope,this.options)}error(e,...t){const i=`${this.key}${t.map((e=>`[${e}]`)).join("")}`;this.errors.push(new Xr(i,e))}checkSubtype(e,t){const i=hn(e,t);return i&&this.error(i),i}}var es=Ko;function ts(e){if(e instanceof Jo)return ts(e.boundExpression);if(e instanceof Rn&&"error"===e.name)return!1;if(e instanceof On)return!1;if(e instanceof ro)return!1;if(e instanceof Go)return!1;if(e instanceof Zo)return!1;const t=e instanceof kn||e instanceof En;let i=!0;return e.eachChild((e=>{i=t?i&&ts(e):i&&e instanceof wn})),!!i&&Wo(e)&&Yo(e,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function is(e,t){const i=e.length-1;let r,n,o=0,s=i,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),r=e[a],n=e[a+1],r<=t){if(a===i||t<n)return a;o=a+1}else{if(!(r>t))throw new Tn("Input is not a number.");s=a-1}return 0}class rs{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[e,t]of i)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const i=t.parse(e[1],1,Jr);if(!i)return null;const r=[];let n=null;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);for(let i=1;i<e.length;i+=2){const o=1===i?-1/0:e[i],s=e[i+1],a=i,l=i+1;if("number"!=typeof o)return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(r.length&&r[r.length-1][0]>=o)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=t.parse(s,l,n);if(!c)return null;n=n||c.type,r.push([o,c])}return new rs(n,i,r)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;return r>=t[n-1]?i[n-1].evaluate(e):i[is(t,r)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){const e=["step",this.input.serialize()];for(let t=0;t<this.labels.length;t++)t>0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}const ns=.95047,os=1.08883,ss=4/29,as=6/29,ls=3*as*as,cs=as*as*as,us=Math.PI/180,hs=180/Math.PI;function ps(e){return e>cs?Math.pow(e,1/3):e/ls+ss}function ds(e){return e>as?e*e*e:ls*(e-ss)}function fs(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function ms(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function _s(e){const t=ms(e.r),i=ms(e.g),r=ms(e.b),n=ps((.4124564*t+.3575761*i+.1804375*r)/ns),o=ps((.2126729*t+.7151522*i+.072175*r)/1);return{l:116*o-16,a:500*(n-o),b:200*(o-ps((.0193339*t+.119192*i+.9503041*r)/os)),alpha:e.a}}function gs(e){let t=(e.l+16)/116,i=isNaN(e.a)?t:t+e.a/500,r=isNaN(e.b)?t:t-e.b/200;return t=1*ds(t),i=ns*ds(i),r=os*ds(r),new $r(fs(3.2404542*i-1.5371385*t-.4985314*r),fs(-.969266*i+1.8760108*t+.041556*r),fs(.0556434*i-.2040259*t+1.0572252*r),e.alpha)}function ys(e,t,i){const r=t-e;return e+i*(r>180||r<-180?r-360*Math.round(r/360):r)}const vs={forward:_s,reverse:gs,interpolate:function(e,t,i){return{l:qr(e.l,t.l,i),a:qr(e.a,t.a,i),b:qr(e.b,t.b,i),alpha:qr(e.alpha,t.alpha,i)}}},xs={forward:function(e){const{l:t,a:i,b:r}=_s(e),n=Math.atan2(r,i)*hs;return{h:n<0?n+360:n,c:Math.sqrt(i*i+r*r),l:t,alpha:e.a}},reverse:function(e){const t=e.h*us,i=e.c;return gs({l:e.l,a:Math.cos(t)*i,b:Math.sin(t)*i,alpha:e.alpha})},interpolate:function(e,t,i){return{h:ys(e.h,t.h,i),c:qr(e.c,t.c,i),l:qr(e.l,t.l,i),alpha:qr(e.alpha,t.alpha,i)}}};var bs=Object.freeze({__proto__:null,hcl:xs,lab:vs});class ws{constructor(e,t,i,r,n){this.type=e,this.operator=t,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(const[e,t]of n)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,i,r){let n=0;if("exponential"===e.name)n=Ts(t,e.base,i,r);else if("linear"===e.name)n=Ts(t,1,i,r);else if("cubic-bezier"===e.name){const o=e.controlPoints;n=new Bt(o[0],o[1],o[2],o[3]).solve(Ts(t,1,i,r))}return n}static parse(e,t){let[i,r,n,...o]=e;if(!Array.isArray(r)||0===r.length)return t.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const e=r[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:e}}else{if("cubic-bezier"!==r[0])return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{const e=r.slice(1);if(4!==e.length||e.some((e=>"number"!=typeof e||e<0||e>1)))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(n=t.parse(n,2,Jr),!n)return null;const s=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=tn:t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);for(let e=0;e<o.length;e+=2){const i=o[e],r=o[e+1],n=e+3,l=e+4;if("number"!=typeof i)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(s.length&&s[s.length-1][0]>=i)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const c=t.parse(r,l,a);if(!c)return null;a=a||c.type,s.push([i,c])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new ws(a,i,r,n,s):t.error(`Type ${cn(a)} is not interpolatable.`)}evaluate(e){const t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);const n=t.length;if(r>=t[n-1])return i[n-1].evaluate(e);const o=is(t,r),s=ws.interpolationFactor(this.interpolation,r,t[o],t[o+1]),a=i[o].evaluate(e),l=i[o+1].evaluate(e);return"interpolate"===this.operator?Zr[this.type.kind.toLowerCase()](a,l,s):"interpolate-hcl"===this.operator?xs.reverse(xs.interpolate(xs.forward(a),xs.forward(l),s)):vs.reverse(vs.interpolate(vs.forward(a),vs.forward(l),s))}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}serialize(){let e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const t=[this.operator,e,this.input.serialize()];for(let e=0;e<this.labels.length;e++)t.push(this.labels[e],this.outputs[e].serialize());return t}}function Ts(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}class Ms{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expectected at least one argument.");let i=null;const r=t.expectedType;r&&"value"!==r.kind&&(i=r);const n=[];for(const r of e.slice(1)){const e=t.parse(r,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!e)return null;i=i||e.type,n.push(e)}const o=r&&n.some((e=>hn(r,e.type)));return new Ms(o?nn:i,n)}evaluate(e){let t,i=null,r=0;for(const n of this.args){if(r++,i=n.evaluate(e),i&&i instanceof gn&&!i.available&&(t||(t=i),i=null,r===this.args.length))return t;if(null!==i)break}return i}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}serialize(){const e=["coalesce"];return this.eachChild((t=>{e.push(t.serialize())})),e}}class Es{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const i=[];for(let r=1;r<e.length-1;r+=2){const n=e[r];if("string"!=typeof n)return t.error(`Expected string, but found ${typeof n} instead.`,r);if(/[^a-zA-Z0-9_]/.test(n))return t.error("Variable names must contain only alphanumeric characters or '_'.",r);const o=t.parse(e[r+1],r+1);if(!o)return null;i.push([n,o])}const r=t.parse(e[e.length-1],e.length-1,t.expectedType,i);return r?new Es(i,r):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[t,i]of this.bindings)e.push(t,i.serialize());return e.push(this.result.serialize()),e}}class Ss{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,Jr),r=t.parse(e[2],2,ln(t.expectedType||nn));return i&&r?new Ss(r.type.itemType,i,r):null}evaluate(e){const t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new Tn(`Array index out of bounds: ${t} < 0.`);if(t>=i.length)throw new Tn(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new Tn(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Cs{constructor(e,t){this.type=en,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,nn),r=t.parse(e[2],2,nn);return i&&r?pn(i.type,[en,Kr,Jr,Yr,nn])?new Cs(i,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${cn(i.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(null==i)return!1;if(!dn(t,["boolean","string","number","null"]))throw new Tn(`Expected first argument to be of type boolean, string, number or null, but found ${cn(xn(t))} instead.`);if(!dn(i,["string","array"]))throw new Tn(`Expected second argument to be of type array or string, but found ${cn(xn(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class As{constructor(e,t,i){this.type=Jr,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,nn),r=t.parse(e[2],2,nn);if(!i||!r)return null;if(!pn(i.type,[en,Kr,Jr,Yr,nn]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${cn(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Jr);return n?new As(i,r,n):null}return new As(i,r)}evaluate(e){const t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!dn(t,["boolean","string","number","null"]))throw new Tn(`Expected first argument to be of type boolean, string, number or null, but found ${cn(xn(t))} instead.`);if(!dn(i,["string","array"]))throw new Tn(`Expected second argument to be of type array or string, but found ${cn(xn(i))} instead.`);if(this.fromIndex){const r=this.fromIndex.evaluate(e);return i.indexOf(t,r)}return i.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Is{constructor(e,t,i,r,n,o){this.inputType=e,this.type=t,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let i,r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const n={},o=[];for(let s=2;s<e.length-1;s+=2){let a=e[s];const l=e[s+1];Array.isArray(a)||(a=[a]);const c=t.concat(s);if(0===a.length)return c.error("Expected at least one branch label.");for(const e of a){if("number"!=typeof e&&"string"!=typeof e)return c.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(i){if(c.checkSubtype(i,xn(e)))return null}else i=xn(e);if(void 0!==n[String(e)])return c.error("Branch labels must be unique.");n[String(e)]=o.length}const u=t.parse(l,s,r);if(!u)return null;r=r||u.type,o.push(u)}const s=t.parse(e[1],1,nn);if(!s)return null;const a=t.parse(e[e.length-1],e.length-1,r);return a?"value"!==s.type.kind&&t.concat(1).checkSubtype(i,s.type)?null:new Is(i,r,s,n,o,a):null}evaluate(e){const t=this.input.evaluate(e);return(xn(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],t=Object.keys(this.cases).sort(),i=[],r={};for(const e of t){const t=r[this.cases[e]];void 0===t?(r[this.cases[e]]=i.length,i.push([this.cases[e],[e]])):i[t][1].push(e)}const n=e=>"number"===this.inputType.kind?Number(e):e;for(const[t,r]of i)e.push(1===r.length?n(r[0]):r.map(n)),e.push(this.outputs[t].serialize());return e.push(this.otherwise.serialize()),e}}class ks{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);const r=[];for(let n=1;n<e.length-1;n+=2){const o=t.parse(e[n],n,en);if(!o)return null;const s=t.parse(e[n+1],n+1,i);if(!s)return null;r.push([o,s]),i=i||s.type}const n=t.parse(e[e.length-1],e.length-1,i);return n?new ks(i,r,n):null}evaluate(e){for(const[t,i]of this.branches)if(t.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,i]of this.branches)e(t),e(i);e(this.otherwise)}outputDefined(){return this.branches.every((([e,t])=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild((t=>{e.push(t.serialize())})),e}}class Ls{constructor(e,t,i,r){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const i=t.parse(e[1],1,nn),r=t.parse(e[2],2,Jr);if(!i||!r)return null;if(!pn(i.type,[ln(nn),Kr,nn]))return t.error(`Expected first argument to be of type array or string, but found ${cn(i.type)} instead`);if(4===e.length){const n=t.parse(e[3],3,Jr);return n?new Ls(i.type,i,r,n):null}return new Ls(i.type,i,r)}evaluate(e){const t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);if(!dn(t,["string","array"]))throw new Tn(`Expected first argument to be of type array or string, but found ${cn(xn(t))} instead.`);if(this.endIndex){const r=this.endIndex.evaluate(e);return t.slice(i,r)}return t.slice(i)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function Ps(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function Rs(e,t,i,r){return 0===r.compare(t,i)}function zs(e,t,i){const r="=="!==e&&"!="!==e;return class n{constructor(e,t,i){this.type=en,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const i=e[0];let o=t.parse(e[1],1,nn);if(!o)return null;if(!Ps(i,o.type))return t.concat(1).error(`"${i}" comparisons are not supported for type '${cn(o.type)}'.`);let s=t.parse(e[2],2,nn);if(!s)return null;if(!Ps(i,s.type))return t.concat(2).error(`"${i}" comparisons are not supported for type '${cn(s.type)}'.`);if(o.type.kind!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error(`Cannot compare types '${cn(o.type)}' and '${cn(s.type)}'.`);r&&("value"===o.type.kind&&"value"!==s.type.kind?o=new En(s.type,[o]):"value"!==o.type.kind&&"value"===s.type.kind&&(s=new En(o.type,[s])));let a=null;if(4===e.length){if("string"!==o.type.kind&&"string"!==s.type.kind&&"value"!==o.type.kind&&"value"!==s.type.kind)return t.error("Cannot use collator to compare non-string types.");if(a=t.parse(e[3],3,on),!a)return null}return new n(o,s,a)}evaluate(n){const o=this.lhs.evaluate(n),s=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){const t=xn(o),i=xn(s);if(t.kind!==i.kind||"string"!==t.kind&&"number"!==t.kind)throw new Tn(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${i.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const e=xn(o),i=xn(s);if("string"!==e.kind||"string"!==i.kind)return t(n,o,s)}return this.collator?i(n,o,s,this.collator.evaluate(n)):t(n,o,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){const t=[e];return this.eachChild((e=>{t.push(e.serialize())})),t}}}const Os=zs("==",(function(e,t,i){return t===i}),Rs),Ds=zs("!=",(function(e,t,i){return t!==i}),(function(e,t,i,r){return!Rs(0,t,i,r)})),Fs=zs("<",(function(e,t,i){return t<i}),(function(e,t,i,r){return r.compare(t,i)<0})),Bs=zs(">",(function(e,t,i){return t>i}),(function(e,t,i,r){return r.compare(t,i)>0})),Ns=zs("<=",(function(e,t,i){return t<=i}),(function(e,t,i,r){return r.compare(t,i)<=0})),js=zs(">=",(function(e,t,i){return t>=i}),(function(e,t,i,r){return r.compare(t,i)>=0}));class Us{constructor(e,t,i,r,n,o){this.type=Kr,this.number=e,this.locale=t,this.currency=i,this.unit=r,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const i=t.parse(e[1],1,Jr);if(!i)return null;const r=e[2];if("object"!=typeof r||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=t.parse(r.locale,1,Kr),!n))return null;let o=null;if(r.currency&&(o=t.parse(r.currency,1,Kr),!o))return null;let s=null;if(r.unit&&(s=t.parse(r.unit,1,Kr),!s))return null;let a=null;if(r["min-fraction-digits"]&&(a=t.parse(r["min-fraction-digits"],1,Jr),!a))return null;let l=null;return r["max-fraction-digits"]&&(l=t.parse(r["max-fraction-digits"],1,Jr),!l)?null:new Us(i,n,o,s,a,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class Vs{constructor(e){this.type=Jr,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);const i=t.parse(e[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?t.error(`Expected argument of type string or array, but found ${cn(i.type)} instead.`):new Vs(i):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new Tn(`Expected value to be of type string or array, but found ${cn(xn(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild((t=>{e.push(t.serialize())})),e}}function $s(e){return function(){e=1831565813+(e|=0)|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}const Gs={"==":Os,"!=":Ds,">":Bs,"<":Fs,">=":js,"<=":Ns,array:En,at:Ss,boolean:En,case:ks,coalesce:Ms,collator:On,format:Sn,image:Cn,in:Cs,"index-of":As,interpolate:ws,"interpolate-hcl":ws,"interpolate-lab":ws,length:Vs,let:Es,literal:wn,match:Is,number:En,"number-format":Us,object:En,slice:Ls,step:rs,string:En,"to-boolean":kn,"to-color":kn,"to-number":kn,"to-string":kn,var:Jo,within:ro,distance:Go,config:Zo};function qs(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);const o=n?n.evaluate(e):1,s=yn(t,i,r,o);if(s)throw new Tn(s);return new $r(t/255*o,i/255*o,r/255*o,o)}function Hs(e,[t,i,r,n]){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);const o=n?n.evaluate(e):1,s=function(e,t,i,r){return"number"==typeof e&&e>=0&&e<=360?"number"==typeof t&&t>=0&&t<=100&&"number"==typeof i&&i>=0&&i<=100?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid hsla value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", ")}]: 'h' must be between 0 and 360.`}(t,i,r,o);if(s)throw new Tn(s);const a=`hsla(${t}, ${i}%, ${r}%, ${o})`,l=$r.parse(a);if(!l)throw new Tn(`Failed to parse HSLA color: ${a}`);return l}function Zs(e,t){return e in t}function Ws(e,t){const i=t[e];return void 0===i?null:i}function Xs(e){return{type:e}}function Qs(e){return{result:"success",value:e}}function Ys(e){return{result:"error",value:e}}function Js(e,t){return!!e&&!!e.parameters&&e.parameters.indexOf(t)>-1}function Ks(e){return"data-driven"===e["property-type"]}function ea(e){return Js(e.expression,"measure-light")}function ta(e){return Js(e.expression,"zoom")}function ia(e){return!!e.expression&&e.expression.interpolated}function ra(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function na(e){return e}function oa(e,t){const i="color"===t.type,r=e.stops&&"object"==typeof e.stops[0][0],n=r||!(r||void 0!==e.property),o=e.type||(ia(t)?"exponential":"interval");if(i&&((e=Wr({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],$r.parse(e[1])]))),e.default=$r.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!bs[e.colorSpace])throw new Error(`Unknown color space: ${e.colorSpace}`);let s,a,l;if("exponential"===o)s=ca;else if("interval"===o)s=la;else if("categorical"===o){s=aa,a=Object.create(null);for(const t of e.stops)a[t[0]]=t[1];l=typeof e.stops[0][0]}else{if("identity"!==o)throw new Error(`Unknown function type "${o}"`);s=ua}if(r){const i={},r=[];for(let t=0;t<e.stops.length;t++){const n=e.stops[t],o=n[0].zoom;void 0===i[o]&&(i[o]={zoom:o,type:e.type,property:e.property,default:e.default,stops:[]},r.push(o)),i[o].stops.push([n[0].value,n[1]])}const n=[];for(const e of r)n.push([i[e].zoom,oa(i[e],t)]);const o={name:"linear"};return{kind:"composite",interpolationType:o,interpolationFactor:ws.interpolationFactor.bind(void 0,o),zoomStops:n.map((e=>e[0])),evaluate:({zoom:i},r)=>ca({stops:n,base:e.base},t,i).evaluate(i,r)}}if(n){const i="exponential"===o?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:ws.interpolationFactor.bind(void 0,i),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:i})=>s(e,t,i,a,l)}}return{kind:"source",evaluate(i,r){const n=r&&r.properties?r.properties[e.property]:void 0;return void 0===n?sa(e.default,t.default):s(e,t,n,a,l)}}}function sa(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function aa(e,t,i,r,n){return sa(typeof i===n?r[i]:void 0,e.default,t.default)}function la(e,t,i){if("number"!==An(i))return sa(e.default,t.default);const r=e.stops.length;if(1===r)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];const n=is(e.stops.map((e=>e[0])),i);return e.stops[n][1]}function ca(e,t,i){const r=void 0!==e.base?e.base:1;if("number"!==An(i))return sa(e.default,t.default);const n=e.stops.length;if(1===n)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];const o=is(e.stops.map((e=>e[0])),i),s=function(e,t,i,r){const n=r-i,o=e-i;return 0===n?0:1===t?o/n:(Math.pow(t,o)-1)/(Math.pow(t,n)-1)}(i,r,e.stops[o][0],e.stops[o+1][0]),a=e.stops[o][1],l=e.stops[o+1][1];let c=Zr[t.type]||na;if(e.colorSpace&&"rgb"!==e.colorSpace){const t=bs[e.colorSpace];c=(e,i)=>t.reverse(t.interpolate(t.forward(e),t.forward(i),s))}return"function"==typeof a.evaluate?{evaluate(...e){const t=a.evaluate.apply(void 0,e),i=l.evaluate.apply(void 0,e);if(void 0!==t&&void 0!==i)return c(t,i,s)}}:c(a,l,s)}function ua(e,t,i){return"color"===t.type?i=$r.parse(i):"formatted"===t.type?i=_n.fromString(i.toString()):"resolvedImage"===t.type?i=gn.fromString(i.toString()):An(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0),sa(i,e.default,t.default)}Rn.register(Gs,{error:[{kind:"error"},[Kr],(e,[t])=>{throw new Tn(t.evaluate(e))}],typeof:[Kr,[nn],(e,[t])=>cn(xn(t.evaluate(e)))],"to-rgba":[ln(Jr,4),[tn],(e,[t])=>t.evaluate(e).toRenderColor(null).toArray()],rgb:[tn,[Jr,Jr,Jr],qs],rgba:[tn,[Jr,Jr,Jr,Jr],qs],hsl:[tn,[Jr,Jr,Jr],Hs],hsla:[tn,[Jr,Jr,Jr,Jr],Hs],has:{type:en,overloads:[[[Kr],(e,[t])=>Zs(t.evaluate(e),e.properties())],[[Kr,rn],(e,[t,i])=>Zs(t.evaluate(e),i.evaluate(e))]]},get:{type:nn,overloads:[[[Kr],(e,[t])=>Ws(t.evaluate(e),e.properties())],[[Kr,rn],(e,[t,i])=>Ws(t.evaluate(e),i.evaluate(e))]]},"feature-state":[nn,[Kr],(e,[t])=>Ws(t.evaluate(e),e.featureState||{})],properties:[rn,[],e=>e.properties()],"geometry-type":[Kr,[],e=>e.geometryType()],id:[nn,[],e=>e.id()],zoom:[Jr,[],e=>e.globals.zoom],pitch:[Jr,[],e=>e.globals.pitch||0],"distance-from-center":[Jr,[],e=>e.distanceFromCenter()],"measure-light":[Jr,[Kr],(e,[t])=>e.measureLight(t.evaluate(e))],"heatmap-density":[Jr,[],e=>e.globals.heatmapDensity||0],"line-progress":[Jr,[],e=>e.globals.lineProgress||0],"raster-value":[Jr,[],e=>e.globals.rasterValue||0],"raster-particle-speed":[Jr,[],e=>e.globals.rasterParticleSpeed||0],"sky-radial-progress":[Jr,[],e=>e.globals.skyRadialProgress||0],accumulated:[nn,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[Jr,Xs(Jr),(e,t)=>{let i=0;for(const r of t)i+=r.evaluate(e);return i}],"*":[Jr,Xs(Jr),(e,t)=>{let i=1;for(const r of t)i*=r.evaluate(e);return i}],"-":{type:Jr,overloads:[[[Jr,Jr],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[Jr],(e,[t])=>-t.evaluate(e)]]},"/":[Jr,[Jr,Jr],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[Jr,[Jr,Jr],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[Jr,[],()=>Math.LN2],pi:[Jr,[],()=>Math.PI],e:[Jr,[],()=>Math.E],"^":[Jr,[Jr,Jr],(e,[t,i])=>Math.pow(t.evaluate(e),i.evaluate(e))],sqrt:[Jr,[Jr],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[Jr,[Jr],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[Jr,[Jr],(e,[t])=>Math.log(t.evaluate(e))],log2:[Jr,[Jr],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[Jr,[Jr],(e,[t])=>Math.sin(t.evaluate(e))],cos:[Jr,[Jr],(e,[t])=>Math.cos(t.evaluate(e))],tan:[Jr,[Jr],(e,[t])=>Math.tan(t.evaluate(e))],asin:[Jr,[Jr],(e,[t])=>Math.asin(t.evaluate(e))],acos:[Jr,[Jr],(e,[t])=>Math.acos(t.evaluate(e))],atan:[Jr,[Jr],(e,[t])=>Math.atan(t.evaluate(e))],min:[Jr,Xs(Jr),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[Jr,Xs(Jr),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[Jr,[Jr],(e,[t])=>Math.abs(t.evaluate(e))],round:[Jr,[Jr],(e,[t])=>{const i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[Jr,[Jr],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[Jr,[Jr],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[en,[Kr,nn],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[en,[nn],(e,[t])=>e.id()===t.value],"filter-type-==":[en,[Kr],(e,[t])=>e.geometryType()===t.value],"filter-<":[en,[Kr,nn],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[en,[nn],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<r}],"filter->":[en,[Kr,nn],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[en,[nn],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[en,[Kr,nn],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[en,[nn],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[en,[Kr,nn],(e,[t,i])=>{const r=e.properties()[t.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[en,[nn],(e,[t])=>{const i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[en,[nn],(e,[t])=>t.value in e.properties()],"filter-has-id":[en,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[en,[ln(Kr)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[en,[ln(nn)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[en,[Kr,ln(nn)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[en,[Kr,ln(nn)],(e,[t,i])=>function(e,t,i,r){for(;i<=r;){const n=i+r>>1;if(t[n]===e)return!0;t[n]>e?r=n-1:i=n+1}return!1}(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:en,overloads:[[[en,en],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[Xs(en),(e,t)=>{for(const i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:en,overloads:[[[en,en],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[Xs(en),(e,t)=>{for(const i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[en,[en],(e,[t])=>!t.evaluate(e)],"is-supported-script":[en,[Kr],(e,[t])=>{const i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[Kr,[Kr],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[Kr,[Kr],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[Kr,Xs(nn),(e,t)=>t.map((t=>bn(t.evaluate(e)))).join("")],"resolved-locale":[Kr,[on],(e,[t])=>t.evaluate(e).resolvedLocale()],random:[Jr,[Jr,Jr,nn],(e,t)=>{const[i,r,n]=t.map((t=>t.evaluate(e)));if(i>r)return i;if(i===r)return i;let o;if("string"==typeof n)o=function(e){let t=0;if(0===e.length)return t;for(let i=0;i<e.length;i++)t=(t<<5)-t+e.charCodeAt(i),t|=0;return t}(n);else{if("number"!=typeof n)throw new Tn(`Invalid seed input: ${n}`);o=n}return i+$s(o)()*(r-i)}]});class ha{constructor(e,t,i,r){this.expression=e,this._warningHistory={},this._evaluator=new Pn(i,r),this._defaultValue=t?function(e){return"color"===e.type&&(ra(e.default)||Array.isArray(e.default))?new $r(0,0,0,0):"color"===e.type?$r.parse(e.default)||null:void 0===e.default?null:e.default}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null}evaluateWithoutErrorHandling(e,t,i,r,n,o,s,a){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=r||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=a||null,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,r,n,o,s,a){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null,this._evaluator.featureTileCoord=s||null,this._evaluator.featureDistanceData=a||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Tn(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${e.message}`)),this._defaultValue}}}function pa(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Gs}function da(e,t,i,r){const n=new es(Gs,[],t?function(e){const t={color:tn,string:Kr,number:Jr,enum:Kr,boolean:en,formatted:sn,resolvedImage:an};return"array"===e.type?ln(t[e.value]||nn,e.length):t[e.type]}(t):void 0,void 0,void 0,i,r),o=n.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return o?Qs(new ha(o,t,i,r)):Ys(n.errors)}class fa{constructor(e,t,i){this.kind=e,this._styleExpression=t,this.isLightConstant=i,this.isStateDependent="constant"!==e&&!Xo(t.expression),this.configDependencies=Qo(t.expression)}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}}class ma{constructor(e,t,i,r,n){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent="camera"!==e&&!Xo(t.expression),this.isLightConstant=n,this.configDependencies=Qo(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,i,r,n,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,o)}evaluate(e,t,i,r,n,o){return this._styleExpression.evaluate(e,t,i,r,n,o)}interpolationFactor(e,t,i){return this.interpolationType?ws.interpolationFactor(this.interpolationType,e,t,i):0}}function _a(e,t,i,r){if("error"===(e=da(e,t,i,r)).result)return e;const n=e.value.expression,o=Wo(n);if(!o&&!Ks(t))return Ys([new Xr("","data expressions not supported")]);const s=Yo(n,["zoom","pitch","distance-from-center"]);if(!s&&!ta(t))return Ys([new Xr("","zoom expressions not supported")]);const a=Yo(n,["measure-light"]);if(!a&&!ea(t))return Ys([new Xr("","measure-light expression not supported")]);const l=t.expression&&t.expression.relaxZoomRestriction,c=ya(n);return c||s||l?c instanceof Xr?Ys([c]):c instanceof ws&&!ia(t)?Ys([new Xr("",'"interpolate" expressions cannot be used with this property')]):Qs(c?new ma(o?"camera":"composite",e.value,c.labels,c instanceof ws?c.interpolation:void 0,a):new fa(o?"constant":"source",e.value,a)):Ys([new Xr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class ga{constructor(e,t){this._parameters=e,this._specification=t,Wr(this,oa(this._parameters,this._specification))}static deserialize(e){return new ga(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function ya(e){let t=null;if(e instanceof Es)t=ya(e.result);else if(e instanceof Ms){for(const i of e.args)if(t=ya(i),t)break}else(e instanceof rs||e instanceof ws)&&e.input instanceof Rn&&"zoom"===e.input.name&&(t=e);return t instanceof Xr||e.eachChild((e=>{const i=ya(e);i instanceof Xr?t=i:t&&i&&t!==i&&(t=new Xr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}var va=ba,xa=3;function ba(e,t,i){var r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;var n=new Int32Array(this.arrayBuffer);e=n[0],this.d=(t=n[1])+2*(i=n[2]);for(var o=0;o<this.d*this.d;o++){var s=n[xa+o],a=n[xa+o+1];r.push(s===a?null:n.subarray(s,a))}var l=n[xa+r.length+1];this.keys=n.subarray(n[xa+r.length],l),this.bboxes=n.subarray(l),this.insert=this._insertReadonly}else{this.d=t+2*i;for(var c=0;c<this.d*this.d;c++)r.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=i,this.scale=t/e,this.uid=0;var u=i/t*e;this.min=-u,this.max=e+u}
1ba.prototype.insert=function(e,t,i,r,n){this._forEachCell(t,i,r,n,this._insertCell,this.uid++),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)},ba.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},ba.prototype._insertCell=function(e,t,i,r,n,o){this.cells[n].push(o)},ba.prototype.query=function(e,t,i,r,n){var o=this.min,s=this.max;if(e<=o&&t<=o&&s<=i&&s<=r&&!n)return Array.prototype.slice.call(this.keys);var a=[];return this._forEachCell(e,t,i,r,this._queryCell,a,{},n),a},ba.prototype._queryCell=function(e,t,i,r,n,o,s,a){var l=this.cells[n];if(null!==l)for(var c=this.keys,u=this.bboxes,h=0;h<l.length;h++){var p=l[h];if(void 0===s[p]){var d=4*p;(a?a(u[d+0],u[d+1],u[d+2],u[d+3]):e<=u[d+2]&&t<=u[d+3]&&i>=u[d+0]&&r>=u[d+1])?(s[p]=!0,o.push(c[p])):s[p]=!1}}},ba.prototype._forEachCell=function(e,t,i,r,n,o,s,a){for(var l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),u=this._convertToCellCoord(i),h=this._convertToCellCoord(r),p=l;p<=u;p++)for(var d=c;d<=h;d++){var f=this.d*d+p;if((!a||a(this._convertFromCellCoord(p),this._convertFromCellCoord(d),this._convertFromCellCoord(p+1),this._convertFromCellCoord(d+1)))&&n.call(this,e,t,i,r,f,o,s,a))return}},ba.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},ba.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},ba.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var e=this.cells,t=xa+this.cells.length+1+1,i=0,r=0;r<this.cells.length;r++)i+=this.cells[r].length;var n=new Int32Array(t+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;for(var o=t,s=0;s<e.length;s++){var a=e[s];n[xa+s]=o,n.set(a,o),o+=a.length}return n[xa+e.length]=o,n.set(this.keys,o),n[xa+e.length+1]=o+=this.keys.length,n.set(this.bboxes,o),o+=this.bboxes.length,n.buffer};var wa=p(va);const Ta={};function Ma(e,t,i={}){Object.defineProperty(e,"_classRegistryKey",{value:t,writable:!1}),Ta[t]={klass:e,omit:i.omit||[]}}Ma(Object,"Object"),wa.serialize=function(e,t){const i=e.toArrayBuffer();return t&&t.add(i),{buffer:i}},wa.deserialize=function(e){return new wa(e.buffer)},Object.defineProperty(wa,"name",{value:"Grid"}),Ma(wa,"Grid"),Ma($r,"Color"),Ma(Error,"Error"),Ma(_n,"Formatted"),Ma(mn,"FormattedSection"),Ma(er,"AJAXError"),Ma(gn,"ResolvedImage"),Ma(ga,"StylePropertyFunction"),Ma(ha,"StyleExpression",{omit:["_evaluator"]}),Ma(ma,"ZoomDependentExpression"),Ma(fa,"ZoomConstantExpression"),Ma(Rn,"CompoundExpression",{omit:["_evaluate"]});for(const e in Gs)Ta[Gs[e]._classRegistryKey]||Ma(Gs[e],`Expression${e}`);function Ea(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function Sa(e){return self.ImageBitmap&&e instanceof ImageBitmap}function Ca(e,t){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp)return e;if(Ea(e)||Sa(e))return t&&t.add(e),e;if(ArrayBuffer.isView(e)){const i=e;return t&&t.add(i.buffer),i}if(e instanceof ImageData)return t&&t.add(e.data.buffer),e;if(Array.isArray(e)){const i=[];for(const r of e)i.push(Ca(r,t));return i}if(e instanceof Map){const t={$name:"Map"};for(const[i,r]of e.entries())t[i]=Ca(r);return t}if(e instanceof Set){const t={$name:"Set"};let i=0;for(const r of e.values())t[++i]=Ca(r);return t}if("object"==typeof e){const i=e.constructor,r=i._classRegistryKey;if(!r)throw new Error(`can't serialize object of unregistered class ${r}`);const n=i.serialize?i.serialize(e,t):{};if(!i.serialize){for(const i in e)e.hasOwnProperty(i)&&(Ta[r].omit.indexOf(i)>=0||(n[i]=Ca(e[i],t)));e instanceof Error&&(n.message=e.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(n.$name=r),n}throw new Error("can't serialize object of type "+typeof e)}function Aa(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||Ea(e)||Sa(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(Aa);if("object"==typeof e){const t=e.$name||"Object";if("Map"===t){const t=new Map;for(const i of Object.keys(e))"$name"!==i&&t.set(i,Aa(e[i]));return t}if("Set"===t){const t=new Set;for(const i of Object.keys(e))"$name"!==i&&t.add(Aa(e[i]));return t}const{klass:i}=Ta[t];if(!i)throw new Error(`can't deserialize unregistered class ${t}`);if(i.deserialize)return i.deserialize(e);const r=Object.create(i.prototype);for(const t of Object.keys(e))"$name"!==t&&(r[t]=Aa(e[t]));return r}throw new Error("can't deserialize object of type "+typeof e)}const Ia={"Latin-1 Supplement":e=>e>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>
1=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519,"CJK Unified Ideographs Extension B":e=>e>=131072&&e<=173791};function ka(e){for(const t of e)if(Ra(t.charCodeAt(0)))return!0;return!1}function La(e){for(const t of e)if(!Pa(t.charCodeAt(0)))return!1;return!0}function Pa(e){return!(Ia.Arabic(e)||Ia["Arabic Supplement"](e)||Ia["Arabic Extended-A"](e)||Ia["Arabic Presentation Forms-A"](e)||Ia["Arabic Presentation Forms-B"](e))}function Ra(e){return!(746!==e&&747!==e&&(e<4352||!(Ia["Bopomofo Extended"](e)||Ia.Bopomofo(e)||Ia["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||Ia["CJK Compatibility Ideographs"](e)||Ia["CJK Compatibility"](e)||Ia["CJK Radicals Supplement"](e)||Ia["CJK Strokes"](e)||!(!Ia["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||Ia["CJK Unified Ideographs Extension A"](e)||Ia["CJK Unified Ideographs"](e)||Ia["Enclosed CJK Letters and Months"](e)||Ia["Hangul Compatibility Jamo"](e)||Ia["Hangul Jamo Extended-A"](e)||Ia["Hangul Jamo Extended-B"](e)||Ia["Hangul Jamo"](e)||Ia["Hangul Syllables"](e)||Ia.Hiragana(e)||Ia["Ideographic Description Characters"](e)||Ia.Kanbun(e)||Ia["Kangxi Radicals"](e)||Ia["Katakana Phonetic Extensions"](e)||Ia.Katakana(e)&&12540!==e||!(!Ia["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!Ia["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||Ia["Unified Canadian Aboriginal Syllabics"](e)||Ia["Unified Canadian Aboriginal Syllabics Extended"](e)||Ia["Vertical Forms"](e)||Ia["Yijing Hexagram Symbols"](e)||Ia["Yi Syllables"](e)||Ia["Yi Radicals"](e))))}function za(e){return!(Ra(e)||function(e){return!!(Ia["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||Ia["General Punctuation"](e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||Ia["Letterlike Symbols"](e)||Ia["Number Forms"](e)||Ia["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||Ia["Control Pictures"](e)&&9251!==e||Ia["Optical Character Recognition"](e)||Ia["Enclosed Alphanumerics"](e)||Ia["Geometric Shapes"](e)||Ia["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Ia["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Ia["CJK Symbols and Punctuation"](e)||Ia.Katakana(e)||Ia["Private Use Area"](e)||Ia["CJK Compatibility Forms"](e)||Ia["Small Form Variants"](e)||Ia["Halfwidth and Fullwidth Forms"](e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}function Oa(e){return e>=1424&&e<=2303||Ia["Arabic Presentation Forms-A"](e)||Ia["Arabic Presentation Forms-B"](e)}function Da(e,t){return!(!t&&Oa(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||Ia.Khmer(e))}function Fa(e){for(const t of e)if(Oa(t.charCodeAt(0)))return!0;return!1}const Ba="deferred",Na="loading",ja="loaded";let Ua=null,Va="unavailable",$a=null;const Ga=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(Va="error"),Ua&&Ua(e)};function qa(){Ha.fire(new Rr("pluginStateChange",{pluginStatus:Va,pluginURL:$a}))}const Ha=new Fr,Za=function(){return Va},Wa=function(){if(Va!==Ba||!$a)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Va=Na,qa(),$a&&rr({url:$a},(e=>{e?Ga(e):(Va=ja,qa())}))},Xa={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Va===ja||null!=Xa.applyArabicShaping,isLoading:()=>Va===Na,setState(e){Va=e.pluginStatus,$a=e.pluginURL},isParsed:()=>null!=Xa.applyArabicShaping&&null!=Xa.processBidirectionalText&&null!=Xa.processStyledBidirectionalText,getPluginURL:()=>$a};class Qa{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.transition=t.transition,this.pitch=t.pitch,this.brightness=t.brightness):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(e,t){for(const i of e)if(!Da(i.charCodeAt(0),t))return!1;return!0}(e,Xa.isLoaded())}}class Ya{constructor(e,t,i,r){this.property=e,this.value=t,this.expression=function(e,t,i,r){if(ra(e))return new ga(e,t);if(pa(e)||Array.isArray(e)&&e.length>0){const n=_a(e,t,i,r);if("error"===n.result)throw new Error(n.value.map((e=>`${e.key}: ${e.message}`)).join(", "));return n.value}{let i=e;return"string"==typeof e&&"color"===t.type&&(i=$r.parse(e)),{kind:"constant",configDependencies:new Set,evaluate:()=>i}}}(void 0===t?e.specification.default:t,e.specification,i,r)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}}class Ja{constructor(e,t,i){this.property=e,this.value=new Ya(e,void 0,t,i)}transitioned(e,t){return new el(this.property,this.value,t,ii({},e.transition,this.transition),e.now)}
vendor: 4,607 bytes, line 1
1untransitioned(){return new el(this.property,this.value,null,{},0)}}class Ka{constructor(e,t,i){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=t,this._options=i,this.configDependencies=new Set}getValue(e){return pi(this._values[e].value.value)}setValue(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Ja(this._values[e].property,this._scope,this._options)),this._values[e].value=new Ya(this._values[e].property,null===t?void 0:pi(t),this._scope,this._options),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]))}setTransitionOrValue(e,t){t&&(this._options=t);const i=this._properties.properties;if(e)for(const t in e){const r=e[t];if(ci(t,"-transition")){const e=t.slice(0,-11);i[e]&&this.setTransition(e,r)}else i.hasOwnProperty(t)&&this.setValue(t,r)}}getTransition(e){return pi(this._values[e].transition)}setTransition(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Ja(this._values[e].property)),this._values[e].transition=pi(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i);const r=this.getTransition(t);void 0!==r&&(e[`${t}-transition`]=r)}return e}transitioned(e,t){const i=new tl(this._properties);for(const r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(e,t._values[r]);return i}untransitioned(){const e=new tl(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class el{constructor(e,t,i,r,n){const o=r.delay||0,s=r.duration||0;n=n||0,this.property=e,this.value=t,this.begin=n+o,this.end=this.begin+s,e.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){const r=e.now||0,n=this.value.possiblyEvaluate(e,t,i),o=this.prior;if(o){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return o.possiblyEvaluate(e,t,i);{const s=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(e,t,i),n,Wt(s))}}return n}}class tl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){const r=new nl(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(e,t,i);return r}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class il{constructor(e,t,i){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=t,this._options=i,this.configDependencies=new Set}getValue(e){return pi(this._values[e].value)}setValue(e,t){this._values[e]=new Ya(this._values[e].property,null===t?void 0:pi(t),this._scope,this._options),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]))}serialize(){const e={};for(const t of Object.keys(this._values)){const i=this.getValue(t);void 0!==i&&(e[t]=i)}return e}possiblyEvaluate(e,t,i){const r=new nl(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(e,t,i);return r}}class rl{constructor(e,t,i){this.property=e,this.value=t,this.parameters=i}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,i,r){return this.property.evaluate(this.value,this.parameters,e,t,i,r)}}class nl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class ol{constructor(e){this.specification=e}possiblyEvaluate(e,t){return e.expression.evaluate(t)}interpolate(e,t,i){const r=Zr[this.specification.type];return r?r(e,t,i):e}}class sl{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,i,r){return new rl(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(t,null,{},i,r)}:e.expression,t)}interpolate(e,t,i){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new rl(this,{kind:"constant",value:void 0},e.parameters);const r=Zr[this.specification.type];return r?new rl(this,{kind:"constant",value:r(e.value.value,t.value.value,i)},e.parameters):e}evaluate(e,t,i,r,n,o){return"constant"===e.kind?e.value:e.evaluate(t,i,r,n,o)}}class al{constructor(e){this.specification=e}
vendor: 7,229 bytes, line 1
1possiblyEvaluate(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}interpolate(){return!1}}class ll{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const t=new Qa(0,{});for(const i in e){const r=e[i];r.specification.overridable&&this.overridableProperties.push(i);const n=this.defaultPropertyValues[i]=new Ya(r,void 0),o=this.defaultTransitionablePropertyValues[i]=new Ja(r);this.defaultTransitioningPropertyValues[i]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=n.possiblyEvaluate(t)}}}Ma(sl,"DataDrivenProperty"),Ma(ol,"DataConstantProperty"),Ma(al,"ColorRampProperty");var cl=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"required":false,"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"imports":{"type":"array","value":"import"},"schema":{"type":"schema"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"},"models":{"type":"models"}},"model":{"type":"string","required":true},"import":{"id":{"type":"string","required":true},"url":{"type":"string","required":true},"config":{"type":"config"},"data":{"type":"$root"}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","property-type":"data-constant","expression":{},"required":true},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string","required":true},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false,"expression":{},"property-type":"data-constant"},"shadow-intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"experimental":true,"type":{"required":true,"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0}
1,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":1}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":1}},"url":{"required":false,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_model":{"type":{"required":true,"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"raster-particle":{"experimental":true},"hillshade":{},"model":{"experimental":true},"background":{},"sky":{},"slot":{},"clip":{"experimental":true}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{},"property-type":"data-constant","experimental":true},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{},"property-type":"data-constant","experimental":true}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","experimental":true,"private":true,"default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","experimental":true,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
1,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective","property-type":"data-constant"}},"colorTheme":{"data":{"type":"string","property-type":"data-constant","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"property-type":"data-constant","type":"color","experimental":true,"default":"#ffffff","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"property-type":"data-constant","type":"number","experimental":true,"default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"property-type":"data-constant","type":"number","experimental":true,"default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"property-type":"data-constant","type":"boolean","default":true,"experimental":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-line-alignment":{"type":"enum","values":{"inside":1,"outside":1,"center":1},"default":"center","property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"
1property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"property-type":"constant"},"line-trim-fade-range":{"type":"array","value":"number","experimental":true,"length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-trim-color":{"type":"color","experimental":true,"default":"transparent","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-border-width":{"type":"number","private":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","private":true,"default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"property-type":"data-constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-image-cross-fade":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"transition":true},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-value"]},"property-type":"color-ramp"},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"raster-array-band":{"type":"string","required":false,"experimental":true,"property-type":"data-constant"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-particle-count":{"type":"number","default":512,"minimum":1,"property-type":"data-constant"},"raster-particle-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-particle-speed"]},"property-type":"color-ramp"},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1,"property-type":"data-constant"},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1,"property-type":"data-constant"},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere
1-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d","property-type":"data-constant"},"model-cast-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-receive-shadows":{"type":"boolean","default":true,"property-type":"data-constant"},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant","transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"model-front-cutoff":{"type":"array","private":true,"value":"number","property-type":"data-constant","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function ul(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function hl(e){if(Array.isArray(e))return e.map(hl);
vendor: 6,396 bytes, line 1
1if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const i in e)t[i]=hl(e[i]);return t}return ul(e)}function pl(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!pl(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}function dl(e,t="fill"){if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};pl(e)||(e=xl(e));const i=e;let r=!0;try{r=function(e){if(!_l(e))return e;let t=hl(e);return ml(t),t=fl(t),t}(i)}catch(e){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${JSON.stringify(i,null,2)}\n `)}const n=cl[`filter_${t}`],o=da(r,n);let s=null;if("error"===o.result)throw new Error(o.value.map((e=>`${e.key}: ${e.message}`)).join(", "));s=(e,t,i)=>o.value.evaluate(e,t,{},i);let a=null,l=null;if(r!==i){const e=da(i,n);if("error"===e.result)throw new Error(e.value.map((e=>`${e.key}: ${e.message}`)).join(", "));a=(t,i,r,n,o)=>e.value.evaluate(t,i,{},r,void 0,void 0,n,o),l=!Wo(e.value.expression)}return{filter:s,dynamicFilter:a||void 0,needGeometry:vl(r),needFeature:!!l}}function fl(e){if(!Array.isArray(e))return e;const t=function(e){if(gl.has(e[0]))for(let t=1;t<e.length;t++)if(_l(e[t]))return!0;return e}(e);return!0===t?t:t.map((e=>fl(e)))}function ml(e){let t=!1;const i=[];if("case"===e[0]){for(let r=1;r<e.length-1;r+=2)t=t||_l(e[r]),i.push(e[r+1]);i.push(e[e.length-1])}else if("match"===e[0]){t=t||_l(e[1]);for(let t=2;t<e.length-1;t+=2)i.push(e[t+1]);i.push(e[e.length-1])}else if("step"===e[0]){t=t||_l(e[1]);for(let t=1;t<e.length-1;t+=2)i.push(e[t+1])}t&&(e.length=0,e.push("any",...i));for(let t=1;t<e.length;t++)ml(e[t])}function _l(e){if(!Array.isArray(e))return!1;if("pitch"===(t=e[0])||"distance-from-center"===t)return!0;var t;for(let t=1;t<e.length;t++)if(_l(e[t]))return!0;return!1}const gl=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function yl(e,t){return e<t?-1:e>t?1:0}function vl(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t<e.length;t++)if(vl(e[t]))return!0;return!1}function xl(e){if(!e)return!0;const t=e[0];return e.length<=1?"any"!==t:"=="===t?bl(e[1],e[2],"=="):"!="===t?Ml(bl(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?bl(e[1],e[2],t):"any"===t?(i=e.slice(1),["any"].concat(i.map(xl))):"all"===t?["all"].concat(e.slice(1).map(xl)):"none"===t?["all"].concat(e.slice(1).map(xl).map(Ml)):"in"===t?wl(e[1],e.slice(2)):"!in"===t?Ml(wl(e[1],e.slice(2))):"has"===t?Tl(e[1]):"!has"!==t||Ml(Tl(e[1]));var i}function bl(e,t,i){switch(e){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,e,t]}}function wl(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?["filter-in-large",e,["literal",t.sort(yl)]]:["filter-in-small",e,["literal",t]]}}function Tl(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Ml(e){return["!",e]}const El="�";function Sl(e,t){return t?`${e}${El}${t}`:e}const Cl="-transition",Al=new Set(["fill","line","background","hillshade","raster"]);class Il extends Fr{constructor(e,t,i,r,n){if(super(),this.id=e.id,this.fqid=Sl(this.id,i),this.type=e.type,this.scope=i,this.lut=r,this.options=n,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&"sky"!==e.type&&"slot"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),e.slot&&(this.slot=e.slot),t.layout&&(this._unevaluatedLayout=new il(t.layout,this.scope,n),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),t.paint)){this._transitionablePaint=new Ka(t.paint,this.scope,n);for(const t in e.paint)this.setPaintProperty(t,e.paint[t]);for(const t in e.layout)this.setLayoutProperty(t,e.layout[t]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new nl(t.paint)}}onAdd(e){}onRemove(e){}isDraped(e){return Al.has(this.type)}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t){if("custom"===this.type&&"visibility"===e)return void(this.visibility=t);const i=this._unevaluatedLayout;i._properties.properties[e]&&(i.setValue(e,t),this.configDependencies=new Set([...this.configDependencies,...i.configDependencies]),"visibility"===e&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0})}getPaintProperty(e){return ci(e,Cl)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t){const i=this._transitionablePaint,r=i._properties.properties;if(ci(e,Cl)){const n=e.slice(0,-11);return r[n]&&i.setTransition(n,t||void 0),!1}if(!r[e])return!1;const n=i._values[e],o=n.value.isDataDriven(),s=n.value;i.setValue(e,t),this.configDependencies=new Set([...this.configDependencies,...i.configDependencies]),this._handleSpecialPaintPropertyUpdate(e);const a=i._values[e].value,l=a.isDataDriven(),c=ci(e,"pattern")||"line-dasharray"===e;return l||o||c||this._handleOverridablePaintPropertyUpdate(e,s,a)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,t,i){return null}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}
vendor: 21,904 bytes, line 1
1isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){return hi({id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()},((e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length)))}is3D(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof rl&&Ks(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=dl(this.filter),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&("shadow"===e.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(e){}queryIntersectsFeature(e,t,i,r,n,o,s,a,l){}queryIntersectsMatchingFeature(e,t,i,r){}}const kl={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ll{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Pl{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.add(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function Rl(e,t=1){let i=0,r=0;return{members:e.map((e=>{const n=kl[e.type].BYTES_PER_ELEMENT,o=i=zl(i,Math.max(t,n)),s=e.components||1;return r=Math.max(r,n),i+=n*s,{name:e.name,type:e.type,components:s,offset:o}})),size:zl(i,Math.max(r,t)),alignment:t}}function zl(e,t){return Math.ceil(e/t)*t}class Ol extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.int16[r+0]=t,this.int16[r+1]=i,e}}Ol.prototype.bytesPerElement=4,Ma(Ol,"StructArrayLayout2i4");class Dl extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}}Dl.prototype.bytesPerElement=6,Ma(Dl,"StructArrayLayout3i6");class Fl extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,e}}Fl.prototype.bytesPerElement=8,Ma(Fl,"StructArrayLayout4i8");class Bl extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const s=5*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=o,e}}Bl.prototype.bytesPerElement=10,Ma(Bl,"StructArrayLayout5i10");class Nl extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o,s)}emplace(e,t,i,r,n,o,s,a){const l=6*e,c=12*e,u=3*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.uint8[c+4]=r,this.uint8[c+5]=n,this.uint8[c+6]=o,this.uint8[c+7]=s,this.float32[u+2]=a,e}}Nl.prototype.bytesPerElement=12,Ma(Nl,"StructArrayLayout2i4ub1f12");class jl extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,e}}jl.prototype.bytesPerElement=16,Ma(jl,"StructArrayLayout4f16");class Ul extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.float32[n+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}}Ul.prototype.bytesPerElement=12,Ma(Ul,"StructArrayLayout3f12");class Vl extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const s=6*e,a=3*e;return this.uint16[s+0]=t,this.uint16[s+1]=i,this.uint16[s+2]=r,this.uint16[s+3]=n,this.float32[a+2]=o,e}}Vl.prototype.bytesPerElement=12,Ma(Vl,"StructArrayLayout4ui1f12");class $l extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=4*e;return this.uint16[o+0]=t,this.uint16[o+1]=i,this.uint16[o+2]=r,this.uint16[o+3]=n,e}}$l.prototype.bytesPerElement=8,Ma($l,"StructArrayLayout4ui8");class Gl extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=6*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=o,this.int16[a+5]=s,e}}Gl.prototype.bytesPerElement=12,Ma(Gl,"StructArrayLayout6i12");class ql extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,u,h){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,i,r,n,o,s,a,l,c,u,h)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,p){const d=12*e;return this.int16[d+0]=t,this.int16[d+1]=i,this.int16[d+2]=r,this.int16[d+3]=n,this.uint16[d+4]=o,this.uint16[d+5]=s,this.uint16[d+6]=a,this.uint16[d+7]=l,this.int16[d+8]=c,this.int16[d+9]=u,this.int16[d+10]=h,this.int16[d+11]=p,e}}ql.prototype.bytesPerElement=24,Ma(ql,"StructArrayLayout4i4ui4i24");class Hl extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,o)}emplace(e,t,i,r,n,o,s){const a=10*e,l=5*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.float32[l+2]=n,this.float32[l+3]=o,this.float32[l+4]=s,e}}Hl.prototype.bytesPerElement=20,Ma(Hl,"StructArrayLayout3i3f20");class Zl extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}Zl.prototype.bytesPerElement=4,Ma(Zl,"StructArrayLayout1ul4");class Wl extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,e}}Wl.prototype.bytesPerElement=4,Ma(Wl,"StructArrayLayout2ui4");class Xl extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,u,h,p){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,i,r,n,o,s,a,l,c,u,h,p)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,p,d){const f=20*e,m=10*e;return this.int16[f+0]=t,this.int16[f+1]=i,this.int16[f+2]=r,this.int16[f+3]=n,this.int16[f+4]=o,this.float32[m+3]=s,this.float32[m+4]=a,this.float32[m+5]=l,this.float32[m+6]=c,this.int16[f+14]=u,this.uint32[m+8]=h,this.uint16[f+18]=p,this.uint16[f+19]=d,e}}Xl.prototype.bytesPerElement=40,Ma(Xl,"StructArrayLayout5i4f1i1ul2ui40");class Ql extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o,s)}emplace(e,t,i,r,n,o,s,a){const l=8*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.int16[l+2]=r,this.int16[l+4]=n,this.int16[l+5]=o,this.int16[l+6]=s,this.int16[l+7]=a,e}}Ql.prototype.bytesPerElement=16,Ma(Ql,"StructArrayLayout3i2i2i16");class Yl extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const s=4*e,a=8*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=r,this.int16[a+6]=n,this.int16[a+7]=o,e}}Yl.prototype.bytesPerElement=16,Ma(Yl,"StructArrayLayout2f1f2i16");class Jl extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=12*e,s=3*e;return this.uint8[o+0]=t,this.uint8[o+1]=i,this.float32[s+1]=r,this.float32[s+2]=n,e}}Jl.prototype.bytesPerElement=12,Ma(Jl,"StructArrayLayout2ub2f12");class Kl extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){const n=3*e;return this.uint16[n+0]=t,this.uint16[n+1]=i,this.uint16[n+2]=r,e}}Kl.prototype.bytesPerElement=6,Ma(Kl,"StructArrayLayout3ui6");class ec extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_,g,y,v,x){const b=this.length;return this.resize(b+1),this.emplace(b,e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_,g,y,v,x)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_,g,y,v,x,b){const w=30*e,T=15*e,M=60*e;return this.int16[w+0]=t,this.int16[w+1]=i,this.int16[w+2]=r,this.float32[T+2]=n,this.float32[T+3]=o,this.uint16[w+8]=s,this.uint16[w+9]=a,this.uint32[T+5]=l,this.uint32[T+6]=c,this.uint32[T+7]=u,this.uint16[w+16]=h,this.uint16[w+17]=p,this.uint16[w+18]=d,this.float32[T+10]=f,this.float32[T+11]=m,this.uint8[M+48]=_,this.uint8[M+49]=g,this.uint8[M+50]=y,this.uint32[T+13]=v,this.int16[w+28]=x,this.uint8[M+58]=b,e}}ec.prototype.bytesPerElement=60,Ma(ec,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class tc extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_,g,y,v,x,b,w,T,M,E,S,C,A,I,k,L){const P=this.length;return this.resize(P+1),this.emplace(P,e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_,g,y,v,x,b,w,T,M,E,S,C,A,I,k,L)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_,g,y,v,x,b,w,T,M,E,S,C,A,I,k,L,P){const R=20*e,z=40*e,O=80*e;return this.float32[R+0]=t,this.float32[R+1]=i,this.int16[z+4]=r,this.int16[z+5]=n,this.int16[z+6]=o,this.int16[z+7]=s,this.int16[z+8]=a,this.int16[z+9]=l,this.int16[z+10]=c,this.int16[z+11]=u,this.int16[z+12]=h,this.uint16[z+13]=p,this.uint16[z+14]=d,this.uint16[z+15]=f,this.uint16[z+16]=m,this.uint16[z+17]=_,this.uint16[z+18]=g,this.uint16[z+19]=y,this.uint16[z+20]=v,this.uint16[z+21]=x,this.uint16[z+22]=b,this.uint16[z+23]=w,this.uint16[z+24]=T,this.uint16[z+25]=M,this.uint16[z+26]=E,this.uint16[z+27]=S,this.uint32[R+14]=C,this.float32[R+15]=A,this.float32[R+16]=I,this.float32[R+17]=k,this.float32[R+18]=L,this.uint8[O+76]=P,e}}tc.prototype.bytesPerElement=80,Ma(tc,"StructArrayLayout2f9i15ui1ul4f1ub80");class ic extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}ic.prototype.bytesPerElement=4,Ma(ic,"StructArrayLayout1f4");class rc extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n)}emplace(e,t,i,r,n,o){const s=5*e;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=r,this.float32[s+3]=n,this.float32[s+4]=o,e}}rc.prototype.bytesPerElement=20,Ma(rc,"StructArrayLayout5f20");class nc extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o,s)}emplace(e,t,i,r,n,o,s,a){const l=7*e;return this.float32[l+0]=t,this.float32[l+1]=i,this.float32[l+2]=r,this.float32[l+3]=n,this.float32[l+4]=o,this.float32[l+5]=s,this.float32[l+6]=a,e}}nc.prototype.bytesPerElement=28,Ma(nc,"StructArrayLayout7f28");class oc extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}emplace(e,t,i,r,n){const o=6*e;return this.uint32[3*e+0]=t,this.uint16[o+2]=i,this.uint16[o+3]=r,this.uint16[o+4]=n,e}}oc.prototype.bytesPerElement=12,Ma(oc,"StructArrayLayout1ul3ui12");class sc extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}sc.prototype.bytesPerElement=2,Ma(sc,"StructArrayLayout1ui2");class ac extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){const r=2*e;return this.float32[r+0]=t,this.float32[r+1]=i,e}}ac.prototype.bytesPerElement=8,Ma(ac,"StructArrayLayout2f8");class lc extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m){const _=this.length;return this.resize(_+1),this.emplace(_,e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m)}emplace(e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_){const g=16*e;return this.float32[g+0]=t,this.float32[g+1]=i,this.float32[g+2]=r,this.float32[g+3]=n,this.float32[g+4]=o,this.float32[g+5]=s,this.float32[g+6]=a,this.float32[g+7]=l,this.float32[g+8]=c,this.float32[g+9]=u,this.float32[g+10]=h,this.float32[g+11]=p,this.float32[g+12]=d,this.float32[g+13]=f,this.float32[g+14]=m,this.float32[g+15]=_,e}}lc.prototype.bytesPerElement=64,Ma(lc,"StructArrayLayout16f64");class cc extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,n,o,s){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n,o,s)}emplace(e,t,i,r,n,o,s,a){const l=10*e,c=5*e;return this.uint16[l+0]=t,this.uint16[l+1]=i,this.uint16[l+2]=r,this.uint16[l+3]=n,this.float32[c+2]=o,this.float32[c+3]=s,this.float32[c+4]=a,e}}cc.prototype.bytesPerElement=20,Ma(cc,"StructArrayLayout4ui3f20");class uc extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.int16[1*e+0]=t,e}}uc.prototype.bytesPerElement=2,Ma(uc,"StructArrayLayout1i2");class hc extends Pl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint8[1*e+0]=t,e}}hc.prototype.bytesPerElement=1,Ma(hc,"StructArrayLayout1ub1");class pc extends Ll{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}pc.prototype.size=40;class dc extends Xl{get(e){return new pc(this,e)}}Ma(dc,"CollisionBoxArray");class fc extends Ll{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}fc.prototype.size=60;class mc extends ec{get(e){return new fc(this,e)}}Ma(mc,"PlacedSymbolArray");class _c extends Ll{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}
vendor: 17,407 bytes, line 1
1get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}}_c.prototype.size=80;class gc extends tc{get(e){return new _c(this,e)}}Ma(gc,"SymbolInstanceArray");class yc extends ic{getoffsetX(e){return this.float32[1*e+0]}}Ma(yc,"GlyphOffsetArray");class vc extends Ol{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}Ma(vc,"SymbolLineVertexArray");class xc extends Ll{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}xc.prototype.size=12;class bc extends oc{get(e){return new xc(this,e)}}Ma(bc,"FeatureIndexArray");class wc extends Wl{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}Ma(wc,"FillExtrusionCentroidArray");class Tc extends Ll{get a_join_normal_inside_polygon0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside_polygon1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside_polygon2(){return this._structArray.int16[this._pos2+2]}get a_join_normal_inside_polygon3(){return this._structArray.int16[this._pos2+3]}}Tc.prototype.size=8;class Mc extends Fl{get(e){return new Tc(this,e)}}Ma(Mc,"FillExtrusionWallArray");const Ec=Rl([{name:"a_pos",components:2,type:"Int16"}],4),Sc=Rl([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Cc{constructor(e=[]){this.segments=e}_prepareSegment(e,t,i,r){let n=this.segments[this.segments.length-1];return e>Cc.MAX_VERTEX_ARRAY_LENGTH&&fi(`Max vertices per segment is ${Cc.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!n||n.vertexLength+e>Cc.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==r)&&(n={vertexOffset:t,primitiveOffset:i,vertexLength:0,primitiveLength:0},void 0!==r&&(n.sortKey=r),this.segments.push(n)),n}prepareSegment(e,t,i,r){return this._prepareSegment(e,t.length,i.length,r)}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,r){return new Cc([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function Ac(e,t){return 256*(e=Yt(Math.floor(e),0,255))+Yt(Math.floor(t),0,255)}Cc.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ma(Cc,"SegmentVector");const Ic=Rl([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),kc=Rl([{name:"a_dash",components:4,type:"Uint16"}]);class Lc{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,t,i,r){this.ids.push(Pc(e)),this.positions.push(t,i,r)}eachPosition(e,t){const i=Pc(e);let r=0,n=this.ids.length-1;for(;r<n;){const e=r+n>>1;this.ids[e]>=i?n=e:r=e+1}for(;this.ids[r]===i;)t(this.positions[3*r],this.positions[3*r+1],this.positions[3*r+2]),r++}static serialize(e,t){const i=new Float64Array(e.ids),r=new Uint32Array(e.positions);return Rc(i,r,0,i.length-1),t&&(t.add(i.buffer),t.add(r.buffer)),{ids:i,positions:r}}static deserialize(e){const t=new Lc;let i;t.ids=e.ids,t.positions=e.positions;for(const e of t.ids)e!==i&&t.uniqueIds.push(e),i=e;return t.indexed=!0,t}}function Pc(e){const t=+e;return!isNaN(t)&&Number.MIN_SAFE_INTEGER<=t&&t<=Number.MAX_SAFE_INTEGER?t:Pr(String(e))}function Rc(e,t,i,r){for(;i<r;){const n=e[i+r>>1];let o=i-1,s=r+1;for(;;){do{o++}while(e[o]<n);do{s--}while(e[s]>n);if(o>=s)break;zc(e,o,s),zc(t,3*o,3*s),zc(t,3*o+1,3*s+1),zc(t,3*o+2,3*s+2)}s-i<r-s?(Rc(e,t,i,s),i=s+1):(Rc(e,t,s+1,r),r=s)}}function zc(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}Ma(Lc,"FeaturePositionMap");class Oc{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,t){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,t),this.initialized=!0),!!this.location}set(e,t,i){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class Dc extends Oc{constructor(e){super(e),this.current=0}set(e,t,i){this.fetchUniformLocation(e,t)&&this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}}class Fc extends Oc{constructor(e){super(e),this.current=0}set(e,t,i){this.fetchUniformLocation(e,t)&&this.current!==i&&(this.current=i,this.gl.uniform1f(this.location,i))}}class Bc extends Oc{constructor(e){super(e),this.current=[0,0]}set(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1])))}}class Nc extends Oc{constructor(e){super(e),this.current=[0,0,0]}set(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2])))}}class jc extends Oc{constructor(e){super(e),this.current=[0,0,0,0]}set(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]&&i[3]===this.current[3]||(this.current=i,this.gl.uniform4f(this.location,i[0],i[1],i[2],i[3])))}}class Uc extends Oc{constructor(e){super(e),this.current=$r.transparent.toRenderColor(null)}set(e,t,i){this.fetchUniformLocation(e,t)&&(i.r===this.current.r&&i.g===this.current.g&&i.b===this.current.b&&i.a===this.current.a||(this.current=i,this.gl.uniform4f(this.location,i.r,i.g,i.b,i.a)))}}const Vc=new Float32Array(16);class $c extends Oc{constructor(e){super(e),this.current=Vc}set(e,t,i){if(this.fetchUniformLocation(e,t)){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}}}const Gc=new Float32Array(9),qc=new Float32Array(4);class Hc extends Oc{constructor(e){super(e),this.current=qc}set(e,t,i){if(this.fetchUniformLocation(e,t))for(let e=0;e<4;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix2fv(this.location,!1,i);break}}}function Zc(e){return[Ac(255*e.r,255*e.g),Ac(255*e.b,255*e.a)]}class Wc{constructor(e,t,i,r){this.value=e,this.uniformNames=t.map((e=>`u_${e}`)),this.type=i,this.context=r}setUniform(e,t,i,r,n){const o=r.constantOr(this.value);t.set(e,n,o instanceof $r?o.toRenderColor(this.context.lut):o)}getBinding(e,t){return"color"===this.type?new Uc(e):new Fc(e)}}class Xc{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}setUniform(e,t,i,r,n){const o="u_pattern"===n||"u_dash"===n?this.pattern:"u_pixel_ratio"===n?this.pixelRatio:null;o&&t.set(e,n,o)}getBinding(e,t){return"u_pattern"===t||"u_dash"===t?new jc(e):new Fc(e)}}class Qc{constructor(e,t,i,r){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===i?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(e,t,i,r,n,o,s){const a=this.paintVertexArray.length,l=this.expression.evaluate(new Qa(0,{brightness:o}),t,{},n,r,s);this.paintVertexArray.resize(e),this._setPaintValue(a,e,l,this.context)}updatePaintArray(e,t,i,r,n,o,s){const a=this.expression.evaluate({zoom:0,brightness:s},i,r,void 0,n);this._setPaintValue(e,t,a,this.context)}_setPaintValue(e,t,i,r){if("color"===this.type){const n=Zc(i.toRenderColor(r.lut));for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,n[0],n[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Yc{constructor(e,t,i,r,n,o){this.expression=e,this.uniformNames=t.map((e=>`u_${e}_t`)),this.type=i,this.useIntegerZoom=r,this.context=n,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:"Float32",components:"color"===i?4:2,offset:0}))),this.paintVertexArray=new o}populatePaintArray(e,t,i,r,n,o,s){const a=this.expression.evaluate(new Qa(this.context.zoom,{brightness:o}),t,{},n,r,s),l=this.expression.evaluate(new Qa(this.context.zoom+1,{brightness:o}),t,{},n,r,s),c=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(c,e,a,l,this.context)}updatePaintArray(e,t,i,r,n,o,s){const a=this.expression.evaluate({zoom:this.context.zoom,brightness:s},i,r,void 0,n),l=this.expression.evaluate({zoom:this.context.zoom+1,brightness:s},i,r,void 0,n);this._setPaintValue(e,t,a,l,this.context)}_setPaintValue(e,t,i,r,n){if("color"===this.type){const r=Zc(i.toRenderColor(n.lut)),o=Zc(i.toRenderColor(n.lut));for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,r[0],r[1],o[0],o[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t,i,r,n){const o=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,s=Yt(this.expression.interpolationFactor(o,this.context.zoom,this.context.zoom+1),0,1);t.set(e,n,s)}getBinding(e,t){return new Fc(e)}}class Jc{constructor(e,t,i,r,n){this.expression=e,this.layerId=n,this.paintVertexAttributes=("array"===i?kc:Ic).members;for(let e=0;e<t.length;++e);this.paintVertexArray=new r}populatePaintArray(e,t,i,r){const n=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(n,e,t.patterns&&t.patterns[this.layerId],i)}updatePaintArray(e,t,i,r,n,o,s){this._setPaintValues(e,t,i.patterns&&i.patterns[this.layerId],o)}_setPaintValues(e,t,i,r){if(!r||!i)return;const n=r[i];if(!n)return;const{tl:o,br:s,pixelRatio:a}=n;for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,o[0],o[1],s[0],s[1],a)}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Kc{constructor(e,t,i=()=>!0){this.binders={},this._buffers=[],this.context=t;const r=[];for(const n in e.paint._values){const o=e.paint.get(n);if(!i(n))continue;if(!(o instanceof rl&&Ks(o.property.specification)))continue;const s=iu(n,e.type),a=o.value,l=o.property.specification.type,c=!!o.property.useIntegerZoom,u="line-dasharray"===n||n.endsWith("pattern"),h="line-dasharray"===n&&"constant"!==e.layout.get("line-cap").value.kind;if("constant"!==a.kind||h)if("source"===a.kind||h||u){const t=ou(n,l,"source");this.binders[n]=u?new Jc(a,s,l,t,e.id):new Qc(a,s,l,t),r.push(`/a_${n}`)}else{const e=ou(n,l,"composite");this.binders[n]=new Yc(a,s,l,c,t,e),r.push(`/z_${n}`)}else this.binders[n]=u?new Xc(a.value,s):new Wc(a.value,s,l,t),r.push(`/u_${n}`)}this.cacheKey=r.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof Qc||t instanceof Yc?t.maxValue:0}populatePaintArrays(e,t,i,r,n,o,s){for(const a in this.binders){const l=this.binders[a];l.context=this.context,(l instanceof Qc||l instanceof Yc||l instanceof Jc)&&l.populatePaintArray(e,t,i,r,n,o,s)}}setConstantPatternPositions(e){for(const t in this.binders){const i=this.binders[t];i instanceof Xc&&i.setConstantPatternPositions(e)}}updatePaintArrays(e,t,i,r,n,o,s,a){let l=!1;const c=Object.keys(e),u=0!==c.length,h=u?c:t.uniqueIds;this.context.lut=n.lut;for(const c in this.binders){const p=this.binders[c];if(p.context=this.context,(p instanceof Qc||p instanceof Yc||p instanceof Jc)&&(!0===p.expression.isStateDependent||!1===p.expression.isLightConstant)){const d=n.paint.get(c);p.expression=d.value;for(const i of h){const n=e[i.toString()];t.eachPosition(i,((e,t,i)=>{const l=r.feature(e);p.updatePaintArray(t,i,l,n,o,s,a)}))}if(!u)for(const t of i.uniqueIds){const n=e[t.toString()];i.eachPosition(t,((e,t,i)=>{const l=r.feature(e);p.updatePaintArray(t,i,l,n,o,s,a)}))}l=!0}}return l}defines(){const e=[];for(const t in this.binders){const i=this.binders[t];(i instanceof Wc||i instanceof Xc)&&e.push(...i.uniformNames.map((e=>`#define HAS_UNIFORM_${e}`)))}return e}getBinderAttributes(){const e=[];for(const t in this.binders){const i=this.binders[t];if(i instanceof Qc||i instanceof Yc||i instanceof Jc)for(let t=0;t<i.paintVertexAttributes.length;t++)e.push(i.paintVertexAttributes[t].name)}return e}getBinderUniforms(){const e=[];for(const t in this.binders){const i=this.binders[t];if(i instanceof Wc||i instanceof Xc||i instanceof Yc)for(const t of i.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const t=[];for(const i in this.binders){const r=this.binders[i];if(r instanceof Wc||r instanceof Xc||r instanceof Yc)for(const n of r.uniformNames)t.push({name:n,property:i,binding:r.getBinding(e,n)})}return t}setUniforms(e,t,i,r,n){for(const{name:t,property:o,binding:s}of i)this.binders[o].setUniform(e,s,n,r.get(o),t)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const t=this.binders[e];(t instanceof Qc||t instanceof Yc||t instanceof Jc)&&t.paintVertexBuffer&&this._buffers.push(t.paintVertexBuffer)}}upload(e){for(const t in this.binders){const i=this.binders[t];(i instanceof Qc||i instanceof Yc||i instanceof Jc)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const t=this.binders[e];(t instanceof Qc||t instanceof Yc||t instanceof Jc)&&t.destroy()}}}class eu{constructor(e,t,i=()=>!0){this.programConfigurations={};for(const r of e)this.programConfigurations[r.id]=new Kc(r,t,i);this.needsUpload=!1,this._featureMap=new Lc,this._featureMapWithoutIds=new Lc,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,t,i,r,n,o,s,a){for(const i in this.programConfigurations)this.programConfigurations[i].populatePaintArrays(e,t,r,n,o,s,a);void 0!==t.id?this._featureMap.add(t.id,i,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,i,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,r,n,o){for(const s of i)this.needsUpload=this.programConfigurations[s.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,t,s,r,n,o||0)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const tu={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["ga
1pwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function iu(e,t){return tu[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}const ru={"line-pattern":{source:Vl,composite:Vl},"fill-pattern":{source:Vl,composite:Vl},"fill-extrusion-pattern":{source:Vl,composite:Vl},"line-dasharray":{source:$l,composite:$l}},nu={color:{source:ac,composite:jl},number:{source:ic,composite:ac}};function ou(e,t,i){const r=ru[e];return r&&r[i]||nu[t][i]}Ma(Wc,"ConstantBinder"),Ma(Xc,"PatternConstantBinder"),Ma(Qc,"SourceExpressionBinder"),Ma(Jc,"PatternCompositeBinder"),Ma(Yc,"CompositeExpressionBinder"),Ma(Kc,"ProgramConfiguration",{omit:["_buffers"]}),Ma(eu,"ProgramConfigurationSet");const su=fo/Math.PI/2,au=5,lu=6,cu=16383,uu=64,hu=[uu,32,16],pu=-su,du=su;function fu(e,t,i,r=su){return i=qt(i),[e*Math.sin(i)*r,-t*r,e*Math.cos(i)*r]}function mu(e,t,i){return fu(Math.cos(qt(e)),Math.sin(qt(e)),t,i)}const _u=6371008.8,gu=2*Math.PI*_u;class yu{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new yu(Kt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,i=this.lat*t,r=e.lat*t,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return _u*Math.acos(Math.min(n,1))}toBounds(e=0){const t=360*e/40075017,i=t/Math.cos(Math.PI/180*this.lat);return new vu({lng:this.lng-i,lat:this.lat-t},{lng:this.lng+i,lat:this.lat+t})}toEcef(e){return mu(this.lat,this.lng,su+e*su/_u)}static convert(e){if(e instanceof yu)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new yu(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new yu(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class vu{constructor(e,t){if(e)if(t)this.setSouthWest(e).setNorthEast(t);else if(4===e.length){const t=e;this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]])}else{const t=e;this.setSouthWest(t[0]).setNorthEast(t[1])}}setNorthEast(e){return this._ne=e instanceof yu?new yu(e.lng,e.lat):yu.convert(e),this}setSouthWest(e){return this._sw=e instanceof yu?new yu(e.lng,e.lat):yu.convert(e),this}extend(e){const t=this._sw,i=this._ne;let r,n;if(e instanceof yu)r=e,n=e;else{if(!(e instanceof vu))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(vu.convert(e)):this.extend(yu.convert(e)):"object"==typeof e&&null!==e&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(yu.convert(e)):this;if(r=e._sw,n=e._ne,!r||!n)return this}return t||i?(t.lng=Math.min(r.lng,t.lng),t.lat=Math.min(r.lat,t.lat),i.lng=Math.max(n.lng,i.lng),i.lat=Math.max(n.lat,i.lat)):(this._sw=new yu(r.lng,r.lat),this._ne=new yu(n.lng,n.lat)),this}getCenter(){return new yu((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new yu(this.getWest(),this.getNorth())}getSouthEast(){return new yu(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:t,lat:i}=yu.convert(e);let r=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(r=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&r}static convert(e){return!e||e instanceof vu?e:new vu(e)}}var xu={};!function(e,t){!function(e){function t(e,t,r){var n=i(256*e,256*(t=Math.pow(2,r)-t-1),r),o=i(256*(e+1),256*(t+1),r);return n[0]+","+n[1]+","+o[0]+","+o[1]}function i(e,t,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}e.getURL=function(e,i,r,n,o,s){return s=s||{},e+"?"+["bbox="+t(r,n,o),"format="+(s.format||"image/png"),"service="+(s.service||"WMS"),"version="+(s.version||"1.1.1"),"request="+(s.request||"GetMap"),"srs="+(s.srs||"EPSG:3857"),"width="+(s.width||256),"height="+(s.height||256),"layers="+i].join("&")},e.getTileBBox=t,e.getMercCoords=i,Object.defineProperty(e,"__esMo
1dule",{value:!0})}(t)}(0,xu);var bu=xu;class wu{constructor(e,t,i){this.z=e,this.x=t,this.y=i,this.key=Eu(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t){const i=bu.getTileBBox(this.x,this.y,this.z),r=function(e,t,i){let r,n="";for(let o=e;o>0;o--)r=1<<o-1,n+=(t&r?1:0)+(i&r?2:0);return n}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===t?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",r).replace("{bbox-epsg-3857}",i)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Tu{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Eu(e,t.z,t.z,t.x,t.y)}}class Mu{constructor(e,t,i,r,n){this.overscaledZ=e,this.wrap=t,this.canonical=new wu(i,+r,+n),this.key=0===t&&e===i?this.canonical.key:Eu(t,e,i,r,n)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const t=this.canonical.z-e;return e>this.canonical.z?new Mu(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Mu(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t=!0){if(this.overscaledZ===e&&t)return this.key;if(e>this.canonical.z)return Eu(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);{const i=this.canonical.z-e;return Eu(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new Mu(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new Mu(t,this.wrap,t,i,r),new Mu(t,this.wrap,t,i+1,r),new Mu(t,this.wrap,t,i,r+1),new Mu(t,this.wrap,t,i+1,r+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Mu(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Mu(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Tu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function Eu(e,t,i,r,n){const o=1<<Math.min(i,22);let s=o*(n%o)+r%o;return e&&i<22&&(s+=o*o*((e<0?-2*e-1:2*e)%(1<<2*(22-i)))),16*(32*s+i)+(t-i)}const Su=[e=>{let t=e.canonical.x-1,i=e.wrap;return t<0&&(t=(1<<e.canonical.z)-1,i--),new Mu(e.overscaledZ,i,e.canonical.z,t,e.canonical.y)},e=>{let t=e.canonical.x+1,i=e.wrap;return t===1<<e.canonical.z&&(t=0,i++),new Mu(e.overscaledZ,i,e.canonical.z,t,e.canonical.y)},e=>new Mu(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1<<e.canonical.z:e.canonical.y)-1),e=>new Mu(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1<<e.canonical.z)-1?0:e.canonical.y+1)];Ma(wu,"CanonicalTileID"),Ma(Mu,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const Cu=0,Au=25.5;function Iu(e){return gu*Math.cos(e*Math.PI/180)}function ku(e){return(180+e)/360}function Lu(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Pu(e,t){return e/Iu(t)}function Ru(e){return 360*e-180}function zu(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function Ou(e,t){return e*Iu(zu(t))}const Du=85.051129;function Fu(e){return Math.cos(qt(Yt(e,-Du,Du)))}function Bu(e,t){const i=Yt(t,Cu,Au),r=Math.pow(2,i);return Fu(e)*gu/(512*r)}function Nu(e){return 1/Math.cos(e*Math.PI/180)}function ju(e,t=0){const i=Math.exp(Math.PI*(1-(e.y+t/fo)/(1<<e.z)*2));return 80150034*i/(i*i+1)/fo/(1<<e.z)}class Uu{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){const i=yu.convert(e);return new Uu(ku(i.lng),Lu(i.lat),Pu(t,i.lat))}toLngLat(){return new yu(Ru(this.x),zu(this.y))}toAltitude(){return Ou(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/gu*Nu(zu(this.y))}}function Vu(e,t,i,r,n,o,s,a,l){const c=(t+r)/2,u=(i+n)/2,h=new Ut(c,u);a(h),function(e,t,i,r,n,o){const s=i-n,a=r-o;return Math.abs((r-t)*s-(i-e)*a)/Math.hypot(s,a)}(h.x,h.y,o.x,o.y,s.x,s.y)>=l?(Vu(e,t,i,c,u,o,h,a,l),Vu(e,c,u,r,n,h,s,a,l)):e.push(s)}function $u(e,t,i){let r=e[0],n=r.x,o=r.y;t(r);const s=[r];for(let a=1;a<e.length;a++){const l=e[a],{x:c,y:u}=l;t(l),Vu(s,n,o,c,u,r,l,t,i),n=c,o=u,r=l}return s}function Gu(e,t,i,r){if(r(t,i)){const n=t.add(i)._mult(.5);Gu(e,t,n,r),Gu(e,n,i,r)}else e.push(i)}function qu(e,t){let i=e[0];const r=[i];for(let n=1;n<e.length;n++){const o=e[n];Gu(r,i,o,t),i=o}return r}const Hu=Math.pow(2,14)-1,Zu=-Hu-1;function Wu(e,t){const i=Math.round(e.x*t),r=Math.round(e.y*t);return e.x=Yt(i,Zu,Hu),e.y=Yt(r,Zu,Hu),(i<e.x||i>e.x+1||r<e.y||r>e.y+1)&&fi("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function Xu(e,t,i){const r=e.loadGeometry(),n=e.extent,o=fo/n;if(t&&i&&i.projection.isReprojectedInTileSpace){const o=1<<t.z,{scale:s,x:a,y:l,projection:c}=i,u=e=>{const i=Ru((t.x+e.x/n)/o),r=zu((t.y+e.y/n)/o),u=c.project(i,r);e.x=(u.x*s-a)*n,e.y=(u.y*s-l)*n};for(let t=0;t<r.length;t++)if(1!==e.type)r[t]=$u(r[t],u,1);else{const e=[];for(const i of r[t])i.x<0||i.x>=n||i.y<0||i.y>=n||(u(i),e.push(i));r[t]=e}}for(const e of r)for(const t of e)Wu(t,o);return r}function Qu(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Xu(e):[]}}function Yu(e,t,i,r,n){e.emplaceBack(2*t+(r+1)/2,2*i+(n+1)/2)}function Ju(e,t,i){const r=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*r,i[1]*r,i[2]*r)}class Ku{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new Ol,this.indexArray=new Kl,this.segments=new Cc,this.programConfigurations=new eu(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}updateFootprints(e,t){}populate(e,t,i,r){const n=this.layers[0],o=[];let s=null;
vendor: 15,358 bytes, line 1
1"circle"===n.type&&(s=n.layout.get("circle-sort-key"));for(const{feature:t,id:n,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=Qu(t,e);if(!this.layers[0]._featureFilter.filter(new Qa(this.zoom),c,i))continue;const u=s?s.evaluate(c,{},i):void 0,h={id:n,properties:t.properties,type:t.type,sourceLayerIndex:l,index:a,geometry:e?c.geometry:Xu(t,i,r),patterns:{},sortKey:u};o.push(h)}s&&o.sort(((e,t)=>e.sortKey-t.sortKey));let a=null;"globe"===r.projection.name&&(this.globeExtVertexArray=new Gl,a=r.projection);for(const r of o){const{geometry:n,index:o,sourceLayerIndex:s}=r,l=e[o].feature;this.addFeature(r,n,o,t.availableImages,i,a,t.brightness),t.featureIndex.insert(l,n,o,s,this.index)}}update(e,t,i,r,n){const o=0!==Object.keys(e).length;o&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,t,o?this.stateDependentLayers:this.layers,i,r,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ec.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Sc.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,t,i,r,n,o,s){for(const i of t)for(const t of i){const i=t.x,r=t.y;if(i<0||i>=fo||r<0||r>=fo)continue;if(o){const e=o.projectTilePoint(i,r,n),t=o.upVector(n,i,r),s=this.globeExtVertexArray;Ju(s,e,t),Ju(s,e,t),Ju(s,e,t),Ju(s,e,t)}const s=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),a=s.vertexLength;Yu(this.layoutVertexArray,i,r,-1,-1),Yu(this.layoutVertexArray,i,r,1,-1),Yu(this.layoutVertexArray,i,r,1,1),Yu(this.layoutVertexArray,i,r,-1,1),this.indexArray.emplaceBack(a,a+1,a+2),this.indexArray.emplaceBack(a,a+2,a+3),s.vertexLength+=4,s.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},r,n,s)}}function eh(e,t){for(let i=0;i<e.length;i++)if(ch(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(ch(e,t[i]))return!0;return!!nh(e,t)}function th(e,t,i){return!!ch(e,t)||!!sh(t,e,i)}function ih(e,t){if(1===e.length)return lh(t,e[0]);for(let i=0;i<t.length;i++){const r=t[i];for(let t=0;t<r.length;t++)if(ch(e,r[t]))return!0}for(let i=0;i<e.length;i++)if(lh(t,e[i]))return!0;for(let i=0;i<t.length;i++)if(nh(e,t[i]))return!0;return!1}function rh(e,t,i){if(e.length>1){if(nh(e,t))return!0;for(let r=0;r<t.length;r++)if(sh(t[r],e,i))return!0}for(let r=0;r<e.length;r++)if(sh(e[r],t,i))return!0;return!1}function nh(e,t){if(0===e.length||0===t.length)return!1;for(let i=0;i<e.length-1;i++){const r=e[i],n=e[i+1];for(let e=0;e<t.length-1;e++)if(oh(r,n,t[e],t[e+1]))return!0}return!1}function oh(e,t,i,r){return mi(e,i,r)!==mi(t,i,r)&&mi(e,t,i)!==mi(e,t,r)}function sh(e,t,i){const r=i*i;if(1===t.length)return e.distSqr(t[0])<r;for(let i=1;i<t.length;i++)if(ah(e,t[i-1],t[i])<r)return!0;return!1}function ah(e,t,i){const r=t.distSqr(i);if(0===r)return e.distSqr(t);const n=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/r;return e.distSqr(n<0?t:n>1?i:i.sub(t)._mult(n)._add(t))}function lh(e,t){let i,r,n,o=!1;for(let s=0;s<e.length;s++){i=e[s];for(let e=0,s=i.length-1;e<i.length;s=e++)r=i[e],n=i[s],r.y>t.y!=n.y>t.y&&t.x<(n.x-r.x)*(t.y-r.y)/(n.y-r.y)+r.x&&(o=!o)}return o}function ch(e,t){let i=!1;for(let r=0,n=e.length-1;r<e.length;n=r++){const o=e[r],s=e[n];o.y>t.y!=s.y>t.y&&t.x<(s.x-o.x)*(t.y-o.y)/(s.y-o.y)+o.x&&(i=!i)}return i}function uh(e,t,i,r,n){for(const o of e)if(t<=o.x&&i<=o.y&&r>=o.x&&n>=o.y)return!0;const o=[new Ut(t,i),new Ut(t,n),new Ut(r,n),new Ut(r,i)];if(e.length>2)for(const t of o)if(ch(e,t))return!0;for(let t=0;t<e.length-1;t++)if(hh(e[t],e[t+1],o))return!0;return!1}function hh(e,t,i){const r=i[0],n=i[2];if(e.x<r.x&&t.x<r.x||e.x>n.x&&t.x>n.x||e.y<r.y&&t.y<r.y||e.y>n.y&&t.y>n.y)return!1;const o=mi(e,t,i[0]);return o!==mi(e,t,i[1])||o!==mi(e,t,i[2])||o!==mi(e,t,i[3])}function ph(e,t,i,r,n,o){let s=t.y-e.y,a=e.x-t.x;if(o=o||0){const e=s*s+a*a;if(0===e)return!0;const t=Math.sqrt(e);s/=t,a/=t}return!((i.x-e.x)*s+(i.y-e.y)*a-o<0||(r.x-e.x)*s+(r.y-e.y)*a-o<0||(n.x-e.x)*s+(n.y-e.y)*a-o<0)}function dh(e,t,i,r,n,o,s){return!(ph(e,t,r,n,o,s)||ph(t,i,r,n,o,s)||ph(i,e,r,n,o,s)||ph(r,n,e,t,i,s)||ph(n,o,e,t,i,s)||ph(o,r,e,t,i,s))}function fh(e,t,i){const r=t.paint.get(e).value;return"constant"===r.kind?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function mh(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function _h(e,t,i,r,n){if(!t[0]&&!t[1])return e;const o=Ut.convert(t)._mult(n);"viewport"===i&&o._rotate(-r);const s=[];for(let t=0;t<e.length;t++)s.push(e[t].sub(o));return s}function gh(e,t,i,r){const n=Ut.convert(e)._mult(r);return"viewport"===t&&n._rotate(-i),n}let yh,vh;Ma(Ku,"CircleBucket",{omit:["layers"]});class xh{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(t,i,r){const n=e.$.dot(i,this.dir);if(Math.abs(n)<1e-6)return!1;const o=((t[0]-this.pos[0])*i[0]+(t[1]-this.pos[1])*i[1]+(t[2]-this.pos[2])*i[2])/n;return r[0]=this.pos[0]+this.dir[0]*o,r[1]=this.pos[1]+this.dir[1]*o,r[2]=this.pos[2]+this.dir[2]*o,!0}closestPointOnSphere(t,i,r){if(e.$.equals(this.pos,t)||0===i)return r[0]=r[1]=r[2]=0,!1;const[n,o,s]=this.dir,a=this.pos[0]-t[0],l=this.pos[1]-t[1],c=this.pos[2]-t[2],u=n*n+o*o+s*s,h=2*(a*n+l*o+c*s),p=h*h-4*u*(a*a+l*l+c*c-i*i);if(p<0){const e=Math.max(-h/2,0),t=a+n*e,u=l+o*e,p=c+s*e,d=Math.hypot(t,u,p);return r[0]=t*i/d,r[1]=u*i/d,r[2]=p*i/d,!1}{const e=(-h-Math.sqrt(p))/(2*u);if(e<0){const e=Math.hypot(a,l,c);return r[0]=a*i/e,r[1]=l*i/e,r[2]=c*i/e,!1}return r[0]=a+n*e,r[1]=l+o*e,r[2]=c+s*e,!0}}}class bh{constructor(e,t,i,r,n){this.TL=e,this.TR=t,this.BR=i,this.BL=r,this.horizon=n}static fromInvProjectionMatrix(t,i,r){const n=[-1,1,1],o=[1,1,1],s=[1,-1,1],a=[-1,-1,1],l=e.$.transformMat4(n,n,t),c=e.$.transformMat4(o,o,t),u=e.$.transformMat4(s,s,t),h=e.$.transformMat4(a,a,t);return new bh(l,c,u,h,i/r)}}function wh(t,i,r){let n=1/0,o=-1/0;const s=[];for(const a of t){e.$.sub(s,a,i);const t=e.$.dot(s,r);n=Math.min(n,t),o=Math.max(o,t)}return[n,o]}function Th(t,i){let r=!0;for(let n=0;n<t.planes.length;n++){const o=t.planes[n];let s=0;for(let t=0;t<i.length;t++)s+=e.$.dot(o,i[t])+o[3]>=0;if(0===s)return 0;s!==i.length&&(r=!1)}return r?2:1}function Mh(e,t){for(const i of e.projections){const r=wh(t,e.points[0],i.axis);if(i.projection[1]<r[0]||i.projection[0]>r[1])return 0}return 1}function Eh(t,i){let r=0;const n=[0,0,0,0];for(let o=0;o<t.length;o++)n[0]=t[o][0],n[1]=t[o][1],n[2]=t[o][2],n[3]=1,e.aB.dot(n,i)>=0&&r++;return r}class Sh{constructor(t,i){this.points=t||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=Ch.fromPoints(this.points),this.projections=[],this.frustumEdges=[e.$.sub([],this.points[2],this.points[3]),e.$.sub([],this.points[0],this.points[3]),e.$.sub([],this.points[4],this.points[0]),e.$.sub([],this.points[5],this.points[1]),e.$.sub([],this.points[6],this.points[2]),e.$.sub([],this.points[7],this.points[3])];for(const e of this.frustumEdges){const t=[0,-e[2],e[1]],i=[e[2],0,-e[0]];this.projections.push({axis:t,projection:wh(this.points,this.points[0],t)}),this.projections.push({axis:i,projection:wh(this.points,this.points[0],i)})}}static fromInvProjectionMatrix(t,i,r,n){const o=Math.pow(2,r),s=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((r=>{const s=e.aB.transformMat4([],r,t),a=1/s[3]/i*o;return e.aB.mul(s,s,[a,a,n?1/s[3]:a,a])})),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((t=>{const i=e.$.sub([],s[t[0]],s[t[1]]),r=e.$.sub([],s[t[2]],s[t[1]]),n=e.$.normalize([],e.$.cross([],i,r)),o=-e.$.dot(n,s[t[1]]);return n.concat(o)})),l=[];for(let e=0;e<s.length;e++)l.push([s[e][0],s[e][1],s[e][2]]);return new Sh(l,a)}intersectsPrecise(t,i,r){for(let e=0;e<i.length;e++)if(!Eh(t,i[e]))return 0;for(let e=0;e<this.planes.length;e++)if(!Eh(t,this.planes[e]))return 0;for(const i of r)for(const r of this.frustumEdges){const n=e.$.cross([],i,r),o=e.$.length(n);if(0===o)continue;e.$.scale(n,n,1/o);const s=wh(this.points,this.points[0],n),a=wh(t,this.points[0],n);if(s[0]>a[1]||a[0]>s[1])return 0}return 1}containsPoint(t){for(const i of this.planes){const r=i[3];if(e.$.dot([i[0],i[1],i[2]],t)+r<0)return!1}return!0}}class Ch{static fromPoints(t){const i=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(const n of t)e.$.min(i,i,n),e.$.max(r,r,n);return new Ch(i,r)}static fromTileIdAndHeight(e,t,i){const r=1<<e.canonical.z,n=e.canonical.x,o=e.canonical.y;return new Ch([n/r,o/r,t],[(n+1)/r,(o+1)/r,i])}static applyTransform(t,i){const r=t.getCorners();for(let t=0;t<r.length;++t)e.$.transformMat4(r[t],r[t],i);return Ch.fromPoints(r)}static applyTransformFast(e,t){const i=[t[12],t[13],t[14]],r=[...i];for(let n=0;n<3;n++)for(let o=0;o<3;o++){const s=t[4*o+n],a=s*e.min[o],l=s*e.max[o];i[n]+=Math.min(a,l),r[n]+=Math.max(a,l)}return new Ch(i,r)}static projectAabbCorners(t,i){const r=t.getCorners();for(let t=0;t<r.length;++t)e.$.transformMat4(r[t],r[t],i);return r}constructor(t,i){this.min=t,this.max=i,this.center=e.$.scale([],e.$.add([],this.min,this.max),.5)}quadrant(t){const i=[t%2==0,t<2],r=e.$.clone(this.min),n=e.$.clone(this.max);for(let e=0;e<i.length;e++)r[e]=i[e]?this.min[e]:this.center[e],n[e]=i[e]?this.center[e]:this.max[e];return n[2]=this.max[2],new Ch(r,n)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,t=this.max;return[[e[0],e[1],e[2]],[t[0],e[1],e[2]],[t[0],t[1],e[2]],[e[0],t[1],e[2]],[e[0],e[1],t[2]],[t[0],e[1],t[2]],[t[0],t[1],t[2]],[e[0],t[1],t[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?Th(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?Th(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,t){return t||this.intersects(e)?Mh(e,this.getCorners()):0}intersectsPreciseFlat(e,t){return t||this.intersectsFlat(e)?Mh(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let t=0;t<3;++t)if(this.min[t]>e.max[t]||e.min[t]>this.max[t])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e.min[t]),this.max[t]=Math.max(this.max[t],e.max[t])}encapsulatePoint(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e[t]),this.max[t]=Math.max(this.max[t],e[t])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}Ma(Ch,"Aabb");const Ah=Rl([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Ih}=Ah,kh=Rl([{name:"a_pos_3",components:3,type:"Int16"}]);var Lh=Rl([{name:"a_pos",type:"Int16",components:2}]);function Ph(e){return e*su/_u}const Rh=[new Ch([pu,pu,pu],[du,du,du]),new Ch([pu,pu,pu],[0,0,du]),new Ch([0,pu,pu],[du,0,du]),new Ch([pu,0,pu],[0,du,du]),new Ch([0,0,pu],[du,du,du])];function zh(t,i,r,n=!0){const o=e.$.scale([],t._camera.position,t.worldSize),s=[i,r,1,1];e.aB.transformMat4(s,s,t.pixelMatrixInverse),e.aB.scale(s,s,1/s[3]);const a=e.$.sub([],s,o),l=e.$.normalize([],a),c=t.globeMatrix,u=[c[12],c[13],c[14]],h=e.$.sub([],u,o),p=e.$.length(h),d=e.$.normalize([],h),f=t.worldSize/(2*Math.PI),m=e.$.dot(d,l),_=Math.asin(f/p);if(_<Math.acos(m)){if(!n)return null;const t=[],i=[];e.$.scale(t,l,p/m),e.$.normalize(i,e.$.sub(i,t,h)),e.$.normalize(l,e.$.add(l,h,e.$.scale(l,i,Math.tan(_)*p)))}const g=[];new xh(o,l).closestPointOnSphere(u,f,g);const y=e.$.normalize([],Ai(c,0)),v=e.$.normalize([],Ai(c,1)),x=e.$.normalize([],Ai(c,2)),b=e.$.dot(y,g),w=e.$.dot(v,g),T=e.$.dot(x,g),M=Ht(Math.asin(-w/f));let E=Ht(Math.atan2(b,T));E=t.center.lng+function(e,t){const i=(t-e+180)%360-180;return i<-180?i+360:i}(t.center.lng,E);const S=ku(E),C=Yt(Lu(M),0,1);return new Uu(S,C)}class Oh{constructor(t,i,r){this.a=e.$.sub([],t,r),this.b=e.$.sub([],i,r),this.center=r;const n=e.$.normalize([],this.a),o=e.$.normalize([],this.b);this.angle=Math.acos(e.$.dot(n,o))}}function Dh(e,t){if(0===e.angle)return null;let i;return i=0===e.a[t]?1/e.angle*.5*Math.PI:1/e.angle*Math.atan(e.b[t]/e.a[t]/Math.sin(e.angle)-1/Math.tan(e.angle)),i<0||i>1?null:function(e,t,i,r){const n=Math.sin(i);return e*(Math.sin((1-r)*i)/n)+t*(Math.sin(r*i)/n)}(e.a[t],e.b[t],e.angle,Yt(i,0,1))+e.center[t]}function Fh(e){if(e.z<=1)return Rh[e.z+2*e.y+e.x];const t=$h(Vh(e));return Ch.fromPoints(t)}function Bh(t,i,r){return e.$.scale(t,t,1-r),e.$.scaleAndAdd(t,t,i,r)}function Nh(t,i){const r=Jh(i.zoom);if(0===r)return Fh(t);const n=Vh(t),o=$h(n),s=ku(n.getWest())*i.worldSize,a=ku(n.getEast())*i.worldSize,l=Lu(n.getNorth())*i.worldSize,c=Lu(n.getSouth())*i.worldSize,u=[s,l,0],h=[a,l,0],p=[s,c,0],d=[a,c,0],f=e.ae.invert([],i.globeMatrix);return e.$.transformMat4(u,u,f),e.$.transformMat4(h,h,f),e.$.transformMat4(p,p,f),e.$.transformMat4(d,d,f),o[0]=Bh(o[0],p,r),o[1]=Bh(o[1],d,r),o[2]=Bh(o[2],h,r),o[3]=Bh(o[3],u,r),Ch.fromPoints(o)}function jh(t,i,r){for(const n of t)e.$.transformMat4(n,n,i),e.$.scale(n,n,r)}function Uh(t,i,r,n){const o=i/t.worldSize,s=t.globeMatrix;if(r.z<=1){const e=Fh(r).getCorners();return jh(e,s,o),Ch.fromPoints(e)}const a=Vh(r,n),l=$h(a,su+Ph(t._tileCoverLift));jh(l,s,o);const c=Number.MAX_VALUE,u=[-c,-c,-c],h=[c,c,c];if(a.contains(t.center)){for(const t of l)e.$.min(h,h,t),e.$.max(u,u,t);u[2]=0;const i=t.point,r=[i.x*o,i.y*o,0];return e.$.min(h,h,r),e.$.max(u,u,r),new Ch(h,u)}if(t._tileCoverLift>0){for(const t of l)e.$.min(h,h,t),e.$.max(u,u,t);return new Ch(h,u)}const p=[s[12]*o,s[13]*o,s[14]*o],d=a.getCenter(),f=Yt(t.center.lat,-Du,Du),m=Yt(d.lat,-Du,Du),_=ku(t.center.lng),g=Lu(f);let y=_-ku(d.lng);const v=g-Lu(m);y>.5?y-=1:y<-.5&&(y+=1);let x=0;if(Math.abs(y)>Math.abs(v))x=y>=0?1:3;else{x=v>=0?0:2;const t=[s[4]*o,s[5]*o,s[6]*o],i=-Math.sin(qt(v>=0?a.getSouth():a.getNorth()))*su;e.$.scaleAndAdd(p,p,t,i)}const b=l[x],w=l[(x+1)%4],T=new Oh(b,w,p),M=[Dh(T,0)||b[0],Dh(T,1)||b[1],Dh(T,2)||b[2]],E=Jh(t.zoom);if(E>0){const n=function({x:e,y:t,z:i},r,n,o,s){const a=1/(1<<i);let l=e*a,c=l+a,u=t*a,h=u+a,p=0;const d=(l+c)/2-o;return d>.5?p=-1:d<-.5&&(p=1),l=((l+p)*r-(o*=r))*n+o,c=((c+p)*r-o)*n+o,u=(u*r-(s*=r))*n+s,h=(h*r-s)*n+s,[[l,h,0],[c,h,0],[c,u,0],[l,u,0]]}(r,i,t._pixelsPerMercatorPixel,_,g);for(let e=0;e<l.length;e++)Bh(l[e],n[e],E);const o=e.$.add([],n[x],n[(x+1)%4]);e.$.scale(o,o,.5),Bh(M,o,E)}for(const t of l)e.$.min(h,h,t),e.$.max(u,u,t);return h[2]=Math.min(b[2],w[2]),e.$.min(h,h,M),e.$.max(u,u,M),new Ch(h,u)}function Vh({x:e,y:t,z:i},r=!1){const n=1/(1<<i),o=new yu(Ru(e*n),t===(1<<i)-1&&r?-90:zu((t+1)*n)),s=new yu(Ru((e+1)*n),0===t&&r?90:zu(t*n));return new vu(o,s)}
1function $h(e,t=su){const i=qt(e.getNorth()),r=qt(e.getSouth()),n=Math.cos(i),o=Math.cos(r),s=Math.sin(i),a=Math.sin(r),l=e.getWest(),c=e.getEast();return[fu(o,a,l,t),fu(o,a,c,t),fu(n,s,c,t),fu(n,s,l,t)]}function Gh(e,t,i,r){const n=1<<i.z,o=(e/fo+i.x)/n;return mu(zu((t/fo+i.y)/n),Ru(o),r)}function qh({min:e,max:t}){return cu/Math.max(t[0]-e[0],t[1]-e[1],t[2]-e[2])}const Hh=new Float64Array(16);function Zh(t){const i=qh(t),r=e.ae.fromScaling(Hh,[i,i,i]);return e.ae.translate(r,r,e.$.negate([],t.min))}function Wh(t){const i=e.ae.fromTranslation(Hh,t.min),r=1/qh(t);return e.ae.scale(i,i,[r,r,r])}function Xh(e){const t=fo/(2*Math.PI);return e/(2*Math.PI)/t}function Qh(e,t){return fo/(512*Math.pow(2,e))*qh(Fh(t))}function Yh(t,i,r,n,o){const s=Xh(r),a=[t,i,-r/(2*Math.PI)],l=e.ae.identity(new Float64Array(16));return e.ae.translate(l,l,a),e.ae.scale(l,l,[s,s,s]),e.ae.rotateX(l,l,qt(-o)),e.ae.rotateY(l,l,qt(-n)),l}function Jh(e){return Jt(au,lu,e)}function Kh(t,i){const r=mu(i.lat,i.lng),n=function(t){const i=mu(t._center.lat,t._center.lng),r=e.$.fromValues(0,1,0);let n=e.$.cross([],r,i);const o=e.ae.fromRotation([],-t.angle,i);n=e.$.transformMat4(n,n,o),e.ae.fromRotation(o,-t._pitch,n);const s=e.$.normalize([],i);return e.$.scale(s,s,Ph(t.cameraToCenterDistance/t.pixelsPerMeter)),e.$.transformMat4(s,s,o),e.$.add([],i,s)}(t),o=e.$.subtract([],n,r);return e.$.angle(o,r)}function ep(e,t){return Kh(e,t)>Math.PI/2*1.01}const tp=qt(85),ip=Math.cos(tp),rp=Math.sin(tp),np=e.ae.create(),op=e=>{const t=[];return"map"===e.paint.get("circle-pitch-alignment")&&t.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&t.push("SCALE_WITH_MAP"),t};function sp(t,i,r,n,o,s,a,l,c){if(s&&t.queryGeometry.isAboveHorizon)return!1;s&&(c*=t.pixelToTileUnitsFactor);const u=t.tileID.canonical,h=r.projection.upVectorScale(u,r.center.lat,r.worldSize).metersToTile;for(const p of i)for(const i of p){const p=i.add(l),d=o&&r.elevation?r.elevation.exaggeration()*o.getElevationAt(p.x,p.y,!0):0,f=r.projection.projectTilePoint(p.x,p.y,u);if(d>0){const e=r.projection.upVector(u,p.x,p.y);f.x+=e[0]*h*d,f.y+=e[1]*h*d,f.z+=e[2]*h*d}const m=s?p:ap(f.x,f.y,f.z,n),_=s?t.tilespaceRays.map((e=>up(e,d))):t.queryGeometry.screenGeometry,g=e.aB.transformMat4([],[f.x,f.y,f.z,1],n);if(!a&&s?c*=g[3]/r.cameraToCenterDistance:a&&!s&&(c*=r.cameraToCenterDistance/g[3]),s){const e=zu((i.y/fo+u.y)/(1<<u.z));c/=r.projection.pixelsPerMeter(e,1)/Pu(1,e)}if(th(_,m,c))return!0}return!1}function ap(t,i,r,n){const o=e.aB.transformMat4([],[t,i,r,1],n);return new Ut(o[0]/o[3],o[1]/o[3])}const lp=e.$.fromValues(0,0,0),cp=e.$.fromValues(0,0,1);function up(t,i){const r=e.$.create();return lp[2]=i,t.intersectsPlane(lp,cp,r),new Ut(r[0],r[1])}class hp extends Ku{}function pp(e,{width:t,height:i},r,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*i*r)throw new RangeError("mismatched image size")}else n=new Uint8Array(t*i*r);return e.width=t,e.height=i,e.data=n,e}function dp(e,t,i){const{width:r,height:n}=t;r===e.width&&n===e.height||(fp(e,t,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,r),height:Math.min(e.height,n)},i,null),e.width=r,e.height=n,e.data=t.data)}function fp(e,t,i,r,n,o,s,a){if(0===n.width||0===n.height)return t;if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");const l=e.data,c=t.data,u=4===o&&a;for(let a=0;a<n.height;a++){const h=((i.y+a)*e.width+i.x)*o,p=((r.y+a)*t.width+r.x)*o;if(u)for(let e=0;e<n.width;e++){const t=h+e*o+3,i=p+e*o;c[i+0]=255,c[i+1]=255,c[i+2]=255,c[i+3]=l[t]}else if(s)for(let e=0;e<n.width;e++){const t=h+e*o,i=p+e*o,r=l[t+3],n=new $r(l[t+0]/255*r,l[t+1]/255*r,l[t+2]/255*r,r).toRenderColor(s).toArray();c[i+0]=n[0],c[i+1]=n[1],c[i+2]=n[2],c[i+3]=n[3]}else for(let e=0;e<n.width*o;e++)c[p+e]=l[h+e]}return t}Ma(hp,"HeatmapBucket",{omit:["layers"]});class mp{constructor(e,t){pp(this,e,1,t)}resize(e){dp(this,new mp(e),1)}clone(){return new mp({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,n){fp(e,t,i,r,n,1,null)}}class _p{constructor(e,t){pp(this,e,4,t)}resize(e){dp(this,new _p(e),4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new _p({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,r,n,o,s){fp(e,t,i,r,n,4,o,s)}}class gp{constructor(e,t){this.width=e.width,this.height=e.height,this.data=t instanceof Uint8Array?new Float32Array(t.buffer):t}}let yp,vp,xp,bp;function wp(e){const t={},i=e.resolution||256,r=e.clips?e.clips.length:1,n=e.image||new _p({width:i,height:r}),o=(i,r,o)=>{t[e.evaluationKey]=o;const s=e.expression.evaluate(t);s&&(n.data[i+r+0]=Math.floor(255*s.r/s.a),n.data[i+r+1]=Math.floor(255*s.g/s.a),n.data[i+r+2]=Math.floor(255*s.b/s.a),n.data[i+r+3]=Math.floor(255*s.a))};if(e.clips)for(let t=0,n=0;t<r;++t,n+=4*i)for(let r=0,s=0;r<i;r++,s+=4){const a=r/(i-1),{start:l,end:c}=e.clips[t];o(n,s,l*(1-a)+c*a)}else for(let e=0,t=0;e<i;e++,t+=4)o(0,t,e/(i-1));return n}
vendor: 4,386 bytes, line 1
1Ma(mp,"AlphaImage"),Ma(_p,"RGBAImage");const Tp=Rl([{name:"a_pos",components:2,type:"Int16"}],4),{members:Mp}=Tp;function Ep(e,t,i=2){const r=t&&t.length,n=r?t[0]*i:e.length;let o=Sp(e,0,n,i,!0);const s=[];if(!o||o.next===o.prev)return s;let a,l,c;if(r&&(o=function(e,t,i,r){const n=[];for(let i=0,o=t.length;i<o;i++){const s=Sp(e,t[i]*r,i<o-1?t[i+1]*r:e.length,r,!1);s===s.next&&(s.steiner=!0),n.push(Fp(s))}n.sort(Rp);for(let e=0;e<n.length;e++)i=zp(n[e],i);return i}(e,t,o,i)),e.length>80*i){a=1/0,l=1/0;let t=-1/0,r=-1/0;for(let o=i;o<n;o+=i){const i=e[o],n=e[o+1];i<a&&(a=i),n<l&&(l=n),i>t&&(t=i),n>r&&(r=n)}c=Math.max(t-a,r-l),c=0!==c?32767/c:0}return Ap(o,s,i,a,l,c,0),s}function Sp(e,t,i,r,n){let o;if(n===function(e,t,i,r){let n=0;for(let o=t,s=i-r;o<i;o+=r)n+=(e[s]-e[o])*(e[o+1]+e[s+1]),s=o;return n}(e,t,i,r)>0)for(let n=t;n<i;n+=r)o=Zp(n/r|0,e[n],e[n+1],o);else for(let n=i-r;n>=t;n-=r)o=Zp(n/r|0,e[n],e[n+1],o);return o&&Up(o,o.next)&&(Wp(o),o=o.next),o}function Cp(e,t){if(!e)return e;t||(t=e);let i,r=e;do{if(i=!1,r.steiner||!Up(r,r.next)&&0!==jp(r.prev,r,r.next))r=r.next;else{if(Wp(r),r=t=r.prev,r===r.next)break;i=!0}}while(i||r!==t);return t}function Ap(e,t,i,r,n,o,s){if(!e)return;!s&&o&&function(e,t,i,r){let n=e;do{0===n.z&&(n.z=Dp(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){let t,i=1;do{let r,n=e;e=null;let o=null;for(t=0;n;){t++;let s=n,a=0;for(let e=0;e<i&&(a++,s=s.nextZ,s);e++);let l=i;for(;a>0||l>0&&s;)0!==a&&(0===l||!s||n.z<=s.z)?(r=n,n=n.nextZ,a--):(r=s,s=s.nextZ,l--),o?o.nextZ=r:e=r,r.prevZ=o,o=r;n=s}o.nextZ=null,i*=2}while(t>1)}(n)}(e,r,n,o);let a=e;for(;e.prev!==e.next;){const l=e.prev,c=e.next;if(o?kp(e,r,n,o):Ip(e))t.push(l.i,e.i,c.i),Wp(e),e=c.next,a=c.next;else if((e=c)===a){s?1===s?Ap(e=Lp(Cp(e),t),t,i,r,n,o,2):2===s&&Pp(e,t,i,r,n,o):Ap(Cp(e),t,i,r,n,o,1);break}}}function Ip(e){const t=e.prev,i=e,r=e.next;if(jp(t,i,r)>=0)return!1;const n=t.x,o=i.x,s=r.x,a=t.y,l=i.y,c=r.y,u=n<o?n<s?n:s:o<s?o:s,h=a<l?a<c?a:c:l<c?l:c,p=n>o?n>s?n:s:o>s?o:s,d=a>l?a>c?a:c:l>c?l:c;let f=r.next;for(;f!==t;){if(f.x>=u&&f.x<=p&&f.y>=h&&f.y<=d&&Bp(n,a,o,l,s,c,f.x,f.y)&&jp(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function kp(e,t,i,r){const n=e.prev,o=e,s=e.next;if(jp(n,o,s)>=0)return!1;const a=n.x,l=o.x,c=s.x,u=n.y,h=o.y,p=s.y,d=a<l?a<c?a:c:l<c?l:c,f=u<h?u<p?u:p:h<p?h:p,m=a>l?a>c?a:c:l>c?l:c,_=u>h?u>p?u:p:h>p?h:p,g=Dp(d,f,t,i,r),y=Dp(m,_,t,i,r);let v=e.prevZ,x=e.nextZ;for(;v&&v.z>=g&&x&&x.z<=y;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==s&&Bp(a,u,l,h,c,p,v.x,v.y)&&jp(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,x.x>=d&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==s&&Bp(a,u,l,h,c,p,x.x,x.y)&&jp(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;v&&v.z>=g;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=_&&v!==n&&v!==s&&Bp(a,u,l,h,c,p,v.x,v.y)&&jp(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;x&&x.z<=y;){if(x.x>=d&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==s&&Bp(a,u,l,h,c,p,x.x,x.y)&&jp(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Lp(e,t){let i=e;do{const r=i.prev,n=i.next.next;!Up(r,n)&&Vp(r,i,i.next,n)&&qp(r,n)&&qp(n,r)&&(t.push(r.i,i.i,n.i),Wp(i),Wp(i.next),i=e=n),i=i.next}while(i!==e);return Cp(i)}function Pp(e,t,i,r,n,o){let s=e;do{let e=s.next.next;for(;e!==s.prev;){if(s.i!==e.i&&Np(s,e)){let a=Hp(s,e);return s=Cp(s,s.next),a=Cp(a,a.next),Ap(s,t,i,r,n,o,0),void Ap(a,t,i,r,n,o,0)}e=e.next}s=s.next}while(s!==e)}function Rp(e,t){return e.x-t.x}function zp(e,t){const i=function(e,t){let i=t;const r=e.x,n=e.y;let o,s=-1/0;do{if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){const e=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=r&&e>s&&(s=e,o=i.x<i.next.x?i:i.next,e===r))return o}i=i.next}while(i!==t);if(!o)return null;const a=o,l=o.x,c=o.y;let u=1/0;i=o;do{if(r>=i.x&&i.x>=l&&r!==i.x&&Bp(n<c?r:s,n,l,c,n<c?s:r,n,i.x,i.y)){const t=Math.abs(n-i.y)/(r-i.x);qp(i,e)&&(t<u||t===u&&(i.x>o.x||i.x===o.x&&Op(o,i)))&&(o=i,u=t)}i=i.next}while(i!==a);return o}(e,t);if(!i)return t;const r=Hp(i,e);return Cp(r,r.next),Cp(i,i.next)}function Op(e,t){return jp(e.prev,e,t.prev)<0&&jp(t.next,e,e.next)<0}function Dp(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Fp(e){let t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}
vendor: 3,559 bytes, line 1
1while(t!==e);return i}function Bp(e,t,i,r,n,o,s,a){return(n-s)*(t-a)>=(e-s)*(o-a)&&(e-s)*(r-a)>=(i-s)*(t-a)&&(i-s)*(o-a)>=(n-s)*(r-a)}function Np(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&Vp(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(qp(e,t)&&qp(t,e)&&function(e,t){let i=e,r=!1;const n=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(jp(e.prev,e,t.prev)||jp(e,t.prev,t))||Up(e,t)&&jp(e.prev,e,e.next)>0&&jp(t.prev,t,t.next)>0)}function jp(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function Up(e,t){return e.x===t.x&&e.y===t.y}function Vp(e,t,i,r){const n=Gp(jp(e,t,i)),o=Gp(jp(e,t,r)),s=Gp(jp(i,r,e)),a=Gp(jp(i,r,t));return n!==o&&s!==a||!(0!==n||!$p(e,i,t))||!(0!==o||!$p(e,r,t))||!(0!==s||!$p(i,e,r))||!(0!==a||!$p(i,t,r))}function $p(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function Gp(e){return e>0?1:e<0?-1:0}function qp(e,t){return jp(e.prev,e,e.next)<0?jp(e,t,e.next)>=0&&jp(e,e.prev,t)>=0:jp(e,t,e.prev)<0||jp(e,e.next,t)<0}function Hp(e,t){const i=Xp(e.i,e.x,e.y),r=Xp(t.i,t.x,t.y),n=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function Zp(e,t,i,r){const n=Xp(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Wp(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Xp(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Qp(e,t){const i=e.length;if(i<=1)return[e];const r=[];let n,o;for(let t=0;t<i;t++){const i=_i(e[t]);0!==i&&(e[t].area=Math.abs(i),void 0===o&&(o=i<0),o===i<0?(n&&r.push(n),n=[e[t]]):n.push(e[t]))}if(n&&r.push(n),t>1)for(let e=0;e<r.length;e++)r[e].length<=t||(Dn(r[e],t,1,r[e].length-1,Yp),r[e]=r[e].slice(0,t));return r}function Yp(e,t){return t.area-e.area}function Jp(e,t,i){const r=i.patternDependencies;let n=!1;for(const i of t){const t=i.paint.get(`${e}-pattern`);t.isConstant()||(n=!0);const o=t.constantOr(null);o&&(n=!0,r[o]=!0)}return n}function Kp(e,t,i,r,n){const o=n.patternDependencies;for(const s of t){const t=s.paint.get(`${e}-pattern`).value;if("constant"!==t.kind){let e=t.evaluate({zoom:r},i,{},n.availableImages);e=e&&e.name?e.name:e,o[e]=!0,i.patterns[s.id]=e}}return i}class ed{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ol,this.indexArray=new Kl,this.indexArray2=new Wl,this.programConfigurations=new eu(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new Cc,this.segments2=new Cc,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.projection=e.projection}updateFootprints(e,t){}populate(e,t,i,r){this.hasPattern=Jp("fill",this.layers,t);const n=this.layers[0].layout.get("fill-sort-key"),o=[];for(const{feature:s,id:a,index:l,sourceLayerIndex:c}of e){const e=this.layers[0]._featureFilter.needGeometry,u=Qu(s,e);if(!this.layers[0]._featureFilter.filter(new Qa(this.zoom),u,i))continue;const h=n?n.evaluate(u,{},i,t.availableImages):void 0,p={id:a,properties:s.properties,type:s.type,sourceLayerIndex:c,index:l,geometry:e?u.geometry:Xu(s,i,r),patterns:{},sortKey:h};o.push(p)}n&&o.sort(((e,t)=>
vendor: 4,194 bytes, line 1
1e.sortKey-t.sortKey));for(const r of o){const{geometry:n,index:o,sourceLayerIndex:s}=r;if(this.hasPattern){const e=Kp("fill",this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,n,o,i,{},t.availableImages,t.brightness);t.featureIndex.insert(e[o].feature,n,o,s,this.index)}}update(e,t,i,r,n){const o=0!==Object.keys(e).length;o&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,t,o?this.stateDependentLayers:this.layers,i,r,n)}addFeatures(e,t,i,r,n,o){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,i,r,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Mp),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,i,r,n,o=[],s){for(const e of Qp(t,500)){let t=0;for(const i of e)t+=i.length;const i=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray),r=i.vertexLength,n=[],o=[];for(const t of e){if(0===t.length)continue;t!==e[0]&&o.push(n.length/2);const i=this.segments2.prepareSegment(t.length,this.layoutVertexArray,this.indexArray2),r=i.vertexLength;this.layoutVertexArray.emplaceBack(t[0].x,t[0].y),this.indexArray2.emplaceBack(r+t.length-1,r),n.push(t[0].x),n.push(t[0].y);for(let e=1;e<t.length;e++)this.layoutVertexArray.emplaceBack(t[e].x,t[e].y),this.indexArray2.emplaceBack(r+e-1,r+e),n.push(t[e].x),n.push(t[e].y);i.vertexLength+=t.length,i.primitiveLength+=t.length}const s=Ep(n,o);for(let e=0;e<s.length;e+=3)this.indexArray.emplaceBack(r+s[e],r+s[e+1],r+s[e+2]);i.vertexLength+=t,i.primitiveLength+=s.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,o,r,s)}}let td,id,rd,nd;Ma(ed,"FillBucket",{omit:["layers","patternFeatures"]});class od{constructor(e,t,i,r){if(this.triangleCount=t.length/3,this.min=new Ut(0,0),this.max=new Ut(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===e.length)return;const[n,o]=[e[0].clone(),e[0].clone()];for(let t=1;t<e.length;++t){const i=e[t];n.x=Math.min(n.x,i.x),n.y=Math.min(n.y,i.y),o.x=Math.max(o.x,i.x),o.y=Math.max(o.y,i.y)}if(r){const e=Math.ceil(Math.max(o.x-n.x,o.y-n.y)/r);i=Math.max(i,e)}if(0===i)return;this.min=n,this.max=o;const s=this.max.sub(this.min);s.x=Math.max(s.x,1),s.y=Math.max(s.y,1);const a=Math.max(s.x,s.y)/i;this.cellsX=Math.max(1,Math.ceil(s.x/a)),this.cellsY=Math.max(1,Math.ceil(s.y/a)),this.xScale=1/a,this.yScale=1/a;const l=[];for(let i=0;i<this.triangleCount;i++){const r=e[t[3*i+0]].sub(this.min),n=e[t[3*i+1]].sub(this.min),o=e[t[3*i+2]].sub(this.min),s=sd(Math.floor(Math.min(r.x,n.x,o.x)),this.xScale,this.cellsX),c=sd(Math.floor(Math.max(r.x,n.x,o.x)),this.xScale,this.cellsX),u=sd(Math.floor(Math.min(r.y,n.y,o.y)),this.yScale,this.cellsY),h=sd(Math.floor(Math.max(r.y,n.y,o.y)),this.yScale,this.cellsY),p=new Ut(0,0),d=new Ut(0,0),f=new Ut(0,0),m=new Ut(0,0);for(let e=u;e<=h;++e){p.y=d.y=e*a,f.y=m.y=(e+1)*a;for(let t=s;t<=c;++t)p.x=f.x=t*a,d.x=m.x=(t+1)*a,(dh(r,n,o,p,d,m)||dh(r,n,o,p,m,f))&&l.push({cellIdx:e*this.cellsX+t,triIdx:i})}}if(0===l.length)return;l.sort(((e,t)=>e.cellIdx-t.cellIdx||e.triIdx-t.triIdx));let c=0;for(;c<l.length;){const e=l[c].cellIdx,t={start:this.payload.length,len:0};for(;c<l.length&&l[c].cellIdx===e;)++t.len,this.payload.push(l[c++].triIdx);this.cells[e]=t}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,t){if(0===this.triangleCount||0===this.cells.length)return;if(e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const i=sd(e.x-this.min.x,this.xScale,this.cellsX),r=sd(e.y-this.min.y,this.yScale,this.cellsY),n=this.cells[r*this.cellsX+i
1];if(n){this._lazyInitLookup();for(let e=0;e<n.len;e++){const i=this.payload[n.start+e],r=Math.floor(i/8),o=1<<i%8;if(!(this.lookup[r]&o)&&(this.lookup[r]|=o,t.push(i),t.length===this.triangleCount))return}}}query(e,t,i){if(0===this.triangleCount||0===this.cells.length)return;if(e.x>this.max.x||this.min.x>t.x)return;if(e.y>this.max.y||this.min.y>t.y)return;this._lazyInitLookup();const r=sd(e.x-this.min.x,this.xScale,this.cellsX),n=sd(t.x-this.min.x,this.xScale,this.cellsX),o=sd(e.y-this.min.y,this.yScale,this.cellsY),s=sd(t.y-this.min.y,this.yScale,this.cellsY);for(let e=o;e<=s;e++)for(let t=r;t<=n;t++){const r=this.cells[e*this.cellsX+t];if(r)for(let e=0;e<r.len;e++){const t=this.payload[r.start+e],n=Math.floor(t/8),o=1<<t%8;if(!(this.lookup[n]&o)&&(this.lookup[n]|=o,i.push(t),i.length===this.triangleCount))return}}}}function sd(e,t,i){return Math.max(0,Math.min(i-1,Math.floor(e*t)))}Ma(od,"TriangleGridIndex");class ad{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.footprints=[]}updateFootprints(e,t){for(const i of this.footprints)t.push({footprint:i,id:e})}populate(e,t,i,r){const n=[];for(const{feature:t,id:o,index:s,sourceLayerIndex:a}of e){const e=this.layers[0]._featureFilter.needGeometry,l=Qu(t,e);if(!this.layers[0]._featureFilter.filter(new Qa(this.zoom),l,i))continue;const c={id:o,properties:t.properties,type:t.type,sourceLayerIndex:a,index:s,geometry:e?l.geometry:Xu(t,i,r),patterns:{}};n.push(c)}for(const r of n){const{geometry:n,index:o,sourceLayerIndex:s}=r;this.addFeature(r,n,o,i,{},t.availableImages,t.brightness),t.featureIndex.insert(e[o].feature,n,o,s,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(e){}update(e,t,i,r,n){}destroy(){}addFeature(e,t,i,r,n,o=[],s){for(const e of Qp(t,2)){const t=[],i=[],r=[],n=new Ut(1/0,1/0),o=new Ut(-1/0,-1/0);for(const s of e)if(0!==s.length){s!==e[0]&&r.push(i.length/2);for(let e=0;e<s.length;e++)i.push(s[e].x),i.push(s[e].y),t.push(s[e]),n.x=Math.min(n.x,s[e].x),n.y=Math.min(n.y,s[e].y),o.x=Math.max(o.x,s[e].x),o.y=Math.max(o.y,s[e].y)}const s=Ep(i,r),a=new od(t,s,8,256);this.footprints.push({vertices:t,indices:s,grid:a,min:n,max:o})}}}Ma(ad,"ClipBucket",{omit:["layers"]});const ld=Rl([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),cd=Rl([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),ud=Rl([{name:"a_centroid_pos",components:2,type:"Uint16"}]),hd=Rl([{name:"a_join_normal_inside_polygon",components:4,type:"Int16"}]),pd=Rl([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),dd=Rl([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:fd}=ld;var md={},_d=Nt,gd=yd;function yd(e,t,i,r,n){this.properties={},this.extent=i,this.type=0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=n,e.readFields(vd,this,t)}function vd(e,t,i){1==e?t.id=i.readVarint():2==e?function(e,t){for(var i=e.readVarint()+e.pos;e.pos<i;){var r=t._keys[e.readVarint()],n=t._values[e.readVarint()];t.properties[r]=n}}(i,t):3==e?t.type=i.readVarint():4==e&&(t._geometry=i.pos)}function xd(e){for(var t,i,r=0,n=0,o=e.length,s=o-1;n<o;s=n++)r+=((i=e[s]).x-(t=e[n]).x)*(t.y+i.y);return r}yd.types=["Unknown","Point","LineString","Polygon"],yd.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t,i=e.readVarint()+e.pos,r=1,n=0,o=0,s=0,a=[];e.pos<i;){if(n<=0){var l=e.readVarint();r=7&l,n=l>>3}if(n--,1===r||2===r)o+=e.readSVarint(),s+=e.readSVarint(),1===r&&(t&&a.push(t),t=[]),t.push(new _d(o,s));else{if(7!==r)throw new Error("unknown command "+r);t&&t.push(t[0].clone())}}return t&&a.push(t),a},yd.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,i=1,r=0,n=0,o=0,s=1/0,a=-1/0,l=1/0,c=-1/0;e.pos<t;){if(r<=0){var u=e.readVarint();i=7&u,r=u>>3}if(r--,1===i||2===i)(n+=e.readSVarint())<s&&(s=n),n>a&&(a=n),(o+=e.readSVarint())<l&&(l=o),o>c&&(c=o);else if(7!==i)throw new Error("unknown command "+i)}return[s,l,a,c]},yd.prototype.toGeoJSON=function(e,t,i){var r,n,o=this.extent*Math.pow(2,i),s=this.extent*e,a=this.extent*t,l=this.loadGeometry(),c=yd.types[this.type];function u(e){for(var t=0;t<e.length;t++){var i=e[t];e[t]=[360*(i.x+s)/o-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+a)/o)*Math.PI/180)
vendor: 16,049 bytes, line 1
1)-90]}}switch(this.type){case 1:var h=[];for(r=0;r<l.length;r++)h[r]=l[r][0];u(l=h);break;case 2:for(r=0;r<l.length;r++)u(l[r]);break;case 3:for(l=function(e){var t=e.length;if(t<=1)return[e];for(var i,r,n=[],o=0;o<t;o++){var s=xd(e[o]);0!==s&&(void 0===r&&(r=s<0),r===s<0?(i&&n.push(i),i=[e[o]]):i.push(e[o]))}return i&&n.push(i),n}(l),r=0;r<l.length;r++)for(n=0;n<l[r].length;n++)u(l[r][n])}1===l.length?l=l[0]:c="Multi"+c;var p={type:"Feature",geometry:{type:c,coordinates:l},properties:this.properties};return"id"in this&&(p.id=this.id),p};var bd=gd,wd=Td;function Td(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Md,this,t),this.length=this._features.length}function Md(e,t,i){15===e?t.version=i.readVarint():1===e?t.name=i.readString():5===e?t.extent=i.readVarint():2===e?t._features.push(i.pos):3===e?t._keys.push(i.readString()):4===e&&t._values.push(function(e){for(var t=null,i=e.readVarint()+e.pos;e.pos<i;){var r=e.readVarint()>>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}return t}(i))}Td.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new bd(this._pbf,t,this.extent,this._keys,this._values)};var Ed=wd;function Sd(e,t,i){if(3===e){var r=new Ed(i,i.readVarint()+i.pos);r.length&&(t[r.name]=r)}}var Cd=md.VectorTile=function(e,t){this.layers=e.readFields(Sd,{},t)},Ad=md.VectorTileFeature=gd;md.VectorTileLayer=wd;class Id extends Ut{constructor(e,t,i){super(e,t),this.z=i}}class kd extends Id{constructor(e,t,i,r){super(e,t,i),this.w=r}}function Ld(e,t,i,r){const n=[],o=0===r?(e,t,i,r,n,o)=>{e.push(new Ut(o,i+(o-t)/(r-t)*(n-i)))}:(e,t,i,r,n,o)=>{e.push(new Ut(t+(o-i)/(n-i)*(r-t),o))};for(const s of e){const e=[];for(const n of s){if(n.length<=2)continue;const s=[];for(let e=0;e<n.length-1;e++){const a=n[e].x,l=n[e].y,c=n[e+1].x,u=n[e+1].y,h=0===r?a:l,p=0===r?c:u;h<t?p>t&&o(s,a,l,c,u,t):h>i?p<i&&o(s,a,l,c,u,i):s.push(n[e]),p<t&&h>=t&&o(s,a,l,c,u,t),p>i&&h<=i&&o(s,a,l,c,u,i)}let a=n[n.length-1];const l=0===r?a.x:a.y;l>=t&&l<=i&&s.push(a),s.length&&(a=s[s.length-1],s[0].x===a.x&&s[0].y===a.y||s.push(s[0]),e.push(s))}e.length&&n.push(e)}return n}function Pd(e,t,i,r){const n="x"===i?"y":"x",o=(r-e[i])/(t[i]-e[i]);e[n]=e[n]+(t[n]-e[n])*o,e[i]=r,e.hasOwnProperty("z")&&(e.z=qr(e.z,t.z,o)),e.hasOwnProperty("w")&&(e.w=qr(e.w,t.w,o))}function Rd(e,t,i,r){const n=i,o=r;for(const i of["x","y"]){let r=e,s=t;r[i]>=s[i]&&(r=t,s=e),r[i]<n&&s[i]>n&&Pd(r,s,i,n),r[i]<o&&s[i]>o&&Pd(s,r,i,o)}}const zd=Number.MAX_SAFE_INTEGER;function Od(e,t,i,r){return e.order<t||e.order===zd||!(e.clipMask&i)||function(e,t){return 0!==t.length&&void 0===t.find((t=>t===e))}(r,e.clipScope)}function Dd(e,t){return e.x-t.x||e.y-t.y}function Fd(e,t){return 0===Dd(e.min,t.min)&&0===Dd(e.max,t.max)}function Bd(e,t){return!(e.min.x>t.max.x||e.max.x<t.min.x||e.min.y>t.max.y||e.max.y<t.min.y)}function Nd(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i].sourceId!==t[i].sourceId||!Fd(e[i],t[i])||e[i].order!==t[i].order||e[i].clipMask!==t[i].clipMask||!Vt(e[i].clipScope,t[i].clipScope))return!1;return!0}function jd(e,t,i){const r=1/fo,n=1/(1<<i.canonical.z),o=(t.x*r+i.canonical.x)*n+i.wrap,s=(t.y*r+i.canonical.y)*n;return{min:new Ut((e.x*r+i.canonical.x)*n+i.wrap,(e.y*r+i.canonical.y)*n),max:new Ut(o,s)}}function Ud(e,t,i){const r=1<<i.canonical.z,n=((t.x-i.wrap)*r-i.canonical.x)*fo,o=(t.y*r-i.canonical.y)*fo;return{min:new Ut(((e.x-i.wrap)*r-i.canonical.x)*fo,(e.y*r-i.canonical.y)*fo),max:new Ut(n,o)}}function Vd(e,t,i,r,n,o,s){const a=e.indices,l=e.vertices,c=[];for(let u=r;u<r+n;u+=3){const r=t[i[u+0]+o],n=t[i[u+1]+o],h=t[i[u+2]+o],p=Math.min(r.x,n.x,h.x),d=Math.max(r.x,n.x,h.x),f=Math.min(r.y,n.y,h.y),m=Math.max(r.y,n.y,h.y);c.length=0,e.grid.query(new Ut(p,f),new Ut(d,m),c);for(let e=0;e<c.length;e++){const t=c[e];if(dh(l[a[3*t+0]],l[a[3*t+1]],l[a[3*t+2]],r,n,h,s))return!0}}return!1}function $d(e,t,i,r){if(!e||!i)return!1;let n=e.vertices;if(!t.canonical.equals(r.canonical)||t.wrap!==r.wrap){if(i.vertices.length<e.vertices.length)return $d(i,r,e,t);const o=t.canonical,s=r.canonical,a=Math.pow(2,s.z-o.z);n=e.vertices.map((e=>new Ut((e.x+o.x*fo)*a-s.x*fo,(e.y+o.y*fo)*a-s.y*fo)))}return Vd(i,n,e.indices,0,e.indices.length,0,0)}function Gd(e,t,i,r){const n=Math.pow(2,r.z-i.z);return new Ut((e+i.x*fo)*n-r.x*fo,(t+i.y*fo)*n-r.y*fo)}function qd(e,t){const i=[];t.footprint.grid.queryPoint(e,i);const r=t.footprint.indices,n=t.footprint.vertices;for(let t=0;t<i.length;t++){const o=i[t];if(ch([n[r[3*o+0]],n[r[3*o+1]],n[r[3*o+2]]],e))return!0}return!1}class Hd{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,t){const i=this.toIdx(e,t);return{min:this.minimums[i],max:this.maximums[i]}}isLeaf(e,t){return this.leaves[this.toIdx(e,t)]}toIdx(e,t){return t*this.size+e}}function Zd(e,t,i,r){let n=0,o=Number.MAX_VALUE;for(let s=0;s<3;s++)if(Math.abs(r[s])<1e-15){if(i[s]<e[s]||i[s]>t[s])return null}else{const a=1/r[s];let l=(e[s]-i[s])*a,c=(t[s]-i[s])*a;if(l>c){const e=l;l=c,c=e}if(l>n&&(n=l),c<o&&(o=c),n>o)return null}return n}function Wd(e,t,i,r,n,o,s,a,l,c,u){const h=r-e,p=n-t,d=o-i,f=s-e,m=a-t,_=l-i,g=u[1]*_-u[2]*m,y=u[2]*f-u[0]*_,v=u[0]*m-u[1]*f,x=h*g+p*y+d*v;if(Math.abs(x)<1e-15)return null;const b=1/x,w=c[0]-e,T=c[1]-t,M=c[2]-i,E=(w*g+T*y+M*v)*b;if(E<0||E>1)return null;const S=T*d-M*p,C=M*h-w*d,A=w*p-T*h,I=(u[0]*S+u[1]*C+u[2]*A)*b;return I<0||E+I>1?null:(f*S+m*C+_*A)*b}function Xd(e,t,i){return(e-t)/(i-t)}function Qd(e,t,i,r,n,o,s,a,l){const c=1<<i,u=o-r,h=s-n,p=(e+1)/c*u+r,d=(t+0)/c*h+n,f=(t+1)/c*h+n;a[0]=(e+0)/c*u+r,a[1]=d,l[0]=p,l[1]=f}class Yd{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const t=function(e){const t=Math.ceil(Math.log2(e.dim/8)),i=[];let r=Math.ceil(Math.pow(2,t));const n=1/r,o=(e,t,i,r,n)=>{const o=r?1:0,s=(e+1)*i-o,a=t*i,l=(t+1)*i-o;n[0]=e*i,n[1]=a,n[2]=s,n[3]=l};let s=new Hd(r);const a=[];for(let t=0;t<r*r;t++){o(t%r,Math.floor(t/r),n,!1,a);const i=Kd(a[0],a[1],e),l=Kd(a[2],a[1],e),c=Kd(a[2],a[3],e),u=Kd(a[0],a[3],e);s.minimums.push(Math.min(i,l,c,u)),s.maximums.push(Math.max(i,l,c,u)),s.leaves.push(1)}for(i.push(s),r/=2;r>=1;r/=2){const e=i[i.length-1];s=new Hd(r);for(let t=0;t<r*r;t++){o(t%r,Math.floor(t/r),2,!0,a);const i=e.getElevation(a[0],a[1]),n=e.getElevation(a[2],a[1]),l=e.getElevation(a[2],a[3]),c=e.getElevation(a[0],a[3]),u=e.isLeaf(a[0],a[1]),h=e.isLeaf(a[2],a[1]),p=e.isLeaf(a[2],a[3]),d=e.isLeaf(a[0],a[3]),f=Math.min(i.min,n.min,l.min,c.min),m=Math.max(i.max,n.max,l.max,c.max),_=u&&h&&p&&d;s.maximums.push(m),s.minimums.push(f),s.leaves.push(m-f<=5&&_?1:0)}i.push(s)}return i}(this.dem),i=t.length-1,r=t[i];this._addNode(r.minimums[0],r.maximums[0],r.leaves[0]),this._construct(t,0,0,i,0)}raycastRoot(e,t,i,r,n,o,s=1){return Zd([e,t,-100],[i,r,this.maximums[0]*s],n,o)}raycast(t,i,r,n,o,s,a=1){if(!this.nodeCount)return null;const l=this.raycastRoot(t,i,r,n,o,s,a);if(null==l)return null;const c=[],u=[],h=[],p=[],d=[{idx:0,t:l,nodex:0,nodey:0,depth:0}];for(;d.length>0;){const{idx:l,t:f,nodex:m,nodey:_,depth:g}=d.pop();if(this.leaves[l]){Qd(m,_,g,t,i,r,n,h,p);const l=1<<g,c=(m+0)/l,u=(m+1)/l,d=(_+0)/l,y=(_+1)/l,v=Kd(c,d,this.dem)*a,x=Kd(u,d,this.dem)*a,b=Kd(u,y,this.dem)*a,w=Kd(c,y,this.dem)*a,T=Wd(h[0],h[1],v,p[0],h[1],x,p[0],p[1],b,o,s),M=Wd(p[0],p[1],b,h[0],p[1],w,h[0],h[1],v,o,s),E=Math.min(null!==T?T:Number.MAX_VALUE,null!==M?M:Number.MAX_VALUE);if(E!==Number.MAX_VALUE)return E;{const t=e.$.scaleAndAdd([],o,s,f);if(Jd(v,x,w,b,Xd(t[0],h[0],p[0]),Xd(t[1],h[1],p[1]))>=t[2])return f}continue}let y=0;for(let e=0;e<this._siblingOffset.length;e++){Qd((m<<1)+this._siblingOffset[e][0],(_<<1)+this._siblingOffset[e][1],g+1,t,i,r,n,h,p),h[2]=-100,p[2]=this.maximums[this.childOffsets[l]+e]*a;const d=Zd(h,p,o,s);if(null!=d){const t=d;c[e]=t;let i=!1;for(let r=0;r<y&&!i;r++)t>=c[u[r]]&&(u.splice(r,0,e),i=!0);i||(u[y]=e),y++}}for(let e=0;e<y;e++){const t=u[e];d.push({idx:this.childOffsets[l]+t,t:c[t],nodex:(m<<1)+this._siblingOffset[t][0],nodey:(_<<1)+this._siblingOffset[t][1],depth:g+1})}}return null}_addNode(e,t,i){return this.minimums.push(e),this.maximums.push(t),this.leaves.push(i),this.childOffsets.push(0),this.nodeCount++}_construct(e,t,i,r,n){if(1===e[r].isLeaf(t,i))return;this.childOffsets[n]||(this.childOffsets[n]=this.nodeCount);const o=r-1,s=e[o];let a=0,l=0;for(let e=0;e<this._siblingOffset.length;e++){const r=2*t+this._siblingOffset[e][0],n=2*i+this._siblingOffset[e][1],o=s.getElevation(r,n),c=s.isLeaf(r,n),u=this._addNode(o.min,o.max,c);c&&(a|=1<<e),l||(l=u)}for(let r=0;r<this._siblingOffset.length;r++)a&1<<r||this._construct(e,2*t+this._siblingOffset[r][0],2*i+this._siblingOffset[r][1],o,l+r)}}function Jd(e,t,i,r,n,o){return qr(qr(e,i,o),qr(t,r,o),n)}function Kd(e,t,i){const r=i.dim,n=Yt(e*r-.5,0,r-1),o=Yt(t*r-.5,0,r-1),s=Math.floor(n),a=Math.floor(o),l=Math.min(s+1,r-1),c=Math.min(a+1,r-1);return Jd(i.get(s,a),i.get(l,a),i.get(s,c),i.get(l,c),n-s,o-a)}const ef={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function tf(e,t,i){return(256*e*256+256*t+i)/10-1e4}function rf(e,t,i){return 256*e+t+i/256-32768}class nf{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,t,i,r=!1){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(i&&"mapbox"!==i&&"terrarium"!==i)return fi(`"${i}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=t.height;const n=this.dim=t.height-2,o=new Uint32Array(t.data.buffer);if(this.pixels=new Uint8Array(t.data.buffer),this.floatView=new Float32Array(t.data.buffer),this.borderReady=r,this._modifiedForSources={},!r){for(let e=0;e<n;e++)o[this._idx(-1,e)]=o[this._idx(0,e)],o[this._idx(n,e)]=o[this._idx(n-1,e)],o[this._idx(e,-1)]=o[this._idx(e,0)],o[this._idx(e,n)]=o[this._idx(e,n-1)];o[this._idx(-1,-1)]=o[this._idx(0,0)],o[this._idx(n,-1)]=o[this._idx(n-1,0)],o[this._idx(-1,n)]=o[this._idx(0,n-1)],o[this._idx(n,n)]=o[this._idx(n-1,n-1)]}const s="terrarium"===i?rf:tf;for(let e=0;e<o.length;++e){const t=4*e;this.floatView[e]=s(this.pixels[t],this.pixels[t+1],this.pixels[t+2])}this._timestamp=zi.now()}_buildQuadTree(){this._tree=new Yd(this)}get(e,t,i=!1){i&&(e=Yt(e,-1,this.dim),t=Yt(t,-1,this.dim));const r=this._idx(e,t);return this.floatView[r]}set(e,t,i){const r=this._idx(e,t),n=this.floatView[r];return this.floatView[r]=i,i-n}static getUnpackVector(e){return ef[e]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}static pack(e,t){const i=[0,0,0,0],r=nf.getUnpackVector(t);let n=Math.floor((e+r[3])/r[2]);return i[2]=n%256,n=Math.floor(n/256),i[1]=n%256,n=Math.floor(n/256),i[0]=n,i}getPixels(){return new gp({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let r=t*this.dim,n=t*this.dim+this.dim,o=i*this.dim,s=i*this.dim+this.dim;switch(t){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:o=s-1;break;case 1:s=o+1}const a=-t*this.dim,l=-i*this.dim;for(let t=o;t<s;t++)for(let i=r;i<n;i++){const r=4*this._idx(i,t),n=4*this._idx(i+a,t+l);this.pixels[r+0]=e.pixels[n+0],this.pixels[r+1]=e.pixels[n+1],this.pixels[r+2]=e.pixels[n+2],this.pixels[r+3]=e.pixels[n+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}Ma(nf,"DEMData"),Ma(Yd,"DemMinMaxQuadTree",{omit:["dem"]});class of{constructor(e,t,i){this._demTile=e,this._dem=this._demTile.dem,this._scale=t,this._offset=i}static create(e,t,i){const r=i||e.findDEMTileFor(t);if(!r||!r.dem)return;const n=r.dem,o=r.tileID,s=1<<t.canonical.z-o.canonical.z;return new of(r,n.dim/fo/s,[(t.canonical.x/s-o.canonical.x)*n.dim,(t.canonical.y/s-o.canonical.y)*n.dim])}tileCoordToPixel(e,t){const i=t*this._scale+this._offset[1],r=Math.floor(e*this._scale+this._offset[0]),n=Math.floor(i);return new Ut(r,n)}getElevationAt(e,t,i,r){const n=e*this._scale+this._offset[0],o=t*this._scale+this._offset[1],s=Math.floor(n),a=Math.floor(o),l=this._dem;return r=!!r,i?qr(qr(l.get(s,a,r),l.get(s,a+1,r),o-a),qr(l.get(s+1,a,r),l.get(s+1,a+1,r),o-a),n-s):l.get(s,a,r)}getElevationAtPixel(e,t,i){return this._dem.get(e,t,!!i)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*Pu(1,e)*this._dem.stride}}const sf={None:0,Model:1,Symbol:2,FillExtrusion:4,All:7},af=Ad.types,lf=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-line-alignment"],cf=["fill-extrusion-flood-light-ground-radius"],uf=Math.pow(2,13),hf=Math.pow(2,15)-1,pf=new Ut(0,1),df=2147483648;function ff(e,t,i,r,n,o,s,a){e.emplaceBack((t<<1)+s,(i<<1)+o,(Math.floor(r*uf)<<1)+n,Math.round(a))}function mf(e,t,i,r){e.emplaceBack(t.x*fo,t.y*fo,i?0:1,r?1:0)}function _f(e,t,i,r,n,o){e.emplaceBack(t.x,t.y,(i.x<<1)+r,(i.y<<1)+n,o)}function gf(e,t,i){const r=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*r,i[1]*r,i[2]*r)}class yf{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class vf{constructor(){this.centroidXY=new Ut(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new Ut(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Ut(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new Ut(this.max.x-this.min.x,this.max.y-this.min.y)}}class xf{constructor(){this.acc=new Ut(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,t){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=t.x,e.min.y=e.max.y=t.y)}appendEdge(e,t,i){this.accCount++,this.acc._add(t);let r=!!this.borders;t.x<e.min.x?(e.min.x=t.x,r=!0):t.x>e.max.x&&(e.max.x=t.x,r=!0),t.y<e.min.y?(e.min.y=t.y,r=!0):t.y>e.max.y&&(e.max.y=t.y,r=!0),((0===t.x||t.x===fo)&&t.x===i.x)!=((0===t.y||t.y===fo)&&t.y===i.y)&&this.processBorderOverlap(t,i),r&&this.checkBorderIntersection(t,i)}checkBorderIntersection(e,t){t.x<0!=e.x<0&&this.addBorderIntersection(0,qr(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>fo!=e.x>fo&&this.addBorderIntersection(1,qr(t.y,e.y,(fo-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,qr(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>fo!=e.y>fo&&this.addBorderIntersection(3,qr(t.x,e.x,(fo-t.y)/(e.y-t.y)))}addBorderIntersection(e,t){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const i=this.borders[e];t<i[0]&&(i[0]=t),t>i[1]&&(i[1]=t)}processBorderOverlap(e,t){if(e.x===t.x){if(e.y===t.y)return;const i=0===e.x?0:1;this.addBorderIntersection(i,t.y),this.addBorderIntersection(i,e.y)}else{const i=0===e.y?2:3;this.addBorderIntersection(i,t.x),this.addBorderIntersection(i,e.x)}}centroid(){return 0===this.accCount?new Ut(0,0):new Ut(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce(((e,t)=>e+ +(t[0]!==Number.MAX_VALUE)),0):0}}function bf(e,t){const i=e.add(t)._unit(),r=Yt(e.x*i.x+e.y*i.y,-1,1);var n,o,s;return n=Math.acos(r),Math.min(4,Math.max(-4,Math.tan(n)))/4*hf*((o=e).x*(s=t).y-o.y*s.x<0?-1:1)}const wf=[e=>e.x<0,e=>e.x>fo,e=>e.y<0,e=>e.y>fo];function Tf(e,t,i,r){const n=[4];if(0===r)return n;i._mult(r);const o=e.sub(i),s=t.sub(i),a=[e,t,o,s];for(let e=0;e<4;e++)for(const t of a)if(wf[e](t)){n.push(e);break}return n}class Mf{constructor(e){this.vertexArray=new Bl,this.indexArray=new Kl,this.programConfigurations=new eu(e.layers,{zoom:e.zoom,lut:e.lut},(e=>
vendor: 15,784 bytes, line 1
1cf.includes(e))),this._segments=new Cc,this.hiddenByLandmarkVertexArray=new hc,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Cc}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(e,t,i,r=!1){const n=e.length;if(n>2){let o=Math.max(0,this._segments.get().length-1);const s=this._segments._prepareSegment(4*n,this.vertexArray.length,2*this._segmentToGroundQuads[o].length);let a;o!==this._segments.get().length-1&&(o++,this._segmentToGroundQuads[o]=[],this._segmentToRegionTriCounts[o]=[0,0,0,0,0]);{const t=e[0],i=e[1];a=bf(t.sub(e[n-1])._perp()._unit(),i.sub(t)._perp()._unit())}for(let l=0;l<n;l++){const c=l===n-1?0:l+1,u=e[l],h=e[c],p=e[c===n-1?0:c+1],d=h.sub(u)._perp()._unit(),f=bf(d,p.sub(h)._perp()._unit()),m=a,_=f;if(If(u,h,t)||r&&kf(u,t)&&kf(h,t)){a=f;continue}const g=s.vertexLength;_f(this.vertexArray,u,h,1,1,m),_f(this.vertexArray,u,h,1,0,m),_f(this.vertexArray,u,h,0,1,_),_f(this.vertexArray,u,h,0,0,_),s.vertexLength+=4;const y=Tf(u,h,d,i);for(const e of y)this._segmentToGroundQuads[o].push({id:g,region:e}),this._segmentToRegionTriCounts[o][e]+=2,s.primitiveLength+=2;a=f}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),t=e.length;for(let e=0;e<t;e++)this._segmentToGroundQuads[e].sort(((e,t)=>e.region-t.region));for(let i=0;i<t;i++){const t=this._segmentToGroundQuads[i],r=e[i],n=this._segmentToRegionTriCounts[i];n.reduce(((e,t)=>e+t),0);let o=0;for(let e=0;e<=4;e++){const t=n[e];if(0!==t){let i=this.regionSegments[e];i||(i=this.regionSegments[e]=new Cc);const n={vertexOffset:r.vertexOffset,primitiveOffset:r.primitiveOffset+o,vertexLength:r.vertexLength,primitiveLength:t};i.get().push(n)}o+=t}for(let e=0;e<t.length;e++){const i=t[e].id;this.indexArray.emplaceBack(i,i+1,i+3),this.indexArray.emplaceBack(i,i+3,i+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,t,i,r,n,o){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,t,i,r,n,o)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,cd.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,t,i,r,n,o){this.hasData()&&this.programConfigurations.updatePaintArrays(e,t,i,r,n,o)}updateHiddenByLandmark(e){if(!this.hasData())return;const t=e.groundVertexCount+e.groundVertexArrayOffset;if(0===e.groundVertexCount)return;const i=e.flags&df?1:0;for(let r=e.groundVertexArrayOffset;r<t;++r)this.hiddenByLandmarkVertexArray.emplace(r,i);this._needsHiddenByLandmarkUpdate=!0}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,pd.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const t=this.regionSegments[e];t&&t.destroy()}}}}class Ef{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Kl,this.footprintVertices=new Ol,this.footprintSegments=[],this.layoutVertexArray=new Fl,this.centroidVertexArray=new wc,this.wallVertexArray=new Mc,this.indexArray=new Kl,this.programConfigurations=new eu(e.layers,{zoom:e.zoom,lut:e.lut},(e=>lf.includes(e))),this.segments=new Cc,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.groundEffect=new Mf(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[]}updateFootprints(e,t){}populate(e,t,i,r){this.features=[],this.hasPattern=Jp("fill-extrusion",this.layers,t),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=ju(i),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=0!==this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1);for(const{feature:n,id:o,index:s,sourceLayerIndex:a}of e){const e=this.layers[0]._featureFilter.needGeometry,l=Qu(n,e);if(!this.layers[0]._featureFilter.filter(new Qa(this.zoom),l,i))continue;const c={id:o,sourceLayerIndex:a,index:s,geometry:e?l.geometry:Xu(n,i,r),properties:n.properties,type:n.type,patterns:{}},u=this.layoutVertexArray.length;if(this.hasPattern)this.features.push(Kp("fill-extrusion",this.layers,c,this.zoom,t));else if(this.wallMode)for(const e of c.geometry)this.addFeature(c,[e],s,i,{},t.availableImages,r,t.brightness);else this.addFeature(c,c.geometry,s,i,{},t.availableImages,r,t.brightness);t.featureIndex.insert(n,c.geometry,s,a,this.index,u)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,t,i,r,n,o){for(const e of this.features){const{geometry:s}=e;if(this.wallMode)for(const a of s)this.addFeature(e,[a],e.index,t,i,r,n,o);else this.addFeature(e,s,e.index,t,i,r,n,o)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(e,t,i,r,n){const o=0!==Object.keys(e).length;if(o&&!this.stateDependentLayers.length)return;const s=o?this.stateDependentLayers:this.layers;this.programConfigurations.updatePaintArrays(e,t,s,i,r,n),this.groundEffect.update(e,t,s,i,r,n)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,fd),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,hd.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,dd.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,ud.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,i,r,n,o,s,a){const l=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,c=[new Ut(0,0),new Ut(fo,fo)],u=s.projection,h="globe"===u.name,p=this.wallMode||"Polygon"===af[e.type],d=new xf;d.centroidDataIndex=this.centroidData.length;const f=new vf,m=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},r)<=0,_=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},r);let g;if(f.height=_,f.vertexArrayOffset=this.layoutVertexArray.length,f.groundVertexArrayOffset=this.groundEffect.vertexArray.length,h&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Gl),this.wallMode){if(h)return void fi("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==t.length)return;g=function(e){const t=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y,i=function(e){let t=0;const i=e.length;for(let r=0;r<i;r++)t+=(e[(r+1)%i].x-e[r].x)*(e[(r+1)%i].y+e[r].y);return t>=0}(e);i||(e=e.reverse());const r={isPolygon:t,geometry:[],joinNormals:[]},n=[],o=[],s=[];let a=e.length;if(a<(t?3:2))return r;for(;a>=2&&e[a-1].equals(e[a-2]);)a--;let l,c,u,h,p,d=0;for(;d<a-1&&e[d].equals(e[d+1]);)d++;t&&(l=e[a-2],p=e[d].sub(l)._unit()._perp());for(let i=d;i<a;i++){if(u=i===a-1?t?e[d+1]:void 0:e[i+1],u&&e[i].equals(u))continue;p&&(h=p),l&&(c=l),l=e[i],p=u?u.sub(l)._unit()._perp():h,h=h||p;const r=h.add(p);0===r.x&&0===r.y||r._unit();const f=r.x*p.x+r.y*p.y,m=0!==f?1/f:1/0,_=h.x*p.y-h.y*p.x>0;let g="miter";"miter"===g&&m>2&&(g="bevel");const y=(e,t,i,r)=>{const a=new Ut(e.x,e.y),l=new Ut(e.x,e.y);a.x-=t.x*r,a.y-=t.y*r,l.x-=t.x*Math.max(i,1),l.y-=t.y*Math.max(i,1),s.push(t),n.push(a),o.push(l)};if("miter"===g)r._mult(m),y(l,r,1,0);else{const e=-Math.sqrt(m*m-1),t=_?e:0,i=_?0:e;c&&y(l,h,t,i),u&&y(l,p,t,i)}}return r.geometry=[...n,...o.reverse(),n[0]],r.joinNormals=[...s,...s.reverse(),s[s.length-1]],r}(t[0]),t=[g.geometry]}const y=(e,t)=>e<(t.length-1)/2||e===t.length-1,v=this.wallMode?[t]:Qp(t,500);for(let e=v.length-1;e>=0;e--){const t=v[e];(0===t.length||(x=t[0]).every((e=>e.x<=0))||x.every((e=>e.x>=fo))||x.every((e=>e.y<=0))||x.every((e=>e.y>=fo)))&&v.splice(e,1)}var x;let b;if(h)b=zf(v,c,r);else{b=[];for(const e of v)b.push({polygon:e,bounds:c})}const w=p?this.edgeRadius:0,T=w>0&&this.zoom<17,M=(e,t)=>{if(0===e.length)return!1;const i=e[e.length-1];return t.x===i.x&&t.y===i.y};for(const{polygon:e,bounds:t}of b){let i=0,n=0;for(const t of e)p&&!t[0].equals(t[t.length-1])&&t.push(t[0]),n+=p?t.length-1:t.length;const o=this.segments.prepareSegment((p?5:4)*n,this.layoutVertexArray,this.indexArray);f.footprintSegIdx<0&&(f.footprintSegIdx=this.footprintSegments.length),f.polygonSegIdx<0&&(f.polygonSegIdx=this.polygonSegments.length);const s={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},a=new yf;if(a.vertexOffset=this.footprintVertices.length,a.indexOffset=3*this.footprintIndices.length,a.ringIndices=[],p){const n=[],s=[];i=o.vertexLength;for(let i=0;i<e.length;i++){const c=e[i];c.length&&0!==i&&s.push(n.length/2);const p=[];let d,f;d=c[1].sub(c[0])._perp()._unit(),a.ringIndices.push(c.length-1);for(let e=1;e<c.length;e++){const t=c[e],i=c[e===c.length-1?1:e+1],s=t.clone();if(w){f=i.sub(t)._perp()._unit();const e=d.add(f)._unit(),r=w*Math.min(4,1/(d.x*e.x+d.y*e.y));s.x+=r*e.x,s.y+=r*e.y,s.x=Math.round(s.x),s.y=Math.round(s.y),d=f}if(!m||0!==w&&!T||M(p,s)||p.push(s),ff(this.layoutVertexArray,s.x,s.y,0,0,1,1,0),this.wallMode){const t=y(e,c);mf(this.wallVertexArray,g.joinNormals[e],t,g.isPolygon)}o.vertexLength++,this.footprintVertices.emplaceBack(t.x,t.y),n.push(t.x,t.y),h&&gf(this.layoutVertexExtArray,u.projectTilePoint(s.x,s.y,r),u.upVector(r,s.x,s.y))}m&&(0===w||T)&&(0!==p.length&&M(p,p[0])&&p.pop(),this.groundEffect.addData(p,t,l))}const c=Ep(n,s);for(let e=0;e<c.length;e+=3)this.footprintIndices.emplaceBack(a.vertexOffset+c[e+0],a.vertexOffset+c[e+1],a.vertexOffset+c[e+2]),this.indexArray.emplaceBack(i+c[e],i+c[e+2],i+c[e+1]),o.primitiveLength++;a.indexCount+=c.length,a.vertexCount+=this.footprintVertices.length-a.vertexOffset}for(let n=0;n<e.length;n++){const s=e[n];d.startRing(f,s[0]);let a=s.length>4&&Lf(s[s.length-2],s[0],s[1]),c=w?Cf(s[s.length-2],s[0],s[1],w):0;const _=[];let v,x,b;x=s[1].sub(s[0])._perp()._unit();let T=!0;for(let e=1,n=0;e<s.length;e++){let l=s[e-1],p=s[e];const E=s[e===s.length-1?1:e+1];if(d.appendEdge(f,p,l),If(p,l,t)){w&&(x=E.sub(p)._perp()._unit(),T=!T);continue}const S=p.sub(l)._perp(),C=S.x/(Math.abs(S.x)+Math.abs(S.y)),A=S.y>0?1:0,I=l.dist(p);if(n+I>32768&&(n=0),w){b=E.sub(p)._perp()._unit();let e=Af(l,p,E,Sf(x,b),w);isNaN(e)&&(e=0);const t=p.sub(l)._unit();l=l.add(t.mult(c))._round(),p=p.add(t.mult(-e))._round(),c=e,x=b,m&&this.zoom>=17&&(M(_,l)||_.push(l),M(_,p)||_.push(p))}const k=o.vertexLength,L=s.length>4&&Lf(l,p,E);let P=Pf(n,a,T);if(ff(this.layoutVertexArray,l.x,l.y,C,A,0,0,P),ff(this.layoutVertexArray,l.x,l.y,C,A,0,1,P),this.wallMode){const t=y(e-1,s),i=g.joinNormals[e-1];mf(this.wallVertexArray,i,!t,g.isPolygon),mf(this.wallVertexArray,i,!t,g.isPolygon)}if(n+=I,P=Pf(n,L,!T),a=L,ff(this.layoutVertexArray,p.x,p.y,C,A,0,0,P),ff(this.layoutVertexArray,p.x,p.y,C,A,0,1,P),this.wallMode){const t=y(e,s),i=g.joinNormals[e];mf(this.wallVertexArray,i,!t,g.isPolygon),mf(this.wallVertexArray,i,!t,g.isPolygon)}if(o.vertexLength+=4,this.indexArray.emplaceBack(k+0,k+1,k+2),this.indexArray.emplaceBack(k+1,k+3,k+2),o.primitiveLength+=2,w){const r=i+(1===e?s.length-2:e-2),n=1===e?i:r+1;if(this.indexArray.emplaceBack(k+1,r,k+3),this.indexArray.emplaceBack(r,n,k+3),o.primitiveLength+=2,void 0===v&&(v=k),!If(E,s[e],t)){const t=e===s.length-1?v:o.vertexLength;this.indexArray.emplaceBack(k+2,k+3,t),this.indexArray.emplaceBack(k+3,t+1,t),this.indexArray.emplaceBack(k+3,n,t+1),o.primitiveLength+=3}T=!T}if(h){const e=this.layoutVertexExtArray,t=u.projectTilePoint(l.x,l.y,r),i=u.projectTilePoint(p.x,p.y,r),n=u.upVector(r,l.x,l.y),o=u.upVector(r,p.x,p.y);gf(e,t,n),gf(e,t,n),gf(e,i,o),gf(e,i,o)}}p&&(i+=s.length-1),m&&w&&this.zoom>=17&&(0!==_.length&&M(_,_[0])&&_.pop(),this.groundEffect.addData(_,t,l,w>0))}this.footprintSegments.push(a),s.triangleCount=this.indexArray.length-s.triangleArrayOffset,this.polygonSegments.push(s),++f.footprintSegLen,++f.polygonSegLen}if(f.vertexCount=this.layoutVertexArray.length-f.vertexArrayOffset,f.groundVertexCount=this.groundEffect.vertexArray.length-f.groundVertexArrayOffset,0!==f.vertexCount){if(f.centroidXY=d.borders?pf:this.encodeCentroid(d,f),this.centroidData.push(f),d.borders){this.featuresOnBorder.push(d);const e=this.featuresOnBorder.length-1;for(let t=0;t<d.borders.length;t++)d.borders[t][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[t].push(e)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,o,r,a),this.groundEffect.addPaintPropertiesData(e,i,n,o,r,a),this.maxHeight=Math.max(this.maxHeight,_)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort(((t,i)=>this.featuresOnBorder[t].borders[e][0]-this.featuresOnBorder[i].borders[e][0]))}splitToSubtiles(){const e=[];for(let t=0;t<this.centroidData.length;t++){const i=this.centroidData[t],r=+(i.min.y+i.max.y>fo),n=2*r+(+(i.min.x+i.max.x>fo)^r);for(let r=0;r<i.polygonSegLen;r++){const o=i.polygonSegIdx+r;e.push({centroidIdx:t,subtile:n,polygonSegmentIdx:o,triangleSegmentIdx:this.polygonSegments[o].triangleSegIdx})}}const t=new Kl;e.sort(((e,t)=>e.triangleSegmentIdx===t.triangleSegmentIdx?e.subtile-t.subtile:e.triangleSegmentIdx-t.triangleSegmentIdx));let i=0,r=0,n=0;for(const t of e){if(t.triangleSegmentIdx!==i)break;n++}const o=e.length;for(;r!==e.length;){i=e[r].triangleSegmentIdx;let s=0,a=r,l=r;for(let t=a;t<n&&e[t].subtile===s;t++)l++;for(;a!==n;){const r=e[a];s=r.subtile;const o=this.centroidData[r.centroidIdx].min.clone(),c=this.centroidData[r.centroidIdx].max.clone(),u={vertexOffset:this.segments.segments[i].vertexOffset,primitiveOffset:t.length,vertexLength:this.segments.segments[i].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let i=a;i<l;i++){const r=e[i],n=this.polygonSegments[r.polygonSegmentIdx],s=this.centroidData[r.centroidIdx].min,a=this.centroidData[r.centroidIdx].max,l=this.indexArray.uint16;for(let e=n.triangleArrayOffset;
vendor: 5,450 bytes, line 1
1e<n.triangleArrayOffset+n.triangleCount;e++)t.emplaceBack(l[3*e],l[3*e+1],l[3*e+2]);u.primitiveLength+=n.triangleCount,o.x=Math.min(o.x,s.x),o.y=Math.min(o.y,s.y),c.x=Math.max(c.x,a.x),c.y=Math.max(c.y,a.y)}u.primitiveLength>0&&this.triangleSubSegments.push({segment:u,min:o,max:c}),a=l;for(let t=a;t<n&&e[t].subtile===e[a].subtile;t++)l++}r=n;for(let t=r;t<o&&e[t].triangleSegmentIdx===e[r].triangleSegmentIdx;t++)n++}t._trim(),this.indexArray=t}getVisibleSegments(e,t,i){const r=new Cc;if(this.wallMode){for(const e of this.triangleSubSegments)r.segments.push(e.segment);return r}let n=0,o=0;const s=1<<e.canonical.z;if(t){const i=t.getMinMaxForTile(e);i&&(n=i.min,o=i.max)}o+=this.maxHeight;const a=e.toUnwrapped();let l;const c=[a.canonical.x/s+a.wrap,a.canonical.y/s],u=[(a.canonical.x+1)/s+a.wrap,(a.canonical.y+1)/s],h=(e,t,i)=>[e[0]*(1-i[0])+t[0]*i[0],e[1]*(1-i[1])+t[1]*i[1]],p=[],d=[];for(const e of this.triangleSubSegments){p[0]=e.min.x/fo,p[1]=e.min.y/fo,d[0]=e.max.x/fo,d[1]=e.max.y/fo;const t=h(c,u,p),s=h(c,u,d);if(0===new Ch([t[0],t[1],n],[s[0],s[1],o]).intersectsPrecise(i)){l&&(r.segments.push(l),l=void 0);continue}const a=e.segment;l&&l.vertexOffset!==a.vertexOffset&&(r.segments.push(l),l=void 0),l?(l.vertexLength+=a.vertexLength,l.primitiveLength+=a.primitiveLength):l={vertexOffset:a.vertexOffset,primitiveLength:a.primitiveLength,vertexLength:a.vertexLength,primitiveOffset:a.primitiveOffset,sortKey:void 0,vaos:{}}}return l&&r.segments.push(l),r}encodeCentroid(e,t){const i=e.centroid(),r=t.span(),n=Math.min(7,Math.round(r.x*this.tileToMeter/10)),o=Math.min(7,Math.round(r.y*this.tileToMeter/10));return new Ut(Yt(i.x,1,fo-1)<<3|n,Yt(i.y,1,fo-1)<<3|o)}encodeBorderCentroid(e){if(!e.borders)return new Ut(0,0);const t=e.borders,i=Number.MAX_VALUE;if(t[0][0]!==i||t[1][0]!==i){const e=t[0][0]!==i?0:1;return new Ut(6|(t[0][0]!==i?0:65528),(t[e][0]+t[e][1])/2<<3|6)}{const e=t[2][0]!==i?2:3;return new Ut((t[e][0]+t[e][1])/2<<3|6,6|(t[2][0]!==i?0:65528))}}showCentroid(e){const t=this.centroidData[e.centroidDataIndex];t.flags&=df,t.centroidXY.x=0,t.centroidXY.y=0,this.writeCentroidToBuffer(t)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const t=e.vertexArrayOffset,i=e.vertexCount+e.vertexArrayOffset,r=e.flags&df?pf:e.centroidXY,n=this.centroidVertexArray.geta_centroid_pos0(t);if(this.centroidVertexArray.geta_centroid_pos1(t)!==r.y||n!==r.x){for(let e=t;e<i;++e)this.centroidVertexArray.emplace(e,r.x,r.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,t,i){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const r=t.getReplacementRegionsForTile(e.toUnwrapped());if(Nd(this.activeReplacements,r))return;if(this.activeReplacements=r,0===this.centroidVertexArray.length)this.createCentroidsBuffer();else for(const e of this.centroidData)e.flags&=2147483647;const n=[];for(const t of this.activeReplacements){if(t.order<i)continue;const r=Math.pow(2,t.footprintTileId.canonical.z-e.canonical.z);for(const i of this.centroidData)if(!(i.flags&df||t.min.x>i.max.x||i.min.x>t.max.x||t.min.y>i.max.y||i.min.y>t.max.y))for(let o=0;o<i.footprintSegLen;o++){const s=this.footprintSegments[i.footprintSegIdx+o];if(n.length=0,Of(this.footprintVertices,s.vertexOffset,s.vertexCount,t.footprintTileId.canonical,e.canonical,n),Vd(t.footprint,n,this.footprintIndices.uint16,s.indexOffset,s.indexCount,-s.vertexOffset,-r)){i.flags|=df;break}}}for(const e of this.centroidData)this.writeCentroidToBuffer(e);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,t,i){let r=!1;for(let n=0;n<i.footprintSegLen;n++){const o=this.footprintSegments[i.footprintSegIdx+n];let s=0;for(const i of o.ringIndices){for(let n=s,a=i+s-1;n<i+s;a=n++){const i=this.footprintVertices.int16[2*(n+o.vertexOffset)+0],s=this.footprintVertices.int16[2*(n+o.vertexOffset)+1],l=this.footprintVertices.int16[2*(a+o.vertexOffset)+1];s>t!=l>t&&e<(this.footprintVertices.int16[2*(a+o.vertexOffset)+0]-i)*(t-s)/(l-s)+i&&(r=!r)}s=i}}return r}getHeightAtTileCoord(e,t){let i=Number.NEGATIVE_INFINITY,r=!0;const n=4*(e+fo)*fo+(t+fo);if(this.partLookup.hasOwnProperty(n)){const e=this.partLookup[n];return e?{height:e.height,hidden:!!(e.flags&df)}:void 0}for(const o of this.centroidData)e>o.max.x||o.min.x>e||t>o.max.y||o.min.y>t||this.footprintContainsPoint(e,t,o)&&o&&o.height>i&&(i=o.height,this.partLookup[n]=o,r=!!(o.flags&df));if(i!==Number.NEGATIVE_INFINITY)return{height:i,hidden:r};this.partLookup[n]=void 0}}function Sf(e,t){const i=e.add(t)._unit();return e.x*i.x+e.y*i.y}function Cf(e,t,i,r){const n=t.sub(e)._perp()._unit(),o=i.sub(t)._perp()._unit();return Af(e,t,i,Sf(n,o),r)}function Af(e,t,i,r,n){const o=Math.sqrt(1-r*r);return Math.min(e.dist(t)/3,t.dist(i)/3,n*o/r)}function If(e,t,i){return e.x<i[0].x&&t.x<i[0].x||e.x>i[1].x&&t.x>i[1].x||e.y<i[0].y&&t.y<i[0].y||e.y>i[1].y&&t.y>i[1].y}function kf(e,t){return e.x<t[0].x||e.x>t[1].x||e.y<t[0].y||e.y>t[1].y}function Lf(e,t,i){if(e.x<0||e.x>=fo||t.x<0||t.x>=fo||i.x<0||i.x>=fo)return!1;const r=i.sub(t),n=r.perp(),o=e.sub(t);return(r.x*o.x+r.y*o.y)/Math.sqrt((r.x*r.x+r.y*r.y)*(o.x*o.x+o.y*o.y))>-.866&&n.x*o.x+n.y*o.y<0}function Pf(e,t,i){const r=t?2|e:-3&e;return i?1|r:-2&r}
vendor: 7,343 bytes, line 1
1function Rf(){const e=Math.PI/32,t=Math.tan(e),i=_u;return i*Math.sqrt(1+2*t*t)-i}function zf(e,t,i){const r=1<<i.z,n=Ru(i.x/r),o=Ru((i.x+1)/r),s=zu(i.y/r),a=zu((i.y+1)/r);return function(e,t,i,r,n=0,o){const s=[];if(!e.length||!i||!r)return s;const a=(e,t)=>{for(const i of e)s.push({polygon:i,bounds:t})},l=Math.ceil(Math.log2(i)),c=Math.ceil(Math.log2(r)),u=l-c,h=[];for(let e=0;e<Math.abs(u);e++)h.push(u>0?0:1);for(let e=0;e<Math.min(l,c);e++)h.push(0),h.push(1);let p=e;if(p=Ld(p,t[0].y-n,t[1].y+n,1),p=Ld(p,t[0].x-n,t[1].x+n,0),!p.length)return s;const d=[];for(h.length?d.push({polygons:p,bounds:t,depth:0}):a(p,t);d.length;){const e=d.pop(),t=e.depth,i=h[t],r=e.bounds[0],s=e.bounds[1],l=0===i?r.x:r.y,c=0===i?s.x:s.y,u=o?o(i,l,c):.5*(l+c),p=Ld(e.polygons,l-n,u+n,i),f=Ld(e.polygons,u-n,c+n,i);if(p.length){const e=[r,new Ut(0===i?u:s.x,1===i?u:s.y)];h.length>t+1?d.push({polygons:p,bounds:e,depth:t+1}):a(p,e)}if(f.length){const e=[new Ut(0===i?u:r.x,1===i?u:r.y),s];h.length>t+1?d.push({polygons:f,bounds:e,depth:t+1}):a(f,e)}}return s}(e,t,Math.ceil((o-n)/11.25),Math.ceil((s-a)/11.25),1,((e,t,n)=>{if(0===e)return.5*(t+n);{const e=zu((i.y+t/fo)/r);return(Lu(.5*(zu((i.y+n/fo)/r)+e))*r-i.y)*fo}}))}function Of(e,t,i,r,n,o){const s=Math.pow(2,r.z-n.z);for(let a=0;a<i;a++){let i=e.int16[2*(a+t)+0],l=e.int16[2*(a+t)+1];i=(i+n.x*fo)*s-r.x*fo,l=(l+n.y*fo)*s-r.y*fo,o.push(new Ut(i,l))}}let Df,Ff;function Bf(e,t){return e.x*t.x+e.y*t.y}function Nf(e,t){if(1===e.length){let i=0;const r=t[i++];let n;for(;!n||r.equals(n);)if(n=t[i++],!n)return 1/0;for(;i<t.length;i++){const o=t[i],s=e[0],a=n.sub(r),l=o.sub(r),c=s.sub(r),u=Bf(a,a),h=Bf(a,l),p=Bf(l,l),d=Bf(c,a),f=Bf(c,l),m=u*p-h*h,_=(p*d-h*f)/m,g=(u*f-h*d)/m,y=r.z*(1-_-g)+n.z*_+o.z*g;if(isFinite(y))return y}return 1/0}{let e=1/0;for(const i of t)e=Math.min(e,i.z);return e}}function jf(e,t,i,r,n,o,s,a){const l=s*n.getElevationAt(e,t,!0,!0),c=0!==o[0],u=c?0===o[1]?s*(o[0]/7-450):s*function(e,t,i){const r=Math.floor(t[0]/8),n=Math.floor(t[1]/8),o=10*(t[0]-8*r),s=10*(t[1]-8*n),a=e.getElevationAt(r,n,!0,!0),l=e.getMeterToDEM(i),c=Math.floor(.5*(o*l-1)),u=Math.floor(.5*(s*l-1)),h=e.tileCoordToPixel(r,n),p=2*c+1,d=2*u+1,f=function(e,t,i,r,n){return[e.getElevationAtPixel(t,i,!0),e.getElevationAtPixel(t+n,i,!0),e.getElevationAtPixel(t,i+n,!0),e.getElevationAtPixel(t+r,i+n,!0)]}(e,h.x-c,h.y-u,p,d),m=Math.abs(f[0]-f[1]),_=Math.abs(f[2]-f[3]),g=Math.abs(f[0]-f[2])+Math.abs(f[1]-f[3]),y=Math.min(.25,.5*l*(m+_)/p),v=Math.min(.25,.5*l*g/d);return a+Math.max(y*o,v*s)}(n,o,a):l;return{base:l+(0===i)?-1:i,top:c?Math.max(u+r,l+i+2):l+r}}Ma(Ef,"FillExtrusionBucket",{omit:["layers","features"]}),Ma(vf,"PartData"),Ma(yf,"FootprintSegment"),Ma(xf,"BorderCentroidData"),Ma(Mf,"GroundEffect");const Uf=Rl([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),{members:Vf}=Uf,$f=Rl([{name:"a_packed",components:4,type:"Float32"}]),{members:Gf}=$f,qf=Rl([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:Hf}=qf,Zf=Rl([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Wf=Rl([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Xf=Rl([{name:"a_projected_pos",components:4,type:"Float32"}],4);Rl([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Qf=Rl([{name:"a_z_offset",components:1,type:"Float32"}],4),Yf=Rl([{name:"a_texb",components:2,type:"Uint16"}]),Jf=Rl([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Kf=Rl([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_z_offset",components:1,type:"Float32"}]);Rl([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const em=Rl([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),tm=Rl([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Rl([{name:"triangle",components:3,type:"Uint16"}]),Rl([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),Rl([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"}]),Rl([{type:"Float32",name:"offsetX"}]),Rl([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);class im{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.image=new mp({width:e,height:t}),this.positions={},this.uploaded=!1}getDash(e,t){const i=this.getKey(e,t);return this.positions[i]}trim(){const e=this.width,t=this.height=si(this.nextRow);this.image.resize({width:e,height:t})}getKey(e,t){return e.join(",")+t}getDashRanges(e,t,i){const r=[];let n=e.length%2==1?-e[e.length-1]*i:0,o=e[0]*i,s=!0;r.push({left:n,right:o,isDash:s,zeroLength:0===e[0]});let a=e[0];for(let t=1;t<e.length;t++){s=!s;const l=e[t];
vendor: 3,010 bytes, line 1
1n=a*i,a+=l,o=a*i,r.push({left:n,right:o,isDash:s,zeroLength:0===l})}return r}addRoundDash(e,t,i){const r=t/2;for(let t=-i;t<=i;t++){const n=this.width*(this.nextRow+i+t);let o=0,s=e[o];for(let a=0;a<this.width;a++){a/s.right>1&&(s=e[++o]);const l=Math.abs(a-s.left),c=Math.abs(a-s.right),u=Math.min(l,c);let h;const p=t/i*(r+1);if(s.isDash){const e=r-Math.abs(p);h=Math.sqrt(u*u+e*e)}else h=r-Math.sqrt(u*u+p*p);this.image.data[n+a]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e,t){for(let t=e.length-1;t>=0;--t){const i=e[t],r=e[t+1];i.zeroLength?e.splice(t,1):r&&r.isDash===i.isDash&&(r.left=i.left,e.splice(t,1))}const i=e[0],r=e[e.length-1];i.isDash===r.isDash&&(i.left=r.left-this.width,r.right=i.right+this.width);const n=this.width*this.nextRow;let o=0,s=e[o];for(let i=0;i<this.width;i++){i/s.right>1&&(s=e[++o]);const r=Math.abs(i-s.left),a=Math.abs(i-s.right),l=Math.min(r,a);this.image.data[n+i]=Math.max(0,Math.min(255,(s.isDash?l:-l)+t+128))}}addDash(e,t){const i=this.getKey(e,t);if(this.positions[i])return this.positions[i];const r="round"===t,n=r?7:0,o=2*n+1;if(this.nextRow+o>this.height)return fi("LineAtlas out of space"),null;0===e.length&&e.push(1);let s=0;for(let t=0;t<e.length;t++)e[t]<0&&(fi("Negative value is found in line dasharray, replacing values with 0"),e[t]=0),s+=e[t];if(0!==s){const i=this.width/s,o=this.getDashRanges(e,this.width,i);r?this.addRoundDash(o,i,n):this.addRegularDash(o,"square"===t?.5*i:0)}const a=this.nextRow+n;this.nextRow+=o;const l={tl:[a,n],br:[s,0]};return this.positions[i]=l,l}}Ma(im,"LineAtlas");const rm=Ad.types,nm=Math.cos(Math.PI/180*37.5),om=Math.cos(Math.PI/180*5);class sm{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasZOffset=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((e=>{this.gradients[e.id]={}})),this.layoutVertexArray=new Nl,this.layoutVertexArray2=new jl,this.patternVertexArray=new Ul,this.indexArray=new Kl,this.programConfigurations=new eu(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new Cc,this.maxLineLength=0,this.zOffsetVertexArray=new ic,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.tessellationStep=e.tessellationStep?e.tessellationStep:fo/64}updateFootprints(e,t){}populate(e,t,i,r){this.hasPattern=Jp("line",this.layers,t);const n=this.layers[0].layout.get("line-sort-key"),o=this.layers[0].layout.get("line-z-offset");this.hasZOffset=!o.isConstant()||!!o.constantOr(0);const s=[];for(const{feature:t,id:o,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=Qu(t,e);if(!this.layers[0]._featureFilter.filter(new Qa(this.zoom),c,i))continue;const u=n?n.evaluate(c,{},i):void 0,h={id:o,properties:t.properties,type:t.type,sourceLayerIndex:l,index:a,geometry:e?c.geometry:Xu(t,i,r),patterns:{},sortKey:u};s.push(h)}n&&s.sort(((e,t)=>
1e.sortKey-t.sortKey));const{lineAtlas:a,featureIndex:l}=t,c=this.addConstantDashes(a);for(const r of s){const{geometry:n,index:o,sourceLayerIndex:s}=r;if(c&&this.addFeatureDashes(r,a),this.hasPattern){const e=Kp("line",this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,n,o,i,a.positions,t.availableImages,t.brightness);l.insert(e[o].feature,n,o,s,this.index)}}addConstantDashes(e){let t=!1;for(const i of this.layers){const r=i.paint.get("line-dasharray").value,n=i.layout.get("line-cap").value;if("constant"!==r.kind||"constant"!==n.kind)t=!0;else{const t=n.value,i=r.value;if(!i)continue;e.addDash(i,t)}}return t}addFeatureDashes(e,t){const i=this.zoom;for(const r of this.layers){const n=r.paint.get("line-dasharray").value,o=r.layout.get("line-cap").value;if("constant"===n.kind&&"constant"===o.kind)continue;let s,a;if("constant"===n.kind){if(s=n.value,!s)continue}else s=n.evaluate({zoom:i},e);a="constant"===o.kind?o.value:o.evaluate({zoom:i},e),t.addDash(s,a),e.patterns[r.id]=t.getKey(s,a)}}update(e,t,i,r,n){const o=0!==Object.keys(e).length;o&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,t,o?this.stateDependentLayers:this.layers,i,r,n)}addFeatures(e,t,i,r,n,o){for(const e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,i,r,o)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Gf)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,Hf)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Qf.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Vf),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,t,i,r,n,o,s){const a=this.layers[0].layout,l=a.get("line-join").evaluate(e,{}),c=a.get("line-cap").evaluate(e,{}),u=a.get("line-miter-limit"),h=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const i of t)this.addLine(i,e,r,l,c,u,h);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,o,r,s)}addLine(e,t,i,r,n,o,s){this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineSoFar=0,this.currentVertex=void 0;const a={zoom:this.zoom,lineProgress:void 0},l=this.layers[0].layout,c="none"===r;if(this.patternJoinNone=this.hasPattern&&c,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[],this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const u="Polygon"===rm[t.type];let h=e.length;for(;h>=2&&e[h-1].equals(e[h-2]);)h--;let p=0;for(;p<h-1&&e[p].equals(e[p+1]);)p++;if(h<(u?3:2))return;"bevel"===r&&(o=1.05);const d=this.overscaling<=16?15*fo/(512*this.overscaling):0,f=this.segments.prepareSegment(10*h,this.layoutVertexArray,this.indexArray);let m,_,g,y,v,x;this.e1=this.e2=-1,u&&(m=e[h-2],v=e[p].sub(m)._unit()._perp());for(let i=p;i<h;i++){if(g=i===h-1?u?e[p+1]:void 0:e[i+1],g&&e[i].equals(g))continue;if(v&&(y=v),m&&(_=m),m=e[i],this.hasZOffset){const e=l.get("line-z-offset").value;if("constant"===e.kind)x=e.value;else{if(this.lineClips){const e=this.totalDistance/(this.lineClips.end-this.lineClips.start);a.lineProgress=(e*this.lineClips.start+this.distance+(_?_.dist(m):0))/e}else fi(`line-z-offset evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`),a.lineProgress=0;x=e.evaluate(a,t)}x=x||0}v=g?g.sub(m)._unit()._perp():y,y=y||v;const b=_&&g;let w=b?r:u||c?"butt":n;const T=y.x*v.x+y.y*v.y;if(c){const e=function(e){if(e.patternJoinNone){const t=e.segmentPoints.length/2,i=e.lineSoFar-e.segmentStart;for(let r=0;r<t;++r){const t=e.segmentPoints[2*r+1],n=Math.round(e.segmentPoints[2*r])+.5+.25*t;e.patternVertexArray.emplaceBack(n,i,e.segmentStart),e.patternVertexArray.emplaceBack(n,i,e.segmentStart)}e.segmentPoints.length=0}e.e1=e.e2=-1};if(b&&T<om){this.updateDistance(_,m),this.addCurrentVertex(m,y,1,1,f,x),e(this),this.addCurrentVertex(m,v,-1,-1,f,x);continue}if(_){if(!g){this.updateDistance(_,m),this.addCurrentVertex(m,y,1,1,f,x),e(this);continue}w="miter"}}let M=y.add(v);0===M.x&&0===M.y||M._unit();const E=M.x*v.x+M.y*v.y,S=0!==E?1/E:1/0,C=2*Math.sqrt(2-2*E),A=E<nm&&_&&g,I=y.x*v.y-y.y*v.x>0;if(A&&i>p){const e=m.dist(_);if(e>2*d){const t=m.sub(m.sub(_)._mult(d/e)._round());this.updateDistance(_,t),this.addCurrentVertex(t,y,0,0,f,x),_=t}}if(b&&"round"===w&&(S<s?w="miter":S<=2&&(w="fakeround")),"miter"
1===w&&S>o&&(w="bevel"),"bevel"===w&&(S>2&&(w="flipbevel"),S<o&&(w="miter")),_&&this.updateDistance(_,m),"miter"===w)M._mult(S),this.addCurrentVertex(m,M,0,0,f,x);else if("flipbevel"===w){if(S>100)M=v.mult(-1);else{const e=S*y.add(v).mag()/y.sub(v).mag();M._perp()._mult(e*(I?-1:1))}this.addCurrentVertex(m,M,0,0,f,x),this.addCurrentVertex(m,M.mult(-1),0,0,f,x)}else if("bevel"===w||"fakeround"===w){const e=-Math.sqrt(S*S-1),t=I?e:0,i=I?0:e;if(_&&this.addCurrentVertex(m,y,t,i,f,x),"fakeround"===w){const e=Math.round(180*C/Math.PI/20);for(let t=1;t<e;t++){let i=t/e;if(.5!==i){const e=i-.5;i+=i*e*(i-1)*((1.0904+T*(T*(3.55645-1.43519*T)-3.2452))*e*e+(.848013+T*(.215638*T-1.06021)))}const r=v.sub(y)._mult(i)._add(y)._unit()._mult(I?-1:1);this.addHalfVertex(m,r.x,r.y,!1,I,0,f,x)}}g&&this.addCurrentVertex(m,v,-t,-i,f,x)}else"butt"===w?this.addCurrentVertex(m,M,0,0,f,x):"square"===w?(_||this.addCurrentVertex(m,M,-1,-1,f,x),this.addCurrentVertex(m,M,0,0,f,x),_&&this.addCurrentVertex(m,M,1,1,f,x)):"round"===w&&(_&&(this.addCurrentVertex(m,y,0,0,f,x),this.addCurrentVertex(m,y,1,1,f,x,!0)),g&&(this.addCurrentVertex(m,v,-1,-1,f,x,!0),this.addCurrentVertex(m,v,0,0,f,x)));if(A&&i<h-1){const e=m.dist(g);if(e>2*d){const t=m.add(g.sub(m)._mult(d/e)._round());this.updateDistance(m,t),this.addCurrentVertex(t,v,0,0,f,x),m=t}}}}addVerticesTo(e,t,i,r,n,o,s,a,l,c){const u=(t.w-e.w)/this.tessellationStep|0;if(u>1){this.lineSoFar=e.w;const h=(t.x-e.x)/u,p=(t.y-e.y)/u,d=(t.z-e.z)/u,f=(t.w-e.w)/u;for(let t=1;t<u;++t)e.x+=h,e.y+=p,e.z+=d,this.lineSoFar+=f,this.addHalfVertex(e,i,r,c,!1,s,l,e.z),this.addHalfVertex(e,n,o,c,!0,-a,l,e.z)}this.lineSoFar=t.w,this.addHalfVertex(t,i,r,c,!1,s,l,t.z),this.addHalfVertex(t,n,o,c,!0,-a,l,t.z)}addCurrentVertex(e,t,i,r,n,o,s=!1){const a=t.x+t.y*i,l=t.y-t.x*i,c=t.y*r-t.x,u=-t.y-t.x*r;if(null!=o){const t=-10,h=fo+10,p=o,d=new kd(e.x,e.y,p,this.lineSoFar),f=am(e,t,h),m=this.lineSoFar;if(this.currentVertex)if(f){const o=this.currentVertexIsOutside,d=this.currentVertex,f=new kd(e.x,e.y,p,this.lineSoFar);Rd(d,f,t,h),am(f,t,h)||(o&&(this.e1=this.e2=-1,this.lineSoFar=d.w,this.addHalfVertex(d,a,l,s,!1,i,n,d.z),this.addHalfVertex(d,c,u,s,!0,-r,n,d.z)),this.addVerticesTo(d,f,a,l,c,u,i,r,n,s))}else{const e=this.currentVertex;this.currentVertexIsOutside&&(Rd(e,d,t,h),this.e1=this.e2=-1,this.lineSoFar=e.w,this.addHalfVertex(e,a,l,s,!1,i,n,e.z),this.addHalfVertex(e,c,u,s,!0,-r,n,e.z)),this.addVerticesTo(e,d,a,l,c,u,i,r,n,s)}else f||(this.addHalfVertex(e,a,l,s,!1,i,n,o),this.addHalfVertex(e,c,u,s,!0,-r,n,o));this.currentVertex=d,this.currentVertexIsOutside=f,this.lineSoFar=m}else this.addHalfVertex(e,a,l,s,!1,i,n,o),this.addHalfVertex(e,c,u,s,!0,-r,n,o)}addHalfVertex({x:e,y:t},i,r,n,o,s,a,l){this.patternJoinNone&&(0===this.segmentPoints.length&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),o||this.segmentPoints.push(this.lineSoFar-this.segmentStart,s)),this.layoutVertexArray.emplaceBack((e<<1)+(n?1:0),(t<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*r)+128,1+(0===s?0:s<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const c=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),a.primitiveLength++),o?this.e2=c:this.e1=c,null!=l&&this.zOffsetVertexArray.emplaceBack(l)}updateScaledDistance(){if(this.lineClips){const e=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}}function am(e,t,i){return e.x<t||e.x>i||e.y<t||e.y>i}let lm,cm;function um(e,t,i){return t*(fo/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}function hm(e,t){return 1/um(e,1,t.tileZoom)}function pm(e,t,i,r){return e.translatePosMatrix(r||t.tileID.projMatrix,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}Ma(sm,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const dm=e=>{const t=[];fm(e)&&t.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&t.push("RENDER_LINE_GRADIENT");const i=e.paint.get("line-trim-offset");0===i[0]&&0===i[1]||t.push("RENDER_LINE_TRIM_OFFSET"),0!==e.paint.get("line-border-width").constantOr(1)&&t.push("RENDER_LINE_BORDER");const r="none"===e.layout.get("line-join").constantOr("miter"),n=!!e.paint.get("line-pattern").constantOr(1);return r&&n&&t.push("LINE_JOIN_NONE"),t};function fm(e){const t=e.paint.get("line-dasharray").value;return t.value||"constant"!==t.kind}class mm{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){const i=e[t];this._stringToNumber[i]=t,this._numberToString[t]=i}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}var _m={read:function(e,t,i,r,n){var o,s,a=8*n-r-1,l=(1<<a)-1,c=l>>1,u=-7,h=i?n-1:0,p=i?-1:1,d=e[t+h];for(h+=p,o=d&(1<<-u)-1,d>>=-u,u+=a;u>0;o=256*o+e[t+h],h+=p,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+e[t+h],h+=p,u-=8);if(0===o)o=1-c;else{if(o===l)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=c}return(d?-1:1)*s*Math.pow(2,o-r)},write:function(e,t,i,r,n,o){var s,a,l,c=8*o-n-1,u=(1<<c)-1,h=u>>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=u?(a=0,s=u):s+h>=1?(a=(t*l-1)*Math.pow(2,n),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,n),s=0));n>=8;e[i+d]=255&a,d+=f,a/=256,n-=8);for(s=s<<n|a,c+=n;c>0;e[i+d]=255&s,d+=f,s/=256,c-=8);e[i+d-f]|=128*m}},gm=vm,ym=_m;function vm(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}vm.Varint=0,vm.Fixed64=1,vm.Bytes=2,vm.Fixed32=5;
vendor: 3,092 bytes, line 1
1var xm=4294967296,bm=1/xm,wm="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Tm(e){return e.type===vm.Bytes?e.readVarint()+e.pos:e.pos+1}function Mm(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function Em(e,t,i){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=e;n--)i.buf[n+r]=i.buf[n]}function Sm(e,t){for(var i=0;i<e.length;i++)t.writeVarint(e[i])}function Cm(e,t){for(var i=0;i<e.length;i++)t.writeSVarint(e[i])}function Am(e,t){for(var i=0;i<e.length;i++)t.writeFloat(e[i])}function Im(e,t){for(var i=0;i<e.length;i++)t.writeDouble(e[i])}function km(e,t){for(var i=0;i<e.length;i++)t.writeBoolean(e[i])}function Lm(e,t){for(var i=0;i<e.length;i++)t.writeFixed32(e[i])}function Pm(e,t){for(var i=0;i<e.length;i++)t.writeSFixed32(e[i])}function Rm(e,t){for(var i=0;i<e.length;i++)t.writeFixed64(e[i])}function zm(e,t){for(var i=0;i<e.length;i++)t.writeSFixed64(e[i])}function Om(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function Dm(e,t,i){e[i]=t,e[i+1]=t>>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function Fm(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}vm.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),n=r>>3,o=this.pos;this.type=7&r,e(n,t,this),this.pos===o&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Om(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Fm(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Om(this.buf,this.pos)+Om(this.buf,this.pos+4)*xm;return this.pos+=8,e},readSFixed64:function(){var e=Om(this.buf,this.pos)+Fm(this.buf,this.pos+4)*xm;return this.pos+=8,e},readFloat:function(){var e=ym.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=ym.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,i,r=this.buf;return t=127&(i=r[this.pos++]),i<128?t:(t|=(127&(i=r[this.pos++]))<<7,i<128?t:(t|=(127&(i=r[this.pos++]))<<14,i<128?t:(t|=(127&(i=r[this.pos++]))<<21,i<128?t:function(e,t,i){var r,n,o=i.buf;if(r=(112&(n=o[i.pos++]))>>4,n<128)return Mm(e,r,t);if(r|=(127&(n=o[i.pos++]))<<3,n<128)return Mm(e,r,t);if(r|=(127&(n=o[i.pos++]))<<10,n<128)return Mm(e,r,t);if(r|=(127&(n=o[i.pos++]))<<17,n<128)return Mm(e,r,t);if(r|=(127&(n=o[i.pos++]))<<24,n<128)return Mm(e,r,t);if(r|=(1&(n=o[i.pos++]))<<31,n<128)return Mm(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&wm?function(e,t,i){return wm.decode(e.subarray(t,i))}(this.buf,t,e):function(e,t,i){for(var r="",n=t;n<i;){var o,s,a,l=e[n],c=null,u=l>239?4:l>223?3:l>191?2:1;if(n+u>i)break;
vendor: 6,262 bytes, line 1
11===u?l<128&&(c=l):2===u?128==(192&(o=e[n+1]))&&(c=(31&l)<<6|63&o)<=127&&(c=null):3===u?(s=e[n+2],128==(192&(o=e[n+1]))&&128==(192&s)&&((c=(15&l)<<12|(63&o)<<6|63&s)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(s=e[n+2],a=e[n+3],128==(192&(o=e[n+1]))&&128==(192&s)&&128==(192&a)&&((c=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),n+=u}return r}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==vm.Bytes)return e.push(this.readVarint(t));var i=Tm(this);for(e=e||[];this.pos<i;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==vm.Bytes)return e.push(this.readSVarint());var t=Tm(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==vm.Bytes)return e.push(this.readBoolean());var t=Tm(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==vm.Bytes)return e.push(this.readFloat());var t=Tm(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==vm.Bytes)return e.push(this.readDouble());var t=Tm(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==vm.Bytes)return e.push(this.readFixed32());var t=Tm(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==vm.Bytes)return e.push(this.readSFixed32());var t=Tm(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==vm.Bytes)return e.push(this.readFixed64());var t=Tm(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==vm.Bytes)return e.push(this.readSFixed64());var t=Tm(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=7&e;if(t===vm.Varint)for(;this.buf[this.pos++]>127;);else if(t===vm.Bytes)this.pos=this.readVarint()+this.pos;else if(t===vm.Fixed32)this.pos+=4;else{if(t!==vm.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),Dm(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),Dm(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),Dm(this.buf,-1&e,this.pos),Dm(this.buf,Math.floor(e*bm),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),Dm(this.buf,-1&e,this.pos),Dm(this.buf,Math.floor(e*bm),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var i,r;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,i.buf[i.pos]=127&(e>>>=7)}(i,0,t),function(e,t){var i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var r,n,o=0;o<t.length;o++){if((r=t.charCodeAt(o))>55295&&r<57344){if(!n){r>56319||o+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&Em(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(e){this.realloc(4),ym.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),ym.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i<t;i++)this.buf[this.pos++]=e[i]},writeRawMessage:function(e,t){this.pos++;var i=this.pos;e(t,this);var r=this.pos-i;r>=128&&Em(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,i){this.writeTag(e,vm.Bytes),this.writeRawMessage(t,i)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,Sm,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,Cm,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,km,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,Am,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,Im,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,Lm,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,Pm,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,Rm,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,zm,t)},writeBytesField:function(e,t){this.writeTag(e,vm.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,vm.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,vm.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,vm.Fixed64),this.writeFixed64
vendor: 13,648 bytes, line 1
1(t)},writeSFixed64Field:function(e,t){this.writeTag(e,vm.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,vm.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,vm.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,vm.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,vm.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,vm.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};var Bm=p(gm);const Nm=["id","tile","layer","source","sourceLayer","state"];class jm{constructor(e,t,i,r,n){this.type="Feature",this._vectorTileFeature=e,this._z=t,this._x=i,this._y=r,this.properties=e.properties,this.id=n}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const t of Nm)void 0!==this[t]&&(e[t]=this[t]);return e}}class Um{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,t,i){const r=String(t);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][r]=this.stateChanges[e][r]||{},ii(this.stateChanges[e][r],i),null===this.deletedStates[e]){this.deletedStates[e]={};for(const t in this.state[e])t!==r&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][r]){this.deletedStates[e][r]={};for(const t in this.state[e][r])i[t]||(this.deletedStates[e][r][t]=null)}else for(const t in i)this.deletedStates[e]&&this.deletedStates[e][r]&&null===this.deletedStates[e][r][t]&&delete this.deletedStates[e][r][t]}removeFeatureState(e,t,i){if(null===this.deletedStates[e])return;const r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&void 0!==t)null!==this.deletedStates[e][r]&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][i]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][r])for(i in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][i]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(e,t){const i=String(t),r=ii({},(this.state[e]||{})[i],(this.stateChanges[e]||{})[i]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){const i=this.deletedStates[e][t];if(null===i)return{};for(const e in i)delete r[e]}return r}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,t){const i={};for(const e in this.stateChanges){this.state[e]=this.state[e]||{};const t={};for(const i in this.stateChanges[e])this.state[e][i]||(this.state[e][i]={}),ii(this.state[e][i],this.stateChanges[e][i]),t[i]=this.state[e][i];i[e]=t}for(const e in this.deletedStates){this.state[e]=this.state[e]||{};const t={};if(null===this.deletedStates[e])for(const i in this.state[e])t[i]={},this.state[e][i]={};else for(const i in this.deletedStates[e]){if(null===this.deletedStates[e][i])this.state[e][i]={};else if(this.state[e][i])for(const t of Object.keys(this.deletedStates[e][i]))delete this.state[e][i][t];t[i]=this.state[e][i]}i[e]=i[e]||{},ii(i[e],t)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(i).length)for(const r in e)e[r].setFeatureState(i,t)}}class Vm{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new wa(fo,16,0),this.featureIndexArray=new bc,this.promoteId=t,this.is3DTile=!1}insert(e,t,i,r,n,o=0,s=0){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n,o);const l=this.grid;for(let e=0;e<t.length;e++){const i=t[e],r=[1/0,1/0,-1/0,-1/0];for(let e=0;e<i.length;e++){const t=i[e];r[0]=Math.min(r[0],t.x),r[1]=Math.min(r[1],t.y),r[2]=Math.max(r[2],t.x),r[3]=Math.max(r[3],t.y)}0!==s&&(r[0]-=s,r[1]-=s,r[2]+=s,r[3]+=s),r[0]<fo&&r[1]<fo&&r[2]>=0&&r[3]>=0&&l.insert(a,r[0],r[1],r[2],r[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Cd(new Bm(this.rawTileData)).layers,this.sourceLayerCoder=new mm(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,t,i,r){this.loadVTLayers();const n=e.params||{},o=dl(n.filter),s=e.tileResult,a=e.transform,l=s.bufferedTilespaceBounds,c=this.grid.query(l.min.x,l.min.y,l.max.x,l.max.y,((e,t,i,r)=>uh(s.bufferedTilespaceGeometry,e,t,i,r)));c.sort(Gm);let u=null;a.elevation&&c.length>0&&(u=of.create(a.elevation,this.tileID));const h={};let p;for(let l=0;l<c.length;l++){const d=c[l];if(d===p)continue;p=d;const f=this.featureIndexArray.get(d);let m=null;if(this.is3DTile){const e=this.bucketLayerIDs[0][0],i=t[e];if("model"!==i.type)continue;const{queryFeature:r,intersectionZ:n}=i.queryIntersectsMatchingFeature(s,f.featureIndex,o,a);r&&this.appendToResult(h,e,f.featureIndex,r,n)}else this.loadMatchingFeature(h,f,o,n.layers,n.availableImages,t,i,r,((t,i,r,n=0)=>(m||(m=Xu(t,this.tileID.canonical,e.tileTransform)),i.queryIntersectsFeature(s,t,r,m,this.z,e.transform,e.pixelPosMatrix,u,n))))}return h}loadMatchingFeature(e,t,i,r,n,o,s,a,l){const{featureIndex:c,bucketIndex:u,sourceLayerIndex:h,layoutVertexArrayOffset:p}=t,d=this.bucketLayerIDs[u];if(r&&!function(e,t){for(let i=0;i<e.length;i++)if(t.indexOf(e[i])>=0)return!0;return!1}(r,d))return;const f=this.sourceLayerCoder.decode(h),m=this.vtLayers[f].feature(c);if(i.needGeometry){const e=Qu(m,!0);if(!i.filter(new Qa(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!i.filter(new Qa(this.tileID.overscaledZ),m))return;const _=this.getId(m,f);for(let t=0;t<d.length;t++){const i=d[t];if(r&&r.indexOf(i)<0)continue;const u=o[i];if(!u)continue;let h={};void 0!==_&&a&&(h=a.getState(u.sourceLayer||"_geojsonTileLayer",_));const f=!l||l(m,u,h,p);if(!f)continue;const g=new jm(m,this.z,this.x,this.y,_),y=ii({},s[i]);y.paint=$m(y.paint,u.paint,m,h,n),y.layout=$m(y.layout,u.layout,m,h,n),g.layer=y,this.appendToResult(e,i,c,g,f)}}appendToResult(e,t,i,r,n){let o=e[t];void 0===o&&(o=e[t]=[]),o.push({featureIndex:i,feature:r,intersectionZ:n})}lookupSymbolFeatures(e,t,i,r,n,o,s,a){const l={};this.loadVTLayers();const c=dl(n);for(const n of e)this.loadMatchingFeature(l,{bucketIndex:i,sourceLayerIndex:r,featureIndex:n,layoutVertexArrayOffset:0},c,o,s,a,t);return l}loadFeature(e){const{featureIndex:t,sourceLayerIndex:i}=e;this.loadVTLayers();const r=this.sourceLayerCoder.decode(i),n=this.vtFeatures[r];if(n[t])return n[t];const o=this.vtLayers[r].feature(t);return n[t]=o,o}hasLayer(e){for(const t of this.bucketLayerIDs)for(const i of t)if(e===i)return!0;return!1}getId(e,t){let i=e.id;if(this.promoteId){const r="string"==typeof this.promoteId?this.promoteId:this.promoteId[t];null!=r&&(i=e.properties[r]),"boolean"==typeof i&&(i=Number(i))}return i}}function $m(e,t,i,r,n){return ui(e,((e,o)=>{const s=t instanceof nl?t.get(o):null;return s&&s.evaluate?s.evaluate(i,r,n):s}))}function Gm(e,t){return t-e}Ma(Vm,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});var qm=24;const Hm=128;function Zm(e,t){const{expression:i}=t;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new Qa(e+1))};if("source"===i.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:r}=i;let n=0;for(;n<t.length&&t[n]<=e;)n++;n=Math.max(0,n-1);let o=n;for(;o<t.length&&t[o]<e+1;)o++;o=Math.min(t.length-1,o);const s=t[n],a=t[o];return"composite"===i.kind?{kind:"composite",minZoom:s,maxZoom:a,interpolationType:r}:{kind:"camera",minZoom:s,maxZoom:a,minSize:i.evaluate(new Qa(s)),maxSize:i.evaluate(new Qa(a)),interpolationType:r}}}function Wm(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:n}){return"source"===e.kind?r/Hm:"composite"===e.kind?qr(r/Hm,n/Hm,i):t}function Xm(e,t){let i=0,r=0;if("constant"===e.kind)r=e.layoutSize;else if("source"!==e.kind){const{interpolationType:n,minZoom:o,maxZoom:s}=e,a=n?Yt(ws.interpolationFactor(n,t,o,s),0,1):0;"camera"===e.kind?r=qr(e.minSize,e.maxSize,a):i=a}return{uSizeT:i,uSize:r}}var Qm=Object.freeze({__proto__:null,SIZE_PACK_FACTOR:Hm,evaluateSizeForFeature:Wm,evaluateSizeForZoom:Xm,getSizeData:Zm});function Ym(e,t,i){return e.sections.forEach((e=>{e.text=function(e,t,i){const r=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?e=e.toLocaleUpperCase():"lowercase"===r&&(e=e.toLocaleLowerCase()),Xa.applyArabicShaping&&(e=Xa.applyArabicShaping(e)),e}(e.text,t,i)})),e}const Jm={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹","â":"â","â":"â"};function Km(e){return"︶"===e||"ï¹"===e||"︸"===e||"ï¹"===e||"ï¹"===e||"︾"===e||"︼"===e||"︺"===e||"ï¸"===e||"ï¹"===e||"ï¸"===e||"ï¸"===e||"ï¸"===e||"ï½"===e||"ï¿£"===e||"ï¸"===e||"ï¸"===e}function e_(e){return"︵"===e||"ï¹"===e||"︷"===e||"ï¹"===e||"ï¹"===e||"︽"===e||"︻"===e||"︹"===e||"ï¸"===e||"︿"===e}const t_=3;function i_(e,t,i){t.glyphs=[],1===e&&i.readMessage(r_,t)}function r_(e,t,i){if(3===e){const{id:e,bitmap:r,width:n,height:o,left:s,top:a,advance:l}=i.readMessage(n_,{});t.glyphs.push({id:e,bitmap:new mp({width:n+2*t_,height:o+2*t_},r),metrics:{width:n,height:o,left:s,top:a,advance:l}})}else 4===e?t.ascender=i.readSVarint():5===e&&(t.descender=i.readSVarint())}function n_(e,t,i){1===e?t.id=i.readVarint():2===e?t.bitmap=i.readBytes():3===e?t.width=i.readVarint():4===e?t.height=i.readVarint():5===e?t.left=i.readSVarint():6===e?t.top=i.readSVarint():7===e&&(t.advance=i.readVarint())}const o_=t_,s_={horizontal:1,vertical:2,horizontalOnly:3};class a_{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,t){const i=new a_;return i.scale=e||1,i.fontStack=t,i}static forImage(e){const t=new a_;return t.imageName=e,t}}class l_{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t){const i=new l_;for(let r=0;r<e.sections.length;r++){const n=e.sections[r];n.image?i.addImageSection(n):i.addTextSection(n,t)}return i}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(e,t){let i="";for(let r=0;r<e.length;r++){const n=e.charCodeAt(r+1)||null,o=e.charCodeAt(r-1)||null;i+=!t&&(n&&za(n)&&!Jm[e[r+1]]||o&&za(o)&&!Jm[e[r-1]])||!Jm[e[r]]?e[r]:Jm[e[r]]}return i}(this.text,e)}trim(){let e=0;for(let t=0;t<this.text.length&&u_[this.text.charCodeAt(t)];t++)e++;let t=this.text.length;for(let i=this.text.length-1;i>=0&&i>=e&&u_[this.text.charCodeAt(i)];i--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){const i=new l_;return i.text=this.text.substring(e,t),i.sectionIndex=this.sectionIndex.slice(e,t),i.sections=this.sections,i}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(a_.forText(e.scale,e.fontStack||t));const i=this.sections.length-1;for(let t=0;t<e.text.length;++t)this.sectionIndex.push(i)}addImageSection(e){const t=e.image?e.image.namePrimary:"";if(0===t.length)return void fi("Can't add FormattedSection with an empty image.");const i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCodePoint(i),this.sections.push(a_.forImage(t)),this.sectionIndex.push(this.sections.length-1)):fi("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function c_(e,t,i,r,n,o,s,a,l,c,u,h,p,d,f){const m=l_.fromFeature(e,n);h===s_.vertical&&m.verticalizePunctuation(p);let _=[];const g=function(e,t,i,r,n,o){if(!e)return[];const s=[],a=function(e,t,i,r,n,o){let s=0;for(let i=0;i<e.length();i++){const a=e.getSection(i);s+=p_(e.getCodePoint(i),a,r,n,t,o)}return s/Math.max(1,Math.ceil(s/i))}(e,t,i,r,n,o),l=e.text.indexOf("â")>=0;let c=0;for(let i=0;i<e.length();i++){const h=e.getSection(i),p=e.getCodePoint(i);if(u_[p]||(c+=p_(p,h,r,n,t,o)),i<e.length()-1){const t=!((u=p)<11904||!(Ia["Bopomofo Extended"](u)||Ia.Bopomofo(u)||Ia["CJK Compatibility Forms"](u)||Ia["CJK Compatibility Ideographs"](u)||Ia["CJK Compatibility"](u)||Ia["CJK Radicals Supplement"](u)||Ia["CJK Strokes"](u)||Ia["CJK Symbols and Punctuation"](u)||Ia["CJK Unified Ideographs Extension A"](u)||Ia["CJK Unified Ideographs"](u)||Ia["Enclosed CJK Letters and Months"](u)||Ia["Halfwidth and Fullwidth Forms"](u)||Ia.Hiragana(u)||Ia["Ideographic Description Characters"](u)||Ia["Kangxi Radicals"](u)||Ia["Katakana Phonet
1ic Extensions"](u)||Ia.Katakana(u)||Ia["Vertical Forms"](u)||Ia["Yi Radicals"](u)||Ia["Yi Syllables"](u)));(h_[p]||t||h.imageName)&&s.push(m_(i+1,c,a,s,f_(p,e.getCodePoint(i+1),t&&l),!1))}}var u;return __(m_(e.length(),c,a,s,0,!0))}(m,c,o,t,r,d),{processBidirectionalText:y,processStyledBidirectionalText:v}=Xa;if(y&&1===m.sections.length){const e=y(m.toString(),g);for(const t of e){const e=new l_;e.text=t,e.sections=m.sections;for(let i=0;i<t.length;i++)e.sectionIndex.push(0);_.push(e)}}else if(v){const e=v(m.text,m.sectionIndex,g);for(const t of e){const e=new l_;e.text=t[0],e.sectionIndex=t[1],e.sections=m.sections,_.push(e)}}else _=function(e,t){const i=[],r=e.text;let n=0;for(const r of t)i.push(e.substring(n,r)),n=r;return n<r.length&&i.push(e.substring(n,r.length)),i}(m,g);const x=[],b={positionedLines:x,text:m.toString(),top:u[1],bottom:u[1],left:u[0],right:u[0],writingMode:h,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(e,t,i,r,n,o,s,a,l,c,u,h){let p=0,d=0,f=0;const m="right"===a?1:"left"===a?0:.5;let _=!1;for(const e of n){const i=e.getSections();for(const e of i){if(e.imageName)continue;const i=t[e.fontStack];if(i&&(_=void 0!==i.ascender&&void 0!==i.descender,!_))break}if(!_)break}let g=0;for(const s of n){s.trim();const n=s.getMaxScale(),a=(n-1)*qm,v={positionedGlyphs:[],lineOffset:0};e.positionedLines[g]=v;const x=v.positionedGlyphs;let b=0;if(!s.length()){d+=o,++g;continue}let w=0,T=0;for(let o=0;o<s.length();o++){const a=s.getSection(o),f=s.getSectionIndex(o),m=s.getCodePoint(o);let g=a.scale,v=null,M=null,E=null,S=qm,C=0;const A=!(l===s_.horizontal||!u&&!Ra(m)||u&&(u_[m]||(y=m,Ia.Arabic(y)||Ia["Arabic Supplement"](y)||Ia["Arabic Extended-A"](y)||Ia["Arabic Presentation Forms-A"](y)||Ia["Arabic Presentation Forms-B"](y))));if(a.imageName){const t=r[a.imageName];if(!t)continue;E=a.imageName,e.iconsInText=e.iconsInText||!0,M=t.paddedRect;const i=t.displaySize;g=g*qm/h,v={width:i[0],height:i[1],left:0,top:-o_,advance:A?i[1]:i[0],localGlyph:!1},C=_?-v.height*g:n*qm-17-i[1]*g,S=v.advance;const o=(A?i[0]:i[1])*g-qm*n;o>0&&o>b&&(b=o)}else{const e=i[a.fontStack];if(!e)continue;e[m]&&(M=e[m]);const r=t[a.fontStack];if(!r)continue;const o=r.glyphs[m];if(!o)continue;if(v=o.metrics,S=8203!==m?qm:0,_){const e=void 0!==r.ascender?Math.abs(r.ascender):0,t=void 0!==r.descender?Math.abs(r.descender):0,i=(e+t)*g;w<i&&(w=i,T=(e-t)/2*g),C=-e*g}else C=(n-g)*qm-17}A?(e.verticalizable=!0,x.push({glyph:m,imageName:E,x:p,y:d+C,vertical:A,scale:g,localGlyph:v.localGlyph,fontStack:a.fontStack,sectionIndex:f,metrics:v,rect:M}),p+=S*g+c):(x.push({glyph:m,imageName:E,x:p,y:d+C,vertical:A,scale:g,localGlyph:v.localGlyph,fontStack:a.fontStack,sectionIndex:f,metrics:v,rect:M}),p+=v.advance*g+c)}0!==x.length&&(f=Math.max(p-c,f),_?y_(x,m,b,T,o*n/2):y_(x,m,b,0,o/2)),p=0;const M=o*n+b;v.lineOffset=Math.max(b,a),d+=M,++g}var y;const v=d,{horizontalAlign:x,verticalAlign:b}=g_(s);(function(e,t,i,r,n,o){const s=(t-i)*n,a=-o*r;for(const t of e)for(const e of t.positionedGlyphs)e.x+=s,e.y+=a})(e.positionedLines,m,x,b,f,v),e.top+=-b*v,e.bottom=e.top+v,e.left+=-x*f,e.right=e.left+f,e.hasBaseline=_}(b,t,i,r,_,s,a,l,h,c,p,f),!function(e){for(const t of e)if(0!==t.positionedGlyphs.length)return!1;return!0}(x)&&b}const u_={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},h_={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function p_(e,t,i,r,n,o){if(t.imageName){const e=r[t.imageName];return e?e.displaySize[0]*t.scale*qm/o+n:0}{const r=i[t.fontStack],o=r&&r.glyphs[e];return o?o.metrics.advance*t.scale+n:0}}function d_(e,t,i,r){const n=Math.pow(e-t,2);return r?e<t?n/2:2*n:n+Math.abs(i)*i}function f_(e,t,i){let r=0;return 10===e&&(r-=1e4),i&&(r+=150),40!==e&&65288!==e||(r+=50),41!==t&&65289!==t||(r+=50),r}function m_(e,t,i,r,n,o){let s=null,a=d_(t,i,n,o);for(const e of r){const r=d_(t-e.x,i,n,o)+e.badness;r<=a&&(s=e,a=r)}return{index:e,x:t,priorBreak:s,badness:a}}function __(e){return e?__(e.priorBreak).concat(e.index):[]}function g_(e){let t=.5,i=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:t,verticalAlign:i}}function y_(e,t,i,r,n){if(!(t||i||r||n))return;const o=e.length-1,s=e[o],a=(s.x+s.metrics.advance*s.scale)*t;for(let t=0;t<=o;t++)e[t].x-=a,e[t].y+=i+r+n}function v_(e,t,i,r){const{horizontalAlign:n,verticalAlign:o}=g_(r),s=i[0]-e.displaySize[0]*n,a=i[1]-e.displaySize[1]*o;return{imagePrimary:e,imageSecondary:t,top:a,bottom:a+e.displaySize[1],left:s,right:s+e.displaySize[0]}}function x_(e,t,i,r,n,o){const s=e.imagePrimary;let a;if(s.content){const e=s.content,t=s.pixelRatio||1;a=[e[0]/t,e[1]/t,s.displaySize[0]-e[2]/t,s.displaySize[1]-e[3]/t]}const l=t.left*o,c=t.right*o;let u,h,p,d;"width"===i||"both"===i?(d=n[0]+l-r[3],h=n[0]+c+r[1]):(d=n[0]+(l+c-s.displaySize[0])/2,h=d+s.displaySize[0]);const f=t.top*o,m=t.bottom*o;return"height"===i||"both"===i?(u=n[1]+f-r[0],p=n[1]+m+r[2]):(u=n[1]+(f+m-s.displaySize[1])/2,p=u+s.displaySize[1]),{imagePrimary:s,imageSecondary:void 0,top:u,right:h,bottom:p,left:d,collisionPadding:a}}class b_ extends Ut{constructor(e,t,i,r,n){super(e,t),this.angle=r,this.z=i,void 0!==n&&(this.segment=n)}clone(){return new b_(this.x,this.y,this.z,this.angle,this.segment)}}function w_(e,t,i,r,n){if(void 0===t.segment)return!0;let o=t,s=t.segment+1,a=0;for(;a>-i/2;){if(s--,s<0)return!1;a-=e[s].dist(o),o=e[s]}a+=e[s].dist(e[s+1]),s++;const l=[];let c=0;for(;a<i/2;){const t=e[s],i=e[s+1];if(!i)return!1;let o=e[s-1].angleTo(t)-t.angleTo(i);for(o=Math.abs((o+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:a,angleDelta:o}),c+=o;a-l[0].distance>r;)c-=l.shift().angleDelta;if(c>n)return!1;s++,a+=t.dist(i)}return!0}function T_(e){let t=0;for(let i=0;i<e.length-1;i++)t+=e[i].dist(e[i+1]);return t}function M_(e,t,i){return e?.6*t*i:0}function E_(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function S_(e,t,i,r,n,o){const s=M_(i,n,o),a=E_(i,r)*o;let l=0;const c=T_(e)/2;for(let i=0;i<e.length-1;i++){const r=e[i],n=e[i+1],o=r.dist(n);if(l+o>c){const u=(c-l)/o,h=qr(r.x,n.x,u),p=qr(r.y,n.y,u),d=new b_(h,p,0,n.angleTo(r),i);return!s||w_(e,d,a,s,t)?d:void 0}l+=o}}function C_(e,t,i,r,n,o,s,a,l){const c=M_(r,o,s),u=E_(r,n),h=u*s,p=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h<t/4&&(t=h+t/4),A_(e,p?t/2*a%t:(u/2+2*o)*s*a%t,t,c,i,h,p,!1,l)}function A_(e,t,i,r,n,o,s,a,l){const c=o/2,u=T_(e);let h=0,p=t-i,d=[];for(let t=0;t<e.length-1;t++){const s=e[t],a=e[t+1],f=s.dist(a),m=a.angleTo(s);for(;p+i<h+f;){p+=i;const _=(p-h)/f,g=qr(s.x,a.x,_),y=qr(s.y,a.y,_);if(g>=0&&g<l&&y>=0&&y<l&&p-c>=0&&p+c<=u){const i=new b_(g,y,0,m,t);r&&!w_(e,i,o,r,n)||d.push(i)}}h+=f}return a||d.length||s||(d=A_(e,h/2,i,r,n,o,s,!0,l)),d}function I_(e,t,i,r,n){const o=[];for(let s=0;s<e.length;s++){const a=e[s];let l;for(let e=0;e<a.length-1;e++){let s=a[e],c=a[e+1];s.x<t&&c.x<t||(s.x<t?s=new Ut(t,s.y+(t-s.x)/(c.x-s.x)*(c.y-s.y))._round():c.x<t&&(c=new Ut(t,s.y+(t-s.x)/(c.x-s.x)*(c.y-s.y))._round()),s.y<i&&c.y<i||(s.y<i?s=new Ut(s.x+(i-s.y)/(c.y-s.y)*(c.x-s.x),i)._round():c.y<i&&(c=new Ut(s.x+(i-s.y)/(c.y-s.y)*(c.x-s.x),i)._round()),s.x>=r&&c.x>=r||(s.x>=r?s=new Ut(r,s.y+(r-s.x)/(c.x-s.x)*(c.y-s.y))._round():c.x>=r&&(c=new Ut(r,s.y+(r-s.x)/(c.x-s.x)*(c.y-s.y))._round()),s.y>=n&&c.y>=n||(s.y>=n?s=new Ut(s.x+(n-s.y)/(c.y-s.y)*(c.x-s.x),n)._round():c.y>=n&&(c=new Ut(s.x+(n-s.y)/(c.y-s.y)*(c.x-s.x),n)._round()),l&&s.equals(l[l.length-1])||(l=[s],o.push(l)),l.push(c)))))}}return o}function k_(e){let t=0,i=0;
vendor: 21,921 bytes, line 1
1for(const r of e)t+=r.w*r.h,i=Math.max(i,r.w);e.sort(((e,t)=>t.h-e.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),i),h:1/0}];let n=0,o=0;for(const t of e)for(let e=r.length-1;e>=0;e--){const i=r[e];if(!(t.w>i.w||t.h>i.h)){if(t.x=i.x,t.y=i.y,o=Math.max(o,t.y+t.h),n=Math.max(n,t.x+t.w),t.w===i.w&&t.h===i.h){const t=r.pop();e<r.length&&(r[e]=t)}else t.h===i.h?(i.x+=t.w,i.w-=t.w):t.w===i.w?(i.y+=t.h,i.h-=t.h):(r.push({x:i.x+t.w,y:i.y,w:i.w-t.w,h:t.h}),i.y+=t.h,i.h-=t.h);break}}return{w:n,h:o,fill:t/(n*o)||0}}Ma(b_,"Anchor");const L_=1;class P_{constructor(e,{pixelRatio:t,version:i,stretchX:r,stretchY:n,content:o}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=r,this.stretchY=n,this.content=o,this.version=i}get tl(){return[this.paddedRect.x+L_,this.paddedRect.y+L_]}get br(){return[this.paddedRect.x+this.paddedRect.w-L_,this.paddedRect.y+this.paddedRect.h-L_]}get displaySize(){return[(this.paddedRect.w-2*L_)/this.pixelRatio,(this.paddedRect.h-2*L_)/this.pixelRatio]}}class R_{constructor(e,t,i){const r={},n={};this.haveRenderCallbacks=[];const o=[];this.addImages(e,r,o),this.addImages(t,n,o);const{w:s,h:a}=k_(o),l=new _p({width:s||1,height:a||1});for(const t in e){const n=e[t],o=r[t].paddedRect;_p.copy(n.data,l,{x:0,y:0},{x:o.x+L_,y:o.y+L_},n.data,i,n.sdf)}for(const e in t){const r=t[e],o=n[e].paddedRect,s=o.x+L_,a=o.y+L_,c=r.data.width,u=r.data.height;_p.copy(r.data,l,{x:0,y:0},{x:s,y:a},r.data,i),_p.copy(r.data,l,{x:0,y:u-1},{x:s,y:a-1},{width:c,height:1},i),_p.copy(r.data,l,{x:0,y:0},{x:s,y:a+u},{width:c,height:1},i),_p.copy(r.data,l,{x:c-1,y:0},{x:s-1,y:a},{width:1,height:u},i),_p.copy(r.data,l,{x:0,y:0},{x:s+c,y:a},{width:1,height:u},i)}this.image=l,this.iconPositions=r,this.patternPositions=n}addImages(e,t,i){for(const r in e){const n=e[r],o={x:0,y:0,w:n.data.width+2*L_,h:n.data.height+2*L_};i.push(o),t[r]=new P_(o,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(e,t,i){this.haveRenderCallbacks=this.haveRenderCallbacks.filter((t=>e.hasImage(t,i))),e.dispatchRenderCallbacks(this.haveRenderCallbacks,i);for(const r in e.getUpdatedImages(i))this.patchUpdatedImage(this.iconPositions[r],e.getImage(r,i),t),this.patchUpdatedImage(this.patternPositions[r],e.getImage(r,i),t)}patchUpdatedImage(e,t,i){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[r,n]=e.tl,o=!!Object.keys(this.patternPositions).length;i.update(t.data,{useMipmap:o},{x:r,y:n})}}Ma(P_,"ImagePosition"),Ma(R_,"ImageAtlas");const z_=1e20;function O_(e,t,i,r,n,o,s,a,l){for(let c=t;c<t+r;c++)D_(e,i*o+c,o,n,s,a,l);for(let c=i;c<i+n;c++)D_(e,c*o+t,1,r,s,a,l)}function D_(e,t,i,r,n,o,s){o[0]=0,s[0]=-z_,s[1]=z_,n[0]=e[t];for(let a=1,l=0,c=0;a<r;a++){n[a]=e[t+a*i];const r=a*a;do{const e=o[l];c=(n[a]-n[e]+r-e*e)/(a-e)/2}while(c<=s[l]&&--l>-1);l++,o[l]=a,s[l]=c,s[l+1]=z_}for(let a=0,l=0;a<r;a++){for(;s[l+1]<a;)l++;const r=o[l],c=a-r;e[t+a*i]=n[r]+c*c}}const F_=2,B_={none:0,ideographs:1,all:2};class N_{constructor(e,t,i){this.requestManager=e,this.localGlyphMode=t,this.localFontFamily=i,this.urls={},this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e,t){this.urls[t]=e}getGlyphs(e,t,i){const n=[],o=this.urls[t]||r.GLYPHS_URL;for(const t in e)for(const i of e[t])n.push({stack:t,id:i});ei(n,(({stack:e,id:t},i)=>{let r=this.entries[e];r||(r=this.entries[e]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let n=r.glyphs[t];if(void 0!==n)return void i(null,{stack:e,id:t,glyph:n});if(n=this._tinySDF(r,e,t),n)return r.glyphs[t]=n,void i(null,{stack:e,id:t,glyph:n});const s=Math.floor(t/256);if(256*s>65535)return void i(new Error("glyphs > 65535 not supported"));if(r.ranges[s])return void i(null,{stack:e,id:t,glyph:n});let a=r.requests[s];a||(a=r.requests[s]=[],N_.loadGlyphRange(e,s,o,this.requestManager,((e,t)=>{if(t){r.ascender=t.ascender,r.descender=t.descender;for(const e in t.glyphs)this._doesCharSupportLocalGlyph(+e)||(r.glyphs[+e]=t.glyphs[+e]);r.ranges[s]=!0}for(const i of a)i(e,t);delete r.requests[s]}))),a.push(((r,n)=>{r?i(r):n&&i(null,{stack:e,id:t,glyph:n.glyphs[t]||null})}))}),((e,t)=>{if(e)i(e);else if(t){const e={};for(const{stack:i,id:r,glyph:n}of t)void 0===e[i]&&(e[i]={}),void 0===e[i].glyphs&&(e[i].glyphs={}),e[i].glyphs[r]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics},e[i].ascender=this.entries[i].ascender,e[i].descender=this.entries[i].descender;i(null,e)}}))}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==B_.none&&(this.localGlyphMode===B_.all?!!this.localFontFamily:!!this.localFontFamily&&(Ia["CJK Unified Ideographs"](e)||Ia["Hangul Syllables"](e)||Ia.Hiragana(e)||Ia.Katakana(e)||Ia["CJK Symbols and Punctuation"](e)||Ia["CJK Unified Ideographs Extension A"](e)||Ia["CJK Unified Ideographs Extension B"](e)))}_tinySDF(e,t,i){const r=this.localFontFamily;if(!r||!this._doesCharSupportLocalGlyph(i))return;let n=e.tinySDF;if(!n){let i="400";/bold/i.test(t)?i="900":/medium/i.test(t)?i="500":/light/i.test(t)&&(i="200"),n=e.tinySDF=new N_.TinySDF({fontFamily:r,fontWeight:i,fontSize:24*F_,buffer:3*F_,radius:8*F_}),n.fontWeight=i}if(this.localGlyphs[n.fontWeight][i])return this.localGlyphs[n.fontWeight][i];const o=String.fromCodePoint(i),{data:s,width:a,height:l,glyphWidth:c,glyphHeight:u,glyphLeft:h,glyphTop:p,glyphAdvance:d}=n.draw(o);return this.localGlyphs[n.fontWeight][i]={id:i,bitmap:new mp({width:a,height:l},s),metrics:{width:c/F_,height:u/F_,left:h/F_,top:p/F_-27,advance:d/F_,localGlyph:!0}}}}N_.loadGlyphRange=function(e,t,i,r,n){const o=256*t,s=o+255,a=r.transformRequest(r.normalizeGlyphsURL(i).replace("{fontstack}",e).replace("{range}",`${o}-${s}`),Ki.Glyphs);rr(a,((e,t)=>{if(e)n(e);else if(t){const e={},i=function(e){return new Bm(e).readFields(i_,{})}(t);for(const t of i.glyphs)e[t.id]=t;n(null,{glyphs:e,ascender:i.ascender,descender:i.descender})}}))},N_.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:s="normal"}={}){this.buffer=t,this.cutoff=r,this.radius=i;const a=this.size=e+4*t,l=this._createCanvas(a),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font=`${s} ${o} ${e}px ${n}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(e){const t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){const{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(e),s=Math.ceil(i),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-n))),l=Math.min(this.size-this.buffer,s+Math.ceil(r)),c=a+2*this.buffer,u=l+2*this.buffer,h=Math.max(c*u,0),p=new Uint8ClampedArray(h),d={data:p,width:c,height:u,glyphWidth:a,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:t};if(0===a||0===l)return d;const{ctx:f,buffer:m,gridInner:_,gridOuter:g}=this;f.clearRect(m,m,a,l),f.fillText(e,m,m+s);const y=f.getImageData(m,m,a,l);g.fill(z_,0,h),_.fill(0,0,h);for(let e=0;e<l;e++)for(let t=0;t<a;t++){const i=y.data[4*(e*a+t)+3]/255;if(0===i)continue;const r=(e+m)*c+t+m;if(1===i)g[r]=0,_[r]=z_;else{const e=.5-i;g[r]=e>0?e*e:0,_[r]=e<0?e*e:0}}O_(g,0,0,c,u,c,this.f,this.v,this.z),O_(_,m,m,a,l,c,this.f,this.v,this.z);for(let e=0;e<h;e++){const t=Math.sqrt(g[e])-Math.sqrt(_[e]);p[e]=Math.round(255-255*(t/this.radius+this.cutoff))}return d}};const j_=L_;function U_(e,t,i,r){const n=[],o=e.imagePrimary,s=o.pixelRatio,a=o.paddedRect.w-2*j_,l=o.paddedRect.h-2*j_,c=e.right-e.left,u=e.bottom-e.top,h=o.stretchX||[[0,a]],p=o.stretchY||[[0,l]],d=(e,t)=>e+t[1]-t[0],f=h.reduce(d,0),m=p.reduce(d,0),_=a-f,g=l-m;let y=0,v=f,x=0,b=m,w=0,T=_,M=0,E=g;if(o.content&&r){const e=o.content;y=V_(h,0,e[0]),x=V_(p,0,e[1]),v=V_(h,e[0],e[2]),b=V_(p,e[1],e[3]),w=e[0]-y,M=e[1]-x,T=e[2]-e[0]-v,E=e[3]-e[1]-b}const S=(r,n,a,l)=>{const h=G_(r.stretch-y,v,c,e.left),p=q_(r.fixed-w,T,r.stretch,f),d=G_(n.stretch-x,b,u,e.top),_=q_(n.fixed-M,E,n.stretch,m),g=G_(a.stretch-y,v,c,e.left),S=q_(a.fixed-w,T,a.stretch,f),C=G_(l.stretch-x,b,u,e.top),A=q_(l.fixed-M,E,l.stretch,m),I=new Ut(h,d),k=new Ut(g,d),L=new Ut(g,C),P=new Ut(h,C),R=new Ut(p/s,_/s),z=new Ut(S/s,A/s),O=t*Math.PI/180;if(O){const e=Math.sin(O),t=Math.cos(O),i=[t,-e,e,t];I._matMult(i),k._matMult(i),P._matMult(i),L._matMult(i)}const D=r.stretch+r.fixed,F=a.stretch+a.fixed,B=n.stretch+n.fixed,N=l.stretch+l.fixed,j=e.imageSecondary;return{tl:I,tr:k,bl:P,br:L,texPrimary:{x:o.paddedRect.x+j_+D,y:o.paddedRect.y+j_+B,w:F-D,h:N-B},texSecondary:j?{x:j.paddedRect.x+j_+D,y:j.paddedRect.y+j_+B,w:F-D,h:N-B}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:R,pixelOffsetBR:z,minFontScaleX:T/s/c,minFontScaleY:E/s/u,isSDF:i}};if(r&&(o.stretchX||o.stretchY)){const e=$_(h,_,f),t=$_(p,g,m);for(let i=0;i<e.length-1;i++){const r=e[i],o=e[i+1];for(let e=0;e<t.length-1;e++)n.push(S(r,t[e],o,t[e+1]))}}else n.push(S({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:a+1},{fixed:0,stretch:l+1}));return n}function V_(e,t,i){let r=0;for(const n of e)r+=Math.max(t,Math.min(i,n[1]))-Math.max(t,Math.min(i,n[0]));return r}function $_(e,t,i){const r=[{fixed:-j_,stretch:0}];for(const[t,i]of e){const e=r[r.length-1];r.push({fixed:t-e.stretch,stretch:e.stretch}),r.push({fixed:t-e.stretch,stretch:e.stretch+(i-t)})}return r.push({fixed:t+j_,stretch:i}),r}function G_(e,t,i,r){return e/t*i+r}function q_(e,t,i,r){return e-t*i/r}function H_(e,t,i,r){const n=t+e.positionedLines[r].lineOffset;return 0===r?i+n/2:i+(n+(t+e.positionedLines[r-1].lineOffset))/2}function Z_(e,t=1,i=!1){let r=1/0,n=1/0,o=-1/0,s=-1/0;const a=e[0];for(let e=0;e<a.length;e++){const t=a[e];(!e||t.x<r)&&(r=t.x),(!e||t.y<n)&&(n=t.y),(!e||t.x>o)&&(o=t.x),(!e||t.y>s)&&(s=t.y)}const l=Math.min(o-r,s-n);let c=l/2;const u=new po([],W_);if(0===l)return new Ut(r,n);for(let t=r;t<o;t+=l)for(let i=n;i<s;i+=l)u.push(new X_(t+c,i+c,c,e));let h=function(e){let t=0,i=0,r=0;const n=e[0];for(let e=0,o=n.length,s=o-1;e<o;s=e++){const o=n[e],a=n[s],l=o.x*a.y-a.x*o.y;i+=(o.x+a.x)*l,r+=(o.y+a.y)*l,t+=3*l}return new X_(i/t,r/t,0,e)}(e),p=u.length;for(;u.length;){const r=u.pop();(r.d>h.d||!h.d)&&(h=r,i&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,p)),r.max-h.d<=t||(c=r.h/2,u.push(new X_(r.p.x-c,r.p.y-c,c,e)),u.push(new X_(r.p.x+c,r.p.y-c,c,e)),u.push(new X_(r.p.x-c,r.p.y+c,c,e)),u.push(new X_(r.p.x+c,r.p.y+c,c,e)),p+=4)}return i&&(console.log(`num probes: ${p}`),console.log(`best distance: ${h.d}`)),h.p}function W_(e,t){return t.max-e.max}class X_{constructor(e,t,i,r){this.p=new Ut(e,t),this.h=i,this.d=function(e,t){let i=!1,r=1/0;for(let n=0;n<t.length;n++){const o=t[n];for(let t=0,n=o.length,s=n-1;t<n;s=t++){const n=o[t],a=o[s];n.y>e.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(i=!i),r=Math.min(r,ah(e,n,a))}}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}}const Q_=Number.POSITIVE_INFINITY,Y_=Math.sqrt(2);function J_(e,[t,i]){let r=0,n=0;if(i===Q_){t<0&&(t=0);const i=t/Y_;switch(e){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-t;break;case"top":n=t-7}switch(e){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=t;break;case"right":r=-t}}else{switch(t=Math.abs(t),i=Math.abs(i),e){case"top-right":case"top-left":case"top":n=i-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-i}switch(e){case"top-right":case"bottom-right":case"right":r=-t;break;case"top-left":case"bottom-left":case"left":r=t}}return[r,n]}function K_(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function eg(e,t,i,r,n,o,s,a,l,c,u,h,p,d,f){let m=o.textMaxSize.evaluate(t,{},h);void 0===m&&(m=s);const _=e.layers[0].layout,g=_.get("icon-offset").evaluate(t,{},h),y=ng(i.horizontal)||i.vertical,v="globe"===p.name,x=qm,b=s/x,w=e.tilePixelRatio*m/x,T=(L=e.overscaling,e.zoom>18&&L>2&&(L>>=1),Math.max(fo/(512*L),1)*_.get("symbol-spacing")),M=_.get("text-padding")*e.tilePixelRatio,E=_.get("icon-padding")*e.tilePixelRatio,S=qt(_.get("text-max-angle")),C="map"===_.get("text-rotation-alignment")&&"point"!==_.get("symbol-placement"),A="map"===_.get("icon-rotation-alignment")&&"point"!==_.get("symbol-placement"),I=_.get("symbol-placement"),k=T/2;var L;const P=_.get("icon-text-fit").evaluate(t,{},h),R=_.get("icon-text-fit-padding").evaluate(t,{},h),z="none"!==P;let O;!1===e.hasAnyIconTextFit&&z&&(e.hasAnyIconTextFit=!0),r&&z&&(e.allowVerticalPlacement&&i.vertical&&(O=x_(r,i.vertical,P,R,g,b)),y&&(r=x_(r,y,P,R,g,b)));const D=(s,a,m)=>{if(a.x<0||a.x>=fo||a.y<0||a.y>=fo)return;let _=null;if(v){const{x:e,y:t,z:i}=p.projectTilePoint(a.x,a.y,m);_={anchor:new b_(e,t,i,0,void 0),up:p.upVector(m,a.x,a.y)}}!function(e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_,g,y,v,x,b,w,T,M,E,S){const C=e.addToLineVertexArray(t,r);let A,I,k,L,P,R,z,O=0,D=0,F=0,B=0,N=-1,j=-1;const U={};let V=Pr("");const $=i?i.anchor:t,G="none"!==l.layout.get("icon-text-fit").evaluate(x,{},M);let q=0,H=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?[q,H]=l.layout.get("text-offset").evaluate(x,{},M).map((e=>e*qm)):(q=l.layout.get("text-radial-offset").evaluate(x,{},M)*qm,H=Q_),e.allowVerticalPlacement&&n.vertical){const e=n.vertical;if(f)R=sg(e),a&&(z=sg(a));else{const i=l.layout.get("text-rotate").evaluate(x,{},M)+90;k=og(c,$,t,u,h,p,e,d,i,m),a&&(L=og(c,$,t,u,h,p,a,g,i))}}if(o){const r=l.layout.get("icon-rotate").evaluate(x,{},M),n=U_(o,r,w,G),s=a?U_(a,r,w,G):void 0;I=og(c,$,t,u,h,p,o,g,r),O=4*n.length;const d=e.iconSizeData;let f=null;"source"===d.kind?(f=[Hm*l.layout.get("icon-size").evaluate(x,{},M)],f[0]>ig&&fi(`${e.layerIds[0]}: Value for "icon-size" is >= ${tg}. Reduce your "icon-size".`)):"composite"===d.kind&&(f=[Hm*b.compositeIconSizes[0].evaluate(x,{},M),Hm*b.compositeIconSizes[1].evaluate(x,{},M)],(f[0]>ig||f[1]>ig)&&fi(`${e.layerIds[0]}: Value for "icon-size" is >= ${tg}. Reduce your "icon-size".`)),e.addSymbols(e.icon,n,f,v,y,x,!1,i,t,C.lineStartIndex,C.lineLength,-1,T,M,E,S),N=e.icon.placedSymbolArray.length-1,s&&(D=4*s.length,e.addSymbols(e.icon,s,f,v,y,x,s_.vertical,i,t,C.lineStartIndex,C.lineLength,-1,T,M,E,S),j=e.icon.placedSymbolArray.length-1)}for(const r in n.horizontal){const o=n.horizontal[r];A||(V=Pr(o.text),f?P=sg(o):A=og(c,$,t,u,h,p,o,d,l.layout.get("text-rotate").evaluate(x,{},M),m));const a=1===o.positionedLines.length;if(F+=rg(e,i,t,o,s,l,f,x,m,C,n.vertical?s_.horizontal:s_.horizontalOnly,a?Object.keys(n.horizontal):[r],U,N,b,T,M,E),a)break}n.vertical&&(B+=rg(e,i,t,n.vertical,s,l,f,x,m,C,s_.vertical,["vertical"],U,j,b,T,M,E));let Z=-1;const W=(e,t)=>e?Math.max(e,t):t;Z=W(P,Z),Z=W(R,Z),Z=W(z,Z);const X=Z>-1?1:0;e.glyphOffsetArray.length>=65535&&fi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,x.sortKey),e.symbolInstances.emplaceBack(t.x,t.y,$.x,$.y,$.z,U.right>=0?U.right:-1,U.center>=0?U.center:-1,U.left>=0?U.left:-1,U.vertical>=0?U.vertical:-1,N,j,V,void 0!==A?A:e.collisionBoxArray.length,void 0!==A?A+1:e.collisionBoxArray.length,void 0!==k?k:e.collisionBoxArray.length,void 0!==k?k+1:e.collisionBoxArray.length,void 0!==I?I:e.collisionBoxArray.length,void 0!==I?I+1:e.collisionBoxArray.length,L||e.collisionBoxArray.length,L?L+1:e.collisionBoxArray.length,u,F,B,O,D,X,0,q,H,Z,0,G?1:0)}(e,a,_,s,i,r,n,O,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,M,C,l,0,E,A,g,t,o,c,u,h,d,f)};if("line"===I)for(const n of I_(t.geometry,0,0,fo,fo)){const t=C_(n,T,S,i.vertical||y,r,x,w,e.overscaling,fo);for(const i of t)y&&ag(e,y.text,k,i)||D(n,i,h)}else if("line-center"===I){for(const e of t.geometry)if(e.length>1){const t=S_(e,S,i.vertical||y,r,x,w);t&&D(e,t,h)}}else if("Polygon"===t.type)for(const e of Qp(t.geometry,0)){const t=Z_(e,16);D(e[0],new b_(t.x,t.y,0,0,void 0),h)}else if("LineString"===t.type)for(const e of t.geometry)D(e,new b_(e[0].x,e[0].y,0,0,void 0),h);else if("Point"===t.type)for(const e of t.geometry)for(const t of e)D([t],new b_(t.x,t.y,0,0,void 0),h)}const tg=255,ig=tg*Hm;function rg(e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_,g){const y=function(e,t,i,r,n,o,s,a){const l=[];if(0===t.positionedLines.length)return l;const c=r.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=function(e){const t=e[0],i=e[1],r=t*i;return r>0?[t,-i]:r<0?[-t,i]:0===t?[i,t]:[i,-t]}(i);let h=Math.abs(t.top-t.bottom);for(const e of t.positionedLines)h-=e.lineOffset;const p=t.positionedLines.length,d=h/p;let f=t.top-i[1];for(let e=0;e<p;++e){const r=t.positionedLines[e];f=H_(t,d,f,e);for(const e of r.positionedGlyphs){if(!e.rect)continue;const r=e.rect||{};let o=o_+1,h=!0,p=1,d=0;if(e.imageName){const t=s[e.imageName];if(!t)continue;if(t.sdf){fi("SDF images are not supported in formatted text and will be ignored.");continue}h=!1,p=t.pixelRatio,o=L_/p}const m=(n||a)&&e.vertical,_=e.metrics.advance*e.scale/2,g=e.metrics,y=e.rect;if(null===y)continue;a&&t.verticalizable&&(d=e.imageName?_-e.metrics.width*e.scale/2:0);const v=n?[e.x+_,e.y]:[0,0];let x=[0,0],b=[0,0],w=!1;n||(m?(b=[e.x+_+u[0],e.y+u[1]-d],w=!0):x=[e.x+_+i[0],e.y+i[1]-d]);const T=y.w*e.scale/(p*(e.localGlyph?F_:1)),M=y.h*e.scale/(p*(e.localGlyph?F_:1));let E,S,C,A;if(m){const t=e.y-f,i=new Ut(-_,_-t),r=-Math.PI/2,n=new Ut(...b);E=new Ut(-_+x[0],x[1]),E._rotateAround(r,i)._add(n),E.x+=-t+_,E.y-=(g.left-o)*e.scale;const s=e.imageName?g.advance*e.scale:qm*e.scale,a=String.fromCodePoint(e.glyph);Km(a)?E.x+=(1-o)*e.scale:e_(a)?E.x+=s-g.height*e.scale+(-o-1)*e.scale:E.x+=e.imageName||g.width+2*o===y.w&&g.height+2*o===y.h?(s-M)/2:(s-(g.height+2*o)*e.scale)/2,S=new Ut(E.x,E.y-T),C=new Ut(E.x+M,E.y),A=new Ut(E.x+M,E.y-T)}else{const t=(g.left-o)*e.scale-_+x[0],i=(-g.top-o)*e.scale+x[1],r=t+T,n=i+M;E=new Ut(t,i),S=new Ut(r,i),C=new Ut(t,n),A=new Ut(r,n)}if(c){let e;e=n?new Ut(0,0):w?new Ut(u[0],u[1]):new Ut(i[0],i[1]),E._rotateAround(c,e),S._rotateAround(c,e),C._rotateAround(c,e),A._rotateAround(c,e)}const I=new Ut(0,0),k=new Ut(0,0);l.push({tl:E,tr:S,bl:C,br:A,texPrimary:r,texSecondary:void 0,writingMode:t.writingMode,glyphOffset:v,sectionIndex:e.sectionIndex,isSDF:h,pixelOffsetTL:I,pixelOffsetBR:k,minFontScaleX:0,minFontScaleY:0})}}return l}(0,r,l,o,s,a,n,e.allowVerticalPlacement),v=e.textSizeData;let x=null;"source"===v.kind?(x=[Hm*o.layout.get("text-size").evaluate(a,{},_)],x[0]>ig&&fi(`${e.layerIds[0]}: Value for "text-size" is >= ${tg}. Reduce your "text-size".`)):"composite"===v.kind&&(x=[Hm*f.compositeTextSizes[0].evaluate(a,{},_),Hm*f.compositeTextSizes[1].evaluate(a,{},_)],(x[0]>ig||x[1]>ig)&&fi(`${e.layerIds[0]}: Value for "text-size" is >= ${tg}. Reduce your "text-size".`)),e.addSymbols(e.text,y,x,l,s,a,u,t,i,c.lineStartIndex,c.lineLength,d,m,_,g,!1);for(const t of h)p[t]=e.text.placedSymbolArray.length-1;return 4*y.length}function ng(e){for(const t in e)return e[t];return null}function og(e,t,i,r,n,o,s,a,l,c){let u=s.top,h=s.bottom,p=s.left,d=s.right;const f=s.collisionPadding;if(f&&(p-=f[0],u-=f[1],d+=f[2],h+=f[3]),l){const e=new Ut(p,u),t=new Ut(d,u),i=new Ut(p,h),r=new Ut(d,h),n=qt(l);let o=new Ut(0,0);c&&(o=new Ut(c[0],c[1])),e._rotateAround(n,o),t._rotateAround(n,o),i._rotateAround(n,o),r._rotateAround(n,o),p=Math.min(e.x,t.x,i.x,r.x),d=Math.max(e.x,t.x,i.x,r.x),u=Math.min(e.y,t.y,i.y,r.y),h=Math.max(e.y,t.y,i.y,r.y)}return e.emplaceBack(t.x,t.y,t.z,i.x,i.y,p,u,d,h,a,r,n,o),e.length-1}function sg(e){e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);const t=e.bottom-e.top;return t>0?Math.max(10,t):null}function ag(e,t,i,r){const n=e.compareText;if(t in n){const e=n[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])<i)return!0}else n[t]=[];return n[t].push(r),!1}function lg(e,t){const i=e.fovAboveCenter,r=e.elevation?e.elevation.getMinElevationBelowMSL()*t:0,n=(e._camera.position[2]*e.worldSize-r)/Math.cos(e._pitch),o=Math.sin(i)*n/Math.sin(Math.max(Math.PI/2-e._pitch-i,.01)),s=Math.sin(e._pitch)*o+n;return Math.min(1.01*s,n*(1/e._horizonShift))}function cg(e,t){if(!t.isReprojectedInTileSpace)return{scale:1<<e.z,x:e.x,y:e.y,x2:e.x+1,y2:e.y+1,projection:t};const i=Math.pow(2,-e.z),r=e.x*i,n=(e.x+1)*i,o=e.y*i,s=(e.y+1)*i,a=Ru(r),l=Ru(n),c=zu(o),u=zu(s),h=t.project(a,c),p=t.project(l,c),d=t.project(l,u),f=t.project(a,u);let m=Math.min(h.x,p.x,d.x,f.x),_=Math.min(h.y,p.y,d.y,f.y),g=Math.max(h.x,p.x,d.x,f.x),y=Math.max(h.y,p.y,d.y,f.y);const v=i/16;function x(e,i,r,n,o,s){const a=(r+o)/2,l=(n+s)/2,c=t.project(Ru(a),zu(l)),u=Math.max(0,m-c.x,_-c.y,c.x-g,c.y-y);m=Math.min(m,c.x),g=Math.max(g,c.x),_=Math.min(_,c.y),y=Math.max(y,c.y),u>v&&(x(e,c,r,n,a,l),x(c,i,a,l,o,s))}x(h,p,r,o,n,o),x(p,d,n,o,n,s),x(d,f,n,s,r,s),x(f,h,r,s,r,o),m-=v,_-=v,g+=v,y+=v;const b=1/Math.max(g-m,y-_);return{scale:b,x:m*b,y:_*b,x2:g*b,y2:y*b,projection:t}}function ug(e,{x:t,y:i},r=0){return new Ut(((t-r)*e.scale-e.x)*fo,(i*e.scale-e.y)*fo)}const hg=e.ae.identity(new Float32Array(16));class pg{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,t){return{x:0,y:0,z:0}}unproject(e,t){return new yu(0,0)}projectTilePoint(e,t,i){return{x:e,y:t,z:0}}locationPoint(e,t,i=!0){return e._coordinatePoint(e.locationCoordinate(t),i)}pixelsPerMeter(e,t){return Pu(1,e)*t}pixelSpaceConversion(e,t,i){return 1}farthestPixelDistance(e){return lg(e,e.pixelsPerMeter)}pointCoordinate(e,t,i,r){const n=e.horizonLineFromTop(!1),o=new Ut(t,Math.max(n,i));return e.rayIntersectionCoordinate(e.pointRayIntersection(o,r))}
vendor: 8,161 bytes, line 1
1pointCoordinate3D(e,t,i){const r=new Ut(t,i);if(e.elevation)return e.elevation.pointCoordinate(r);{const t=this.pointCoordinate(e,r.x,r.y,0);return[t.x,t.y,t.z]}}isPointAboveHorizon(e,t){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,t.x,t.y);const i=e.horizonLineFromTop();return t.y<i}createInversionMatrix(e,t){return hg}createTileMatrix(t,i,r){let n,o,s;const a=r.canonical,l=e.ae.identity(new Float64Array(16));if(this.isReprojectedInTileSpace){const c=cg(a,this);n=1,o=c.x+r.wrap*c.scale,s=c.y,e.ae.scale(l,l,[n/c.scale,n/c.scale,t.pixelsPerMeter/i])}else n=i/t.zoomScale(a.z),o=(a.x+Math.pow(2,a.z)*r.wrap)*n,s=a.y*n;return e.ae.translate(l,l,[o,s,0]),e.ae.scale(l,l,[n/fo,n/fo,1]),l}upVector(e,t,i){return[0,0,1]}upVectorScale(e,t,i){return{metersToTile:1}}}class dg extends pg{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[t,i]=this.parallels=e.parallels||[29.5,45.5],r=Math.sin(qt(t));this.n=(r+Math.sin(qt(i)))/2,this.c=1+r*(2*this.n-r),this.r0=Math.sqrt(this.c)/this.n}project(e,t){const{n:i,c:r,r0:n}=this,o=qt(e-this.center[0]),s=qt(t),a=Math.sqrt(r-2*i*Math.sin(s))/i;return{x:a*Math.sin(o*i),y:a*Math.cos(o*i)-n,z:0}}unproject(e,t){const{n:i,c:r,r0:n}=this,o=n+t;let s=Math.atan2(e,Math.abs(o))*Math.sign(o);o*i<0&&(s-=Math.PI*Math.sign(e)*Math.sign(o));const a=qt(this.center[0])*i;s=Kt(s,-Math.PI-a,Math.PI-a);const l=Yt(Ht(s/i)+this.center[0],-180,180),c=Math.asin(Yt((r-(e*e+o*o)*i*i)/(2*i),-1,1)),u=Yt(Ht(c),-Du,Du);return new yu(l,u)}}const fg=1.340264,mg=-.081106,_g=893e-6,gg=.003796,yg=Math.sqrt(3)/2;class vg extends pg{project(e,t){t=t/180*Math.PI,e=e/180*Math.PI;const i=Math.asin(yg*Math.sin(t)),r=i*i,n=r*r*r;return{x:.5*(e*Math.cos(i)/(yg*(fg+3*mg*r+n*(7*_g+9*gg*r)))/Math.PI+.5),y:1-.5*(i*(fg+mg*r+n*(_g+gg*r))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let i=t=(2*(1-t)-1)*Math.PI,r=i*i,n=r*r*r;for(let e,o,s,a=0;a<12&&(o=i*(fg+mg*r+n*(_g+gg*r))-t,s=fg+3*mg*r+n*(7*_g+9*gg*r),e=o/s,i=Yt(i-e,-Math.PI/3,Math.PI/3),r=i*i,n=r*r*r,!(Math.abs(e)<1e-12));++a);const o=yg*e*(fg+3*mg*r+n*(7*_g+9*gg*r))/Math.cos(i),s=Math.asin(Math.sin(i)/yg),a=Yt(180*o/Math.PI,-180,180),l=Yt(180*s/Math.PI,-Du,Du);return new yu(a,l)}}class xg extends pg{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){return{x:.5+e/360,y:.5-t/360,z:0}}unproject(e,t){const i=360*(e-.5),r=Yt(360*(.5-t),-Du,Du);return new yu(i,r)}}const bg=Math.PI/2;function wg(e){return Math.tan((bg+e)/2)}class Tg extends pg{constructor(e){super(e),this.center=e.center||[0,30];const[t,i]=this.parallels=e.parallels||[30,30];let r=qt(t),n=qt(i);this.southernCenter=r+n<0,this.southernCenter&&(r=-r,n=-n);const o=Math.cos(r),s=wg(r);this.n=r===n?Math.sin(r):Math.log(o/Math.cos(n))/Math.log(wg(n)/s),this.f=o*Math.pow(wg(r),this.n)/this.n}project(e,t){t=qt(t),this.southernCenter&&(t=-t),e=qt(e-this.center[0]);const i=1e-6,{n:r,f:n}=this;n>0?t<-bg+i&&(t=-bg+i):t>bg-i&&(t=bg-i);const o=n/Math.pow(wg(t),r);let s=o*Math.sin(r*e),a=n-o*Math.cos(r*e);return s=.5*(s/Math.PI+.5),a=.5*(a/Math.PI+.5),{x:s,y:this.southernCenter?a:1-a,z:0}}unproject(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;const{n:i,f:r}=this,n=r-t,o=Math.sign(n),s=Math.sign(i)*Math.sqrt(e*e+n*n);let a=Math.atan2(e,Math.abs(n))*o;n*i<0&&(a-=Math.PI*Math.sign(e)*o);const l=Yt(Ht(a/i)+this.center[0],-180,180),c=Yt(Ht(2*Math.atan(Math.pow(r/s,1/i))-bg),-Du,Du);return new yu(l,this.southernCenter?-c:c)}}class Mg extends pg{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,t){return{x:ku(e),y:Lu(t),z:0}}unproject(e,t){const i=Ru(e),r=zu(t);return new yu(i,r)}}const Eg=qt(Du);class Sg extends pg{project(e,t){const i=(t=qt(t))*t,r=i*i;return{x:.5*((e=qt(e))*(.8707-.131979*i+r*(r*(.003971*i-.001529*r)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+i*(.015085+r*(.028874*i-.044475-.005916*r)))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let i=t=(2*(1-t)-1)*Math.PI,r=25,n=0,o=i*i;do{o=i*i;const e=o*o;n=(i*(1.007226+o*(.015085+e*(.028874*o-.044475-.005916*e)))-t)/(1.007226+o*(.045255+e*(.259866*o-.311325-.005916*11*e))),i=Yt(i-n,-Eg,Eg)}while(Math.abs(n)>1e-6&&--r>0);o=i*i;const s=Yt(Ht(e/(.8707+o*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979))),-180,180),a=Ht(i);return new yu(s,a)}}const Cg=qt(Du);class Ag extends pg{project(e,t){t=qt(t),e=qt(e);const i=Math.cos(t),r=2/Math.PI,n=Math.acos(i*Math.cos(e/2)),o=Math.sin(n)/n,s=.5*(e*r+2*i*Math.sin(e/2)/o)||0,a=.5*(t+Math.sin(t)/o)||0;return{x:.5*(s/Math.PI+.5),y:1-.5*(a/Math.PI+1),z:0}}unproject(e,t){let i=e=(2*e-.5)*Math.PI,r=t=(2*(1-t)-1)*Math.PI,n=25;const o=1e-6;let s=0,a=0;do{const n=Math.cos(r),o=Math.sin(r),l=2*o*n,c=o*o,u=n*n,h=Math.cos(i/2),p=Math.sin(i/2),d=2*h*p,f=p*p,m=1-u*h*h,_=m?1/m:0,g=m?Math.acos(n*h)*Math.sqrt(1/m):0,y=.5*(2*g*n*p+2*i/Math.PI)-e,v=.5*(g*o+r)-t,x=.5*_*(u*f+g*n*h*c)+1/Math.PI,b=_*(d*l/4-g*o*p),w=.125*_*(l*p-g*o*u*d),T=.5*_*(c*h+g*f*n)+.5,M=b*w-T*x;s=(v*b-y*T)/M,a=(y*w-v*x)/M,i=Yt(i-s,-Math.PI,Math.PI),r=Yt(r-a,-Cg,Cg)}while((Math.abs(s)>o||Math.abs(a)>o)&&--n>0);return new yu(Ht(i),Ht(r))}}class Ig extends pg{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(qt(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){const{scale:i,cosPhi:r}=this;return{x:qt(e)*r*i+.5,y:-Math.sin(qt(t))/r*i+.5,z:0}}unproject(e,t){const{scale:i,cosPhi:r}=this,n=-(t-.5)/i,o=Yt(Ht((e-.5)/i)/r,-180,180),s=Math.asin(Yt(n*r,-1,1)),a=Yt(Ht(s),-Du,Du);return new yu(o,a)}}class kg extends Mg{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(t,i,r){const n=Gh(t,i,r),o=Zh(Fh(r));return e.$.transformMat4(n,n,o),{x:n[0],y:n[1],z:n[2]}}locationPoint(t,i){const r=mu(i.lat,i.lng),n=e.$.normalize([],r),o=t.elevation?t.elevation.getAtPointOrZero(t.locationCoordinate(i),t._centerAltitude):t._centerAltitude,s=Pu(1,0)*fo*o;e.$.scaleAndAdd(r,r,n,s);const a=e.ae.identity(new Float64Array(16));return e.ae.multiply(a,t.pixelMatrix,t.globeMatrix),e.$.transformMat4(r,r,a),new Ut(r[0],r[1])}pixelsPerMeter(e,t){return Pu(1,0)*t}pixelSpaceConversion(e,t,i){const r=Pu(1,e)*t,n=qr(Pu(1,45)*t,r,i);return this.pixelsPerMeter(e,t)/n}createTileMatrix(t,i,r){const n=Wh(Fh(r.canonical));return e.ae.multiply(new Float64Array(16),t.globeMatrix,n)}createInversionMatrix(t,i){const{center:r}=t,n=Zh(Fh(i));return e.ae.rotateY(n,n,qt(r.lng)),e.ae.rotateX(n,n,qt(r.lat)),e.ae.scale(n,n,[t._pixelsPerMercatorPixel,t._pixelsPerMercatorPixel,1]),Float32Array.from(n)}pointCoordinate(e,t,i,r){return zh(e,t,i,!0)||new Uu(0,0)}pointCoordinate3D(e,t,i){const r=this.pointCoordinate(e,t,i,0);return[r.x,r.y,r.z]}isPointAboveHorizon(e,t){return!zh(e,t.x,t.y,!1)}farthestPixelDistance(t){const i=function(t,i){const r=t.cameraToCenterDistance,n=t._centerAltitude*i,o=t._camera,s=t._camera.forward(),a=e.$.add([],e.$.scale([],s,-r),[0,0,n]),l=t.worldSize/(2*Math.PI),c=[0,0,-l],u=t.width/t.height,h=Math.tan(t.fovAboveCenter),p=e.$.scale([],o.up(),h),d=e.$.scale([],o.right(),h*u),f=e.$.normalize([],e.$.add([],e.$.add([],s,p),d)),m=[];let _;if(new xh(a,f).closestPointOnSphere(c,l,m)){const i=e.$.add([],m,c),r=e.$.sub([],i,a);_=Math.cos(t.fovAboveCenter)*e.$.length(r)}else{const t=e.$.sub([],a,c),i=e.$.sub([],c,a);e.$.normalize(i,i);const r=e.$.length(t)-l;_=Math.sqrt(r*(r+2*l));const n=Math.acos(_/(l+r))-Math.acos(e.$.dot(s,i));_*=Math.cos(n)}return 1.01*_}(t,this.pixelsPerMeter(t.center.lat,t.worldSize)),r=Jh(t.zoom);if(r>0){const e=lg(t,Pu(1,t.center.lat)*t.worldSize),n=t.worldSize/(2*Math.PI),o=Math.max(t.width,t.height)/t.worldSize*Math.PI;return qr(i,e+n*(1-Math.cos(o)),Math.pow(r,10))}return i}upVector(e,t,i){return Gh(t,i,e,1)}upVectorScale(e){return{metersToTile:Ph(qh(Fh(e)))}}}function Lg(e){const t=e.parallels,i=!!t&&Math.abs(t[0]+t[1])<.01;
vendor: 3,527 bytes, line 1
1switch(e.name){case"mercator":return new Mg(e);case"equirectangular":return new xg(e);case"naturalEarth":return new Sg(e);case"equalEarth":return new vg(e);case"winkelTripel":return new Ag(e);case"albers":return i?new Ig(e):new dg(e);case"lambertConformalConic":return i?new Ig(e):new Tg(e);case"globe":return new kg(e)}throw new Error(`Invalid projection name: ${e.name}`)}const Pg=Ad.types,Rg=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function zg(e,t,i,r,n,o,s,a,l,c,u,h,p){const d=a?Math.min(ig,Math.round(a[0])):0,f=a?Math.min(ig,Math.round(a[1])):0;e.emplaceBack(t,i,Math.round(32*r),Math.round(32*n),o,s,(d<<1)+(l?1:0),f,16*c,16*u,256*h,256*p)}function Og(e,t,i){e.emplaceBack(t,i)}function Dg(e,t,i,r,n,o,s){e.emplaceBack(t,i,r,n,o,s)}function Fg(e,t,i,r,n){e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n)}function Bg(e){for(const t of e.sections)if(Fa(t.text))return!0;return!1}class Ng{constructor(e){this.layoutVertexArray=new ql,this.indexArray=new Kl,this.programConfigurations=e,this.segments=new Cc,this.dynamicLayoutVertexArray=new jl,this.opacityVertexArray=new Zl,this.placedSymbolArray=new mc,this.iconTransitioningVertexArray=new Wl,this.globeExtVertexArray=new Hl,this.zOffsetVertexArray=new ic}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}upload(e,t,i,r,n){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Zf.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Xf.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Rg,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,Yf.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Wf.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||n)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Qf.members,!0)),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy())}}Ma(Ng,"SymbolBuffers");class jg{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new Cc,this.collisionVertexArray=new Jl,this.collisionVertexArrayExt=new jl}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Jf.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,Kf.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
vendor: 4,978 bytes, line 1
1stroy())}}Ma(jg,"CollisionBuffers");class Ug{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.lut=t.lut,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=e.ae.identity([]),this.placementViewportMatrix=e.ae.identity([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Zm(this.zoom,i["text-size"]),this.iconSizeData=Zm(this.zoom,i["icon-size"]);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),o=r.get("symbol-z-order");this.canOverlap=r.get("text-allow-overlap")||r.get("icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&void 0!==n.constantOr(1),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=r.get("text-writing-mode").map((e=>s_[e])),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=t.sourceID,this.projection=t.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=r.get("symbol-z-elevate"),this.activeReplacements=[],this.replacementUpdateTime=0}createArrays(){this.text=new Ng(new eu(this.layers,{zoom:this.zoom,lut:this.lut},(e=>/^text/.test(e)))),this.icon=new Ng(new eu(this.layers,{zoom:this.zoom,lut:this.lut},(e=>/^icon/.test(e)))),this.glyphOffsetArray=new yc,this.lineVertexArray=new vc,this.symbolInstances=new gc}calculateGlyphDependencies(e,t,i,r,n){for(let i=0;i<e.length;i++){const o=e.codePointAt(i);if(void 0===o)break;if(t[o]=!0,r&&n&&o<=65535){const r=Jm[e.charAt(i)];r&&(t[r.charCodeAt(0)]=!0)}}}updateFootprints(e,t){}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const i=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!Nd(this.activeReplacements,i)&&(this.activeReplacements=i,!0)}populate(t,i,r,n){const o=this.layers[0],s=o.layout,a="globe"===this.projection.name,l=s.get("text-font"),c=s.get("text-field"),u=s.get("icon-image"),h=("constant"!==c.value.kind||c.value.value instanceof _n&&!c.value.value.isEmpty()||c.value.value.toString().length>0)&&("constant"!==l.value.kind||l.value.value.length>0),p="constant"!==u.value.kind||!!u.value.value||Object.keys(u.parameters).length>0,d=s.get("symbol-sort-key");if(this.features=[],!h&&!p)return;const f=i.iconDependencies,m=i.glyphDependencies,_=i.availableImages,g=new Qa(this.zoom);for(const{feature:i,id:c,index:u,sourceLayerIndex:y}of t){const t=o._featureFilter.needGeometry,v=Qu(i,t);if(!o._featureFilter.filter(g,v,r))continue;if(t||(v.geometry=Xu(i,r,n)),a&&1!==i.type&&r.z<=5){const t=v.geometry,i=.98078528056,n=(t,n)=>{const o=Gh(t.x,t.y,r,1),s=Gh(n.x,n.y,r,1);return e.$.dot(o,s)<i};for(let e=0;e<t.length;e++)t[e]=qu(t[e],n)}let x,b;if(h){const e=o.getValueAndResolveTokens("text-field",v,r,_),t=_n.factory(e);Bg(t)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Za()||this.hasRTLText&&Xa.isParsed())&&(x=Ym(t,o,v))}if(p){const e=o.getValueAndResolveTokens("icon-image",v,r,_);b=e instanceof gn?e:gn.fromString(e)}if(!x&&!b)continue;const w=this.sortFeaturesByKey?d.evaluate(v,{},r):void 0;if(this.features.push({id:c,text:x,icon:b,index:u,sourceLayerIndex:y,geometry:v.geometry,properties:i.properties,type:Pg[i.type],sortKey:w}),b&&(f[b.namePrimary]=!0,b.nameSecondary&&(f[b.nameSecondary]=!0)),x){const e=l.evaluate(v,{},r).join(","),t="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(s_.vertical)>=0;for(const i of x.sections)if(i.image)f[i.image.namePrimary]=!0;else{const r=ka(x.toString()),n=i.fontStack||e,o=m[n]=m[n]||{};this.calculateGlyphDependencies(i.text,o,t,this.allowVerticalPlacement,r)}}}"line"===s.get("symbol-placement")&&(this.features=function(e){const t={},i={},r=[];let n=0;function o(t){r.push(e[t]),n++}function s(e,t,n){const o=i[e];return delete i[e],i[t]=o,r[o].geometry[0].pop(),r[o].geometry[0]=r[o].geometry[0].concat(n[0]),o}function a(e,i,n){const o=t[i];return delete t[i],t[e]=o,r[o].geometry[0].shift(),r[o].geometry[0]=n[0].concat(r[o].geometry[0]),o}function l(e,t,i){const r=i?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.y}`}for(let c=0;c<e.length;c++){const u=e[c],h=u.geometry,p=u.text?u.text.toString():null;if(!p){o(c);continue}const d=l(p,h),f=l(p,h,!0);if(d in i&&f in t&&i[d]!==t[f]){const e=a(d,f,h),n=s(d,f,r[e].geometry);delete t[d],delete i[f],i[l(p,r[n].geometry,!0)]=n,r[e].geometry=null}else d in i?s(d,f,h):f in t?a(d,f,h):(o(c),t[d]=n-1,i[f]=n-1)}return r.filter((e=>e.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>
vendor: 10,513 bytes, line 1
1e.sortKey-t.sortKey))}update(e,t,i,r,n){const o=0!==Object.keys(e).length;if(o&&!this.stateDependentLayers.length)return;const s=o?this.stateDependentLayers:this.layers;this.text.programConfigurations.updatePaintArrays(e,t,s,i,r,n),this.icon.programConfigurations.updatePaintArrays(e,t,s,i,r,n)}updateZOffset(){const e=(e,t,r)=>{i+=t,i>e.length&&e.resize(i);for(let n=-t;n<0;n++)e.emplace(n+i,r)},t=(e,t,i)=>{r+=t,r>e.length&&e.resize(r);for(let n=-t;n<0;n++)e.emplace(n+r,i)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let i=0,r=0;for(let i=0;i<this.symbolInstances.length;i++){const r=this.symbolInstances.get(i),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:o,numIconVertices:s}=r,a=r.zOffset,l=s>0;if((n>0||o>0)&&(e(this.text.zOffsetVertexArray,n,a),e(this.text.zOffsetVertexArray,o,a)),l){const{placedIconSymbolIndex:e,verticalPlacedIconSymbolIndex:i}=r;e>=0&&t(this.icon.zOffsetVertexArray,s,a),i>=0&&t(this.icon.zOffsetVertexArray,r.numVerticalIconVertices,a)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Lg(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const i=this.lineVertexArray.length;if(void 0!==e.segment)for(const{x:e,y:i}of t)this.lineVertexArray.emplaceBack(e,i);return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m){const _=e.indexArray,g=e.layoutVertexArray,y=e.globeExtVertexArray,v=e.segments.prepareSegment(4*t.length,g,_,this.canOverlap?o.sortKey:void 0),x=this.glyphOffsetArray.length,b=v.vertexLength,w=this.allowVerticalPlacement&&s===s_.vertical?Math.PI/2:0,T=o.text&&o.text.sections;for(let r=0;r<t.length;r++){const{tl:n,tr:s,bl:c,br:u,texPrimary:h,texSecondary:x,pixelOffsetTL:b,pixelOffsetBR:M,minFontScaleX:E,minFontScaleY:S,glyphOffset:C,isSDF:A,sectionIndex:I}=t[r],k=v.vertexLength,L=C[1];if(zg(g,l.x,l.y,n.x,L+n.y,h.x,h.y,i,A,b.x,b.y,E,S),zg(g,l.x,l.y,s.x,L+s.y,h.x+h.w,h.y,i,A,M.x,b.y,E,S),zg(g,l.x,l.y,c.x,L+c.y,h.x,h.y+h.h,i,A,b.x,M.y,E,S),zg(g,l.x,l.y,u.x,L+u.y,h.x+h.w,h.y+h.h,i,A,M.x,M.y,E,S),a){const{x:t,y:i,z:r}=a.anchor,[n,o,s]=a.up;Dg(y,t,i,r,n,o,s),Dg(y,t,i,r,n,o,s),Dg(y,t,i,r,n,o,s),Dg(y,t,i,r,n,o,s),Fg(e.dynamicLayoutVertexArray,t,i,r,w)}else Fg(e.dynamicLayoutVertexArray,l.x,l.y,l.z,w);if(m){const t=x||h;Og(e.iconTransitioningVertexArray,t.x,t.y),Og(e.iconTransitioningVertexArray,t.x+t.w,t.y),Og(e.iconTransitioningVertexArray,t.x,t.y+t.h),Og(e.iconTransitioningVertexArray,t.x+t.w,t.y+t.h)}_.emplaceBack(k,k+1,k+2),_.emplaceBack(k+1,k+2,k+3),v.vertexLength+=4,v.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(C[0]),r!==t.length-1&&I===t[r+1].sectionIndex||e.programConfigurations.populatePaintArrays(g.length,o,o.index,{},p,d,f,T&&T[I])}const M=a?a.anchor:l;e.placedSymbolArray.emplaceBack(M.x,M.y,M.z,l.x,l.y,x,this.glyphOffsetArray.length-x,b,c,u,l.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],s,0,!1,0,h,0)}_commitLayoutVertex(e,t,i,r,n,o,s){e.emplaceBack(t,i,r,n,o,Math.round(s.x),Math.round(s.y))}_addCollisionDebugVertices(e,t,i,r,n,o,s){const a=i.segments.prepareSegment(4,i.layoutVertexArray,i.indexArray),l=a.vertexLength,c=s.tileAnchorX,u=s.tileAnchorY;for(let e=0;e<4;e++)i.collisionVertexArray.emplaceBack(0,0,0,0);this._commitDebugCollisionVertexUpdate(i.collisionVertexArrayExt,t,e.padding,s.zOffset),this._commitLayoutVertex(i.layoutVertexArray,r,n,o,c,u,new Ut(e.x1,e.y1)),this._commitLayoutVertex(i.layoutVertexArray,r,n,o,c,u,new Ut(e.x2,e.y1)),this._commitLayoutVertex(i.layoutVertexArray,r,n,o,c,u,new Ut(e.x2,e.y2)),this._commitLayoutVertex(i.layoutVertexArray,r,n,o,c,u,new Ut(e.x1,e.y2)),a.vertexLength+=4;const h=i.indexArray;h.emplaceBack(l,l+1),h.emplaceBack(l+1,l+2),h.emplaceBack(l+2,l+3),h.emplaceBack(l+3,l),a.primitiveLength+=4}_addTextDebugCollisionBoxes(e,t,i,r,n,o){for(let s=r;s<n;s++){const r=i.get(s),n=this.getSymbolInstanceTextSize(e,o,t,s);this._addCollisionDebugVertices(r,n,this.textCollisionBox,r.projectedAnchorX,r.projectedAnchorY,r.projectedAnchorZ,o)}}_addIconDebugCollisionBoxes(e,t,i,r,n,o){for(let s=r;s<n;s++){const r=i.get(s),n=this.getSymbolInstanceIconSize(e,t,o.placedIconSymbolIndex);this._addCollisionDebugVertices(r,n,this.iconCollisionBox,r.projectedAnchorX,r.projectedAnchorY,r.projectedAnchorZ,o)}}generateCollisionDebugBuffers(e,t){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new jg(Ql,em.members,Wl),this.iconCollisionBox=new jg(Ql,em.members,Wl);const i=Xm(this.iconSizeData,e),r=Xm(this.textSizeData,e);for(let n=0;n<this.symbolInstances.length;n++){const o=this.symbolInstances.get(n);this._addTextDebugCollisionBoxes(r,e,t,o.textBoxStartIndex,o.textBoxEndIndex,o),this._addTextDebugCollisionBoxes(r,e,t,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o),this._addIconDebugCollisionBoxes(i,e,t,o.iconBoxStartIndex,o.iconBoxEndIndex,o),this._addIconDebugCollisionBoxes(i,e,t,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex,o)}}getSymbolInstanceTextSize(e,t,i,r){const n=this.text.placedSymbolArray.get(t.rightJustifiedTextSymbolIndex>=0?t.rightJustifiedTextSymbolIndex:t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.leftJustifiedTextSymbolIndex>=0?t.leftJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex>=0?t.verticalPlacedTextSymbolIndex:r),o=Wm(this.textSizeData,e,n)/qm;return this.tilePixelRatio*o}getSymbolInstanceIconSize(e,t,i){const r=this.icon.placedSymbolArray.get(i),n=Wm(this.iconSizeData,e,r);return this.tilePixelRatio*n}_commitDebugCollisionVertexUpdate(e,t,i,r){e.emplaceBack(t,-i,-i,r),e.emplaceBack(t,i,-i,r),e.emplaceBack(t,i,i,r),e.emplaceBack(t,-i,i,r)}_updateTextDebugCollisionBoxes(e,t,i,r,n,o){for(let s=r;s<n;s++){const r=i.get(s),n=this.getSymbolInstanceTextSize(e,o,t,s);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,n,r.padding,o.zOffset)}}_updateIconDebugCollisionBoxes(e,t,i,r,n,o){for(let s=r;s<n;s++){const r=i.get(s),n=this.getSymbolInstanceIconSize(e,t,o.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,n,r.padding,o.zOffset)}}updateCollisionDebugBuffers(e,t){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const i=Xm(this.iconSizeData,e),r=Xm(this.textSizeData,e);for(let n=0;n<this.symbolInstances.length;n++){const o=this.symbolInstances.get(n);this._updateTextDebugCollisionBoxes(r,e,t,o.textBoxStartIndex,o.textBoxEndIndex,o),this._updateTextDebugCollisionBoxes(r,e,t,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o),this._updateIconDebugCollisionBoxes(i,e,t,o.iconBoxStartIndex,o.iconBoxEndIndex,o),this._updateIconDebugCollisionBoxes(i,e,t,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex,o)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,t,i,r,n,o,s,a,l){const c={};if(t<i){const{x1:i,y1:r,x2:n,y2:o,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:p,featureIndex:d}=e.get(t);c.textBox={x1:i,y1:r,x2:n,y2:o,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:p},c.textFeatureIndex=d}if(r<n){const{x1:t,y1:i,x2:n,y2:o,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:p,featureIndex:d}=e.get(r);c.verticalTextBox={x1:t,y1:i,x2:n,y2:o,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:p},c.verticalTextFeatureIndex=d}if(o<s){const{x1:t,y1:i,x2:r,y2:n,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:p,featureIndex:d}=e.get(o);c.iconBox={x1:t,y1:i,x2:r,y2:n,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:p},c.iconFeatureIndex=d}if(a<l){const{x1:t,y1:i,x2:r,y2:n,padding:o,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:p,featureIndex:d}=e.get(a);c.verticalIconBox={x1:t,y1:i,x2:r,y2:n,padding:o,projectedAnchorX:s,projectedAnchorY:l,projectedAnchorZ:u,tileAnchorX:h,tileAnchorY:p},c.verticalIconFeatureIndex=d}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){const i=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,t){const i=e.placedSymbolArray.get(t),r=i.vertexStartIndex+4*i.numGlyphs;for(let t=i.vertexStartIndex;t<r;t+=4)e.indexArray.emplaceBack(t,t+1,t+2),e.indexArray.emplaceBack(t+1,t+2,t+3)}
1getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const t=Math.sin(e),i=Math.cos(e),r=[],n=[],o=[];for(let e=0;e<this.symbolInstances.length;++e){o.push(e);const s=this.symbolInstances.get(e);r.push(0|Math.round(t*s.tileAnchorX+i*s.tileAnchorY)),n.push(s.featureIndex)}return o.sort(((e,t)=>r[e]-r[t]||n[t]-n[e])),o}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort(((e,t)=>this.symbolInstances.get(t).zOffset-this.symbolInstances.get(e).zOffset))}addToSortKeyRanges(e,t){const i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);const{rightJustifiedTextSymbolIndex:i,centerJustifiedTextSymbolIndex:r,leftJustifiedTextSymbolIndex:n,verticalPlacedTextSymbolIndex:o,placedIconSymbolIndex:s,verticalPlacedIconSymbolIndex:a}=t;i>=0&&this.addIndicesForPlacedSymbol(this.text,i),r>=0&&r!==i&&this.addIndicesForPlacedSymbol(this.text,r),n>=0&&n!==r&&n!==i&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&this.addIndicesForPlacedSymbol(this.text,o),s>=0&&this.addIndicesForPlacedSymbol(this.icon,s),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Ma(Ug,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),Ug.addDynamicAttributes=Fg;class Vg{constructor(e,t,i,r){this.context=e,this.format=i,this.texture=e.gl.createTexture(),this.update(t,r)}update(e,t,i){const{width:r,height:n}=e,{context:o}=this,{gl:s}=o;if(s.bindTexture(s.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1),o.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA&&(!t||!1!==t.premultiply)),this.useMipmap=Boolean(t&&t.useMipmap),i||this.size&&this.size[0]===r&&this.size[1]===n){const{x:t,y:o}=i||{x:0,y:0};if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap)s.texSubImage2D(s.TEXTURE_2D,0,t,o,s.RGBA,s.UNSIGNED_BYTE,e);else{let i=this.format,a=s.UNSIGNED_BYTE;this.format===s.R32F&&(i=s.RED,a=s.FLOAT),s.texSubImage2D(s.TEXTURE_2D,0,t,o,r,n,i,a,e.data)}}else if(this.size=[r,n],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap){let t=this.format;this.format===s.R8&&(t=s.RED),s.texImage2D(s.TEXTURE_2D,0,this.format,t,s.UNSIGNED_BYTE,e)}else{let t=this.format,i=this.format,o=s.UNSIGNED_BYTE,a=!1;this.format===s.DEPTH_COMPONENT&&(t=s.DEPTH_COMPONENT16,o=s.UNSIGNED_SHORT),this.format===s.DEPTH_STENCIL&&(t=s.DEPTH24_STENCIL8,o=s.UNSIGNED_INT_24_8,a=!0),this.format===s.R8&&(i=s.RED),this.format===s.R32F&&(o=s.FLOAT,i=s.RED),!this.useMipmap&&a?s.texStorage2D(s.TEXTURE_2D,1,t,r,n):s.texImage2D(s.TEXTURE_2D,0,t,r,n,0,i,o,e.data)}this.useMipmap&&s.generateMipmap(s.TEXTURE_2D)}bind(e,t,i=!1){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),e!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,this.useMipmap&&!i?e===n.NEAREST?n.NEAREST_MIPMAP_NEAREST:n.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),t!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrapS=t)}bindExtraParam(e,t,i,r){const{context:n}=this,{gl:o}=n;
vendor: 4,585 bytes, line 1
1o.bindTexture(o.TEXTURE_2D,this.texture),t!==this.magFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,t),this.magFilter=t),e!==this.minFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,this.useMipmap?e===o.NEAREST?o.NEAREST_MIPMAP_NEAREST:o.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,i),this.wrapS=i),r!==this.wrapT&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,r),this.wrapT=r)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class $g{constructor(e,t){this.context=e,this.texture=t}bind(e,t){const{context:i}=this,{gl:r}=i;r.bindTexture(r.TEXTURE_2D,this.texture),e!==this.minFilter&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,e),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,e),this.minFilter=e),t!==this.wrapS&&(r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,t),this.wrapS=t)}}const Gg=32,qg=33,Hg=new Uint16Array(8184);for(let e=0;e<2046;e++){let t=e+2,i=0,r=0,n=0,o=0,s=0,a=0;for(1&t?n=o=s=Gg:i=r=a=Gg;(t>>=1)>1;){const e=i+n>>1,l=r+o>>1;1&t?(n=i,o=r,i=s,r=a):(i=n,r=o,n=s,o=a),s=e,a=l}const l=4*e;Hg[l+0]=i,Hg[l+1]=r,Hg[l+2]=n,Hg[l+3]=o}const Zg=new Uint16Array(2178),Wg=new Uint8Array(1089),Xg=new Uint16Array(1089);function Qg(e){return 0===e?-.03125:32===e?.03125:0}var Yg=Rl([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Jg{constructor(e,t,i,r){this.id=Jg.uniqueIdxCounter,Jg.uniqueIdxCounter++,this.context=e;const n=e.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||r||t.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){this.id=Jg.uniqueIdxCounter,Jg.uniqueIdxCounter++;const t=this.context.gl;this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Jg.uniqueIdxCounter=0;class Kg{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}}Kg.ReadOnly=!1,Kg.ReadWrite=!0,Kg.disabled=new Kg(519,Kg.ReadOnly,[0,1]);const ey=7680;class ty{constructor(e,t,i,r,n,o){this.test=e,this.ref=t,this.mask=i,this.fail=r,this.depthFail=n,this.pass=o}}ty.disabled=new ty({func:519,mask:0},0,0,ey,ey,ey);const iy=771;class ry{constructor(e,t,i,r){this.blendFunction=e,this.blendColor=t,this.mask=i,this.blendEquation=r}}ry.Replace=[1,0,1,0],ry.disabled=new ry(ry.Replace,$r.transparent,[!1,!1,!1,!1]),ry.unblended=new ry(ry.Replace,$r.transparent,[!0,!0,!0,!0]),ry.alphaBlended=new ry([1,iy,1,iy],$r.transparent,[!0,!0,!0,!0]),ry.alphaBlendedNonPremultiplied=new ry([770,iy,770,iy],$r.transparent,[!0,!0,!0,!0]),ry.multiply=new ry([774,0,774,0],$r.transparent,[!0,!0,!0,!0]);const ny=1029,oy=2305;class sy{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}}sy.disabled=new sy(!1,ny,oy),sy.backCCW=new sy(!0,ny,oy),sy.backCW=new sy(!0,ny,2304),sy.frontCW=new sy(!0,1028,2304),sy.frontCCW=new sy(!0,1028,oy);var ay=Rl([{name:"a_index",type:"Int16",components:1}]);const ly={type:2,extent:fo,loadGeometry:()=>[[new Ut(0,0),new Ut(fo+1,0),new Ut(fo+1,fo+1),new Ut(0,fo+1),new Ut(0,0)]]};class cy{constructor(e,t,i,r,n){this.tileID=e,this.uid=ni(),this.uses=0,this.tileSize=t,this.tileZoom=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=n,r&&r.style&&(this._lastUpdatedBrightness=r.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",r&&r.transform&&(this.projection=r.transform.projection)}registerFadeDuration(e){const t=e+this.timeAdded;t<zi.now()||this.fadeEndTime&&t<this.fadeEndTime||(this.fadeEndTime=t)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=cg(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(e,t,i){if(this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){const i={};if(!t)return i;for(const r of e){const e=r.layerIds.map((e=>
1t.getLayer(e))).filter(Boolean);if(0!==e.length){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(const t of e)i[t.fqid]=r}}return i}(e.buckets,t.style),this.hasSymbolBuckets=!1;for(const e in this.buckets){const t=this.buckets[e];if(t instanceof Ug){if(this.hasSymbolBuckets=!0,!i)break;t.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const e in this.buckets){const t=this.buckets[e];if(t instanceof Ug&&t.hasRTLText){this.hasRTLText=!0,Xa.isLoading()||Xa.isLoaded()||"deferred"!==Za()||Wa();break}}this.queryPadding=0;for(const e in this.buckets){const i=this.buckets[e],r=t.style.getOwnLayer(e);if(!r)continue;const n=r.queryRadius(i);this.queryPadding=Math.max(this.queryPadding,n)}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),e.lineAtlas&&(this.lineAtlas=e.lineAtlas),this._lastUpdatedBrightness=e.brightness}else this.collisionBoxArray=new dc}unloadVectorData(){if(this.hasData()){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(e){return this.buckets[e.fqid]}upload(e){for(const t in this.buckets){const i=this.buckets[t];i.uploadPending()&&i.upload(e)}const t=e.gl,i=this.imageAtlas;if(i&&!i.uploaded){const r=!!Object.keys(i.patternPositions).length;this.imageAtlasTexture=new Vg(e,i.image,t.RGBA,{useMipmap:r}),this.imageAtlas.uploaded=!0}this.glyphAtlasImage&&(this.glyphAtlasTexture=new Vg(e,this.glyphAtlasImage,t.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new Vg(e,this.lineAtlas.image,t.R8),this.lineAtlas.uploaded=!0)}prepare(e,t,i){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture,i),!t||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const r=t.style.getBrightness();(this._lastUpdatedBrightness||r)&&(this._lastUpdatedBrightness&&r&&Math.abs(this._lastUpdatedBrightness-r)<.001||(this._lastUpdatedBrightness=r,this.updateBuckets(void 0,t)))}queryRenderedFeatures(e,t,i,r,n,o,s,a){return this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)?this.latestFeatureIndex.query({tileResult:r,pixelPosMatrix:s,transform:o,params:n,tileTransform:this.tileTransform},e,t,i):{}}querySourceFeatures(e,t){const i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;const r=i.loadVTLayers(),n=t?t.sourceLayer:"",o=r._geojsonTileLayer||r[n];if(!o)return;const s=dl(t&&t.filter),{z:a,x:l,y:c}=this.tileID.canonical,u={z:a,x:l,y:c};for(let t=0;t<o.length;t++){const r=o.feature(t);if(s.needGeometry){const e=Qu(r,!0);if(!s.filter(new Qa(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new Qa(this.tileID.overscaledZ),r))continue;const h=i.getId(r,n),p=new jm(r,a,l,c,h);p.tile=u,e.push(p)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const t=this.expirationTime;
vendor: 12,076 bytes, line 1
1if(e.cacheControl){const t=vi(e.cacheControl);t["max-age"]&&(this.expirationTime=Date.now()+1e3*t["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const e=Date.now();let i=!1;if(this.expirationTime>e)i=!1;else if(t)if(this.expirationTime<t)i=!0;else{const r=this.expirationTime-t;r?this.expirationTime=e+Math.max(r,3e4):i=!0}else i=!0;i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(e,t){this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&0!==Object.keys(e).length&&t&&this.updateBuckets(e,t)}updateBuckets(e,t){if(!this.latestFeatureIndex)return;const i=this.latestFeatureIndex.loadVTLayers(),r=t.style.listImages(),n=t.style.getBrightness();for(const o in this.buckets){if(!t.style.hasLayer(o))continue;const s=this.buckets[o],a=s.layers[0].sourceLayer||"_geojsonTileLayer",l=i[a];let c={};if(e&&(c=e[a],!l||!c||0===Object.keys(c).length))continue;if(s.update(c,l,r,this.imageAtlas&&this.imageAtlas.patternPositions||{},n),s instanceof sm||s instanceof ed){const e=t.style.getOwnSourceCache(s.layers[0].source);t._terrain&&t._terrain.enabled&&e&&s.programConfigurations.needsUpload&&t._terrain._clearRenderCacheForTile(e.id,this.tileID)}const u=t&&t.style&&t.style.getOwnLayer(o);u&&(this.queryPadding=Math.max(this.queryPadding,u.queryRadius(s)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<zi.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=zi.now()+e}setTexture(e,t){const i=t.context,r=i.gl;this.texture=this.texture||t.getTileTexture(e.width),this.texture&&this.texture instanceof Vg?this.texture.update(e,{useMipmap:!0}):(this.texture=new Vg(i,e,r.RGBA,{useMipmap:!0}),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE))}setDependencies(e,t){const i={};for(const e of t)i[e]=!0;this.dependencies[e]=i}hasDependency(e,t){for(const i of e){const e=this.dependencies[i];if(e)for(const i of t)if(e[i])return!0}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(e,t){if(!t||"mercator"===t.name||this._tileDebugBuffer)return;const i=Xu(ly,this.tileID.canonical,this.tileTransform)[0],r=new Ol,n=new sc;for(let e=0;e<i.length;e++){const{x:t,y:o}=i[e];r.emplaceBack(t,o),n.emplaceBack(e)}n.emplaceBack(0),this._tileDebugIndexBuffer=e.createIndexBuffer(n),this._tileDebugBuffer=e.createVertexBuffer(r,Lh.members),this._tileDebugSegments=Cc.simpleSegment(0,0,r.length,n.length)}_makeTileBoundsBuffers(e,t){if(this._tileBoundsBuffer||!t||"mercator"===t.name)return;const i=Xu(ly,this.tileID.canonical,this.tileTransform)[0];let r,n;if(this.isRaster){const e=function(e,t){const i=cg(e,t),r=Math.pow(2,e.z);for(let n=0;n<qg;n++)for(let o=0;o<qg;o++){const s=Ru((e.x+(o+Qg(o))/Gg)/r),a=zu((e.y+(n+Qg(n))/Gg)/r),l=t.project(s,a),c=n*qg+o;Zg[2*c+0]=Math.round((l.x*i.scale-i.x)*fo),Zg[2*c+1]=Math.round((l.y*i.scale-i.y)*fo)}Wg.fill(0),Xg.fill(0);for(let e=2045;e>=0;e--){const t=4*e,i=Hg[t+0],r=Hg[t+1],n=Hg[t+2],o=Hg[t+3],s=i+n>>1,a=r+o>>1,l=s+a-r,c=a+i-s,u=r*qg+i,h=o*qg+n,p=a*qg+s,d=Math.hypot((Zg[2*u+0]+Zg[2*h+0])/2-Zg[2*p+0],(Zg[2*u+1]+Zg[2*h+1])/2-Zg[2*p+1])>=16;Wg[p]=Wg[p]||(d?1:0),e<1022&&(Wg[p]=Wg[p]||Wg[(r+c>>1)*qg+(i+l>>1)]||Wg[(o+c>>1)*qg+(n+l>>1)])}const n=new Fl,o=new Kl;let s=0;function a(e,t){const i=t*qg+e;return 0===Xg[i]&&(n.emplaceBack(Zg[2*i+0],Zg[2*i+1],e*fo/Gg,t*fo/Gg),Xg[i]=++s),Xg[i]-1}function l(e,t,i,r,n,s){const c=e+i>>1,u=t+r>>1;if(Math.abs(e-n)+Math.abs(t-s)>1&&Wg[u*qg+c])l(n,s,e,t,c,u),l(i,r,n,s,c,u);else{const l=a(e,t),c=a(i,r),u=a(n,s);o.emplaceBack(l,c,u)}}return l(0,0,Gg,Gg,Gg,0),l(Gg,Gg,0,0,0,Gg),{vertices:n,indices:o}}(this.tileID.canonical,t);r=e.vertices,n=e.indices}else{r=new Fl,n=new Kl;for(const{x:e,y:t}of i)r.emplaceBack(e,t,0,0);const e=Ep(r.int16,void 0,4);for(let t=0;t<e.length;t+=3)n.emplaceBack(e[t],e[t+1],e[t+2])}this._tileBoundsBuffer=e.createVertexBuffer(r,Yg.members),this._tileBoundsIndexBuffer=e.createIndexBuffer(n),this._tileBoundsSegments=Cc.simpleSegment(0,0,r.length,n.length)}_makeGlobeTileDebugBuffers(t,i){const r=i.projection;if(!r||"globe"!==r.name||i.freezeTileCoverage)return;const n=this.tileID.canonical,o=Zh(Nh(n,i)),s=Jh(i.zoom);let a;s>0&&(a=e.ae.invert(new Float64Array(16),i.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,n,i,o,a,s),this._makeGlobeTileDebugTextBuffer(t,n,i,o,a,s)}_globePoint(t,i,r,n,o,s,a){let l=Gh(t,i,r);if(s){const o=1<<r.z,c=ku(n.center.lng),u=Lu(n.center.lat),h=(r.x+.5)/o-c;let p=0;h>.5?p=-1:h<-.5&&(p=1);let d=(t/fo+r.x)/o+p,f=(i/fo+r.y)/o;d=(d-c)*n._pixelsPerMercatorPixel+c,f=(f-u)*n._pixelsPerMercatorPixel+u;const m=[d*n.worldSize,f*n.worldSize,0];e.$.transformMat4(m,m,s),l=Bh(l,m,a)}return e.$.transformMat4(l,l,o)}_makeGlobeTileDebugBorderBuffer(e,t,i,r,n,o){const s=new Ol,a=new sc,l=new Dl,c=(e,c,u,h,p)=>{const d=(u-e)/(p-1),f=(h-c)/(p-1),m=s.length;for(let u=0;u<p;u++){const h=e+u*d,p=c+u*f;s.emplaceBack(h,p);const _=this._globePoint(h,p,t,i,r,n,o);l.emplaceBack(_[0],_[1],_[2]),a.emplaceBack(m+u)}},u=fo;c(0,0,u,0,16),c(u,0,u,u,16),c(u,u,0,u,16),c(0,u,0,0,16),this._tileDebugIndexBuffer=e.createIndexBuffer(a),this._tileDebugBuffer=e.createVertexBuffer(s,Lh.members),this._globeTileDebugBorderBuffer=e.createVertexBuffer(l,kh.members),this._tileDebugSegments=Cc.simpleSegment(0,0,s.length,a.length)}_makeGlobeTileDebugTextBuffer(e,t,i,r,n,o){const s=fo/4,a=new Ol,l=new Kl,c=new Dl,u=25;l.reserve(32),a.reserve(u),c.reserve(u);const h=(e,t)=>u*e+t;for(let e=0;e<u;e++){const l=e*s;for(let e=0;e<u;e++){const u=e*s;a.emplaceBack(u,l);const h=this._globePoint(u,l,t,i,r,n,o);c.emplaceBack(h[0],h[1],h[2])}}for(let e=0;e<4;e++)for(let t=0;t<4;t++){const i=h(e,t),r=h(e,t+1),n=h(e+1,t),o=h(e+1,t+1);l.emplaceBack(i,r,n),l.emplaceBack(n,r,o)}this._tileDebugTextIndexBuffer=e.createIndexBuffer(l),this._tileDebugTextBuffer=e.createVertexBuffer(a,Lh.members),this._globeTileDebugTextBuffer=e.createVertexBuffer(c,kh.members),this._tileDebugTextSegments=Cc.simpleSegment(0,0,u,32)}destroy(e=!1){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!e&&this.texture&&this.texture instanceof Vg&&(this.texture.destroy(),delete this.texture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}function uy(e,t,i){1===e?t.header_length=i.readFixed32():2===e?t.x=i.readVarint():3===e?t.y=i.readVarint():4===e?t.z=i.readVarint():5===e&&t.layers.push(function(e,t){return e.readFields(my,{version:0,name:"",units:"",tilesize:0,buffer:0,pixel_format:0,data_index:[]},t)}(i,i.readVarint()+i.pos))}function hy(e,t,i){1===e?(t.delta_filter=function(e,t){return e.readFields(py,{block_size:0},t)}(i,i.readVarint()+i.pos),t.filter="delta_filter"):2===e?(i.readVarint(),t.filter="zigzag_filter"):3===e?(i.readVarint(),t.filter="bitshuffle_filter"):4===e&&(i.readVarint(),t.filter="byteshuffle_filter")}function py(e,t,i){1===e&&(t.block_size=i.readVarint())}function dy(e,t,i){1===e?(i.readVarint(),t.codec="gzip_data"):2===e?(i.readVarint(),t.codec="jpeg_image"):3===e?(i.readVarint(),t.codec="webp_image"):4===e&&(i.readVarint(),t.codec="png_image")}function fy(e,t,i){1===e?t.first_byte=i.readFixed64():2===e?t.last_byte=i.readFixed64():3===e?t.filters.push(function(e,t){return e.readFields(hy,{},t)}(i,i.readVarint()+i.pos)):4===e?t.codec=function(e,t){return e.readFields(dy,{},t)}(i,i.readVarint()+i.pos):5===e?t.deprecated_offset=i.readFloat():6===e?t.deprecated_scale=i.readFloat():7===e?t.bands.push(i.readString()):8===e?t.offset=i.readDouble():9===e&&(t.scale=i.readDouble())}function my(e,t,i){1===e?t.version=i.readVarint():2===e?t.name=i.readString():3===e?t.units=i.readString():4===e?t.tilesize=i.readVarint():5===e?t.buffer=i.readVarint():6===e?t.pixel_format=i.readVarint():7===e&&t.data_index.push(function(e,t){return e.readFields(fy,{first_byte:0,last_byte:0,filters:[],codec:null,offset:0,scale:0,deprecated_offset:0,deprecated_scale:0,bands:[]},t)}(i,i.readVarint()+i.pos))}function _y(e,t,i){if(2===e)!function(e,t,i){e.readFields(gy,i,t)}(i,i.readVarint()+i.pos,t);else if(3===e)throw new Error("Not implemented")}function gy(e,t,i){if(1===e){let e=0;const r=i.readVarint()+i.pos;for(;i.pos<r;)t[e++]=i.readVarint()}}class yy{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}put(e,t){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,t)}}function vy(e,t){if(4!==t.length)throw new Error(`Expected data of dimension 4 but got ${t.length}.`);let i=t[3];for(let r=2;r>=1;r--){const n=1===r?1:0,o=2===r?1:0;for(let r=0;r<t[0];r++){const s=t[1]*r;for(let r=n;r<t[1];r++){const n=t[2]*(r+s);for(let r=o;r<t[2];r++){const o=t[3]*(r+n);for(let r=0;r<t[3];r++){const t=o+r;e[t]+=e[t-i]}}}}i*=t[r]}return e}function xy(e){for(let t=0,i=e.length;t<i;t++)e[t]=e[t]>>>1^-(1&e[t]);return e}function by(e,t){switch(t){case"uint32":return e;case"uint16":for(let t=0;t<e.length;t+=2){const i=e[t],r=e[t+1];e[t]=(240&i)>>4|(61440&i)>>8|(240&r)<<4|61440&r,e[t+1]=15&i|(3840&i)>>4|(15&r)<<8|(3840&r)<<4}return e;case"uint8":for(let t=0;t<e.length;t+=4){const i=e[t],r=e[t+1],n=e[t+2],o=e[t+3];e[t+0]=(192&i)>>6|(192&r)>>4|(192&n)>>2|192&o,e[t+1]=(48&i)>>4|(48&r)>>2|48&n|(48&o)<<2,e[t+2]=(12&i)>>2|12&r|(12&n)<<2|(12&o)<<4,e[t+3]=3&i|(3&r)<<2|(3&n)<<4|(3&o)<<6}return e;default:throw new Error(`Invalid pixel format, "${t}"`)}}var wy=Uint8Array,Ty=Uint16Array,My=Int32Array,Ey=new wy([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Sy=new wy([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Cy=new wy([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ay=function(e,t){for(var i=new Ty(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var n=new My(i[30]);for(r=1;r<30;++r)for(var o=i[r];o<i[r+1];++o)n[o]=o-i[r]<<5|r;return{b:i,r:n}},Iy=Ay(Ey,2),ky=Iy.b,Ly=Iy.r;ky[28]=258,Ly[258]=28;for(var Py=Ay(Sy,0).b,Ry=new Ty(32768),zy=0;zy<32768;++zy){var Oy=(43690&zy)>>1|(21845&zy)<<1;Ry[zy]=((65280&(Oy=(61680&(Oy=(52428&Oy)>>2|(13107&Oy)<<2))>>4|(3855&Oy)<<4))>>8|(255&Oy)<<8)>>1}var Dy=function(e,t,i){for(var r=e.length,n=0,o=new Ty(t);n<r;++n)e[n]&&++o[e[n]-1];var s,a=new Ty(t);for(n=1;n<t;++n)a[n]=a[n-1]+o[n-1]<<1;s=new Ty(1<<t);var l=15-t;for(n=0;n<r;++n)if(e[n])for(var c=n<<4|e[n],u=t-e[n],h=a[e[n]-1]++<<u,p=h|(1<<u)-1;h<=p;
vendor: 5,077 bytes, line 1
1++h)s[Ry[h]>>l]=c;return s},Fy=new wy(288);for(zy=0;zy<144;++zy)Fy[zy]=8;for(zy=144;zy<256;++zy)Fy[zy]=9;for(zy=256;zy<280;++zy)Fy[zy]=7;for(zy=280;zy<288;++zy)Fy[zy]=8;var By=new wy(32);for(zy=0;zy<32;++zy)By[zy]=5;var Ny=Dy(Fy,9),jy=Dy(By,5),Uy=function(e){for(var t=e[0],i=1;i<e.length;++i)e[i]>t&&(t=e[i]);return t},Vy=function(e,t,i){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(7&t)&i},$y=function(e,t){var i=t/8|0;return(e[i]|e[i+1]<<8|e[i+2]<<16)>>(7&t)},Gy=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],qy=function(e,t,i){var r=new Error(t||Gy[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,qy),!i)throw r;return r},Hy=new wy(0),Zy="undefined"!=typeof TextDecoder&&new TextDecoder;try{Zy.decode(Hy,{stream:!0})}catch(e){}const Wy={gzip_data:"gzip"};class Xy extends Error{constructor(e){super(e),this.name="MRTError"}}const Qy={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},Yy={uint32:1,uint16:2,uint8:4},Jy={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let Ky,ev;class tv{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const t=this.layers[e];if(!t)throw new Xy(`Layer '${e}' not found`);return t}getHeaderLength(e){const t=new Uint8Array(e),i=new DataView(e);if(13!==t[0])throw new Xy("File is not a valid MRT.");return i.getUint32(1,!0)}parseHeader(e){const t=new Uint8Array(e),i=this.getHeaderLength(e);if(t.length<i)throw new Xy(`Expected header with length >= ${i} but got buffer of length ${t.length}`);const r=function(e,t){return e.readFields(uy,{header_length:0,x:0,y:0,z:0,layers:[]},void 0)}(new Ky(t.subarray(0,i)));if(!isNaN(this.x)&&(this.x!==r.x||this.y!==r.y||this.z!==r.z))throw new Xy(`Invalid attempt to parse header ${r.z}/${r.x}/${r.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=r.x,this.y=r.y,this.z=r.z;for(const e of r.layers)this.layers[e.name]=new iv(e,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const t=[],i=this.getLayer(e.layerName);for(let r of e.blockIndices){const n=i.dataIndex[r],o=n.first_byte-e.firstByte,s=n.last_byte-e.firstByte;if(i._blocksInProgress.has(r))continue;const a={layerName:i.name,firstByte:o,lastByte:s,pixelFormat:i.pixelFormat,blockIndex:r,blockShape:[n.bands.length].concat(i.bandShape),buffer:i.buffer,codec:n.codec.codec,filters:n.filters.map((e=>e.filter))};i._blocksInProgress.add(r),t.push(a)}return new rv(t,(()=>{t.forEach((e=>i._blocksInProgress.delete(e.blockIndex)))}),((e,r)=>{if(t.forEach((e=>i._blocksInProgress.delete(e.blockIndex))),e)throw e;r.forEach((e=>{this.getLayer(e.layerName).processDecodedData(e)}))}))}}class iv{constructor({version:e,name:t,units:i,tilesize:r,pixel_format:n,buffer:o,data_index:s},a){if(this.version=e,1!==this.version)throw new Xy(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=t,this.units=i,this.tileSize=r,this.buffer=o,this.pixelFormat=Qy[n],this.dataIndex=s,this.bandShape=[r+2*o,r+2*o,Yy[this.pixelFormat]],this._decodedBlocks=new yy(a?a.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return Yy[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map((({bands:e})=>e)).flat()}processDecodedData(e){const t=e.blockIndex.toString();this._decodedBlocks.get(t)||this._decodedBlocks.put(t,e.data)}getBlockForBand(e){let t=0;switch(typeof e){case"string":for(const[i,r]of this.dataIndex.entries()){for(const[n,o]of r.bands.entries())if(o===e)return{bandIndex:t+n,blockIndex:i,blockBandIndex:n};t+=r.bands.length}break;case"number":for(const[i,r]of this.dataIndex.entries()){if(e>=t&&e<t+r.bands.length)return{bandIndex:e,blockIndex:i,blockBandIndex:e-t};t+=r.bands.length}break;default:throw new Xy(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}throw new Xy(`Band not found: ${JSON.stringify(e)}`)}getDataRange(e){let t=1/0,i=-1/0;const r=[],n=new Set;for(const o of e){const{blockIndex:e}=this.getBlockForBand(o);if(e<0)throw new Xy(`Invalid band: ${JSON.stringify(o)}`);const s=this.dataIndex[e];r.includes(e)||r.push(e),n.add(e),t=Math.min(t,s.first_byte),i=Math.max(i,s.last_byte)}if(n.size>this.cacheSize)throw new Xy(`Number of blocks to decode (${n.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:t,lastByte:i,blockIndices:r}}hasBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0}hasDataForBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0&&!!this._decodedBlocks.get(t.toString())}getBandView(e){const{blockIndex:t,blockBandIndex:i}=this.getBlockForBand(e),r=this._decodedBlocks.get(t.toString());if(!r)throw new Xy(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const n=this.dataIndex[t],o=this.bandShape.reduce(((e,t)=>e*t),1),s=i*o,a=r.subarray(s,s+o);return{data:a,bytes:new Uint8Array(a.buffer).subarray(a.byteOffset,a.byteOffset+a.b
1yteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:0!==n.offset?n.offset:n.deprecated_offset,scale:0!==n.scale?n.scale:n.deprecated_scale}}}tv.setPbf=function(e){Ky=e};class rv{constructor(e,t,i){this.tasks=e,this._onCancel=t,this._onComplete=i,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,t){this._finalized||(this._onComplete(e,t),this._finalized=!0)}}tv.performDecoding=function(e,t){const i=new Uint8Array(e);return Promise.all(t.tasks.map((e=>{const{layerName:t,firstByte:r,lastByte:n,pixelFormat:o,blockShape:s,blockIndex:a,filters:l,codec:c}=e,u=i.subarray(r,n+1),h=new Uint32Array(s[0]*s[1]*s[2]);let p;if("gzip_data"!==c)throw new Xy(`Unhandled codec: ${c}`);return p=function(e,t){if(!globalThis.DecompressionStream&&"gzip_data"===t)return Promise.resolve(((o=function(e){31==e[0]&&139==e[1]&&8==e[2]||qy(6,"invalid gzip data");var t=e[3],i=10;4&t&&(i+=2+(e[10]|e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[i++]);return i+(2&t)}(n=e))+8>n.length&&qy(6,"invalid gzip data"),function(e,t,i,r){var n=e.length;if(!n||t.f&&!t.l)return i||new wy(0);var o=!i,s=o||2!=t.i,a=t.i;o&&(i=new wy(3*n));var l,c,u=function(e){var t=i.length;if(e>t){var r=new wy(Math.max(2*t,e));r.set(i),i=r}},h=t.f||0,p=t.p||0,d=t.b||0,f=t.l,m=t.d,_=t.m,g=t.n,y=8*n;do{if(!f){h=Vy(e,p,1);var v=Vy(e,p+1,3);if(p+=3,!v){var x=e[(L=4+((p+7)/8|0))-4]|e[L-3]<<8,b=L+x;if(b>n){a&&qy(0);break}s&&u(d+x),i.set(e.subarray(L,b),d),t.b=d+=x,t.p=p=8*b,t.f=h;continue}if(1==v)f=Ny,m=jy,_=9,g=5;else if(2==v){var w=Vy(e,p,31)+257,T=Vy(e,p+10,15)+4,M=w+Vy(e,p+5,31)+1;p+=14;for(var E=new wy(M),S=new wy(19),C=0;C<T;++C)S[Cy[C]]=Vy(e,p+3*C,7);p+=3*T;var A=Uy(S),I=(1<<A)-1,k=Dy(S,A);for(C=0;C<M;){var L,P=k[Vy(e,p,I)];if(p+=15&P,(L=P>>4)<16)E[C++]=L;else{var R=0,z=0;for(16==L?(z=3+Vy(e,p,3),p+=2,R=E[C-1]):17==L?(z=3+Vy(e,p,7),p+=3):18==L&&(z=11+Vy(e,p,127),p+=7);z--;)E[C++]=R}}var O=E.subarray(0,w),D=E.subarray(w);_=Uy(O),g=Uy(D),f=Dy(O,_),m=Dy(D,g)}else qy(1);if(p>y){a&&qy(0);break}}s&&u(d+131072);for(var F=(1<<_)-1,B=(1<<g)-1,N=p;;N=p){var j=(R=f[$y(e,p)&F])>>4;if((p+=15&R)>y){a&&qy(0);break}if(R||qy(2),j<256)i[d++]=j;else{if(256==j){N=p,f=null;break}var U=j-254;j>264&&(U=Vy(e,p,(1<<(G=Ey[C=j-257]))-1)+ky[C],p+=G);var V=m[$y(e,p)&B],$=V>>4;if(V||qy(3),p+=15&V,D=Py[$],$>3){var G=Sy[$];D+=$y(e,p)&(1<<G)-1,p+=G}if(p>y){a&&qy(0);break}s&&u(d+131072);var q=d+U;if(d<D){var H=0-D,Z=Math.min(D,q);for(H+d<0&&qy(3);d<Z;++d)i[d]=(void 0)[H+d]}for(;d<q;++d)i[d]=i[d-D]}}t.l=f,t.p=N,t.b=d,t.f=h,f&&(h=1,t.m=_,t.d=m,t.n=g)}while(!h);return d!=i.length&&o?(l=i,(null==(c=d)||c>l.length)&&(c=l.length),new wy(l.subarray(0,c))):i.subarray(0,d)}(n.subarray(o,-8),{i:2},new wy(((i=n)[(r=i.length)-4]|i[r-3]<<8|i[r-2]<<16|i[r-1]<<24)>>>0))));var i,r,n,o;const s=Wy[t];if(!s)throw new Error(`Unhandled codec: ${t}`);const a=new globalThis.DecompressionStream(s);return new Response(new Blob([e]).stream().pipeThrough(a)).arrayBuffer().then((e=>new Uint8Array(e)))}(u,c).then((e=>(function(e,t){e.readFields(_y,t)}(new Ky(e),h),new(0,Jy[o])(h.buffer)))),p.then((e=>{for(let t=l.length-1;t>=0;t--)switch(l[t]){case"delta_filter":vy(e,s);break;case"zigzag_filter":xy(e);break;case"bitshuffle_filter":by(e,o);break;default:throw new Xy(`Unhandled filter "${l[t]}"`)}return{layerName:t,blockIndex:a,data:e}})).catch((e=>{throw e}))})))},tv.setPbf(Bm);class nv extends cy{constructor(e,t,i,r,n){super(e,t,i,r,n),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1}setTexture(e,t){const i=t.context,r=i.gl;this.texture=this.texture||t.getTileTexture(e.width),this.texture&&this.texture instanceof Vg?this.texture.update(e,{useMipmap:!1,premultiply:!1}):this.texture=new Vg(i,e,r.RGBA,{useMipmap:!1,premultiply:!1})}flushQueues(){for(;this._workQueue.length;)this._workQueue.pop()();for(;this._fetchQueue.length;)this._fetchQueue.pop()()}fetchHeader(e=16384,t){const i=this._mrt=new tv(30),r=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(e-1)}});return this.entireBuffer=null,this.request=rr(r,((r,n,o,s)=>{if(r)t(r);else try{const r=i.getHeaderLength(n);if(r>e)return void(this.request=this.fetchHeader(r,t));i.parseHeader(n),this._isHeaderLoaded=!0;let a=0;for(const e of Object.values(i.layers))a=Math.max(a,e.dataIndex[e.dataIndex.length-1].last_byte);n.byteLength>=a&&(this.entireBuffer=n),t(null,this.entireBuffer||n,o,s)}catch(e){t(e)}})),this.request}fetchBand(e,t,i){const r=this._mrt;if(!this._isHeaderLoaded||!r)return void i(new Error("Tile header is not ready"));const n=this.actor;if(!n)return void i(new Error("Can't fetch tile band without an actor"));let o;const s=(r,n)=>{o.complete(r,n),r?i(r):(this.updateTextureDescriptor(e,t),i(null,this.textureDescriptor&&this.textureDescriptor.img))},a=(e,t)=>{if(e)return i(e);const r=n.send("decodeRasterArray",{buffer:t,task:o},s,void 0,!0);this._workQueue.push((()=>{r&&r.cancel(),o.cancel()}))},l=r.getLayer(e);if(!l)return void i(new Error(`Unknown sourceLayer "${e}"`));if(l.hasDataForBand(t))return this.updateTextureDescriptor(e,t),void i(null,this.textureDescriptor?this.textureDescriptor.img:null);const c=l.getDataRange([t]);if(o=r.createDecodingTask(c),!o||o.tasks.length)if(this.flushQueues(),this.entireBuffer)a(null,this.entireBuffer.slice(c.firstByte,c.lastByte+1));else{const e=Object.assign({}
vendor: 6,028 bytes, line 1
1,this.requestParams,{headers:{Range:`bytes=${c.firstByte}-${c.lastByte}`}}),t=rr(e,a);this._fetchQueue.push((()=>{t.cancel(),o.cancel()}))}else i(null)}updateNeeded(e,t){return(!this.textureDescriptor||this.textureDescriptor.band!==t||this.textureDescriptor.layer!==e)&&"errored"!==this.state}updateTextureDescriptor(e,t){if(!this._mrt)return;const i=this._mrt.getLayer(e);if(!i||!i.hasBand(t)||!i.hasDataForBand(t))return;const{bytes:r,tileSize:n,buffer:o,offset:s,scale:a}=i.getBandView(t),l=n+2*o,c={data:r,width:l,height:l},u=this.texture;u&&u instanceof Vg&&u.update(c,{useMipmap:!1,premultiply:!1}),this.textureDescriptor={layer:e,band:t,img:c,buffer:o,offset:s,tileSize:n,format:i.pixelFormat,mix:[a,256*a,65536*a,16777216*a]}}}class ov{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(const e in this.data)for(const t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,i){const r=e.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);const n={value:t,timeout:void 0};if(void 0!==i&&(n.timeout=setTimeout((()=>{this.remove(e,n)}),i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){const t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;const i=e.wrapped().key,r=void 0===t?0:this.data[i].indexOf(t),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){const t=[];for(const i in this.data)for(const r of this.data[i])e(r.value)||t.push(r);for(const e of t)this.remove(e.value.tileID,e)}}class sv extends Fr{constructor(e,t,i){super(),this.id=e,this._onlySymbols=i,t.on("data",(e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))})),t.on("error",(()=>{this._sourceErrored=!0})),this._source=t,this._tiles={},this._cache=new ov(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Um,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"raster-array"===this._source.type||"custom"===this._source.type&&"raster"===this._source._dataType}onAdd(e){this.map=e,this._minTileCacheSize=void 0===this._minTileCacheSize&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;for(const e in this._tiles){const t=this._tiles[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,t){return e.isSymbolTile=this._onlySymbols,e.isExtraShadowCaster=this._shadowCasterTiles[e.tileID.key],this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e)}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e)}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const t in this._tiles){const i=this._tiles[t];i.upload(e),i.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return ti(this._tiles).map((e=>e.tileID)).sort(av).map((e=>e.key))}getRenderableIds(e,t){const i=[];for(const r in this._tiles)this._isIdRenderable(+r,e,t)&&i.push(this._tiles[r]);return e?i.sort(((e,t)=>{const i=e.tileID,r=t.tileID,n=new Ut(i.canonical.x,i.canonical.y)._rotate(this.transform.angle),o=new Ut(r.canonical.x,r.canonical.y)._rotate(this.transform.angle);return i.overscaledZ-r.overscaledZ||o.y-n.y||o.x-n.x})).map((e=>e.tileID.key)):i.map((e=>e.tileID)).sort(av).map((e=>e.key))}hasRenderableParent(e){const t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t,i){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())&&(i||!this._shadowCasterTiles[e])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}}_reloadTile(e,t){const i=this._tiles[e];i&&("loading"!==i.state&&(i.state=t),this._loadTile(i,this._tileLoaded.bind(this,i,e,t)))}_tileLoaded(e,t,i,r){if(r)if(e.state="errored",404!==r.status)this._source.fire(new zr(r,{tile:e}));else{if(this._source.fire(new Rr("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:e})),!(e.tileID.key in this._loadedParentTiles))return;if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const e=this.map.painter.terrain;this.update(this.transform,e.getScaledDemTileSize(),!0),e.resetTileLookupCache(this.id
vendor: 4,293 bytes, line 1
1)}else this.update(this.transform)}else e.timeAdded=zi.now(),"expired"===i&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),"raster-dem"===this._source.type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new Rr("data",{dataType:"source",tile:e,coord:e.tileID,sourceCacheId:this.id}))}_backfillDEM(e){const t=this.getRenderableIds();for(let r=0;r<t.length;r++){const n=t[r];if(e.neighboringTiles&&e.neighboringTiles[n]){const t=this.getTileByID(n);i(e,t),i(t,e)}}function i(e,t){if(!e.dem||e.dem.borderReady)return;e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0;let i=t.tileID.canonical.x-e.tileID.canonical.x;const r=t.tileID.canonical.y-e.tileID.canonical.y,n=Math.pow(2,e.tileID.canonical.z),o=t.tileID.key;0===i&&0===r||Math.abs(r)>1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,r),e.neighboringTiles&&e.neighboringTiles[o]&&(e.neighboringTiles[o].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,i,r){for(const n in this._tiles){let o=this._tiles[n];if(r[n]||!o.hasData()||o.tileID.overscaledZ<=t||o.tileID.overscaledZ>i)continue;let s=o.tileID;for(;o&&o.tileID.overscaledZ>t+1;){const e=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[e.key],o&&o.hasData()&&(s=e)}let a=s;for(;a.overscaledZ>t;)if(a=a.scaledTo(a.overscaledZ-1),e[a.key]){r[s.key]=s;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){const i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(let i=e.overscaledZ-1;i>=t;i--){const t=e.scaledTo(i),r=this._getLoadedTile(t);if(r)return r}}_getLoadedTile(e){const t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,t){t=t||this._source.tileSize;const i=Math.ceil(e.width/t)+1,r=Math.ceil(e.height/t)+1,n=Math.floor(i*r*5),o="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,n):n,s="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(s)}handleWrapJump(e){const t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){const e={};for(const i in this._tiles){const r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}this._tiles=e;for(const e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(const e in this._tiles)this._setTileReloadTimer(+e,this._tiles[e])}}update(e,t,i,r){if(this.transform=e,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!i)return;this.updateCacheSize(e,t),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const n="batched-model"===this._source.type;let o;if(this.used||this.usedForTerrain){if(this._source.tileID)o=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new Mu(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)));else if(0!==this.tileCoverLift){const r=e.clone();r.tileCoverLift=this.tileCoverLift,o=r.coveringTiles({tileSize:t||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!i,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:n}),this._source.minzoom<=1&&"globe"===e.projection.name&&(o.push(new Mu(1,0,1,0,0)),o.push(new Mu(1,0,1,1,0)),o.push(new Mu(1,0,1,0,1)),o.push(new Mu(1,0,1,1,1)))}else if(o=e.coveringTiles({tileSize:t||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!i,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:n}),this._source.hasTile){const e=this._source.hasTile.bind(this._source);o=o.filter((t=>e(t)))}}else o=[];if(o.length>0&&this.castsShadows&&r&&"globe"!==this.transform.projection.name&&!this.usedForTerrain&&!lv(this._source.type)){const s=e.coveringZoomLevel({tileSize:t||this._source.tileSize,roundZoom:this._source.roundZoom&&!i}),a=Math.min(s,this._source.maxzoom);
vendor: 4,391 bytes, line 1
1if(n){const t=e.extendTileCover(o,a);for(const e of t)o.push(e)}else{const t=e.extendTileCover(o,a,r);for(const e of t)this._shadowCasterTiles[e.key]=!0,o.push(e)}}const s=this._updateRetainedTiles(o);if(lv(this._source.type)&&0!==o.length){const e={},t={},i=Object.keys(s);for(const r of i){const i=s[r],n=this._tiles[r];if(!n||n.fadeEndTime&&n.fadeEndTime<=zi.now())continue;const o=this.findLoadedParent(i,Math.max(i.overscaledZ-sv.maxOverzooming,this._source.minzoom));o&&(this._addTile(o.tileID),e[o.tileID.key]=o.tileID),t[r]=i}const r=o[o.length-1].overscaledZ;for(const e in this._tiles){const i=this._tiles[e];if(s[e]||!i.hasData())continue;let n=i.tileID;for(;n.overscaledZ>r;){n=n.scaledTo(n.overscaledZ-1);const r=this._tiles[n.key];if(r&&r.hasData()&&t[n.key]){s[e]=i.tileID;break}}}for(const t in e)s[t]||(this._coveredTiles[t]=!0,s[t]=e[t])}for(const e in s)this._tiles[e].clearFadeHold();const a=function(e,t){const i=[];for(const r in e)r in t||i.push(r);return i}(this._tiles,s);for(const e of a){const t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):t.hasSymbolBuckets&&!t.symbolFadeFinished()||this._removeTile(+e)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){const t={};if(0===e.length)return t;const i={},r=e.reduce(((e,t)=>Math.min(e,t.overscaledZ)),1/0),n=e[0].overscaledZ,o=Math.max(n-sv.maxOverzooming,this._source.minzoom),s=Math.max(n+sv.maxUnderzooming,this._source.minzoom),a={};for(const i of e){const e=this._addTile(i);t[i.key]=i,e.hasData()||r<this._source.maxzoom&&(a[i.key]=i)}this._retainLoadedChildren(a,r,s,t);for(const r of e){let e=this._tiles[r.key];if(e.hasData())continue;if(r.canonical.z>=this._source.maxzoom){const e=r.children(this._source.maxzoom)[0],i=this.getTile(e);if(i&&i.hasData()){t[e.key]=e;continue}}else{const e=r.children(this._source.maxzoom);if(t[e[0].key]&&t[e[1].key]&&t[e[2].key]&&t[e[3].key])continue}let n=e.wasRequested();for(let s=r.overscaledZ-1;s>=o;--s){const o=r.scaledTo(s);if(i[o.key])break;if(i[o.key]=!0,e=this.getTile(o),!e&&n&&(e=this._addTile(o)),e&&(t[o.key]=o,n=e.wasRequested(),e.hasData()))break}}return t}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let i,r=this._tiles[e].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}t.push(r.key);const e=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(e),i)break;r=e}for(const e of t)this._loadedParentTiles[e]=i}}_addTile(e){let t=this._tiles[e.key];if(t)return!0!==t.isExtraShadowCaster||!!this._shadowCasterTiles[e.key]||this._reloadTile(e.key,"reloading"),t;t=this._cache.getAndRemove(e),t&&(this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,t)));const i=Boolean(t);if(!i){const i=this.map?this.map.painter:null,r=this._source.tileSize*e.overscaleFactor();t="raster-array"===this._source.type?new nv(e,r,this.transform.tileZoom,i,this._isRaster):new cy(e,r,this.transform.tileZoom,i,this._isRaster),this._loadTile(t,this._tileLoaded.bind(this,t,e.key,t.state))}return t?(t.uses++,this._tiles[e.key]=t,i||this._source.fire(new Rr("dataloading",{tile:t,coord:t.tileID,dataType:"source"})),t):null}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),i))}_removeTile(e){const t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state||"empty"===t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id
1)}tilesIn(e,t,i){const r=[],n=this.transform;if(!n)return r;const o="globe"===n.projection.name,s=ku(n.center.lng);for(const a in this._tiles){const l=this._tiles[a];if(i&&l.clearQueryDebugViz(),l.holdingForFade())continue;let c;if(o){const e=l.tileID.canonical;if(0===e.z){const t=[Math.abs(Yt(s,...cv(e,-1))-s),Math.abs(Yt(s,...cv(e,1))-s)];c=[0,2*t.indexOf(Math.min(...t))-1]}else{const t=[Math.abs(Yt(s,...cv(e,-1))-s),Math.abs(Yt(s,...cv(e,0))-s),Math.abs(Yt(s,...cv(e,1))-s)];c=[t.indexOf(Math.min(...t))-1]}}else c=[0];for(const i of c){const o=e.containsTile(l,n,t,i);o&&r.push(o)}}return r}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(e){return this._getRenderableCoordinates(e)}_getRenderableCoordinates(e,t){const i=this.getRenderableIds(e,t).map((e=>this._tiles[e].tileID)),r="globe"===this.transform.projection.name;for(const e of i)e.projMatrix=this.transform.calculateProjMatrix(e.toUnwrapped()),e.expandedProjMatrix=r?this.transform.calculateProjMatrix(e.toUnwrapped(),!1,!0):e.projMatrix;return i}sortCoordinatesByDistance(e){const t=e.slice(),i=this.transform._camera.position,r=this.transform._camera.forward(),n={};for(const e of t){const t=1/(1<<e.canonical.z);n[e.key]=((e.canonical.x+.5)*t+e.wrap-i[0])*r[0]+((e.canonical.y+.5)*t-i[1])*r[1]-i[2]*r[2]}return t.sort(((e,t)=>n[e.key]-n[t.key])),t}hasTransition(){if(this._source.hasTransition())return!0;if(lv(this._source.type))for(const e in this._tiles){const t=this._tiles[e];if(void 0!==t.fadeEndTime&&t.fadeEndTime>=zi.now())return!0}return!1}setFeatureState(e,t,i){this._state.updateState(e=e||"_geojsonTileLayer",t,i)}removeFeatureState(e,t,i){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,i)}getFeatureState(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}
vendor: 25,560 bytes, line 1
1setDependencies(e,t,i){const r=this._tiles[e];r&&r.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(const i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(+i,"reloading");this._cache.filter((i=>!i.hasDependency(e,t)))}_preloadTiles(e,t){if(!this._sourceLoaded){const i=()=>{this._sourceLoaded&&(this._source.off("data",i),this._preloadTiles(e,t))};return void this._source.on("data",i)}const i=new Map,r=Array.isArray(e)?e:[e],n=this.map.painter.terrain,o=this.usedForTerrain&&n?n.getScaledDemTileSize():this._source.tileSize;for(const e of r){const t=e.coveringTiles({tileSize:o,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const e of t)i.set(e.key,e);this.usedForTerrain&&e.updateElevation(!1)}ei(Array.from(i.values()),((e,t)=>{const i=new cy(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(i,(e=>{"raster-dem"===this._source.type&&i.dem&&this._backfillDEM(i),t(e,i)}))}),t)}}function av(e,t){const i=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function lv(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function cv(e,t){const i=1<<e.z;return[e.x/i+t,(e.x+1)/i+t]}sv.maxOverzooming=10,sv.maxUnderzooming=3;const uv=()=>ev||(ev={layout:lm||(lm=new ll({"line-cap":new sl(cl.layout_line["line-cap"]),"line-join":new sl(cl.layout_line["line-join"]),"line-miter-limit":new ol(cl.layout_line["line-miter-limit"]),"line-round-limit":new ol(cl.layout_line["line-round-limit"]),"line-sort-key":new sl(cl.layout_line["line-sort-key"]),"line-z-offset":new sl(cl.layout_line["line-z-offset"]),visibility:new ol(cl.layout_line.visibility)})),paint:cm||(cm=new ll({"line-opacity":new sl(cl.paint_line["line-opacity"]),"line-color":new sl(cl.paint_line["line-color"]),"line-translate":new ol(cl.paint_line["line-translate"]),"line-translate-anchor":new ol(cl.paint_line["line-translate-anchor"]),"line-width":new sl(cl.paint_line["line-width"]),"line-gap-width":new sl(cl.paint_line["line-gap-width"]),"line-offset":new sl(cl.paint_line["line-offset"]),"line-blur":new sl(cl.paint_line["line-blur"]),"line-dasharray":new sl(cl.paint_line["line-dasharray"]),"line-pattern":new sl(cl.paint_line["line-pattern"]),"line-gradient":new al(cl.paint_line["line-gradient"]),"line-trim-offset":new ol(cl.paint_line["line-trim-offset"]),"line-trim-fade-range":new ol(cl.paint_line["line-trim-fade-range"]),"line-trim-color":new ol(cl.paint_line["line-trim-color"]),"line-emissive-strength":new ol(cl.paint_line["line-emissive-strength"]),"line-border-width":new sl(cl.paint_line["line-border-width"]),"line-border-color":new sl(cl.paint_line["line-border-color"]),"line-occlusion-opacity":new ol(cl.paint_line["line-occlusion-opacity"])}))},ev);class hv extends sl{possiblyEvaluate(e,t){return t=new Qa(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,r){return t=ii({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,r)}}let pv,dv,fv,mv;function _v(e,t){return t>0?t+2*e:e}class gv{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:Yr,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ma(gv,"FormatSectionOverride",{omit:["defaultValue"]});const yv=()=>mv||(mv={layout:dv||(dv=new ll({"symbol-placement":new ol(cl.layout_symbol["symbol-placement"]),"symbol-spacing":new ol(cl.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new ol(cl.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new sl(cl.layout_symbol["symbol-sort-key"]),"symbol-z-order":new ol(cl.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new ol(cl.layout_symbol["symbol-z-elevate"]),"icon-allow-overlap":new ol(cl.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new ol(cl.layout_symbol["icon-ignore-placement"]),"icon-optional":new ol(cl.layout_symbol["icon-optional"]),"icon-rotation-alignment":new ol(cl.layout_symbol["icon-rotation-alignment"]),"icon-size":new sl(cl.layout_symbol["icon-size"]),"icon-text-fit":new sl(cl.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new sl(cl.layout_symbol["icon-text-fit-padding"]),"icon-image":new sl(cl.layout_symbol["icon-image"]),"icon-rotate":new sl(cl.layout_symbol["icon-rotate"]),"icon-padding":new ol(cl.layout_symbol["icon-padding"]),"icon-keep-upright":new ol(cl.layout_symbol["icon-keep-upright"]),"icon-offset":new sl(cl.layout_symbol["icon-offset"]),"icon-anchor":new sl(cl.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new ol(cl.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new ol(cl.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new ol(cl.layout_symbol["text-rotation-alignment"]),"text-field":new sl(cl.layout_symbol["text-field"]),"text-font":new sl(cl.layout_symbol["text-font"]),"text-size":new sl(cl.layout_symbol["text-size"]),"text-max-width":new sl(cl.layout_symbol["text-max-width"]),"text-line-height":new sl(cl.layout_symbol["text-line-height"]),"text-letter-spacing":new sl(cl.layout_symbol["text-letter-spacing"]),"text-justify":new sl(cl.layout_symbol["text-justify"]),"text-radial-offset":new sl(cl.layout_symbol["text-radial-offset"]),"text-variable-anchor":new ol(cl.layout_symbol["text-variable-anchor"]),"text-anchor":new sl(cl.layout_symbol["text-anchor"]),"text-max-angle":new ol(cl.layout_symbol["text-max-angle"]),"text-writing-mode":new ol(cl.layout_symbol["text-writing-mode"]),"text-rotate":new sl(cl.layout_symbol["text-rotate"]),"text-padding":new ol(cl.layout_symbol["text-padding"]),"text-keep-upright":new ol(cl.layout_symbol["text-keep-upright"]),"text-transform":new sl(cl.layout_symbol["text-transform"]),"text-offset":new sl(cl.layout_symbol["text-offset"]),"text-allow-overlap":new ol(cl.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new ol(cl.layout_symbol["text-ignore-placement"]),"text-optional":new ol(cl.layout_symbol["text-optional"]),visibility:new ol(cl.layout_symbol.visibility)})),paint:fv||(fv=new ll({"icon-opacity":new sl(cl.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new sl(cl.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new sl(cl.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new sl(cl.paint_symbol["text-emissive-strength"]),"icon-color":new sl(cl.paint_symbol["icon-color"]),"icon-halo-color":new sl(cl.paint_symbol["icon-halo-color"]),"icon-halo-width":new sl(cl.paint_symbol["icon-halo-width"]),"icon-halo-blur":new sl(cl.paint_symbol["icon-halo-blur"]),"icon-translate":new ol(cl.paint_symbol["icon-translate"]),"icon-translate-anchor":new ol(cl.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new sl(cl.paint_symbol["icon-image-cross-fade"]),"text-opacity":new sl(cl.paint_symbol["text-opacity"]),"text-occlusion-opacity":new sl(cl.paint_symbol["text-occlusion-opacity"]),"text-color":new sl(cl.paint_symbol["text-color"],{runtimeType:tn,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new sl(cl.paint_symbol["text-halo-color"]),"text-halo-width":new sl(cl.paint_symbol["text-halo-width"]),"text-halo-blur":new sl(cl.paint_symbol["text-halo-blur"]),"text-translate":new ol(cl.paint_symbol["text-translate"]),"text-translate-anchor":new ol(cl.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new ol(cl.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new ol(cl.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new ol(cl.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new ol(cl.paint_symbol["icon-color-brightness-max"])}))},mv);class vv extends Il{constructor(t,i,r,n){super(t,yv(),i,r,n),this._colorAdjustmentMatrix=e.ae.identity([]),this.hasInitialOcclusionOpacityProperties=void 0!==t.paint&&("icon-occlusion-opacity"in t.paint||"text-occlusion-opacity"in t.paint)}recalculate(e,t){super.recalculate(e,t),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const i=this.layout.get("text-writing-mode");if(i){const e=[];for(const t of i)e.indexOf(t)<0&&e.push(t);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(t,i,r,n){return this._saturation===t&&this._contrast===i&&this._brightnessMin===r&&this._brightnessMax===n||(this._colorAdjustmentMatrix=function(t,i,r,n){t=Pi(t),i=Li(i);const o=e.ae.create(),s=t/3,a=1-2*s,l=[a,s,s,0,s,a,s,0,s,s,a,0,0,0,0,1],c=.5-.5*i,u=n-r;return e.ae.multiply(o,[u,0,0,0,0,u,0,0,0,0,u,0,r,r,r,1],[i,0,0,0,0,i,0,0,0,0,i,0,c,c,c,1]),e.ae.multiply(o,o,l),o}(t,i,r,n),this._saturation=t,this._contrast=i,this._brightnessMin=r,this._brightnessMax=n),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,t,i,r){const n=this.layout.get(e).evaluate(t,{},i,r),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||pa(o.value)||!n?n:function(e,t){return t.replace(/{([^{}]+)}/g,((t,i)=>i in e?String(e[i]):""))}(t.properties,n)}createBucket(e){return new Ug(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of yv().paint.overridableProperties){if(!vv.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),i=new gv(t),r=new ha(i,t.property.specification,this.scope,this.options);let n=null;n="constant"===t.value.kind||"source"===t.value.kind?new fa("source",r):new ma("composite",r,t.value.zoomStops,t.value._interpolationType),this.paint._values[e]=new rl(t.property,n,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&vv.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const i=e.get("text-field"),r=yv().paint.properties[t];let n=!1;const o=e=>{for(const t of e)if(r.overrides&&r.overrides.hasOverride(t))return void(n=!0)};if("constant"===i.value.kind&&i.value.value instanceof _n)o(i.value.value.sections);else if("source"===i.value.kind){const e=t=>{n||(t instanceof wn&&xn(t.value)===sn?o(t.value.sections):t instanceof Sn?o(t.sections):t.eachChild(e))},t=i.value;t._styleExpression&&e(t._styleExpression.expression)}return n}getProgramIds(){const e=0!==this.paint.get("icon-opacity").constantOr(1),t=0!==this.paint.get("text-opacity").constantOr(1),i=[];return e&&i.push("symbolIcon"),t&&i.push("symbolSDF"),i}getDefaultProgramParams(e,t,i){return{config:new Kc(this,{zoom:t,lut:i}),overrideFog:!1}}}let xv,bv,wv,Tv;function Mv(t,i,r,n,o,s,a,l){const c=[t,i,1,r,n,1,o,s,1],u=[a,l,1],h=e.bE.adjoint([],c),[p,d,f]=e.$.transformMat3(u,u,h);return e.bE.multiply(c,c,[p,0,0,0,d,0,0,0,f])}function Ev(t,i,r,n,o,s,a,l){const c=function(t,i,r,n,o,s,a,l){const c=Mv(0,0,1,0,1,1,0,1),u=Mv(t,i,r,n,o,s,a,l),h=e.bE.adjoint([],c);return e.bE.multiply(u,u,h)}(t,i,r,n,o,s,a,l);return[c[2]/c[8]/fo,c[5]/c[8]/fo]}function Sv(e){return[e[0],Math.min(Math.max(e[1],-Du),Du)]}class Cv extends Fr{constructor(e,t,i,r){super(),this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(r),this.options=t,this._dirty=!1}load(e,t){if(this._loaded=t||!1,this.fire(new Rr("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=lr(this.map._requestManager.transformRequest(this.url,Ki.Image),((t,i)=>{this._imageRequest=null,this._loaded=!0,t?this.fire(new zr(t)):i&&(this.image=i instanceof HTMLImageElement?zi.getImageData(i):i,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())}))}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new $g(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Rr("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof $g||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let t=e[0][1],i=e[0][1];for(const r of e)r[1]>i&&(i=r[1]),r[1]<t&&(t=r[1]);const r=(i+t)/2;if(r>Du?this.onNorthPole=!0:r<-Du&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const t=e.map(Uu.fromLngLat);this.tileID=function(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of e)t=Math.min(t,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);const o=Math.max(r-t,n-i),s=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),a=Math.pow(2,s);let l=Math.floor((t+r)/2*a);return l>1&&(l-=1),new wu(s,l,Math.floor((i+n)/2*a))}(t),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Rr("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(t){for(const e in this.tiles){const t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=cg(new wu(0,0,0),this.map.transform.projection),r=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(e){const t=e[1].x-e[0].x,i=e[1].y-e[0].y,r=e[2].x-e[1].x,n=e[2].y-e[1].y,o=e[3].x-e[2].x,s=e[3].y-e[2].y,a=e[0].x-e[3].x,l=e[0].y-e[3].y,c=t*n-r*i,u=r*s-o*n,h=o*l-a*s,p=a*i-t*l;return c>0&&u>0&&h>0&&p>0||c<0&&u<0&&h<0&&p<0}(r))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const n=cg(this.tileID,this.map.transform.projection),[o,s,a,l]=this.coordinates.map((e=>{const t=n.projection.project(e[0],e[1]);return ug(n,t)._round()}));this.perspectiveTransform=Ev(o.x,o.y,s.x,s.y,a.x,a.y,l.x,l.y);const c=this._boundsArray=new Fl;c.emplaceBack(o.x,o.y,0,0),c.emplaceBack(s.x,s.y,fo,0),c.emplaceBack(l.x,l.y,0,fo),c.emplaceBack(a.x,a.y,fo,fo),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=t.createVertexBuffer(c,Yg.members),this.boundsSegments=Cc.simpleSegment(0,0,4,2);const u=[],h=function(e){return[Sv(e[0]),Sv(e[1]),Sv(e[2]),Sv(e[3])]}(this.coordinates),[p,d,f,m]=function(e){let t=e[0][0],i=t,r=e[0][1],n=r;for(let o=1;o<e.length;o++)e[o][0]<t?t=e[o][0]:e[o][0]>i&&(i=e[o][0]),e[o][1]<r?r=e[o][1]:e[o][1]>n&&(n=e[o][1]);return[t,r,i-t,n-r]}(h);{const n=new Fl,[o,s,a,l]=function(e){let t=e[0].x,i=t,r=e[0].y,n=r;for(let o=1;o<e.length;o++)e[o].x<t?t=e[o].x:e[o].x>i&&(i=e[o].x),e[o].y<r?r=e[o].y:e[o].y>n&&(n=e[o].y);return[t,r,i-t,n-r]}(r),c=e=>[(e.x-o)/a,(e.y-s)/l],[h,_,g,y]=r.map(c),v=function(t,i,r,n,o,s,a,l){const c=Mv(0,0,1,0,1,1,0,1),u=Mv(t,i,r,n,o,s,a,l),h=e.bE.adjoint([],u);return e.bE.multiply(c,c,h)}(h[0],h[1],_[0],_[1],g[0],g[1],y[0],y[1]);this.elevatedGlobePerspectiveTransform=Ev(h[0],h[1],_[0],_[1],g[0],g[1],y[0],y[1]);const x=(t,i)=>{u.push(t.lng);const r=Math.round((t.lng-p)/f*fo),o=Math.round((t.lat-d)/m*fo),s=c(i),a=e.$.transformMat3([],[s[0],s[1],1],v),l=Math.round(a[0]/a[2]*fo),h=Math.round(a[1]/a[2]*fo);n.emplaceBack(r,o,l,h)},b=r[3].x-r[0].x,w=r[3].y-r[0].y,T=r[2].x-r[1].x,M=r[2].y-r[1].y;for(let e=0;e<65;e++){const t=e/64,n=[r[0].x+t*b,r[0].y+t*w],o=[r[1].x+t*T,r[1].y+t*M],s=o[0]-n[0],a=o[1]-n[1];for(let e=0;e<65;e++){const t=e/64,r={x:n[0]+s*t,y:n[1]+a*t,z:0};x(i.projection.unproject(r.x,r.y),r)}}this.elevatedGlobeVertexBuffer=t.createVertexBuffer(n,Yg.members)}{this.maxLongitudeTriangleSize=0;let e=[],i=new Kl;const r=(t,r,n)=>{i.emplaceBack(t,r,n);const o=u[t],s=u[r],a=u[n],l=Math.min(Math.min(o,s),a),c=Math.max(Math.max(o,s),a)-l;c>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=c),e.push(l+c/2)};for(let e=0;e<64;e++)for(let t=0;t<64;t++){const i=65*e+t,n=i+1,o=i+65,s=o+1;r(i,o,n),r(n,o,s)}[e,i]=function(e,t){const i=Array.from({length:e.length},((e,t)=>t));i.sort(((t,i)=>e[t]-e[i]));const r=[],n=new Kl;for(let o=0;o<i.length;o++){const s=i[o];r.push(e[s]);const a=3*s,l=a+1;n.emplaceBack(t.uint16[a],t.uint16[l],t.uint16[l+1])}return[r,n]}(e,i),this.elevatedGlobeTrianglesCenterLongitudes=e,this.elevatedGlobeIndexBuffer=t.createIndexBuffer(i)}this.elevatedGlobeSegments=Cc.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,f/fo,0,m/fo,0,0,d,p,0])}prepare(){const e=0!==Object.keys(this.tiles).length;if(this.tileID&&!e)return;const t=this.map.painter.context,i=t.gl;!this._dirty||this.texture instanceof $g||(this.texture?this.texture.update(this.image):(this.texture=new Vg(t,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(t)}loadTile(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state="errored",t(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const t=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!t)return null;const i=this.elevatedGlobeTrianglesCenterLongitudes;let r=(n=e+180)+360*Math.round((i[0]-n)/360);var n;const o=new Cc,s=(e,i)=>{o.segments.push({vertexOffset:0,primitiveOffset:e,vertexLength:t.segments[0].vertexLength,primitiveLength:i,sortKey:void 0,vaos:{}})},a=.51*this.maxLongitudeTriangleSize;if(Math.abs(i[0]-r)<=a){const e=ki(i,0,i.length,r+a);return e===i.length||s(e,Ii(i,e+1,i.length,r+360-a)-e),o}r<i[0]&&(r+=360);const l=Ii(i,0,i.length,r-a);if(l===i.length)return s(0,i.length),o;s(0,l-0);const c=ki(i,l+1,i.length,r+a);return c!==i.length&&s(c,i.length-c),o}}const Av=(Math.pow(256,2)-1)/16907520;class Iv extends Il{constructor(e,t,i,r){super(e,{layout:wv||(wv=new ll({visibility:new ol(cl.layout_raster.visibility)})),paint:Tv||(Tv=new ll({"raster-opacity":new ol(cl.paint_raster["raster-opacity"]),"raster-color":new al(cl.paint_raster["raster-color"]),"raster-color-mix":new ol(cl.paint_raster["raster-color-mix"]),"raster-color-range":new ol(cl.paint_raster["raster-color-range"]),"raster-hue-rotate":new ol(cl.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new ol(cl.paint_raster["raster-brightness-min"]),"raster-brightness-max":new ol(cl.paint_raster["raster-brightness-max"]),"raster-saturation":new ol(cl.paint_raster["raster-saturation"]),"raster-contrast":new ol(cl.paint_raster["raster-contrast"]),"raster-resampling":new ol(cl.paint_raster["raster-resampling"]),"raster-fade-duration":new ol(cl.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new ol(cl.paint_raster["raster-emissive-strength"]),"raster-array-band":new ol(cl.paint_raster["raster-array-band"]),"raster-elevation":new ol(cl.paint_raster["raster-elevation"])}))},t,i,r),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof Cv&&(e._source.onNorthPole||e._source.onSouthPole))&&0===this.paint.get("raster-elevation")}_handleSpecialPaintPropertyUpdate(e){"raster-color"!==e&&"raster-color-range"!==e||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}updateColorRamp(e){if(!this.hasColorMap())return;if(!this._curRampRange)return;const t=this._transitionablePaint._values["raster-color"].value.expression,[i,r]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(i)&&isNaN(r)||i===this._curRampRange[0]&&r===this._curRampRange[1]||(this.colorRamp=wp({expression:t,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:i,end:r}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[i,r])}}let kv,Lv,Pv,Rv,zv;class Ov extends Il{constructor(e,t,i,r){super(e,{layout:kv||(kv=new ll({visibility:new ol(cl["layout_raster-particle"].visibility)})),paint:Lv||(Lv=new ll({"raster-particle-array-band":new ol(cl["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new ol(cl["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new al(cl["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new ol(cl["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new ol(cl["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new ol(cl["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new ol(cl["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new ol(cl["paint_raster-particle"]["raster-particle-elevation"])}))},t,i,r),this._updateColorRamp(),this.lastInvalidatedAt=zi.now()}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return"none"!==this.visibility}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){"raster-particle-color"!==e&&"raster-particle-max-speed"!==e||(this._updateColorRamp(),this._invalidateAnimationState()),"raster-particle-count"===e&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,t=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=wp({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:t}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=zi.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class Dv extends Il{constructor(e,t){super(e,{},t,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isDraped(e){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function Fv(t,i,r){const n=[0,0,1],o=e.aw.identity([]);return e.aw.rotateY(o,o,r?-qt(t)+Math.PI:qt(t)),e.aw.rotateX(o,o,-qt(i)),e.$.transformQuat(n,n,o),e.$.normalize(n,n)}function Bv(t,i){const r=jv(t.projection,t.zoom,t.width,t.height),n=function(t,i,r,n,o){const s=new yu(r.lng-180*Uv,r.lat),a=new yu(r.lng+180*Uv,r.lat),l=t.project(s.lng,s.lat),c=t.project(a.lng,a.lat),u=-Math.atan2(c.y-l.y,c.x-l.x),h=Uu.fromLngLat(r);h.y=Yt(h.y,-1+Uv,1-Uv);const p=h.toLngLat(),d=t.project(p.lng,p.lat),f=Uu.fromLngLat(p);f.x+=Uv;const m=f.toLngLat(),_=t.project(m.lng,m.lat),g=$v(_.x-d.x,_.y-d.y,u),y=Uu.fromLngLat(p);y.y+=Uv;const v=y.toLngLat(),x=t.project(v.lng,v.lat),b=$v(x.x-d.x,x.y-d.y,u),w=Math.abs(g.x)/Math.abs(b.y),T=e.ae.identity([]);
1e.ae.rotateZ(T,T,-u*(1-(o?0:n)));const M=e.ae.identity([]);return e.ae.scale(M,M,[1,1-(1-w)*n,1]),M[4]=-b.x/b.y*n,e.ae.rotateZ(M,M,u),e.ae.multiply(M,T,M),M}(t.projection,0,t.center,r,i),o=Nv(t);return e.ae.scale(n,n,[o,o,1]),n}function Nv(e){const t=e.projection,i=jv(e.projection,e.zoom,e.width,e.height),r=Vv(t,e.center),n=Vv(t,yu.convert(t.center));return Math.pow(2,r*i+(1-i)*n)}function jv(e,t,i,r,n=1/0){const o=e.range;if(!o)return 0;const s=Math.min(n,Math.max(i,r)),a=Math.log(s/1024)/Math.LN2;return Jt(o[0]+a,o[1]+a,t)}const Uv=1/4e4;function Vv(e,t){const i=Yt(t.lat,-Du,Du),r=new yu(t.lng-180*Uv,i),n=new yu(t.lng+180*Uv,i),o=e.project(r.lng,i),s=e.project(n.lng,i),a=Uu.fromLngLat(r),l=Uu.fromLngLat(n),c=s.x-o.x,u=s.y-o.y,h=l.x-a.x,p=l.y-a.y,d=Math.sqrt((h*h+p*p)/(c*c+u*u));return Math.log(d)/Math.LN2}function $v(e,t,i){const r=Math.cos(i),n=Math.sin(i);return{x:e*r-t*n,y:e*n+t*r}}function Gv(t,i,r){e.ae.identity(t),e.ae.rotateZ(t,t,qt(i[2])),e.ae.rotateX(t,t,qt(i[0])),e.ae.rotateY(t,t,qt(i[1])),e.ae.scale(t,t,r),e.ae.multiply(t,t,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function qv(t,i,r,n,o,s,a,l){const c=[r[0]-i[0],r[1]-i[1],0],u=[n[0]-i[0],n[1]-i[1],0];if(e.$.length(c)<1e-12||e.$.length(u)<1e-12)return e.aw.identity(t);const h=e.$.cross([],c,u);e.$.normalize(h,h),e.$.subtract(u,n,i),c[2]=(s-o)*l,u[2]=(a-o)*l;const p=c;return e.$.cross(p,c,u),e.$.normalize(p,p),e.aw.rotationTo(t,h,p)}function Hv(t,i,r=!1){const n=Jh(i.zoom),o=function(t,i,r){const n=i.worldSize,o=[t[12],t[13],t[14]],s=zu(o[1]/n),a=Ru(o[0]/n),l=e.ae.identity([]),c=Pu(1,s)*n,u=Pu(1,0)*n*Bu(s,i.zoom),h=1/Xh(n);let p=u*h;if(r){const e=jv(i.projection,i.zoom,i.width,i.height,1024);p=h*i.projection.pixelSpaceConversion(i.center.lat,n,e)}const d=mu(s,a);e.$.add(d,d,e.$.scale([],e.$.normalize([],d),c*p*o[2]));const f=function(t){const i=[t[0],t[1],t[2]];let r=[0,1,0];const n=e.$.cross([],r,i);return e.$.cross(r,i,n),0===e.$.squaredLength(r)&&(r=[0,1,0],e.$.cross(n,i,r)),e.$.normalize(n,n),e.$.normalize(r,r),e.$.normalize(i,i),[n[0],n[1],n[2],0,r[0],r[1],r[2],0,i[0],i[1],i[2],0,t[0],t[1],t[2],1]}(d);e.ae.scale(l,l,[p,p,p*c]),e.ae.translate(l,l,[-o[0],-o[1],-o[2]]);const m=e.ae.multiply([],i.globeMatrix,f);return e.ae.multiply(m,m,l),e.ae.multiply(m,m,t),m}(t,i,r);if(n>0){const r=function(t,i){const r=i.worldSize,n=Pu(1,0)*r*Bu(i.center.lat,i.zoom)/Xh(r),o=Pu(1,i.center.lat)*r,s=e.ae.identity([]);return e.ae.rotateY(s,s,qt(i.center.lng)),e.ae.rotateX(s,s,qt(i.center.lat)),e.ae.translate(s,s,[0,0,su]),e.ae.scale(s,s,[n,n,n*o]),e.ae.translate(s,s,[i.point.x-.5*r,i.point.y-.5*r,0]),e.ae.multiply(s,s,t),e.ae.multiply(s,i.globeMatrix,s)}(t,i);return function(t,i,r){const n=(t,i,r)=>{const n=e.$.length(t),o=e.$.length(i),s=Bh(t,i,r);return e.$.scale(s,s,1/e.$.length(s)*qr(n,o,r))},o=n([t[0],t[1],t[2]],[i[0],i[1],i[2]],r),s=n([t[4],t[5],t[6]],[i[4],i[5],i[6]],r),a=n([t[8],t[9],t[10]],[i[8],i[9],i[10]],r),l=Bh([t[12],t[13],t[14]],[i[12],i[13],i[14]],r);return[o[0],o[1],o[2],0,s[0],s[1],s[2],0,a[0],a[1],a[2],0,l[0],l[1],l[2],1]}(o,r,n)}return o}function Zv(e,t,i,r){const n=Ch.projectAabbCorners(r,i);let o=Number.MAX_VALUE,s=-1;for(let e=0;e<n.length;++e){const i=n[e];i[0]=(.5*i[0]+.5)*t.width,i[1]=(.5-.5*i[1])*t.height,i[2]<o&&(s=e,o=i[2])}const a=e=>new Ut(n[e][0],n[e][1]);let l;switch(s){case 0:case 6:l=[a(1),a(5),a(4),a(7),a(3),a(2),a(1)];break;case 1:case 7:l=[a(0),a(4),a(5),a(6),a(2),a(3),a(0)];break;case 3:case 5:l=[a(1),a(0),a(4),a(7),a(6),a(2),a(1)];break;default:l=[a(1),a(5),a(6),a(7),a(3),a(0),a(1)]}if(eh(e,l))return o}const Wv=Rl([{name:"a_pos_3f",components:3,type:"Float32"}]),Xv=Rl([{name:"a_color_3f",components:3,type:"Float32"}]),Qv=Rl([{name:"a_color_4f",components:4,type:"Float32"}]),Yv=Rl([{name:"a_uv_2f",components:2,type:"Float32"}]),Jv=Rl([{name:"a_normal_3f",components:3,type:"Float32"}]),Kv=Rl([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),ex=Rl([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);class tx{constructor(e,t,i,r){this.message=(e?`${e}: `:"")+i,r&&(this.identifier=r),null!=t&&t.__line__&&(this.line=t.__line__)}}function ix(e,t){const i=-1===e.indexOf("://");try{return new URL(e,i&&t?"http://example.com":void 0),!0}catch(e){return!1}}class rx{constructor(e,t){this.feature=e,this.instancedDataOffset=t,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}
1class nx{constructor(){this.instancedDataArray=new lc,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class ox{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.fqid)),this.projection=e.projection,this.index=e.index,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0}updateFootprints(e,t){}populate(e,t,i,r){this.tileToMeter=ju(i);const n=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:o,id:s,index:a,sourceLayerIndex:l}of e){const e=null!=s?s:o.properties&&o.properties.hasOwnProperty("id")?o.properties.id:void 0,c=Qu(o,n);if(!this.layers[0]._featureFilter.filter(new Qa(this.zoom),c,i))continue;const u={id:e,sourceLayerIndex:l,index:a,geometry:n?c.geometry:Xu(o,i,r),properties:o.properties,type:o.type,patterns:{}},h=this.addFeature(u,u.geometry,c);h&&t.featureIndex.insert(o,u.geometry,a,l,this.index,this.instancesPerModel[h].instancedDataArray.length,fo/32)}this.lookup=null}update(e,t,i,r){for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];for(const t in e)i.idToFeaturesIndex.hasOwnProperty(t)&&(this.evaluate(i.features[i.idToFeaturesIndex[t]],e[t],i,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let t=!1;for(const i in this.instancesPerModel){const r=this.instancesPerModel[i];for(const i of r.features){const n=this.layers[0],o=i.feature,s=this.canonical,a=n.paint.get("model-rotation").evaluate(o,{},s),l=n.paint.get("model-scale").evaluate(o,{},s),c=n.paint.get("model-translation").evaluate(o,{},s);e.$.exactEquals(i.rotation,a)&&e.$.exactEquals(i.scale,l)&&e.$.exactEquals(i.translation,c)||(this.evaluate(i,i.featureStates,r,!0),t=!0)}}return t}updateReplacement(e,t,i,r){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const n=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(Nd(this.activeReplacements,n))return!1;this.activeReplacements=n;let o=!1;for(const t in this.instancesPerModel){const n=this.instancesPerModel[t],s=n.instancedDataArray;for(const t of n.features){const n=t.instancedDataOffset,a=t.instancedDataCount;for(let t=0;t<a;t++){const a=16*(t+n);let l=s.float32[a+0];l=l>fo?l-fo:l;const c=Math.floor(l),u=s.float32[a+1];let h=!1;for(const t of this.activeReplacements)if(!Od(t,i,sf.Model,r)&&!(t.min.x>c||c>t.max.x||t.min.y>u||u>t.max.y)&&(h=qd(Gd(c,u,e.canonical,t.footprintTileId.canonical),t),h))break;s.float32[a]=h?l+fo:l,o=o||h}}}return o}isEmpty(){for(const e in this.instancesPerModel)if(0!==this.instancesPerModel[e].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const t in this.instancesPerModel){const i=this.instancesPerModel[t];i.instancedDataArray.length<0||0===i.instancedDataArray.length||(i.instancedDataBuffer?i.instancedDataBuffer.updateData(i.instancedDataArray):i.instancedDataBuffer=e.createVertexBuffer(i.instancedDataArray,Kv.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const e in this.instancesPerModel){const t=this.instancesPerModel[e];0!==t.instancedDataArray.length&&t.instancedDataBuffer&&t.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(e&&this.modelUris)for(const t of this.modelUris)e.removeModel(t,"")}addFeature(e,t,i){const r=this.layers[0],n=r.layout.get("model-id").evaluate(i,{},this.canonical);if(!n)return fi(`modelId is not evaluated for layer ${r.id} and it is not going to get rendered.`),n;ix(n,!1)&&(this.modelUris.includes(n)||this.modelUris.push(n)),this.instancesPerModel[n]||(this.instancesPerModel[n]=new nx);const o=this.instancesPerModel[n],s=o.instancedDataArray,a=new rx(i,s.length);for(const e of t)for(const t of e){if(t.x<0||t.x>=fo||t.y<0||t.y>=fo)continue;const e=(this.lookupDim-1)/fo,i=this.lookupDim*(t.y*e|0)+t.x*e|0;if(this.lookup){if(0!==this.lookup[i])continue;this.lookup[i]=1}this.instanceCount++;const r=s.length;s.resize(r+1),o.instancesEvaluatedElevation.push(0),s.float32[16*r]=t.x,s.float32[16*r+1]=t.y}return a.instancedDataCount=o.instancedDataArray.length-a.instancedDataOffset,a.instancedDataCount>0&&(e.id&&(o.idToFeaturesIndex[e.id]=o.features.length),o.features.push(a),this.evaluate(a,{},o,!1)),n}getModelUris(){return this.modelUris}evaluate(e,t,i,r){const n=this.layers[0],o=e.feature,s=this.canonical,a=e.rotation=n.paint.get("model-rotation").evaluate(o,t,s),l=e.scale=n.paint.get("model-scale").evaluate(o,t,s),c=e.translation=n.paint.get("model-translation").evaluate(o,t,s),u=n.paint.get("model-color").evaluate(o,t,s);u.a=n.paint.get("model-color-mix-intensity").evaluate(o,t,s);const h=[];this.maxVerticalOffset<c[2]&&(this.maxVerticalOffset=c[2]),this.maxScale=Math.max(Math.max(this.maxScale,l[0]),Math.max(l[1],l[2])),Gv(h,a,l);const p=Math.round(100*u.a)+u.b/1.05;for(let t=0;t<e.instancedDataCount;++t){const n=e.instancedDataOffset+t,o=16*n,a=i.instancedDataArray.float32;let l=0;r&&(l=a[o+6]-i.instancesEvaluatedElevation[n]);const d=0|a[o+1];a[o]=(0|a[o])+u.r/1.05,a[o+1]=d+u.g/1.05,a[o+2]=p,a[o+3]=1/(s.z>10?this.tileToMeter:ju(s,d)),a[o+4]=c[0],a[o+5]=c[1],a[o+6]=c[2]+l,a[o+7]=h[0],a[o+8]=h[1],a[o+9]=h[2],a[o+10]=h[4],a[o+11]=h[5],a[o+12]=h[6],a[o+13]=h[8],a[o+14]=h[9],a[o+15]=h[10],i.instancesEvaluatedElevation[n]=c[2]}}}let sx,ax;Ma(ox,"ModelBucket",{omit:["layers"]}),Ma(nx,"PerModelAttributes"),Ma(rx,"ModelFeature");const lx=64,cx={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapbox
1MeshFeatures:4,HasMeshoptCompression:8};function ux(t,i,r,n,o,s,a,l,c,u=!1){const h=r.zoom,p=r.project(n),d=Bu(n.lat,h),f=1/d;e.ae.identity(t),e.ae.translate(t,t,[p.x+a[0]*f,p.y+a[1]*f,a[2]]);let m=1,_=1;const g=r.worldSize;if(u){if("mercator"===r.projection.name){let t=0;r.elevation&&(t=r.elevation.getAtPointOrZero(new Uu(p.x/g,p.y/g),0));const i=e.aB.transformMat4([],[p.x,p.y,t,1],r.projMatrix)[3]/r.cameraToCenterDistance;m=i,_=i*Bu(r.center.lat,h)}else if("globe"===r.projection.name){const i=Hv(t,r),o=e.ae.multiply([],r.projMatrix,i),s=[0,0,0,1];e.aB.transformMat4(s,s,o);const a=s[3]/r.cameraToCenterDistance,l=Jh(h),c=r.projection.pixelsPerMeter(n.lat,g)*Bu(n.lat,h),u=r.projection.pixelsPerMeter(r.center.lat,g)*Bu(r.center.lat,h);m=a/qr(c,Fu(r.center.lat),l),_=a*d/c,m*=u,_*=u}}else m=f;e.ae.scale(t,t,[m,m,_]);const y=[...t],v=i.orientation,x=[];if(Gv(x,[v[0]+o[0],v[1]+o[1],v[2]+o[2]],s),e.ae.multiply(t,y,x),l&&r.elevation){let o=0;const s=[];if(c&&r.elevation){o=function(t,i,r,n,o){const s=i.elevation;if(!s)return 0;const a=Ch.projectAabbCorners(r,n),l=Pu(1,o.lat)*i.worldSize,c=function(t,i){const r=[0,0,1],n=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const o of n){const n=t[o.corners[0]],s=t[o.corners[1]],a=t[o.corners[2]],l=[s[0]-n[0],s[1]-n[1],i*(s[2]-n[2])],c=e.$.cross(l,l,[a[0]-n[0],a[1]-n[1],i*(a[2]-n[2])]);e.$.normalize(c,c),o.dotProductWithUp=e.$.dot(c,r)}return n.sort(((e,t)=>e.dotProductWithUp-t.dotProductWithUp)),n[0].corners}(a,l),u=a[c[0]],h=a[c[1]],p=a[c[2]],d=a[c[3]],f=s.getAtPointOrZero(new Uu(u[0]/i.worldSize,u[1]/i.worldSize),0),m=s.getAtPointOrZero(new Uu(h[0]/i.worldSize,h[1]/i.worldSize),0),_=s.getAtPointOrZero(new Uu(p[0]/i.worldSize,p[1]/i.worldSize),0),g=s.getAtPointOrZero(new Uu(d[0]/i.worldSize,d[1]/i.worldSize),0),y=(f+g)/2,v=(m+_)/2;return y>v?m<_?qv(t,h,d,u,m,g,f,l):qv(t,p,u,d,_,f,g,l):f<g?qv(t,u,h,p,f,m,_,l):qv(t,d,p,h,g,_,m,l),Math.max(y,v)}(s,r,i.aabb,t,n);const a=e.ae.fromQuat([],s),l=e.ae.multiply([],a,x);e.ae.multiply(t,y,l)}else o=r.elevation.getAtPointOrZero(new Uu(p.x/g,p.y/g),0);0!==o&&(t[14]+=o)}}function hx(e,t,i=!1){e.uploaded||(e.gfxTexture=new Vg(t,e.image,i?t.gl.R8:t.gl.RGBA,{useMipmap:e.sampler.minFilter>=t.gl.NEAREST_MIPMAP_NEAREST}),e.uploaded=!0,e.image=null)}function px(e,t,i){e.indexBuffer=t.createIndexBuffer(e.indexArray,!1,!0),e.vertexBuffer=t.createVertexBuffer(e.vertexArray,Wv.members,!1,!0),e.normalArray&&(e.normalBuffer=t.createVertexBuffer(e.normalArray,Jv.members,!1,!0)),e.texcoordArray&&(e.texcoordBuffer=t.createVertexBuffer(e.texcoordArray,Yv.members,!1,!0)),e.colorArray&&(e.colorBuffer=t.createVertexBuffer(e.colorArray,(12===e.colorArray.bytesPerElement?Xv:Qv).members,!1,!0)),e.featureArray&&(e.pbrBuffer=t.createVertexBuffer(e.featureArray,ex.members,!0)),e.segments=Cc.simpleSegment(0,0,e.vertexArray.length,e.indexArray.length);const r=e.material;r.pbrMetallicRoughness.baseColorTexture&&hx(r.pbrMetallicRoughness.baseColorTexture,t),r.pbrMetallicRoughness.metallicRoughnessTexture&&hx(r.pbrMetallicRoughness.metallicRoughnessTexture,t),r.normalTexture&&hx(r.normalTexture,t),r.occlusionTexture&&hx(r.occlusionTexture,t,i),r.emissionTexture&&hx(r.emissionTexture,t)}function dx(e,t,i){if(e.meshes)for(const r of e.meshes)px(r,t,i);if(e.children)for(const r of e.children)dx(r,t,i)}function fx(e){if(e.meshes)for(const t of e.meshes)t.indexArray.destroy(),t.vertexArray.destroy(),t.colorArray&&t.colorArray.destroy(),t.normalArray&&t.normalArray.destroy(),t.texcoordArray&&t.texcoordArray.destroy(),t.featureArray&&t.featureArray.destroy();if(e.children)for(const t of e.children)fx(t)}function mx(e){if(e.meshes)for(const i of e.meshes)i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((t=i.material).pbrMetallicRoughness.baseColorTexture&&t.pbrMetallicRoughness.baseColorTexture.gfxTexture&&t.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),t.pbrMetallicRoughness.metallicRoughnessTexture&&t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&t.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),t.normalTexture&&t.normalTexture.gfxTexture&&t.normalTexture.gfxTexture.destroy(),t.emissionTexture&&t.emissionTexture.gfxTexture&&t.emissionTexture.gfxTexture.destroy(),t.occlusionTexture&&t.occlusionTexture.gfxTexture&&t.occlusionTexture.gfxTexture.destroy()));var t;if(e.children)for(const t of e.children)mx(t)}class _x{constructor(e){this._callback=e,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){this._channel=void 0,this._callback=()=>{}}}class gx{constructor(){this.tasks={},this.taskQueue=[],li(["process"],this),this.invoker=new _x(this.process),this.nextId=0}add(e,t){const i=this.nextId++,r=function({type:e,isSymbolTile:t,zoom:i}){return i=i||0,"message"===e?0:"maybePrepare"!==e||t?"parseTile"!==e||t?"parseTile"===e&&t?300-i:"maybePrepare"===e&&t?400-i:500:200-i:100-i}(t);if(0===r){try{e()}finally{}return null}return this.tasks[i]={fn:e,metadata:t,priority:r,id:i},this.taskQueue.push(i),this.invoker.trigger(),{cancel:()=>{delete this.tasks[i]}}}process(){try{if(this.taskQueue=this.taskQueue.filter((e=>!!this.tasks[e])),!this.taskQueue.length)return;const e=this.pick();if(null===e)return;const t=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!t)return;t.fn()}finally{}}pick(){let e=null,t=1/0;for(let i=0;i<this.taskQueue.length;i++){const r=this.tasks[this.taskQueue[i]];r.priority<t&&(t=r.priority,e=i)}if(null===e)return null;const i=this.taskQueue[e];return this.taskQueue.splice(e,1),i}remove(){this.invoker.remove()}}class yx{constructor(e,t,i){this.target=e,this.parent=t,this.mapId=i,this.callbacks={},this.cancelCallbacks={},li(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler
1=new gx}send(e,t,i,r,n=!1,o){const s=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(i.metadata=o,this.callbacks[s]=i);const a=new Set;return this.target.postMessage({id:s,type:e,hasCallback:!!i,targetMapId:r,mustQueue:n,sourceMapId:this.mapId,data:Ca(t,a)},a),{cancel:()=>{i&&delete this.callbacks[s],this.target.postMessage({id:s,type:"<cancel>",targetMapId:r,sourceMapId:this.mapId})}}}receive(e){const t=e.data,i=t.id;if(i&&(!t.targetMapId||this.mapId===t.targetMapId))if("<cancel>"===t.type){const e=this.cancelCallbacks[i];delete this.cancelCallbacks[i],e&&e.cancel()}else if(t.mustQueue||yi()){const e=this.callbacks[i],r=this.scheduler.add((()=>this.processTask(i,t)),e&&e.metadata||{type:"message"});r&&(this.cancelCallbacks[i]=r)}else this.processTask(i,t)}processTask(e,t){if(delete this.cancelCallbacks[e],"<response>"===t.type){const i=this.callbacks[e];delete this.callbacks[e],i&&(t.error?i(Aa(t.error)):i(null,Aa(t.data)))}else{const i=new Set,r=t.hasCallback?(t,r)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:t?Ca(t):null,data:Ca(r,i)},i)}:e=>{},n=Aa(t.data);if(this.parent[t.type])this.parent[t.type](t.sourceMapId,n,r);else if(this.parent.getWorkerSource){const e=t.type.split(".");this.parent.getWorkerSource(t.sourceMapId,e[0],n.source,n.scope)[e[1]](n,r)}else r(new Error(`Could not find function ${t.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}class vx{constructor(e,t){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=ni();const i=this.workerPool.acquire(this.id);for(let e=0;e<i.length;e++){const r=new vx.Actor(i[e],t,this.id);r.name=`Worker ${e}`,this.actors.push(r)}this.ready=!1,this.broadcast("checkIfReady",null,(()=>{this.ready=!0}))}broadcast(e,t,i){ei(this.actors,((i,r)=>{i.send(e,t,r)}),i=i||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((e=>{e.remove()})),this.actors=[],this.workerPool.release(this.id)}}vx.Actor=yx;var xx={workerUrl:"",workerClass:null,workerParams:void 0};function bx(){return null!=xx.workerClass?new xx.workerClass:new self.Worker(xx.workerUrl,xx.workerParams)}const wx="mapboxgl_preloaded_worker_pool";class Tx{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Tx.workerCount;)this.workers.push(new bx);return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&0===this.numActive()&&(this.workers.forEach((e=>{e.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[wx]}numActive(){return Object.keys(this.active).length}}let Mx;function Ex(){return Mx||(Mx=new Tx),Mx}Tx.workerCount=2;let Sx,Cx,Ax,Ix,kx,Lx=null;function Px(){return yi()&&self.worker&&self.worker.dracoUrl?self.worker.dracoUrl:Cx||r.DRACO_URL}function Rx(){if(yi()&&self.worker&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(Ix)return Ix;const e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if("object"!=typeof WebAssembly)throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return Ix=WebAssembly.validate(e)?r.MESHOPT_SIMD_URL:r.MESHOPT_URL,Ix}const zx={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Ox={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},Dx={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function Fx(e,t,i){const r=i.json.bufferViews.length,n=i.buffers.length;t.bufferView=r,i.json.bufferViews[r]={buffer:n,byteLength:e.byteLength},i.buffers[n]=e}const Bx="KHR_draco_mesh_compression";function Nx(e,t){const i=e.extensions&&e.extensions[Bx];if(!i)return;const r=new Ax.Decoder,n=Hx(t,i.bufferView),o=new Ax.Mesh;if(!r.DecodeArrayToMesh(n,n.byteLength,o))throw new Error("Failed to decode Draco mesh");const s=t.json.accessors[e.indices],a=zx[s.componentType],l=s.count*a.BYTES_PER_ELEMENT,c=Ax._malloc(l);a===Uint16Array?r.GetTrianglesUInt16Array(o,l,c):r.GetTrianglesUInt32Array(o,l,c),Fx(Ax.memory.buffer.slice(c,c+l),s,t),Ax._free(c);for(const n of Object.keys(i.attributes)){const s=r.GetAttributeByUniqueId(o,i.attributes[n]),a=t.json.accessors[e.attributes[n]],l=Ox[a.componentType],c=a.count*Dx[a.type]*zx[a.componentType].BYTES_PER_ELEMENT,u=Ax._malloc(c);r.GetAttributeDataArrayForAllPoints(o,s,Ax[l],c,u),Fx(Ax.memory.buffer.slice(u,u+c),a,t),Ax._free(u)}r.destroy(),o.destroy(),delete e.extensions[Bx]}const jx="EXT_meshopt_compression";function Ux(e,t){if(!e.extensions||!e.extensions[jx])return;
1const i=e.extensions[jx],r=new Uint8Array(t.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),n=new Uint8Array(i.count*i.byteStride);kx.decodeGltfBuffer(n,i.count,i.byteStride,r,i.mode,i.filter),e.buffer=t.buffers.length,e.byteOffset=0,t.buffers[e.buffer]=n.buffer,delete e.extensions[jx]}const Vx=1179937895,$x=new TextDecoder("utf8");function Gx(e,t){return new URL(e,t).href}function qx(e,t,i,r){return fetch(Gx(e.uri,r)).then((e=>e.arrayBuffer())).then((e=>{t.buffers[i]=e}))}function Hx(e,t){const i=e.json.bufferViews[t];return new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function Zx(e,t,i,r){if(e.uri){const n=Gx(e.uri,r);return fetch(n).then((e=>e.blob())).then((e=>createImageBitmap(e))).then((e=>{t.images[i]=e}))}if(void 0!==e.bufferView){const r=Hx(t,e.bufferView),n=new Blob([r],{type:e.mimeType});return createImageBitmap(n).then((e=>{t.images[i]=e}))}}function Wx(e,t=0,i){const r={json:null,images:[],buffers:[]};if(new Uint32Array(e,t,1)[0]===Vx){const i=new Uint32Array(e,t);let n=2;const o=(i[n++]>>2)-3,s=i[n++]>>2;if(n++,r.json=JSON.parse($x.decode(i.subarray(n,n+s))),n+=s,n<o){const o=i[n++];n++;const s=t+(n<<2);r.buffers[0]=e.slice(s,s+o)}}else r.json=JSON.parse($x.decode(new Uint8Array(e,t)));const{buffers:n,images:o,meshes:s,extensionsUsed:a,bufferViews:l}=r.json;let c=Promise.resolve();if(n){const e=[];for(let t=0;t<n.length;t++){const o=n[t];o.uri?e.push(qx(o,r,t,i)):r.buffers[t]||(r.buffers[t]=null)}c=Promise.all(e)}return c.then((()=>{const e=[],t=a&&a.includes(Bx),n=a&&a.includes(jx);if(t&&e.push(function(){if(!Ax)return Sx||(Sx=function(e){let t,i=null;function r(){t=new Uint8Array(i.buffer)}function n(){throw new Error("Unexpected Draco error.")}const o={a:{a:n,d:function(e,i,r){return t.copyWithin(e,i,i+r)},c:function(e){const n=t.length,o=Math.max(e>>>0,Math.ceil(1.2*n)),s=Math.ceil((o-n)/65536);try{return i.grow(s),r(),!0}catch(e){return!1}},b:n}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,o):e.then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,o)))).then((e=>{const{Rb:n,Qb:o,P:s,T:a,X:l,Ja:c,La:u,Qa:h,Va:p,Wa:d,eb:f,jb:m,f:_,e:g,yb:y,zb:v,Ab:x,Bb:b,Db:w,Gb:T}=e.instance.exports;i=g;const M=(()=>{let e=0,i=0,r=0,s=0;return a=>{r&&(n(s),n(e),i+=r,r=e=0),e||(i+=128,e=o(i));const l=a.length+7&-8;let c=e;l>=i&&(r=l,c=s=o(l));for(let e=0;e<a.length;e++)t[c+e]=a[e];return c}})();return r(),_(),{memory:g,_free:n,_malloc:o,Mesh:class{constructor(){this.ptr=s()}destroy(){a(this.ptr)}},Decoder:class{constructor(){this.ptr=c()}destroy(){m(this.ptr)}DecodeArrayToMesh(e,t,i){const r=M(e),n=u(this.ptr,r,t,i.ptr);return!!l(n)}GetAttributeByUniqueId(e,t){return{ptr:h(this.ptr,e.ptr,t)}}GetTrianglesUInt16Array(e,t,i){p(this.ptr,e.ptr,t,i)}GetTrianglesUInt32Array(e,t,i){d(this.ptr,e.ptr,t,i)}GetAttributeDataArrayForAllPoints(e,t,i,r,n){f(this.ptr,e.ptr,t.ptr,i,r,n)}},DT_INT8:y(),DT_UINT8:v(),DT_INT16:x(),DT_UINT16:b(),DT_UINT32:w(),DT_FLOAT32:T()}}))}(fetch(Px())),Sx.then((e=>{Ax=e,Sx=void 0})))}()),n&&e.push(function(){if(kx)return;const e=function(e){let t;const i=WebAssembly.instantiateStreaming(e,{}).then((e=>{t=e.instance,t.exports.__wasm_call_ctors()})),r={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},n={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:i,supported:!0,decodeGltfBuffer(e,i,o,s,a,l){!function(e,t,i,r,n,o,s){const a=e.exports.sbrk,l=r+3&-4,c=a(l*n),u=a(o.length),h=new Uint8Array(e.exports.memory.buffer);h.set(o,u);const p=t(c,r,n,u,o.length);if(0===p&&s&&s(c,l,n),i.set(h.subarray(c,c+r*n)),a(c-a(0)),0!==p)throw new Error(`Malformed buffer data: ${p}`)}(t,t.exports[n[a]],e,i,o,s,t.exports[r[l]])}}}(fetch(Rx()));return e.ready.then((()=>{kx=e}))}()),o)for(let t=0;t<o.length;t++)e.push(Zx(o[t],r,t,i));return(e.length?Promise.all(e):Promise.resolve()).then((()=>
vendor: 7,486 bytes, line 1
1{if(t&&s)for(const{primitives:e}of s)for(const t of e)Nx(t,r);if(n&&s&&l)for(const e of l)Ux(e,r);return r}))}))}function Xx(e,t){const i=e.json.bufferViews[t.bufferView],r=zx[t.componentType];return new r(e.buffers[i.buffer],(t.byteOffset||0)+(i.byteOffset||0),t.count*(i.byteStride&&i.byteStride!==Dx[t.type]*r.BYTES_PER_ELEMENT?i.byteStride/r.BYTES_PER_ELEMENT:Dx[t.type]))}function Qx(e,t,i,r){const n=zx[t.componentType],o=function(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(n),s=e.json.bufferViews[t.bufferView],a=s.byteStride?s.byteStride/n.BYTES_PER_ELEMENT:Dx[t.type],l=i.float32,c=l.length/i.capacity;for(let e=0,i=0;e<t.count*a;e+=a,i+=c)for(let t=0;t<c;t++)l[i+t]=r[e+t]*o;i._trim()}function Yx(e,t,i){const r=e.indices,n=e.attributes,o={};o.indexArray=new Kl;const s=t.json.accessors[r],a=s.count/3;o.indexArray.reserve(a);const l=Xx(t,s);for(let e=0;e<a;e++)o.indexArray.emplaceBack(l[3*e],l[3*e+1],l[3*e+2]);o.indexArray._trim(),o.vertexArray=new Ul;const c=t.json.accessors[n.POSITION];o.vertexArray.reserve(c.count);const u=Xx(t,c);for(let e=0;e<c.count;e++)o.vertexArray.emplaceBack(u[3*e],u[3*e+1],u[3*e+2]);if(o.vertexArray._trim(),o.aabb=new Ch(c.min,c.max),o.centroid=function(e,t){const i=[0,0,0],r=e.length;if(r>0){for(let n=0;n<r;n++){const r=3*e[n];i[0]+=t[r],i[1]+=t[r+1],i[2]+=t[r+2]}i[0]/=r,i[1]/=r,i[2]/=r}return i}(l,u),void 0!==n.COLOR_0){const e=t.json.accessors[n.COLOR_0],i=Dx[e.type],r=Xx(t,e);o.colorArray=3===i?new Ul:new jl,o.colorArray.resize(e.count),Qx(t,e,o.colorArray,r)}if(void 0!==n.NORMAL){o.normalArray=new Ul;const e=t.json.accessors[n.NORMAL];o.normalArray.resize(e.count);const i=Xx(t,e);Qx(t,e,o.normalArray,i)}if(void 0!==n.TEXCOORD_0&&i.length>0){o.texcoordArray=new ac;const e=t.json.accessors[n.TEXCOORD_0];o.texcoordArray.resize(e.count);const i=Xx(t,e);Qx(t,e,o.texcoordArray,i)}if(void 0!==n._FEATURE_ID_RGBA4444){const e=t.json.accessors[n._FEATURE_ID_RGBA4444];t.json.extensionsUsed&&t.json.extensionsUsed.includes("EXT_meshopt_compression")&&(o.featureData=Xx(t,e))}void 0!==n._FEATURE_RGBA4444&&(o.featureData=new Uint32Array(Xx(t,t.json.accessors[n._FEATURE_RGBA4444]).buffer));const h=e.material;return o.material=function(e,t){const{emissiveFactor:i=[0,0,0],alphaMode:r="OPAQUE",alphaCutoff:n=.5,normalTexture:o,occlusionTexture:s,emissiveTexture:a,doubleSided:l}=e,{baseColorFactor:c=[1,1,1,1],metallicFactor:u=1,roughnessFactor:h=1,baseColorTexture:p,metallicRoughnessTexture:d}=e.pbrMetallicRoughness||{},f=s?t[s.index]:void 0;if(s&&s.extensions&&s.extensions.KHR_texture_transform&&f){const e=s.extensions.KHR_texture_transform;f.offsetScale=[e.offset[0],e.offset[1],e.scale[0],e.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new $r(...c),metallicFactor:u,roughnessFactor:h,baseColorTexture:p?t[p.index]:void 0,metallicRoughnessTexture:d?t[d.index]:void 0},doubleSided:l,emissiveFactor:i,alphaMode:r,alphaCutoff:n,normalTexture:o?t[o.index]:void 0,occlusionTexture:f,emissionTexture:a?t[a.index]:void 0,defined:void 0===e.defined}}(void 0!==h?t.json.materials[h]:{defined:!1},i),o}function Jx(t,i,r){const{matrix:n,rotation:o,translation:s,scale:a,mesh:l,extras:c,children:u}=t,h={};if(h.matrix=n||e.ae.fromRotationTranslationScale([],o||[0,0,0,1],s||[0,0,0],a||[1,1,1]),void 0!==l){h.meshes=r[l];const e=h.anchor=[0,0];for(const t of h.meshes){const{min:i,max:r}=t.aabb;e[0]+=i[0]+r[0],e[1]+=i[1]+r[1]}e[0]=Math.floor(e[0]/h.meshes.length/2),e[1]=Math.floor(e[1]/h.meshes.length/2)}if(c&&(c.id&&(h.id=c.id),c.lights&&(h.lights=function(e){if(!e.length)return[];const t=function(e){const t=atob(e),i=new Uint8Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.codePointAt(e);return i}(e),i=[],r=t.length/24,n=new Uint16Array(t.buffer),o=new Float32Array(t.buffer);for(let e=0;e<r;e++){const t=n[2*e*6]/30,r=n[2*e*6+1]/30,s=n[2*e*6+10]/100,a=o[6*e+1],l=o[6*e+2],c=o[6*e+3],u=o[6*e+4],h=c-a,p=u-l,d=Math.hypot(h,p);i.push({pos:[a+.5*h,l+.5*p,r],normal:[p/d,-h/d,0],width:d,height:t,depth:s,points:[a,l,c,u]})}return i}(c.lights))),u){const e=[];for(const t of u)e.push(Jx(i.json.nodes[t],i,r));h.children=e}return h}function Kx(e){if(0===e.vertices.length||0===e.indices.length)return null;const t=new od(e.vertices,e.indices,8,256),[i,r]=[t.min.clone(),t.max.clone()];return{vertices:e.vertices,indices:e.indices,grid:t,min:i,max:r}}function eb(e){if(!e.extras||!e.extras.ground)return null;const t=e.extras.ground;if(!t||!Array.isArray(t)||0===t.length)return null;const i=t[0];if(!i||!Array.isArray(i)||0===i.length)return null;const r=[];for(const e of i){if(!Array.isArray(e)||2!==e.length)continue;const t=e[0],i=e[1];"number"==typeof t&&"number"==typeof i&&r.push(new Ut(t,i))}if(r.length<3)return null;r.length>1&&r[r.length-1].equals(r[0])&&r.pop();let n=0;for(let e=0;e<r.length;e++){const t=r[e],i=r[(e+1)%r.length],o=r[(e+2)%r.length];n+=(t.x-i.x)*(o.y-i.y)-(o.x-i.x)*(t.y-i.y)}n>0&&r.reverse();const o=Ep(r.flatMap((e=>[e.x,e.y])),[]);return 0===o.length?null:{vertices:r,indices:o}}function tb(t,i){const r=[],n=[];let o=0;const s=[];for(const a of t){o=r.length;const t=a.vertexArray.float32,l=a.indexArray.uint16;for(let n=0;n<a.vertexArray.length;n++)s[0]=t[3*n+0],s[1]=t[3*n+1],s[2]=t[3*n+2],e.$.transformMat4(s,s,i),r.push(new Ut(s[0],s[1]));for(let e=0;e<3*a.indexArray.length;e++)n.push(l[e]+o)}if(n.length%3!=0)return null;for(let e=0;e<n.length;e+=3){const t=r[n[e+0]],i=r[n[e+1]],o=r[n[e+2]];(t.x-i.x)*(o.y-i.y)-(o.x-i.x)*(t.y-i.y)>0&&([n[e+1],n[e+2]]=[n[e+2],n[e+1]])}return{vertices:r,indices:n}}function ib(e){const t=function(e,t){const i=[],r=WebGL2RenderingContext;if(e.json.textures)for(const n of e.json.textures){const o={magFilter:r.LINEAR,minFilter:r.NEAREST,wrapS:r.REPEAT,wrapT:r.REPEAT};void 0!==n.sampler&&Object.assign(o,e.json.samplers[n.sampler]),i.push({image:t[n.source],sampler:o,uploaded:!1})}return i}(e,e.images),i=function(e,t){const i=[];for(const r of e.json.meshes){const n=[];for(const i of r.primitives)n.push(Yx(i,e,t));i.push(n)}return i}(e,t),{scenes:r,scene:n,nodes:o}=e.json,s=r?r[n||0].nodes:o,a=[];for(const t of s)a.push(Jx(o[t],e,i));return function(e,t,i){const r={},n=new Set;for(let o=0;o<e.length;o++){const e=i[t[o]];if(!e.extras)continue;const s=e.extras["mapbox:footprint:version"],a=e.extras["mapbox:footprint:id"];(s||a)&&n.add(o),"1.0.0"===s&&a&&(r[a]=o)}for(let o=0;o<e.length;o++){if(n.has(o))continue;const s=e[o],a=i[t[o]];if(!a.extras)continue;let l=null;s.id in r&&(l=tb(e[r[s.id]].meshes,s.matrix)),l||(l=eb(a)),l&&(s.footprint=Kx(l))}if(n.size>0){const t=Array.from(n.values()).sort(((e,t)=>e-t));for(let i=t.length-1;i>=0;i--)e.splice(t[i],1)}}(a,s,e.json.nodes),a}function rb(e){e.heightmap=new Float32Array(4096),e.heightmap.fill(-1);const t=e.vertexArray.float32,i=e.aabb.min[0]-1,r=e.aabb.min[1]-1,n=lx/(e.aabb.max[0]-i+2),o=lx/(e.aabb.max[1]-r+2);for(let s=0;s<t.length;s+=3){const a=t[s+2],l=(t[s+0]-i)*n|0,c=(t[s+1]-r)*o|0;a>e.heightmap[c*lx+l]&&(e.heightmap[c*lx+l]=a)}}function nb(t,i){const r={};r.indexArray=new Kl,r.indexArray.reserve(4*t.length),r.vertexArray=new Ul,r.vertexArray.reserve(10*t.length),r.colorArray=new jl,r.vertexArray.reserve(10*t.length);let n=0;for(const o of t){const t=Math.min(10,Math.max(4,1.3*o.height))*i,s=[-o.normal[1],o.normal[0],0],a=Math.min(.29,.1*o.width/o.depth),l=o.width-2*o.depth*i*(a+.01),c=e.$.scaleAndAdd([],o.pos,s,l/2),u=e.$.scaleAndAdd([],o.pos,s,-l/2),h=[c[0],c[
11],c[2]+o.height],p=[u[0],u[1],u[2]+o.height],d=e.$.scaleAndAdd([],o.normal,s,a);e.$.scale(d,d,t);const f=e.$.scaleAndAdd([],o.normal,s,-a);e.$.scale(f,f,t),e.$.add(d,c,d),e.$.add(f,u,f),c[2]+=.1,u[2]+=.1,r.vertexArray.emplaceBack(d[0],d[1],d[2]),r.vertexArray.emplaceBack(f[0],f[1],f[2]),r.vertexArray.emplaceBack(c[0],c[1],c[2]),r.vertexArray.emplaceBack(u[0],u[1],u[2]),r.vertexArray.emplaceBack(h[0],h[1],h[2]),r.vertexArray.emplaceBack(p[0],p[1],p[2]),r.vertexArray.emplaceBack(c[0],c[1],c[2]),r.vertexArray.emplaceBack(u[0],u[1],u[2]),r.vertexArray.emplaceBack(d[0],d[1],d[2]),r.vertexArray.emplaceBack(f[0],f[1],f[2]);const m=l/t/2;r.colorArray.emplaceBack(-m-a,-1,m,.8),r.colorArray.emplaceBack(m+a,-1,m,.8),r.colorArray.emplaceBack(-m,0,m,1.3),r.colorArray.emplaceBack(m,0,m,1.3),r.colorArray.emplaceBack(m+a,-.8,m,.7),r.colorArray.emplaceBack(m+a,-.8,m,.7),r.colorArray.emplaceBack(0,0,m,1.3),r.colorArray.emplaceBack(0,0,m,1.3),r.colorArray.emplaceBack(m+a,-1.2,m,.8),r.colorArray.emplaceBack(m+a,-1.2,m,.8),r.indexArray.emplaceBack(6+n,4+n,8+n),r.indexArray.emplaceBack(7+n,9+n,5+n),r.indexArray.emplaceBack(0+n,1+n,2+n),r.indexArray.emplaceBack(1+n,3+n,2+n),n+=10}const o={defined:!0,emissiveFactor:[0,0,0]},s={};return s.baseColorFactor=$r.white,o.pbrMetallicRoughness=s,r.material=o,r.aabb=new Ch([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),r}const ob=new Float32Array(262144),sb=new Uint8Array(262144);function ab(e){let t=0;if(e.meshes)for(const i of e.meshes)t=Math.max(t,i.aabb.max[2]);if(e.children)for(const i of e.children)t=Math.max(t,ab(i));return t}function lb(e,t,i){if(e.meshes)for(const r of e.meshes)r.aabb.min[0]!==1/0&&i.insert(t,r.aabb.min[0],r.aabb.min[1],r.aabb.max[0],r.aabb.max[1]);if(e.children)for(const r of e.children)lb(r,t,i)}const cb=["","wall","door","roof","window","lamp","logo"];class ub{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.feature={type:"Point",id:e.id,geometry:[],properties:{height:ab(e)}},this.aabb=this._getLocalBounds()}_getLocalBounds(){if(!this.node.meshes)return new Ch([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const t=new Ch([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const i of this.node.meshes)this.node.lightMeshIndex!==e&&(i.transformedAabb=Ch.applyTransformFast(i.aabb,this.node.matrix),t.encapsulate(i.transformedAabb)),e++;this.aabb=t}return this.aabb}}class hb{constructor(e,t,i,r,n,o){this.id=t,this.modelTraits|=cx.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,i&&(this.modelTraits|=cx.HasMapboxMeshFeatures),r&&(this.modelTraits|=cx.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=n,this.dirty=!0,this.needsUpload=!1,this.nodesInfo=[];for(const t of e)this.nodesInfo.push(new ub(t)),lb(t,o.featureIndexArray.length,o.grid),o.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,o.bucketLayerIDs.length-1,0)}updateFootprints(e,t){for(const i of this.getNodesInfo()){const r=i.node;r.footprint&&t.push({footprint:r.footprint,id:e})}}update(){console.log("Update 3D model bucket")}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const t=this.getNodesInfo();for(const i of t){const t=i.node;this.uploaded?this.updatePbrBuffer(t):dx(t,e,!0)}for(const e of t)fx(e.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let t=!1;if(!e.meshes)return t;for(const i of e.meshes)i.pbrBuffer&&(i.pbrBuffer.updateData(i.featureArray),t=!0);return t}needsReEvaluation(e,t,i){const r=e.transform.projectionOptions,n=e.style.getBrightness(),o=this.brightness!==n;return!!(!this.uploaded||this.dirty||r.name!==this.projection.name||pb(i.paint.get("model-color").value,o)||pb(i.paint.get("model-color-mix-intensity").value,o)||pb(i.paint.get("model-roughness").value,o)||pb(i.paint.get("model-emissive-strength").value,o)||pb(i.paint.get("model-height-based-emissive-strength-multiplier").value,o))&&(this.projection=r,this.brightness=n,!0)}evaluateScale(e,t){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const i=this.getNodesInfo(),r=this.id.canonical;for(const e of i){const i=e.feature;e.evaluatedScale=t.paint.get("model-scale").evaluate(i,{},r)}}evaluate(e){const t=this.getNodesInfo();for(const i of t){if(!i.node.meshes)continue;const t=i.feature,r=i.node.meshes&&i.node.meshes[0].featureData,n=i.evaluatedColor[2],o=i.evaluatedRMEA[2],s=this.id.canonical;if(i.hasTranslucentParts=!1,r){for(let r=0;r<cb.length;r++){const n=cb[r];n.length&&(t.properties.part=n);const o=e.paint.get("model-color").evaluate(t,{},s).toRenderColor(null),a=e.paint.get("model-color-mix-intensity").evaluate(t,{},s);i.evaluatedColor[r]=[o.r,o.g,o.b,a],i.evaluatedRMEA[r][0]=e.paint.get("model-roughness").evaluate(t,{},s),i.evaluatedRMEA[r][2]=e.paint.get("model-emissive-strength").evaluate(t,{},s),i.evaluatedRMEA[r][3]=o.a,i.emissionHeightBasedParams[r]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(t,{},s),!i.hasTranslucentParts&&o.a<1&&(i.hasTranslucentParts=!0)}delete t.properties.part,fb(i,n!==i.evaluatedColor[2]||o!==i.evaluatedRMEA[2],this.modelTraits)}else i.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(t,{},s);i.evaluatedScale=e.paint.get("model-scale").evaluate(t,{},s),this.updatePbrBuffer(i.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,t,i,r){const n=e.findDEMTileFor(i);if(n&&(n.tileID.canonical!==this.terrainTile||t!==this.terrainExaggeration)){if
vendor: 1,270 bytes, line 1
1(n.dem&&n.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=n.tileID.overscaledZ;const t=of.create(e,i,n);if(!t)return;this.modelTraits&cx.HasMapboxMeshFeatures&&this.updateDEM(e,t,i,r);for(const e of this.getNodesInfo()){const i=e.node;if(!i.footprint||!i.footprint.vertices||!i.footprint.vertices.length)continue;const r=i.footprint.vertices;let n=t.getElevationAt(r[0].x,r[0].y,!0,!0);for(let e=1;e<r.length;e++)n=Math.min(n,t.getElevationAt(r[e].x,r[e].y,!0,!0));i.elevation=n}}this.terrainTile=n.tileID.canonical,this.terrainExaggeration=t}}updateDEM(e,t,i,r){let n=t._dem._modifiedForSources[r];if(void 0===n&&(t._dem._modifiedForSources[r]=[],n=t._dem._modifiedForSources[r]),n.includes(i.canonical))return;const o=t._dem.dim;n.push(i.canonical);let s=!1;for(const e of this.getNodesInfo()){const i=e.node;if(!i.footprint||!i.footprint.grid)continue;const r=i.footprint.grid,n=t.tileCoordToPixel(r.min.x,r.min.y),a=t.tileCoordToPixel(r.max.x,r.max.y),l=Math.min(Math.min(o-a.y,n.x),Math.min(n.y,o-a.x));if(l<0)continue;const c=Yt(l,2,5);let u=Math.max(0,n.x-c),h=Math.max(0,n.y-c),p=Math.min(a.x+c,o-1),d=Math.min(a.y+c,o-1);for(let e=h;e<=d;++e)for(let t=u;t<=p;++t)sb[e*o+t]=255;let f=0,m=0;for(let e=0;e<r.cellsY;++e)for(let i=0;i<r.cellsX;
1++i){if(!r.cells[e*r.cellsX+i])continue;const n=t.tileCoordToPixel(r.min.x+i/r.xScale,r.min.y+e/r.yScale),s=t.tileCoordToPixel(r.min.x+(i+1)/r.xScale,r.min.y+(e+1)/r.yScale);for(let e=n.y;e<=Math.min(s.y+1,o-1);++e)for(let i=n.x;i<=Math.min(s.x+1,o-1);++i)255===sb[e*o+i]&&(sb[e*o+i]=0,f+=t.getElevationAtPixel(i,e),m++)}const _=f/m;u=Math.max(1,n.x-c),h=Math.max(1,n.y-c),p=Math.min(a.x+c,o-2),d=Math.min(a.y+c,o-2),s=!0;for(let e=h;e<=d;++e)for(let i=u;i<=p;++i)0===sb[e*o+i]&&(ob[e*o+i]=t._dem.set(i,e,_));for(let e=1;e<c;++e){u=Math.max(1,n.x-e),h=Math.max(1,n.y-e),p=Math.min(a.x+e,o-2),d=Math.min(a.y+e,o-2);for(let i=h;i<=d;++i)for(let r=u;r<=p;++r){const n=i*o+r;if(255===sb[n]){let s=0,a=0,l=-1,u=-1;for(let t=-1;t<=1;++t)for(let n=-1;n<=1;++n){const c=(i+t)*o+r+n;if(sb[c]>=e)continue;const h=ob[c],p=Math.abs(h);p>a&&(s=h,a=p,l=n,u=t)}if(a>.1){const o=1-(e+.5*Math.abs(l*u))/c;let a=t._dem.get(r,i)+s*o;const h=t._dem.get(r+l,i+u),p=t._dem.get(r-l,i-u,!0);(a-h)*(a-p)>0&&(a=(h+p)/2),ob[n]=t._dem.set(r,i,a),sb[n]=e}}}}}s&&(t._demTile.needsDEMTextureUpload=!0,t._dem._timestamp=zi.now())}getNodesInfo(){return this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const t of e)fx(t.node),mx(t.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const i=t.getReplacementRegionsForTile(e.toUnwrapped()),r=this.getNodesInfo();for(let e=0;e<this.nodesInfo.length;e++){const t=r[e].node;r[e].hiddenByReplacement=!!t.footprint&&!i.find((e=>e.footprint===t.footprint))}}getHeightAtTileCoord(t,i){const r=this.getNodesInfo(),n=[],o=[0,0,0],s=e.ae.identity([]);for(let a=0;a<this.nodesInfo.length;a++){const l=r[a],c=l.node.meshes[0],u=c.transformedAabb;if(t<u.min[0]||i<u.min[1]||t>u.max[0]||i>u.max[1])continue;if(!0===l.node.hidden)return{height:0,maxHeight:l.feature.properties.height,hidden:!1,verticalScale:l.evaluatedScale[2]};e.ae.invert(s,l.node.matrix),o[0]=t,o[1]=i,e.$.transformMat4(o,o,s);const h=(o[0]-c.aabb.min[0])/(c.aabb.max[0]-c.aabb.min[0])*lx|0,p=Math.min(63,(o[1]-c.aabb.min[1])/(c.aabb.max[1]-c.aabb.min[1])*lx|0)*lx+Math.min(63,h),d=c.heightmap[p];if(!(d<0&&l.node.footprint)){if(l.hiddenByReplacement)return;return{height:d,maxHeight:l.feature.properties.height,hidden:!1,verticalScale:l.evaluatedScale[2]}}if(l.node.footprint.grid.query(new Ut(t,i),new Ut(t,i),n),n.length>0)return{height:void 0,maxHeight:l.feature.properties.height,hidden:l.hiddenByReplacement,verticalScale:l.evaluatedScale[2]}}}}function pb(e,t){return!e.isLightConstant&&t}function db(e,t,i,r,n,o,s,a){let l=(61440&t|(61440&t)>>4)>>8,c=(3840&t|(3840&t)>>4)>>4,u=240&t|(240&t)>>4;i[3]>0&&(l=qr(l,255*i[0],i[3]),c=qr(c,255*i[1],i[3]),u=qr(u,255*i[2],i[3]));const h=l<<8|c,p=u<<8|Math.floor(255*r[3]),d=function(e){const t=Yt(e,0,2);return Math.min(Math.round(.5*t*255),255)}(r[2])<<8|15*r[0]<<4|15*r[1],f=Yt(n[0],0,1),m=Yt(n[1],0,1),_=Yt(n[2],0,1),g=Yt(n[3],0,1);let y,v,x,b;if(f!==m&&s!==o&&m!==f){const e=s-o;v=1/(e*(m-f)),x=-(o+e*f)/(e*(m-f));const t=Yt(n[4],-1,1);b=Math.pow(10,t),y=255*_<<8|255*g}else y=65535,v=0,x=1,b=1;if(e.emplaceBack(h,p,d,y,v,x,b),a){const e=a.length;a.clear();for(let t=0;t<e;t++)a.emplaceBack(h,p,d,y,v,x,b)}}function fb(e,t,i){const r=e.node;let n=0;const o=i&cx.HasMeshoptCompression;for(const i of r.meshes){if(r.lights&&r.lightMeshIndex===n)continue;if(!i.featureData)continue;i.featureArray=new cc,i.featureArray.reserve(i.featureData.length);let s=t;for(const t of i.featureData){const n=o?65535&t:t>>16&65535,a=o?t>>16&65535:65535&t,l=(15&a)<8?15&a:0,c=e.evaluatedRMEA[l],u=e.evaluatedColor[l],h=e.emissionHeightBasedParams[l];let p;if(s&&2===l&&r.lights&&(p=new cc,p.resize(10*r.lights.length)),db(i.featureArray,n,u,c,h,i.aabb.min[2],i.aabb.max[2],p),p&&s){s=!1;const e=r.meshes[r.lightMeshIndex];e.featureArray=p,e.featureArray._trim()}}i.featureArray._trim(),n++}}function mb(e,t,i,r){const n=1<<e.z;t.lat=zu((r/fo+e.y)/n),t.lng=Ru((i/fo+e.x)/n)}Ma(hb,"Tiled3dModelBucket",{omit:["layers"]}),Ma(ub,"Tiled3dModelFeature");const _b={circle:class extends Il{constructor(e,t,i,r){super(e,{layout:yh||(yh=new ll({"circle-sort-key":new sl(cl.layout_circle["circle-sort-key"]),visibility:new ol(cl.layout_circle.visibility)})),paint:vh||(vh=new ll({"circle-radius":new sl(cl.paint_circle["circle-radius"]),"circle-color":new sl(cl.paint_circle["circle-color"]),"circle-blur":new sl(cl.paint_circle["circle-blur"]),"circle-opacity":new sl(cl.paint_circle["circle-opacity"]),"circle-translate":new ol(cl.paint_circle["circle-translate"]),"circle-translate-anchor":new ol(cl.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new ol(cl.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new ol(cl.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new sl(cl.paint_circle["circle-stroke-width"]),"circle-stroke-color":new sl(cl.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new sl(cl.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new ol(cl.paint_circle["circle-emissive-strength"])}))},t,i,r)}createBucket(e){return new Ku(e)}queryRadius(e){const t=e;return fh("circle-radius",this,t)+fh("circle-stroke-width",this,t)+mh(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,i,r,n,o,s,a){const l=gh(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),c=this.paint.get("circle-radius").evaluate(t,i)+this.paint.get("circle-stroke-width").evaluate(t,i);return sp(e,r,o,s,a,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,c)}getProgramIds(){return["circle"]}getDefaultProgramParams(e,t,i){const r=op(this);return{config:new Kc(this,{zoom:t,lut:i}),defines:r,overrideFog:!1}}},heatmap:class extends Il{createBucket(e){return new hp(e)}
vendor: 14,622 bytes, line 1
1constructor(e,t,i,r){super(e,{layout:yp||(yp=new ll({visibility:new ol(cl.layout_heatmap.visibility)})),paint:vp||(vp=new ll({"heatmap-radius":new sl(cl.paint_heatmap["heatmap-radius"]),"heatmap-weight":new sl(cl.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new ol(cl.paint_heatmap["heatmap-intensity"]),"heatmap-color":new al(cl.paint_heatmap["heatmap-color"]),"heatmap-opacity":new ol(cl.paint_heatmap["heatmap-opacity"])}))},t,i,r),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=wp({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(e){return fh("heatmap-radius",this,e)}queryIntersectsFeature(e,t,i,r,n,o,s,a){const l=this.paint.get("heatmap-radius").evaluate(t,i);return sp(e,r,o,s,a,!0,!0,new Ut(0,0),l)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(e,t,i){return"heatmap"===e?{config:new Kc(this,{zoom:t,lut:i}),overrideFog:!1}:{}}},hillshade:class extends Il{constructor(e,t,i,r){super(e,{layout:xp||(xp=new ll({visibility:new ol(cl.layout_hillshade.visibility)})),paint:bp||(bp=new ll({"hillshade-illumination-direction":new ol(cl.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new ol(cl.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new ol(cl.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new ol(cl.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new ol(cl.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new ol(cl.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new ol(cl.paint_hillshade["hillshade-emissive-strength"])}))},t,i,r)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(e,t,i){return{overrideFog:!1}}},fill:class extends Il{constructor(e,t,i,r){super(e,{layout:td||(td=new ll({"fill-sort-key":new sl(cl.layout_fill["fill-sort-key"]),visibility:new ol(cl.layout_fill.visibility)})),paint:id||(id=new ll({"fill-antialias":new ol(cl.paint_fill["fill-antialias"]),"fill-opacity":new sl(cl.paint_fill["fill-opacity"]),"fill-color":new sl(cl.paint_fill["fill-color"]),"fill-outline-color":new sl(cl.paint_fill["fill-outline-color"]),"fill-translate":new ol(cl.paint_fill["fill-translate"]),"fill-translate-anchor":new ol(cl.paint_fill["fill-translate-anchor"]),"fill-pattern":new sl(cl.paint_fill["fill-pattern"]),"fill-emissive-strength":new ol(cl.paint_fill["fill-emissive-strength"])}))},t,i,r)}getProgramIds(){const e=this.paint.get("fill-pattern"),t=e&&e.constantOr(1),i=[t?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(t&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(e,t,i){return{config:new Kc(this,{zoom:t,lut:i}),overrideFog:!1}}recalculate(e,t){super.recalculate(e,t);const i=this.paint._values["fill-outline-color"];"constant"===i.value.kind&&void 0===i.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new ed(e)}queryRadius(){return mh(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,i,r,n,o){return!e.queryGeometry.isAboveHorizon&&ih(_h(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),r)}isTileClipped(){return!0}},"fill-extrusion":class extends Il{constructor(e,t,i,r){super(e,{layout:Df||(Df=new ll({visibility:new ol(cl["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new ol(cl["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:Ff||(Ff=new ll({"fill-extrusion-opacity":new ol(cl["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new sl(cl["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new ol(cl["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new ol(cl["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new sl(cl["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new sl(cl["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new sl(cl["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new ol(cl["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new ol(cl["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new ol(cl["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new ol(cl["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new ol(cl["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new ol(cl["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new ol(cl["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new ol(cl["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new sl(cl["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new sl(cl["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new ol(cl["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new ol(cl["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new ol(cl["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new ol(cl["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new ol(cl["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new sl(cl["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-line-alignment":new ol(cl["paint_fill-extrusion"]["fill-extrusion-line-alignment"])}))},t,i,r),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new Ef(e)}queryRadius(){return mh(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}hasShadowPass(){return!0}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(t,i,r,n,o,s,a,l,c){const u=gh(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,t.pixelToTileUnitsFactor),h=this.paint.get("fill-extrusion-height").evaluate(i,r),p=this.paint.get("fill-extrusion-base").evaluate(i,r),d=[0,0],f=l&&s.elevation,m=s.elevation?s.elevation.exaggeration():1,_=t.tile.getBucket(this);if(f&&_ instanceof Ef){const e=_.centroidVertexArray,t=c+1;t<e.length&&(d[0]=e.geta_centroid_pos0(t),d[1]=e.geta_centroid_pos1(t))}if(0===d[0]&&1===d[1])return!1;"globe"===s.projection.name&&(n=zf([n],[new Ut(0,0),new Ut(fo,fo)],t.tileID.canonical).map((e=>e.polygon)).flat());const g=f?l:null,[y,v]=function(t,i,r,n,o,s,a,l,c,u,h){return"globe"===t.projection.name?function(t,i,r,n,o,s,a,l,c,u,h){const p=[],d=[],f=t.projection.upVectorScale(h,t.center.lat,t.worldSize).metersToTile,m=[0,0,0,1],_=[0,0,0,1],g=(e,t,i,r)=>{e[0]=t,e[1]=i,e[2]=r,e[3]=1},y=Rf();r>0&&(r+=y),n+=y;for(const y of i){const i=[],v=[];for(const p of y){const d=p.x+o.x,y=p.y+o.y,x=t.projection.projectTilePoint(d,y,h),b=t.projection.upVector(h,p.x,p.y);let w=r,T=n;if(a){const e=jf(d,y,r,n,a,l,c,u);w+=e.base,T+=e.top}0!==r?g(m,x.x+b[0]*f*w,x.y+b[1]*f*w,x.z+b[2]*f*w):g(m,x.x,x.y,x.z),g(_,x.x+b[0]*f*T,x.y+b[1]*f*T,x.z+b[2]*f*T),e.$.transformMat4(m,m,s),e.$.transformMat4(_,_,s),i.push(new Id(m[0],m[1],m[2])),v.push(new Id(_[0],_[1],_[2]))}p.push(i),d.push(v)}return[p,d]}(t,i,r,n,o,s,a,l,c,u,h):a?function(t,i,r,n,o,s,a,l,c){const u=[],h=[],p=[0,0,0,1];for(const d of t){const t=[],f=[];for(const u of d){const h=u.x+n.x,d=u.y+n.y,m=jf(h,d,i,r,s,a,l,c);p[0]=h,p[1]=d,p[2]=m.base,p[3]=1,e.aB.transformMat4(p,p,o),p[3]=Math.max(p[3],1e-5);const _=new Id(p[0]/p[3],p[1]/p[3],p[2]/p[3]);p[0]=h,p[1]=d,p[2]=m.top,p[3]=1,e.aB.transformMat4(p,p,o),p[3]=Math.max(p[3],1e-5);const g=new Id(p[0]/p[3],p[1]/p[3],p[2]/p[3]);t.push(_),f.push(g)}u.push(t),h.push(f)}return[u,h]}(i,r,n,o,s,a,l,c,u):function(e,t,i,r,n){const o=[],s=[],a=n[8]*t,l=n[9]*t,c=n[10]*t,u=n[11]*t,h=n[8]*i,p=n[9]*i,d=n[10]*i,f=n[11]*i;for(const t of e){const e=[],i=[];for(const o of t){const t=o.x+r.x,s=o.y+r.y,m=n[0]*t+n[4]*s+n[12],_=n[1]*t+n[5]*s+n[13],g=n[2]*t+n[6]*s+n[14],y=n[3]*t+n[7]*s+n[15],v=m+a,x=_+l,b=g+c,w=Math.max(y+u,1e-5),T=m+h,M=_+p,E=g+d,S=Math.max(y+f,1e-5);e.push(new Id(v/w,x/w,b/w)),i.push(new Id(T/S,M/S,E/S))}o.push(e),s.push(i)}return[o,s]}(i,r,n,o,s)}(s,n,p,h,u,a,g,d,m,s.center.lat,t.tileID.canonical),x=t.queryGeometry;return function(e,t,i){let r=1/0;ih(i,t)&&(r=Nf(i,t[0]));for(let n=0;n<t.length;n++){const o=t[n],s=e[n];for(let e=0;e<o.length-1;e++){const t=o[e],n=[t,o[e+1],s[e+1],s[e],t];eh(i,n)&&(r=Math.min(r,Nf(i,n)))}}return r!==1/0&&r}(y,v,x.isPointQuery()?x.screenBounds:x.screenGeometry)}},line:class extends Il{constructor(e,t,i,r){const n=uv();super(e,n,t,i,r),n.layout&&(this.layout=new nl(n.layout)),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof rs,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=(()=>{if(pv)return pv;const e=uv();return pv=new hv(e.paint.properties["line-width"].specification),pv.useIntegerZoom=!0,pv})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new sm(e)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(e,t,i){const r=dm(this);return{config:new Kc(this,{zoom:t,lut:i}),defines:r,overrideFog:!1}}queryRadius(e){const t=e,i=_v(fh("line-width",this,t),fh("line-gap-width",this,t)),r=fh("line-offset",this,t);return i/2+Math.abs(r)+mh(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,i,r,n,o){if(e.queryGeometry.isAboveHorizon)return!1;const s=_h(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),a=e.pixelToTileUnitsFactor/2*_v(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),l=this.paint.get("line-offset").evaluate(t,i);return l&&(r=function(e,t){const i=[],r=new Ut(0,0);for(let n=0;n<e.length;n++){const o=e[n],s=[];for(let e=0;e<o.length;e++){const i=o[e],n=o[e+1],a=0===e?r:i.sub(o[e-1])._unit()._perp(),l=e===o.length-1?r:n.sub(i)._unit()._perp(),c=a._add(l)._unit();c._mult(1/(c.x*l.x+c.y*l.y)),s.push(c._mult(t)._add(i))}i.push(s)}return i}(r,l*e.pixelToTileUnitsFactor)),function(e,t,i){for(let r=0;r<t.length;r++){const n=t[r];if(e.length>=3)for(let t=0;t<n.length;t++)if(ch(e,n[t]))return!0;if(rh(e,n,i))return!0}return!1}(s,r,a)}isTileClipped(){return!0}isDraped(e){const t=this.layout.get("line-z-offset");return t.isConstant()&&!t.constantOr(0)}},symbol:vv,background:class extends Il{constructor(e,t,i,r){super(e,{layout:xv||(xv=new ll({visibility:new ol(cl.layout_background.visibility)})),paint:bv||(bv=new ll({"background-color":new ol(cl.paint_background["background-color"]),"background-pattern":new ol(cl.paint_background["background-pattern"]),"background-opacity":new ol(cl.paint_background["background-opacity"]),"background-emissive-strength":new ol(cl.paint_background["background-emissive-strength"])}))},t,i,r)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(e,t,i){return{overrideFog:!1}}},raster:Iv,"raster-particle":Ov,sky:class extends Il{constructor(e,t,i,r){super(e,{layout:Pv||(Pv=new ll({visibility:new ol(cl.layout_sky.visibility)})),paint:Rv||(Rv=new ll({"sky-type":new ol(cl.paint_sky["sky-type"]),"sky-atmosphere-sun":new ol(cl.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new ol(cl.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new ol(cl.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new ol(cl.paint_sky["sky-gradient-radius"]),"sky-gradient":new al(cl.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new ol(cl.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new ol(cl.paint_sky["sky-atmosphere-color"]),"sky-opacity":new ol(cl.paint_sky["sky-opacity"])}))},t,i,r),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"sky-gradient"===e?this._updateColorRamp():"sky-atmosphere-sun"!==e&&"sky-atmosphere-halo-color"!==e&&"sky-atmosphere-color"!==e&&"sky-atmosphere-sun-intensity"!==e||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=wp({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(e){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const t=e.style.light.properties.get("position");return this._lightPosition.azimuthal!==t.azimuthal||this._lightPosition.polar!==t.polar}return!1}getCenter(e,t){if("atmosphere"===this.paint.get("sky-type")){const i=this.paint.get("sky-atmosphere-sun"),r=!i,n=e.style.light,o=n.properties.get("position");return r&&"viewport"===n.properties.get("anchor")&&fi("The sun direction is attached to a light with viewport anchor, lighting may behave unex
1pectedly."),r?Fv(o.azimuthal,90-o.polar,t):Fv(i[0],90-i[1],t)}const i=this.paint.get("sky-gradient-center");return Fv(i[0],90-i[1],t)}isSky(){return!0}markSkyboxValid(e){this._skyboxInvalidated=!1,this._lightPosition=e.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const e=this.paint.get("sky-type");return"atmosphere"===e?["skyboxCapture","skybox"]:"gradient"===e?["skyboxGradient"]:null}},slot:class extends Il{constructor(e,t,i,r){super(e,{paint:zv||(zv=new ll({}))},t,null)}},model:class extends Il{constructor(e,t,i,r){super(e,{layout:sx||(sx=new ll({visibility:new ol(cl.layout_model.visibility),"model-id":new sl(cl.layout_model["model-id"])})),paint:ax||(ax=new ll({"model-opacity":new ol(cl.paint_model["model-opacity"]),"model-rotation":new sl(cl.paint_model["model-rotation"]),"model-scale":new sl(cl.paint_model["model-scale"]),"model-translation":new sl(cl.paint_model["model-translation"]),"model-color":new sl(cl.paint_model["model-color"]),"model-color-mix-intensity":new sl(cl.paint_model["model-color-mix-intensity"]),"model-type":new ol(cl.paint_model["model-type"]),"model-cast-shadows":new ol(cl.paint_model["model-cast-shadows"]),"model-receive-shadows":new ol(cl.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new ol(cl.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new sl(cl.paint_model["model-emissive-strength"]),"model-roughness":new sl(cl.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new sl(cl.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new ol(cl.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new ol(cl.paint_model["model-front-cutoff"])}))},t,i,r),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new ox(e)}getProgramIds(){return["model"]}is3D(){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(e){return e instanceof hb?fo-1:0}queryIntersectsFeature(t,i,r,n,o,s){if(!this.modelManager)return!1;const a=this.modelManager,l=t.tile.getBucket(this);if(!(l&&l instanceof ox))return!1;const c=l;for(const r in c.instancesPerModel){const n=c.instancesPerModel[r],o=void 0!==i.id?i.id:i.properties&&i.properties.hasOwnProperty("id")?i.properties.id:void 0;if(n.idToFeaturesIndex.hasOwnProperty(o)){const i=n.features[n.idToFeaturesIndex[o]],l=a.getModel(r,this.scope);if(!l)return!1;let u=e.ae.create();const h=new yu(0,0),p=c.canonical;let d=Number.MAX_VALUE;for(let r=0;r<i.instancedDataCount;++r){const o=16*(i.instancedDataOffset+r),a=n.instancedDataArray.float32,c=[a[o+4],a[o+5],a[o+6]];mb(p,h,a[o],0|a[o+1]),ux(u,l,s,h,i.rotation,i.scale,c,!1,!1,!1),"globe"===s.projection.name&&(u=Hv(u,s));const f=e.ae.multiply([],s.projMatrix,u),m=t.queryGeometry,_=Zv(m.isPointQuery()?m.screenBounds:m.screenGeometry,s,f,l.aabb);null!=_&&(d=Math.min(_,d))}return d!==Number.MAX_VALUE&&d}}return!1}_handleOverridablePaintPropertyUpdate(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven()||"model-color"!==e&&"model-color-mix-intensity"!==e&&"model-rotation"!==e&&"model-scale"!==e&&"model-translation"!==e&&"model-emissive-strength"!==e)}_isPropertyZoomDependent(e){const t=this._transitionablePaint._values[e];return null!=t&&null!=t.value&&null!=t.value.expression&&t.value.expression instanceof ma}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}queryIntersectsMatchingFeature(t,i,r,n){const o=t.tile,s=o.getBucket(this);let a=null,l=Number.MAX_VALUE;if(!(s&&s instanceof hb))return{queryFeature:a,intersectionZ:l};const c=s.getNodesInfo()[i];if(c.hiddenByReplacement||!c.node.meshes||!r.filter(new Qa(o.tileID.overscaledZ),c.feature,o.tileID.canonical))return{queryFeature:a,intersectionZ:l};const u=c.node,h=n.calculatePosMatrix(o.tileID.toUnwrapped(),n.worldSize),p=c.evaluatedScale;let d=0;n.elevation&&u.elevation&&(d=u.elevation*n.elevation.exaggeration()),e.ae.translate(h,h,[(u.anchor?u.anchor[0]:0)*(p[0]-1),(u.anchor?u.anchor[1]:0)*(p[1]-1),d]),e.ae.scale(h,h,p),e.ae.multiply(h,h,u.matrix);const f=t.queryGeometry,m=f.isPointQuery()?f.screenBounds:f.screenGeometry,_=function(t){const i=e.ae.multiply([],h,t.matrix),r=e.ae.multiply(i,n.expandedFarZProjMatrix,i);for(let e=0;e<t.meshes.length;++e){const i=t.meshes[e];if(e===t.lightMeshIndex)continue;const o=Zv(m,n,r,i.aabb);null!=o&&(l=Math.min(o,l))}if(t.children)for(const e of t.children)_(e)};if(_(u),l===Number.MAX_VALUE)return{queryFeature:a,intersectionZ:l};const g=new yu(0,0);return mb(o.tileID.canonical,g,c.node.anchor[0],c.node.anchor[1]),a={type:"Feature",geometry:{type:"Point",coordinates:[g.lng,g.lat]},properties:c.feature.properties,id:c.feature.id,state:{},layer:this.serialize()},{queryFeature:a,intersectionZ:l}}},clip:class extends Il{constructor(e,t,i,r){super(e,{layout:rd||(rd=new ll({"clip-layer-types":ne
1w ol(cl.layout_clip["clip-layer-types"]),"clip-layer-scope":new ol(cl.layout_clip["clip-layer-scope"])})),paint:nd||(nd=new ll({}))},t,i,r)}recalculate(e,t){super.recalculate(e,t)}createBucket(e){return new ad(e)}isTileClipped(){return!0}is3D(){return!0}}};Ma(rv,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]});const gb=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class yb{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,i]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const r=i>>4;if(1!==r)throw new Error(`Got v${r} data when expected v1.`);const n=gb[15&i];if(!n)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new yb(s,o,n,e)}constructor(e,t=64,i=Float64Array,r){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const n=gb.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(n<0)throw new Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+a),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+s+a,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return vb(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:o,nodeSize:s}=this,a=[0,n.length-1,0],l=[];for(;a.length;){const c=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=s){for(let s=h;s<=u;s++){const a=o[2*s],c=o[2*s+1];a>=e&&a<=i&&c>=t&&c<=r&&l.push(n[s])}continue}const p=h+u>>1,d=o[2*p],f=o[2*p+1];d>=e&&d<=i&&f>=t&&f<=r&&l.push(n[p]),(0===c?e<=d:t<=f)&&(a.push(h),a.push(p-1),a.push(1-c)),(0===c?i>=d:r>=f)&&(a.push(p+1),a.push(u),a.push(1-c))}return l}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:r,coords:n,nodeSize:o}=this,s=[0,r.length-1,0],a=[],l=i*i;for(;s.length;){const c=s.pop()||0,u=s.pop()||0,h=s.pop()||0;if(u-h<=o){for(let i=h;i<=u;i++)Tb(n[2*i],n[2*i+1],e,t)<=l&&a.push(r[i]);continue}const p=h+u>>1,d=n[2*p],f=n[2*p+1];Tb(d,f,e,t)<=l&&a.push(r[p]),(0===c?e-i<=d:t-i<=f)&&(s.push(h),s.push(p-1),s.push(1-c)),(0===c?e+i>=d:t+i>=f)&&(s.push(p+1),s.push(u),s.push(1-c))}return a}}function vb(e,t,i,r,n,o){if(n-r<=i)return;const s=r+n>>1;xb(e,t,s,r,n,o),vb(e,t,i,r,s-1,1-o),vb(e,t,i,s+1,n,1-o)}function xb(e,t,i,r,n,o){for(;n>r;){if(n-r>600){const s=n-r+1,a=i-r+1,l=Math.log(s),c=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*c*(s-c)/s)*(a-s/2<0?-1:1);xb(e,t,i,Math.max(r,Math.floor(i-a*c/s+u)),Math.min(n,Math.floor(i+(s-a)*c/s+u)),o)}const s=t[2*i+o];let a=r,l=n;for(bb(e,t,r,i),t[2*n+o]>s&&bb(e,t,r,n);a<l;){for(bb(e,t,a,l),a++,l--;t[2*a+o]<s;)a++;for(;t[2*l+o]>s;)l--}t[2*r+o]===s?bb(e,t,r,l):(l++,bb(e,t,l,n)),l<=i&&(r=l+1),i<=l&&(n=l-1)}}function bb(e,t,i,r){wb(e,i,r),wb(t,2*i,2*r),wb(t,2*i+1,2*r+1)}function wb(e,t,i){const r=e[t];e[t]=e[i],e[i]=r}function Tb(e,t,i,r){const n=e-i,o=t-r;return n*n+o*o}e.A=Xo,e.B=Yo,e.C=$r,e.D=Wo,e.E=Fr,e.F=Rn,e.H=pl,e.I=Jg,e.J=ra,e.K=ea,e.L=function(e){const t=e.value;let i=[];if(!t)return i;const r=An(t);return"string"!==r?(i=i.concat([new tx(e.key,t,`string expected, "${r}" found`)]),i):(ix(t,!0)||(i=i.concat([new tx(e.key,t,`invalid url "${t}"`)])),i)},e.M=class{constructor(e,t,i,r){this.id=e,this.position=null!=t?new yu(t[0],t[1]):new yu(0,0),this.orientation=null!=i?i:[0,0,0],this.nodes=r,this.uploaded=!1,this.aabb=new Ch([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(t,i){if(e.ae.multiply(t.matrix,i,t.matrix),t.meshes)for(const e of t.meshes){const i=Ch.applyTransformFast(e.aabb,t.matrix);this.aabb.encapsulate(i)}if(t.children)for(const e of t.children)this._applyTransformations(e,t.matrix)}computeBoundsAndApplyParent(){const t=e.ae.identity([]);for(const e of this.nodes)this._applyTransformations(e,t)}computeModelMatrix(e,t,i,r,n,o,s=!1){ux(this.matrix,this,e.transform,this.position,t,i,r,n,o,s)}upload(e){if(!this.uploaded){for(const t of this.nodes)dx(t,e);for(const e of this.nodes)fx(e);this.uploaded=!0}}destroy(){for(const e of this.nodes)mx(e)}},e.N=cl,e.O=Ka,e.P=Ut,e.Q=ii,e.R=Ki,e.S=uc,e.T=Vg,e.U=ll,e.V=tx,e.W=ol,e.X=class{constructor(e){this.specification=e}
1possiblyEvaluate(e,t){return gi(e.expression.evaluate(t))}interpolate(e,t,i){return{x:qr(e.x,t.x,i),y:qr(e.y,t.y,i),z:qr(e.z,t.z,i),azimuthal:qr(e.azimuthal,t.azimuthal,i),polar:qr(e.polar,t.polar,i)}}},e.Y=Qa,e.Z=ma,e._=Uu,e.a=ry,e.a$=bh,e.a0=Jt,e.a1=nl,e.a2=Jh,e.a3=qr,e.a4=fo,e.a5=Hr,e.a6=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){return function([e,t]){const i=gi([1,e,t]);return{x:i.x,y:i.y,z:i.z}}(e.expression.evaluate(t))}interpolate(e,t,i){return{x:qr(e.x,t.x,i),y:qr(e.y,t.y,i),z:qr(e.z,t.z,i)}}},e.a7=$c,e.a8=Dc,e.a9=Bc,e.aA=function(e,t,i){e[4*t+0]=i[0],e[4*t+1]=i[1],e[4*t+2]=i[2],e[4*t+3]=i[3]},e.aC=function(t,i){const{x:r,y:n}=t.point,o=Yh(r,n,t.worldSize/t._pixelsPerMercatorPixel,0,0);return e.ae.multiply(o,o,Wh(Fh(i)))},e.aE=Xm,e.aF=s_,e.aG=Wm,e.aH=function(e,t,i,r,n){const o=5*t+2;e.float32[o+0]=i,e.float32[o+1]=r,e.float32[o+2]=n},e.aI=Fg,e.aJ=yu,e.aK=Lg,e.aL=Tu,e.aM=Sh,e.aN=Nv,e.aO=wu,e.aP=Uh,e.aQ=Mu,e.aR=function(e,t,i,r,n,o,s,a,l){if("globe"===l.name)return Uh(e,t,new wu(i,r,n),!1);const c=cg({z:i,x:r,y:n},l);return new Ch([(o+c.x/c.scale)*t,t*(c.y/c.scale),s],[(o+c.x2/c.scale)*t,t*(c.y2/c.scale),a])},e.aS=function(e,t,i){let r=0;for(let i=0;i<2;++i){const n=0;e[i]>n&&(r+=(e[i]-n)*(e[i]-n)),t[i]<n&&(r+=(n-t[i])*(n-t[i]))}return r},e.aT=Du,e.aU=xh,e.aV=lu,e.aW=function(t){const i=e.ae.identity(new Float64Array(16));e.ae.multiply(i,t.pixelMatrix,t.globeMatrix);const r=[0,pu,0],n=[0,du,0];return e.$.transformMat4(r,r,i),e.$.transformMat4(n,n,i),[r[0]>0&&r[0]<=t.width&&r[1]>0&&r[1]<=t.height&&!ep(t,new yu(t.center.lat,90)),n[0]>0&&n[0]<=t.width&&n[1]>0&&n[1]<=t.height&&!ep(t,new yu(t.center.lat,-90))]},e.aX=function(t,i){const{scale:r}=t.tileTransform,n=r*fo/(t.tileSize*Math.pow(2,i.zoom-t.tileID.overscaledZ+t.tileID.canonical.z));return e.aD.scale(new Float32Array(4),i.inverseAdjustmentMatrix,[n,n])},e.aY=jv,e.aZ=Bv,e.a_=function(t){const i=Bv(t,!0);return e.aD.invert([],[i[0],i[1],i[4],i[5]])},e.aa=Uc,e.ab=Fc,e.ac=qt,e.ad=function(e,t,i){const r=Math.sqrt(e*e+t*t+i*i),n=r>0?Math.acos(i/r)*Gt:0;let o=0!==e||0!==t?Math.atan2(-t,-e)*Gt+90:0;return o<0&&(o+=360),[r,o,n]},e.af=Kg,e.ag=sy,e.ah=ty,e.ai=function(e,t){const i={};for(let r=0;r<t.length;r++){const n=t[r];n in e&&(i[n]=e[n])}return i},e.aj=vu,e.ak=ku,e.al=Lu,e.am=Sl,e.an=function(e){qi++,qi>Ni&&(e.getActor().send("enforceCacheSizeLimit",Bi),qi=0)},e.ao=yr,e.ap=class{constructor(e){this.entries={},this.scheduler=e}request(e,t,i,r){const n=this.entries[e]=this.entries[e]||{callbacks:[]};if(n.result){const[e,i]=n.result;return this.scheduler?this.scheduler.add((()=>{r(e,i)}),t):r(e,i),()=>{}}return n.callbacks.push(r),n.cancel||(n.cancel=i(((i,r)=>{n.result=[i,r];for(const e of n.callbacks)this.scheduler?this.scheduler.add((()=>{e(i,r)}),t):e(i,r);setTimeout((()=>delete this.entries[e]),3e3)}))),()=>{n.result||(n.callbacks=n.callbacks.filter((e=>e!==r)),n.callbacks.length||(n.cancel(),delete this.entries[e]))}}},e.aq=function(e,t,i){const r=JSON.stringify(e.request);return e.data&&(this.deduped.entries[r]={result:[null,e.data]}),this.deduped.request(r,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},(t=>{const r=rr(e.request,((e,r,n,o)=>{e?t(e):r&&t(null,{vectorTile:i?void 0:new Cd(new Bm(r)),rawData:r,cacheControl:n,expires:o})}));return()=>{r.cancel(),t()}}),t)},e.ar=Nc,e.as=class extends Oc{constructor(e){super(e),this.current=Gc}set(e,t,i){if(this.fetchUniformLocation(e,t))for(let e=0;e<9;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}},e.at=jc,e.au=Yt,e.av=Kt,e.ax=Ai,e.ay=Pu,e.az=zu,e.b=Cc,e.b$=Su,e.b0=function(e){const{x:t,y:i}=e.point,{lng:r,lat:n}=e._center;return Yh(t,i,e.worldSize,r,n)},e.b1=Ht,e.b2=Eu,e.b3=au,e.b4=function(e){const t=Math.round((e+45+360)%360/90)%4;return Zt[t]},e.b5=45,e.b6=Iu,e.b7=ju,e.b8=Ch,e.b9=gi,e.bA=cy,e.bB=gp,e.bC=function(e,t){return[Math.pow(e[0],2.2)*t,Math.pow(e[1],2.2)*t,Math.pow(e[2],2.2)*t]},e.bD=um,e.bF=Qh,e.bG=Pi,e.bH=Li,e.bI=256,e.bJ=function(t,i){const r=[0,0,0],n=Zh(Fh(i.canonical));return e.$.transformMat4(r,r,n),e.$.transformMat4(r,r,t),r},e.bK=e=>({u_camera_to_center_distance:new Fc(e),u_extrude_scale:new Hc(e),u_device_pixel_ratio:new Fc(e),u_matrix:new $c(e),u_inv_rot_matrix:new $c(e),u_merc_center:new Bc(e),u_tile_id:new Nc(e),u_zoom_transition:new Fc(e),u_up_dir:new Nc(e),u_emissive_strength:new Fc(e)}),e.bL=e=>({u_matrix:new $c(e),u_pixels_to_tile_units:new Hc(e),u_device_pixel_ratio:new Fc(e),u_units_to_pixels:new Bc(e),u_dash_image:new Dc(e),u_gradient_image:new Dc(e),u_image_height:new Fc(e),u_texsize:new Bc(e),u_tile_units_to_pixels:new Fc(e),u_alpha_discard_threshold:new Fc(e),u_trim_offset:new Bc(e),u_trim_fade_range:new Bc(e),u_trim_color:new jc(e),u_emissive_strength:new Fc(e)}),e.bM=e=>({u_matrix:new $c(e),u_texsize:new Bc(e),u_pixels_to_tile_units:new Hc(e),u_device_pixel_ratio:new Fc(e),u_image:new Dc(e),u_units_to_pixels:new Bc(e),u_tile_units_to_pixels:new Fc(e),u_alpha_discard_threshold:new Fc(e),u_trim_offset:new Bc(e)}),e.bN=Yl,e.bO=tm,e.bP=qm,e.bQ=Qm,e.bR=J_,e.bS=g_,e.bT=op,e.bU=(e,t,i,r,n,o)=>{const s=e.transform,a="globe"===s.projection.name;let l;if("map"===o.paint.get("circle-pitch-alignment"))if(a){const e=Qh(s.zoom,t.canonical)*s._pixelsPerMercatorPixel;l=Float32Array.from([e,0,0,e])}else l=s.calculatePixelsToTileUnitsMatrix(i);else l=new Float32Array([s.pixelsToGLUnits[0],0,0,s.pixelsToGLUnits[1]]);const c={u_camera_to_center_distance:e.transform.getCameraToCenterDistance(s.projection),u_matrix:e.translatePosMatrix(t.projMatrix,i,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_device_pixel_ratio:zi.devicePixelRatio,u_extrude_scale:l,u_inv_rot_matrix:np,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:o.paint.get("circle-emissive-strength")};if(a){c.u_inv_rot_matrix=r,c.u_merc_center=n,c.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],c.u_zoom_transition=Jh(s.zoom);const e=n[0]*fo,i=n[1]*fo;c.u_up_dir=s.projection.upVector(new wu(0,0,0),e,i)}return c},e.bV=dm,e.bW=(e,t,i,r,n,o)=>{const s=e.transform;return{u_matrix:pm(e,t,i,r),u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:s.calculatePixelsToTileUnitsMatrix(t),u_device_pixel_ratio:n,u_image:0,u_tile_units_to_pixels:hm(t,s),u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]],u_alph
1a_discard_threshold:0,u_trim_offset:o}},e.bX=(e,t,i,r,n,o,s)=>{const a=e.transform,l=a.calculatePixelsToTileUnitsMatrix(t);return{u_matrix:pm(e,t,i,r),u_pixels_to_tile_units:l,u_device_pixel_ratio:o,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:n,u_texsize:fm(i)&&t.lineAtlasTexture?t.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:hm(t,e.transform),u_alpha_discard_threshold:0,u_trim_offset:s,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toRenderColor(i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength")}},e.bY=si,e.bZ=wp,e.b_=Rf,e.ba=function(e){return[Math.pow(e[0],1/2.2),Math.pow(e[1],1/2.2),Math.pow(e[2],1/2.2)]},e.bb=Wt,e.bc=function(e,t,i){const r=Jh(i.zoom),n=e.style.map._antialias,o=t.options.extStandardDerivativesForceOff||e.terrain&&e.terrain.exaggeration()>0;return 0===r&&!n&&!o},e.bd=function(t){const i=t.pixelsPerMeter,r=i/Pu(1,t.center.lat),n=e.ae.identity(new Float64Array(16));return e.ae.translate(n,n,[t.point.x,t.point.y,0]),e.ae.scale(n,n,[r,r,i]),Float32Array.from(n)},e.be=Vh,e.bf=function(e){const t=Du-5;e=Yt(e,-t,t)/t*90;const i=Math.pow(Math.abs(Math.sin(qt(e))),3);return Math.round(i*(hu.length-1))},e.bg=function(t,i,r,n){const o=i.getNorth(),s=i.getSouth(),a=i.getWest(),l=i.getEast(),c=1<<t.z,u=l-a,h=o-s,p=u/uu,d=-h/hu[r],f=[0,p,0,d,0,0,o,a,0];if(t.z>0){const t=180/n;e.bE.multiply(f,f,[t/u+1,0,0,0,t/h+1,0,-.5*t/p,.5*t/d,1])}return f[2]=c,f[5]=t.x,f[8]=t.y,f},e.bh=Zh,e.bi=Fh,e.bj=function(t,i,r){const n=e.ae.identity(new Float64Array(16)),o=(i/(1<<t)-.5)*Math.PI*2;return e.ae.rotateY(n,r.globeMatrix,o),Float32Array.from(n)},e.bk=Ri,e.bl=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.bm=Iv,e.bn=Ov,e.bo=Cv,e.bp=function(e,t){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){t(null,i)};for(let t=0;t<e.length;t++){const r=document.createElement("source");nr(e[t])||(i.crossOrigin="Anonymous"),r.src=e[t],i.appendChild(r)}return{cancel:()=>{}}},e.bq=$g,e.br=li,e.bs=class{isDataAvailableAtPoint(e){const t=this._source();if(this.isUsingMockSource()||!t||e.y<0||e.y>1)return!1;const i=t.getSource().maxzoom,r=1<<i,n=Math.floor(e.x),o=Math.floor((e.x-n)*r),s=Math.floor(e.y*r),a=this.findDEMTileFor(new Mu(i,n,i,o,s));return!(!a||!a.dem)}getAtPointOrZero(e,t=0){return this.getAtPoint(e,t)||0}getAtPoint(e,t,i=!0){if(this.isUsingMockSource())return null;null==t&&(t=null);const r=this._source();if(!r)return t;if(e.y<0||e.y>1)return t;const n=r.getSource().maxzoom,o=1<<n,s=Math.floor(e.x),a=e.x-s,l=new Mu(n,s,n,Math.floor(a*o),Math.floor(e.y*o)),c=this.findDEMTileFor(l);if(!c||!c.dem)return t;const u=c.dem,h=1<<c.tileID.canonical.z,p=(a*h-c.tileID.canonical.x)*u.dim,d=(e.y*h-c.tileID.canonical.y)*u.dim,f=Math.floor(p),m=Math.floor(d);return(i?this.exaggeration():1)*qr(qr(u.get(f,m),u.get(f,m+1),d-m),qr(u.get(f+1,m),u.get(f+1,m+1),d-m),p-f)}getAtTileOffset(e,t,i){const r=1<<e.canonical.z;return this.getAtPointOrZero(new Uu(e.wrap+(e.canonical.x+t/fo)/r,(e.canonical.y+i/fo)/r))}getAtTileOffsetFunc(t,i,r,n){return o=>{const s=this.getAtTileOffset(t,o.x,o.y),a=n.upVector(t.canonical,o.x,o.y),l=n.upVectorScale(t.canonical,i,r).metersToTile;return e.$.scale(a,a,s*l),a}}getForTilePoints(e,t,i,r){if(this.isUsingMockSource())return!1;const n=of.create(this,e,r);return!!n&&(t.forEach((e=>{e[2]=this.exaggeration()*n.getElevationAt(e[0],e[1],i)})),!0)}getMinMaxForTile(e){if(this.isUsingMockSource())return null;const t=this.findDEMTileFor(e);if(!t||!t.dem)return null;const i=t.dem.tree,r=t.tileID,n=1<<e.canonical.z-r.canonical.z;let o=e.canonical.x/n-r.canonical.x,s=e.canonical.y/n-r.canonical.y,a=0;for(let t=0;t<e.canonical.z-r.canonical.z&&!i.leaves[a];t++){o*=2,s*=2;const e=2*Math.floor(s)+Math.floor(o);a=i.childOffsets[a]+e,o%=1,s%=1}return{min:this.exaggeration()*i.minimums[a],max:this.exaggeration()*i.maximums[a]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(e,t,i){throw new Error("Pure virtual method called.")}pointCoordinate(e){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(e){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const e=this.visibleDemTiles;if(0===e.length)return null;let t=!1,i=Number.MAX_VALUE,r=Number.MIN_VALUE;for(const n of e){const e=this.getMinMaxForTile(n.tileID);
vendor: 11,502 bytes, line 1
1e&&(i=Math.min(i,e.min),r=Math.max(r,e.max),t=!0)}return t?{min:i,max:r}:null}},e.bt=Lh,e.bu=Ph,e.bv=Ol,e.bw=Kl,e.bx=sv,e.by=vx,e.bz=Ex,e.c=ib,e.c$=function(e,t,i,r){return"custom"===e.type?new Dv(e,t):new _b[e.type](e,t,i,r)},e.c0=Ef,e.c1=df,e.c2=450,e.c3=7,e.c4=Av,e.c5=nv,e.c6=256,e.c7=Nh,e.c8=Wh,e.c9=Rl,e.cA=uh,e.cB=function(t,i,r=0){return e.$.fromValues(((i.x-r)*t.scale-t.x)*fo,(i.y*t.scale-t.y)*fo,Ou(i.z,i.y))},e.cC=function(e){let t=1/0,i=1/0,r=-1/0,n=-1/0;for(const o of e)t=Math.min(t,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);return{min:new Ut(t,i),max:new Ut(r,n)}},e.cD=ch,e.cE=$u,e.cF=su,e.cG=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.cH=I_,e.cI=eh,e.cJ=Od,e.cK=Gd,e.cL=qd,e.cM=K_,e.cN=yb,e.cO=function(e){return e({pluginStatus:Va,pluginURL:$a}),Ha.on("pluginStateChange",e),e},e.cP=N_,e.cQ=B_,e.cR=tr,e.cS=Ga,e.cT=o,e.cU=Di,e.cV=Pr,e.cW=pi,e.cX=function(e){const t=e.indexOf(El);return t>=0?e.slice(0,t):e},e.cY=function(e){return e.indexOf(El)>=0},e.cZ=function(e){const t=e.indexOf(El);return t>=0?e.slice(t+1):""},e.c_=function(e){const t=[],i=e.id;return void 0===i&&t.push({message:`layers.${i}: missing required property "id"`}),void 0===e.render&&t.push({message:`layers.${i}: missing required method "render"`}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),t},e.ca=Ul,e.cb=rc,e.cc=1,e.cd=iy,e.ce=0,e.cf=nc,e.cg=function(e,t,i,r,n){return Yt((e-t)/(i-t)*(n-r)+r,r,n)},e.ch=$s,e.ci=Bu,e.cj=class{constructor(e,t,i,r){this.context=e,this.format=r,this.size=i,this.texture=e.gl.createTexture();const[n,o,s]=this.size,{gl:a}=e;a.bindTexture(a.TEXTURE_3D,this.texture),e.pixelStoreUnpackFlipY.set(!1),e.pixelStoreUnpack.set(1),e.pixelStoreUnpackPremultiplyAlpha.set(!1);let l=this.format,c=a.UNSIGNED_BYTE;this.format===a.DEPTH_COMPONENT&&(l=a.DEPTH_COMPONENT16,c=a.UNSIGNED_SHORT),this.format===a.R8&&(r=a.RED),this.format===a.R32F&&(c=a.FLOAT,r=a.RED),a.texImage3D(a.TEXTURE_3D,0,l,n,o,s,0,r,c,t.data)}bind(e,t){const{context:i}=this,{gl:r}=i;r.bindTexture(r.TEXTURE_3D,this.texture),e!==this.minFilter&&(r.texParameteri(r.TEXTURE_3D,r.TEXTURE_MAG_FILTER,e),r.texParameteri(r.TEXTURE_3D,r.TEXTURE_MIN_FILTER,e),this.minFilter=e),t!==this.wrapS&&(r.texParameteri(r.TEXTURE_3D,r.TEXTURE_WRAP_S,t),r.texParameteri(r.TEXTURE_3D,r.TEXTURE_WRAP_T,t),this.wrapS=t)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}},e.ck=Hv,e.cl=[1,1,1],e.cm=of,e.cn=cx,e.co=Wl,e.cp=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new Ut(1/0,1/0),max:new Ut(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(e,t=!1){const i=jd(new Ut(0,0),new Ut(fo,fo),e),r=[];if(t&&!Bd(i,this._globalClipBounds))return r;for(const t of this._activeRegions){if(t.hiddenByOverlap)continue;if(!Bd(i,t))continue;const n=Ud(t.min,t.max,e);r.push({min:n.min,max:n.max,sourceId:this._sourceIds[t.priority],footprint:t.footprint,footprintTileId:t.tileId,order:t.order,clipMask:t.clipMask,clipScope:t.clipScope})}return r}setSources(e){this._setSources(e.map((e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const t=[];for(const i of e.cache.getVisibleCoordinates()){const r=e.cache.getTile(i).buckets[e.layer];r&&r.updateFootprints(i.toUnwrapped(),t)}return t},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope}))))}_addSource(e){const t=e.getFootprints();if(0===t.length)return;const i=e.getOrder(),r=e.getClipMask(),n=e.getClipScope();for(const e of t){if(!e.footprint)continue;const t=jd(e.footprint.min,e.footprint.max,e.id);this._activeRegions.push({min:t.min,max:t.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:e.id,footprint:e.footprint,order:i,clipMask:r,clipScope:n})}this._sourceIds.push(e.getSourceId())}_computeReplacement(){this._activeRegions.sort(((e,t)=>e.priority-t.priority||Dd(e.min,t.min)||Dd(e.max,t.max)||e.order-t.order||e.clipMask-t.clipMask||function(e,t){const i=(e,t)=>e+t;return e.length-t.length||e.reduce(i,"").localeCompare(t.reduce(i,""))}(e.clipScope,t.clipScope)));let e=this._activeRegions.length!==this._prevRegions.length;if(!e){let t=0;for(;!e&&t!==this._activeRegions.length;){const i=this._activeRegions[t],r=this._prevRegions[t];e=i.priority!==r.priority||!Fd(i,r)||i.order!==r.order||i.clipMask!==r.clipMask||!Vt(i.clipScope,r.clipScope),++t}}if(e){++this._updateTime;for(const e of this._activeRegions)e.order!==zd&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,e.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,e.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,e.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,e.max.y));const e=e=>{const t=this._activeRegions;if(e>=t.length)return e;const i=t[e].priority;for(;e<t.length&&t[e].priority===i;)++e;return e};if(this._sourceIds.length>1){let t=0,i=e(t);for(;t!==i;){let r=t;const n=t;for(;r!==i;){const e=this._activeRegions[r];e.hiddenByOverlap=!1;for(let t=0;t<n;t++){const i=this._activeRegions[t];if(!i.hiddenByOverlap&&e.order===zd&&Bd(e,i)&&(e.hiddenByOverlap=$d(e.footprint,e.tileId,i.footprint,i.tileId),e.hiddenByOverlap))break}++r}t=i,i=e(t)}}}}_setSources(e){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let t=e.length-1;t>=0;t--)this._addSource(e[t]);this._computeReplacement()}},e.cq=Fl,e.cr=Yg,e.cs=sc,e.ct=class{constructor(e){this._createGrid(e),this._createPoles(e)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const e of this._poleSegments)e.destroy();for(const e of this._gridSegments)e.withSkirts.destroy(),e.withoutSkirts.destroy()}_fillGridMeshWithLods(e,t){const i=new Ol,r=new Kl,n=[],o=e+1+2,s=t[0]+1,a=t[0]+1+(1+t.length),l=(e,t,i)=>{let r=e===o-1?e-2:0===e?e:e-1;return r+=i?24575:0,[r,t]};for(let e=0;e<o;++e)i.emplaceBack(...l(e,0,!0));for(let e=0;e<s;++e)for(let t=0;t<o;++t)i.emplaceBack(...l(t,e,(0===t||t===o-1)&&!0));for(let e=0;e<t.length;++e){const r=t[e];for(let e=0;e<o;++e)i.emplaceBack(...l(e,r,!0))}for(let e=0;e<t.length;++e){const s=r.length,l=t[e]+1+2,c=new Kl;for(let i=0;i<l-1;i++){const n=i===l-2,s=n?o*(a-t.length+e-i):o;for(let e=0;e<o-1;e++){const t=i*o+e;0===i||n||0===e||e===o-2?(c.emplaceBack(t+1,t,t+s),c.emplaceBack(t+s,t+s+1,t+1)):(r.emplaceBack(t+1,t,t+s),r.emplaceBack(t+s,t+s+1,t+1))}}const u=Cc.simpleSegment(0,s,i.length,r.length-s);for(let e=0;e<c.uint16.length;e+=3)r.emplaceBack(c.uint16[e],c.uint16[e+1],c.uint16[e+2]);const h=Cc.simpleSegment(0,s,i.length,r.length-s);n.push({withoutSkirts:u,withSkirts:h})}return{vertices:i,indices:r,segments:n}}_createGrid(e){const t=this._fillGridMeshWithLods(uu,hu);this._gridSegments=t.segments,this._gridBuffer=e.createVertexBuffer(t.vertices,Lh.members),this._gridIndexBuffer=e.createIndexBuffer(t.indices,!0)}_createPoles(e){const t=new Kl;for(let e=0;e<=uu;e++)t.emplaceBack(0,e+1,e+2);this._poleIndexBuffer=e.createIndexBuffer(t,!0);const i=new rc,r=new rc,n=new rc,o=new rc;this._poleSegments=[];for(let e=0,t=0;e<au;e++){const s=360/(1<<e);i.emplaceBack(0,-su,0,.5,0),r.emplaceBack(0,-su,0,.5,1),n.emplaceBack(0,-su,0,.5,.5),o.emplaceBack(0,-su,0,.5,.5);for(let e=0;e<=uu;e++){let t=e/uu,a=0;const l=qr(0,s,t),[c,u,h]=fu(ip,rp,l,su);i.emplaceBack(c,u,h,t,a),r.emplaceBack(c,u,h,t,1-a);const p=qt(l);t=.5+.5*Math.sin(p),a=.5+.5*Math.cos(p),n.emplaceBack(c,u,h,t,a),o.emplaceBack(c,u,h,t,1-a)}this._poleSegments.push(Cc.simpleSegment(t,0,66,64)),t+=66}this._poleNorthVertexBuffer=e.createVertexBuffer(i,Ih,!1),this._poleSouthVertexBuffer=e.createVertexBuffer(r,Ih,!1),this._texturedPoleNorthVertexBuffer=e.createVertexBuffer(n,Ih,!1),this._texturedPoleSouthVertexBuffer=e.createVertexBuffer(o,Ih,!1)}getGridBuffers(e,t){return[this._gridBuffer,this._gridIndexBuffer,t?this._gridSegments[e].withSkirts:this._gridSegments[e].withoutSkirts]}getPoleBuffers(e,t){return[t?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,t?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[e]]}},e.cu=function(e){return Cr.has(e)},e.cv=zd,e.cw=sf,e.cx=function(e,t,i=0,r=!0){const n=new Ut(i,i),o=e.sub(n),s=t.add(n),a=[o,new Ut(s.x,o.y),s,new Ut(o.x,s.y)];return r&&a.push(o.clone()),a},e.cy=function(e,t){const i=[];for(let r=0;r<e.length;r++){const n=Kt(r-1,-1,e.length-1),o=Kt(r+1,-1,e.length-1),s=e[r],a=e[o],l=e[n].sub(s).unit(),c=a.sub(s).unit(),u=c.angleWithSep(l.x,l.y),h=l.add(c).unit().mult(-1*t/Math.sin(u/2));i.push(s.add(h))}return i},e.cz=ug,e.d=Vt,e.d$=tv,e.d0=hi,e.d1=Ha,e.d2=ir,e.d3=Xt,e.d4=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},e.d5=Qt,e.d6=Nu,e.d7=mu,e.d8=function([e,t,i]){const r=Math.hypot(e,t,i),n=Math.atan2(e,i),o=.5*Math.PI-Math.acos(-t/r);return new yu(Ht(n),Ht(o))},e.d9=Ru,e.dA=function(){Ex().acquire(wx)},e.dB=function(){const e=Mx;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(wx),Mx=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},e.dC=Tx,e.dD=function(e){const t=$i();if(!t)return;const i=t.delete(Fi);e&&i.catch(e).then((()=>e()))},e.dE=xx,e.dF=Px,e.dG=function(e){Cx=zi.resolveURL(e),Lx||(Lx=new vx(Ex(),new Fr)),Lx.broadcast("setDracoUrl",Cx)},e.dH=Rx,e.dI=function(e){Ix=zi.resolveURL(e),Lx||(Lx=new vx(Ex(),new Fr)),Lx.broadcast("setMeshoptUrl",Ix)},e.dJ=ti,e.dK=Ma,e.dL=mp,e.dM=F_,e.dN=cg,e.dO=dc,e.dP=mm,e.dQ=Vm,e.dR=im,e.dS=ui,e.dT=R_,e.dU=Ug,e.dV=function(e,t,i,r,n,o,s,a,l,c,u){e.createArrays(),e.tilePixelRatio=fo/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;const h=e.layers[0].layout,p=e.layers[0]._unevaluatedLayout._values,d={};if("composite"===e.textSizeData.kind){const{minZoom:t,maxZoom:i}=e.textSizeData;d.compositeTextSizes=[p["text-size"].possiblyEvaluate(new Qa(t),a),p["text-size"].possiblyEvaluate(new Qa(i),a)]}if("composite"===e.iconSizeData.kind){const{minZoom:t,maxZoom:i}=e.iconSizeData;d.compositeIconSizes=[p["icon-size"].possiblyEvaluate(new Qa(t),a),p["icon-size"].possiblyEvaluate(new Qa(i),a)]}d.layoutTextSize=p["text-size"].possiblyEvaluate(new Qa(l+1),a),d.layoutIconSize=p["icon-size"].possiblyEvaluate(new Qa(l+1),a),d.textMaxSize=p["text-size"].possiblyEvaluate(new Qa(18),a);const f="map"===h.get("text-rotation-alignment")&&"point"!==h.get("symbol-placement"),m=h.get("text-size");let _=!1;for(const t of e.features)if(t.icon&&t.icon.nameSecondary){_=!0;break}for(const o of e.features){const l=h.get("text-font").evaluate(o,{},a).join(","),p=m.evaluate(o,{},a),g=d.layoutTextSize.evaluate(o,{},a),y=(d.layoutIconSize.evaluate(o,{},a),{horizontal:{},vertical:void 0}),v=o.text;let x,b=[0,0];if(v){const r=v.toString(),s=h.get("text-letter-spacing").evaluate(o,{},a)*qm,c=h.get("text-line-height").evaluate(o,{},a)*qm,u=La(r)?s:0,d=h.get("text-anchor").evaluate(o,{},a),m=h.get("text-variable-anchor");if(!m){const e=h.get("text-radial-offset").evaluate(o,{},a);b=e?J_(d,[e*qm,Q_]):h.get("text-offset").evaluate(o,{},a).map((e=>e*qm))}
vendor: 5,240 bytes, line 1
1let _=f?"center":h.get("text-justify").evaluate(o,{},a);const x="point"===h.get("symbol-placement"),w=x?h.get("text-max-width").evaluate(o,{},a)*qm:1/0,T=o=>{e.allowVerticalPlacement&&ka(r)&&(y.vertical=c_(v,t,i,n,l,w,c,d,o,u,b,s_.vertical,!0,g,p))};if(!f&&m){const e="auto"===_?m.map((e=>K_(e))):[_];let r=!1;for(let o=0;o<e.length;o++){const s=e[o];if(!y.horizontal[s])if(r)y.horizontal[s]=y.horizontal[0];else{const e=c_(v,t,i,n,l,w,c,"center",s,u,b,s_.horizontal,!1,g,p);e&&(y.horizontal[s]=e,r=1===e.positionedLines.length)}}T("left")}else{if("auto"===_&&(_=K_(d)),x||h.get("text-writing-mode").indexOf("horizontal")>=0||!ka(r)){const e=c_(v,t,i,n,l,w,c,d,_,u,b,s_.horizontal,!1,g,p);e&&(y.horizontal[_]=e)}T(x?"left":_)}}let w=!1;if(o.icon&&o.icon.namePrimary){const t=r[o.icon.namePrimary];t&&(x=v_(n[o.icon.namePrimary],o.icon.nameSecondary?n[o.icon.nameSecondary]:void 0,h.get("icon-offset").evaluate(o,{},a),h.get("icon-anchor").evaluate(o,{},a)),w=t.sdf,void 0===e.sdfIcons?e.sdfIcons=t.sdf:e.sdfIcons!==t.sdf&&fi("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(t.pixelRatio!==e.pixelRatio||0!==h.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}const T=ng(y.horizontal)||y.vertical;e.iconsInText||(e.iconsInText=!!T&&T.iconsInText),(T||x)&&eg(e,o,y,x,r,d,g,0,b,w,s,a,c,u,_)}o&&e.generateCollisionDebugBuffers(l,e.collisionBoxArray)},e.dW=sm,e.dX=ed,e.dY=Cd,e.dZ=Bm,e.d_=nf,e.da=_u,e.db=r,e.dc=ep,e.dd=Kh,e.de=function(t){const i=[0,0,0],r=e.ae.identity(new Float64Array(16));return e.ae.multiply(r,t.pixelMatrix,t.globeMatrix),e.$.transformMat4(i,i,r),new Ut(i[0],i[1])},e.df=u,e.dg=c,e.dh=function(e){const t=e.navigator?e.navigator.userAgent:null;return!!function(e){if(null==Si){const t=e.navigator?e.navigator.userAgent:null;Si=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Si}(e)&&t&&(t.match("Version/15.4")||t.match("Version/15.5")||t.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},e.di=ni,e.dj=class{constructor(e,t,i){this._transformRequestFn=e,this._customAccessToken=t,this._silenceAuthErrors=!!i,this._createSkuToken()}_createSkuToken(){const e=function(){let e="";for(let t=0;t<10;t++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",cr,e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=e.token,this._skuTokenExpiresAt=e.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}normalizeStyleURL(e,i){if(!o(e))return e;const r=pr(e);return r.params.push(`sdk=js-${t}`),r.path=`/styles/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||i)}normalizeGlyphsURL(e,t){if(!o(e))return e;const i=pr(e);return i.path=`/fonts/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||t)}normalizeModelURL(e,t){if(!o(e))return e;const i=pr(e);return i.path=`/models/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||t)}normalizeSourceURL(e,t,i,r){if(!o(e))return e;const n=pr(e);return n.path=`/v4/${n.authority}.json`,n.params.push("secure"),i&&n.params.push(`language=${i}`),r&&n.params.push(`worldview=${r}`),this._makeAPIURL(n,this._customAccessToken||t)}normalizeSpriteURL(e,t,i,r){const n=pr(e);return o(e)?(n.path=`/styles/v1${n.path}/sprite${t}${i}`,this._makeAPIURL(n,this._customAccessToken||r)):(n.path+=`${t}${i}`,dr(n))}normalizeTileURL(e,t,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),e&&!o(e))return e;const n=pr(e);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${t||i&&"raster"!==n.authority&&512===i?"@2x":""}${Hi.supported?".webp":"$1"}`),"raster"===n.authority?n.path=`/${r.RASTER_URL_PREFIX}${n.path}`:"rasterarrays"===n.authority?n.path=`/${r.RASTERARRAYS_URL_PREFIX}${n.path}`:"3dtiles"===n.authority?n.path=`/${r.TILES3D_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${r.TILE_URL_VERSION}${n.path}`);const s=this._customAccessToken||function(e){for(const t of e){const e=t.match(/^access_token=(.*)$/);if(e)return e[1]}return null}(n.params)||r.ACCESS_TOKEN;return r.REQUIRE_ACCESS_TOKEN&&s&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,s)}canonicalizeTileURL(e,t){const i=pr(e);if(!i.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!i.path.match(/\.[\w]+$/))return e;let n="mapbox://";i.path.match(/^\/raster\/v1\//)?n+=`raster/${i.path.replace(`/${r.RASTER_URL_PREFIX}/`,"")}`:i.path.match(/^\/rasterarrays\/v1\//)?n+=`rasterarrays/${i.path.replace(`/${r.RASTERARRAYS_URL_PREFIX}/`,"")}`:n+=`tiles/${i.path.replace(`/${r.TILE_URL_VERSION}/`,"")}`;let o=i.params;return t&&(o=o.filter((e=>!e.match(/^access_token=/)))),o.length&&(n+=`?${o.join("&")}`),n}canonicalizeTileset(e,t){const i=!!t&&o(t),r=[];for(const t of e.tiles||[])n(t)?r.push(this.canonicalizeTileURL(t,i)):r.push(t);return r}_makeAPIURL(e,t){const i="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",n=pr(r.API_URL);if(e.protocol=n.protocol,e.authority=n.authority,"http"===e.protocol){const t=e.params.indexOf("secure");t>=0&&e.params.splice(t,1)}if("/"!==n.path&&(e.path=`${n.path}${e.path}`),!r.REQUIRE_ACCESS_TOKEN)return dr(e);
1if(t=t||r.ACCESS_TOKEN,!this._silenceAuthErrors){if(!t)throw new Error(`An API access token is required to use Mapbox GL. ${i}`);if("s"===t[0])throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${i}`)}return e.params=e.params.filter((e=>-1===e.indexOf("access_token"))),e.params.push(`access_token=${t||""}`),dr(e)}},e.dk=function(e,t){t?Cr.add(e):Cr.delete(e)},e.dl=Hi,e.dm=Mr,e.dn=Sr,e.dp=ur,e.dq=xr,e.dr=wr,e.ds=function(e){Cr.delete(e)},e.dt=Er,e.du=vr,e.dv=ei,e.dw=t,e.dx=function(e,t){Bi=e,Ni=t},e.dy=function(e,t,i=!1){if(Va===Ba||Va===Na||Va===ja)throw new Error("setRTLTextPlugin cannot be called multiple times.");$a=zi.resolveURL(e),Va=Ba,Ua=t,qa(),i||Wa()},e.dz=Za,e.e=zi,e.e0=Ad,e.e1=md,e.e2=Nt,e.e3=gm,e.e4=p,e.e5=rr,e.e6=function(e){let t=0;if(new Uint32Array(e,0,1)[0]!==Vx){const i=new Uint32Array(e,0,7),[,,r,n,o,s]=i;t=i.byteLength+n+o+s+o,(r!==e.byteLength||t>=e.byteLength)&&fi("Invalid b3dm header information.")}return Wx(e,t)},e.e7=function(e,t){const i=ib(e);for(const e of i){for(const t of e.meshes)rb(t);e.lights&&(e.lightMeshIndex=e.meshes.length,e.meshes.push(nb(e.lights,t)))}return i},e.e8=hb,e.e9=yx,e.ea=Xa,e.eb=function(e){Gi(),Ui&&Ui.then((t=>{t.keys().then((i=>{for(let r=0;r<i.length-e;r++)t.delete(i[r])}))}))},e.f=zr,e.g=Rr,e.h=function(e,t){return ir(ii(e,{type:"json"}),t)}
1,e.i=lr,e.j=_p,e.k=k_,e.l=function(e){return fetch(e).then((e=>e.arrayBuffer())).then((t=>Wx(t,0,e)))},e.m=P_,e.n=class extends tx{},e.o=An,e.p=ay,e.q=Wr,e.r=Ks,e.s=ia,e.t=ta,e.u=ul,e.v=pa,e.w=fi,e.x=hl,e.y=_a,e.z=da}));r(0,(function(e){function t(e){const t=e?e.url.toString():void 0;return t?performance.getEntriesByName(t):[]}function i(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let t="[";for(const r of e)t+=`${i(r)},`;return`${t}]`}let t="{";for(const r of Object.keys(e).sort())t+=`${r}:${i(e[r])},`;return`${t}}`}function r(t){let r="";for(const n of e.cG)r+=`/${i(t[n])}`;return r}class n{constructor(e){this.keyCache={},this._layers={},this._layerConfigs={},e&&this.replace(e)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(t,i,n){this._options=n;for(const i of t)this._layerConfigs[i.id]=i,(this._layers[i.id]=e.c$(i,this.scope,null,this._options)).compileFilter(),this.keyCache[i.id]&&delete this.keyCache[i.id];for(const e of i)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const o=function(e,t){const i={};for(let n=0;n<e.length;n++){const o=t&&t[e[n].id]||r(e[n]);t&&(t[e[n].id]=o);let s=i[o];s||(s=i[o]=[]),s.push(e[n])}const n=[];for(const e in i)n.push(i[e]);return n}(e.dJ(this._layerConfigs),this.keyCache);for(const e of o){const t=e.map((e=>this._layers[e.id])),i=t[0];if("none"===i.visibility)continue;const r=i.source||"";let n=this.familiesBySource[r];n||(n=this.familiesBySource[r]={});const o=i.sourceLayer||"_geojsonTileLayer";let s=n[o];s||(s=n[o]=[]),s.push(t)}}}const o=1*e.dM;class s{constructor(t){const i={},r=[];for(const e in t){const n=t[e],s=i[e]={};for(const e in n.glyphs){const t=n.glyphs[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const i=t.metrics.localGlyph?o:1,a={x:0,y:0,w:t.bitmap.width+2*i,h:t.bitmap.height+2*i};r.push(a),s[e]=a}}const{w:n,h:s}=e.k(r),a=new e.dL({width:n||1,height:s||1});for(const r in t){const n=t[r];for(const t in n.glyphs){const s=n.glyphs[+t];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;const l=i[r][t],c=s.metrics.localGlyph?o:1;e.dL.copy(s.bitmap,a,{x:0,y:0},{x:l.x+c,y:l.y+c},s.bitmap)}}this.image=a,this.positions=i}}e.dK(s,"GlyphAtlas");class a{constructor(t){this.tileID=new e.aQ(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.lut=t.lut,this.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.scope=t.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.promoteId=t.promoteId,this.isSymbolTile=t.isSymbolTile,this.tileTransform=e.dN(t.tileID.canonical,t.projection),this.projection=t.projection,this.brightness=t.brightness,this.extraShadowCaster=!!t.extraShadowCaster,this.tessellationStep=t.tessellationStep}parse(t,i,r,n,o){this.status="parsing",this.data=t,this.collisionBoxArray=new e.dO;const a=new e.dP(Object.keys(t.layers).sort()),c=new e.dQ(this.tileID,this.promoteId);c.bucketLayerIDs=[];const u={},h=new e.dR(256,256),p={featureIndex:c,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:h,availableImages:r,brightness:this.brightness},d=i.familiesBySource[this.source];for(const i in d){const n=t.layers[i];if(!n)continue;let o=!1,s=!1,h=!1;for(const e of d[i])"symbol"===e[0].type?o=!0:s=!0,e[0].is3D()&&"model"!==e[0].type&&(h=!0);if(this.extraShadowCaster&&!h)continue;if(!0===this.isSymbolTile&&!o)continue;if(!1===this.isSymbolTile&&!s)continue;1===n.version&&e.w(`Vector tile source "${this.source}" layer "${i}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const f=a.encode(i),m=[];for(let e=0;e<n.length;e++){const t=n.feature(e),r=c.getId(t,i);m.push({feature:t,id:r,index:e,sourceLayerIndex:f})}for(const e of d[i]){const t=e[0];(!this.extraShadowCaster||t.is3D()&&"model"!==t.type)&&(void 0!==this.isSymbolTile&&"symbol"===t.type!==this.isSymbolTile||t.minzoom&&this.zoom<Math.floor(t.minzoom)||t.maxzoom&&this.zoom>=t.maxzoom||"none"!==t.visibility&&(l(e,this.zoom,p.brightness,r),(u[t.id]=t.createBucket({index:c.bucketLayerIDs.length,layers:e,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:f,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep})).populate(m,p,this.tileID.canonical,this.tileTransform),c.bucketLayerIDs.push(e.map((e=>e.id)))))}}let f,m,_,g;h.trim();const y={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},v=()=>{if(f)return this.status="done",o(f);if(this.extraShadowCaster)this.status="done",o(null,{buckets:e.dJ(u).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:p.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(m&&_&&g){const t=new s(m),i=new e.dT(_,g,this.lut);for(const n in u){const o=u[n];o instanceof e.dU?(l(o.layers,this.zoom,p.brightness,r),e.dV(o,m,t.positions,_,i.iconPositions,this.showCollisionBoxes,r,this.tileID.canonical,this.tileZoom,this.projection,this.brightness)):o.hasPattern&&(o instanceof e.dW||o instanceof e.dX||o instanceof e.c0)&&(l(o.layers,this.zoom,p.brightness,r),o.addFeatures(p,this.tileID.canonical,i.patternPositions,r,this.tileTransform,this.brightness))}this.status="done",o(null,{buckets:e.dJ(u).filter((e=>!e.isEmpty())),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,lineAtlas:h,imageAtlas:i,brightness:p.brightness})}};if(!this.extraShadowCaster){const t=e.dS(p.glyphDependencies,(e=>Object.keys(e).map(Number)));Object.keys(t).length?n.send("getGlyphs",{uid:this.uid,stacks:t,scope:this.scope},((e,t)=>{f||(f=e,m=t,v())}),void 0,!1,y):m={};const i=Object.keys(p.iconDependencies);i.length?n.send("getImages",{icons:i,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},((e,t)=>{f||(f=e,_=t,v())}),void 0,!1,y):_={};const r=Object.keys(p.patternDependencies);r.length?n.send("getImages",{icons:r,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},((e,t)=>{f||(f=e,g=t,v())}),void 0,!1,y):g={}}v()}}function l(t,i,r,n){const o=new e.Y(i,{brightness:r});for(const e of t)e.recalculate(o,n)}class c extends e.E{constructor(t,i,r,n,o,s){super(),this.actor=t,this.layerIndex=i,this.availableImages=r,this.loadVectorData=o||e.aq,this.loading={},this.loaded={},this.deduped=new e.ap(t.scheduler),this.isSpriteLoaded=n,this.scheduler
1=t.scheduler,this.brightness=s}loadTile(i,r){const n=i.uid,o=i&&i.request,s=o&&o.collectResourceTiming,l=this.loading[n]=new a(i);l.abort=this.loadVectorData(i,((a,c)=>{const u=!this.loading[n];if(delete this.loading[n],u||a||!c)return l.status="done",u||(this.loaded[n]=l),r(a);const h=c.rawData,p={};c.expires&&(p.expires=c.expires),c.cacheControl&&(p.cacheControl=c.cacheControl),l.vectorTile=c.vectorTile||new e.dY(new e.dZ(h));const d=()=>{l.parse(l.vectorTile,this.layerIndex,this.availableImages,this.actor,((i,n)=>{if(i||!n)return r(i);const a={};if(s){const e=t(o);e.length>0&&(a.resourceTiming=JSON.parse(JSON.stringify(e)))}r(null,e.Q({rawTileData:h.slice(0)},n,p,a))}))};this.isSpriteLoaded?d():this.once("isSpriteLoaded",(()=>{this.scheduler?this.scheduler.add(d,{type:"parseTile",isSymbolTile:i.isSymbolTile,zoom:i.tileZoom}):d()})),this.loaded=this.loaded||{},this.loaded[n]=l}))}reloadTile(t,i){const r=this.loaded,n=t.uid;if(r&&r[n]){const o=r[n];o.showCollisionBoxes=t.showCollisionBoxes,o.projection=t.projection,o.brightness=t.brightness,o.tileTransform=e.dN(t.tileID.canonical,t.projection),o.extraShadowCaster=t.extraShadowCaster,o.lut=t.lut;const s=(e,t)=>{const r=o.reloadCallback;r&&(delete o.reloadCallback,o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,r)),i(e,t)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}else i(null,void 0)}abortTile(e,t){const i=e.uid,r=this.loading[i];r&&(r.abort&&r.abort(),delete this.loading[i]),t()}removeTile(e,t){const i=this.loaded,r=e.uid;i&&i[r]&&delete i[r],t()}}class u{loadTile(t,i){const{uid:r,encoding:n,rawImageData:o,padding:s}=t,a=ImageBitmap&&o instanceof ImageBitmap?this.getImageData(o,s):o;i(null,new e.d_(r,a,n,s<1))}getImageData(e,t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const i=this.offscreenCanvasContext.getImageData(-t,-t,e.width+2*t,e.height+2*t);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),i}}e.d$.setPbf(e.dZ);class h{decodeRasterArray({task:t,buffer:i},r){e.d$.performDecoding(i,t).then((e=>{r(null,e)}),(e=>{r(e)}))}}const p=e.e0.prototype.toGeoJSON;let d=class{constructor(t){this._feature=t,this.extent=e.a4,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(1===this._feature.type){const t=[];for(const i of this._feature.geometry)t.push([new e.P(i[0],i[1])]);return t}{const t=[];for(const i of this._feature.geometry){const r=[];for(const t of i)r.push(new e.P(t[0],t[1]));t.push(r)}return t}}toGeoJSON(e,t,i){return p.call(this,e,t,i)}},f=class{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.a4,this.length=t.length,this._features=t}feature(e){return new d(this._features[e])}};const m=64/4096,_=128;class g{constructor(){this.features=new Map}clear(){this.features.clear()}load(e=[],t){for(const i of e){const e=i.id;if(null==e)continue;let r=this.features.get(e);r&&this.updateCache(r,t),i.geometry?(r=v(i),this.updateCache(r,t),this.features.set(e,r)):this.features.delete(e),this.updateCache(r,t)}}updateCache(e,t){for(const{canonical:i,uid:r}of Object.values(t)){const{z:n,x:o,y:s}=i;y(e,Math.pow(2,n),o,s)&&delete t[r]}}getTile(e,t,i){const r=Math.pow(2,e),n=[];for(const e of this.features.values())y(e,r,t,i)&&n.push(T(e,r,t,i));return{features:n}}getFeatures(){return[...this.features.values()]}}function y({minX:e,minY:t,maxX:i,maxY:r},n,o,s){return e<(o+1+m)/n&&t<(s+1+m)/n&&i>(o-m)/n&&r>(s-m)/n}function v(e){const{id:t,geometry:i,properties:r}=e;if(!i)return;if("GeometryCollection"===i.type)throw new Error("GeometryCollection not supported in dynamic mode.");const{type:n,coordinates:o}=i,s={id:t,type:1,geometry:[],tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},a=s.geometry;if("Point"===n)x(o,a,s);else if("MultiPoint"===n)for(const e of o)x(e,a,s);else if("LineString"===n)s.type=2,b(o,a,s);else if("MultiLineString"===n)s.type=2,w(o,a,s);else if("Polygon"===n)s.type=3,w(o,a,s,!0);else{if("MultiPolygon"!==n)throw new Error("Input data is not a valid GeoJSON object.");s.type=3;for(const e of o)w(e,a,s,!0)}return s}
1function x([t,i],r,n){const o=e.ak(t);let s=e.al(i);s=s<0?0:s>1?1:s,r.push(o,s),n.minX=Math.min(n.minX,o),n.minY=Math.min(n.minY,s),n.maxX=Math.max(n.maxX,o),n.maxY=Math.max(n.maxY,s)}function b(e,t,i,r=!1,n=!1){const o=[];for(const t of e)x(t,o,i);t.push(o),r&&function(e,t){let i=0;for(let t=0,r=e.length,n=r-2;t<r;n=t,t+=2)i+=(e[t]-e[n])*(e[t+1]+e[n+1]);if(i>0===t)for(let t=0,i=e.length;t<i/2;t+=2){const r=e[t],n=e[t+1];e[t]=e[i-2-t],e[t+1]=e[i-1-t],e[i-2-t]=r,e[i-1-t]=n}}(o,n)}function w(e,t,i,r=!1){for(let n=0;n<e.length;n++)b(e[n],t,i,r,0===n)}function T(t,i,r,n){const{id:o,type:s,geometry:a,tags:l}=t,c=[];if(1===s)!function(t,i,r,n,o){for(let s=0;s<t.length;s+=2){const a=Math.round(e.a4*(t[s+0]*i-r)),l=Math.round(e.a4*(t[s+1]*i-n));o.push([a,l])}}(a,i,r,n,c);else for(const e of a)M(e,i,r,n,c);return{id:o,type:s,geometry:c,tags:l}}function M(t,i,r,n,o){const s=-_,a=e.a4+_;let l;for(let c=0;c<t.length-2;c+=2){let u=Math.round(e.a4*(t[c+0]*i-r)),h=Math.round(e.a4*(t[c+1]*i-n)),p=Math.round(e.a4*(t[c+2]*i-r)),d=Math.round(e.a4*(t[c+3]*i-n));const f=p-u,m=d-h;u<s&&p<s||(u<s?(h+=Math.round(m*((s-u)/f)),u=s):p<s&&(d=h+Math.round(m*((s-u)/f)),p=s),h<s&&d<s||(h<s?(u+=Math.round(f*((s-h)/m)),h=s):d<s&&(p=u+Math.round(f*((s-h)/m)),d=s),u>=a&&p>=a||(u>=a?(h+=Math.round(m*((a-u)/f)),u=a):p>=a&&(d=h+Math.round(m*((a-u)/f)),p=a),h>=a&&d>=a||(h>=a?(u+=Math.round(f*((a-h)/m)),h=a):d>=a&&(p=u+Math.round(f*((a-h)/m)),d=a),l&&u===l[l.length-1][0]&&h===l[l.length-1][1]||(l=[[u,h]],o.push(l)),l.push([p,d])))))}}var E={exports:{}},S=e.e2,C=e.e1.VectorTileFeature,A=I;function I(e,t){this.options=t||{},this.features=e,this.length=e.length}function k(e,t){this.id="number"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096}I.prototype.feature=function(e){return new k(this.features[e],this.options.extent)},k.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t<e.length;t++){for(var i=e[t],r=[],n=0;n<i.length;n++)r.push(new S(i[n][0],i[n][1]));this.geometry.push(r)}return this.geometry},k.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,i=-1/0,r=1/0,n=-1/0,o=0;o<e.length;o++)for(var s=e[o],a=0;a<s.length;a++){var l=s[a];t=Math.min(t,l.x),i=Math.max(i,l.x),r=Math.min(r,l.y),n=Math.max(n,l.y)}return[t,r,i,n]},k.prototype.toGeoJSON=C.prototype.toGeoJSON;var L=e.e3,P=A;function R(e){var t=new L;return function(e,t){for(var i in e.layers)t.writeMessage(3,z,e.layers[i])}(e,t),t.finish()}function z(e,t){var i;t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);var r={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<e.length;i++)r.feature=e.feature(i),t.writeMessage(2,O,r);var n=r.keys;for(i=0;i<n.length;i++)t.writeStringField(3,n[i]);var o=r.values;for(i=0;i<o.length;i++)t.writeMessage(4,j,o[i])}function O(e,t){var i=e.feature;void 0!==i.id&&t.writeVarintField(1,i.id),t.writeMessage(2,D,e),t.writeVarintField(3,i.type),t.writeMessage(4,N,i)}function D(e,t){var i=e.feature,r=e.keys,n=e.values,o=e.keycache,s=e.valuecache;for(var a in i.properties){var l=i.properties[a],c=o[a];if(null!==l){void 0===c&&(r.push(a),o[a]=c=r.length-1),t.writeVarint(c);var u=typeof l;"string"!==u&&"boolean"!==u&&"number"!==u&&(l=JSON.stringify(l));var h=u+":"+l,p=s[h];void 0===p&&(n.push(l),s[h]=p=n.length-1),t.writeVarint(p)}}}function F(e,t){return(t<<3)+(7&e)}function B(e){return e<<1^e>>31}function N(e,t){for(var i=e.loadGeometry(),r=e.type,n=0,o=0,s=i.length,a=0;a<s;a++){var l=i[a],c=1;1===r&&(c=l.length),t.writeVarint(F(1,c));for(var u=3===r?l.length-1:l.length,h=0;h<u;h++){1===h&&1!==r&&t.writeVarint(F(2,u-1));var p=l[h].x-n,d=l[h].y-o;t.writeVarint(B(p)),t.writeVarint(B(d)),n+=p,o+=d}3===r&&t.writeVarint(F(7,1))}}function j(e,t){var i=typeof e;"string"===i?t.writeStringField(1,e):"boolean"===i?t.writeBooleanField(7,e):"number"===i&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}E.exports=R,E.exports.fromVectorTileJs=R,E.exports.fromGeojsonVt=function(e,t){t=t||{};var i={};for(var r in e)i[r]=new P(e[r].features,t),i[r].name=r,i[r].version=t.version,i[r].extent=t.extent;return R({layers:i})},E.exports.GeoJSONWrapper=P;
vendor: 14,345 bytes, line 1
1var U=e.e4(E.exports);const V={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},$=Math.fround||(G=new Float32Array(1),e=>(G[0]=+e,G[0]));var G;const q=3,H=5,Z=6;class W{constructor(e){this.options=Object.assign(Object.create(V),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:i,maxZoom:r}=this.options;t&&console.time("total time");const n=`prepare ${e.length} points`;t&&console.time(n),this.points=e;const o=[];for(let t=0;t<e.length;t++){const i=e[t];if(!i.geometry)continue;const[r,n]=i.geometry.coordinates,s=$(Y(r)),a=$(J(n));o.push(s,a,1/0,t,-1,1),this.options.reduce&&o.push(0)}let s=this.trees[r+1]=this._createTree(o);t&&console.timeEnd(n);for(let e=r;e>=i;e--){const i=+Date.now();s=this.trees[e]=this._createTree(this._cluster(s,e)),t&&console.log("z%d: %d clusters in %dms",e,s.numItems,+Date.now()-i)}return t&&console.timeEnd("total time"),this}getClusters(e,t){let i=((e[0]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[1]));let n=180===e[2]?180:((e[2]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,n=180;else if(i>n){const e=this.getClusters([i,r,180,o],t),s=this.getClusters([-180,r,n,o],t);return e.concat(s)}const s=this.trees[this._limitZoom(t)],a=s.range(Y(i),J(o),Y(n),J(r)),l=s.data,c=[];for(const e of a){const t=this.stride*e;c.push(l[t+H]>1?X(l,t,this.clusterProps):this.points[l[t+q]])}return c}getChildren(e){const t=this._getOriginId(e),i=this._getOriginZoom(e),r="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(r);const o=n.data;if(t*this.stride>=o.length)throw new Error(r);const s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),a=n.within(o[t*this.stride],o[t*this.stride+1],s),l=[];for(const t of a){const i=t*this.stride;o[i+4]===e&&l.push(o[i+H]>1?X(o,i,this.clusterProps):this.points[o[i+q]])}if(0===l.length)throw new Error(r);return l}getLeaves(e,t,i){const r=[];return this._appendLeaves(r,e,t=t||10,i=i||0,0),r}getTile(e,t,i){const r=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:o,radius:s}=this.options,a=s/o,l=(i-a)/n,c=(i+1+a)/n,u={features:[]};return this._addTileFeatures(r.range((t-a)/n,l,(t+1+a)/n,c),r.data,t,i,n,u),0===t&&this._addTileFeatures(r.range(1-a/n,l,1,c),r.data,n,i,n,u),t===n-1&&this._addTileFeatures(r.range(0,l,a/n,c),r.data,-1,i,n,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}_appendLeaves(e,t,i,r,n){const o=this.getChildren(t);for(const t of o){const o=t.properties;if(o&&o.cluster?n+o.point_count<=r?n+=o.point_count:n=this._appendLeaves(e,o.cluster_id,i,r,n):n<r?n++:e.push(t),e.length===i)break}return n}_createTree(t){const i=new e.cN(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let e=0;e<t.length;e+=this.stride)i.add(t[e],t[e+1]);return i.finish(),i.data=t,i}_addTileFeatures(e,t,i,r,n,o){for(const s of e){const e=s*this.stride,a=t[e+H]>1;let l,c,u;if(a)l=Q(t,e,this.clusterProps),c=t[e],u=t[e+1];else{const i=this.points[t[e+q]];l=i.properties;const[r,n]=i.geometry.coordinates;c=Y(r),u=J(n)}const h={type:1,geometry:[[Math.round(this.options.extent*(c*n-i)),Math.round(this.options.extent*(u*n-r))]],tags:l};let p;p=a||this.options.generateId?t[e+q]:this.points[t[e+q]].id,void 0!==p&&(h.id=p),o.features.push(h)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:i,extent:r,reduce:n,minPoints:o}=this.options,s=i/(r*Math.pow(2,t)),a=e.data,l=[],c=this.stride;for(let i=0;i<a.length;i+=c){if(a[i+2]<=t)continue;a[i+2]=t;const r=a[i],u=a[i+1],h=e.within(a[i],a[i+1],s),p=a[i+H];let d=p;for(const e of h){const i=e*c;a[i+2]>t&&(d+=a[i+H])}if(d>p&&d>=o){let e,o=r*p,s=u*p,f=-1;const m=(i/c<<5)+(t+1)+this.points.length;for(const r of h){const l=r*c;if(a[l+2]<=t)continue;a[l+2]=t;const u=a[l+H];o+=a[l]*u,s+=a[l+1]*u,a[l+4]=m,n&&(e||(e=this._map(a,i,!0),f=this.clusterProps.length,this.clusterProps.push(e)),n(e,this._map(a,l)))}a[i+4]=m,l.push(o/d,s/d,1/0,m,-1,d),n&&l.push(f)}else{for(let e=0;e<c;e++)l.push(a[i+e]);if(d>1)for(const e of h){const i=e*c;if(!(a[i+2]<=t)){a[i+2]=t;for(let e=0;e<c;e++)l.push(a[i+e])}}}}return l}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,i){if(e[t+H]>1){const r=this.clusterProps[e[t+Z]];return i?Object.assign({},r):r}const r=this.points[e[t+q]].properties,n=this.options.map(r);return i&&n===r?Object.assign({},n):n}}function X(e,t,i){return{type:"Feature",id:e[t+q],properties:Q(e,t,i),geometry:{type:"Point",coordinates:[(r=e[t],360*(r-.5)),K(e[t+1])]}};var r}function Q(e,t,i){const r=e[t+H],n=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+"k":r,o=e[t+Z],s=-1===o?{}:Object.assign({},i[o]);return Object.assign(s,{cluster:!0,cluster_id:e[t+q],point_count:r,point_count_abbreviated:n})}function Y(e){return e/360+.5}function J(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function K(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function ee(e,t,i,r){let n=r;const o=t+(i-t>>1);let s,a=i-t;const l=e[t],c=e[t+1],u=e[i],h=e[i+1];for(let r=t+3;r<i;r+=3){const t=te(e[r],e[r+1],l,c,u,h);if(t>n)s=r,n=t;else if(t===n){const e=Math.abs(r-o);e<a&&(s=r,a=e)}}n>r&&(s-t>3&&ee(e,t,s,r),e[s+2]=n,i-s>3&&ee(e,s,i,r))}function te(e,t,i,r,n,o){let s=n-i,a=o-r;if(0!==s||0!==a){const l=((e-i)*s+(t-r)*a)/(s*s+a*a);l>1?(i=n,r=o):l>0&&(i+=s*l,r+=a*l)}return s=e-i,a=t-r,s*s+a*a}function ie(e,t,i,r){const n={id:e??null,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===t||"MultiPoint"===t||"LineString"===t)re(n,i);else if("Polygon"===t)re(n,i[0]);else if("MultiLineString"===t)for(const e of i)re(n,e);else if("MultiPolygon"===t)for(const e of i)re(n,e[0]);return n}function re(e,t){for(let i=0;i<t.length;i+=3)e.minX=Math.min(e.minX,t[i]),e.minY=Math.min(e.minY,t[i+1]),e.maxX=Math.max(e.maxX,t[i]),e.maxY=Math.max(e.maxY,t[i+1])}function ne(e,t,i,r){if(!t.geometry)return;const n=t.geometry.coordinates;if(n&&0===n.length)return;const o=t.geometry.type,s=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);let a=[],l=t.id;if(i.promoteId?l=t.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===o)oe(n,a);else if("MultiPoint"===o)for(const e of n)oe(e,a);else if("LineString"===o)se(n,a,s,!1);else if("MultiLineString"===o){if(i.lineMetrics){for(const i of n)a=[],se(i,a,s,!1),e.push(ie(l,"LineString",a,t.properties));return}ae(n,a,s,!1)}else if("Polygon"===o)ae(n,a,s,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(const n of t.geometry.geometries)ne(e,{id:l,geometry:n,properties:t.properties},i,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const e of n){const t=[];ae(e,t,s,!0),a.push(t)}}e.push(ie(l,o,a,t.properties))}function oe(e,t){t.push(le(e[0]),ce(e[1]),0)}function se(e,t,i,r){let n,o,s=0;for(let i=0;i<e.length;i++){const a=le(e[i][0]),l=ce(e[i][1]);t.push(a,l,0),i>0&&(s+=r?(n*l-a*o)/2:Math.sqrt(Math.pow(a-n,2)+Math.pow(l-o,2))),n=a,o=l}const a=t.length-3;t[2]=1,ee(t,0,a,i),t[a+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function ae(e,t,i,r){for(let n=0;n<e.length;n++){const o=[];se(e[n],o,i,r),t.push(o)}}function le(e){return e/360+.5}function ce(e){const t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function ue(e,t,i,r,n,o,s,a){if(r/=t,o>=(i/=t)&&s<r)return e;if(s<i||o>=r)return null;const l=[];for(const t of e){const e=t.geometry;let o=t.type;const s=0===n?t.minX:t.minY,c=0===n?t.maxX:t.maxY;if(s>=i&&c<r){l.push(t);continue}if(c<i||s>=r)continue;let u=[];if("Point"===o||"MultiPoint"===o)he(e,u,i,r,n);else if("LineString"===o)pe(e,u,i,r,n,!1,a.lineMetrics);else if("MultiLineString"===o)fe(e,u,i,r,n,!1);else if("Polygon"===o)fe(e,u,i,r,n,!0);else if("MultiPolygon"===o)for(const t of e){const e=[];fe(t,e,i,r,n,!0),e.length&&u.push(e)}if(u.length){if(a.lineMetrics&&"LineString"===o){for(const e of u)l.push(ie(t.id,o,e,t.tags));continue}"LineString"!==o&&"MultiLineString"!==o||(1===u.length?(o="LineString",u=u[0]):o="MultiLineString"),"Point"!==o&&"MultiPoint"!==o||(o=3===u.length?"Point":"MultiPoint"),l.push(ie(t.id,o,u,t.tags))}}return l.length?l:null}function he(e,t,i,r,n){for(let o=0;o<e.length;o+=3){const s=e[o+n];s>=i&&s<=r&&me(t,e[o],e[o+1],e[o+2])}}function pe(e,t,i,r,n,o,s){let a=de(e);const l=0===n?_e:ge;let c,u,h=e.start;for(let p=0;p<e.length-3;p+=3){const d=e[p],f=e[p+1],m=e[p+2],_=e[p+3],g=e[p+4],y=0===n?d:f,v=0===n?_:g;let x=!1;s&&(c=Math.sqrt(Math.pow(d-_,2)+Math.pow(f-g,2))),y<i?v>i&&(u=l(a,d,f,_,g,i),s&&(a.start=h+c*u)):y>r?v<r&&(u=l(a,d,f,_,g,r),s&&(a.start=h+c*u)):me(a,d,f,m),v<i&&y>=i&&(u=l(a,d,f,_,g,i),x=!0),v>r&&y<=r&&(u=l(a,d,f,_,g,r),x=!0),!o&&x&&(s&&(a.end=h+c*u),t.push(a),a=de(e)),s&&(h+=c)}let p=e.length-3;const d=e[p],f=e[p+1],m=0===n?d:f;m>=i&&m<=r&&me(a,d,f,e[p+2]),p=a.length-3,o&&p>=3&&(a[p]!==a[0]||a[p+1]!==a[1])&&me(a,a[0],a[1],a[2]),a.length&&t.push(a)}function de(e){const t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function fe(e,t,i,r,n,o){for(const s of e)pe(s,t,i,r,n,o,!1)}function me(e,t,i,r){e.push(t,i,r)}function _e(e,t,i,r,n,o){const s=(o-t)/(r-t);return me(e,o,i+(n-i)*s,1),s}function ge(e,t,i,r,n,o){const s=(o-i)/(n-i);return me(e,t+(r-t)*s,o,1),s}function ye(e,t){const i=[];for(let r=0;r<e.length;r++){const n=e[r],o=n.type;let s;if("Point"===o||"MultiPoint"===o||"LineString"===o)s=ve(n.geometry,t);else if("MultiLineString"===o||"Polygon"===o){s=[];for(const e of n.geometry)s.push(ve(e,t))}else if("MultiPolygon"===o){s=[];for(const e of n.geometry){const i=[];for(const r of e)i.push(ve(r,t));s.push(i)}}i.push(ie(n.id,o,s,n.tags))}return i}function ve(e,t){const i=[];i.size=e.size,void 0!==e.start&&(i.start=e.start,i.end=e.end);for(let r=0;r<e.length;r+=3)i.push(e[r]+t,e[r+1],e[r+2]);return i}function xe(e,t){if(e.transformed)return e;const i=1<<e.z,r=e.x,n=e.y;for(const o of e.features){const e=o.geometry,s=o.type;if(o.geometry=[],1===s)for(let s=0;s<e.length;s+=2)o.geometry.push(be(e[s],e[s+1],t,i,r,n));else for(let s=0;s<e.length;s++){const a=[];for(let o=0;o<e[s].length;o+=2)a.push(be(e[s][o],e[s][o+1],t,i,r,n));o.geometry.push(a)}}return e.transformed=!0,e}function be(e,t,i,r,n,o){return[Math.round(i*(e*r-n)),Math.round(i*(t*r-o))]}function we(e,t,i,r,n){const o=t===n.maxZoom?0:n.tolerance/((1<<t)*n.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:i,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const t of e)Te(s,t,o,n);return s}function Te(e,t,i,r){const n=t.geometry,o=t.type,s=[];if(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),"Point"===o||"MultiPoint"===o)for(let t=0;t<n.length;t+=3)s.push(n[t],n[t+1]),e.numPoints++,e.numSimplified++;else if("LineString"===o)Me(s,n,e,i,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(let t=0;t<n.length;t++)Me(s,n[t],e,i,"Polygon"===o,0===t);else if("MultiPolygon"===o)for(let t=0;t<n.length;t++){const r=n[t];for(let t=0;t<r.length;t++)Me(s,r[t],e,i,!0,0===t)}if(s.length){let i=t.tags||null;if("LineString"===o&&r.lineMetrics){i={};for(const e in t.tags)i[e]=t.tags[e];i.mapbox_clip_start=n.start/n.size,i.mapbox_clip_end=n.end/n.size}const a={geometry:s,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:i};null!==t.id&&(a.id=t.id),e.features.push(a)}}function Me(e,t,i,r,n,o){const s=r*r;if(r>0&&t.size<(n?s:r))return void(i.numPoints+=t.length/3);const a=[];for(let e=0;e<t.length;e+=3)(0===r||t[e+2]>s)&&(i.numSimplified++,a.push(t[e],t[e+1])),i.numPoints++;n&&function(e,t){let i=0;for(let t=0,r=e.length,n=r-2;t<r;n=t,t+=2)i+=(e[t]-e[n])*(e[t+1]+e[n+1]);if(i>0===t)for(let t=0,i=e.length;t<i/2;t+=2){const r=e[t],n=e[t+1];e[t]=e[i-2-t],e[t+1]=e[i-1-t],e[i-2-t]=r,e[i-1-t]=n}}(a,o),e.push(a)}const Ee={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Se{constructor(e,t){const i=(t=this.options=function(e,t){for(const i in t)e[i]=t[i];return e}(Object.create(Ee),t)).debug;if(i&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=function(e,t){const i=[];if("FeatureCollection"===e.type)for(let r=0;r<e.features.length;r++)ne(i,e.features[r],t,r);else ne(i,"Feature"===e.type?e:{geometry:e},t);return i}(e,t);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),r=function(e,t){const i=t.buffer/t.extent;let r=e;const n=ue(e,1,-1-i,i,0,-1,2,t),o=ue(e,1,1-i,2+i,0,-1,2,t);return(n||o)&&(r=ue(e,1,-i,1+i,0,-1,2,t)||[],n&&(r=ye(n,1).concat(r)),o&&(r=r.concat(ye(o,-1)))),r}(r,t),r.length&&this.splitTile(r,0,0,0),i&&(r.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(e,t,i,r,n,o,s){const a=[e,t,i,r],l=this.options,c=l.debug;for(;a.length;){r=a.pop(),i=a.pop(),t=a.pop(),e=a.pop();const u=1<<t,h=Ce(t,i,r);let p=this.tiles[h];if(!p&&(c>1&&console.time("creation"),p=this.tiles[h]=we(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,r,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(p.source=e,null==n){if(t===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===n)continue;if(null!=n){const e=n-t;if(i!==o>>e||r!==s>>e)continue}}if(p.source=null,0===e.length)continue;c>1&&console.time("clipping");const d=.5*l.buffer/l.extent,f=.5-d,m=.5+d,_=1+d;let g=null,y=null,v=null,x=null,b=ue(e,u,i-d,i+m,0,p.minX,p.maxX,l),w=ue(e,u,
1i+f,i+_,0,p.minX,p.maxX,l);e=null,b&&(g=ue(b,u,r-d,r+m,1,p.minY,p.maxY,l),y=ue(b,u,r+f,r+_,1,p.minY,p.maxY,l),b=null),w&&(v=ue(w,u,r-d,r+m,1,p.minY,p.maxY,l),x=ue(w,u,r+f,r+_,1,p.minY,p.maxY,l),w=null),c>1&&console.timeEnd("clipping"),a.push(g||[],t+1,2*i,2*r),a.push(y||[],t+1,2*i,2*r+1),a.push(v||[],t+1,2*i+1,2*r),a.push(x||[],t+1,2*i+1,2*r+1)}}getTile(e,t,i){e=+e,t=+t,i=+i;const r=this.options,{extent:n,debug:o}=r;if(e<0||e>24)return null;const s=1<<e,a=Ce(e,t=t+s&s-1,i);if(this.tiles[a])return xe(this.tiles[a],n);o>1&&console.log("drilling down to z%d-%d-%d",e,t,i);let l,c=e,u=t,h=i;for(;!l&&c>0;)c--,u>>=1,h>>=1,l=this.tiles[Ce(c,u,h)];return l&&l.source?(o>1&&(console.log("found parent tile z%d-%d-%d",c,u,h),console.time("drilling down")),this.splitTile(l.source,c,u,h,e,t,i),o>1&&console.timeEnd("drilling down"),this.tiles[a]?xe(this.tiles[a],n):null):null}}function Ce(e,t,i){return 32*((1<<e)*i+t)+e}function Ae(e,t){const i=e.tileID.canonical;if(!this._geoJSONIndex)return t(null,null);const r=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!r)return t(null,null);const n=new f(r.features);let o=U(n);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),t(null,{vectorTile:n,rawData:o.buffer})}class Ie extends c{constructor(e,t,i,r,n,o){super(e,t,i,r,Ae,o),n&&(this.loadGeoJSON=n),this._dynamicIndex=new g}loadData(i,r){const n=i&&i.request,o=n&&n.collectResourceTiming;this.loadGeoJSON(i,((s,a)=>{if(s||!a)return r(s);if("object"!=typeof a)return r(new Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`));{try{if(i.filter){const t=e.z(i.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===t.result)throw new Error(t.value.map((e=>`${e.key}: ${e.message}`)).join(", "));a.features=a.features.filter((e=>t.value.evaluate({zoom:0},e)))}i.dynamic?("Feature"===a.type&&(a={type:"FeatureCollection",features:[a]}),i.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(a.features,this.loaded),i.cluster&&(a.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=i.cluster?new W(function({superclusterOptions:t,clusterProperties:i}){if(!i||!t)return t;const r={},n={},o={accumulated:null,zoom:0},s={properties:null},a=Object.keys(i);for(const t of a){const[o,s]=i[t],a=e.z(s),l=e.z("string"==typeof o?[o,["accumulated"],["get",t]]:o);r[t]=a.value,n[t]=l.value}return t.map=e=>{s.properties=e;const t={};for(const e of a)t[e]=r[e].evaluate(o,s);return t},t.reduce=(e,t)=>{s.properties=t;for(const t of a)o.accumulated=e[t],e[t]=n[t].evaluate(o,s)},t}(i)).load(a.features):i.dynamic?this._dynamicIndex:function(e,t){return new Se(e,t)}(a,i.geojsonVtOptions)}catch(e){return r(e)}const s={};if(o){const e=t(n);e&&(s.resourceTiming={},s.resourceTiming[i.source]=JSON.parse(JSON.stringify(e)))}r(null,s)}}))}reloadTile(e,t){const i=this.loaded;return i&&i[e.uid]?e.partial?t(null,void 0):super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,i){if(t.request)e.h(t.request,i);else{if("string"!=typeof t.data)return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));try{return i(null,JSON.parse(t.data))}catch(e){return i(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(e){t(e)}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){t(e)}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){t(e)}}}class ke{constructor(t,i){this.tileID=new e.aQ(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=t.projection,this.brightness=i}parse(t,i,r,n){this.status="parsing";const o=new e.aQ(r.tileID.overscaledZ,r.tileID.wrap,r.tileID.canonical.z,r.tileID.canonical.x,r.tileID.canonical.y),s={},a=i.familiesBySource[r.source],l=new e.dQ(o,r.promoteId);return l.bucketLayerIDs=[],l.is3DTile=!0,e.e6(t).then((t=>{if(!t)return n(new Error("Could not parse tile"));const i=e.e7(t,1/e.b7(r.tileID.canonical)),c=t.json.extensionsUsed&&t.json.extensionsUsed.includes("MAPBOX_mesh_features")||t.json.asset.extras&&t.json.asset.extras.MAPBOX_mesh_features,u=t.json.extensionsUsed&&t.json.extensionsUsed.includes("EXT_meshopt_compression"),h=new e.Y(this.zoom,{brightness:this.brightness});for(const t in a)for(const r of a[t]){const t=r[0];l.bucketLayerIDs.push(r.map((e=>e.id))),t.recalculate(h,[]);const n=new e.e8(i,o,c,u,this.brightness,l);c||(n.needsUpload=!0),s[t.fqid]=n,n.evaluate(t)}this.status="done",n(null,{buckets:s,featureIndex:l})})).catch((e=>n(new Error(e.message))))}}class Le{constructor(e,t,i,r,n,o){this.actor=e,this.layerIndex=t,this.brightness=o,this.loading={},this.loaded={}}loadTile(t,i){const r=t.uid,n=this.loading[r]=new ke(t,this.brightness);e.e5(t.request,((e,o)=>{const s=!this.loading[r];return delete this.loading[r],s||e?(n.status="done",s||(this.loaded[r]=n),i(e)):o&&0!==o.byteLength?void n.parse(o,this.layerIndex,t,((e,t)=>
1{n.status="done",this.loaded=this.loaded||{},this.loaded[r]=n,e||!t?i(e):i(null,t)})):(n.status="done",this.loaded[r]=n,i())}))}reloadTile(e,t){const i=this.loaded,r=e.uid;if(i&&i[r]){const n=i[r];n.projection=e.projection,n.brightness=e.brightness;const o=(i,r)=>{n.reloadCallback&&(delete n.reloadCallback,this.loadTile(e,t)),t(i,r)};"parsing"===n.status?n.reloadCallback=o:"done"===n.status&&this.loadTile(e,t)}}abortTile(e,t){const i=e.uid;this.loading[i]&&delete this.loading[i],t()}removeTile(e,t){const i=this.loaded,r=e.uid;i&&i[r]&&delete i[r],t()}}class Pe{constructor(t){this.self=t,this.actor=new e.e9(t,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=e.aK({name:"mercator"}),this.workerSourceTypes={vector:c,geojson:Ie,"batched-model":Le},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw new Error(`Worker source with name "${e}" already registered.`);this.workerSourceTypes[e]=t},this.self.registerRTLTextPlugin=t=>{if(e.ea.isParsed())throw new Error("RTL text plugin already registered.");e.ea.applyArabicShaping=t.applyArabicShaping,e.ea.processBidirectionalText=t.processBidirectionalText,e.ea.processStyledBidirectionalText=t.processStyledBidirectionalText}}clearCaches(e,t,i){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],delete this.rasterArrayWorkerSource,i()}checkIfReady(e,t,i){i()}setReferrer(e,t){this.referrer=t}spriteLoaded(t,{scope:i,isLoaded:r}){if(this.isSpriteLoaded[t]||(this.isSpriteLoaded[t]={}),this.isSpriteLoaded[t][i]=r,this.workerSources[t]&&this.workerSources[t][i])for(const n in this.workerSources[t][i]){const o=this.workerSources[t][i][n];for(const t in o){const i=o[t];i instanceof c&&(i.isSpriteLoaded=r,i.fire(new e.g("isSpriteLoaded")))}}}setImages(e,{scope:t,images:i},r){if(this.availableImages[e]||(this.availableImages[e]={}),this.availableImages[e][t]=i,this.workerSources[e]&&this.workerSources[e][t]){for(const r in this.workerSources[e][t]){const n=this.workerSources[e][t][r];for(const e in n)n[e].availableImages=i}r()}else r()}setProjection(t,i){this.projections[t]=e.aK(i)}setBrightness(e,t,i){this.brightness=t,i()}setLayers(e,t,i){this.getLayerIndex(e,t.scope).replace(t.layers,t.options),i()}updateLayers(e,t,i){this.getLayerIndex(e,t.scope).update(t.layers,t.removedIds,t.options),i()}loadTile(e,t,i){t.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,t.type,t.source,t.scope).loadTile(t,i)}loadDEMTile(e,t,i){this.getDEMWorkerSource(e,t.source,t.scope).loadTile(t,i)}decodeRasterArray(e,t,i){this.getRasterArrayWorkerSource().decodeRasterArray(t,i)}reloadTile(e,t,i){t.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,t.type,t.source,t.scope).reloadTile(t,i)}abortTile(e,t,i){this.getWorkerSource(e,t.type,t.source,t.scope).abortTile(t,i)}removeTile(e,t,i){this.getWorkerSource(e,t.type,t.source,t.scope).removeTile(t,i)}removeSource(e,t,i){if(!(this.workerSources[e]&&this.workerSources[e][t.scope]&&this.workerSources[e][t.scope][t.type]&&this.workerSources[e][t.scope][t.type][t.source]))return;const r=this.workerSources[e][t.scope][t.type][t.source];delete this.workerSources[e][t.scope][t.type][t.source],void 0!==r.removeSource?r.removeSource(t,i):i()}loadWorkerSource(e,t,i){try{this.self.importScripts(t.url),i()}catch(e){i(e.toString())}}syncRTLPluginState(t,i,r){try{e.ea.setState(i);const t=e.ea.getPluginURL();if(e.ea.isLoaded()&&!e.ea.isParsed()&&null!=t){this.self.importScripts(t);const i=e.ea.isParsed();r(i?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),i)}}catch(e){r(e.toString())}}setDracoUrl(e,t){this.dracoUrl=t}getAvailableImages(e,t){this.availableImages[e]||(this.availableImages[e]={});let i=this.availableImages[e][t];return i||(i=[]),i}getLayerIndex(e,t){this.layerIndexes[e]||(this.layerIndexes[e]={});let i=this.layerIndexes[e][t];return i||(i=this.layerIndexes[e][t]=new n,i.scope=t),i}getWorkerSource(e,t,i,r){return this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][r]||(this.workerSources[e][r]={}),this.workerSources[e][r][t]||(this.workerSources[e][r][t]={}),this.isSpriteLoaded[e]||(this.isSpriteLoaded[e]={}),this.workerSources[e][r][t][i]||(this.workerSources[e][r][t][i]=new this.workerSourceTypes[t]({send:(t,i,r,n,o,s)=>{this.actor.send(t,i,r,e,o,s)},scheduler:this.actor.scheduler},this.getLayerIndex(e,r),this.getAvailableImages(e,r),this.isSpriteLoaded[e][r],void 0,this.brightness)),this.workerSources[e][r][t][i]}getDEMWorkerSource(e,t,i){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][i]||(this.demWorkerSources[e][i]={}),this.demWorkerSources[e][i][t]||(this.demWorkerSources[e][i][t]=new u),this.demWorkerSources[e][i][t]}getRasterArrayWorkerSource(){return this.rasterArrayWorkerSource||(this.rasterArrayWorkerSource=new h),this.rasterArrayWorkerSource}enforceCacheSizeLimit(t,i){e.eb(i)}getWorkerPerformanceMetrics(e,t,i){i(void 0,void 0)}}return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new Pe(self)),Pe}));r(0,(function(e){var t=i;function i(e){return!function(e){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var e,t,i=new Blob([""],{type:"text/javascript"}),r=URL.createObjectURL(i);try{t=new Worker(r),e=!0}catch(t){e=!1}return t&&t.terminate(),URL.revokeObjectURL(r),e}()?function(){var e=document.createElement("canvas");e.width=e.height=1;var t=e.getContext("2d");if(!t)return!1;var i=t.getImageData(0,0,1,1);return i&&i.width===e.width}()?(void 0===r[t=e&&e.failIfMajorPerformanceCaveat]&&(r[t]=function(e){var t,r=function(e){var t=document.createElement("canvas"),r=Object.create(i.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=e,t.getContext("webgl2",r)}(e);if(!r)return!1;try{t=r.createShader(r.VERTEX_SHADER)}catch(e){return!1}return!(!t||r.isContextLost())&&(r.shaderSource(t,"void main() {}"),r.compileShader(t),!0===r.getShaderParameter(t,r.COMPILE_STATUS))}(t)),r[t]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var t}(e)}var r={};function n(e,t,i){const r=document.createElement(e);return null!=t&&(r.className=t),i&&i.appendChild(r),r}function o(e,t,i){const r=document.createElementNS("http://www.w3.org/2000/svg",e);for(const e of Object.keys(t))r.setAttributeNS(null,e,String(t[e]));return i&&i.appendChild(r),r}i.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};const s="undefined"!=typeof document?document.documentElement&&document.documentElement.style:null,a=s&&void 0!==s.userSelect?"userSelect":"WebkitUserSelect";let l;function c(){s&&a&&(l=s[a],s[a]="none")}function u(){s&&a&&(s[a]=l)}function h(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",h,!0)}function p(){window.addEventListener("click",h,!0),window.setTimeout((()=>{window.removeEventListener("click",h,!0)}),0)}function d(e,t){const i=e.getBoundingClientRect();return _(e,i,t)}function f(e,t){const i=e.getBoundingClientRect(),r=[];for(let n=0;n<t.length;
vendor: 18,410 bytes, line 1
1n++)r.push(_(e,i,t[n]));return r}function m(e){return void 0!==window.InstallTrigger&&2===e.button&&e.ctrlKey&&window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:e.button}function _(t,i,r){const n=t.offsetWidth===i.width?1:t.offsetWidth/i.width;return new e.P((r.clientX-i.left)*n,(r.clientY-i.top)*n)}class g{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages=new Set}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(e,t){this._updatedSourceCaches[e]=t,this.setDirty()}discardSourceCacheUpdate(e){delete this._updatedSourceCaches[e]}updateLayer(e){const t=e.scope;this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._updatedLayers[t].add(e.id),this.setDirty()}removeLayer(e){const t=e.scope;this._removedLayers[t]=this._removedLayers[t]||{},this._updatedLayers[t]=this._updatedLayers[t]||new Set,this._removedLayers[t][e.id]=e,this._updatedLayers[t].delete(e.id),this._updatedPaintProps.delete(e.fqid),this.setDirty()}getRemovedLayer(e){return this._removedLayers[e.scope]?this._removedLayers[e.scope][e.id]:null}discardLayerRemoval(e){this._removedLayers[e.scope]&&delete this._removedLayers[e.scope][e.id]}getLayerUpdatesByScope(){const e={};for(const t in this._updatedLayers)e[t]=e[t]||{},e[t].updatedIds=Array.from(this._updatedLayers[t].values());for(const t in this._removedLayers)e[t]=e[t]||{},e[t].removedIds=Object.keys(this._removedLayers[t]);return e}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(e){this._updatedPaintProps.add(e.fqid),this.setDirty()}getUpdatedImages(){return Array.from(this._updatedImages.values())}updateImage(e){this._updatedImages.add(e),this.setDirty()}resetUpdatedImages(){this._updatedImages.clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages.clear()}}const y={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class v{constructor(e,t,i,r,n,o){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.instanceCount=o,this.context=e;const s=e.gl;this.buffer=s.createBuffer(),e.bindVertexBuffer.set(this.buffer),s.bufferData(s.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||n||t.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){const t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let i=0;i<this.attributes.length;i++){const r=t.attributes[this.attributes[i].name];void 0!==r&&e.enableVertexAttribArray(r)}}setVertexAttribPointers(e,t,i){for(let r=0;r<this.attributes.length;r++){const n=this.attributes[r],o=t.attributes[n.name];void 0!==o&&e.vertexAttribPointer(o,n.components,e[y[n.type]],!1,this.itemSize,n.offset+this.itemSize*(i||0))}}setVertexAttribDivisor(e,t,i){for(let r=0;r<this.attributes.length;r++){const n=t.attributes[this.attributes[r].name];void 0!==n&&this.instanceCount&&this.instanceCount>0&&e.vertexAttribDivisor(n,i)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class x{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class b extends x{getDefault(){return e.C.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class w extends x{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class T extends x{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class M extends x{getDefault(){return[!0,!0,!0,!0]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class E extends x{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class S extends x{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class C extends x{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class A extends x{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class I extends x{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}class k extends x{getDefault(){return[0,1]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class L extends x{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}class P extends x{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class R extends x{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}class z extends x{getDefault(){const e=this.gl;return[e.ONE,e.ZERO,e.ONE,e.ZERO]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.blendFuncSeparate(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class O extends x{getDefault(){return e.C.transparent}set(e){const t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class D extends x{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(e,e),this.current=e,this.dirty=!1)}}class F extends x{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}class B extends x{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class N extends x{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}let j=class extends x{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}};class U extends x{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class V extends x{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class $ extends x{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class G extends x{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class q extends x{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class H extends x{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Z extends x{getDefault(){return null}set(e){const t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class W extends x{getDefault(){return null}set(e){this.gl&&(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}}class X extends x{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Q extends x{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class Y extends x{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class J extends x{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class K extends J{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class ee extends J{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,this.attachment(),t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class te extends J{attachment(){return this.gl.DEPTH_ATTACHMENT}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,this.attachment(),t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class ie extends ee{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}class re{constructor(e,t,i,r,n){this.context=e,this.width=t,this.height=i;const o=this.framebuffer=e.gl.createFramebuffer();r&&(this.colorAttachment=new K(e,o)),n&&(this.depthAttachmentType=n,this.depthAttachment="renderbuffer"===n?new ee(e,o):new te(e,o))}destroy(){const e=this.context.gl;if(this.colorAttachment){const t=this.colorAttachment.get();t&&e.deleteTexture(t)}if(this.depthAttachment&&this.depthAttachmentType)if("renderbuffer"===this.depthAttachmentType){const t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}else{const t=this.depthAttachment.get();t&&e.deleteTexture(t)}e.deleteFramebuffer(this.framebuffer)}}class ne{constructor(e,t){this.gl=e,this.clearColor=new b(this),this.clearDepth=new w(this),this.clearStencil=new T(this),this.colorMask=new M(this),this.depthMask=new E(this),this.stencilMask=new S(this),this.stencilFunc=new C(this),this.stencilOp=new A(this),this.stencilTest=new I(this),this.depthRange=new k(this),this.depthTest=new L(this),this.depthFunc=new P(this),this.blend=new R(this),this.blendFunc=new z(this),this.blendColor=new O(this),this.blendEquation=new D(this),this.cullFace=new F(this),this.cullFaceSide=new B(this),this.frontFace=new N(this),this.program=new j(this),this.activeTexture=new U(this),this.viewport=new V(this),this.bindFramebuffer=new $(this),this.bindRenderbuffer=new G(this),this.bindTexture=new q(this),this.bindVertexBuffer=new H(this),this.bindElementBuffer=new Z(this),this.bindVertexArrayOES=new W(this),this.pixelStoreUnpack=new X(this),this.pixelStoreUnpackPremultiplyAlpha=new Q(this),this.pixelStoreUnpackFlipY=new Y(this),this.options=t?{...t}:{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=e.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=e.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=e.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=e.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxPointSize=e.getParameter(e.ALIASED_POINT_SIZE_RANGE)[1]}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,i,r){return new e.I(this,t,i,r)}createVertexBuffer(e,t,i,r,n){return new v(this,e,t,i,r,n)}createRenderbuffer(e,t,i){const r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),n}createFramebuffer(e,t,i,r){return new re(this,e,t,i,r)}clear({color:e,depth:t,stencil:i,colorMask:r}){const n=this.gl;let o=0;e&&(o|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set(r||[!0,!0,!0,!0])),void 0!==t&&(o|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==i&&(o|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),n.clear(o)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(t){e.d(t.blendFunction,e.a.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor),t.blendEquation?this.blendEquation.set(t.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(t.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}class oe{constructor(t,i,r,n){const o={width:r[0],height:r[1],data:null},s=t.gl;this.targetColorTexture=new e.T(t,o,s.RGBA,{useMipmap:!1}),this.backgroundColorTexture=new e.T(t,o,s.RGBA,{useMipmap:!1}),this.context=t,this.updateParticleTexture(i,n),this.lastInvalidatedAt=0}updateParticleTexture(t,i){if(this.particleTextureDimension===i.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const r=this.context.gl,n=i.width*i.height;this.particleTexture0=new e.T(this.context,i,r.RGBA,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new e.T(this.context,i,r.RGBA,{premultiply:!1,useMipmap:!1});const o=new e.S;o.reserve(n);for(let e=0;e<n;e++)o.emplaceBack(e);this.particleIndexBuffer=this.context.createVertexBuffer(o,e.p.members,!0),this.particleSegment=e.b.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=i.width}update(t){return!(this.lastInvalidatedAt<t&&(this.lastInvalidatedAt=e.e.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}class se extends e.E{constructor(e){super(),this.requestManager=e,this.models={"":{}},this.numModelsLoading={}}loadModel(t,i){return e.l(this.requestManager.transformRequest(i,e.R.Model).url).then((i=>{if(!i)return;const r=e.c(i),n=new e.M(t,void 0,void 0,r);return n.computeBoundsAndApplyParent(),n})).catch((r=>{if(r&&404===r.status)return null;this.fire(new e.f(new Error(`Could not load model ${t} from ${i}: ${r.message}`)))}))}load(t,i){this.models[i]||(this.models[i]={});const r=Object.keys(t);this.numModelsLoading[i]=(this.numModelsLoading[i]||0)+r.length;const n=[];for(const e of r)n.push(this.loadModel(e,t[e]));Promise.allSettled(n).then((t=>{for(let e=0;e<t.length;e++){const{status:n,value:o}=t[e];"fulfilled"===n&&o&&(this.models[i][r[e]]={model:o,numReferences:1})}this.numModelsLoading[i]-=r.length,this.fire(new e.g("data",{dataType:"style"}))})).catch((t=>{this.fire(new e.f(new Error(`Could not load models: ${t.message}`)))}))}isLoaded(){for(const e in this.numModelsLoading)if(this.numModelsLoading[e]>0)return!1;return!0}hasModel(e,t){return!!this.getModel(e,t)}getModel(e,t){return this.models[t]||(this.models[t]={}),this.models[t][e]?this.models[t][e].model:void 0}
1addModel(e,t,i){this.models[i]||(this.models[i]={}),this.hasModel(e,i)&&this.models[i][e].numReferences++,this.load({[e]:this.requestManager.normalizeModelURL(t)},i)}addModels(e,t){this.models[t]||(this.models[t]={});const i={};for(const r in e)this.models[t][r]={},i[r]=this.requestManager.normalizeModelURL(e[r]);this.load(i,t)}addModelsFromBucket(e,t){this.models[t]||(this.models[t]={});const i={};for(const r of e)this.hasModel(r,t)?this.models[t][r].numReferences++:i[r]=this.requestManager.normalizeModelURL(r);this.load(i,t)}removeModel(e,t){if(this.models[t]&&this.models[t][e]&&(this.models[t][e].numReferences--,0===this.models[t][e].numReferences)){const i=this.models[t][e].model;delete this.models[t][e],i.destroy()}}listModels(e){return this.models[e]||(this.models[e]={}),Object.keys(this.models[e])}upload(e,t){this.models[t]||(this.models[t]={});for(const i in this.models[t])this.models[t][i].model&&this.models[t][i].model.upload(e.context)}}function ae(e){const{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class le extends e.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded={},this.requestors=[],this.patterns={},this.atlasImage={},this.atlasTexture={},this.dirty=!0}createScope(t){this.images[t]={},this.loaded[t]=!1,this.updatedImages[t]={},this.patterns[t]={},this.callbackDispatchedThisFrame[t]={},this.atlasImage[t]=new e.j({width:1,height:1})}isLoaded(){for(const e in this.loaded)if(!this.loaded[e])return!1;return!0}setLoaded(e,t){if(this.loaded[t]!==e&&(this.loaded[t]=e,e)){for(const{ids:e,callback:i}of this.requestors)this._notify(e,t,i);this.requestors=[]}}hasImage(e,t){return!!this.getImage(e,t)}getImage(e,t){return this.images[t][e]}addImage(e,t,i){this._validate(e,i)&&(this.images[t][e]=i)}_validate(t,i){let r=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new e.f(new Error(`Image "${t}" has invalid "stretchX" value`))),r=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new e.f(new Error(`Image "${t}" has invalid "stretchY" value`))),r=!1),this._validateContent(i.content,i)||(this.fire(new e.f(new Error(`Image "${t}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let i=0;for(const r of e){if(r[0]<i||r[1]<r[0]||t<r[1])return!1;i=r[1]}return!0}_validateContent(e,t){return!(e&&(4!==e.length||e[0]<0||t.data.width<e[0]||e[1]<0||t.data.height<e[1]||e[2]<0||t.data.width<e[2]||e[3]<0||t.data.height<e[3]||e[2]<e[0]||e[3]<e[1]))}updateImage(e,t,i){i.version=this.images[t][e].version+1,this.images[t][e]=i,this.updatedImages[t][e]=!0}removeImage(e,t){const i=this.images[t][e];delete this.images[t][e],delete this.patterns[t][e],i.userImage&&i.userImage.onRemove&&i.userImage.onRemove()}listImages(e){return Object.keys(this.images[e])}getImages(e,t,i){let r=!0;const n=!!this.loaded[t];if(!n)for(const i of e)this.images[t][i]||(r=!1);n||r?this._notify(e,t,i):this.requestors.push({ids:e,scope:t,callback:i})}getUpdatedImages(e){return this.updatedImages[e]}_notify(t,i,r){const n={};for(const r of t){this.images[i][r]||this.fire(new e.g("styleimagemissing",{id:r}));const t=this.images[i][r];t?n[r]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,hasRenderCallback:Boolean(t.userImage&&t.userImage.render)}:e.w(`Image "${r}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}r(null,n)}getPixelSize(e){const{width:t,height:i}=this.atlasImage[e];return{width:t,height:i}}getPattern(t,i,r){const n=this.patterns[i][t],o=this.getImage(t,i);if(!o)return null;if(n&&n.position.version===o.version)return n.position;if(n)n.position.version=o.version;else{const r={w:o.data.width+2,h:o.data.height+2,x:0,y:0},n=new e.m(r,o);this.patterns[i][t]={bin:r,position:n}}return this._updatePatternAtlas(i,r),this.patterns[i][t].position}bind(t,i){const r=t.gl;let n=this.atlasTexture[i];n?this.dirty&&(n.update(this.atlasImage[i]),this.dirty=!1):(n=new e.T(t,this.atlasImage[i],r.RGBA),this.atlasTexture[i]=n),n.bind(r.LINEAR,r.CLAMP_TO_EDGE)}_updatePatternAtlas(t,i){const r=[];for(const e in this.patterns[t])r.push(this.patterns[t][e].bin);const{w:n,h:o}=e.k(r),s=this.atlasImage[t];s.resize({width:n||1,height:o||1});for(const r in this.patterns[t]){const{bin:n}=this.patterns[t][r],o=n.x+1,a=n.y+1,l=this.images[t][r].data,c=l.width,u=l.height;e.j.copy(l,s,{x:0,y:0},{x:o,y:a},{width:c,height:u},i),e.j.copy(l,s,{x:0,y:u-1},{x:o,y:a-1},{width:c,height:1},i),e.j.copy(l,s,{x:0,y:0},{x:o,y:a+u},{width:c,height:1},i),e.j.copy(l,s,{x:c-1,y:0},{x:o-1,y:a},{width:1,height:u},i),e.j.copy(l,s,{x:0,y:0},{x:o+c,y:a},{width:1,height:u},i)}this.dirty=!0}beginFrame(){for(const e in this.images)this.callbackDispatchedThisFrame[e]={}}
1dispatchRenderCallbacks(e,t){for(const i of e){if(this.callbackDispatchedThisFrame[t][i])continue;this.callbackDispatchedThisFrame[t][i]=!0;const e=this.images[t][i];ae(e)&&this.updateImage(i,t,e)}}}function ce(t){const i=t.key,r=t.value,n=t.valueSpec||{},o=t.objectElementValidators||{},s=t.style,a=t.styleSpec;let l=[];const c=e.o(r);if("object"!==c)return[new e.V(i,r,`object expected, ${c} found`)];for(const t in r){const c=t.split(".")[0];let u;o[c]?u=o[c]:n[c]?u=Le:o["*"]?u=o["*"]:n["*"]&&(u=Le),u?l=l.concat(u({key:(i?`${i}.`:i)+t,value:r[t],valueSpec:n[c]||n["*"],style:s,styleSpec:a,object:r,objectKey:t},r)):l.push(new e.n(i,r[t],`unknown property "${t}"`))}for(const t in n)o[t]||n[t].required&&void 0===n[t].default&&void 0===r[t]&&l.push(new e.V(i,r,`missing required property "${t}"`));return l}function ue(t){const i=t.value,r=t.valueSpec,n=t.style,o=t.styleSpec,s=t.key,a=t.arrayElementValidator||Le;if("array"!==e.o(i))return[new e.V(s,i,`array expected, ${e.o(i)} found`)];if(r.length&&i.length!==r.length)return[new e.V(s,i,`array length ${r.length} expected, length ${i.length} found`)];if(r["min-length"]&&i.length<r["min-length"])return[new e.V(s,i,`array length at least ${r["min-length"]} expected, length ${i.length} found`)];let l={type:r.value,values:r.values,minimum:r.minimum,maximum:r.maximum,function:void 0};o.$version<7&&(l.function=r.function),"object"===e.o(r.value)&&(l=r.value);let c=[];for(let e=0;e<i.length;e++)c=c.concat(a({array:i,arrayIndex:e,value:i[e],valueSpec:l,style:n,styleSpec:o,key:`${s}[${e}]`},!0));return c}function he(t){const i=t.key,r=t.value,n=t.valueSpec;let o=e.o(r);if("number"===o&&r!=r&&(o="NaN"),"number"!==o)return[new e.V(i,r,`number expected, ${o} found`)];if("minimum"in n){let o=n.minimum;if("array"===e.o(n.minimum)&&(o=n.minimum[t.arrayIndex]),r<o)return[new e.V(i,r,`${r} is less than the minimum value ${o}`)]}if("maximum"in n){let o=n.maximum;if("array"===e.o(n.maximum)&&(o=n.maximum[t.arrayIndex]),r>o)return[new e.V(i,r,`${r} is greater than the maximum value ${o}`)]}return[]}function pe(t){const i=t.valueSpec,r=e.u(t.value.type);let n,o,s,a={};const l="categorical"!==r&&void 0===t.value.property,c=!l,u="array"===e.o(t.value.stops)&&"array"===e.o(t.value.stops[0])&&"object"===e.o(t.value.stops[0][0]),h=ce({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===r)return[new e.V(t.key,t.value,'identity function may not have a "stops" property')];let i=[];const n=t.value;return i=i.concat(ue({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:p})),"array"===e.o(n)&&0===n.length&&i.push(new e.V(t.key,n,"array must have at least one stop")),i},default:function(e){return Le({key:e.key,value:e.value,valueSpec:i,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===r&&l&&h.push(new e.V(t.key,t.value,'missing required property "property"')),"identity"===r||t.value.stops||h.push(new e.V(t.key,t.value,'missing required property "stops"')),"exponential"===r&&t.valueSpec.expression&&!e.s(t.valueSpec)&&h.push(new e.V(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(c&&!e.r(t.valueSpec)?h.push(new e.V(t.key,t.value,"property functions not supported")):l&&!e.t(t.valueSpec)&&h.push(new e.V(t.key,t.value,"zoom functions not supported"))),"categorical"!==r&&!u||void 0!==t.value.property||h.push(new e.V(t.key,t.value,'"property" property is required')),h;function p(t){let r=[];const n=t.value,l=t.key;if("array"!==e.o(n))return[new e.V(l,n,`array expected, ${e.o(n)} found`)];if(2!==n.length)return[new e.V(l,n,`array length 2 expected, length ${n.length} found`)];if(u){if("object"!==e.o(n[0]))return[new e.V(l,n,`object expected, ${e.o(n[0])} found`)];if(void 0===n[0].zoom)return[new e.V(l,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new e.V(l,n,"object stop key must have value")];const i=e.u(n[0].zoom);if("number"!=typeof i)return[new e.V(l,n[0].zoom,"stop zoom values must be numbers")];if(s&&s>i)return[new e.V(l,n[0].zoom,"stop zoom values must appear in ascending order")];i!==s&&(s=i,o=void 0,a={}),r=r.concat(ce({key:`${l}[0]`,value:n[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:he,value:d}}))}else r=r.concat(d({key:`${l}[0]`,value:n[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},n));return e.v(e.x(n[1]))?r.concat([new e.V(`${l}[1]`,n[1],"expressions are not allowed in function stops.")]):r.concat(Le({key:`${l}[1]`,value:n[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function d(t,s){const l=e.o(t.value),c=e.u(t.value),u=null!==t.value?t.value:s;if(n){if(l!==n)return[new e.V(t.key,u,`${l} stop domain type must match previous stop domain type ${n}`)]}else n=l;if("number"!==l&&"string"!==l&&"boolean"!==l&&"number"!=typeof c&&"string"!=typeof c&&"boolean"!=typeof c)return[new e.V(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==l&&"categorical"!==r){let n=`number expected, ${l}
1 found`;return e.r(i)&&void 0===r&&(n+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new e.V(t.key,u,n)]}return"categorical"!==r||"number"!==l||"number"==typeof c&&isFinite(c)&&Math.floor(c)===c?"categorical"!==r&&"number"===l&&"number"==typeof c&&"number"==typeof o&&void 0!==o&&c<o?[new e.V(t.key,u,"stop domain values must appear in ascending order")]:(o=c,"categorical"===r&&c in a?[new e.V(t.key,u,"stop domain values must be unique")]:(a[c]=!0,[])):[new e.V(t.key,u,`integer expected, found ${String(c)}`)]}}function de(t){const i=("property"===t.expressionContext?e.y:e.z)(e.x(t.value),t.valueSpec);if("error"===i.result)return i.value.map((i=>new e.V(`${t.key}${i.key}`,t.value,i.message)));const r=i.value.expression||i.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&!r.outputDefined())return[new e.V(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===t.expressionContext&&"layout"===t.propertyType&&!e.A(r))return[new e.V(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext)return fe(r,t);if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!e.B(r,["zoom","feature-state"]))return[new e.V(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!e.D(r))return[new e.V(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function fe(t,i){const r=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(i.valueSpec&&i.valueSpec.expression)for(const e of i.valueSpec.expression.parameters)r.delete(e);if(0===r.size)return[];const n=[];return t instanceof e.F&&r.has(t.name)?[new e.V(i.key,i.value,`["${t.name}"] expression is not supported in a filter for a ${i.object.type} layer with id: ${i.object.id}`)]:(t.eachChild((e=>{n.push(...fe(e,i))})),n)}function me(t){const i=t.key,r=t.value,n=t.valueSpec,o=[];return Array.isArray(n.values)?-1===n.values.indexOf(e.u(r))&&o.push(new e.V(i,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(e.u(r))&&o.push(new e.V(i,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),o}function _e(t){return e.H(e.x(t.value))?de(e.q({},t,{expressionContext:"filter",valueSpec:t.styleSpec[`filter_${t.layerType||"fill"}`]})):ge(t)}function ge(t){const i=t.value,r=t.key;if("array"!==e.o(i))return[new e.V(r,i,`array expected, ${e.o(i)} found`)];const n=t.styleSpec;let o,s=[];if(i.length<1)return[new e.V(r,i,"filter array must have at least 1 element")];switch(s=s.concat(me({key:`${r}[0]`,value:i[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),e.u(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&"$type"===e.u(i[1])&&s.push(new e.V(r,i,`"$type" cannot be use with operator "${i[0]}"`));case"==":case"!=":3!==i.length&&s.push(new e.V(r,i,`filter array for operator "${i[0]}" must have 3 elements`));case"in":case"!in":i.length>=2&&(o=e.o(i[1]),"string"!==o&&s.push(new e.V(`${r}[1]`,i[1],`string expected, ${o} found`)));for(let a=2;a<i.length;a++)o=e.o(i[a]),"$type"===e.u(i[1])?s=s.concat(me({key:`${r}[${a}]`,value:i[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==o&&"number"!==o&&"boolean"!==o&&s.push(new e.V(`${r}[${a}]`,i[a],`string, number, or boolean expected, ${o} found`));break;case"any":case"all":case"none":for(let e=1;e<i.length;e++)s=s.concat(ge({key:`${r}[${e}]`,value:i[e],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":o=e.o(i[1]),2!==i.length?s.push(new e.V(r,i,`filter array for "${i[0]}" operator must have 2 elements`)):"string"!==o&&s.push(new e.V(`${r}[1]`,i[1],`string expected, ${o} found`))}return s}function ye(t,i){const r=t.key,n=t.style,o=t.layer,s=t.styleSpec,a=t.value,l=t.objectKey,c=s[`${i}_${t.layerType}`];if(!c)return[];const u=l.match(/^(.*)-transition$/);if("paint"===i&&u&&c[u[1]]&&c[u[1]].transition)return Le({key:r,value:a,valueSpec:s.transition,style:n,styleSpec:s}
1);const h=t.valueSpec||c[l];if(!h)return[new e.n(r,a,`unknown property "${l}"`)];let p;if("string"===e.o(a)&&e.r(h)&&!h.tokens&&(p=/^{([^}]+)}$/.exec(a))){const t=`\`{ "type": "identity", "property": ${p?JSON.stringify(p[1]):'"_"'} }\``;return[new e.V(r,a,`"${l}" does not support interpolation syntax\nUse an identity property function instead: ${t}.`)]}const d=[];if("symbol"===t.layerType)"text-field"!==l||!n||n.glyphs||n.imports||d.push(new e.V(r,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===l&&e.J(e.x(a))&&"identity"===e.u(a.type)&&d.push(new e.V(r,a,'"text-font" does not support identity functions'));else if("model"===t.layerType&&"paint"===i&&o&&o.layout&&o.layout.hasOwnProperty("model-id")&&e.r(h)&&(e.K(h)||e.t(h))){const t=e.y(e.x(a),h),i=t.value.expression||t.value._styleExpression.expression;i&&!e.B(i,["measure-light"])&&("model-emissive-strength"===l&&e.D(i)&&e.A(i)||d.push(new e.V(r,a,`${l} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return d.concat(Le({key:t.key,value:a,valueSpec:h,style:n,styleSpec:s,expressionContext:"property",propertyType:i,propertyKey:l}))}function ve(e){return ye(e,"paint")}function xe(e){return ye(e,"layout")}function be(t){let i=[];const r=t.value,n=t.key,o=t.style,s=t.styleSpec;r.type||r.ref||i.push(new e.V(n,r,'either "type" or "ref" is required'));let a=e.u(r.type);const l=e.u(r.ref);if(r.id){const s=e.u(r.id);for(let a=0;a<t.arrayIndex;a++){const t=o.layers[a];e.u(t.id)===s&&i.push(new e.V(n,r.id,`duplicate layer id "${r.id}", previously used at line ${t.id.__line__}`))}}if("ref"in r){let t;["type","source","source-layer","filter","layout"].forEach((t=>{t in r&&i.push(new e.V(n,r[t],`"${t}" is prohibited for ref layers`))})),o.layers.forEach((i=>{e.u(i.id)===l&&(t=i)})),t?t.ref?i.push(new e.V(n,r.ref,"ref cannot reference another ref layer")):a=e.u(t.type):"string"==typeof l&&i.push(new e.V(n,r.ref,`ref layer "${l}" not found`))}else if("background"!==a&&"sky"!==a&&"slot"!==a)if(r.source){const t=o.sources&&o.sources[r.source],s=t&&e.u(t.type);t?"vector"===s&&"raster"===a?i.push(new e.V(n,r.source,`layer "${r.id}" requires a raster source`)):"raster"===s&&"raster"!==a?i.push(new e.V(n,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==s||r["source-layer"]?"raster-dem"===s&&"hillshade"!==a?i.push(new e.V(n,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"raster-array"!==s||["raster","raster-particle"].includes(a)?"line"!==a||!r.paint||!r.paint["line-gradient"]&&!r.paint["line-trim-offset"]||"geojson"===s&&t.lineMetrics?"raster-particle"===a&&"raster-array"!==s&&i.push(new e.V(n,r.source,`layer "${r.id}" requires a 'raster-array' source.`)):i.push(new e.V(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):i.push(new e.V(n,r.source,"raster-array source can only be used with layer type 'raster'.")):i.push(new e.V(n,r,`layer "${r.id}" must specify a "source-layer"`)):i.push(new e.V(n,r.source,`source "${r.source}" not found`))}else i.push(new e.V(n,r,'missing required property "source"'));return i=i.concat(ce({key:n,value:r,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Le({key:`${n}.type`,value:r.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,object:r,objectKey:"type"}),filter:t=>_e(e.q({layerType:a},t)),layout:t=>ce({layer:r,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>xe(e.q({layerType:a},t))}}),paint:t=>ce({layer:r,key:t.key,value:t.value,valueSpec:{},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":t=>ve(e.q({layerType:a,layer:r},t))}})}})),i}function we(t){const i=t.value,r=t.key,n=e.o(i);return"string"!==n?[new e.V(r,i,`string expected, ${n} found`)]:[]}const Te={promoteId:function({key:t,value:i}){if("string"===e.o(i))return we({key:t,value:i});{const e=[];for(const r in i)e.push(...we({key:`${t}.${r}`,value:i[r]}));return e}}};function Me(t){const i=t.value,r=t.key,n=t.styleSpec,o=t.style;
1if(!i.type)return[new e.V(r,i,'"type" is required')];const s=e.u(i.type);let a=[];switch(["vector","raster","raster-dem","raster-array"].includes(s)&&(i.url||i.tiles||a.push(new e.n(r,i,'Either "url" or "tiles" is required.'))),s){case"vector":case"raster":case"raster-dem":case"raster-array":return a=a.concat(ce({key:r,value:i,valueSpec:n[`source_${s.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:Te})),a;case"geojson":if(a=ce({key:r,value:i,valueSpec:n.source_geojson,style:o,styleSpec:n,objectElementValidators:Te}),i.cluster)for(const e in i.clusterProperties){const[t,n]=i.clusterProperties[e],o="string"==typeof t?[t,["accumulated"],["get",e]]:t;a.push(...de({key:`${r}.${e}.map`,value:n,expressionContext:"cluster-map"})),a.push(...de({key:`${r}.${e}.reduce`,value:o,expressionContext:"cluster-reduce"}))}return a;case"video":return ce({key:r,value:i,valueSpec:n.source_video,style:o,styleSpec:n});case"image":return ce({key:r,value:i,valueSpec:n.source_image,style:o,styleSpec:n});case"canvas":return[new e.V(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return me({key:`${r}.type`,value:i.type,valueSpec:{values:Ee(n)},style:o,styleSpec:n})}}function Ee(e){return e.source.reduce(((t,i)=>{const r=e[i];return"enum"===r.type.type&&(t=t.concat(Object.keys(r.type.values))),t}),[])}function Se(t){const i=t.value,r=t.styleSpec,n=r.light,o=t.style;let s=[];const a=e.o(i);if(void 0===i)return s;if("object"!==a)return s=s.concat([new e.V("light",i,`object expected, ${a} found`)]),s;for(const t in i){const a=t.match(/^(.*)-transition$/);s=s.concat(a&&n[a[1]]&&n[a[1]].transition?Le({key:t,value:i[t],valueSpec:r.transition,style:o,styleSpec:r}):n[t]?Le({key:t,value:i[t],valueSpec:n[t],style:o,styleSpec:r}):[new e.V(t,i[t],`unknown property "${t}"`)])}return s}function Ce(t){const i=t.value;let r=[];if(!i)return r;const n=e.o(i);if("object"!==n)return r=r.concat([new e.V("light-3d",i,`object expected, ${n} found`)]),r;const o=t.styleSpec,s=o["light-3d"],a=t.key,l=t.style,c=t.style.lights;for(const t of["type","id"])if(!(t in i))return r=r.concat([new e.V("light-3d",i,`missing property ${t} on light`)]),r;if(i.type&&c)for(let n=0;n<t.arrayIndex;n++){const t=e.u(i.type),o=c[n];e.u(o.type)===t&&r.push(new e.V(a,i.id,`duplicate light type "${i.type}", previously defined at line ${o.id.__line__}`))}const u=`properties_light_${i.type}`;if(!(u in o))return r=r.concat([new e.V("light-3d",i,`Invalid light type ${i.type}`)]),r;const h=o[u];for(const n in i)if("properties"===n){const s=i[n],a=e.o(s);if("object"!==a)return r=r.concat([new e.V("properties",s,`object expected, ${a} found`)]),r;for(const i in s)r=r.concat(h[i]?Le({key:i,value:s[i],valueSpec:h[i],style:l,styleSpec:o}):[new e.n(t.key,s[i],`unknown property "${i}"`)])}else{const t=n.match(/^(.*)-transition$/);r=r.concat(t&&s[t[1]]&&s[t[1]].transition?Le({key:n,value:i[n],valueSpec:o.transition,style:l,styleSpec:o}):s[n]?Le({key:n,value:i[n],valueSpec:s[n],style:l,styleSpec:o}):[new e.n(n,i[n],`unknown property "${n}"`)])}return r}function Ae(t){const i=t.value,r=t.key,n=t.style,o=t.styleSpec,s=o.terrain;let a=[];const l=e.o(i);if(void 0===i)return a;if("null"===l)return a;
1if("object"!==l)return a=a.concat([new e.V("terrain",i,`object expected, ${l} found`)]),a;for(const t in i){const r=t.match(/^(.*)-transition$/);a=a.concat(r&&s[r[1]]&&s[r[1]].transition?Le({key:t,value:i[t],valueSpec:o.transition,style:n,styleSpec:o}):s[t]?Le({key:t,value:i[t],valueSpec:s[t],style:n,styleSpec:o}):[new e.n(t,i[t],`unknown property "${t}"`)])}if(i.source){const t=n.sources&&n.sources[i.source],o=t&&e.u(t.type);t?"raster-dem"!==o&&a.push(new e.V(r,i.source,`terrain cannot be used with a source of type ${String(o)}, it only be used with a "raster-dem" source type`)):a.push(new e.V(r,i.source,`source "${i.source}" not found`))}else a.push(new e.V(r,i,'terrain is missing required property "source"'));return a}function Ie(t){const i=t.value,r=t.style,n=t.styleSpec,o=n.fog;let s=[];const a=e.o(i);if(void 0===i)return s;if("object"!==a)return s=s.concat([new e.V("fog",i,`object expected, ${a} found`)]),s;for(const t in i){const a=t.match(/^(.*)-transition$/);s=s.concat(a&&o[a[1]]&&o[a[1]].transition?Le({key:t,value:i[t],valueSpec:n.transition,style:r,styleSpec:n}):o[t]?Le({key:t,value:i[t],valueSpec:o[t],style:r,styleSpec:n}):[new e.n(t,i[t],`unknown property "${t}"`)])}return s}const ke={"*":()=>[],array:ue,boolean:function(t){const i=t.value,r=t.key,n=e.o(i);return"boolean"!==n?[new e.V(r,i,`boolean expected, ${n} found`)]:[]},number:he,color:function(t){const i=t.key,r=t.value,n=e.o(r);return"string"!==n?[new e.V(i,r,`color expected, ${n} found`)]:null===e.G(r)?[new e.V(i,r,`color expected, "${r}" found`)]:[]},enum:me,filter:_e,function:pe,layer:be,object:ce,source:Me,model:e.L,light:Se,"light-3d":Ce,terrain:Ae,fog:Ie,string:we,formatted:function(e){return 0===we(e).length?[]:de(e)},resolvedImage:function(e){return 0===we(e).length?[]:de(e)},projection:function(t){const i=t.value,r=t.styleSpec,n=r.projection,o=t.style;let s=[];const a=e.o(i);if("object"===a)for(const e in i)s=s.concat(Le({key:e,value:i[e],valueSpec:n[e],style:o,styleSpec:r}));else"string"!==a&&(s=s.concat([new e.V("projection",i,`object or string expected, ${a} found`)]));return s},import:function(t){const{value:i,styleSpec:r}=t,{data:n,...o}=i;Object.defineProperty(o,"__line__",{value:i.__line__,enumerable:!1});let s=ce(e.q({},t,{value:o,valueSpec:r.import}));return""===e.u(o.id)&&s.push(new e.V(`${t.key}.id`,o,"import id can't be an empty string")),n&&(s=s.concat(Re(n,r,{key:`${t.key}.data`}))),s}};function Le(t,i=!1){const r=t.value,n=t.valueSpec,o=t.styleSpec;if(n.expression&&e.J(e.u(r)))return pe(t);if(n.expression&&e.v(e.x(r)))return de(t);if(n.type&&ke[n.type]){const r=ke[n.type](t);return!0===i&&r.length>0&&"array"===e.o(t.value)?de(t):r}return ce(e.q({},t,{valueSpec:n.type?o[n.type]:n}))}function Pe(t){const i=t.value,r=t.key,n=we(t);return n.length||(-1===i.indexOf("{fontstack}")&&n.push(new e.V(r,i,'"glyphs" url must include a "{fontstack}" token')),-1===i.indexOf("{range}")&&n.push(new e.V(r,i,'"glyphs" url must include a "{range}" token'))),n}function Re(t,i=e.N,r={}){return Le({key:r.key||"",value:t,valueSpec:i.$root,styleSpec:i,style:t,objectElementValidators:{glyphs:Pe,"*":()=>[]}})}function ze(t,i=e.N){return qe(Re(t,i))}const Oe=e=>qe(Me(e)),De=e=>qe(Se(e)),Fe=e=>qe(Ce(e)),Be=e=>qe(Ae(e)),Ne=e=>qe(Ie(e)),je=e=>qe(be(e)),Ue=e=>qe(_e(e)),Ve=e=>qe(ve(e)),$e=e=>qe(xe(e)),Ge=t=>qe(e.L(t));function qe(e){return e.slice().sort(((e,t)=>e.line&&t.line?e.line-t.line:0))}
1function He(t,i){let r=!1;if(i&&i.length)for(const n of i)n instanceof e.n?e.w(n.message):(t.fire(new e.f(new Error(n.message))),r=!0);return r}let Ze;class We extends e.E{constructor(t,i="flat"){super(),this._transitionable=new e.O(Ze||(Ze=new e.U({anchor:new e.W(e.N.light.anchor),position:new e.X(e.N.light.position),color:new e.W(e.N.light.color),intensity:new e.W(e.N.light.intensity)}))),this.setLight(t,i),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t,i={}){this._validate(De,e,i)||(this._transitionable.setTransitionOrValue(e),this.id=t)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,r){return(!r||!1!==r.validate)&&He(this,t.call(ze,e.Q({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.N})))}}const Xe=new e.U({source:new e.W(e.N.terrain.source),exaggeration:new e.W(e.N.terrain.exaggeration)});let Qe=class extends e.E{constructor(t,i,r,n){super(),this.scope=r,this._transitionable=new e.O(Xe,r,n),this._transitionable.setTransitionOrValue(t,n),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=i}get(){return this._transitionable.serialize()}set(e,t){this._transitionable.setTransitionOrValue(e,t)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}getExaggeration(t){return this._transitioning.possiblyEvaluate(new e.Y(t)).get("exaggeration")}isZoomDependent(){const t=this._transitionable._values.exaggeration;return null!=t&&null!=t.value&&null!=t.value.expression&&t.value.expression instanceof e.Z}};const Ye=45,Je=65,Ke=.05;function et(t,i,r,n){const o=e.a0(Ye,Je,r),[s,a]=tt(t,n);let l=1-Math.min(1,Math.exp((i-s)/(a-s)*-6));return l*=l*l,l=Math.min(1,1.00747*l),l*o*t.alpha}function tt(e,t){const i=.5/Math.tan(.5*t);return[e.range[0]+i,e.range[1]+i]}function it(t,i,r,n,o){const s=e.$.transformMat4([],[i,r,n],o.mercatorFogMatrix);return et(t,e.$.length(s),o.pitch,o._fov)}function rt(t,i,r,n,o,s,a){const l=[[r,n,0],[o,n,0],[o,s,0],[r,s,0]];let c=Number.MAX_VALUE,u=-Number.MAX_VALUE;for(const t of l){const r=e.$.transformMat4([],t,i),n=e.$.length(r);c=Math.min(c,n),u=Math.max(u,n)}return[et(t,c,a.pitch,a._fov),et(t,u,a.pitch,a._fov)]}const nt=new e.U({range:new e.W(e.N.fog.range),color:new e.W(e.N.fog.color),"high-color":new e.W(e.N.fog["high-color"]),"space-color":new e.W(e.N.fog["space-color"]),"horizon-blend":new e.W(e.N.fog["horizon-blend"]),"star-intensity":new e.W(e.N.fog["star-intensity"]),"vertical-range":new e.W(e.N.fog["vertical-range"])});class ot extends e.E{constructor(t,i,r,n){super(),this._transitionable=new e.O(nt,r,new Map(n)),this.set(t,n),this._transitioning=this._transitionable.untransitioned(),this._transform=i,this.properties=new e.a1(nt),this.scope=r}get state(){const t=this._transform,i="globe"===t.projection.name,r=e.a2(t.zoom),n=this.properties.get("range"),o=[.5,3];return{range:i?[e.a3(o[0],n[0],r),e.a3(o[1],n[1],r)]:n,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,i,r={}){if(this._validate(Ne,t,r))return;const n=e.Q({},t);for(const t of Object.keys(e.N.fog))void 0===n[t]&&(n[t]=e.N.fog[t].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,i)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const i=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:e.a0(Ye,Je,t))*i.a}getOpacityAtLatLng(t,i){return this._transform.projection.supportsFog?function(t,i,r){const n=e._.fromLngLat(i),o=r.elevation?r.elevation.getAtPointOrZero(n):0;return it(t,n.x,n.y,o,r)}(this.state,t,i):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const i=this._transform.calculateFogTileMatrix(t.toUnwrapped());return rt(this.state,i,0,0,e.a4,e.a4,this._transform)}getOpacityForBounds(e,t,i,r,n){return this._transform.projection.supportsFog?rt(this.state,e,t,i,r,n,this._transform):[1,1]}getFovAdjustedRange(e){return this._transform.projection.supportsFog?tt(this.state,e):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const i=[4,5,6,7];for(const r of i){const i=t.points[r];let n;if(i[2]>=0)n=i;else{const o=t.points[r-4];n=e.a5(o,i,o[2]/(o[2]-i[2]))}if(it(this.state,n[0],n[1],0,this._transform)>=Ke)return!0}return!1}updateConfig(e){this._transitionable.setTransitionOrValue(this._options,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(t,i,r){return(!r||!1!==r.validate)&&He(this,t.call(ze,e.Q({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.N})))}}class st extends e.E{constructor(t,i,r,n){super(),this.scope=r,this._options=t,this.properties=new e.a1(i),this._transitionable=new e.O(i,r,new Map(n)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(e){this._transitionable.setTransitionOrValue(this._options.properties,new Map(e))}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(e,t){this._options=e,this._transitionable.setTransitionOrValue(e.properties,t)}shadowsEnabled(){return!!this.properties&&!0===this.properties.get("cast-shadows")}}let at,lt;var ct="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef RENDER_CUTOFF\nfloat cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}\n#endif",ut="\nout vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}\n#ifdef INDICATOR_CUTOUT\nuniform vec2 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\n#endif\nvec4 applyCutout(vec4 color) {\n#ifdef INDICATOR_CUTOUT\nfloat holeMinOpacity=u_indicator_cutout_params.x;float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;
1float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);\n#else\nreturn color;\n#endif\n}\n#ifdef DEBUG_WIREFRAME\n#define HANDLE_WIREFRAME_DEBUG \\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\ngl_FragDepth=gl_FragCoord.z-0.0001;\n#else\n#define HANDLE_WIREFRAME_DEBUG\n#endif\n#ifdef RENDER_CUTOFF\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\n#endif\nvec4 textureLodCustom(sampler2D image,vec2 pos,vec2 lod_coord) {vec2 size=vec2(textureSize(image,0));vec2 dx=dFdx(lod_coord.xy*size);vec2 dy=dFdy(lod_coord.xy*size);float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}",ht="\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}\n#ifdef RENDER_CUTOFF\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\n#endif\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}",pt="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;
1void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",dt="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nvec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }\n#endif\n#ifdef DEPTH_OCCLUSION\nuniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;\n#ifdef DEPTH_D24\nfloat unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}\n#else\nhighp float unpack_depth_rgba(vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;\n#ifdef DEPTH_D24\nfloat depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);\n#else\nfloat depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));\n#endif\nreturn coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
1size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef DEPTH_D24\nhighp vec4 depth=vec4(\ntexture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r\n);depth=unpack_depth4(depth);\n#else\nhighp vec4 depth=vec4(\nunpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))\n);\n#endif\nreturn depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));\n#endif\nres+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}\n#else\nbool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }\n#endif//DEPTH_OCCLUSION",ft="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",mt="highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}\n#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
1vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {\n#ifdef FOG_DITHERING\nvec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);\n#else\nreturn color;\n#endif\n}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif",_t="#ifdef RASTER_ARRAY\nuniform sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)\n);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)\n);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}\n#endif",gt="#ifdef RASTER_ARRAY\nuniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}\n#endif\nuniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}",yt="#ifdef RENDER_SHADOWS\nuniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}\n#endif//RENDER_SHADOWS",vt="#ifdef RENDER_SHADOWS\n#ifdef DEPTH_TEXTURE\nuniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1;\n#else\nuniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1;\n#endif\nuniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp float shadow_sample_1(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_1,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth;\n#ifdef DEPTH_TEXTURE\nshadow_depth=texture(u_shadowmap_0,uv).r;\n#else\nshadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5;\n#endif\nreturn step(shadow_depth,compare);}
1float shadow_occlusion_1(highp vec4 pos,highp float bias) {highp vec2 uv=pos.xy;return shadow_sample_1(uv,pos.z-bias);}float shadow_occlusion_0(highp vec4 pos,highp float bias) {highp float compare0=pos.z-bias;\n#ifdef NATIVE\nhighp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0));\n#else\nhighp vec2 uv00=pos.xy-vec2(0.5*u_shadow_texel_size);highp vec2 uv10=uv00+vec2(u_shadow_texel_size,0.0);highp vec2 uv01=uv00+vec2(0.0,u_shadow_texel_size);highp vec2 uv11=uv01+vec2(u_shadow_texel_size,0.0);lowp vec4 stepSamples=vec4(\nshadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0)\n);\n#endif\nvec2 f=fract(pos.xy*u_shadow_map_resolution-vec2(0.5));lowp vec2 lerpx=mix(stepSamples.wx,stepSamples.zy,f.xx);return mix(lerpx.x,lerpx.y,f.y);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {\n#ifdef SHADOWS_SINGLE_CASCADE\nlight_view_pos0.xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);\n#else\nlight_view_pos0.xyz/=light_view_pos0.w;light_view_pos1.xyz/=light_view_pos1.w;vec4 uv=vec4(light_view_pos0.xy,light_view_pos1.xy);vec4 abs_bounds=abs(uv);if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}light_view_pos1.xyz=light_view_pos1.xyz*0.5+0.5;float occlusion1=shadow_occlusion_1(light_view_pos1,bias);return mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth));\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}\n#endif";const xt=[];
1St(ct,xt),St(ht,xt),St(ut,xt);const bt={"_prelude_fog.vertex.glsl":ft,"_prelude_terrain.vertex.glsl":dt,"_prelude_shadow.vertex.glsl":yt,"_prelude_fog.fragment.glsl":mt,"_prelude_shadow.fragment.glsl":vt,"_prelude_lighting.glsl":"\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\n#endif//LIGHTING_3D_MODE","_prelude_raster_array.glsl":_t,"_prelude_raster_particle.glsl":gt},wt={};Ct("",dt),Ct(mt,ft),Ct(vt,yt),Ct(_t,""),Ct(gt,"");const Tt=Ct(ut,ht),Mt=ct;var Et={background:Ct('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec4 u_color;uniform float u_opacity;\n#ifdef LIGHTING_3D_MODE\nin vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),backgroundPattern:Ct('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
1\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),circle:Ct('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nuniform float u_emissive_strength;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float opacity_t=smoothstep((1.0-blur_positive)*antialiased_blur,blur_positive*antialiased_blur,extrude_length-1.0)-smoothstep(0.0,antialiasblur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\nglFragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);
1\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}'),clippingMask:Ct("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Ct('#include "_prelude_fog.fragment.glsl"\nuniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nout vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),heatmapTexture:Ct("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);
1\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Ct("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",'#include "_prelude_terrain.vertex.glsl"\nin vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in float a_size_scale;in vec2 a_padding;in float a_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(a_z_offset+elevation(a_anchor_pos)),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}'),collisionCircle:Ct("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}","in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:Ct("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",'#include "_prelude_terrain.vertex.glsl"\nin vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;\n#endif\nout vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}'),fill:Ct('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
1\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillOutline:Ct('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nin vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillOutlinePattern:Ct('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;in highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillPattern:Ct('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;in vec2 v_pos;uniform float u_emissive_strength;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
1\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),fillExtrusion:Ct('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec4 v_color;in vec4 v_flat;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\nuniform lowp float u_opacity;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radius;in float v_has_floodlight;\n#endif\nuniform float u_emissive_strength;in float v_height;void main() {\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);\n#else\nfloat shadowed_lighting_factor;\n#ifdef RENDER_CUTOFF\nshadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,u_emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
1\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_alignment;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec4 a_join_normal_inside_polygon;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nuniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nout vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nout highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec2 v_ao;\n#endif\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nout float v_flood_radius;out float v_has_floodlight;\n#endif\nout float v_height;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define highp float flood_light_wall_radius\n#pragma mapbox: define highp float line_width\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize highp float flood_light_wall_radius\n#pragma mapbox: initialize highp float line_width\nbase*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nv_normal=normal;\n#endif\nbase=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat cutoff=1.0;vec3 scaled_pos=pos;\n#ifdef RENDER_CUTOFF\nvec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=cutoff_opacity(u_cutoff_params,ground.z);if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0));\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside_polygon.xy/EXTENT);float isPolygon=a_join_normal_inside_polygon.w;float sideAlignment=abs(isPolygon*u_alignment);scaled_pos.xy+=(1.0-a_join_normal_inside_polygon.z)*mix(wall_offset*0.5,wall_offset*mix(1.0,0.0,max(u_alignment,0.0)),sideAlignment);scaled_pos.xy-=a_join_normal_inside_polygon.z*mix(wall_offset*0.5,wall_offset*mix(0.0,1.0,max(u_alignment,0.0)),sideAlignment);\n#endif\ngl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifndef LIGHTING_3D_MODE\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1\n#endif\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\nfloat is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;\n#endif\nv_color=vec4(color.rgb,1.0);v_flat=vec4(linearProduct(color.rgb,vec3(calculate_NdotL(normal))),1.0);\n#else\nv_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),fillExtrusionDepth:Ct("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_alignment;uniform float u_width_scale;uniform float u_vertical_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec4 a_join_normal_inside_polygon;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp float line_width\nout highp float v_depth;void main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp float line_width\nbase*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nvec3 pos;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base);pos=vec3(pos_nx.xy,h);\n#else\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside_polygon.xy/EXTENT);float isPolygon=a_join_normal_inside_polygon.w;float sideAlignment=abs(isPolygon*u_alignment);pos.xy+=(1.0-a_join_normal_inside_polygon.z)*mix(wall_offset*0.5,wall_offset*mix(1.0,0.0,max(u_alignment,0.0)),sideAlignment);pos.xy-=a_join_normal_inside_polygon.z*mix(wall_offset*0.5,wall_offset*mix(0.0,1.0,max(u_alignment,0.0)),sideAlignment);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}'),fillExtrusionPattern:Ct('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nin vec3 v_normal;\n#endif\nin vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
1),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\nuniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_alignment;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;\n#ifdef RENDER_WALL_MODE\nin vec4 a_join_normal_inside_polygon;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nout vec2 v_pos;out vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nout vec3 v_normal;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define highp float pixel_ratio\n#pragma mapbox: define highp float line_width\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize highp float pixel_ratio\n#pragma mapbox: initialize highp float line_width\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\n#ifdef RENDER_WALL_MODE\nvec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside_polygon.xy/EXTENT);float isPolygon=a_join_normal_inside_polygon.w;float sideAlignment=abs(isPolygon*u_alignment);p.xy+=(1.0-a_join_normal_inside_polygon.z)*mix(wall_offset*0.5,wall_offset*mix(1.0,0.0,max(u_alignment,0.0)),sideAlignment);p.xy-=a_join_normal_inside_polygon.z*mix(wall_offset*0.5,wall_offset*mix(0.0,1.0,max(u_alignment,0.0)),sideAlignment);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);
1\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif \n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'),groundShadow:Ct('#include "_prelude_shadow.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid main() {float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\n#ifdef INDICATOR_CUTOUT\nshadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0)).r);\n#endif\nglFragColor=vec4(shadow,1.0);}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);\n#endif\n}'),fillExtrusionGroundEffect:Ct("uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;\n#ifdef SDF_SUBPASS\nin highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}\n#ifdef FOG\nin highp float v_fog;\n#endif\n#endif\nvoid main() {\n#ifdef CLEAR_SUBPASS\nvec4 color=vec4(1.0);\n#ifdef CLEAR_FROM_TEXTURE\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\n#endif\nglFragColor=color;\n#else\n#ifdef SDF_SUBPASS\nhighp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;\n#ifdef FOG\nfog=v_fog;\n#endif\n#ifdef RENDER_CUTOFF\nfog*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));\n#else\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\n#ifdef OVERDRAW_INSPECTOR\ncolor=vec4(1.0);\n#endif\nglFragColor=color;\n#endif\nHANDLE_WIREFRAME_DEBUG;\n#endif\n}",'#include "_prelude_fog.vertex.glsl"\nin highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp vec2 u_ao;
1\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(1.0,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;\n#ifdef SDF_SUBPASS\nv_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);\n#ifdef FOG\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\n#endif\n#endif\nfloat hidden_by_landmark=0.0;\n#ifdef HAS_CENTROID\nhidden_by_landmark=a_hidden_by_landmark;\n#endif\nfloat isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'),hillshadePrepare:Ct("precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}","uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Ct('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
1\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}'),line:Ct('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;in vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nfloat linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture(u_dash_image,v_tex).r;
1float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trim_alpha=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=out_color.a;}\n#endif\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=(border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color.rgb=mix(border_color.rgb*border_color.a*trim_alpha,out_color.rgb,smoothAlpha);}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(alpha*opacity);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED)\nin float a_z_offset;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nin highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nin float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);\n#if defined(ELEVATED)\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 halfCellProgress=normal.yx*32.0;float ele0=elevation(pos);float ele_line=max(ele0,max(elevation(pos+halfCellProgress),elevation(pos-halfCellProgress)));float ele1=elevation(pos+offsetTile);float ele2=elevation(pos-offsetTile);float ele_max=max(ele_line,0.5*(ele1+ele2));float ele=ele_max-ele0+ele1+a_z_offset ;gl_Position=u_matrix*vec4(pos+offsetTile,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*0.1*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);\n#else\ngl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),linePattern:Ct('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform highp float u_device_pixel_ratio;
1uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec4 v_uv;\n#endif\n#ifdef LINE_JOIN_NONE\nin vec2 v_pattern_data;\n#endif\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;float x=mod(pattern_x,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {color=vec4(0,0,0,0);}}\n#endif\n#ifdef LINE_JOIN_NONE\nfloat pattern_len=pattern_size/aspect;float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}\n#endif\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting_ground(color);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define scale 0.015873016\nin vec2 a_pos_normal;in vec4 a_data;\n#if defined(ELEVATED)\nin float a_z_offset;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec4 a_packed;\n#endif\nin highp float a_linesofar;\n#ifdef LINE_JOIN_NONE\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\n#endif\nuniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nout highp vec4 v_uv;\n#endif\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define mediump float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float floorwidth\n#pragma mapbox: define mediump vec4 pattern\n#pragma mapbox: define mediump float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize mediump float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize mediump float pixel_ratio\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);\n#if defined(ELEVATED)\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 halfCellProgress=normal.yx*32.0;float ele0=elevation(pos);float ele_line=max(ele0,max(elevation(pos+halfCellProgress),elevation(pos-halfCellProgress)));float ele1=elevation(pos+offsetTile);float ele2=elevation(pos-offsetTile);float ele_max=max(ele_line,0.5*(ele1+ele2));float ele=ele_max-ele0+ele1+a_z_offset ;gl_Position=u_matrix*vec4(pos+offsetTile,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*0.1*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);\n#else\ngl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nfloat a_uv_x=a_packed[0];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef LINE_JOIN_NONE\nv_width=floorwidth+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),raster:Ct('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nin float v_split_fade;\n#endif\nuniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;\n#ifndef RASTER_ARRAY\nuniform sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#else\nvalue=mix(\nraTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;\n#else\ncolor=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);\n#endif\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\n#else\ncolor0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);\n#endif\ncolor.a*=u_opacity;\n#ifdef GLOBE_POLES\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\n#endif\nvec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef PROJECTION_GLOBE_VIEW\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));\n#endif\n#ifdef RENDER_CUTOFF\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
1\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;in vec2 a_texture_pos;\n#endif\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nout float v_split_fade;\n#endif\nvoid main() {vec2 uv;\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nfloat w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); \nv_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];
1if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\ngl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;\n#ifdef RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'),rasterParticle:Ct('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb;\n#endif\n#ifdef FOG\nhighp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\nin vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nuv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'),rasterParticleDraw:Ct("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",'#include "_prelude_raster_particle.glsl"\nin float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(\nmod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}'),rasterParticleTexture:Ct("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:Ct('#include "_prelude_raster_particle.glsl"\nuniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;
1vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(\nlinearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)\n);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}',"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbolIcon:Ct('#include "_prelude_lighting.glsl"\nuniform sampler2D u_texture;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\nin float v_fade_opacity;in vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nin vec2 v_tex_b;\n#endif\n#ifdef COLOR_ADJUSTMENT\nuniform mat4 u_color_adj_mat;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float emissive_strength\nlowp float alpha=opacity*v_fade_opacity;vec4 out_color;\n#ifdef ICON_TRANSITION\nvec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);\n#else\nout_color=texture(u_texture,v_tex_a);\n#endif\n#ifdef COLOR_ADJUSTMENT\nout_color=u_color_adj_mat*out_color;\n#endif\nout_color*=alpha;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef OCCLUSION_QUERIES\nin float a_occlusion_query_opacity;\n#endif\n#ifdef Z_OFFSET\nin float a_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin vec2 a_texb;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float emissive_strength\n#pragma mapbox: define lowp float occlusion_opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float emissive_strength\n#pragma mapbox: initialize lowp float occlusion_opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjected_point;vec2 a;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;\n#else\noffsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;\n#endif\nvec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=globe_occlusion_fade;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\n#endif\nv_tex_a=a_tex/u_texsize;\n#ifdef ICON_TRANSITION\nv_tex_b=a_texb/u_texsize;\n#endif\nv_fade_opacity=out_fade_opacity;\n#ifdef DEPTH_OCCLUSION\nfloat depthOcclusion=occlusionFadeMultiSample(projected_point);float depthOcclusionMultplier=mix(occlusion_opacity,1.0,depthOcclusion);v_fade_opacity*=depthOcclusionMultplier;\n#endif\n#ifdef OCCLUSION_QUERIES\nfloat occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);v_fade_opacity*=occludedFadeMultiplier;\n#endif\n}'),symbolSDF:Ct('#include "_prelude_lighting.glsl"\n#define SDF_PX 8.0\nuniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;in float v_draw_halo;in vec2 v_data0;in vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
1\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef OCCLUSION_QUERIES\nin float a_occlusion_query_opacity;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout float v_draw_halo;out vec2 v_data0;out vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\n#pragma mapbox: define lowp float occlusion_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\n#pragma mapbox: initialize lowp float occlusion_opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;\n#endif\nvec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=globe_occlusion_fade;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;\n#ifdef DEPTH_OCCLUSION\nfloat depthOcclusion=occlusionFadeMultiSample(projected_point);float depthOcclusionMultplier=mix(occlusion_opacity,1.0,depthOcclusion);out_fade_opacity*=depthOcclusionMultplier;\n#endif\n#ifdef OCCLUSION_QUERIES\nfloat occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;\n#endif\nfloat alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\n#endif\nfloat gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,out_fade_opacity);}'),symbolTextAndIcon:Ct('#include "_prelude_lighting.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_halo;in float v_draw_halo;in vec4 v_data0;in vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;
1glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\nin vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_projected_pos;in float a_fade_opacity;\n#ifdef OCCLUSION_QUERIES\nin float a_occlusion_query_opacity;\n#endif\n#ifdef Z_OFFSET\nin float a_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin vec3 a_globe_anchor;in vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nout float v_draw_halo;out vec4 v_data0;out vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\n#pragma mapbox: define lowp float occlusion_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\n#pragma mapbox: initialize lowp float occlusion_opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=elevation(tile_anchor);\n#ifdef Z_OFFSET\ne+=a_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nfloat out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;\n#ifdef DEPTH_OCCLUSION\nfloat depthOcclusion=occlusionFadeMultiSample(projected_point);float depthOcclusionMultplier=mix(occlusion_opacity,1.0,depthOcclusion);out_fade_opacity*=depthOcclusionMultplier;\n#endif\n#ifdef OCCLUSION_QUERIES\nfloat occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;\n#endif\nfloat alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+ xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);\n#endif\nfloat gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,out_fade_opacity,is_sdf);}'),terrainRaster:Ct('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;in vec2 v_pos0;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#endif\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\n#ifdef LIGHTING_3D_MODE\nconst vec3 normal=vec3(0.0,0.0,1.0);\n#ifdef RENDER_SHADOWS\nfloat cutoffOpacity=1.0;\n#ifdef RENDER_CUTOFF\ncutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);\n#endif\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nvec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;\n#else\nfloat lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
1\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth;\n#endif\nvoid main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);\n#endif\n}'),terrainDepth:Ct("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",'#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}'),skybox:Ct('#include "_prelude_fog.fragment.glsl"\nin lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
1nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',pt),skyboxGradient:Ct('#include "_prelude_fog.fragment.glsl"\nin highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',pt),skyboxCapture:Ct
vendor: 3,689 bytes, line 1
1("\nin highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}","in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;
1v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:Ct('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nvec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nraster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(raster.rgb*antialias,antialias);\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\ncolor=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin vec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}'),globeAtmosphere:Ct('#include "_prelude_fog.fragment.glsl"\nuniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\n#ifdef NATIVE\nglFragColor=vec4(1,1,1,1);\n#else\nglFragColor=vec4(0,0,0,1);\n#endif\nreturn;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;
1vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);\n#else\nvec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;\n#ifndef NATIVE\nc=dither(c,gl_FragCoord.xy+u_temporal_offset);\n#endif\nglFragColor=vec4(c*t,t);\n#endif\n}',"in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}"),model:Ct('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_pbr\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nin highp float v_depth;uniform highp sampler2D u_depthTexture;uniform vec2 u_inv_depth_size;uniform vec2 u_depth_range_unpack;\n#ifdef DEPTH_D24\nfloat unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}\n#else\nhighp float unpack_depth_rgba(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}\n#endif\nbool isOccluded() {vec2 coord=gl_FragCoord.xy*u_inv_depth_size;\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depthTexture,coord).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));\n#endif\nreturn v_depth > depth+0.0005;}\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
1Color),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\nif(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;\n#endif\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\n#endif\nvec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\nreturn color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\n#ifdef HAS_TEXTURE_u_normalTexture\nhighp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;\n#else\nreturn mat3(1.0);\n#endif\n}highp vec3 getNormal(){highp vec3 n;\n#ifdef HAS_ATTRIBUTE_a_normal_3f\nn=normalize(normal_3f);\n#else\nhighp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0;\n#endif\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);\n#endif\nreturn n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;\n#ifdef HAS_ATTRIBUTE_a_pbr\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) \nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)\n{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)\n{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)\n{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)\n{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
1Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);\n#endif\ncolor*=intensityFactor;return color;}void main() {\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nif (isOccluded()) {discard;}\n#endif\nvec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nfloat emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_pbr\nfloat resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;\n#ifdef APPLY_LUT_ON_GPU\ncolor_mix=applyLUT(u_lutTexture,color_mix);\n#endif\ncolor=mix(color,color_mix,min(1.0,resEmission));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
1y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nfinalColor=applyCutout(finalColor);\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nout highp float v_depth;\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp vec4 pbr\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;\n#else\nlocal_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_pbr\nvec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nfloat x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);
1\n#else\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;\n#endif\n}'),modelDepth:Ct("in highp float v_depth;void main() {\n#ifndef DEPTH_TEXTURE\nglFragColor=pack_depth(v_depth);\n#endif\n}","in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
1rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\nv_depth=gl_Position.z/gl_Position.w;}"),stars:Ct("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\n{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}","\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}"),occlusion:Ct("uniform vec4 u_color;void main() {glFragColor=u_color;}",'#include "_prelude_terrain.vertex.glsl"\nin highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;\n#ifdef TERRAIN\nfloat e=elevation(world_pos.xy);world_pos.z+=e;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}')};function St(e,t){const i=e.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n");for(let e of i)if(e=e.trim(),"#"===e[0]&&e.includes("if")&&!e.includes("endif")){e=e.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const i=e.split(" ");for(const e of i)t.includes(e)||t.push(e)}}function Ct(e,t){const i=/#include\s+"([^"]+)"/g,r=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let n=t.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);n&&(n=n.map((e=>{const t=e.split(" ");return t[t.length-1]})),n=[...new Set(n)]);const o={},s=[],a=[];if(e=e.replace(i,((e,t)=>(a.push(t),""))),(t=t.replace(i,((e,t)=>(s.push(t),"")))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let l=[...xt];St(e,l),St(t,l);for(const e of[...s,...a])bt[e]||console.error(`Undefined include: ${e}`),wt[e]||(wt[e]=[],St(bt[e],wt[e])),l=[...l,...wt[e]];return{fragmentSource:e=e.replace(r,((e,t,i,r,n)=>(o[n]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"initialize"===t?`\n#ifdef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = u_${n};\n#endif\n`:"define-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\n in ${i} ${r} ${n};\n#endif\n`:"initialize-attribute"===t?"":void 0))),vertexSource:t=t.replace(r,((e,t,i,r,n)=>{const s="float"===r?"vec2":r,a=n.match(/color/)?"color":s;return"define-attribute-vertex-shader-only"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\nin ${i} ${r} a_${n};\n#endif\n`:o[n]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${s} a_${n};\nout ${i} ${r} ${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"initialize"===t?"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:"define-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\n in ${i} ${r} a_${n};\n out ${i} ${r} ${n};\n#endif\n`:"initialize-attribute"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\n ${n} = a_${n};\n#endif\n`:void 0:"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nin ${i} ${s} a_${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"define-instanced"===t?"mat4"===a?`\n#ifdef INSTANCED_ARRAYS\nin vec4 a_${n}0;\nin vec4 a_${n}1;\nin vec4 a_${n}2;\nin vec4 a_${n}3;\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:`\n#ifdef INSTANCED_ARRAYS\nin ${i} ${s} a_${n};\n#else\nuniform ${i} ${r} u_${n};\n#endif\n`:"initialize-attribute-custom"===t?`\n#ifdef HAS_ATTRIBUTE_a_${n}\n ${i} ${r} ${n} = a_${n};\n#endif\n`:"vec4"===a?`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = a_${n};\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${i} ${r} ${n} = unpack_mix_${a}(a_${n}, u_${n}_t);\n#else\n ${i} ${r} ${n} = u_${n};\n#endif\n`})),staticAttributes:n,usedDefines:l,vertexIncludes:s,fragmentIncludes:a}}class At{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(e,t,i,r,n,o,s,a){this.context=e;let l=this.boundPaintVertexBuffers.length!==r.length;for(let e=0;!l&&e<r.length;e++)this.boundPaintVertexBuffers[e]!==r[e]&&(l=!0);let c=this.boundDynamicVertexBuffers.length!==s.length;for(let e=0;!c&&e<s.length;e++)this.boundDynamicVertexBuffers[e]!==s[e]&&(c=!0);if(!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||l||c||this.boundIndexBuffer!==n||this.boundVertexOffset!==o)this.freshBind(t,i,r,n,o,s,a);else{e.bindVertexArrayOES.set(this.vao);for(const i of s)i&&(i.bind(),a&&i.instanceCount&&i.setVertexAttribDivisor(e.gl,t,a));n&&n.dynamicDraw&&n.bind()}}freshBind(e,t,i,r,n,o,s){const a=e.numAttributes,l=this.context,c=l.gl;this.vao&&this.destroy(),this.vao=l.gl.createVertexArray(),l.bindVertexArrayOES.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffers=o,t.enableAttributes(c,e),t.bind(),t.setVertexAttribPointers(c,e,n);for(const t of i)t.enableAttributes(c,e),t.bind(),t.setVertexAttribPointers(c,e,n);for(const t of o)t&&(t.enableAttributes(c,e),t.bind(),t.setVertexAttribPointers(c,e,n),s&&t.instanceCount&&t.setVertexAttribDivisor(c,e,s));r&&r.bind(),l.currentNumAttributes=a}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function It(t,i){const r=Math.pow(2,i.canonical.z),n=i.canonical.y;return[new e._(0,n/r).toLngLat().lat,new e._(0,(n+1)/r).toLngLat().lat]}function kt(t,i,r,n,o,s,a){const l=t.context,c=l.gl,u=r.hillshadeFBO;if(!u)return;t.prepareDrawTile();const h=t.isTileAffectedByFog(i),p=t.getOrCreateProgram("hillshade",{overrideFog:h});l.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,u.colorAttachment.get());const d=((t,i,r,n)=>{const o=r.paint.get("hillshade-shadow-color"),s=r.paint.get("hillshade-highlight-color"),a=r.paint.get("hillshade-accent-color"),l=r.paint.get("hillshade-emissive-strength");let c=e.ac(r.paint.get("hillshade-illumination-direction"));if("viewport"===r.paint.get("hillshade-illumination-anchor"))c-=t.transform.angle;else if(t.style&&t.style.enable3dLights()&&t.style.directionalLight){const i=t.style.directionalLight.properties.get("direction"),r=e.ad(i.x,i.y,i.z);c=e.ac(r[1])}const u=!t.options.moving;return{u_matrix:n||t.transform.calculateProjMatrix(i.tileID.toUnwrapped(),u),u_image:0,u_latrange:It(0,i.tileID),u_light:[r.paint.get("hillshade-exaggeration"),c],u_shadow:o.toRenderColor(r.lut),u_highlight:s.toRenderColor(r.lut),u_emissive_strength:l,u_accent:a.toRenderColor(r.lut)}})(t,r,n,t.terrain?i.projMatrix:null);t.uploadCommonUniforms(l,p,i.toUnwrapped());const{tileBoundsBuffer:f,tileBoundsIndexBuffer:m,tileBoundsSegments:_}=t.getTileBoundsBuffers(r);p.draw(t,c.TRIANGLES,o,s,a,e.ag.disabled,d,n.id,f,m,_)}function Lt(t,i,r){if(!i.needsDEMTextureUpload)return;const n=t.context,o=n.gl;n.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(r.stride);const s=r.getPixels();i.demTexture?i.demTexture.update(s,{premultiply:!1}):i.demTexture=new e.T(n,s,o.R32F,{premultiply:!1}),i.needsDEMTextureUpload=!1}function Pt(t,i,r){const n=t.context,o=n.gl;if(!i.dem)return;const s=i.dem;if(n.activeTexture.set(o.TEXTURE1),Lt(t,i,s),!i.demTexture)return;i.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE);const a=s.dim;n.activeTexture.set(o.TEXTURE0);let l=i.hillshadeFBO;if(!l){const t=new e.T(n,{width:a,height:a,data:null},o.RGBA);t.bind(o.LINEAR,o.CLAMP_TO_EDGE),l=i.hillshadeFBO=n.createFramebuffer(a,a,!0,"renderbuffer"),l.colorAttachment.set(t.texture)}n.bindFramebuffer.set(l.framebuffer),n.viewport.set([0,0,a,a]);const{tileBoundsBuffer:c,tileBoundsIndexBuffer:u,tileBoundsSegments:h}=t.getMercatorTileBoundsBuffers(),p=[];t.linearFloatFilteringSupported()&&p.push("TERRAIN_DEM_FLOAT_FORMAT"),t.getOrCreateProgram("hillshadePrepare",{defines:p}).draw(t,o.TRIANGLES,e.af.disabled,e.ah.disabled,e.a.unblended,e.ag.disabled,((t,i)=>{const r=i.stride,n=e.ae.create();return e.ae.ortho(n,0,e.a4,-e.a4,0,0,1),e.ae.translate(n,n,[0,-e.a4,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:t.overscaledZ}})(i.tileID,s),r.id,c,u,h),i.needsHillshadePrepare=!1}function Rt(t,i,r,n,o){const s=function(r,n){if(r)return o(r);if(n){if(t.url&&n.tiles&&t.tiles&&delete t.tiles,n.variants){if(!Array.isArray(n.variants)
1)return o(new Error("variants must be an array"));for(const t of n.variants){if(null==t||"object"!=typeof t||t.constructor!==Object)return o(new Error("variant must be an object"));if(!Array.isArray(t.capabilities))return o(new Error("capabilities must be an array"));if(1===t.capabilities.length&&"meshopt"===t.capabilities[0]){n=e.Q(n,t);break}}}const r=e.ai(e.Q(n,t),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);n.vector_layers&&(r.vectorLayers=n.vector_layers,r.vectorLayerIds=r.vectorLayers.map((e=>e.id))),n.raster_layers&&(r.rasterLayers=n.raster_layers,r.rasterLayerIds=r.rasterLayers.map((e=>e.id))),r.tiles=i.canonicalizeTileset(r,t.url),o(null,r)}},a=function(e,t,i){if(!e)return null;if(!t&&!i)return e;i=i||e.worldview_default;const r=Object.values(e.language||{});if(0===r.length)return null;const n=Object.values(e.worldview||{});if(0===n.length)return null;const o=r.every((e=>e===t)),s=n.every((e=>e===i));return o&&s?e:t in(e.language_options||{})||i in(e.worldview_options||{})?null:e.language_options&&e.worldview_options?e:null}(t.data,r,n);return a?e.e.frame((()=>s(null,a))):t.url?e.h(i.transformRequest(i.normalizeSourceURL(t.url,null,r,n),e.R.Source),s):e.e.frame((()=>{const{data:e,...i}=t;s(null,i)}))}class zt{constructor(t,i,r){this.bounds=e.aj.convert(this.validateBounds(t)),this.minzoom=i||0,this.maxzoom=r||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(t){const i=Math.pow(2,t.z),r=Math.floor(e.ak(this.bounds.getWest())*i),n=Math.floor(e.al(this.bounds.getNorth())*i),o=Math.ceil(e.ak(this.bounds.getEast())*i),s=Math.ceil(e.al(this.bounds.getSouth())*i);return t.x>=r&&t.x<o&&t.y>=n&&t.y<s}}class Ot extends e.E{constructor(t,i,r,n){super(),this.id=t,this.dispatcher=r,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=e.Q({type:"raster"},i),e.Q(this,e.ai(i,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new e.g("dataloading",{dataType:"source"})),this._tileJSONRequest=Rt(this._options,this.map._requestManager,null,null,((i,r)=>{this._tileJSONRequest=null,this._loaded=!0,i?this.fire(new e.f(i)):r&&(e.Q(this,r),r.bounds&&(this.tileBounds=new zt(r.bounds,this.minzoom,this.maxzoom)),e.ao(r.tiles),this.fire(new e.g("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.g("data",{dataType:"source",sourceDataType:"content"}))),t&&t(i)}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const t=e.am(this.id,this.scope);this.load((()=>this.map.style.clearSource(t)))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return e.Q({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(t,i){const r=e.e.devicePixelRatio>=2,n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),r,this.tileSize);t.request=e.i(this.map._requestManager.transformRequest(n,e.R.Tile),((r,n,o,s)=>(delete t.request,t.aborted?(t.state="unloaded",i(null)):r?(t.state="errored",i(r)):n?(this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:o,expires:s}),t.setTexture(n,this.map.painter),t.state="loaded",e.an(this.dispatcher),void i(null)):i(null))))}abortTile(e,t){e.request&&(e.request.cancel(),delete e.request),t&&t()}unloadTile(t,i){t.texture&&t.texture instanceof e.T?(t.destroy(!0),t.texture&&t.texture instanceof e.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),i&&i()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Dt extends e.E{constructor(t,i,r,n){if(super(),this.id=t,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,e.Q(this,e.ai(i,["url","scheme","tileSize","promoteId"])),this._options=e.Q({type:"vector"},i),this._collectResourceTiming=!!i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n),this._tileWorkers={},this._deduped=new e.ap}load(t){this._loaded=!1,this.fire(new e.g("dataloading",{dataType:"source"}));const i=Array.isArray(this.map._language)?this.map._language.join():this.map._language,r=this.map._worldview;this._tileJSONRequest=Rt(this._options,this.map._requestManager,i,r,((n,o)=>{this._tileJSONRequest=null,this._loaded=!0,n?(i&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`),r&&2!==r.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${r}`),this.fire(new e.f(n))):o&&(e.Q(this,o),o.bounds&&(this.tileBounds=new zt(o.bounds,this.minzoom,this.maxzoom)),e.ao(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.g("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.g("data",{dataType:"source",sourceDataType:"content"}))),t&&t(n)}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}reload(){this.cancelTileJSONRequest();const t=e.am(this.id,this.scope);this.load((()=>this.map.style.clearSource(t)))}setTiles(e){return this._options.tiles=e,this.reload(),this}setUrl(e){return this.url=e,this._options.url=e,this.reload(),this}onRemove(e){this.cancelTileJSONRequest()}serialize(){return e.Q({},this._options)}loadTile(t,i){const r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme)),n=this.map._requestManager.transformRequest(r,e.R.Tile),o=this.map.style?this.map.style.getLut(this.scope):null,s={request:n,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,lut:o?{image:o.image.clone()}:null,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
vendor: 1,375 bytes, line 1
1ype,source:this.id,scope:this.scope,pixelRatio:e.e.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep};if(s.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state)"loading"===t.state?t.reloadCallback=i:t.request=t.actor.send("reloadTile",s,a.bind(this));else if(t.actor=this._tileWorkers[r]=this._tileWorkers[r]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",s,a.bind(this),void 0,!0);else{const i=e.aq.call({deduped:this._deduped},s,((e,i)=>{e||!i?a.call(this,e):(s.data={cacheControl:i.cacheControl,expires:i.expires,rawData:i.rawData.slice(0)},t.actor&&t.actor.send("loadTile",s,a.bind(this),void 0,!0))}),!0);t.request={cancel:i}}function a(r,n){return delete t.request,t.aborted?i(null):r&&404!==r.status?i(r):(n&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&t.setExpiryData(n),t.loadVectorData(n,this.map.painter),e.an(this.dispatcher),i(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.t
1ype,source:this.id,scope:this.scope})}unloadTile(e,t){e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id,scope:this.scope}),e.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}const Ft=(e,t,i)=>({u_matrix:e,u_image0:0,u_skirt_height:t,u_ground_shadow_factor:i}),Bt=(e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m)=>({u_proj_matrix:Float32Array.from(e),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(r),u_merc_matrix:i,u_zoom_transition:n,u_merc_center:o,u_image0:0,u_frustum_tl:s,u_frustum_tr:a,u_frustum_br:l,u_frustum_bl:c,u_globe_pos:u,u_globe_radius:h,u_viewport:p,u_grid_matrix:m?Float32Array.from(m):new Float32Array(9),u_skirt_height:d,u_far_z_cutoff:f});class Nt{constructor(e=0,t=0,i=0,r=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=i,this.right=r}interpolate(t,i,r){return null!=i.top&&null!=t.top&&(this.top=e.a3(t.top,i.top,r)),null!=i.bottom&&null!=t.bottom&&(this.bottom=e.a3(t.bottom,i.bottom,r)),null!=i.left&&null!=t.left&&(this.left=e.a3(t.left,i.left,r)),null!=i.right&&null!=t.right&&(this.right=e.a3(t.right,i.right,r)),this}getCenter(t,i){const r=e.au((this.left+t-this.right)/2,0,t),n=e.au((this.top+i-this.bottom)/2,0,i);return new e.P(r,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Nt(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function jt(t,i){const r=e.ax(t,3);e.ae.fromQuat(t,i),e.aA(t,3,r)}function Ut(t,i){const r=e.aw.identity([]);return e.aw.rotateZ(r,r,-i),e.aw.rotateX(r,r,-t),r}function Vt(t,i){const r=[t[0],t[1],0],n=[i[0],i[1],0];if(e.$.length(r)>=1e-15){const t=e.$.normalize([],r);e.$.scale(n,t,e.$.dot(n,t)),i[0]=n[0],i[1]=n[1]}const o=e.$.cross([],i,t);if(e.$.len(o)<1e-15)return null;const s=Math.atan2(-o[1],o[0]);return Ut(Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2]),s)}class $t{constructor(e,t){this.position=e,this.orientation=t}get position(){return this._position}set position(t){if(t){const i=t instanceof e._?t:new e._(t[0],t[1],t[2]);
1this._renderWorldCopies&&(i.x=e.av(i.x,0,1)),this._position=i}else this._position=null}lookAtPoint(t,i){if(this.orientation=null,!this.position)return;const r=this.position,n=this._elevation?this._elevation.getAtPointOrZero(e._.fromLngLat(t)):0,o=e._.fromLngLat(t,n),s=[o.x-r.x,o.y-r.y,o.z-r.z];i||(i=[0,0,1]),i[2]=Math.abs(i[2]),this.orientation=Vt(s,i)}setPitchBearing(t,i){this.orientation=Ut(e.ac(t),e.ac(-i))}}class Gt{constructor(t,i){this._transform=e.ae.identity([]),this.orientation=i,this.position=t}get mercatorPosition(){const t=this.position;return new e._(t[0],t[1],t[2])}get position(){const t=e.ax(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var i;t&&e.aA(this._transform,3,[(i=t)[0],i[1],i[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||e.aw.identity([]),t&&jt(this._transform,this._orientation)}getPitchBearing(){const e=this.forward(),t=this.right();return{bearing:Math.atan2(-t[1],t[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}setPitchBearing(e,t){this._orientation=Ut(e,t),jt(this._transform,this._orientation)}forward(){const t=e.ax(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=e.ax(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=e.ax(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,i){const r=new Float64Array(16);return e.ae.invert(r,this.getWorldToCamera(t,i)),r}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,i,r){const n=this.position;e.$.scale(n,n,-t);const o=new Float64Array(16);return e.ae.fromScaling(o,[r,r,r]),e.ae.translate(o,o,n),o[10]*=i,o}getWorldToCamera(t,i){const r=new Float64Array(16),n=new Float64Array(4),o=this.position;return e.aw.conjugate(n,this._orientation),e.$.scale(o,o,-t),e.ae.fromQuat(r,n),e.ae.translate(r,r,o),r[1]*=-1,r[5]*=-1,r[9]*=-1,r[13]*=-1,r[8]*=i,r[9]*=i,r[10]*=i,r[11]*=i,r}getCameraToClipPerspective(t,i,r,n){const o=new Float64Array(16);return e.ae.perspective(o,t,i,r,n),o}getCameraToClipOrthographic(t,i,r,n,o,s){const a=new Float64Array(16);return e.ae.ortho(a,t,i,r,n,o,s),a}getDistanceToElevation(t,i=!1){const r=0===t?0:e.ay(t,i?e.az(this.position[1]):this.position[1]),n=this.forward();return(r-this.position[2])/n[2]}clone(){return new Gt([...this.position],[...this.orientation])}}const qt={unknown:0,flipRequired:1,flipNotRequired:2},Ht=Math.tan(85*Math.PI/180);function Zt(t,i,r,n,o,s,a){const l=e.ae.create();if(r)if("globe"===s.name){const t=e.aC(o,i);e.ae.multiply(l,l,t)}else{const t=e.aD.invert([],a);l[0]=t[0],l[1]=t[1],l[4]=t[2],l[5]=t[3],n||e.ae.rotateZ(l,l,o.angle)}else e.ae.multiply(l,o.labelPlaneMatrix,t);return l}function Wt(e,t,i,r,n,o,s){const a=Zt(e,t,i,r,n,o,s);return"globe"===o.name&&i||(a[2]=a[6]=a[10]=a[14]=0),a}function Xt(t,i,r,n,o,s,a){if(r){if("globe"===s.name){const l=Zt(t,i,r,n,o,s,a);return e.ae.invert(l,l),e.ae.multiply(l,t,l),l}{const i=e.ae.clone(t),r=e.ae.identity([]);return r[0]=a[0],r[1]=a[1],r[4]=a[2],r[5]=a[3],e.ae.multiply(i,i,r),n||e.ae.rotateZ(i,i,-o.angle),i}}return o.glCoordMatrix}function Qt(t,i,r,n){const o=[t,i,r,1];r?e.aB.transformMat4(o,o,n):ai(o,o,n);const s=o[3];return o[0]/=s,o[1]/=s,o[2]/=s,o}function Yt(e,t){return Math.min(.5+e/t*.5,1.5)}function Jt(e,t){const i=e[0]/e[3],r=e[1]/e[3];return i>=-t[0]&&i<=t[0]&&r>=-t[1]&&r<=t[1]}function Kt(t,i,r,n,o,s,a,l,c,u){const h=r.transform,p=n?t.textSizeData:t.iconSizeData,d=e.aE(p,r.transform.zoom),f="globe"===h.projection.name,m=[256/r.width*2+1,256/r.height*2+1],_=n?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;_.clear();let g=null;f&&(g=n?t.text.globeExtVertexArray:t.icon.globeExtVertexArray);const y=t.lineVertexArray,v=n?t.text.placedSymbolArray:t.icon.placedSymbolArray,x=r.transform.width/r.transform.height;let b,w=!1;for(let n=0;n<v.length;n++){const f=v.get(n),{numGlyphs:T,writingMode:M}=f;if(M!==e.aF.vertical||w||b===e.aF.horizontal||(w=!0),b=M,(f.hidden||M===e.aF.vertical)&&!w){si(T,_);continue}w=!1;const E=new e.P(f.tileAnchorX,f.tileAnchorY);let{x:S,y:C,z:A}=h.projection.projectTilePoint(E.x,E.y,u.canonical);if(c){const[e,t,i]=c(E);S+=e,C+=t,A+=i}const I=[S,C,A,1];if(e.aB.transformMat4(I,I,i),!Jt(I,m)){si(T,_);continue}const k=I[3],L=Yt(r.transform.getCameraToCenterDistance(h.projection),k),P=e.aG(p,d,f),R=a?P/L:P*L,z=Qt(S,C,A,o);if(z[3]<=0){si(T,_);continue}let O={};const D=a?null:c,F=ii(f,R,!1,l,i,o,s,t.glyphOffsetArray,y,_,g,z,E,O,x,D,h.projection,u,a);w=F.useVertical,D&&F.needsFlipping&&(O={}),(F.notEnoughRoom||w||F.needsFlipping&&ii(f,R,!0,l,i,o,s,t.glyphOffsetArray,y,_,g,z,E,O,x,D,h.projection,u,a).notEnoughRoom)&&si(T,_)}n?(t.text.dynamicLayoutVertexBuffer.updateData(_),g&&t.text.globeExtVertexBuffer&&t.text.globeExtVertexBuffer.updateData(g)):(t.icon.dynamicLayoutVertexBuffer.updateData(_),g&&t.icon.globeExtVertexBuffer&&t.icon.globeExtVertexBuffer.updateData(g))}function ei(e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m){const{lineStartIndex:_,glyphStartIndex:g,segment:y}=a,v=g+a.numGlyphs,x=_+a.lineLength,b=t.getoffsetX(g),w=t.getoffsetX(v-1),T=oi(e*b,i,r,n,o,s,y,_,x,l,c,u,h,p,!0,d,f,m);if(!T)return null;const M=oi(e*w,i,r,n,o,s,y,_,x,l,c,u,h,p,!0,d,f,m);return M?{first:T,last:M}:null}function ti(t,i,r,n){return t===e.aF.horizontal&&Math.abs(n)>Math.abs(r)?{useVertical:!0}:t===e.aF.vertical?n>0?{needsFlipping:!0}:null:i!==qt.unknown&&function(e,t){return 0===e||Math.abs(t/e)>Ht}(r,n)?i===qt.flipRequired?{needsFlipping:!0}:null:r<0?{needsFlipping:!0}:null}function ii(t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_,g,y,v){const x=i/24,b=t.lineOffsetX*x,w=t.lineOffsetY*x,{lineStartIndex:T,glyphStartIndex:M,numGlyphs:E,segment:S,writingMode:C,flipState:A}=t,I=T+t.lineLength,k=t=>{if(h){const[i,r,n]=t.up,o=u.length;
1e.aH(h,o+0,i,r,n),e.aH(h,o+1,i,r,n),e.aH(h,o+2,i,r,n),e.aH(h,o+3,i,r,n)}const[i,r,n]=t.point;e.aI(u,i,r,n,t.angle)};if(E>1){const e=ei(x,l,b,w,r,p,d,t,c,s,f,_,!1,g,y,v);if(!e)return{notEnoughRoom:!0};if(n&&!r){let[i,r,n]=e.first.point,[o,s,l]=e.last.point;[i,r]=Qt(i,r,n,a),[o,s]=Qt(o,s,l,a);const c=ti(C,A,(o-i)*m,s-r);if(t.flipState=c&&c.needsFlipping?qt.flipRequired:qt.flipNotRequired,c)return c}k(e.first);for(let e=M+1;e<M+E-1;e++){const t=oi(x*l.getoffsetX(e),b,w,r,p,d,S,T,I,c,s,f,_,!1,!1,g,y,v);if(!t)return u.length-=4*(e-M),{notEnoughRoom:!0};k(t)}k(e.last)}else{if(n&&!r){const i=Qt(d.x,d.y,0,o),r=T+S+1,n=new e.P(c.getx(r),c.gety(r)),s=Qt(n.x,n.y,0,o),a=s[3]>0?s:ni(d,n,i,1,o,void 0,g,y.canonical),l=ti(C,A,(a[0]-i[0])*m,a[1]-i[1]);if(t.flipState=l&&l.needsFlipping?qt.flipRequired:qt.flipNotRequired,l)return l}const i=oi(x*l.getoffsetX(M),b,w,r,p,d,S,T,I,c,s,f,_,!1,!1,g,y,v);if(!i)return{notEnoughRoom:!0};k(i)}return{}}function ri(e,t,i,r,n){const{x:o,y:s,z:a}=r.projectTilePoint(e.x,e.y,t);if(!n)return Qt(o,s,a,i);const[l,c,u]=n(e);return Qt(o+l,s+c,a+u,i)}function ni(t,i,r,n,o,s,a,l){const c=ri(t.sub(i)._unit()._add(t),l,o,a,s);return e.$.sub(c,r,c),e.$.normalize(c,c),e.$.scaleAndAdd(c,r,c,n)}function oi(t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_,g,y){const v=n?t-i:t+i;let x=v>0?1:-1,b=0;n&&(x*=-1,b=Math.PI),x<0&&(b+=Math.PI);let w=l+a+(x>0?0:1)|0,T=o,M=o,E=0,S=0;const C=Math.abs(v),A=[],I=[];let k=s,L=k;const P=()=>ni(L,k,M,C-E+1,h,d,_,g.canonical);for(;E+S<=C;){if(w+=x,w<l||w>=c)return null;if(M=T,L=k,A.push(M),f&&I.push(L),k=new e.P(u.getx(w),u.gety(w)),T=p[w],!T){const e=ri(k,g.canonical,h,_,d);T=e[3]>0?p[w]=e:P()}E+=S,S=e.$.distance(M,T)}m&&d&&(p[w]&&(T=P(),S=e.$.distance(M,T)),p[w]=T);const R=(C-E)/S,z=k.sub(L)._mult(R)._add(L),O=e.$.sub([],T,M),D=e.$.scaleAndAdd([],M,O,R);let F=[0,0,1],B=O[0],N=O[1];if(y&&(F=_.upVector(g.canonical,z.x,z.y),0!==F[0]||0!==F[1]||1!==F[2])){const t=[F[2],0,-F[0]],i=e.$.cross([],F,t);e.$.normalize(t,t),e.$.normalize(i,i),B=e.$.dot(O,t),N=e.$.dot(O,i)}if(r){const t=e.$.cross([],F,O);e.$.normalize(t,t),e.$.scaleAndAdd(D,D,t,r*x)}const j=b+Math.atan2(N,B);return A.push(D),f&&I.push(z),{point:D,angle:j,path:A,tilePath:I,up:F}}function si(e,t){const i=t.length,r=i+4*e;t.resize(r),t.float32.fill(-1/0,4*i,4*r)}function ai(e,t,i){const r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e[3]=i[3]*r+i[7]*n+i[15],e}const li=(e,t,i)=>(1-i)*e+i*t,ci=e=>e*e*e*e*e;class ui{constructor(t,i,r,n,o,s,a){this.tileSize=512,this._renderWorldCopies=void 0===o||o,this._minZoom=t||0,this._maxZoom=i||22,this._minPitch=r??0,this._maxPitch=n??60,this.setProjection(s),this.setMaxBounds(a),this.width=0,this.height=0,this._center=new e.aJ(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Nt,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Gt,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1}clone(){const e=new ui(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForE
1xaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._averageElevation=this._averageElevation,e._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e}get isOrthographic(){return"globe"!==this.projection.name&&this._orthographicProjectionAtLowPitch&&this.pitch<15}get elevation(){return this._elevation}set elevation(e){this._elevation!==e&&(this._elevation=e,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return"globe"!==this.projection.name&&!this.isOrthographic}updateElevation(e,t=!1){const i=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
vendor: 3,944 bytes, line 1
1xaggeration;(null==this._seaLevelZoom||i)&&this._updateCameraOnTerrain(),(e||i)&&this._constrainCamera(t),this._calcMatrices()}getProjection(){return e.ai(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const i=this.projection?this.getProjection():void 0;this.projection=e.aK(this.projectionOptions);const r=this.getProjection(),n=!e.d(i,r);return n&&this._calcMatrices(),this.mercatorFromTransition=!1,n}setOrthographicProjectionAtLowPitch(e){return this._orthographicProjectionAtLowPitch!==e&&(this._orthographicProjectionAtLowPitch=e,this._calcMatrices(),!0)}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=e.aK({name:"mercator"});const i=t!==this.projection.name;return i&&this._calcMatrices(),i}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const e=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get cameraWorldSize(){const e=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return e.ay(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.P(this.width,this.height)}get bearing(){return e.av(this.rotation,-180,180)}set bearing(e){this.rotation=e}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const i=-t*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=e.aD.create(),e.aD.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const i=e.au(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){const e=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/e)}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=e.ac(t),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(e){this._averageElevation=e,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(e){const t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._setZoom(t),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(e){this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(e){this._tileCoverLift!==e&&(this._tileCoverLift=e)}_updateCameraOnTerrain(){const e=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,t=this.elevation&&e===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
vendor: 4,580 bytes, line 1
10&&this._centerAltitudeValidForExaggeration;if(!this._elevation||e===Number.NEGATIVE_INFINITY&&(!t||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const i=this._elevation;t||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&i.exaggeration()&&this._centerAltitudeValidForExaggeration!==i.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*i.exaggeration(),this._centerAltitudeValidForExaggeration=i.exaggeration()):(this._centerAltitude=e||0,this._centerAltitudeValidForExaggeration=i.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,i=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],r=this.horizonLineFromTop();let n=0,o=0;for(let s=0;s<i.length;s++){const a=new e.P(i[s][0]*this.width,r+i[s][1]*(this.height-r)),l=t.pointCoordinate(a);if(!l)continue;const c=1/Math.hypot(l[0]-this._camera.position[0],l[1]-this._camera.position[1]);n+=l[3]*c,o+=c}return 0===o?NaN:n/o}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._terrainEnabled()&&("ground"===this.cameraElevationReference?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(null==this._seaLevelZoom||!this._elevation)return;const e=this._seaLevelZoom,t=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),i=this.pixelsPerMeter/this.worldSize*t,r=this._mercatorZfromZoom(e),n=this._mercatorZfromZoom(this._maxZoom),o=Math.max(r-i,n);this._setZoom(this._zoomFromMercatorZ(o))}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}computeZoomRelativeTo(t){const i=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let r;r=t.z<this._camera.position[2]?[i.x,i.y,i.z]:[t.x,t.y,t.z];const n=e.$.length(e.$.sub([],this._camera.position,r));return e.au(this._zoomFromMercatorZ(n),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height)return;if(!t.position&&!t.orientation)return;this._updateCameraState();let i=!1;if(t.orientation&&!e.aw.exactEquals(t.orientation,this._camera.orientation)&&(i=this._setCameraOrientation(t.orientation)),t.position){const r=[t.position.x,t.position.y,t.position.z];e.$.exactEquals(r,this._camera.position)||(this._setCameraPosition(r),i=!0)}i&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,i=new $t;return i.position=new e._(t[0],t[1],t[2]),i.orientation=this._camera.orientation,i._elevation=this.elevation,i._renderWorldCopies=this.renderWorldCopies,i}_setCameraOrientation(t){if(!e.aw.length(t))return!1;e.aw.normalize(t,t);const i=e.$.transformQuat([],[0,0,-1],t),r=e.$.transformQuat([],[0,-1,0],t);if(r[2]<0)return!1;const n=Vt(i,r);return!!n&&(this._camera.orientation=n,!0)}_setCameraPosition(t){const i=this.zoomScale(this.minZoom)*this.tileSize,r=this.zoomScale(this.maxZoom)*this.tileSize,n=this.cameraToCenterDistance;t[2]=e.au(t[2],n/r,n/i),this._camera.position=t}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){const t=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,t)}getVisibleUnwrappedCoordinates(t){const i=[new e.aL(0,t)];if(this.renderWorldCopies){const r=this.pointCoordinate(new e.P(0,0)),n=this.pointCoordinate(new e.P(this.width,0)),o=this.pointCoordinate(new e.P(this.width,this.height)),s=this.pointCoordinate(new e.P(0,this.height)),a=Math.floor(Math.min(r.x,n.x,o.x,s.x)),l=Math.floor(Math.max(r.x,n.x,o.x,s.x)),c=1;for(let r=a-c;r<=l+c;r++)0!==r&&i.push(new e.aL(r,t))}return i}isLODDisabled(e){return(!e||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}
vendor: 6,439 bytes, line 1
1extendTileCover(t,i,r){let n=[];const o=void 0!==r,s=!o;if(s&&this.zoom<i)return n;if(o&&0===r[0]&&0===r[1])return n;const a=new Set,l=(t,i,r,o,s)=>{const l=e.b2(i,t,r,o,s);a.has(l)||(n.push(new e.aQ(t,i,r,o,s)),a.add(l))};for(let e=0;e<t.length;e++){const n=t[e];if(s&&n.canonical.z!==i)continue;const a=n.canonical,c=n.overscaledZ,u=n.wrap,h=1<<a.z,p=a.x+1<h,d=a.x>0,f=a.y+1<h,m=a.y>0,_=n.wrap-(d?0:1),g=n.wrap+(p?0:1),y=d?a.x-1:h-1,v=p?a.x+1:0;if(o)r[0]<0?(l(c,g,a.z,v,a.y),r[1]<0&&f&&(l(c,u,a.z,a.x,a.y+1),l(c,g,a.z,v,a.y+1)),r[1]>0&&m&&(l(c,u,a.z,a.x,a.y-1),l(c,g,a.z,v,a.y-1))):r[0]>0?(l(c,_,a.z,y,a.y),r[1]<0&&f&&(l(c,u,a.z,a.x,a.y+1),l(c,_,a.z,y,a.y+1)),r[1]>0&&m&&(l(c,u,a.z,a.x,a.y-1),l(c,_,a.z,y,a.y-1))):r[1]<0&&f?l(c,u,a.z,a.x,a.y+1):m&&l(c,u,a.z,a.x,a.y-1);else{const e=n.visibleQuadrants;1&e&&(l(c,_,a.z,y,a.y),m&&(l(c,u,a.z,a.x,a.y-1),l(c,_,a.z,y,a.y-1))),2&e&&(l(c,g,a.z,v,a.y),m&&(l(c,u,a.z,a.x,a.y-1),l(c,g,a.z,v,a.y-1))),4&e&&(l(c,_,a.z,y,a.y),f&&(l(c,u,a.z,a.x,a.y+1),l(c,_,a.z,y,a.y+1))),8&e&&(l(c,g,a.z,v,a.y),f&&(l(c,u,a.z,a.x,a.y+1),l(c,g,a.z,v,a.y+1)))}}const c=[];for(const e of n)n.some((t=>e.isChildOf(t)))||c.push(e);if(n=c.filter((e=>!t.some((t=>!!(e.overscaledZ<i&&t.isChildOf(e))||e.equals(t)||e.isChildOf(t))))),s){const e=1<<i,t="globe"===this.projection.name?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),r=[e*t.x,e*t.y],o=4,s=o*o;n=n.filter((e=>{const t=e.canonical.x+.5-r[0],i=e.canonical.y+.5-r[1];return t*t+i*i<s}))}return n}coveringTiles(t){let i=this.coveringZoomLevel(t);const r=i,n=this.elevation&&this.elevation.exaggeration(),o=n&&!t.isTerrainDEM,s="mercator"===this.projection.name;if(void 0!==t.minzoom&&i<t.minzoom)return[];void 0!==t.maxzoom&&i>t.maxzoom&&(i=t.maxzoom);const a=this.locationCoordinate(this.center),l=this.center.lat,c=1<<i,u=[c*a.x,c*a.y,0],h="globe"===this.projection.name,p=!h,d=e.aM.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i,p),f=h?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),m=c*e.ay(1,this.center.lat),_=this._camera.position[2]/e.ay(1,this.center.lat),g=[c*f.x,c*f.y,_*(p?1:m)],y=h||n,v=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),x=this.isLODDisabled(!0)?i:0;let b;if(this._elevation&&t.isTerrainDEM)b=1e4*this._elevation.exaggeration();else if(this._elevation){const e=this._elevation.getMinMaxForVisibleTiles();b=e?e.max:this._centerAltitude}else b=this._centerAltitude;const w=t.isTerrainDEM?-b:this._elevation?this._elevation.getMinElevationBelowMSL():0,T=this.projection.isReprojectedInTileSpace?e.aN(this):1,M=t=>{const i=1/4e4,r=new e._(t.x+i,t.y,t.z),n=new e._(t.x,t.y+i,t.z),o=t.toLngLat(),s=r.toLngLat(),a=n.toLngLat(),l=this.locationCoordinate(o),c=this.locationCoordinate(s),u=this.locationCoordinate(a),h=Math.hypot(c.x-l.x,c.y-l.y),p=Math.hypot(u.x-l.x,u.y-l.y);return Math.sqrt(h*p)*T/i},E=t=>{const i=b,r=w;return{aabb:e.aR(this,c,0,0,0,t,r,i,this.projection),zoom:0,x:0,y:0,minZ:r,maxZ:i,wrap:t,fullyVisible:!1}},S=[];let C=[];const A=i,I=t.reparseOverscaled?r:i,k=(_-this._centerAltitude)*m,L=e=>{if(!this._elevation||!e.tileID||!s)return;const t=this._elevation.getMinMaxForTile(e.tileID),i=e.aabb;t?(i.min[2]=t.min,i.max[2]=t.max,i.center[2]=(i.min[2]+i.max[2])/2):(e.shouldSplit=R(e),e.shouldSplit||(i.min[2]=i.max[2]=i.center[2]=this._centerAltitude))},P=(e,t)=>{if(.707*t<e)return 1;const i=t/e;return i/(1.4144271570014144+(Math.pow(1.1,i-1.4144271570014144+1)-1)/(1.1-1)-1)},R=t=>{if(t.zoom<x)return!0;if(t.zoom===A)return!1;if(null!=t.shouldSplit)return t.shouldSplit;const i=t.aabb.distanceX(g),n=t.aabb.distanceY(g);let a=k,c=1;if(h){a=t.aabb.distanceZ(g);const i=Math.pow(2,t.zoom),r=e.az((t.y+1)/i),n=e.az(t.y/i),o=Math.min(Math.max(l,r),n),s=e.b6(o)/e.b6(l);if(c=o===l?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,s/this._mercatorScaleRatio),this.zoom<=e.b3&&t.zoom===A-1&&s>=.9)return!0}else if(o&&(a=t.aabb.distanceZ(g)*m),this.projection.isReprojectedInTileSpace&&r<=5){const i=Math.pow(2,t.zoom),r=M(new e._((t.x+.5)/i,(t.y+.5)/i));c=r>.85?1:r}if(!s){const e=Math.sqrt(i*i+n*n+a*a);let r=(1<<A-t.zoom)*v*c;return r*=P(Math.max(a,k),e),e<r}let p=Number.MAX_VALUE,d=0;const f=t.aabb.getCorners(),_=[];for(const t of f){e.$.sub(_,t,g),h||(o?_[2]*=m:_[2]=k);const i=e.$.dot(_,this._camera.forward());i<p&&(p=i,d=Math.abs(_[2]))}let y=(1<<A-t.zoom)*v*c;if(y*=P(Math.max(d,k),p),p<y)return!0;const b=t.aabb.closestPoint(u);return b[0]===u[0]&&b[1]===u[1]};if(this.renderWorldCopies)for(let e=1;e<=3;e++)S.push(E(-e)),S.push(E(e));for(S.push(E(0));S.length>0;){const r=S.pop(),n=r.x,a=r.y;let l=r.fullyVisible;const p=()=>"globe"===this.projection.name&&(0===r.y||r.y===(1<<r.zoom)-1);if(!l){let t=y?r.aabb.intersects(d):r.aabb.intersectsFlat(d);if(0===t&&p()){const i=new e.aO(r.zoom,n,a);t=e.aP(this,c,i,!0).intersects(d)}if(0===t)continue;l=2===t}if(r.zoom!==A&&R(r))for(let t=0;t<4;t++){const i=(n<<1)+t%2,u=(a<<1)+(t>>1),p={aabb:s?r.aabb.quadrant(t):e.aR(this,c,r.zoom+1,i,u,r.wrap,r.minZ,r.maxZ,this.projection),zoom:r.zoom+1,x:i,y:u,wrap:r.wrap,fullyVisible:l,tileID:void 0,shouldSplit:void 0,minZ:r.minZ,maxZ:r.maxZ};o&&!h&&(p.tileID=new e.aQ(r.zoom+1===A?I:r.zoom+1,r.wrap,r.zoom+1,i,u),L(p)),S.push(p)}else{const o=r.zoom===A?I:r.zoom;if(t.minzoom&&t.minzoom>o)continue;let s=0;if(!l){let i=y?r.aabb.intersectsPrecise(d):r.aabb.intersectsPreciseFlat(d);if(0===i&&p()){const t=new e.aO(r.zoom,n,a);i=e.aP(this,c,t,!0).intersectsPrecise(d)}if(0===i)continue;if(t.calculateQuadrantVisibility)if(d.containsPoint(r.aabb.center))s=15;else for(let e=0;e<4;e++)0!==r.aabb.quadrant(e).intersects(d)&&(s|=1<<e)}const h=u[0]-(.5+n+(r.wrap<<r.zoom))*(1<<i-r.zoom),f=u[1]-.5-a,m=r.tileID?r.tileID:new e.aQ(o,r.wrap,r.zoom,n,a);t.calculateQuadrantVisibility&&(m.visibleQuadrants=s),C.push({tileID:m,distanceSq:h*h+f*f})}}if(this.fogCullDistSq){const i=this.fogCullDistSq,r=this.horizonLineFromTop();C=C.filter((n=>{const o=[0,0,0,1],s=[e.a4,e.a4,0,1],a=this.calculateFogTileMatrix(n.tileID.toUnwrapped());e.aB.transformMat4(o,o,a),e.aB.transformMat4(s,s,a);const l=e.aB.min([],o,s),c=e.aB.max([],o,s),u=e.aS(l,c);if(0===u)return!0;let h=!1;const p=this._elevation;if(p&&u>i&&0!==r){const i=this.calculateProjMatrix(n.tileID.toUnwrapped());let o;t.isTerrainDEM||(o=p.getMinMaxForTile(n.tileID)),o||(o={min:w,max:b});const s=e.b4(this.rotation),a=[s[0]*e.a4,s[1]*e.a4,o.max];e.$.transformMat4(a,a,i),h=(1-a[1])*this.height*.5<r}return u<i||h}
1))}return C.sort(((e,t)=>e.distanceSq-t.distanceSq)).map((e=>e.tileID))}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(t){const i=e.au(t.lat,-e.aT,e.aT),r=this.projection.project(t.lng,i);return new e.P(r.x*this.worldSize,r.y*this.worldSize)}unproject(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/e.ay(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,i){let r,n;const o=this.centerPoint;if("globe"===this.projection.name){const e=this.worldSize;r=(i.x-o.x)/e,n=(i.y-o.y)/e}else{const e=this.pointCoordinate(i),t=this.pointCoordinate(o);r=e.x-t.x,n=e.y-t.y}const s=this.locationCoordinate(t);this.setLocation(new e._(s.x-r,s.y-n))}setLocation(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(e){return this.projection.locationPoint(this,e)}locationPoint3D(e){return this.projection.locationPoint(this,e,!0)}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}pointLocation3D(e){return this.coordinateLocation(this.pointCoordinate3D(e))}locationCoordinate(t,i){const r=i?e.ay(i,t.lat):void 0,n=this.projection.project(t.lng,t.lat);return new e._(n.x,n.y,r)}coordinateLocation(e){return this.projection.unproject(e.x,e.y)}pointRayIntersection(t,i){const r=null!=i?i:this._centerAltitude,n=[t.x,t.y,0,1],o=[t.x,t.y,1,1];e.aB.transformMat4(n,n,this.pixelMatrixInverse),e.aB.transformMat4(o,o,this.pixelMatrixInverse);const s=o[3];e.aB.scale(n,n,1/n[3]),e.aB.scale(o,o,1/s);const a=n[2],l=o[2];return{p0:n,p1:o,t:a===l?0:(r-a)/(l-a)}}screenPointToMercatorRay(t){const i=[t.x,t.y,0,1],r=[t.x,t.y,1,1];return e.aB.transformMat4(i,i,this.pixelMatrixInverse),e.aB.transformMat4(r,r,this.pixelMatrixInverse),e.aB.scale(i,i,1/i[3]),e.aB.scale(r,r,1/r[3]),i[2]=e.ay(i[2],this._center.lat)*this.worldSize,r[2]=e.ay(r[2],this._center.lat)*this.worldSize,e.aB.scale(i,i,1/this.worldSize),e.aB.scale(r,r,1/this.worldSize),new e.aU([i[0],i[1],i[2]],e.$.normalize([],e.$.sub([],r,i)))}rayIntersectionCoordinate(t){const{p0:i,p1:r,t:n}=t,o=e.ay(i[2],this._center.lat),s=e.ay(r[2],this._center.lat);return new e._(e.a3(i[0],r[0],n)/this.worldSize,e.a3(i[1],r[1],n)/this.worldSize,e.a3(o,s,n))}pointCoordinate(e,t=this._centerAltitude){return this.projection.pointCoordinate(this,e.x,e.y,t)}pointCoordinate3D(t){if(!this.elevation)return this.pointCoordinate(t);let i=this.projection.pointCoordinate3D(this,t.x,t.y);if(i)return new e._(i[0],i[1],i[2]);let r=0,n=this.horizonLineFromTop();if(t.y>n)return this.pointCoordinate(t);const o=.02*n,s=t.clone();for(let t=0;t<10&&n-r>o;t++){s.y=e.a3(r,n,.66);const t=this.projection.pointCoordinate3D(this,s.x,s.y);t?(n=s.y,i=t):r=s.y}return i?new e._(i[0],i[1],i[2]):this.pointCoordinate(t)}isPointAboveHorizon(e){return this.projection.isPointAboveHorizon(this,e)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=e.aV)return!this.isPointAboveHorizon(t);const i=this.pointCoordinate(t);return i.y>=0&&i.y<=1}_coordinatePoint(t,i){const r=i&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,n=[t.x*this.worldSize,t.y*this.worldSize,r+t.toAltitude(),1];return e.aB.transformMat4(n,n,this.pixelMatrix),n[3]>0?new e.P(n[0]/n[3],n[1]/n[3]):new e.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:i}=this._edgeInsets,r=this.height-this._edgeInsets.bottom,n=this.width-this._edgeInsets.right,o=this.pointLocation3D(new e.P(i,t)),s=this.pointLocation3D(new e.P(n,t)),a=this.pointLocation3D(new e.P(n,r)),l=this.pointLocation3D(new e.P(i,r));let c=Math.min(o.lng,s.lng,a.lng,l.lng),u=Math.max(o.lng,s.lng,a.lng,l.lng),h=Math.min(o.lat,s.lat,a.lat,l.lat),p=Math.max(o.lat,s.lat,a.lat,l.lat);const d=Math.pow(2,-this.zoom)/16*270,f="globe"===this.projection.name?1:4,m=(t,i,r,n,o)=>
vendor: 6,649 bytes, line 1
1{const s=(t+r)/2,a=(i+n)/2,l=new e.P(s,a),{lng:_,lat:g}=this.pointLocation3D(l),y=Math.max(0,c-_,h-g,_-u,g-p);c=Math.min(c,_),u=Math.max(u,_),h=Math.min(h,g),p=Math.max(p,g),(o<f||y>d)&&(m(t,i,s,a,o+1),m(s,a,r,n,o+1))};if(m(i,t,n,t,1),m(n,t,n,r,1),m(n,r,i,r,1),m(i,r,i,t,1),"globe"===this.projection.name){const[t,i]=e.aW(this);t?(p=90,u=180,c=-180):i&&(h=-90,u=180,c=-180)}return new e.aj(new e.aJ(c,h),new e.aJ(u,p))}_getBoundsRectangular(t,i){const{top:r,left:n}=this._edgeInsets,o=this.height-this._edgeInsets.bottom,s=this.width-this._edgeInsets.right,a=new e.P(n,r),l=new e.P(s,r),c=new e.P(s,o),u=new e.P(n,o);let h=this.pointCoordinate(a,t),p=this.pointCoordinate(l,t);const d=this.pointCoordinate(c,i),f=this.pointCoordinate(u,i),m=(e,t)=>(t.y-e.y)/(t.x-e.x);return h.y>1&&p.y>=0?h=new e._((1-f.y)/m(f,h)+f.x,1):h.y<0&&p.y<=1&&(h=new e._(-f.y/m(f,h)+f.x,0)),p.y>1&&h.y>=0?p=new e._((1-d.y)/m(d,p)+d.x,1):p.y<0&&h.y<=1&&(p=new e._(-d.y/m(d,p)+d.x,0)),(new e.aj).extend(this.coordinateLocation(h)).extend(this.coordinateLocation(p)).extend(this.coordinateLocation(f)).extend(this.coordinateLocation(d))}_getBoundsRectangularTerrain(){const e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBoundsRectangular(0,0);const t=e.visibleDemTiles.reduce(((e,t)=>{if(t.dem){const i=t.dem.tree;e.min=Math.min(e.min,i.minimums[0]),e.max=Math.max(e.max,i.maximums[0])}return e}),{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(t.min*e.exaggeration(),t.max*e.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(e=!0){const t=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,i=this.height/2-t*(1-this._horizonShift);return e?Math.max(0,i):i}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-e.aT,this.maxLat=e.aT,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=e.ak(this.minLng)*this.tileSize,this.worldMaxX=e.ak(this.maxLng)*this.tileSize,this.worldMinY=e.al(this.maxLat)*this.tileSize,this.worldMaxY=e.al(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(e,t){return this.projection.createTileMatrix(this,t,e)}calculateDistanceTileData(t){const i=t.key,r=this._distanceTileDataCache;if(r[i])return r[i];const n=t.canonical,o=1/this.height,s=this.cameraWorldSize,a=s/this.zoomScale(n.z),l=(n.x+Math.pow(2,n.z)*t.wrap)*a,c=n.y*a,u=this.point;u.x*=s/this.worldSize,u.y*=s/this.worldSize;const h=this.angle,p=Math.sin(-h),d=-Math.cos(-h);return r[i]={bearing:[p,d],center:[(u.x-l)*o,(u.y-c)*o],scale:a/e.a4*o},r[i]}calculateFogTileMatrix(t){const i=t.key,r=this._fogTileMatrixCache;if(r[i])return r[i];const n=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return e.ae.multiply(n,this.worldToFogMatrix,n),r[i]=new Float32Array(n),r[i]}calculateProjMatrix(t,i=!1,r=!1){const n=t.key;let o;if(o=r?this._expandedProjMatrixCache:i?this._alignedProjMatrixCache:this._projMatrixCache,o[n])return o[n];const s=this.calculatePosMatrix(t,this.worldSize);let a;return a=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:r?this.expandedFarZProjMatrix:i?this.alignedProjMatrix:this.projMatrix,e.ae.multiply(s,a,s),o[n]=new Float32Array(s),o[n]}calculatePixelsToTileUnitsMatrix(t){const i=t.tileID.key,r=this._pixelsToTileUnitsCache;if(r[i])return r[i];const n=e.aX(t,this);return r[i]=n,r[i]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if("globe"===this.projection.name){const t=1/this.worldSize,i=e.ae.fromScaling([],[t,t,t]);return e.ae.multiply(i,i,this.globeMatrix),i}}recenterOnTerrain(){if(!this._elevation||"globe"===this.projection.name)return;const t=this._elevation;this._updateCameraState();const i=e.ay(1,this._center.lat)*this.worldSize,r=this._computeCameraPosition(i),n=this._camera.forward(),o=e.ay(1,this._center.lat);r[2]/=o,n[2]/=o,e.$.normalize(n,n);const s=t.raycast(r,n,t.exaggeration());if(s){const t=e.$.scaleAndAdd([],r,n,s),i=new e._(t[0],t[1],e.ay(t[2],e.az(t[1]))),a=(i.z+e.$.length([i.x-r[0],i.y-r[1],i.z-r[2]*o]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(a),this._centerAltitude=i.toAltitude(),this._center=this.coordinateLocation(i),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(t=!1){if(!this._elevation)return;const i=this._elevation,r=e.ay(1,this._center.lat)*this.worldSize,n=this._computeCameraPosition(r),o=i.getAtPointOrZero(new e._(...n)),s=this.pixelsPerMeter/this.worldSize*o,a=this._minimumHeightOverTerrain(),l=n[2]-s;if(l<=a)if(l<0||t){const t=this.locationCoordinate(this._center,this._centerAltitude),i=[n[0],n[1],t.z-n[2]],r=e.$.length(i);i[2]-=(a-l)/this._pixelsPerMercatorPixel;const o=e.$.length(i);if(0===o)return;e.$.scale(i,i,r/o*this._pixelsPerMercatorPixel),this._camera.position=[n[0],n[1],t.z*this._pixelsPerMercatorPixel-i[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){const i=this.center;return i.lat=e.au(i.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(i.lng=e.au(i.lng,this.minLng,this.maxLng)),this.center=i,void(this._constraining=!1)}const i=this._unmodified,{x:r,y:n}=this.point;let o=0,s=r,a=n;const l=this.width/2,c=this.height/2,u=this.worldMinY*this.scale,h=this.worldMaxY*this.scale;if(n-c<u&&(a=u+c),n+c>h&&(a=h-c),h-u<this.height&&(o=Math.max(o,this.height/(h-u)),a=(h+u)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const e=this.worldMinX*this.scale,t=this.worldMaxX*this.scale,i=this.worldSize/2-(e+t)/2;s=(r+i+this.worldSize)%this.worldSize-i,s-l<e&&(s=e+l),s+l>t&&(s=t-l),t-e<this.width&&(o=Math.max(o,this.width/(t-e)),s=(t+e)/2)}s===r&&a===n||(this.center=this.unproject(new e.P(s,a))),o&&(this.zoom+=this.scaleZoom(o)),this._constrainCamera(),this._unmodified=i,this._constraining=!1}_minZoomForBounds(){let e=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(e=Math.max(e,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),e}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}
1_calcMatrices(){if(!this.height)return;const t=this.centerOffset,i="globe"===this.projection.name,r=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=e.ay(1,this.center.lat)/e.ay(1,e.b5));const n=e.aY(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,n),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const o="meters"===this.projection.zAxisUnit?r:1,s=this._camera.getWorldToCamera(this.worldSize,o);let a;const l=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(l[8]=2*-t.x/this.width,l[9]=2*t.y/this.height,this.isOrthographic){let e=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),i=e*this.aspect,r=-i,n=-e;i-=t.x,r-=t.x,e+=t.y,n+=t.y,a=this._camera.getCameraToClipOrthographic(r,i,n,e,this._nearZ,this._farZ),((e,t,i,r)=>{for(let n=0;n<16;n++)e[n]=li(t[n],i[n],r)})(a,a,l,ci(this.pitch>=15?1:this.pitch/15))}else a=l;const c=e.ae.mul([],l,s);let u=e.ae.mul([],a,s);if(this.projection.isReprojectedInTileSpace){const t=this.locationCoordinate(this.center),i=e.ae.identity([]);e.ae.translate(i,i,[t.x*this.worldSize,t.y*this.worldSize,0]),e.ae.multiply(i,i,e.aZ(this)),e.ae.translate(i,i,[-t.x*this.worldSize,-t.y*this.worldSize,0]),e.ae.multiply(u,u,i),e.ae.multiply(c,c,i),this.inverseAdjustmentMatrix=e.a_(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=e.ae.scale([],u,[this.worldSize,this.worldSize,this.worldSize/o,1]),this.projMatrix=u,this.invProjMatrix=e.ae.invert(new Float64Array(16),this.projMatrix),i){const i=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);i[8]=2*-t.x/this.width,i[9]=2*t.y/this.height,this.expandedFarZProjMatrix=e.ae.mul([],i,s)}else this.expandedFarZProjMatrix=this.projMatrix;const h=e.ae.invert([],a);this.frustumCorners=e.a$.fromInvProjectionMatrix(h,this.horizonLineFromTop(),this.height),this.cameraFrustum=e.aM.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!i);const p=new Float32Array(16);e.ae.identity(p),e.ae.scale(p,p,[1,-1,1]),e.ae.rotateX(p,p,this._pitch),e.ae.rotateZ(p,p,this.angle);const d=e.ae.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=e.ae.clone(d);const f=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;d[8]=2*-t.x/this.width,d[9]=2*(t.y+f)/this.height,this.skyboxMatrix=e.ae.multiply(p,d,p);const m=this.point,_=m.x,g=m.y,y=this.width%2/2,v=this.height%2/2,x=Math.cos(this.angle),b=Math.sin(this.angle),w=_-Math.round(_)+x*y+b*v,T=g-Math.round(g)+x*v+b*y,M=new Float64Array(u);if(e.ae.translate(M,M,[w>.5?w-1:w,T>.5?T-1:T,0]),this.alignedProjMatrix=M,u=e.ae.create(),e.ae.scale(u,u,[this.width/2,-this.height/2,1]),e.ae.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=e.ae.create(),e.ae.scale(u,u,[1,-1,1]),e.ae.translate(u,u,[-1,-1,0]),e.ae.scale(u,u,[2/this.width,2/this.height,1]),this.glCoordMatrix=u,this.pixelMatrix=e.ae.multiply(new Float64Array(16),this.labelPlaneMatrix,c),this._calcFogMatrices(),this._distanceTileDataCache={},u=e.ae.invert(new Float64Array(16),this.pixelMatrix),!u)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=u,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.b0(this);const t=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.$.transformMat4(t,t,s),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=u;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,i=this.cameraPixelsPerMeter,r=this._camera.position,n=1/this.height/this._pixelsPerMercatorPixel,o=[t,t,i];e.$.scale(o,o,n),e.$.scale(r,r,-1),e.$.multiply(r,r,o);const s=e.ae.create();e.ae.translate(s,s,r),e.ae.scale(s,s,o),this.mercatorFogMatrix=s,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,i,n)}_computeCameraPosition(e){const t=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,i=this._camera.forward(),r=this.point,
1n=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*t-e/this.worldSize*this._centerAltitude;return[r.x/this.worldSize-i[0]*n,r.y/this.worldSize-i[1]*n,e/this.worldSize*this._centerAltitude-i[2]*n]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const i=this._maxCameraBoundsDistance()*Math.cos(this._pitch),r=this._camera.position[2],n=t[2];let o=1;this.projection.wrap&&(this.center=this.center.wrap()),n>0&&(o=Math.min((i-r)/n,1)),this._camera.position=e.$.scaleAndAdd([],this._camera.position,t,o),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,i=this._camera.forward(),{pitch:r,bearing:n}=this._camera.getPitchBearing(),o=e.ay(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,s=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.ac(this._maxPitch)),a=Math.max((t[2]-o)/Math.cos(r),s),l=this._zoomFromMercatorZ(a);e.$.scaleAndAdd(t,t,i,a),this._pitch=e.au(r,e.ac(this.minPitch),e.ac(this.maxPitch)),this.angle=e.av(n,-Math.PI,Math.PI),this._setZoom(e.au(l,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e._(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(e){return Math.pow(2,e)*this.tileSize}_mercatorZfromZoom(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}_minimumHeightOverTerrain(){const e=Math.min(null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(e)}_zoomFromMercatorZ(e){return this.scaleZoom(this.cameraToCenterDistance/(e*this.tileSize))}zoomFromMercatorZAdjusted(t){let i=0,r=e.aV,n=0,o=1/0;for(;r-i>1e-6&&r>i;){const e=i+.5*(r-i),s=this.tileSize*Math.pow(2,e),a=this.getCameraToCenterDistance(this.projection,e,s),l=this.scaleZoom(a/(t*this.tileSize)),c=Math.abs(e-l);c<o&&(o=c,n=e),e<l?i=e:r=e}return n}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(e.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,i){const r=Math.min(t.x,i.x),n=Math.max(t.x,i.x),o=Math.min(t.y,i.y),s=Math.max(t.y,i.y);if(o<this.horizonLineFromTop(!1))return!0;if("mercator"!==this.projection.name)return!1;const a=[new e.P(r,o),new e.P(n,s),new e.P(r,s),new e.P(n,o)],l=this.renderWorldCopies?-3:0,c=this.renderWorldCopies?4:1;for(const e of a){const t=this.pointRayIntersection(e);if(t.t<0)return!0;const i=this.rayIntersectionCoordinate(t);if(i.x<l||i.y<0||i.x>c||i.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+e.b1(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.P(0,0),new e.P(this.width,this.height))}zoomDeltaToMovement(t,i){const r=e.$.length(e.$.sub([],this._camera.position,t)),n=this._zoomFromMercatorZ(r)+i;return r-this._mercatorZfromZoom(n)}getCameraPoint(){if("globe"===this.projection.name){const t=function([t,i,r],n){const o=[t,i,r,1];e.aB.transformMat4(o,o,n);const s=o[3]=Math.max(o[3],1e-6);return o[0]/=s,o[1]/=s,o[2]/=s,o}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new e.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(0,t))}}getCameraToCenterDistance(t,i=this.zoom,r=this.worldSize){const n=e.aY(t,i,this.width,this.height,1024),o=t.pixelSpaceConversion(this.center.lat,r,n);let s=.5/Math.tan(.5*this._fov)*this.height*o;return this.isOrthographic&&(s=li(1,s,ci(this.pitch>=15?1:this.pitch/15))),s}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&e.ae.multiply(t,t,this.globeMatrix),t}getFrustum(t){return e.aM.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,"meters"===this.projection.zAxisUnit)}}const hi={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11},pi=(t,i)=>{if(i>0&&t.terrain&&e.w("Cutoff is currently disabled on terrain"),i<=0||t.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const r=t.transform,n=Math.max(Math.abs(r._zoom-(t.minCutoffZoom-1)),1),o=r.isLODDisabled(!1)?e.a0(60,45,r.pitch):e.a0(30,15,r.pitch),s=r._farZ-r._nearZ,a=i*r.height,l=((1-(c=o))*r.cameraToCenterDistance+c*(r._farZ+a))*n;var c;return{shouldRenderCutoff:o<1,uniformValues:{u_cutoff_params:[r._nearZ,r._farZ,(l-r._nearZ)/s,(l-a-r._nearZ)/s]}}},di={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class fi{constructor(e,t){this.aabb=e,this.lastCascade=t}}class mi{add(e,t){const i=this.receivers[e.key];void 0!==i?(i.aabb.min[0]=Math.min(i.aabb.min[0],t.min[0]),i.aabb.min[1]=Math.min(i.aabb.min[1],t.min[1]),i.aabb.min[2]=Math.min(i.aabb.min[2],t.min[2]),i.aabb.max[0]=Math.max(i.aabb.max[0],t.max[0]),i.aabb.max[1]=Math.max(i.aabb.max[1],t.max[1]),i.aabb.max[2]=Math.max(i.aabb.max[2],t.max[2])):this.receivers[e.key]=new fi(t,null)}clear(){this.receivers={}}get(e){return this.receivers[e.key]}computeRequiredCascades(t,i,r){const n=e.b8.fromPoints(t.points);let o=0;for(const t in this.receivers){const s=this.receivers[t];if(!s)continue;if(!n.intersectsAabb(s.aabb))continue;s.aabb.min=n.closestPoint(s.aabb.min),s.aabb.max=n.closestPoint(s.aabb.max);const a=s.aabb.getCorners();for(let t=0;t<r.length;t++){let n=!0;for(const o of a){const s=[o[0]*i,o[1]*i,o[2]];
1if(e.$.transformMat4(s,s,r[t].matrix),s[0]<-1||s[0]>1||s[1]<-1||s[1]>1){n=!1;break}}if(s.lastCascade=t,o=Math.max(o,t),n)break}}return o+1}}class _i{constructor(t){this.painter=t,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new mi,this._depthMode=new e.af(t.context.gl.LEQUAL,e.af.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,t.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},(()=>{this.painter.style.map.triggerRepaint()})),t.tp.registerParameter(di,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),t.tp.registerParameter(di,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),t.tp.registerParameter(di,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),t.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const e of this._cascades)e.texture.destroy(),e.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,i){const r=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!i||!i.properties)return;const n=i.properties.get("shadow-intensity");if(!i.shadowsEnabled()||n<=0)return;if(this._shadowLayerCount=r.style.order.reduce(((e,i)=>{const n=r.style._mergedLayers[i];return e+(n.hasShadowPass()&&!n.isHidden(t.zoom)?1:0)}),0),this._enabled=this._shadowLayerCount>0,!this.enabled)return;const o=r.context,s=di.shadowMapResolution,a=di.shadowMapResolution;if(0===this._cascades.length||di.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let t=0;t<di.cascadeCount;++t){const t=r._shadowMapDebug,i=o.gl,n=o.createFramebuffer(s,a,t,"texture"),l=new e.T(o,{width:s,height:a,data:null},i.DEPTH_COMPONENT);if(n.depthAttachment.set(l.texture),t){const t=new e.T(o,{width:s,height:a,data:null},i.RGBA);n.colorAttachment.set(t.texture)}this._cascades.push({framebuffer:n,texture:l,matrix:[],far:0,boundingSphereRadius:0,frustum:new e.aM,scale:0})}}this.shadowDirection=yi(i);let l=0;if(t.elevation){const e=t.elevation,i=[1e4,-1e4];e.visibleDemTiles.filter((e=>e.dem)).forEach((e=>{const t=e.dem.tree;i[0]=Math.min(i[0],t.minimums[0]),i[1]=Math.max(i[1],t.maximums[0])})),1e4!==i[0]&&(l=(i[1]-i[0])*e.exaggeration())}const c=1.5*t.cameraToCenterDistance,u=3*c,h=new Float64Array(16);for(let i=0;i<this._cascades.length;++i){const r=this._cascades[i];let n=t.height/50,o=1;1===di.cascadeCount?o=u:0===i?o=c:(n=c,o=u);const[s,a]=xi(t,this.shadowDirection,n,o,di.shadowMapResolution,l);r.scale=t.scale,r.matrix=s,r.boundingSphereRadius=a,e.ae.invert(h,r.matrix),r.frustum=e.aM.fromInvProjectionMatrix(h,1,0,!0),r.far=o}const p=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[p].far,this._cascades[p].far],this._uniformValues.u_shadow_intensity=n,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/di.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=di.shadowMapResolution,this._uniformValues.u_shadowmap_0=hi.ShadowMap0,this._uniformValues.u_shadowmap_1=hi.ShadowMap0+1,this._groundShadowTiles=r.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const d=r.transform.elevation;for(const e of this._groundShadowTiles){let t={min:0,max:0};if(d){const i=d.getMinMaxForTile(e);i&&(t=i)}this.addShadowReceiver(e.toUnwrapped(),t.min,t.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(e){this._enabled=e}drawShadowPass(t,i){if(!this.enabled)return;const r=this.painter,n=r.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(r.transform.getFrustum(0),r.transform.worldSize,this._cascades),n.viewport.set([0,0,di.shadowMapResolution,di.shadowMapResolution]);for(let o=0;o<this._numCascadesToRender;++o){r.currentShadowCascade=o,n.bindFramebuffer.set(this._cascades[o].framebuffer.framebuffer),n.clear({color:e.C.white,depth:1});for(const e of t.order){const n=t._mergedLayers[e];if(!n.hasShadowPass()||n.isHidden(r.transform.zoom))continue;const o=t.getLayerSourceCache(n),s=o?i[o.id]:void 0;("model"===n.type||s&&s.length)&&r.renderLayer(r,o,n,s)}}r.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const t=this.painter,i=t.style,r=t.context,n=i.directionalLight,o=i.ambientLight;if(!n||!o)return;const s=[],a=pi(t,t.longestCutoffRange);a.shouldRenderCutoff&&s.push("RENDER_CUTOFF");const l=vi(i,n,o),c=new e.af(r.gl.LEQUAL,e.af.ReadOnly,t.depthRangeFor3D);for(const i of this._groundShadowTiles){const n=i.toUnwrapped(),o=t.isTileAffectedByFog(i),u=t.getOrCreateProgram("groundShadow",{defines:s,overrideFog:o});this.setupShadows(n,u),t.uploadCommonUniforms(r,u,n,null,a);const h={u_matrix:t.transform.calculateProjMatrix(n),u_ground_shadow_factor:l};u.draw(t,r.gl.TRIANGLES,c,e.ah.disabled,e.a.multiply,e.ag.disabled,h,"ground_shadow",t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments,{},t.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?e.a.unblended:e.a.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(t){const i=this.painter.transform,r=i.calculatePosMatrix(t,i.worldSize);return e.ae.multiply(r,this._cascades[this.painter.currentShadowCascade].matrix,r),Float32Array.from(r)}
1calculateShadowPassMatrixFromMatrix(t){return e.ae.multiply(t,this._cascades[this.painter.currentShadowCascade].matrix,t),Float32Array.from(t)}setupShadows(t,i,r,n=0){if(!this.enabled)return;const o=this.painter.transform,s=this.painter.context,a=s.gl,l=this._uniformValues,c=new Float64Array(16),u=o.calculatePosMatrix(t,o.worldSize);for(let t=0;t<this._cascades.length;t++)e.ae.multiply(c,this._cascades[t].matrix,u),l[0===t?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(c),s.activeTexture.set(a.TEXTURE0+hi.ShadowMap0+t),this._cascades[t].texture.bind(a.NEAREST,a.CLAMP_TO_EDGE);if(this.useNormalOffset=!!r,this.useNormalOffset){const i=e.b7(t.canonical),s=2/o.tileSize*e.a4/di.shadowMapResolution,a=s*this._cascades[0].boundingSphereRadius,c=s*this._cascades[this._cascades.length-1].boundingSphereRadius,u=("vector-tile"===r?1:3)/Math.pow(2,n-t.canonical.z-(1-o.zoom+Math.floor(o.zoom)));l.u_shadow_normal_offset=[i,a*u,c*u],l.u_shadow_bias=[6e-5,.0012,.012]}else l.u_shadow_bias=[36e-5,.0012,.012];i.setShadowUniformValues(s,l)}setupShadowsFromMatrix(t,i,r=!1){if(!this.enabled)return;const n=this.painter.context,o=n.gl,s=this._uniformValues,a=new Float64Array(16);for(let i=0;i<di.cascadeCount;i++)e.ae.multiply(a,this._cascades[i].matrix,t),s[0===i?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(a),n.activeTexture.set(o.TEXTURE0+hi.ShadowMap0+i),this._cascades[i].texture.bind(o.NEAREST,o.CLAMP_TO_EDGE);if(this.useNormalOffset=r,r){const e=di.normalOffset;s.u_shadow_normal_offset=[1,e,e],s.u_shadow_bias=[6e-5,.0012,.012]}else s.u_shadow_bias=[36e-5,.0012,.012];i.setShadowUniformValues(n,s)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(t,i,r,n){if(n[2]>=0)return{};const o=function(t,i,r){const n=r/(1<<t.canonical.z);return new e.b8([t.canonical.x*n+t.wrap*r,t.canonical.y*n+t.wrap*r,0],[(t.canonical.x+1)*n+t.wrap*r,(t.canonical.y+1)*n+t.wrap*r,i])}(t,i,r).getCorners(),s=i/-n[2];n[0]<0?(e.$.add(o[0],o[0],[n[0]*s,0,0]),e.$.add(o[3],o[3],[n[0]*s,0,0])):n[0]>0&&(e.$.add(o[1],o[1],[n[0]*s,0,0]),e.$.add(o[2],o[2],[n[0]*s,0,0])),n[1]<0?(e.$.add(o[0],o[0],[0,n[1]*s,0]),e.$.add(o[1],o[1],[0,n[1]*s,0])):n[1]>0&&(e.$.add(o[2],o[2],[0,n[1]*s,0]),e.$.add(o[3],o[3],[0,n[1]*s,0]));const a={};return a.vertices=o,a.planes=[gi(o[1],o[0],o[4]),gi(o[2],o[1],o[5]),gi(o[3],o[2],o[6]),gi(o[0],o[3],o[7])],a}addShadowReceiver(t,i,r){this._receivers.add(t,e.b8.fromTileIdAndHeight(t,i,r))}getMaxCascadeForTile(e){const t=this._receivers.get(e);return t&&t.lastCascade?t.lastCascade:0}}function gi(t,i,r){const n=e.$.sub([],r,i),o=e.$.sub([],t,i),s=e.$.cross([],n,o),a=e.$.length(s);return 0===a?[0,0,1,0]:(e.$.scale(s,s,1/a),[s[0],s[1],s[2],-e.$.dot(s,i)])}function yi(t){const i=t.properties.get("direction"),r=e.ad(i.x,i.y,i.z);r[2]=e.au(r[2],0,75);const n=e.b9([r[0],r[1],r[2]]);return e.$.fromValues(n.x,n.y,n.z)}function vi(t,i,r){const n=i.properties.get("color"),o=i.properties.get("intensity"),s=i.properties.get("direction"),a=[s.x,s.y,s.z],l=r.properties.get("color"),c=r.properties.get("intensity"),u=Math.max(e.$.dot([0,0,1],a),0),h=[0,0,0];e.$.scale(h,l.toRenderColor(t.getLut(i.scope)).toArray01Linear().slice(0,3),c);const p=[0,0,0];return e.$.scale(p,n.toRenderColor(t.getLut(r.scope)).toArray01Linear().slice(0,3),u*o),e.ba([h[0]>0?h[0]/(h[0]+p[0]):0,h[1]>0?h[1]/(h[1]+p[1]):0,h[2]>0?h[2]/(h[2]+p[2]):0])}function xi(t,i,r,n,o,s){const a=t.zoom,l=t.scale,c=t.worldSize,u=1/c,h=t.aspect,p=Math.sqrt(1+h*h)*Math.tan(.5*t.fovX),d=p*p,f=n-r,m=n+r;let _,g;d>f/m?(_=n,g=n*p):(_=.5*m*(1+d),g=.5*Math.sqrt(f*f+2*(n*n+r*r)*d+m*m*d*d));const y=t.projection.pixelsPerMeter(t.center.lat,c),v=t._camera.getCameraToWorldMercator(),x=[0,0,-_*u];e.$.transformMat4(x,x,v);let b=g*u;const w=t._edgeInsets;if(!(0===w.left&&0===w.top&&0===w.right&&0===w.bottom||w.left===w.right&&w.top===w.bottom)){const i=t._camera.getWorldToCamera(t.worldSize,"meters"===t.projection.zAxisUnit?y:1),o=t._camera.getCameraToClipPerspective(t._fov,t.width/t.height,r,n);o[8]=2*-t.centerOffset.x/t.width,o[9]=2*t.centerOffset.y/t.height;const s=new Float64Array(16);e.ae.mul(s,o,i);const u=new Float64Array(16);e.ae.invert(u,s);const h=e.aM.fromInvProjectionMatrix(u,c,a,!0);for(const i of h.points){const r=((T=i)[0]/=l,T[1]/=l,T[2]=e.ay(T[2],t._center.lat),T);b=Math.max(b,e.$.len(e.$.subtract([],x,r)))}}var T;b*=o/(o-1);const M=Math.acos(i[2]),E=Math.atan2(-i[0],-i[1]),S=new Gt;S.position=x,S.setPitchBearing(M,E);const C=S.getWorldToCamera(c,y),A=b*c,I=Math.min(t._mercatorZfromZoom(17)*c*-2,-2*A),k=S.getCameraToClipOrthographic(-A,A,-A,A,I,(A+s*y)/i[2]),L=new Float64Array(16);e.ae.multiply(L,k,C);const P=e.$.fromValues(Math.floor(1e6*x[0])/1e6*c,Math.floor(1e6*x[1])/1e6*c,0),R=.5*o,z=[0,0,0];e.$.transformMat4(z,P,L),e.$.scale(z,z,R);const O=[Math.floor(z[0]),Math.floor(z[1]),Math.floor(z[2])],D=[0,0,0];e.$.sub(D,z,O),e.$.scale(D,D,-1/R);const F=new Float64Array(16);return e.ae.identity(F),e.ae.translate(F,F,D),e.ae.multiply(L,F,L),[L,A]}function bi(e,t){return null!=e&&null!=t&&!(!e.hasData()||!t.hasData())&&null!=e.demTexture&&null!=t.demTexture&&e.tileID.key!==t.tileID.key}const wi=new class{constructor(){this.operations={}}newMorphing(e,t,i,r,n){if(e in this.operations){const t=this.operations[e];t.to.tileID.key!==i.tileID.key&&(t.queued=i)}else this.operations[e]={startTime:r,phase:0,duration:n,from:t,to:i,queued:null}}getMorphValuesForProxy(e){if(!(e in this.operations))return null;const t=this.operations[e];return{from:t.from,to:t.to,phase:t.phase}}update(e){for(const t in this.operations){const i=this.operations[t];for(i.phase=(e-i.startTime)/i.duration;i.phase>
1=1||!this._validOp(i);)if(!this._nextOp(i,e)){delete this.operations[t];break}}}_nextOp(e,t){return!!e.queued&&(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=t,!0)}_validOp(e){return e.from.hasData()&&e.to.hasData()}},Ti={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Mi(e,t,i){if(0===t)return 0;const r=t<1&&514===i?.25/t:1;return 6*Math.pow(1.5,22-e)*Math.max(t,1)*r}function Ei(e,t){const i=1<<e.z;return!t&&(0===e.x||e.x===i-1)||0===e.y||e.y===i-1}const Si=e=>({u_matrix:e});function Ci(t,i,r,n,o){if(o>0){const s=e.e.now(),a=(s-t.timeAdded)/o,l=i?(s-i.timeAdded)/o:-1,c=r.getSource(),u=n.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!i||Math.abs(i.tileID.overscaledZ-u)>Math.abs(t.tileID.overscaledZ-u),p=h&&t.refreshedUponExpiration?1:e.au(h?a:1-l,0,1);return t.refreshedUponExpiration&&a>=1&&(t.refreshedUponExpiration=!1),i?{opacity:1,mix:1-p}:{opacity:p,mix:0}}return{opacity:1,mix:0}}class Ai extends Ot{constructor(t,i,r,n){super(t,i,r,n),this.type="raster-array",this.maxzoom=22,this._options=e.Q({type:"raster-array"},i)}triggerRepaint(e){const t=this.map.painter._terrain,i=this.map.style.getSourceCache(this.id);t&&t.enabled&&i&&t._clearRenderCacheForTile(i.id,e.tileID),this.map.triggerRepaint()}loadTile(t,i){const r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),n=this.map._requestManager.transformRequest(r,e.R.Tile);t.requestParams=n,t.actor||(t.actor=this.dispatcher.getActor()),t.request=t.fetchHeader(void 0,((e,r,n,o)=>{if(delete t.request,t.aborted)return t.state="unloaded",i(null);if(e){if(20===e.code)return;return t.state="errored",i(e)}this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:n,expires:o}),t.state="empty",i(null)}))}unloadTile(t,i){const r=t.texture;r&&r instanceof e.T?(t.destroy(!0),this.map.painter.saveTileTexture(r)):(t.destroy(),t.flushQueues(),t._isHeaderLoaded=!1,delete t._mrt,delete t.textureDescriptor),t.fbo&&(t.fbo.destroy(),delete t.fbo),delete t.request,delete t.requestParams,delete t.neighboringTiles,t.state="unloaded"}prepareTile(t,i,r){t._isHeaderLoaded&&("empty"!==t.state&&(t.state="reloading"),t.fetchBand(i,r,((i,r)=>{if(i)return t.state="errored",this.fire(new e.f(i)),void this.triggerRepaint(t);r&&(t.setTexture(r,this.map.painter),t.state="loaded",this.triggerRepaint(t))})))}getInitialBand(e){if(!this.rasterLayers)return 0;const t=this.rasterLayers.find((({id:t})=>t===e)),i=t&&t.fields,r=i&&i.bands&&i.bands;return r?r[0]:0}getTextureDescriptor(t,i,r){if(!t)return;const n=i.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!n)return;let o=null;i instanceof e.bm?o=i.paint.get("raster-array-band"):i instanceof e.bn&&(o=i.paint.get("raster-particle-array-band"));const s=o||this.getInitialBand(n);if(null!=s)if(t.textureDescriptor){if(!t.updateNeeded(n,s)||r)return Object.assign({},t.textureDescriptor,{texture:t.texture})}else this.prepareTile(t,n,s)}}const Ii={vector:Dt,raster:Ot,"raster-dem":class extends Ot{constructor(t,i,r,n){super(t,i,r,n),this.type="raster-dem",this.maxzoom=22,this._options=e.Q({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox"}loadTile(t,i){const r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function n(e,r){e&&(t.state="errored",i(e)),r&&(t.dem=r,t.dem.onDeserialize(),t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0,t.state="loaded",i(null))}t.request=e.i(this.map._requestManager.transformRequest(r,e.R.Tile),function(r,o,s,a){if(delete t.request,t.aborted)t.state="unloaded",i(null);else if(r)t.state="errored",i(r);else if(o){this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:s,expires:a});const i=ImageBitmap&&o instanceof ImageBitmap&&e.bk(),r=1-(o.width-e.bl(o.width))/2;r<1||t.neighboringTiles||(t.neighboringTiles=this._getNeighboringTiles(t.tileID));const l=i?o:e.e.getImageData(o,r),c={uid:t.uid,coord:t.tileID,source:this.id,scope:this.scope,rawImageData:l,encoding:this.encoding,padding:r};t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",c,n.bind(this),void 0,!0))}}.bind(this))}_getNeighboringTiles(t){const i=t.canonical,r=Math.pow(2,i.z),n=(i.x-1+r)%r,o=0===i.x?t.wrap-1:t.wrap,s=(i.x+1+r)%r,a=i.x+1===r?t.wrap+1:t.wrap,l={};return l[new e.aQ(t.overscaledZ,o,i.z,n,i.y).key]={backfilled:!1},l[new e.aQ(t.overscaledZ,a,i.z,s,i.y).key]={backfilled:!1},i.y>0&&(l[new e.aQ(t.overscaledZ,o,i.z,n,i.y-1).key]={backfilled:!1},l[new e.aQ(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new e.aQ(t.overscaledZ,a,i.z,s,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new e.aQ(t.overscaledZ,o,i.z,n,i.y+1).key]={backfilled:!1},l[new e.aQ(t.overscaledZ,t.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new e.aQ(t.overscaledZ,a,i.z,s,i.y+1).key]={backfilled:!1}),l}},"raster-array":Ai,geojson:class extends e.E{constructor(t,i,r,n){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=r.getActor(),this.setEventedParent(n),this._data=i.data,this._options=e.Q({},i),this._collectResourceTiming=i.collectResourceTiming,void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),void 0!==i.minzoom&&(this.minzoom=i.minzoom),i.type&&(this.t
vendor: 1,316 bytes, line 1
1ype=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId;const o=e.a4/this.tileSize;this.workerOptions=e.Q({source:this.id,scope:this.scope,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(void 0!==i.buffer?i.buffer:128)*o,tolerance:(void 0!==i.tolerance?i.tolerance:.375)*o,extent:e.a4,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:void 0!==i.clusterMaxZoom?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:e.a4,radius:(void 0!==i.clusterRadius?i.clusterRadius:50)*o,log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter,dynamic:i.dynamic},i.workerOptions)}onAdd(e){this.map=e,this.setData(this._data)}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(t){if(!this._options.dynamic)return this.fire(new e.f(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if("string"!=typeof t&&("Feature"===t.type&&(t={type:"FeatureCollection",features:[t]}),"FeatureCollection"!==t.type))return this.fire(new e.f(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&"string"!=typeof t&&"string"!=typeof this._data&&"FeatureCollection"===this._data.type){const e=new Map;
1for(const t of this._data.features)e.set(t.id,t);for(const i of t.features)e.set(i.id,i);this._data.features=[...e.values()]}else this._data=t;return this._updateWorkerData(!0),this}getClusterExpansionZoom(e,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id,scope:this.scope},t),this}getClusterChildren(e,t){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id,scope:this.scope},t),this}getClusterLeaves(e,t,i,r){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:e,limit:t,offset:i},r),this}_updateWorkerData(t=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new e.g("dataloading",{dataType:"source"})),this._loaded=!1;const i=e.Q({append:t},this.workerOptions);i.scope=this.scope;const r=this._data;"string"==typeof r?(i.request=this.map._requestManager.transformRequest(e.e.resolveURL(r),e.R.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(r),this._pendingLoad=this.actor.send(`${this.type}.loadData`,i,((i,r)=>{if(this._loaded=!0,this._pendingLoad=null,i)this.fire(new e.f(i));else{const i={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&r&&r.resourceTiming&&r.resourceTiming[this.id]&&(i.resourceTiming=r.resourceTiming[this.id]),t&&(this._partialReload=!0),this.fire(new e.g("data",i)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(t),this._coalesce=!1)}))}loaded(){return this._loaded}loadTile(t,i){const r=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const n=this.map.style?this.map.style.getLut(this.scope):null,o=this._partialReload,s={type:this.type,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:n?{image:n.image.clone()}:null,scope:this.scope,pixelRatio:e.e.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,partial:o};t.request=this.actor.send(r,s,((e,n)=>o&&!n?(t.state="loaded",i(null)):(delete t.request,t.destroy(),t.aborted?i(null):e?i(e):(t.loadVectorData(n,this.map.painter,"reloadTile"===r),i(null)))),void 0,"loadTile"===r)}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e,t){this.actor.send("removeTile",{uid:e.uid,type:this.t
1ype,source:this.id,scope:this.scope}),e.destroy()}onRemove(e){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return e.Q({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends e.bo{constructor(e,t,i,r){super(e,t,i,r),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const i of t.urls)this.urls.push(this.map._requestManager.transformRequest(i,e.R.Source).url);e.bp(this.urls,((t,i)=>{this._loaded=!0,t?this.fire(new e.f(t)):i&&(this.video=i,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading())}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const i=this.video.seekable;t<i.start(0)||t>i.end(0)?this.fire(new e.f(new e.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;const t=this.map.painter.context,i=t.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new e.T(t,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(t)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:e.bo,model:class extends e.E{constructor(e,t,i,r){super(),this.id=e,this.type="model",this.models=[],this._loaded=!1,this._options=t}load(){const t=[];for(const i in this._options.models){const r=this._options.models[i],n=e.l(this.map._requestManager.transformRequest(r.uri,e.R.Model).url).then((t=>{if(!t)return;const n=e.c(t),o=new e.M(i,r.position,r.orientation,n);o.computeBoundsAndApplyParent(),this.models.push(o)})).catch((t=>{this.fire(new e.f(new Error(`Could not load model ${i} from ${r.uri}: ${t.message}`)))}));t.push(n)}return Promise.allSettled(t).then((()=>{this._loaded=!0,this.fire(new e.g("data",{dataType:"source",sourceDataType:"metadata"}))})).catch((t=>{this.fire(new e.f(new Error(`Could not load models: ${t.message}`)))}))}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(e,t){}serialize(){return{type:"model"}}},"batched-model":class extends e.E{constructor(e,t,i,r){super(),this.type="batched-model",this.id=e,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=i,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(r)}onAdd(e){this.map=e,this.load()}load(t){this._loaded=!1,this.fire(new e.g("dataloading",{dataType:"source"}));const i=Array.isArray(this.map._language)?this.map._language.join():this.map._language,r=this.map._worldview;this._tileJSONRequest=Rt(this._options,this.map._requestManager,i,r,((n,o)=>{this._tileJSONRequest=null,this._loaded=!0,n?(i&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`),r&&2!==r.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${r}`),this.fire(new e.f(n))):o&&(e.Q(this,o),o.bounds&&(this.tileBounds=new zt(o.bounds,this.minzoom,this.maxzoom)),e.ao(o.tiles,this.map._requestManager._customAccessToken),this.fire(new e.g("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.g("data",{dataType:"source",sourceDataType:"content"}))),t&&t(n)}))}hasTransition(){return!1}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loaded(){return this._loaded}loadTile(t,i){const r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme)),n={request:this.map._requestManager.transformRequest(r,e.R.Tile),data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
1ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0};if(t.actor&&"expired"!==t.state)if("loading"===t.state)t.reloadCallback=i;else{if(t.buckets){const e=Object.values(t.buckets);for(const t of e)t.dirty=!0;return void(t.state="loaded")}t.request=t.actor.send("reloadTile",n,o.bind(this))}else t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",n,o.bind(this),void 0,!0);function o(e,r){return t.aborted?i(null):e&&404!==e.status?i(e):(r&&(r.resourceTiming&&(t.resourceTiming=r.resourceTiming),this.map._refreshExpiredTiles&&t.setExpiryData(r),t.buckets={...t.buckets,...r.buckets},r.featureIndex&&(t.latestFeatureIndex=r.featureIndex)),t.state="loaded",void i(null))}}serialize(){return e.Q({},this._options)}},canvas:class extends e.bo{constructor(t,i,r,n){super(t,i,r,n),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((e=>!Array.isArray(e)||2!==e.length||e.some((e=>"number"!=typeof e))))||this.fire(new e.f(new e.V(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.f(new e.V(`sources.${t}`,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new e.f(new e.V(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new e.f(new e.V(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new e.f(new e.V(`sources.${t}`,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.f(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(e){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(0===Object.keys(this.tiles).length)return;const i=this.map.painter.context;this.texture?!t&&!this._playing||this.texture instanceof e.bq||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.T(i,this.canvas,i.gl.RGBA,{premultiply:!0}),this._prepareData(i)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},custom:class extends e.E{constructor(t,i,r,n){super(),this.id=t,this.type="custom",this._dataType="raster",this._dispatcher=r,this._implementation=i,this.setEventedParent(n),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new e.f(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new e.f(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new zt(this._implementation.bounds,this.minzoom,this.maxzoom)),i.update=this._update.bind(this),i.clearTiles=this._clearTiles.bind(this),i.coveringTiles=this._coveringTiles.bind(this),e.Q(this,e.ai(i,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return e.ai(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new e.g("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.g("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(t){this.map=t,this._loaded=!1,this.fire(new e.g("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(t),this.load()}onRemove(e){this._implementation.onRemove&&this._implementation.onRemove(e)}hasTile(e){if(this._implementation.hasTile){const{x:t,y:i,z:r}=e.canonical;return this._implementation.hasTile({x:t,y:i,z:r})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,t){const{x:i,y:r,z:n}=e.tileID.canonical,o=new AbortController;e.request=Promise.resolve(this._implementation.loadTile({x:i,y:r,z:n},{signal:o.signal})).then(function(i){return delete e.request,e.aborted?(e.state="unloaded",t(null)):void 0===i?(e.state="errored",t(null)):null===i?(this.loadTileData(e,{width:this.tileSize,height:this.tileSize,data:null}),e.state="loaded",t(null)):function(e){return e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof ImageBitmap||e instanceof HTMLImageElement}(i)?(this.loadTileData(e,i),e.state="loaded",void t(null)):(e.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch((i=>{20!==i.code&&(e.state="errored",t(i))})),e.request.cancel=()=>o.abort()}loadTileData(e,t){e.setTexture(t,this.map.painter)}
1unloadTile(t,i){if(t.texture&&t.texture instanceof e.T?(t.destroy(!0),t.texture&&t.texture instanceof e.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),this._implementation.unloadTile){const{x:e,y:i,z:r}=t.tileID.canonical;this._implementation.unloadTile({x:e,y:i,z:r})}i&&i()}abortTile(e,t){e.request&&e.request.cancel&&(e.request.cancel(),delete e.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map((e=>({x:e.canonical.x,y:e.canonical.y,z:e.canonical.z})))}_clearTiles(){const t=e.am(this.id,this.scope);this.map.style.clearSource(t)}_update(){this.fire(new e.g("data",{dataType:"source",sourceDataType:"content"}))}}},ki=function(t,i,r,n){const o=new Ii[i.type](t,i,r,n);if(o.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${o.id}`);return e.br(["load","abort","unload","serialize","prepare"],o),o};class Li extends e.bx{constructor(t){const i={type:"raster-dem",maxzoom:t.transform.maxZoom},r=new e.by(e.bz(),null),n=ki("mock-dem",i,r,t.style);super("mock-dem",n,!1),n.setEventedParent(this),this._sourceLoaded=!0}_loadTile(e,t){e.state="loaded",t(null)}}class Pi extends e.bx{constructor(t){const i=ki("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},new e.by(e.bz(),null),t.style);super("proxy",i,!1),i.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,i,r){if(t.freezeTileCoverage)return;this.transform=t;const n=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce(((i,r)=>{if(i[r.key]="",!this._tiles[r.key]){const i=new e.bA(r,this._source.tileSize*r.overscaleFactor(),t.tileZoom);i.state="loaded",this._tiles[r.key]=i}return i}),{});for(const e in this._tiles)e in n||(this.freeFBO(e),this._tiles[e].unloadVectorData(),delete this._tiles[e])}freeFBO(e){const t=this.proxyCachedFBO[e];if(void 0!==t){const i=Object.values(t);this.renderCachePool.push(...i),delete this.proxyCachedFBO[e]}}deallocRenderCache(){this.renderCache.forEach((e=>e.fb.destroy())),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Ri extends e.aQ{constructor(e,t,i){super(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y),this.proxyTileKey=t,this.projMatrix=i}}class zi extends e.bs{constructor(t,i){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},t.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},(()=>{this._style.map.triggerRepaint()})),t.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},(()=>{this._style.map.triggerRepaint()})),t.tp.registerButton(["Terrain"],"Invalidate Render Cache",(()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()})),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[r,n,o]=function(t){const i=new e.bv,r=new e.bw,n=131;i.reserve(17161),r.reserve(33800);const o=e.a4/128,s=e.a4+o/2,a=s+o;for(let t=-o;t<a;t+=o)for(let r=-o;r<a;r+=o){const n=r<0||r>s||t<0||t>s?24575:0,o=e.au(Math.round(r),0,e.a4),a=e.au(Math.round(t),0,e.a4);i.emplaceBack(o+n,a)}const l=(e,t)=>{const i=t*n+e;r.emplaceBack(i+1,i,i+n),r.emplaceBack(i+n,i+n+1,i+1)};for(let e=1;e<129;e++)for(let t=1;t<129;t++)l(t,e);return[0,129].forEach((e=>{for(let t=0;t<130;t++)l(t,e),l(e,t)})),[i,r,32768]}(),s=t.context;this.gridBuffer=s.createVertexBuffer(r,e.bt.members),this.gridIndexBuffer=s.createIndexBuffer(n),this.gridSegments=e.b.simpleSegment(0,0,r.length,n.length),this.gridNoSkirtSegments=e.b.simpleSegment(0,0,r.length,o),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Pi(i.map),this.orthoMatrix=e.ae.create(),e.ae.ortho(this.orthoMatrix,"globe"===this.painter.transform.projection.name?.015:0,e.a4,0,e.a4,0,1);const a=s.gl;this._overlapStencilMode=new e.ah({func:a.GEQUAL,mask:255},0,255,a.KEEP,a.KEEP,a.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=i,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Li(i.map),this._pendingGroundEffectLayers=[]}set style(e){e.on("data",this._onStyleDataEvent.bind(this)),this._style=e,this._style.map.on("moveend",(()=>{this._clearLineLayersFromRenderCache()}))}update(t,i,r){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const n=t.terrain.properties,o=0===t.terrain.drapeRenderMode,s=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=e.e.now();const a=t.terrain&&t.terrain.scope,l=n.get("source"),c=o?this._mockSourceCache:t.getSourceCache(l,a);if(!c)return void e.w(`Couldn't find terrain source "${l}".`);if(this.sourceCache=c,this._exaggeration=s?this.calculateExaggeration(i):n.get("exaggeration"),!i.projection.requiresDraping&&s&&0===this._exaggeration)return void this._disable();this.enabled=!0;const u=()=>{this.sourceCache.used&&e.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const t=this.getScaledDemTileSize();this.sourceCache.update(i,t,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,u(),this._initializing=!0),u(),i.updateElevation(!0,r),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(i),this._emptyDEMTextureDirty=!0,this._previousZoom=i.zoom}else this._disable()}calculateExaggeration(t){const i=this._previousCameraAltitude,r=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=r;
vendor: 4,325 bytes, line 1
1const n=null!=i?r-i:Number.MAX_VALUE;if(Math.abs(n)<2)return this._exaggeration;const o=t.zoom,s=this._style.terrain;if(!this._previousUpdateTimestamp)return s.getExaggeration(o);let a=o-this._previousZoom;const l=this._previousUpdateTimestamp;let c=o;null!=this._evaluationZoom&&(c=this._evaluationZoom,Math.abs(o-c)>.5&&(a=.5*(o-c+a)),a*n<0&&(c+=a)),this._evaluationZoom=c;const u=s.getExaggeration(c),h=u===s.getExaggeration(Math.max(0,c-.1));if(h&&Math.abs(u-this._exaggeration)<.01)return u;let p=Math.min(.1,.00375*(this._updateTimestamp-l));return(h||u<.1||Math.abs(a)<1e-4)&&(p=Math.min(.2,4*p)),e.a3(this._exaggeration,u,p)}resetTileLookupCache(e){this._findCoveringTileCache[e]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(e){e.coord&&"source"===e.dataType?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):"style"===e.dataType&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const e in this._style._mergedSourceCaches)this._style._mergedSourceCaches[e].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach((e=>e.fb.destroy())),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const e=2*this.proxySourceCache.getSource().tileSize;return[e,e]}set useVertexMorphing(e){this._useVertexMorphing=e}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const i=this.proxySourceCache,r=this.painter.transform;this._initializing&&(this._initializing=0===r._centerAltitude&&-1===this.getAtPointOrZero(e._.fromLngLat(r.center),-1),this._emptyDEMTextureDirty=!this._initializing);const n=this.proxyCoords=i.getIds().map((e=>{const t=i.getTileByID(e).tileID;return t.projMatrix=r.calculateProjMatrix(t.toUnwrapped()),t}));!function(t,i){const r=i.transform.pointCoordinate(i.transform.getCameraPoint()),n=new e.P(r.x,r.y);t.sort(((t,i)=>{if(i.overscaledZ-t.overscaledZ)return i.overscaledZ-t.overscaledZ;const r=new e.P(t.canonical.x+(1<<t.canonical.z)*t.wrap,t.canonical.y),o=new e.P(i.canonical.x+(1<<i.canonical.z)*i.wrap,i.canonical.y),s=n.mult(1<<t.canonical.z);return s.x-=.5,s.y-=.5,s.distSqr(r)-s.distSqr(o)}))}(n,this.painter);const o=this.proxyToSource||{};this.proxyToSource={},n.forEach((e=>{this.proxyToSource[e.key]={}})),this.terrainTileForTile={};const s=this._style._mergedSourceCaches;for(const e in s){const i=s[e];if(!i.used)continue;if(i!==this.sourceCache&&this.resetTileLookupCache(i.id),this._setupProxiedCoordsForOrtho(i,t[e],o),i.usedForTerrain)continue;const r=t[e];i.getSource().reparseOverscaled&&this._assignTerrainTiles(r)}this.proxiedCoords[i.id]=n.map((e=>new Ri(e,e.key,this.orthoMatrix))),this._assignTerrainTiles(n),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(o),this.renderingToTexture=!1;const a={};this._visibleDemTiles=[];for(const e of this.proxyCoords){const t=this.terrainTileForTile[e.key];if(!t)continue;const i=t.tileID.key;i in a||(this._visibleDemTiles.push(t),a[i]=i)}}_assignTerrainTiles(e){this._initializing||e.forEach((e=>{if(this.terrainTileForTile[e.key])return;const t=this._findTileCoveringTileID(e,this.sourceCache);t&&(this.terrainTileForTile[e.key]=t)}))}_prepareDEMTextures(){const e=this.painter.context,t=e.gl;for(const i in this.terrainTileForTile){const r=this.terrainTileForTile[i],n=r.dem;!n||r.demTexture&&!r.needsDEMTextureUpload||(e.activeTexture.set(t.TEXTURE1),Lt(this.painter,r,n))}}_prepareDemTileUniforms(e,t,i,r){if(!t||null==t.demTexture)return!1;const n=e.tileID.canonical,o=Math.pow(2,t.tileID.canonical.z-n.z),s=r||"";return i[`u_dem_tl${s}`]=[n.x*o%1,n.y*o%1],i[`u_dem_scale${s}`]=o,!0}
vendor: 4,060 bytes, line 1
1get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let e=0;const t=this._visibleDemTiles.reduce(((t,i)=>{if(!i.dem)return t;const r=i.dem.tree.minimums[0];return r>0&&e++,t+r}),0);return e?t/e:0}_updateEmptyDEMTexture(){const t=this.painter.context,i=t.gl;t.activeTexture.set(i.TEXTURE2);const r=this._getLoadedAreaMinimum(),[n,o]=(()=>{const t=new e.bB({width:1,height:1},new Float32Array([r]));return[i.R32F,t]})();this._emptyDEMTextureDirty=!1;let s=this._emptyDEMTexture;return s?s.update(o,{premultiply:!1}):s=this._emptyDEMTexture=new e.T(t,o,n,{premultiply:!1}),s}setupElevationDraw(t,i,r){const n=this.painter.context,o=n.gl,s={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};s.u_exaggeration=this.exaggeration();let a=null,l=null,c=1;if(r&&r.morphing&&this._useVertexMorphing){const e=r.morphing.srcDemTile,i=r.morphing.dstDemTile;c=r.morphing.phase,e&&i&&(this._prepareDemTileUniforms(t,e,s,"_prev")&&(l=e),this._prepareDemTileUniforms(t,i,s)&&(a=i))}const u=e=>e&&e.demTexture&&this.painter.linearFloatFilteringSupported()?o.LINEAR:o.NEAREST;let h=null;var p;if(this.enabled?l&&a?(h=a.demTexture,n.activeTexture.set(o.TEXTURE4),l.demTexture.bind(u(l),o.CLAMP_TO_EDGE),s.u_dem_lerp=c):(a=this.terrainTileForTile[t.tileID.key],h=this._prepareDemTileUniforms(t,a,s)?a.demTexture:this.emptyDEMTexture):h=this.emptyDEMTexture,n.activeTexture.set(o.TEXTURE2),h&&(s.u_dem_size=1===(p=h).size[0]?1:p.size[0]-2,h.bind(u(a),o.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(r&&r.useDepthForOcclusion,i,s),r&&r.useMeterToDem&&a){const t=(1<<a.tileID.canonical.z)*e.ay(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;s.u_meter_to_dem=t}if(r&&r.labelPlaneMatrixInv&&(s.u_label_plane_matrix_inv=r.labelPlaneMatrixInv),i.setTerrainUniformValues(n,s),"globe"===this.painter.transform.projection.name){const e=this.globeUniformValues(this.painter.transform,t.tileID.canonical,r&&r.useDenormalizedUpVectorScale);i.setGlobeUniformValues(n,e)}}globeUniformValues(t,i,r){const n=t.projection;return{u_tile_tl_up:n.upVector(i,0,0),u_tile_tr_up:n.upVector(i,e.a4,0),u_tile_br_up:n.upVector(i,e.a4,e.a4),u_tile_bl_up:n.upVector(i,0,e.a4),u_tile_up_scale:r?e.bu(1):n.upVectorScale(i,t.center.lat,t.worldSize).metersToTile}}renderToBackBuffer(t){const i=this.painter,r=this.painter.context;0!==t.length&&(r.bindFramebuffer.set(null),r.viewport.set([0,0,i.width,i.height]),i.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(t,i,r,n,o){if("globe"===t.transform.projection.name)!function(t,i,r,n,o){const s=t.context,a=s.gl;let l,c;const u=t.transform,h=e.bc(t,s,u),p=(e,i)=>{if(c===i)return;const r=[Ti[i],"PROJECTION_GLOBE_VIEW"];h&&r.push("CUSTOM_ANTIALIASING");const n=t.isTileAffectedByFog(e);l=t.getOrCreateProgram("globeRaster",{defines:r,overrideFog:n}),c=i},d=t.colorModeForRenderPass(),f=new e.af(a.LEQUAL,e.af.ReadWrite,t.depthRangeFor3D);wi.update(o);const m=e.bd(u),_=[e.ak(u.center.lng),e.al(u.center.lat)],g=t.globeSharedBuffers,y=[u.width*e.e.devicePixelRatio,u.height*e.e.devicePixelRatio],v=Float32Array.from(u.globeMatrix),x={useDenormalizedUpVectorScale:!0};{const u=t.transform,h=Mi(u.zoom,i.exaggeration(),i.sourceCache._source.tileSize);c=-1;const b=a.TRIANGLES;for(const c of n){const n=r.getTile(c),w=e.ah.disabled,T=i.prevTerrainTileForTile[c.key],M=i.terrainTileForTile[c.key];bi(T,M)&&wi.newMorphing(c.key,T,M,o,250),s.activeTexture.set(a.TEXTURE0),n.texture&&n.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const E=wi.getMorphValuesForProxy(c.key),S=E?1:0;E&&e.q(x,{morphing:{srcDemTile:E.from,dstDemTile:E.to,phase:e.bb(E.phase)}});const C=e.be(c.canonical),A=e.bf(C.getCenter().lat),I=e.bg(c.canonical,C,A,u.worldSize/u._pixelsPerMercatorPixel),k=e.bh(e.bi(c.canonical)),L=Bt
vendor: 10,111 bytes, line 1
1(u.expandedFarZProjMatrix,v,m,k,e.a2(u.zoom),_,u.frustumCorners.TL,u.frustumCorners.TR,u.frustumCorners.BR,u.frustumCorners.BL,u.globeCenterInViewSpace,u.globeRadius,y,h,u._farZ,I);if(p(c,S),l&&(i.setupElevationDraw(n,l,x),t.uploadCommonUniforms(s,l,c.toUnwrapped()),g)){const[i,r,n]=g.getGridBuffers(A,0!==h);l.draw(t,b,f,w,d,e.ag.backCCW,L,"globe_raster",i,r,n)}}}if(g&&(t.renderDefaultNorthPole||t.renderDefaultSouthPole)){const o=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];h&&o.push("CUSTOM_ANTIALIASING"),l=t.getOrCreateProgram("globeRaster",{defines:o});for(const o of n){const{x:n,y:c,z:h}=o.canonical,p=0===c,m=c===(1<<h)-1,[v,b,w,T]=g.getPoleBuffers(h,!1);if(T&&(p||m)){const c=r.getTile(o);s.activeTexture.set(a.TEXTURE0),c.texture&&c.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);let g=e.bj(h,n,u);const M=e.bh(e.bi(o.canonical)),E=(i,r)=>i.draw(t,a.TRIANGLES,f,e.ah.disabled,d,e.ag.disabled,Bt(u.expandedFarZProjMatrix,g,g,M,0,_,u.frustumCorners.TL,u.frustumCorners.TR,u.frustumCorners.BR,u.frustumCorners.BL,u.globeCenterInViewSpace,u.globeRadius,y,0,u._farZ),"globe_pole_raster",r,w,T);i.setupElevationDraw(c,l,x),t.uploadCommonUniforms(s,l,o.toUnwrapped()),p&&t.renderDefaultNorthPole&&E(l,v),m&&t.renderDefaultSouthPole&&(g=e.ae.scale(e.ae.create(),g,[1,-1,1]),E(l,b))}}}}(t,i,r,n,o);else{const s=t.context,a=s.gl;let l,c;const u=t.shadowRenderer,h=pi(t,t.longestCutoffRange),p=e=>{if(c===e)return;const i=[];i.push(Ti[e]),h.shouldRenderCutoff&&i.push("RENDER_CUTOFF"),l=t.getOrCreateProgram("terrainRaster",{defines:i}),c=e},d=t.colorModeForRenderPass(),f=new e.af(a.LEQUAL,e.af.ReadWrite,t.depthRangeFor3D);wi.update(o);const m=t.transform,_=Mi(m.zoom,i.exaggeration(),i.sourceCache._source.tileSize);let g=[0,0,0];if(u){const e=t.style.directionalLight,i=t.style.ambientLight;e&&i&&(g=vi(t.style,e,i))}{c=-1;const y=a.TRIANGLES,[v,x]=[i.gridIndexBuffer,i.gridSegments];for(const c of n){const n=r.getTile(c),b=e.ah.disabled,w=i.prevTerrainTileForTile[c.key],T=i.terrainTileForTile[c.key];bi(w,T)&&wi.newMorphing(c.key,w,T,o,250),s.activeTexture.set(a.TEXTURE0),n.texture&&n.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const M=wi.getMorphValuesForProxy(c.key),E=M?1:0;let S;M&&(S={morphing:{srcDemTile:M.from,dstDemTile:M.to,phase:e.bb(M.phase)}});const C=Ft(c.projMatrix,Ei(c.canonical,m.renderWorldCopies)?_/10:_,g);if(p(E),!l)continue;i.setupElevationDraw(n,l,S);const A=c.toUnwrapped();u&&u.setupShadows(A,l),t.uploadCommonUniforms(s,l,A,null,h),l.draw(t,y,f,b,d,e.ag.backCCW,C,"terrain_raster",i.gridBuffer,v,x)}}}}(i,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,i.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(0===this._drapedRenderBatches.length)return t+1;this.renderingToTexture=!0;const i=this.painter,r=this.painter.context,n=this.proxySourceCache,o=this.proxiedCoords[n.id],s=this._drapedRenderBatches.shift(),a=i.style.order,l=[];let c=0;for(const u of o){const o=n.getTileByID(u.proxyTileKey),h=n.proxyCachedFBO[u.key]?n.proxyCachedFBO[u.key][t]:void 0,p=void 0!==h?n.renderCache[h]:this.pool[c++],d=void 0!==h;if(o.texture=p.tex,d&&!p.dirty){l.push(o.tileID);continue}let f;r.bindFramebuffer.set(p.fb.framebuffer),this.renderedToTile=!1,p.dirty&&(r.clear({color:e.C.transparent,stencil:0}),p.dirty=!1);for(let e=s.start;e<=s.end;++e){const t=i.style._mergedLayers[a[e]];if(t.isHidden(i.transform.zoom))continue;const n=i.style.getLayerSourceCache(t),o=n?this.proxyToSource[u.key][n.id]:[u];if(!o)continue;const s=o;r.viewport.set([0,0,p.fb.width,p.fb.height]),f!==(n?n.id:null)&&(this._setupStencil(p,o,t,n),f=n?n.id:null),i.renderLayer(i,n,t,s)}if(0===this._drapedRenderBatches.length)for(const e of this._pendingGroundEffectLayers){const t=i.style._mergedLayers[a[e]];if(t.isHidden(i.transform.zoom))continue;const n=i.style.getLayerSourceCache(t),o=n?this.proxyToSource[u.key][n.id]:[u];if(!o)continue;const s=o;r.viewport.set([0,0,p.fb.width,p.fb.height]),f!==(n?n.id:null)&&(this._setupStencil(p,o,t,n),f=n?n.id:null),i.renderLayer(i,n,t,s)}this.renderedToTile?(p.dirty=!0,l.push(o.tileID)):d||--c,5===c&&(c=0,this.renderToBackBuffer(l))}return this.renderToBackBuffer(l),this.renderingToTexture=!1,r.bindFramebuffer.set(null),r.viewport.set([0,0,i.width,i.height]),s.end+1}postRender(){}isLayerOrderingCorrect(e){const t=e.order.length;let i=-1,r=t;for(let n=0;n<t;++n)this._style.isLayerDraped(e._mergedLayers[e.order[n]])?i=Math.max(i,n):r=Math.min(r,n);return r>i}getMinElevationBelowMSL(){let e=0;return this._visibleDemTiles.filter((e=>e.dem)).forEach((t=>{e=Math.min(e,t.dem.tree.minimums[0])})),0===e?e:(e-30)*this._exaggeration}raycast(e,t,i){if(!this._visibleDemTiles)return null;const r=this._visibleDemTiles.filter((e=>e.dem)).map((r=>{const n=r.tileID,o=1<<n.overscaledZ,{x:s,y:a}=n.canonical,l=s/o,c=(s+1)/o,u=a/o,h=(a+1)/o;return{minx:l,miny:u,maxx:c,maxy:h,t:r.dem.tree.raycastRoot(l,u,c,h,e,t,i),tile:r}}));r.sort(((e,t)=>(null!==e.t?e.t:Number.MAX_VALUE)-(null!==t.t?t.t:Number.MAX_VALUE)));for(const n of r){if(null==n.t)return null;const r=n.tile.dem.tree.raycast(n.minx,n.miny,n.maxx,n.maxy,e,t,i);if(null!=r)return r}return null}_createFBO(){const t=this.painter.context,i=t.gl,r=this.drapeBufferSize;t.activeTexture.set(i.TEXTURE0);const n=new e.T(t,{width:r[0],height:r[1],data:null},i.RGBA);n.bind(i.LINEAR,i.CLAMP_TO_EDGE);const o=t.createFramebuffer(r[0],r[1],!0,null);return o.colorAttachment.set(n.texture),o.depthAttachment=new ie(t,o.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,r[0],r[1]),this._stencilRef=0,o.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):o.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&i.texParameterf(i.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:o,tex:n,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache)return!0;if(this._style.hasLightTransitions())return!0;for(const e in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[e].hasTransition())return!0;return this._style.order.some((e=>{const t=this._style._mergedLayers[e],i=t.isHidden(this.painter.transform.zoom);return"custom"===t.type?!i&&t.shouldRedrape():!i&&t.hasTransition()}))}_clearLineLayersFromRenderCache(){let t=!1;for(const e of this._style.getSources())if(e instanceof Dt){t=!0;break}if(!t)return;const i={};for(let t=0;t<this._style.order.length;++t){const r=this._style._mergedLayers[this._style.order[t]],n=this._style.getLayerSourceCache(r);if(n&&!i[n.id]&&!r.isHidden(this.painter.transform.zoom)&&"line"===r.type&&r.widthExpression()instanceof e.Z){i[n.id]=!0;for(const e of this.proxyCoords){const t=this.proxyToSource[e.key][n.id];if(t)for(const e of t)this._clearRenderCacheForTile(n.id,e)}}}}_clearRasterLayersFromRenderCache(){let e=!1;for(const t in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[t]._source instanceof Ot){e=!0;break}if(!e)return;const t={};for(let e=0;e<this._style.order.length;++e){const i=this._style._mergedLayers[this._style.order[e]],r=this._style.getLayerSourceCache(i);if(!r||t[r.id])continue;if(i.isHidden(this.painter.transform.zoom)||"raster"!==i.type)continue;const n=i.paint.get("raster-fade-duration");for(const e of this.proxyCoords){const t=this.proxyToSource[e.key][r.id];if(t)for(const e of t){const t=Ci(r.getTile(e),r.findLoadedParent(e,0),r,this.painter.transform,n);(1!==t.opacity||0!==t.mix)&&this._clearRenderCacheForTile(r.id,e)}}}}_setupDrapedRenderBatches(){const t=this._style.order,i=t.length;if(0===i)return;const r=[];this._pendingGroundEffectLayers=[];let n,o=0,s=this._style._mergedLayers[t[o]];for(;!this._style.isLayerDraped(s)&&s.isHidden(this.painter.transform.zoom)&&++o<i;)s=this._style._mergedLayers[t[o]];for(;o<i;++o){const e=this._style._mergedLayers[t[o]];e.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(e)?void 0===n&&(n=o):("fill-extrusion"===e.type&&this._pendingGroundEffectLayers.push(o),void 0!==n&&(r.push({start:n,end:o-1}),n=void 0)))}if(void 0!==n&&r.push({start:n,end:o-1}),0!==r.length){const t=r[r.length-1];this._pendingGroundEffectLayers.every((e=>e>t.end))||e.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=r}_setupRenderCache(e){const t=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,t.renderCache.length>t.renderCachePool.length){const e=Object.values(t.proxyCachedFBO);t.proxyCachedFBO={};for(let i=0;i<e.length;++i){const r=Object.values(e[i]);t.renderCachePool.push(...r)}}return}this._clearRasterLayersFromRenderCache();const i=this.proxyCoords,r=this._tilesDirty;for(let n=i.length-1;n>=0;n--){const o=i[n];if(t.getTileByID(o.key),void 0!==t.proxyCachedFBO[o.key]){const i=e[o.key],n=this.proxyToSource[o.key];let s=0;for(const e in n){const t=n[e],o=i[e];if(!o||o.length!==t.length||t.some(((t,i)=>t!==o[i]||r[e]&&r[e].hasOwnProperty(t.key)))){s=-1;break}++s}for(const e in t.proxyCachedFBO[o.key])t.renderCache[t.proxyCachedFBO[o.key][e]].dirty=s<0||s!==Object.values(i).length}}const n=[...this._drapedRenderBatches];n.sort(((e,t)=>t.end-t.start-(e.end-e.start)));for(const e of n)for(const r of i){if(t.proxyCachedFBO[r.key])continue;let i=t.renderCachePool.pop();void 0===i&&t.renderCache.length<50&&(i=t.renderCache.length,t.renderCache.push(this._createFBO())),void 0!==i&&(t.proxyCachedFBO[r.key]={},t.proxyCachedFBO[r.key][e.start]=i,t.renderCache[i].dirty=!0)}this._tilesDirty={}}_setupStencil(e,t,i,r){if(!r||!this._sourceTilesOverlap[r.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const n=this.painter.context,o=n.gl;if(t.length<=1)return void(this._overlapStencilType=!1);let s;if(i.isTileClipped())s=t.length,this._overlapStencilMode.test={func:o.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(t[0].overscaledZ>
vendor: 4,980 bytes, line 1
1t[t.length-1].overscaledZ))return void(this._overlapStencilType=!1);s=1,this._overlapStencilMode.test={func:o.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+s>255&&(n.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=s,this._overlapStencilMode.ref=this._stencilRef,i.isTileClipped()&&this._renderTileClippingMasks(t,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(t){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):e.ah.disabled}_renderTileClippingMasks(t,i){const r=this.painter,n=this.painter.context,o=n.gl;r._tileClippingMaskIDs={},n.setColorMode(e.a.disabled),n.setDepthMode(e.af.disabled);const s=r.getOrCreateProgram("clippingMask");for(const n of t){const t=r._tileClippingMaskIDs[n.key]=--i;s.draw(r,o.TRIANGLES,e.af.disabled,new e.ah({func:o.ALWAYS,mask:0},t,255,o.KEEP,o.KEEP,o.REPLACE),e.a.disabled,e.ag.disabled,Si(n.projMatrix),"$clipping",r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments)}}pointCoordinate(t){const i=this.painter.transform;if(t.x<0||t.x>i.width||t.y<0||t.y>i.height)return null;const r=[t.x,t.y,1,1];e.aB.transformMat4(r,r,i.pixelMatrixInverse),e.aB.scale(r,r,1/r[3]),r[0]/=i.worldSize,r[1]/=i.worldSize;const n=i._camera.position,o=e.ay(1,i.center.lat),s=[n[0],n[1],n[2]/o,0],a=e.$.subtract([],r.slice(0,3),s);e.$.normalize(a,a);const l=this.raycast(s,a,this._exaggeration);return null!==l&&l?(e.$.scaleAndAdd(s,s,a,l),s[3]=s[2],s[2]*=o,s):null}_setupProxiedCoordsForOrtho(t,i,r){if(t.getSource()instanceof e.bo)return this._setupProxiedCoordsForImageSource(t,i,r);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const n=this.proxiedCoords[t.id]=[],o=this.proxyCoords;for(let e=0;e<o.length;e++){const i=o[e],s=this._findTileCoveringTileID(i,t);if(s){const e=this._createProxiedId(i,s,r[i.key]&&r[i.key][t.id]);n.push(e),this.proxyToSource[i.key][t.id]=[e]}}let s=!1;const a=new Set;for(let e=0;e<i.length;e++){const o=t.getTile(i[e]);if(!o||!o.hasData())continue;const l=this._findTileCoveringTileID(o.tileID,this.proxySourceCache);if(l&&l.tileID.canonical.z!==o.tileID.canonical.z){const e=this.proxyToSource[l.tileID.key][t.id],i=this._createProxiedId(l.tileID,o,r[l.tileID.key]&&r[l.tileID.key][t.id]);e?e.splice(e.length-1,0,i):this.proxyToSource[l.tileID.key][t.id]=[i];const c=this.proxyToSource[l.tileID.key][t.id];a.has(c)||a.add(c),n.push(i),s=!0}}if(this._sourceTilesOverlap[t.id]=s,s&&this._debugParams.sortTilesHiZFirst)for(const e of a)e.sort(((e,t)=>t.overscaledZ-e.overscaledZ))}_setupProxiedCoordsForImageSource(t,i,r){if(!t.getSource().loaded())return;const n=this.proxiedCoords[t.id]=[],o=this.proxyCoords,s=t.getSource(),a=s.tileID;if(!a)return;const l=new e.P(a.x,a.y)._div(1<<a.z),c=s.coordinates.map(e._.fromLngLat).reduce(((e,t)=>(e.min.x=Math.min(e.min.x,t.x-l.x),e.min.y=Math.min(e.min.y,t.y-l.y),e.max.x=Math.max(e.max.x,t.x-l.x),e.max.y=Math.max(e.max.y,t.y-l.y),e)),{min:new e.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new e.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),u=(t,i)=>{const r=t.wrap+t.canonical.x/(1<<t.canonical.z),n=t.canonical.y/(1<<t.canonical.z),o=e.a4/(1<<t.canonical.z),s=i.wrap+i.canonical.x/(1<<i.canonical.z),a=i.canonical.y/(1<<i.canonical.z);return r+o<s+c.min.x||r>s+c.max.x||n+o<a+c.min.y||n>a+c.max.y};for(let e=0;e<o.length;e++){const s=o[e];for(let e=0;e<i.length;e++){const o=t.getTile(i[e]);if(!o||!o.hasData())continue;if(u(s,o.tileID))continue;const a=this._createProxiedId(s,o,r[s.key]&&r[s.key][t.id]),l=this.proxyToSource[s.key][t.id];l?l.push(a):this.proxyToSource[s.key][t.id]=[a],n.push(a)}}}_createProxiedId(t,i,r){let n=this.orthoMatrix;if(r){const e=r.find((e=>e.key===i.tileID.key));if(e)return e}if(i.tileID.key!==t.key){const r=t.canonical.z-i.tileID.canonical.z;let o,s,a;n=e.ae.create();const l=i.tileID.wrap-t.wrap<<t.overscaledZ;r>0?(o=e.a4>>r,s=o*((i.tileID.canonical.x<<r)-t.canonical.x+l),a=o*((i.tileID.canonical.y<<r)-t.canonical.y)):(o=e.a4<<-r,s=e.a4*(i.tileID.canonical.x-(t.canonical.x+l<<-r)),a=e.a4*(i.tileID.canonical.y-(t.canonical.y<<-r))),e.ae.ortho(n,0,o,0,o,0,1),e.ae.translate(n,n,[s,a,0])}return new Ri(i.tileID,t.key,n)}_findTileCoveringTileID(t,i){let r=i.getTile(t);if(r&&r.hasData())return r;const n=this._findCoveringTileCache[i.id],o=n[t.key];if(r=o?i.getTileByID(o):null,r&&r.hasData()||null===o)return r;let s=r?r.tileID:t,a=s.overscaledZ;const l=i.getSource().minzoom,c=[];if(!o){const n=i.getSource().maxzoom;if(t.canonical.z>=n){const r=t.canonical.z-n;i.getSource().reparseOverscaled?(a=Math.max(t.canonical.z+2,i.transform.tileZoom),s=new e.aQ(a,t.wrap,n,t.canonical.x>>r,t.canonical.y>>r)):0!==r&&(a=n,s=new e.aQ(a,t.wrap,n,t.canonical.x>>r,t.canonical.y>>r))}s.key!==t.key&&(c.push(s.key),r=i.getTile(s))}const u=e=>
1{c.forEach((t=>{n[t]=e})),c.length=0};for(a-=1;a>=l&&(!r||!r.hasData());a--){r&&u(r.tileID.key);const e=s.calculateScaledKey(a);if(r=i.getTileByID(e),r&&r.hasData())break;const t=n[e];if(null===t)break;void 0===t?c.push(e):r=i.getTileByID(t)}return u(r?r.tileID.key:null),r&&r.hasData()?r:null}findDEMTileFor(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(e,t){let i=this._tilesDirty[e];i||(i=this._tilesDirty[e]={}),i[t.key]=!0}}function Oi(t,i,r){const n=function(t,i,r){const n=e.$.dot(i,t),o=e.$.dot(r,[.2126,.7152,.0722]),s=(e,t,i)=>(1-i)*e+i*t,a=s(1-.3*Math.min(o,1),1,Math.min(n+1,1));return s(.92,1,Math.asin(e.au(i[2],-1,1))/Math.PI+.5)*a}(t,[0,0,1],i),o=[0,0,0];e.$.scale(o,r.slice(0,3),n);const s=[0,0,0];e.$.scale(s,i.slice(0,3),t[2]);const a=[0,0,0];return e.$.add(a,o,s),e.ba(a)}const Di=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],Fi=["stars","fillExtrusion","fillExtrusionGroundEffect","model","symbolSDF","symbolIcon","symbolTextAndIcon"];class Bi{static cacheKey(e,t,i,r){let n=`${t}${r?r.cacheKey:""}`;for(const t of i)e.usedDefines.includes(t)&&(n+=`/${t}`);return n}constructor(t,i,r,n,o,s){const a=t.gl;this.program=a.createProgram(),this.configuration=n,this.name=i,this.fixedDefines=[...s];const l=n?n.getBinderAttributes():[],c=(r.staticAttributes||[]).concat(l);let u=n?n.defines():[];u=u.concat(s.map((e=>`#define ${e}`)));const h="#version 300 es\n";let p=h+u.concat("precision mediump float;",Mt,Tt.fragmentSource).join("\n");for(const e of r.fragmentIncludes)p+=`\n${bt[e]}`;p+=`\n${r.fragmentSource}`;let d=h+u.concat("precision highp float;",Mt,Tt.vertexSource).join("\n");for(const e of r.vertexIncludes)d+=`\n${bt[e]}`;d+=`\n${r.vertexSource}`;const f=a.createShader(a.FRAGMENT_SHADER);if(a.isContextLost())return void(this.failedToCreate=!0);a.shaderSource(f,p),a.compileShader(f),a.attachShader(this.program,f);const m=a.createShader(a.VERTEX_SHADER);if(a.isContextLost())this.failedToCreate=!0;else{a.shaderSource(m,d),a.compileShader(m),a.attachShader(this.program,m),this.attributes={},this.numAttributes=c.length;for(let e=0;e<this.numAttributes;e++)if(c[e]){const t=c[e].startsWith("a_")?c[e]:`a_${c[e]}`;a.bindAttribLocation(this.program,e,t),this.attributes[t]=e}a.linkProgram(this.program),a.deleteShader(m),a.deleteShader(f),this.fixedUniforms=o(t),this.binderUniforms=n?n.getUniforms(t):[],(s.includes("TERRAIN")||-1!==i.indexOf("symbol")||-1!==i.indexOf("circle"))&&(this.terrainUniforms=(t=>({u_dem:new e.a8(t),u_dem_prev:new e.a8(t),u_dem_tl:new e.a9(t),u_dem_scale:new e.ab(t),u_dem_tl_prev:new e.a9(t),u_dem_scale_prev:new e.ab(t),u_dem_size:new e.ab(t),u_dem_lerp:new e.ab(t),u_exaggeration:new e.ab(t),u_depth:new e.a8(t),u_depth_size_inv:new e.a9(t),u_depth_range_unpack:new e.a9(t),u_occluder_half_size:new e.ab(t),u_occlusion_depth_offset:new e.ab(t),u_meter_to_dem:new e.ab(t),u_label_plane_matrix_inv:new e.a7(t)}))(t)),s.includes("GLOBE")&&(this.globeUniforms=(t=>({u_tile_tl_up:new e.ar(t),u_tile_tr_up:new e.ar(t),u_tile_br_up:new e.ar(t),u_tile_bl_up:new e.ar(t),u_tile_up_scale:new e.ab(t)}))(t)),s.includes("FOG")&&(this.fogUniforms=(t=>({u_fog_matrix:new e.a7(t),u_fog_range:new e.a9(t),u_fog_color:new e.at(t),u_fog_horizon_blend:new e.ab(t),u_fog_vertical_limit:new e.a9(t),u_fog_temporal_offset:new e.ab(t),u_frustum_tl:new e.ar(t),u_frustum_tr:new e.ar(t),u_frustum_br:new e.ar(t),u_frustum_bl:new e.ar(t),u_globe_pos:new e.ar(t),u_globe_radius:new e.ab(t),u_globe_transition:new e.ab(t),u_is_globe:new e.a8(t),u_viewport:new e.a9(t)}))(t)),s.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(t=>({u_cutoff_params:new e.at(t)}))(t)),s.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(t=>({u_lighting_ambient_color:new e.ar(t),u_lighting_directional_dir:new e.ar(t),u_lighting_directional_color:new e.ar(t),u_ground_radiance:new e.ar(t)}))(t)),s.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(t=>({u_light_matrix_0:new e.a7(t),u_light_matrix_1:new e.a7(t),u_fade_range:new e.a9(t),u_shadow_normal_offset:new e.ar(t),u_shadow_intensity:new e.ab(t),u_shadow_texel_size:new e.ab(t),u_shadow_map_resolution:new e.ab(t),u_shadow_direction:new e.ar(t),u_shadow_bias:new e.ar(t),u_shadowmap_0:new e.a8(t),u_shadowmap_1:new e.a8(t)}))(t))}}setTerrainUniformValues(e,t){if(!this.terrainUniforms)return;const i=this.terrainUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e])}}setGlobeUniformValues(e,t){if(!this.globeUniforms)return;const i=this.globeUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e]&&i[e].set(this.program,e,t[e])}}setFogUniformValues(e,t){if(!this.fogUniforms)return;const i=this.fogUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}setCutoffUniformValues(e,t){if(!this.cutoffUniforms)return;const i=this.cutoffUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}setLightsUniformValues(e,t){if(!this.lightsUniforms)return;const i=this.lightsUniforms;if(!this.failedToCreate){e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}}setShadowUniformValues(e,t){if(this.failedToCreate||!this.shadowUniforms)return;const i=this.shadowUniforms;e.program.set(this.program);for(const e in t)i[e].set(this.program,e,t[e])}_drawDebugWireframe(t,i,r,n,o,s,a,l,c,u){const h=t.options.wireframe;if(!1===h.terrain&&!1===h.layers2D&&!1===h.layers3D)return;const p=t.context;if(!(()=>!(!h.terrain||"terrainRaster"!==this.name&&"globeRaster"!==this.name)||!(!h.layers2D||t._terrain&&t._terrain.renderingToTexture||!Di.includes(this.name))||!(!h.layers3D||!Fi.includes(this.name)))())return;const d=p.gl,f=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,o,p);if(!f)return;const m=[...this.fixedDefines];
1m.push("DEBUG_WIREFRAME");const _=t.getOrCreateProgram(this.name,{config:this.configuration,defines:m});p.program.set(_.program);const g=(e,t,i)=>{if(t[e]&&i[e])for(const r in t[e])i[e][r]&&i[e][r].set(i.program,r,t[e][r].current)};c&&c.setUniforms(_.program,p,_.binderUniforms,a,{zoom:l}),g("fixedUniforms",this,_),g("terrainUniforms",this,_),g("globeUniforms",this,_),g("fogUniforms",this,_),g("lightsUniforms",this,_),g("shadowUniforms",this,_),f.bind(),p.setColorMode(new e.a([d.ONE,d.ONE_MINUS_SRC_ALPHA,d.ZERO,d.ONE],e.C.transparent,[!0,!0,!0,!1])),p.setDepthMode(new e.af(i.func===d.LESS?d.LEQUAL:i.func,e.af.ReadOnly,i.range)),p.setStencilMode(e.ah.disabled);const y=3*s.primitiveLength*2,v=3*s.primitiveOffset*2*2;u&&u>1?d.drawElementsInstanced(d.LINES,y,d.UNSIGNED_SHORT,v,u):d.drawElements(d.LINES,y,d.UNSIGNED_SHORT,v),o.bind(),p.program.set(this.program),p.setDepthMode(i),p.setStencilMode(r),p.setColorMode(n)}draw(e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m){const _=e.context,g=_.gl;if(this.failedToCreate)return;_.program.set(this.program),_.setDepthMode(i),_.setStencilMode(r),_.setColorMode(n),_.setCullFace(o);for(const e of Object.keys(this.fixedUniforms))this.fixedUniforms[e].set(this.program,e,s[e]);d&&d.setUniforms(this.program,_,this.binderUniforms,h,{zoom:p});const y={[g.POINTS]:1,[g.LINES]:2,[g.TRIANGLES]:3,[g.LINE_STRIP]:1}[t],v=m&&m>0?1:void 0;for(const o of u.get()){const s=o.vaos||(o.vaos={});(s[a]||(s[a]=new At)).bind(_,this,l,d?d.getPaintVertexBuffers():[],c,o.vertexOffset,f||[],v),m&&m>1?g.drawElementsInstanced(t,o.primitiveLength*y,g.UNSIGNED_SHORT,o.primitiveOffset*y*2,m):c?g.drawElements(t,o.primitiveLength*y,g.UNSIGNED_SHORT,o.primitiveOffset*y*2):g.drawArrays(t,o.vertexOffset,o.vertexLength),t===g.TRIANGLES&&c&&this._drawDebugWireframe(e,i,r,n,c,o,h,p,d,m)}}}function Ni(t,i){const r=Math.pow(2,i.tileID.overscaledZ),n=i.tileSize*Math.pow(2,t.transform.tileZoom)/r,o=n*(i.tileID.canonical.x+i.tileID.wrap*r),s=n*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture?i.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/e.bD(i,1,t.transform.tileZoom),u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}const ji=e.ae.create(),Ui=(t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_,g,y)=>{const v=i.style.light,x=v.properties.get("position"),b=[x.x,x.y,x.z],w=e.bE.create();"viewport"===v.properties.get("anchor")&&(e.bE.fromRotation(w,-i.transform.angle),e.$.transformMat3(b,b,w));const T=v.properties.get("color"),M=i.transform,E={u_matrix:t,u_lightpos:b,u_lightintensity:v.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_vertical_gradient:+r,u_opacity:n,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:ji,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:o,u_edge_radius:s,u_alignment:a,u_width_scale:l,u_flood_light_color:f,u_vertical_scale:m,u_flood_light_intensity:_,u_ground_shadow_factor:g,u_emissive_strength:y};return"globe"===M.projection.name&&(E.u_tile_id=[c.canonical.x,c.canonical.y,1<<c.canonical.z],E.u_zoom_transition=h,E.u_inv_rot_matrix=d,E.u_merc_center=p,E.u_up_dir=M.projection.upVector(new e.aO(0,0,0),p[0]*e.a4,p[1]*e.a4),E.u_height_lift=u),E},Vi=(e,t,i,r,n)=>({u_matrix:e,u_edge_radius:t,u_alignment:i,u_width_scale:r,u_vertical_scale:n}),$i=(t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_)=>{const g=Ui(t,i,r,n,o,s,a,l,c,h,p,d,f,m,_,1,[0,0,0],0),y={u_height_factor:-Math.pow(2,c.overscaledZ)/u.tileSize/8};return e.Q(g,Ni(i,u),y)},Gi=(e,t)=>({u_matrix:e,u_emissive_strength:t}),qi=(t,i,r,n)=>e.Q(Gi(t,i),Ni(r,n)),Hi=(e,t,i)=>({u_matrix:e,u_world:i,u_emissive_strength:t}),Zi=(t,i,r,n,o)=>e.Q(qi(t,i,r,n),{u_world:o}),Wi=(t,i,r,n)=>{const o=e.a4/r.tileSize;return{u_matrix:t,u_camera_to_center_distance:i.getCameraToCenterDistance(n),u_extrude_scale:[i.pixelsToGLUnits[0]/o,i.pixelsToGLUnits[1]/o]}},Xi=(e,t,i=1)=>({u_matrix:e,u_color:t.toRenderColor(null),u_overlay:0,u_overlay_scale:i}),Qi=e.ae.create(),Yi=(t,i,r,n,o,s,a)=>{const l=t.transform,c="globe"===l.projection.name,u=c?e.bF(l.zoom,i.canonical)*l._pixelsPerMercatorPixel:e.bD(r,1,s),h={u_matrix:i.projMatrix,u_extrude_scale:u,u_intensity:a,u_inv_rot_matrix:
vendor: 4,291 bytes, line 1
1Qi,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){h.u_inv_rot_matrix=n,h.u_merc_center=o,h.u_tile_id=[i.canonical.x,i.canonical.y,1<<i.canonical.z],h.u_zoom_transition=e.a2(l.zoom);const t=o[0]*e.a4,r=o[1]*e.a4;h.u_up_dir=l.projection.upVector(new e.aO(0,0,0),t,r)}return h};function Ji(e,[t,i,r,n],[o,s]){if(o===s)return[0,0,0,0];const a=255*(e-1)/(e*(s-o));return[t*a,i*a,r*a,n*a]}function Ki(e,t,[i,r]){return i===r?0:.5/e+(t-i)*(e-1)/(e*(r-i))}const er=(t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_,g,y,v,x,b)=>({u_matrix:t,u_normalize_matrix:i,u_globe_matrix:r,u_merc_matrix:n,u_grid_matrix:o,u_tl_parent:s,u_scale_parent:u,u_fade_t:h.mix,u_opacity:h.opacity*p.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:p.paint.get("raster-brightness-min"),u_brightness_high:p.paint.get("raster-brightness-max"),u_saturation_factor:e.bG(p.paint.get("raster-saturation")),u_contrast_factor:e.bH(p.paint.get("raster-contrast")),u_spin_weights:tr(p.paint.get("raster-hue-rotate")),u_perspective_transform:d,u_raster_elevation:f,u_zoom_transition:a,u_merc_center:l,u_cutoff_params:c,u_colorization_mix:Ji(e.bI,_,y),u_colorization_offset:Ki(e.bI,g,y),u_color_ramp:m,u_texture_offset:[x/(v+2*x),v/(v+2*x)],u_texture_res:[v+2*x,v+2*x],u_emissive_strength:b});function tr(e){e*=Math.PI/180;const t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}const ir=.05,rr=(e,t,i,r,n,o,s,a,l,c,u,h)=>({u_matrix:e,u_normalize_matrix:t,u_globe_matrix:i,u_merc_matrix:r,u_grid_matrix:n,u_tl_parent:o,u_scale_parent:c,u_fade_t:u.mix,u_opacity:u.opacity,u_image0:0,u_image1:1,u_raster_elevation:h,u_zoom_transition:s,u_merc_center:a,u_cutoff_params:l}),nr=(e,t,i,r,n,o,s,a,l,c)=>({u_particle_texture:e,u_particle_texture_side_len:t,u_tile_offset:i,u_velocity:r,u_color_ramp:o,u_velocity_res:n,u_max_speed:s,u_uv_offset:a,u_data_scale:[255*l[0],255*l[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[ir,ir]}),or=(e,t,i,r,n,o,s,a,l,c)=>({u_particle_texture:e,u_particle_texture_side_len:t,u_velocity:i,u_velocity_res:r,u_max_speed:n,u_speed_factor:o,u_reset_rate:s,u_rand_seed:Math.random(),u_uv_offset:a,u_data_scale:[255*l[0],255*l[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[ir,ir]}),sr=e.ae.create(),ar=(t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_,g,y)=>{const v=o.transform,x={u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:v.getCameraToCenterDistance(_),u_rotate_symbol:+r,u_aspect_ratio:v.width/v.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_matrix:s,u_label_plane_matrix:a,u_coord_matrix:l,u_is_text:+c,u_pitch_with_map:+n,u_texsize:u,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:sr,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:sr,u_up_vector:[0,-1,0],u_color_adj_mat:g,u_icon_transition:y||0};return"globe"===_.name&&(x.u_tile_id=[h.canonical.x,h.canonical.y,1<<h.canonical.z],x.u_zoom_transition=p,x.u_inv_rot_matrix=f,x.u_merc_center=d,x.u_camera_forward=v._camera.forward(),x.u_ecef_origin=e.bJ(v.globeMatrix,h.toUnwrapped()),x.u_tile_matrix=Float32Array.from(v.globeMatrix),x.u_up_vector=m),x},lr=(t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_,g)=>e.Q(ar(t,i,r,n,o,s,a,l,c,u,p,d,f,m,_,g),{u_gamma_scale:n?o.transform.getCameraToCenterDistance(g)*Math.cos(o.terrain?0:o.transform._pitch):1,u_device_pixel_ratio:e.e.devicePixelRatio,u_is_halo:+h,undefined:void 0}),cr=(t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_)=>e.Q(lr(t,i,r,n,o,s,a,l,!0,c,!0,h,p,d,f,m,_),{u_texsize_icon:u,u_texture_icon:1}),ur=(e,t,i,r)=>({u_matrix:e,u_emissive_strength:t,u_opacity:i,u_color:r}),hr=(t,i,r,n,o,s,a,l)=>e.Q(function(t,i,r,n,o){const{width:s,height:a}=n.imageManager.getPixelSize(i),l=Math.pow(2,o.tileID.overscaledZ),c=o.tileSize*Math.pow(2,n.transform.tileZoom)/l,u=c*(o.tileID.canonical.x+o.tileID.wrap*l),h=c*o.tileID.canonical.y;return{u_image:0,u_pattern_tl:r.tl,u_pattern_br:r.br,u_texsize:[s,a],u_pattern_size:r.displaySize,u_tile_units_to_pixels:1/e.bD(o,1,n.transform.tileZoom),u_pixel_coord_upper:[u>>16,h>>16],u_pixel_coord_lower:[65535&u,65535&h]}}(0,s,a,n,l),{u_matrix:t,u_emissive_strength:i,u_opacity:r}
1),pr=new Float32Array(e.ae.identity([])),dr=(t,i,r,n,o,s,a,l,c,u,h,p,d,f=[0,0,0],m)=>{const _=o.style.light,g=_.properties.get("position"),y=[-g.x,-g.y,g.z],v=e.bE.create();"viewport"===_.properties.get("anchor")&&(e.bE.fromRotation(v,-o.transform.angle),e.$.transformMat3(y,y,v));const x="MASK"===h.alphaMode,b=_.properties.get("color").toRenderColor(null),w=d.paint.get("model-ambient-occlusion-intensity"),T=d.paint.get("model-color").constantOr(e.C.white).toRenderColor(null),M=d.paint.get("model-color-mix-intensity").constantOr(0);return{u_matrix:t,u_lighting_matrix:i,u_normal_matrix:r,u_node_matrix:n||pr,u_lightpos:y,u_lightintensity:_.properties.get("intensity"),u_lightcolor:[b.r,b.g,b.b],u_camera_pos:f,u_opacity:s,u_baseTextureIsAlpha:0,u_alphaMask:+x,u_alphaCutoff:h.alphaCutoff,u_baseColorFactor:[a.r,a.g,a.b,a.a],u_emissiveFactor:[l[0],l[1],l[2],1],u_metallicFactor:c,u_roughnessFactor:u,u_baseColorTexture:hi.BaseColor,u_metallicRoughnessTexture:hi.MetallicRoughness,u_normalTexture:hi.Normal,u_occlusionTexture:hi.Occlusion,u_emissionTexture:hi.Emission,u_lutTexture:hi.LUT,u_color_mix:[T.r,T.g,T.b,M],u_aoIntensity:w,u_emissive_strength:p,u_occlusionTextureTransform:m||[0,0,0,0]}},fr=(e,t=pr,i=pr)=>({u_matrix:e,u_instance:t,u_node_matrix:i}),mr={fillExtrusion:t=>({u_matrix:new e.a7(t),u_lightpos:new e.ar(t),u_lightintensity:new e.ab(t),u_lightcolor:new e.ar(t),u_vertical_gradient:new e.ab(t),u_opacity:new e.ab(t),u_edge_radius:new e.ab(t),u_alignment:new e.ab(t),u_width_scale:new e.ab(t),u_ao:new e.a9(t),u_tile_id:new e.ar(t),u_zoom_transition:new e.ab(t),u_inv_rot_matrix:new e.a7(t),u_merc_center:new e.a9(t),u_up_dir:new e.ar(t),u_height_lift:new e.ab(t),u_flood_light_color:new e.ar(t),u_vertical_scale:new e.ab(t),u_flood_light_intensity:new e.ab(t),u_ground_shadow_factor:new e.ar(t),u_emissive_strength:new e.ab(t)}),fillExtrusionDepth:t=>({u_matrix:new e.a7(t),u_edge_radius:new e.ab(t),u_alignment:new e.ab(t),u_width_scale:new e.ab(t),u_vertical_scale:new e.ab(t)}),fillExtrusionPattern:t=>({u_matrix:new e.a7(t),u_lightpos:new e.ar(t),u_lightintensity:new e.ab(t),u_lightcolor:new e.ar(t),u_vertical_gradient:new e.ab(t),u_height_factor:new e.ab(t),u_edge_radius:new e.ab(t),u_alignment:new e.ab(t),u_width_scale:new e.ab(t),u_ao:new e.a9(t),u_tile_id:new e.ar(t),u_zoom_transition:new e.ab(t),u_inv_rot_matrix:new e.a7(t),u_merc_center:new e.a9(t),u_up_dir:new e.ar(t),u_height_lift:new e.ab(t),u_image:new e.a8(t),u_texsize:new e.a9(t),u_pixel_coord_upper:new e.a9(t),u_pixel_coord_lower:new e.a9(t),u_tile_units_to_pixels:new e.ab(t),u_opacity:new e.ab(t)}),fillExtrusionGroundEffect:t=>({u_matrix:new e.a7(t),u_opacity:new e.ab(t),u_ao_pass:new e.ab(t),u_meter_to_tile:new e.ab(t),u_ao:new e.a9(t),u_flood_light_intensity:new e.ab(t),u_flood_light_color:new e.ar(t),u_attenuation:new e.ab(t),u_edge_radius:new e.ab(t),u_fb:new e.a8(t),u_fb_size:new e.ab(t)}),fill:t=>({u_matrix:new e.a7(t),u_emissive_strength:new e.ab(t)}),fillPattern:t=>({u_matrix:new e.a7(t),u_emissive_strength:new e.ab(t),u_image:new e.a8(t),u_texsize:new e.a9(t),u_pixel_coord_upper:new e.a9(t),u_pixel_coord_lower:new e.a9(t),u_tile_units_to_pixels:new e.ab(t)}),fillOutline:t=>({u_matrix:new e.a7(t),u_emissive_strength:new e.ab(t),u_world:new e.a9(t)}),fillOutlinePattern:t=>({u_matrix:new e.a7(t),u_emissive_strength:new e.ab(t),u_world:new e.a9(t),u_image:new e.a8(t),u_texsize:new e.a9(t),u_pixel_coord_upper:new e.a9(t),u_pixel_coord_lower:new e.a9(t),u_tile_units_to_pixels:new e.ab(t)}),circle:e.bK,collisionBox:t=>({u_matrix:new e.a7(t),u_camera_to_center_distance:new e.ab(t),u_extrude_scale:new e.a9(t)}),collisionCircle:t=>({u_matrix:new e.a7(t),u_inv_matrix:new e.a7(t),u_camera_to_center_distance:new e.ab(t),u_viewport_size:new e.a9(t)}),debug:t=>({u_color:new e.aa(t),u_matrix:new e.a7(t),u_overlay:new e.a8(t),u_overlay_scale:new e.ab(t)}),clippingMask:t=>({u_matrix:new e.a7(t)}),heatmap:t=>({u_extrude_scale:new e.ab(t),u_intensity:new e.ab(t),u_matrix:new e.a7(t),u_inv_rot_matrix:new e.a7(t),u_merc_center:new e.a9(t),u_tile_id:new e.ar(t),u_zoom_transition:new e.ab(t),u_up_dir:new e.ar(t)}),heatmapTexture:t=>({u_image:new e.a8(t),u_color_ramp:new e.a8(t),u_opacity:new e.ab(t)}),hillshade:t=>({u_matrix:new e.a7(t),u_image:new e.a8(t),u_latrange:new e.a9(t),u_light:new e.a9(t),u_shadow:new e.aa(t),u_highlight:new e.aa(t),u_emissive_strength:new e.ab(t),u_accent:new e.aa(t)}),hillshadePrepare:t=>({u_matrix:new e.a7(t),u_image:new e.a8(t),u_dimension:new e.a9(t),u_zoom:new e.ab(t)}),line:e.bL,linePattern:e.bM,raster:t=>({u_matrix:new e.a7(t),u_normalize_matrix:new e.a7(t),u_globe_matrix:new e.a7(t),u_merc_matrix:new e.a7(t),u_grid_matrix:new e.as(t),u_tl_parent:new e.a9(t),u_scale_parent:new e.ab(t),u_fade_t:new e.ab(t),u_opacity:new e.ab(t),u_image0:new e.a8(t),u_image1:new e.a8(t),u_brightness_low:new e.ab(t),u_brightness_high:new e.ab(t),u_saturation_factor:new e.ab(t),u_contrast_factor:new e.ab(t),u_spin_weights:new e.ar(t),u_perspective_transform:new e.a9(t),u_raster_elevation:new e.ab(t),u_zoom_transition:new e.ab(t),u_merc_center:new e.a9(t),u_cutoff_params:new e.at(t),u_colorization_mix:new e.at(t),u_colorization_offset:new e.ab(t),u_color_ramp:new e.a8(t),u_texture_offset:new e.a9(t),u_texture_res:new e.a9(t),u_emissive_strength:new e.ab(t)}),rasterParticle:t=>({u_matrix:new e.a7(t),u_normalize_matrix:new e.a7(t),u_globe_matrix:new e.a7(t),u_merc_matrix:new e.a7(t),u_grid_matrix:new e.as(t),u_tl_parent:new e.a9(t),u_scale_parent:new e.ab(t),u_fade_t:new e.ab(t),u_opacity:new e.ab(t),u_image0:new e.a8(t),u_image1:new e.a8(t),u_raster_elevation:new e.ab(t),u_zoom_transition:new e.ab(t),u_merc_center:new e.a9(t),u_cutoff_params:new e.at(t)}),rasterParticleTexture:t=>({u_texture:new e.a8(t),u_opacity:new e.ab(t)}),rasterParticleDraw:t=>({u_particle_texture:new e.a8(t),u_particle_texture_side_len:new e.ab(t),u_tile_offset:new e.a9(t),u_velocity:new e.a8(t),u_color_ramp:new e.a8(t),u_velocity_res:new e.a9(t),u_max_speed:new e.ab(t),u_uv_offset:new e.a9(t),u_data_scale:new e.a9(t),u_data_offset:new e.ab(t),u_particle_pos_scale:new e.ab(t),u_particle_pos_offset:new e.a9(t)}),rasterParticleUpdate:t=>({u_particle_texture:new e.a8(t),u_particle_texture_side_len:new e.ab(t),u_velocity:new e.a8(t),u_velocity_res:new e.a9(t),u_max_speed:new e.ab(t),u_speed_factor:new e.ab(t),u_reset_rate:new e.ab(t),u_rand_seed:new e.ab(t),u_uv_offset:new e.a9(t),u_data_scale:new e.a9(t),u_data_offset:new e.ab(t),u_particle_pos_scale:new e.ab(t),u_particle_pos_offset:new e.a9(t)}),symbolIcon:t=>({u_is_size_zoom_constant:new e.a8(t),u_is_size_feature_constant:new e.a8(t),u_size_t:new e.ab(t),u_size:new e.ab(t),u_camera_to_center_distance:new e.ab(t),u_rotate_symbol:new e.a8(t),u_aspect_ratio:new e.ab(t),u_fade_change:new e.ab(t),u_matrix:new e.a7(t),u_label_plane_matrix:new e.a7(t),u_coord_matrix:new e.a7(t),u_is_text:new e.a8(t),u_pitch_with_map:new e.a8(t),u_texsize:new e.a9(t),u_tile_id:new e.ar(t),u_zoom_transition:new e.ab(t),u_inv_rot_matrix:new e.a7(t),u_merc_center:new e.a9(t),u_camera_forward:new e.ar(t),u_tile_matrix:new e.a7(t),u_up_vector:new e.ar(t),u_ecef_origin:new e.ar(t),u_texture:new e.a8(t),u_icon_transition:new e.ab(t),u_color_adj_mat:new e.a7(t)}),symbolSDF:t=>({u_is_size_zoom_constant:new e.a8(t),u_is_size_feature_constant:new e.a8(t),u_size_t:new e.ab(t),u_size:new e.ab(t),u_camera_to_center_distance:new e.ab(t),u_rotate_symbol:new e.a8(t),u_aspect_ratio:new e.ab(t),u_fade_change:new e.ab(t),u_matrix:new e.a7(t),u_label_plane_matrix:new e.a7(t),u_coord_matrix:new e.a7(t),u_is_text:new e.a8(t),u_pitch_with_map:new e.a8(t),u_texsize:new e.a9(t),u_texture:new e.a8(t),u_gamma_scale:new e.ab(t),u_device_pixel_ratio:new e.ab(t),u_tile_id:new e.ar(t),u_zoom_transition:new e.ab(t),u_inv_rot_matrix:new e.a7(t),u_merc_center:new e.a9(t),u_camera_forward:new e.ar(t),u_tile_matrix:new e.a7(t),u_up_vector:new e.ar(t),u_ecef_origin:new e.ar(t),u_is_halo:new e.a8(t)}),symbolTextAndIcon:t=>({u_is_size_zoom_constant:new e.a8(t),u_is_size_feature_constant:new e.a8(t),u_size_t:new e.ab(t),u_size:new e.ab(t),u_camera_to_center_distance:new e.ab(t),u_rotate_symbol:new e.a8(t),u_aspect_ratio:new e.ab(t),u_fade_change:new e.ab(t),u_matrix:new e.a7(t),u_label_plane_matrix:new e.a7(t),u_coord_matrix:new e.a7(t),u_is_text:new e.a8(t),u_pitch_with_map:new e.a8(t),u_texsize:new e.a9(t),u_texsize_icon:new e.a9(t),u_texture:new e.a8(t),u_texture_icon:new e.a8(t),u_gamma_scale:new e.ab(t),u_device_pixel_ratio:new e.ab(t),u_is_halo:new e.a8(t)}),background:t=>({u_matrix:new e.a7(t),u_emissive_strength:new e.ab(t),u_opacity:new e.ab(t),u_color:new e.aa(t)}),backgroundPattern:t=>({u_matrix:new e.a7(t),u_emissive_strength:new e.ab(t),u_opacity:new e.ab(t),u_image:new e.a8(t),u_pattern_tl:new e.a9(t),u_pattern_br:new e.a9(t),u_texsize:new e.a9(t),u_pattern_size:new e.a9(t),u_pixel_coord_upper:new e.a9(t),u_pixel_coord_lower:new e.a9(t),u_tile_units_to_pixels:new e.ab(t)}),terrainRaster:t=>({u_matrix:new e.a7(t),u_image0:new e.a8(t),u_skirt_height:new e.ab(t),u_ground_shadow_factor:new e.ar(t)}),skybox:t=>({u_matrix:new e.a7(t),u_sun_direction:new e.ar(t),u_cubemap:new e.a8(t),u_opacity:new e.ab(t),u_temporal_offset:new e.ab(t)}),skyboxGradient:t=>({u_matrix:new e.a7(t),u_color_ramp:new e.a8(t),u_center_direction:new e.ar(t),u_radius:new e.ab(t),u_opacity:new e.ab(t),u_temporal_offset:new e.ab(t)}),skyboxCapture:t=>({u_matrix_3f:new e.as(t),u_sun_direction:new e.ar(t),u_sun_intensity:new e.ab(t),u_color_tint_r:new e.at(t),u_color_tint_m:new e.at(t),u_luminance:new e.ab(t)}),globeRaster:t=>({u_proj_matrix:new e.a7(t),u_globe_matrix:new e.a7(t),u_normalize_matrix:new e.a7(t),u_merc_matrix:new e.a7(t),u_zoom_transition:new e.ab(t),u_merc_center:new e.a9(t),u_image0:new e.a8(t),u_grid_matrix:new e.as(t),u_skirt_height:new e.ab(t),u_far_z_cutoff:new e.ab(t),u_frustum_tl:new e.ar(t),u_frustum_tr:new e.ar(t),u_frustum_br:new e.ar(t),u_frustum_bl:new e.ar(t),u_globe_pos:new e.ar(t),u_globe_radius:new e.ab(t),u_viewport:new e.a9(t)}),globeAtmosphere:t=>({u_frustum_tl:new e.ar(t),u_frustum_tr:new e.ar(t),u_frustum_br:new e.ar(t),u_frustum_bl:new e.ar(t),u_horizon:new e.ab(t),u_transition:new e.ab(t),u_fadeout_range:new e.ab(t),u_color:new e.at(t),u_high_color:new e.at(t),u_space_color:new e.at(t),u_temporal_offset:new e.ab(t),u_horizon_angle:new e.ab(t)}),model:t=>({u_matrix:new e.a7(t),u_lighting_matrix:new e.a7(t),u_normal_matrix:new e.a7(t),u_node_matrix:new e.a7(t),u_lightpos:new e.ar(t),u_lightintensity:new e.ab(t),u_lightcolor:new e.ar(t),u_camera_pos:new e.ar(t),u_opacity:new e.ab(t),u_baseColorFactor:new e.at(t),u_emissiveFactor:new e.at(t),u_metallicFactor:new e.ab(t),u_roughnessFactor:new e.ab(t),u_baseTextureIsAlpha:new e.a8(t),u_alphaMask:new e.a8(t),u_alphaCutoff:new e.ab(t),u_baseColorTexture:new e.a8(t),u_metallicRoughnessTexture:new e.a8(t),u_normalTexture:new e.a8(t),u_occlusionTexture:new e.a8(t),u_emissionTexture:new e.a8(t),u_lutTexture:new e.a8(t),u_color_mix:new e.at(t),u_aoIntensity:new e.ab(t),u_emissive_strength:new e.ab(t),u_occlusionTextureTransform:new e.at(t)}),modelDepth:t=>({u_matrix:new e.a7(t),u_instance:new e.a7(t),u_node_matrix:new e.a7(t)}),groundShadow:t=>({u_matrix:new e.a7(t),u_ground_shadow_factor:new e.ar(t)}),stars:t=>({u_matrix:new e.a7(t),u_up:new e.ar(t),u_right:new e.ar(t),u_intensity_multiplier:new e.ab(t)}),occlusion:t=>({u_matrix:new e.a7(t),u_anchorPos:new e.ar(t),u_screenSizePx:new e.a9(t),u_occluderSizePx:new e.a9(t),u_color:new e.at(t)})};
1function _r(t,i,r){const n=i.createTileMatrix(t,t.worldSize,r.toUnwrapped());return e.ae.multiply(new Float32Array(16),t.projMatrix,n)}function gr(e,t,i){if(t.projection.name===i.projection.name)return e.projMatrix;const r=i.clone();return r.setProjection(t.projection),_r(r,t.getProjection(),e)}function yr(e,t,i){return t.name===i.projection.name?e.projMatrix:_r(i,t,e)}let vr;function xr(t,i,r,n,o,s,a){const l=t.context,c=l.gl,u=t.transform,h=t.getOrCreateProgram("collisionBox"),p=[];let d=0,f=0;for(let l=0;l<n.length;l++){const m=n[l],_=i.getTile(m),g=_.getBucket(r);if(!g)continue;const y=gr(m,g,u);let v=y;0===o[0]&&0===o[1]||(v=t.translatePosMatrix(y,_,o,s));const x=a?g.textCollisionBox:g.iconCollisionBox,b=g.collisionCircleArray;if(b.length>0){const t=e.ae.create(),i=v;e.ae.mul(t,g.placementInvProjMatrix,u.glCoordMatrix),e.ae.mul(t,t,g.placementViewportMatrix),p.push({circleArray:b,circleOffset:f,transform:i,invTransform:t,projection:g.getProjection()}),d+=b.length/4,f=d}x&&(t.terrain&&t.terrain.setupElevationDraw(_,h),h.draw(t,c.LINES,e.af.disabled,e.ah.disabled,t.colorModeForRenderPass(),e.ag.disabled,Wi(v,u,_,g.getProjection()),r.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,null,u.zoom,null,[x.collisionVertexBuffer,x.collisionVertexBufferExt]))}if(!a||!p.length)return;const m=t.getOrCreateProgram("collisionCircle"),_=new e.bN;_.resize(4*d),_._trim();let g=0;for(const e of p)for(let t=0;t<e.circleArray.length/4;t++){const i=4*t,r=e.circleArray[i+0],n=e.circleArray[i+1],o=e.circleArray[i+2],s=e.circleArray[i+3];_.emplace(g++,r,n,o,s,0),_.emplace(g++,r,n,o,s,1),_.emplace(g++,r,n,o,s,2),_.emplace(g++,r,n,o,s,3)}(!vr||vr.length<2*d)&&(vr=function(t){const i=2*t,r=new e.bw;r.resize(i),r._trim();for(let e=0;e<i;e++){const t=6*e;r.uint16[t+0]=4*e+0,r.uint16[t+1]=4*e+1,r.uint16[t+2]=4*e+2,r.uint16[t+3]=4*e+2,r.uint16[t+4]=4*e+3,r.uint16[t+5]=4*e+0}return r}(d));const y=l.createIndexBuffer(vr,!0),v=l.createVertexBuffer(_,e.bO.members,!0);for(const i of p){const n={u_matrix:i.transform,u_inv_matrix:i.invTransform,u_camera_to_center_distance:(x=u).getCameraToCenterDistance(i.projection),u_viewport_size:[x.width,x.height]};m.draw(t,c.TRIANGLES,e.af.disabled,e.ah.disabled,t.colorModeForRenderPass(),e.ag.disabled,n,r.id,v,y,e.b.simpleSegment(0,2*i.circleOffset,i.circleArray.length,i.circleArray.length/2),null,u.zoom)}var x;v.destroy(),y.destroy()}const br=e.ae.create();function wr(t){const i=t._camera.getWorldToCamera(t.worldSize,1),r=e.ae.multiply([],i,t.globeMatrix);e.ae.invert(r,r);const n=[0,0,0],o=[0,1,0,0];return e.aB.transformMat4(o,o,r),n[0]=o[0],n[1]=o[1],n[2]=o[2],e.$.normalize(n,n),n}function Tr({width:t,height:i,anchor:r,textOffset:n,textScale:o},s){const{horizontalAlign:a,verticalAlign:l}=e.bS(r),c=-(a-.5)*t,u=-(l-.5)*i,h=e.bR(r,n);return new e.P((c/o+h[0])*s,(u/o+h[1])*s)}function Mr(t,i,r,n,o,s,a,l,c,u,h){const p=t.text.placedSymbolArray,d=t.text.dynamicLayoutVertexArray,f=t.icon.dynamicLayoutVertexArray,m={},_=t.getProjection(),g=yr(l,_,s),y=s.elevation,v=_.upVectorScale(l.canonical,s.center.lat,s.worldSize).metersToTile;d.clear();for(let f=0;f<p.length;f++){const x=p.get(f),{tileAnchorX:b,tileAnchorY:w,numGlyphs:T}=x,M=x.hidden||!x.crossTileID||t.allowVerticalPlacement&&!x.placedOrientation?null:n[x.crossTileID];if(M){let n=0,p=0,f=0;if(y){const e=y?y.getAtTileOffset(l,b,w):0,[t,i,r]=_.upVector(l.canonical,b,w);n=e*t*v,p=e*i*v,f=e*r*v}let[E,S,C,A]=Qt(x.projectedAnchorX+n,x.projectedAnchorY+p,x.projectedAnchorZ+f,r?g:a);const I=Yt(s.getCameraToCenterDistance(_),A);let k=o.evaluateSizeForFeature(t.textSizeData,u,x)*I/e.bP;r&&(k*=t.tilePixelRatio/c);const L=Tr(M,k);r?(({x:E,y:S,z:C}=_.projectTilePoint(b+L.x,w+L.y,l.canonical)),[E,S,C]=Qt(E+n,S+p,C+f,a)):(i&&L._rotate(-s.angle),E+=L.x,S+=L.y,C=0);const P=t.allowVerticalPlacement&&x.placedOrientation===e.aF.vertical?Math.PI/2:0;for(let t=0;t<T;t++)e.aI(d,E,S,C,P);h&&x.associatedIconIndex>=0&&(m[x.associatedIconIndex]={x:E,y:S,z:C,angle:P})}else si(T,d)}if(h){f.clear();const i=t.icon.placedSymbolArray;for(let t=0;t<i.length;t++){const r=i.get(t),{numGlyphs:n}=r,o=m[t];if(r.hidden||!o)si(n,f);else{const{x:t,y:i,z:r,angle:s}=o;for(let o=0;o<n;o++)e.aI(f,t,i,r,s)}}t.icon.dynamicLayoutVertexBuffer.updateData(f)}t.text.dynamicLayoutVertexBuffer.updateData(d)}function Er(t,i,r,n,o,s,a={}){const l=r.paint.get("icon-translate"),c=r.paint.get("text-translate"),u=r.paint.get("icon-translate-anchor"),h=r.paint.get("text-translate-anchor"),p=r.layout.get("icon-rotation-alignment"),d=r.layout.get("text-rotation-alignment"),f=r.layout.get("icon-pitch-alignment"),m=r.layout.get("text-pitch-alignment"),_=r.layout.get("icon-keep-upright"),g=r.layout.get("text-keep-upright"),y=r.paint.get("icon-color-saturation"),v=r.paint.get("icon-color-contrast"),x=r.paint.get("icon-color-brightness-min"),b=r.paint.get("icon-color-brightness-max");r.paint.get("icon-occlusion-opacity").constantOr(0),r.paint.get("text-occlusion-opacity").constantOr(0);const w=t.context,T=w.gl,M=t.transform,E="map"===p,S="map"===d,C="map"===f,A="map"===m,I=void 0!==r.layout.get("symbol-sort-key").constantOr(1);let k=!1;const L=t.depthModeForSublayer(0,e.af.ReadOnly),P=[e.ak(M.center.lng),e.al(M.center.lat)],R=r.layout.get("text-variable-anchor"),z="globe"===M.projection.name,O=[],D=[0,-1,0];for(const o of n){const n=i.getTile(o),s=n.getBucket(r);
1if(!s)continue;if("mercator"===s.projection.name&&z)continue;if(s.fullyClipped)continue;const p="globe"===s.projection.name,d=p?e.a2(M.zoom):0,f=yr(o,s.getProjection(),M),m=M.calculatePixelsToTileUnitsMatrix(n),w=R&&s.hasTextData(),L=s.hasIconTextFit()&&w&&s.hasIconData(),F=s.getProjection().createInversionMatrix(M,o.canonical),B=e=>{M.depthOcclusionForSymbolsAndCircles&&(r.hasInitialOcclusionOpacityProperties||t.terrain)&&(e.push("DEPTH_D24"),e.push("DEPTH_OCCLUSION"))},N=()=>{const i=E&&"point"!==r.layout.get("symbol-placement"),a=[];B(a);const c=i||L,h=r.paint.get("icon-image-cross-fade").constantOr(0);t.terrainRenderModeElevated()&&C&&a.push("PITCH_WITH_MAP_TERRAIN"),p&&(a.push("PROJECTION_GLOBE_VIEW"),c&&a.push("PROJECTED_POS_ON_VIEWPORT")),h>0&&a.push("ICON_TRANSITION"),s.icon.zOffsetVertexBuffer&&a.push("Z_OFFSET"),0===y&&0===v&&0===x&&1===b||a.push("COLOR_ADJUSTMENT");const g=s.icon.programConfigurations.get(r.id),w=t.getOrCreateProgram(s.sdfIcons?"symbolSDF":"symbolIcon",{config:g,defines:a});let S;const A=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],I=s.iconSizeData,k=e.aE(I,M.zoom),R=C||0!==M.pitch,O=Zt(f,n.tileID.canonical,C,E,M,s.getProjection(),m),N=Xt(f,n.tileID.canonical,C,E,M,s.getProjection(),m),j=t.translatePosMatrix(N,n,l,u,!0),U=t.translatePosMatrix(f,n,l,u),V=c?br:O,$=E&&!C&&!i;let G=D;!z&&!M.mercatorFromTransition||E||(G=wr(M));const q=p?G:D;if(s.sdfIcons&&!s.iconsInText)S=lr(I.kind,k,$,C,t,U,V,j,!1,A,!0,o,d,P,F,q,s.getProjection());else{const e=r.getColorAdjustmentMatrix(y,v,x,b);S=ar(I.kind,k,$,C,t,U,V,j,!1,A,o,d,P,F,q,s.getProjection(),e,h)}const H=n.imageAtlasTexture?n.imageAtlasTexture:null,Z=1!==r.layout.get("icon-size").constantOr(0)||s.iconsNeedLinear,W=s.sdfIcons||t.options.rotating||t.options.zooming||Z||R?T.LINEAR:T.NEAREST,X=s.sdfIcons&&0!==r.paint.get("icon-halo-width").constantOr(1),Q=t.terrain&&C&&i?e.ae.invert(e.ae.create(),O):br;if(i&&s.icon){const e=M.elevation,i=e?e.getAtTileOffsetFunc(o,M.center.lat,M.worldSize,s.getProjection()):null,r=Wt(f,n.tileID.canonical,C,E,M,s.getProjection(),m);Kt(s,f,t,!1,r,N,C,_,i,o)}return{program:w,buffers:s.icon,uniformValues:S,atlasTexture:H,atlasTextureIcon:null,atlasInterpolation:W,atlasInterpolationIcon:null,isSDF:s.sdfIcons,hasHalo:X,tile:n,labelPlaneMatrixInv:Q}},j=()=>{const i=S&&"point"!==r.layout.get("symbol-placement"),a=[],l=i||R||L;t.terrainRenderModeElevated()&&A&&a.push("PITCH_WITH_MAP_TERRAIN"),p&&(a.push("PROJECTION_GLOBE_VIEW"),l&&a.push("PROJECTED_POS_ON_VIEWPORT")),s.text.zOffsetVertexBuffer&&a.push("Z_OFFSET"),B(a);const u=s.text.programConfigurations.get(r.id),_=t.getOrCreateProgram(s.iconsInText?"symbolTextAndIcon":"symbolSDF",{config:u,defines:a});let y,v=[0,0],x=null;const b=s.textSizeData;s.iconsInText&&(v=n.imageAtlasTexture?n.imageAtlasTexture.size:[0,0],x=n.imageAtlasTexture?n.imageAtlasTexture:null,y=A||0!==M.pitch||t.options.rotating||t.options.zooming||"composite"===b.kind||"camera"===b.kind?T.LINEAR:T.NEAREST);const w=n.glyphAtlasTexture?n.glyphAtlasTexture.size:[0,0],E=e.aE(b,M.zoom),C=Zt(f,n.tileID.canonical,A,S,M,s.getProjection(),m),I=Xt(f,n.tileID.canonical,A,S,M,s.getProjection(),m),k=t.translatePosMatrix(I,n,c,h,!0),O=t.translatePosMatrix(f,n,c,h),N=l?br:C,j=S&&!A&&!i;let U=D;!z&&!M.mercatorFromTransition||S||(U=wr(M));const V=p?U:D;let $;$=s.iconsInText?cr(b.kind,E,j,A,t,O,N,k,w,v,o,d,P,F,V,s.getProjection()):lr(b.kind,E,j,A,t,O,N,k,!0,w,!0,o,d,P,F,V,s.getProjection());const G=n.glyphAtlasTexture?n.glyphAtlasTexture:null,q=T.LINEAR,H=0!==r.paint.get("text-halo-width").constantOr(1),Z=t.terrain&&A&&i?e.ae.invert(e.ae.create(),C):br;if(i&&s.text){const e=M.elevation,i=e?e.getAtTileOffsetFunc(o,M.center.lat,M.worldSize,s.getProjection()):null,r=Wt(f,n.tileID.canonical,A,S,M,s.getProjection(),m);Kt(s,f,t,!0,r,I,A,g,i,o)}return{program:_,buffers:s.text,uniformValues:$,atlasTexture:G,atlasTextureIcon:x,atlasInterpolation:q,atlasInterpolationIcon:y,isSDF:!0,hasHalo:H,tile:n,labelPlaneMatrixInv:Z}},U=s.icon.segments.get().length,V=s.text.segments.get().length,$=U&&!a.onlyText?N():null,G=V&&!a.onlyIcons?j():null,q=r.paint.get("icon-opacity").constantOr(1),H=r.paint.get("text-opacity").constantOr(1);if(I&&s.canOverlap){k=!0;const t=q&&!a.onlyText?s.icon.segments.get():[],i=H&&!a.onlyIcons?s.text.segments.get():[];for(const i of t)O.push({segments:new e.b([i]),sortKey:i.sortKey,state:$});for(const t of i)O.push({segments:new e.b([t]),sortKey:t.sortKey,state:G})}else a.onlyText||O.push({segments:q?s.icon.segments:new e.b([]),sortKey:0,state:$}),a.onlyIcons||O.push({segments:H?s.text.segments:new e.b([]),sortKey:0,state:G})}k&&O.sort(((e,t)=>
1e.sortKey-t.sortKey));for(const e of O){const i=e.state;if(i)if(t.terrain?t.terrain.setupElevationDraw(i.tile,i.program,{useDepthForOcclusion:M.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:i.labelPlaneMatrixInv}):t.setupDepthForOcclusion(M.depthOcclusionForSymbolsAndCircles,i.program),w.activeTexture.set(T.TEXTURE0),i.atlasTexture&&i.atlasTexture.bind(i.atlasInterpolation,T.CLAMP_TO_EDGE,!0),i.atlasTextureIcon&&(w.activeTexture.set(T.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,T.CLAMP_TO_EDGE,!0)),t.uploadCommonLightUniforms(t.context,i.program),i.hasHalo){const n=i.uniformValues;n.u_is_halo=1,Sr(i.buffers,e.segments,r,t,i.program,L,o,s,n,2),n.u_is_halo=0}else{if(i.isSDF){const n=i.uniformValues;i.hasHalo&&(n.u_is_halo=1,Sr(i.buffers,e.segments,r,t,i.program,L,o,s,n,1)),n.u_is_halo=0}Sr(i.buffers,e.segments,r,t,i.program,L,o,s,i.uniformValues,1)}}}function Sr(t,i,r,n,o,s,a,l,c,u){const h=[t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer,t.iconTransitioningVertexBuffer,t.globeExtVertexBuffer,t.zOffsetVertexBuffer];o.draw(n,n.context.gl.TRIANGLES,s,a,l,e.ag.disabled,c,r.id,t.layoutVertexBuffer,t.indexBuffer,i,r.paint,n.transform.zoom,t.programConfigurations.get(r.id),h,u)}function Cr(t,i,r,n,o,s,a){const l=t.context.gl,c=r.paint.get("fill-pattern"),u=c&&c.constantOr(1);let h,p,d,f,m;a?(p=u&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",h=l.LINES):(p=u?"fillPattern":"fill",h=l.TRIANGLES);for(const _ of n){const n=i.getTile(_);if(u&&!n.patternsLoaded())continue;const g=n.getBucket(r);if(!g)continue;t.prepareDrawTile();const y=g.programConfigurations.get(r.id),v=t.isTileAffectedByFog(_),x=t.getOrCreateProgram(p,{config:y,overrideFog:v});u&&(t.context.activeTexture.set(l.TEXTURE0),n.imageAtlasTexture&&n.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),y.updatePaintBuffers());const b=c.constantOr(null);if(b&&n.imageAtlas){const e=n.imageAtlas.patternPositions[b.toString()];e&&y.setConstantPatternPositions(e)}const w=t.translatePosMatrix(_.projMatrix,n,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor")),T=r.paint.get("fill-emissive-strength");if(a){f=g.indexBuffer2,m=g.segments2;const e=t.terrain&&t.terrain.renderingToTexture?t.terrain.drapeBufferSize:[l.drawingBufferWidth,l.drawingBufferHeight];d="fillOutlinePattern"===p&&u?Zi(w,T,t,n,e):Hi(w,T,e)}else f=g.indexBuffer,m=g.segments,d=u?qi(w,T,t,n):Gi(w,T);t.uploadCommonUniforms(t.context,x,_.toUnwrapped()),x.draw(t,h,o,t.stencilModeForClipping(_),s,e.ag.disabled,d,r.id,g.layoutVertexBuffer,f,m,r.paint,t.transform.zoom,y,void 0)}}function Ar(t,i,r,n,o,s,a,l){r.resetLayerRenderingStats(t);const c=t.context,u=c.gl,h=t.transform,p=r.paint.get("fill-extrusion-pattern"),d=p.constantOr(1),f=r.paint.get("fill-extrusion-opacity"),m=t.style.enable3dLights(),_=r.paint.get(m&&!d?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),g=[r.paint.get("fill-extrusion-ambient-occlusion-intensity"),_],y=r.layout.get("fill-extrusion-edge-radius"),v=y>0&&!r.paint.get("fill-extrusion-rounded-roof"),x=v?0:y,b="globe"===h.projection.name?e.b_():0,w="globe"===h.projection.name,T=w?e.a2(h.zoom):0,M=[e.ak(h.center.lng),e.al(h.center.lat)],E=r.paint.get("fill-extrusion-flood-light-color").toRenderColor(r.lut).toArray01().slice(0,3),S=r.paint.get("fill-extrusion-flood-light-intensity"),C=r.paint.get("fill-extrusion-vertical-scale"),A=0!==r.paint.get("fill-extrusion-line-width").constantOr(1),I=pi(t,r.paint.get("fill-extrusion-cutoff-fade-range")),k=r.paint.get("fill-extrusion-emissive-strength"),L=[];w&&L.push("PROJECTION_GLOBE_VIEW"),g[0]>0&&L.push("FAUX_AO"),v&&L.push("ZERO_ROOF_RADIUS"),l&&L.push("HAS_CENTROID"),S>0&&L.push("FLOOD_LIGHT"),I.shouldRenderCutoff&&L.push("RENDER_CUTOFF"),A&&L.push("RENDER_WALL_MODE");const P=(()=>{const t=r.paint.get("fill-extrusion-line-alignment");switch(t){case"inside":return 1;case"outside":return-1;case"center":return 0;default:return e.w(`Unsupported value for fill-extrusion-line-alignment: ${t}`),0}})();let R;const z="shadow"===t.renderPass,O=t.shadowRenderer,D=z&&!!O;t.shadowRenderer&&(t.shadowRenderer.useNormalOffset=!0);let F=[0,0,0];if(O){const e=t.style.directionalLight,i=t.style.ambientLight;e&&i&&(F=vi(t.style,e,i)),R=L.concat(["SHADOWS_SINGLE_CASCADE"])}const B=D?"fillExtrusionDepth":d?"fillExtrusionPattern":"fillExtrusion",N=r.getLayerRenderingStats();for(const m of n){const n=i.getTile(m),_=n.getBucket(r);
1if(!_||_.projection.name!==h.projection.name)continue;let y=!1;O&&(y=0===O.getMaxCascadeForTile(m.toUnwrapped()));const v=t.isTileAffectedByFog(m),D=_.programConfigurations.get(r.id),j=t.getOrCreateProgram(B,{config:D,defines:y?R:L,overrideFog:v});if(t.terrain&&t.terrain.setupElevationDraw(n,j,{useMeterToDem:!0}),!_.centroidVertexBuffer){const e=j.attributes.a_centroid_pos;void 0!==e&&u.vertexAttrib2f(e,0,0)}!z&&O&&O.setupShadows(n.tileID.toUnwrapped(),j,"vector-tile",n.tileID.overscaledZ),d&&(t.context.activeTexture.set(u.TEXTURE0),n.imageAtlasTexture&&n.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),D.updatePaintBuffers());const U=p.constantOr(null);if(U&&n.imageAtlas){const e=n.imageAtlas.patternPositions[U.toString()];e&&D.setConstantPatternPositions(e)}const V=r.paint.get("fill-extrusion-vertical-gradient"),$=1/_.tileToMeter;let G;if(z&&O){if(zr(n.tileID,_,t))continue;const e=O.calculateShadowPassMatrixFromTile(n.tileID.toUnwrapped());G=Vi(e,x,P,$,C)}else{const e=t.translatePosMatrix(m.expandedProjMatrix,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),i=h.projection.createInversionMatrix(h,m.canonical);G=d?$i(e,t,V,f,g,x,P,$,m,n,b,T,M,i,E,C):Ui(e,t,V,f,g,x,P,$,m,b,T,M,i,E,C,S,F,k)}t.uploadCommonUniforms(c,j,m.toUnwrapped(),null,I);let q=_.segments;if("mercator"===h.projection.name&&!z&&(q=_.getVisibleSegments(n.tileID,t.terrain,t.transform.getFrustum(0)),!q.get().length))continue;if(N)if(z)for(const e of q.get())N.numRenderedVerticesInShadowPass+=e.primitiveLength;else for(const e of q.get())N.numRenderedVerticesInTransparentPass+=e.primitiveLength;const H=[];(t.terrain||l)&&H.push(_.centroidVertexBuffer),w&&H.push(_.layoutVertexExtBuffer),A&&H.push(_.wallVertexBuffer),j.draw(t,c.gl.TRIANGLES,o,s,a,e.ag.backCCW,G,r.id,_.layoutVertexBuffer,_.indexBuffer,q,r.paint,t.transform.zoom,D,H)}t.shadowRenderer&&(t.shadowRenderer.useNormalOffset=!1)}function Ir(t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_,g,y,v){const x=t.context,b=x.gl,w=t.transform,T=t.transform.zoom,M=[],E=pi(t,r.paint.get("fill-extrusion-cutoff-fade-range"));"clear"===u?(M.push("CLEAR_SUBPASS"),v&&(M.push("CLEAR_FROM_TEXTURE"),x.activeTexture.set(b.TEXTURE0),v.bind(b.LINEAR,b.CLAMP_TO_EDGE))):"sdf"===u&&M.push("SDF_SUBPASS"),g&&M.push("HAS_CENTROID"),E.shouldRenderCutoff&&M.push("RENDER_CUTOFF");const S=r.layout.get("fill-extrusion-edge-radius"),C=(e,i,n,u,y)=>{const b=i.programConfigurations.get(r.id),w=t.isTileAffectedByFog(e),C=t.getOrCreateProgram("fillExtrusionGroundEffect",{config:b,defines:M,overrideFog:w}),A=((e,t,i,r,n,o,s,a,l,c,u)=>({u_matrix:t,u_opacity:i,u_ao_pass:r?1:0,u_meter_to_tile:n,u_ao:o,u_flood_light_intensity:s,u_flood_light_color:a,u_attenuation:l,u_edge_radius:c,u_fb:0,u_fb_size:u}))(0,u,h,c,y,[p,d*y],f,m,_,T>=17?0:S*y,v?v.size[0]:0),I=[];g&&I.push(i.hiddenByLandmarkVertexBuffer),t.uploadCommonUniforms(x,C,e.toUnwrapped(),null,E),C.draw(t,x.gl.TRIANGLES,o,s,a,l,A,r.id,i.vertexBuffer,i.indexBuffer,n,r.paint,T,b,I)};for(const o of n){const n=i.getTile(o),s=n.getBucket(r);if(!s||s.projection.name!==w.projection.name||!s.groundEffect||s.groundEffect&&!s.groundEffect.hasData())continue;const a=s.groundEffect,l=1/s.tileToMeter;{const e=t.translatePosMatrix(o.projMatrix,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),i=a.getDefaultSegment();C(o,a,i,e,l)}if(y)for(let s=0;s<4;s++){const a=e.b$[s](o),c=i.getTile(a);if(!c)continue;const u=c.getBucket(r);if(!u||u.projection.name!==w.projection.name||!u.groundEffect||u.groundEffect&&!u.groundEffect.hasData())continue;const h=u.groundEffect;let p,d;0===s?(p=[-e.a4,0,0],d=1):1===s?(p=[e.a4,0,0],d=0):2===s?(p=[0,-e.a4,0],d=3):(p=[0,e.a4,0],d=2);const f=h.regionSegments[d];if(!f)continue;const m=new Float32Array(16);e.ae.translate(m,o.projMatrix,p),C(o,h,f,t.translatePosMatrix(m,n,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),l)}}}function kr(t,i,r,n,o,s,a){0===n.centroidVertexArray.length&&n.createCentroidsBuffer();const l=s?s.findDEMTileFor(r):null;if(!(l&&l.dem||a))return;const c=t=>new e.P(Math.ceil((t+e.c2)*e.c3),0),u=e=>{const t=i.getSource().minzoom,r=e=>{const t=i.getTileByID(e);if(t&&t.hasData())return t.getBucket(o)},n=[0,-1,1];for(const i of n){if(e.overscaledZ+i<t)continue;const n=r(e.calculateScaledKey(e.overscaledZ+i));if(n)return n}},h=[0,0,0],p=(t,i)=>(h[0]=Math.min(t.min.y,i.min.y),h[1]=Math.max(t.max.y,i.max.y),h[2]=e.a4-i.min.x>t.max.x?i.min.x-e.a4:t.max.x,h),d=(t,i)=>(h[0]=Math.min(t.min.x,i.min.x),h[1]=Math.max(t.max.x,i.max.x),h[2]=e.a4-i.min.y>t.max.y?i.min.y-e.a4:t.max.y,h),f=[(e,t)=>p(e,t),(e,t)=>p(t,e),(e,t)=>d(e,t),(e,t)=>d(t,e)],m=(t,i,n,o,a,c,u)=>{if(!s)return 0;const h=[[c?n:t,c?t:n,0],[c?n:i,c?i:n,0]],p=u<0?e.a4+u:u,d=[c?p:(t+i)/2,c?(t+i)/2:p,0];return 0===n&&u<0||0!==n&&u>0?s.getForTilePoints(a,[d],!0,o):h.push(d),s.getForTilePoints(r,h,!0,l),Math.max(h[0][2],h[1][2],d[2])/s.exaggeration()};for(let t=0;t<4;t++){const i=n.borderFeatureIndices[t];if(0===i.length)continue;const o=e.b$[t](r),l=u(o);if(!(l&&l instanceof e.c0))continue;if(n.borderDoneWithNeighborZ[t]===l.canonical.z)continue;0===l.centroidVertexArray.length&&l.createCentroidsBuffer();const h=s?s.findDEMTileFor(o):null;if(!(h&&h.dem||a))continue;const p=(t<2?1:5)-t,d=l.borderDoneWithNeighborZ[p]!==n.canonical.z,y=l.borderFeatureIndices[p];let v=0;if(n.canonical.z!==l.canonical.z){for(const e of i)n.showCentroid(n.featuresOnBorder[e]);if(d)for(const e of y)l.showCentroid(l.featuresOnBorder[e]);n.borderDoneWithNeighborZ[t]=l.canonical.z,l.borderDoneWithNeighborZ[p]=n.
1canonical.z}for(const r of i){const i=n.featuresOnBorder[r],s=n.centroidData[i.centroidDataIndex],u=i.borders[t];let d;for(;v<y.length;){d=l.featuresOnBorder[y[v]];const e=d.borders[p];if(e[1]>u[0]+3||e[0]>u[0]-3)break;l.showCentroid(d),v++}if(d&&v<y.length){const r=v;let x=0;for(;!(d.borders[p][0]>u[1]-3)&&(x++,++v!==y.length);)d=l.featuresOnBorder[y[v]];if(d=l.featuresOnBorder[y[r]],x>1){const e=d.borders[p];Math.abs(u[0]-e[0])<3&&Math.abs(u[1]-e[1])<3&&(x=1,v=r+1)}else if(0===x){n.showCentroid(i);continue}const b=l.centroidData[d.centroidDataIndex];a&&1===x&&(((_=s).flags|(g=b).flags)&e.c1?(_.flags|=e.c1,g.flags|=e.c1):(_.flags&=~e.c1,g.flags&=~e.c1));const w=i.intersectsCount()>1||d.intersectsCount()>1;if(x>1)v=r,s.centroidXY=b.centroidXY=new e.P(0,0);else if(h&&h.dem&&!w){const i=f[t](s,b),r=t%2?e.a4-1:0,n=m(i[0],Math.min(e.a4-1,i[1]),r,h,o,t<2,i[2]);s.centroidXY=b.centroidXY=c(n)}else w?s.centroidXY=b.centroidXY=new e.P(0,0):(s.centroidXY=n.encodeBorderCentroid(i),b.centroidXY=l.encodeBorderCentroid(d));n.writeCentroidToBuffer(s),l.writeCentroidToBuffer(b)}else n.showCentroid(i)}n.borderDoneWithNeighborZ[t]=l.canonical.z,l.borderDoneWithNeighborZ[p]=n.canonical.z}var _,g;(n.needsCentroidUpdate||!n.centroidVertexBuffer&&0!==n.centroidVertexArray.length)&&n.uploadCentroid(t)}const Lr=[1,0,0],Pr=[0,1,0],Rr=[0,0,1];function zr(t,i,r){const n=r.transform,o=r.shadowRenderer;if(!o)return!0;const s=t.toUnwrapped(),a=n.tileSize*o._cascades[r.currentShadowCascade].scale;let l=i.maxHeight;if(n.elevation){const e=n.elevation.getMinMaxForTile(t);e&&(l+=e.max)}const c=[...o.shadowDirection];c[2]=-c[2];const u=o.computeSimplifiedTileShadowVolume(s,l,a,c);if(!u)return!1;const h=[Lr,Pr,Rr,c,[c[0],0,c[2]],[0,c[1],c[2]]],p="globe"===n.projection.name,d=n.scaleZoom(a),f=e.aM.fromInvProjectionMatrix(n.invProjMatrix,n.worldSize,d,!p),m=o.getCurrentCascadeFrustum();return 0===f.intersectsPrecise(u.vertices,u.planes,h)||0===m.intersectsPrecise(u.vertices,u.planes,h)}function Or(t){return[t[0]*e.c4,t[1]*e.c4,t[2]*e.c4,0]}function Dr(t,i,r,n,o,s,a,l,c){const u=n.getSource(),h=r.globeSharedBuffers;if(!h)return;let p,d,f;if(i&&(p=n.getTile(i)),u instanceof e.bo?(d=u.texture,f=e.bj(0,0,r.transform)):p&&i&&(d=p.texture,f=e.bj(i.canonical.z,i.canonical.x,r.transform)),!d||!f)return;t||(f=e.ae.scale(e.ae.create(),f,[1,-1,1]));const m=r.context,_=m.gl,g="nearest"===o.paint.get("raster-resampling")?_.NEAREST:_.LINEAR,y=r.colorModeForDrapableLayerRenderPass(s),v=a.defines;v.push("GLOBE_POLES");const x=new e.af(_.LEQUAL,e.af.ReadWrite,r.depthRangeFor3D),b=Float32Array.from(r.transform.expandedFarZProjMatrix),w=Float32Array.from(e.bh(e.bi(new e.aO(0,0,0))));r.terrain&&r.terrain.prepareDrawTile(),m.activeTexture.set(_.TEXTURE0),d.bind(g,_.CLAMP_TO_EDGE),m.activeTexture.set(_.TEXTURE1),d.bind(g,_.CLAMP_TO_EDGE),d.useMipmap&&m.extTextureFilterAnisotropic&&r.transform.pitch>20&&_.texParameterf(_.TEXTURE_2D,m.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,m.extTextureFilterAnisotropicMax);const[T,M,E,S]=i?h.getPoleBuffers(i.canonical.z,!1):h.getPoleBuffers(0,!0),C=o.paint.get("raster-elevation");let A;t?(A=T,r.renderDefaultNorthPole=0!==C):(A=M,r.renderDefaultSouthPole=0!==C);const I=Or(a.mix),k=((e,t,i,r,n,o,s,a,l,c,u,h,p)=>er(e,t,i,new Float32Array(16),new Float32Array(9),[0,0],r,[0,0],[0,0,0,0],1,{opacity:1,mix:0},o,[0,0]||[0,0],a,2,c,u,h,1,0,p))(b,w,f,e.a2(r.transform.zoom),0,o,0,C,0,I,a.offset,a.range,s),L=r.getOrCreateProgram("raster",{defines:v});r.uploadCommonUniforms(m,L,null),L.draw(r,_.TRIANGLES,x,c,y,l,k,o.id,A,E,S)}function Fr(e){const t=e._nearZ,i=e.projection.farthestPixelDistance(e),r=i-t,n=.2*e.height,o=t+n;return[t,i,(o-n-t)/r,(o-t)/r]}function Br(t,i,r,n){if(t)return i instanceof Ai&&t instanceof e.c5?i.getTextureDescriptor(t,r,!0):{texture:t.texture,mix:Or(n.mix),offset:n.offset,buffer:0,tileSize:1}}function Nr(t,i,r){if(!t)return null;const n=i.getTextureDescriptor(t,r,!0);if(!n)return null;let{texture:o,mix:s,offset:a,tileSize:l,buffer:c,format:u}=n;if(!o||!u)return null;let h=!1;return"uint32"===u&&(h=!0,s[3]=0,s=Ji(e.c6,s,[0,r.paint.get("raster-particle-max-speed")]),a=Ki(e.c6,a,[0,r.paint.get("raster-particle-max-speed")])),{texture:o,textureOffset:[c/(l+2*c),l/(l+2*c)],tileSize:l,scalarData:h,scale:s,offset:a,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[u]]}}function jr(e){const t=e._nearZ,i=e.projection.farthestPixelDistance(e),r=i-t,n=.2*e.height,o=t+n;return[t,i,(o-n-t)/r,(o-t)/r]}const Ur=new e.C(1,0,0,1),Vr=new e.C(0,1,0,1),$r=new e.C(0,0,1,1),Gr=new e.C(1,0,1,1),qr=new e.C(0,1,1,1);function Hr(t,i,r,n,o,s,a){const l=t.context,c=t.transform,u=l.gl,h="globe"===c.projection.name,p=h?["PROJECTION_GLOBE_VIEW"]:[];let d=e.ae.clone(r.projMatrix);if(h&&e.a2(c.zoom)>0){const t=e.c7(r.canonical,c),i=e.c8(t);d=e.ae.multiply(new Float32Array(16),c.globeMatrix,i),e.ae.multiply(d,c.projMatrix,d)}const f=e.ae.create();f[12]+=2*o/(e.e.devicePixelRatio*c.width),f[13]+=2*s/(e.e.devicePixelRatio*c.height),e.ae.multiply(d,f,d);const m=t.getOrCreateProgram("debug",{defines:p}),_=i.getTileByID(r.key);t.terrain&&t.terrain.setupElevationDraw(_,m);const g=e.af.disabled,y=e.ah.disabled,v=t.colorModeForRenderPass(),x="$debug";l.activeTexture.set(u.TEXTURE0),t.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),h?_._makeGlobeTileDebugBuffers(t.context,c):_._makeDebugTileBoundsBuffers(t.context,c.projection);const b=_._tileDebugBuffer||t.debugBuffer,w=_._tileDebugIndexBuffer||t.debugIndexBuffer,T=_._tileDebugSegments||t.debugSegments;
1if(m.draw(t,u.LINE_STRIP,g,y,v,e.ag.disabled,Xi(d,n),x,b,w,T,null,null,null,[_._globeTileDebugBorderBuffer]),a){const e=_.latestRawTileData,i=Math.floor((e&&e.byteLength||0)/1024);let n=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(n+=` => ${r.overscaledZ}`),n+=` ${_.state}`,n+=` ${i}kb`,function(e,t){e.initDebugOverlayCanvas();const i=e.debugOverlayCanvas,r=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(t,n)}const M=i.getTile(r).tileSize,E=512/Math.min(M,512)*(r.overscaledZ/c.zoom)*.5,S=_._tileDebugTextBuffer||t.debugBuffer,C=_._tileDebugTextIndexBuffer||t.quadTriangleIndexBuffer,A=_._tileDebugTextSegments||t.debugSegments;m.draw(t,u.TRIANGLES,g,y,e.a.alphaBlended,e.ag.disabled,Xi(d,e.C.transparent,E),x,S,C,A,null,null,null,[_._globeTileDebugTextBuffer])}function Zr(e,t,i,r){Xr(e,0,t+i/2,e.transform.width,i,r)}function Wr(e,t,i,r){Xr(e,t-i/2,0,i,e.transform.height,r)}function Xr(t,i,r,n,o,s){const a=t.context,l=a.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*e.e.devicePixelRatio,r*e.e.devicePixelRatio,n*e.e.devicePixelRatio,o*e.e.devicePixelRatio),a.clear({color:s}),l.disable(l.SCISSOR_TEST)}const Qr=e.c9([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Yr}=Qr;function Jr(e,t,i,r){e.emplaceBack(t,i,r)}class Kr{constructor(t){this.vertexArray=new e.ca,this.indices=new e.bw,Jr(this.vertexArray,-1,-1,1),Jr(this.vertexArray,1,-1,1),Jr(this.vertexArray,-1,1,1),Jr(this.vertexArray,1,1,1),Jr(this.vertexArray,-1,-1,-1),Jr(this.vertexArray,1,-1,-1),Jr(this.vertexArray,-1,1,-1),Jr(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,Yr),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=e.b.simpleSegment(0,0,36,12)}}function en(t,i,r,n,o,s){const a=t.context.gl,l=i.paint.get("sky-atmosphere-color"),c=i.paint.get("sky-atmosphere-halo-color"),u=i.paint.get("sky-atmosphere-sun-intensity"),h=((e,t,i,r,n)=>({u_matrix_3f:e,u_sun_direction:t,u_sun_intensity:i,u_color_tint_r:[r.r,r.g,r.b,r.a],u_color_tint_m:[n.r,n.g,n.b,n.a],u_luminance:5e-5}))(e.bE.fromMat4(e.bE.create(),n),o,u,l,c);a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+s,i.skyboxTexture,0),r.draw(t,a.TRIANGLES,e.af.disabled,e.ah.disabled,e.a.unblended,e.ag.frontCW,h,"skyboxCapture",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}const tn=e.c9([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class rn{constructor(t){const i=new e.cb;i.emplaceBack(-1,1,1,0,0),i.emplaceBack(1,1,1,1,0),i.emplaceBack(1,-1,1,1,1),i.emplaceBack(-1,-1,1,0,1);const r=new e.bw;r.emplaceBack(0,1,2),r.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(i,tn.members),this.indexBuffer=t.createIndexBuffer(r),this.segments=e.b.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const nn=e.c9([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class on{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class sn{constructor(t){this.colorModeAlphaBlendedWriteRGB=new e.a([e.cc,e.cd,e.cc,e.cd],e.C.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new e.a([e.cc,e.ce,e.cc,e.ce],e.C.transparent,[!1,!1,!1,!0]),this.params=new on,this.updateNeeded=!0,t.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},(()=>{this.updateNeeded=!0})),t.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),t.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},(()=>{this.updateNeeded=!0})),t.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},(()=>{this.updateNeeded=!0}))}update(t){const i=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new rn(i);const t=this.params.sizeRange,r=this.params.intensityRange,n=function(t){const i=e.ch(30),r=[];for(let n=0;n<t;++n){const t=2*Math.PI*i(),n=Math.acos(1-2*i())-.5*Math.PI;r.push(e.$.fromValues(Math.cos(n)*Math.cos(t),Math.cos(n)*Math.sin(t),Math.sin(n)))}return r}(this.params.starsCount),o=e.ch(300),s=new e.cf,a=new e.bw;let l=0;for(let i=0;i<n.length;++i){const c=e.$.scale([],n[i],200),u=Math.max(0,1+.01*t*(1*o()-.5)),h=Math.max(0,1+.01*r*(1*o()-.5));s.emplaceBack(c[0],c[1],c[2],-1,-1,u,h),s.emplaceBack(c[0],c[1],c[2],1,-1,u,h),s.emplaceBack(c[0],c[1],c[2],1,1,u,h),s.emplaceBack(c[0],c[1],c[2],-1,1,u,h),a.emplaceBack(l+0,l+1,l+2),a.emplaceBack(l+0,l+2,l+3),l+=4}this.starsVx=i.createVertexBuffer(s,nn.members),this.starsIdx=i.createIndexBuffer(a),this.starsSegments=e.b.simpleSegment(0,0,s.length,a.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(t,i){const r=t.context,n=r.gl,o=t.transform,s=new e.af(n.LEQUAL,e.af.ReadOnly,[0,1]),a=e.a2(o.zoom),l=t.style.getLut(i.scope),c=i.properties.get("color").toRenderColor(l).toArray01(),u=i.properties.get("high-color").toRenderColor(l).toArray01(),h=i.properties.get("space-color").toRenderColor(l).toArray01PremultipliedAlpha(),p=5e-4,d=e.cg(i.properties.get("horizon-blend"),0,1,p,.25),f=e.bc(t,r,o)&&d===p?o.worldSize/(2*Math.PI*1.025)-1:o.globeRadius,m=t.frameCounter/1e3%1,_=e.$.length(o.globeCenterInViewSpace),g=Math.sqrt(Math.pow(_,2)-Math.pow(f,2)),y=Math.acos(g/_),v=i=>{const l="globe"===o.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];i&&l.push("ALPHA_PASS");const p=t.getOrCreateProgram("globeAtmosphere",{defines:l}),f=((e,t,i,r,n,o,s,a,l,c,u,h)=>({u_frustum_tl:e,u_frustum_tr:t,u_frustum_br:i,u_frustum_bl:r,u_horizon:n,u_transition:o,u_fadeout_range:s,u_color:a,u_high_color:l,u_space_color:c,u_temporal_offset:u,u_horizon_angle:h}))(o.frustumCorners.TL,o.frustumCorners.TR,o.frustumCorners.BR,o.frustumCorners.BL,o.frustumCorners.horizon,a,d,c,u,h,m,y);t.uploadCommonUniforms(r,p);const _=this.atmosphereBuffer;_&&p.draw(t,n.TRIANGLES,s,e.ah.disabled,i?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,e.ag.backCW,f,i?"atmosphere_glow_alpha":"atmosphere_glow",_.vertexBuffer,_.indexBuffer,_.segments)};v(!1),v(!0)}drawStars(t,i){const r=e.au(i.properties.get("star-intensity"),0,1);if(0===r)return;const n=t.context,o=n.gl,s=t.transform,a=t.getOrCreateProgram("stars"),l=e.aw.identity([]);e.aw.rotateX(l,l,-s._pitch),e.aw.rotateZ(l,l,-s.angle),e.aw.rotateX(l,l,e.ac(s._center.lat)),e.aw.rotateY(l,l,-e.ac(s._center.lng));const c=e.ae.fromQuat(new Float32Array(16),l),u=e.ae.multiply([],s.starsProjMatrix,c),h=e.bE.fromMat4([],c),p=e.bE.invert([],h),d=[0,1,0];e.$.transformMat3(d,d,p),e.$.scale(d,d,this.params.sizeMultiplier);const f=[1,0,0];e.$.transformMat3(f,f,p),e.$.scale(f,f,this.params.sizeMultiplier);const m=(_=d,g=f,y=r,{u_matrix:Float32Array.from(u),u_up:_,u_right:g,u_intensity_multiplier:y});var _,g,y;t.uploadCommonUniforms(n,a),this.starsVx&&this.starsIdx&&a.draw(t,o.TRIANGLES,e.af.disabled,e.ah.disabled,this.colorModeAlphaBlendedWriteRGB,e.ag.disabled,m,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function an(t,i){const r=[...t],n=i.cameraWorldSizeForFog/i.worldSize,o=e.ae.identity([]);return e.ae.scale(o,o,[n,n,1]),e.ae.multiply(r,o,r),e.ae.multiply(r,i.worldToFogMatrix,r),r}function ln(t,i,r,n,o){const s=r.material,a=n.context,{baseColorTexture:l,metallicRoughnessTexture:c}=s.pbrMetallicRoughness,{normalTexture:u,occlusionTexture:h,emissionTexture:p}=s;function d(e,i,r){if(e&&(t.push(i),a.activeTexture.set(a.gl.TEXTURE0+r),e.gfxTexture)){const{minFilter:t,magFilter:i,wrapS:r,wrapT:n}=e.sampler;e.gfxTexture.bindExtraParam(t,i,r,n)}}d(l,"HAS_TEXTURE_u_baseColorTexture",hi.BaseColor),d(c,"HAS_TEXTURE_u_metallicRoughnessTexture",hi.MetallicRoughness),d(u,"HAS_TEXTURE_u_normalTexture",hi.Normal),d(h,"HAS_TEXTURE_u_occlusionTexture",hi.Occlusion),d(p,"HAS_TEXTURE_u_emissionTexture",hi.Emission),o&&(o.texture||(o.texture=new e.cj(n.context,o.image,[o.image.height,o.image.height,o.image.height],a.gl.RGBA)),a.activeTexture.set(a.gl.TEXTURE0+hi.LUT),o.texture&&o.texture.bind(a.gl.LINEAR,a.gl.CLAMP_TO_EDGE),t.push("APPLY_LUT_ON_GPU")),r.texcoordBuffer&&(t.push("HAS_ATTRIBUTE_a_uv_2f"),i.push(r.texcoordBuffer)),r.colorBuffer&&(t.push(12===r.colorBuffer.itemSize?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),i.push(r.colorBuffer)),r.normalBuffer&&(t.push("HAS_ATTRIBUTE_a_normal_3f"),i.push(r.normalBuffer)),r.pbrBuffer&&(t.push("HAS_ATTRIBUTE_a_pbr"),t.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),i.push(r.pbrBuffer)),"OPAQUE"!==s.alphaMode&&"MASK"!==s.alphaMode||t.push("UNPREMULT_TEXTURE_IN_SHADER"),s.defined||t.push("DIFFUSE_SHADED"),t.push("USE_STANDARD_DERIVATIVES")}function cn(t,i,r,n,o,s){const a=r.paint.get("model-opacity"),l=i.context,c=new e.af(i.context.gl.LEQUAL,e.af.ReadWrite,i.depthRangeFor3D),u=i.transform,h=t.mesh,p=h.material,d=p.pbrMetallicRoughness,f=i.style.fog;let m;m="pixels"===i.transform.projection.zAxisUnit?[...t.nodeModelMatrix]:e.ae.multiply([],n.zScaleMatrix,t.nodeModelMatrix),e.ae.multiply(m,n.negCameraPosMatrix,m);const _=e.ae.invert([],m);e.ae.transpose(_,_);const g=r.paint.get("model-emissive-strength").constantOr(0),y=dr(new Float32Array(t.worldViewProjection),new Float32Array(m),new Float32Array(_),null,i,a,d.baseColorFactor.toRenderColor(null),p.emissiveFactor,d.metallicFactor,d.roughnessFactor,p,g,r),v={defines:[]},x=[];ln(v.defines,x,h,i,r.lut);const b=i.shadowRenderer;b&&(b.useNormalOffset=!1);let w=null;if(f){const e=an(t.nodeModelMatrix,i.transform);if(w=new Float32Array(e),"globe"!==u.projection.name){const t=h.aabb.min,i=h.aabb.max,[r,n]=f.getOpacityForBounds(e,t[0],t[1],i[0],i[1]);v.overrideFog=r>=Ke||n>=Ke}}const T=pi(i,r.paint.get("model-cutoff-fade-range"));T.shouldRenderCutoff&&v.defines.push("RENDER_CUTOFF");const M=i.getOrCreateProgram("model",v);i.uploadCommonUniforms(l,M,null,w,T),"shadow"!==i.renderPass&&b&&b.setupShadowsFromMatr
1ix(t.nodeModelMatrix,M),M.draw(i,l.gl.TRIANGLES,c,o,s,h.material.doubleSided?e.ag.disabled:e.ag.backCCW,y,r.id,h.vertexBuffer,h.indexBuffer,h.segments,r.paint,i.transform.zoom,void 0,x)}function un(t,i,r,n,o,s,a){let l;l="globe"===t.projection.name?e.ck(r,t):[...r],e.ae.multiply(l,l,i.matrix);const c=e.ae.multiply([],n,l);if(i.meshes)for(const t of i.meshes){if("BLEND"!==t.material.alphaMode){a.push({mesh:t,depth:0,modelIndex:o,worldViewProjection:c,nodeModelMatrix:l});continue}const i=e.$.transformMat4([],t.centroid,c);i[2]>0&&s.push({mesh:t,depth:i[2],modelIndex:o,worldViewProjection:c,nodeModelMatrix:l})}if(i.children)for(const e of i.children)un(t,e,r,n,o,s,a)}function hn(t,i,r,n){const o=r.shadowRenderer;if(!o)return;const s=o.getShadowPassDepthMode(),a=o.getShadowPassColorMode(),l=o.calculateShadowPassMatrixFromMatrix(i),c=fr(l);r.getOrCreateProgram("modelDepth",{defines:r._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(r,r.context.gl.TRIANGLES,s,e.ah.disabled,a,e.ag.backCCW,c,n.id,t.vertexBuffer,t.indexBuffer,t.segments,n.paint,r.transform.zoom,void 0,void 0)}function pn(t,i,r){const n=i.updateZoomBasedPaintProperties(),o=function(t,i,r){let n,o,s,a=t.terrain?t.terrain.exaggeration():0;if(t.terrain&&a>0){const i=t.terrain,o=i.findDEMTileFor(r);o&&o.dem?n=e.cm.create(i,r,o):a=0}if(0===a&&(i.terrainElevationMin=0,i.terrainElevationMax=0),a===i.validForExaggeration&&(0===a||n&&n._demTile&&n._demTile.tileID===i.validForDEMTile.id&&n._dem._timestamp===i.validForDEMTile.timestamp))return!1;for(const e in i.instancesPerModel){const t=i.instancesPerModel[e];for(let e=0;e<t.instancedDataArray.length;++e){const r=(n?a*n.getElevationAt(0|t.instancedDataArray.float32[16*e],0|t.instancedDataArray.float32[16*e+1],!0,!0):0)+t.instancesEvaluatedElevation[e];t.instancedDataArray.float32[16*e+6]=r,o=o?Math.min(i.terrainElevationMin,r):r,s=s?Math.max(i.terrainElevationMax,r):r}}return i.terrainElevationMin=o||0,i.terrainElevationMax=s||0,i.validForExaggeration=a,i.validForDEMTile=n&&n._demTile?{id:n._demTile.tileID,timestamp:n._dem._timestamp}:{id:void 0,timestamp:0},!0}(t,i,r);(n||o)&&(i.uploaded=!1,i.upload(t.context))}const dn={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new e.b8([0,0,0],[e.a4,e.a4,0])};function fn(t,i){const r=1<<t.canonical.z,n=i.getFreeCameraOptions().position,o=i.elevation,s=t.canonical.x/r,a=(t.canonical.x+1)/r,l=t.canonical.y/r,c=(t.canonical.y+1)/r;let u=i._centerAltitude;if(o){const e=o.getMinMaxForTile(t);e&&e.max>u&&(u=e.max)}const h=e.au(n.x,s,a)-n.x,p=e.au(n.y,l,c)-n.y,d=e.ay(u,i.center.lat)-n.z;return i._zoomFromMercatorZ(Math.sqrt(h*h+p*p+d*d))}function mn(t,i,r,n,o,s,a){const l=t.context,c="shadow"===t.renderPass,u=t.shadowRenderer,h=c&&u?u.getShadowPassDepthMode():new e.af(l.gl.LEQUAL,e.af.ReadWrite,t.depthRangeFor3D),p=t.isTileAffectedByFog(s);if(r.meshes)for(const d of r.meshes){const f=["MODEL_POSITION_ON_GPU"],m=[];let _,g,y;n.instancedDataArray.length>20&&f.push("INSTANCED_ARRAYS");const v=pi(t,i.paint.get("model-cutoff-fade-range"));if(v.shouldRenderCutoff&&f.push("RENDER_CUTOFF"),c&&u)_=t.getOrCreateProgram("modelDepth",{defines:f}),g=fr(a.shadowTileMatrix,a.shadowTileMatrix,Float32Array.from(r.matrix)),y=u.getShadowPassColorMode();else{ln(f,m,d,t,i.lut),_=t.getOrCreateProgram("model",{defines:f,overrideFog:p});const n=d.material,c=n.pbrMetallicRoughness,h=i.paint.get("model-opacity"),x=i.paint.get("model-emissive-strength").constantOr(0);g=dr(s.expandedProjMatrix,Float32Array.from(r.matrix),new Float32Array(16),null,t,h,c.baseColorFactor.toRenderColor(null),n.emissiveFactor,c.metallicFactor,c.roughnessFactor,n,x,i,o),u&&(a.shadowUniformsInitialized?_.setShadowUniformValues(l,u.getShadowUniformValues()):(u.setupShadows(s.toUnwrapped(),_,"model-tile",s.overscaledZ),a.shadowUniformsInitialized=!0)),y=v.shouldRenderCutoff||h<1||"OPAQUE"!==n.alphaMode?e.a.alphaBlended:e.a.unblended}t.uploadCommonUniforms(l,_,s.toUnwrapped(),null,v);const x=d.material.doubleSided?e.ag.disabled:e.ag.backCCW;if(n.instancedDataArray.length>20)m.push(n.instancedDataBuffer),_.draw(t,l.gl.TRIANGLES,h,e.ah.disabled,y,x,g,i.id,d.vertexBuffer,d.indexBuffer,d.segments,i.paint,t.transform.zoom,void 0,m,n.instancedDataArray.length);else{const r=c?"u_instance":"u_normal_matrix";for(let o=0;o<n.instancedDataArray.length;++o)g[r]=new Float32Array(n.instancedDataArray.arrayBuffer,64*o,16),_.draw(t,l.gl.TRIANGLES,h,e.ah.disabled,y,x,g,i.id,d.vertexBuffer,d.indexBuffer,d.segments,i.paint,t.transform.zoom,void 0,m)}}if(r.children)for(const e of r.children)mn(t,i,e,n,o,s,a)}const _n=[1,-1,1];function gn(t,i,r,n){if(!r.modelManager)return!0;const o=r.modelManager;
1if(!r.shadowRenderer)return!0;const s=r.shadowRenderer,a=i.aabb;let l=!0,c=t.maxHeight;if(0===c){let e=0;for(const i in t.instancesPerModel){const t=o.getModel(i,n);t?e=Math.max(e,Math.max(Math.max(t.aabb.max[0],t.aabb.max[1]),t.aabb.max[2])):l=!1}c=t.maxScale*e*1.41+t.maxVerticalOffset,l&&(t.maxHeight=c)}a.max[2]=c,a.min[2]+=t.terrainElevationMin,a.max[2]+=t.terrainElevationMax,e.$.transformMat4(a.min,a.min,i.tileMatrix),e.$.transformMat4(a.max,a.max,i.tileMatrix);const u=a.intersects(s.getCurrentCascadeFrustum());return 0===r.currentShadowCascade&&(t.isInsideFirstShadowMapFrustum=2===u),0===u}function yn(t,i){const r=t.uniformValues.u_cutoff_params[0],n=t.uniformValues.u_cutoff_params[1],o=t.uniformValues.u_cutoff_params[2],s=t.uniformValues.u_cutoff_params[3];return n===r||s===o?1:e.au(((i-r)/(n-r)-o)/(s-o),0,1)}function vn(t,i,r,n){if(i.pitch<20)return 1;const o=i.getWorldToCameraMatrix(),s=e.ae.multiply([],o,t),a=[...r.min,1];let l=e.aB.transformMat4([],a,s),c=l,u=l;a[1]=r.max[1],l=e.aB.transformMat4([],a,s),c=l[1]<c[1]?l:c,u=l[1]>u[1]?l:u,a[0]=r.max[0],l=e.aB.transformMat4([],a,s),c=l[1]<c[1]?l:c,u=l[1]>u[1]?l:u,a[1]=r.min[1],l=e.aB.transformMat4([],a,s),c=l[1]<c[1]?l:c,u=l[1]>u[1]?l:u;const h=e.au(n[0],0,1),p=100*i.pixelsPerMeter*e.au(n[1],0,1),d=e.au(n[2],0,1),f=e.$.lerp([],c,u,h),m=Math.tan(.5*i.fovX),_=-f[2]*m;if(0===p)return f[1]<-Math.abs(_)?d:1;const g=(-Math.abs(_)-f[1])/p,y=(e,t,i)=>(1-i)*e+i*t,v=e.au(y(1,d,g),d,1);return y(1,v,e.au((i.pitch-20)/20,0,1))}class xn{}class bn{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,i,r){{const e=this._storage.get(i.id);if(e)return e.lastUsedFrameIdx=t,e.buf}const n=r.gl,o=n.getBufferParameter(n.ELEMENT_ARRAY_BUFFER,n.BUFFER_SIZE),s=new ArrayBuffer(o),a=new Int16Array(s);n.getBufferSubData(n.ELEMENT_ARRAY_BUFFER,0,new Int16Array(s));const l=new e.co;for(let e=0;e<o/2;e+=3){const t=a[e],i=a[e+1],r=a[e+2];l.emplaceBack(t,i),l.emplaceBack(i,r),l.emplaceBack(r,t)}const c=r.bindVertexArrayOES.current,u=new xn;return u.buf=new e.I(r,l),u.lastUsedFrameIdx=t,this._storage.set(i.id,u),r.bindVertexArrayOES.set(c),u.buf}update(e){for(const[t,i]of this._storage)e-i.lastUsedFrameIdx>30&&(i.buf.destroy(),this._storage.delete(t))}destroy(){for(const[e,t]of this._storage)t.buf.destroy(),this._storage.delete(e)}}class wn{constructor(e){this.occluderSize=30,this.depthOffset=-1e-4,e.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),e.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}const Tn={symbol:function(t,i,r,n,o){if("translucent"!==t.renderPass)return;const s=e.ah.disabled,a=t.colorModeForRenderPass();r.layout.get("text-variable-anchor")&&function(t,i,r,n,o,s,a){const l=i.transform,c="map"===o,u="map"===s;for(const i of t){const t=n.getTile(i),o=t.getBucket(r);if(!o||!o.text||!o.text.segments.get().length)continue;const s=e.aE(o.textSizeData,l.zoom),h=yr(i,o.getProjection(),l),p=l.calculatePixelsToTileUnitsMatrix(t),d=Zt(h,t.tileID.canonical,u,c,l,o.getProjection(),p),f=o.hasIconTextFit()&&o.hasIconData();if(s){const r=Math.pow(2,l.zoom-t.tileID.overscaledZ);Mr(o,c,u,a,e.bQ,l,d,i,r,s,f)}}}(n,t,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),o);const l=0!==r.paint.get("icon-opacity").constantOr(1),c=0!==r.paint.get("text-opacity").constantOr(1);void 0!==r.layout.get("symbol-sort-key").constantOr(1)&&(l||c)?Er(t,i,r,n,s,a):(l&&Er(t,i,r,n,s,a,{onlyIcons:!0}),c&&Er(t,i,r,n,s,a,{onlyText:!0})),i.map.showCollisionBoxes&&(xr(t,i,r,n,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),xr(t,i,r,n,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))},circle:function(t,i,r,n){if("translucent"!==t.renderPass)return;const o=r.paint.get("circle-opacity"),s=r.paint.get("circle-stroke-width"),a=r.paint.get("circle-stroke-opacity"),l=void 0!==r.layout.get("circle-sort-key").constantOr(1),c=r.paint.get("circle-emissive-strength");if(0===o.constantOr(1)&&(0===s.constantOr(1)||0===a.constantOr(1)))return;const u=t.context,h=u.gl,p=t.transform,d=t.depthModeForSublayer(0,e.af.ReadOnly),f=e.ah.disabled,m=t.colorModeForDrapableLayerRenderPass(c),_="globe"===p.projection.name,g=[e.ak(p.center.lng),e.al(p.center.lat)],y=[];for(let o=0;o<n.length;o++){const s=n[o],a=i.getTile(s),c=a.getBucket(r);
vendor: 1,816 bytes, line 1
1if(!c||c.projection.name!==p.projection.name)continue;const u=c.programConfigurations.get(r.id),h=e.bT(r),d=t.isTileAffectedByFog(s);_&&h.push("PROJECTION_GLOBE_VIEW"),h.push("DEPTH_D24"),t.terrain&&p.depthOcclusionForSymbolsAndCircles&&h.push("DEPTH_OCCLUSION");const f=t.getOrCreateProgram("circle",{config:u,defines:h,overrideFog:d}),m=c.layoutVertexBuffer,v=c.globeExtVertexBuffer,x=c.indexBuffer,b=p.projection.createInversionMatrix(p,s.canonical),w={programConfiguration:u,program:f,layoutVertexBuffer:m,globeExtVertexBuffer:v,indexBuffer:x,uniformValues:e.bU(t,s,a,b,g,r),tile:a};if(l){const t=c.segments.get();for(const i of t)y.push({segments:new e.b([i]),sortKey:i.sortKey,state:w})}else y.push({segments:c.segments,sortKey:0,state:w})}l&&y.sort(((e,t)=>e.sortKey-t.sortKey));const v={useDepthForOcclusion:p.depthOcclusionForSymbolsAndCircles};for(const i of y){const{programConfiguration:n,program:o,layoutVertexBuffer:s,globeExtVertexBuffer:a,indexBuffer:l,uniformValues:c,tile:_}=i.state,g=i.segments;t.terrain&&t.terrain.setupElevationDraw(_,o,v),t.uploadCommonUniforms(u,o,_.tileID.toUnwrapped()),o.draw(t,h.TRIANGLES,d,f,m,e.ag.disabled,c,r.id,s,l,g,r.paint,p.zoom,n,[a])}},heatmap:function(t,i,r,n){if(0!==r.paint.get("heatmap-opacity"))if("offscreen"===t.renderPass){const o=t.context,s=o.gl,a=e.ah.disabled,l=new e.a([s.ONE,s.ONE,s.ONE,s.ONE],e.C.transparent,[!0,!0,!0,!0]);!function(e,t,i,r){const n=e.gl,o=t.width*r,s=t.height*r;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,o,s]);let a=i.heatmapFbo;if(!a||a&&(a.width!==o||a.height!==s)){a&&a.destroy();const t=n.createTexture();n.bindTexture(n.TEXTURE_2D,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.L
1INEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),a=i.heatmapFbo=e.createFramebuffer(o,s,!0,null),function(e,t,i,r,n,o){const s=e.gl;s.texImage2D(s.TEXTURE_2D,0,e.extRenderToTextureHalfFloat?s.RGBA16F:s.RGBA,n,o,0,s.RGBA,e.extRenderToTextureHalfFloat?s.HALF_FLOAT:s.UNSIGNED_BYTE,null),r.colorAttachment.set(i)}(e,0,t,a,o,s)}else n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer)}(o,t,r,"globe"===t.transform.projection.name?.5:.25),o.clear({color:e.C.transparent});const c=t.transform,u="globe"===c.projection.name,h=u?["PROJECTION_GLOBE_VIEW"]:[],p=u?e.ag.frontCCW:e.ag.disabled,d=[e.ak(c.center.lng),e.al(c.center.lat)];for(let f=0;f<n.length;f++){const m=n[f];if(i.hasRenderableParent(m))continue;const _=i.getTile(m),g=_.getBucket(r);if(!g||g.projection.name!==c.projection.name)continue;const y=t.isTileAffectedByFog(m),v=g.programConfigurations.get(r.id),x=t.getOrCreateProgram("heatmap",{config:v,defines:h,overrideFog:y}),{zoom:b}=t.transform;t.terrain&&t.terrain.setupElevationDraw(_,x),t.uploadCommonUniforms(o,x,m.toUnwrapped());const w=c.projection.createInversionMatrix(c,m.canonical);x.draw(t,s.TRIANGLES,e.af.disabled,a,l,p,Yi(t,m,_,w,d,b,r.paint.get("heatmap-intensity")),r.id,g.layoutVertexBuffer,g.indexBuffer,g.segments,r.paint,t.transform.zoom,v,u?[g.globeExtVertexBuffer]:null)}o.viewport.set([0,0,t.width,t.height])}else"translucent"===t.renderPass&&(t.context.setColorMode(t.colorModeForRenderPass()),function(t,i){const r=t.context,n=r.gl,o=i.heatmapFbo;if(!o)return;r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,o.colorAttachment.get()),r.activeTexture.set(n.TEXTURE1);let s=i.colorRampTexture;s||(s=i.colorRampTexture=new e.T(r,i.colorRamp,n.RGBA)),s.bind(n.LINEAR,n.CLAMP_TO_EDGE),t.getOrCreateProgram("heatmapTexture").draw(t,n.TRIANGLES,e.af.disabled,e.ah.disabled,t.colorModeForRenderPass(),e.ag.disabled,((e,t,i,r)=>({u_image:0,u_color_ramp:1,u_opacity:t.paint.get("heatmap-opacity")}))(0,i),i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,i.paint,t.transform.zoom)}(t,r))},line:function(t,i,r,n){if("translucent"!==t.renderPass)return;const o=r.paint.get("line-opacity"),s=r.paint.get("line-width");if(0===o.constantOr(1)||0===s.constantOr(1))return;const a=r.paint.get("line-emissive-strength"),l=r.paint.get("line-occlusion-opacity"),c=t.context,u=c.gl,h=r.layout.get("line-z-offset"),p=!h.isConstant()||!!h.constantOr(0),d=p?new e.af(t.depthOcclusion?u.GREATER:u.LEQUAL,e.af.ReadOnly,t.depthRangeFor3D):t.depthModeForSublayer(0,e.af.ReadOnly),f=t.colorModeForDrapableLayerRenderPass(a),m=t.terrain&&t.terrain.renderingToTexture,_=m?1:e.e.devicePixelRatio,g=r.paint.get("line-dasharray"),y=g.constantOr(1),v=r.layout.get("line-cap"),x=g.constantOr(null),b=v.constantOr(null),w=r.paint.get("line-pattern"),T=w.constantOr(1),M=w.constantOr(null),E=r.paint.get("line-opacity").constantOr(1);let S=!T&&1!==E||t.depthOcclusion&&l>0&&l<1;const C=r.paint.get("line-gradient"),A=T?"linePattern":"line",I=e.bV(r);let k;if(m&&t.terrain&&t.terrain.clipOrMaskOverlapStencilType()&&(S=!1),0!==l&&t.depthOcclusion){const t=r.paint._values["line-opacity"];t&&t.value&&"constant"===t.value.kind?k=t.value:e.w(`Occlusion opacity for layer ${r.id} is supported only when line-opacity isn't data-driven.`)}if(p&&(t.forceTerrainMode=!0),!p&&0!==l&&t.terrain&&!m)return void e.w(`Occlusion opacity for layer ${r.id} is supported on terrain only if the layer has non-zero line-z-offset.`);const L=S&&p?t.stencilModeFor3D():e.ah.disabled;for(const o of n){const n=i.getTile(o);if(T&&!n.patternsLoaded())continue;const s=n.getBucket(r);if(!s)continue;t.prepareDrawTile();const a=s.programConfigurations.get(r.id),h=t.isTileAffectedByFog(o),g=t.getOrCreateProgram(A,{config:a,defines:p?[...I,"ELEVATED"]:I,overrideFog:h});if(M&&n.imageAtlas){const e=n.imageAtlas.patternPositions[M.toString()];e&&a.setConstantPatternPositions(e)}if(!T&&x&&b&&n.lineAtlas){const e=n.lineAtlas.getDash(x,b);e&&a.setConstantPatternPositions(e)}let[v,w]=r.paint.get("line-trim-offset");if("round"===b||"square"===b){const e=1;v!==w&&(0===v&&(v-=e),1===w&&(w+=e))}const P=m?o.projMatrix:null,R=T?e.bW(t,n,r,P,_,[v,w]):e.bX(t,n,r,P,s.lineClipsArray.length,_,[v,w]);if(C){const n=s.gradients[r.id];let a=n.texture;if(r.gradientVersion!==n.version){let l=256;if(r.stepInterpolant){const r=i.getSource().maxzoom,n=o.canonical.z===r?Math.ceil(1<<t.transform.maxZoom-o.canonical.z):1;l=e.au(e.bY(s.maxLineLength/e.a4*1024*n),256,c.maxTextureSize)}n.gradient=e.bZ({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:n.gradient||void 0,clips:s.lineClipsArray}),n.texture?n.texture.update(n.gradient):n.texture=new e.T(c,n.gradient,u.RGBA),n.version=r.gradientVersion,a=n.texture}c.activeTexture.set(u.TEXTURE1),a.bind(r.stepInterpolant?u.NEAREST:u.LINEAR,u.CLAMP_TO_EDGE)}y&&(c.activeTexture.set(u.TEXTURE0),n.lineAtlasTexture&&n.lineAtlasTexture.bind(u.LINEAR,u.REPEAT),a.updatePaintBuffers()),T&&(c.activeTexture.set(u.TEXTURE0),n.imageAtlasTexture&&n.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),a.updatePaintBuffers()),p&&t.terrain.setupElevationDraw(n,g),t.uploadCommonUniforms(c,g,o.toUnwrapped());const z=i=>{null!=k&&(k.value=E*l),g.draw(t,u.TRIANGLES,d,i,f,e.ag.disabled,R,r.id,s.layoutVertexBuffer,s.indexBuffer,s.segments,r.paint,t.transform.zoom,a,[s.layoutVertexBuffer2,s.patternVertexBuffer,s.zOffsetVertexBuffer]),null!=k&&(k.value=E)};if(S&&!p){const i=t.stencilModeForClipping(o).ref;0===i&&m&&c.clear({stencil:0});const r={func:u.EQUAL,mask:255};R.u_alpha_discard_threshold=.8,z(new e.ah(r,i,255,u.KEEP,u.KEEP,u.INVERT)),R.u_alpha_discard_threshold=0,z(ne
1w e.ah(r,i,255,u.KEEP,u.KEEP,u.KEEP))}else S&&p&&(R.u_alpha_discard_threshold=.001),z(p?L:t.stencilModeForClipping(o))}S&&(t.resetStencilClippingMasks(),m&&c.clear({stencil:0})),0===l||t.depthOcclusion||m||t.layersWithOcclusionOpacity.push(t.currentLayer),p&&(t.forceTerrainMode=!1)},fill:function(t,i,r,n){const o=r.paint.get("fill-color"),s=r.paint.get("fill-opacity");if(0===s.constantOr(1))return;const a=r.paint.get("fill-emissive-strength"),l=t.colorModeForDrapableLayerRenderPass(a),c=r.paint.get("fill-pattern"),u=t.opaquePassEnabledForLayer()&&!c.constantOr(1)&&1===o.constantOr(e.C.transparent).a&&1===s.constantOr(0)?"opaque":"translucent";if(t.renderPass===u){const o=t.depthModeForSublayer(1,"opaque"===t.renderPass?e.af.ReadWrite:e.af.ReadOnly);Cr(t,i,r,n,o,l,!1)}if("translucent"===t.renderPass&&r.paint.get("fill-antialias")){const o=t.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,e.af.ReadOnly);Cr(t,i,r,n,o,l,!0)}},"fill-extrusion":function(t,i,r,n){const o=r.paint.get("fill-extrusion-opacity"),s=t.context,a=s.gl,l=t.terrain,c=l&&l.renderingToTexture;if(0===o)return;const u=t.conflationActive&&t.style.isLayerClipped(r,i.getSource()),h=t.style.order.indexOf(r.fqid);if(u&&function(e,t,i,r,n){for(const o of r){const r=t.getTile(o).getBucket(i);r&&(r.updateReplacement(o,e.replacementSource,n),r.uploadCentroid(e.context))}}(t,i,r,n,h),l||u)for(const e of n){const n=i.getTile(e).getBucket(r);n&&kr(t.context,i,e,n,r,l,u)}if("shadow"===t.renderPass&&t.shadowRenderer){const s=t.shadowRenderer;if(l&&o<.65&&r._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof e.Z)return;const a=s.getShadowPassDepthMode(),c=s.getShadowPassColorMode();Ar(t,i,r,n,a,e.ah.disabled,c,u)}else if("translucent"===t.renderPass){const h=!r.paint.get("fill-extrusion-pattern").constantOr(1),p=r.paint.get("fill-extrusion-color").constantOr(e.C.white);if(!c&&0!==p.a){const s=new e.af(t.context.gl.LEQUAL,e.af.ReadWrite,t.depthRangeFor3D);1===o&&h?Ar(t,i,r,n,s,e.ah.disabled,e.a.unblended,u):(Ar(t,i,r,n,s,e.ah.disabled,e.a.disabled,u),Ar(t,i,r,n,s,t.stencilModeFor3D(),t.colorModeForRenderPass(),u),t.resetStencilClippingMasks())}if(t.style.enable3dLights()&&h&&(!l&&"globe"!==t.transform.projection.name||c)){const o=r.paint.get("fill-extrusion-opacity"),h=r.paint.get("fill-extrusion-ambient-occlusion-intensity"),p=r.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),d=r.paint.get("fill-extrusion-flood-light-intensity"),f=r.paint.get("fill-extrusion-flood-light-color").toRenderColor(r.lut).toArray01().slice(0,3),m=h>0&&p>0,_=d>0,g=(e,t,i)=>(1-i)*e+i*t,y=s=>{const l=t.depthModeForSublayer(1,e.af.ReadOnly,a.LEQUAL,!0),c=r.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),m=g(.1,3,c),_=t._showOverdrawInspector;if(!_){const c=new e.ah({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),_=new e.a([a.ONE,a.ONE,a.ONE,a.ONE],e.C.transparent,[!1,!1,!1,!0],a.MIN);Ir(t,i,r,n,l,c,_,e.ag.disabled,s,"sdf",o,h,p,d,f,m,u,!1)}{const c=_?e.ah.disabled:new e.ah({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),g=_?t.colorModeForRenderPass():new e.a([a.ONE_MINUS_DST_ALPHA,a.DST_ALPHA,a.ONE,a.ONE],e.C.transparent,[!0,!0,!0,!0]);Ir(t,i,r,n,l,c,g,e.ag.disabled,s,"color",o,h,p,d,f,m,u,!1)}};if(c){const c=(s,l,c)=>{const m=t.depthModeForSublayer(1,e.af.ReadOnly,a.LEQUAL,!1),_=r.paint.get(s?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),y=g(.1,3,_);{const c=new e.a([a.ONE,a.ONE,a.ONE,a.ONE],e.C.transparent,[!1,!1,!1,!0]);Ir(t,i,r,n,m,e.ah.disabled,c,e.ag.disabled,s,"clear",o,h,p,d,f,y,u,l)}{const c=new e.ah({func:a.ALWAYS,mask:255},255,255,a.KEEP,a.KEEP,a.REPLACE),_=new e.a([a.ONE,a.ONE,a.ONE,a.ONE],e.C.transparent,[!1,!1,!1,!0],a.MIN);Ir(t,i,r,n,m,c,_,e.ag.disabled,s,"sdf",o,h,p,d,f,y,u,l)}{const c=s?a.ZERO:a.ONE_MINUS_DST_ALPHA,_=new e.ah({func:a.EQUAL,mask:255},255,255,a.KEEP,a.DECR,a.DECR),g=new e.a([c,a.DST_ALPHA,a.ONE_MINUS_DST_ALPHA,a.ZERO],e.C.transparent,[!0,!0,!0,!0]);Ir(t,i,r,n,m,_,g,e.ag.disabled,s,"color",o,h,p,d,f,y,u,l)}{const _=new e.a([a.ONE,a.ONE,a.ONE,s?a.ZERO:a.ONE],e.C.transparent,[!1,!1,!1,!0],s?a.FUNC_ADD:a.MAX);Ir(t,i,r,n,m,e.ah.disabled,_,e.ag.disabled,s,"clear",o,h,p,d,f,y,u,l,c)}};if(m||_){let i;if(t.prepareDrawTile(),l){const t=l.drapeBufferSize[0],r=l.drapeBufferSize[1];i=l.framebufferCopyTexture,i&&(!i||i.size[0]===t&&i.size[1]===r)||(i&&i.destroy(),i=l.framebufferCopyTexture=new e.T(s,new e.j({width:t,height:r}),a.RGBA)),i.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.copyTexImage2D(a.TEXTURE_2D,0,a.RGBA,0,0,t,r,0)}m&&c(!0,!1,i),_&&c(!1,!0,i)}}else m&&y(!0),_&&y(!1),(m||_)&&t.resetStencilClippingMasks()}}},hillshade:function(t,i,r,n){if("offscreen"!==t.renderPass&&"translucent"!==t.renderPass)return;if(t.style.disableElevatedTerrain)return;const o=t.context,s=t.terrain&&t.terrain.renderingToTexture,[a,l]="translucent"!==t.renderPass||s?[{},n]:t.stencilConfigForOverlap(n);for(const n of l){const o=i.getTile(n);if(o.needsHillshadePrepare&&"offscreen"===t.renderPass)Pt(t,o,r);else if("translucent"===t.renderPass){const i=t.depthModeForSublayer(0,e.af.ReadOnly),l=r.paint.get("hillshade-emissive-strength"),c=t.colorModeForDrapableLayerRenderPass(l),u=s&&t.terrain?t.terrain.stencilModeForRTTOverlap(n):a[n.overscaledZ];kt(t,n,o,r,i,u,c)}}o.viewport.set([0,0,t.width,t.height]),t.resetStencilClippingMasks()}
1,raster:function(t,i,r,n,o,s){if("translucent"!==t.renderPass)return;if(0===r.paint.get("raster-opacity"))return;const a="globe"===t.transform.projection.name,l=0!==r.paint.get("raster-elevation"),c=l&&a;if(t.renderElevatedRasterBackface&&!c)return;const u=t.context,h=u.gl,p=i.getSource(),d=function(t,i,r,n){const o=i.paint.get("raster-color"),s="raster-array"===t.type,a=[],l=i.paint.get("raster-resampling"),c=i.paint.get("raster-color-mix");let u=i.paint.get("raster-color-range");const h=[c[0],c[1],c[2],0],p=c[3];let d="nearest"===l?n.NEAREST:n.LINEAR;if(s&&(a.push("RASTER_ARRAY"),o||a.push("RASTER_COLOR"),"linear"===l&&a.push("RASTER_ARRAY_LINEAR"),d=n.NEAREST,!u&&t.rasterLayers)){const e=t.rasterLayers.find((({id:e})=>e===i.sourceLayer));e&&e.fields&&e.fields.range&&(u=e.fields.range)}if(u=u||[0,1],o){a.push("RASTER_COLOR"),r.activeTexture.set(n.TEXTURE2),i.updateColorRamp(u);let t=i.colorRampTexture;t||(t=i.colorRampTexture=new e.T(r,i.colorRamp,n.RGBA)),t.bind(n.LINEAR,n.CLAMP_TO_EDGE)}return{mix:h,range:u,offset:p,defines:a,resampling:d}}(p,r,u,h);if(p instanceof e.bo&&!n.length&&!a)return;const f=r.paint.get("raster-emissive-strength"),m=t.colorModeForDrapableLayerRenderPass(f),_=t.terrain&&t.terrain.renderingToTexture,g=!t.options.moving,y="nearest"===r.paint.get("raster-resampling")?h.NEAREST:h.LINEAR;if(p instanceof e.bo&&!n.length&&(p.onNorthPole||p.onSouthPole)){const n=l?t.stencilModeFor3D():e.ah.disabled;return void Dr(!!p.onNorthPole,null,t,i,r,f,d,e.ag.disabled,n)}if(!n.length)return;const[v,x]=p instanceof e.bo||_?[{},n]:t.stencilConfigForOverlap(n),b=x[x.length-1].overscaledZ;c&&d.defines.push("PROJECTION_GLOBE_VIEW"),l&&d.defines.push("RENDER_CUTOFF");const w=(n,o,x)=>{for(const w of n){const n=w.toUnwrapped(),T=i.getTile(w);if(_&&(!T||!T.hasData()))continue;u.activeTexture.set(h.TEXTURE0);const M=Br(T,p,r,d);if(!M||!M.texture)continue;const{texture:E,mix:S,offset:C,tileSize:A,buffer:I}=M;let k,L;_?(k=e.af.disabled,L=w.projMatrix):l?(k=new e.af(h.LEQUAL,e.af.ReadWrite,t.depthRangeFor3D),L=a?Float32Array.from(t.transform.expandedFarZProjMatrix):t.transform.calculateProjMatrix(n,g)):(k=t.depthModeForSublayer(w.overscaledZ-b,1===r.paint.get("raster-opacity")?e.af.ReadWrite:e.af.ReadOnly,h.LESS),L=t.transform.calculateProjMatrix(n,g));const P=t.terrain&&_?t.terrain.stencilModeForRTTOverlap(w):v[w.overscaledZ],R=s?0:r.paint.get("raster-fade-duration");T.registerFadeDuration(R);const z=i.findLoadedParent(w,0),O=Ci(T,z,i,t.transform,R);let D,F;t.terrain&&t.terrain.prepareDrawTile(),u.activeTexture.set(h.TEXTURE0),E.bind(y,h.CLAMP_TO_EDGE),u.activeTexture.set(h.TEXTURE1),z?(z.texture&&z.texture.bind(y,h.CLAMP_TO_EDGE),D=Math.pow(2,z.tileID.overscaledZ-T.tileID.overscaledZ),F=[T.tileID.canonical.x*D%1,T.tileID.canonical.y*D%1]):E.bind(y,h.CLAMP_TO_EDGE),E.useMipmap&&u.extTextureFilterAnisotropic&&t.transform.pitch>20&&h.texParameterf(h.TEXTURE_2D,u.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,u.extTextureFilterAnisotropicMax);const B=t.transform;let N;const j=l?Fr(B):[0,0,0,0];let U,V,$,G,q,H=0;if(c&&p instanceof e.bo&&p.coordinates.length>3)U=Float32Array.from(e.bh(e.bi(new e.aO(0,0,0)))),V=Float32Array.from(B.globeMatrix),$=Float32Array.from(e.bd(B)),G=[e.ak(B.center.lng),e.al(B.center.lat)],N=p.elevatedGlobePerspectiveTransform,q=p.elevatedGlobeGridMatrix||new Float32Array(9);else if(c){const t=e.be(w.canonical);H=e.bf(t.getCenter().lat),U=Float32Array.from(e.bh(e.bi(w.canonical))),V=Float32Array.from(B.globeMatrix),$=Float32Array.from(e.bd(B)),G=[e.ak(B.center.lng),e.al(B.center.lat)],N=[0,0],q=Float32Array.from(e.bg(w.canonical,t,H,B.worldSize/B._pixelsPerMercatorPixel))}else N=p instanceof e.bo?p.perspectiveTransform:[0,0],U=new Float32Array(16),V=new Float32Array(9),$=new Float32Array(16),G=[0,0],q=new Float32Array(9);const Z=er(L,U,V,$,q,F||[0,0],e.a2(t.transform.zoom),G,j,D||1,O,r,N,l?r.paint.get("raster-elevation"):0,2,S,C,d.range,A,I,f),W=t.isTileAffectedByFog(w),X=t.getOrCreateProgram("raster",{defines:d.defines,overrideFog:W});if(t.uploadCommonUniforms(u,X,n),p instanceof e.bo){const i=p.elevatedGlobeVertexBuffer,n=p.elevatedGlobeIndexBuffer;if(_||!a)p.boundsBuffer&&p.boundsSegments&&X.draw(t,h.TRIANGLES,k,e.ah.disabled,m,e.ag.disabled,Z,r.id,p.boundsBuffer,t.quadTriangleIndexBuffer,p.boundsSegments);else if(i&&n){const s=B.zoom<=e.b3?p.elevatedGlobeSegments:p.getSegmentsForLongitude(
vendor: 6,214 bytes, line 1
1B.center.lng);s&&X.draw(t,h.TRIANGLES,k,e.ah.disabled,m,o,Z,r.id,i,n,s)}}else if(c){k=new e.af(h.LEQUAL,e.af.ReadOnly,t.depthRangeFor3D);const i=t.globeSharedBuffers;if(i){const[e,n,s]=i.getGridBuffers(H,!1);X.draw(t,h.TRIANGLES,k,x||P,t.colorModeForRenderPass(),o,Z,r.id,e,n,s)}}else{const{tileBoundsBuffer:i,tileBoundsIndexBuffer:n,tileBoundsSegments:o}=t.getTileBoundsBuffers(T);X.draw(t,h.TRIANGLES,k,P,m,e.ag.disabled,Z,r.id,i,n,o)}}if(!(p instanceof e.bo)&&c)for(const s of n){const n=s.canonical.y===(1<<s.canonical.z)-1;0===s.canonical.y&&Dr(!0,s,t,i,r,f,d,o,x||e.ah.disabled),n&&Dr(!1,s,t,i,r,f,d,o===e.ag.frontCW?e.ag.backCW:e.ag.frontCW,x||e.ah.disabled)}};c?w(x,t.renderElevatedRasterBackface?e.ag.backCW:e.ag.frontCW,t.stencilModeFor3D()):w(x,e.ag.disabled,void 0),t.resetStencilClippingMasks()},"raster-particle":function(t,i,r,n,o,s){"offscreen"===t.renderPass&&function(t,i,r,n){if(!n.length)return;const o=t.context,s=o.gl,a=i.getSource();if(!(a instanceof Ai))return;const l=Math.ceil(Math.sqrt(r.paint.get("raster-particle-count")));let c=r.particlePositionRGBAImage;if(!c||c.width!==l){const t=function(e){const t=e*e,i=new Uint8Array(4*t),r=function(e){return e|=0,e=Math.imul(2747636419^e,2654435769),e=Math.imul(e^e>>>16,2654435769),((e=Math.imul(e^e>>>16,2654435769))>>>0)/4294967296},n=1/1.1;for(let e=0;e<t;e++){const t=n*(r(2*e+0)+ir),o=n*(r(2*e+1)+ir),s=255*t%1,a=255*o%1,l=s,c=o-a/255,u=a;i[4*e+0]=255*(t-s/255),i[4*e+1]=255*l,i[4*e+2]=255*c,i[4*e+3]=255*u}return i}(l);c=r.particlePositionRGBAImage=new e.j({width:l,height:l},t)}let u=r.particleFramebuffer;u?u.width!==l&&(u.destroy(),u=r.particleFramebuffer=o.createFramebuffer(l,l,!0,null)):u=r.particleFramebuffer=o.createFramebuffer(l,l,!0,null);const h=[];for(const t of n){const n=i.getTile(t);if(!(n instanceof e.c5))continue;const s=Nr(n,a,r);if(!s)continue;const u=[n.tileSize,n.tileSize];let p=r.tileFramebuffer;p||(p=r.tileFramebuffer=o.createFramebuffer(u[0],u[1],!0,null));let d=n.rasterParticleState;d||(d=n.rasterParticleState=new oe(o,t,u,c));const f=d.update(r.lastInvalidatedAt);d.particleTextureDimension!==l&&d.updateParticleTexture(t,c);const m=d.targetColorTexture;d.targetColorTexture=d.backgroundColorTexture,d.backgroundColorTexture=m;const _=d.particleTexture0;d.particleTexture0=d.particleTexture1,d.particleTexture1=_,h.push([t,s,d,f])}if(0===h.length)return;const p=e.e.now(),d=r.previousDrawTimestamp?.001*(p-r.previousDrawTimestamp):.0167;if(r.previousDrawTimestamp=p,r.hasColorMap()){o.activeTexture.set(s.TEXTURE0+2);let t=r.colorRampTexture;t||(t=r.colorRampTexture=new e.T(o,r.colorRamp,s.RGBA)),t.bind(s.LINEAR,s.CLAMP_TO_EDGE)}o.bindFramebuffer.set(r.tileFramebuffer.framebuffer),function(t,i,r){const n=t.context,o=n.gl,s=i.tileFramebuffer;n.activeTexture.set(o.TEXTURE0);const a={u_texture:0,u_opacity:1.05*(c=i.paint.get("raster-particle-fade-opacity-factor"))/(c+.05)},l=t.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var c;for(const c of r){const[,,r,u]=c;s.colorAttachment.set(r.targetColorTexture.texture),n.viewport.set([0,0,s.width,s.height]),n.clear({color:e.C.transparent}),u&&(r.backgroundColorTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),l.draw(t,o.TRIANGLES,e.af.disabled,e.ah.disabled,e.a.alphaBlended,e.ag.disabled,a,i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments))}}(t,r,h),function(t,i,r,n){const o=t.context,s=o.gl,a=r.tileFramebuffer,l="globe"===t.transform.projection.name,c=r.paint.get("raster-particle-max-speed");for(const u of n){const[n,h,p]=u;o.activeTexture.set(s.TEXTURE0+0),h.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),a.colorAttachment.set(p.targetColorTexture.texture);const d=t.getOrCreateProgram("rasterParticleDraw",{defines:h.defines,overrideFog:!1});o.activeTexture.set(s.TEXTURE0+1);const f=h.scalarData?[]:[0,1,2,3].map((t=>e.b$[t](n)));f.push(n);const m=n.canonical.x,_=n.canonical.y;for(const o of f){const a=i.getTile(l?o.wrapped():o);if(!a)continue;const u=a.rasterParticleState;if(!u)continue;const p=o.canonical.x+(1<<o.canonical.z)*(o.wrap-n.wrap),f=o.canonical.y;u.particleTexture0.bind(s.NEAREST,s.CLAMP_TO_EDGE);const g=nr(1,u.particleTexture0.size[0],[p-m,f-_],0,h.texture.size,2,c,h.textureOffset,h.scale,h.offset);d.draw(t,s.POINTS,e.af.disabled,e.ah.disabled,e.a.alphaBlended,e.ag.disabled,g,r.id,u.particleIndexBuffer,void 0,u.particleSegment)}}}(t,i,r,h),o.bindFramebuffer.set(r.particleFramebuffer.framebuffer),function(t,i,r,n){const o=t.context,s=o.gl,a=i.paint.get("raster-particle-max-speed"),l=n*i.paint.get("raster-particle-speed-factor")*.15,c=function(e){return Math.pow(e,6)}(.01+1*i.paint.get("raster-particle-reset-rate-factor")),u=i.particleFramebuffer;o.viewport.set([0,0,u.width,u.height]);for(const n of r){const[,r,h]=n;o.activeTexture.set(s.TEXTURE0+0),r.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),o.activeTexture.set(s.TEXTURE0+1);const p=h.particleTexture0;p.bind(s.NEAREST,s.CLAMP_TO_EDGE);const d=or(1,p.size[0],0,r.texture.size,a,l,c,r.textureOffset,r.scale,r.offset);u.colorAttachment.set(h.particleTexture1.texture),o.clear({color:e.C.transparent}),t.getOrCreateProgram("rasterParticleUpdate",{defines:r.defines}).draw(t,s.TRIANGLES,e.af.disabled,e.ah.disabled,e.a.unblended,e.ag.disabled,d,i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments)}}(t,r,h,d)}(t,i,r,n),"translucent"===t.renderPass&&(function(t,i,r,n,o){const s=t.context,a=s.gl,l=i.getSource().tileSize,c=5*(1-e.a0(e.aV,e.aV+1,t.transform.zoom))*l+r.paint.get("raster-particle-elevation"),u=!t.options.moving,h="globe"===t.transform.projection.name;if(!n.length)return;const[p,d]=t.stencilConfigForOverlap(n),f=[];h&&f.push("PROJECTION_GLOBE_VIEW");const m=t.stencilModeFor3D();for(const n of d){const o=n.toUnwrapped(),l=i.getTile(n);if(!l.rasterParticleState)continue;const d=l.rasterParticleState,_=100;l.registerFadeDuration(_);const g=i.findLoadedParent(n,0),y=Ci(l,g,i,t.transform,_);let v,x;t.terrain&&t.terrain.prepareDrawTile(),s.activeTexture.set(a.TEXTURE0),d.targetColorTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),s.activeTexture.set(a.TEXTURE1),g&&g.rasterParticleState?(g.rasterParticleState.targetColorTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE),v=Math.pow(2,g.tileID.overscaledZ-l.tileID.overscaledZ
vendor: 7,678 bytes, line 1
1),x=[l.tileID.canonical.x*v%1,l.tileID.canonical.y*v%1]):d.targetColorTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE);const b=h?Float32Array.from(t.transform.expandedFarZProjMatrix):t.transform.calculateProjMatrix(o,u),w=t.transform,T=jr(w),M=e.be(n.canonical),E=e.bf(M.getCenter().lat);let S,C,A,I,k;h?(S=Float32Array.from(e.bh(e.bi(n.canonical))),C=Float32Array.from(w.globeMatrix),A=Float32Array.from(e.bd(w)),I=[e.ak(w.center.lng),e.al(w.center.lat)],k=Float32Array.from(e.bg(n.canonical,M,E,w.worldSize/w._pixelsPerMercatorPixel))):(S=new Float32Array(16),C=new Float32Array(9),A=new Float32Array(16),I=[0,0],k=new Float32Array(9));const L=rr(b,S,C,A,k,x||[0,0],e.a2(t.transform.zoom),I,T,v||1,y,c),P=t.isTileAffectedByFog(n),R=t.getOrCreateProgram("rasterParticle",{defines:f,overrideFog:P});if(t.uploadCommonUniforms(s,R,o),h){const i=new e.af(a.LEQUAL,e.af.ReadOnly,t.depthRangeFor3D),n=0,o=t.globeSharedBuffers;if(o){const[s,l,c]=o.getGridBuffers(E,0!==n);R.draw(t,a.TRIANGLES,i,m,e.a.alphaBlended,t.renderElevatedRasterBackface?e.ag.frontCCW:e.ag.backCCW,L,r.id,s,l,c)}}else{const i=t.depthModeForSublayer(0,e.af.ReadOnly),o=p[n.overscaledZ],{tileBoundsBuffer:s,tileBoundsIndexBuffer:c,tileBoundsSegments:u}=t.getTileBoundsBuffers(l);R.draw(t,a.TRIANGLES,i,o,e.a.alphaBlended,e.ag.disabled,L,r.id,s,c,u)}}t.resetStencilClippingMasks()}(t,i,r,n),t.style.map.triggerRepaint())},background:function(t,i,r,n){const o=r.paint.get("background-color"),s=r.paint.get("background-opacity"),a=r.paint.get("background-emissive-strength");if(0===s)return;const l=t.context,c=l.gl,u=t.transform,h=u.tileSize,p=r.paint.get("background-pattern");let d;if(void 0!==p){if(null===p)return;if(d=t.imageManager.getPattern(p.toString(),r.scope,t.style.getLut(r.scope)),!d)return}const f=!p&&1===o.a&&1===s&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==f)return;const m=e.ah.disabled,_=t.depthModeForSublayer(0,"opaque"===f?e.af.ReadWrite:e.af.ReadOnly),g=t.colorModeForDrapableLayerRenderPass(a),y=p?"backgroundPattern":"background";let v,x=n;x||(v=t.getBackgroundTiles(),x=Object.values(v).map((e=>e.tileID))),p&&(l.activeTexture.set(c.TEXTURE0),t.imageManager.bind(t.context,r.scope));for(const f of x){const x=t.isTileAffectedByFog(f),b=t.getOrCreateProgram(y,{overrideFog:x}),w=f.toUnwrapped(),T=n?f.projMatrix:t.transform.calculateProjMatrix(w);t.prepareDrawTile();const M=i?i.getTile(f):v?v[f.key]:new e.bA(f,h,u.zoom,t),E=p?hr(T,a,s,t,0,r.scope,d,{tileID:f,tileSize:h}):ur(T,a,s,o.toRenderColor(r.lut));t.uploadCommonUniforms(l,b,w);const{tileBoundsBuffer:S,tileBoundsIndexBuffer:C,tileBoundsSegments:A}=t.getTileBoundsBuffers(M);b.draw(t,c.TRIANGLES,_,m,g,e.ag.disabled,E,r.id,S,C,A)}},sky:function(t,i,r){const n=t._atmosphere?e.a2(t.transform.zoom):1,o=r.paint.get("sky-opacity")*n;if(0===o)return;const s=t.context,a=r.paint.get("sky-type"),l=new e.af(s.gl.LEQUAL,e.af.ReadOnly,[0,1]),c=t.frameCounter/1e3%1;"atmosphere"===a?"offscreen"===t.renderPass?r.needsSkyboxCapture(t)&&(function(t,i,r,n){const o=t.context,s=o.gl;let a=i.skyboxFbo;if(!a){a=i.skyboxFbo=o.createFramebuffer(32,32,!0,null),i.skyboxGeometry=new Kr(o),i.skyboxTexture=o.gl.createTexture(),s.bindTexture(s.TEXTURE_CUBE_MAP,i.skyboxTexture),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MAG_FILTER,s.LINEAR);for(let e=0;e<6;++e)s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,s.RGBA,32,32,0,s.RGBA,s.UNSIGNED_BYTE,null)}o.bindFramebuffer.set(a.framebuffer),o.viewport.set([0,0,32,32]);const l=i.getCenter(t,!0),c=t.getOrCreateProgram("skyboxCapture"),u=new Float64Array(16);e.ae.identity(u),e.ae.rotateY(u,u,.5*-Math.PI),en(t,i,c,u,l,0),e.ae.identity(u),e.ae.rotateY(u,u,.5*Math.PI),en(t,i,c,u,l,1),e.ae.identity(u),e.ae.rotateX(u,u,.5*-Math.PI),en(t,i,c,u,l,2),e.ae.identity(u),e.ae.rotateX(u,u,.5*Math.PI),en(t,i,c,u,l,3),e.ae.identity(u),en(t,i,c,u,l,4),e.ae.identity(u),e.ae.rotateY(u,u,Math.PI),en(t,i,c,u,l,5),o.viewport.set([0,0,t.width,t.height])}(t,r),r.markSkyboxValid(t)):"sky"===t.renderPass&&function(t,i,r,n,o){const s=t.context,a=s.gl,l=t.transform,c=t.getOrCreateProgram("skybox");s.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_CUBE_MAP,i.skyboxTexture);const u=((e,t,i,r,n)=>({u_matrix:e,u_sun_direction:t,u_cubemap:0,u_opacity:r,u_temporal_offset:n}))(l.skyboxMatrix,i.getCenter(t,!1),0,n,o);t.uploadCommonUniforms(s,c),c.draw(t,a.TRIANGLES,r,e.ah.disabled,t.colorModeForRenderPass(),e.ag.backCW,u,"skybox",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(t,r,l,o,c):"gradient"===a&&"sky"===t.renderPass&&function(t,i,r,n,o){const s=t.context,a=s.gl,l=t.transform,c=t.getOrCreateProgram("skyboxGradient");i.skyboxGeometry||(i.skyboxGeometry=new Kr(s)),s.activeTexture.set(a.TEXTURE0);let u=i.colorRampTexture;u||(u=i.colorRampTexture=new e.T(s,i.colorRamp,a.RGBA)),u.bind(a.LINEAR,a.CLAMP_TO_EDGE);const h=((t,i,r,n,o)=>({u_matrix:t,u_color_ramp:0,u_center_direction:i,u_radius:e.ac(r),u_opacity:n,u_temporal_offset:o}))(l.skyboxMatrix,i.getCenter(t,!1),i.paint.get("sky-gradient-radius"),n,o);t.uploadCommonUniforms(s,c),c.draw(t,a.TRIANGLES,r,e.ah.disabled,t.colorModeForRenderPass(),e.ag.backCW,h,"skyboxGradient",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(t,r,l,o,c)},debug:function(t,i,r,n,o,s){for(let a=0;a<r.length;a++)if(o){const o=1,l=.8,c=new e.C(n.r*l,n.g*l,n.b*l,1);Hr(t,i,r[a],n,-o,-o,s),Hr(t,i,r[a],n,-o,o,s),Hr(t,i,r[a],n,o,o,s),Hr(t,i,r[a],n,o,-o,s),Hr(t,i,r[a],c,0,0,s)}else Hr(t,i,r[a],n,0,0,s)},custom:function(t,i,r,n){const o=t.context,s=r.implementation;if(!t.transform.projection.unsupportedLayers||!t.transform.projection.unsupportedLayers.includes("custom")||t.terrain&&(t.terrain.renderingToTexture||"offscreen"===t.renderPass)&&r.isDraped(i)){if("offscreen"===t.renderPass){const i=s.prerender;if(i){if(t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),"globe"===t.transform.projection.name){const r=t.transform.pointMerc;i.call(s,o.gl,t.transform.customLayerMatrix(),t.transform.getProjection(),t.transform.globeToMercatorMatrix(),e.a2(t.transform.zoom),[r.x,r.y],t.transform.pixelsPerMeterRatio)}else i.call(s,o.gl,t.transform.customLayerMatrix());o.setDirty(),t.setBaseState()}}else if("translucent"===t.renderPass){if(t.terrain&&t.terrain.renderingToTexture){const i=s.renderToTile;if(i){const r=n[0].canonical,a=new e._(r.x+n[0].wrap*(1<<r.z),r.y,r.z);o.setDepthMode(e.af.disabled),o.setStencilMode(e.ah.disabled),o.setColorMode(t.colorModeForRenderPass()),t.setCustomLayerDefaults(),i.call(s,o.gl,a),o.setDirty(),t.setBaseState()}return}t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),o.setStencilMode(e.ah.disabled);const i="3d"===s.renderingMode?new e.af(t.context.gl.LEQUAL,e.af.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,e.af.ReadOnly);if(o.setDepthMode(i),"globe"===t.transform.projection.name){const i=t.transform.pointMerc;s.render(o.gl,t.transform.customLayerMatrix(),t.transform.getProjection(),t.transform.globeToMercatorMatrix(),e.a2(t.transform.zoom),[i.x,i.y],t.transform.pixelsPerMeterRatio)}else s.render(o.gl,t.transform.customLayerMatrix());o.setDirty(),t.setBaseState(),o.bindFramebuffer.set(null)}}else e.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(t,i,r,n){if("opaque"===t.renderPass)return;const o=r.paint.get("model-opacity");if(0===o)return;const s=r.paint.get("model-cast-shadows");
1if("shadow"===t.renderPass){if(!s)return;if(t.terrain&&o<.65&&r._transitionablePaint._values["model-opacity"].value.expression instanceof e.Z)return}const a=t.shadowRenderer,l=r.paint.get("model-receive-shadows");a&&(a.useNormalOffset=!0,l||(a.enabled=!1));const c=()=>{a&&(a.useNormalOffset=!0,l||(a.enabled=!0))},u=i.getSource();if("light-beam"===t.renderPass&&"batched-model"!==u.type)return;if("vector"===u.type||"geojson"===u.type)return function(t,i,r,n,o){const s=t.transform;if("mercator"!==s.projection.name)return void e.w(`Drawing 3D models for ${s.projection.name} projection is not yet implemented`);const a=s.getFreeCameraOptions().position;if(!t.modelManager)return;const l=t.modelManager;r.modelManager=l;const c=t.shadowRenderer;if(!r._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const u=r._unevaluatedLayout._values["model-id"],h={...r.layout.get("model-id").parameters},p=t.style.order.indexOf(r.fqid);for(const d of n){const n=i.getTile(d).getBucket(r);if(!n||n.projection.name!==s.projection.name)continue;const f=n.getModelUris();f&&!n.modelsRequested&&(l.addModelsFromBucket(f,o),n.modelsRequested=!0);const m=fn(d,s);h.zoom=m;const _=u.possiblyEvaluate(h);if(pn(t,n,d),dn.shadowUniformsInitialized=!1,dn.useSingleShadowCascade=!!c&&0===c.getMaxCascadeForTile(d.toUnwrapped()),"shadow"===t.renderPass&&c){if(1===t.currentShadowCascade&&n.isInsideFirstShadowMapFrustum)continue;const i=s.calculatePosMatrix(d.toUnwrapped(),s.worldSize);if(dn.tileMatrix.set(i),dn.shadowTileMatrix=Float32Array.from(c.calculateShadowPassMatrixFromMatrix(i)),dn.aabb.min.fill(0),dn.aabb.max[0]=dn.aabb.max[1]=e.a4,dn.aabb.max[2]=0,gn(n,dn,t,r.scope))continue}const g=1<<d.canonical.z,y=[((a.x-d.wrap)*g-d.canonical.x)*e.a4,(a.y*g-d.canonical.y)*e.a4,a.z*g*e.a4];t.conflationActive&&Object.keys(n.instancesPerModel).length>0&&t.style.isLayerClipped(r,i.getSource())&&n.updateReplacement(d,t.replacementSource,p,o)&&(n.uploaded=!1,n.upload(t.context));for(let e in n.instancesPerModel){const i=n.instancesPerModel[e];i.features.length>0&&(e=_.evaluate(i.features[0].feature,{}));const s=l.getModel(e,o);if(s&&s.uploaded)for(const e of s.nodes)mn(t,r,e,i,y,d,dn)}}}(t,i,r,n,"vector"===u.type?r.scope:""),void c();if(!u.loaded())return;if("batched-model"===u.type)return function(t,i,r,n){r.resetLayerRenderingStats(t);const o=t.context,s=t.transform,a=t.style.fog,l=t.shadowRenderer;if("mercator"!==s.projection.name)return void e.w(`Drawing 3D landmark models for ${s.projection.name} projection is not yet implemented`);const c=t.transform.getFreeCameraOptions().position,u=e.$.scale([],[c.x,c.y,c.z],t.transform.worldSize);e.$.negate(u,u);const h=e.ae.identity([]),p=e.ci(s.center.lat,s.zoom),d=e.ae.fromScaling([],[1,1,1/p]);e.ae.translate(h,h,u);const f=r.paint.get("model-opacity"),m=new e.af(o.gl.LEQUAL,e.af.ReadWrite,t.depthRangeFor3D),_=new e.af(o.gl.LEQUAL,e.af.ReadOnly,t.depthRangeFor3D),g=new e.b8([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),y="shadow"===t.renderPass,v=y&&l?l.getCurrentCascadeFrustum():s.getFrustum(s.scaleZoom(s.worldSize)),x=r.paint.get("model-front-cutoff"),b=x[2]<1,w=pi(t,r.paint.get("model-cutoff-fade-range")),T=r.getLayerRenderingStats();(function(e,t,i,r){const n=e.terrain?e.terrain.exaggeration():0,o=e.transform.zoom;for(const s of r){const r=t.getTile(s).getBucket(i);r&&(e.conflationActive&&r.updateReplacement(s,e.replacementSource),r.evaluateScale(e,i),e.terrain&&n>0&&r.elevationUpdate(e.terrain,n,s,i.source),r.needsReEvaluation(e,o,i)&&r.evaluate(i))}})(t,i,r,n),function(){let c,u,p;b?(c=n.length-1,u=-1,p=-1):(c=0,u=n.length,p=1);for(let M=c;M!==u;M+=p){const c=n[M],u=i.getTile(c).getBucket(r);if(!u||!u.uploaded)continue;let p=!1;l&&(p=0===l.getMaxCascadeForTile(c.toUnwrapped()));const E=s.calculatePosMatrix(c.toUnwrapped(),s.worldSize),S=u.modelTraits,C=[];for(const i of u.getNodesInfo()){if(i.hiddenByReplacement)continue;if(!i.node.meshes)continue;const r=i.node;let n=0;t.terrain&&r.elevation&&(n=r.elevation*t.terrain.exaggeration());const o=i.evaluatedScale;if(o[0]<=1&&o[1]<=1&&o[2]<=1&&0===(()=>{const t=i.aabb;return g.min=[...t.min],g.max=[...t.max],g.min[2]+=n,g.max[2]+=n,e.$.transformMat4(g.min,g.min,E),e.$.transformMat4(g.max,g.max,E),g})().intersects(v))continue;const a=[...E],l=r.anchor?r.anchor[0]:0,c=r.anchor?r.anchor[1]:0;e.ae.translate(a,a,[l*(o[0]-1),c*(o[1]-1),n]),e.$.exactEquals(o,e.cl)||e.ae.scale(a,a,o);const u=e.ae.multiply([],a,r.matrix),h=e.ae.multiply([],s.expandedFarZProjMatrix,u),p=e.ae.multiply([],s.expandedFarZProjMatrix,a),d=e.aB.transformMat4([],[l,c,n,1],h)[2];r.hidden=!1;let m=f;y||(b&&(m*=vn(a,s,i.aabb,x)),m*=yn(w,d)),0!==m?C.push({nodeInfo:i,depth:d,opacity:m,wvpForNode:h,wvpForTile:p,nodeModelMatrix:u,tileModelMatrix:a}):r.hidden=!0}y||C.sort(((e,t)=>!b||1===e.opacity&&1===t.opacity?e.depth<t.depth?-1:1:1===e.opacity?-1:1===t.opacity?1:e.depth>t.depth?-1:1));for(const i of C){const n=i.nodeInfo,c=n.node;let u=e.ae.multiply([],d,i.tileModelMatrix);e.ae.multiply(u,h,u);const f=e.ae.invert([],u);e.ae.transpose(f,f),e.ae.scale(f,f,_n),u=e.ae.multiply(u,u,c.matrix);
1const g="light-beam"===t.renderPass,v=S&e.cn.HasMapboxMeshFeatures,x=v?0:n.evaluatedRMEA[0][2];for(let h=0;h<c.meshes.length;++h){const d=c.meshes[h],b=h===c.lightMeshIndex;let w=i.wvpForNode;if(b){if(!g&&!t.terrain&&t.shadowRenderer){t.currentLayer<t.firstLightBeamLayer&&(t.firstLightBeamLayer=t.currentLayer);continue}w=i.wvpForTile}else if(g)continue;const M={defines:[]},E=[];if(ln(M.defines,E,d,t,r.lut),v||M.defines.push("DIFFUSE_SHADED"),p&&M.defines.push("SHADOWS_SINGLE_CASCADE"),T&&(y?T.numRenderedVerticesInShadowPass+=d.vertexArray.length:T.numRenderedVerticesInTransparentPass+=d.vertexArray.length),y){hn(d,i.nodeModelMatrix,t,r);continue}let S=null;if(a){const e=an(i.nodeModelMatrix,t.transform);if(S=new Float32Array(e),"globe"!==s.projection.name){const t=d.aabb.min,i=d.aabb.max,[r,n]=a.getOpacityForBounds(e,t[0],t[1],i[0],i[1]);M.overrideFog=r>=Ke||n>=Ke}}const C=d.material;let A;C.occlusionTexture&&C.occlusionTexture.offsetScale&&(A=C.occlusionTexture.offsetScale,M.defines.push("OCCLUSION_TEXTURE_TRANSFORM")),!y&&l&&(l.useNormalOffset=!!d.normalBuffer);const I=t.getOrCreateProgram("model",M);!y&&l&&l.setupShadowsFromMatrix(i.tileModelMatrix,I,l.useNormalOffset),t.uploadCommonUniforms(o,I,null,S);const k=C.pbrMetallicRoughness;k.metallicFactor=.9,k.roughnessFactor=.5;const L=dr(new Float32Array(w),new Float32Array(u),new Float32Array(f),new Float32Array(c.matrix),t,i.opacity,k.baseColorFactor.toRenderColor(null),C.emissiveFactor,k.metallicFactor,k.roughnessFactor,C,x,r,[0,0,0],A);!b&&(n.hasTranslucentParts||i.opacity<1)&&I.draw(t,o.gl.TRIANGLES,m,e.ah.disabled,e.a.disabled,e.ag.backCCW,L,r.id,d.vertexBuffer,d.indexBuffer,d.segments,r.paint,t.transform.zoom,void 0,E),I.draw(t,o.gl.TRIANGLES,b?_:m,e.ah.disabled,b||i.opacity<1||n.hasTranslucentParts?e.a.alphaBlended:e.a.unblended,e.ag.backCCW,L,r.id,d.vertexBuffer,d.indexBuffer,d.segments,r.paint,t.transform.zoom,void 0,E)}}}}()}(t,i,r,n),void c();if("model"!==u.type)return;const h=u.getModels(),p=[],d=t.transform.getFreeCameraOptions().position,f=e.$.scale([],[d.x,d.y,d.z],t.transform.worldSize);e.$.negate(f,f);const m=[],_=[];let g=0;for(const i of h){const n=r.paint.get("model-rotation").constantOr(null),o=r.paint.get("model-scale").constantOr(null),s=r.paint.get("model-translation").constantOr(null);i.computeModelMatrix(t,n,o,s,!0,!0,!1);const a=e.ae.identity([]),l=e.ci(i.position.lat,t.transform.zoom),c=e.ae.fromScaling([],[1,1,1/l]);e.ae.translate(a,a,f),p.push({zScaleMatrix:c,negCameraPosMatrix:a});for(const e of i.nodes)un(t.transform,e,i.matrix,t.transform.expandedFarZProjMatrix,g,m,_);g++}if(m.sort(((e,t)=>t.depth-e.depth)),"shadow"!==t.renderPass){if(1===o)for(const i of _)cn(i,t,r,p[i.modelIndex],e.ah.disabled,t.colorModeForRenderPass());else{for(const i of _)cn(i,t,r,p[i.modelIndex],e.ah.disabled,e.a.disabled);for(const e of _)cn(e,t,r,p[e.modelIndex],t.stencilModeFor3D(),t.colorModeForRenderPass());t.resetStencilClippingMasks()}for(const i of m)cn(i,t,r,p[i.modelIndex],e.ah.disabled,t.colorModeForRenderPass());c()}else{for(const e of _)hn(e.mesh,e.nodeModelMatrix,t,r);for(const e of m)hn(e.mesh,e.nodeModelMatrix,t,r);c()}}},Mn={model:function(e,t,i){const r=t.getSource();if(!r.loaded())return;if("vector"===r.type||"geojson"===r.type)return void(i.modelManager&&i.modelManager.upload(i,"vector"===r.type?e.scope:""));if("batched-model"===r.type)return;if("model"!==r.type)return;const n=r.getModels();for(const e of n)e.upload(i.context)},raster:function(e,t,i){const r=t.getSource();if(!(r instanceof Ai&&r.loaded()))return;const n=e.sourceLayer||r.rasterLayerIds&&r.rasterLayerIds[0];if(!n)return;const o=e.paint.get("raster-array-band")||r.getInitialBand(n);if(null==o)return;const s=t.getIds().map((e=>t.getTileByID(e)));for(const e of s)e.updateNeeded(n,o)&&r.prepareTile(e,n,o)},"raster-particle":function(e,t,i){const r=t.getSource();if(!(r instanceof Ai&&r.loaded()))return;const n=e.sourceLayer||r.rasterLayerIds&&r.rasterLayerIds[0];if(!n)return;const o=e.paint.get("raster-particle-array-band")||r.getInitialBand(n);if(null==o)return;const s=t.getIds().map((e=>t.getTileByID(e)));for(const e of s)e.updateNeeded(n,o)&&r.prepareTile(e,n,o)}};class En{constructor(t,i,r,n){this.context=new ne(t,i),this.transform=r,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=n,this._timeStamp=e.e.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const o=["fill","line","symbol","circle","heatmap","fill-extrusion","raster","raster-particle","hillshade","model","background","sky"];for(const e of o)this._debugParams.enabledLayers[e]=!0;n.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},(()=>{this.style.map.triggerRepaint()})),n.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),n.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),n.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),n.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const e of o)n.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],e);this.occlusionParams=new wn(n),this.setup(),this.numSublayers=e.bx.maxUnderzooming+e.bx.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new e.cp,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new _i(this),this._wireframeDebugCache=new bn,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const s=new e.j({width:1,height:1},Uint8Array.of(0,0,0,0));
vendor: 5,099 bytes, line 1
1this.emptyDepthTexture=new e.T(this.context,s,t.RGBA)}updateTerrain(e,t){const i=!!e&&!!e.terrain&&this.transform.projection.supportsTerrain;if(!(i||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new zi(this,e));const r=this._terrain;this.transform.elevation=i?r:null,r.update(e,this.transform,t),this.transform.elevation&&!r.enabled&&(this.transform.elevation=null)}_updateFog(e){const t=e.fog;if(!t||"globe"===this.transform.projection.name||t.getOpacity(this.transform.pitch)<1||t.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[i,r]=t.getFovAdjustedRange(this.transform._fov);if(i>r)return void(this.transform.fogCullDistSq=null);const n=i+.78*(r-i);this.transform.fogCullDistSq=n*n}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(e){e&&!this._terrain&&(this._terrain=new zi(this,this.style)),this._forceTerrainMode=e}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,i){if(this.width=t*e.e.devicePixelRatio,this.height=i*e.e.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const e of this.style.order)this.style._mergedLayers[e].resize()}setup(){const t=this.context,i=new e.bv;i.emplaceBack(0,0),i.emplaceBack(e.a4,0),i.emplaceBack(0,e.a4),i.emplaceBack(e.a4,e.a4),this.tileExtentBuffer=t.createVertexBuffer(i,e.bt.members),this.tileExtentSegments=e.b.simpleSegment(0,0,4,2);const r=new e.bv;r.emplaceBack(0,0),r.emplaceBack(e.a4,0),r.emplaceBack(0,e.a4),r.emplaceBack(e.a4,e.a4),this.debugBuffer=t.createVertexBuffer(r,e.bt.members),this.debugSegments=e.b.simpleSegment(0,0,4,5);const n=new e.bv;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(-1,1),n.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(n,e.bt.members),this.viewportSegments=e.b.simpleSegment(0,0,4,2);const o=new e.cq;o.emplaceBack(0,0,0,0),o.emplaceBack(e.a4,0,e.a4,0),o.emplaceBack(0,e.a4,0,e.a4),o.emplaceBack(e.a4,e.a4,e.a4,e.a4),this.mercatorBoundsBuffer=t.createVertexBuffer(o,e.cr.members),this.mercatorBoundsSegments=e.b.simpleSegment(0,0,4,2);const s=new e.bw;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(s);const a=new e.cs;for(const e of[0,1,3,2,0])a.emplaceBack(e);this.debugIndexBuffer=t.createIndexBuffer(a),this.emptyTexture=new e.T(t,new e.j({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA),this.identityMat=e.ae.create();const l=this.context.gl;this.stencilClearMode=new e.ah({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const t=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,t.TRIANGLES,e.af.disabled,this.stencilClearMode,e.a.disabled,e.ag.disabled,Si(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,i,r){if(!i||this.currentStencilSource===i.id||!t.isTileClipped()||!r||0===r.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let e=!1;for(const t of r)if(void 0===this._tileClippingMaskIDs[t.key]){e=!0;break}if(!e)return}this.currentStencilSource=i.id;const n=this.context,o=n.gl;this.nextStencilID+r.length>256&&this.clearStencil(),n.setColorMode(e.a.disabled),n.setDepthMode(e.af.disabled);const s=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const t of r){const r=i.getTile(t),n=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,{tileBoundsBuffer:a,tileBoundsIndexBuffer:l,tileBoundsSegments:c}=this.getTileBoundsBuffers(r);s.draw(this,o.TRIANGLES,e.af.disabled,new e.ah({func:o.ALWAYS,mask:0},n,255,o.KEEP,o.KEEP,o.REPLACE),e.a.disabled,e.ag.disabled,Si(t.projMatrix),"$clipping",a,l,c)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,i=this.context.gl;return new e.ah({func:i.NOTEQUAL,mask:255},t,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const i=this.context.gl;return new e.ah({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,i.KEEP,i.KEEP,i.REPLACE)}stencilConfigForOverlap(t){const i=this.context.gl,r=t.sort(((e,t)=>
1t.overscaledZ-e.overscaledZ)),n=r[r.length-1].overscaledZ,o=r[0].overscaledZ-n+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();const t={};for(let r=0;r<o;r++)t[r+n]=new e.ah({func:i.GEQUAL,mask:255},r+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=o,[t,r]}return[{[n]:e.ah.disabled},r]}colorModeForRenderPass(){const t=this.context.gl;if(this._showOverdrawInspector){const i=1/8;return new e.a([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new e.C(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?e.a.unblended:e.a.alphaBlended}colorModeForDrapableLayerRenderPass(t){const i=this.context.gl;return(()=>this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture)()&&"translucent"===this.renderPass?new e.a([i.ONE,i.ONE_MINUS_SRC_ALPHA,i.CONSTANT_ALPHA,i.ONE_MINUS_SRC_ALPHA],new e.C(0,0,0,void 0===t?0:t),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(t,i,r,n=!1){if(this.depthOcclusion)return new e.af(this.context.gl.GREATER,e.af.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!n)return e.af.disabled;const o=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new e.af(r||this.context.gl.LEQUAL,i,[o,o])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const t=this.context.gl,i=Math.ceil(this.width),r=Math.ceil(this.height),n=this.context.bindFramebuffer.get(),o=t.getParameter(t.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===i&&this.depthFBO.height===r||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),0!==i&&0!==r&&(this.depthFBO=new re(this.context,i,r,!1,"texture"),this.depthTexture=new e.T(this.context,{width:i,height:r,data:null},t.DEPTH_STENCIL),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(n),t.bindTexture(t.TEXTURE_2D,o),this.depthFBO&&(t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),t.blitFramebuffer(0,0,i,r,0,0,i,r,t.DEPTH_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(t.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(0===this._dt?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce(((e,t)=>e+t/this._fpsHistory.length),0))}render(t,i){const r=e.e.now();this._dt=r-this._timeStamp,this._timeStamp=r,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=t.map.repaint,this.style=t,this.options=i;const n=this.style._mergedLayers,o=this.style.order.filter((e=>{const t=n[e];return!(t.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[t.type]}));let s=!1,a=!1;for(const e of o){const t=n[e];"circle"===t.type&&(s=!0),"symbol"===t.type&&(t.hasInitialOcclusionOpacityProperties?a=!0:s=!0)}const l=o.map((e=>n[e])),c=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(e.e.now()),this.imageManager.beginFrame();let u=0,h=!1;for(const e in c){const t=c[e];t.used&&(t.prepare(this.context),t.getSource().usedInConflation&&++u)}let p=!1;for(const e of l)e.isHidden(this.transform.zoom)||("clip"===e.type&&(p=!0),this.prepareLayer(e));const d={},f={},m={},_={},g={};for(const e in c){const t=c[e];d[e]=t.getVisibleCoordinates(),f[e]=d[e].slice().reverse(),m[e]=t.getVisibleCoordinates(!0).reverse(),_[e]=t.getShadowCasterCoordinates(),g[e]=t.sortCoordinatesByDistance(d[e])}const y=e=>{const t=this.style.getLayerSourceCache(e);return t&&t.used?t.getSource():null};if(u||p){const t=[],i=[];let r=0;for(const e of l)this.isSourceForClippingOrConflation(e,y(e))&&(t.push(e),i.push(r)),r++;if(t&&(p||t.length>1)){const r=[];for(let n=0;n<t.length;n++){const o=t[n],s=i[n],a=this.style.getLayerSourceCache(o);if(!a||!a.used||!a.getSource().usedInConflation&&"clip"!==o.type)continue;let l=e.cv,c=e.cw.None;const u=[];
1if("clip"===o.type){l=s;for(const t of o.layout.get("clip-layer-types"))c|="model"===t?e.cw.Model:"symbol"===t?e.cw.Symbol:e.cw.FillExtrusion;for(const e of o.layout.get("clip-layer-scope"))u.push(e)}r.push({layer:o.fqid,cache:a,order:l,clipMask:c,clipScope:u})}this.replacementSource.setSources(r),h=!0}}h||this.replacementSource.clear(),this.conflationActive=h,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let e=0;e<l.length;e++){const t=l[e],i=t.cutoffRange();if(this.longestCutoffRange=Math.max(i,this.longestCutoffRange),i>0){const e=y(t);e&&(this.minCutoffZoom=Math.max(e.minzoom,this.minCutoffZoom)),t.minzoom&&(this.minCutoffZoom=Math.max(t.minzoom,this.minCutoffZoom))}t.is3D()&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=e),this._lastOcclusionLayer=e)}const v=this.style&&this.style.fog;v?(this._fogVisible=0!==v.getOpacity(this.transform.pitch),this._fogVisible&&"globe"!==this.transform.projection.name&&(this._fogVisible=v.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(m),this.opaquePassCutoff=0);const x=this._shadowRenderer;if(x){x.updateShadowParameters(this.transform,this.style.directionalLight);for(const e in c)for(const t of d[e]){let e={min:0,max:0};this.terrain&&(e=this.terrain.getMinMaxForTile(t)||e),x.addShadowReceiver(t.toUnwrapped(),e.min,e.max)}}if("globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new e.ct(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new sn(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),!e.cu(this.context.gl))return;this.renderPass="offscreen";for(const e of l){const i=t.getLayerSourceCache(e);if(!e.hasOffscreenPass()||e.isHidden(this.transform.zoom))continue;const r=i?f[i.id]:void 0;("custom"===e.type||"raster"===e.type||"raster-particle"===e.type||e.isSky()||r&&r.length)&&this.renderLayer(this,i,e,r)}this.depthRangeFor3D=[0,1-(l.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,_)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const b="globe"===this.transform.projection.name||this.transform.isHorizonVisible(),w=(()=>{if(i.showOverdrawInspector)return e.C.black;const t=this.style.fog;if(t&&this.transform.projection.supportsFog){const i=this.style.getLut(t.scope);if(!b){const r=t.properties.get("color").toRenderColor(i).toArray01();return new e.C(...r)}if(b){const r=t.properties.get("space-color").toRenderColor(i).toArray01();return new e.C(...r)}}return e.C.transparent})();if(this.context.clear({color:w,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&b&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){const e=l[this.currentLayer],i=t.getLayerSourceCache(e);if(e.isSky())continue;const r=i?(e.is3D()?g:f)[i.id]:void 0;this._renderTileClippingMasks(e,i,r),this.renderLayer(this,i,e,r)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&b&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||e.a2(this.transform.zoom)>0)&&("globe"===this.transform.projection.name||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<o.length;this.currentLayer++){const e=l[this.currentLayer],i=t.getLayerSourceCache(e);e.isSky()&&this.renderLayer(this,i,e,i?f[i.id]:void 0)}function T(e,t){let i;return t&&(i=("symbol"===e.type?m:e.is3D()?g:f)[t.id]),i}if(this.renderPass="translucent","globe"===this.transform.projection.name){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<o.length;){const e=l[this.currentLayer];if("raster"===e.type||"raster-particle"===e.type){const i=t.getLayerSourceCache(e);this.renderLayer(this,i,e,T(e,i))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let M=0;x&&(M=x.getShadowCastingLayerCount());let E=!1,S=-1;for(let e=0;e<o.length;++e){const t=l[e];t.isHidden(this.transform.zoom)||t.is3D()&&(S=e)}for(a&&-1===S&&(s=!0);this.currentLayer<o.length;){const e=l[this.currentLayer],i=t.getLayerSourceCache(e);if(e.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(e)){if(e.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(s&&!E&&this.terrain&&!this.transform.isOrthographic&&(E=!0,this.blitDepth()),a&&-1!==S&&this.currentLayer===S+1&&!this.transform.isOrthographic&&this.blitDepth(),e.is3D()||this.terrain||this._renderTileClippingMasks(e,i,i?d[i.id]:void 0),this.renderLayer(this,i,e,T(e,i)),!this.terrain&&x&&M>0&&e.hasShadowPass()&&0==--M&&(x.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer)){const e=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=e;this.currentLayer++){const e=l[this.currentLayer];if(!e.hasLightBeamPass())continue;const i=t.getLayerSourceCache(e);this.renderLayer(this,i,e,i?f[i.id]:void 0)}this.currentLayer=e,this.renderPass="translucent"}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const e=this.currentLayer;this.depthOcclusion=!0;for(const e of this.layersWithOcclusionOpacity){this.currentLayer=e;const i=l[this.currentLayer],r=t.getLayerSourceCache(i),n=r?f[r.id]:void 0;i.is3D()||this.terrain||this._renderTileClippingMasks(i,r,r?d[r.id]:void 0),this.renderLayer(this,r,i,n)}this.depthOcclusion=!1,this.currentLayer=e,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let i=null;l.forEach((e=>{const r=t.getLayerSourceCache(e);r&&!e.isHidden(this.transform.zoom)&&r.getVisibleCoordinates().length&&(!i||i.getSource().maxzoom<r.getSource().maxzoom)&&(i=r)})),i&&this.options.showTileBoundaries&&Tn.debug(this,i,i.getVisibleCoordinates(),e.C.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&Tn.debug(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new e.C(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(e){const t=e.transform.padding;
1Zr(e,e.transform.height-(t.top||0),3,Ur),Zr(e,t.bottom||0,3,Vr),Wr(e,t.left||0,3,$r),Wr(e,e.transform.width-(t.right||0),3,Gr);const i=e.transform.centerPoint;!function(e,t,i,r){Xr(e,t-1,i-10,2,20,r),Xr(e,t-10,i-1,20,2,r)}(e,i.x,e.transform.height-i.y,qr)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveCanvasCopy()),h||(this.conflationActive=!1)}prepareLayer(e){this.gpuTimingStart(e);const{unsupportedLayers:t}=this.transform.projection,i=!t||!t.includes(e.type);if(Mn[e.type]&&(i||this.terrain&&"custom"===e.type)){const t=this.style.getLayerSourceCache(e);Mn[e.type](e,t,this)}this.gpuTimingEnd()}renderLayer(e,t,i,r){i.isHidden(this.transform.zoom)||("background"===i.type||"sky"===i.type||"custom"===i.type||"model"===i.type||"raster"===i.type||"raster-particle"===i.type||r&&r.length)&&(this.id=i.id,this.gpuTimingStart(i),e.transform.projection.unsupportedLayers&&e.transform.projection.unsupportedLayers.includes(i.type)&&(!e.terrain||"custom"!==i.type)||"clip"===i.type||Tn[i.type](e,t,i,r,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(e){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery,i=this.context.gl;let r=this.gpuTimers[e.id];r||(r=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:i.createQuery()}),r.calls++,i.beginQuery(t.TIME_ELAPSED_EXT,r.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const e=this.context.extTimerQuery,t=this.context.gl,i=t.createQuery();this.deferredRenderGpuTimeQueries.push(i),t.beginQuery(e.TIME_ELAPSED_EXT,i)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const e=this.gpuTimers;return this.gpuTimers={},e}collectDeferredRenderGpuQueries(){const e=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],e}queryGpuTimers(e){const t={};for(const i in e){const r=e[i],n=this.context.extTimerQuery,o=n.getQueryParameter(r.query,this.context.gl.QUERY_RESULT)/1e6;n.deleteQueryEXT(r.query),t[i]=o}return t}queryGpuTimeDeferredRender(e){if(!this.options.gpuTimingDeferredRender)return 0;const t=this.context.extTimerQuery,i=this.context.gl;let r=0;for(const n of e)r+=t.getQueryParameter(n,i.QUERY_RESULT)/1e6,t.deleteQueryEXT(n);return r}translatePosMatrix(t,i,r,n,o){if(!r[0]&&!r[1])return t;const s=o?"map"===n?this.transform.angle:0:"viewport"===n?-this.transform.angle:0;if(s){const e=Math.sin(s),t=Math.cos(s);r=[r[0]*t-r[1]*e,r[0]*e+r[1]*t]}const a=[o?r[0]:e.bD(i,r[0],this.transform.zoom),o?r[1]:e.bD(i,r[1],this.transform.zoom),0],l=new Float32Array(16);return e.ae.translate(l,t,a),l}saveTileTexture(e){const t=e.size[0],i=this._tileTextures[t];i?i.push(e):this._tileTextures[t]=[e]}getTileTexture(e){const t=this._tileTextures[e];return t&&t.length>0?t.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return null!=this.context.extTextureFloatLinear}currentGlobalDefines(e,t,i){const r=void 0===i?this.terrain&&this.terrain.renderingToTexture:i,n=[];return this.style&&this.style.enable3dLights()&&("globeRaster"===e||"terrainRaster"===e?(n.push("LIGHTING_3D_MODE"),n.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):r||n.push("LIGHTING_3D_MODE")),"shadow"===this.renderPass?this._shadowMapDebug||n.push("DEPTH_TEXTURE"):this.shadowRenderer&&(this.shadowRenderer.useNormalOffset?n.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"):n.push("RENDER_SHADOWS","DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(n.push("TERRAIN"),this.linearFloatFilteringSupported()&&n.push("TERRAIN_DEM_FLOAT_FORMAT")),"globe"===this.transform.projection.name&&n.push("GLOBE"),!this._fogVisible||r||void 0!==t&&!t||n.push("FOG","FOG_DITHERING"),r&&n.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&n.push("OVERDRAW_INSPECTOR"),n}getOrCreateProgram(e,t){this.cache=this.cache||{};const i=t&&t.defines||[],r=t&&t.config,n=this.currentGlobalDefines(e,t&&t.overrideFog,t&&t.overrideRtt).concat(i),o=Bi.cacheKey(Et[e],e,n,r);return this.cache[o]||(this.cache[o]=new Bi(this.context,e,Et[e],r,mr[e],n)),this.cache[o]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.de
vendor: 4,271 bytes, line 1
1stroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(t,i){if(this.style.enable3dLights()){const r=this.style.directionalLight,n=this.style.ambientLight;if(r&&n){const o=((t,i,r)=>{const n=t.properties.get("direction"),o=t.properties.get("color").toRenderColor(r.getLut(t.scope)).toArray01(),s=t.properties.get("intensity"),a=i.properties.get("color").toRenderColor(r.getLut(i.scope)).toArray01(),l=i.properties.get("intensity"),c=[n.x,n.y,n.z],u=e.bC(a,l),h=e.bC(o,s);return{u_lighting_ambient_color:u,u_lighting_directional_dir:c,u_lighting_directional_color:h,u_ground_radiance:Oi(c,h,u)}})(r,n,this.style);i.setLightsUniformValues(t,o)}}}uploadCommonUniforms(t,i,r,n,o){if(this.uploadCommonLightUniforms(t,i),this.terrain&&this.terrain.renderingToTexture)return;const s=this.style.fog;if(s){const o=s.getOpacity(this.transform.pitch),a=((t,i,r,n,o,s,a,l,c,u,h,p)=>{const d=t.transform,f=i.properties.get("color").toRenderColor(t.style.getLut(i.scope)).toArray01();f[3]=n;const m=t.frameCounter/1e3%1,[_,g]=i.properties.get("vertical-range");return{u_fog_matrix:r?d.calculateFogTileMatrix(r):p||t.identityMat,u_fog_range:i.getFovAdjustedRange(d._fov),u_fog_color:f,u_fog_horizon_blend:i.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(_,g),g],u_fog_temporal_offset:m,u_frustum_tl:o,u_frustum_tr:s,u_frustum_br:a,u_frustum_bl:l,u_globe_pos:c,u_globe_radius:u,u_viewport:h,u_globe_transition:e.a2(d.zoom),u_is_globe:+("globe"===d.projection.name)}})(this,s,r,o,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*e.e.devicePixelRatio,this.transform.height*e.e.devicePixelRatio],n);i.setFogUniformValues(t,a)}o&&i.setCutoffUniformValues(t,o.uniformValues)}setTileLoadedFlag(e){this.tileLoaded=e}saveCanvasCopy(){const e=this.canvasCopy();e&&(this.frameCopies.push(e),this.tileLoaded=!1)}canvasCopy(){const e=this.context.gl,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),t}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const e=this.style&&this.style.fog;return!!e&&0!==e.getOpacity(this.transform.pitch)}getBackgroundTiles(){const t=this._backgroundTiles,i=this._backgroundTiles={},r=this.transform.coveringTiles({tileSize:512});for(const n of r)i[n.key]=t[n.key]||new e.bA(n,512,this.transform.tileZoom,this);return i}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(e,t){return!(!e.is3D()||e.minzoom&&e.minzoom>this.transform.zoom||(this.style._clipLayerIndices.length||"building"!==e.sourceLayer)&&"clip"!==e.type&&(!t||"batched-model"!==t.type))}isTileAffectedByFog(e){if(!this.style||!this.style.fog)return!1;if("globe"===this.transform.projection.name)return!0;let t=this._cachedTileFogOpacities[e.key];return t||(this._cachedTileFogOpacities[e.key]=t=this.style.fog.getOpacityForTile(e)),t[0]>=Ke||t[1]>=Ke}setupDepthForOcclusion(e,t,i){const r=this.context,n=r.gl,o=!!i;var s;i||(i={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),r.activeTexture.set(n.TEXTURE3),e&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(n.NEAREST,n.CLAMP_TO_EDGE),i.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],i.u_depth_range_unpack=[2/((s=this.depthRangeFor3D)[1]-s[0]),-1-2*s[0]/(s[1]-s[0])],i.u_occluder_half_size=.5*this.occlusionParams.occluderSize,i.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.empty
vendor: 4,186 bytes, line 1
1DepthTexture.bind(n.NEAREST,n.CLAMP_TO_EDGE),r.activeTexture.set(n.TEXTURE0),o||t.setTerrainUniformValues(r,i)}}class Sn{constructor(e,t,i,r){this.screenBounds=e,this.cameraPoint=t,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=i,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,r)}static createFromScreenPoints(t,i){let r,n;if(t instanceof e.P||"number"==typeof t[0]){const o=e.P.convert(t);r=[o],n=i.isPointAboveHorizon(o)}else{const o=e.P.convert(t[0]),s=e.P.convert(t[1]);r=[o,s],n=e.cx(o,s).every((e=>i.isPointAboveHorizon(e)))}return new Sn(r,i.getCameraPoint(),n,i)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(t){return e.cx(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const i=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.cx(i,r,0,!1);return this.cameraPoint.y>r.y&&(this.cameraPoint.x>i.x&&this.cameraPoint.x<r.x?n.splice(3,0,this.cameraPoint):this.cameraPoint.x>=r.x?n[2]=this.cameraPoint:this.cameraPoint.x<=i.x&&(n[3]=this.cameraPoint)),e.cy(n,t)}bufferedCameraGeometryGlobe(t){const i=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new e.P(1,1)):this.screenBounds[1],n=e.cx(i,r,t),o=this.cameraPoint.clone();switch(3*((o.y>i.y)+(o.y>r.y))+((o.x>i.x)+(o.x>r.x))){case 0:n[0]=o,n[4]=o.clone();break;case 1:n.splice(1,0,o);break;case 2:n[1]=o;break;case 3:n.splice(4,0,o);break;case 5:n.splice(2,0,o);break;case 6:n[3]=o;break;case 7:n.splice(3,0,o);break;case 8:n[2]=o}return n}containsTile(t,i,r,n=0){const o=t.queryPadding/i._pixelsPerMercatorPixel+1,s=r?this._bufferedCameraMercator(o,i):this._bufferedScreenMercator(o,i);let a=t.tileID.wrap+(s.unwrapped?n:0);const l=s.polygon.map((i=>e.cz(t.tileTransform,i,a)));if(!e.cA(l,0,0,e.a4,e.a4))return;a=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?n:0);const c=this.screenGeometryMercator.polygon.map((i=>e.cB(t.tileTransform,i,a))),u=c.map((t=>new e.P(t[0],t[1]))),h=i.getFreeCameraOptions().position||new e._(0,0,0),p=e.cB(t.tileTransform,h,a),d=c.map((t=>{const i=e.$.sub(t,t,p);return e.$.normalize(i,i),new e.aU(p,i)})),f=e.bD(t,1,i.zoom)*i._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:u,tilespaceRays:d,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(m=e.cC(l),m.min.x=e.au(m.min.x,0,e.a4),m.min.y=e.au(m.min.y,0,e.a4),m.max.x=e.au(m.max.x,0,e.a4),m.max.y=e.au(m.max.y,0,e.a4),m),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:f};var m}_bufferedScreenMercator(e,t){const i=In(e);if(this._screenRaycastCache[i])return this._screenRaycastCache[i];{let r;return r="globe"===t.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),t):{polygon:this.bufferedScreenGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._screenRaycastCache[i]=r,r}}_bufferedCameraMercator(e,t){const i=In(e);if(this._cameraRaycastCache[i])return this._cameraRaycastCache[i];{let r;return r="globe"===t.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),t):{polygon:this.bufferedCameraGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._cameraRaycastCache[i]=r,r}}_projectAndResample(t,i){const r=function(t,i){const r=e.ae.multiply([],i.pixelMatrix,i.globeMatrix),n=[0,-e.cF,0,1],o=[0,e.cF,0,1],s=[0,0,0,1];e.aB.transformMat4(n,n,r),e.aB.transformMat4(o,o,r),e.aB.transformMat4(s,s,r);const a=new e.P(n[0]/n[3],n[1]/n[3]),l=new e.P(o[0]/o[3],o[1]/o[3]),c=e.cD(t,a)&&n[3]<s[3],u=e.cD(t,l)&&o[3]<s[3];if(!c&&!u)return null;const h=function(e,t,i){for(let r=1;r<e.length;r++){const n=An(t.pointCoordinate3D(e[r-1]).x),o=An(t.pointCoordinate3D(e[r]).x);if(i<0){if(n<o)return{idx:r,t:-n/(o-1-n)}}else if(o<n)return{idx:r,t:(1-n)/(o+1-n)}}return null}(t,i,c?-1:1);if(!h)return null;const{idx:p,t:d}=h;let f=p>1?Cn(t.slice(0,p),i):[],m=p<t.length?Cn(t.slice(p),i):[];f=f.map((t=>new e.P(An(t.x),t.y))),m=m.map((t=>new e.P(An(t.x),t.y)));const _=[...f];0===_.length&&_.push(m[m.length-1]);const g=e.a3(_[_.length-1].y,(0===m.length?f[0]:m[0]).y,d);let y;
1return y=c?[new e.P(0,g),new e.P(0,0),new e.P(1,0),new e.P(1,g)]:[new e.P(1,g),new e.P(1,1),new e.P(0,1),new e.P(0,g)],_.push(...y),0===m.length?_.push(f[0]):_.push(...m),{polygon:_.map((t=>new e._(t.x,t.y))),unwrapped:!1}}(t,i);if(r)return r;const n=function(t,i){let r=!1,n=-1/0,o=0;for(let e=0;e<t.length-1;e++)t[e].x>n&&(n=t[e].x,o=e);for(let e=0;e<t.length-1;e++){const i=(o+e)%(t.length-1),n=t[i],s=t[i+1];Math.abs(n.x-s.x)>.5&&(n.x<s.x?(n.x+=1,0===i&&(t[t.length-1].x+=1)):(s.x+=1,i+1===t.length-1&&(t[0].x+=1)),r=!0)}const s=e.ak(i.center.lng);return r&&s<Math.abs(s-1)&&t.forEach((e=>{e.x-=1})),{polygon:t,unwrapped:r}}(Cn(t,i).map((t=>new e.P(An(t.x),t.y))),i);return{polygon:n.polygon.map((t=>new e._(t.x,t.y))),unwrapped:n.unwrapped}}}function Cn(t,i){return e.cE(t,(e=>{const t=i.pointCoordinate3D(e);e.x=t.x,e.y=t.y}),1/256)}function An(e){return e<0?1+e%1:e%1}function In(e){return 100*e|0}function kn(t,i){const r=e.ae.identity([]);return e.ae.scale(r,r,[.5*t.width,.5*-t.height,1]),e.ae.translate(r,r,[1,-1,0]),e.ae.multiply(r,r,t.calculateProjMatrix(i.toUnwrapped())),Float32Array.from(r)}function Ln(e,t,i,r,n,o,s,a=!1){const l=e.tilesIn(r,s,a);l.sort(Rn);const c=[];for(const r of l)c.push({wrappedTileID:r.tile.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(t,i,e._state,r,n,o,kn(e.transform,r.tile.tileID),a)});const u=function(e){const t={},i={};for(const r of e){const e=r.queryResults,n=r.wrappedTileID,o=i[n]=i[n]||{};for(const i in e){const r=e[i],n=o[i]=o[i]||{},s=t[i]=t[i]||[];for(const e of r)n[e.featureIndex]||(n[e.featureIndex]=!0,s.push(e))}}return t}(c);for(const t in u)u[t].forEach((t=>{const i=t.feature,r=i.layer;r&&"background"!==r.type&&"sky"!==r.type&&"slot"!==r.type&&(i.source=r.source,r["source-layer"]&&(i.sourceLayer=r["source-layer"]),i.state=void 0!==i.id?e.getFeatureState(r["source-layer"],i.id):{})}));return u}function Pn(e,t){const i=e.getRenderableIds().map((t=>e.getTileByID(t))),r=[],n={};for(let e=0;e<i.length;e++){const o=i[e],s=o.tileID.canonical.key;n[s]||(n[s]=!0,o.querySourceFeatures(r,t))}return r}function Rn(e,t){const i=e.tileID,r=t.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}class zn{constructor(e){this.style=e,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const e=!1,t=!1;for(const i in this.style._mergedLayers){const r=this.style._mergedLayers[i];if("fill-extrusion"===r.type)this.layers.push({layer:r,visible:e,visibilityChanged:t});else if("model"===r.type){const i=this.style.getLayerSource(r);i&&"batched-model"===i.type&&this.layers.push({layer:r,visible:e,visibilityChanged:t})}}}onNewFrame(e){this.layersGotHidden=!1;for(const t of this.layers){const i=t.layer;let r=!1;"fill-extrusion"===i.type?r=!i.isHidden(e)&&i.paint.get("fill-extrusion-opacity")>0:"model"===i.type&&(r=!i.isHidden(e)&&i.paint.get("model-opacity")>0),this.layersGotHidden=this.layersGotHidden||!r&&t.visible,t.visible=r}}updateZOffset(e,t){this.currentBuildingBuckets=[];for(const e of this.layers){const i=e.layer,r=this.style.getLayerSourceCache(i);let n=1;"fill-extrusion"===i.type&&(n=e.visible?i.paint.get("fill-extrusion-vertical-scale"):0);let o=r?r.getTile(t):null;if(!o&&r&&t.canonical.z>r.getSource().minzoom){let e=t.scaledTo(Math.min(r.getSource().maxzoom,t.overscaledZ-1));for(;e.overscaledZ>=r.getSource().minzoom&&(o=r.getTile(e),!o&&0!==e.overscaledZ);)e=e.scaledTo(e.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:o?o.getBucket(i):null,tileID:o?o.tileID:t,verticalScale:n})}e.hasAnyZOffset=!1;let i=!1;for(let r=0;r<e.symbolInstances.length;r++){const n=e.symbolInstances.get(r),o=n.zOffset,s=this._getHeightAtTileOffset(t,n.tileAnchorX,n.tileAnchorY);n.zOffset=s!==Number.NEGATIVE_INFINITY?s:o,i||o===n.zOffset||(i=!0),e.hasAnyZOffset||0===n.zOffset||(e.hasAnyZOffset=!0)}i&&(e.zOffsetBuffersNeedUpload=!0,e.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,i,r,n){let o=i,s=r;if(t.canonical.z!==n.canonical.z){const a=n.canonical,l=1/(1<<t.canonical.z-a.z);o=(i+t.canonical.x*e.a4)*l-a.x*e.a4|0,s=(r+t.canonical.y*e.a4)*l-a.y*e.a4|0}return{tileX:o,tileY:s}}_getHeightAtTileOffset(e,t,i){let r,n;for(let o=0;o<this.layers.length;++o){if("fill-extrusion"!==this.layers[o].layer.type)continue;const{bucket:s,tileID:a,verticalScale:l}=this.currentBuildingBuckets[o];if(!s)continue;const{tileX:c,tileY:u}=this._mapCoordToOverlappingTile(e,t,i,a),h=s.getHeightAtTileCoord(c,u);h&&void 0!==h.height&&(h.hidden?r=h.height:n=Math.max(h.height*l,n||0))}if(void 0!==n)return n;for(let n=0;n<this.layers.length;++n){const o=this.layers[n];if("model"!==o.layer.type||!o.visible)continue;const{bucket:s,tileID:a}=this.currentBuildingBuckets[n];if(!s)continue;const{tileX:l,tileY:c}=this._mapCoordToOverlappingTile(e,t,i,a),u=s.getHeightAtTileCoord(l,c);if(u&&!u.hidden)return void 0===u.height&&void 0!==r?Math.min(u.maxHeight,r)*u.verticalScale:u.height?u.height*u.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function On(t,i){const r={};for(const e in t)"ref"!==e&&(r[e]=t[e]);return e.cG.forEach((e=>{e in i&&(r[e]=i[e])})),r}function Dn(e){e=e.slice();const t=Object.create(null);for(let i=0;i<e.length;i++)t[e[i].id]=e[i];for(let i=0;i<e.length;i++)"ref"in e[i]&&(e[i]=On(e[i],t[e[i].ref]));return e}const Fn={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport"};function Bn(e,t,i){i.push({command:Fn.addSource,args:[e,t[e]]})}function Nn(e,t,i){t.push({command:Fn.removeSource,args:[e]}),i[e]=!0}function jn(e,t,i,r){Nn(e,i,r),Bn(e,t,i)}function Un(t,i,r){let n;for(n in t[r])if(t[r].hasOwnProperty(n)&&"data"!==n&&!e.d(t[r][n],i[r][n]))return!1;for(n in i[r])if(i[r].hasOwnProperty(n)&&"data"!==n&&!e.d(t[r][n],i[r][n]))return!1;return!0}function Vn(t,i,r,n,o,s){let a;for(a in i=i||{},t=t||{})t.hasOwnProperty(a)&&(e.d(t[a],i[a])||r.push({command:s,args:[n,a,i[a],o]}));for(a in i)i.hasOwnProperty(a)&&!t.hasOwnProperty(a)&&(e.d(t[a],i[a])||r.push({command:s,args:[n,a,i[a],o]}))}function $n(e){return e.id}function Gn(e,t){return e[t.id]=t,e}class qn{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(1===this.points.length)return this.points[0];t=e.au(t,0,1);let i=1,r=this._distances[i];const n=t*this.paddedLength+this.padding;
vendor: 4,359 bytes, line 1
1for(;r<n&&i<this._distances.length;)r=this._distances[++i];const o=i-1,s=this._distances[o],a=r-s,l=a>0?(n-s)/a:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}class Hn{constructor(e,t,i){const r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let e=0;e<this.xCellCount*this.yCellCount;e++)r.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,i,r,n){this._forEachCell(t,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}insertCircle(e,t,i,r){this._forEachCell(t-r,i-r,t+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(r)}_insertBoxCell(e,t,i,r,n,o){this.boxCells[n].push(o)}_insertCircleCell(e,t,i,r,n,o){this.circleCells[n].push(o)}_query(e,t,i,r,n,o){if(i<0||e>this.width||r<0||t>this.height)return!n&&[];const s=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r){if(n)return!0;for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){const t=this.circles[3*e],i=this.circles[3*e+1],r=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:t-r,y1:i-r,x2:t+r,y2:i+r})}return o?s.filter(o):s}return this._forEachCell(e,t,i,r,this._queryCell,s,{hitTest:n,seenUids:{box:{},circle:{}}},o),n?s.length>0:s}_queryCircle(e,t,i,r,n){const o=e-i,s=e+i,a=t-i,l=t+i;if(s<0||o>this.width||l<0||a>this.height)return!r&&[];const c=[];return this._forEachCell(o,a,s,l,this._queryCellCircle,c,{hitTest:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},n),r?c.length>0:c}query(e,t,i,r,n){return this._query(e,t,i,r,!1,n)}hitTest(e,t,i,r,n){return this._query(e,t,i,r,!0,n)}hitTestCircle(e,t,i,r){return this._queryCircle(e,t,i,!0,r)}_queryCell(e,t,i,r,n,o,s,a){const l=s.seenUids,c=this.boxCells[n];if(null!==c){const n=this.bboxes;for(const u of c)if(!l.box[u]){l.box[u]=!0;const c=4*u;if(e<=n[c+2]&&t<=n[c+3]&&i>=n[c+0]&&r>=n[c+1]&&(!a||a(this.boxKeys[u]))){if(s.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[u],x1:n[c],y1:n[c+1],x2:n[c+2],y2:n[c+3]})}}}const u=this.circleCells[n];if(null!==u){const n=this.circles;for(const c of u)if(!l.circle[c]){l.circle[c]=!0;const u=3*c;if(this._circleAndRectCollide(n[u],n[u+1],n[u+2],e,t,i,r)&&(!a||a(this.circleKeys[c]))){if(s.hitTest)return o.push(!0),!0;{const e=n[u],t=n[u+1],i=n[u+2];o.push({key:this.circleKeys[c],x1:e-i,y1:t-i,x2:e+i,y2:t+i})}}}}}_queryCellCircle(e,t,i,r,n,o,s,a){const l=s.circle,c=s.seenUids,u=this.boxCells[n];if(null!==u){const e=this.bboxes;for(const t of u)if(!c.box[t]){c.box[t]=!0;const i=4*t;if(this._circleAndRectCollide(l.x,l.y,l.radius,e[i+0],e[i+1],e[i+2],e[i+3])&&(!a||a(this.boxKeys[t])))return o.push(!0),!0}}const h=this.circleCells[n];if(null!==h){const e=this.circles;for(const t of h)if(!c.circle[t]){c.circle[t]=!0;const i=3*t;if(this._circlesCollide(e[i],e[i+1],e[i+2],l.x,l.y,l.radius)&&(!a||a(this.circleKeys[t])))return o.push(!0),!0}}}_forEachCell(e,t,i,r,n,o,s,a){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(i),h=this._convertToYCellCoord(r);for(let p=l;p<=u;p++)for(let l=c;l<=h;l++)if(n.call(this,e,t,i,r,this.xCellCount*l+p,o,s,a))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,r,n,o){const s=r-e,a=n-t,l=i+o;return l*l>s*s+a*a}_circleAndRectCollide(e,t,i,r,n,o,s){const a=(o-r)/2,l=Math.abs(e-(r+a));if(l>a+i)return!1;const c=(s-n)/2,u=Math.abs(t-(n+c));if(u>c+i)return!1;if(l<=a||u<=c)return!0;const h=l-a,p=u-c;return h*h+p*p<=i*i}}const Zn=100;class Wn{constructor(e,t,i=new Hn(e.width+200,e.height+200,25),r=new Hn(e.width+200,e.height+200,25)){this.transform=e,this.grid=i,this.ignoredGrid=r,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Zn,this.screenBottomBoundary=e.he
1ight+Zn,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.fogState=t}placeCollisionBox(e,t,i,r,n,o,s,a){let l=i.projectedAnchorX,c=i.projectedAnchorY,u=i.projectedAnchorZ;const h=i.elevation,p=i.tileID,d=e.getProjection();if(h&&p){const[e,t,r]=d.upVector(p.canonical,i.tileAnchorX,i.tileAnchorY),n=d.upVectorScale(p.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;l+=e*h*n,c+=t*h*n,u+=r*h*n}const f=this.projectAndGetPerspectiveRatio(s,l,c,u,i.tileID,"globe"===d.name||!!h||this.transform.pitch>0,d),m=o*f.perspectiveRatio,_=(i.x1*t+r.x-i.padding)*m+f.point.x,g=(i.y1*t+r.y-i.padding)*m+f.point.y,y=(i.x2*t+r.x+i.padding)*m+f.point.x,v=(i.y2*t+r.y+i.padding)*m+f.point.y,x=f.perspectiveRatio<=.55||f.occluded;return!this.isInsideGrid(_,g,y,v)||!n&&this.grid.hitTest(_,g,y,v,a)||x?{box:[],offscreen:!1,occluded:f.occluded}:{box:[_,g,y,v],offscreen:this.isOffscreen(_,g,y,v),occluded:!1}}placeCollisionCircles(t,i,r,n,o,s,a,l,c,u,h,p,d,f,m){const _=[],g=this.transform.elevation,y=t.getProjection(),v=g?g.getAtTileOffsetFunc(m,this.transform.center.lat,this.transform.worldSize,y):null,x=new e.P(r.tileAnchorX,r.tileAnchorY);let{x:b,y:w,z:T}=y.projectTilePoint(x.x,x.y,m.canonical);if(v){const[e,t,i]=v(x);b+=e,w+=t,T+=i}const M="globe"===y.name,E=this.projectAndGetPerspectiveRatio(a,b,w,T,m,M||!!g||this.transform.pitch>0,y),{perspectiveRatio:S}=E,C=(h?s/S:s*S)/e.bP,A=Qt(b,w,T,l),I=E.signedDistanceFromCamera>0?ei(C,o,r.lineOffsetX*C,r.lineOffsetY*C,!1,A,x,r,n,l,{},g&&!h?v:null,h&&!!g,y,m,h):null;let k=!1,L=!1,P=!0;if(I&&!E.occluded){const t=.5*d*S+f,r=new e.P(-100,-100),n=new e.P(this.screenRightBoundary,this.screenBottomBoundary),o=new qn,{first:s,last:a}=I,l=s.path.length;let h=[];for(let e=l-1;e>=1;e--)h.push(s.path[e]);for(let e=1;e<a.path.length;e++)h.push(a.path[e]);const m=2.5*t;c&&(h=h.map((([e,t,i],r)=>(v&&!M&&(i=v(r<l-1?s.tilePath[l-1-r]:a.tilePath[r-l+2])[2]),Qt(e,t,i,c)))),h.some((e=>e[3]<=0))&&(h=[]));let g=[];if(h.length>0){let t=1/0,i=-1/0,o=1/0,s=-1/0;for(const e of h)t=Math.min(t,e[0]),o=Math.min(o,e[1]),i=Math.max(i,e[0]),s=Math.max(s,e[1]);i>=r.x&&t<=n.x&&s>=r.y&&o<=n.y&&(g=[h.map((t=>new e.P(t[0],t[1])))],(t<r.x||i>n.x||o<r.y||s>n.y)&&(g=e.cH(g,r.x,r.y,n.x,n.y)))}for(const e of g){o.reset(e,.25*t);let r=0;r=o.length<=.5*t?1:Math.ceil(o.paddedLength/m)+1;for(let e=0;e<r;e++){const n=e/Math.max(r-1,1),s=o.lerp(n),a=s.x+Zn,l=s.y+Zn;_.push(a,l,t,0);const c=a-t,h=l-t,d=a+t,f=l+t;if(P=P&&this.isOffscreen(c,h,d,f),L=L||this.isInsideGrid(c,h,d,f),!i&&this.grid.hitTestCircle(a,l,t,p)&&(k=!0,!u))return{circles:[],offscreen:!1,collisionDetected:k,occluded:!1}}}}return{circles:!u&&k||!L?[]:_,offscreen:P,collisionDetected:k,occluded:E.occluded}}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};const i=[];let r=1/0,n=1/0,o=-1/0,s=-1/0;for(const a of t){const t=new e.P(a.x+Zn,a.y+Zn);r=Math.min(r,t.x),n=Math.min(n,t.y),o=Math.max(o,t.x),s=Math.max(s,t.y),i.push(t)}const a=this.grid.query(r,n,o,s).concat(this.ignoredGrid.query(r,n,o,s)),l={},c={};for(const t of a){const r=t.key;if(void 0===l[r.bucketInstanceId]&&(l[r.bucketInstanceId]={}),l[r.bucketInstanceId][r.featureIndex])continue;const n=[new e.P(t.x1,t.y1),new e.P(t.x2,t.y1),new e.P(t.x2,t.y2),new e.P(t.x1,t.y2)];e.cI(i,n)&&(l[r.bucketInstanceId][r.featureIndex]=!0,void 0===c[r.bucketInstanceId]&&(c[r.bucketInstanceId]=[]),c[r.bucketInstanceId].push(r.featureIndex))}return c}insertCollisionBox(e,t,i,r,n){(t?this.ignoredGrid:this.grid).insert({bucketInstanceId:i,featureIndex:r,collisionGroupID:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,r,n){const o=t?this.ignoredGrid:this.grid,s={bucketInstanceId:i,featureIndex:r,collisionGroupID:n};for(let t=0;t<e.length;t+=4)o.insertCircle(s,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(t,i,r,n,o,s,a){const l=[i,r,n,1];let c=!1;if(n||this.transform.pitch>0){if(e.aB.transformMat4(l,l,t),this.fogState&&o&&"globe"!==a.name){const t=function(t,i,r,n,o,s){const a=s.calculateFogTileMatrix(o),l=[i,r,n];return e.$.transformMat4(l,l,a),et(t,e.$.length(l),s.pitch,s._fov)}(this.fogState,i,r,n,o.toUnwrapped(),this.transform);c=t>.9}}else ai(l,l,t);const u=l[3];return{point:new e.P((l[0]/u+1)/2*this.transform.width+Zn,(-l[1]/u+1)/2*this.transform.height+Zn),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(a)/u*.5,1.5),signedDistanceFromCamera:u,occluded:s&&l[2]>u||c}}
vendor: 4,675 bytes, line 1
1isOffscreen(e,t,i,r){return i<Zn||e>=this.screenRightBoundary||r<Zn||t>this.screenBottomBoundary}isInsideGrid(e,t,i,r){return i>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){const t=e.ae.identity([]);return e.ae.translate(t,t,[-100,-100,0]),t}}class Xn{constructor(e,t,i,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&i?1:0,this.placed=i}isHidden(){return 0===this.opacity&&!this.placed}}class Qn{constructor(e,t,i,r,n,o=!1){this.text=new Xn(e?e.text:null,t,i,n),this.icon=new Xn(e?e.icon:null,t,r,n),this.clipped=o}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Yn{constructor(e,t,i,r=!1){this.text=e,this.icon=t,this.skipFade=i,this.clipped=r}}class Jn{constructor(){this.invProjMatrix=e.ae.create(),this.viewportMatrix=e.ae.create(),this.circles=[]}}class Kn{constructor(e,t,i,r,n){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}}class eo{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function to(t,i,r,n,o){const{horizontalAlign:s,verticalAlign:a}=e.bS(t),l=-(s-.5)*i,c=-(a-.5)*r,u=e.bR(t,n);return new e.P(l+u[0]*o,c+u[1]*o)}function io(t,i,r,n,o){const s=new e.P(t,i);return r&&s._rotate(n?o:-o),s}class ro{constructor(e,t,i,r,n,o){this.transform=e.clone(),this.projection=e.projection.name,this.collisionIndex=new Wn(this.transform,n),this.buildingIndex=o,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=t,this.retainedQueryData={},this.collisionGroups=new eo(i),this.collisionCircleArrays={},this.prevPlacement=r,r&&(r.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,i,r,n){const o=r.getBucket(i),s=r.latestFeatureIndex;if(!o||!s||i.fqid!==o.layerIds[0])return;const a=o.layers[0].layout,l=r.collisionBoxArray,c=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),u=r.tileSize/e.a4,h=r.tileID.toUnwrapped();this.transform.setProjection(o.projection);const p=(d=r.tileID,f=o.getProjection(),m=this.transform,f.name===this.projection?m.calculateProjMatrix(d.toUnwrapped()):_r(m,f,d));var d,f,m;const _="map"===a.get("text-pitch-alignment"),g="map"===a.get("text-rotation-alignment");i.compileFilter();const y=i.dynamicFilter(),v=i.dynamicFilterNeedsFeature(),x=this.transform.calculatePixelsToTileUnitsMatrix(r),b=Wt(p,r.tileID.canonical,_,g,this.transform,o.getProjection(),x);let w=null;if(_){const t=Xt(p,r.tileID.canonical,_,g,this.transform,o.getProjection(),x);w=e.ae.multiply([],this.transform.labelPlaneMatrix,t)}let T=null;y&&r.latestFeatureIndex&&(T={unwrappedTileID:h,dynamicFilter:y,dynamicFilterNeedsFeature:v,featureIndex:r.latestFeatureIndex}),this.retainedQueryData[o.bucketInstanceId]=new Kn(o.bucketInstanceId,s,o.sourceLayerIndex,o.index,r.tileID);const M={bucket:o,layout:a,posMatrix:p,textLabelPlaneMatrix:b,labelToScreenMatrix:w,clippingData:T,scale:c,textPixelRatio:u,holdingForFade:r.holdingForFade(),collisionBoxArray:l,partiallyEvaluatedTextSize:e.aE(o.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:e.aE(o.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(const e of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n}=e;t.push({sortKey:i,symbolInstanceStart:r,symbolInstanceEnd:n,parameters:M})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:M})}attemptAnchorPlacement(e,t,i,r,n,o,s,a,l,c,u,h,p,d,f,m,_,g){const{textOffset0:y,textOffset1:v,crossTileID:x}=h,b=[y,v],w=to(e,i,r,b,n),T=this.collisionIndex.placeCollisionBox(d,n,t,io(w.x,w.y,o,s,this.transform.angle),u,a,l,c.predicate);if(m){const e=d.getSymbolInstanceIconSize(g,this.transform.zoom,h.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(d,e,m,io(w.x,w.y,o,s,this.transform.angle),u,a,l,c.predicate).box.length)return}if(T.box.length>0){let t;return this.prevPlacement&&this.prevPlacement.variableOffsets[x]&&this.prevPlacement.placements[x]&&this.prevPlacement.placements[x].text&&(t=this.prevPlacement.variableOffsets[x].anchor),this.variableOffsets[x]={textOffset:b,width:i,height:r,anchor:e,textScale:n,prevAnchor:t},this.markUsedJustification(d,e,h,f),d.allowVerticalPlacement&&(this.markUsedOrientation(d,f,h),this.placedOrientations[x]=f),{shift:w,placedGlyphBoxes:T}}}placeLayerBucketPart(t,i,r,n){const{bucket:o,layout:s,posMatrix:a,textLabelPlaneMatr
1ix:l,labelToScreenMatrix:c,clippingData:u,textPixelRatio:h,holdingForFade:p,collisionBoxArray:d,partiallyEvaluatedTextSize:f,partiallyEvaluatedIconSize:m,collisionGroup:_}=t.parameters,g=s.get("text-optional"),y=s.get("icon-optional"),v=s.get("text-allow-overlap"),x=s.get("icon-allow-overlap"),b="map"===s.get("text-rotation-alignment"),w="map"===s.get("text-pitch-alignment"),T="viewport-y"===s.get("symbol-z-order"),M=s.get("symbol-z-elevate");this.transform.setProjection(o.projection);let E=v&&(x||!o.hasIconData()||y),S=x&&(v||!o.hasTextData()||g);!o.collisionArrays&&d&&o.deserializeCollisionBoxes(d),r&&n&&o.updateCollisionDebugBuffers(this.transform.zoom,d);const C=(t,n,d)=>{const{crossTileID:T,numVerticalGlyphVertices:M}=t;if(u){const r={zoom:this.transform.zoom,pitch:this.transform.pitch};let n=null;if(u.dynamicFilterNeedsFeature){const e=this.retainedQueryData[o.bucketInstanceId];n=u.featureIndex.loadFeature({featureIndex:t.featureIndex,bucketIndex:e.bucketIndex,sourceLayerIndex:e.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,u.dynamicFilter)(r,n,this.retainedQueryData[o.bucketInstanceId].tileID.canonical,new e.P(t.tileAnchorX,t.tileAnchorY),this.transform.calculateDistanceTileData(u.unwrappedTileID)))return this.placements[T]=new Yn(!1,!1,!1,!0),void i.add(T)}if(i.has(T))return;if(p)return void(this.placements[T]=new Yn(!1,!1,!1));let C=!1,A=!1,I=!0,k=!1,L=!1,P=null,R={box:null,offscreen:null,occluded:null},z={box:null,offscreen:null,occluded:null},O=null,D=null,F=null,B=0,N=0,j=0;d.textFeatureIndex?B=d.textFeatureIndex:t.useRuntimeCollisionCircles&&(B=t.featureIndex),d.verticalTextFeatureIndex&&(N=d.verticalTextFeatureIndex);const U=e=>{e.tileID=this.retainedQueryData[o.bucketInstanceId].tileID;const i=this.transform.elevation;e.elevation=t.zOffset+(i?i.getAtTileOffset(e.tileID,e.tileAnchorX,e.tileAnchorY):0)},V=d.textBox;if(V){U(V);const i=i=>{let r=e.aF.horizontal;if(o.allowVerticalPlacement&&!i&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[T];e&&(this.placedOrientations[T]=e,r=e,this.markUsedOrientation(o,r,t))}return r},r=(t,i)=>{if(o.allowVerticalPlacement&&M>0&&d.verticalTextBox){for(const r of o.writingModes)if(r===e.aF.vertical?(R=i(),z=R):R=t(),R&&R.box&&R.box.length)break}else R=t()};if(s.get("text-variable-anchor")){let l=s.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[T]){const e=this.prevPlacement.variableOffsets[T];l.indexOf(e.anchor)>0&&(l=l.filter((t=>t!==e.anchor)),l.unshift(e.anchor))}const c=(e,i,r)=>{const s=o.getSymbolInstanceTextSize(f,t,this.transform.zoom,n),c=(e.x2-e.x1)*s+2*e.padding,u=(e.y2-e.y1)*s+2*e.padding,p=t.hasIconTextFit&&!x?i:null;p&&U(p);let d={box:[],offscreen:!1,occluded:!1};const g=v?2*l.length:l.length;for(let i=0;i<g;
vendor: 2,172 bytes, line 1
1++i){const g=this.attemptAnchorPlacement(l[i%l.length],e,c,u,s,b,w,h,a,_,i>=l.length,t,n,o,r,p,f,m);if(g&&(d=g.placedGlyphBoxes,d&&d.box&&d.box.length)){C=!0,P=g.shift;break}}return d};r((()=>c(V,d.iconBox,e.aF.horizontal)),(()=>{const t=d.verticalTextBox;return t&&U(t),o.allowVerticalPlacement&&!(R&&R.box&&R.box.length)&&M>0&&t?c(t,d.verticalIconBox,e.aF.vertical):{box:null,offscreen:null,occluded:null}})),R&&(C=R.box,I=R.offscreen,k=R.occluded);const u=i(!(!R||!R.box));if(!C&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[T];e&&(this.variableOffsets[T]=e,this.markUsedJustification(o,e.anchor,t,u))}}else{const s=(i,r)=>{const s=o.getSymbolInstanceTextSize(f,t,this.transform.zoom,n),l=this.collisionIndex.placeCollisionBox(o,s,i,new e.P(0,0),v,h,a,_.predicate);return l&&l.box&&l.box.length&&(this.markUsedOrientation(o,r,t),this.placedOrientations[T]=r),l};r((()=>s(V,e.aF.horizontal)),(()=>{const t=d.verticalTextBox;return o.allowVerticalPlacement&&M>0&&t?(U(t),s(t,e.aF.vertical)):{box:null,offscreen:null,occluded:null}})),i(!!(R&&R.box&&R.box.length))}}if(O=R,C=O&&O.box&&O.box.length>0,I=O&&O.offscreen,k=O&&O.occluded,t.useRuntimeCollisionCircles){const i=o.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex),n=e.aG(o.textSizeData,f,i),u=s.get("text-padding");D=this.collisionIndex.placeCollisionCircles(o,v,i,o.lineVertexArray,o.glyphOffsetArray,n,a,l,c,r,w,_.predicate,t.collisionCircleDiameter*n/e.bP,u,this.retainedQueryData[o.bucketInstanceId].tileID),C=v||D.circles.length>0&&!D.collisionDetected,I=I&&D.offscreen,k=D.occluded}if(d.iconFeatureIndex&&(j=d.iconFeatureIndex),d.iconBox){const i=i=>{U(i);const r=t.hasIconTextFit&&P?io(P.x,P.y,b,w,this.transform.angle):new e.P(0,0),n=o.getSymbolInstanceIconSize(m,this.transform.zoom,t.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(o,n,i,r,x,h,a,_.predicate)};z&&z.box&&z.box.length&&d.verticalIconBox?(F=i(d.verticalIconBox),A=F.box.length>0):(F=i(d.iconBox),A=F.box.length>0),I=I&&F.offscreen,L=F.occluded}const $=g||0===t.numHorizontalGlyphVertices&&0===M,G=y||0===t.numIconVertices;
vendor: 4,489 bytes, line 1
1if($||G?G?$||(A=A&&C):C=A&&C:A=C=A&&C,C&&O&&O.box&&this.collisionIndex.insertCollisionBox(O.box,s.get("text-ignore-placement"),o.bucketInstanceId,z&&z.box&&N?N:B,_.ID),A&&F&&this.collisionIndex.insertCollisionBox(F.box,s.get("icon-ignore-placement"),o.bucketInstanceId,j,_.ID),D&&(C&&this.collisionIndex.insertCollisionCircles(D.circles,s.get("text-ignore-placement"),o.bucketInstanceId,B,_.ID),r)){const e=o.bucketInstanceId;let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=new Jn);for(let e=0;e<D.circles.length;e+=4)t.circles.push(D.circles[e+0]),t.circles.push(D.circles[e+1]),t.circles.push(D.circles[e+2]),t.circles.push(D.collisionDetected?1:0)}const q="globe"!==o.projection.name;E=E&&(q||!k),S=S&&(q||!L),this.placements[T]=new Yn(C||E,A||S,I||o.justReloaded),i.add(T)};if(M&&this.buildingIndex&&(this.buildingIndex.updateZOffset(o,this.retainedQueryData[o.bucketInstanceId].tileID),o.updateZOffset()),T){const t=o.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){const i=t[e];C(o.symbolInstances.get(i),i,o.collisionArrays[i])}o.hasAnyZOffset&&e.w(`${o.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(o.hasAnyZOffset){const e=o.getSortedIndexesByZOffset();for(let t=0;t<e.length;++t){const i=e[t];C(o.symbolInstances.get(i),i,o.collisionArrays[i])}}else for(let e=t.symbolInstanceStart;e<t.symbolInstanceEnd;e++)C(o.symbolInstances.get(e),e,o.collisionArrays[e]);if(r&&o.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[o.bucketInstanceId];e.ae.invert(t.invProjMatrix,a),t.viewportMatrix=this.collisionIndex.getViewportMatrix()}o.justReloaded=!1}markUsedJustification(t,i,r,n){const{leftJustifiedTextSymbolIndex:o,centerJustifiedTextSymbolIndex:s,rightJustifiedTextSymbolIndex:a,verticalPlacedTextSymbolIndex:l,crossTileID:c}=r,u=e.cM(i),h=n===e.aF.vertical?l:"left"===u?o:"center"===u?s:"right"===u?a:-1;o>=0&&(t.text.placedSymbolArray.get(o).crossTileID=h>=0&&o!==h?0:c),s>=0&&(t.text.placedSymbolArray.get(s).crossTileID=h>=0&&s!==h?0:c),a>=0&&(t.text.placedSymbolArray.get(a).crossTileID=h>=0&&a!==h?0:c),l>=0&&(t.text.placedSymbolArray.get(l).crossTileID=h>=0&&l!==h?0:c)}markUsedOrientation(t,i,r){const n=i===e.aF.horizontal||i===e.aF.horizontalOnly?i:0,o=i===e.aF.vertical?i:0,{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:a,rightJustifiedTextSymbolIndex:l,verticalPlacedTextSymbolIndex:c}=r,u=t.text.placedSymbolArray;s>=0&&(u.get(s).placedOrientation=n),a>=0&&(u.get(a).placedOrientation=n),l>=0&&(u.get(l).placedOrientation=n),c>=0&&(u.get(c).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const t=this.prevPlacement;let i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;const r=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},o=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],o=n[e];o?(this.opacities[e]=new Qn(o,r,t.text,t.icon,null,t.clipped),i=i||t.text!==o.text.placed||t.icon!==o.icon.placed):(this.opacities[e]=new Qn(null,r,t.text,t.icon,t.skipFade,t.clipped),i=i||t.text||t.icon)}for(const e in n){const t=n[e];if(!this.opacities[e]){const n=new Qn(t,r,!1,!1);n.isHidden()||(this.opacities[e]=n,i=i||t.text.placed||t.icon.placed)}}for(const e in o)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=o[e]);for(const e in s)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=s[e]);i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t,i,r){const n=new Set;for(const o of t){const t=o.getBucket(e);t&&o.latestFeatureIndex&&e.fqid===t.layerIds[0]&&(this.updateBucketOpacities(t,n,o.collisionBoxArray,i,r,o.tileID,e.scope),t.layers[0].layout.get("symbol-z-elevate")&&this.buildingIndex&&(this.buildingIndex.updateZOffset(t,o.tileID),t.updateZOffset()))}}updateBucketOpacities(t,i,r,n,o,s,a){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const l=t.layers[0].layout,c=!!t.layers[0].dynamicFilter(),u=new Qn(null,0,!1,!1,
vendor: 2,659 bytes, line 1
1!0),h=l.get("text-allow-overlap"),p=l.get("icon-allow-overlap"),d=l.get("text-variable-anchor"),f="map"===l.get("text-rotation-alignment"),m="map"===l.get("text-pitch-alignment"),_=new Qn(null,0,h&&(p||!t.hasIconData()||l.get("icon-optional")),p&&(h||!t.hasTextData()||l.get("text-optional")),!0);!t.collisionArrays&&r&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(r);const g=(e,t,i)=>{for(let r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(i)};let y=0;o&&t.updateReplacement(s,o);for(let r=0;r<t.symbolInstances.length;r++){const l=t.symbolInstances.get(r),{numHorizontalGlyphVertices:h,numVerticalGlyphVertices:p,crossTileID:v,numIconVertices:x,tileAnchorX:b,tileAnchorY:w}=l,T=i.has(v);let M=this.opacities[v];T?M=u:M||(M=_,this.opacities[v]=M),i.add(v);const E=h>0||p>0,S=x>0,C=this.placedOrientations[v],A=C===e.aF.vertical,I=C===e.aF.horizontal||C===e.aF.horizontalOnly;!E&&!S||M.isHidden()||y++;let k=!1;if((E||S)&&o)for(const i of t.activeReplacements){if(e.cJ(i,n,e.cw.Symbol,a))continue;if(i.min.x>b||b>i.max.x||i.min.y>w||w>i.max.y)continue;const t=e.cK(b,w,s.canonical,i.footprintTileId.canonical);if(k=e.cL(t,i),k)break}if(E){const e=k?fo:po(M.text);g(t.text,h,A?fo:e),g(t.text,p,I?fo:e);const i=M.text.isHidden(),{leftJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:n,rightJustifiedTextSymbolIndex:o,verticalPlacedTextSymbolIndex:s}=l,a=t.text.placedSymbolArray,c=i||A?1:0;r>=0&&(a.get(r).hidden=c),n>=0&&(a.get(n).hidden=c),o>=0&&(a.get(o).hidden=c),s>=0&&(a.get(s).hidden=i||I?1:0);const u=this.variableOffsets[v];u&&this.markUsedJustification(t,u.anchor,l,C);const d=this.placedOrientations[v];d&&(this.markUsedJustification(t,"left",l,d),this.markUsedOrientation(t,d,l))}if(S){const e=k?fo:po(M.icon),{placedIconSymbolIndex:i,verticalPlacedIconSymbolIndex:r}=l,n=t.icon.placedSymbolArray,o=M.icon.isHidden()?1:0;i>=0&&(g(t.icon,x,A?fo:e),n.get(i).hidden=o),r>=0&&(g(t.icon,l.numVerticalIconVertices,I?fo:e),n.get(r).hidden=o)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const i=t.collisionArrays[r];if(i){let r=new e.P(0,0),n=!0;if(i.textBox||i.verticalTextBox){if(d){const e=this.variableOffsets[v];e?(r=to(e.anchor,e.width,e.height,e.textOffset,e.textScale),f&&r._rotate(m?this.transform.angle:-this.transform.angle)):n=!1}c&&(n=!M.clipped),i.textBox&&no(t.textCollisionBox.collisionVertexArray,M.text.placed,!n||A,r.x,r.y),i.verticalTextBox&&no(t.textCollisionBox.collisionVertexArray,M.text.placed,!n||I,r.x,r.y)}const o=n&&Boolean(!I&&i.verticalIconBox);i.iconBox&&no(t.iconCollisionBox.collisionVertexArray,M.icon.placed,o,l.hasIconTextFit?r.x:0,l.hasIconTextFit?r.
vendor: 7,512 bytes, line 1
1y:0),i.verticalIconBox&&no(t.iconCollisionBox.collisionVertexArray,M.icon.placed,!o,l.hasIconTextFit?r.x:0,l.hasIconTextFit?r.y:0)}}}if(t.fullyClipped=0===y,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const e=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=e.invProjMatrix,t.placementViewportMatrix=e.viewportMatrix,t.collisionCircleArray=e.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){const i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}setStale(){this.stale=!0}}function no(e,t,i,r,n){e.emplaceBack(t?1:0,i?1:0,r||0,n||0),e.emplaceBack(t?1:0,i?1:0,r||0,n||0),e.emplaceBack(t?1:0,i?1:0,r||0,n||0),e.emplaceBack(t?1:0,i?1:0,r||0,n||0)}const oo=Math.pow(2,25),so=Math.pow(2,24),ao=Math.pow(2,17),lo=Math.pow(2,16),co=Math.pow(2,9),uo=Math.pow(2,8),ho=Math.pow(2,1);function po(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;const t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*oo+t*so+i*ao+t*lo+i*co+t*uo+i*ho+t}const fo=0;class mo{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&void 0!==e.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(e,t,i,r,n){const o=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(o,r,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort(((e,t)=>e.sortKey-t.sortKey)));this._currentPartIndex<o.length;){const e=o[this._currentPartIndex];if(t.placeLayerBucketPart(e,this._seenCrossTileIDs,i,0===e.symbolInstanceStart),this._currentPartIndex++,n())return!0}return!1}}class _o{constructor(e,t,i,r,n,o,s,a,l){this.placement=new ro(e,n,o,s,a,l),this._currentPlacementIndex=t.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=r,this._done=!1}isDone(){return this._done}continuePlacement(t,i,r,n){const o=e.e.now(),s=()=>{const t=e.e.now()-o;return!this._forceFullPlacement&&t>2};for(;this._currentPlacementIndex>=0;){const o=i[t[this._currentPlacementIndex]],a=this.placement.collisionIndex.transform.zoom;if("symbol"===o.type&&(!o.minzoom||o.minzoom<=a)&&(!o.maxzoom||o.maxzoom>a)){const t=o,i=t.layout.get("symbol-z-elevate"),a=this._inProgressLayer=this._inProgressLayer||new mo(t),l=e.am(o.source,o.scope);if(a.continuePlacement(i?n[l]:r[l],this.placement,this._showCollisionBoxes,o,s))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const go=512/e.a4/2;class yo{constructor(t,i,r){this.tileID=t,this.bucketInstanceId=r,this.index=new e.cN(i.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const n=t.canonical.x*e.a4,o=t.canonical.y*e.a4;for(let e=0;e<i.length;e++){const{key:t,crossTileID:r,tileAnchorX:s,tileAnchorY:a}=i.get(e),l=Math.floor((n+s)*go),c=Math.floor((o+a)*go);this.index.add(l,c),this.keys.push(t),this.crossTileIDs.push(r)}this.index.finish()}findMatches(t,i,r){const n=this.tileID.canonical.z<i.canonical.z?1:Math.pow(2,this.tileID.canonical.z-i.canonical.z),o=go/Math.pow(2,i.canonical.z-this.tileID.canonical.z),s=i.canonical.x*e.a4,a=i.canonical.y*e.a4;for(let e=0;e<t.length;e++){const i=t.get(e);if(i.crossTileID)continue;const{key:l,tileAnchorX:c,tileAnchorY:u}=i,h=Math.floor((s+c)*o),p=Math.floor((a+u)*o),d=this.index.range(h-n,p-n,h+n,p+n);for(const e of d){const t=this.crossTileIDs[e];if(this.keys[e]===l&&!r.has(t)){r.add(t),i.crossTileID=t;break}}}}}class vo{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class xo{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const t=Math.round((e-this.lng)/360);if(0!==t)for(const e in this.indexes){const i=this.indexes[e],r={};for(const e in i){const n=i[e];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),r[n.tileID.key]=n}this.indexes[e]=r}this.lng=e}addBucket(e,t,i){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++)t.symbolInstances.get(e).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]=new Set);const r=this.usedCrossTileIDs[e.overscaledZ];for(const i in this.indexes){const n=this.indexes[i];if(Number(i)>e.overscaledZ)for(const i in n){const o=n[i];o.tileID.isChildOf(e)&&o.findMatches(t.symbolInstances,e,r)}else{const o=n[e.scaledTo(Number(i)).key];o&&o.findMatches(t.symbolInstances,e,r)}}for(let e=0;e<t.symbolInstances.length;e++){const n=t.symbolInstances.get(e);n.crossTileID||(n.crossTileID=i.generate(),r.add(n.crossTileID))}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new yo(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(const i of t.crossTileIDs)this.usedCrossTileIDs[e].delete(i)}removeStaleBuckets(e){let t=!1;for(const i in this.indexes){const r=this.indexes[i];for(const n in r)e[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],t=!0)}return t}}class bo{constructor(){this.layerIndexes={},this.crossTileIDs=new vo,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i,r){let n=this.layerIndexes[e.fqid];void 0===n&&(n=this.layerIndexes[e.fqid]=new xo);let o=!1;const s={};"globe"!==r.name&&n.handleWrapJump(i);for(const i of t){const t=i.getBucket(e);t&&e.fqid===t.layerIds[0]&&(t.bucketInstanceId||(t.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(i.tileID,t,this.crossTileIDs)&&(o=!0),s[t.bucketInstanceId]=!0)}return n.removeStaleBuckets(s)&&(o=!0),o}pruneUnusedLayers(e){const t={};e.forEach((e=>{t[e]=!0}));for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}const wo=new e.U({data:new e.W(e.N.colorTheme.data)}),To=(e,t)=>He(e,t&&t.filter((e=>"source.canvas"!==e.identifier))),Mo=e.ai(Fn,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection","setCamera","addImport","removeImport","updateImport"]),Eo=e.ai(Fn,["setCenter","setZoom","setBearing","setP
1itch"]),So={version:8,layers:[],sources:{}},Co={duration:300,delay:0};class Ao extends e.E{constructor(t,i={}){super(),this.map=t,this.scope=i.scope||"",this.globalId=null,this.fragments=[],this.importDepth=i.importDepth||0,this.importsCache=i.importsCache||new Map,this.resolvedImports=i.resolvedImports||new Set,this.transition=e.Q({},Co),this._buildingIndex=new zn(this),this.crossTileSymbolIndex=new bo,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerIndices=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=i.styleChanges||new g,this.dispatcher=i.dispatcher?i.dispatcher:new e.by(e.bz(),this),i.imageManager?this.imageManager=i.imageManager:(this.imageManager=new le,this.imageManager.setEventedParent(this)),this.imageManager.createScope(this.scope),this.glyphManager=i.glyphManager?i.glyphManager:new e.cP(t._requestManager,i.localFontFamily?e.cQ.all:i.localIdeographFontFamily?e.cQ.ideographs:e.cQ.none,i.localFontFamily||i.localIdeographFontFamily),i.modelManager?this.modelManager=i.modelManager:(this.modelManager=new se(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._order=[],this._markersNeedUpdate=!1,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null},this._styleColorThemeForScope={},this.options=i.configOptions?i.configOptions:new Map,this._configDependentLayers=i.configDependentLayers?i.configDependentLayers:new Set,this._config=i.config,this._initialConfig=i.initialConfig,this.dispatcher.broadcast("setReferrer",e.cR());const r=this;this._rtlTextPluginCallback=Ao.registerForPluginStateChange((t=>{r.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},((t,i)=>{if(e.cS(t),i&&i.every((e=>e)))for(const e in r._sourceCaches){const t=r._sourceCaches[e],i=t.getSource().type;"vector"!==i&&"geojson"!==i||t.reload()}}))})),this.on("data",(e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;const t=this.getOwnSource(e.sourceId);if(t&&t.vectorLayerIds)for(const e in this._layers){const i=this._layers[e];i.source===t.id&&this._validateLayer(i)}}))}load(e){return e?("string"==typeof e?this.loadURL(e):this.loadJSON(e),this):this}_getGlobalId(t){if(!t)return null;if("string"==typeof t){if(e.cT(t))return t;const i=e.cU(t);if(!i.startsWith("http"))try{return new URL(i,location.href).toString()}catch(e){return i}return i}return`json://${e.cV(JSON.stringify(t))}`}_diffStyle(t,i,r){this.globalId=this._getGlobalId(t);const n=(e,t)=>{try{t(null,this.setState(e,r))}catch(e){t(e,!1)}};if("string"==typeof t){const r=this.map._requestManager.normalizeStyleURL(t),o=this.map._requestManager.transformRequest(r,e.R.Style);e.h(o,((t,r)=>{t?this.fire(new e.f(t)):r&&n(r,i)}))}else"object"==typeof t&&n(t,i)}loadURL(t,i={}){this.fire(new e.g("dataloading",{dataType:"style"}));const r="boolean"==typeof i.validate?i.validate:!e.cT(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,i.accessToken),this.resolvedImports.add(t);const n=this.importsCache.get(t);if(n)return this._load(n,r);const o=this.map._requestManager.transformRequest(t,e.R.Style);this._request=e.h(o,((i,n)=>{if(this._request=null,i)this.fire(new e.f(i));else if(n)return this.importsCache.set(t,n),this._load(n,r)}))}loadJSON(t,i={}){this.fire(new e.g("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=e.e.frame((()=>{this._request=null,this._load(t,!1!==i.validate)}))}loadEmpty(){this.fire(new e.g("dataloading",{dataType:"style"})),this._load(So,!1)}_loadImports(t,i,r){if(this.importDepth>=4)return e.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const n=[];for(const e of t){const t=this._createFragmentStyle(e),o=new Promise((e=>{t.once("style.import.load",e),t.once("error",e)})).then((()=>this.mergeAll()));if(n.push(o),this.resolvedImports.has(e.url)){t.loadEmpty();continue}const s=e.data||this.importsCache.get(e.url);s?(t.loadJSON(s,{validate:i}),this._isInternalStyle(s)&&(t.globalId=null)):e.url?t.loadURL(e.url,{validate:i}):t.loadEmpty();const a={style:t,id:e.id,config:e.config};if(r){const e=this.fragments.findIndex((({id:e})=>e===r));this.fragments=this.fragments.slice(0,e).concat(a).concat(this.fragments.slice(e))}else this.fragments.push(a)}return Promise.allSettled(n)}getImportGlobalIds(e=this,t=new Set){for(const i of e.fragments)i.style.globalId&&t.add(i.style.globalId),this.getImportGlobalIds(i.style,t);return[...t.values()]}_createFragmentStyle(t){const i=this.scope?e.am(t.id,this.scope):t.id;let r;const n=this._initialConfig&&this._initialConfig[i];(t.config||n)&&(r=e.Q({},t.config,n));const o=new Ao(this.map,{scope:i,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:r,configOptions:this.options,configDependentLayers:this._configDependentLayers});return o.setEventedParent(this.map,{style:o}),o}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(e){return this.isRootStyle()&&(e.fragment||!!e.schema&&!1!==e.fragment)}_load(t,i){const r=t.schema;if(this._isInternalStyle(t)){const r=e.Q({},So,{imports:[{id:"basemap",data:t,url:""}]});return void this._load(r,i)}if(this.updateConfig(this._config,r),i&&To(this,ze(t)))return;this._loaded=!0,this.stylesheet=e.cW(t);const n=()=>{for(const e in t.sources)this.addSource(e,t.sources[e],{validate:!1,isInitialLoad:!0});t.sprite?this._loadSprite(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.glyphManager.setURL(t.glyphs,this.scope);
1const r=Dn(this.stylesheet.layers);if(this._order=r.map((e=>e.id)),this.stylesheet.light&&e.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(1===this.stylesheet.lights.length&&"flat"===this.stylesheet.lights[0].type){const e=this.stylesheet.lights[0];this.light=new We(e.properties,e.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new We(this.stylesheet.light)),this._layers={},this._serializedLayers={};for(const t of r){const i=e.c$(t,this.scope,this._styleColorTheme.lut,this.options);0!==i.configDependencies.size&&this._configDependentLayers.add(i.fqid),i.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=i,this._serializedLayers[i.id]=i.serialize();const r=this.getOwnLayerSourceCache(i),n=!!this.directionalLight&&this.directionalLight.shadowsEnabled();r&&i.canCastShadows()&&n&&(r.castsShadows=!0)}this.stylesheet.models&&this.modelManager.addModels(this.stylesheet.models,this.scope);const n=this.stylesheet.terrain;n&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(n,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new e.g("data",{dataType:"style"}));const o=this.isRootStyle();t.imports?this._loadImports(t.imports,i).then((()=>{this._reloadImports(),this.fire(new e.g(o?"style.load":"style.import.load"))})):(this._reloadImports(),this.fire(new e.g(o?"style.load":"style.import.load")))},o=this.stylesheet["color-theme"];if(this._styleColorTheme.colorTheme=o,o){const t=this._evaluateColorThemeData(o);this._loadColorTheme(t).then((()=>{n()})).catch((t=>{e.w(`Couldn't load color theme from the stylesheet: ${t}`),n()}))}else this._styleColorTheme.lut=null,n()}isRootStyle(){return 0===this.importDepth}mergeAll(){let t,i,r,n,o,s,a,l;const c={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle((e=>{if(e.stylesheet){if(null!=e.light&&(t=e.light),e.stylesheet.lights)for(const t of e.stylesheet.lights)"ambient"===t.type&&null!=e.ambientLight&&(i=e.ambientLight),"directional"===t.type&&null!=e.directionalLight&&(r=e.directionalLight);n=this._prioritizeTerrain(n,e.terrain,e.stylesheet.terrain),e.stylesheet.fog&&null!=e.fog&&(o=e.fog),null!=e.stylesheet.camera&&(l=e.stylesheet.camera),null!=e.stylesheet.projection&&(s=e.stylesheet.projection),null!=e.stylesheet.transition&&(a=e.stylesheet.transition),c[e.scope]=e._styleColorTheme}})),this.light=t,this.ambientLight=i,this.directionalLight=r,this.fog=o,this._styleColorThemeForScope=c,null===n?delete this.terrain:this.terrain=n,this.camera=l||{"camera-projection":"perspective"},this.projection=s||{name:"mercator"},this.transition=e.Q({},Co,a),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(e){const t=i=>{for(const e of i.fragments)t(e.style);e(i)};t(this)}_prioritizeTerrain(e,t,i){const r=e&&0===e.drapeRenderMode;return null===i?t&&0===t.drapeRenderMode?t:r?e:null:null!=t&&(!e||r||t&&1===t.drapeRenderMode)?t:e}mergeTerrain(){let e;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle((t=>{e=this._prioritizeTerrain(e,t.terrain,t.stylesheet.terrain)})),null===e?delete this.terrain:this.terrain=e}mergeProjection(){let e;this.forEachFragmentStyle((t=>{null!=t.stylesheet.projection&&(e=t.stylesheet.projection)})),this.projection=e||{name:"mercator"}}mergeSources(){const t={},i={},r={};this.forEachFragmentStyle((n=>{for(const i in n._sourceCaches){const r=e.am(i,n.scope);t[r]=n._sourceCaches[i]}for(const t in n._otherSourceCaches){const r=e.am(t,n.scope);i[r]=n._otherSourceCaches[t]}for(const t in n._symbolSourceCaches){const i=e.am(t,n.scope);r[i]=n._symbolSourceCaches[t]}})),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=i,this._mergedSymbolSourceCaches=r}mergeLayers(){const t={},i=[],r={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle((r=>{for(const n of r._order){const o=r._layers[n];if("slot"===o.type){const i=e.cX(n);if(t[i])continue;t[i]=[]}o.slot&&t[o.slot]?t[o.slot].push(o):i.push(o)}})),this._mergedOrder=[],this._clipLayerIndices=[];let n=0;const o=(i=[])=>{for(const s of i)if("slot"===s.type){const i=e.cX(s.id);t[i]&&o(t[i]),this._mergedSlots.push(i)}else{const t=e.am(s.id,s.scope);this._mergedOrder.push(t),r[t]=s,s.is3D()&&(this._has3DLayers=!0),"circle"===s.type&&(this._hasCircleLayers=!0),"symbol"===s.type&&(this._hasSymbolLayers=!0),"clip"===s.type&&this._clipLayerIndices.push(n),n++}};o(i),this._mergedOrder.sort(((e,t)=>{const i=r[e],n=r[t];return i.hasInitialOcclusionOpacityProperties?n.is3D()?1:0:i.is3D()&&n.hasInitialOcclusionOpacityProperties?-1:0})),this._mergedLayers=r,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=e.Q({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?function(t,i,r){const n=e.Q({},i);for(const t of Object.keys(e.N.colorTheme))void 0===n[t]&&(n[t]=e.N.colorTheme[t].default);const o=new e.O(wo,t,new Map(r));return o.setTransitionOrValue(n,r),o.untransitioned().possiblyEvaluate(new e.Y(0))}(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const i=this._styleColorTheme.lutLoadingCorrelationID;return new Promise(((r,n)=>{const o="data:image/png;base64,";if(!t||0===t.length)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void r();let s=t;s.startsWith(o)||(s=o+s);const a="mapbox-reserved-lut",l=new Image;l.src=s,l.onerror=()=>{this._styleColorTheme.lutLoading=!1,n(new Error("Failed to load image data"))},l.onload=()=>
1{if(this._styleColorTheme.lutLoadingCorrelationID!==i)return void r();this._styleColorTheme.lutLoading=!1;const{width:o,height:s,data:c}=e.e.getImageData(l);if(s>32)return void n(new Error("The height of the image must be less than or equal to 32 pixels."));if(o!==s*s)return void n(new Error("The width of the image must be equal to the height squared."));this.getImage(a)&&this.removeImage(a),this.addImage(a,{data:new e.j({width:o,height:s},c),pixelRatio:1,sdf:!1,version:0});const u=this.imageManager.getImage(a,this.scope);u?(this._styleColorTheme.lut={image:u.data,data:t},r()):n(new Error("Missing LUT image."))}}))}getLut(e){const t=this._styleColorThemeForScope[e];return t?t.lut:null}setProjection(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(t){this._spriteRequest=function(t,i,r){let n,o,s;const a=e.e.devicePixelRatio>1?"@2x":"";let l=e.h(i.transformRequest(i.normalizeSpriteURL(t,a,".json"),e.R.SpriteJSON),((e,t)=>{l=null,s||(s=e,n=t,u())})),c=e.i(i.transformRequest(i.normalizeSpriteURL(t,a,".png"),e.R.SpriteImage),((e,t)=>{c=null,s||(s=e,o=t,u())}));function u(){if(s)r(s);else if(n&&o){const t=e.e.getImageData(o),i={};for(const r in n){const{width:o,height:s,x:a,y:l,sdf:c,pixelRatio:u,stretchX:h,stretchY:p,content:d}=n[r],f=new e.j({width:o,height:s});e.j.copy(t,f,{x:a,y:l},{x:0,y:0},{width:o,height:s},null),i[r]={data:f,pixelRatio:u,sdf:c,stretchX:h,stretchY:p,content:d}}r(null,i)}}return{cancel(){l&&(l.cancel(),l=null),c&&(c.cancel(),c=null)}}}(t,this.map._requestManager,((t,i)=>{if(this._spriteRequest=null,t)this.fire(new e.f(t));else if(i)for(const e in i)this.imageManager.addImage(e,this.scope,i[e]);this.imageManager.setLoaded(!0,this.scope),this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new e.g("data",{dataType:"style"}))}))}_validateLayer(t){const i=this.getOwnSource(t.source);if(!i)return;const r=t.sourceLayer;
1r&&("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(r))&&this.fire(new e.f(new Error(`Source layer "${r}" does not exist on source "${i.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return!1;if(!this.imageManager.isLoaded())return!1;if(!this.modelManager.isLoaded())return!1;if(this._styleColorTheme.lutLoading)return!1;for(const{style:e}of this.fragments)if(!e.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map(((e,t)=>{const i=this.fragments[t];return i&&i.style&&(e.data=i.style.serialize()),e}))}_serializeSources(){const e={};for(const t in this._sourceCaches){const i=this._sourceCaches[t].getSource();e[i.id]||(e[i.id]=i.serialize())}return e}_serializeLayers(e){const t=[];for(const i of e){const e=this._layers[i];e&&"custom"!==e.type&&t.push(e.serialize())}return t}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasTransitions(){if(this.hasLightTransitions())return!0;if(this.hasFogTransition())return!0;for(const e in this._sourceCaches)if(this._sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}isLayerDraped(e){return!!this.terrain&&e.isDraped(this.getLayerSourceCache(e))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const i=this.getOwnLayer(t);if(i)return i;this.fire(new e.f(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const i=this.getOwnSource(t);if(i)return i;this.fire(new e.f(new Error(`The source '${t}' does not exist in the map's style.`)))}precompilePrograms(e,t){const i=this.map.painter;if(i)for(let r=e.minzoom||0;r<(e.maxzoom||25.5);r++){const r=e.getProgramIds();if(r)for(const n of r){const r=e.getDefaultProgramParams(n,t.zoom,this._styleColorTheme.lut);r&&(i.style=this,this.fog&&(i._fogVisible=!0,r.overrideFog=!0,i.getOrCreateProgram(n,r)),i._fogVisible=!1,r.overrideFog=!1,i.getOrCreateProgram(n,r),(this.stylesheet.terrain||this.stylesheet.projection&&"globe"===this.stylesheet.projection.name)&&(r.overrideRtt=!0,i.getOrCreateProgram(n,r)))}}}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const i=this.calculateLightsBrightness();t.brightness=i||0,i!==this._brightness&&(this._brightness=i,this.dispatcher.broadcast("setBrightness",i));const r=this._changes.isDirty();let n=!1;if(this._changes.isDirty()){const e=this._changes.getLayerUpdatesByScope();for(const t in e){const{updatedIds:i,removedIds:r}=e[t];(i||r)&&(this._updateWorkerLayers(t,i,r),n=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this._changes.reset()}const o={};for(const e in this._mergedSourceCaches){const t=this._mergedSourceCaches[e];o[e]=t.used,t.used=!1,t.tileCoverLift=0}for(const e of this._mergedOrder){const i=this._mergedLayers[e];if(i.recalculate(t,this._availableImages),!i.isHidden(t.zoom)){const e=this.getLayerSourceCache(i);e&&(e.used=!0,e.tileCoverLift=Math.max(e.tileCoverLift,i.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback((()=>{this.precompilePrograms(i,t)})):this.precompilePrograms(i,t))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&n&&this.mergeLayers();for(const t in o){const i=this._mergedSourceCaches[t];o[t]!==i.used&&i.getSource().fire(new e.g("data",{sourceDataType:"visibility",dataType:"source",sourceId:i.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.z=t.zoom,this._markersNeedU
1pdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),r&&this.fire(new e.g("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=this._changes.getUpdatedImages();if(e.length){for(const t in this._sourceCaches)this._sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changes.resetUpdatedImages()}}_updateWorkerLayers(e,t,i){const r=this.getFragmentStyle(e);r&&this.dispatcher.broadcast("updateLayers",{layers:t?r._serializeLayers(t):[],scope:e,removedIds:i||[],options:r.options})}setState(t,i){if(this._checkLoaded(),To(this,ze(t)))return!1;(t=e.cW(t)).layers=Dn(t.layers);const r=function(t,i){if(!t)return[{command:Fn.setStyle,args:[i]}];let r=[];try{if(!e.d(t.version,i.version))return[{command:Fn.setStyle,args:[i]}];if(e.d(t.center,i.center)||r.push({command:Fn.setCenter,args:[i.center]}),e.d(t.zoom,i.zoom)||r.push({command:Fn.setZoom,args:[i.zoom]}),e.d(t.bearing,i.bearing)||r.push({command:Fn.setBearing,args:[i.bearing]}),e.d(t.pitch,i.pitch)||r.push({command:Fn.setPitch,args:[i.pitch]}),e.d(t.sprite,i.sprite)||r.push({command:Fn.setSprite,args:[i.sprite]}),e.d(t.glyphs,i.glyphs)||r.push({command:Fn.setGlyphs,args:[i.glyphs]}),e.d(t.imports,i.imports)||function(t=[],i=[],r){i=i||[];const n=(t=t||[]).map($n),o=i.map($n),s=t.reduce(Gn,{}),a=i.reduce(Gn,{}),l=n.slice();let c,u,h,p;for(c=0,u=0;c<n.length;c++)h=n[c],a.hasOwnProperty(h)?u++:(r.push({command:Fn.removeImport,args:[h]}),l.splice(l.indexOf(h,u),1));for(c=0,u=0;c<o.length;c++)h=o[o.length-1-c],l[l.length-1-c]!==h&&(s.hasOwnProperty(h)?(r.push({command:Fn.removeImport,args:[h]}),l.splice(l.lastIndexOf(h,l.length-u),1)):u++,p=l[l.length-c],r.push({command:Fn.addImport,args:[a[h],p]}),l.splice(l.length-c,0,h));for(const t of i){const i=s[t.id];i&&!e.d(i,t)&&r.push({command:Fn.updateImport,args:[t.id,t]})}}(t.imports,i.imports,r),e.d(t.transition,i.transition)||r.push({command:Fn.setTransition,args:[i.transition]}),e.d(t.light,i.light)||r.push({command:Fn.setLight,args:[i.light]}),e.d(t.fog,i.fog)||r.push({command:Fn.setFog,args:[i.fog]}),e.d(t.projection,i.projection)||r.push({command:Fn.setProjection,args:[i.projection]}),e.d(t.lights,i.lights)||r.push({command:Fn.setLights,args:[i.lights]}),e.d(t.camera,i.camera)||r.push({command:Fn.setCamera,args:[i.camera]}),!e.d(t["color-theme"],i["color-theme"]))return[{command:Fn.setStyle,args:[i]}];const n={},o=[];!function(t,i,r,n){let o;for(o in i=i||{},t=t||{})t.hasOwnProperty(o)&&(i.hasOwnProperty(o)||Nn(o,r,n));for(o in i){if(!i.hasOwnProperty(o))continue;const s=i[o];t.hasOwnProperty(o)?e.d(t[o],s)||("geojson"===t[o].type&&"geojson"===s.type&&Un(t,i,o)?r.push({command:Fn.setGeoJSONSourceData,args:[o,s.data]}):jn(o,i,r,n)):Bn(o,i,r)}}(t.sources,i.sources,o,n);const s=[];t.layers&&t.layers.forEach((e=>{e.source&&n[e.source]?r.push({command:Fn.removeLayer,args:[e.id]}):s.push(e)}));let a=t.terrain;a&&n[a.source]&&(r.push({command:Fn.setTerrain,args:[void 0]}),a=void 0),r=r.concat(o),e.d(a,i.terrain)||r.push({command:Fn.setTerrain,args:[i.terrain]}),function(t,i,r){i=i||[];const n=(t=t||[]).map($n),o=i.map($n),s=t.reduce(Gn,{}),a=i.reduce(Gn,{}),l=n.slice(),c=Object.create(null);let u,h,p,d,f,m,_;for(u=0,h=0;u<n.length;u++)p=n[u],a.hasOwnProperty(p)?h++:(r.push({command:Fn.removeLayer,args:[p]}),l.splice(l.indexOf(p,h),1));for(u=0,h=0;u<o.length;u++)p=o[o.length-1-u],l[l.length-1-u]!==p&&(s.hasOwnProperty(p)?(r.push({command:Fn.removeLayer,args:[p]}),l.splice(l.lastIndexOf(p,l.length-h),1)):h++,m=l[l.length-u],r.push({command:Fn.addLayer,args:[a[p],m]}),l.splice(l.length-u,0,p),c[p]=!0);for(u=0;u<o.length;u++)if(p=o[u],d=s[p],f=a[p],!c[p]&&!e.d(d,f))if(e.d(d.source,f.source)&&e.d(d["source-layer"],f["source-layer"])&&e.d(d.type,f.type)){for(_ in Vn(d.layout,f.layout,r,p,null,Fn.setLayoutProperty),Vn(d.paint,f.paint,r,p,null,Fn.setPaintProperty),e.d(d.slot,f.slot)||r.push({command:Fn.setSlot,args:[p,f.slot]}),e.d(d.filter,f.filter)||r.push({command:Fn.setFilter,args:[p,f.filter]}),e.d(d.minzoom,f.minzoom)&&e.d(d.maxzoom,f.maxzoom)||r.push({command:Fn.setLayerZoomRange,args:[p,f.minzoom,f.maxzoom]}),d)d.hasOwnProperty(_)&&"layout"!==_&&"paint"!==_&&"filter"!==_&&"metadata"!==_&&"minzoom"!==_&&"maxzoom"!==_&&"slot"!==_&&(0===_.indexOf("paint.")?Vn(d[_],f[_],r,p,_.slice(6),Fn.setPaintProperty):e.d(d[_],f[_])||r.push({command:Fn.setLayerProperty,args:[p,_,f[_]]}));for(_ in f)f.hasOwnProperty(_)&&!d.hasOwnProperty(_)&&"layout"!==_&&"paint"!==_&&"filter"!==_&&"metadata"!==_&&"minzoom"!==_&&"maxzoom"!==_&&"slot"!==_&&(0===_.indexOf("paint.")?Vn(d[_],f[_],r,p,_.slice(6),Fn.setPaintProperty):e.d(d[_],f[_])||r.push({command:Fn.setLayerProperty,args:[p,_,f[_]]}))}else r.push({command:Fn.removeLayer,args:[p]}),m=l[l.lastIndexOf(p)+1],r.push({command:Fn.addLayer,args:[f,m]})}(s,i.layers,r)}catch(e){console.warn("Unable to compute style diff:",e),r=[{command:Fn.setStyle,args:[i]}]}return r}(this.serialize(),t).filter((e=>!(e.command in Eo)));if(0===r.length)return!1;const n=r.filter((e=>!(e.command in Mo)));if(n.length>0)throw new Error(`Unimplemented: ${n.map((e=>e.command)).join(", ")}.`);const o=[];return r.forEach((e=>{o.push(this[e.command].apply(this,e.args))})),i&&Promise.all(o).then(i),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}addImage(t,i){return this.getImage(t)?this.fire(new e.f(new Error("An image with this name already exists."))):(this.imageManager.addImage(t,this.scope,i),this._afterImageUpdated(t),this)}updateImage(e,t){this.imageManager.updateImage(e,this.scope,t)}getImage(e){return this.imageManager.getImage(e,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._afterImageUpdated(t),this):this.fire(new e.f(new Error("No image with this name exists.")))}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(this.scope),this._changes.updateImage(t),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.fire(new e.g("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(e,t,i={}
1){return this._checkLoaded(),this._validate(Ge,`models.${e}`,t,null,i)||(this.modelManager.addModel(e,t,this.scope),this._changes.setDirty()),this}hasModel(e){return this.modelManager.hasModel(e,this.scope)}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.scope),this):this.fire(new e.f(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(t,i,r={}){if(this._checkLoaded(),void 0!==this.getOwnSource(t))throw new Error(`There is already a source with ID "${t}".`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(Oe,`sources.${t}`,i,null,r))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const n=ki(t,i,this.dispatcher,this);n.scope=this.scope,n.setEventedParent(this,(()=>({isSourceLoaded:this._isSourceCacheLoaded(n.id),source:n.serialize(),sourceId:n.id})));const o=t=>{const i=(t?"symbol:":"other:")+n.id,r=e.am(i,this.scope),o=this._sourceCaches[i]=new e.bx(r,n,t);(t?this._symbolSourceCaches:this._otherSourceCaches)[n.id]=o,o.onAdd(this.map)};o(!1),"vector"!==i.type&&"geojson"!==i.type||o(!0),n.onAdd&&n.onAdd(this.map),r.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const i=this.getOwnSource(t);if(!i)throw new Error("There is no source with this ID");for(const i in this._layers)if(this._layers[i].source===t)return this.fire(new e.f(new Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new e.f(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));const r=this.getOwnSourceCaches(t);for(const t of r){const i=e.cX(t.id);delete this._sourceCaches[i],this._changes.discardSourceCacheUpdate(t.id),t.fire(new e.g("data",{sourceDataType:"metadata",dataType:"source",sourceId:t.getSource().id})),t.setEventedParent(null),t.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),i.setEventedParent(null),i.onRemove&&i.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(e,t){this._checkLoaded(),this.getOwnSource(e).setData(t),this._changes.setDirty()}getOwnSource(e){const t=this.getOwnSourceCache(e);return t&&t.getSource()}getOwnSources(){const e=[];for(const t in this._otherSourceCaches){const i=this.getOwnSourceCache(t);i&&e.push(i.getSource())}return e}areTilesLoaded(){const e=this._mergedSourceCaches;for(const t in e){const i=e[t]._tiles;for(const e in i){const t=i[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const i=this._getTransitionParameters();for(const r of t){if(this._validate(Fe,"lights",r))return;switch(r.type){case"ambient":if(this.ambientLight){const e=this.ambientLight;e.set(r),e.updateTransitions(i)}else this.ambientLight=new st(r,at||(at=new e.U({color:new e.W(e.N.properties_light_ambient.color),intensity:new e.W(e.N.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const e=this.directionalLight;e.set(r),e.updateTransitions(i)}else this.directionalLight=new st(r,lt||(lt=new e.U({direction:new e.a6(e.N.properties_light_directional.direction),color:new e.W(e.N.properties_light_directional.color),intensity:new e.W(e.N.properties_light_directional.intensity),"cast-shadows":new e.W(e.N.properties_light_directional["cast-shadows"]),"shadow-intensity":new e.W(e.N.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const r=new e.Y(this.z||0,i);this.ambientLight&&this.ambientLight.recalculate(r),this.directionalLight&&this.directionalLight.recalculate(r),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,i=this.ambientLight;if(!t||!i)return;const r=e=>.2126*(e[0]<=.03928?e[0]/12.92:Math.pow((e[0]+.055)/1.055,2.4))+.7152*(e[1]<=.03928?e[1]/12.92:Math.pow((e[1]+.055)/1.055,2.4))+.0722*(e[2]<=.03928?e[2]/12.92:Math.pow((e[2]+.055)/1.055,2.4)),n=t.properties.get("color").toRenderColor(null).toArray01(),o=t.properties.get("intensity"),s=t.properties.get("direction"),a=1-e.ad(s.x,s.y,s.z)[2]/90,l=r(n)*o*a,c=i.properties.get("color").toRenderColor(null).toArray01(),u=i.properties.get("intensity");return(l+r(c)*u)/2}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const e=[];return this.directionalLight&&e.push(this.directionalLight.get()),this.ambientLight&&e.push(this.ambientLight.get()),e}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(!t)return this;if(e.cY(t)){const i=e.cZ(t),r=this.fragments.find((({id:e})=>e===i));if(!r)throw new Error(`Style import not found: ${t}`);const n=e.cX(t);return r.style.getFragmentStyle(n)}{const e=this.fragments.find((({id:e})=>e===t));if(!e)throw new Error(`Style import not found: ${t}`);return e.style}}getConfigProperty(t,i){const r=this.getFragmentStyle(t);if(!r)return null;const n=e.am(i,r.scope),o=r.options.get(n),s=o?o.value||o.default:null;return s?s.serialize():null}setConfigProperty(t,i,r){const n=this.getFragmentStyle(t);if(!n)return;const o=n.stylesheet.schema;if(!o||!o[i])return;const s=e.z(r);if("success"!==s.result)return void To(this,s.value);const a=s.value.expression,l=e.am(i,n.scope),c=n.options.get(l);if(!c)return;let u;const{minValue:h,maxValue:p,stepValue:d,type:f,values:m}=o[i],_=e.z(o[i].default);"success"===_.result&&(u=_.value.expression),u?(this.options.set(l,{...c,value:a,default:u,minValue:h,maxValue:p,stepValue:d,type:f,values:m}),this.updateConfigDependencies(i)):this.fire(new e.f(new Error(`No schema defined for the config option "${i}" in the "${t}" fragment.`)))}getConfig(t){const i=this.getFragmentStyle(t);if(!i)return null;const r=i.stylesheet.schema;if(!r)return null;const n={};
1for(const t in r){const r=e.am(t,i.scope),o=i.options.get(r),s=o?o.value||o.default:null;n[t]=s?s.serialize():null}return n}setConfig(e,t){const i=this.getFragmentStyle(e);i&&(i.updateConfig(t,i.stylesheet.schema),this.updateConfigDependencies())}getSchema(e){const t=this.getFragmentStyle(e);return t?t.stylesheet.schema:null}setSchema(e,t){const i=this.getFragmentStyle(e);i&&(i.stylesheet.schema=t,i.updateConfig(i._config,t),this.updateConfigDependencies())}updateConfig(t,i){if(this._config=t,t||i)if(i)for(const r in i){let n,o;const s=e.z(i[r].default);if("success"===s.result&&(n=s.value.expression),t&&void 0!==t[r]){const i=e.z(t[r]);"success"===i.result&&(o=i.value.expression)}const{minValue:a,maxValue:l,stepValue:c,type:u,values:h}=i[r];if(n){const t=e.am(r,this.scope);this.options.set(t,{default:n,value:o,minValue:a,maxValue:l,stepValue:c,type:u,values:h})}else this.fire(new e.f(new Error(`No schema defined for config option "${r}".`)))}else this.fire(new e.f(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(e){for(const t of this._configDependentLayers){const i=this.getLayer(t);if(i){if(e&&!i.configDependencies.has(e))continue;i.possiblyEvaluateVisibility(),this._updateLayer(i)}}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.forEachFragmentStyle((e=>{if(e._styleColorTheme.colorTheme){const t=e._evaluateColorThemeData(e._styleColorTheme.colorTheme);(!e._styleColorTheme.lut&&""!==t||e._styleColorTheme.lut&&t!==e._styleColorTheme.lut.data)&&e.setColorTheme(e._styleColorTheme.colorTheme)}})),this._changes.setDirty()}addLayer(t,i,r={}){this._checkLoaded();const n=t.id;if(this._layers[n])return void this.fire(new e.f(new Error(`Layer with i
1d "${n}" already exists on this map`)));let o;if("custom"===t.type){if(To(this,e.c_(t)))return;o=e.c$(t,this.scope,this._styleColorTheme.lut,this.options)}else{if("object"==typeof t.source&&(this.addSource(n,t.source),t=e.cW(t),t=e.Q(t,{source:n})),this._validate(je,`layers.${n}`,t,{arrayIndex:-1},r))return;o=e.c$(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(o),o.setEventedParent(this,{layer:{id:n}}),this._serializedLayers[o.id]=o.serialize()}0!==o.configDependencies.size&&this._configDependentLayers.add(o.fqid);let s=this._order.length;if(i){const t=this._order.indexOf(i);if(-1===t)return void this.fire(new e.f(new Error(`Layer with id "${i}" does not exist on this map.`)));o.slot===this._layers[i].slot?s=t:e.w(`Layer with id "${i}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(s,0,n),this._layerOrderChanged=!0,this._layers[n]=o;const a=this.getOwnLayerSourceCache(o),l=!!this.directionalLight&&this.directionalLight.shadowsEnabled();a&&o.canCastShadows()&&l&&(a.castsShadows=!0);const c=this._changes.getRemovedLayer(o);if(c&&o.source&&a&&"custom"!==o.type){this._changes.discardLayerRemoval(o);const t=e.am(o.source,o.scope);c.type!==o.type?this._changes.updateSourceCache(t,"clear"):(this._changes.updateSourceCache(t,"reload"),a.pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map),o.scope=this.scope,this.mergeLayers()}moveLayer(t,i){this._checkLoaded();const r=this._checkLayer(t);if(!r)return;if(t===i)return;const n=this._order.indexOf(t);this._order.splice(n,1);let o=this._order.length;if(i){const t=this._order.indexOf(i);
1if(-1===t)return void this.fire(new e.f(new Error(`Layer with id "${i}" does not exist on this map.`)));r.slot===this._layers[i].slot?o=t:e.w(`Layer with id "${i}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(o,0,t),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(e){this._checkLoaded();const t=this._checkLayer(e);if(!t)return;t.setEventedParent(null);const i=this._order.indexOf(e);this._order.splice(i,1),delete this._layers[e],delete this._serializedLayers[e],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(t.fqid),this._changes.removeLayer(t);const r=this.getOwnLayerSourceCache(t);if(r&&r.castsShadows){let e=!1;for(const i in this._layers)if(this._layers[i].source===t.source&&this._layers[i].canCastShadows()){e=!0;break}r.castsShadows=e}t.onRemove&&t.onRemove(this.map),this.mergeLayers()}getOwnLayer(e){return this._layers[e]}hasLayer(e){return e in this._mergedLayers}hasLayerType(e){for(const t in this._layers)if(this._layers[t].type===e)return!0;return!1}setLayerZoomRange(e,t,i){this._checkLoaded();const r=this._checkLayer(e);r&&(r.minzoom===t&&r.maxzoom===i||(null!=t&&(r.minzoom=t),null!=i&&(r.maxzoom=i),this._updateLayer(r)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(e,t){this._checkLoaded();const i=this._checkLayer(e);i&&i.slot!==t&&(i.slot=t,this._updateLayer(i))}setFilter(t,i,r={}){this._checkLoaded();const n=this._checkLayer(t);if(n&&!e.d(n.filter,i))return null==i?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(Ue,`layers.${n.id}.filter`,i,{layerType:n.type},r)||(n.filter=e.cW(i),this._updateLayer(n)))}getFilter(t){const i=this._checkLayer(t);if(i)return e.cW(i.filter)}setLayoutProperty(t,i,r,n={}){this._checkLoaded();const o=this._checkLayer(t);if(o&&!e.d(o.getLayoutProperty(i),r)){if(null!=r&&(!n||!1!==n.validate)&&To(o,$e.call(ze,{key:`layers.${t}.layout.${i}`,layerType:o.type,objectKey:i,value:r,styleSpec:e.N,style:{glyphs:!0,sprite:!0}})))return;o.setLayoutProperty(i,r),0!==o.configDependencies.size&&this._configDependentLayers.add(o.fqid),this._updateLayer(o)}}getLayoutProperty(e,t){const i=this._checkLayer(e);if(i)return i.getLayoutProperty(t)}setPaintProperty(t,i,r,n={}){this._checkLoaded();const o=this._checkLayer(t);if(!o)return;if(e.d(o.getPaintProperty(i),r))return;if(null!=r&&(!n||!1!==n.validate)&&To(o,Ve.call(ze,{key:`layers.${t}.paint.${i}`,layerType:o.type,objectKey:i,value:r,styleSpec:e.N})))return;const s=o.setPaintProperty(i,r);0!==o.configDependencies.size&&this._configDependentLayers.add(o.fqid),s&&this._updateLayer(o),this._changes.updatePaintProperties(o)}getPaintProperty(e,t){const i=this._checkLayer(e);if(i)return i.getPaintProperty(t)}setFeatureState(t,i){this._checkLoaded();const r=t.source,n=t.sourceLayer,o=this._checkSource(r);if(!o)return;const s=o.type;if("geojson"===s&&n)return void this.fire(new e.f(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===s&&!n)return void this.fire(new e.f(new Error("The sourceLayer parameter must be provided for vector source types.")));void 0===t.id&&this.fire(new e.f(new Error("The feature id parameter must be provided.")));const a=this.getOwnSourceCaches(r);for(const e of a)e.setFeatureState(n,t.id,i)}removeFeatureState(t,i){this._checkLoaded();const r=t.source,n=this._checkSource(r);if(!n)return;const o=n.type,s="vector"===o?t.sourceLayer:void 0;if("vector"===o&&!s)return void this.fire(new e.f(new Error("The sourceLayer parameter must be provided for vector source types.")));if(i&&"string"!=typeof t.id&&"number"!=typeof t.id)return void this.fire(new e.f(new Error("A feature id is required to remove its specific state property.")));const a=this.getOwnSourceCaches(r);for(const e of a)e.removeFeatureState(s,t.id,i)}getFeatureState(t){this._checkLoaded();const i=t.source,r=t.sourceLayer,n=this._checkSource(i);if(n){if("vector"!==n.type||r)return void 0===t.id&&this.fire(new e.f(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(i)[0].getFeatureState(r,t.id);this.fire(new e.f(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=e.Q({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return e.Q({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),i=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return e.d0({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:i,fog:this.stylesheet.fog,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},(e=>void 0!==e))}_updateLayer(t){this._changes.updateLayer(t);const i=this.getLayerSourceCache(t),r=e.am(t.source,t.scope),n=this._changes.getUpd
1atedSourceCaches();t.source&&!n[r]&&i&&"raster"!==i.getSource().type&&(this._changes.updateSourceCache(r,"reload"),i.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(e){const t=e=>"fill-extrusion"===this._mergedLayers[e].type||"model"===this._mergedLayers[e].type,i=this.order,r={},n=[];for(let o=i.length-1;o>=0;o--){const s=i[o];if(t(s)){r[s]=o;for(const t of e){const e=t[s];if(e)for(const t of e)n.push(t)}}}n.sort(((e,t)=>t.intersectionZ-e.intersectionZ));const o=[];for(let s=i.length-1;s>=0;s--){const a=i[s];if(t(a))for(let e=n.length-1;e>=0;e--){const t=n[e].feature;if(t.layer&&r[t.layer.id]<s)break;o.push(t),n.pop()}else for(const t of e){const e=t[a];if(e)for(const t of e)o.push(t.feature)}}return o}queryRenderedFeatures(t,i,r){i&&i.filter&&this._validate(Ue,"queryRenderedFeatures.filter",i.filter,null,i),i.scope=this.scope,i.availableImages=this._availableImages,i.serializedLayers=this._serializedLayers;const n={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new e.f(new Error("parameters.layers must be an Array."))),[];for(const t of i.layers){const i=this._mergedLayers[t];if(!i)return this.fire(new e.f(new Error(`The layer '${t}' does not exist in the map's style and cannot be queried for features.`))),[];n[i.source]=!0}}const o=[],s=i.serializedLayers||{},a=i&&i.layers?i.layers.some((e=>{const t=this.getLayer(e);return t&&t.is3D()})):this.has3DLayers(),l=Sn.createFromScreenPoints(t,r);for(const e in this._mergedSourceCaches){const t=this._mergedSourceCaches[e].getSource();if(!t||t.scope!==i.scope)continue;const c=this._mergedSourceCaches[e].getSource().id;i.layers&&!n[c]||o.push(Ln(this._mergedSourceCaches[e],this._mergedLayers,s,l,i,r,a,!!this.map._showQueryGeometry))}return this.placement&&o.push(function(e,t,i,r,n,o,s){const a={},l=o.queryRenderedSymbols(r),c=[];for(const e of Object.keys(l).map(Number))c.push(s[e]);c.sort(Rn);for(const i of c){const r=i.featureIndex.lookupSymbolFeatures(l[i.bucketInstanceId],t,i.bucketIndex,i.sourceLayerIndex,n.filter,n.layers,n.availableImages,e);for(const e in r){const t=a[e]=a[e]||[],n=r[e];n.sort(((e,t)=>{const r=i.featureSortOrder;if(r){const i=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-i}return t.featureIndex-e.featureIndex}));for(const e of n)t.push(e)}}for(const t in a)a[t].forEach((r=>{const n=r.feature,o=i(e[t]);if(!o)return;const s=o.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=s}));return a}(this._mergedLayers,s,this.getLayerSourceCache.bind(this),l.screenGeometry,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,t){t&&t.filter&&this._validate(Ue,"querySourceFeatures.filter",t.filter,null,t);const i=this.getOwnSourceCaches(e);let r=[];for(const e of i)r=r.concat(Pn(e,t));return r}addSourceType(e,t,i){return Ao.getSourceType(e)?i(new Error(`A source type called "${e}" already exists.`)):(Ao.setSourceType(e,t),t.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:t.workerSourceURL},i):i(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,i,r={}){this._checkLoaded();const n=this.light.getLight();let o=!1;for(const i in t)if(!e.d(t[i],n[i])){o=!0;break}if(!o)return;const s=this._getTransitionParameters();this.light.setLight(t,i,r),this.light.updateTransitions(s)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){void 0===this.disableElevatedTerrain&&(this.disableElevatedTerrain=e.e.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&e.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,i=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),0===i&&delete this.terrain,null===t?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedU
1pdate=!0);this.checkCanvasFingerprintNoise();let r=t;const n=null==t.source;if(1===i){if(this.disableElevatedTerrain)return;if("object"==typeof r.source){const t="terrain-dem-src";this.addSource(t,r.source),r=e.cW(r),r=e.Q(r,{source:t})}const t=e.Q({},r),i={};if(this.terrain&&n){t.source=this.terrain.get().source;const e=this.terrain?this.getFragmentStyle(this.terrain.scope):null;e&&(i.style=e.serialize())}if(this._validate(Be,"terrain",t,i))return}if(!this.terrain||this.terrain.scope!==this.scope&&!n||this.terrain&&i!==this.terrain.drapeRenderMode){if(!r)return;this._createTerrain(r,i),this.fire(new e.g("data",{dataType:"style"}))}else{const i=this.terrain,n=i.get();for(const t of Object.keys(e.N.terrain))!r.hasOwnProperty(t)&&e.N.terrain[t].default&&(r[t]=e.N.terrain[t].default);for(const r in t)if(!e.d(t[r],n[r])){i.set(t,this.options),this.stylesheet.terrain=t;const r=this._getTransitionParameters({duration:0});i.updateTransitions(r),this.fire(new e.g("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(e){const t=this.fog=new ot(e,this.map.transform,this.scope,this.options);this.stylesheet.fog=t.get();const i=this._getTransitionParameters({duration:0});t.updateTransitions(i)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask((()=>{for(const e of this.map._markers)e._evaluateOpacity()}))}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const i=this.fog;if(!e.d(i.get(),t)){i.set(t,this.options),this.stylesheet.fog=i.get();const e=this._getTransitionParameters({duration:0});i.updateTransitions(e)}}else this._createFog(t);this._markersNeedUpdate=!0}setColorTheme(t){this._checkLoaded();const i=()=>{for(const e in this._layers)this._layers[e].lut=this._styleColorTheme.lut;for(const e in this._sourceCaches)this._sourceCaches[e].clearTiles()};if(this._styleColorTheme.colorTheme=t,!t)return this._styleColorTheme.lut=null,void i();const r=this._evaluateColorThemeData(t);this._loadColorTheme(r).then((()=>{this.fire(new e.g("colorthemeset")),i()})).catch((t=>{e.w(`Couldn't set color theme: ${t}`)}))}_getTransitionParameters(t){return{now:e.e.now(),transition:e.Q(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const e=[],t=[];for(const i of this._mergedOrder)this.isLayerDraped(this._mergedLayers[i])?e.push(i):t.push(i);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...e),this._drapedFirstOrder.push(...t)}_createTerrain(e,t){const i=this.terrain=new Qe(e,t,this.scope,this.options);1===t&&(this.stylesheet.terrain=e),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const r=this._getTransitionParameters({duration:0});i.updateTransitions(r)}_force3DLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"fill-extrusion"===t.type&&this._updateLayer(t)}}_forceSymbolLayerUpdate(){for(const e in this._layers){const t=this._layers[e];"symbol"===t.type&&this._updateLayer(t)}}_validate(t,i,r,n,o={}){if(o&&!1===o.validate)return!1;const s=e.Q({},this.serialize());return To(this,t.call(ze,e.Q({key:i,style:s,value:r,styleSpec:e.N},n)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.d1.off("pluginStateChange",this._rtlTextPluginCallback);for(const e in this._mergedLayers)this._mergedLayers[e].setEventedParent(null);for(const e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles(),this._mergedSourceCaches[e].setEventedParent(null);this.setEventedParent(null),delete this.fog,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.dispatcher.remove())}clearSource(e){const t=this.getSourceCaches(e);for(const e of t)e.clearTiles()}clearSources(){for(const e in this._mergedSourceCaches)this._mergedSourceCaches[e].clearTiles()}reloadSource(e){const t=this.getSourceCaches(e);for(const e of t)e.resume(),e.reload()}
1reloadSources(){for(const e of this.getSources())e.reload&&e.reload()}updateSources(e){let t;this.directionalLight&&(t=yi(this.directionalLight));for(const i in this._mergedSourceCaches)this._mergedSourceCaches[i].update(e,void 0,void 0,t)}_generateCollisionBoxes(){for(const e in this._sourceCaches){const t=this._sourceCaches[e];t.resume(),t.reload()}}_updatePlacement(t,i,r,n,o,s,a=!1){let l=!1,c=!1;const u={},h={};for(const t of this._mergedOrder){const r=this._mergedLayers[t];if("symbol"!==r.type)continue;const n=e.am(r.source,r.scope);let o=u[n];if(!o){const e=this.getLayerSourceCache(r);if(!e)continue;const t=e.getRenderableIds(!0).map((t=>e.getTileByID(t)));h[n]=t.slice(),o=u[n]=t.sort(((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)))}const s=this.crossTileSymbolIndex.addLayer(r,o,i.center.lng,i.projection);l=l||s}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),a=a||this._layerOrderChanged||0===n,this._layerOrderChanged&&this.fire(new e.g("neworder")),(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.e.now(),i.zoom))&&(this.pauseablePlacement=new _o(i,this._mergedOrder,a,r,n,o,this.placement,this.fog&&i.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,u,h),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.e.now()),c=!0),l&&this.pauseablePlacement.placement.setStale()),c||l){this._buildingIndex.onNewFrame(i.zoom);for(let t=0;t<this._mergedOrder.length;t++){const i=this._mergedLayers[this._mergedOrder[t]];if("symbol"!==i.type)continue;const r=this.isLayerClipped(i)&&this._clipLayerIndices.some((e=>t<e));this.placement.updateLayerOpacities(i,u[e.am(i.source,i.scope)],t,r?s:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(e.e.now())}}_releaseSymbolFadeTiles(){for(const e in this._sourceCaches)this._sourceCaches[e].releaseSymbolFadeTiles()}addImport(t,i){this._checkLoaded();const r=this.stylesheet.imports=this.stylesheet.imports||[];if(-1!==r.findIndex((({id:e})=>e===t.id)))return void this.fire(new e.f(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!i)return r.push(t),this._loadImports([t],!0);const n=r.findIndex((({id:e})=>e===i));return-1===n&&this.fire(new e.f(new Error(`Import with id "${i}" does not exist on this map.`))),this.stylesheet.imports=r.slice(0,n).concat(t).concat(r.slice(n)),this._loadImports([t],!0,i)}updateImport(t,i){this._checkLoaded();const r=this.stylesheet.imports||[],n=this.getImportIndex(t);return-1===n?this:"string"==typeof i?(this.setImportUrl(t,i),this):(i.url&&i.url!==r[n].url&&this.setImportUrl(t,i.url),e.d(i.config,r[n].config)||this.setImportConfig(t,i.config),e.d(i.data,r[n].data)||this.setImportData(t,i.data),this)}moveImport(e,t){this._checkLoaded();let i=this.stylesheet.imports||[];const r=this.getImportIndex(e);if(-1===r)return this;const n=this.getImportIndex(t);if(-1===n)return this;const o=i[r],s=this.fragments[r];return i=i.filter((({id:t})=>t!==e)),this.fragments=this.fragments.filter((({id:t})=>t!==e)),this.stylesheet.imports=i.slice(0,n).concat(o).concat(i.slice(n)),this.fragments=this.fragments.slice(0,n).concat(s).concat(this.fragments.slice(n)),this.mergeLayers(),this}setImportUrl(e,t){this._checkLoaded();const i=this.stylesheet.imports||[],r=this.getImportIndex(e);if(-1===r)return this;i[r].url=t;const n=this.fragments[r];return n.style=this._createFragmentStyle(i[r]),n.style.on("style.import.load",(()=>this.mergeAll())),n.style.loadURL(t),this}setImportData(e,t){this._checkLoaded();const i=this.getImportIndex(e),r=this.stylesheet.imports||[];return-1===i?this:t?(this.fragments[i].style.setState(t),this._reloadImports(),this):(delete r[i].data,this.setImportUrl(e,r[i].url))}setImportConfig(e,t){this._checkLoaded();const i=this.getImportIndex(e),r=this.stylesheet.imports||[];if(-1===i)return this;
1t?r[i].config=t:delete r[i].config;const n=this.fragments[i],o=n.style.stylesheet&&n.style.stylesheet.schema;return n.config=t,n.style.updateConfig(t,o),this.updateConfigDependencies(),this}removeImport(e){this._checkLoaded();const t=this.stylesheet.imports||[],i=this.getImportIndex(e);-1!==i&&(t.splice(i,1),this.fragments[i].style._remove(),this.fragments.splice(i,1),this._reloadImports())}getImportIndex(t){const i=(this.stylesheet.imports||[]).findIndex((e=>e.id===t));return-1===i&&this.fire(new e.f(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),i}getLayer(e){return this._mergedLayers[e]}getSources(){const e=[];for(const t in this._mergedOtherSourceCaches){const i=this._mergedOtherSourceCaches[t];i&&e.push(i.getSource())}return e}getSource(e,t){const i=this.getSourceCache(e,t);return i&&i.getSource()}getLayerSource(e){const t=this.getLayerSourceCache(e);return t&&t.getSource()}getSourceCache(t,i){const r=e.am(t,i);return this._mergedOtherSourceCaches[r]}getLayerSourceCache(t){const i=e.am(t.source,t.scope);return"symbol"===t.type?this._mergedSymbolSourceCaches[i]:this._mergedOtherSourceCaches[i]}getSourceCaches(e){if(null==e)return Object.values(this._mergedSourceCaches);const t=[];return this._mergedOtherSourceCaches[e]&&t.push(this._mergedOtherSourceCaches[e]),this._mergedSymbolSourceCaches[e]&&t.push(this._mergedSymbolSourceCaches[e]),t}updateSourceCaches(){const e=this._changes.getUpdatedSourceCaches();for(const t in e){const i=e[t];"reload"===i?this.reloadSource(t):"clear"===i&&this.clearSource(t)}}updateLayers(e){const t=this._changes.getUpdatedPaintProperties();for(const i of t){const t=this.getLayer(i);t&&t.updateTransitions(e)}}getImages(e,t,i){this.imageManager.getImages(t.icons,t.scope,i),this._updateTilesForChangedImages();const r=e=>{e&&e.setDependencies(t.tileID.key,t.type,t.icons)};r(this._otherSourceCaches[t.source]),r(this._symbolSourceCaches[t.source])}getGlyphs(e,t,i){this.glyphManager.getGlyphs(t.stacks,t.scope,i)}getResource(t,i,r){return e.d2(i,r)}getOwnSourceCache(e){return this._otherSourceCaches[e]}getOwnLayerSourceCache(e){return"symbol"===e.type?this._symbolSourceCaches[e.source]:this._otherSourceCaches[e.source]}getOwnSourceCaches(e){const t=[];return this._otherSourceCaches[e]&&t.push(this._otherSourceCaches[e]),this._symbolSourceCaches[e]&&t.push(this._symbolSourceCaches[e]),t}_isSourceCacheLoaded(t){const i=this.getOwnSourceCaches(t);return 0===i.length?(this.fire(new e.f(new Error(`There is no source with ID '${t}'`))),!1):i.every((e=>e.loaded()))}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(t,i){if(0===this._clipLayerIndices.length&&"fill-extrusion"!==t.type)return!1;const r="fill-extrusion"===t.type&&"building"===t.sourceLayer;let n=0;if(t.is3D()){if(r||i&&"batched-model"===i.type)return!0;"model"===t.type&&(n=e.cw.Model)}else"symbol"===t.type&&(n=e.cw.Symbol);for(const t of this._clipLayerIndices){const i=this._mergedLayers[this._mergedOrder[t]];if(!i)continue;const r=[];for(const t of i.layout.get("clip-layer-types"))r.push("model"===t?e.cw.Model:"symbol"===t?e.cw.Symbol:e.cw.FillExtrusion);for(const e of r)if(n&e)return!0}return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach((e=>{e.style._remove()})),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}function Io(e,t){let i=!1,r=null;const n=()=>{r=null,i&&(e(),r=setTimeout(n,t),i=!1)};return()=>(i=!0,r||n(),r)}Ao.getSourceType=function(e){return Ii[e]},Ao.setSourceType=function(e,t){Ii[e]=t},Ao.registerForPluginStateChange=e.cO;class ko{constructor(t){this._hashName=t&&encodeURIComponent(t),e.br(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=Io(this._updateHashUnthrottled.bind(this),300)}addTo(e){return this._map=e,window.addEventListener("hashchange",this._onHashChange,!1),e.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const e=this._map;if(!e)return"";const t=Lo(e);if(this._hashName){const e=this._hashName;let i=!1;const r=location.hash.slice(1).split("&").map((r=>{const n=r.split("=")[0];return n===e?(i=!0,`${n}=${t}`):r})).filter((e=>e));return i||r.push(`${e}=${t}`),`#${r.join("&")}`}return`#${t}`}_getCurrentHash(){const e=location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map((e=>
vendor: 11,334 bytes, line 1
1e.split("="))).forEach((e=>{e[0]===this._hashName&&(t=e)})),(t&&t[1]||"").split("/")}return e.split("/")}_onHashChange(){const e=this._map;if(!e)return!1;const t=this._getCurrentHash();if(t.length>=3&&!t.some((e=>isNaN(e)))){const i=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(t[3]||0):e.getBearing();return e.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Lo(e,t){const i=e.getCenter(),r=Math.round(100*e.getZoom())/100,n=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,n),s=Math.round(i.lng*o)/o,a=Math.round(i.lat*o)/o,l=e.getBearing(),c=e.getPitch();let u=t?`/${s}/${a}/${r}`:`${r}/${a}/${s}`;return(l||c)&&(u+="/"+Math.round(10*l)/10),c&&(u+=`/${Math.round(c)}`),u}const Po={linearity:.3,easing:e.d3(0,0,.3,1)},Ro=e.Q({deceleration:2500,maxSpeed:1400},Po),zo=e.Q({deceleration:20,maxSpeed:1400},Po),Oo=e.Q({deceleration:1e3,maxSpeed:360},Po),Do=e.Q({deceleration:1e3,maxSpeed:90},Po);class Fo{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.e.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,i=e.e.now();for(;t.length>0&&i-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion())return;if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:e}of this._inertiaBuffer)i.zoom+=e.zoomDelta||0,i.bearing+=e.bearingDelta||0,i.pitch+=e.pitchDelta||0,e.panDelta&&i.pan._add(e.panDelta),e.around&&(i.around=e.around),e.pinchAround&&(i.pinchAround=e.pinchAround);const r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,n={};if(i.pan.mag()){const o=No(i.pan.mag(),r,e.Q({},Ro,t||{}));n.offset=i.pan.mult(o.amount/i.pan.mag()),n.center=this._map.transform.center,Bo(n,o)}if(i.zoom){const e=No(i.zoom,r,zo);n.zoom=this._map.transform.zoom+e.amount,Bo(n,e)}if(i.bearing){const t=No(i.bearing,r,Oo);n.bearing=this._map.transform.bearing+e.au(t.amount,-179,179),Bo(n,t)}if(i.pitch){const e=No(i.pitch,r,Do);n.pitch=this._map.transform.pitch+e.amount,Bo(n,e)}if(n.zoom||n.bearing){const e=void 0===i.pinchAround?i.around:i.pinchAround;n.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),n.noMoveStart=!0,n}}function Bo(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function No(t,i,r){const{maxSpeed:n,linearity:o,deceleration:s}=r,a=e.au(t*o/(i/1e3),-n,n),l=Math.abs(a)/(s*o);return{easing:r.easing,duration:1e3*l,amount:a*(l/2)}}class jo extends e.g{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r,n={}){const o=d(i.getCanvasContainer(),r),s=i.unproject(o);super(t,e.Q({point:o,lngLat:s,originalEvent:r},n)),this._defaultPrevented=!1,this.target=i}}class Uo extends e.g{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,i,r){const n="touchend"===t?r.changedTouches:r.touches,o=f(i.getCanvasContainer(),n),s=o.map((e=>i.unproject(e))),a=o.reduce(((e,t,i,r)=>e.add(t.div(r.length))),new e.P(0,0));super(t,{points:o,point:a,lngLats:s,lngLat:i.unproject(a),originalEvent:r}),this._defaultPrevented=!1}}class Vo extends e.g{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t){super("wheel",{originalEvent:t}),this._defaultPrevented=!1}}class $o{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){this._mousedownPos=void 0}wheel(e){return this._firePreventable(new Vo(this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new jo(e.type,this._map,e))}mouseup(e){this._map.fire(new jo(e.type,this._map,e))}preclick(t){const i=e.Q({},t);i.type="preclick",this._map.fire(new jo(i.type,this._map,i))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||(this.preclick(e),this._map.fire(new jo(e.type,this._map,e)))}dblclick(e){return this._firePreventable(new jo(e.type,this._map,e))}mouseover(e){this._map.fire(new jo(e.type,this._map,e))}mouseout(e){this._map.fire(new jo(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Uo(e.type,this._map,e))}touchmove(e){this._map.fire(new Uo(e.type,this._map,e))}touchend(e){this._map.fire(new Uo(e.type,this._map,e))}touchcancel(e){this._map.fire(new Uo(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Go{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(e){this._map.fire(new jo(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new jo("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new jo(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class qo{constructor(e,t){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(c(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;const i=t,r=this._startPos,o=this._lastPos;if(!r||!o||o.equals(i)||!this._box&&i.dist(r)<this._clickTolerance)return;this._lastPos=i,this._box||(this._box=n("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",e));const s=Math.min(r.x,i.x),a=Math.max(r.x,i.x),l=Math.min(r.y,i.y),c=Math.max(r.y,i.y);this._map._requestDomTask((()=>{this._box&&(this._box.style.transform=`translate(${s}px,${l}px)`,this._box.style.width=a-s+"px",this._box.style.height=c-l+"px")}))}mouseupWindow(t,i){if(!this._active)return;const r=this._startPos,n=i;if(r&&0===t.button){if(this.reset(),p(),r.x!==n.x||r.y!==n.y)return this._map.fire(new e.g("boxzoomend",{originalEvent:t})),{cameraAnimation:e=>e.fitScreenCoordinates(r,n,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),u(),delete this._startPos,delete this._lastPos}_fireEvent(t,i){return this._map.fire(new e.g(t,{originalEvent:i}))}}function Ho(e,t){const i={};for(let r=0;r<e.length;r++)i[e[r].identifier]=t[r];return i}class Zo{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(t,i,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=t.timeStamp),r.length===this.numTouches&&(this.centroid=function(t){const i=new e.P(0,0);for(const e of t)i._add(e);return i.div(t.length)}(i),this.touches=Ho(r,i)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;const r=Ho(i,t);for(const e in this.touches){const t=r[e];(!t||t.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class Wo{constructor(e){this.singleTap=new Zo(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){const r=this.singleTap.touchend(e,t,i);if(r){const t=e.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(r)<30;if(t&&i||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class Xo{constructor(){this._zoomIn=new Wo({numTouches:1,numTaps:2}),this._zoomOut=new Wo({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){const r=this._zoomIn.touchend(e,t,i),n=this._zoomOut.touchend(e,t,i);return r?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()+1,around:t.unproject(r)},{originalEvent:e})}):n?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:t.getZoom()-1,around:t.unproject(n)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const Qo={0:1,2:2};class Yo{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(e,t){return!1}_move(e,t){return{}}mousedown(e,t){if(this._lastPoint)return;const i=m(e);this._correctButton(e,i)&&(this._lastPoint=t,this._eventButton=i)}mousemoveWindow(e,t){const i=this._lastPoint;if(i)if(e.preventDefault(),null!=this._eventButton&&function(e,t){const i=Qo[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton))this.reset();else if(this._moved||!(t.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=t,this._move(i,t)}mouseupWindow(e){this._lastPoint&&m(e)===this._eventButton&&(this._moved&&p(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Jo extends Yo{mousedown(e,t){super.mousedown(e,t),this._lastPoint&&(this._active=!0)}_correctButton(e,t){return 0===t&&!e.ctrlKey}_move(e,t){return{around:t,panDelta:t.sub(e)}}}class Ko extends Yo{_correctButton(e,t){return 0===t&&e.ctrlKey||2===t}_move(e,t){const i=.8*(t.x-e.x);if(i)return this._active=!0,{bearingDelta:i}}contextmenu(e){e.preventDefault()}}class es extends Yo{_correctButton(e,t){return 0===t&&e.ctrlKey||2===t}_move(e,t){const i=-.5*(t.y-e.y);if(i)return this._active=!0,{pitchDelta:i}}contextmenu(e){e.preventDefault()}}class ts{constructor(t,i){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=i.clickTolerance||1,this.reset(),e.br(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0)}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(t,i,r){if(this._active&&!(r.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===r.length&&!e.d4())return void this._showTouchPanBlockerAlert();
vendor: 4,248 bytes, line 1
1"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return t.cancelable&&t.preventDefault(),this._calculateTransform(t,i,r)}}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&i.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,i,r){r.length>0&&(this._active=!0);const n=Ho(r,i),o=new e.P(0,0),s=new e.P(0,0);let a=0;for(const e in n){const t=n[e],i=this._touches[e];i&&(o._add(t),s._add(t.sub(i)),a++,n[e]=t)}if(this._touches=n,a<this._minTouches||!s.mag())return;const l=s.div(a);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(a),panDelta:l}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=n("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout((()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")}),500)}}class is{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(e){}_move(e,t,i){return{}}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){const r=this._firstTwoTouches;if(!r)return;e.preventDefault();const[n,o]=r,s=rs(i,t,n),a=rs(i,t,o);if(!s||!a)return;const l=this._aroundCenter?null:s.add(a).div(2);return this._move([s,a],l,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;const[r,n]=this._firstTwoTouches,o=rs(i,t,r),s=rs(i,t,n);o&&s||(this._active&&p(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function rs(e,t,i){for(let r=0;r<e.length;r++)if(e[r].identifier===i)return t[r]}function ns(e,t){return Math.log(e/t)/Math.LN2}class os extends is{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){const i=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(ns(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ns(this._distance,i),pinchAround:t}}}function ss(e,t){return 180*e.angleWith(t)/Math.PI}class as extends is{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t){const i=this._vector;if(this._vector=e[0].sub(e[1]),i&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:ss(this._vector,i),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const t=25/(Math.PI*this._minDiameter)*360,i=this._startVector;if(!i)return!1;const r=ss(e,i);return Math.abs(r)<t}}function ls(e){return Math.abs(e.y)>Math.abs(e.x)}class cs extends is{constructor(e){super(),this._map=e}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(e){this._lastPoints=e,ls(e[0].sub(e[1]))&&(this._valid=!1)}_move(t,i,r){const n=this._lastPoints;if(!n)return;const o=t[0].sub(n[0]),s=t[1].sub(n[1]);return this._map._cooperativeGestures&&!e.d4()&&r.touches.length<3||(this._val
vendor: 5,087 bytes, line 1
1id=this.gestureBeginsVertically(o,s,r.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+s.y)/2*-.5})}gestureBeginsVertically(e,t,i){if(void 0!==this._valid)return this._valid;const r=e.mag()>=2,n=t.mag()>=2;if(!r&&!n)return;if(!r||!n)return null==this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=e.y>0==t.y>0;return ls(e)&&ls(t)&&o}}const us={panStep:100,bearingStep:15,pitchStep:10};class hs{constructor(){const e=us;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,r=0,n=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:s=>{const a=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:ps,zoom:t?Math.round(a)+t*(e.shiftKey?2:1):a,bearing:s.getBearing()+i*this._bearingStep,pitch:s.getPitch()+r*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:s.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function ps(e){return e*(2-e)}const ds=4.000244140625,fs=1/450;class ms{constructor(t,i){this._map=t,this._el=t.getCanvasContainer(),this._handler=i,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=fs,e.br(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||e.d4()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let i=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const r=e.e.now(),n=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==i&&i%ds==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=i,this._timeout=window.setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(n*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),t.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=t,this._delta-=i,this._active||this._start(t)),t.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const t=d(this._el,e);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:t,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._map.transform;"wheel"===this._type&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const i=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(0!==this._delta){const e="wheel"===this._type&&Math.abs(this._delta)>ds?this._wheelZoomRate:this._defaultZoomRate;let r=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==r&&(r=1/r);const n=i(),o=Math.pow(2,n),s="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):o;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(s*r))),"wheel"===this._type&&(this._startZoom=n,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const r="number"==typeof this._targetZoom?this._targetZoom:i(),n=this._startZoom,o=this._easing;let s,a=!1;if("wheel"===this._type&&n&&o){const t=Math.min((e.e.now()-this._lastWheelEventTime)/200,1),i=o(t);s=e.a3(n,r,i),t<1?this._frameId||(this._frameId=!0):a=!0}else s=r,a=!0;this._active=!0,a&&(this._active=!1,this._finishTimeout=window.setTimeout((()=>
vendor: 9,041 bytes, line 1
1{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200));let l=s-i();return l*this._lastDelta<0&&(l=0),{noInertia:!0,needsRenderFrame:!a,zoomDelta:l,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=e.d5;if(this._prevEase){const t=this._prevEase,r=(e.e.now()-t.start)/t.duration,n=t.easing(r+.01)-t.easing(r),o=.27/Math.sqrt(n*n+1e-4)*.01,s=Math.sqrt(.0729-o*o);i=e.d3(o,s,.25,1)}return this._prevEase={start:e.e.now(),duration:t,easing:i},i}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=n("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout((()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")}),200)}}class _s{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class gs{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:i.getZoom()+(e.shiftKey?-1:1),around:i.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ys{constructor(){this._tap=new Wo({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(e,t,i){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=t[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(e,t,i))}touchmove(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const r=t[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(e,t,i)}touchend(e,t,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(e,t,i)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class vs{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class xs{constructor(e,t,i){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=t,this._mousePitch=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class bs{constructor(e,t,i,r){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const ws=e=>e.zoom||e.drag||e.pitch||e.rotate;class Ts extends e.g{}class Ms{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,i){const r=e.$.sub([],i,t);this.radius=e.$.length(r[2]<0?e.$.div([],r,this.constants):[r[0],r[1],0])}projectRay(t){e.$.div(t,t,this.constants),e.$.normalize(t,t),e.$.mul(t,t,this.constants);const i=e.$.scale([],t,this.radius);if(i[2]>0){const t=e.$.scale([],[0,0,1],e.$.dot(i,[0,0,1])),r=e.$.scale([],e.$.normalize([],[i[0],i[1],0]),this.radius),n=e.$.add([],i,e.$.scale([],e.$.sub([],e.$.add([],r,t),i),2));i[0]=n[0],i[1]=n[1]}return i}}function Es(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class Ss{constructor(t,i){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Fo(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Ms,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(i),e.br(["handleEvent","handleWindowEvent"],this);const r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]];for(const[e,t,i]of this._listeners){const r=e===document?this.handleWindowEvent:this.handleEvent;e.addEventListener(t,r,i)}}destroy(){for(const[e,t,i]of this._listeners){const r=e===document?this.handleWindowEvent:this.handleEvent;e.removeEventListener(t,r,i)}}_addDefaultHandlers(e){const t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new $o(t,e));const r=t.boxZoom=new qo(t,e);this._add("boxZoom",r);const n=new Xo,o=new gs;t.doubleClickZoom=new _s(o,n),this._add("tapZoom",n),this._add("clickZoom",o);const s=new ys;this._add("tapDragZoom",s);const a=t.touchPitch=new cs(t);this._add("touchPitch",a);const l=new Ko(e),c=new es(e);t.dragRotate=new xs(e,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const u=new Jo(e),h=new ts(t,e);t.dragPan=new vs(i,u,h),this._add("mousePan",u),this._add("touchPan",h,["touchZoom","touchRotate"]);const p=new as,d=new os;t.touchZoomRotate=new bs(i,d,p,s),this._add("touchRotate",p,["touchPan","touchZoom"]),this._add("touchZoom",d,["touchPan","touchRotate"]),this._add("blockableMapEvent",new Go(t));const f=t.scrollZoom=new ms(t,this);this._add("scrollZoom",f,["mousePan"]);const m=t.keyboard=new hs;this._add("keyboard",m);for(const i of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])e.interactive&&e[i]&&t[i].enable(e[i])}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(const{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ws(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(e,t,i){for(const r in e)if(r!==i&&(!t||t.indexOf(r)<0))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){const t=[];for(const i of e)this._el.contains(i.target)&&t.push(i);return t}handleEvent(e,t){this._updatingCamera=!0;const i="renderFrame"===e.type,r=i?void 0:e,n={needsRenderFrame:!1},o={},s={},a=e.touches?this._getMapTouches(e.touches):void 0,l=a?f(this._el,a):i?void 0:d(this._el,e);for(const{handlerName:i,handler:c,allowed:u}of this._handlers){if(!c.isEnabled())continue;let h;this._blockedByActive(s,u,i)?c.reset():c[t||e.type]&&(h=c[t||e.type](e,l,a),this.mergeHandlerResult(n,o,h,i,r),h&&h.needsRenderFrame&&this._triggerRe
vendor: 4,105 bytes, line 1
1nderFrame()),(h||c.isActive())&&(s[i]=c)}const c={};for(const e in this._previousActiveHandlers)s[e]||(c[e]=r);this._previousActiveHandlers=s,(Object.keys(c).length||Es(n))&&(this._changes.push([n,o,c]),this._triggerRenderFrame()),(Object.keys(s).length||Es(n))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=n;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))}mergeHandlerResult(t,i,r,n,o){if(!r)return;e.Q(t,r);const s={handlerName:n,originalEvent:r.originalEvent||o};void 0!==r.zoomDelta&&(i.zoom=s),void 0!==r.panDelta&&(i.drag=s),void 0!==r.pitchDelta&&(i.pitch=s),void 0!==r.bearingDelta&&(i.rotate=s)}_applyChanges(){const t={},i={},r={};for(const[n,o,s]of this._changes)n.panDelta&&(t.panDelta=(t.panDelta||new e.P(0,0))._add(n.panDelta)),n.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+n.pitchDelta),void 0!==n.around&&(t.around=n.around),void 0!==n.aroundCoord&&(t.aroundCoord=n.aroundCoord),void 0!==n.pinchAround&&(t.pinchAround=n.pinchAround),n.noInertia&&(t.noInertia=n.noInertia),e.Q(i,o),e.Q(r,s);this._updateMapTransform(t,i,r),this._changes=[]}_updateMapTransform(t,i,r){const n=this._map,o=n.transform,s=e=>[e.x,e.y,e.z];if((e=>{const t=this._eventsInProgress.drag;return t&&!this._handlersById[t.handlerName].isActive()})()&&!Es(t)){const e=o.zoom;o.cameraElevationReference="sea",null!=this._originalZoom&&o._orthographicProjectionAtLowPitch&&"globe"!==o.projection.name&&0===o.pitch?(o.cameraElevationReference="ground",o.zoom=this._originalZoom):(o.recenterOnTerrain(),o.cameraElevationReference="ground"),e!==o.zoom&&this._map._update(!0)}if(o._isCameraConstrained&&n._stop(!0),!Es(t))return void this._fireEvents(i,r,!0);let{panDelta:a,zoomDelta:l,bearingDelta:c,pitchDelta:u,around:h,aroundCoord:p,pinchAround:d}=t;o._isCameraConstrained&&(l>0&&(l=0),o._isCameraConstrained=!1),void 0!==d&&(h=d),(l||(e=>i[e]&&!this._eventsInProgress[e])("drag"))&&h&&(this._dragOrigin=s(o.pointCoordinate3D(h)),this._originalZoom=o.zoom,this._trackingEllipsoid.setup(o._camera.position,this._dragOrigin)),o.cameraElevationReference="sea",n._stop(!0),h=h||n.transform.centerPoint,c&&(o.bearing+=c),u&&(o.pitch+=u),o._updateCameraState();const f=[0,0,0];if(a)if("mercator"===o.projection.name){const e=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(h).dir),t=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(h.sub(a)).dir);f[0]=t[0]-e[0],f[1]=t[1]-e[1]}else{const t=o.pointCoordinate(h);if("globe"===o.projection.name){a=a.rotate(-o.angle);const i=o._pixelsPerMercatorPixel/o.worldSize;f[0]=-a.x*e.d6(e.az(t.y))*i,f[1]=-a.y*e.d6(o.center.lat)*i}else{const e=o.pointCoordinate(h.sub(a));t&&e&&(f[0]=e.x-t.x,f[1]=e.y-t.y)}}const m=o.zoom,_=[0,0,0];if(l){const t=s(p||o.pointCoordinate3D(h)),i={dir:e.$.normalize([],e.$.sub([],t,o._camera.position))};if(i.dir[2]<0){const r=o.zoomDeltaToMovement(t,l);e.$.scale(_,i.dir,r)}}const g=e.$.add(f,f,_);o._translateCameraConstrained(g),l&&Math.abs(o.zoom-m)>1e-4&&o.recenterOnTerrain(),o.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(i,r,!0)}_fireEvents(t,i,r){const n=ws(this._eventsInProgress),o=ws(t),s={};for(const e in t){const{originalEvent:i}=t[e];this._eventsInProgress[e]||(s[`${e}start`]=i),this._eventsInProgress[e]=t[e]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(const e in s)this._fireEvent(e,s[e]);o&&this._fireEvent("move",o.originalEvent);for(const e in t){const{originalEvent:i}=t[e];this._fireEvent(e,i)}const a={};let l;for(const e in this._eventsInProgress){const{handlerName:t,originalEvent:r}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],l=i[t]||r,a[`${e}end`]=l)}for(const e in a)this._fireEvent(e,a[e]);const c=ws(this._eventsInProgress);if(r&&(n||o)&&!c){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;
1t?(i(t.bearing||this._map.getBearing())&&(t.bearing=0),this._map.easeTo(t,{originalEvent:l})):(this._map.fire(new e.g("moveend",{originalEvent:l})),i(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,i){this._map.fire(new e.g(t,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((e=>{this._frameId=void 0,this.handleEvent(new Ts("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const Cs="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class As extends e.E{constructor(t,i){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,this._respectPrefersReducedMotion=!1!==i.respectPrefersReducedMotion,e.br(["_renderFrameCallback"],this)}getCenter(){return new e.aJ(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}panBy(t,i,r){return t=e.P.convert(t).mult(-1),this.panTo(this.transform.center,e.Q({offset:t},i),r)}panTo(t,i,r){return this.easeTo(e.Q({center:t},i),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(t,i,r){return this.easeTo(e.Q({zoom:t},i),r)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(t,i,r){return this.easeTo(e.Q({bearing:t},i),r)}resetNorth(t,i){return this.rotateTo(0,e.Q({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(e.Q({bearing:0,pitch:0,duration:1e3},t),i),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}cameraForBounds(t,i){t=e.aj.convert(t);const r=i&&i.bearing||0,n=i&&i.pitch||0,o=t.getNorthWest(),s=t.getSouthEast();return this._cameraForBounds(this.transform,o,s,r,n,i)}_extendPadding(t){const i={top:0,right:0,bottom:0,left:0};return null==t?e.Q({},i,this.transform.padding):"number"==typeof t?{top:t,bottom:t,right:t,left:t}:e.Q({},i,t)}_extendCameraOptions(t){return(t=e.Q({offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding=this._extendPadding(t.padding),t}_minimumAABBFrustumDistance(e,t){const i=t.max[0]-t.min[0],r=t.max[1]-t.min[1];return i/r>e.aspect?i/(2*Math.tan(.5*e.fovX)*e.aspect):r/(2*Math.tan(.5*e.fovY)*e.aspect)}_cameraForBoundsOnGlobe(t,i,r,n,o,s){const a=t.clone(),l=this._extendCameraOptions(s);a.bearing=n,a.pitch=o;const c=e.aJ.convert(i),u=e.aJ.convert(r),h=.5*(c.lat+u.lat),p=.5*(c.lng+u.lng),d=e.d7(h,p),f=e.$.normalize([],d),m=e.$.normalize([],e.$.cross([],f,[0,1,0])),_=e.$.cross([],m,f),g=[m[0],m[1],m[2],0,_[0],_[1],_[2],0,f[0],f[1],f[2],0,0,0,0,1],y=[d,e.d7(c.lat,c.lng),e.d7(u.lat,c.lng),e.d7(u.lat,u.lng),e.d7(c.lat,u.lng),e.d7(h,c.lng),e.d7(h,u.lng),e.d7(c.lat,p),e.d7(u.lat,p)];let v=e.b8.fromPoints(y.map((t=>[e.$.dot(m,t),e.$.dot(_,t),e.$.dot(f,t)])));const x=e.$.transformMat4([],v.center,g);0===e.$.squaredLength(x)&&e.$.set(x,0,0,1),e.$.normalize(x,x),e.$.scale(x,x,e.cF),a.center=e.d8(x);const b=a.getWorldToCameraMatrix(),w=e.ae.invert(new Float64Array(16),b);v=e.b8.applyTransform(v,e.ae.multiply([],b,g));const T=this._extendAABB(v,a,l,n);if(!T)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");v=T,e.$.transformMat4(x,x,b);const M=.5*(v.max[2]-v.min[2]),E=this._minimumAABBFrustumDistance(a,v),S=e.$.scale([],[0,0,1],M),C=e.$.add(S,x,S),A=E+(0===a.pitch?0:e.$.distance(x,C)),I=a.globeCenterInViewSpace,k=e.$.sub([],x,[I[0],I[1],I[2]]);e.$.normalize(k,k),e.$.scale(k,k,A);const L=e.$.add([],x,k);e.$.transformMat4(L,L,w);const P=e.da/e.cF,R=e.$.length(L),z=e.ay(Math.max(R*P-e.da,Number.EPSILON),0),O=Math.min(a.zoomFromMercatorZAdjusted(z),l.maxZoom);return O>.5*(e.b3+e.aV)?(a.setProjection({name:"mercator"}),a.zoom=O,this._cameraForBounds(a,i,r,n,o,s)):{center:a.center,zoom:O,bearing:n,pitch:o}}_extendAABB(t,i,r,n){const o=.5*((r.padding.left||0)+(r.padding.right||0)),s=.5*((r.padding.top||0)+(r.padding.bottom||0)),a=s,l=o,c=o,u=s,h=i.width-(l+c),p=i.height-(a+u),d=e.$.sub([],t.max,t.min),f=Math.min(h/d[0],p/d[1]),m=Math.min(i.scaleZoom(i.scale*f),r.maxZoom);if(isNaN(m))return null;const _=i.scale/i.zoomScale(m),g=new e.b8([t.min[0]-l*_,t.min[1]-u*_,t.min[2]],[t.max[0]+c*_,t.max[1]+a*_,t.max[2]]),y=("number"==typeof r.offset.x&&"number"==typeof r.offset.y?new e.P(r.offset.x,r.offset.y):e.P.convert(r.offset)).rotate(-e.ac(n));return g.center[0]-=y.x*_,g.center[1]+=y.y*_,g}queryTerrainElevation(t,i){const r=this.transform.elevation;return r?(i=e.Q({},{exaggerated:!0},i),r.getAtPoint(e._.fromLngLat(t),null,i.exaggerated)):null}
1_cameraForBounds(t,i,r,n,o,s){if("globe"===t.projection.name)return this._cameraForBoundsOnGlobe(t,i,r,n,o,s);const a=t.clone(),l=this._extendCameraOptions(s);a.bearing=n,a.pitch=o;const c=e.aJ.convert(i),u=e.aJ.convert(r),h=new e.aJ(c.lng,u.lat),p=new e.aJ(u.lng,c.lat),d=a.project(c),f=a.project(u),m=this.queryTerrainElevation(c),_=this.queryTerrainElevation(u),g=this.queryTerrainElevation(h),y=this.queryTerrainElevation(p),v=[[d.x,d.y,Math.min(m||0,_||0,g||0,y||0)],[f.x,f.y,Math.max(m||0,_||0,g||0,y||0)]];let x=e.b8.fromPoints(v);const b=a.getWorldToCameraMatrix(),w=e.ae.invert(new Float64Array(16),b);x=e.b8.applyTransform(x,b);const T=this._extendAABB(x,a,l,n);if(!T)return void e.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");x=T;const M=.5*e.$.sub([],x.max,x.min)[2],E=this._minimumAABBFrustumDistance(a,x),S=[0,0,1,0];e.aB.transformMat4(S,S,b),e.aB.normalize(S,S);const C=e.$.scale([],S,E+M),A=e.$.add([],x.center,C);e.$.transformMat4(x.center,x.center,w),e.$.transformMat4(A,A,w);const I=[x.center[0],x.center[1],A[2]*a.pixelsPerMeter];e.$.scale(I,I,1/a.worldSize);const k=e.d9(I[0]),L=e.az(I[1]),P=Math.min(a._zoomFromMercatorZ(I[2]),l.maxZoom),R=new e.aJ(k,L);return a.mercatorFromTransition&&P<.5*(e.b3+e.aV)?(a.setProjection({name:"globe"}),a.zoom=P,this._cameraForBounds(a,i,r,n,o,s)):{center:R,zoom:P,bearing:n,pitch:o}}fitBounds(e,t,i){const r=this.cameraForBounds(e,t);return this._fitInternal(r,t,i)}fitScreenCoordinates(t,i,r,n,o){const s=e.P.convert(t),a=e.P.convert(i),l=new e.P(Math.min(s.x,a.x),Math.min(s.y,a.y)),c=new e.P(Math.max(s.x,a.x),Math.max(s.y,a.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(s,a))return this;const u=this.transform.pointLocation3D(l),h=this.transform.pointLocation3D(c),p=this.transform.pointLocation3D(new e.P(l.x,c.y)),d=this.transform.pointLocation3D(new e.P(c.x,l.y)),f=[Math.min(u.lng,h.lng,p.lng,d.lng),Math.min(u.lat,h.lat,p.lat,d.lat)],m=[Math.max(u.lng,h.lng,p.lng,d.lng),Math.max(u.lat,h.lat,p.lat,d.lat)],_=n&&n.pitch?n.pitch:this.getPitch(),g=this._cameraForBounds(this.transform,f,m,r,_,n);return this._fitInternal(g,n,o)}_fitInternal(t,i,r){return t?(i=e.Q(t,i)).linear?this.easeTo(i,r):this.flyTo(i,r):this}jumpTo(t,i){this.stop();const r=t.preloadOnly?this.transform.clone():this.transform;let n=!1,o=!1,s=!1;if("zoom"in t&&r.zoom!==+t.zoom&&(n=!0,r.zoom=+t.zoom),void 0!==t.center&&(r.center=e.aJ.convert(t.center)),"bearing"in t&&r.bearing!==+t.bearing&&(o=!0,r.bearing=+t.bearing),"pitch"in t&&r.pitch!==+t.pitch&&(s=!0,r.pitch=+t.pitch),null!=t.padding){const e="number"==typeof t.padding?this._extendPadding(t.padding):t.padding;r.isPaddingEqual(e)||(r.padding=e)}return t.preloadOnly?(this._preloadTiles(r),this):(this.fire(new e.g("movestart",i)).fire(new e.g("move",i)),n&&this.fire(new e.g("zoomstart",i)).fire(new e.g("zoom",i)).fire(new e.g("zoomend",i)),o&&this.fire(new e.g("rotatestart",i)).fire(new e.g("rotate",i)).fire(new e.g("rotateend",i)),s&&this.fire(new e.g("pitchstart",i)).fire(new e.g("pitch",i)).fire(new e.g("pitchend",i)),this.fire(new e.g("moveend",i)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||e.w(Cs),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,i){const r=this.transform;if(!r.projection.supportsFreeCamera)return e.w(Cs),this;this.stop();const n=r.zoom,o=r.pitch,s=r.bearing;r.setFreeCameraOptions(t);const a=n!==r.zoom,l=o!==r.pitch,c=s!==r.bearing;return this.fire(new e.g("movestart",i)).fire(new e.g("move",i)),a&&this.fire(new e.g("zoomstart",i)).fire(new e.g("zoom",i)).fire(new e.g("zoomend",i)),c&&this.fire(new e.g("rotatestart",i)).fire(new e.g("rotate",i)).fire(new e.g("rotateend",i)),l&&this.fire(new e.g("pitchstart",i)).fire(new e.g("pitch",i)).fire(new e.g("pitchend",i)),this.fire(new e.g("moveend",i)),this}easeTo(t,i){this._stop(!1,t.easeId),(!1===(t=e.Q({offset:[0,0],duration:500,easing:e.d5},t)).animate||this._prefersReducedMotion(t))&&(t.duration=0);const r=this.transform,n=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in t?+t.zoom:n,c="bearing"in t?this._normalizeBearing(t.bearing,o):o,u="pitch"in t?+t.pitch:s,h=this._extendPadding(t.padding),p=e.P.convert(t.offset);let d,f,m;if("globe"===r.projection.name){const i=e._.fromLngLat(r.center),n=p.rotate(-r.angle);i.x+=n.x/r.worldSize,i.y+=n.y/r.worldSize;const o=i.toLngLat(),s=e.aJ.convert(t.center||o);this._normalizeCenter(s),d=r.centerPoint.add(n),f=new e.P(i.x,i.y).mult(r.worldSize),m=new e.P(e.ak(s.lng),e.al(s.lat)).mult(r.worldSize).sub(f)}else{d=r.centerPoint.add(p);const i=r.pointLocation(d),n=e.aJ.convert(t.center||i);this._normalizeCenter(n),f=r.project(i),m=r.project(n).sub(f)}const _=r.zoomScale(l-n);let g,y;t.around&&(g=e.aJ.convert(t.around),y=r.locationPoint(g));const v=this._zooming||l!==n,x=this._rotating||o!==c,b=this._pitching||u!==s,w=!r.isPaddingEqual(h),T=r=>T=>{if(v&&(r.zoom=e.a3(n,l,T)),x&&(r.bearing=e.a3(o,c,T)),b&&(r.pitch=e.a3(s,u,T)),w&&(r.interpolatePadding(a,h,T),d=r.centerPoint.add(p)),g)r.setLocationAtPoint(g,y);else{const e=r.zoomScale(r.zoom-n),t=l>n?Math.min(2,_):Math.max(.5,_),i=Math.pow(t,1-T),o=r.unproject(f.add(m.mult(T*i)).mult(e));r.setLocationAtPoint(r.renderWorldCopies?o.wrap():o,d)}return t.preloadOnly||this._fireMoveEvents(i),r};if(t.preloadOnly){const e=this._emulate(T,t.duration,r);return this._preloadTiles(e),this}const M={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=v,this._rotating=x,this._pitching=b,this._padding=w,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,M),this._ease(T(r),(e=>{"sea"===r.cameraElevationReference&&r.recenterOnTerrain(),this._afterEase(i,e)}),t),this}_prepareEase(t,i,r={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&0===this.transform.pitch&&"globe"!==this.transform.projection.name&&(this.transform.cameraElevationReference="ground"),i||r.moving||this.fire(new e.g("movestart",t)),this._zooming&&!r.zooming&&this.fire(new e.g("zoomstart",t)),this._rotating&&!r.rotating&&this.fire(new e.g("rotatestart",t)),this._pitching&&!r.pitching&&this.fire(new e.g("pitchstart",t))}_fireMoveEvents(t){this.fire(new e.g("move",t)),this._zooming&&this.fire(new e.g("zoom",t)),this._rotating&&this.fire(new e.g("rotate",t)),this._pitching&&this.fire(new e.g("pitch",t))}
vendor: 5,531 bytes, line 1
1_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const r=this._zooming,n=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new e.g("zoomend",t)),n&&this.fire(new e.g("rotateend",t)),o&&this.fire(new e.g("pitchend",t)),this.fire(new e.g("moveend",t))}flyTo(t,i){if(this._prefersReducedMotion(t)){const r=e.ai(t,["center","zoom","bearing","pitch","around","padding"]);return this.jumpTo(r,i)}this.stop(),t=e.Q({offset:[0,0],speed:1.2,curve:1.42,easing:e.d5},t);const r=this.transform,n=this.getZoom(),o=this.getBearing(),s=this.getPitch(),a=this.getPadding(),l="zoom"in t?e.au(+t.zoom,r.minZoom,r.maxZoom):n,c="bearing"in t?this._normalizeBearing(t.bearing,o):o,u="pitch"in t?+t.pitch:s,h=this._extendPadding(t.padding),p=r.zoomScale(l-n),d=e.P.convert(t.offset);let f=r.centerPoint.add(d);const m=r.pointLocation(f),_=e.aJ.convert(t.center||m);this._normalizeCenter(_);const g=r.project(m),y=r.project(_).sub(g);let v=t.curve;const x=Math.max(r.width,r.height),b=x/p,w=y.mag();if("minZoom"in t){const i=e.au(Math.min(t.minZoom,n,l),r.minZoom,r.maxZoom),o=x/r.zoomScale(i-n);v=Math.sqrt(o/w*2)}const T=v*v;function M(e){const t=(b*b-x*x+(e?-1:1)*T*T*w*w)/(2*(e?b:x)*T*w);return Math.log(Math.sqrt(t*t+1)-t)}function E(e){return(Math.exp(e)-Math.exp(-e))/2}function S(e){return(Math.exp(e)+Math.exp(-e))/2}const C=M(0);let A=function(e){return S(C)/S(C+v*e)},I=function(e){return x*((S(C)*(E(t=C+v*e)/S(t))-E(C))/T)/w;var t},k=(M(1)-C)/v;if(Math.abs(w)<1e-6||!isFinite(k)){if(Math.abs(x-b)<1e-6)return this.easeTo(t,i);const e=b<x?-1:1;k=Math.abs(Math.log(b/x))/v,I=function(){return 0},A=function(t){return Math.exp(e*v*t)}}t.duration="duration"in t?+t.duration:1e3*k/("screenSpeed"in t?+t.screenSpeed/v:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const L=o!==c,P=u!==s,R=!r.isPaddingEqual(h),z=r=>p=>{const m=p*k,v=1/A(m);r.zoom=1===p?l:n+r.scaleZoom(v),L&&(r.bearing=e.a3(o,c,p)),P&&(r.pitch=e.a3(s,u,p)),R&&(r.interpolatePadding(a,h,p),f=r.centerPoint.add(d));const x=1===p?_:r.unproject(g.add(y.mult(I(m))).mult(v));return r.setLocationAtPoint(r.renderWorldCopies?x.wrap():x,f),r._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(i),r};if(t.preloadOnly){const e=this._emulate(z,t.duration,r);return this._preloadTiles(e),this}return this._zooming=!0,this._rotating=L,this._pitching=P,this._padding=R,this._prepareEase(i,!1),this._ease(z(r),(()=>this._afterEase(i)),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(e){}_cancelRenderFrame(e){}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const e=this._onEaseEnd;this._onEaseEnd=void 0,e.call(this,t)}if(!e){const e=this.handlers;e&&e.stop(!1)}return this}_ease(t,i,r){!1===r.animate||0===r.duration?(t(1),i()):(this._easeStart=e.e.now(),this._easeOptions=r,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((e.e.now()-this._easeStart)/this._easeOptions.duration,1),i=this._onEaseFrame;i&&i(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,i){t=e.av(t,-180,180);const r=Math.abs(t-i);return Math.abs(t-360-i)<r&&(t-=360),Math.abs(t+360-i)<r&&(t+=360),t}_normalizeCenter(e){const t=this.transform;if(t.maxBounds)return;if("globe"!==t.projection.name&&!t.renderWorldCopies)return;const i=e.lng-t.center.lng;e.lng+=i>180?-360:i<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&e.e.prefersReducedMotion&&!(t&&t.essential)}_emulate(e,t,i){const r=Math.ceil(15*t/1e3),n=[],o=e(i.clone());for(let e=0;e<=r;e++){const t=o(e/r);n.push(t.clone())}return n}_preloadTiles(e,t){}}class Is{constructor(t={}){this.options=t,e.br(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){const t=this.options&&this.options.compact,i=e._getUIString("AttributionControl.ToggleAttribution");this._map=e,this._container=n("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=n("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",i);const r=n("span","mapboxgl-ctrl-icon",this._compactButton);return r.setAttribute("aria-hidden","true"),r.setAttribute("title",i),this._innerContainer=n("div","mapboxgl-ctrl-attrib-inner",this._container),t&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===t&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
1se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const i=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||e.db.ACCESS_TOKEN}];if(t){const r=i.reduce(((e,t,r)=>(t.value&&(e+=`${t.key}=${t.value}${r<i.length-1?"&":""}`),e)),"?");t.href=`${e.db.FEEDBACK_URL}/${r}#${Lo(this._map,!0)}`,t.rel="noopener nofollow"}}_updateData(e){!e||"metadata"!==e.sourceDataType&&"visibility"!==e.sourceDataType&&"style"!==e.dataType||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let e=[];if(this._map.style.stylesheet){const e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}const t=this._map.style._mergedSourceCaches;for(const i in t){const r=t[i];if(r.used){const t=r.getSource();t.attribution&&e.indexOf(t.attribution)<0&&e.push(t.attribution)}}e.sort(((e,t)=>e.length-t.length)),e=e.filter(((t,i)=>{for(let r=i+1;r<e.length;r++)if(e[r].indexOf(t)>=0)return!1;return!0})),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[...this.options.customAttribution,...e]:e.unshift(this.options.customAttribution));const i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class ks{constructor(){e.br(["_updateLogo","_updateCompact"],this)}onAdd(e){this._map=e,this._container=n("div","mapboxgl-ctrl");const t=n("a","mapboxgl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://www.mapbox.com/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(e){e&&"metadata"!==e.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const e=this._map.style._sourceCaches;if(0===Object.entries(e).length)return!0;for(const t in e){const i=e[t].getSource();if(i.hasOwnProperty("mapbox_logo")&&!i.mapbox_logo)return!1}return!0}_updateCompact(){const e=this._container.children;if(e.length){const t=e[0];this._map.getCanvasContainer().offsetWidth<250?t.classList.add("mapboxgl-compact"):t.classList.remove("mapboxgl-compact")}}}class Ls{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){const t=this._currentlyRunning,i=t?this._queue.concat(t):this._queue;for(const t of i)if(t.id===e)return void(t.cancelled=!0)}run(e=0){const t=this._currentlyRunning=this._queue;this._queue=[];for(const i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function Ps(t,i,r){if(t=new e.aJ(t.lng,t.lat),i){const n=new e.aJ(t.lng-360,t.lat),o=new e.aJ(t.lng+360,t.lat),s=360*Math.ceil(Math.abs(t.lng-r.center.lng)/360),a=r.locationPoint(t).distSqr(i),l=i.x<0||i.y<0||i.x>r.width||i.y>r.height;r.locationPoint(n).distSqr(i)<a&&(l||Math.abs(n.lng-r.center.lng)<s)?t=n:r.locationPoint(o).distSqr(i)<a&&(l||Math.abs(o.lng-r.center.lng)<s)&&(t=o)}for(;Math.abs(t.lng-r.center.lng)>180;){const e=r.locationPoint(t);if(e.x>=0&&e.y>=0&&e.x<=r.width&&e.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t}
vendor: 4,138 bytes, line 1
1const Rs={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};class zs extends e.E{constructor(t,i){if(super(),(t instanceof HTMLElement||i)&&(t=e.Q({element:t},i)),e.br(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=t&&t.occludedOpacity||.2,t&&t.element)this._element=t.element,this._offset=e.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=n("div");const i=41,r=27,s=o("svg",{display:"block",height:i*this._scale+"px",width:r*this._scale+"px",viewBox:`0 0 ${r} ${i}`},this._element),a=o("radialGradient",{id:"shadowGradient"},o("defs",{},s));o("stop",{offset:"10%","stop-opacity":.4},a),o("stop",{offset:"100%","stop-opacity":.05},a),o("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},s),o("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},s),o("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},s),o("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},s),this._offset=e.P.convert(t&&t.offset||[0,-14])}this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",(e=>{e.preventDefault()})),this._element.addEventListener("mousedown",(e=>{e.preventDefault()}));const r=this._element.classList;for(const e in Rs)r.remove(`mapboxgl-marker-anchor-${e}`);r.add(`mapboxgl-marker-anchor-${this._anchor}`);const s=t&&t.className?t.className.trim().split(/\s+/):[];r.add(...s),this._popup=null}addTo(e){return e===this._map||(this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._updateMoving),e.on("moveend",this._update),e.on("remove",this._clearFadeTimer),e._addMarker(this),this.setDraggable(this._draggable),this._update(),e.on("click",this._onMapClick)),this}remove(){const e=this._map;return e&&(e.off("click",this._onMapClick),e.off("move",this._updateMoving),e.off("moveend",this._update),e.off("mousedown",this._addDragHandler),e.off("touchstart",this._addDragHandler),e.off("mouseup",this._onUp),e.off("touchend",this._onUp),e.off("mousemove",this._onMove),e.off("touchmove",this._onMove),e.off("remove",this._clearFadeTimer),e._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.aJ.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const t=38.1,i=13.5,r=Math.sqrt(Math.pow(i,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
vendor: 3,140 bytes, line 1
10,-t],"bottom-left":[r,-1*(t-i+r)],"bottom-right":[-r,-1*(t-i+r)],left:[i,-1*(t-i)],right:[-i,-1*(t-i)]}:this._offset}this._popup=e,e._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(e){const t=e.code,i=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==i&&13!==i||this.togglePopup()}_onMapClick(e){const t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const e=this._popup;return e?(e.isOpen()?(e.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(e.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const e=this._map,t=this._pos;if(!e||!t)return!1;const i=e.unproject(t),r=e.getFreeCameraOptions();if(!r.position)return!1;const n=r.position.toLngLat();return n.distanceTo(i)<.9*n.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const i=this._pos;if(!i||i.x<0||i.x>t.transform.width||i.y<0||i.y>t.transform.height)return void this._clearFadeTimer();const r=t.unproject(i);let n;t._showingGlobe()&&e.dc(t.transform,this._lngLat)?n=0:(n=1-t._queryFogOpacity(r),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(n*=this._occludedOpacity)),this._element.style.opacity=`${n}`,this._element.style.pointerEvents=n>0?"auto":"none",this._popup&&this._popup._setOpacity(n),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const e=this._pos;if(!e||!this._map)return;const t=this._offset.mult(this._scale);this._element.style.transform=`\n translate(${e.x}px,${e.y}px)\n ${Rs[this._anchor]}\n ${this._calculateXYTransform()} ${this._calculateZTransform()}\n translate(${t.x}px,${t.y}px)\n `}_calculateXYTransform(){const t=this._pos,i=this._map,r=this.getPitchAlignment();if(!i||!t||"map"!==r)return"";if(!i._showingGlobe()){const e=i.getPitch();return e?`rotateX(${e}deg)`:""}const n=e.b1(e.dd(i.transform,this._lngLat)),o=t.sub(e.de(i.transform)),s=Math.abs(o.x)+Math.abs(o.y);if(0===s)return"";const a=n/s;return`rotateX(${-o.y*a}deg) rotateY(${o.x*a}deg)`}_calculateZTransform(){const t=this._pos,i=this._map;if(!i||!t)return"";let r=0;const n=this.getRotationAlignment();if("map"===n)if(i._showingGlobe()){const t=i.project(new e.aJ(this._lngLat.lng,this._lngLat.lat+.001)),n=i.project(new e.aJ(this._lngLat.lng,this._lngLat.lat-.001)).sub(t);r=e.b1(Math.atan2(n.y,n.x))-90}else r=-i.getBearing();else if("horizon"===n){const n=e.a0(4,6,i.getZoom()),o=e.de(i.transform);o.y+=n*i.transform.height;const s=t.sub(o),a=e.b1(Math.atan2(s.y,s.x));r=(a>90?a-270:a+90)*(1-n)}return r+=this._rotation,r?`rotateZ(${r}deg)`:""}_update(e){cancelAnimationFrame(this._updateFrameId);const t=this._map;
vendor: 11,297 bytes, line 1
1t&&(t.transform.renderWorldCopies&&(this._lngLat=Ps(this._lngLat,this._pos,t.transform)),this._pos=t.project(this._lngLat),!0===e?this._updateFrameId=requestAnimationFrame((()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())})):this._pos=this._pos.round(),t._requestDomTask((()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(t._showingGlobe()||t.getTerrain()||t.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))})))}getOffset(){return this._offset}setOffset(t){return this._offset=e.P.convert(t),this._update(),this}addClassName(e){return this._element.classList.add(e),this}removeClassName(e){return this._element.classList.remove(e),this}toggleClassName(e){return this._element.classList.toggle(e)}_onMove(t){const i=this._map;if(!i)return;const r=this._pointerdownPos,n=this._positionDelta;if(r&&n){if(!this._isDragging){const e=this._clickTolerance||i._clickTolerance;if(t.point.dist(r)<e)return;this._isDragging=!0}this._pos=t.point.sub(n),this._lngLat=i.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.g("dragstart"))),this.fire(new e.g("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const t=this._map;t&&(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new e.g("dragend")),this._state="inactive"}_addDragHandler(e){const t=this._map,i=this._pos;t&&i&&this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(i),this._pointerdownPos=e.point,this._state="pending",t.on("mousemove",this._onMove),t.on("touchmove",this._onMove),t.once("mouseup",this._onUp),t.once("touchend",this._onUp))}setDraggable(e){this._draggable=!!e;const t=this._map;return t&&(e?(t.on("mousedown",this._addDragHandler),t.on("touchstart",this._addDragHandler)):(t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return"auto"===this._rotationAlignment||"horizon"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e||"auto",this._update(),this}getPitchAlignment(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(e){return this._occludedOpacity=e||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Os={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Ds=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Fs(t=new e.P(0,0),i="bottom"){if("number"==typeof t){const r=Math.round(Math.sqrt(.5*Math.pow(t,2)));switch(i){case"top":return new e.P(0,t);case"top-left":return new e.P(r,r);case"top-right":return new e.P(-r,r);case"bottom":return new e.P(0,-t);case"bottom-left":return new e.P(r,-r);case"bottom-right":return new e.P(-r,-r);case"left":return new e.P(t,0);case"right":return new e.P(-t,0)}return new e.P(0,0)}return t instanceof e.P||Array.isArray(t)?e.P.convert(t):e.P.convert(t[i]||[0,0])}class Bs{constructor(e){this.jumpTo(e)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const i=e.bb((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-i)+this._end*i}isEasing(e){return e>=this._startTime&&e<=this._endTime}jumpTo(e){this._startTime=-1/0,this._endTime=-1/0,this._start=e,this._end=e}easeTo(e,t,i){this._start=this.getValue(t),this._end=e,this._startTime=t,this._endTime=t+i}}const Ns={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use â + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class js{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}const Us={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0},Vs={showCompass:!0,showZoom:!0,visualizePitch:!1};class $s{constructor(t,i,r=!1){this._clickTolerance=10,this.element=i,this.mouseRotate=new Ko({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,r&&(this.mousePitch=new es({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),e.br(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),i.addEventListener("mousedown",this.mousedown),i.addEventListener("touchstart",this.touchstart,{passive:!1}),i.addEventListener("touchmove",this.touchmove),i.addEventListener("touchend",this.touchend),i.addEventListener("touchcancel",this.reset)}down(e,t){this.mouseRotate.mousedown(e,t),this.mousePitch&&this.mousePitch.mousedown(e,t),c()}move(e,t){const i=this.map,r=this.mouseRotate.mousemoveWindow(e,t),n=r&&r.bearingDelta;if(n&&i.setBearing(i.getBearing()+n),this.mousePitch){const r=this.mousePitch.mousemoveWindow(e,t),n=r&&r.pitchDelta;n&&i.setPitch(i.getPitch()+n)}}off(){const e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart,{passive:!1}),e.removeEventListener("touchmove",this.touchmove),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){u(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(e.Q({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),d(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(e){this.move(e,d(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=f(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){1!==e.targetTouches.length?this.reset():(this._lastPos=f(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}const Gs={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},qs={maxWidth:100,unit:"metric"},Hs={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},Zs={version:e.dw,supported:t,setRTLTextPlugin:e.dy,getRTLTextPluginStatus:e.dz,Map:class extends As{constructor(t){e.df.mark(e.dg.create);const i=t;if(null!=(t=e.Q({},Us,t)).minZoom&&null!=t.maxZoom&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=t.minPitch&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=t.maxPitch&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(t.antialias&&e.dh(window)&&(t.antialias=!1,e.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new ui(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),t),this._repaint=!!t.repaint,this._interactive=t.interactive,this._minTileCacheSize=t.minTileCacheSize,this._maxTileCacheSize=t.maxTileCacheSize,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._antialias=t.antialias,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=t.crossSourceCollisions,this._collectResourceTiming=t.collectResourceTiming,this._language=this._parseLanguage(t.language),this._worldview=t.worldview,this._renderTaskQueue=new Ls,this._domRenderTaskQueue=new Ls,this._controls=[],this._markers=[],this._popups=[],this._mapId=e.di(),this._locale=e.Q({},Ns,t.locale),this._clickTolerance=t.clickTolerance,this._cooperativeGestures=t.cooperativeGestures,this._performanceMetricsCollection=t.performanceMetricsCollection,this._tessellationStep=t.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=t.precompilePrograms,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Bs(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._requestManager=new e.dj(t.transformRequest,t.accessToken,t.testMode),this._silenceAuthErrors=!!t.testMode,this._contextCreateOptions=t.contextCreateOptions?{...t.contextCreateOptions}:{},"string"==typeof t.container){const e=document.getElementById(t.container);if(!e)throw new Error(`Container '${t.container.toString()}' not found.`);this._container=e}else{if(!(t.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=t.container}if(this._container.childNodes.length>0&&e.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),t.max
1Bounds&&this.setMaxBounds(t.maxBounds),e.br(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new js),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},(()=>{this._update()})),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");if(this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new Ss(this,t),this._localFontFamily=t.localFontFamily,this._localIdeographFontFamily=t.localIdeographFontFamily,(t.style||!t.testMode)&&this.setStyle(t.style||e.db.DEFAULT_STYLE,{config:t.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),t.projection&&this.setProjection(t.projection),t.hash&&(this._hash=new ko("string"==typeof t.hash&&t.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){null==i.center&&null==i.zoom||(this.transform._unmodified=!1),this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch});const r=t.bounds;r&&(this.resize(),this.fitBounds(r,e.Q({},t.fitBoundsOptions,{duration:0})))}this.resize(),t.attributionControl&&this.addControl(new Is({customAttribution:t.customAttribution})),this._logoControl=new ks,this.addControl(this._logoControl,t.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()})),this.on("data",(t=>{this._update("style"===t.dataType),this.fire(new e.g(`${t.dataType}data`,t))})),this.on("dataloading",(t=>{this.fire(new e.g(`${t.dataType}dataloading`,t))}))}_getMapId(){return this._mapId}addControl(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.f(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const r=t.onAdd(this);this._controls.push(t);const n=this._controlPositions[i];return-1!==i.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.f(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(t){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const i=!this._moving;return i&&this.fire(new e.g("movestart",t)).fire(new e.g("move",t)),this.fire(new e.g("resize",t)),i&&this.fire(new e.g("moveend",t)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(t){return this.transform.setMaxBounds(e.aj.convert(t)),this._update()}setMinZoom(t){if((t=t??-2)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t?this.setZoom(t):this.fire(new e.g("zoomstart")).fire(new e.g("zoom")).fire(new e.g("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=t??22)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t?this.setZoom(t):this.fire(new e.g("zoomstart")).fire(new e.g("zoom")).fire(new e.g("zoomend")),this;
1throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=t??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t?this.setPitch(t):this.fire(new e.g("pitchstart")).fire(new e.g("pitch")).fire(new e.g("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=t??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t?this.setPitch(t):this.fire(new e.g("pitchstart")).fire(new e.g("pitch")).fire(new e.g("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(e){return"auto"===e?navigator.language:Array.isArray(e)?0===e.length?void 0:e.map((e=>"auto"===e?navigator.language:e)):e}setLanguage(e){const t=this._parseLanguage(e);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const e of this._controls)e._setLanguage&&e._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(e){return this.style&&e!==this._worldview?(this._worldview=e,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(e){return this._lazyInitEmptyStyle(),e?"string"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.projection)}_updateProjectionTransition(){if("globe"!==this.getProjection().name)return;const t=this.transform,i=t.projection.name;let r;"globe"===i&&t.zoom>=e.aV?(t.setMercatorFromTransition(),r=!0):"mercator"===i&&t.zoom<e.aV&&(t.setProjection({name:"globe"}),r=!0),r&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate())}_prioritizeAndUpdateProjection(e,t){return this._updateProjection(e||t||{name:"mercator"})}_updateProjection(t){let i;return i="globe"===t.name&&this.transform.zoom>=e.aV?this.transform.setMercatorFromTransition():this.transform.setProjection(t),this.style.applyProjectionUpdate(),i&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(t){return this.transform.locationPoint3D(e.aJ.convert(t))}unproject(t){return this.transform.pointLocation3D(e.P.convert(t))}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(e,t,i){if("mouseenter"===e||"mouseover"===e){let r=!1;const n=n=>{const o=t.filter((e=>this.getLayer(e))),s=o.length?this.queryRenderedFeatures(n.point,{layers:o}):[];s.length?r||(r=!0,i.call(this,new jo(e,this,n.originalEvent,{features:s}))):r=!1},o=()=>{r=!1};return{layers:new Set(t),listener:i,delegates:{mousemove:n,mouseout:o}}}if("mouseleave"===e||"mouseout"===e){let r=!1;const n=n=>{const o=t.filter((e=>this.getLayer(e)));(o.length?this.queryRenderedFeatures(n.point,{layers:o}):[]).length?r=!0:r&&(r=!1,i.call(this,new jo(e,this,n.originalEvent)))},o=t=>{r&&(r=!1,i.call(this,new jo(e,this,t.originalEvent)))};return{layers:new Set(t),listener:i,delegates:{mousemove:n,mouseout:o}}}{const r=e=>{const r=t.filter((e=>this.getLayer(e))),n=r.length?this.queryRenderedFeatures(e.point,{layers:r}):[];n.length&&(e.features=n,i.call(this,e),delete e.features)};return{layers:new Set(t),listener:i,delegates:{[e]:r}}}}on(e,t,i){if("function"==typeof t||void 0===i)return super.on(e,t);if(Array.isArray(t)||(t=[t]),t)for(const e of t)if(!this._isValidId(e))return this;const r=this._createDelegatedListener(e,t,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(r);for(const e in r.delegates)this.on(e,r.delegates[e]);return this}once(e,t,i){if("function"==typeof t||void 0===i)return super.once(e,t);if(Array.isArray(t)||(t=[t]),t)for(const e of t)if(!this._isValidId(e))return this;const r=this._createDelegatedListener(e,t,i);for(const e in r.delegates)this.once(e,r.delegates[e]);return this}off(e,t,i){if("function"==typeof t||void 0===i)return super.off(e,t);const r=new Set(Array.isArray(t)?t:[t]);for(const e of r)if(!this._isValidId(e))return this;const n=(e,t)=>{if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0},o=this._delegatedListeners?this._delegatedListeners[e]:void 0;return o&&(e=>{for(let t=0;t<e.length;t++){const o=e[t];if(o.listener===i&&n(o.layers,r)){for(const e in o.delegates)this.off(e,o.delegates[e]);return e.splice(t,1),this}}})(o),this}queryRenderedFeatures(t,i){if(!this.style)return[];if(void 0!==i||void 0===t||t instanceof e.P||Array.isArray(t)||(i=t,t=void 0),t=t||[[0,0],[this.transform.width,this.transform.height]],(i=i||{}).layers&&Array.isArray(i.layers))for(const e of i.layers)if(!this._isValidId(e))return[];return this.style.queryRenderedFeatures(t,i,this.transform)}querySourceFeatures(e,t){return this._isValidId(e)?this.style.querySourceFeatures(e,t):[]}isPointOnSurface(t){const{name:i}=this.transform.projection;return"globe"!==i&&"mercator"!==i&&e.w(`${i} projection does not support isPointOnSurface, this API may behave unex
1pectedly.`),this.transform.isPointOnSurface(e.P.convert(t))}setStyle(t,i){return i=e.Q({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},i),this.style&&t&&!1!==i.diff&&i.localFontFamily===this._localFontFamily&&i.localIdeographFontFamily===this._localIdeographFontFamily&&!i.config?(this.style._diffStyle(t,((r,n)=>{r?(e.w(`Unable to perform style diff: ${String(r.message||r.error||r)}. Rebuilding the style from scratch.`),this._updateStyle(t,i)):n&&this._update(!0)}),(()=>{this._postStyleLoadEvent()})),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._localFontFamily=i.localFontFamily,this._updateStyle(t,i))}_getUIString(e){const t=this._locale[e];if(null==t)throw new Error(`Missing UI string '${e}'`);return t}_updateStyle(t,i){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),t){const r=e.Q({},i);i&&i.config&&(r.initialConfig=i.config,delete r.config),this.style=new Ao(this,r).load(t),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Ao(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(e.w("There is no style added to the map."),!1)}_isValidId(t){return null==t?(this.fire(new e.f(new Error("IDs can't be empty."))),!1):!e.cY(t)||(this.fire(new e.f(new Error(`IDs can't contain special symbols: "${t}".`))),!1)}addSource(e,t){return this._isValidId(e)?(this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)):this}isSourceLoaded(e){return!!this._isValidId(e)&&!!this.style&&this.style._isSourceCacheLoaded(e)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(e,t,i){this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,i)}removeSource(e){return this._isValidId(e)?(this.style.removeSource(e),this._updateTerrain(),this._update(!0)):this}getSource(e){return this._isValidId(e)?this.style.getOwnSource(e):null}addImage(t,i,{pixelRatio:r=1,sdf:n=!1,stretchX:o,stretchY:s,content:a}={}){if(this._lazyInitEmptyStyle(),i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap){const{width:l,height:c,data:u}=e.e.getImageData(i);this.style.addImage(t,{data:new e.j({width:l,height:c},u),pixelRatio:r,stretchX:o,stretchY:s,content:a,sdf:n,version:0})}else if(void 0===i.width||void 0===i.height)this.fire(new e.f(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:l,height:c}=i,u=i;this.style.addImage(t,{data:new e.j({width:l,height:c},new Uint8Array(u.data)),pixelRatio:r,stretchX:o,stretchY:s,content:a,sdf:n,version:0,userImage:u}),u.onAdd&&u.onAdd(this,t)}}updateImage(t,i){this._lazyInitEmptyStyle();const r=this.style.getImage(t);if(!r)return void this.fire(new e.f(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const n=i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap?e.e.getImageData(i):i,{width:o,height:s,data:a}=n;if(void 0===o||void 0===s)return void this.fire(new e.f(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(o!==r.data.width||s!==r.data.height)return void this.fire(new e.f(new Error(`The width and height of the updated image (${o}, ${s})\n must be that same as the previous version of the image\n (${r.data.width}, ${r.data.height})`)));const l=!(i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap);r.data.replace(a,l),this.style.updateImage(t,r)}hasImage(t){return t?!!this.style&&!!this.style.getImage(t):(this.fire(new e.f(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(t,i){e.i(this._requestManager.transformRequest(t,e.R.Image),((t,r)=>{i(t,r instanceof HTMLImageElement?e.e.getImageData(r):r)}))}listImages(){return this.style.listImages()}addModel(e,t){this._lazyInitEmptyStyle(),this.style.addModel(e,t)}hasModel(t){return t?this.style.hasModel(t):(this.fire(new e.f(new Error("Missing required model id"))),!1)}removeModel(e){this.style.removeModel(e)}listModels(){return this.style.listModels()}addLayer(e,t){return this._isValidId(e.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)):this}getSlot(e){const t=this.getLayer(e);return t&&t.slot||null}setSlot(e,t){return this.style.setSlot(e,t),this.style.mergeLayers(),this._update(!0)}
vendor: 4,524 bytes, line 1
1addImport(e,t){return this.style.addImport(e,t),this}updateImport(e,t){return"string"!=typeof t&&t.id!==e?(this.removeImport(e),this.addImport(t)):(this.style.updateImport(e,t),this._update(!0))}removeImport(e){return this.style.removeImport(e),this}moveImport(e,t){return this.style.moveImport(e,t),this._update(!0)}moveLayer(e,t){return this._isValidId(e)?(this.style.moveLayer(e,t),this._update(!0)):this}removeLayer(e){return this._isValidId(e)?(this.style.removeLayer(e),this._update(!0)):this}getLayer(e){if(!this._isValidId(e))return null;const t=this.style.getOwnLayer(e);return t?"custom"===t.type?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(e,t,i){return this._isValidId(e)?(this.style.setLayerZoomRange(e,t,i),this._update(!0)):this}setFilter(e,t,i={}){return this._isValidId(e)?(this.style.setFilter(e,t,i),this._update(!0)):this}getFilter(e){return this._isValidId(e)?this.style.getFilter(e):null}setPaintProperty(e,t,i,r={}){return this._isValidId(e)?(this.style.setPaintProperty(e,t,i,r),this._update(!0)):this}getPaintProperty(e,t){return this._isValidId(e)?this.style.getPaintProperty(e,t):null}setLayoutProperty(e,t,i,r={}){return this._isValidId(e)?(this.style.setLayoutProperty(e,t,i,r),this._update(!0)):this}getLayoutProperty(e,t){return this._isValidId(e)?this.style.getLayoutProperty(e,t):null}getSchema(e){return this.style.getSchema(e)}setSchema(e,t){return this.style.setSchema(e,t),this._update(!0)}getConfig(e){return this.style.getConfig(e)}setConfig(e,t){return this.style.setConfig(e,t),this._update(!0)}getConfigProperty(e,t){return this.style.getConfigProperty(e,t)}setConfigProperty(e,t,i){return this.style.setConfigProperty(e,t,i),this._update(!0)}setLights(e){if(this._lazyInitEmptyStyle(),e&&1===e.length&&"flat"===e[0].type){const t=e[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(e),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const e=this.style.getLights()||[];return 0===e.length&&e.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),e}setLight(e,t={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:e}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(e){return this._lazyInitEmptyStyle(),!e&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setColorTheme(e){return this._lazyInitEmptyStyle(),this.style.setColorTheme(e),this._update(!0)}setCamera(e){return this.style.setCamera(e),this._triggerCameraUpdate(e)}_triggerCameraUpdate(e){return this._update(this.transform.setOrthographicProjectionAtLowPitch("orthographic"===e["camera-projection"]))}getCamera(){return this.style.camera}_queryFogOpacity(t){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(e.aJ.convert(t),this.transform):0}setFeatureState(e,t){return this._isValidId(e.source)?(this.style.setFeatureState(e,t),this._update()):this}removeFeatureState(e,t){return this._isValidId(e.source)?(this.style.removeFeatureState(e,t),this._update()):this}getFeatureState(e){return this._isValidId(e.source)?this.style.getFeatureState(e):null}_updateContainerDimensions(){if(!this._container)return;const e=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let i,r,n,o=this._container;for(;o&&(!r||!n);){const e=window.getComputedStyle(o).transform;e&&"none"!==e&&(i=e.match(/matrix.*\((.+)\)/)[1].split(", "),i[0]&&"0"!==i[0]&&"1"!==i[0]&&(r=i[0]),i[3]&&"0"!==i[3]&&"1"!==i[3]&&(n=i[3])),o=o.parentElement}this._containerWidth=r?Math.abs(e/r):e,this._containerHeight=n?Math.abs(t/n):t}_detectMissingCSS(){"rgb(250, 128, 114)"!==window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&e.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described
1in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=n("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=n("div","mapboxgl-canvas-container",e);this._canvas=n("canvas","mapboxgl-canvas",t),this._interactive&&(t.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const i=this._controlContainer=n("div","mapboxgl-control-container",e),r=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((e=>{r[e]=n("div",`mapboxgl-ctrl-${e}`,i)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,i){const r=e.e.devicePixelRatio||1;this._canvas.width=r*Math.ceil(t),this._canvas.height=r*Math.ceil(i),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${i}px`}_addMarker(e){this._markers.push(e)}_removeMarker(e){const t=this._markers.indexOf(e);-1!==t&&this._markers.splice(t,1)}_addPopup(e){this._popups.push(e)}_removePopup(e){const t=this._popups.indexOf(e);-1!==t&&this._popups.splice(t,1)}_setupPainter(){const i=e.Q({},t.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl2",i);r?(e.dk(r,!0),this.painter=new En(r,this._contextCreateOptions,this.transform,this._tp),this.on("data",(e=>{"source"===e.dataType&&this.painter.setTileLoadedFlag(!0)})),e.dl.testSupport(r)):this.fire(new e.f(new Error("Failed to initialize WebGL")))}_contextLost(t){t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.g("webglcontextlost",{originalEvent:t}))}_contextRestored(t){this._setupPainter(),this.resize(),this._update(),this.fire(new e.g("webglcontextrestored",{originalEvent:t}))}_onMapScroll(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(e){return this.style?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_requestDomTask(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e)}_render(t){let i;this.fire(new e.g("renderstart")),++this._frameId;const r=this.painter.context.extTimerQuery,n=e.e.now(),o=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(i=o.createQuery(),o.beginQuery(r.TIME_ELAPSED_EXT,i)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(t),this._domRenderTaskQueue.run(t),this._removed)return;this._updateProjectionTransition();const s=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,i=this.transform.pitch,r=e.e.now(),n=new e.Y(t,{now:r,fadeDuration:s,pitch:i,transition:this.style.transition});this.style.update(n)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let a=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),a=this._updateAverageElevation(n),this.style.updateSources(this.transform),this._forceMar
vendor: 4,114 bytes, line 1
1kerAndPopupUpdate()):a=this._updateAverageElevation(n);const l=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,s,this._crossSourceCollisions,this.painter.replacementSource);if(l&&(this._placementDirty=l.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new e.g("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,e.df.mark(e.dg.load),this.fire(new e.g("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),i){const t=e.e.now()-n;o.endQuery(r.TIME_ELAPSED_EXT),setTimeout((()=>{const r=o.getQueryParameter(i,o.QUERY_RESULT)/1e6;o.deleteQuery(i),this.fire(new e.g("gpu-timing-frame",{cpuTime:t,gpuTime:r}))}),50)}if(this.listens("gpu-timing-layer")){const t=this.painter.collectGpuTimers();setTimeout((()=>{const i=this.painter.queryGpuTimers(t);this.fire(new e.g("gpu-timing-layer",{layerTimes:i}))}),50)}if(this.listens("gpu-timing-deferred-render")){const t=this.painter.collectDeferredRenderGpuQueries();setTimeout((()=>{const i=this.painter.queryGpuTimeDeferredRender(t);this.fire(new e.g("gpu-timing-deferred-render",{gpuTime:i}))}),50)}const c=this._sourcesDirty||this._styleDirty||this._placementDirty||a;if(c||this._repaint)this.triggerRepaint();else{const t=this.idle();if(t&&(a=this._updateAverageElevation(n,!0)),a)this.triggerRepaint();else if(this._triggerFrame(!1),t&&(this.fire(new e.g("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const t=this._calculateSpeedIndex();this.fire(new e.g("speedindexcompleted",{speedIndex:t})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||c||(this._fullyLoaded=!0,e.df.mark(e.dg.fullLoad),this._performanceMetricsCollection&&e.dm(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(e){for(const t of this._markers)e&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!e||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(e,t=!1){const i=e=>(this.transform.averageElevation=e,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&i(0);const r=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(r||(t||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){const t=this.transform.averageElevation;let n=this.transform.sampleAverageElevation();null!=this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(n)?n=0:this._averageElevationLastSampledAt=e;const o=Math.abs(t-n);if(o>1){if(this._isInitialLoad||r)return this._averageElevation.jumpTo(n),i(n);this._averageElevation.easeTo(n,e,300)}else if(o>1e-4)return this._averageElevation.jumpTo(n),i(n)}return!!this._averageElevation.isEasing(e)&&i(this._averageElevation.getValue(e))}_authenticate(){e.dn(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(t=>
vendor: 11,123 bytes, line 1
1{if(t&&(t.message===e.dp||401===t.status)){const t=this.painter.context.gl;e.dk(t,!1),this._logoControl instanceof ks&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new e.f(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}})),e.dq(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(()=>{}))}_postStyleLoadEvent(){this.style.globalId&&e.dr(this._requestManager._customAccessToken,{map:this,skuToken:this._requestManager._skuToken,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){const e=this._isDragging();this.painter.updateTerrain(this.style,e)}_calculateSpeedIndex(){const e=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const i=this.painter.context.gl,r=i.createFramebuffer();function n(e){i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0);const t=new Uint8Array(i.drawingBufferWidth*i.drawingBufferHeight*4);return i.readPixels(0,0,i.drawingBufferWidth,i.drawingBufferHeight,i.RGBA,i.UNSIGNED_BYTE,t),t}return i.bindFramebuffer(i.FRAMEBUFFER,r),this._canvasPixelComparison(n(e),t.canvasCopies.map(n),t.timeStamps)}_canvasPixelComparison(e,t,i){let r=i[1]-i[0];const n=e.length/4;for(let o=0;o<t.length;o++){const s=t[o];let a=0;for(let t=0;t<s.length;t+=4)s[t]===e[t]&&s[t+1]===e[t+1]&&s[t+2]===e[t+2]&&s[t+3]===e[t+3]&&(a+=1);r+=(i[o+2]-i[o+1])*(1-a/n)}return r}remove(){this._hash&&this._hash.remove();for(const e of this._controls)e.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),e.ds(this.painter.context.gl),e.dt.remove(),e.du.remove(),this._removed=!0,this.fire(new e.g("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(t){this._renderNextFrame=this._renderNextFrame||t,this.style&&!this._frame&&(this._frame=e.e.frame((e=>{const t=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,t&&this._render(e)})))}_preloadTiles(t){const i=this.style?this.style.getSourceCaches():[];return e.dv(i,((e,i)=>e._preloadTiles(t,i)),(()=>{this.triggerRepaint()})),this}_onWindowOnline(){this._update()}_onWindowResize(e){this._trackResize&&this.resize({originalEvent:e})._update()}_onVisibilityChange(){"hidden"===document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(e){this._showParseStatus!==e&&(this._showParseStatus=e,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(e){this._showLayers2DWireframe!==e&&(this._showLayers2DWireframe=e,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(e){this._showLayers3DWireframe!==e&&(this._showLayers3DWireframe=e,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(e){this._speedIndexTiming!==e&&(this._speedIndexTiming=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,this._tp.refreshUI(),e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(e){this._showTileAABBs!==e&&(this._showTileAABBs=e,this._tp.refreshUI(),e&&this._update())}_setCacheLimits(t,i){e.dx(t,i)}get version(){return e.dw}},NavigationControl:class{constructor(t={}){this.options=e.Q({},Vs,t),this._container=n("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(e.br(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(e=>{this._map&&this._map.zoomIn({},{originalEvent:e})})),n("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",(e=>{this._map&&this._map.zoomOut({},{originalEvent:e})})),n("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.br(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",(e=>{const t=this._map;t&&(this.options.visualizePitch?t.resetNorthPitch({},{originalEvent:e}):t.resetNorth({},{originalEvent:e}))})),this._compassIcon=n("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const e=this._map;if(!e)return;const t=e.getZoom(),i=t===e.getMaxZoom(),r=t===e.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())}_rotateCompassArrow(){const e=this._map;if(!e)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(e.transform.pitch*(Math.PI/180)),.5)}) rotateX(${e.transform.pitch}deg) rotateZ(${e.transform.angle*(180/Math.PI)}deg)`:`rotate(${e.transform.angle*(180/Math.PI)}deg)`;e._requestDomTask((()=>{this._compassIcon&&(this._compassIcon.style.transform=t)}))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),e.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&e.on("pitch",this._rotateCompassArrow),e.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new $s(e,this._compass,this.options.visualizePitch)),this._container}onRemove(){const e=this._map;e&&(this._container.remove(),this.options.showZoom&&e.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&e.off("pitch",this._rotateCompassArrow),e.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(e,t){const i=n("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}_setButtonTitle(e,t){if(!this._map)return;const i=this._map._getUIString(`NavigationControl.${t}`);e.setAttribute("aria-label",i),e.firstElementChild&&e.firstElementChild.setAttribute("title",i)}},GeolocateControl:class extends e.E{constructor(t={}){super();const i=navigator.geolocation;this.options=e.Q({geolocation:i},Gs,t),e.br(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=Io(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(e){return this._map=e,this._container=n("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(e){const t=(t=!!this.options.geolocation)=>{this._supportsGeolocation=t,e(t)};void 0!==this._supportsGeolocation?e(this._supportsGeolocation):void 0!==navigator.permissions?navigator.permissions.query({name:"geolocation"}).then((e=>t("denied"!==e.state))).catch((()=>t())):t()}_isOutOfMapMaxBounds(e){const t=this._map.getMaxBounds(),i=e.coords;return!!t&&(i.longitude<t.getWest()||i.longitude>t.getEast()||i.latitude<t.getSouth()||i.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(t){if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.g("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
1RROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.g("geolocate",t)),this._finish()}}_updateCamera(t){const i=new e.aJ(t.coords.longitude,t.coords.latitude),r=t.coords.accuracy,n=this._map.getBearing(),o=e.Q({bearing:n},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(r),o,{geolocateSource:!0})}_updateMarker(t){if(t){const i=new e.aJ(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const t=this._map.transform,i=e.ay(1,t._center.lat)*t.worldSize,r=Math.ceil(2*this._accuracy*i);this._circleElement.style.width=`${r}px`,this._circleElement.style.height=`${r}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(t){if(this._map){if(this.options.trackUserLocation)if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new e.g("error",t)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(t){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=n("button","mapboxgl-ctrl-geolocate",this._container),n("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===t){e.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",e),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
1se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=n("div","mapboxgl-user-location"),this._dotElement.appendChild(n("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(n("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new zs({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=n("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new zs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(t=>{t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new e.g("trackuserlocationend")))}))}}_onDeviceOrientation(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return e.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new e.g("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new e.g("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.g("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(e={maximumAge:6e5,timeout:0},this._noTimeout=!0):(e=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,e),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const e=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};"undefined"!=typeof DeviceMotionEvent&&"function"==typeof DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((t=>{"granted"===t&&e()})).catch(console.error):e()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
1se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Is,ScaleControl:class{constructor(t={}){this.options=e.Q({},qs,t),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch(e){return!1}}(),e.br(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const e=this.options.maxWidth||100,t=this._map,i=t._containerHeight/2,r=t._containerWidth/2-e/2,n=t.unproject([r,i]),o=t.unproject([r+e,i]),s=n.distanceTo(o);if("imperial"===this.options.unit){const t=3.2808*s;t>5280?this._setScale(e,t/5280,"mile"):this._setScale(e,t,"foot")}else"nautical"===this.options.unit?this._setScale(e,s/1852,"nautical-mile"):s>=1e3?this._setScale(e,s/1e3,"kilometer"):this._setScale(e,s,"meter")}_setScale(e,t,i){this._map._requestDomTask((()=>{const r=function(e){const t=Math.pow(10,`${Math.floor(e)}`.length-1);let i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){const t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i),t*i}(t),n=r/t;this._container.innerHTML=this._isNumberFormatSupported&&"nautical-mile"!==i?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:i}).format(r):`${r} ${Hs[i]}`,this._container.style.width=e*n+"px"}))}onAdd(e){return this._map=e,this._language=e.getLanguage(),this._container=n("div","mapboxgl-ctrl mapboxgl-ctrl-scale",e.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(e){this._language=e,this._update()}setUnit(e){this.options.unit=e,this._update()}},FullscreenControl:class{constructor(t={}){this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:e.w("Full screen control 'container' must be a DOM element.")),e.br(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=n("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const e=this._fullscreenButton=n("button","mapboxgl-ctrl-fullscreen",this._controlContainer);n("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",e)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends e.E{constructor(t){super(),this.options=e.Q(Object.create(Os),t),e.br(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(t&&t.className?t.className.trim().split(/\s+/):[])}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&t.on("preclick",this._onClose),this.options.closeOnMove&&t.on("move",this._onClose),t.on("remove",this.remove),this._update(),t._addPopup(this),this._focusFirstElement(),this._trackPointer?(t.on("mousemove",this._onMouseEvent),t.on("mouseup",this._onMouseEvent),t._canvasContainer.classList.add("mapboxgl-track-pointer")):t.on("move",this._update),this.fire(new e.g("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const t=this._map;return t&&(t.off("move",this._update),t.off("move",this._onClose),t.off("preclick",this._onClose),t.off("click",this._onClose),t.off("remove",this.remove),t.off("mousemove",this._onMouseEvent),t.off("mouseup",this._onMouseEvent),t.off("drag",this._onMouseEvent),t._canvasContainer&&t._canvasContainer.classList.remove("mapboxgl-track-pointer"),t._removePopup(this),this._map=void 0),this.fire(new e.g("close")),this}getLngLat(){return this._lngLat}setLngLat(t){this._lngLat=e.aJ.convert(t),this._pos=null,this._trackPointer=!1,this._update();const i=this._map;return i&&(i.on("move",this._update),i.off("mousemove",this._onMouseEvent),i._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const e=this._map;return e&&(e.off("move",this._update),e.on("mousemove",this._onMouseEvent),e.on("drag",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){const t=document.createDocumentFragment(),i=document.createElement("body");let r;for(i.innerHTML=e;r=i.firstChild,r;)t.appendChild(r);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=n("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(e),this.options.closeButton){const e=this._closeButton=n("button","mapboxgl-popup-close-button",t);e.type="button",e.setAttribute("aria-label","Close popup"),e.setAttribute("aria-hidden","true"),e.innerHTML="×",e.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(e){return this._classList.add(e),this._updateClassList(),this}removeClassName(e){return this._classList.delete(e),this._updateClassList(),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){let t;return this._classList.delete(e)?t=!1:(this._classList.add(e),t=!0),this._updateClassList(),t}_onMouseEvent(e){this._update(e.point)}_getAnchor(e){if(this.options.anchor)return this.options.anchor;const t=this._map,i=this._container,r=this._pos;if(!t||!i||!r)return"bottom";const n=i.offsetWidth,o=i.offsetHeight,s=r.x<n/2,a=r.x>t.transform.width-n/2;
1if(r.y+e<o)return s?"top-left":a?"top-right":"top";if(r.y>t.transform.height-o){if(s)return"bottom-left";if(a)return"bottom-right"}return s?"left":a?"right":"bottom"}_updateClassList(){const e=this._container;if(!e)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),e.className=t.join(" ")}_update(t){const i=this._map,r=this._content;if(!i||!this._lngLat&&!this._trackPointer||!r)return;let o=this._container;if(o||(o=this._container=n("div","mapboxgl-popup",i.getContainer()),this._tip=n("div","mapboxgl-popup-tip",o),o.appendChild(r)),this.options.maxWidth&&o.style.maxWidth!==this.options.maxWidth&&(o.style.maxWidth=this.options.maxWidth),i.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ps(this._lngLat,this._pos,i.transform)),!this._trackPointer||t){const r=this._pos=this._trackPointer&&t instanceof e.P?t:i.project(this._lngLat),n=Fs(this.options.offset),o=this._anchor=this._getAnchor(n.y),s=Fs(this.options.offset,o),a=r.add(s).round();i._requestDomTask((()=>{this._container&&o&&(this._container.style.transform=`${Rs[o]} translate(${a.x}px,${a.y}px)`)}))}if(!this._marker&&i._showingGlobe()){const t=e.dc(i.transform,this._lngLat)?0:1;this._setOpacity(t)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(Ds);e&&e.focus()}_onClose(){this.remove()}_setOpacity(e){this._container&&(this._container.style.opacity=`${e}`),this._content&&(this._content.style.pointerEvents=e?"auto":"none")}},Marker:zs,Style:Ao,LngLat:e.aJ,LngLatBounds:e.aj,Point:e.P,MercatorCoordinate:e._,FreeCameraOptions:$t,Evented:e.E,config:e.db,prewarm:e.dA,clearPrewarmedResources:e.dB,get accessToken(){return e.db.ACCESS_TOKEN},set accessToken(t){e.db.ACCESS_TOKEN=t},get baseApiUrl(){return e.db.API_URL},set baseApiUrl(t){e.db.API_URL=t},get workerCount(){return e.dC.workerCount},set workerCount(t){e.dC.workerCount=t},get maxParallelImageRequests(){return e.db.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.db.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(t){e.dD(t)},get workerUrl(){return e.dE.workerUrl},set workerUrl(t){e.dE.workerUrl=t},get workerClass(){return e.dE.workerClass},set workerClass(t){e.dE.workerClass=t},get workerParams(){return e.dE.workerParams},set workerParams(t){e.dE.workerParams=t},get dracoUrl(){return e.dF()},set dracoUrl(t){e.dG(t)},get meshoptUrl(){return e.dH()},set meshoptUrl(t){e.dI(t)},setNow:e.e.setNow,restoreNow:e.e.restoreNow};return Zs}));return i}));!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).DOMPurify=t()}(this,(function(){"use strict";function e(t){return(e="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)}function t(e,i){return t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(e,i)}function i(e,r,n){return i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(e,i,r){var n=[null];n.push.apply(n,i);var o=new(Function.bind.apply(e,n));return r&&t(o,r.prototype),o},i.apply(null,arguments)}function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var r,n,o=[],s=!0,a=!1;try{for(i=i.call(e);!(s=(r=i.next()).done)&&(o.push(r.value),!t||o.length!==t);s=!0);}catch(e){a=!0,n=e}finally{try{s||null==i.return||i.return()}finally{if(a)throw n}}return o}}(e,t)||o(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||o(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){if(e){if("string"==typeof e)return s(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?s(e,t):void 0}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}var a=Object.entries,l=Object.setPrototypeOf,c=Object.isFrozen,u=Object.getPrototypeOf,h=Object.getOwnPropertyDescriptor,p=Object.freeze,d=Object.
1seal,f=Object.create,m="undefined"!=typeof Reflect&&Reflect,_=m.apply,g=m.construct;_||(_=function(e,t,i){return e.apply(t,i)}),p||(p=function(e){return e}),d||(d=function(e){return e}),g||(g=function(e,t){return i(e,n(t))});var y,v=k(Array.prototype.forEach),x=k(Array.prototype.pop),b=k(Array.prototype.push),w=k(String.prototype.toLowerCase),T=k(String.prototype.toString),M=k(String.prototype.match),E=k(String.prototype.replace),S=k(String.prototype.indexOf),C=k(String.prototype.trim),A=k(RegExp.prototype.test),I=(y=TypeError,function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return g(y,t)});function k(e){return function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];return _(e,t,r)}}function L(e,t,i){i=i||w,l&&l(e,null);for(var r=t.length;r--;){var n=t[r];if("string"==typeof n){var o=i(n);o!==n&&(c(t)||(t[r]=o),n=o)}e[n]=!0}return e}function P(e){var t,i=f(null),n=function(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=o(e))){i&&(e=i);var r=0,n=function(){};return{s:n,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,l=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return a=e.done,e},e:function(e){l=!0,s=e},f:function(){try{a||null==i.return||i.return()}finally{if(l)throw s}}}}(a(e));try{for(n.s();!(t=n.n()).done;){var s=r(t.value,2),l=s[0],c=s[1];i[l]=c}}catch(e){n.e(e)}finally{n.f()}return i}function R(e,t){for(;null!==e;){var i=h(e,t);if(i){if(i.get)return k(i.get);if("function"==typeof i.value)return k(i.value)}e=u(e)}return function(e){return console.warn("fallback value for",e),null}}var z=p(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),O=p(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),D=p(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),F=p(["animate","color-profile","cursor","discard","fedropshadow","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),B=p(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),N=p(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),j=p(["#text"]),U=p(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","
1spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),V=p(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),$=p(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),G=p(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),q=d(/\{\{[\w\W]*|[\w\W]*\}\}/gm),H=d(/<%[\w\W]*|[\w\W]*%>/gm),Z=d(/\${[\w\W]*}/gm),W=d(/^data-[\-\w.\u00B7-\uFFFF]/),X=d(/^aria-[\-\w]+$/),Q=d(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Y=d(/^(?:\w+script|data):/i),J=d(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),K=d(/^html$/i),ee=function t(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window,r=function(e){return t(e)};if(r.version="3.0.0",r.removed=[],!i||!i.document||9!==i.document.nodeType)return r.isSupported=!1,r;var o=i.document,s=i.document,l=i.DocumentFragment,c=i.HTMLTemplateElement,u=i.Node,h=i.Element,d=i.NodeFilter,f=i.NamedNodeMap,m=void 0===f?i.NamedNodeMap||i.MozNamedAttrMap:f,_=i.HTMLFormElement,g=i.DOMParser,y=i.trustedTypes,k=h.prototype,ee=R(k,"cloneNode"),te=R(k,"nextSibling"),ie=R(k,"childNodes"),re=R(k,"parentNode");if("function"==typeof c){var ne=s.createElement("template");ne.content&&ne.content.ownerDocument&&(s=ne.content.ownerDocument)}var oe=function(t,i){if("object"!==e(t)||"function"!=typeof t.createPolicy)return null;
vendor: 4,213 bytes, line 1
1var r=null,n="data-tt-policy-suffix";i.currentScript&&i.currentScript.hasAttribute(n)&&(r=i.currentScript.getAttribute(n));var o="dompurify"+(r?"#"+r:"");try{return t.createPolicy(o,{createHTML:function(e){return e},createScriptURL:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(y,o),se=oe?oe.createHTML(""):"",ae=s,le=ae.implementation,ce=ae.createNodeIterator,ue=ae.createDocumentFragment,he=ae.getElementsByTagName,pe=o.importNode,de={};r.isSupported="function"==typeof a&&"function"==typeof re&&le&&void 0!==le.createHTMLDocument;var fe,me,_e=q,ge=H,ye=Z,ve=W,xe=X,be=Y,we=J,Te=Q,Me=null,Ee=L({},[].concat(n(z),n(O),n(D),n(B),n(j))),Se=null,Ce=L({},[].concat(n(U),n(V),n($),n(G))),Ae=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ie=null,ke=null,Le=!0,Pe=!0,Re=!1,ze=!0,Oe=!1,De=!1,Fe=!1,Be=!1,Ne=!1,je=!1,Ue=!1,Ve=!0,$e=!1,Ge=!0,qe=!1,He={},Ze=null,We=L({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Xe=null,Qe=L({},["audio","video","img","source","image","track"]),Ye=null,Je=L({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ke="http://www.w3.org/1998/Math/MathML",et="http://www.w3.org/2000/svg",tt="http://www.w3.org/1999/xhtml",it=tt,rt=!1,nt=null,ot=L({},[Ke,et,tt],T),st=["application/xhtml+xml","text/html"],at=null,lt=s.createElement("form"),ct=function(e){return e instanceof RegExp||e instanceof Function},ut=function(t){at&&at===t||(t&&"object"===e(t)||(t={}),t=P(t),fe=fe=-1===st.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,me="application/xhtml+xml"===fe?T:w,Me="ALLOWED_TAGS"in t?L({},t.ALLOWED_TAGS,me):Ee,Se="ALLOWED_ATTR"in t?L({},t.ALLOWED_ATTR,me):Ce,nt="ALLOWED_NAMESPACES"in t?L({},t.ALLOWED_NAMESPACES,T):ot,Ye="ADD_URI_SAFE_ATTR"in t?L(P(Je),t.ADD_URI_SAFE_ATTR,me):Je,Xe="ADD_DATA_URI_TAGS"in t?L(P(Qe),t.ADD_DATA_URI_TAGS,me):Qe,Ze="FORBID_CONTENTS"in t?L({},t.FORBID_CONTENTS,me):We,Ie="FORBID_TAGS"in t?L({},t.FORBID_TAGS,me):{},ke="FORBID_ATTR"in t?L({},t.FORBID_ATTR,me):{},He="USE_PROFILES"in t&&t.USE_PROFILES,Le=!1!==t.ALLOW_ARIA_ATTR,Pe=!1!==t.ALLOW_DATA_ATTR,Re=t.ALLOW_UNKNOWN_PROTOCOLS||!1,ze=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,Oe=t.SAFE_FOR_TEMPLATES||!1,De=t.WHOLE_DOCUMENT||!1,Ne=t.RETURN_DOM||!1,je=t.RETURN_DOM_FRAGMENT||!1,Ue=t.RETURN_TRUSTED_TYPE||!1,Be=t.FORCE_BODY||!1,Ve=!1!==t.SANITIZE_DOM,$e=t.SANITIZE_NAMED_PROPS||!1,Ge=!1!==t.KEEP_CONTENT,qe=t.IN_PLACE||!1,Te=t.ALLOWED_URI_REGEXP||Te,it=t.NAMESPACE||tt,t.CUSTOM_ELEMENT_HANDLING&&ct(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Ae.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&ct(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Ae.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Ae.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Oe&&(Pe=!1),je&&(Ne=!0),He&&(Me=L({},n(j)),Se=[],!0===He.html&&(L(Me,z),L(Se,U)),!0===He.svg&&(L(Me,O),L(Se,V),L(Se,G)),!0===He.svgFilters&&(L(Me,D),L(Se,V),L(Se,G)),!0===He.mathMl&&(L(Me,B),L(Se,$),L(Se,G))),t.ADD_TAGS&&(Me===Ee&&(Me=P(Me)),L(Me,t.ADD_TAGS,me)),t.ADD_ATTR&&(Se===Ce&&(Se=P(Se)),L(Se,t.ADD_ATTR,me)),t.ADD_URI_SAFE_ATTR&&L(Ye,t.ADD_URI_SAFE_ATTR,me),t.FORBID_CONTENTS&&(Ze===We&&(Ze=P(Ze)),L(Ze,t.FORBID_CONTENTS,me)),Ge&&(Me["#text"]=!0),De&&L(Me,["html","head","body"]),Me.table&&(L(Me,["tbody"]),delete Ie.tbody),p&&p(t),at=t)},ht=L({},["mi","mo","mn","ms","mtext"]),pt=L({},["foreignobject","desc","title","annotation-xml"]),dt=L({},["title","style","font","a","script"]),ft=L({},O);L(ft,D),L(ft,F);var mt=L({},B);L(mt,N);var _t=function(e){b(r.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}}
vendor: 4,245 bytes, line 1
1,gt=function(e,t){try{b(r.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){b(r.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!Se[e])if(Ne||je)try{_t(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},yt=function(e){var t,i;if(Be)e="<remove></remove>"+e;else{var r=M(e,/^[\r\n\t ]+/);i=r&&r[0]}"application/xhtml+xml"===fe&&it===tt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");var n=oe?oe.createHTML(e):e;if(it===tt)try{t=(new g).parseFromString(n,fe)}catch(e){}if(!t||!t.documentElement){t=le.createDocument(it,"template",null);try{t.documentElement.innerHTML=rt?se:n}catch(e){}}var o=t.body||t.documentElement;return e&&i&&o.insertBefore(s.createTextNode(i),o.childNodes[0]||null),it===tt?he.call(t,De?"html":"body")[0]:De?t.documentElement:o},vt=function(e){return ce.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT,null,!1)},xt=function(t){return"object"===e(u)?t instanceof u:t&&"object"===e(t)&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},bt=function(e,t,i){de[e]&&v(de[e],(function(e){e.call(r,t,i,at)}))},wt=function(e){var t;if(bt("beforeSanitizeElements",e,null),function(e){return e instanceof _&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof m)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)}(e))return _t(e),!0;var i=me(e.nodeName);if(bt("uponSanitizeElement",e,{tagName:i,allowedTags:Me}),e.hasChildNodes()&&!xt(e.firstElementChild)&&(!xt(e.content)||!xt(e.content.firstElementChild))&&A(/<[/\w]/g,e.innerHTML)&&A(/<[/\w]/g,e.textContent))return _t(e),!0;if(!Me[i]||Ie[i]){if(!Ie[i]&&Mt(i)){if(Ae.tagNameCheck instanceof RegExp&&A(Ae.tagNameCheck,i))return!1;if(Ae.tagNameCheck instanceof Function&&Ae.tagNameCheck(i))return!1}if(Ge&&!Ze[i]){var n=re(e)||e.parentNode,o=ie(e)||e.childNodes;if(o&&n)for(var s=o.length-1;s>=0;--s)n.insertBefore(ee(o[s],!0),te(e))}return _t(e),!0}return e instanceof h&&!function(e){var t=re(e);t&&t.tagName||(t={namespaceURI:it,tagName:"template"});var i=w(e.tagName),r=w(t.tagName);return!!nt[e.namespaceURI]&&(e.namespaceURI===et?t.namespaceURI===tt?"svg"===i:t.namespaceURI===Ke?"svg"===i&&("annotation-xml"===r||ht[r]):Boolean(ft[i]):e.namespaceURI===Ke?t.namespaceURI===tt?"math"===i:t.namespaceURI===et?"math"===i&&pt[r]:Boolean(mt[i]):e.namespaceURI===tt?!(t.namespaceURI===et&&!pt[r])&&!(t.namespaceURI===Ke&&!ht[r])&&!mt[i]&&(dt[i]||!ft[i]):!("application/xhtml+xml"!==fe||!nt[e.namespaceURI]))}(e)?(_t(e),!0):"noscript"!==i&&"noembed"!==i||!A(/<\/no(script|embed)/i,e.innerHTML)?(Oe&&3===e.nodeType&&(t=e.textContent,t=E(t,_e," "),t=E(t,ge," "),t=E(t,ye," "),e.textContent!==t&&(b(r.removed,{element:e.cloneNode()}),e.textContent=t)),bt("afterSanitizeElements",e,null),!1):(_t(e),!0)},Tt=function(e,t,i){if(Ve&&("id"===t||"name"===t)&&(i in s||i in lt))return!1;if(Pe&&!ke[t]&&A(ve,t));else if(Le&&A(xe,t));else if(!Se[t]||ke[t]){if(!(Mt(e)&&(Ae.tagNameCheck instanceof RegExp&&A(Ae.tagNameCheck,e)||Ae.tagNameCheck instanceof Function&&Ae.tagNameCheck(e))&&(Ae.attributeNameCheck instanceof RegExp&&A(Ae.attributeNameCheck,t)||Ae.attributeNameCheck instanceof Function&&Ae.attributeNameCheck(t))||"is"===t&&Ae.allowCustomizedBuiltInElements&&(Ae.tagNameCheck instanceof RegExp&&A(Ae.tagNameCheck,i)||Ae.tagNameCheck instanceof Function&&Ae.tagNameCheck(i))))return!1}else if(Ye[t]);else if(A(Te,E(i,we,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==S(i,"data:")||!Xe[e])if(Re&&!A(be,E(i,we,"")));else if(i)return!1;return!0},Mt=function(e){return e.indexOf("-")>0},Et=function(t){var i,n,o,s;bt("beforeSanitizeAttributes",t,null);var a=t.attributes;if(a){var l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Se};for(s=a.length;s--;){var c=i=a[s],u=c.name,h=c.namespaceURI;if(n="value"===u?i.value:C(i.value),o=me(u),l.attrName=o,l.attrValue=n,l.keepAttr=!0,l.forceKeepAttr=void 0,bt("uponSanitizeAttribute",t,l),n=l.attrValue,!l.forceKeepAttr&&(gt(u,t),l.keepAttr))if(ze||!A(/\/>/i,n)){Oe&&(n=E(n,_e," "),n=E(n,ge," "),n=E(n,ye," "));
1var p=me(t.nodeName);if(Tt(p,o,n)){if(!$e||"id"!==o&&"name"!==o||(gt(u,t),n="user-content-"+n),oe&&"object"===e(y)&&"function"==typeof y.getAttributeType)if(h);else switch(y.getAttributeType(p,o)){case"TrustedHTML":n=oe.createHTML(n);break;case"TrustedScriptURL":n=oe.createScriptURL(n)}try{h?t.setAttributeNS(h,u,n):t.setAttribute(u,n),x(r.removed)}catch(e){}}}else gt(u,t)}bt("afterSanitizeAttributes",t,null)}},St=function e(t){var i,r=vt(t);for(bt("beforeSanitizeShadowDOM",t,null);i=r.nextNode();)bt("uponSanitizeShadowNode",i,null),wt(i)||(i.content instanceof l&&e(i.content),Et(i));bt("afterSanitizeShadowDOM",t,null)};return r.sanitize=function(e){var t,i,n,s,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((rt=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!xt(e)){if("function"!=typeof e.toString)throw I("toString is not a function");if("string"!=typeof(e=e.toString()))throw I("dirty is not a string, aborting")}if(!r.isSupported)return e;if(Fe||ut(a),r.removed=[],"string"==typeof e&&(qe=!1),qe){if(e.nodeName){var c=me(e.nodeName);if(!Me[c]||Ie[c])throw I("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof u)1===(i=(t=yt("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===i.nodeName||"HTML"===i.nodeName?t=i:t.appendChild(i);else{if(!Ne&&!Oe&&!De&&-1===e.indexOf("<"))return oe&&Ue?oe.createHTML(e):e;if(!(t=yt(e)))return Ne?null:Ue?se:""}t&&Be&&_t(t.firstChild);for(var h=vt(qe?e:t);n=h.nextNode();)wt(n)||(n.content instanceof l&&St(n.content),Et(n));if(qe)return e;if(Ne){if(je)for(s=ue.call(t.ownerDocument);t.firstChild;)s.appendChild(t.firstChild);else s=t;return(Se.shadowroot||Se.shadowrootmod)&&(s=pe.call(o,s,!0)),s}var p=De?t.outerHTML:t.innerHTML;return De&&Me["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&A(K,t.ownerDocument.doctype.name)&&(p="<!DOCTYPE "+t.ownerDocument.doctype.name+">\n"+p),Oe&&(p=E(p,_e," "),p=E(p,ge," "),p=E(p,ye," ")),oe&&Ue?oe.createHTML(p):p},r.setConfig=function(e){ut(e),Fe=!0},r.clearConfig=function(){at=null,Fe=!1},r.isValidAttribute=function(e,t,i){at||ut({});var r=me(e),n=me(t);return Tt(r,n,i)},r.addHook=function(e,t){"function"==typeof t&&(de[e]=de[e]||[],b(de[e],t))},r.removeHook=function(e){if(de[e])return x(de[e])},r.removeHooks=function(e){de[e]&&(de[e]=[])},r.removeAllHooks=function(){de={}},r}();return ee}));!function e(t,i,r){function n(s,a){if(!i[s]){if(!t[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var u=i[s]={exports:{}};t[s][0].call(u.exports,(function(e){return n(t[s][1][e]||e)}),u,u.exports,e,t,i,r)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)n(r[s]);return n}({1:[function(e,t,i){"use strict";var r=e("@mapbox/mapbox-gl-sync-move"),n=e("events").EventEmitter;function o(e,t,i,o){if(this.options=o||{},this._mapA=e,this._mapB=t,this._horizontal="horizontal"===this.options.orientation,this._onDown=this._onDown.bind(this),this._onMove=this._onMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._ev=new n,this._swiper=document.createElement("div"),this._swiper.className=this._horizontal?"compare-swiper-horizontal":"compare-swiper-vertical",this._controlContainer=document.createElement("div"),this._controlContainer.className=this._horizontal?"mapboxgl-compare mapboxgl-compare-horizontal":"mapboxgl-compare",this._controlContainer.className=this._controlContainer.className,this._controlContainer.appendChild(this._swiper),"string"==typeof i&&document.body.querySelectorAll){var s=document.body.querySelectorAll(i)[0];if(!s)throw new Error("Cannot find element with specified container selector.");s.appendChild(this._controlContainer)}else{if(!(i instanceof Element&&i.appendChild))throw new Error("Invalid container specified. Must be CSS selector or HTML element.");i.appendChild(this._controlContainer)}this._bounds=t.getContainer().getBoundingClientRect();var a=(this._horizontal?this._bounds.height:this._bounds.width)/2;this._setPosition(a),this._clearSync=r(e,t),this._onResize=function(){this._bounds=t.getContainer().getBoundingClientRect(),this.currentPosition&&this._setPosition(this.currentPosition)}.bind(this),t.on("resize",this._onResize),this.options&&this.options.mousemove&&(e.getContainer().addEventListener("mousemove",this._onMove),t.getContainer().addEventListener("mousemove",this._onMove)),this._swiper.addEventListener("mousedown",this._onDown),this._swiper.addEventListener("touchstart",this._onDown)}o.prototype={_setPointerEvents:function(e){this._controlContainer.style.pointerEvents=e,this._swiper.style.pointerEvents=e},_onDown:function(e){e.touches?(document.addEventListener("touchmove",this._onMove),document.addEventListener("touchend",this._onTouchEnd)):(document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onMouseUp))},_setPosition:function(e){e=Math.min(e,this._horizontal?this._bounds.height:this._bounds.width);var t=this._horizontal?"translate(0, "+e+"px)":"translate("+e+"px, 0)";this._controlContainer.style.transform=t,this._controlContainer.style.WebkitTransform=t;var i=this._horizontal?"rect(0, 999em, "+e+"px, 0)":"rect(0, "+e+"px, "+this._bounds.height+"px, 0)",r=this._horizontal?"rect("+e+"px, 999em, "+this._bounds.height+"px,0)":"rect(0, 999em, "+this._bounds.height+"px,"+e+"px)";this._mapA.getContainer().style.clip=i,this._mapB.getContainer().style.clip=r,this.currentPosition=e},_onMove:function(e){this.options&&this.options.mousemove&&this._setPointerEvents(e.touches?"auto":"none"),this._horizontal?this._setPosition(this._getY(e)):this._setPosition(this._getX(e))},_onMouseUp:function(){document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onMouseUp),this.fire("slideend",{currentPosition:this.currentPosition})},_onTouchEnd:function(){document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onTouchEnd)},_getX:function(e){var t=(e=e.touches?e.touches[0]:e).clientX-this._bounds.left;return t<0&&(t=0),t>this._bounds.width&&(t=this._bounds.width),t},_getY:function(e){var t=(e=e.touches?e.touches[0]:e).clientY-this._bounds.top;return t<0&&(t=0),t>this._bounds.height&&(t=this._bounds.height),t},setSlider:function(e){this._setPosition(e)},on:function(e,t){return this._ev.on(e,t),this},fire:function(e,t){return this._ev.emit(e,t),this},off:function(e,t){return this._ev.removeListener(e,t),this},remove:function(){this._clearSync(),this._mapB.off("resize",this._onResize);var e=this._mapA.getContainer();e&&(e.style.clip=null,e.removeEventListener("mousemove",this._onMove));var t=this._mapB.getContainer();t&&(t.style.clip=null,t.removeEventListener("mousemove",this._onMove)),this._swiper.removeEventListener("mousedown",this._onDown),this._swiper.removeEventListener("touchstart",this._onDown),this._controlContainer.remove()}},window.mapboxgl?mapboxgl.Compare=o:void 0!==t&&(t.exports=o)},{"@mapbox/mapbox-gl-sync-move":2,events:3}],2:[function(e,t,i){t.exports=function(){var e,t=arguments.length;if(1===t)e=arguments[0];else{e=[];for(var i=0;i<t;i++)e.push(arguments[i])}var r=[];function n(){e.forEach((function(e,t){e.on("move",r[t])}))}function o(){e.forEach((function(e,t){e.off("move",r[t])}))}return e.forEach((function(t,i){r[i]=function(e,t){o(),function(e,t){var i=e.getCenter(),r=e.getZoom(),n=e.getBearing(),o=e.getPitch();t.forEach((function(e){e.jumpTo({center:i,zoom:r,bearing:n,pitch:o})}))}(e,t),n()}.bind(null,t,e.filter((function(e,t){return t!==i})))}
vendor: 4,828 bytes, line 1
1)),n(),function(){o(),r=[]}}},{}],3:[function(e,t,i){var r=Object.create||function(e){function t(){}return t.prototype=e,new t},n=Object.keys||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.push(i);return i},o=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function s(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=r(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}((t.exports=s).EventEmitter=s).prototype._events=void 0,s.prototype._maxListeners=void 0;var a,l=10;try{var c={};Object.defineProperty&&Object.defineProperty(c,"x",{value:0}),a=0===c.x}catch(e){a=!1}function u(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function h(e,t,i,n){var o,s,a;if("function"!=typeof i)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),s=e._events),a=s[t]):(s=e._events=r(null),e._eventsCount=0),a){if("function"==typeof a?a=s[t]=n?[i,a]:[a,i]:n?a.unshift(i):a.push(i),!a.warned&&(o=u(e))&&0<o&&a.length>o){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",l.name,l.message)}}else a=s[t]=i,++e._eventsCount;return e}function p(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function d(e,t,i){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},n=o.call(p,r);return n.listener=i,r.wrapFn=n}function f(e,t,i){var r=e._events;if(!r)return[];var n=r[t];return n?"function"==typeof n?i?[n.listener||n]:[n]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(n):_(n,n.length):[]}function m(e){var t=this._events;if(t){var i=t[e];if("function"==typeof i)return 1;if(i)return i.length}return 0}function _(e,t){for(var i=new Array(t),r=0;r<t;++r)i[r]=e[r];return i}a?Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');l=e}}):s.defaultMaxListeners=l,s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e,t,i,r){var n,o,s,a,l,c,u="error"===e;if(c=this._events)u=u&&null==c.error;else if(!u)return!1;if(u){if(1<arguments.length&&(n=t),n instanceof Error)throw n;var h=new Error('Unhandled "error" event. ('+n+")");throw h.context=n,h}if(!(o=c[e]))return!1;var p="function"==typeof o;switch(s=arguments.length){case 1:!function(e,t,i){if(t)e.call(i);else for(var r=e.length,n=_(e,r),o=0;o<r;++o)n[o].call(i)}(o,p,this);break;case 2:!function(e,t,i,r){if(t)e.call(i,r);else for(var n=e.length,o=_(e,n),s=0;s<n;++s)o[s].call(i,r)}(o,p,this,t);break;case 3:!function(e,t,i,r,n){if(t)e.call(i,r,n);else for(var o=e.length,s=_(e,o),a=0;a<o;++a)s[a].call(i,r,n)}(o,p,this,t,i);break;case 4:!function(e,t,i,r,n,o){if(t)e.call(i,r,n,o);else for(var s=e.length,a=_(e,s),l=0;l<s;++l)a[l].call(i,r,n,o)}(o,p,this,t,i,r);break;default:for(a=new Array(s-1),l=1;l<s;l++)a[l-1]=arguments[l];!function(e,t,i,r){if(t)e.apply(i,r);else for(var n=e.length,o=_(e,n),s=0;s<n;++s)o[s].apply(i,r)}(o,p,this,a)}return!0},s.prototype.on=s.prototype.addListener=function(e,t){return h(this,e,t,!1)},s.prototype.prependListener=function(e,t){return h(this,e,t,!0)},s.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,d(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,d(this,e,t)),this},s.prototype.removeListener=function(e,t){var i,n,o,s,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(i=n[e]))return this;if(i===t||i.listener===t)0==--this._eventsCount?this._events=r(null):(delete n[e],n.removeListener&&this.emit
1("removeListener",e,i.listener||t));else if("function"!=typeof i){for(o=-1,s=i.length-1;0<=s;s--)if(i[s]===t||i[s].listener===t){a=i[s].listener,o=s;break}if(o<0)return this;0===o?i.shift():function(e,t){for(var i=t,r=i+1,n=e.length;r<n;i+=1,r+=1)e[i]=e[r];e.pop()}(i,o),1===i.length&&(n[e]=i[0]),n.removeListener&&this.emit("removeListener",e,a||t)}return this},s.prototype.removeAllListeners=function(e){var t,i,o;if(!(i=this._events))return this;if(!i.removeListener)return 0===arguments.length?(this._events=r(null),this._eventsCount=0):i[e]&&(0==--this._eventsCount?this._events=r(null):delete i[e]),this;if(0===arguments.length){var s,a=n(i);for(o=0;o<a.length;++o)"removeListener"!==(s=a[o])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=r(null),this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(t)for(o=t.length-1;0<=o;o--)this.removeListener(e,t[o]);return this},s.prototype.listeners=function(e){return f(this,e,!0)},s.prototype.rawListeners=function(e){return f(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return 0<this._eventsCount?Reflect.ownKeys(this._events):[]}},{}]},{},[1]);!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).MapboxDirections=e()}}((function(){return function e(t,i,r){function n(s,a){if(!i[s]){if(!t[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var u=i[s]={exports:{}};t[s][0].call(u.exports,(function(e){return n(t[s][1][e]||e)}),u,u.exports,e,t,i,r)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)n(r[s]);return n}({1:[function(e,t,i){"use strict";var r={};function n(e){return Math.floor(Math.abs(e)+.5)*(e>=0?1:-1)}function o(e,t,i){var r=(e=n(e*i))-(t=n(t*i));r<<=1;e-t<0&&(r=~r);for(var o="";r>=32;){o+=String.fromCharCode(63+(32|31&r));r>>=5}return o+=String.fromCharCode(r+63)}r.decode=function(e,t){for(var i,r=0,n=0,o=0,s=[],a=0,l=0,c=null,u=Math.pow(10,Number.isInteger(t)?t:5);r<e.length;){c=null;a=0;l=0;do{l|=(31&(c=e.charCodeAt(r++)-63))<<a;a+=5}while(c>=32);i=1&l?~(l>>1):l>>1;a=l=0;do{l|=(31&(c=e.charCodeAt(r++)-63))<<a;a+=5}while(c>=32);n+=i;o+=1&l?~(l>>1):l>>1;s.push([n/u,o/u])}return s};r.encode=function(e,t){if(!e.length)return"";for(var i=Math.pow(10,Number.isInteger(t)?t:5),r=o(e[0][0],0,i)+o(e[0][1],0,i),n=1;n<e.length;n++){var s=e[n],a=e[n-1];r+=o(s[0],a[0],i);r+=o(s[1],a[1],i)}return r};function s(e){for(var t=[],i=0;i<e.length;i++){var r=e[i].slice();t.push([r[1],r[0]])}return t}r.fromGeoJSON=function(e,t){e&&"Feature"===e.type&&(e=e.geometry);if(!e||"LineString"!==e.type)throw new Error("Input must be a GeoJSON LineString");return r.encode(s(e.coordinates),t)};r.toGeoJSON=function(e,t){return{type:"LineString",coordinates:s(r.decode(e,t))}};"object"==typeof t&&t.exports&&(t.exports=r)},{}],2:[function(e,t,i){"use strict";var r=e("is-obj"),n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function s(e,t,i){var o=t[i];if(null!=o){if(n.call(e,i)&&(void 0===e[i]||null===e[i]))throw new TypeError("Cannot convert undefined or null to object ("+i+")");n.call(e,i)&&r(o)?e[i]=a(Object(e[i]),t[i]):e[i]=o}}function a(e,t){if(e===t)return e;t=Object(t);for(var i in t)n.call(t,i)&&s(e,t,i);if(Object.getOwnPropertySymbols)for(var r=Object.getOwnPropertySymbols(t),a=0;a<r.length;a++)o.call(t,r[a])&&s(e,t,r[a]);return e}t.exports=function(e){e=function(e){if(null==e)throw new TypeError("Sources cannot be null or undefined");return Object(e)}(e);for(var t=1;t<arguments.length;t++)a(e,arguments[t]);return e}},{"is-obj":5}],3:[function(e,t,i){function r(){this._events=this._events||{};this._maxListeners=this._maxListeners||void 0}t.exports=r;r.EventEmitter=r;r.prototype._events=void 0;r.prototype._maxListeners=void 0;r.defaultMaxListeners=10;r.prototype.setMaxListeners=function(e){if(!(t=e,"number"==typeof t)||e<0||isNaN(e))throw TypeError("n must be a positive number");var t;this._maxListeners=e;return this};r.prototype.emit=function(e){var t,i,r,a,l,c;this._events||(this._events={});if("error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");u.context=t;throw u}if(s(i=this._events[e]))return!1;if(n(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;
1default:a=Array.prototype.slice.call(arguments,1);i.apply(this,a)}else if(o(i)){a=Array.prototype.slice.call(arguments,1);r=(c=i.slice()).length;for(l=0;l<r;l++)c[l].apply(this,a)}return!0};r.prototype.addListener=function(e,t){var i;if(!n(t))throw TypeError("listener must be a function");this._events||(this._events={});this._events.newListener&&this.emit("newListener",e,n(t.listener)?t.listener:t);this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t;if(o(this._events[e])&&!this._events[e].warned&&(i=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[e].length>i){this._events[e].warned=!0;console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length);"function"==typeof console.trace&&console.trace()}return this};r.prototype.on=r.prototype.addListener;r.prototype.once=function(e,t){if(!n(t))throw TypeError("listener must be a function");var i=!1;function r(){this.removeListener(e,r);if(!i){i=!0;t.apply(this,arguments)}}r.listener=t;this.on(e,r);return this};r.prototype.removeListener=function(e,t){var i,r,s,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;s=(i=this._events[e]).length;r=-1;if(i===t||n(i.listener)&&i.listener===t){delete this._events[e];this._events.removeListener&&this.emit("removeListener",e,t)}else if(o(i)){for(a=s;a-- >0;)if(i[a]===t||i[a].listener&&i[a].listener===t){r=a;break}if(r<0)return this;if(1===i.length){i.length=0;delete this._events[e]}else i.splice(r,1);this._events.removeListener&&this.emit("removeListener",e,t)}return this};r.prototype.removeAllListeners=function(e){var t,i;if(!this._events)return this;if(!this._events.removeListener){0===arguments.length?this._events={}:this._events[e]&&delete this._events[e];return this}if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);this.removeAllListeners("removeListener");this._events={};return this}if(n(i=this._events[e]))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);delete this._events[e];return this};r.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]};r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0};r.listenerCount=function(e,t){return e.listenerCount(t)};function n(e){return"function"==typeof e}function o(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}},{}],4:[function(e,t,i){!function(){var e={};void 0!==i?t.exports=e:this.fuzzy=e;e.simpleFilter=function(t,i){return i.filter((function(i){return e.test(t,i)}))};e.test=function(t,i){return null!==e.match(t,i)};e.match=function(e,t,i){i=i||{};var r,n=0,o=[],s=t.length,a=0,l=0,c=i.pre||"",u=i.post||"",h=i.caseSensitive&&t||t.toLowerCase();e=i.caseSensitive&&e||e.toLowerCase();for(var p=0;p<s;p++){r=t[p];if(h[p]===e[n]){r=c+r+u;n+=1;l+=1+l}else l=0;a+=l;o[o.length]=r}if(n===e.length){a=h===e?1/0:a;return{rendered:o.join(""),score:a}}return null};e.filter=function(t,i,r){if(!i||0===i.length)return[];if("string"!=typeof t)return i;r=r||{};return i.reduce((function(i,n,o,s){var a=n;r.extract&&(a=r.extract(n));var l=e.match(t,a,r);null!=l&&(i[i.length]={string:l.rendered,score:l.score,index:o,original:n});return i}),[]).sort((function(e,t){var i=t.score-e.score;return i||e.index-t.index}))}}()},{}],5:[function(e,t,i){"use strict";t.exports=function(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}},{}],6:[function(e,t,i){t.exports=/<%=([\s\S]+?)%>/g},{}],7:[function(e,t,i){(function(e){var i=NaN,r="[object Symbol]",n=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,l=parseInt,c="object"==typeof e&&e&&e.Object===Object&&e,u="object"==typeof self&&self&&self.Object===Object&&self,h=c||u||Function("return this")(),p=Object.prototype.toString,d=Math.max,f=Math.min,m=function(){return h.Date.now()};function _(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&p.call(e)==r}(e))return i;if(_(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=_(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var c=s.test(e);return c||a.test(e)?l(e.slice(2),c?2:8):o.test(e)?i:+e}t.exports=function(e,t,i){var r,n,o,s,a,l,c=0,u=!1,h=!1,p=!0;if("function"!=typeof e)throw new TypeError("Expected a function");t=g(t)||0;if(_(i)){u=!!i.leading;o=(h="maxWait"in i)?d(g(i.maxWait)||0,t):o;p="trailing"in i?!!i.trailing:p}function y(t){var i=r,o=n;r=n=void 0;c=t;return s=e.apply(o,i)}function v(e){var i=e-l;return void 0===l||i>=t||i<0||h&&e-c>=o}function x(){var e=m();if(v(e))return b(e);a=setTimeout(x,function(e){var i=t-(e-l);return h?f(i,o-(e-c)):i}(e))}function b(e){a=void 0;if(p&&r)return y(e);r=n=void 0;return s}function w(){var e=m(),i=v(e);r=arguments;n=this;l=e;if(i){if(void 0===a)return function(e){c=e;a=setTimeout(x,t);return u?y(e):s}(l);if(h){a=setTimeout(x,t);return y(l)}}void 0===a&&(a=setTimeout(x,t));return s}w.cancel=function(){void 0!==a&&clearTimeout(a);c=0;r=l=n=a=void 0};w.flush=function(){return void 0===a?s:b(m())};return w}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],8:[function(e,t,i){(function(e){var r="__lodash_hash_undefined__",n=1,o=2,s=9007199254740991,a="[object Arguments]",l="[object Array]",c="[object AsyncFunction]",u="[object Boolean]",h="[object Date]",p="[object Error]",d="[object Function]",f="[object GeneratorFunction]",m="[object Map]",_="[object Number]",g="[object Null]",y="[object Object]",v="[object Promise]",x="[object Proxy]",b="[object RegExp]",w="[object Set]",T="[object String]",M="[object Symbol]",E="[object Undef
1ined]",S="[object WeakMap]",C="[object ArrayBuffer]",A="[object DataView]",I=/^\[object .+?Constructor\]$/,k=/^(?:0|[1-9]\d*)$/,L={};L["[object Float32Array]"]=L["[object Float64Array]"]=L["[object Int8Array]"]=L["[object Int16Array]"]=L["[object Int32Array]"]=L["[object Uint8Array]"]=L["[object Uint8ClampedArray]"]=L["[object Uint16Array]"]=L["[object Uint32Array]"]=!0;L[a]=L[l]=L[C]=L[u]=L[A]=L[h]=L[p]=L[d]=L[m]=L[_]=L[y]=L[b]=L[w]=L[T]=L[S]=!1;var P="object"==typeof e&&e&&e.Object===Object&&e,R="object"==typeof self&&self&&self.Object===Object&&self,z=P||R||Function("return this")(),O="object"==typeof i&&i&&!i.nodeType&&i,D=O&&"object"==typeof t&&t&&!t.nodeType&&t,F=D&&D.exports===O,B=F&&P.process,N=function(){try{return B&&B.binding&&B.binding("util")}catch(e){}}(),j=N&&N.isTypedArray;function U(e,t){for(var i=-1,r=null==e?0:e.length;++i<r;)if(t(e[i],i,e))return!0;return!1}function V(e){var t=-1,i=Array(e.size);e.forEach((function(e,r){i[++t]=[r,e]}));return i}function $(e){var t=-1,i=Array(e.size);e.forEach((function(e){i[++t]=e}));return i}var G,q,H,Z=Array.prototype,W=Function.prototype,X=Object.prototype,Q=z["__core-js_shared__"],Y=W.toString,J=X.hasOwnProperty,K=(G=/[^.]+$/.exec(Q&&Q.keys&&Q.keys.IE_PROTO||""))?"Symbol(src)_1."+G:"",ee=X.toString,te=RegExp("^"+Y.call(J).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ie=F?z.Buffer:void 0,re=z.Symbol,ne=z.Uint8Array,oe=X.propertyIsEnumerable,se=Z.splice,ae=re?re.toStringTag:void 0,le=Object.getOwnPropertySymbols,ce=ie?ie.isBuffer:void 0,ue=(q=Object.keys,H=Object,function(e){return q(H(e))}),he=Ne(z,"DataView"),pe=Ne(z,"Map"),de=Ne(z,"Promise"),fe=Ne(z,"Set"),me=Ne(z,"WeakMap"),_e=Ne(Object,"create"),ge=$e(he),ye=$e(pe),ve=$e(de),xe=$e(fe),be=$e(me),we=re?re.prototype:void 0,Te=we?we.valueOf:void 0;function Me(e){var t=-1,i=null==e?0:e.length;this.clear();for(;++t<i;){var r=e[t];this.set(r[0],r[1])}}Me.prototype.clear=function(){this.__data__=_e?_e(null):{};this.size=0};Me.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];this.size-=t?1:0;return t};Me.prototype.get=function(e){var t=this.__data__;if(_e){var i=t[e];return i===r?void 0:i}return J.call(t,e)?t[e]:void 0};Me.prototype.has=function(e){var t=this.__data__;return _e?void 0!==t[e]:J.call(t,e)};Me.prototype.set=function(e,t){var i=this.__data__;this.size+=this.has(e)?0:1;i[e]=_e&&void 0===t?r:t;return this};function Ee(e){var t=-1,i=null==e?0:e.length;this.clear();for(;++t<i;){var r=e[t];this.set(r[0],r[1])}}Ee.prototype.clear=function(){this.__data__=[];this.size=0};Ee.prototype.delete=function(e){var t=this.__data__,i=ke(t,e);if(i<0)return!1;i==t.length-1?t.pop():se.call(t,i,1);--this.size;return!0};Ee.prototype.get=function(e){var t=this.__data__,i=ke(t,e);return i<0?void 0:t[i][1]};Ee.prototype.has=function(e){return ke(this.__data__,e)>-1};Ee.prototype.set=function(e,t){var i=this.__data__,r=ke(i,e);if(r<0){++this.size;i.push([e,t])}else i[r][1]=t;return this};function Se(e){var t=-1,i=null==e?0:e.length;this.clear();for(;++t<i;){var r=e[t];this.set(r[0],r[1])}}Se.prototype.clear=function(){this.size=0;this.__data__={hash:new Me,map:new(pe||Ee),string:new Me}};Se.prototype.delete=function(e){var t=Be(this,e).delete(e);this.size-=t?1:0;return t};Se.prototype.get=function(e){return Be(this,e).get(e)};Se.prototype.has=function(e){return Be(this,e).has(e)};Se.prototype.set=function(e,t){var i=Be(this,e),r=i.size;i.set(e,t);this.size+=i.size==r?0:1;return this};function Ce(e){var t=-1,i=null==e?0:e.length;this.__data__=new Se;for(;++t<i;)this.add(e[t])}Ce.prototype.add=Ce.prototype.push=function(e){this.__data__.set(e,r);return this};Ce.prototype.has=function(e){return this.__data__.has(e)};function Ae(e){var t=this.__data__=new Ee(e);this.size=t.size}Ae.prototype.clear=function(){this.__data__=new Ee;this.size=0};Ae.prototype.delete=function(e){var t=this.__data__,i=t.delete(e);this.size=t.size;return i};Ae.prototype.get=function(e){return this.__data__.get(e)};Ae.prototype.has=function(e){return this.__data__.has(e)};Ae.prototype.set=function(e,t){var i=this.__data__;if(i instanceof Ee){var r=i.__data__;
1if(!pe||r.length<199){r.push([e,t]);this.size=++i.size;return this}i=this.__data__=new Se(r)}i.set(e,t);this.size=i.size;return this};function Ie(e,t){var i=He(e),r=!i&&qe(e),n=!i&&!r&&Ze(e),o=!i&&!r&&!n&&Je(e),s=i||r||n||o,a=s?function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}(e.length,String):[],l=a.length;for(var c in e)!t&&!J.call(e,c)||s&&("length"==c||n&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Ve(c,l))||a.push(c);return a}function ke(e,t){for(var i=e.length;i--;)if(Ge(e[i][0],t))return i;return-1}function Le(e){return null==e?void 0===e?E:g:ae&&ae in Object(e)?function(e){var t=J.call(e,ae),i=e[ae];try{e[ae]=void 0;var r=!0}catch(e){}var n=ee.call(e);r&&(t?e[ae]=i:delete e[ae]);return n}(e):function(e){return ee.call(e)}(e)}function Pe(e){return Ye(e)&&Le(e)==a}function Re(e,t,i,r,s){return e===t||(null==e||null==t||!Ye(e)&&!Ye(t)?e!=e&&t!=t:function(e,t,i,r,s,c){var d=He(e),f=He(t),g=d?l:Ue(e),v=f?l:Ue(t),x=(g=g==a?y:g)==y,E=(v=v==a?y:v)==y,S=g==v;if(S&&Ze(e)){if(!Ze(t))return!1;d=!0;x=!1}if(S&&!x){c||(c=new Ae);return d||Je(e)?De(e,t,i,r,s,c):function(e,t,i,r,s,a,l){switch(i){case A:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer;t=t.buffer;case C:return!(e.byteLength!=t.byteLength||!a(new ne(e),new ne(t)));case u:case h:case _:return Ge(+e,+t);case p:return e.name==t.name&&e.message==t.message;case b:case T:return e==t+"";case m:var c=V;case w:var d=r&n;c||(c=$);if(e.size!=t.size&&!d)return!1;var f=l.get(e);if(f)return f==t;r|=o;l.set(e,t);var g=De(c(e),c(t),r,s,a,l);l.delete(e);return g;case M:if(Te)return Te.call(e)==Te.call(t)}return!1}(e,t,g,i,r,s,c)}if(!(i&n)){var I=x&&J.call(e,"__wrapped__"),k=E&&J.call(t,"__wrapped__");
1if(I||k){var L=I?e.value():e,P=k?t.value():t;c||(c=new Ae);return s(L,P,i,r,c)}}if(!S)return!1;c||(c=new Ae);return function(e,t,i,r,o,s){var a=i&n,l=Fe(e),c=l.length,u=Fe(t),h=u.length;if(c!=h&&!a)return!1;var p=c;for(;p--;){var d=l[p];if(!(a?d in t:J.call(t,d)))return!1}var f=s.get(e);if(f&&s.get(t))return f==t;var m=!0;s.set(e,t);s.set(t,e);var _=a;for(;++p<c;){var g=e[d=l[p]],y=t[d];if(r)var v=a?r(y,g,d,t,e,s):r(g,y,d,e,t,s);if(!(void 0===v?g===y||o(g,y,i,r,s):v)){m=!1;break}_||(_="constructor"==d)}if(m&&!_){var x=e.constructor,b=t.constructor;x==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof x&&x instanceof x&&"function"==typeof b&&b instanceof b||(m=!1)}s.delete(e);s.delete(t);return m}(e,t,i,r,s,c)}(e,t,i,r,Re,s))}function ze(e){return!(!Qe(e)||function(e){return!!K&&K in e}(e))&&(We(e)?te:I).test($e(e))}function Oe(e){if(!(t=e,i=t&&t.constructor,r="function"==typeof i&&i.prototype||X,t===r))return ue(e);var t,i,r,n=[];for(var o in Object(e))J.call(e,o)&&"constructor"!=o&&n.push(o);return n}function De(e,t,i,r,s,a){var l=i&n,c=e.length,u=t.length;if(c!=u&&!(l&&u>c))return!1;var h=a.get(e);if(h&&a.get(t))return h==t;var p=-1,d=!0,f=i&o?new Ce:void 0;a.set(e,t);a.set(t,e);for(;++p<c;){var m=e[p],_=t[p];if(r)var g=l?r(_,m,p,t,e,a):r(m,_,p,e,t,a);if(void 0!==g){if(g)continue;d=!1;break}if(f){if(!U(t,(function(e,t){if(!(n=f,o=t,n.has(o))&&(m===e||s(m,e,i,r,a)))return f.push(t);var n,o}))){d=!1;break}}else if(m!==_&&!s(m,_,i,r,a)){d=!1;break}}a.delete(e);a.delete(t);return d}function Fe(e){return function(e,t,i){var r=t(e);return He(e)?r:function(e,t){for(var i=-1,r=t.length,n=e.length;++i<r;)e[n+i]=t[i];return e}(r,i(e))}(e,Ke,je)}function Be(e,t){var i,r,n=e.__data__;return("string"==(r=typeof(i=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==i:null===i)?n["string"==typeof t?"string":"hash"]:n.map}function Ne(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return ze(i)?i:void 0}var je=le?function(e){if(null==e)return[];e=Object(e);return function(e,t){for(var i=-1,r=null==e?0:e.length,n=0,o=[];++i<r;){var s=e[i];t(s,i,e)&&(o[n++]=s)}return o}(le(e),(function(t){return oe.call(e,t)}))}:function(){return[]},Ue=Le;(he&&Ue(new he(new ArrayBuffer(1)))!=A||pe&&Ue(new pe)!=m||de&&Ue(de.resolve())!=v||fe&&Ue(new fe)!=w||me&&Ue(new me)!=S)&&(Ue=function(e){var t=Le(e),i=t==y?e.constructor:void 0,r=i?$e(i):"";if(r)switch(r){case ge:return A;case ye:return m;case ve:return v;case xe:return w;case be:return S}return t});function Ve(e,t){return!!(t=null==t?s:t)&&("number"==typeof e||k.test(e))&&e>-1&&e%1==0&&e<t}function $e(e){if(null!=e){try{return Y.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ge(e,t){return e===t||e!=e&&t!=t}var qe=Pe(function(){return arguments}())?Pe:function(e){return Ye(e)&&J.call(e,"callee")&&!oe.call(e,"callee")},He=Array.isArray;var Ze=ce||function(){return!1};function We(e){if(!Qe(e))return!1;var t=Le(e);return t==d||t==f||t==c||t==x}function Xe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=s}function Qe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ye(e){return null!=e&&"object"==typeof e}var Je=j?function(e){return function(t){return e(t)}}(j):function(e){return Ye(e)&&Xe(e.length)&&!!L[Le(e)]};function Ke(e){return null!=(t=e)&&Xe(t.length)&&!We(t)?Ie(e):Oe(e);var t}t.exports=function(e,t){return Re(e,t)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],9:[function(e,t,i){(function(r){var n=e("lodash._reinterpolate"),o=e("lodash.templatesettings"),s=1/0,a=9007199254740991,l="[object Arguments]",c="[object AsyncFunction]",u="[object DOMException]",h="[object Error]",p="[object Function]",d="[object GeneratorFunction]",f="[object Null]",m="[object Object]",_="[object Proxy]",g="[object Symbol]",y="[object Undefined]",v=/\b__p \+= '';/g,x=/\b(__p \+=) '' \+/g,b=/(__e\(.*?\)|\b__t\)) \+\n'';/g,w=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,T=/^\[object .+?Constructor\]$/,M=/^(?:0|[1-9]\d*)$/,E=/($^)/,S=/['\n\r\u2028\u2029\\]/g,C={};
1C["[object Float32Array]"]=C["[object Float64Array]"]=C["[object Int8Array]"]=C["[object Int16Array]"]=C["[object Int32Array]"]=C["[object Uint8Array]"]=C["[object Uint8ClampedArray]"]=C["[object Uint16Array]"]=C["[object Uint32Array]"]=!0;C[l]=C["[object Array]"]=C["[object ArrayBuffer]"]=C["[object Boolean]"]=C["[object DataView]"]=C["[object Date]"]=C[h]=C[p]=C["[object Map]"]=C["[object Number]"]=C[m]=C["[object RegExp]"]=C["[object Set]"]=C["[object String]"]=C["[object WeakMap]"]=!1;var A={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},I="object"==typeof r&&r&&r.Object===Object&&r,k="object"==typeof self&&self&&self.Object===Object&&self,L=I||k||Function("return this")(),P="object"==typeof i&&i&&!i.nodeType&&i,R=P&&"object"==typeof t&&t&&!t.nodeType&&t,z=R&&R.exports===P,O=z&&I.process,D=function(){try{var e=R&&R.require&&R.require("util").types;return e||O&&O.binding&&O.binding("util")}catch(e){}}(),F=D&&D.isTypedArray;function B(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}function N(e,t){for(var i=-1,r=null==e?0:e.length,n=Array(r);++i<r;)n[i]=t(e[i],i,e);return n}function j(e){return"\\"+A[e]}function U(e,t){return function(i){return e(t(i))}}var V,$=Function.prototype,G=Object.prototype,q=L["__core-js_shared__"],H=$.toString,Z=G.hasOwnProperty,W=(V=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||""))?"Symbol(src)_1."+V:"",X=G.toString,Q=H.call(Object),Y=RegExp("^"+H.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),J=z?L.Buffer:void 0,K=L.Symbol,ee=U(Object.getPrototypeOf,Object),te=G.propertyIsEnumerable,ie=K?K.toStringTag:void 0,re=function(){try{var e=function(e){if(!Oe(e)||function(e){return!!W&&W in e}(e))return!1;var t=Re(e)?Y:T;return t.test(function(e){if(null!=e){try{return H.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}(t=function(e,t){return null==e?void 0:e[t]}(Object,"defineProperty"))?t:void 0;e({},"",{});return e}catch(e){}var t}(),ne=J?J.isBuffer:void 0,oe=U(Object.keys,Object),se=Math.max,ae=Date.now,le=K?K.prototype:void 0,ce=le?le.toString:void 0;function ue(e,t){var i=Ie(e),r=!i&&Ae(e),n=!i&&!r&&Le(e),o=!i&&!r&&!n&&Fe(e),s=i||r||n||o,a=s?function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}(e.length,String):[],l=a.length;for(var c in e)!t&&!Z.call(e,c)||s&&("length"==c||n&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||xe(c,l))||a.push(c);return a}function he(e,t,i){var r=e[t];Z.call(e,t)&&Ce(r,i)&&(void 0!==i||t in e)||pe(e,t,i)}function pe(e,t,i){"__proto__"==t&&re?re(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}function de(e){return null==e?void 0===e?y:f:ie&&ie in Object(e)?function(e){var t=Z.call(e,ie),i=e[ie];try{e[ie]=void 0;var r=!0}catch(e){}var n=X.call(e);r&&(t?e[ie]=i:delete e[ie]);return n}(e):function(e){return X.call(e)}(e)}function fe(e){return De(e)&&de(e)==l}function me(e){if(!Oe(e))return function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t}(e);var t=we(e),i=[];for(var r in e)("constructor"!=r||!t&&Z.call(e,r))&&i.push(r);return i}function _e(e,t){return Se(function(e,t,i){t=se(void 0===t?e.length-1:t,0);return function(){for(var r=arguments,n=-1,o=se(r.length-t,0),s=Array(o);++n<o;)s[n]=r[t+n];n=-1;for(var a=Array(t+1);++n<t;)a[n]=r[n];a[t]=i(s);return B(e,this,a)}}(e,t,Ve),e+"")}var ge=re?function(e,t){return re(e,"toString",{configurable:!0,enumerable:!1,value:(i=t,function(){return i}),writable:!0});var i}:Ve;function ye(e){if("string"==typeof e)return e;if(Ie(e))return N(e,ye)+"";if(function(e){return"symbol"==typeof e||De(e)&&de(e)==g}(e))return ce?ce.call(e):"";var t=e+"";return"0"==t&&1/e==-s?"-0":t}function ve(e,t,i,r){return void 0===e||Ce(e,G[i])&&!Z.call(r,i)?t:e}function xe(e,t){var i=typeof e;return!!(t=null==t?a:t)&&("number"==i||"symbol"!=i&&M.test(e))&&e>-1&&e%1==0&&e<t}function be(e,t,i){if(!Oe(i))return!1;var r=typeof t;
1return!!("number"==r?ke(i)&&xe(t,i.length):"string"==r&&t in i)&&Ce(i[t],e)}function we(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||G)}var Te,Me,Ee,Se=(Te=ge,Me=0,Ee=0,function(){var e=ae(),t=16-(e-Ee);Ee=e;if(t>0){if(++Me>=800)return arguments[0]}else Me=0;return Te.apply(void 0,arguments)});function Ce(e,t){return e===t||e!=e&&t!=t}var Ae=fe(function(){return arguments}())?fe:function(e){return De(e)&&Z.call(e,"callee")&&!te.call(e,"callee")},Ie=Array.isArray;function ke(e){return null!=e&&ze(e.length)&&!Re(e)}var Le=ne||function(){return!1};function Pe(e){if(!De(e))return!1;var t=de(e);return t==h||t==u||"string"==typeof e.message&&"string"==typeof e.name&&!function(e){if(!De(e)||de(e)!=m)return!1;var t=ee(e);if(null===t)return!0;var i=Z.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&H.call(i)==Q}(e)}function Re(e){if(!Oe(e))return!1;var t=de(e);return t==p||t==d||t==c||t==_}function ze(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=a}function Oe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function De(e){return null!=e&&"object"==typeof e}var Fe=F?function(e){return function(t){return e(t)}}(F):function(e){return De(e)&&ze(e.length)&&!!C[de(e)]};var Be,Ne=(Be=function(e,t,i,r){!function(e,t,i,r){var n=!i;i||(i={});for(var o=-1,s=t.length;++o<s;){var a=t[o],l=r?r(i[a],e[a],a,i,e):void 0;void 0===l&&(l=e[a]);n?pe(i,a,l):he(i,a,l)}}(t,function(e){return ke(e)?ue(e,!0):me(e)}(t),e,r)},_e((function(e,t){var i=-1,r=t.length,n=r>1?t[r-1]:void 0,o=r>2?t[2]:void 0;n=Be.length>3&&"function"==typeof n?(r--,n):void 0;if(o&&be(t[0],t[1],o)){n=r<3?void 0:n;r=1}e=Object(e);for(;++i<r;){var s=t[i];s&&Be(e,s,i,n)}return e})));function je(e){return ke(e)?ue(e):function(e){if(!we(e))return oe(e);var t=[];for(var i in Object(e))Z.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}var Ue=_e((function(e,t){try{return B(e,void 0,t)}catch(e){return Pe(e)?e:new Error(e)}}));function Ve(e){return e}t.exports=function(e,t,i){var r,s=o.imports._.templateSettings||o;i&&be(e,t,i)&&(t=void 0);e=null==(r=e)?"":ye(r);t=Ne({},t,s,ve);var a,l,c,u=Ne({},t.imports,s.imports,ve),h=je(u),p=(a=u,N(h,(function(e){return a[e]}))),d=0,f=t.interpolate||E,m="__p += '",_=RegExp((t.escape||E).source+"|"+f.source+"|"+(f===n?w:E).source+"|"+(t.evaluate||E).source+"|$","g"),g=Z.call(t,"sourceURL")?"//# sourceURL="+(t.sourceURL+"").replace(/[\r\n]/g," ")+"\n":"";e.replace(_,(function(t,i,r,n,o,s){r||(r=n);m+=e.slice(d,s).replace(S,j);if(i){l=!0;m+="' +\n__e("+i+") +\n'"}if(o){c=!0;m+="';\n"+o+";\n__p += '"}r&&(m+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'");d=s+t.length;return t}));m+="';\n";var y=Z.call(t,"variable")&&t.variable;y||(m="with (obj) {\n"+m+"\n}\n");m=(c?m.replace(v,""):m).replace(x,"$1").replace(b,"$1;");m="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(l?", __e = _.escape":"")+(c?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+m+"return __p\n}";var T=Ue((function(){return Function(h,g+"return "+m).apply(void 0,p)}));T.source=m;if(Pe(T))throw T;return T}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"lodash._reinterpolate":6,"lodash.templatesettings":10}],10:[function(e,t,i){(function(i){var r=e("lodash._reinterpolate"),n=1/0,o="[object Null]",s="[object Symbol]",a="[object Undefined]",l=/[&<>"']/g,c=RegExp(l.source),u="object"==typeof i&&i&&i.Object===Object&&i,h="object"==typeof self&&self&&self.Object===Object&&self,p=u||h||Function("return this")();var d,f=(d={"&":"&","<":"<",">":">",'"':""","'":"'"},function(e){return null==d?void 0:d[e]}),m=Object.prototype,_=m.hasOwnProperty,g=m.toString,y=p.Symbol,v=y?y.toStringTag:void 0,x=y?y.prototype:void 0,b=x?x.toString:void 0,w={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:r,variable:"",imports:{_:{escape:function(e){return(e=(t=e,null==t?"":M(t)))&&c.test(e)?e.replace(l,f):e;var t}}}};function T(e){return null==e?void 0===e?a:o:v&&v in Object(e)?function(e){var t=_.call(e,v),i=e[v];try{e[v]=void 0;var r=!0}catch(e){}var n=g.call(e);r&&(t?e[v]=i:delete e[v]);return n}(e):function(e){return g.call(e)}(e)}function M(e){if("string"==typeof e)return e;if(E(e))return function(e,t){for(var i=-1,r=null==e?0:e.length,n=Array(r);++i<r;)n[i]=t(e[i],i,e);return n}(e,M)+"";if(function(e){return"symbol"==typeof e||function(e){return null!=e&&"object"==typeof e}(e)&&T(e)==s}(e))return b?b.call(e):"";var t=e+"";return"0"==t&&1/e==-n?"-0":t}var E=Array.isArray;t.exports=w}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"lodash._reinterpolate":6}],11:[function(e,t,i){var r=e("./_root").Symbol;t.exports=r},{"./_root":18}],12:[function(e,t,i){var r=e("./_Symbol"),n=e("./_getRawTag"),o=e("./_objectToString"),s=r?r.toStringTag:void 0;
1t.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?n(e):o(e)}},{"./_Symbol":11,"./_getRawTag":15,"./_objectToString":16}],13:[function(e,t,i){(function(e){var i="object"==typeof e&&e&&e.Object===Object&&e;t.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],14:[function(e,t,i){var r=e("./_overArg")(Object.getPrototypeOf,Object);t.exports=r},{"./_overArg":17}],15:[function(e,t,i){var r=e("./_Symbol"),n=Object.prototype,o=n.hasOwnProperty,s=n.toString,a=r?r.toStringTag:void 0;t.exports=function(e){var t=o.call(e,a),i=e[a];try{e[a]=void 0;var r=!0}catch(e){}var n=s.call(e);r&&(t?e[a]=i:delete e[a]);return n}},{"./_Symbol":11}],16:[function(e,t,i){var r=Object.prototype.toString;t.exports=function(e){return r.call(e)}},{}],17:[function(e,t,i){t.exports=function(e,t){return function(i){return e(t(i))}}},{}],18:[function(e,t,i){var r=e("./_freeGlobal"),n="object"==typeof self&&self&&self.Object===Object&&self,o=r||n||Function("return this")();t.exports=o},{"./_freeGlobal":13}],19:[function(e,t,i){t.exports=function(e){return null!=e&&"object"==typeof e}},{}],20:[function(e,t,i){var r=e("./_baseGetTag"),n=e("./_getPrototype"),o=e("./isObjectLike"),s=Function.prototype,a=Object.prototype,l=s.toString,c=a.hasOwnProperty,u=l.call(Object);t.exports=function(e){if(!o(e)||"[object Object]"!=r(e))return!1;var t=n(e);if(null===t)return!0;var i=c.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&l.call(i)==u}},{"./_baseGetTag":12,"./_getPrototype":14,"./isObjectLike":19}],21:[function(e,t,i){var r,n,o=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(e){r=s}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();function l(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!r)&&setTimeout){r=setTimeout;return setTimeout(e,0)}try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}var c,u=[],h=!1,p=-1;function d(){if(h&&c){h=!1;c.length?u=c.concat(u):p=-1;u.length&&f()}}function f(){if(!h){var e=l(d);h=!0;for(var t=u.length;t;){c=u;u=[];for(;++p<t;)c&&c[p].run();p=-1;t=u.length}c=null;h=!1;!function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!n)&&clearTimeout){n=clearTimeout;return clearTimeout(e)}try{return n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];u.push(new m(e,t));1!==u.length||h||l(f)};function m(e,t){this.fun=e;this.array=t}m.prototype.run=function(){this.fun.apply(null,this.array)};o.title="browser";o.browser=!0;o.env={};o.argv=[];o.version="";o.versions={};function _(){}o.on=_;o.addListener=_;o.once=_;o.off=_;o.removeListener=_;o.removeAllListeners=_;o.emit=_;o.prependListener=_;o.prependOnceListener=_;o.listeners=function(e){return[]};o.binding=function(e){throw new Error("process.binding is not supported")};o.cwd=function(){return"/"};o.chdir=function(e){throw new Error("process.chdir is not supported")};o.umask=function(){return 0}},{}],22:[function(e,t,i){"use strict";i.__esModule=!0;function r(e){return function(t){var i=t.dispatch,r=t.getState;return function(t){return function(n){return"function"==typeof n?n(i,r,e):t(n)}}}}var n=r();n.withExtraArgument=r;i.default=n},{}],23:[function(e,t,i){"use strict";i.__esModule=!0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e};i.default=function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return function(e){return function(i,n,o){var a,l=e(i,n,o),c=l.dispatch,u={getState:l.getState,dispatch:function(e){return c(e)}};a=t.map((function(e){return e(u)}));c=s.default.apply(void 0,a)(l.dispatch);return r({},l,{dispatch:c})}}};var n,o=e("./compose"),s=(n=o)&&n.__esModule?n:{default:n}},{"./compose":26}],24:[function(e,t,i){"use strict";i.__esModule=!0;i.default=function(e,t){if("function"==typeof e)return r(e,t);if("object"!=typeof e||null===e)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var i=Object.keys(e),n={},o=0;o<i.length;o++){var s=i[o],a=e[s];"function"==typeof a&&(n[s]=r(a,t))}return n};function r(e,t){return function(){return t(e.apply(void 0,arguments))}}},{}],25:[function(e,t,i){(function(t){"use strict";i.__esModule=!0;i.default=function(e){for(var i=Object.keys(e),s={},l=0;l<i.length;l++){var c=i[l];"production"!==t.env.NODE_ENV&&void 0===e[c]&&(0,o.default)('No reducer provided for key "'+c+'"');"function"==typeof e[c]&&(s[c]=e[c])}var u=Object.keys(s),h=void 0;"production"!==t.env.NODE_ENV&&(h={});var p=void 0;try{!function(e){Object.keys(e).forEach((function(t){var i=e[t];if(void 0===i(void 0,{type:r.ActionTypes.INIT}))throw new Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===i(void 0,{type:"@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".")}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+r.ActionTypes.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')}))}(s)}catch(e){p=e}return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments[1];if(p)throw p;if("production"!==t.env.NODE_ENV){var l=function(e,t,i,o){var s=Object.keys(t),a=i&&i.type===r.ActionTypes.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(0===s.length)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!(0,n.default)(e))return"The "+a+' has unexpected type of "'+{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1]+'". Expected argument to be an object with the following keys: "'+s.join('", "')+'"';var l=Object.keys(e).filter((function(e){return!t.hasOwnProperty(e)&&!o[e]}));l.forEach((function(e){o[e]=!0}));if(l.length>0)return"Unexpected "+(l.length>1?"keys":"key")+' "'+l.join('", "')+'" found in '+a+'. Expected to find one of the known reducer keys instead: "'+s.join('", "')+'". Unexpected keys will be ignored.'}(e,s,i,h);l&&(0,o.default)(l)}for(var c=!1,d={},f=0;f<u.length;f++){var m=u[f],_=s[m],g=e[m],y=_(g,i);if(void 0===y){var v=a(m,i);throw new Error(v)}d[m]=y;c=c||y!==g}return c?d:e}};var r=e("./createStore"),n=s(e("lodash/isPlainObject")),o=s(e("./utils/warning"));
1function s(e){return e&&e.__esModule?e:{default:e}}function a(e,t){var i=t&&t.type;return"Given action "+(i&&'"'+i.toString()+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}}).call(this,e("_process"))},{"./createStore":27,"./utils/warning":29,_process:21,"lodash/isPlainObject":20}],26:[function(e,t,i){"use strict";i.__esModule=!0;i.default=function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];if(0===t.length)return function(e){return e};if(1===t.length)return t[0];return t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}},{}],27:[function(e,t,i){"use strict";i.__esModule=!0;i.ActionTypes=void 0;i.default=function e(t,i,o){var a;if("function"==typeof i&&void 0===o){o=i;i=void 0}if(void 0!==o){if("function"!=typeof o)throw new Error("Expected the enhancer to be a function.");return o(e)(t,i)}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var l=t,c=i,u=[],h=u,p=!1;function d(){h===u&&(h=u.slice())}function f(){return c}function m(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;d();h.push(e);return function(){if(t){t=!1;d();var i=h.indexOf(e);h.splice(i,1)}}}function _(e){if(!(0,r.default)(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(p)throw new Error("Reducers may not dispatch actions.");try{p=!0;c=l(c,e)}finally{p=!1}for(var t=u=h,i=0;i<t.length;i++){(0,t[i])()}return e}_({type:s.INIT});return(a={dispatch:_,subscribe:m,getState:f,replaceReducer:function(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");l=e;_({type:s.INIT})}})[n.default]=function(){var e,t=m;return(e={subscribe:function(e){if("object"!=typeof e)throw new TypeError("Expected the observer to be an object.");function i(){e.next&&e.next(f())}i();return{unsubscribe:t(i)}}})[n.default]=function(){return this},e},a};var r=o(e("lodash/isPlainObject")),n=o(e("symbol-observable"));function o(e){return e&&e.__esModule?e:{default:e}}var s=i.ActionTypes={INIT:"@@redux/INIT"}},{"lodash/isPlainObject":20,"symbol-observable":33}],28:[function(e,t,i){(function(t){"use strict";i.__esModule=!0;i.compose=i.applyMiddleware=i.bindActionCreators=i.combineReducers=i.createStore=void 0;var r=l(e("./createStore")),n=l(e("./combineReducers")),o=l(e("./bindActionCreators")),s=l(e("./applyMiddleware")),a=l(e("./compose"));l(e("./utils/warning"));function l(e){return e&&e.__esModule?e:{default:e}}function c(){}"production"!==t.env.NODE_ENV&&"string"==typeof c.name&&c.name;i.createStore=r.default;i.combineReducers=n.default;i.bindActionCreators=o.default;i.applyMiddleware=s.default;i.compose=a.default}).call(this,e("_process"))},{"./applyMiddleware":23,"./bindActionCreators":24,"./combineReducers":25,"./compose":26,"./createStore":27,"./utils/warning":29,_process:21}],29:[function(e,t,i){"use strict";i.__esModule=!0;i.default=function(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}},{}],30:[function(e,t,i){"use strict";var r=e("./src/suggestions");window.Suggestions=t.exports=r},{"./src/suggestions":32}],31:[function(e,t,i){var r=function(e){this.component=e;this.items=[];this.active=0;this.element=document.createElement("ul");this.element.className="suggestions";this.selectingListItem=!1;e.el.parentNode.insertBefore(this.element,e.el.nextSibling);return this};r.prototype.show=function(){this.element.style.display="block"};r.prototype.hide=function(){this.element.style.display="none"};r.prototype.add=function(e){this.items.push(e)};r.prototype.clear=function(){this.items=[];this.active=0};r.prototype.isEmpty=function(){return!this.items.length};r.prototype.draw=function(){this.element.innerHTML="";if(0!==this.items.length){for(var e=0;e<this.items.length;e++)this.drawItem(this.items[e],this.active===e);this.show()}else this.hide()};r.prototype.drawItem=function(e,t){var i=document.createElement("li"),r=document.createElement("a");t&&(i.className+=" active");r.innerHTML=e.string;i.appendChild(r);this.element.appendChild(i);i.addEventListener("mousedown",function(){this.selectingListItem=!0}.bind(this));i.addEventListener("mouseup",function(){this.handleMouseUp.call(this,e)}.bind(this))};r.prototype.handleMouseUp=function(e){this.selectingListItem=!1;this.component.value(e.original);this.clear();this.draw()};r.prototype.move=function(e){this.active=e;this.draw()};r.prototype.previous=function(){this.move(0===this.active?this.items.length-1:this.active-1)};r.prototype.next=function(){this.move(this.active===this.items.length-1?0:this.active+1)};t.exports=r},{}],32:[function(e,t,i){"use strict";var r=e("xtend"),n=e("fuzzy"),o=e("./list"),s=function(e,t,i){i=i||{};this.options=r({minLength:2,limit:5,filter:!0},i);this.el=e;this.data=t||[];this.list=new o(this);this.query="";this.selected=null;this.list.draw();this.el.addEventListener("keyup",function(e){this.handleKeyUp(e.keyCode)}.bind(this),!1);this.el.addEventListener("keydown",function(e){this.handleKeyDown(e)}.bind(this));this.el.addEventListener("focus",function(){this.handleFocus()}.bind(this));this.el.addEventListener("blur",function(){this.handleBlur()}.bind(this));this.el.addEventListener("paste",function(e){this.handlePaste(e)}.bind(this));return this};s.prototype.handleKeyUp=function(e){40!==e&&38!==e&&27!==e&&13!==e&&9!==e&&this.handleInputChange(this.el.value)};s.prototype.handleKeyDown=function(e){switch(e.keyCode){case 13:case 9:e.preventDefault();if(!this.list.isEmpty()){this.value(this.list.items[this.list.active].original);this.list.hide()}break;case 27:this.list.isEmpty()||this.list.hide();break;case 38:this.list.previous();break;case 40:this.list.next()}};s.prototype.handleBlur=function(){this.list.selectingListItem||this.list.hide()};s.prototype.handlePaste=function(e){if(e.clipboardData)this.handleInputChange(e.clipboardData.getData("Text"));else{var t=this;setTimeout((function(){t.handleInputChange(e.target.value)}),100)}};s.prototype.handleInputChange=function(e){this.query=this.normalize(e);this.list.clear();this.query.length<this.options.minLength?this.list.draw():this.getCandidates(function(e){for(var t=0;t<e.length;t++){this.list.add(e[t]);if(t===this.options.limit-1)break}this.list.draw()}.bind(this))};s.prototype.handleFocus=function(){this.list.isEmpty()||this.list.show();this.list.selectingListItem=!1};s.prototype.update=function(e){this.data=e;this.handleKeyUp()};s.prototype.clear=function(){this.data=[];this.list.clear()};s.prototype.normalize=function(e){return e=e.toLowerCase()};s.prototype.match=function(e,t){return e.indexOf(t)>-1};s.prototype.value=function(e){this.selected=e;
1this.el.value=this.getItemValue(e);if(document.createEvent){var t=document.createEvent("HTMLEvents");t.initEvent("change",!0,!1);this.el.dispatchEvent(t)}else this.el.fireEvent("onchange")};s.prototype.getCandidates=function(e){var t={pre:"<strong>",post:"</strong>",extract:function(e){return this.getItemValue(e)}.bind(this)};e(this.options.filter?n.filter(this.query,this.data,t):this.data.map(function(e){for(var t=this.getItemValue(e),i=this.normalize(t),r=i.lastIndexOf(this.query);r>-1;){var n=r+this.query.length;t=t.slice(0,r)+"<strong>"+t.slice(r,n)+"</strong>"+t.slice(n);r=i.slice(0,r).lastIndexOf(this.query)}return{original:e,string:t}}.bind(this)))};s.prototype.getItemValue=function(e){return e};t.exports=s},{"./list":31,fuzzy:4,xtend:37}],33:[function(e,t,i){(function(r){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n,o,s=e("./ponyfill.js"),a=(n=s)&&n.__esModule?n:{default:n};o="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r?r:void 0!==t?t:Function("return this")();var l=(0,a.default)(o);i.default=l}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./ponyfill.js":34}],34:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.default=function(e){var t,i=e.Symbol;if("function"==typeof i)if(i.observable)t=i.observable;else{t=i("observable");i.observable=t}else t="@@observable";return t}},{}],35:[function(e,t,i){var r=e("turf-meta").coordEach;t.exports=function(e){var t=[1/0,1/0,-1/0,-1/0];r(e,(function(e){t[0]>e[0]&&(t[0]=e[0]);t[1]>e[1]&&(t[1]=e[1]);t[2]<e[0]&&(t[2]=e[0]);t[3]<e[1]&&(t[3]=e[1])}));return t}},{"turf-meta":36}],36:[function(e,t,i){function r(e,t,i){var r,n,o,s,a,c,u,h,p,d=0,f="FeatureCollection"===e.type,m="Feature"===e.type,_=f?e.features.length:1;for(r=0;r<_;r++){c=(p="GeometryCollection"===(h=f?e.features[r].geometry:m?e.geometry:e).type)?h.geometries.length:1;for(s=0;s<c;s++){u=(a=p?h.geometries[s]:h).coordinates;d=!i||"Polygon"!==a.type&&"MultiPolygon"!==a.type?0:1;if("Point"===a.type)t(u);else if("LineString"===a.type||"MultiPoint"===a.type)for(n=0;n<u.length;n++)t(u[n]);else if("Polygon"===a.type||"MultiLineString"===a.type)for(n=0;n<u.length;n++)for(o=0;o<u[n].length-d;o++)t(u[n][o]);else{if("MultiPolygon"!==a.type)throw new Error("Unknown Geometry Type");for(n=0;n<u.length;n++)for(o=0;o<u[n].length;o++)for(l=0;l<u[n][o].length-d;l++)t(u[n][o][l])}}}}t.exports.coordEach=r;t.exports.coordReduce=function(e,t,i,n){r(e,(function(e){i=t(i,e)}),n);return i};function n(e,t){var i;switch(e.type){case"FeatureCollection":features=e.features;for(i=0;i<e.features.length;i++)t(e.features[i].properties);break;case"Feature":t(e.properties)}}t.exports.propEach=n;t.exports.propReduce=function(e,t,i){n(e,(function(e){i=t(i,e)}));return i}},{}],37:[function(e,t,i){t.exports=function(){for(var e={},t=0;t<arguments.length;t++){var i=arguments[t];for(var n in i)r.call(i,n)&&(e[n]=i[n])}return e};var r=Object.prototype.hasOwnProperty},{}],38:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.queryOrigin=function(e){return{type:n.ORIGIN_QUERY,query:e}};i.queryDestination=function(e){return{type:n.DESTINATION_QUERY,query:e}};i.queryOriginCoordinates=m;i.queryDestinationCoordinates=_;i.clearOrigin=function(){return function(e){e({type:n.ORIGIN_CLEAR});e(x("clear",{type:"origin"}));e(f(null))}};i.clearDestination=function(){return function(e){e({type:n.DESTINATION_CLEAR});e(x("clear",{type:"destination"}));e(f(null))}};i.setOptions=function(e){return{type:n.SET_OPTIONS,options:e}};i.hoverMarker=function(e){return function(t){t(function(e){return{type:n.HOVER_MARKER,hoverMarker:e}}(e?s.default.createPoint(e,{id:"hover"}):{}))}};i.setRouteIndex=g;i.createOrigin=y;i.createDestination=v;i.setProfile=function(e){return function(t,i){var r=i(),o=r.origin,s=r.destination;t({type:n.DIRECTIONS_PROFILE,profile:e});t(x("profile",{profile:e}));o.geometry&&s.geometry&&t(p())}};i.reverse=function(){return function(e,t){var i=t();i.destination.geometry&&e(l(i.destination.geometry.coordinates));i.origin.geometry&&e(c(i.origin.geometry.coordinates));i.origin.geometry&&i.destination.geometry&&e(p());for(var r=document.getElementsByClassName("suggestions"),n=0;n<r.length;n++)r[n].style.visibility="hidden"}};i.setOriginFromCoordinates=function(e){return function(t){s.default.validCoords(e)||(e=[s.default.wrap(e[0]),s.default.wrap(e[1])]);if(isNaN(e[0])&&isNaN(e[1]))return t(f(new Error("Coordinates are not valid")));t(m(e));t(y(e))}};i.setDestinationFromCoordinates=function(e){return function(t){s.default.validCoords(e)||(e=[s.default.wrap(e[0]),s.default.wrap(e[1])]);if(isNaN(e[0])&&isNaN(e[1]))return t(f(new Error("Coordinates are not valid")));t(v(e));t(_(e))}};i.addWaypoint=function(e,t){return function(i,r){var n=r(),o=n.destination,s=n.waypoints;s.splice(e,0,d(t));i(h(s));o.geometry&&i(p())}};i.setWaypoint=function(e,t){return function(i,r){var n=r(),o=n.destination,s=n.waypoints;s[e]=d(t);i(h(s));o.geometry&&i(p())}};i.removeWaypoint=function(e){return function(t,i){var r=i(),n=r.destination,o=r.waypoints;t(h(o=o.filter((function(t){return!s.default.coordinateMatch(t,e)}))));n.geometry&&t(p())}};i.eventSubscribe=function(e,t){return function(i,r){var o=r().events;o[e]=o[e]||[];o[e].push(t);return{type:n.EVENTS,events:o}}};i.eventEmit=x;
1var r,n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);t.default=e;return t}(e("../constants/action_types")),o=e("../utils"),s=(r=o)&&r.__esModule?r:{default:r};var a=new XMLHttpRequest;function l(e){return function(t){var i=s.default.createPoint(e,{id:"origin","marker-symbol":"A"});t({type:n.ORIGIN,origin:i});t(x("origin",{feature:i}))}}function c(e){return function(t){var i=s.default.createPoint(e,{id:"destination","marker-symbol":"B"});t({type:n.DESTINATION,destination:i});t(x("destination",{feature:i}))}}function u(e){return function(t){t({type:n.DIRECTIONS,directions:e});t(x("route",{route:e}))}}function h(e){return{type:n.WAYPOINTS,waypoints:e}}function p(){return function(e,t){var i=t(),r=i.api,n=i.accessToken,o=i.routeIndex,s=i.profile,h=i.alternatives,p=i.congestion,d=i.destination,m=i.language,_=i.exclude;if(d&&d.geometry){var y=function(e){var t=e(),i=t.origin,r=t.destination,n=t.waypoints,o=[];o.push(i.geometry.coordinates.join(","));o.push(";");n.length&&n.forEach((function(e){o.push(e.geometry.coordinates.join(","));o.push(";")}));o.push(r.geometry.coordinates.join(","));return encodeURIComponent(o.join(""))}(t),v=[];v.push("geometries=polyline");h&&v.push("alternatives=true");p&&v.push("annotations=congestion");v.push("steps=true");v.push("overview=full");m&&v.push("language="+m);_&&v.push("exclude="+_);n&&v.push("access_token="+n);a.abort();a.open("GET",""+r+s+"/"+y+".json?"+v.join("&"),!0);a.onload=function(){if(!(a.status>=200&&a.status<400)){e(u([]));return e(f(JSON.parse(a.responseText).message))}var t=JSON.parse(a.responseText);if(t.error){e(u([]));return e(f(t.error))}e(f(null));t.routes[o]||e(g(0));e(u(t.routes));e(l(t.waypoints[0].location));e(c(t.waypoints[t.waypoints.length-1].location))};a.onerror=function(){e(u([]));return e(f(JSON.parse(a.responseText).message))};a.send()}}}function d(e){var t={id:"waypoint"};return Object.assign(e,{properties:e.properties?Object.assign(e.properties,t):t})}function f(e){return function(t){t({type:"ERROR",error:e});e&&t(x("error",{error:e}))}}function m(e){return{type:n.ORIGIN_FROM_COORDINATES,coordinates:e}}function _(e){return{type:n.DESTINATION_FROM_COORDINATES,coordinates:e}}function g(e){return{type:n.ROUTE_INDEX,routeIndex:e}}function y(e){return function(t,i){var r=i().destination;t(l(e));r.geometry&&t(p())}}function v(e){return function(t,i){var r=i().origin;t(c(e));r.geometry&&t(p())}}function x(e,t){var i=this;return function(r,o){var s=o().events;if(!s[e])return{type:n.EVENTS,events:s};for(var a=s[e].slice(),l=0;l<a.length;l++)a[l].call(i,t)}}},{"../constants/action_types":39,"../utils":47}],39:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.DESTINATION="DESTINATION",i.DESTINATION_CLEAR="DESTINATION_CLEAR",i.DESTINATION_QUERY="DESTINATION_QUERY",i.DESTINATION_FROM_COORDINATES="DESTINATION_FROM_COORDINATES",i.DIRECTIONS="DIRECTIONS",i.DIRECTIONS_PROFILE="DIRECTIONS_PROFILE",i.EVENTS="EVENTS",i.ERROR="ERROR",i.HOVER_MARKER="HOVER_MARKER",i.ORIGIN="ORIGIN",i.ORIGIN_CLEAR="ORIGIN_CLEAR",i.ORIGIN_QUERY="ORIGIN_QUERY",i.ORIGIN_FROM_COORDINATES="ORIGIN_FROM_COORDINATES",i.ROUTE_INDEX="ROUTE_INDEX",i.SET_OPTIONS="SET_OPTIONS",i.WAYPOINTS="WAYPOINTS"},{}],40:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r="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},n=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1;r.configurable=!0;"value"in r&&(r.writable=!0);Object.defineProperty(e,r.key,r)}}return function(t,i,r){i&&e(t.prototype,i);r&&e(t,r);return t}}(),o=c(e("suggestions")),s=c(e("lodash.debounce")),a=e("events"),l=c(e("../utils"));function c(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);this._ev=new a.EventEmitter;this.options=t;this.api=t&&t.api||"https://api.mapbox.com/geocoding/v5/mapbox.places/"}n(e,[{key:"onAdd",value:function(e){this._map=e;this.request=new XMLHttpRequest;var t=document.createElement("div");t.className="mapboxgl-ctrl-geocoder";var i=document.createElement("span");i.className="geocoder-icon geocoder-icon-search";var r=this._inputEl=document.createElement("input");r.type="text";r.placeholder=this.options.placeholder;r.addEventListener("keydown",(0,s.default)(function(e){if(!e.target.value)return this._clearEl.classList.remove("active");e.metaKey||-1!==[9,27,37,39,13,38,40].indexOf(e.keyCode)||this._queryFromInput(e.target.value)}.bind(this)),200);r.addEventListener("change",function(t){t.target.value&&this._clearEl.classList.add("active");var i=this._typeahead.selected;if(i){if(this.options.flyTo)if(i.bbox&&i.context&&i.context.length<=3||i.bbox&&!i.context){var r=i.bbox;
1e.fitBounds([[r[0],r[1]],[r[2],r[3]]])}else e.flyTo({center:i.center,zoom:this.options.zoom});this._input=i;this.fire("result",{result:i})}}.bind(this));var n=document.createElement("div");n.classList.add("geocoder-pin-right");var a=this._clearEl=document.createElement("button");a.className="geocoder-icon geocoder-icon-close";a.addEventListener("click",this._clear.bind(this));var l=this._loadingEl=document.createElement("span");l.className="geocoder-icon geocoder-icon-loading";n.appendChild(a);n.appendChild(l);t.appendChild(i);t.appendChild(r);t.appendChild(n);this.options.container&&(this.options.position=!1);this._typeahead=new o.default(r,[],{filter:!1});this._typeahead.getItemValue=function(e){return e.place_name};return t}},{key:"_geocode",value:function(e,t){this._loadingEl.classList.add("active");this.fire("loading");var i=this.options,r=["placeholder","zoom","flyTo","accessToken"],n=Object.keys(this.options).filter((function(e){return-1===r.indexOf(e)})).map((function(e){return e+"="+i[e]})),o=this.options.accessToken?this.options.accessToken:mapboxgl.accessToken;n.push("access_token="+o);this.request.abort();this.request.open("GET",this.api+encodeURIComponent(e.trim())+".json?"+n.join("&"),!0);this.request.onload=function(){this._loadingEl.classList.remove("active");if(this.request.status>=200&&this.request.status<400){var e=JSON.parse(this.request.responseText);if(e.features.length)this._clearEl.classList.add("active");else{this._clearEl.classList.remove("active");this._typeahead.selected=null}this.fire("results",{results:e.features});this._typeahead.update(e.features);return t(e.features)}this.fire("error",{error:JSON.parse(this.request.responseText).message})}.bind(this);this.request.onerror=function(){this._loadingEl.classList.remove("active");this.fire("error",{error:JSON.parse(this.request.responseText).message})}.bind(this);this.request.send()}},{key:"_queryFromInput",value:function(e){(e=e.trim())||this._clear();e.length>2&&this._geocode(e,function(e){this._results=e}.bind(this))}},{key:"_change",value:function(){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1);this._inputEl.dispatchEvent(e)}},{key:"_query",value:function(e){if(e){"object"===(void 0===e?"undefined":r(e))&&e.length&&(e=[l.default.wrap(e[0]),l.default.wrap(e[1])].join());this._geocode(e,function(e){if(e.length){var t=e[0];this._results=e;this._typeahead.selected=t;this._inputEl.value=t.place_name;this._change()}}.bind(this))}}},{key:"_setInput",value:function(e){if(e){"object"===(void 0===e?"undefined":r(e))&&e.length&&(e=[l.default.roundWithOriginalPrecision(l.default.wrap(e[0]),e[0]),l.default.roundWithOriginalPrecision(l.default.wrap(e[1]),e[1])].join());this._inputEl.value=e;this._input=null;this._typeahead.selected=null;this._typeahead.clear();this._change()}}},{key:"_clear",value:function(){this._input=null;this._inputEl.value="";this._typeahead.selected=null;this._typeahead.clear();this._change();this._inputEl.focus();this._clearEl.classList.remove("active");this.fire("clear")}},{key:"getResult",value:function(){return this._input}},{key:"query",value:function(e){this._query(e);return this}},{key:"setInput",value:function(e){this._setInput(e);return this}},{key:"on",value:function(e,t){this._ev.on(e,t);this._ev.on("error",(function(e){console.log(e)}));return this}},{key:"fire",value:function(e,t){this._ev.emit(e,t);return this}},{key:"off",value:function(e,t){this._ev.removeListener(e,t);return this}}]);return e}();i.default=u},{"../utils":47,events:3,"lodash.debounce":7,suggestions:30}],41:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1;r.configurable=!0;"value"in r&&(r.writable=!0);Object.defineProperty(e,r.key,r)}}return function(t,i,r){i&&e(t.prototype,i);r&&e(t,r);return t}}(),n=l(e("./geocoder")),o=l(e("lodash.template")),s=l(e("lodash.isequal")),a=l(e("turf-extent"));function l(e){return e&&e.__esModule?e:{default:e}}var c=(0,o.default)("<div class='mapbox-directions-component mapbox-directions-inputs'>\n <div class='mapbox-directions-component-keyline'>\n <div class='mapbox-directions-origin'>\n <label class='mapbox-form-label'>
1\n <span class='directions-icon directions-icon-depart'></span>\n </label>\n <div id='mapbox-directions-origin-input'></div>\n </div>\n\n <button\n class='directions-icon directions-icon-reverse directions-reverse js-reverse-inputs'\n title='Reverse origin & destination'>\n </button>\n\n <div class='mapbox-directions-destination'>\n <label class='mapbox-form-label'>\n <span class='directions-icon directions-icon-arrive'></span>\n </label>\n <div id='mapbox-directions-destination-input'></div>\n </div>\n </div>\n\n <% if (controls.profileSwitcher) { %>\n <div class='mapbox-directions-profile mapbox-directions-component-keyline mapbox-directions-clearfix'><input\n id='mapbox-directions-profile-driving-traffic'\n type='radio'\n name='profile'\n value='mapbox/driving-traffic'\n <% if (profile === 'mapbox/driving-traffic') { %>checked<% } %>\n />\n <label for='mapbox-directions-profile-driving-traffic'>Traffic</label>\n <input\n id='mapbox-directions-profile-driving'\n type='radio'\n name='profile'\n value='mapbox/driving'\n <% if (profile === 'mapbox/driving') { %>checked<% } %>\n />\n <label for='mapbox-directions-profile-driving'>Driving</label>\n <input\n id='mapbox-directions-profile-walking'\n type='radio'\n name='profile'\n value='mapbox/walking'\n <% if (profile === 'mapbox/walking') { %>checked<% } %>\n />\n <label for='mapbox-directions-profile-walking'>Walking</label>\n <input\n id='mapbox-directions-profile-cycling'\n type='radio'\n name='profile'\n value='mapbox/cycling'\n <% if (profile === 'mapbox/cycling') { %>checked<% } %>\n />\n <label for='mapbox-directions-profile-cycling'>Cycling</label>\n </div>\n <% } %>\n</div>\n"),u=function(){function e(t,i,r,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var o=i.getState(),s=o.originQuery,a=o.destinationQuery,l=o.profile,u=o.controls;t.innerHTML=c({originQuery:s,destinationQuery:a,profile:l,controls:u});this.container=t;this.actions=r;this.store=i;this._map=n;this.onAdd();this.render()}r(e,[{key:"animateToCoordinates",value:function(e,t){var i=this.store.getState(),r=i.origin,n=i.destination,o=i.routePadding;if(r.geometry&&n.geometry&&!(0,s.default)(r.geometry,n.geometry)){var l=(0,a.default)({type:"FeatureCollection",features:[r,n]});this._map.fitBounds([[l[0],l[1]],[l[2],l[3]]],{padding:o})}else this._map.flyTo({center:t})}},{key:"onAdd",value:function(){var e=this,t=this.actions,i=t.clearOrigin,r=t.clearDestination,o=t.createOrigin,s=t.createDestination,a=t.setProfile,l=t.reverse,c=this.store.getState(),u=c.geocoder,h=c.accessToken,p=c.flyTo,d=c.placeholderOrigin,f=c.placeholderDestination,m=c.zoom;this.originInput=new n.default(Object.assign({},{accessToken:h},u,{flyTo:p,placeholder:d,zoom:m}));var _=this.originInput.onAdd(this._map);this.container.querySelector("#mapbox-directions-origin-input").appendChild(_);this.destinationInput=new n.default(Object.assign({},{accessToken:h},u,{flyTo:p,placeholder:f,zoom:m}));var g=this.destinationInput.onAdd(this._map);this.container.querySelector("#mapbox-directions-destination-input").appendChild(g);this.originInput.on("result",(function(t){var i=t.result.center;o(i);e.animateToCoordinates("origin",i)}));this.originInput.on("clear",i);this.destinationInput.on("result",(function(t){var i=t.result.center;s(i);e.animateToCoordinates("destination",i)}));this.destinationInput.on("clear",r);var y=this.container.querySelectorAll('input[type="radio"]');Array.prototype.forEach.call(y,(function(e){e.addEventListener("change",(function(){a(e.value)}))}));this.container.querySelector(".js-reverse-inputs").addEventListener("click",(function(){var t=e.store.getState(),i=t.origin,r=t.destination;i&&e.actions.queryDestination(i.geometry.coordinates);r&&e.actions.queryOrigin(r.geometry.coordinates);l()}))}},{key:"render",value:function(){var e=this;this.store.subscribe((function(){var t=e.store.getState(),i=t.originQuery,r
1=t.destinationQuery,n=t.originQueryCoordinates,o=t.destinationQueryCoordinates;if(i){e.originInput.query(i);e.actions.queryOrigin(null)}if(r){e.destinationInput.query(r);e.actions.queryDestination(null)}if(n){e.originInput.setInput(n);e.animateToCoordinates("origin",n);e.actions.queryOriginCoordinates(null)}if(o){e.destinationInput.setInput(o);e.animateToCoordinates("destination",o);e.actions.queryDestinationCoordinates(null)}}))}}]);return e}();i.default=u},{"./geocoder":40,"lodash.isequal":8,"lodash.template":9,"turf-extent":35}],42:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1;r.configurable=!0;"value"in r&&(r.writable=!0);Object.defineProperty(e,r.key,r)}}return function(t,i,r){i&&e(t.prototype,i);r&&e(t,r);return t}}(),n=a(e("../utils")),o=a(e("lodash.template")),s=a(e("lodash.isequal"));function a(e){return e&&e.__esModule?e:{default:e}}var l=(0,o.default)("<div class='directions-control directions-control-directions'>\n <div class='mapbox-directions-component mapbox-directions-route-summary<% if (routes > 1) { %> mapbox-directions-multiple<% } %>'>\n <% if (routes > 1) { %>\n <div class='mapbox-directions-routes mapbox-directions-clearfix'>\n <% for (var i = 0; i < routes; i++) { %>\n <input type='radio' name='routes' id='<%= i %>' <% if (i === routeIndex) { %>checked<% } %>>\n <label for='<%= i %>' class='mapbox-directions-route'><%= i + 1 %></label>\n <% } %>\n </div>\n <% } %>\n <h1><%- duration %></h1>\n <span><%- distance %></span>\n </div>\n\n <div class='mapbox-directions-instructions'>\n <div class='mapbox-directions-instructions-wrapper'>\n <ol class='mapbox-directions-steps'>\n <% steps.forEach(function(step) { %>\n <%\n var distance = step.distance ? format(step.distance) : false;\n var icon = step.maneuver.modifier ? step.maneuver.modifier.replace(/\\s+/g, '-').toLowerCase() : step.maneuver.type.replace(/\\s+/g, '-').toLowerCase();\n\n if (step.maneuver.type === 'arrive' || step.maneuver.type === 'depart') {\n icon = step.maneuver.type;\n }\n\n if (step.maneuver.type === 'roundabout' || step.maneuver.type === 'rotary') {\n icon= 'roundabout';\n }\n\n var lng = step.maneuver.location[0];\n var lat = step.maneuver.location[1];\n %>\n <li\n data-lat='<%= lat %>'\n data-lng='<%= lng %>'\n class='mapbox-directions-step'>\n <span class='directions-icon directions-icon-<%= icon %>'></span>\n <div class='mapbox-directions-step-maneuver'>
1\n <%= step.maneuver.instruction %>\n </div>\n <% if (distance) { %>\n <div class='mapbox-directions-step-distance'>\n <%= distance %>\n </div>\n <% } %>\n </li>\n <% }); %>\n </ol>\n </div>\n </div>\n</div>\n"),c=(0,o.default)("<div class='directions-control directions-control-directions'>\n <div class='mapbox-directions-error'>\n <%= error %>\n </div>\n</div>\n"),u=function(){function e(t,i,r,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);this.container=t;this.actions=r;this.store=i;this._map=n;this.directions={};this.render()}r(e,[{key:"render",value:function(){var e=this;this.store.subscribe((function(){var t=e.actions,i=t.hoverMarker,r=t.setRouteIndex,o=e.store.getState(),a=o.routeIndex,u=o.unit,h=o.directions,p=o.error,d=o.compile,f=!(0,s.default)(h[a],e.directions);if(p)e.container.innerHTML=c({error:p});else if(h.length&&f){var m=e.directions=h[a];d&&m.legs.forEach((function(e){e.steps.forEach((function(e){e.maneuver.instruction=d("en",e)}))}));e.container.innerHTML=l({routeIndex:a,routes:h.length,steps:m.legs[0].steps,format:n.default.format[u],duration:n.default.format[u](m.distance),distance:n.default.format.duration(m.duration)});var _=e.container.querySelectorAll(".mapbox-directions-step");Array.prototype.forEach.call(_,(function(t){var r=t.getAttribute("data-lng"),n=t.getAttribute("data-lat");t.addEventListener("mouseover",(function(){i([r,n])}));t.addEventListener("mouseout",(function(){i(null)}));t.addEventListener("click",(function(){e._map.flyTo({center:[r,n],zoom:16})}))}));var g=e.container.querySelectorAll('input[type="radio"]');Array.prototype.forEach.call(g,(function(e){e.addEventListener("change",(function(e){r(parseInt(e.target.id,10))}))}))}else e.container.innerHTML&&f&&(e.container.innerHTML="")}))}}]);return e}();i.default=u},{"../utils":47,"lodash.isequal":8,"lodash.template":9}],43:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1;r.configurable=!0;"value"in r&&(r.writable=!0);Object.defineProperty(e,r.key,r)}}return function(t,i,r){i&&e(t.prototype,i);r&&e(t,r);return t}}(),n=e("redux"),o=d(e("redux-thunk")),s=e("@mapbox/polyline"),a=d(e("./utils")),l=d(e("./reducers")),c=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);t.default=e;return t}(e("./actions")),u=d(e("./directions_style")),h=d(e("./controls/inputs")),p=d(e("./controls/instructions"));function d(e){return e&&e.__esModule?e:{default:e}}var f=(0,n.applyMiddleware)(o.default)(n.createStore)(l.default),m=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);this.actions=(0,n.bindActionCreators)(c,f.dispatch);this.actions.setOptions(t||{});this.options=t||{};this.onDragDown=this._onDragDown.bind(this);this.onDragMove=this._onDragMove.bind(this);this.onDragUp=this._onDragUp.bind(this);this.move=this._move.bind(this);this.onClick=this._clickHandler().bind(this)}r(e,[{key:"onAdd",value:function(e){this._map=e;var t=f.getState().controls,i=this.container=document.createElement("div");i.className="mapboxgl-ctrl-directions mapboxgl-ctrl";var r=document.createElement("div");r.className="directions-control directions-control-inputs";new h.default(r,f,this.actions,this._map);var n=document.createElement("div");n.className="directions-control directions-control-instructions";new p.default(n,f,{hoverMarker:this.actions.hoverMarker,setRouteIndex:this.actions.setRouteIndex},this._map);t.inputs&&i.appendChild(r);t.instructions&&i.appendChild(n);this.subscribedActions();this.mapState();return i}},{key:"onRemove",value:function(e){this.container.parentNode.removeChild(this.container);this.removeRoutes();e.off("mousedown",this.onDragDown);e.off("mousemove",this.move);e.off("touchstart",this.onDragDown);e.off("touchstart",this.move);e.off("click",this.onClick);if(this.storeUnsubscribe){this.storeUnsubscribe();delete this.storeUnsubscribe}u.default.forEach((function(t){e.getLayer(t.id)&&e.removeLayer(t.id)}));e.getSource("directions")&&e.removeSource("directions");this._map=null;return this}},{key:"mapState",value:function(){var e=this,t=f.getState(),i=t.profile,r=(t.alternatives,t.congestion,t.styles),n=t.interactive;t.compile;this.actions.eventEmit("profile",{profile:i});this._map.addSource("directions",{type:"geojson",data:{type:"FeatureCollection",features:[]}});r&&r.length&&r.forEach((function(t){return e._map.addLayer(t)}));u.default.forEach((function(t){e._map.getLayer(t.id)||e._map.addLayer(t)}));if(n){this._map.on("mousedown",this.onDragDown);this._map.on("mousemove",this.move);this._map.on("click",this.onClick);this._map.on("touchstart",this.move);this._map.on("touchstart",this.onDragDown)}}},{key:"subscribedActions",value:function(){var e=this;this.storeUnsubscribe=f.subscribe((function(){var t=f.getState(),i=t.origin,r=t.destination,n=t.hoverMarker,o=t.directions,a=t.routeIndex,l={type:"FeatureCollection",features:[i,r,n].filter((function(e){return e.geometry}))};o.length&&o.forEach((function(e,t){var i=[];(0,s.decode)(e.geometry,5).map((function(e){return e.reverse()}
1)).forEach((function(r,n){var o=i[i.length-1],s=e.legs[0].annotation&&e.legs[0].annotation.congestion&&e.legs[0].annotation.congestion[n-1];if(!o||s&&o.properties.congestion!==s){var l={geometry:{type:"LineString",coordinates:[]},properties:{"route-index":t,route:t===a?"selected":"alternate"}};o&&l.geometry.coordinates.push(o.geometry.coordinates[o.geometry.coordinates.length-1]);l.geometry.coordinates.push(r);s&&(l.properties.congestion=e.legs[0].annotation.congestion[n-1]);i.push(l)}else o.geometry.coordinates.push(r)}));l.features=l.features.concat(i);t===a&&e.legs[0].steps.forEach((function(e){"waypoint"===e.maneuver.type&&l.features.push({type:"Feature",geometry:e.maneuver.location,properties:{id:"waypoint"}})}))}));e._map.style&&e._map.getSource("directions")&&e._map.getSource("directions").setData(l)}))}},{key:"_clickHandler",value:function(){var e=null;return function(t){if(e){clearTimeout(e);e=null;this._map.zoomIn()}else{var i=this._onSingleClick.bind(this);e=setTimeout((function(){i(t);e=null}),250)}}}},{key:"_onSingleClick",value:function(e){var t=this,i=f.getState().origin,r=[e.lngLat.lng,e.lngLat.lat];if(i.geometry){var n=this._map.queryRenderedFeatures(e.point,{layers:["directions-origin-point","directions-destination-point","directions-waypoint-point","directions-route-line-alt"]});if(n.length){n.forEach((function(e){"directions-waypoint-point"===e.layer.id&&t.actions.removeWaypoint(e)}));if("alternate"===n[0].properties.route){var o=n[0].properties["route-index"];this.actions.setRouteIndex(o)}}else{this.actions.setDestinationFromCoordinates(r);this._map.flyTo({center:r})}}else this.actions.setOriginFromCoordinates(r)}},{key:"_move",value:function(e){var t=this,i=f.getState().hoverMarker,r=this._map.queryRenderedFeatures(e.point,{layers:["directions-route-line-alt","directions-route-line","directions-origin-point","directions-destination-point","directions-hover-point"]});this._map.getCanvas().style.cursor=r.length?"pointer":"";if(r.length){this.isCursorOverPoint=r[0];this._map.dragPan.disable();r.forEach((function(r){"directions-route-line"===r.layer.id?t.actions.hoverMarker([e.lngLat.lng,e.lngLat.lat]):i.geometry&&t.actions.hoverMarker(null)}))}else if(this.isCursorOverPoint){this.isCursorOverPoint=!1;this._map.dragPan.enable()}}},{key:"_onDragDown",value:function(){if(this.isCursorOverPoint){this.isDragging=this.isCursorOverPoint;this._map.getCanvas().style.cursor="grab";this._map.on("mousemove",this.onDragMove);this._map.on("mouseup",this.onDragUp);this._map.on("touchmove",this.onDragMove);this._map.on("touchend",this.onDragUp)}}},{key:"_onDragMove",value:function(e){if(this.isDragging){var t=[e.lngLat.lng,e.lngLat.lat];switch(this.isDragging.layer.id){case"directions-origin-point":this.actions.createOrigin(t);break;case"directions-destination-point":this.actions.createDestination(t);break;case"directions-hover-point":this.actions.hoverMarker(t)}}}},{key:"_onDragUp",value:function(){if(this.isDragging){var e=f.getState(),t=e.hoverMarker,i=e.origin,r=e.destination;switch(this.isDragging.layer.id){case"directions-origin-point":this.actions.setOriginFromCoordinates(i.geometry.coordinates);break;case"directions-destination-point":this.actions.setDestinationFromCoordinates(r.geometry.coordinates);break;case"directions-hover-point":t.geometry&&!a.default.coordinateMatch(this.isDragging,t)&&this.actions.addWaypoint(0,t)}this.isDragging=!1;this._map.getCanvas().style.cursor="";this._map.off("touchmove",this.onDragMove);this._map.off("touchend",this.onDragUp);this._map.off("mousemove",this.onDragMove);this._map.off("mouseup",this.onDragUp)}}},{key:"interactive",value:function(e){if(e){this._map.on("touchstart",this.move);this._map.on("touchstart",this.onDragDown);this._map.on("mousedown",this.onDragDown);this._map.on("mousemove",this.move);this._map.on("click",this.onClick)}else{this._map.off("touchstart",this.move);this._map.off("touchstart",this.onDragDown);this._map.off("mousedown",this.onDragDown);this._map.off("mousemove",this.move);this._map.off("click",this.onClick)}return this}},{key:"getOrigin",value:function(){return f.getState().origin}},{key:"setOrigin",value:function(e){"string"==typeof e?this.actions.queryOrigin(e):this.actions.setOriginFromCoordinates(e);return this}},{key:"getDestination",value:function(){return f.getState().destination}},{key:"setDestination",value:function(e){"string"==typeof e?this.actions.queryDestination(e):this.actions.setDestinationFromCoordinates(e);return this}},{key:"reverse",value:function(){this.actions.reverse();return this}},{key:"addWaypoint",value:function(e,t){t.type||(t=a.default.createPoint(t,{id:"wayp
1oint"}));this.actions.addWaypoint(e,t);return this}},{key:"setWaypoint",value:function(e,t){t.type||(t=a.default.createPoint(t,{id:"waypoint"}));this.actions.setWaypoint(e,t);return this}},{key:"removeWaypoint",value:function(e){var t=f.getState().waypoints;this.actions.removeWaypoint(t[e]);return this}},{key:"getWaypoints",value:function(){return f.getState().waypoints}},{key:"removeRoutes",value:function(){this.actions.clearOrigin();this.actions.clearDestination();return this}},{key:"on",value:function(e,t){this.actions.eventSubscribe(e,t);return this}}]);return e}();i.default=m},{"./actions":38,"./controls/inputs":41,"./controls/instructions":42,"./directions_style":44,"./reducers":46,"./utils":47,"@mapbox/polyline":1,redux:28,"redux-thunk":22}],44:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.default=[{id:"directions-route-line-alt",type:"line",source:"directions",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#bbb","line-width":4},filter:["all",["in","$type","LineString"],["in","route","alternate"]]},{id:"directions-route-line-casing",type:"line",source:"directions",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#2d5f99","line-width":12},filter:["all",["in","$type","LineString"],["in","route","selected"]]},{id:"directions-route-line",type:"line",source:"directions",layout:{"line-cap":"butt","line-join":"round"},paint:{"line-color":{property:"congestion",type:"categorical",default:"#4882c5",stops:[["unknown","#4882c5"],["low","#4882c5"],["moderate","#f09a46"],["heavy","#e34341"],["severe","#8b2342"]]},"line-width":7},filter:["all",["in","$type","LineString"],["in","route","selected"]]},{id:"directions-hover-point-casing",type:"circle",source:"directions",paint:{"circle-radius":8,"circle-color":"#fff"},filter:["all",["in","$type","Point"],["in","id","hover"]]},{id:"directions-hover-point",type:"circle",source:"directions",paint:{"circle-radius":6,"circle-color":"#3bb2d0"},filter:["all",["in","$type","Point"],["in","id","hover"]]},{id:"directions-waypoint-point-casing",type:"circle",source:"directions",paint:{"circle-radius":8,"circle-color":"#fff"},filter:["all",["in","$type","Point"],["in","id","waypoint"]]},{id:"directions-waypoint-point",type:"circle",source:"directions",paint:{"circle-radius":6,"circle-color":"#8a8bc9"},filter:["all",["in","$type","Point"],["in","id","waypoint"]]},{id:"directions-origin-point",type:"circle",source:"directions",paint:{"circle-radius":18,"circle-color":"#3bb2d0"},filter:["all",["in","$type","Point"],["in","marker-symbol","A"]]},{id:"directions-origin-label",type:"symbol",source:"directions",layout:{"text-field":"A","text-font":["Open Sans Bold","Arial Unicode MS Bold"],"text-size":12},paint:{"text-color":"#fff"},filter:["all",["in","$type","Point"],["in","marker-symbol","A"]]},{id:"directions-destination-point",type:"circle",source:"directions",paint:{"circle-radius":18,"circle-color":"#8a8bc9"},filter:["all",["in","$type","Point"],["in","marker-symbol","B"]]},{id:"directions-destination-label",type:"symbol",source:"directions",layout:{"text-field":"B","text-font":["Open Sans Bold","Arial Unicode MS Bold"],"text-size":12},paint:{"text-color":"#fff"},filter:["all",["in","$type","Point"],["in","marker-symbol","B"]]}]},{}],45:[function(e,t,i){"use strict";var r,n=e("./directions"),o=(r=n)&&r.__esModule?r:{default:r};t.exports=o.default},{"./directions":43}],46:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r,n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);t.default=e;return t}(e("../constants/action_types.js")),o=e("deep-assign"),s=(r=o)&&r.__esModule?r:{default:r};var a={api:"https://api.mapbox.com/directions/v5/",profile:"mapbox/driving-traffic",alternatives:!1,congestion:!1,unit:"imperial",flyTo:!0,placeholderOrigin:"Choose a starting place",placeholderDestination:"Choose destination",zoom:16,language:"en",compile:null,proximity:!1,styles:[],controls:{profileSwitcher:!0,inputs:!0,instructions:!0},geocoder:{},interactive:!0,events:{},origin:{},destination:{},hoverMarker:{},waypoints:[],originQuery:null,destinationQuery:null,originQueryCoordinates:null,destinationQueryCoordinates:null,directions:[],routeIndex:0,routePadding:80};i.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,t=arguments[1];switch(t.type){case n.SET_OPTIONS:return(0,s.default)({},e,t.options);case n.DIRECTIONS_PROFILE:return Object.assign({},e,{profile:t.profile});case n.ORIGIN:return Object.assign({},e,{origin:t.origin,hoverMarker:{}});case n.DESTINATION:return Object.assign({},e,{destination:t.destination,hoverMarker:{}});case n.HOVER_MARKER:return Object.assign({},e,{hoverMarker:t.hoverMarker});case n.WAYPOINTS:return Object.assign({}
1,e,{waypoints:t.waypoints});case n.ORIGIN_QUERY:return Object.assign({},e,{originQuery:t.query});case n.DESTINATION_QUERY:return Object.assign({},e,{destinationQuery:t.query});case n.ORIGIN_FROM_COORDINATES:return Object.assign({},e,{originQueryCoordinates:t.coordinates});case n.DESTINATION_FROM_COORDINATES:return Object.assign({},e,{destinationQueryCoordinates:t.coordinates});case n.ORIGIN_CLEAR:return Object.assign({},e,{origin:{},originQuery:"",waypoints:[],directions:[]});case n.DESTINATION_CLEAR:return Object.assign({},e,{destination:{},destinationQuery:"",waypoints:[],directions:[]});case n.DIRECTIONS:return Object.assign({},e,{directions:t.directions});case n.ROUTE_INDEX:return Object.assign({},e,{routeIndex:t.routeIndex});case n.ERROR:return Object.assign({},e,{error:t.error});default:return e}}},{"../constants/action_types.js":39,"deep-assign":2}],47:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r={duration:function(e){var t=Math.floor(e/60),i=Math.floor(t/60);e%=60;t%=60;return 0===i&&0===t?e+"s":0===i?t+"min":i+"h "+t+"min"},imperial:function(e){var t=e/1609.344;return t>=100?t.toFixed(0)+"mi":t>=10?t.toFixed(1)+"mi":t>=.1?t.toFixed(2)+"mi":(5280*t).toFixed(0)+"ft"},metric:function(e){return e>=1e5?(e/1e3).toFixed(0)+"km":e>=1e4?(e/1e3).toFixed(1)+"km":e>=100?(e/1e3).toFixed(2)+"km":e.toFixed(0)+"m"}};i.default={format:r,coordinateMatch:function(e,t){e=e.geometry.coordinates;t=t.geometry.coordinates;return e.join()===t.join()||e[0].toFixed(3)===t[0].toFixed(3)&&e[1].toFixed(3)===t[1].toFixed(3)},createPoint:function(e,t){return{type:"Feature",geometry:{type:"Point",coordinates:e},properties:t||{}}},validCoords:function(e){return e[0]>=-180&&e[0]<=180&&e[1]>=-90&&e[1]<=90},wrap:function(e){var t=((e- -180)%360+360)%360-180;return-180===t?180:t},roundWithOriginalPrecision:function(e,t){var i=0;Math.floor(t)!==t&&(i=t.toString().split(".")[1].length);return e.toFixed(Math.min(i,5))}}},{}]},{},[45])(45)}));!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).MapboxGeocoder=e()}}((function(){return function e(t,i,r){function n(s,a){if(!i[s]){if(!t[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var u=i[s]={exports:{}};t[s][0].call(u.exports,(function(e){return n(t[s][1][e]||e)}),u,u.exports,e,t,i,r)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)n(r[s]);return n}({1:[function(e,t,i){"use strict";function r(e){return(r="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})(e)}function n(e){this.origin=e.origin||"https://api.mapbox.com",this.endpoint="events/v2",this.access_token=e.accessToken,this.version="0.3.0",this.pluginSessionID=this.generateSessionID(),this.sessionIncrementer=0,this.userAgent=this.getUserAgent(),this.options=e,this.send=this.send.bind(this),this.countries=e.countries?e.countries.split(","):null,this.types=e.types?e.types.split(","):null,this.bbox=e.bbox?e.bbox:null,this.language=e.language?e.language.split(","):null,this.limit=e.limit?+e.limit:null,this.locale=navigator.language||null,this.enableEventLogging=this.shouldEnableLogging(e),this.eventQueue=new Array,this.flushInterval=e.flushInterval||1e3,this.maxQueueSize=e.maxQueueSize||100,this.timer=this.flushInterval?setTimeout(this.flush.bind(this),this.flushInterval):null,this.lastSentInput="",this.lastSentIndex=0}var o=e("nanoid").nanoid;n.prototype={select:function(e,t){var i=this.getEventPayload("search.select",t,{selectedFeature:e});if(i&&(i.resultIndex!==this.lastSentIndex||i.queryString!==this.lastSentInput)&&-1!=i.resultIndex)return this.lastSentIndex=i.resultIndex,this.lastSentInput=i.queryString,this.push(i)},start:function(e){var t=this.getEventPayload("search.start",e);if(t)return this.push(t)},keyevent:function(e,t){if(e.key&&!e.metaKey&&-1===[9,27,37,39,13,38,40].indexOf(e.keyCode)){var i=this.getEventPayload("search.keystroke",t,{key:e.key});if(i)return this.push(i)}},send:function(e,t){if(this.enableEventLogging){var i=this.getRequestOptions(e);this.request(i,function(e){return e?this.handleError(e,t):t?t():void 0}.bind(this))}else if(t)return t()},getRequestOptions:function(e){return Array.isArray(e)||(e=[e]),{method:"POST",host:this.origin,path:this.endpoint+"?access_token="+this.access_token,headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}},getEventPayload:function(e,t){var i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("search.select"===e&&!n.selectedFeature||"search.keystroke"===e&&!n.key)return null;if(t.options.proximity)if("object"===r(t.options.proximity))i=[t.options.proximity.longitude,t.options.proximity.latitude];else if("ip"===t.options.proximity){var o=t._headers?t._headers["ip-proximity"]:null;i=o&&"string"==typeof o?o.split(",").map(parseFloat):[999,999]}else i=t.options.proximity;else i=null;var s=t._map?t._map.getZoom():void 0,a={event:e,version:this.getEventSchemaVersion(e),created:+new Date,sessionIdentifier:this.getSessionId(),country:this.countries,userAgent:this.userAgent,language:this.language,bbox:this.bbox,types:this.types,endpoint:"mapbox.places",autocomplete:t.options.autocomplete,fuzzyMatch:t.options.fuzzyMatch,proximity:i,limit:t.options.limit,routing:t.options.routing,worldview:t.options.worldview,mapZoom:s,keyboardLocale:this.locale};if("search.select"===e?a.queryString=t.inputString:"search.select"!=e&&t._inputEl?a.queryString=t._inputEl.value:a.queryString=t.inputString,["search.keystroke","search.select"].includes(e)&&(a.path="geocoding/v5/mapbox.places"),"search.keystroke"===e&&n.key)a.lastAction=n.key;else if("search.select"===e&&n.selectedFeature){var l=n.selectedFeature,c=this.getSelectedIndex(l,t);
vendor: 8,155 bytes, line 1
1if(a.resultIndex=c,a.resultPlaceName=l.place_name,a.resultId=l.id,l.properties&&(a.resultMapboxId=l.properties.mapbox_id),t._typeahead){var u=t._typeahead.data;u&&u.length>0&&(a.suggestionIds=this.getSuggestionIds(u),a.suggestionNames=this.getSuggestionNames(u),a.suggestionTypes=this.getSuggestionTypes(u),a.suggestionSources=this.getSuggestionSources(u))}}return this.validatePayload(a)?a:null},request:function(e,t){var i=new XMLHttpRequest;i.onreadystatechange=function(){if(4==this.readyState)return t(204==this.status?null:this.statusText)},i.open(e.method,e.host+"/"+e.path,!0);for(var r in e.headers){var n=e.headers[r];i.setRequestHeader(r,n)}i.send(e.body)},handleError:function(e,t){if(t)return t(e)},generateSessionID:function(){return o()},getSessionId:function(){return this.pluginSessionID+"."+this.sessionIncrementer},getUserAgent:function(){return"mapbox-gl-geocoder."+this.version+"."+navigator.userAgent},getSelectedIndex:function(e,t){if(t._typeahead){var i=t._typeahead.data,r=e.id;return i.map((function(e){return e.id})).indexOf(r)}},getSuggestionIds:function(e){return e.map((function(e){return e.properties?e.properties.mapbox_id||"":e.id||""}))},getSuggestionNames:function(e){return e.map((function(e){return e.place_name||""}))},getSuggestionTypes:function(e){return e.map((function(e){return e.place_type&&Array.isArray(e.place_type)&&e.place_type[0]||""}))},getSuggestionSources:function(e){return e.map((function(e){return e._source||""}))},getEventSchemaVersion:function(e){return["search.keystroke","search.select"].includes(e)?"2.2":"2.0"},validatePayload:function(e){if(!e||!e.event)return!1;var t=e.event;return"search.start"===t?this.objectHasRequiredProps(e,["event","created","sessionIdentifier","queryString"]):"search.keystroke"===t?this.objectHasRequiredProps(e,["event","created","sessionIdentifier","queryString","lastAction"]):"search.select"!==t||this.objectHasRequiredProps(e,["event","created","sessionIdentifier","queryString","resultIndex","path","suggestionIds"])},objectHasRequiredProps:function(e,t){return t.every((function(t){return"queryString"===t?"string"==typeof e[t]&&e[t].length>0:void 0!==e[t]}))},shouldEnableLogging:function(e){return!1!==e.enableEventLogging&&(!e.origin||"https://api.mapbox.com"===e.origin)},flush:function(){this.eventQueue.length>0&&(this.send(this.eventQueue),this.eventQueue=new Array),this.timer&&clearTimeout(this.timer),this.flushInterval&&(this.timer=setTimeout(this.flush.bind(this),this.flushInterval))},push:function(e,t){this.eventQueue.push(e),(this.eventQueue.length>=this.maxQueueSize||t)&&this.flush()},remove:function(){this.flush()}},t.exports=n},{nanoid:32}],2:[function(e,t,i){"use strict";t.exports={fr:{name:"France",bbox:[[-4.59235,41.380007],[9.560016,51.148506]]},us:{name:"United States",bbox:[[-171.791111,18.91619],[-66.96466,71.357764]]},ru:{name:"Russia",bbox:[[19.66064,41.151416],[190.10042,81.2504]]},ca:{name:"Canada",bbox:[[-140.99778,41.675105],[-52.648099,83.23324]]}}},{}],3:[function(e,t,i){"use strict";function r(){}r.prototype={isSupport:function(){return Boolean(window.navigator.geolocation)},getCurrentPosition:function(){var e={enableHighAccuracy:!0};return new Promise((function(t,i){window.navigator.geolocation.getCurrentPosition(t,i,e)}))}},t.exports=r},{}],4:[function(e,t,i){"use strict";function r(e){this._eventEmitter=new a,this.options=s({},this.options,e),this.inputString="",this.fresh=!0,this.lastSelected=null,this.geolocation=new f}var n=e("suggestions"),o=e("lodash.debounce"),s=e("xtend"),a=e("events").EventEmitter,l=e("./exceptions"),c=e("@mapbox/mapbox-sdk"),u=e("@mapbox/mapbox-sdk/services/geocoding"),h=e("./events"),p=e("./localization"),d=e("subtag"),f=e("./geolocation"),m=e("./utils"),_=0,g=1,y=2;r.prototype={options:{zoom:16,flyTo:!0,trackProximity:!0,minLength:2,reverseGeocode:!1,flipCoordinates:!1,limit:5,origin:"https://api.mapbox.com",enableEventLogging:!0,marker:!0,mapboxgl:null,collapsed:!1,clearAndBlurOnEsc:!1,clearOnBlur:!1,enableGeolocation:!1,addressAccuracy:"street",getItemValue:function(e){return e.place_name},render:function(e){var t=e.place_name.split(",");return'<div class="mapboxgl-ctrl-geocoder--suggestion"><div class="mapboxgl-ctrl-geocoder--suggestion-title">'+t[0]+'</div><div class="mapboxgl-ctrl-geocoder--suggestion-address">'+t.splice(1,t.length).join(",")+"</div></div>"}},_headers:{},addTo:function(e){function t(e,t){if(!document.body.contains(t))throw new Error("Element provided to #addTo() exists, but is not in the DOM");var i=e.onAdd();t.appendChild(i)}if(e._controlContainer)e.addControl(this);else if(e instanceof HTMLElement)t(this,e);else{if("string"!=typeof e)throw new Error("Error: addTo must be a mapbox-gl-js map, an html element, or a CSS selector query for a single html element");var i=document.querySelectorAll(e);if(0===i.length)throw new Error("Element ",e,"not found.");if(i.length>1)throw new Error("Geocoder can only be added to a single html element");t(this,i[0])}},onAdd:function(e){if(e&&"string"!=typeof e&&(this._map=e),this.setLanguage(),this.options.localGeocoderOnly||(this.geocoderService=u(c({accessToken:this.options.accessToken,origin:this.options.origin}))),this.options.localGeocoderOnly&&!this.options.localGeocoder)throw new Error("A localGeocoder function must be specified to use localGeocoderOnly mode");this.eventManager=new h(this.options),this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onPaste=this._onPaste.bind(this),this._onBlur=this._onBlur.bind(this),this._showButton=this._showButton.bind(this),this._hideButton=this._hideButton.bind(this),this._onQueryResult=this._onQueryResult.bind(this),this.clear=this.clear.bind(this),this._updateProximity=this._updateProximity.bind(this),this._collapse=this._collapse.bind(this),this._unCollapse=this._unCollapse.bind(this),this._clear=this._clear.bind(this),this._clearOnBlur=this._clearOnBlur.bind(this),this._geolocateUser=this._geolocateUser.bind(this);var t=this.container=document.createElement("div");t.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl";var i=this.createIcon("search",'<path d="M7.4 2.5c-2.7 0-4.9 2.2-4.9 4.9s2.2 4.9 4.9 4.9c1 0 1.8-.2 2.5-.8l3.7 3.7c.2.2.4.3.8.3.7 0 1.1-.4 1.1-1.1 0-.3-.1-.5-.3-.8L11.4 10c.4-.8.8-1.6.8-2.5.1-2.8-2.1-5-4.8-5zm0 1.6c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2-3.3-1.3-3.3-3.1 1.4-3.3 3.3-3.3z"/>');this._inputEl=document.createElement("input"),this._inputEl.type="text",this._inputEl.className="mapboxgl-ctrl-geocoder--input",this.setPlaceholder(),this.options.collapsed&&(this._collapse(),this.container.addEventListener("mouseenter",this._unCollapse),this.container.addEventListener("mouseleave",this._collapse),this._inputEl.addEventListener("focus",this._unCollapse)),(this.options.collapsed||this.options.clearOnBlur)&&this._inputEl.addEventListener("blur",this._onBlur),this._inputEl.addEventListener("keydown",o(this._onKeyDown,200)),this._inputEl.addEventListener("paste",this._onPaste),this._inputEl.addEventListener("change",this._onChange),this.container.addEventListener("mouseenter",this._showButton),this.container.addEventListener("mouseleave",this._hideButton),this._inputEl.addEventListener("keyup",function(e){this.eventManager.keyevent(e,this)}.bind(this));var r=document.createElement("div");r.classList.add("mapboxgl-ctrl-geocoder--pin-right"),this._clearEl=document.createElement("button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear),this._clearEl.className="mapboxgl-ctrl-geocoder--button";var s=this.createIcon("close",'<path d="M3.8 2.5c-.6 0-1.3.7-1.3 1.3 0 .3.2.7.5.8L7.2 9 3 13.2c-.3.3-.5.7-.5 1 0 .6.7 1.3 1.3 1.3.3 0 .7-.2 1-.5L9 10.8l4.2 4.2c.2.3.7.3 1 .3.6 0 1.3-.7 1.3-1.3 0-.3-.2-.7-.3-1l-4.4-4L15 4.6c.3-.2.5-.5.5-.8 0-.7-.7-1.3-1.3-1.3-.3 0-.7.2-1 .3L9 7.1 4.8 2.8c-.3-.1-.7-.3-1-.3z"/>');if(this._clearEl.appendChild(s),this._loadingEl=this.createIcon("loading",'<path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"/><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.
16 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"/>'),r.appendChild(this._clearEl),r.appendChild(this._loadingEl),t.appendChild(i),t.appendChild(this._inputEl),t.appendChild(r),this.options.enableGeolocation&&this.geolocation.isSupport()){this._geolocateEl=document.createElement("button"),this._geolocateEl.setAttribute("aria-label","Geolocate"),this._geolocateEl.addEventListener("click",this._geolocateUser),this._geolocateEl.className="mapboxgl-ctrl-geocoder--button";var a=this.createIcon("geolocate",'<path d="M12.999 3.677L2.042 8.269c-.962.403-.747 1.823.29 1.912l5.032.431.431 5.033c.089 1.037 1.509 1.252 1.912.29l4.592-10.957c.345-.822-.477-1.644-1.299-1.299z" fill="#4264fb"/>');this._geolocateEl.appendChild(a),r.appendChild(this._geolocateEl),this._showGeolocateButton()}var l=this._typeahead=new n(this._inputEl,[],{filter:!1,minLength:this.options.minLength,limit:this.options.limit});this.setRenderFunction(this.options.render),l.getItemValue=this.options.getItemValue;var p=l.list.draw,d=this._footerNode=function(){var e=document.createElement("div");return e.className="mapboxgl-ctrl-geocoder--powered-by",e.innerHTML='<a href="https://www.mapbox.com/search-service" target="_blank">Powered by Mapbox</a>',e}();return l.list.draw=function(){p.call(this),d.addEventListener("mousedown",function(){this.selectingListItem=!0}.bind(this)),d.addEventListener("mouseup",function(){this.selectingListItem=!1}.bind(this)),this.element.appendChild(d)},this.mapMarker=null,this._handleMarker=this._handleMarker.bind(this),this._map&&(this.options.trackProximity&&(this._updateProximity(),this._map.on("moveend",this._updateProximity)),this._mapboxgl=this.options.mapboxgl,!this._mapboxgl&&this.options.marker&&(console.error("No mapboxgl detected in options. Map markers are disabled. Please set options.mapboxgl."),this.options.marker=!1)),t},_geolocateUser:function(){this._hideGeolocateButton(),this._showLoadingIcon(),this.geolocation.getCurrentPosition().then(function(e){this._hideLoadingIcon();var t={geometry:{type:"Point",coordinates:[e.coords.longitude,e.coords.latitude]}};this._handleMarker(t),this._fly(t),this._typeahead.clear(),this._typeahead.selected=!0,this.lastSelected=JSON.stringify(t),this._showClearButton(),this.fresh=!1;var i={limit:1,language:[this.options.language],query:t.geometry.coordinates,types:["address"]};if(this.options.localGeocoderOnly){var r=t.geometry.coordinates[0]+","+t.geometry.coordinates[1];this._setInputValue(r),this._eventEmitter.emit("result",{result:t})}else this.geocoderService.reverseGeocode(i).send().then(function(e){var i=e.body.features[0];if(i){var r=m.transformFeatureToGeolocationText(i,this.options.addressAccuracy);this._setInputValue(r),i.user_coordinates=t.geometry.coordinates,this._eventEmitter.emit("result",{result:i})}else this._eventEmitter.emit("result",{result:{user_coordinates:t.geometry.coordinates}})}.bind(this))}.bind(this)).catch(function(e){1===e.code?this._renderUserDeniedGeolocationError():this._renderLocationError(),this._hideLoadingIcon(),this._showGeolocateButton(),this._hideAttribution()}.bind(this))},createIcon:function(e,t){var i=document.createElementNS("http://www.w3.org/2000/svg","svg");return i.setAttribute("class","mapboxgl-ctrl-geocoder--icon mapboxgl-ctrl-geocoder--icon-"+e),i.setAttribute("viewBox","0 0 18 18"),i.setAttribute("xml:space","preserve"),i.setAttribute("width",18),i.setAttribute("height",18),i.innerHTML=t,i},onRemove:function(){return this.container.parentNode.removeChild(this.container),this.options.trackProximity&&this._map&&this._map.off("moveend",this._updateProximity),this._removeMarker(),this._map=null,this},_setInputValue:function(e){this._inputEl.value=e,setTimeout(function(){this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0)}.bind(this),1)},_onPaste:function(e){var t=(e.clipboardData||window.clipboardData).getData("text");t.length>=this.options.minLength&&this._geocode(t)},_onKeyDown:function(e){if(27===e.keyCode&&this.options.clearAndBlurOnEsc)return this._clear(e),this._inputEl.blur();var t=e.target&&e.target.shadowRoot?e.target.shadowRoot.activeElement:e.target;if(!t||!t.value)return this.fresh=!0,9!==e.keyCode&&this.clear(e),this._showGeolocateButton(),this._hideClearButton();this._hideGeolocateButton(),e.metaKey||-1!==[9,27,37,39,13,38,40].indexOf(e.keyCode)||t.value.length>=this.options.minLength&&this._geocode(t.value)},_showButton:function(){this._typeahead.selected&&this._showClearButton()},_hideButton:function(){this._typeahead.selected&&this._hideClearButton()},_showClearButton:function(){this._clearEl.style.display="block"},_hideClearButton:function(){this._clearEl.style.display="none"},_showGeolocateButton:function(){this._geolocateEl&&this.geolocation.isSupport()&&(this._geolocateEl.style.display="block")},_hideGeolocateButton:function(){this._geolocateEl&&(this._geolocateEl.style.display="none")},_showLoadingIcon:function(){this._loadingEl.style.display="block"},_hideLoadingIcon:function(){this._loadingEl.style.display="none"},_showAttribution:function(){this._footerNode.style.display="block"},_hideAttribution:function(){this._footerNode.style.display="none"},_onBlur:function(e){this.options.clearOnBlur&&this._clearOnBlur(e),this.options.collapsed&&this._collapse()},_onChange:function(){var e=this._typeahead.selected;e&&JSON.stringify(e)!==this.lastSelected&&(this._hideClearButton(),this.options.flyTo&&this._fly(e),this.options.marker&&this._mapboxgl&&this._handleMarker(e),this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0),this.lastSelected=JSON.stringify(e),this._eventEmitter.emit("result",{result:e}),this.eventManager.select(e,this))},_fly:function(e){var t;if(e.properties&&l[e.properties.short_code])t=s({},this.options.flyTo),this._map&&this._map.fitBounds(l[e.properties.short_code].bbox,t);else if(e.bbox){var i=e.bbox;t=s({},this.options.flyTo),this._map&&this._map.fitBounds([[i[0],i[1]],[i[2],i[3]]],t)}else{var r={zoom:this.options.zoom};t=s({},r,this.options.flyTo),e.center?t.center=e.center:e.geometry&&e.geometry.type&&"Point"===e.geometry.type&&e.geometry.coordinates&&(t.center=e.geometry.coordinates),this._map&&this._map.flyTo(t)}},_requestType:function(e,t){return e.localGeocoderOnly?g:e.reverseGeocode&&m.REVERSE_GEOCODE_COORD_RGX.test(t)?y:_},_setupConfig:function(e,t){var i=/[\s,]+/,r=this,n=["bbox","limit","proximity","countries","types","language","reverseMode","mode","autocomplete","fuzzyMatch","routing","worldview"].reduce((function(e,t){if(void 0===r.options[t]||null===r.options[t])return e;["countries","types","language"].indexOf(t)>-1?e[t]=r.options[t].split(i):e[t]=r.options[t];var n="number"==typeof r.options[t].longitude&&"number"==typeof r.options[t].latitude;if("proximity"===t&&n){var o=r.options[t].longitude,s=r.options[t].latitude;e[t]=[o,s]}return e}),{});switch(e){case y:var o=t.split(i).map((function(e){return parseFloat(e,10)}));r.options.flipCoordinates||o.reverse(),n.types&&n.types[0],n=s(n,{query:o,limit:1}),["proximity","autocomplete","fuzzyMatch","bbox"].forEach((function(e){e in n&&delete n[e]}));break;case _:/^(-?\d{1,3}(\.\d{0,256})?)[, ]+(-?\d{1,3}(\.\d{0,256})?)?$/.test(t.trim())&&(t=t.replace(/,/g," ")),n=s(n,{query:t})}return n.session_token=this.eventManager.getSessionId(),n},_geocode:function(e){this.inputString=e,this._showLoadingIcon(),this._eventEmitter.emit("loading",{query:e});var t,i=this._requestType(this.options,e),r=this._setupConfig(i,e);switch(i){case g:t=Promise.resolve();break;case _:t=this.geocoderService.forwardGeocode(r).send();break;case y:t=this.geocoderService.reverseGeocode(r).send()}var n=this.options.localGeocoder&&this.options.localGeocoder(e)||[],o=[],s=null;return t.catch(function(e){s=e}.bind(this)).then(function(t){this._hideLoadingIcon();var i={};return t?"200"==t.statusCode&&((i=t.body).request=t.request,i.headers=t.headers,this._headers=t.headers):i={type:"FeatureCollection",features:[]},i.config=r,this.fresh&&(this.eventManager.start(this),this.fresh=!1),i.features&&i.features.length&&i.features.map((function(e){e._source="mapbox"})),i.features=i.features?n.concat(i.features):n,this.options.externalGeocoder?(o=this.options.externalGeocoder(e,i.features)||Promise.resolve([])).then((function(e){return i.features=i.features?e.concat(i.features):e,i}),(function(){return i})):i}.bind(this)).then(function(e){if(s)throw s;this.options.filter&&e.features.length&&(e.features=e.features.filter(this.options.filter)),e.features.length?(this._showClearButton(),this._hideGeolocateButton(),this._showAttribution(),this._eventEmitter.emit("results",e),this._typeahead.update(e.features)):(this._hideClearButton(),this._hideAttribution(),this._typeahead.selected=null,this._renderNoResults(),this._eventEmitter.emit("results",e))}.bind(this)).catch(function(e){this._hideLoadingIcon(),this._hideAttribution(),n.length&&this.options.localGeocoder||o.length&&this.options.externalGeocoder?(this._showClearButton(),this._hideGeolocateButton(),this._typeahead.update(n)):(this._hideClearButton(),this._typeahead.selected=null,this._renderError()),this._eventEmitter.emit("results",{features:n}),this._eventEmitter.emit("error",{error:e})}.bind(this)),t},_clear:function(e){e&&e.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this.eventManager.sessionIncrementer++,this._onChange(),this._hideClearButton(),this._showGeolocateButton(),this._removeMarker(),this.lastSelected=null,this._eventEmitter.emit("clear"),this.fresh=!0},clear:function(e){this._clear(e),this._inputEl.focus()},_clearOnBlur:function(e){e.relatedTarget&&this._clear(e)},_onQueryResult:function(e){var t=e.body;if(t.features.length){var i=t.features[0];this._typeahead.selected=i,this._inputEl.value=i.place_name,this._onChange()}},_updateProximity:function(){if(this._map&&this.options.trackProximity)if(this._map.getZoom()>9){var e=this._map.getCenter().wrap();this.setProximity({longitude:e.lng,latitude:e.lat},!1)}else this.setProximity(null,!1)},_collapse:function(){this._inputEl.value||this._inputEl===document.activeElement||this.container.classList.add("mapboxgl-ctrl-geocoder--collapsed")},_unCollapse:function(){this.container.classList.remove("mapboxgl-ctrl-geocoder--collapsed")},query:function(e){return this._geocode(e).then(this._onQueryResult),this},_renderError:function(){this._renderMessage("<div class='mapbox-gl-geocoder--error'>There was an error reaching the server</div>")},_renderLocationError:function(){this._renderMessage("<div class='mapbox-gl-geocoder--error'>A location error has occurred</div>")},_renderNoResults:function(){this._renderMessage("<div class='mapbox-gl-geocoder--error mapbox-gl-geocoder--no-results'>No results found</div>")},_renderUserDeniedGeolocationError:function(){this._renderMessage("<div class='mapbox-gl-geocoder--error'>Geolocation permission denied</div>")},_renderMessage:function(e){this._typeahead.update([]),this._typeahead.selected=null,this._typeahead.clear(),this._typeahead.renderError(e)},_getPlaceholderText:function(){if(this.options.placeholder)return this.options.placeholder;if(this.options.language){var e=this.options.language.split(",")[0],t=d.language(e),i=p.placeholder[t];if(i)return i}return"Search"},setInput:function(e,t){return void 0===t&&(t=!1),this._inputEl.value=e,this._typeahead.selected=null,this._typeahead.clear(),e.length>=this.options.minLength&&(t?this._geocode(e):this._onChange()),this},setProximity:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.options.proximity=e,t&&(this.options.trackProximity=!1),this},getProximity:function(){return this.options.proximity},setRenderFunction:function(e){return e&&"function"==typeof e&&(this._typeahead.render=e),this},getRenderFunction:function(){return this._typeahead.render},setLanguage:function(e){var t=navigator.language||navigator.userLanguage||navigator.browserLanguage;return this.options.language=e||this.options.language||t,this},getLanguage:function(){return this.options.language},getZoom:function(){return this.options.zoom},setZoom:function(e){return this.options.zoom=e,this},getFlyTo:function(){return this.options.flyTo},setFlyTo:function(e){return this.options.flyTo=e,this},getPlaceholder:function(){return this.options.placeholder},setPlaceholder:function(e){return this.options.placeholder=e||this._getPlaceholderText(),this._inputEl.placeholder=this.options.placeholder,this._inputEl.setAttribute("aria-label",this.options.placeholder),this},getBbox:function(){return this.options.bbox},setBbox:function(e){return this.options.bbox=e,this},getCountries:function(){return this.options.countries},setCountries:function(e){return this.options.countries=e,this},getTypes:function(){return this.options.types},setTypes:function(e){return this.options.types=e,this},getMinLength:function(){return this.options.minLength},setMinLength:function(e){return this.options.minLength=e,this._typeahead&&(this._typeahead.options.minLength=e),this},getLimit:function(){return this.options.limit},setLimit:function(e){return this.options.limit=e,this._typeahead&&(this._typeahead.options.limit=e),this},getFilter:function(){return this.options.filter},setFilter:function(e){return this.options.filter=e,this},setOrigin:function(e){return this.options.origin=e,this.geocoderService=u(c({accessToken:this.options.accessToken,origin:this.options.origin})),this},getOrigin:function(){return this.options.origin},setAccessToken:function(e){return this.options.accessToken=e,this.geocoderService=u(c({accessToken:this.options.accessToken,origin:this.options.origin})),this},setAutocomplete:function(e){return this.options.autocomplete=e,this},getAutocomplete:function(){return this.options.autocomplete},setFuzzyMatch:function(e){return this.options.fuzzyMatch=e,this},getFuzzyMatch:function(){return this.options.fuzzyMatch},setRouting:function(e){return this.options.routing=e,this},getRouting:function(){return this.options.routing},setWorldview:function(e){return this.options.worldview=e,this},getWorldview:function(){return this.options.worldview},_handleMarker:function(e){if(this._map){this._removeMarker();var t=s({},{color:"#4668F2"},this.options.marker);return this.mapMarker=new this._mapboxgl.Marker(t),e.center?this.mapMarker.setLngLat(e.center).addTo(this._map):e.geometry&&e.geometry.type&&"Point"===e.geometry.type&&e.geometry.coordinates&&this.mapMarker.setLngLat(e.geometry.coordinates).addTo(this._map),this}},_removeMarker:function(){this.mapMarker&&(this.mapMarker.remove(),this.mapMarker=null)},on:function(e,t){return this._eventEmitter.on(e,t),this},off:function(e,t){return this._eventEmitter.removeListener(e,t),this.eventManager.remove(),this}},t.exports=r},{"./events":1,"./exceptions":2,"./geolocation":3,"./localization":5,"./utils":6,"@mapbox/mapbox-sdk":8,"@mapbox/mapbox-sdk/services/geocoding":19,events:27,"lodash.debounce":31,subtag:35,suggestions:36,xtend:39}],5:[function(e,t,i){"use strict";
1t.exports={placeholder:{de:"Suche",it:"Ricerca",en:"Search",nl:"Zoeken",fr:"Chercher",ca:"Cerca",he:"××פש",ja:"ãµã¼ã",lv:"MeklÄt",pt:"Procurar",sr:"ÐÑеÑÑага",zh:"æç´¢",cs:"VyhledávánÃ",hu:"Keresés",ka:"á«áááá",nb:"Søke",sk:"Vyhľadávanie",th:"à¸à¹à¸à¸«à¸²",fi:"Hae",is:"Leita",ko:"ìì",pl:"Szukaj",sl:"Iskanje",fa:"جستجÙ",ru:"ÐоиÑк"}}},{}],6:[function(e,t,i){"use strict";function r(e){var t=e.address||"",i=e.text||"",r=e.place_name||"",n={address:r.split(",")[0],houseNumber:t,street:i,placeName:r};return e.context.forEach((function(e){var t=e.id.split(".")[0];n[t]=e.text})),n}t.exports={transformFeatureToGeolocationText:function(e,t){var i=r(e),n=["address","street","place","country"];if("function"==typeof t)return t(i);var o=n.indexOf(t);return(-1===o?n:n.slice(o)).reduce((function(e,t){return i[t]?(""!==e&&(e+=", "),e+i[t]):e}),"")},getAddressInfo:r,REVERSE_GEOCODE_COORD_RGX:/^[ ]*(-?\d{1,3}(\.\d{0,256})?)[, ]+(-?\d{1,3}(\.\d{0,256})?)[ ]*$/}},{}],7:[function(e,t,i){"use strict";function r(e){var t=Array.isArray(e),i=function(i){return t?e[i]:e};return function(r){var o=n(h.plainArray,r);if(o)return o;if(t&&r.length!==e.length)return"an array with "+e.length+" items";for(var s=0;s<r.length;s++)if(o=n(i(s),r[s]))return[s].concat(o)}}function n(e,t){if(null!=t||e.hasOwnProperty("__required")){var i=e(t);return i?Array.isArray(i)?i:[i]:void 0}}function o(e,t){var i=e.length,r=e[i-1],n=e.slice(0,i-1);return 0===n.length&&(n=[u]),t=c(t,{path:n}),"function"==typeof r?r(t):s(t,function(e){return"must be "+function(e){return/^an? /.test(e)?e:/^[aeiou]/i.test(e)?"an "+e:/^[a-z]/i.test(e)?"a "+e:e}(e)+"."}(r))}function s(e,t){return(a(e.path)?"Item at position ":"")+(e.path.join(".")+" "+t)}function a(e){return"number"==typeof e[e.length-1]||"number"==typeof e[0]}var l=e("is-plain-obj"),c=e("xtend"),u="value",h={assert:function(e,t){return t=t||{},function(i){var r=n(e,i);if(r){var s=o(r,t);throw t.apiName&&(s=t.apiName+": "+s),new Error(s)}}}};h.shape=function(e){var t=function(e){return Object.keys(e||{}).map((function(t){return{key:t,value:e[t]}}))}(e);return function(e){var i=n(h.plainObject,e);if(i)return i;for(var r,s=[],a=0;a<t.length;a++)r=t[a].key,(i=n(t[a].value,e[r]))&&s.push([r].concat(i));return s.length<2?s[0]:function(e){s=s.map((function(t){return"- "+t[0]+": "+o(t,e).split("\n").join("\n ")}));var t=e.path.join(".");return"The following properties"+(t===u?"":" of "+t)+" have invalid values:\n "+s.join("\n ")}}},h.strictShape=function(e){var t=h.shape(e);return function(i){var r=t(i);if(r)return r;var n=Object.keys(i).reduce((function(t,i){return void 0===e[i]&&t.push(i),t}),[]);return 0!==n.length?function(){return"The following keys are invalid: "+n.join(", ")}:void 0}},h.arrayOf=function(e){return r(e)},h.tuple=function(){return r(Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments))},h.required=function(e){function t(t){return null==t?function(e){return s(e,a(e.path)?"cannot be undefined/null.":"is required.")}:e.apply(this,arguments)}return t.__required=!0,t},h.oneOfType=function(){var e=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments);return function(t){var i=e.map((function(e){return n(e,t)})).filter(Boolean);if(i.length===e.length)return i.every((function(e){return 1===e.length&&"string"==typeof e[0]}))?function(e){return e.length<2?e[0]:2===e.length?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e.slice(-1)}(i.map((function(e){return e[0]}))):i.reduce((function(e,t){return t.length>e.length?t:e}))}},h.equal=function(e){return function(t){if(t!==e)return JSON.stringify(e)}},h.oneOf=function(){var e=(Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments)).map((function(e){return h.equal(e)}));return h.oneOfType.apply(this,e)},h.range=function(e){var t=e[0],i=e[1];return function(e){if(n(h.number,e)||e<t||e>i)return"number between "+t+" & "+i+" (inclusive)"}},h.any=function(){},h.boolean=function(e){if("boolean"!=typeof e)return"boolean"},h.number=function(e){if("number"!=typeof e)return"number"},h.plainArray=function(e){if(!Array.isArray(e))return"array"},h.plainObject=function(e){if(!l(e))return"object"},h.string=function(e){if("string"!=typeof e)return"string"},h.func=function(e){if("function"!=typeof e)return"function"},h.validate=n,h.processMessage=o,t.exports=h},{"is-plain-obj":30,xtend:39}],8:[function(e,t,i){"use strict";var r=e("./lib/client");t.exports=r},{"./lib/client":9}],9:[function(e,t,i){"use strict";function r(e){o.call(this,e)}var n=e("./browser-layer"),o=e("../classes/mapi-client");r.prototype=Object.create(o.prototype),r.prototype.constructor=r,r.prototype.sendRequest=n.browserSend,r.prototype.abortRequest=n.browserAbort,t.exports=function(e){return new r(e)}},{"../classes/mapi-client":11,"./browser-layer":10}],10:[function(e,t,i){"use strict";function r(e){var t=e.total,i=e.loaded;return{total:t,transferred:i,percent:100*i/t}}function n(e,t){return new Promise((function(i,n){t.onprogress=function(t){e.emitter.emit(l.EVENT_PROGRESS_DOWNLOAD,r(t))};var o=e.file;o&&(t.upload.onprogress=function(t){e.emitter.emit(l.EVENT_PROGRESS_UPLOAD,r(t))}),t.onerror=function(e){n(e)},t.onabort=function(){var t=new a({request:e,type:l.ERROR_REQUEST_ABORTED});n(t)},t.onload=function(){if(delete u[e.id],t.status<200||t.status>=400){var r=new a({request:e,body:t.response,statusCode:t.status});n(r)}else i(t)};var s=e.body;"string"==typeof s?t.send(s):s?t.send(JSON.stringify(s)):o?t.send(o):t.send(),u[e.id]=t})).then((function(t){return function(e,t){return new s(e,{body:t.response,headers:c(t.getAllResponseHeaders()),statusCode:t.status})}(e,t)}))}function o(e,t){var i=e.url(t),r=new window.XMLHttpRequest;
1return r.open(e.method,i),Object.keys(e.headers).forEach((function(t){r.setRequestHeader(t,e.headers[t])})),r}var s=e("../classes/mapi-response"),a=e("../classes/mapi-error"),l=e("../constants"),c=e("../helpers/parse-headers"),u={};t.exports={browserAbort:function(e){var t=u[e.id];t&&(t.abort(),delete u[e.id])},sendRequestXhr:n,browserSend:function(e){return Promise.resolve().then((function(){var t=o(e,e.client.accessToken);return n(e,t)}))},createRequestXhr:o}},{"../classes/mapi-error":12,"../classes/mapi-response":14,"../constants":15,"../helpers/parse-headers":16}],11:[function(e,t,i){"use strict";function r(e){if(!e||!e.accessToken)throw new Error("Cannot create a client without an access token");n(e.accessToken),this.accessToken=e.accessToken,this.origin=e.origin||s.API_ORIGIN}var n=e("@mapbox/parse-mapbox-token"),o=e("./mapi-request"),s=e("../constants");r.prototype.createRequest=function(e){return new o(this,e)},t.exports=r},{"../constants":15,"./mapi-request":13,"@mapbox/parse-mapbox-token":25}],12:[function(e,t,i){"use strict";var r=e("../constants");t.exports=function(e){var t,i=e.type||r.ERROR_HTTP;if(e.body)try{t=JSON.parse(e.body)}catch(i){t=e.body}else t=null;var n=e.message||null;n||("string"==typeof t?n=t:t&&"string"==typeof t.message?n=t.message:i===r.ERROR_REQUEST_ABORTED&&(n="Request aborted")),this.message=n,this.type=i,this.statusCode=e.statusCode||null,this.request=e.request,this.body=t}},{"../constants":15}],13:[function(e,t,i){"use strict";function r(e,t){if(!e)throw new Error("MapiRequest requires a client");if(!t||!t.path||!t.method)throw new Error("MapiRequest requires an options object with path and method properties");var i={};t.body&&(i["content-type"]="application/json");var r=o(i,t.headers),n=Object.keys(r).reduce((function(e,t){return e[t.toLowerCase()]=r[t],e}),{});this.id=c++,this._options=t,this.emitter=new s,this.client=e,this.response=null,this.error=null,this.sent=!1,this.aborted=!1,this.path=t.path,this.method=t.method,this.origin=t.origin||e.origin,this.query=t.query||{},this.params=t.params||{},this.body=t.body||null,this.file=t.file||null,this.encoding=t.encoding||"utf8",this.sendFileAs=t.sendFileAs||null,this.headers=n}var n=e("@mapbox/parse-mapbox-token"),o=e("xtend"),s=e("eventemitter3"),a=e("../helpers/url-utils"),l=e("../constants"),c=1;r.prototype.url=function(e){var t=a.prependOrigin(this.path,this.origin);t=a.appendQueryObject(t,this.query);var i=this.params,r=null==e?this.client.accessToken:e;if(r){t=a.appendQueryParam(t,"access_token",r);var s=n(r).user;i=o({ownerId:s},i)}return t=a.interpolateRouteParams(t,i)},r.prototype.send=function(){var e=this;if(e.sent)throw new Error("This request has already been sent. Check the response and error properties. Create a new request with clone().");return e.sent=!0,e.client.sendRequest(e).then((function(t){return e.response=t,e.emitter.emit(l.EVENT_RESPONSE,t),t}),(function(t){throw e.error=t,e.emitter.emit(l.EVENT_ERROR,t),t}))},r.prototype.abort=function(){this._nextPageRequest&&(this._nextPageRequest.abort(),delete this._nextPageRequest),this.response||this.error||this.aborted||(this.aborted=!0,this.client.abortRequest(this))},r.prototype.eachPage=function(e){function t(t){e(null,t,(function(){delete n._nextPageRequest;var e=t.nextPage();e&&(n._nextPageRequest=e,r(e))}))}function i(t){e(t,null,(function(){}))}function r(e){e.send().then(t,i)}var n=this;r(this)},r.prototype.clone=function(){return this._extend()},r.prototype._extend=function(e){var t=o(this._options,e);return new r(this.client,t)},t.exports=r},{"../constants":15,"../helpers/url-utils":18,"@mapbox/parse-mapbox-token":25,eventemitter3:28,xtend:39}],14:[function(e,t,i){"use strict";function r(e,t){this.request=e,this.headers=t.headers,this.rawBody=t.body,this.statusCode=t.statusCode;try{this.body=JSON.parse(t.body||"{}")}catch(e){this.body=t.body}this.links=n(this.headers.link)}var n=e("../helpers/parse-link-header");r.prototype.hasNextPage=function(){return!!this.links.next},r.prototype.nextPage=function(){return this.hasNextPage()?this.request._extend({path:this.links.next.url}):null},t.exports=r},{"../helpers/parse-link-header":17}],15:[function(e,t,i){"use strict";
1t.exports={API_ORIGIN:"https://api.mapbox.com",EVENT_PROGRESS_DOWNLOAD:"downloadProgress",EVENT_PROGRESS_UPLOAD:"uploadProgress",EVENT_ERROR:"error",EVENT_RESPONSE:"response",ERROR_HTTP:"HttpError",ERROR_REQUEST_ABORTED:"RequestAbortedError"}},{}],16:[function(e,t,i){"use strict";t.exports=function(e){var t={};return e?(e.trim().split(/[\r|\n]+/).forEach((function(e){var i=function(e){var t=e.indexOf(":");return{name:e.substring(0,t).trim().toLowerCase(),value:e.substring(t+1).trim()}}(e);t[i.name]=i.value})),t):t}},{}],17:[function(e,t,i){"use strict";t.exports=function(e){return e?e.split(/,\s*</).reduce((function(e,t){var i=function(e){var t=e.match(/<?([^>]*)>(.*)/);if(!t)return null;var i=t[1],r=t[2].split(";"),n=null,o=r.reduce((function(e,t){var i=function(e){var t=e.match(/\s*(.+)\s*=\s*"?([^"]+)"?/);return t?{key:t[1],value:t[2]}:null}(t);return i?"rel"===i.key?(n||(n=i.value),e):(e[i.key]=i.value,e):e}),{});return n?{url:i,rel:n,params:o}:null}(t);return i?(i.rel.split(/\s+/).forEach((function(t){e[t]||(e[t]={url:i.url,params:i.params})})),e):e}),{}):{}}},{}],18:[function(e,t,i){"use strict";function r(e){return Array.isArray(e)?function(e){return e.map(encodeURIComponent).join(",")}(e):encodeURIComponent(String(e))}function n(e,t,i){if(!1===i||null===i)return e;var n=/\?/.test(e)?"&":"?",o=encodeURIComponent(t);return void 0!==i&&""!==i&&!0!==i&&(o+="="+r(i)),""+e+n+o}t.exports={appendQueryObject:function(e,t){if(!t)return e;var i=e;return Object.keys(t).forEach((function(e){var r=t[e];void 0!==r&&(Array.isArray(r)&&(r=r.filter((function(e){return null!=e})).join(",")),i=n(i,e,r))})),i},appendQueryParam:n,prependOrigin:function(e,t){if(!t)return e;if("http"===e.slice(0,4))return e;var i="/"===e[0]?"":"/";return""+t.replace(/\/$/,"")+i+e},interpolateRouteParams:function(e,t){return t?e.replace(/\/:([a-zA-Z0-9]+)/g,(function(e,i){var n=t[i];if(void 0===n)throw new Error("Unspecified route parameter "+i);return"/"+r(n)})):e}}},{}],19:[function(e,t,i){"use strict";var r=e("xtend"),n=e("./service-helpers/validator"),o=e("./service-helpers/pick"),s=e("./service-helpers/stringify-booleans"),a=e("./service-helpers/create-service-factory"),l={},c=["country","region","postcode","district","place","locality","neighborhood","address","poi","poi.landmark"];l.forwardGeocode=function(e){n.assertShape({query:n.required(n.string),mode:n.oneOf("mapbox.places","mapbox.places-permanent"),countries:n.arrayOf(n.string),proximity:n.oneOf(n.coordinates,"ip"),types:n.arrayOf(n.oneOf(c)),autocomplete:n.boolean,bbox:n.arrayOf(n.number),limit:n.number,language:n.arrayOf(n.string),routing:n.boolean,fuzzyMatch:n.boolean,worldview:n.string,
vendor: 24,501 bytes, line 1
1session_token:n.string})(e),e.mode=e.mode||"mapbox.places";var t=s(r({country:e.countries},o(e,["proximity","types","autocomplete","bbox","limit","language","routing","fuzzyMatch","worldview","session_token"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:o(e,["mode","query"]),query:t})},l.reverseGeocode=function(e){n.assertShape({query:n.required(n.coordinates),mode:n.oneOf("mapbox.places","mapbox.places-permanent"),countries:n.arrayOf(n.string),types:n.arrayOf(n.oneOf(c)),bbox:n.arrayOf(n.number),limit:n.number,language:n.arrayOf(n.string),reverseMode:n.oneOf("distance","score"),routing:n.boolean,worldview:n.string,session_token:n.string})(e),e.mode=e.mode||"mapbox.places";var t=s(r({country:e.countries},o(e,["country","types","bbox","limit","language","reverseMode","routing","worldview","session_token"])));return this.client.createRequest({method:"GET",path:"/geocoding/v5/:mode/:query.json",params:o(e,["mode","query"]),query:t})},t.exports=a(l)},{"./service-helpers/create-service-factory":20,"./service-helpers/pick":22,"./service-helpers/stringify-booleans":23,"./service-helpers/validator":24,xtend:39}],20:[function(e,t,i){"use strict";var r=e("../../lib/classes/mapi-client"),n=e("../../lib/client");t.exports=function(e){return function(t){var i;i=r.prototype.isPrototypeOf(t)?t:n(t);var o=Object.create(e);return o.client=i,o}}},{"../../lib/classes/mapi-client":11,"../../lib/client":9}],21:[function(e,t,i){"use strict";t.exports=function(e,t){return Object.keys(e).reduce((function(i,r){return i[r]=t(r,e[r]),i}),{})}},{}],22:[function(e,t,i){"use strict";t.exports=function(e,t){var i=function(e,i){return-1!==t.indexOf(e)&&void 0!==i};return"function"==typeof t&&(i=t),Object.keys(e).filter((function(t){return i(t,e[t])})).reduce((function(t,i){return t[i]=e[i],t}),{})}},{}],23:[function(e,t,i){"use strict";var r=e("./object-map");t.exports=function(e){return r(e,(function(e,t){return"boolean"==typeof t?JSON.stringify(t):t}))}},{"./object-map":21}],24:[function(e,t,i){(function(i){(function(){"use strict";var r=e("xtend"),n=e("@mapbox/fusspot");t.exports=r(n,{file:function(e){if("undefined"!=typeof window){if(e instanceof i.Blob||e instanceof i.ArrayBuffer)return;return"Blob or ArrayBuffer"}if("string"!=typeof e&&void 0===e.pipe)return"Filename or Readable stream"},date:function(e){if("boolean"==typeof e)return"date";try{var t=new Date(e);if(t.getTime&&isNaN(t.getTime()))return"date"}catch(e){return"date"}},coordinates:function(e){return n.tuple(n.number,n.number)(e)},assertShape:function(e,t){return n.assert(n.strictShape(e),t)}})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"@mapbox/fusspot":7,xtend:39}],25:[function(e,t,i){"use strict";function r(e){try{return JSON.parse(o.decode(e))}catch(e){throw new Error("Invalid token")}}function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var o=e("base-64"),s={};t.exports=function(e){if(s[e])return s[e];var t=e.split("."),i=t[0],o=t[1];if(!o)throw new Error("Invalid token");var a=r(o),l={usage:i,user:a.u};return n(a,"a")&&(l.authorization=a.a),n(a,"exp")&&(l.expires=1e3*a.exp),n(a,"iat")&&(l.created=1e3*a.iat),n(a,"scopes")&&(l.scopes=a.scopes),n(a,"client")&&(l.client=a.client),n(a,"ll")&&(l.lastLogin=a.ll),n(a,"iu")&&(l.impersonator=a.iu),s[e]=l,l}},{"base-64":26}],26:[function(e,t,i){(function(e){(function(){"use strict";function r(e){return(r="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})(e)}!function(n){var o="object"==(void 0===i?"undefined":r(i))&&i,s="object"==(void 0===t?"undefined":r(t))&&t&&t.exports==o&&t,a="object"==(void 0===e?"undefined":r(e))&&e;a.global!==a&&a.window!==a||(n=a);var l=function(e){this.message=e};(l.prototype=new Error).name="InvalidCharacterError";var c=function(e){throw new l(e)},u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=/[\t\n\f\r ]/g,p={encode:function(e){e=String(e),/[^\0-\xFF]/.test(e)&&c("The string to be encoded contains characters outside of the Latin1 range.");for(var t,i,r,n,o=e.length%3,s="",a=-1,l=e.length-o;++a<l;)t=e.charCodeAt(a)<<16,i=e.charCodeAt(++a)<<8,r=e.charCodeAt(++a),s+=u.charAt((n=t+i+r)>>18&63)+u.charAt(n>>12&63)+u.charAt(n>>6&63)+u.charAt(63&n);return 2==o?(t=e.charCodeAt(a)<<8,i=e.charCodeAt(++a),s+=u.charAt((n=t+i)>>10)+u.charAt(n>>4&63)+u.charAt(n<<2&63)+"="):1==o&&(n=e.charCodeAt(a),s+=u.charAt(n>>2)+u.charAt(n<<4&63)+"=="),s},decode:function(e){var t=(e=String(e).replace(h,"")).length;t%4==0&&(t=(e=e.replace(/==?$/,"")).length),(t%4==1||/[^+a-zA-Z0-9/]/.test(e))&&c("Invalid character: the string to be decoded is not correctly encoded.");for(var i,r,n=0,o="",s=-1;++s<t;)r=u.indexOf(e.charAt(s)),i=n%4?64*i+r:r,n++%4&&(o+=String.fromCharCode(255&i>>(-2*n&6)));return o},version:"0.1.0"};if(o&&!o.nodeType)if(s)s.exports=p;else for(var d in p)p.hasOwnProperty(d)&&(o[d]=p[d]);else n.base64=p}(void 0)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],27:[function(e,t,i){"use strict";function r(e){return(r="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})(e)}function n(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=p(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}function o(e){return void 0===e._maxListeners?n.defaultMaxListeners:e._maxListeners}function s(e,t,i,n){var s,a,l;if("function"!=typeof i)throw new TypeError('"listener" argument must be a function');if((a=e._events)?(a.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),a=e._events),l=a[t]):(a=e._events=p(null),e._eventsCount=0),l){if("function"==typeof l?l=a[t]=n?[i,l]:[l,i]:n?l.unshift(i):l.push(i),!l.warned&&(s=o(e))&&s>0&&l.length>s){l.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+l.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=l.length,"object"===("undefined"==typeof console?"undefined":r(console))&&console.warn&&console.warn("%s: %s",c.name,c.message)}}else l=a[t]=i,++e._eventsCount;return e}function a(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function l(e,t,i){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},n=f.call(a,r);return n.listener=i,r.wrapFn=n,n}function c(e,t,i){var r=e._events;if(!r)return[];var n=r[t];return n?"function"==typeof n?i?[n.listener||n]:[n]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(n):h(n,n.length):[]}function u(e){var t=this._events;if(t){var i=t[e];if("function"==typeof i)return 1;if(i)return i.length}return 0}function h(e,t){for(var i=new Array(t),r=0;r<t;++r)i[r]=e[r];return i}var p=Object.create||function(e){var t=function(){};return t.prototype=e,new t},d=Object.keys||function(e){var t=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.push(i);return i},f=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0;var m,_=10;try{var g={};Object.defineProperty&&Object.defineProperty(g,"x",{value:0}),m=0===g.x}catch(e){m=!1}m?Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return _},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');_=e}}):n.defaultMaxListeners=_,n.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},n.prototype.getMaxListeners=function(){return o(this)},n.prototype.emit=function(e){var t,i,r,n,o,s,a="error"===e;if(s=this._events)a=a&&null==s.error;else if(!a)return!1;if(a){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var l=new Error('Unhandled "error" event. ('+t+")");throw l.context=t,l}if(!(i=s[e]))return!1;var c="function"==typeof i;switch(r=arguments.length){case 1:!function(e,t,i){if(t)e.call(i);else for(var r=e.length,n=h(e,r),o=0;o<r;++o)n[o].call(i)}(i,c,this);break;case 2:!function(e,t,i,r){if(t)e.call(i,r);else for(var n=e.length,o=h(e,n),s=0;s<n;++s)o[s].call(i,r)}(i,c,this,arguments[1]);break;case 3:!function(e,t,i,r,n){if(t)e.call(i,r,n);else for(var o=e.length,s=h(e,o),a=0;a<o;++a)s[a].call(i,r,n)}(i,c,this,arguments[1],arguments[2]);break;case 4:!function(e,t,i,r,n,o){if(t)e.call(i,r,n,o);else for(var s=e.length,a=h(e,s),l=0;l<s;++l)a[l].call(i,r,n,o)}(i,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(n=new Array(r-1),o=1;o<r;o++)n[o-1]=arguments[o];!function(e,t,i,r){if(t)e.apply(i,r);else for(var n=e.length,o=h(e,n),s=0;s<n;++s)o[s].apply(i,r)}(i,c,this,n)}return!0},n.prototype.addListener=function(e,t){return s(this,e,t,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(e,t){return s(this,e,t,!0)},n.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,l(this,e,t)),this},n.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,l(this,e,t)),this},n.prototype.removeListener=function(e,t){var i,r,n,o,s;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(i=r[e]))return this;if(i===t||i.listener===t)0==--this._eventsCount?this._events=p(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(n=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){s=i[o].listener,n=o;break}if(n<0)return this;0===n?i.shift():function(e,t){for(var i=t,r=i+1,n=e.length;r<n;i+=1,r+=1)e[i]=e[r];e.pop()}(i,n),1===i.length&&(r[e]=i[0]),r.removeListener&&this.emit("removeListener",e,s||t)}return this},n.prototype.removeAllListeners=function(e){var t,i,r;if(!(i=this._events))return this;if(!i.removeListener)return 0===arguments.length?(this._events=p(null),this._eventsCount=0):i[e]&&(0==--this._eventsCount?this._events=p(null):delete i[e]),this;if(0===arguments.length){var n,o=d(i);for(r=0;r<o.length;++r)"removeListener"!==(n=o[r])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=p(null),this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},n.prototype.listeners=function(e){return c(this,e,!0)},n.prototype.rawListeners=function(e){return c(this,e,!1)},n.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):u.call(e,t)},n.prototype.listenerCount=u,n.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],28:[function(e,t,i){"use strict";function r(){}function n(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,i,r,o){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new n(i,r||e,o),a=c?c+t:t;return e._events[a]?e._events[a].fn?e._events[a]=[e._events[a],s]:e._events[a].push(s):(e._events[a]=s,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}var l=Object.prototype.hasOwnProperty,c="~";Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(c=!1)),a.prototype.eventNames=function(){var e,t,i=[];if(0===this._eventsCount)return i;for(t in e=this._events)l.call(e,t)&&i.push(c?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=c?c+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,n=i.length,o=new Array(n);r<n;r++)o[r]=i[r].fn;return o},a.prototype.listenerCount=function(e){var t=c?c+e:e,i=this._events[t];return i?i.fn?1:i.length:0},a.prototype.emit=function(e,t,i,r,n,o){var s=c?c+e:e;if(!this._events[s])return!1;var a,l,u=this._events[s],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,i),!0;case 4:return u.fn.call(u.context,t,i,r),!0;case 5:return u.fn.call(u.context,t,i,r,n),!0;case 6:return u.fn.call(u.context,t,i,r,n,o),!0}for(l=1,a=new Array(h-1);l<h;l++)a[l-1]=arguments[l];u.fn.apply(u.context,a)}else{var p,d=u.length;for(l=0;l<d;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),h){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,t);break;case 3:u[l].fn.call(u[l].context,t,i);break;case 4:u[l].fn.call(u[l].context,t,i,r);break;default:if(!a)for(p=1,a=new Array(h-1);p<h;p++)a[p-1]=arguments[p];u[l].fn.apply(u[l].context,a)}}return!0},a.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},a.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},a.prototype.removeListener=function(e,t,i,r){var n=c?c+e:e;if(!this._events[n])return this;if(!t)return s(this,n),this;var o=this._events[n];if(o.fn)o.fn!==t||r&&!o.once||i&&o.context!==i||s(this,n);else{for(var a=0,l=[],u=o.length;a<u;a++)(o[a].fn!==t||r&&!o[a].once||i&&o[a].context!==i)&&l.push(o[a]);l.length?this._events[n]=1===l.length?l[0]:l:s(this,n)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=c?c+e:e,this._events[t]&&s(this,t)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=c,a.EventEmitter=a,void 0!==t&&(t.exports=a)},{}],29:[function(e,t,i){"use strict";!function(){var e={};void 0!==i?t.exports=e:this.fuzzy=e,e.simpleFilter=function(t,i){return i.filter((function(i){return e.test(t,i)}))},e.test=function(t,i){return null!==e.match(t,i)},e.match=function(e,t,i){i=i||{};var r,n=0,o=[],s=t.length,a=0,l=0,c=i.pre||"",u=i.post||"",h=i.caseSensitive&&t||t.toLowerCase();e=i.caseSensitive&&e||e.toLowerCase();for(var p=0;p<s;p++)r=t[p],h[p]===e[n]?(r=c+r+u,n+=1,l+=1+l):l=0,a+=l,o[o.length]=r;return n===e.length?(a=h===e?1/0:a,{rendered:o.join(""),score:a}):null},e.filter=function(t,i,r){return i&&0!==i.length?"string"!=typeof t?i:(r=r||{},i.reduce((function(i,n,o,s){var a=n;r.extract&&(a=r.extract(n));var l=e.match(t,a,r);return null!=l&&(i[i.length]={string:l.rendered,score:l.score,index:o,original:n}),i}),[]).sort((function(e,t){return t.score-e.score||e.index-t.index}))):[]}}()},{}],30:[function(e,t,i){"use strict";var r=Object.prototype.toString;t.exports=function(e){var t;return"[object Object]"===r.call(e)&&(null===(t=Object.getPrototypeOf(e))||t===Object.getPrototypeOf({}))}},{}],31:[function(e,t,i){(function(e){(function(){"use strict";function i(e){return(i="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})(e)}function r(e){var t=i(e);return!!e&&("object"==t||"function"==t)}function n(e){return"symbol"==i(e)||function(e){return!!e&&"object"==i(e)}(e)&&g.call(e)==l}function o(e){if("number"==typeof e)return e;if(n(e))return a;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(c,"");var i=h.test(e);return i||p.test(e)?d(e.slice(2),i?2:8):u.test(e)?a:+e}var s="Expected a function",a=NaN,l="[object Symbol]",c=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,p=/^0o[0-7]+$/i,d=parseInt,f="object"==(void 0===e?"undefined":i(e))&&e&&e.Object===Object&&e,m="object"==("undefined"==typeof self?"undefined":i(self))&&self&&self.Object===Object&&self,_=f||m||Function("return this")(),g=Object.prototype.toString,y=Math.max,v=Math.min,x=function(){return _.Date.now()};t.exports=function(e,t,i){function n(t){var i=h,r=p;return h=p=void 0,g=t,f=e.apply(r,i)}function a(e){var i=e-_;return void 0===_||i>=t||i<0||w&&e-g>=d}function l(){var e=x();if(a(e))return c(e);m=setTimeout(l,function(e){var i=t-(e-_);return w?v(i,d-(e-g)):i}(e))}function c(e){return m=void 0,T&&h?n(e):(h=p=void 0,f)}function u(){var e=x(),i=a(e);if(h=arguments,p=this,_=e,i){if(void 0===m)return function(e){return g=e,m=setTimeout(l,t),b?n(e):f}(_);if(w)return m=setTimeout(l,t),n(_)}return void 0===m&&(m=setTimeout(l,t)),f}var h,p,d,f,m,_,g=0,b=!1,w=!1,T=!0;if("function"!=typeof e)throw new TypeError(s);return t=o(t)||0,r(i)&&(b=!!i.leading,d=(w="maxWait"in i)?y(o(i.maxWait)||0,t):d,T="trailing"in i?!!i.trailing:T),u.cancel=function(){void 0!==m&&clearTimeout(m),g=0,h=_=p=m=void 0},u.flush=function(){return void 0===m?f:c(x())},u}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],32:[function(e,t,i){(function(i){(function(){"use strict";var r=e("./url-alphabet/index.cjs").urlAlphabet;if("production"!==i.env.NODE_ENV){if("undefined"!=typeof navigator&&"ReactNative"===navigator.product&&"undefined"==typeof crypto)throw new Error("React Native does not have a built-in secure random generator. If you donât need unpredictable IDs use `nanoid/non-secure`. For secure IDs, import `react-native-get-random-values` before Nano ID.");if("undefined"!=typeof msCrypto&&"undefined"==typeof crypto)throw new Error("Import file with `if (!window.crypto) window.crypto = window.msCrypto` before importing Nano ID to fix IE 11 support");if("undefined"==typeof crypto)throw new Error("Your browser does not have secure random generator. If you donât need unpredictable IDs, you can use nanoid/non-secure.")}var n=function(e){return crypto.getRandomValues(new Uint8Array(e))},o=function(e,t,i){var r=(2<<Math.log(e.length-1)/Math.LN2)-1,n=-~(1.6*r*t/e.length);return function(){for(var o="";;)for(var s=i(n),a=n;a--;)if((o+=e[s[a]&r]||"").length===t)return o}};t.exports={nanoid:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:21,t="",i=crypto.getRandomValues(new Uint8Array(e));e--;){var r=63&i[e];t+=r<36?r.toString(36):r<62?(r-26).toString(36).toUpperCase():r<63?"_":"-"}return t},customAlphabet:function(e,t){return o(e,t,n)},customRandom:o,urlAlphabet:r,random:n}}).call(this)}).call(this,e("_process"))},{"./url-alphabet/index.cjs":33,_process:34}],33:[function(e,t,i){"use strict";t.exports={urlAlphabet:"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"}},{}],34:[function(e,t,i){"use strict";function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function o(e){if(u===setTimeout)return setTimeout(e,0);if((u===r||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(t){try{return u.call(null,e,0)}catch(t){return u.call(this,e,0)}}}function s(){m&&d&&(m=!1,d.length?f=d.concat(f):_=-1,f.length&&a())}function a(){if(!m){var e=o(s);m=!0;for(var t=f.length;t;){for(d=f,f=[];++_<t;)d&&d[_].run();_=-1,t=f.length}d=null,m=!1,function(e){if(h===clearTimeout)return clearTimeout(e);if((h===n||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(e);try{return h(e)}catch(t){try{return h.call(null,e)}catch(t){return h.call(this,e)}}}(e)}}function l(e,t){this.fun=e,this.array=t}function c(){}var u,h,p=t.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:r}catch(e){u=r}try{h="function"==typeof clearTimeout?clearTimeout:n}catch(e){h=n}}();var d,f=[],m=!1,_=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];f.push(new l(e,t)),1!==f.length||m||o(a)},l.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=c,p.addListener=c,p.once=c,p.off=c,p.removeListener=c,p.removeAllListeners=c,p.emit=c,p.prependListener=c,p.prependOnceListener=c,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},{}],35:[function(e,t,i){"use strict";r=function(){function e(e){return e.match(o)||[]}function t(t){return{language:(t=e(t))[1]||n,extlang:t[2]||n,script:t[3]||n,region:t[4]||n}}function i(e,t,i){Object.defineProperty(e,t,{value:i,enumerable:!0})}function r(r,o,s){function a(t){return e(t)[r]||n}i(a,"pattern",o),i(t,s,a)}var n="",o=/^([a-zA-Z]{2,3})(?:[_-]+([a-zA-Z]{3})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{4})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{2}|[0-9]{3})(?=$|[_-]+))?/;return r(1,/^[a-zA-Z]{2,3}$/,"language"),r(2,/^[a-zA-Z]{3}$/,"extlang"),r(3,/^[a-zA-Z]{4}$/,"script"),r(4,/^[a-zA-Z]{2}$|^[0-9]{3}$/,"region"),i(t,"split",(function(t){return e(t).filter((function(e,t){return e&&t}))})),t},void 0!==t&&t.exports?t.exports=r():(void 0).subtag=r();var r},{}],36:[function(e,t,i){"use strict";var r=e("./src/suggestions");t.exports=r,"undefined"!=typeof window&&(window.Suggestions=r)},{"./src/suggestions":38}],37:[function(e,t,i){"use strict";var r=function(e){return this.component=e,this.items=[],this.active=0,this.wrapper=document.createElement("div"),this.wrapper.className="suggestions-wrapper",this.element=document.createElement("ul"),this.element.className="suggestions",this.wrapper.appendChild(this.element),this.selectingListItem=!1,e.el.parentNode.insertBefore(this.wrapper,e.el.nextSibling),this};r.prototype.show=function(){this.element.style.display="block"},r.prototype.hide=function(){this.element.style.display="none"},r.prototype.add=function(e){this.items.push(e)},r.prototype.clear=function(){this.items=[],this.active=0},r.prototype.isEmpty=function(){return!this.items.length},r.prototype.isVisible=function(){return"block"===this.element.style.display},r.prototype.draw=function(){if(this.element.innerHTML="",0!==this.items.length){for(var e=0;e<this.items.length;e++)this.drawItem(this.items[e],this.active===e);this.show()}else this.hide()},r.prototype.drawItem=function(e,t){var i=document.createElement("li"),r=document.createElement("a");t&&(i.className+=" active"),r.innerHTML=e.string,i.appendChild(r),this.element.appendChild(i),i.addEventListener("mousedown",function(){this.selectingListItem=!0}.bind(this)),i.addEventListener("mouseup",function(){this.handleMouseUp.call(this,e)}.bind(this))},r.prototype.handleMouseUp=function(e){this.selectingListItem=!1,this.component.value(e.original),this.clear(),this.draw()},r.prototype.move=function(e){this.active=e,this.draw()},r.prototype.previous=function(){this.move(0===this.active?this.items.length-1:this.active-1)},r.prototype.next=function(){this.move(this.active===this.items.length-1?0:this.active+1)},r.prototype.drawError=function(e){var t=document.createElement("li");t.innerHTML=e,this.element.appendChild(t),this.show()},t.exports=r},{}],38:[function(e,t,i){"use strict";var r=e("xtend"),n=e("fuzzy"),o=e("./list"),s=function(e,t,i){return i=i||{},this.options=r({minLength:2,limit:5,filter:!0,hideOnBlur:!0},i),this.el=e,this.data=t||[],this.list=new o(this),this.query="",this.selected=null,this.list.draw(),this.el.addEventListener("keyup",function(e){this.handleKeyUp(e.keyCode)}.bind(this),!1),this.el.addEventListener("keydown",function(e){this.handleKeyDown(e)}.bind(this)),this.el.addEventListener("focus",function(){this.handleFocus()}.bind(this)),this.el.addEventListener("blur",function(){this.handleBlur()}.bind(this)),this.el.addEventListener("paste",function(e){this.handlePaste(e)}.bind(this)),this.render=this.options.render?this.options.render.bind(this):this.render.bind(this),this.getItemV
1alue=this.options.getItemValue?this.options.getItemValue.bind(this):this.getItemValue.bind(this),this};s.prototype.handleKeyUp=function(e){40!==e&&38!==e&&27!==e&&13!==e&&9!==e&&this.handleInputChange(this.el.value)},s.prototype.handleKeyDown=function(e){switch(e.keyCode){case 13:case 9:this.list.isEmpty()||(this.list.isVisible()&&e.preventDefault(),this.value(this.list.items[this.list.active].original),this.list.hide());break;case 27:this.list.isEmpty()||this.list.hide();break;case 38:this.list.previous();break;case 40:this.list.next()}},s.prototype.handleBlur=function(){!this.list.selectingListItem&&this.options.hideOnBlur&&this.list.hide()},s.prototype.handlePaste=function(e){if(e.clipboardData)this.handleInputChange(e.clipboardData.getData("Text"));else{var t=this;setTimeout((function(){t.handleInputChange(e.target.value)}),100)}},s.prototype.handleInputChange=function(e){this.query=this.normalize(e),this.list.clear(),this.query.length<this.options.minLength?this.list.draw():this.getCandidates(function(e){for(var t=0;t<e.length&&(this.list.add(e[t]),t!==this.options.limit-1);t++);this.list.draw()}.bind(this))},s.prototype.handleFocus=function(){this.list.isEmpty()||this.list.show(),this.list.selectingListItem=!1},s.prototype.update=function(e){this.data=e,this.handleKeyUp()},s.prototype.clear=function(){this.data=[],this.list.clear()},s.prototype.normalize=function(e){return e.toLowerCase()},s.prototype.match=function(e,t){return e.indexOf(t)>-1},s.prototype.value=function(e){if(this.selected=e,this.el.value=this.getItemValue(e),document.createEvent){var t=document.createEvent("HTMLEvents");t.initEvent("change",!0,!1),this.el.dispatchEvent(t)}else this.el.fireEvent("onchange")},s.prototype.getCandidates=function(e){var t,i={pre:"<strong>",post:"</strong>",extract:function(e){return this.getItemValue(e)}.bind(this)};this.options.filter?t=(t=n.filter(this.query,this.data,i)).map(function(e){return{original:e.original,string:this.render(e.original,e.string)}}.bind(this)):t=this.data.map(function(e){return{original:e,string:this.render(e)}}.bind(this)),e(t)}
1,s.prototype.getItemValue=function(e){return e},s.prototype.render=function(e,t){if(t)return t;for(var i=e.original?this.getItemValue(e.original):this.getItemValue(e),r=this.normalize(i),n=r.lastIndexOf(this.query);n>-1;){var o=n+this.query.length;i=i.slice(0,n)+"<strong>"+i.slice(n,o)+"</strong>"+i.slice(o),n=r.slice(0,n).lastIndexOf(this.query)}return i},s.prototype.renderError=function(e){this.list.drawError(e)},t.exports=s},{"./list":37,fuzzy:29,xtend:39}],39:[function(e,t,i){"use strict";t.exports=function(){for(var e={},t=0;t<arguments.length;t++){var i=arguments[t];for(var n in i)r.call(i,n)&&(e[n]=i[n])}return e};var r=Object.prototype.hasOwnProperty},{}]},{},[4])(4)}));!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).turf=e()}}((function(){return function e(t,i,r){function n(s,a){if(!i[s]){if(!t[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var u=i[s]={exports:{}};t[s][0].call(u.exports,(function(e){return n(t[s][1][e]||e)}),u,u.exports,e,t,i,r)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)n(r[s]);return n}({1:[function(e,t,i){t.exports={along:e("@turf/along").default,bbox:e("@turf/bbox").default,center:e("@turf/center").default,distance:e("@turf/distance").default,destination:e("@turf/destination").default,length:e("@turf/length").default,nearestPointOnLine:e("@turf/nearest-point-on-line").default,booleanPointInPolygon:e("@turf/boolean-point-in-polygon").default,pointOnFeature:e("@turf/point-on-feature").default}},{"@turf/along":2,"@turf/bbox":3,"@turf/boolean-point-in-polygon":5,"@turf/center":6,"@turf/destination":8,"@turf/distance":9,"@turf/length":13,"@turf/nearest-point-on-line":17,"@turf/point-on-feature":19}],2:[function(e,t,i){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0});var n=r(e("@turf/bearing")),o=r(e("@turf/destination")),s=r(e("@turf/distance")),a=e("@turf/helpers"),l=e("@turf/invariant");i.default=function(e,t,i){void 0===i&&(i={});for(var r=l.getGeom(e).coordinates,c=0,u=0;u<r.length&&!(t>=c&&u===r.length-1);u++){if(c>=t){var h=t-c;if(h){var p=n.default(r[u],r[u-1])-180;return o.default(r[u],h,p,i)}return a.point(r[u])}c+=s.default(r[u],r[u+1],i)}return a.point(r[r.length-1])}},{"@turf/bearing":4,"@turf/destination":8,"@turf/distance":9,"@turf/helpers":11,"@turf/invariant":12}],3:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=e("@turf/meta");function n(e){var t=[1/0,1/0,-1/0,-1/0];r.coordEach(e,(function(e){t[0]>e[0]&&(t[0]=e[0]);t[1]>e[1]&&(t[1]=e[1]);t[2]<e[0]&&(t[2]=e[0]);t[3]<e[1]&&(t[3]=e[1])}));return t}n.default=n;i.default=n},{"@turf/meta":16}],4:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=e("@turf/helpers"),n=e("@turf/invariant");function o(e,t,i){void 0===i&&(i={});if(!0===i.final)return function(e,t){var i=o(t,e);return(i+180)%360}(e,t);var s=n.getCoord(e),a=n.getCoord(t),l=r.degreesToRadians(s[0]),c=r.degreesToRadians(a[0]),u=r.degreesToRadians(s[1]),h=r.degreesToRadians(a[1]),p=Math.sin(c-l)*Math.cos(h),d=Math.cos(u)*Math.sin(h)-Math.sin(u)*Math.cos(h)*Math.cos(c-l);return r.radiansToDegrees(Math.atan2(p,d))}i.default=o},{"@turf/helpers":11,"@turf/invariant":12}],5:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=e("@turf/invariant");i.default=function(e,t,i){void 0===i&&(i={});if(!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");var o=r.getCoord(e),s=r.getGeom(t),a=s.type,l=t.bbox,c=s.coordinates;if(l&&!1===function(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}(o,l))return!1;"Polygon"===a&&(c=[c]);for(var u=!1,h=0;h<c.length&&!u;h++)if(n(o,c[h][0],i.ignoreBoundary)){for(var p=!1,d=1;d<c[h].length&&!p;){n(o,c[h][d],!i.ignoreBoundary)&&(p=!0);d++}p||(u=!0)}return u};function n(e,t,i){var r=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var n=0,o=t.length-1;n<t.length;
1o=n++){var s=t[n][0],a=t[n][1],l=t[o][0],c=t[o][1];if(e[1]*(s-l)+a*(l-e[0])+c*(e[0]-s)==0&&(s-e[0])*(l-e[0])<=0&&(a-e[1])*(c-e[1])<=0)return!i;a>e[1]!=c>e[1]&&e[0]<(l-s)*(e[1]-a)/(c-a)+s&&(r=!r)}return r}},{"@turf/invariant":12}],6:[function(e,t,i){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0});var n=r(e("@turf/bbox")),o=e("@turf/helpers");i.default=function(e,t){void 0===t&&(t={});var i=n.default(e),r=(i[0]+i[2])/2,s=(i[1]+i[3])/2;return o.point([r,s],t.properties,t)}},{"@turf/bbox":3,"@turf/helpers":11}],7:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});function r(e){var t={type:"Feature"};Object.keys(e).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:t[i]=e[i]}}));t.properties=n(e.properties);t.geometry=o(e.geometry);return t}function n(e){var t={};if(!e)return t;Object.keys(e).forEach((function(i){var r=e[i];"object"==typeof r?null===r?t[i]=null:Array.isArray(r)?t[i]=r.map((function(e){return e})):t[i]=n(r):t[i]=r}));return t}function o(e){var t={type:e.type};e.bbox&&(t.bbox=e.bbox);if("GeometryCollection"===e.type){t.geometries=e.geometries.map((function(e){return o(e)}));return t}t.coordinates=s(e.coordinates);return t}function s(e){var t=e;return"object"!=typeof t[0]?t.slice():t.map((function(e){return s(e)}))}i.default=function(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return r(e);case"FeatureCollection":return function(e){var t={type:"FeatureCollection"};Object.keys(e).forEach((function(i){switch(i){case"type":case"features":return;default:t[i]=e[i]}}));t.features=e.features.map((function(e){return r(e)}));return t}(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return o(e);default:throw new Error("unknown GeoJSON type")}}},{}],8:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=e("@turf/helpers"),n=e("@turf/invariant");i.default=function(e,t,i,o){void 0===o&&(o={});var s=n.getCoord(e),a=r.degreesToRadians(s[0]),l=r.degreesToRadians(s[1]),c=r.degreesToRadians(i),u=r.lengthToRadians(t,o.units),h=Math.asin(Math.sin(l)*Math.cos(u)+Math.cos(l)*Math.sin(u)*Math.cos(c)),p=a+Math.atan2(Math.sin(c)*Math.sin(u)*Math.cos(l),Math.cos(u)-Math.sin(l)*Math.sin(h)),d=r.radiansToDegrees(p),f=r.radiansToDegrees(h);return r.point([d,f],o.properties)}},{"@turf/helpers":11,"@turf/invariant":12}],9:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=e("@turf/invariant"),n=e("@turf/helpers");i.default=function(e,t,i){void 0===i&&(i={});var o=r.getCoord(e),s=r.getCoord(t),a=n.degreesToRadians(s[1]-o[1]),l=n.degreesToRadians(s[0]-o[0]),c=n.degreesToRadians(o[1]),u=n.degreesToRadians(s[1]),h=Math.pow(Math.sin(a/2),2)+Math.pow(Math.sin(l/2),2)*Math.cos(c)*Math.cos(u);return n.radiansToLength(2*Math.atan2(Math.sqrt(h),Math.sqrt(1-h)),i.units)}},{"@turf/helpers":11,"@turf/invariant":12}],10:[function(e,t,i){"use strict";var r=e("@turf/meta"),n=e("@turf/helpers");function o(e){var t=[];"FeatureCollection"===e.type?r.featureEach(e,(function(e){r.coordEach(e,(function(i){t.push(n.point(i,e.properties))}))})):r.coordEach(e,(function(i){t.push(n.point(i,e.properties))}));return n.featureCollection(t)}t.exports=o;t.exports.default=o},{"@turf/helpers":11,"@turf/meta":16}],11:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});i.earthRadius=6371008.8;i.factors={centimeters:100*i.earthRadius,centimetres:100*i.earthRadius,degrees:i.earthRadius/111325,feet:3.28084*i.earthRadius,inches:39.37*i.earthRadius,kilometers:i.earthRadius/1e3,kilometres:i.earthRadius/1e3,meters:i.earthRadius,metres:i.earthRadius,miles:i.earthRadius/1609.344,millimeters:1e3*i.earthRadius,millimetres:1e3*i.earthRadius,nauticalmiles:i.earthRadius/1852,radians:1,yards:1.0936*i.earthRadius};i.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/i.earthRadius,yards:1.093
16133};i.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function r(e,t,i){void 0===i&&(i={});var r={type:"Feature"};(0===i.id||i.id)&&(r.id=i.id);i.bbox&&(r.bbox=i.bbox);r.properties=t||{};r.geometry=e;return r}i.feature=r;i.geometry=function(e,t,i){void 0===i&&(i={});switch(e){case"Point":return n(t).geometry;case"LineString":return s(t).geometry;case"Polygon":return o(t).geometry;case"MultiPoint":return c(t).geometry;case"MultiLineString":return l(t).geometry;case"MultiPolygon":return u(t).geometry;default:throw new Error(e+" is invalid")}};function n(e,t,i){void 0===i&&(i={});if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!f(e[0])||!f(e[1]))throw new Error("coordinates must contain numbers");return r({type:"Point",coordinates:e},t,i)}i.point=n;i.points=function(e,t,i){void 0===i&&(i={});return a(e.map((function(e){return n(e,t)})),i)};function o(e,t,i){void 0===i&&(i={});for(var n=0,o=e;n<o.length;n++){var s=o[n];if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<s[s.length-1].length;a++)if(s[s.length-1][a]!==s[0][a])throw new Error("First and last Position are not equivalent.")}return r({type:"Polygon",coordinates:e},t,i)}i.polygon=o;i.polygons=function(e,t,i){void 0===i&&(i={});return a(e.map((function(e){return o(e,t)})),i)};function s(e,t,i){void 0===i&&(i={});if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return r({type:"LineString",coordinates:e},t,i)}i.lineString=s;i.lineStrings=function(e,t,i){void 0===i&&(i={});return a(e.map((function(e){return s(e,t)})),i)};function a(e,t){void 0===t&&(t={});var i={type:"FeatureCollection"};t.id&&(i.id=t.id);t.bbox&&(i.bbox=t.bbox);i.features=e;return i}i.featureCollection=a;function l(e,t,i){void 0===i&&(i={});return r({type:"MultiLineString",coordinates:e},t,i)}i.multiLineString=l;function c(e,t,i){void 0===i&&(i={});return r({type:"MultiPoint",coordinates:e},t,i)}i.multiPoint=c;function u(e,t,i){void 0===i&&(i={});return r({type:"MultiPolygon",coordinates:e},t,i)}i.multiPolygon=u;i.geometryCollection=function(e,t,i){void 0===i&&(i={});return r({type:"GeometryCollection",geometries:e},t,i)};i.round=function(e,t){void 0===t&&(t=0);if(t&&!(t>=0))throw new Error("precision must be a positive number");
1var i=Math.pow(10,t||0);return Math.round(e*i)/i};function h(e,t){void 0===t&&(t="kilometers");var r=i.factors[t];if(!r)throw new Error(t+" units is invalid");return e*r}i.radiansToLength=h;function p(e,t){void 0===t&&(t="kilometers");var r=i.factors[t];if(!r)throw new Error(t+" units is invalid");return e/r}i.lengthToRadians=p;i.lengthToDegrees=function(e,t){return d(p(e,t))};i.bearingToAzimuth=function(e){var t=e%360;t<0&&(t+=360);return t};function d(e){return 180*(e%(2*Math.PI))/Math.PI}i.radiansToDegrees=d;i.degreesToRadians=function(e){return e%360*Math.PI/180};i.convertLength=function(e,t,i){void 0===t&&(t="kilometers");void 0===i&&(i="kilometers");if(!(e>=0))throw new Error("length must be a positive number");return h(p(e,t),i)};i.convertArea=function(e,t,r){void 0===t&&(t="meters");void 0===r&&(r="kilometers");if(!(e>=0))throw new Error("area must be a positive number");var n=i.areaFactors[t];if(!n)throw new Error("invalid original units");var o=i.areaFactors[r];if(!o)throw new Error("invalid final units");return e/n*o};function f(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}i.isNumber=f;i.isObject=function(e){return!!e&&e.constructor===Object};i.validateBBox=function(e){if(!e)throw new Error("bbox is required");if(!Array.isArray(e))throw new Error("bbox must be an Array");if(4!==e.length&&6!==e.length)throw new Error("bbox must be an Array of 4 or 6 numbers");e.forEach((function(e){if(!f(e))throw new Error("bbox must only contain numbers")}))};i.validateId=function(e){if(!e)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof e))throw new Error("id must be a number or a string")}},{}],12:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=e("@turf/helpers");
1i.getCoord=function(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return e.geometry.coordinates;if("Point"===e.type)return e.coordinates}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return e;throw new Error("coord must be GeoJSON Point or an Array of numbers")};i.getCoords=function(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")};i.containsNumber=function e(t){if(t.length>1&&r.isNumber(t[0])&&r.isNumber(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return e(t[0]);throw new Error("coordinates must only contain numbers")};i.geojsonType=function(e,t,i){if(!t||!i)throw new Error("type and name required");if(!e||e.type!==t)throw new Error("Invalid input to "+i+": must be a "+t+", given "+e.type)};i.featureOf=function(e,t,i){if(!e)throw new Error("No feature passed");if(!i)throw new Error(".featureOf() requires a name");if(!e||"Feature"!==e.type||!e.geometry)throw new Error("Invalid input to "+i+", Feature with geometry required");if(!e.geometry||e.geometry.type!==t)throw new Error("Invalid input to "+i+": must be a "+t+", given "+e.geometry.type)};i.collectionOf=function(e,t,i){if(!e)throw new Error("No featureCollection passed");if(!i)throw new Error(".collectionOf() requires a name");if(!e||"FeatureCollection"!==e.type)throw new Error("Invalid input to "+i+", FeatureCollection required");for(var r=0,n=e.features;r<n.length;r++){var o=n[r];if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+i+", Feature with geometry required");if(!o.geometry||o.geometry.type!==t)throw new Error("Invalid input to "+i+": must be a "+t+", given "+o.geometry.type)}};i.getGeom=function(e){return"Feature"===e.type?e.geometry:e};i.getType=function(e,t){return"FeatureCollection"===e.type?"FeatureCollection":"GeometryCollection"===e.type?"GeometryCollection":"Feature"===e.type&&null!==e.geometry?e.geometry.type:e.type}},{"@turf/helpers":11}],13:[function(e,t,i){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0});var n=r(e("@turf/distance")),o=e("@turf/meta");i.default=function(e,t){void 0===t&&(t={});return o.segmentReduce(e,(function(e,i){var r=i.geometry.coordinates;return e+n.default(r[0],r[1],t)}),0)}},{"@turf/distance":9,"@turf/meta":16}],14:[function(e,t,i){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0});var n=e("@turf/helpers"),o=e("@turf/invariant"),s=r(e("@turf/line-segment")),a=e("@turf/meta"),l=r(e("geojson-rbush"));function c(e,t){var i=o.getCoords(e),r=o.getCoords(t);if(2!==i.length)throw new Error("<intersects> line1 must only contain 2 coordinates");if(2!==r.length)throw new Error("<intersects> line2 must only contain 2 coordinates");var s=i[0][0],a=i[0][1],l=i[1][0],c=i[1][1],u=r[0][0],h=r[0][1],p=r[1][0],d=r[1][1],f=(d-h)*(l-s)-(p-u)*(c-a),m=(p-u)*(a-h)-(d-h)*(s-u),_=(l-s)*(a-h)-(c-a)*(s-u);if(0===f)return null;var g=m/f,y=_/f;if(g>=0&&g<=1&&y>=0&&y<=1){var v=s+g*(l-s),x=a+g*(c-a);return n.point([v,x])}return null}i.default=function(e,t){var i={},r=[];"LineString"===e.type&&(e=n.feature(e));"LineString"===t.type&&(t=n.feature(t));if("Feature"===e.type&&"Feature"===t.type&&null!==e.geometry&&null!==t.geometry&&"LineString"===e.geometry.type&&"LineString"===t.geometry.type&&2===e.geometry.coordinates.length&&2===t.geometry.coordinates.length){var u=c(e,t);u&&r.push(u);return n.featureCollection(r)}var h=l.default();h.load(s.default(t));a.featureEach(s.default(e),(function(e){a.featureEach(h.search(e),(function(t){var n=c(e,t);if(n){var s=o.getCoords(n).join(",");if(!i[s]){i[s]=!0;r.push(n)}}}))}));return n.featureCollection(r)}},{"@turf/helpers":11,"@turf/invariant":12,"@turf/line-segment":15,"@turf/meta":16,"geojson-rbush":20}],15:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=e("@turf/helpers"),n=e("@turf/invariant"),o=e("@turf/meta");i.default=function(e){if(!e)throw new Error("geojson is required");var t=[];o.flattenEach(e,(function(e){!function(e,t){var i=[],o=e.geometry;if(null!==o){switch(o.type){case"Polygon":i=n.getCoords(o);break;case"LineString":i=[n.getCoords(o)]}i.forEach((function(i){var n=function(e,t){var i=[];e.reduce((function(e,n){var o,s,a,l,c,u,h=r.lineString([e,n],t);h.bbox=(s=n,a=(o=e)[0],l=o[1],c=s[0],u=s[1],[a<c?a:c,l<u?l:u,a>c?a:c,l>u?l:u]);i.push(h);return n}));return i}(i,e.properties);
1n.forEach((function(e){e.id=t.length;t.push(e)}))}))}}(e,t)}));return r.featureCollection(t)}},{"@turf/helpers":11,"@turf/invariant":12,"@turf/meta":16}],16:[function(e,t,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var r=e("@turf/helpers");function n(e,t,i){if(null!==e)for(var r,o,s,a,l,c,u,h,p=0,d=0,f=e.type,m="FeatureCollection"===f,_="Feature"===f,g=m?e.features.length:1,y=0;y<g;y++){l=(h=!!(u=m?e.features[y].geometry:_?e.geometry:e)&&"GeometryCollection"===u.type)?u.geometries.length:1;for(var v=0;v<l;v++){var x=0,b=0;if(null!==(a=h?u.geometries[v]:u)){c=a.coordinates;var w=a.type;p=!i||"Polygon"!==w&&"MultiPolygon"!==w?0:1;switch(w){case null:break;case"Point":if(!1===t(c,d,y,x,b))return!1;d++;x++;break;case"LineString":case"MultiPoint":for(r=0;r<c.length;r++){if(!1===t(c[r],d,y,x,b))return!1;d++;"MultiPoint"===w&&x++}"LineString"===w&&x++;break;case"Polygon":case"MultiLineString":for(r=0;r<c.length;r++){for(o=0;o<c[r].length-p;o++){if(!1===t(c[r][o],d,y,x,b))return!1;d++}"MultiLineString"===w&&x++;"Polygon"===w&&b++}"Polygon"===w&&x++;break;case"MultiPolygon":for(r=0;r<c.length;r++){b=0;for(o=0;o<c[r].length;o++){for(s=0;s<c[r][o].length-p;s++){if(!1===t(c[r][o][s],d,y,x,b))return!1;d++}b++}x++}break;case"GeometryCollection":for(r=0;r<a.geometries.length;r++)if(!1===n(a.geometries[r],t,i))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function o(e,t){var i;switch(e.type){case"FeatureCollection":for(i=0;i<e.features.length&&!1!==t(e.features[i].properties,i);i++);break;case"Feature":t(e.properties,0)}}function s(e,t){if("Feature"===e.type)t(e,0);else if("FeatureCollection"===e.type)for(var i=0;i<e.features.length&&!1!==t(e.features[i],i);i++);}function a(e,t){var i,r,n,o,s,a,l,c,u,h,p=0,d="FeatureCollection"===e.type,f="Feature"===e.type,m=d?e.features.length:1;for(i=0;i<m;i++){a=d?e.features[i].geometry:f?e.geometry:e;c=d?e.features[i].properties:f?e.properties:{};u=d?e.features[i].bbox:f?e.bbox:void 0;h=d?e.features[i].id:f?e.id:void 0;s=(l=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1;for(n=0;n<s;n++)if(null!==(o=l?a.geometries[n]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,p,c,u,h))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===t(o.geometries[r],p,c,u,h))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,p,c,u,h))return!1;p++}}function l(e,t){a(e,(function(e,i,n,o,s){var a,l=null===e?null:e.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return!1!==t(r.feature(e,n,{bbox:o,id:s}),i,0)&&void 0}switch(l){case"MultiPoint":a="Point";break;case"MultiLineString":a="LineString";break;case"MultiPolygon":a="Polygon"}for(var c=0;c<e.coordinates.length;c++){var u={type:a,coordinates:e.coordinates[c]};if(!1===t(r.feature(u,n),i,c))return!1}}))}function c(e,t){l(e,(function(e,i,o){var s=0;if(e.geometry){var a=e.geometry.type;if("Point"!==a&&"MultiPoint"!==a){var l,c=0,u=0,h=0;return!1!==n(e,(function(n,a,p,d,f){if(void 0===l||i>c||d>u||f>h){l=n;c=i;u=d;h=f;s=0}else{var m=r.lineString([l,n],e.properties);if(!1===t(m,i,o,f,s))return!1;s++;l=n}}))&&void 0}}}))}function u(e,t){if(!e)throw new Error("geojson is required");l(e,(function(e,i,n){if(null!==e.geometry){var o=e.geometry.type,s=e.geometry.coordinates;switch(o){case"LineString":if(!1===t(e,i,n,0,0))return!1;break;case"Polygon":for(var a=0;a<s.length;a++)if(!1===t(r.lineString(s[a],e.properties),i,n,a))return!1}}}))}i.coordAll=function(e){var t=[];n(e,(function(e){t.push(e)}));return t};i.coordEach=n;i.coordReduce=function(e,t,i,r){var o=i;n(e,(function(e,r,n,s,a){o=0===r&&void 0===i?e:t(o,e,r,n,s,a)}),r);return o};i.featureEach=s;i.featureReduce=function(e,t,i){var r=i;s(e,(function(e,n){r=0===n&&void 0===i?e:t(r,e,n)}));return r};i.findPoint=function(e,t){t=t||{};if(!r.isObject(t))throw new Error("options is invalid");var i,n=t.featureIndex||0,o=t.multiFeatureIndex||0,s=t.geometryIndex||0,a=t.coordIndex||0,l=t.properties;switch(e.type){case"FeatureCollection":n<0&&(n=e.features.length+n);l=l||e.features[n].properties;i=e.features[n].geometry;break;case"Feature":l=l||e.properties;i=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":i=e;break;
1default:throw new Error("geojson is invalid")}if(null===i)return null;var c=i.coordinates;switch(i.type){case"Point":return r.point(c,l,t);case"MultiPoint":o<0&&(o=c.length+o);return r.point(c[o],l,t);case"LineString":a<0&&(a=c.length+a);return r.point(c[a],l,t);case"Polygon":s<0&&(s=c.length+s);a<0&&(a=c[s].length+a);return r.point(c[s][a],l,t);case"MultiLineString":o<0&&(o=c.length+o);a<0&&(a=c[o].length+a);return r.point(c[o][a],l,t);case"MultiPolygon":o<0&&(o=c.length+o);s<0&&(s=c[o].length+s);a<0&&(a=c[o][s].length-a);return r.point(c[o][s][a],l,t)}throw new Error("geojson is invalid")};i.findSegment=function(e,t){t=t||{};if(!r.isObject(t))throw new Error("options is invalid");var i,n=t.featureIndex||0,o=t.multiFeatureIndex||0,s=t.geometryIndex||0,a=t.segmentIndex||0,l=t.properties;switch(e.type){case"FeatureCollection":n<0&&(n=e.features.length+n);l=l||e.features[n].properties;i=e.features[n].geometry;break;case"Feature":l=l||e.properties;i=e.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":i=e;break;default:throw new Error("geojson is invalid")}if(null===i)return null;var c=i.coordinates;switch(i.type){case"Point":case"MultiPoint":return null;case"LineString":a<0&&(a=c.length+a-1);return r.lineString([c[a],c[a+1]],l,t);case"Polygon":s<0&&(s=c.length+s);a<0&&(a=c[s].length+a-1);return r.lineString([c[s][a],c[s][a+1]],l,t);case"MultiLineString":o<0&&(o=c.length+o);a<0&&(a=c[o].length+a-1);return r.lineString([c[o][a],c[o][a+1]],l,t);case"MultiPolygon":o<0&&(o=c.length+o);s<0&&(s=c[o].length+s);a<0&&(a=c[o][s].length-a-1);return r.lineString([c[o][s][a],c[o][s][a+1]],l,t)}throw new Error("geojson is invalid")};i.flattenEach=l;i.flattenReduce=function(e,t,i){var r=i;l(e,(function(e,n,o){r=0===n&&0===o&&void 0===i?e:t(r,e,n,o)}));return r};i.geomEach=a;i.geomReduce=function(e,t,i){var r=i;a(e,(function(e,n,o,s,a){r=0===n&&void 0===i?e:t(r,e,n,o,s,a)}));return r};i.lineEach=u;i.lineReduce=function(e,t,i){var r=i;u(e,(function(e,n,o,s){r=0===n&&void 0===i?e:t(r,e,n,o,s)}));return r};i.propEach=o;i.propReduce=function(e,t,i){var r=i;o(e,(function(e,n){r=0===n&&void 0===i?e:t(r,e,n)}));return r};i.segmentEach=c;i.segmentReduce=function(e,t,i){var r=i,n=!1;c(e,(function(e,o,s,a,l){r=!1===n&&void 0===i?e:t(r,e,o,s,a,l);n=!0}));return r}},{"@turf/helpers":11}],17:[function(e,t,i){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0});var n=r(e("@turf/bearing")),o=r(e("@turf/distance")),s=r(e("@turf/destination")),a=r(e("@turf/line-intersect")),l=e("@turf/meta"),c=e("@turf/helpers"),u=e("@turf/invariant");i.default=function(e,t,i){void 0===i&&(i={});var r=c.point([1/0,1/0],{dist:1/0}),h=0;l.flattenEach(e,(function(e){for(var l=u.getCoords(e),p=0;p<l.length-1;p++){var d=c.point(l[p]);d.properties.dist=o.default(t,d,i);var f=c.point(l[p+1]);f.properties.dist=o.default(t,f,i);var m=o.default(d,f,i),_=Math.max(d.properties.dist,f.properties.dist),g=n.default(d,f),y=s.default(t,_,g+90,i),v=s.default(t,_,g-90,i),x=a.default(c.lineString([y.geometry.coordinates,v.geometry.coordinates]),c.lineString([d.geometry.coordinates,f.geometry.coordinates])),b=null;if(x.features.length>0){(b=x.features[0]).properties.dist=o.default(t,b,i);b.properties.location=h+o.default(d,b,i)}if(d.properties.dist<r.properties.dist){(r=d).properties.index=p;r.properties.location=h}if(f.properties.dist<r.properties.dist){(r=f).properties.index=p+1;r.properties.location=h+m}b&&b.properties.dist<r.properties.dist&&((r=b).properties.index=p);h+=m}}));return r}},{"@turf/bearing":4,"@turf/destination":8,"@turf/distance":9,"@turf/helpers":11,"@turf/invariant":12,"@turf/line-intersect":14,"@turf/meta":16}],18:[function(e,t,i){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(i,"__esModule",{value:!0});var n=r(e("@turf/clone")),o=r(e("@turf/distance")),s=e("@turf/meta");i.default=function(e,t){if(!e)throw new Error("targetPoint is required");if(!t)throw new Error("points is required");var i,r=1/0,a=0;
1s.featureEach(t,(function(t,i){var n=o.default(e,t);if(n<r){a=i;r=n}}));(i=n.default(t.features[a])).properties.featureIndex=a;i.properties.distanceToPoint=r;return i}},{"@turf/clone":7,"@turf/distance":9,"@turf/meta":16}],19:[function(e,t,i){"use strict";var r=e("@turf/explode"),n=e("@turf/center"),o=e("@turf/nearest-point"),s=e("@turf/boolean-point-in-polygon"),a=e("@turf/helpers");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=l(r),u=l(n),h=l(o),p=l(s);function d(e){for(var t=function(e){if("FeatureCollection"!==e.type)return"Feature"!==e.type?a.featureCollection([a.feature(e)]):a.featureCollection([e]);return e}(e),i=u.default(t),r=!1,n=0;!r&&n<t.features.length;){var o,s=t.features[n].geometry,l=!1;if("Point"===s.type)i.geometry.coordinates[0]===s.coordinates[0]&&i.geometry.coordinates[1]===s.coordinates[1]&&(r=!0);else if("MultiPoint"===s.type){var d=!1;o=0;for(;!d&&o<s.coordinates.length;){if(i.geometry.coordinates[0]===s.coordinates[o][0]&&i.geometry.coordinates[1]===s.coordinates[o][1]){r=!0;d=!0}o++}}else if("LineString"===s.type){o=0;for(;!l&&o<s.coordinates.length-1;){if(f(i.geometry.coordinates[0],i.geometry.coordinates[1],s.coordinates[o][0],s.coordinates[o][1],s.coordinates[o+1][0],s.coordinates[o+1][1])){l=!0;r=!0}o++}}else if("MultiLineString"===s.type)for(var m=0;m<s.coordinates.length;){l=!1;o=0;for(var _=s.coordinates[m];!l&&o<_.length-1;){if(f(i.geometry.coordinates[0],i.geometry.coordinates[1],_[o][0],_[o][1],_[o+1][0],_[o+1][1])){l=!0;r=!0}o++}m++}else"Polygon"!==s.type&&"MultiPolygon"!==s.type||p.default(i,s)&&(r=!0);n++}if(r)return i;var g=a.featureCollection([]);for(n=0;n<t.features.length;n++)g.features=g.features.concat(c.default(t.features[n]).features);return a.point(h.default(i,g).geometry.coordinates)}function f(e,t,i,r,n,o){return Math.sqrt((n-i)*(n-i)+(o-r)*(o-r))===Math.sqrt((e-i)*(e-i)+(t-r)*(t-r))+Math.sqrt((n-e)*(n-e)+(o-t)*(o-t))}t.exports=d;t.exports.default=d},{"@turf/boolean-point-in-polygon":5,"@turf/center":6,"@turf/explode":10,"@turf/helpers":11,"@turf/nearest-point":18}],20:[function(e,t,i){var r=e("rbush"),n=e("@turf/helpers"),o=e("@turf/meta"),s=e("@turf/bbox").default,a=o.featureEach,l=(o.coordEach,n.polygon,n.featureCollection);function c(e){var t=new r(e);t.insert=function(e){if("Feature"!==e.type)throw new Error("invalid feature");e.bbox=e.bbox?e.bbox:s(e);return r.prototype.insert.call(this,e)};t.load=function(e){var t=[];Array.isArray(e)?e.forEach((function(e){if("Feature"!==e.type)throw new Error("invalid features");e.bbox=e.bbox?e.bbox:s(e);t.push(e)})):a(e,(function(e){if("Feature"!==e.type)throw new Error("invalid features");e.bbox=e.bbox?e.bbox:s(e);t.push(e)}));return r.prototype.load.call(this,t)};t.remove=function(e,t){if("Feature"!==e.type)throw new Error("invalid feature");e.bbox=e.bbox?e.bbox:s(e);return r.prototype.remove.call(this,e,t)};t.clear=function(){return r.prototype.clear.call(this)};t.search=function(e){var t=r.prototype.search.call(this,this.toBBox(e));return l(t)};t.collides=function(e){return r.prototype.collides.call(this,this.toBBox(e))};t.all=function(){var e=r.prototype.all.call(this);return l(e)};t.toJSON=function(){return r.prototype.toJSON.call(this)};t.fromJSON=function(e){return r.prototype.fromJSON.call(this,e)};t.toBBox=function(e){var t;if(e.bbox)t=e.bbox;else if(Array.isArray(e)&&4===e.length)t=e;else if(Array.isArray(e)&&6===e.length)t=[e[0],e[1],e[3],e[4]];else if("Feature"===e.type)t=s(e);else{if("FeatureCollection"!==e.type)throw new Error("invalid geojson");t=s(e)}return{minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]}};return t}t.exports=c;t.exports.default=c},{"@turf/bbox":3,"@turf/helpers":11,"@turf/meta":16,rbush:21}],21:[function(e,t,i){r=this,n=function(){"use strict";function e(e,r,n,o,s){!function e(i,r,n,o,s){for(;o>n;){if(o-n>600){var a=o-n+1,l=r-n+1,c=Math.log(a),u=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*u*(a-u)/a)*(l-a/2<0?-1:1);e(i,r,Math.max(n,Math.floor(r-l*u/a+h)),Math.min(o,Math.floor(r+(a-l)*u/a+h)),s)}var p=i[r],d=n,f=o;for(t(i,n,r),s(i[o],p)>0&&t(i,n,o);d<f;){for(t(i,d,f),d++,f--;s(i[d],p)<0;)d++;for(;s(i[f],p)>0;)f--}0===s(i[n],p)?t(i,n,f):t(i,++f,o),f<=r&&(n=f+1),r<=f&&(o=f-1)}}(e,r,n||0,o||e.length-1,s||i)}function t(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function i(e,t){return e<t?-1:e>t?1:0}var r=function(e){void 0===e&&(e=9),this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function n(e,t,i){if(!i)return t.indexOf(e);for(var r=0;r<t.length;r++)if(i(e,t[r]))return r;return-1}function o(e,t){s(e,0,e.children.length,t,e)}function s(e,t,i,r,n){n||(n=f(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(var o=t;o<i;o++){var s=e.children[o];a(n,e.leaf?r(s):s)}return n}function a(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function l(e,t){return e.minX-t.minX}function c(e,t){return e.minY-t.minY}function u(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function h(e){return e.maxX-e.minX+(e.maxY-e.minY)}function p(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function d(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function f(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function m(t,i,r,n,o){for(var s=[i,r];s.length;)if(!((r=s.pop())-(i=s.pop())<=n)){var a=i+Math.ceil((r-i)/n/2)*n;e(t,a,i,r,o),s.push(i,a,a,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(e){var t=this.data,i=[];if(!d(e,t))return i;for(var r=this.toBBox,n=[];t;){for(var o=0;o<t.children.length;o++){var s=t.children[o],a=t.leaf?r(s):s;d(e,a)&&(t.leaf?i.push(s):p(e,a)?this._all(s,i):n.push(s))}t=n.pop()}return i},r.prototype.collides=function(e){var t=this.data;if(!d(e,t))return!1;for(var i=[];t;){for(var r=0;r<t.children.length;r++){var n=t.children[r],o=t.leaf?this.toBBox(n):n;
vendor: 4,894 bytes, line 1
1if(d(e,o)){if(t.leaf||p(e,o))return!0;i.push(n)}}t=i.pop()}return!1},r.prototype.load=function(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(var t=0;t<e.length;t++)this.insert(e[t]);return this}var i=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)if(this.data.height===i.height)this._splitRoot(this.data,i);else{if(this.data.height<i.height){var r=this.data;this.data=i,i=r}this._insert(i,this.data.height-i.height-1,!0)}else this.data=i;return this},r.prototype.insert=function(e){return e&&this._insert(e,this.data.height-1),this},r.prototype.clear=function(){return this.data=f([]),this},r.prototype.remove=function(e,t){if(!e)return this;for(var i,r,o,s=this.data,a=this.toBBox(e),l=[],c=[];s||l.length;){if(s||(s=l.pop(),r=l[l.length-1],i=c.pop(),o=!0),s.leaf){var u=n(e,s.children,t);if(-1!==u)return s.children.splice(u,1),l.push(s),this._condense(l),this}o||s.leaf||!p(s,a)?r?(i++,s=r.children[i],o=!1):s=null:(l.push(s),c.push(i),i=0,r=s,s=s.children[0])}return this},r.prototype.toBBox=function(e){return e},r.prototype.compareMinX=function(e,t){return e.minX-t.minX},r.prototype.compareMinY=function(e,t){return e.minY-t.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(e){return this.data=e,this},r.prototype._all=function(e,t){for(var i=[];e;)e.leaf?t.push.apply(t,e.children):i.push.apply(i,e.children),e=i.pop();return t},r.prototype._build=function(e,t,i,r){var n,s=i-t+1,a=this._maxEntries;if(s<=a)return o(n=f(e.slice(t,i+1)),this.toBBox),n;r||(r=Math.ceil(Math.log(s)/Math.log(a)),a=Math.ceil(s/Math.pow(a,r-1))),(n=f([])).leaf=!1,n.height=r;var l=Math.ceil(s/a),c=l*Math.ceil(Math.sqrt(a));m(e,t,i,c,this.compareMinX);for(var u=t;u<=i;u+=c){var h=Math.min(u+c-1,i);m(e,u,h,l,this.compareMinY);for(var p=u;p<=h;p+=l){var d=Math.min(p+l-1,h);n.children.push(this._build(e,p,d,r-1))}}return o(n,this.toBBox),n},r.prototype._chooseSubtree=function(e,t,i,r){for(;r.push(t),!t.leaf&&r.length-1!==i;){for(var n=1/0,o=1/0,s=void 0,a=0;a<t.children.length;a++){var l=t.children[a],c=u(l),h=(p=e,d=l,(Math.max(d.maxX,p.maxX)-Math.min(d.minX,p.minX))*(Math.max(d.maxY,p.maxY)-Math.min(d.minY,p.minY))-c);h<o?(o=h,n=c<n?c:n,s=l):h===o&&c<n&&(n=c,s=l)}t=s||t.children[0]}var p,d;return t},r.prototype._insert=function(e,t,i){var r=i?e:this.toBBox(e),n=[],o=this._chooseSubtree(r,this.data,t,n);for(o.children.push(e),a(o,r);t>=0&&n[t].children.length>this._maxEntries;)this._split(n,t),t--;this._adjustParentBBoxes(r,n,t)},r.prototype._split=function(e,t){var i=e[t],r=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,r);var s=this._chooseSplitIndex(i,n,r),a=f(i.children.splice(s,i.children.length-s));a.height=i.height,a.leaf=i.leaf,o(i,this.toBBox),o(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(i,a)},r.prototype._splitRoot=function(e,t){this.data=f([e,t]),this.data.height=e.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(e,t,i){for(var r,n,o,a,l,c,h,p=1/0,d=1/0,f=t;f<=i-t;f++){var m=s(e,0,f,this.toBBox),_=s(e,f,i,this.toBBox),g=(n=m,o=_,a=Math.max(n.minX,o.minX),l=Math.max(n.minY,o.minY),c=Math.min(n.maxX,o.maxX),h=Math.min(n.maxY,o.maxY),Math.max(0,c-a)*Math.max(0,h-l)),y=u(m)+u(_);g<p?(p=g,r=f,d=y<d?y:d):g===p&&y<d&&(d=y,r=f)}return r||i-t},r.prototype._chooseSplitAxis=function(e,t,i){var r=e.leaf?this.compareMinX:l,n=e.leaf?this.compareMinY:c;this._allDistMargin(e,t,i,r)<this._allDistMargin(e,t,i,n)&&e.children.sort(r)},r.prototype._allDistMargin=function(e,t,i,r){e.children.sort(r);for(var n=this.toBBox,o=s(e,0,t,n),l=s(e,i-t,i,n),c=h(o)+h(l),u=t;u<i-t;u++){var p=e.children[u];a(o,e.leaf?n(p):p),c+=h(o)}for(var d=i-t-1;d>=t;d--){var f=e.children[d];a(l,e.leaf?n(f):f),c+=h(l)}return c},r.prototype._adjustParentBBoxes=function(e,t,i){for(var r=i;r>=0;r--)a(t[r],e)},r.prototype._condense=function(e){for(var t=e.length-1,i=void 0;t>=0;t--)0===e[t].children.length?t>0?(i=e[t-1].children).splice(i.indexOf(e[t]),1):this.clear():o(e[t],this.toBBox)},r},"object"==typeof i&&void 0!==t?t.exports=n():(r=r||self).RBush=n();var r,n},{}]},{},[1])(1)}));class ControlMenu{constructor(e){this.post_id=e.post_id;this.div_position=e.div_position}addListeners(){jQuery(document).on("click",`.mapster-control-menu-${this.post_id} .mapster-control-menu-toggle`,(()=>{jQuery(`.mapster-control-menu-${this.post_id} #mapster-control-menu-holder`).is(":visible")?jQuery(`.mapster-control-menu-${this.post_id} #mapster-control-menu-holder`).fadeOut():jQuery(`.mapster-control-menu-${this.post_id} #mapster-control-menu-holder`).fadeIn()}))}onAdd(e){this.map=e;this._container=document.createElement("div");this._container.className=`mapboxgl-ctrl mapster-control-menu mapster-control-menu-${this.post_id}`;this._container.innerHTML=`\n <div>\n ${"above"===this.div_position?"<div id='mapster-control-menu-holder'></div>":""}
1\n <span class="mapster-control-menu-toggle dashicons dashicons-menu"></span>\n ${"below"===this.div_position?"<div id='mapster-control-menu-holder'></div>":""}\n </div>\n `;this.addListeners();return this._container}onRemove(){this._container.parentNode.removeChild(this._container);this._map=void 0}}class CustomHTMLControl{constructor(e){this.custom_html=e.custom_html}onAdd(e){this.map=e;this._container=document.createElement("div");this._container.innerHTML=this.custom_html;return this._container}onRemove(){this._container.parentNode.removeChild(this._container);this._map=void 0}}class DownloadControl{constructor(e){this.post_id=e.post_id;this.interact_with_filters=e.interact_with_filters;this.notify_on_download=e.notify_on_download;this.included_fields=e.included_fields;this.features=e.locations.concat(e.lines.concat(e.polygons))}addListeners(){jQuery(document).on("click",`.mapster-download-control-${this.post_id} .mapster-data-download`,(()=>{this.downloadFeatures()}))}downloadFeatures(){let e=this.processFeatures();e.length>0?this.downloadCSV(e):alert("No features selected for download.")}processFeatures(e){let t=[];this.features.forEach((e=>{if(this.interact_with_filters&&window.mapster_categories_hidden_features&&window.mapster_categories_hidden_features.indexOf(e.id)>-1)return;let i=e.data.location?e.data.location:e.data.line?e.data.line:e.data.polygon?e.data.polygon:null,r={};r.title=e.title;r.permalink=e.permalink;r.categories=e.categories.map((e=>e.name)).join(",");this.getRecursivePropertyValue(r,e.data.additional_details,"");r.geography=JSON.stringify(i);if(this.included_fields&&""!==this.included_fields){let e={};this.included_fields.split(",").forEach((t=>{let i=t.trim();r[i]&&(e[i]=r[i])}));r=e}t.push(r)}));return t}getRecursivePropertyValue(e,t,i){for(let r in t)Array.isArray(t[r])?e[i+r]=t[r].join(","):"object"==typeof t[r]?this.getRecursivePropertyValue(e,t[r],i+r+"_"):e[i+r]=JSON.stringify(t[r])}downloadCSV(e){const t=(e,t)=>null===t?"":t;let i=[];e.forEach((e=>{for(let t in e)-1===i.indexOf(t)&&i.push(t)}));e.forEach((e=>{i.forEach((t=>{e[t]||(e[t]="")}))}));let r=e.map((e=>i.map((i=>JSON.stringify(e[i],t).replace(/\\"/g,'""'))).join(",")));r.unshift(i.join(","));r=r.join("\r\n");var n=document.createElement("a"),o=new Blob(["\ufeff",r]),s=URL.createObjectURL(o);n.href=s;n.download="map-data-download.csv";document.body.appendChild(n);n.click();document.body.removeChild(n);if(this.notify_on_download){let e=[];jQuery(`.mapster-download-control-${this.post_id} .mapster-category-control input`).each((function(){jQuery(this).is(":checked")&&e.push(jQuery(this).closest("li").text().trim())}));fetch(`${window.mapster_params.rest_url}mapster-wp-maps/send-email`,{method:"POST",body:JSON.stringify({users:this.notify_on_download,active_filters:e})})}}onAdd(e){this.map=e;this.storedBounds=this.map.getBounds();this._container=document.createElement("div");if(window.mapster_params.public){this._container.className=`mapboxgl-ctrl mapster-download-control mapster-download-control-${this.post_id}`;this._container.innerHTML='\n <div class="mapster-download-control-content">\n <button class="mapster-data-download">Download Data</button>\n </div>\n ';this.addListeners()}return this._container}onRemove(){this._container.parentNode.removeChild(this._container);this._map=void 0}}class ListControl{constructor(e,t,i,r,n,o){this.MapsterMap=e.MapsterMap;this.post_id=e.post_id;this.sort_by_distance=e.sort_by_distance;this.show_distance=e.show_distance;this.units=e.units;this.group_by_category=e.group_by_category;this.list_order=e.list_order;this.markers=e.markers;this.mapLibrary=e.mapLibrary;this.listing_type=e.listing_type;this.display_images=e.display_images;this.number_of_locations=e.number_of_locations;this.store_locator=e.store_locator_options.enable;this.sort_hours_by_day=e.store_locator_options.sort_hours_by_day;this.features=e.locations.concat(e.lines.concat(e.polygons));this.currentPage=1;this.storedBounds=null;this.storedMapLocation=null;this.storedLastMarkerClick=null;this.openedCategories=[]}storeLocatorHTML(e){return"<div>Upgrade to Mapster Pro to enable this functionality.</div>"}filterFeatures(){const e=new MapsterHelpers;let t=[];
1this.features.forEach(((i,r)=>{if(!(window.mapster_categories_hidden_features&&window.mapster_categories_hidden_features.indexOf(i.id)>-1)){var n=e.makeFeatureJSON(i.data);if(this.show_distance||this.sort_by_distance){var o=turf.distance(turf.center(n).geometry.coordinates,this.getCenter());i.distance=o*("imperial"===this.units?.621371:1)}t.push(i)}}));return t}sortFeatures(e){return this.sort_by_distance?e.sort(((e,t)=>e.distance>t.distance?1:-1)):e}getCategories(){return[]}sortCategories(e){return e}getCategoryListStructure(e){return[]}setCategoryListHTML(e){return""}setHTML(e){new MapsterHelpers;let t="<ul>",i=this.sortFeatures(this.filterFeatures()),r=this.sortCategories(this.getCategories(i));if(this.group_by_category){let e=this.getCategoryListStructure(r,i);t=this.setCategoryListHTML(e)}else{var n=[];i.forEach(((e,t)=>{"paginate"===this.listing_type?this.number_of_locations*(this.currentPage-1)<=t&&this.number_of_locations*this.currentPage>t&&n.push(e):n=i}));this.store_locator?t=this.storeLocatorHTML(t,n):n.forEach((e=>{let i=""; 2t+=`\n <li data-id="${e.id}">\n ${i}\n ${e.title}\n <em>${e.distance?e.distance.toFixed(2)+("imperial"===this.units?" miles":" km"):""}</em>\n </li>\n `}));t+="</ul>"}if("paginate"===this.listing_type){t+='<div class="mapster-paging">';this.currentPage>1&&(t+='<span class="mapster-back dashicons dashicons-arrow-left"></span>');this.number_of_locations*this.currentPage<i.length&&(t+='<span class="mapster-next dashicons dashicons-arrow-right"></span>');t+="</div>"}if(e)return t;jQuery(`.mapster-list-control-${this.post_id} .mapster-list-control-content`).html(t)}getStoreHTML(e){return""}getCenter(){return[this.map.getCenter().lng,this.map.getCenter().lat]}addListeners(){var e=this;const t=new MapsterHelpers;jQuery(document).on("click",`.mapster-list-control-${this.post_id} li`,(function(i,r=!1){if(!(jQuery(this).find(".mapster-accordion-indicator").length>0||i.isTrigger&&3!==i.isTrigger)){var n=e.features.find((e=>parseInt(e.id)==jQuery(this).data("id"))),o=t.makeFeatureJSON(n.data).features[0];if("Point"===o.geometry.type){const t=e.markers.find((e=>e.mapsterProperties.id===n.id));t&&n.data.enable_popup&&e.openPopup(t,n);!t&&n.data.enable_popup&&(r||e.openPopupNonMarker(n));let i=n.data.default_zoom_level&&""!==n.data.default_zoom_level?n.data.default_zoom_level:15;e.centerMap(o.geometry.coordinates,i)}else{n.data.enable_popup&&(r||e.openPopupNonMarker(n));var s=turf.bbox(o);e.fitBounds(s,{padding:20})}if(e.store_locator){jQuery(`.mapster-list-control-${e.post_id} .mapster-list-control-content`).hide();jQuery(`.mapster-list-control-${e.post_id} .mapster-list-control-single-content`).show();jQuery(`.mapster-list-control-${e.post_id} .mapster-list-control-single-content`).html(e.getStoreHTML(n))}}}));jQuery(document).on("click",`.mapster-list-control-${this.post_id} .mapster-accordion-indicator-open, .mapster-list-control-${this.post_id} .mapster-accordion-indicator-closed`,(function(){let t=!1;jQuery(this).hasClass("mapster-accordion-indicator-open")&&(t=!0);if(t){jQuery(this).removeClass("mapster-accordion-indicator-open");jQuery(this).addClass("mapster-accordion-indicator-closed");jQuery(this).next("ul").is(":visible")&&jQuery(this).next("ul").slideToggle();e.openedCategories.splice(e.openedCategories.indexOf(jQuery(this).data("id")),1)}else{jQuery(this).addClass("mapster-accordion-indicator-open");jQuery(this).next("ul").slideToggle();e.openedCategories.push(jQuery(this).data("id"))}}));jQuery(document).on("click",`.mapster-list-control-${this.post_id} .mapster-next`,(()=>{this.currentPage=this.currentPage+1;this.setHTML()}));jQuery(document).on("click",`.mapster-list-control-${this.post_id} .mapster-back`,(()=>{this.currentPage=this.currentPage-1;this.setHTML()}));jQuery(document).on("click",`.mapster-list-control-${this.post_id} .mapster-store-locator-results`,(()=>{jQuery(".mapster-list-control-content").show();jQuery(".mapster-list-control-single-content").hide();jQuery(".mapster-list-control-single-content").empty();this.storedBounds&&this.fitBounds(this.storedBounds);this.storedMapLocation&&(this.map.flyTo?this.map.flyTo(this.storedMapLocation):this.centerMap(this.storedMapLocation.center,this.storedMapLocation.zoom))}));jQuery(document).on("change",`.mapster-list-control-${this.post_id} .mapster-cat-toggle`,(()=>{this.setHTML()}));let i=!1,r=!1;jQuery(document).on("click",".mapster-list-hide-show",(function(){const e=jQuery(this).parent();if(e.find(".mapster-list-control-content").is(":visible")){if(!i){i=e.css("background-color");r=e.css("box-shadow")}e.css("background-color","transparent");e.css("box-shadow","none");e.find(".mapster-list-control-content").fadeOut();e.find(".mapster-list-control-single-content").fadeOut();jQuery(this).text("Show List")}else{const e=jQuery(this).parent();e.css("background-color",i);e.css("box-shadow",r);e.find(".mapster-list-control-content").fadeIn();e.find(".mapster-list-control-single-content").fadeIn();jQuery(this).text("Hide")}}))}openPopup(e,t){new MapsterHelpers;jQuery(e.getElement()).trigger("click")}openPopupNonMarker(e){const t=(new MapsterHelpers).makeFeatureJSON(e.data),i=turf.pointOnFeature(t);this.MapsterMap.doTriggerClick({lngLat:i.geometry.coordinates},e)}centerMap(e,t){this.map.flyTo({center:e,zoom:t})}fitBounds(e,t){this.map.fitBounds(e,t)}onAdd(e){this.map=e;this.storedMapLocation={center:this.map.getCenter(),zoom:this.map.getZoom(),pitch:this.map.getPitch(),bearing:this.map.getBearing()};this._container=document.createElement("div");this._container.className=`mapboxgl-ctrl mapster-list-control mapster-list-control-${this.post_id}`+(this.store_locator?" mapster-store-locator":"")+(window.innerWidth<768?" mapster-mobile":"");this._container.innerHTML=`<div class="mapster-list-control-content" style="max-height : ${jQuery(this.map._container).height()-100}px">`+this.setHTML(!0)+`</div><div class="mapster-list-control-single-content" style="max-height : ${jQuery(this.map._container).height()}px;"></div>`;if(window.innerWidth<768&&this.store_locator){jQuery(this.map._container).css("overflow","visible");this._container.style.marginTop=`${jQuery(this.map._container).height()}px`;jQuery(this.map._container).after(`<div style="height: ${jQuery(this.map._container).height()}px"></div>`);
2jQuery(".maplibregl-control-container > div, .mapboxgl-control-container > div").width("100%");jQuery(".mapboxgl-ctrl-geocoder").width("100%")}window.innerWidth<768&&!this.store_locator&&(this._container.innerHTML='<div class="mapster-list-hide-show">Hide</div>'+this._container.innerHTML);this.addListeners();this.map.on("moveend",(()=>{this.setHTML()}));setTimeout((()=>{this.store_locator&&!jQuery(".mapster-store-locator .mapboxgl-ctrl-geocoder").length&&jQuery(".mapboxgl-ctrl-geocoder").prependTo(".mapster-store-locator")}),100);return this._container}onAddGoogleMap(e){this.map=e;this.storedMapLocation={center:[this.map.getCenter().lng(),this.map.getCenter().lat()],zoom:this.map.getZoom()};this._container=document.createElement("div");this._container.className=`mapboxgl-ctrl mapster-list-control mapster-list-control-${this.post_id} mapster-list-control-google`+(this.store_locator?" mapster-store-locator":"")+(window.innerWidth<768?" mapster-mobile":"");this._container.innerHTML=`<div class="mapster-list-control-content" style="max-height : ${jQuery(this.map.__gm.developerProvidedDiv).height()-100}px">`+this.setHTML(!0)+`</div><div class="mapster-list-control-single-content" style="max-height : ${jQuery(this.map.__gm.developerProvidedDiv).height()}px;"></div>`;this.addListeners();this.map.addListener("dragend",(()=>{this.setHTML()}));google.maps.event.addListenerOnce(this.map,"idle",(()=>{this.store_locator&&setTimeout((()=>{jQuery(".mapster-google-geocoder-input").addClass("geocoder-google-store-locator");jQuery(".mapster-google-geocoder-input").prependTo(".mapster-store-locator")}),1e3);const e=this.map.getBounds();
2this.storedBounds=[e.getSouthWest().lng(),e.getSouthWest().lat(),e.getNorthEast().lng(),e.getNorthEast().lat()]}));return this._container}onRemove(){this._container.parentNode.removeChild(this._container);this._map=void 0}} 3;class PitchToggle{constructor(e=-20,t=70,i=null){this._bearing=-20;this._pitch=70;this._minpitchzoom=i}onAdd(e){this._map=e;let t=this;this._btn=document.createElement("button");this._btn.className="mapboxgl-ctrl-icon mapboxgl-ctrl-pitchtoggle-3d";this._btn.type="button";this._btn["aria-label"]="Toggle Pitch";this._btn.onclick=function(){if(0===e.getPitch()){let i={pitch:t._pitch,bearing:t._bearing};t._minpitchzoom&&e.getZoom()>t._minpitchzoom&&(i.zoom=t._minpitchzoom);e.easeTo(i);t._btn.className="mapboxgl-ctrl-icon mapboxgl-ctrl-pitchtoggle-2d"}else{e.easeTo({pitch:0,bearing:0});t._btn.className="mapboxgl-ctrl-icon mapboxgl-ctrl-pitchtoggle-3d"}};this._container=document.createElement("div");this._container.className="mapboxgl-ctrl-group mapboxgl-ctrl";this._container.appendChild(this._btn);return this._container}onRemove(){this._container.parentNode.removeChild(this._container);this._map=void 0}}class PrintControl{constructor(){}onAdd(e){this._map=e;let t=this;this._btn=document.createElement("button");this._btn.className="mapboxgl-ctrl-icon mapboxgl-ctrl-printcontrol";this._btn.type="button";this._btn["aria-label"]="Print";this._btn.innerHTML='\n <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16" style="margin-top: 3px;">\n <path d="M5 1a2 2 0 0 0-2 2v1h10V3a2 2 0 0 0-2-2zm6 8H5a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1"/>\n <path d="M0 7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2h-1v-2a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2H2a2 2 0 0 1-2-2zm2.5 1a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1"/>\n </svg>\n ';this._btn.onclick=function(){ 4};this._container=document.createElement("div");this._container.className="mapboxgl-ctrl-group mapboxgl-ctrl";this._container.appendChild(this._btn);return this._container}printMap(){"devicePixelRatio"in window||Object.defineProperty(window,"devicePixelRatio",{get:function(){return 3.125}});const e=document.createElement("canvas"),t=this._map.getCanvas().width,i=this._map.getCanvas().height;e.width=t;e.height=i;const r=e.getContext("2d"),n=new Image;n.onload=function(){r.fillStyle="#333";r.fillRect(0,0,t,i);r.drawImage(n,0,0);let o=document.createElement("a");o.download="image.png";o.href=e.toDataURL("image/png",.92);o.click()};n.src=this._map.getCanvas().toDataURL("image/png")}onRemove(){this._container.parentNode.removeChild(this._container);this._map=void 0}}class CategoryControl{constructor(e){this.post_id=e.post_id;this.displayMode=e.category_display;this.checkboxMode=e.checkbox_display;this.initialVisibility=e.initial_visibility;this.preSelectedCategories=e.pre_selected_categories;this.categoryOrder=e.category_order;this.independentChildren=e.independent_children;this.excludedCategories=e.excluded_categories;this.functionality=e.functionality;this.additional_filters=e.additional_filters;this.reset_button=e.reset_button;this.accordion_layout=e.accordion_layout;this.parent_cat_display=e.parent_cat_display;this.show_number_of_features=e.show_number_of_features;this.did_one_accordion=!1;this.markers=e.markers;this.map_provider=e.map_provider;this.circle_clustering=e.circle_clustering;this.label_icon_clustering=e.label_icon_clustering;this.marker_clustering=e.marker_clustering;this.polygon_clustering=e.polygon_clustering;this.line_clustering=e.line_clustering;this.cluster_options=e.cluster_options;this.features=e.locations.concat(e.lines.concat(e.polygons));this.dataLayers=e.dataLayers;this.locations=e.locations;this.lines=e.lines;this.polygons=e.polygons}setMarkers(e){this.markers=e}organizeCategories(){let e=[];this.features.forEach((t=>{t.categories.forEach((t=>{-1===e.findIndex((e=>e.id===t.id))&&e.push(t)}))}));e=this.filterCategories(e);e=this.sortCategories(e);return e}returnHTML(){return`\n <div>\n ${this.returnCategoryHTML(this.organizeCategories())}\n </div>\n `}returnCategoryHTML(e){var t="<ul>";e.filter((e=>
40===e.parent)).forEach(((i,r)=>{var n=e.filter((e=>e.parent===i.id));t+=this.returnInputHTML(i,n);t+=this.returnChildrenHTML(i,e)}));return t+="</ul>"}returnChildrenHTML(e,t){var i="<ul>",r=t.filter((t=>t.parent===e.id));r.forEach((e=>{i+=this.returnInputHTML(e,[]);i+=this.returnChildrenHTML(e,t)}));i+="</ul>";0===r.length&&(i="");return i}returnInputHTML(e,t){var i=!0;this.initialVisibility||this.preSelectedCategories&&(!this.preSelectedCategories||-1!==this.preSelectedCategories.indexOf(e.id))||(i=!1);return this.returnAccordionHTML(`\n <li>\n ${"checkbox"===this.checkboxMode?`\n <input\n class="mapster-cat-toggle"\n id="${e.id}"\n data-term="${e.id}"\n data-parent="${e.parent}" ${i?'checked="checked"':""}\n style="display: ${this.parent_cat_display&&"hide_check"===this.parent_cat_display&&0===e.parent?"none":""}"\n type="checkbox" />\n `:`\n <label\n class="mapster-switch"\n style="display: ${this.parent_cat_display&&"hide_check"===this.parent_cat_display&&0===e.parent?"none":""}">\n <input class="mapster-cat-toggle" id="${e.id}" data-term="${e.id}" data-parent="${e.parent}" ${i?'checked="checked"':""} type="checkbox" />\n <span class="mapster-slider mapster-round"></span>\n </label>\n `}\n ${"colors"===this.displayMode?`<div class="mapster-color-swatch" style="background-color: ${e.color};"></div>`:""}\n ${"icons"===this.displayMode?`<div class="mapster-icon-swatch" style="background-image: url(${e.icon});background-size: cover;"></div>`:""}\n <label for="${e.id}">${e.name} ${this.returnNumberOfFeatures(e)?`<span class="mapster-number-of-features">(${this.returnNumberOfFeatures(e)})</span>`:""}</label>\n </li>\n `,e,t)}setToggles(e){var t=jQuery(e).data("term"),i=jQuery(e).data("parent"),r=jQuery(e).is(":checked");if(!this.independentChildren)if(0===i)r?jQuery(`.mapster-category-control-${this.post_id} .mapster-cat-toggle[data-parent="${t}"]`).prop("checked",!0):jQuery(`.mapster-category-control-${this.post_id} .mapster-cat-toggle[data-parent="${t}"]`).prop("checked",!1);else if(r)jQuery(`.mapster-category-control-${this.post_id} .mapster-cat-toggle[data-term="${i}"]`).prop("checked",!0);else{var n=!0;jQuery(`.mapster-category-control-${this.post_id} .mapster-cat-toggle[data-parent="${i}"]`).each((function(){jQuery(this).is(":checked")&&(n=!1)}));n&&jQuery(`.mapster-category-control-${this.post_id} .mapster-cat-toggle[data-term="${i}"]`).prop("checked",!1)}}returnIDsToHideFeatures(e){let t=[];this.features.forEach((i=>{if(i.categories.length>0)if("exclusive"===this.functionality)i.categories.find((t=>e.indexOf(t.id)>-1))&&t.push(i.id);else if("inclusive"===this.functionality){var r=!0;i.categories.forEach((t=>{-1===e.indexOf(t.id)&&(r=!1)}));r&&t.push(i.id)}}));return t}returnNumberOfFeatures(){return!1}adjustMarkers(e){let t=[];this.markers.forEach((i=>{const r=this.returnMarkerProperties(i);if(r.categories.length>0)if("exclusive"===this.functionality)if(r.categories.find((t=>e.indexOf(t.id)>-1))){this.changeMarker("hide",i);t.push(i.mapsterProperties.id)}else this.changeMarker("show",i);else if("inclusive"===this.functionality){var n=!0;if(r.categories.length>0){r.categories.forEach((t=>{-1===e.indexOf(t.id)&&(n=!1)}));if(n){this.changeMarker("hide",i);t.push(i.mapsterProperties.id)}else this.changeMarker("show",i)}}}));this.adjustMarkerClusters(t)}adjustMarkerClusters(e){if(this.marker_clustering){let t=["marker"];(new MapsterHelpers).makeClusters(this.map,this.map_provider,this.cluster_options,t,this.locations,[],[],e)}}returnAccordionHTML(e,t,i){return e}filterCategories(e){return e}sortCategories(e){return e}changeMarker(e,t){"hide"===e?t.remove():"show"===e&&t.addTo(this.map)}changeLayerVisibility(){var e=this,t=[];jQuery(`.mapster-category-control-${this.post_id} .mapster-cat-toggle`).each((function(){jQuery(this).is(":checked")||t.push(jQuery(this).data("term"));"1"===window.mapster_params.activated&&e.parent_cat_display&&"hide_check"===e.parent_cat_display&&0===jQuery(this).data("parent")&&jQuery(this).parent().next().is("ul")&&t.push(jQuery(this).data("term"))}));var i=this.returnIDsToHideFeatures(t);this.setHiddenFeatures(i);this.adjustMarkers(t)}setHiddenFeatures(e){const t=new MapsterHelpers;if(this.map.getLayer("symbol")){this.map.getLayer("symbol-clusters")&&t.setClustering(this.map,this.map_provider,this.cluster_options,this.circle_clustering,this.label_icon_clustering,this.marker_clustering,this.polygon_clustering,this.line_clustering,this.markers,this.locations,this.lines,this.polygons,e);let i=this.locations.filter((t=>-1===e.indexOf(t.id))),r=t.createLayerGeoJSON(this.map,"location","symbol",i,[],[],[]);this.map.getSource("symbol").setData(r)}this.map.getStyle().layers.find((e=>
4"circle"===e.type&&e.id.indexOf("clusters")>-1))&&t.setClustering(this.map,this.map_provider,this.cluster_options,this.circle_clustering,this.label_icon_clustering,this.marker_clustering,this.polygon_clustering,this.line_clustering,this.markers,this.locations,this.lines,this.polygons,e);if(this.map.getLayer("circle")){this.map.setPaintProperty("circle","circle-radius",["case",["in",["get","post_id"],["literal",e]],0,["has","circle_radius"],["to-number",["get","circle_radius"]],0]);this.map.setPaintProperty("circle","circle-stroke-width",["case",["in",["get","post_id"],["literal",e]],0,["has",'"circle_stroke-width"'],["to-number",["get",'"circle_stroke-width"']],0])}this.map.getLayer("line")&&this.map.setPaintProperty("line","line-width",["case",["in",["get","post_id"],["literal",e]],0,["has","width"],["to-number",["get","width"]],2]);if(this.map.getLayer("fill")){const t=new MapsterHelpers;let i=this.polygons.filter((t=>-1===e.indexOf(t.id))),r=t.createLayerGeoJSON(this.map,"polygon","fill",[],[],i,[]);this.map.getSource("fill").setData(r)}if(this.map.getLayer("fill-extrusion")){const t=new MapsterHelpers;let i=this.polygons.filter((t=>-1===e.indexOf(t.id))),r=t.createLayerGeoJSON(this.map,"polygon","fill-extrusion",[],[],i,[]);this.map.getSource("fill-extrusion").setData(r)}}returnMarkerProperties(e){return e.mapsterProperties}addResetButton(){if(this.reset_button){let e=this;jQuery(document).on("click",`.mapster-category-control-${this.post_id} #mapster-reset-categories`,(function(){jQuery(`.mapster-category-control-${e.post_id} .mapster-cat-toggle`).each((function(){let t=jQuery(this).data("term");var i=!0;e.initialVisibility||e.preSelectedCategories&&(!e.preSelectedCategories||-1!==e.preSelectedCategories.indexOf(t))||(i=!1);jQuery(this).prop("checked",i)}));e.changeLayerVisibility()}));return'<button id="mapster-reset-categories">Reset</button>'}return""}addListeners(){var e=this;jQuery(document).on("change",`.mapster-category-control-${this.post_id} .mapster-cat-toggle`,(function(){e.setToggles(this);e.changeLayerVisibility()}));jQuery(document).on("click",`.mapster-category-control-${this.post_id} .mapster-accordion-indicator`,(function(){let t=!1;jQuery(this).parent().hasClass("mapster-accordion-indicator-open")&&(t=!0);jQuery(`.mapster-category-control-${e.post_id} .mapster-accordion-indicator`).each((function(){if(jQuery(this).parent().next("ul").is(":visible")){jQuery(this).parent().next("ul").slideToggle(400,(()=>jQuery(this).parent().addClass("mapster-accordion-indicator-closed")));jQuery(this).parent().removeClass("mapster-accordion-indicator-open")}}));if(t)jQuery(this).parent().addClass("mapster-accordion-indicator-closed");else{jQuery(this).parent().addClass("mapster-accordion-indicator-open");jQuery(this).parent().next("ul").slideToggle()}}))}onAdd(e){this.map=e;this._container=document.createElement("div");this._container.className=`mapboxgl-ctrl mapster-category-control mapster-category-control-${this.post_id}`;this._container.innerHTML=this.returnHTML();this.initialVisibility||setTimeout((()=>{this.changeLayerVisibility()}),10);this.addListeners();return this._container}onAddGoogleMap(e){this.map=e;this._container=document.createElement("div");this._container.className=`mapster-category-control mapster-google-category-control mapster-category-control-${this.post_id}`;this._container.innerHTML=this.returnHTML();this.addListeners();return this._container}onRemove(){this._container.parentNode.removeChild(this._container);this.map=void 0}} 5;class LayerControl{constructor(e){this.post_id=e.post_id;this.toggleable_layers=e.toggleable_layers;this.toggleable_layer_titles=e.toggleable_layer_titles;this.checkbox_type=e.checkbox_type}returnHTML(){let e='<ul class="mapster-layer-control-content">';const t=this.toggleable_layers.replace("\r","").split("\n"),i=this.toggleable_layer_titles.replace("\r","").split("\n");t.forEach(((t,r)=>{e+="<li>";const n=t.split(",");let o=!0,s=!0;n.forEach((e=>{if(""!==e){this.map.getLayer(e.trim())||(o=!1);
5"hidden"!==this.map.getLayoutProperty(e.trim(),"visibility")&&void 0===this.map.getLayoutProperty(e.trim(),"visibility")||(s=!1)}}));o?"checkbox"===this.checkbox_type?e+=`<input class="mapster-layer-toggle" data-layers="${t}" ${s?'checked="checked"':""} type="checkbox" /> ${i[r]}`:"radio"===this.checkbox_type?e+=`<input name="mapster-layer-control" class="mapster-layer-toggle" data-layers="${t}" ${s?'checked="checked"':""} type="radio" /> ${i[r]}`:"switch"===this.checkbox_type&&(e+=`<label class="mapster-switch">\n <input class="mapster-layer-toggle" data-layers="${t}" ${s?'checked="checked"':""} type="checkbox" />\n <span class="mapster-slider mapster-round"></span>\n </label> ${i[r]}`):alert("Please double check the layers you've set for the layer control: some don't exist in the style!");e+="</li>"}));e+="</ul>";return e}changeLayerVisibility(){let e=this;jQuery(`.mapster-layer-control-${this.post_id} .mapster-layer-toggle`).each((function(){jQuery(this).data("layers").split(",").forEach((t=>{jQuery(this).is(":checked")?e.map.setLayoutProperty(t.trim(),"visibility","visible"):e.map.setLayoutProperty(t.trim(),"visibility","none")}))}))}addListeners(){var e=this;jQuery(document).on("change",`.mapster-layer-control-${this.post_id} .mapster-layer-toggle`,(function(){e.changeLayerVisibility()}))}onAdd(e){this.map=e;this._container=document.createElement("div");this._container.className=`mapboxgl-ctrl mapster-layer-control mapster-layer-control-${this.post_id}`;const t=setInterval((()=>{if(this.map.isStyleLoaded()){this._container.innerHTML=this.returnHTML();clearInterval(t)}}),100);this.addListeners();return this._container}onRemove(){this._container.parentNode.removeChild(this._container);this._map=void 0}}class StyleControl{constructor(e){this.post_id=e.post_id;this.toggleable_styles=e.toggleable_styles;this.toggleable_styles_titles=e.toggleable_styles_titles;this.initial_style_title=e.initial_style_title;this.map_type=e.map_type;this.default_style=!1}returnHTML(){let e='<ul class="mapster-style-control-content">';const t=new MapsterHelpers;this.default_style=t.getStyle(this.map_type);this.map_type.custom_style_json&&""!==this.map_type.custom_style_json&&(this.default_style=JSON.parse(this.map_type.custom_style_json));e+=`<li><input name="mapster-style-control" class="mapster-style-toggle" data-index="default" checked="checked" type="radio" /> ${this.initial_style_title}`;const i=this.toggleable_styles.replace("\r","").split("\n"),r=this.toggleable_styles_titles.replace("\r","").split("\n");i.forEach(((t,i)=>{if(""!==t){e+="<li>";e+=`<input name="mapster-style-control" class="mapster-style-toggle" data-index="${i}" type="radio" /> ${r[i]}`;e+="</li>"}}));e+="</ul>";return e}addListeners(){var e=this;new MapsterHelpers;jQuery(document).on("change",`.mapster-style-control-${this.post_id} .mapster-style-toggle`,(function(){const t=jQuery(this).data("index");if("default"!==t){const i=e.toggleable_styles.split("\n");i[t].indexOf("{")>-1?e.map.setStyle(JSON.parse(i[t])):e.map.setStyle(i[t]);e.map.fire("mapster_custom_style_load")}else{e.map.setStyle(e.default_style);e.map.fire("mapster_custom_style_load")}}))}onAdd(e){this.map=e;this._container=document.createElement("div");this._container.className=`mapboxgl-ctrl mapster-style-control mapster-style-control-${this.post_id}`;const t=setInterval((()=>{if(this.map.isStyleLoaded()){this._container.innerHTML=this.returnHTML();clearInterval(t)}}),100);this.addListeners();return this._container}onRemove(){this._container.parentNode.removeChild(this._container);this._map=void 0}}class ElevationControl{constructor(e){this.lines=e.lines;this.post_id=e.post_id;this.single_line=e.single_line;this.open_on_load=e.open_on_load;this.profile_color=e.profile_color;this.units=e.units;this.show_line_length=e.show_line_length;this.profile_displayed=!1;this.last_line_displayed=!1}addListeners(){jQuery(document).on("click",`.mapster-elevation-control-${this.post_id} .mapster-elevation-control-content`,(()=>{if(this.profile_displayed){this.removeElevation();this.profile_displayed=!1;jQuery(`.mapster-elevation-control-${this.post_id} .mapster-elevation-control-content`).removeClass("mapster-elevation-control-active")}else{if(this.map.getSource("mapbox-dem"))this.addElevation(this.last_line_displayed);else{this.loadElevationData();this.map.once("idle",(()=>{this.addElevation(this.last_line_displayed)}))}this.profile_displayed=!0;jQuery(`.mapster-elevation-control-${this.post_id} .mapster-elevation-control-content`).addClass("mapster-elevation-control-active")}}));this.single_line&&this.open_on_load&&setTimeout((()=>{this.last_line_displayed=this.lines[0];jQuery(`.mapster-elevation-control-${this.post_id} .mapster-elevation-control-content`).click()}),1e3);this.single_line||this.map.on("click","line",(e=>{this.last_line_displayed=this.lines.find((t=>t.id===e.features[0].properties.post_id));this.profile_displayed&&jQuery(`.mapster-elevation-control-${this.post_id} .mapster-elevation-control-content`).click();jQuery(`.mapster-elevation-control-${this.post_id} .mapster-elevation-control-content`).click()}));this.map.on("mousemove",(()=>
5{this.map.getLayer("elevation-point-along-layer")&&this.map.setLayoutProperty("elevation-point-along-layer","visibility","none")}))}loadElevationData(){this.map.addSource("mapbox-dem",{type:"raster-dem",url:"mapbox://mapbox.terrain-rgb",tileSize:512,maxzoom:14});this.map.setTerrain({source:"mapbox-dem",exaggeration:1.5})}removeElevation(){document.getElementById("mapster-chartjs-container").remove()}addElevation(e){let t=[],i=turf.length(e.data.line);for(let r=0;r<i;r+=i/50){let i=turf.along(e.data.line,r),n=this.map.queryTerrainElevation(i.geometry.coordinates,{exaggerated:!1});"feet"===this.units&&(n*=3.28084);t.push(n)}let r=document.createElement("div");r.setAttribute("id","mapster-chartjs-container");let n=document.createElement("canvas");n.setAttribute("id","mapster-chartjs");document.getElementById(`mapster-wp-maps-${this.post_id}`).append(r);r.append(n);const o=new MapsterConstants;let s=t.map((e=>""));if(this.show_line_length){s=[];t.forEach(((e,t)=>{let r=i/50;"feet"===this.units&&(r*=.621371);let n=parseInt(t*r*10)/10;s.push(n)}))}new Chart(document.getElementById("mapster-chartjs"),{type:"line",data:{labels:s,datasets:[{label:"Elevation",data:t,fill:!1,borderColor:this.profile_color,pointRadius:0,tension:.2}]},options:o.returnElevationChartOptions(this.units,this.show_line_length),plugins:[o.returnElevationChartPlugin(this.map,e)]})}onAdd(e){this.map=e;this.storedBounds=this.map.getBounds();this._container=document.createElement("div");if(window.mapster_params.public){this._container.className=`mapboxgl-ctrl mapster-elevation-control mapster-elevation-control-${this.post_id}`;this._container.innerHTML='\n <div class="mapster-elevation-control-content">\n <svg class="mapster-svg-mountain" focusable="false" viewBox="0 0 24 24" aria-hidden="true">\n <path d="M14 6l-3.75 5 2.85 3.8-1.6 1.2C9.81 13.75 7 10 7 10l-6 8h22L14 6z"></path>\n </svg>\n </div>\n ';this.addListeners()}return this._container}onRemove(){this._container.parentNode.removeChild(this._container);this._map=void 0}}class MapsterConstants{returnElevationChartPlugin(e,t){return{id:"corsair",afterInit:e=>{e.corsair={x:0,y:0}},afterEvent:(e,t)=>{const{chartArea:{top:i,bottom:r,left:n,right:o}}=e,{event:{x:s,y:a}}=t;if(s<n||s>o||a<i||a>r){e.corsair={x:s,y:a,draw:!1};e.draw()}else{e.corsair={x:s,y:a,draw:!0};e.draw()}},afterDatasetsDraw:(i,r,n)=>{const{ctx:o,chartArea:{top:s,bottom:a,left:l,right:c}}=i,{x:u,y:h,draw:p}=i.corsair;if(!p)return;o.lineWidth=n.width||0;o.setLineDash(n.dash||[]);o.strokeStyle=n.color||"black";o.save();o.beginPath();o.moveTo(u,a);o.lineTo(u,s);o.stroke();
5o.restore();const d=(u-l)/(c-l);let f=turf.length(t.data.line),m=turf.along(t.data.line,f*d);if(e.getSource("elevation-point-along")&&e.getLayer("elevation-point-along-layer")){e.getSource("elevation-point-along").setData(m);e.setLayoutProperty("elevation-point-along-layer","visibility","visible")}else{e.addSource("elevation-point-along",{type:"geojson",data:m});e.addLayer({id:"elevation-point-along-layer",type:"circle",source:"elevation-point-along"})}}}}returnElevationChartOptions(e,t){return{interaction:{intersect:!1,mode:"index"},scales:{x:{title:{display:!!t,text:"meters"===e?"KM":"Miles",font:{style:"italic",size:10}},grid:{display:!0},ticks:{font:{size:10}}}},maintainAspectRatio:!1,plugins:{legend:{display:!1},title:{display:!0,text:`Elevation (${"meters"===e?"m":"ft"})`},tooltip:{displayColors:!1,callbacks:{label:function(t){return parseInt(10*t.parsed.y)/10+" "+("meters"===e?"m":"ft")}}},corsair:{color:"#333",width:1}}}}returnStyleProviders(){let e=[{id:"standard-day",style:"mapbox://styles/mapbox/standard",lighting:"day"},{id:"standard-night",style:"mapbox://styles/mapbox/standard",lighting:"night"},{id:"standard-dusk",style:"mapbox://styles/mapbox/standard",lighting:"dusk"},{id:"standard-dawn",style:"mapbox://styles/mapbox/standard",lighting:"dawn"},{id:"standard-satellite-day",style:"mapbox://styles/mapbox/standard-satellite",lighting:"day"},{id:"standard-satellite-night",style:"mapbox://styles/mapbox/standard-satellite",lighting:"night"},{id:"streets",style:"mapbox://styles/mapbox/streets-v12"},{id:"outdoors",style:"mapbox://styles/mapbox/outdoors-v12"},{id:"light",style:"mapbox://styles/mapbox/light-v11"},{id:"dark",style:"mapbox://styles/mapbox/dark-v11"},{id:"satellite",style:"mapbox://styles/mapbox/satellite-v9"},{id:"satellite-streets",style:"mapbox://styles/mapbox/satellite-streets-v12"},{id:"navigation-day",style:"mapbox://styles/mapbox/navigation-day-v1"},{id:"navigation-night",style:"mapbox://styles/mapbox/navigation-night-v1"},{id:"custom-image",style:{version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[{id:"background",type:"background",paint:{"background-color":"rgba(255,255,255,1)"}}]}},{id:"empty",style:{version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{},layers:[{id:"background",type:"background",paint:{"background-color":"rgba(255,255,255,1)"}}]}},{id:"open-street-map",style:this.returnJsonStyle("https://a.tile.openstreetmap.org/{z}/{x}/{y}.png",'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors')},{id:"open-topo-map",style:this.returnJsonStyle("https://a.tile.opentopomap.org/{z}/{x}/{y}.png",'Map data: © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="https://viewfinderpanoramas.org">SRTM</a> | Map style: © <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)')},{id:"hot-osm",style:this.returnJsonStyle("https://a.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png",'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Tiles style by <a href="https://www.hotosm.org/" target="_blank">Humanitarian OpenStreetMap Team</a> hosted by <a href="https://openstreetmap.fr/" target="_blank">OpenStreetMap France</a>')},{id:"cyclo-osm",style:this.returnJsonStyle("https://a.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png",'<a href="https://github.com/cyclosm/cyclosm-cartocss-style/releases" title="CyclOSM - Open Bicycle render">CyclOSM</a> | Map data: © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors')},{id:"toner-stamen",style:this.returnJsonStyle("https://tiles.stadiamaps.com/tiles/stamen_toner/{z}/{x}/{y}.png",'Map tiles by <a href="https://stamen.com">Stamen Design</a>, <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors')},{id:"watercolor-stamen",style:this.returnJsonStyle("https://tiles.stadiamaps.com/tiles/stamen_watercolor/{z}/{x}/{y}.jpg",'Map tiles by <a href="https://stamen.com">Stamen Design</a>, <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors')},{id:"terrain-stamen",style:this.returnJsonStyle("https://tiles.stadiamaps.com/tiles/stamen_terrain/{z}/{x}/{y}.png",'Map tiles by <a href="https://stamen.com">Stamen Design</a>, <a href="https://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> — Map data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors')},{id:"esri-satellite",style:this.returnJsonStyle("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}","Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community")},{id:"esri-topo",style:this.returnJsonStyle("https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}","Tiles © Esri — Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community")},{id:"esri-hybrid",style:"https://raw.githubusercontent.com/go2garret/maps/main/sr
5c/assets/json/arcgis_hybrid.json"},{id:"dark-matter",style:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"},{id:"dark-matter-nolabels",style:"https://basemaps.cartocdn.com/gl/dark-matter-nolabels-gl-style/style.json"},{id:"positron",style:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json"},{id:"positron-nolabels",style:"https://basemaps.cartocdn.com/gl/positron-nolabels-gl-style/style.json"},{id:"voyager",style:"https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json"},{id:"voyager-nolabels",style:"https://basemaps.cartocdn.com/gl/voyager-nolabels-gl-style/style.json"},{id:"icgc-main",style:"https://geoserveis.icgc.cat/contextmaps/icgc.json"},{id:"icgc-dark",style:"https://geoserveis.icgc.cat/contextmaps/icgc_mapa_base_fosc.json"},{id:"icgc-orthophoto",style:"https://geoserveis.icgc.cat/contextmaps/icgc_orto_estandard.json"},{id:"blank-map",style:this.returnJsonStyle("https://a.tile.openstreetmap.org/{z}/{x}/{y}.png",'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors')}];if("1"===window.mapster_params.activated){let t=[{id:"mapster-unicorn",style:"mapbox://styles/mapstertech/cm10x5cvq02n401pwhdpncvrj"},{id:"mapster-minimo",style:"mapbox://styles/mapstertech/cm12g9n3g00t501rbej0m74bv"},{id:"mapster-whaam",style:"mapbox://styles/mapstertech/cm15kgcun033l01r793jh5b30"},{id:"mapster-standard-oil",style:"mapbox://styles/mapstertech/cm12g8j4t03ao01pq9wm99p54"},{id:"mapster-blueprint",style:"mapbox://styles/mapstertech/cm12g880g00t401rb9yc32icp"},{id:"mapster-frank",style:"mapbox://styles/mapstertech/cm12g7tw303an01pqh7vr9sp4"},{id:"mapster-pencil",style:"mapbox://styles/mapstertech/cm10xd4pn02g501rggzgifof7"},{id:"mapster-bubble",style:"mapbox://styles/mapstertech/cm10xc01702g401rg1hmg4db8"},{id:"mapster-memory",style:"mapbox://styles/mapstertech/cm10xaa8m020g01pq4ueh42z2"},{id:"mapster-neon-glow",style:"mapbox://styles/mapstertech/cm10x86ma00l601r74d7a7rfw"},{id:"mapster-vintage",style:"mapbox://styles/mapstertech/cm15klhbj033m01r70dwy5ap8"},{id:"mapster-swiss-ski",style:"mapbox://styles/mapstertech/cm15klq59018k01q13nz0eo5k"},{id:"mapster-neon",style:"mapbox://styles/mapstertech/cm15km0rx023b01rb6v7ieds5"},{id:"mapster-monochrome-blue",style:"mapbox://styles/mapstertech/cm15km82m018l01q1aha7e04l"},{id:"mapster-camouflage",style:"mapbox://styles/mapstertech/cm15l1x1g018n01q127v8g0pu"},{id:"mapster-bright",style:"mapbox://styles/mapstertech/cm15l28wo023c01rb3ukd02j6"}];e=e.concat(t)}return e}returnJsonStyle(e,t){return{version:8,glyphs:"https://fonts.openmaptiles.org/{fontstack}/{range}.pbf",sources:{"raster-tiles":{type:"raster",tiles:[e],tileSize:256,attribution:t}},layers:[{id:"simple-tiles",type:"raster",source:"raster-tiles",minzoom:0,maxzoom:22}]}}defaultLoader(){return"\n <svg width='38' height='38' viewBox='0 0 38 38' xmlns='https://www.w3.org/2000/svg' stroke='#333'>\n <g fill='none' fill-rule='evenodd'>\n <g transform='translate(1 1)' stroke-width='2'>\n <circle stroke-opacity='.5' cx='18' cy='18' r='18'/>\n <path d='M36 18c0-9.94-8.06-18-18-18'>\n <animateTransform\n attributeName='transform'\n type='rotate'\n from='0 18 18'\n to='360 18 18'\n dur='1s'\n repeatCount='indefinite'/>\n </path>\n </g>\n </g>\n </svg>"}loaderHTML(e){let t=this.defaultLoader(),i="rgba(255,255,255,0.6)";if("1"===window.mapster_params.activated&&e&&e.loading_graphic){t=e.loading_graphic.replace("svg",`svg stroke="${e.loader_color}" fill="${e.loader_color}"`);e.background_color&&(i=e.background_color);"custom"===e.loading_graphic&&(t=`<img src="${e.custom_loader}" />`)}return`\n\t\t\t<div class="mapster-map-loader" style="background-color:${i}">\n\t\t\t\t${t}\n\t\t\t</div>\n\t\t`}markerAsSVG(e){return"data:image/svg+xml;charset=UTF-8,"+encodeURIComponent(`\n <svg display="block" height="41px" width="27px" viewBox="0 0 27 41" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <g fill-rule="nonzero">\n <g transform="translate(3.0, 29.0)" fill="#000000">\n <ellipse opacity="0.04" cx="10.5" cy="5.80029008" rx="10.5" ry="5.25002273"></ellipse>\n <ellipse opacity="0.04" cx="10.5" cy="5.80029008" rx="10.5" ry="5.25002273"></ellipse>\n <ellipse opacity="0.04" cx="10.5" cy="5.80029008" rx="9.5" ry="4.77275007"></ellipse>\n <ellipse opacity="0.04" cx="10.5" cy="5.80029008" rx="8.5" ry="4.29549936"></ellipse>\n <ellipse opacity="0.04" cx="10.5" cy="5.80029008" rx="7.5" ry="3.81822308"></ellipse>\n <ellipse opacity="0.04" cx="10.5" cy="5.80029008" rx="6.5" ry="3.34094679"></ellipse>\n <ellipse opacity="0.04" cx="10.5" cy="5.80029008" rx="5.5" ry="2.86367051"></ellipse>\n <ellipse opacity="0.04" cx="10.5" cy="5.80029008" rx="4.5" ry="2.38636864"></ellipse>\n </g>\n <g fill="${e}">\n <path d="M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"></path>\n </g>\n <g opacity="0.25" fill="${e}">\n <path d="M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"></path>\n </g>\n <g transform="translate(6.0, 7.0)" fill="#FFFFFF"></g>\n <g transform="translate(8.0, 8.0)">\n <circle fill="${e}" opacity="0.25" cx="5.5" cy="5.5" r="5.4999962"></circle>\n <circle fill="#FFFFFF" cx="5.5" cy="5.5" r="5.4999962"></circle>\n </g>\n </g>\n </svg>\n `)}}class MapsterHelpers{constructor(){this.queuedImages=[]}isMobile(){let e=!1;/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(e=!0);return e}changeCursor(e,t,i){t&&t.data&&(t.data.enable_popup||t.data.open_link_on_click)&&(e.getCanvas().style.cursor="on"===i?"pointer":"grab")}formatResponse(e){["location","line","polygon"].forEach((t=>{e[t+"s"].forEach((i=>{this.setObjectProperties(i,e[t+"_template"]);this.setPopupStyles(i,e.popup_styles)}))}));return new Promise((t=>{t(e)}))}simulateMouseActions(e,t,i,r,n,o,s){const a=r.find((e=>e.mapsterProperties.id===parseInt(i)));if(a){let e=a.mapsterProperties.data.default_zoom_level&&""!==a.mapsterProperties.data.default_zoom_level?a.mapsterProperties.data.default_zoom_level:15;t.jumpTo({center:a.mapsterProperties.data.location.coordinates,zoom:e});if(a.mapsterProperties.data.enable_popup)if("click"===a.mapsterProperties.data.interaction)a.getElement().click();else if("hover"===a.mapsterProperties.data.interaction){const e=new Event("mouseenter");a.getElement().dispatchEvent(e)}}else{const r=n.concat(o.concat(s)).find((e=>e.id===parseInt(i)));if(r){let i=r.data.default_zoom_level&&""!==r.data.default_zoom_level?r.data.default_zoom_level:15,n=!1;if(r.data.location){n=r.data.location.coordinates;t.jumpTo({center:r.data.location.coordinates,zoom:i})}else{const e=r.data.line?r.data.line:r.data.polygon;n=turf.center(e).geometry.coordinates;t.fitBounds(turf.bbox(e),{padding:20})}r.data.enable_popup&&("click"===r.data.interaction?e.doTriggerClick({lngLat:n},r):"hover"===r.data.interaction&&e.doTriggerHover({lngLat:n},r))}}}getDefaultCenter(){let e=[0,0];"1"===window.mapster_params.activated&&window.mapster_params.mapster_default_lat&&window.mapster_params.mapster_default_lng&&(e=[parseFloat(window.mapster_params.mapster_default_lng),parseFloat(window.mapster_params.mapster_default_lat)]
5);return e}getDefaultZoom(){let e=2;"1"===window.mapster_params.activated&&window.mapster_params.mapster_default_zoom&&(e=parseFloat(window.mapster_params.mapster_default_zoom));return e}doHover(e,t){let i=t.data.line?"line":t.data.label&&t.data.label.label_on||t.data.icon&&t.data.icon.icon_on?"symbol":t.data.circle?"circle":t.data.polygon?"fill":[],r="line"===i||"fill"===i||"symbol"===i?t.data:"circle"===i?t.data.circle:t.data.symbol;if("symbol"===i){t.data.label.label_on&&(r=t.data.label.label_properties);t.data.icon.icon_on&&(r=t.data.icon.icon_properties)}if(r&&r.hover_effects&&r.hover_effects.hover_enabled){e.removeFeatureState({source:i});e.setFeatureState({source:i,id:t.id},{hover:!0})}}doHoverOut(e,t){let i=t.data.line?"line":t.data.label&&t.data.label.label_on||t.data.icon&&t.data.icon.icon_on?"symbol":t.data.circle?"circle":t.data.polygon?"fill":[],r="line"===i||"fill"===i?t.data:"circle"===i?t.data.circle:t.data.symbol;if("symbol"===i){t.data.label.label_on&&(r=t.data.label.label_properties);t.data.icon.icon_on&&(r=t.data.icon.icon_properties)}r&&r.hover_effects&&r.hover_effects.hover_enabled&&e.setFeatureState({source:i,id:t.id},{hover:!1})}doMarkerHover(e,t,i){let r=i.mapsterProperties.data;if(r.marker.hover_effects.hover_enabled){const n=new t.Marker({color:r.marker.hover_effects.hover_color,scale:parseFloat(r.marker.hover_effects.hover_scale)/100,rotation:parseFloat(r.marker.hover_effects.hover_rotation),anchor:r.marker.anchor});-1===n._element.className.indexOf("mapster-remove-hover")&&(n._element.className+=" mapster-remove-hover");-1===i._element.className.indexOf("mapster-hide-original")&&(i._element.className+=" mapster-hide-original");n.setLngLat([i._lngLat.lng,i._lngLat.lat]).addTo(e);return n}return!1}doMarkerHoverOut(e,t){t._element.className.indexOf("mapster-hide-original")>-1&&(t._element.className=t._element.className.replace(" mapster-hide-original",""));e.remove()}globeAnimate(e,t,i){e.getZoom();let r=360/(201-t);const n=e.getCenter();"east-west"===i?n.lng+=r:"west-east"===i?n.lng-=r:"north-south"===i?n.lat+=r:"south-north"===i&&(n.lat-=r);e.easeTo({center:n,duration:1e3,easing:e=>e})}setMapCompare(e,t,i,r){ 6}createFillImages(e,t){ 7}getBase64Image(e){var t=document.createElement("canvas");t.width=e.width;t.height=e.height;t.getContext("2d").drawImage(e,0,0);return t.toDataURL("image/png")}applyProSearchFilter(e,t){ 8return t}setGeolocationOnLoad(e){ 9}setMapBreakpointSizes(e,t){ 10}async getImageData(e){return wp.media.attachment(e).fetch().then((e=>e))}async setCustomImageMap(e,t,i,r){ 11}loadModalSteps(e,t,i,r,n,o){const s=new MapsterConstants;let a=!1,l=[];
11if("create_point"===r){if(n)if(1===n.length){a=n[0].term_id;if(o.submission_interface.include_address_search){c(e);u()}else{u();h()}}else{c(e);jQuery(`#mapster-submission-modal-${e} .mapster-submission-modal-content`).html(`\n <div class="mapster-category-container">\n ${n.map((e=>`\n <div class="mapster-category-tile mapster-cat-set" data-category="${e.term_id}">\n ${e.icon?`<div class="mapster-category-image"><img src="${e.icon}" /></div>`:""}\n ${e.name?`<div class="mapster-category-name"><p>${e.name}</p></div>`:""}\n ${e.description?`<div class="mapster-category-description"><p>${e.description}</p></div>`:""}\n </div>\n `)).join("")}\n </div>\n `)}else{c(e);jQuery(`#mapster-submission-modal-${e} .mapster-submission-modal-content`).html(`\n <div class="mapster-category-container" data-category="none">\n <div class="mapster-category-tile mapster-cat-set">${o.custom_texts.add_point_text}</div>\n </div>\n `)}jQuery(document).on("click",`#mapster-submission-modal-${e} .mapster-category-tile.mapster-cat-set`,(function(){"none"!==jQuery(this).data("category")&&(a=jQuery(this).data("category"));u()}))}if("edit_point"===r){const t=window.mapster_params.user_submission_permalink;c(e);jQuery(`#mapster-submission-modal-${e} .mapster-submission-modal-content`).html(`\n ${s.loaderHTML()}\n <iframe\n onload="jQuery('.mapster-map-loader').remove();"\n class="mapster-submission-embed"\n src="${t}?pagetype=search&map_id=${e}">\n </iframe>\n `)}window.onmessage=function(e){if(e.data&&e.data.indexOf){e.data.indexOf("set_point")>-1&&u(e.data.replace("set_point-",""));if(e.data.indexOf("close_modal")>-1){jQuery(".mapster-submission-modal-overlay").fadeOut(50);jQuery(".mapster-submission-modal").fadeOut(100)}}};function c(e){jQuery(`.mapster-submit-${e} #mapster-submission-modal-overlay-${e}`).fadeIn(100);jQuery(`.mapster-submit-${e} #mapster-submission-modal-${e}`).fadeIn(150)}function u(r){o.submission_interface.include_address_search?jQuery(`#mapster-submission-modal-${e} .mapster-submission-modal-content`).html(`\n <div class="mapster-description-text"><p>${o.custom_texts.choose_how}</p></div>\n <div class="mapster-category-container">\n ${o.submission_interface.include_address_search?`<div class="mapster-category-tile mapster-method-set" data-method="address" style="max-width:none;"><p>${o.custom_texts.address_search}</p></div>`:""}\n <div class="mapster-category-tile mapster-method-set" data-method="click" style="max-width:none;"><p>${o.custom_texts.map_click}</p></div>\n </div>\n `):h();jQuery(document).on("click",`#mapster-submission-modal-${e} .mapster-category-tile.mapster-method-set`,(function(){if("address"===jQuery(this).data("method")){const r=new MapboxGeocoder({accessToken:o.submission_interface.mapbox_geocoder_access_token,mapboxgl:i,marker:!1});jQuery(`#mapster-submission-modal-${e} .mapster-submission-modal-content`).html(`<p>${o.custom_texts.search_location}</p>`);jQuery(`#mapster-submission-modal-${e} .mapster-submission-modal-content`)[0].appendChild(r.onAdd(t));r.on("result",(function(){h()}))}"click"===jQuery(this).data("method")&&h()}));jQuery(document).on("click",`#mapster-wp-maps-${e} .mapster-selection-instructions button`,(function(i){const r=t.getCenter();let n=!0;if(o.administration.allowed_area){const e=JSON.parse(o.administration.allowed_area);turf.booleanPointInPolygon([r.lng,r.lat],e.features[0])||(n=!1)}jQuery(".mapboxgl-ctrl").show();jQuery(".mapster-selection-overlay").remove();l=[r.lng,r.lat];jQuery(`#mapster-submission-modal-overlay-${e}`).fadeIn(100);jQuery(`#mapster-submission-modal-${e}`).fadeIn(150);jQuery(`#mapster-submission-modal-${e} .mapster-submission-modal-content`).html(`\n <div class="mapster-description-text"><p>${n?o.custom_texts.selection_saved:o.custom_texts.selection_error}</p></div>\n <div class="mapster-category-container">\n <div class="mapster-category-tile mapster-method-set" data-method="click" style="max-width:none;"><p>${o.custom_texts.try_again}</p></div>\n ${n?`<div class="mapster-category-tile mapster-coords-set" style="max-width:none;"><p>${o.custom_texts.confirm}</p></div>`:""}\n </div>\n `)}));jQuery(document).on("click",`#mapster-submission-modal-${e} .mapster-category-tile.mapster-coords-set`,(function(){const t=window.mapster_params.user_submission_permalink;let i=!!o.administration.template_post&&o.administration.template_post.ID;if(o.administration.multiple_templates){let e=o.submission_interface.categories.indexOf(a);i=o.administration.template_posts[e]}let n=r?"&type=edit&post_id="+r:"";jQuery(`#mapster-submission-modal-${e} .mapster-submission-modal-content`).html(`\n ${s.loaderHTML()}\n <iframe\n onload="jQuery('.mapster-map-loader').remove();"\n class="mapster-submission-embed"\n src="${t}?category=${a}&coords=${l.join(",")}&map_id=${e}${n}">\n </iframe>\n `)}))}function h(){jQuery(".mapster-submission-modal-close").trigger("click");jQuery(".mapboxgl-ctrl").hide();jQuery(t._container).append(`\n <div class="mapster-selection-overlay">\n <div class="mapster-selection-instructions">\n <p>${o.custom_texts.drag_zoom}</p>\n <button>${o.custom_texts.capture_point}</button>\n </div>\n <svg version="1.1" id="Uploaded to svgrepo.com" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n width="32px" height="32px" viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">\n <style type="text/css">\n .dashing_een{fill:#141414;}\n .st0{fill:#141414;}\n </style>\n <path class="dashing_een" d="M15.5,21.5v-2c0-0.276,0.224-0.5,0.5-0.5s0.5,0.224,0.5,0.5v2c0,0.276-0.224,0.5-0.5,0.5\n S15.5,21.776,15.5,21.5z M16,13c0.276,0,0.5-0.224,0.5-0.5v-2c0-0.276-0.224-0.5-0.5-0.5s-0.5,0.224-0.5,0.5v2\n C15.5,12.776,15.724,13,16,13z M16,3c0.276,0,0.5-0.224,0.5-0.5v-2C16.5,0.224,16.276,0,16,0c-0.276,0-0.5,0.224-0.5,0.5v2\n C15.5,2.776,15.724,3,16,3z M16,32c0.276,0,0.5-0.224,0.5-0.5v-2c0-0.276-0.224-0.5-0.5-0.5s-0.5,0.224-0.5,0.5v2\n C15.5,31.776,15.724,32,16,32z M22,16c0-0.276-0.224-0.5-0.5-0.5h-2c-0.276,0-0.5,0.224-0.5,0.5s0.224,0.5,0.5,0.5h2\n C21.776,16.5,22,16.276,22,16z M13,16c0-0.276-0.224-0.5-0.5-0.5h-2c-0.276,0-0.5,0.224-0.5,0.5s0.224,0.5,0.5,0.5h2\n C12.776,16.5,13,16.276,13,16z M3,16c0-0.276-0.224-0.5-0.5-0.5h-2C0.224,15.5,0,15.724,0,16c0,0.276,
110.224,0.5,0.5,0.5h2\n C2.776,16.5,3,16.276,3,16z M32,16c0-0.276-0.224-0.5-0.5-0.5h-2c-0.276,0-0.5,0.224-0.5,0.5s0.224,0.5,0.5,0.5h2\n C31.776,16.5,32,16.276,32,16z M27,16c0,6.065-4.935,11-11,11S5,22.065,5,16S9.935,5,16,5S27,9.935,27,16z M26,16.5h-1.5\n c-0.276,0-0.5-0.224-0.5-0.5s0.224-0.5,0.5-0.5H26c-0.255-5.115-4.387-9.245-9.5-9.5v1.5C16.5,7.776,16.276,8,16,8\n s-0.5-0.224-0.5-0.5V6c-5.113,0.255-9.245,4.385-9.5,9.5h1.5C7.776,15.5,8,15.724,8,16s-0.224,0.5-0.5,0.5H6\n c0.255,5.115,4.387,9.245,9.5,9.5v-1.5c0-0.276,0.224-0.5,0.5-0.5s0.5,0.224,0.5,0.5V26C21.613,25.745,25.745,21.615,26,16.5z"/>\n </svg>\n </div>\n `)}}setProjectionGlobe(e,t){ 12}create3DModels(e,t){ 13}setPopupStyles(e,t){if(e.data.popup_style){let i=e.data.popup_style,r=t.find((e=>e.id===i));e.data.popup_style=r}}setObjectProperties(e,t){for(var i in t)if(this.isObject(t[i])){null==e[i]&&(e[i]={});this.setObjectProperties(e[i],t[i])}else null==e[i]&&(e[i]=t[i])}isObject(e){return"object"==typeof e&&!Array.isArray(e)&&null!==e}makeFeatureJSON(e){let t=e.line?e.line:e.location?e.location:!!e.polygon&&e.polygon;return{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:t.type,coordinates:t.coordinates}}]}}getLighting(e){const t=new MapsterConstants;if(""!==e.custom_mapbox_style)return!1;if("custom-image"===e.map_provider)return!1;if(""!==e.access_token&&"mapbox"===e.map_provider){var i=e.map_tile_style_access_token;return t.returnStyleProviders().find((e=>e.id===i)).lighting}i=e.map_tile_style_no_access_token;return t.returnStyleProviders().find((e=>e.id===i)).lighting}getStyle(e){const t=new MapsterConstants;if(""!==e.custom_mapbox_style)return e.custom_mapbox_style;if("custom-image"===e.map_provider)return t.returnStyleProviders().find((e=>"custom-image"===e.id)).style;if(""!==e.access_token&&"mapbox"===e.map_provider){var i=e.map_tile_style_access_token;return t.returnStyleProviders().find((e=>e.id===i)).style}i=e.map_tile_style_no_access_token;return t.returnStyleProviders().find((e=>e.id===i)).style}isInControlMenu(e,t){let i=[];e&&e.enable&&e.included_controls&&(i=JSON.parse(e.included_controls));return i.indexOf(t)>-1}addMapControl(e,t,i,r,n,o,s,a={}){t&&e.removeControl(t);if(i){const t=new s(a);n&&""!==n&&document.getElementById(n)?document.getElementById(n).appendChild(t.onAdd(e)):o?document.getElementById("mapster-control-menu-holder").appendChild(t.onAdd(e)):e.addControl(t,r);return t}return!1}searchCoordinateGeocoder(e){ 14}searchLocalFeatures(e,t,i,r,n,o=!1){var s={type:"FeatureCollection",features:[]};i.concat(r.concat(n)).forEach((e=>{var t=this.makeFeatureJSON(e.data);s.features.push(this.makeGeocoderResult(e,t,o))}));let a=this.localFeaturesTextMatch(e,t,s.features);a.sort(((e,t)=>e.place_name>t.place_name?1:-1));return a}localFeaturesTextMatch(e,t,i){let r=[];const n=t.split(" ").filter((e=>""!==e));i.forEach((i=>{var o=!1;
14i.properties.searchableTexts.forEach((s=>{var a={type:"Feature",id:i.properties.id,place_name:jQuery("<div>").html(i.properties.place_name).text()};"1"===window.mapster_params.activated&&i.properties.thumbnail&&(a.place_name=`\n <img src="${i.properties.thumbnail}" class="mapster-filter-dropdown-image" /><br />${a.place_name}\n `);if(!(window.mapster_categories_hidden_features&&window.mapster_categories_hidden_features.length>0&&-1!==window.mapster_categories_hidden_features.indexOf(i.properties.id))){if("exact-match"===e&&s&&(s.toLowerCase().indexOf(t.toLowerCase())>-1||" "===t)&&!o){a.center=turf.center(i).geometry.coordinates;"Point"!==i.geometry.type&&(a.bbox=turf.bbox(i));r.push(a);o=!0} 15}}))}));return r}initializeSlider(e,t){const i=e=>{jQuery("#mapster-slider ul").animate({left:jQuery("#mapster-slider ul li").width()*("right"===e?-1:1)},200,(()=>{jQuery("#mapster-slider ul li:first-child").appendTo("#mapster-slider ul");jQuery("#mapster-slider ul").css("left","")}))};if(!window.sliderClicksInitialized){jQuery(document).on("click","#mapster-slider .mapster-slider-control_prev",(function(){i("left")}));jQuery(document).on("click","#mapster-slider .mapster-slider-control_next",(function(){i("right")}));window.sliderClicksInitialized=!0}}makeHeatmap(e,t,i,r){ 16}loadListings(e,t,i){ 17}loadCustomListingHTML(e,t){let i; 18return`\n <div class="mapster-listing-single-item" data-post_id="${t.id}">\n ${i}\n </div>\n `}setListingEvents(e,t,i,r,n){ 19}setListingStickyMap(){ 20}createHeatmapProperties(e,t,i,r){ 21}fadeHeatmapFeatures(e,t){ 22}setClustering(e,t,i,r,n,o,s,a,l,c,u,h,p){o&&this.doMarkerClustering(e,t,i,o,l,c,p);return n||r?this.doSymbolClustering(e,t,i,r,n,c,u,h,p):s||a?this.doPolygonAndLineClustering(e,t,i,s,a,c,u,h,p):[]}doMarkerClustering(e,t,i,r,n,o,s){let a=i.cluster_by_category?i.categories_to_cluster.map((e=>"marker-"+e)):["marker"];this.makeClusters(e,t,i,a,o,[],[],s);e.on("render",(()=>{let t=[];a.forEach((i=>{if(!e.isSourceLoaded(i))return;const r=e.querySourceFeatures(i);t=t.concat(r.filter((e=>e.properties.id)).map((e=>e.properties.id)))}));n.forEach((i=>{-1===t.indexOf(i.mapsterProperties.id)?i.remove():(!i._popup||i._popup&&!i._popup.isOpen())&&i.addTo(e)}))}))}doSymbolClustering(e,t,i,r,n,o,s,a,l){var c=[];n&&(i.cluster_by_category?i.categories_to_cluster.forEach((e=>{c.push("symbol-"+e)})):c.push("symbol"));r&&(i.cluster_by_category?i.categories_to_cluster.forEach((e=>{c.push("circle-"+e)})):c.push("circle"));this.makeClusters(e,t,i,c,o,s,a,l);return c}doPolygonAndLineClustering(e,t,i,r,n,o,s,a,l){var c=[];if("1"===window.mapster_params.activated){r&&(i.cluster_by_category?i.categories_to_cluster.forEach((e=>{c.push("fillcl-"+e)})):c.push("fillcl"));n&&(i.cluster_by_category?i.categories_to_cluster.forEach((e=>{c.push("line-"+e)})):c.push("line"));this.makeClusters(e,t,i,c,o,s,a,l);let u=!1;e.on("render",(()=>{let t=[];c.forEach((i=>{if(!e.isSourceLoaded(i))return;const r=e.querySourceFeatures(i);t=t.concat(r.filter((e=>e.properties.post_id)).map((e=>e.properties.post_id)))}));if(JSON.stringify(t)!==JSON.stringify(u)){u=t;if(r){const i=this.createLayerGeoJSON(!1,"polygon","fill",o,s,a,[]).features.filter((e=>t.indexOf(e.id)>-1));e.getSource("fill").setData({type:"FeatureCollection",features:i})}if(n){const i=this.createLayerGeoJSON(!1,"line","line",o,s,a,[]).features.filter((e=>t.indexOf(e.id)>-1));e.getSource("line").setData({type:"FeatureCollection",features:i})}}}))}return c}makeClusters(e,t,i,r,n,o,s,a){let l=[];r.forEach((t=>{e.getLayer(`${t}-cluster-count`)&&e.removeLayer(`${t}-cluster-count`);e.getLayer(`${t}-clusters`)&&e.removeLayer(`${t}-clusters`);e.getLayer(`${t}-clusters-border`)&&e.removeLayer(`${t}-clusters-border`);e.getLayer(t)&&e.removeLayer(t);if(e.getSource(t))try{e.removeSource(t)}catch(e){}if(t.indexOf("-")>-1){let e=parseInt(t.split("-")[1]);l.push(e)}}));let c="location";r.indexOf("fillcl")>-1&&(c="polygon");r.indexOf("linecl")>-1&&(c="line");r.forEach(((r,u)=>{let h,p=r.split("-")[0];if(l.length>0){let t=this.createLayerGeoJSON(e,c,p,n,o,s,l);"location"!==c&&(t=this.reduceToPoints(t));e.getSource(p)&&e.getSource(p).setData(t)}else if(e.getLayer(p)&&e.getSource(p)){e.removeLayer(p);e.removeSource(p)}if(r.indexOf("marker")>-1)h=this.createMarkerGeoJSON(n,r);else{h=this.createLayerGeoJSON(e,c,r,n,o,s,[]);"location"!==c&&(h=this.reduceToPoints(h))}a=a||[];var d=h.features.filter((e=>-1===a.indexOf(e.properties.post_id)));let f=!1;if(i.show_category_name){let e=n.concat(o.concat(s)),t=parseInt(r.split("-")[1]);e.forEach((e=>{f||(f=e.categories.find((e=>e.id===t)))}))}e.addSource(r,{type:"geojson",data:{type:"FeatureCollection",features:d}
22,cluster:!0,clusterMaxZoom:14,clusterRadius:50});if(r.indexOf("marker")>-1)e.addLayer({id:r,source:r,type:"circle",filter:["!",["has","point_count"]],paint:{"circle-radius":0}});else if(r.indexOf("fillcl")>-1)e.addLayer({id:r,source:r,type:"fill",filter:["!",["has","point_count"]],paint:{"fill-opacity":0}});else{var m=this.getLayerExpressions("location",r.indexOf("symbol")>-1?"symbol":"circle",t);e.addLayer({id:r,source:r,type:r.split("-")[0],filter:["!",["has","point_count"]],paint:m.paint,layout:m.layout})}this.addIcons(e,r,h);let _="#51bbd6",g=100,y=20,v="#f1f075",x=750,b=30,w="#f28cb1",T=40; 23if(i.image_on_cluster&&""!==i.image_on_cluster)this.addNewIcon(e,i.image_on_cluster,"cluster",(()=>{ 24}));else{e.addLayer({id:`${r}-clusters`,type:"circle",source:r,filter:["has","point_count"],paint:{"circle-stroke-width":["step",["get","point_count"],y/7,g/7,b/7,x/7,T/7],"circle-stroke-color":["step",["get","point_count"],_,g,v,x,w],"circle-stroke-opacity":.3,"circle-color":["step",["get","point_count"],_,g,v,x,w],"circle-radius":["step",["get","point_count"],y,g,b,x,T]}});e.addLayer({id:`${r}-cluster-count`,type:"symbol",source:r,filter:["has","point_count"],layout:{"text-field":f?f.name:"{point_count_abbreviated}","text-font":"mapbox"===t?["DIN Offc Pro Medium","Arial Unicode MS Bold"]:["Open Sans Regular"],"text-size":12}})}setTimeout((()=>{e.on("click",`${r}-clusters`,(t=>{const i=e.queryRenderedFeatures(t.point,{layers:[`${r}-clusters`]}),n=i[0].properties.cluster_id;e.getSource(r).getClusterExpansionZoom(n,((t,r)=>{e.easeTo({center:i[0].geometry.coordinates,zoom:r+1})}))}))}),500)}))}reduceToPoints(e){let t={type:"FeatureCollection",features:[]};e.features.forEach((e=>{t.features.push(turf.center(e,{properties:e.properties}))}));return t}makeGeocoderResult(e,t,i){var r=t.features[0];r.properties={searchableTexts:[e.data.popup?e.data.popup.header_text:"",e.data.popup?e.data.popup.body_text:"",e.title,e.content],id:e.id,place_name:e.title};"1"===window.mapster_params.activated&&i&&e.data.popup&&e.data.popup.featured_image&&(r.properties.thumbnail=e.data.popup.featured_image.url);return r}modifyDropdown(e,t){e.container.classList.add("mapster-maps-dropdown");jQuery(".mapster-maps-dropdown").find(".mapboxgl-ctrl-geocoder--icon.mapboxgl-ctrl-geocoder--icon-search").replaceWith('<svg viewBox="0 0 32 32" class="mapboxgl-ctrl-geocoder--icon mapboxgl-ctrl-geocoder--icon-search" viewBox="0 0 32 32" aria-hidden="true">\n <path d="M24 11.305l-7.997 11.39L8 11.305z"/>\n </svg>');jQuery(".mapster-maps-dropdown").find(".mapboxgl-ctrl-geocoder--input").wrap('<div class="input-wrapper"></div>');jQuery(".mapster-maps-dropdown").find(".mapboxgl-ctrl-geocoder--input").attr("disabled",!0);jQuery(".mapster-maps-dropdown").find(".mapboxgl-ctrl-geocoder--input").css("pointer-events","none");jQuery(document).on("click",".mapster-maps-dropdown .input-wrapper, .mapster-maps-dropdown .mapboxgl-ctrl-geocoder--icon-search",(()=>{e.query("");jQuery(".suggestions-wrapper .suggestions li").removeClass("active")}));jQuery(document).on("click",".mapboxgl-ctrl-geocoder--icon.mapboxgl-ctrl-geocoder--icon-close",(()=>{e.clear();jQuery(".suggestions-wrapper .suggestions").hide()}))}openExternalLink(e){e&&e.data.open_link_on_click&&e.data.click_link&&e.data.click_link.url&&DOMPurify.isValidAttribute("a","href",e.data.click_link.url)&&(e.data.click_link.open_link_
24in_new_tab?window.open(e.data.click_link.url):window.open(e.data.click_link.url,"_self"))}getMapBounds(e,t,i){var r={type:"FeatureCollection",features:[]};[["location",e],["line",t],["polygon",i]].forEach((e=>{e[1].forEach((e=>{var t=this.makeFeatureJSON(e.data);r.features.push(t.features[0])}))}));return r.features.length>0?turf.bbox(r):null}openStoreLocatorClick(e,t){e.enable&&jQuery(`.mapster-store-locator-list[data-id="${t}"]`).trigger("click",[!0])}openSidebarClick(e,t,i,r,n,o){!e.enable&&t&&this.setSidebarHTML(i,r,n,o)}openPopup(e,t,i,r,n,o,s){if(!o.enable&&!s){i&&i.remove();if(r.data.popup_style){if(!r.data.popup_style.open_as_modal_immediately){r.data.location&&"Point"===r.data.location.type&&(n=r.data.location.coordinates);let i=new t.Popup(this.returnPopupOptions(r.data)).setLngLat(n).setHTML(this.getPopupHTML(r.id,r));this.centerPopup(e,i,r);i.addTo(e);return i}this.openDirectToModal(r)}}}openDirectToModal(e){ 25}centerPopup(e,t,i){ 26}mouseIsNear(e,t,i){if(e&&e.offset()){var r=e.offset().left-t,n=e.offset().top-t,o=r+e.width()+2*t,s=n+e.height()+2*t,a=i.pageX,l=i.pageY;return a>r&&a<o&&l>n&&l<s}return!1}getDirectionsLatLng(e){let t="";e.location&&(t=e.location.coordinates[1].toString()+","+e.location.coordinates[0].toString());if(e.line){let i=turf.center(e.line);t=i.geometry.coordinates[1].toString()+","+i.geometry.coordinates[0].toString()}if(e.polygon){let i=turf.center(e.polygon);t=i.geometry.coordinates[1].toString()+","+i.geometry.coordinates[0].toString()}return t}getPopupHTML(e,t){const i=t.data;var r=this.getPopupStyle(i,t.title),n=this.returnPopupCSS(i),o=this.returnPopupLayout(i),s=this.returnPopupContent(i,t.title),a=this.returnPopupHTML(i),l="";"to-directions"===s.button_action&&(l=this.getDirectionsLatLng(i));o.enable_image&&"gallery"===s.image_type&&setTimeout((()=>{this.initializeSlider(`mapster-popup-${i.popup_style.id}`,s.images.length+1)}),400);return`\n <style>${r}</style>\n ${o.use_custom_css?`<style>${n.css_editor.replace(/#mapster-popup/g,`#mapster-popup-${i.popup_style.id}`)}</style>`:""}\n ${o.use_custom_html?this.replaceHTMLValues(a.html_editor,s,e,i):`<div id="mapster-popup-${i.popup_style.id}" class="map-popup-background ${this.sanitizeInput(o.popup_class)} mapster-feature-popup-${e}">\n ${o.enable_header?`<div class="map-popup-header">\n <h2>${s.header_text}</h2>\n </div>`:""}\n ${o.enable_image&&"feature-image"===s.image_type?'<div class="map-popup-image"></div>':""}\n ${o.enable_image&&"gallery"===s.image_type?`<div class="map-popup-gallery">\n <div id="mapster-slider" style="height : ${n.image_height}px;">\n <div class="mapster-slider-control_next">></div>\n <div class="mapster-slider-control_prev"><</div>\n <ul>\n ${s.images.map((e=>`<li style="height : ${n.image_height}px; background-image: url(${e});"> </li>`)).join(" ")}\n </ul>\n </div>\n </div>`:""}\n ${o.enable_body?`<div class="map-popup-body">\n ${i.popup.render_shortcode&&"1"===window.mapster_params.activated?`<iframe class="mapster-popup-shortcode-iframe" scrolling="no" onload="this.style.height=(this.contentDocument.getElementById('mapster-popup-shortcode-content').offsetHeight+10) + 'px';" src='${window.mapster_params.directory}../admin/includes/mapster-popup-shortcode.php?feature_id=${e}&popup_id=${i.popup_style.id}'></iframe>`:`<p>${s.body_text}</p>`}\n </div>`:""}\n ${o.enable_footer?`<div class="map-popup-footer">\n ${"do-nothing"===s.button_action?`<button class="map-popup-footer-button">${s.button_text}</button>`:""}\n ${"to-post"===s.button_action?`<button class="map-popup-footer-button" onclick="${s.open_link_in_new_tab?`window.open('${i.popup.permalink}', '_blank');`:`window.open('${i.popup.permalink}', '_self');`}">\n ${s.button_text}\n </button>`:""}\n ${"to-link"===s.button_action?`<button class="map-popup-footer-button" onclick="${s.open_link_
26in_new_tab?`window.open('${s.button_url}', '_blank');`:`window.open('${s.button_url}', '_self');`}">\n ${s.button_text}\n </button>`:""}\n ${"to-directions"===s.button_action?`<button class="map-popup-footer-button" onclick="window.open('https://www.google.com/maps/dir/?api=1&destination=${l}', '_blank');">\n ${s.button_text}\n </button>`:""}\n ${"to-modal"===s.button_action?`<button class="map-popup-footer-button mapster-button-modal-open">\n ${s.button_text}\n </button>\n <div class="mapster-modal-content-in-popup" data-title="${s.header_text?s.header_text:"Details"}"><iframe style='width: 100%; height: ${window.innerHeight-300}px;' src='${window.mapster_params.directory}../admin/includes/mapster-modal-shortcode.php?feature_id=${e}&type=modal_details'></iframe></div>`:""}\n </div>`:""}\n </div>`}\n `}getPopupStyle(e,t){var i=this.returnPopupCSS(e),r=this.returnPopupLayout(e),n=this.returnPopupContent(e,t),o=e.popup_style.id;return`\n .mapboxgl-popup .mapboxgl-popup-content, .maplibregl-popup .maplibregl-popup-content {\n padding: 0px;\n background: none;\n border: none;\n border-radius: none;\n box-shadow: none;\n }\n #mapster-popup-${o}.map-popup-background {\n background : ${i.background};\n text-align : ${i.align};\n border-radius: 3px;\n box-shadow: 0 1px 2px rgb(0 0 0 / 10%);\n }\n #mapster-popup-${o} .map-popup-header {\n background : ${i.header};\n padding: 10px;\n }\n #mapster-popup-${o} .map-popup-header h2 {\n all : revert;\n color : ${i.header_text};\n text-align : ${i.align};\n font-weight: bold;\n margin: 0;\n padding: 0;\n }\n #mapster-popup-${o} .map-popup-image {\n background-image : url("${n.featured_image?n.featured_image.url:""}");\n background-position : center center;\n background-size: cover;\n height : ${i.image_height}px;\n width: 100%;\n }\n #mapster-popup-${o} .map-popup-body {\n margin-top: -1px;\n background : ${i.body};\n padding: 10px;\n color : ${i.body_text};\n }\n #mapster-popup-${o} .map-popup-body p {\n padding: 0px;\n text-align : ${i.align};\n margin: 0px;\n }\n #mapster-popup-${o} .map-popup-footer {\n margin-top: -1px;\n background : ${i.footer};\n padding: 10px;\n }\n #mapster-popup-${o} .map-popup-footer .map-popup-footer-button {\n all : revert;\n background : ${i.button};\n border-color: ${i.button};\n color : ${i.button_text};\n padding: 5px;\n text-decoration: none;\n text-shadow: none;\n }\n #mapster-popup-${o} .map-popup-footer .map-popup-footer-button:hover {\n cursor: pointer;\n filter: brightness(1.15);\n }\n\t\t\t.mapboxgl-popup.mapboxgl-popup-anchor-top .mapboxgl-popup-tip, .maplibregl-popup.maplibregl-popup-anchor-top .maplibregl-popup-tip,\n\t\t\t.mapboxgl-popup.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip, .maplibregl-popup.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,\n\t\t\t.mapboxgl-popup.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip, .maplibregl-popup.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {\n border-bottom-color : ${i.pointer};\n display : ${r.enable_pointer?"block":"none"};\n }\n\t\t\t.mapboxgl-popup.mapboxgl-popup-anchor-right .mapboxgl-popup-tip, .maplibregl-popup.maplibregl-popup-anchor-right .maplibregl-popup-tip {\n\t\t\t\tborder-left-color : ${i.pointer};\n display : ${r.enable_pointer?"block":"none"};\n\t\t\t}\n\t\t\t.mapboxgl-popup.mapboxgl-popup-anchor-left .mapboxgl-popup-tip, .maplibregl-popup.maplibregl-popup-anchor-left .maplibregl-popup-tip {\n\t\t\t\tborder-right-color : ${i.pointer};\n display : ${r.enable_pointer?"block":"none"};\n\t\t\t}\n\t\t\t.mapboxgl-popup.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip, .maplibregl-popup.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,\n\t\t\t.mapboxgl-popup.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip, .maplibregl-popup.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,\n\t\t\t.mapboxgl-popup.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip, .maplibregl-popup.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {\n border-top-color : ${i.pointer};\n display : ${r.enable_pointer?"block":"none"};\n }\n `}sanitizeInput(e){const t={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return e?e.replace(/[&<>"'/]/gi,(e=>t[e])):""}setSidebarHTML(e,t,i,r){var n="#mapster-wp-maps-"+r;jQuery(".mapster-sidebar-popup").remove();const o=e.data;var s=jQuery(n).height(),a=(jQuery(n).width(),this.getPopupStyle(o)),l=this.returnPopupCSS(o),c=this.returnPopupLayout(o),u=this.returnPopupContent(o,e.title),h=this.returnPopupHTML(o);c.enable_image&&"gallery"===u.image_type&&setTimeout((()=>{this.initializeSlider(`mapster-sidebar-popup-${o.popup_style.id}`,u.images.length+1)}),400);jQuery(document).on("click",".mapster-sidebar-popup-exit",(()=>{jQuery(".mapster-sidebar-popup").remove()}));const p=parseFloat(t),d=parseFloat(i),f=`\n <style>${a.replace(/-popup/g,"-sidebar-popup")}</style>\n ${c.use_custom_css?`<style>${l.css_editor.replace(/#mapster-popup/g,`#mapster-popup-${o.popup_style.id}`)}</style>`:""}\n <div id="mapster-sidebar-popup-${o.popup_style.id}" class="mapster-sidebar-popup" style="min-width: ${p}px; min-height: ${s/2}px; max-height: ${s}px; max-width: ${d}px;">\n ${c.use_custom_html?this.replaceHTMLValues(h.html_editor,u,o.popup_style.id,o):`<div>\n <div class="mapster-sidebar-popup-exit">✖</div>\n ${c.enable_header?`<div class="map-sidebar-popup-header">\n <h2>${u.header_text}</h2>\n </div>`:""}\n ${c.enable_image&&"feature-image"===u.image_type?'<div class="map-sidebar-popup-image"></div>':""}\n ${c.enable_image&&"gallery"===u.image_type?`<div class="map-sidebar-popup-gallery">\n <div id="mapster-slider" style="height : ${l.image_height}px;">\n <div class="mapster-slider-control_next">></div>\n <div class="mapster-slider-control_prev"><</div>\n <ul>\n ${u.images.map((e=>`<li style="height : ${l.image_height}px; background-image: url(${e});"> </li>`)).join(" ")}\n </ul>\n </div>\n </div>`:""}\n ${c.enable_body?`<div class="map-sidebar-popup-body">\n <p>${u.body_text}</p>\n </div>`:""}\n ${c.enable_footer?`<div class="map-sidebar-popup-footer">\n ${"do-nothing"===u.button_action?`<button class="map-sidebar-popup-footer-button">${u.button_text}</button>`:""}\n ${"to-post"===u.button_action?`<button class="map-sidebar-popup-footer-button" onclick="${u.open_link_
26in_new_tab?`window.open('${o.popup.permalink}', '_blank');`:`window.open('${o.popup.permalink}', '_self');`}">\n ${u.button_text}\n </button>`:""}\n ${"to-link"===u.button_action?`<button class="map-sidebar-popup-footer-button" onclick="${u.open_link_in_new_tab?`window.open('${u.button_url}', '_blank');`:`window.open('${u.button_url}', '_self');`}">\n ${u.button_text}\n </button>`:""}\n ${"to-modal"===u.button_action?`<button class="map-sidebar-popup-footer-button mapster-button-modal-open">\n ${u.button_text}\n </button>\n <div class="mapster-modal-content-in-popup" data-title="${u.header_text?u.header_text:"Details"}">${u.modal_details}</div>`:""}\n </div>`:""}\n </div>`}\n </div>\n `;jQuery(n).append(f)}replaceHTMLValues(e,t,i,r){let n; 27return`\n <div class="mapster-feature-popup-${i}">\n ${n}\n </div>\n `}returnPopupHTML(e){return{html_editor:e.popup_style.html_editor}}returnPopupContent(e,t){return{post_title:t,header_text:e.popup.header_text,image_type:e.popup.image_type,featured_image:e.popup.featured_image,images:e.popup.images,body_text:e.popup.body_text,button_text:e.popup.button_text,button_action:e.popup.button_action,button_url:e.popup.button_url,modal_details:e.popup.modal_details,additional_details:e.additional_details,open_link_in_new_tab:e.popup.open_link_
27in_new_tab}}returnPopupLayout(e){return{enable_header:e.popup_style.enable_header,enable_image:e.popup_style.enable_image,enable_body:e.popup_style.enable_body,enable_footer:e.popup_style.enable_footer,enable_pointer:e.popup_style.enable_pointer,use_custom_css:e.popup_style.use_custom_css,use_custom_html:e.popup_style.use_custom_html,popup_class:e.popup_style.popup_class}}returnPopupOptions(e){let t={anchor:e.popup_style.popup_anchor?e.popup_style.popup_anchor:"bottom",focusAfterOpen:!1,className:"hover"===e.interaction?"mapster-hover-popup":"",closeButton:e.popup_style.close_button,closeOnClick:e.popup_style.close_on_click,closeMapMove:e.popup_style.close_on_map_move,maxWidth:e.popup_style.max_width+"px"};if("1"===window.mapster_params.activated&&e.popup_permanent){t.closeButton=!1;t.closeMapMove=!1;t.closeOnClick=!1}if(e.popup_style.popup_translate){let i=e.popup_style.popup_translate;t.offset=[-1*parseFloat(i.left_translate)+parseFloat(i.right_translate),-1*parseFloat(i.top_translate)+parseFloat(i.bottom_translate)]}return t}returnPopupCSS(e){return{background:e.popup_style.background,header:e.popup_style.header,image_height:e.popup_style.image_height,body:e.popup_style.body,footer:e.popup_style.footer,button:e.popup_style.button,pointer:e.popup_style.pointer,header_text:e.popup_style.header_text,body_text:e.popup_style.body_text,button_text:e.popup_style.button_text,align:e.popup_style.align,css_editor:e.popup_style.css_editor,max_width:e.popup_style.max_width}}getMarkerStyles(e){var t=e.data;return{color:t.marker.color,scale:parseFloat(t.marker.scale)/100,rotation:parseFloat(t.marker.rotation),anchor:t.marker.anchor}}getLayerExpressions(e,t,i){if("line"===e)return{layout:{},paint:{"line-color":["case",["boolean",["feature-state","hover"],!1],["get","hover_effects_hover_color"],["has","color"],["get","color"],"#000"],"line-opacity":["case",["boolean",["feature-state","hover"],!1],["/",["to-number",["get","hover_effects_hover_opacity"]],100],["has","opacity"],["/",["to-number",["get","opacity"]],100],1],"line-width":["case",["boolean",["feature-state","hover"],!1],["to-number",["get","hover_effects_hover_width"]],["has","width"],["to-number",["get","width"]],2],"line-dasharray":"mapbox"===i?["case",["==",!0,["to-boolean",["get","dashed_line"]]],["get","dash_properties_line_dash_array"],["literal",[1,0]]]:[1,0]}};if("polygon"===e){if("fill"===t)return{layout:{},paint:{"fill-color":["case",["boolean",["feature-state","hover"],!1],["get","hover_effects_hover_color"],["has","color"],["get","color"],"#000"],"fill-opacity":["case",["boolean",["feature-state","hover"],!1],["/",["to-number",["get","hover_effects_opacity"]],100],["has","opacity"],["/",["to-number",["get","opacity"]],100],1],"fill-outline-color":["case",["boolean",["feature-state","hover"],!1],["get","hover_effects_outline-color"],["has","outline-color"],["get","outline-color"],"rgba(0,0,0,0)"]}};if("fill-pattern"===t)return{layout:{},paint:{"fill-pattern":["case",["has","pattern"],["concat","icon-image-",["get","pattern"]],""]}};if("fill-extrusion"===t)return"1"===window.mapster_params.activated?{layout:{},paint:{"fill-extrusion-color":["case",["boolean",["feature-state","hover"],!1],["get","hover_effects_hover_color"],["has","color"],["get","color"],"#000"],"fill-extrusion-opacity":.75,"fill-extrusion-base":["case",["boolean",["feature-state","hover"],!1],["/",["to-number",["get","3d_polygon_base"]],100],["has","3d_polygon_base"],["to-number",["get","3d_polygon_base"]],0],"fill-extrusion-height":["case",["boolean",["feature-state","hover"],!1],["to-number",["get","3d_polygon_height"]],["has","3d_polygon_height"],["to-number",["get","3d_polygon_height"]],0]}}:{layout:{},paint:{}}}if("location"===e){if("circle"===t)return{layout:{},paint:{"circle-color":["case",["boolean",["feature-state","hover"],!1],["get","circle_hover_effects_hover_color"],["has","circle_color"],["get","circle_color"],"#000"],"circle-opacity":["case",["boolean",["feature-state","hover"],!1],["/",["to-number",["get","circle_hover_effects_hover_opacity"]],100],["has","circle_opacity"],["/",["to-number",["get","circle_opacity"]],100],1],"circle-radius":["interpolate",["exponential",2],["zoom"],0,["case",["all",["has","circle_circle-static-size"],["==",!0,["get","circle_circle-static-size"]]],["*",["case",["boolean",["feature-state","hover"],!1],["to-number",["get","circle_hover_effects_hover_radius"]],["has","circle_radius"],["to-number",["get","circle_radius"]],0],["^",2,-16]],["case",["boolean",["feature-state","hover"],!1],["to-number",["get","circle_hover_effects_hover_radius"]],["has","circle_radius"],["to-number",["get","circle_radius"]],0]],24,["case",["all",["has","circle_circle-static-size"],["==",!0,["get","circle_circle-static-size"]]],["*",["case",["boolean",["feature-state","hover"],!1],["to-number",["get","circle_hover_effects_hover_radius"]],["has","circle_radius"],["to-number",["get","circle_radius"]],0],["^",2,8]],["case",["boolean",["feature-state","hover"],!1],["to-number",["get","circle_hover_effects_hover_radius"]],["has","circle_radius"],["to-number",["get","circle_radius"]],0]]],"circle-stroke-width":["case",["boolean",["feature-state","hover"],!1],["to-number",["get","circle_hover_effects_hover_stroke-width"]],["has","circle_stroke-width"],["to-number",["get","circle_stroke-width"]],0],"circle-stroke-color":["case",["boolean",["feature-state","hover"],!1],["get","circle_hover_effects_hover_stroke-color"],["has","circle_stroke-color"],["get","circle_stroke-color"],"#000"],"circle-stroke-opacity":["case",["boolean",["feature-state","hover"],!1],["/",["to-number",["get","circle_hover_effects_hover_stroke-opacity"]],100],["has","circle_stroke-opacity"],["/",["to-number",["get","circle_stroke-opacity"]],100],1]}};if("symbol"===t)return{layout:{"text-field":["case",["has","label_text_properties_text-field"],["get","label_text_properties_text-field"],"New Text"],"text-font":["case",["==","Open Sans Regular",["get","label_text_properties_text-font"]],["literal",["Open Sans Regular"]],["==","Open Sans Bold",["get","label_text_properties_text-font"]],["literal",["Open Sans Bold"]],["==","Open Sans Italic",["get","label_text_properties_text-font"]],["literal",["Open Sans Italic"]],["==","Klokantech Noto Sans Regular",["get","label_text_properties_text-font"]],["literal",["Klokantech Noto Sans Regular"]],["==","Klokantech Noto Sans Bold",["get","label_text_properties_text-font"]],["literal",["Klokantech Noto Sans Bold"]],["==","Klokantech Noto Sans Italic",["get","label_text_properties_text-font"]],["literal",["Klokantech Noto Sans Italic"]],["==","Metropolis",["get","label_text_properties_text-font"]],["literal",["Metropolis"]],["==","Metropolis Bold",["get","label_text_properties_text-font"]],["literal",["Metropolis Bold"]],["==","Metropolis Regular Italic",["get","label_text_properties_text-font"]],["literal",["Metropolis Regular Italic"]],["literal",["Open Sans Regular"]]],"text-rotate":["case",["has","label_text_properties_text-rotate"],["to-number",["get","label_text_properties_text-rotate"]],0],"text-size":["case",["==",!1,["get","label_label_on"]],0,["has","label_text_properties_text-size"],["to-number",["get","label_text_properties_text-size"]],16],"icon-size":["interpolate",["exponential",2],["zoom"],1,["case",["==",!1,["get","icon_icon_on"]],0,["all",["has","icon_icon_properties_icon-static-size"],["==",!0,["get","icon_icon_properties_icon-static-size"]]],["*",["to-number",["get","icon_icon_properties_icon-size"]],["^",2,-15]],["has","icon_icon_properties_icon-size"],["/",["to-number",["get","icon_icon_properties_icon-size"]],100],1],22,["case",["==",!1,["get","icon_icon_on"]],0,["all",["has","icon_icon_properties_icon-static-size"],["==",!0,["get","icon_icon_properties_icon-static-size"]]],["*",["to-number",["get","icon_icon_properties_icon-static-size"]],["^",2,6]],["has","icon_icon_properties_icon-size"],["/",["to-number",["get","icon_icon_properties_icon-size"]],100],1]],"icon-rotate":["case",["has","icon_icon_properties_icon-rotate"],["to-number",["get","icon_icon_properties_icon-rotate"]],0],"icon-allow-overlap":!0,"icon-ignore-placement":!0,"icon-anchor":["case",["has","icon_icon_properties_icon-anchor"],["get","icon_icon_properties_icon-anchor"],"center"],"icon-offset":["case",["has","icon_icon_properties_offset_array"],["get","icon_icon_properties_offset_array"],["literal",[0,0]]],"text-offset":["case",["has","label_text_properties_offset_array"],["get","label_text_properties_offset_array"],["literal",[0,0]]],"text-allow-overlap":!0,"text-ignore-placement":!0},paint:{"text-color":["case",["has","label_text_properties_text-color"],["get","label_text_properties_text-color"],"#000000"],"text-halo-width":["case",["has","label_text_properties_text-halo-width"],["to-number",["get","label_text_properties_text-halo-width"]],1],"text-halo-color":["case",["has","label_text_properties_text-halo-color"],["get","label_text_properties_text-halo-color"],"#FFFFFF"],"text-halo-blur":["case",["has","label_text_properties_text-halo-blur"],["/",["to-number",["get","label_text_properties_text-halo-blur"]],100],1],"text-opacity":["case",["has","label_text_properties_text-opacity"],["/",["to-number",["get","label_text_properties_text-opacity"]],100],1],"icon-opacity":["case",["boolean",["feature-state","hover"],!1],["/",["to-number",["get","icon_icon_properties_hover_effects_hover_opacity"]],100],["has","icon_icon_properties_icon-opacity"],["/",["to-number",["get","icon_icon_properties_icon-opacity"]],100],1]}}}}createFillPatterns(e,t,i){if(t.getSource("fill-pattern")){t.getSource("fill-pattern").setData(i);
27this.addIcons(t,"fill-pattern",i)}else{t.addSource("fill-pattern",{type:"geojson",data:i});var r=this.getLayerExpressions("polygon","fill-pattern",e);t.addLayer({id:"fill-pattern",source:"fill-pattern",type:"fill",paint:r.paint,layout:r.layout})}}addIcons(e,t,i){t.indexOf("symbol")>-1&&i.features.forEach((i=>{if(i.properties.icon_icon_on){i.properties["icon_icon_properties_icon-image_url"]&&this.addNewIcon(e,i.properties["icon_icon_properties_icon-image_url"],i.properties["icon_icon_properties_icon-image_id"],(()=>{e.getLayer(t)&&e.setLayoutProperty(t,"icon-image",["case",["has","icon_icon_properties_icon-image_id"],["concat","icon-image-",["get","icon_icon_properties_icon-image_id"]],"none"])}));i.properties.icon_icon_properties_hover_effects_hover_image_url&&this.addNewIcon(e,i.properties.icon_icon_properties_hover_effects_hover_image_url,i.properties.icon_icon_properties_hover_effects_hover_image_id,(()=>{}))}}));t.indexOf("fill-pattern")>-1&&i.features.forEach((i=>{i.properties.pattern&&""!==i.properties.pattern&&this.addNewIcon(e,i.properties.pattern,i.properties.pattern,(()=>{e.getLayer(t)&&e.setPaintProperty(t,"fill-pattern",["case",["has","pattern"],["concat","icon-image-",["get","pattern"]],""])}))}))}addNewIcon(e,t,i,r){if(this.queuedImages.indexOf(`icon-image-${i}`)>-1)r();else{this.queuedImages.push(`icon-image-${i}`);t||r();"https:"===window.location.protocol&&t.indexOf("http://")>-1&&(t=t.replace("http","https"));var n=new Image;n.src=t;n.crossOrigin="";n.onload=function(){if(e.loaded()){e.hasImage(`icon-image-${i}`)?e.updateImage(`icon-image-${i}`,n):e.addImage(`icon-image-${i}`,n);r()}else e.once("idle",(()=>{e.hasImage(`icon-image-${i}`)?e.updateImage(`icon-image-${i}`,n):e.addImage(`icon-image-${i}`,n);r()}))}}}createLayerGeoJSON(e,t,i,r,n,o,s){var a={type:"FeatureCollection",features:[]};let l="line"===t?n:"location"===t?r:"polygon"===t?o:[],c=i.indexOf("-")>-1&&i.split("-")[1],u=i.indexOf("-")>-1?i.split("-")[0]:i;if("fill-extrusion"===i){u=i;c=!1}if("fill-pattern"===i){u=i;c=!1}"fillcl"===i&&(u="fill");"linecl"===i&&(u="line");l.forEach((r=>{if(r.data[t]&&u===this.getLayerType(t,r.data)&&(!c||r.categories.find((e=>e.id===parseFloat(c))))){let t=!1;s.length>0&&r.categories.forEach((e=>{s.indexOf(e.id)>-1&&(t=!0)}));if(!t){var n=this.makeFeatureJSON(r.data);let t=!1;if(n.features[0]){t=this.makeFeatureWithProperties(r,n.features[0]);a.features.push(t)}if(e&&r.data.open_popup_on_load&&-1===i.indexOf("-")){const t=turf.pointOnFeature(n);e.doTriggerClick({lngLat:t.geometry.coordinates},r)}}}}));return a}createMarkerGeoJSON(e,t){let i=!!t.indexOf("-")&&t.split("-")[1];var r={type:"FeatureCollection",features:[]};r.features=e.filter((e=>!i&&"marker"===e.data.location_style||!(!i||"marker"!==e.data.location_style||!e.categories.find((e=>e.id===parseFloat(i)))))).map((e=>{e.post_id=e.id;return{type:"Feature",properties:e,geometry:e.data.location}}));return r}makeFeatureWithProperties(e,t){var i=JSON.parse(JSON.stringify(t));i.id=e.id;i.properties.post_id=e.id;for(var r in e.data)-1===["polygon","line","location","popup","popup_style"].indexOf(r)&&this.assignToProperty(i,e.data,r);i.properties.dashed_line&&i.properties.dash_properties_dash_length&&(i.properties.dash_properties_line_dash_array=[parseFloat(i.properties.dash_properties_dash_length),parseFloat(i.properties.dash_properties_gap_length)]);(i.properties["label_text_properties_text-translate-x"]||i.properties["label_text_properties_text-translate-y"])&&(i.properties.label_text_properties_offset_array=[parseFloat(i.properties["label_text_properties_text-translate-x"]),parseFloat(i.properties["label_text_properties_text-translate-y"])]);(i.properties["icon_icon_properties_icon-translate-x"]||i.properties["icon_icon_properties_icon-translate-y"])&&(i.properties.icon_icon_properties_offset_array=[parseFloat(i.properties["icon_icon_properties_icon-translate-x"]),parseFloat(i.properties["icon_icon_properties_icon-translate-y"])]);return i}assignToProperty(e,t,i,r){if("object"==typeof t[i])for(var n in t[i])this.assignToProperty(e,t[i],n,r?r+"_"+i:i);else{var o=r?r+"_"+i:i;e.properties[o]=t[i]}}getLayerType(e,t){if("line"===e)return"line";if("polygon"===e){if(!t.polygon_style||"fill"===t.polygon_style)return"fill";if("fill-extrusion"===t.polygon_style)return"fill-extrusion";if("fill-pattern"===t.polygon_style)return"fill-pattern"}if("location"===e){if("circle"===t.location_style)return"circle";if("label"===t.location_style)return"symbol"}}}class MapsterCore{constructor(){}setDataLayers(){}getPostData({post_id:e,single_feature_id:t,feature_ids:i}){const r=new MapsterHelpers;let n=t?`&single_feature_id=${t}`:"",o=i?`&feature_ids=${i}`:"";return fetch(`${window.mapster_params.rest_url}mapster-wp-maps/map${window.mapster_params.qd}id=${e}${n}${o}`).then((e=>e.json())).then((e=>r.formatResponse(e)))}getFeaturesAdmin({locations_ids:e,lines_ids:t,polygons_ids:i,cats:r,custom_post_ids:n,custom_cats:o}){let s=e.concat(t.concat(i));return fetch(`${window.mapster_params.rest_url}mapster-wp-maps/features${window.mapster_params.qd}ids=${JSON.stringify(s)}&categories=${JSON.stringify(r)}&custom=${JSON.stringify(n)}&custom_cats=${JSON.stringify(o)}`).then((e=>e.json()))}sortLocations({adminFeatures:e}){return e.filter((e=>e.data.location))}sortLines({adminFeatures:e}){return e.filter((e=>e.data.line))}sortPolygons({adminFeatures:e}){return e.filter((e=>e.data.polygon))}doClustering({map:e,map_provider:t,cluster_options:i,circle_clustering:r,label_icon_clustering:n,marker_clustering:o,polygon_clustering:s,line_clustering:a,markers:l,locations:c,lines:u,polygons:h,idsToHide:p}){return(new MapsterHelpers).setClustering(e,t,i,r,n,o,s,a,l,c,u,h,p)}loadCustomScripts({map:e,javascript:t,locations:i,lines:r,polygons:n}){t&&window[t]&&(0,window[t])(e,i.concat(r.concat(n)))}setLighting({map:e,map_type:t}){let i=(new MapsterHelpers).getLighting(t);i&&e.getConfig("basemap")&&e.getConfig("basemap","lightPreset")&&e.setConfigProperty("basemap","lightPreset",i)}setMapStyle({post_id:e,map:t,map_type:i}){const r=new MapsterHelpers;"custom-image"===i.map_provider?r.setCustomImageMap(e,t,i,!0):i.custom_style_json&&""!==i.custom_style_json?t.setStyle(JSON.parse(i.custom_style_json)):t.setStyle(r.getStyle(i))}checkQuerystring({MapsterMap:e,post_id:t,map:i,markers:r,locations:n,lines:o,polygons:s}){ 28}loadProjection({map:e,map_provider:t,projection:i}){"mapbox"===t&&e.setProjection({name:i,center:[0,30],parallels:[30,30]})}loadBuildings3D({map:e,map_provider:t,buildings_3d:i}){ 29}setIPLocation({map:e,view:t}){"location"===t.initial_load&&window.mapster_params.ip&&fetch(`http://ip-api.com/json/${window.mapster_params.ip}`).then((e=>e.json())).then((i=>{"fail"!==i.status&&e.flyTo({center:[i.lon,i.lat],zoom:parseFloat(t.manual_zoom),bearing:parseFloat(t.manual_rotation),pitch:parseFloat(t.manual_pitch)})}))}loadTerrain({map:e,map_provider:t,terrain:i}){if("mapbox"===t)if(i){if(!e.getSource("mapbox-mapster-dem")){e.addSource("mapbox-mapster-dem",{type:"raster-dem",url:"mapbox://mapbox.mapbox-terrain-dem-v1",tileSize:512,maxzoom:14});e.setTerrain({source:"mapbox-mapster-dem",exaggeration:1.5});e.addLayer({id:"sky",type:"sky",paint:{"sky-type":"atmosphere","sky-atmosphere-sun":[0,0],"sky-atmosphere-sun-intensity":15}})}}else{e.getLayer("sky")&&e.removeLayer("sky");e.setTerrain(null);e.getSource("mapbox-mapster-dem")&&e.removeSource("mapbox-mapster-dem")}}layerClick({map:e,interactivity:t,clicking_disabled:i,clickedEvent:r,locations:n,lines:o,polygons:s}){if(t||!i){if(r.is3D)return r.location;let t=r.point?r.point:e.project(r.lngLat),i=e.queryRenderedFeatures(t).filter((e=>["symbol","line","fill","circle"].indexOf(e.source.split("-")[0])>-1)),a=i.sort(((t,i)=>{const n=e.project(turf.center(t).geometry.coordinates),o=e.project(turf.center(i).geometry.coordinates);return Math.hypot(n.x-r.point.x,n.y-r.point.y)-Math.hypot(o.x-r.point.x,o.y-r.point.y)}))[0];if(r.mapsterFeatureID){let e=i.find((e=>e.id===r.mapsterFeatureID));e&&(a=e)}r.mapsterFoundFeature&&(a=r.mapsterFoundFeature);return!(!a||"fill"===a.layer.id&&("fill"!==a.layer.id||0===a.layer.paint["fill-opacity"]))&&n.concat(o.concat(s)).find((e=>e.id===a.properties.post_id))}return!1}storeLocatorClick({clickedFeature:e,store_locator_options:t}){const i=new MapsterHelpers;e&&e.data.enable_popup&&("click"===e.data.interaction||i.isMobile()&&e.data.click_on_mobile)&&i.openStoreLocatorClick(t,e.id)}sidebarClick({post_id:e,clickedFeature:t,minimum_sidebar_width:i,maximum_sidebar_width:r,store_locator_options:n,open_popups_in_sidebar:o}){const s=new MapsterHelpers;t&&t.data.enable_popup&&("click"===t.data.interaction||s.isMobile()&&t.data.click_on_mobile)&&s.openSidebarClick(n,o,t,i,r,e)}externalClickLayer({clickedFeature:e}){(new MapsterHelpers).openExternalLink(e)}externalClickMarker({clickedMarker:e}){(new MapsterHelpers).openExternalLink(e)}popupClick({map:e,mapLibrary:t,clickedPopup:i,clickedFeature:r,clickedEvent:n,store_locator_options:o,open_popups_in_sidebar:s}){const a=new MapsterHelpers;if(r&&r.data.enable_popup&&("click"===r.data.interaction||a.isMobile()&&r.data.click_on_mobile))return a.openPopup(e,t,i,r,n.lngLat,o,s)}layerHover({map:e,interactivity:t,clicking_disabled:i,hoveredEvent:r,locations:n,lines:o,polygons:s}){if(t||!i){if(r.is3D)return r.location;var a=e.queryRenderedFeatures(r.point).filter((e=>["symbol","line","fill","circle"].indexOf(e.source.split("-")[0])>-1));return!(!a[0]||"fill"===a[0].layer.id&&("fill"!==a[0].layer.id||0===a[0].layer.paint["fill-opacity"]))&&n.concat(o.concat(s)).find((e=>e.id===a[0].properties.post_id))}return!1}layerHoverEffect({map:e,interactivity:t,clicking_disabled:i,hoveredFeature:r}){const n=new MapsterHelpers;n.changeCursor(e,r,"on");"1"===window.mapster_params.activated&&(!t&&i||!r||n.doHover(e,r))}popupHover({map:e,mapLibrary:t,hoveredPopup:i,hoveredFeature:r,hoveredEvent:n,store_locator_options:o}){const s=new MapsterHelpers;if(r&&r.data.enable_popup&&"hover"===r.data.interaction&&(!s.isMobile()||s.isMobile()&&r.data.click_on_mobile))return s.openPopup(e,t,i,r,n.lngLat,o);i&&i.remove()}markerClick({interactivity:e,clicking_disabled:t,clickedMarker:i}){return!(!e&&t)&&i.mapsterProperties}triggerClick({interactivity:e,clicking_disabled:t,triggeredFeature:i}){return!(!e&&t)&&i}markerHover({interactivity:e,clicking_disabled:t,hoveredMarker:i}){return!(!e&&t)&&i.mapsterProperties}triggerHover({interactivity:e,clicking_disabled:t,triggeredFeature:i}){return!(!e&&t)&&i}markerHoverEffect({map:e,mapLibrary:t,interactivity:i,clicking_disabled:r,hoveredMarker:n}){ 30}openMarkerClickPopup({map:e,mapLibrary:t,clickedMarker:i,clickedFeature:r,clickedPopup:n,store_locator_options:o,open_popups_in_sidebar:s}){const a=new MapsterHelpers;if(!o.enable&&!s&&r&&r.data.enable_popup&&("click"===r.data.interaction||a.isMobile()&&r.data.click_on_mobile)&&r.data.popup_style)if(r.data.popup_style.open_as_modal_immediately)a.openDirectToModal(r);else{const n=new t.Popup(a.returnPopupOptions(r.data));n.setHTML(a.getPopupHTML(r.id,r));a.centerPopup(e,n,r);i.setPopup(n)}}openMarkerHoverPopup({map:e,mapLibrary:t,hoveredMarker:i,hoveredFeature:r}){const n=new MapsterHelpers;if(r&&r.data.enable_popup&&"hover"===r.data.interaction&&!n.isMobile()&&r.data.popup_style&&!i.getPopup())if(r.data.popup_style.open_as_modal_immediately)n.openDirectToModal(r);else{const o=new t.Popup(n.returnPopupOptions(r.data));o.setHTML(n.getPopupHTML(r.id,r));n.centerPopup(e,o,r);i.setPopup(o).togglePopup()}}markerHoverEffectOff({tempHoverMarker:e,hoveredMarker:t}){ 31}removeMarkerHoverPopup({hoveredMarker:e}){const t=new MapsterHelpers;e&&e.mapsterProperties.data.enable_popup&&"hover"===e.mapsterProperties.data.interaction&&!t.isMobile()&&(e&&!e.mapsterProperties.data.keep_popup_open_on_hover?e.setPopup(null):e&&e.mapsterProperties.data.keep_popup_open_on_hover&&jQuery(document).on("mousemove.mapster",(function(i){let r=jQuery(`.mapster-feature-popup-${e.mapsterProperties.id}`).closest(".mapboxgl-popup");if(t.mouseIsNear(r,2,i))r.one("mouseleave",(function(){e.setPopup(null);jQuery(document).off("mousemove.mapster")}));else{e.setPopup(null);jQuery(document).off("mousemove.mapster")}})))}layerHoverEffectOff({map:e,interactivity:t,clicking_disabled:i,hoveredFeature:r}){const n=new MapsterHelpers;n.changeCursor(e,r,"off");"1"===window.mapster_params.activated&&(!t&&i||!r||n.doHoverOut(e,r))}removePopupHover({hoveredFeature:e,hoveredPopup:t}){t&&!e.data.keep_popup_open_on_hover?t.remove():t&&e.data.keep_popup_open_on_hover&&jQuery(document).one("mousemove",(function(i){let r=jQuery(`.mapster-feature-popup-${e.id}
31`).closest(".mapboxgl-popup:hover");r.length?r.one("mouseleave",(function(){t.remove()})):t.remove()}))}setInteractivity({map:e,zoom_on_scroll:t,interactivity:i,allow_rotation_and_pitch:r}){t||e.scrollZoom.disable();if(!i){e.scrollZoom.disable();e.boxZoom.disable();e.dragRotate.disable();e.dragPan.disable();e.keyboard.disable();e.doubleClickZoom.disable();e.touchZoomRotate.disable()}if(i&&!r){e.dragRotate.disable();e.setMaxPitch(0);e.touchZoomRotate.disableRotation()}}setFeaturesToMap({MapsterMap:e,map:t,map_provider:i,locations:r,lines:n,polygons:o}){const s=new MapsterHelpers;[["polygon","fill"],["polygon","fill-extrusion"],["polygon","fill-image"],["polygon","fill-pattern"],["line","line"],["location","circle"],["location","symbol"],["location","3d-model"]].forEach((a=>{var l=s.createLayerGeoJSON(e,a[0],a[1],r,n,o,[]);if("3d-model"!==a[1]&&"fill-image"!==a[1]&&"fill-pattern"!==a[1])if(t.getSource(a[1])){t.getSource(a[1]).setData(l);s.addIcons(t,a[1],l)}else{t.addSource(a[1],{type:"geojson",data:l});var c=s.getLayerExpressions(a[0],a[1],i);t.addLayer({id:a[1],source:a[1],type:a[1],paint:c.paint,layout:c.layout});s.addIcons(t,a[1],l)}else if("3d-model"===a[1])s.create3DModels(t,r);else if("fill-image"===a[1])s.createFillImages(t,o);else if("fill-pattern"===a[1]){s.createFillPatterns(i,t,l);s.addIcons(t,a[1],l)}}))}setMarkersToMap({map:e,markers:t,mapLibrary:i,locations:r,marker_clustering:n}){r.filter((e=>!e.data.location.coordinates||!e.data.location.coordinates[0]));const o=new MapsterHelpers;let s=[];t.forEach((e=>{r.find((t=>t.id===e.id))?s.push(e):e.remove()}));let a=[];a=a.concat(s);const l=r.filter((e=>"marker"===e.data.location_style));let c=[];l.sort(((e,t)=>{if(e.data.location.coordinates&&t.data.location.coordinates)return e.data.location.coordinates[1]>t.data.location.coordinates[1]?-1:1;if(!e.data.location.coordinates&&-1===c.indexOf(e.title)){alert(`A point is missing coordinates. See ${e.title}.`);c.push(e.title)}if(!t.data.location.coordinates&&-1===c.indexOf(t.title)){alert(`A point is missing coordinates. See ${t.title}.`);c.push(t.title)}}));l.forEach((t=>{if(!s.find((e=>e.mapsterProperties.id===t.id))){var r=o.getMarkerStyles(t),l=o.makeFeatureJSON(t.data).features[0].geometry.coordinates,c=new i.Marker(r).setLngLat(l);c.mapsterProperties=t;n||c.addTo(e);a.push(c);t.data.open_popup_on_load&&setTimeout((()=>{jQuery(c.getElement()).trigger("click")}),100)}}));return a}setHeatmap({map:e,mapLibrary:t,markers:i,locations:r,heatmap:n}){ 32}setMapSize({post_id:e,layout:t}){var i="#mapster-wp-maps-"+e;const r=new MapsterHelpers;if(!t.full_page){jQuery(i).height(t.height+t.height_units);jQuery(i).width(t.width+t.width_units);r.setMapBreakpointSizes(e,t)}if(t.full_page){jQuery(i).height(window.innerHeight+"px");jQuery(i).width("100%")}if(t.full_page&&t.ignore_container)if(t.map_only){let e=jQuery(".mapster-wp-maps-container").clone();jQuery("html").attr("style","margin-top : 0px !important; overflow-y: hidden;");jQuery("body").children().each((function(){jQuery(this).is("script")||jQuery(this).is("style")||jQuery(this).hide()}));jQuery("body").prepend(e)}else{jQuery(`<div id="margin-compensator" style="padding-bottom: ${window.innerHeight}px"></div>`).insertAfter(i);jQuery(i).css("marginLeft",-1*jQuery(i).offset().left+"px");jQuery(i).width(window.innerWidth+"px");jQuery(i).css("position","absolute")}}setMapMoveEndVariables({map:e}){jQuery('.acf-field[data-name="manual_pitch"]').find(".acf-label label").html(`Manual Pitch <i>(currently: ${e.getPitch()})</i>`);jQuery('.acf-field[data-name="manual_zoom"]').find(".acf-label label").html(`Manual Zoom <i>(currently: ${e.getZoom()})</i>`);jQuery('.acf-field[data-name="manual_rotation"]').find(".acf-label label").html(`Manual Rotation <i>(currently: ${e.getBearing()})</i>`);const{lng:t,lat:i}=e.getCenter();jQuery('.acf-field[data-name="manual_latitude"]').find(".acf-label label").html(`Manual Latitude <i>(currently: ${i})</i>`);jQuery('.acf-field[data-name="manual_longitude"]').find(".acf-label label").html(`Manual Longitude <i>(currently: ${t})</i>`)}setDefaultAccessToken(){""===jQuery('.acf-field[data-name="access_token"]').find(":input").val()&&jQuery('.acf-field[data-name="access_token"]').find(":input").val(window.mapster_params.mapbox_access_token)}setMapType({map_type:e}){if("mapbox"!==e.map_provider){""!==e.access_token&&(maplibregl.accessToken=e.access_token);return maplibregl}if(""!==e.access_token){mapboxgl.accessToken=e.access_token;return mapboxgl}
32window.alert(window.mapster_params.strings["Mapbox Token Warning"])}setSubmissionModal({post_id:e,map:t,mapLibrary:i,submission:r}){const n=new MapsterHelpers;jQuery(document).on("click",`#mapster-submit-${e}`,(function(){const o=jQuery(this).data("type"),s=jQuery(this).data("header");jQuery(`.mapster-submit-${e} .mapster-submission-modal-title`).text(s);jQuery(`.mapster-submit-${e} #mapster-submission-modal-overlay-${e}`).parent().detach().appendTo("body");jQuery(`.mapster-submit-${e} #mapster-submission-modal-${e}`).parent().detach().appendTo("body");r.submission_interface.categories.length>0?fetch(`${window.mapster_params.rest_url}mapster-wp-maps/submission-info${window.mapster_params.qd}categories=${r.submission_interface.categories.join(",")}`).then((e=>e.json())).then((s=>{n.loadModalSteps(e,t,i,o,s,r)})):n.loadModalSteps(e,t,i,o,!1,r)}));jQuery(document).on("click",".mapster-submission-modal-close",(function(){jQuery(".mapster-submission-modal-overlay").fadeOut(50);jQuery(".mapster-submission-modal").fadeOut(100)}))}setMap({post_id:e,mapLibrary:t,map:i,locations:r,lines:n,polygons:o}){var s="mapster-wp-maps-"+e;const a=new MapsterHelpers;let l=!0,c="manual"===i.view.initial_load?[parseFloat(i.view.manual_longitude),parseFloat(i.view.manual_latitude)]:a.getDefaultCenter();if(jQuery(`#${s}`).data("latitude")&&"null"!==jQuery(`#${s}`).data("latitude")&&jQuery(`#${s}`).data("longitude")&&"null"!==jQuery(`#${s}`).data("longitude")){c=[parseFloat(jQuery(`#${s}`).data("longitude")),parseFloat(jQuery(`#${s}`).data("latitude"))];l=!1}let u="manual"===i.view.initial_load?parseFloat(i.view.manual_zoom):a.getDefaultZoom();if(jQuery(`#${s}`).data("zoom")&&"null"!==jQuery(`#${s}`).data("zoom")){u=parseFloat(jQuery(`#${s}`).data("zoom"));l=!1}const h={renderWorldCopies:i.layout.duplicate_horizontally,style:a.getStyle(i.map_type),container:s,fitBoundsOptions:{padding:20,maxZoom:18},cooperativeGestures:i.cooperative_gestures,projection:{name:i.map_type.projection?i.map_type.projection:"mercator",center:[0,30],parallels:[30,30]},bounds:"fit-features"===i.view.initial_load&&l?a.getMapBounds(r,n,o):null,center:c,zoom:u,preserveDrawingBuffer:!!i.print_control&&i.print_control.enable,pitch:i.view.manual_pitch?parseFloat(i.view.manual_pitch):0,bearing:i.view.manual_rotation?parseFloat(i.view.manual_rotation):0,attributionControl:!1,logoPosition:i.logo_control?i.logo_control.position:"bottom-left"};let p=a.getLighting(i.map_type);p&&(h.config={basemap:{lightPreset:p}});if("1"===window.mapster_params.activated){if(i.restricted_movement.restrict_movement){let e=i.restricted_movement.allowed_bounds.southwest_longitude,t=i.restricted_movement.allowed_bounds.southwest_latitude,r=i.restricted_movement.allowed_bounds.northeast_longitude,n=i.restricted_movement.allowed_bounds.northeast_latitude;if(""!==e&&""!==t&&""!==r&&""!==n){let i=[[parseFloat(e),parseFloat(t)],[parseFloat(r),parseFloat(n)]];h.maxBounds=i}let o=i.restricted_movement.allowed_zoom.min_zoom;""!==o&&(h.minZoom=parseFloat(o));let s=i.restricted_movement.allowed_zoom.max_zoom;""!==s&&(h.maxZoom=parseFloat(s))}i.map_type.map_language&&(h.language=i.map_type.map_language);i.view.padding_around_bounds&&0!==i.view.padding_around_bounds&&(h.fitBoundsOptions.padding=parseInt(i.view.padding_around_bounds))}const d=new t.Map(h);i.map_type.custom_style_json&&""!==i.map_type.custom_style_json&&d.setStyle(JSON.parse(i.map_type.custom_style_json));"custom-image"===i.map_type.map_provider&&a.setCustomImageMap(e,d,i.map_type);i.map_compare&&i.map_compare.enable_map_slider&&i.map_compare.compared_map&&a.setMapCompare(t,d,e,i.map_compare);i.load_3d_model_libraries&&window.Threebox&&(window.tb=new window.Threebox(d,d.getCanvas().getContext("webgl"),{defaultLights:!0,enableSelectingObjects:!0}));window[`mapsterMap${e}`]=d;a.setProjectionGlobe(d,i.map_type);jQuery(".mapster-wp-maps-loader-container").hide();return d}setLoader({post_id:e,loading:t}){const i=new MapsterConstants;jQuery("#mapster-wp-maps-"+e).append(i.loaderHTML(t))}setLoaderDone({post_id:e}){jQuery("#mapster-wp-maps-"+e+" .mapster-map-loader").fadeOut()}setMapResize({map:e}){e.resize()}setStreetViewControl(){}setMapTypeControl(){}setZoomControl({map:e,mapLibrary:t,controls:i,control_menu:r,zoom_
32control:n}){const o=new MapsterHelpers;return o.addMapControl(e,i.zoomControl,n.enable,n.position,!1,o.isInControlMenu(r,"zoom_control"),t.NavigationControl)}setAttributionControl({map:e,mapLibrary:t,controls:i,attribution_control:r,map_type:n}){if("mapbox"===n.map_provider||"maplibre"===n.map_provider)return(new MapsterHelpers).addMapControl(e,i.attributionControl,!0,r.position,!1,!1,t.AttributionControl)}setControlOrder({control_order:e}){return!(!e||"1"!==window.mapster_params.activated)&&JSON.parse(e)}setControlMenu({map:e,mapLibrary:t,post_id:i,controls:r,control_menu:n}){ 33}setElevationControl({map:e,mapLibrary:t,controls:i,control_menu:r,elevation_line_chart:n,post_id:o,lines:s}){ 34}set3DControl(e){const{map:t,mapLibrary:i,control_menu:r,controls:n}=e,o=new MapsterHelpers;return o.addMapControl(t,n["3dControl"],e["3d_control"].enable,e["3d_control"].position,!1,o.isInControlMenu(r,"3d_control"),PitchToggle)}setScaleControl({map:e,mapLibrary:t,controls:i,control_menu:r,scale_control:n}){const o=new MapsterHelpers;return o.addMapControl(e,i.scaleControl,n.enable,n.position,!1,o.isInControlMenu(r,"scale_control"),t.ScaleControl)}setPrintControl({map:e,mapLibrary:t,controls:i,control_menu:r,print_control:n}){const o=new MapsterHelpers;return!!n&&o.addMapControl(e,i.printControl,n.enable,n.position,!1,o.isInControlMenu(r,"print_control"),PrintControl)}setGeolocationControl({map:e,mapLibrary:t,controls:i,control_menu:r,geolocation_control:n}){const o=new MapsterHelpers,s={showAccuracyCircle:n.show_accuracy_circle,showUserHeading:n.show_user_heading,trackUserLocation:n.show_user_heading||n.track_user_location};"1"===window.mapster_params.activated&&n.enable_high_accuracy&&(s.positionOptions={enableHighAccuracy:!0,maximumAge:0,timeout:5e3});const a=o.addMapControl(e,i.geolocationControl,n.enable,n.position,!1,o.isInControlMenu(r,"geolocation_control"),t.GeolocateControl,s);o.setGeolocationOnLoad(n);return a}setFullscreenControl({map:e,mapLibrary:t,controls:i,control_menu:r,fullscreen_control:n}){const o=new MapsterHelpers;return o.addMapControl(e,i.fullscreenControl,n.enable,n.position,!1,o.isInControlMenu(r,"fullscreen_control"),t.FullscreenControl)}setGeocoderControl({map:e,mapLibrary:t,controls:i,control_menu:r,geocoder_control:n}){const o=new MapsterHelpers;if("undefined"!=typeof MapboxGeocoder){var s={accessToken:t.accessToken,mapboxgl:t,placeholder:n.placeholder};""!==n.limit_results&&(s.countries=n.limit_results);n.marker_color&&""!==n.marker_color&&(s.marker={color:n.marker_color});if(n.accept_latlngs){ 35}if(n.limit_by_bounds&&"1"===window.mapster_params.activated){let e=n.bounds_limit.southwest_longitude,t=n.bounds_limit.southwest_latitude,i=n.bounds_limit.northeast_longitude,r=n.bounds_limit.northeast_latitude;if(""!==e&&""!==t&&""!==i&&""!==r){let n=[parseFloat(e),parseFloat(t),parseFloat(i),parseFloat(r)];s.bbox=n}}return o.addMapControl(e,i.geocoderControl,n.enable,n.position,!1,o.isInControlMenu(r,"geocoder_control"),MapboxGeocoder,s)}}setDirectionsControl({map:e,mapLibrary:t,controls:i,control_menu:r,directions_control:n}){if("undefined"!=typeof MapboxDirections){const s=new MapsterHelpers;var o={accessToken:t.accessToken,mapboxgl:t,unit:n.unit,profile:n.profile,interactive:!1,placeholderOrigin:n.placeholderOrigin};return s.addMapControl(e,i.directionsControl,n.enable,n.position,!1,s.isInControlMenu(r,"directions_control"),MapboxDirections,o)}}setSearchBoxControl({map:e,mapLibrary:t,controls:i,control_menu:r,searchbox_control:n,post_id:o}){const s=new MapsterHelpers;if(n&&"undefined"!=typeof MapsterSearchBoxControl){const a={post_id:o,mapLibrary:t,accessToken:t.accessToken,position:n.position};return s.addMapControl(e,i.searchBoxControl,n.enable,n.position,!1,s.isInControlMenu(r,"searchbox_control"),MapsterSearchBoxControl,a)}}setCustomSearchFilterControl({map:e,mapLibrary:t,controls:i,control_menu:r,custom_search_filter:n,locations:o,lines:s,polygons:a,markers:l,open_popups_in_sidebar:c}){const u=new MapsterHelpers;if("undefined"!=typeof MapboxGeocoder){var h={mapboxgl:t,marker:!1,flyTo:!1,placeholder:n.placeholder};n.include_geocoder?h.accessToken=t.accessToken:h.localGeocoderOnly=!0;""!==n.limit_results&&(h.countries=n.limit_results);if(n.limit_by_bounds&&"1"===window.mapster_params.activated){let e=n.bounds_limit.southwest_longitude,t=n.bounds_limit.southwest_latitude,i=n.bounds_limit.northeast_longitude,r=n.bounds_limit.northeast_latitude;if(""!==e&&""!==t&&""!==i&&""!==r){let n=[parseFloat(e),parseFloat(t),parseFloat(i),parseFloat(r)];h.bbox=n}}(h=u.applyProSearchFilter(n,h)).localGeocoder=e=>u.searchLocalFeatures(n.search_type,e,o,s,a);const p=u.addMapControl(e,i.customSearchControl,n.enable,n.position,!1,u.isInControlMenu(r,"custom_search_filter"),MapboxGeocoder,h);if(p){p.on("result",(({result:i})=>{const r=l.find((e=>e.mapsterProperties.id===i.id)),n=o.find((e=>e.id===i.id));let s={};i.bbox?s={bounds:i.bbox}:i.center&&(s={center:i.center,zoom:15});"1"===window.mapster_params.activated&&(r&&r.mapsterProperties.data.default_zoom_level?s.zoom=r.mapsterProperties.data.default_zoom_level:n&&n.data.default_zoom_level&&(s.zoom=n.data.default_zoom_level));s.bounds?e.fitBounds(s.bounds):e.flyTo(s);var a=document.createElement("div");a.innerHTML=i.place_name;jQuery(p._inputEl).val(a.innerHTML);r&&r.mapsterProperties.data.enable_popup&&!c&&r.setPopup(new t.Popup(u.returnPopupOptions(r.mapsterProperties.data)).setHTML(u.getPopupHTML(r.mapsterProperties.id,r.mapsterProperties))).togglePopup()}));return p}}}setFilterDropdownControl({MapsterMap:e,map:t,mapLibrary:i,controls:r,control_menu:n,filter_dropdown:o,locations:s,lines:a,polygons:l,markers:c}){const u=new MapsterHelpers;if("undefined"!=typeof MapboxGeocoder){var h={mapboxgl:i,localGeocoderOnly:!0,marker:!1,placeholder:o.placeholder,minLength:0,limit:1e3,flyTo:!1,localGeocoder:e=>u.searchLocalFeatures("exact-match",e,s,a,l,o.display_images)};const p=u.addMapControl(t,r.filterDropdownControl,o.enable,o.position,!1,u.isInControlMenu(n,"filter_dropdown"),MapboxGeocoder,h);if(p){o.enable&&u.modifyDropdown(p,s);p.on("result",(({result:i})=>{const r=c.find((e=>e.mapsterProperties.id===i.id)),n=s.find((e=>e.id===i.id));let o={};i.bbox?o={bounds:i.bbox}:i.center&&(o={center:i.center});"1"===window.mapster_params.activated&&(r&&r.mapsterProperties.data.default_zoom_level?o.zoom=r.mapsterProperties.data.default_zoom_level:n&&n.data.default_zoom_level&&(o.zoom=n.data.default_zoom_level));o.bounds?t.fitBounds(o.bounds,{padding:20}):t.flyTo(o);if(r&&r.mapsterProperties.data.enable_popup){if("click"===r.mapsterProperties.data.interaction)r.getElement().click();else if("hover"===r.mapsterProperties.data.interaction){const e=new Event("mouseenter");r.getElement().dispatchEvent(e)}}else n&&n.data.enable_popup&&("click"===n.data.interaction?e.doTriggerClick({lngLat:n.data.location.coordinates},n):"hover"===n.data.interaction&&e.doTriggerHover({lngLat:n.data.location.coordinates},n))}))}return p}}setCategoryFilterControl({map:e,mapLibrary:t,post_id:i,controls:r,control_menu:n,cluster_options:o,category_filter:s,markers:a,dataLayers:l,locations:c,lines:u,polygons:h,map_provider:p,label_icon_clustering:d,circle_clustering:f,marker_clustering:m,polygon_clustering:_,line_clustering:g}){const y=new MapsterHelpers,v={post_id:i,functionality:s.functionality,independent_children:s.independent_children,initial_visibility:s.initial_visibility,category_order:s.category_order,category_display:s.category_display,checkbox_display:s.checkbox_display,reset_button:s.reset_button,pre_selected_categories:s.pre_selected_categories,additional_filters:s.additional_filters,accordion_layout:s.accordion_layout,excluded_categories:s.excluded_categories,show_number_of_features:s.show_number_of_features,parent_cat_display:s.parent_cat_display,cluster_options:o,markers:a,dataLayers:l,locations:c,lines:u,polygons:h,map_provider:p,circle_clustering:f,label_icon_clustering:d,marker_clustering:m,polygon_clustering:_,line_clustering:g};return y.addMapControl(e,r.categoryFilterControl,s.enable,s.position,s.render_in_external_div,y.isInControlMenu(n,"category_filter"),CategoryControl,v)}setListControl({MapsterMap:e,map:t,mapLibrary:i,post_id:r,controls:n,control_menu:o,list:s,locations:a,lines:l,polygons:c,markers:u}){const h=new MapsterHelpers,p={MapsterMap:e,post_id:r,sort_by_distance:s.sort_by_distance,show_distance:s.show_distance,units:s.units,group_by_category:s.group_by_category,list_order:s.list_order,listing_type:s.listing_type,display_images:s.display_images,number_of_locations:s.number_of_locations,store_locator_options:s.store_locator_options,locations:a,lines:l,polygons:c,markers:u,mapLibrary:i};return h.addMapControl(t,n.listControl,s.enable,s.position,s.render_in_external_div,h.isInControlMenu(o,"list"),ListControl,p)}setDownloadControl({map:e,mapLibrary:t,post_id:i,controls:r,control_menu:n,download_control:o,locations:s,lines:a,polygons:l}){ 36}setCustomHTMLControl({map:e,mapLibrary:t,controls:i,control_menu:r,custom_html_control:n}){ 37}setLayerControl({map:e,mapLibrary:t,post_id:i,controls:r,control_menu:n,layer_control:o}){ 38}setStyleControl({map:e,mapLibrary:t,post_id:i,controls:r,control_menu:n,style_control:o,map_type:s}){ 39}autoAnimateGlobe({map:e,globe_animation:t,globe_animation_speed:i,globe_animation_direction:r}){ 40}setListingPosts({MapsterMap:e,post_id:t,map:i,listing_page:r,locations:n,lines:o,polygons:s,markers:a}){ 41}setJqueryEvents(){ 42}destroyMap({post_id:e,mapLibrary:t,map:i}){if(i){i.remove();jQuery(`#mapster-wp-maps-${e}`).empty()}}}
42class MapsterContainer{constructor(e,t,i,r){this.core={};this.MapsterMap=r;this.post_id=e;this.single_feature_id=t;this.feature_ids=i;this.postResponse;this.mapLibrary;this.markers=[];this.controls=[];this.clusterLayers=[];this.triggeredFeature;this.clickedEvent;this.clickedFeature;this.clickedPopup;this.clickedMarker;this.hoveredEvent;this.hoveredFeature;this.hoveredPopup;this.hoveredMarker;this.tempHoverMarker;this.map;this.postResponseAdmin;this.adminFeatures;this.controlOrder;this.dataLayers;this.defineCore()}defineCore(){const e=new MapsterCore;this.core.set_accesstokendefault={args:[],hook:"access_token_set",func:e.setDefaultAccessToken};this.core.define_postResponse={args:["post_id","single_feature_id","feature_ids"],hook:"data_fetched",func:e.getPostData,promise:!0};this.core.set_mapSize={args:["post_id","postResponse.map.layout"],hook:"map_size_set",func:e.setMapSize};this.core.define_mapLibrary={args:["postResponse.map.map_type"],hook:"map_library_set",func:e.setMapType};this.core.set_submissionModal={args:["post_id","map","mapLibrary","postResponse.map.submission"],hook:"submission_modal_initialized",func:e.setSubmissionModal};this.core.define_map={args:["post_id","mapLibrary","postResponse.map","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"map_set",func:e.setMap};this.core.destroy_map={args:["post_id","mapLibrary","map"],hook:"map_destroy",func:e.destroyMap};this.core.set_moveendVariables={args:["map"],hook:"map_moveend",func:e.setMapMoveEndVariables};this.core.set_jquery_events={args:[],hook:"jquery_events_set",func:e.setJqueryEvents};this.core.set_loader={args:["post_id","postResponse.map.loading"],hook:"loading_icon_started",func:e.setLoader};this.core.set_loaderdone={args:["post_id"],hook:"loading_icon_done",func:e.setLoaderDone};this.core.set_mapresize={args:["map"],hook:"map_resize_set",func:e.setMapResize};this.core.set_ipload={args:["map","postResponse.map.view"],hook:"map_set_ip_on_load",func:e.setIPLocation};this.core.set_querystringLoad={args:["MapsterMap","post_id","map","markers","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"check_querystring",func:e.checkQuerystring};this.core.set_listingposts={args:["MapsterMap","post_id","map","postResponse.map.listing_page","postResponse.locations","postResponse.lines","postResponse.polygons","markers"],hook:"map_set_listing_posts",func:e.setListingPosts};this.core.define_dataLayers={args:["map","postResponse.map.map_type.map_provider","dataLayers","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"map_datalayers_set",func:e.setDataLayers,callback:this.MapsterMap.setDataLayerEvents};this.core.set_mapfeatures={args:["MapsterMap","map","postResponse.map.map_type.map_provider","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"map_features_set",func:e.setFeaturesToMap,callback:this.MapsterMap.setLayerEvents};this.core.define_markers={args:["map","markers","mapLibrary","postResponse.locations","postResponse.map.marker_clustering"],hook:"map_markers_set",func:e.setMarkersToMap,callback:this.MapsterMap.setMarkerEvents};this.core.set_heatmap={args:["map","markers","postResponse.locations","postResponse.map.heatmap"],hook:"map_heatmap_set",func:e.setHeatmap};this.core.define_controlOrder={args:["postResponse.map.control_order"],hook:"control_order_set",func:e.setControlOrder};this.core["define_controls.controlMenu"]={args:["map","mapLibrary","post_id","controls","postResponse.map.control_menu"],hook:"control_menu_set",func:e.setControlMenu};this.core["define_controls.elevationControl"]={args:["map","mapLibrary","post_id","controls","postResponse.map.control_menu","postResponse.map.elevation_line_chart","post_id","postResponse.lines"],hook:"elevation_control_set",func:e.setElevationControl};this.core["define_controls.zoomControl"]={args:["map","mapLibrary","controls","postResponse.map.control_menu","postResponse.map.zoom_control"],hook:"zoom_control_set",func:e.setZoomControl};this.core["define_controls.attributionControl"]={args:["map","mapLibrary","controls","postResponse.map.attribution_control","postResponse.map.map_type"],hook:"attribution_control_set",func:e.setAttributionControl};this.core["define_controls.streetViewControl"]={args:["map","mapLibrary","controls","postResponse.map.street_view_control"],hook:"street_view_control_set",func:e.setStreetViewControl};this.core["define_controls.mapTypeControl"]={args:["map","mapLibrary","controls","postResponse.map.map_type_control"],hook:"map_type_control_set",func:e.setMapTypeControl};this.core["define_controls.geocoderControl"]={args:["map","mapLibrary","controls","postResponse.map.control_menu","postResponse.map.geocoder_control"],hook:"geocoder_control_set",func:e.setGeocoderControl};this.core["define_controls.searchBoxControl"]={args:["map","mapLibrary","post_id","controls","postResponse.map.control_menu","postResponse.map.searchbox_control"],hook:"geocoder_control_set",func:e.setSearchBoxControl};this.core["define_controls.directionsControl"]={args:["map","mapLibrary","controls","postResponse.map.control_menu","postResponse.map.directions_control"],hook:"directions_control_set",func:e.setDirectionsControl};this.core["define_controls.3dControl"]={args:["map","mapLibrary","controls","postResponse.map.control_menu","postResponse.map.3d_control"],hook:"3d_control_set",func:e.set3DControl};this.core["define_controls.scaleControl"]={args:["map","mapLibrary","controls","postResponse.map.control_menu","postResponse.map.scale_control"],hook:"scale_control_set",func:e.setScaleControl};this.core["define_controls.printControl"]={args:["map","mapLibrary","controls","postResponse.map.control_menu","postResponse.map.print_control"],hook:"print_control_set",func:e.setPrintControl};this.core["define_controls.geolocationControl"]={args:["map","mapLibrary","controls","postResponse.map.control_menu","postResponse.map.geolocation_control"],hook:"geolocation_control_set",func:e.setGeolocationControl};this.core["define_controls.fullscreenControl"]={args:["map","mapLibrary","controls","postResponse.map.control_menu","postResponse.map.fullscreen_control"],hook:"fullscreen_control_set",func:e.setFullscreenControl};this.core["define_controls.downloadControl"]={args:["map","mapLibrary","post_id","controls","postResponse.map.control_menu","postResponse.map.download_control","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"download_control_set",func:e.setDownloadControl};this.core["define_controls.customHTMLControl"]={args:["map","mapLibrary","controls","postResponse.map.control_menu","postResponse.map.custom_html_control"],hook:"custom_html_control_set",func:e.setCustomHTMLControl};this.core["define_controls.layerControl"]={args:["map","mapLibrary","post_id","controls","postResponse.map.control_menu","postResponse.map.layer_control"],hook:"layer_control_set",func:e.setLayerControl};this.core["define_controls.styleControl"]={args:["map","mapLibrary","post_id","controls","postResponse.map.control_menu","postResponse.map.style_control","postResponse.map.map_type"],hook:"style_control_set",func:e.setStyleControl};this.core["define_controls.customSearchControl"]={args:["map","mapLibrary","controls","postResponse.map.control_menu","postResponse.map.filter.custom_search_filter","postResponse.locations","postResponse.lines","postResponse.polygons","markers","postResponse.map.open_popups_in_sidebar"],hook:"customSearch_control_set",func:e.setCustomSearchFilterControl};this.core["define_controls.filterDropdownControl"]={args:["MapsterMap","map","mapLibrary","controls","postResponse.map.control_menu","postResponse.map.filter.filter_dropdown","postResponse.locations","postResponse.lines","postResponse.polygons","markers"],hook:"filterDropdown_control_set",func:e.setFilterDropdownControl};this.core["define_controls.categoryFilterControl"]={args:["map","mapLibrary","post_id","controls","postResponse.map.control_menu","postResponse.map.cluster_options","postResponse.map.filter.category_filter","markers","dataLayers","postResponse.locations","postResponse.lines","postResponse.polygons","postResponse.map.map_type.map_provider","postResponse.map.circle_clustering","postResponse.map.label_icon_clustering","postResponse.map.marker_clustering","postResponse.map.polygon_clustering","postResponse.map.line_clustering"],hook:"categoryFilter_control_set",func:e.setCategoryFilterControl};this.core["define_controls.listControl"]={args:["MapsterMap","map","mapLibrary","post_id","controls","postResponse.map.control_menu","postResponse.map.list","postResponse.locations","postResponse.lines","postResponse.polygons","markers"],hook:"list_control_set",func:e.setListControl};this.core.set_autoanimate={args:["map","postResponse.map.view.globe_animation","postResponse.map.view.globe_animation_speed","postResponse.map.view.globe_animation_direction"],hook:"globe_autoanimate_set",func:e.autoAnimateGlobe};this.core.define_clusterLayers={args:["map","postResponse.map.map_type.map_provider","postResponse.map.cluster_options","postResponse.map.circle_clustering","postResponse.map.label_icon_clustering","postResponse.map.marker_clustering","postResponse.map.polygon_clustering","postResponse.map.line_clustering","markers","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"map_clustering_set",func:e.doClustering,callback:this.MapsterMap.setDynamicLayerEvents};this.core.set_customscripts={args:["map","postResponse.map.javascript","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"custom_scripts_set",func:e.loadCustomScripts};this.core.set_interactivity={args:["map","postResponse.map.zoom_on_scroll","postResponse.map.interactivity","postResponse.map.allow_rotation_and_pitch"],hook:"interactivity_set",func:e.setInteractivity};this.core.set_mapstyle={args:["post_id","map","postResponse.map.map_type"],hook:"map_style_set",func:e.setMapStyle,callback:this.MapsterMap.idleReload};this.core.set_lighting={args:["map","postResponse.map.map_type"],hook:"map_lighting_set",func:e.setLighting};this.core.set_terrain={args:["map","postResponse.map.map_type.map_provider","postResponse.map.map_type.terrain"],hook:"map_terrain_set",func:e.loadTerrain};this.core.set_buildings3d={args:["map","postResponse.map.map_type.map_provider","postResponse.map.map_type.buildings_3d"],hook:"map_buildings3d_set",func:e.loadBuildings3D};this.core.set_projection={args:["map","postResponse.map.map_type.map_provider","postResponse.map.map_type.projection"],hook:"map_projection_set",func:e.loadProjection};this.core.define_clickedFeature={args:["map","postResponse.map.interactivity","postResponse.map.clicking_disabled","clickedEvent","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"layer_feature_clicked",func:e.layerClick};this.core.set_storelocatorclick={args:["clickedFeature","postResponse.map.list.store_locator_options"],hook:"",func:e.storeLocatorClick};this.core.set_sidebarclick={args:["post_id","clickedFeature","postResponse.map.minimum_sidebar_width","postResponse.map.maximum_sidebar_width","postResponse.map.list.store_locator_options","postResponse.map.open_popups_in_sidebar"],hook:"",func:e.sidebarClick}
42;this.core.define_clickedPopup={args:["map","mapLibrary","clickedPopup","clickedFeature","clickedEvent","postResponse.map.list.store_locator_options","postResponse.map.open_popups_in_sidebar"],hook:"popup_opened_from_layer_click",func:e.popupClick};this.core.define_hoveredFeature={args:["map","postResponse.map.interactivity","postResponse.map.clicking_disabled","hoveredEvent","postResponse.locations","postResponse.lines","postResponse.polygons"],hook:"layer_feature_hovered",func:e.layerHover};this.core.set_hoverEffects={args:["map","postResponse.map.interactivity","postResponse.map.clicking_disabled","hoveredFeature","dataLayers"],hook:"",func:e.layerHoverEffect};this.core.define_hoveredPopup={args:["map","mapLibrary","hoveredPopup","hoveredFeature","hoveredEvent","postResponse.map.list.store_locator_options","postResponse.map.open_popups_in_sidebar"],hook:"popup_opened_from_layer_hover",func:e.popupHover};this.core.set_hoverEffectsOff={args:["map","postResponse.map.interactivity","postResponse.map.clicking_disabled","hoveredFeature","dataLayers"],hook:"",func:e.layerHoverEffectOff};this.core.set_hoveredPopupOff={args:["hoveredFeature","hoveredPopup"],hook:"popup_closed_from_layer_hover",func:e.removePopupHover};this.core.set_externallink={args:["clickedFeature"],hook:"external_link_opened",func:e.externalClickLayer};this.core.define_clickedFeature_fromTrigger={args:["triggeredFeature","postResponse.map.interactivity","postResponse.map.clicking_disabled"],hook:"triggered_feature_clicked",func:e.triggerClick};this.core.define_clickedFeature_fromMarker={args:["clickedMarker","postResponse.map.interactivity","postResponse.map.clicking_disabled"],hook:"marker_feature_clicked",func:e.markerClick};this.core.define_hoveredFeature_fromTrigger={args:["triggeredFeature","postResponse.map.interactivity","postResponse.map.clicking_disabled"],hook:"triggered_feature_hovered",func:e.triggerHover};this.core.define_hoveredFeature_fromMarker={args:["hoveredMarker","postResponse.map.interactivity","postResponse.map.clicking_disabled"],hook:"marker_feature_hovered",func:e.markerHover};this.core.define_tempHoverMarker={args:["map","mapLibrary","postResponse.map.interactivity","postResponse.map.clicking_disabled","hoveredMarker"],hook:"",func:e.markerHoverEffect};this.core.define_clickedPopup_fromMarker={args:["map","mapLibrary","clickedMarker","clickedFeature","clickedPopup","postResponse.map.list.store_locator_options","postResponse.map.open_popups_in_sidebar"],hook:"popup_opened_from_marker_click",func:e.openMarkerClickPopup};this.core.define_hoveredPopup_fromMarker={args:["map","mapLibrary","hoveredMarker","hoveredFeature","hoveredPopup","postResponse.map.list.store_locator_options","postResponse.map.open_popups_in_sidebar"],hook:"popup_opened_from_marker_hover",func:e.openMarkerHoverPopup};this.core.set_hoverEffectsOff_fromMarker={args:["tempHoverMarker","hoveredMarker"],hook:"",func:e.markerHoverEffectOff};this.core.set_hoveredPopupOff_fromMarker={args:["hoveredMarker","hoveredFeature","hoveredPopup"],hook:"popup_closed_from_marker_hover",func:e.removeMarkerHoverPopup};this.core.define_adminFeatures={args:["postResponseAdmin.locations_ids","postResponseAdmin.lines_ids","postResponseAdmin.polygons_ids","postResponse.cats","postResponseAdmin.custom_post_ids","postResponseAdmin.custom_cats"],hook:"",func:e.getFeaturesAdmin,promise:!0};this.core["define_postResponse.locations"]={args:["adminFeatures"],hook:"locations_fetched",func:e.sortLocations};this.core["define_postResponse.lines"]={args:["adminFeatures"],hook:"lines_fetched",func:e.sortLines};this.core["define_postResponse.polygons"]={args:["adminFeatures"],hook:"polygons_fetched",func:e.sortPolygons}}doCore(e){let t=this.core[e].args,i=this.core[e].func,r={};for(var n=0;n<t.length;n++){let e=t[n].split(".");r[e[e.length-1]]=this.getObjectProperty(this,t[n])}if(this.core[e].promise)return Promise.resolve(i(r)).then((t=>{this.defineThisObject(e,t);this.core[e].callback&&this.core[e].callback(this,this.MapsterMap);this.core[e].hook&&this.MapsterMap.runHookActions(e,t)}));{const t=i(r);this.defineThisObject(e,t);this.core[e].callback&&this.core[e].callback(this,this.MapsterMap);this.core[e].hook&&this.MapsterMap.runHookActions(e,t);return t}}registerListener(e,t,i,r){this.setStarterValue(e,t,i);jQuery(document).on("change","select"!==t?e:e.replace("select",":input"),(()=>{"check"===t&&this.setObjectProperty(this,i,jQuery(e).is(":checked"));"val"===t&&this.setObjectProperty(this,i,jQuery(e).val());"select"===t&&this.setObjectProperty(this,i,jQuery(e).select2("data").map((e=>e.id)));if(r&&r.length>0)for(var n=0;n<r.length;n++){if(this.core[r[n]].promise){this.MapsterMap.doCoreAndRunActions(r[n]).then((()=>{for(var e=n+1;e<r.length;e++)this.MapsterMap.doCoreAndRunActions(r[e])}));break}this.MapsterMap.doCoreAndRunActions(r[n])}}))}setStarterValue(e,t,i){"check"===t&&this.setObjectProperty(this,i,jQuery(e).is(":checked"));"val"===t&&this.setObjectProperty(this,i,jQuery(e).val());"img"===t&&this.setObjectProperty(this,i,jQuery(e).find("img").attr("src"));"select"===t&&this.setObjectProperty(this,i,jQuery(e).select2("data").map((e=>e.id)))}defineThisObject(e,t){e.indexOf("define_")>-1&&this.setObjectProperty(this,e.split("_")[1],t)}getObjectProperty(e,t){return t.split(".").reduce(((e,t)=>e?.[t]),e)}setObjectProperty(e,t,i){t.split(".").reduce(((e,r)=>{r===t.split(".")[t.split(".").length-1]&&(e[r]=i);void 0===e[r]&&(r===t.split(".")[t.split(".").length-1]?e[r]="":e[r]={});return e?.[r]}),e)}getControlOrder(){return this.controlOrder}}class MapsterMap{constructor(e,t,i,r){this.MapsterContainer=new MapsterContainer(e,i,r,this);this.post_id=e;this.isPublic=t;this.dynamicLayerListenersSet=!1;this.isPublic||this.registerAdminEventListeners()}preInitMap(){return this.isPublic?this.doCoreAndRunActions("define_postResponse"):this.doCoreAndRunActions("define_adminFeatures")}destroy(){this.doCoreAndRunActions("destroy_map")}init(){this.preInitMap().then((()=>
42{if(!this.isPublic){this.doCoreAndRunActions("set_accesstokendefault");this.doCoreAndRunActions("define_postResponse.locations");this.doCoreAndRunActions("define_postResponse.lines");this.doCoreAndRunActions("define_postResponse.polygons")}this.initMap();this.MapsterContainer.map.on("load",(()=>{this.postLoad();this.setMoveEvents(this.MapsterContainer.map)}));this.MapsterContainer.map.on("mapster_custom_style_load",(()=>{this.postStyleSwitch(this.MapsterContainer,this)}))}))}initMap(){this.isPublic&&this.doCoreAndRunActions("set_mapSize");this.doCoreAndRunActions("define_mapLibrary");this.doCoreAndRunActions("define_map");this.doCoreAndRunActions("set_jquery_events");this.doCoreAndRunActions("set_loader");if(this.isPublic){this.doCoreAndRunActions("set_submissionModal");this.doCoreAndRunActions("set_interactivity")}}postLoad(){this.doCoreAndRunActions("set_mapresize");this.doCoreAndRunActions("set_terrain");this.doCoreAndRunActions("set_buildings3d");this.doCoreAndRunActions("set_mapfeatures");this.doCoreAndRunActions("define_dataLayers");this.doCoreAndRunActions("define_markers");this.doCoreAndRunActions("set_heatmap");setTimeout((()=>{this.doCoreAndRunActions("set_autoanimate")}),1e3);this.doCoreAndRunActions("set_listingposts");this.setControls();if(this.isPublic){this.doCoreAndRunActions("set_ipload");this.doCoreAndRunActions("define_clusterLayers");this.doCoreAndRunActions("set_querystringLoad")}this.doCoreAndRunActions("set_loaderdone");this.doCoreAndRunActions("set_customscripts")}setControls(){this.doCoreAndRunActions("define_controlOrder");this.doCoreAndRunActions("define_controls.controlMenu");let e=this.getControlOrder(),t=[],i=[{slug:"zoom_control",function:"zoomControl"},{slug:"map_type_control",function:"mapTypeControl"},{slug:"street_view_control",function:"streetViewControl"},{slug:"attribution_control",function:"attributionControl"},{slug:"geocoder_control",function:"geocoderControl"},{slug:"searchbox_control",function:"searchBoxControl"},{slug:"directions_control",function:"directionsControl"},{slug:"3d_control",function:"3dControl"},{slug:"scale_control",function:"scaleControl"},{slug:"print_control",function:"printControl"},{slug:"geolocation_control",function:"geolocationControl"},{slug:"fullscreen_control",function:"fullscreenControl"},{slug:"download_control",function:"downloadControl"},{slug:"custom_html_control",function:"customHTMLControl"},{slug:"layer_control",function:"layerControl"},{slug:"style_control",function:"styleControl"},{slug:"custom_search_filter",function:"customSearchControl"},{slug:"filter_dropdown",function:"filterDropdownControl"},{slug:"category_filter",function:"categoryFilterControl"},{slug:"elevation_line_chart",function:"elevationControl"},{slug:"list",function:"listControl"}];if(e){e.forEach((e=>{let r=i.find((t=>t.slug===e.slug));r&&t.push(r)}));i.forEach((e=>{t.find((t=>t.slug===e.slug))||t.push(e)}))}else t=i;t.forEach((e=>{this.doCoreAndRunActions(`define_controls.${e.function}`)}))}idleReload(e,t){e.map.once("idle",(()=>{t.doCoreAndRunActions("set_loader");t.doCoreAndRunActions("set_lighting");t.doCoreAndRunActions("set_terrain");t.doCoreAndRunActions("set_mapfeatures");t.doCoreAndRunActions("define_dataLayers");t.doCoreAndRunActions("define_markers");t.doCoreAndRunActions("define_clusterLayers");t.doCoreAndRunActions("set_loaderdone")}))}postStyleSwitch(e,t){e.map.once("idle",(()=>{t.doCoreAndRunActions("set_terrain");t.doCoreAndRunActions("set_mapfeatures");t.doCoreAndRunActions("define_dataLayers");t.doCoreAndRunActions("define_markers");t.doCoreAndRunActions("define_clusterLayers");t.doCoreAndRunActions("set_lighting")}))}setLayerEvents(e,t){["symbol","circle","line","fill"].forEach((i=>{e.map.on("click",i,(i=>{e.clickedEvent=i;t.doCoreAndRunActions("define_clickedFeature");t.doCoreAndRunActions("set_storelocatorclick");t.doCoreAndRunActions("set_sidebarclick");t.doCoreAndRunActions("set_externallink");t.doCoreAndRunActions("define_clickedPopup")}));e.map.on("mousemove",i,(i=>{e.hoveredEvent=i;t.doCoreAndRunActions("define_hoveredFeature");t.doCoreAndRunActions("set_hoverEffects");t.doCoreAndRunActions("define_hoveredPopup")}));e.map.on("mouseout",i,(e=>{t.doCoreAndRunActions("set_hoverEffectsOff");t.doCoreAndRunActions("set_hoveredPopupOff")}))}));e.map.on("custom_layer_click",(i=>{e.clickedEvent=i;t.doCoreAndRunActions("define_clickedFeature");t.doCoreAndRunActions("set_storelocatorclick");t.doCoreAndRunActions("set_sidebarclick");t.doCoreAndRunActions("set_externallink");t.doCoreAndRunActions("define_clickedPopup")}));e.map.on("custom_layer_mouseover",(i=>{e.hoveredEvent=i;t.doCoreAndRunActions("define_hoveredFeature");t.doCoreAndRunActions("set_hoverEffects");t.doCoreAndRunActions("define_hoveredPopup")}));e.map.on("custom_layer_mouseout",(e=>{t.doCoreAndRunActions("set_hoverEffectsOff");t.doCoreAndRunActions("set_hoveredPopupOff")}))}setDynamicLayerEvents(e,t){if(e.clusterLayers.length>
420&&!this.dynamicLayerListenersSet){e.clusterLayers.forEach((i=>{if(i.indexOf("-")>-1){e.map.on("click",i,(i=>{e.clickedEvent=i;t.doCoreAndRunActions("define_clickedFeature");t.doCoreAndRunActions("set_storelocatorclick");t.doCoreAndRunActions("set_sidebarclick");t.doCoreAndRunActions("set_externallink");t.doCoreAndRunActions("define_clickedPopup")}));e.map.on("mousemove",i,(i=>{e.hoveredEvent=i;t.doCoreAndRunActions("define_hoveredFeature");t.doCoreAndRunActions("set_hoverEffects");t.doCoreAndRunActions("define_hoveredPopup")}));e.map.on("mouseout",i,(e=>{t.doCoreAndRunActions("set_hoverEffectsOff");t.doCoreAndRunActions("set_hoveredPopupOff")}))}}));this.dynamicLayerListenersSet=!0}}doTriggerClick(e,t){this.MapsterContainer.clickedEvent=e;this.MapsterContainer.triggeredFeature=t;this.doCoreAndRunActions("define_clickedFeature_fromTrigger");this.doCoreAndRunActions("set_storelocatorclick");this.doCoreAndRunActions("set_sidebarclick");this.doCoreAndRunActions("set_externallink");this.doCoreAndRunActions("define_clickedPopup")}doTriggerHover(e,t){this.MapsterContainer.hoveredEvent=e;this.MapsterContainer.triggeredFeature=t;this.doCoreAndRunActions("define_hoveredFeature_fromTrigger");this.doCoreAndRunActions("set_hoverEffects");this.doCoreAndRunActions("define_hoveredPopup")}setDataLayerEvents(e,t){}setMarkerEvents(e,t){e.markers.forEach((i=>{i.getElement().addEventListener("click",(r=>{e.clickedMarker=i;t.doCoreAndRunActions("define_clickedFeature_fromMarker");t.doCoreAndRunActions("set_storelocatorclick");t.doCoreAndRunActions("set_sidebarclick");t.doCoreAndRunActions("set_externallink");t.doCoreAndRunActions("define_clickedPopup_fromMarker")}));i.getElement().addEventListener("mouseenter",(r=>{e.hoveredMarker=i;t.doCoreAndRunActions("define_hoveredFeature_fromMarker");t.doCoreAndRunActions("define_tempHoverMarker");t.doCoreAndRunActions("define_hoveredPopup_fromMarker")}));i.getElement().addEventListener("mouseleave",(e=>{t.doCoreAndRunActions("set_hoverEffectsOff_fromMarker");t.doCoreAndRunActions("set_hoveredPopupOff_fromMarker")}))}))}setMoveEvents(e){if(!this.isPublic){e.once("idle",(e=>{this.doCoreAndRunActions("set_moveendVariables")}));e.on("moveend",(e=>{this.doCoreAndRunActions("set_moveendVariables")}))}}getControlOrder(){return this.MapsterContainer.getControlOrder()}doCoreAndRunActions(e){return this.MapsterContainer.doCore(e)}runHookActions(e,t){if(window.mwm){let r=this.MapsterContainer.core[e].hook;const n=`${r}/mapster-${this.isPublic?this.post_id:"admin"}`;if(window.mwm.actions[n]){window.mwm.actions[n].funcs;if(window.mwm.actions[n].funcs.length>0)for(var i=0;i<window.mwm.actions[n].funcs.length;i++)window.mwm.actions[n].funcs[i].func(t)}if(window.mwm.actions[r]){window.mwm.actions[r].funcs;if(window.mwm.actions[r].funcs.length>0)for(i=0;i<window.mwm.actions[r].funcs.length;i++)window.mwm.actions[r].funcs[i].func(t)}}}registerAdminEventListeners(){this.MapsterContainer.registerListener('.acf-field[data-name="zoom_on_scroll"] :input',"check","postResponse.map.zoom_on_scroll");this.MapsterContainer.registerListener('.acf-field[data-name="interactivity"] :input',"check","postResponse.map.interactivity");this.MapsterContainer.registerListener('.acf-field[data-name="open_popups_in_sidebar"] :input',"check","postResponse.map.open_popups_in_sidebar");this.MapsterContainer.registerListener('.acf-field[data-name="restrict_movement"] :input',"check","postResponse.map.restricted_movement.restrict_movement");this.MapsterContainer.registerListener('.acf-field[data-name="southwest_longitude"] :input',"val","postResponse.map.restricted_movement.allowed_bounds.southwest_longitude");this.MapsterContainer.registerListener('.acf-field[data-name="southwest_latitude"] :input',"val","postResponse.map.restricted_movement.allowed_bounds.southwest_latitude");this.MapsterContainer.registerListener('.acf-field[data-name="northeast_longitude"] :input',"val","postResponse.map.restricted_movement.allowed_bounds.northeast_longitude");this.MapsterContainer.registerListener('.acf-field[data-name="northeast_latitude"] :input',"val","postResponse.map.restricted_movement.allowed_bounds.northeast_latitude");this.MapsterContainer.registerListener('.acf-field[data-name="min_zoom"] :input',"val","postResponse.map.restricted_movement.allowed_zoom.min_zoom");this.MapsterContainer.registerListener('.acf-field[data-name="max_zoom"] :input',"val","postResponse.map.restricted_movement.allowed_zoom.max_zoom");this.MapsterContainer.registerListener('.acf-field[data-name="control_order"] :input',"val","postResponse.map.control_order");this.MapsterContainer.registerListener('.acf-field[data-name="control_menu"] .acf-field[data-name="enable"] :input',"check","postResponse.map.control_menu.enable",["define_controls.controlMenu"]);this.MapsterContainer.registerListener('.acf-field[data-name="control_menu"] .acf-field[data-name="position"] :input',"val","postResponse.map.control_menu.position",["define_controls.controlMenu"]);this.MapsterContainer.registerListener('.acf-field[data-name="control_menu"] .acf-field[data-name="included_controls"] :input[type="text"]',"val","postResponse.map.control_menu.included_controls",["define_controls.controlMenu"]);this.MapsterContainer.registerListener('.acf-field[data-name="zoom_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.zoom_control.enable",["define_controls.zoomControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="zoom_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.zoom_control.position",["define_controls.zoomControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="3d_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.3d_control.enable",["define_controls.3dControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="3d_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.3d_control.position",["define_controls.3dControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="scale_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.scale_control.enable",["define_controls.scaleControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="scale_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.scale_control.position",["define_controls.scaleControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="print_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.print_control.enable",["define_controls.printControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="print_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.print_control.position",["define_controls.printControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="attribution_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.attribution_control.position",["define_controls.attributionControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="geolocation_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.geolocation_control.enable",["define_controls.geolocationControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="geolocation_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.geolocation_control.position",["define_controls.geolocationControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="geolocation_control"] .acf-field[data-name="set_on_load"] :input',"check","postResponse.map.geolocation_control.set_on_load",["define_controls.geolocationControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="fullscreen_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.fullscreen_control.enable",["define_controls.fullscreenControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="fullscreen_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.fullscreen_control.position",["define_controls.fullscreenControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="street_view_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.street_view_control.enable",["define_controls.streetViewControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="street_view_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.street_view_control.position",["define_controls.streetViewControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="map_type_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.map_type_control.enable",["define_controls.mapTypeControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="map_type_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.map_type_control.position",["define_controls.mapTypeControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="download_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.download_control.enable",["define_controls.downloadControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="download_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.download_control.position",["define_controls.downloadControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="download_control"] .acf-field[data-name="interact_with_filters"] :input',"check","postResponse.map.download_control.interact_with_filters",["define_controls.downloadControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="download_control"] .acf-field[data-name="notify_on_download"] :input',"val","postResponse.map.download_control.notify_on_download",["define_controls.downloadControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_html_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.custom_html_control.enable",["define_controls.customHTMLControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_html_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.custom_html_control.position",["define_controls.customHTMLControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_html_control"] .acf-field[data-name="custom_html"] :input',"val","postResponse.map.custom_html_control.custom_html",["define_controls.customHTMLControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="layer_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.layer_control.enable",["define_controls.layerControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="layer_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.layer_control.position",["define_controls.layerControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="layer_control"] .acf-field[data-name="toggleable_layers"] :input',"val","postResponse.map.layer_control.toggleable_layers",["define_controls.layerControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="layer_control"] .acf-field[data-name="toggleable_layer_titles"] :input',"val","postResponse.map.layer_control.toggleable_layer_titles",["define_controls.layerControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="layer_control"] .acf-field[data-name="checkbox_type"] :input',"val","postResponse.map.layer_control.checkbox_type",["define_controls.layerControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="style_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.style_control.enable",["define_controls.styleControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="style_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.style_control.position",["define_controls.styleControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="style_control"] .acf-field[data-name="toggleable_styles"] :input',"val","postResponse.map.style_control.toggleable_styles",["define_controls.styleControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="style_control"] .acf-field[data-name="toggleable_styles_titles"] :input',"val","postResponse.map.style_control.toggleable_styles_titles",["define_controls.styleControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="style_control"] .acf-field[data-name="initial_style_title"] :input',"val","postResponse.map.style_control.initial_style_title",["define_controls.styleControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="searchbox_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.searchbox_control.enable",["define_controls.searchBoxControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="searchbox_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.searchbox_control.position",["define_controls.searchBoxControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="geocoder_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.geocoder_control.enable",["define_controls.geocoderControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="geocoder_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.geocoder_control.position",["define_controls.geocoderControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="geocoder_control"] .acf-field[data-name="limit_results"] :input',"val","postResponse.map.geocoder_control.limit_results",["define_controls.geocoderControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="geocoder_control"] .acf-field[data-name="placeholder"] :input',"val","postResponse.map.geocoder_control.placeholder",["define_controls.geocoderControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="directions_control"] .acf-field[data-name="enable"] :input',"check","postResponse.map.directions_control.enable",["define_controls.directionsControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="directions_control"] .acf-field[data-name="position"] :input',"val","postResponse.map.directions_control.position",["define_controls.directionsControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="directions_control"] .acf-field[data-name="unit"] :input',"val","postResponse.map.directions_control.unit",["define_controls.directionsControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="directions_control"] .acf-field[data-name="profile"] :input',"val","postResponse.map.directions_control.profile",["define_controls.directionsControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="directions_control"] .acf-field[data-name="placeholderOrigin"] :input',"val","postResponse.map.directions_control.placeholderOrigin",["define_controls.directionsControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_search_filter"] .acf-field[data-name="enable"] :input',"check","postResponse.map.filter.custom_search_filter.enable",["define_controls.customSearchControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_search_filter"] .acf-field[data-name="position"] :input',"val","postResponse.map.filter.custom_search_filter.position",["define_controls.customSearchControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_search_filter"] .acf-field[data-name="include_geocoder"] :input',"check","postResponse.map.filter.custom_search_filter.include_geocoder",["define_controls.customSearchControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_search_filter"] .acf-field[data-name="limit_results"] :input',"val","postResponse.map.filter.custom_search_filter.limit_results",["define_controls.customSearchControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_search_filter"] .acf-field[data-name="number_of_results"] :input',"val","postResponse.map.filter.custom_search_filter.number_of_results",["define_controls.customSearchControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_search_filter"] .acf-field[data-name="placeholder"] :input',"val","postResponse.map.filter.custom_search_filter.placeholder",["def
42ine_controls.customSearchControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="filter_dropdown"] .acf-field[data-name="enable"] :input',"check","postResponse.map.filter.filter_dropdown.enable",["define_controls.filterDropdownControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="filter_dropdown"] .acf-field[data-name="position"] :input',"val","postResponse.map.filter.filter_dropdown.position",["define_controls.filterDropdownControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="filter_dropdown"] .acf-field[data-name="placeholder"] :input',"val","postResponse.map.filter.filter_dropdown.placeholder",["define_controls.filterDropdownControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="category_filter"] .acf-field[data-name="enable"] :input',"check","postResponse.map.filter.category_filter.enable",["define_controls.categoryFilterControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="category_filter"] .acf-field[data-name="position"] :input',"val","postResponse.map.filter.category_filter.position",["define_controls.categoryFilterControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="category_filter"] .acf-field[data-name="initial_visibility"] :input',"check","postResponse.map.filter.category_filter.initial_visibility",["define_controls.categoryFilterControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="category_filter"] .acf-field[data-name="functionality"] :input',"val","postResponse.map.filter.category_filter.functionality",["define_controls.categoryFilterControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="category_filter"] .acf-field[data-name="independent_children"] :input',"check","postResponse.map.filter.category_filter.independent_children",["define_controls.categoryFilterControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="category_filter"] .acf-field[data-name="category_display"] :input',"val","postResponse.map.filter.category_filter.category_display",["define_controls.categoryFilterControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="category_filter"] .acf-field[data-name="category_order"] :input',"val","postResponse.map.filter.category_filter.category_order",["define_controls.categoryFilterControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="category_filter"] .acf-field[data-name="checkbox_display"] :input',"val","postResponse.map.filter.category_filter.checkbox_display",["define_controls.categoryFilterControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="category_filter"] .acf-field[data-name="pre_selected_categories"] :input',"val","postResponse.map.filter.category_filter.pre_selected_categories",["define_controls.categoryFilterControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="enable"] :input',"check","postResponse.map.list.enable",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="position"] :input',"val","postResponse.map.list.position",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="units"] :input',"val","postResponse.map.list.units",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="show_distance"] :input',"check","postResponse.map.list.show_distance",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="sort_by_distance"] :input',"check","postResponse.map.list.sort_by_distance",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="listing_type"] :input',"val","postResponse.map.list.listing_type",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="list_order"] :input',"val","postResponse.map.list.list_order",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="group_by_category"] :input',"check","postResponse.map.list.group_by_category",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="number_of_locations"] :input',"val","postResponse.map.list.number_of_locations",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="store_locator_options"] .acf-field[data-name="enable"] :input',"check","postResponse.map.list.store_locator_options.enable",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="list"] .acf-field[data-name="store_locator_options"] .acf-field[data-name="sort_hours_by_day"] :input',"check","postResponse.map.list.store_locator_options.sort_hours_by_day",["define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="locations"] select',"select","postResponseAdmin.locations_ids",["define_adminFeatures","define_postResponse.locations","set_mapfeatures","define_dataLayers","define_markers","define_controls.customSearchControl","define_controls.filterDropdownControl","define_controls.categoryFilterControl","define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="lines"] select',"select","postResponseAdmin.lines_ids",["define_adminFeatures","define_postResponse.lines","set_mapfeatures","define_dataLayers","define_markers","define_controls.customSearchControl","define_controls.filterDropdownControl","define_controls.categoryFilterControl","define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="polygons"] select',"select","postResponseAdmin.polygons_ids",["define_adminFeatures","define_postResponse.polygons","set_mapfeatures","define_dataLayers","define_markers","define_controls.customSearchControl","define_controls.filterDropdownControl","define_controls.categoryFilterControl","define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="add_by_category"] select',"select","postResponse.cats",["define_adminFeatures","define_postResponse.locations","define_postResponse.lines","define_postResponse.polygons","set_mapfeatures","define_dataLayers","define_markers","define_controls.customSearchControl","define_controls.filterDropdownControl","define_controls.categoryFilterControl","define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="add_custom_posts"] select',"select","postResponseAdmin.custom_post_ids",["define_adminFeatures","define_postResponse.locations","define_postResponse.lines","define_postResponse.polygons","set_mapfeatures","define_dataLayers","define_markers","define_controls.customSearchControl","define_controls.filterDropdownControl","define_controls.categoryFilterControl","define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="add_by_custom_category"] select',"select","postResponseAdmin.custom_cats",["define_adminFeatures","define_postResponse.locations","define_postResponse.lines","define_postResponse.polygons","set_mapfeatures","define_dataLayers","define_markers","define_controls.customSearchControl","define_controls.filterDropdownControl","define_controls.categoryFilterControl","define_controls.listControl"]);this.MapsterContainer.registerListener('.acf-field[data-name="manual_latitude"] :input',"val","postResponse.map.view.manual_latitude");this.MapsterContainer.registerListener('.acf-field[data-name="manual_longitude"] :input',"val","postResponse.map.view.manual_longitude");this.MapsterContainer.registerListener('.acf-field[data-name="manual_zoom"] :input',"val","postResponse.map.view.manual_zoom");this.MapsterContainer.registerListener('.acf-field[data-name="manual_pitch"] :input',"val","postResponse.map.view.manual_pitch");this.MapsterContainer.registerListener('.acf-field[data-name="manual_rotation"] :input',"val","postResponse.map.view.manual_rotation");this.MapsterContainer.registerListener('.acf-field[data-name="padding_around_bounds"] :input',"val","postResponse.map.view.padding_around_bounds");this.MapsterContainer.registerListener('.acf-field[data-name="initial_load"] :input',"val","postResponse.map.view.initial_load");this.MapsterContainer.registerListener('.acf-field[data-name="loading_graphic"] :input',"val","postResponse.map.loading.loading_graphic");this.MapsterContainer.registerListener('.acf-field[data-name="background_color"] :input',"val","postResponse.map.loading.background_color");this.MapsterContainer.registerListener('.acf-field[data-name="loader_color"] :input',"val","postResponse.map.loading.loader_color");this.MapsterContainer.registerListener('.acf-field[data-name="custom_loader"]',"img","postResponse.map.loading.custom_loader");this.MapsterContainer.registerListener('.acf-field[data-name="circle_clustering"] :input',"check","postResponse.map.circle_clustering");this.MapsterContainer.registerListener('.acf-field[data-name="label_icon_clustering"] :input',"check","postResponse.map.label_icon_clustering");this.MapsterContainer.registerListener('.acf-field[data-name="enable_heatmap"] :input',"check","postResponse.map.heatmap.enable_heatmap",["set_heatmap"]);this.MapsterContainer.registerListener('.acf-field[data-name="heatmap_layer"] :input',"val","postResponse.map.heatmap.heatmap_layer",["set_heatmap"]);this.MapsterContainer.registerListener('.acf-field[data-name="heatmap_layer_visibility"] :input',"val","postResponse.map.heatmap.heatmap_layer_visibility",["set_heatmap"]);this.MapsterContainer.registerListener('.acf-field[data-name="heatmap_weighted_property"] :input',"val","postResponse.map.heatmap.heatmap_weighted_property",["set_heatmap"]);this.MapsterContainer.registerListener('.acf-field[data-name="heatmap_intensity"] :input',"val","postResponse.map.heatmap.heatmap_intensity",["set_heatmap"]);this.MapsterContainer.registerListener('.acf-field[data-name="heatmap_color_range"] :input',"val","postResponse.map.heatmap.heatmap_color_range",["set_heatmap"]);this.MapsterContainer.registerListener('.acf-field[data-name="heatmap_point_radius"] :input',"val","postResponse.map.heatmap.heatmap_point_radius",["set_heatmap"]);this.MapsterContainer.registerListener('.acf-field[data-name="heatmap_opacity"] :input',"val","postResponse.map.heatmap.heatmap_opacity",["set_heatmap"]);this.MapsterContainer.registerListener('.acf-field[data-name="enable_elevation_chart"] :input',"check","postResponse.map.elevation_line_chart.enable_elevation_chart");this.MapsterContainer.registerListener('.acf-field[data-name="map_provider"] :input',"val","postResponse.map.map_type.map_provider",["define_mapLibrary"]);this.MapsterContainer.registerListener('.acf-field[data-name="map_tile_style_access_token"] :input',"val","postResponse.map.map_type.map_tile_style_access_token",["set_mapstyle"]);this.MapsterContainer.registerListener('.acf-field[data-name="map_tile_style_no_access_token"] :input',"val","postResponse.map.map_type.map_tile_style_no_access_token",["set_mapstyle"]);this.MapsterContainer.registerListener('.acf-field[data-name="access_token"] :input',"val","postResponse.map.map_type.access_token");this.MapsterContainer.registerListener('.acf-field[data-name="custom_mapbox_style"] :input',"val","postResponse.map.map_type.custom_mapbox_style",["set_mapstyle"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_style_json"] :input',"val","postResponse.map.map_type.custom_style_json",["set_mapstyle"]);this.MapsterContainer.registerListener('.acf-field[data-name="snazzy_map_style"] :input',"val","postResponse.map.map_type.snazzy_map_style",["set_mapstyle"]);this.MapsterContainer.registerListener('.acf-field[data-name="custom_image"] :input',"val","postResponse.map.map_type.custom_image",["set_mapstyle"]);this.MapsterContainer.registerListener('.acf-field[data-name="duplicate_horizontally"] :input',"check","postResponse.map.layout.duplicate_horizontally");this.MapsterContainer.registerListener('.acf-field[data-name="terrain"] :input',"check","postResponse.map.map_type.terrain",["set_terrain"]);this.MapsterContainer.registerListener('.acf-field[data-name="buildings_3d"] :input',"check","postResponse.map.map_type.buildings_3d",["set_buildings3d"]);this.MapsterContainer.registerListener('.acf-field[data-name="map_language"] :input',"val","postResponse.map.map_type.map_language");this.MapsterContainer.registerListener('.acf-field[data-name="projection"] :input',"val","postResponse.map.map_type.projection",["set_projection"]);this.MapsterContainer.registerListener('.acf-field[data-name="globe"] :input',"check","postResponse.map.map_type.globe",[]);this.MapsterContainer.registerListener('.acf-field[data-name="globe_background"] :input',"val","postResponse.map.map_type.globe_background",[])}}class MapsterPublic{constructor(){this.actions={}}add_action(e,t){this.actions[e]||(this.actions[e]={funcs:[]});this.actions[e].funcs.push({func:t})}}window.mwm=new MapsterPublic;!function(e){if(window.mapster_params&&window.mapster_params.public)(i=".mapster-wp-maps",new Promise((e=>{if(document.querySelector(i))return e(document.querySelector(i));const t=new MutationObserver((r=>{if(document.querySelector(i)){e(document.querySelector(i));t.disconnect()}}));t.observe(document.body,{childList:!0,subtree:!0})}
42))).then((t=>{let i=!1,r=e(document).scrollTop();e(".mapster-wp-maps").length>15&&(i=!0);e(".mapster-wp-maps").each((function(){const t=e(this).attr("id").replace("mapster-wp-maps-",""),n=""!==e(this).data("single_feature_id")&&e(this).data("single_feature_id"),o=""!==e(this).data("feature_ids")&&e(this).data("feature_ids");if(i){let a=!1;const l=e(window).height(),c=e(this).offset().top;s();e(document).scroll((()=>{r=e(document).scrollTop();s()}));function s(){if(r-1.5*l<c&&r+1.5*l>c&&!a){a=new MapsterMap(t,window.mapster_params.public,n,o);a.init()}else if((r-1.5*l>c||r+1.5*l<c)&&a){a.destroy();a=!1}}}else new MapsterMap(t,window.mapster_params.public,n,o).init()}))}));else if(window.mapster_params){let r="Publish this post to generate an embed code.";const n=new URLSearchParams(window.location.search);if(n.has("post")){let p=window.mapster_params.directory.replace("/admin/","/admin/includes/mapster-embed-map.php");p=p+window.mapster_params.qd+"map_id="+n.get("post");r=`<iframe src="${p}" />`}let o="Publish this post to generate a listing code.";n.has("post")&&(o=`[mapster_listing_posts id="${n.get("post")}"]`);if(document.body.classList.contains("block-editor-page")){e("#mapster-wp-maps-preview").prependTo("#normal-sortables");e(".acf-field-625df5ebf4ecc .acf-input").text(r);e(".acf-field-6507ba6e3053a .acf-input").text(o);e("#mapster-wp-map-external-search-filter-shortcode").text(s)}else{e("#mapster-wp-maps-preview").prependTo("#acf_after_title-sortables");e(".acf-field-625df5ebf4ecc .acf-input").text(r);e(".acf-field-6507ba6e3053a .acf-input").text(o)}if(n.has("post")){let d=`\n [mapster_wp_map_submit map_id="${n.get("post")}" type="create_point"]<br />\n [mapster_wp_map_submit map_id="${n.get("post")}" type="edit_point" button_text="Edit Point" header_text="Edit Point"]\n `;e(".acf-field-62bf86b094491 .acf-input").append(d)}let s="Publish this post to generate a custom search code.";n.has("post")&&(s=`[mapster_custom_search id="${n.get("post")}" to_url="${jQuery("#sample-permalink").text()}"]`);e("#mapster-wp-map-external-search-filter-shortcode").text(s);let a=acf.getFields().length,l=acf.getFields().filter((e=>"accordion"===e.data.type)).length;a-=l;let c=6,u=0,h=0;function t(e){"select"!==e&&(u+=1);u===a&&c===h&&new MapsterMap("map",window.mapster_params.public,!1).init()}acf.add_action("ready_field",t);acf.addAction("select2_init",(function(e,i,r,n){h+=1;t("select")}))}var i}(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.