@basemaps/landing 6.28.1 → 6.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/android-chrome-192x192.png +0 -0
- package/dist/android-chrome-512x512.png +0 -0
- package/dist/apple-touch-icon.png +0 -0
- package/dist/assets/fonts/OpenSans-Bold.woff2 +0 -0
- package/dist/assets/fonts/OpenSans-Italic.woff2 +0 -0
- package/dist/assets/fonts/OpenSans-Light.woff2 +0 -0
- package/dist/assets/fonts/OpenSans-Regular.woff2 +0 -0
- package/dist/assets/fonts/OpenSans-SemiBold.woff2 +0 -0
- package/dist/assets/logo-linz.svg +256 -0
- package/dist/assets/logo-nz-govt.svg +11 -0
- package/dist/basemaps-card.jpeg +0 -0
- package/dist/examples/index.html +33 -0
- package/dist/examples/index.leaflet.xyz.3857.html +43 -0
- package/dist/examples/index.maplibre.compare.3857.html +111 -0
- package/dist/examples/index.maplibre.opacity.3857.html +218 -0
- package/dist/examples/index.maplibre.vector.3857.html +48 -0
- package/dist/examples/index.openlayers.attribution.wmts.3857.html +55 -0
- package/dist/examples/index.openlayers.wmts.3857.html +49 -0
- package/dist/examples/index.openlayers.xyz.3857.html +49 -0
- package/dist/favicon-16x16.png +0 -0
- package/dist/favicon-32x32.png +0 -0
- package/dist/favicon.ico +0 -0
- package/dist/index-6.29.0-053c6b9b5e501b18.js +575 -0
- package/dist/index-6.29.0-433a0509539c3f0c.js +35288 -0
- package/dist/index-6.29.0-f61958521df787d6.css +4317 -0
- package/dist/index.css +4317 -0
- package/dist/index.html +26 -0
- package/dist/index.js +575 -0
- package/dist/json-schema/stac-basemaps-extension/1.0/schema.json +144 -0
- package/dist/lib/attribution-6.29.0-431936fcac8e2647.js +2318 -0
- package/dist/lib/attribution-6.29.0-a5dcb359f35150b9.js +10 -0
- package/dist/lib/attribution.js +10 -0
- package/package.json +5 -5
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
var BS=Object.create;var Qv=Object.defineProperty;var US=Object.getOwnPropertyDescriptor;var GS=Object.getOwnPropertyNames;var VS=Object.getPrototypeOf,jS=Object.prototype.hasOwnProperty;var $v=(r,n)=>()=>(r&&(n=r(r=0)),n);var xa=(r,n)=>()=>(n||r((n={exports:{}}).exports,n),n.exports);var qS=(r,n,s,p)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of GS(n))!jS.call(r,i)&&i!==s&&Qv(r,i,{get:()=>n[i],enumerable:!(p=US(n,i))||p.enumerable});return r};var zr=(r,n,s)=>(s=r!=null?BS(VS(r)):{},qS(n||!r||!r.__esModule?Qv(s,"default",{value:r,enumerable:!0}):s,r));function js(r,n){for(var s in n)r[s]=n[s];return r}function l0(r){var n=r.parentNode;n&&n.removeChild(r)}function D(r,n,s){var p,i,m,v={};for(m in n)m=="key"?p=n[m]:m=="ref"?i=n[m]:v[m]=n[m];if(arguments.length>2&&(v.children=arguments.length>3?Nf.call(arguments,2):s),typeof r=="function"&&r.defaultProps!=null)for(m in r.defaultProps)v[m]===void 0&&(v[m]=r.defaultProps[m]);return Rf(r,v,p,i,null)}function Rf(r,n,s,p,i){var m={type:r,props:n,key:s,ref:p,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:i??++o0};return i==null&&Ei.vnode!=null&&Ei.vnode(m),m}function K(r){return r.children}function Ti(r,n){this.props=r,this.context=n}function Qu(r,n){if(n==null)return r.__?Qu(r.__,r.__.__k.indexOf(r)+1):null;for(var s;n<r.__k.length;n++)if((s=r.__k[n])!=null&&s.__e!=null)return s.__e;return typeof r.type=="function"?Qu(r):null}function u0(r){var n,s;if((r=r.__)!=null&&r.__c!=null){for(r.__e=r.__c.base=null,n=0;n<r.__k.length;n++)if((s=r.__k[n])!=null&&s.__e!=null){r.__e=r.__c.base=s.__e;break}return u0(r)}}function e0(r){(!r.__d&&(r.__d=!0)&&zc.push(r)&&!Df.__r++||t0!==Ei.debounceRendering)&&((t0=Ei.debounceRendering)||a0)(Df)}function Df(){for(var r;Df.__r=zc.length;)r=zc.sort(function(n,s){return n.__v.__b-s.__v.__b}),zc=[],r.some(function(n){var s,p,i,m,v,b;n.__d&&(v=(m=(s=n).__v).__e,(b=s.__P)&&(p=[],(i=js({},m)).__v=m.__v+1,Wm(b,m,i,s.__n,b.ownerSVGElement!==void 0,m.__h!=null?[v]:null,p,v??Qu(m),m.__h),f0(p,m),m.__e!=v&&u0(m)))})}function h0(r,n,s,p,i,m,v,b,M,z){var C,j,Y,ot,J,mt,ft,At=p&&p.__k||s0,Gt=At.length;for(s.__k=[],C=0;C<n.length;C++)if((ot=s.__k[C]=(ot=n[C])==null||typeof ot=="boolean"?null:typeof ot=="string"||typeof ot=="number"||typeof ot=="bigint"?Rf(null,ot,null,null,ot):Array.isArray(ot)?Rf(K,{children:ot},null,null,null):ot.__b>0?Rf(ot.type,ot.props,ot.key,null,ot.__v):ot)!=null){if(ot.__=s,ot.__b=s.__b+1,(Y=At[C])===null||Y&&ot.key==Y.key&&ot.type===Y.type)At[C]=void 0;else for(j=0;j<Gt;j++){if((Y=At[j])&&ot.key==Y.key&&ot.type===Y.type){At[j]=void 0;break}Y=null}Wm(r,ot,Y=Y||zf,i,m,v,b,M,z),J=ot.__e,(j=ot.ref)&&Y.ref!=j&&(ft||(ft=[]),Y.ref&&ft.push(Y.ref,null,ot),ft.push(j,ot.__c||J,ot)),J!=null?(mt==null&&(mt=J),typeof ot.type=="function"&&ot.__k===Y.__k?ot.__d=M=c0(ot,M,r):M=p0(r,ot,Y,At,J,M),typeof s.type=="function"&&(s.__d=M)):M&&Y.__e==M&&M.parentNode!=r&&(M=Qu(Y))}for(s.__e=mt,C=Gt;C--;)At[C]!=null&&(typeof s.type=="function"&&At[C].__e!=null&&At[C].__e==s.__d&&(s.__d=Qu(p,C+1)),m0(At[C],At[C]));if(ft)for(C=0;C<ft.length;C++)d0(ft[C],ft[++C],ft[++C])}function c0(r,n,s){for(var p,i=r.__k,m=0;i&&m<i.length;m++)(p=i[m])&&(p.__=r,n=typeof p.type=="function"?c0(p,n,s):p0(s,p,p,i,p.__e,n));return n}function p0(r,n,s,p,i,m){var v,b,M;if(n.__d!==void 0)v=n.__d,n.__d=void 0;else if(s==null||i!=m||i.parentNode==null)t:if(m==null||m.parentNode!==r)r.appendChild(i),v=null;else{for(b=m,M=0;(b=b.nextSibling)&&M<p.length;M+=2)if(b==i)break t;r.insertBefore(i,m),v=m}return v!==void 0?v:i.nextSibling}function ZS(r,n,s,p,i){var m;for(m in s)m==="children"||m==="key"||m in n||Of(r,m,null,s[m],p);for(m in n)i&&typeof n[m]!="function"||m==="children"||m==="key"||m==="value"||m==="checked"||s[m]===n[m]||Of(r,m,n[m],s[m],p)}function r0(r,n,s){n[0]==="-"?r.setProperty(n,s):r[n]=s==null?"":typeof s!="number"||HS.test(n)?s:s+"px"}function Of(r,n,s,p,i){var m;t:if(n==="style")if(typeof s=="string")r.style.cssText=s;else{if(typeof p=="string"&&(r.style.cssText=p=""),p)for(n in p)s&&n in s||r0(r.style,n,"");if(s)for(n in s)p&&s[n]===p[n]||r0(r.style,n,s[n])}else if(n[0]==="o"&&n[1]==="n")m=n!==(n=n.replace(/Capture$/,"")),n=n.toLowerCase()in r?n.toLowerCase().slice(2):n.slice(2),r.l||(r.l={}),r.l[n+m]=s,s?p||r.addEventListener(n,m?n0:i0,m):r.removeEventListener(n,m?n0:i0,m);else if(n!=="dangerouslySetInnerHTML"){if(i)n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!=="href"&&n!=="list"&&n!=="form"&&n!=="tabIndex"&&n!=="download"&&n in r)try{r[n]=s??"";break t}catch{}typeof s=="function"||(s!=null&&(s!==!1||n[0]==="a"&&n[1]==="r")?r.setAttribute(n,s):r.removeAttribute(n))}}function i0(r){this.l[r.type+!1](Ei.event?Ei.event(r):r)}function n0(r){this.l[r.type+!0](Ei.event?Ei.event(r):r)}function Wm(r,n,s,p,i,m,v,b,M){var z,C,j,Y,ot,J,mt,ft,At,Gt,Zt,we,he,Kt=n.type;if(n.constructor!==void 0)return null;s.__h!=null&&(M=s.__h,b=n.__e=s.__e,n.__h=null,m=[b]),(z=Ei.__b)&&z(n);try{t:if(typeof Kt=="function"){if(ft=n.props,At=(z=Kt.contextType)&&p[z.__c],Gt=z?At?At.props.value:z.__:p,s.__c?mt=(C=n.__c=s.__c).__=C.__E:("prototype"in Kt&&Kt.prototype.render?n.__c=C=new Kt(ft,Gt):(n.__c=C=new Ti(ft,Gt),C.constructor=Kt,C.render=YS),At&&At.sub(C),C.props=ft,C.state||(C.state={}),C.context=Gt,C.__n=p,j=C.__d=!0,C.__h=[]),C.__s==null&&(C.__s=C.state),Kt.getDerivedStateFromProps!=null&&(C.__s==C.state&&(C.__s=js({},C.__s)),js(C.__s,Kt.getDerivedStateFromProps(ft,C.__s))),Y=C.props,ot=C.state,j)Kt.getDerivedStateFromProps==null&&C.componentWillMount!=null&&C.componentWillMount(),C.componentDidMount!=null&&C.__h.push(C.componentDidMount);else{if(Kt.getDerivedStateFromProps==null&&ft!==Y&&C.componentWillReceiveProps!=null&&C.componentWillReceiveProps(ft,Gt),!C.__e&&C.shouldComponentUpdate!=null&&C.shouldComponentUpdate(ft,C.__s,Gt)===!1||n.__v===s.__v){C.props=ft,C.state=C.__s,n.__v!==s.__v&&(C.__d=!1),C.__v=n,n.__e=s.__e,n.__k=s.__k,n.__k.forEach(function(ce){ce&&(ce.__=n)}),C.__h.length&&v.push(C);break t}C.componentWillUpdate!=null&&C.componentWillUpdate(ft,C.__s,Gt),C.componentDidUpdate!=null&&C.__h.push(function(){C.componentDidUpdate(Y,ot,J)})}if(C.context=Gt,C.props=ft,C.__v=n,C.__P=r,Zt=Ei.__r,we=0,"prototype"in Kt&&Kt.prototype.render)C.state=C.__s,C.__d=!1,Zt&&Zt(n),z=C.render(C.props,C.state,C.context);else do C.__d=!1,Zt&&Zt(n),z=C.render(C.props,C.state,C.context),C.state=C.__s;while(C.__d&&++we<25);C.state=C.__s,C.getChildContext!=null&&(p=js(js({},p),C.getChildContext())),j||C.getSnapshotBeforeUpdate==null||(J=C.getSnapshotBeforeUpdate(Y,ot)),he=z!=null&&z.type===K&&z.key==null?z.props.children:z,h0(r,Array.isArray(he)?he:[he],n,s,p,i,m,v,b,M),C.base=n.__e,n.__h=null,C.__h.length&&v.push(C),mt&&(C.__E=C.__=null),C.__e=!1}else m==null&&n.__v===s.__v?(n.__k=s.__k,n.__e=s.__e):n.__e=XS(s.__e,n,s,p,i,m,v,M);(z=Ei.diffed)&&z(n)}catch(ce){n.__v=null,(M||m!=null)&&(n.__e=b,n.__h=!!M,m[m.indexOf(b)]=null),Ei.__e(ce,n,s)}}function f0(r,n){Ei.__c&&Ei.__c(n,r),r.some(function(s){try{r=s.__h,s.__h=[],r.some(function(p){p.call(s)})}catch(p){Ei.__e(p,s.__v)}})}function XS(r,n,s,p,i,m,v,b){var M,z,C,j=s.props,Y=n.props,ot=n.type,J=0;if(ot==="svg"&&(i=!0),m!=null){for(;J<m.length;J++)if((M=m[J])&&"setAttribute"in M==!!ot&&(ot?M.localName===ot:M.nodeType===3)){r=M,m[J]=null;break}}if(r==null){if(ot===null)return document.createTextNode(Y);r=i?document.createElementNS("http://www.w3.org/2000/svg",ot):document.createElement(ot,Y.is&&Y),m=null,b=!1}if(ot===null)j===Y||b&&r.data===Y||(r.data=Y);else{if(m=m&&Nf.call(r.childNodes),z=(j=s.props||zf).dangerouslySetInnerHTML,C=Y.dangerouslySetInnerHTML,!b){if(m!=null)for(j={},J=0;J<r.attributes.length;J++)j[r.attributes[J].name]=r.attributes[J].value;(C||z)&&(C&&(z&&C.__html==z.__html||C.__html===r.innerHTML)||(r.innerHTML=C&&C.__html||""))}if(ZS(r,Y,j,i,b),C)n.__k=[];else if(J=n.props.children,h0(r,Array.isArray(J)?J:[J],n,s,p,i&&ot!=="foreignObject",m,v,m?m[0]:s.__k&&Qu(s,0),b),m!=null)for(J=m.length;J--;)m[J]!=null&&l0(m[J]);b||("value"in Y&&(J=Y.value)!==void 0&&(J!==r.value||ot==="progress"&&!J||ot==="option"&&J!==j.value)&&Of(r,"value",J,j.value,!1),"checked"in Y&&(J=Y.checked)!==void 0&&J!==r.checked&&Of(r,"checked",J,j.checked,!1))}return r}function d0(r,n,s){try{typeof r=="function"?r(n):r.current=n}catch(p){Ei.__e(p,s)}}function m0(r,n,s){var p,i;if(Ei.unmount&&Ei.unmount(r),(p=r.ref)&&(p.current&&p.current!==r.__e||d0(p,null,n)),(p=r.__c)!=null){if(p.componentWillUnmount)try{p.componentWillUnmount()}catch(m){Ei.__e(m,n)}p.base=p.__P=null}if(p=r.__k)for(i=0;i<p.length;i++)p[i]&&m0(p[i],n,typeof r.type!="function");s||r.__e==null||l0(r.__e),r.__e=r.__d=void 0}function YS(r,n,s){return this.constructor(r,s)}function y0(r,n,s){var p,i,m;Ei.__&&Ei.__(r,n),i=(p=typeof s=="function")?null:s&&s.__k||n.__k,m=[],Wm(n,r=(!p&&s||n).__k=D(K,null,[r]),i||zf,zf,n.ownerSVGElement!==void 0,!p&&s?[s]:i?null:n.firstChild?Nf.call(n.childNodes):null,m,!p&&s?s:i?i.__e:n.firstChild,p),f0(m,r)}var Nf,Ei,o0,WS,zc,a0,t0,KS,zf,s0,HS,go=$v(()=>{E();zf={},s0=[],HS=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;Nf=s0.slice,Ei={__e:function(r,n,s,p){for(var i,m,v;n=n.__;)if((i=n.__c)&&!i.__)try{if((m=i.constructor)&&m.getDerivedStateFromError!=null&&(i.setState(m.getDerivedStateFromError(r)),v=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(r,p||{}),v=i.__d),v)return i.__E=i}catch(b){r=b}throw r}},o0=0,WS=function(r){return r!=null&&r.constructor===void 0},Ti.prototype.setState=function(r,n){var s;s=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=js({},this.state),typeof r=="function"&&(r=r(js({},s),this.props)),r&&js(s,r),r!=null&&this.__v&&(n&&this.__h.push(n),e0(this))},Ti.prototype.forceUpdate=function(r){this.__v&&(this.__e=!0,r&&this.__h.push(r),e0(this))},Ti.prototype.render=K,zc=[],a0=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Df.__r=0,KS=0});var E=$v(()=>{go()});var g0=xa(()=>{E()});var T0=xa(Bf=>{"use strict";E();Object.defineProperty(Bf,"__esModule",{value:!0});Bf.Nztm2000Quad=void 0;Bf.Nztm2000Quad={type:"TileMatrixSetType",title:"LINZ NZTM2000 Map Tile Grid V2",abstract:"",identifier:"NZTM2000Quad",supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/2193",boundingBox:{type:"BoundingBoxType",crs:"https://www.opengis.net/def/crs/EPSG/0/2193",lowerCorner:[419435.9938,-32605867284e-4],upperCorner:[104381901652e-4,6758167443e-3]},tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:139770566007179e-6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1,matrixHeight:1},{type:"TileMatrixType",identifier:"1",scaleDenominator:698852830035895e-7,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:2},{type:"TileMatrixType",identifier:"2",scaleDenominator:3494264150179475e-8,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:4},{type:"TileMatrixType",identifier:"3",scaleDenominator:17471320750897374e-9,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:8},{type:"TileMatrixType",identifier:"4",scaleDenominator:8735660375448687e-9,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:16},{type:"TileMatrixType",identifier:"5",scaleDenominator:4.3678301877243435e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:32},{type:"TileMatrixType",identifier:"6",scaleDenominator:2.1839150938621718e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:64},{type:"TileMatrixType",identifier:"7",scaleDenominator:1.0919575469310859e6,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:128},{type:"TileMatrixType",identifier:"8",scaleDenominator:545978.7734655429,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:256},{type:"TileMatrixType",identifier:"9",scaleDenominator:272989.38673277147,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:512,matrixHeight:512},{type:"TileMatrixType",identifier:"10",scaleDenominator:136494.69336638573,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1024,matrixHeight:1024},{type:"TileMatrixType",identifier:"11",scaleDenominator:68247.34668319287,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2048,matrixHeight:2048},{type:"TileMatrixType",identifier:"12",scaleDenominator:34123.67334159643,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:4096,matrixHeight:4096},{type:"TileMatrixType",identifier:"13",scaleDenominator:17061.836670798217,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:8192,matrixHeight:8192},{type:"TileMatrixType",identifier:"14",scaleDenominator:8530.918335399108,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:16384,matrixHeight:16384},{type:"TileMatrixType",identifier:"15",scaleDenominator:4265.459167699554,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:32768,matrixHeight:32768},{type:"TileMatrixType",identifier:"16",scaleDenominator:2132.729583849777,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:65536,matrixHeight:65536},{type:"TileMatrixType",identifier:"17",scaleDenominator:1066.3647919248886,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:131072,matrixHeight:131072},{type:"TileMatrixType",identifier:"18",scaleDenominator:533.1823959624443,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:262144,matrixHeight:262144},{type:"TileMatrixType",identifier:"19",scaleDenominator:266.59119798122214,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:524288,matrixHeight:524288},{type:"TileMatrixType",identifier:"20",scaleDenominator:133.29559899061107,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:1048576,matrixHeight:1048576},{type:"TileMatrixType",identifier:"21",scaleDenominator:66.64779949530553,topLeftCorner:[104381901652e-4,-32605867284e-4],tileWidth:256,tileHeight:256,matrixWidth:2097152,matrixHeight:2097152}]}});var M0=xa(Uf=>{"use strict";E();Object.defineProperty(Uf,"__esModule",{value:!0});Uf.Nztm2000=void 0;Uf.Nztm2000={type:"TileMatrixSetType",title:"LINZ NZTM2000 Map Tile Grid",abstract:"See https://www.linz.govt.nz/data/linz-data-service/guides-and-documentation/nztm2000-map-tile-service-schema",identifier:"NZTM2000",supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/2193",boundingBox:{type:"BoundingBoxType",crs:"https://www.opengis.net/def/crs/EPSG/0/2193",lowerCorner:[3087e3,274e3],upperCorner:[7173e3,3327e3]},tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:32e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:4},{type:"TileMatrixType",identifier:"1",scaleDenominator:16e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:8},{type:"TileMatrixType",identifier:"2",scaleDenominator:8e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:16},{type:"TileMatrixType",identifier:"3",scaleDenominator:4e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:32},{type:"TileMatrixType",identifier:"4",scaleDenominator:2e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:64},{type:"TileMatrixType",identifier:"5",scaleDenominator:1e6,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:128},{type:"TileMatrixType",identifier:"6",scaleDenominator:5e5,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:256},{type:"TileMatrixType",identifier:"7",scaleDenominator:25e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:512},{type:"TileMatrixType",identifier:"8",scaleDenominator:1e5,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:640,matrixHeight:1280},{type:"TileMatrixType",identifier:"9",scaleDenominator:5e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:1280,matrixHeight:2560},{type:"TileMatrixType",identifier:"10",scaleDenominator:25e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:2560,matrixHeight:5120},{type:"TileMatrixType",identifier:"11",scaleDenominator:1e4,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:6400,matrixHeight:12800},{type:"TileMatrixType",identifier:"12",scaleDenominator:5e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:12800,matrixHeight:25600},{type:"TileMatrixType",identifier:"13",scaleDenominator:2500,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:25600,matrixHeight:51200},{type:"TileMatrixType",identifier:"14",scaleDenominator:1e3,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:64e3,matrixHeight:128e3},{type:"TileMatrixType",identifier:"15",scaleDenominator:500,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:128e3,matrixHeight:256e3},{type:"TileMatrixType",identifier:"16",scaleDenominator:250,topLeftCorner:[1e7,-1e6],tileWidth:256,tileHeight:256,matrixWidth:256e3,matrixHeight:512e3}]}});var I0=xa(eh=>{"use strict";E();Object.defineProperty(eh,"__esModule",{value:!0});eh.Nztm2000=eh.Nztm2000Quad=void 0;var aE=T0();Object.defineProperty(eh,"Nztm2000Quad",{enumerable:!0,get:function(){return aE.Nztm2000Quad}});var sE=M0();Object.defineProperty(eh,"Nztm2000",{enumerable:!0,get:function(){return sE.Nztm2000}})});var A0=xa(os=>{"use strict";E();Object.defineProperty(os,"__esModule",{value:!0});os.once=os.Emitter=os.ALL_EVENTS=void 0;os.ALL_EVENTS=Symbol("ALL_EVENTS");function lE(r,n){return r.add(n),function(){return r.delete(n)}}function C0(r,...n){if(r)for(let{fn:s}of r)s(...n)}var Jm=class{constructor(){this.$=Object.create(null)}on(n,s){let p=this.$[n]=this.$[n]||new Set;return lE(p,{fn:s})}emit(n,...s){C0(this.$[n],...s),C0(this.$[os.ALL_EVENTS],{type:n,args:s})}};os.Emitter=Jm;function uE(r,n,s){let p=r.on(n,function(...m){return p(),s(...m)});return p}os.once=uE});var L0=xa((VL,P0)=>{"use strict";E();P0.exports=Vf;Vf.polyline=Vf;Vf.polygon=cE;function Vf(r,n,s){var p=r.length,i=nh(r[0],n),m=[],v,b,M,z,C;for(s||(s=[]),v=1;v<p;v++){for(b=r[v-1],M=r[v],z=C=nh(M,n);;)if(i|z){if(i&z)break;i?(b=$m(b,M,i,n),i=nh(b,n)):(M=$m(b,M,z,n),z=nh(M,n))}else{m.push(b),z!==C?(m.push(M),v<p-1&&(s.push(m),m=[])):v===p-1&&m.push(M);break}i=C}return m.length&&s.push(m),s}function cE(r,n){var s,p,i,m,v,b,M;for(p=1;p<=8;p*=2){for(s=[],i=r[r.length-1],m=!(nh(i,n)&p),v=0;v<r.length;v++)b=r[v],M=!(nh(b,n)&p),M!==m&&s.push($m(i,b,p,n)),M&&s.push(b),i=b,m=M;if(r=s,!r.length)break}return s}function $m(r,n,s,p){return s&8?[r[0]+(n[0]-r[0])*(p[3]-r[1])/(n[1]-r[1]),p[3]]:s&4?[r[0]+(n[0]-r[0])*(p[1]-r[1])/(n[1]-r[1]),p[1]]:s&2?[p[2],r[1]+(n[1]-r[1])*(p[2]-r[0])/(n[0]-r[0])]:s&1?[p[0],r[1]+(n[1]-r[1])*(p[0]-r[0])/(n[0]-r[0])]:null}function nh(r,n){var s=0;return r[0]<n[0]?s|=1:r[0]>n[2]&&(s|=2),r[1]<n[1]?s|=4:r[1]>n[3]&&(s|=8),s}});var k0=xa((ty,ey)=>{E();(function(r,n){typeof ty=="object"&&typeof ey<"u"?ey.exports=n():typeof define=="function"&&define.amd?define(n):(r=typeof globalThis<"u"?globalThis:r||self,r.polygonClipping=n())})(ty,function(){"use strict";function r(bt,q){if(!(bt instanceof q))throw new TypeError("Cannot call a class as a function")}function n(bt,q){for(var F=0;F<q.length;F++){var W=q[F];W.enumerable=W.enumerable||!1,W.configurable=!0,"value"in W&&(W.writable=!0),Object.defineProperty(bt,W.key,W)}}function s(bt,q,F){return q&&n(bt.prototype,q),F&&n(bt,F),bt}var p=function(){function bt(q,F){this.next=null,this.key=q,this.data=F,this.left=null,this.right=null}return bt}();function i(bt,q){return bt>q?1:bt<q?-1:0}function m(bt,q,F){for(var W=new p(null,null),nt=W,dt=W;;){var Mt=F(bt,q.key);if(Mt<0){if(q.left===null)break;if(F(bt,q.left.key)<0){var Dt=q.left;if(q.left=Dt.right,Dt.right=q,q=Dt,q.left===null)break}dt.left=q,dt=q,q=q.left}else if(Mt>0){if(q.right===null)break;if(F(bt,q.right.key)>0){var Dt=q.right;if(q.right=Dt.left,Dt.left=q,q=Dt,q.right===null)break}nt.right=q,nt=q,q=q.right}else break}return nt.right=q.left,dt.left=q.right,q.left=W.right,q.right=W.left,q}function v(bt,q,F,W){var nt=new p(bt,q);if(F===null)return nt.left=nt.right=null,nt;F=m(bt,F,W);var dt=W(bt,F.key);return dt<0?(nt.left=F.left,nt.right=F,F.left=null):dt>=0&&(nt.right=F.right,nt.left=F,F.right=null),nt}function b(bt,q,F){var W=null,nt=null;if(q){q=m(bt,q,F);var dt=F(q.key,bt);dt===0?(W=q.left,nt=q.right):dt<0?(nt=q.right,q.right=null,W=q):(W=q.left,q.left=null,nt=q)}return{left:W,right:nt}}function M(bt,q,F){return q===null?bt:(bt===null||(q=m(bt.key,q,F),q.left=bt),q)}function z(bt,q,F,W,nt){if(bt){W(""+q+(F?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+nt(bt)+`
|
|
2
|
+
`);var dt=q+(F?" ":"\u2502 ");bt.left&&z(bt.left,dt,!1,W,nt),bt.right&&z(bt.right,dt,!0,W,nt)}}var C=function(){function bt(q){q===void 0&&(q=i),this._root=null,this._size=0,this._comparator=q}return bt.prototype.insert=function(q,F){return this._size++,this._root=v(q,F,this._root,this._comparator)},bt.prototype.add=function(q,F){var W=new p(q,F);this._root===null&&(W.left=W.right=null,this._size++,this._root=W);var nt=this._comparator,dt=m(q,this._root,nt),Mt=nt(q,dt.key);return Mt===0?this._root=dt:(Mt<0?(W.left=dt.left,W.right=dt,dt.left=null):Mt>0&&(W.right=dt.right,W.left=dt,dt.right=null),this._size++,this._root=W),this._root},bt.prototype.remove=function(q){this._root=this._remove(q,this._root,this._comparator)},bt.prototype._remove=function(q,F,W){var nt;if(F===null)return null;F=m(q,F,W);var dt=W(q,F.key);return dt===0?(F.left===null?nt=F.right:(nt=m(q,F.left,W),nt.right=F.right),this._size--,nt):F},bt.prototype.pop=function(){var q=this._root;if(q){for(;q.left;)q=q.left;return this._root=m(q.key,this._root,this._comparator),this._root=this._remove(q.key,this._root,this._comparator),{key:q.key,data:q.data}}return null},bt.prototype.findStatic=function(q){for(var F=this._root,W=this._comparator;F;){var nt=W(q,F.key);if(nt===0)return F;nt<0?F=F.left:F=F.right}return null},bt.prototype.find=function(q){return this._root&&(this._root=m(q,this._root,this._comparator),this._comparator(q,this._root.key)!==0)?null:this._root},bt.prototype.contains=function(q){for(var F=this._root,W=this._comparator;F;){var nt=W(q,F.key);if(nt===0)return!0;nt<0?F=F.left:F=F.right}return!1},bt.prototype.forEach=function(q,F){for(var W=this._root,nt=[],dt=!1;!dt;)W!==null?(nt.push(W),W=W.left):nt.length!==0?(W=nt.pop(),q.call(F,W),W=W.right):dt=!0;return this},bt.prototype.range=function(q,F,W,nt){for(var dt=[],Mt=this._comparator,Dt=this._root,Vt;dt.length!==0||Dt;)if(Dt)dt.push(Dt),Dt=Dt.left;else{if(Dt=dt.pop(),Vt=Mt(Dt.key,F),Vt>0)break;if(Mt(Dt.key,q)>=0&&W.call(nt,Dt))return this;Dt=Dt.right}return this},bt.prototype.keys=function(){var q=[];return this.forEach(function(F){var W=F.key;return q.push(W)}),q},bt.prototype.values=function(){var q=[];return this.forEach(function(F){var W=F.data;return q.push(W)}),q},bt.prototype.min=function(){return this._root?this.minNode(this._root).key:null},bt.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},bt.prototype.minNode=function(q){if(q===void 0&&(q=this._root),q)for(;q.left;)q=q.left;return q},bt.prototype.maxNode=function(q){if(q===void 0&&(q=this._root),q)for(;q.right;)q=q.right;return q},bt.prototype.at=function(q){for(var F=this._root,W=!1,nt=0,dt=[];!W;)if(F)dt.push(F),F=F.left;else if(dt.length>0){if(F=dt.pop(),nt===q)return F;nt++,F=F.right}else W=!0;return null},bt.prototype.next=function(q){var F=this._root,W=null;if(q.right){for(W=q.right;W.left;)W=W.left;return W}for(var nt=this._comparator;F;){var dt=nt(q.key,F.key);if(dt===0)break;dt<0?(W=F,F=F.left):F=F.right}return W},bt.prototype.prev=function(q){var F=this._root,W=null;if(q.left!==null){for(W=q.left;W.right;)W=W.right;return W}for(var nt=this._comparator;F;){var dt=nt(q.key,F.key);if(dt===0)break;dt<0?F=F.left:(W=F,F=F.right)}return W},bt.prototype.clear=function(){return this._root=null,this._size=0,this},bt.prototype.toList=function(){return ot(this._root)},bt.prototype.load=function(q,F,W){F===void 0&&(F=[]),W===void 0&&(W=!1);var nt=q.length,dt=this._comparator;if(W&&ft(q,F,0,nt-1,dt),this._root===null)this._root=j(q,F,0,nt),this._size=nt;else{var Mt=mt(this.toList(),Y(q,F),dt);nt=this._size+nt,this._root=J({head:Mt},0,nt)}return this},bt.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(bt.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(bt.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),bt.prototype.toString=function(q){q===void 0&&(q=function(nt){return String(nt.key)});var F=[];return z(this._root,"",!0,function(W){return F.push(W)},q),F.join("")},bt.prototype.update=function(q,F,W){var nt=this._comparator,dt=b(q,this._root,nt),Mt=dt.left,Dt=dt.right;nt(q,F)<0?Dt=v(F,W,Dt,nt):Mt=v(F,W,Mt,nt),this._root=M(Mt,Dt,nt)},bt.prototype.split=function(q){return b(q,this._root,this._comparator)},bt}();function j(bt,q,F,W){var nt=W-F;if(nt>0){var dt=F+Math.floor(nt/2),Mt=bt[dt],Dt=q[dt],Vt=new p(Mt,Dt);return Vt.left=j(bt,q,F,dt),Vt.right=j(bt,q,dt+1,W),Vt}return null}function Y(bt,q){for(var F=new p(null,null),W=F,nt=0;nt<bt.length;nt++)W=W.next=new p(bt[nt],q[nt]);return W.next=null,F.next}function ot(bt){for(var q=bt,F=[],W=!1,nt=new p(null,null),dt=nt;!W;)q?(F.push(q),q=q.left):F.length>0?(q=dt=dt.next=F.pop(),q=q.right):W=!0;return dt.next=null,nt.next}function J(bt,q,F){var W=F-q;if(W>0){var nt=q+Math.floor(W/2),dt=J(bt,q,nt),Mt=bt.head;return Mt.left=dt,bt.head=bt.head.next,Mt.right=J(bt,nt+1,F),Mt}return null}function mt(bt,q,F){for(var W=new p(null,null),nt=W,dt=bt,Mt=q;dt!==null&&Mt!==null;)F(dt.key,Mt.key)<0?(nt.next=dt,dt=dt.next):(nt.next=Mt,Mt=Mt.next),nt=nt.next;return dt!==null?nt.next=dt:Mt!==null&&(nt.next=Mt),W.next}function ft(bt,q,F,W,nt){if(!(F>=W)){for(var dt=bt[F+W>>1],Mt=F-1,Dt=W+1;;){do Mt++;while(nt(bt[Mt],dt)<0);do Dt--;while(nt(bt[Dt],dt)>0);if(Mt>=Dt)break;var Vt=bt[Mt];bt[Mt]=bt[Dt],bt[Dt]=Vt,Vt=q[Mt],q[Mt]=q[Dt],q[Dt]=Vt}ft(bt,q,F,Dt,nt),ft(bt,q,Dt+1,W,nt)}}var At=function(q,F){return q.ll.x<=F.x&&F.x<=q.ur.x&&q.ll.y<=F.y&&F.y<=q.ur.y},Gt=function(q,F){if(F.ur.x<q.ll.x||q.ur.x<F.ll.x||F.ur.y<q.ll.y||q.ur.y<F.ll.y)return null;var W=q.ll.x<F.ll.x?F.ll.x:q.ll.x,nt=q.ur.x<F.ur.x?q.ur.x:F.ur.x,dt=q.ll.y<F.ll.y?F.ll.y:q.ll.y,Mt=q.ur.y<F.ur.y?q.ur.y:F.ur.y;return{ll:{x:W,y:dt},ur:{x:nt,y:Mt}}},Zt=Number.EPSILON;Zt===void 0&&(Zt=Math.pow(2,-52));var we=Zt*Zt,he=function(q,F){if(-Zt<q&&q<Zt&&-Zt<F&&F<Zt)return 0;var W=q-F;return W*W<we*q*F?0:q<F?-1:1},Kt=function(){function bt(){r(this,bt),this.reset()}return s(bt,[{key:"reset",value:function(){this.xRounder=new ce,this.yRounder=new ce}},{key:"round",value:function(F,W){return{x:this.xRounder.round(F),y:this.yRounder.round(W)}}}]),bt}(),ce=function(){function bt(){r(this,bt),this.tree=new C,this.round(0)}return s(bt,[{key:"round",value:function(F){var W=this.tree.add(F),nt=this.tree.prev(W);if(nt!==null&&he(W.key,nt.key)===0)return this.tree.remove(F),nt.key;var dt=this.tree.next(W);return dt!==null&&he(W.key,dt.key)===0?(this.tree.remove(F),dt.key):F}}]),bt}(),Yt=new Kt,Te=function(q,F){return q.x*F.y-q.y*F.x},dr=function(q,F){return q.x*F.x+q.y*F.y},Le=function(q,F,W){var nt={x:F.x-q.x,y:F.y-q.y},dt={x:W.x-q.x,y:W.y-q.y},Mt=Te(nt,dt);return he(Mt,0)},hr=function(q){return Math.sqrt(dr(q,q))},Ur=function(q,F,W){var nt={x:F.x-q.x,y:F.y-q.y},dt={x:W.x-q.x,y:W.y-q.y};return Te(dt,nt)/hr(dt)/hr(nt)},Gr=function(q,F,W){var nt={x:F.x-q.x,y:F.y-q.y},dt={x:W.x-q.x,y:W.y-q.y};return dr(dt,nt)/hr(dt)/hr(nt)},_n=function(q,F,W){return F.y===0?null:{x:q.x+F.x/F.y*(W-q.y),y:W}},Cr=function(q,F,W){return F.x===0?null:{x:W,y:q.y+F.y/F.x*(W-q.x)}},te=function(q,F,W,nt){if(F.x===0)return Cr(W,nt,q.x);if(nt.x===0)return Cr(q,F,W.x);if(F.y===0)return _n(W,nt,q.y);if(nt.y===0)return _n(q,F,W.y);var dt=Te(F,nt);if(dt==0)return null;var Mt={x:W.x-q.x,y:W.y-q.y},Dt=Te(Mt,F)/dt,Vt=Te(Mt,nt)/dt,ye=q.x+Vt*F.x,Ae=W.x+Dt*nt.x,qe=q.y+Vt*F.y,Ge=W.y+Dt*nt.y,Xe=(ye+Ae)/2,yr=(qe+Ge)/2;return{x:Xe,y:yr}},ae=function(){s(bt,null,[{key:"compare",value:function(F,W){var nt=bt.comparePoints(F.point,W.point);return nt!==0?nt:(F.point!==W.point&&F.link(W),F.isLeft!==W.isLeft?F.isLeft?1:-1:Ne.compare(F.segment,W.segment))}},{key:"comparePoints",value:function(F,W){return F.x<W.x?-1:F.x>W.x?1:F.y<W.y?-1:F.y>W.y?1:0}}]);function bt(q,F){r(this,bt),q.events===void 0?q.events=[this]:q.events.push(this),this.point=q,this.isLeft=F}return s(bt,[{key:"link",value:function(F){if(F.point===this.point)throw new Error("Tried to link already linked events");for(var W=F.point.events,nt=0,dt=W.length;nt<dt;nt++){var Mt=W[nt];this.point.events.push(Mt),Mt.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var F=this.point.events.length,W=0;W<F;W++){var nt=this.point.events[W];if(nt.segment.consumedBy===void 0)for(var dt=W+1;dt<F;dt++){var Mt=this.point.events[dt];Mt.consumedBy===void 0&&nt.otherSE.point.events===Mt.otherSE.point.events&&nt.segment.consume(Mt.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var F=[],W=0,nt=this.point.events.length;W<nt;W++){var dt=this.point.events[W];dt!==this&&!dt.segment.ringOut&&dt.segment.isInResult()&&F.push(dt)}return F}},{key:"getLeftmostComparator",value:function(F){var W=this,nt=new Map,dt=function(Dt){var Vt=Dt.otherSE;nt.set(Dt,{sine:Ur(W.point,F.point,Vt.point),cosine:Gr(W.point,F.point,Vt.point)})};return function(Mt,Dt){nt.has(Mt)||dt(Mt),nt.has(Dt)||dt(Dt);var Vt=nt.get(Mt),ye=Vt.sine,Ae=Vt.cosine,qe=nt.get(Dt),Ge=qe.sine,Xe=qe.cosine;return ye>=0&&Ge>=0?Ae<Xe?1:Ae>Xe?-1:0:ye<0&&Ge<0?Ae<Xe?-1:Ae>Xe?1:0:Ge<ye?-1:Ge>ye?1:0}}}]),bt}(),me=0,Ne=function(){s(bt,null,[{key:"compare",value:function(F,W){var nt=F.leftSE.point.x,dt=W.leftSE.point.x,Mt=F.rightSE.point.x,Dt=W.rightSE.point.x;if(Dt<nt)return 1;if(Mt<dt)return-1;var Vt=F.leftSE.point.y,ye=W.leftSE.point.y,Ae=F.rightSE.point.y,qe=W.rightSE.point.y;if(nt<dt){if(ye<Vt&&ye<Ae)return 1;if(ye>Vt&&ye>Ae)return-1;var Ge=F.comparePoint(W.leftSE.point);if(Ge<0)return 1;if(Ge>0)return-1;var Xe=W.comparePoint(F.rightSE.point);return Xe!==0?Xe:-1}if(nt>dt){if(Vt<ye&&Vt<qe)return-1;if(Vt>ye&&Vt>qe)return 1;var yr=W.comparePoint(F.leftSE.point);if(yr!==0)return yr;var ar=F.comparePoint(W.rightSE.point);return ar<0?1:ar>0?-1:1}if(Vt<ye)return-1;if(Vt>ye)return 1;if(Mt<Dt){var ur=W.comparePoint(F.rightSE.point);if(ur!==0)return ur}if(Mt>Dt){var $r=F.comparePoint(W.rightSE.point);if($r<0)return 1;if($r>0)return-1}if(Mt!==Dt){var Vr=Ae-Vt,yi=Mt-nt,Yr=qe-ye,gi=Dt-dt;if(Vr>yi&&Yr<gi)return 1;if(Vr<yi&&Yr>gi)return-1}return Mt>Dt?1:Mt<Dt||Ae<qe?-1:Ae>qe?1:F.id<W.id?-1:F.id>W.id?1:0}}]);function bt(q,F,W,nt){r(this,bt),this.id=++me,this.leftSE=q,q.segment=this,q.otherSE=F,this.rightSE=F,F.segment=this,F.otherSE=q,this.rings=W,this.windings=nt}return s(bt,[{key:"replaceRightSE",value:function(F){this.rightSE=F,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var F=this.leftSE.point.y,W=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:F<W?F:W},ur:{x:this.rightSE.point.x,y:F>W?F:W}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(F){return F.x===this.leftSE.point.x&&F.y===this.leftSE.point.y||F.x===this.rightSE.point.x&&F.y===this.rightSE.point.y}},{key:"comparePoint",value:function(F){if(this.isAnEndpoint(F))return 0;var W=this.leftSE.point,nt=this.rightSE.point,dt=this.vector();if(W.x===nt.x)return F.x===W.x?0:F.x<W.x?1:-1;var Mt=(F.y-W.y)/dt.y,Dt=W.x+Mt*dt.x;if(F.x===Dt)return 0;var Vt=(F.x-W.x)/dt.x,ye=W.y+Vt*dt.y;return F.y===ye?0:F.y<ye?-1:1}},{key:"getIntersection",value:function(F){var W=this.bbox(),nt=F.bbox(),dt=Gt(W,nt);if(dt===null)return null;var Mt=this.leftSE.point,Dt=this.rightSE.point,Vt=F.leftSE.point,ye=F.rightSE.point,Ae=At(W,Vt)&&this.comparePoint(Vt)===0,qe=At(nt,Mt)&&F.comparePoint(Mt)===0,Ge=At(W,ye)&&this.comparePoint(ye)===0,Xe=At(nt,Dt)&&F.comparePoint(Dt)===0;if(qe&&Ae)return Xe&&!Ge?Dt:!Xe&&Ge?ye:null;if(qe)return Ge&&Mt.x===ye.x&&Mt.y===ye.y?null:Mt;if(Ae)return Xe&&Dt.x===Vt.x&&Dt.y===Vt.y?null:Vt;if(Xe&&Ge)return null;if(Xe)return Dt;if(Ge)return ye;var yr=te(Mt,this.vector(),Vt,F.vector());return yr===null||!At(dt,yr)?null:Yt.round(yr.x,yr.y)}},{key:"split",value:function(F){var W=[],nt=F.events!==void 0,dt=new ae(F,!0),Mt=new ae(F,!1),Dt=this.rightSE;this.replaceRightSE(Mt),W.push(Mt),W.push(dt);var Vt=new bt(dt,Dt,this.rings.slice(),this.windings.slice());return ae.comparePoints(Vt.leftSE.point,Vt.rightSE.point)>0&&Vt.swapEvents(),ae.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),nt&&(dt.checkForConsuming(),Mt.checkForConsuming()),W}},{key:"swapEvents",value:function(){var F=this.rightSE;this.rightSE=this.leftSE,this.leftSE=F,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var W=0,nt=this.windings.length;W<nt;W++)this.windings[W]*=-1}},{key:"consume",value:function(F){for(var W=this,nt=F;W.consumedBy;)W=W.consumedBy;for(;nt.consumedBy;)nt=nt.consumedBy;var dt=bt.compare(W,nt);if(dt!==0){if(dt>0){var Mt=W;W=nt,nt=Mt}if(W.prev===nt){var Dt=W;W=nt,nt=Dt}for(var Vt=0,ye=nt.rings.length;Vt<ye;Vt++){var Ae=nt.rings[Vt],qe=nt.windings[Vt],Ge=W.rings.indexOf(Ae);Ge===-1?(W.rings.push(Ae),W.windings.push(qe)):W.windings[Ge]+=qe}nt.rings=null,nt.windings=null,nt.consumedBy=W,nt.leftSE.consumedBy=W.leftSE,nt.rightSE.consumedBy=W.rightSE}}},{key:"prevInResult",value:function(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var F=this.prev.consumedBy||this.prev;this._beforeState=F.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var F=this.beforeState();this._afterState={rings:F.rings.slice(0),windings:F.windings.slice(0),multiPolys:[]};for(var W=this._afterState.rings,nt=this._afterState.windings,dt=this._afterState.multiPolys,Mt=0,Dt=this.rings.length;Mt<Dt;Mt++){var Vt=this.rings[Mt],ye=this.windings[Mt],Ae=W.indexOf(Vt);Ae===-1?(W.push(Vt),nt.push(ye)):nt[Ae]+=ye}for(var qe=[],Ge=[],Xe=0,yr=W.length;Xe<yr;Xe++)if(nt[Xe]!==0){var ar=W[Xe],ur=ar.poly;if(Ge.indexOf(ur)===-1)if(ar.isExterior)qe.push(ur);else{Ge.indexOf(ur)===-1&&Ge.push(ur);var $r=qe.indexOf(ar.poly);$r!==-1&&qe.splice($r,1)}}for(var Vr=0,yi=qe.length;Vr<yi;Vr++){var Yr=qe[Vr].multiPoly;dt.indexOf(Yr)===-1&&dt.push(Yr)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var F=this.beforeState().multiPolys,W=this.afterState().multiPolys;switch(Ce.type){case"union":{var nt=F.length===0,dt=W.length===0;this._isInResult=nt!==dt;break}case"intersection":{var Mt,Dt;F.length<W.length?(Mt=F.length,Dt=W.length):(Mt=W.length,Dt=F.length),this._isInResult=Dt===Ce.numMultiPolys&&Mt<Dt;break}case"xor":{var Vt=Math.abs(F.length-W.length);this._isInResult=Vt%2===1;break}case"difference":{var ye=function(qe){return qe.length===1&&qe[0].isSubject};this._isInResult=ye(F)!==ye(W);break}default:throw new Error("Unrecognized operation type found ".concat(Ce.type))}return this._isInResult}}],[{key:"fromRing",value:function(F,W,nt){var dt,Mt,Dt,Vt=ae.comparePoints(F,W);if(Vt<0)dt=F,Mt=W,Dt=1;else if(Vt>0)dt=W,Mt=F,Dt=-1;else throw new Error("Tried to create degenerate segment at [".concat(F.x,", ").concat(F.y,"]"));var ye=new ae(dt,!0),Ae=new ae(Mt,!1);return new bt(ye,Ae,[nt],[Dt])}}]),bt}(),Qe=function(){function bt(q,F,W){if(r(this,bt),!Array.isArray(q)||q.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=F,this.isExterior=W,this.segments=[],typeof q[0][0]!="number"||typeof q[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var nt=Yt.round(q[0][0],q[0][1]);this.bbox={ll:{x:nt.x,y:nt.y},ur:{x:nt.x,y:nt.y}};for(var dt=nt,Mt=1,Dt=q.length;Mt<Dt;Mt++){if(typeof q[Mt][0]!="number"||typeof q[Mt][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var Vt=Yt.round(q[Mt][0],q[Mt][1]);Vt.x===dt.x&&Vt.y===dt.y||(this.segments.push(Ne.fromRing(dt,Vt,this)),Vt.x<this.bbox.ll.x&&(this.bbox.ll.x=Vt.x),Vt.y<this.bbox.ll.y&&(this.bbox.ll.y=Vt.y),Vt.x>this.bbox.ur.x&&(this.bbox.ur.x=Vt.x),Vt.y>this.bbox.ur.y&&(this.bbox.ur.y=Vt.y),dt=Vt)}(nt.x!==dt.x||nt.y!==dt.y)&&this.segments.push(Ne.fromRing(dt,nt,this))}return s(bt,[{key:"getSweepEvents",value:function(){for(var F=[],W=0,nt=this.segments.length;W<nt;W++){var dt=this.segments[W];F.push(dt.leftSE),F.push(dt.rightSE)}return F}}]),bt}(),pi=function(){function bt(q,F){if(r(this,bt),!Array.isArray(q))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Qe(q[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var W=1,nt=q.length;W<nt;W++){var dt=new Qe(q[W],this,!1);dt.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=dt.bbox.ll.x),dt.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=dt.bbox.ll.y),dt.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=dt.bbox.ur.x),dt.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=dt.bbox.ur.y),this.interiorRings.push(dt)}this.multiPoly=F}return s(bt,[{key:"getSweepEvents",value:function(){for(var F=this.exteriorRing.getSweepEvents(),W=0,nt=this.interiorRings.length;W<nt;W++)for(var dt=this.interiorRings[W].getSweepEvents(),Mt=0,Dt=dt.length;Mt<Dt;Mt++)F.push(dt[Mt]);return F}}]),bt}(),Ai=function(){function bt(q,F){if(r(this,bt),!Array.isArray(q))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof q[0][0][0]=="number"&&(q=[q])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var W=0,nt=q.length;W<nt;W++){var dt=new pi(q[W],this);dt.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=dt.bbox.ll.x),dt.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=dt.bbox.ll.y),dt.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=dt.bbox.ur.x),dt.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=dt.bbox.ur.y),this.polys.push(dt)}this.isSubject=F}return s(bt,[{key:"getSweepEvents",value:function(){for(var F=[],W=0,nt=this.polys.length;W<nt;W++)for(var dt=this.polys[W].getSweepEvents(),Mt=0,Dt=dt.length;Mt<Dt;Mt++)F.push(dt[Mt]);return F}}]),bt}(),Ji=function(){s(bt,null,[{key:"factory",value:function(F){for(var W=[],nt=0,dt=F.length;nt<dt;nt++){var Mt=F[nt];if(!(!Mt.isInResult()||Mt.ringOut)){for(var Dt=null,Vt=Mt.leftSE,ye=Mt.rightSE,Ae=[Vt],qe=Vt.point,Ge=[];Dt=Vt,Vt=ye,Ae.push(Vt),Vt.point!==qe;)for(;;){var Xe=Vt.getAvailableLinkedEvents();if(Xe.length===0){var yr=Ae[0].point,ar=Ae[Ae.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(yr.x,",")+" ".concat(yr.y,"]. Last matching segment found ends at")+" [".concat(ar.x,", ").concat(ar.y,"]."))}if(Xe.length===1){ye=Xe[0].otherSE;break}for(var ur=null,$r=0,Vr=Ge.length;$r<Vr;$r++)if(Ge[$r].point===Vt.point){ur=$r;break}if(ur!==null){var yi=Ge.splice(ur)[0],Yr=Ae.splice(yi.index);Yr.unshift(Yr[0].otherSE),W.push(new bt(Yr.reverse()));continue}Ge.push({index:Ae.length,point:Vt.point});var gi=Vt.getLeftmostComparator(Dt);ye=Xe.sort(gi)[0].otherSE;break}W.push(new bt(Ae))}}return W}}]);function bt(q){r(this,bt),this.events=q;for(var F=0,W=q.length;F<W;F++)q[F].segment.ringOut=this;this.poly=null}return s(bt,[{key:"getGeom",value:function(){for(var F=this.events[0].point,W=[F],nt=1,dt=this.events.length-1;nt<dt;nt++){var Mt=this.events[nt].point,Dt=this.events[nt+1].point;Le(Mt,F,Dt)!==0&&(W.push(Mt),F=Mt)}if(W.length===1)return null;var Vt=W[0],ye=W[1];Le(Vt,F,ye)===0&&W.shift(),W.push(W[0]);for(var Ae=this.isExteriorRing()?1:-1,qe=this.isExteriorRing()?0:W.length-1,Ge=this.isExteriorRing()?W.length:-1,Xe=[],yr=qe;yr!=Ge;yr+=Ae)Xe.push([W[yr].x,W[yr].y]);return Xe}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var F=this.enclosingRing();this._isExteriorRing=F?!F.isExteriorRing():!0}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var F=this.events[0],W=1,nt=this.events.length;W<nt;W++){var dt=this.events[W];ae.compare(F,dt)>0&&(F=dt)}for(var Mt=F.segment.prevInResult(),Dt=Mt?Mt.prevInResult():null;;){if(!Mt)return null;if(!Dt)return Mt.ringOut;if(Dt.ringOut!==Mt.ringOut)return Dt.ringOut.enclosingRing()!==Mt.ringOut?Mt.ringOut:Mt.ringOut.enclosingRing();Mt=Dt.prevInResult(),Dt=Mt?Mt.prevInResult():null}}}]),bt}(),ke=function(){function bt(q){r(this,bt),this.exteriorRing=q,q.poly=this,this.interiorRings=[]}return s(bt,[{key:"addInterior",value:function(F){this.interiorRings.push(F),F.poly=this}},{key:"getGeom",value:function(){var F=[this.exteriorRing.getGeom()];if(F[0]===null)return null;for(var W=0,nt=this.interiorRings.length;W<nt;W++){var dt=this.interiorRings[W].getGeom();dt!==null&&F.push(dt)}return F}}]),bt}(),cr=function(){function bt(q){r(this,bt),this.rings=q,this.polys=this._composePolys(q)}return s(bt,[{key:"getGeom",value:function(){for(var F=[],W=0,nt=this.polys.length;W<nt;W++){var dt=this.polys[W].getGeom();dt!==null&&F.push(dt)}return F}},{key:"_composePolys",value:function(F){for(var W=[],nt=0,dt=F.length;nt<dt;nt++){var Mt=F[nt];if(!Mt.poly)if(Mt.isExteriorRing())W.push(new ke(Mt));else{var Dt=Mt.enclosingRing();Dt.poly||W.push(new ke(Dt)),Dt.poly.addInterior(Mt)}}return W}}]),bt}(),We=function(){function bt(q){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ne.compare;r(this,bt),this.queue=q,this.tree=new C(F),this.segments=[]}return s(bt,[{key:"process",value:function(F){var W=F.segment,nt=[];if(F.consumedBy)return F.isLeft?this.queue.remove(F.otherSE):this.tree.remove(W),nt;var dt=F.isLeft?this.tree.insert(W):this.tree.find(W);if(!dt)throw new Error("Unable to find segment #".concat(W.id," ")+"[".concat(W.leftSE.point.x,", ").concat(W.leftSE.point.y,"] -> ")+"[".concat(W.rightSE.point.x,", ").concat(W.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var Mt=dt,Dt=dt,Vt=void 0,ye=void 0;Vt===void 0;)Mt=this.tree.prev(Mt),Mt===null?Vt=null:Mt.key.consumedBy===void 0&&(Vt=Mt.key);for(;ye===void 0;)Dt=this.tree.next(Dt),Dt===null?ye=null:Dt.key.consumedBy===void 0&&(ye=Dt.key);if(F.isLeft){var Ae=null;if(Vt){var qe=Vt.getIntersection(W);if(qe!==null&&(W.isAnEndpoint(qe)||(Ae=qe),!Vt.isAnEndpoint(qe)))for(var Ge=this._splitSafely(Vt,qe),Xe=0,yr=Ge.length;Xe<yr;Xe++)nt.push(Ge[Xe])}var ar=null;if(ye){var ur=ye.getIntersection(W);if(ur!==null&&(W.isAnEndpoint(ur)||(ar=ur),!ye.isAnEndpoint(ur)))for(var $r=this._splitSafely(ye,ur),Vr=0,yi=$r.length;Vr<yi;Vr++)nt.push($r[Vr])}if(Ae!==null||ar!==null){var Yr=null;if(Ae===null)Yr=ar;else if(ar===null)Yr=Ae;else{var gi=ae.comparePoints(Ae,ar);Yr=gi<=0?Ae:ar}this.queue.remove(W.rightSE),nt.push(W.rightSE);for(var An=W.split(Yr),Ni=0,Hi=An.length;Ni<Hi;Ni++)nt.push(An[Ni])}nt.length>0?(this.tree.remove(W),nt.push(F)):(this.segments.push(W),W.prev=Vt)}else{if(Vt&&ye){var vi=Vt.getIntersection(ye);if(vi!==null){if(!Vt.isAnEndpoint(vi))for(var xr=this._splitSafely(Vt,vi),k=0,O=xr.length;k<O;k++)nt.push(xr[k]);if(!ye.isAnEndpoint(vi))for(var B=this._splitSafely(ye,vi),H=0,rt=B.length;H<rt;H++)nt.push(B[H])}}this.tree.remove(W)}return nt}},{key:"_splitSafely",value:function(F,W){this.tree.remove(F);var nt=F.rightSE;this.queue.remove(nt);var dt=F.split(W);return dt.push(nt),F.consumedBy===void 0&&this.tree.insert(F),dt}}]),bt}(),oi=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,ln=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Oi=function(){function bt(){r(this,bt)}return s(bt,[{key:"run",value:function(F,W,nt){Ce.type=F,Yt.reset();for(var dt=[new Ai(W,!0)],Mt=0,Dt=nt.length;Mt<Dt;Mt++)dt.push(new Ai(nt[Mt],!1));if(Ce.numMultiPolys=dt.length,Ce.type==="difference")for(var Vt=dt[0],ye=1;ye<dt.length;)Gt(dt[ye].bbox,Vt.bbox)!==null?ye++:dt.splice(ye,1);if(Ce.type==="intersection"){for(var Ae=0,qe=dt.length;Ae<qe;Ae++)for(var Ge=dt[Ae],Xe=Ae+1,yr=dt.length;Xe<yr;Xe++)if(Gt(Ge.bbox,dt[Xe].bbox)===null)return[]}for(var ar=new C(ae.compare),ur=0,$r=dt.length;ur<$r;ur++)for(var Vr=dt[ur].getSweepEvents(),yi=0,Yr=Vr.length;yi<Yr;yi++)if(ar.insert(Vr[yi]),ar.size>oi)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var gi=new We(ar),An=ar.size,Ni=ar.pop();Ni;){var Hi=Ni.key;if(ar.size===An){var vi=Hi.segment;throw new Error("Unable to pop() ".concat(Hi.isLeft?"left":"right"," SweepEvent ")+"[".concat(Hi.point.x,", ").concat(Hi.point.y,"] from segment #").concat(vi.id," ")+"[".concat(vi.leftSE.point.x,", ").concat(vi.leftSE.point.y,"] -> ")+"[".concat(vi.rightSE.point.x,", ").concat(vi.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(ar.size>oi)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(gi.segments.length>ln)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var xr=gi.process(Hi),k=0,O=xr.length;k<O;k++){var B=xr[k];B.consumedBy===void 0&&ar.insert(B)}An=ar.size,Ni=ar.pop()}Yt.reset();var H=Ji.factory(gi.segments),rt=new cr(H);return rt.getGeom()}}]),bt}(),Ce=new Oi,Cn=function(q){for(var F=arguments.length,W=new Array(F>1?F-1:0),nt=1;nt<F;nt++)W[nt-1]=arguments[nt];return Ce.run("union",q,W)},Ar=function(q){for(var F=arguments.length,W=new Array(F>1?F-1:0),nt=1;nt<F;nt++)W[nt-1]=arguments[nt];return Ce.run("intersection",q,W)},Ki=function(q){for(var F=arguments.length,W=new Array(F>1?F-1:0),nt=1;nt<F;nt++)W[nt-1]=arguments[nt];return Ce.run("xor",q,W)},zo=function(q){for(var F=arguments.length,W=new Array(F>1?F-1:0),nt=1;nt<F;nt++)W[nt-1]=arguments[nt];return Ce.run("difference",q,W)},Qi={union:Cn,intersection:Ar,xor:Ki,difference:zo};return Qi})});var Ci=xa((UD,bx)=>{"use strict";E();var xx=Object.getOwnPropertySymbols,KI=Object.prototype.hasOwnProperty,HI=Object.prototype.propertyIsEnumerable;function ZI(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function XI(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var n={},s=0;s<10;s++)n["_"+String.fromCharCode(s)]=s;var p=Object.getOwnPropertyNames(n).map(function(m){return n[m]});if(p.join("")!=="0123456789")return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(m){i[m]=m}),Object.keys(Object.assign({},i)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}bx.exports=XI()?Object.assign:function(r,n){for(var s,p=ZI(r),i,m=1;m<arguments.length;m++){s=Object(arguments[m]);for(var v in s)KI.call(s,v)&&(p[v]=s[v]);if(xx){i=xx(s);for(var b=0;b<i.length;b++)HI.call(s,i[b])&&(p[i[b]]=s[i[b]])}}return p}});var Ly=xa((F8,h1)=>{"use strict";E();var Eh=typeof Reflect=="object"?Reflect:null,e1=Eh&&typeof Eh.apply=="function"?Eh.apply:function(n,s,p){return Function.prototype.apply.call(n,s,p)},_d;Eh&&typeof Eh.ownKeys=="function"?_d=Eh.ownKeys:Object.getOwnPropertySymbols?_d=function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:_d=function(n){return Object.getOwnPropertyNames(n)};function CC(r){console&&console.warn&&console.warn(r)}var i1=Number.isNaN||function(n){return n!==n};function Xr(){Xr.init.call(this)}h1.exports=Xr;Xr.EventEmitter=Xr;Xr.prototype._events=void 0;Xr.prototype._eventsCount=0;Xr.prototype._maxListeners=void 0;var r1=10;function xd(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(Xr,"defaultMaxListeners",{enumerable:!0,get:function(){return r1},set:function(r){if(typeof r!="number"||r<0||i1(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");r1=r}});Xr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Xr.prototype.setMaxListeners=function(n){if(typeof n!="number"||n<0||i1(n))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+n+".");return this._maxListeners=n,this};function n1(r){return r._maxListeners===void 0?Xr.defaultMaxListeners:r._maxListeners}Xr.prototype.getMaxListeners=function(){return n1(this)};Xr.prototype.emit=function(n){for(var s=[],p=1;p<arguments.length;p++)s.push(arguments[p]);var i=n==="error",m=this._events;if(m!==void 0)i=i&&m.error===void 0;else if(!i)return!1;if(i){var v;if(s.length>0&&(v=s[0]),v instanceof Error)throw v;var b=new Error("Unhandled error."+(v?" ("+v.message+")":""));throw b.context=v,b}var M=m[n];if(M===void 0)return!1;if(typeof M=="function")e1(M,this,s);else for(var z=M.length,C=u1(M,z),p=0;p<z;++p)e1(C[p],this,s);return!0};function o1(r,n,s,p){var i,m,v;if(xd(s),m=r._events,m===void 0?(m=r._events=Object.create(null),r._eventsCount=0):(m.newListener!==void 0&&(r.emit("newListener",n,s.listener?s.listener:s),m=r._events),v=m[n]),v===void 0)v=m[n]=s,++r._eventsCount;else if(typeof v=="function"?v=m[n]=p?[s,v]:[v,s]:p?v.unshift(s):v.push(s),i=n1(r),i>0&&v.length>i&&!v.warned){v.warned=!0;var b=new Error("Possible EventEmitter memory leak detected. "+v.length+" "+String(n)+" listeners added. Use emitter.setMaxListeners() to increase limit");b.name="MaxListenersExceededWarning",b.emitter=r,b.type=n,b.count=v.length,CC(b)}return r}Xr.prototype.addListener=function(n,s){return o1(this,n,s,!1)};Xr.prototype.on=Xr.prototype.addListener;Xr.prototype.prependListener=function(n,s){return o1(this,n,s,!0)};function AC(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function a1(r,n,s){var p={fired:!1,wrapFn:void 0,target:r,type:n,listener:s},i=AC.bind(p);return i.listener=s,p.wrapFn=i,i}Xr.prototype.once=function(n,s){return xd(s),this.on(n,a1(this,n,s)),this};Xr.prototype.prependOnceListener=function(n,s){return xd(s),this.prependListener(n,a1(this,n,s)),this};Xr.prototype.removeListener=function(n,s){var p,i,m,v,b;if(xd(s),i=this._events,i===void 0)return this;if(p=i[n],p===void 0)return this;if(p===s||p.listener===s)--this._eventsCount===0?this._events=Object.create(null):(delete i[n],i.removeListener&&this.emit("removeListener",n,p.listener||s));else if(typeof p!="function"){for(m=-1,v=p.length-1;v>=0;v--)if(p[v]===s||p[v].listener===s){b=p[v].listener,m=v;break}if(m<0)return this;m===0?p.shift():PC(p,m),p.length===1&&(i[n]=p[0]),i.removeListener!==void 0&&this.emit("removeListener",n,b||s)}return this};Xr.prototype.off=Xr.prototype.removeListener;Xr.prototype.removeAllListeners=function(n){var s,p,i;if(p=this._events,p===void 0)return this;if(p.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):p[n]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete p[n]),this;if(arguments.length===0){var m=Object.keys(p),v;for(i=0;i<m.length;++i)v=m[i],v!=="removeListener"&&this.removeAllListeners(v);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(s=p[n],typeof s=="function")this.removeListener(n,s);else if(s!==void 0)for(i=s.length-1;i>=0;i--)this.removeListener(n,s[i]);return this};function s1(r,n,s){var p=r._events;if(p===void 0)return[];var i=p[n];return i===void 0?[]:typeof i=="function"?s?[i.listener||i]:[i]:s?LC(i):u1(i,i.length)}Xr.prototype.listeners=function(n){return s1(this,n,!0)};Xr.prototype.rawListeners=function(n){return s1(this,n,!1)};Xr.listenerCount=function(r,n){return typeof r.listenerCount=="function"?r.listenerCount(n):l1.call(r,n)};Xr.prototype.listenerCount=l1;function l1(r){var n=this._events;if(n!==void 0){var s=n[r];if(typeof s=="function")return 1;if(s!==void 0)return s.length}return 0}Xr.prototype.eventNames=function(){return this._eventsCount>0?_d(this._events):[]};function u1(r,n){for(var s=new Array(n),p=0;p<n;++p)s[p]=r[p];return s}function PC(r,n){for(;n+1<r.length;n++)r[n]=r[n+1];r.pop()}function LC(r){for(var n=new Array(r.length),s=0;s<n.length;++s)n[s]=r[s].listener||r[s];return n}});var Hd=xa((Ig,Cg)=>{E();(function(r,n){typeof Ig=="object"&&typeof Cg<"u"?Cg.exports=n():typeof define=="function"&&define.amd?define(n):(r=r||self,r.maplibregl=n())})(Ig,function(){"use strict";var r,n,s;function p(i,m){if(!r)r=m;else if(!n)n=m;else{var v="var sharedChunk = {}; ("+r+")(sharedChunk); ("+n+")(sharedChunk);",b={};r(b),s=m(b),typeof window<"u"&&(s.workerUrl=window.URL.createObjectURL(new Blob([v],{type:"text/javascript"})))}}return p(["exports"],function(i){"use strict";function m(t,e){return t(e={exports:{}},e.exports),e.exports}var v=b;function b(t,e,o,h){this.cx=3*t,this.bx=3*(o-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(h-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=h,this.p2x=o,this.p2y=h}b.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},b.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},b.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},b.prototype.solveCurveX=function(t,e){var o,h,f,d,g;for(e===void 0&&(e=1e-6),f=t,g=0;g<8;g++){if(d=this.sampleCurveX(f)-t,Math.abs(d)<e)return f;var w=this.sampleCurveDerivativeX(f);if(Math.abs(w)<1e-6)break;f-=d/w}if((f=t)<(o=0))return o;if(f>(h=1))return h;for(;o<h;){if(d=this.sampleCurveX(f),Math.abs(d-t)<e)return f;t>d?o=f:h=f,f=.5*(h-o)+o}return f},b.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var M=z;function z(t,e){this.x=t,this.y=e}z.prototype={clone:function(){return new z(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,o=t.y-this.y;return e*e+o*o},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),o=Math.sin(t),h=o*this.x+e*this.y;return this.x=e*this.x-o*this.y,this.y=h,this},_rotateAround:function(t,e){var o=Math.cos(t),h=Math.sin(t),f=e.y+h*(this.x-e.x)+o*(this.y-e.y);return this.x=e.x+o*(this.x-e.x)-h*(this.y-e.y),this.y=f,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},z.convert=function(t){return t instanceof z?t:Array.isArray(t)?new z(t[0],t[1]):t};var C=typeof self<"u"?self:{},j=Math.pow(2,53)-1;function Y(t,e,o,h){var f=new v(t,e,o,h);return function(d){return f.solve(d)}}var ot=Y(.25,.1,.25,1);function J(t,e,o){return Math.min(o,Math.max(e,t))}function mt(t,e,o){var h=o-e,f=((t-e)%h+h)%h+e;return f===e?o:f}function ft(t){for(var e=[],o=arguments.length-1;o-- >0;)e[o]=arguments[o+1];for(var h=0,f=e;h<f.length;h+=1){var d=f[h];for(var g in d)t[g]=d[g]}return t}var At=1;function Gt(){return At++}function Zt(){return function t(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function we(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function he(t,e){t.forEach(function(o){e[o]&&(e[o]=e[o].bind(e))})}function Kt(t,e){return t.indexOf(e,t.length-e.length)!==-1}function ce(t,e,o){var h={};for(var f in t)h[f]=e.call(o||this,t[f],f,t);return h}function Yt(t,e,o){var h={};for(var f in t)e.call(o||this,t[f],f,t)&&(h[f]=t[f]);return h}function Te(t){return Array.isArray(t)?t.map(Te):typeof t=="object"&&t?ce(t,Te):t}var dr={};function Le(t){dr[t]||(typeof console<"u"&&console.warn(t),dr[t]=!0)}function hr(t,e,o){return(o.y-t.y)*(e.x-t.x)>(e.y-t.y)*(o.x-t.x)}function Ur(t){for(var e=0,o=0,h=t.length,f=h-1,d=void 0,g=void 0;o<h;f=o++)e+=((g=t[f]).x-(d=t[o]).x)*(d.y+g.y);return e}function Gr(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function _n(t){var e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,function(h,f,d,g){var w=d||g;return e[f]=!w||w.toLowerCase(),""}),e["max-age"]){var o=parseInt(e["max-age"],10);isNaN(o)?delete e["max-age"]:e["max-age"]=o}return e}var Cr=null;function te(t){if(Cr==null){var e=t.navigator?t.navigator.userAgent:null;Cr=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Cr}function ae(t){try{var e=C[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}}var me,Ne,Qe,pi,Ai=C.performance&&C.performance.now?C.performance.now.bind(C.performance):Date.now.bind(Date),Ji=C.requestAnimationFrame||C.mozRequestAnimationFrame||C.webkitRequestAnimationFrame||C.msRequestAnimationFrame,ke=C.cancelAnimationFrame||C.mozCancelAnimationFrame||C.webkitCancelAnimationFrame||C.msCancelAnimationFrame,cr={now:Ai,frame:function(t){var e=Ji(t);return{cancel:function(){return ke(e)}}},getImageData:function(t,e){e===void 0&&(e=0);var o=C.document.createElement("canvas"),h=o.getContext("2d");if(!h)throw new Error("failed to create canvas 2d context");return o.width=t.width,o.height=t.height,h.drawImage(t,0,0,t.width,t.height),h.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:function(t){return me||(me=C.document.createElement("a")),me.href=t,me.href},hardwareConcurrency:C.navigator&&C.navigator.hardwareConcurrency||4,get devicePixelRatio(){return C.devicePixelRatio},get prefersReducedMotion(){return!!C.matchMedia&&(Ne==null&&(Ne=C.matchMedia("(prefers-reduced-motion: reduce)")),Ne.matches)}},We={API_URL:"https://api.mapbox.com",get EVENTS_URL(){return this.API_URL?this.API_URL.indexOf("https://api.mapbox.cn")===0?"https://events.mapbox.cn/events/v2":this.API_URL.indexOf("https://api.mapbox.com")===0?"https://events.mapbox.com/events/v2":null:null},FEEDBACK_URL:"https://apps.mapbox.com/feedback",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},oi={supported:!1,testSupport:function(t){!ln&&pi&&(Oi?Ce(t):Qe=t)}},ln=!1,Oi=!1;function Ce(t){var e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,pi),t.isContextLost())return;oi.supported=!0}catch{}t.deleteTexture(e),ln=!0}C.document&&((pi=C.document.createElement("img")).onload=function(){Qe&&Ce(Qe),Qe=null,Oi=!0},pi.onerror=function(){ln=!0,Qe=null},pi.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var Cn="01",Ar=function(t,e){this._transformRequestFn=t,this._customAccessToken=e,this._createSkuToken()};function Ki(t){return t.indexOf("mapbox:")===0}Ar.prototype._createSkuToken=function(){var t=function(){for(var e="",o=0;o<10;o++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Cn,e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt},Ar.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},Ar.prototype.transformRequest=function(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}},Ar.prototype.normalizeStyleURL=function(t,e){if(!Ki(t))return t;var o=q(t);return o.path="/styles/v1"+o.path,this._makeAPIURL(o,this._customAccessToken||e)},Ar.prototype.normalizeGlyphsURL=function(t,e){if(!Ki(t))return t;var o=q(t);return o.path="/fonts/v1"+o.path,this._makeAPIURL(o,this._customAccessToken||e)},Ar.prototype.normalizeSourceURL=function(t,e){if(!Ki(t))return t;var o=q(t);return o.path="/v4/"+o.authority+".json",o.params.push("secure"),this._makeAPIURL(o,this._customAccessToken||e)},Ar.prototype.normalizeSpriteURL=function(t,e,o,h){var f=q(t);return Ki(t)?(f.path="/styles/v1"+f.path+"/sprite"+e+o,this._makeAPIURL(f,this._customAccessToken||h)):(f.path+=""+e+o,F(f))},Ar.prototype.normalizeTileURL=function(t,e){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!Ki(t))return t;var o=q(t);o.path=o.path.replace(/(\.(png|jpg)\d*)(?=$)/,(cr.devicePixelRatio>=2||e===512?"@2x":"")+(oi.supported?".webp":"$1")),o.path=o.path.replace(/^.+\/v4\//,"/"),o.path="/v4"+o.path;var h=this._customAccessToken||function(f){for(var d=0,g=f;d<g.length;d+=1){var w=g[d].match(/^access_token=(.*)$/);if(w)return w[1]}return null}(o.params)||We.ACCESS_TOKEN;return We.REQUIRE_ACCESS_TOKEN&&h&&this._skuToken&&o.params.push("sku="+this._skuToken),this._makeAPIURL(o,h)},Ar.prototype.canonicalizeTileURL=function(t,e){var o=q(t);if(!o.path.match(/(^\/v4\/)/)||!o.path.match(/\.[\w]+$/))return t;var h="mapbox://tiles/";h+=o.path.replace("/v4/","");var f=o.params;return e&&(f=f.filter(function(d){return!d.match(/^access_token=/)})),f.length&&(h+="?"+f.join("&")),h},Ar.prototype.canonicalizeTileset=function(t,e){for(var o=!!e&&Ki(e),h=[],f=0,d=t.tiles||[];f<d.length;f+=1){var g=d[f];Qi(g)?h.push(this.canonicalizeTileURL(g,o)):h.push(g)}return h},Ar.prototype._makeAPIURL=function(t,e){var o="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes",h=q(We.API_URL);if(t.protocol=h.protocol,t.authority=h.authority,t.protocol==="http"){var f=t.params.indexOf("secure");f>=0&&t.params.splice(f,1)}if(h.path!=="/"&&(t.path=""+h.path+t.path),!We.REQUIRE_ACCESS_TOKEN)return F(t);if(!(e=e||We.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+o);if(e[0]==="s")throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+o);return t.params=t.params.filter(function(d){return d.indexOf("access_token")===-1}),t.params.push("access_token="+e),F(t)},Ar.prototype.setTransformRequest=function(t){this._transformRequestFn=t};var zo=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;function Qi(t){return zo.test(t)}var bt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function q(t){var e=t.match(bt);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function F(t){var e=t.params.length?"?"+t.params.join("&"):"";return t.protocol+"://"+t.authority+t.path+e}function W(t){if(!t)return null;var e=t.split(".");if(!e||e.length!==3)return null;try{return JSON.parse(decodeURIComponent(C.atob(e[1]).split("").map(function(o){return"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)}).join("")))}catch{return null}}var nt=function(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null};nt.prototype.getStorageKey=function(t){var e,o=W(We.ACCESS_TOKEN);return e=o&&o.u?C.btoa(encodeURIComponent(o.u).replace(/%([0-9A-F]{2})/g,function(h,f){return String.fromCharCode(Number("0x"+f))})):We.ACCESS_TOKEN||"",t?"mapbox.eventData."+t+":"+e:"mapbox.eventData:"+e},nt.prototype.fetchEventData=function(){var t=ae("localStorage"),e=this.getStorageKey(),o=this.getStorageKey("uuid");if(t)try{var h=C.localStorage.getItem(e);h&&(this.eventData=JSON.parse(h));var f=C.localStorage.getItem(o);f&&(this.anonId=f)}catch{Le("Unable to read from LocalStorage")}},nt.prototype.saveEventData=function(){var t=ae("localStorage"),e=this.getStorageKey(),o=this.getStorageKey("uuid");if(t)try{C.localStorage.setItem(o,this.anonId),Object.keys(this.eventData).length>=1&&C.localStorage.setItem(e,JSON.stringify(this.eventData))}catch{Le("Unable to write to LocalStorage")}},nt.prototype.processRequests=function(t){},nt.prototype.postEvent=function(t,e,o,h){var f=this;if(We.EVENTS_URL){var d=q(We.EVENTS_URL);d.params.push("access_token="+(h||We.ACCESS_TOKEN||""));var g={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"1.15.1",skuId:Cn,userId:this.anonId},w=e?ft(g,e):g,T={url:F(d),headers:{"Content-Type":"text/plain"},body:JSON.stringify([w])};this.pendingRequest=k(T,function(I){f.pendingRequest=null,o(I),f.saveEventData(),f.processRequests(h)})}},nt.prototype.queueRequest=function(t,e){this.queue.push(t),this.processRequests(e)};var dt,Mt,Dt=function(t){function e(){t.call(this,"map.load"),this.success={},this.skuToken=""}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postMapLoadEvent=function(o,h,f,d){this.skuToken=f,(We.EVENTS_URL&&d||We.ACCESS_TOKEN&&Array.isArray(o)&&o.some(function(g){return Ki(g)||Qi(g)}))&&this.queueRequest({id:h,timestamp:Date.now()},d)},e.prototype.processRequests=function(o){var h=this;if(!this.pendingRequest&&this.queue.length!==0){var f=this.queue.shift(),d=f.id,g=f.timestamp;d&&this.success[d]||(this.anonId||this.fetchEventData(),we(this.anonId)||(this.anonId=Zt()),this.postEvent(g,{skuToken:this.skuToken},function(w){w||d&&(h.success[d]=!0)},o))}},e}(nt),Vt=new(function(t){function e(o){t.call(this,"appUserTurnstile"),this._customAccessToken=o}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postTurnstileEvent=function(o,h){We.EVENTS_URL&&We.ACCESS_TOKEN&&Array.isArray(o)&&o.some(function(f){return Ki(f)||Qi(f)})&&this.queueRequest(Date.now(),h)},e.prototype.processRequests=function(o){var h=this;if(!this.pendingRequest&&this.queue.length!==0){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var f=W(We.ACCESS_TOKEN),d=f?f.u:We.ACCESS_TOKEN,g=d!==this.eventData.tokenU;we(this.anonId)||(this.anonId=Zt(),g=!0);var w=this.queue.shift();if(this.eventData.lastSuccess){var T=new Date(this.eventData.lastSuccess),I=new Date(w),P=(w-this.eventData.lastSuccess)/864e5;g=g||P>=1||P<-1||T.getDate()!==I.getDate()}else g=!0;if(!g)return this.processRequests();this.postEvent(w,{"enabled.telemetry":!1},function(L){L||(h.eventData.lastSuccess=w,h.eventData.tokenU=d)},o)}},e}(nt)),ye=Vt.postTurnstileEvent.bind(Vt),Ae=new Dt,qe=Ae.postMapLoadEvent.bind(Ae),Ge=500,Xe=50;function yr(){C.caches&&!dt&&(dt=C.caches.open("mapbox-tiles"))}function ar(t){var e=t.indexOf("?");return e<0?t:t.slice(0,e)}var ur,$r=1/0;function Vr(){return ur==null&&(ur=C.OffscreenCanvas&&new C.OffscreenCanvas(1,1).getContext("2d")&&typeof C.createImageBitmap=="function"),ur}var yi={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(yi);var Yr=function(t){function e(o,h,f){h===401&&Qi(f)&&(o+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),t.call(this,o),this.status=h,this.url=f,this.name=this.constructor.name,this.message=o}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.toString=function(){return this.name+": "+this.message+" ("+this.status+"): "+this.url},e}(Error),gi=Gr()?function(){return self.worker&&self.worker.referrer}:function(){return(C.location.protocol==="blob:"?C.parent:C).location.href};function An(t,e){var o,h=new C.AbortController,f=new C.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:gi(),signal:h.signal}),d=!1,g=!1,w=(o=f.url).indexOf("sku=")>0&&Qi(o);t.type==="json"&&f.headers.set("Accept","application/json");var T=function(P,L,N){if(!g){if(P&&P.message!=="SecurityError"&&Le(P),L&&N)return I(L);var U=Date.now();C.fetch(f).then(function(Q){if(Q.ok){var $=w?Q.clone():null;return I(Q,$,U)}return e(new Yr(Q.statusText,Q.status,t.url))}).catch(function(Q){Q.code!==20&&e(new Error(Q.message))})}},I=function(P,L,N){(t.type==="arrayBuffer"?P.arrayBuffer():t.type==="json"?P.json():P.text()).then(function(U){g||(L&&N&&function(Q,$,ct){if(yr(),dt){var st={status:$.status,statusText:$.statusText,headers:new C.Headers};$.headers.forEach(function(xt,St){return st.headers.set(St,xt)});var vt=_n($.headers.get("Cache-Control")||"");vt["no-store"]||(vt["max-age"]&&st.headers.set("Expires",new Date(ct+1e3*vt["max-age"]).toUTCString()),new Date(st.headers.get("Expires")).getTime()-ct<42e4||function(xt,St){if(Mt===void 0)try{new Response(new ReadableStream),Mt=!0}catch{Mt=!1}Mt?St(xt.body):xt.blob().then(St)}($,function(xt){var St=new C.Response(xt,st);yr(),dt&&dt.then(function(Et){return Et.put(ar(Q.url),St)}).catch(function(Et){return Le(Et.message)})}))}}(f,L,N),d=!0,e(null,U,P.headers.get("Cache-Control"),P.headers.get("Expires")))}).catch(function(U){g||e(new Error(U.message))})};return w?function(P,L){if(yr(),!dt)return L(null);var N=ar(P.url);dt.then(function(U){U.match(N).then(function(Q){var $=function(ct){if(!ct)return!1;var st=new Date(ct.headers.get("Expires")||0),vt=_n(ct.headers.get("Cache-Control")||"");return st>Date.now()&&!vt["no-cache"]}(Q);U.delete(N),$&&U.put(N,Q.clone()),L(null,Q,$)}).catch(L)}).catch(L)}(f,T):T(null,null),{cancel:function(){g=!0,d||h.abort()}}}var Ni,Hi,vi=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(Gr()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!Gr()){var o=t.url.substring(0,t.url.indexOf("://"));return(We.REGISTERED_PROTOCOLS[o]||An)(t,e)}}if(!(/^file:/.test(h=t.url)||/^file:/.test(gi())&&!/^\w+:/.test(h))){if(C.fetch&&C.Request&&C.AbortController&&C.Request.prototype.hasOwnProperty("signal"))return An(t,e);if(Gr()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var h;return function(f,d){var g=new C.XMLHttpRequest;for(var w in g.open(f.method||"GET",f.url,!0),f.type==="arrayBuffer"&&(g.responseType="arraybuffer"),f.headers)g.setRequestHeader(w,f.headers[w]);return f.type==="json"&&(g.responseType="text",g.setRequestHeader("Accept","application/json")),g.withCredentials=f.credentials==="include",g.onerror=function(){d(new Error(g.statusText))},g.onload=function(){if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){var T=g.response;if(f.type==="json")try{T=JSON.parse(g.response)}catch(I){return d(I)}d(null,T,g.getResponseHeader("Cache-Control"),g.getResponseHeader("Expires"))}else d(new Yr(g.statusText,g.status,f.url))},g.send(f.body),{cancel:function(){return g.abort()}}}(t,e)},xr=function(t,e){return vi(ft(t,{type:"arrayBuffer"}),e)},k=function(t,e){return vi(ft(t,{method:"POST"}),e)},O="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";Ni=[],Hi=0;var B=function(t,e){if(oi.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),Hi>=We.MAX_PARALLEL_IMAGE_REQUESTS){var o={requestParameters:t,callback:e,cancelled:!1,cancel:function(){this.cancelled=!0}};return Ni.push(o),o}Hi++;var h=!1,f=function(){if(!h)for(h=!0,Hi--;Ni.length&&Hi<We.MAX_PARALLEL_IMAGE_REQUESTS;){var g=Ni.shift();g.cancelled||(g.cancel=B(g.requestParameters,g.callback).cancel)}},d=xr(t,function(g,w,T,I){f(),g?e(g):w&&(Vr()?function(P,L){var N=new C.Blob([new Uint8Array(P)],{type:"image/png"});C.createImageBitmap(N).then(function(U){L(null,U)}).catch(function(U){L(new Error("Could not load image because of "+U.message+". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))})}(w,e):function(P,L,N,U){var Q=new C.Image,$=C.URL;Q.onload=function(){L(null,Q),$.revokeObjectURL(Q.src),Q.onload=null,C.requestAnimationFrame(function(){Q.src=O})},Q.onerror=function(){return L(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."))};var ct=new C.Blob([new Uint8Array(P)],{type:"image/png"});Q.cacheControl=N,Q.expires=U,Q.src=P.byteLength?$.createObjectURL(ct):O}(w,e,T,I))});return{cancel:function(){d.cancel(),f()}}};function H(t,e,o){o[t]&&o[t].indexOf(e)!==-1||(o[t]=o[t]||[],o[t].push(e))}function rt(t,e,o){if(o&&o[t]){var h=o[t].indexOf(e);h!==-1&&o[t].splice(h,1)}}var pt=function(t,e){e===void 0&&(e={}),ft(this,e),this.type=t},gt=function(t){function e(o,h){h===void 0&&(h={}),t.call(this,"error",ft({error:o},h))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(pt),ht=function(){};ht.prototype.on=function(t,e){return this._listeners=this._listeners||{},H(t,e,this._listeners),this},ht.prototype.off=function(t,e){return rt(t,e,this._listeners),rt(t,e,this._oneTimeListeners),this},ht.prototype.once=function(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},H(t,e,this._oneTimeListeners),this},ht.prototype.fire=function(t,e){typeof t=="string"&&(t=new pt(t,e||{}));var o=t.type;if(this.listens(o)){t.target=this;for(var h=0,f=this._listeners&&this._listeners[o]?this._listeners[o].slice():[];h<f.length;h+=1)f[h].call(this,t);for(var d=0,g=this._oneTimeListeners&&this._oneTimeListeners[o]?this._oneTimeListeners[o].slice():[];d<g.length;d+=1){var w=g[d];rt(o,w,this._oneTimeListeners),w.call(this,t)}var T=this._eventedParent;T&&(ft(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),T.fire(t))}else t instanceof gt&&console.error(t.error);return this},ht.prototype.listens=function(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},ht.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var X={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},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:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},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,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},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,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{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_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},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:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}},at=function(t,e,o,h){this.message=(t?t+": ":"")+o,h&&(this.identifier=h),e!=null&&e.__line__&&(this.line=e.__line__)};function Ot(t){var e=t.value;return e?[new at(t.key,e,"constants have been deprecated as of v8")]:[]}function Wt(t){for(var e=[],o=arguments.length-1;o-- >0;)e[o]=arguments[o+1];for(var h=0,f=e;h<f.length;h+=1){var d=f[h];for(var g in d)t[g]=d[g]}return t}function wt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Ft(t){if(Array.isArray(t))return t.map(Ft);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){var e={};for(var o in t)e[o]=Ft(t[o]);return e}return wt(t)}var ne=function(t){function e(o,h){t.call(this,h),this.message=h,this.key=o}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(Error),se=function(t,e){e===void 0&&(e=[]),this.parent=t,this.bindings={};for(var o=0,h=e;o<h.length;o+=1){var f=h[o];this.bindings[f[0]]=f[1]}};se.prototype.concat=function(t){return new se(this,t)},se.prototype.get=function(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(t+" not found in scope.")},se.prototype.has=function(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)};var ge={kind:"null"},kt={kind:"number"},Jt={kind:"string"},Rt={kind:"boolean"},Fe={kind:"color"},Be={kind:"object"},pe={kind:"value"},Er={kind:"collator"},Ze={kind:"formatted"},Pr={kind:"resolvedImage"};function Nr(t,e){return{kind:"array",itemType:t,N:e}}function rr(t){if(t.kind==="array"){var e=rr(t.itemType);return typeof t.N=="number"?"array<"+e+", "+t.N+">":t.itemType.kind==="value"?"array":"array<"+e+">"}return t.kind}var Tr=[ge,kt,Jt,Rt,Fe,Ze,Be,Nr(pe),Pr];function Jr(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Jr(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(var o=0,h=Tr;o<h.length;o+=1)if(!Jr(h[o],e))return null}}return"Expected "+rr(t)+" but found "+rr(e)+" instead."}function Mr(t,e){return e.some(function(o){return o.kind===t.kind})}function Ke(t,e){return e.some(function(o){return o==="null"?t===null:o==="array"?Array.isArray(t):o==="object"?t&&!Array.isArray(t)&&typeof t=="object":o===typeof t})}var Ts=m(function(t,e){var o={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 h(w){return(w=Math.round(w))<0?0:w>255?255:w}function f(w){return h(w[w.length-1]==="%"?parseFloat(w)/100*255:parseInt(w))}function d(w){return(T=w[w.length-1]==="%"?parseFloat(w)/100:parseFloat(w))<0?0:T>1?1:T;var T}function g(w,T,I){return I<0?I+=1:I>1&&(I-=1),6*I<1?w+(T-w)*I*6:2*I<1?T:3*I<2?w+(T-w)*(2/3-I)*6:w}try{e.parseCSSColor=function(w){var T,I=w.replace(/ /g,"").toLowerCase();if(I in o)return o[I].slice();if(I[0]==="#")return I.length===4?(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:I.length===7&&(T=parseInt(I.substr(1),16))>=0&&T<=16777215?[(16711680&T)>>16,(65280&T)>>8,255&T,1]:null;var P=I.indexOf("("),L=I.indexOf(")");if(P!==-1&&L+1===I.length){var N=I.substr(0,P),U=I.substr(P+1,L-(P+1)).split(","),Q=1;switch(N){case"rgba":if(U.length!==4)return null;Q=d(U.pop());case"rgb":return U.length!==3?null:[f(U[0]),f(U[1]),f(U[2]),Q];case"hsla":if(U.length!==4)return null;Q=d(U.pop());case"hsl":if(U.length!==3)return null;var $=(parseFloat(U[0])%360+360)%360/360,ct=d(U[1]),st=d(U[2]),vt=st<=.5?st*(ct+1):st+ct-st*ct,xt=2*st-vt;return[h(255*g(xt,vt,$+1/3)),h(255*g(xt,vt,$)),h(255*g(xt,vt,$-1/3)),Q];default:return null}}return null}}catch{}}).parseCSSColor,$e=function(t,e,o,h){h===void 0&&(h=1),this.r=t,this.g=e,this.b=o,this.a=h};$e.parse=function(t){if(t){if(t instanceof $e)return t;if(typeof t=="string"){var e=Ts(t);if(e)return new $e(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},$e.prototype.toString=function(){var t=this.toArray(),e=t[1],o=t[2],h=t[3];return"rgba("+Math.round(t[0])+","+Math.round(e)+","+Math.round(o)+","+h+")"},$e.prototype.toArray=function(){var t=this.a;return t===0?[0,0,0,0]:[255*this.r/t,255*this.g/t,255*this.b/t,t]},$e.black=new $e(0,0,0,1),$e.white=new $e(1,1,1,1),$e.transparent=new $e(0,0,0,0),$e.red=new $e(1,0,0,1);var za=function(t,e,o){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=o,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};za.prototype.compare=function(t,e){return this.collator.compare(t,e)},za.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var Ql=function(t,e,o,h,f){this.text=t,this.image=e,this.scale=o,this.fontStack=h,this.textColor=f},Fi=function(t){this.sections=t};Fi.fromString=function(t){return new Fi([new Ql(t,null,null,null,null)])},Fi.prototype.isEmpty=function(){return this.sections.length===0||!this.sections.some(function(t){return t.text.length!==0||t.image&&t.image.name.length!==0})},Fi.factory=function(t){return t instanceof Fi?t:Fi.fromString(t)},Fi.prototype.toString=function(){return this.sections.length===0?"":this.sections.map(function(t){return t.text}).join("")},Fi.prototype.serialize=function(){for(var t=["format"],e=0,o=this.sections;e<o.length;e+=1){var h=o[e];if(h.image)t.push(["image",h.image.name]);else{t.push(h.text);var f={};h.fontStack&&(f["text-font"]=["literal",h.fontStack.split(",")]),h.scale&&(f["font-scale"]=h.scale),h.textColor&&(f["text-color"]=["rgba"].concat(h.textColor.toArray())),t.push(f)}}return t};var xn=function(t){this.name=t.name,this.available=t.available};function Oh(t,e,o,h){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof o=="number"&&o>=0&&o<=255?h===void 0||typeof h=="number"&&h>=0&&h<=1?null:"Invalid rgba value ["+[t,e,o,h].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+(typeof h=="number"?[t,e,o,h]:[t,e,o]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function Da(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof $e||t instanceof za||t instanceof Fi||t instanceof xn)return!0;if(Array.isArray(t)){for(var e=0,o=t;e<o.length;e+=1)if(!Da(o[e]))return!1;return!0}if(typeof t=="object"){for(var h in t)if(!Da(t[h]))return!1;return!0}return!1}function Pi(t){if(t===null)return ge;if(typeof t=="string")return Jt;if(typeof t=="boolean")return Rt;if(typeof t=="number")return kt;if(t instanceof $e)return Fe;if(t instanceof za)return Er;if(t instanceof Fi)return Ze;if(t instanceof xn)return Pr;if(Array.isArray(t)){for(var e,o=t.length,h=0,f=t;h<f.length;h+=1){var d=Pi(f[h]);if(e){if(e===d)continue;e=pe;break}e=d}return Nr(e||pe,o)}return Be}function So(t){var e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof $e||t instanceof Fi||t instanceof xn?t.toString():JSON.stringify(t)}xn.prototype.toString=function(){return this.name},xn.fromString=function(t){return t?new xn({name:t,available:!1}):null},xn.prototype.serialize=function(){return["image",this.name]};var to=function(t,e){this.type=t,this.value=e};to.parse=function(t,e){if(t.length!==2)return e.error("'literal' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(!Da(t[1]))return e.error("invalid value");var o=t[1],h=Pi(o),f=e.expectedType;return h.kind!=="array"||h.N!==0||!f||f.kind!=="array"||typeof f.N=="number"&&f.N!==0||(h=f),new to(h,o)},to.prototype.evaluate=function(){return this.value},to.prototype.eachChild=function(){},to.prototype.outputDefined=function(){return!0},to.prototype.serialize=function(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof $e?["rgba"].concat(this.value.toArray()):this.value instanceof Fi?this.value.serialize():this.value};var jr=function(t){this.name="ExpressionEvaluationError",this.message=t};jr.prototype.toJSON=function(){return this.message};var bn={string:Jt,number:kt,boolean:Rt,object:Be},$i=function(t,e){this.type=t,this.args=e};$i.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var o,h=1,f=t[0];if(f==="array"){var d,g;if(t.length>2){var w=t[1];if(typeof w!="string"||!(w in bn)||w==="object")return e.error('The item type argument of "array" must be one of string, number, boolean',1);d=bn[w],h++}else d=pe;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);g=t[2],h++}o=Nr(d,g)}else o=bn[f];for(var T=[];h<t.length;h++){var I=e.parse(t[h],h,pe);if(!I)return null;T.push(I)}return new $i(o,T)},$i.prototype.evaluate=function(t){for(var e=0;e<this.args.length;e++){var o=this.args[e].evaluate(t);if(!Jr(this.type,Pi(o)))return o;if(e===this.args.length-1)throw new jr("Expected value to be of type "+rr(this.type)+", but found "+rr(Pi(o))+" instead.")}return null},$i.prototype.eachChild=function(t){this.args.forEach(t)},$i.prototype.outputDefined=function(){return this.args.every(function(t){return t.outputDefined()})},$i.prototype.serialize=function(){var t=this.type,e=[t.kind];if(t.kind==="array"){var o=t.itemType;if(o.kind==="string"||o.kind==="number"||o.kind==="boolean"){e.push(o.kind);var h=t.N;(typeof h=="number"||this.args.length>1)&&e.push(h)}}return e.concat(this.args.map(function(f){return f.serialize()}))};var Pn=function(t){this.type=Ze,this.sections=t};Pn.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var o=t[1];if(!Array.isArray(o)&&typeof o=="object")return e.error("First argument must be an image or text section.");for(var h=[],f=!1,d=1;d<=t.length-1;++d){var g=t[d];if(f&&typeof g=="object"&&!Array.isArray(g)){f=!1;var w=null;if(g["font-scale"]&&!(w=e.parse(g["font-scale"],1,kt)))return null;var T=null;if(g["text-font"]&&!(T=e.parse(g["text-font"],1,Nr(Jt))))return null;var I=null;if(g["text-color"]&&!(I=e.parse(g["text-color"],1,Fe)))return null;var P=h[h.length-1];P.scale=w,P.font=T,P.textColor=I}else{var L=e.parse(t[d],1,pe);if(!L)return null;var N=L.type.kind;if(N!=="string"&&N!=="value"&&N!=="null"&&N!=="resolvedImage")return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");f=!0,h.push({content:L,scale:null,font:null,textColor:null})}}return new Pn(h)},Pn.prototype.evaluate=function(t){return new Fi(this.sections.map(function(e){var o=e.content.evaluate(t);return Pi(o)===Pr?new Ql("",o,null,null,null):new Ql(So(o),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)}))},Pn.prototype.eachChild=function(t){for(var e=0,o=this.sections;e<o.length;e+=1){var h=o[e];t(h.content),h.scale&&t(h.scale),h.font&&t(h.font),h.textColor&&t(h.textColor)}},Pn.prototype.outputDefined=function(){return!1},Pn.prototype.serialize=function(){for(var t=["format"],e=0,o=this.sections;e<o.length;e+=1){var h=o[e];t.push(h.content.serialize());var f={};h.scale&&(f["font-scale"]=h.scale.serialize()),h.font&&(f["text-font"]=h.font.serialize()),h.textColor&&(f["text-color"]=h.textColor.serialize()),t.push(f)}return t};var Do=function(t){this.type=Pr,this.input=t};Do.parse=function(t,e){if(t.length!==2)return e.error("Expected two arguments.");var o=e.parse(t[1],1,Jt);return o?new Do(o):e.error("No image name provided.")},Do.prototype.evaluate=function(t){var e=this.input.evaluate(t),o=xn.fromString(e);return o&&t.availableImages&&(o.available=t.availableImages.indexOf(e)>-1),o},Do.prototype.eachChild=function(t){t(this.input)},Do.prototype.outputDefined=function(){return!1},Do.prototype.serialize=function(){return["image",this.input.serialize()]};var $d={"to-boolean":Rt,"to-color":Fe,"to-number":kt,"to-string":Jt},eo=function(t,e){this.type=t,this.args=e};eo.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var o=t[0];if((o==="to-boolean"||o==="to-string")&&t.length!==2)return e.error("Expected one argument.");for(var h=$d[o],f=[],d=1;d<t.length;d++){var g=e.parse(t[d],d,pe);if(!g)return null;f.push(g)}return new eo(h,f)},eo.prototype.evaluate=function(t){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(t));if(this.type.kind==="color"){for(var e,o,h=0,f=this.args;h<f.length;h+=1){if(o=null,(e=f[h].evaluate(t))instanceof $e)return e;if(typeof e=="string"){var d=t.parseColor(e);if(d)return d}else if(Array.isArray(e)&&!(o=e.length<3||e.length>4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":Oh(e[0],e[1],e[2],e[3])))return new $e(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new jr(o||"Could not parse color from value '"+(typeof e=="string"?e:String(JSON.stringify(e)))+"'")}if(this.type.kind==="number"){for(var g=null,w=0,T=this.args;w<T.length;w+=1){if((g=T[w].evaluate(t))===null)return 0;var I=Number(g);if(!isNaN(I))return I}throw new jr("Could not convert "+JSON.stringify(g)+" to number.")}return this.type.kind==="formatted"?Fi.fromString(So(this.args[0].evaluate(t))):this.type.kind==="resolvedImage"?xn.fromString(So(this.args[0].evaluate(t))):So(this.args[0].evaluate(t))},eo.prototype.eachChild=function(t){this.args.forEach(t)},eo.prototype.outputDefined=function(){return this.args.every(function(t){return t.outputDefined()})},eo.prototype.serialize=function(){if(this.type.kind==="formatted")return new Pn([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Do(this.args[0]).serialize();var t=["to-"+this.type.kind];return this.eachChild(function(e){t.push(e.serialize())}),t};var Cp=["Unknown","Point","LineString","Polygon"],Oo=function(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null};Oo.prototype.id=function(){return this.feature&&"id"in this.feature?this.feature.id:null},Oo.prototype.geometryType=function(){return this.feature?typeof this.feature.type=="number"?Cp[this.feature.type]:this.feature.type:null},Oo.prototype.geometry=function(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null},Oo.prototype.canonicalID=function(){return this.canonical},Oo.prototype.properties=function(){return this.feature&&this.feature.properties||{}},Oo.prototype.parseColor=function(t){var e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=$e.parse(t)),e};var Bi=function(t,e,o,h){this.name=t,this.type=e,this._evaluate=o,this.args=h};Bi.prototype.evaluate=function(t){return this._evaluate(t,this.args)},Bi.prototype.eachChild=function(t){this.args.forEach(t)},Bi.prototype.outputDefined=function(){return!1},Bi.prototype.serialize=function(){return[this.name].concat(this.args.map(function(t){return t.serialize()}))},Bi.parse=function(t,e){var o,h=t[0],f=Bi.definitions[h];if(!f)return e.error('Unknown expression "'+h+'". If you wanted a literal array, use ["literal", [...]].',0);for(var d=Array.isArray(f)?f[0]:f.type,g=Array.isArray(f)?[[f[1],f[2]]]:f.overloads,w=g.filter(function(ve){var ee=ve[0];return!Array.isArray(ee)||ee.length===t.length-1}),T=null,I=0,P=w;I<P.length;I+=1){var L=P[I],N=L[0],U=L[1];T=new ea(e.registry,e.path,null,e.scope);for(var Q=[],$=!1,ct=1;ct<t.length;ct++){var st=t[ct],vt=Array.isArray(N)?N[ct-1]:N.type,xt=T.parse(st,1+Q.length,vt);if(!xt){$=!0;break}Q.push(xt)}if(!$)if(Array.isArray(N)&&N.length!==Q.length)T.error("Expected "+N.length+" arguments, but found "+Q.length+" instead.");else{for(var St=0;St<Q.length;St++){var Et=Array.isArray(N)?N[St]:N.type,Pt=Q[St];T.concat(St+1).checkSubtype(Et,Pt.type)}if(T.errors.length===0)return new Bi(h,d,U,Q)}}if(w.length===1)(o=e.errors).push.apply(o,T.errors);else{for(var jt=(w.length?w:g).map(function(ve){var ee;return ee=ve[0],Array.isArray(ee)?"("+ee.map(rr).join(", ")+")":"("+rr(ee.type)+"...)"}).join(" | "),Xt=[],de=1;de<t.length;de++){var Qt=e.parse(t[de],1+Xt.length);if(!Qt)return null;Xt.push(rr(Qt.type))}e.error("Expected arguments of type "+jt+", but found ("+Xt.join(", ")+") instead.")}return null},Bi.register=function(t,e){for(var o in Bi.definitions=e,e)t[o]=Bi};var _i=function(t,e,o){this.type=Er,this.locale=o,this.caseSensitive=t,this.diacriticSensitive=e};function Ms(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function $l(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function tm(t,e){var o=(180+t[0])/360,h=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,f=Math.pow(2,e.z);return[Math.round(o*f*8192),Math.round(h*f*8192)]}function em(t,e,o){return e[1]>t[1]!=o[1]>t[1]&&t[0]<(o[0]-e[0])*(t[1]-e[1])/(o[1]-e[1])+e[0]}function Nh(t,e){for(var o,h,f,d,g,w,T,I=!1,P=0,L=e.length;P<L;P++)for(var N=e[P],U=0,Q=N.length;U<Q-1;U++){if((d=(o=t)[0]-(h=N[U])[0])*(T=o[1]-(f=N[U+1])[1])-(w=o[0]-f[0])*(g=o[1]-h[1])==0&&d*w<=0&&g*T<=0)return!1;em(t,N[U],N[U+1])&&(I=!I)}return I}function rm(t,e){for(var o=0;o<e.length;o++)if(Nh(t,e[o]))return!0;return!1}function Ap(t,e,o,h){var f=h[0]-o[0],d=h[1]-o[1],g=(t[0]-o[0])*d-f*(t[1]-o[1]),w=(e[0]-o[0])*d-f*(e[1]-o[1]);return g>0&&w<0||g<0&&w>0}function im(t,e,o){for(var h=0,f=o;h<f.length;h+=1)for(var d=f[h],g=0;g<d.length-1;++g)if((L=[(P=d[g+1])[0]-(I=d[g])[0],P[1]-I[1]])[0]*(N=[(T=e)[0]-(w=t)[0],T[1]-w[1]])[1]-L[1]*N[0]!=0&&Ap(w,T,I,P)&&Ap(I,P,w,T))return!0;var w,T,I,P,L,N;return!1}function Fh(t,e){for(var o=0;o<t.length;++o)if(!Nh(t[o],e))return!1;for(var h=0;h<t.length-1;++h)if(im(t[h],t[h+1],e))return!1;return!0}function tu(t,e){for(var o=0;o<e.length;o++)if(Fh(t,e[o]))return!0;return!1}function eu(t,e,o){for(var h=[],f=0;f<t.length;f++){for(var d=[],g=0;g<t[f].length;g++){var w=tm(t[f][g],o);Ms(e,w),d.push(w)}h.push(d)}return h}function sl(t,e,o){for(var h=[],f=0;f<t.length;f++){var d=eu(t[f],e,o);h.push(d)}return h}function Pp(t,e,o,h){if(t[0]<o[0]||t[0]>o[2]){var f=.5*h,d=t[0]-o[0]>f?-h:o[0]-t[0]>f?h:0;d===0&&(d=t[0]-o[2]>f?-h:o[2]-t[0]>f?h:0),t[0]+=d}Ms(e,t)}function ru(t,e,o,h){for(var f=8192*Math.pow(2,h.z),d=[8192*h.x,8192*h.y],g=[],w=0,T=t;w<T.length;w+=1)for(var I=0,P=T[w];I<P.length;I+=1){var L=P[I],N=[L.x+d[0],L.y+d[1]];Pp(N,e,o,f),g.push(N)}return g}function Bh(t,e,o,h){for(var f,d=8192*Math.pow(2,h.z),g=[8192*h.x,8192*h.y],w=[],T=0,I=t;T<I.length;T+=1){for(var P=[],L=0,N=I[T];L<N.length;L+=1){var U=N[L],Q=[U.x+g[0],U.y+g[1]];Ms(e,Q),P.push(Q)}w.push(P)}if(e[2]-e[0]<=d/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(var $=0,ct=w;$<ct.length;$+=1)for(var st=0,vt=ct[$];st<vt.length;st+=1)Pp(vt[st],e,o,d)}return w}_i.parse=function(t,e){if(t.length!==2)return e.error("Expected one argument.");var o=t[1];if(typeof o!="object"||Array.isArray(o))return e.error("Collator options argument must be an object.");var h=e.parse(o["case-sensitive"]!==void 0&&o["case-sensitive"],1,Rt);if(!h)return null;var f=e.parse(o["diacritic-sensitive"]!==void 0&&o["diacritic-sensitive"],1,Rt);if(!f)return null;var d=null;return o.locale&&!(d=e.parse(o.locale,1,Jt))?null:new _i(h,f,d)},_i.prototype.evaluate=function(t){return new za(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)},_i.prototype.eachChild=function(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)},_i.prototype.outputDefined=function(){return!1},_i.prototype.serialize=function(){var t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]};var wn=function(t,e){this.type=Rt,this.geojson=t,this.geometries=e};function Oa(t){if(t instanceof Bi&&(t.name==="get"&&t.args.length===1||t.name==="feature-state"||t.name==="has"&&t.args.length===1||t.name==="properties"||t.name==="geometry-type"||t.name==="id"||/^filter-/.test(t.name))||t instanceof wn)return!1;var e=!0;return t.eachChild(function(o){e&&!Oa(o)&&(e=!1)}),e}function $o(t){if(t instanceof Bi&&t.name==="feature-state")return!1;var e=!0;return t.eachChild(function(o){e&&!$o(o)&&(e=!1)}),e}function iu(t,e){if(t instanceof Bi&&e.indexOf(t.name)>=0)return!1;var o=!0;return t.eachChild(function(h){o&&!iu(h,e)&&(o=!1)}),o}wn.parse=function(t,e){if(t.length!==2)return e.error("'within' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(Da(t[1])){var o=t[1];if(o.type==="FeatureCollection")for(var h=0;h<o.features.length;++h){var f=o.features[h].geometry.type;if(f==="Polygon"||f==="MultiPolygon")return new wn(o,o.features[h].geometry)}else if(o.type==="Feature"){var d=o.geometry.type;if(d==="Polygon"||d==="MultiPolygon")return new wn(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new wn(o,o)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")},wn.prototype.evaluate=function(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(e,o){var h=[1/0,1/0,-1/0,-1/0],f=[1/0,1/0,-1/0,-1/0],d=e.canonicalID();if(o.type==="Polygon"){var g=eu(o.coordinates,f,d),w=ru(e.geometry(),h,f,d);if(!$l(h,f))return!1;for(var T=0,I=w;T<I.length;T+=1)if(!Nh(I[T],g))return!1}if(o.type==="MultiPolygon"){var P=sl(o.coordinates,f,d),L=ru(e.geometry(),h,f,d);if(!$l(h,f))return!1;for(var N=0,U=L;N<U.length;N+=1)if(!rm(U[N],P))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(e,o){var h=[1/0,1/0,-1/0,-1/0],f=[1/0,1/0,-1/0,-1/0],d=e.canonicalID();if(o.type==="Polygon"){var g=eu(o.coordinates,f,d),w=Bh(e.geometry(),h,f,d);if(!$l(h,f))return!1;for(var T=0,I=w;T<I.length;T+=1)if(!Fh(I[T],g))return!1}if(o.type==="MultiPolygon"){var P=sl(o.coordinates,f,d),L=Bh(e.geometry(),h,f,d);if(!$l(h,f))return!1;for(var N=0,U=L;N<U.length;N+=1)if(!tu(U[N],P))return!1}return!0}(t,this.geometries)}return!1},wn.prototype.eachChild=function(){},wn.prototype.outputDefined=function(){return!0},wn.prototype.serialize=function(){return["within",this.geojson]};var ta=function(t,e){this.type=e.type,this.name=t,this.boundExpression=e};ta.parse=function(t,e){if(t.length!==2||typeof t[1]!="string")return e.error("'var' expression requires exactly one string literal argument.");var o=t[1];return e.scope.has(o)?new ta(o,e.scope.get(o)):e.error('Unknown variable "'+o+'". Make sure "'+o+'" has been bound in an enclosing "let" expression before using it.',1)},ta.prototype.evaluate=function(t){return this.boundExpression.evaluate(t)},ta.prototype.eachChild=function(){},ta.prototype.outputDefined=function(){return!1},ta.prototype.serialize=function(){return["var",this.name]};var ea=function(t,e,o,h,f){e===void 0&&(e=[]),h===void 0&&(h=new se),f===void 0&&(f=[]),this.registry=t,this.path=e,this.key=e.map(function(d){return"["+d+"]"}).join(""),this.scope=h,this.errors=f,this.expectedType=o};function No(t,e){for(var o,h=t.length-1,f=0,d=h,g=0;f<=d;)if((o=t[g=Math.floor((f+d)/2)])<=e){if(g===h||e<t[g+1])return g;f=g+1}else{if(!(o>e))throw new jr("Input is not a number.");d=g-1}return 0}ea.prototype.parse=function(t,e,o,h,f){return f===void 0&&(f={}),e?this.concat(e,o,h)._parse(t,f):this._parse(t,f)},ea.prototype._parse=function(t,e){function o(I,P,L){return L==="assert"?new $i(P,[I]):L==="coerce"?new eo(P,[I]):I}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var h=t[0];if(typeof h!="string")return this.error("Expression name must be a string, but found "+typeof h+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var f=this.registry[h];if(f){var d=f.parse(t,this);if(!d)return null;if(this.expectedType){var g=this.expectedType,w=d.type;if(g.kind!=="string"&&g.kind!=="number"&&g.kind!=="boolean"&&g.kind!=="object"&&g.kind!=="array"||w.kind!=="value")if(g.kind!=="color"&&g.kind!=="formatted"&&g.kind!=="resolvedImage"||w.kind!=="value"&&w.kind!=="string"){if(this.checkSubtype(g,w))return null}else d=o(d,g,e.typeAnnotation||"coerce");else d=o(d,g,e.typeAnnotation||"assert")}if(!(d instanceof to)&&d.type.kind!=="resolvedImage"&&function I(P){if(P instanceof ta)return I(P.boundExpression);if(P instanceof Bi&&P.name==="error"||P instanceof _i||P instanceof wn)return!1;var L=P instanceof eo||P instanceof $i,N=!0;return P.eachChild(function(U){N=L?N&&I(U):N&&U instanceof to}),!!N&&Oa(P)&&iu(P,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(d)){var T=new Oo;try{d=new to(d.type,d.evaluate(T))}catch(I){return this.error(I.message),null}}return d}return this.error('Unknown expression "'+h+'". If you wanted a literal array, use ["literal", [...]].',0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found "+typeof t+" instead.")},ea.prototype.concat=function(t,e,o){var h=typeof t=="number"?this.path.concat(t):this.path,f=o?this.scope.concat(o):this.scope;return new ea(this.registry,h,e||null,f,this.errors)},ea.prototype.error=function(t){for(var e=[],o=arguments.length-1;o-- >0;)e[o]=arguments[o+1];var h=""+this.key+e.map(function(f){return"["+f+"]"}).join("");this.errors.push(new ne(h,t))},ea.prototype.checkSubtype=function(t,e){var o=Jr(t,e);return o&&this.error(o),o};var po=function(t,e,o){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var h=0,f=o;h<f.length;h+=1){var d=f[h],g=d[1];this.labels.push(d[0]),this.outputs.push(g)}};function fi(t,e,o){return t*(1-o)+e*o}po.parse=function(t,e){if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");var o=e.parse(t[1],1,kt);if(!o)return null;var h=[],f=null;e.expectedType&&e.expectedType.kind!=="value"&&(f=e.expectedType);for(var d=1;d<t.length;d+=2){var g=d===1?-1/0:t[d],w=t[d+1],T=d,I=d+1;if(typeof g!="number")return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',T);if(h.length&&h[h.length-1][0]>=g)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',T);var P=e.parse(w,I,f);if(!P)return null;f=f||P.type,h.push([g,P])}return new po(f,o,h)},po.prototype.evaluate=function(t){var e=this.labels,o=this.outputs;if(e.length===1)return o[0].evaluate(t);var h=this.input.evaluate(t);if(h<=e[0])return o[0].evaluate(t);var f=e.length;return h>=e[f-1]?o[f-1].evaluate(t):o[No(e,h)].evaluate(t)},po.prototype.eachChild=function(t){t(this.input);for(var e=0,o=this.outputs;e<o.length;e+=1)t(o[e])},po.prototype.outputDefined=function(){return this.outputs.every(function(t){return t.outputDefined()})},po.prototype.serialize=function(){for(var t=["step",this.input.serialize()],e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var nu=Object.freeze({__proto__:null,number:fi,color:function(t,e,o){return new $e(fi(t.r,e.r,o),fi(t.g,e.g,o),fi(t.b,e.b,o),fi(t.a,e.a,o))},array:function(t,e,o){return t.map(function(h,f){return fi(h,e[f],o)})}}),Lp=6/29*3*(6/29),nm=Math.PI/180,om=180/Math.PI;function Uh(t){return t>.008856451679035631?Math.pow(t,1/3):t/Lp+4/29}function Gh(t){return t>6/29?t*t*t:Lp*(t-4/29)}function Vh(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function jh(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function kp(t){var e=jh(t.r),o=jh(t.g),h=jh(t.b),f=Uh((.4124564*e+.3575761*o+.1804375*h)/.95047),d=Uh((.2126729*e+.7151522*o+.072175*h)/1);return{l:116*d-16,a:500*(f-d),b:200*(d-Uh((.0193339*e+.119192*o+.9503041*h)/1.08883)),alpha:t.a}}function Rp(t){var e=(t.l+16)/116,o=isNaN(t.a)?e:e+t.a/500,h=isNaN(t.b)?e:e-t.b/200;return e=1*Gh(e),o=.95047*Gh(o),h=1.08883*Gh(h),new $e(Vh(3.2404542*o-1.5371385*e-.4985314*h),Vh(-.969266*o+1.8760108*e+.041556*h),Vh(.0556434*o-.2040259*e+1.0572252*h),t.alpha)}function am(t,e,o){var h=e-t;return t+o*(h>180||h<-180?h-360*Math.round(h/360):h)}var ll={forward:kp,reverse:Rp,interpolate:function(t,e,o){return{l:fi(t.l,e.l,o),a:fi(t.a,e.a,o),b:fi(t.b,e.b,o),alpha:fi(t.alpha,e.alpha,o)}}},ul={forward:function(t){var e=kp(t),o=e.l,h=e.a,f=e.b,d=Math.atan2(f,h)*om;return{h:d<0?d+360:d,c:Math.sqrt(h*h+f*f),l:o,alpha:t.a}},reverse:function(t){var e=t.h*nm,o=t.c;return Rp({l:t.l,a:Math.cos(e)*o,b:Math.sin(e)*o,alpha:t.alpha})},interpolate:function(t,e,o){return{h:am(t.h,e.h,o),c:fi(t.c,e.c,o),l:fi(t.l,e.l,o),alpha:fi(t.alpha,e.alpha,o)}}},zp=Object.freeze({__proto__:null,lab:ll,hcl:ul}),Zi=function(t,e,o,h,f){this.type=t,this.operator=e,this.interpolation=o,this.input=h,this.labels=[],this.outputs=[];for(var d=0,g=f;d<g.length;d+=1){var w=g[d],T=w[1];this.labels.push(w[0]),this.outputs.push(T)}};function qh(t,e,o,h){var f=h-o,d=t-o;return f===0?0:e===1?d/f:(Math.pow(e,d)-1)/(Math.pow(e,f)-1)}Zi.interpolationFactor=function(t,e,o,h){var f=0;if(t.name==="exponential")f=qh(e,t.base,o,h);else if(t.name==="linear")f=qh(e,1,o,h);else if(t.name==="cubic-bezier"){var d=t.controlPoints;f=new v(d[0],d[1],d[2],d[3]).solve(qh(e,1,o,h))}return f},Zi.parse=function(t,e){var o=t[0],h=t[1],f=t[2],d=t.slice(3);if(!Array.isArray(h)||h.length===0)return e.error("Expected an interpolation type expression.",1);if(h[0]==="linear")h={name:"linear"};else if(h[0]==="exponential"){var g=h[1];if(typeof g!="number")return e.error("Exponential interpolation requires a numeric base.",1,1);h={name:"exponential",base:g}}else{if(h[0]!=="cubic-bezier")return e.error("Unknown interpolation type "+String(h[0]),1,0);var w=h.slice(1);if(w.length!==4||w.some(function(ct){return typeof ct!="number"||ct<0||ct>1}))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);h={name:"cubic-bezier",controlPoints:w}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(f=e.parse(f,2,kt)))return null;var T=[],I=null;o==="interpolate-hcl"||o==="interpolate-lab"?I=Fe:e.expectedType&&e.expectedType.kind!=="value"&&(I=e.expectedType);for(var P=0;P<d.length;P+=2){var L=d[P],N=d[P+1],U=P+3,Q=P+4;if(typeof L!="number")return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',U);if(T.length&&T[T.length-1][0]>=L)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',U);var $=e.parse(N,Q,I);if(!$)return null;I=I||$.type,T.push([L,$])}return I.kind==="number"||I.kind==="color"||I.kind==="array"&&I.itemType.kind==="number"&&typeof I.N=="number"?new Zi(I,o,h,f,T):e.error("Type "+rr(I)+" is not interpolatable.")},Zi.prototype.evaluate=function(t){var e=this.labels,o=this.outputs;if(e.length===1)return o[0].evaluate(t);var h=this.input.evaluate(t);if(h<=e[0])return o[0].evaluate(t);var f=e.length;if(h>=e[f-1])return o[f-1].evaluate(t);var d=No(e,h),g=Zi.interpolationFactor(this.interpolation,h,e[d],e[d+1]),w=o[d].evaluate(t),T=o[d+1].evaluate(t);return this.operator==="interpolate"?nu[this.type.kind.toLowerCase()](w,T,g):this.operator==="interpolate-hcl"?ul.reverse(ul.interpolate(ul.forward(w),ul.forward(T),g)):ll.reverse(ll.interpolate(ll.forward(w),ll.forward(T),g))},Zi.prototype.eachChild=function(t){t(this.input);for(var e=0,o=this.outputs;e<o.length;e+=1)t(o[e])},Zi.prototype.outputDefined=function(){return this.outputs.every(function(t){return t.outputDefined()})},Zi.prototype.serialize=function(){var t;t=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);for(var e=[this.operator,t,this.input.serialize()],o=0;o<this.labels.length;o++)e.push(this.labels[o],this.outputs[o].serialize());return e};var ra=function(t,e){this.type=t,this.args=e};ra.parse=function(t,e){if(t.length<2)return e.error("Expectected at least one argument.");var o=null,h=e.expectedType;h&&h.kind!=="value"&&(o=h);for(var f=[],d=0,g=t.slice(1);d<g.length;d+=1){var w=e.parse(g[d],1+f.length,o,void 0,{typeAnnotation:"omit"});if(!w)return null;o=o||w.type,f.push(w)}var T=h&&f.some(function(I){return Jr(h,I.type)});return new ra(T?pe:o,f)},ra.prototype.evaluate=function(t){for(var e,o=null,h=0,f=0,d=this.args;f<d.length&&(h++,(o=d[f].evaluate(t))&&o instanceof xn&&!o.available&&(e||(e=o.name),o=null,h===this.args.length&&(o=e)),o===null);f+=1);return o},ra.prototype.eachChild=function(t){this.args.forEach(t)},ra.prototype.outputDefined=function(){return this.args.every(function(t){return t.outputDefined()})},ra.prototype.serialize=function(){var t=["coalesce"];return this.eachChild(function(e){t.push(e.serialize())}),t};var ia=function(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e};ia.prototype.evaluate=function(t){return this.result.evaluate(t)},ia.prototype.eachChild=function(t){for(var e=0,o=this.bindings;e<o.length;e+=1)t(o[e][1]);t(this.result)},ia.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found "+(t.length-1)+" instead.");for(var o=[],h=1;h<t.length-1;h+=2){var f=t[h];if(typeof f!="string")return e.error("Expected string, but found "+typeof f+" instead.",h);if(/[^a-zA-Z0-9_]/.test(f))return e.error("Variable names must contain only alphanumeric characters or '_'.",h);var d=e.parse(t[h+1],h+1);if(!d)return null;o.push([f,d])}var g=e.parse(t[t.length-1],t.length-1,e.expectedType,o);return g?new ia(o,g):null},ia.prototype.outputDefined=function(){return this.result.outputDefined()},ia.prototype.serialize=function(){for(var t=["let"],e=0,o=this.bindings;e<o.length;e+=1){var h=o[e];t.push(h[0],h[1].serialize())}return t.push(this.result.serialize()),t};var Na=function(t,e,o){this.type=t,this.index=e,this.input=o};Na.parse=function(t,e){if(t.length!==3)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var o=e.parse(t[1],1,kt),h=e.parse(t[2],2,Nr(e.expectedType||pe));return o&&h?new Na(h.type.itemType,o,h):null},Na.prototype.evaluate=function(t){var e=this.index.evaluate(t),o=this.input.evaluate(t);if(e<0)throw new jr("Array index out of bounds: "+e+" < 0.");if(e>=o.length)throw new jr("Array index out of bounds: "+e+" > "+(o.length-1)+".");if(e!==Math.floor(e))throw new jr("Array index must be an integer, but found "+e+" instead.");return o[e]},Na.prototype.eachChild=function(t){t(this.index),t(this.input)},Na.prototype.outputDefined=function(){return!1},Na.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var Fa=function(t,e){this.type=Rt,this.needle=t,this.haystack=e};Fa.parse=function(t,e){if(t.length!==3)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var o=e.parse(t[1],1,pe),h=e.parse(t[2],2,pe);return o&&h?Mr(o.type,[Rt,Jt,kt,ge,pe])?new Fa(o,h):e.error("Expected first argument to be of type boolean, string, number or null, but found "+rr(o.type)+" instead"):null},Fa.prototype.evaluate=function(t){var e=this.needle.evaluate(t),o=this.haystack.evaluate(t);if(!o)return!1;if(!Ke(e,["boolean","string","number","null"]))throw new jr("Expected first argument to be of type boolean, string, number or null, but found "+rr(Pi(e))+" instead.");if(!Ke(o,["string","array"]))throw new jr("Expected second argument to be of type array or string, but found "+rr(Pi(o))+" instead.");return o.indexOf(e)>=0},Fa.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},Fa.prototype.outputDefined=function(){return!0},Fa.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var na=function(t,e,o){this.type=kt,this.needle=t,this.haystack=e,this.fromIndex=o};na.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var o=e.parse(t[1],1,pe),h=e.parse(t[2],2,pe);if(!o||!h)return null;if(!Mr(o.type,[Rt,Jt,kt,ge,pe]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+rr(o.type)+" instead");if(t.length===4){var f=e.parse(t[3],3,kt);return f?new na(o,h,f):null}return new na(o,h)},na.prototype.evaluate=function(t){var e=this.needle.evaluate(t),o=this.haystack.evaluate(t);if(!Ke(e,["boolean","string","number","null"]))throw new jr("Expected first argument to be of type boolean, string, number or null, but found "+rr(Pi(e))+" instead.");if(!Ke(o,["string","array"]))throw new jr("Expected second argument to be of type array or string, but found "+rr(Pi(o))+" instead.");if(this.fromIndex){var h=this.fromIndex.evaluate(t);return o.indexOf(e,h)}return o.indexOf(e)},na.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)},na.prototype.outputDefined=function(){return!1},na.prototype.serialize=function(){if(this.fromIndex!=null&&this.fromIndex!==void 0){var t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var Ba=function(t,e,o,h,f,d){this.inputType=t,this.type=e,this.input=o,this.cases=h,this.outputs=f,this.otherwise=d};Ba.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var o,h;e.expectedType&&e.expectedType.kind!=="value"&&(h=e.expectedType);for(var f={},d=[],g=2;g<t.length-1;g+=2){var w=t[g],T=t[g+1];Array.isArray(w)||(w=[w]);var I=e.concat(g);if(w.length===0)return I.error("Expected at least one branch label.");for(var P=0,L=w;P<L.length;P+=1){var N=L[P];if(typeof N!="number"&&typeof N!="string")return I.error("Branch labels must be numbers or strings.");if(typeof N=="number"&&Math.abs(N)>Number.MAX_SAFE_INTEGER)return I.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if(typeof N=="number"&&Math.floor(N)!==N)return I.error("Numeric branch labels must be integer values.");if(o){if(I.checkSubtype(o,Pi(N)))return null}else o=Pi(N);if(f[String(N)]!==void 0)return I.error("Branch labels must be unique.");f[String(N)]=d.length}var U=e.parse(T,g,h);if(!U)return null;h=h||U.type,d.push(U)}var Q=e.parse(t[1],1,pe);if(!Q)return null;var $=e.parse(t[t.length-1],t.length-1,h);return $?Q.type.kind!=="value"&&e.concat(1).checkSubtype(o,Q.type)?null:new Ba(o,h,Q,f,d,$):null},Ba.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(Pi(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},Ba.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},Ba.prototype.outputDefined=function(){return this.outputs.every(function(t){return t.outputDefined()})&&this.otherwise.outputDefined()},Ba.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],o=[],h={},f=0,d=Object.keys(this.cases).sort();f<d.length;f+=1){var g=d[f];(L=h[this.cases[g]])===void 0?(h[this.cases[g]]=o.length,o.push([this.cases[g],[g]])):o[L][1].push(g)}for(var w=function(U){return t.inputType.kind==="number"?Number(U):U},T=0,I=o;T<I.length;T+=1){var P=I[T],L=P[0],N=P[1];e.push(N.length===1?w(N[0]):N.map(w)),e.push(this.outputs[outputIndex$1].serialize())}return e.push(this.otherwise.serialize()),e};var Ua=function(t,e,o){this.type=t,this.branches=e,this.otherwise=o};Ua.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found only "+(t.length-1)+".");if(t.length%2!=0)return e.error("Expected an odd number of arguments.");var o;e.expectedType&&e.expectedType.kind!=="value"&&(o=e.expectedType);for(var h=[],f=1;f<t.length-1;f+=2){var d=e.parse(t[f],f,Rt);if(!d)return null;var g=e.parse(t[f+1],f+1,o);if(!g)return null;h.push([d,g]),o=o||g.type}var w=e.parse(t[t.length-1],t.length-1,o);return w?new Ua(o,h,w):null},Ua.prototype.evaluate=function(t){for(var e=0,o=this.branches;e<o.length;e+=1){var h=o[e],f=h[1];if(h[0].evaluate(t))return f.evaluate(t)}return this.otherwise.evaluate(t)},Ua.prototype.eachChild=function(t){for(var e=0,o=this.branches;e<o.length;e+=1){var h=o[e],f=h[1];t(h[0]),t(f)}t(this.otherwise)},Ua.prototype.outputDefined=function(){return this.branches.every(function(t){return t[1].outputDefined()})&&this.otherwise.outputDefined()},Ua.prototype.serialize=function(){var t=["case"];return this.eachChild(function(e){t.push(e.serialize())}),t};var oa=function(t,e,o,h){this.type=t,this.input=e,this.beginIndex=o,this.endIndex=h};function Dp(t,e){return t==="=="||t==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function qr(t,e,o,h){return h.compare(e,o)===0}function Is(t,e,o){var h=t!=="=="&&t!=="!=";return function(){function f(d,g,w){this.type=Rt,this.lhs=d,this.rhs=g,this.collator=w,this.hasUntypedArgument=d.type.kind==="value"||g.type.kind==="value"}return f.parse=function(d,g){if(d.length!==3&&d.length!==4)return g.error("Expected two or three arguments.");var w=d[0],T=g.parse(d[1],1,pe);if(!T)return null;if(!Dp(w,T.type))return g.concat(1).error('"'+w+`" comparisons are not supported for type '`+rr(T.type)+"'.");var I=g.parse(d[2],2,pe);if(!I)return null;if(!Dp(w,I.type))return g.concat(2).error('"'+w+`" comparisons are not supported for type '`+rr(I.type)+"'.");if(T.type.kind!==I.type.kind&&T.type.kind!=="value"&&I.type.kind!=="value")return g.error("Cannot compare types '"+rr(T.type)+"' and '"+rr(I.type)+"'.");h&&(T.type.kind==="value"&&I.type.kind!=="value"?T=new $i(I.type,[T]):T.type.kind!=="value"&&I.type.kind==="value"&&(I=new $i(T.type,[I])));var P=null;if(d.length===4){if(T.type.kind!=="string"&&I.type.kind!=="string"&&T.type.kind!=="value"&&I.type.kind!=="value")return g.error("Cannot use collator to compare non-string types.");if(!(P=g.parse(d[3],3,Er)))return null}return new f(T,I,P)},f.prototype.evaluate=function(d){var g=this.lhs.evaluate(d),w=this.rhs.evaluate(d);if(h&&this.hasUntypedArgument){var T=Pi(g),I=Pi(w);if(T.kind!==I.kind||T.kind!=="string"&&T.kind!=="number")throw new jr('Expected arguments for "'+t+'" to be (string, string) or (number, number), but found ('+T.kind+", "+I.kind+") instead.")}if(this.collator&&!h&&this.hasUntypedArgument){var P=Pi(g),L=Pi(w);if(P.kind!=="string"||L.kind!=="string")return e(d,g,w)}return this.collator?o(d,g,w,this.collator.evaluate(d)):e(d,g,w)},f.prototype.eachChild=function(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)},f.prototype.outputDefined=function(){return!0},f.prototype.serialize=function(){var d=[t];return this.eachChild(function(g){d.push(g.serialize())}),d},f}()}oa.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var o=e.parse(t[1],1,pe),h=e.parse(t[2],2,kt);if(!o||!h)return null;if(!Mr(o.type,[Nr(pe),Jt,pe]))return e.error("Expected first argument to be of type array or string, but found "+rr(o.type)+" instead");if(t.length===4){var f=e.parse(t[3],3,kt);return f?new oa(o.type,o,h,f):null}return new oa(o.type,o,h)},oa.prototype.evaluate=function(t){var e=this.input.evaluate(t),o=this.beginIndex.evaluate(t);if(!Ke(e,["string","array"]))throw new jr("Expected first argument to be of type array or string, but found "+rr(Pi(e))+" instead.");if(this.endIndex){var h=this.endIndex.evaluate(t);return e.slice(o,h)}return e.slice(o)},oa.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)},oa.prototype.outputDefined=function(){return!1},oa.prototype.serialize=function(){if(this.endIndex!=null&&this.endIndex!==void 0){var t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};var ou=Is("==",function(t,e,o){return e===o},qr),Op=Is("!=",function(t,e,o){return e!==o},function(t,e,o,h){return!qr(0,e,o,h)}),Np=Is("<",function(t,e,o){return e<o},function(t,e,o,h){return h.compare(e,o)<0}),Fp=Is(">",function(t,e,o){return e>o},function(t,e,o,h){return h.compare(e,o)>0}),Bp=Is("<=",function(t,e,o){return e<=o},function(t,e,o,h){return h.compare(e,o)<=0}),sm=Is(">=",function(t,e,o){return e>=o},function(t,e,o,h){return h.compare(e,o)>=0}),aa=function(t,e,o,h,f){this.type=Jt,this.number=t,this.locale=e,this.currency=o,this.minFractionDigits=h,this.maxFractionDigits=f};aa.parse=function(t,e){if(t.length!==3)return e.error("Expected two arguments.");var o=e.parse(t[1],1,kt);if(!o)return null;var h=t[2];if(typeof h!="object"||Array.isArray(h))return e.error("NumberFormat options argument must be an object.");var f=null;if(h.locale&&!(f=e.parse(h.locale,1,Jt)))return null;var d=null;if(h.currency&&!(d=e.parse(h.currency,1,Jt)))return null;var g=null;if(h["min-fraction-digits"]&&!(g=e.parse(h["min-fraction-digits"],1,kt)))return null;var w=null;return h["max-fraction-digits"]&&!(w=e.parse(h["max-fraction-digits"],1,kt))?null:new aa(o,f,d,g,w)},aa.prototype.evaluate=function(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))},aa.prototype.eachChild=function(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)},aa.prototype.outputDefined=function(){return!1},aa.prototype.serialize=function(){var t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]};var sa=function(t){this.type=kt,this.input=t};sa.parse=function(t,e){if(t.length!==2)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var o=e.parse(t[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?e.error("Expected argument of type string or array, but found "+rr(o.type)+" instead."):new sa(o):null},sa.prototype.evaluate=function(t){var e=this.input.evaluate(t);if(typeof e=="string"||Array.isArray(e))return e.length;throw new jr("Expected value to be of type string or array, but found "+rr(Pi(e))+" instead.")},sa.prototype.eachChild=function(t){t(this.input)},sa.prototype.outputDefined=function(){return!1},sa.prototype.serialize=function(){var t=["length"];return this.eachChild(function(e){t.push(e.serialize())}),t};var Cs={"==":ou,"!=":Op,">":Fp,"<":Np,">=":sm,"<=":Bp,array:$i,at:Na,boolean:$i,case:Ua,coalesce:ra,collator:_i,format:Pn,image:Do,in:Fa,"index-of":na,interpolate:Zi,"interpolate-hcl":Zi,"interpolate-lab":Zi,length:sa,let:ia,literal:to,match:Ba,number:$i,"number-format":aa,object:$i,slice:oa,step:po,string:$i,"to-boolean":eo,"to-color":eo,"to-number":eo,"to-string":eo,var:ta,within:wn};function Up(t,e){var o=e[0],h=e[1],f=e[2],d=e[3];o=o.evaluate(t),h=h.evaluate(t),f=f.evaluate(t);var g=d?d.evaluate(t):1,w=Oh(o,h,f,g);if(w)throw new jr(w);return new $e(o/255*g,h/255*g,f/255*g,g)}function Gp(t,e){return t in e}function Wh(t,e){var o=e[t];return o===void 0?null:o}function Ga(t){return{type:t}}function Kh(t){return{result:"success",value:t}}function Va(t){return{result:"error",value:t}}function As(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function au(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Hh(t){return!!t.expression&&t.expression.interpolated}function Lr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function su(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Vp(t){return t}function Ps(t,e,o){return t!==void 0?t:e!==void 0?e:o!==void 0?o:void 0}function lm(t,e,o,h,f){return Ps(typeof o===f?h[o]:void 0,t.default,e.default)}function um(t,e,o){if(Lr(o)!=="number")return Ps(t.default,e.default);var h=t.stops.length;if(h===1||o<=t.stops[0][0])return t.stops[0][1];if(o>=t.stops[h-1][0])return t.stops[h-1][1];var f=No(t.stops.map(function(d){return d[0]}),o);return t.stops[f][1]}function hl(t,e,o){var h=t.base!==void 0?t.base:1;if(Lr(o)!=="number")return Ps(t.default,e.default);var f=t.stops.length;if(f===1||o<=t.stops[0][0])return t.stops[0][1];if(o>=t.stops[f-1][0])return t.stops[f-1][1];var d=No(t.stops.map(function(L){return L[0]}),o),g=function(L,N,U,Q){var $=Q-U,ct=L-U;return $===0?0:N===1?ct/$:(Math.pow(N,ct)-1)/(Math.pow(N,$)-1)}(o,h,t.stops[d][0],t.stops[d+1][0]),w=t.stops[d][1],T=t.stops[d+1][1],I=nu[e.type]||Vp;if(t.colorSpace&&t.colorSpace!=="rgb"){var P=zp[t.colorSpace];I=function(L,N){return P.reverse(P.interpolate(P.forward(L),P.forward(N),g))}}return typeof w.evaluate=="function"?{evaluate:function(){for(var L=[],N=arguments.length;N--;)L[N]=arguments[N];var U=w.evaluate.apply(void 0,L),Q=T.evaluate.apply(void 0,L);if(U!==void 0&&Q!==void 0)return I(U,Q,g)}}:I(w,T,g)}function jp(t,e,o){return e.type==="color"?o=$e.parse(o):e.type==="formatted"?o=Fi.fromString(o.toString()):e.type==="resolvedImage"?o=xn.fromString(o.toString()):Lr(o)===e.type||e.type==="enum"&&e.values[o]||(o=void 0),Ps(o,t.default,e.default)}Bi.register(Cs,{error:[{kind:"error"},[Jt],function(t,e){throw new jr(e[0].evaluate(t))}],typeof:[Jt,[pe],function(t,e){return rr(Pi(e[0].evaluate(t)))}],"to-rgba":[Nr(kt,4),[Fe],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[Fe,[kt,kt,kt],Up],rgba:[Fe,[kt,kt,kt,kt],Up],has:{type:Rt,overloads:[[[Jt],function(t,e){return Gp(e[0].evaluate(t),t.properties())}],[[Jt,Be],function(t,e){var o=e[1];return Gp(e[0].evaluate(t),o.evaluate(t))}]]},get:{type:pe,overloads:[[[Jt],function(t,e){return Wh(e[0].evaluate(t),t.properties())}],[[Jt,Be],function(t,e){var o=e[1];return Wh(e[0].evaluate(t),o.evaluate(t))}]]},"feature-state":[pe,[Jt],function(t,e){return Wh(e[0].evaluate(t),t.featureState||{})}],properties:[Be,[],function(t){return t.properties()}],"geometry-type":[Jt,[],function(t){return t.geometryType()}],id:[pe,[],function(t){return t.id()}],zoom:[kt,[],function(t){return t.globals.zoom}],"heatmap-density":[kt,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[kt,[],function(t){return t.globals.lineProgress||0}],accumulated:[pe,[],function(t){return t.globals.accumulated===void 0?null:t.globals.accumulated}],"+":[kt,Ga(kt),function(t,e){for(var o=0,h=0,f=e;h<f.length;h+=1)o+=f[h].evaluate(t);return o}],"*":[kt,Ga(kt),function(t,e){for(var o=1,h=0,f=e;h<f.length;h+=1)o*=f[h].evaluate(t);return o}],"-":{type:kt,overloads:[[[kt,kt],function(t,e){var o=e[1];return e[0].evaluate(t)-o.evaluate(t)}],[[kt],function(t,e){return-e[0].evaluate(t)}]]},"/":[kt,[kt,kt],function(t,e){var o=e[1];return e[0].evaluate(t)/o.evaluate(t)}],"%":[kt,[kt,kt],function(t,e){var o=e[1];return e[0].evaluate(t)%o.evaluate(t)}],ln2:[kt,[],function(){return Math.LN2}],pi:[kt,[],function(){return Math.PI}],e:[kt,[],function(){return Math.E}],"^":[kt,[kt,kt],function(t,e){var o=e[1];return Math.pow(e[0].evaluate(t),o.evaluate(t))}],sqrt:[kt,[kt],function(t,e){return Math.sqrt(e[0].evaluate(t))}],log10:[kt,[kt],function(t,e){return Math.log(e[0].evaluate(t))/Math.LN10}],ln:[kt,[kt],function(t,e){return Math.log(e[0].evaluate(t))}],log2:[kt,[kt],function(t,e){return Math.log(e[0].evaluate(t))/Math.LN2}],sin:[kt,[kt],function(t,e){return Math.sin(e[0].evaluate(t))}],cos:[kt,[kt],function(t,e){return Math.cos(e[0].evaluate(t))}],tan:[kt,[kt],function(t,e){return Math.tan(e[0].evaluate(t))}],asin:[kt,[kt],function(t,e){return Math.asin(e[0].evaluate(t))}],acos:[kt,[kt],function(t,e){return Math.acos(e[0].evaluate(t))}],atan:[kt,[kt],function(t,e){return Math.atan(e[0].evaluate(t))}],min:[kt,Ga(kt),function(t,e){return Math.min.apply(Math,e.map(function(o){return o.evaluate(t)}))}],max:[kt,Ga(kt),function(t,e){return Math.max.apply(Math,e.map(function(o){return o.evaluate(t)}))}],abs:[kt,[kt],function(t,e){return Math.abs(e[0].evaluate(t))}],round:[kt,[kt],function(t,e){var o=e[0].evaluate(t);return o<0?-Math.round(-o):Math.round(o)}],floor:[kt,[kt],function(t,e){return Math.floor(e[0].evaluate(t))}],ceil:[kt,[kt],function(t,e){return Math.ceil(e[0].evaluate(t))}],"filter-==":[Rt,[Jt,pe],function(t,e){var o=e[0],h=e[1];return t.properties()[o.value]===h.value}],"filter-id-==":[Rt,[pe],function(t,e){var o=e[0];return t.id()===o.value}],"filter-type-==":[Rt,[Jt],function(t,e){var o=e[0];return t.geometryType()===o.value}],"filter-<":[Rt,[Jt,pe],function(t,e){var o=e[0],h=e[1],f=t.properties()[o.value],d=h.value;return typeof f==typeof d&&f<d}],"filter-id-<":[Rt,[pe],function(t,e){var o=e[0],h=t.id(),f=o.value;return typeof h==typeof f&&h<f}],"filter->":[Rt,[Jt,pe],function(t,e){var o=e[0],h=e[1],f=t.properties()[o.value],d=h.value;return typeof f==typeof d&&f>d}],"filter-id->":[Rt,[pe],function(t,e){var o=e[0],h=t.id(),f=o.value;return typeof h==typeof f&&h>f}],"filter-<=":[Rt,[Jt,pe],function(t,e){var o=e[0],h=e[1],f=t.properties()[o.value],d=h.value;return typeof f==typeof d&&f<=d}],"filter-id-<=":[Rt,[pe],function(t,e){var o=e[0],h=t.id(),f=o.value;return typeof h==typeof f&&h<=f}],"filter->=":[Rt,[Jt,pe],function(t,e){var o=e[0],h=e[1],f=t.properties()[o.value],d=h.value;return typeof f==typeof d&&f>=d}],"filter-id->=":[Rt,[pe],function(t,e){var o=e[0],h=t.id(),f=o.value;return typeof h==typeof f&&h>=f}],"filter-has":[Rt,[pe],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[Rt,[],function(t){return t.id()!==null&&t.id()!==void 0}],"filter-type-in":[Rt,[Nr(Jt)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[Rt,[Nr(pe)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[Rt,[Jt,Nr(pe)],function(t,e){var o=e[0];return e[1].value.indexOf(t.properties()[o.value])>=0}],"filter-in-large":[Rt,[Jt,Nr(pe)],function(t,e){var o=e[0],h=e[1];return function(f,d,g,w){for(;g<=w;){var T=g+w>>1;if(d[T]===f)return!0;d[T]>f?w=T-1:g=T+1}return!1}(t.properties()[o.value],h.value,0,h.value.length-1)}],all:{type:Rt,overloads:[[[Rt,Rt],function(t,e){var o=e[1];return e[0].evaluate(t)&&o.evaluate(t)}],[Ga(Rt),function(t,e){for(var o=0,h=e;o<h.length;o+=1)if(!h[o].evaluate(t))return!1;return!0}]]},any:{type:Rt,overloads:[[[Rt,Rt],function(t,e){var o=e[1];return e[0].evaluate(t)||o.evaluate(t)}],[Ga(Rt),function(t,e){for(var o=0,h=e;o<h.length;o+=1)if(h[o].evaluate(t))return!0;return!1}]]},"!":[Rt,[Rt],function(t,e){return!e[0].evaluate(t)}],"is-supported-script":[Rt,[Jt],function(t,e){var o=t.globals&&t.globals.isSupportedScript;return!o||o(e[0].evaluate(t))}],upcase:[Jt,[Jt],function(t,e){return e[0].evaluate(t).toUpperCase()}],downcase:[Jt,[Jt],function(t,e){return e[0].evaluate(t).toLowerCase()}],concat:[Jt,Ga(pe),function(t,e){return e.map(function(o){return So(o.evaluate(t))}).join("")}],"resolved-locale":[Jt,[Er],function(t,e){return e[0].evaluate(t).resolvedLocale()}]});var Ls=function(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Oo,this._defaultValue=e?function(o){return o.type==="color"&&su(o.default)?new $e(0,0,0,0):o.type==="color"?$e.parse(o.default)||null:o.default===void 0?null:o.default}(e):null,this._enumValues=e&&e.type==="enum"?e.values:null};function lu(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in Cs}function uu(t,e){var o=new ea(Cs,[],e?function(f){var d={color:Fe,string:Jt,number:kt,enum:Jt,boolean:Rt,formatted:Ze,resolvedImage:Pr};return f.type==="array"?Nr(d[f.value]||pe,f.length):d[f.type]}(e):void 0),h=o.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?Kh(new Ls(h,e)):Va(o.errors)}Ls.prototype.evaluateWithoutErrorHandling=function(t,e,o,h,f,d){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=o,this._evaluator.canonical=h,this._evaluator.availableImages=f||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)},Ls.prototype.evaluate=function(t,e,o,h,f,d){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=o||null,this._evaluator.canonical=h,this._evaluator.availableImages=f||null,this._evaluator.formattedSection=d||null;try{var g=this.expression.evaluate(this._evaluator);if(g==null||typeof g=="number"&&g!=g)return this._defaultValue;if(this._enumValues&&!(g in this._enumValues))throw new jr("Expected value to be one of "+Object.keys(this._enumValues).map(function(w){return JSON.stringify(w)}).join(", ")+", but found "+JSON.stringify(g)+" instead.");return g}catch(w){return this._warningHistory[w.message]||(this._warningHistory[w.message]=!0,typeof console<"u"&&console.warn(w.message)),this._defaultValue}};var cl=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent=t!=="constant"&&!$o(e.expression)};cl.prototype.evaluateWithoutErrorHandling=function(t,e,o,h,f,d){return this._styleExpression.evaluateWithoutErrorHandling(t,e,o,h,f,d)},cl.prototype.evaluate=function(t,e,o,h,f,d){return this._styleExpression.evaluate(t,e,o,h,f,d)};var ks=function(t,e,o,h){this.kind=t,this.zoomStops=o,this._styleExpression=e,this.isStateDependent=t!=="camera"&&!$o(e.expression),this.interpolationType=h};function Zh(t,e){if((t=uu(t,e)).result==="error")return t;var o=t.value.expression,h=Oa(o);if(!h&&!As(e))return Va([new ne("","data expressions not supported")]);var f=iu(o,["zoom"]);if(!f&&!au(e))return Va([new ne("","zoom expressions not supported")]);var d=function g(w){var T=null;if(w instanceof ia)T=g(w.result);else if(w instanceof ra)for(var I=0,P=w.args;I<P.length&&!(T=g(P[I]));I+=1);else(w instanceof po||w instanceof Zi)&&w.input instanceof Bi&&w.input.name==="zoom"&&(T=w);return T instanceof ne||w.eachChild(function(L){var N=g(L);N instanceof ne?T=N:!T&&N?T=new ne("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):T&&N&&T!==N&&(T=new ne("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),T}(o);return d||f?d instanceof ne?Va([d]):d instanceof Zi&&!Hh(e)?Va([new ne("",'"interpolate" expressions cannot be used with this property')]):Kh(d?new ks(h?"camera":"composite",t.value,d.labels,d instanceof Zi?d.interpolation:void 0):new cl(h?"constant":"source",t.value)):Va([new ne("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}ks.prototype.evaluateWithoutErrorHandling=function(t,e,o,h,f,d){return this._styleExpression.evaluateWithoutErrorHandling(t,e,o,h,f,d)},ks.prototype.evaluate=function(t,e,o,h,f,d){return this._styleExpression.evaluate(t,e,o,h,f,d)},ks.prototype.interpolationFactor=function(t,e,o){return this.interpolationType?Zi.interpolationFactor(this.interpolationType,t,e,o):0};var pl=function(t,e){this._parameters=t,this._specification=e,Wt(this,function o(h,f){var d,g,w,T=f.type==="color",I=h.stops&&typeof h.stops[0][0]=="object",P=I||!(I||h.property!==void 0),L=h.type||(Hh(f)?"exponential":"interval");if(T&&((h=Wt({},h)).stops&&(h.stops=h.stops.map(function(Qt){return[Qt[0],$e.parse(Qt[1])]})),h.default=$e.parse(h.default?h.default:f.default)),h.colorSpace&&h.colorSpace!=="rgb"&&!zp[h.colorSpace])throw new Error("Unknown color space: "+h.colorSpace);if(L==="exponential")d=hl;else if(L==="interval")d=um;else if(L==="categorical"){d=lm,g=Object.create(null);for(var N=0,U=h.stops;N<U.length;N+=1){var Q=U[N];g[Q[0]]=Q[1]}w=typeof h.stops[0][0]}else{if(L!=="identity")throw new Error('Unknown function type "'+L+'"');d=jp}if(I){for(var $={},ct=[],st=0;st<h.stops.length;st++){var vt=h.stops[st],xt=vt[0].zoom;$[xt]===void 0&&($[xt]={zoom:xt,type:h.type,property:h.property,default:h.default,stops:[]},ct.push(xt)),$[xt].stops.push([vt[0].value,vt[1]])}for(var St=[],Et=0,Pt=ct;Et<Pt.length;Et+=1){var jt=Pt[Et];St.push([$[jt].zoom,o($[jt],f)])}var Xt={name:"linear"};return{kind:"composite",interpolationType:Xt,interpolationFactor:Zi.interpolationFactor.bind(void 0,Xt),zoomStops:St.map(function(Qt){return Qt[0]}),evaluate:function(Qt,ve){var ee=Qt.zoom;return hl({stops:St,base:h.base},f,ee).evaluate(ee,ve)}}}if(P){var de=L==="exponential"?{name:"exponential",base:h.base!==void 0?h.base:1}:null;return{kind:"camera",interpolationType:de,interpolationFactor:Zi.interpolationFactor.bind(void 0,de),zoomStops:h.stops.map(function(Qt){return Qt[0]}),evaluate:function(Qt){return d(h,f,Qt.zoom,g,w)}}}return{kind:"source",evaluate:function(Qt,ve){var ee=ve&&ve.properties?ve.properties[h.property]:void 0;return ee===void 0?Ps(h.default,f.default):d(h,f,ee,g,w)}}}(this._parameters,this._specification))};function fo(t){var e=t.key,o=t.value,h=t.valueSpec||{},f=t.objectElementValidators||{},d=t.style,g=t.styleSpec,w=[],T=Lr(o);if(T!=="object")return[new at(e,o,"object expected, "+T+" found")];for(var I in o){var P=I.split(".")[0],L=h[P]||h["*"],N=void 0;if(f[P])N=f[P];else if(h[P])N=ir;else if(f["*"])N=f["*"];else{if(!h["*"]){w.push(new at(e,o[I],'unknown property "'+I+'"'));continue}N=ir}w=w.concat(N({key:(e&&e+".")+I,value:o[I],valueSpec:L,style:d,styleSpec:g,object:o,objectKey:I},o))}for(var U in h)f[U]||h[U].required&&h[U].default===void 0&&o[U]===void 0&&w.push(new at(e,o,'missing required property "'+U+'"'));return w}function qp(t){var e=t.value,o=t.valueSpec,h=t.style,f=t.styleSpec,d=t.key,g=t.arrayElementValidator||ir;if(Lr(e)!=="array")return[new at(d,e,"array expected, "+Lr(e)+" found")];if(o.length&&e.length!==o.length)return[new at(d,e,"array length "+o.length+" expected, length "+e.length+" found")];if(o["min-length"]&&e.length<o["min-length"])return[new at(d,e,"array length at least "+o["min-length"]+" expected, length "+e.length+" found")];var w={type:o.value,values:o.values};f.$version<7&&(w.function=o.function),Lr(o.value)==="object"&&(w=o.value);for(var T=[],I=0;I<e.length;I++)T=T.concat(g({array:e,arrayIndex:I,value:e[I],valueSpec:w,style:h,styleSpec:f,key:d+"["+I+"]"}));return T}function Wp(t){var e=t.key,o=t.value,h=t.valueSpec,f=Lr(o);return f==="number"&&o!=o&&(f="NaN"),f!=="number"?[new at(e,o,"number expected, "+f+" found")]:"minimum"in h&&o<h.minimum?[new at(e,o,o+" is less than the minimum value "+h.minimum)]:"maximum"in h&&o>h.maximum?[new at(e,o,o+" is greater than the maximum value "+h.maximum)]:[]}function Xh(t){var e,o,h,f=t.valueSpec,d=wt(t.value.type),g={},w=d!=="categorical"&&t.value.property===void 0,T=!w,I=Lr(t.value.stops)==="array"&&Lr(t.value.stops[0])==="array"&&Lr(t.value.stops[0][0])==="object",P=fo({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(U){if(d==="identity")return[new at(U.key,U.value,'identity function may not have a "stops" property')];var Q=[],$=U.value;return Q=Q.concat(qp({key:U.key,value:$,valueSpec:U.valueSpec,style:U.style,styleSpec:U.styleSpec,arrayElementValidator:L})),Lr($)==="array"&&$.length===0&&Q.push(new at(U.key,$,"array must have at least one stop")),Q},default:function(U){return ir({key:U.key,value:U.value,valueSpec:f,style:U.style,styleSpec:U.styleSpec})}}});return d==="identity"&&w&&P.push(new at(t.key,t.value,'missing required property "property"')),d==="identity"||t.value.stops||P.push(new at(t.key,t.value,'missing required property "stops"')),d==="exponential"&&t.valueSpec.expression&&!Hh(t.valueSpec)&&P.push(new at(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(T&&!As(t.valueSpec)?P.push(new at(t.key,t.value,"property functions not supported")):w&&!au(t.valueSpec)&&P.push(new at(t.key,t.value,"zoom functions not supported"))),d!=="categorical"&&!I||t.value.property!==void 0||P.push(new at(t.key,t.value,'"property" property is required')),P;function L(U){var Q=[],$=U.value,ct=U.key;if(Lr($)!=="array")return[new at(ct,$,"array expected, "+Lr($)+" found")];if($.length!==2)return[new at(ct,$,"array length 2 expected, length "+$.length+" found")];if(I){if(Lr($[0])!=="object")return[new at(ct,$,"object expected, "+Lr($[0])+" found")];if($[0].zoom===void 0)return[new at(ct,$,"object stop key must have zoom")];if($[0].value===void 0)return[new at(ct,$,"object stop key must have value")];if(h&&h>wt($[0].zoom))return[new at(ct,$[0].zoom,"stop zoom values must appear in ascending order")];wt($[0].zoom)!==h&&(h=wt($[0].zoom),o=void 0,g={}),Q=Q.concat(fo({key:ct+"[0]",value:$[0],valueSpec:{zoom:{}},style:U.style,styleSpec:U.styleSpec,objectElementValidators:{zoom:Wp,value:N}}))}else Q=Q.concat(N({key:ct+"[0]",value:$[0],valueSpec:{},style:U.style,styleSpec:U.styleSpec},$));return lu(Ft($[1]))?Q.concat([new at(ct+"[1]",$[1],"expressions are not allowed in function stops.")]):Q.concat(ir({key:ct+"[1]",value:$[1],valueSpec:f,style:U.style,styleSpec:U.styleSpec}))}function N(U,Q){var $=Lr(U.value),ct=wt(U.value),st=U.value!==null?U.value:Q;if(e){if($!==e)return[new at(U.key,st,$+" stop domain type must match previous stop domain type "+e)]}else e=$;if($!=="number"&&$!=="string"&&$!=="boolean")return[new at(U.key,st,"stop domain value must be a number, string, or boolean")];if($!=="number"&&d!=="categorical"){var vt="number expected, "+$+" found";return As(f)&&d===void 0&&(vt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new at(U.key,st,vt)]}return d!=="categorical"||$!=="number"||isFinite(ct)&&Math.floor(ct)===ct?d!=="categorical"&&$==="number"&&o!==void 0&&ct<o?[new at(U.key,st,"stop domain values must appear in ascending order")]:(o=ct,d==="categorical"&&ct in g?[new at(U.key,st,"stop domain values must be unique")]:(g[ct]=!0,[])):[new at(U.key,st,"integer expected, found "+ct)]}}function ja(t){var e=(t.expressionContext==="property"?Zh:uu)(Ft(t.value),t.valueSpec);if(e.result==="error")return e.value.map(function(h){return new at(""+t.key+h.key,t.value,h.message)});var o=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!o.outputDefined())return[new at(t.key,t.value,'Invalid data expression for "'+t.propertyKey+'". Output values must be contained as literals within the expression.')];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!$o(o))return[new at(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if(t.expressionContext==="filter"&&!$o(o))return[new at(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!iu(o,["zoom","feature-state"]))return[new at(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(t.expressionContext==="cluster-initial"&&!Oa(o))return[new at(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function fl(t){var e=t.key,o=t.value,h=t.valueSpec,f=[];return Array.isArray(h.values)?h.values.indexOf(wt(o))===-1&&f.push(new at(e,o,"expected one of ["+h.values.join(", ")+"], "+JSON.stringify(o)+" found")):Object.keys(h.values).indexOf(wt(o))===-1&&f.push(new at(e,o,"expected one of ["+Object.keys(h.values).join(", ")+"], "+JSON.stringify(o)+" found")),f}function dl(t){if(t===!0||t===!1)return!0;if(!Array.isArray(t)||t.length===0)return!1;switch(t[0]){case"has":return t.length>=2&&t[1]!=="$id"&&t[1]!=="$type";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(var e=0,o=t.slice(1);e<o.length;e+=1){var h=o[e];if(!dl(h)&&typeof h!="boolean")return!1}return!0;default:return!0}}pl.deserialize=function(t){return new pl(t._parameters,t._specification)},pl.serialize=function(t){return{_parameters:t._parameters,_specification:t._specification}};var hm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function hu(t){if(t==null)return{filter:function(){return!0},needGeometry:!1};dl(t)||(t=cu(t));var e=uu(t,hm);if(e.result==="error")throw new Error(e.value.map(function(o){return o.key+": "+o.message}).join(", "));return{filter:function(o,h,f){return e.value.evaluate(o,h,{},f)},needGeometry:function o(h){if(!Array.isArray(h))return!1;if(h[0]==="within")return!0;for(var f=1;f<h.length;f++)if(o(h[f]))return!0;return!1}(t)}}function cm(t,e){return t<e?-1:t>e?1:0}function cu(t){if(!t)return!0;var e,o=t[0];return t.length<=1?o!=="any":o==="=="?Yh(t[1],t[2],"=="):o==="!="?pu(Yh(t[1],t[2],"==")):o==="<"||o===">"||o==="<="||o===">="?Yh(t[1],t[2],o):o==="any"?(e=t.slice(1),["any"].concat(e.map(cu))):o==="all"?["all"].concat(t.slice(1).map(cu)):o==="none"?["all"].concat(t.slice(1).map(cu).map(pu)):o==="in"?Kp(t[1],t.slice(2)):o==="!in"?pu(Kp(t[1],t.slice(2))):o==="has"?Hp(t[1]):o==="!has"?pu(Hp(t[1])):o!=="within"||t}function Yh(t,e,o){switch(t){case"$type":return["filter-type-"+o,e];case"$id":return["filter-id-"+o,e];default:return["filter-"+o,t,e]}}function Kp(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(function(o){return typeof o!=typeof e[0]})?["filter-in-large",t,["literal",e.sort(cm)]]:["filter-in-small",t,["literal",e]]}}function Hp(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function pu(t){return["!",t]}function fu(t){return dl(Ft(t.value))?ja(Wt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function e(o){var h=o.value,f=o.key;if(Lr(h)!=="array")return[new at(f,h,"array expected, "+Lr(h)+" found")];var d,g=o.styleSpec,w=[];if(h.length<1)return[new at(f,h,"filter array must have at least 1 element")];switch(w=w.concat(fl({key:f+"[0]",value:h[0],valueSpec:g.filter_operator,style:o.style,styleSpec:o.styleSpec})),wt(h[0])){case"<":case"<=":case">":case">=":h.length>=2&&wt(h[1])==="$type"&&w.push(new at(f,h,'"$type" cannot be use with operator "'+h[0]+'"'));case"==":case"!=":h.length!==3&&w.push(new at(f,h,'filter array for operator "'+h[0]+'" must have 3 elements'));case"in":case"!in":h.length>=2&&(d=Lr(h[1]))!=="string"&&w.push(new at(f+"[1]",h[1],"string expected, "+d+" found"));for(var T=2;T<h.length;T++)d=Lr(h[T]),wt(h[1])==="$type"?w=w.concat(fl({key:f+"["+T+"]",value:h[T],valueSpec:g.geometry_type,style:o.style,styleSpec:o.styleSpec})):d!=="string"&&d!=="number"&&d!=="boolean"&&w.push(new at(f+"["+T+"]",h[T],"string, number, or boolean expected, "+d+" found"));break;case"any":case"all":case"none":for(var I=1;I<h.length;I++)w=w.concat(e({key:f+"["+I+"]",value:h[I],style:o.style,styleSpec:o.styleSpec}));break;case"has":case"!has":d=Lr(h[1]),h.length!==2?w.push(new at(f,h,'filter array for "'+h[0]+'" operator must have 2 elements')):d!=="string"&&w.push(new at(f+"[1]",h[1],"string expected, "+d+" found"));break;case"within":d=Lr(h[1]),h.length!==2?w.push(new at(f,h,'filter array for "'+h[0]+'" operator must have 2 elements')):d!=="object"&&w.push(new at(f+"[1]",h[1],"object expected, "+d+" found"))}return w}(t)}function Jh(t,e){var o=t.key,h=t.style,f=t.styleSpec,d=t.value,g=t.objectKey,w=f[e+"_"+t.layerType];if(!w)return[];var T=g.match(/^(.*)-transition$/);if(e==="paint"&&T&&w[T[1]]&&w[T[1]].transition)return ir({key:o,value:d,valueSpec:f.transition,style:h,styleSpec:f});var I,P=t.valueSpec||w[g];if(!P)return[new at(o,d,'unknown property "'+g+'"')];if(Lr(d)==="string"&&As(P)&&!P.tokens&&(I=/^{([^}]+)}$/.exec(d)))return[new at(o,d,'"'+g+'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": '+JSON.stringify(I[1])+" }`.")];var L=[];return t.layerType==="symbol"&&(g==="text-field"&&h&&!h.glyphs&&L.push(new at(o,d,'use of "text-field" requires a style "glyphs" property')),g==="text-font"&&su(Ft(d))&&wt(d.type)==="identity"&&L.push(new at(o,d,'"text-font" does not support identity functions'))),L.concat(ir({key:t.key,value:d,valueSpec:P,style:h,styleSpec:f,expressionContext:"property",propertyType:e,propertyKey:g}))}function ml(t){return Jh(t,"paint")}function Zp(t){return Jh(t,"layout")}function Qh(t){var e=[],o=t.value,h=t.key,f=t.style,d=t.styleSpec;o.type||o.ref||e.push(new at(h,o,'either "type" or "ref" is required'));var g,w=wt(o.type),T=wt(o.ref);if(o.id)for(var I=wt(o.id),P=0;P<t.arrayIndex;P++){var L=f.layers[P];wt(L.id)===I&&e.push(new at(h,o.id,'duplicate layer id "'+o.id+'", previously used at line '+L.id.__line__))}if("ref"in o)["type","source","source-layer","filter","layout"].forEach(function(Q){Q in o&&e.push(new at(h,o[Q],'"'+Q+'" is prohibited for ref layers'))}),f.layers.forEach(function(Q){wt(Q.id)===T&&(g=Q)}),g?g.ref?e.push(new at(h,o.ref,"ref cannot reference another ref layer")):w=wt(g.type):e.push(new at(h,o.ref,'ref layer "'+T+'" not found'));else if(w!=="background")if(o.source){var N=f.sources&&f.sources[o.source],U=N&&wt(N.type);N?U==="vector"&&w==="raster"?e.push(new at(h,o.source,'layer "'+o.id+'" requires a raster source')):U==="raster"&&w!=="raster"?e.push(new at(h,o.source,'layer "'+o.id+'" requires a vector source')):U!=="vector"||o["source-layer"]?U==="raster-dem"&&w!=="hillshade"?e.push(new at(h,o.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="line"||!o.paint||!o.paint["line-gradient"]||U==="geojson"&&N.lineMetrics||e.push(new at(h,o,'layer "'+o.id+'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.')):e.push(new at(h,o,'layer "'+o.id+'" must specify a "source-layer"')):e.push(new at(h,o.source,'source "'+o.source+'" not found'))}else e.push(new at(h,o,'missing required property "source"'));return e=e.concat(fo({key:h,value:o,valueSpec:d.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(){return[]},type:function(){return ir({key:h+".type",value:o.type,valueSpec:d.layer.type,style:t.style,styleSpec:t.styleSpec,object:o,objectKey:"type"})},filter:fu,layout:function(Q){return fo({layer:o,key:Q.key,value:Q.value,style:Q.style,styleSpec:Q.styleSpec,objectElementValidators:{"*":function($){return Zp(Wt({layerType:w},$))}}})},paint:function(Q){return fo({layer:o,key:Q.key,value:Q.value,style:Q.style,styleSpec:Q.styleSpec,objectElementValidators:{"*":function($){return ml(Wt({layerType:w},$))}}})}}}))}function br(t){var e=t.value,o=t.key,h=Lr(e);return h!=="string"?[new at(o,e,"string expected, "+h+" found")]:[]}var du={promoteId:function(t){var e=t.key,o=t.value;if(Lr(o)==="string")return br({key:e,value:o});var h=[];for(var f in o)h.push.apply(h,br({key:e+"."+f,value:o[f]}));return h}};function qa(t){var e=t.value,o=t.key,h=t.styleSpec,f=t.style;if(!e.type)return[new at(o,e,'"type" is required')];var d,g=wt(e.type);switch(g){case"vector":case"raster":case"raster-dem":return fo({key:o,value:e,valueSpec:h["source_"+g.replace("-","_")],style:t.style,styleSpec:h,objectElementValidators:du});case"geojson":if(d=fo({key:o,value:e,valueSpec:h.source_geojson,style:f,styleSpec:h,objectElementValidators:du}),e.cluster)for(var w in e.clusterProperties){var T=e.clusterProperties[w],I=T[0],P=typeof I=="string"?[I,["accumulated"],["get",w]]:I;d.push.apply(d,ja({key:o+"."+w+".map",value:T[1],expressionContext:"cluster-map"})),d.push.apply(d,ja({key:o+"."+w+".reduce",value:P,expressionContext:"cluster-reduce"}))}return d;case"video":return fo({key:o,value:e,valueSpec:h.source_video,style:f,styleSpec:h});case"image":return fo({key:o,value:e,valueSpec:h.source_image,style:f,styleSpec:h});case"canvas":return[new at(o,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return fl({key:o+".type",value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:f,styleSpec:h})}}function la(t){var e=t.value,o=t.styleSpec,h=o.light,f=t.style,d=[],g=Lr(e);if(e===void 0)return d;if(g!=="object")return d.concat([new at("light",e,"object expected, "+g+" found")]);for(var w in e){var T=w.match(/^(.*)-transition$/);d=d.concat(T&&h[T[1]]&&h[T[1]].transition?ir({key:w,value:e[w],valueSpec:o.transition,style:f,styleSpec:o}):h[w]?ir({key:w,value:e[w],valueSpec:h[w],style:f,styleSpec:o}):[new at(w,e[w],'unknown property "'+w+'"')])}return d}var gr={"*":function(){return[]},array:qp,boolean:function(t){var e=t.value,o=t.key,h=Lr(e);return h!=="boolean"?[new at(o,e,"boolean expected, "+h+" found")]:[]},number:Wp,color:function(t){var e=t.key,o=t.value,h=Lr(o);return h!=="string"?[new at(e,o,"color expected, "+h+" found")]:Ts(o)===null?[new at(e,o,'color expected, "'+o+'" found')]:[]},constants:Ot,enum:fl,filter:fu,function:Xh,layer:Qh,object:fo,source:qa,light:la,string:br,formatted:function(t){return br(t).length===0?[]:ja(t)},resolvedImage:function(t){return br(t).length===0?[]:ja(t)}};function ir(t){var e=t.value,o=t.valueSpec,h=t.styleSpec;return o.expression&&su(wt(e))?Xh(t):o.expression&&lu(Ft(e))?ja(t):o.type&&gr[o.type]?gr[o.type](t):fo(Wt({},t,{valueSpec:o.type?h[o.type]:o}))}function Wa(t){var e=t.value,o=t.key,h=br(t);return h.length||(e.indexOf("{fontstack}")===-1&&h.push(new at(o,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&h.push(new at(o,e,'"glyphs" url must include a "{range}" token'))),h}function Eo(t,e){e===void 0&&(e=X);var o=[];return o=o.concat(ir({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:Wa,"*":function(){return[]}}})),t.constants&&(o=o.concat(Ot({key:"constants",value:t.constants,style:t,styleSpec:e}))),Xp(o)}function Xp(t){return[].concat(t).sort(function(e,o){return e.line-o.line})}function Rs(t){return function(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];return Xp(t.apply(this,e))}}Eo.source=Rs(qa),Eo.light=Rs(la),Eo.layer=Rs(Qh),Eo.filter=Rs(fu),Eo.paintProperty=Rs(ml),Eo.layoutProperty=Rs(Zp);var yl=Eo,pm=yl.light,gl=yl.paintProperty,mu=yl.layoutProperty;function vl(t,e){var o=!1;if(e&&e.length)for(var h=0,f=e;h<f.length;h+=1)t.fire(new gt(new Error(f[h].message))),o=!0;return o}var tn=qn;function qn(t,e,o){var h=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var f=new Int32Array(this.arrayBuffer);t=f[0],this.d=(e=f[1])+2*(o=f[2]);for(var d=0;d<this.d*this.d;d++){var g=f[3+d],w=f[3+d+1];h.push(g===w?null:f.subarray(g,w))}var T=f[3+h.length+1];this.keys=f.subarray(f[3+h.length],T),this.bboxes=f.subarray(T),this.insert=this._insertReadonly}else{this.d=e+2*o;for(var I=0;I<this.d*this.d;I++)h.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=o,this.scale=e/t,this.uid=0;var P=o/e*t;this.min=-P,this.max=t+P}qn.prototype.insert=function(t,e,o,h,f){this._forEachCell(e,o,h,f,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(o),this.bboxes.push(h),this.bboxes.push(f)},qn.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},qn.prototype._insertCell=function(t,e,o,h,f,d){this.cells[f].push(d)},qn.prototype.query=function(t,e,o,h,f){var d=this.min,g=this.max;if(t<=d&&e<=d&&g<=o&&g<=h&&!f)return Array.prototype.slice.call(this.keys);var w=[];return this._forEachCell(t,e,o,h,this._queryCell,w,{},f),w},qn.prototype._queryCell=function(t,e,o,h,f,d,g,w){var T=this.cells[f];if(T!==null)for(var I=this.keys,P=this.bboxes,L=0;L<T.length;L++){var N=T[L];if(g[N]===void 0){var U=4*N;(w?w(P[U+0],P[U+1],P[U+2],P[U+3]):t<=P[U+2]&&e<=P[U+3]&&o>=P[U+0]&&h>=P[U+1])?(g[N]=!0,d.push(I[N])):g[N]=!1}}},qn.prototype._forEachCell=function(t,e,o,h,f,d,g,w){for(var T=this._convertToCellCoord(t),I=this._convertToCellCoord(e),P=this._convertToCellCoord(o),L=this._convertToCellCoord(h),N=T;N<=P;N++)for(var U=I;U<=L;U++){var Q=this.d*U+N;if((!w||w(this._convertFromCellCoord(N),this._convertFromCellCoord(U),this._convertFromCellCoord(N+1),this._convertFromCellCoord(U+1)))&&f.call(this,t,e,o,h,Q,d,g,w))return}},qn.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},qn.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},qn.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,o=0,h=0;h<this.cells.length;h++)o+=this.cells[h].length;var f=new Int32Array(e+o+this.keys.length+this.bboxes.length);f[0]=this.extent,f[1]=this.n,f[2]=this.padding;for(var d=e,g=0;g<t.length;g++){var w=t[g];f[3+g]=d,f.set(w,d),d+=w.length}return f[3+t.length]=d,f.set(this.keys,d),f[3+t.length+1]=d+=this.keys.length,f.set(this.bboxes,d),d+=this.bboxes.length,f.buffer};var Yp=C.ImageData,Ui=C.ImageBitmap,Ln={};function oe(t,e,o){o===void 0&&(o={}),Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Ln[t]={klass:e,omit:o.omit||[],shallow:o.shallow||[]}}for(var _l in oe("Object",Object),tn.serialize=function(t,e){var o=t.toArrayBuffer();return e&&e.push(o),{buffer:o}},tn.deserialize=function(t){return new tn(t.buffer)},oe("Grid",tn),oe("Color",$e),oe("Error",Error),oe("ResolvedImage",xn),oe("StylePropertyFunction",pl),oe("StyleExpression",Ls,{omit:["_evaluator"]}),oe("ZoomDependentExpression",ks),oe("ZoomConstantExpression",cl),oe("CompoundExpression",Bi,{omit:["_evaluate"]}),Cs)Cs[_l]._classRegistryKey||oe("Expression_"+_l,Cs[_l]);function zs(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}function ua(t){return Ui&&t instanceof Ui}function kn(t,e){if(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp)return t;if(zs(t)||ua(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){var o=t;return e&&e.push(o.buffer),o}if(t instanceof Yp)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){for(var h=[],f=0,d=t;f<d.length;f+=1)h.push(kn(d[f],e));return h}if(typeof t=="object"){var g=t.constructor,w=g._classRegistryKey;if(!w)throw new Error("can't serialize object of unregistered class");var T=g.serialize?g.serialize(t,e):{};if(!g.serialize){for(var I in t)if(t.hasOwnProperty(I)&&!(Ln[w].omit.indexOf(I)>=0)){var P=t[I];T[I]=Ln[w].shallow.indexOf(I)>=0?P:kn(P,e)}t instanceof Error&&(T.message=t.message)}if(T.$name)throw new Error("$name property is reserved for worker serialization logic.");return w!=="Object"&&(T.$name=w),T}throw new Error("can't serialize object of type "+typeof t)}function xl(t){if(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||zs(t)||ua(t)||ArrayBuffer.isView(t)||t instanceof Yp)return t;if(Array.isArray(t))return t.map(xl);if(typeof t=="object"){var e=t.$name||"Object",o=Ln[e].klass;if(!o)throw new Error("can't deserialize unregistered class "+e);if(o.deserialize)return o.deserialize(t);for(var h=Object.create(o.prototype),f=0,d=Object.keys(t);f<d.length;f+=1){var g=d[f];if(g!=="$name"){var w=t[g];h[g]=Ln[e].shallow.indexOf(g)>=0?w:xl(w)}}return h}throw new Error("can't deserialize object of type "+typeof t)}var Sn=function(){this.first=!0};Sn.prototype.update=function(t,e){var o=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=o,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=o,!0):(this.lastFloorZoom>o?(this.lastIntegerZoom=o+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<o&&(this.lastIntegerZoom=o,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=o,!0))};var le={"Latin-1 Supplement":function(t){return t>=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function yu(t){for(var e=0,o=t;e<o.length;e+=1)if(gu(o[e].charCodeAt(0)))return!0;return!1}function gu(t){return!(t!==746&&t!==747&&(t<4352||!(le["Bopomofo Extended"](t)||le.Bopomofo(t)||le["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||le["CJK Compatibility Ideographs"](t)||le["CJK Compatibility"](t)||le["CJK Radicals Supplement"](t)||le["CJK Strokes"](t)||!(!le["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||t===12336)||le["CJK Unified Ideographs Extension A"](t)||le["CJK Unified Ideographs"](t)||le["Enclosed CJK Letters and Months"](t)||le["Hangul Compatibility Jamo"](t)||le["Hangul Jamo Extended-A"](t)||le["Hangul Jamo Extended-B"](t)||le["Hangul Jamo"](t)||le["Hangul Syllables"](t)||le.Hiragana(t)||le["Ideographic Description Characters"](t)||le.Kanbun(t)||le["Kangxi Radicals"](t)||le["Katakana Phonetic Extensions"](t)||le.Katakana(t)&&t!==12540||!(!le["Halfwidth and Fullwidth Forms"](t)||t===65288||t===65289||t===65293||t>=65306&&t<=65310||t===65339||t===65341||t===65343||t>=65371&&t<=65503||t===65507||t>=65512&&t<=65519)||!(!le["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||le["Unified Canadian Aboriginal Syllabics"](t)||le["Unified Canadian Aboriginal Syllabics Extended"](t)||le["Vertical Forms"](t)||le["Yijing Hexagram Symbols"](t)||le["Yi Syllables"](t)||le["Yi Radicals"](t))))}function ro(t){return!(gu(t)||function(e){return!!(le["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||le["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||le["Letterlike Symbols"](e)||le["Number Forms"](e)||le["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||le["Control Pictures"](e)&&e!==9251||le["Optical Character Recognition"](e)||le["Enclosed Alphanumerics"](e)||le["Geometric Shapes"](e)||le["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||le["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||le["CJK Symbols and Punctuation"](e)||le.Katakana(e)||le["Private Use Area"](e)||le["CJK Compatibility Forms"](e)||le["Small Form Variants"](e)||le["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(t))}function En(t){return t>=1424&&t<=2303||le["Arabic Presentation Forms-A"](t)||le["Arabic Presentation Forms-B"](t)}function vu(t,e){return!(!e&&En(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||le.Khmer(t))}function Jp(t){for(var e=0,o=t;e<o.length;e+=1)if(En(o[e].charCodeAt(0)))return!0;return!1}var $h=null,Tn="unavailable",ha=null,_u=function(t){t&&typeof t=="string"&&t.indexOf("NetworkError")>-1&&(Tn="error"),$h&&$h(t)};function tc(){ec.fire(new pt("pluginStateChange",{pluginStatus:Tn,pluginURL:ha}))}var ec=new ht,mo=function(){return Tn},Qp=function(){if(Tn!=="deferred"||!ha)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Tn="loading",tc(),ha&&xr({url:ha},function(t){t?_u(t):(Tn="loaded",tc())})},Zr={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return Tn==="loaded"||Zr.applyArabicShaping!=null},isLoading:function(){return Tn==="loading"},setState:function(t){Tn=t.pluginStatus,ha=t.pluginURL},isParsed:function(){return Zr.applyArabicShaping!=null&&Zr.processBidirectionalText!=null&&Zr.processStyledBidirectionalText!=null},getPluginURL:function(){return ha}},fr=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Sn,this.transition={})};fr.prototype.isSupportedScript=function(t){return function(e,o){for(var h=0,f=e;h<f.length;h+=1)if(!vu(f[h].charCodeAt(0),o))return!1;return!0}(t,Zr.isLoaded())},fr.prototype.crossFadingFactor=function(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)},fr.prototype.getCrossfadeParameters=function(){var t=this.zoom,e=t-Math.floor(t),o=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*o}:{fromScale:.5,toScale:1,t:1-(1-o)*e}};var io=function(t,e){this.property=t,this.value=e,this.expression=function(o,h){if(su(o))return new pl(o,h);if(lu(o)){var f=Zh(o,h);if(f.result==="error")throw new Error(f.value.map(function(g){return g.key+": "+g.message}).join(", "));return f.value}var d=o;return typeof o=="string"&&h.type==="color"&&(d=$e.parse(o)),{kind:"constant",evaluate:function(){return d}}}(e===void 0?t.specification.default:e,t.specification)};io.prototype.isDataDriven=function(){return this.expression.kind==="source"||this.expression.kind==="composite"},io.prototype.possiblyEvaluate=function(t,e,o){return this.property.possiblyEvaluate(this,t,e,o)};var Rn=function(t){this.property=t,this.value=new io(t,void 0)};Rn.prototype.transitioned=function(t,e){return new Ka(this.property,this.value,e,ft({},t.transition,this.transition),t.now)},Rn.prototype.untransitioned=function(){return new Ka(this.property,this.value,null,{},0)};var Wn=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};Wn.prototype.getValue=function(t){return Te(this._values[t].value.value)},Wn.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Rn(this._values[t].property)),this._values[t].value=new io(this._values[t].property,e===null?void 0:Te(e))},Wn.prototype.getTransition=function(t){return Te(this._values[t].transition)},Wn.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Rn(this._values[t].property)),this._values[t].transition=Te(e)||void 0},Wn.prototype.serialize=function(){for(var t={},e=0,o=Object.keys(this._values);e<o.length;e+=1){var h=o[e],f=this.getValue(h);f!==void 0&&(t[h]=f);var d=this.getTransition(h);d!==void 0&&(t[h+"-transition"]=d)}return t},Wn.prototype.transitioned=function(t,e){for(var o=new To(this._properties),h=0,f=Object.keys(this._values);h<f.length;h+=1){var d=f[h];o._values[d]=this._values[d].transitioned(t,e._values[d])}return o},Wn.prototype.untransitioned=function(){for(var t=new To(this._properties),e=0,o=Object.keys(this._values);e<o.length;e+=1){var h=o[e];t._values[h]=this._values[h].untransitioned()}return t};var Ka=function(t,e,o,h,f){this.property=t,this.value=e,this.begin=f+h.delay||0,this.end=this.begin+h.duration||0,t.specification.transition&&(h.delay||h.duration)&&(this.prior=o)};Ka.prototype.possiblyEvaluate=function(t,e,o){var h=t.now||0,f=this.value.possiblyEvaluate(t,e,o),d=this.prior;if(d){if(h>this.end)return this.prior=null,f;if(this.value.isDataDriven())return this.prior=null,f;if(h<this.begin)return d.possiblyEvaluate(t,e,o);var g=(h-this.begin)/(this.end-this.begin);return this.property.interpolate(d.possiblyEvaluate(t,e,o),f,function(w){if(w<=0)return 0;if(w>=1)return 1;var T=w*w,I=T*w;return 4*(w<.5?I:3*(w-T)+I-.75)}(g))}return f};var To=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};To.prototype.possiblyEvaluate=function(t,e,o){for(var h=new Ha(this._properties),f=0,d=Object.keys(this._values);f<d.length;f+=1){var g=d[f];h._values[g]=this._values[g].possiblyEvaluate(t,e,o)}return h},To.prototype.hasTransition=function(){for(var t=0,e=Object.keys(this._values);t<e.length;t+=1)if(this._values[e[t]].prior)return!0;return!1};var ca=function(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)};ca.prototype.getValue=function(t){return Te(this._values[t].value)},ca.prototype.setValue=function(t,e){this._values[t]=new io(this._values[t].property,e===null?void 0:Te(e))},ca.prototype.serialize=function(){for(var t={},e=0,o=Object.keys(this._values);e<o.length;e+=1){var h=o[e],f=this.getValue(h);f!==void 0&&(t[h]=f)}return t},ca.prototype.possiblyEvaluate=function(t,e,o){for(var h=new Ha(this._properties),f=0,d=Object.keys(this._values);f<d.length;f+=1){var g=d[f];h._values[g]=this._values[g].possiblyEvaluate(t,e,o)}return h};var Kn=function(t,e,o){this.property=t,this.value=e,this.parameters=o};Kn.prototype.isConstant=function(){return this.value.kind==="constant"},Kn.prototype.constantOr=function(t){return this.value.kind==="constant"?this.value.value:t},Kn.prototype.evaluate=function(t,e,o,h){return this.property.evaluate(this.value,this.parameters,t,e,o,h)};var Ha=function(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)};Ha.prototype.get=function(t){return this._values[t]};var re=function(t){this.specification=t};re.prototype.possiblyEvaluate=function(t,e){return t.expression.evaluate(e)},re.prototype.interpolate=function(t,e,o){var h=nu[this.specification.type];return h?h(t,e,o):t};var Ie=function(t,e){this.specification=t,this.overrides=e};Ie.prototype.possiblyEvaluate=function(t,e,o,h){return new Kn(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(e,null,{},o,h)}:t.expression,e)},Ie.prototype.interpolate=function(t,e,o){if(t.value.kind!=="constant"||e.value.kind!=="constant")return t;if(t.value.value===void 0||e.value.value===void 0)return new Kn(this,{kind:"constant",value:void 0},t.parameters);var h=nu[this.specification.type];return h?new Kn(this,{kind:"constant",value:h(t.value.value,e.value.value,o)},t.parameters):t},Ie.prototype.evaluate=function(t,e,o,h,f,d){return t.kind==="constant"?t.value:t.evaluate(e,o,h,f,d)};var zn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(o,h,f,d){if(o.value===void 0)return new Kn(this,{kind:"constant",value:void 0},h);if(o.expression.kind==="constant"){var g=o.expression.evaluate(h,null,{},f,d),w=o.property.specification.type==="resolvedImage"&&typeof g!="string"?g.name:g,T=this._calculate(w,w,w,h);return new Kn(this,{kind:"constant",value:T},h)}if(o.expression.kind==="camera"){var I=this._calculate(o.expression.evaluate({zoom:h.zoom-1}),o.expression.evaluate({zoom:h.zoom}),o.expression.evaluate({zoom:h.zoom+1}),h);return new Kn(this,{kind:"constant",value:I},h)}return new Kn(this,o.expression,h)},e.prototype.evaluate=function(o,h,f,d,g,w){if(o.kind==="source"){var T=o.evaluate(h,f,d,g,w);return this._calculate(T,T,T,h)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(h.zoom)-1},f,d),o.evaluate({zoom:Math.floor(h.zoom)},f,d),o.evaluate({zoom:Math.floor(h.zoom)+1},f,d),h):o.value},e.prototype._calculate=function(o,h,f,d){return d.zoom>d.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:f,to:h}},e.prototype.interpolate=function(o){return o},e}(Ie),no=function(t){this.specification=t};no.prototype.possiblyEvaluate=function(t,e,o,h){if(t.value!==void 0){if(t.expression.kind==="constant"){var f=t.expression.evaluate(e,null,{},o,h);return this._calculate(f,f,f,e)}return this._calculate(t.expression.evaluate(new fr(Math.floor(e.zoom-1),e)),t.expression.evaluate(new fr(Math.floor(e.zoom),e)),t.expression.evaluate(new fr(Math.floor(e.zoom+1),e)),e)}},no.prototype._calculate=function(t,e,o,h){return h.zoom>h.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:o,to:e}},no.prototype.interpolate=function(t){return t};var Fo=function(t){this.specification=t};Fo.prototype.possiblyEvaluate=function(t,e,o,h){return!!t.expression.evaluate(e,null,{},o,h)},Fo.prototype.interpolate=function(){return!1};var Dn=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],t){var o=t[e];o.specification.overridable&&this.overridableProperties.push(e);var h=this.defaultPropertyValues[e]=new io(o,void 0),f=this.defaultTransitionablePropertyValues[e]=new Rn(o);this.defaultTransitioningPropertyValues[e]=f.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=h.possiblyEvaluate({})}};oe("DataDrivenProperty",Ie),oe("DataConstantProperty",re),oe("CrossFadedDataDrivenProperty",zn),oe("CrossFadedProperty",no),oe("ColorRampProperty",Fo);var oo=function(t){function e(o,h){if(t.call(this),this.id=o.id,this.type=o.type,this._featureFilter={filter:function(){return!0},needGeometry:!1},o.type!=="custom"&&(this.metadata=(o=o).metadata,this.minzoom=o.minzoom,this.maxzoom=o.maxzoom,o.type!=="background"&&(this.source=o.source,this.sourceLayer=o["source-layer"],this.filter=o.filter),h.layout&&(this._unevaluatedLayout=new ca(h.layout)),h.paint)){for(var f in this._transitionablePaint=new Wn(h.paint),o.paint)this.setPaintProperty(f,o.paint[f],{validate:!1});for(var d in o.layout)this.setLayoutProperty(d,o.layout[d],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ha(h.paint)}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},e.prototype.getLayoutProperty=function(o){return o==="visibility"?this.visibility:this._unevaluatedLayout.getValue(o)},e.prototype.setLayoutProperty=function(o,h,f){f===void 0&&(f={}),h!=null&&this._validate(mu,"layers."+this.id+".layout."+o,o,h,f)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,h):this.visibility=h)},e.prototype.getPaintProperty=function(o){return Kt(o,"-transition")?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)},e.prototype.setPaintProperty=function(o,h,f){if(f===void 0&&(f={}),h!=null&&this._validate(gl,"layers."+this.id+".paint."+o,o,h,f))return!1;if(Kt(o,"-transition"))return this._transitionablePaint.setTransition(o.slice(0,-11),h||void 0),!1;var d=this._transitionablePaint._values[o],g=d.property.specification["property-type"]==="cross-faded-data-driven",w=d.value.isDataDriven(),T=d.value;this._transitionablePaint.setValue(o,h),this._handleSpecialPaintPropertyUpdate(o);var I=this._transitionablePaint._values[o].value;return I.isDataDriven()||w||g||this._handleOverridablePaintPropertyUpdate(o,T,I)},e.prototype._handleSpecialPaintPropertyUpdate=function(o){},e.prototype._handleOverridablePaintPropertyUpdate=function(o,h,f){return!1},e.prototype.isHidden=function(o){return!!(this.minzoom&&o<this.minzoom)||!!(this.maxzoom&&o>=this.maxzoom)||this.visibility==="none"},e.prototype.updateTransitions=function(o){this._transitioningPaint=this._transitionablePaint.transitioned(o,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(o,h){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,h)},e.prototype.serialize=function(){var o={id:this.id,type:this.type,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()};return this.visibility&&(o.layout=o.layout||{},o.layout.visibility=this.visibility),Yt(o,function(h,f){return!(h===void 0||f==="layout"&&!Object.keys(h).length||f==="paint"&&!Object.keys(h).length)})},e.prototype._validate=function(o,h,f,d,g){return g===void 0&&(g={}),(!g||g.validate!==!1)&&vl(this,o.call(yl,{key:h,layerType:this.type,objectKey:f,value:d,styleSpec:X,style:{glyphs:!0,sprite:!0}}))},e.prototype.is3D=function(){return!1},e.prototype.isTileClipped=function(){return!1},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e.prototype.isStateDependent=function(){for(var o in this.paint._values){var h=this.paint.get(o);if(h instanceof Kn&&As(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1},e}(ht),fm={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Bo=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},kr=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function Gi(t,e){e===void 0&&(e=1);var o=0,h=0;return{members:t.map(function(f){var d=fm[f.type].BYTES_PER_ELEMENT,g=o=rc(o,Math.max(e,d)),w=f.components||1;return h=Math.max(h,d),o+=d*w,{name:f.name,type:f.type,components:w,offset:g}}),size:rc(o,Math.max(h,e)),alignment:e}}function rc(t,e){return Math.ceil(t/e)*e}kr.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},kr.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},kr.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},kr.prototype.clear=function(){this.length=0},kr.prototype.resize=function(t){this.reserve(t),this.length=t},kr.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},kr.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var bl=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h){var f=this.length;return this.resize(f+1),this.emplace(f,o,h)},e.prototype.emplace=function(o,h,f){var d=2*o;return this.int16[d+0]=h,this.int16[d+1]=f,o},e}(kr);bl.prototype.bytesPerElement=4,oe("StructArrayLayout2i4",bl);var Uo=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h,f,d){var g=this.length;return this.resize(g+1),this.emplace(g,o,h,f,d)},e.prototype.emplace=function(o,h,f,d,g){var w=4*o;return this.int16[w+0]=h,this.int16[w+1]=f,this.int16[w+2]=d,this.int16[w+3]=g,o},e}(kr);Uo.prototype.bytesPerElement=8,oe("StructArrayLayout4i8",Uo);var On=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h,f,d,g,w){var T=this.length;return this.resize(T+1),this.emplace(T,o,h,f,d,g,w)},e.prototype.emplace=function(o,h,f,d,g,w,T){var I=6*o;return this.int16[I+0]=h,this.int16[I+1]=f,this.int16[I+2]=d,this.int16[I+3]=g,this.int16[I+4]=w,this.int16[I+5]=T,o},e}(kr);On.prototype.bytesPerElement=12,oe("StructArrayLayout2i4i12",On);var xu=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h,f,d,g,w){var T=this.length;return this.resize(T+1),this.emplace(T,o,h,f,d,g,w)},e.prototype.emplace=function(o,h,f,d,g,w,T){var I=4*o,P=8*o;return this.int16[I+0]=h,this.int16[I+1]=f,this.uint8[P+4]=d,this.uint8[P+5]=g,this.uint8[P+6]=w,this.uint8[P+7]=T,o},e}(kr);xu.prototype.bytesPerElement=8,oe("StructArrayLayout2i4ub8",xu);var Za=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h){var f=this.length;return this.resize(f+1),this.emplace(f,o,h)},e.prototype.emplace=function(o,h,f){var d=2*o;return this.float32[d+0]=h,this.float32[d+1]=f,o},e}(kr);Za.prototype.bytesPerElement=8,oe("StructArrayLayout2f8",Za);var Go=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h,f,d,g,w,T,I,P,L){var N=this.length;return this.resize(N+1),this.emplace(N,o,h,f,d,g,w,T,I,P,L)},e.prototype.emplace=function(o,h,f,d,g,w,T,I,P,L,N){var U=10*o;return this.uint16[U+0]=h,this.uint16[U+1]=f,this.uint16[U+2]=d,this.uint16[U+3]=g,this.uint16[U+4]=w,this.uint16[U+5]=T,this.uint16[U+6]=I,this.uint16[U+7]=P,this.uint16[U+8]=L,this.uint16[U+9]=N,o},e}(kr);Go.prototype.bytesPerElement=20,oe("StructArrayLayout10ui20",Go);var Ds=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h,f,d,g,w,T,I,P,L,N,U){var Q=this.length;return this.resize(Q+1),this.emplace(Q,o,h,f,d,g,w,T,I,P,L,N,U)},e.prototype.emplace=function(o,h,f,d,g,w,T,I,P,L,N,U,Q){var $=12*o;return this.int16[$+0]=h,this.int16[$+1]=f,this.int16[$+2]=d,this.int16[$+3]=g,this.uint16[$+4]=w,this.uint16[$+5]=T,this.uint16[$+6]=I,this.uint16[$+7]=P,this.int16[$+8]=L,this.int16[$+9]=N,this.int16[$+10]=U,this.int16[$+11]=Q,o},e}(kr);Ds.prototype.bytesPerElement=24,oe("StructArrayLayout4i4ui4i24",Ds);var wl=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h,f){var d=this.length;return this.resize(d+1),this.emplace(d,o,h,f)},e.prototype.emplace=function(o,h,f,d){var g=3*o;return this.float32[g+0]=h,this.float32[g+1]=f,this.float32[g+2]=d,o},e}(kr);wl.prototype.bytesPerElement=12,oe("StructArrayLayout3f12",wl);var ic=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o){var h=this.length;return this.resize(h+1),this.emplace(h,o)},e.prototype.emplace=function(o,h){return this.uint32[1*o+0]=h,o},e}(kr);ic.prototype.bytesPerElement=4,oe("StructArrayLayout1ul4",ic);var Sl=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h,f,d,g,w,T,I,P){var L=this.length;return this.resize(L+1),this.emplace(L,o,h,f,d,g,w,T,I,P)},e.prototype.emplace=function(o,h,f,d,g,w,T,I,P,L){var N=10*o,U=5*o;return this.int16[N+0]=h,this.int16[N+1]=f,this.int16[N+2]=d,this.int16[N+3]=g,this.int16[N+4]=w,this.int16[N+5]=T,this.uint32[U+3]=I,this.uint16[N+8]=P,this.uint16[N+9]=L,o},e}(kr);Sl.prototype.bytesPerElement=20,oe("StructArrayLayout6i1ul2ui20",Sl);var pa=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h,f,d,g,w){var T=this.length;return this.resize(T+1),this.emplace(T,o,h,f,d,g,w)},e.prototype.emplace=function(o,h,f,d,g,w,T){var I=6*o;return this.int16[I+0]=h,this.int16[I+1]=f,this.int16[I+2]=d,this.int16[I+3]=g,this.int16[I+4]=w,this.int16[I+5]=T,o},e}(kr);pa.prototype.bytesPerElement=12,oe("StructArrayLayout2i2i2i12",pa);var nc=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h,f,d,g){var w=this.length;return this.resize(w+1),this.emplace(w,o,h,f,d,g)},e.prototype.emplace=function(o,h,f,d,g,w){var T=4*o,I=8*o;return this.float32[T+0]=h,this.float32[T+1]=f,this.float32[T+2]=d,this.int16[I+6]=g,this.int16[I+7]=w,o},e}(kr);nc.prototype.bytesPerElement=16,oe("StructArrayLayout2f1f2i16",nc);var oc=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h,f,d){var g=this.length;return this.resize(g+1),this.emplace(g,o,h,f,d)},e.prototype.emplace=function(o,h,f,d,g){var w=12*o,T=3*o;return this.uint8[w+0]=h,this.uint8[w+1]=f,this.float32[T+1]=d,this.float32[T+2]=g,o},e}(kr);oc.prototype.bytesPerElement=12,oe("StructArrayLayout2ub2f12",oc);var Hn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h,f){var d=this.length;return this.resize(d+1),this.emplace(d,o,h,f)},e.prototype.emplace=function(o,h,f,d){var g=3*o;return this.uint16[g+0]=h,this.uint16[g+1]=f,this.uint16[g+2]=d,o},e}(kr);Hn.prototype.bytesPerElement=6,oe("StructArrayLayout3ui6",Hn);var bu=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h,f,d,g,w,T,I,P,L,N,U,Q,$,ct,st,vt){var xt=this.length;return this.resize(xt+1),this.emplace(xt,o,h,f,d,g,w,T,I,P,L,N,U,Q,$,ct,st,vt)},e.prototype.emplace=function(o,h,f,d,g,w,T,I,P,L,N,U,Q,$,ct,st,vt,xt){var St=24*o,Et=12*o,Pt=48*o;return this.int16[St+0]=h,this.int16[St+1]=f,this.uint16[St+2]=d,this.uint16[St+3]=g,this.uint32[Et+2]=w,this.uint32[Et+3]=T,this.uint32[Et+4]=I,this.uint16[St+10]=P,this.uint16[St+11]=L,this.uint16[St+12]=N,this.float32[Et+7]=U,this.float32[Et+8]=Q,this.uint8[Pt+36]=$,this.uint8[Pt+37]=ct,this.uint8[Pt+38]=st,this.uint32[Et+10]=vt,this.int16[St+22]=xt,o},e}(kr);bu.prototype.bytesPerElement=48,oe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",bu);var Xa=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h,f,d,g,w,T,I,P,L,N,U,Q,$,ct,st,vt,xt,St,Et,Pt,jt,Xt,de,Qt,ve,ee,Ve){var Me=this.length;return this.resize(Me+1),this.emplace(Me,o,h,f,d,g,w,T,I,P,L,N,U,Q,$,ct,st,vt,xt,St,Et,Pt,jt,Xt,de,Qt,ve,ee,Ve)},e.prototype.emplace=function(o,h,f,d,g,w,T,I,P,L,N,U,Q,$,ct,st,vt,xt,St,Et,Pt,jt,Xt,de,Qt,ve,ee,Ve,Me){var fe=34*o,He=17*o;return this.int16[fe+0]=h,this.int16[fe+1]=f,this.int16[fe+2]=d,this.int16[fe+3]=g,this.int16[fe+4]=w,this.int16[fe+5]=T,this.int16[fe+6]=I,this.int16[fe+7]=P,this.uint16[fe+8]=L,this.uint16[fe+9]=N,this.uint16[fe+10]=U,this.uint16[fe+11]=Q,this.uint16[fe+12]=$,this.uint16[fe+13]=ct,this.uint16[fe+14]=st,this.uint16[fe+15]=vt,this.uint16[fe+16]=xt,this.uint16[fe+17]=St,this.uint16[fe+18]=Et,this.uint16[fe+19]=Pt,this.uint16[fe+20]=jt,this.uint16[fe+21]=Xt,this.uint16[fe+22]=de,this.uint32[He+12]=Qt,this.float32[He+13]=ve,this.float32[He+14]=ee,this.float32[He+15]=Ve,this.float32[He+16]=Me,o},e}(kr);Xa.prototype.bytesPerElement=68,oe("StructArrayLayout8i15ui1ul4f68",Xa);var Zn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o){var h=this.length;return this.resize(h+1),this.emplace(h,o)},e.prototype.emplace=function(o,h){return this.float32[1*o+0]=h,o},e}(kr);Zn.prototype.bytesPerElement=4,oe("StructArrayLayout1f4",Zn);var ac=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h,f){var d=this.length;return this.resize(d+1),this.emplace(d,o,h,f)},e.prototype.emplace=function(o,h,f,d){var g=3*o;return this.int16[g+0]=h,this.int16[g+1]=f,this.int16[g+2]=d,o},e}(kr);ac.prototype.bytesPerElement=6,oe("StructArrayLayout3i6",ac);var sc=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h,f){var d=this.length;return this.resize(d+1),this.emplace(d,o,h,f)},e.prototype.emplace=function(o,h,f,d){var g=4*o;return this.uint32[2*o+0]=h,this.uint16[g+2]=f,this.uint16[g+3]=d,o},e}(kr);sc.prototype.bytesPerElement=8,oe("StructArrayLayout1ul2ui8",sc);var El=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h){var f=this.length;return this.resize(f+1),this.emplace(f,o,h)},e.prototype.emplace=function(o,h,f){var d=2*o;return this.uint16[d+0]=h,this.uint16[d+1]=f,o},e}(kr);El.prototype.bytesPerElement=4,oe("StructArrayLayout2ui4",El);var wu=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o){var h=this.length;return this.resize(h+1),this.emplace(h,o)},e.prototype.emplace=function(o,h){return this.uint16[1*o+0]=h,o},e}(kr);wu.prototype.bytesPerElement=2,oe("StructArrayLayout1ui2",wu);var a=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(o,h,f,d){var g=this.length;return this.resize(g+1),this.emplace(g,o,h,f,d)},e.prototype.emplace=function(o,h,f,d,g){var w=4*o;return this.float32[w+0]=h,this.float32[w+1]=f,this.float32[w+2]=d,this.float32[w+3]=g,o},e}(kr);a.prototype.bytesPerElement=16,oe("StructArrayLayout4f16",a);var u=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var o={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},anchorPoint:{configurable:!0}};return o.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},o.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},o.x1.get=function(){return this._structArray.int16[this._pos2+2]},o.y1.get=function(){return this._structArray.int16[this._pos2+3]},o.x2.get=function(){return this._structArray.int16[this._pos2+4]},o.y2.get=function(){return this._structArray.int16[this._pos2+5]},o.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},o.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},o.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},o.anchorPoint.get=function(){return new M(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,o),e}(Bo);u.prototype.size=20;var l=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(o){return new u(this,o)},e}(Sl);oe("CollisionBoxArray",l);var c=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var o={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},placedOrientation:{configurable:!0},hidden:{configurable:!0},crossTileID:{configurable:!0},associatedIconIndex:{configurable:!0}};return o.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},o.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},o.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},o.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},o.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},o.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},o.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},o.segment.get=function(){return this._structArray.uint16[this._pos2+10]},o.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},o.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},o.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},o.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},o.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},o.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},o.placedOrientation.set=function(h){this._structArray.uint8[this._pos1+37]=h},o.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},o.hidden.set=function(h){this._structArray.uint8[this._pos1+38]=h},o.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},o.crossTileID.set=function(h){this._structArray.uint32[this._pos4+10]=h},o.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},Object.defineProperties(e.prototype,o),e}(Bo);c.prototype.size=48;var y=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(o){return new c(this,o)},e}(bu);oe("PlacedSymbolArray",y);var _=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var o={anchorX:{configurable:!0},anchorY:{configurable:!0},rightJustifiedTextSymbolIndex:{configurable:!0},centerJustifiedTextSymbolIndex:{configurable:!0},leftJustifiedTextSymbolIndex:{configurable:!0},verticalPlacedTextSymbolIndex:{configurable:!0},placedIconSymbolIndex:{configurable:!0},verticalPlacedIconSymbolIndex:{configurable:!0},key:{configurable:!0},textBoxStartIndex:{configurable:!0},textBoxEndIndex:{configurable:!0},verticalTextBoxStartIndex:{configurable:!0},verticalTextBoxEndIndex:{configurable:!0},iconBoxStartIndex:{configurable:!0},iconBoxEndIndex:{configurable:!0},verticalIconBoxStartIndex:{configurable:!0},verticalIconBoxEndIndex:{configurable:!0},featureIndex:{configurable:!0},numHorizontalGlyphVertices:{configurable:!0},numVerticalGlyphVertices:{configurable:!0},numIconVertices:{configurable:!0},numVerticalIconVertices:{configurable:!0},useRuntimeCollisionCircles:{configurable:!0},crossTileID:{configurable:!0},textBoxScale:{configurable:!0},textOffset0:{configurable:!0},textOffset1:{configurable:!0},collisionCircleDiameter:{configurable:!0}};return o.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},o.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},o.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},o.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},o.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},o.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},o.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},o.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},o.key.get=function(){return this._structArray.uint16[this._pos2+8]},o.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},o.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},o.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},o.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},o.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},o.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},o.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},o.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},o.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},o.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},o.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},o.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},o.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},o.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},o.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},o.crossTileID.set=function(h){this._structArray.uint32[this._pos4+12]=h},o.textBoxScale.get=function(){return this._structArray.float32[this._pos4+13]},o.textOffset0.get=function(){return this._structArray.float32[this._pos4+14]},o.textOffset1.get=function(){return this._structArray.float32[this._pos4+15]},o.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+16]},Object.defineProperties(e.prototype,o),e}(Bo);_.prototype.size=68;var x=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(o){return new _(this,o)},e}(Xa);oe("SymbolInstanceArray",x);var S=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getoffsetX=function(o){return this.float32[1*o+0]},e}(Zn);oe("GlyphOffsetArray",S);var A=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getx=function(o){return this.int16[3*o+0]},e.prototype.gety=function(o){return this.int16[3*o+1]},e.prototype.gettileUnitDistanceFromAnchor=function(o){return this.int16[3*o+2]},e}(ac);oe("SymbolLineVertexArray",A);var R=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var o={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return o.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},o.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},o.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},Object.defineProperties(e.prototype,o),e}(Bo);R.prototype.size=8;var G=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(o){return new R(this,o)},e}(sc);oe("FeatureIndexArray",G);var Z=Gi([{name:"a_pos",components:2,type:"Int16"}],4).members,V=function(t){t===void 0&&(t=[]),this.segments=t};function it(t,e){return 256*(t=J(Math.floor(t),0,255))+J(Math.floor(e),0,255)}V.prototype.prepareSegment=function(t,e,o,h){var f=this.segments[this.segments.length-1];return t>V.MAX_VERTEX_ARRAY_LENGTH&&Le("Max vertices per segment is "+V.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!f||f.vertexLength+t>V.MAX_VERTEX_ARRAY_LENGTH||f.sortKey!==h)&&(f={vertexOffset:e.length,primitiveOffset:o.length,vertexLength:0,primitiveLength:0},h!==void 0&&(f.sortKey=h),this.segments.push(f)),f},V.prototype.get=function(){return this.segments},V.prototype.destroy=function(){for(var t=0,e=this.segments;t<e.length;t+=1){var o=e[t];for(var h in o.vaos)o.vaos[h].destroy()}},V.simpleSegment=function(t,e,o,h){return new V([{vertexOffset:t,primitiveOffset:e,vertexLength:o,primitiveLength:h,vaos:{},sortKey:0}])},V.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,oe("SegmentVector",V);var et=Gi([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),ut=m(function(t){t.exports=function(e,o){var h,f,d,g,w,T,I,P;for(f=e.length-(h=3&e.length),d=o,w=3432918353,T=461845907,P=0;P<f;)I=255&e.charCodeAt(P)|(255&e.charCodeAt(++P))<<8|(255&e.charCodeAt(++P))<<16|(255&e.charCodeAt(++P))<<24,++P,d=27492+(65535&(g=5*(65535&(d=(d^=I=(65535&(I=(I=(65535&I)*w+(((I>>>16)*w&65535)<<16)&4294967295)<<15|I>>>17))*T+(((I>>>16)*T&65535)<<16)&4294967295)<<13|d>>>19))+((5*(d>>>16)&65535)<<16)&4294967295))+((58964+(g>>>16)&65535)<<16);switch(I=0,h){case 3:I^=(255&e.charCodeAt(P+2))<<16;case 2:I^=(255&e.charCodeAt(P+1))<<8;case 1:d^=I=(65535&(I=(I=(65535&(I^=255&e.charCodeAt(P)))*w+(((I>>>16)*w&65535)<<16)&4294967295)<<15|I>>>17))*T+(((I>>>16)*T&65535)<<16)&4294967295}return d^=e.length,d=2246822507*(65535&(d^=d>>>16))+((2246822507*(d>>>16)&65535)<<16)&4294967295,d=3266489909*(65535&(d^=d>>>13))+((3266489909*(d>>>16)&65535)<<16)&4294967295,(d^=d>>>16)>>>0}}),tt=m(function(t){t.exports=function(e,o){for(var h,f=e.length,d=o^f,g=0;f>=4;)h=1540483477*(65535&(h=255&e.charCodeAt(g)|(255&e.charCodeAt(++g))<<8|(255&e.charCodeAt(++g))<<16|(255&e.charCodeAt(++g))<<24))+((1540483477*(h>>>16)&65535)<<16),d=1540483477*(65535&d)+((1540483477*(d>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),f-=4,++g;switch(f){case 3:d^=(255&e.charCodeAt(g+2))<<16;case 2:d^=(255&e.charCodeAt(g+1))<<8;case 1:d=1540483477*(65535&(d^=255&e.charCodeAt(g)))+((1540483477*(d>>>16)&65535)<<16)}return d=1540483477*(65535&(d^=d>>>13))+((1540483477*(d>>>16)&65535)<<16),(d^=d>>>15)>>>0}}),lt=ut,yt=tt;lt.murmur3=ut,lt.murmur2=yt;var _t=function(){this.ids=[],this.positions=[],this.indexed=!1};_t.prototype.add=function(t,e,o,h){this.ids.push(Tt(t)),this.positions.push(e,o,h)},_t.prototype.getPositions=function(t){for(var e=Tt(t),o=0,h=this.ids.length-1;o<h;){var f=o+h>>1;this.ids[f]>=e?h=f:o=f+1}for(var d=[];this.ids[o]===e;)d.push({index:this.positions[3*o],start:this.positions[3*o+1],end:this.positions[3*o+2]}),o++;return d},_t.serialize=function(t,e){var o=new Float64Array(t.ids),h=new Uint32Array(t.positions);return function f(d,g,w,T){for(;w<T;){for(var I=d[w+T>>1],P=w-1,L=T+1;;){do P++;while(d[P]<I);do L--;while(d[L]>I);if(P>=L)break;Ct(d,P,L),Ct(g,3*P,3*L),Ct(g,3*P+1,3*L+1),Ct(g,3*P+2,3*L+2)}L-w<T-L?(f(d,g,w,L),w=L+1):(f(d,g,L+1,T),T=L)}}(o,h,0,o.length-1),e&&e.push(o.buffer,h.buffer),{ids:o,positions:h}},_t.deserialize=function(t){var e=new _t;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e};var It=Math.pow(2,53)-1;function Tt(t){var e=+t;return!isNaN(e)&&e<=It?e:lt(String(t))}function Ct(t,e,o){var h=t[e];t[e]=t[o],t[o]=h}oe("FeaturePositionMap",_t);var Lt=function(t,e){this.gl=t.gl,this.location=e},qt=function(t){function e(o,h){t.call(this,o,h),this.current=0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(o){this.current!==o&&(this.current=o,this.gl.uniform1i(this.location,o))},e}(Lt),Ut=function(t){function e(o,h){t.call(this,o,h),this.current=0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(o){this.current!==o&&(this.current=o,this.gl.uniform1f(this.location,o))},e}(Lt),ie=function(t){function e(o,h){t.call(this,o,h),this.current=[0,0]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(o){o[0]===this.current[0]&&o[1]===this.current[1]||(this.current=o,this.gl.uniform2f(this.location,o[0],o[1]))},e}(Lt),_e=function(t){function e(o,h){t.call(this,o,h),this.current=[0,0,0]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(o){o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]||(this.current=o,this.gl.uniform3f(this.location,o[0],o[1],o[2]))},e}(Lt),Se=function(t){function e(o,h){t.call(this,o,h),this.current=[0,0,0,0]}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(o){o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]&&o[3]===this.current[3]||(this.current=o,this.gl.uniform4f(this.location,o[0],o[1],o[2],o[3]))},e}(Lt),xe=function(t){function e(o,h){t.call(this,o,h),this.current=$e.transparent}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(o){o.r===this.current.r&&o.g===this.current.g&&o.b===this.current.b&&o.a===this.current.a||(this.current=o,this.gl.uniform4f(this.location,o.r,o.g,o.b,o.a))},e}(Lt),nr=new Float32Array(16),ue=function(t){function e(o,h){t.call(this,o,h),this.current=nr}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.set=function(o){if(o[12]!==this.current[12]||o[0]!==this.current[0])return this.current=o,void this.gl.uniformMatrix4fv(this.location,!1,o);for(var h=1;h<16;h++)if(o[h]!==this.current[h]){this.current=o,this.gl.uniformMatrix4fv(this.location,!1,o);break}},e}(Lt);function De(t){return[it(255*t.r,255*t.g),it(255*t.b,255*t.a)]}var je=function(t,e,o){this.value=t,this.uniformNames=e.map(function(h){return"u_"+h}),this.type=o};je.prototype.setUniform=function(t,e,o){t.set(o.constantOr(this.value))},je.prototype.getBinding=function(t,e,o){return this.type==="color"?new xe(t,e):new Ut(t,e)};var Oe=function(t,e){this.uniformNames=e.map(function(o){return"u_"+o}),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1};Oe.prototype.setConstantPatternPositions=function(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr},Oe.prototype.setUniform=function(t,e,o,h){var f=h==="u_pattern_to"?this.patternTo:h==="u_pattern_from"?this.patternFrom:h==="u_pixel_ratio_to"?this.pixelRatioTo:h==="u_pixel_ratio_from"?this.pixelRatioFrom:null;f&&t.set(f)},Oe.prototype.getBinding=function(t,e,o){return o.substr(0,9)==="u_pattern"?new Se(t,e):new Ut(t,e)};var ze=function(t,e,o,h){this.expression=t,this.type=o,this.maxValue=0,this.paintVertexAttributes=e.map(function(f){return{name:"a_"+f,type:"Float32",components:o==="color"?2:1,offset:0}}),this.paintVertexArray=new h};ze.prototype.populatePaintArray=function(t,e,o,h,f){var d=this.paintVertexArray.length,g=this.expression.evaluate(new fr(0),e,{},h,[],f);this.paintVertexArray.resize(t),this._setPaintValue(d,t,g)},ze.prototype.updatePaintArray=function(t,e,o,h){var f=this.expression.evaluate({zoom:0},o,h);this._setPaintValue(t,e,f)},ze.prototype._setPaintValue=function(t,e,o){if(this.type==="color")for(var h=De(o),f=t;f<e;f++)this.paintVertexArray.emplace(f,h[0],h[1]);else{for(var d=t;d<e;d++)this.paintVertexArray.emplace(d,o);this.maxValue=Math.max(this.maxValue,Math.abs(o))}},ze.prototype.upload=function(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},ze.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()};var Re=function(t,e,o,h,f,d){this.expression=t,this.uniformNames=e.map(function(g){return"u_"+g+"_t"}),this.type=o,this.useIntegerZoom=h,this.zoom=f,this.maxValue=0,this.paintVertexAttributes=e.map(function(g){return{name:"a_"+g,type:"Float32",components:o==="color"?4:2,offset:0}}),this.paintVertexArray=new d};Re.prototype.populatePaintArray=function(t,e,o,h,f){var d=this.expression.evaluate(new fr(this.zoom),e,{},h,[],f),g=this.expression.evaluate(new fr(this.zoom+1),e,{},h,[],f),w=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(w,t,d,g)},Re.prototype.updatePaintArray=function(t,e,o,h){var f=this.expression.evaluate({zoom:this.zoom},o,h),d=this.expression.evaluate({zoom:this.zoom+1},o,h);this._setPaintValue(t,e,f,d)},Re.prototype._setPaintValue=function(t,e,o,h){if(this.type==="color")for(var f=De(o),d=De(h),g=t;g<e;g++)this.paintVertexArray.emplace(g,f[0],f[1],d[0],d[1]);else{for(var w=t;w<e;w++)this.paintVertexArray.emplace(w,o,h);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(h))}},Re.prototype.upload=function(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},Re.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()},Re.prototype.setUniform=function(t,e){var o=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,h=J(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);t.set(h)},Re.prototype.getBinding=function(t,e,o){return new Ut(t,e)};var Pe=function(t,e,o,h,f,d){this.expression=t,this.type=e,this.useIntegerZoom=o,this.zoom=h,this.layerId=d,this.zoomInPaintVertexArray=new f,this.zoomOutPaintVertexArray=new f};Pe.prototype.populatePaintArray=function(t,e,o){var h=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(h,t,e.patterns&&e.patterns[this.layerId],o)},Pe.prototype.updatePaintArray=function(t,e,o,h,f){this._setPaintValues(t,e,o.patterns&&o.patterns[this.layerId],f)},Pe.prototype._setPaintValues=function(t,e,o,h){if(h&&o){var f=h[o.min],d=h[o.mid],g=h[o.max];if(f&&d&&g)for(var w=t;w<e;w++)this.zoomInPaintVertexArray.emplace(w,d.tl[0],d.tl[1],d.br[0],d.br[1],f.tl[0],f.tl[1],f.br[0],f.br[1],d.pixelRatio,f.pixelRatio),this.zoomOutPaintVertexArray.emplace(w,d.tl[0],d.tl[1],d.br[0],d.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],d.pixelRatio,g.pixelRatio)}},Pe.prototype.upload=function(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,et.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,et.members,this.expression.isStateDependent))},Pe.prototype.destroy=function(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()};var Ee=function(t,e,o){this.binders={},this._buffers=[];var h=[];for(var f in t.paint._values)if(o(f)){var d=t.paint.get(f);if(d instanceof Kn&&As(d.property.specification)){var g=ai(f,t.type),w=d.value,T=d.property.specification.type,I=d.property.useIntegerZoom,P=d.property.specification["property-type"],L=P==="cross-faded"||P==="cross-faded-data-driven";if(w.kind==="constant")this.binders[f]=L?new Oe(w.value,g):new je(w.value,g,T),h.push("/u_"+f);else if(w.kind==="source"||L){var N=un(f,T,"source");this.binders[f]=L?new Pe(w,T,I,e,N,t.id):new ze(w,g,T,N),h.push("/a_"+f)}else{var U=un(f,T,"composite");this.binders[f]=new Re(w,g,T,I,e,U),h.push("/z_"+f)}}}this.cacheKey=h.sort().join("")};Ee.prototype.getMaxValue=function(t){var e=this.binders[t];return e instanceof ze||e instanceof Re?e.maxValue:0},Ee.prototype.populatePaintArrays=function(t,e,o,h,f){for(var d in this.binders){var g=this.binders[d];(g instanceof ze||g instanceof Re||g instanceof Pe)&&g.populatePaintArray(t,e,o,h,f)}},Ee.prototype.setConstantPatternPositions=function(t,e){for(var o in this.binders){var h=this.binders[o];h instanceof Oe&&h.setConstantPatternPositions(t,e)}},Ee.prototype.updatePaintArrays=function(t,e,o,h,f){var d=!1;for(var g in t)for(var w=0,T=e.getPositions(g);w<T.length;w+=1){var I=T[w],P=o.feature(I.index);for(var L in this.binders){var N=this.binders[L];if((N instanceof ze||N instanceof Re||N instanceof Pe)&&N.expression.isStateDependent===!0){var U=h.paint.get(L);N.expression=U.value,N.updatePaintArray(I.start,I.end,P,t[g],f),d=!0}}}return d},Ee.prototype.defines=function(){var t=[];for(var e in this.binders){var o=this.binders[e];(o instanceof je||o instanceof Oe)&&t.push.apply(t,o.uniformNames.map(function(h){return"#define HAS_UNIFORM_"+h}))}return t},Ee.prototype.getBinderAttributes=function(){var t=[];for(var e in this.binders){var o=this.binders[e];if(o instanceof ze||o instanceof Re)for(var h=0;h<o.paintVertexAttributes.length;h++)t.push(o.paintVertexAttributes[h].name);else if(o instanceof Pe)for(var f=0;f<et.members.length;f++)t.push(et.members[f].name)}return t},Ee.prototype.getBinderUniforms=function(){var t=[];for(var e in this.binders){var o=this.binders[e];if(o instanceof je||o instanceof Oe||o instanceof Re)for(var h=0,f=o.uniformNames;h<f.length;h+=1)t.push(f[h])}return t},Ee.prototype.getPaintVertexBuffers=function(){return this._buffers},Ee.prototype.getUniforms=function(t,e){var o=[];for(var h in this.binders){var f=this.binders[h];if(f instanceof je||f instanceof Oe||f instanceof Re)for(var d=0,g=f.uniformNames;d<g.length;d+=1){var w=g[d];if(e[w]){var T=f.getBinding(t,e[w],w);o.push({name:w,property:h,binding:T})}}}return o},Ee.prototype.setUniforms=function(t,e,o,h){for(var f=0,d=e;f<d.length;f+=1){var g=d[f],w=g.name,T=g.property;this.binders[T].setUniform(g.binding,h,o.get(T),w)}},Ee.prototype.updatePaintBuffers=function(t){for(var e in this._buffers=[],this.binders){var o=this.binders[e];if(t&&o instanceof Pe){var h=t.fromScale===2?o.zoomInPaintVertexBuffer:o.zoomOutPaintVertexBuffer;h&&this._buffers.push(h)}else(o instanceof ze||o instanceof Re)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}},Ee.prototype.upload=function(t){for(var e in this.binders){var o=this.binders[e];(o instanceof ze||o instanceof Re||o instanceof Pe)&&o.upload(t)}this.updatePaintBuffers()},Ee.prototype.destroy=function(){for(var t in this.binders){var e=this.binders[t];(e instanceof ze||e instanceof Re||e instanceof Pe)&&e.destroy()}};var wr=function(t,e,o){o===void 0&&(o=function(){return!0}),this.programConfigurations={};for(var h=0,f=t;h<f.length;h+=1){var d=f[h];this.programConfigurations[d.id]=new Ee(d,e,o)}this.needsUpload=!1,this._featureMap=new _t,this._bufferOffset=0};function ai(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"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":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(e+"-","").replace(/-/g,"_")]}function un(t,e,o){var h={color:{source:Za,composite:a},number:{source:Zn,composite:Za}},f=function(d){return{"line-pattern":{source:Go,composite:Go},"fill-pattern":{source:Go,composite:Go},"fill-extrusion-pattern":{source:Go,composite:Go}}[d]}(t);return f&&f[o]||h[e][o]}wr.prototype.populatePaintArrays=function(t,e,o,h,f,d){for(var g in this.programConfigurations)this.programConfigurations[g].populatePaintArrays(t,e,h,f,d);e.id!==void 0&&this._featureMap.add(e.id,o,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0},wr.prototype.updatePaintArrays=function(t,e,o,h){for(var f=0,d=o;f<d.length;f+=1){var g=d[f];this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(t,this._featureMap,e,g,h)||this.needsUpload}},wr.prototype.get=function(t){return this.programConfigurations[t]},wr.prototype.upload=function(t){if(this.needsUpload){for(var e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}},wr.prototype.destroy=function(){for(var t in this.programConfigurations)this.programConfigurations[t].destroy()},oe("ConstantBinder",je),oe("CrossFadedConstantBinder",Oe),oe("SourceExpressionBinder",ze),oe("CrossFadedCompositeBinder",Pe),oe("CompositeExpressionBinder",Re),oe("ProgramConfiguration",Ee,{omit:["_buffers"]}),oe("ProgramConfigurationSet",wr);var Li=Math.pow(2,14)-1,ki=-Li-1;function si(t){for(var e=8192/t.extent,o=t.loadGeometry(),h=0;h<o.length;h++)for(var f=o[h],d=0;d<f.length;d++){var g=f[d],w=Math.round(g.x*e),T=Math.round(g.y*e);g.x=J(w,ki,Li),g.y=J(T,ki,Li),(w<g.x||w>g.x+1||T<g.y||T>g.y+1)&&Le("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return o}function en(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?si(t):[]}}function Mo(t,e,o,h,f){t.emplaceBack(2*e+(h+1)/2,2*o+(f+1)/2)}var hn=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(e){return e.id}),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new bl,this.indexArray=new Hn,this.segments=new V,this.programConfigurations=new wr(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(function(e){return e.isStateDependent()}).map(function(e){return e.id})};function cn(t,e){for(var o=0;o<t.length;o++)if(Co(e,t[o]))return!0;for(var h=0;h<e.length;h++)if(Co(t,e[h]))return!0;return!!fa(t,e)}function Io(t,e,o){return!!Co(t,e)||!!Ya(e,t,o)}function Xn(t,e){if(t.length===1)return Ns(e,t[0]);for(var o=0;o<e.length;o++)for(var h=e[o],f=0;f<h.length;f++)if(Co(t,h[f]))return!0;for(var d=0;d<t.length;d++)if(Ns(e,t[d]))return!0;for(var g=0;g<e.length;g++)if(fa(t,e[g]))return!0;return!1}function lc(t,e,o){if(t.length>1){if(fa(t,e))return!0;for(var h=0;h<e.length;h++)if(Ya(e[h],t,o))return!0}for(var f=0;f<t.length;f++)if(Ya(t[f],e,o))return!0;return!1}function fa(t,e){if(t.length===0||e.length===0)return!1;for(var o=0;o<t.length-1;o++)for(var h=t[o],f=t[o+1],d=0;d<e.length-1;d++)if(Os(h,f,e[d],e[d+1]))return!0;return!1}function Os(t,e,o,h){return hr(t,o,h)!==hr(e,o,h)&&hr(t,e,o)!==hr(t,e,h)}function Ya(t,e,o){var h=o*o;if(e.length===1)return t.distSqr(e[0])<h;for(var f=1;f<e.length;f++)if(Tl(t,e[f-1],e[f])<h)return!0;return!1}function Tl(t,e,o){var h=e.distSqr(o);if(h===0)return t.distSqr(e);var f=((t.x-e.x)*(o.x-e.x)+(t.y-e.y)*(o.y-e.y))/h;return t.distSqr(f<0?e:f>1?o:o.sub(e)._mult(f)._add(e))}function Ns(t,e){for(var o,h,f,d=!1,g=0;g<t.length;g++)for(var w=0,T=(o=t[g]).length-1;w<o.length;T=w++)(h=o[w]).y>e.y!=(f=o[T]).y>e.y&&e.x<(f.x-h.x)*(e.y-h.y)/(f.y-h.y)+h.x&&(d=!d);return d}function Co(t,e){for(var o=!1,h=0,f=t.length-1;h<t.length;f=h++){var d=t[h],g=t[f];d.y>e.y!=g.y>e.y&&e.x<(g.x-d.x)*(e.y-d.y)/(g.y-d.y)+d.x&&(o=!o)}return o}function Fs(t,e,o){var h=o[0],f=o[2];if(t.x<h.x&&e.x<h.x||t.x>f.x&&e.x>f.x||t.y<h.y&&e.y<h.y||t.y>f.y&&e.y>f.y)return!1;var d=hr(t,e,o[0]);return d!==hr(t,e,o[1])||d!==hr(t,e,o[2])||d!==hr(t,e,o[3])}function xi(t,e,o){var h=e.paint.get(t).value;return h.kind==="constant"?h.value:o.programConfigurations.get(e.id).getMaxValue(t)}function Vo(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function yo(t,e,o,h,f){if(!e[0]&&!e[1])return t;var d=M.convert(e)._mult(f);o==="viewport"&&d._rotate(-h);for(var g=[],w=0;w<t.length;w++)g.push(t[w].sub(d));return g}hn.prototype.populate=function(t,e,o){var h=this.layers[0],f=[],d=null,g=!1;h.type==="circle"&&(g=!(d=h.layout.get("circle-sort-key")).isConstant());for(var w=0,T=t;w<T.length;w+=1){var I=T[w],P=I.feature,L=I.id,N=I.index,U=I.sourceLayerIndex,Q=this.layers[0]._featureFilter.needGeometry,$=en(P,Q);if(this.layers[0]._featureFilter.filter(new fr(this.zoom),$,o)){var ct=g?d.evaluate($,{},o):void 0,st={id:L,properties:P.properties,type:P.type,sourceLayerIndex:U,index:N,geometry:Q?$.geometry:si(P),patterns:{},sortKey:ct};f.push(st)}}g&&f.sort(function(de,Qt){return de.sortKey-Qt.sortKey});for(var vt=0,xt=f;vt<xt.length;vt+=1){var St=xt[vt],Et=St.geometry,Pt=St.index,jt=St.sourceLayerIndex,Xt=t[Pt].feature;this.addFeature(St,Et,Pt,o),e.featureIndex.insert(Xt,Et,Pt,jt,this.index)}},hn.prototype.update=function(t,e,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,o)},hn.prototype.isEmpty=function(){return this.layoutVertexArray.length===0},hn.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},hn.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Z),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},hn.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},hn.prototype.addFeature=function(t,e,o,h){for(var f=0,d=e;f<d.length;f+=1)for(var g=0,w=d[f];g<w.length;g+=1){var T=w[g],I=T.x,P=T.y;if(!(I<0||I>=8192||P<0||P>=8192)){var L=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),N=L.vertexLength;Mo(this.layoutVertexArray,I,P,-1,-1),Mo(this.layoutVertexArray,I,P,1,-1),Mo(this.layoutVertexArray,I,P,1,1),Mo(this.layoutVertexArray,I,P,-1,1),this.indexArray.emplaceBack(N,N+1,N+2),this.indexArray.emplaceBack(N,N+3,N+2),L.vertexLength+=4,L.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,o,{},h)},oe("CircleBucket",hn,{omit:["layers"]});var Ja=new Dn({"circle-sort-key":new Ie(X.layout_circle["circle-sort-key"])}),li={paint:new Dn({"circle-radius":new Ie(X.paint_circle["circle-radius"]),"circle-color":new Ie(X.paint_circle["circle-color"]),"circle-blur":new Ie(X.paint_circle["circle-blur"]),"circle-opacity":new Ie(X.paint_circle["circle-opacity"]),"circle-translate":new re(X.paint_circle["circle-translate"]),"circle-translate-anchor":new re(X.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new re(X.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new re(X.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ie(X.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ie(X.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ie(X.paint_circle["circle-stroke-opacity"])}),layout:Ja},ti=typeof Float32Array<"u"?Float32Array:Array;function pn(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Ml(t,e,o){var h=e[0],f=e[1],d=e[2],g=e[3],w=e[4],T=e[5],I=e[6],P=e[7],L=e[8],N=e[9],U=e[10],Q=e[11],$=e[12],ct=e[13],st=e[14],vt=e[15],xt=o[0],St=o[1],Et=o[2],Pt=o[3];return t[0]=xt*h+St*w+Et*L+Pt*$,t[1]=xt*f+St*T+Et*N+Pt*ct,t[2]=xt*d+St*I+Et*U+Pt*st,t[3]=xt*g+St*P+Et*Q+Pt*vt,t[4]=(xt=o[4])*h+(St=o[5])*w+(Et=o[6])*L+(Pt=o[7])*$,t[5]=xt*f+St*T+Et*N+Pt*ct,t[6]=xt*d+St*I+Et*U+Pt*st,t[7]=xt*g+St*P+Et*Q+Pt*vt,t[8]=(xt=o[8])*h+(St=o[9])*w+(Et=o[10])*L+(Pt=o[11])*$,t[9]=xt*f+St*T+Et*N+Pt*ct,t[10]=xt*d+St*I+Et*U+Pt*st,t[11]=xt*g+St*P+Et*Q+Pt*vt,t[12]=(xt=o[12])*h+(St=o[13])*w+(Et=o[14])*L+(Pt=o[15])*$,t[13]=xt*f+St*T+Et*N+Pt*ct,t[14]=xt*d+St*I+Et*U+Pt*st,t[15]=xt*g+St*P+Et*Q+Pt*vt,t}Math.hypot||(Math.hypot=function(){for(var t=arguments,e=0,o=arguments.length;o--;)e+=t[o]*t[o];return Math.sqrt(e)});var Su,dm=Ml;function Eu(t,e,o){var h=e[0],f=e[1],d=e[2],g=e[3];return t[0]=o[0]*h+o[4]*f+o[8]*d+o[12]*g,t[1]=o[1]*h+o[5]*f+o[9]*d+o[13]*g,t[2]=o[2]*h+o[6]*f+o[10]*d+o[14]*g,t[3]=o[3]*h+o[7]*f+o[11]*d+o[15]*g,t}Su=new ti(3),ti!=Float32Array&&(Su[0]=0,Su[1]=0,Su[2]=0),function(){var t=new ti(4);ti!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}();var Tu=(function(){var t=new ti(2);ti!=Float32Array&&(t[0]=0,t[1]=0)}(),function(t){function e(o){t.call(this,o,li)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(o){return new hn(o)},e.prototype.queryRadius=function(o){var h=o;return xi("circle-radius",this,h)+xi("circle-stroke-width",this,h)+Vo(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(o,h,f,d,g,w,T,I){for(var P=yo(o,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),w.angle,T),L=this.paint.get("circle-radius").evaluate(h,f)+this.paint.get("circle-stroke-width").evaluate(h,f),N=this.paint.get("circle-pitch-alignment")==="map",U=N?P:function(jt,Xt){return jt.map(function(de){return $p(de,Xt)})}(P,I),Q=N?L*T:L,$=0,ct=d;$<ct.length;$+=1)for(var st=0,vt=ct[$];st<vt.length;st+=1){var xt=vt[st],St=N?xt:$p(xt,I),Et=Q,Pt=Eu([],[xt.x,xt.y,0,1],I);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?Et*=Pt[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(Et*=w.cameraToCenterDistance/Pt[3]),Io(U,St,Et))return!0}return!1},e}(oo));function $p(t,e){var o=Eu([],[t.x,t.y,0,1],e);return new M(o[0]/o[3],o[1]/o[3])}var Il=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(hn);function Cl(t,e,o,h){var f=e.width,d=e.height;if(h){if(h instanceof Uint8ClampedArray)h=new Uint8Array(h.buffer);else if(h.length!==f*d*o)throw new RangeError("mismatched image size")}else h=new Uint8Array(f*d*o);return t.width=f,t.height=d,t.data=h,t}function Lg(t,e,o){var h=e.width,f=e.height;if(h!==t.width||f!==t.height){var d=Cl({},{width:h,height:f},o);mm(t,d,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,h),height:Math.min(t.height,f)},o),t.width=h,t.height=f,t.data=d.data}}function mm(t,e,o,h,f,d){if(f.width===0||f.height===0)return e;if(f.width>t.width||f.height>t.height||o.x>t.width-f.width||o.y>t.height-f.height)throw new RangeError("out of range source coordinates for image copy");if(f.width>e.width||f.height>e.height||h.x>e.width-f.width||h.y>e.height-f.height)throw new RangeError("out of range destination coordinates for image copy");for(var g=t.data,w=e.data,T=0;T<f.height;T++)for(var I=((o.y+T)*t.width+o.x)*d,P=((h.y+T)*e.width+h.x)*d,L=0;L<f.width*d;L++)w[P+L]=g[I+L];return e}oe("HeatmapBucket",Il,{omit:["layers"]});var Al=function(t,e){Cl(this,t,1,e)};Al.prototype.resize=function(t){Lg(this,t,1)},Al.prototype.clone=function(){return new Al({width:this.width,height:this.height},new Uint8Array(this.data))},Al.copy=function(t,e,o,h,f){mm(t,e,o,h,f,1)};var Nn=function(t,e){Cl(this,t,4,e)};Nn.prototype.resize=function(t){Lg(this,t,4)},Nn.prototype.replace=function(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t},Nn.prototype.clone=function(){return new Nn({width:this.width,height:this.height},new Uint8Array(this.data))},Nn.copy=function(t,e,o,h,f){mm(t,e,o,h,f,4)},oe("AlphaImage",Al),oe("RGBAImage",Nn);var s2={paint:new Dn({"heatmap-radius":new Ie(X.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ie(X.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new re(X.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Fo(X.paint_heatmap["heatmap-color"]),"heatmap-opacity":new re(X.paint_heatmap["heatmap-opacity"])})};function kg(t){var e={},o=t.resolution||256,h=t.clips?t.clips.length:1,f=t.image||new Nn({width:o,height:h}),d=function(Q,$,ct){e[t.evaluationKey]=ct;var st=t.expression.evaluate(e);f.data[Q+$+0]=Math.floor(255*st.r/st.a),f.data[Q+$+1]=Math.floor(255*st.g/st.a),f.data[Q+$+2]=Math.floor(255*st.b/st.a),f.data[Q+$+3]=Math.floor(255*st.a)};if(t.clips)for(var g=0,w=0;g<h;++g,w+=4*o)for(var T=0,I=0;T<o;T++,I+=4){var P=T/(o-1),L=t.clips[g];d(w,I,L.start*(1-P)+L.end*P)}else for(var N=0,U=0;N<o;N++,U+=4)d(0,U,N/(o-1));return f}var l2=function(t){function e(o){t.call(this,o,s2),this._updateColorRamp()}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(o){return new Il(o)},e.prototype._handleSpecialPaintPropertyUpdate=function(o){o==="heatmap-color"&&this._updateColorRamp()},e.prototype._updateColorRamp=function(){this.colorRamp=kg({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null},e.prototype.resize=function(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)},e.prototype.queryRadius=function(){return 0},e.prototype.queryIntersectsFeature=function(){return!1},e.prototype.hasOffscreenPass=function(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"},e}(oo),u2={paint:new Dn({"hillshade-illumination-direction":new re(X.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new re(X.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new re(X.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new re(X.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new re(X.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new re(X.paint_hillshade["hillshade-accent-color"])})},h2=function(t){function e(o){t.call(this,o,u2)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.hasOffscreenPass=function(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"},e}(oo),c2=Gi([{name:"a_pos",components:2,type:"Int16"}],4).members,ym=tf,p2=tf;function tf(t,e,o){o=o||2;var h,f,d,g,w,T,I,P=e&&e.length,L=P?e[0]*o:t.length,N=Rg(t,0,L,o,!0),U=[];if(!N||N.next===N.prev)return U;if(P&&(N=function($,ct,st,vt){var xt,St,Et,Pt=[];for(xt=0,St=ct.length;xt<St;xt++)(Et=Rg($,ct[xt]*vt,xt<St-1?ct[xt+1]*vt:$.length,vt,!1))===Et.next&&(Et.steiner=!0),Pt.push(x2(Et));for(Pt.sort(g2),xt=0;xt<Pt.length;xt++)v2(Pt[xt],st),st=Bs(st,st.next);return st}(t,e,N,o)),t.length>80*o){h=d=t[0],f=g=t[1];for(var Q=o;Q<L;Q+=o)(w=t[Q])<h&&(h=w),(T=t[Q+1])<f&&(f=T),w>d&&(d=w),T>g&&(g=T);I=(I=Math.max(d-h,g-f))!==0?1/I:0}return uc(N,U,o,h,f,I),U}function Rg(t,e,o,h,f){var d,g;if(f===_m(t,e,o,h)>0)for(d=e;d<o;d+=h)g=Og(d,t[d],t[d+1],g);else for(d=o-h;d>=e;d-=h)g=Og(d,t[d],t[d+1],g);return g&&ef(g,g.next)&&(cc(g),g=g.next),g}function Bs(t,e){if(!t)return t;e||(e=t);var o,h=t;do if(o=!1,h.steiner||!ef(h,h.next)&&bi(h.prev,h,h.next)!==0)h=h.next;else{if(cc(h),(h=e=h.prev)===h.next)break;o=!0}while(o||h!==e);return e}function uc(t,e,o,h,f,d,g){if(t){!g&&d&&function(P,L,N,U){var Q=P;do Q.z===null&&(Q.z=gm(Q.x,Q.y,L,N,U)),Q.prevZ=Q.prev,Q.nextZ=Q.next,Q=Q.next;while(Q!==P);Q.prevZ.nextZ=null,Q.prevZ=null,function($){var ct,st,vt,xt,St,Et,Pt,jt,Xt=1;do{for(st=$,$=null,St=null,Et=0;st;){for(Et++,vt=st,Pt=0,ct=0;ct<Xt&&(Pt++,vt=vt.nextZ);ct++);for(jt=Xt;Pt>0||jt>0&&vt;)Pt!==0&&(jt===0||!vt||st.z<=vt.z)?(xt=st,st=st.nextZ,Pt--):(xt=vt,vt=vt.nextZ,jt--),St?St.nextZ=xt:$=xt,xt.prevZ=St,St=xt;st=vt}St.nextZ=null,Xt*=2}while(Et>1)}(Q)}(t,h,f,d);for(var w,T,I=t;t.prev!==t.next;)if(w=t.prev,T=t.next,d?d2(t,h,f,d):f2(t))e.push(w.i/o),e.push(t.i/o),e.push(T.i/o),cc(t),t=T.next,I=T.next;else if((t=T)===I){g?g===1?uc(t=m2(Bs(t),e,o),e,o,h,f,d,2):g===2&&y2(t,e,o,h,f,d):uc(Bs(t),e,o,h,f,d,1);break}}}function f2(t){var e=t.prev,o=t,h=t.next;if(bi(e,o,h)>=0)return!1;for(var f=t.next.next;f!==t.prev;){if(Mu(e.x,e.y,o.x,o.y,h.x,h.y,f.x,f.y)&&bi(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function d2(t,e,o,h){var f=t.prev,d=t,g=t.next;if(bi(f,d,g)>=0)return!1;for(var w=f.x>d.x?f.x>g.x?f.x:g.x:d.x>g.x?d.x:g.x,T=f.y>d.y?f.y>g.y?f.y:g.y:d.y>g.y?d.y:g.y,I=gm(f.x<d.x?f.x<g.x?f.x:g.x:d.x<g.x?d.x:g.x,f.y<d.y?f.y<g.y?f.y:g.y:d.y<g.y?d.y:g.y,e,o,h),P=gm(w,T,e,o,h),L=t.prevZ,N=t.nextZ;L&&L.z>=I&&N&&N.z<=P;){if(L!==t.prev&&L!==t.next&&Mu(f.x,f.y,d.x,d.y,g.x,g.y,L.x,L.y)&&bi(L.prev,L,L.next)>=0||(L=L.prevZ,N!==t.prev&&N!==t.next&&Mu(f.x,f.y,d.x,d.y,g.x,g.y,N.x,N.y)&&bi(N.prev,N,N.next)>=0))return!1;N=N.nextZ}for(;L&&L.z>=I;){if(L!==t.prev&&L!==t.next&&Mu(f.x,f.y,d.x,d.y,g.x,g.y,L.x,L.y)&&bi(L.prev,L,L.next)>=0)return!1;L=L.prevZ}for(;N&&N.z<=P;){if(N!==t.prev&&N!==t.next&&Mu(f.x,f.y,d.x,d.y,g.x,g.y,N.x,N.y)&&bi(N.prev,N,N.next)>=0)return!1;N=N.nextZ}return!0}function m2(t,e,o){var h=t;do{var f=h.prev,d=h.next.next;!ef(f,d)&&zg(f,h,h.next,d)&&hc(f,d)&&hc(d,f)&&(e.push(f.i/o),e.push(h.i/o),e.push(d.i/o),cc(h),cc(h.next),h=t=d),h=h.next}while(h!==t);return Bs(h)}function y2(t,e,o,h,f,d){var g=t;do{for(var w=g.next.next;w!==g.prev;){if(g.i!==w.i&&b2(g,w)){var T=Dg(g,w);return g=Bs(g,g.next),T=Bs(T,T.next),uc(g,e,o,h,f,d),void uc(T,e,o,h,f,d)}w=w.next}g=g.next}while(g!==t)}function g2(t,e){return t.x-e.x}function v2(t,e){if(e=function(h,f){var d,g=f,w=h.x,T=h.y,I=-1/0;do{if(T<=g.y&&T>=g.next.y&&g.next.y!==g.y){var P=g.x+(T-g.y)*(g.next.x-g.x)/(g.next.y-g.y);if(P<=w&&P>I){if(I=P,P===w){if(T===g.y)return g;if(T===g.next.y)return g.next}d=g.x<g.next.x?g:g.next}}g=g.next}while(g!==f);if(!d)return null;if(w===I)return d;var L,N=d,U=d.x,Q=d.y,$=1/0;g=d;do w>=g.x&&g.x>=U&&w!==g.x&&Mu(T<Q?w:I,T,U,Q,T<Q?I:w,T,g.x,g.y)&&(L=Math.abs(T-g.y)/(w-g.x),hc(g,h)&&(L<$||L===$&&(g.x>d.x||g.x===d.x&&_2(d,g)))&&(d=g,$=L)),g=g.next;while(g!==N);return d}(t,e)){var o=Dg(e,t);Bs(e,e.next),Bs(o,o.next)}}function _2(t,e){return bi(t.prev,t,e.prev)<0&&bi(e.next,t,t.next)<0}function gm(t,e,o,h,f){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-o)*f)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-h)*f)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function x2(t){var e=t,o=t;do(e.x<o.x||e.x===o.x&&e.y<o.y)&&(o=e),e=e.next;while(e!==t);return o}function Mu(t,e,o,h,f,d,g,w){return(f-g)*(e-w)-(t-g)*(d-w)>=0&&(t-g)*(h-w)-(o-g)*(e-w)>=0&&(o-g)*(d-w)-(f-g)*(h-w)>=0}function b2(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(o,h){var f=o;do{if(f.i!==o.i&&f.next.i!==o.i&&f.i!==h.i&&f.next.i!==h.i&&zg(f,f.next,o,h))return!0;f=f.next}while(f!==o);return!1}(t,e)&&(hc(t,e)&&hc(e,t)&&function(o,h){var f=o,d=!1,g=(o.x+h.x)/2,w=(o.y+h.y)/2;do f.y>w!=f.next.y>w&&f.next.y!==f.y&&g<(f.next.x-f.x)*(w-f.y)/(f.next.y-f.y)+f.x&&(d=!d),f=f.next;while(f!==o);return d}(t,e)&&(bi(t.prev,t,e.prev)||bi(t,e.prev,e))||ef(t,e)&&bi(t.prev,t,t.next)>0&&bi(e.prev,e,e.next)>0)}function bi(t,e,o){return(e.y-t.y)*(o.x-e.x)-(e.x-t.x)*(o.y-e.y)}function ef(t,e){return t.x===e.x&&t.y===e.y}function zg(t,e,o,h){var f=nf(bi(t,e,o)),d=nf(bi(t,e,h)),g=nf(bi(o,h,t)),w=nf(bi(o,h,e));return f!==d&&g!==w||!(f!==0||!rf(t,o,e))||!(d!==0||!rf(t,h,e))||!(g!==0||!rf(o,t,h))||!(w!==0||!rf(o,e,h))}function rf(t,e,o){return e.x<=Math.max(t.x,o.x)&&e.x>=Math.min(t.x,o.x)&&e.y<=Math.max(t.y,o.y)&&e.y>=Math.min(t.y,o.y)}function nf(t){return t>0?1:t<0?-1:0}function hc(t,e){return bi(t.prev,t,t.next)<0?bi(t,e,t.next)>=0&&bi(t,t.prev,e)>=0:bi(t,e,t.prev)<0||bi(t,t.next,e)<0}function Dg(t,e){var o=new vm(t.i,t.x,t.y),h=new vm(e.i,e.x,e.y),f=t.next,d=e.prev;return t.next=e,e.prev=t,o.next=f,f.prev=o,h.next=o,o.prev=h,d.next=h,h.prev=d,h}function Og(t,e,o,h){var f=new vm(t,e,o);return h?(f.next=h.next,f.prev=h,h.next.prev=f,h.next=f):(f.prev=f,f.next=f),f}function cc(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function vm(t,e,o){this.i=t,this.x=e,this.y=o,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function _m(t,e,o,h){for(var f=0,d=e,g=o-h;d<o;d+=h)f+=(t[g]-t[d])*(t[d+1]+t[g+1]),g=d;return f}function w2(t,e,o,h,f){(function d(g,w,T,I,P){for(;I>T;){if(I-T>600){var L=I-T+1,N=w-T+1,U=Math.log(L),Q=.5*Math.exp(2*U/3),$=.5*Math.sqrt(U*Q*(L-Q)/L)*(N-L/2<0?-1:1);d(g,w,Math.max(T,Math.floor(w-N*Q/L+$)),Math.min(I,Math.floor(w+(L-N)*Q/L+$)),P)}var ct=g[w],st=T,vt=I;for(pc(g,T,w),P(g[I],ct)>0&&pc(g,T,I);st<vt;){for(pc(g,st,vt),st++,vt--;P(g[st],ct)<0;)st++;for(;P(g[vt],ct)>0;)vt--}P(g[T],ct)===0?pc(g,T,vt):pc(g,++vt,I),vt<=w&&(T=vt+1),w<=vt&&(I=vt-1)}})(t,e,o||0,h||t.length-1,f||S2)}function pc(t,e,o){var h=t[e];t[e]=t[o],t[o]=h}function S2(t,e){return t<e?-1:t>e?1:0}function xm(t,e){var o=t.length;if(o<=1)return[t];for(var h,f,d=[],g=0;g<o;g++){var w=Ur(t[g]);w!==0&&(t[g].area=Math.abs(w),f===void 0&&(f=w<0),f===w<0?(h&&d.push(h),h=[t[g]]):h.push(t[g]))}if(h&&d.push(h),e>1)for(var T=0;T<d.length;T++)d[T].length<=e||(w2(d[T],e,1,d[T].length-1,E2),d[T]=d[T].slice(0,e));return d}function E2(t,e){return e.area-t.area}function bm(t,e,o){for(var h=o.patternDependencies,f=!1,d=0,g=e;d<g.length;d+=1){var w=g[d].paint.get(t+"-pattern");w.isConstant()||(f=!0);var T=w.constantOr(null);T&&(f=!0,h[T.to]=!0,h[T.from]=!0)}return f}function wm(t,e,o,h,f){for(var d=f.patternDependencies,g=0,w=e;g<w.length;g+=1){var T=w[g],I=T.paint.get(t+"-pattern").value;if(I.kind!=="constant"){var P=I.evaluate({zoom:h-1},o,{},f.availableImages),L=I.evaluate({zoom:h},o,{},f.availableImages),N=I.evaluate({zoom:h+1},o,{},f.availableImages);L=L&&L.name?L.name:L,N=N&&N.name?N.name:N,d[P=P&&P.name?P.name:P]=!0,d[L]=!0,d[N]=!0,o.patterns[T.id]={min:P,mid:L,max:N}}}return o}tf.deviation=function(t,e,o,h){var f=e&&e.length,d=Math.abs(_m(t,0,f?e[0]*o:t.length,o));if(f)for(var g=0,w=e.length;g<w;g++)d-=Math.abs(_m(t,e[g]*o,g<w-1?e[g+1]*o:t.length,o));var T=0;for(g=0;g<h.length;g+=3){var I=h[g]*o,P=h[g+1]*o,L=h[g+2]*o;T+=Math.abs((t[I]-t[L])*(t[P+1]-t[I+1])-(t[I]-t[P])*(t[L+1]-t[I+1]))}return d===0&&T===0?0:Math.abs((T-d)/d)},tf.flatten=function(t){for(var e=t[0][0].length,o={vertices:[],holes:[],dimensions:e},h=0,f=0;f<t.length;f++){for(var d=0;d<t[f].length;d++)for(var g=0;g<e;g++)o.vertices.push(t[f][d][g]);f>0&&o.holes.push(h+=t[f-1].length)}return o},ym.default=p2;var jo=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(e){return e.id}),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new bl,this.indexArray=new Hn,this.indexArray2=new El,this.programConfigurations=new wr(t.layers,t.zoom),this.segments=new V,this.segments2=new V,this.stateDependentLayerIds=this.layers.filter(function(e){return e.isStateDependent()}).map(function(e){return e.id})};jo.prototype.populate=function(t,e,o){this.hasPattern=bm("fill",this.layers,e);for(var h=this.layers[0].layout.get("fill-sort-key"),f=!h.isConstant(),d=[],g=0,w=t;g<w.length;g+=1){var T=w[g],I=T.feature,P=T.id,L=T.index,N=T.sourceLayerIndex,U=this.layers[0]._featureFilter.needGeometry,Q=en(I,U);if(this.layers[0]._featureFilter.filter(new fr(this.zoom),Q,o)){var $=f?h.evaluate(Q,{},o,e.availableImages):void 0,ct={id:P,properties:I.properties,type:I.type,sourceLayerIndex:N,index:L,geometry:U?Q.geometry:si(I),patterns:{},sortKey:$};d.push(ct)}}f&&d.sort(function(Xt,de){return Xt.sortKey-de.sortKey});for(var st=0,vt=d;st<vt.length;st+=1){var xt=vt[st],St=xt.geometry,Et=xt.index,Pt=xt.sourceLayerIndex;if(this.hasPattern){var jt=wm("fill",this.layers,xt,this.zoom,e);this.patternFeatures.push(jt)}else this.addFeature(xt,St,Et,o,{});e.featureIndex.insert(t[Et].feature,St,Et,Pt,this.index)}},jo.prototype.update=function(t,e,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,o)},jo.prototype.addFeatures=function(t,e,o){for(var h=0,f=this.patternFeatures;h<f.length;h+=1){var d=f[h];this.addFeature(d,d.geometry,d.index,e,o)}},jo.prototype.isEmpty=function(){return this.layoutVertexArray.length===0},jo.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},jo.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,c2),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0},jo.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())},jo.prototype.addFeature=function(t,e,o,h,f){for(var d=0,g=xm(e,500);d<g.length;d+=1){for(var w=g[d],T=0,I=0,P=w;I<P.length;I+=1)T+=P[I].length;for(var L=this.segments.prepareSegment(T,this.layoutVertexArray,this.indexArray),N=L.vertexLength,U=[],Q=[],$=0,ct=w;$<ct.length;$+=1){var st=ct[$];if(st.length!==0){st!==w[0]&&Q.push(U.length/2);var vt=this.segments2.prepareSegment(st.length,this.layoutVertexArray,this.indexArray2),xt=vt.vertexLength;this.layoutVertexArray.emplaceBack(st[0].x,st[0].y),this.indexArray2.emplaceBack(xt+st.length-1,xt),U.push(st[0].x),U.push(st[0].y);for(var St=1;St<st.length;St++)this.layoutVertexArray.emplaceBack(st[St].x,st[St].y),this.indexArray2.emplaceBack(xt+St-1,xt+St),U.push(st[St].x),U.push(st[St].y);vt.vertexLength+=st.length,vt.primitiveLength+=st.length}}for(var Et=ym(U,Q),Pt=0;Pt<Et.length;Pt+=3)this.indexArray.emplaceBack(N+Et[Pt],N+Et[Pt+1],N+Et[Pt+2]);L.vertexLength+=T,L.primitiveLength+=Et.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,o,f,h)},oe("FillBucket",jo,{omit:["layers","patternFeatures"]});var T2=new Dn({"fill-sort-key":new Ie(X.layout_fill["fill-sort-key"])}),M2={paint:new Dn({"fill-antialias":new re(X.paint_fill["fill-antialias"]),"fill-opacity":new Ie(X.paint_fill["fill-opacity"]),"fill-color":new Ie(X.paint_fill["fill-color"]),"fill-outline-color":new Ie(X.paint_fill["fill-outline-color"]),"fill-translate":new re(X.paint_fill["fill-translate"]),"fill-translate-anchor":new re(X.paint_fill["fill-translate-anchor"]),"fill-pattern":new zn(X.paint_fill["fill-pattern"])}),layout:T2},I2=function(t){function e(o){t.call(this,o,M2)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(o,h){t.prototype.recalculate.call(this,o,h);var f=this.paint._values["fill-outline-color"];f.value.kind==="constant"&&f.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])},e.prototype.createBucket=function(o){return new jo(o)},e.prototype.queryRadius=function(){return Vo(this.paint.get("fill-translate"))},e.prototype.queryIntersectsFeature=function(o,h,f,d,g,w,T){return Xn(yo(o,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),w.angle,T),d)},e.prototype.isTileClipped=function(){return!0},e}(oo),C2=Gi([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4).members,Ng=Iu;function Iu(t,e,o,h,f){this.properties={},this.extent=o,this.type=0,this._pbf=t,this._geometry=-1,this._keys=h,this._values=f,t.readFields(A2,this,e)}function A2(t,e,o){t==1?e.id=o.readVarint():t==2?function(h,f){for(var d=h.readVarint()+h.pos;h.pos<d;){var g=f._keys[h.readVarint()],w=f._values[h.readVarint()];f.properties[g]=w}}(o,e):t==3?e.type=o.readVarint():t==4&&(e._geometry=o.pos)}function P2(t){for(var e,o,h=0,f=0,d=t.length,g=d-1;f<d;g=f++)h+=((o=t[g]).x-(e=t[f]).x)*(e.y+o.y);return h}Iu.types=["Unknown","Point","LineString","Polygon"],Iu.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,o=t.readVarint()+t.pos,h=1,f=0,d=0,g=0,w=[];t.pos<o;){if(f<=0){var T=t.readVarint();h=7&T,f=T>>3}if(f--,h===1||h===2)d+=t.readSVarint(),g+=t.readSVarint(),h===1&&(e&&w.push(e),e=[]),e.push(new M(d,g));else{if(h!==7)throw new Error("unknown command "+h);e&&e.push(e[0].clone())}}return e&&w.push(e),w},Iu.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,o=1,h=0,f=0,d=0,g=1/0,w=-1/0,T=1/0,I=-1/0;t.pos<e;){if(h<=0){var P=t.readVarint();o=7&P,h=P>>3}if(h--,o===1||o===2)(f+=t.readSVarint())<g&&(g=f),f>w&&(w=f),(d+=t.readSVarint())<T&&(T=d),d>I&&(I=d);else if(o!==7)throw new Error("unknown command "+o)}return[g,T,w,I]},Iu.prototype.toGeoJSON=function(t,e,o){var h,f,d=this.extent*Math.pow(2,o),g=this.extent*t,w=this.extent*e,T=this.loadGeometry(),I=Iu.types[this.type];function P(U){for(var Q=0;Q<U.length;Q++){var $=U[Q];U[Q]=[360*($.x+g)/d-180,360/Math.PI*Math.atan(Math.exp((180-360*($.y+w)/d)*Math.PI/180))-90]}}switch(this.type){case 1:var L=[];for(h=0;h<T.length;h++)L[h]=T[h][0];P(T=L);break;case 2:for(h=0;h<T.length;h++)P(T[h]);break;case 3:for(T=function(U){var Q=U.length;if(Q<=1)return[U];for(var $,ct,st=[],vt=0;vt<Q;vt++){var xt=P2(U[vt]);xt!==0&&(ct===void 0&&(ct=xt<0),ct===xt<0?($&&st.push($),$=[U[vt]]):$.push(U[vt]))}return $&&st.push($),st}(T),h=0;h<T.length;h++)for(f=0;f<T[h].length;f++)P(T[h][f])}T.length===1?T=T[0]:I="Multi"+I;var N={type:"Feature",geometry:{type:I,coordinates:T},properties:this.properties};return"id"in this&&(N.id=this.id),N};var Fg=Bg;function Bg(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(L2,this,e),this.length=this._features.length}function L2(t,e,o){t===15?e.version=o.readVarint():t===1?e.name=o.readString():t===5?e.extent=o.readVarint():t===2?e._features.push(o.pos):t===3?e._keys.push(o.readString()):t===4&&e._values.push(function(h){for(var f=null,d=h.readVarint()+h.pos;h.pos<d;){var g=h.readVarint()>>3;f=g===1?h.readString():g===2?h.readFloat():g===3?h.readDouble():g===4?h.readVarint64():g===5?h.readVarint():g===6?h.readSVarint():g===7?h.readBoolean():null}return f}(o))}function k2(t,e,o){if(t===3){var h=new Fg(o,o.readVarint()+o.pos);h.length&&(e[h.name]=h)}}Bg.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new Ng(this._pbf,e,this.extent,this._keys,this._values)};var Cu={VectorTile:function(t,e){this.layers=t.readFields(k2,{},e)},VectorTileFeature:Ng,VectorTileLayer:Fg},R2=Cu.VectorTileFeature.types,Sm=Math.pow(2,13);function fc(t,e,o,h,f,d,g,w){t.emplaceBack(e,o,2*Math.floor(h*Sm)+g,f*Sm*2,d*Sm*2,Math.round(w))}var qo=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(e){return e.id}),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new On,this.indexArray=new Hn,this.programConfigurations=new wr(t.layers,t.zoom),this.segments=new V,this.stateDependentLayerIds=this.layers.filter(function(e){return e.isStateDependent()}).map(function(e){return e.id})};function z2(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}qo.prototype.populate=function(t,e,o){this.features=[],this.hasPattern=bm("fill-extrusion",this.layers,e);for(var h=0,f=t;h<f.length;h+=1){var d=f[h],g=d.feature,w=d.id,T=d.index,I=d.sourceLayerIndex,P=this.layers[0]._featureFilter.needGeometry,L=en(g,P);if(this.layers[0]._featureFilter.filter(new fr(this.zoom),L,o)){var N={id:w,sourceLayerIndex:I,index:T,geometry:P?L.geometry:si(g),properties:g.properties,type:g.type,patterns:{}};this.hasPattern?this.features.push(wm("fill-extrusion",this.layers,N,this.zoom,e)):this.addFeature(N,N.geometry,T,o,{}),e.featureIndex.insert(g,N.geometry,T,I,this.index,!0)}}},qo.prototype.addFeatures=function(t,e,o){for(var h=0,f=this.features;h<f.length;h+=1){var d=f[h];this.addFeature(d,d.geometry,d.index,e,o)}},qo.prototype.update=function(t,e,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,o)},qo.prototype.isEmpty=function(){return this.layoutVertexArray.length===0},qo.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},qo.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,C2),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},qo.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},qo.prototype.addFeature=function(t,e,o,h,f){for(var d=0,g=xm(e,500);d<g.length;d+=1){for(var w=g[d],T=0,I=0,P=w;I<P.length;I+=1)T+=P[I].length;for(var L=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray),N=0,U=w;N<U.length;N+=1){var Q=U[N];if(Q.length!==0&&!((He=Q).every(function(Ue){return Ue.x<0})||He.every(function(Ue){return Ue.x>8192})||He.every(function(Ue){return Ue.y<0})||He.every(function(Ue){return Ue.y>8192})))for(var $=0,ct=0;ct<Q.length;ct++){var st=Q[ct];if(ct>=1){var vt=Q[ct-1];if(!z2(st,vt)){L.vertexLength+4>V.MAX_VERTEX_ARRAY_LENGTH&&(L=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var xt=st.sub(vt)._perp()._unit(),St=vt.dist(st);$+St>32768&&($=0),fc(this.layoutVertexArray,st.x,st.y,xt.x,xt.y,0,0,$),fc(this.layoutVertexArray,st.x,st.y,xt.x,xt.y,0,1,$),fc(this.layoutVertexArray,vt.x,vt.y,xt.x,xt.y,0,0,$+=St),fc(this.layoutVertexArray,vt.x,vt.y,xt.x,xt.y,0,1,$);var Et=L.vertexLength;this.indexArray.emplaceBack(Et,Et+2,Et+1),this.indexArray.emplaceBack(Et+1,Et+2,Et+3),L.vertexLength+=4,L.primitiveLength+=2}}}}if(L.vertexLength+T>V.MAX_VERTEX_ARRAY_LENGTH&&(L=this.segments.prepareSegment(T,this.layoutVertexArray,this.indexArray)),R2[t.type]==="Polygon"){for(var Pt=[],jt=[],Xt=L.vertexLength,de=0,Qt=w;de<Qt.length;de+=1){var ve=Qt[de];if(ve.length!==0){ve!==w[0]&&jt.push(Pt.length/2);for(var ee=0;ee<ve.length;ee++){var Ve=ve[ee];fc(this.layoutVertexArray,Ve.x,Ve.y,0,0,1,1,0),Pt.push(Ve.x),Pt.push(Ve.y)}}}for(var Me=ym(Pt,jt),fe=0;fe<Me.length;fe+=3)this.indexArray.emplaceBack(Xt+Me[fe],Xt+Me[fe+2],Xt+Me[fe+1]);L.primitiveLength+=Me.length/3,L.vertexLength+=T}}var He;this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,o,f,h)},oe("FillExtrusionBucket",qo,{omit:["layers","features"]});var D2={paint:new Dn({"fill-extrusion-opacity":new re(X["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ie(X["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new re(X["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new re(X["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new zn(X["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ie(X["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ie(X["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new re(X["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})},O2=function(t){function e(o){t.call(this,o,D2)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(o){return new qo(o)},e.prototype.queryRadius=function(){return Vo(this.paint.get("fill-extrusion-translate"))},e.prototype.is3D=function(){return!0},e.prototype.queryIntersectsFeature=function(o,h,f,d,g,w,T,I){var P=yo(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),w.angle,T),L=this.paint.get("fill-extrusion-height").evaluate(h,f),N=this.paint.get("fill-extrusion-base").evaluate(h,f),U=function($,ct,st,vt){for(var xt=[],St=0,Et=$;St<Et.length;St+=1){var Pt=Et[St],jt=[Pt.x,Pt.y,0,1];Eu(jt,jt,ct),xt.push(new M(jt[0]/jt[3],jt[1]/jt[3]))}return xt}(P,I),Q=function($,ct,st,vt){for(var xt=[],St=[],Et=vt[8]*ct,Pt=vt[9]*ct,jt=vt[10]*ct,Xt=vt[11]*ct,de=vt[8]*st,Qt=vt[9]*st,ve=vt[10]*st,ee=vt[11]*st,Ve=0,Me=$;Ve<Me.length;Ve+=1){for(var fe=[],He=[],Ue=0,tr=Me[Ve];Ue<tr.length;Ue+=1){var be=tr[Ue],sr=be.x,Kr=be.y,ei=vt[0]*sr+vt[4]*Kr+vt[12],Qr=vt[1]*sr+vt[5]*Kr+vt[13],Hr=vt[2]*sr+vt[6]*Kr+vt[14],ri=vt[3]*sr+vt[7]*Kr+vt[15],Ri=Hr+jt,zi=ri+Xt,dn=ei+de,ji=Qr+Qt,mn=Hr+ve,ui=ri+ee,qi=new M((ei+Et)/zi,(Qr+Pt)/zi);qi.z=Ri/zi,fe.push(qi);var Ye=new M(dn/ui,ji/ui);Ye.z=mn/ui,He.push(Ye)}xt.push(fe),St.push(He)}return[xt,St]}(d,N,L,I);return function($,ct,st){var vt=1/0;Xn(st,ct)&&(vt=Ug(st,ct[0]));for(var xt=0;xt<ct.length;xt++)for(var St=ct[xt],Et=$[xt],Pt=0;Pt<St.length-1;Pt++){var jt=St[Pt],Xt=[jt,St[Pt+1],Et[Pt+1],Et[Pt],jt];cn(st,Xt)&&(vt=Math.min(vt,Ug(st,Xt)))}return vt!==1/0&&vt}(Q[0],Q[1],U)},e}(oo);function dc(t,e){return t.x*e.x+t.y*e.y}function Ug(t,e){if(t.length===1){for(var o,h=0,f=e[h++];!o||f.equals(o);)if(!(o=e[h++]))return 1/0;for(;h<e.length;h++){var d=e[h],g=t[0],w=o.sub(f),T=d.sub(f),I=g.sub(f),P=dc(w,w),L=dc(w,T),N=dc(T,T),U=dc(I,w),Q=dc(I,T),$=P*N-L*L,ct=(N*U-L*Q)/$,st=(P*Q-L*U)/$,vt=f.z*(1-ct-st)+o.z*ct+d.z*st;if(isFinite(vt))return vt}return 1/0}for(var xt=1/0,St=0,Et=e;St<Et.length;St+=1)xt=Math.min(xt,Et[St].z);return xt}var N2=Gi([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4).members,F2=Gi([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]).members,B2=Cu.VectorTileFeature.types,U2=Math.cos(Math.PI/180*37.5),Gg=Math.pow(2,14)/.5,Mn=function(t){var e=this;this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(o){return o.id}),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(function(o){e.gradients[o.id]={}}),this.layoutVertexArray=new xu,this.layoutVertexArray2=new Za,this.indexArray=new Hn,this.programConfigurations=new wr(t.layers,t.zoom),this.segments=new V,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(function(o){return o.isStateDependent()}).map(function(o){return o.id})};Mn.prototype.populate=function(t,e,o){this.hasPattern=bm("line",this.layers,e);for(var h=this.layers[0].layout.get("line-sort-key"),f=!h.isConstant(),d=[],g=0,w=t;g<w.length;g+=1){var T=w[g],I=T.feature,P=T.id,L=T.index,N=T.sourceLayerIndex,U=this.layers[0]._featureFilter.needGeometry,Q=en(I,U);if(this.layers[0]._featureFilter.filter(new fr(this.zoom),Q,o)){var $=f?h.evaluate(Q,{},o):void 0,ct={id:P,properties:I.properties,type:I.type,sourceLayerIndex:N,index:L,geometry:U?Q.geometry:si(I),patterns:{},sortKey:$};d.push(ct)}}f&&d.sort(function(Xt,de){return Xt.sortKey-de.sortKey});for(var st=0,vt=d;st<vt.length;st+=1){var xt=vt[st],St=xt.geometry,Et=xt.index,Pt=xt.sourceLayerIndex;if(this.hasPattern){var jt=wm("line",this.layers,xt,this.zoom,e);this.patternFeatures.push(jt)}else this.addFeature(xt,St,Et,o,{});e.featureIndex.insert(t[Et].feature,St,Et,Pt,this.index)}},Mn.prototype.update=function(t,e,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,o)},Mn.prototype.addFeatures=function(t,e,o){for(var h=0,f=this.patternFeatures;h<f.length;h+=1){var d=f[h];this.addFeature(d,d.geometry,d.index,e,o)}},Mn.prototype.isEmpty=function(){return this.layoutVertexArray.length===0},Mn.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Mn.prototype.upload=function(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,F2)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,N2),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},Mn.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Mn.prototype.lineFeatureClips=function(t){if(t.properties&&t.properties.hasOwnProperty("mapbox_clip_start")&&t.properties.hasOwnProperty("mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}},Mn.prototype.addFeature=function(t,e,o,h,f){var d=this.layers[0].layout,g=d.get("line-join").evaluate(t,{}),w=d.get("line-cap"),T=d.get("line-miter-limit"),I=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(var P=0,L=e;P<L.length;P+=1)this.addLine(L[P],t,g,w,T,I);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,o,f,h)},Mn.prototype.addLine=function(t,e,o,h,f,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(var g=0;g<t.length-1;g++)this.totalDistance+=t[g].dist(t[g+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}for(var w=B2[e.type]==="Polygon",T=t.length;T>=2&&t[T-1].equals(t[T-2]);)T--;for(var I=0;I<T-1&&t[I].equals(t[I+1]);)I++;if(!(T<(w?3:2))){o==="bevel"&&(f=1.05);var P,L=this.overscaling<=16?122880/(512*this.overscaling):0,N=this.segments.prepareSegment(10*T,this.layoutVertexArray,this.indexArray),U=void 0,Q=void 0,$=void 0,ct=void 0;this.e1=this.e2=-1,w&&(ct=t[I].sub(P=t[T-2])._unit()._perp());for(var st=I;st<T;st++)if(!(Q=st===T-1?w?t[I+1]:void 0:t[st+1])||!t[st].equals(Q)){ct&&($=ct),P&&(U=P),P=t[st],ct=Q?Q.sub(P)._unit()._perp():$;var vt=($=$||ct).add(ct);vt.x===0&&vt.y===0||vt._unit();var xt=$.x*ct.x+$.y*ct.y,St=vt.x*ct.x+vt.y*ct.y,Et=St!==0?1/St:1/0,Pt=2*Math.sqrt(2-2*St),jt=St<U2&&U&&Q,Xt=$.x*ct.y-$.y*ct.x>0;if(jt&&st>I){var de=P.dist(U);if(de>2*L){var Qt=P.sub(P.sub(U)._mult(L/de)._round());this.updateDistance(U,Qt),this.addCurrentVertex(Qt,$,0,0,N),U=Qt}}var ve=U&&Q,ee=ve?o:w?"butt":h;if(ve&&ee==="round"&&(Et<d?ee="miter":Et<=2&&(ee="fakeround")),ee==="miter"&&Et>f&&(ee="bevel"),ee==="bevel"&&(Et>2&&(ee="flipbevel"),Et<f&&(ee="miter")),U&&this.updateDistance(U,P),ee==="miter")vt._mult(Et),this.addCurrentVertex(P,vt,0,0,N);else if(ee==="flipbevel"){if(Et>100)vt=ct.mult(-1);else{var Ve=Et*$.add(ct).mag()/$.sub(ct).mag();vt._perp()._mult(Ve*(Xt?-1:1))}this.addCurrentVertex(P,vt,0,0,N),this.addCurrentVertex(P,vt.mult(-1),0,0,N)}else if(ee==="bevel"||ee==="fakeround"){var Me=-Math.sqrt(Et*Et-1),fe=Xt?Me:0,He=Xt?0:Me;if(U&&this.addCurrentVertex(P,$,fe,He,N),ee==="fakeround")for(var Ue=Math.round(180*Pt/Math.PI/20),tr=1;tr<Ue;tr++){var be=tr/Ue;if(be!==.5){var sr=be-.5;be+=be*sr*(be-1)*((1.0904+xt*(xt*(3.55645-1.43519*xt)-3.2452))*sr*sr+(.848013+xt*(.215638*xt-1.06021)))}var Kr=ct.sub($)._mult(be)._add($)._unit()._mult(Xt?-1:1);this.addHalfVertex(P,Kr.x,Kr.y,!1,Xt,0,N)}Q&&this.addCurrentVertex(P,ct,-fe,-He,N)}else if(ee==="butt")this.addCurrentVertex(P,vt,0,0,N);else if(ee==="square"){var ei=U?1:-1;this.addCurrentVertex(P,vt,ei,ei,N)}else ee==="round"&&(U&&(this.addCurrentVertex(P,$,0,0,N),this.addCurrentVertex(P,$,1,1,N,!0)),Q&&(this.addCurrentVertex(P,ct,-1,-1,N,!0),this.addCurrentVertex(P,ct,0,0,N)));if(jt&&st<T-1){var Qr=P.dist(Q);if(Qr>2*L){var Hr=P.add(Q.sub(P)._mult(L/Qr)._round());this.updateDistance(P,Hr),this.addCurrentVertex(Hr,ct,0,0,N),P=Hr}}}}},Mn.prototype.addCurrentVertex=function(t,e,o,h,f,d){d===void 0&&(d=!1);var g=e.y*h-e.x,w=-e.y-e.x*h;this.addHalfVertex(t,e.x+e.y*o,e.y-e.x*o,d,!1,o,f),this.addHalfVertex(t,g,w,d,!0,-h,f),this.distance>Gg/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(t,e,o,h,f,d))},Mn.prototype.addHalfVertex=function(t,e,o,h,f,d,g){var w=.5*(this.lineClips?this.scaledDistance*(Gg-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t.x<<1)+(h?1:0),(t.y<<1)+(f?1:0),Math.round(63*e)+128,Math.round(63*o)+128,1+(d===0?0:d<0?-1:1)|(63&w)<<2,w>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);var T=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,T),g.primitiveLength++),f?this.e2=T:this.e1=T},Mn.prototype.updateScaledDistance=function(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance},Mn.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.updateScaledDistance()},oe("LineBucket",Mn,{omit:["layers","patternFeatures"]});var G2=new Dn({"line-cap":new re(X.layout_line["line-cap"]),"line-join":new Ie(X.layout_line["line-join"]),"line-miter-limit":new re(X.layout_line["line-miter-limit"]),"line-round-limit":new re(X.layout_line["line-round-limit"]),"line-sort-key":new Ie(X.layout_line["line-sort-key"])}),Vg={paint:new Dn({"line-opacity":new Ie(X.paint_line["line-opacity"]),"line-color":new Ie(X.paint_line["line-color"]),"line-translate":new re(X.paint_line["line-translate"]),"line-translate-anchor":new re(X.paint_line["line-translate-anchor"]),"line-width":new Ie(X.paint_line["line-width"]),"line-gap-width":new Ie(X.paint_line["line-gap-width"]),"line-offset":new Ie(X.paint_line["line-offset"]),"line-blur":new Ie(X.paint_line["line-blur"]),"line-dasharray":new no(X.paint_line["line-dasharray"]),"line-pattern":new zn(X.paint_line["line-pattern"]),"line-gradient":new Fo(X.paint_line["line-gradient"])}),layout:G2},jg=new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(o,h){return h=new fr(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),t.prototype.possiblyEvaluate.call(this,o,h)},e.prototype.evaluate=function(o,h,f,d){return h=ft({},h,{zoom:Math.floor(h.zoom)}),t.prototype.evaluate.call(this,o,h,f,d)},e}(Ie))(Vg.paint.properties["line-width"].specification);jg.useIntegerZoom=!0;var V2=function(t){function e(o){t.call(this,o,Vg),this.gradientVersion=0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(o){o==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof po,this.gradientVersion=(this.gradientVersion+1)%j)},e.prototype.gradientExpression=function(){return this._transitionablePaint._values["line-gradient"].value.expression},e.prototype.recalculate=function(o,h){t.prototype.recalculate.call(this,o,h),this.paint._values["line-floorwidth"]=jg.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)},e.prototype.createBucket=function(o){return new Mn(o)},e.prototype.queryRadius=function(o){var h=o,f=qg(xi("line-width",this,h),xi("line-gap-width",this,h)),d=xi("line-offset",this,h);return f/2+Math.abs(d)+Vo(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(o,h,f,d,g,w,T){var I=yo(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),w.angle,T),P=T/2*qg(this.paint.get("line-width").evaluate(h,f),this.paint.get("line-gap-width").evaluate(h,f)),L=this.paint.get("line-offset").evaluate(h,f);return L&&(d=function(N,U){for(var Q=[],$=new M(0,0),ct=0;ct<N.length;ct++){for(var st=N[ct],vt=[],xt=0;xt<st.length;xt++){var St=st[xt],Et=st[xt+1],Pt=xt===0?$:St.sub(st[xt-1])._unit()._perp(),jt=xt===st.length-1?$:Et.sub(St)._unit()._perp(),Xt=Pt._add(jt)._unit();Xt._mult(1/(Xt.x*jt.x+Xt.y*jt.y)),vt.push(Xt._mult(U)._add(St))}Q.push(vt)}return Q}(d,L*T)),function(N,U,Q){for(var $=0;$<U.length;$++){var ct=U[$];if(N.length>=3){for(var st=0;st<ct.length;st++)if(Co(N,ct[st]))return!0}if(lc(N,ct,Q))return!0}return!1}(I,d,P)},e.prototype.isTileClipped=function(){return!0},e}(oo);function qg(t,e){return e>0?e+2*t:t}var j2=Gi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),q2=Gi([{name:"a_projected_pos",components:3,type:"Float32"}],4),W2=(Gi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Gi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),Wg=(Gi([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Gi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),K2=Gi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function H2(t,e,o){return t.sections.forEach(function(h){h.text=function(f,d,g){var w=d.layout.get("text-transform").evaluate(g,{});return w==="uppercase"?f=f.toLocaleUpperCase():w==="lowercase"&&(f=f.toLocaleLowerCase()),Zr.applyArabicShaping&&(f=Zr.applyArabicShaping(f)),f}(h.text,e,o)}),t}Gi([{name:"triangle",components:3,type:"Uint16"}]),Gi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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"}]),Gi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Gi([{type:"Float32",name:"offsetX"}]),Gi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var mc={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"},Kg=function(t,e,o,h,f){var d,g,w=8*f-h-1,T=(1<<w)-1,I=T>>1,P=-7,L=o?f-1:0,N=o?-1:1,U=t[e+L];for(L+=N,d=U&(1<<-P)-1,U>>=-P,P+=w;P>0;d=256*d+t[e+L],L+=N,P-=8);for(g=d&(1<<-P)-1,d>>=-P,P+=h;P>0;g=256*g+t[e+L],L+=N,P-=8);if(d===0)d=1-I;else{if(d===T)return g?NaN:1/0*(U?-1:1);g+=Math.pow(2,h),d-=I}return(U?-1:1)*g*Math.pow(2,d-h)},Hg=function(t,e,o,h,f,d){var g,w,T,I=8*d-f-1,P=(1<<I)-1,L=P>>1,N=f===23?Math.pow(2,-24)-Math.pow(2,-77):0,U=h?0:d-1,Q=h?1:-1,$=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(w=isNaN(e)?1:0,g=P):(g=Math.floor(Math.log(e)/Math.LN2),e*(T=Math.pow(2,-g))<1&&(g--,T*=2),(e+=g+L>=1?N/T:N*Math.pow(2,1-L))*T>=2&&(g++,T/=2),g+L>=P?(w=0,g=P):g+L>=1?(w=(e*T-1)*Math.pow(2,f),g+=L):(w=e*Math.pow(2,L-1)*Math.pow(2,f),g=0));f>=8;t[o+U]=255&w,U+=Q,w/=256,f-=8);for(g=g<<f|w,I+=f;I>0;t[o+U]=255&g,U+=Q,g/=256,I-=8);t[o+U-Q]|=128*$},of=Rr;function Rr(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}Rr.Varint=0,Rr.Fixed64=1,Rr.Bytes=2,Rr.Fixed32=5;var Zg=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Qa(t){return t.type===Rr.Bytes?t.readVarint()+t.pos:t.pos+1}function Au(t,e,o){return o?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Xg(t,e,o){var h=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));o.realloc(h);for(var f=o.pos-1;f>=t;f--)o.buf[f+h]=o.buf[f]}function Z2(t,e){for(var o=0;o<t.length;o++)e.writeVarint(t[o])}function X2(t,e){for(var o=0;o<t.length;o++)e.writeSVarint(t[o])}function Y2(t,e){for(var o=0;o<t.length;o++)e.writeFloat(t[o])}function J2(t,e){for(var o=0;o<t.length;o++)e.writeDouble(t[o])}function Q2(t,e){for(var o=0;o<t.length;o++)e.writeBoolean(t[o])}function $2(t,e){for(var o=0;o<t.length;o++)e.writeFixed32(t[o])}function tS(t,e){for(var o=0;o<t.length;o++)e.writeSFixed32(t[o])}function eS(t,e){for(var o=0;o<t.length;o++)e.writeFixed64(t[o])}function rS(t,e){for(var o=0;o<t.length;o++)e.writeSFixed64(t[o])}function af(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Pu(t,e,o){t[o]=e,t[o+1]=e>>>8,t[o+2]=e>>>16,t[o+3]=e>>>24}function Yg(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function iS(t,e,o){t===1&&o.readMessage(nS,e)}function nS(t,e,o){if(t===3){var h=o.readMessage(oS,{}),f=h.width,d=h.height,g=h.left,w=h.top,T=h.advance;e.push({id:h.id,bitmap:new Al({width:f+6,height:d+6},h.bitmap),metrics:{width:f,height:d,left:g,top:w,advance:T}})}}function oS(t,e,o){t===1?e.id=o.readVarint():t===2?e.bitmap=o.readBytes():t===3?e.width=o.readVarint():t===4?e.height=o.readVarint():t===5?e.left=o.readSVarint():t===6?e.top=o.readSVarint():t===7&&(e.advance=o.readVarint())}function Jg(t){for(var e=0,o=0,h=0,f=t;h<f.length;h+=1){var d=f[h];e+=d.w*d.h,o=Math.max(o,d.w)}t.sort(function($,ct){return ct.h-$.h});for(var g=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),o),h:1/0}],w=0,T=0,I=0,P=t;I<P.length;I+=1)for(var L=P[I],N=g.length-1;N>=0;N--){var U=g[N];if(!(L.w>U.w||L.h>U.h)){if(L.x=U.x,L.y=U.y,T=Math.max(T,L.y+L.h),w=Math.max(w,L.x+L.w),L.w===U.w&&L.h===U.h){var Q=g.pop();N<g.length&&(g[N]=Q)}else L.h===U.h?(U.x+=L.w,U.w-=L.w):L.w===U.w?(U.y+=L.h,U.h-=L.h):(g.push({x:U.x+L.w,y:U.y,w:U.w-L.w,h:L.h}),U.y+=L.h,U.h-=L.h);break}}return{w,h:T,fill:e/(w*T)||0}}Rr.prototype={destroy:function(){this.buf=null},readFields:function(t,e,o){for(o=o||this.length;this.pos<o;){var h=this.readVarint(),f=h>>3,d=this.pos;this.type=7&h,t(f,e,this),this.pos===d&&this.skip(h)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=af(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Yg(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=af(this.buf,this.pos)+4294967296*af(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=af(this.buf,this.pos)+4294967296*Yg(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=Kg(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Kg(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,o,h=this.buf;return e=127&(o=h[this.pos++]),o<128?e:(e|=(127&(o=h[this.pos++]))<<7,o<128?e:(e|=(127&(o=h[this.pos++]))<<14,o<128?e:(e|=(127&(o=h[this.pos++]))<<21,o<128?e:function(f,d,g){var w,T,I=g.buf;if(w=(112&(T=I[g.pos++]))>>4,T<128||(w|=(127&(T=I[g.pos++]))<<3,T<128)||(w|=(127&(T=I[g.pos++]))<<10,T<128)||(w|=(127&(T=I[g.pos++]))<<17,T<128)||(w|=(127&(T=I[g.pos++]))<<24,T<128)||(w|=(1&(T=I[g.pos++]))<<31,T<128))return Au(f,w,d);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(o=h[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Zg?function(o,h,f){return Zg.decode(o.subarray(h,f))}(this.buf,e,t):function(o,h,f){for(var d="",g=h;g<f;){var w,T,I,P=o[g],L=null,N=P>239?4:P>223?3:P>191?2:1;if(g+N>f)break;N===1?P<128&&(L=P):N===2?(192&(w=o[g+1]))==128&&(L=(31&P)<<6|63&w)<=127&&(L=null):N===3?(T=o[g+2],(192&(w=o[g+1]))==128&&(192&T)==128&&((L=(15&P)<<12|(63&w)<<6|63&T)<=2047||L>=55296&&L<=57343)&&(L=null)):N===4&&(T=o[g+2],I=o[g+3],(192&(w=o[g+1]))==128&&(192&T)==128&&(192&I)==128&&((L=(15&P)<<18|(63&w)<<12|(63&T)<<6|63&I)<=65535||L>=1114112)&&(L=null)),L===null?(L=65533,N=1):L>65535&&(L-=65536,d+=String.fromCharCode(L>>>10&1023|55296),L=56320|1023&L),d+=String.fromCharCode(L),g+=N}return d}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==Rr.Bytes)return t.push(this.readVarint(e));var o=Qa(this);for(t=t||[];this.pos<o;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==Rr.Bytes)return t.push(this.readSVarint());var e=Qa(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==Rr.Bytes)return t.push(this.readBoolean());var e=Qa(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==Rr.Bytes)return t.push(this.readFloat());var e=Qa(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==Rr.Bytes)return t.push(this.readDouble());var e=Qa(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==Rr.Bytes)return t.push(this.readFixed32());var e=Qa(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==Rr.Bytes)return t.push(this.readSFixed32());var e=Qa(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==Rr.Bytes)return t.push(this.readFixed64());var e=Qa(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==Rr.Bytes)return t.push(this.readSFixed64());var e=Qa(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Rr.Varint)for(;this.buf[this.pos++]>127;);else if(e===Rr.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Rr.Fixed32)this.pos+=4;else{if(e!==Rr.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var o=new Uint8Array(e);o.set(this.buf),this.buf=o,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Pu(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Pu(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Pu(this.buf,-1&t,this.pos),Pu(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Pu(this.buf,-1&t,this.pos),Pu(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(e,o){var h,f;if(e>=0?(h=e%4294967296|0,f=e/4294967296|0):(f=~(-e/4294967296),4294967295^(h=~(-e%4294967296))?h=h+1|0:(h=0,f=f+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");o.realloc(10),function(d,g,w){w.buf[w.pos++]=127&d|128,d>>>=7,w.buf[w.pos++]=127&d|128,d>>>=7,w.buf[w.pos++]=127&d|128,d>>>=7,w.buf[w.pos++]=127&d|128,w.buf[w.pos]=127&(d>>>=7)}(h,0,o),function(d,g){var w=(7&d)<<4;g.buf[g.pos++]|=w|((d>>>=3)?128:0),d&&(g.buf[g.pos++]=127&d|((d>>>=7)?128:0),d&&(g.buf[g.pos++]=127&d|((d>>>=7)?128:0),d&&(g.buf[g.pos++]=127&d|((d>>>=7)?128:0),d&&(g.buf[g.pos++]=127&d|((d>>>=7)?128:0),d&&(g.buf[g.pos++]=127&d)))))}(f,o)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(h,f,d){for(var g,w,T=0;T<f.length;T++){if((g=f.charCodeAt(T))>55295&&g<57344){if(!w){g>56319||T+1===f.length?(h[d++]=239,h[d++]=191,h[d++]=189):w=g;continue}if(g<56320){h[d++]=239,h[d++]=191,h[d++]=189,w=g;continue}g=w-55296<<10|g-56320|65536,w=null}else w&&(h[d++]=239,h[d++]=191,h[d++]=189,w=null);g<128?h[d++]=g:(g<2048?h[d++]=g>>6|192:(g<65536?h[d++]=g>>12|224:(h[d++]=g>>18|240,h[d++]=g>>12&63|128),h[d++]=g>>6&63|128),h[d++]=63&g|128)}return d}(this.buf,t,this.pos);var o=this.pos-e;o>=128&&Xg(e,o,this),this.pos=e-1,this.writeVarint(o),this.pos+=o},writeFloat:function(t){this.realloc(4),Hg(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Hg(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var o=0;o<e;o++)this.buf[this.pos++]=t[o]},writeRawMessage:function(t,e){this.pos++;var o=this.pos;t(e,this);var h=this.pos-o;h>=128&&Xg(o,h,this),this.pos=o-1,this.writeVarint(h),this.pos+=h},writeMessage:function(t,e,o){this.writeTag(t,Rr.Bytes),this.writeRawMessage(e,o)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Z2,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,X2,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Q2,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Y2,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,J2,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,$2,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,tS,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,eS,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,rS,e)},writeBytesField:function(t,e){this.writeTag(t,Rr.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Rr.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Rr.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Rr.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Rr.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Rr.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Rr.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Rr.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Rr.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Rr.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var sf=function(t,e){var o=e.pixelRatio,h=e.version,f=e.stretchX,d=e.stretchY,g=e.content;this.paddedRect=t,this.pixelRatio=o,this.stretchX=f,this.stretchY=d,this.content=g,this.version=h},yc={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};yc.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},yc.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},yc.tlbr.get=function(){return this.tl.concat(this.br)},yc.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(sf.prototype,yc);var gc=function(t,e){var o={},h={};this.haveRenderCallbacks=[];var f=[];this.addImages(t,o,f),this.addImages(e,h,f);var d=Jg(f),g=new Nn({width:d.w||1,height:d.h||1});for(var w in t){var T=t[w],I=o[w].paddedRect;Nn.copy(T.data,g,{x:0,y:0},{x:I.x+1,y:I.y+1},T.data)}for(var P in e){var L=e[P],N=h[P].paddedRect,U=N.x+1,Q=N.y+1,$=L.data.width,ct=L.data.height;Nn.copy(L.data,g,{x:0,y:0},{x:U,y:Q},L.data),Nn.copy(L.data,g,{x:0,y:ct-1},{x:U,y:Q-1},{width:$,height:1}),Nn.copy(L.data,g,{x:0,y:0},{x:U,y:Q+ct},{width:$,height:1}),Nn.copy(L.data,g,{x:$-1,y:0},{x:U-1,y:Q},{width:1,height:ct}),Nn.copy(L.data,g,{x:0,y:0},{x:U+$,y:Q},{width:1,height:ct})}this.image=g,this.iconPositions=o,this.patternPositions=h};gc.prototype.addImages=function(t,e,o){for(var h in t){var f=t[h],d={x:0,y:0,w:f.data.width+2,h:f.data.height+2};o.push(d),e[h]=new sf(d,f),f.hasRenderCallback&&this.haveRenderCallbacks.push(h)}},gc.prototype.patchUpdatedImages=function(t,e){for(var o in t.dispatchRenderCallbacks(this.haveRenderCallbacks),t.updatedImages)this.patchUpdatedImage(this.iconPositions[o],t.getImage(o),e),this.patchUpdatedImage(this.patternPositions[o],t.getImage(o),e)},gc.prototype.patchUpdatedImage=function(t,e,o){if(t&&e&&t.version!==e.version){t.version=e.version;var h=t.tl;o.update(e.data,void 0,{x:h[0],y:h[1]})}},oe("ImagePosition",sf),oe("ImageAtlas",gc);var ao={horizontal:1,vertical:2,horizontalOnly:3},Lu=function(){this.scale=1,this.fontStack="",this.imageName=null};Lu.forText=function(t,e){var o=new Lu;return o.scale=t||1,o.fontStack=e,o},Lu.forImage=function(t){var e=new Lu;return e.imageName=t,e};var fn=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function lf(t,e,o,h,f,d,g,w,T,I,P,L,N,U,Q,$){var ct,st=fn.fromFeature(t,f);L===ao.vertical&&st.verticalizePunctuation();var vt=Zr.processBidirectionalText,xt=Zr.processStyledBidirectionalText;if(vt&&st.sections.length===1){ct=[];for(var St=0,Et=vt(st.toString(),Em(st,I,d,e,h,U,Q));St<Et.length;St+=1){var Pt=Et[St],jt=new fn;jt.text=Pt,jt.sections=st.sections;for(var Xt=0;Xt<Pt.length;Xt++)jt.sectionIndex.push(0);ct.push(jt)}}else if(xt){ct=[];for(var de=0,Qt=xt(st.text,st.sectionIndex,Em(st,I,d,e,h,U,Q));de<Qt.length;de+=1){var ve=Qt[de],ee=new fn;ee.text=ve[0],ee.sectionIndex=ve[1],ee.sections=st.sections,ct.push(ee)}}else ct=function(fe,He){for(var Ue=[],tr=fe.text,be=0,sr=0,Kr=He;sr<Kr.length;sr+=1){var ei=Kr[sr];Ue.push(fe.substring(be,ei)),be=ei}return be<tr.length&&Ue.push(fe.substring(be,tr.length)),Ue}(st,Em(st,I,d,e,h,U,Q));var Ve=[],Me={positionedLines:Ve,text:st.toString(),top:P[1],bottom:P[1],left:P[0],right:P[0],writingMode:L,iconsInText:!1,verticalizable:!1};return function(fe,He,Ue,tr,be,sr,Kr,ei,Qr,Hr,ri,Ri){for(var zi=0,dn=-17,ji=0,mn=0,ui=ei==="right"?1:ei==="left"?0:.5,qi=0,Ye=0,Sr=be;Ye<Sr.length;Ye+=1){var mr=Sr[Ye];mr.trim();var or=mr.getMaxScale(),In=24*(or-1),rn={positionedGlyphs:[],lineOffset:0};fe.positionedLines[qi]=rn;var Fr=rn.positionedGlyphs,di=0;if(mr.length()){for(var nn=0;nn<mr.length();nn++){var lr=mr.getSection(nn),da=mr.getSectionIndex(nn),so=mr.getCharCode(nn),ma=0,hi=null,ya=null,Ao=null,Bu=24,Rl=!(Qr===ao.horizontal||!ri&&!gu(so)||ri&&(uf[so]||(rs=so,le.Arabic(rs)||le["Arabic Supplement"](rs)||le["Arabic Extended-A"](rs)||le["Arabic Presentation Forms-A"](rs)||le["Arabic Presentation Forms-B"](rs))));if(lr.imageName){var Uu=tr[lr.imageName];if(!Uu)continue;Ao=lr.imageName,fe.iconsInText=fe.iconsInText||!0,ya=Uu.paddedRect;var es=Uu.displaySize;lr.scale=24*lr.scale/Ri,ma=In+(24-es[1]*lr.scale),Bu=(hi={width:es[0],height:es[1],left:1,top:-3,advance:Rl?es[1]:es[0]}).advance;var Gu=Rl?es[0]*lr.scale-24*or:es[1]*lr.scale-24*or;Gu>0&&Gu>di&&(di=Gu)}else{var vf=Ue[lr.fontStack],Vu=vf&&vf[so];if(Vu&&Vu.rect)ya=Vu.rect,hi=Vu.metrics;else{var xc=He[lr.fontStack],_f=xc&&xc[so];if(!_f)continue;hi=_f.metrics}ma=24*(or-lr.scale)}Rl?(fe.verticalizable=!0,Fr.push({glyph:so,imageName:Ao,x:zi,y:dn+ma,vertical:Rl,scale:lr.scale,fontStack:lr.fontStack,sectionIndex:da,metrics:hi,rect:ya}),zi+=Bu*lr.scale+Hr):(Fr.push({glyph:so,imageName:Ao,x:zi,y:dn+ma,vertical:Rl,scale:lr.scale,fontStack:lr.fontStack,sectionIndex:da,metrics:hi,rect:ya}),zi+=hi.advance*lr.scale+Hr)}Fr.length!==0&&(ji=Math.max(zi-Hr,ji),sS(Fr,0,Fr.length-1,ui,di)),zi=0;var xf=sr*or+di;rn.lineOffset=Math.max(di,In),dn+=xf,mn=Math.max(xf,mn),++qi}else dn+=sr,++qi}var rs,bc=dn- -17,ju=Tm(Kr),Gs=ju.horizontalAlign,qu=ju.verticalAlign;(function(bf,wf,wc,Sc,Sf,Ec,Tc,Mc,Ef){var Wu,Tf=(wf-wc)*Sf;Wu=Ec!==Tc?-Mc*Sc- -17:(-Sc*Ef+.5)*Tc;for(var Ku=0,Ic=bf;Ku<Ic.length;Ku+=1)for(var zl=0,Cc=Ic[Ku].positionedGlyphs;zl<Cc.length;zl+=1){var Hu=Cc[zl];Hu.x+=Tf,Hu.y+=Wu}})(fe.positionedLines,ui,Gs,qu,ji,mn,sr,bc,be.length),fe.top+=-qu*bc,fe.bottom=fe.top+bc,fe.left+=-Gs*ji,fe.right=fe.left+ji}(Me,e,o,h,ct,g,w,T,L,I,N,$),!function(fe){for(var He=0,Ue=fe;He<Ue.length;He+=1)if(Ue[He].positionedGlyphs.length!==0)return!1;return!0}(Ve)&&Me}fn.fromFeature=function(t,e){for(var o=new fn,h=0;h<t.sections.length;h++){var f=t.sections[h];f.image?o.addImageSection(f):o.addTextSection(f,e)}return o},fn.prototype.length=function(){return this.text.length},fn.prototype.getSection=function(t){return this.sections[this.sectionIndex[t]]},fn.prototype.getSectionIndex=function(t){return this.sectionIndex[t]},fn.prototype.getCharCode=function(t){return this.text.charCodeAt(t)},fn.prototype.verticalizePunctuation=function(){this.text=function(t){for(var e="",o=0;o<t.length;o++){var h=t.charCodeAt(o+1)||null,f=t.charCodeAt(o-1)||null;e+=h&&ro(h)&&!mc[t[o+1]]||f&&ro(f)&&!mc[t[o-1]]||!mc[t[o]]?t[o]:mc[t[o]]}return e}(this.text)},fn.prototype.trim=function(){for(var t=0,e=0;e<this.text.length&&uf[this.text.charCodeAt(e)];e++)t++;for(var o=this.text.length,h=this.text.length-1;h>=0&&h>=t&&uf[this.text.charCodeAt(h)];h--)o--;this.text=this.text.substring(t,o),this.sectionIndex=this.sectionIndex.slice(t,o)},fn.prototype.substring=function(t,e){var o=new fn;return o.text=this.text.substring(t,e),o.sectionIndex=this.sectionIndex.slice(t,e),o.sections=this.sections,o},fn.prototype.toString=function(){return this.text},fn.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce(function(e,o){return Math.max(e,t.sections[o].scale)},0)},fn.prototype.addTextSection=function(t,e){this.text+=t.text,this.sections.push(Lu.forText(t.scale,t.fontStack||e));for(var o=this.sections.length-1,h=0;h<t.text.length;++h)this.sectionIndex.push(o)},fn.prototype.addImageSection=function(t){var e=t.image?t.image.name:"";if(e.length!==0){var o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCharCode(o),this.sections.push(Lu.forImage(e)),this.sectionIndex.push(this.sections.length-1)):Le("Reached maximum number of images 6401")}else Le("Can't add FormattedSection with an empty image.")},fn.prototype.getNextImageSectionCharCode=function(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var uf={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Yn={};function Qg(t,e,o,h,f,d){if(e.imageName){var g=h[e.imageName];return g?g.displaySize[0]*e.scale*24/d+f:0}var w=o[e.fontStack],T=w&&w[t];return T?T.metrics.advance*e.scale+f:0}function $g(t,e,o,h){var f=Math.pow(t-e,2);return h?t<e?f/2:2*f:f+Math.abs(o)*o}function aS(t,e,o){var h=0;return t===10&&(h-=1e4),o&&(h+=150),t!==40&&t!==65288||(h+=50),e!==41&&e!==65289||(h+=50),h}function tv(t,e,o,h,f,d){for(var g=null,w=$g(e,o,f,d),T=0,I=h;T<I.length;T+=1){var P=I[T],L=$g(e-P.x,o,f,d)+P.badness;L<=w&&(g=P,w=L)}return{index:t,x:e,priorBreak:g,badness:w}}function Em(t,e,o,h,f,d,g){if(d!=="point")return[];if(!t)return[];for(var w,T=[],I=function(ct,st,vt,xt,St,Et){for(var Pt=0,jt=0;jt<ct.length();jt++){var Xt=ct.getSection(jt);Pt+=Qg(ct.getCharCode(jt),Xt,xt,St,st,Et)}return Pt/Math.max(1,Math.ceil(Pt/vt))}(t,e,o,h,f,g),P=t.text.indexOf("\u200B")>=0,L=0,N=0;N<t.length();N++){var U=t.getSection(N),Q=t.getCharCode(N);if(uf[Q]||(L+=Qg(Q,U,h,f,e,g)),N<t.length()-1){var $=!((w=Q)<11904||!(le["Bopomofo Extended"](w)||le.Bopomofo(w)||le["CJK Compatibility Forms"](w)||le["CJK Compatibility Ideographs"](w)||le["CJK Compatibility"](w)||le["CJK Radicals Supplement"](w)||le["CJK Strokes"](w)||le["CJK Symbols and Punctuation"](w)||le["CJK Unified Ideographs Extension A"](w)||le["CJK Unified Ideographs"](w)||le["Enclosed CJK Letters and Months"](w)||le["Halfwidth and Fullwidth Forms"](w)||le.Hiragana(w)||le["Ideographic Description Characters"](w)||le["Kangxi Radicals"](w)||le["Katakana Phonetic Extensions"](w)||le.Katakana(w)||le["Vertical Forms"](w)||le["Yi Radicals"](w)||le["Yi Syllables"](w)));(Yn[Q]||$||U.imageName)&&T.push(tv(N+1,L,I,T,aS(Q,t.getCharCode(N+1),$&&P),!1))}}return function ct(st){return st?ct(st.priorBreak).concat(st.index):[]}(tv(t.length(),L,I,T,0,!0))}function Tm(t){var e=.5,o=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":o=1;break;case"top":case"top-right":case"top-left":o=0}return{horizontalAlign:e,verticalAlign:o}}function sS(t,e,o,h,f){if(h||f)for(var d=t[o],g=(t[o].x+d.metrics.advance*d.scale)*h,w=e;w<=o;w++)t[w].x-=g,t[w].y+=f}function ev(t,e,o,h,f,d){var g,w=t.image;if(w.content){var T=w.content,I=w.pixelRatio||1;g=[T[0]/I,T[1]/I,w.displaySize[0]-T[2]/I,w.displaySize[1]-T[3]/I]}var P,L,N,U,Q=e.left*d,$=e.right*d;o==="width"||o==="both"?(U=f[0]+Q-h[3],L=f[0]+$+h[1]):L=(U=f[0]+(Q+$-w.displaySize[0])/2)+w.displaySize[0];var ct=e.top*d,st=e.bottom*d;return o==="height"||o==="both"?(P=f[1]+ct-h[0],N=f[1]+st+h[2]):N=(P=f[1]+(ct+st-w.displaySize[1])/2)+w.displaySize[1],{image:w,top:P,right:L,bottom:N,left:U,collisionPadding:g}}Yn[10]=!0,Yn[32]=!0,Yn[38]=!0,Yn[40]=!0,Yn[41]=!0,Yn[43]=!0,Yn[45]=!0,Yn[47]=!0,Yn[173]=!0,Yn[183]=!0,Yn[8203]=!0,Yn[8208]=!0,Yn[8211]=!0,Yn[8231]=!0;var ku=function(t){function e(o,h,f,d){t.call(this,o,h),this.angle=f,d!==void 0&&(this.segment=d)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.clone=function(){return new e(this.x,this.y,this.angle,this.segment)},e}(M);function Mm(t,e){var o=e.expression;if(o.kind==="constant")return{kind:"constant",layoutSize:o.evaluate(new fr(t+1))};if(o.kind==="source")return{kind:"source"};for(var h=o.zoomStops,f=o.interpolationType,d=0;d<h.length&&h[d]<=t;)d++;for(var g=d=Math.max(0,d-1);g<h.length&&h[g]<t+1;)g++;g=Math.min(h.length-1,g);var w=h[d],T=h[g];return o.kind==="composite"?{kind:"composite",minZoom:w,maxZoom:T,interpolationType:f}:{kind:"camera",minZoom:w,maxZoom:T,minSize:o.evaluate(new fr(w)),maxSize:o.evaluate(new fr(T)),interpolationType:f}}function rv(t,e,o){var h=e.uSize,f=o.lowerSize;return t.kind==="source"?f/128:t.kind==="composite"?fi(f/128,o.upperSize/128,e.uSizeT):h}function iv(t,e){var o=0,h=0;if(t.kind==="constant")h=t.layoutSize;else if(t.kind!=="source"){var f=t.interpolationType,d=f?J(Zi.interpolationFactor(f,e,t.minZoom,t.maxZoom),0,1):0;t.kind==="camera"?h=fi(t.minSize,t.maxSize,d):o=d}return{uSizeT:o,uSize:h}}oe("Anchor",ku);var lS=Object.freeze({__proto__:null,getSizeData:Mm,evaluateSizeForFeature:rv,evaluateSizeForZoom:iv,SIZE_PACK_FACTOR:128});function nv(t,e,o,h,f){if(e.segment===void 0)return!0;for(var d=e,g=e.segment+1,w=0;w>-o/2;){if(--g<0)return!1;w-=t[g].dist(d),d=t[g]}w+=t[g].dist(t[g+1]),g++;for(var T=[],I=0;w<o/2;){var P=t[g],L=t[g+1];if(!L)return!1;var N=t[g-1].angleTo(P)-P.angleTo(L);for(N=Math.abs((N+3*Math.PI)%(2*Math.PI)-Math.PI),T.push({distance:w,angleDelta:N}),I+=N;w-T[0].distance>h;)I-=T.shift().angleDelta;if(I>f)return!1;g++,w+=P.dist(L)}return!0}function ov(t){for(var e=0,o=0;o<t.length-1;o++)e+=t[o].dist(t[o+1]);return e}function av(t,e,o){return t?.6*e*o:0}function sv(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function uS(t,e,o,h,f,d){for(var g=av(o,f,d),w=sv(o,h)*d,T=0,I=ov(t)/2,P=0;P<t.length-1;P++){var L=t[P],N=t[P+1],U=L.dist(N);if(T+U>I){var Q=(I-T)/U,$=fi(L.x,N.x,Q),ct=fi(L.y,N.y,Q),st=new ku($,ct,N.angleTo(L),P);return st._round(),!g||nv(t,st,w,g,e)?st:void 0}T+=U}}function hS(t,e,o,h,f,d,g,w,T){var I=av(h,d,g),P=sv(h,f),L=P*g,N=t[0].x===0||t[0].x===T||t[0].y===0||t[0].y===T;return e-L<e/4&&(e=L+e/4),function U(Q,$,ct,st,vt,xt,St,Et,Pt){for(var jt=xt/2,Xt=ov(Q),de=0,Qt=$-ct,ve=[],ee=0;ee<Q.length-1;ee++){for(var Ve=Q[ee],Me=Q[ee+1],fe=Ve.dist(Me),He=Me.angleTo(Ve);Qt+ct<de+fe;){var Ue=((Qt+=ct)-de)/fe,tr=fi(Ve.x,Me.x,Ue),be=fi(Ve.y,Me.y,Ue);if(tr>=0&&tr<Pt&&be>=0&&be<Pt&&Qt-jt>=0&&Qt+jt<=Xt){var sr=new ku(tr,be,He,ee);sr._round(),st&&!nv(Q,sr,xt,st,vt)||ve.push(sr)}}de+=fe}return Et||ve.length||St||(ve=U(Q,de/2,ct,st,vt,xt,St,!0,Pt)),ve}(t,N?e/2*w%e:(P/2+2*d)*g*w%e,e,I,o,L,N,!1,T)}function lv(t,e,o,h,f){for(var d=[],g=0;g<t.length;g++)for(var w=t[g],T=void 0,I=0;I<w.length-1;I++){var P=w[I],L=w[I+1];P.x<e&&L.x<e||(P.x<e?P=new M(e,P.y+(e-P.x)/(L.x-P.x)*(L.y-P.y))._round():L.x<e&&(L=new M(e,P.y+(e-P.x)/(L.x-P.x)*(L.y-P.y))._round()),P.y<o&&L.y<o||(P.y<o?P=new M(P.x+(o-P.y)/(L.y-P.y)*(L.x-P.x),o)._round():L.y<o&&(L=new M(P.x+(o-P.y)/(L.y-P.y)*(L.x-P.x),o)._round()),P.x>=h&&L.x>=h||(P.x>=h?P=new M(h,P.y+(h-P.x)/(L.x-P.x)*(L.y-P.y))._round():L.x>=h&&(L=new M(h,P.y+(h-P.x)/(L.x-P.x)*(L.y-P.y))._round()),P.y>=f&&L.y>=f||(P.y>=f?P=new M(P.x+(f-P.y)/(L.y-P.y)*(L.x-P.x),f)._round():L.y>=f&&(L=new M(P.x+(f-P.y)/(L.y-P.y)*(L.x-P.x),f)._round()),T&&P.equals(T[T.length-1])||d.push(T=[P]),T.push(L)))))}return d}function uv(t,e,o,h){var f=[],d=t.image,g=d.pixelRatio,w=d.paddedRect.w-2,T=d.paddedRect.h-2,I=t.right-t.left,P=t.bottom-t.top,L=d.stretchX||[[0,w]],N=d.stretchY||[[0,T]],U=function(tr,be){return tr+be[1]-be[0]},Q=L.reduce(U,0),$=N.reduce(U,0),ct=w-Q,st=T-$,vt=0,xt=Q,St=0,Et=$,Pt=0,jt=ct,Xt=0,de=st;if(d.content&&h){var Qt=d.content;vt=hf(L,0,Qt[0]),St=hf(N,0,Qt[1]),xt=hf(L,Qt[0],Qt[2]),Et=hf(N,Qt[1],Qt[3]),Pt=Qt[0]-vt,Xt=Qt[1]-St,jt=Qt[2]-Qt[0]-xt,de=Qt[3]-Qt[1]-Et}var ve=function(tr,be,sr,Kr){var ei=cf(tr.stretch-vt,xt,I,t.left),Qr=pf(tr.fixed-Pt,jt,tr.stretch,Q),Hr=cf(be.stretch-St,Et,P,t.top),ri=pf(be.fixed-Xt,de,be.stretch,$),Ri=cf(sr.stretch-vt,xt,I,t.left),zi=pf(sr.fixed-Pt,jt,sr.stretch,Q),dn=cf(Kr.stretch-St,Et,P,t.top),ji=pf(Kr.fixed-Xt,de,Kr.stretch,$),mn=new M(ei,Hr),ui=new M(Ri,Hr),qi=new M(Ri,dn),Ye=new M(ei,dn),Sr=new M(Qr/g,ri/g),mr=new M(zi/g,ji/g),or=e*Math.PI/180;if(or){var In=Math.sin(or),rn=Math.cos(or),Fr=[rn,-In,In,rn];mn._matMult(Fr),ui._matMult(Fr),Ye._matMult(Fr),qi._matMult(Fr)}var di=tr.stretch+tr.fixed,nn=be.stretch+be.fixed;return{tl:mn,tr:ui,bl:Ye,br:qi,tex:{x:d.paddedRect.x+1+di,y:d.paddedRect.y+1+nn,w:sr.stretch+sr.fixed-di,h:Kr.stretch+Kr.fixed-nn},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Sr,pixelOffsetBR:mr,minFontScaleX:jt/g/I,minFontScaleY:de/g/P,isSDF:o}};if(h&&(d.stretchX||d.stretchY))for(var ee=hv(L,ct,Q),Ve=hv(N,st,$),Me=0;Me<ee.length-1;Me++)for(var fe=ee[Me],He=ee[Me+1],Ue=0;Ue<Ve.length-1;Ue++)f.push(ve(fe,Ve[Ue],He,Ve[Ue+1]));else f.push(ve({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:w+1},{fixed:0,stretch:T+1}));return f}function hf(t,e,o){for(var h=0,f=0,d=t;f<d.length;f+=1){var g=d[f];h+=Math.max(e,Math.min(o,g[1]))-Math.max(e,Math.min(o,g[0]))}return h}function hv(t,e,o){for(var h=[{fixed:-1,stretch:0}],f=0,d=t;f<d.length;f+=1){var g=d[f],w=g[0],T=g[1],I=h[h.length-1];h.push({fixed:w-I.stretch,stretch:I.stretch}),h.push({fixed:w-I.stretch,stretch:I.stretch+(T-w)})}return h.push({fixed:e+1,stretch:o}),h}function cf(t,e,o,h){return t/e*o+h}function pf(t,e,o,h){return t-e*o/h}var ff=function(t,e,o,h,f,d,g,w,T,I){if(this.boxStartIndex=t.length,T){var P=d.top,L=d.bottom,N=d.collisionPadding;N&&(P-=N[1],L+=N[3]);var U=L-P;U>0&&(U=Math.max(10,U),this.circleDiameter=U)}else{var Q=d.top*g-w,$=d.bottom*g+w,ct=d.left*g-w,st=d.right*g+w,vt=d.collisionPadding;if(vt&&(ct-=vt[0]*g,Q-=vt[1]*g,st+=vt[2]*g,$+=vt[3]*g),I){var xt=new M(ct,Q),St=new M(st,Q),Et=new M(ct,$),Pt=new M(st,$),jt=I*Math.PI/180;xt._rotate(jt),St._rotate(jt),Et._rotate(jt),Pt._rotate(jt),ct=Math.min(xt.x,St.x,Et.x,Pt.x),st=Math.max(xt.x,St.x,Et.x,Pt.x),Q=Math.min(xt.y,St.y,Et.y,Pt.y),$=Math.max(xt.y,St.y,Et.y,Pt.y)}t.emplaceBack(e.x,e.y,ct,Q,st,$,o,h,f)}this.boxEndIndex=t.length},Ru=function(t,e){if(t===void 0&&(t=[]),e===void 0&&(e=cS),this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(var o=(this.length>>1)-1;o>=0;o--)this._down(o)};function cS(t,e){return t<e?-1:t>e?1:0}function pS(t,e,o){e===void 0&&(e=1),o===void 0&&(o=!1);for(var h=1/0,f=1/0,d=-1/0,g=-1/0,w=t[0],T=0;T<w.length;T++){var I=w[T];(!T||I.x<h)&&(h=I.x),(!T||I.y<f)&&(f=I.y),(!T||I.x>d)&&(d=I.x),(!T||I.y>g)&&(g=I.y)}var P=Math.min(d-h,g-f),L=P/2,N=new Ru([],fS);if(P===0)return new M(h,f);for(var U=h;U<d;U+=P)for(var Q=f;Q<g;Q+=P)N.push(new zu(U+L,Q+L,L,t));for(var $=function(vt){for(var xt=0,St=0,Et=0,Pt=vt[0],jt=0,Xt=Pt.length,de=Xt-1;jt<Xt;de=jt++){var Qt=Pt[jt],ve=Pt[de],ee=Qt.x*ve.y-ve.x*Qt.y;St+=(Qt.x+ve.x)*ee,Et+=(Qt.y+ve.y)*ee,xt+=3*ee}return new zu(St/xt,Et/xt,0,vt)}(t),ct=N.length;N.length;){var st=N.pop();(st.d>$.d||!$.d)&&($=st,o&&console.log("found best %d after %d probes",Math.round(1e4*st.d)/1e4,ct)),st.max-$.d<=e||(N.push(new zu(st.p.x-(L=st.h/2),st.p.y-L,L,t)),N.push(new zu(st.p.x+L,st.p.y-L,L,t)),N.push(new zu(st.p.x-L,st.p.y+L,L,t)),N.push(new zu(st.p.x+L,st.p.y+L,L,t)),ct+=4)}return o&&(console.log("num probes: "+ct),console.log("best distance: "+$.d)),$.p}function fS(t,e){return e.max-t.max}function zu(t,e,o,h){this.p=new M(t,e),this.h=o,this.d=function(f,d){for(var g=!1,w=1/0,T=0;T<d.length;T++)for(var I=d[T],P=0,L=I.length,N=L-1;P<L;N=P++){var U=I[P],Q=I[N];U.y>f.y!=Q.y>f.y&&f.x<(Q.x-U.x)*(f.y-U.y)/(Q.y-U.y)+U.x&&(g=!g),w=Math.min(w,Tl(f,U,Q))}return(g?1:-1)*Math.sqrt(w)}(this.p,h),this.max=this.d+this.h*Math.SQRT2}Ru.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},Ru.prototype.pop=function(){if(this.length!==0){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}},Ru.prototype.peek=function(){return this.data[0]},Ru.prototype._up=function(t){for(var e=this.data,o=this.compare,h=e[t];t>0;){var f=t-1>>1,d=e[f];if(o(h,d)>=0)break;e[t]=d,t=f}e[t]=h},Ru.prototype._down=function(t){for(var e=this.data,o=this.compare,h=this.length>>1,f=e[t];t<h;){var d=1+(t<<1),g=e[d],w=d+1;if(w<this.length&&o(e[w],g)<0&&(d=w,g=e[w]),o(g,f)>=0)break;e[t]=g,t=d}e[t]=f};var Im=Number.POSITIVE_INFINITY;function cv(t,e){return e[1]!==Im?function(o,h,f){var d=0,g=0;switch(h=Math.abs(h),f=Math.abs(f),o){case"top-right":case"top-left":case"top":g=f-7;break;case"bottom-right":case"bottom-left":case"bottom":g=7-f}switch(o){case"top-right":case"bottom-right":case"right":d=-h;break;case"top-left":case"bottom-left":case"left":d=h}return[d,g]}(t,e[0],e[1]):function(o,h){var f=0,d=0;h<0&&(h=0);var g=h/Math.sqrt(2);switch(o){case"top-right":case"top-left":d=g-7;break;case"bottom-right":case"bottom-left":d=7-g;break;case"bottom":d=7-h;break;case"top":d=h-7}switch(o){case"top-right":case"bottom-right":f=-g;break;case"top-left":case"bottom-left":f=g;break;case"left":f=h;break;case"right":f=-h}return[f,d]}(t,e[0])}function Cm(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function pv(t,e,o,h,f,d,g,w,T,I,P,L,N,U,Q){var $=function(St,Et,Pt,jt,Xt,de,Qt,ve){for(var ee=jt.layout.get("text-rotate").evaluate(de,{})*Math.PI/180,Ve=[],Me=0,fe=Et.positionedLines;Me<fe.length;Me+=1)for(var He=fe[Me],Ue=0,tr=He.positionedGlyphs;Ue<tr.length;Ue+=1){var be=tr[Ue];if(be.rect){var sr=be.rect||{},Kr=4,ei=!0,Qr=1,Hr=0,ri=(Xt||ve)&&be.vertical,Ri=be.metrics.advance*be.scale/2;if(ve&&Et.verticalizable&&(Hr=He.lineOffset/2-(be.imageName?-(24-be.metrics.width*be.scale)/2:24*(be.scale-1))),be.imageName){var zi=Qt[be.imageName];ei=zi.sdf,Kr=1/(Qr=zi.pixelRatio)}var dn=Xt?[be.x+Ri,be.y]:[0,0],ji=Xt?[0,0]:[be.x+Ri+Pt[0],be.y+Pt[1]-Hr],mn=[0,0];ri&&(mn=ji,ji=[0,0]);var ui=(be.metrics.left-Kr)*be.scale-Ri+ji[0],qi=(-be.metrics.top-Kr)*be.scale+ji[1],Ye=ui+sr.w*be.scale/Qr,Sr=qi+sr.h*be.scale/Qr,mr=new M(ui,qi),or=new M(Ye,qi),In=new M(ui,Sr),rn=new M(Ye,Sr);if(ri){var Fr=new M(-Ri,Ri- -17),di=-Math.PI/2,nn=12-Ri,lr=new M(22-nn,-(be.imageName?nn:0)),da=new(Function.prototype.bind.apply(M,[null].concat(mn)));mr._rotateAround(di,Fr)._add(lr)._add(da),or._rotateAround(di,Fr)._add(lr)._add(da),In._rotateAround(di,Fr)._add(lr)._add(da),rn._rotateAround(di,Fr)._add(lr)._add(da)}if(ee){var so=Math.sin(ee),ma=Math.cos(ee),hi=[ma,-so,so,ma];mr._matMult(hi),or._matMult(hi),In._matMult(hi),rn._matMult(hi)}var ya=new M(0,0),Ao=new M(0,0);Ve.push({tl:mr,tr:or,bl:In,br:rn,tex:sr,writingMode:Et.writingMode,glyphOffset:dn,sectionIndex:be.sectionIndex,isSDF:ei,pixelOffsetTL:ya,pixelOffsetBR:Ao,minFontScaleX:0,minFontScaleY:0})}}return Ve}(0,o,w,f,d,g,h,t.allowVerticalPlacement),ct=t.textSizeData,st=null;ct.kind==="source"?(st=[128*f.layout.get("text-size").evaluate(g,{})])[0]>32640&&Le(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):ct.kind==="composite"&&((st=[128*U.compositeTextSizes[0].evaluate(g,{},Q),128*U.compositeTextSizes[1].evaluate(g,{},Q)])[0]>32640||st[1]>32640)&&Le(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),t.addSymbols(t.text,$,st,w,d,g,I,e,T.lineStartIndex,T.lineLength,N,Q);for(var vt=0,xt=P;vt<xt.length;vt+=1)L[xt[vt]]=t.text.placedSymbolArray.length-1;return 4*$.length}function fv(t){for(var e in t)return t[e];return null}function dS(t,e,o,h){var f=t.compareText;if(e in f){for(var d=f[e],g=d.length-1;g>=0;g--)if(h.dist(d[g])<o)return!0}else f[e]=[];return f[e].push(h),!1}var mS=Cu.VectorTileFeature.types,yS=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function df(t,e,o,h,f,d,g,w,T,I,P,L,N){var U=w?Math.min(32640,Math.round(w[0])):0,Q=w?Math.min(32640,Math.round(w[1])):0;t.emplaceBack(e,o,Math.round(32*h),Math.round(32*f),d,g,(U<<1)+(T?1:0),Q,16*I,16*P,256*L,256*N)}function Am(t,e,o){t.emplaceBack(e.x,e.y,o),t.emplaceBack(e.x,e.y,o),t.emplaceBack(e.x,e.y,o),t.emplaceBack(e.x,e.y,o)}function gS(t){for(var e=0,o=t.sections;e<o.length;e+=1)if(Jp(o[e].text))return!0;return!1}var Du=function(t){this.layoutVertexArray=new Ds,this.indexArray=new Hn,this.programConfigurations=t,this.segments=new V,this.dynamicLayoutVertexArray=new wl,this.opacityVertexArray=new ic,this.placedSymbolArray=new y};Du.prototype.isEmpty=function(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0},Du.prototype.upload=function(t,e,o,h){this.isEmpty()||(o&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,j2.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,q2.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,yS,!0),this.opacityVertexBuffer.itemSize=1),(o||h)&&this.programConfigurations.upload(t))},Du.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())},oe("SymbolBuffers",Du);var vc=function(t,e,o){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new o,this.segments=new V,this.collisionVertexArray=new oc};vc.prototype.upload=function(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,W2.members,!0)},vc.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())},oe("CollisionBuffers",vc);var vr=function(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(d){return d.id}),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=pn([]),this.placementViewportMatrix=pn([]);var e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Mm(this.zoom,e["text-size"]),this.iconSizeData=Mm(this.zoom,e["icon-size"]);var o=this.layers[0].layout,h=o.get("symbol-sort-key"),f=o.get("symbol-z-order");this.canOverlap=o.get("text-allow-overlap")||o.get("icon-allow-overlap")||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=f!=="viewport-y"&&!h.isConstant(),this.sortFeaturesByY=(f==="viewport-y"||f==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,o.get("symbol-placement")==="point"&&(this.writingModes=o.get("text-writing-mode").map(function(d){return ao[d]})),this.stateDependentLayerIds=this.layers.filter(function(d){return d.isStateDependent()}).map(function(d){return d.id}),this.sourceID=t.sourceID};vr.prototype.createArrays=function(){this.text=new Du(new wr(this.layers,this.zoom,function(t){return/^text/.test(t)})),this.icon=new Du(new wr(this.layers,this.zoom,function(t){return/^icon/.test(t)})),this.glyphOffsetArray=new S,this.lineVertexArray=new A,this.symbolInstances=new x},vr.prototype.calculateGlyphDependencies=function(t,e,o,h,f){for(var d=0;d<t.length;d++)if(e[t.charCodeAt(d)]=!0,(o||h)&&f){var g=mc[t.charAt(d)];g&&(e[g.charCodeAt(0)]=!0)}},vr.prototype.populate=function(t,e,o){var h=this.layers[0],f=h.layout,d=f.get("text-font"),g=f.get("text-field"),w=f.get("icon-image"),T=(g.value.kind!=="constant"||g.value.value instanceof Fi&&!g.value.value.isEmpty()||g.value.value.toString().length>0)&&(d.value.kind!=="constant"||d.value.value.length>0),I=w.value.kind!=="constant"||!!w.value.value||Object.keys(w.parameters).length>0,P=f.get("symbol-sort-key");if(this.features=[],T||I){for(var L=e.iconDependencies,N=e.glyphDependencies,U=e.availableImages,Q=new fr(this.zoom),$=0,ct=t;$<ct.length;$+=1){var st=ct[$],vt=st.feature,xt=st.id,St=st.index,Et=st.sourceLayerIndex,Pt=h._featureFilter.needGeometry,jt=en(vt,Pt);if(h._featureFilter.filter(Q,jt,o)){Pt||(jt.geometry=si(vt));var Xt=void 0;if(T){var de=h.getValueAndResolveTokens("text-field",jt,o,U),Qt=Fi.factory(de);gS(Qt)&&(this.hasRTLText=!0),(!this.hasRTLText||mo()==="unavailable"||this.hasRTLText&&Zr.isParsed())&&(Xt=H2(Qt,h,jt))}var ve=void 0;if(I){var ee=h.getValueAndResolveTokens("icon-image",jt,o,U);ve=ee instanceof xn?ee:xn.fromString(ee)}if(Xt||ve){var Ve=this.sortFeaturesByKey?P.evaluate(jt,{},o):void 0;if(this.features.push({id:xt,text:Xt,icon:ve,index:St,sourceLayerIndex:Et,geometry:jt.geometry,properties:vt.properties,type:mS[vt.type],sortKey:Ve}),ve&&(L[ve.name]=!0),Xt){var Me=d.evaluate(jt,{},o).join(","),fe=f.get("text-rotation-alignment")==="map"&&f.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(ao.vertical)>=0;for(var He=0,Ue=Xt.sections;He<Ue.length;He+=1){var tr=Ue[He];if(tr.image)L[tr.image.name]=!0;else{var be=yu(Xt.toString()),sr=tr.fontStack||Me,Kr=N[sr]=N[sr]||{};this.calculateGlyphDependencies(tr.text,Kr,fe,this.allowVerticalPlacement,be)}}}}}}f.get("symbol-placement")==="line"&&(this.features=function(ei){var Qr={},Hr={},ri=[],Ri=0;function zi(Fr){ri.push(ei[Fr]),Ri++}function dn(Fr,di,nn){var lr=Hr[Fr];return delete Hr[Fr],Hr[di]=lr,ri[lr].geometry[0].pop(),ri[lr].geometry[0]=ri[lr].geometry[0].concat(nn[0]),lr}function ji(Fr,di,nn){var lr=Qr[di];return delete Qr[di],Qr[Fr]=lr,ri[lr].geometry[0].shift(),ri[lr].geometry[0]=nn[0].concat(ri[lr].geometry[0]),lr}function mn(Fr,di,nn){var lr=nn?di[0][di[0].length-1]:di[0][0];return Fr+":"+lr.x+":"+lr.y}for(var ui=0;ui<ei.length;ui++){var qi=ei[ui],Ye=qi.geometry,Sr=qi.text?qi.text.toString():null;if(Sr){var mr=mn(Sr,Ye),or=mn(Sr,Ye,!0);if(mr in Hr&&or in Qr&&Hr[mr]!==Qr[or]){var In=ji(mr,or,Ye),rn=dn(mr,or,ri[In].geometry);delete Qr[mr],delete Hr[or],Hr[mn(Sr,ri[rn].geometry,!0)]=rn,ri[In].geometry=null}else mr in Hr?dn(mr,or,Ye):or in Qr?ji(mr,or,Ye):(zi(ui),Qr[mr]=Ri-1,Hr[or]=Ri-1)}else zi(ui)}return ri.filter(function(Fr){return Fr.geometry})}(this.features)),this.sortFeaturesByKey&&this.features.sort(function(ei,Qr){return ei.sortKey-Qr.sortKey})}},vr.prototype.update=function(t,e,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,o),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,o))},vr.prototype.isEmpty=function(){return this.symbolInstances.length===0&&!this.hasRTLText},vr.prototype.uploadPending=function(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload},vr.prototype.upload=function(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0},vr.prototype.destroyDebugData=function(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()},vr.prototype.destroy=function(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()},vr.prototype.addToLineVertexArray=function(t,e){var o=this.lineVertexArray.length;if(t.segment!==void 0){for(var h=t.dist(e[t.segment+1]),f=t.dist(e[t.segment]),d={},g=t.segment+1;g<e.length;g++)d[g]={x:e[g].x,y:e[g].y,tileUnitDistanceFromAnchor:h},g<e.length-1&&(h+=e[g+1].dist(e[g]));for(var w=t.segment||0;w>=0;w--)d[w]={x:e[w].x,y:e[w].y,tileUnitDistanceFromAnchor:f},w>0&&(f+=e[w-1].dist(e[w]));for(var T=0;T<e.length;T++){var I=d[T];this.lineVertexArray.emplaceBack(I.x,I.y,I.tileUnitDistanceFromAnchor)}}return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}},vr.prototype.addSymbols=function(t,e,o,h,f,d,g,w,T,I,P,L){for(var N=t.indexArray,U=t.layoutVertexArray,Q=t.segments.prepareSegment(4*e.length,U,N,this.canOverlap?d.sortKey:void 0),$=this.glyphOffsetArray.length,ct=Q.vertexLength,st=this.allowVerticalPlacement&&g===ao.vertical?Math.PI/2:0,vt=d.text&&d.text.sections,xt=0;xt<e.length;xt++){var St=e[xt],Et=St.tl,Pt=St.tr,jt=St.bl,Xt=St.br,de=St.tex,Qt=St.pixelOffsetTL,ve=St.pixelOffsetBR,ee=St.minFontScaleX,Ve=St.minFontScaleY,Me=St.glyphOffset,fe=St.isSDF,He=St.sectionIndex,Ue=Q.vertexLength,tr=Me[1];df(U,w.x,w.y,Et.x,tr+Et.y,de.x,de.y,o,fe,Qt.x,Qt.y,ee,Ve),df(U,w.x,w.y,Pt.x,tr+Pt.y,de.x+de.w,de.y,o,fe,ve.x,Qt.y,ee,Ve),df(U,w.x,w.y,jt.x,tr+jt.y,de.x,de.y+de.h,o,fe,Qt.x,ve.y,ee,Ve),df(U,w.x,w.y,Xt.x,tr+Xt.y,de.x+de.w,de.y+de.h,o,fe,ve.x,ve.y,ee,Ve),Am(t.dynamicLayoutVertexArray,w,st),N.emplaceBack(Ue,Ue+1,Ue+2),N.emplaceBack(Ue+1,Ue+2,Ue+3),Q.vertexLength+=4,Q.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Me[0]),xt!==e.length-1&&He===e[xt+1].sectionIndex||t.programConfigurations.populatePaintArrays(U.length,d,d.index,{},L,vt&&vt[He])}t.placedSymbolArray.emplaceBack(w.x,w.y,$,this.glyphOffsetArray.length-$,ct,T,I,w.segment,o?o[0]:0,o?o[1]:0,h[0],h[1],g,0,!1,0,P)},vr.prototype._addCollisionDebugVertex=function(t,e,o,h,f,d){return e.emplaceBack(0,0),t.emplaceBack(o.x,o.y,h,f,Math.round(d.x),Math.round(d.y))},vr.prototype.addCollisionDebugVertices=function(t,e,o,h,f,d,g){var w=f.segments.prepareSegment(4,f.layoutVertexArray,f.indexArray),T=w.vertexLength,I=f.layoutVertexArray,P=f.collisionVertexArray,L=g.anchorX,N=g.anchorY;this._addCollisionDebugVertex(I,P,d,L,N,new M(t,e)),this._addCollisionDebugVertex(I,P,d,L,N,new M(o,e)),this._addCollisionDebugVertex(I,P,d,L,N,new M(o,h)),this._addCollisionDebugVertex(I,P,d,L,N,new M(t,h)),w.vertexLength+=4;var U=f.indexArray;U.emplaceBack(T,T+1),U.emplaceBack(T+1,T+2),U.emplaceBack(T+2,T+3),U.emplaceBack(T+3,T),w.primitiveLength+=4},vr.prototype.addDebugCollisionBoxes=function(t,e,o,h){for(var f=t;f<e;f++){var d=this.collisionBoxArray.get(f);this.addCollisionDebugVertices(d.x1,d.y1,d.x2,d.y2,h?this.textCollisionBox:this.iconCollisionBox,d.anchorPoint,o)}},vr.prototype.generateCollisionDebugBuffers=function(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new vc(pa,Wg.members,El),this.iconCollisionBox=new vc(pa,Wg.members,El);for(var t=0;t<this.symbolInstances.length;t++){var e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}},vr.prototype._deserializeCollisionBoxesForSymbol=function(t,e,o,h,f,d,g,w,T){for(var I={},P=e;P<o;P++){var L=t.get(P);I.textBox={x1:L.x1,y1:L.y1,x2:L.x2,y2:L.y2,anchorPointX:L.anchorPointX,anchorPointY:L.anchorPointY},I.textFeatureIndex=L.featureIndex;break}for(var N=h;N<f;N++){var U=t.get(N);I.verticalTextBox={x1:U.x1,y1:U.y1,x2:U.x2,y2:U.y2,anchorPointX:U.anchorPointX,anchorPointY:U.anchorPointY},I.verticalTextFeatureIndex=U.featureIndex;break}for(var Q=d;Q<g;Q++){var $=t.get(Q);I.iconBox={x1:$.x1,y1:$.y1,x2:$.x2,y2:$.y2,anchorPointX:$.anchorPointX,anchorPointY:$.anchorPointY},I.iconFeatureIndex=$.featureIndex;break}for(var ct=w;ct<T;ct++){var st=t.get(ct);I.verticalIconBox={x1:st.x1,y1:st.y1,x2:st.x2,y2:st.y2,anchorPointX:st.anchorPointX,anchorPointY:st.anchorPointY},I.verticalIconFeatureIndex=st.featureIndex;break}return I},vr.prototype.deserializeCollisionBoxes=function(t){this.collisionArrays=[];for(var e=0;e<this.symbolInstances.length;e++){var o=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,o.textBoxStartIndex,o.textBoxEndIndex,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o.iconBoxStartIndex,o.iconBoxEndIndex,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex))}},vr.prototype.hasTextData=function(){return this.text.segments.get().length>0},vr.prototype.hasIconData=function(){return this.icon.segments.get().length>0},vr.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},vr.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},vr.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},vr.prototype.addIndicesForPlacedSymbol=function(t,e){for(var o=t.placedSymbolArray.get(e),h=o.vertexStartIndex+4*o.numGlyphs,f=o.vertexStartIndex;f<h;f+=4)t.indexArray.emplaceBack(f,f+1,f+2),t.indexArray.emplaceBack(f+1,f+2,f+3)},vr.prototype.getSortedSymbolIndexes=function(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;for(var e=Math.sin(t),o=Math.cos(t),h=[],f=[],d=[],g=0;g<this.symbolInstances.length;++g){d.push(g);var w=this.symbolInstances.get(g);h.push(0|Math.round(e*w.anchorX+o*w.anchorY)),f.push(w.featureIndex)}return d.sort(function(T,I){return h[T]-h[I]||f[I]-f[T]}),d},vr.prototype.addToSortKeyRanges=function(t,e){var o=this.sortKeyRanges[this.sortKeyRanges.length-1];o&&o.sortKey===e?o.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})},vr.prototype.sortFeatures=function(t){var e=this;if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var o=0,h=this.symbolInstanceIndexes;o<h.length;o+=1){var f=this.symbolInstances.get(h[o]);this.featureSortOrder.push(f.featureIndex),[f.rightJustifiedTextSymbolIndex,f.centerJustifiedTextSymbolIndex,f.leftJustifiedTextSymbolIndex].forEach(function(d,g,w){d>=0&&w.indexOf(d)===g&&e.addIndicesForPlacedSymbol(e.text,d)}),f.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,f.verticalPlacedTextSymbolIndex),f.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,f.placedIconSymbolIndex),f.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,f.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},oe("SymbolBucket",vr,{omit:["layers","collisionBoxArray","features","compareText"]}),vr.MAX_GLYPHS=65535,vr.addDynamicAttributes=Am;var vS=new Dn({"symbol-placement":new re(X.layout_symbol["symbol-placement"]),"symbol-spacing":new re(X.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new re(X.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ie(X.layout_symbol["symbol-sort-key"]),"symbol-z-order":new re(X.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new re(X.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new re(X.layout_symbol["icon-ignore-placement"]),"icon-optional":new re(X.layout_symbol["icon-optional"]),"icon-rotation-alignment":new re(X.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ie(X.layout_symbol["icon-size"]),"icon-text-fit":new re(X.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new re(X.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ie(X.layout_symbol["icon-image"]),"icon-rotate":new Ie(X.layout_symbol["icon-rotate"]),"icon-padding":new re(X.layout_symbol["icon-padding"]),"icon-keep-upright":new re(X.layout_symbol["icon-keep-upright"]),"icon-offset":new Ie(X.layout_symbol["icon-offset"]),"icon-anchor":new Ie(X.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new re(X.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new re(X.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new re(X.layout_symbol["text-rotation-alignment"]),"text-field":new Ie(X.layout_symbol["text-field"]),"text-font":new Ie(X.layout_symbol["text-font"]),"text-size":new Ie(X.layout_symbol["text-size"]),"text-max-width":new Ie(X.layout_symbol["text-max-width"]),"text-line-height":new re(X.layout_symbol["text-line-height"]),"text-letter-spacing":new Ie(X.layout_symbol["text-letter-spacing"]),"text-justify":new Ie(X.layout_symbol["text-justify"]),"text-radial-offset":new Ie(X.layout_symbol["text-radial-offset"]),"text-variable-anchor":new re(X.layout_symbol["text-variable-anchor"]),"text-anchor":new Ie(X.layout_symbol["text-anchor"]),"text-max-angle":new re(X.layout_symbol["text-max-angle"]),"text-writing-mode":new re(X.layout_symbol["text-writing-mode"]),"text-rotate":new Ie(X.layout_symbol["text-rotate"]),"text-padding":new re(X.layout_symbol["text-padding"]),"text-keep-upright":new re(X.layout_symbol["text-keep-upright"]),"text-transform":new Ie(X.layout_symbol["text-transform"]),"text-offset":new Ie(X.layout_symbol["text-offset"]),"text-allow-overlap":new re(X.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new re(X.layout_symbol["text-ignore-placement"]),"text-optional":new re(X.layout_symbol["text-optional"])}),Pm={paint:new Dn({"icon-opacity":new Ie(X.paint_symbol["icon-opacity"]),"icon-color":new Ie(X.paint_symbol["icon-color"]),"icon-halo-color":new Ie(X.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ie(X.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ie(X.paint_symbol["icon-halo-blur"]),"icon-translate":new re(X.paint_symbol["icon-translate"]),"icon-translate-anchor":new re(X.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ie(X.paint_symbol["text-opacity"]),"text-color":new Ie(X.paint_symbol["text-color"],{runtimeType:Fe,getOverride:function(t){return t.textColor},hasOverride:function(t){return!!t.textColor}}),"text-halo-color":new Ie(X.paint_symbol["text-halo-color"]),"text-halo-width":new Ie(X.paint_symbol["text-halo-width"]),"text-halo-blur":new Ie(X.paint_symbol["text-halo-blur"]),"text-translate":new re(X.paint_symbol["text-translate"]),"text-translate-anchor":new re(X.paint_symbol["text-translate-anchor"])}),layout:vS},Ou=function(t){this.type=t.property.overrides?t.property.overrides.runtimeType:ge,this.defaultValue=t};Ou.prototype.evaluate=function(t){if(t.formattedSection){var e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default},Ou.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)},Ou.prototype.outputDefined=function(){return!1},Ou.prototype.serialize=function(){return null},oe("FormatSectionOverride",Ou,{omit:["defaultValue"]});var _S=function(t){function e(o){t.call(this,o,Pm)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(o,h){if(t.prototype.recalculate.call(this,o,h),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){var f=this.layout.get("text-writing-mode");if(f){for(var d=[],g=0,w=f;g<w.length;g+=1){var T=w[g];d.indexOf(T)<0&&d.push(T)}this.layout._values["text-writing-mode"]=d}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()},e.prototype.getValueAndResolveTokens=function(o,h,f,d){var g=this.layout.get(o).evaluate(h,{},f,d),w=this._unevaluatedLayout._values[o];return w.isDataDriven()||lu(w.value)||!g?g:function(T,I){return I.replace(/{([^{}]+)}/g,function(P,L){return L in T?String(T[L]):""})}(h.properties,g)},e.prototype.createBucket=function(o){return new vr(o)},e.prototype.queryRadius=function(){return 0},e.prototype.queryIntersectsFeature=function(){return!1},e.prototype._setPaintOverrides=function(){for(var o=0,h=Pm.paint.overridableProperties;o<h.length;o+=1){var f=h[o];if(e.hasPaintOverride(this.layout,f)){var d,g=this.paint.get(f),w=new Ou(g),T=new Ls(w,g.property.specification);d=g.value.kind==="constant"||g.value.kind==="source"?new cl("source",T):new ks("composite",T,g.value.zoomStops,g.value._interpolationType),this.paint._values[f]=new Kn(g.property,d,g.parameters)}}},e.prototype._handleOverridablePaintPropertyUpdate=function(o,h,f){return!(!this.layout||h.isDataDriven()||f.isDataDriven())&&e.hasPaintOverride(this.layout,o)},e.hasPaintOverride=function(o,h){var f=o.get("text-field"),d=Pm.paint.properties[h],g=!1,w=function(P){for(var L=0,N=P;L<N.length;L+=1)if(d.overrides&&d.overrides.hasOverride(N[L]))return void(g=!0)};if(f.value.kind==="constant"&&f.value.value instanceof Fi)w(f.value.value.sections);else if(f.value.kind==="source"){var T=function(P){g||(P instanceof to&&Pi(P.value)===Ze?w(P.value.sections):P instanceof Pn?w(P.sections):P.eachChild(T))},I=f.value;I._styleExpression&&T(I._styleExpression.expression)}return g},e}(oo),xS={paint:new Dn({"background-color":new re(X.paint_background["background-color"]),"background-pattern":new no(X.paint_background["background-pattern"]),"background-opacity":new re(X.paint_background["background-opacity"])})},bS=function(t){function e(o){t.call(this,o,xS)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(oo),wS={paint:new Dn({"raster-opacity":new re(X.paint_raster["raster-opacity"]),"raster-hue-rotate":new re(X.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new re(X.paint_raster["raster-brightness-min"]),"raster-brightness-max":new re(X.paint_raster["raster-brightness-max"]),"raster-saturation":new re(X.paint_raster["raster-saturation"]),"raster-contrast":new re(X.paint_raster["raster-contrast"]),"raster-resampling":new re(X.paint_raster["raster-resampling"]),"raster-fade-duration":new re(X.paint_raster["raster-fade-duration"])})},SS=function(t){function e(o){t.call(this,o,wS)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(oo),ES=function(t){function e(o){t.call(this,o,{}),this.implementation=o}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.is3D=function(){return this.implementation.renderingMode==="3d"},e.prototype.hasOffscreenPass=function(){return this.implementation.prerender!==void 0},e.prototype.recalculate=function(){},e.prototype.updateTransitions=function(){},e.prototype.hasTransition=function(){},e.prototype.serialize=function(){},e.prototype.onAdd=function(o){this.implementation.onAdd&&this.implementation.onAdd(o,o.painter.context.gl)},e.prototype.onRemove=function(o){this.implementation.onRemove&&this.implementation.onRemove(o,o.painter.context.gl)},e}(oo),TS={circle:Tu,heatmap:l2,hillshade:h2,fill:I2,"fill-extrusion":O2,line:V2,symbol:_S,background:bS,raster:SS},dv=C.HTMLImageElement,mv=C.HTMLCanvasElement,yv=C.HTMLVideoElement,gv=C.ImageData,mf=C.ImageBitmap,Pl=function(t,e,o,h){this.context=t,this.format=o,this.texture=t.gl.createTexture(),this.update(e,h)};Pl.prototype.update=function(t,e,o){var h=t.width,f=t.height,d=!(this.size&&this.size[0]===h&&this.size[1]===f||o),g=this.context,w=g.gl;if(this.useMipmap=Boolean(e&&e.useMipmap),w.bindTexture(w.TEXTURE_2D,this.texture),g.pixelStoreUnpackFlipY.set(!1),g.pixelStoreUnpack.set(1),g.pixelStoreUnpackPremultiplyAlpha.set(this.format===w.RGBA&&(!e||e.premultiply!==!1)),d)this.size=[h,f],t instanceof dv||t instanceof mv||t instanceof yv||t instanceof gv||mf&&t instanceof mf?w.texImage2D(w.TEXTURE_2D,0,this.format,this.format,w.UNSIGNED_BYTE,t):w.texImage2D(w.TEXTURE_2D,0,this.format,h,f,0,this.format,w.UNSIGNED_BYTE,t.data);else{var T=o||{x:0,y:0},I=T.x,P=T.y;t instanceof dv||t instanceof mv||t instanceof yv||t instanceof gv||mf&&t instanceof mf?w.texSubImage2D(w.TEXTURE_2D,0,I,P,w.RGBA,w.UNSIGNED_BYTE,t):w.texSubImage2D(w.TEXTURE_2D,0,I,P,h,f,w.RGBA,w.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&w.generateMipmap(w.TEXTURE_2D)},Pl.prototype.bind=function(t,e,o){var h=this.context.gl;h.bindTexture(h.TEXTURE_2D,this.texture),o!==h.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(o=h.LINEAR),t!==this.filter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,t),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,o||t),this.filter=t),e!==this.wrap&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,e),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,e),this.wrap=e)},Pl.prototype.isSizePowerOfTwo=function(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0},Pl.prototype.destroy=function(){this.context.gl.deleteTexture(this.texture),this.texture=null};var Lm=function(t){var e=this;this._callback=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=function(){e._triggered=!1,e._callback()})};Lm.prototype.trigger=function(){var t=this;this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(function(){t._triggered=!1,t._callback()},0))},Lm.prototype.remove=function(){delete this._channel,this._callback=function(){}};var Nu=function(t,e,o){this.target=t,this.parent=e,this.mapId=o,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},he(["receive","process"],this),this.invoker=new Lm(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Gr()?t:C};function vv(t,e,o){var h=2*Math.PI*6378137/256/Math.pow(2,o);return[t*h-2*Math.PI*6378137/2,e*h-2*Math.PI*6378137/2]}Nu.prototype.send=function(t,e,o,h,f){var d=this;f===void 0&&(f=!1);var g=Math.round(1e18*Math.random()).toString(36).substring(0,10);o&&(this.callbacks[g]=o);var w=te(this.globalScope)?void 0:[];return this.target.postMessage({id:g,type:t,hasCallback:!!o,targetMapId:h,mustQueue:f,sourceMapId:this.mapId,data:kn(e,w)},w),{cancel:function(){o&&delete d.callbacks[g],d.target.postMessage({id:g,type:"<cancel>",targetMapId:h,sourceMapId:d.mapId})}}},Nu.prototype.receive=function(t){var e=t.data,o=e.id;if(o&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type==="<cancel>"){delete this.tasks[o];var h=this.cancelCallbacks[o];delete this.cancelCallbacks[o],h&&h()}else Gr()||e.mustQueue?(this.tasks[o]=e,this.taskQueue.push(o),this.invoker.trigger()):this.processTask(o,e)},Nu.prototype.process=function(){if(this.taskQueue.length){var t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}},Nu.prototype.processTask=function(t,e){var o=this;if(e.type==="<response>"){var h=this.callbacks[t];delete this.callbacks[t],h&&(e.error?h(xl(e.error)):h(null,xl(e.data)))}else{var f=!1,d=te(this.globalScope)?void 0:[],g=e.hasCallback?function(P,L){f=!0,delete o.cancelCallbacks[t],o.target.postMessage({id:t,type:"<response>",sourceMapId:o.mapId,error:P?kn(P):null,data:kn(L,d)},d)}:function(P){f=!0},w=null,T=xl(e.data);if(this.parent[e.type])w=this.parent[e.type](e.sourceMapId,T,g);else if(this.parent.getWorkerSource){var I=e.type.split(".");w=this.parent.getWorkerSource(e.sourceMapId,I[0],T.source)[I[1]](T,g)}else g(new Error("Could not find function "+e.type));!f&&w&&w.cancel&&(this.cancelCallbacks[t]=w.cancel)}},Nu.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};var wi=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};wi.prototype.setNorthEast=function(t){return this._ne=t instanceof Wr?new Wr(t.lng,t.lat):Wr.convert(t),this},wi.prototype.setSouthWest=function(t){return this._sw=t instanceof Wr?new Wr(t.lng,t.lat):Wr.convert(t),this},wi.prototype.extend=function(t){var e,o,h=this._sw,f=this._ne;if(t instanceof Wr)e=t,o=t;else{if(!(t instanceof wi))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(wi.convert(t)):this.extend(Wr.convert(t)):this;if(o=t._ne,!(e=t._sw)||!o)return this}return h||f?(h.lng=Math.min(e.lng,h.lng),h.lat=Math.min(e.lat,h.lat),f.lng=Math.max(o.lng,f.lng),f.lat=Math.max(o.lat,f.lat)):(this._sw=new Wr(e.lng,e.lat),this._ne=new Wr(o.lng,o.lat)),this},wi.prototype.getCenter=function(){return new Wr((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},wi.prototype.getSouthWest=function(){return this._sw},wi.prototype.getNorthEast=function(){return this._ne},wi.prototype.getNorthWest=function(){return new Wr(this.getWest(),this.getNorth())},wi.prototype.getSouthEast=function(){return new Wr(this.getEast(),this.getSouth())},wi.prototype.getWest=function(){return this._sw.lng},wi.prototype.getSouth=function(){return this._sw.lat},wi.prototype.getEast=function(){return this._ne.lng},wi.prototype.getNorth=function(){return this._ne.lat},wi.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},wi.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},wi.prototype.isEmpty=function(){return!(this._sw&&this._ne)},wi.prototype.contains=function(t){var e=Wr.convert(t),o=e.lng,h=e.lat,f=this._sw.lng<=o&&o<=this._ne.lng;return this._sw.lng>this._ne.lng&&(f=this._sw.lng>=o&&o>=this._ne.lng),this._sw.lat<=h&&h<=this._ne.lat&&f},wi.convert=function(t){return!t||t instanceof wi?t:new wi(t)};var Wr=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};Wr.prototype.wrap=function(){return new Wr(mt(this.lng,-180,180),this.lat)},Wr.prototype.toArray=function(){return[this.lng,this.lat]},Wr.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},Wr.prototype.distanceTo=function(t){var e=Math.PI/180,o=this.lat*e,h=t.lat*e,f=Math.sin(o)*Math.sin(h)+Math.cos(o)*Math.cos(h)*Math.cos((t.lng-this.lng)*e);return 63710088e-1*Math.acos(Math.min(f,1))},Wr.prototype.toBounds=function(t){t===void 0&&(t=0);var e=360*t/40075017,o=e/Math.cos(Math.PI/180*this.lat);return new wi(new Wr(this.lng-o,this.lat-e),new Wr(this.lng+o,this.lat+e))},Wr.convert=function(t){if(t instanceof Wr)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new Wr(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new Wr(Number("lng"in t?t.lng:t.lon),Number(t.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>]")};var _v=2*Math.PI*63710088e-1;function xv(t){return _v*Math.cos(t*Math.PI/180)}function bv(t){return(180+t)/360}function wv(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Sv(t,e){return t/xv(e)}function km(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}var Ll=function(t,e,o){o===void 0&&(o=0),this.x=+t,this.y=+e,this.z=+o};Ll.fromLngLat=function(t,e){e===void 0&&(e=0);var o=Wr.convert(t);return new Ll(bv(o.lng),wv(o.lat),Sv(e,o.lat))},Ll.prototype.toLngLat=function(){return new Wr(360*this.x-180,km(this.y))},Ll.prototype.toAltitude=function(){return this.z*xv(km(this.y))},Ll.prototype.meterInMercatorCoordinateUnits=function(){return 1/_v*(t=km(this.y),1/Math.cos(t*Math.PI/180));var t};var kl=function(t,e,o){this.z=t,this.x=e,this.y=o,this.key=_c(0,t,t,e,o)};kl.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},kl.prototype.url=function(t,e){var o,h,f,d,g,w=(h=this.y,f=this.z,d=vv(256*(o=this.x),256*(h=Math.pow(2,f)-h-1),f),g=vv(256*(o+1),256*(h+1),f),d[0]+","+d[1]+","+g[0]+","+g[1]),T=function(I,P,L){for(var N,U="",Q=I;Q>0;Q--)U+=(P&(N=1<<Q-1)?1:0)+(L&N?2:0);return U}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace("{z}",String(this.z)).replace("{x}",String(this.x)).replace("{y}",String(e==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",T).replace("{bbox-epsg-3857}",w)},kl.prototype.getTilePoint=function(t){var e=Math.pow(2,this.z);return new M(8192*(t.x*e-this.x),8192*(t.y*e-this.y))},kl.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y};var Ev=function(t,e){this.wrap=t,this.canonical=e,this.key=_c(t,e.z,e.z,e.x,e.y)},Si=function(t,e,o,h,f){this.overscaledZ=t,this.wrap=e,this.canonical=new kl(o,+h,+f),this.key=_c(e,t,o,h,f)};function _c(t,e,o,h,f){(t*=2)<0&&(t=-1*t-1);var d=1<<o;return(d*d*t+d*f+h).toString(36)+o.toString(36)+e.toString(36)}Si.prototype.equals=function(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)},Si.prototype.scaledTo=function(t){var e=this.canonical.z-t;return t>this.canonical.z?new Si(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Si(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},Si.prototype.calculateScaledKey=function(t,e){var o=this.canonical.z-t;return t>this.canonical.z?_c(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):_c(this.wrap*+e,t,t,this.canonical.x>>o,this.canonical.y>>o)},Si.prototype.isChildOf=function(t){if(t.wrap!==this.wrap)return!1;var e=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e},Si.prototype.children=function(t){if(this.overscaledZ>=t)return[new Si(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,o=2*this.canonical.x,h=2*this.canonical.y;return[new Si(e,this.wrap,e,o,h),new Si(e,this.wrap,e,o+1,h),new Si(e,this.wrap,e,o,h+1),new Si(e,this.wrap,e,o+1,h+1)]},Si.prototype.isLessThan=function(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))},Si.prototype.wrapped=function(){return new Si(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)},Si.prototype.unwrapTo=function(t){return new Si(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)},Si.prototype.overscaleFactor=function(){return Math.pow(2,this.overscaledZ-this.canonical.z)},Si.prototype.toUnwrapped=function(){return new Ev(this.wrap,this.canonical)},Si.prototype.toString=function(){return this.overscaledZ+"/"+this.canonical.x+"/"+this.canonical.y},Si.prototype.getTilePoint=function(t){return this.canonical.getTilePoint(new Ll(t.x-this.wrap,t.y))},oe("CanonicalTileID",kl),oe("OverscaledTileID",Si,{omit:["posMatrix"]});var $a=function(t,e,o){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(o&&o!=="mapbox"&&o!=="terrarium")return Le('"'+o+'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".');this.stride=e.height;var h=this.dim=e.height-2;this.data=new Uint32Array(e.data.buffer),this.encoding=o||"mapbox";for(var f=0;f<h;f++)this.data[this._idx(-1,f)]=this.data[this._idx(0,f)],this.data[this._idx(h,f)]=this.data[this._idx(h-1,f)],this.data[this._idx(f,-1)]=this.data[this._idx(f,0)],this.data[this._idx(f,h)]=this.data[this._idx(f,h-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(h,-1)]=this.data[this._idx(h-1,0)],this.data[this._idx(-1,h)]=this.data[this._idx(0,h-1)],this.data[this._idx(h,h)]=this.data[this._idx(h-1,h-1)]};$a.prototype.get=function(t,e){var o=new Uint8Array(this.data.buffer),h=4*this._idx(t,e);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(o[h],o[h+1],o[h+2])},$a.prototype.getUnpackVector=function(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]},$a.prototype._idx=function(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)},$a.prototype._unpackMapbox=function(t,e,o){return(256*t*256+256*e+o)/10-1e4},$a.prototype._unpackTerrarium=function(t,e,o){return 256*t+e+o/256-32768},$a.prototype.getPixels=function(){return new Nn({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},$a.prototype.backfillBorder=function(t,e,o){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");var h=e*this.dim,f=e*this.dim+this.dim,d=o*this.dim,g=o*this.dim+this.dim;switch(e){case-1:h=f-1;break;case 1:f=h+1}switch(o){case-1:d=g-1;break;case 1:g=d+1}for(var w=-e*this.dim,T=-o*this.dim,I=d;I<g;I++)for(var P=h;P<f;P++)this.data[this._idx(P,I)]=t.data[this._idx(P+w,I+T)]},oe("DEMData",$a);var yf=function(t){this._stringToNumber={},this._numberToString=[];for(var e=0;e<t.length;e++){var o=t[e];this._stringToNumber[o]=e,this._numberToString[e]=o}};yf.prototype.encode=function(t){return this._stringToNumber[t]},yf.prototype.decode=function(t){return this._numberToString[t]};var gf=function(t,e,o,h,f){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=o,t._y=h,this.properties=t.properties,this.id=f},Rm={geometry:{configurable:!0}};Rm.geometry.get=function(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},Rm.geometry.set=function(t){this._geometry=t},gf.prototype.toJSON=function(){var t={geometry:this.geometry};for(var e in this)e!=="_geometry"&&e!=="_vectorTileFeature"&&(t[e]=this[e]);return t},Object.defineProperties(gf.prototype,Rm);var Fu=function(){this.state={},this.stateChanges={},this.deletedStates={}};Fu.prototype.updateState=function(t,e,o){var h=String(e);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][h]=this.stateChanges[t][h]||{},ft(this.stateChanges[t][h],o),this.deletedStates[t]===null)for(var f in this.deletedStates[t]={},this.state[t])f!==h&&(this.deletedStates[t][f]=null);else if(this.deletedStates[t]&&this.deletedStates[t][h]===null)for(var d in this.deletedStates[t][h]={},this.state[t][h])o[d]||(this.deletedStates[t][h][d]=null);else for(var g in o)this.deletedStates[t]&&this.deletedStates[t][h]&&this.deletedStates[t][h][g]===null&&delete this.deletedStates[t][h][g]},Fu.prototype.removeFeatureState=function(t,e,o){if(this.deletedStates[t]!==null){var h=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},o&&e!==void 0)this.deletedStates[t][h]!==null&&(this.deletedStates[t][h]=this.deletedStates[t][h]||{},this.deletedStates[t][h][o]=null);else if(e!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][h])for(o in this.deletedStates[t][h]={},this.stateChanges[t][h])this.deletedStates[t][h][o]=null;else this.deletedStates[t][h]=null;else this.deletedStates[t]=null}},Fu.prototype.getState=function(t,e){var o=String(e),h=ft({},(this.state[t]||{})[o],(this.stateChanges[t]||{})[o]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){var f=this.deletedStates[t][e];if(f===null)return{};for(var d in f)delete h[d]}return h},Fu.prototype.initializeTileState=function(t,e){t.setFeatureState(this.state,e)},Fu.prototype.coalesceChanges=function(t,e){var o={};for(var h in this.stateChanges){this.state[h]=this.state[h]||{};var f={};for(var d in this.stateChanges[h])this.state[h][d]||(this.state[h][d]={}),ft(this.state[h][d],this.stateChanges[h][d]),f[d]=this.state[h][d];o[h]=f}for(var g in this.deletedStates){this.state[g]=this.state[g]||{};var w={};if(this.deletedStates[g]===null)for(var T in this.state[g])w[T]={},this.state[g][T]={};else for(var I in this.deletedStates[g]){if(this.deletedStates[g][I]===null)this.state[g][I]={};else for(var P=0,L=Object.keys(this.deletedStates[g][I]);P<L.length;P+=1)delete this.state[g][I][L[P]];w[I]=this.state[g][I]}o[g]=o[g]||{},ft(o[g],w)}if(this.stateChanges={},this.deletedStates={},Object.keys(o).length!==0)for(var N in t)t[N].setFeatureState(o,e)};var ts=function(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new tn(8192,16,0),this.grid3D=new tn(8192,16,0),this.featureIndexArray=new G,this.promoteId=e};function Tv(t,e,o,h,f){return ce(t,function(d,g){var w=e instanceof Ha?e.get(g):null;return w&&w.evaluate?w.evaluate(o,h,f):w})}function Mv(t){for(var e=1/0,o=1/0,h=-1/0,f=-1/0,d=0,g=t;d<g.length;d+=1){var w=g[d];e=Math.min(e,w.x),o=Math.min(o,w.y),h=Math.max(h,w.x),f=Math.max(f,w.y)}return{minX:e,minY:o,maxX:h,maxY:f}}function MS(t,e){return e-t}ts.prototype.insert=function(t,e,o,h,f,d){var g=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,h,f);for(var w=d?this.grid3D:this.grid,T=0;T<e.length;T++){for(var I=e[T],P=[1/0,1/0,-1/0,-1/0],L=0;L<I.length;L++){var N=I[L];P[0]=Math.min(P[0],N.x),P[1]=Math.min(P[1],N.y),P[2]=Math.max(P[2],N.x),P[3]=Math.max(P[3],N.y)}P[0]<8192&&P[1]<8192&&P[2]>=0&&P[3]>=0&&w.insert(g,P[0],P[1],P[2],P[3])}},ts.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new Cu.VectorTile(new of(this.rawTileData)).layers,this.sourceLayerCoder=new yf(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},ts.prototype.query=function(t,e,o,h){var f=this;this.loadVTLayers();for(var d=t.params||{},g=8192/t.tileSize/t.scale,w=hu(d.filter),T=t.queryGeometry,I=t.queryPadding*g,P=Mv(T),L=this.grid.query(P.minX-I,P.minY-I,P.maxX+I,P.maxY+I),N=Mv(t.cameraQueryGeometry),U=this.grid3D.query(N.minX-I,N.minY-I,N.maxX+I,N.maxY+I,function(St,Et,Pt,jt){return function(Xt,de,Qt,ve,ee){for(var Ve=0,Me=Xt;Ve<Me.length;Ve+=1){var fe=Me[Ve];if(de<=fe.x&&Qt<=fe.y&&ve>=fe.x&&ee>=fe.y)return!0}var He=[new M(de,Qt),new M(de,ee),new M(ve,ee),new M(ve,Qt)];if(Xt.length>2){for(var Ue=0,tr=He;Ue<tr.length;Ue+=1)if(Co(Xt,tr[Ue]))return!0}for(var be=0;be<Xt.length-1;be++)if(Fs(Xt[be],Xt[be+1],He))return!0;return!1}(t.cameraQueryGeometry,St-I,Et-I,Pt+I,jt+I)}),Q=0,$=U;Q<$.length;Q+=1)L.push($[Q]);L.sort(MS);for(var ct,st={},vt=function(St){var Et=L[St];if(Et!==ct){ct=Et;var Pt=f.featureIndexArray.get(Et),jt=null;f.loadMatchingFeature(st,Pt.bucketIndex,Pt.sourceLayerIndex,Pt.featureIndex,w,d.layers,d.availableImages,e,o,h,function(Xt,de,Qt){return jt||(jt=si(Xt)),de.queryIntersectsFeature(T,Xt,Qt,jt,f.z,t.transform,g,t.pixelPosMatrix)})}},xt=0;xt<L.length;xt++)vt(xt);return st},ts.prototype.loadMatchingFeature=function(t,e,o,h,f,d,g,w,T,I,P){var L=this.bucketLayerIDs[e];if(!d||function(Xt,de){for(var Qt=0;Qt<Xt.length;Qt++)if(de.indexOf(Xt[Qt])>=0)return!0;return!1}(d,L)){var N=this.sourceLayerCoder.decode(o),U=this.vtLayers[N].feature(h);if(f.needGeometry){var Q=en(U,!0);if(!f.filter(new fr(this.tileID.overscaledZ),Q,this.tileID.canonical))return}else if(!f.filter(new fr(this.tileID.overscaledZ),U))return;for(var $=this.getId(U,N),ct=0;ct<L.length;ct++){var st=L[ct];if(!(d&&d.indexOf(st)<0)){var vt=w[st];if(vt){var xt={};$!==void 0&&I&&(xt=I.getState(vt.sourceLayer||"_geojsonTileLayer",$));var St=ft({},T[st]);St.paint=Tv(St.paint,vt.paint,U,xt,g),St.layout=Tv(St.layout,vt.layout,U,xt,g);var Et=!P||P(U,vt,xt);if(Et){var Pt=new gf(U,this.z,this.x,this.y,$);Pt.layer=St;var jt=t[st];jt===void 0&&(jt=t[st]=[]),jt.push({featureIndex:h,feature:Pt,intersectionZ:Et})}}}}}},ts.prototype.lookupSymbolFeatures=function(t,e,o,h,f,d,g,w){var T={};this.loadVTLayers();for(var I=hu(f),P=0,L=t;P<L.length;P+=1)this.loadMatchingFeature(T,o,h,L[P],I,d,g,w,e);return T},ts.prototype.hasLayer=function(t){for(var e=0,o=this.bucketLayerIDs;e<o.length;e+=1)for(var h=0,f=o[e];h<f.length;h+=1)if(t===f[h])return!0;return!1},ts.prototype.getId=function(t,e){var o=t.id;return this.promoteId&&typeof(o=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[e]])=="boolean"&&(o=Number(o)),o},oe("FeatureIndex",ts,{omit:["rawTileData","sourceLayerCoder"]});var Vi=function(t,e){this.tileID=t,this.uid=Gt(),this.uses=0,this.tileSize=e,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.expiredRequestCount=0,this.state="loading"};Vi.prototype.registerFadeDuration=function(t){var e=t+this.timeAdded;e<cr.now()||this.fadeEndTime&&e<this.fadeEndTime||(this.fadeEndTime=e)},Vi.prototype.wasRequested=function(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"},Vi.prototype.loadVectorData=function(t,e,o){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){for(var h in t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(I,P){var L={};if(!P)return L;for(var N=function(){var $=Q[U],ct=$.layerIds.map(function(xt){return P.getLayer(xt)}).filter(Boolean);if(ct.length!==0){$.layers=ct,$.stateDependentLayerIds&&($.stateDependentLayers=$.stateDependentLayerIds.map(function(xt){return ct.filter(function(St){return St.id===xt})[0]}));for(var st=0,vt=ct;st<vt.length;st+=1)L[vt[st].id]=$}},U=0,Q=I;U<Q.length;U+=1)N();return L}(t.buckets,e.style),this.hasSymbolBuckets=!1,this.buckets){var f=this.buckets[h];if(f instanceof vr){if(this.hasSymbolBuckets=!0,!o)break;f.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(var d in this.buckets){var g=this.buckets[d];if(g instanceof vr&&g.hasRTLText){this.hasRTLText=!0,Zr.isLoading()||Zr.isLoaded()||mo()!=="deferred"||Qp();break}}for(var w in this.queryPadding=0,this.buckets){var T=this.buckets[w];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(w).queryRadius(T))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new l},Vi.prototype.unloadVectorData=function(){for(var t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"},Vi.prototype.getBucket=function(t){return this.buckets[t.id]},Vi.prototype.upload=function(t){for(var e in this.buckets){var o=this.buckets[e];o.uploadPending()&&o.upload(t)}var h=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Pl(t,this.imageAtlas.image,h.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Pl(t,this.glyphAtlasImage,h.ALPHA),this.glyphAtlasImage=null)},Vi.prototype.prepare=function(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)},Vi.prototype.queryRenderedFeatures=function(t,e,o,h,f,d,g,w,T,I){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:h,cameraQueryGeometry:f,scale:d,tileSize:this.tileSize,pixelPosMatrix:I,transform:w,params:g,queryPadding:this.queryPadding*T},t,e,o):{}},Vi.prototype.querySourceFeatures=function(t,e){var o=this.latestFeatureIndex;if(o&&o.rawTileData){var h=o.loadVTLayers(),f=e?e.sourceLayer:"",d=h._geojsonTileLayer||h[f];if(d)for(var g=hu(e&&e.filter),w=this.tileID.canonical,T=w.z,I=w.x,P=w.y,L={z:T,x:I,y:P},N=0;N<d.length;N++){var U=d.feature(N);if(g.needGeometry){var Q=en(U,!0);if(!g.filter(new fr(this.tileID.overscaledZ),Q,this.tileID.canonical))continue}else if(!g.filter(new fr(this.tileID.overscaledZ),U))continue;var $=o.getId(U,f),ct=new gf(U,T,I,P,$);ct.tile=L,t.push(ct)}}},Vi.prototype.hasData=function(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"},Vi.prototype.patternsLoaded=function(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length},Vi.prototype.setExpiryData=function(t){var e=this.expirationTime;if(t.cacheControl){var o=_n(t.cacheControl);o["max-age"]&&(this.expirationTime=Date.now()+1e3*o["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){var h=Date.now(),f=!1;if(this.expirationTime>h)f=!1;else if(e)if(this.expirationTime<e)f=!0;else{var d=this.expirationTime-e;d?this.expirationTime=h+Math.max(d,3e4):f=!0}else f=!0;f?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}},Vi.prototype.getExpiryTimeout=function(){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)},Vi.prototype.setFeatureState=function(t,e){if(this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&Object.keys(t).length!==0){var o=this.latestFeatureIndex.loadVTLayers();for(var h in this.buckets)if(e.style.hasLayer(h)){var f=this.buckets[h],d=f.layers[0].sourceLayer||"_geojsonTileLayer",g=o[d],w=t[d];if(g&&w&&Object.keys(w).length!==0){f.update(w,g,this.imageAtlas&&this.imageAtlas.patternPositions||{});var T=e&&e.style&&e.style.getLayer(h);T&&(this.queryPadding=Math.max(this.queryPadding,T.queryRadius(f)))}}}},Vi.prototype.holdingForFade=function(){return this.symbolFadeHoldUntil!==void 0},Vi.prototype.symbolFadeFinished=function(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<cr.now()},Vi.prototype.clearFadeHold=function(){this.symbolFadeHoldUntil=void 0},Vi.prototype.setHoldDuration=function(t){this.symbolFadeHoldUntil=cr.now()+t},Vi.prototype.setDependencies=function(t,e){for(var o={},h=0,f=e;h<f.length;h+=1)o[f[h]]=!0;this.dependencies[t]=o},Vi.prototype.hasDependency=function(t,e){for(var o=0,h=t;o<h.length;o+=1){var f=this.dependencies[h[o]];if(f){for(var d=0,g=e;d<g.length;d+=1)if(f[g[d]])return!0}}return!1};var Us=C.performance,Iv=function(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},Us.mark(this._marks.start)};Iv.prototype.finish=function(){Us.mark(this._marks.end);var t=Us.getEntriesByName(this._marks.measure);return t.length===0&&(Us.measure(this._marks.measure,this._marks.start,this._marks.end),t=Us.getEntriesByName(this._marks.measure),Us.clearMarks(this._marks.start),Us.clearMarks(this._marks.end),Us.clearMeasures(this._marks.measure)),t},i.Actor=Nu,i.AlphaImage=Al,i.CanonicalTileID=kl,i.CollisionBoxArray=l,i.Color=$e,i.DEMData=$a,i.DataConstantProperty=re,i.DictionaryCoder=yf,i.EXTENT=8192,i.ErrorEvent=gt,i.EvaluationParameters=fr,i.Event=pt,i.Evented=ht,i.FeatureIndex=ts,i.FillBucket=jo,i.FillExtrusionBucket=qo,i.ImageAtlas=gc,i.ImagePosition=sf,i.LineBucket=Mn,i.LngLat=Wr,i.LngLatBounds=wi,i.MercatorCoordinate=Ll,i.ONE_EM=24,i.OverscaledTileID=Si,i.Point=M,i.Point$1=M,i.Properties=Dn,i.Protobuf=of,i.RGBAImage=Nn,i.RequestManager=Ar,i.RequestPerformance=Iv,i.ResourceType=yi,i.SegmentVector=V,i.SourceFeatureState=Fu,i.StructArrayLayout1ui2=wu,i.StructArrayLayout2f1f2i16=nc,i.StructArrayLayout2i4=bl,i.StructArrayLayout3ui6=Hn,i.StructArrayLayout4i8=Uo,i.SymbolBucket=vr,i.Texture=Pl,i.Tile=Vi,i.Transitionable=Wn,i.Uniform1f=Ut,i.Uniform1i=qt,i.Uniform2f=ie,i.Uniform3f=_e,i.Uniform4f=Se,i.UniformColor=xe,i.UniformMatrix4f=ue,i.UnwrappedTileID=Ev,i.ValidationError=at,i.WritingMode=ao,i.ZoomHistory=Sn,i.add=function(t,e,o){return t[0]=e[0]+o[0],t[1]=e[1]+o[1],t[2]=e[2]+o[2],t},i.addDynamicAttributes=Am,i.asyncAll=function(t,e,o){if(!t.length)return o(null,[]);var h=t.length,f=new Array(t.length),d=null;t.forEach(function(g,w){e(g,function(T,I){T&&(d=T),f[w]=I,--h==0&&o(d,f)})})},i.bezier=Y,i.bindAll=he,i.browser=cr,i.cacheEntryPossiblyAdded=function(t){++$r>Xe&&(t.getActor().send("enforceCacheSizeLimit",Ge),$r=0)},i.clamp=J,i.clearTileCache=function(t){var e=C.caches.delete("mapbox-tiles");t&&e.catch(t).then(function(){return t()})},i.clipLine=lv,i.clone=function(t){var e=new ti(16);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},i.clone$1=Te,i.clone$2=function(t){var e=new ti(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},i.collisionCircleLayout=K2,i.config=We,i.create=function(){var t=new ti(16);return ti!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},i.create$1=function(){var t=new ti(9);return ti!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},i.create$2=function(){var t=new ti(4);return ti!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},i.createCommonjsModule=m,i.createExpression=uu,i.createLayout=Gi,i.createStyleLayer=function(t){return t.type==="custom"?new ES(t):new TS[t.type](t)},i.cross=function(t,e,o){var h=e[0],f=e[1],d=e[2],g=o[0],w=o[1],T=o[2];return t[0]=f*T-d*w,t[1]=d*g-h*T,t[2]=h*w-f*g,t},i.deepEqual=function t(e,o){if(Array.isArray(e)){if(!Array.isArray(o)||e.length!==o.length)return!1;for(var h=0;h<e.length;h++)if(!t(e[h],o[h]))return!1;return!0}if(typeof e=="object"&&e!==null&&o!==null){if(typeof o!="object"||Object.keys(e).length!==Object.keys(o).length)return!1;for(var f in e)if(!t(e[f],o[f]))return!1;return!0}return e===o},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.dot$1=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},i.ease=ot,i.emitValidationErrors=vl,i.endsWith=Kt,i.enforceCacheSizeLimit=function(t){yr(),dt&&dt.then(function(e){e.keys().then(function(o){for(var h=0;h<o.length-t;h++)e.delete(o[h])})})},i.evaluateSizeForFeature=rv,i.evaluateSizeForZoom=iv,i.evaluateVariableOffset=cv,i.evented=ec,i.extend=ft,i.featureFilter=hu,i.filterObject=Yt,i.fromRotation=function(t,e){var o=Math.sin(e),h=Math.cos(e);return t[0]=h,t[1]=o,t[2]=0,t[3]=-o,t[4]=h,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},i.getAnchorAlignment=Tm,i.getAnchorJustification=Cm,i.getArrayBuffer=xr,i.getImage=B,i.getJSON=function(t,e){return vi(ft(t,{type:"json"}),e)},i.getRTLTextPluginStatus=mo,i.getReferrer=gi,i.getVideo=function(t,e){var o,h,f=C.document.createElement("video");f.muted=!0,f.onloadstart=function(){e(null,f)};for(var d=0;d<t.length;d++){var g=C.document.createElement("source");o=t[d],h=void 0,(h=C.document.createElement("a")).href=o,(h.protocol!==C.document.location.protocol||h.host!==C.document.location.host)&&(f.crossOrigin="Anonymous"),g.src=t[d],f.appendChild(g)}return{cancel:function(){}}},i.identity=pn,i.invert=function(t,e){var o=e[0],h=e[1],f=e[2],d=e[3],g=e[4],w=e[5],T=e[6],I=e[7],P=e[8],L=e[9],N=e[10],U=e[11],Q=e[12],$=e[13],ct=e[14],st=e[15],vt=o*w-h*g,xt=o*T-f*g,St=o*I-d*g,Et=h*T-f*w,Pt=h*I-d*w,jt=f*I-d*T,Xt=P*$-L*Q,de=P*ct-N*Q,Qt=P*st-U*Q,ve=L*ct-N*$,ee=L*st-U*$,Ve=N*st-U*ct,Me=vt*Ve-xt*ee+St*ve+Et*Qt-Pt*de+jt*Xt;return Me?(t[0]=(w*Ve-T*ee+I*ve)*(Me=1/Me),t[1]=(f*ee-h*Ve-d*ve)*Me,t[2]=($*jt-ct*Pt+st*Et)*Me,t[3]=(N*Pt-L*jt-U*Et)*Me,t[4]=(T*Qt-g*Ve-I*de)*Me,t[5]=(o*Ve-f*Qt+d*de)*Me,t[6]=(ct*St-Q*jt-st*xt)*Me,t[7]=(P*jt-N*St+U*xt)*Me,t[8]=(g*ee-w*Qt+I*Xt)*Me,t[9]=(h*Qt-o*ee-d*Xt)*Me,t[10]=(Q*Pt-$*St+st*vt)*Me,t[11]=(L*St-P*Pt-U*vt)*Me,t[12]=(w*de-g*ve-T*Xt)*Me,t[13]=(o*ve-h*de+f*Xt)*Me,t[14]=($*xt-Q*Et-ct*vt)*Me,t[15]=(P*Et-L*xt+N*vt)*Me,t):null},i.isChar=le,i.isMapboxURL=Ki,i.keysDifference=function(t,e){var o=[];for(var h in t)h in e||o.push(h);return o},i.makeRequest=vi,i.mapObject=ce,i.mercatorXfromLng=bv,i.mercatorYfromLat=wv,i.mercatorZfromAltitude=Sv,i.mul=dm,i.multiply=Ml,i.mvt=Cu,i.nextPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},i.normalize=function(t,e){var o=e[0],h=e[1],f=e[2],d=o*o+h*h+f*f;return d>0&&(d=1/Math.sqrt(d)),t[0]=e[0]*d,t[1]=e[1]*d,t[2]=e[2]*d,t},i.number=fi,i.offscreenCanvasSupported=Vr,i.ortho=function(t,e,o,h,f,d,g){var w=1/(e-o),T=1/(h-f),I=1/(d-g);return t[0]=-2*w,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*T,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*I,t[11]=0,t[12]=(e+o)*w,t[13]=(f+h)*T,t[14]=(g+d)*I,t[15]=1,t},i.parseGlyphPBF=function(t){return new of(t).readFields(iS,[])},i.pbf=of,i.performSymbolLayout=function(t,e,o,h,f,d,g){t.createArrays(),t.tilePixelRatio=8192/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;var w=t.layers[0].layout,T=t.layers[0]._unevaluatedLayout._values,I={};if(t.textSizeData.kind==="composite"){var P=t.textSizeData,L=P.maxZoom;I.compositeTextSizes=[T["text-size"].possiblyEvaluate(new fr(P.minZoom),g),T["text-size"].possiblyEvaluate(new fr(L),g)]}if(t.iconSizeData.kind==="composite"){var N=t.iconSizeData,U=N.maxZoom;I.compositeIconSizes=[T["icon-size"].possiblyEvaluate(new fr(N.minZoom),g),T["icon-size"].possiblyEvaluate(new fr(U),g)]}I.layoutTextSize=T["text-size"].possiblyEvaluate(new fr(t.zoom+1),g),I.layoutIconSize=T["icon-size"].possiblyEvaluate(new fr(t.zoom+1),g),I.textMaxSize=T["text-size"].possiblyEvaluate(new fr(18));for(var Q=24*w.get("text-line-height"),$=w.get("text-rotation-alignment")==="map"&&w.get("symbol-placement")!=="point",ct=w.get("text-keep-upright"),st=w.get("text-size"),vt=function(){var Et=St[xt],Pt=w.get("text-font").evaluate(Et,{},g).join(","),jt=st.evaluate(Et,{},g),Xt=I.layoutTextSize.evaluate(Et,{},g),de=I.layoutIconSize.evaluate(Et,{},g),Qt={horizontal:{},vertical:void 0},ve=Et.text,ee=[0,0];if(ve){var Ve=ve.toString(),Me=24*w.get("text-letter-spacing").evaluate(Et,{},g),fe=function(Ye){for(var Sr=0,mr=Ye;Sr<mr.length;Sr+=1)if(or=mr[Sr].charCodeAt(0),le.Arabic(or)||le["Arabic Supplement"](or)||le["Arabic Extended-A"](or)||le["Arabic Presentation Forms-A"](or)||le["Arabic Presentation Forms-B"](or))return!1;var or;return!0}(Ve)?Me:0,He=w.get("text-anchor").evaluate(Et,{},g),Ue=w.get("text-variable-anchor");if(!Ue){var tr=w.get("text-radial-offset").evaluate(Et,{},g);ee=tr?cv(He,[24*tr,Im]):w.get("text-offset").evaluate(Et,{},g).map(function(Ye){return 24*Ye})}var be=$?"center":w.get("text-justify").evaluate(Et,{},g),sr=w.get("symbol-placement"),Kr=sr==="point"?24*w.get("text-max-width").evaluate(Et,{},g):0,ei=function(){t.allowVerticalPlacement&&yu(Ve)&&(Qt.vertical=lf(ve,e,o,f,Pt,Kr,Q,He,"left",fe,ee,ao.vertical,!0,sr,Xt,jt))};if(!$&&Ue){for(var Qr=be==="auto"?Ue.map(function(Ye){return Cm(Ye)}):[be],Hr=!1,ri=0;ri<Qr.length;ri++){var Ri=Qr[ri];if(!Qt.horizontal[Ri])if(Hr)Qt.horizontal[Ri]=Qt.horizontal[0];else{var zi=lf(ve,e,o,f,Pt,Kr,Q,"center",Ri,fe,ee,ao.horizontal,!1,sr,Xt,jt);zi&&(Qt.horizontal[Ri]=zi,Hr=zi.positionedLines.length===1)}}ei()}else{be==="auto"&&(be=Cm(He));var dn=lf(ve,e,o,f,Pt,Kr,Q,He,be,fe,ee,ao.horizontal,!1,sr,Xt,jt);dn&&(Qt.horizontal[be]=dn),ei(),yu(Ve)&&$&&ct&&(Qt.vertical=lf(ve,e,o,f,Pt,Kr,Q,He,be,fe,ee,ao.vertical,!1,sr,Xt,jt))}}var ji=void 0,mn=!1;if(Et.icon&&Et.icon.name){var ui=h[Et.icon.name];ui&&(ji=function(Ye,Sr,mr){var or=Tm(mr),In=Sr[0]-Ye.displaySize[0]*or.horizontalAlign,rn=Sr[1]-Ye.displaySize[1]*or.verticalAlign;return{image:Ye,top:rn,bottom:rn+Ye.displaySize[1],left:In,right:In+Ye.displaySize[0]}}(f[Et.icon.name],w.get("icon-offset").evaluate(Et,{},g),w.get("icon-anchor").evaluate(Et,{},g)),mn=ui.sdf,t.sdfIcons===void 0?t.sdfIcons=ui.sdf:t.sdfIcons!==ui.sdf&&Le("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ui.pixelRatio!==t.pixelRatio||w.get("icon-rotate").constantOr(1)!==0)&&(t.iconsNeedLinear=!0))}var qi=fv(Qt.horizontal)||Qt.vertical;t.iconsInText=!!qi&&qi.iconsInText,(qi||ji)&&function(Ye,Sr,mr,or,In,rn,Fr,di,nn,lr,da){var so=rn.textMaxSize.evaluate(Sr,{});so===void 0&&(so=Fr);var ma,hi=Ye.layers[0].layout,ya=hi.get("icon-offset").evaluate(Sr,{},da),Ao=fv(mr.horizontal),Bu=Fr/24,Rl=Ye.tilePixelRatio*Bu,Uu=Ye.tilePixelRatio*so/24,es=Ye.tilePixelRatio*di,Gu=Ye.tilePixelRatio*hi.get("symbol-spacing"),vf=hi.get("text-padding")*Ye.tilePixelRatio,Vu=hi.get("icon-padding")*Ye.tilePixelRatio,xc=hi.get("text-max-angle")/180*Math.PI,_f=hi.get("text-rotation-alignment")==="map"&&hi.get("symbol-placement")!=="point",xf=hi.get("icon-rotation-alignment")==="map"&&hi.get("symbol-placement")!=="point",rs=hi.get("symbol-placement"),bc=Gu/2,ju=hi.get("icon-text-fit");or&&ju!=="none"&&(Ye.allowVerticalPlacement&&mr.vertical&&(ma=ev(or,mr.vertical,ju,hi.get("icon-text-fit-padding"),ya,Bu)),Ao&&(or=ev(or,Ao,ju,hi.get("icon-text-fit-padding"),ya,Bu)));var Gs=function(IS,Ac){Ac.x<0||Ac.x>=8192||Ac.y<0||Ac.y>=8192||function(ci,Wo,CS,Vs,Nm,Pv,Mf,ga,If,Pc,Cf,Af,Fm,Lv,Lc,kv,Rv,zv,Dv,Ov,lo,Pf,Nv,va,AS){var Fv,Dl,Zu,Xu,Yu,Ju=ci.addToLineVertexArray(Wo,CS),Bv=0,Uv=0,Gv=0,Vv=0,Bm=-1,Um=-1,is={},jv=lt(""),Gm=0,Vm=0;if(ga._unevaluatedLayout.getValue("text-radial-offset")===void 0?(Gm=(Fv=ga.layout.get("text-offset").evaluate(lo,{},va).map(function(Rc){return 24*Rc}))[0],Vm=Fv[1]):(Gm=24*ga.layout.get("text-radial-offset").evaluate(lo,{},va),Vm=Im),ci.allowVerticalPlacement&&Vs.vertical){var qv=ga.layout.get("text-rotate").evaluate(lo,{},va)+90;Xu=new ff(If,Wo,Pc,Cf,Af,Vs.vertical,Fm,Lv,Lc,qv),Mf&&(Yu=new ff(If,Wo,Pc,Cf,Af,Mf,Rv,zv,Lc,qv))}if(Nm){var jm=ga.layout.get("icon-rotate").evaluate(lo,{}),Wv=ga.layout.get("icon-text-fit")!=="none",Kv=uv(Nm,jm,Nv,Wv),qm=Mf?uv(Mf,jm,Nv,Wv):void 0;Zu=new ff(If,Wo,Pc,Cf,Af,Nm,Rv,zv,!1,jm),Bv=4*Kv.length;var Hv=ci.iconSizeData,kc=null;Hv.kind==="source"?(kc=[128*ga.layout.get("icon-size").evaluate(lo,{})])[0]>32640&&Le(ci.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):Hv.kind==="composite"&&((kc=[128*Pf.compositeIconSizes[0].evaluate(lo,{},va),128*Pf.compositeIconSizes[1].evaluate(lo,{},va)])[0]>32640||kc[1]>32640)&&Le(ci.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),ci.addSymbols(ci.icon,Kv,kc,Ov,Dv,lo,!1,Wo,Ju.lineStartIndex,Ju.lineLength,-1,va),Bm=ci.icon.placedSymbolArray.length-1,qm&&(Uv=4*qm.length,ci.addSymbols(ci.icon,qm,kc,Ov,Dv,lo,ao.vertical,Wo,Ju.lineStartIndex,Ju.lineLength,-1,va),Um=ci.icon.placedSymbolArray.length-1)}for(var Zv in Vs.horizontal){var Lf=Vs.horizontal[Zv];if(!Dl){jv=lt(Lf.text);var PS=ga.layout.get("text-rotate").evaluate(lo,{},va);Dl=new ff(If,Wo,Pc,Cf,Af,Lf,Fm,Lv,Lc,PS)}var Xv=Lf.positionedLines.length===1;if(Gv+=pv(ci,Wo,Lf,Pv,ga,Lc,lo,kv,Ju,Vs.vertical?ao.horizontal:ao.horizontalOnly,Xv?Object.keys(Vs.horizontal):[Zv],is,Bm,Pf,va),Xv)break}Vs.vertical&&(Vv+=pv(ci,Wo,Vs.vertical,Pv,ga,Lc,lo,kv,Ju,ao.vertical,["vertical"],is,Um,Pf,va));var LS=Dl?Dl.boxStartIndex:ci.collisionBoxArray.length,kS=Dl?Dl.boxEndIndex:ci.collisionBoxArray.length,RS=Xu?Xu.boxStartIndex:ci.collisionBoxArray.length,zS=Xu?Xu.boxEndIndex:ci.collisionBoxArray.length,DS=Zu?Zu.boxStartIndex:ci.collisionBoxArray.length,OS=Zu?Zu.boxEndIndex:ci.collisionBoxArray.length,NS=Yu?Yu.boxStartIndex:ci.collisionBoxArray.length,FS=Yu?Yu.boxEndIndex:ci.collisionBoxArray.length,_a=-1,kf=function(Rc,Jv){return Rc&&Rc.circleDiameter?Math.max(Rc.circleDiameter,Jv):Jv};_a=kf(Dl,_a),_a=kf(Xu,_a),_a=kf(Zu,_a);var Yv=(_a=kf(Yu,_a))>-1?1:0;Yv&&(_a*=AS/24),ci.glyphOffsetArray.length>=vr.MAX_GLYPHS&&Le("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),lo.sortKey!==void 0&&ci.addToSortKeyRanges(ci.symbolInstances.length,lo.sortKey),ci.symbolInstances.emplaceBack(Wo.x,Wo.y,is.right>=0?is.right:-1,is.center>=0?is.center:-1,is.left>=0?is.left:-1,is.vertical||-1,Bm,Um,jv,LS,kS,RS,zS,DS,OS,NS,FS,Pc,Gv,Vv,Bv,Uv,Yv,0,Fm,Gm,Vm,_a)}(Ye,Ac,IS,mr,or,In,ma,Ye.layers[0],Ye.collisionBoxArray,Sr.index,Sr.sourceLayerIndex,Ye.index,Rl,vf,_f,nn,es,Vu,xf,ya,Sr,rn,lr,da,Fr)};if(rs==="line")for(var qu=0,bf=lv(Sr.geometry,0,0,8192,8192);qu<bf.length;qu+=1)for(var wf=bf[qu],wc=0,Sc=hS(wf,Gu,xc,mr.vertical||Ao,or,24,Uu,Ye.overscaling,8192);wc<Sc.length;wc+=1){var Sf=Sc[wc];Ao&&dS(Ye,Ao.text,bc,Sf)||Gs(wf,Sf)}else if(rs==="line-center")for(var Ec=0,Tc=Sr.geometry;Ec<Tc.length;Ec+=1){var Mc=Tc[Ec];if(Mc.length>1){var Ef=uS(Mc,xc,mr.vertical||Ao,or,24,Uu);Ef&&Gs(Mc,Ef)}}else if(Sr.type==="Polygon")for(var Wu=0,Tf=xm(Sr.geometry,0);Wu<Tf.length;Wu+=1){var Ku=Tf[Wu],Ic=pS(Ku,16);Gs(Ku[0],new ku(Ic.x,Ic.y,0))}else if(Sr.type==="LineString")for(var zl=0,Cc=Sr.geometry;zl<Cc.length;zl+=1){var Hu=Cc[zl];Gs(Hu,new ku(Hu[0].x,Hu[0].y,0))}else if(Sr.type==="Point")for(var zm=0,Cv=Sr.geometry;zm<Cv.length;zm+=1)for(var Dm=0,Av=Cv[zm];Dm<Av.length;Dm+=1){var Om=Av[Dm];Gs([Om],new ku(Om.x,Om.y,0))}}(t,Et,Qt,ji,h,I,Xt,de,ee,mn,g)},xt=0,St=t.features;xt<St.length;xt+=1)vt();d&&t.generateCollisionDebugBuffers()},i.perspective=function(t,e,o,h,f){var d,g=1/Math.tan(e/2);return t[0]=g/o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=g,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,f!=null&&f!==1/0?(t[10]=(f+h)*(d=1/(h-f)),t[14]=2*f*h*d):(t[10]=-1,t[14]=-2*h),t},i.pick=function(t,e){for(var o={},h=0;h<e.length;h++){var f=e[h];f in t&&(o[f]=t[f])}return o},i.plugin=Zr,i.polygonIntersectsPolygon=cn,i.postMapLoadEvent=qe,i.postTurnstileEvent=ye,i.potpack=Jg,i.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],i.register=oe,i.registerForPluginStateChange=function(t){return t({pluginStatus:Tn,pluginURL:ha}),ec.on("pluginStateChange",t),t},i.renderColorRamp=kg,i.rotate=function(t,e,o){var h=e[0],f=e[1],d=e[2],g=e[3],w=Math.sin(o),T=Math.cos(o);return t[0]=h*T+d*w,t[1]=f*T+g*w,t[2]=h*-w+d*T,t[3]=f*-w+g*T,t},i.rotateX=function(t,e,o){var h=Math.sin(o),f=Math.cos(o),d=e[4],g=e[5],w=e[6],T=e[7],I=e[8],P=e[9],L=e[10],N=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=d*f+I*h,t[5]=g*f+P*h,t[6]=w*f+L*h,t[7]=T*f+N*h,t[8]=I*f-d*h,t[9]=P*f-g*h,t[10]=L*f-w*h,t[11]=N*f-T*h,t},i.rotateZ=function(t,e,o){var h=Math.sin(o),f=Math.cos(o),d=e[0],g=e[1],w=e[2],T=e[3],I=e[4],P=e[5],L=e[6],N=e[7];return e!==t&&(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[0]=d*f+I*h,t[1]=g*f+P*h,t[2]=w*f+L*h,t[3]=T*f+N*h,t[4]=I*f-d*h,t[5]=P*f-g*h,t[6]=L*f-w*h,t[7]=N*f-T*h,t},i.scale=function(t,e,o){var h=o[0],f=o[1],d=o[2];return t[0]=e[0]*h,t[1]=e[1]*h,t[2]=e[2]*h,t[3]=e[3]*h,t[4]=e[4]*f,t[5]=e[5]*f,t[6]=e[6]*f,t[7]=e[7]*f,t[8]=e[8]*d,t[9]=e[9]*d,t[10]=e[10]*d,t[11]=e[11]*d,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},i.scale$1=function(t,e,o){return t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t[3]=e[3]*o,t},i.scale$2=function(t,e,o){return t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t},i.setCacheLimits=function(t,e){Ge=t,Xe=e},i.setRTLTextPlugin=function(t,e,o){if(o===void 0&&(o=!1),Tn==="deferred"||Tn==="loading"||Tn==="loaded")throw new Error("setRTLTextPlugin cannot be called multiple times.");ha=cr.resolveURL(t),Tn="deferred",$h=e,tc(),o||Qp()},i.sphericalToCartesian=function(t){var e=t[0],o=t[1],h=t[2];return o+=90,o*=Math.PI/180,h*=Math.PI/180,{x:e*Math.cos(o)*Math.sin(h),y:e*Math.sin(o)*Math.sin(h),z:e*Math.cos(h)}},i.sqrLen=function(t){var e=t[0],o=t[1];return e*e+o*o},i.styleSpec=X,i.sub=function(t,e,o){return t[0]=e[0]-o[0],t[1]=e[1]-o[1],t[2]=e[2]-o[2],t},i.symbolSize=lS,i.transformMat3=function(t,e,o){var h=e[0],f=e[1],d=e[2];return t[0]=h*o[0]+f*o[3]+d*o[6],t[1]=h*o[1]+f*o[4]+d*o[7],t[2]=h*o[2]+f*o[5]+d*o[8],t},i.transformMat4=Eu,i.translate=function(t,e,o){var h,f,d,g,w,T,I,P,L,N,U,Q,$=o[0],ct=o[1],st=o[2];return e===t?(t[12]=e[0]*$+e[4]*ct+e[8]*st+e[12],t[13]=e[1]*$+e[5]*ct+e[9]*st+e[13],t[14]=e[2]*$+e[6]*ct+e[10]*st+e[14],t[15]=e[3]*$+e[7]*ct+e[11]*st+e[15]):(f=e[1],d=e[2],g=e[3],w=e[4],T=e[5],I=e[6],P=e[7],L=e[8],N=e[9],U=e[10],Q=e[11],t[0]=h=e[0],t[1]=f,t[2]=d,t[3]=g,t[4]=w,t[5]=T,t[6]=I,t[7]=P,t[8]=L,t[9]=N,t[10]=U,t[11]=Q,t[12]=h*$+w*ct+L*st+e[12],t[13]=f*$+T*ct+N*st+e[13],t[14]=d*$+I*ct+U*st+e[14],t[15]=g*$+P*ct+Q*st+e[15]),t},i.triggerPluginCompletionEvent=_u,i.uniqueId=Gt,i.validateCustomStyleLayer=function(t){var e=[],o=t.id;return o===void 0&&e.push({message:"layers."+o+': missing required property "id"'}),t.render===void 0&&e.push({message:"layers."+o+': missing required method "render"'}),t.renderingMode&&t.renderingMode!=="2d"&&t.renderingMode!=="3d"&&e.push({message:"layers."+o+': property "renderingMode" must be either "2d" or "3d"'}),e},i.validateLight=pm,i.validateStyle=yl,i.values=function(t){var e=[];for(var o in t)e.push(t[o]);return e},i.vectorTile=Cu,i.version="1.15.1",i.warnOnce=Le,i.webpSupported=oi,i.window=C,i.wrap=mt}),p(["./shared"],function(i){"use strict";function m(k){var O=typeof k;if(O==="number"||O==="boolean"||O==="string"||k==null)return JSON.stringify(k);if(Array.isArray(k)){for(var B="[",H=0,rt=k;H<rt.length;H+=1)B+=m(rt[H])+",";return B+"]"}for(var pt=Object.keys(k).sort(),gt="{",ht=0;ht<pt.length;ht++)gt+=JSON.stringify(pt[ht])+":"+m(k[pt[ht]])+",";return gt+"}"}function v(k){for(var O="",B=0,H=i.refProperties;B<H.length;B+=1)O+="/"+m(k[H[B]]);return O}var b=function(k){this.keyCache={},k&&this.replace(k)};b.prototype.replace=function(k){this._layerConfigs={},this._layers={},this.update(k,[])},b.prototype.update=function(k,O){for(var B=this,H=0,rt=k;H<rt.length;H+=1){var pt=rt[H];this._layerConfigs[pt.id]=pt;var gt=this._layers[pt.id]=i.createStyleLayer(pt);gt._featureFilter=i.featureFilter(gt.filter),this.keyCache[pt.id]&&delete this.keyCache[pt.id]}for(var ht=0,X=O;ht<X.length;ht+=1){var at=X[ht];delete this.keyCache[at],delete this._layerConfigs[at],delete this._layers[at]}this.familiesBySource={};for(var Ot=0,Wt=function(Jt,Rt){for(var Fe={},Be=0;Be<Jt.length;Be++){var pe=Rt&&Rt[Jt[Be].id]||v(Jt[Be]);Rt&&(Rt[Jt[Be].id]=pe);var Er=Fe[pe];Er||(Er=Fe[pe]=[]),Er.push(Jt[Be])}var Ze=[];for(var Pr in Fe)Ze.push(Fe[Pr]);return Ze}(i.values(this._layerConfigs),this.keyCache);Ot<Wt.length;Ot+=1){var wt=Wt[Ot].map(function(Jt){return B._layers[Jt.id]}),Ft=wt[0];if(Ft.visibility!=="none"){var ne=Ft.source||"",se=this.familiesBySource[ne];se||(se=this.familiesBySource[ne]={});var ge=Ft.sourceLayer||"_geojsonTileLayer",kt=se[ge];kt||(kt=se[ge]=[]),kt.push(wt)}}};var M=function(k){var O={},B=[];for(var H in k){var rt=k[H],pt=O[H]={};for(var gt in rt){var ht=rt[+gt];if(ht&&ht.bitmap.width!==0&&ht.bitmap.height!==0){var X={x:0,y:0,w:ht.bitmap.width+2,h:ht.bitmap.height+2};B.push(X),pt[gt]={rect:X,metrics:ht.metrics}}}}var at=i.potpack(B),Ot=new i.AlphaImage({width:at.w||1,height:at.h||1});for(var Wt in k){var wt=k[Wt];for(var Ft in wt){var ne=wt[+Ft];if(ne&&ne.bitmap.width!==0&&ne.bitmap.height!==0){var se=O[Wt][Ft].rect;i.AlphaImage.copy(ne.bitmap,Ot,{x:0,y:0},{x:se.x+1,y:se.y+1},ne.bitmap)}}}this.image=Ot,this.positions=O};i.register("GlyphAtlas",M);var z=function(k){this.tileID=new i.OverscaledTileID(k.tileID.overscaledZ,k.tileID.wrap,k.tileID.canonical.z,k.tileID.canonical.x,k.tileID.canonical.y),this.uid=k.uid,this.zoom=k.zoom,this.pixelRatio=k.pixelRatio,this.tileSize=k.tileSize,this.source=k.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=k.showCollisionBoxes,this.collectResourceTiming=!!k.collectResourceTiming,this.returnDependencies=!!k.returnDependencies,this.promoteId=k.promoteId};function C(k,O,B){for(var H=new i.EvaluationParameters(O),rt=0,pt=k;rt<pt.length;rt+=1)pt[rt].recalculate(H,B)}function j(k,O){var B=i.getArrayBuffer(k.request,function(H,rt,pt,gt){H?O(H):rt&&O(null,{vectorTile:new i.vectorTile.VectorTile(new i.pbf(rt)),rawData:rt,cacheControl:pt,expires:gt})});return function(){B.cancel(),O()}}z.prototype.parse=function(k,O,B,H,rt){var pt=this;this.status="parsing",this.data=k,this.collisionBoxArray=new i.CollisionBoxArray;var gt=new i.DictionaryCoder(Object.keys(k.layers).sort()),ht=new i.FeatureIndex(this.tileID,this.promoteId);ht.bucketLayerIDs=[];var X,at,Ot,Wt,wt={},Ft={featureIndex:ht,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:B},ne=O.familiesBySource[this.source];for(var se in ne){var ge=k.layers[se];if(ge){ge.version===1&&i.warnOnce('Vector tile source "'+this.source+'" layer "'+se+'" does not use vector tile spec v2 and therefore may have some rendering errors.');for(var kt=gt.encode(se),Jt=[],Rt=0;Rt<ge.length;Rt++){var Fe=ge.feature(Rt),Be=ht.getId(Fe,se);Jt.push({feature:Fe,id:Be,index:Rt,sourceLayerIndex:kt})}for(var pe=0,Er=ne[se];pe<Er.length;pe+=1){var Ze=Er[pe],Pr=Ze[0];Pr.minzoom&&this.zoom<Math.floor(Pr.minzoom)||Pr.maxzoom&&this.zoom>=Pr.maxzoom||Pr.visibility!=="none"&&(C(Ze,this.zoom,B),(wt[Pr.id]=Pr.createBucket({index:ht.bucketLayerIDs.length,layers:Ze,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:kt,sourceID:this.source})).populate(Jt,Ft,this.tileID.canonical),ht.bucketLayerIDs.push(Ze.map(function(Mr){return Mr.id})))}}}var Nr=i.mapObject(Ft.glyphDependencies,function(Mr){return Object.keys(Mr).map(Number)});Object.keys(Nr).length?H.send("getGlyphs",{uid:this.uid,stacks:Nr},function(Mr,Ke){X||(X=Mr,at=Ke,Jr.call(pt))}):at={};var rr=Object.keys(Ft.iconDependencies);rr.length?H.send("getImages",{icons:rr,source:this.source,tileID:this.tileID,type:"icons"},function(Mr,Ke){X||(X=Mr,Ot=Ke,Jr.call(pt))}):Ot={};var Tr=Object.keys(Ft.patternDependencies);function Jr(){if(X)return rt(X);if(at&&Ot&&Wt){var Mr=new M(at),Ke=new i.ImageAtlas(Ot,Wt);for(var Ts in wt){var $e=wt[Ts];$e instanceof i.SymbolBucket?(C($e.layers,this.zoom,B),i.performSymbolLayout($e,at,Mr.positions,Ot,Ke.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):$e.hasPattern&&($e instanceof i.LineBucket||$e instanceof i.FillBucket||$e instanceof i.FillExtrusionBucket)&&(C($e.layers,this.zoom,B),$e.addFeatures(Ft,this.tileID.canonical,Ke.patternPositions))}this.status="done",rt(null,{buckets:i.values(wt).filter(function(za){return!za.isEmpty()}),featureIndex:ht,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Mr.image,imageAtlas:Ke,glyphMap:this.returnDependencies?at:null,iconMap:this.returnDependencies?Ot:null,glyphPositions:this.returnDependencies?Mr.positions:null})}}Tr.length?H.send("getImages",{icons:Tr,source:this.source,tileID:this.tileID,type:"patterns"},function(Mr,Ke){X||(X=Mr,Wt=Ke,Jr.call(pt))}):Wt={},Jr.call(this)};var Y=function(k,O,B,H){this.actor=k,this.layerIndex=O,this.availableImages=B,this.loadVectorData=H||j,this.loading={},this.loaded={}};Y.prototype.loadTile=function(k,O){var B=this,H=k.uid;this.loading||(this.loading={});var rt=!!(k&&k.request&&k.request.collectResourceTiming)&&new i.RequestPerformance(k.request),pt=this.loading[H]=new z(k);pt.abort=this.loadVectorData(k,function(gt,ht){if(delete B.loading[H],gt||!ht)return pt.status="done",B.loaded[H]=pt,O(gt);var X=ht.rawData,at={};ht.expires&&(at.expires=ht.expires),ht.cacheControl&&(at.cacheControl=ht.cacheControl);var Ot={};if(rt){var Wt=rt.finish();Wt&&(Ot.resourceTiming=JSON.parse(JSON.stringify(Wt)))}pt.vectorTile=ht.vectorTile,pt.parse(ht.vectorTile,B.layerIndex,B.availableImages,B.actor,function(wt,Ft){if(wt||!Ft)return O(wt);O(null,i.extend({rawTileData:X.slice(0)},Ft,at,Ot))}),B.loaded=B.loaded||{},B.loaded[H]=pt})},Y.prototype.reloadTile=function(k,O){var B=this,H=this.loaded,rt=k.uid,pt=this;if(H&&H[rt]){var gt=H[rt];gt.showCollisionBoxes=k.showCollisionBoxes;var ht=function(X,at){var Ot=gt.reloadCallback;Ot&&(delete gt.reloadCallback,gt.parse(gt.vectorTile,pt.layerIndex,B.availableImages,pt.actor,Ot)),O(X,at)};gt.status==="parsing"?gt.reloadCallback=ht:gt.status==="done"&&(gt.vectorTile?gt.parse(gt.vectorTile,this.layerIndex,this.availableImages,this.actor,ht):ht())}},Y.prototype.abortTile=function(k,O){var B=this.loading,H=k.uid;B&&B[H]&&B[H].abort&&(B[H].abort(),delete B[H]),O()},Y.prototype.removeTile=function(k,O){var B=this.loaded,H=k.uid;B&&B[H]&&delete B[H],O()};var ot=i.window.ImageBitmap,J=function(){this.loaded={}};function mt(k,O){if(k.length!==0){ft(k[0],O);for(var B=1;B<k.length;B++)ft(k[B],!O)}}function ft(k,O){for(var B=0,H=0,rt=k.length,pt=rt-1;H<rt;pt=H++)B+=(k[H][0]-k[pt][0])*(k[pt][1]+k[H][1]);B>=0!=!!O&&k.reverse()}J.prototype.loadTile=function(k,O){var B=k.uid,H=k.encoding,rt=k.rawImageData,pt=ot&&rt instanceof ot?this.getImageData(rt):rt,gt=new i.DEMData(B,pt,H);this.loaded=this.loaded||{},this.loaded[B]=gt,O(null,gt)},J.prototype.getImageData=function(k){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(k.width,k.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=k.width,this.offscreenCanvas.height=k.height,this.offscreenCanvasContext.drawImage(k,0,0,k.width,k.height);var O=this.offscreenCanvasContext.getImageData(-1,-1,k.width+2,k.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new i.RGBAImage({width:O.width,height:O.height},O.data)},J.prototype.removeTile=function(k){var O=this.loaded,B=k.uid;O&&O[B]&&delete O[B]};var At=i.vectorTile.VectorTileFeature.prototype.toGeoJSON,Gt=function(k){this._feature=k,this.extent=i.EXTENT,this.type=k.type,this.properties=k.tags,"id"in k&&!isNaN(k.id)&&(this.id=parseInt(k.id,10))};Gt.prototype.loadGeometry=function(){if(this._feature.type===1){for(var k=[],O=0,B=this._feature.geometry;O<B.length;O+=1){var H=B[O];k.push([new i.Point$1(H[0],H[1])])}return k}for(var rt=[],pt=0,gt=this._feature.geometry;pt<gt.length;pt+=1){for(var ht=[],X=0,at=gt[pt];X<at.length;X+=1){var Ot=at[X];ht.push(new i.Point$1(Ot[0],Ot[1]))}rt.push(ht)}return rt},Gt.prototype.toGeoJSON=function(k,O,B){return At.call(this,k,O,B)};var Zt=function(k){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=i.EXTENT,this.length=k.length,this._features=k};Zt.prototype.feature=function(k){return new Gt(this._features[k])};var we=i.vectorTile.VectorTileFeature,he=Kt;function Kt(k,O){this.options=O||{},this.features=k,this.length=k.length}function ce(k,O){this.id=typeof k.id=="number"?k.id:void 0,this.type=k.type,this.rawGeometry=k.type===1?[k.geometry]:k.geometry,this.properties=k.tags,this.extent=O||4096}Kt.prototype.feature=function(k){return new ce(this.features[k],this.options.extent)},ce.prototype.loadGeometry=function(){var k=this.rawGeometry;this.geometry=[];for(var O=0;O<k.length;O++){for(var B=k[O],H=[],rt=0;rt<B.length;rt++)H.push(new i.Point$1(B[rt][0],B[rt][1]));this.geometry.push(H)}return this.geometry},ce.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var k=this.geometry,O=1/0,B=-1/0,H=1/0,rt=-1/0,pt=0;pt<k.length;pt++)for(var gt=k[pt],ht=0;ht<gt.length;ht++){var X=gt[ht];O=Math.min(O,X.x),B=Math.max(B,X.x),H=Math.min(H,X.y),rt=Math.max(rt,X.y)}return[O,H,B,rt]},ce.prototype.toGeoJSON=we.prototype.toGeoJSON;var Yt=dr,Te=he;function dr(k){var O=new i.pbf;return function(B,H){for(var rt in B.layers)H.writeMessage(3,Le,B.layers[rt])}(k,O),O.finish()}function Le(k,O){var B;O.writeVarintField(15,k.version||1),O.writeStringField(1,k.name||""),O.writeVarintField(5,k.extent||4096);var H={keys:[],values:[],keycache:{},valuecache:{}};for(B=0;B<k.length;B++)H.feature=k.feature(B),O.writeMessage(2,hr,H);var rt=H.keys;for(B=0;B<rt.length;B++)O.writeStringField(3,rt[B]);var pt=H.values;for(B=0;B<pt.length;B++)O.writeMessage(4,te,pt[B])}function hr(k,O){var B=k.feature;B.id!==void 0&&O.writeVarintField(1,B.id),O.writeMessage(2,Ur,k),O.writeVarintField(3,B.type),O.writeMessage(4,Cr,B)}function Ur(k,O){var B=k.feature,H=k.keys,rt=k.values,pt=k.keycache,gt=k.valuecache;for(var ht in B.properties){var X=pt[ht];X===void 0&&(H.push(ht),pt[ht]=X=H.length-1),O.writeVarint(X);var at=B.properties[ht],Ot=typeof at;Ot!=="string"&&Ot!=="boolean"&&Ot!=="number"&&(at=JSON.stringify(at));var Wt=Ot+":"+at,wt=gt[Wt];wt===void 0&&(rt.push(at),gt[Wt]=wt=rt.length-1),O.writeVarint(wt)}}function Gr(k,O){return(O<<3)+(7&k)}function _n(k){return k<<1^k>>31}function Cr(k,O){for(var B=k.loadGeometry(),H=k.type,rt=0,pt=0,gt=B.length,ht=0;ht<gt;ht++){var X=B[ht],at=1;H===1&&(at=X.length),O.writeVarint(Gr(1,at));for(var Ot=H===3?X.length-1:X.length,Wt=0;Wt<Ot;Wt++){Wt===1&&H!==1&&O.writeVarint(Gr(2,Ot-1));var wt=X[Wt].x-rt,Ft=X[Wt].y-pt;O.writeVarint(_n(wt)),O.writeVarint(_n(Ft)),rt+=wt,pt+=Ft}H===3&&O.writeVarint(Gr(7,1))}}function te(k,O){var B=typeof k;B==="string"?O.writeStringField(1,k):B==="boolean"?O.writeBooleanField(7,k):B==="number"&&(k%1!=0?O.writeDoubleField(3,k):k<0?O.writeSVarintField(6,k):O.writeVarintField(5,k))}function ae(k,O,B,H){me(k,B,H),me(O,2*B,2*H),me(O,2*B+1,2*H+1)}function me(k,O,B){var H=k[O];k[O]=k[B],k[B]=H}function Ne(k,O,B,H){var rt=k-B,pt=O-H;return rt*rt+pt*pt}Yt.fromVectorTileJs=dr,Yt.fromGeojsonVt=function(k,O){O=O||{};var B={};for(var H in k)B[H]=new he(k[H].features,O),B[H].name=H,B[H].version=O.version,B[H].extent=O.extent;return dr({layers:B})},Yt.GeoJSONWrapper=Te;var Qe=function(k){return k[0]},pi=function(k){return k[1]},Ai=function(k,O,B,H,rt){O===void 0&&(O=Qe),B===void 0&&(B=pi),H===void 0&&(H=64),rt===void 0&&(rt=Float64Array),this.nodeSize=H,this.points=k;for(var pt=k.length<65536?Uint16Array:Uint32Array,gt=this.ids=new pt(k.length),ht=this.coords=new rt(2*k.length),X=0;X<k.length;X++)gt[X]=X,ht[2*X]=O(k[X]),ht[2*X+1]=B(k[X]);(function at(Ot,Wt,wt,Ft,ne,se){if(!(ne-Ft<=wt)){var ge=Ft+ne>>1;(function kt(Jt,Rt,Fe,Be,pe,Er){for(;pe>Be;){if(pe-Be>600){var Ze=pe-Be+1,Pr=Fe-Be+1,Nr=Math.log(Ze),rr=.5*Math.exp(2*Nr/3),Tr=.5*Math.sqrt(Nr*rr*(Ze-rr)/Ze)*(Pr-Ze/2<0?-1:1);kt(Jt,Rt,Fe,Math.max(Be,Math.floor(Fe-Pr*rr/Ze+Tr)),Math.min(pe,Math.floor(Fe+(Ze-Pr)*rr/Ze+Tr)),Er)}var Jr=Rt[2*Fe+Er],Mr=Be,Ke=pe;for(ae(Jt,Rt,Be,Fe),Rt[2*pe+Er]>Jr&&ae(Jt,Rt,Be,pe);Mr<Ke;){for(ae(Jt,Rt,Mr,Ke),Mr++,Ke--;Rt[2*Mr+Er]<Jr;)Mr++;for(;Rt[2*Ke+Er]>Jr;)Ke--}Rt[2*Be+Er]===Jr?ae(Jt,Rt,Be,Ke):ae(Jt,Rt,++Ke,pe),Ke<=Fe&&(Be=Ke+1),Fe<=Ke&&(pe=Ke-1)}})(Ot,Wt,ge,Ft,ne,se%2),at(Ot,Wt,wt,Ft,ge-1,se+1),at(Ot,Wt,wt,ge+1,ne,se+1)}})(gt,ht,H,0,gt.length-1,0)};Ai.prototype.range=function(k,O,B,H){return function(rt,pt,gt,ht,X,at,Ot){for(var Wt,wt,Ft=[0,rt.length-1,0],ne=[];Ft.length;){var se=Ft.pop(),ge=Ft.pop(),kt=Ft.pop();if(ge-kt<=Ot)for(var Jt=kt;Jt<=ge;Jt++)wt=pt[2*Jt+1],(Wt=pt[2*Jt])>=gt&&Wt<=X&&wt>=ht&&wt<=at&&ne.push(rt[Jt]);else{var Rt=Math.floor((kt+ge)/2);wt=pt[2*Rt+1],(Wt=pt[2*Rt])>=gt&&Wt<=X&&wt>=ht&&wt<=at&&ne.push(rt[Rt]);var Fe=(se+1)%2;(se===0?gt<=Wt:ht<=wt)&&(Ft.push(kt),Ft.push(Rt-1),Ft.push(Fe)),(se===0?X>=Wt:at>=wt)&&(Ft.push(Rt+1),Ft.push(ge),Ft.push(Fe))}}return ne}(this.ids,this.coords,k,O,B,H,this.nodeSize)},Ai.prototype.within=function(k,O,B){return function(H,rt,pt,gt,ht,X){for(var at=[0,H.length-1,0],Ot=[],Wt=ht*ht;at.length;){var wt=at.pop(),Ft=at.pop(),ne=at.pop();if(Ft-ne<=X)for(var se=ne;se<=Ft;se++)Ne(rt[2*se],rt[2*se+1],pt,gt)<=Wt&&Ot.push(H[se]);else{var ge=Math.floor((ne+Ft)/2),kt=rt[2*ge],Jt=rt[2*ge+1];Ne(kt,Jt,pt,gt)<=Wt&&Ot.push(H[ge]);var Rt=(wt+1)%2;(wt===0?pt-ht<=kt:gt-ht<=Jt)&&(at.push(ne),at.push(ge-1),at.push(Rt)),(wt===0?pt+ht>=kt:gt+ht>=Jt)&&(at.push(ge+1),at.push(Ft),at.push(Rt))}}return Ot}(this.ids,this.coords,k,O,B,this.nodeSize)};var Ji={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(k){return k}},ke=function(k){this.options=Cn(Object.create(Ji),k),this.trees=new Array(this.options.maxZoom+1)};function cr(k,O,B,H,rt){return{x:k,y:O,zoom:1/0,id:B,parentId:-1,numPoints:H,properties:rt}}function We(k,O){var B=k.geometry.coordinates,H=B[1];return{x:Oi(B[0]),y:Ce(H),zoom:1/0,index:O,parentId:-1}}function oi(k){return{type:"Feature",id:k.id,properties:ln(k),geometry:{type:"Point",coordinates:[(H=k.x,360*(H-.5)),(O=k.y,B=(180-360*O)*Math.PI/180,360*Math.atan(Math.exp(B))/Math.PI-90)]}};var O,B,H}function ln(k){var O=k.numPoints,B=O>=1e4?Math.round(O/1e3)+"k":O>=1e3?Math.round(O/100)/10+"k":O;return Cn(Cn({},k.properties),{cluster:!0,cluster_id:k.id,point_count:O,point_count_abbreviated:B})}function Oi(k){return k/360+.5}function Ce(k){var O=Math.sin(k*Math.PI/180),B=.5-.25*Math.log((1+O)/(1-O))/Math.PI;return B<0?0:B>1?1:B}function Cn(k,O){for(var B in O)k[B]=O[B];return k}function Ar(k){return k.x}function Ki(k){return k.y}function zo(k,O,B,H,rt,pt){var gt=rt-B,ht=pt-H;if(gt!==0||ht!==0){var X=((k-B)*gt+(O-H)*ht)/(gt*gt+ht*ht);X>1?(B=rt,H=pt):X>0&&(B+=gt*X,H+=ht*X)}return(gt=k-B)*gt+(ht=O-H)*ht}function Qi(k,O,B,H){var rt={id:k===void 0?null:k,type:O,geometry:B,tags:H,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(pt){var gt=pt.geometry,ht=pt.type;if(ht==="Point"||ht==="MultiPoint"||ht==="LineString")bt(pt,gt);else if(ht==="Polygon"||ht==="MultiLineString")for(var X=0;X<gt.length;X++)bt(pt,gt[X]);else if(ht==="MultiPolygon")for(X=0;X<gt.length;X++)for(var at=0;at<gt[X].length;at++)bt(pt,gt[X][at])}(rt),rt}function bt(k,O){for(var B=0;B<O.length;B+=3)k.minX=Math.min(k.minX,O[B]),k.minY=Math.min(k.minY,O[B+1]),k.maxX=Math.max(k.maxX,O[B]),k.maxY=Math.max(k.maxY,O[B+1])}function q(k,O,B,H){if(O.geometry){var rt=O.geometry.coordinates,pt=O.geometry.type,gt=Math.pow(B.tolerance/((1<<B.maxZoom)*B.extent),2),ht=[],X=O.id;if(B.promoteId?X=O.properties[B.promoteId]:B.generateId&&(X=H||0),pt==="Point")F(rt,ht);else if(pt==="MultiPoint")for(var at=0;at<rt.length;at++)F(rt[at],ht);else if(pt==="LineString")W(rt,ht,gt,!1);else if(pt==="MultiLineString"){if(B.lineMetrics){for(at=0;at<rt.length;at++)W(rt[at],ht=[],gt,!1),k.push(Qi(X,"LineString",ht,O.properties));return}nt(rt,ht,gt,!1)}else if(pt==="Polygon")nt(rt,ht,gt,!0);else{if(pt!=="MultiPolygon"){if(pt==="GeometryCollection"){for(at=0;at<O.geometry.geometries.length;at++)q(k,{id:X,geometry:O.geometry.geometries[at],properties:O.properties},B,H);return}throw new Error("Input data is not a valid GeoJSON object.")}for(at=0;at<rt.length;at++){var Ot=[];nt(rt[at],Ot,gt,!0),ht.push(Ot)}}k.push(Qi(X,pt,ht,O.properties))}}function F(k,O){O.push(dt(k[0])),O.push(Mt(k[1])),O.push(0)}function W(k,O,B,H){for(var rt,pt,gt=0,ht=0;ht<k.length;ht++){var X=dt(k[ht][0]),at=Mt(k[ht][1]);O.push(X),O.push(at),O.push(0),ht>0&&(gt+=H?(rt*at-X*pt)/2:Math.sqrt(Math.pow(X-rt,2)+Math.pow(at-pt,2))),rt=X,pt=at}var Ot=O.length-3;O[2]=1,function Wt(wt,Ft,ne,se){for(var ge,kt=se,Jt=ne-Ft>>1,Rt=ne-Ft,Fe=wt[Ft],Be=wt[Ft+1],pe=wt[ne],Er=wt[ne+1],Ze=Ft+3;Ze<ne;Ze+=3){var Pr=zo(wt[Ze],wt[Ze+1],Fe,Be,pe,Er);if(Pr>kt)ge=Ze,kt=Pr;else if(Pr===kt){var Nr=Math.abs(Ze-Jt);Nr<Rt&&(ge=Ze,Rt=Nr)}}kt>se&&(ge-Ft>3&&Wt(wt,Ft,ge,se),wt[ge+2]=kt,ne-ge>3&&Wt(wt,ge,ne,se))}(O,0,Ot,B),O[Ot+2]=1,O.size=Math.abs(gt),O.start=0,O.end=O.size}function nt(k,O,B,H){for(var rt=0;rt<k.length;rt++){var pt=[];W(k[rt],pt,B,H),O.push(pt)}}function dt(k){return k/360+.5}function Mt(k){var O=Math.sin(k*Math.PI/180),B=.5-.25*Math.log((1+O)/(1-O))/Math.PI;return B<0?0:B>1?1:B}function Dt(k,O,B,H,rt,pt,gt,ht){if(H/=O,pt>=(B/=O)&><H)return k;if(gt<B||pt>=H)return null;for(var X=[],at=0;at<k.length;at++){var Ot=k[at],Wt=Ot.geometry,wt=Ot.type,Ft=rt===0?Ot.minX:Ot.minY,ne=rt===0?Ot.maxX:Ot.maxY;if(Ft>=B&&ne<H)X.push(Ot);else if(!(ne<B||Ft>=H)){var se=[];if(wt==="Point"||wt==="MultiPoint")Vt(Wt,se,B,H,rt);else if(wt==="LineString")ye(Wt,se,B,H,rt,!1,ht.lineMetrics);else if(wt==="MultiLineString")qe(Wt,se,B,H,rt,!1);else if(wt==="Polygon")qe(Wt,se,B,H,rt,!0);else if(wt==="MultiPolygon")for(var ge=0;ge<Wt.length;ge++){var kt=[];qe(Wt[ge],kt,B,H,rt,!0),kt.length&&se.push(kt)}if(se.length){if(ht.lineMetrics&&wt==="LineString"){for(ge=0;ge<se.length;ge++)X.push(Qi(Ot.id,wt,se[ge],Ot.tags));continue}wt!=="LineString"&&wt!=="MultiLineString"||(se.length===1?(wt="LineString",se=se[0]):wt="MultiLineString"),wt!=="Point"&&wt!=="MultiPoint"||(wt=se.length===3?"Point":"MultiPoint"),X.push(Qi(Ot.id,wt,se,Ot.tags))}}}return X.length?X:null}function Vt(k,O,B,H,rt){for(var pt=0;pt<k.length;pt+=3){var gt=k[pt+rt];gt>=B&><=H&&(O.push(k[pt]),O.push(k[pt+1]),O.push(k[pt+2]))}}function ye(k,O,B,H,rt,pt,gt){for(var ht,X,at=Ae(k),Ot=rt===0?Xe:yr,Wt=k.start,wt=0;wt<k.length-3;wt+=3){var Ft=k[wt],ne=k[wt+1],se=k[wt+2],ge=k[wt+3],kt=k[wt+4],Jt=rt===0?Ft:ne,Rt=rt===0?ge:kt,Fe=!1;gt&&(ht=Math.sqrt(Math.pow(Ft-ge,2)+Math.pow(ne-kt,2))),Jt<B?Rt>B&&(X=Ot(at,Ft,ne,ge,kt,B),gt&&(at.start=Wt+ht*X)):Jt>H?Rt<H&&(X=Ot(at,Ft,ne,ge,kt,H),gt&&(at.start=Wt+ht*X)):Ge(at,Ft,ne,se),Rt<B&&Jt>=B&&(X=Ot(at,Ft,ne,ge,kt,B),Fe=!0),Rt>H&&Jt<=H&&(X=Ot(at,Ft,ne,ge,kt,H),Fe=!0),!pt&&Fe&&(gt&&(at.end=Wt+ht*X),O.push(at),at=Ae(k)),gt&&(Wt+=ht)}var Be=k.length-3;Ft=k[Be],ne=k[Be+1],se=k[Be+2],(Jt=rt===0?Ft:ne)>=B&&Jt<=H&&Ge(at,Ft,ne,se),Be=at.length-3,pt&&Be>=3&&(at[Be]!==at[0]||at[Be+1]!==at[1])&&Ge(at,at[0],at[1],at[2]),at.length&&O.push(at)}function Ae(k){var O=[];return O.size=k.size,O.start=k.start,O.end=k.end,O}function qe(k,O,B,H,rt,pt){for(var gt=0;gt<k.length;gt++)ye(k[gt],O,B,H,rt,pt,!1)}function Ge(k,O,B,H){k.push(O),k.push(B),k.push(H)}function Xe(k,O,B,H,rt,pt){var gt=(pt-O)/(H-O);return k.push(pt),k.push(B+(rt-B)*gt),k.push(1),gt}function yr(k,O,B,H,rt,pt){var gt=(pt-B)/(rt-B);return k.push(O+(H-O)*gt),k.push(pt),k.push(1),gt}function ar(k,O){for(var B=[],H=0;H<k.length;H++){var rt,pt=k[H],gt=pt.type;if(gt==="Point"||gt==="MultiPoint"||gt==="LineString")rt=ur(pt.geometry,O);else if(gt==="MultiLineString"||gt==="Polygon"){rt=[];for(var ht=0;ht<pt.geometry.length;ht++)rt.push(ur(pt.geometry[ht],O))}else if(gt==="MultiPolygon")for(rt=[],ht=0;ht<pt.geometry.length;ht++){for(var X=[],at=0;at<pt.geometry[ht].length;at++)X.push(ur(pt.geometry[ht][at],O));rt.push(X)}B.push(Qi(pt.id,gt,rt,pt.tags))}return B}function ur(k,O){var B=[];B.size=k.size,k.start!==void 0&&(B.start=k.start,B.end=k.end);for(var H=0;H<k.length;H+=3)B.push(k[H]+O,k[H+1],k[H+2]);return B}function $r(k,O){if(k.transformed)return k;var B,H,rt,pt=1<<k.z,gt=k.x,ht=k.y;for(B=0;B<k.features.length;B++){var X=k.features[B],at=X.geometry,Ot=X.type;if(X.geometry=[],Ot===1)for(H=0;H<at.length;H+=2)X.geometry.push(Vr(at[H],at[H+1],O,pt,gt,ht));else for(H=0;H<at.length;H++){var Wt=[];for(rt=0;rt<at[H].length;rt+=2)Wt.push(Vr(at[H][rt],at[H][rt+1],O,pt,gt,ht));X.geometry.push(Wt)}}return k.transformed=!0,k}function Vr(k,O,B,H,rt,pt){return[Math.round(B*(k*H-rt)),Math.round(B*(O*H-pt))]}function yi(k,O,B,H,rt){for(var pt=O===rt.maxZoom?0:rt.tolerance/((1<<O)*rt.extent),gt={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:B,y:H,z:O,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},ht=0;ht<k.length;ht++){gt.numFeatures++,Yr(gt,k[ht],pt,rt);var X=k[ht].minX,at=k[ht].minY,Ot=k[ht].maxX,Wt=k[ht].maxY;X<gt.minX&&(gt.minX=X),at<gt.minY&&(gt.minY=at),Ot>gt.maxX&&(gt.maxX=Ot),Wt>gt.maxY&&(gt.maxY=Wt)}return gt}function Yr(k,O,B,H){var rt=O.geometry,pt=O.type,gt=[];if(pt==="Point"||pt==="MultiPoint")for(var ht=0;ht<rt.length;ht+=3)gt.push(rt[ht]),gt.push(rt[ht+1]),k.numPoints++,k.numSimplified++;else if(pt==="LineString")gi(gt,rt,k,B,!1,!1);else if(pt==="MultiLineString"||pt==="Polygon")for(ht=0;ht<rt.length;ht++)gi(gt,rt[ht],k,B,pt==="Polygon",ht===0);else if(pt==="MultiPolygon")for(var X=0;X<rt.length;X++){var at=rt[X];for(ht=0;ht<at.length;ht++)gi(gt,at[ht],k,B,!0,ht===0)}if(gt.length){var Ot=O.tags||null;if(pt==="LineString"&&H.lineMetrics){for(var Wt in Ot={},O.tags)Ot[Wt]=O.tags[Wt];Ot.mapbox_clip_start=rt.start/rt.size,Ot.mapbox_clip_end=rt.end/rt.size}var wt={geometry:gt,type:pt==="Polygon"||pt==="MultiPolygon"?3:pt==="LineString"||pt==="MultiLineString"?2:1,tags:Ot};O.id!==null&&(wt.id=O.id),k.features.push(wt)}}function gi(k,O,B,H,rt,pt){var gt=H*H;if(H>0&&O.size<(rt?gt:H))B.numPoints+=O.length/3;else{for(var ht=[],X=0;X<O.length;X+=3)(H===0||O[X+2]>gt)&&(B.numSimplified++,ht.push(O[X]),ht.push(O[X+1])),B.numPoints++;rt&&function(at,Ot){for(var Wt=0,wt=0,Ft=at.length,ne=Ft-2;wt<Ft;ne=wt,wt+=2)Wt+=(at[wt]-at[ne])*(at[wt+1]+at[ne+1]);if(Wt>0===Ot)for(wt=0,Ft=at.length;wt<Ft/2;wt+=2){var se=at[wt],ge=at[wt+1];at[wt]=at[Ft-2-wt],at[wt+1]=at[Ft-1-wt],at[Ft-2-wt]=se,at[Ft-1-wt]=ge}}(ht,pt),k.push(ht)}}function An(k,O){var B=(O=this.options=function(rt,pt){for(var gt in pt)rt[gt]=pt[gt];return rt}(Object.create(this.options),O)).debug;if(B&&console.time("preprocess data"),O.maxZoom<0||O.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(O.promoteId&&O.generateId)throw new Error("promoteId and generateId cannot be used together.");var H=function(rt,pt){var gt=[];if(rt.type==="FeatureCollection")for(var ht=0;ht<rt.features.length;ht++)q(gt,rt.features[ht],pt,ht);else q(gt,rt.type==="Feature"?rt:{geometry:rt},pt);return gt}(k,O);this.tiles={},this.tileCoords=[],B&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",O.indexMaxZoom,O.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(H=function(rt,pt){var gt=pt.buffer/pt.extent,ht=rt,X=Dt(rt,1,-1-gt,gt,0,-1,2,pt),at=Dt(rt,1,1-gt,2+gt,0,-1,2,pt);return(X||at)&&(ht=Dt(rt,1,-gt,1+gt,0,-1,2,pt)||[],X&&(ht=ar(X,1).concat(ht)),at&&(ht=ht.concat(ar(at,-1)))),ht}(H,O)).length&&this.splitTile(H,0,0,0),B&&(H.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)))}function Ni(k,O,B){return 32*((1<<k)*B+O)+k}function Hi(k,O){var B=k.tileID.canonical;if(!this._geoJSONIndex)return O(null,null);var H=this._geoJSONIndex.getTile(B.z,B.x,B.y);if(!H)return O(null,null);var rt=new Zt(H.features),pt=Yt(rt);pt.byteOffset===0&&pt.byteLength===pt.buffer.byteLength||(pt=new Uint8Array(pt)),O(null,{vectorTile:rt,rawData:pt.buffer})}ke.prototype.load=function(k){var O=this.options,B=O.log,H=O.minZoom,rt=O.maxZoom,pt=O.nodeSize;B&&console.time("total time");var gt="prepare "+k.length+" points";B&&console.time(gt),this.points=k;for(var ht=[],X=0;X<k.length;X++)k[X].geometry&&ht.push(We(k[X],X));this.trees[rt+1]=new Ai(ht,Ar,Ki,pt,Float32Array),B&&console.timeEnd(gt);for(var at=rt;at>=H;at--){var Ot=+Date.now();ht=this._cluster(ht,at),this.trees[at]=new Ai(ht,Ar,Ki,pt,Float32Array),B&&console.log("z%d: %d clusters in %dms",at,ht.length,+Date.now()-Ot)}return B&&console.timeEnd("total time"),this},ke.prototype.getClusters=function(k,O){var B=((k[0]+180)%360+360)%360-180,H=Math.max(-90,Math.min(90,k[1])),rt=k[2]===180?180:((k[2]+180)%360+360)%360-180,pt=Math.max(-90,Math.min(90,k[3]));if(k[2]-k[0]>=360)B=-180,rt=180;else if(B>rt){var gt=this.getClusters([B,H,180,pt],O),ht=this.getClusters([-180,H,rt,pt],O);return gt.concat(ht)}for(var X=this.trees[this._limitZoom(O)],at=[],Ot=0,Wt=X.range(Oi(B),Ce(pt),Oi(rt),Ce(H));Ot<Wt.length;Ot+=1){var wt=X.points[Wt[Ot]];at.push(wt.numPoints?oi(wt):this.points[wt.index])}return at},ke.prototype.getChildren=function(k){var O=this._getOriginId(k),B=this._getOriginZoom(k),H="No cluster with the specified id.",rt=this.trees[B];if(!rt)throw new Error(H);var pt=rt.points[O];if(!pt)throw new Error(H);for(var gt=this.options.radius/(this.options.extent*Math.pow(2,B-1)),ht=[],X=0,at=rt.within(pt.x,pt.y,gt);X<at.length;X+=1){var Ot=rt.points[at[X]];Ot.parentId===k&&ht.push(Ot.numPoints?oi(Ot):this.points[Ot.index])}if(ht.length===0)throw new Error(H);return ht},ke.prototype.getLeaves=function(k,O,B){var H=[];return this._appendLeaves(H,k,O=O||10,B=B||0,0),H},ke.prototype.getTile=function(k,O,B){var H=this.trees[this._limitZoom(k)],rt=Math.pow(2,k),pt=this.options,gt=pt.radius/pt.extent,ht=(B-gt)/rt,X=(B+1+gt)/rt,at={features:[]};return this._addTileFeatures(H.range((O-gt)/rt,ht,(O+1+gt)/rt,X),H.points,O,B,rt,at),O===0&&this._addTileFeatures(H.range(1-gt/rt,ht,1,X),H.points,rt,B,rt,at),O===rt-1&&this._addTileFeatures(H.range(0,ht,gt/rt,X),H.points,-1,B,rt,at),at.features.length?at:null},ke.prototype.getClusterExpansionZoom=function(k){for(var O=this._getOriginZoom(k)-1;O<=this.options.maxZoom;){var B=this.getChildren(k);if(O++,B.length!==1)break;k=B[0].properties.cluster_id}return O},ke.prototype._appendLeaves=function(k,O,B,H,rt){for(var pt=0,gt=this.getChildren(O);pt<gt.length;pt+=1){var ht=gt[pt],X=ht.properties;if(X&&X.cluster?rt+X.point_count<=H?rt+=X.point_count:rt=this._appendLeaves(k,X.cluster_id,B,H,rt):rt<H?rt++:k.push(ht),k.length===B)break}return rt},ke.prototype._addTileFeatures=function(k,O,B,H,rt,pt){for(var gt=0,ht=k;gt<ht.length;gt+=1){var X=O[ht[gt]],at=X.numPoints,Ot={type:1,geometry:[[Math.round(this.options.extent*(X.x*rt-B)),Math.round(this.options.extent*(X.y*rt-H))]],tags:at?ln(X):this.points[X.index].properties},Wt=void 0;at?Wt=X.id:this.options.generateId?Wt=X.index:this.points[X.index].id&&(Wt=this.points[X.index].id),Wt!==void 0&&(Ot.id=Wt),pt.features.push(Ot)}},ke.prototype._limitZoom=function(k){return Math.max(this.options.minZoom,Math.min(+k,this.options.maxZoom+1))},ke.prototype._cluster=function(k,O){for(var B=[],H=this.options,rt=H.reduce,pt=H.minPoints,gt=H.radius/(H.extent*Math.pow(2,O)),ht=0;ht<k.length;ht++){var X=k[ht];if(!(X.zoom<=O)){X.zoom=O;for(var at=this.trees[O+1],Ot=at.within(X.x,X.y,gt),Wt=X.numPoints||1,wt=Wt,Ft=0,ne=Ot;Ft<ne.length;Ft+=1){var se=at.points[ne[Ft]];se.zoom>O&&(wt+=se.numPoints||1)}if(wt>=pt){for(var ge=X.x*Wt,kt=X.y*Wt,Jt=rt&&Wt>1?this._map(X,!0):null,Rt=(ht<<5)+(O+1)+this.points.length,Fe=0,Be=Ot;Fe<Be.length;Fe+=1){var pe=at.points[Be[Fe]];if(!(pe.zoom<=O)){pe.zoom=O;var Er=pe.numPoints||1;ge+=pe.x*Er,kt+=pe.y*Er,pe.parentId=Rt,rt&&(Jt||(Jt=this._map(X,!0)),rt(Jt,this._map(pe)))}}X.parentId=Rt,B.push(cr(ge/wt,kt/wt,Rt,wt,Jt))}else if(B.push(X),wt>1)for(var Ze=0,Pr=Ot;Ze<Pr.length;Ze+=1){var Nr=at.points[Pr[Ze]];Nr.zoom<=O||(Nr.zoom=O,B.push(Nr))}}}return B},ke.prototype._getOriginId=function(k){return k-this.points.length>>5},ke.prototype._getOriginZoom=function(k){return(k-this.points.length)%32},ke.prototype._map=function(k,O){if(k.numPoints)return O?Cn({},k.properties):k.properties;var B=this.points[k.index].properties,H=this.options.map(B);return O&&H===B?Cn({},H):H},An.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},An.prototype.splitTile=function(k,O,B,H,rt,pt,gt){for(var ht=[k,O,B,H],X=this.options,at=X.debug;ht.length;){H=ht.pop(),B=ht.pop(),O=ht.pop(),k=ht.pop();var Ot=1<<O,Wt=Ni(O,B,H),wt=this.tiles[Wt];if(!wt&&(at>1&&console.time("creation"),wt=this.tiles[Wt]=yi(k,O,B,H,X),this.tileCoords.push({z:O,x:B,y:H}),at)){at>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",O,B,H,wt.numFeatures,wt.numPoints,wt.numSimplified),console.timeEnd("creation"));var Ft="z"+O;this.stats[Ft]=(this.stats[Ft]||0)+1,this.total++}if(wt.source=k,rt){if(O===X.maxZoom||O===rt)continue;var ne=1<<rt-O;if(B!==Math.floor(pt/ne)||H!==Math.floor(gt/ne))continue}else if(O===X.indexMaxZoom||wt.numPoints<=X.indexMaxPoints)continue;if(wt.source=null,k.length!==0){at>1&&console.time("clipping");var se,ge,kt,Jt,Rt,Fe,Be=.5*X.buffer/X.extent,pe=.5-Be,Er=.5+Be,Ze=1+Be;se=ge=kt=Jt=null,Rt=Dt(k,Ot,B-Be,B+Er,0,wt.minX,wt.maxX,X),Fe=Dt(k,Ot,B+pe,B+Ze,0,wt.minX,wt.maxX,X),k=null,Rt&&(se=Dt(Rt,Ot,H-Be,H+Er,1,wt.minY,wt.maxY,X),ge=Dt(Rt,Ot,H+pe,H+Ze,1,wt.minY,wt.maxY,X),Rt=null),Fe&&(kt=Dt(Fe,Ot,H-Be,H+Er,1,wt.minY,wt.maxY,X),Jt=Dt(Fe,Ot,H+pe,H+Ze,1,wt.minY,wt.maxY,X),Fe=null),at>1&&console.timeEnd("clipping"),ht.push(se||[],O+1,2*B,2*H),ht.push(ge||[],O+1,2*B,2*H+1),ht.push(kt||[],O+1,2*B+1,2*H),ht.push(Jt||[],O+1,2*B+1,2*H+1)}}},An.prototype.getTile=function(k,O,B){var H=this.options,rt=H.extent,pt=H.debug;if(k<0||k>24)return null;var gt=1<<k,ht=Ni(k,O=(O%gt+gt)%gt,B);if(this.tiles[ht])return $r(this.tiles[ht],rt);pt>1&&console.log("drilling down to z%d-%d-%d",k,O,B);for(var X,at=k,Ot=O,Wt=B;!X&&at>0;)at--,Ot=Math.floor(Ot/2),Wt=Math.floor(Wt/2),X=this.tiles[Ni(at,Ot,Wt)];return X&&X.source?(pt>1&&console.log("found parent tile z%d-%d-%d",at,Ot,Wt),pt>1&&console.time("drilling down"),this.splitTile(X.source,at,Ot,Wt,k,O,B),pt>1&&console.timeEnd("drilling down"),this.tiles[ht]?$r(this.tiles[ht],rt):null):null};var vi=function(k){function O(B,H,rt,pt){k.call(this,B,H,rt,Hi),pt&&(this.loadGeoJSON=pt)}return k&&(O.__proto__=k),(O.prototype=Object.create(k&&k.prototype)).constructor=O,O.prototype.loadData=function(B,H){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=H,this._pendingLoadDataParams=B,this._state&&this._state!=="Idle"?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},O.prototype._loadData=function(){var B=this;if(this._pendingCallback&&this._pendingLoadDataParams){var H=this._pendingCallback,rt=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var pt=!!(rt&&rt.request&&rt.request.collectResourceTiming)&&new i.RequestPerformance(rt.request);this.loadGeoJSON(rt,function(gt,ht){if(gt||!ht)return H(gt);if(typeof ht!="object")return H(new Error("Input data given to '"+rt.source+"' is not a valid GeoJSON object."));(function wt(Ft,ne){var se,ge=Ft&&Ft.type;if(ge==="FeatureCollection")for(se=0;se<Ft.features.length;se++)wt(Ft.features[se],ne);else if(ge==="GeometryCollection")for(se=0;se<Ft.geometries.length;se++)wt(Ft.geometries[se],ne);else if(ge==="Feature")wt(Ft.geometry,ne);else if(ge==="Polygon")mt(Ft.coordinates,ne);else if(ge==="MultiPolygon")for(se=0;se<Ft.coordinates.length;se++)mt(Ft.coordinates[se],ne);return Ft})(ht,!0);try{if(rt.filter){var X=i.createExpression(rt.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(X.result==="error")throw new Error(X.value.map(function(wt){return wt.key+": "+wt.message}).join(", "));var at=ht.features.filter(function(wt){return X.value.evaluate({zoom:0},wt)});ht={type:"FeatureCollection",features:at}}B._geoJSONIndex=rt.cluster?new ke(function(wt){var Ft=wt.superclusterOptions,ne=wt.clusterProperties;if(!ne||!Ft)return Ft;for(var se={},ge={},kt={accumulated:null,zoom:0},Jt={properties:null},Rt=Object.keys(ne),Fe=0,Be=Rt;Fe<Be.length;Fe+=1){var pe=Be[Fe],Er=ne[pe],Ze=Er[0],Pr=i.createExpression(Er[1]),Nr=i.createExpression(typeof Ze=="string"?[Ze,["accumulated"],["get",pe]]:Ze);se[pe]=Pr.value,ge[pe]=Nr.value}return Ft.map=function(rr){Jt.properties=rr;for(var Tr={},Jr=0,Mr=Rt;Jr<Mr.length;Jr+=1){var Ke=Mr[Jr];Tr[Ke]=se[Ke].evaluate(kt,Jt)}return Tr},Ft.reduce=function(rr,Tr){Jt.properties=Tr;for(var Jr=0,Mr=Rt;Jr<Mr.length;Jr+=1){var Ke=Mr[Jr];kt.accumulated=rr[Ke],rr[Ke]=ge[Ke].evaluate(kt,Jt)}},Ft}(rt)).load(ht.features):function(wt,Ft){return new An(wt,Ft)}(ht,rt.geojsonVtOptions)}catch(wt){return H(wt)}B.loaded={};var Ot={};if(pt){var Wt=pt.finish();Wt&&(Ot.resourceTiming={},Ot.resourceTiming[rt.source]=JSON.parse(JSON.stringify(Wt)))}H(null,Ot)})}},O.prototype.coalesce=function(){this._state==="Coalescing"?this._state="Idle":this._state==="NeedsLoadData"&&(this._state="Coalescing",this._loadData())},O.prototype.reloadTile=function(B,H){var rt=this.loaded;return rt&&rt[B.uid]?k.prototype.reloadTile.call(this,B,H):this.loadTile(B,H)},O.prototype.loadGeoJSON=function(B,H){if(B.request)i.getJSON(B.request,H);else{if(typeof B.data!="string")return H(new Error("Input data given to '"+B.source+"' is not a valid GeoJSON object."));try{return H(null,JSON.parse(B.data))}catch{return H(new Error("Input data given to '"+B.source+"' is not a valid GeoJSON object."))}}},O.prototype.removeSource=function(B,H){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),H()},O.prototype.getClusterExpansionZoom=function(B,H){try{H(null,this._geoJSONIndex.getClusterExpansionZoom(B.clusterId))}catch(rt){H(rt)}},O.prototype.getClusterChildren=function(B,H){try{H(null,this._geoJSONIndex.getChildren(B.clusterId))}catch(rt){H(rt)}},O.prototype.getClusterLeaves=function(B,H){try{H(null,this._geoJSONIndex.getLeaves(B.clusterId,B.limit,B.offset))}catch(rt){H(rt)}},O}(Y),xr=function(k){var O=this;this.self=k,this.actor=new i.Actor(k,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Y,geojson:vi},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=function(B,H){if(O.workerSourceTypes[B])throw new Error('Worker source with name "'+B+'" already registered.');O.workerSourceTypes[B]=H},this.self.registerRTLTextPlugin=function(B){if(i.plugin.isParsed())throw new Error("RTL text plugin already registered.");i.plugin.applyArabicShaping=B.applyArabicShaping,i.plugin.processBidirectionalText=B.processBidirectionalText,i.plugin.processStyledBidirectionalText=B.processStyledBidirectionalText}};return xr.prototype.setReferrer=function(k,O){this.referrer=O},xr.prototype.setImages=function(k,O,B){for(var H in this.availableImages[k]=O,this.workerSources[k]){var rt=this.workerSources[k][H];for(var pt in rt)rt[pt].availableImages=O}B()},xr.prototype.setLayers=function(k,O,B){this.getLayerIndex(k).replace(O),B()},xr.prototype.updateLayers=function(k,O,B){this.getLayerIndex(k).update(O.layers,O.removedIds),B()},xr.prototype.loadTile=function(k,O,B){this.getWorkerSource(k,O.type,O.source).loadTile(O,B)},xr.prototype.loadDEMTile=function(k,O,B){this.getDEMWorkerSource(k,O.source).loadTile(O,B)},xr.prototype.reloadTile=function(k,O,B){this.getWorkerSource(k,O.type,O.source).reloadTile(O,B)},xr.prototype.abortTile=function(k,O,B){this.getWorkerSource(k,O.type,O.source).abortTile(O,B)},xr.prototype.removeTile=function(k,O,B){this.getWorkerSource(k,O.type,O.source).removeTile(O,B)},xr.prototype.removeDEMTile=function(k,O){this.getDEMWorkerSource(k,O.source).removeTile(O)},xr.prototype.removeSource=function(k,O,B){if(this.workerSources[k]&&this.workerSources[k][O.type]&&this.workerSources[k][O.type][O.source]){var H=this.workerSources[k][O.type][O.source];delete this.workerSources[k][O.type][O.source],H.removeSource!==void 0?H.removeSource(O,B):B()}},xr.prototype.loadWorkerSource=function(k,O,B){try{this.self.importScripts(O.url),B()}catch(H){B(H.toString())}},xr.prototype.syncRTLPluginState=function(k,O,B){try{i.plugin.setState(O);var H=i.plugin.getPluginURL();if(i.plugin.isLoaded()&&!i.plugin.isParsed()&&H!=null){this.self.importScripts(H);var rt=i.plugin.isParsed();B(rt?void 0:new Error("RTL Text Plugin failed to import scripts from "+H),rt)}}catch(pt){B(pt.toString())}},xr.prototype.getAvailableImages=function(k){var O=this.availableImages[k];return O||(O=[]),O},xr.prototype.getLayerIndex=function(k){var O=this.layerIndexes[k];return O||(O=this.layerIndexes[k]=new b),O},xr.prototype.getWorkerSource=function(k,O,B){var H=this;return this.workerSources[k]||(this.workerSources[k]={}),this.workerSources[k][O]||(this.workerSources[k][O]={}),this.workerSources[k][O][B]||(this.workerSources[k][O][B]=new this.workerSourceTypes[O]({send:function(rt,pt,gt){H.actor.send(rt,pt,gt,k)}},this.getLayerIndex(k),this.getAvailableImages(k))),this.workerSources[k][O][B]},xr.prototype.getDEMWorkerSource=function(k,O){return this.demWorkerSources[k]||(this.demWorkerSources[k]={}),this.demWorkerSources[k][O]||(this.demWorkerSources[k][O]=new J),this.demWorkerSources[k][O]},xr.prototype.enforceCacheSizeLimit=function(k,O){i.enforceCacheSizeLimit(O)},typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new xr(self)),xr}),p(["./shared"],function(i){"use strict";var m=i.createCommonjsModule(function(a){function u(y){return!l(y)}function l(y){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var x,S,A=new Blob([""],{type:"text/javascript"}),R=URL.createObjectURL(A);try{S=new Worker(R),x=!0}catch{x=!1}return S&&S.terminate(),URL.revokeObjectURL(R),x}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var x=document.createElement("canvas");x.width=x.height=1;var S=x.getContext("2d");if(!S)return!1;var A=S.getImageData(0,0,1,1);return A&&A.width===x.width}()?(c[_=y&&y.failIfMajorPerformanceCaveat]===void 0&&(c[_]=function(x){var S=function(R){var G=document.createElement("canvas"),Z=Object.create(u.webGLContextAttributes);return Z.failIfMajorPerformanceCaveat=R,G.probablySupportsContext?G.probablySupportsContext("webgl",Z)||G.probablySupportsContext("experimental-webgl",Z):G.supportsContext?G.supportsContext("webgl",Z)||G.supportsContext("experimental-webgl",Z):G.getContext("webgl",Z)||G.getContext("experimental-webgl",Z)}(x);if(!S)return!1;var A=S.createShader(S.VERTEX_SHADER);return!(!A||S.isContextLost())&&(S.shaderSource(A,"void main() {}"),S.compileShader(A),S.getShaderParameter(A,S.COMPILE_STATUS)===!0)}(_)),c[_]?void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var _}a.exports?a.exports=u:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=u,window.mapboxgl.notSupportedReason=l);var c={};u.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}}),v={create:function(a,u,l){var c=i.window.document.createElement(a);return u!==void 0&&(c.className=u),l&&l.appendChild(c),c},createNS:function(a,u){return i.window.document.createElementNS(a,u)}},b=i.window.document&&i.window.document.documentElement.style;function M(a){if(!b)return a[0];for(var u=0;u<a.length;u++)if(a[u]in b)return a[u];return a[0]}var z,C=M(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]);v.disableDrag=function(){b&&C&&(z=b[C],b[C]="none")},v.enableDrag=function(){b&&C&&(b[C]=z)};var j=M(["transform","WebkitTransform"]);v.setTransform=function(a,u){a.style[j]=u};var Y=!1;try{var ot=Object.defineProperty({},"passive",{get:function(){Y=!0}});i.window.addEventListener("test",ot,ot),i.window.removeEventListener("test",ot,ot)}catch{Y=!1}v.addEventListener=function(a,u,l,c){c===void 0&&(c={}),a.addEventListener(u,l,"passive"in c&&Y?c:c.capture)},v.removeEventListener=function(a,u,l,c){c===void 0&&(c={}),a.removeEventListener(u,l,"passive"in c&&Y?c:c.capture)};var J=function(a){a.preventDefault(),a.stopPropagation(),i.window.removeEventListener("click",J,!0)};function mt(a){var u=a.userImage;return!!(u&&u.render&&u.render())&&(a.data.replace(new Uint8Array(u.data.buffer)),!0)}v.suppressClick=function(){i.window.addEventListener("click",J,!0),i.window.setTimeout(function(){i.window.removeEventListener("click",J,!0)},0)},v.mousePos=function(a,u){var l=a.getBoundingClientRect();return new i.Point(u.clientX-l.left-a.clientLeft,u.clientY-l.top-a.clientTop)},v.touchPos=function(a,u){for(var l=a.getBoundingClientRect(),c=[],y=0;y<u.length;y++)c.push(new i.Point(u[y].clientX-l.left-a.clientLeft,u[y].clientY-l.top-a.clientTop));return c},v.mouseButton=function(a){return i.window.InstallTrigger!==void 0&&a.button===2&&a.ctrlKey&&i.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:a.button},v.remove=function(a){a.parentNode&&a.parentNode.removeChild(a)};var ft=function(a){function u(){a.call(this),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new i.RGBAImage({width:1,height:1}),this.dirty=!0}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.isLoaded=function(){return this.loaded},u.prototype.setLoaded=function(l){if(this.loaded!==l&&(this.loaded=l,l)){for(var c=0,y=this.requestors;c<y.length;c+=1){var _=y[c];this._notify(_.ids,_.callback)}this.requestors=[]}},u.prototype.getImage=function(l){return this.images[l]},u.prototype.addImage=function(l,c){this._validate(l,c)&&(this.images[l]=c)},u.prototype._validate=function(l,c){var y=!0;return this._validateStretch(c.stretchX,c.data&&c.data.width)||(this.fire(new i.ErrorEvent(new Error('Image "'+l+'" has invalid "stretchX" value'))),y=!1),this._validateStretch(c.stretchY,c.data&&c.data.height)||(this.fire(new i.ErrorEvent(new Error('Image "'+l+'" has invalid "stretchY" value'))),y=!1),this._validateContent(c.content,c)||(this.fire(new i.ErrorEvent(new Error('Image "'+l+'" has invalid "content" value'))),y=!1),y},u.prototype._validateStretch=function(l,c){if(!l)return!0;for(var y=0,_=0,x=l;_<x.length;_+=1){var S=x[_];if(S[0]<y||S[1]<S[0]||c<S[1])return!1;y=S[1]}return!0},u.prototype._validateContent=function(l,c){return!(l&&(l.length!==4||l[0]<0||c.data.width<l[0]||l[1]<0||c.data.height<l[1]||l[2]<0||c.data.width<l[2]||l[3]<0||c.data.height<l[3]||l[2]<l[0]||l[3]<l[1]))},u.prototype.updateImage=function(l,c){c.version=this.images[l].version+1,this.images[l]=c,this.updatedImages[l]=!0},u.prototype.removeImage=function(l){var c=this.images[l];delete this.images[l],delete this.patterns[l],c.userImage&&c.userImage.onRemove&&c.userImage.onRemove()},u.prototype.listImages=function(){return Object.keys(this.images)},u.prototype.getImages=function(l,c){var y=!0;if(!this.isLoaded())for(var _=0,x=l;_<x.length;_+=1)this.images[x[_]]||(y=!1);this.isLoaded()||y?this._notify(l,c):this.requestors.push({ids:l,callback:c})},u.prototype._notify=function(l,c){for(var y={},_=0,x=l;_<x.length;_+=1){var S=x[_];this.images[S]||this.fire(new i.Event("styleimagemissing",{id:S}));var A=this.images[S];A?y[S]={data:A.data.clone(),pixelRatio:A.pixelRatio,sdf:A.sdf,version:A.version,stretchX:A.stretchX,stretchY:A.stretchY,content:A.content,hasRenderCallback:Boolean(A.userImage&&A.userImage.render)}:i.warnOnce('Image "'+S+'" 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.')}c(null,y)},u.prototype.getPixelSize=function(){var l=this.atlasImage;return{width:l.width,height:l.height}},u.prototype.getPattern=function(l){var c=this.patterns[l],y=this.getImage(l);if(!y)return null;if(c&&c.position.version===y.version)return c.position;if(c)c.position.version=y.version;else{var _={w:y.data.width+2,h:y.data.height+2,x:0,y:0},x=new i.ImagePosition(_,y);this.patterns[l]={bin:_,position:x}}return this._updatePatternAtlas(),this.patterns[l].position},u.prototype.bind=function(l){var c=l.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new i.Texture(l,this.atlasImage,c.RGBA),this.atlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE)},u.prototype._updatePatternAtlas=function(){var l=[];for(var c in this.patterns)l.push(this.patterns[c].bin);var y=i.potpack(l),_=y.w,x=y.h,S=this.atlasImage;for(var A in S.resize({width:_||1,height:x||1}),this.patterns){var R=this.patterns[A].bin,G=R.x+1,Z=R.y+1,V=this.images[A].data,it=V.width,et=V.height;i.RGBAImage.copy(V,S,{x:0,y:0},{x:G,y:Z},{width:it,height:et}),i.RGBAImage.copy(V,S,{x:0,y:et-1},{x:G,y:Z-1},{width:it,height:1}),i.RGBAImage.copy(V,S,{x:0,y:0},{x:G,y:Z+et},{width:it,height:1}),i.RGBAImage.copy(V,S,{x:it-1,y:0},{x:G-1,y:Z},{width:1,height:et}),i.RGBAImage.copy(V,S,{x:0,y:0},{x:G+it,y:Z},{width:1,height:et})}this.dirty=!0},u.prototype.beginFrame=function(){this.callbackDispatchedThisFrame={}},u.prototype.dispatchRenderCallbacks=function(l){for(var c=0,y=l;c<y.length;c+=1){var _=y[c];if(!this.callbackDispatchedThisFrame[_]){this.callbackDispatchedThisFrame[_]=!0;var x=this.images[_];mt(x)&&this.updateImage(_,x)}}},u}(i.Evented),At=we,Gt=we,Zt=1e20;function we(a,u,l,c,y,_){this.fontSize=a||24,this.buffer=u===void 0?3:u,this.cutoff=c||.25,this.fontFamily=y||"sans-serif",this.fontWeight=_||"normal",this.radius=l||8;var x=this.size=this.fontSize+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=x,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(x*x),this.gridInner=new Float64Array(x*x),this.f=new Float64Array(x),this.d=new Float64Array(x),this.z=new Float64Array(x+1),this.v=new Int16Array(x),this.middle=Math.round(x/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function he(a,u,l,c,y,_,x){for(var S=0;S<u;S++){for(var A=0;A<l;A++)c[A]=a[A*u+S];for(Kt(c,y,_,x,l),A=0;A<l;A++)a[A*u+S]=y[A]}for(A=0;A<l;A++){for(S=0;S<u;S++)c[S]=a[A*u+S];for(Kt(c,y,_,x,u),S=0;S<u;S++)a[A*u+S]=Math.sqrt(y[S])}}function Kt(a,u,l,c,y){l[0]=0,c[0]=-Zt,c[1]=+Zt;for(var _=1,x=0;_<y;_++){for(var S=(a[_]+_*_-(a[l[x]]+l[x]*l[x]))/(2*_-2*l[x]);S<=c[x];)x--,S=(a[_]+_*_-(a[l[x]]+l[x]*l[x]))/(2*_-2*l[x]);l[++x]=_,c[x]=S,c[x+1]=+Zt}for(_=0,x=0;_<y;_++){for(;c[x+1]<_;)x++;u[_]=(_-l[x])*(_-l[x])+a[l[x]]}}we.prototype.draw=function(a){this.ctx.clearRect(0,0,this.size,this.size),this.ctx.fillText(a,this.buffer,this.middle);for(var u=this.ctx.getImageData(0,0,this.size,this.size),l=new Uint8ClampedArray(this.size*this.size),c=0;c<this.size*this.size;c++){var y=u.data[4*c+3]/255;this.gridOuter[c]=y===1?0:y===0?Zt:Math.pow(Math.max(0,.5-y),2),this.gridInner[c]=y===1?Zt:y===0?0:Math.pow(Math.max(0,y-.5),2)}for(he(this.gridOuter,this.size,this.size,this.f,this.d,this.v,this.z),he(this.gridInner,this.size,this.size,this.f,this.d,this.v,this.z),c=0;c<this.size*this.size;c++)l[c]=Math.max(0,Math.min(255,Math.round(255-255*((this.gridOuter[c]-this.gridInner[c])/this.radius+this.cutoff))));return l},At.default=Gt;var ce=function(a,u){this.requestManager=a,this.localIdeographFontFamily=u,this.entries={}};ce.prototype.setURL=function(a){this.url=a},ce.prototype.getGlyphs=function(a,u){var l=this,c=[];for(var y in a)for(var _=0,x=a[y];_<x.length;_+=1)c.push({stack:y,id:x[_]});i.asyncAll(c,function(S,A){var R=S.stack,G=S.id,Z=l.entries[R];Z||(Z=l.entries[R]={glyphs:{},requests:{},ranges:{}});var V=Z.glyphs[G];if(V===void 0){if(V=l._tinySDF(Z,R,G))return Z.glyphs[G]=V,void A(null,{stack:R,id:G,glyph:V});var it=Math.floor(G/256);if(256*it>65535)A(new Error("glyphs > 65535 not supported"));else if(Z.ranges[it])A(null,{stack:R,id:G,glyph:V});else{var et=Z.requests[it];et||(et=Z.requests[it]=[],ce.loadGlyphRange(R,it,l.url,l.requestManager,function(ut,tt){if(tt){for(var lt in tt)l._doesCharSupportLocalGlyph(+lt)||(Z.glyphs[+lt]=tt[+lt]);Z.ranges[it]=!0}for(var yt=0,_t=et;yt<_t.length;yt+=1)(0,_t[yt])(ut,tt);delete Z.requests[it]})),et.push(function(ut,tt){ut?A(ut):tt&&A(null,{stack:R,id:G,glyph:tt[G]||null})})}}else A(null,{stack:R,id:G,glyph:V})},function(S,A){if(S)u(S);else if(A){for(var R={},G=0,Z=A;G<Z.length;G+=1){var V=Z[G],it=V.stack,et=V.id,ut=V.glyph;(R[it]||(R[it]={}))[et]=ut&&{id:ut.id,bitmap:ut.bitmap.clone(),metrics:ut.metrics}}u(null,R)}})},ce.prototype._doesCharSupportLocalGlyph=function(a){return!!this.localIdeographFontFamily&&(i.isChar["CJK Unified Ideographs"](a)||i.isChar["Hangul Syllables"](a)||i.isChar.Hiragana(a)||i.isChar.Katakana(a))},ce.prototype._tinySDF=function(a,u,l){var c=this.localIdeographFontFamily;if(c&&this._doesCharSupportLocalGlyph(l)){var y=a.tinySDF;if(!y){var _="400";/bold/i.test(u)?_="900":/medium/i.test(u)?_="500":/light/i.test(u)&&(_="200"),y=a.tinySDF=new ce.TinySDF(24,3,8,.25,c,_)}return{id:l,bitmap:new i.AlphaImage({width:30,height:30},y.draw(String.fromCharCode(l))),metrics:{width:24,height:24,left:0,top:-8,advance:24}}}},ce.loadGlyphRange=function(a,u,l,c,y){var _=256*u,x=_+255,S=c.transformRequest(c.normalizeGlyphsURL(l).replace("{fontstack}",a).replace("{range}",_+"-"+x),i.ResourceType.Glyphs);i.getArrayBuffer(S,function(A,R){if(A)y(A);else if(R){for(var G={},Z=0,V=i.parseGlyphPBF(R);Z<V.length;Z+=1){var it=V[Z];G[it.id]=it}y(null,G)}})},ce.TinySDF=At;var Yt=function(){this.specification=i.styleSpec.light.position};Yt.prototype.possiblyEvaluate=function(a,u){return i.sphericalToCartesian(a.expression.evaluate(u))},Yt.prototype.interpolate=function(a,u,l){return{x:i.number(a.x,u.x,l),y:i.number(a.y,u.y,l),z:i.number(a.z,u.z,l)}};var Te=new i.Properties({anchor:new i.DataConstantProperty(i.styleSpec.light.anchor),position:new Yt,color:new i.DataConstantProperty(i.styleSpec.light.color),intensity:new i.DataConstantProperty(i.styleSpec.light.intensity)}),dr=function(a){function u(l){a.call(this),this._transitionable=new i.Transitionable(Te),this.setLight(l),this._transitioning=this._transitionable.untransitioned()}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getLight=function(){return this._transitionable.serialize()},u.prototype.setLight=function(l,c){if(c===void 0&&(c={}),!this._validate(i.validateLight,l,c))for(var y in l){var _=l[y];i.endsWith(y,"-transition")?this._transitionable.setTransition(y.slice(0,-11),_):this._transitionable.setValue(y,_)}},u.prototype.updateTransitions=function(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)},u.prototype.hasTransition=function(){return this._transitioning.hasTransition()},u.prototype.recalculate=function(l){this.properties=this._transitioning.possiblyEvaluate(l)},u.prototype._validate=function(l,c,y){return(!y||y.validate!==!1)&&i.emitValidationErrors(this,l.call(i.validateStyle,i.extend({value:c,style:{glyphs:!0,sprite:!0},styleSpec:i.styleSpec})))},u}(i.Evented),Le=function(a,u){this.width=a,this.height=u,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}};Le.prototype.getDash=function(a,u){var l=a.join(",")+String(u);return this.dashEntry[l]||(this.dashEntry[l]=this.addDash(a,u)),this.dashEntry[l]},Le.prototype.getDashRanges=function(a,u,l){var c=[],y=a.length%2==1?-a[a.length-1]*l:0,_=a[0]*l,x=!0;c.push({left:y,right:_,isDash:x,zeroLength:a[0]===0});for(var S=a[0],A=1;A<a.length;A++){var R=a[A];c.push({left:y=S*l,right:_=(S+=R)*l,isDash:x=!x,zeroLength:R===0})}return c},Le.prototype.addRoundDash=function(a,u,l){for(var c=u/2,y=-l;y<=l;y++)for(var _=this.width*(this.nextRow+l+y),x=0,S=a[x],A=0;A<this.width;A++){A/S.right>1&&(S=a[++x]);var R=Math.abs(A-S.left),G=Math.abs(A-S.right),Z=Math.min(R,G),V=void 0,it=y/l*(c+1);if(S.isDash){var et=c-Math.abs(it);V=Math.sqrt(Z*Z+et*et)}else V=c-Math.sqrt(Z*Z+it*it);this.data[_+A]=Math.max(0,Math.min(255,V+128))}},Le.prototype.addRegularDash=function(a){for(var u=a.length-1;u>=0;--u){var l=a[u],c=a[u+1];l.zeroLength?a.splice(u,1):c&&c.isDash===l.isDash&&(c.left=l.left,a.splice(u,1))}var y=a[0],_=a[a.length-1];y.isDash===_.isDash&&(y.left=_.left-this.width,_.right=y.right+this.width);for(var x=this.width*this.nextRow,S=0,A=a[S],R=0;R<this.width;R++){R/A.right>1&&(A=a[++S]);var G=Math.abs(R-A.left),Z=Math.abs(R-A.right),V=Math.min(G,Z);this.data[x+R]=Math.max(0,Math.min(255,(A.isDash?V:-V)+128))}},Le.prototype.addDash=function(a,u){var l=u?7:0,c=2*l+1;if(this.nextRow+c>this.height)return i.warnOnce("LineAtlas out of space"),null;for(var y=0,_=0;_<a.length;_++)y+=a[_];if(y!==0){var x=this.width/y,S=this.getDashRanges(a,this.width,x);u?this.addRoundDash(S,x,l):this.addRegularDash(S)}var A={y:(this.nextRow+l+.5)/this.height,height:2*l/this.height,width:y};return this.nextRow+=c,this.dirty=!0,A},Le.prototype.bind=function(a){var u=a.gl;this.texture?(u.bindTexture(u.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,u.texSubImage2D(u.TEXTURE_2D,0,0,0,this.width,this.height,u.ALPHA,u.UNSIGNED_BYTE,this.data))):(this.texture=u.createTexture(),u.bindTexture(u.TEXTURE_2D,this.texture),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.REPEAT),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.REPEAT),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.LINEAR),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.LINEAR),u.texImage2D(u.TEXTURE_2D,0,u.ALPHA,this.width,this.height,0,u.ALPHA,u.UNSIGNED_BYTE,this.data))};var hr=function a(u,l){this.workerPool=u,this.actors=[],this.currentActor=0,this.id=i.uniqueId();for(var c=this.workerPool.acquire(this.id),y=0;y<c.length;y++){var _=new a.Actor(c[y],l,this.id);_.name="Worker "+y,this.actors.push(_)}};function Ur(a,u,l){var c=function(y,_){if(y)return l(y);if(_){var x=i.pick(i.extend(_,a),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);_.vector_layers&&(x.vectorLayers=_.vector_layers,x.vectorLayerIds=x.vectorLayers.map(function(S){return S.id})),x.tiles=u.canonicalizeTileset(x,a.url),l(null,x)}};return a.url?i.getJSON(u.transformRequest(u.normalizeSourceURL(a.url),i.ResourceType.Source),c):i.browser.frame(function(){return c(null,a)})}hr.prototype.broadcast=function(a,u,l){i.asyncAll(this.actors,function(c,y){c.send(a,u,y)},l=l||function(){})},hr.prototype.getActor=function(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]},hr.prototype.remove=function(){this.actors.forEach(function(a){a.remove()}),this.actors=[],this.workerPool.release(this.id)},hr.Actor=i.Actor;var Gr=function(a,u,l){this.bounds=i.LngLatBounds.convert(this.validateBounds(a)),this.minzoom=u||0,this.maxzoom=l||24};Gr.prototype.validateBounds=function(a){return Array.isArray(a)&&a.length===4?[Math.max(-180,a[0]),Math.max(-90,a[1]),Math.min(180,a[2]),Math.min(90,a[3])]:[-180,-90,180,90]},Gr.prototype.contains=function(a){var u=Math.pow(2,a.z),l=Math.floor(i.mercatorXfromLng(this.bounds.getWest())*u),c=Math.floor(i.mercatorYfromLat(this.bounds.getNorth())*u),y=Math.ceil(i.mercatorXfromLng(this.bounds.getEast())*u),_=Math.ceil(i.mercatorYfromLat(this.bounds.getSouth())*u);return a.x>=l&&a.x<y&&a.y>=c&&a.y<_};var _n=function(a){function u(l,c,y,_){if(a.call(this),this.id=l,this.dispatcher=y,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,i.extend(this,i.pick(c,["url","scheme","tileSize","promoteId"])),this._options=i.extend({type:"vector"},c),this._collectResourceTiming=c.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(_)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.load=function(){var l=this;this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Ur(this._options,this.map._requestManager,function(c,y){l._tileJSONRequest=null,l._loaded=!0,c?l.fire(new i.ErrorEvent(c)):y&&(i.extend(l,y),y.bounds&&(l.tileBounds=new Gr(y.bounds,l.minzoom,l.maxzoom)),i.postTurnstileEvent(y.tiles,l.map._requestManager._customAccessToken),i.postMapLoadEvent(y.tiles,l.map._getMapId(),l.map._requestManager._skuToken,l.map._requestManager._customAccessToken),l.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),l.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})))})},u.prototype.loaded=function(){return this._loaded},u.prototype.hasTile=function(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)},u.prototype.onAdd=function(l){this.map=l,this.load()},u.prototype.setSourceProperty=function(l){this._tileJSONRequest&&this._tileJSONRequest.cancel(),l(),this.map.style.sourceCaches[this.id].clearTiles(),this.load()},u.prototype.setTiles=function(l){var c=this;return this.setSourceProperty(function(){c._options.tiles=l}),this},u.prototype.setUrl=function(l){var c=this;return this.setSourceProperty(function(){c.url=l,c._options.url=l}),this},u.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},u.prototype.serialize=function(){return i.extend({},this._options)},u.prototype.loadTile=function(l,c){var y=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme)),_={request:this.map._requestManager.transformRequest(y,i.ResourceType.Tile),uid:l.uid,tileID:l.tileID,zoom:l.tileID.overscaledZ,tileSize:this.tileSize*l.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:i.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function x(S,A){return delete l.request,l.aborted?c(null):S&&S.status!==404?c(S):(A&&A.resourceTiming&&(l.resourceTiming=A.resourceTiming),this.map._refreshExpiredTiles&&A&&l.setExpiryData(A),l.loadVectorData(A,this.map.painter),i.cacheEntryPossiblyAdded(this.dispatcher),c(null),void(l.reloadCallback&&(this.loadTile(l,l.reloadCallback),l.reloadCallback=null)))}_.request.collectResourceTiming=this._collectResourceTiming,l.actor&&l.state!=="expired"?l.state==="loading"?l.reloadCallback=c:l.request=l.actor.send("reloadTile",_,x.bind(this)):(l.actor=this.dispatcher.getActor(),l.request=l.actor.send("loadTile",_,x.bind(this)))},u.prototype.abortTile=function(l){l.request&&(l.request.cancel(),delete l.request),l.actor&&l.actor.send("abortTile",{uid:l.uid,type:this.type,source:this.id},void 0)},u.prototype.unloadTile=function(l){l.unloadVectorData(),l.actor&&l.actor.send("removeTile",{uid:l.uid,type:this.type,source:this.id},void 0)},u.prototype.hasTransition=function(){return!1},u}(i.Evented),Cr=function(a){function u(l,c,y,_){a.call(this),this.id=l,this.dispatcher=y,this.setEventedParent(_),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=i.extend({type:"raster"},c),i.extend(this,i.pick(c,["url","scheme","tileSize"]))}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.load=function(){var l=this;this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Ur(this._options,this.map._requestManager,function(c,y){l._tileJSONRequest=null,l._loaded=!0,c?l.fire(new i.ErrorEvent(c)):y&&(i.extend(l,y),y.bounds&&(l.tileBounds=new Gr(y.bounds,l.minzoom,l.maxzoom)),i.postTurnstileEvent(y.tiles),i.postMapLoadEvent(y.tiles,l.map._getMapId(),l.map._requestManager._skuToken),l.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),l.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})))})},u.prototype.loaded=function(){return this._loaded},u.prototype.onAdd=function(l){this.map=l,this.load()},u.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},u.prototype.serialize=function(){return i.extend({},this._options)},u.prototype.hasTile=function(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)},u.prototype.loadTile=function(l,c){var y=this,_=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme),this.tileSize);l.request=i.getImage(this.map._requestManager.transformRequest(_,i.ResourceType.Tile),function(x,S){if(delete l.request,l.aborted)l.state="unloaded",c(null);else if(x)l.state="errored",c(x);else if(S){y.map._refreshExpiredTiles&&l.setExpiryData(S),delete S.cacheControl,delete S.expires;var A=y.map.painter.context,R=A.gl;l.texture=y.map.painter.getTileTexture(S.width),l.texture?l.texture.update(S,{useMipmap:!0}):(l.texture=new i.Texture(A,S,R.RGBA,{useMipmap:!0}),l.texture.bind(R.LINEAR,R.CLAMP_TO_EDGE,R.LINEAR_MIPMAP_NEAREST),A.extTextureFilterAnisotropic&&R.texParameterf(R.TEXTURE_2D,A.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,A.extTextureFilterAnisotropicMax)),l.state="loaded",i.cacheEntryPossiblyAdded(y.dispatcher),c(null)}})},u.prototype.abortTile=function(l,c){l.request&&(l.request.cancel(),delete l.request),c()},u.prototype.unloadTile=function(l,c){l.texture&&this.map.painter.saveTileTexture(l.texture),c()},u.prototype.hasTransition=function(){return!1},u}(i.Evented),te=function(a){function u(l,c,y,_){a.call(this,l,c,y,_),this.type="raster-dem",this.maxzoom=22,this._options=i.extend({type:"raster-dem"},c),this.encoding=c.encoding||"mapbox"}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.serialize=function(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}},u.prototype.loadTile=function(l,c){var y=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme),this.tileSize);function _(x,S){x&&(l.state="errored",c(x)),S&&(l.dem=S,l.needsHillshadePrepare=!0,l.state="loaded",c(null))}l.request=i.getImage(this.map._requestManager.transformRequest(y,i.ResourceType.Tile),function(x,S){if(delete l.request,l.aborted)l.state="unloaded",c(null);else if(x)l.state="errored",c(x);else if(S){this.map._refreshExpiredTiles&&l.setExpiryData(S),delete S.cacheControl,delete S.expires;var A=i.window.ImageBitmap&&S instanceof i.window.ImageBitmap&&i.offscreenCanvasSupported()?S:i.browser.getImageData(S,1),R={uid:l.uid,coord:l.tileID,source:this.id,rawImageData:A,encoding:this.encoding};l.actor&&l.state!=="expired"||(l.actor=this.dispatcher.getActor(),l.actor.send("loadDEMTile",R,_.bind(this)))}}.bind(this)),l.neighboringTiles=this._getNeighboringTiles(l.tileID)},u.prototype._getNeighboringTiles=function(l){var c=l.canonical,y=Math.pow(2,c.z),_=(c.x-1+y)%y,x=c.x===0?l.wrap-1:l.wrap,S=(c.x+1+y)%y,A=c.x+1===y?l.wrap+1:l.wrap,R={};return R[new i.OverscaledTileID(l.overscaledZ,x,c.z,_,c.y).key]={backfilled:!1},R[new i.OverscaledTileID(l.overscaledZ,A,c.z,S,c.y).key]={backfilled:!1},c.y>0&&(R[new i.OverscaledTileID(l.overscaledZ,x,c.z,_,c.y-1).key]={backfilled:!1},R[new i.OverscaledTileID(l.overscaledZ,l.wrap,c.z,c.x,c.y-1).key]={backfilled:!1},R[new i.OverscaledTileID(l.overscaledZ,A,c.z,S,c.y-1).key]={backfilled:!1}),c.y+1<y&&(R[new i.OverscaledTileID(l.overscaledZ,x,c.z,_,c.y+1).key]={backfilled:!1},R[new i.OverscaledTileID(l.overscaledZ,l.wrap,c.z,c.x,c.y+1).key]={backfilled:!1},R[new i.OverscaledTileID(l.overscaledZ,A,c.z,S,c.y+1).key]={backfilled:!1}),R},u.prototype.unloadTile=function(l){l.demTexture&&this.map.painter.saveTileTexture(l.demTexture),l.fbo&&(l.fbo.destroy(),delete l.fbo),l.dem&&delete l.dem,delete l.neighboringTiles,l.state="unloaded",l.actor&&l.actor.send("removeDEMTile",{uid:l.uid,source:this.id})},u}(Cr),ae=function(a){function u(l,c,y,_){a.call(this),this.id=l,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._loaded=!1,this.actor=y.getActor(),this.setEventedParent(_),this._data=c.data,this._options=i.extend({},c),this._collectResourceTiming=c.collectResourceTiming,this._resourceTiming=[],c.maxzoom!==void 0&&(this.maxzoom=c.maxzoom),c.type&&(this.type=c.type),c.attribution&&(this.attribution=c.attribution),this.promoteId=c.promoteId;var x=i.EXTENT/this.tileSize;this.workerOptions=i.extend({source:this.id,cluster:c.cluster||!1,geojsonVtOptions:{buffer:(c.buffer!==void 0?c.buffer:128)*x,tolerance:(c.tolerance!==void 0?c.tolerance:.375)*x,extent:i.EXTENT,maxZoom:this.maxzoom,lineMetrics:c.lineMetrics||!1,generateId:c.generateId||!1},superclusterOptions:{maxZoom:c.clusterMaxZoom!==void 0?Math.min(c.clusterMaxZoom,this.maxzoom-1):this.maxzoom-1,minPoints:Math.max(2,c.clusterMinPoints||2),extent:i.EXTENT,radius:(c.clusterRadius||50)*x,log:!1,generateId:c.generateId||!1},clusterProperties:c.clusterProperties,filter:c.filter},c.workerOptions)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.load=function(){var l=this;this.fire(new i.Event("dataloading",{dataType:"source"})),this._updateWorkerData(function(c){if(c)l.fire(new i.ErrorEvent(c));else{var y={dataType:"source",sourceDataType:"metadata"};l._collectResourceTiming&&l._resourceTiming&&l._resourceTiming.length>0&&(y.resourceTiming=l._resourceTiming,l._resourceTiming=[]),l.fire(new i.Event("data",y))}})},u.prototype.onAdd=function(l){this.map=l,this.load()},u.prototype.setData=function(l){var c=this;return this._data=l,this.fire(new i.Event("dataloading",{dataType:"source"})),this._updateWorkerData(function(y){if(y)c.fire(new i.ErrorEvent(y));else{var _={dataType:"source",sourceDataType:"content"};c._collectResourceTiming&&c._resourceTiming&&c._resourceTiming.length>0&&(_.resourceTiming=c._resourceTiming,c._resourceTiming=[]),c.fire(new i.Event("data",_))}}),this},u.prototype.getClusterExpansionZoom=function(l,c){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:l,source:this.id},c),this},u.prototype.getClusterChildren=function(l,c){return this.actor.send("geojson.getClusterChildren",{clusterId:l,source:this.id},c),this},u.prototype.getClusterLeaves=function(l,c,y,_){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:l,limit:c,offset:y},_),this},u.prototype._updateWorkerData=function(l){var c=this;this._loaded=!1;var y=i.extend({},this.workerOptions),_=this._data;typeof _=="string"?(y.request=this.map._requestManager.transformRequest(i.browser.resolveURL(_),i.ResourceType.Source),y.request.collectResourceTiming=this._collectResourceTiming):y.data=JSON.stringify(_),this.actor.send(this.type+".loadData",y,function(x,S){c._removed||S&&S.abandoned||(c._loaded=!0,S&&S.resourceTiming&&S.resourceTiming[c.id]&&(c._resourceTiming=S.resourceTiming[c.id].slice(0)),c.actor.send(c.type+".coalesce",{source:y.source},null),l(x))})},u.prototype.loaded=function(){return this._loaded},u.prototype.loadTile=function(l,c){var y=this,_=l.actor?"reloadTile":"loadTile";l.actor=this.actor,l.request=this.actor.send(_,{type:this.type,uid:l.uid,tileID:l.tileID,zoom:l.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:i.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},function(x,S){return delete l.request,l.unloadVectorData(),l.aborted?c(null):x?c(x):(l.loadVectorData(S,y.map.painter,_==="reloadTile"),c(null))})},u.prototype.abortTile=function(l){l.request&&(l.request.cancel(),delete l.request),l.aborted=!0},u.prototype.unloadTile=function(l){l.unloadVectorData(),this.actor.send("removeTile",{uid:l.uid,type:this.type,source:this.id})},u.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})},u.prototype.serialize=function(){return i.extend({},this._options,{type:this.type,data:this._data})},u.prototype.hasTransition=function(){return!1},u}(i.Evented),me=i.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),Ne=function(a){function u(l,c,y,_){a.call(this),this.id=l,this.dispatcher=y,this.coordinates=c.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(_),this.options=c}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.load=function(l,c){var y=this;this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this.url=this.options.url,i.getImage(this.map._requestManager.transformRequest(this.url,i.ResourceType.Image),function(_,x){y._loaded=!0,_?y.fire(new i.ErrorEvent(_)):x&&(y.image=x,l&&(y.coordinates=l),c&&c(),y._finishLoading())})},u.prototype.loaded=function(){return this._loaded},u.prototype.updateImage=function(l){var c=this;return this.image&&l.url?(this.options.url=l.url,this.load(l.coordinates,function(){c.texture=null}),this):this},u.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})))},u.prototype.onAdd=function(l){this.map=l,this.load()},u.prototype.setCoordinates=function(l){var c=this;this.coordinates=l;var y=l.map(i.MercatorCoordinate.fromLngLat);this.tileID=function(x){for(var S=1/0,A=1/0,R=-1/0,G=-1/0,Z=0,V=x;Z<V.length;Z+=1){var it=V[Z];S=Math.min(S,it.x),A=Math.min(A,it.y),R=Math.max(R,it.x),G=Math.max(G,it.y)}var et=Math.max(R-S,G-A),ut=Math.max(0,Math.floor(-Math.log(et)/Math.LN2)),tt=Math.pow(2,ut);return new i.CanonicalTileID(ut,Math.floor((S+R)/2*tt),Math.floor((A+G)/2*tt))}(y),this.minzoom=this.maxzoom=this.tileID.z;var _=y.map(function(x){return c.tileID.getTilePoint(x)._round()});return this._boundsArray=new i.StructArrayLayout4i8,this._boundsArray.emplaceBack(_[0].x,_[0].y,0,0),this._boundsArray.emplaceBack(_[1].x,_[1].y,i.EXTENT,0),this._boundsArray.emplaceBack(_[3].x,_[3].y,0,i.EXTENT),this._boundsArray.emplaceBack(_[2].x,_[2].y,i.EXTENT,i.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})),this},u.prototype.prepare=function(){if(Object.keys(this.tiles).length!==0&&this.image){var l=this.map.painter.context,c=l.gl;for(var y in this.boundsBuffer||(this.boundsBuffer=l.createVertexBuffer(this._boundsArray,me.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new i.Texture(l,this.image,c.RGBA),this.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE)),this.tiles){var _=this.tiles[y];_.state!=="loaded"&&(_.state="loaded",_.texture=this.texture)}}},u.prototype.loadTile=function(l,c){this.tileID&&this.tileID.equals(l.tileID.canonical)?(this.tiles[String(l.tileID.wrap)]=l,l.buckets={},c(null)):(l.state="errored",c(null))},u.prototype.serialize=function(){return{type:"image",url:this.options.url,coordinates:this.coordinates}},u.prototype.hasTransition=function(){return!1},u}(i.Evented),Qe=function(a){function u(l,c,y,_){a.call(this,l,c,y,_),this.roundZoom=!0,this.type="video",this.options=c}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.load=function(){var l=this;this._loaded=!1;var c=this.options;this.urls=[];for(var y=0,_=c.urls;y<_.length;y+=1)this.urls.push(this.map._requestManager.transformRequest(_[y],i.ResourceType.Source).url);i.getVideo(this.urls,function(x,S){l._loaded=!0,x?l.fire(new i.ErrorEvent(x)):S&&(l.video=S,l.video.loop=!0,l.video.addEventListener("playing",function(){l.map.triggerRepaint()}),l.map&&l.video.play(),l._finishLoading())})},u.prototype.pause=function(){this.video&&this.video.pause()},u.prototype.play=function(){this.video&&this.video.play()},u.prototype.seek=function(l){if(this.video){var c=this.video.seekable;l<c.start(0)||l>c.end(0)?this.fire(new i.ErrorEvent(new i.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+c.start(0)+" and "+c.end(0)+"-second mark."))):this.video.currentTime=l}},u.prototype.getVideo=function(){return this.video},u.prototype.onAdd=function(l){this.map||(this.map=l,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},u.prototype.prepare=function(){if(!(Object.keys(this.tiles).length===0||this.video.readyState<2)){var l=this.map.painter.context,c=l.gl;for(var y in this.boundsBuffer||(this.boundsBuffer=l.createVertexBuffer(this._boundsArray,me.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE),c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,this.video)):(this.texture=new i.Texture(l,this.video,c.RGBA),this.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE)),this.tiles){var _=this.tiles[y];_.state!=="loaded"&&(_.state="loaded",_.texture=this.texture)}}},u.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},u.prototype.hasTransition=function(){return this.video&&!this.video.paused},u}(Ne),pi=function(a){function u(l,c,y,_){a.call(this,l,c,y,_),c.coordinates?Array.isArray(c.coordinates)&&c.coordinates.length===4&&!c.coordinates.some(function(x){return!Array.isArray(x)||x.length!==2||x.some(function(S){return typeof S!="number"})})||this.fire(new i.ErrorEvent(new i.ValidationError("sources."+l,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.ErrorEvent(new i.ValidationError("sources."+l,null,'missing required property "coordinates"'))),c.animate&&typeof c.animate!="boolean"&&this.fire(new i.ErrorEvent(new i.ValidationError("sources."+l,null,'optional "animate" property must be a boolean value'))),c.canvas?typeof c.canvas=="string"||c.canvas instanceof i.window.HTMLCanvasElement||this.fire(new i.ErrorEvent(new i.ValidationError("sources."+l,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 i.ErrorEvent(new i.ValidationError("sources."+l,null,'missing required property "canvas"'))),this.options=c,this.animate=c.animate===void 0||c.animate}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.load=function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof i.window.HTMLCanvasElement?this.options.canvas:i.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new i.ErrorEvent(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())},u.prototype.getCanvas=function(){return this.canvas},u.prototype.onAdd=function(l){this.map=l,this.load(),this.canvas&&this.animate&&this.play()},u.prototype.onRemove=function(){this.pause()},u.prototype.prepare=function(){var l=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,l=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,l=!0),!this._hasInvalidDimensions()&&Object.keys(this.tiles).length!==0){var c=this.map.painter.context,y=c.gl;for(var _ in this.boundsBuffer||(this.boundsBuffer=c.createVertexBuffer(this._boundsArray,me.members)),this.boundsSegments||(this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(l||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new i.Texture(c,this.canvas,y.RGBA,{premultiply:!0}),this.tiles){var x=this.tiles[_];x.state!=="loaded"&&(x.state="loaded",x.texture=this.texture)}}},u.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},u.prototype.hasTransition=function(){return this._playing},u.prototype._hasInvalidDimensions=function(){for(var l=0,c=[this.canvas.width,this.canvas.height];l<c.length;l+=1){var y=c[l];if(isNaN(y)||y<=0)return!0}return!1},u}(Ne),Ai={vector:_n,raster:Cr,"raster-dem":te,geojson:ae,video:Qe,image:Ne,canvas:pi};function Ji(a,u){var l=i.identity([]);return i.translate(l,l,[1,1,0]),i.scale(l,l,[.5*a.width,.5*a.height,1]),i.multiply(l,l,a.calculatePosMatrix(u.toUnwrapped()))}function ke(a,u,l,c,y,_){var x=function(ut,tt,lt){if(ut)for(var yt=0,_t=ut;yt<_t.length;yt+=1){var It=tt[_t[yt]];if(It&&It.source===lt&&It.type==="fill-extrusion")return!0}else for(var Tt in tt){var Ct=tt[Tt];if(Ct.source===lt&&Ct.type==="fill-extrusion")return!0}return!1}(y&&y.layers,u,a.id),S=_.maxPitchScaleFactor(),A=a.tilesIn(c,S,x);A.sort(cr);for(var R=[],G=0,Z=A;G<Z.length;G+=1){var V=Z[G];R.push({wrappedTileID:V.tileID.wrapped().key,queryResults:V.tile.queryRenderedFeatures(u,l,a._state,V.queryGeometry,V.cameraQueryGeometry,V.scale,y,_,S,Ji(a.transform,V.tileID))})}var it=function(ut){for(var tt={},lt={},yt=0,_t=ut;yt<_t.length;yt+=1){var It=_t[yt],Tt=It.queryResults,Ct=It.wrappedTileID,Lt=lt[Ct]=lt[Ct]||{};for(var qt in Tt)for(var Ut=Tt[qt],ie=Lt[qt]=Lt[qt]||{},_e=tt[qt]=tt[qt]||[],Se=0,xe=Ut;Se<xe.length;Se+=1){var nr=xe[Se];ie[nr.featureIndex]||(ie[nr.featureIndex]=!0,_e.push(nr))}}return tt}(R);for(var et in it)it[et].forEach(function(ut){var tt=ut.feature,lt=a.getFeatureState(tt.layer["source-layer"],tt.id);tt.source=tt.layer.source,tt.layer["source-layer"]&&(tt.sourceLayer=tt.layer["source-layer"]),tt.state=lt});return it}function cr(a,u){var l=a.tileID,c=u.tileID;return l.overscaledZ-c.overscaledZ||l.canonical.y-c.canonical.y||l.wrap-c.wrap||l.canonical.x-c.canonical.x}var We=function(a,u){this.max=a,this.onRemove=u,this.reset()};We.prototype.reset=function(){for(var a in this.data)for(var u=0,l=this.data[a];u<l.length;u+=1){var c=l[u];c.timeout&&clearTimeout(c.timeout),this.onRemove(c.value)}return this.data={},this.order=[],this},We.prototype.add=function(a,u,l){var c=this,y=a.wrapped().key;this.data[y]===void 0&&(this.data[y]=[]);var _={value:u,timeout:void 0};if(l!==void 0&&(_.timeout=setTimeout(function(){c.remove(a,_)},l)),this.data[y].push(_),this.order.push(y),this.order.length>this.max){var x=this._getAndRemoveByKey(this.order[0]);x&&this.onRemove(x)}return this},We.prototype.has=function(a){return a.wrapped().key in this.data},We.prototype.getAndRemove=function(a){return this.has(a)?this._getAndRemoveByKey(a.wrapped().key):null},We.prototype._getAndRemoveByKey=function(a){var u=this.data[a].shift();return u.timeout&&clearTimeout(u.timeout),this.data[a].length===0&&delete this.data[a],this.order.splice(this.order.indexOf(a),1),u.value},We.prototype.getByKey=function(a){var u=this.data[a];return u?u[0].value:null},We.prototype.get=function(a){return this.has(a)?this.data[a.wrapped().key][0].value:null},We.prototype.remove=function(a,u){if(!this.has(a))return this;var l=a.wrapped().key,c=u===void 0?0:this.data[l].indexOf(u),y=this.data[l][c];return this.data[l].splice(c,1),y.timeout&&clearTimeout(y.timeout),this.data[l].length===0&&delete this.data[l],this.onRemove(y.value),this.order.splice(this.order.indexOf(l),1),this},We.prototype.setMaxSize=function(a){for(this.max=a;this.order.length>this.max;){var u=this._getAndRemoveByKey(this.order[0]);u&&this.onRemove(u)}return this},We.prototype.filter=function(a){var u=[];for(var l in this.data)for(var c=0,y=this.data[l];c<y.length;c+=1){var _=y[c];a(_.value)||u.push(_)}for(var x=0,S=u;x<S.length;x+=1){var A=S[x];this.remove(A.value.tileID,A)}};var oi=function(a,u,l){this.context=a;var c=a.gl;this.buffer=c.createBuffer(),this.dynamicDraw=Boolean(l),this.context.unbindVAO(),a.bindElementBuffer.set(this.buffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?c.DYNAMIC_DRAW:c.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer};oi.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer)},oi.prototype.updateData=function(a){var u=this.context.gl;this.context.unbindVAO(),this.bind(),u.bufferSubData(u.ELEMENT_ARRAY_BUFFER,0,a.arrayBuffer)},oi.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var ln={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},Oi=function(a,u,l,c){this.length=u.length,this.attributes=l,this.itemSize=u.bytesPerElement,this.dynamicDraw=c,this.context=a;var y=a.gl;this.buffer=y.createBuffer(),a.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer};Oi.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},Oi.prototype.updateData=function(a){var u=this.context.gl;this.bind(),u.bufferSubData(u.ARRAY_BUFFER,0,a.arrayBuffer)},Oi.prototype.enableAttributes=function(a,u){for(var l=0;l<this.attributes.length;l++){var c=u.attributes[this.attributes[l].name];c!==void 0&&a.enableVertexAttribArray(c)}},Oi.prototype.setVertexAttribPointers=function(a,u,l){for(var c=0;c<this.attributes.length;c++){var y=this.attributes[c],_=u.attributes[y.name];_!==void 0&&a.vertexAttribPointer(_,y.components,a[ln[y.type]],!1,this.itemSize,y.offset+this.itemSize*(l||0))}},Oi.prototype.destroy=function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)};var Ce=function(a){this.gl=a.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1};Ce.prototype.get=function(){return this.current},Ce.prototype.set=function(a){},Ce.prototype.getDefault=function(){return this.default},Ce.prototype.setDefault=function(){this.set(this.default)};var Cn=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return i.Color.transparent},u.prototype.set=function(l){var c=this.current;(l.r!==c.r||l.g!==c.g||l.b!==c.b||l.a!==c.a||this.dirty)&&(this.gl.clearColor(l.r,l.g,l.b,l.a),this.current=l,this.dirty=!1)},u}(Ce),Ar=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return 1},u.prototype.set=function(l){(l!==this.current||this.dirty)&&(this.gl.clearDepth(l),this.current=l,this.dirty=!1)},u}(Ce),Ki=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return 0},u.prototype.set=function(l){(l!==this.current||this.dirty)&&(this.gl.clearStencil(l),this.current=l,this.dirty=!1)},u}(Ce),zo=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return[!0,!0,!0,!0]},u.prototype.set=function(l){var c=this.current;(l[0]!==c[0]||l[1]!==c[1]||l[2]!==c[2]||l[3]!==c[3]||this.dirty)&&(this.gl.colorMask(l[0],l[1],l[2],l[3]),this.current=l,this.dirty=!1)},u}(Ce),Qi=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return!0},u.prototype.set=function(l){(l!==this.current||this.dirty)&&(this.gl.depthMask(l),this.current=l,this.dirty=!1)},u}(Ce),bt=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return 255},u.prototype.set=function(l){(l!==this.current||this.dirty)&&(this.gl.stencilMask(l),this.current=l,this.dirty=!1)},u}(Ce),q=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return{func:this.gl.ALWAYS,ref:0,mask:255}},u.prototype.set=function(l){var c=this.current;(l.func!==c.func||l.ref!==c.ref||l.mask!==c.mask||this.dirty)&&(this.gl.stencilFunc(l.func,l.ref,l.mask),this.current=l,this.dirty=!1)},u}(Ce),F=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){var l=this.gl;return[l.KEEP,l.KEEP,l.KEEP]},u.prototype.set=function(l){var c=this.current;(l[0]!==c[0]||l[1]!==c[1]||l[2]!==c[2]||this.dirty)&&(this.gl.stencilOp(l[0],l[1],l[2]),this.current=l,this.dirty=!1)},u}(Ce),W=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return!1},u.prototype.set=function(l){if(l!==this.current||this.dirty){var c=this.gl;l?c.enable(c.STENCIL_TEST):c.disable(c.STENCIL_TEST),this.current=l,this.dirty=!1}},u}(Ce),nt=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return[0,1]},u.prototype.set=function(l){var c=this.current;(l[0]!==c[0]||l[1]!==c[1]||this.dirty)&&(this.gl.depthRange(l[0],l[1]),this.current=l,this.dirty=!1)},u}(Ce),dt=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return!1},u.prototype.set=function(l){if(l!==this.current||this.dirty){var c=this.gl;l?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST),this.current=l,this.dirty=!1}},u}(Ce),Mt=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return this.gl.LESS},u.prototype.set=function(l){(l!==this.current||this.dirty)&&(this.gl.depthFunc(l),this.current=l,this.dirty=!1)},u}(Ce),Dt=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return!1},u.prototype.set=function(l){if(l!==this.current||this.dirty){var c=this.gl;l?c.enable(c.BLEND):c.disable(c.BLEND),this.current=l,this.dirty=!1}},u}(Ce),Vt=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){var l=this.gl;return[l.ONE,l.ZERO]},u.prototype.set=function(l){var c=this.current;(l[0]!==c[0]||l[1]!==c[1]||this.dirty)&&(this.gl.blendFunc(l[0],l[1]),this.current=l,this.dirty=!1)},u}(Ce),ye=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return i.Color.transparent},u.prototype.set=function(l){var c=this.current;(l.r!==c.r||l.g!==c.g||l.b!==c.b||l.a!==c.a||this.dirty)&&(this.gl.blendColor(l.r,l.g,l.b,l.a),this.current=l,this.dirty=!1)},u}(Ce),Ae=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return this.gl.FUNC_ADD},u.prototype.set=function(l){(l!==this.current||this.dirty)&&(this.gl.blendEquation(l),this.current=l,this.dirty=!1)},u}(Ce),qe=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return!1},u.prototype.set=function(l){if(l!==this.current||this.dirty){var c=this.gl;l?c.enable(c.CULL_FACE):c.disable(c.CULL_FACE),this.current=l,this.dirty=!1}},u}(Ce),Ge=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return this.gl.BACK},u.prototype.set=function(l){(l!==this.current||this.dirty)&&(this.gl.cullFace(l),this.current=l,this.dirty=!1)},u}(Ce),Xe=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return this.gl.CCW},u.prototype.set=function(l){(l!==this.current||this.dirty)&&(this.gl.frontFace(l),this.current=l,this.dirty=!1)},u}(Ce),yr=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return null},u.prototype.set=function(l){(l!==this.current||this.dirty)&&(this.gl.useProgram(l),this.current=l,this.dirty=!1)},u}(Ce),ar=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return this.gl.TEXTURE0},u.prototype.set=function(l){(l!==this.current||this.dirty)&&(this.gl.activeTexture(l),this.current=l,this.dirty=!1)},u}(Ce),ur=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){var l=this.gl;return[0,0,l.drawingBufferWidth,l.drawingBufferHeight]},u.prototype.set=function(l){var c=this.current;(l[0]!==c[0]||l[1]!==c[1]||l[2]!==c[2]||l[3]!==c[3]||this.dirty)&&(this.gl.viewport(l[0],l[1],l[2],l[3]),this.current=l,this.dirty=!1)},u}(Ce),$r=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return null},u.prototype.set=function(l){if(l!==this.current||this.dirty){var c=this.gl;c.bindFramebuffer(c.FRAMEBUFFER,l),this.current=l,this.dirty=!1}},u}(Ce),Vr=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return null},u.prototype.set=function(l){if(l!==this.current||this.dirty){var c=this.gl;c.bindRenderbuffer(c.RENDERBUFFER,l),this.current=l,this.dirty=!1}},u}(Ce),yi=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return null},u.prototype.set=function(l){if(l!==this.current||this.dirty){var c=this.gl;c.bindTexture(c.TEXTURE_2D,l),this.current=l,this.dirty=!1}},u}(Ce),Yr=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return null},u.prototype.set=function(l){if(l!==this.current||this.dirty){var c=this.gl;c.bindBuffer(c.ARRAY_BUFFER,l),this.current=l,this.dirty=!1}},u}(Ce),gi=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return null},u.prototype.set=function(l){var c=this.gl;c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,l),this.current=l,this.dirty=!1},u}(Ce),An=function(a){function u(l){a.call(this,l),this.vao=l.extVertexArrayObject}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return null},u.prototype.set=function(l){this.vao&&(l!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(l),this.current=l,this.dirty=!1)},u}(Ce),Ni=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return 4},u.prototype.set=function(l){if(l!==this.current||this.dirty){var c=this.gl;c.pixelStorei(c.UNPACK_ALIGNMENT,l),this.current=l,this.dirty=!1}},u}(Ce),Hi=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return!1},u.prototype.set=function(l){if(l!==this.current||this.dirty){var c=this.gl;c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,l),this.current=l,this.dirty=!1}},u}(Ce),vi=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return!1},u.prototype.set=function(l){if(l!==this.current||this.dirty){var c=this.gl;c.pixelStorei(c.UNPACK_FLIP_Y_WEBGL,l),this.current=l,this.dirty=!1}},u}(Ce),xr=function(a){function u(l,c){a.call(this,l),this.context=l,this.parent=c}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getDefault=function(){return null},u}(Ce),k=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.setDirty=function(){this.dirty=!0},u.prototype.set=function(l){if(l!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var c=this.gl;c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,l,0),this.current=l,this.dirty=!1}},u}(xr),O=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.set=function(l){if(l!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var c=this.gl;c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,l),this.current=l,this.dirty=!1}},u}(xr),B=function(a,u,l,c){this.context=a,this.width=u,this.height=l;var y=this.framebuffer=a.gl.createFramebuffer();this.colorAttachment=new k(a,y),c&&(this.depthAttachment=new O(a,y))};B.prototype.destroy=function(){var a=this.context.gl,u=this.colorAttachment.get();if(u&&a.deleteTexture(u),this.depthAttachment){var l=this.depthAttachment.get();l&&a.deleteRenderbuffer(l)}a.deleteFramebuffer(this.framebuffer)};var H=function(a,u,l){this.func=a,this.mask=u,this.range=l};H.ReadOnly=!1,H.ReadWrite=!0,H.disabled=new H(519,H.ReadOnly,[0,1]);var rt=function(a,u,l,c,y,_){this.test=a,this.ref=u,this.mask=l,this.fail=c,this.depthFail=y,this.pass=_};rt.disabled=new rt({func:519,mask:0},0,0,7680,7680,7680);var pt=function(a,u,l){this.blendFunction=a,this.blendColor=u,this.mask=l};pt.disabled=new pt(pt.Replace=[1,0],i.Color.transparent,[!1,!1,!1,!1]),pt.unblended=new pt(pt.Replace,i.Color.transparent,[!0,!0,!0,!0]),pt.alphaBlended=new pt([1,771],i.Color.transparent,[!0,!0,!0,!0]);var gt=function(a,u,l){this.enable=a,this.mode=u,this.frontFace=l};gt.disabled=new gt(!1,1029,2305),gt.backCCW=new gt(!0,1029,2305);var ht=function(a){this.gl=a,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Cn(this),this.clearDepth=new Ar(this),this.clearStencil=new Ki(this),this.colorMask=new zo(this),this.depthMask=new Qi(this),this.stencilMask=new bt(this),this.stencilFunc=new q(this),this.stencilOp=new F(this),this.stencilTest=new W(this),this.depthRange=new nt(this),this.depthTest=new dt(this),this.depthFunc=new Mt(this),this.blend=new Dt(this),this.blendFunc=new Vt(this),this.blendColor=new ye(this),this.blendEquation=new Ae(this),this.cullFace=new qe(this),this.cullFaceSide=new Ge(this),this.frontFace=new Xe(this),this.program=new yr(this),this.activeTexture=new ar(this),this.viewport=new ur(this),this.bindFramebuffer=new $r(this),this.bindRenderbuffer=new Vr(this),this.bindTexture=new yi(this),this.bindVertexBuffer=new Yr(this),this.bindElementBuffer=new gi(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new An(this),this.pixelStoreUnpack=new Ni(this),this.pixelStoreUnpackPremultiplyAlpha=new Hi(this),this.pixelStoreUnpackFlipY=new vi(this),this.extTextureFilterAnisotropic=a.getExtension("EXT_texture_filter_anisotropic")||a.getExtension("MOZ_EXT_texture_filter_anisotropic")||a.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=a.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=a.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(a.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=a.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=a.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=a.getParameter(a.MAX_TEXTURE_SIZE)};ht.prototype.setDefault=function(){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()},ht.prototype.setDirty=function(){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.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0},ht.prototype.createIndexBuffer=function(a,u){return new oi(this,a,u)},ht.prototype.createVertexBuffer=function(a,u,l){return new Oi(this,a,u,l)},ht.prototype.createRenderbuffer=function(a,u,l){var c=this.gl,y=c.createRenderbuffer();return this.bindRenderbuffer.set(y),c.renderbufferStorage(c.RENDERBUFFER,a,u,l),this.bindRenderbuffer.set(null),y},ht.prototype.createFramebuffer=function(a,u,l){return new B(this,a,u,l)},ht.prototype.clear=function(a){var u=a.color,l=a.depth,c=this.gl,y=0;u&&(y|=c.COLOR_BUFFER_BIT,this.clearColor.set(u),this.colorMask.set([!0,!0,!0,!0])),l!==void 0&&(y|=c.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(l),this.depthMask.set(!0)),c.clear(y)},ht.prototype.setCullFace=function(a){a.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(a.mode),this.frontFace.set(a.frontFace))},ht.prototype.setDepthMode=function(a){a.func!==this.gl.ALWAYS||a.mask?(this.depthTest.set(!0),this.depthFunc.set(a.func),this.depthMask.set(a.mask),this.depthRange.set(a.range)):this.depthTest.set(!1)},ht.prototype.setStencilMode=function(a){a.test.func!==this.gl.ALWAYS||a.mask?(this.stencilTest.set(!0),this.stencilMask.set(a.mask),this.stencilOp.set([a.fail,a.depthFail,a.pass]),this.stencilFunc.set({func:a.test.func,ref:a.ref,mask:a.test.mask})):this.stencilTest.set(!1)},ht.prototype.setColorMode=function(a){i.deepEqual(a.blendFunction,pt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(a.blendFunction),this.blendColor.set(a.blendColor)),this.colorMask.set(a.mask)},ht.prototype.unbindVAO=function(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)};var X=function(a){function u(l,c,y){var _=this;a.call(this),this.id=l,this.dispatcher=y,this.on("data",function(x){x.dataType==="source"&&x.sourceDataType==="metadata"&&(_._sourceLoaded=!0),_._sourceLoaded&&!_._paused&&x.dataType==="source"&&x.sourceDataType==="content"&&(_.reload(),_.transform&&_.update(_.transform))}),this.on("error",function(){_._sourceErrored=!0}),this._source=function(x,S,A,R){var G=new Ai[S.type](x,S,A,R);if(G.id!==x)throw new Error("Expected Source id to be "+x+" instead of "+G.id);return i.bindAll(["load","abort","unload","serialize","prepare"],G),G}(l,c,y,this),this._tiles={},this._cache=new We(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new i.SourceFeatureState}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.onAdd=function(l){this.map=l,this._maxTileCacheSize=l?l._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(l)},u.prototype.onRemove=function(l){this._source&&this._source.onRemove&&this._source.onRemove(l)},u.prototype.loaded=function(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(var l in this._tiles){var c=this._tiles[l];if(c.state!=="loaded"&&c.state!=="errored")return!1}return!0},u.prototype.getSource=function(){return this._source},u.prototype.pause=function(){this._paused=!0},u.prototype.resume=function(){if(this._paused){var l=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,l&&this.reload(),this.transform&&this.update(this.transform)}},u.prototype._loadTile=function(l,c){return this._source.loadTile(l,c)},u.prototype._unloadTile=function(l){if(this._source.unloadTile)return this._source.unloadTile(l,function(){})},u.prototype._abortTile=function(l){if(this._source.abortTile)return this._source.abortTile(l,function(){})},u.prototype.serialize=function(){return this._source.serialize()},u.prototype.prepare=function(l){for(var c in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){var y=this._tiles[c];y.upload(l),y.prepare(this.map.style.imageManager)}},u.prototype.getIds=function(){return i.values(this._tiles).map(function(l){return l.tileID}).sort(at).map(function(l){return l.key})},u.prototype.getRenderableIds=function(l){var c=this,y=[];for(var _ in this._tiles)this._isIdRenderable(_,l)&&y.push(this._tiles[_]);return l?y.sort(function(x,S){var A=x.tileID,R=S.tileID,G=new i.Point(A.canonical.x,A.canonical.y)._rotate(c.transform.angle),Z=new i.Point(R.canonical.x,R.canonical.y)._rotate(c.transform.angle);return A.overscaledZ-R.overscaledZ||Z.y-G.y||Z.x-G.x}).map(function(x){return x.tileID.key}):y.map(function(x){return x.tileID}).sort(at).map(function(x){return x.key})},u.prototype.hasRenderableParent=function(l){var c=this.findLoadedParent(l,0);return!!c&&this._isIdRenderable(c.tileID.key)},u.prototype._isIdRenderable=function(l,c){return this._tiles[l]&&this._tiles[l].hasData()&&!this._coveredTiles[l]&&(c||!this._tiles[l].holdingForFade())},u.prototype.reload=function(){if(this._paused)this._shouldReloadOnResume=!0;else for(var l in this._cache.reset(),this._tiles)this._tiles[l].state!=="errored"&&this._reloadTile(l,"reloading")},u.prototype._reloadTile=function(l,c){var y=this._tiles[l];y&&(y.state!=="loading"&&(y.state=c),this._loadTile(y,this._tileLoaded.bind(this,y,l,c)))},u.prototype._tileLoaded=function(l,c,y,_){if(_)return l.state="errored",void(_.status!==404?this._source.fire(new i.ErrorEvent(_,{tile:l})):this.update(this.transform));l.timeAdded=i.browser.now(),y==="expired"&&(l.refreshedUponExpiration=!0),this._setTileReloadTimer(c,l),this.getSource().type==="raster-dem"&&l.dem&&this._backfillDEM(l),this._state.initializeTileState(l,this.map?this.map.painter:null),this._source.fire(new i.Event("data",{dataType:"source",tile:l,coord:l.tileID}))},u.prototype._backfillDEM=function(l){for(var c=this.getRenderableIds(),y=0;y<c.length;y++){var _=c[y];if(l.neighboringTiles&&l.neighboringTiles[_]){var x=this.getTileByID(_);S(l,x),S(x,l)}}function S(A,R){A.needsHillshadePrepare=!0;var G=R.tileID.canonical.x-A.tileID.canonical.x,Z=R.tileID.canonical.y-A.tileID.canonical.y,V=Math.pow(2,A.tileID.canonical.z),it=R.tileID.key;G===0&&Z===0||Math.abs(Z)>1||(Math.abs(G)>1&&(Math.abs(G+V)===1?G+=V:Math.abs(G-V)===1&&(G-=V)),R.dem&&A.dem&&(A.dem.backfillBorder(R.dem,G,Z),A.neighboringTiles&&A.neighboringTiles[it]&&(A.neighboringTiles[it].backfilled=!0)))}},u.prototype.getTile=function(l){return this.getTileByID(l.key)},u.prototype.getTileByID=function(l){return this._tiles[l]},u.prototype._retainLoadedChildren=function(l,c,y,_){for(var x in this._tiles){var S=this._tiles[x];if(!(_[x]||!S.hasData()||S.tileID.overscaledZ<=c||S.tileID.overscaledZ>y)){for(var A=S.tileID;S&&S.tileID.overscaledZ>c+1;){var R=S.tileID.scaledTo(S.tileID.overscaledZ-1);(S=this._tiles[R.key])&&S.hasData()&&(A=R)}for(var G=A;G.overscaledZ>c;)if(l[(G=G.scaledTo(G.overscaledZ-1)).key]){_[A.key]=A;break}}}},u.prototype.findLoadedParent=function(l,c){if(l.key in this._loadedParentTiles){var y=this._loadedParentTiles[l.key];return y&&y.tileID.overscaledZ>=c?y:null}for(var _=l.overscaledZ-1;_>=c;_--){var x=l.scaledTo(_),S=this._getLoadedTile(x);if(S)return S}},u.prototype._getLoadedTile=function(l){var c=this._tiles[l.key];return c&&c.hasData()?c:this._cache.getByKey(l.wrapped().key)},u.prototype.updateCacheSize=function(l){var c=Math.ceil(l.width/this._source.tileSize)+1,y=Math.ceil(l.height/this._source.tileSize)+1,_=Math.floor(c*y*5),x=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,_):_;this._cache.setMaxSize(x)},u.prototype.handleWrapJump=function(l){var c=Math.round((l-(this._prevLng===void 0?l:this._prevLng))/360);if(this._prevLng=l,c){var y={};for(var _ in this._tiles){var x=this._tiles[_];x.tileID=x.tileID.unwrapTo(x.tileID.wrap+c),y[x.tileID.key]=x}for(var S in this._tiles=y,this._timers)clearTimeout(this._timers[S]),delete this._timers[S];for(var A in this._tiles)this._setTileReloadTimer(A,this._tiles[A])}},u.prototype.update=function(l){var c=this;if(this.transform=l,this._sourceLoaded&&!this._paused){var y;this.updateCacheSize(l),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?y=l.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(Lt){return new i.OverscaledTileID(Lt.canonical.z,Lt.wrap,Lt.canonical.z,Lt.canonical.x,Lt.canonical.y)}):(y=l.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(y=y.filter(function(Lt){return c._source.hasTile(Lt)}))):y=[];var _=l.coveringZoomLevel(this._source),x=Math.max(_-u.maxOverzooming,this._source.minzoom),S=Math.max(_+u.maxUnderzooming,this._source.minzoom),A=this._updateRetainedTiles(y,_);if(Ot(this._source.type)){for(var R={},G={},Z=0,V=Object.keys(A);Z<V.length;Z+=1){var it=V[Z],et=A[it],ut=this._tiles[it];if(ut&&!(ut.fadeEndTime&&ut.fadeEndTime<=i.browser.now())){var tt=this.findLoadedParent(et,x);tt&&(this._addTile(tt.tileID),R[tt.tileID.key]=tt.tileID),G[it]=et}}for(var lt in this._retainLoadedChildren(G,_,S,A),R)A[lt]||(this._coveredTiles[lt]=!0,A[lt]=R[lt])}for(var yt in A)this._tiles[yt].clearFadeHold();for(var _t=0,It=i.keysDifference(this._tiles,A);_t<It.length;_t+=1){var Tt=It[_t],Ct=this._tiles[Tt];Ct.hasSymbolBuckets&&!Ct.holdingForFade()?Ct.setHoldDuration(this.map._fadeDuration):Ct.hasSymbolBuckets&&!Ct.symbolFadeFinished()||this._removeTile(Tt)}this._updateLoadedParentTileCache()}},u.prototype.releaseSymbolFadeTiles=function(){for(var l in this._tiles)this._tiles[l].holdingForFade()&&this._removeTile(l)},u.prototype._updateRetainedTiles=function(l,c){for(var y={},_={},x=Math.max(c-u.maxOverzooming,this._source.minzoom),S=Math.max(c+u.maxUnderzooming,this._source.minzoom),A={},R=0,G=l;R<G.length;R+=1){var Z=G[R],V=this._addTile(Z);y[Z.key]=Z,V.hasData()||c<this._source.maxzoom&&(A[Z.key]=Z)}this._retainLoadedChildren(A,c,S,y);for(var it=0,et=l;it<et.length;it+=1){var ut=et[it],tt=this._tiles[ut.key];if(!tt.hasData()){if(c+1>this._source.maxzoom){var lt=ut.children(this._source.maxzoom)[0],yt=this.getTile(lt);if(yt&&yt.hasData()){y[lt.key]=lt;continue}}else{var _t=ut.children(this._source.maxzoom);if(y[_t[0].key]&&y[_t[1].key]&&y[_t[2].key]&&y[_t[3].key])continue}for(var It=tt.wasRequested(),Tt=ut.overscaledZ-1;Tt>=x;--Tt){var Ct=ut.scaledTo(Tt);if(_[Ct.key]||(_[Ct.key]=!0,!(tt=this.getTile(Ct))&&It&&(tt=this._addTile(Ct)),tt&&(y[Ct.key]=Ct,It=tt.wasRequested(),tt.hasData())))break}}}return y},u.prototype._updateLoadedParentTileCache=function(){for(var l in this._loadedParentTiles={},this._tiles){for(var c=[],y=void 0,_=this._tiles[l].tileID;_.overscaledZ>0;){if(_.key in this._loadedParentTiles){y=this._loadedParentTiles[_.key];break}c.push(_.key);var x=_.scaledTo(_.overscaledZ-1);if(y=this._getLoadedTile(x))break;_=x}for(var S=0,A=c;S<A.length;S+=1)this._loadedParentTiles[A[S]]=y}},u.prototype._addTile=function(l){var c=this._tiles[l.key];if(c)return c;(c=this._cache.getAndRemove(l))&&(this._setTileReloadTimer(l.key,c),c.tileID=l,this._state.initializeTileState(c,this.map?this.map.painter:null),this._cacheTimers[l.key]&&(clearTimeout(this._cacheTimers[l.key]),delete this._cacheTimers[l.key],this._setTileReloadTimer(l.key,c)));var y=Boolean(c);return y||(c=new i.Tile(l,this._source.tileSize*l.overscaleFactor()),this._loadTile(c,this._tileLoaded.bind(this,c,l.key,c.state))),c?(c.uses++,this._tiles[l.key]=c,y||this._source.fire(new i.Event("dataloading",{tile:c,coord:c.tileID,dataType:"source"})),c):null},u.prototype._setTileReloadTimer=function(l,c){var y=this;l in this._timers&&(clearTimeout(this._timers[l]),delete this._timers[l]);var _=c.getExpiryTimeout();_&&(this._timers[l]=setTimeout(function(){y._reloadTile(l,"expired"),delete y._timers[l]},_))},u.prototype._removeTile=function(l){var c=this._tiles[l];c&&(c.uses--,delete this._tiles[l],this._timers[l]&&(clearTimeout(this._timers[l]),delete this._timers[l]),c.uses>0||(c.hasData()&&c.state!=="reloading"?this._cache.add(c.tileID,c,c.getExpiryTimeout()):(c.aborted=!0,this._abortTile(c),this._unloadTile(c))))},u.prototype.clearTiles=function(){for(var l in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(l);this._cache.reset()},u.prototype.tilesIn=function(l,c,y){var _=this,x=[],S=this.transform;if(!S)return x;for(var A=y?S.getCameraQueryGeometry(l):l,R=l.map(function(Tt){return S.pointCoordinate(Tt)}),G=A.map(function(Tt){return S.pointCoordinate(Tt)}),Z=this.getIds(),V=1/0,it=1/0,et=-1/0,ut=-1/0,tt=0,lt=G;tt<lt.length;tt+=1){var yt=lt[tt];V=Math.min(V,yt.x),it=Math.min(it,yt.y),et=Math.max(et,yt.x),ut=Math.max(ut,yt.y)}for(var _t=function(Tt){var Ct=_._tiles[Z[Tt]];if(!Ct.holdingForFade()){var Lt=Ct.tileID,qt=Math.pow(2,S.zoom-Ct.tileID.overscaledZ),Ut=c*Ct.queryPadding*i.EXTENT/Ct.tileSize/qt,ie=[Lt.getTilePoint(new i.MercatorCoordinate(V,it)),Lt.getTilePoint(new i.MercatorCoordinate(et,ut))];if(ie[0].x-Ut<i.EXTENT&&ie[0].y-Ut<i.EXTENT&&ie[1].x+Ut>=0&&ie[1].y+Ut>=0){var _e=R.map(function(xe){return Lt.getTilePoint(xe)}),Se=G.map(function(xe){return Lt.getTilePoint(xe)});x.push({tile:Ct,tileID:Lt,queryGeometry:_e,cameraQueryGeometry:Se,scale:qt})}}},It=0;It<Z.length;It++)_t(It);return x},u.prototype.getVisibleCoordinates=function(l){for(var c=this,y=this.getRenderableIds(l).map(function(A){return c._tiles[A].tileID}),_=0,x=y;_<x.length;_+=1){var S=x[_];S.posMatrix=this.transform.calculatePosMatrix(S.toUnwrapped())}return y},u.prototype.hasTransition=function(){if(this._source.hasTransition())return!0;if(Ot(this._source.type))for(var l in this._tiles){var c=this._tiles[l];if(c.fadeEndTime!==void 0&&c.fadeEndTime>=i.browser.now())return!0}return!1},u.prototype.setFeatureState=function(l,c,y){this._state.updateState(l=l||"_geojsonTileLayer",c,y)},u.prototype.removeFeatureState=function(l,c,y){this._state.removeFeatureState(l=l||"_geojsonTileLayer",c,y)},u.prototype.getFeatureState=function(l,c){return this._state.getState(l=l||"_geojsonTileLayer",c)},u.prototype.setDependencies=function(l,c,y){var _=this._tiles[l];_&&_.setDependencies(c,y)},u.prototype.reloadTilesForDependencies=function(l,c){for(var y in this._tiles)this._tiles[y].hasDependency(l,c)&&this._reloadTile(y,"reloading");this._cache.filter(function(_){return!_.hasDependency(l,c)})},u}(i.Evented);function at(a,u){var l=Math.abs(2*a.wrap)-+(a.wrap<0),c=Math.abs(2*u.wrap)-+(u.wrap<0);return a.overscaledZ-u.overscaledZ||c-l||u.canonical.y-a.canonical.y||u.canonical.x-a.canonical.x}function Ot(a){return a==="raster"||a==="image"||a==="video"}function Wt(){return new i.window.Worker(wu.workerUrl)}X.maxOverzooming=10,X.maxUnderzooming=3;var wt="mapboxgl_preloaded_worker_pool",Ft=function(){this.active={}};Ft.prototype.acquire=function(a){if(!this.workers)for(this.workers=[];this.workers.length<Ft.workerCount;)this.workers.push(new Wt);return this.active[a]=!0,this.workers.slice()},Ft.prototype.release=function(a){delete this.active[a],this.numActive()===0&&(this.workers.forEach(function(u){u.terminate()}),this.workers=null)},Ft.prototype.isPreloaded=function(){return!!this.active[wt]},Ft.prototype.numActive=function(){return Object.keys(this.active).length};var ne,se=Math.floor(i.browser.hardwareConcurrency/2);function ge(){return ne||(ne=new Ft),ne}function kt(a,u){var l={};for(var c in a)c!=="ref"&&(l[c]=a[c]);return i.refProperties.forEach(function(y){y in u&&(l[y]=u[y])}),l}function Jt(a){a=a.slice();for(var u=Object.create(null),l=0;l<a.length;l++)u[a[l].id]=a[l];for(var c=0;c<a.length;c++)"ref"in a[c]&&(a[c]=kt(a[c],u[a[c].ref]));return a}Ft.workerCount=Math.max(Math.min(se,6),1);var Rt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",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"};function Fe(a,u,l){l.push({command:Rt.addSource,args:[a,u[a]]})}function Be(a,u,l){u.push({command:Rt.removeSource,args:[a]}),l[a]=!0}function pe(a,u,l,c){Be(a,l,c),Fe(a,u,l)}function Er(a,u,l){var c;for(c in a[l])if(a[l].hasOwnProperty(c)&&c!=="data"&&!i.deepEqual(a[l][c],u[l][c]))return!1;for(c in u[l])if(u[l].hasOwnProperty(c)&&c!=="data"&&!i.deepEqual(a[l][c],u[l][c]))return!1;return!0}function Ze(a,u,l,c,y,_){var x;for(x in u=u||{},a=a||{})a.hasOwnProperty(x)&&(i.deepEqual(a[x],u[x])||l.push({command:_,args:[c,x,u[x],y]}));for(x in u)u.hasOwnProperty(x)&&!a.hasOwnProperty(x)&&(i.deepEqual(a[x],u[x])||l.push({command:_,args:[c,x,u[x],y]}))}function Pr(a){return a.id}function Nr(a,u){return a[u.id]=u,a}var rr=function(a,u){this.reset(a,u)};rr.prototype.reset=function(a,u){this.points=a||[],this._distances=[0];for(var l=1;l<this.points.length;l++)this._distances[l]=this._distances[l-1]+this.points[l].dist(this.points[l-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(u||0,.5*this.length),this.paddedLength=this.length-2*this.padding},rr.prototype.lerp=function(a){if(this.points.length===1)return this.points[0];a=i.clamp(a,0,1);for(var u=1,l=this._distances[u],c=a*this.paddedLength+this.padding;l<c&&u<this._distances.length;)l=this._distances[++u];var y=u-1,_=this._distances[y],x=l-_,S=x>0?(c-_)/x:0;return this.points[y].mult(1-S).add(this.points[u].mult(S))};var Tr=function(a,u,l){var c=this.boxCells=[],y=this.circleCells=[];this.xCellCount=Math.ceil(a/l),this.yCellCount=Math.ceil(u/l);for(var _=0;_<this.xCellCount*this.yCellCount;_++)c.push([]),y.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=a,this.height=u,this.xScale=this.xCellCount/a,this.yScale=this.yCellCount/u,this.boxUid=0,this.circleUid=0};function Jr(a,u,l,c,y){var _=i.create();return u?(i.scale(_,_,[1/y,1/y,1]),l||i.rotateZ(_,_,c.angle)):i.multiply(_,c.labelPlaneMatrix,a),_}function Mr(a,u,l,c,y){if(u){var _=i.clone(a);return i.scale(_,_,[y,y,1]),l||i.rotateZ(_,_,-c.angle),_}return c.glCoordMatrix}function Ke(a,u){var l=[a.x,a.y,0,1];to(l,l,u);var c=l[3];return{point:new i.Point(l[0]/c,l[1]/c),signedDistanceFromCamera:c}}function Ts(a,u){return .5+a/u*.5}function $e(a,u){var l=a[0]/a[3],c=a[1]/a[3];return l>=-u[0]&&l<=u[0]&&c>=-u[1]&&c<=u[1]}function za(a,u,l,c,y,_,x,S){var A=c?a.textSizeData:a.iconSizeData,R=i.evaluateSizeForZoom(A,l.transform.zoom),G=[256/l.width*2+1,256/l.height*2+1],Z=c?a.text.dynamicLayoutVertexArray:a.icon.dynamicLayoutVertexArray;Z.clear();for(var V=a.lineVertexArray,it=c?a.text.placedSymbolArray:a.icon.placedSymbolArray,et=l.transform.width/l.transform.height,ut=!1,tt=0;tt<it.length;tt++){var lt=it.get(tt);if(lt.hidden||lt.writingMode===i.WritingMode.vertical&&!ut)So(lt.numGlyphs,Z);else{ut=!1;var yt=[lt.anchorX,lt.anchorY,0,1];if(i.transformMat4(yt,yt,u),$e(yt,G)){var _t=Ts(l.transform.cameraToCenterDistance,yt[3]),It=i.evaluateSizeForFeature(A,R,lt),Tt=x?It/_t:It*_t,Ct=new i.Point(lt.anchorX,lt.anchorY),Lt=Ke(Ct,y).point,qt={},Ut=xn(lt,Tt,!1,S,u,y,_,a.glyphOffsetArray,V,Z,Lt,Ct,qt,et);ut=Ut.useVertical,(Ut.notEnoughRoom||ut||Ut.needsFlipping&&xn(lt,Tt,!0,S,u,y,_,a.glyphOffsetArray,V,Z,Lt,Ct,qt,et).notEnoughRoom)&&So(lt.numGlyphs,Z)}else So(lt.numGlyphs,Z)}}c?a.text.dynamicLayoutVertexBuffer.updateData(Z):a.icon.dynamicLayoutVertexBuffer.updateData(Z)}function Ql(a,u,l,c,y,_,x,S,A,R,G){var Z=S.glyphStartIndex+S.numGlyphs,V=S.lineStartIndex,it=S.lineStartIndex+S.lineLength,et=u.getoffsetX(S.glyphStartIndex),ut=u.getoffsetX(Z-1),tt=Da(a*et,l,c,y,_,x,S.segment,V,it,A,R,G);if(!tt)return null;var lt=Da(a*ut,l,c,y,_,x,S.segment,V,it,A,R,G);return lt?{first:tt,last:lt}:null}function Fi(a,u,l,c){return a===i.WritingMode.horizontal&&Math.abs(l.y-u.y)>Math.abs(l.x-u.x)*c?{useVertical:!0}:(a===i.WritingMode.vertical?u.y<l.y:u.x>l.x)?{needsFlipping:!0}:null}function xn(a,u,l,c,y,_,x,S,A,R,G,Z,V,it){var et,ut=u/24,tt=a.lineOffsetX*ut,lt=a.lineOffsetY*ut;if(a.numGlyphs>1){var yt=a.glyphStartIndex+a.numGlyphs,_t=a.lineStartIndex,It=a.lineStartIndex+a.lineLength,Tt=Ql(ut,S,tt,lt,l,G,Z,a,A,_,V);if(!Tt)return{notEnoughRoom:!0};var Ct=Ke(Tt.first.point,x).point,Lt=Ke(Tt.last.point,x).point;if(c&&!l){var qt=Fi(a.writingMode,Ct,Lt,it);if(qt)return qt}et=[Tt.first];for(var Ut=a.glyphStartIndex+1;Ut<yt-1;Ut++)et.push(Da(ut*S.getoffsetX(Ut),tt,lt,l,G,Z,a.segment,_t,It,A,_,V));et.push(Tt.last)}else{if(c&&!l){var ie=Ke(Z,y).point,_e=a.lineStartIndex+a.segment+1,Se=new i.Point(A.getx(_e),A.gety(_e)),xe=Ke(Se,y),nr=xe.signedDistanceFromCamera>0?xe.point:Oh(Z,Se,ie,1,y),ue=Fi(a.writingMode,ie,nr,it);if(ue)return ue}var De=Da(ut*S.getoffsetX(a.glyphStartIndex),tt,lt,l,G,Z,a.segment,a.lineStartIndex,a.lineStartIndex+a.lineLength,A,_,V);if(!De)return{notEnoughRoom:!0};et=[De]}for(var je=0,Oe=et;je<Oe.length;je+=1){var ze=Oe[je];i.addDynamicAttributes(R,ze.point,ze.angle)}return{}}function Oh(a,u,l,c,y){var _=Ke(a.add(a.sub(u)._unit()),y).point,x=l.sub(_);return l.add(x._mult(c/x.mag()))}function Da(a,u,l,c,y,_,x,S,A,R,G,Z){var V=c?a-u:a+u,it=V>0?1:-1,et=0;c&&(it*=-1,et=Math.PI),it<0&&(et+=Math.PI);for(var ut=it>0?S+x:S+x+1,tt=y,lt=y,yt=0,_t=0,It=Math.abs(V),Tt=[];yt+_t<=It;){if((ut+=it)<S||ut>=A)return null;if(lt=tt,Tt.push(tt),(tt=Z[ut])===void 0){var Ct=new i.Point(R.getx(ut),R.gety(ut)),Lt=Ke(Ct,G);if(Lt.signedDistanceFromCamera>0)tt=Z[ut]=Lt.point;else{var qt=ut-it;tt=Oh(yt===0?_:new i.Point(R.getx(qt),R.gety(qt)),Ct,lt,It-yt+1,G)}}yt+=_t,_t=lt.dist(tt)}var Ut=(It-yt)/_t,ie=tt.sub(lt),_e=ie.mult(Ut)._add(lt);_e._add(ie._unit()._perp()._mult(l*it));var Se=et+Math.atan2(tt.y-lt.y,tt.x-lt.x);return Tt.push(_e),{point:_e,angle:Se,path:Tt}}Tr.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},Tr.prototype.insert=function(a,u,l,c,y){this._forEachCell(u,l,c,y,this._insertBoxCell,this.boxUid++),this.boxKeys.push(a),this.bboxes.push(u),this.bboxes.push(l),this.bboxes.push(c),this.bboxes.push(y)},Tr.prototype.insertCircle=function(a,u,l,c){this._forEachCell(u-c,l-c,u+c,l+c,this._insertCircleCell,this.circleUid++),this.circleKeys.push(a),this.circles.push(u),this.circles.push(l),this.circles.push(c)},Tr.prototype._insertBoxCell=function(a,u,l,c,y,_){this.boxCells[y].push(_)},Tr.prototype._insertCircleCell=function(a,u,l,c,y,_){this.circleCells[y].push(_)},Tr.prototype._query=function(a,u,l,c,y,_){if(l<0||a>this.width||c<0||u>this.height)return!y&&[];var x=[];if(a<=0&&u<=0&&this.width<=l&&this.height<=c){if(y)return!0;for(var S=0;S<this.boxKeys.length;S++)x.push({key:this.boxKeys[S],x1:this.bboxes[4*S],y1:this.bboxes[4*S+1],x2:this.bboxes[4*S+2],y2:this.bboxes[4*S+3]});for(var A=0;A<this.circleKeys.length;A++){var R=this.circles[3*A],G=this.circles[3*A+1],Z=this.circles[3*A+2];x.push({key:this.circleKeys[A],x1:R-Z,y1:G-Z,x2:R+Z,y2:G+Z})}return _?x.filter(_):x}return this._forEachCell(a,u,l,c,this._queryCell,x,{hitTest:y,seenUids:{box:{},circle:{}}},_),y?x.length>0:x},Tr.prototype._queryCircle=function(a,u,l,c,y){var _=a-l,x=a+l,S=u-l,A=u+l;if(x<0||_>this.width||A<0||S>this.height)return!c&&[];var R=[];return this._forEachCell(_,S,x,A,this._queryCellCircle,R,{hitTest:c,circle:{x:a,y:u,radius:l},seenUids:{box:{},circle:{}}},y),c?R.length>0:R},Tr.prototype.query=function(a,u,l,c,y){return this._query(a,u,l,c,!1,y)},Tr.prototype.hitTest=function(a,u,l,c,y){return this._query(a,u,l,c,!0,y)},Tr.prototype.hitTestCircle=function(a,u,l,c){return this._queryCircle(a,u,l,!0,c)},Tr.prototype._queryCell=function(a,u,l,c,y,_,x,S){var A=x.seenUids,R=this.boxCells[y];if(R!==null)for(var G=this.bboxes,Z=0,V=R;Z<V.length;Z+=1){var it=V[Z];if(!A.box[it]){A.box[it]=!0;var et=4*it;if(a<=G[et+2]&&u<=G[et+3]&&l>=G[et+0]&&c>=G[et+1]&&(!S||S(this.boxKeys[it]))){if(x.hitTest)return _.push(!0),!0;_.push({key:this.boxKeys[it],x1:G[et],y1:G[et+1],x2:G[et+2],y2:G[et+3]})}}}var ut=this.circleCells[y];if(ut!==null)for(var tt=this.circles,lt=0,yt=ut;lt<yt.length;lt+=1){var _t=yt[lt];if(!A.circle[_t]){A.circle[_t]=!0;var It=3*_t;if(this._circleAndRectCollide(tt[It],tt[It+1],tt[It+2],a,u,l,c)&&(!S||S(this.circleKeys[_t]))){if(x.hitTest)return _.push(!0),!0;var Tt=tt[It],Ct=tt[It+1],Lt=tt[It+2];_.push({key:this.circleKeys[_t],x1:Tt-Lt,y1:Ct-Lt,x2:Tt+Lt,y2:Ct+Lt})}}}},Tr.prototype._queryCellCircle=function(a,u,l,c,y,_,x,S){var A=x.circle,R=x.seenUids,G=this.boxCells[y];if(G!==null)for(var Z=this.bboxes,V=0,it=G;V<it.length;V+=1){var et=it[V];if(!R.box[et]){R.box[et]=!0;var ut=4*et;if(this._circleAndRectCollide(A.x,A.y,A.radius,Z[ut+0],Z[ut+1],Z[ut+2],Z[ut+3])&&(!S||S(this.boxKeys[et])))return _.push(!0),!0}}var tt=this.circleCells[y];if(tt!==null)for(var lt=this.circles,yt=0,_t=tt;yt<_t.length;yt+=1){var It=_t[yt];if(!R.circle[It]){R.circle[It]=!0;var Tt=3*It;if(this._circlesCollide(lt[Tt],lt[Tt+1],lt[Tt+2],A.x,A.y,A.radius)&&(!S||S(this.circleKeys[It])))return _.push(!0),!0}}},Tr.prototype._forEachCell=function(a,u,l,c,y,_,x,S){for(var A=this._convertToXCellCoord(a),R=this._convertToYCellCoord(u),G=this._convertToXCellCoord(l),Z=this._convertToYCellCoord(c),V=A;V<=G;V++)for(var it=R;it<=Z;it++)if(y.call(this,a,u,l,c,this.xCellCount*it+V,_,x,S))return},Tr.prototype._convertToXCellCoord=function(a){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(a*this.xScale)))},Tr.prototype._convertToYCellCoord=function(a){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(a*this.yScale)))},Tr.prototype._circlesCollide=function(a,u,l,c,y,_){var x=c-a,S=y-u,A=l+_;return A*A>x*x+S*S},Tr.prototype._circleAndRectCollide=function(a,u,l,c,y,_,x){var S=(_-c)/2,A=Math.abs(a-(c+S));if(A>S+l)return!1;var R=(x-y)/2,G=Math.abs(u-(y+R));if(G>R+l)return!1;if(A<=S||G<=R)return!0;var Z=A-S,V=G-R;return Z*Z+V*V<=l*l};var Pi=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function So(a,u){for(var l=0;l<a;l++){var c=u.length;u.resize(c+4),u.float32.set(Pi,3*c)}}function to(a,u,l){var c=u[0],y=u[1];return a[0]=l[0]*c+l[4]*y+l[12],a[1]=l[1]*c+l[5]*y+l[13],a[3]=l[3]*c+l[7]*y+l[15],a}var jr=function(a,u,l){u===void 0&&(u=new Tr(a.width+200,a.height+200,25)),l===void 0&&(l=new Tr(a.width+200,a.height+200,25)),this.transform=a,this.grid=u,this.ignoredGrid=l,this.pitchfactor=Math.cos(a._pitch)*a.cameraToCenterDistance,this.screenRightBoundary=a.width+100,this.screenBottomBoundary=a.height+100,this.gridRightBoundary=a.width+200,this.gridBottomBoundary=a.height+200};function bn(a,u,l){return u*(i.EXTENT/(a.tileSize*Math.pow(2,l-a.tileID.overscaledZ)))}jr.prototype.placeCollisionBox=function(a,u,l,c,y){var _=this.projectAndGetPerspectiveRatio(c,a.anchorPointX,a.anchorPointY),x=l*_.perspectiveRatio,S=a.x1*x+_.point.x,A=a.y1*x+_.point.y,R=a.x2*x+_.point.x,G=a.y2*x+_.point.y;return!this.isInsideGrid(S,A,R,G)||!u&&this.grid.hitTest(S,A,R,G,y)?{box:[],offscreen:!1}:{box:[S,A,R,G],offscreen:this.isOffscreen(S,A,R,G)}},jr.prototype.placeCollisionCircles=function(a,u,l,c,y,_,x,S,A,R,G,Z,V){var it=[],et=new i.Point(u.anchorX,u.anchorY),ut=Ke(et,_),tt=Ts(this.transform.cameraToCenterDistance,ut.signedDistanceFromCamera),lt=(R?y/tt:y*tt)/i.ONE_EM,yt=Ke(et,x).point,_t=Ql(lt,c,u.lineOffsetX*lt,u.lineOffsetY*lt,!1,yt,et,u,l,x,{}),It=!1,Tt=!1,Ct=!0;if(_t){for(var Lt=.5*Z*tt+V,qt=new i.Point(-100,-100),Ut=new i.Point(this.screenRightBoundary,this.screenBottomBoundary),ie=new rr,_e=_t.first,Se=_t.last,xe=[],nr=_e.path.length-1;nr>=1;nr--)xe.push(_e.path[nr]);for(var ue=1;ue<Se.path.length;ue++)xe.push(Se.path[ue]);var De=2.5*Lt;if(S){var je=xe.map(function(Xn){return Ke(Xn,S)});xe=je.some(function(Xn){return Xn.signedDistanceFromCamera<=0})?[]:je.map(function(Xn){return Xn.point})}var Oe=[];if(xe.length>0){for(var ze=xe[0].clone(),Re=xe[0].clone(),Pe=1;Pe<xe.length;Pe++)ze.x=Math.min(ze.x,xe[Pe].x),ze.y=Math.min(ze.y,xe[Pe].y),Re.x=Math.max(Re.x,xe[Pe].x),Re.y=Math.max(Re.y,xe[Pe].y);Oe=ze.x>=qt.x&&Re.x<=Ut.x&&ze.y>=qt.y&&Re.y<=Ut.y?[xe]:Re.x<qt.x||ze.x>Ut.x||Re.y<qt.y||ze.y>Ut.y?[]:i.clipLine([xe],qt.x,qt.y,Ut.x,Ut.y)}for(var Ee=0,wr=Oe;Ee<wr.length;Ee+=1){var ai;ie.reset(wr[Ee],.25*Lt),ai=ie.length<=.5*Lt?1:Math.ceil(ie.paddedLength/De)+1;for(var un=0;un<ai;un++){var Li=un/Math.max(ai-1,1),ki=ie.lerp(Li),si=ki.x+100,en=ki.y+100;it.push(si,en,Lt,0);var Mo=si-Lt,hn=en-Lt,cn=si+Lt,Io=en+Lt;if(Ct=Ct&&this.isOffscreen(Mo,hn,cn,Io),Tt=Tt||this.isInsideGrid(Mo,hn,cn,Io),!a&&this.grid.hitTestCircle(si,en,Lt,G)&&(It=!0,!A))return{circles:[],offscreen:!1,collisionDetected:It}}}}return{circles:!A&&It||!Tt?[]:it,offscreen:Ct,collisionDetected:It}},jr.prototype.queryRenderedSymbols=function(a){if(a.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};for(var u=[],l=1/0,c=1/0,y=-1/0,_=-1/0,x=0,S=a;x<S.length;x+=1){var A=S[x],R=new i.Point(A.x+100,A.y+100);l=Math.min(l,R.x),c=Math.min(c,R.y),y=Math.max(y,R.x),_=Math.max(_,R.y),u.push(R)}for(var G={},Z={},V=0,it=this.grid.query(l,c,y,_).concat(this.ignoredGrid.query(l,c,y,_));V<it.length;V+=1){var et=it[V],ut=et.key;if(G[ut.bucketInstanceId]===void 0&&(G[ut.bucketInstanceId]={}),!G[ut.bucketInstanceId][ut.featureIndex]){var tt=[new i.Point(et.x1,et.y1),new i.Point(et.x2,et.y1),new i.Point(et.x2,et.y2),new i.Point(et.x1,et.y2)];i.polygonIntersectsPolygon(u,tt)&&(G[ut.bucketInstanceId][ut.featureIndex]=!0,Z[ut.bucketInstanceId]===void 0&&(Z[ut.bucketInstanceId]=[]),Z[ut.bucketInstanceId].push(ut.featureIndex))}}return Z},jr.prototype.insertCollisionBox=function(a,u,l,c,y){(u?this.ignoredGrid:this.grid).insert({bucketInstanceId:l,featureIndex:c,collisionGroupID:y},a[0],a[1],a[2],a[3])},jr.prototype.insertCollisionCircles=function(a,u,l,c,y){for(var _=u?this.ignoredGrid:this.grid,x={bucketInstanceId:l,featureIndex:c,collisionGroupID:y},S=0;S<a.length;S+=4)_.insertCircle(x,a[S],a[S+1],a[S+2])},jr.prototype.projectAndGetPerspectiveRatio=function(a,u,l){var c=[u,l,0,1];return to(c,c,a),{point:new i.Point((c[0]/c[3]+1)/2*this.transform.width+100,(-c[1]/c[3]+1)/2*this.transform.height+100),perspectiveRatio:.5+this.transform.cameraToCenterDistance/c[3]*.5}},jr.prototype.isOffscreen=function(a,u,l,c){return l<100||a>=this.screenRightBoundary||c<100||u>this.screenBottomBoundary},jr.prototype.isInsideGrid=function(a,u,l,c){return l>=0&&a<this.gridRightBoundary&&c>=0&&u<this.gridBottomBoundary},jr.prototype.getViewportMatrix=function(){var a=i.identity([]);return i.translate(a,a,[-100,-100,0]),a};var $i=function(a,u,l,c){this.opacity=a?Math.max(0,Math.min(1,a.opacity+(a.placed?u:-u))):c&&l?1:0,this.placed=l};$i.prototype.isHidden=function(){return this.opacity===0&&!this.placed};var Pn=function(a,u,l,c,y){this.text=new $i(a?a.text:null,u,l,y),this.icon=new $i(a?a.icon:null,u,c,y)};Pn.prototype.isHidden=function(){return this.text.isHidden()&&this.icon.isHidden()};var Do=function(a,u,l){this.text=a,this.icon=u,this.skipFade=l},$d=function(){this.invProjMatrix=i.create(),this.viewportMatrix=i.create(),this.circles=[]},eo=function(a,u,l,c,y){this.bucketInstanceId=a,this.featureIndex=u,this.sourceLayerIndex=l,this.bucketIndex=c,this.tileID=y},Cp=function(a){this.crossSourceCollisions=a,this.maxGroupID=0,this.collisionGroups={}};function Oo(a,u,l,c,y){var _=i.getAnchorAlignment(a),x=-(_.horizontalAlign-.5)*u,S=-(_.verticalAlign-.5)*l,A=i.evaluateVariableOffset(a,c);return new i.Point(x+A[0]*y,S+A[1]*y)}function Bi(a,u,l,c,y,_){var x=a.x1,S=a.x2,A=a.y1,R=a.y2,G=a.anchorPointX,Z=a.anchorPointY,V=new i.Point(u,l);return c&&V._rotate(y?_:-_),{x1:x+V.x,y1:A+V.y,x2:S+V.x,y2:R+V.y,anchorPointX:G,anchorPointY:Z}}Cp.prototype.get=function(a){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[a]){var u=++this.maxGroupID;this.collisionGroups[a]={ID:u,predicate:function(l){return l.collisionGroupID===u}}}return this.collisionGroups[a]};var _i=function(a,u,l,c){this.transform=a.clone(),this.collisionIndex=new jr(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=u,this.retainedQueryData={},this.collisionGroups=new Cp(l),this.collisionCircleArrays={},this.prevPlacement=c,c&&(c.prevPlacement=void 0),this.placedOrientations={}};function Ms(a,u,l,c,y){a.emplaceBack(u?1:0,l?1:0,c||0,y||0),a.emplaceBack(u?1:0,l?1:0,c||0,y||0),a.emplaceBack(u?1:0,l?1:0,c||0,y||0),a.emplaceBack(u?1:0,l?1:0,c||0,y||0)}_i.prototype.getBucketParts=function(a,u,l,c){var y=l.getBucket(u),_=l.latestFeatureIndex;if(y&&_&&u.id===y.layerIds[0]){var x=l.collisionBoxArray,S=y.layers[0].layout,A=Math.pow(2,this.transform.zoom-l.tileID.overscaledZ),R=l.tileSize/i.EXTENT,G=this.transform.calculatePosMatrix(l.tileID.toUnwrapped()),Z=S.get("text-pitch-alignment")==="map",V=S.get("text-rotation-alignment")==="map",it=bn(l,1,this.transform.zoom),et=Jr(G,Z,V,this.transform,it),ut=null;if(Z){var tt=Mr(G,Z,V,this.transform,it);ut=i.multiply([],this.transform.labelPlaneMatrix,tt)}this.retainedQueryData[y.bucketInstanceId]=new eo(y.bucketInstanceId,_,y.sourceLayerIndex,y.index,l.tileID);var lt={bucket:y,layout:S,posMatrix:G,textLabelPlaneMatrix:et,labelToScreenMatrix:ut,scale:A,textPixelRatio:R,holdingForFade:l.holdingForFade(),collisionBoxArray:x,partiallyEvaluatedTextSize:i.evaluateSizeForZoom(y.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(y.sourceID)};if(c)for(var yt=0,_t=y.sortKeyRanges;yt<_t.length;yt+=1){var It=_t[yt];a.push({sortKey:It.sortKey,symbolInstanceStart:It.symbolInstanceStart,symbolInstanceEnd:It.symbolInstanceEnd,parameters:lt})}else a.push({symbolInstanceStart:0,symbolInstanceEnd:y.symbolInstances.length,parameters:lt})}},_i.prototype.attemptAnchorPlacement=function(a,u,l,c,y,_,x,S,A,R,G,Z,V,it,et){var ut,tt=[Z.textOffset0,Z.textOffset1],lt=Oo(a,l,c,tt,y),yt=this.collisionIndex.placeCollisionBox(Bi(u,lt.x,lt.y,_,x,this.transform.angle),G,S,A,R.predicate);if(!et||this.collisionIndex.placeCollisionBox(Bi(et,lt.x,lt.y,_,x,this.transform.angle),G,S,A,R.predicate).box.length!==0)return yt.box.length>0?(this.prevPlacement&&this.prevPlacement.variableOffsets[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID].text&&(ut=this.prevPlacement.variableOffsets[Z.crossTileID].anchor),this.variableOffsets[Z.crossTileID]={textOffset:tt,width:l,height:c,anchor:a,textBoxScale:y,prevAnchor:ut},this.markUsedJustification(V,a,Z,it),V.allowVerticalPlacement&&(this.markUsedOrientation(V,it,Z),this.placedOrientations[Z.crossTileID]=it),{shift:lt,placedGlyphBoxes:yt}):void 0},_i.prototype.placeLayerBucketPart=function(a,u,l){var c=this,y=a.parameters,_=y.bucket,x=y.layout,S=y.posMatrix,A=y.textLabelPlaneMatrix,R=y.labelToScreenMatrix,G=y.textPixelRatio,Z=y.holdingForFade,V=y.collisionBoxArray,it=y.partiallyEvaluatedTextSize,et=y.collisionGroup,ut=x.get("text-optional"),tt=x.get("icon-optional"),lt=x.get("text-allow-overlap"),yt=x.get("icon-allow-overlap"),_t=x.get("text-rotation-alignment")==="map",It=x.get("text-pitch-alignment")==="map",Tt=x.get("icon-text-fit")!=="none",Ct=x.get("symbol-z-order")==="viewport-y",Lt=lt&&(yt||!_.hasIconData()||tt),qt=yt&&(lt||!_.hasTextData()||ut);!_.collisionArrays&&V&&_.deserializeCollisionBoxes(V);var Ut=function(ue,De){if(!u[ue.crossTileID])if(Z)c.placements[ue.crossTileID]=new Do(!1,!1,!1);else{var je,Oe=!1,ze=!1,Re=!0,Pe=null,Ee={box:null,offscreen:null},wr={box:null,offscreen:null},ai=null,un=null,Li=0,ki=0,si=0;De.textFeatureIndex?Li=De.textFeatureIndex:ue.useRuntimeCollisionCircles&&(Li=ue.featureIndex),De.verticalTextFeatureIndex&&(ki=De.verticalTextFeatureIndex);var en=De.textBox;if(en){var Mo=function(li){var ti=i.WritingMode.horizontal;if(_.allowVerticalPlacement&&!li&&c.prevPlacement){var pn=c.prevPlacement.placedOrientations[ue.crossTileID];pn&&(c.placedOrientations[ue.crossTileID]=pn,c.markUsedOrientation(_,ti=pn,ue))}return ti},hn=function(li,ti){if(_.allowVerticalPlacement&&ue.numVerticalGlyphVertices>0&&De.verticalTextBox)for(var pn=0,Ml=_.writingModes;pn<Ml.length&&(Ml[pn]===i.WritingMode.vertical?(Ee=ti(),wr=Ee):Ee=li(),!(Ee&&Ee.box&&Ee.box.length));pn+=1);else Ee=li()};if(x.get("text-variable-anchor")){var cn=x.get("text-variable-anchor");if(c.prevPlacement&&c.prevPlacement.variableOffsets[ue.crossTileID]){var Io=c.prevPlacement.variableOffsets[ue.crossTileID];cn.indexOf(Io.anchor)>0&&(cn=cn.filter(function(li){return li!==Io.anchor})).unshift(Io.anchor)}var Xn=function(li,ti,pn){for(var Ml=li.x2-li.x1,Su=li.y2-li.y1,dm=ue.textBoxScale,Eu=Tt&&!yt?ti:null,Tu={box:[],offscreen:!1},$p=lt?2*cn.length:cn.length,Il=0;Il<$p;++Il){var Cl=c.attemptAnchorPlacement(cn[Il%cn.length],li,Ml,Su,dm,_t,It,G,S,et,Il>=cn.length,ue,_,pn,Eu);if(Cl&&(Tu=Cl.placedGlyphBoxes)&&Tu.box&&Tu.box.length){Oe=!0,Pe=Cl.shift;break}}return Tu};hn(function(){return Xn(en,De.iconBox,i.WritingMode.horizontal)},function(){var li=De.verticalTextBox;return _.allowVerticalPlacement&&!(Ee&&Ee.box&&Ee.box.length)&&ue.numVerticalGlyphVertices>0&&li?Xn(li,De.verticalIconBox,i.WritingMode.vertical):{box:null,offscreen:null}}),Ee&&(Oe=Ee.box,Re=Ee.offscreen);var lc=Mo(Ee&&Ee.box);if(!Oe&&c.prevPlacement){var fa=c.prevPlacement.variableOffsets[ue.crossTileID];fa&&(c.variableOffsets[ue.crossTileID]=fa,c.markUsedJustification(_,fa.anchor,ue,lc))}}else{var Os=function(li,ti){var pn=c.collisionIndex.placeCollisionBox(li,lt,G,S,et.predicate);return pn&&pn.box&&pn.box.length&&(c.markUsedOrientation(_,ti,ue),c.placedOrientations[ue.crossTileID]=ti),pn};hn(function(){return Os(en,i.WritingMode.horizontal)},function(){var li=De.verticalTextBox;return _.allowVerticalPlacement&&ue.numVerticalGlyphVertices>0&&li?Os(li,i.WritingMode.vertical):{box:null,offscreen:null}}),Mo(Ee&&Ee.box&&Ee.box.length)}}if(Oe=(je=Ee)&&je.box&&je.box.length>0,Re=je&&je.offscreen,ue.useRuntimeCollisionCircles){var Ya=_.text.placedSymbolArray.get(ue.centerJustifiedTextSymbolIndex),Tl=i.evaluateSizeForFeature(_.textSizeData,it,Ya),Ns=x.get("text-padding");ai=c.collisionIndex.placeCollisionCircles(lt,Ya,_.lineVertexArray,_.glyphOffsetArray,Tl,S,A,R,l,It,et.predicate,ue.collisionCircleDiameter,Ns),Oe=lt||ai.circles.length>0&&!ai.collisionDetected,Re=Re&&ai.offscreen}if(De.iconFeatureIndex&&(si=De.iconFeatureIndex),De.iconBox){var Co=function(li){var ti=Tt&&Pe?Bi(li,Pe.x,Pe.y,_t,It,c.transform.angle):li;return c.collisionIndex.placeCollisionBox(ti,yt,G,S,et.predicate)};ze=wr&&wr.box&&wr.box.length&&De.verticalIconBox?(un=Co(De.verticalIconBox)).box.length>0:(un=Co(De.iconBox)).box.length>0,Re=Re&&un.offscreen}var Fs=ut||ue.numHorizontalGlyphVertices===0&&ue.numVerticalGlyphVertices===0,xi=tt||ue.numIconVertices===0;if(Fs||xi?xi?Fs||(ze=ze&&Oe):Oe=ze&&Oe:ze=Oe=ze&&Oe,Oe&&je&&je.box&&c.collisionIndex.insertCollisionBox(je.box,x.get("text-ignore-placement"),_.bucketInstanceId,wr&&wr.box&&ki?ki:Li,et.ID),ze&&un&&c.collisionIndex.insertCollisionBox(un.box,x.get("icon-ignore-placement"),_.bucketInstanceId,si,et.ID),ai&&(Oe&&c.collisionIndex.insertCollisionCircles(ai.circles,x.get("text-ignore-placement"),_.bucketInstanceId,Li,et.ID),l)){var Vo=_.bucketInstanceId,yo=c.collisionCircleArrays[Vo];yo===void 0&&(yo=c.collisionCircleArrays[Vo]=new $d);for(var Ja=0;Ja<ai.circles.length;Ja+=4)yo.circles.push(ai.circles[Ja+0]),yo.circles.push(ai.circles[Ja+1]),yo.circles.push(ai.circles[Ja+2]),yo.circles.push(ai.collisionDetected?1:0)}c.placements[ue.crossTileID]=new Do(Oe||Lt,ze||qt,Re||_.justReloaded),u[ue.crossTileID]=!0}};if(Ct)for(var ie=_.getSortedSymbolIndexes(this.transform.angle),_e=ie.length-1;_e>=0;--_e){var Se=ie[_e];Ut(_.symbolInstances.get(Se),_.collisionArrays[Se])}else for(var xe=a.symbolInstanceStart;xe<a.symbolInstanceEnd;xe++)Ut(_.symbolInstances.get(xe),_.collisionArrays[xe]);if(l&&_.bucketInstanceId in this.collisionCircleArrays){var nr=this.collisionCircleArrays[_.bucketInstanceId];i.invert(nr.invProjMatrix,S),nr.viewportMatrix=this.collisionIndex.getViewportMatrix()}_.justReloaded=!1},_i.prototype.markUsedJustification=function(a,u,l,c){var y;y=c===i.WritingMode.vertical?l.verticalPlacedTextSymbolIndex:{left:l.leftJustifiedTextSymbolIndex,center:l.centerJustifiedTextSymbolIndex,right:l.rightJustifiedTextSymbolIndex}[i.getAnchorJustification(u)];for(var _=0,x=[l.leftJustifiedTextSymbolIndex,l.centerJustifiedTextSymbolIndex,l.rightJustifiedTextSymbolIndex,l.verticalPlacedTextSymbolIndex];_<x.length;_+=1){var S=x[_];S>=0&&(a.text.placedSymbolArray.get(S).crossTileID=y>=0&&S!==y?0:l.crossTileID)}},_i.prototype.markUsedOrientation=function(a,u,l){for(var c=u===i.WritingMode.horizontal||u===i.WritingMode.horizontalOnly?u:0,y=u===i.WritingMode.vertical?u:0,_=0,x=[l.leftJustifiedTextSymbolIndex,l.centerJustifiedTextSymbolIndex,l.rightJustifiedTextSymbolIndex];_<x.length;_+=1)a.text.placedSymbolArray.get(x[_]).placedOrientation=c;l.verticalPlacedTextSymbolIndex&&(a.text.placedSymbolArray.get(l.verticalPlacedTextSymbolIndex).placedOrientation=y)},_i.prototype.commit=function(a){this.commitTime=a,this.zoomAtLastRecencyCheck=this.transform.zoom;var u=this.prevPlacement,l=!1;this.prevZoomAdjustment=u?u.zoomAdjustment(this.transform.zoom):0;var c=u?u.symbolFadeChange(a):1,y=u?u.opacities:{},_=u?u.variableOffsets:{},x=u?u.placedOrientations:{};for(var S in this.placements){var A=this.placements[S],R=y[S];R?(this.opacities[S]=new Pn(R,c,A.text,A.icon),l=l||A.text!==R.text.placed||A.icon!==R.icon.placed):(this.opacities[S]=new Pn(null,c,A.text,A.icon,A.skipFade),l=l||A.text||A.icon)}for(var G in y){var Z=y[G];if(!this.opacities[G]){var V=new Pn(Z,c,!1,!1);V.isHidden()||(this.opacities[G]=V,l=l||Z.text.placed||Z.icon.placed)}}for(var it in _)this.variableOffsets[it]||!this.opacities[it]||this.opacities[it].isHidden()||(this.variableOffsets[it]=_[it]);for(var et in x)this.placedOrientations[et]||!this.opacities[et]||this.opacities[et].isHidden()||(this.placedOrientations[et]=x[et]);l?this.lastPlacementChangeTime=a:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=u?u.lastPlacementChangeTime:a)},_i.prototype.updateLayerOpacities=function(a,u){for(var l={},c=0,y=u;c<y.length;c+=1){var _=y[c],x=_.getBucket(a);x&&_.latestFeatureIndex&&a.id===x.layerIds[0]&&this.updateBucketOpacities(x,l,_.collisionBoxArray)}},_i.prototype.updateBucketOpacities=function(a,u,l){var c=this;a.hasTextData()&&a.text.opacityVertexArray.clear(),a.hasIconData()&&a.icon.opacityVertexArray.clear(),a.hasIconCollisionBoxData()&&a.iconCollisionBox.collisionVertexArray.clear(),a.hasTextCollisionBoxData()&&a.textCollisionBox.collisionVertexArray.clear();var y=a.layers[0].layout,_=new Pn(null,0,!1,!1,!0),x=y.get("text-allow-overlap"),S=y.get("icon-allow-overlap"),A=y.get("text-variable-anchor"),R=y.get("text-rotation-alignment")==="map",G=y.get("text-pitch-alignment")==="map",Z=y.get("icon-text-fit")!=="none",V=new Pn(null,0,x&&(S||!a.hasIconData()||y.get("icon-optional")),S&&(x||!a.hasTextData()||y.get("text-optional")),!0);!a.collisionArrays&&l&&(a.hasIconCollisionBoxData()||a.hasTextCollisionBoxData())&&a.deserializeCollisionBoxes(l);for(var it=function(lt,yt,_t){for(var It=0;It<yt/4;It++)lt.opacityVertexArray.emplaceBack(_t)},et=function(lt){var yt=a.symbolInstances.get(lt),_t=yt.numHorizontalGlyphVertices,It=yt.numVerticalGlyphVertices,Tt=yt.crossTileID,Ct=c.opacities[Tt];u[Tt]?Ct=_:Ct||(c.opacities[Tt]=Ct=V),u[Tt]=!0;var Lt=yt.numIconVertices>0,qt=c.placedOrientations[yt.crossTileID],Ut=qt===i.WritingMode.vertical,ie=qt===i.WritingMode.horizontal||qt===i.WritingMode.horizontalOnly;if(_t>0||It>0){var _e=Fh(Ct.text);it(a.text,_t,Ut?tu:_e),it(a.text,It,ie?tu:_e);var Se=Ct.text.isHidden();[yt.rightJustifiedTextSymbolIndex,yt.centerJustifiedTextSymbolIndex,yt.leftJustifiedTextSymbolIndex].forEach(function(Ee){Ee>=0&&(a.text.placedSymbolArray.get(Ee).hidden=Se||Ut?1:0)}),yt.verticalPlacedTextSymbolIndex>=0&&(a.text.placedSymbolArray.get(yt.verticalPlacedTextSymbolIndex).hidden=Se||ie?1:0);var xe=c.variableOffsets[yt.crossTileID];xe&&c.markUsedJustification(a,xe.anchor,yt,qt);var nr=c.placedOrientations[yt.crossTileID];nr&&(c.markUsedJustification(a,"left",yt,nr),c.markUsedOrientation(a,nr,yt))}if(Lt){var ue=Fh(Ct.icon),De=!(Z&&yt.verticalPlacedIconSymbolIndex&&Ut);yt.placedIconSymbolIndex>=0&&(it(a.icon,yt.numIconVertices,De?ue:tu),a.icon.placedSymbolArray.get(yt.placedIconSymbolIndex).hidden=Ct.icon.isHidden()),yt.verticalPlacedIconSymbolIndex>=0&&(it(a.icon,yt.numVerticalIconVertices,De?tu:ue),a.icon.placedSymbolArray.get(yt.verticalPlacedIconSymbolIndex).hidden=Ct.icon.isHidden())}if(a.hasIconCollisionBoxData()||a.hasTextCollisionBoxData()){var je=a.collisionArrays[lt];if(je){var Oe=new i.Point(0,0);if(je.textBox||je.verticalTextBox){var ze=!0;if(A){var Re=c.variableOffsets[Tt];Re?(Oe=Oo(Re.anchor,Re.width,Re.height,Re.textOffset,Re.textBoxScale),R&&Oe._rotate(G?c.transform.angle:-c.transform.angle)):ze=!1}je.textBox&&Ms(a.textCollisionBox.collisionVertexArray,Ct.text.placed,!ze||Ut,Oe.x,Oe.y),je.verticalTextBox&&Ms(a.textCollisionBox.collisionVertexArray,Ct.text.placed,!ze||ie,Oe.x,Oe.y)}var Pe=Boolean(!ie&&je.verticalIconBox);je.iconBox&&Ms(a.iconCollisionBox.collisionVertexArray,Ct.icon.placed,Pe,Z?Oe.x:0,Z?Oe.y:0),je.verticalIconBox&&Ms(a.iconCollisionBox.collisionVertexArray,Ct.icon.placed,!Pe,Z?Oe.x:0,Z?Oe.y:0)}}},ut=0;ut<a.symbolInstances.length;ut++)et(ut);if(a.sortFeatures(this.transform.angle),this.retainedQueryData[a.bucketInstanceId]&&(this.retainedQueryData[a.bucketInstanceId].featureSortOrder=a.featureSortOrder),a.hasTextData()&&a.text.opacityVertexBuffer&&a.text.opacityVertexBuffer.updateData(a.text.opacityVertexArray),a.hasIconData()&&a.icon.opacityVertexBuffer&&a.icon.opacityVertexBuffer.updateData(a.icon.opacityVertexArray),a.hasIconCollisionBoxData()&&a.iconCollisionBox.collisionVertexBuffer&&a.iconCollisionBox.collisionVertexBuffer.updateData(a.iconCollisionBox.collisionVertexArray),a.hasTextCollisionBoxData()&&a.textCollisionBox.collisionVertexBuffer&&a.textCollisionBox.collisionVertexBuffer.updateData(a.textCollisionBox.collisionVertexArray),a.bucketInstanceId in this.collisionCircleArrays){var tt=this.collisionCircleArrays[a.bucketInstanceId];a.placementInvProjMatrix=tt.invProjMatrix,a.placementViewportMatrix=tt.viewportMatrix,a.collisionCircleArray=tt.circles,delete this.collisionCircleArrays[a.bucketInstanceId]}},_i.prototype.symbolFadeChange=function(a){return this.fadeDuration===0?1:(a-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment},_i.prototype.zoomAdjustment=function(a){return Math.max(0,(this.transform.zoom-a)/1.5)},_i.prototype.hasTransitions=function(a){return this.stale||a-this.lastPlacementChangeTime<this.fadeDuration},_i.prototype.stillRecent=function(a,u){var l=this.zoomAtLastRecencyCheck===u?1-this.zoomAdjustment(u):1;return this.zoomAtLastRecencyCheck=u,this.commitTime+this.fadeDuration*l>a},_i.prototype.setStale=function(){this.stale=!0};var $l=Math.pow(2,25),tm=Math.pow(2,24),em=Math.pow(2,17),Nh=Math.pow(2,16),rm=Math.pow(2,9),Ap=Math.pow(2,8),im=Math.pow(2,1);function Fh(a){if(a.opacity===0&&!a.placed)return 0;if(a.opacity===1&&a.placed)return 4294967295;var u=a.placed?1:0,l=Math.floor(127*a.opacity);return l*$l+u*tm+l*em+u*Nh+l*rm+u*Ap+l*im+u}var tu=0,eu=function(a){this._sortAcrossTiles=a.layout.get("symbol-z-order")!=="viewport-y"&&!a.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]};eu.prototype.continuePlacement=function(a,u,l,c,y){for(var _=this._bucketParts;this._currentTileIndex<a.length;)if(u.getBucketParts(_,c,a[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,y())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,_.sort(function(x,S){return x.sortKey-S.sortKey}));this._currentPartIndex<_.length;)if(u.placeLayerBucketPart(_[this._currentPartIndex],this._seenCrossTileIDs,l),this._currentPartIndex++,y())return!0;return!1};var sl=function(a,u,l,c,y,_,x){this.placement=new _i(a,y,_,x),this._currentPlacementIndex=u.length-1,this._forceFullPlacement=l,this._showCollisionBoxes=c,this._done=!1};sl.prototype.isDone=function(){return this._done},sl.prototype.continuePlacement=function(a,u,l){for(var c=this,y=i.browser.now(),_=function(){var A=i.browser.now()-y;return!c._forceFullPlacement&&A>2};this._currentPlacementIndex>=0;){var x=u[a[this._currentPlacementIndex]],S=this.placement.collisionIndex.transform.zoom;if(x.type==="symbol"&&(!x.minzoom||x.minzoom<=S)&&(!x.maxzoom||x.maxzoom>S)){if(this._inProgressLayer||(this._inProgressLayer=new eu(x)),this._inProgressLayer.continuePlacement(l[x.source],this.placement,this._showCollisionBoxes,x,_))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},sl.prototype.commit=function(a){return this.placement.commit(a),this.placement};var Pp=512/i.EXTENT/2,ru=function(a,u,l){this.tileID=a,this.indexedSymbolInstances={},this.bucketInstanceId=l;for(var c=0;c<u.length;c++){var y=u.get(c),_=y.key;this.indexedSymbolInstances[_]||(this.indexedSymbolInstances[_]=[]),this.indexedSymbolInstances[_].push({crossTileID:y.crossTileID,coord:this.getScaledCoordinates(y,a)})}};ru.prototype.getScaledCoordinates=function(a,u){var l=Pp/Math.pow(2,u.canonical.z-this.tileID.canonical.z);return{x:Math.floor((u.canonical.x*i.EXTENT+a.anchorX)*l),y:Math.floor((u.canonical.y*i.EXTENT+a.anchorY)*l)}},ru.prototype.findMatches=function(a,u,l){for(var c=this.tileID.canonical.z<u.canonical.z?1:Math.pow(2,this.tileID.canonical.z-u.canonical.z),y=0;y<a.length;y++){var _=a.get(y);if(!_.crossTileID){var x=this.indexedSymbolInstances[_.key];if(x)for(var S=this.getScaledCoordinates(_,u),A=0,R=x;A<R.length;A+=1){var G=R[A];if(Math.abs(G.coord.x-S.x)<=c&&Math.abs(G.coord.y-S.y)<=c&&!l[G.crossTileID]){l[G.crossTileID]=!0,_.crossTileID=G.crossTileID;break}}}}};var Bh=function(){this.maxCrossTileID=0};Bh.prototype.generate=function(){return++this.maxCrossTileID};var wn=function(){this.indexes={},this.usedCrossTileIDs={},this.lng=0};wn.prototype.handleWrapJump=function(a){var u=Math.round((a-this.lng)/360);if(u!==0)for(var l in this.indexes){var c=this.indexes[l],y={};for(var _ in c){var x=c[_];x.tileID=x.tileID.unwrapTo(x.tileID.wrap+u),y[x.tileID.key]=x}this.indexes[l]=y}this.lng=a},wn.prototype.addBucket=function(a,u,l){if(this.indexes[a.overscaledZ]&&this.indexes[a.overscaledZ][a.key]){if(this.indexes[a.overscaledZ][a.key].bucketInstanceId===u.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(a.overscaledZ,this.indexes[a.overscaledZ][a.key])}for(var c=0;c<u.symbolInstances.length;c++)u.symbolInstances.get(c).crossTileID=0;this.usedCrossTileIDs[a.overscaledZ]||(this.usedCrossTileIDs[a.overscaledZ]={});var y=this.usedCrossTileIDs[a.overscaledZ];for(var _ in this.indexes){var x=this.indexes[_];if(Number(_)>a.overscaledZ)for(var S in x){var A=x[S];A.tileID.isChildOf(a)&&A.findMatches(u.symbolInstances,a,y)}else{var R=x[a.scaledTo(Number(_)).key];R&&R.findMatches(u.symbolInstances,a,y)}}for(var G=0;G<u.symbolInstances.length;G++){var Z=u.symbolInstances.get(G);Z.crossTileID||(Z.crossTileID=l.generate(),y[Z.crossTileID]=!0)}return this.indexes[a.overscaledZ]===void 0&&(this.indexes[a.overscaledZ]={}),this.indexes[a.overscaledZ][a.key]=new ru(a,u.symbolInstances,u.bucketInstanceId),!0},wn.prototype.removeBucketCrossTileIDs=function(a,u){for(var l in u.indexedSymbolInstances)for(var c=0,y=u.indexedSymbolInstances[l];c<y.length;c+=1)delete this.usedCrossTileIDs[a][y[c].crossTileID]},wn.prototype.removeStaleBuckets=function(a){var u=!1;for(var l in this.indexes){var c=this.indexes[l];for(var y in c)a[c[y].bucketInstanceId]||(this.removeBucketCrossTileIDs(l,c[y]),delete c[y],u=!0)}return u};var Oa=function(){this.layerIndexes={},this.crossTileIDs=new Bh,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}};Oa.prototype.addLayer=function(a,u,l){var c=this.layerIndexes[a.id];c===void 0&&(c=this.layerIndexes[a.id]=new wn);var y=!1,_={};c.handleWrapJump(l);for(var x=0,S=u;x<S.length;x+=1){var A=S[x],R=A.getBucket(a);R&&a.id===R.layerIds[0]&&(R.bucketInstanceId||(R.bucketInstanceId=++this.maxBucketInstanceId),c.addBucket(A.tileID,R,this.crossTileIDs)&&(y=!0),_[R.bucketInstanceId]=!0)}return c.removeStaleBuckets(_)&&(y=!0),y},Oa.prototype.pruneUnusedLayers=function(a){var u={};for(var l in a.forEach(function(c){u[c]=!0}),this.layerIndexes)u[l]||delete this.layerIndexes[l]};var $o=function(a,u){return i.emitValidationErrors(a,u&&u.filter(function(l){return l.identifier!=="source.canvas"}))},iu=i.pick(Rt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),ta=i.pick(Rt,["setCenter","setZoom","setBearing","setPitch"]),ea=function(){var a={},u=i.styleSpec.$version;for(var l in i.styleSpec.$root){var c,y=i.styleSpec.$root[l];y.required&&(c=l==="version"?u:y.type==="array"?[]:{})!=null&&(a[l]=c)}return a}(),No=function(a){function u(l,c){var y=this;c===void 0&&(c={}),a.call(this),this.map=l,this.dispatcher=new hr(ge(),this),this.imageManager=new ft,this.imageManager.setEventedParent(this),this.glyphManager=new ce(l._requestManager,c.localIdeographFontFamily),this.lineAtlas=new Le(256,512),this.crossTileSymbolIndex=new Oa,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new i.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",i.getReferrer());var _=this;this._rtlTextPluginCallback=u.registerForPluginStateChange(function(x){_.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:x.pluginStatus,pluginURL:x.pluginURL},function(S,A){if(i.triggerPluginCompletionEvent(S),A&&A.every(function(G){return G}))for(var R in _.sourceCaches)_.sourceCaches[R].reload()})}),this.on("data",function(x){if(x.dataType==="source"&&x.sourceDataType==="metadata"){var S=y.sourceCaches[x.sourceId];if(S){var A=S.getSource();if(A&&A.vectorLayerIds)for(var R in y._layers){var G=y._layers[R];G.source===A.id&&y._validateLayer(G)}}}})}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.loadURL=function(l,c){var y=this;c===void 0&&(c={}),this.fire(new i.Event("dataloading",{dataType:"style"}));var _=typeof c.validate=="boolean"?c.validate:!i.isMapboxURL(l);l=this.map._requestManager.normalizeStyleURL(l,c.accessToken);var x=this.map._requestManager.transformRequest(l,i.ResourceType.Style);this._request=i.getJSON(x,function(S,A){y._request=null,S?y.fire(new i.ErrorEvent(S)):A&&y._load(A,_)})},u.prototype.loadJSON=function(l,c){var y=this;c===void 0&&(c={}),this.fire(new i.Event("dataloading",{dataType:"style"})),this._request=i.browser.frame(function(){y._request=null,y._load(l,c.validate!==!1)})},u.prototype.loadEmpty=function(){this.fire(new i.Event("dataloading",{dataType:"style"})),this._load(ea,!1)},u.prototype._load=function(l,c){if(!c||!$o(this,i.validateStyle(l))){for(var y in this._loaded=!0,this.stylesheet=l,l.sources)this.addSource(y,l.sources[y],{validate:!1});l.sprite?this._loadSprite(l.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(l.glyphs);var _=Jt(this.stylesheet.layers);this._order=_.map(function(R){return R.id}),this._layers={},this._serializedLayers={};for(var x=0,S=_;x<S.length;x+=1){var A=S[x];(A=i.createStyleLayer(A)).setEventedParent(this,{layer:{id:A.id}}),this._layers[A.id]=A,this._serializedLayers[A.id]=A.serialize()}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new dr(this.stylesheet.light),this.fire(new i.Event("data",{dataType:"style"})),this.fire(new i.Event("style.load"))}},u.prototype._loadSprite=function(l){var c=this;this._spriteRequest=function(y,_,x){var S,A,R,G=i.browser.devicePixelRatio>1?"@2x":"",Z=i.getJSON(_.transformRequest(_.normalizeSpriteURL(y,G,".json"),i.ResourceType.SpriteJSON),function(et,ut){Z=null,R||(R=et,S=ut,it())}),V=i.getImage(_.transformRequest(_.normalizeSpriteURL(y,G,".png"),i.ResourceType.SpriteImage),function(et,ut){V=null,R||(R=et,A=ut,it())});function it(){if(R)x(R);else if(S&&A){var et=i.browser.getImageData(A),ut={};for(var tt in S){var lt=S[tt],yt=lt.width,_t=lt.height,It=lt.x,Tt=lt.y,Ct=lt.sdf,Lt=lt.pixelRatio,qt=lt.stretchX,Ut=lt.stretchY,ie=lt.content,_e=new i.RGBAImage({width:yt,height:_t});i.RGBAImage.copy(et,_e,{x:It,y:Tt},{x:0,y:0},{width:yt,height:_t}),ut[tt]={data:_e,pixelRatio:Lt,sdf:Ct,stretchX:qt,stretchY:Ut,content:ie}}x(null,ut)}}return{cancel:function(){Z&&(Z.cancel(),Z=null),V&&(V.cancel(),V=null)}}}(l,this.map._requestManager,function(y,_){if(c._spriteRequest=null,y)c.fire(new i.ErrorEvent(y));else if(_)for(var x in _)c.imageManager.addImage(x,_[x]);c.imageManager.setLoaded(!0),c._availableImages=c.imageManager.listImages(),c.dispatcher.broadcast("setImages",c._availableImages),c.fire(new i.Event("data",{dataType:"style"}))})},u.prototype._validateLayer=function(l){var c=this.sourceCaches[l.source];if(c){var y=l.sourceLayer;if(y){var _=c.getSource();(_.type==="geojson"||_.vectorLayerIds&&_.vectorLayerIds.indexOf(y)===-1)&&this.fire(new i.ErrorEvent(new Error('Source layer "'+y+'" does not exist on source "'+_.id+'" as specified by style layer "'+l.id+'"')))}}},u.prototype.loaded=function(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(var l in this.sourceCaches)if(!this.sourceCaches[l].loaded())return!1;return!!this.imageManager.isLoaded()},u.prototype._serializeLayers=function(l){for(var c=[],y=0,_=l;y<_.length;y+=1){var x=this._layers[_[y]];x.type!=="custom"&&c.push(x.serialize())}return c},u.prototype.hasTransitions=function(){if(this.light&&this.light.hasTransition())return!0;for(var l in this.sourceCaches)if(this.sourceCaches[l].hasTransition())return!0;for(var c in this._layers)if(this._layers[c].hasTransition())return!0;return!1},u.prototype._checkLoaded=function(){if(!this._loaded)throw new Error("Style is not done loading")},u.prototype.update=function(l){if(this._loaded){var c=this._changed;if(this._changed){var y=Object.keys(this._updatedLayers),_=Object.keys(this._removedLayers);for(var x in(y.length||_.length)&&this._updateWorkerLayers(y,_),this._updatedSources){var S=this._updatedSources[x];S==="reload"?this._reloadSource(x):S==="clear"&&this._clearSource(x)}for(var A in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[A].updateTransitions(l);this.light.updateTransitions(l),this._resetUpdates()}var R={};for(var G in this.sourceCaches){var Z=this.sourceCaches[G];R[G]=Z.used,Z.used=!1}for(var V=0,it=this._order;V<it.length;V+=1){var et=this._layers[it[V]];et.recalculate(l,this._availableImages),!et.isHidden(l.zoom)&&et.source&&(this.sourceCaches[et.source].used=!0)}for(var ut in R){var tt=this.sourceCaches[ut];R[ut]!==tt.used&&tt.fire(new i.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:ut}))}this.light.recalculate(l),this.z=l.zoom,c&&this.fire(new i.Event("data",{dataType:"style"}))}},u.prototype._updateTilesForChangedImages=function(){var l=Object.keys(this._changedImages);if(l.length){for(var c in this.sourceCaches)this.sourceCaches[c].reloadTilesForDependencies(["icons","patterns"],l);this._changedImages={}}},u.prototype._updateWorkerLayers=function(l,c){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(l),removedIds:c})},u.prototype._resetUpdates=function(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}},u.prototype.setState=function(l){var c=this;if(this._checkLoaded(),$o(this,i.validateStyle(l)))return!1;(l=i.clone$1(l)).layers=Jt(l.layers);var y=function(x,S){if(!x)return[{command:Rt.setStyle,args:[S]}];var A=[];try{if(!i.deepEqual(x.version,S.version))return[{command:Rt.setStyle,args:[S]}];i.deepEqual(x.center,S.center)||A.push({command:Rt.setCenter,args:[S.center]}),i.deepEqual(x.zoom,S.zoom)||A.push({command:Rt.setZoom,args:[S.zoom]}),i.deepEqual(x.bearing,S.bearing)||A.push({command:Rt.setBearing,args:[S.bearing]}),i.deepEqual(x.pitch,S.pitch)||A.push({command:Rt.setPitch,args:[S.pitch]}),i.deepEqual(x.sprite,S.sprite)||A.push({command:Rt.setSprite,args:[S.sprite]}),i.deepEqual(x.glyphs,S.glyphs)||A.push({command:Rt.setGlyphs,args:[S.glyphs]}),i.deepEqual(x.transition,S.transition)||A.push({command:Rt.setTransition,args:[S.transition]}),i.deepEqual(x.light,S.light)||A.push({command:Rt.setLight,args:[S.light]});var R={},G=[];(function(V,it,et,ut){var tt;for(tt in it=it||{},V=V||{})V.hasOwnProperty(tt)&&(it.hasOwnProperty(tt)||Be(tt,et,ut));for(tt in it)it.hasOwnProperty(tt)&&(V.hasOwnProperty(tt)?i.deepEqual(V[tt],it[tt])||(V[tt].type==="geojson"&&it[tt].type==="geojson"&&Er(V,it,tt)?et.push({command:Rt.setGeoJSONSourceData,args:[tt,it[tt].data]}):pe(tt,it,et,ut)):Fe(tt,it,et))})(x.sources,S.sources,G,R);var Z=[];x.layers&&x.layers.forEach(function(V){R[V.source]?A.push({command:Rt.removeLayer,args:[V.id]}):Z.push(V)}),A=A.concat(G),function(V,it,et){it=it||[];var ut,tt,lt,yt,_t,It,Tt,Ct=(V=V||[]).map(Pr),Lt=it.map(Pr),qt=V.reduce(Nr,{}),Ut=it.reduce(Nr,{}),ie=Ct.slice(),_e=Object.create(null);for(ut=0,tt=0;ut<Ct.length;ut++)Ut.hasOwnProperty(lt=Ct[ut])?tt++:(et.push({command:Rt.removeLayer,args:[lt]}),ie.splice(ie.indexOf(lt,tt),1));for(ut=0,tt=0;ut<Lt.length;ut++)ie[ie.length-1-ut]!==(lt=Lt[Lt.length-1-ut])&&(qt.hasOwnProperty(lt)?(et.push({command:Rt.removeLayer,args:[lt]}),ie.splice(ie.lastIndexOf(lt,ie.length-tt),1)):tt++,et.push({command:Rt.addLayer,args:[Ut[lt],It=ie[ie.length-ut]]}),ie.splice(ie.length-ut,0,lt),_e[lt]=!0);for(ut=0;ut<Lt.length;ut++)if(yt=qt[lt=Lt[ut]],_t=Ut[lt],!_e[lt]&&!i.deepEqual(yt,_t))if(i.deepEqual(yt.source,_t.source)&&i.deepEqual(yt["source-layer"],_t["source-layer"])&&i.deepEqual(yt.type,_t.type)){for(Tt in Ze(yt.layout,_t.layout,et,lt,null,Rt.setLayoutProperty),Ze(yt.paint,_t.paint,et,lt,null,Rt.setPaintProperty),i.deepEqual(yt.filter,_t.filter)||et.push({command:Rt.setFilter,args:[lt,_t.filter]}),i.deepEqual(yt.minzoom,_t.minzoom)&&i.deepEqual(yt.maxzoom,_t.maxzoom)||et.push({command:Rt.setLayerZoomRange,args:[lt,_t.minzoom,_t.maxzoom]}),yt)yt.hasOwnProperty(Tt)&&Tt!=="layout"&&Tt!=="paint"&&Tt!=="filter"&&Tt!=="metadata"&&Tt!=="minzoom"&&Tt!=="maxzoom"&&(Tt.indexOf("paint.")===0?Ze(yt[Tt],_t[Tt],et,lt,Tt.slice(6),Rt.setPaintProperty):i.deepEqual(yt[Tt],_t[Tt])||et.push({command:Rt.setLayerProperty,args:[lt,Tt,_t[Tt]]}));for(Tt in _t)_t.hasOwnProperty(Tt)&&!yt.hasOwnProperty(Tt)&&Tt!=="layout"&&Tt!=="paint"&&Tt!=="filter"&&Tt!=="metadata"&&Tt!=="minzoom"&&Tt!=="maxzoom"&&(Tt.indexOf("paint.")===0?Ze(yt[Tt],_t[Tt],et,lt,Tt.slice(6),Rt.setPaintProperty):i.deepEqual(yt[Tt],_t[Tt])||et.push({command:Rt.setLayerProperty,args:[lt,Tt,_t[Tt]]}))}else et.push({command:Rt.removeLayer,args:[lt]}),It=ie[ie.lastIndexOf(lt)+1],et.push({command:Rt.addLayer,args:[_t,It]})}(Z,S.layers,A)}catch(V){console.warn("Unable to compute style diff:",V),A=[{command:Rt.setStyle,args:[S]}]}return A}(this.serialize(),l).filter(function(x){return!(x.command in ta)});if(y.length===0)return!1;var _=y.filter(function(x){return!(x.command in iu)});if(_.length>0)throw new Error("Unimplemented: "+_.map(function(x){return x.command}).join(", ")+".");return y.forEach(function(x){x.command!=="setTransition"&&c[x.command].apply(c,x.args)}),this.stylesheet=l,!0},u.prototype.addImage=function(l,c){if(this.getImage(l))return this.fire(new i.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(l,c),this._afterImageUpdated(l)},u.prototype.updateImage=function(l,c){this.imageManager.updateImage(l,c)},u.prototype.getImage=function(l){return this.imageManager.getImage(l)},u.prototype.removeImage=function(l){if(!this.getImage(l))return this.fire(new i.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(l),this._afterImageUpdated(l)},u.prototype._afterImageUpdated=function(l){this._availableImages=this.imageManager.listImages(),this._changedImages[l]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new i.Event("data",{dataType:"style"}))},u.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},u.prototype.addSource=function(l,c,y){var _=this;if(y===void 0&&(y={}),this._checkLoaded(),this.sourceCaches[l]!==void 0)throw new Error("There is already a source with this ID");if(!c.type)throw new Error("The type property must be defined, but only the following properties were given: "+Object.keys(c).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(c.type)>=0&&this._validate(i.validateStyle.source,"sources."+l,c,null,y))){this.map&&this.map._collectResourceTiming&&(c.collectResourceTiming=!0);var x=this.sourceCaches[l]=new X(l,c,this.dispatcher);x.style=this,x.setEventedParent(this,function(){return{isSourceLoaded:_.loaded(),source:x.serialize(),sourceId:l}}),x.onAdd(this.map),this._changed=!0}},u.prototype.removeSource=function(l){if(this._checkLoaded(),this.sourceCaches[l]===void 0)throw new Error("There is no source with this ID");for(var c in this._layers)if(this._layers[c].source===l)return this.fire(new i.ErrorEvent(new Error('Source "'+l+'" cannot be removed while layer "'+c+'" is using it.')));var y=this.sourceCaches[l];delete this.sourceCaches[l],delete this._updatedSources[l],y.fire(new i.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:l})),y.setEventedParent(null),y.clearTiles(),y.onRemove&&y.onRemove(this.map),this._changed=!0},u.prototype.setGeoJSONSourceData=function(l,c){this._checkLoaded(),this.sourceCaches[l].getSource().setData(c),this._changed=!0},u.prototype.getSource=function(l){return this.sourceCaches[l]&&this.sourceCaches[l].getSource()},u.prototype.addLayer=function(l,c,y){y===void 0&&(y={}),this._checkLoaded();var _=l.id;if(this.getLayer(_))this.fire(new i.ErrorEvent(new Error('Layer with id "'+_+'" already exists on this map')));else{var x;if(l.type==="custom"){if($o(this,i.validateCustomStyleLayer(l)))return;x=i.createStyleLayer(l)}else{if(typeof l.source=="object"&&(this.addSource(_,l.source),l=i.clone$1(l),l=i.extend(l,{source:_})),this._validate(i.validateStyle.layer,"layers."+_,l,{arrayIndex:-1},y))return;x=i.createStyleLayer(l),this._validateLayer(x),x.setEventedParent(this,{layer:{id:_}}),this._serializedLayers[x.id]=x.serialize()}var S=c?this._order.indexOf(c):this._order.length;if(c&&S===-1)this.fire(new i.ErrorEvent(new Error('Layer with id "'+c+'" does not exist on this map.')));else{if(this._order.splice(S,0,_),this._layerOrderChanged=!0,this._layers[_]=x,this._removedLayers[_]&&x.source&&x.type!=="custom"){var A=this._removedLayers[_];delete this._removedLayers[_],A.type!==x.type?this._updatedSources[x.source]="clear":(this._updatedSources[x.source]="reload",this.sourceCaches[x.source].pause())}this._updateLayer(x),x.onAdd&&x.onAdd(this.map)}}},u.prototype.moveLayer=function(l,c){if(this._checkLoaded(),this._changed=!0,this._layers[l]){if(l!==c){var y=this._order.indexOf(l);this._order.splice(y,1);var _=c?this._order.indexOf(c):this._order.length;c&&_===-1?this.fire(new i.ErrorEvent(new Error('Layer with id "'+c+'" does not exist on this map.'))):(this._order.splice(_,0,l),this._layerOrderChanged=!0)}}else this.fire(new i.ErrorEvent(new Error("The layer '"+l+"' does not exist in the map's style and cannot be moved.")))},u.prototype.removeLayer=function(l){this._checkLoaded();var c=this._layers[l];if(c){c.setEventedParent(null);var y=this._order.indexOf(l);this._order.splice(y,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[l]=c,delete this._layers[l],delete this._serializedLayers[l],delete this._updatedLayers[l],delete this._updatedPaintProps[l],c.onRemove&&c.onRemove(this.map)}else this.fire(new i.ErrorEvent(new Error("The layer '"+l+"' does not exist in the map's style and cannot be removed.")))},u.prototype.getLayer=function(l){return this._layers[l]},u.prototype.hasLayer=function(l){return l in this._layers},u.prototype.setLayerZoomRange=function(l,c,y){this._checkLoaded();var _=this.getLayer(l);_?_.minzoom===c&&_.maxzoom===y||(c!=null&&(_.minzoom=c),y!=null&&(_.maxzoom=y),this._updateLayer(_)):this.fire(new i.ErrorEvent(new Error("The layer '"+l+"' does not exist in the map's style and cannot have zoom extent.")))},u.prototype.setFilter=function(l,c,y){y===void 0&&(y={}),this._checkLoaded();var _=this.getLayer(l);if(_){if(!i.deepEqual(_.filter,c))return c==null?(_.filter=void 0,void this._updateLayer(_)):void(this._validate(i.validateStyle.filter,"layers."+_.id+".filter",c,null,y)||(_.filter=i.clone$1(c),this._updateLayer(_)))}else this.fire(new i.ErrorEvent(new Error("The layer '"+l+"' does not exist in the map's style and cannot be filtered.")))},u.prototype.getFilter=function(l){return i.clone$1(this.getLayer(l).filter)},u.prototype.setLayoutProperty=function(l,c,y,_){_===void 0&&(_={}),this._checkLoaded();var x=this.getLayer(l);x?i.deepEqual(x.getLayoutProperty(c),y)||(x.setLayoutProperty(c,y,_),this._updateLayer(x)):this.fire(new i.ErrorEvent(new Error("The layer '"+l+"' does not exist in the map's style and cannot be styled.")))},u.prototype.getLayoutProperty=function(l,c){var y=this.getLayer(l);if(y)return y.getLayoutProperty(c);this.fire(new i.ErrorEvent(new Error("The layer '"+l+"' does not exist in the map's style.")))},u.prototype.setPaintProperty=function(l,c,y,_){_===void 0&&(_={}),this._checkLoaded();var x=this.getLayer(l);x?i.deepEqual(x.getPaintProperty(c),y)||(x.setPaintProperty(c,y,_)&&this._updateLayer(x),this._changed=!0,this._updatedPaintProps[l]=!0):this.fire(new i.ErrorEvent(new Error("The layer '"+l+"' does not exist in the map's style and cannot be styled.")))},u.prototype.getPaintProperty=function(l,c){return this.getLayer(l).getPaintProperty(c)},u.prototype.setFeatureState=function(l,c){this._checkLoaded();var y=l.source,_=l.sourceLayer,x=this.sourceCaches[y];if(x!==void 0){var S=x.getSource().type;S==="geojson"&&_?this.fire(new i.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):S!=="vector"||_?(l.id===void 0&&this.fire(new i.ErrorEvent(new Error("The feature id parameter must be provided."))),x.setFeatureState(_,l.id,c)):this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new i.ErrorEvent(new Error("The source '"+y+"' does not exist in the map's style.")))},u.prototype.removeFeatureState=function(l,c){this._checkLoaded();var y=l.source,_=this.sourceCaches[y];if(_!==void 0){var x=_.getSource().type,S=x==="vector"?l.sourceLayer:void 0;x!=="vector"||S?c&&typeof l.id!="string"&&typeof l.id!="number"?this.fire(new i.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):_.removeFeatureState(S,l.id,c):this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new i.ErrorEvent(new Error("The source '"+y+"' does not exist in the map's style.")))},u.prototype.getFeatureState=function(l){this._checkLoaded();var c=l.source,y=l.sourceLayer,_=this.sourceCaches[c];if(_!==void 0){if(_.getSource().type!=="vector"||y)return l.id===void 0&&this.fire(new i.ErrorEvent(new Error("The feature id parameter must be provided."))),_.getFeatureState(y,l.id);this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new i.ErrorEvent(new Error("The source '"+c+"' does not exist in the map's style.")))},u.prototype.getTransition=function(){return i.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},u.prototype.serialize=function(){return i.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:i.mapObject(this.sourceCaches,function(l){return l.serialize()}),layers:this._serializeLayers(this._order)},function(l){return l!==void 0})},u.prototype._updateLayer=function(l){this._updatedLayers[l.id]=!0,l.source&&!this._updatedSources[l.source]&&this.sourceCaches[l.source].getSource().type!=="raster"&&(this._updatedSources[l.source]="reload",this.sourceCaches[l.source].pause()),this._changed=!0},u.prototype._flattenAndSortRenderedFeatures=function(l){for(var c=this,y=function(qt){return c._layers[qt].type==="fill-extrusion"},_={},x=[],S=this._order.length-1;S>=0;S--){var A=this._order[S];if(y(A)){_[A]=S;for(var R=0,G=l;R<G.length;R+=1){var Z=G[R][A];if(Z)for(var V=0,it=Z;V<it.length;V+=1)x.push(it[V])}}}x.sort(function(qt,Ut){return Ut.intersectionZ-qt.intersectionZ});for(var et=[],ut=this._order.length-1;ut>=0;ut--){var tt=this._order[ut];if(y(tt))for(var lt=x.length-1;lt>=0;lt--){var yt=x[lt].feature;if(_[yt.layer.id]<ut)break;et.push(yt),x.pop()}else for(var _t=0,It=l;_t<It.length;_t+=1){var Tt=It[_t][tt];if(Tt)for(var Ct=0,Lt=Tt;Ct<Lt.length;Ct+=1)et.push(Lt[Ct].feature)}}return et},u.prototype.queryRenderedFeatures=function(l,c,y){c&&c.filter&&this._validate(i.validateStyle.filter,"queryRenderedFeatures.filter",c.filter,null,c);var _={};if(c&&c.layers){if(!Array.isArray(c.layers))return this.fire(new i.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(var x=0,S=c.layers;x<S.length;x+=1){var A=S[x],R=this._layers[A];if(!R)return this.fire(new i.ErrorEvent(new Error("The layer '"+A+"' does not exist in the map's style and cannot be queried for features."))),[];_[R.source]=!0}}var G=[];for(var Z in c.availableImages=this._availableImages,this.sourceCaches)c.layers&&!_[Z]||G.push(ke(this.sourceCaches[Z],this._layers,this._serializedLayers,l,c,y));return this.placement&&G.push(function(V,it,et,ut,tt,lt,yt){for(var _t={},It=lt.queryRenderedSymbols(ut),Tt=[],Ct=0,Lt=Object.keys(It).map(Number);Ct<Lt.length;Ct+=1)Tt.push(yt[Lt[Ct]]);Tt.sort(cr);for(var qt=function(){var xe=ie[Ut],nr=xe.featureIndex.lookupSymbolFeatures(It[xe.bucketInstanceId],it,xe.bucketIndex,xe.sourceLayerIndex,tt.filter,tt.layers,tt.availableImages,V);for(var ue in nr){var De=_t[ue]=_t[ue]||[],je=nr[ue];je.sort(function(Re,Pe){var Ee=xe.featureSortOrder;if(Ee){var wr=Ee.indexOf(Re.featureIndex);return Ee.indexOf(Pe.featureIndex)-wr}return Pe.featureIndex-Re.featureIndex});for(var Oe=0,ze=je;Oe<ze.length;Oe+=1)De.push(ze[Oe])}},Ut=0,ie=Tt;Ut<ie.length;Ut+=1)qt();var _e=function(xe){_t[xe].forEach(function(nr){var ue=nr.feature,De=et[V[xe].source].getFeatureState(ue.layer["source-layer"],ue.id);ue.source=ue.layer.source,ue.layer["source-layer"]&&(ue.sourceLayer=ue.layer["source-layer"]),ue.state=De})};for(var Se in _t)_e(Se);return _t}(this._layers,this._serializedLayers,this.sourceCaches,l,c,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(G)},u.prototype.querySourceFeatures=function(l,c){c&&c.filter&&this._validate(i.validateStyle.filter,"querySourceFeatures.filter",c.filter,null,c);var y=this.sourceCaches[l];return y?function(_,x){for(var S=_.getRenderableIds().map(function(it){return _.getTileByID(it)}),A=[],R={},G=0;G<S.length;G++){var Z=S[G],V=Z.tileID.canonical.key;R[V]||(R[V]=!0,Z.querySourceFeatures(A,x))}return A}(y,c):[]},u.prototype.addSourceType=function(l,c,y){return u.getSourceType(l)?y(new Error('A source type called "'+l+'" already exists.')):(u.setSourceType(l,c),c.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:l,url:c.workerSourceURL},y):y(null,null))},u.prototype.getLight=function(){return this.light.getLight()},u.prototype.setLight=function(l,c){c===void 0&&(c={}),this._checkLoaded();var y=this.light.getLight(),_=!1;for(var x in l)if(!i.deepEqual(l[x],y[x])){_=!0;break}if(_){var S={now:i.browser.now(),transition:i.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(l,c),this.light.updateTransitions(S)}},u.prototype._validate=function(l,c,y,_,x){return x===void 0&&(x={}),(!x||x.validate!==!1)&&$o(this,l.call(i.validateStyle,i.extend({key:c,style:this.serialize(),value:y,styleSpec:i.styleSpec},_)))},u.prototype._remove=function(){for(var l in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[l].setEventedParent(null);for(var c in this.sourceCaches)this.sourceCaches[c].clearTiles(),this.sourceCaches[c].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()},u.prototype._clearSource=function(l){this.sourceCaches[l].clearTiles()},u.prototype._reloadSource=function(l){this.sourceCaches[l].resume(),this.sourceCaches[l].reload()},u.prototype._updateSources=function(l){for(var c in this.sourceCaches)this.sourceCaches[c].update(l)},u.prototype._generateCollisionBoxes=function(){for(var l in this.sourceCaches)this._reloadSource(l)},u.prototype._updatePlacement=function(l,c,y,_,x){x===void 0&&(x=!1);for(var S=!1,A=!1,R={},G=0,Z=this._order;G<Z.length;G+=1){var V=this._layers[Z[G]];if(V.type==="symbol"){if(!R[V.source]){var it=this.sourceCaches[V.source];R[V.source]=it.getRenderableIds(!0).map(function(yt){return it.getTileByID(yt)}).sort(function(yt,_t){return _t.tileID.overscaledZ-yt.tileID.overscaledZ||(yt.tileID.isLessThan(_t.tileID)?-1:1)})}var et=this.crossTileSymbolIndex.addLayer(V,R[V.source],l.center.lng);S=S||et}}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((x=x||this._layerOrderChanged||y===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.browser.now(),l.zoom))&&(this.pauseablePlacement=new sl(l,this._order,x,c,y,_,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,R),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.browser.now()),A=!0),S&&this.pauseablePlacement.placement.setStale()),A||S)for(var ut=0,tt=this._order;ut<tt.length;ut+=1){var lt=this._layers[tt[ut]];lt.type==="symbol"&&this.placement.updateLayerOpacities(lt,R[lt.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(i.browser.now())},u.prototype._releaseSymbolFadeTiles=function(){for(var l in this.sourceCaches)this.sourceCaches[l].releaseSymbolFadeTiles()},u.prototype.getImages=function(l,c,y){this.imageManager.getImages(c.icons,y),this._updateTilesForChangedImages();var _=this.sourceCaches[c.source];_&&_.setDependencies(c.tileID.key,c.type,c.icons)},u.prototype.getGlyphs=function(l,c,y){this.glyphManager.getGlyphs(c.stacks,y)},u.prototype.getResource=function(l,c,y){return i.makeRequest(c,y)},u}(i.Evented);No.getSourceType=function(a){return Ai[a]},No.setSourceType=function(a,u){Ai[a]=u},No.registerForPluginStateChange=i.registerForPluginStateChange;var po=i.createLayout([{name:"a_pos",type:"Int16",components:2}]),fi=qr(`#ifdef GL_ES
|
|
3
|
+
precision mediump float;
|
|
4
|
+
#else
|
|
5
|
+
#if !defined(lowp)
|
|
6
|
+
#define lowp
|
|
7
|
+
#endif
|
|
8
|
+
#if !defined(mediump)
|
|
9
|
+
#define mediump
|
|
10
|
+
#endif
|
|
11
|
+
#if !defined(highp)
|
|
12
|
+
#define highp
|
|
13
|
+
#endif
|
|
14
|
+
#endif`,`#ifdef GL_ES
|
|
15
|
+
precision highp float;
|
|
16
|
+
#else
|
|
17
|
+
#if !defined(lowp)
|
|
18
|
+
#define lowp
|
|
19
|
+
#endif
|
|
20
|
+
#if !defined(mediump)
|
|
21
|
+
#define mediump
|
|
22
|
+
#endif
|
|
23
|
+
#if !defined(highp)
|
|
24
|
+
#define highp
|
|
25
|
+
#endif
|
|
26
|
+
#endif
|
|
27
|
+
vec2 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(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
|
|
28
|
+
);}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;}`),nu=qr(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
|
|
29
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
30
|
+
gl_FragColor=vec4(1.0);
|
|
31
|
+
#endif
|
|
32
|
+
}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),Lp=qr(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
|
|
33
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
34
|
+
gl_FragColor=vec4(1.0);
|
|
35
|
+
#endif
|
|
36
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),nm=qr(`varying vec3 v_data;
|
|
37
|
+
#pragma mapbox: define highp vec4 color
|
|
38
|
+
#pragma mapbox: define mediump float radius
|
|
39
|
+
#pragma mapbox: define lowp float blur
|
|
40
|
+
#pragma mapbox: define lowp float opacity
|
|
41
|
+
#pragma mapbox: define highp vec4 stroke_color
|
|
42
|
+
#pragma mapbox: define mediump float stroke_width
|
|
43
|
+
#pragma mapbox: define lowp float stroke_opacity
|
|
44
|
+
void main() {
|
|
45
|
+
#pragma mapbox: initialize highp vec4 color
|
|
46
|
+
#pragma mapbox: initialize mediump float radius
|
|
47
|
+
#pragma mapbox: initialize lowp float blur
|
|
48
|
+
#pragma mapbox: initialize lowp float opacity
|
|
49
|
+
#pragma mapbox: initialize highp vec4 stroke_color
|
|
50
|
+
#pragma mapbox: initialize mediump float stroke_width
|
|
51
|
+
#pragma mapbox: initialize lowp float stroke_opacity
|
|
52
|
+
vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
|
|
53
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
54
|
+
gl_FragColor=vec4(1.0);
|
|
55
|
+
#endif
|
|
56
|
+
}`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;
|
|
57
|
+
#pragma mapbox: define highp vec4 color
|
|
58
|
+
#pragma mapbox: define mediump float radius
|
|
59
|
+
#pragma mapbox: define lowp float blur
|
|
60
|
+
#pragma mapbox: define lowp float opacity
|
|
61
|
+
#pragma mapbox: define highp vec4 stroke_color
|
|
62
|
+
#pragma mapbox: define mediump float stroke_width
|
|
63
|
+
#pragma mapbox: define lowp float stroke_opacity
|
|
64
|
+
void main(void) {
|
|
65
|
+
#pragma mapbox: initialize highp vec4 color
|
|
66
|
+
#pragma mapbox: initialize mediump float radius
|
|
67
|
+
#pragma mapbox: initialize lowp float blur
|
|
68
|
+
#pragma mapbox: initialize lowp float opacity
|
|
69
|
+
#pragma mapbox: initialize highp vec4 stroke_color
|
|
70
|
+
#pragma mapbox: initialize mediump float stroke_width
|
|
71
|
+
#pragma mapbox: initialize lowp float stroke_opacity
|
|
72
|
+
vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),om=qr("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),Uh=qr(`uniform highp float u_intensity;varying vec2 v_extrude;
|
|
73
|
+
#pragma mapbox: define highp float weight
|
|
74
|
+
#define GAUSS_COEF 0.3989422804014327
|
|
75
|
+
void main() {
|
|
76
|
+
#pragma mapbox: initialize highp float weight
|
|
77
|
+
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
|
|
78
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
79
|
+
gl_FragColor=vec4(1.0);
|
|
80
|
+
#endif
|
|
81
|
+
}`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
|
|
82
|
+
#pragma mapbox: define highp float weight
|
|
83
|
+
#pragma mapbox: define mediump float radius
|
|
84
|
+
const highp float ZERO=1.0/255.0/16.0;
|
|
85
|
+
#define GAUSS_COEF 0.3989422804014327
|
|
86
|
+
void main(void) {
|
|
87
|
+
#pragma mapbox: initialize highp float weight
|
|
88
|
+
#pragma mapbox: initialize mediump float radius
|
|
89
|
+
vec2 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;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),Gh=qr(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
|
|
90
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
91
|
+
gl_FragColor=vec4(0.0);
|
|
92
|
+
#endif
|
|
93
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),Vh=qr("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),jh=qr("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying 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);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying 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;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-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(0.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);}"),kp=qr("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}"),Rp=qr(`#pragma mapbox: define highp vec4 color
|
|
94
|
+
#pragma mapbox: define lowp float opacity
|
|
95
|
+
void main() {
|
|
96
|
+
#pragma mapbox: initialize highp vec4 color
|
|
97
|
+
#pragma mapbox: initialize lowp float opacity
|
|
98
|
+
gl_FragColor=color*opacity;
|
|
99
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
100
|
+
gl_FragColor=vec4(1.0);
|
|
101
|
+
#endif
|
|
102
|
+
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;
|
|
103
|
+
#pragma mapbox: define highp vec4 color
|
|
104
|
+
#pragma mapbox: define lowp float opacity
|
|
105
|
+
void main() {
|
|
106
|
+
#pragma mapbox: initialize highp vec4 color
|
|
107
|
+
#pragma mapbox: initialize lowp float opacity
|
|
108
|
+
gl_Position=u_matrix*vec4(a_pos,0,1);}`),am=qr(`varying vec2 v_pos;
|
|
109
|
+
#pragma mapbox: define highp vec4 outline_color
|
|
110
|
+
#pragma mapbox: define lowp float opacity
|
|
111
|
+
void main() {
|
|
112
|
+
#pragma mapbox: initialize highp vec4 outline_color
|
|
113
|
+
#pragma mapbox: initialize lowp float opacity
|
|
114
|
+
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
|
|
115
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
116
|
+
gl_FragColor=vec4(1.0);
|
|
117
|
+
#endif
|
|
118
|
+
}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
|
|
119
|
+
#pragma mapbox: define highp vec4 outline_color
|
|
120
|
+
#pragma mapbox: define lowp float opacity
|
|
121
|
+
void main() {
|
|
122
|
+
#pragma mapbox: initialize highp vec4 outline_color
|
|
123
|
+
#pragma mapbox: initialize lowp float opacity
|
|
124
|
+
gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),ll=qr(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|
125
|
+
#pragma mapbox: define lowp float opacity
|
|
126
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
127
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
128
|
+
void main() {
|
|
129
|
+
#pragma mapbox: initialize lowp float opacity
|
|
130
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
131
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
132
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
|
|
133
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
134
|
+
gl_FragColor=vec4(1.0);
|
|
135
|
+
#endif
|
|
136
|
+
}`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
|
|
137
|
+
#pragma mapbox: define lowp float opacity
|
|
138
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
139
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
140
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
141
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
142
|
+
void main() {
|
|
143
|
+
#pragma mapbox: initialize lowp float opacity
|
|
144
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
145
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
146
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
147
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
148
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),ul=qr(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|
149
|
+
#pragma mapbox: define lowp float opacity
|
|
150
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
151
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
152
|
+
void main() {
|
|
153
|
+
#pragma mapbox: initialize lowp float opacity
|
|
154
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
155
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
156
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
|
|
157
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
158
|
+
gl_FragColor=vec4(1.0);
|
|
159
|
+
#endif
|
|
160
|
+
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
|
|
161
|
+
#pragma mapbox: define lowp float opacity
|
|
162
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
163
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
164
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
165
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
166
|
+
void main() {
|
|
167
|
+
#pragma mapbox: initialize lowp float opacity
|
|
168
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
169
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
170
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
171
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
172
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),zp=qr(`varying vec4 v_color;void main() {gl_FragColor=v_color;
|
|
173
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
174
|
+
gl_FragColor=vec4(1.0);
|
|
175
|
+
#endif
|
|
176
|
+
}`,`uniform 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;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;
|
|
177
|
+
#pragma mapbox: define highp float base
|
|
178
|
+
#pragma mapbox: define highp float height
|
|
179
|
+
#pragma mapbox: define highp vec4 color
|
|
180
|
+
void main() {
|
|
181
|
+
#pragma mapbox: initialize highp float base
|
|
182
|
+
#pragma mapbox: initialize highp float height
|
|
183
|
+
#pragma mapbox: initialize highp vec4 color
|
|
184
|
+
vec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),Zi=qr(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|
185
|
+
#pragma mapbox: define lowp float base
|
|
186
|
+
#pragma mapbox: define lowp float height
|
|
187
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
188
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
189
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
190
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
191
|
+
void main() {
|
|
192
|
+
#pragma mapbox: initialize lowp float base
|
|
193
|
+
#pragma mapbox: initialize lowp float height
|
|
194
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
195
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
196
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
197
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
198
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
|
|
199
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
200
|
+
gl_FragColor=vec4(1.0);
|
|
201
|
+
#endif
|
|
202
|
+
}`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
|
|
203
|
+
#pragma mapbox: define lowp float base
|
|
204
|
+
#pragma mapbox: define lowp float height
|
|
205
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
206
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
207
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
208
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
209
|
+
void main() {
|
|
210
|
+
#pragma mapbox: initialize lowp float base
|
|
211
|
+
#pragma mapbox: initialize lowp float height
|
|
212
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
213
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
214
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
215
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
216
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
|
|
217
|
+
? a_pos
|
|
218
|
+
: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),qh=qr(`#ifdef GL_ES
|
|
219
|
+
precision highp float;
|
|
220
|
+
#endif
|
|
221
|
+
uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);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((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
|
|
222
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
223
|
+
gl_FragColor=vec4(1.0);
|
|
224
|
+
#endif
|
|
225
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying 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;}"),ra=qr(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
|
|
226
|
+
#define PI 3.141592653589793
|
|
227
|
+
void main() {vec4 pixel=texture2D(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);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
|
|
228
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
229
|
+
gl_FragColor=vec4(1.0);
|
|
230
|
+
#endif
|
|
231
|
+
}`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),ia=qr(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
|
|
232
|
+
#pragma mapbox: define highp vec4 color
|
|
233
|
+
#pragma mapbox: define lowp float blur
|
|
234
|
+
#pragma mapbox: define lowp float opacity
|
|
235
|
+
void main() {
|
|
236
|
+
#pragma mapbox: initialize highp vec4 color
|
|
237
|
+
#pragma mapbox: initialize lowp float blur
|
|
238
|
+
#pragma mapbox: initialize lowp float opacity
|
|
239
|
+
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);gl_FragColor=color*(alpha*opacity);
|
|
240
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
241
|
+
gl_FragColor=vec4(1.0);
|
|
242
|
+
#endif
|
|
243
|
+
}`,`
|
|
244
|
+
#define scale 0.015873016
|
|
245
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
|
|
246
|
+
#pragma mapbox: define highp vec4 color
|
|
247
|
+
#pragma mapbox: define lowp float blur
|
|
248
|
+
#pragma mapbox: define lowp float opacity
|
|
249
|
+
#pragma mapbox: define mediump float gapwidth
|
|
250
|
+
#pragma mapbox: define lowp float offset
|
|
251
|
+
#pragma mapbox: define mediump float width
|
|
252
|
+
void main() {
|
|
253
|
+
#pragma mapbox: initialize highp vec4 color
|
|
254
|
+
#pragma mapbox: initialize lowp float blur
|
|
255
|
+
#pragma mapbox: initialize lowp float opacity
|
|
256
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
257
|
+
#pragma mapbox: initialize lowp float offset
|
|
258
|
+
#pragma mapbox: initialize mediump float width
|
|
259
|
+
float 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;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.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*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float 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;v_width2=vec2(outset,inset);}`),Na=qr(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|
260
|
+
#pragma mapbox: define lowp float blur
|
|
261
|
+
#pragma mapbox: define lowp float opacity
|
|
262
|
+
void main() {
|
|
263
|
+
#pragma mapbox: initialize lowp float blur
|
|
264
|
+
#pragma mapbox: initialize lowp float opacity
|
|
265
|
+
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);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
|
|
266
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
267
|
+
gl_FragColor=vec4(1.0);
|
|
268
|
+
#endif
|
|
269
|
+
}`,`
|
|
270
|
+
#define scale 0.015873016
|
|
271
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
|
|
272
|
+
#pragma mapbox: define lowp float blur
|
|
273
|
+
#pragma mapbox: define lowp float opacity
|
|
274
|
+
#pragma mapbox: define mediump float gapwidth
|
|
275
|
+
#pragma mapbox: define lowp float offset
|
|
276
|
+
#pragma mapbox: define mediump float width
|
|
277
|
+
void main() {
|
|
278
|
+
#pragma mapbox: initialize lowp float blur
|
|
279
|
+
#pragma mapbox: initialize lowp float opacity
|
|
280
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
281
|
+
#pragma mapbox: initialize lowp float offset
|
|
282
|
+
#pragma mapbox: initialize mediump float width
|
|
283
|
+
float 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;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);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*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float 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;v_width2=vec2(outset,inset);}`),Fa=qr(`uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|
284
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
285
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
286
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
287
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
288
|
+
#pragma mapbox: define lowp float blur
|
|
289
|
+
#pragma mapbox: define lowp float opacity
|
|
290
|
+
void main() {
|
|
291
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
292
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
293
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
294
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
295
|
+
#pragma mapbox: initialize lowp float blur
|
|
296
|
+
#pragma mapbox: initialize lowp float opacity
|
|
297
|
+
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.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);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
|
|
298
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
299
|
+
gl_FragColor=vec4(1.0);
|
|
300
|
+
#endif
|
|
301
|
+
}`,`
|
|
302
|
+
#define scale 0.015873016
|
|
303
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
304
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
|
|
305
|
+
#pragma mapbox: define lowp float blur
|
|
306
|
+
#pragma mapbox: define lowp float opacity
|
|
307
|
+
#pragma mapbox: define lowp float offset
|
|
308
|
+
#pragma mapbox: define mediump float gapwidth
|
|
309
|
+
#pragma mapbox: define mediump float width
|
|
310
|
+
#pragma mapbox: define lowp float floorwidth
|
|
311
|
+
#pragma mapbox: define lowp vec4 pattern_from
|
|
312
|
+
#pragma mapbox: define lowp vec4 pattern_to
|
|
313
|
+
#pragma mapbox: define lowp float pixel_ratio_from
|
|
314
|
+
#pragma mapbox: define lowp float pixel_ratio_to
|
|
315
|
+
void main() {
|
|
316
|
+
#pragma mapbox: initialize lowp float blur
|
|
317
|
+
#pragma mapbox: initialize lowp float opacity
|
|
318
|
+
#pragma mapbox: initialize lowp float offset
|
|
319
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
320
|
+
#pragma mapbox: initialize mediump float width
|
|
321
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
322
|
+
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
323
|
+
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
324
|
+
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
325
|
+
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
326
|
+
float 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;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;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*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float 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;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),na=qr(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|
327
|
+
#pragma mapbox: define highp vec4 color
|
|
328
|
+
#pragma mapbox: define lowp float blur
|
|
329
|
+
#pragma mapbox: define lowp float opacity
|
|
330
|
+
#pragma mapbox: define mediump float width
|
|
331
|
+
#pragma mapbox: define lowp float floorwidth
|
|
332
|
+
void main() {
|
|
333
|
+
#pragma mapbox: initialize highp vec4 color
|
|
334
|
+
#pragma mapbox: initialize lowp float blur
|
|
335
|
+
#pragma mapbox: initialize lowp float opacity
|
|
336
|
+
#pragma mapbox: initialize mediump float width
|
|
337
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
338
|
+
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);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
|
|
339
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
340
|
+
gl_FragColor=vec4(1.0);
|
|
341
|
+
#endif
|
|
342
|
+
}`,`
|
|
343
|
+
#define scale 0.015873016
|
|
344
|
+
#define LINE_DISTANCE_SCALE 2.0
|
|
345
|
+
attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
|
|
346
|
+
#pragma mapbox: define highp vec4 color
|
|
347
|
+
#pragma mapbox: define lowp float blur
|
|
348
|
+
#pragma mapbox: define lowp float opacity
|
|
349
|
+
#pragma mapbox: define mediump float gapwidth
|
|
350
|
+
#pragma mapbox: define lowp float offset
|
|
351
|
+
#pragma mapbox: define mediump float width
|
|
352
|
+
#pragma mapbox: define lowp float floorwidth
|
|
353
|
+
void main() {
|
|
354
|
+
#pragma mapbox: initialize highp vec4 color
|
|
355
|
+
#pragma mapbox: initialize lowp float blur
|
|
356
|
+
#pragma mapbox: initialize lowp float opacity
|
|
357
|
+
#pragma mapbox: initialize mediump float gapwidth
|
|
358
|
+
#pragma mapbox: initialize lowp float offset
|
|
359
|
+
#pragma mapbox: initialize mediump float width
|
|
360
|
+
#pragma mapbox: initialize lowp float floorwidth
|
|
361
|
+
float 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;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;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*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float 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;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),Ba=qr(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(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);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
|
|
362
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
363
|
+
gl_FragColor=vec4(1.0);
|
|
364
|
+
#endif
|
|
365
|
+
}`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),Ua=qr(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
|
|
366
|
+
#pragma mapbox: define lowp float opacity
|
|
367
|
+
void main() {
|
|
368
|
+
#pragma mapbox: initialize lowp float opacity
|
|
369
|
+
lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
|
|
370
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
371
|
+
gl_FragColor=vec4(1.0);
|
|
372
|
+
#endif
|
|
373
|
+
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform 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 highp float u_pitch;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;varying vec2 v_tex;varying float v_fade_opacity;
|
|
374
|
+
#pragma mapbox: define lowp float opacity
|
|
375
|
+
void main() {
|
|
376
|
+
#pragma mapbox: initialize lowp float opacity
|
|
377
|
+
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];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;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
378
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
379
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp 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);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}`),oa=qr(`#define SDF_PX 8.0
|
|
380
|
+
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
|
|
381
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
382
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
383
|
+
#pragma mapbox: define lowp float opacity
|
|
384
|
+
#pragma mapbox: define lowp float halo_width
|
|
385
|
+
#pragma mapbox: define lowp float halo_blur
|
|
386
|
+
void main() {
|
|
387
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
388
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
389
|
+
#pragma mapbox: initialize lowp float opacity
|
|
390
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
391
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
392
|
+
float 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;if (u_is_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=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|
393
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
394
|
+
gl_FragColor=vec4(1.0);
|
|
395
|
+
#endif
|
|
396
|
+
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform 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 highp float u_pitch;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;varying vec2 v_data0;varying vec3 v_data1;
|
|
397
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
398
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
399
|
+
#pragma mapbox: define lowp float opacity
|
|
400
|
+
#pragma mapbox: define lowp float halo_width
|
|
401
|
+
#pragma mapbox: define lowp float halo_blur
|
|
402
|
+
void main() {
|
|
403
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
404
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
405
|
+
#pragma mapbox: initialize lowp float opacity
|
|
406
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
407
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
408
|
+
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];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;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
409
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
410
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp 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);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;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(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),Dp=qr(`#define SDF_PX 8.0
|
|
411
|
+
#define SDF 1.0
|
|
412
|
+
#define ICON 0.0
|
|
413
|
+
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
|
|
414
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
415
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
416
|
+
#pragma mapbox: define lowp float opacity
|
|
417
|
+
#pragma mapbox: define lowp float halo_width
|
|
418
|
+
#pragma mapbox: define lowp float halo_blur
|
|
419
|
+
void main() {
|
|
420
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
421
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
422
|
+
#pragma mapbox: initialize lowp float opacity
|
|
423
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
424
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
425
|
+
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
|
|
426
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
427
|
+
gl_FragColor=vec4(1.0);
|
|
428
|
+
#endif
|
|
429
|
+
return;}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;if (u_is_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=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
|
|
430
|
+
#ifdef OVERDRAW_INSPECTOR
|
|
431
|
+
gl_FragColor=vec4(1.0);
|
|
432
|
+
#endif
|
|
433
|
+
}`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform 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 highp float u_pitch;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 vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;
|
|
434
|
+
#pragma mapbox: define highp vec4 fill_color
|
|
435
|
+
#pragma mapbox: define highp vec4 halo_color
|
|
436
|
+
#pragma mapbox: define lowp float opacity
|
|
437
|
+
#pragma mapbox: define lowp float halo_width
|
|
438
|
+
#pragma mapbox: define lowp float halo_blur
|
|
439
|
+
void main() {
|
|
440
|
+
#pragma mapbox: initialize highp vec4 fill_color
|
|
441
|
+
#pragma mapbox: initialize highp vec4 halo_color
|
|
442
|
+
#pragma mapbox: initialize lowp float opacity
|
|
443
|
+
#pragma mapbox: initialize lowp float halo_width
|
|
444
|
+
#pragma mapbox: initialize lowp float halo_blur
|
|
445
|
+
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.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[2];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;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
446
|
+
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
447
|
+
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp 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);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;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(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`);function qr(a,u){var l=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,c=u.match(/attribute ([\w]+) ([\w]+)/g),y=a.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),_=u.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),x=_?_.concat(y):y,S={};return{fragmentSource:a=a.replace(l,function(A,R,G,Z,V){return S[V]=!0,R==="define"?`
|
|
448
|
+
#ifndef HAS_UNIFORM_u_`+V+`
|
|
449
|
+
varying `+G+" "+Z+" "+V+`;
|
|
450
|
+
#else
|
|
451
|
+
uniform `+G+" "+Z+" u_"+V+`;
|
|
452
|
+
#endif
|
|
453
|
+
`:`
|
|
454
|
+
#ifdef HAS_UNIFORM_u_`+V+`
|
|
455
|
+
`+G+" "+Z+" "+V+" = u_"+V+`;
|
|
456
|
+
#endif
|
|
457
|
+
`}),vertexSource:u=u.replace(l,function(A,R,G,Z,V){var it=Z==="float"?"vec2":"vec4",et=V.match(/color/)?"color":it;return S[V]?R==="define"?`
|
|
458
|
+
#ifndef HAS_UNIFORM_u_`+V+`
|
|
459
|
+
uniform lowp float u_`+V+`_t;
|
|
460
|
+
attribute `+G+" "+it+" a_"+V+`;
|
|
461
|
+
varying `+G+" "+Z+" "+V+`;
|
|
462
|
+
#else
|
|
463
|
+
uniform `+G+" "+Z+" u_"+V+`;
|
|
464
|
+
#endif
|
|
465
|
+
`:et==="vec4"?`
|
|
466
|
+
#ifndef HAS_UNIFORM_u_`+V+`
|
|
467
|
+
`+V+" = a_"+V+`;
|
|
468
|
+
#else
|
|
469
|
+
`+G+" "+Z+" "+V+" = u_"+V+`;
|
|
470
|
+
#endif
|
|
471
|
+
`:`
|
|
472
|
+
#ifndef HAS_UNIFORM_u_`+V+`
|
|
473
|
+
`+V+" = unpack_mix_"+et+"(a_"+V+", u_"+V+`_t);
|
|
474
|
+
#else
|
|
475
|
+
`+G+" "+Z+" "+V+" = u_"+V+`;
|
|
476
|
+
#endif
|
|
477
|
+
`:R==="define"?`
|
|
478
|
+
#ifndef HAS_UNIFORM_u_`+V+`
|
|
479
|
+
uniform lowp float u_`+V+`_t;
|
|
480
|
+
attribute `+G+" "+it+" a_"+V+`;
|
|
481
|
+
#else
|
|
482
|
+
uniform `+G+" "+Z+" u_"+V+`;
|
|
483
|
+
#endif
|
|
484
|
+
`:et==="vec4"?`
|
|
485
|
+
#ifndef HAS_UNIFORM_u_`+V+`
|
|
486
|
+
`+G+" "+Z+" "+V+" = a_"+V+`;
|
|
487
|
+
#else
|
|
488
|
+
`+G+" "+Z+" "+V+" = u_"+V+`;
|
|
489
|
+
#endif
|
|
490
|
+
`:`
|
|
491
|
+
#ifndef HAS_UNIFORM_u_`+V+`
|
|
492
|
+
`+G+" "+Z+" "+V+" = unpack_mix_"+et+"(a_"+V+", u_"+V+`_t);
|
|
493
|
+
#else
|
|
494
|
+
`+G+" "+Z+" "+V+" = u_"+V+`;
|
|
495
|
+
#endif
|
|
496
|
+
`}),staticAttributes:c,staticUniforms:x}}var Is=Object.freeze({__proto__:null,prelude:fi,background:nu,backgroundPattern:Lp,circle:nm,clippingMask:om,heatmap:Uh,heatmapTexture:Gh,collisionBox:Vh,collisionCircle:jh,debug:kp,fill:Rp,fillOutline:am,fillOutlinePattern:ll,fillPattern:ul,fillExtrusion:zp,fillExtrusionPattern:Zi,hillshadePrepare:qh,hillshade:ra,line:ia,lineGradient:Na,linePattern:Fa,lineSDF:na,raster:Ba,symbolIcon:Ua,symbolSDF:oa,symbolTextAndIcon:Dp}),ou=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};function Op(a){for(var u=[],l=0;l<a.length;l++)if(a[l]!==null){var c=a[l].split(" ");u.push(c.pop())}return u}ou.prototype.bind=function(a,u,l,c,y,_,x,S){this.context=a;for(var A=this.boundPaintVertexBuffers.length!==c.length,R=0;!A&&R<c.length;R++)this.boundPaintVertexBuffers[R]!==c[R]&&(A=!0);a.extVertexArrayObject&&this.vao&&this.boundProgram===u&&this.boundLayoutVertexBuffer===l&&!A&&this.boundIndexBuffer===y&&this.boundVertexOffset===_&&this.boundDynamicVertexBuffer===x&&this.boundDynamicVertexBuffer2===S?(a.bindVertexArrayOES.set(this.vao),x&&x.bind(),y&&y.dynamicDraw&&y.bind(),S&&S.bind()):this.freshBind(u,l,c,y,_,x,S)},ou.prototype.freshBind=function(a,u,l,c,y,_,x){var S,A=a.numAttributes,R=this.context,G=R.gl;if(R.extVertexArrayObject)this.vao&&this.destroy(),this.vao=R.extVertexArrayObject.createVertexArrayOES(),R.bindVertexArrayOES.set(this.vao),S=0,this.boundProgram=a,this.boundLayoutVertexBuffer=u,this.boundPaintVertexBuffers=l,this.boundIndexBuffer=c,this.boundVertexOffset=y,this.boundDynamicVertexBuffer=_,this.boundDynamicVertexBuffer2=x;else{S=R.currentNumAttributes||0;for(var Z=A;Z<S;Z++)G.disableVertexAttribArray(Z)}u.enableAttributes(G,a);for(var V=0,it=l;V<it.length;V+=1)it[V].enableAttributes(G,a);_&&_.enableAttributes(G,a),x&&x.enableAttributes(G,a),u.bind(),u.setVertexAttribPointers(G,a,y);for(var et=0,ut=l;et<ut.length;et+=1){var tt=ut[et];tt.bind(),tt.setVertexAttribPointers(G,a,y)}_&&(_.bind(),_.setVertexAttribPointers(G,a,y)),c&&c.bind(),x&&(x.bind(),x.setVertexAttribPointers(G,a,y)),R.currentNumAttributes=A},ou.prototype.destroy=function(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)};var Np=function(a,u,l,c,y,_){var x=a.gl;this.program=x.createProgram();for(var S=Op(l.staticAttributes),A=c?c.getBinderAttributes():[],R=S.concat(A),G=l.staticUniforms?Op(l.staticUniforms):[],Z=c?c.getBinderUniforms():[],V=[],it=0,et=G.concat(Z);it<et.length;it+=1){var ut=et[it];V.indexOf(ut)<0&&V.push(ut)}var tt=c?c.defines():[];_&&tt.push("#define OVERDRAW_INSPECTOR;");var lt=tt.concat(fi.fragmentSource,l.fragmentSource).join(`
|
|
497
|
+
`),yt=tt.concat(fi.vertexSource,l.vertexSource).join(`
|
|
498
|
+
`),_t=x.createShader(x.FRAGMENT_SHADER);if(x.isContextLost())this.failedToCreate=!0;else{x.shaderSource(_t,lt),x.compileShader(_t),x.attachShader(this.program,_t);var It=x.createShader(x.VERTEX_SHADER);if(x.isContextLost())this.failedToCreate=!0;else{x.shaderSource(It,yt),x.compileShader(It),x.attachShader(this.program,It),this.attributes={};var Tt={};this.numAttributes=R.length;for(var Ct=0;Ct<this.numAttributes;Ct++)R[Ct]&&(x.bindAttribLocation(this.program,Ct,R[Ct]),this.attributes[R[Ct]]=Ct);x.linkProgram(this.program),x.deleteShader(It),x.deleteShader(_t);for(var Lt=0;Lt<V.length;Lt++){var qt=V[Lt];if(qt&&!Tt[qt]){var Ut=x.getUniformLocation(this.program,qt);Ut&&(Tt[qt]=Ut)}}this.fixedUniforms=y(a,Tt),this.binderUniforms=c?c.getUniforms(a,Tt):[]}}};function Fp(a,u,l){var c=1/bn(l,1,u.transform.tileZoom),y=Math.pow(2,l.tileID.overscaledZ),_=l.tileSize*Math.pow(2,u.transform.tileZoom)/y,x=_*(l.tileID.canonical.x+l.tileID.wrap*y),S=_*l.tileID.canonical.y;return{u_image:0,u_texsize:l.imageAtlasTexture.size,u_scale:[c,a.fromScale,a.toScale],u_fade:a.t,u_pixel_coord_upper:[x>>16,S>>16],u_pixel_coord_lower:[65535&x,65535&S]}}Np.prototype.draw=function(a,u,l,c,y,_,x,S,A,R,G,Z,V,it,et,ut){var tt,lt=a.gl;if(!this.failedToCreate){for(var yt in a.program.set(this.program),a.setDepthMode(l),a.setStencilMode(c),a.setColorMode(y),a.setCullFace(_),this.fixedUniforms)this.fixedUniforms[yt].set(x[yt]);it&&it.setUniforms(a,this.binderUniforms,Z,{zoom:V});for(var _t=(tt={},tt[lt.LINES]=2,tt[lt.TRIANGLES]=3,tt[lt.LINE_STRIP]=1,tt)[u],It=0,Tt=G.get();It<Tt.length;It+=1){var Ct=Tt[It],Lt=Ct.vaos||(Ct.vaos={});(Lt[S]||(Lt[S]=new ou)).bind(a,this,A,it?it.getPaintVertexBuffers():[],R,Ct.vertexOffset,et,ut),lt.drawElements(u,Ct.primitiveLength*_t,lt.UNSIGNED_SHORT,Ct.primitiveOffset*_t*2)}}};var Bp=function(a,u,l,c){var y=u.style.light,_=y.properties.get("position"),x=[_.x,_.y,_.z],S=i.create$1();y.properties.get("anchor")==="viewport"&&i.fromRotation(S,-u.transform.angle),i.transformMat3(x,x,S);var A=y.properties.get("color");return{u_matrix:a,u_lightpos:x,u_lightintensity:y.properties.get("intensity"),u_lightcolor:[A.r,A.g,A.b],u_vertical_gradient:+l,u_opacity:c}},sm=function(a,u,l,c,y,_,x){return i.extend(Bp(a,u,l,c),Fp(_,u,x),{u_height_factor:-Math.pow(2,y.overscaledZ)/x.tileSize/8})},aa=function(a){return{u_matrix:a}},sa=function(a,u,l,c){return i.extend(aa(a),Fp(l,u,c))},Cs=function(a,u){return{u_matrix:a,u_world:u}},Up=function(a,u,l,c,y){return i.extend(sa(a,u,l,c),{u_world:y})},Gp=function(a,u,l,c){var y,_,x=a.transform;if(c.paint.get("circle-pitch-alignment")==="map"){var S=bn(l,1,x.zoom);y=!0,_=[S,S]}else y=!1,_=x.pixelsToGLUnits;return{u_camera_to_center_distance:x.cameraToCenterDistance,u_scale_with_map:+(c.paint.get("circle-pitch-scale")==="map"),u_matrix:a.translatePosMatrix(u.posMatrix,l,c.paint.get("circle-translate"),c.paint.get("circle-translate-anchor")),u_pitch_with_map:+y,u_device_pixel_ratio:i.browser.devicePixelRatio,u_extrude_scale:_}},Wh=function(a,u,l){var c=bn(l,1,u.zoom),y=Math.pow(2,u.zoom-l.tileID.overscaledZ),_=l.tileID.overscaleFactor();return{u_matrix:a,u_camera_to_center_distance:u.cameraToCenterDistance,u_pixels_to_tile_units:c,u_extrude_scale:[u.pixelsToGLUnits[0]/(c*y),u.pixelsToGLUnits[1]/(c*y)],u_overscale_factor:_}},Ga=function(a,u,l){return{u_matrix:a,u_inv_matrix:u,u_camera_to_center_distance:l.cameraToCenterDistance,u_viewport_size:[l.width,l.height]}},Kh=function(a,u,l){return l===void 0&&(l=1),{u_matrix:a,u_color:u,u_overlay:0,u_overlay_scale:l}},Va=function(a){return{u_matrix:a}},As=function(a,u,l,c){return{u_matrix:a,u_extrude_scale:bn(u,1,l),u_intensity:c}},au=function(a,u,l){var c=a.transform;return{u_matrix:Ps(a,u,l),u_ratio:1/bn(u,1,c.zoom),u_device_pixel_ratio:i.browser.devicePixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},Hh=function(a,u,l,c){return i.extend(au(a,u,l),{u_image:0,u_image_height:c})},Lr=function(a,u,l,c){var y=a.transform,_=Vp(u,y);return{u_matrix:Ps(a,u,l),u_texsize:u.imageAtlasTexture.size,u_ratio:1/bn(u,1,y.zoom),u_device_pixel_ratio:i.browser.devicePixelRatio,u_image:0,u_scale:[_,c.fromScale,c.toScale],u_fade:c.t,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},su=function(a,u,l,c,y){var _=a.lineAtlas,x=Vp(u,a.transform),S=l.layout.get("line-cap")==="round",A=_.getDash(c.from,S),R=_.getDash(c.to,S),G=A.width*y.fromScale,Z=R.width*y.toScale;return i.extend(au(a,u,l),{u_patternscale_a:[x/G,-A.height/2],u_patternscale_b:[x/Z,-R.height/2],u_sdfgamma:_.width/(256*Math.min(G,Z)*i.browser.devicePixelRatio)/2,u_image:0,u_tex_y_a:A.y,u_tex_y_b:R.y,u_mix:y.t})};function Vp(a,u){return 1/bn(a,1,u.tileZoom)}function Ps(a,u,l){return a.translatePosMatrix(u.tileID.posMatrix,u,l.paint.get("line-translate"),l.paint.get("line-translate-anchor"))}var lm=function(a,u,l,c,y){return{u_matrix:a,u_tl_parent:u,u_scale_parent:l,u_buffer_scale:1,u_fade_t:c.mix,u_opacity:c.opacity*y.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:y.paint.get("raster-brightness-min"),u_brightness_high:y.paint.get("raster-brightness-max"),u_saturation_factor:(x=y.paint.get("raster-saturation"),x>0?1-1/(1.001-x):-x),u_contrast_factor:(_=y.paint.get("raster-contrast"),_>0?1/(1-_):1+_),u_spin_weights:um(y.paint.get("raster-hue-rotate"))};var _,x};function um(a){a*=Math.PI/180;var u=Math.sin(a),l=Math.cos(a);return[(2*l+1)/3,(-Math.sqrt(3)*u-l+1)/3,(Math.sqrt(3)*u-l+1)/3]}var hl,jp=function(a,u,l,c,y,_,x,S,A,R){var G=y.transform;return{u_is_size_zoom_constant:+(a==="constant"||a==="source"),u_is_size_feature_constant:+(a==="constant"||a==="camera"),u_size_t:u?u.uSizeT:0,u_size:u?u.uSize:0,u_camera_to_center_distance:G.cameraToCenterDistance,u_pitch:G.pitch/360*2*Math.PI,u_rotate_symbol:+l,u_aspect_ratio:G.width/G.height,u_fade_change:y.options.fadeDuration?y.symbolFadeChange:1,u_matrix:_,u_label_plane_matrix:x,u_coord_matrix:S,u_is_text:+A,u_pitch_with_map:+c,u_texsize:R,u_texture:0}},Ls=function(a,u,l,c,y,_,x,S,A,R,G){var Z=y.transform;return i.extend(jp(a,u,l,c,y,_,x,S,A,R),{u_gamma_scale:c?Math.cos(Z._pitch)*Z.cameraToCenterDistance:1,u_device_pixel_ratio:i.browser.devicePixelRatio,u_is_halo:+G})},lu=function(a,u,l,c,y,_,x,S,A,R){return i.extend(Ls(a,u,l,c,y,_,x,S,!0,A,!0),{u_texsize_icon:R,u_texture_icon:1})},uu=function(a,u,l){return{u_matrix:a,u_opacity:u,u_color:l}},cl=function(a,u,l,c,y,_){return i.extend(function(x,S,A,R){var G=A.imageManager.getPattern(x.from.toString()),Z=A.imageManager.getPattern(x.to.toString()),V=A.imageManager.getPixelSize(),it=V.width,et=V.height,ut=Math.pow(2,R.tileID.overscaledZ),tt=R.tileSize*Math.pow(2,A.transform.tileZoom)/ut,lt=tt*(R.tileID.canonical.x+R.tileID.wrap*ut),yt=tt*R.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:G.tl,u_pattern_br_a:G.br,u_pattern_tl_b:Z.tl,u_pattern_br_b:Z.br,u_texsize:[it,et],u_mix:S.t,u_pattern_size_a:G.displaySize,u_pattern_size_b:Z.displaySize,u_scale_a:S.fromScale,u_scale_b:S.toScale,u_tile_units_to_pixels:1/bn(R,1,A.transform.tileZoom),u_pixel_coord_upper:[lt>>16,yt>>16],u_pixel_coord_lower:[65535<,65535&yt]}}(c,_,l,y),{u_matrix:a,u_opacity:u})},ks={fillExtrusion:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_lightpos:new i.Uniform3f(a,u.u_lightpos),u_lightintensity:new i.Uniform1f(a,u.u_lightintensity),u_lightcolor:new i.Uniform3f(a,u.u_lightcolor),u_vertical_gradient:new i.Uniform1f(a,u.u_vertical_gradient),u_opacity:new i.Uniform1f(a,u.u_opacity)}},fillExtrusionPattern:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_lightpos:new i.Uniform3f(a,u.u_lightpos),u_lightintensity:new i.Uniform1f(a,u.u_lightintensity),u_lightcolor:new i.Uniform3f(a,u.u_lightcolor),u_vertical_gradient:new i.Uniform1f(a,u.u_vertical_gradient),u_height_factor:new i.Uniform1f(a,u.u_height_factor),u_image:new i.Uniform1i(a,u.u_image),u_texsize:new i.Uniform2f(a,u.u_texsize),u_pixel_coord_upper:new i.Uniform2f(a,u.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(a,u.u_pixel_coord_lower),u_scale:new i.Uniform3f(a,u.u_scale),u_fade:new i.Uniform1f(a,u.u_fade),u_opacity:new i.Uniform1f(a,u.u_opacity)}},fill:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix)}},fillPattern:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_image:new i.Uniform1i(a,u.u_image),u_texsize:new i.Uniform2f(a,u.u_texsize),u_pixel_coord_upper:new i.Uniform2f(a,u.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(a,u.u_pixel_coord_lower),u_scale:new i.Uniform3f(a,u.u_scale),u_fade:new i.Uniform1f(a,u.u_fade)}},fillOutline:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_world:new i.Uniform2f(a,u.u_world)}},fillOutlinePattern:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_world:new i.Uniform2f(a,u.u_world),u_image:new i.Uniform1i(a,u.u_image),u_texsize:new i.Uniform2f(a,u.u_texsize),u_pixel_coord_upper:new i.Uniform2f(a,u.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(a,u.u_pixel_coord_lower),u_scale:new i.Uniform3f(a,u.u_scale),u_fade:new i.Uniform1f(a,u.u_fade)}},circle:function(a,u){return{u_camera_to_center_distance:new i.Uniform1f(a,u.u_camera_to_center_distance),u_scale_with_map:new i.Uniform1i(a,u.u_scale_with_map),u_pitch_with_map:new i.Uniform1i(a,u.u_pitch_with_map),u_extrude_scale:new i.Uniform2f(a,u.u_extrude_scale),u_device_pixel_ratio:new i.Uniform1f(a,u.u_device_pixel_ratio),u_matrix:new i.UniformMatrix4f(a,u.u_matrix)}},collisionBox:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_camera_to_center_distance:new i.Uniform1f(a,u.u_camera_to_center_distance),u_pixels_to_tile_units:new i.Uniform1f(a,u.u_pixels_to_tile_units),u_extrude_scale:new i.Uniform2f(a,u.u_extrude_scale),u_overscale_factor:new i.Uniform1f(a,u.u_overscale_factor)}},collisionCircle:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_inv_matrix:new i.UniformMatrix4f(a,u.u_inv_matrix),u_camera_to_center_distance:new i.Uniform1f(a,u.u_camera_to_center_distance),u_viewport_size:new i.Uniform2f(a,u.u_viewport_size)}},debug:function(a,u){return{u_color:new i.UniformColor(a,u.u_color),u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_overlay:new i.Uniform1i(a,u.u_overlay),u_overlay_scale:new i.Uniform1f(a,u.u_overlay_scale)}},clippingMask:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix)}},heatmap:function(a,u){return{u_extrude_scale:new i.Uniform1f(a,u.u_extrude_scale),u_intensity:new i.Uniform1f(a,u.u_intensity),u_matrix:new i.UniformMatrix4f(a,u.u_matrix)}},heatmapTexture:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_world:new i.Uniform2f(a,u.u_world),u_image:new i.Uniform1i(a,u.u_image),u_color_ramp:new i.Uniform1i(a,u.u_color_ramp),u_opacity:new i.Uniform1f(a,u.u_opacity)}},hillshade:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_image:new i.Uniform1i(a,u.u_image),u_latrange:new i.Uniform2f(a,u.u_latrange),u_light:new i.Uniform2f(a,u.u_light),u_shadow:new i.UniformColor(a,u.u_shadow),u_highlight:new i.UniformColor(a,u.u_highlight),u_accent:new i.UniformColor(a,u.u_accent)}},hillshadePrepare:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_image:new i.Uniform1i(a,u.u_image),u_dimension:new i.Uniform2f(a,u.u_dimension),u_zoom:new i.Uniform1f(a,u.u_zoom),u_unpack:new i.Uniform4f(a,u.u_unpack)}},line:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_ratio:new i.Uniform1f(a,u.u_ratio),u_device_pixel_ratio:new i.Uniform1f(a,u.u_device_pixel_ratio),u_units_to_pixels:new i.Uniform2f(a,u.u_units_to_pixels)}},lineGradient:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_ratio:new i.Uniform1f(a,u.u_ratio),u_device_pixel_ratio:new i.Uniform1f(a,u.u_device_pixel_ratio),u_units_to_pixels:new i.Uniform2f(a,u.u_units_to_pixels),u_image:new i.Uniform1i(a,u.u_image),u_image_height:new i.Uniform1f(a,u.u_image_height)}},linePattern:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_texsize:new i.Uniform2f(a,u.u_texsize),u_ratio:new i.Uniform1f(a,u.u_ratio),u_device_pixel_ratio:new i.Uniform1f(a,u.u_device_pixel_ratio),u_image:new i.Uniform1i(a,u.u_image),u_units_to_pixels:new i.Uniform2f(a,u.u_units_to_pixels),u_scale:new i.Uniform3f(a,u.u_scale),u_fade:new i.Uniform1f(a,u.u_fade)}},lineSDF:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_ratio:new i.Uniform1f(a,u.u_ratio),u_device_pixel_ratio:new i.Uniform1f(a,u.u_device_pixel_ratio),u_units_to_pixels:new i.Uniform2f(a,u.u_units_to_pixels),u_patternscale_a:new i.Uniform2f(a,u.u_patternscale_a),u_patternscale_b:new i.Uniform2f(a,u.u_patternscale_b),u_sdfgamma:new i.Uniform1f(a,u.u_sdfgamma),u_image:new i.Uniform1i(a,u.u_image),u_tex_y_a:new i.Uniform1f(a,u.u_tex_y_a),u_tex_y_b:new i.Uniform1f(a,u.u_tex_y_b),u_mix:new i.Uniform1f(a,u.u_mix)}},raster:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_tl_parent:new i.Uniform2f(a,u.u_tl_parent),u_scale_parent:new i.Uniform1f(a,u.u_scale_parent),u_buffer_scale:new i.Uniform1f(a,u.u_buffer_scale),u_fade_t:new i.Uniform1f(a,u.u_fade_t),u_opacity:new i.Uniform1f(a,u.u_opacity),u_image0:new i.Uniform1i(a,u.u_image0),u_image1:new i.Uniform1i(a,u.u_image1),u_brightness_low:new i.Uniform1f(a,u.u_brightness_low),u_brightness_high:new i.Uniform1f(a,u.u_brightness_high),u_saturation_factor:new i.Uniform1f(a,u.u_saturation_factor),u_contrast_factor:new i.Uniform1f(a,u.u_contrast_factor),u_spin_weights:new i.Uniform3f(a,u.u_spin_weights)}},symbolIcon:function(a,u){return{u_is_size_zoom_constant:new i.Uniform1i(a,u.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(a,u.u_is_size_feature_constant),u_size_t:new i.Uniform1f(a,u.u_size_t),u_size:new i.Uniform1f(a,u.u_size),u_camera_to_center_distance:new i.Uniform1f(a,u.u_camera_to_center_distance),u_pitch:new i.Uniform1f(a,u.u_pitch),u_rotate_symbol:new i.Uniform1i(a,u.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(a,u.u_aspect_ratio),u_fade_change:new i.Uniform1f(a,u.u_fade_change),u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(a,u.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(a,u.u_coord_matrix),u_is_text:new i.Uniform1i(a,u.u_is_text),u_pitch_with_map:new i.Uniform1i(a,u.u_pitch_with_map),u_texsize:new i.Uniform2f(a,u.u_texsize),u_texture:new i.Uniform1i(a,u.u_texture)}},symbolSDF:function(a,u){return{u_is_size_zoom_constant:new i.Uniform1i(a,u.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(a,u.u_is_size_feature_constant),u_size_t:new i.Uniform1f(a,u.u_size_t),u_size:new i.Uniform1f(a,u.u_size),u_camera_to_center_distance:new i.Uniform1f(a,u.u_camera_to_center_distance),u_pitch:new i.Uniform1f(a,u.u_pitch),u_rotate_symbol:new i.Uniform1i(a,u.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(a,u.u_aspect_ratio),u_fade_change:new i.Uniform1f(a,u.u_fade_change),u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(a,u.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(a,u.u_coord_matrix),u_is_text:new i.Uniform1i(a,u.u_is_text),u_pitch_with_map:new i.Uniform1i(a,u.u_pitch_with_map),u_texsize:new i.Uniform2f(a,u.u_texsize),u_texture:new i.Uniform1i(a,u.u_texture),u_gamma_scale:new i.Uniform1f(a,u.u_gamma_scale),u_device_pixel_ratio:new i.Uniform1f(a,u.u_device_pixel_ratio),u_is_halo:new i.Uniform1i(a,u.u_is_halo)}},symbolTextAndIcon:function(a,u){return{u_is_size_zoom_constant:new i.Uniform1i(a,u.u_is_size_zoom_constant),u_is_size_feature_constant:new i.Uniform1i(a,u.u_is_size_feature_constant),u_size_t:new i.Uniform1f(a,u.u_size_t),u_size:new i.Uniform1f(a,u.u_size),u_camera_to_center_distance:new i.Uniform1f(a,u.u_camera_to_center_distance),u_pitch:new i.Uniform1f(a,u.u_pitch),u_rotate_symbol:new i.Uniform1i(a,u.u_rotate_symbol),u_aspect_ratio:new i.Uniform1f(a,u.u_aspect_ratio),u_fade_change:new i.Uniform1f(a,u.u_fade_change),u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_label_plane_matrix:new i.UniformMatrix4f(a,u.u_label_plane_matrix),u_coord_matrix:new i.UniformMatrix4f(a,u.u_coord_matrix),u_is_text:new i.Uniform1i(a,u.u_is_text),u_pitch_with_map:new i.Uniform1i(a,u.u_pitch_with_map),u_texsize:new i.Uniform2f(a,u.u_texsize),u_texsize_icon:new i.Uniform2f(a,u.u_texsize_icon),u_texture:new i.Uniform1i(a,u.u_texture),u_texture_icon:new i.Uniform1i(a,u.u_texture_icon),u_gamma_scale:new i.Uniform1f(a,u.u_gamma_scale),u_device_pixel_ratio:new i.Uniform1f(a,u.u_device_pixel_ratio),u_is_halo:new i.Uniform1i(a,u.u_is_halo)}},background:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_opacity:new i.Uniform1f(a,u.u_opacity),u_color:new i.UniformColor(a,u.u_color)}},backgroundPattern:function(a,u){return{u_matrix:new i.UniformMatrix4f(a,u.u_matrix),u_opacity:new i.Uniform1f(a,u.u_opacity),u_image:new i.Uniform1i(a,u.u_image),u_pattern_tl_a:new i.Uniform2f(a,u.u_pattern_tl_a),u_pattern_br_a:new i.Uniform2f(a,u.u_pattern_br_a),u_pattern_tl_b:new i.Uniform2f(a,u.u_pattern_tl_b),u_pattern_br_b:new i.Uniform2f(a,u.u_pattern_br_b),u_texsize:new i.Uniform2f(a,u.u_texsize),u_mix:new i.Uniform1f(a,u.u_mix),u_pattern_size_a:new i.Uniform2f(a,u.u_pattern_size_a),u_pattern_size_b:new i.Uniform2f(a,u.u_pattern_size_b),u_scale_a:new i.Uniform1f(a,u.u_scale_a),u_scale_b:new i.Uniform1f(a,u.u_scale_b),u_pixel_coord_upper:new i.Uniform2f(a,u.u_pixel_coord_upper),u_pixel_coord_lower:new i.Uniform2f(a,u.u_pixel_coord_lower),u_tile_units_to_pixels:new i.Uniform1f(a,u.u_tile_units_to_pixels)}}};function Zh(a,u,l,c,y,_,x){for(var S=a.context,A=S.gl,R=a.useProgram("collisionBox"),G=[],Z=0,V=0,it=0;it<c.length;it++){var et=c[it],ut=u.getTile(et),tt=ut.getBucket(l);if(tt){var lt=et.posMatrix;y[0]===0&&y[1]===0||(lt=a.translatePosMatrix(et.posMatrix,ut,y,_));var yt=x?tt.textCollisionBox:tt.iconCollisionBox,_t=tt.collisionCircleArray;if(_t.length>0){var It=i.create(),Tt=lt;i.mul(It,tt.placementInvProjMatrix,a.transform.glCoordMatrix),i.mul(It,It,tt.placementViewportMatrix),G.push({circleArray:_t,circleOffset:V,transform:Tt,invTransform:It}),V=Z+=_t.length/4}yt&&R.draw(S,A.LINES,H.disabled,rt.disabled,a.colorModeForRenderPass(),gt.disabled,Wh(lt,a.transform,ut),l.id,yt.layoutVertexBuffer,yt.indexBuffer,yt.segments,null,a.transform.zoom,null,null,yt.collisionVertexBuffer)}}if(x&&G.length){var Ct=a.useProgram("collisionCircle"),Lt=new i.StructArrayLayout2f1f2i16;Lt.resize(4*Z),Lt._trim();for(var qt=0,Ut=0,ie=G;Ut<ie.length;Ut+=1)for(var _e=ie[Ut],Se=0;Se<_e.circleArray.length/4;Se++){var xe=4*Se,nr=_e.circleArray[xe+0],ue=_e.circleArray[xe+1],De=_e.circleArray[xe+2],je=_e.circleArray[xe+3];Lt.emplace(qt++,nr,ue,De,je,0),Lt.emplace(qt++,nr,ue,De,je,1),Lt.emplace(qt++,nr,ue,De,je,2),Lt.emplace(qt++,nr,ue,De,je,3)}(!hl||hl.length<2*Z)&&(hl=function(ai){var un=2*ai,Li=new i.StructArrayLayout3ui6;Li.resize(un),Li._trim();for(var ki=0;ki<un;ki++){var si=6*ki;Li.uint16[si+0]=4*ki+0,Li.uint16[si+1]=4*ki+1,Li.uint16[si+2]=4*ki+2,Li.uint16[si+3]=4*ki+2,Li.uint16[si+4]=4*ki+3,Li.uint16[si+5]=4*ki+0}return Li}(Z));for(var Oe=S.createIndexBuffer(hl,!0),ze=S.createVertexBuffer(Lt,i.collisionCircleLayout.members,!0),Re=0,Pe=G;Re<Pe.length;Re+=1){var Ee=Pe[Re],wr=Ga(Ee.transform,Ee.invTransform,a.transform);Ct.draw(S,A.TRIANGLES,H.disabled,rt.disabled,a.colorModeForRenderPass(),gt.disabled,wr,l.id,ze,Oe,i.SegmentVector.simpleSegment(0,2*Ee.circleOffset,Ee.circleArray.length,Ee.circleArray.length/2),null,a.transform.zoom,null,null,null)}ze.destroy(),Oe.destroy()}}var pl=i.identity(new Float32Array(16));function fo(a,u,l,c,y,_){var x=i.getAnchorAlignment(a),S=-(x.horizontalAlign-.5)*u,A=-(x.verticalAlign-.5)*l,R=i.evaluateVariableOffset(a,c);return new i.Point((S/y+R[0])*_,(A/y+R[1])*_)}function qp(a,u,l,c,y,_,x,S,A,R,G){var Z=a.text.placedSymbolArray,V=a.text.dynamicLayoutVertexArray,it=a.icon.dynamicLayoutVertexArray,et={};V.clear();for(var ut=0;ut<Z.length;ut++){var tt=Z.get(ut),lt=tt.hidden||!tt.crossTileID||a.allowVerticalPlacement&&!tt.placedOrientation?null:c[tt.crossTileID];if(lt){var yt=new i.Point(tt.anchorX,tt.anchorY),_t=Ke(yt,l?S:x),It=Ts(_.cameraToCenterDistance,_t.signedDistanceFromCamera),Tt=y.evaluateSizeForFeature(a.textSizeData,R,tt)*It/i.ONE_EM;l&&(Tt*=a.tilePixelRatio/A);for(var Ct=fo(lt.anchor,lt.width,lt.height,lt.textOffset,lt.textBoxScale,Tt),Lt=l?Ke(yt.add(Ct),x).point:_t.point.add(u?Ct.rotate(-_.angle):Ct),qt=a.allowVerticalPlacement&&tt.placedOrientation===i.WritingMode.vertical?Math.PI/2:0,Ut=0;Ut<tt.numGlyphs;Ut++)i.addDynamicAttributes(V,Lt,qt);G&&tt.associatedIconIndex>=0&&(et[tt.associatedIconIndex]={shiftedAnchor:Lt,angle:qt})}else So(tt.numGlyphs,V)}if(G){it.clear();for(var ie=a.icon.placedSymbolArray,_e=0;_e<ie.length;_e++){var Se=ie.get(_e);if(Se.hidden)So(Se.numGlyphs,it);else{var xe=et[_e];if(xe)for(var nr=0;nr<Se.numGlyphs;nr++)i.addDynamicAttributes(it,xe.shiftedAnchor,xe.angle);else So(Se.numGlyphs,it)}}a.icon.dynamicLayoutVertexBuffer.updateData(it)}a.text.dynamicLayoutVertexBuffer.updateData(V)}function Wp(a,u,l){return l.iconsInText&&u?"symbolTextAndIcon":a?"symbolSDF":"symbolIcon"}function Xh(a,u,l,c,y,_,x,S,A,R,G,Z){for(var V=a.context,it=V.gl,et=a.transform,ut=S==="map",tt=A==="map",lt=ut&&l.layout.get("symbol-placement")!=="point",yt=ut&&!tt&&!lt,_t=!l.layout.get("symbol-sort-key").isConstant(),It=!1,Tt=a.depthModeForSublayer(0,H.ReadOnly),Ct=l.layout.get("text-variable-anchor"),Lt=[],qt=0,Ut=c;qt<Ut.length;qt+=1){var ie=Ut[qt],_e=u.getTile(ie),Se=_e.getBucket(l);if(Se){var xe=y?Se.text:Se.icon;if(xe&&xe.segments.get().length){var nr=xe.programConfigurations.get(l.id),ue=y||Se.sdfIcons,De=y?Se.textSizeData:Se.iconSizeData,je=tt||et.pitch!==0,Oe=a.useProgram(Wp(ue,y,Se),nr),ze=i.evaluateSizeForZoom(De,et.zoom),Re=void 0,Pe=[0,0],Ee=void 0,wr=void 0,ai=null,un=void 0;if(y)Ee=_e.glyphAtlasTexture,wr=it.LINEAR,Re=_e.glyphAtlasTexture.size,Se.iconsInText&&(Pe=_e.imageAtlasTexture.size,ai=_e.imageAtlasTexture,un=je||a.options.rotating||a.options.zooming||De.kind==="composite"||De.kind==="camera"?it.LINEAR:it.NEAREST);else{var Li=l.layout.get("icon-size").constantOr(0)!==1||Se.iconsNeedLinear;Ee=_e.imageAtlasTexture,wr=ue||a.options.rotating||a.options.zooming||Li||je?it.LINEAR:it.NEAREST,Re=_e.imageAtlasTexture.size}var ki=bn(_e,1,a.transform.zoom),si=Jr(ie.posMatrix,tt,ut,a.transform,ki),en=Mr(ie.posMatrix,tt,ut,a.transform,ki),Mo=Ct&&Se.hasTextData(),hn=l.layout.get("icon-text-fit")!=="none"&&Mo&&Se.hasIconData();lt&&za(Se,ie.posMatrix,a,y,si,en,tt,R);var cn=a.translatePosMatrix(ie.posMatrix,_e,_,x),Io=lt||y&&Ct||hn?pl:si,Xn=a.translatePosMatrix(en,_e,_,x,!0),lc=ue&&l.paint.get(y?"text-halo-width":"icon-halo-width").constantOr(1)!==0,fa={program:Oe,buffers:xe,uniformValues:ue?Se.iconsInText?lu(De.kind,ze,yt,tt,a,cn,Io,Xn,Re,Pe):Ls(De.kind,ze,yt,tt,a,cn,Io,Xn,y,Re,!0):jp(De.kind,ze,yt,tt,a,cn,Io,Xn,y,Re),atlasTexture:Ee,atlasTextureIcon:ai,atlasInterpolation:wr,atlasInterpolationIcon:un,isSDF:ue,hasHalo:lc};if(_t&&Se.canOverlap){It=!0;for(var Os=0,Ya=xe.segments.get();Os<Ya.length;Os+=1){var Tl=Ya[Os];Lt.push({segments:new i.SegmentVector([Tl]),sortKey:Tl.sortKey,state:fa})}}else Lt.push({segments:xe.segments,sortKey:0,state:fa})}}}It&&Lt.sort(function(yo,Ja){return yo.sortKey-Ja.sortKey});for(var Ns=0,Co=Lt;Ns<Co.length;Ns+=1){var Fs=Co[Ns],xi=Fs.state;if(V.activeTexture.set(it.TEXTURE0),xi.atlasTexture.bind(xi.atlasInterpolation,it.CLAMP_TO_EDGE),xi.atlasTextureIcon&&(V.activeTexture.set(it.TEXTURE1),xi.atlasTextureIcon&&xi.atlasTextureIcon.bind(xi.atlasInterpolationIcon,it.CLAMP_TO_EDGE)),xi.isSDF){var Vo=xi.uniformValues;xi.hasHalo&&(Vo.u_is_halo=1,ja(xi.buffers,Fs.segments,l,a,xi.program,Tt,G,Z,Vo)),Vo.u_is_halo=0}ja(xi.buffers,Fs.segments,l,a,xi.program,Tt,G,Z,xi.uniformValues)}}function ja(a,u,l,c,y,_,x,S,A){var R=c.context;y.draw(R,R.gl.TRIANGLES,_,x,S,gt.disabled,A,l.id,a.layoutVertexBuffer,a.indexBuffer,u,l.paint,c.transform.zoom,a.programConfigurations.get(l.id),a.dynamicLayoutVertexBuffer,a.opacityVertexBuffer)}function fl(a,u,l,c,y,_,x){var S,A,R,G,Z,V=a.context.gl,it=l.paint.get("fill-pattern"),et=it&&it.constantOr(1),ut=l.getCrossfadeParameters();x?(A=et&&!l.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",S=V.LINES):(A=et?"fillPattern":"fill",S=V.TRIANGLES);for(var tt=0,lt=c;tt<lt.length;tt+=1){var yt=lt[tt],_t=u.getTile(yt);if(!et||_t.patternsLoaded()){var It=_t.getBucket(l);if(It){var Tt=It.programConfigurations.get(l.id),Ct=a.useProgram(A,Tt);et&&(a.context.activeTexture.set(V.TEXTURE0),_t.imageAtlasTexture.bind(V.LINEAR,V.CLAMP_TO_EDGE),Tt.updatePaintBuffers(ut));var Lt=it.constantOr(null);if(Lt&&_t.imageAtlas){var qt=_t.imageAtlas,Ut=qt.patternPositions[Lt.to.toString()],ie=qt.patternPositions[Lt.from.toString()];Ut&&ie&&Tt.setConstantPatternPositions(Ut,ie)}var _e=a.translatePosMatrix(yt.posMatrix,_t,l.paint.get("fill-translate"),l.paint.get("fill-translate-anchor"));if(x){G=It.indexBuffer2,Z=It.segments2;var Se=[V.drawingBufferWidth,V.drawingBufferHeight];R=A==="fillOutlinePattern"&&et?Up(_e,a,ut,_t,Se):Cs(_e,Se)}else G=It.indexBuffer,Z=It.segments,R=et?sa(_e,a,ut,_t):aa(_e);Ct.draw(a.context,S,y,a.stencilModeForClipping(yt),_,gt.disabled,R,l.id,It.layoutVertexBuffer,G,Z,l.paint,a.transform.zoom,Tt)}}}}function dl(a,u,l,c,y,_,x){for(var S=a.context,A=S.gl,R=l.paint.get("fill-extrusion-pattern"),G=R.constantOr(1),Z=l.getCrossfadeParameters(),V=l.paint.get("fill-extrusion-opacity"),it=0,et=c;it<et.length;it+=1){var ut=et[it],tt=u.getTile(ut),lt=tt.getBucket(l);if(lt){var yt=lt.programConfigurations.get(l.id),_t=a.useProgram(G?"fillExtrusionPattern":"fillExtrusion",yt);G&&(a.context.activeTexture.set(A.TEXTURE0),tt.imageAtlasTexture.bind(A.LINEAR,A.CLAMP_TO_EDGE),yt.updatePaintBuffers(Z));var It=R.constantOr(null);if(It&&tt.imageAtlas){var Tt=tt.imageAtlas,Ct=Tt.patternPositions[It.to.toString()],Lt=Tt.patternPositions[It.from.toString()];Ct&&Lt&&yt.setConstantPatternPositions(Ct,Lt)}var qt=a.translatePosMatrix(ut.posMatrix,tt,l.paint.get("fill-extrusion-translate"),l.paint.get("fill-extrusion-translate-anchor")),Ut=l.paint.get("fill-extrusion-vertical-gradient"),ie=G?sm(qt,a,Ut,V,ut,Z,tt):Bp(qt,a,Ut,V);_t.draw(S,S.gl.TRIANGLES,y,_,x,gt.backCCW,ie,l.id,lt.layoutVertexBuffer,lt.indexBuffer,lt.segments,l.paint,a.transform.zoom,yt)}}}function hm(a,u,l,c,y,_){var x=a.context,S=x.gl,A=u.fbo;if(A){var R=a.useProgram("hillshade");x.activeTexture.set(S.TEXTURE0),S.bindTexture(S.TEXTURE_2D,A.colorAttachment.get());var G=function(Z,V,it){var et=it.paint.get("hillshade-shadow-color"),ut=it.paint.get("hillshade-highlight-color"),tt=it.paint.get("hillshade-accent-color"),lt=it.paint.get("hillshade-illumination-direction")*(Math.PI/180);it.paint.get("hillshade-illumination-anchor")==="viewport"&&(lt-=Z.transform.angle);var yt,_t,It,Tt=!Z.options.moving;return{u_matrix:Z.transform.calculatePosMatrix(V.tileID.toUnwrapped(),Tt),u_image:0,u_latrange:(yt=V.tileID,_t=Math.pow(2,yt.canonical.z),It=yt.canonical.y,[new i.MercatorCoordinate(0,It/_t).toLngLat().lat,new i.MercatorCoordinate(0,(It+1)/_t).toLngLat().lat]),u_light:[it.paint.get("hillshade-exaggeration"),lt],u_shadow:et,u_highlight:ut,u_accent:tt}}(a,u,l);R.draw(x,S.TRIANGLES,c,y,_,gt.disabled,G,l.id,a.rasterBoundsBuffer,a.quadTriangleIndexBuffer,a.rasterBoundsSegments)}}function hu(a,u,l,c,y,_){var x=a.context,S=x.gl,A=u.dem;if(A&&A.data){var R=A.dim,G=A.stride,Z=A.getPixels();if(x.activeTexture.set(S.TEXTURE1),x.pixelStoreUnpackPremultiplyAlpha.set(!1),u.demTexture=u.demTexture||a.getTileTexture(G),u.demTexture){var V=u.demTexture;V.update(Z,{premultiply:!1}),V.bind(S.NEAREST,S.CLAMP_TO_EDGE)}else u.demTexture=new i.Texture(x,Z,S.RGBA,{premultiply:!1}),u.demTexture.bind(S.NEAREST,S.CLAMP_TO_EDGE);x.activeTexture.set(S.TEXTURE0);var it=u.fbo;if(!it){var et=new i.Texture(x,{width:R,height:R,data:null},S.RGBA);et.bind(S.LINEAR,S.CLAMP_TO_EDGE),(it=u.fbo=x.createFramebuffer(R,R,!0)).colorAttachment.set(et.texture)}x.bindFramebuffer.set(it.framebuffer),x.viewport.set([0,0,R,R]),a.useProgram("hillshadePrepare").draw(x,S.TRIANGLES,c,y,_,gt.disabled,function(ut,tt){var lt=tt.stride,yt=i.create();return i.ortho(yt,0,i.EXTENT,-i.EXTENT,0,0,1),i.translate(yt,yt,[0,-i.EXTENT,0]),{u_matrix:yt,u_image:1,u_dimension:[lt,lt],u_zoom:ut.overscaledZ,u_unpack:tt.getUnpackVector()}}(u.tileID,A),l.id,a.rasterBoundsBuffer,a.quadTriangleIndexBuffer,a.rasterBoundsSegments),u.needsHillshadePrepare=!1}}function cm(a,u,l,c,y){var _=c.paint.get("raster-fade-duration");if(_>0){var x=i.browser.now(),S=(x-a.timeAdded)/_,A=u?(x-u.timeAdded)/_:-1,R=l.getSource(),G=y.coveringZoomLevel({tileSize:R.tileSize,roundZoom:R.roundZoom}),Z=!u||Math.abs(u.tileID.overscaledZ-G)>Math.abs(a.tileID.overscaledZ-G),V=Z&&a.refreshedUponExpiration?1:i.clamp(Z?S:1-A,0,1);return a.refreshedUponExpiration&&S>=1&&(a.refreshedUponExpiration=!1),u?{opacity:1,mix:1-V}:{opacity:V,mix:0}}return{opacity:1,mix:0}}var cu=new i.Color(1,0,0,1),Yh=new i.Color(0,1,0,1),Kp=new i.Color(0,0,1,1),Hp=new i.Color(1,0,1,1),pu=new i.Color(0,1,1,1);function fu(a,u,l,c){ml(a,0,u+l/2,a.transform.width,l,c)}function Jh(a,u,l,c){ml(a,u-l/2,0,l,a.transform.height,c)}function ml(a,u,l,c,y,_){var x=a.context,S=x.gl;S.enable(S.SCISSOR_TEST),S.scissor(u*i.browser.devicePixelRatio,l*i.browser.devicePixelRatio,c*i.browser.devicePixelRatio,y*i.browser.devicePixelRatio),x.clear({color:_}),S.disable(S.SCISSOR_TEST)}function Zp(a,u,l){var c=a.context,y=c.gl,_=l.posMatrix,x=a.useProgram("debug"),S=H.disabled,A=rt.disabled,R=a.colorModeForRenderPass();c.activeTexture.set(y.TEXTURE0),a.emptyTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),x.draw(c,y.LINE_STRIP,S,A,R,gt.disabled,Kh(_,i.Color.red),"$debug",a.debugBuffer,a.tileBorderIndexBuffer,a.debugSegments);var G=u.getTileByID(l.key).latestRawTileData,Z=Math.floor((G&&G.byteLength||0)/1024),V=u.getTile(l).tileSize,it=512/Math.min(V,512)*(l.overscaledZ/a.transform.zoom)*.5,et=l.canonical.toString();l.overscaledZ!==l.canonical.z&&(et+=" => "+l.overscaledZ),function(ut,tt){ut.initDebugOverlayCanvas();var lt=ut.debugOverlayCanvas,yt=ut.context.gl,_t=ut.debugOverlayCanvas.getContext("2d");_t.clearRect(0,0,lt.width,lt.height),_t.shadowColor="white",_t.shadowBlur=2,_t.lineWidth=1.5,_t.strokeStyle="white",_t.textBaseline="top",_t.font="bold 36px Open Sans, sans-serif",_t.fillText(tt,5,5),_t.strokeText(tt,5,5),ut.debugOverlayTexture.update(lt),ut.debugOverlayTexture.bind(yt.LINEAR,yt.CLAMP_TO_EDGE)}(a,et+" "+Z+"kb"),x.draw(c,y.TRIANGLES,S,A,pt.alphaBlended,gt.disabled,Kh(_,i.Color.transparent,it),"$debug",a.debugBuffer,a.quadTriangleIndexBuffer,a.debugSegments)}var Qh={symbol:function(a,u,l,c,y){if(a.renderPass==="translucent"){var _=rt.disabled,x=a.colorModeForRenderPass();l.layout.get("text-variable-anchor")&&function(S,A,R,G,Z,V,it){for(var et=A.transform,ut=Z==="map",tt=V==="map",lt=0,yt=S;lt<yt.length;lt+=1){var _t=yt[lt],It=G.getTile(_t),Tt=It.getBucket(R);if(Tt&&Tt.text&&Tt.text.segments.get().length){var Ct=i.evaluateSizeForZoom(Tt.textSizeData,et.zoom),Lt=bn(It,1,A.transform.zoom),qt=Jr(_t.posMatrix,tt,ut,A.transform,Lt),Ut=R.layout.get("icon-text-fit")!=="none"&&Tt.hasIconData();if(Ct){var ie=Math.pow(2,et.zoom-It.tileID.overscaledZ);qp(Tt,ut,tt,it,i.symbolSize,et,qt,_t.posMatrix,ie,Ct,Ut)}}}}(c,a,l,u,l.layout.get("text-rotation-alignment"),l.layout.get("text-pitch-alignment"),y),l.paint.get("icon-opacity").constantOr(1)!==0&&Xh(a,u,l,c,!1,l.paint.get("icon-translate"),l.paint.get("icon-translate-anchor"),l.layout.get("icon-rotation-alignment"),l.layout.get("icon-pitch-alignment"),l.layout.get("icon-keep-upright"),_,x),l.paint.get("text-opacity").constantOr(1)!==0&&Xh(a,u,l,c,!0,l.paint.get("text-translate"),l.paint.get("text-translate-anchor"),l.layout.get("text-rotation-alignment"),l.layout.get("text-pitch-alignment"),l.layout.get("text-keep-upright"),_,x),u.map.showCollisionBoxes&&(Zh(a,u,l,c,l.paint.get("text-translate"),l.paint.get("text-translate-anchor"),!0),Zh(a,u,l,c,l.paint.get("icon-translate"),l.paint.get("icon-translate-anchor"),!1))}},circle:function(a,u,l,c){if(a.renderPass==="translucent"){var y=l.paint.get("circle-opacity"),_=l.paint.get("circle-stroke-width"),x=l.paint.get("circle-stroke-opacity"),S=!l.layout.get("circle-sort-key").isConstant();if(y.constantOr(1)!==0||_.constantOr(1)!==0&&x.constantOr(1)!==0){for(var A=a.context,R=A.gl,G=a.depthModeForSublayer(0,H.ReadOnly),Z=rt.disabled,V=a.colorModeForRenderPass(),it=[],et=0;et<c.length;et++){var ut=c[et],tt=u.getTile(ut),lt=tt.getBucket(l);if(lt){var yt=lt.programConfigurations.get(l.id),_t={programConfiguration:yt,program:a.useProgram("circle",yt),layoutVertexBuffer:lt.layoutVertexBuffer,indexBuffer:lt.indexBuffer,uniformValues:Gp(a,ut,tt,l)};if(S)for(var It=0,Tt=lt.segments.get();It<Tt.length;It+=1){var Ct=Tt[It];it.push({segments:new i.SegmentVector([Ct]),sortKey:Ct.sortKey,state:_t})}else it.push({segments:lt.segments,sortKey:0,state:_t})}}S&&it.sort(function(_e,Se){return _e.sortKey-Se.sortKey});for(var Lt=0,qt=it;Lt<qt.length;Lt+=1){var Ut=qt[Lt],ie=Ut.state;ie.program.draw(A,R.TRIANGLES,G,Z,V,gt.disabled,ie.uniformValues,l.id,ie.layoutVertexBuffer,ie.indexBuffer,Ut.segments,l.paint,a.transform.zoom,ie.programConfiguration)}}}},heatmap:function(a,u,l,c){if(l.paint.get("heatmap-opacity")!==0)if(a.renderPass==="offscreen"){var y=a.context,_=y.gl,x=rt.disabled,S=new pt([_.ONE,_.ONE],i.Color.transparent,[!0,!0,!0,!0]);(function(it,et,ut){var tt=it.gl;it.activeTexture.set(tt.TEXTURE1),it.viewport.set([0,0,et.width/4,et.height/4]);var lt=ut.heatmapFbo;if(lt)tt.bindTexture(tt.TEXTURE_2D,lt.colorAttachment.get()),it.bindFramebuffer.set(lt.framebuffer);else{var yt=tt.createTexture();tt.bindTexture(tt.TEXTURE_2D,yt),tt.texParameteri(tt.TEXTURE_2D,tt.TEXTURE_WRAP_S,tt.CLAMP_TO_EDGE),tt.texParameteri(tt.TEXTURE_2D,tt.TEXTURE_WRAP_T,tt.CLAMP_TO_EDGE),tt.texParameteri(tt.TEXTURE_2D,tt.TEXTURE_MIN_FILTER,tt.LINEAR),tt.texParameteri(tt.TEXTURE_2D,tt.TEXTURE_MAG_FILTER,tt.LINEAR),lt=ut.heatmapFbo=it.createFramebuffer(et.width/4,et.height/4,!1),function(_t,It,Tt,Ct){var Lt=_t.gl;Lt.texImage2D(Lt.TEXTURE_2D,0,Lt.RGBA,It.width/4,It.height/4,0,Lt.RGBA,_t.extRenderToTextureHalfFloat?_t.extTextureHalfFloat.HALF_FLOAT_OES:Lt.UNSIGNED_BYTE,null),Ct.colorAttachment.set(Tt)}(it,et,yt,lt)}})(y,a,l),y.clear({color:i.Color.transparent});for(var A=0;A<c.length;A++){var R=c[A];if(!u.hasRenderableParent(R)){var G=u.getTile(R),Z=G.getBucket(l);if(Z){var V=Z.programConfigurations.get(l.id);a.useProgram("heatmap",V).draw(y,_.TRIANGLES,H.disabled,x,S,gt.disabled,As(R.posMatrix,G,a.transform.zoom,l.paint.get("heatmap-intensity")),l.id,Z.layoutVertexBuffer,Z.indexBuffer,Z.segments,l.paint,a.transform.zoom,V)}}}y.viewport.set([0,0,a.width,a.height])}else a.renderPass==="translucent"&&(a.context.setColorMode(a.colorModeForRenderPass()),function(it,et){var ut=it.context,tt=ut.gl,lt=et.heatmapFbo;if(lt){ut.activeTexture.set(tt.TEXTURE0),tt.bindTexture(tt.TEXTURE_2D,lt.colorAttachment.get()),ut.activeTexture.set(tt.TEXTURE1);var yt=et.colorRampTexture;yt||(yt=et.colorRampTexture=new i.Texture(ut,et.colorRamp,tt.RGBA)),yt.bind(tt.LINEAR,tt.CLAMP_TO_EDGE),it.useProgram("heatmapTexture").draw(ut,tt.TRIANGLES,H.disabled,rt.disabled,it.colorModeForRenderPass(),gt.disabled,function(_t,It,Tt,Ct){var Lt=i.create();i.ortho(Lt,0,_t.width,_t.height,0,0,1);var qt=_t.context.gl;return{u_matrix:Lt,u_world:[qt.drawingBufferWidth,qt.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:It.paint.get("heatmap-opacity")}}(it,et),et.id,it.viewportBuffer,it.quadTriangleIndexBuffer,it.viewportSegments,et.paint,it.transform.zoom)}}(a,l))},line:function(a,u,l,c){if(a.renderPass==="translucent"){var y=l.paint.get("line-opacity"),_=l.paint.get("line-width");if(y.constantOr(1)!==0&&_.constantOr(1)!==0)for(var x=a.depthModeForSublayer(0,H.ReadOnly),S=a.colorModeForRenderPass(),A=l.paint.get("line-dasharray"),R=l.paint.get("line-pattern"),G=R.constantOr(1),Z=l.paint.get("line-gradient"),V=l.getCrossfadeParameters(),it=G?"linePattern":A?"lineSDF":Z?"lineGradient":"line",et=a.context,ut=et.gl,tt=!0,lt=0,yt=c;lt<yt.length;lt+=1){var _t=yt[lt],It=u.getTile(_t);if(!G||It.patternsLoaded()){var Tt=It.getBucket(l);if(Tt){var Ct=Tt.programConfigurations.get(l.id),Lt=a.context.program.get(),qt=a.useProgram(it,Ct),Ut=tt||qt.program!==Lt,ie=R.constantOr(null);if(ie&&It.imageAtlas){var _e=It.imageAtlas,Se=_e.patternPositions[ie.to.toString()],xe=_e.patternPositions[ie.from.toString()];Se&&xe&&Ct.setConstantPatternPositions(Se,xe)}var nr=G?Lr(a,It,l,V):A?su(a,It,l,A,V):Z?Hh(a,It,l,Tt.lineClipsArray.length):au(a,It,l);if(G)et.activeTexture.set(ut.TEXTURE0),It.imageAtlasTexture.bind(ut.LINEAR,ut.CLAMP_TO_EDGE),Ct.updatePaintBuffers(V);else if(A&&(Ut||a.lineAtlas.dirty))et.activeTexture.set(ut.TEXTURE0),a.lineAtlas.bind(et);else if(Z){var ue=Tt.gradients[l.id],De=ue.texture;if(l.gradientVersion!==ue.version){var je=256;if(l.stepInterpolant){var Oe=u.getSource().maxzoom,ze=_t.canonical.z===Oe?Math.ceil(1<<a.transform.maxZoom-_t.canonical.z):1;je=i.clamp(i.nextPowerOfTwo(Tt.maxLineLength/i.EXTENT*1024*ze),256,et.maxTextureSize)}ue.gradient=i.renderColorRamp({expression:l.gradientExpression(),evaluationKey:"lineProgress",resolution:je,image:ue.gradient||void 0,clips:Tt.lineClipsArray}),ue.texture?ue.texture.update(ue.gradient):ue.texture=new i.Texture(et,ue.gradient,ut.RGBA),ue.version=l.gradientVersion,De=ue.texture}et.activeTexture.set(ut.TEXTURE0),De.bind(l.stepInterpolant?ut.NEAREST:ut.LINEAR,ut.CLAMP_TO_EDGE)}qt.draw(et,ut.TRIANGLES,x,a.stencilModeForClipping(_t),S,gt.disabled,nr,l.id,Tt.layoutVertexBuffer,Tt.indexBuffer,Tt.segments,l.paint,a.transform.zoom,Ct,Tt.layoutVertexBuffer2),tt=!1}}}}},fill:function(a,u,l,c){var y=l.paint.get("fill-color"),_=l.paint.get("fill-opacity");if(_.constantOr(1)!==0){var x=a.colorModeForRenderPass(),S=l.paint.get("fill-pattern"),A=a.opaquePassEnabledForLayer()&&!S.constantOr(1)&&y.constantOr(i.Color.transparent).a===1&&_.constantOr(0)===1?"opaque":"translucent";if(a.renderPass===A){var R=a.depthModeForSublayer(1,a.renderPass==="opaque"?H.ReadWrite:H.ReadOnly);fl(a,u,l,c,R,x,!1)}if(a.renderPass==="translucent"&&l.paint.get("fill-antialias")){var G=a.depthModeForSublayer(l.getPaintProperty("fill-outline-color")?2:0,H.ReadOnly);fl(a,u,l,c,G,x,!0)}}},"fill-extrusion":function(a,u,l,c){var y=l.paint.get("fill-extrusion-opacity");if(y!==0&&a.renderPass==="translucent"){var _=new H(a.context.gl.LEQUAL,H.ReadWrite,a.depthRangeFor3D);if(y!==1||l.paint.get("fill-extrusion-pattern").constantOr(1))dl(a,u,l,c,_,rt.disabled,pt.disabled),dl(a,u,l,c,_,a.stencilModeFor3D(),a.colorModeForRenderPass());else{var x=a.colorModeForRenderPass();dl(a,u,l,c,_,rt.disabled,x)}}},hillshade:function(a,u,l,c){if(a.renderPass==="offscreen"||a.renderPass==="translucent"){for(var y=a.context,_=a.depthModeForSublayer(0,H.ReadOnly),x=a.colorModeForRenderPass(),S=a.renderPass==="translucent"?a.stencilConfigForOverlap(c):[{},c],A=S[0],R=0,G=S[1];R<G.length;R+=1){var Z=G[R],V=u.getTile(Z);V.needsHillshadePrepare&&a.renderPass==="offscreen"?hu(a,V,l,_,rt.disabled,x):a.renderPass==="translucent"&&hm(a,V,l,_,A[Z.overscaledZ],x)}y.viewport.set([0,0,a.width,a.height])}},raster:function(a,u,l,c){if(a.renderPass==="translucent"&&l.paint.get("raster-opacity")!==0&&c.length)for(var y=a.context,_=y.gl,x=u.getSource(),S=a.useProgram("raster"),A=a.colorModeForRenderPass(),R=x instanceof Ne?[{},c]:a.stencilConfigForOverlap(c),G=R[0],Z=R[1],V=Z[Z.length-1].overscaledZ,it=!a.options.moving,et=0,ut=Z;et<ut.length;et+=1){var tt=ut[et],lt=a.depthModeForSublayer(tt.overscaledZ-V,l.paint.get("raster-opacity")===1?H.ReadWrite:H.ReadOnly,_.LESS),yt=u.getTile(tt),_t=a.transform.calculatePosMatrix(tt.toUnwrapped(),it);yt.registerFadeDuration(l.paint.get("raster-fade-duration"));var It=u.findLoadedParent(tt,0),Tt=cm(yt,It,u,l,a.transform),Ct=void 0,Lt=void 0,qt=l.paint.get("raster-resampling")==="nearest"?_.NEAREST:_.LINEAR;y.activeTexture.set(_.TEXTURE0),yt.texture.bind(qt,_.CLAMP_TO_EDGE,_.LINEAR_MIPMAP_NEAREST),y.activeTexture.set(_.TEXTURE1),It?(It.texture.bind(qt,_.CLAMP_TO_EDGE,_.LINEAR_MIPMAP_NEAREST),Ct=Math.pow(2,It.tileID.overscaledZ-yt.tileID.overscaledZ),Lt=[yt.tileID.canonical.x*Ct%1,yt.tileID.canonical.y*Ct%1]):yt.texture.bind(qt,_.CLAMP_TO_EDGE,_.LINEAR_MIPMAP_NEAREST);var Ut=lm(_t,Lt||[0,0],Ct||1,Tt,l);x instanceof Ne?S.draw(y,_.TRIANGLES,lt,rt.disabled,A,gt.disabled,Ut,l.id,x.boundsBuffer,a.quadTriangleIndexBuffer,x.boundsSegments):S.draw(y,_.TRIANGLES,lt,G[tt.overscaledZ],A,gt.disabled,Ut,l.id,a.rasterBoundsBuffer,a.quadTriangleIndexBuffer,a.rasterBoundsSegments)}},background:function(a,u,l){var c=l.paint.get("background-color"),y=l.paint.get("background-opacity");if(y!==0){var _=a.context,x=_.gl,S=a.transform,A=S.tileSize,R=l.paint.get("background-pattern");if(!a.isPatternMissing(R)){var G=!R&&c.a===1&&y===1&&a.opaquePassEnabledForLayer()?"opaque":"translucent";if(a.renderPass===G){var Z=rt.disabled,V=a.depthModeForSublayer(0,G==="opaque"?H.ReadWrite:H.ReadOnly),it=a.colorModeForRenderPass(),et=a.useProgram(R?"backgroundPattern":"background"),ut=S.coveringTiles({tileSize:A});R&&(_.activeTexture.set(x.TEXTURE0),a.imageManager.bind(a.context));for(var tt=l.getCrossfadeParameters(),lt=0,yt=ut;lt<yt.length;lt+=1){var _t=yt[lt],It=a.transform.calculatePosMatrix(_t.toUnwrapped()),Tt=R?cl(It,y,a,R,{tileID:_t,tileSize:A},tt):uu(It,y,c);et.draw(_,x.TRIANGLES,V,Z,it,gt.disabled,Tt,l.id,a.tileExtentBuffer,a.quadTriangleIndexBuffer,a.tileExtentSegments)}}}}},debug:function(a,u,l){for(var c=0;c<l.length;c++)Zp(a,u,l[c])},custom:function(a,u,l){var c=a.context,y=l.implementation;if(a.renderPass==="offscreen"){var _=y.prerender;_&&(a.setCustomLayerDefaults(),c.setColorMode(a.colorModeForRenderPass()),_.call(y,c.gl,a.transform.customLayerMatrix()),c.setDirty(),a.setBaseState())}else if(a.renderPass==="translucent"){a.setCustomLayerDefaults(),c.setColorMode(a.colorModeForRenderPass()),c.setStencilMode(rt.disabled);var x=y.renderingMode==="3d"?new H(a.context.gl.LEQUAL,H.ReadWrite,a.depthRangeFor3D):a.depthModeForSublayer(0,H.ReadOnly);c.setDepthMode(x),y.render(c.gl,a.transform.customLayerMatrix()),c.setDirty(),a.setBaseState(),c.bindFramebuffer.set(null)}}},br=function(a,u){this.context=new ht(a),this.transform=u,this._tileTextures={},this.setup(),this.numSublayers=X.maxUnderzooming+X.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Oa,this.gpuTimers={}};br.prototype.resize=function(a,u){if(this.width=a*i.browser.devicePixelRatio,this.height=u*i.browser.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(var l=0,c=this.style._order;l<c.length;l+=1)this.style._layers[c[l]].resize()},br.prototype.setup=function(){var a=this.context,u=new i.StructArrayLayout2i4;u.emplaceBack(0,0),u.emplaceBack(i.EXTENT,0),u.emplaceBack(0,i.EXTENT),u.emplaceBack(i.EXTENT,i.EXTENT),this.tileExtentBuffer=a.createVertexBuffer(u,po.members),this.tileExtentSegments=i.SegmentVector.simpleSegment(0,0,4,2);var l=new i.StructArrayLayout2i4;l.emplaceBack(0,0),l.emplaceBack(i.EXTENT,0),l.emplaceBack(0,i.EXTENT),l.emplaceBack(i.EXTENT,i.EXTENT),this.debugBuffer=a.createVertexBuffer(l,po.members),this.debugSegments=i.SegmentVector.simpleSegment(0,0,4,5);var c=new i.StructArrayLayout4i8;c.emplaceBack(0,0,0,0),c.emplaceBack(i.EXTENT,0,i.EXTENT,0),c.emplaceBack(0,i.EXTENT,0,i.EXTENT),c.emplaceBack(i.EXTENT,i.EXTENT,i.EXTENT,i.EXTENT),this.rasterBoundsBuffer=a.createVertexBuffer(c,me.members),this.rasterBoundsSegments=i.SegmentVector.simpleSegment(0,0,4,2);var y=new i.StructArrayLayout2i4;y.emplaceBack(0,0),y.emplaceBack(1,0),y.emplaceBack(0,1),y.emplaceBack(1,1),this.viewportBuffer=a.createVertexBuffer(y,po.members),this.viewportSegments=i.SegmentVector.simpleSegment(0,0,4,2);var _=new i.StructArrayLayout1ui2;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=a.createIndexBuffer(_);var x=new i.StructArrayLayout3ui6;x.emplaceBack(0,1,2),x.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=a.createIndexBuffer(x),this.emptyTexture=new i.Texture(a,{width:1,height:1,data:new Uint8Array([0,0,0,0])},a.gl.RGBA);var S=this.context.gl;this.stencilClearMode=new rt({func:S.ALWAYS,mask:0},0,255,S.ZERO,S.ZERO,S.ZERO)},br.prototype.clearStencil=function(){var a=this.context,u=a.gl;this.nextStencilID=1,this.currentStencilSource=void 0;var l=i.create();i.ortho(l,0,this.width,this.height,0,0,1),i.scale(l,l,[u.drawingBufferWidth,u.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(a,u.TRIANGLES,H.disabled,this.stencilClearMode,pt.disabled,gt.disabled,Va(l),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)},br.prototype._renderTileClippingMasks=function(a,u){if(this.currentStencilSource!==a.source&&a.isTileClipped()&&u&&u.length){this.currentStencilSource=a.source;var l=this.context,c=l.gl;this.nextStencilID+u.length>256&&this.clearStencil(),l.setColorMode(pt.disabled),l.setDepthMode(H.disabled);var y=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var _=0,x=u;_<x.length;_+=1){var S=x[_],A=this._tileClippingMaskIDs[S.key]=this.nextStencilID++;y.draw(l,c.TRIANGLES,H.disabled,new rt({func:c.ALWAYS,mask:0},A,255,c.KEEP,c.KEEP,c.REPLACE),pt.disabled,gt.disabled,Va(S.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}},br.prototype.stencilModeFor3D=function(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();var a=this.nextStencilID++,u=this.context.gl;return new rt({func:u.NOTEQUAL,mask:255},a,255,u.KEEP,u.KEEP,u.REPLACE)},br.prototype.stencilModeForClipping=function(a){var u=this.context.gl;return new rt({func:u.EQUAL,mask:255},this._tileClippingMaskIDs[a.key],0,u.KEEP,u.KEEP,u.REPLACE)},br.prototype.stencilConfigForOverlap=function(a){var u,l=this.context.gl,c=a.sort(function(A,R){return R.overscaledZ-A.overscaledZ}),y=c[c.length-1].overscaledZ,_=c[0].overscaledZ-y+1;if(_>1){this.currentStencilSource=void 0,this.nextStencilID+_>256&&this.clearStencil();for(var x={},S=0;S<_;S++)x[S+y]=new rt({func:l.GEQUAL,mask:255},S+this.nextStencilID,255,l.KEEP,l.KEEP,l.REPLACE);return this.nextStencilID+=_,[x,c]}return[(u={},u[y]=rt.disabled,u),c]},br.prototype.colorModeForRenderPass=function(){var a=this.context.gl;return this._showOverdrawInspector?new pt([a.CONSTANT_COLOR,a.ONE],new i.Color(1/8,1/8,1/8,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?pt.unblended:pt.alphaBlended},br.prototype.depthModeForSublayer=function(a,u,l){if(!this.opaquePassEnabledForLayer())return H.disabled;var c=1-((1+this.currentLayer)*this.numSublayers+a)*this.depthEpsilon;return new H(l||this.context.gl.LEQUAL,u,[c,c])},br.prototype.opaquePassEnabledForLayer=function(){return this.currentLayer<this.opaquePassCutoff},br.prototype.render=function(a,u){var l=this;this.style=a,this.options=u,this.lineAtlas=a.lineAtlas,this.imageManager=a.imageManager,this.glyphManager=a.glyphManager,this.symbolFadeChange=a.placement.symbolFadeChange(i.browser.now()),this.imageManager.beginFrame();var c=this.style._order,y=this.style.sourceCaches;for(var _ in y){var x=y[_];x.used&&x.prepare(this.context)}var S,A,R={},G={},Z={};for(var V in y){var it=y[V];R[V]=it.getVisibleCoordinates(),G[V]=R[V].slice().reverse(),Z[V]=it.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(var et=0;et<c.length;et++)if(this.style._layers[c[et]].is3D()){this.opaquePassCutoff=et;break}this.renderPass="offscreen";for(var ut=0,tt=c;ut<tt.length;ut+=1){var lt=this.style._layers[tt[ut]];if(lt.hasOffscreenPass()&&!lt.isHidden(this.transform.zoom)){var yt=G[lt.source];(lt.type==="custom"||yt.length)&&this.renderLayer(this,y[lt.source],lt,yt)}}for(this.context.bindFramebuffer.set(null),this.context.clear({color:u.showOverdrawInspector?i.Color.black:i.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=u.showOverdrawInspector,this.depthRangeFor3D=[0,1-(a._order.length+2)*this.numSublayers*this.depthEpsilon],this.renderPass="opaque",this.currentLayer=c.length-1;this.currentLayer>=0;this.currentLayer--){var _t=this.style._layers[c[this.currentLayer]],It=y[_t.source],Tt=R[_t.source];this._renderTileClippingMasks(_t,Tt),this.renderLayer(this,It,_t,Tt)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<c.length;this.currentLayer++){var Ct=this.style._layers[c[this.currentLayer]],Lt=y[Ct.source],qt=(Ct.type==="symbol"?Z:G)[Ct.source];this._renderTileClippingMasks(Ct,R[Ct.source]),this.renderLayer(this,Lt,Ct,qt)}this.options.showTileBoundaries&&(i.values(this.style._layers).forEach(function(Ut){Ut.source&&!Ut.isHidden(l.transform.zoom)&&(Ut.source!==(A&&A.id)&&(A=l.style.sourceCaches[Ut.source]),(!S||S.getSource().maxzoom<A.getSource().maxzoom)&&(S=A))}),S&&Qh.debug(this,S,S.getVisibleCoordinates())),this.options.showPadding&&function(Ut){var ie=Ut.transform.padding;fu(Ut,Ut.transform.height-(ie.top||0),3,cu),fu(Ut,ie.bottom||0,3,Yh),Jh(Ut,ie.left||0,3,Kp),Jh(Ut,Ut.transform.width-(ie.right||0),3,Hp);var _e=Ut.transform.centerPoint;(function(Se,xe,nr,ue){ml(Se,xe-1,nr-10,2,20,ue),ml(Se,xe-10,nr-1,20,2,ue)})(Ut,_e.x,Ut.transform.height-_e.y,pu)}(this),this.context.setDefault()},br.prototype.renderLayer=function(a,u,l,c){l.isHidden(this.transform.zoom)||(l.type==="background"||l.type==="custom"||c.length)&&(this.id=l.id,this.gpuTimingStart(l),Qh[l.type](a,u,l,c,this.style.placement.variableOffsets),this.gpuTimingEnd())},br.prototype.gpuTimingStart=function(a){if(this.options.gpuTiming){var u=this.context.extTimerQuery,l=this.gpuTimers[a.id];l||(l=this.gpuTimers[a.id]={calls:0,cpuTime:0,query:u.createQueryEXT()}),l.calls++,u.beginQueryEXT(u.TIME_ELAPSED_EXT,l.query)}},br.prototype.gpuTimingEnd=function(){if(this.options.gpuTiming){var a=this.context.extTimerQuery;a.endQueryEXT(a.TIME_ELAPSED_EXT)}},br.prototype.collectGpuTimers=function(){var a=this.gpuTimers;return this.gpuTimers={},a},br.prototype.queryGpuTimers=function(a){var u={};for(var l in a){var c=a[l],y=this.context.extTimerQuery,_=y.getQueryObjectEXT(c.query,y.QUERY_RESULT_EXT)/1e6;y.deleteQueryEXT(c.query),u[l]=_}return u},br.prototype.translatePosMatrix=function(a,u,l,c,y){if(!l[0]&&!l[1])return a;var _=y?c==="map"?this.transform.angle:0:c==="viewport"?-this.transform.angle:0;if(_){var x=Math.sin(_),S=Math.cos(_);l=[l[0]*S-l[1]*x,l[0]*x+l[1]*S]}var A=[y?l[0]:bn(u,l[0],this.transform.zoom),y?l[1]:bn(u,l[1],this.transform.zoom),0],R=new Float32Array(16);return i.translate(R,a,A),R},br.prototype.saveTileTexture=function(a){var u=this._tileTextures[a.size[0]];u?u.push(a):this._tileTextures[a.size[0]]=[a]},br.prototype.getTileTexture=function(a){var u=this._tileTextures[a];return u&&u.length>0?u.pop():null},br.prototype.isPatternMissing=function(a){if(!a)return!1;if(!a.from||!a.to)return!0;var u=this.imageManager.getPattern(a.from.toString()),l=this.imageManager.getPattern(a.to.toString());return!u||!l},br.prototype.useProgram=function(a,u){this.cache=this.cache||{};var l=""+a+(u?u.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[l]||(this.cache[l]=new Np(this.context,a,Is[a],u,ks[a],this._showOverdrawInspector)),this.cache[l]},br.prototype.setCustomLayerDefaults=function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()},br.prototype.setBaseState=function(){var a=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(a.FUNC_ADD)},br.prototype.initDebugOverlayCanvas=function(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=i.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new i.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))},br.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()};var du=function(a,u){this.points=a,this.planes=u};du.fromInvProjectionMatrix=function(a,u,l){var c=Math.pow(2,l),y=[[-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(function(x){return i.transformMat4([],x,a)}).map(function(x){return i.scale$1([],x,1/x[3]/u*c)}),_=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(function(x){var S=i.sub([],y[x[0]],y[x[1]]),A=i.sub([],y[x[2]],y[x[1]]),R=i.normalize([],i.cross([],S,A)),G=-i.dot(R,y[x[1]]);return R.concat(G)});return new du(y,_)};var qa=function(a,u){this.min=a,this.max=u,this.center=i.scale$2([],i.add([],this.min,this.max),.5)};qa.prototype.quadrant=function(a){for(var u=[a%2==0,a<2],l=i.clone$2(this.min),c=i.clone$2(this.max),y=0;y<u.length;y++)l[y]=u[y]?this.min[y]:this.center[y],c[y]=u[y]?this.center[y]:this.max[y];return c[2]=this.max[2],new qa(l,c)},qa.prototype.distanceX=function(a){return Math.max(Math.min(this.max[0],a[0]),this.min[0])-a[0]},qa.prototype.distanceY=function(a){return Math.max(Math.min(this.max[1],a[1]),this.min[1])-a[1]},qa.prototype.intersects=function(a){for(var u=[[this.min[0],this.min[1],0,1],[this.max[0],this.min[1],0,1],[this.max[0],this.max[1],0,1],[this.min[0],this.max[1],0,1]],l=!0,c=0;c<a.planes.length;c++){for(var y=a.planes[c],_=0,x=0;x<u.length;x++)_+=i.dot$1(y,u[x])>=0;if(_===0)return 0;_!==u.length&&(l=!1)}if(l)return 2;for(var S=0;S<3;S++){for(var A=Number.MAX_VALUE,R=-Number.MAX_VALUE,G=0;G<a.points.length;G++){var Z=a.points[G][S]-this.min[S];A=Math.min(A,Z),R=Math.max(R,Z)}if(R<0||A>this.max[S]-this.min[S])return 0}return 1};var la=function(a,u,l,c){if(a===void 0&&(a=0),u===void 0&&(u=0),l===void 0&&(l=0),c===void 0&&(c=0),isNaN(a)||a<0||isNaN(u)||u<0||isNaN(l)||l<0||isNaN(c)||c<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=a,this.bottom=u,this.left=l,this.right=c};la.prototype.interpolate=function(a,u,l){return u.top!=null&&a.top!=null&&(this.top=i.number(a.top,u.top,l)),u.bottom!=null&&a.bottom!=null&&(this.bottom=i.number(a.bottom,u.bottom,l)),u.left!=null&&a.left!=null&&(this.left=i.number(a.left,u.left,l)),u.right!=null&&a.right!=null&&(this.right=i.number(a.right,u.right,l)),this},la.prototype.getCenter=function(a,u){var l=i.clamp((this.left+a-this.right)/2,0,a),c=i.clamp((this.top+u-this.bottom)/2,0,u);return new i.Point(l,c)},la.prototype.equals=function(a){return this.top===a.top&&this.bottom===a.bottom&&this.left===a.left&&this.right===a.right},la.prototype.clone=function(){return new la(this.top,this.bottom,this.left,this.right)},la.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var gr=function(a,u,l,c,y){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=y===void 0||y,this._minZoom=a||0,this._maxZoom=u||22,this._minPitch=l??0,this._maxPitch=c??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new i.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new la,this._posMatrixCache={},this._alignedPosMatrixCache={}},ir={minZoom:{configurable:!0},maxZoom:{configurable:!0},minPitch:{configurable:!0},maxPitch:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerOffset:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},padding:{configurable:!0},centerPoint:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};gr.prototype.clone=function(){var a=new gr(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return a.tileSize=this.tileSize,a.latRange=this.latRange,a.width=this.width,a.height=this.height,a._center=this._center,a.zoom=this.zoom,a.angle=this.angle,a._fov=this._fov,a._pitch=this._pitch,a._unmodified=this._unmodified,a._edgeInsets=this._edgeInsets.clone(),a._calcMatrices(),a},ir.minZoom.get=function(){return this._minZoom},ir.minZoom.set=function(a){this._minZoom!==a&&(this._minZoom=a,this.zoom=Math.max(this.zoom,a))},ir.maxZoom.get=function(){return this._maxZoom},ir.maxZoom.set=function(a){this._maxZoom!==a&&(this._maxZoom=a,this.zoom=Math.min(this.zoom,a))},ir.minPitch.get=function(){return this._minPitch},ir.minPitch.set=function(a){this._minPitch!==a&&(this._minPitch=a,this.pitch=Math.max(this.pitch,a))},ir.maxPitch.get=function(){return this._maxPitch},ir.maxPitch.set=function(a){this._maxPitch!==a&&(this._maxPitch=a,this.pitch=Math.min(this.pitch,a))},ir.renderWorldCopies.get=function(){return this._renderWorldCopies},ir.renderWorldCopies.set=function(a){a===void 0?a=!0:a===null&&(a=!1),this._renderWorldCopies=a},ir.worldSize.get=function(){return this.tileSize*this.scale},ir.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},ir.size.get=function(){return new i.Point(this.width,this.height)},ir.bearing.get=function(){return-this.angle/Math.PI*180},ir.bearing.set=function(a){var u=-i.wrap(a,-180,180)*Math.PI/180;this.angle!==u&&(this._unmodified=!1,this.angle=u,this._calcMatrices(),this.rotationMatrix=i.create$2(),i.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},ir.pitch.get=function(){return this._pitch/Math.PI*180},ir.pitch.set=function(a){var u=i.clamp(a,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==u&&(this._unmodified=!1,this._pitch=u,this._calcMatrices())},ir.fov.get=function(){return this._fov/Math.PI*180},ir.fov.set=function(a){a=Math.max(.01,Math.min(60,a)),this._fov!==a&&(this._unmodified=!1,this._fov=a/180*Math.PI,this._calcMatrices())},ir.zoom.get=function(){return this._zoom},ir.zoom.set=function(a){var u=Math.min(Math.max(a,this.minZoom),this.maxZoom);this._zoom!==u&&(this._unmodified=!1,this._zoom=u,this.scale=this.zoomScale(u),this.tileZoom=Math.floor(u),this.zoomFraction=u-this.tileZoom,this._constrain(),this._calcMatrices())},ir.center.get=function(){return this._center},ir.center.set=function(a){a.lat===this._center.lat&&a.lng===this._center.lng||(this._unmodified=!1,this._center=a,this._constrain(),this._calcMatrices())},ir.padding.get=function(){return this._edgeInsets.toJSON()},ir.padding.set=function(a){this._edgeInsets.equals(a)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,a,1),this._calcMatrices())},ir.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},gr.prototype.isPaddingEqual=function(a){return this._edgeInsets.equals(a)},gr.prototype.interpolatePadding=function(a,u,l){this._unmodified=!1,this._edgeInsets.interpolate(a,u,l),this._constrain(),this._calcMatrices()},gr.prototype.coveringZoomLevel=function(a){var u=(a.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/a.tileSize));return Math.max(0,u)},gr.prototype.getVisibleUnwrappedCoordinates=function(a){var u=[new i.UnwrappedTileID(0,a)];if(this._renderWorldCopies)for(var l=this.pointCoordinate(new i.Point(0,0)),c=this.pointCoordinate(new i.Point(this.width,0)),y=this.pointCoordinate(new i.Point(this.width,this.height)),_=this.pointCoordinate(new i.Point(0,this.height)),x=Math.floor(Math.min(l.x,c.x,y.x,_.x)),S=Math.floor(Math.max(l.x,c.x,y.x,_.x)),A=x-1;A<=S+1;A++)A!==0&&u.push(new i.UnwrappedTileID(A,a));return u},gr.prototype.coveringTiles=function(a){var u=this.coveringZoomLevel(a),l=u;if(a.minzoom!==void 0&&u<a.minzoom)return[];a.maxzoom!==void 0&&u>a.maxzoom&&(u=a.maxzoom);var c=i.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,u),_=[y*c.x,y*c.y,0],x=du.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,u),S=a.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(S=u);var A=function(Ut){return{aabb:new qa([Ut*y,0,0],[(Ut+1)*y,y,0]),zoom:0,x:0,y:0,wrap:Ut,fullyVisible:!1}},R=[],G=[],Z=u,V=a.reparseOverscaled?l:u;if(this._renderWorldCopies)for(var it=1;it<=3;it++)R.push(A(-it)),R.push(A(it));for(R.push(A(0));R.length>0;){var et=R.pop(),ut=et.x,tt=et.y,lt=et.fullyVisible;if(!lt){var yt=et.aabb.intersects(x);if(yt===0)continue;lt=yt===2}var _t=et.aabb.distanceX(_),It=et.aabb.distanceY(_),Tt=Math.max(Math.abs(_t),Math.abs(It));if(et.zoom===Z||Tt>3+(1<<Z-et.zoom)-2&&et.zoom>=S)G.push({tileID:new i.OverscaledTileID(et.zoom===Z?V:et.zoom,et.wrap,et.zoom,ut,tt),distanceSq:i.sqrLen([_[0]-.5-ut,_[1]-.5-tt])});else for(var Ct=0;Ct<4;Ct++){var Lt=(ut<<1)+Ct%2,qt=(tt<<1)+(Ct>>1);R.push({aabb:et.aabb.quadrant(Ct),zoom:et.zoom+1,x:Lt,y:qt,wrap:et.wrap,fullyVisible:lt})}}return G.sort(function(Ut,ie){return Ut.distanceSq-ie.distanceSq}).map(function(Ut){return Ut.tileID})},gr.prototype.resize=function(a,u){this.width=a,this.height=u,this.pixelsToGLUnits=[2/a,-2/u],this._constrain(),this._calcMatrices()},ir.unmodified.get=function(){return this._unmodified},gr.prototype.zoomScale=function(a){return Math.pow(2,a)},gr.prototype.scaleZoom=function(a){return Math.log(a)/Math.LN2},gr.prototype.project=function(a){var u=i.clamp(a.lat,-this.maxValidLatitude,this.maxValidLatitude);return new i.Point(i.mercatorXfromLng(a.lng)*this.worldSize,i.mercatorYfromLat(u)*this.worldSize)},gr.prototype.unproject=function(a){return new i.MercatorCoordinate(a.x/this.worldSize,a.y/this.worldSize).toLngLat()},ir.point.get=function(){return this.project(this.center)},gr.prototype.setLocationAtPoint=function(a,u){var l=this.pointCoordinate(u),c=this.pointCoordinate(this.centerPoint),y=this.locationCoordinate(a),_=new i.MercatorCoordinate(y.x-(l.x-c.x),y.y-(l.y-c.y));this.center=this.coordinateLocation(_),this._renderWorldCopies&&(this.center=this.center.wrap())},gr.prototype.locationPoint=function(a){return this.coordinatePoint(this.locationCoordinate(a))},gr.prototype.pointLocation=function(a){return this.coordinateLocation(this.pointCoordinate(a))},gr.prototype.locationCoordinate=function(a){return i.MercatorCoordinate.fromLngLat(a)},gr.prototype.coordinateLocation=function(a){return a.toLngLat()},gr.prototype.pointCoordinate=function(a){var u=[a.x,a.y,0,1],l=[a.x,a.y,1,1];i.transformMat4(u,u,this.pixelMatrixInverse),i.transformMat4(l,l,this.pixelMatrixInverse);var c=u[3],y=l[3],_=u[1]/c,x=l[1]/y,S=u[2]/c,A=l[2]/y,R=S===A?0:(0-S)/(A-S);return new i.MercatorCoordinate(i.number(u[0]/c,l[0]/y,R)/this.worldSize,i.number(_,x,R)/this.worldSize)},gr.prototype.coordinatePoint=function(a){var u=[a.x*this.worldSize,a.y*this.worldSize,0,1];return i.transformMat4(u,u,this.pixelMatrix),new i.Point(u[0]/u[3],u[1]/u[3])},gr.prototype.getBounds=function(){return new i.LngLatBounds().extend(this.pointLocation(new i.Point(0,0))).extend(this.pointLocation(new i.Point(this.width,0))).extend(this.pointLocation(new i.Point(this.width,this.height))).extend(this.pointLocation(new i.Point(0,this.height)))},gr.prototype.getMaxBounds=function(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new i.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null},gr.prototype.setMaxBounds=function(a){a?(this.lngRange=[a.getWest(),a.getEast()],this.latRange=[a.getSouth(),a.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])},gr.prototype.calculatePosMatrix=function(a,u){u===void 0&&(u=!1);var l=a.key,c=u?this._alignedPosMatrixCache:this._posMatrixCache;if(c[l])return c[l];var y=a.canonical,_=this.worldSize/this.zoomScale(y.z),x=y.x+Math.pow(2,y.z)*a.wrap,S=i.identity(new Float64Array(16));return i.translate(S,S,[x*_,y.y*_,0]),i.scale(S,S,[_/i.EXTENT,_/i.EXTENT,1]),i.multiply(S,u?this.alignedProjMatrix:this.projMatrix,S),c[l]=new Float32Array(S),c[l]},gr.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},gr.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var a,u,l,c,y=-90,_=90,x=-180,S=180,A=this.size,R=this._unmodified;if(this.latRange){var G=this.latRange;y=i.mercatorYfromLat(G[1])*this.worldSize,a=(_=i.mercatorYfromLat(G[0])*this.worldSize)-y<A.y?A.y/(_-y):0}if(this.lngRange){var Z=this.lngRange;x=i.mercatorXfromLng(Z[0])*this.worldSize,u=(S=i.mercatorXfromLng(Z[1])*this.worldSize)-x<A.x?A.x/(S-x):0}var V=this.point,it=Math.max(u||0,a||0);if(it)return this.center=this.unproject(new i.Point(u?(S+x)/2:V.x,a?(_+y)/2:V.y)),this.zoom+=this.scaleZoom(it),this._unmodified=R,void(this._constraining=!1);if(this.latRange){var et=V.y,ut=A.y/2;et-ut<y&&(c=y+ut),et+ut>_&&(c=_-ut)}if(this.lngRange){var tt=V.x,lt=A.x/2;tt-lt<x&&(l=x+lt),tt+lt>S&&(l=S-lt)}l===void 0&&c===void 0||(this.center=this.unproject(new i.Point(l!==void 0?l:V.x,c!==void 0?c:V.y))),this._unmodified=R,this._constraining=!1}},gr.prototype._calcMatrices=function(){if(this.height){var a=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var u=Math.PI/2+this._pitch,l=this._fov*(.5+a.y/this.height),c=Math.sin(l)*this.cameraToCenterDistance/Math.sin(i.clamp(Math.PI-u-l,.01,Math.PI-.01)),y=this.point,_=y.x,x=y.y,S=1.01*(Math.cos(Math.PI/2-this._pitch)*c+this.cameraToCenterDistance),A=this.height/50,R=new Float64Array(16);i.perspective(R,this._fov,this.width/this.height,A,S),R[8]=2*-a.x/this.width,R[9]=2*a.y/this.height,i.scale(R,R,[1,-1,1]),i.translate(R,R,[0,0,-this.cameraToCenterDistance]),i.rotateX(R,R,this._pitch),i.rotateZ(R,R,this.angle),i.translate(R,R,[-_,-x,0]),this.mercatorMatrix=i.scale([],R,[this.worldSize,this.worldSize,this.worldSize]),i.scale(R,R,[1,1,i.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=R,this.invProjMatrix=i.invert([],this.projMatrix);var G=this.width%2/2,Z=this.height%2/2,V=Math.cos(this.angle),it=Math.sin(this.angle),et=_-Math.round(_)+V*G+it*Z,ut=x-Math.round(x)+V*Z+it*G,tt=new Float64Array(R);if(i.translate(tt,tt,[et>.5?et-1:et,ut>.5?ut-1:ut,0]),this.alignedProjMatrix=tt,R=i.create(),i.scale(R,R,[this.width/2,-this.height/2,1]),i.translate(R,R,[1,-1,0]),this.labelPlaneMatrix=R,R=i.create(),i.scale(R,R,[1,-1,1]),i.translate(R,R,[-1,-1,0]),i.scale(R,R,[2/this.width,2/this.height,1]),this.glCoordMatrix=R,this.pixelMatrix=i.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),!(R=i.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=R,this._posMatrixCache={},this._alignedPosMatrixCache={}}},gr.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var a=this.pointCoordinate(new i.Point(0,0)),u=[a.x*this.worldSize,a.y*this.worldSize,0,1];return i.transformMat4(u,u,this.pixelMatrix)[3]/this.cameraToCenterDistance},gr.prototype.getCameraPoint=function(){var a=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.Point(0,a))},gr.prototype.getCameraQueryGeometry=function(a){var u=this.getCameraPoint();if(a.length===1)return[a[0],u];for(var l=u.x,c=u.y,y=u.x,_=u.y,x=0,S=a;x<S.length;x+=1){var A=S[x];l=Math.min(l,A.x),c=Math.min(c,A.y),y=Math.max(y,A.x),_=Math.max(_,A.y)}return[new i.Point(l,c),new i.Point(y,c),new i.Point(y,_),new i.Point(l,_),new i.Point(l,c)]},Object.defineProperties(gr.prototype,ir);var Wa=function(a){var u,l,c,y;this._hashName=a&&encodeURIComponent(a),i.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=(u=this._updateHashUnthrottled.bind(this),l=!1,c=null,y=function(){c=null,l&&(u(),c=setTimeout(y,300),l=!1)},function(){return l=!0,c||y(),c})};Wa.prototype.addTo=function(a){return this._map=a,i.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},Wa.prototype.remove=function(){return i.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},Wa.prototype.getHashString=function(a){var u=this._map.getCenter(),l=Math.round(100*this._map.getZoom())/100,c=Math.ceil((l*Math.LN2+Math.log(512/360/.5))/Math.LN10),y=Math.pow(10,c),_=Math.round(u.lng*y)/y,x=Math.round(u.lat*y)/y,S=this._map.getBearing(),A=this._map.getPitch(),R="";if(R+=a?"/"+_+"/"+x+"/"+l:l+"/"+x+"/"+_,(S||A)&&(R+="/"+Math.round(10*S)/10),A&&(R+="/"+Math.round(A)),this._hashName){var G=this._hashName,Z=!1,V=i.window.location.hash.slice(1).split("&").map(function(it){var et=it.split("=")[0];return et===G?(Z=!0,et+"="+R):it}).filter(function(it){return it});return Z||V.push(G+"="+R),"#"+V.join("&")}return"#"+R},Wa.prototype._getCurrentHash=function(){var a,u=this,l=i.window.location.hash.replace("#","");return this._hashName?(l.split("&").map(function(c){return c.split("=")}).forEach(function(c){c[0]===u._hashName&&(a=c)}),(a&&a[1]||"").split("/")):l.split("/")},Wa.prototype._onHashChange=function(){var a=this._getCurrentHash();if(a.length>=3&&!a.some(function(l){return isNaN(l)})){var u=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(a[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+a[2],+a[1]],zoom:+a[0],bearing:u,pitch:+(a[4]||0)}),!0}return!1},Wa.prototype._updateHashUnthrottled=function(){var a=i.window.location.href.replace(/(#.+)?$/,this.getHashString());try{i.window.history.replaceState(i.window.history.state,null,a)}catch{}};var Eo={linearity:.3,easing:i.bezier(0,0,.3,1)},Xp=i.extend({deceleration:2500,maxSpeed:1400},Eo),Rs=i.extend({deceleration:20,maxSpeed:1400},Eo),yl=i.extend({deceleration:1e3,maxSpeed:360},Eo),pm=i.extend({deceleration:1e3,maxSpeed:90},Eo),gl=function(a){this._map=a,this.clear()};function mu(a,u){(!a.duration||a.duration<u.duration)&&(a.duration=u.duration,a.easing=u.easing)}function vl(a,u,l){var c=l.maxSpeed,y=l.linearity,_=l.deceleration,x=i.clamp(a*y/(u/1e3),-c,c),S=Math.abs(x)/(_*y);return{easing:l.easing,duration:1e3*S,amount:x*(S/2)}}gl.prototype.clear=function(){this._inertiaBuffer=[]},gl.prototype.record=function(a){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.browser.now(),settings:a})},gl.prototype._drainInertiaBuffer=function(){for(var a=this._inertiaBuffer,u=i.browser.now();a.length>0&&u-a[0].time>160;)a.shift()},gl.prototype._onMoveEnd=function(a){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var u={zoom:0,bearing:0,pitch:0,pan:new i.Point(0,0),pinchAround:void 0,around:void 0},l=0,c=this._inertiaBuffer;l<c.length;l+=1){var y=c[l].settings;u.zoom+=y.zoomDelta||0,u.bearing+=y.bearingDelta||0,u.pitch+=y.pitchDelta||0,y.panDelta&&u.pan._add(y.panDelta),y.around&&(u.around=y.around),y.pinchAround&&(u.pinchAround=y.pinchAround)}var _=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,x={};if(u.pan.mag()){var S=vl(u.pan.mag(),_,i.extend({},Xp,a||{}));x.offset=u.pan.mult(S.amount/u.pan.mag()),x.center=this._map.transform.center,mu(x,S)}if(u.zoom){var A=vl(u.zoom,_,Rs);x.zoom=this._map.transform.zoom+A.amount,mu(x,A)}if(u.bearing){var R=vl(u.bearing,_,yl);x.bearing=this._map.transform.bearing+i.clamp(R.amount,-179,179),mu(x,R)}if(u.pitch){var G=vl(u.pitch,_,pm);x.pitch=this._map.transform.pitch+G.amount,mu(x,G)}if(x.zoom||x.bearing){var Z=u.pinchAround===void 0?u.around:u.pinchAround;x.around=Z?this._map.unproject(Z):this._map.getCenter()}return this.clear(),i.extend(x,{noMoveStart:!0})}};var tn=function(a){function u(c,y,_,x){x===void 0&&(x={});var S=v.mousePos(y.getCanvasContainer(),_),A=y.unproject(S);a.call(this,c,i.extend({point:S,lngLat:A,originalEvent:_},x)),this._defaultPrevented=!1,this.target=y}a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u;var l={defaultPrevented:{configurable:!0}};return u.prototype.preventDefault=function(){this._defaultPrevented=!0},l.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(u.prototype,l),u}(i.Event),qn=function(a){function u(c,y,_){var x=c==="touchend"?_.changedTouches:_.touches,S=v.touchPos(y.getCanvasContainer(),x),A=S.map(function(Z){return y.unproject(Z)}),R=S.reduce(function(Z,V,it,et){return Z.add(V.div(et.length))},new i.Point(0,0)),G=y.unproject(R);a.call(this,c,{points:S,point:R,lngLats:A,lngLat:G,originalEvent:_}),this._defaultPrevented=!1}a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u;var l={defaultPrevented:{configurable:!0}};return u.prototype.preventDefault=function(){this._defaultPrevented=!0},l.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(u.prototype,l),u}(i.Event),Yp=function(a){function u(c,y,_){a.call(this,c,{originalEvent:_}),this._defaultPrevented=!1}a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u;var l={defaultPrevented:{configurable:!0}};return u.prototype.preventDefault=function(){this._defaultPrevented=!0},l.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(u.prototype,l),u}(i.Event),Ui=function(a,u){this._map=a,this._clickTolerance=u.clickTolerance};Ui.prototype.reset=function(){delete this._mousedownPos},Ui.prototype.wheel=function(a){return this._firePreventable(new Yp(a.type,this._map,a))},Ui.prototype.mousedown=function(a,u){return this._mousedownPos=u,this._firePreventable(new tn(a.type,this._map,a))},Ui.prototype.mouseup=function(a){this._map.fire(new tn(a.type,this._map,a))},Ui.prototype.click=function(a,u){this._mousedownPos&&this._mousedownPos.dist(u)>=this._clickTolerance||this._map.fire(new tn(a.type,this._map,a))},Ui.prototype.dblclick=function(a){return this._firePreventable(new tn(a.type,this._map,a))},Ui.prototype.mouseover=function(a){this._map.fire(new tn(a.type,this._map,a))},Ui.prototype.mouseout=function(a){this._map.fire(new tn(a.type,this._map,a))},Ui.prototype.touchstart=function(a){return this._firePreventable(new qn(a.type,this._map,a))},Ui.prototype.touchmove=function(a){this._map.fire(new qn(a.type,this._map,a))},Ui.prototype.touchend=function(a){this._map.fire(new qn(a.type,this._map,a))},Ui.prototype.touchcancel=function(a){this._map.fire(new qn(a.type,this._map,a))},Ui.prototype._firePreventable=function(a){if(this._map.fire(a),a.defaultPrevented)return{}},Ui.prototype.isEnabled=function(){return!0},Ui.prototype.isActive=function(){return!1},Ui.prototype.enable=function(){},Ui.prototype.disable=function(){};var Ln=function(a){this._map=a};Ln.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},Ln.prototype.mousemove=function(a){this._map.fire(new tn(a.type,this._map,a))},Ln.prototype.mousedown=function(){this._delayContextMenu=!0},Ln.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new tn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)},Ln.prototype.contextmenu=function(a){this._delayContextMenu?this._contextMenuEvent=a:this._map.fire(new tn(a.type,this._map,a)),this._map.listens("contextmenu")&&a.preventDefault()},Ln.prototype.isEnabled=function(){return!0},Ln.prototype.isActive=function(){return!1},Ln.prototype.enable=function(){},Ln.prototype.disable=function(){};var oe=function(a,u){this._map=a,this._el=a.getCanvasContainer(),this._container=a.getContainer(),this._clickTolerance=u.clickTolerance||1};function _l(a,u){for(var l={},c=0;c<a.length;c++)l[a[c].identifier]=u[c];return l}oe.prototype.isEnabled=function(){return!!this._enabled},oe.prototype.isActive=function(){return!!this._active},oe.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},oe.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},oe.prototype.mousedown=function(a,u){this.isEnabled()&&a.shiftKey&&a.button===0&&(v.disableDrag(),this._startPos=this._lastPos=u,this._active=!0)},oe.prototype.mousemoveWindow=function(a,u){if(this._active){var l=u;if(!(this._lastPos.equals(l)||!this._box&&l.dist(this._startPos)<this._clickTolerance)){var c=this._startPos;this._lastPos=l,this._box||(this._box=v.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",a));var y=Math.min(c.x,l.x),_=Math.max(c.x,l.x),x=Math.min(c.y,l.y),S=Math.max(c.y,l.y);v.setTransform(this._box,"translate("+y+"px,"+x+"px)"),this._box.style.width=_-y+"px",this._box.style.height=S-x+"px"}}},oe.prototype.mouseupWindow=function(a,u){var l=this;if(this._active&&a.button===0){var c=this._startPos,y=u;if(this.reset(),v.suppressClick(),c.x!==y.x||c.y!==y.y)return this._map.fire(new i.Event("boxzoomend",{originalEvent:a})),{cameraAnimation:function(_){return _.fitScreenCoordinates(c,y,l._map.getBearing(),{linear:!0})}};this._fireEvent("boxzoomcancel",a)}},oe.prototype.keydown=function(a){this._active&&a.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",a))},oe.prototype.reset=function(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(v.remove(this._box),this._box=null),v.enableDrag(),delete this._startPos,delete this._lastPos},oe.prototype._fireEvent=function(a,u){return this._map.fire(new i.Event(a,{originalEvent:u}))};var zs=function(a){this.reset(),this.numTouches=a.numTouches};zs.prototype.reset=function(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1},zs.prototype.touchstart=function(a,u,l){(this.centroid||l.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=a.timeStamp),l.length===this.numTouches&&(this.centroid=function(c){for(var y=new i.Point(0,0),_=0,x=c;_<x.length;_+=1)y._add(x[_]);return y.div(c.length)}(u),this.touches=_l(l,u)))},zs.prototype.touchmove=function(a,u,l){if(!this.aborted&&this.centroid){var c=_l(l,u);for(var y in this.touches){var _=c[y];(!_||_.dist(this.touches[y])>30)&&(this.aborted=!0)}}},zs.prototype.touchend=function(a,u,l){if((!this.centroid||a.timeStamp-this.startTime>500)&&(this.aborted=!0),l.length===0){var c=!this.aborted&&this.centroid;if(this.reset(),c)return c}};var ua=function(a){this.singleTap=new zs(a),this.numTaps=a.numTaps,this.reset()};ua.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},ua.prototype.touchstart=function(a,u,l){this.singleTap.touchstart(a,u,l)},ua.prototype.touchmove=function(a,u,l){this.singleTap.touchmove(a,u,l)},ua.prototype.touchend=function(a,u,l){var c=this.singleTap.touchend(a,u,l);if(c){var y=a.timeStamp-this.lastTime<500,_=!this.lastTap||this.lastTap.dist(c)<30;if(y&&_||this.reset(),this.count++,this.lastTime=a.timeStamp,this.lastTap=c,this.count===this.numTaps)return this.reset(),c}};var kn=function(){this._zoomIn=new ua({numTouches:1,numTaps:2}),this._zoomOut=new ua({numTouches:2,numTaps:1}),this.reset()};kn.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()},kn.prototype.touchstart=function(a,u,l){this._zoomIn.touchstart(a,u,l),this._zoomOut.touchstart(a,u,l)},kn.prototype.touchmove=function(a,u,l){this._zoomIn.touchmove(a,u,l),this._zoomOut.touchmove(a,u,l)},kn.prototype.touchend=function(a,u,l){var c=this,y=this._zoomIn.touchend(a,u,l),_=this._zoomOut.touchend(a,u,l);return y?(this._active=!0,a.preventDefault(),setTimeout(function(){return c.reset()},0),{cameraAnimation:function(x){return x.easeTo({duration:300,zoom:x.getZoom()+1,around:x.unproject(y)},{originalEvent:a})}}):_?(this._active=!0,a.preventDefault(),setTimeout(function(){return c.reset()},0),{cameraAnimation:function(x){return x.easeTo({duration:300,zoom:x.getZoom()-1,around:x.unproject(_)},{originalEvent:a})}}):void 0},kn.prototype.touchcancel=function(){this.reset()},kn.prototype.enable=function(){this._enabled=!0},kn.prototype.disable=function(){this._enabled=!1,this.reset()},kn.prototype.isEnabled=function(){return this._enabled},kn.prototype.isActive=function(){return this._active};var xl={0:1,2:2},Sn=function(a){this.reset(),this._clickTolerance=a.clickTolerance||1};Sn.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton},Sn.prototype._correctButton=function(a,u){return!1},Sn.prototype._move=function(a,u){return{}},Sn.prototype.mousedown=function(a,u){if(!this._lastPoint){var l=v.mouseButton(a);this._correctButton(a,l)&&(this._lastPoint=u,this._eventButton=l)}},Sn.prototype.mousemoveWindow=function(a,u){var l=this._lastPoint;if(l){if(a.preventDefault(),function(c,y){var _=xl[y];return c.buttons===void 0||(c.buttons&_)!==_}(a,this._eventButton))this.reset();else if(this._moved||!(u.dist(l)<this._clickTolerance))return this._moved=!0,this._lastPoint=u,this._move(l,u)}},Sn.prototype.mouseupWindow=function(a){this._lastPoint&&v.mouseButton(a)===this._eventButton&&(this._moved&&v.suppressClick(),this.reset())},Sn.prototype.enable=function(){this._enabled=!0},Sn.prototype.disable=function(){this._enabled=!1,this.reset()},Sn.prototype.isEnabled=function(){return this._enabled},Sn.prototype.isActive=function(){return this._active};var le=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.mousedown=function(l,c){a.prototype.mousedown.call(this,l,c),this._lastPoint&&(this._active=!0)},u.prototype._correctButton=function(l,c){return c===0&&!l.ctrlKey},u.prototype._move=function(l,c){return{around:c,panDelta:c.sub(l)}},u}(Sn),yu=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._correctButton=function(l,c){return c===0&&l.ctrlKey||c===2},u.prototype._move=function(l,c){var y=.8*(c.x-l.x);if(y)return this._active=!0,{bearingDelta:y}},u.prototype.contextmenu=function(l){l.preventDefault()},u}(Sn),gu=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype._correctButton=function(l,c){return c===0&&l.ctrlKey||c===2},u.prototype._move=function(l,c){var y=-.5*(c.y-l.y);if(y)return this._active=!0,{pitchDelta:y}},u.prototype.contextmenu=function(l){l.preventDefault()},u}(Sn),ro=function(a){this._minTouches=1,this._clickTolerance=a.clickTolerance||1,this.reset()};ro.prototype.reset=function(){this._active=!1,this._touches={},this._sum=new i.Point(0,0)},ro.prototype.touchstart=function(a,u,l){return this._calculateTransform(a,u,l)},ro.prototype.touchmove=function(a,u,l){if(this._active&&!(l.length<this._minTouches))return a.preventDefault(),this._calculateTransform(a,u,l)},ro.prototype.touchend=function(a,u,l){this._calculateTransform(a,u,l),this._active&&l.length<this._minTouches&&this.reset()},ro.prototype.touchcancel=function(){this.reset()},ro.prototype._calculateTransform=function(a,u,l){l.length>0&&(this._active=!0);var c=_l(l,u),y=new i.Point(0,0),_=new i.Point(0,0),x=0;for(var S in c){var A=c[S],R=this._touches[S];R&&(y._add(A),_._add(A.sub(R)),x++,c[S]=A)}if(this._touches=c,!(x<this._minTouches)&&_.mag()){var G=_.div(x);if(this._sum._add(G),!(this._sum.mag()<this._clickTolerance))return{around:y.div(x),panDelta:G}}},ro.prototype.enable=function(){this._enabled=!0},ro.prototype.disable=function(){this._enabled=!1,this.reset()},ro.prototype.isEnabled=function(){return this._enabled},ro.prototype.isActive=function(){return this._active};var En=function(){this.reset()};function vu(a,u,l){for(var c=0;c<a.length;c++)if(a[c].identifier===l)return u[c]}function Jp(a,u){return Math.log(a/u)/Math.LN2}En.prototype.reset=function(){this._active=!1,delete this._firstTwoTouches},En.prototype._start=function(a){},En.prototype._move=function(a,u,l){return{}},En.prototype.touchstart=function(a,u,l){this._firstTwoTouches||l.length<2||(this._firstTwoTouches=[l[0].identifier,l[1].identifier],this._start([u[0],u[1]]))},En.prototype.touchmove=function(a,u,l){if(this._firstTwoTouches){a.preventDefault();var c=this._firstTwoTouches,y=c[1],_=vu(l,u,c[0]),x=vu(l,u,y);if(_&&x){var S=this._aroundCenter?null:_.add(x).div(2);return this._move([_,x],S,a)}}},En.prototype.touchend=function(a,u,l){if(this._firstTwoTouches){var c=this._firstTwoTouches,y=c[1],_=vu(l,u,c[0]),x=vu(l,u,y);_&&x||(this._active&&v.suppressClick(),this.reset())}},En.prototype.touchcancel=function(){this.reset()},En.prototype.enable=function(a){this._enabled=!0,this._aroundCenter=!!a&&a.around==="center"},En.prototype.disable=function(){this._enabled=!1,this.reset()},En.prototype.isEnabled=function(){return this._enabled},En.prototype.isActive=function(){return this._active};var $h=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.reset=function(){a.prototype.reset.call(this),delete this._distance,delete this._startDistance},u.prototype._start=function(l){this._startDistance=this._distance=l[0].dist(l[1])},u.prototype._move=function(l,c){var y=this._distance;if(this._distance=l[0].dist(l[1]),this._active||!(Math.abs(Jp(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Jp(this._distance,y),pinchAround:c}},u}(En);function Tn(a,u){return 180*a.angleWith(u)/Math.PI}var ha=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.reset=function(){a.prototype.reset.call(this),delete this._minDiameter,delete this._startVector,delete this._vector},u.prototype._start=function(l){this._startVector=this._vector=l[0].sub(l[1]),this._minDiameter=l[0].dist(l[1])},u.prototype._move=function(l,c){var y=this._vector;if(this._vector=l[0].sub(l[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Tn(this._vector,y),pinchAround:c}},u.prototype._isBelowThreshold=function(l){this._minDiameter=Math.min(this._minDiameter,l.mag());var c=25/(Math.PI*this._minDiameter)*360,y=Tn(l,this._startVector);return Math.abs(y)<c},u}(En);function _u(a){return Math.abs(a.y)>Math.abs(a.x)}var tc=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.reset=function(){a.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints},u.prototype._start=function(l){this._lastPoints=l,_u(l[0].sub(l[1]))&&(this._valid=!1)},u.prototype._move=function(l,c,y){var _=l[0].sub(this._lastPoints[0]),x=l[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(_,x,y.timeStamp),this._valid)return this._lastPoints=l,this._active=!0,{pitchDelta:(_.y+x.y)/2*-.5}},u.prototype.gestureBeginsVertically=function(l,c,y){if(this._valid!==void 0)return this._valid;var _=l.mag()>=2,x=c.mag()>=2;if(_||x){if(!_||!x)return this._firstMove===void 0&&(this._firstMove=y),y-this._firstMove<100&&void 0;var S=l.y>0==c.y>0;return _u(l)&&_u(c)&&S}},u}(En),ec={panStep:100,bearingStep:15,pitchStep:10},mo=function(){var a=ec;this._panStep=a.panStep,this._bearingStep=a.bearingStep,this._pitchStep=a.pitchStep,this._rotationDisabled=!1};function Qp(a){return a*(2-a)}mo.prototype.reset=function(){this._active=!1},mo.prototype.keydown=function(a){var u=this;if(!(a.altKey||a.ctrlKey||a.metaKey)){var l=0,c=0,y=0,_=0,x=0;switch(a.keyCode){case 61:case 107:case 171:case 187:l=1;break;case 189:case 109:case 173:l=-1;break;case 37:a.shiftKey?c=-1:(a.preventDefault(),_=-1);break;case 39:a.shiftKey?c=1:(a.preventDefault(),_=1);break;case 38:a.shiftKey?y=1:(a.preventDefault(),x=-1);break;case 40:a.shiftKey?y=-1:(a.preventDefault(),x=1);break;default:return}return this._rotationDisabled&&(c=0,y=0),{cameraAnimation:function(S){var A=S.getZoom();S.easeTo({duration:300,easeId:"keyboardHandler",easing:Qp,zoom:l?Math.round(A)+l*(a.shiftKey?2:1):A,bearing:S.getBearing()+c*u._bearingStep,pitch:S.getPitch()+y*u._pitchStep,offset:[-_*u._panStep,-x*u._panStep],center:S.getCenter()},{originalEvent:a})}}}},mo.prototype.enable=function(){this._enabled=!0},mo.prototype.disable=function(){this._enabled=!1,this.reset()},mo.prototype.isEnabled=function(){return this._enabled},mo.prototype.isActive=function(){return this._active},mo.prototype.disableRotation=function(){this._rotationDisabled=!0},mo.prototype.enableRotation=function(){this._rotationDisabled=!1};var Zr=function(a,u){this._map=a,this._el=a.getCanvasContainer(),this._handler=u,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=1/450,i.bindAll(["_onTimeout"],this)};Zr.prototype.setZoomRate=function(a){this._defaultZoomRate=a},Zr.prototype.setWheelZoomRate=function(a){this._wheelZoomRate=a},Zr.prototype.isEnabled=function(){return!!this._enabled},Zr.prototype.isActive=function(){return!!this._active||this._finishTimeout!==void 0},Zr.prototype.isZooming=function(){return!!this._zooming},Zr.prototype.enable=function(a){this.isEnabled()||(this._enabled=!0,this._aroundCenter=a&&a.around==="center")},Zr.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Zr.prototype.wheel=function(a){if(this.isEnabled()){var u=a.deltaMode===i.window.WheelEvent.DOM_DELTA_LINE?40*a.deltaY:a.deltaY,l=i.browser.now(),c=l-(this._lastWheelEventTime||0);this._lastWheelEventTime=l,u!==0&&u%4.000244140625==0?this._type="wheel":u!==0&&Math.abs(u)<4?this._type="trackpad":c>400?(this._type=null,this._lastValue=u,this._timeout=setTimeout(this._onTimeout,40,a)):this._type||(this._type=Math.abs(c*u)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,u+=this._lastValue)),a.shiftKey&&u&&(u/=4),this._type&&(this._lastWheelEvent=a,this._delta-=u,this._active||this._start(a)),a.preventDefault()}},Zr.prototype._onTimeout=function(a){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)},Zr.prototype._start=function(a){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var u=v.mousePos(this._el,a);this._around=i.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(u)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}},Zr.prototype.renderFrame=function(){var a=this;if(this._frameId&&(this._frameId=null,this.isActive())){var u=this._map.transform;if(this._delta!==0){var l=this._type==="wheel"&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,c=2/(1+Math.exp(-Math.abs(this._delta*l)));this._delta<0&&c!==0&&(c=1/c);var y=typeof this._targetZoom=="number"?u.zoomScale(this._targetZoom):u.scale;this._targetZoom=Math.min(u.maxZoom,Math.max(u.minZoom,u.scaleZoom(y*c))),this._type==="wheel"&&(this._startZoom=u.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var _,x=typeof this._targetZoom=="number"?this._targetZoom:u.zoom,S=this._startZoom,A=this._easing,R=!1;if(this._type==="wheel"&&S&&A){var G=Math.min((i.browser.now()-this._lastWheelEventTime)/200,1),Z=A(G);_=i.number(S,x,Z),G<1?this._frameId||(this._frameId=!0):R=!0}else _=x,R=!0;return this._active=!0,R&&(this._active=!1,this._finishTimeout=setTimeout(function(){a._zooming=!1,a._handler._triggerRenderFrame(),delete a._targetZoom,delete a._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!R,zoomDelta:_-u.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},Zr.prototype._smoothOutEasing=function(a){var u=i.ease;if(this._prevEase){var l=this._prevEase,c=(i.browser.now()-l.start)/l.duration,y=l.easing(c+.01)-l.easing(c),_=.27/Math.sqrt(y*y+1e-4)*.01,x=Math.sqrt(.0729-_*_);u=i.bezier(_,x,.25,1)}return this._prevEase={start:i.browser.now(),duration:a,easing:u},u},Zr.prototype.reset=function(){this._active=!1};var fr=function(a,u){this._clickZoom=a,this._tapZoom=u};fr.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable()},fr.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable()},fr.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},fr.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var io=function(){this.reset()};io.prototype.reset=function(){this._active=!1},io.prototype.dblclick=function(a,u){return a.preventDefault(),{cameraAnimation:function(l){l.easeTo({duration:300,zoom:l.getZoom()+(a.shiftKey?-1:1),around:l.unproject(u)},{originalEvent:a})}}},io.prototype.enable=function(){this._enabled=!0},io.prototype.disable=function(){this._enabled=!1,this.reset()},io.prototype.isEnabled=function(){return this._enabled},io.prototype.isActive=function(){return this._active};var Rn=function(){this._tap=new ua({numTouches:1,numTaps:1}),this.reset()};Rn.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},Rn.prototype.touchstart=function(a,u,l){this._swipePoint||(this._tapTime&&a.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?l.length>0&&(this._swipePoint=u[0],this._swipeTouch=l[0].identifier):this._tap.touchstart(a,u,l))},Rn.prototype.touchmove=function(a,u,l){if(this._tapTime){if(this._swipePoint){if(l[0].identifier!==this._swipeTouch)return;var c=u[0],y=c.y-this._swipePoint.y;return this._swipePoint=c,a.preventDefault(),this._active=!0,{zoomDelta:y/128}}}else this._tap.touchmove(a,u,l)},Rn.prototype.touchend=function(a,u,l){this._tapTime?this._swipePoint&&l.length===0&&this.reset():this._tap.touchend(a,u,l)&&(this._tapTime=a.timeStamp)},Rn.prototype.touchcancel=function(){this.reset()},Rn.prototype.enable=function(){this._enabled=!0},Rn.prototype.disable=function(){this._enabled=!1,this.reset()},Rn.prototype.isEnabled=function(){return this._enabled},Rn.prototype.isActive=function(){return this._active};var Wn=function(a,u,l){this._el=a,this._mousePan=u,this._touchPan=l};Wn.prototype.enable=function(a){this._inertiaOptions=a||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")},Wn.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")},Wn.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},Wn.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var Ka=function(a,u,l){this._pitchWithRotate=a.pitchWithRotate,this._mouseRotate=u,this._mousePitch=l};Ka.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},Ka.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},Ka.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},Ka.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var To=function(a,u,l,c){this._el=a,this._touchZoom=u,this._touchRotate=l,this._tapDragZoom=c,this._rotationDisabled=!1,this._enabled=!0};To.prototype.enable=function(a){this._touchZoom.enable(a),this._rotationDisabled||this._touchRotate.enable(a),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")},To.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")},To.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},To.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},To.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable()},To.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()};var ca=function(a){return a.zoom||a.drag||a.pitch||a.rotate},Kn=function(a){function u(){a.apply(this,arguments)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u}(i.Event);function Ha(a){return a.panDelta&&a.panDelta.mag()||a.zoomDelta||a.bearingDelta||a.pitchDelta}var re=function(a,u){this._map=a,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new gl(a),this._bearingSnap=u.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(u),i.bindAll(["handleEvent","handleWindowEvent"],this);var l=this._el;this._listeners=[[l,"touchstart",{passive:!0}],[l,"touchmove",{passive:!1}],[l,"touchend",void 0],[l,"touchcancel",void 0],[l,"mousedown",void 0],[l,"mousemove",void 0],[l,"mouseup",void 0],[i.window.document,"mousemove",{capture:!0}],[i.window.document,"mouseup",void 0],[l,"mouseover",void 0],[l,"mouseout",void 0],[l,"dblclick",void 0],[l,"click",void 0],[l,"keydown",{capture:!1}],[l,"keyup",void 0],[l,"wheel",{passive:!1}],[l,"contextmenu",void 0],[i.window,"blur",void 0]];for(var c=0,y=this._listeners;c<y.length;c+=1){var _=y[c],x=_[0];v.addEventListener(x,_[1],x===i.window.document?this.handleWindowEvent:this.handleEvent,_[2])}};re.prototype.destroy=function(){for(var a=0,u=this._listeners;a<u.length;a+=1){var l=u[a],c=l[0];v.removeEventListener(c,l[1],c===i.window.document?this.handleWindowEvent:this.handleEvent,l[2])}},re.prototype._addDefaultHandlers=function(a){var u=this._map,l=u.getCanvasContainer();this._add("mapEvent",new Ui(u,a));var c=u.boxZoom=new oe(u,a);this._add("boxZoom",c);var y=new kn,_=new io;u.doubleClickZoom=new fr(_,y),this._add("tapZoom",y),this._add("clickZoom",_);var x=new Rn;this._add("tapDragZoom",x);var S=u.touchPitch=new tc;this._add("touchPitch",S);var A=new yu(a),R=new gu(a);u.dragRotate=new Ka(a,A,R),this._add("mouseRotate",A,["mousePitch"]),this._add("mousePitch",R,["mouseRotate"]);var G=new le(a),Z=new ro(a);u.dragPan=new Wn(l,G,Z),this._add("mousePan",G),this._add("touchPan",Z,["touchZoom","touchRotate"]);var V=new ha,it=new $h;u.touchZoomRotate=new To(l,it,V,x),this._add("touchRotate",V,["touchPan","touchZoom"]),this._add("touchZoom",it,["touchPan","touchRotate"]);var et=u.scrollZoom=new Zr(u,this);this._add("scrollZoom",et,["mousePan"]);var ut=u.keyboard=new mo;this._add("keyboard",ut),this._add("blockableMapEvent",new Ln(u));for(var tt=0,lt=["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"];tt<lt.length;tt+=1){var yt=lt[tt];a.interactive&&a[yt]&&u[yt].enable(a[yt])}},re.prototype._add=function(a,u,l){this._handlers.push({handlerName:a,handler:u,allowed:l}),this._handlersById[a]=u},re.prototype.stop=function(a){if(!this._updatingCamera){for(var u=0,l=this._handlers;u<l.length;u+=1)l[u].handler.reset();this._inertia.clear(),this._fireEvents({},{},a),this._changes=[]}},re.prototype.isActive=function(){for(var a=0,u=this._handlers;a<u.length;a+=1)if(u[a].handler.isActive())return!0;return!1},re.prototype.isZooming=function(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()},re.prototype.isRotating=function(){return!!this._eventsInProgress.rotate},re.prototype.isMoving=function(){return Boolean(ca(this._eventsInProgress))||this.isZooming()},re.prototype._blockedByActive=function(a,u,l){for(var c in a)if(c!==l&&(!u||u.indexOf(c)<0))return!0;return!1},re.prototype.handleWindowEvent=function(a){this.handleEvent(a,a.type+"Window")},re.prototype._getMapTouches=function(a){for(var u=[],l=0,c=a;l<c.length;l+=1){var y=c[l];this._el.contains(y.target)&&u.push(y)}return u},re.prototype.handleEvent=function(a,u){if(a.type!=="blur"){this._updatingCamera=!0;for(var l=a.type==="renderFrame"?void 0:a,c={needsRenderFrame:!1},y={},_={},x=a.touches?this._getMapTouches(a.touches):void 0,S=x?v.touchPos(this._el,x):v.mousePos(this._el,a),A=0,R=this._handlers;A<R.length;A+=1){var G=R[A],Z=G.handlerName,V=G.handler,it=G.allowed;if(V.isEnabled()){var et=void 0;this._blockedByActive(_,it,Z)?V.reset():V[u||a.type]&&(et=V[u||a.type](a,S,x),this.mergeHandlerResult(c,y,et,Z,l),et&&et.needsRenderFrame&&this._triggerRenderFrame()),(et||V.isActive())&&(_[Z]=V)}}var ut={};for(var tt in this._previousActiveHandlers)_[tt]||(ut[tt]=l);this._previousActiveHandlers=_,(Object.keys(ut).length||Ha(c))&&(this._changes.push([c,y,ut]),this._triggerRenderFrame()),(Object.keys(_).length||Ha(c))&&this._map._stop(!0),this._updatingCamera=!1;var lt=c.cameraAnimation;lt&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],lt(this._map))}else this.stop(!0)},re.prototype.mergeHandlerResult=function(a,u,l,c,y){if(l){i.extend(a,l);var _={handlerName:c,originalEvent:l.originalEvent||y};l.zoomDelta!==void 0&&(u.zoom=_),l.panDelta!==void 0&&(u.drag=_),l.pitchDelta!==void 0&&(u.pitch=_),l.bearingDelta!==void 0&&(u.rotate=_)}},re.prototype._applyChanges=function(){for(var a={},u={},l={},c=0,y=this._changes;c<y.length;c+=1){var _=y[c],x=_[0],S=_[1],A=_[2];x.panDelta&&(a.panDelta=(a.panDelta||new i.Point(0,0))._add(x.panDelta)),x.zoomDelta&&(a.zoomDelta=(a.zoomDelta||0)+x.zoomDelta),x.bearingDelta&&(a.bearingDelta=(a.bearingDelta||0)+x.bearingDelta),x.pitchDelta&&(a.pitchDelta=(a.pitchDelta||0)+x.pitchDelta),x.around!==void 0&&(a.around=x.around),x.pinchAround!==void 0&&(a.pinchAround=x.pinchAround),x.noInertia&&(a.noInertia=x.noInertia),i.extend(u,S),i.extend(l,A)}this._updateMapTransform(a,u,l),this._changes=[]},re.prototype._updateMapTransform=function(a,u,l){var c=this._map,y=c.transform;if(!Ha(a))return this._fireEvents(u,l,!0);var _=a.panDelta,x=a.zoomDelta,S=a.bearingDelta,A=a.pitchDelta,R=a.around,G=a.pinchAround;G!==void 0&&(R=G),c._stop(!0),R=R||c.transform.centerPoint;var Z=y.pointLocation(_?R.sub(_):R);S&&(y.bearing+=S),A&&(y.pitch+=A),x&&(y.zoom+=x),y.setLocationAtPoint(Z,R),this._map._update(),a.noInertia||this._inertia.record(a),this._fireEvents(u,l,!0)},re.prototype._fireEvents=function(a,u,l){var c=this,y=ca(this._eventsInProgress),_=ca(a),x={};for(var S in a)this._eventsInProgress[S]||(x[S+"start"]=a[S].originalEvent),this._eventsInProgress[S]=a[S];for(var A in!y&&_&&this._fireEvent("movestart",_.originalEvent),x)this._fireEvent(A,x[A]);for(var R in _&&this._fireEvent("move",_.originalEvent),a)this._fireEvent(R,a[R].originalEvent);var G,Z={};for(var V in this._eventsInProgress){var it=this._eventsInProgress[V],et=it.handlerName,ut=it.originalEvent;this._handlersById[et].isActive()||(delete this._eventsInProgress[V],Z[V+"end"]=G=u[et]||ut)}for(var tt in Z)this._fireEvent(tt,Z[tt]);var lt=ca(this._eventsInProgress);if(l&&(y||_)&&!lt){this._updatingCamera=!0;var yt=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),_t=function(It){return It!==0&&-c._bearingSnap<It&&It<c._bearingSnap};yt?(_t(yt.bearing||this._map.getBearing())&&(yt.bearing=0),this._map.easeTo(yt,{originalEvent:G})):(this._map.fire(new i.Event("moveend",{originalEvent:G})),_t(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}},re.prototype._fireEvent=function(a,u){this._map.fire(new i.Event(a,u?{originalEvent:u}:{}))},re.prototype._requestFrame=function(){var a=this;return this._map.triggerRepaint(),this._map._renderTaskQueue.add(function(u){delete a._frameId,a.handleEvent(new Kn("renderFrame",{timeStamp:u})),a._applyChanges()})},re.prototype._triggerRenderFrame=function(){this._frameId===void 0&&(this._frameId=this._requestFrame())};var Ie=function(a){function u(l,c){a.call(this),this._moving=!1,this._zooming=!1,this.transform=l,this._bearingSnap=c.bearingSnap,i.bindAll(["_renderFrameCallback"],this)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.getCenter=function(){return new i.LngLat(this.transform.center.lng,this.transform.center.lat)},u.prototype.setCenter=function(l,c){return this.jumpTo({center:l},c)},u.prototype.panBy=function(l,c,y){return l=i.Point.convert(l).mult(-1),this.panTo(this.transform.center,i.extend({offset:l},c),y)},u.prototype.panTo=function(l,c,y){return this.easeTo(i.extend({center:l},c),y)},u.prototype.getZoom=function(){return this.transform.zoom},u.prototype.setZoom=function(l,c){return this.jumpTo({zoom:l},c),this},u.prototype.zoomTo=function(l,c,y){return this.easeTo(i.extend({zoom:l},c),y)},u.prototype.zoomIn=function(l,c){return this.zoomTo(this.getZoom()+1,l,c),this},u.prototype.zoomOut=function(l,c){return this.zoomTo(this.getZoom()-1,l,c),this},u.prototype.getBearing=function(){return this.transform.bearing},u.prototype.setBearing=function(l,c){return this.jumpTo({bearing:l},c),this},u.prototype.getPadding=function(){return this.transform.padding},u.prototype.setPadding=function(l,c){return this.jumpTo({padding:l},c),this},u.prototype.rotateTo=function(l,c,y){return this.easeTo(i.extend({bearing:l},c),y)},u.prototype.resetNorth=function(l,c){return this.rotateTo(0,i.extend({duration:1e3},l),c),this},u.prototype.resetNorthPitch=function(l,c){return this.easeTo(i.extend({bearing:0,pitch:0,duration:1e3},l),c),this},u.prototype.snapToNorth=function(l,c){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(l,c):this},u.prototype.getPitch=function(){return this.transform.pitch},u.prototype.setPitch=function(l,c){return this.jumpTo({pitch:l},c),this},u.prototype.cameraForBounds=function(l,c){l=i.LngLatBounds.convert(l);var y=c&&c.bearing||0;return this._cameraForBoxAndBearing(l.getNorthWest(),l.getSouthEast(),y,c)},u.prototype._cameraForBoxAndBearing=function(l,c,y,_){var x={top:0,bottom:0,right:0,left:0};if(typeof(_=i.extend({padding:x,offset:[0,0],maxZoom:this.transform.maxZoom},_)).padding=="number"){var S=_.padding;_.padding={top:S,bottom:S,right:S,left:S}}_.padding=i.extend(x,_.padding);var A=this.transform,R=A.padding,G=A.project(i.LngLat.convert(l)),Z=A.project(i.LngLat.convert(c)),V=G.rotate(-y*Math.PI/180),it=Z.rotate(-y*Math.PI/180),et=new i.Point(Math.max(V.x,it.x),Math.max(V.y,it.y)),ut=new i.Point(Math.min(V.x,it.x),Math.min(V.y,it.y)),tt=et.sub(ut),lt=(A.width-(R.left+R.right+_.padding.left+_.padding.right))/tt.x,yt=(A.height-(R.top+R.bottom+_.padding.top+_.padding.bottom))/tt.y;if(!(yt<0||lt<0)){var _t=Math.min(A.scaleZoom(A.scale*Math.min(lt,yt)),_.maxZoom),It=typeof _.offset.x=="number"?new i.Point(_.offset.x,_.offset.y):i.Point.convert(_.offset),Tt=new i.Point((_.padding.left-_.padding.right)/2,(_.padding.top-_.padding.bottom)/2).rotate(y*Math.PI/180),Ct=It.add(Tt).mult(A.scale/A.zoomScale(_t));return{center:A.unproject(G.add(Z).div(2).sub(Ct)),zoom:_t,bearing:y}}i.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")},u.prototype.fitBounds=function(l,c,y){return this._fitInternal(this.cameraForBounds(l,c),c,y)},u.prototype.fitScreenCoordinates=function(l,c,y,_,x){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(i.Point.convert(l)),this.transform.pointLocation(i.Point.convert(c)),y,_),_,x)},u.prototype._fitInternal=function(l,c,y){return l?(delete(c=i.extend(l,c)).padding,c.linear?this.easeTo(c,y):this.flyTo(c,y)):this},u.prototype.jumpTo=function(l,c){this.stop();var y=this.transform,_=!1,x=!1,S=!1;return"zoom"in l&&y.zoom!==+l.zoom&&(_=!0,y.zoom=+l.zoom),l.center!==void 0&&(y.center=i.LngLat.convert(l.center)),"bearing"in l&&y.bearing!==+l.bearing&&(x=!0,y.bearing=+l.bearing),"pitch"in l&&y.pitch!==+l.pitch&&(S=!0,y.pitch=+l.pitch),l.padding==null||y.isPaddingEqual(l.padding)||(y.padding=l.padding),this.fire(new i.Event("movestart",c)).fire(new i.Event("move",c)),_&&this.fire(new i.Event("zoomstart",c)).fire(new i.Event("zoom",c)).fire(new i.Event("zoomend",c)),x&&this.fire(new i.Event("rotatestart",c)).fire(new i.Event("rotate",c)).fire(new i.Event("rotateend",c)),S&&this.fire(new i.Event("pitchstart",c)).fire(new i.Event("pitch",c)).fire(new i.Event("pitchend",c)),this.fire(new i.Event("moveend",c))},u.prototype.easeTo=function(l,c){var y=this;this._stop(!1,l.easeId),((l=i.extend({offset:[0,0],duration:500,easing:i.ease},l)).animate===!1||!l.essential&&i.browser.prefersReducedMotion)&&(l.duration=0);var _=this.transform,x=this.getZoom(),S=this.getBearing(),A=this.getPitch(),R=this.getPadding(),G="zoom"in l?+l.zoom:x,Z="bearing"in l?this._normalizeBearing(l.bearing,S):S,V="pitch"in l?+l.pitch:A,it="padding"in l?l.padding:_.padding,et=i.Point.convert(l.offset),ut=_.centerPoint.add(et),tt=_.pointLocation(ut),lt=i.LngLat.convert(l.center||tt);this._normalizeCenter(lt);var yt,_t,It=_.project(tt),Tt=_.project(lt).sub(It),Ct=_.zoomScale(G-x);l.around&&(yt=i.LngLat.convert(l.around),_t=_.locationPoint(yt));var Lt={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||G!==x,this._rotating=this._rotating||S!==Z,this._pitching=this._pitching||V!==A,this._padding=!_.isPaddingEqual(it),this._easeId=l.easeId,this._prepareEase(c,l.noMoveStart,Lt),this._ease(function(qt){if(y._zooming&&(_.zoom=i.number(x,G,qt)),y._rotating&&(_.bearing=i.number(S,Z,qt)),y._pitching&&(_.pitch=i.number(A,V,qt)),y._padding&&(_.interpolatePadding(R,it,qt),ut=_.centerPoint.add(et)),yt)_.setLocationAtPoint(yt,_t);else{var Ut=_.zoomScale(_.zoom-x),ie=G>x?Math.min(2,Ct):Math.max(.5,Ct),_e=Math.pow(ie,1-qt),Se=_.unproject(It.add(Tt.mult(qt*_e)).mult(Ut));_.setLocationAtPoint(_.renderWorldCopies?Se.wrap():Se,ut)}y._fireMoveEvents(c)},function(qt){y._afterEase(c,qt)},l),this},u.prototype._prepareEase=function(l,c,y){y===void 0&&(y={}),this._moving=!0,c||y.moving||this.fire(new i.Event("movestart",l)),this._zooming&&!y.zooming&&this.fire(new i.Event("zoomstart",l)),this._rotating&&!y.rotating&&this.fire(new i.Event("rotatestart",l)),this._pitching&&!y.pitching&&this.fire(new i.Event("pitchstart",l))},u.prototype._fireMoveEvents=function(l){this.fire(new i.Event("move",l)),this._zooming&&this.fire(new i.Event("zoom",l)),this._rotating&&this.fire(new i.Event("rotate",l)),this._pitching&&this.fire(new i.Event("pitch",l))},u.prototype._afterEase=function(l,c){if(!this._easeId||!c||this._easeId!==c){delete this._easeId;var y=this._zooming,_=this._rotating,x=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,y&&this.fire(new i.Event("zoomend",l)),_&&this.fire(new i.Event("rotateend",l)),x&&this.fire(new i.Event("pitchend",l)),this.fire(new i.Event("moveend",l))}},u.prototype.flyTo=function(l,c){var y=this;if(!l.essential&&i.browser.prefersReducedMotion){var _=i.pick(l,["center","zoom","bearing","pitch","around"]);return this.jumpTo(_,c)}this.stop(),l=i.extend({offset:[0,0],speed:1.2,curve:1.42,easing:i.ease},l);var x=this.transform,S=this.getZoom(),A=this.getBearing(),R=this.getPitch(),G=this.getPadding(),Z="zoom"in l?i.clamp(+l.zoom,x.minZoom,x.maxZoom):S,V="bearing"in l?this._normalizeBearing(l.bearing,A):A,it="pitch"in l?+l.pitch:R,et="padding"in l?l.padding:x.padding,ut=x.zoomScale(Z-S),tt=i.Point.convert(l.offset),lt=x.centerPoint.add(tt),yt=x.pointLocation(lt),_t=i.LngLat.convert(l.center||yt);this._normalizeCenter(_t);var It=x.project(yt),Tt=x.project(_t).sub(It),Ct=l.curve,Lt=Math.max(x.width,x.height),qt=Lt/ut,Ut=Tt.mag();if("minZoom"in l){var ie=i.clamp(Math.min(l.minZoom,S,Z),x.minZoom,x.maxZoom),_e=Lt/x.zoomScale(ie-S);Ct=Math.sqrt(_e/Ut*2)}var Se=Ct*Ct;function xe(Pe){var Ee=(qt*qt-Lt*Lt+(Pe?-1:1)*Se*Se*Ut*Ut)/(2*(Pe?qt:Lt)*Se*Ut);return Math.log(Math.sqrt(Ee*Ee+1)-Ee)}function nr(Pe){return(Math.exp(Pe)-Math.exp(-Pe))/2}function ue(Pe){return(Math.exp(Pe)+Math.exp(-Pe))/2}var De=xe(0),je=function(Pe){return ue(De)/ue(De+Ct*Pe)},Oe=function(Pe){return Lt*((ue(De)*(nr(Ee=De+Ct*Pe)/ue(Ee))-nr(De))/Se)/Ut;var Ee},ze=(xe(1)-De)/Ct;if(Math.abs(Ut)<1e-6||!isFinite(ze)){if(Math.abs(Lt-qt)<1e-6)return this.easeTo(l,c);var Re=qt<Lt?-1:1;ze=Math.abs(Math.log(qt/Lt))/Ct,Oe=function(){return 0},je=function(Pe){return Math.exp(Re*Ct*Pe)}}return l.duration="duration"in l?+l.duration:1e3*ze/("screenSpeed"in l?+l.screenSpeed/Ct:+l.speed),l.maxDuration&&l.duration>l.maxDuration&&(l.duration=0),this._zooming=!0,this._rotating=A!==V,this._pitching=it!==R,this._padding=!x.isPaddingEqual(et),this._prepareEase(c,!1),this._ease(function(Pe){var Ee=Pe*ze,wr=1/je(Ee);x.zoom=Pe===1?Z:S+x.scaleZoom(wr),y._rotating&&(x.bearing=i.number(A,V,Pe)),y._pitching&&(x.pitch=i.number(R,it,Pe)),y._padding&&(x.interpolatePadding(G,et,Pe),lt=x.centerPoint.add(tt));var ai=Pe===1?_t:x.unproject(It.add(Tt.mult(Oe(Ee))).mult(wr));x.setLocationAtPoint(x.renderWorldCopies?ai.wrap():ai,lt),y._fireMoveEvents(c)},function(){return y._afterEase(c)},l),this},u.prototype.isEasing=function(){return!!this._easeFrameId},u.prototype.stop=function(){return this._stop()},u.prototype._stop=function(l,c){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var y=this._onEaseEnd;delete this._onEaseEnd,y.call(this,c)}if(!l){var _=this.handlers;_&&_.stop(!1)}return this},u.prototype._ease=function(l,c,y){y.animate===!1||y.duration===0?(l(1),c()):(this._easeStart=i.browser.now(),this._easeOptions=y,this._onEaseFrame=l,this._onEaseEnd=c,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},u.prototype._renderFrameCallback=function(){var l=Math.min((i.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(l)),l<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},u.prototype._normalizeBearing=function(l,c){l=i.wrap(l,-180,180);var y=Math.abs(l-c);return Math.abs(l-360-c)<y&&(l-=360),Math.abs(l+360-c)<y&&(l+=360),l},u.prototype._normalizeCenter=function(l){var c=this.transform;if(c.renderWorldCopies&&!c.lngRange){var y=l.lng-c.center.lng;l.lng+=y>180?-360:y<-180?360:0}},u}(i.Evented),zn=function(a){a===void 0&&(a={}),this.options=a,i.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)};zn.prototype.getDefaultPosition=function(){return"bottom-right"},zn.prototype.onAdd=function(a){var u=this.options&&this.options.compact;return this._map=a,this._container=v.create("div","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=v.create("button","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.type="button",this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=v.create("div","maplibregl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),u&&this._container.classList.add("maplibregl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),u===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},zn.prototype.onRemove=function(){v.remove(this._container),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},zn.prototype._setElementTitle=function(a,u){var l=this._map._getUIString("AttributionControl."+u);a.title=l,a.setAttribute("aria-label",l)},zn.prototype._toggleAttribution=function(){this._container.classList.contains("maplibregl-compact-show")?(this._container.classList.remove("maplibregl-compact-show"),this._compactButton.setAttribute("aria-pressed","false")):(this._container.classList.add("maplibregl-compact-show"),this._compactButton.setAttribute("aria-pressed","true"))},zn.prototype._updateEditLink=function(){var a=this._editLink;a||(a=this._editLink=this._container.querySelector(".mapbox-improve-map"));var u=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.config.ACCESS_TOKEN}];if(a){var l=u.reduce(function(c,y,_){return y.value&&(c+=y.key+"="+y.value+(_<u.length-1?"&":"")),c},"?");a.href=i.config.FEEDBACK_URL+"/"+l+(this._map._hash?this._map._hash.getHashString(!0):""),a.rel="noopener nofollow",this._setElementTitle(a,"MapFeedback")}},zn.prototype._updateData=function(a){!a||a.sourceDataType!=="metadata"&&a.sourceDataType!=="visibility"&&a.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())},zn.prototype._updateAttributions=function(){if(this._map.style){var a=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?a=a.concat(this.options.customAttribution.map(function(S){return typeof S!="string"?"":S})):typeof this.options.customAttribution=="string"&&a.push(this.options.customAttribution)),this._map.style.stylesheet){var u=this._map.style.stylesheet;this.styleOwner=u.owner,this.styleId=u.id}var l=this._map.style.sourceCaches;for(var c in l){var y=l[c];if(y.used){var _=y.getSource();_.attribution&&a.indexOf(_.attribution)<0&&a.push(_.attribution)}}a.sort(function(S,A){return S.length-A.length});var x=(a=a.filter(function(S,A){for(var R=A+1;R<a.length;R++)if(a[R].indexOf(S)>=0)return!1;return!0})).join(" | ");x!==this._attribHTML&&(this._attribHTML=x,a.length?(this._innerContainer.innerHTML=x,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._editLink=null)}},zn.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("maplibregl-compact"):this._container.classList.remove("maplibregl-compact","maplibregl-compact-show")};var no=function(){i.bindAll(["_updateLogo"],this),i.bindAll(["_updateCompact"],this)};no.prototype.onAdd=function(a){this._map=a,this._container=v.create("div","maplibregl-ctrl");var u=v.create("a","maplibregl-ctrl-logo");return u.target="_blank",u.rel="noopener nofollow",u.href="https://maplibre.org/",u.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),u.setAttribute("rel","noopener nofollow"),this._container.appendChild(u),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},no.prototype.onRemove=function(){v.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},no.prototype.getDefaultPosition=function(){return"bottom-left"},no.prototype._updateLogo=function(a){a&&a.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")},no.prototype._logoRequired=function(){if(this._map.style){var a=this._map.style.sourceCaches;for(var u in a)if(a[u].getSource().mapbox_logo)return!0;return!1}},no.prototype._updateCompact=function(){var a=this._container.children;if(a.length){var u=a[0];this._map.getCanvasContainer().offsetWidth<250?u.classList.add("maplibregl-compact"):u.classList.remove("maplibregl-compact")}};var Fo=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};Fo.prototype.add=function(a){var u=++this._id;return this._queue.push({callback:a,id:u,cancelled:!1}),u},Fo.prototype.remove=function(a){for(var u=this._currentlyRunning,l=0,c=u?this._queue.concat(u):this._queue;l<c.length;l+=1){var y=c[l];if(y.id===a)return void(y.cancelled=!0)}},Fo.prototype.run=function(a){a===void 0&&(a=0);var u=this._currentlyRunning=this._queue;this._queue=[];for(var l=0,c=u;l<c.length;l+=1){var y=c[l];if(!y.cancelled&&(y.callback(a),this._cleared))break}this._cleared=!1,this._currentlyRunning=!1},Fo.prototype.clear=function(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]};var Dn={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm"},oo=i.window.HTMLImageElement,fm=i.window.HTMLElement,Bo=i.window.ImageBitmap,kr={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},Gi=function(a){function u(c){var y=this;if((c=i.extend({},kr,c)).minZoom!=null&&c.maxZoom!=null&&c.minZoom>c.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(c.minPitch!=null&&c.maxPitch!=null&&c.minPitch>c.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(c.minPitch!=null&&c.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(c.maxPitch!=null&&c.maxPitch>60)throw new Error("maxPitch must be less than or equal to 60");var _=new gr(c.minZoom,c.maxZoom,c.minPitch,c.maxPitch,c.renderWorldCopies);if(a.call(this,_,c),this._interactive=c.interactive,this._maxTileCacheSize=c.maxTileCacheSize,this._failIfMajorPerformanceCaveat=c.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=c.preserveDrawingBuffer,this._antialias=c.antialias,this._trackResize=c.trackResize,this._bearingSnap=c.bearingSnap,this._refreshExpiredTiles=c.refreshExpiredTiles,this._fadeDuration=c.fadeDuration,this._crossSourceCollisions=c.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=c.collectResourceTiming,this._renderTaskQueue=new Fo,this._controls=[],this._mapId=i.uniqueId(),this._locale=i.extend({},Dn,c.locale),this._clickTolerance=c.clickTolerance,this._requestManager=new i.RequestManager(c.transformRequest,c.accessToken),typeof c.container=="string"){if(this._container=i.window.document.getElementById(c.container),!this._container)throw new Error("Container '"+c.container+"' not found.")}else{if(!(c.container instanceof fm))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=c.container}if(c.maxBounds&&this.setMaxBounds(c.maxBounds),i.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",function(){return y._update(!1)}),this.on("moveend",function(){return y._update(!1)}),this.on("zoom",function(){return y._update(!0)}),i.window!==void 0&&(i.window.addEventListener("online",this._onWindowOnline,!1),i.window.addEventListener("resize",this._onWindowResize,!1),i.window.addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new re(this,c),this._hash=c.hash&&new Wa(typeof c.hash=="string"&&c.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:c.center,zoom:c.zoom,bearing:c.bearing,pitch:c.pitch}),c.bounds&&(this.resize(),this.fitBounds(c.bounds,i.extend({},c.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=c.localIdeographFontFamily,c.style&&this.setStyle(c.style,{localIdeographFontFamily:c.localIdeographFontFamily}),c.attributionControl&&this.addControl(new zn({customAttribution:c.customAttribution})),this.addControl(new no,c.logoPosition),this.on("style.load",function(){y.transform.unmodified&&y.jumpTo(y.style.stylesheet)}),this.on("data",function(x){y._update(x.dataType==="style"),y.fire(new i.Event(x.dataType+"data",x))}),this.on("dataloading",function(x){y.fire(new i.Event(x.dataType+"dataloading",x))})}a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u;var l={showTileBoundaries:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return u.prototype._getMapId=function(){return this._mapId},u.prototype.addControl=function(c,y){if(y===void 0&&(y=c.getDefaultPosition?c.getDefaultPosition():"top-right"),!c||!c.onAdd)return this.fire(new i.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var _=c.onAdd(this);this._controls.push(c);var x=this._controlPositions[y];return y.indexOf("bottom")!==-1?x.insertBefore(_,x.firstChild):x.appendChild(_),this},u.prototype.removeControl=function(c){if(!c||!c.onRemove)return this.fire(new i.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var y=this._controls.indexOf(c);return y>-1&&this._controls.splice(y,1),c.onRemove(this),this},u.prototype.hasControl=function(c){return this._controls.indexOf(c)>-1},u.prototype.resize=function(c){var y=this._containerDimensions(),_=y[0],x=y[1];this._resizeCanvas(_,x),this.transform.resize(_,x),this.painter.resize(_,x);var S=!this._moving;return S&&(this.stop(),this.fire(new i.Event("movestart",c)).fire(new i.Event("move",c))),this.fire(new i.Event("resize",c)),S&&this.fire(new i.Event("moveend",c)),this},u.prototype.getBounds=function(){return this.transform.getBounds()},u.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},u.prototype.setMaxBounds=function(c){return this.transform.setMaxBounds(i.LngLatBounds.convert(c)),this._update()},u.prototype.setMinZoom=function(c){if((c=c??-2)>=-2&&c<=this.transform.maxZoom)return this.transform.minZoom=c,this._update(),this.getZoom()<c&&this.setZoom(c),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")},u.prototype.getMinZoom=function(){return this.transform.minZoom},u.prototype.setMaxZoom=function(c){if((c=c??22)>=this.transform.minZoom)return this.transform.maxZoom=c,this._update(),this.getZoom()>c&&this.setZoom(c),this;throw new Error("maxZoom must be greater than the current minZoom")},u.prototype.getMaxZoom=function(){return this.transform.maxZoom},u.prototype.setMinPitch=function(c){if((c=c??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(c>=0&&c<=this.transform.maxPitch)return this.transform.minPitch=c,this._update(),this.getPitch()<c&&this.setPitch(c),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")},u.prototype.getMinPitch=function(){return this.transform.minPitch},u.prototype.setMaxPitch=function(c){if((c=c??60)>60)throw new Error("maxPitch must be less than or equal to 60");if(c>=this.transform.minPitch)return this.transform.maxPitch=c,this._update(),this.getPitch()>c&&this.setPitch(c),this;throw new Error("maxPitch must be greater than the current minPitch")},u.prototype.getMaxPitch=function(){return this.transform.maxPitch},u.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},u.prototype.setRenderWorldCopies=function(c){return this.transform.renderWorldCopies=c,this._update()},u.prototype.project=function(c){return this.transform.locationPoint(i.LngLat.convert(c))},u.prototype.unproject=function(c){return this.transform.pointLocation(i.Point.convert(c))},u.prototype.isMoving=function(){return this._moving||this.handlers.isMoving()},u.prototype.isZooming=function(){return this._zooming||this.handlers.isZooming()},u.prototype.isRotating=function(){return this._rotating||this.handlers.isRotating()},u.prototype._createDelegatedListener=function(c,y,_){var x,S=this;if(c==="mouseenter"||c==="mouseover"){var A=!1;return{layer:y,listener:_,delegates:{mousemove:function(G){var Z=S.getLayer(y)?S.queryRenderedFeatures(G.point,{layers:[y]}):[];Z.length?A||(A=!0,_.call(S,new tn(c,S,G.originalEvent,{features:Z}))):A=!1},mouseout:function(){A=!1}}}}if(c==="mouseleave"||c==="mouseout"){var R=!1;return{layer:y,listener:_,delegates:{mousemove:function(G){(S.getLayer(y)?S.queryRenderedFeatures(G.point,{layers:[y]}):[]).length?R=!0:R&&(R=!1,_.call(S,new tn(c,S,G.originalEvent)))},mouseout:function(G){R&&(R=!1,_.call(S,new tn(c,S,G.originalEvent)))}}}}return{layer:y,listener:_,delegates:(x={},x[c]=function(G){var Z=S.getLayer(y)?S.queryRenderedFeatures(G.point,{layers:[y]}):[];Z.length&&(G.features=Z,_.call(S,G),delete G.features)},x)}},u.prototype.on=function(c,y,_){if(_===void 0)return a.prototype.on.call(this,c,y);var x=this._createDelegatedListener(c,y,_);for(var S in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[c]=this._delegatedListeners[c]||[],this._delegatedListeners[c].push(x),x.delegates)this.on(S,x.delegates[S]);return this},u.prototype.once=function(c,y,_){if(_===void 0)return a.prototype.once.call(this,c,y);var x=this._createDelegatedListener(c,y,_);for(var S in x.delegates)this.once(S,x.delegates[S]);return this},u.prototype.off=function(c,y,_){var x=this;return _===void 0?a.prototype.off.call(this,c,y):(this._delegatedListeners&&this._delegatedListeners[c]&&function(S){for(var A=S[c],R=0;R<A.length;R++){var G=A[R];if(G.layer===y&&G.listener===_){for(var Z in G.delegates)x.off(Z,G.delegates[Z]);return A.splice(R,1),x}}}(this._delegatedListeners),this)},u.prototype.queryRenderedFeatures=function(c,y){if(!this.style)return[];var _;if(y!==void 0||c===void 0||c instanceof i.Point||Array.isArray(c)||(y=c,c=void 0),y=y||{},(c=c||[[0,0],[this.transform.width,this.transform.height]])instanceof i.Point||typeof c[0]=="number")_=[i.Point.convert(c)];else{var x=i.Point.convert(c[0]),S=i.Point.convert(c[1]);_=[x,new i.Point(S.x,x.y),S,new i.Point(x.x,S.y),x]}return this.style.queryRenderedFeatures(_,y,this.transform)},u.prototype.querySourceFeatures=function(c,y){return this.style.querySourceFeatures(c,y)},u.prototype.setStyle=function(c,y){return(y=i.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},y)).diff!==!1&&y.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&c?(this._diffStyle(c,y),this):(this._localIdeographFontFamily=y.localIdeographFontFamily,this._updateStyle(c,y))},u.prototype.setTransformRequest=function(c){return this._requestManager.setTransformRequest(c),this},u.prototype._getUIString=function(c){var y=this._locale[c];if(y==null)throw new Error("Missing UI string '"+c+"'");return y},u.prototype._updateStyle=function(c,y){return this.style&&(this.style.setEventedParent(null),this.style._remove()),c?(this.style=new No(this,y||{}),this.style.setEventedParent(this,{style:this.style}),typeof c=="string"?this.style.loadURL(c):this.style.loadJSON(c),this):(delete this.style,this)},u.prototype._lazyInitEmptyStyle=function(){this.style||(this.style=new No(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())},u.prototype._diffStyle=function(c,y){var _=this;if(typeof c=="string"){var x=this._requestManager.normalizeStyleURL(c),S=this._requestManager.transformRequest(x,i.ResourceType.Style);i.getJSON(S,function(A,R){A?_.fire(new i.ErrorEvent(A)):R&&_._updateDiff(R,y)})}else typeof c=="object"&&this._updateDiff(c,y)},u.prototype._updateDiff=function(c,y){try{this.style.setState(c)&&this._update(!0)}catch(_){i.warnOnce("Unable to perform style diff: "+(_.message||_.error||_)+". Rebuilding the style from scratch."),this._updateStyle(c,y)}},u.prototype.getStyle=function(){if(this.style)return this.style.serialize()},u.prototype.isStyleLoaded=function(){return this.style?this.style.loaded():i.warnOnce("There is no style added to the map.")},u.prototype.addSource=function(c,y){return this._lazyInitEmptyStyle(),this.style.addSource(c,y),this._update(!0)},u.prototype.isSourceLoaded=function(c){var y=this.style&&this.style.sourceCaches[c];if(y!==void 0)return y.loaded();this.fire(new i.ErrorEvent(new Error("There is no source with ID '"+c+"'")))},u.prototype.areTilesLoaded=function(){var c=this.style&&this.style.sourceCaches;for(var y in c){var _=c[y]._tiles;for(var x in _){var S=_[x];if(S.state!=="loaded"&&S.state!=="errored")return!1}}return!0},u.prototype.addSourceType=function(c,y,_){return this._lazyInitEmptyStyle(),this.style.addSourceType(c,y,_)},u.prototype.removeSource=function(c){return this.style.removeSource(c),this._update(!0)},u.prototype.getSource=function(c){return this.style.getSource(c)},u.prototype.addImage=function(c,y,_){_===void 0&&(_={});var x=_.pixelRatio;x===void 0&&(x=1);var S=_.sdf;S===void 0&&(S=!1);var A=_.stretchX,R=_.stretchY,G=_.content;if(this._lazyInitEmptyStyle(),y instanceof oo||Bo&&y instanceof Bo){var Z=i.browser.getImageData(y);this.style.addImage(c,{data:new i.RGBAImage({width:Z.width,height:Z.height},Z.data),pixelRatio:x,stretchX:A,stretchY:R,content:G,sdf:S,version:0})}else{if(y.width===void 0||y.height===void 0)return this.fire(new i.ErrorEvent(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`")));var V=y;this.style.addImage(c,{data:new i.RGBAImage({width:y.width,height:y.height},new Uint8Array(y.data)),pixelRatio:x,stretchX:A,stretchY:R,content:G,sdf:S,version:0,userImage:V}),V.onAdd&&V.onAdd(this,c)}},u.prototype.updateImage=function(c,y){var _=this.style.getImage(c);if(!_)return this.fire(new i.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));var x=y instanceof oo||Bo&&y instanceof Bo?i.browser.getImageData(y):y,S=x.width,A=x.height,R=x.data;return S===void 0||A===void 0?this.fire(new i.ErrorEvent(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`"))):S!==_.data.width||A!==_.data.height?this.fire(new i.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image"))):(_.data.replace(R,!(y instanceof oo||Bo&&y instanceof Bo)),void this.style.updateImage(c,_))},u.prototype.hasImage=function(c){return c?!!this.style.getImage(c):(this.fire(new i.ErrorEvent(new Error("Missing required image id"))),!1)},u.prototype.removeImage=function(c){this.style.removeImage(c)},u.prototype.loadImage=function(c,y){i.getImage(this._requestManager.transformRequest(c,i.ResourceType.Image),y)},u.prototype.listImages=function(){return this.style.listImages()},u.prototype.addLayer=function(c,y){return this._lazyInitEmptyStyle(),this.style.addLayer(c,y),this._update(!0)},u.prototype.moveLayer=function(c,y){return this.style.moveLayer(c,y),this._update(!0)},u.prototype.removeLayer=function(c){return this.style.removeLayer(c),this._update(!0)},u.prototype.getLayer=function(c){return this.style.getLayer(c)},u.prototype.setLayerZoomRange=function(c,y,_){return this.style.setLayerZoomRange(c,y,_),this._update(!0)},u.prototype.setFilter=function(c,y,_){return _===void 0&&(_={}),this.style.setFilter(c,y,_),this._update(!0)},u.prototype.getFilter=function(c){return this.style.getFilter(c)},u.prototype.setPaintProperty=function(c,y,_,x){return x===void 0&&(x={}),this.style.setPaintProperty(c,y,_,x),this._update(!0)},u.prototype.getPaintProperty=function(c,y){return this.style.getPaintProperty(c,y)},u.prototype.setLayoutProperty=function(c,y,_,x){return x===void 0&&(x={}),this.style.setLayoutProperty(c,y,_,x),this._update(!0)},u.prototype.getLayoutProperty=function(c,y){return this.style.getLayoutProperty(c,y)},u.prototype.setLight=function(c,y){return y===void 0&&(y={}),this._lazyInitEmptyStyle(),this.style.setLight(c,y),this._update(!0)},u.prototype.getLight=function(){return this.style.getLight()},u.prototype.setFeatureState=function(c,y){return this.style.setFeatureState(c,y),this._update()},u.prototype.removeFeatureState=function(c,y){return this.style.removeFeatureState(c,y),this._update()},u.prototype.getFeatureState=function(c){return this.style.getFeatureState(c)},u.prototype.getContainer=function(){return this._container},u.prototype.getCanvasContainer=function(){return this._canvasContainer},u.prototype.getCanvas=function(){return this._canvas},u.prototype._containerDimensions=function(){var c=0,y=0;return this._container&&(c=this._container.clientWidth||400,y=this._container.clientHeight||300),[c,y]},u.prototype._setupContainer=function(){var c=this._container;c.classList.add("maplibregl-map");var y=this._canvasContainer=v.create("div","maplibregl-canvas-container",c);this._interactive&&y.classList.add("maplibregl-interactive"),this._canvas=v.create("canvas","maplibregl-canvas",y),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");var _=this._containerDimensions();this._resizeCanvas(_[0],_[1]);var x=this._controlContainer=v.create("div","maplibregl-control-container",c),S=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(A){S[A]=v.create("div","maplibregl-ctrl-"+A,x)}),this._container.addEventListener("scroll",this._onMapScroll,!1)},u.prototype._resizeCanvas=function(c,y){var _=i.browser.devicePixelRatio||1;this._canvas.width=_*c,this._canvas.height=_*y,this._canvas.style.width=c+"px",this._canvas.style.height=y+"px"},u.prototype._setupPainter=function(){var c=i.extend({},m.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),y=this._canvas.getContext("webgl",c)||this._canvas.getContext("experimental-webgl",c);y?(this.painter=new br(y,this.transform),i.webpSupported.testSupport(y)):this.fire(new i.ErrorEvent(new Error("Failed to initialize WebGL")))},u.prototype._contextLost=function(c){c.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new i.Event("webglcontextlost",{originalEvent:c}))},u.prototype._contextRestored=function(c){this._setupPainter(),this.resize(),this._update(),this.fire(new i.Event("webglcontextrestored",{originalEvent:c}))},u.prototype._onMapScroll=function(c){if(c.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},u.prototype.loaded=function(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()},u.prototype._update=function(c){return this.style?(this._styleDirty=this._styleDirty||c,this._sourcesDirty=!0,this.triggerRepaint(),this):this},u.prototype._requestRenderFrame=function(c){return this._update(),this._renderTaskQueue.add(c)},u.prototype._cancelRenderFrame=function(c){this._renderTaskQueue.remove(c)},u.prototype._render=function(c){var y,_=this,x=0,S=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(y=S.createQueryEXT(),S.beginQueryEXT(S.TIME_ELAPSED_EXT,y),x=i.browser.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(c),!this._removed){var A=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;var R=this.transform.zoom,G=i.browser.now();this.style.zoomHistory.update(R,G);var Z=new i.EvaluationParameters(R,{now:G,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),V=Z.crossFadingFactor();V===1&&V===this._crossFadingFactor||(A=!0,this._crossFadingFactor=V),this.style.update(Z)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new i.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new i.Event("load"))),this.style&&(this.style.hasTransitions()||A)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){var it=i.browser.now()-x;S.endQueryEXT(S.TIME_ELAPSED_EXT,y),setTimeout(function(){var tt=S.getQueryObjectEXT(y,S.QUERY_RESULT_EXT)/1e6;S.deleteQueryEXT(y),_.fire(new i.Event("gpu-timing-frame",{cpuTime:it,gpuTime:tt}))},50)}if(this.listens("gpu-timing-layer")){var et=this.painter.collectGpuTimers();setTimeout(function(){var tt=_.painter.queryGpuTimers(et);_.fire(new i.Event("gpu-timing-layer",{layerTimes:tt}))},50)}var ut=this._sourcesDirty||this._styleDirty||this._placementDirty;return ut||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new i.Event("idle")),!this._loaded||this._fullyLoaded||ut||(this._fullyLoaded=!0),this}},u.prototype.remove=function(){this._hash&&this._hash.remove();for(var c=0,y=this._controls;c<y.length;c+=1)y[c].onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),i.window!==void 0&&(i.window.removeEventListener("resize",this._onWindowResize,!1),i.window.removeEventListener("orientationchange",this._onWindowResize,!1),i.window.removeEventListener("online",this._onWindowOnline,!1));var _=this.painter.context.gl.getExtension("WEBGL_lose_context");_&&_.loseContext(),rc(this._canvasContainer),rc(this._controlContainer),this._container.classList.remove("maplibregl-map"),this._removed=!0,this.fire(new i.Event("remove"))},u.prototype.triggerRepaint=function(){var c=this;this.style&&!this._frame&&(this._frame=i.browser.frame(function(y){c._frame=null,c._render(y)}))},u.prototype._onWindowOnline=function(){this._update()},u.prototype._onWindowResize=function(c){this._trackResize&&this.resize({originalEvent:c})._update()},l.showTileBoundaries.get=function(){return!!this._showTileBoundaries},l.showTileBoundaries.set=function(c){this._showTileBoundaries!==c&&(this._showTileBoundaries=c,this._update())},l.showPadding.get=function(){return!!this._showPadding},l.showPadding.set=function(c){this._showPadding!==c&&(this._showPadding=c,this._update())},l.showCollisionBoxes.get=function(){return!!this._showCollisionBoxes},l.showCollisionBoxes.set=function(c){this._showCollisionBoxes!==c&&(this._showCollisionBoxes=c,c?this.style._generateCollisionBoxes():this._update())},l.showOverdrawInspector.get=function(){return!!this._showOverdrawInspector},l.showOverdrawInspector.set=function(c){this._showOverdrawInspector!==c&&(this._showOverdrawInspector=c,this._update())},l.repaint.get=function(){return!!this._repaint},l.repaint.set=function(c){this._repaint!==c&&(this._repaint=c,this.triggerRepaint())},l.vertices.get=function(){return!!this._vertices},l.vertices.set=function(c){this._vertices=c,this._update()},u.prototype._setCacheLimits=function(c,y){i.setCacheLimits(c,y)},l.version.get=function(){return i.version},Object.defineProperties(u.prototype,l),u}(Ie);function rc(a){a.parentNode&&a.parentNode.removeChild(a)}var bl={showCompass:!0,showZoom:!0,visualizePitch:!1},Uo=function(a){var u=this;this.options=i.extend({},bl,a),this._container=v.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",function(l){return l.preventDefault()}),this.options.showZoom&&(i.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",function(l){return u._map.zoomIn({},{originalEvent:l})}),v.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden",!0),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",function(l){return u._map.zoomOut({},{originalEvent:l})}),v.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden",!0)),this.options.showCompass&&(i.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass",function(l){u.options.visualizePitch?u._map.resetNorthPitch({},{originalEvent:l}):u._map.resetNorth({},{originalEvent:l})}),this._compassIcon=v.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden",!0))};Uo.prototype._updateZoomButtons=function(){var a=this._map.getZoom(),u=a===this._map.getMaxZoom(),l=a===this._map.getMinZoom();this._zoomInButton.disabled=u,this._zoomOutButton.disabled=l,this._zoomInButton.setAttribute("aria-disabled",u.toString()),this._zoomOutButton.setAttribute("aria-disabled",l.toString())},Uo.prototype._rotateCompassArrow=function(){var a=this.options.visualizePitch?"scale("+1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)+") rotateX("+this._map.transform.pitch+"deg) rotateZ("+this._map.transform.angle*(180/Math.PI)+"deg)":"rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassIcon.style.transform=a},Uo.prototype.onAdd=function(a){return this._map=a,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new On(this._map,this._compass,this.options.visualizePitch)),this._container},Uo.prototype.onRemove=function(){v.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map},Uo.prototype._createButton=function(a,u){var l=v.create("button",a,this._container);return l.type="button",l.addEventListener("click",u),l},Uo.prototype._setButtonTitle=function(a,u){var l=this._map._getUIString("NavigationControl."+u);a.title=l,a.setAttribute("aria-label",l)};var On=function(a,u,l){l===void 0&&(l=!1),this._clickTolerance=10,this.element=u,this.mouseRotate=new yu({clickTolerance:a.dragRotate._mouseRotate._clickTolerance}),this.map=a,l&&(this.mousePitch=new gu({clickTolerance:a.dragRotate._mousePitch._clickTolerance})),i.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),v.addEventListener(u,"mousedown",this.mousedown),v.addEventListener(u,"touchstart",this.touchstart,{passive:!1}),v.addEventListener(u,"touchmove",this.touchmove),v.addEventListener(u,"touchend",this.touchend),v.addEventListener(u,"touchcancel",this.reset)};function xu(a,u,l){if(a=new i.LngLat(a.lng,a.lat),u){var c=new i.LngLat(a.lng-360,a.lat),y=new i.LngLat(a.lng+360,a.lat),_=l.locationPoint(a).distSqr(u);l.locationPoint(c).distSqr(u)<_?a=c:l.locationPoint(y).distSqr(u)<_&&(a=y)}for(;Math.abs(a.lng-l.center.lng)>180;){var x=l.locationPoint(a);if(x.x>=0&&x.y>=0&&x.x<=l.width&&x.y<=l.height)break;a.lng>l.center.lng?a.lng-=360:a.lng+=360}return a}On.prototype.down=function(a,u){this.mouseRotate.mousedown(a,u),this.mousePitch&&this.mousePitch.mousedown(a,u),v.disableDrag()},On.prototype.move=function(a,u){var l=this.map,c=this.mouseRotate.mousemoveWindow(a,u);if(c&&c.bearingDelta&&l.setBearing(l.getBearing()+c.bearingDelta),this.mousePitch){var y=this.mousePitch.mousemoveWindow(a,u);y&&y.pitchDelta&&l.setPitch(l.getPitch()+y.pitchDelta)}},On.prototype.off=function(){var a=this.element;v.removeEventListener(a,"mousedown",this.mousedown),v.removeEventListener(a,"touchstart",this.touchstart,{passive:!1}),v.removeEventListener(a,"touchmove",this.touchmove),v.removeEventListener(a,"touchend",this.touchend),v.removeEventListener(a,"touchcancel",this.reset),this.offTemp()},On.prototype.offTemp=function(){v.enableDrag(),v.removeEventListener(i.window,"mousemove",this.mousemove),v.removeEventListener(i.window,"mouseup",this.mouseup)},On.prototype.mousedown=function(a){this.down(i.extend({},a,{ctrlKey:!0,preventDefault:function(){return a.preventDefault()}}),v.mousePos(this.element,a)),v.addEventListener(i.window,"mousemove",this.mousemove),v.addEventListener(i.window,"mouseup",this.mouseup)},On.prototype.mousemove=function(a){this.move(a,v.mousePos(this.element,a))},On.prototype.mouseup=function(a){this.mouseRotate.mouseupWindow(a),this.mousePitch&&this.mousePitch.mouseupWindow(a),this.offTemp()},On.prototype.touchstart=function(a){a.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=v.touchPos(this.element,a.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return a.preventDefault()}},this._startPos))},On.prototype.touchmove=function(a){a.targetTouches.length!==1?this.reset():(this._lastPos=v.touchPos(this.element,a.targetTouches)[0],this.move({preventDefault:function(){return a.preventDefault()}},this._lastPos))},On.prototype.touchend=function(a){a.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()},On.prototype.reset=function(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()};var Za={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%)"};function Go(a,u,l){var c=a.classList;for(var y in Za)c.remove("maplibregl-"+l+"-anchor-"+y);c.add("maplibregl-"+l+"-anchor-"+u)}var Ds,wl=function(a){function u(l,c){if(a.call(this),(l instanceof i.window.HTMLElement||c)&&(l=i.extend({element:l},c)),i.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=l&&l.anchor||"center",this._color=l&&l.color||"#3FB1CE",this._scale=l&&l.scale||1,this._draggable=l&&l.draggable||!1,this._clickTolerance=l&&l.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=l&&l.rotation||0,this._rotationAlignment=l&&l.rotationAlignment||"auto",this._pitchAlignment=l&&l.pitchAlignment&&l.pitchAlignment!=="auto"?l.pitchAlignment:this._rotationAlignment,l&&l.element)this._element=l.element,this._offset=i.Point.convert(l&&l.offset||[0,0]);else{this._defaultMarker=!0,this._element=v.create("div"),this._element.setAttribute("aria-label","Map marker");var y=v.createNS("http://www.w3.org/2000/svg","svg");y.setAttributeNS(null,"display","block"),y.setAttributeNS(null,"height","41px"),y.setAttributeNS(null,"width","27px"),y.setAttributeNS(null,"viewBox","0 0 27 41");var _=v.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"stroke","none"),_.setAttributeNS(null,"stroke-width","1"),_.setAttributeNS(null,"fill","none"),_.setAttributeNS(null,"fill-rule","evenodd");var x=v.createNS("http://www.w3.org/2000/svg","g");x.setAttributeNS(null,"fill-rule","nonzero");var S=v.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"transform","translate(3.0, 29.0)"),S.setAttributeNS(null,"fill","#000000");for(var A=0,R=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];A<R.length;A+=1){var G=R[A],Z=v.createNS("http://www.w3.org/2000/svg","ellipse");Z.setAttributeNS(null,"opacity","0.04"),Z.setAttributeNS(null,"cx","10.5"),Z.setAttributeNS(null,"cy","5.80029008"),Z.setAttributeNS(null,"rx",G.rx),Z.setAttributeNS(null,"ry",G.ry),S.appendChild(Z)}var V=v.createNS("http://www.w3.org/2000/svg","g");V.setAttributeNS(null,"fill",this._color);var it=v.createNS("http://www.w3.org/2000/svg","path");it.setAttributeNS(null,"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"),V.appendChild(it);var et=v.createNS("http://www.w3.org/2000/svg","g");et.setAttributeNS(null,"opacity","0.25"),et.setAttributeNS(null,"fill","#000000");var ut=v.createNS("http://www.w3.org/2000/svg","path");ut.setAttributeNS(null,"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"),et.appendChild(ut);var tt=v.createNS("http://www.w3.org/2000/svg","g");tt.setAttributeNS(null,"transform","translate(6.0, 7.0)"),tt.setAttributeNS(null,"fill","#FFFFFF");var lt=v.createNS("http://www.w3.org/2000/svg","g");lt.setAttributeNS(null,"transform","translate(8.0, 8.0)");var yt=v.createNS("http://www.w3.org/2000/svg","circle");yt.setAttributeNS(null,"fill","#000000"),yt.setAttributeNS(null,"opacity","0.25"),yt.setAttributeNS(null,"cx","5.5"),yt.setAttributeNS(null,"cy","5.5"),yt.setAttributeNS(null,"r","5.4999962");var _t=v.createNS("http://www.w3.org/2000/svg","circle");_t.setAttributeNS(null,"fill","#FFFFFF"),_t.setAttributeNS(null,"cx","5.5"),_t.setAttributeNS(null,"cy","5.5"),_t.setAttributeNS(null,"r","5.4999962"),lt.appendChild(yt),lt.appendChild(_t),x.appendChild(S),x.appendChild(V),x.appendChild(et),x.appendChild(tt),x.appendChild(lt),y.appendChild(x),y.setAttributeNS(null,"height",41*this._scale+"px"),y.setAttributeNS(null,"width",27*this._scale+"px"),this._element.appendChild(y),this._offset=i.Point.convert(l&&l.offset||[0,-14])}this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",function(It){It.preventDefault()}),this._element.addEventListener("mousedown",function(It){It.preventDefault()}),Go(this._element,this._anchor,"marker"),this._popup=null}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.addTo=function(l){return this.remove(),this._map=l,l.getCanvasContainer().appendChild(this._element),l.on("move",this._update),l.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this},u.prototype.remove=function(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),v.remove(this._element),this._popup&&this._popup.remove(),this},u.prototype.getLngLat=function(){return this._lngLat},u.prototype.setLngLat=function(l){return this._lngLat=i.LngLat.convert(l),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this},u.prototype.getElement=function(){return this._element},u.prototype.setPopup=function(l){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),l){if(!("offset"in l.options)){var c=Math.sqrt(Math.pow(13.5,2)/2);l.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[c,-1*(24.6+c)],"bottom-right":[-c,-1*(24.6+c)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=l,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this},u.prototype._onKeyPress=function(l){var c=l.code,y=l.charCode||l.keyCode;c!=="Space"&&c!=="Enter"&&y!==32&&y!==13||this.togglePopup()},u.prototype._onMapClick=function(l){var c=l.originalEvent.target,y=this._element;this._popup&&(c===y||y.contains(c))&&this.togglePopup()},u.prototype.getPopup=function(){return this._popup},u.prototype.togglePopup=function(){var l=this._popup;return l?(l.isOpen()?l.remove():l.addTo(this._map),this):this},u.prototype._update=function(l){if(this._map){this._map.transform.renderWorldCopies&&(this._lngLat=xu(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);var c="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?c="rotateZ("+this._rotation+"deg)":this._rotationAlignment==="map"&&(c="rotateZ("+(this._rotation-this._map.getBearing())+"deg)");var y="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?y="rotateX(0deg)":this._pitchAlignment==="map"&&(y="rotateX("+this._map.getPitch()+"deg)"),l&&l.type!=="moveend"||(this._pos=this._pos.round()),v.setTransform(this._element,Za[this._anchor]+" translate("+this._pos.x+"px, "+this._pos.y+"px) "+y+" "+c)}},u.prototype.getOffset=function(){return this._offset},u.prototype.setOffset=function(l){return this._offset=i.Point.convert(l),this._update(),this},u.prototype._onMove=function(l){if(!this._isDragging){var c=this._clickTolerance||this._map._clickTolerance;this._isDragging=l.point.dist(this._pointerdownPos)>=c}this._isDragging&&(this._pos=l.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new i.Event("dragstart"))),this.fire(new i.Event("drag")))},u.prototype._onUp=function(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new i.Event("dragend")),this._state="inactive"},u.prototype._addDragHandler=function(l){this._element.contains(l.originalEvent.target)&&(l.preventDefault(),this._positionDelta=l.point.sub(this._pos).add(this._offset),this._pointerdownPos=l.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},u.prototype.setDraggable=function(l){return this._draggable=!!l,this._map&&(l?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this},u.prototype.isDraggable=function(){return this._draggable},u.prototype.setRotation=function(l){return this._rotation=l||0,this._update(),this},u.prototype.getRotation=function(){return this._rotation},u.prototype.setRotationAlignment=function(l){return this._rotationAlignment=l||"auto",this._update(),this},u.prototype.getRotationAlignment=function(){return this._rotationAlignment},u.prototype.setPitchAlignment=function(l){return this._pitchAlignment=l&&l!=="auto"?l:this._rotationAlignment,this._update(),this},u.prototype.getPitchAlignment=function(){return this._pitchAlignment},u}(i.Evented),ic={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Sl=0,pa=!1,nc=function(a){function u(l){a.call(this),this.options=i.extend({},ic,l),i.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.onAdd=function(l){var c;return this._map=l,this._container=v.create("div","maplibregl-ctrl maplibregl-ctrl-group"),c=this._setupUI,Ds!==void 0?c(Ds):i.window.navigator.permissions!==void 0?i.window.navigator.permissions.query({name:"geolocation"}).then(function(y){c(Ds=y.state!=="denied")}):c(Ds=!!i.window.navigator.geolocation),this._container},u.prototype.onRemove=function(){this._geolocationWatchID!==void 0&&(i.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),v.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Sl=0,pa=!1},u.prototype._isOutOfMapMaxBounds=function(l){var c=this._map.getMaxBounds(),y=l.coords;return c&&(y.longitude<c.getWest()||y.longitude>c.getEast()||y.latitude<c.getSouth()||y.latitude>c.getNorth())},u.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting")}},u.prototype._onSuccess=function(l){if(this._map){if(this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new i.Event("outofmaxbounds",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(l),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(l),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new i.Event("geolocate",l)),this._finish()}},u.prototype._updateCamera=function(l){var c=new i.LngLat(l.coords.longitude,l.coords.latitude),y=l.coords.accuracy,_=this._map.getBearing(),x=i.extend({bearing:_},this.options.fitBoundsOptions);this._map.fitBounds(c.toBounds(y),x,{geolocateSource:!0})},u.prototype._updateMarker=function(l){if(l){var c=new i.LngLat(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(c).addTo(this._map),this._userLocationDotMarker.setLngLat(c).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},u.prototype._updateCircleRadius=function(){var l=this._map._container.clientHeight/2,c=this._map.unproject([0,l]),y=this._map.unproject([1,l]),_=c.distanceTo(y),x=Math.ceil(2*this._accuracy/_);this._circleElement.style.width=x+"px",this._circleElement.style.height=x+"px"},u.prototype._onZoom=function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},u.prototype._onError=function(l){if(this._map){if(this.options.trackUserLocation)if(l.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var c=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=c,this._geolocateButton.setAttribute("aria-label",c),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&pa)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new i.Event("error",l)),this._finish()}},u.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},u.prototype._setupUI=function(l){var c=this;if(this._container.addEventListener("contextmenu",function(x){return x.preventDefault()}),this._geolocateButton=v.create("button","maplibregl-ctrl-geolocate",this._container),v.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",l===!1){i.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var y=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=y,this._geolocateButton.setAttribute("aria-label",y)}else{var _=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=_,this._geolocateButton.setAttribute("aria-label",_)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=v.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new wl(this._dotElement),this._circleElement=v.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new wl({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",function(x){x.geolocateSource||c._watchState!=="ACTIVE_LOCK"||x.originalEvent&&x.originalEvent.type==="resize"||(c._watchState="BACKGROUND",c._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),c._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),c.fire(new i.Event("trackuserlocationend")))})},u.prototype.trigger=function(){if(!this._setup)return i.warnOnce("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 i.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Sl--,pa=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new i.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){var l;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++Sl>1?(l={maximumAge:6e5,timeout:0},pa=!0):(l=this.options.positionOptions,pa=!1),this._geolocationWatchID=i.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,l)}}else i.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0},u.prototype._clearWatch=function(){i.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},u}(i.Evented),oc={maxWidth:100,unit:"metric"},Hn=function(a){this.options=i.extend({},oc,a),i.bindAll(["_onMove","setUnit"],this)};function bu(a,u,l){var c=l&&l.maxWidth||100,y=a._container.clientHeight/2,_=a.unproject([0,y]),x=a.unproject([c,y]),S=_.distanceTo(x);if(l&&l.unit==="imperial"){var A=3.2808*S;A>5280?Xa(u,c,A/5280,a._getUIString("ScaleControl.Miles")):Xa(u,c,A,a._getUIString("ScaleControl.Feet"))}else l&&l.unit==="nautical"?Xa(u,c,S/1852,a._getUIString("ScaleControl.NauticalMiles")):S>=1e3?Xa(u,c,S/1e3,a._getUIString("ScaleControl.Kilometers")):Xa(u,c,S,a._getUIString("ScaleControl.Meters"))}function Xa(a,u,l,c){var y,_,x,S=(y=l,(_=Math.pow(10,(""+Math.floor(y)).length-1))*(x=(x=y/_)>=10?10:x>=5?5:x>=3?3:x>=2?2:x>=1?1:function(A){var R=Math.pow(10,Math.ceil(-Math.log(A)/Math.LN10));return Math.round(A*R)/R}(x)));a.style.width=u*(S/l)+"px",a.innerHTML=S+" "+c}Hn.prototype.getDefaultPosition=function(){return"bottom-left"},Hn.prototype._onMove=function(){bu(this._map,this._container,this.options)},Hn.prototype.onAdd=function(a){return this._map=a,this._container=v.create("div","maplibregl-ctrl maplibregl-ctrl-scale",a.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},Hn.prototype.onRemove=function(){v.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},Hn.prototype.setUnit=function(a){this.options.unit=a,bu(this._map,this._container,this.options)};var Zn=function(a){this._fullscreen=!1,a&&a.container&&(a.container instanceof i.window.HTMLElement?this._container=a.container:i.warnOnce("Full screen control 'container' must be a DOM element.")),i.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in i.window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in i.window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in i.window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in i.window.document&&(this._fullscreenchange="MSFullscreenChange")};Zn.prototype.onAdd=function(a){return this._map=a,this._container||(this._container=this._map.getContainer()),this._controlContainer=v.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},Zn.prototype.onRemove=function(){v.remove(this._controlContainer),this._map=null,i.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},Zn.prototype._checkFullscreenSupport=function(){return!!(i.window.document.fullscreenEnabled||i.window.document.mozFullScreenEnabled||i.window.document.msFullscreenEnabled||i.window.document.webkitFullscreenEnabled)},Zn.prototype._setupUI=function(){var a=this._fullscreenButton=v.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);v.create("span","maplibregl-ctrl-icon",a).setAttribute("aria-hidden",!0),a.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),i.window.document.addEventListener(this._fullscreenchange,this._changeIcon)},Zn.prototype._updateTitle=function(){var a=this._getTitle();this._fullscreenButton.setAttribute("aria-label",a),this._fullscreenButton.title=a},Zn.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},Zn.prototype._isFullscreen=function(){return this._fullscreen},Zn.prototype._changeIcon=function(){(i.window.document.fullscreenElement||i.window.document.mozFullScreenElement||i.window.document.webkitFullscreenElement||i.window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle())},Zn.prototype._onClickFullscreen=function(){this._isFullscreen()?i.window.document.exitFullscreen?i.window.document.exitFullscreen():i.window.document.mozCancelFullScreen?i.window.document.mozCancelFullScreen():i.window.document.msExitFullscreen?i.window.document.msExitFullscreen():i.window.document.webkitCancelFullScreen&&i.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()};var ac={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},sc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),El=function(a){function u(l){a.call(this),this.options=i.extend(Object.create(ac),l),i.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}return a&&(u.__proto__=a),(u.prototype=Object.create(a&&a.prototype)).constructor=u,u.prototype.addTo=function(l){return this._map&&this.remove(),this._map=l,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new i.Event("open")),this},u.prototype.isOpen=function(){return!!this._map},u.prototype.remove=function(){return this._content&&v.remove(this._content),this._container&&(v.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new i.Event("close")),this},u.prototype.getLngLat=function(){return this._lngLat},u.prototype.setLngLat=function(l){return this._lngLat=i.LngLat.convert(l),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this},u.prototype.trackPointer=function(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this},u.prototype.getElement=function(){return this._container},u.prototype.setText=function(l){return this.setDOMContent(i.window.document.createTextNode(l))},u.prototype.setHTML=function(l){var c,y=i.window.document.createDocumentFragment(),_=i.window.document.createElement("body");for(_.innerHTML=l;c=_.firstChild;)y.appendChild(c);return this.setDOMContent(y)},u.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},u.prototype.setMaxWidth=function(l){return this.options.maxWidth=l,this._update(),this},u.prototype.setDOMContent=function(l){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=v.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(l),this._createCloseButton(),this._update(),this._focusFirstElement(),this},u.prototype.addClassName=function(l){this._container&&this._container.classList.add(l)},u.prototype.removeClassName=function(l){this._container&&this._container.classList.remove(l)},u.prototype.setOffset=function(l){return this.options.offset=l,this._update(),this},u.prototype.toggleClassName=function(l){if(this._container)return this._container.classList.toggle(l)},u.prototype._createCloseButton=function(){this.options.closeButton&&(this._closeButton=v.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))},u.prototype._onMouseUp=function(l){this._update(l.point)},u.prototype._onMouseMove=function(l){this._update(l.point)},u.prototype._onDrag=function(l){this._update(l.point)},u.prototype._update=function(l){var c=this;if(this._map&&(this._lngLat||this._trackPointer)&&this._content&&(this._container||(this._container=v.create("div","maplibregl-popup",this._map.getContainer()),this._tip=v.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(function(Z){return c._container.classList.add(Z)}),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=xu(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||l)){var y=this._pos=this._trackPointer&&l?l:this._map.project(this._lngLat),_=this.options.anchor,x=function Z(V){if(V){if(typeof V=="number"){var it=Math.round(Math.sqrt(.5*Math.pow(V,2)));return{center:new i.Point(0,0),top:new i.Point(0,V),"top-left":new i.Point(it,it),"top-right":new i.Point(-it,it),bottom:new i.Point(0,-V),"bottom-left":new i.Point(it,-it),"bottom-right":new i.Point(-it,-it),left:new i.Point(V,0),right:new i.Point(-V,0)}}if(V instanceof i.Point||Array.isArray(V)){var et=i.Point.convert(V);return{center:et,top:et,"top-left":et,"top-right":et,bottom:et,"bottom-left":et,"bottom-right":et,left:et,right:et}}return{center:i.Point.convert(V.center||[0,0]),top:i.Point.convert(V.top||[0,0]),"top-left":i.Point.convert(V["top-left"]||[0,0]),"top-right":i.Point.convert(V["top-right"]||[0,0]),bottom:i.Point.convert(V.bottom||[0,0]),"bottom-left":i.Point.convert(V["bottom-left"]||[0,0]),"bottom-right":i.Point.convert(V["bottom-right"]||[0,0]),left:i.Point.convert(V.left||[0,0]),right:i.Point.convert(V.right||[0,0])}}return Z(new i.Point(0,0))}(this.options.offset);if(!_){var S,A=this._container.offsetWidth,R=this._container.offsetHeight;S=y.y+x.bottom.y<R?["top"]:y.y>this._map.transform.height-R?["bottom"]:[],y.x<A/2?S.push("left"):y.x>this._map.transform.width-A/2&&S.push("right"),_=S.length===0?"bottom":S.join("-")}var G=y.add(x[_]).round();v.setTransform(this._container,Za[_]+" translate("+G.x+"px,"+G.y+"px)"),Go(this._container,_,"popup")}},u.prototype._focusFirstElement=function(){if(this.options.focusAfterOpen&&this._container){var l=this._container.querySelector(sc);l&&l.focus()}},u.prototype._onClose=function(){this.remove()},u}(i.Evented),wu={version:i.version,supported:m,setRTLTextPlugin:i.setRTLTextPlugin,getRTLTextPluginStatus:i.getRTLTextPluginStatus,Map:Gi,NavigationControl:Uo,GeolocateControl:nc,AttributionControl:zn,ScaleControl:Hn,FullscreenControl:Zn,Popup:El,Marker:wl,Style:No,LngLat:i.LngLat,LngLatBounds:i.LngLatBounds,Point:i.Point,MercatorCoordinate:i.MercatorCoordinate,Evented:i.Evented,config:i.config,prewarm:function(){ge().acquire(wt)},clearPrewarmedResources:function(){var a=ne;a&&(a.isPreloaded()&&a.numActive()===1?(a.release(wt),ne=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()"))},get accessToken(){return i.config.ACCESS_TOKEN},set accessToken(a){i.config.ACCESS_TOKEN=a},get baseApiUrl(){return i.config.API_URL},set baseApiUrl(a){i.config.API_URL=a},get workerCount(){return Ft.workerCount},set workerCount(a){Ft.workerCount=a},get maxParallelImageRequests(){return i.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(a){i.config.MAX_PARALLEL_IMAGE_REQUESTS=a},clearStorage:function(a){i.clearTileCache(a)},workerUrl:"",addProtocol:function(a,u){i.config.REGISTERED_PROTOCOLS[a]=u},removeProtocol:function(a){delete i.config.REGISTERED_PROTOCOLS[a]}};return wu}),s})});E();go();E();go();E();E();E();function Ol(r){var n=new Error(r);return n.source="ulid",n}var Ff="0123456789ABCDEFGHJKMNPQRSTVWXYZ",$u=Ff.length,Km=Math.pow(2,48)-1,Hm=10,v0=16;function JS(r){var n=Math.floor(r()*$u);return n===$u&&(n=$u-1),Ff.charAt(n)}function QS(r,n){if(isNaN(r))throw new Error(r+" must be a number");if(r>Km)throw Ol("cannot encode time greater than "+Km);if(r<0)throw Ol("time must be positive");if(Number.isInteger(r)===!1)throw Ol("time must be an integer");for(var s=void 0,p="";n>0;n--)s=r%$u,p=Ff.charAt(s)+p,r=(r-s)/$u;return p}function $S(r,n){for(var s="";r>0;r--)s=JS(n)+s;return s}function _0(r){if(r.length!==Hm+v0)throw Ol("malformed ulid");var n=r.substr(0,Hm).split("").reverse().reduce(function(s,p,i){var m=Ff.indexOf(p);if(m===-1)throw Ol("invalid character found: "+p);return s+=m*Math.pow($u,i)},0);if(n>Km)throw Ol("malformed ulid, timestamp too large");return n}function tE(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n=arguments[1];n||(n=typeof window<"u"?window:null);var s=n&&(n.crypto||n.msCrypto);if(s)return function(){var i=new Uint8Array(1);return s.getRandomValues(i),i[0]/255};try{var p=g0();return function(){return p.randomBytes(1).readUInt8()/255}}catch{}if(r){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return function(){return Math.random()}}throw Ol("secure crypto unusable, insecure Math.random not allowed")}function eE(r){return r||(r=tE()),function(s){return isNaN(s)&&(s=Date.now()),QS(s,Hm)+$S(v0,r)}}var x0=eE();var b0=()=>typeof localStorage<"u",rE=24*60*60*1e3,iE=30*rE;function Dc(){let r="c"+x0().toLowerCase();return b0()&&localStorage.setItem("api-key",r),r}function w0(){if(!b0())return Dc();let r=localStorage.getItem("api-key");if(r==null||!r.startsWith("c"))return Dc();try{let n=_0(r.slice(1).toUpperCase());return Date.now()-iE<n?r:Dc()}catch{return Dc()}}E();E();E();var Di=class{constructor(n,s,p,i){this.x=n,this.y=s,this.width=p,this.height=i}get bottom(){return this.y+this.height}get right(){return this.x+this.width}intersects(n){return this.x<n.right&&n.x<this.right&&this.y<n.bottom&&n.y<this.bottom}containsBounds(n){return Di.contains(this,n)}intersection(n){let s=Math.max(this.x,n.x),p=Math.min(this.x+this.width,n.x+n.width),i=Math.max(this.y,n.y),m=Math.min(this.y+this.height,n.y+n.height);return p>s&&m>i?new Di(s,i,p-s,m-i):null}static union(n){if(n.length===0)throw new Error("Union on empty list is not allowed");let{x:s,y:p}=n[0],i=s+n[0].width,m=p+n[0].height;for(let v=1;v<n.length;++v){let b=n[v];s=Math.min(s,b.x),i=Math.max(i,b.x+b.width),p=Math.min(p,b.y),m=Math.max(m,b.y+b.height)}return new Di(s,p,i-s,m-p)}union(n){return Di.union([this,n])}toJson(){return{x:this.x,y:this.y,width:this.width,height:this.height}}toBbox(){return[this.x,this.y,this.right,this.bottom]}toPolygon(){return[[[this.x,this.y],[this.x,this.bottom],[this.right,this.bottom],[this.right,this.y],[this.x,this.y]]]}scale(n,s=n){return new Di(this.x*n,this.y*s,this.width*n,this.height*s)}scaleFromCenter(n,s=n){let p=this.width*n,i=this.height*s;return new Di(this.x-.5*(p-this.width),this.y-.5*(i-this.height),p,i)}pad(n,s=n){return new Di(this.x-n,this.y-s,this.width+n*2,this.height+s*2)}round(n=0){let s=Math.round(this.x-n),p=Math.round(this.y-n);return new Di(s,p,Math.round(this.right+n)-s,Math.round(this.bottom+n)-p)}add(n){return new Di(this.x+n.x,this.y+n.y,this.width,this.height)}subtract(n){return new Di(this.x-n.x,this.y-n.y,this.width,this.height)}static fromMultiPolygon(n){if(n.length===0)return new Di(0,0,0,0);let s=n[0][0][0][0],p=n[0][0][0][1],i=s,m=p;for(let[v]of n)for(let[b,M]of v)b<s?s=b:b>i&&(i=b),M<p?p=M:M>m&&(m=M);return new Di(s,p,i-s,m-p)}static fromBbox([n,s,p,i]){return new Di(Math.min(n,p),Math.min(s,i),Math.abs(p-n),Math.abs(i-s))}static fromUpperLeftLowerRight(n,s){return new Di(n.x,n.y,s.x-n.x,s.y-n.y)}static fromJson(n){return new Di(n.x,n.y,n.width,n.height)}static compareArea(n,s){let p=n.width*n.height-s.width*s.height;if(p!==0)return p;let i=n.x-s.x;return i===0?n.y-s.y:i}static contains(n,s){return n.x<=s.x&&n.x+n.width>=s.x+s.width&&n.y<=s.y&&n.y+n.height>=s.y+s.height}};E();var Dr;(function(r){r[r.Google=3857]="Google",r[r.Wgs84=4326]="Wgs84",r[r.Nztm2000=2193]="Nztm2000",r[r.Citm2000=3793]="Citm2000"})(Dr||(Dr={}));var Zm={google:Dr.Google,epsg3857:Dr.Google,[Dr.Google]:Dr.Google,globalmercator:Dr.Google,wgs84:Dr.Wgs84,epsg4326:Dr.Wgs84,[Dr.Wgs84]:Dr.Wgs84,nztm:Dr.Nztm2000,epsg2193:Dr.Nztm2000,[Dr.Nztm2000]:Dr.Nztm2000,nztm2000:Dr.Nztm2000,citm:Dr.Citm2000,epsg3793:Dr.Citm2000,[Dr.Citm2000]:Dr.Citm2000,citm2000:Dr.Citm2000},pr=class{constructor(n){if(this.code=n,pr.Codes.has(n))throw new Error(`Duplicate EPSG code created: ${n}`);pr.Codes.set(this.code,this)}toString(){return this.code.toString()}toJSON(){return this.code}toEpsgString(){return`EPSG:${this.code}`}toUrn(){return`urn:ogc:def:crs:EPSG::${this.code}`}static get(n){let s=pr.Codes.get(n);if(s==null)throw new Error(`Invalid EPSG:${n}`);return s}static tryGet(n){if(n!=null)return pr.Codes.get(n)}static parseCode(n){var s;return n.startsWith("urn:")?Zm[n.slice(n.lastIndexOf(":")+1)]:n.startsWith("https://")?Zm[n.slice(n.lastIndexOf("/")+1)]:(s=Zm[n.replace(/[\W_]/g,"").toLowerCase()])!==null&&s!==void 0?s:null}static parse(n){let s=pr.parseCode(n);return s==null?null:pr.get(s)}};pr.Codes=new Map;pr.Google=new pr(Dr.Google);pr.Wgs84=new pr(Dr.Wgs84);pr.Nztm2000=new pr(Dr.Nztm2000);pr.Citm2000=new pr(Dr.Citm2000);E();var oL="0".charCodeAt(0),aL="1".charCodeAt(0),sL="2".charCodeAt(0),lL="3".charCodeAt(0);E();E();var th;(function(r){r[r.Xy=0]="Xy",r[r.Yx=1]="Yx"})(th||(th={}));function S0(r){return r===pr.Nztm2000?th.Yx:th.Xy}function nE(r,n){return n.scaleDenominator-r.scaleDenominator}var qs=class{constructor(n){this.zooms=[],this.indexX=0,this.indexY=1,this.zoomConversionMap=new Map,this.def=n,this.tileSize=n.tileMatrix[0].tileHeight;let s=n.tileMatrix.slice().sort(nE),p={};for(let z of s){if(p[z.identifier])throw new Error(`Duplicate tileMatrix identifier ${z.identifier}`);if(z.tileHeight!==z.tileWidth)throw new Error("Only square tiles supported");if(z.tileHeight!==this.tileSize)throw new Error("All tiles must have the same tile size");p[z.identifier]=!0}this.zooms=s;let i=pr.parse(n.supportedCRS);if(i==null)throw new Error(`Unable to find supported projection ${n.supportedCRS}`);this.projection=i,S0(this.projection)===th.Yx&&(this.indexX=1,this.indexY=0);let{lowerCorner:m,upperCorner:v}=n.boundingBox,b=m[this.indexX],M=m[this.indexY];this.extent=new Di(b,M,v[this.indexX]-b,v[this.indexY]-M)}get maxZoom(){return this.zooms.length-1}get identifier(){return this.def.identifier}pixelScale(n){let s=this.zooms[n];if(s==null)throw new Error(`Zoom not found :${n}`);return s.scaleDenominator*28e-5}tileToPixels(n,s){return{x:n*this.tileSize,y:s*this.tileSize}}pixelsToTile(n,s,p){let i=Math.floor(n/this.tileSize),m=Math.floor(s/this.tileSize);return{x:i,y:m,z:p}}sourceToPixels(n,s,p){let i=this.zooms[p],m=this.pixelScale(p),v=(n-i.topLeftCorner[this.indexX])/m,b=(i.topLeftCorner[this.indexY]-s)/m;return{x:v,y:b}}pixelsToSource(n,s,p){let i=this.zooms[p],m=this.pixelScale(p),v=i.topLeftCorner[this.indexX]+n*m,b=i.topLeftCorner[this.indexY]-s*m;return{x:v,y:b}}tileToSource(n){let s=this.tileToPixels(n.x,n.y);return this.pixelsToSource(s.x,s.y,n.z)}tileToSourceBounds(n){let s=this.tileToSource(n),p=this.pixelScale(n.z)*this.tileSize;return new Di(s.x,s.y-p,p,p)}*topLevelTiles(){let{matrixWidth:s,matrixHeight:p}=this.zooms[0];for(let i=0;i<p;++i)for(let m=0;m<s;++m)yield{x:m,y:i,z:0};return null}*coverTile(n){if(n==null)return yield*this.topLevelTiles(),null;let s=n.z+1,{matrixWidth:p,matrixHeight:i}=this.zooms[n.z],{matrixWidth:m,matrixHeight:v}=this.zooms[s],b=m/p,M=v/i,z=Math.floor(n.x*b),C=Math.floor(n.y*M),j=Math.ceil((n.x+1)*b),Y=Math.ceil((n.y+1)*M);for(let ot=C;ot<Y;++ot)for(let J=z;J<j;++J)yield{x:J,y:ot,z:s};return null}static tileToName(n){return`${n.z}-${n.x}-${n.y}`}static nameToTile(n){let s=n.split("-");if(s.length===3){let p=Number(s[0]),i=Number(s[1]),m=Number(s[2]);if(!(isNaN(p)||isNaN(m)||isNaN(i)))return{x:i,y:m,z:p}}throw new Error(`Invalid tile name '${n}'`)}findBestZoom(n){let s=this.zoomConversionMap.get(n);return s==null&&(s=this.convertZoomLevel(n),this.zoomConversionMap.set(n,s)),s}convertZoomLevel(n){for(let s=0;s<this.zooms.length;s++){let p=this.zooms[s].scaleDenominator-n;if(p>1e-5)continue;if(s===0)return s;let i=this.zooms[s-1].scaleDenominator-n;return Math.abs(p)<i?s:s-1}return this.maxZoom}static convertZoomLevel(n,s,p,i=!0){return s.identifier===p.identifier||(n>=s.maxZoom&&(n=s.maxZoom),i&&n===0)?n:i&&n===s.maxZoom?p.maxZoom:p.findBestZoom(s.zooms[n].scaleDenominator)}};E();var E0={Version:"1.0.0-beta.2",License:"CC BY 4.0",BaseMapsExtension:"https://basemaps.linz.govt.nz/json-schema/stac-basemaps-extension/1.0/schema.json"};E();E();var oE={type:"TileMatrixSetType",title:"Google Maps Compatible for the World",identifier:"WebMercatorQuad",boundingBox:{type:"BoundingBoxType",crs:"http://www.opengis.net/def/crs/EPSG/0/3857",lowerCorner:[-200375083427892e-7,-200375083427892e-7],upperCorner:[200375083427892e-7,200375083427892e-7]},supportedCRS:"https://www.opengis.net/def/crs/EPSG/0/3857",wellKnownScaleSet:"https://www.opengis.net/def/wkss/OGC/1.0/GoogleMapsCompatible",tileMatrix:[{type:"TileMatrixType",identifier:"0",scaleDenominator:559082264028717e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1,matrixHeight:1},{type:"TileMatrixType",identifier:"1",scaleDenominator:279541132014358e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2,matrixHeight:2},{type:"TileMatrixType",identifier:"2",scaleDenominator:139770566007179e-6,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4,matrixHeight:4},{type:"TileMatrixType",identifier:"3",scaleDenominator:698852830035897e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8,matrixHeight:8},{type:"TileMatrixType",identifier:"4",scaleDenominator:349426415017948e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16,matrixHeight:16},{type:"TileMatrixType",identifier:"5",scaleDenominator:174713207508974e-7,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:32,matrixHeight:32},{type:"TileMatrixType",identifier:"6",scaleDenominator:873566037544871e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:64,matrixHeight:64},{type:"TileMatrixType",identifier:"7",scaleDenominator:436783018772435e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:128,matrixHeight:128},{type:"TileMatrixType",identifier:"8",scaleDenominator:218391509386217e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:256,matrixHeight:256},{type:"TileMatrixType",identifier:"9",scaleDenominator:109195754693108e-8,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:512,matrixHeight:512},{type:"TileMatrixType",identifier:"10",scaleDenominator:545978.773465544,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1024,matrixHeight:1024},{type:"TileMatrixType",identifier:"11",scaleDenominator:272989.386732772,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2048,matrixHeight:2048},{type:"TileMatrixType",identifier:"12",scaleDenominator:136494.693366386,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4096,matrixHeight:4096},{type:"TileMatrixType",identifier:"13",scaleDenominator:68247.346683193,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8192,matrixHeight:8192},{type:"TileMatrixType",identifier:"14",scaleDenominator:34123.6733415964,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16384,matrixHeight:16384},{type:"TileMatrixType",identifier:"15",scaleDenominator:17061.8366707982,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:32768,matrixHeight:32768},{type:"TileMatrixType",identifier:"16",scaleDenominator:8530.91833539913,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:65536,matrixHeight:65536},{type:"TileMatrixType",identifier:"17",scaleDenominator:4265.45916769956,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:131072,matrixHeight:131072},{type:"TileMatrixType",identifier:"18",scaleDenominator:2132.72958384978,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:262144,matrixHeight:262144},{type:"TileMatrixType",identifier:"19",scaleDenominator:1066.36479192489,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:524288,matrixHeight:524288},{type:"TileMatrixType",identifier:"20",scaleDenominator:533.182395962445,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:1048576,matrixHeight:1048576},{type:"TileMatrixType",identifier:"21",scaleDenominator:266.591197981222,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:2097152,matrixHeight:2097152},{type:"TileMatrixType",identifier:"22",scaleDenominator:133.295598990611,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:4194304,matrixHeight:4194304},{type:"TileMatrixType",identifier:"23",scaleDenominator:66.6477994953056,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:8388608,matrixHeight:8388608},{type:"TileMatrixType",identifier:"24",scaleDenominator:33.3238997476528,topLeftCorner:[-200375083427892e-7,200375083427892e-7],tileWidth:256,tileHeight:256,matrixWidth:16777216,matrixHeight:16777216}]},Or=new qs(oE);E();var Gf=zr(I0(),1),ns=new qs(Gf.Nztm2000),ba=new qs(Gf.Nztm2000Quad);var Ws={All:[Or,ns,ba],Defaults:new Map([[pr.Google.code,Or],[pr.Nztm2000.code,ns]]),get(r){let n=this.tryGet(r);if(n==null)throw new Error("Failed to lookup TileMatrixSet: "+r);return n},tryGet(r){var n,s;return r==null?null:typeof r=="number"?(n=this.Defaults.get(r))!==null&&n!==void 0?n:null:(s=this.Defaults.get(r.code))!==null&&s!==void 0?s:null},find(r){if(r==null)return null;let n=pr.parse(r);if(n!=null)return Ws.tryGet(n);for(let s of Ws.All)if(s.identifier===r)return s;return null}};E();var Xm;(function(r){r.Png="png",r.Jpeg="jpeg",r.Webp="webp",r.Avif="avif"})(Xm||(Xm={}));var Ym;(function(r){r.MapboxVectorTiles="pbf"})(Ym||(Ym={}));var vx=zr(A0(),1);E();var ih={debug:!1,"debug.background":!1,"debug.source":!1,"debug.screenshot":!1,"debug.layer.linz-aerial":0,"debug.layer.linz-topographic":0,"debug.layer.osm":0},Oc=class{static toUrl(n,s){if(n.debug===!0){s.append("debug","true");for(let[p,i]of Object.entries(n))p==="debug"||ih[p]===i||s.append(p,String(i))}}static fromUrl(n,s){let p=s.get("debug")!=null,i=!1;if(p===!1){for(let[m,v]of Object.entries(ih))i=rh(n,m,v)||i;return i}return i=rh(n,"debug",!0),i=rh(n,"debug.background",s.get("debug.background"))||i,i=rh(n,"debug.source",s.get("debug.source")!=null)||i,i=rh(n,"debug.screenshot",s.get("debug.screenshot")!=null)||i,i=Qm(n,"debug.layer.linz-aerial",s.get("debug.layer.linz-aerial"))||i,i=Qm(n,"debug.layer.linz-topographic",s.get("debug.layer.linz-topographic"))||i,i=Qm(n,"debug.layer.osm",s.get("debug.layer.osm"))||i,i}};function hE(r,n=0){if(r==null)return n;let s=Number(r);return isNaN(s)?n:s}function rh(r,n,s){return s==null&&(s=ih[n]),r[n]===s?!1:(r[n]=s,!0)}function Qm(r,n,s){return rh(r,n,hE(s))}E();E();E();E();var z0=zr(L0(),1),D0=zr(k0(),1);E();function R0(r){return[[[r[0],r[1]],[r[2],r[1]],[r[2],r[3]],[r[0],r[3]],[r[0],r[1]]]]}var{intersection:ry,union:WL}=D0.default;function pE(r,n){return r[0]===n[0]&&r[1]===n[1]}function fE(r,n){return ry(r,R0(n))}function iy(r,n){let s=[];for(let p of r){let i=z0.default.polygon(p[0],n);i.length!==0&&(pE(i[0],i[i.length-1])||i.push(i[0]),s.push([i]))}return fE(s,n)}E();E();var Nc=r=>(r<-360?r=-(-r%360):r>360&&(r=r%360),r<-180?360+r:r>180?r-360:r),Nl=(r,n)=>{let s=n-r;return s>180?s-360:s<-180?s+360:s},dE=(r,n)=>Nc(r+(n<r?n+360-r:n-r)),Ks={boxLonCenter(r){return Nc(r[0]+.5*(r[2]<r[0]?360+r[2]-r[0]:r[2]-r[0]))},delta:Nl,crossesAM(r,n){return Math.sign(Nl(r,n))!==Math.sign(n-r)},normLon:Nc,normExtent(r){return[Nc(r[0]),r[1],Nc(r[2]),r[3]]},union(r,n){if(n==null)return r.slice();let s=Ks.boxLonCenter(r),p=Ks.boxLonCenter(n);if(Nl(s,p)<0)return this.union(n,r);let i=r.slice(),m=dE(s,p);return Nl(m,n[0])<Nl(m,r[0])&&(i[0]=n[0]),Nl(m,n[2])>Nl(m,r[2])&&(i[2]=n[2]),n[1]<r[1]&&(i[1]=n[1]),n[3]>r[3]&&(i[3]=n[3]),i},intersects(r,n){if(r[1]>n[3]||n[1]>r[3])return!1;let s=r[0],p=n[0],i=s<r[2]?r[2]:r[2]+360,m=p<n[2]?n[2]:n[2]+360;return s<=m&&p<=i||s+360<=m&&p<=i+360||s<=m+360&&p+360<=i},ringToBbox(r){if(r.length<3)throw new Error("Invalid ring");let n=!1,s=r[0],p=s[0],i=s[1],m=p,v=i,b=p;for(let M=1;M<r.length;++M){let z=r[M],C=z[0];Ks.crossesAM(b,C)&&(n=!n),n&&(C<0?C+=360:(b+=360,M===1&&(p=m=b))),C<p?p=C:C>m&&(m=C);let Y=z[1];Y<i?i=Y:Y>v&&(v=Y),b=z[0]}return[this.normLon(p),i,this.normLon(m),v]},multiPolygonToBbox(r){let n=null;for(let s of r){if(s.length===0)continue;let p=s[0];if(p.length<3)continue;let i=this.ringToBbox(p);n=n==null?i:this.union(n,i)}if(n==null)throw new Error("Invalid multipolygon");return n},bboxToMultiPolygon(r){let n=[r[0],r[1]],s=[r[2],r[1]],p=[r[0],r[3]],i=[r[2],r[3]];return r[0]<r[2]?[[[n,p,i,s,n]]]:[[[n,p,[180,i[1]],[180,s[1]],n]],[[i,s,[-180,n[1]],[-180,p[1]],i]]]}};var mE=[-180,-90,180,90],yE=[180,-90,360,90];function gE(r,n,s){return[n[0]+(s[0]-n[0])*r,n[1]+(s[1]-n[1])*r]}function vE(r){let n=[];for(let s of iy(r,mE))n.push(s);for(let s of iy(r,yE))n.push(s.map(p=>p.map(i=>[i[0]-360,i[1]])));return n}function O0(r,n,s=!0){let p=!1,i=!1,m=r.map(v=>v.map(b=>{let M=[];if(b.length===0)return M;let z=b[0],C=null,j=0;for(let Y of b){let ot=n(Y),J=ot[0];if(C!=null){let mt=Ks.crossesAM(j,J);if(mt&&(p=!0,i=!i),i&&(J<0?ot[0]=J+360:C[0]=j+360),mt){let ft=(180-ot[0])/(C[0]-ot[0]),At=n(gE(ft,Y,z));M.push([180,At[1]])}}M.push(ot),z=Y,C=ot,j=J}return M}));return p&&s?vE(m):m}E();E();function _E(r){return{type:"Polygon",coordinates:r}}function N0(r,n={}){return{type:"Feature",geometry:_E(r),properties:n}}function F0(r,n={}){return{type:"Feature",geometry:{type:"MultiPolygon",coordinates:r},properties:n}}E();E();E();E();E();E();function B0(r){r("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),r("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),r("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),r.WGS84=r["EPSG:4326"],r["EPSG:3785"]=r["EPSG:3857"],r.GOOGLE=r["EPSG:3857"],r["EPSG:900913"]=r["EPSG:3857"],r["EPSG:102113"]=r["EPSG:3857"]}E();E();var Ko=1,Ho=2,U0=4,Fc=5,Fl=484813681109536e-20,Bt=Math.PI/2,G0=.16666666666666666,V0=.04722222222222222,j0=.022156084656084655,Ht=1e-10,Wi=.017453292519943295,Zo=57.29577951308232,_r=Math.PI/4,Bc=Math.PI*2,Mi=3.14159265359;E();var Jn={};Jn.greenwich=0;Jn.lisbon=-9.131906111111;Jn.paris=2.337229166667;Jn.bogota=-74.080916666667;Jn.madrid=-3.687938888889;Jn.rome=12.452333333333;Jn.bern=7.439583333333;Jn.jakarta=106.807719444444;Jn.ferro=-17.666666666667;Jn.brussels=4.367975;Jn.stockholm=18.058277777778;Jn.athens=23.7163375;Jn.oslo=10.722916666667;E();var q0={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};E();var W0=/[\s_\-\/\(\)]/g;function vo(r,n){if(r[n])return r[n];for(var s=Object.keys(r),p=n.toLowerCase().replace(W0,""),i=-1,m,v;++i<s.length;)if(m=s[i],v=m.toLowerCase().replace(W0,""),v===p)return r[m]}function Uc(r){var n={},s=r.split("+").map(function(b){return b.trim()}).filter(function(b){return b}).reduce(function(b,M){var z=M.split("=");return z.push(!0),b[z[0].toLowerCase()]=z[1],b},{}),p,i,m,v={proj:"projName",datum:"datumCode",rf:function(b){n.rf=parseFloat(b)},lat_0:function(b){n.lat0=b*Wi},lat_1:function(b){n.lat1=b*Wi},lat_2:function(b){n.lat2=b*Wi},lat_ts:function(b){n.lat_ts=b*Wi},lon_0:function(b){n.long0=b*Wi},lon_1:function(b){n.long1=b*Wi},lon_2:function(b){n.long2=b*Wi},alpha:function(b){n.alpha=parseFloat(b)*Wi},lonc:function(b){n.longc=b*Wi},x_0:function(b){n.x0=parseFloat(b)},y_0:function(b){n.y0=parseFloat(b)},k_0:function(b){n.k0=parseFloat(b)},k:function(b){n.k0=parseFloat(b)},a:function(b){n.a=parseFloat(b)},b:function(b){n.b=parseFloat(b)},r_a:function(){n.R_A=!0},zone:function(b){n.zone=parseInt(b,10)},south:function(){n.utmSouth=!0},towgs84:function(b){n.datum_params=b.split(",").map(function(M){return parseFloat(M)})},to_meter:function(b){n.to_meter=parseFloat(b)},units:function(b){n.units=b;var M=vo(q0,b);M&&(n.to_meter=M.to_meter)},from_greenwich:function(b){n.from_greenwich=b*Wi},pm:function(b){var M=vo(Jn,b);n.from_greenwich=(M||parseFloat(b))*Wi},nadgrids:function(b){b==="@null"?n.datumCode="none":n.nadgrids=b},axis:function(b){var M="ewnsud";b.length===3&&M.indexOf(b.substr(0,1))!==-1&&M.indexOf(b.substr(1,1))!==-1&&M.indexOf(b.substr(2,1))!==-1&&(n.axis=b)}};for(p in s)i=s[p],p in v?(m=v[p],typeof m=="function"?m(i):n[m]=i):n[p]=i;return typeof n.datumCode=="string"&&n.datumCode!=="WGS84"&&(n.datumCode=n.datumCode.toLowerCase()),n}E();E();var K0=SE,Gc=1,H0=2,Z0=3,jf=4,X0=5,ny=-1,xE=/\s/,bE=/[A-Za-z]/,wE=/[A-Za-z84]/,qf=/[,\]]/,Y0=/[\d\.E\-\+]/;function as(r){if(typeof r!="string")throw new Error("not a string");this.text=r.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Gc}as.prototype.readCharicter=function(){var r=this.text[this.place++];if(this.state!==jf)for(;xE.test(r);){if(this.place>=this.text.length)return;r=this.text[this.place++]}switch(this.state){case Gc:return this.neutral(r);case H0:return this.keyword(r);case jf:return this.quoted(r);case X0:return this.afterquote(r);case Z0:return this.number(r);case ny:return}};as.prototype.afterquote=function(r){if(r==='"'){this.word+='"',this.state=jf;return}if(qf.test(r)){this.word=this.word.trim(),this.afterItem(r);return}throw new Error(`havn't handled "`+r+'" in afterquote yet, index '+this.place)};as.prototype.afterItem=function(r){if(r===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Gc;return}if(r==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Gc,this.currentObject=this.stack.pop(),this.currentObject||(this.state=ny);return}};as.prototype.number=function(r){if(Y0.test(r)){this.word+=r;return}if(qf.test(r)){this.word=parseFloat(this.word),this.afterItem(r);return}throw new Error(`havn't handled "`+r+'" in number yet, index '+this.place)};as.prototype.quoted=function(r){if(r==='"'){this.state=X0;return}this.word+=r};as.prototype.keyword=function(r){if(wE.test(r)){this.word+=r;return}if(r==="["){var n=[];n.push(this.word),this.level++,this.root===null?this.root=n:this.currentObject.push(n),this.stack.push(this.currentObject),this.currentObject=n,this.state=Gc;return}if(qf.test(r)){this.afterItem(r);return}throw new Error(`havn't handled "`+r+'" in keyword yet, index '+this.place)};as.prototype.neutral=function(r){if(bE.test(r)){this.word=r,this.state=H0;return}if(r==='"'){this.word="",this.state=jf;return}if(Y0.test(r)){this.word=r,this.state=Z0;return}if(qf.test(r)){this.afterItem(r);return}throw new Error(`havn't handled "`+r+'" in neutral yet, index '+this.place)};as.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===ny)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function SE(r){var n=new as(r);return n.output()}E();function J0(r,n,s){Array.isArray(n)&&(s.unshift(n),n=null);var p=n?{}:r,i=s.reduce(function(m,v){return Bl(v,m),m},p);n&&(r[n]=i)}function Bl(r,n){if(!Array.isArray(r)){n[r]=!0;return}var s=r.shift();if(s==="PARAMETER"&&(s=r.shift()),r.length===1){if(Array.isArray(r[0])){n[s]={},Bl(r[0],n[s]);return}n[s]=r[0];return}if(!r.length){n[s]=!0;return}if(s==="TOWGS84"){n[s]=r;return}if(s==="AXIS"){s in n||(n[s]=[]),n[s].push(r);return}Array.isArray(s)||(n[s]={});var p;switch(s){case"UNIT":case"PRIMEM":case"VERT_DATUM":n[s]={name:r[0].toLowerCase(),convert:r[1]},r.length===3&&Bl(r[2],n[s]);return;case"SPHEROID":case"ELLIPSOID":n[s]={name:r[0],a:r[1],rf:r[2]},r.length===4&&Bl(r[3],n[s]);return;case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":r[0]=["name",r[0]],J0(n,s,r);return;default:for(p=-1;++p<r.length;)if(!Array.isArray(r[p]))return Bl(r,n[s]);return J0(n,s,r)}}var EE=.017453292519943295;function TE(r,n){var s=n[0],p=n[1];!(s in r)&&p in r&&(r[s]=r[p],n.length===3&&(r[s]=n[2](r[s])))}function ss(r){return r*EE}function ME(r){if(r.type==="GEOGCS"?r.projName="longlat":r.type==="LOCAL_CS"?(r.projName="identity",r.local=!0):typeof r.PROJECTION=="object"?r.projName=Object.keys(r.PROJECTION)[0]:r.projName=r.PROJECTION,r.AXIS){for(var n="",s=0,p=r.AXIS.length;s<p;++s){var i=r.AXIS[s],m=i[0].toLowerCase();m.indexOf("north")!==-1?n+="n":m.indexOf("south")!==-1?n+="s":m.indexOf("east")!==-1?n+="e":m.indexOf("west")!==-1&&(n+="w")}n.length===2&&(n+="u"),n.length===3&&(r.axis=n)}r.UNIT&&(r.units=r.UNIT.name.toLowerCase(),r.units==="metre"&&(r.units="meter"),r.UNIT.convert&&(r.type==="GEOGCS"?r.DATUM&&r.DATUM.SPHEROID&&(r.to_meter=r.UNIT.convert*r.DATUM.SPHEROID.a):r.to_meter=r.UNIT.convert));var v=r.GEOGCS;r.type==="GEOGCS"&&(v=r),v&&(v.DATUM?r.datumCode=v.DATUM.name.toLowerCase():r.datumCode=v.name.toLowerCase(),r.datumCode.slice(0,2)==="d_"&&(r.datumCode=r.datumCode.slice(2)),(r.datumCode==="new_zealand_geodetic_datum_1949"||r.datumCode==="new_zealand_1949")&&(r.datumCode="nzgd49"),(r.datumCode==="wgs_1984"||r.datumCode==="world_geodetic_system_1984")&&(r.PROJECTION==="Mercator_Auxiliary_Sphere"&&(r.sphere=!0),r.datumCode="wgs84"),r.datumCode.slice(-6)==="_ferro"&&(r.datumCode=r.datumCode.slice(0,-6)),r.datumCode.slice(-8)==="_jakarta"&&(r.datumCode=r.datumCode.slice(0,-8)),~r.datumCode.indexOf("belge")&&(r.datumCode="rnb72"),v.DATUM&&v.DATUM.SPHEROID&&(r.ellps=v.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),r.ellps.toLowerCase().slice(0,13)==="international"&&(r.ellps="intl"),r.a=v.DATUM.SPHEROID.a,r.rf=parseFloat(v.DATUM.SPHEROID.rf,10)),v.DATUM&&v.DATUM.TOWGS84&&(r.datum_params=v.DATUM.TOWGS84),~r.datumCode.indexOf("osgb_1936")&&(r.datumCode="osgb36"),~r.datumCode.indexOf("osni_1952")&&(r.datumCode="osni52"),(~r.datumCode.indexOf("tm65")||~r.datumCode.indexOf("geodetic_datum_of_1965"))&&(r.datumCode="ire65"),r.datumCode==="ch1903+"&&(r.datumCode="ch1903"),~r.datumCode.indexOf("israel")&&(r.datumCode="isr93")),r.b&&!isFinite(r.b)&&(r.b=r.a);function b(C){var j=r.to_meter||1;return C*j}var M=function(C){return TE(r,C)},z=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_2","Standard_Parallel_2"],["false_easting","False_Easting"],["false_northing","False_Northing"],["central_meridian","Central_Meridian"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",ss],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",ss],["x0","false_easting",b],["y0","false_northing",b],["long0","central_meridian",ss],["lat0","latitude_of_origin",ss],["lat0","standard_parallel_1",ss],["lat1","standard_parallel_1",ss],["lat2","standard_parallel_2",ss],["azimuth","Azimuth"],["alpha","azimuth",ss],["srsCode","name"]];z.forEach(M),!r.long0&&r.longc&&(r.projName==="Albers_Conic_Equal_Area"||r.projName==="Lambert_Azimuthal_Equal_Area")&&(r.long0=r.longc),!r.lat_ts&&r.lat1&&(r.projName==="Stereographic_South_Pole"||r.projName==="Polar Stereographic (variant B)")&&(r.lat0=ss(r.lat1>0?90:-90),r.lat_ts=r.lat1)}function Wf(r){var n=K0(r),s=n.shift(),p=n.shift();n.unshift(["name",p]),n.unshift(["type",s]);var i={};return Bl(n,i),ME(i),i}function Po(r){var n=this;if(arguments.length===2){var s=arguments[1];typeof s=="string"?s.charAt(0)==="+"?Po[r]=Uc(arguments[1]):Po[r]=Wf(arguments[1]):Po[r]=s}else if(arguments.length===1){if(Array.isArray(r))return r.map(function(p){Array.isArray(p)?Po.apply(n,p):Po(p)});if(typeof r=="string"){if(r in Po)return Po[r]}else"EPSG"in r?Po["EPSG:"+r.EPSG]=r:"ESRI"in r?Po["ESRI:"+r.ESRI]=r:"IAU2000"in r?Po["IAU2000:"+r.IAU2000]=r:console.log(r);return}}B0(Po);var oh=Po;function IE(r){return typeof r=="string"}function CE(r){return r in oh}var AE=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function PE(r){return AE.some(function(n){return r.indexOf(n)>-1})}var LE=["3857","900913","3785","102113"];function kE(r){var n=vo(r,"authority");if(!!n){var s=vo(n,"epsg");return s&&LE.indexOf(s)>-1}}function RE(r){var n=vo(r,"extension");if(!!n)return vo(n,"proj4")}function zE(r){return r[0]==="+"}function DE(r){if(IE(r)){if(CE(r))return oh[r];if(PE(r)){var n=Wf(r);if(kE(n))return oh["EPSG:3857"];var s=RE(n);return s?Uc(s):n}if(zE(r))return Uc(r)}else return r}var Q0=DE;E();function oy(r,n){r=r||{};var s,p;if(!n)return r;for(p in n)s=n[p],s!==void 0&&(r[p]=s);return r}E();E();E();function Fn(r,n,s){var p=r*n;return s/Math.sqrt(1-p*p)}E();E();function wa(r){return r<0?-1:1}function $t(r){return Math.abs(r)<=Mi?r:r-wa(r)*Bc}E();function Qn(r,n,s){var p=r*s,i=.5*r;return p=Math.pow((1-p)/(1+p),i),Math.tan(.5*(Bt-n))/p}E();function ls(r,n){for(var s=.5*r,p,i,m=Bt-2*Math.atan(n),v=0;v<=15;v++)if(p=r*Math.sin(m),i=Bt-2*Math.atan(n*Math.pow((1-p)/(1+p),s))-m,m+=i,Math.abs(i)<=1e-10)return m;return-9999}function OE(){var r=this.b/this.a;this.es=1-r*r,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Fn(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function NE(r){var n=r.x,s=r.y;if(s*Zo>90&&s*Zo<-90&&n*Zo>180&&n*Zo<-180)return null;var p,i;if(Math.abs(Math.abs(s)-Bt)<=Ht)return null;if(this.sphere)p=this.x0+this.a*this.k0*$t(n-this.long0),i=this.y0+this.a*this.k0*Math.log(Math.tan(_r+.5*s));else{var m=Math.sin(s),v=Qn(this.e,s,m);p=this.x0+this.a*this.k0*$t(n-this.long0),i=this.y0-this.a*this.k0*Math.log(v)}return r.x=p,r.y=i,r}function FE(r){var n=r.x-this.x0,s=r.y-this.y0,p,i;if(this.sphere)i=Bt-2*Math.atan(Math.exp(-s/(this.a*this.k0)));else{var m=Math.exp(-s/(this.a*this.k0));if(i=ls(this.e,m),i===-9999)return null}return p=$t(this.long0+n/(this.a*this.k0)),r.x=p,r.y=i,r}var BE=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],$0={init:OE,forward:NE,inverse:FE,names:BE};E();function UE(){}function t_(r){return r}var GE=["longlat","identity"],e_={init:UE,forward:t_,inverse:t_,names:GE};var VE=[$0,e_],Kf={},Hf=[];function r_(r,n){var s=Hf.length;return r.names?(Hf[s]=r,r.names.forEach(function(p){Kf[p.toLowerCase()]=s}),this):(console.log(n),!0)}function jE(r){if(!r)return!1;var n=r.toLowerCase();if(typeof Kf[n]<"u"&&Hf[Kf[n]])return Hf[Kf[n]]}function qE(){VE.forEach(r_)}var i_={start:qE,add:r_,get:jE};E();E();var Je={};Je.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"};Je.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"};Je.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"};Je.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"};Je.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"};Je.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"};Je.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"};Je.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"};Je.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"};Je.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"};Je.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"};Je.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"};Je.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"};Je.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"};Je.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."};Je.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"};Je.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"};Je.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"};Je.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"};Je.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"};Je.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"};Je.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"};Je.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"};Je.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"};Je.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"};Je.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"};Je.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"};Je.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"};Je.hough={a:6378270,rf:297,ellipseName:"Hough"};Je.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"};Je.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"};Je.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"};Je.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"};Je.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"};Je.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"};Je.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"};Je.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"};Je.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"};Je.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"};Je.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"};Je.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var n_=Je.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};Je.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function o_(r,n,s,p){var i=r*r,m=n*n,v=(i-m)/i,b=0;p?(r*=1-v*(G0+v*(V0+v*j0)),i=r*r,v=0):b=Math.sqrt(v);var M=(i-m)/m;return{es:v,e:b,ep2:M}}function a_(r,n,s,p,i){if(!r){var m=vo(Je,p);m||(m=n_),r=m.a,n=m.b,s=m.rf}return s&&!n&&(n=(1-1/s)*r),(s===0||Math.abs(r-n)<Ht)&&(i=!0,n=r),{a:r,b:n,rf:s,sphere:i}}E();var on={};on.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"};on.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"};on.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"};on.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"};on.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"};on.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"};on.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"};on.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"};on.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"};on.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"};on.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"};on.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"};on.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"};on.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"};on.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"};on.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"};on.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};E();function WE(r,n,s,p,i,m){var v={};return r===void 0||r==="none"?v.datum_type=Fc:v.datum_type=U0,n&&(v.datum_params=n.map(parseFloat),(v.datum_params[0]!==0||v.datum_params[1]!==0||v.datum_params[2]!==0)&&(v.datum_type=Ko),v.datum_params.length>3&&(v.datum_params[3]!==0||v.datum_params[4]!==0||v.datum_params[5]!==0||v.datum_params[6]!==0)&&(v.datum_type=Ho,v.datum_params[3]*=Fl,v.datum_params[4]*=Fl,v.datum_params[5]*=Fl,v.datum_params[6]=v.datum_params[6]/1e6+1)),v.a=s,v.b=p,v.es=i,v.ep2=m,v}var s_=WE;function ah(r,n){if(!(this instanceof ah))return new ah(r);n=n||function(M){if(M)throw M};var s=Q0(r);if(typeof s!="object"){n(r);return}var p=ah.projections.get(s.projName);if(!p){n(r);return}if(s.datumCode&&s.datumCode!=="none"){var i=vo(on,s.datumCode);i&&(s.datum_params=i.towgs84?i.towgs84.split(","):null,s.ellps=i.ellipse,s.datumName=i.datumName?i.datumName:s.datumCode)}s.k0=s.k0||1,s.axis=s.axis||"enu",s.ellps=s.ellps||"wgs84";var m=a_(s.a,s.b,s.rf,s.ellps,s.sphere),v=o_(m.a,m.b,m.rf,s.R_A),b=s.datum||s_(s.datumCode,s.datum_params,m.a,m.b,v.es,v.ep2);oy(this,s),oy(this,p),this.a=m.a,this.b=m.b,this.rf=m.rf,this.sphere=m.sphere,this.es=v.es,this.e=v.e,this.ep2=v.ep2,this.datum=b,this.init(),n(null,this)}ah.projections=i_;ah.projections.start();var Hs=ah;E();E();E();function l_(r,n){return r.datum_type!==n.datum_type||r.a!==n.a||Math.abs(r.es-n.es)>5e-11?!1:r.datum_type===Ko?r.datum_params[0]===n.datum_params[0]&&r.datum_params[1]===n.datum_params[1]&&r.datum_params[2]===n.datum_params[2]:r.datum_type===Ho?r.datum_params[0]===n.datum_params[0]&&r.datum_params[1]===n.datum_params[1]&&r.datum_params[2]===n.datum_params[2]&&r.datum_params[3]===n.datum_params[3]&&r.datum_params[4]===n.datum_params[4]&&r.datum_params[5]===n.datum_params[5]&&r.datum_params[6]===n.datum_params[6]:!0}function Zf(r,n,s){var p=r.x,i=r.y,m=r.z?r.z:0,v,b,M,z;if(i<-Bt&&i>-1.001*Bt)i=-Bt;else if(i>Bt&&i<1.001*Bt)i=Bt;else{if(i<-Bt)return{x:-1/0,y:-1/0,z:r.z};if(i>Bt)return{x:1/0,y:1/0,z:r.z}}return p>Math.PI&&(p-=2*Math.PI),b=Math.sin(i),z=Math.cos(i),M=b*b,v=s/Math.sqrt(1-n*M),{x:(v+m)*z*Math.cos(p),y:(v+m)*z*Math.sin(p),z:(v*(1-n)+m)*b}}function Xf(r,n,s,p){var i=1e-12,m=i*i,v=30,b,M,z,C,j,Y,ot,J,mt,ft,At,Gt,Zt,we=r.x,he=r.y,Kt=r.z?r.z:0,ce,Yt,Te;if(b=Math.sqrt(we*we+he*he),M=Math.sqrt(we*we+he*he+Kt*Kt),b/s<i){if(ce=0,M/s<i)return Yt=Bt,Te=-p,{x:r.x,y:r.y,z:r.z}}else ce=Math.atan2(he,we);z=Kt/M,C=b/M,j=1/Math.sqrt(1-n*(2-n)*C*C),J=C*(1-n)*j,mt=z*j,Zt=0;do Zt++,ot=s/Math.sqrt(1-n*mt*mt),Te=b*J+Kt*mt-ot*(1-n*mt*mt),Y=n*ot/(ot+Te),j=1/Math.sqrt(1-Y*(2-Y)*C*C),ft=C*(1-Y)*j,At=z*j,Gt=At*J-ft*mt,J=ft,mt=At;while(Gt*Gt>m&&Zt<v);return Yt=Math.atan(At/Math.abs(ft)),{x:ce,y:Yt,z:Te}}function u_(r,n,s){if(n===Ko)return{x:r.x+s[0],y:r.y+s[1],z:r.z+s[2]};if(n===Ho){var p=s[0],i=s[1],m=s[2],v=s[3],b=s[4],M=s[5],z=s[6];return{x:z*(r.x-M*r.y+b*r.z)+p,y:z*(M*r.x+r.y-v*r.z)+i,z:z*(-b*r.x+v*r.y+r.z)+m}}}function h_(r,n,s){if(n===Ko)return{x:r.x-s[0],y:r.y-s[1],z:r.z-s[2]};if(n===Ho){var p=s[0],i=s[1],m=s[2],v=s[3],b=s[4],M=s[5],z=s[6],C=(r.x-p)/z,j=(r.y-i)/z,Y=(r.z-m)/z;return{x:C+M*j-b*Y,y:-M*C+j+v*Y,z:b*C-v*j+Y}}}function Yf(r){return r===Ko||r===Ho}function c_(r,n,s){return l_(r,n)||r.datum_type===Fc||n.datum_type===Fc||r.es===n.es&&r.a===n.a&&!Yf(r.datum_type)&&!Yf(n.datum_type)?s:(s=Zf(s,r.es,r.a),Yf(r.datum_type)&&(s=u_(s,r.datum_type,r.datum_params)),Yf(n.datum_type)&&(s=h_(s,n.datum_type,n.datum_params)),Xf(s,n.es,n.a,n.b))}E();function ay(r,n,s){var p=s.x,i=s.y,m=s.z||0,v,b,M,z={};for(M=0;M<3;M++)if(!(n&&M===2&&s.z===void 0))switch(M===0?(v=p,"ew".indexOf(r.axis[M])!==-1?b="x":b="y"):M===1?(v=i,"ns".indexOf(r.axis[M])!==-1?b="y":b="x"):(v=m,b="z"),r.axis[M]){case"e":z[b]=v;break;case"w":z[b]=-v;break;case"n":z[b]=v;break;case"s":z[b]=-v;break;case"u":s[b]!==void 0&&(z.z=v);break;case"d":s[b]!==void 0&&(z.z=-v);break;default:return null}return z}E();function Jf(r){var n={x:r[0],y:r[1]};return r.length>2&&(n.z=r[2]),r.length>3&&(n.m=r[3]),n}E();function f_(r){p_(r.x),p_(r.y)}function p_(r){if(typeof Number.isFinite=="function"){if(Number.isFinite(r))return;throw new TypeError("coordinates must be finite numbers")}if(typeof r!="number"||r!==r||!isFinite(r))throw new TypeError("coordinates must be finite numbers")}function KE(r,n){return(r.datum.datum_type===Ko||r.datum.datum_type===Ho)&&n.datumCode!=="WGS84"||(n.datum.datum_type===Ko||n.datum.datum_type===Ho)&&r.datumCode!=="WGS84"}function Ul(r,n,s){var p;if(Array.isArray(s)&&(s=Jf(s)),f_(s),r.datum&&n.datum&&KE(r,n)&&(p=new Hs("WGS84"),s=Ul(r,p,s),r=p),r.axis!=="enu"&&(s=ay(r,!1,s)),r.projName==="longlat")s={x:s.x*Wi,y:s.y*Wi,z:s.z||0};else if(r.to_meter&&(s={x:s.x*r.to_meter,y:s.y*r.to_meter,z:s.z||0}),s=r.inverse(s),!s)return;return r.from_greenwich&&(s.x+=r.from_greenwich),s=c_(r.datum,n.datum,s),n.from_greenwich&&(s={x:s.x-n.from_greenwich,y:s.y,z:s.z||0}),n.projName==="longlat"?s={x:s.x*Zo,y:s.y*Zo,z:s.z||0}:(s=n.forward(s),n.to_meter&&(s={x:s.x/n.to_meter,y:s.y/n.to_meter,z:s.z||0})),n.axis!=="enu"?ay(n,!0,s):s}var d_=Hs("WGS84");function sy(r,n,s){var p,i,m;return Array.isArray(s)?(p=Ul(r,n,s)||{x:NaN,y:NaN},s.length>2?typeof r.name<"u"&&r.name==="geocent"||typeof n.name<"u"&&n.name==="geocent"?typeof p.z=="number"?[p.x,p.y,p.z].concat(s.splice(3)):[p.x,p.y,s[2]].concat(s.splice(3)):[p.x,p.y].concat(s.splice(2)):[p.x,p.y]):(i=Ul(r,n,s),m=Object.keys(s),m.length===2||m.forEach(function(v){if(typeof r.name<"u"&&r.name==="geocent"||typeof n.name<"u"&&n.name==="geocent"){if(v==="x"||v==="y"||v==="z")return}else if(v==="x"||v==="y")return;i[v]=s[v]}),i)}function m_(r){return r instanceof Hs?r:r.oProj?r.oProj:Hs(r)}function HE(r,n,s){r=m_(r);var p=!1,i;return typeof n>"u"?(n=r,r=d_,p=!0):(typeof n.x<"u"||Array.isArray(n))&&(s=n,n=r,r=d_,p=!0),n=m_(n),s?sy(r,n,s):(i={forward:function(m){return sy(r,n,m)},inverse:function(m){return sy(n,r,m)}},p&&(i.oProj=n),i)}var _o=HE;E();E();var y_=6,v_="AJSAJS",__="AFAFAF",sh=65,uo=73,Lo=79,Vc=86,jc=90,x_={forward:uy,inverse:ZE,toPoint:hy};function uy(r,n){return n=n||5,JE(XE({lat:r[1],lon:r[0]}),n)}function ZE(r){var n=cy(w_(r.toUpperCase()));return n.lat&&n.lon?[n.lon,n.lat,n.lon,n.lat]:[n.left,n.bottom,n.right,n.top]}function hy(r){var n=cy(w_(r.toUpperCase()));return n.lat&&n.lon?[n.lon,n.lat]:[(n.left+n.right)/2,(n.top+n.bottom)/2]}function ly(r){return r*(Math.PI/180)}function g_(r){return 180*(r/Math.PI)}function XE(r){var n=r.lat,s=r.lon,p=6378137,i=.00669438,m=.9996,v,b,M,z,C,j,Y,ot=ly(n),J=ly(s),mt,ft;ft=Math.floor((s+180)/6)+1,s===180&&(ft=60),n>=56&&n<64&&s>=3&&s<12&&(ft=32),n>=72&&n<84&&(s>=0&&s<9?ft=31:s>=9&&s<21?ft=33:s>=21&&s<33?ft=35:s>=33&&s<42&&(ft=37)),v=(ft-1)*6-180+3,mt=ly(v),b=i/(1-i),M=p/Math.sqrt(1-i*Math.sin(ot)*Math.sin(ot)),z=Math.tan(ot)*Math.tan(ot),C=b*Math.cos(ot)*Math.cos(ot),j=Math.cos(ot)*(J-mt),Y=p*((1-i/4-3*i*i/64-5*i*i*i/256)*ot-(3*i/8+3*i*i/32+45*i*i*i/1024)*Math.sin(2*ot)+(15*i*i/256+45*i*i*i/1024)*Math.sin(4*ot)-35*i*i*i/3072*Math.sin(6*ot));var At=m*M*(j+(1-z+C)*j*j*j/6+(5-18*z+z*z+72*C-58*b)*j*j*j*j*j/120)+5e5,Gt=m*(Y+M*Math.tan(ot)*(j*j/2+(5-z+9*C+4*C*C)*j*j*j*j/24+(61-58*z+z*z+600*C-330*b)*j*j*j*j*j*j/720));return n<0&&(Gt+=1e7),{northing:Math.round(Gt),easting:Math.round(At),zoneNumber:ft,zoneLetter:YE(n)}}function cy(r){var n=r.northing,s=r.easting,p=r.zoneLetter,i=r.zoneNumber;if(i<0||i>60)return null;var m=.9996,v=6378137,b=.00669438,M,z=(1-Math.sqrt(1-b))/(1+Math.sqrt(1-b)),C,j,Y,ot,J,mt,ft,At,Gt,Zt=s-5e5,we=n;p<"N"&&(we-=1e7),ft=(i-1)*6-180+3,M=b/(1-b),mt=we/m,At=mt/(v*(1-b/4-3*b*b/64-5*b*b*b/256)),Gt=At+(3*z/2-27*z*z*z/32)*Math.sin(2*At)+(21*z*z/16-55*z*z*z*z/32)*Math.sin(4*At)+151*z*z*z/96*Math.sin(6*At),C=v/Math.sqrt(1-b*Math.sin(Gt)*Math.sin(Gt)),j=Math.tan(Gt)*Math.tan(Gt),Y=M*Math.cos(Gt)*Math.cos(Gt),ot=v*(1-b)/Math.pow(1-b*Math.sin(Gt)*Math.sin(Gt),1.5),J=Zt/(C*m);var he=Gt-C*Math.tan(Gt)/ot*(J*J/2-(5+3*j+10*Y-4*Y*Y-9*M)*J*J*J*J/24+(61+90*j+298*Y+45*j*j-252*M-3*Y*Y)*J*J*J*J*J*J/720);he=g_(he);var Kt=(J-(1+2*j+Y)*J*J*J/6+(5-2*Y+28*j-3*Y*Y+8*M+24*j*j)*J*J*J*J*J/120)/Math.cos(Gt);Kt=ft+g_(Kt);var ce;if(r.accuracy){var Yt=cy({northing:r.northing+r.accuracy,easting:r.easting+r.accuracy,zoneLetter:r.zoneLetter,zoneNumber:r.zoneNumber});ce={top:Yt.lat,right:Yt.lon,bottom:he,left:Kt}}else ce={lat:he,lon:Kt};return ce}function YE(r){var n="Z";return 84>=r&&r>=72?n="X":72>r&&r>=64?n="W":64>r&&r>=56?n="V":56>r&&r>=48?n="U":48>r&&r>=40?n="T":40>r&&r>=32?n="S":32>r&&r>=24?n="R":24>r&&r>=16?n="Q":16>r&&r>=8?n="P":8>r&&r>=0?n="N":0>r&&r>=-8?n="M":-8>r&&r>=-16?n="L":-16>r&&r>=-24?n="K":-24>r&&r>=-32?n="J":-32>r&&r>=-40?n="H":-40>r&&r>=-48?n="G":-48>r&&r>=-56?n="F":-56>r&&r>=-64?n="E":-64>r&&r>=-72?n="D":-72>r&&r>=-80&&(n="C"),n}function JE(r,n){var s="00000"+r.easting,p="00000"+r.northing;return r.zoneNumber+r.zoneLetter+QE(r.easting,r.northing,r.zoneNumber)+s.substr(s.length-5,n)+p.substr(p.length-5,n)}function QE(r,n,s){var p=b_(s),i=Math.floor(r/1e5),m=Math.floor(n/1e5)%20;return $E(i,m,p)}function b_(r){var n=r%y_;return n===0&&(n=y_),n}function $E(r,n,s){var p=s-1,i=v_.charCodeAt(p),m=__.charCodeAt(p),v=i+r-1,b=m+n,M=!1;v>jc&&(v=v-jc+sh-1,M=!0),(v===uo||i<uo&&v>uo||(v>uo||i<uo)&&M)&&v++,(v===Lo||i<Lo&&v>Lo||(v>Lo||i<Lo)&&M)&&(v++,v===uo&&v++),v>jc&&(v=v-jc+sh-1),b>Vc?(b=b-Vc+sh-1,M=!0):M=!1,(b===uo||m<uo&&b>uo||(b>uo||m<uo)&&M)&&b++,(b===Lo||m<Lo&&b>Lo||(b>Lo||m<Lo)&&M)&&(b++,b===uo&&b++),b>Vc&&(b=b-Vc+sh-1);var z=String.fromCharCode(v)+String.fromCharCode(b);return z}function w_(r){if(r&&r.length===0)throw"MGRSPoint coverting from nothing";for(var n=r.length,s=null,p="",i,m=0;!/[A-Z]/.test(i=r.charAt(m));){if(m>=2)throw"MGRSPoint bad conversion from: "+r;p+=i,m++}var v=parseInt(p,10);if(m===0||m+3>n)throw"MGRSPoint bad conversion from: "+r;var b=r.charAt(m++);if(b<="A"||b==="B"||b==="Y"||b>="Z"||b==="I"||b==="O")throw"MGRSPoint zone letter "+b+" not handled: "+r;s=r.substring(m,m+=2);for(var M=b_(v),z=tT(s.charAt(0),M),C=eT(s.charAt(1),M);C<rT(b);)C+=2e6;var j=n-m;if(j%2!==0)throw`MGRSPoint has to have an even number
|
|
499
|
+
of digits after the zone letter and two 100km letters - front
|
|
500
|
+
half for easting meters, second half for
|
|
501
|
+
northing meters`+r;var Y=j/2,ot=0,J=0,mt,ft,At,Gt,Zt;return Y>0&&(mt=1e5/Math.pow(10,Y),ft=r.substring(m,m+Y),ot=parseFloat(ft)*mt,At=r.substring(m+Y),J=parseFloat(At)*mt),Gt=ot+z,Zt=J+C,{easting:Gt,northing:Zt,zoneLetter:b,zoneNumber:v,accuracy:mt}}function tT(r,n){for(var s=v_.charCodeAt(n-1),p=1e5,i=!1;s!==r.charCodeAt(0);){if(s++,s===uo&&s++,s===Lo&&s++,s>jc){if(i)throw"Bad character: "+r;s=sh,i=!0}p+=1e5}return p}function eT(r,n){if(r>"V")throw"MGRSPoint given invalid Northing "+r;for(var s=__.charCodeAt(n-1),p=0,i=!1;s!==r.charCodeAt(0);){if(s++,s===uo&&s++,s===Lo&&s++,s>Vc){if(i)throw"Bad character: "+r;s=sh,i=!0}p+=1e5}return p}function rT(r){var n;switch(r){case"C":n=11e5;break;case"D":n=2e6;break;case"E":n=28e5;break;case"F":n=37e5;break;case"G":n=46e5;break;case"H":n=55e5;break;case"J":n=64e5;break;case"K":n=73e5;break;case"L":n=82e5;break;case"M":n=91e5;break;case"N":n=0;break;case"P":n=8e5;break;case"Q":n=17e5;break;case"R":n=26e5;break;case"S":n=35e5;break;case"T":n=44e5;break;case"U":n=53e5;break;case"V":n=62e5;break;case"W":n=7e6;break;case"X":n=79e5;break;default:n=-1}if(n>=0)return n;throw"Invalid zone letter: "+r}function lh(r,n,s){if(!(this instanceof lh))return new lh(r,n,s);if(Array.isArray(r))this.x=r[0],this.y=r[1],this.z=r[2]||0;else if(typeof r=="object")this.x=r.x,this.y=r.y,this.z=r.z||0;else if(typeof r=="string"&&typeof n>"u"){var p=r.split(",");this.x=parseFloat(p[0],10),this.y=parseFloat(p[1],10),this.z=parseFloat(p[2],10)||0}else this.x=r,this.y=n,this.z=s||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}lh.fromMGRS=function(r){return new lh(hy(r))};lh.prototype.toMGRS=function(r){return uy([this.x,this.y],r)};var S_=lh;E();E();E();var iT=1,nT=.25,E_=.046875,T_=.01953125,M_=.01068115234375,oT=.75,aT=.46875,sT=.013020833333333334,lT=.007120768229166667,uT=.3645833333333333,hT=.005696614583333333,cT=.3076171875;function Qf(r){var n=[];n[0]=iT-r*(nT+r*(E_+r*(T_+r*M_))),n[1]=r*(oT-r*(E_+r*(T_+r*M_)));var s=r*r;return n[2]=s*(aT-r*(sT+r*lT)),s*=r,n[3]=s*(uT-r*hT),n[4]=s*r*cT,n}E();function Gl(r,n,s,p){return s*=n,n*=n,p[0]*r-s*(p[1]+n*(p[2]+n*(p[3]+n*p[4])))}E();var pT=20;function $f(r,n,s){for(var p=1/(1-n),i=r,m=pT;m;--m){var v=Math.sin(i),b=1-n*v*v;if(b=(Gl(i,v,Math.cos(i),s)-r)*(b*Math.sqrt(b))*p,i-=b,Math.abs(b)<Ht)return i}return i}function fT(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=Qf(this.es),this.ml0=Gl(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function dT(r){var n=r.x,s=r.y,p=$t(n-this.long0),i,m,v,b=Math.sin(s),M=Math.cos(s);if(this.es){var C=M*p,j=Math.pow(C,2),Y=this.ep2*Math.pow(M,2),ot=Math.pow(Y,2),J=Math.abs(M)>Ht?Math.tan(s):0,mt=Math.pow(J,2),ft=Math.pow(mt,2);i=1-this.es*Math.pow(b,2),C=C/Math.sqrt(i);var At=Gl(s,b,M,this.en);m=this.a*(this.k0*C*(1+j/6*(1-mt+Y+j/20*(5-18*mt+ft+14*Y-58*mt*Y+j/42*(61+179*ft-ft*mt-479*mt)))))+this.x0,v=this.a*(this.k0*(At-this.ml0+b*p*C/2*(1+j/12*(5-mt+9*Y+4*ot+j/30*(61+ft-58*mt+270*Y-330*mt*Y+j/56*(1385+543*ft-ft*mt-3111*mt))))))+this.y0}else{var z=M*Math.sin(p);if(Math.abs(Math.abs(z)-1)<Ht)return 93;if(m=.5*this.a*this.k0*Math.log((1+z)/(1-z))+this.x0,v=M*Math.cos(p)/Math.sqrt(1-Math.pow(z,2)),z=Math.abs(v),z>=1){if(z-1>Ht)return 93;v=0}else v=Math.acos(v);s<0&&(v=-v),v=this.a*this.k0*(v-this.lat0)+this.y0}return r.x=m,r.y=v,r}function mT(r){var n,s,p,i,m=(r.x-this.x0)*(1/this.a),v=(r.y-this.y0)*(1/this.a);if(this.es)if(n=this.ml0+v/this.k0,s=$f(n,this.es,this.en),Math.abs(s)<Bt){var j=Math.sin(s),Y=Math.cos(s),ot=Math.abs(Y)>Ht?Math.tan(s):0,J=this.ep2*Math.pow(Y,2),mt=Math.pow(J,2),ft=Math.pow(ot,2),At=Math.pow(ft,2);n=1-this.es*Math.pow(j,2);var Gt=m*Math.sqrt(n)/this.k0,Zt=Math.pow(Gt,2);n=n*ot,p=s-n*Zt/(1-this.es)*.5*(1-Zt/12*(5+3*ft-9*J*ft+J-4*mt-Zt/30*(61+90*ft-252*J*ft+45*At+46*J-Zt/56*(1385+3633*ft+4095*At+1574*At*ft)))),i=$t(this.long0+Gt*(1-Zt/6*(1+2*ft+J-Zt/20*(5+28*ft+24*At+8*J*ft+6*J-Zt/42*(61+662*ft+1320*At+720*At*ft))))/Y)}else p=Bt*wa(v),i=0;else{var b=Math.exp(m/this.k0),M=.5*(b-1/b),z=this.lat0+v/this.k0,C=Math.cos(z);n=Math.sqrt((1-Math.pow(C,2))/(1+Math.pow(M,2))),p=Math.asin(n),v<0&&(p=-p),M===0&&C===0?i=0:i=$t(Math.atan2(M,C)+this.long0)}return r.x=i,r.y=p,r}var yT=["Transverse_Mercator","Transverse Mercator","tmerc"],I_={init:fT,forward:dT,inverse:mT,names:yT};E();E();function td(r){var n=Math.exp(r);return n=(n-1/n)/2,n}E();function Vl(r,n){r=Math.abs(r),n=Math.abs(n);var s=Math.max(r,n),p=Math.min(r,n)/(s||1);return s*Math.sqrt(1+Math.pow(p,2))}E();E();function C_(r){var n=1+r,s=n-1;return s===0?r:r*Math.log(n)/s}function A_(r){var n=Math.abs(r);return n=C_(n*(1+n/(Vl(1,n)+1))),r<0?-n:n}E();function ed(r,n){for(var s=2*Math.cos(2*n),p=r.length-1,i=r[p],m=0,v;--p>=0;)v=-m+s*i+r[p],m=i,i=v;return n+v*Math.sin(2*n)}E();function P_(r,n){for(var s=2*Math.cos(n),p=r.length-1,i=r[p],m=0,v;--p>=0;)v=-m+s*i+r[p],m=i,i=v;return Math.sin(n)*v}E();E();function L_(r){var n=Math.exp(r);return n=(n+1/n)/2,n}function py(r,n,s){for(var p=Math.sin(n),i=Math.cos(n),m=td(s),v=L_(s),b=2*i*v,M=-2*p*m,z=r.length-1,C=r[z],j=0,Y=0,ot=0,J,mt;--z>=0;)J=Y,mt=j,Y=C,j=ot,C=-J+b*Y-M*j+r[z],ot=-mt+M*Y+b*j;return b=p*v,M=i*m,[b*C-M*ot,b*ot+M*C]}function gT(){if(this.es===void 0||this.es<=0)throw new Error("incorrect elliptical usage");this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var r=this.es/(1+Math.sqrt(1-this.es)),n=r/(2-r),s=n;this.cgb[0]=n*(2+n*(-2/3+n*(-2+n*(116/45+n*(26/45+n*(-2854/675)))))),this.cbg[0]=n*(-2+n*(2/3+n*(4/3+n*(-82/45+n*(32/45+n*(4642/4725)))))),s=s*n,this.cgb[1]=s*(7/3+n*(-8/5+n*(-227/45+n*(2704/315+n*(2323/945))))),this.cbg[1]=s*(5/3+n*(-16/15+n*(-13/9+n*(904/315+n*(-1522/945))))),s=s*n,this.cgb[2]=s*(56/15+n*(-136/35+n*(-1262/105+n*(73814/2835)))),this.cbg[2]=s*(-26/15+n*(34/21+n*(8/5+n*(-12686/2835)))),s=s*n,this.cgb[3]=s*(4279/630+n*(-332/35+n*(-399572/14175))),this.cbg[3]=s*(1237/630+n*(-12/5+n*(-24832/14175))),s=s*n,this.cgb[4]=s*(4174/315+n*(-144838/6237)),this.cbg[4]=s*(-734/315+n*(109598/31185)),s=s*n,this.cgb[5]=s*(601676/22275),this.cbg[5]=s*(444337/155925),s=Math.pow(n,2),this.Qn=this.k0/(1+n)*(1+s*(1/4+s*(1/64+s/256))),this.utg[0]=n*(-.5+n*(2/3+n*(-37/96+n*(1/360+n*(81/512+n*(-96199/604800)))))),this.gtu[0]=n*(.5+n*(-2/3+n*(5/16+n*(41/180+n*(-127/288+n*(7891/37800)))))),this.utg[1]=s*(-1/48+n*(-1/15+n*(437/1440+n*(-46/105+n*(1118711/3870720))))),this.gtu[1]=s*(13/48+n*(-3/5+n*(557/1440+n*(281/630+n*(-1983433/1935360))))),s=s*n,this.utg[2]=s*(-17/480+n*(37/840+n*(209/4480+n*(-5569/90720)))),this.gtu[2]=s*(61/240+n*(-103/140+n*(15061/26880+n*(167603/181440)))),s=s*n,this.utg[3]=s*(-4397/161280+n*(11/504+n*(830251/7257600))),this.gtu[3]=s*(49561/161280+n*(-179/168+n*(6601661/7257600))),s=s*n,this.utg[4]=s*(-4583/161280+n*(108847/3991680)),this.gtu[4]=s*(34729/80640+n*(-3418889/1995840)),s=s*n,this.utg[5]=s*(-20648693/638668800),this.gtu[5]=s*(212378941/319334400);var p=ed(this.cbg,this.lat0);this.Zb=-this.Qn*(p+P_(this.gtu,2*p))}function vT(r){var n=$t(r.x-this.long0),s=r.y;s=ed(this.cbg,s);var p=Math.sin(s),i=Math.cos(s),m=Math.sin(n),v=Math.cos(n);s=Math.atan2(p,v*i),n=Math.atan2(m*i,Vl(p,i*v)),n=A_(Math.tan(n));var b=py(this.gtu,2*s,2*n);s=s+b[0],n=n+b[1];var M,z;return Math.abs(n)<=2.623395162778?(M=this.a*(this.Qn*n)+this.x0,z=this.a*(this.Qn*s+this.Zb)+this.y0):(M=1/0,z=1/0),r.x=M,r.y=z,r}function _T(r){var n=(r.x-this.x0)*(1/this.a),s=(r.y-this.y0)*(1/this.a);s=(s-this.Zb)/this.Qn,n=n/this.Qn;var p,i;if(Math.abs(n)<=2.623395162778){var m=py(this.utg,2*s,2*n);s=s+m[0],n=n+m[1],n=Math.atan(td(n));var v=Math.sin(s),b=Math.cos(s),M=Math.sin(n),z=Math.cos(n);s=Math.atan2(v*z,Vl(M,z*b)),n=Math.atan2(M,z*b),p=$t(n+this.long0),i=ed(this.cgb,s)}else p=1/0,i=1/0;return r.x=p,r.y=i,r}var xT=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],uh={init:gT,forward:vT,inverse:_T,names:xT};E();E();function k_(r,n){if(r===void 0){if(r=Math.floor(($t(n)+Math.PI)*30/Math.PI)+1,r<0)return 0;if(r>60)return 60}return r}var bT="etmerc";function wT(){var r=k_(this.zone,this.long0);if(r===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(r)-183)*Wi,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,uh.init.apply(this),this.forward=uh.forward,this.inverse=uh.inverse}var ST=["Universal Transverse Mercator System","utm"],R_={init:wT,names:ST,dependsOn:bT};E();E();E();function rd(r,n){return Math.pow((1-r)/(1+r),n)}var ET=20;function TT(){var r=Math.sin(this.lat0),n=Math.cos(this.lat0);n*=n,this.rc=Math.sqrt(1-this.es)/(1-this.es*r*r),this.C=Math.sqrt(1+this.es*n*n/(1-this.es)),this.phic0=Math.asin(r/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+_r)/(Math.pow(Math.tan(.5*this.lat0+_r),this.C)*rd(this.e*r,this.ratexp))}function MT(r){var n=r.x,s=r.y;return r.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*s+_r),this.C)*rd(this.e*Math.sin(s),this.ratexp))-Bt,r.x=this.C*n,r}function IT(r){for(var n=1e-14,s=r.x/this.C,p=r.y,i=Math.pow(Math.tan(.5*p+_r)/this.K,1/this.C),m=ET;m>0&&(p=2*Math.atan(i*rd(this.e*Math.sin(r.y),-.5*this.e))-Bt,!(Math.abs(p-r.y)<n));--m)r.y=p;return m?(r.x=s,r.y=p,r):null}var CT=["gauss"],id={init:TT,forward:MT,inverse:IT,names:CT};function AT(){id.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function PT(r){var n,s,p,i;return r.x=$t(r.x-this.long0),id.forward.apply(this,[r]),n=Math.sin(r.y),s=Math.cos(r.y),p=Math.cos(r.x),i=this.k0*this.R2/(1+this.sinc0*n+this.cosc0*s*p),r.x=i*s*Math.sin(r.x),r.y=i*(this.cosc0*n-this.sinc0*s*p),r.x=this.a*r.x+this.x0,r.y=this.a*r.y+this.y0,r}function LT(r){var n,s,p,i,m;if(r.x=(r.x-this.x0)/this.a,r.y=(r.y-this.y0)/this.a,r.x/=this.k0,r.y/=this.k0,m=Math.sqrt(r.x*r.x+r.y*r.y)){var v=2*Math.atan2(m,this.R2);n=Math.sin(v),s=Math.cos(v),i=Math.asin(s*this.sinc0+r.y*n*this.cosc0/m),p=Math.atan2(r.x*n,m*this.cosc0*s-r.y*this.sinc0*n)}else i=this.phic0,p=0;return r.x=p,r.y=i,id.inverse.apply(this,[r]),r.x=$t(r.x+this.long0),r}var kT=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],z_={init:AT,forward:PT,inverse:LT,names:kT};E();function RT(r,n,s){return n*=s,Math.tan(.5*(Bt+r))*Math.pow((1-n)/(1+n),.5*s)}function zT(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Ht&&(this.k0=.5*(1+wa(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=Ht&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Ht&&(this.k0=.5*this.cons*Fn(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Qn(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Fn(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-Bt,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function DT(r){var n=r.x,s=r.y,p=Math.sin(s),i=Math.cos(s),m,v,b,M,z,C,j=$t(n-this.long0);return Math.abs(Math.abs(n-this.long0)-Math.PI)<=Ht&&Math.abs(s+this.lat0)<=Ht?(r.x=NaN,r.y=NaN,r):this.sphere?(m=2*this.k0/(1+this.sinlat0*p+this.coslat0*i*Math.cos(j)),r.x=this.a*m*i*Math.sin(j)+this.x0,r.y=this.a*m*(this.coslat0*p-this.sinlat0*i*Math.cos(j))+this.y0,r):(v=2*Math.atan(this.ssfn_(s,p,this.e))-Bt,M=Math.cos(v),b=Math.sin(v),Math.abs(this.coslat0)<=Ht?(z=Qn(this.e,s*this.con,this.con*p),C=2*this.a*this.k0*z/this.cons,r.x=this.x0+C*Math.sin(n-this.long0),r.y=this.y0-this.con*C*Math.cos(n-this.long0),r):(Math.abs(this.sinlat0)<Ht?(m=2*this.a*this.k0/(1+M*Math.cos(j)),r.y=m*b):(m=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*b+this.cosX0*M*Math.cos(j))),r.y=m*(this.cosX0*b-this.sinX0*M*Math.cos(j))+this.y0),r.x=m*M*Math.sin(j)+this.x0,r))}function OT(r){r.x-=this.x0,r.y-=this.y0;var n,s,p,i,m,v=Math.sqrt(r.x*r.x+r.y*r.y);if(this.sphere){var b=2*Math.atan(v/(2*this.a*this.k0));return n=this.long0,s=this.lat0,v<=Ht?(r.x=n,r.y=s,r):(s=Math.asin(Math.cos(b)*this.sinlat0+r.y*Math.sin(b)*this.coslat0/v),Math.abs(this.coslat0)<Ht?this.lat0>0?n=$t(this.long0+Math.atan2(r.x,-1*r.y)):n=$t(this.long0+Math.atan2(r.x,r.y)):n=$t(this.long0+Math.atan2(r.x*Math.sin(b),v*this.coslat0*Math.cos(b)-r.y*this.sinlat0*Math.sin(b))),r.x=n,r.y=s,r)}else if(Math.abs(this.coslat0)<=Ht){if(v<=Ht)return s=this.lat0,n=this.long0,r.x=n,r.y=s,r;r.x*=this.con,r.y*=this.con,p=v*this.cons/(2*this.a*this.k0),s=this.con*ls(this.e,p),n=this.con*$t(this.con*this.long0+Math.atan2(r.x,-1*r.y))}else i=2*Math.atan(v*this.cosX0/(2*this.a*this.k0*this.ms1)),n=this.long0,v<=Ht?m=this.X0:(m=Math.asin(Math.cos(i)*this.sinX0+r.y*Math.sin(i)*this.cosX0/v),n=$t(this.long0+Math.atan2(r.x*Math.sin(i),v*this.cosX0*Math.cos(i)-r.y*this.sinX0*Math.sin(i)))),s=-1*ls(this.e,Math.tan(.5*(Bt+m)));return r.x=n,r.y=s,r}var NT=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],D_={init:zT,forward:DT,inverse:OT,names:NT,ssfn_:RT};E();function FT(){var r=this.lat0;this.lambda0=this.long0;var n=Math.sin(r),s=this.a,p=this.rf,i=1/p,m=2*i-Math.pow(i,2),v=this.e=Math.sqrt(m);this.R=this.k0*s*Math.sqrt(1-m)/(1-m*Math.pow(n,2)),this.alpha=Math.sqrt(1+m/(1-m)*Math.pow(Math.cos(r),4)),this.b0=Math.asin(n/this.alpha);var b=Math.log(Math.tan(Math.PI/4+this.b0/2)),M=Math.log(Math.tan(Math.PI/4+r/2)),z=Math.log((1+v*n)/(1-v*n));this.K=b-this.alpha*M+this.alpha*v/2*z}function BT(r){var n=Math.log(Math.tan(Math.PI/4-r.y/2)),s=this.e/2*Math.log((1+this.e*Math.sin(r.y))/(1-this.e*Math.sin(r.y))),p=-this.alpha*(n+s)+this.K,i=2*(Math.atan(Math.exp(p))-Math.PI/4),m=this.alpha*(r.x-this.lambda0),v=Math.atan(Math.sin(m)/(Math.sin(this.b0)*Math.tan(i)+Math.cos(this.b0)*Math.cos(m))),b=Math.asin(Math.cos(this.b0)*Math.sin(i)-Math.sin(this.b0)*Math.cos(i)*Math.cos(m));return r.y=this.R/2*Math.log((1+Math.sin(b))/(1-Math.sin(b)))+this.y0,r.x=this.R*v+this.x0,r}function UT(r){for(var n=r.x-this.x0,s=r.y-this.y0,p=n/this.R,i=2*(Math.atan(Math.exp(s/this.R))-Math.PI/4),m=Math.asin(Math.cos(this.b0)*Math.sin(i)+Math.sin(this.b0)*Math.cos(i)*Math.cos(p)),v=Math.atan(Math.sin(p)/(Math.cos(this.b0)*Math.cos(p)-Math.sin(this.b0)*Math.tan(i))),b=this.lambda0+v/this.alpha,M=0,z=m,C=-1e3,j=0;Math.abs(z-C)>1e-7;){if(++j>20)return;M=1/this.alpha*(Math.log(Math.tan(Math.PI/4+m/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(z))/2)),C=z,z=2*Math.atan(Math.exp(M))-Math.PI/2}return r.x=b,r.y=z,r}var GT=["somerc"],O_={init:FT,forward:BT,inverse:UT,names:GT};E();function VT(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var r=Math.sin(this.lat0),n=Math.cos(this.lat0),s=this.e*r;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(n,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-s*s);var p=Qn(this.e,this.lat0,r),i=this.bl/n*Math.sqrt((1-this.es)/(1-s*s));i*i<1&&(i=1);var m,v;if(!isNaN(this.longc))this.lat0>=0?m=i+Math.sqrt(i*i-1):m=i-Math.sqrt(i*i-1),this.el=m*Math.pow(p,this.bl),v=.5*(m-1/m),this.gamma0=Math.asin(Math.sin(this.alpha)/i),this.long0=this.longc-Math.asin(v*Math.tan(this.gamma0))/this.bl;else{var b=Qn(this.e,this.lat1,Math.sin(this.lat1)),M=Qn(this.e,this.lat2,Math.sin(this.lat2));this.lat0>=0?this.el=(i+Math.sqrt(i*i-1))*Math.pow(p,this.bl):this.el=(i-Math.sqrt(i*i-1))*Math.pow(p,this.bl);var z=Math.pow(b,this.bl),C=Math.pow(M,this.bl);m=this.el/z,v=.5*(m-1/m);var j=(this.el*this.el-C*z)/(this.el*this.el+C*z),Y=(C-z)/(C+z),ot=$t(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(j*Math.tan(.5*this.bl*ot)/Y)/this.bl,this.long0=$t(this.long0);var J=$t(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*J)/v),this.alpha=Math.asin(i*Math.sin(this.gamma0))}this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(i*i-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(i*i-1),Math.cos(this.alpha))}function jT(r){var n=r.x,s=r.y,p=$t(n-this.long0),i,m,v;if(Math.abs(Math.abs(s)-Bt)<=Ht)s>0?v=-1:v=1,m=this.al/this.bl*Math.log(Math.tan(_r+v*this.gamma0*.5)),i=-1*v*Bt*this.al/this.bl;else{var b=Qn(this.e,s,Math.sin(s)),M=this.el/Math.pow(b,this.bl),z=.5*(M-1/M),C=.5*(M+1/M),j=Math.sin(this.bl*p),Y=(z*Math.sin(this.gamma0)-j*Math.cos(this.gamma0))/C;Math.abs(Math.abs(Y)-1)<=Ht?m=Number.POSITIVE_INFINITY:m=.5*this.al*Math.log((1-Y)/(1+Y))/this.bl,Math.abs(Math.cos(this.bl*p))<=Ht?i=this.al*this.bl*p:i=this.al*Math.atan2(z*Math.cos(this.gamma0)+j*Math.sin(this.gamma0),Math.cos(this.bl*p))/this.bl}return this.no_rot?(r.x=this.x0+i,r.y=this.y0+m):(i-=this.uc,r.x=this.x0+m*Math.cos(this.alpha)+i*Math.sin(this.alpha),r.y=this.y0+i*Math.cos(this.alpha)-m*Math.sin(this.alpha)),r}function qT(r){var n,s;this.no_rot?(s=r.y-this.y0,n=r.x-this.x0):(s=(r.x-this.x0)*Math.cos(this.alpha)-(r.y-this.y0)*Math.sin(this.alpha),n=(r.y-this.y0)*Math.cos(this.alpha)+(r.x-this.x0)*Math.sin(this.alpha),n+=this.uc);var p=Math.exp(-1*this.bl*s/this.al),i=.5*(p-1/p),m=.5*(p+1/p),v=Math.sin(this.bl*n/this.al),b=(v*Math.cos(this.gamma0)+i*Math.sin(this.gamma0))/m,M=Math.pow(this.el/Math.sqrt((1+b)/(1-b)),1/this.bl);return Math.abs(b-1)<Ht?(r.x=this.long0,r.y=Bt):Math.abs(b+1)<Ht?(r.x=this.long0,r.y=-1*Bt):(r.y=ls(this.e,M),r.x=$t(this.long0-Math.atan2(i*Math.cos(this.gamma0)-v*Math.sin(this.gamma0),Math.cos(this.bl*n/this.al))/this.bl)),r}var WT=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"],N_={init:VT,forward:jT,inverse:qT,names:WT};E();function KT(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<Ht)){var r=this.b/this.a;this.e=Math.sqrt(1-r*r);var n=Math.sin(this.lat1),s=Math.cos(this.lat1),p=Fn(this.e,n,s),i=Qn(this.e,this.lat1,n),m=Math.sin(this.lat2),v=Math.cos(this.lat2),b=Fn(this.e,m,v),M=Qn(this.e,this.lat2,m),z=Qn(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>Ht?this.ns=Math.log(p/b)/Math.log(i/M):this.ns=n,isNaN(this.ns)&&(this.ns=n),this.f0=p/(this.ns*Math.pow(i,this.ns)),this.rh=this.a*this.f0*Math.pow(z,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function HT(r){var n=r.x,s=r.y;Math.abs(2*Math.abs(s)-Math.PI)<=Ht&&(s=wa(s)*(Bt-2*Ht));var p=Math.abs(Math.abs(s)-Bt),i,m;if(p>Ht)i=Qn(this.e,s,Math.sin(s)),m=this.a*this.f0*Math.pow(i,this.ns);else{if(p=s*this.ns,p<=0)return null;m=0}var v=this.ns*$t(n-this.long0);return r.x=this.k0*(m*Math.sin(v))+this.x0,r.y=this.k0*(this.rh-m*Math.cos(v))+this.y0,r}function ZT(r){var n,s,p,i,m,v=(r.x-this.x0)/this.k0,b=this.rh-(r.y-this.y0)/this.k0;this.ns>0?(n=Math.sqrt(v*v+b*b),s=1):(n=-Math.sqrt(v*v+b*b),s=-1);var M=0;if(n!==0&&(M=Math.atan2(s*v,s*b)),n!==0||this.ns>0){if(s=1/this.ns,p=Math.pow(n/(this.a*this.f0),s),i=ls(this.e,p),i===-9999)return null}else i=-Bt;return m=$t(M/this.ns+this.long0),r.x=m,r.y=i,r}var XT=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"],F_={init:KT,forward:HT,inverse:ZT,names:XT};E();function YT(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function JT(r){var n,s,p,i,m,v,b,M=r.x,z=r.y,C=$t(M-this.long0);return n=Math.pow((1+this.e*Math.sin(z))/(1-this.e*Math.sin(z)),this.alfa*this.e/2),s=2*(Math.atan(this.k*Math.pow(Math.tan(z/2+this.s45),this.alfa)/n)-this.s45),p=-C*this.alfa,i=Math.asin(Math.cos(this.ad)*Math.sin(s)+Math.sin(this.ad)*Math.cos(s)*Math.cos(p)),m=Math.asin(Math.cos(s)*Math.sin(p)/Math.cos(i)),v=this.n*m,b=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(i/2+this.s45),this.n),r.y=b*Math.cos(v)/1,r.x=b*Math.sin(v)/1,this.czech||(r.y*=-1,r.x*=-1),r}function QT(r){var n,s,p,i,m,v,b,M,z=r.x;r.x=r.y,r.y=z,this.czech||(r.y*=-1,r.x*=-1),v=Math.sqrt(r.x*r.x+r.y*r.y),m=Math.atan2(r.y,r.x),i=m/Math.sin(this.s0),p=2*(Math.atan(Math.pow(this.ro0/v,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),n=Math.asin(Math.cos(this.ad)*Math.sin(p)-Math.sin(this.ad)*Math.cos(p)*Math.cos(i)),s=Math.asin(Math.cos(p)*Math.sin(i)/Math.cos(n)),r.x=this.long0-s/this.alfa,b=n,M=0;var C=0;do r.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(n/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(b))/(1-this.e*Math.sin(b)),this.e/2))-this.s45),Math.abs(b-r.y)<1e-10&&(M=1),b=r.y,C+=1;while(M===0&&C<15);return C>=15?null:r}var $T=["Krovak","krovak"],B_={init:YT,forward:JT,inverse:QT,names:$T};E();E();function an(r,n,s,p,i){return r*i-n*Math.sin(2*i)+s*Math.sin(4*i)-p*Math.sin(6*i)}E();function us(r){return 1-.25*r*(1+r/16*(3+1.25*r))}E();function hs(r){return .375*r*(1+.25*r*(1+.46875*r))}E();function cs(r){return .05859375*r*r*(1+.75*r)}E();function ps(r){return r*r*r*(35/3072)}E();function fs(r,n,s){var p=n*s;return r/Math.sqrt(1-p*p)}E();function Xo(r){return Math.abs(r)<Bt?r:r-wa(r)*Math.PI}E();function jl(r,n,s,p,i){var m,v;m=r/n;for(var b=0;b<15;b++)if(v=(r-(n*m-s*Math.sin(2*m)+p*Math.sin(4*m)-i*Math.sin(6*m)))/(n-2*s*Math.cos(2*m)+4*p*Math.cos(4*m)-6*i*Math.cos(6*m)),m+=v,Math.abs(v)<=1e-10)return m;return NaN}function tM(){this.sphere||(this.e0=us(this.es),this.e1=hs(this.es),this.e2=cs(this.es),this.e3=ps(this.es),this.ml0=this.a*an(this.e0,this.e1,this.e2,this.e3,this.lat0))}function eM(r){var n,s,p=r.x,i=r.y;if(p=$t(p-this.long0),this.sphere)n=this.a*Math.asin(Math.cos(i)*Math.sin(p)),s=this.a*(Math.atan2(Math.tan(i),Math.cos(p))-this.lat0);else{var m=Math.sin(i),v=Math.cos(i),b=fs(this.a,this.e,m),M=Math.tan(i)*Math.tan(i),z=p*Math.cos(i),C=z*z,j=this.es*v*v/(1-this.es),Y=this.a*an(this.e0,this.e1,this.e2,this.e3,i);n=b*z*(1-C*M*(1/6-(8-M+8*j)*C/120)),s=Y-this.ml0+b*m/v*C*(.5+(5-M+6*j)*C/24)}return r.x=n+this.x0,r.y=s+this.y0,r}function rM(r){r.x-=this.x0,r.y-=this.y0;var n=r.x/this.a,s=r.y/this.a,p,i;if(this.sphere){var m=s+this.lat0;p=Math.asin(Math.sin(m)*Math.cos(n)),i=Math.atan2(Math.tan(n),Math.cos(m))}else{var v=this.ml0/this.a+s,b=jl(v,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(b)-Bt)<=Ht)return r.x=this.long0,r.y=Bt,s<0&&(r.y*=-1),r;var M=fs(this.a,this.e,Math.sin(b)),z=M*M*M/this.a/this.a*(1-this.es),C=Math.pow(Math.tan(b),2),j=n*this.a/M,Y=j*j;p=b-M*Math.tan(b)/z*j*j*(.5-(1+3*C)*j*j/24),i=j*(1-Y*(C/3+(1+3*C)*C*Y/15))/Math.cos(b)}return r.x=$t(i+this.long0),r.y=Xo(p),r}var iM=["Cassini","Cassini_Soldner","cass"],U_={init:tM,forward:eM,inverse:rM,names:iM};E();E();function Yo(r,n){var s;return r>1e-7?(s=r*n,(1-r*r)*(n/(1-s*s)-.5/r*Math.log((1-s)/(1+s)))):2*n}var nM=1,oM=2,aM=3,sM=4;function lM(){var r=Math.abs(this.lat0);if(Math.abs(r-Bt)<Ht?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(r)<Ht?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var n;switch(this.qp=Yo(this.e,1),this.mmf=.5/(1-this.es),this.apa=gM(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),n=Math.sin(this.lat0),this.sinb1=Yo(this.e,n)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*n*n)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function uM(r){var n,s,p,i,m,v,b,M,z,C,j=r.x,Y=r.y;if(j=$t(j-this.long0),this.sphere){if(m=Math.sin(Y),C=Math.cos(Y),p=Math.cos(j),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(s=this.mode===this.EQUIT?1+C*p:1+this.sinph0*m+this.cosph0*C*p,s<=Ht)return null;s=Math.sqrt(2/s),n=s*C*Math.sin(j),s*=this.mode===this.EQUIT?m:this.cosph0*m-this.sinph0*C*p}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(p=-p),Math.abs(Y+this.lat0)<Ht)return null;s=_r-Y*.5,s=2*(this.mode===this.S_POLE?Math.cos(s):Math.sin(s)),n=s*Math.sin(j),s*=p}}else{switch(b=0,M=0,z=0,p=Math.cos(j),i=Math.sin(j),m=Math.sin(Y),v=Yo(this.e,m),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(b=v/this.qp,M=Math.sqrt(1-b*b)),this.mode){case this.OBLIQ:z=1+this.sinb1*b+this.cosb1*M*p;break;case this.EQUIT:z=1+M*p;break;case this.N_POLE:z=Bt+Y,v=this.qp-v;break;case this.S_POLE:z=Y-Bt,v=this.qp+v;break}if(Math.abs(z)<Ht)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:z=Math.sqrt(2/z),this.mode===this.OBLIQ?s=this.ymf*z*(this.cosb1*b-this.sinb1*M*p):s=(z=Math.sqrt(2/(1+M*p)))*b*this.ymf,n=this.xmf*z*M*i;break;case this.N_POLE:case this.S_POLE:v>=0?(n=(z=Math.sqrt(v))*i,s=p*(this.mode===this.S_POLE?z:-z)):n=s=0;break}}return r.x=this.a*n+this.x0,r.y=this.a*s+this.y0,r}function hM(r){r.x-=this.x0,r.y-=this.y0;var n=r.x/this.a,s=r.y/this.a,p,i,m,v,b,M,z;if(this.sphere){var C=0,j,Y=0;if(j=Math.sqrt(n*n+s*s),i=j*.5,i>1)return null;switch(i=2*Math.asin(i),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(Y=Math.sin(i),C=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(j)<=Ht?0:Math.asin(s*Y/j),n*=Y,s=C*j;break;case this.OBLIQ:i=Math.abs(j)<=Ht?this.lat0:Math.asin(C*this.sinph0+s*Y*this.cosph0/j),n*=Y*this.cosph0,s=(C-Math.sin(i)*this.sinph0)*j;break;case this.N_POLE:s=-s,i=Bt-i;break;case this.S_POLE:i-=Bt;break}p=s===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(n,s)}else{if(z=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(n/=this.dd,s*=this.dd,M=Math.sqrt(n*n+s*s),M<Ht)return r.x=this.long0,r.y=this.lat0,r;v=2*Math.asin(.5*M/this.rq),m=Math.cos(v),n*=v=Math.sin(v),this.mode===this.OBLIQ?(z=m*this.sinb1+s*v*this.cosb1/M,b=this.qp*z,s=M*this.cosb1*m-s*this.sinb1*v):(z=s*v/M,b=this.qp*z,s=M*m)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(s=-s),b=n*n+s*s,!b)return r.x=this.long0,r.y=this.lat0,r;z=1-b/this.qp,this.mode===this.S_POLE&&(z=-z)}p=Math.atan2(n,s),i=vM(Math.asin(z),this.apa)}return r.x=$t(this.long0+p),r.y=i,r}var cM=.3333333333333333,pM=.17222222222222222,fM=.10257936507936508,dM=.06388888888888888,mM=.0664021164021164,yM=.016415012942191543;function gM(r){var n,s=[];return s[0]=r*cM,n=r*r,s[0]+=n*pM,s[1]=n*dM,n*=r,s[0]+=n*fM,s[1]+=n*mM,s[2]=n*yM,s}function vM(r,n){var s=r+r;return r+n[0]*Math.sin(s)+n[1]*Math.sin(s+s)+n[2]*Math.sin(s+s+s)}var _M=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],G_={init:lM,forward:uM,inverse:hM,names:_M,S_POLE:nM,N_POLE:oM,EQUIT:aM,OBLIQ:sM};E();E();function ho(r){return Math.abs(r)>1&&(r=r>1?1:-1),Math.asin(r)}function xM(){Math.abs(this.lat1+this.lat2)<Ht||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=Fn(this.e3,this.sin_po,this.cos_po),this.qs1=Yo(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=Fn(this.e3,this.sin_po,this.cos_po),this.qs2=Yo(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=Yo(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>Ht?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function bM(r){var n=r.x,s=r.y;this.sin_phi=Math.sin(s),this.cos_phi=Math.cos(s);var p=Yo(this.e3,this.sin_phi,this.cos_phi),i=this.a*Math.sqrt(this.c-this.ns0*p)/this.ns0,m=this.ns0*$t(n-this.long0),v=i*Math.sin(m)+this.x0,b=this.rh-i*Math.cos(m)+this.y0;return r.x=v,r.y=b,r}function wM(r){var n,s,p,i,m,v;return r.x-=this.x0,r.y=this.rh-r.y+this.y0,this.ns0>=0?(n=Math.sqrt(r.x*r.x+r.y*r.y),p=1):(n=-Math.sqrt(r.x*r.x+r.y*r.y),p=-1),i=0,n!==0&&(i=Math.atan2(p*r.x,p*r.y)),p=n*this.ns0/this.a,this.sphere?v=Math.asin((this.c-p*p)/(2*this.ns0)):(s=(this.c-p*p)/this.ns0,v=this.phi1z(this.e3,s)),m=$t(i/this.ns0+this.long0),r.x=m,r.y=v,r}function SM(r,n){var s,p,i,m,v,b=ho(.5*n);if(r<Ht)return b;for(var M=r*r,z=1;z<=25;z++)if(s=Math.sin(b),p=Math.cos(b),i=r*s,m=1-i*i,v=.5*m*m/p*(n/(1-M)-s/m+.5/r*Math.log((1-i)/(1+i))),b=b+v,Math.abs(v)<=1e-7)return b;return null}var EM=["Albers_Conic_Equal_Area","Albers","aea"],V_={init:xM,forward:bM,inverse:wM,names:EM,phi1z:SM};E();function TM(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function MM(r){var n,s,p,i,m,v,b,M,z=r.x,C=r.y;return p=$t(z-this.long0),n=Math.sin(C),s=Math.cos(C),i=Math.cos(p),v=this.sin_p14*n+this.cos_p14*s*i,m=1,v>0||Math.abs(v)<=Ht?(b=this.x0+this.a*m*s*Math.sin(p)/v,M=this.y0+this.a*m*(this.cos_p14*n-this.sin_p14*s*i)/v):(b=this.x0+this.infinity_dist*s*Math.sin(p),M=this.y0+this.infinity_dist*(this.cos_p14*n-this.sin_p14*s*i)),r.x=b,r.y=M,r}function IM(r){var n,s,p,i,m,v;return r.x=(r.x-this.x0)/this.a,r.y=(r.y-this.y0)/this.a,r.x/=this.k0,r.y/=this.k0,(n=Math.sqrt(r.x*r.x+r.y*r.y))?(i=Math.atan2(n,this.rc),s=Math.sin(i),p=Math.cos(i),v=ho(p*this.sin_p14+r.y*s*this.cos_p14/n),m=Math.atan2(r.x*s,n*this.cos_p14*p-r.y*this.sin_p14*s),m=$t(this.long0+m)):(v=this.phic0,m=0),r.x=m,r.y=v,r}var CM=["gnom"],j_={init:TM,forward:MM,inverse:IM,names:CM};E();E();function q_(r,n){var s=1-(1-r*r)/(2*r)*Math.log((1-r)/(1+r));if(Math.abs(Math.abs(n)-s)<1e-6)return n<0?-1*Bt:Bt;for(var p=Math.asin(.5*n),i,m,v,b,M=0;M<30;M++)if(m=Math.sin(p),v=Math.cos(p),b=r*m,i=Math.pow(1-b*b,2)/(2*v)*(n/(1-r*r)-m/(1-b*b)+.5/r*Math.log((1-b)/(1+b))),p+=i,Math.abs(i)<=1e-10)return p;return NaN}function AM(){this.sphere||(this.k0=Fn(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function PM(r){var n=r.x,s=r.y,p,i,m=$t(n-this.long0);if(this.sphere)p=this.x0+this.a*m*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(s)/Math.cos(this.lat_ts);else{var v=Yo(this.e,Math.sin(s));p=this.x0+this.a*this.k0*m,i=this.y0+this.a*v*.5/this.k0}return r.x=p,r.y=i,r}function LM(r){r.x-=this.x0,r.y-=this.y0;var n,s;return this.sphere?(n=$t(this.long0+r.x/this.a/Math.cos(this.lat_ts)),s=Math.asin(r.y/this.a*Math.cos(this.lat_ts))):(s=q_(this.e,2*r.y*this.k0/this.a),n=$t(this.long0+r.x/(this.a*this.k0))),r.x=n,r.y=s,r}var kM=["cea"],W_={init:AM,forward:PM,inverse:LM,names:kM};E();function RM(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function zM(r){var n=r.x,s=r.y,p=$t(n-this.long0),i=Xo(s-this.lat0);return r.x=this.x0+this.a*p*this.rc,r.y=this.y0+this.a*i,r}function DM(r){var n=r.x,s=r.y;return r.x=$t(this.long0+(n-this.x0)/(this.a*this.rc)),r.y=Xo(this.lat0+(s-this.y0)/this.a),r}var OM=["Equirectangular","Equidistant_Cylindrical","eqc"],K_={init:RM,forward:zM,inverse:DM,names:OM};E();var H_=20;function NM(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=us(this.es),this.e1=hs(this.es),this.e2=cs(this.es),this.e3=ps(this.es),this.ml0=this.a*an(this.e0,this.e1,this.e2,this.e3,this.lat0)}function FM(r){var n=r.x,s=r.y,p,i,m,v=$t(n-this.long0);if(m=v*Math.sin(s),this.sphere)Math.abs(s)<=Ht?(p=this.a*v,i=-1*this.a*this.lat0):(p=this.a*Math.sin(m)/Math.tan(s),i=this.a*(Xo(s-this.lat0)+(1-Math.cos(m))/Math.tan(s)));else if(Math.abs(s)<=Ht)p=this.a*v,i=-1*this.ml0;else{var b=fs(this.a,this.e,Math.sin(s))/Math.tan(s);p=b*Math.sin(m),i=this.a*an(this.e0,this.e1,this.e2,this.e3,s)-this.ml0+b*(1-Math.cos(m))}return r.x=p+this.x0,r.y=i+this.y0,r}function BM(r){var n,s,p,i,m,v,b,M,z;if(p=r.x-this.x0,i=r.y-this.y0,this.sphere)if(Math.abs(i+this.a*this.lat0)<=Ht)n=$t(p/this.a+this.long0),s=0;else{v=this.lat0+i/this.a,b=p*p/this.a/this.a+v*v,M=v;var C;for(m=H_;m;--m)if(C=Math.tan(M),z=-1*(v*(M*C+1)-M-.5*(M*M+b)*C)/((M-v)/C-1),M+=z,Math.abs(z)<=Ht){s=M;break}n=$t(this.long0+Math.asin(p*Math.tan(M)/this.a)/Math.sin(s))}else if(Math.abs(i+this.ml0)<=Ht)s=0,n=$t(this.long0+p/this.a);else{v=(this.ml0+i)/this.a,b=p*p/this.a/this.a+v*v,M=v;var j,Y,ot,J,mt;for(m=H_;m;--m)if(mt=this.e*Math.sin(M),j=Math.sqrt(1-mt*mt)*Math.tan(M),Y=this.a*an(this.e0,this.e1,this.e2,this.e3,M),ot=this.e0-2*this.e1*Math.cos(2*M)+4*this.e2*Math.cos(4*M)-6*this.e3*Math.cos(6*M),J=Y/this.a,z=(v*(j*J+1)-J-.5*j*(J*J+b))/(this.es*Math.sin(2*M)*(J*J+b-2*v*J)/(4*j)+(v-J)*(j*ot-2/Math.sin(2*M))-ot),M-=z,Math.abs(z)<=Ht){s=M;break}j=Math.sqrt(1-this.es*Math.pow(Math.sin(s),2))*Math.tan(s),n=$t(this.long0+Math.asin(p*j/this.a)/Math.sin(s))}return r.x=n,r.y=s,r}var UM=["Polyconic","poly"],Z_={init:NM,forward:FM,inverse:BM,names:UM};E();function GM(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function VM(r){var n,s=r.x,p=r.y,i=p-this.lat0,m=s-this.long0,v=i/Fl*1e-5,b=m,M=1,z=0;for(n=1;n<=10;n++)M=M*v,z=z+this.A[n]*M;var C=z,j=b,Y=1,ot=0,J,mt,ft=0,At=0;for(n=1;n<=6;n++)J=Y*C-ot*j,mt=ot*C+Y*j,Y=J,ot=mt,ft=ft+this.B_re[n]*Y-this.B_im[n]*ot,At=At+this.B_im[n]*Y+this.B_re[n]*ot;return r.x=At*this.a+this.x0,r.y=ft*this.a+this.y0,r}function jM(r){var n,s=r.x,p=r.y,i=s-this.x0,m=p-this.y0,v=m/this.a,b=i/this.a,M=1,z=0,C,j,Y=0,ot=0;for(n=1;n<=6;n++)C=M*v-z*b,j=z*v+M*b,M=C,z=j,Y=Y+this.C_re[n]*M-this.C_im[n]*z,ot=ot+this.C_im[n]*M+this.C_re[n]*z;for(var J=0;J<this.iterations;J++){var mt=Y,ft=ot,At,Gt,Zt=v,we=b;for(n=2;n<=6;n++)At=mt*Y-ft*ot,Gt=ft*Y+mt*ot,mt=At,ft=Gt,Zt=Zt+(n-1)*(this.B_re[n]*mt-this.B_im[n]*ft),we=we+(n-1)*(this.B_im[n]*mt+this.B_re[n]*ft);mt=1,ft=0;var he=this.B_re[1],Kt=this.B_im[1];for(n=2;n<=6;n++)At=mt*Y-ft*ot,Gt=ft*Y+mt*ot,mt=At,ft=Gt,he=he+n*(this.B_re[n]*mt-this.B_im[n]*ft),Kt=Kt+n*(this.B_im[n]*mt+this.B_re[n]*ft);var ce=he*he+Kt*Kt;Y=(Zt*he+we*Kt)/ce,ot=(we*he-Zt*Kt)/ce}var Yt=Y,Te=ot,dr=1,Le=0;for(n=1;n<=9;n++)dr=dr*Yt,Le=Le+this.D[n]*dr;var hr=this.lat0+Le*Fl*1e5,Ur=this.long0+Te;return r.x=Ur,r.y=hr,r}var qM=["New_Zealand_Map_Grid","nzmg"],X_={init:GM,forward:VM,inverse:jM,names:qM};E();function WM(){}function KM(r){var n=r.x,s=r.y,p=$t(n-this.long0),i=this.x0+this.a*p,m=this.y0+this.a*Math.log(Math.tan(Math.PI/4+s/2.5))*1.25;return r.x=i,r.y=m,r}function HM(r){r.x-=this.x0,r.y-=this.y0;var n=$t(this.long0+r.x/this.a),s=2.5*(Math.atan(Math.exp(.8*r.y/this.a))-Math.PI/4);return r.x=n,r.y=s,r}var ZM=["Miller_Cylindrical","mill"],Y_={init:WM,forward:KM,inverse:HM,names:ZM};E();var XM=20;function YM(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=Qf(this.es)}function JM(r){var n,s,p=r.x,i=r.y;if(p=$t(p-this.long0),this.sphere){if(!this.m)i=this.n!==1?Math.asin(this.n*Math.sin(i)):i;else for(var m=this.n*Math.sin(i),v=XM;v;--v){var b=(this.m*i+Math.sin(i)-m)/(this.m+Math.cos(i));if(i-=b,Math.abs(b)<Ht)break}n=this.a*this.C_x*p*(this.m+Math.cos(i)),s=this.a*this.C_y*i}else{var M=Math.sin(i),z=Math.cos(i);s=this.a*Gl(i,M,z,this.en),n=this.a*p*z/Math.sqrt(1-this.es*M*M)}return r.x=n,r.y=s,r}function QM(r){var n,s,p,i;return r.x-=this.x0,p=r.x/this.a,r.y-=this.y0,n=r.y/this.a,this.sphere?(n/=this.C_y,p=p/(this.C_x*(this.m+Math.cos(n))),this.m?n=ho((this.m*n+Math.sin(n))/this.n):this.n!==1&&(n=ho(Math.sin(n)/this.n)),p=$t(p+this.long0),n=Xo(n)):(n=$f(r.y/this.a,this.es,this.en),i=Math.abs(n),i<Bt?(i=Math.sin(n),s=this.long0+r.x*Math.sqrt(1-this.es*i*i)/(this.a*Math.cos(n)),p=$t(s)):i-Ht<Bt&&(p=this.long0)),r.x=p,r.y=n,r}var $M=["Sinusoidal","sinu"],J_={init:YM,forward:JM,inverse:QM,names:$M};E();function tI(){}function eI(r){for(var n=r.x,s=r.y,p=$t(n-this.long0),i=s,m=Math.PI*Math.sin(s);;){var v=-(i+Math.sin(i)-m)/(1+Math.cos(i));if(i+=v,Math.abs(v)<Ht)break}i/=2,Math.PI/2-Math.abs(s)<Ht&&(p=0);var b=.900316316158*this.a*p*Math.cos(i)+this.x0,M=1.4142135623731*this.a*Math.sin(i)+this.y0;return r.x=b,r.y=M,r}function rI(r){var n,s;r.x-=this.x0,r.y-=this.y0,s=r.y/(1.4142135623731*this.a),Math.abs(s)>.999999999999&&(s=.999999999999),n=Math.asin(s);var p=$t(this.long0+r.x/(.900316316158*this.a*Math.cos(n)));p<-Math.PI&&(p=-Math.PI),p>Math.PI&&(p=Math.PI),s=(2*n+Math.sin(2*n))/Math.PI,Math.abs(s)>1&&(s=1);var i=Math.asin(s);return r.x=p,r.y=i,r}var iI=["Mollweide","moll"],Q_={init:tI,forward:eI,inverse:rI,names:iI};E();function nI(){Math.abs(this.lat1+this.lat2)<Ht||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=us(this.es),this.e1=hs(this.es),this.e2=cs(this.es),this.e3=ps(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=Fn(this.e,this.sinphi,this.cosphi),this.ml1=an(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<Ht?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=Fn(this.e,this.sinphi,this.cosphi),this.ml2=an(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=an(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function oI(r){var n=r.x,s=r.y,p;if(this.sphere)p=this.a*(this.g-s);else{var i=an(this.e0,this.e1,this.e2,this.e3,s);p=this.a*(this.g-i)}var m=this.ns*$t(n-this.long0),v=this.x0+p*Math.sin(m),b=this.y0+this.rh-p*Math.cos(m);return r.x=v,r.y=b,r}function aI(r){r.x-=this.x0,r.y=this.rh-r.y+this.y0;var n,s,p,i;this.ns>=0?(s=Math.sqrt(r.x*r.x+r.y*r.y),n=1):(s=-Math.sqrt(r.x*r.x+r.y*r.y),n=-1);var m=0;if(s!==0&&(m=Math.atan2(n*r.x,n*r.y)),this.sphere)return i=$t(this.long0+m/this.ns),p=Xo(this.g-s/this.a),r.x=i,r.y=p,r;var v=this.g-s/this.a;return p=jl(v,this.e0,this.e1,this.e2,this.e3),i=$t(this.long0+m/this.ns),r.x=i,r.y=p,r}var sI=["Equidistant_Conic","eqdc"],$_={init:nI,forward:oI,inverse:aI,names:sI};E();function lI(){this.R=this.a}function uI(r){var n=r.x,s=r.y,p=$t(n-this.long0),i,m;Math.abs(s)<=Ht&&(i=this.x0+this.R*p,m=this.y0);var v=ho(2*Math.abs(s/Math.PI));(Math.abs(p)<=Ht||Math.abs(Math.abs(s)-Bt)<=Ht)&&(i=this.x0,s>=0?m=this.y0+Math.PI*this.R*Math.tan(.5*v):m=this.y0+Math.PI*this.R*-Math.tan(.5*v));var b=.5*Math.abs(Math.PI/p-p/Math.PI),M=b*b,z=Math.sin(v),C=Math.cos(v),j=C/(z+C-1),Y=j*j,ot=j*(2/z-1),J=ot*ot,mt=Math.PI*this.R*(b*(j-J)+Math.sqrt(M*(j-J)*(j-J)-(J+M)*(Y-J)))/(J+M);p<0&&(mt=-mt),i=this.x0+mt;var ft=M+j;return mt=Math.PI*this.R*(ot*ft-b*Math.sqrt((J+M)*(M+1)-ft*ft))/(J+M),s>=0?m=this.y0+mt:m=this.y0-mt,r.x=i,r.y=m,r}function hI(r){var n,s,p,i,m,v,b,M,z,C,j,Y,ot;return r.x-=this.x0,r.y-=this.y0,j=Math.PI*this.R,p=r.x/j,i=r.y/j,m=p*p+i*i,v=-Math.abs(i)*(1+m),b=v-2*i*i+p*p,M=-2*v+1+2*i*i+m*m,ot=i*i/M+(2*b*b*b/M/M/M-9*v*b/M/M)/27,z=(v-b*b/3/M)/M,C=2*Math.sqrt(-z/3),j=3*ot/z/C,Math.abs(j)>1&&(j>=0?j=1:j=-1),Y=Math.acos(j)/3,r.y>=0?s=(-C*Math.cos(Y+Math.PI/3)-b/3/M)*Math.PI:s=-(-C*Math.cos(Y+Math.PI/3)-b/3/M)*Math.PI,Math.abs(p)<Ht?n=this.long0:n=$t(this.long0+Math.PI*(m-1+Math.sqrt(1+2*(p*p-i*i)+m*m))/2/p),r.x=n,r.y=s,r}var cI=["Van_der_Grinten_I","VanDerGrinten","vandg"],tx={init:lI,forward:uI,inverse:hI,names:cI};E();function pI(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function fI(r){var n=r.x,s=r.y,p=Math.sin(r.y),i=Math.cos(r.y),m=$t(n-this.long0),v,b,M,z,C,j,Y,ot,J,mt,ft,At,Gt,Zt,we,he,Kt,ce,Yt,Te,dr,Le,hr;return this.sphere?Math.abs(this.sin_p12-1)<=Ht?(r.x=this.x0+this.a*(Bt-s)*Math.sin(m),r.y=this.y0-this.a*(Bt-s)*Math.cos(m),r):Math.abs(this.sin_p12+1)<=Ht?(r.x=this.x0+this.a*(Bt+s)*Math.sin(m),r.y=this.y0+this.a*(Bt+s)*Math.cos(m),r):(ce=this.sin_p12*p+this.cos_p12*i*Math.cos(m),he=Math.acos(ce),Kt=he?he/Math.sin(he):1,r.x=this.x0+this.a*Kt*i*Math.sin(m),r.y=this.y0+this.a*Kt*(this.cos_p12*p-this.sin_p12*i*Math.cos(m)),r):(v=us(this.es),b=hs(this.es),M=cs(this.es),z=ps(this.es),Math.abs(this.sin_p12-1)<=Ht?(C=this.a*an(v,b,M,z,Bt),j=this.a*an(v,b,M,z,s),r.x=this.x0+(C-j)*Math.sin(m),r.y=this.y0-(C-j)*Math.cos(m),r):Math.abs(this.sin_p12+1)<=Ht?(C=this.a*an(v,b,M,z,Bt),j=this.a*an(v,b,M,z,s),r.x=this.x0+(C+j)*Math.sin(m),r.y=this.y0+(C+j)*Math.cos(m),r):(Y=p/i,ot=fs(this.a,this.e,this.sin_p12),J=fs(this.a,this.e,p),mt=Math.atan((1-this.es)*Y+this.es*ot*this.sin_p12/(J*i)),ft=Math.atan2(Math.sin(m),this.cos_p12*Math.tan(mt)-this.sin_p12*Math.cos(m)),ft===0?Yt=Math.asin(this.cos_p12*Math.sin(mt)-this.sin_p12*Math.cos(mt)):Math.abs(Math.abs(ft)-Math.PI)<=Ht?Yt=-Math.asin(this.cos_p12*Math.sin(mt)-this.sin_p12*Math.cos(mt)):Yt=Math.asin(Math.sin(m)*Math.cos(mt)/Math.sin(ft)),At=this.e*this.sin_p12/Math.sqrt(1-this.es),Gt=this.e*this.cos_p12*Math.cos(ft)/Math.sqrt(1-this.es),Zt=At*Gt,we=Gt*Gt,Te=Yt*Yt,dr=Te*Yt,Le=dr*Yt,hr=Le*Yt,he=ot*Yt*(1-Te*we*(1-we)/6+dr/8*Zt*(1-2*we)+Le/120*(we*(4-7*we)-3*At*At*(1-7*we))-hr/48*Zt),r.x=this.x0+he*Math.sin(ft),r.y=this.y0+he*Math.cos(ft),r))}function dI(r){r.x-=this.x0,r.y-=this.y0;var n,s,p,i,m,v,b,M,z,C,j,Y,ot,J,mt,ft,At,Gt,Zt,we,he,Kt,ce,Yt;return this.sphere?(n=Math.sqrt(r.x*r.x+r.y*r.y),n>2*Bt*this.a?void 0:(s=n/this.a,p=Math.sin(s),i=Math.cos(s),m=this.long0,Math.abs(n)<=Ht?v=this.lat0:(v=ho(i*this.sin_p12+r.y*p*this.cos_p12/n),b=Math.abs(this.lat0)-Bt,Math.abs(b)<=Ht?this.lat0>=0?m=$t(this.long0+Math.atan2(r.x,-r.y)):m=$t(this.long0-Math.atan2(-r.x,r.y)):m=$t(this.long0+Math.atan2(r.x*p,n*this.cos_p12*i-r.y*this.sin_p12*p))),r.x=m,r.y=v,r)):(M=us(this.es),z=hs(this.es),C=cs(this.es),j=ps(this.es),Math.abs(this.sin_p12-1)<=Ht?(Y=this.a*an(M,z,C,j,Bt),n=Math.sqrt(r.x*r.x+r.y*r.y),ot=Y-n,v=jl(ot/this.a,M,z,C,j),m=$t(this.long0+Math.atan2(r.x,-1*r.y)),r.x=m,r.y=v,r):Math.abs(this.sin_p12+1)<=Ht?(Y=this.a*an(M,z,C,j,Bt),n=Math.sqrt(r.x*r.x+r.y*r.y),ot=n-Y,v=jl(ot/this.a,M,z,C,j),m=$t(this.long0+Math.atan2(r.x,r.y)),r.x=m,r.y=v,r):(n=Math.sqrt(r.x*r.x+r.y*r.y),ft=Math.atan2(r.x,r.y),J=fs(this.a,this.e,this.sin_p12),At=Math.cos(ft),Gt=this.e*this.cos_p12*At,Zt=-Gt*Gt/(1-this.es),we=3*this.es*(1-Zt)*this.sin_p12*this.cos_p12*At/(1-this.es),he=n/J,Kt=he-Zt*(1+Zt)*Math.pow(he,3)/6-we*(1+3*Zt)*Math.pow(he,4)/24,ce=1-Zt*Kt*Kt/2-he*Kt*Kt*Kt/6,mt=Math.asin(this.sin_p12*Math.cos(Kt)+this.cos_p12*Math.sin(Kt)*At),m=$t(this.long0+Math.asin(Math.sin(ft)*Math.sin(Kt)/Math.cos(mt))),Yt=Math.sin(mt),v=Math.atan2((Yt-this.es*ce*this.sin_p12)*Math.tan(mt),Yt*(1-this.es)),r.x=m,r.y=v,r))}var mI=["Azimuthal_Equidistant","aeqd"],ex={init:pI,forward:fI,inverse:dI,names:mI};E();function yI(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function gI(r){var n,s,p,i,m,v,b,M,z=r.x,C=r.y;return p=$t(z-this.long0),n=Math.sin(C),s=Math.cos(C),i=Math.cos(p),v=this.sin_p14*n+this.cos_p14*s*i,m=1,(v>0||Math.abs(v)<=Ht)&&(b=this.a*m*s*Math.sin(p),M=this.y0+this.a*m*(this.cos_p14*n-this.sin_p14*s*i)),r.x=b,r.y=M,r}function vI(r){var n,s,p,i,m,v,b;return r.x-=this.x0,r.y-=this.y0,n=Math.sqrt(r.x*r.x+r.y*r.y),s=ho(n/this.a),p=Math.sin(s),i=Math.cos(s),v=this.long0,Math.abs(n)<=Ht?(b=this.lat0,r.x=v,r.y=b,r):(b=ho(i*this.sin_p14+r.y*p*this.cos_p14/n),m=Math.abs(this.lat0)-Bt,Math.abs(m)<=Ht?(this.lat0>=0?v=$t(this.long0+Math.atan2(r.x,-r.y)):v=$t(this.long0-Math.atan2(-r.x,r.y)),r.x=v,r.y=b,r):(v=$t(this.long0+Math.atan2(r.x*p,n*this.cos_p14*i-r.y*this.sin_p14*p)),r.x=v,r.y=b,r))}var _I=["ortho"],rx={init:yI,forward:gI,inverse:vI,names:_I};E();var Ii={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},Br={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function xI(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=Bt-_r/2?this.face=Ii.TOP:this.lat0<=-(Bt-_r/2)?this.face=Ii.BOTTOM:Math.abs(this.long0)<=_r?this.face=Ii.FRONT:Math.abs(this.long0)<=Bt+_r?this.face=this.long0>0?Ii.RIGHT:Ii.LEFT:this.face=Ii.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function bI(r){var n={x:0,y:0},s,p,i,m,v,b,M={value:0};if(r.x-=this.long0,this.es!==0?s=Math.atan(this.one_minus_f_squared*Math.tan(r.y)):s=r.y,p=r.x,this.face===Ii.TOP)m=Bt-s,p>=_r&&p<=Bt+_r?(M.value=Br.AREA_0,i=p-Bt):p>Bt+_r||p<=-(Bt+_r)?(M.value=Br.AREA_1,i=p>0?p-Mi:p+Mi):p>-(Bt+_r)&&p<=-_r?(M.value=Br.AREA_2,i=p+Bt):(M.value=Br.AREA_3,i=p);else if(this.face===Ii.BOTTOM)m=Bt+s,p>=_r&&p<=Bt+_r?(M.value=Br.AREA_0,i=-p+Bt):p<_r&&p>=-_r?(M.value=Br.AREA_1,i=-p):p<-_r&&p>=-(Bt+_r)?(M.value=Br.AREA_2,i=-p-Bt):(M.value=Br.AREA_3,i=p>0?-p+Mi:-p-Mi);else{var z,C,j,Y,ot,J,mt;this.face===Ii.RIGHT?p=hh(p,+Bt):this.face===Ii.BACK?p=hh(p,+Mi):this.face===Ii.LEFT&&(p=hh(p,-Bt)),Y=Math.sin(s),ot=Math.cos(s),J=Math.sin(p),mt=Math.cos(p),z=ot*mt,C=ot*J,j=Y,this.face===Ii.FRONT?(m=Math.acos(z),i=nd(m,j,C,M)):this.face===Ii.RIGHT?(m=Math.acos(C),i=nd(m,j,-z,M)):this.face===Ii.BACK?(m=Math.acos(-z),i=nd(m,j,-C,M)):this.face===Ii.LEFT?(m=Math.acos(-C),i=nd(m,j,z,M)):(m=i=0,M.value=Br.AREA_0)}return b=Math.atan(12/Mi*(i+Math.acos(Math.sin(i)*Math.cos(_r))-Bt)),v=Math.sqrt((1-Math.cos(m))/(Math.cos(b)*Math.cos(b))/(1-Math.cos(Math.atan(1/Math.cos(i))))),M.value===Br.AREA_1?b+=Bt:M.value===Br.AREA_2?b+=Mi:M.value===Br.AREA_3&&(b+=1.5*Mi),n.x=v*Math.cos(b),n.y=v*Math.sin(b),n.x=n.x*this.a+this.x0,n.y=n.y*this.a+this.y0,r.x=n.x,r.y=n.y,r}function wI(r){var n={lam:0,phi:0},s,p,i,m,v,b,M,z,C,j={value:0};if(r.x=(r.x-this.x0)/this.a,r.y=(r.y-this.y0)/this.a,p=Math.atan(Math.sqrt(r.x*r.x+r.y*r.y)),s=Math.atan2(r.y,r.x),r.x>=0&&r.x>=Math.abs(r.y)?j.value=Br.AREA_0:r.y>=0&&r.y>=Math.abs(r.x)?(j.value=Br.AREA_1,s-=Bt):r.x<0&&-r.x>=Math.abs(r.y)?(j.value=Br.AREA_2,s=s<0?s+Mi:s-Mi):(j.value=Br.AREA_3,s+=Bt),C=Mi/12*Math.tan(s),v=Math.sin(C)/(Math.cos(C)-1/Math.sqrt(2)),b=Math.atan(v),i=Math.cos(s),m=Math.tan(p),M=1-i*i*m*m*(1-Math.cos(Math.atan(1/Math.cos(b)))),M<-1?M=-1:M>1&&(M=1),this.face===Ii.TOP)z=Math.acos(M),n.phi=Bt-z,j.value===Br.AREA_0?n.lam=b+Bt:j.value===Br.AREA_1?n.lam=b<0?b+Mi:b-Mi:j.value===Br.AREA_2?n.lam=b-Bt:n.lam=b;else if(this.face===Ii.BOTTOM)z=Math.acos(M),n.phi=z-Bt,j.value===Br.AREA_0?n.lam=-b+Bt:j.value===Br.AREA_1?n.lam=-b:j.value===Br.AREA_2?n.lam=-b-Bt:n.lam=b<0?-b-Mi:-b+Mi;else{var Y,ot,J;Y=M,C=Y*Y,C>=1?J=0:J=Math.sqrt(1-C)*Math.sin(b),C+=J*J,C>=1?ot=0:ot=Math.sqrt(1-C),j.value===Br.AREA_1?(C=ot,ot=-J,J=C):j.value===Br.AREA_2?(ot=-ot,J=-J):j.value===Br.AREA_3&&(C=ot,ot=J,J=-C),this.face===Ii.RIGHT?(C=Y,Y=-ot,ot=C):this.face===Ii.BACK?(Y=-Y,ot=-ot):this.face===Ii.LEFT&&(C=Y,Y=ot,ot=-C),n.phi=Math.acos(-J)-Bt,n.lam=Math.atan2(ot,Y),this.face===Ii.RIGHT?n.lam=hh(n.lam,-Bt):this.face===Ii.BACK?n.lam=hh(n.lam,-Mi):this.face===Ii.LEFT&&(n.lam=hh(n.lam,+Bt))}if(this.es!==0){var mt,ft,At;mt=n.phi<0?1:0,ft=Math.tan(n.phi),At=this.b/Math.sqrt(ft*ft+this.one_minus_f_squared),n.phi=Math.atan(Math.sqrt(this.a*this.a-At*At)/(this.one_minus_f*At)),mt&&(n.phi=-n.phi)}return n.lam+=this.long0,r.x=n.lam,r.y=n.phi,r}function nd(r,n,s,p){var i;return r<Ht?(p.value=Br.AREA_0,i=0):(i=Math.atan2(n,s),Math.abs(i)<=_r?p.value=Br.AREA_0:i>_r&&i<=Bt+_r?(p.value=Br.AREA_1,i-=Bt):i>Bt+_r||i<=-(Bt+_r)?(p.value=Br.AREA_2,i=i>=0?i-Mi:i+Mi):(p.value=Br.AREA_3,i+=Bt)),i}function hh(r,n){var s=r+n;return s<-Mi?s+=Bc:s>+Mi&&(s-=Bc),s}var SI=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],ix={init:xI,forward:bI,inverse:wI,names:SI};E();var fy=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],qc=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],nx=.8487,ox=1.3523,ax=Zo/5,EI=1/ax,ch=18,od=function(r,n){return r[0]+n*(r[1]+n*(r[2]+n*r[3]))},TI=function(r,n){return r[1]+n*(2*r[2]+n*3*r[3])};function MI(r,n,s,p){for(var i=n;p;--p){var m=r(i);if(i-=m,Math.abs(m)<s)break}return i}function II(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function CI(r){var n=$t(r.x-this.long0),s=Math.abs(r.y),p=Math.floor(s*ax);p<0?p=0:p>=ch&&(p=ch-1),s=Zo*(s-EI*p);var i={x:od(fy[p],s)*n,y:od(qc[p],s)};return r.y<0&&(i.y=-i.y),i.x=i.x*this.a*nx+this.x0,i.y=i.y*this.a*ox+this.y0,i}function AI(r){var n={x:(r.x-this.x0)/(this.a*nx),y:Math.abs(r.y-this.y0)/(this.a*ox)};if(n.y>=1)n.x/=fy[ch][0],n.y=r.y<0?-Bt:Bt;else{var s=Math.floor(n.y*ch);for(s<0?s=0:s>=ch&&(s=ch-1);;)if(qc[s][0]>n.y)--s;else if(qc[s+1][0]<=n.y)++s;else break;var p=qc[s],i=5*(n.y-p[0])/(qc[s+1][0]-p[0]);i=MI(function(m){return(od(p,m)-n.y)/TI(p,m)},i,Ht,100),n.x/=od(fy[s],i),n.y=(5*s+i)*Wi,r.y<0&&(n.y=-n.y)}return n.x=$t(n.x+this.long0),n}var PI=["Robinson","robin"],sx={init:II,forward:CI,inverse:AI,names:PI};E();function LI(){this.name="geocent"}function kI(r){var n=Zf(r,this.es,this.a);return n}function RI(r){var n=Xf(r,this.es,this.a,this.b);return n}var zI=["Geocentric","geocentric","geocent","Geocent"],lx={init:LI,forward:kI,inverse:RI,names:zI};E();var Bn={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},Wc={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function DI(){if(Object.keys(Wc).forEach(function(s){if(typeof this[s]>"u")this[s]=Wc[s].def;else{if(Wc[s].num&&isNaN(this[s]))throw new Error("Invalid parameter value, must be numeric "+s+" = "+this[s]);Wc[s].num&&(this[s]=parseFloat(this[s]))}Wc[s].degrees&&(this[s]=this[s]*Wi)}.bind(this)),Math.abs(Math.abs(this.lat0)-Bt)<Ht?this.mode=this.lat0<0?Bn.S_POLE:Bn.N_POLE:Math.abs(this.lat0)<Ht?this.mode=Bn.EQUIT:(this.mode=Bn.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var r=this.tilt,n=this.azi;this.cg=Math.cos(n),this.sg=Math.sin(n),this.cw=Math.cos(r),this.sw=Math.sin(r)}function OI(r){r.x-=this.long0;var n=Math.sin(r.y),s=Math.cos(r.y),p=Math.cos(r.x),i,m;switch(this.mode){case Bn.OBLIQ:m=this.sinph0*n+this.cosph0*s*p;break;case Bn.EQUIT:m=s*p;break;case Bn.S_POLE:m=-n;break;case Bn.N_POLE:m=n;break}switch(m=this.pn1/(this.p-m),i=m*s*Math.sin(r.x),this.mode){case Bn.OBLIQ:m*=this.cosph0*n-this.sinph0*s*p;break;case Bn.EQUIT:m*=n;break;case Bn.N_POLE:m*=-(s*p);break;case Bn.S_POLE:m*=s*p;break}var v,b;return v=m*this.cg+i*this.sg,b=1/(v*this.sw*this.h1+this.cw),i=(i*this.cg-m*this.sg)*this.cw*b,m=v*b,r.x=i*this.a,r.y=m*this.a,r}function NI(r){r.x/=this.a,r.y/=this.a;var n={x:r.x,y:r.y},s,p,i;i=1/(this.pn1-r.y*this.sw),s=this.pn1*r.x*i,p=this.pn1*r.y*this.cw*i,r.x=s*this.cg+p*this.sg,r.y=p*this.cg-s*this.sg;var m=Vl(r.x,r.y);if(Math.abs(m)<Ht)n.x=0,n.y=r.y;else{var v,b;switch(b=1-m*m*this.pfact,b=(this.p-Math.sqrt(b))/(this.pn1/m+m/this.pn1),v=Math.sqrt(1-b*b),this.mode){case Bn.OBLIQ:n.y=Math.asin(v*this.sinph0+r.y*b*this.cosph0/m),r.y=(v-this.sinph0*Math.sin(n.y))*m,r.x*=b*this.cosph0;break;case Bn.EQUIT:n.y=Math.asin(r.y*b/m),r.y=v*m,r.x*=b;break;case Bn.N_POLE:n.y=Math.asin(v),r.y=-r.y;break;case Bn.S_POLE:n.y=-Math.asin(v);break}n.x=Math.atan2(r.x,r.y)}return r.x=n.x+this.long0,r.y=n.y,r}var FI=["Tilted_Perspective","tpers"],ux={init:DI,forward:OI,inverse:NI,names:FI};function hx(r){r.Proj.projections.add(I_),r.Proj.projections.add(uh),r.Proj.projections.add(R_),r.Proj.projections.add(z_),r.Proj.projections.add(D_),r.Proj.projections.add(O_),r.Proj.projections.add(N_),r.Proj.projections.add(F_),r.Proj.projections.add(B_),r.Proj.projections.add(U_),r.Proj.projections.add(G_),r.Proj.projections.add(V_),r.Proj.projections.add(j_),r.Proj.projections.add(W_),r.Proj.projections.add(K_),r.Proj.projections.add(Z_),r.Proj.projections.add(X_),r.Proj.projections.add(Y_),r.Proj.projections.add(J_),r.Proj.projections.add(Q_),r.Proj.projections.add($_),r.Proj.projections.add(tx),r.Proj.projections.add(ex),r.Proj.projections.add(rx),r.Proj.projections.add(ix),r.Proj.projections.add(sx),r.Proj.projections.add(lx),r.Proj.projections.add(ux)}_o.defaultDatum="WGS84";_o.Proj=Hs;_o.WGS84=new _o.Proj("WGS84");_o.Point=S_;_o.toPoint=Jf;_o.defs=oh;_o.transform=Ul;_o.mgrs=x_;_o.version="__VERSION__";hx(_o);var ph=_o;E();E();E();var Un;(function(r){r[r.UInt8=1]="UInt8",r[r.UInt16=2]="UInt16",r[r.UInt32=4]="UInt32",r[r.UInt64=8]="UInt64",r[r.Double=8]="Double",r[r.Float=4]="Float"})(Un||(Un={}));E();var cx=2**32,BI=typeof setImmediate>"u"?setTimeout:setImmediate,$n=()=>{throw new Error("Method not implemented.")},Sa=class{constructor(){this.isLittleEndian=!0,this.delayMs=Sa.DefaultDelayMs,this.maxChunkCount=10,this.chunks=Sa.DefaultChunkCache(),this.blankFillCount=16,this.maxConcurrentRequests=50,this.toFetch=new Set,this.toFetchPromise=null,this.byteOffset=0,this.getFloat32=$n,this.getFloat64=$n,this.getInt8=$n,this.getInt16=$n,this.getInt32=$n,this.setFloat32=$n,this.setFloat64=$n,this.setInt8=$n,this.setInt16=$n,this.setInt32=$n,this.setUint8=$n,this.setUint16=$n,this.setUint32=$n,this.setBigInt64=$n,this.setBigUint64=$n}static getByteRanges(n,s=32,p=16){if(n.size===0)return{chunks:[],blankFill:[]};let i=[...n.values()].sort((M,z)=>M-z),m=[],v=[];m.push(v);let b=[];for(let M=0;M<i.length;++M){let z=i[M],C=i[M-1];if(v.length>=s)v=[z],m.push(v);else if(M===0||z===C+1)v.push(z);else if(z<C+p){for(let j=C;j<z;j++)v.push(j+1),b.push(j+1);b.pop()}else v=[z],m.push(v)}return{chunks:m,blankFill:b}}async fetchData(){if(this.toFetch.size===0)return;let n=this.toFetch;this.toFetch=new Set,this.toFetchPromise=null;let s=Sa.getByteRanges(n,this.maxChunkCount,this.blankFillCount),p=[];for(let i of s.chunks){let m=i[0],v=i[i.length-1],b=m*this.chunkSize,M=v*this.chunkSize+this.chunkSize-b,z=await this.fetchBytes(b,M);if(i.length===1){p[m]=z,this.chunks.set(m,new DataView(z));continue}let C=m*this.chunkSize;for(let j of i){let Y=j*this.chunkSize-C,ot=z.slice(Y,Y+this.chunkSize);p[j]=ot,this.chunks.set(j,new DataView(ot))}}}async loadBytes(n,s){if(n<0)throw new Error("Offset must be positive");let p=Math.floor(n/this.chunkSize),i=Math.ceil((n+s)/this.chunkSize)-1;for(let m=p;m<=i;m++)this.chunks.has(m)||this.toFetch.add(m);if(this.toFetch.size!==0){if(this.toFetchPromise==null&&(this.toFetchPromise=new Promise(m=>BI(m,this.delayMs)).then(()=>this.fetchData())),this.toFetch.size>this.maxConcurrentRequests)throw new Error("Too many outstanding requests");await this.toFetchPromise}}getChunkId(n){return Math.floor(n/this.chunkSize)}getUint(n,s){switch(s){case Un.UInt8:return this.getUint8(n);case Un.UInt16:return this.getUint16(n);case Un.UInt32:return this.getUint32(n);case Un.UInt64:return this.getUint64(n)}}bytes(n,s){let p=this.isOneChunk(n,s);if(p){let z=this.getView(p),C=n-p*this.chunkSize;return new Uint8Array(z.buffer.slice(C,C+s))}let i=new Uint8Array(s),m=n+s,v=Math.floor(n/this.chunkSize),b=Math.ceil((n+s)/this.chunkSize)-1,M=0;for(let z=v;z<=b;z++){let C=n+M,j=z*this.chunkSize,Y=this.getView(z),ot=Math.min(m,j+this.chunkSize),J=Y.buffer.slice(C-j,ot-j);i.set(new Uint8Array(J),M),M+=J.byteLength}return i}getView(n){let s=this.chunks.get(n);if(s==null)throw new Error(`Chunk:${n} is not ready`);return s}isOneChunk(n,s){let p=n+s-1,i=Math.floor(n/this.chunkSize);return Math.floor(p/this.chunkSize)-i<1?i:null}hasBytes(n,s=1){let p=Math.floor(n/this.chunkSize),i=Math.ceil((n+s)/this.chunkSize)-1;for(let m=p;m<=i;m++)if(!this.chunks.has(m))return!1;return!0}toRange(n,s){if(s==null)return`bytes=${n}`;if(n<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${n}-${n+s}`}parseContentRange(n){let[s,p]=n.split(" ");if(s!=="bytes")throw new Error("Failed to parse content-range: "+n);if(p==null)throw new Error("Failed to parse content-range: "+n);let[,i]=p.split("/"),m=Number(i);if(isNaN(m))throw new Error("Failed to parse content-range: "+n);return m}get buffer(){throw new Error("Method not implemented.")}get byteLength(){if(this._byteLength)return this._byteLength;throw Error(".size() has not been fetched.")}getUint8(n){let s=Math.floor(n/this.chunkSize),p=this.chunks.get(s);if(p==null)throw new Error(`Chunk:${s} is not ready`);return p.getUint8(n-s*this.chunkSize)}getUint16(n){let s=this.isOneChunk(n,Un.UInt16);if(s!=null)return this.getView(s).getUint16(n-s*this.chunkSize,this.isLittleEndian);let p=this.getUint8(n),i=this.getUint8(n+Un.UInt8);return this.isLittleEndian?p+(i<<8):(p<<8)+i}getUint32(n){let s=this.isOneChunk(n,Un.UInt32);if(s!=null)return this.getView(s).getUint32(n-s*this.chunkSize,this.isLittleEndian);let p=this.getUint16(n),i=this.getUint16(n+Un.UInt16);return this.isLittleEndian?p+i*65536:p*65536+i}getUint64(n){let s=this.isOneChunk(n,Un.UInt64);if(s!=null){let m=this.getView(s);return Number(m.getBigUint64(n-s*this.chunkSize,this.isLittleEndian))}let p=this.getUint32(n),i=this.getUint32(n+Un.UInt32);return this.isLittleEndian?p+i*cx:p*cx+i}getBigUint64(n){let s=this.isOneChunk(n,Un.UInt64);if(s!=null)return this.getView(s).getBigUint64(n-s*this.chunkSize,this.isLittleEndian);let p=BigInt(this.getUint32(n)),i=BigInt(this.getUint32(n+Un.UInt32));return this.isLittleEndian?p+(i<<BigInt(32)):(p<<BigInt(32))+i}getBigInt64(){throw new Error("Not implemented.")}};Sa.DefaultChunkCache=()=>new Map;Sa.DefaultDelayMs=1;E();E();var fh=class extends Error{constructor(n,s,p){super(n),this.name="CompositeError",this.code=s,this.reason=p}static isCompositeError(n){return typeof n!="object"||n==null?!1:n.name==="CompositeError"}};E();var px=`PROJCS["NZGD2000 / Chatham Islands TM 2000",
|
|
502
|
+
GEOGCS["NZGD2000",
|
|
503
|
+
DATUM["New_Zealand_Geodetic_Datum_2000",
|
|
504
|
+
SPHEROID["GRS 1980",6378137,298.257222101,
|
|
505
|
+
AUTHORITY["EPSG","7019"]],
|
|
506
|
+
TOWGS84[0,0,0,0,0,0,0],
|
|
507
|
+
AUTHORITY["EPSG","6167"]],
|
|
508
|
+
PRIMEM["Greenwich",0,
|
|
509
|
+
AUTHORITY["EPSG","8901"]],
|
|
510
|
+
UNIT["degree",0.01745329251994328,
|
|
511
|
+
AUTHORITY["EPSG","9122"]],
|
|
512
|
+
AUTHORITY["EPSG","4167"]],
|
|
513
|
+
UNIT["metre",1,
|
|
514
|
+
AUTHORITY["EPSG","9001"]],
|
|
515
|
+
PROJECTION["Transverse_Mercator"],
|
|
516
|
+
PARAMETER["latitude_of_origin",0],
|
|
517
|
+
PARAMETER["central_meridian",-176.5],
|
|
518
|
+
PARAMETER["scale_factor",1],
|
|
519
|
+
PARAMETER["false_easting",3500000],
|
|
520
|
+
PARAMETER["false_northing",10000000],
|
|
521
|
+
AUTHORITY["EPSG","3793"],
|
|
522
|
+
AXIS["Easting",EAST],
|
|
523
|
+
AXIS["Northing",NORTH]]`;E();var fx=`PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
|
|
524
|
+
GEOGCS["NZGD2000",
|
|
525
|
+
DATUM["New_Zealand_Geodetic_Datum_2000",
|
|
526
|
+
SPHEROID["GRS 1980",6378137,298.257222101,
|
|
527
|
+
AUTHORITY["EPSG","7019"]],
|
|
528
|
+
TOWGS84[0,0,0,0,0,0,0],
|
|
529
|
+
AUTHORITY["EPSG","6167"]],
|
|
530
|
+
PRIMEM["Greenwich",0,
|
|
531
|
+
AUTHORITY["EPSG","8901"]],
|
|
532
|
+
UNIT["degree",0.0174532925199433,
|
|
533
|
+
AUTHORITY["EPSG","9122"]],
|
|
534
|
+
AUTHORITY["EPSG","4167"]],
|
|
535
|
+
PROJECTION["Transverse_Mercator"],
|
|
536
|
+
PARAMETER["latitude_of_origin",0],
|
|
537
|
+
PARAMETER["central_meridian",173],
|
|
538
|
+
PARAMETER["scale_factor",0.9996],
|
|
539
|
+
PARAMETER["false_easting",1600000],
|
|
540
|
+
PARAMETER["false_northing",10000000],
|
|
541
|
+
UNIT["metre",1,
|
|
542
|
+
AUTHORITY["EPSG","9001"]],
|
|
543
|
+
AUTHORITY["EPSG","2193"]]`;ph.defs(pr.Nztm2000.toEpsgString(),fx);ph.defs(pr.Citm2000.toEpsgString(),px);var dy=new Map;function UI(r){return r==null?null:typeof r=="number"?r:"code"in r?r.code:"projection"in r?r.projection.code:null}var Zs=class{constructor(n){this.epsg=n;try{this.projection=ph(n.toEpsgString(),pr.Wgs84.toEpsgString())}catch(s){throw new fh(`Failed to create projection: ${n.toEpsgString()}, ${pr.Wgs84.toEpsgString()}`,500,s)}}static define(n,s){if(dy.get(n.code)!=null)throw new Error("Duplicate projection definition: "+n.toEpsgString());ph.defs(n.toEpsgString(),s)}static get(n){let s=this.tryGet(n);if(s==null)throw new Error(`Invalid projection: ${n}`);return s}static tryGet(n){let s=UI(n);if(s==null)return null;let p=dy.get(s);if(p!=null)return p;let i=pr.tryGet(s);return i==null||ph.defs(i.toEpsgString())==null?null:(p=new Zs(i),dy.set(s,p),p)}projectMultipolygon(n,s){if(s.epsg.code===this.epsg.code)return n;let{toWgs84:p}=this,{fromWgs84:i}=s;return n.map(m=>m.map(v=>v.map(b=>i(p(b)))))}get toWgs84(){return this.projection.forward}get fromWgs84(){return this.projection.inverse}boundsToWgs84BoundingBox(n){let s=this.toWgs84([n.x,n.y]),p=this.toWgs84([n.x+n.width,n.y+n.height]);return[s[0],s[1],p[0],p[1]]}boundsToGeoJsonFeature(n,s={}){let p=[n.x,n.y],i=[n.x+n.width,n.y],m=[n.x,n.y+n.height],v=[n.x+n.width,n.y+n.height],b=O0([[[p,m,v,i,p]]],this.toWgs84),M=b.length===1?N0(b[0],s):F0(b,s);return M.bbox=this.boundsToWgs84BoundingBox(n),M}toGeoJson(n){return{type:"FeatureCollection",features:n.map(s=>this.boundsToGeoJsonFeature(s,{name:s.name}))}}static getTiffResZoom(n,s,p=1){let i=0;for(;i<n.zooms.length;++i)if(n.pixelScale(i)<=s*p)return i;if(i===n.zooms.length)return i-1;throw new Error("ResZoom not found")}static tileToWgs84Bbox(n,s){let p=n.tileToSource(s),i=n.tileToSource({x:s.x+1,y:s.y+1,z:s.z}),m=this.get(n),[v,b]=m.toWgs84([p.x,i.y]),[M,z]=m.toWgs84([i.x,p.y]);return[v,b,M,z]}static tileCenterToLatLon(n,s){let p=n.tileToSource({x:s.x+.5,y:s.y+.5,z:s.z}),[i,m]=this.get(n).toWgs84([p.x,p.y]);return Zs.wrapLatLon(m,i)}static wrapLatLon(n,s){let p={lat:n,lon:s},i=Math.floor(Math.abs(n)/90)%4,m=n>0?90:-90,v=n%90;switch(i){case 0:p.lat=v;break;case 1:p.lat=m-v,p.lon+=180;break;case 2:p.lat=-v,p.lon+=180;break;case 3:p.lat=-m+v;break}return(p.lon>180||p.lon<-180)&&(p.lon-=Math.floor((p.lon+180)/360)*360),p}static findAlignmentLevels(n,s,p){return Math.max(0,this.getTiffResZoom(n,p,2)-s.z)}static getImagePixelWidth(n,s,p){let i=n.tileToSource(s),m=n.tileToSource({x:s.x+1,y:s.y+1,z:s.z});return Math.round((m.x-i.x)/n.pixelScale(p))*2}};E();var Xi={ImageFormat:"png",toHash(r){return`#@${r.lat.toFixed(7)},${r.lon.toFixed(7)},z${r.zoom}`},parseZoom(r){return r==null||r===""?NaN:r.startsWith("z")?parseFloat(r.slice(1)):r.endsWith("z")?parseFloat(r):NaN},fromHash(r){let n={},s=r.replace("#@",""),[p,i,m]=s.split(","),v=parseFloat(p),b=parseFloat(i);!isNaN(v)&&!isNaN(b)&&(n.lat=v,n.lon=b);let M=Xi.parseZoom(m);return isNaN(M)||(n.zoom=M),n},baseUrl(){let r=zt.BaseUrl;if(r==="")return window.location.origin;if(!r.startsWith("http"))throw new Error("BaseURL must start with http(s)://");return r},toBaseWmts(){let r=zt.ApiKey==null||zt.ApiKey===""?"":`?api=${zt.ApiKey}`;return`${this.baseUrl()}/v1/tiles/WMTSCapabilities.xml${r}`},toImageryUrl(r,n){return`${this.baseUrl()}/v1/imagery/${r}/${n}`},toTileUrl(r,n,s,p){let i=zt.ApiKey==null||zt.ApiKey===""?"":`?api=${zt.ApiKey}`,v=Ws.get(n.projection).identifier===n.identifier?n.projection.toEpsgString():n.identifier,b=`${this.baseUrl()}/v1/tiles/${s}/${v}`;if(r==="raster")return`${b}/{z}/{x}/{y}.${Xi.ImageFormat}${i}`;if(r==="vector-xyz")return`${b}/{z}/{x}/{y}.pbf${i}`;if(r==="style")return`${b}/style/${p}.json${i}`;if(r==="wmts")return`${b}/WMTSCapabilities.xml${i}`;if(r==="attribution")return`${b}/attribution.json${i}`;if(r==="tile-wmts")return`${b}/{TileMatrix}/{TileCol}/{TileRow}.${Xi.ImageFormat}${i}`;throw new Error("Unknown url type: "+r)}};var Kc=class{constructor(n,s=0){this.tileMatrix=n,this.extraZoomLevels=s}getStyle(n,s){return n==="topographic"?Xi.toTileUrl("style",this.tileMatrix,n,s):{version:8,sources:{basemaps:{type:"raster",tiles:[Xi.toTileUrl("raster",this.tileMatrix,n)],tileSize:256}},layers:[{id:"LINZ Raster Basemaps",type:"raster",source:"basemaps"}]}}},GI=new Kc(ns,2),VI=new Kc(ba),mx=new Kc(Or),jI=[GI,VI,mx];function dh(r){for(let n of jI)if(r===n.tileMatrix.identifier)return n;return mx}function dx(r){return r.identifier===Or.identifier}function Ea(r,n,s){if(n.identifier===s.identifier)return r;if(!dx(n)&&!dx(s))throw new Error("Either tileMatrix or targetTileMatrix must be GoogleTms");let p=Zs.get(n).fromWgs84([r.lon,r.lat]),i=n.sourceToPixels(p[0],p[1],Math.round(r.zoom)),m={x:i.x/n.tileSize,y:i.y/n.tileSize,z:Math.round(r.zoom)},v=s.tileToSource(m),b=Zs.get(s).toWgs84([v.x,v.y]);return{lon:Math.round(b[0]*1e8)/1e8,lat:Math.round(b[1]*1e8)/1e8,zoom:r.zoom}}function yx(r,n){for(let s of r.features){if(s.geometry.type!=="Polygon")throw new Error("Only polygons supported");for(let p of s.geometry.coordinates)for(let i of p){let m=Ea({lat:i[1],lon:i[0],zoom:n.maxZoom},n,Or);i[0]=m.lon,i[1]=m.lat}}}var gx={[Or.identifier]:{lat:-41.88999621,lon:174.04924373,zoom:5},[ns.identifier]:{lat:-41.277848,lon:174.6763921,zoom:3},[ba.identifier]:{lat:-41.88999621,lon:174.04924373,zoom:3}},xo=class extends vx.Emitter{constructor(){super(...arguments);this.style=null;this.layerId="aerial";this.tileMatrix=Or;this.debug={...ih}}get layers(){return this._layers==null&&(this._layers=qI()),this._layers}get isDebug(){return this.debug.debug}get location(){return this._location==null&&(window.addEventListener("popstate",()=>{let s={...gx[this.tileMatrix.identifier],...Xi.fromHash(window.location.hash)};this.setLocation(s)}),this.updateFromUrl(),this._location={...gx[this.tileMatrix.identifier],...Xi.fromHash(window.location.hash)}),this._location}get transformedLocation(){return this.transformLocation(this.location.lat,this.location.lon,this.location.zoom)}get isVector(){return this.layerId==="topographic"}get layerKey(){return this.style==null?this.layerId:`${this.layerId}::${this.style}`}get layerKeyTms(){return`${this.layerKey}::${this.tileMatrix.identifier}`}updateFromUrl(s=window.location.search){let p=new URLSearchParams(s),i=p.get("s")??p.get("style"),m=p.get("i")??"aerial",v=(p.get("p")??Or.identifier).toLowerCase(),b=Ws.All.find(C=>C.identifier.toLowerCase()===v);b==null&&(b=Ws.get(pr.parse(v)??pr.Google)),b.identifier===ns.identifier&&(b=ba),Oc.fromUrl(this.debug,p)&&this.emit("change");let z=xo.toUrl(this);this.style=i??null,this.layerId=m.startsWith("im_")?m.slice(3):m,this.tileMatrix=b,this.layerId==="topographic"&&this.style==null&&(this.style="topographic"),this.emit("tileMatrix",this.tileMatrix),this.emit("layer",this.layerId,this.style),z!==xo.toUrl(this)&&this.emit("change")}static toUrl(s){let p=new URLSearchParams;return s.style&&p.append("s",s.style),s.layerId!=="aerial"&&p.append("i",s.layerId),s.tileMatrix.identifier!==Or.identifier&&p.append("p",s.tileMatrix.identifier),Oc.toUrl(s.debug,p),p.toString()}toTileUrl(s,p=this.tileMatrix,i=this.layerId,m=this.style){return Xi.toTileUrl(s,p,i,m)}getLocation(s){let p=s.getCenter();if(p==null)throw new Error("Invalid Map location");let i=Math.floor((s.getZoom()??0)*1e4)/1e4;return zt.map.transformLocation(p.lat,p.lng,i)}transformLocation(s,p,i){return Ea({lat:s,lon:p,zoom:i},Or,this.tileMatrix)}setLocation(s){s.lat===this.location.lat&&s.lon===this.location.lon&&s.zoom===this.location.zoom||(this.location.lat=s.lat,this.location.lon=s.lon,this.location.zoom=s.zoom,this.emit("location",this.location),this.emit("change"))}setTileMatrix(s){this.tileMatrix.identifier!==s.identifier&&(this.emit("tileMatrix",this.tileMatrix),this.emit("change"))}setLayerId(s,p){this.layerId===s&&this.style===p||(this.layerId=s,this.style=p??null,this.emit("layer",this.layerId,this.style),this.emit("change"))}setDebug(s,p=ih[s]){this.debug[s]!==p&&(this.debug[s]=p,this.emit("change"))}};async function qI(){let r=new Map,n=await fetch(Xi.toBaseWmts());if(!n.ok)return r;let i=new DOMParser().parseFromString(await n.text(),"text/xml").getElementsByTagName("Layer"),m=[];for(let v=0;v<i.length;v++){let b=i.item(v);if(b==null)continue;let M=b.getElementsByTagName("ows:Title").item(0)?.textContent,z=b.getElementsByTagName("ows:Identifier").item(0)?.textContent;if(M==null||z==null||M==="aerial")continue;let C=b.getElementsByTagName("ows:WGS84BoundingBox").item(0),j=C?.getElementsByTagName("ows:UpperCorner").item(0)?.textContent?.split(" ").map(Number),Y=C?.getElementsByTagName("ows:LowerCorner").item(0)?.textContent?.split(" ").map(Number),ot=b.getElementsByTagName("TileMatrixSet"),J=new Set;for(let mt=0;mt<ot.length;mt++){let ft=pr.parse(ot.item(mt)?.textContent??"");ft!=null&&J.add(ft.code)}j==null||Y==null||j.length!==2||m.push({id:z,name:M.replace("aerial ",""),upperLeft:j,lowerRight:Y,projections:J})}m.sort((v,b)=>v.name.localeCompare(b.name));for(let v of m)r.set(v.id,v);return r}var WI=w0(),zt={get BaseUrl(){return""},get ApiKey(){return WI},get GoogleAnalytics(){return"UA-23232486-3"},get Version(){return"v6.29.0"},get SplitApiKey(){return"7fkp3g68jouonf9qgo2ug564sb0kjjq0okd3"},map:new xo};if(zt.GoogleAnalytics!==""&&typeof window<"u"){window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date),window.gtag("config",`${zt.GoogleAnalytics}`);let r=document.createElement("script");r.setAttribute("async",""),r.setAttribute("src",`https://www.googletagmanager.com/gtag/js?id=${zt.GoogleAnalytics}`),document.head.appendChild(r)}function ql(r,n,s){zt.GoogleAnalytics!==""&&window.gtag("event",n,{event_category:r,value:s})}E();go();var Hc=class extends Ti{render(n){return D("i",{class:"material-icons-round md-36"},n.name)}},Ta=class extends Ti{render(n){return D("a",{rel:"noopener",target:"_blank",href:n.href,style:"display:flex;","aria-label":n.ariaLabel},n.children,n.icon?D(Hc,{name:n.icon}):void 0)}};var ad=class extends Ti{constructor(){super(...arguments);this._events=[]}componentWillMount(){this._events.push(zt.map.on("change",()=>this.setState(this.state)))}componentWillUnmount(){for(let s of this._events)s();this._events=[]}render(){if(!zt.map.isDebug)return D("footer",{class:"lui-footer lui-footer-small lui-hide-sm lui-hide-xs",role:"contentinfo"},D("div",{class:"lui-footer-columns"},D("div",{style:"display:flex; align-items:center"},D(Ta,{href:"http://www.govt.nz/",ariaLabel:"New Zealand Government"},D("img",{src:"/assets/logo-nz-govt.svg"}))),D("div",{class:"justify-end"},D("ul",{class:"lui-footer-list"},D("li",{class:"lui-footer-inline-list-item"},"\xA9 2021 Land Information New Zealand"),D("li",{class:"lui-footer-inline-list-item"},D(Ta,{href:"https://www.linz.govt.nz/contact-us"},"Contact")),D("li",{class:"lui-footer-inline-list-item"},D(Ta,{href:"https://www.linz.govt.nz/privacy"},"Privacy")),D("li",{class:"lui-footer-inline-list-item"},D(Ta,{href:"https://www.linz.govt.nz/data/linz-data/linz-basemaps/data-attribution"},"Data Attribution"))))))}};E();E();function _x(r){var n,s,p="";if(typeof r=="string"||typeof r=="number")p+=r;else if(typeof r=="object")if(Array.isArray(r))for(n=0;n<r.length;n++)r[n]&&(s=_x(r[n]))&&(p&&(p+=" "),p+=s);else for(n in r)r[n]&&(p&&(p+=" "),p+=n);return p}function sd(){for(var r=0,n,s,p="";r<arguments.length;)(n=arguments[r++])&&(s=_x(n))&&(p&&(p+=" "),p+=s);return p}go();E();go();go();E();E();E();var qx=zr(Ci());E();var er=function(r){return r!=null&&typeof r.then=="function"};E();function Xs(r,n){return Ir(r)&&Ir(n)?r.slice(0,n.length)===n:!1}function wx(r,n,s){return s===void 0&&(s=!1),Ir(r)&&Ir(n)?(s&&(r=r.toLowerCase(),n=n.toLowerCase()),r.slice(r.length-n.length)===n):!1}function ds(r,n,s){var p=s;try{var i=n.split("."),m=r;i.forEach(function(v){return m=m[v]}),typeof m<"u"&&(p=m)}catch{}return p}function Gn(r,n){if(Array.isArray(r)&&typeof n=="function"){for(var s=0;s<r.length;s++)if(n(r[s],s,r)===!0)return s}return-1}function ld(r,n){var s;if(Yi(r))for(var p=Object.keys(r),i=0;i<p.length&&!s;i++){var m=p[i],v=n(r[m],m,r);v&&(s=r[m])}else if(Array.isArray(r))for(var b=0;b<r.length&&!s;b++){var M=n(r[b],b,r);M&&(s=r[b])}return s}function Ir(r){return typeof r=="string"||r instanceof String}function co(r){return r instanceof Number&&(r=r.valueOf()),typeof r=="number"?Number.isFinite?Number.isFinite(r):isFinite(r):!1}function yy(r){return r instanceof Number&&(r=r.valueOf()),r!==r}var YI=-1;function Sx(){return YI++}function Yi(r){return r&&typeof r=="object"&&r.constructor===Object}function Wl(r,n){var s=r;Yi(n)&&Object.keys(n).forEach(function(b){var M=n[b];Yi(M)&&(s[b]&&Yi(s[b])?M=Wl({},s[b],M):M=Wl({},M)),M!==void 0&&(s[b]=M)});for(var p=arguments.length,i=new Array(p>2?p-2:0),m=2;m<p;m++)i[m-2]=arguments[m];if(i&&i.length){var v=i.splice(0,1)[0];s=Wl.apply(void 0,[s,v].concat(i))}return s}function mh(r){var n={};return r.filter(function(s){return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function Ex(r,n){n===void 0&&(n=JSON.stringify);var s={};return r.filter(function(p){var i=n(p);return Object.prototype.hasOwnProperty.call(s,i)?!1:s[i]=!0})}function yh(r){if(r==null)return"";if(typeof r=="string")return r;if(Array.isArray(r))return r.map(function(s){return Ir(s)?s:""})+"";var n=r+"";return n==="0"&&1/r===Number.NEGATIVE_INFINITY?"-0":n}function Ys(r){if(typeof r=="number")return r;if(Yi(r)&&typeof r.valueOf=="function"){var n=r.valueOf();r=Yi(n)?n+"":n}return typeof r!="string"?r===0?r:+r:(r=r.replace(/^\s+|\s+$/g,""),+r)}function sn(r,n){var s=Object.keys(r);return s.forEach(function(p){return n(r[p],p,r)}),r}function Tx(r,n){var s={};if(Array.isArray(r)&&Ir(n))for(var p=0;p<r.length;p++){var i=r[p][n];Ir(i)&&(s[i]||(s[i]=[]),s[i].push(r[p]))}return s}function Mx(r){return r.name?r.name:(r.toString().match(/function (.+?)\(/)||["",""])[1]}function Ix(r){for(var n=Object.keys(r),s={},p=0;p<n.length;p++)s[n[p]]=r[n[p]];return s}function Cx(r){return r===!0||r===!1}E();E();E();E();var Ax=zr(Ci()),ko={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR",NONE:"NONE"},gh={DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5},Px=gh.DEBUG,ud=function(n){Px=gh[n]},JI={showLevel:!0,displayAllErrors:!1},hd=function(){function r(s,p){this.category=s,this.options=(0,Ax.default)({},JI,p)}var n=r.prototype;return n.debug=function(p){this._shouldLog(gh.DEBUG)&&this._log(ko.DEBUG,p)},n.info=function(p){this._shouldLog(gh.INFO)&&this._log(ko.INFO,p)},n.warn=function(p){this._shouldLog(gh.WARN)&&this._log(ko.WARN,p)},n.error=function(p){(this.options.displayAllErrors||this._shouldLog(gh.ERROR))&&this._log(ko.ERROR,p)},n._log=function(p,i){var m=this._generateLogMessage(p,i);console.log(m)},n._generateLogMessage=function(p,i){var m=" => ",v="";return this.options.showLevel&&(v+="["+p+"]"+(p===ko.INFO||p===ko.WARN?" ":"")+" "),this.category&&(v+=this.category+m),v+=i},n._shouldLog=function(p){return p>=Px},r}();E();function Zc(){var r="__SPLITSOFTWARE__";try{return localStorage.setItem(r,r),localStorage.removeItem(r),!0}catch{return!1}}var Lx=function(n){return!!ld(ko,function(s){return n===s})},QI={showLevel:!0,displayAllErrors:!1},$I="splitio_debug",tC="SPLITIO_DEBUG",kx=!1;typeof process<"u"&&typeof process.version<"u"&&!!process.version&&(kx=!0);var gy=String(kx?process.env[tC]:Zc()?localStorage.getItem($I):""),Rx=function(n,s){return s===void 0&&(s={}),new hd(n,Wl(s,QI))},eC=Rx("splitio-utils:logger"),ms={enable:function(){ud(ko.DEBUG)},setLogLevel:function(n){Lx(n)?ud(n):eC.error("Invalid Log Level - No changes to the logs will be applied.")},disable:function(){ud(ko.NONE)},LogLevel:ko};/^(enabled?|on)/i.test(gy)?ms.enable(ko.DEBUG):Lx(gy)?ms.setLogLevel(gy):ms.disable();var Nt=Rx;var Xc=Nt("",{displayAllErrors:!0}),Ma={};function vy(r){var n=!1;return r==null?Xc.error("Factory instantiation: you passed a null or undefined api_key, api_key must be a non-empty string."):Ir(r)?r.length>0?n=r:Xc.error("Factory instantiation: you passed an empty api_key, api_key must be a non-empty string."):Xc.error("Factory instantiation: you passed an invalid api_key, api_key must be a non-empty string."),n&&(Ma[n]?(Xc.warn("Factory instantiation: You already have "+Ma[n]+" "+(Ma[n]===1?"factory":"factories")+" with this API Key. We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing it throughout your application."),Ma[n]++):(Ma[n]=1,Object.keys(Ma).length>1&&Xc.warn("Factory instantiation: You already have an instance of the Split factory. Make sure you definitely want this additional instance. We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing it throughout your application."))),n}function Yc(r){Ma[r]&&Ma[r]--,Ma[r]===0&&delete Ma[r]}E();var rC=Nt("");function _y(r,n){return Yi(r)||r==null?r:(rC.error(n+": attributes must be a plain object."),!1)}E();var cd=Nt(""),iC=/^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$/;function Jc(r,n){if(r==null)cd.error(n+": you passed a null or undefined event_type, event_type must be a non-empty string.");else if(!Ir(r))cd.error(n+": you passed an invalid event_type, event_type must be a non-empty string.");else if(r.length===0)cd.error(n+": you passed an empty event_type, event_type must be a non-empty string.");else if(!iC.test(r))cd.error(n+': you passed "'+r+'", event_type must adhere to the regular expression /^[a-zA-Z0-9][-_.:a-zA-Z0-9]{0,79}$/g. This means an event_type must be alphanumeric, cannot be more than 80 characters long, and can only include a dash, underscore, period, or colon as separators of alphanumeric characters.');else return r;return!1}E();var nC=Nt("");function Qc(r,n){return co(r)||r==null?r:(nC.error(n+": value must be a finite number."),!1)}E();var pd=Nt(""),$c={NULL:0,STRING:2,BOOLEAN:4,NUMBER:8},oC=300,aC=1024*32,xy=1024;function tp(r,n){if(r==null)return{properties:null,size:xy};if(!Yi(r))return pd.error(n+": properties must be a plain object."),{properties:!1,size:xy};var s=Object.keys(r),p=Ix(r),i={properties:p,size:xy};s.length>oC&&pd.warn(n+": Event has more than 300 properties. Some of them will be trimmed when processed.");for(var m=0;m<s.length;m++){i.size+=s[m].length*$c.STRING;var v=p[s[m]],b=Ir(v),M=co(v),z=Cx(v),C=v===null;if(b||M||z||C||(p[s[m]]=null,v=null,C=!0,pd.warn(n+": Property "+s[m]+" is of invalid type. Setting value to null.")),C?i.size+=$c.NULL:M?i.size+=$c.NUMBER:z?i.size+=$c.BOOLEAN:b&&(i.size+=v.length*$c.STRING),i.size>aC){pd.error(n+": The maximum size allowed for the properties is 32768 bytes, which was exceeded. Event not queued."),i.properties=!1;break}}return i}E();var vh=Nt(""),zx=250;function by(r,n,s){if(r==null)return vh.error(n+": you passed a null or undefined "+s+", "+s+" must be a non-empty string."),!1;if(co(r))return vh.warn(n+": "+s+' "'+r+'" is not of type string, converting.'),yh(r);if(Ir(r)){if(r=r.trim(),r.length>0&&r.length<=zx)return r;r.length===0?vh.error(n+": you passed an empty string, "+s+" must be a non-empty string."):r.length>zx&&vh.error(n+": "+s+" too long, "+s+" must be 250 characters or less.")}else vh.error(n+": you passed an invalid "+s+" type, "+s+" must be a non-empty string.");return!1}function Ia(r,n){if(Yi(r)){var s=by(r.matchingKey,n,"matchingKey"),p=by(r.bucketingKey,n,"bucketingKey");return s&&p?{matchingKey:s,bucketingKey:p}:(vh.error(n+": Key must be an object with bucketingKey and matchingKey with valid string properties."),!1)}else return by(r,n,"key")}E();E();var Dx="killed",Ox="default rule",fd="definition not found",Nx="not ready",_h="exception",Fx="archived",Bx="not in split";var ep=Nt(""),sC=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/;function Kl(r,n,s){if(s===void 0&&(s="split name"),r==null)ep.error(n+": you passed a null or undefined "+s+", "+s+" must be a non-empty string.");else if(!Ir(r))ep.error(n+": you passed an invalid "+s+", "+s+" must be a non-empty string.");else{if(sC.test(r)&&(ep.warn(n+": "+s+' "'+r+'" has extra whitespace, trimming.'),r=r.trim()),r.length>0)return r;ep.error(n+": you passed an empty "+s+", "+s+" must be a non-empty string.")}return!1}function xh(r,n,s,p){return r.get(r.constants.READY,!0)&&(s===fd||s==null)?(ep.warn(p+': you passed "'+n+'" that does not exist in this environment, please double check what Splits exist in the web console.'),!1):!0}E();var lC=Nt("");function rp(r,n,s,p){if(s===void 0&&(s="split_names"),p===void 0&&(p="split name"),Array.isArray(r)&&r.length>0){var i=[];if(r.forEach(function(m){var v=Kl(m,n,p);v&&i.push(v)}),i.length)return mh(i)}return lC.error(n+": "+s+" must be a non-empty array."),!1}E();E();var Ca="localhost",Jo="standalone",bh="producer",wh="consumer",Js="MEMORY",Ux="REDIS",Qs="LOCALSTORAGE",Vn="control",md={treatment:Vn,config:null};var yd="GOOGLE_ANALYTICS_TO_SPLIT",gd="SPLIT_TO_GOOGLE_ANALYTICS",ip="IMPRESSION",np="EVENT",vd=[{type:"byName",maxLength:400,queryParam:"names="},{type:"byPrefix",maxLength:50,queryParam:"prefixes="}],Hl="DEBUG",yn="OPTIMIZED";var op=Nt(""),uC=/[A-Z]/;function ys(r,n){if(r==null)op.error(n+": you passed a null or undefined traffic_type_name, traffic_type_name must be a non-empty string.");else if(!Ir(r))op.error(n+": you passed an invalid traffic_type_name, traffic_type_name must be a non-empty string.");else if(r.length===0)op.error(n+": you passed an empty traffic_type_name, traffic_type_name must be a non-empty string.");else return uC.test(r)&&(op.warn(n+": traffic_type_name should be all lowercase - converting string to lowercase."),r=r.toLowerCase()),r;return!1}function Gx(r,n){op.warn(r+": Traffic Type "+n+" does not have any corresponding Splits in this environment, make sure you're tracking your events to a valid traffic type defined in the Split console.")}function wy(r,n,s){var p=n.get(n.constants.READY,!0),i=n.get(n.constants.SETTINGS),m=n.get(n.constants.STORAGE).splits;if(!p||i.mode===Ca)return!0;var v=m.trafficTypeExists(r);return er(v)?v.then(function(b){return b||Gx(s,r),b}):v||Gx(s,r),v}E();var Vx=Nt("",{displayAllErrors:!0});function $s(r){return r.get(r.constants.DESTROYED,!0)?(Vx.error("Client has already been destroyed - no calls possible."),!1):!0}function Zl(r,n){return r.get(r.constants.READY,!0)||r.get(r.constants.READY_FROM_CACHE,!0)?!0:(Vx.warn(n+": the SDK is not ready, results may be incorrect. Make sure to wait for SDK readiness before using this method."),!1)}var hC=function(n){var s=n.conditions,p=ld(s,function(i){return i.conditionType==="ROLLOUT"});return p||(p=s[0]),p?p.partitions.map(function(i){return i.treatment}):[]},Sy=function(n){var s;try{s=JSON.parse(n)}catch{return null}return s==null?null:{name:s.name,trafficType:s.trafficTypeName||null,killed:s.killed,changeNumber:s.changeNumber||0,treatments:hC(s),configs:s.configurations||{}}},jx=function(n){var s=[];return n.forEach(function(p){var i=Sy(p);i!=null&&s.push(i)}),s};function cC(r,n){var s="split",p=n.get(n.constants.STATUS_MANAGER);return(0,qx.default)(Object.create(p),{split:function(m){var v=Kl(m,s);if(!$s(n)||!Zl(n,s)||!v)return null;var b=r.getSplit(v);return er(b)?b.then(function(M){return xh(n,v,M,s),Sy(M)}):(xh(n,v,b,s),Sy(b))},splits:function(){if(!$s(n)||!Zl(n,"splits"))return[];var m=r.getAll();return er(m)?m.then(jx):jx(m)},names:function(){return!$s(n)||!Zl(n,"names")?[]:r.getKeys()}})}var Wx=cC;E();E();E();function pC(r){r===void 0&&(r=[]);for(var n=0;n<r.length;n++)for(var s=r[n].matcherGroup.matchers,p=0;p<s.length;p++)if(s[p].matcherType==="IN_SEGMENT")return!0;return!1}var Xl=pC;E();function ap(r,n,s){var p=this,i=this.getSplit(r),m=er(i)?i:Promise.resolve(i);return m.then(function(v){if(v){var b=JSON.parse(v);if(!b.changeNumber||b.changeNumber<s){b.killed=!0,b.defaultTreatment=n,b.changeNumber=s;var M=JSON.stringify(b);return p.addSplit(r,M)}}return!1})}var Kx=function(){function r(){this.flush()}var n=r.prototype;return n.addSplit=function(p,i){var m=this.getSplit(p);if(m){var v=JSON.parse(m);if(v.trafficTypeName){var b=v.trafficTypeName;this.ttCache[b]--,this.ttCache[b]||delete this.ttCache[b]}Xl(v.conditions)&&this.splitsWithSegmentsCount--}var M=JSON.parse(i);if(M){this.splitCache[p]=i;var z=M.trafficTypeName;return z&&(this.ttCache[z]||(this.ttCache[z]=0),this.ttCache[z]++),Xl(M.conditions)&&this.splitsWithSegmentsCount++,!0}else return!1},n.addSplits=function(p){var i=this,m=[];return p.forEach(function(v){m.push(i.addSplit(v[0],v[1]))}),m},n.removeSplit=function(p){var i=this.getSplit(p);if(i){delete this.splitCache[p];var m=JSON.parse(i),v=m.trafficTypeName;return v&&(this.ttCache[v]--,this.ttCache[v]||delete this.ttCache[v]),Xl(m.conditions)&&this.splitsWithSegmentsCount--,1}else return 0},n.removeSplits=function(p){var i=this;return p.forEach(function(m){return i.removeSplit(m)}),p.length},n.getSplit=function(p){return this.splitCache[p]},n.setChangeNumber=function(p){return this.changeNumber=p,!0},n.getChangeNumber=function(){return this.changeNumber},n.getAll=function(){var p=this;return this.getKeys().map(function(i){return p.splitCache[i]})},n.getKeys=function(){return Object.keys(this.splitCache)},n.trafficTypeExists=function(p){return co(this.ttCache[p])&&this.ttCache[p]>0},n.usesSegments=function(){return this.getChangeNumber()===-1||this.splitsWithSegmentsCount>0},n.flush=function(){this.splitCache={},this.ttCache={},this.changeNumber=-1,this.splitsWithSegmentsCount=0},n.fetchMany=function(p){var i=this,m={};return p.forEach(function(v){m[v]=i.splitCache[v]||null}),m},n.checkCache=function(){return!1},r}();Kx.prototype.killLocally=ap;var sp=Kx;E();var gs=Nt("splitio-storage:localstorage"),Hx=function(){function r(s,p,i){i===void 0&&(i={validFilters:[],queryString:null,groupedFilters:{byName:[],byPrefix:[]}}),this.keys=s,this.splitFiltersValidation=i,this.__checkExpiration(p),this.__checkFilterQuery()}var n=r.prototype;return n.decrementCount=function(p){var i=Ys(localStorage.getItem(p))-1;i>0?localStorage.setItem(p,i):localStorage.removeItem(p)},n.decrementCounts=function(p){try{if(p){if(p.trafficTypeName){var i=this.keys.buildTrafficTypeKey(p.trafficTypeName);this.decrementCount(i)}if(Xl(p.conditions)){var m=this.keys.buildSplitsWithSegmentCountKey();this.decrementCount(m)}}}catch(v){gs.error(v)}},n.incrementCounts=function(p){try{if(p){if(p.trafficTypeName){var i=this.keys.buildTrafficTypeKey(p.trafficTypeName);localStorage.setItem(i,Ys(localStorage.getItem(i))+1)}if(Xl(p.conditions)){var m=this.keys.buildSplitsWithSegmentCountKey();localStorage.setItem(m,Ys(localStorage.getItem(m))+1)}}}catch(v){gs.error(v)}},n.addSplit=function(p,i){try{var m=this.keys.buildSplitKey(p),v=localStorage.getItem(m),b=v?JSON.parse(v):null;this.decrementCounts(b),localStorage.setItem(m,i);var M=i?JSON.parse(i):null;return this.incrementCounts(M),!0}catch(z){return gs.error(z),!1}},n.addSplits=function(p){var i=this,m=[];return p.forEach(function(v){m.push(i.addSplit(v[0],v[1]))}),m},n.removeSplit=function(p){try{var i=this.getSplit(p);localStorage.removeItem(this.keys.buildSplitKey(p));var m=JSON.parse(i);return this.decrementCounts(m),1}catch(v){return gs.error(v),0}},n.removeSplits=function(p){for(var i=0,m=p.length,v=0;i<m;i++)v+=this.removeSplit(p[i]);return v},n.getSplit=function(p){return localStorage.getItem(this.keys.buildSplitKey(p))},n.setChangeNumber=function(p){if(this.cacheReadyButNeedsToFlush&&(this.flush(),this.cacheReadyButNeedsToFlush=!1),this.updateNewFilter){gs.info("Split filter query was modified. Updating cache.");var i=this.keys.buildSplitsFilterQueryKey(),m=this.splitFiltersValidation.queryString;try{m?localStorage.setItem(i,m):localStorage.removeItem(i)}catch(v){gs.error(v)}this.updateNewFilter=!1}try{return localStorage.setItem(this.keys.buildSplitsTillKey(),p+""),localStorage.setItem(this.keys.buildLastUpdatedKey(),Date.now()+""),this.hasSync=!0,!0}catch(v){return gs.error(v),!1}},n.getChangeNumber=function(){var p=-1,i=localStorage.getItem(this.keys.buildSplitsTillKey());return i!==null?(i=parseInt(i,10),yy(i)?p:i):p},n.getAll=function(){for(var p=localStorage.length,i=[],m=0;m<p;){var v=localStorage.key(m),b=v&&localStorage.getItem(v);v!=null&&this.keys.isSplitKey(v)&&b&&i.push(b),m++}return i},n.getKeys=function(){for(var p=localStorage.length,i=[],m=0;m<p;){var v=localStorage.key(m);v!=null&&this.keys.isSplitKey(v)&&i.push(this.keys.extractKey(v)),m++}return i},n.trafficTypeExists=function(p){var i=Ys(localStorage.getItem(this.keys.buildTrafficTypeKey(p)));return co(i)&&i>0},n.usesSegments=function(){if(!this.hasSync)return!0;var p=localStorage.getItem(this.keys.buildSplitsWithSegmentCountKey()),i=p===null?0:Ys(p);return co(i)?i>0:!0},n.flush=function(){gs.info("Flushing Splits data from localStorage");for(var p=localStorage.length,i=[],m=0;m<p;m++){var v=localStorage.key(m);v!=null&&this.keys.isSplitCacheKey(v)&&i.push(v)}i.forEach(function(b){localStorage.removeItem(b)}),this.hasSync=!1},n.fetchMany=function(p){var i=this,m={};return p.forEach(function(v){m[v]=localStorage.getItem(i.keys.buildSplitKey(v))}),m},n.checkCache=function(){return this.getChangeNumber()>-1||this.cacheReadyButNeedsToFlush},n.__checkExpiration=function(p){var i=localStorage.getItem(this.keys.buildLastUpdatedKey());i!==null&&(i=parseInt(i,10),!yy(i)&&i<p&&this.flush())},n.__checkFilterQuery=function(){var p=this,i=this.splitFiltersValidation,m=i.queryString,v=i.groupedFilters,b=this.keys.buildSplitsFilterQueryKey(),M=localStorage.getItem(b);if(M!==m)try{this.updateNewFilter=!0,this.checkCache()&&(localStorage.setItem(this.keys.buildSplitsTillKey(),"-1"),this.getKeys().forEach(function(z){if(m&&(v.byName.indexOf(z)>-1||v.byPrefix.some(function(C){return z.startsWith(C+"__")}))){p.cacheReadyButNeedsToFlush=!0;return}p.removeSplit(z)}))}catch(z){gs.error(z)}},r}();Hx.prototype.killLocally=ap;var Zx=Hx;E();var fC=function(){function r(s){this.keys=s,this.flush()}var n=r.prototype;return n.flush=function(){this.segmentCache={}},n.addToSegment=function(p){var i=this.keys.buildSegmentNameKey(p);return this.segmentCache[i]=!0,!0},n.removeFromSegment=function(p){var i=this.keys.buildSegmentNameKey(p);return delete this.segmentCache[i],!0},n.resetSegments=function(p){var i=this,m=!1,v,b=Object.keys(this.segmentCache);if(p.length===0&&b.length===p.length)return m;if(b.length!==p.length)m=!0,this.segmentCache={},p.forEach(function(M){i.addToSegment(M)});else{for(v=0;v<p.length&&this.isInSegment(p[v]);v++);v<p.length&&(m=!0,this.segmentCache={},p.forEach(function(M){i.addToSegment(M)}))}return m},n.isInSegment=function(p){var i=this.keys.buildSegmentNameKey(p);return this.segmentCache[i]===!0},n.setChangeNumber=function(){return!0},n.getChangeNumber=function(){return-1},n.registerSegment=function(){return!1},n.registerSegments=function(){return!1},n.getRegisteredSegments=function(){return[]},r}(),lp=fC;E();var Ey=Nt("splitio-storage:localstorage"),Xx="1",dC=function(){function r(s){this.keys=s}var n=r.prototype;return n.addToSegment=function(p){var i=this.keys.buildSegmentNameKey(p);try{return localStorage.setItem(i,Xx),!0}catch(m){return Ey.error(m),!1}},n.removeFromSegment=function(p){var i=this.keys.buildSegmentNameKey(p);try{return localStorage.removeItem(i),!0}catch(m){return Ey.error(m),!1}},n.resetSegments=function(p){var i=this,m=!1,v,b=Object.keys(localStorage).reduce(function(M,z){var C=i.keys.extractSegmentName(z);return C&&M.push(C),M},[]);if(p.length===0&&b.length===p.length)return m;if(b.length!==p.length)m=!0,b.forEach(function(M){return i.removeFromSegment(M)}),p.forEach(function(M){return i.addToSegment(M)});else{for(v=0;v<p.length&&b.indexOf(p[v])!==-1;v++);v<p.length&&(m=!0,b.forEach(function(M){return i.removeFromSegment(M)}),p.forEach(function(M){return i.addToSegment(M)}))}return m},n.isInSegment=function(p){return localStorage.getItem(this.keys.buildSegmentNameKey(p))===Xx},n.setChangeNumber=function(){return!0},n.getChangeNumber=function(){return-1},n.registerSegment=function(){return!1},n.registerSegments=function(){return!1},n.getRegisteredSegments=function(){return[]},n.flush=function(){Ey.info("Flushing MySegments data from localStorage"),this.resetSegments([])},r}(),Ty=dC;E();var mC=function(){function r(){this.queue=[]}var n=r.prototype;return n.state=function(){return this.queue},n.track=function(p){var i;return(i=this.queue).push.apply(i,p),this},n.clear=function(){return this.queue.length=0,this},n.toJSON=function(){return this.queue},n.isEmpty=function(){return this.queue.length===0},r}(),My=mC;E();E();E();function yC(r,n){for(var s=0,p=r.length-1,i=Math.floor((p+s)/2),m=s,v=p;r[i]!==n&&s<p;)n<r[i]?p=i-1:n>r[i]&&(s=i+1),i=Math.floor((p+s)/2);return i<m?i=m:i>v&&(i=v),n<r[i]&&i>m?i-1:i}var Yx=yC;var Jx=Yx.bind(null,[1,1.5,2.25,3.38,5.06,7.59,11.39,17.09,25.63,38.44,57.67,86.5,129.75,194.62,291.93,437.89,656.84,985.26,1477.89,2216.84,3325.26,4987.89,7481.83]);var gC=function(){function r(){this.clear()}var n=r.prototype;return n.clear=function(){return this.counters={},this},n.state=function(){return this.counters},n.track=function(p,i){return this.counters[p]===void 0&&(this.counters[p]=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),this.counters[p][Jx(i)]++,this},n.isEmpty=function(){return Object.keys(this.counters).length===0},n.toJSON=function(){return this.counters},r}(),Iy=gC;E();var vC=function(){function r(){this.clear()}var n=r.prototype;return n.clear=function(){return this.counters={},this},n.state=function(){return this.counters},n.track=function(p){return this.counters[p]===void 0?this.counters[p]=1:this.counters[p]++,this.counters[p]},n.isEmpty=function(){return Object.keys(this.counters).length===0},n.toJSON=function(){return this.counters},r}(),Cy=vC;E();var _C=5*1024*1024,xC=function(){function r(s){var p=this,i=s.get(s.constants.SETTINGS),m=s.get(s.constants.EVENTS);this.onFullQueue=!1,this.maxQueue=i.scheduler.eventsQueueSize,this.queue=[],this.queueByteSize=0,er(m)?m.then(function(v){p.onFullQueue=v.flushAndResetTimer,p._checkForFlush()}):typeof m.flushAndResetTimer=="function"&&(this.onFullQueue=m.flushAndResetTimer)}var n=r.prototype;return n.state=function(){return this.queue},n.track=function(p,i){return i===void 0&&(i=0),this.queueByteSize+=i,this.queue.push(p),this._checkForFlush(),!0},n.clear=function(){return this.queue=[],this.queueByteSize=0,this},n.toJSON=function(){return this.queue},n.isEmpty=function(){return this.queue.length===0},n._checkForFlush=function(){(this.queueByteSize>_C||this.maxQueue>0&&this.queue.length>=this.maxQueue)&&this.onFullQueue&&this.onFullQueue()},r}(),Ay=xC;E();var bC=/[^.]+$/,wC=/count\.([^/]+)$/,SC=/latency\.([^/]+)\.bucket\.([0-9]+)$/,EC=function(){function r(s){this.settings=s}var n=r.prototype;return n.buildSplitKey=function(p){return this.settings.storage.prefix+".split."+p},n.buildTrafficTypeKey=function(p){return this.settings.storage.prefix+".trafficType."+p},n.buildSplitsTillKey=function(){return this.settings.storage.prefix+".splits.till"},n.buildSplitsReady=function(){return this.settings.storage.prefix+".splits.ready"},n.isSplitKey=function(p){return Xs(p,this.settings.storage.prefix+".split.")},n.buildSegmentNameKey=function(p){return this.settings.storage.prefix+".segment."+p},n.buildSegmentTillKey=function(p){return this.settings.storage.prefix+".segment."+p+".till"},n.buildRegisteredSegmentsKey=function(){return this.settings.storage.prefix+".segments.registered"},n.buildSegmentsReady=function(){return this.settings.storage.prefix+".segments.ready"},n.buildVersionablePrefix=function(){return this.settings.storage.prefix+"/"+this.settings.version+"/"+this.settings.runtime.ip},n.buildImpressionsKey=function(){return this.settings.storage.prefix+".impressions"},n.buildEventsKey=function(){return this.settings.storage.prefix+".events"},n.buildLatencyKeyPrefix=function(){return this.buildVersionablePrefix()+"/latency"},n.buildLatencyKey=function(p,i){return this.buildLatencyKeyPrefix()+"."+p+".bucket."+i},n.buildCountKey=function(p){return this.buildVersionablePrefix()+"/count."+p},n.buildGaugeKey=function(p){return this.buildVersionablePrefix()+"/gauge."+p},n.searchPatternForCountKeys=function(){return this.buildVersionablePrefix()+"/count.*"},n.searchPatternForSplitKeys=function(){return this.settings.storage.prefix+".split.*"},n.searchPatternForLatency=function(){return this.buildLatencyKeyPrefix()+".*"},n.extractKey=function(p){var i=p.match(bC);if(i&&i.length)return i[0];throw new Error("Invalid latency key provided")},n.extractCounterName=function(p){var i=p.match(wC);if(i&&i.length)return i[1];throw new Error("Invalid counter key provided")},n.extractLatencyMetricNameAndBucket=function(p){var i=p.match(SC);if(i&&i.length>2)return{metricName:i[1],bucketNumber:i[2]};throw new Error("Invalid counter key provided")},r}(),Sh=EC;E();E();E();function vs(r,n){return vs=Object.setPrototypeOf||function(p,i){return p.__proto__=i,p},vs(r,n)}function Qo(r,n){r.prototype=Object.create(n.prototype),r.prototype.constructor=r,vs(r,n)}E();function Qx(r,n){return n===void 0&&(n=!1),function(p){return Yi(p)?p[r]:n?void 0:p}}var Aa=Qx("matchingKey"),$x=Qx("bucketingKey",!0);var TC=function(r){Qo(n,r);function n(p){var i;return i=r.call(this,p)||this,i.regexSplitCacheKey=new RegExp("^"+i.settings.storage.prefix+"\\.(splits?|trafficType)\\."),i}var s=n.prototype;return s.buildSegmentNameKey=function(i){return Aa(this.settings.core.key)+"."+this.settings.storage.prefix+".segment."+i},s.extractSegmentName=function(i){var m=Aa(this.settings.core.key)+"."+this.settings.storage.prefix+".segment.";if(Xs(i,m))return i.substr(m.length)},s.buildSplitsWithSegmentCountKey=function(){return this.settings.storage.prefix+".splits.usingSegments"},s.buildLastUpdatedKey=function(){return this.settings.storage.prefix+".splits.lastUpdated"},s.isSplitCacheKey=function(i){return this.regexSplitCacheKey.test(i)},s.buildSplitsFilterQueryKey=function(){return this.settings.storage.prefix+".splits.filterQuery"},n}(Sh),Py=TC;var MC=864e6,IC=function(n){var s=n.get(n.constants.SETTINGS),p=s.storage;switch(p.type){case Js:{var i=new Sh(s);return{splits:new sp,segments:new lp(i),impressions:new My,metrics:new Iy,count:new Cy,events:new Ay(n),shared:function(M){var z=new Sh(M);return{splits:this.splits,segments:new lp(z),impressions:this.impressions,metrics:this.metrics,count:this.count,events:this.events,destroy:function(){this.splits=new sp,this.segments.flush()}}},destroy:function(){this.splits.flush(),this.segments.flush(),this.impressions.clear(),this.metrics.clear(),this.count.clear(),this.events.clear()}}}case Qs:{var m=new Py(s),v=Date.now()-MC;return{splits:new Zx(m,v,s.sync.__splitFiltersValidation),segments:new Ty(m),impressions:new My,metrics:new Iy,count:new Cy,events:new Ay(n),shared:function(M){var z=new Py(M);return{splits:this.splits,segments:new Ty(z),impressions:this.impressions,metrics:this.metrics,count:this.count,events:this.events,destroy:function(){this.splits=new sp,this.segments=new lp(z)}}},destroy:function(){this.splits=new sp,this.segments=new lp(new Sh(s)),this.impressions.clear(),this.metrics.clear(),this.count.clear(),this.events.clear()}}}default:throw new Error("Unsupported storage type")}},t1=IC;E();var bd=zr(Ly()),c1=2,p1=4,f1=c1|p1,kC=8,ky=f1|kC,gn={SDK_READY_TIMED_OUT:"init::timeout",SDK_READY:"init::ready",SDK_READY_FROM_CACHE:"init::cache-ready",SDK_SPLITS_ARRIVED:"state::splits-arrived",SDK_SEGMENTS_ARRIVED:"state::segments-arrived",SDK_SPLITS_CACHE_LOADED:"state::splits-cache-loaded",SDK_UPDATE:"state::update",READINESS_GATE_CHECK_STATE:"state::check"};function RC(){var r=0,n=new bd.default;n.SDK_SPLITS_CACHE_LOADED=gn.SDK_SPLITS_CACHE_LOADED,n.SDK_SPLITS_ARRIVED=gn.SDK_SPLITS_ARRIVED;var s=0;function p(m,v){var b=new bd.default,M=0,z=0;return b.on(gn.READINESS_GATE_CHECK_STATE,function(){z!==ky&&r+M===f1?(z=ky,b.emit(gn.SDK_READY)):z===ky&&b.emit(gn.SDK_UPDATE)}),m.on(gn.SDK_SPLITS_ARRIVED,function(C){C||(r=c1),b.emit(gn.READINESS_GATE_CHECK_STATE)}),m.once(gn.SDK_SPLITS_CACHE_LOADED,function(){b.emit(gn.SDK_READY_FROM_CACHE)}),v.on(gn.SDK_SEGMENTS_ARRIVED,function(){M=p1,b.emit(gn.READINESS_GATE_CHECK_STATE)}),b}function i(m){m===void 0&&(m=0);var v=0,b=new bd.default;b.SDK_SEGMENTS_ARRIVED=gn.SDK_SEGMENTS_ARRIVED;var M=p(n,b);return m>0&&(v=setTimeout(function(){M.emit(gn.SDK_READY_TIMED_OUT,"Split SDK emitted SDK_READY_TIMED_OUT event.")},m),M.once(gn.SDK_READY,function(){return clearTimeout(v)})),M.SDK_READY=gn.SDK_READY,M.SDK_READY_FROM_CACHE=gn.SDK_READY_FROM_CACHE,M.SDK_UPDATE=gn.SDK_UPDATE,M.SDK_READY_TIMED_OUT=gn.SDK_READY_TIMED_OUT,s++,{splits:n,segments:b,gate:M,destroy:function(){b.removeAllListeners(),M.removeAllListeners(),clearTimeout(v),s>0&&s--,s===0&&n.removeAllListeners()}}}return i}var d1=RC;E();var Sd=zr(Ci());E();var m1="javascript";E();function Ry(){return{ip:!1,hostname:!1}}E();var y1={startup:{requestTimeoutBeforeReady:5,retriesOnFailureBeforeReady:1,readyTimeout:10,eventsFirstPushWindow:10}};E();var zC=Nt("splitio-settings"),DC=function(n){var s=n.mode,p=n.storage,i=p.type,m=i===void 0?Js:i,v=p.options,b=v===void 0?{}:v,M=p.prefix,z;M?M+=".SPLITIO":M="SPLITIO";var C=function(){z=m,m=Js};return s===Ca&&m===Qs&&C(),(m!==Js&&m!==Qs||m===Qs&&!Zc())&&(C(),zC.warn("Invalid or unavailable storage. Fallbacking into MEMORY storage")),{type:m,options:b,prefix:M,__originalType:z}},g1=DC;E();E();var OC=Nt("splitio-settings"),NC=function(n,s){s===void 0&&(s=[]);var p=n.integrations;if(!Array.isArray(p)||p.length===0)return[];var i=p.filter(function(v){return v&&Ir(v.type)&&s.indexOf(v.type)>-1}),m=p.length-i.length;return m&&OC.warn(m+" integration "+(m===1?"item":"items")+" at settings "+(m===1?"is":"are")+" invalid: integration items must have a valid 'type' value"),i},v1=NC;var FC=function(n){return v1(n,[yd,gd])},_1=FC;E();function BC(r,n){if(r==="localhost")return Ca;if([Jo,bh,wh].indexOf(n)===-1)throw Error("Invalid mode provided");return n}var x1=BC;E();var wd=Nt("splitio-settings");function UC(r){return vd.some(function(n){return n.type===r})}function GC(r,n,s){var p=rp(n,"settings",r+" filter",r+" filter value");if(p){if(p.length>s)throw new Error(s+" unique values can be specified at most for '"+r+"' filter. You passed "+p.length+". Please consider reducing the amount or using other filter.");p.sort()}return p||[]}function VC(r){var n=[];return vd.forEach(function(s){var p=s.type,i=s.queryParam,m=r[p];m.length>0&&n.push(i+m.map(function(v){return encodeURIComponent(v)}).join(","))}),n.length>0?"&"+n.join("&"):null}function zy(r,n){var s={validFilters:[],queryString:null,groupedFilters:{byName:[],byPrefix:[]}};return r?n!==Jo?(wd.warn("split filters have been configured but will have no effect if mode is not '"+Jo+"', since synchronization is being deferred to an external tool."),s):!Array.isArray(r)||r.length===0?(wd.warn("splitFilters configuration must be a non-empty array of filter objects."),s):(s.validFilters=r.filter(function(p,i){return p&&UC(p.type)&&Array.isArray(p.values)?(s.groupedFilters[p.type]=s.groupedFilters[p.type].concat(p.values),!0):(wd.warn("split filter at position '"+i+"' is invalid. It must be an object with a valid filter type ('byName' or 'byPrefix') and a list of 'values'."),!1)}),vd.forEach(function(p){var i=p.type,m=p.maxLength;s.groupedFilters[i].length>0&&(s.groupedFilters[i]=GC(i,s.groupedFilters[i],m))}),s.queryString=VC(s.groupedFilters),wd.debug("splits filtering criteria is '"+s.queryString+"'."),s):s}E();var jC=Nt("splitio-settings");function qC(r){return r=r.toUpperCase(),[Hl,yn].indexOf(r)===-1&&(jC.error("You passed an invalid impressionsMode, impressionsMode should be one of the following values: '"+Hl+"' or '"+yn+"'. Defaulting to '"+yn+"' mode."),r=yn),r}var b1=qC;var WC="10.16.1",KC=/^\/(testImpressions|metrics|events)/,HC=/^\/v2\/auth/,ZC=/^\/(sse|event-stream)/,XC={mode:Jo,core:{authorizationKey:void 0,key:void 0,trafficType:void 0,labelsEnabled:!0,IPAddressesEnabled:void 0},scheduler:{featuresRefreshRate:30,segmentsRefreshRate:60,metricsRefreshRate:120,impressionsRefreshRate:60,offlineRefreshRate:15,eventsPushRate:60,eventsQueueSize:500,pushRetryBackoffBase:1},urls:{sdk:"https://sdk.split.io/api",events:"https://events.split.io/api",auth:"https://auth.split.io/api",streaming:"https://streaming.split.io"},storage:{type:Js},debug:void 0,impressionListener:void 0,version:m1+"-"+WC,integrations:void 0,streamingEnabled:!0,sync:{splitFilters:void 0,impressionsMode:yn}};function Pa(r){return Math.round(r*1e3)}function YC(r){typeof r=="boolean"?r?ms.enable():ms.disable():typeof r=="string"&&ms.setLogLevel(r)}function JC(r){var n=Wl({},XC,y1,r);n.scheduler.featuresRefreshRate=Pa(n.scheduler.featuresRefreshRate),n.scheduler.segmentsRefreshRate=Pa(n.scheduler.segmentsRefreshRate),n.scheduler.metricsRefreshRate=Pa(n.scheduler.metricsRefreshRate),n.scheduler.impressionsRefreshRate=Pa(n.scheduler.impressionsRefreshRate),n.scheduler.offlineRefreshRate=Pa(n.scheduler.offlineRefreshRate),n.scheduler.eventsPushRate=Pa(n.scheduler.eventsPushRate),n.startup.requestTimeoutBeforeReady=Pa(n.startup.requestTimeoutBeforeReady),n.startup.readyTimeout=Pa(n.startup.readyTimeout),n.startup.eventsFirstPushWindow=Pa(n.startup.eventsFirstPushWindow),n.mode=x1(n.core.authorizationKey,n.mode),n.storage=g1(n),YC(n.debug),n.runtime=Ry(n.core.IPAddressesEnabled,n.mode===wh),n.integrations=_1(n),n.streamingEnabled!==!1&&(n.streamingEnabled=!0,n.scheduler.pushRetryBackoffBase=Pa(n.scheduler.pushRetryBackoffBase));var s=zy(n.sync.splitFilters,n.mode);return n.sync.splitFilters=s.validFilters,n.sync.__splitFiltersValidation=s,n.sync.impressionsMode=b1(n.sync.impressionsMode),n}var w1={url:function(n){return KC.test(n)?""+this.urls.events+n:HC.test(n)?""+this.urls.auth+n:ZC.test(n)?""+this.urls.streaming+n:""+this.urls.sdk+n},overrideKeyAndTT:function(n,s){return(0,Sd.default)(Object.create(w1),this,{core:(0,Sd.default)({},this.core,{key:n,trafficType:s})})}},QC=function(n){return(0,Sd.default)(Object.create(w1),JC(n))},S1=QC;E();var T1=zr(Ci());E();var $C="metrics_collectors",tA="is_destroyed",eA="events_publisher",rA="has_timedout",iA="integrations_manager",nA="my_segments_change_worker",oA="producer",aA="readiness_gate",sA="is_ready",lA="is_ready_from_cache",uA="settings",hA="status_manager",cA="storage",pA="impressions_counter",E1={COLLECTORS:$C,DESTROYED:tA,EVENTS:eA,HAS_TIMEDOUT:rA,INTEGRATIONS_MANAGER:iA,MY_SEGMENTS_CHANGE_WORKER:nA,PRODUCER:oA,READINESS:aA,READY:sA,READY_FROM_CACHE:lA,SETTINGS:uA,STATUS_MANAGER:hA,STORAGE:cA,IMPRESSIONS_COUNTER:pA};var fA=function(){function r(){this._map={},this.constants=E1}var n=r.prototype;return n.get=function(p,i){if(i===void 0&&(i=!1),!(typeof p!="string"||typeof p=="string"&&!p.length)){var m=this._map[p];if(m!==void 0)return m;if(!i){var v,b=new Promise(function(M){return v=M});return b.manualResolve=v,this._map[p]=b,b}}},n.getAll=function(){return(0,T1.default)({},this._map)},n.put=function(p,i){var m=this;if(typeof p!="string"||typeof p=="string"&&!p.length||i===void 0)return!1;var v=this._map[p];return v!==void 0&&typeof v.manualResolve!="function"?!1:(er(v)&&v.manualResolve&&v.manualResolve(i),er(i)&&i.then(function(b){return m._map[p]=b,b}).catch(function(b){return m._map[p]=void 0,b}),this._map[p]=i,!0)},r}(),Dy=fA;E();var Ed=function(r){return Yi(r)?{matchingKey:r.matchingKey,bucketingKey:r.bucketingKey}:{matchingKey:r,bucketingKey:r}};E();E();E();function dA(){return typeof performance=="object"&&typeof performance.now=="function"?performance.now.bind(performance):Date.now}var mA=dA(),Oy=mA;function yA(){var r=Oy();return function(){return Math.round(Oy()-r)}}var M1=yA;var La,gA=new hd("[TIME TRACKER]",{showLevel:!1}),Td={},_s={SDK_READY:"Getting ready - Split SDK",SDK_GET_TREATMENT:"SDK - Get Treatment",SDK_GET_TREATMENTS:"SDK - Get Treatments",SDK_GET_TREATMENT_WITH_CONFIG:"SDK - Get Treatment with config",SDK_GET_TREATMENTS_WITH_CONFIG:"SDK - Get Treatments with config",SPLITS_READY:"Getting ready - Splits",SEGMENTS_READY:"Getting ready - Segments",METRICS_PUSH:"Pushing - Metrics",IMPRESSIONS_PUSH:"Pushing - Impressions",EVENTS_PUSH:"Pushing - Events",MY_SEGMENTS_FETCH:"Fetching - My Segments",SEGMENTS_FETCH:"Fetching - Segments",SPLITS_FETCH:"Fetching - Splits"},Fy=(La={},La[_s.SDK_READY]={collector:"client",method:"ready"},La[_s.SDK_GET_TREATMENT]={collector:"client",method:"getTreatment"},La[_s.SDK_GET_TREATMENTS]={collector:"client",method:"getTreatments"},La[_s.SDK_GET_TREATMENT_WITH_CONFIG]={collector:"client",method:"getTreatmentWithConfig"},La[_s.SDK_GET_TREATMENTS_WITH_CONFIG]={collector:"client",method:"getTreatmentsWithConfig"},La[_s.MY_SEGMENTS_FETCH]={collector:"mySegments",method:"latency"},La[_s.SEGMENTS_FETCH]={collector:"segmentChanges",method:"latency"},La[_s.SPLITS_FETCH]={collector:"splitChanges",method:"latency"},La),Ny=function(n,s){return typeof s=="string"?n+s:n},I1=function(n,s){var p=Fy[n];return p&&s?s[p.collector]:!1},C1=function(n,s){var p=Fy[n];return p&&s?s[p.method]:!1},vA={__attachToPromise:function(n,s,p,i){var m=this;return n.then(function(v){return m.stop(s,i),p&&p.count&&p.count(v.status),v}).catch(function(v){throw m.stop(s,i),p&&p.countException&&p.countException(),v})},start:function(n,s,p){var i=Sx(),m=I1(n,s),v;er(p)?v=this.__attachToPromise(p,n,m,i):(v=this.stop.bind(this,n,i),Fy[n]&&!m&&(v.setCollectorForTask=this.setCollectorForTask.bind(this,n,i)));var b=Ny(n,i),M=C1(n,m);return Td[b]={cb:M,timer:M1()},v},setCollectorForTask:function(n,s,p){var i=I1(n,p);if(i){var m=Ny(n,s);Td[m].cb=C1(n,i)}},stop:function(n,s){var p=Ny(n,s),i=Td[p];if(i){var m=i.timer();return gA.debug("["+n+"] took "+m+"ms to finish."),i.cb&&i.cb(m),delete Td[p],m}},TaskNames:_s},ii=vA;E();var Ow=zr(Ci());E();E();var Ld=zr(Ci());E();E();E();var Tb=zr(Ci());E();E();E();var ni={UNDEFINED:0,ALL_KEYS:1,IN_SEGMENT:2,WHITELIST:3,EQUAL_TO:4,GREATER_THAN_OR_EQUAL_TO:5,LESS_THAN_OR_EQUAL_TO:6,BETWEEN:7,EQUAL_TO_SET:8,CONTAINS_ANY_OF_SET:9,CONTAINS_ALL_OF_SET:10,PART_OF_SET:11,ENDS_WITH:12,STARTS_WITH:13,CONTAINS_STRING:14,IN_SPLIT_TREATMENT:15,EQUAL_TO_BOOLEAN:16,MATCHES_STRING:17},vn={BOOLEAN:"BOOLEAN",STRING:"STRING",NUMBER:"NUMBER",SET:"SET",DATETIME:"DATETIME",NOT_SPECIFIED:"NOT_SPECIFIED"};function A1(r){var n=ni[r];return n||ni.UNDEFINED}E();function _A(r){return r===void 0&&(r={}),r.segmentName}var P1=_A;E();E();E();function L1(r,n){for(var s=0;s<n.length;s++){var p=n[s];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(r,p.key,p)}}function up(r,n,s){return n&&L1(r.prototype,n),s&&L1(r,s),r}var k1=function(){function r(){var s=this;this.__setData__=[];var p=arguments[0];Array.isArray(p)&&p.forEach(function(i){s.add(i)})}var n=r.prototype;return n.clear=function(){!this.__setData__.length||(this.__setData__.length=0)},n.add=function(p){return this.has(p)?this:(this.__setData__.push(p),this)},n.delete=function(p){var i=this.__setData__.indexOf(p);return i===-1?!1:(this.__setData__.splice(i,1),!0)},n.has=function(p){return this.__setData__.indexOf(p)!==-1},n.forEach=function(p){var i=arguments[1];if(typeof p!="function")throw new TypeError(p+" is not a function");for(var m=0;m<this.__setData__.length;m++){var v=this.__setData__[m];p.call(i,v,v,this)}},up(r,[{key:"size",get:function(){return this.__setData__.length}}]),r}();function Md(r){return r instanceof k1?r.__setData__.slice():Array.from(r)}function xA(){return typeof Array.from=="function"&&typeof Set=="function"&&Set.prototype&&Set.prototype.values?Set:k1}var xs=xA();function bA(r){return new xs(r.whitelist)}var R1=bA;E();function wA(r){return r.whitelist}var By=wA;E();function SA(r){return r.value}var Uy=SA;E();function Id(r){return new Date(r).setUTCHours(0,0,0,0)}function Th(r){return new Date(r).setUTCSeconds(0,0)}function EA(r){var n=r.map(function(s){var p=s.matcherType,i=s.negate,m=s.keySelector,v=s.userDefinedSegmentMatcherData,b=s.whitelistMatcherData,M=s.unaryNumericMatcherData,z=s.betweenMatcherData,C=s.dependencyMatcherData,j=s.booleanMatcherData,Y=s.stringMatcherData,ot=m&&m.attribute,J=A1(p),mt=vn.STRING,ft=void 0;return J===ni.IN_SEGMENT?ft=P1(v):J===ni.WHITELIST?ft=R1(b):J===ni.EQUAL_TO?(ft=Uy(M),mt=vn.NUMBER,M.dataType==="DATETIME"&&(ft=Id(ft),mt=vn.DATETIME)):J===ni.GREATER_THAN_OR_EQUAL_TO||J===ni.LESS_THAN_OR_EQUAL_TO?(ft=Uy(M),mt=vn.NUMBER,M.dataType==="DATETIME"&&(ft=Th(ft),mt=vn.DATETIME)):J===ni.BETWEEN?(ft=z,mt=vn.NUMBER,z.dataType==="DATETIME"&&(ft.start=Th(ft.start),ft.end=Th(ft.end),mt=vn.DATETIME)):J===ni.EQUAL_TO_SET||J===ni.CONTAINS_ANY_OF_SET||J===ni.CONTAINS_ALL_OF_SET||J===ni.PART_OF_SET?(ft=By(b),mt=vn.SET):J===ni.STARTS_WITH||J===ni.ENDS_WITH||J===ni.CONTAINS_STRING?ft=By(b):J===ni.IN_SPLIT_TREATMENT?(ft=C,mt=vn.NOT_SPECIFIED):J===ni.EQUAL_TO_BOOLEAN?(mt=vn.BOOLEAN,ft=j):J===ni.MATCHES_STRING&&(ft=Y),{attribute:ot,negate:i,type:J,value:ft,dataType:mt}});return Gn(n,function(s){return s.type===ni.UNDEFINED})===-1?n:[]}var z1=EA;E();function Mh(r,n){if(!(this instanceof Mh))return new Mh(r,n);if(r[r.length-1]!==100)throw new RangeError("Provided invalid dataset as input");this._ranges=r,this._treatments=n}Mh.parse=function(n){var s=n.reduce(function(m,v){var b=v.size,M=v.treatment;return m.ranges.push(m.inc+=b),m.treatments.push(M),m},{inc:0,ranges:[],treatments:[]}),p=s.ranges,i=s.treatments;return new Mh(p,i)};Mh.prototype.getTreatmentFor=function(n){if(n<0||n>100)throw new RangeError("Please provide a value between 0 and 100");var s=Gn(this._ranges,function(i){return n<=i}),p=this._treatments[s];return p};var D1=Mh;E();E();var TA=Nt("splitio-engine:matcher");function MA(r){return TA.debug("[allMatcher] is always true"),r!=null}function IA(){return MA}var O1=IA;E();var N1=Nt("splitio-engine:matcher");function CA(r,n){function s(p){var i=n.segments.isInSegment(r,p);return er(i)?i.then(function(m){return N1.debug("[asyncSegmentMatcher] evaluated "+r+" / "+p+" => "+i),m}):N1.debug("[segmentMatcher] evaluated "+r+" / "+p+" => "+i),i}return s}var F1=CA;E();var AA=Nt("splitio-engine:matcher");function PA(r){return function(s){var p=r.has(s);return AA.debug("[whitelistMatcher] evaluated "+s+" in ["+Md(r).join(",")+"] => "+p),p}}var B1=PA;E();var LA=Nt("splitio-engine:matcher");function kA(r){return function(s){var p=s===r;return LA.debug("[equalToMatcher] is "+s+" equal to "+r+"? "+p),p}}var U1=kA;E();var RA=Nt("splitio-engine:matcher");function zA(r){return function(s){var p=s>=r;return RA.debug("[greaterThanEqualMatcher] is "+s+" greater than "+r+"? "+p),p}}var G1=zA;E();var DA=Nt("splitio-engine:matcher");function OA(r){return function(s){var p=s<=r;return DA.debug("[lessThanEqualMatcher] is "+s+" less than "+r+"? "+p),p}}var V1=OA;E();var NA=Nt("splitio-engine:matcher");function FA(r){return function(s){var p=s>=r.start&&s<=r.end;return NA.debug("[betweenMatcher] is "+s+" between "+r.start+" and "+r.end+"? "+p),p}}var j1=FA;E();var BA=Nt("splitio-engine:matcher");function UA(r){return function(s){for(var p=s.length===r.length,i=function(b){Gn(r,function(M){return M===s[b]})<0&&(p=!1)},m=0;m<s.length&&p;m++)i(m);return BA.debug("[equalToSetMatcher] is "+s+" equal to set "+r+"? "+p),p}}var q1=UA;E();var GA=Nt("splitio-engine:matcher");function VA(r){return function(s){var p=!0;if(s.length<r.length)p=!1;else for(var i=function(b){Gn(s,function(M){return M===r[b]})<0&&(p=!1)},m=0;m<r.length&&p;m++)i(m);return GA.debug("[containsAllMatcher] "+s+" contains all elements of "+r+"? "+p),p}}var W1=VA;E();var jA=Nt("splitio-engine:matcher");function qA(r){return function(s){for(var p=!1,i=function(b){Gn(s,function(M){return M===r[b]})>=0&&(p=!0)},m=0;m<r.length&&!p;m++)i(m);return jA.debug("[containsAnyMatcher] "+s+" contains at least an element of "+r+"? "+p),p}}var K1=qA;E();var WA=Nt("splitio-engine:matcher");function KA(r){return function(s){for(var p=s.length<=r.length,i=function(b){Gn(r,function(M){return M===s[b]})<0&&(p=!1)},m=0;m<s.length&&p;m++)i(m);return WA.debug("[partOfMatcher] "+s+" is part of "+r+"? "+p),p}}var H1=KA;E();var HA=Nt("splitio-engine:matcher");function ZA(r){return function(s){var p=r.some(function(i){return Xs(s,i)});return HA.debug("[startsWithMatcher] "+s+" starts with "+r+"? "+p),p}}var Z1=ZA;E();var XA=Nt("splitio-engine:matcher");function YA(r){return function(s){var p=r.some(function(i){return wx(s,i)});return XA.debug("[endsWithMatcher] "+s+" ends with "+r+"? "+p),p}}var X1=YA;E();var JA=Nt("splitio-engine:matcher");function QA(r){return function(s){var p=r.some(function(i){return Ir(s)&&s.indexOf(i)>-1});return JA.debug("[containsStringMatcher] "+s+" contains "+r+"? "+p),p}}var Y1=QA;E();var Q1=Nt("splitio-engine:matcher");function J1(r,n,s){var p=!1;return Array.isArray(n)&&(p=n.indexOf(r.treatment)!==-1),Q1.debug('[dependencyMatcher] Parent split "'+s+'" evaluated to "'+r.treatment+'" with label "'+r.label+'". '+s+" evaluated treatment is part of ["+n+"] ? "+p+"."),p}function $A(r,n){var s=r.split,p=r.treatments;return function(m,v){var b=m.key,M=m.attributes;Q1.debug('[dependencyMatcher] will evaluate parent split: "'+s+'" with key: '+JSON.stringify(b)+" "+(M?`
|
|
544
|
+
attributes: `+JSON.stringify(M):""));var z=v(b,s,M,n);return er(z)?z.then(function(C){return J1(C,p,s)}):J1(z,p,s)}}var $1=$A;E();var tP=Nt("splitio-engine:matcher");function eP(r){return function(s){var p=r===s;return tP.debug("[booleanMatcher] "+r+" === "+s),p}}var tb=eP;E();var eb=Nt("splitio-engine:matcher");function rP(r){return function(s){var p;try{p=new RegExp(r)}catch{return eb.debug("[stringMatcher] "+r+" is an invalid regex"),!1}var i=p.test(s);return eb.debug("[stringMatcher] does "+s+" matches with "+r+"? "+(i?"yes":"no")),i}}var rb=rP;var ib=[void 0,O1,F1,B1,U1,G1,V1,j1,q1,K1,W1,H1,X1,Z1,Y1,$1,tb,rb];function iP(r,n){var s=r.type,p=r.value,i;return ib[s]&&(i=ib[s](p,n)),i}var nb=iP;E();E();var nP=Nt("splitio-engine:sanitize");function oP(r){var n=Ys(r);return isNaN(n)?void 0:n}function aP(r){var n=r;Yi(r)&&(n=r.matchingKey?r.matchingKey:void 0);var s=yh(n);return s||void 0}function sP(r){var n=Array.isArray(r)?mh(r.map(function(s){return s+""})):[];return n.length?n:void 0}function lP(r){if(r===!0||r===!1)return r;if(typeof r=="string"){var n=r.toLocaleLowerCase();if(n==="true")return!0;if(n==="false")return!1}}function uP(r,n){return{key:r,attributes:n}}function hP(r,n){switch(r){case ni.EQUAL_TO:return n==="DATETIME"?Id:void 0;case ni.GREATER_THAN_OR_EQUAL_TO:case ni.LESS_THAN_OR_EQUAL_TO:case ni.BETWEEN:return n==="DATETIME"?Th:void 0;case ni.IN_SPLIT_TREATMENT:return uP;default:return}}function cP(r,n,s,p){var i=hP(r,s),m;switch(s){case vn.NUMBER:case vn.DATETIME:m=oP(n);break;case vn.STRING:m=aP(n);break;case vn.SET:m=sP(n);break;case vn.BOOLEAN:m=lP(n);break;case vn.NOT_SPECIFIED:m=n;break;default:m=void 0}return i&&(m=i(m,p)),nP.debug("Attempted to sanitize ["+n+"] which should be of type ["+s+`].
|
|
545
|
+
Sanitized and processed value => [`+(m instanceof Object?JSON.stringify(m):m)+"]"),m}var ob=cP;var Gy=Nt("splitio-engine:value");function pP(r,n,s){var p=void 0;return n?s?(p=s[n],Gy.debug("Extracted attribute ["+n+"], ["+p+"] will be used for matching.")):Gy.warn("Defined attribute ["+n+"], no attributes received."):p=r,p}function fP(r,n,s){var p=n.attribute,i=pP(r,p,s),m=ob(n.type,i,n.dataType,s);if(m!==void 0)return m;Gy.warn("Value "+i+" "+(p?"for attribute "+p+" ":+"")+"doesn't match with expected type.")}var ab=fP;E();E();E();function dP(r){return r=Number(r),r<0?Math.ceil(r):Math.floor(r)}function mP(r,n){return r-Math.floor(r/n)*n}function yP(r){return mP(dP(r),Math.pow(2,32))}function Vy(r){var n=yP(r);return n>=Math.pow(2,31)?n-Math.pow(2,32):n}function sb(r,n){for(var s=0,p=0;p<r.length;p++)s=Vy(Vy(31*s)+r.charCodeAt(p));return Vy(s^n)}function gP(r,n){return Math.abs(sb(r,n)%100)+1}var lb={hash:sb,bucket:gP};E();E();E();function vP(r,n){var s=null;for(typeof r=="number"&&(s=r,r=function(){return null});s!==null||(s=r())!==null;)s<128?n(s&127):s<2048?(n(s>>6&31|192),n(s&63|128)):s<65536?(n(s>>12&15|224),n(s>>6&63|128),n(s&63|128)):(n(s>>18&7|240),n(s>>12&63|128),n(s>>6&63|128),n(s&63|128)),s=null}function _P(r,n){for(var s,p=null;(s=p!==null?p:r())!==null;){if(s>=55296&&s<=57343&&(p=r())!==null&&p>=56320&&p<=57343){n((s-55296)*1024+p-56320+65536),p=null;continue}n(s)}p!==null&&n(p)}function hb(r,n){_P(r,function(s){vP(s,n)})}var ub=String.fromCharCode;function cb(r){if(typeof r!="string")throw TypeError("Illegal argument: "+typeof r);var n=0;return function(){return n>=r.length?null:r.charCodeAt(n++)}}function pb(){var r=[],n=[];return function(){if(arguments.length===0)return n.join("")+ub.apply(String,r);r.length+arguments.length>1024&&(n.push(ub.apply(String,r)),r.length=0),Array.prototype.push.apply(r,arguments)}}function Cd(r){var n;return hb(cb(r),n=pb()),n()}function tl(r,n){return(r&65535)*n+(((r>>>16)*n&65535)<<16)}function Ad(r,n){return r<<n|r>>>32-n}function fb(r){return r^=r>>>16,r=tl(r,2246822507),r^=r>>>13,r=tl(r,3266489909),r^=r>>>16,r}function xP(r,n){r=r||"",n=n||0;for(var s=r.length%4,p=r.length-s,i=n,m=0,v=3432918353,b=461845907,M=0;M<p;M=M+4)m=r.charCodeAt(M)&255|(r.charCodeAt(M+1)&255)<<8|(r.charCodeAt(M+2)&255)<<16|(r.charCodeAt(M+3)&255)<<24,m=tl(m,v),m=Ad(m,15),m=tl(m,b),i^=m,i=Ad(i,13),i=tl(i,5)+3864292196;switch(m=0,s){case 3:m^=(r.charCodeAt(M+2)&255)<<16;case 2:m^=(r.charCodeAt(M+1)&255)<<8;case 1:m^=r.charCodeAt(M)&255,m=tl(m,v),m=Ad(m,15),m=tl(m,b),i^=m}return i^=r.length,i=fb(i),i>>>0}function db(r,n){return xP(Cd(r),n>>>0)}function bP(r,n){return Math.abs(db(r,n)%100)+1}var Ih={hash:db,bucket:bP};var wP=Nt("splitio-engine"),yb=2;function mb(r){return r===yb?Ih.bucket:lb.bucket}var SP={getTreatment:function(n,s,p,i){var m=mb(i)(n,s),v=p.getTreatmentFor(m);return wP.debug("[engine] using algo "+(i!==yb?"legacy":"murmur")+" bucket "+m+" for key "+n+" using seed "+s+" - treatment "+v),v},shouldApplyRollout:function(n,s,p,i){if(n<100){var m=mb(i)(s,p);if(m>n)return!1}return!0}},jy=SP;function gb(r,n,s,p,i,m){if(r){var v=jy.getTreatment(n,s,p,m);return{treatment:v,label:i}}}function EP(r,n,s,p){function i(m,v,b,M,z,C,j){if(p==="ROLLOUT"&&!jy.shouldApplyRollout(b,m.bucketingKey,M,j))return{treatment:void 0,label:Bx};var Y=r(m,C,z);return er(Y)?Y.then(function(ot){return gb(ot,m.bucketingKey,v,n,s,j)}):gb(Y,m.bucketingKey,v,n,s,j)}return i}var vb=EP;E();var qy=Nt("splitio-engine:combiner");function TP(){return qy.error("Invalid Split provided, no valid conditions found"),{treatment:Vn,label:_h}}function _b(r){for(var n=r.length,s=0;s<n;s++){var p=r[s];if(p!==void 0)return qy.debug("Treatment found: "+p.treatment),p}qy.debug("All predicates evaluated, no treatment found.")}function MP(r){function n(s,p,i,m,v,b,M){var z=r.map(function(C){return C(s,p,i,m,M,v,b)});return Gn(z,er)!==-1?Promise.all(z).then(function(C){return _b(C)}):_b(z)}return!Array.isArray(r)||Array.isArray(r)&&r.length===0?TP:n}var xb=MP;E();var IP=Nt("splitio-engine:combiner");function bb(r){for(var n=0,s=r.length,p;n<s&&r[n];n++);return p=n===s,IP.debug("[andCombiner] evaluates to "+p),p}function CP(r){function n(){for(var s=arguments.length,p=new Array(s),i=0;i<s;i++)p[i]=arguments[i];var m=r.map(function(v){return v.apply(void 0,p)});return Gn(m,er)!==-1?Promise.all(m).then(bb):bb(m)}return n}var wb=CP;function AP(r,n){for(var s=[],p=0;p<r.length;p++){var i=r[p],m=i.matcherGroup.matchers,v=i.partitions,b=i.label,M=i.conditionType;m=z1(m);var z=m.map(function(C){var j=nb(C,n);return function(Y,ot,J){var mt=ab(Y,C,ot),ft=mt!==void 0?j(mt,J):!1;return er(ft)?ft.then(function(At){return Boolean(At^C.negate)}):Boolean(ft^C.negate)}});if(z.length===0){s=[];break}s.push(vb(wb(z),D1.parse(v),b,M))}return xb(s)}var Sb=AP;function PP(r){typeof r.baseInfo.defaultTreatment!="string"&&(r.baseInfo.defaultTreatment=Vn)}function Eb(r,n){return{treatment:ds(r,"treatment",n),label:ds(r,"label",Ox)}}function bs(r,n){if(!(this instanceof bs))return new bs(r,n);this.baseInfo=r,this.evaluator=n,PP(this)}bs.parse=function(n,s){var p=n.conditions,i=Sb(p,s);return new bs((0,Tb.default)({},n),i)};bs.prototype.getKey=function(){return this.baseInfo.name};bs.prototype.getTreatment=function(n,s,p){var i=this.baseInfo,m=i.killed,v=i.seed,b=i.defaultTreatment,M=i.trafficAllocation,z=i.trafficAllocationSeed,C=i.algo,j,Y,ot;try{j=Ed(n)}catch{return{treatment:Vn,label:_h}}if(this.isGarbage())Y=Vn,ot=Fx;else if(m)Y=b,ot=Dx;else{var J=this.evaluator(j,v,M,z,s,C,p);return er(J)?J.then(function(mt){return Eb(mt,b)}):Eb(J,b)}return{treatment:Y,label:ot}};bs.prototype.isGarbage=function(){return this.baseInfo.status==="ARCHIVED"};bs.prototype.getChangeNumber=function(){return this.baseInfo.changeNumber};var Mb=bs;var Cb={treatment:Vn,label:_h,config:null};function Ky(r,n,s,p){var i;try{i=p.splits.getSplit(n)}catch{return Promise.resolve(Cb)}return er(i)?i.then(function(m){return Wy(m,r,s,p)}):Wy(i,r,s,p)}function Ab(r,n,s,p){var i,m={};try{i=p.splits.fetchMany(n)}catch{return n.forEach(function(b){m[b]=Cb}),Promise.resolve(m)}return er(i)?i.then(function(v){return Ib(n,v,r,s,p)}):Ib(n,i,r,s,p)}function Wy(r,n,s,p){var i={treatment:Vn,label:fd,config:null};if(r){var m=JSON.parse(r),v=Mb.parse(m,p);if(i=v.getTreatment(n,s,Ky),er(i))return i.then(function(b){return b.changeNumber=v.getChangeNumber(),b.config=ds(m,"configurations."+b.treatment,null),b});i.changeNumber=v.getChangeNumber(),i.config=ds(m,"configurations."+i.treatment,null)}return i}function Ib(r,n,s,p,i){var m={},v=[];return r.forEach(function(b){var M=Wy(n[b],s,p,i);er(M)?v.push(M.then(function(z){m[b]=z})):m[b]=M}),v.length>0?Promise.all(v).then(function(){return m}):m}E();var Ob=zr(Ci());E();E();E();E();var Ch=function(n,s,p,i){this.list=i,this.value=n,s?(s.next=this,this.prev=s):this.prev=null,p?(p.prev=this,this.next=p):this.next=null},Pb=function(){function r(){this.tail=null,this.head=null,this.length=0}var n=r.prototype;return n.removeNode=function(p){if(!(!p||!(p instanceof Ch))){if(p.list!==this)throw new Error("removing node which does not belong to this list");var i=p.next,m=p.prev;return i&&(i.prev=m),m&&(m.next=i),p===this.head&&(this.head=i),p===this.tail&&(this.tail=m),p.list.length--,p.next=null,p.prev=null,p.list=null,i}},n.unshiftNode=function(p){if(!(!p||!(p instanceof Ch))&&p!==this.head){p.list&&p.list.removeNode(p);var i=this.head;p.list=this,p.next=i,i&&(i.prev=p),this.head=p,this.tail||(this.tail=p),this.length++}},n.unshift=function(){for(var p=0,i=arguments.length;p<i;p++)this.head=new Ch(arguments[p],null,this.head,this),this.tail||(this.tail=this.head),this.length++;return this.length},r}();var LP=typeof Map<"u"?Map:function(){function r(){}var n=r.prototype;return n.set=function(p,i){this[p]=i},n.get=function(p){return this[p]},n.delete=function(p){delete this[p]},up(r,[{key:"size",get:function(){return Object.keys(this).length}}]),r}(),kP=function(){function r(s){this.maxLen=s||1,this.items=new LP,this.lru=new Pb}var n=r.prototype;return n.get=function(p){var i=this.items.get(p);if(!(!i||!(i instanceof Ch)))return this.lru.unshiftNode(i),i.value.value},n.set=function(p,i){var m=this.items.get(p);if(m){if(!(m instanceof Ch))return!1;this.lru.unshiftNode(m),this.lru.head.value.value=i}else{if(this.lru.length===this.maxLen){var v=this.lru.tail;if(!v)return!1;this.items.delete(v.value.key),this.lru.removeNode(this.lru.tail)}this.lru.unshift({key:p,value:i}),this.items.set(p,this.lru.head)}return!0},r}(),Lb=kP;var RP=function(){function r(s,p){this.cache=new Lb(s),this.hasher=p}var n=r.prototype;return n.testAndSet=function(p){var i=this.hasher(p),m=this.cache.get(i);return this.cache.set(i,p.time),m},r}(),kb=RP;E();E();function Rb(r){return r.keyName+":"+r.feature+":"+r.treatment+":"+r.label+":"+r.changeNumber}function zb(r){return Ih.hash(Rb(r))}var zP=500,DP=function(){return new kb(zP,zb)},Db=DP;E();var OP=36e5;function Pd(r){return r-r%OP}var Hy=Nt("splitio-client:impressions-tracker");function Nb(r){return[bh,Jo].indexOf(r.mode)>-1}function NP(r){return Nb(r)?r.sync.impressionsMode===yn:!1}function FP(r){var n=r.get(r.constants.STORAGE).impressions,s=r.get(r.constants.SETTINGS),p=s.impressionListener,i=r.get(r.constants.INTEGRATIONS_MANAGER,!0),m=s.runtime,v=m.ip,b=m.hostname,M=s.version,z=[],C=Nb(s),j=NP(s),Y=Db(),ot=r.get(r.constants.IMPRESSIONS_COUNTER);return{queue:function(mt,ft){z.push({impression:mt,attributes:ft})},track:function(){var mt=z.length,ft=z.splice(0,mt),At=[];ft.forEach(function(he){var Kt=he.impression;C&&(Kt.pt=Y.testAndSet(Kt));var ce=Date.now();j&&ot&&ot.inc(Kt.feature,ce,1),(!j||!Kt.pt||Kt.pt<Pd(ce))&&At.push(Kt)});var Gt=n.track(At);if(er(Gt)&&Gt.then(function(){Hy.debug("Successfully stored "+mt+" impression"+(mt===1?"":"s")+".")}).catch(function(he){Hy.error("Could not store impressions bulk with "+mt+" impression"+(mt===1?"":"s")+". Error: "+he)}),p||i)for(var Zt=function(Kt){var ce={impression:(0,Ob.default)({},ft[Kt].impression),attributes:ft[Kt].attributes,ip:v,hostname:b,sdkLanguageVersion:M};setTimeout(function(){i&&i.handleImpression(ce);try{p&&p.logImpression(ce)}catch(Yt){Hy.error("Impression listener logImpression method threw: "+Yt+".")}},0)},we=0;we<mt;we++)Zt(we)}}}var Fb=FP;E();var Zy=zr(Ci());var Bb=Nt("splitio-client:event-tracker");function BP(r){var n=r.get(r.constants.STORAGE).events,s=r.get(r.constants.INTEGRATIONS_MANAGER,!0);function p(i,m){var v=i.eventTypeId,b=i.trafficTypeName,M=i.key,z=i.value,C=i.timestamp,j=i.properties,Y='event of type "'+v+'" for traffic type "'+b+'". Key: '+M+". Value: "+z+". Timestamp: "+C+". "+(j?"With properties.":"With no properties.");return m?(Bb.info("Successfully queued "+Y),s&&setTimeout(function(){var ot=(0,Zy.default)({},i);i.properties&&(ot.properties=(0,Zy.default)({},i.properties)),s.handleEvent(ot)},0)):Bb.warn("Failed to queue "+Y),m}return{track:function(m,v){var b=n.track(m,v);return er(b)?b.then(p.bind(null,m)):p(m,b)}}}var Ub=BP;var Gb=Nt("splitio-client");function UP(r){var n=r.get(r.constants.STORAGE),s=r.get(r.constants.COLLECTORS),p=Fb(r),i=Ub(r);function m(j,Y,ot,J){J===void 0&&(J=!1);var mt=ii.TaskNames[J?"SDK_GET_TREATMENT_WITH_CONFIG":"SDK_GET_TREATMENT"],ft=ii.start(mt,s),At=Ky(j,Y,ot,n),Gt=function(we){var he=z(we,Y,j,ot,J,"getTreatment"+(J?"withConfig":""));return p.track(),ft(),he};return er(At)?At.then(function(Zt){return Gt(Zt)}):Gt(At)}function v(j,Y,ot){return m(j,Y,ot,!0)}function b(j,Y,ot,J){J===void 0&&(J=!1);var mt=ii.TaskNames[J?"SDK_GET_TREATMENTS_WITH_CONFIG":"SDK_GET_TREATMENTS"],ft=ii.start(mt,s),At=function(we){var he={};return Object.keys(we).forEach(function(Kt){he[Kt]=z(we[Kt],Kt,j,ot,J,"getTreatments"+(J?"withConfig":""))}),p.track(),ft(),he},Gt=Ab(j,Y,ot,n);return er(Gt)?Gt.then(function(Zt){return At(Zt)}):At(Gt)}function M(j,Y,ot){return b(j,Y,ot,!0)}function z(j,Y,ot,J,mt,ft){var At=r.get(r.constants.READY,!0)||r.get(r.constants.READY_FROM_CACHE,!0),Gt=Aa(ot),Zt=$x(ot);At||(j={treatment:Vn,label:Nx});var we=j,he=we.treatment,Kt=we.label,ce=we.changeNumber,Yt=we.config,Te=Yt===void 0?null:Yt;return Gb.info("Split: "+Y+". Key: "+Gt+". Evaluation: "+he+". Label: "+Kt),xh(r,Y,Kt,ft)&&(Gb.info("Queueing corresponding impression."),p.queue({feature:Y,keyName:Gt,treatment:he,time:Date.now(),bucketingKey:Zt,label:Kt,changeNumber:ce},J)),mt?{treatment:he,config:Te}:he}function C(j,Y,ot,J,mt,ft){J===void 0&&(J=null),mt===void 0&&(mt=null),ft===void 0&&(ft=1024);var At=Aa(j),Gt=Date.now(),Zt={eventTypeId:ot,trafficTypeName:Y,value:J,timestamp:Gt,key:At,properties:mt};return wy(Y,r,"track"),i.track(Zt,ft)}return{getTreatment:m,getTreatmentWithConfig:v,getTreatments:b,getTreatmentsWithConfig:M,track:C}}var Vb=UP;function GP(r,n,s){var p=r.get(r.constants.SETTINGS),i=p.storage.type!==Ux,m=Vb(r),v=m.getTreatment,b=m.getTreatmentWithConfig,M=m.getTreatments,z=m.getTreatmentsWithConfig,C=m.track;function j(Y,ot,J,mt){var ft=Xs(mt,"getTreatments"),At=n?Y:Ia(Y,mt),Gt=ft?rp(ot,mt):Kl(ot,mt),Zt=_y(J,mt),we=$s(r);Zl(r,mt);var he=we&&At&&Gt&&Zt!==!1;return{valid:he,key:At,splitOrSplits:Gt,attributes:Zt}}return m.getTreatment=function(ot,J,mt){var ft=j(ot,J,mt,"getTreatment");return ft.valid?v(ft.key,ft.splitOrSplits,ft.attributes):i?Vn:Promise.resolve(Vn)},m.getTreatmentWithConfig=function(ot,J,mt){var ft=j(ot,J,mt,"getTreatmentWithConfig");return ft.valid?b(ft.key,ft.splitOrSplits,ft.attributes):i?(0,Ld.default)({},md):Promise.resolve((0,Ld.default)({},md))},m.getTreatments=function(ot,J,mt){var ft=j(ot,J,mt,"getTreatments");if(ft.valid)return M(ft.key,ft.splitOrSplits,ft.attributes);var At={};return ft.splitOrSplits&&ft.splitOrSplits.forEach(function(Gt){return At[Gt]=Vn}),i?At:Promise.resolve(At)},m.getTreatmentsWithConfig=function(ot,J,mt){var ft=j(ot,J,mt,"getTreatmentsWithConfig");if(ft.valid)return z(ft.key,ft.splitOrSplits,ft.attributes);var At={};return ft.splitOrSplits&&ft.splitOrSplits.forEach(function(Gt){return At[Gt]=(0,Ld.default)({},md)}),i?At:Promise.resolve(At)},m.track=function(ot,J,mt,ft,At){var Gt=n?ot:Ia(ot,"track"),Zt=s?J:ys(J,"track"),we=Jc(mt,"track"),he=Qc(ft,"track"),Kt=tp(At,"track"),ce=Kt.properties,Yt=Kt.size,Te=$s(r);return Te&&Gt&&Zt&&we&&he!==!1&&ce!==!1?C(Gt,Zt,we,he,ce,Yt):i?!1:Promise.resolve(!1)},m}var jb=GP;function VP(r){var n,s=r.get(r.constants.SETTINGS),p=ds(s,"core.key",void 0),i=ds(s,"core.trafficType",void 0);s.mode===Ca&&p===void 0?s.core.key="localhost_key":s.core.key=Ia(p,"Client instantiation");var m=[s.core.key];if(i!==void 0){var v=ys(i,"Client instantiation");s.core.trafficType=v,m.push(v)}var b=jb(r,!0,m.length>1);return b.isBrowserClient=!0,b.getTreatment=b.getTreatment.bind(b,s.core.key),b.getTreatmentWithConfig=b.getTreatmentWithConfig.bind(b,s.core.key),b.getTreatments=b.getTreatments.bind(b,s.core.key),b.getTreatmentsWithConfig=b.getTreatmentsWithConfig.bind(b,s.core.key),b.track=(n=b.track).bind.apply(n,[b].concat(m)),b}var kd=VP;E();E();function jP(r,n){for(var s=arguments.length,p=new Array(s>2?s-2:0),i=2;i<s;i++)p[i-2]=arguments[i];var m,v=!1;function b(z){z===void 0&&(z=n);for(var C=arguments.length,j=new Array(C>1?C-1:0),Y=1;Y<C;Y++)j[Y-1]=arguments[Y];v||(m=setTimeout(function(){r.apply(void 0,j.concat([b]))},z))}function M(){clearTimeout(m),m=void 0,v=!0}return M.reset=function(){clearTimeout(m),m=void 0,b.apply(void 0,[n].concat(p))},r.apply(void 0,p.concat([b])),M}var el=jP;E();E();E();E();function qb(r,n){return n=n||{},new Promise(function(s,p){var i=new XMLHttpRequest,m=[],v=[],b={},M=function(){return{ok:(i.status/100|0)==2,statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:M,headers:{keys:function(){return m},entries:function(){return v},get:function(C){return b[C.toLowerCase()]},has:function(C){return C.toLowerCase()in b}}}};for(var z in i.open(n.method||"get",r,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(C,j,Y){m.push(j=j.toLowerCase()),v.push([j,Y]),b[j]=b[j]?b[j]+","+Y:Y}),s(M())},i.onerror=p,i.withCredentials=n.credentials=="include",n.headers)i.setRequestHeader(z,n.headers[z]);i.send(n.body||null)})}function Xy(){return typeof fetch=="function"?fetch:qb}E();E();E();function hp(r){return hp=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},hp(r)}E();function Yy(r){return Function.toString.call(r).indexOf("[native code]")!==-1}E();E();function Jy(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ah(r,n,s){return Jy()?Ah=Reflect.construct:Ah=function(i,m,v){var b=[null];b.push.apply(b,m);var M=Function.bind.apply(i,b),z=new M;return v&&vs(z,v.prototype),z},Ah.apply(null,arguments)}function cp(r){var n=typeof Map=="function"?new Map:void 0;return cp=function(p){if(p===null||!Yy(p))return p;if(typeof p!="function")throw new TypeError("Super expression must either be null or a function");if(typeof n<"u"){if(n.has(p))return n.get(p);n.set(p,i)}function i(){return Ah(p,arguments,hp(this).constructor)}return i.prototype=Object.create(p.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),vs(i,p)},cp(r)}var ka=function(r){Qo(n,r);function n(s){var p;return s===void 0&&(s="Split Error"),p=r.call(this,s)||this,p.message=s,p}return n}(cp(Error)),Wb=function(r){Qo(n,r);function n(s){return r.call(this,s||"Split Timeout Error")||this}return n}(ka),Qy=function(r){Qo(n,r);function n(s,p){var i;return i=r.call(this,s||"Split Network Error")||this,i.statusCode=p,i}return n}(ka);var qP=Nt("splitio-services:service"),WP="Global fetch API is not available.";function bo(r){var n=r.url,s=Xy();return s?s(n,r).then(function(p){return p.ok?p:p.text().then(function(i){return Promise.reject({response:p,message:i})})}).catch(function(p){var i=p.response,m="";if(i)switch(i.status){case 404:m="Invalid API key or resource not found.";break;default:m=p.message;break}else m=p.message;throw(!i||i.status!==403)&&qP[r.logErrorsAsInfo?"info":"error"]("Response status is not OK. Status: "+(i?i.status:"NO_STATUS")+". URL: "+n+". Message: "+m),new Qy(m,i&&i.status)}):Promise.reject(new Qy(WP))}var $y=bo;E();var Kb=zr(Ci());E();var eg=zr(Ci());E();function tg(){return{}}function KP(r,n,s,p){var i=r.core.authorizationKey,m=r.version,v=r.runtime,b=v.ip,M=v.hostname,z={},C=tg();return z.Accept="application/json",z["Content-Type"]="application/json",z.Authorization="Bearer "+i,z.SplitSDKVersion=m,b&&(z.SplitSDKMachineIP=b),M&&(z.SplitSDKMachineName=M),p&&(0,eg.default)(z,p),(0,eg.default)({headers:z,url:r.url(n)},C,s)}var jn=KP,Rd={"Cache-Control":"no-cache"};function rg(r,n){return jn(r,"/metrics/times",(0,Kb.default)({method:"POST"},n,{logErrorsAsInfo:!0}))}E();var Hb=zr(Ci());function ig(r,n){return jn(r,"/metrics/counters",(0,Hb.default)({method:"POST"},n,{logErrorsAsInfo:!0}))}E();function Zb(r){var n=[],s=r.toJSON();return sn(s,function(p,i){n.push({name:i,latencies:p})}),n}function Xb(r){var n=[],s=r.toJSON();return sn(s,function(p,i){n.push({name:i,delta:p})}),n}E();var Ph=bo;E();var Yb=zr(Ci());function pp(r,n){return jn(r,"/testImpressions/bulk",(0,Yb.default)({method:"POST"},n),{SplitSDKImpressionsMode:r.sync.impressionsMode===yn?yn:Hl})}E();var Jb=zr(Ci());function fp(r,n){return jn(r,"/testImpressions/count",(0,Jb.default)({method:"POST"},n))}E();function zd(r,n){var s=n.core.labelsEnabled,p=Tx(r.state(),"feature"),i=[];return sn(p,function(m,v){i.push({f:v,i:m.map(function(b){var M={k:b.keyName,t:b.treatment,m:b.time,c:b.changeNumber};return s&&(M.r=b.label),b.bucketingKey&&(M.b=b.bucketingKey),b.pt&&(M.pt=b.pt),M})})}),i}function Dd(r){var n=r?r.size():0,s=[];if(n===0)return s;for(var p=r.popAll(),i=Object.keys(p),m=0;m<i.length;m++){var v=i[m].split("::");if(v.length===2){var b=v[0],M=v[1],z={f:b,m:Number(M),rc:p[i[m]]};s.push(z)}}return s}E();var ng=function(){function r(s){this.storage=s,this.latency=this.latency.bind(this),this.count=this.count.bind(this),this.countException=this.countException.bind(this)}var n=r.prototype;return n.latency=function(p){this.storage.metrics.track(this.metricType+".time",p)},n.count=function(p){this.storage.count.track(this.metricType+".status."+p)},n.countException=function(){this.storage.count.track(this.metricType+".exception")},r}(),Qb=function(r){Qo(n,r);function n(s){var p;return p=r.call(this,s)||this,p.metricType="segmentChangeFetcher",p}return n}(ng),$b=function(r){Qo(n,r);function n(s){var p;return p=r.call(this,s)||this,p.metricType="splitChangeFetcher",p}return n}(ng),tw=function(r){Qo(n,r);function n(s){var p;return p=r.call(this,s)||this,p.metricType="mySegmentsFetcher",p}return n}(ng),ew=function(){function r(s){this.storage=s,this.ready=this.ready.bind(this),this.getTreatment=this.getTreatment.bind(this),this.getTreatments=this.getTreatments.bind(this),this.getTreatmentWithConfig=this.getTreatmentWithConfig.bind(this),this.getTreatmentsWithConfig=this.getTreatmentsWithConfig.bind(this)}var n=r.prototype;return n.ready=function(p){this.storage.metrics.track("sdk.ready",p)},n.getTreatment=function(p){this.storage.metrics.track("sdk.getTreatment",p)},n.getTreatments=function(p){this.storage.metrics.track("sdk.getTreatments",p)},n.getTreatmentWithConfig=function(p){this.storage.metrics.track("sdk.getTreatmentWithConfig",p)},n.getTreatmentsWithConfig=function(p){this.storage.metrics.track("sdk.getTreatmentsWithConfig",p)},r}();var Yl=Nt("splitio-metrics"),HP=18e5,ZP=function(n){var s=0,p=n.get(n.constants.SETTINGS),i=n.get(n.constants.STORAGE),m=n.get(n.constants.IMPRESSIONS_COUNTER),v=p.sync.impressionsMode===yn,b=function(){if(i.metrics.isEmpty()&&i.count.isEmpty())return Promise.resolve();Yl.debug("Pushing metrics");var J=ii.start(ii.TaskNames.METRICS_PUSH),mt=i.metrics.isEmpty()?null:$y(rg(p,{body:JSON.stringify(Zb(i.metrics))})).then(function(){return i.metrics.clear()}).catch(function(){return i.metrics.clear()}),ft=i.count.isEmpty()?null:$y(ig(p,{body:JSON.stringify(Xb(i.count))})).then(function(){return i.count.clear()}).catch(function(){return i.count.clear()});return Promise.all([mt,ft]).then(function(At){return J(),At})},M=function(){if(i.impressions.isEmpty())return Promise.resolve();var J=i.impressions.queue.length;Yl.info("Pushing "+J+" impressions");var mt=ii.start(ii.TaskNames.IMPRESSIONS_PUSH);return Ph(pp(p,{body:JSON.stringify(zd(i.impressions,p))})).then(function(){s=0,i.impressions.clear()}).catch(function(ft){s?(Yl.warn("Droping "+J+" impressions after retry. Reason "+ft+"."),s=0,i.impressions.clear()):(s++,Yl.warn("Failed to push "+J+" impressions, keeping data to retry on next iteration. Reason "+ft+"."))}).then(function(){return mt()})},z=function(){var J=Dd(m),mt=J.length;return mt===0?Promise.resolve():(Yl.info("Pushing count of impressions for "+mt+" features"),Ph(fp(p,{body:JSON.stringify({pf:J})})).then(function(){s=0}).catch(function(ft){s?(Yl.warn("Droping count of impressions for "+mt+" features after retry. Reason "+ft+"."),s=0):(s++,Yl.warn("Failed to push impressions count for "+mt+" features, keeping data to retry on next iteration. Reason "+ft+"."))}))},C=!1,j=!1,Y=!1;return{start:function(){C=el(function(J){return M().then(function(){return J()})},p.scheduler.impressionsRefreshRate),j=el(function(J){return b().then(function(){return J()})},p.scheduler.metricsRefreshRate),v&&(Y=el(function(J){return z().then(function(){return J()})},HP))},flush:function(){return v&&z(),M()},stop:function(){C&&C(),j&&j(),Y&&Y()},collectors:{segmentChanges:new Qb(i),splitChanges:new $b(i),mySegments:new tw(i),client:new ew(i)}}},rw=ZP;E();E();var Od=bo;E();var iw=zr(Ci());function dp(r,n){return jn(r,"/events/bulk",(0,iw.default)({method:"POST"},n))}var nw=Nt("splitio-events"),XP=function(n){var s=n.get(n.constants.SETTINGS),p=n.get(n.constants.STORAGE),i=function(){if(p.events.isEmpty())return Promise.resolve();nw.info("Pushing "+p.events.state().length+" queued events.");var z=ii.start(ii.TaskNames.EVENTS_PUSH),C=JSON.stringify(p.events.toJSON()),j=function(){return z()};return p.events.clear(),Od(dp(s,{body:C})).then(j).catch(j)},m=!1,v=!1,b=function(){return v=el(function(z){return i().then(function(){return z()})},s.scheduler.eventsPushRate)};return{start:function(){s.startup.eventsFirstPushWindow>0?m=setTimeout(b,s.startup.eventsFirstPushWindow):b()},flush:function(){return i()},stop:function(){m&&clearTimeout(m),v&&v()},flushAndResetTimer:function(){return nw.info("Flushing events and reseting timer."),v&&v.reset(),i()}}},ow=XP;E();E();var Sw=zr(Ly()),Ew=zr(Ci());E();var uw=zr(Ci());E();var aw=bo;E();function YP(r){return"users="+encodeURIComponent(r)}function og(r,n){var s="/v2/auth";if(n){var p=n.map(YP).join("&");p&&(s+="?"+p)}return jn(r,s)}E();E();function Nd(r){return atob(r)}function sw(r){return btoa(r)}function lw(r){var n=r.split(".")[1],s=n.replace(/-/g,"+").replace(/_/g,"/"),p=decodeURIComponent(Nd(s).split("").map(function(i){return"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(p)}function ag(r,n){var s=aw(og(r,n));return s.then(function(p){return p.json()}).then(function(p){if(p.token){var i=lw(p.token);if(typeof i.iat!="number"||typeof i.exp!="number")throw new Error('token properties "issuedAt" (iat) or "expiration" (exp) are missing or invalid');var m=JSON.parse(i["x-ably-capability"]);return(0,uw.default)({decodedToken:i,channels:m},p)}return p})}E();E();function mp(){return typeof EventSource=="function"?EventSource:void 0}function hw(r){var n=mp();return n?typeof atob!="function"||typeof btoa!="function"?(r.warn('"atob" and "btoa" functions for Base64 encoding are not available. Falling back to polling mode.'),!1):!0:(r.warn("EventSource API is not available. Falling back to polling mode."),!1)}E();E();var sg=function(){function r(s,p,i){this.baseMillis=p||r.DEFAULT_BASE_MILLIS,this.maxMillis=i||r.DEFAULT_MAX_MILLIS,this.attempts=0,this.cb=s}var n=r.prototype;return n.scheduleCall=function(){var p=this,i=Math.min(this.baseMillis*Math.pow(2,this.attempts),this.maxMillis);return this.timeoutID&&clearTimeout(this.timeoutID),this.timeoutID=setTimeout(function(){p.cb()},i),this.attempts++,i},n.reset=function(){this.attempts=0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=0)},r}();sg.DEFAULT_BASE_MILLIS=1e3;sg.DEFAULT_MAX_MILLIS=18e5;var Lh=sg;var lg=function(){function r(s,p){this.mySegmentsStorage=s,this.mySegmentsProducer=p,this.maxChangeNumber=0,this.segmentsData=void 0,this.currentChangeNumber=-1,this.put=this.put.bind(this),this.__handleMySegmentUpdateCall=this.__handleMySegmentUpdateCall.bind(this),this.backoff=new Lh(this.__handleMySegmentUpdateCall)}var n=r.prototype;return n.__handleMySegmentUpdateCall=function(){var p=this;if(this.maxChangeNumber>this.currentChangeNumber){this.handleNewEvent=!1;var i=this.maxChangeNumber;this.mySegmentsProducer.synchronizeMySegments(this.segmentsData,!0).then(function(m){m!==!1&&(p.currentChangeNumber=Math.max(p.currentChangeNumber,i)),p.handleNewEvent?p.__handleMySegmentUpdateCall():p.backoff.scheduleCall()})}},n.put=function(p,i){p<=this.currentChangeNumber||p<=this.maxChangeNumber||(this.maxChangeNumber=p,this.handleNewEvent=!0,this.backoff.reset(),this.segmentsData=i,!this.mySegmentsProducer.isSynchronizingMySegments()&&this.__handleMySegmentUpdateCall())},r}();E();var cw=function(){function r(s,p,i){this.splitStorage=s,this.splitProducer=p,this.maxChangeNumber=0,this.splitsEventEmitter=i,this.put=this.put.bind(this),this.killSplit=this.killSplit.bind(this),this.__handleSplitUpdateCall=this.__handleSplitUpdateCall.bind(this),this.backoff=new Lh(this.__handleSplitUpdateCall)}var n=r.prototype;return n.__handleSplitUpdateCall=function(){var p=this;this.maxChangeNumber>this.splitStorage.getChangeNumber()&&(this.handleNewEvent=!1,this.splitProducer.synchronizeSplits(!0).then(function(){p.handleNewEvent?p.__handleSplitUpdateCall():(p.splitProducer.synchronizeSegment&&p.splitProducer.synchronizeSegment(void 0,!1,!0),p.backoff.scheduleCall())}))},n.put=function(p){var i=this.splitStorage.getChangeNumber();p<=i||p<=this.maxChangeNumber||(this.maxChangeNumber=p,this.handleNewEvent=!0,this.backoff.reset(),!this.splitProducer.isSynchronizingSplits()&&this.__handleSplitUpdateCall())},n.killSplit=function(p,i,m){var v=this;this.splitStorage.killLocally(i,m,p).then(function(b){b&&v.splitsEventEmitter.emit(v.splitsEventEmitter.SDK_SPLITS_ARRIVED,!0),v.put(p)})},r}();E();var JP="1.1",QP=/^control_/;function $P(r){var n={SplitSDKClientKey:r.core.authorizationKey.slice(-4),SplitSDKVersion:r.version},s=r.runtime,p=s.ip,i=s.hostname;return p&&(n.SplitSDKMachineIP=p),i&&(n.SplitSDKMachineName=i),n}var pw=function(){r.getInstance=function(p,i){var m=mp();if(m)return new r(m,p,i)};function r(s,p,i){this.EventSource=s,this.streamingUrl=p.url("/sse"),this.useHeaders=i,this.headers=$P(p)}var n=r.prototype;return n.setEventHandler=function(p){this.handler=p},n.open=function(p){this.close();var i=Object.keys(p.channels).map(function(v){var b=QP.test(v)?"[?occupancy=metrics.publishers]":"";return encodeURIComponent(b+v)}).join(","),m=this.streamingUrl+"?channels="+i+"&accessToken="+p.token+"&v="+JP+"&heartbeats=true";this.connection=new this.EventSource(this.useHeaders?m:m+("&SplitSDKVersion="+this.headers.SplitSDKVersion+"&SplitSDKClientKey="+this.headers.SplitSDKClientKey),this.useHeaders?{headers:this.headers}:void 0),this.handler&&(this.connection.onopen=this.handler.handleOpen,this.connection.onmessage=this.handler.handleMessage,this.connection.onerror=this.handler.handleError)},n.close=function(){this.connection&&this.connection.close()},r}();E();E();E();var fw=600,rl="PUSH_NONRETRYABLE_ERROR",yp="PUSH_RETRYABLE_ERROR",il="PUSH_SUBSYSTEM_UP",ws="PUSH_SUBSYSTEM_DOWN",gp="MY_SEGMENTS_UPDATE",vp="MY_SEGMENTS_UPDATE_V2",_p="SEGMENT_UPDATE",xp="SPLIT_KILL",bp="SPLIT_UPDATE",ug="CONTROL",wp="OCCUPANCY",nl={STREAMING_DISABLED:"STREAMING_DISABLED",STREAMING_PAUSED:"STREAMING_PAUSED",STREAMING_RESUMED:"STREAMING_RESUMED",STREAMING_RESET:"STREAMING_RESET"};function dw(r){return Ir(r.data)&&(r.parsedData=JSON.parse(r.data)),r}function mw(r){var n=JSON.parse(r.data);return n.parsedData=JSON.parse(n.data),n.name&&n.name==="[meta]occupancy"&&(n.parsedData.type=wp),n}E();var t3=[/control_pri$/,/control_sec$/];function hg(r){var n=t3.map(function(m){return{regex:m,hasPublishers:!0,oTime:-1,cTime:-1}}),s=!0,p=!0;function i(){return n.some(function(m){return m.hasPublishers})}return{handleOpen:function(){r.emit(il)},isStreamingUp:function(){return p&&s},handleOccupancyEvent:function(v,b,M){for(var z=0;z<n.length;z++){var C=n[z];if(C.regex.test(b)){if(M>C.oTime){C.oTime=M,C.hasPublishers=v!==0;var j=i();p&&(!j&&s?r.emit(ws):j&&!s&&r.emit(il)),s=j}return}}},handleControlEvent:function(v,b,M){if(v===nl.STREAMING_RESET){r.emit(v);return}for(var z=0;z<n.length;z++){var C=n[z];if(C.regex.test(b)){M>C.cTime&&(C.cTime=M,v===nl.STREAMING_DISABLED?r.emit(rl):s&&(v===nl.STREAMING_PAUSED&&p?r.emit(ws):v===nl.STREAMING_RESUMED&&!p&&r.emit(il)),p=v===nl.STREAMING_RESUMED);return}}}}}var Fd=Nt("splitio-sync:sse-handler");function e3(r){if(r.parsedData&&r.parsedData.code){var n=r.parsedData.code;if(40140<=n&&n<=40149)return!0;if(4e4<=n&&n<=49999)return!1}return!0}function cg(r){var n=hg(r);return{handleOpen:function(){n.handleOpen()},handleError:function(p){var i=p;try{i=dw(p)}catch(v){Fd.warn("Error parsing SSE error notification: "+v)}var m=i.parsedData&&i.parsedData.message;Fd.error("Fail to connect to streaming"+(m?', with error message: "'+m+'"':"")),e3(i)?r.emit(yp):r.emit(rl)},handleMessage:function(p){var i;try{i=mw(p)}catch(C){Fd.warn("Error parsing new SSE message notification: "+C);return}var m=i,v=m.parsedData,b=m.data,M=m.channel,z=m.timestamp;if(Fd.debug("New SSE message received, with data: "+b+"."),!(!n.isStreamingUp()&&[wp,ug].indexOf(v.type)===-1))switch(v.type){case bp:r.emit(bp,v.changeNumber);break;case _p:r.emit(_p,v.changeNumber,v.segmentName);break;case gp:r.emit(gp,v,M);break;case vp:r.emit(vp,v);break;case xp:r.emit(xp,v.changeNumber,v.splitName,v.defaultTreatment);break;case wp:n.handleOccupancyEvent(v.metrics.publishers,M,z);break;case ug:n.handleControlEvent(v.controlType,M,z);break;default:break}}}}E();function pg(r){return sw(Ih.hash(r,0).toString())}E();E();var Sp=function(){if([typeof Uint8Array,typeof Uint16Array,typeof Uint32Array].some(function(Cr){return Cr!="function"}))return"global Uint8Array object is not available for gzip/zlib decompression";var n=Uint8Array,s=Uint16Array,p=Uint32Array,i=new n([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]),m=new n([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]),v=new n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),b=function(te,ae){for(var me=new s(31),Ne=0;Ne<31;++Ne)me[Ne]=ae+=1<<te[Ne-1];for(var Qe=new p(me[30]),Ne=1;Ne<30;++Ne)for(var pi=me[Ne];pi<me[Ne+1];++pi)Qe[pi]=pi-me[Ne]<<5|Ne;return[me,Qe]},M=b(i,2),z=M[0],C=M[1];z[28]=258,C[258]=28;for(var j=b(m,0),Y=j[0],ot=new s(32768),J=0;J<32768;++J){var mt=(J&43690)>>>1|(J&21845)<<1;mt=(mt&52428)>>>2|(mt&13107)<<2,mt=(mt&61680)>>>4|(mt&3855)<<4,ot[J]=((mt&65280)>>>8|(mt&255)<<8)>>>1}for(var ft=function(te,ae,me){for(var Ne=te.length,Qe=0,pi=new s(ae);Qe<Ne;++Qe)++pi[te[Qe]-1];var Ai=new s(ae);for(Qe=0;Qe<ae;++Qe)Ai[Qe]=Ai[Qe-1]+pi[Qe-1]<<1;var Ji;if(me){Ji=new s(1<<ae);var ke=15-ae;for(Qe=0;Qe<Ne;++Qe)if(te[Qe])for(var cr=Qe<<4|te[Qe],We=ae-te[Qe],oi=Ai[te[Qe]-1]++<<We,ln=oi|(1<<We)-1;oi<=ln;++oi)Ji[ot[oi]>>>ke]=cr}else for(Ji=new s(Ne),Qe=0;Qe<Ne;++Qe)te[Qe]&&(Ji[Qe]=ot[Ai[te[Qe]-1]++]>>>15-te[Qe]);return Ji},At=new n(288),J=0;J<144;++J)At[J]=8;for(var J=144;J<256;++J)At[J]=9;for(var J=256;J<280;++J)At[J]=7;for(var J=280;J<288;++J)At[J]=8;for(var Gt=new n(32),J=0;J<32;++J)Gt[J]=5;var Zt=ft(At,9,1),we=ft(Gt,5,1),he=function(te){for(var ae=te[0],me=1;me<te.length;++me)te[me]>ae&&(ae=te[me]);return ae},Kt=function(te,ae,me){var Ne=ae/8|0;return(te[Ne]|te[Ne+1]<<8)>>(ae&7)&me},ce=function(te,ae){var me=ae/8|0;return(te[me]|te[me+1]<<8|te[me+2]<<16)>>(ae&7)},Yt=function(te){return(te+7)/8|0},Te=function(te,ae,me){(ae==null||ae<0)&&(ae=0),(me==null||me>te.length)&&(me=te.length);var Ne=new(te instanceof s?s:te instanceof p?p:n)(me-ae);return Ne.set(te.subarray(ae,me)),Ne},dr=["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"],Le=function Cr(te,ae,me){var Ne=new Error(ae||dr[te]);if(Ne.code=te,Error.captureStackTrace&&Error.captureStackTrace(Ne,Cr),!me)throw Ne;return Ne},hr=function(te,ae,me){var Ne=te.length;if(!Ne||me&&me.f&&!me.l)return ae||new n(0);var Qe=!ae||me,pi=!me||me.i;me||(me={}),ae||(ae=new n(Ne*3));var Ai=function(Ni){var Hi=ae.length;if(Ni>Hi){var vi=new n(Math.max(Hi*2,Ni));vi.set(ae),ae=vi}},Ji=me.f||0,ke=me.p||0,cr=me.b||0,We=me.l,oi=me.d,ln=me.m,Oi=me.n,Ce=Ne*8;do{if(!We){Ji=Kt(te,ke,1);var Cn=Kt(te,ke+1,3);if(ke+=3,Cn)if(Cn==1)We=Zt,oi=we,ln=9,Oi=5;else if(Cn==2){var Qi=Kt(te,ke,31)+257,bt=Kt(te,ke+10,15)+4,q=Qi+Kt(te,ke+5,31)+1;ke+=14;for(var F=new n(q),W=new n(19),nt=0;nt<bt;++nt)W[v[nt]]=Kt(te,ke+nt*3,7);ke+=bt*3;for(var dt=he(W),Mt=(1<<dt)-1,Dt=ft(W,dt,1),nt=0;nt<q;){var Vt=Dt[Kt(te,ke,Mt)];ke+=Vt&15;var Ar=Vt>>>4;if(Ar<16)F[nt++]=Ar;else{var ye=0,Ae=0;for(Ar==16?(Ae=3+Kt(te,ke,3),ke+=2,ye=F[nt-1]):Ar==17?(Ae=3+Kt(te,ke,7),ke+=3):Ar==18&&(Ae=11+Kt(te,ke,127),ke+=7);Ae--;)F[nt++]=ye}}var qe=F.subarray(0,Qi),Ge=F.subarray(Qi);ln=he(qe),Oi=he(Ge),We=ft(qe,ln,1),oi=ft(Ge,Oi,1)}else Le(1);else{var Ar=Yt(ke)+4,Ki=te[Ar-4]|te[Ar-3]<<8,zo=Ar+Ki;if(zo>Ne){pi&&Le(0);break}Qe&&Ai(cr+Ki),ae.set(te.subarray(Ar,zo),cr),me.b=cr+=Ki,me.p=ke=zo*8,me.f=Ji;continue}if(ke>Ce){pi&&Le(0);break}}Qe&&Ai(cr+131072);for(var Xe=(1<<ln)-1,yr=(1<<Oi)-1,ar=ke;;ar=ke){var ye=We[ce(te,ke)&Xe],ur=ye>>>4;if(ke+=ye&15,ke>Ce){pi&&Le(0);break}if(ye||Le(2),ur<256)ae[cr++]=ur;else if(ur==256){ar=ke,We=null;break}else{var $r=ur-254;if(ur>264){var nt=ur-257,Vr=i[nt];$r=Kt(te,ke,(1<<Vr)-1)+z[nt],ke+=Vr}var yi=oi[ce(te,ke)&yr],Yr=yi>>>4;yi||Le(3),ke+=yi&15;var Ge=Y[Yr];if(Yr>3){var Vr=m[Yr];Ge+=ce(te,ke)&(1<<Vr)-1,ke+=Vr}if(ke>Ce){pi&&Le(0);break}Qe&&Ai(cr+131072);for(var gi=cr+$r;cr<gi;cr+=4)ae[cr]=ae[cr-Ge],ae[cr+1]=ae[cr+1-Ge],ae[cr+2]=ae[cr+2-Ge],ae[cr+3]=ae[cr+3-Ge];cr=gi}}me.l=We,me.p=ar,me.b=cr,me.f=Ji,We&&(Ji=1,me.m=ln,me.d=oi,me.n=Oi)}while(!Ji);return cr==ae.length?ae:Te(ae,0,cr)},Ur=function(te){(te[0]!=31||te[1]!=139||te[2]!=8)&&Le(6,"invalid gzip data");var ae=te[3],me=10;ae&4&&(me+=te[10]|(te[11]<<8)+2);for(var Ne=(ae>>3&1)+(ae>>4&1);Ne>0;Ne-=!te[me++]);return me+(ae&2)},Gr=function(te){var ae=te.length;return(te[ae-4]|te[ae-3]<<8|te[ae-2]<<16|te[ae-1]<<24)>>>0},_n=function(te){((te[0]&15)!=8||te[0]>>>4>7||(te[0]<<8|te[1])%31)&&Le(6,"invalid zlib data"),te[1]&32&&Le(6,"invalid zlib data: preset dictionaries not supported")};return{gunzipSync:function(te,ae){return hr(te.subarray(Ur(te),-8),ae||new n(Gr(te)))},unzlibSync:function(te,ae){return hr((_n(te),te.subarray(2,-4)),ae)}}}();var r3=1,i3=2;function n3(r){return String.fromCharCode.apply(null,r)}function o3(r){var n=r.split("").map(function(s){return s.charCodeAt()});return new Uint8Array(n)}function yw(r,n){var s=Nd(r),p=o3(s);if(typeof Sp=="string")throw new Error(Sp);if(n===r3)return Sp.gunzipSync(p);if(n===i3)return Sp.unzlibSync(p);throw new Error("Invalid compression algorithm #"+n)}function gw(r,n){var s=yw(r,n),p=n3(s);return JSON.parse(p.replace(/\d+/g,'"$&"'))}function vw(r,n){return yw(r,n)}function _w(r,n){var s=parseInt(n.slice(8),16)%(r.length*8),p=Math.floor(s/8),i=s%8;return(r[p]&1<<i)>0}E();E();function ol(r,n){r=[r[0]>>>16,r[0]&65535,r[1]>>>16,r[1]&65535],n=[n[0]>>>16,n[0]&65535,n[1]>>>16,n[1]&65535];var s=[0,0,0,0];return s[3]+=r[3]+n[3],s[2]+=s[3]>>>16,s[3]&=65535,s[2]+=r[2]+n[2],s[1]+=s[2]>>>16,s[2]&=65535,s[1]+=r[1]+n[1],s[0]+=s[1]>>>16,s[1]&=65535,s[0]+=r[0]+n[0],s[0]&=65535,[s[0]<<16|s[1],s[2]<<16|s[3]]}function Ro(r,n){r=[r[0]>>>16,r[0]&65535,r[1]>>>16,r[1]&65535],n=[n[0]>>>16,n[0]&65535,n[1]>>>16,n[1]&65535];var s=[0,0,0,0];return s[3]+=r[3]*n[3],s[2]+=s[3]>>>16,s[3]&=65535,s[2]+=r[2]*n[3],s[1]+=s[2]>>>16,s[2]&=65535,s[2]+=r[3]*n[2],s[1]+=s[2]>>>16,s[2]&=65535,s[1]+=r[1]*n[3],s[0]+=s[1]>>>16,s[1]&=65535,s[1]+=r[2]*n[2],s[0]+=s[1]>>>16,s[1]&=65535,s[1]+=r[3]*n[1],s[0]+=s[1]>>>16,s[1]&=65535,s[0]+=r[0]*n[3]+r[1]*n[2]+r[2]*n[1]+r[3]*n[0],s[0]&=65535,[s[0]<<16|s[1],s[2]<<16|s[3]]}function kh(r,n){return n%=64,n===32?[r[1],r[0]]:n<32?[r[0]<<n|r[1]>>>32-n,r[1]<<n|r[0]>>>32-n]:(n-=32,[r[1]<<n|r[0]>>>32-n,r[0]<<n|r[1]>>>32-n])}function wo(r,n){return n%=64,n===0?r:n<32?[r[0]<<n|r[1]>>>32-n,r[1]<<n]:[r[1]<<n-32,0]}function mi(r,n){return[r[0]^n[0],r[1]^n[1]]}function xw(r){return r=mi(r,[0,r[0]>>>1]),r=Ro(r,[4283543511,3981806797]),r=mi(r,[0,r[0]>>>1]),r=Ro(r,[3301882366,444984403]),r=mi(r,[0,r[0]>>>1]),r}function a3(r,n){r=r||"",n=n||0;for(var s=r.length%16,p=r.length-s,i=[0,n],m=[0,n],v=[0,0],b=[0,0],M=[2277735313,289559509],z=[1291169091,658871167],C=0;C<p;C=C+16)v=[r.charCodeAt(C+4)&255|(r.charCodeAt(C+5)&255)<<8|(r.charCodeAt(C+6)&255)<<16|(r.charCodeAt(C+7)&255)<<24,r.charCodeAt(C)&255|(r.charCodeAt(C+1)&255)<<8|(r.charCodeAt(C+2)&255)<<16|(r.charCodeAt(C+3)&255)<<24],b=[r.charCodeAt(C+12)&255|(r.charCodeAt(C+13)&255)<<8|(r.charCodeAt(C+14)&255)<<16|(r.charCodeAt(C+15)&255)<<24,r.charCodeAt(C+8)&255|(r.charCodeAt(C+9)&255)<<8|(r.charCodeAt(C+10)&255)<<16|(r.charCodeAt(C+11)&255)<<24],v=Ro(v,M),v=kh(v,31),v=Ro(v,z),i=mi(i,v),i=kh(i,27),i=ol(i,m),i=ol(Ro(i,[0,5]),[0,1390208809]),b=Ro(b,z),b=kh(b,33),b=Ro(b,M),m=mi(m,b),m=kh(m,31),m=ol(m,i),m=ol(Ro(m,[0,5]),[0,944331445]);switch(v=[0,0],b=[0,0],s){case 15:b=mi(b,wo([0,r.charCodeAt(C+14)],48));case 14:b=mi(b,wo([0,r.charCodeAt(C+13)],40));case 13:b=mi(b,wo([0,r.charCodeAt(C+12)],32));case 12:b=mi(b,wo([0,r.charCodeAt(C+11)],24));case 11:b=mi(b,wo([0,r.charCodeAt(C+10)],16));case 10:b=mi(b,wo([0,r.charCodeAt(C+9)],8));case 9:b=mi(b,[0,r.charCodeAt(C+8)]),b=Ro(b,z),b=kh(b,33),b=Ro(b,M),m=mi(m,b);case 8:v=mi(v,wo([0,r.charCodeAt(C+7)],56));case 7:v=mi(v,wo([0,r.charCodeAt(C+6)],48));case 6:v=mi(v,wo([0,r.charCodeAt(C+5)],40));case 5:v=mi(v,wo([0,r.charCodeAt(C+4)],32));case 4:v=mi(v,wo([0,r.charCodeAt(C+3)],24));case 3:v=mi(v,wo([0,r.charCodeAt(C+2)],16));case 2:v=mi(v,wo([0,r.charCodeAt(C+1)],8));case 1:v=mi(v,[0,r.charCodeAt(C)]),v=Ro(v,M),v=kh(v,31),v=Ro(v,z),i=mi(i,v)}return i=mi(i,[0,r.length]),m=mi(m,[0,r.length]),i=ol(i,m),m=ol(m,i),i=xw(i),m=xw(m),i=ol(i,m),m=ol(m,i),("00000000"+(i[0]>>>0).toString(16)).slice(-8)+("00000000"+(i[1]>>>0).toString(16)).slice(-8)+("00000000"+(m[0]>>>0).toString(16)).slice(-8)+("00000000"+(m[1]>>>0).toString(16)).slice(-8)}function bw(r,n){return a3(Cd(r),n>>>0)}function s3(r){var n,s,p=[0],i;for(n=0;n<r.length;n+=1){for(i=parseInt(r.charAt(n),16),s=p.length-1;s>=0;s-=1)p[s]=p[s]*16+i,i=p[s]/10|0,p[s]%=10;for(;i>0;)p.unshift(i%10),i=i/10|0}return p.join("")}function ww(r){var n=bw(r).slice(0,16);return{hex:n,dec:s3(n)}}var Ra=Nt("splitio-sync:push-manager"),l3=1,u3=2,h3=3;function fg(r,n){return"Fetching MySegments due to an error processing "+r+" notification: "+n}function dg(r,n){if(!hw(Ra))return;var s=new Sw.default,p=r.get(r.constants.READINESS),i=p.splits,m=r.get(r.constants.SETTINGS),v=r.get(r.constants.STORAGE),b=pw.getInstance(m,!n),M=cg(s);b.setEventHandler(M);var z={},C={},j=!1,Y,ot=new Lh(At,m.scheduler.pushRetryBackoffBase),J,mt;function ft(ce){J&&clearTimeout(J),mt&&clearTimeout(mt);var Yt=ce.decodedToken,Te=Yt.exp-Yt.iat-fw,dr=typeof ce.connDelay=="number"&&ce.connDelay>=0?ce.connDelay:60;Ra.info("Refreshing streaming token in "+Te+" seconds, and connecting streaming in "+dr+" seconds"),J=setTimeout(At,Te*1e3),mt=setTimeout(function(){Y||b.open(ce)},dr*1e3)}function At(){if(!Y){Ra.info((Y===void 0?"Connecting":"Re-connecting")+" to push streaming."),Y=!1;var ce=n?Object.keys(n):void 0;ag(m,ce).then(function(Yt){if(!Y){if(!Yt.pushEnabled){Ra.info("Streaming is not available. Switching to polling mode."),s.emit(rl);return}ce&&ce.length<Object.keys(n).length||ft(Yt)}}).catch(function(Yt){if(!Y){if(Ra.error("Failed to authenticate for streaming. Error: "+Yt.message+"."),Yt.statusCode>=400&&Yt.statusCode<500){s.emit(rl);return}s.emit(yp)}})}}function Gt(){Y||(Y=!0,b.close(),Ra.info("Disconnecting from push streaming."),J&&clearTimeout(J),mt&&clearTimeout(mt),ot.reset(),Kt())}s.on(ws,Kt),s.on(il,function(){ot.reset(),Kt()}),s.on(rl,function(){Gt(),s.emit(ws)}),s.on(yp,function(){b.close();var Yt=ot.scheduleCall();Ra.info("Attempting to reconnect in "+Yt/1e3+" seconds."),s.emit(ws)}),s.on(nl.STREAMING_RESET,function(){Y||(J&&clearTimeout(J),At())});var Zt=r.get(r.constants.PRODUCER),we=new cw(v.splits,Zt,i),he;function Kt(){we.backoff.reset(),he&&he.backoff.reset(),sn(C,function(ce){var Yt=ce.worker;return Yt.backoff.reset()})}return s.on(xp,we.killSplit),s.on(bp,we.put),n?(s.on(gp,function(Yt,Te){var dr=Te.split("_")[2],Le=z[dr];if(Le&&n[Le]){var hr=n[Le].get(r.constants.MY_SEGMENTS_CHANGE_WORKER,!0);hr&&hr.put(Yt.changeNumber,Yt.includesPayload?Yt.segmentList?Yt.segmentList:[]:void 0)}}),s.on(vp,function(Yt){switch(Yt.u){case l3:{var Te;try{Te=vw(Yt.d,Yt.c)}catch(Ur){Ra.warn(fg("BoundedFetchRequest",Ur));break}sn(C,function(Ur){var Gr=Ur.hash64,_n=Ur.worker;_w(Te,Gr.hex)&&_n.put(Yt.changeNumber)});return}case u3:{var dr,Le,hr;try{dr=gw(Yt.d,Yt.c),Le=new xs(dr.a),hr=new xs(dr.r)}catch(Ur){Ra.warn(fg("KeyList",Ur));break}sn(C,function(Ur){var Gr=Ur.hash64,_n=Ur.worker,Cr=Le.has(Gr.dec)?!0:hr.has(Gr.dec)?!1:void 0;Cr!==void 0&&_n.put(Yt.changeNumber,{name:Yt.segmentName,add:Cr})});return}case h3:if(!Yt.segmentName){Ra.warn(fg("SegmentRemoval","No segment name was provided"));break}sn(C,function(Ur){var Gr=Ur.worker;Gr.put(Yt.changeNumber,{name:Yt.segmentName,add:!1})});return}sn(C,function(Ur){var Gr=Ur.worker;Gr.put(Yt.changeNumber)})})):(he=new lg(v.segments,Zt),s.on(_p,he.put)),(0,Ew.default)(Object.create(s),{stop:Gt,start:At,startNewClient:function(Yt,Te){var dr=pg(Yt),Le=Te.get(Te.constants.STORAGE),hr=Te.get(Te.constants.PRODUCER);z[dr]||(z[dr]=Yt,j=!0);var Ur=new lg(Le.segments,hr);C[Yt]={worker:Ur,hash64:ww(Yt)},Te.put(Te.constants.MY_SEGMENTS_CHANGE_WORKER,Ur),setTimeout(function(){j&&(j=!1,At())},0)},removeClient:function(Yt){var Te=pg(Yt);delete z[Te],delete C[Yt]}})}E();E();var mg=Nt("splitio-producer:task"),c3=function(n,s){var p=Mx(n),i=!1;return{start:function(){i||(mg.debug("Starting "+p+" refreshing each "+s),i=el(function(v){mg.debug("Running "+p),n().then(function(){return v()})},s))},stop:function(){mg.debug("Stopping "+p),i&&i(),i=!1},isRunning:function(){return!!i}}},Rh=c3;E();E();E();function p3(r,n){return r<1?n:new Promise(function(s,p){var i=setTimeout(function(){p(new Wb("Operation timed out because it exceeded the configured time limit of "+r+"ms."))},r);n.then(function(m){clearTimeout(i),s(m)},function(m){clearTimeout(i),p(m)})})}var Bd=p3;E();var Tw=bo;E();function yg(r,n,s,p){return jn(r,"/splitChanges?since="+n+(s||""),void 0,p?Rd:void 0)}function f3(r,n,s,p,i,m){s===void 0&&(s=!1);var v=r.sync.__splitFiltersValidation.queryString,b=Tw(yg(r,n,v,m)),M=s||i;return b=ii.start(ii.TaskNames.SPLITS_FETCH,M?p:!1,b),s&&(b=Bd(r.startup.requestTimeoutBeforeReady,b)),b.then(function(z){return z.json().catch(function(C){throw new ka(C.message)})})}var Mw=f3;E();var d3=function(n){var s=new xs;return n.forEach(function(p){var i=p.matcherGroup.matchers;i.forEach(function(m){var v=m.matcherType,b=m.userDefinedSegmentMatcherData;v==="IN_SEGMENT"&&s.add(b.segmentName)})}),s},Iw=d3;var zh=Nt("splitio-producer:split-changes");function m3(r){return r.getRegisteredSegments().every(function(n){return r.getChangeNumber(n)!==-1})}function y3(r){var n=r.reduce(function(s,p){return p.status==="ACTIVE"?(s.added.push([p.name,JSON.stringify(p)]),Iw(p.conditions).forEach(function(i){s.segments.add(i)})):s.removed.push(p.name),s},{added:[],removed:[],segments:new xs});return n.segments=Md(n.segments),n}function gg(r,n){n===void 0&&(n=!1);var s=r.getAll(),p=s[r.constants.SETTINGS],i=s[r.constants.READINESS],m=s[r.constants.STORAGE],v=s[r.constants.COLLECTORS],b=i.splits,M=!0,z=!0;return function C(j,Y){j===void 0&&(j=0);function ot(ft){zh.debug("Spin up split update using since = "+ft);var At=Mw(p,ft,M,v,n,Y).then(function(Gt){M=!1;var Zt=y3(Gt.splits);return zh.debug("New splits "+Zt.added.length),zh.debug("Removed splits "+Zt.removed.length),zh.debug("Segment names collected "+Zt.segments),Promise.all([m.splits.setChangeNumber(Gt.till),m.splits.addSplits(Zt.added),m.splits.removeSplits(Zt.removed),m.segments.registerSegments(Zt.segments)]).then(function(){(z||ft!==Gt.till&&(!n||m3(m.segments)))&&(z=!1,b.emit(b.SDK_SPLITS_ARRIVED))})}).catch(function(Gt){return Gt instanceof ka||(setTimeout(function(){throw Gt},0),M=!1),zh.warn("Error while doing fetch of Splits. "+Gt),M&&p.startup.retriesOnFailureBeforeReady>j?(j+=1,zh.info("Retrying download of splits #"+j+". Reason: "+Gt),C(j,Y)):(M=!1,!1)});return M&&m.splits.checkCache()&&setTimeout(b.emit(b.SDK_SPLITS_CACHE_LOADED),0),At}var J=m.splits.getChangeNumber(),mt=er(J)?J:Promise.resolve(J);return mt.then(ot)}}E();E();E();E();var Cw=bo;E();function vg(r,n){return jn(r,"/mySegments/"+encodeURIComponent(Aa(r.core.key)),void 0,n?Rd:void 0)}var g3=function(n,s,p,i){s===void 0&&(s=!1);var m=Cw(vg(n,i));return m=ii.start(ii.TaskNames.MY_SEGMENTS_FETCH,s?p:!1,m),s&&(m=Bd(n.startup.requestTimeoutBeforeReady,m)),m.then(function(v){return v.json().catch(function(b){throw new ka(b.message)})}).then(function(v){return v.mySegments.map(function(b){return b.name})})},Aw=g3;var v3=Nt("splitio-producer:my-segments");function _g(r){var n=r.getAll(),s=n[r.constants.SETTINGS],p=n[r.constants.READINESS],i=n[r.constants.STORAGE],m=n[r.constants.COLLECTORS],v=p.segments,b=!0,M=!0;function z(C){var j=i.segments,Y;if(Array.isArray(C))Y=j.resetSegments(C);else{var ot=C.name,J=C.add;j.isInSegment(ot)!==J?(Y=!0,J?j.addToSegment(ot):j.removeFromSegment(ot)):Y=!1}i.splits.usesSegments()&&(Y||b)&&(b=!1,v.emit(v.SDK_SEGMENTS_ARRIVED))}return function C(j,Y,ot){j===void 0&&(j=0);var J;return Y?J=new Promise(function(mt){z(Y),mt()}):J=Aw(s,M,m,ot).then(function(mt){M=!1,z(mt)}),J.catch(function(mt){return mt instanceof ka||setTimeout(function(){throw mt},0),M&&s.startup.retriesOnFailureBeforeReady>j?(j+=1,v3.warn("Retrying download of segments #"+j+". Reason: "+mt),C(j)):(M=!1,!1)})}}var _3=Nt("splitio-producer:mySegmentsHandler"),x3=function(n){var s=n.get(n.constants.SETTINGS),p=n.get(n.constants.STORAGE).splits,i=n.get(n.constants.READINESS),m=i.splits,v=i.segments,b=_g(n),M=Rh(C,s.scheduler.segmentsRefreshRate);m.on(m.SDK_SPLITS_ARRIVED,J),p.usesSegments()?m.once(m.SDK_SPLITS_ARRIVED,ot):setTimeout(ot,0);var z=!1;function C(mt,ft){return z=!0,b(0,mt,ft).then(function(At){return z=!1,At})}var j=!1;function Y(){return j}function ot(){var mt=n.get(n.constants.READY,!0);!mt&&!p.usesSegments()&&v.emit(v.SDK_SEGMENTS_ARRIVED)}function J(){if(!!j){var mt=p.usesSegments();mt!==M.isRunning()&&(_3.info("Turning segments data polling "+(mt?"ON":"OFF")+"."),mt?M.start():M.stop())}}return{start:function(){j=!0,p.usesSegments()&&M.start()},stop:function(){j=!1,M.stop()},isRunning:Y,isSynchronizingMySegments:function(){return z},synchronizeMySegments:C}},Ud=x3;var Pw=Nt("splitio-producer:updater"),b3=function(n){var s=n.get(n.constants.SETTINGS),p=gg(n),i=Rh(b,s.scheduler.featuresRefreshRate),m=Ud(n),v=!1;function b(M){return v=!0,p(0,M).then(function(z){return v=!1,z})}return{start:function(){Pw.info("Starting BROWSER producer"),i.start(),m.start()},stop:function(){Pw.info("Stopping BROWSER producer"),i.stop(),m.stop()},isRunning:i.isRunning,isSynchronizingSplits:function(){return v},synchronizeSplits:b,isSynchronizingMySegments:m.isSynchronizingMySegments,synchronizeMySegments:m.synchronizeMySegments}},Lw=b3;var Gd=Nt("splitio-sync:sync-manager");function xg(r){var n={},s=r.get(r.constants.SETTINGS),p=z(!1,r),i=s.streamingEnabled?dg(r,n):void 0,m=r.get(r.constants.PRODUCER);function v(){m.isRunning()?Gd.info("Streaming couldn't connect. Continue periodic fetch of data."):(Gd.info("Streaming not available. Starting periodic fetch of data."),sn(n,function(C){var j=C.get(C.constants.PRODUCER);j.start()}))}function b(){m.isRunning()&&(Gd.info("PUSH (re)connected. Syncing and stopping periodic fetch of data."),sn(n,function(C){var j=C.get(C.constants.PRODUCER);j.stop()})),M()}function M(){var C=r.get(r.constants.PRODUCER);C.synchronizeSplits(),sn(n,function(j){var Y=j.get(j.constants.PRODUCER);Y.synchronizeMySegments()})}function z(C,j){var Y=C?Ud(j):Lw(j),ot=j.get(j.constants.SETTINGS),J=yh(Aa(ot.core.key));return j.put(j.constants.PRODUCER,Y),n[J]&&Gd.warn("A client with the same user key has already been created. Only the new instance will be properly synchronized."),n[J]=j,{start:function(){i?(C?m.isRunning()?Y.start():Y.synchronizeMySegments():(M(),i.on(il,b),i.on(ws,v)),i.startNewClient(J,j)):Y.start()},stop:function(){var ft=n[J];ft&&(delete n[J],i&&(i.removeClient(J),C||i.stop()),Y.isRunning()&&Y.stop())}}}return p.shared=z.bind(null,!0),p.pushManager=i,p}E();var zw=zr(Ci()),kw=Nt("splitio-client:cleanup"),Rw="unload",Dw=function(){function r(s,p){this.storage=s.get(s.constants.STORAGE),this.settings=s.get(s.constants.SETTINGS),this.syncManager=p,this.flushData=this.flushData.bind(this),this.settings.sync.impressionsMode===yn&&(this.impressionsCounter=s.get(s.constants.IMPRESSIONS_COUNTER))}var n=r.prototype;return n.start=function(){typeof window<"u"&&window.addEventListener&&(kw.debug("Registering flush handler when unload page event is triggered."),window.addEventListener(Rw,this.flushData))},n.stop=function(){typeof window<"u"&&window.removeEventListener&&(kw.debug("Deregistering flush handler when unload page event is triggered."),window.removeEventListener(Rw,this.flushData))},n.flushData=function(){this._flushImpressions(),this._flushEvents(),this.impressionsCounter&&this._flushImpressionsCount(),this.syncManager&&this.syncManager.pushManager&&this.syncManager.pushManager.stop()},n._flushImpressions=function(){var p=this.storage.impressions;if(!p.isEmpty()){var i=this.settings.url("/testImpressions/beacon"),m=zd(p,this.settings),v={sim:this.settings.sync.impressionsMode===yn?yn:Hl};this._sendBeacon(i,m,v)||Ph(pp(this.settings,{body:JSON.stringify(m)})),p.clear()}},n._flushImpressionsCount=function(){var p={pf:Dd(this.impressionsCounter)},i=p.pf.length;if(i!==0){var m=this.settings.url("/testImpressions/count/beacon");this._sendBeacon(m,p)||Ph(fp(this.settings,{body:JSON.stringify(p)}))}},n._flushEvents=function(){var p=this.storage.events;if(!p.isEmpty()){var i=this.settings.url("/events/beacon"),m=p.toJSON();this._sendBeacon(i,m)||Od(dp(this.settings,{body:JSON.stringify(m)})),p.clear()}},n._sendBeacon=function(p,i,m){if(typeof navigator<"u"&&navigator.sendBeacon){var v={entries:i,token:this.settings.core.authorizationKey,sdk:this.settings.version};m&&(0,zw.default)(v,m);var b=JSON.stringify(v);return navigator.sendBeacon(p,b)}return!1},r}();var bg={};function w3(r,n,s){var p=!!s,i=r.get(r.constants.SETTINGS),m=r.get(r.constants.READINESS),v=r.get(r.constants.STORAGE),b=r.get(r.constants.STATUS_MANAGER),M=m.gate,z=m.splits,C=m.segments,j=M.SDK_READY,Y=p?void 0:rw(r),ot=p?void 0:ow(r),J;switch(i.mode){case bh:case Jo:{r.put(r.constants.COLLECTORS,Y&&Y.collectors),p?J=bg[i.core.authorizationKey].shared(r):(J=xg(r),bg[i.core.authorizationKey]=J);break}case wh:{r.put(r.constants.READY_FROM_CACHE,!0);break}}var mt=p?void 0:new Dw(r,J);if(n&&J&&!p){var ft=n.sdkReadyTracker,At=n.splitsReadyTracker,Gt=n.segmentsReadyTracker;ft.setCollectorForTask(Y.collectors),M.once(j,ft),z.once(z.SDK_SPLITS_ARRIVED,At),C.once(C.SDK_SEGMENTS_ARRIVED,Gt)}J&&J.start(),Y&&Y.start(),ot&&r.put(r.constants.EVENTS,ot)&&ot.start(),r.put(r.constants.COLLECTORS,s);var Zt=(0,Ow.default)(Object.create(b),kd(r),{destroy:function(){return J&&J.stop(),Y&&Y.stop(),ot&&ot.stop(),Promise.all([Y&&Y.flush(),ot&&ot.flush()]).then(function(){m.destroy(),mt&&mt.stop(),v.destroy&&v.destroy(),r.put(r.constants.DESTROYED,!0),p||(Yc(i.core.authorizationKey),delete bg[i.core.authorizationKey])})}});return!p&&mt.start(Zt.destroy),{api:Zt,metricCollectors:Y&&Y.collectors}}var Nw=w3;E();var Uw=zr(Ci());E();E();E();E();function wg(r){var n=r.treatment;return r.keys?{conditionType:"WHITELIST",matcherGroup:{combiner:"AND",matchers:[{keySelector:null,matcherType:"WHITELIST",negate:!1,whitelistMatcherData:{whitelist:Ir(r.keys)?[r.keys]:r.keys}}]},partitions:[{treatment:n,size:100}],label:"whitelisted "+n}:{conditionType:"ROLLOUT",matcherGroup:{combiner:"AND",matchers:[{keySelector:null,matcherType:"ALL_KEYS",negate:!1}]},partitions:[{treatment:n,size:100}],label:"default rule"}}function S3(r,n){return typeof r!=typeof n?!0:typeof r=="string"?r!==n:r.treatment!==n.treatment||r.config!==n.config}function Sg(){var r={emptyMock:1};function n(s){var p=Object.keys(s);return p.length!==Object.keys(r).length?(r=s,!0):p.some(function(i){var m=!r[i],v=S3(r[i],s[i]),b=m||v;return b&&(r=s),b})}return function(p){var i=p.features||{};if(!n(i))return!1;var m={};return sn(i,function(v,b){var M=v,z=null;Yi(v)&&(M=v.treatment,z=v.config||z);var C={};z!==null&&(C[M]=z),m[b]={trafficTypeName:"localhost",conditions:[wg({treatment:M})],configurations:C}}),m}}E();var Eg=Nt("splitio-producer:offline");function E3(r,n){var s=n.getAll(),p=s[n.constants.SETTINGS],i=s[n.constants.READINESS],m=s[n.constants.STORAGE],v=!0;return function(){var M=[],z=null,C={};try{C=r(p)}catch(j){z=j,Eg.error("There was an issue loading the mock Splits data, no changes will be applied to the current cache. "+j)}return!z&&C?(Eg.debug("Splits data: "),Eg.debug(JSON.stringify(C)),sn(C,function(j,Y){M.push([Y,JSON.stringify({name:Y,status:"ACTIVE",killed:!1,trafficAllocation:100,defaultTreatment:"control",conditions:j.conditions||[],configurations:j.configurations,trafficTypeName:j.trafficTypeName})])}),Promise.all([m.splits.flush(),m.splits.addSplits(M)]).then(function(){i.splits.emit(i.splits.SDK_SPLITS_ARRIVED),v&&(v=!1,p.storage.__originalType===Qs&&i.splits.emit(i.splits.SDK_SPLITS_CACHE_LOADED),i.segments.emit(i.segments.SDK_SEGMENTS_ARRIVED))})):Promise.resolve()}}var Fw=E3;function Tg(r){var n=Sg();return Fw(n,r)}var T3=function(n){var s=n.get(n.constants.SETTINGS),p=Tg(n),i=Rh(p,s.scheduler.offlineRefreshRate);return i},Bw=T3;function M3(r,n){var s=!n,p=r.get(r.constants.READINESS),i=r.get(r.constants.STORAGE),m=r.get(r.constants.STATUS_MANAGER);s&&setTimeout(function(){p.splits.on(p.splits.SDK_SPLITS_ARRIVED,function(){p.gate.emit(p.gate.SDK_UPDATE)}),p.gate.emit(p.gate.SDK_READY)},0);var v=s?void 0:Bw(r);v&&v.start();var b=(0,Uw.default)(Object.create(m),kd(r),{destroy:function(){return v&&v.stop(),p.destroy(),i.destroy&&i.destroy(),r.put(r.constants.DESTROYED,!0),!s&&Yc(),Promise.resolve()}});return{api:b,metricCollectors:!1}}var Gw=M3;E();var jw=zr(Ci());E();function Vd(r,n){var s=!1,p=!1;function i(v){var b=new Promise(function(z,C){return v.then(z,function(j){p?C(j):n(j)})}),M=b.then;return Object.defineProperty(b,"then",{value:function(C,j){var Y=M.call(b,C,j);return typeof C=="function"&&(s=!0),typeof j=="function"?(p=!0,Y):i(Y)}}),b}var m=i(r);return m.hasOnFulfilled=function(){return s},m}var Ep=Nt(""),I3="newListener",C3="removeListener";function Vw(r){Ep.error(r)}function jd(r,n){n===void 0&&(n=0);var s=r.get(r.constants.READINESS).gate,p=0,i=!1,m=!1,v=s.SDK_READY,b=s.SDK_READY_FROM_CACHE,M=s.SDK_UPDATE,z=s.SDK_READY_TIMED_OUT;s.on(C3,function(Y){Y===v&&p--}),s.on(I3,function(Y){(Y===v||Y===z)&&(i?Ep.error("A listener was added for "+(Y===v?"SDK_READY":"SDK_READY_TIMED_OUT")+" on the SDK, which has already fired and won't be emitted again. The callback won't be executed."):Y===v&&p++)});var C=j();s.once(b,function(){Ep.info("Split SDK is ready from cache."),r.put(r.constants.READY_FROM_CACHE,!0)});function j(){var Y=Vd(new Promise(function(ot,J){s.once(v,function(){Ep.info("Split SDK is ready."),p===n&&!Y.hasOnFulfilled()&&Ep.warn("No listeners for SDK Readiness detected. Incorrect control treatments could have been logged if you called getTreatment/s while the SDK was not yet ready."),r.put(r.constants.READY,!0),i=!0,ot()}),s.once(z,function(mt){r.put(r.constants.HAS_TIMEDOUT,!0),m=!0,J(mt)})}),Vw);return Y}return(0,jw.default)(Object.create(s),{Event:{SDK_READY:v,SDK_READY_FROM_CACHE:b,SDK_UPDATE:M,SDK_READY_TIMED_OUT:z},ready:function(){return m?i?Promise.resolve():Vd(Promise.reject("Split SDK has emitted SDK_READY_TIMED_OUT event."),Vw):C},__context:r})}E();E();var Mg=zr(Ci());var qw="splitio-ga-to-split",Tp=qw+":mapper",Jl=Nt(qw);function A3(r,n){var s=window.GoogleAnalyticsObject||"ga";window[s]=window[s]||function(){for(var p=arguments.length,i=new Array(p),m=0;m<p;m++)i[m]=arguments[m];(window[s].q=window[s].q||[]).push(i)},window[s]("provide",r,n)}var P3={eventTypeId:{event:"eventAction",social:"socialAction"},eventValue:{event:"eventValue",timing:"timingValue"},eventProperties:{pageview:["page"],screenview:["screenName"],event:["eventCategory","eventLabel"],social:["socialNetwork","socialTarget"],timing:["timingCategory","timingVar","timingLabel"],exception:["exDescription","exFatal"]}};function L3(r){return function(n){var s=n.get("hitType"),p=n.get(r.eventTypeId[s]||"hitType"),i=n.get(r.eventValue[s]),m={},v=r.eventProperties[s];if(v)for(var b=0;b<v.length;b++)m[v[b]]=n.get(v[b]);return{eventTypeId:p,value:i,properties:m,timestamp:Date.now()}}}var k3=L3(P3),R3="ga";function z3(r){if(!Array.isArray(r))return[];var n=Ex(r);return n.filter(function(s){if(!s)return!1;var p=s.key,i=s.trafficType;return!(!Ir(p)&&!co(p)||!Ir(i))})}function D3(r){if(!Jc(r.eventTypeId,Tp)||Qc(r.value,Tp)===!1)return!1;var n=tp(r.properties,Tp),s=n.properties;return!(s===!1||r.timestamp&&!co(r.timestamp)||r.key&&Ia(r.key,Tp)===!1||r.trafficTypeName&&ys(r.trafficTypeName,Tp)===!1)}var O3=/^[^a-zA-Z0-9]+/,N3=/[^-_.:a-zA-Z0-9]+/g;function F3(r){if(!Ir(r)||r.length===0)return r;var n=r.replace(O3,"").replace(N3,"_"),s=n.slice(0,80);return s.length<n.length&&Jl.warn("EventTypeId was truncated because it cannot be more than 80 characters long."),s}function B3(r,n,s){var p={prefix:R3,identities:s.key&&s.trafficType?[{key:s.key,trafficType:s.trafficType}]:void 0},i=function(v,b){var M=(0,Mg.default)({},p,r,b);this.tracker=v;var z=z3(M.identities);if(z.length===0){Jl.warn("No valid identities were provided. Please check that you are passing a valid list of identities or providing a traffic type at the SDK configuration.");return}var C=z.length-M.identities.length;C&&Jl.warn(C+" identities were discarded because they are invalid or duplicated. Identities must be an array of objects with key and trafficType."),M.identities=z,Ir(M.prefix)||(Jl.warn("The provided `prefix` was ignored since it is invalid. Please check that you are passing a string object as `prefix`."),M.prefix=void 0);var j=v.get("sendHitTask");v.set("sendHitTask",function(Y){if(j(Y),!(M.hits===!1||Y.get("splitHit"))){try{if(M.filter&&!M.filter(Y))return}catch(J){Jl.warn("GaToSplit custom filter threw: "+J);return}var ot=k3(Y);if(M.mapper){try{ot=M.mapper(Y,ot)}catch(J){Jl.warn("GaToSplit custom mapper threw: "+J);return}if(!ot)return}M.prefix&&(ot.eventTypeId=M.prefix+"."+ot.eventTypeId),ot.eventTypeId=F3(ot.eventTypeId),D3(ot)&&(ot.key&&ot.trafficTypeName?n.events.track(ot):M.identities.forEach(function(J){var mt=(0,Mg.default)({key:J.key,trafficTypeName:J.trafficType},ot);n.events.track(mt)}))}}),Jl.info("Started GA-to-Split integration")};A3("splitTracker",i)}var Ww=B3;E();var qd=Nt("splitio-split-to-ga"),Kw=function(){r.defaultMapper=function(p){var i=p.type,m=p.payload;switch(i){case ip:return{hitType:"event",eventCategory:"split-impression",eventAction:"Evaluate "+m.impression.feature,eventLabel:"Treatment: "+m.impression.treatment+". Targeting rule: "+m.impression.label+".",nonInteraction:!0};case np:return{hitType:"event",eventCategory:"split-event",eventAction:m.eventTypeId,eventValue:m.value,nonInteraction:!0}}return null},r.getGa=function(){return typeof window<"u"?window[window.GoogleAnalyticsObject||"ga"]:void 0},r.validateFieldsObject=function(p){return p&&p.hitType?!0:(qd.warn("your custom mapper returned an invalid FieldsObject instance. It must be an object with at least a `hitType` field."),!1)};function r(s){if(typeof r.getGa()!="function")return qd.warn("`ga` command queue not found. No hits will be sent."),{};this.trackerNames=r.defaultTrackerNames,s&&(typeof s.filter=="function"&&(this.filter=s.filter),typeof s.mapper=="function"&&(this.mapper=s.mapper),Array.isArray(s.trackerNames)&&(this.trackerNames=mh(s.trackerNames)),this.impressions=s.impressions,this.events=s.events),qd.info("Started Split-to-GA integration")}var n=r.prototype;return n.queue=function(p){var i=r.getGa();if(i){if(this.impressions===!1&&p.type===ip||this.events===!1&&p.type===np)return;var m;try{if(this.filter&&!this.filter(p)||(m=r.defaultMapper(p),this.mapper&&(m=this.mapper(p,m),!m||!r.validateFieldsObject(m))))return}catch(v){qd.warn("SplitToGa queue method threw: "+v+". No hit was sent.");return}this.trackerNames.forEach(function(v){var b=v?v+".send":"send";m.splitHit=!0,i(b,m)})}},r}();Kw.defaultTrackerNames=[""];var Hw=Kw;var U3=function(n){var s=n.get(n.constants.SETTINGS),p=[];if(s.integrations.forEach(function(i){var m=i.type,v;switch(m){case yd:{var b=n.get(n.constants.STORAGE),M=s.core;v=Ww(i,b,M);break}case gd:{v=new Hw(i);break}}v&&v.queue&&p.push(v)}),p.length!==0)return{handleImpression:function(m){p.forEach(function(v){return v.queue({type:ip,payload:m})})},handleEvent:function(m){p.forEach(function(v){return v.queue({type:np,payload:m})})}}},Zw=U3;E();var Xw=zr(Ci()),G3=function(){function r(){this.cache={}}var n=r.prototype;return n._makeKey=function(p,i){return p+"::"+Pd(i)},n.inc=function(p,i,m){var v=this._makeKey(p,i),b=this.cache[v];this.cache[v]=b?b+m:m},n.popAll=function(){var p={};return(0,Xw.default)(p,this.cache),this.cache={},p},n.size=function(){return Object.keys(this.cache).length},r}(),Yw=G3;var Mp=Nt("splitio"),Jw=function(n,s){return(n.matchingKey?n.matchingKey:n)+"-"+(n.bucketingKey?n.bucketingKey:n)+"-"+(s!==void 0?s:"")};function Qw(r){var n={},s={splitsReadyTracker:ii.start(ii.TaskNames.SPLITS_READY),segmentsReadyTracker:ii.start(ii.TaskNames.SEGMENTS_READY),sdkReadyTracker:ii.start(ii.TaskNames.SDK_READY)},p=new Dy,i=S1(r);p.put(p.constants.SETTINGS,i),vy(i.core.authorizationKey);var m=d1(),v=m(i.startup.readyTimeout);p.put(p.constants.READINESS,v);var b=jd(p);p.put(p.constants.STATUS_MANAGER,b);var M=t1(p);p.put(p.constants.STORAGE,M);var z=new Yw;p.put(p.constants.IMPRESSIONS_COUNTER,z);var C=Zw(p);p.put(p.constants.INTEGRATIONS_MANAGER,C);var j=i.mode===Ca?Gw:Nw,Y=j(p,s),ot=Y.api,J=Y.metricCollectors,mt=Wx(M.splits,p),ft=Ed(i.core.key),At=Jw(ft,i.core.trafficType);return n[At]=ot,Mp.info("New Split SDK instance created."),{client:function(Zt,we){if(Zt===void 0)return Mp.debug("Retrieving default SDK client."),ot;if(typeof M.shared!="function")throw new Error("Shared Client not supported by the storage mechanism. Create isolated instances instead.");var he=Ia(Zt,"Shared Client instantiation");if(he===!1)throw new Error("Shared Client needs a valid key.");var Kt;if(we!==void 0&&(Kt=ys(we,"Shared Client instantiation"),Kt===!1))throw new Error("Shared Client needs a valid traffic type or no traffic type at all.");var ce=Jw(he,Kt);if(n[ce])Mp.debug("Retrieving existing SDK client.");else{var Yt=i.overrideKeyAndTT(he,Kt),Te=new Dy,dr=m(Yt.startup.readyTimeout);Te.put(p.constants.READY_FROM_CACHE,p.get(p.constants.READY_FROM_CACHE,!0)),Te.put(p.constants.READINESS,dr),Te.put(p.constants.STATUS_MANAGER,jd(Te,-1)),Te.put(p.constants.SETTINGS,Yt),Te.put(p.constants.STORAGE,M.shared(Yt)),Te.put(p.constants.IMPRESSIONS_COUNTER,z),n[ce]=j(Te,!1,J).api,Mp.info("New shared client instance created.")}return n[ce]},manager:function(){return Mp.info("Manager instance retrieved."),mt},Logger:ms,settings:i}}var Ss={client:null,_client:null,getClient(){if(this.client!=null)return this.client;if(zt.SplitApiKey==="")return this.client=Promise.resolve(null),this.client;let r=Qw({core:{authorizationKey:zt.SplitApiKey,key:zt.ApiKey}});return this.client=new Promise(n=>{let s=r.client();s.on(s.Event.SDK_READY,()=>{Ss._client=s,n(s)})}),this.client},getClientSync(){return this._client?this._client:(this.getClient(),null)},getTreatment(r){let n=Ss.getClientSync();return n==null?null:n.getTreatment(r)}};window.splitIo=Ss;E();go();var Es=class extends Ti{constructor(){super(...arguments);this._copyTimeout=null;this.copy=()=>{ql("Ui","copy:"+zt.map.layerKey+":"+this.props.header.replace(/ /g,"").toLowerCase()),navigator.clipboard.writeText(this.props.value),this.setState({copied:!0}),this._copyTimeout!=null&&clearTimeout(this._copyTimeout),this._copyTimeout=setTimeout(()=>this.setState({copied:!1}),1e3)}}render(){return D("div",{class:"LuiDeprecatedForms"},D("label",null,this.props.header),D("div",{class:sd({"lui-menu-label":!0,"menu-copyable":!0,"menu-copyable-copied":this.state.copied})},D("button",{class:"menu-copyable-icon-button",title:"Copy",onClick:this.copy},D("i",{class:"material-icons-round"},this.state.copied?"check":"content_copy")),D("input",{value:this.props.value,readonly:!0})))}};E();go();var Wd=class extends Ti{constructor(){super(...arguments);this._events=[];this.onChange=s=>{let p=s.target,[i,m]=p.value.split("::");zt.map.setLayerId(i,m),ql("Ui","layer:"+p.value),zt.map.layers.then(v=>{let b=v.get(i);b!=null&&zt.map.emit("bounds",[b.upperLeft,b.lowerRight])}),window.history.pushState(null,"",`?${xo.toUrl(zt.map)}`)}}componentWillMount(){Ss.getClient().then(s=>{let p=s?.getTreatment("layer-switcher-dropdown")==="on",i=s?.getTreatment("layer-switcher-individual-layers")==="on",m=s?.getTreatment("layer-switcher-basic")==="on";this.setState({...this.state,isEnabled:p,isIndividualEnabled:i,isBasicStyleEnabled:m}),p&&zt.map.layers.then(v=>this.setState({...this.state,layers:v}))}),this.setState({...this.state,currentLayer:zt.map.layerKey}),this._events.push(zt.map.on("layer",()=>this.setState({...this.state,currentLayer:zt.map.layerKey})),zt.map.on("tileMatrix",()=>this.setState(this.state)))}componentWillUnmount(){for(let s of this._events)s();this._events=[]}render(){if(this.state.isEnabled===!0)return D("div",{class:"LuiDeprecatedForms"},D("h6",null,"Layers"),D("select",{onChange:this.onChange,value:this.state.currentLayer},D("optgroup",{label:"Basemaps"},D("option",{value:"aerial"}," Aerial Imagery"),D("option",{value:"topographic::topographic"},"Topographic"),this.state.isBasicStyleEnabled?D("option",{value:"topographic::basic"},"Basic"):void 0),this.renderAerialLayers()))}renderAerialLayers(){if(this.state.isIndividualEnabled!==!0||this.state.layers==null||this.state.layers.size===0)return;let s=[],p=[];for(let i of this.state.layers.values()){if(!i.projections.has(zt.map.tileMatrix.projection.code))continue;let m=D("option",{value:i.id},i.name);i.name.toLowerCase().includes(" rural ")?s.push(m):p.push(m)}if(!(s.length===0||p.length===0))return D(K,null,D("optgroup",{label:"Aerial Imagery - Urban"},...p),";",D("optgroup",{label:"Aerial Imagery - Rural"},...s),";")}};var Kd=class extends Ti{constructor(){super(...arguments);this._events=[];this.menuToggle=()=>{let s=!this.state.isMenuOpen;ql("Ui",s?"menu:open":"menu:close"),this.setState({...this.state,isMenuOpen:s})};this.contactUs=()=>{let s="Request Basemaps Developer Access",p=`
|
|
546
|
+
Give us a few key details to sign up for Developer Access to LINZ Basemaps. We will respond with your Apps' unique API key.
|
|
547
|
+
|
|
548
|
+
Your Name:
|
|
549
|
+
|
|
550
|
+
Your Email:
|
|
551
|
+
|
|
552
|
+
Your Service/App URL:
|
|
553
|
+
|
|
554
|
+
`;ql("Ui","contact-us:click"),window.location.href=`mailto:basemaps@linz.govt.nz?subject=${encodeURI(s)}&body=${encodeURI(p)}`};this._validProjections=new Set([Dr.Google,Dr.Nztm2000])}componentWillMount(){this.setState({isMenuOpen:!1}),this._events.push(zt.map.on("change",()=>this.setState(this.state))),Ss.getClient().then(s=>{s?.getTreatment("layer-switcher-individual-layers")==="on"&&zt.map.layers.then(i=>this.setState({...this.state,layers:i}))})}componentWillUnmount(){for(let s of this._events)s();this._events=[]}render(){if(!zt.map.isDebug)return D("header",{class:"lui-header"},D("div",{class:"lui-header-row"},D("div",{class:"lui-header-col"},D("div",{class:"lui-header-logo"},D("img",{class:"linz-logo",src:"/assets/logo-linz.svg"})),D("div",{class:"lui-header-title"},D("h1",null,"Basemaps"))),D("div",{class:"lui-header-col"},D("div",{class:"lui-header-menu-item"},D("div",{class:"lui-header-menu-icon"},D("i",{class:"material-icons-round md-36",onClick:this.menuToggle,style:{cursor:"pointer"}},this.state.isMenuOpen?"close":"menu"))))),D("div",{class:sd({"lui-menu-drawer":!0,"lui-menu-drawer-closed":!this.state.isMenuOpen,"lui-menu-drawer-wide":!0}),"aria-hidden":this.state.isMenuOpen},D(Wd,null),this.renderLinks(),D("h6",null,"Developer API Keys"),D("p",null,"Contact us for free API keys with better support for public web and mobile apps."),D("button",{class:"lui-button lui-button-tertiary contact-us",onClick:this.contactUs},"Contact us"),this.renderAbout()))}renderAboutLi(s,p,i){return D("li",null,D(Ta,{href:p},s,i??D(Hc,{name:"launch"})))}renderAbout(){return D(K,null,D("h6",null,"About Basemaps"),D("ul",{class:"about-links"},this.renderAboutLi("Get started","https://www.linz.govt.nz/data/linz-data/linz-basemaps/get-started-linz-basemaps"),this.renderAboutLi("Technical information","https://www.linz.govt.nz/data/linz-data/linz-basemaps/linz-basemaps-documentation"),this.renderAboutLi("How to use our APIs","https://www.linz.govt.nz/data/linz-data/linz-basemaps/how-use-linz-basemaps-apis"),this.renderAboutLi("Github","https://github.com/linz/basemaps",this.renderGithubLogo()),D("li",null,D(Ta,{href:"https://github.com/linz/basemaps/blob/master/CHANGELOG.md"},"Version ",D("span",{class:"basemaps-version"},zt.Version)))))}renderGithubLogo(){return D("svg",{style:"width: 24px; height: 24px",viewBox:"0 0 24 24"},D("path",{fill:"currentColor",d:"M12,2A10,10 0 0,0 2,12C2,16.42 4.87,20.17 8.84,21.5C9.34,21.58 9.5,21.27 9.5,21C9.5,20.77 9.5,20.14 9.5,19.31C6.73,19.91 6.14,17.97 6.14,17.97C5.68,16.81 5.03,16.5 5.03,16.5C4.12,15.88 5.1,15.9 5.1,15.9C6.1,15.97 6.63,16.93 6.63,16.93C7.5,18.45 8.97,18 9.54,17.76C9.63,17.11 9.89,16.67 10.17,16.42C7.95,16.17 5.62,15.31 5.62,11.5C5.62,10.39 6,9.5 6.65,8.79C6.55,8.54 6.2,7.5 6.75,6.15C6.75,6.15 7.59,5.88 9.5,7.17C10.29,6.95 11.15,6.84 12,6.84C12.85,6.84 13.71,6.95 14.5,7.17C16.41,5.88 17.25,6.15 17.25,6.15C17.8,7.5 17.45,8.54 17.35,8.79C18,9.5 18.38,10.39 18.38,11.5C18.38,15.32 16.04,16.16 13.81,16.41C14.17,16.72 14.5,17.33 14.5,18.26C14.5,19.6 14.5,20.68 14.5,21C14.5,21.27 14.66,21.59 15.17,21.5C19.14,20.16 22,16.42 22,12A10,10 0 0,0 12,2Z"}))}renderLinks(){return D(K,null,D("h6",null,"90 day API keys"),D("p",null,"API keys expire after 90 days, if a longer duration is needed please request a developer API key"),D(Es,{header:"Api Key",value:zt.ApiKey}),this.renderLinksTiles())}validProjections(){return this.state.layers==null?this._validProjections:this.state.layers.get(zt.map.layerId)?.projections??this._validProjections}renderLinksTiles(){if(zt.map.isVector)return D(K,null,D(Es,{header:"StyleJSON",value:zt.map.toTileUrl("style")}),D(Es,{header:"XYZ",value:zt.map.toTileUrl("vector-xyz")}));let s=this.validProjections(),p=[];if(s.has(Dr.Nztm2000)){let i=zt.map.toTileUrl("wmts",ba);p.push(D(Es,{header:"WMTS: NZTM2000Quad",value:i}))}if(s.has(Dr.Google)){let i=zt.map.toTileUrl("wmts",Or),m=zt.map.toTileUrl("raster",Or);p.push(D(Es,{header:"WMTS: WebMercatorQuad",value:i})),p.push(D(Es,{header:"XYZ",value:m}))}return D(K,null,p)}};E();var Dh=zr(Hd(),1);go();E();E();E();function t2(r){let n=document.createElement("span");return n.textContent=r,n.innerHTML}var Ag=class{constructor(n){this.boundaries=[],this.collection=n;let s=n.summaries["linz:zoom"];this.minZoom=s.min,this.maxZoom=s.max,this.bbox=n.extent.spatial.bbox[0]}intersects(n,s){return s>this.maxZoom||s<this.minZoom||!Ks.intersects(n,this.bbox)?!1:this.intersection(Ks.bboxToMultiPolygon(n))}intersection(n){for(let s of this.boundaries)if(ry(s,n).length>0)return!0;return!1}addBoundary(n){V3(n),this.boundaries.push(n)}};function V3(r){for(let n of r)for(let s of n)if(s.length!==2)throw new Error("Invalid ring wrong length")}function j3(r){var n;let s=new Map,p=[];for(let i of r.collections){let m=new Ag(i);p.push(m),s.set(i.id,m)}for(let i of r.features){let m=s.get((n=i.collection)!==null&&n!==void 0?n:"");if(m==null)throw new Error("Could not match feature to collection: "+i.collection);if(i.geometry.type==="Polygon")m.addBoundary(i.geometry.coordinates);else if(i.geometry.type==="MultiPolygon")for(let v of i.geometry.coordinates)m.addBoundary(v)}return p}function e2(r){let{interval:n}=r.extent.temporal;if(n==null||n.length===0)return[-1,-1];let s=n[0],p=new Date(s[0]).getFullYear(),i=(s.length<2?p:new Date(s[1]).getFullYear())-1;return[p,i<p?p:i]}var al=class{constructor(n){this.attributions=n}static async load(n){let s=await fetch(n);if(s.ok){let p=await s.json();return al.fromStac(p)}throw new Error(`fetch attribution failed [${s.status}] ${s.statusText}`)}static fromStac(n){return new al(j3(n).reverse())}filter(n,s){s=Math.round(s);let p=[],{attributions:i}=this;if(i==null)return p;for(let m of i)this.isIgnored!=null&&this.isIgnored(m)||m.intersects(n,s)&&p.push(m.collection);return p}renderList(n){if(n.length===0)return"";let s=t2(n[0].title);if(n.length>1)if(n.length===2)s+=` & ${t2(n[1].title)}`;else{let[p,i]=e2(n[1]);for(let m=1;m<n.length;++m){let[v,b]=e2(n[m]);v!==-1&&(p===-1||v<p)&&(p=v),b!==-1&&(i===-1||b>i)&&(i=b)}p===-1&&(p=i),i!==-1&&(s+=` & others ${p}-${i}`)}return s}};var Ip=zr(Hd(),1);var r2=`\xA9 ${E0.License} LINZ`,i2=new Map,n2=new Map,Zd=class{constructor(n){this._raf=0;this.attributionHtml="";this.bounds=new Ip.LngLatBounds([0,0,0,0]);this.zoom=-1;this.filteredRecords=[];this.resetAttribution=()=>{this.attributionHtml="",this.updateAttribution()};this.updateAttribution=()=>{if(zt.map.isVector)return this.vectorAttribution();let n=zt.map.layerKeyTms,s=i2.get(n);s==null&&(s=al.load(zt.map.toTileUrl("attribution")).catch(()=>null),i2.set(n,s),s.then(p=>{p!=null&&(p.isIgnored=this.isIgnored,n2.set(n,p),this.scheduleRender())})),this.scheduleRender()};this.isIgnored=n=>n.collection.title.toLowerCase().startsWith("geographx");this.renderAttribution=()=>{this._raf=0;let n=n2.get(zt.map.layerKeyTms);if(n==null)return this.removeAttribution();this.zoom=Math.round(this.map.getZoom()??0),this.bounds=this.map.getBounds(),this.zoom+=1;let s=this.mapboxBoundToBbox(this.bounds,zt.map.tileMatrix),p=n.filter(s,this.zoom),i=n.renderList(p);if(i===""?i=r2:i=r2+" - "+i,i!==this.attributionHtml){let m=this.attributionHtml=i;this.removeAttribution(),this.attributionControl=new Ip.default.AttributionControl({compact:!1,customAttribution:m}),this.map.addControl(this.attributionControl,"bottom-right")}this.filteredRecords=p};this.map=n,n.on("load",this.resetAttribution),n.on("move",this.updateAttribution),zt.map.on("tileMatrix",this.resetAttribution),zt.map.on("layer",this.resetAttribution)}scheduleRender(){this._scheduled!=null||this._raf!==0||this.map.getZoom()===this.zoom&&this.map.getBounds()===this.bounds||(this.zoom=this.map.getZoom()??0,this.bounds=this.map.getBounds(),this._scheduled=setTimeout(()=>{this._scheduled=void 0,this._raf=requestAnimationFrame(this.renderAttribution)},200))}removeAttribution(){this.attributionControl!=null&&(this.map.removeControl(this.attributionControl),this.attributionControl=null)}mapboxBoundToBbox(n,s){let p={lon:n.getWest(),lat:n.getSouth(),zoom:this.zoom},i={lon:n.getEast(),lat:n.getNorth(),zoom:this.zoom},m=Ea(p,Or,s),v=Ea(i,Or,s);return[m.lon,m.lat,v.lon,v.lat]}vectorAttribution(){this.removeAttribution(),this.attributionControl=new Ip.default.AttributionControl({compact:!1}),this.map.addControl(this.attributionControl,"bottom-right")}};E();go();function Xd(r,n){return D("input",{className:"debug__slider",type:"range",min:"0",max:"1",step:"0.05",value:String(zt.map.debug[`debug.layer.${r}`]),onInput:n})}var Yd=class extends Ti{constructor(){super(...arguments);this.waitForMap=()=>{let s=this.props.map;if(s==null){setTimeout(this.waitForMap,20);return}window.MaplibreMap=s,s.resize(),s.once("load",()=>{if(zt.map.on("change",()=>{if(this.props.map==null)return;let p=Xi.toHash(zt.map.getLocation(this.props.map)),i="?"+xo.toUrl(zt.map);window.history.replaceState(null,"",i+p),this.updateFromConfig()}),this.updateFromConfig(),zt.map.debug["debug.screenshot"]){let p=document.createElement("div");p.id="map-loaded",document.body.appendChild(p)}})};this.toggleSource=s=>{let p=s.target;zt.map.setDebug("debug.source",p.checked),this.setSourceShown(p.checked)};this._layerLoading=new Map;this._styleJson=null;this.adjustTopographic=s=>{let p=s.target;zt.map.setDebug("debug.layer.linz-topographic",Number(p.value))};this.adjustOsm=s=>{zt.map.setDebug("debug.layer.osm",Number(s.target.value))};this.adjustLinzAerial=s=>{zt.map.setDebug("debug.layer.linz-aerial",Number(s.target.value))};this.togglePurple=s=>{let p=s.target;this.setPurple(p.checked)}}componentDidMount(){this.waitForMap()}updateFromConfig(){this.setPurple(zt.map.debug["debug.background"]==="magenta"),this.adjustRaster("osm",zt.map.debug["debug.layer.osm"]),this.adjustRaster("linz-aerial",zt.map.debug["debug.layer.linz-aerial"]),this.adjustVector(zt.map.debug["debug.layer.linz-topographic"]),this.setSourceShown(zt.map.debug["debug.source"])}render(){return zt.map.debug["debug.screenshot"]?null:D("div",{className:"debug"},D("div",{className:"debug__info"},D("label",{className:"debug__label"},"ImageId"),D("div",{className:"debug__value"},zt.map.layerId)),D("div",{className:"debug__info"},D("label",{className:"debug__label"},"Projection "),D("div",{className:"debug__value"},zt.map.tileMatrix.projection.toEpsgString())),D("div",{className:"debug__info"},D("label",{className:"debug__label"},"TileMatrix "),D("div",{className:"debug__value"},zt.map.tileMatrix.identifier)),this.renderSliders(),this.renderPurple(),this.renderSourceToggle())}renderPurple(){if(!zt.map.debug["debug.screenshot"])return D("div",{className:"debug__info"},D("label",{className:"debug__label"},"Purple"),D("input",{type:"checkbox",onClick:this.togglePurple,checked:zt.map.debug["debug.background"]==="magenta"}))}renderSourceToggle(){return zt.map.layerId.startsWith("01")?D(K,null,D("div",{className:"debug__info"},D("label",{className:"debug__label"},"Source"),D("input",{type:"checkbox",onClick:this.toggleSource,checked:zt.map.debug["debug.source"]})),this.state.lastFeatureId==null?null:D("div",{className:"debug__info",title:String(this.state.lastFeatureName)},D("label",{className:"debug__label"},"SourceId"),String(this.state.lastFeatureName).split("/").pop())):null}trackMouseMove(s){let p=`${s}_source`,i=`${p}_fill`,m=this.props.map,v;m.on("mousemove",i,b=>{let M=b.features;if(M==null||M.length===0)return;let z=M[0];z.id!==v&&(v!=null&&m.setFeatureState({source:p,id:v},{hover:!1}),v=z.id,this.setState({...this.state,lastFeatureId:v,lastFeatureName:z.properties?.name}),m.setFeatureState({source:p,id:v},{hover:!0}))}),m.on("mouseleave",i,()=>{v!=null&&(m.setFeatureState({source:p,id:v},{hover:!1}),v=void 0,this.setState({...this.state,lastFeatureId:v,lastFeatureName:void 0}))})}setSourceShown(s){let p=this.props.map,i=zt.map.layerId,m=`${i}_source`,v=`${m}_fill`,b=`${m}_line`;if(s===!1){if(p.getLayer(v)==null)return;p.removeLayer(v),p.removeLayer(b);return}p.getLayer(v)==null&&this.loadSourceLayer(i).then(()=>{p.getLayer(v)==null&&(p.addLayer({id:v,type:"fill",source:m,paint:{"fill-opacity":["case",["boolean",["feature-state","hover"],!1],.25,0],"fill-color":"#ff00ff"}}),p.addLayer({id:b,type:"line",source:m,paint:{"line-color":"#ff00ff","line-opacity":["case",["boolean",["feature-state","hover"],!1],1,.5],"line-width":["case",["boolean",["feature-state","hover"],!1],2,1]}}),this.trackMouseMove(i))})}loadSourceLayer(s){let p=this._layerLoading.get(s);return p==null&&(p=this._loadSourceLayer(s),this._layerLoading.set(s,p)),p}async _loadSourceLayer(s){let p=this.props.map,i=`${s}_source`,m=`${i}_fill`;if(p.getLayer(m)!=null)return;let v=Xi.toImageryUrl(`im_${s}`,"source.geojson"),b=await fetch(v);if(!b.ok)return;let M=await b.json();zt.map.tileMatrix.projection!==Or.projection&&yx(M,zt.map.tileMatrix);let z=0;for(let C of M.features)C.id=z++;p.addSource(i,{type:"geojson",data:M})}renderSliders(){if(!zt.map.debug["debug.screenshot"])return zt.map.tileMatrix.identifier!==Or.identifier?D("div",{className:"debug__info"},D("label",{className:"debug__label"},"LINZ Aerial"),Xd("linz-aerial",this.adjustLinzAerial)):D(K,null,D("div",{className:"debug__info"},D("label",{className:"debug__label"},"OSM"),Xd("osm",this.adjustOsm)),D("div",{className:"debug__info"},D("label",{className:"debug__label"},"Topographic"),Xd("linz-topographic",this.adjustTopographic)),D("div",{className:"debug__info"},D("label",{className:"debug__label"},"LINZ Aerial"),Xd("linz-aerial",this.adjustLinzAerial)))}get styleJson(){return this._styleJson==null&&(this._styleJson=fetch(Xi.toTileUrl("style",zt.map.tileMatrix,"topographic","topographic")).then(s=>s.json())),this._styleJson}async adjustVector(s){let p=await this.styleJson,i=this.props.map;if(i.getSource("LINZ Basemaps")==null){if(s===0)return;let b=p.sources?.["LINZ Basemaps"];if(b==null)return;i.addSource("LINZ Basemaps",b),i.setStyle({...i.getStyle(),glyphs:p.glyphs,sprite:p.sprite}),i.once("style.load",()=>this.adjustVector(s));return}let v=p.layers?.filter(b=>b.type!=="custom"&&b.source==="LINZ Basemaps")??[];if(zt.map.layerId!=="topographic"){for(let b of v){if(b.type==="custom")continue;let M=b.paint??{};b.type==="symbol"?(M["icon-opacity"]=0,M["text-opacity"]=0):M[`${b.type}-opacity`]=0,b.paint=M}if(s===0){for(let b of v)i.getLayer(b.id)!=null&&i.removeLayer(b.id);return}if(i.getLayer(v[0].id)==null){if(s===0)return;for(let b of v)i.addLayer(b)}for(let b of v)i.getLayer(b.id)!=null&&(b.type==="symbol"?(i.setPaintProperty(b.id,"icon-opacity",s),i.setPaintProperty(b.id,"text-opacity",s)):i.setPaintProperty(b.id,`${b.type}-opacity`,s))}}adjustRaster(s,p){this.props.map.getSource(s)==null&&this.props.map.addSource(s,{type:"raster",tiles:[q3(s)],tileSize:256});let i=this.props.map.getLayer(s)==null;if(p===0){i||this.props.map.removeLayer(s);return}if(i){this.props.map.addLayer({id:s,type:"raster",source:s,minzoom:0,maxzoom:24,paint:{"raster-opacity":0}});let m=`${zt.map.layerId}_source_fill`;this.props.map.getLayer(m)!=null&&this.props.map.moveLayer(s,m)}this.props.map.setPaintProperty(s,"raster-opacity",p)}setPurple(s){zt.map.setDebug("debug.background",s?"magenta":!1),s?document.body.style.backgroundColor="magenta":document.body.style.backgroundColor=""}};function q3(r){if(r==="osm")return"https://tile.openstreetmap.org/{z}/{x}/{y}.png";if(r==="linz-aerial")return Xi.toTileUrl("raster",zt.map.tileMatrix,"aerial");throw new Error("Unknown tile server")}E();var o2=zr(Hd(),1);go();var Jd=class extends Ti{constructor(){super(...arguments);this._events=[];this._updateTimer=null;this.update=()=>{this._updateTimer==null&&(this._updateTimer=setTimeout(this.updateMap,1e3))};this.updateMap=()=>{this._updateTimer=null;let s=zt.map.transformedLocation,p=this.getStyleType(),i=`${p.layerId}::${p.style}`;if(this.currentStyle!==i){let v=dh(zt.map.tileMatrix.identifier).getStyle(p.layerId,p.style);this.currentStyle=i,this.map.setStyle(v)}this.map.setZoom(Math.max(s.zoom-4,0)),this.map.setCenter([s.lon,s.lat]),this.setState(this.state)};this.switchLayer=()=>{let s=this.getStyleType();zt.map.setLayerId(s.layerId,s.style),this.updateMap(),window.history.pushState(null,"",`?${xo.toUrl(zt.map)}`)}}componentDidMount(){if(zt.map.updateFromUrl(),this.el=document.getElementById("map-switcher-map"),this.el==null)return;let s=zt.map,p=dh(s.tileMatrix.identifier),i=this.getStyleType();this.currentStyle=`${i.layerId}::${i.style}`;let m=p.getStyle(i.layerId,i.style),v=s.transformedLocation;this.map=new o2.default.Map({container:this.el,style:m,center:[v.lon,v.lat],zoom:v.zoom,attributionControl:!1}),this.map.on("load",()=>{this._events.push(zt.map.on("location",this.update),zt.map.on("tileMatrix",this.update),zt.map.on("layer",this.update),zt.map.on("bounds",this.update)),this.updateMap()})}componentWillUnmount(){this.map&&this.map.remove();for(let s of this._events)s()}getStyleType(){return zt.map.layerId!=="aerial"?{layerId:"aerial"}:{layerId:"topographic",style:"topographic"}}render(){let s=`Switch map to ${this.getStyleType().layerId}`;return D("div",{id:"map-switcher",class:"map-switcher",onClick:this.switchLayer,title:s},D("div",{id:"map-switcher-map",style:{width:"100%",height:"100%",pointerEvents:"none"}}))}};var Qd=class extends Ti{constructor(){super(...arguments);this.ignoreNextLocationUpdate=!1;this.updateLocation=()=>{if(this.ignoreNextLocationUpdate){this.ignoreNextLocationUpdate=!1;return}let s=zt.map.location;this.map.setZoom(s.zoom),this.map.setCenter([s.lon,s.lat])};this.updateBounds=s=>{if(zt.map.tileMatrix!==Or){let p=Dh.default.LngLatBounds.convert(s),i=p.getNorthEast(),m=p.getSouthWest(),v=this.map.getZoom(),b=Ea({lat:i.lat,lon:i.lng,zoom:v},zt.map.tileMatrix,Or),M=Ea({lat:m.lat,lon:m.lng,zoom:v},zt.map.tileMatrix,Or);s=[[b.lon,b.lat],[M.lon,M.lat]]}this.map.fitBounds(s)};this.updateStyle=()=>{this.ensureGeoControl();let p=dh(zt.map.tileMatrix.identifier).getStyle(zt.map.layerId,zt.map.style);this.map.setStyle(p),zt.map.tileMatrix!==Or?this.map.setMaxBounds([-180,-85.06,180,85.06]):this.map.setMaxBounds(),this.setState(this.state)};this._events=[];this.updateUrlTimer=null;this.onRender=()=>{this.updateUrlTimer==null&&(this.updateUrlTimer=setTimeout(()=>this.setLocationUrl(),1e3))}}ensureGeoControl(){if(!zt.map.debug["debug.screenshot"])if(zt.map.tileMatrix===Or){if(this.controlGeo!=null)return;this.controlGeo=new Dh.default.GeolocateControl({}),this.map.addControl(this.controlGeo,"top-left")}else{if(this.controlGeo==null)return;this.map.removeControl(this.controlGeo)}}componentWillMount(){this.setState({isLayerSwitcherEnabled:!1})}componentDidMount(){if(zt.map.updateFromUrl(),this.el=document.getElementById("map"),this.el==null)throw new Error("Unable to find #map element");let s=zt.map,i=dh(s.tileMatrix.identifier).getStyle(s.layerId,s.style),m=Ea(s.location,s.tileMatrix,Or);if(this.map=new Dh.default.Map({container:this.el,style:i,center:[m.lon,m.lat],zoom:m.zoom,attributionControl:!1}),this.mapAttr=new Zd(this.map),zt.map.debug["debug.screenshot"]!==!0){let v=new Dh.default.NavigationControl({visualizePitch:!0});this.map.addControl(v,"top-left"),this.map.addControl(new Dh.default.FullscreenControl({container:this.el}))}this.map.on("render",this.onRender),this.map.on("load",()=>{this._events.push(zt.map.on("location",this.updateLocation),zt.map.on("tileMatrix",this.updateStyle),zt.map.on("layer",this.updateStyle),zt.map.on("bounds",this.updateBounds)),this.updateStyle()}),Ss.getClient().then(v=>{let b=v?.getTreatment("layer-switcher-button")==="on";this.setState({isLayerSwitcherEnabled:b})})}componentWillUnmount(){this.map&&this.map.remove();for(let s of this._events)s();this._events=[]}render(){let s=this.state.isLayerSwitcherEnabled&&zt.map.tileMatrix===Or&&!zt.map.isDebug;return D("div",{style:{flex:1,position:"relative"}},D("div",{id:"map",style:{width:"100%",height:"100%"}}),zt.map.isDebug?D(Yd,{map:this.map}):void 0,s?D(Jd,null):void 0)}setLocationUrl(){this.updateUrlTimer=null;let s=zt.map.getLocation(this.map);this.ignoreNextLocationUpdate=!0,zt.map.setLocation(s);let p=Xi.toHash(s);window.history.replaceState(null,"",p)}};E();var W3="data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA=";function K3(){let r=document.createElement("canvas");return r.getContext&&r.getContext("2d")?r.toDataURL("image/webp").indexOf("data:image/webp")===0:!1}function H3(){let r=new Image,n=new Promise(s=>{r.onload=()=>s(!0),r.onerror=()=>s(!1)});return r.src=W3,n}function a2(){return new Promise(r=>{if(K3())return r(!0);H3().then(r)})}var Pg=class extends Ti{render(){return D(K,null,D(Kd,null),D(Qd,null),D(ad,null))}};document.addEventListener("DOMContentLoaded",async()=>{await await a2()&&(Xi.ImageFormat="webp");let n=document.getElementById("main");if(n==null)throw new Error("Missing #main");y0(D(Pg,null),n)});
|
|
555
|
+
/*
|
|
556
|
+
object-assign
|
|
557
|
+
(c) Sindre Sorhus
|
|
558
|
+
@license MIT
|
|
559
|
+
*/
|
|
560
|
+
/*!
|
|
561
|
+
* +----------------------------------------------------------------------------------+
|
|
562
|
+
* | murmurHash3.js v3.0.0 (http://github.com/karanlyons/murmurHash3.js) |
|
|
563
|
+
* | A TypeScript/JavaScript implementation of MurmurHash3's hashing algorithms. |
|
|
564
|
+
* |----------------------------------------------------------------------------------|
|
|
565
|
+
* | Copyright (c) 2012-2020 Karan Lyons. Freely distributable under the MIT license. |
|
|
566
|
+
* +----------------------------------------------------------------------------------+
|
|
567
|
+
*/
|
|
568
|
+
/**
|
|
569
|
+
* splaytree v3.1.0
|
|
570
|
+
* Fast Splay tree for Node and browser
|
|
571
|
+
*
|
|
572
|
+
* @author Alexander Milevski <info@w8r.name>
|
|
573
|
+
* @license MIT
|
|
574
|
+
* @preserve
|
|
575
|
+
*/
|