@basemaps/landing 6.28.0 → 6.30.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.
Files changed (103) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/build/__tests__/config.debug.test.js +1 -0
  3. package/build/__tests__/config.debug.test.js.map +1 -0
  4. package/build/__tests__/config.test.js +1 -0
  5. package/build/__tests__/config.test.js.map +1 -0
  6. package/build/__tests__/geojson.test.js +1 -0
  7. package/build/__tests__/geojson.test.js.map +1 -0
  8. package/build/__tests__/map.config.test.js +10 -9
  9. package/build/__tests__/map.config.test.js.map +1 -0
  10. package/build/__tests__/tile.matrix.test.js +1 -0
  11. package/build/__tests__/tile.matrix.test.js.map +1 -0
  12. package/build/attribution.d.ts +4 -4
  13. package/build/attribution.d.ts.map +1 -1
  14. package/build/attribution.js +3 -1
  15. package/build/attribution.js.map +1 -0
  16. package/build/components/copyable.js +1 -0
  17. package/build/components/copyable.js.map +1 -0
  18. package/build/components/debug.d.ts +15 -10
  19. package/build/components/debug.d.ts.map +1 -1
  20. package/build/components/debug.js +57 -31
  21. package/build/components/debug.js.map +1 -0
  22. package/build/components/layer.switcher.dropdown.d.ts +0 -6
  23. package/build/components/layer.switcher.dropdown.d.ts.map +1 -1
  24. package/build/components/layer.switcher.dropdown.js +16 -24
  25. package/build/components/layer.switcher.dropdown.js.map +1 -0
  26. package/build/components/layout.footer.js +1 -0
  27. package/build/components/layout.footer.js.map +1 -0
  28. package/build/components/layout.header.d.ts.map +1 -1
  29. package/build/components/layout.header.js +2 -6
  30. package/build/components/layout.header.js.map +1 -0
  31. package/build/components/link.js +1 -0
  32. package/build/components/link.js.map +1 -0
  33. package/build/components/map.d.ts +8 -5
  34. package/build/components/map.d.ts.map +1 -1
  35. package/build/components/map.js +12 -10
  36. package/build/components/map.js.map +1 -0
  37. package/build/components/map.switcher.d.ts +1 -2
  38. package/build/components/map.switcher.d.ts.map +1 -1
  39. package/build/components/map.switcher.js +3 -1
  40. package/build/components/map.switcher.js.map +1 -0
  41. package/build/config.d.ts +0 -1
  42. package/build/config.d.ts.map +1 -1
  43. package/build/config.debug.d.ts +3 -1
  44. package/build/config.debug.d.ts.map +1 -1
  45. package/build/config.debug.js +3 -0
  46. package/build/config.debug.js.map +1 -0
  47. package/build/config.js +1 -4
  48. package/build/config.js.map +1 -0
  49. package/build/config.map.d.ts +3 -1
  50. package/build/config.map.d.ts.map +1 -1
  51. package/build/config.map.js +39 -6
  52. package/build/config.map.js.map +1 -0
  53. package/build/global.d.ts +1 -2
  54. package/build/global.d.ts.map +1 -1
  55. package/build/global.js +1 -0
  56. package/build/global.js.map +1 -0
  57. package/build/index.js +1 -0
  58. package/build/index.js.map +1 -0
  59. package/build/tile.matrix.d.ts +2 -2
  60. package/build/tile.matrix.d.ts.map +1 -1
  61. package/build/tile.matrix.js +1 -0
  62. package/build/tile.matrix.js.map +1 -0
  63. package/build/url.d.ts.map +1 -1
  64. package/build/url.js +3 -5
  65. package/build/url.js.map +1 -0
  66. package/build/webp.js +1 -0
  67. package/build/webp.js.map +1 -0
  68. package/dist/android-chrome-192x192.png +0 -0
  69. package/dist/android-chrome-512x512.png +0 -0
  70. package/dist/apple-touch-icon.png +0 -0
  71. package/dist/assets/fonts/OpenSans-Bold.woff2 +0 -0
  72. package/dist/assets/fonts/OpenSans-Italic.woff2 +0 -0
  73. package/dist/assets/fonts/OpenSans-Light.woff2 +0 -0
  74. package/dist/assets/fonts/OpenSans-Regular.woff2 +0 -0
  75. package/dist/assets/fonts/OpenSans-SemiBold.woff2 +0 -0
  76. package/dist/assets/logo-linz.svg +256 -0
  77. package/dist/assets/logo-nz-govt.svg +11 -0
  78. package/dist/basemaps-card.jpeg +0 -0
  79. package/dist/examples/index.html +33 -0
  80. package/dist/examples/index.leaflet.xyz.3857.html +43 -0
  81. package/dist/examples/index.maplibre.compare.3857.html +111 -0
  82. package/dist/examples/index.maplibre.opacity.3857.html +218 -0
  83. package/dist/examples/index.maplibre.vector.3857.html +48 -0
  84. package/dist/examples/index.openlayers.attribution.wmts.3857.html +55 -0
  85. package/dist/examples/index.openlayers.wmts.3857.html +49 -0
  86. package/dist/examples/index.openlayers.xyz.3857.html +49 -0
  87. package/dist/favicon-16x16.png +0 -0
  88. package/dist/favicon-32x32.png +0 -0
  89. package/dist/favicon.ico +0 -0
  90. package/dist/index-6.30.0-3328a19b1b63f913.js +28520 -0
  91. package/dist/index-6.30.0-467e63869a31f2e1.css +4317 -0
  92. package/dist/index-6.30.0-7bdec3e7d1c65337.js +567 -0
  93. package/dist/index.css +4317 -0
  94. package/dist/index.html +26 -0
  95. package/dist/index.js +567 -0
  96. package/dist/json-schema/stac-basemaps-extension/1.0/schema.json +144 -0
  97. package/dist/lib/attribution-6.30.0-431936fcac8e2647.js +2318 -0
  98. package/dist/lib/attribution-6.30.0-a5dcb359f35150b9.js +10 -0
  99. package/dist/lib/attribution.js +10 -0
  100. package/package.json +9 -11
  101. package/build/split.d.ts +0 -11
  102. package/build/split.d.ts.map +0 -1
  103. package/build/split.js +0 -45
@@ -0,0 +1,567 @@
1
+ var $y=Object.create;var Ed=Object.defineProperty;var Wy=Object.getOwnPropertyDescriptor;var Zy=Object.getOwnPropertyNames;var Hy=Object.getPrototypeOf,Xy=Object.prototype.hasOwnProperty;var Id=(s,l)=>()=>(s&&(l=s(s=0)),l);var Ls=(s,l)=>()=>(l||s((l={exports:{}}).exports,l),l.exports);var Ky=(s,l,u,y)=>{if(l&&typeof l=="object"||typeof l=="function")for(let _ of Zy(l))!Xy.call(s,_)&&_!==u&&Ed(s,_,{get:()=>l[_],enumerable:!(y=Wy(l,_))||y.enumerable});return s};var ua=(s,l,u)=>(u=s!=null?$y(Hy(s)):{},Ky(l||!s||!s.__esModule?Ed(u,"default",{value:s,enumerable:!0}):u,s));function Ds(s,l){for(var u in l)s[u]=l[u];return s}function Bd(s){var l=s.parentNode;l&&l.removeChild(s)}function K(s,l,u){var y,_,a,T={};for(a in l)a=="key"?y=l[a]:a=="ref"?_=l[a]:T[a]=l[a];if(arguments.length>2&&(T.children=arguments.length>3?Zh.call(arguments,2):u),typeof s=="function"&&s.defaultProps!=null)for(a in s.defaultProps)T[a]===void 0&&(T[a]=s.defaultProps[a]);return qh(s,T,y,_,null)}function qh(s,l,u,y,_){var a={type:s,props:l,key:u,ref:y,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:_??++Ld};return _==null&&Si.vnode!=null&&Si.vnode(a),a}function yt(s){return s.children}function Ti(s,l){this.props=s,this.context=l}function ho(s,l){if(l==null)return s.__?ho(s.__,s.__.__k.indexOf(s)+1):null;for(var u;l<s.__k.length;l++)if((u=s.__k[l])!=null&&u.__e!=null)return u.__e;return typeof s.type=="function"?ho(s):null}function Fd(s){var l,u;if((s=s.__)!=null&&s.__c!=null){for(s.__e=s.__c.base=null,l=0;l<s.__k.length;l++)if((u=s.__k[l])!=null&&u.__e!=null){s.__e=s.__c.base=u.__e;break}return Fd(s)}}function Ad(s){(!s.__d&&(s.__d=!0)&&Cl.push(s)&&!$h.__r++||Cd!==Si.debounceRendering)&&((Cd=Si.debounceRendering)||Dd)($h)}function $h(){for(var s;$h.__r=Cl.length;)s=Cl.sort(function(l,u){return l.__v.__b-u.__v.__b}),Cl=[],s.some(function(l){var u,y,_,a,T,E;l.__d&&(T=(a=(u=l).__v).__e,(E=u.__P)&&(y=[],(_=Ds({},a)).__v=a.__v+1,zu(E,a,_,u.__n,E.ownerSVGElement!==void 0,a.__h!=null?[T]:null,y,T??ho(a),a.__h),Vd(y,a),a.__e!=T&&Fd(a)))})}function Od(s,l,u,y,_,a,T,E,B,$){var L,it,pt,gt,_t,Ot,Lt,Nt=y&&y.__k||Rd,ue=Nt.length;for(u.__k=[],L=0;L<l.length;L++)if((gt=u.__k[L]=(gt=l[L])==null||typeof gt=="boolean"?null:typeof gt=="string"||typeof gt=="number"||typeof gt=="bigint"?qh(null,gt,null,null,gt):Array.isArray(gt)?qh(yt,{children:gt},null,null,null):gt.__b>0?qh(gt.type,gt.props,gt.key,null,gt.__v):gt)!=null){if(gt.__=u,gt.__b=u.__b+1,(pt=Nt[L])===null||pt&&gt.key==pt.key&&gt.type===pt.type)Nt[L]=void 0;else for(it=0;it<ue;it++){if((pt=Nt[it])&&gt.key==pt.key&&gt.type===pt.type){Nt[it]=void 0;break}pt=null}zu(s,gt,pt=pt||jh,_,a,T,E,B,$),_t=gt.__e,(it=gt.ref)&&pt.ref!=it&&(Lt||(Lt=[]),pt.ref&&Lt.push(pt.ref,null,gt),Lt.push(it,gt.__c||_t,gt)),_t!=null?(Ot==null&&(Ot=_t),typeof gt.type=="function"&&gt.__k===pt.__k?gt.__d=B=Nd(gt,B,s):B=Ud(s,gt,pt,Nt,_t,B),typeof u.type=="function"&&(u.__d=B)):B&&pt.__e==B&&B.parentNode!=s&&(B=ho(pt))}for(u.__e=Ot,L=ue;L--;)Nt[L]!=null&&(typeof u.type=="function"&&Nt[L].__e!=null&&Nt[L].__e==u.__d&&(u.__d=ho(y,L+1)),qd(Nt[L],Nt[L]));if(Lt)for(L=0;L<Lt.length;L++)Gd(Lt[L],Lt[++L],Lt[++L])}function Nd(s,l,u){for(var y,_=s.__k,a=0;_&&a<_.length;a++)(y=_[a])&&(y.__=s,l=typeof y.type=="function"?Nd(y,l,u):Ud(u,y,y,_,y.__e,l));return l}function Ud(s,l,u,y,_,a){var T,E,B;if(l.__d!==void 0)T=l.__d,l.__d=void 0;else if(u==null||_!=a||_.parentNode==null)t:if(a==null||a.parentNode!==s)s.appendChild(_),T=null;else{for(E=a,B=0;(E=E.nextSibling)&&B<y.length;B+=2)if(E==_)break t;s.insertBefore(_,a),T=a}return T!==void 0?T:_.nextSibling}function t0(s,l,u,y,_){var a;for(a in u)a==="children"||a==="key"||a in l||Wh(s,a,null,u[a],y);for(a in l)_&&typeof l[a]!="function"||a==="children"||a==="key"||a==="value"||a==="checked"||u[a]===l[a]||Wh(s,a,l[a],u[a],y)}function Pd(s,l,u){l[0]==="-"?s.setProperty(l,u):s[l]=u==null?"":typeof u!="number"||Qy.test(l)?u:u+"px"}function Wh(s,l,u,y,_){var a;t:if(l==="style")if(typeof u=="string")s.style.cssText=u;else{if(typeof y=="string"&&(s.style.cssText=y=""),y)for(l in y)u&&l in u||Pd(s.style,l,"");if(u)for(l in u)y&&u[l]===y[l]||Pd(s.style,l,u[l])}else if(l[0]==="o"&&l[1]==="n")a=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in s?l.toLowerCase().slice(2):l.slice(2),s.l||(s.l={}),s.l[l+a]=u,u?y||s.addEventListener(l,a?kd:zd,a):s.removeEventListener(l,a?kd:zd,a);else if(l!=="dangerouslySetInnerHTML"){if(_)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(l!=="href"&&l!=="list"&&l!=="form"&&l!=="tabIndex"&&l!=="download"&&l in s)try{s[l]=u??"";break t}catch{}typeof u=="function"||(u!=null&&(u!==!1||l[0]==="a"&&l[1]==="r")?s.setAttribute(l,u):s.removeAttribute(l))}}function zd(s){this.l[s.type+!1](Si.event?Si.event(s):s)}function kd(s){this.l[s.type+!0](Si.event?Si.event(s):s)}function zu(s,l,u,y,_,a,T,E,B){var $,L,it,pt,gt,_t,Ot,Lt,Nt,ue,oe,Ee,ve,me=l.type;if(l.constructor!==void 0)return null;u.__h!=null&&(B=u.__h,E=l.__e=u.__e,l.__h=null,a=[E]),($=Si.__b)&&$(l);try{t:if(typeof me=="function"){if(Lt=l.props,Nt=($=me.contextType)&&y[$.__c],ue=$?Nt?Nt.props.value:$.__:y,u.__c?Ot=(L=l.__c=u.__c).__=L.__E:("prototype"in me&&me.prototype.render?l.__c=L=new me(Lt,ue):(l.__c=L=new Ti(Lt,ue),L.constructor=me,L.render=i0),Nt&&Nt.sub(L),L.props=Lt,L.state||(L.state={}),L.context=ue,L.__n=y,it=L.__d=!0,L.__h=[]),L.__s==null&&(L.__s=L.state),me.getDerivedStateFromProps!=null&&(L.__s==L.state&&(L.__s=Ds({},L.__s)),Ds(L.__s,me.getDerivedStateFromProps(Lt,L.__s))),pt=L.props,gt=L.state,it)me.getDerivedStateFromProps==null&&L.componentWillMount!=null&&L.componentWillMount(),L.componentDidMount!=null&&L.__h.push(L.componentDidMount);else{if(me.getDerivedStateFromProps==null&&Lt!==pt&&L.componentWillReceiveProps!=null&&L.componentWillReceiveProps(Lt,ue),!L.__e&&L.shouldComponentUpdate!=null&&L.shouldComponentUpdate(Lt,L.__s,ue)===!1||l.__v===u.__v){L.props=Lt,L.state=L.__s,l.__v!==u.__v&&(L.__d=!1),L.__v=l,l.__e=u.__e,l.__k=u.__k,l.__k.forEach(function(Ge){Ge&&(Ge.__=l)}),L.__h.length&&T.push(L);break t}L.componentWillUpdate!=null&&L.componentWillUpdate(Lt,L.__s,ue),L.componentDidUpdate!=null&&L.__h.push(function(){L.componentDidUpdate(pt,gt,_t)})}if(L.context=ue,L.props=Lt,L.__v=l,L.__P=s,oe=Si.__r,Ee=0,"prototype"in me&&me.prototype.render)L.state=L.__s,L.__d=!1,oe&&oe(l),$=L.render(L.props,L.state,L.context);else do L.__d=!1,oe&&oe(l),$=L.render(L.props,L.state,L.context),L.state=L.__s;while(L.__d&&++Ee<25);L.state=L.__s,L.getChildContext!=null&&(y=Ds(Ds({},y),L.getChildContext())),it||L.getSnapshotBeforeUpdate==null||(_t=L.getSnapshotBeforeUpdate(pt,gt)),ve=$!=null&&$.type===yt&&$.key==null?$.props.children:$,Od(s,Array.isArray(ve)?ve:[ve],l,u,y,_,a,T,E,B),L.base=l.__e,l.__h=null,L.__h.length&&T.push(L),Ot&&(L.__E=L.__=null),L.__e=!1}else a==null&&l.__v===u.__v?(l.__k=u.__k,l.__e=u.__e):l.__e=e0(u.__e,l,u,y,_,a,T,B);($=Si.diffed)&&$(l)}catch(Ge){l.__v=null,(B||a!=null)&&(l.__e=E,l.__h=!!B,a[a.indexOf(E)]=null),Si.__e(Ge,l,u)}}function Vd(s,l){Si.__c&&Si.__c(l,s),s.some(function(u){try{s=u.__h,u.__h=[],s.some(function(y){y.call(u)})}catch(y){Si.__e(y,u.__v)}})}function e0(s,l,u,y,_,a,T,E){var B,$,L,it=u.props,pt=l.props,gt=l.type,_t=0;if(gt==="svg"&&(_=!0),a!=null){for(;_t<a.length;_t++)if((B=a[_t])&&"setAttribute"in B==!!gt&&(gt?B.localName===gt:B.nodeType===3)){s=B,a[_t]=null;break}}if(s==null){if(gt===null)return document.createTextNode(pt);s=_?document.createElementNS("http://www.w3.org/2000/svg",gt):document.createElement(gt,pt.is&&pt),a=null,E=!1}if(gt===null)it===pt||E&&s.data===pt||(s.data=pt);else{if(a=a&&Zh.call(s.childNodes),$=(it=u.props||jh).dangerouslySetInnerHTML,L=pt.dangerouslySetInnerHTML,!E){if(a!=null)for(it={},_t=0;_t<s.attributes.length;_t++)it[s.attributes[_t].name]=s.attributes[_t].value;(L||$)&&(L&&($&&L.__html==$.__html||L.__html===s.innerHTML)||(s.innerHTML=L&&L.__html||""))}if(t0(s,pt,it,_,E),L)l.__k=[];else if(_t=l.props.children,Od(s,Array.isArray(_t)?_t:[_t],l,u,y,_&&gt!=="foreignObject",a,T,a?a[0]:u.__k&&ho(u,0),E),a!=null)for(_t=a.length;_t--;)a[_t]!=null&&Bd(a[_t]);E||("value"in pt&&(_t=pt.value)!==void 0&&(_t!==s.value||gt==="progress"&&!_t||gt==="option"&&_t!==it.value)&&Wh(s,"value",_t,it.value,!1),"checked"in pt&&(_t=pt.checked)!==void 0&&_t!==s.checked&&Wh(s,"checked",_t,it.checked,!1))}return s}function Gd(s,l,u){try{typeof s=="function"?s(l):s.current=l}catch(y){Si.__e(y,u)}}function qd(s,l,u){var y,_;if(Si.unmount&&Si.unmount(s),(y=s.ref)&&(y.current&&y.current!==s.__e||Gd(y,null,l)),(y=s.__c)!=null){if(y.componentWillUnmount)try{y.componentWillUnmount()}catch(a){Si.__e(a,l)}y.base=y.__P=null}if(y=s.__k)for(_=0;_<y.length;_++)y[_]&&qd(y[_],l,typeof s.type!="function");u||s.__e==null||Bd(s.__e),s.__e=s.__d=void 0}function i0(s,l,u){return this.constructor(s,u)}function jd(s,l,u){var y,_,a;Si.__&&Si.__(s,l),_=(y=typeof u=="function")?null:u&&u.__k||l.__k,a=[],zu(l,s=(!y&&u||l).__k=K(yt,null,[s]),_||jh,jh,l.ownerSVGElement!==void 0,!y&&u?[u]:_?null:l.firstChild?Zh.call(l.childNodes):null,a,!y&&u?u:_?_.__e:l.firstChild,y),Vd(a,s)}var Zh,Si,Ld,Yy,Cl,Dd,Cd,Jy,jh,Rd,Qy,Xr=Id(()=>{H();jh={},Rd=[],Qy=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;Zh=Rd.slice,Si={__e:function(s,l,u,y){for(var _,a,T;l=l.__;)if((_=l.__c)&&!_.__)try{if((a=_.constructor)&&a.getDerivedStateFromError!=null&&(_.setState(a.getDerivedStateFromError(s)),T=_.__d),_.componentDidCatch!=null&&(_.componentDidCatch(s,y||{}),T=_.__d),T)return _.__E=_}catch(E){s=E}throw s}},Ld=0,Yy=function(s){return s!=null&&s.constructor===void 0},Ti.prototype.setState=function(s,l){var u;u=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Ds({},this.state),typeof s=="function"&&(s=s(Ds({},u),this.props)),s&&Ds(u,s),s!=null&&this.__v&&(l&&this.__h.push(l),Ad(this))},Ti.prototype.forceUpdate=function(s){this.__v&&(this.__e=!0,s&&this.__h.push(s),Ad(this))},Ti.prototype.render=yt,Cl=[],Dd=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,$h.__r=0,Jy=0});var H=Id(()=>{Xr()});var $d=Ls(()=>{H()});var Qd=Ls(Xh=>{"use strict";H();Object.defineProperty(Xh,"__esModule",{value:!0});Xh.Nztm2000Quad=void 0;Xh.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 tf=Ls(Kh=>{"use strict";H();Object.defineProperty(Kh,"__esModule",{value:!0});Kh.Nztm2000=void 0;Kh.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 ef=Ls(po=>{"use strict";H();Object.defineProperty(po,"__esModule",{value:!0});po.Nztm2000=po.Nztm2000Quad=void 0;var p0=Qd();Object.defineProperty(po,"Nztm2000Quad",{enumerable:!0,get:function(){return p0.Nztm2000Quad}});var d0=tf();Object.defineProperty(po,"Nztm2000",{enumerable:!0,get:function(){return d0.Nztm2000}})});var nf=Ls(ts=>{"use strict";H();Object.defineProperty(ts,"__esModule",{value:!0});ts.once=ts.Emitter=ts.ALL_EVENTS=void 0;ts.ALL_EVENTS=Symbol("ALL_EVENTS");function f0(s,l){return s.add(l),function(){return s.delete(l)}}function rf(s,...l){if(s)for(let{fn:u}of s)u(...l)}var Fu=class{constructor(){this.$=Object.create(null)}on(l,u){let y=this.$[l]=this.$[l]||new Set;return f0(y,{fn:u})}emit(l,...u){rf(this.$[l],...u),rf(this.$[ts.ALL_EVENTS],{type:l,args:u})}};ts.Emitter=Fu;function m0(s,l,u){let y=s.on(l,function(...a){return y(),u(...a)});return y}ts.once=m0});var af=Ls((tb,sf)=>{"use strict";H();sf.exports=Jh;Jh.polyline=Jh;Jh.polygon=y0;function Jh(s,l,u){var y=s.length,_=mo(s[0],l),a=[],T,E,B,$,L;for(u||(u=[]),T=1;T<y;T++){for(E=s[T-1],B=s[T],$=L=mo(B,l);;)if(_|$){if(_&$)break;_?(E=Nu(E,B,_,l),_=mo(E,l)):(B=Nu(E,B,$,l),$=mo(B,l))}else{a.push(E),$!==L?(a.push(B),T<y-1&&(u.push(a),a=[])):T===y-1&&a.push(B);break}_=L}return a.length&&u.push(a),u}function y0(s,l){var u,y,_,a,T,E,B;for(y=1;y<=8;y*=2){for(u=[],_=s[s.length-1],a=!(mo(_,l)&y),T=0;T<s.length;T++)E=s[T],B=!(mo(E,l)&y),B!==a&&u.push(Nu(_,E,y,l)),B&&u.push(E),_=E,a=B;if(s=u,!s.length)break}return u}function Nu(s,l,u,y){return u&8?[s[0]+(l[0]-s[0])*(y[3]-s[1])/(l[1]-s[1]),y[3]]:u&4?[s[0]+(l[0]-s[0])*(y[1]-s[1])/(l[1]-s[1]),y[1]]:u&2?[y[2],s[1]+(l[1]-s[1])*(y[2]-s[0])/(l[0]-s[0])]:u&1?[y[0],s[1]+(l[1]-s[1])*(y[0]-s[0])/(l[0]-s[0])]:null}function mo(s,l){var u=0;return s[0]<l[0]?u|=1:s[0]>l[2]&&(u|=2),s[1]<l[1]?u|=4:s[1]>l[3]&&(u|=8),u}});var of=Ls((Uu,Vu)=>{H();(function(s,l){typeof Uu=="object"&&typeof Vu<"u"?Vu.exports=l():typeof define=="function"&&define.amd?define(l):(s=typeof globalThis<"u"?globalThis:s||self,s.polygonClipping=l())})(Uu,function(){"use strict";function s(ft,N){if(!(ft instanceof N))throw new TypeError("Cannot call a class as a function")}function l(ft,N){for(var R=0;R<N.length;R++){var U=N[R];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(ft,U.key,U)}}function u(ft,N,R){return N&&l(ft.prototype,N),R&&l(ft,R),ft}var y=function(){function ft(N,R){this.next=null,this.key=N,this.data=R,this.left=null,this.right=null}return ft}();function _(ft,N){return ft>N?1:ft<N?-1:0}function a(ft,N,R){for(var U=new y(null,null),X=U,st=U;;){var xt=R(ft,N.key);if(xt<0){if(N.left===null)break;if(R(ft,N.left.key)<0){var Dt=N.left;if(N.left=Dt.right,Dt.right=N,N=Dt,N.left===null)break}st.left=N,st=N,N=N.left}else if(xt>0){if(N.right===null)break;if(R(ft,N.right.key)>0){var Dt=N.right;if(N.right=Dt.left,Dt.left=N,N=Dt,N.right===null)break}X.right=N,X=N,N=N.right}else break}return X.right=N.left,st.left=N.right,N.left=U.right,N.right=U.left,N}function T(ft,N,R,U){var X=new y(ft,N);if(R===null)return X.left=X.right=null,X;R=a(ft,R,U);var st=U(ft,R.key);return st<0?(X.left=R.left,X.right=R,R.left=null):st>=0&&(X.right=R.right,X.left=R,R.right=null),X}function E(ft,N,R){var U=null,X=null;if(N){N=a(ft,N,R);var st=R(N.key,ft);st===0?(U=N.left,X=N.right):st<0?(X=N.right,N.right=null,U=N):(U=N.left,N.left=null,X=N)}return{left:U,right:X}}function B(ft,N,R){return N===null?ft:(ft===null||(N=a(ft.key,N,R),N.left=ft),N)}function $(ft,N,R,U,X){if(ft){U(""+N+(R?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+X(ft)+`
2
+ `);var st=N+(R?" ":"\u2502 ");ft.left&&$(ft.left,st,!1,U,X),ft.right&&$(ft.right,st,!0,U,X)}}var L=function(){function ft(N){N===void 0&&(N=_),this._root=null,this._size=0,this._comparator=N}return ft.prototype.insert=function(N,R){return this._size++,this._root=T(N,R,this._root,this._comparator)},ft.prototype.add=function(N,R){var U=new y(N,R);this._root===null&&(U.left=U.right=null,this._size++,this._root=U);var X=this._comparator,st=a(N,this._root,X),xt=X(N,st.key);return xt===0?this._root=st:(xt<0?(U.left=st.left,U.right=st,st.left=null):xt>0&&(U.right=st.right,U.left=st,st.right=null),this._size++,this._root=U),this._root},ft.prototype.remove=function(N){this._root=this._remove(N,this._root,this._comparator)},ft.prototype._remove=function(N,R,U){var X;if(R===null)return null;R=a(N,R,U);var st=U(N,R.key);return st===0?(R.left===null?X=R.right:(X=a(N,R.left,U),X.right=R.right),this._size--,X):R},ft.prototype.pop=function(){var N=this._root;if(N){for(;N.left;)N=N.left;return this._root=a(N.key,this._root,this._comparator),this._root=this._remove(N.key,this._root,this._comparator),{key:N.key,data:N.data}}return null},ft.prototype.findStatic=function(N){for(var R=this._root,U=this._comparator;R;){var X=U(N,R.key);if(X===0)return R;X<0?R=R.left:R=R.right}return null},ft.prototype.find=function(N){return this._root&&(this._root=a(N,this._root,this._comparator),this._comparator(N,this._root.key)!==0)?null:this._root},ft.prototype.contains=function(N){for(var R=this._root,U=this._comparator;R;){var X=U(N,R.key);if(X===0)return!0;X<0?R=R.left:R=R.right}return!1},ft.prototype.forEach=function(N,R){for(var U=this._root,X=[],st=!1;!st;)U!==null?(X.push(U),U=U.left):X.length!==0?(U=X.pop(),N.call(R,U),U=U.right):st=!0;return this},ft.prototype.range=function(N,R,U,X){for(var st=[],xt=this._comparator,Dt=this._root,Ut;st.length!==0||Dt;)if(Dt)st.push(Dt),Dt=Dt.left;else{if(Dt=st.pop(),Ut=xt(Dt.key,R),Ut>0)break;if(xt(Dt.key,N)>=0&&U.call(X,Dt))return this;Dt=Dt.right}return this},ft.prototype.keys=function(){var N=[];return this.forEach(function(R){var U=R.key;return N.push(U)}),N},ft.prototype.values=function(){var N=[];return this.forEach(function(R){var U=R.data;return N.push(U)}),N},ft.prototype.min=function(){return this._root?this.minNode(this._root).key:null},ft.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},ft.prototype.minNode=function(N){if(N===void 0&&(N=this._root),N)for(;N.left;)N=N.left;return N},ft.prototype.maxNode=function(N){if(N===void 0&&(N=this._root),N)for(;N.right;)N=N.right;return N},ft.prototype.at=function(N){for(var R=this._root,U=!1,X=0,st=[];!U;)if(R)st.push(R),R=R.left;else if(st.length>0){if(R=st.pop(),X===N)return R;X++,R=R.right}else U=!0;return null},ft.prototype.next=function(N){var R=this._root,U=null;if(N.right){for(U=N.right;U.left;)U=U.left;return U}for(var X=this._comparator;R;){var st=X(N.key,R.key);if(st===0)break;st<0?(U=R,R=R.left):R=R.right}return U},ft.prototype.prev=function(N){var R=this._root,U=null;if(N.left!==null){for(U=N.left;U.right;)U=U.right;return U}for(var X=this._comparator;R;){var st=X(N.key,R.key);if(st===0)break;st<0?R=R.left:(U=R,R=R.right)}return U},ft.prototype.clear=function(){return this._root=null,this._size=0,this},ft.prototype.toList=function(){return gt(this._root)},ft.prototype.load=function(N,R,U){R===void 0&&(R=[]),U===void 0&&(U=!1);var X=N.length,st=this._comparator;if(U&&Lt(N,R,0,X-1,st),this._root===null)this._root=it(N,R,0,X),this._size=X;else{var xt=Ot(this.toList(),pt(N,R),st);X=this._size+X,this._root=_t({head:xt},0,X)}return this},ft.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(ft.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(ft.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),ft.prototype.toString=function(N){N===void 0&&(N=function(X){return String(X.key)});var R=[];return $(this._root,"",!0,function(U){return R.push(U)},N),R.join("")},ft.prototype.update=function(N,R,U){var X=this._comparator,st=E(N,this._root,X),xt=st.left,Dt=st.right;X(N,R)<0?Dt=T(R,U,Dt,X):xt=T(R,U,xt,X),this._root=B(xt,Dt,X)},ft.prototype.split=function(N){return E(N,this._root,this._comparator)},ft}();function it(ft,N,R,U){var X=U-R;if(X>0){var st=R+Math.floor(X/2),xt=ft[st],Dt=N[st],Ut=new y(xt,Dt);return Ut.left=it(ft,N,R,st),Ut.right=it(ft,N,st+1,U),Ut}return null}function pt(ft,N){for(var R=new y(null,null),U=R,X=0;X<ft.length;X++)U=U.next=new y(ft[X],N[X]);return U.next=null,R.next}function gt(ft){for(var N=ft,R=[],U=!1,X=new y(null,null),st=X;!U;)N?(R.push(N),N=N.left):R.length>0?(N=st=st.next=R.pop(),N=N.right):U=!0;return st.next=null,X.next}function _t(ft,N,R){var U=R-N;if(U>0){var X=N+Math.floor(U/2),st=_t(ft,N,X),xt=ft.head;return xt.left=st,ft.head=ft.head.next,xt.right=_t(ft,X+1,R),xt}return null}function Ot(ft,N,R){for(var U=new y(null,null),X=U,st=ft,xt=N;st!==null&&xt!==null;)R(st.key,xt.key)<0?(X.next=st,st=st.next):(X.next=xt,xt=xt.next),X=X.next;return st!==null?X.next=st:xt!==null&&(X.next=xt),U.next}function Lt(ft,N,R,U,X){if(!(R>=U)){for(var st=ft[R+U>>1],xt=R-1,Dt=U+1;;){do xt++;while(X(ft[xt],st)<0);do Dt--;while(X(ft[Dt],st)>0);if(xt>=Dt)break;var Ut=ft[xt];ft[xt]=ft[Dt],ft[Dt]=Ut,Ut=N[xt],N[xt]=N[Dt],N[Dt]=Ut}Lt(ft,N,R,Dt,X),Lt(ft,N,Dt+1,U,X)}}var Nt=function(N,R){return N.ll.x<=R.x&&R.x<=N.ur.x&&N.ll.y<=R.y&&R.y<=N.ur.y},ue=function(N,R){if(R.ur.x<N.ll.x||N.ur.x<R.ll.x||R.ur.y<N.ll.y||N.ur.y<R.ll.y)return null;var U=N.ll.x<R.ll.x?R.ll.x:N.ll.x,X=N.ur.x<R.ur.x?N.ur.x:R.ur.x,st=N.ll.y<R.ll.y?R.ll.y:N.ll.y,xt=N.ur.y<R.ur.y?N.ur.y:R.ur.y;return{ll:{x:U,y:st},ur:{x:X,y:xt}}},oe=Number.EPSILON;oe===void 0&&(oe=Math.pow(2,-52));var Ee=oe*oe,ve=function(N,R){if(-oe<N&&N<oe&&-oe<R&&R<oe)return 0;var U=N-R;return U*U<Ee*N*R?0:N<R?-1:1},me=function(){function ft(){s(this,ft),this.reset()}return u(ft,[{key:"reset",value:function(){this.xRounder=new Ge,this.yRounder=new Ge}},{key:"round",value:function(R,U){return{x:this.xRounder.round(R),y:this.yRounder.round(U)}}}]),ft}(),Ge=function(){function ft(){s(this,ft),this.tree=new L,this.round(0)}return u(ft,[{key:"round",value:function(R){var U=this.tree.add(R),X=this.tree.prev(U);if(X!==null&&ve(U.key,X.key)===0)return this.tree.remove(R),X.key;var st=this.tree.next(U);return st!==null&&ve(U.key,st.key)===0?(this.tree.remove(R),st.key):R}}]),ft}(),Ne=new me,di=function(N,R){return N.x*R.y-N.y*R.x},Ri=function(N,R){return N.x*R.x+N.y*R.y},Yi=function(N,R,U){var X={x:R.x-N.x,y:R.y-N.y},st={x:U.x-N.x,y:U.y-N.y},xt=di(X,st);return ve(xt,0)},Bi=function(N){return Math.sqrt(Ri(N,N))},Vr=function(N,R,U){var X={x:R.x-N.x,y:R.y-N.y},st={x:U.x-N.x,y:U.y-N.y};return di(st,X)/Bi(st)/Bi(X)},ye=function(N,R,U){var X={x:R.x-N.x,y:R.y-N.y},st={x:U.x-N.x,y:U.y-N.y};return Ri(st,X)/Bi(st)/Bi(X)},Pr=function(N,R,U){return R.y===0?null:{x:N.x+R.x/R.y*(U-N.y),y:U}},Gr=function(N,R,U){return R.x===0?null:{x:U,y:N.y+R.y/R.x*(U-N.x)}},Qr=function(N,R,U,X){if(R.x===0)return Gr(U,X,N.x);if(X.x===0)return Gr(N,R,U.x);if(R.y===0)return Pr(U,X,N.y);if(X.y===0)return Pr(N,R,U.y);var st=di(R,X);if(st==0)return null;var xt={x:U.x-N.x,y:U.y-N.y},Dt=di(xt,R)/st,Ut=di(xt,X)/st,ct=N.x+Ut*R.x,Ct=U.x+Dt*X.x,Se=N.y+Ut*R.y,Ie=U.y+Dt*X.y,ae=(ct+Ct)/2,Oe=(Se+Ie)/2;return{x:ae,y:Oe}},_i=function(){u(ft,null,[{key:"compare",value:function(R,U){var X=ft.comparePoints(R.point,U.point);return X!==0?X:(R.point!==U.point&&R.link(U),R.isLeft!==U.isLeft?R.isLeft?1:-1:zr.compare(R.segment,U.segment))}},{key:"comparePoints",value:function(R,U){return R.x<U.x?-1:R.x>U.x?1:R.y<U.y?-1:R.y>U.y?1:0}}]);function ft(N,R){s(this,ft),N.events===void 0?N.events=[this]:N.events.push(this),this.point=N,this.isLeft=R}return u(ft,[{key:"link",value:function(R){if(R.point===this.point)throw new Error("Tried to link already linked events");for(var U=R.point.events,X=0,st=U.length;X<st;X++){var xt=U[X];this.point.events.push(xt),xt.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var R=this.point.events.length,U=0;U<R;U++){var X=this.point.events[U];if(X.segment.consumedBy===void 0)for(var st=U+1;st<R;st++){var xt=this.point.events[st];xt.consumedBy===void 0&&X.otherSE.point.events===xt.otherSE.point.events&&X.segment.consume(xt.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var R=[],U=0,X=this.point.events.length;U<X;U++){var st=this.point.events[U];st!==this&&!st.segment.ringOut&&st.segment.isInResult()&&R.push(st)}return R}},{key:"getLeftmostComparator",value:function(R){var U=this,X=new Map,st=function(Dt){var Ut=Dt.otherSE;X.set(Dt,{sine:Vr(U.point,R.point,Ut.point),cosine:ye(U.point,R.point,Ut.point)})};return function(xt,Dt){X.has(xt)||st(xt),X.has(Dt)||st(Dt);var Ut=X.get(xt),ct=Ut.sine,Ct=Ut.cosine,Se=X.get(Dt),Ie=Se.sine,ae=Se.cosine;return ct>=0&&Ie>=0?Ct<ae?1:Ct>ae?-1:0:ct<0&&Ie<0?Ct<ae?-1:Ct>ae?1:0:Ie<ct?-1:Ie>ct?1:0}}}]),ft}(),dn=0,zr=function(){u(ft,null,[{key:"compare",value:function(R,U){var X=R.leftSE.point.x,st=U.leftSE.point.x,xt=R.rightSE.point.x,Dt=U.rightSE.point.x;if(Dt<X)return 1;if(xt<st)return-1;var Ut=R.leftSE.point.y,ct=U.leftSE.point.y,Ct=R.rightSE.point.y,Se=U.rightSE.point.y;if(X<st){if(ct<Ut&&ct<Ct)return 1;if(ct>Ut&&ct>Ct)return-1;var Ie=R.comparePoint(U.leftSE.point);if(Ie<0)return 1;if(Ie>0)return-1;var ae=U.comparePoint(R.rightSE.point);return ae!==0?ae:-1}if(X>st){if(Ut<ct&&Ut<Se)return-1;if(Ut>ct&&Ut>Se)return 1;var Oe=U.comparePoint(R.leftSE.point);if(Oe!==0)return Oe;var Ce=R.comparePoint(U.rightSE.point);return Ce<0?1:Ce>0?-1:1}if(Ut<ct)return-1;if(Ut>ct)return 1;if(xt<Dt){var Qe=U.comparePoint(R.rightSE.point);if(Qe!==0)return Qe}if(xt>Dt){var Pe=R.comparePoint(U.rightSE.point);if(Pe<0)return 1;if(Pe>0)return-1}if(xt!==Dt){var Vt=Ct-Ut,ge=xt-X,he=Se-ct,ai=Dt-st;if(Vt>ge&&he<ai)return 1;if(Vt<ge&&he>ai)return-1}return xt>Dt?1:xt<Dt||Ct<Se?-1:Ct>Se?1:R.id<U.id?-1:R.id>U.id?1:0}}]);function ft(N,R,U,X){s(this,ft),this.id=++dn,this.leftSE=N,N.segment=this,N.otherSE=R,this.rightSE=R,R.segment=this,R.otherSE=N,this.rings=U,this.windings=X}return u(ft,[{key:"replaceRightSE",value:function(R){this.rightSE=R,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var R=this.leftSE.point.y,U=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:R<U?R:U},ur:{x:this.rightSE.point.x,y:R>U?R:U}}}},{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(R){return R.x===this.leftSE.point.x&&R.y===this.leftSE.point.y||R.x===this.rightSE.point.x&&R.y===this.rightSE.point.y}},{key:"comparePoint",value:function(R){if(this.isAnEndpoint(R))return 0;var U=this.leftSE.point,X=this.rightSE.point,st=this.vector();if(U.x===X.x)return R.x===U.x?0:R.x<U.x?1:-1;var xt=(R.y-U.y)/st.y,Dt=U.x+xt*st.x;if(R.x===Dt)return 0;var Ut=(R.x-U.x)/st.x,ct=U.y+Ut*st.y;return R.y===ct?0:R.y<ct?-1:1}},{key:"getIntersection",value:function(R){var U=this.bbox(),X=R.bbox(),st=ue(U,X);if(st===null)return null;var xt=this.leftSE.point,Dt=this.rightSE.point,Ut=R.leftSE.point,ct=R.rightSE.point,Ct=Nt(U,Ut)&&this.comparePoint(Ut)===0,Se=Nt(X,xt)&&R.comparePoint(xt)===0,Ie=Nt(U,ct)&&this.comparePoint(ct)===0,ae=Nt(X,Dt)&&R.comparePoint(Dt)===0;if(Se&&Ct)return ae&&!Ie?Dt:!ae&&Ie?ct:null;if(Se)return Ie&&xt.x===ct.x&&xt.y===ct.y?null:xt;if(Ct)return ae&&Dt.x===Ut.x&&Dt.y===Ut.y?null:Ut;if(ae&&Ie)return null;if(ae)return Dt;if(Ie)return ct;var Oe=Qr(xt,this.vector(),Ut,R.vector());return Oe===null||!Nt(st,Oe)?null:Ne.round(Oe.x,Oe.y)}},{key:"split",value:function(R){var U=[],X=R.events!==void 0,st=new _i(R,!0),xt=new _i(R,!1),Dt=this.rightSE;this.replaceRightSE(xt),U.push(xt),U.push(st);var Ut=new ft(st,Dt,this.rings.slice(),this.windings.slice());return _i.comparePoints(Ut.leftSE.point,Ut.rightSE.point)>0&&Ut.swapEvents(),_i.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),X&&(st.checkForConsuming(),xt.checkForConsuming()),U}},{key:"swapEvents",value:function(){var R=this.rightSE;this.rightSE=this.leftSE,this.leftSE=R,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var U=0,X=this.windings.length;U<X;U++)this.windings[U]*=-1}},{key:"consume",value:function(R){for(var U=this,X=R;U.consumedBy;)U=U.consumedBy;for(;X.consumedBy;)X=X.consumedBy;var st=ft.compare(U,X);if(st!==0){if(st>0){var xt=U;U=X,X=xt}if(U.prev===X){var Dt=U;U=X,X=Dt}for(var Ut=0,ct=X.rings.length;Ut<ct;Ut++){var Ct=X.rings[Ut],Se=X.windings[Ut],Ie=U.rings.indexOf(Ct);Ie===-1?(U.rings.push(Ct),U.windings.push(Se)):U.windings[Ie]+=Se}X.rings=null,X.windings=null,X.consumedBy=U,X.leftSE.consumedBy=U.leftSE,X.rightSE.consumedBy=U.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 R=this.prev.consumedBy||this.prev;this._beforeState=R.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var R=this.beforeState();this._afterState={rings:R.rings.slice(0),windings:R.windings.slice(0),multiPolys:[]};for(var U=this._afterState.rings,X=this._afterState.windings,st=this._afterState.multiPolys,xt=0,Dt=this.rings.length;xt<Dt;xt++){var Ut=this.rings[xt],ct=this.windings[xt],Ct=U.indexOf(Ut);Ct===-1?(U.push(Ut),X.push(ct)):X[Ct]+=ct}for(var Se=[],Ie=[],ae=0,Oe=U.length;ae<Oe;ae++)if(X[ae]!==0){var Ce=U[ae],Qe=Ce.poly;if(Ie.indexOf(Qe)===-1)if(Ce.isExterior)Se.push(Qe);else{Ie.indexOf(Qe)===-1&&Ie.push(Qe);var Pe=Se.indexOf(Ce.poly);Pe!==-1&&Se.splice(Pe,1)}}for(var Vt=0,ge=Se.length;Vt<ge;Vt++){var he=Se[Vt].multiPoly;st.indexOf(he)===-1&&st.push(he)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var R=this.beforeState().multiPolys,U=this.afterState().multiPolys;switch(Je.type){case"union":{var X=R.length===0,st=U.length===0;this._isInResult=X!==st;break}case"intersection":{var xt,Dt;R.length<U.length?(xt=R.length,Dt=U.length):(xt=U.length,Dt=R.length),this._isInResult=Dt===Je.numMultiPolys&&xt<Dt;break}case"xor":{var Ut=Math.abs(R.length-U.length);this._isInResult=Ut%2===1;break}case"difference":{var ct=function(Se){return Se.length===1&&Se[0].isSubject};this._isInResult=ct(R)!==ct(U);break}default:throw new Error("Unrecognized operation type found ".concat(Je.type))}return this._isInResult}}],[{key:"fromRing",value:function(R,U,X){var st,xt,Dt,Ut=_i.comparePoints(R,U);if(Ut<0)st=R,xt=U,Dt=1;else if(Ut>0)st=U,xt=R,Dt=-1;else throw new Error("Tried to create degenerate segment at [".concat(R.x,", ").concat(R.y,"]"));var ct=new _i(st,!0),Ct=new _i(xt,!1);return new ft(ct,Ct,[X],[Dt])}}]),ft}(),kr=function(){function ft(N,R,U){if(s(this,ft),!Array.isArray(N)||N.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=R,this.isExterior=U,this.segments=[],typeof N[0][0]!="number"||typeof N[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var X=Ne.round(N[0][0],N[0][1]);this.bbox={ll:{x:X.x,y:X.y},ur:{x:X.x,y:X.y}};for(var st=X,xt=1,Dt=N.length;xt<Dt;xt++){if(typeof N[xt][0]!="number"||typeof N[xt][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var Ut=Ne.round(N[xt][0],N[xt][1]);Ut.x===st.x&&Ut.y===st.y||(this.segments.push(zr.fromRing(st,Ut,this)),Ut.x<this.bbox.ll.x&&(this.bbox.ll.x=Ut.x),Ut.y<this.bbox.ll.y&&(this.bbox.ll.y=Ut.y),Ut.x>this.bbox.ur.x&&(this.bbox.ur.x=Ut.x),Ut.y>this.bbox.ur.y&&(this.bbox.ur.y=Ut.y),st=Ut)}(X.x!==st.x||X.y!==st.y)&&this.segments.push(zr.fromRing(st,X,this))}return u(ft,[{key:"getSweepEvents",value:function(){for(var R=[],U=0,X=this.segments.length;U<X;U++){var st=this.segments[U];R.push(st.leftSE),R.push(st.rightSE)}return R}}]),ft}(),tn=function(){function ft(N,R){if(s(this,ft),!Array.isArray(N))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new kr(N[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 U=1,X=N.length;U<X;U++){var st=new kr(N[U],this,!1);st.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=st.bbox.ll.x),st.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=st.bbox.ll.y),st.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=st.bbox.ur.x),st.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=st.bbox.ur.y),this.interiorRings.push(st)}this.multiPoly=R}return u(ft,[{key:"getSweepEvents",value:function(){for(var R=this.exteriorRing.getSweepEvents(),U=0,X=this.interiorRings.length;U<X;U++)for(var st=this.interiorRings[U].getSweepEvents(),xt=0,Dt=st.length;xt<Dt;xt++)R.push(st[xt]);return R}}]),ft}(),en=function(){function ft(N,R){if(s(this,ft),!Array.isArray(N))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof N[0][0][0]=="number"&&(N=[N])}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 U=0,X=N.length;U<X;U++){var st=new tn(N[U],this);st.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=st.bbox.ll.x),st.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=st.bbox.ll.y),st.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=st.bbox.ur.x),st.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=st.bbox.ur.y),this.polys.push(st)}this.isSubject=R}return u(ft,[{key:"getSweepEvents",value:function(){for(var R=[],U=0,X=this.polys.length;U<X;U++)for(var st=this.polys[U].getSweepEvents(),xt=0,Dt=st.length;xt<Dt;xt++)R.push(st[xt]);return R}}]),ft}(),gr=function(){u(ft,null,[{key:"factory",value:function(R){for(var U=[],X=0,st=R.length;X<st;X++){var xt=R[X];if(!(!xt.isInResult()||xt.ringOut)){for(var Dt=null,Ut=xt.leftSE,ct=xt.rightSE,Ct=[Ut],Se=Ut.point,Ie=[];Dt=Ut,Ut=ct,Ct.push(Ut),Ut.point!==Se;)for(;;){var ae=Ut.getAvailableLinkedEvents();if(ae.length===0){var Oe=Ct[0].point,Ce=Ct[Ct.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(Oe.x,",")+" ".concat(Oe.y,"]. Last matching segment found ends at")+" [".concat(Ce.x,", ").concat(Ce.y,"]."))}if(ae.length===1){ct=ae[0].otherSE;break}for(var Qe=null,Pe=0,Vt=Ie.length;Pe<Vt;Pe++)if(Ie[Pe].point===Ut.point){Qe=Pe;break}if(Qe!==null){var ge=Ie.splice(Qe)[0],he=Ct.splice(ge.index);he.unshift(he[0].otherSE),U.push(new ft(he.reverse()));continue}Ie.push({index:Ct.length,point:Ut.point});var ai=Ut.getLeftmostComparator(Dt);ct=ae.sort(ai)[0].otherSE;break}U.push(new ft(Ct))}}return U}}]);function ft(N){s(this,ft),this.events=N;for(var R=0,U=N.length;R<U;R++)N[R].segment.ringOut=this;this.poly=null}return u(ft,[{key:"getGeom",value:function(){for(var R=this.events[0].point,U=[R],X=1,st=this.events.length-1;X<st;X++){var xt=this.events[X].point,Dt=this.events[X+1].point;Yi(xt,R,Dt)!==0&&(U.push(xt),R=xt)}if(U.length===1)return null;var Ut=U[0],ct=U[1];Yi(Ut,R,ct)===0&&U.shift(),U.push(U[0]);for(var Ct=this.isExteriorRing()?1:-1,Se=this.isExteriorRing()?0:U.length-1,Ie=this.isExteriorRing()?U.length:-1,ae=[],Oe=Se;Oe!=Ie;Oe+=Ct)ae.push([U[Oe].x,U[Oe].y]);return ae}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var R=this.enclosingRing();this._isExteriorRing=R?!R.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 R=this.events[0],U=1,X=this.events.length;U<X;U++){var st=this.events[U];_i.compare(R,st)>0&&(R=st)}for(var xt=R.segment.prevInResult(),Dt=xt?xt.prevInResult():null;;){if(!xt)return null;if(!Dt)return xt.ringOut;if(Dt.ringOut!==xt.ringOut)return Dt.ringOut.enclosingRing()!==xt.ringOut?xt.ringOut:xt.ringOut.enclosingRing();xt=Dt.prevInResult(),Dt=xt?xt.prevInResult():null}}}]),ft}(),Lr=function(){function ft(N){s(this,ft),this.exteriorRing=N,N.poly=this,this.interiorRings=[]}return u(ft,[{key:"addInterior",value:function(R){this.interiorRings.push(R),R.poly=this}},{key:"getGeom",value:function(){var R=[this.exteriorRing.getGeom()];if(R[0]===null)return null;for(var U=0,X=this.interiorRings.length;U<X;U++){var st=this.interiorRings[U].getGeom();st!==null&&R.push(st)}return R}}]),ft}(),qr=function(){function ft(N){s(this,ft),this.rings=N,this.polys=this._composePolys(N)}return u(ft,[{key:"getGeom",value:function(){for(var R=[],U=0,X=this.polys.length;U<X;U++){var st=this.polys[U].getGeom();st!==null&&R.push(st)}return R}},{key:"_composePolys",value:function(R){for(var U=[],X=0,st=R.length;X<st;X++){var xt=R[X];if(!xt.poly)if(xt.isExteriorRing())U.push(new Lr(xt));else{var Dt=xt.enclosingRing();Dt.poly||U.push(new Lr(Dt)),Dt.poly.addInterior(xt)}}return U}}]),ft}(),Sn=function(){function ft(N){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zr.compare;s(this,ft),this.queue=N,this.tree=new L(R),this.segments=[]}return u(ft,[{key:"process",value:function(R){var U=R.segment,X=[];if(R.consumedBy)return R.isLeft?this.queue.remove(R.otherSE):this.tree.remove(U),X;var st=R.isLeft?this.tree.insert(U):this.tree.find(U);if(!st)throw new Error("Unable to find segment #".concat(U.id," ")+"[".concat(U.leftSE.point.x,", ").concat(U.leftSE.point.y,"] -> ")+"[".concat(U.rightSE.point.x,", ").concat(U.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var xt=st,Dt=st,Ut=void 0,ct=void 0;Ut===void 0;)xt=this.tree.prev(xt),xt===null?Ut=null:xt.key.consumedBy===void 0&&(Ut=xt.key);for(;ct===void 0;)Dt=this.tree.next(Dt),Dt===null?ct=null:Dt.key.consumedBy===void 0&&(ct=Dt.key);if(R.isLeft){var Ct=null;if(Ut){var Se=Ut.getIntersection(U);if(Se!==null&&(U.isAnEndpoint(Se)||(Ct=Se),!Ut.isAnEndpoint(Se)))for(var Ie=this._splitSafely(Ut,Se),ae=0,Oe=Ie.length;ae<Oe;ae++)X.push(Ie[ae])}var Ce=null;if(ct){var Qe=ct.getIntersection(U);if(Qe!==null&&(U.isAnEndpoint(Qe)||(Ce=Qe),!ct.isAnEndpoint(Qe)))for(var Pe=this._splitSafely(ct,Qe),Vt=0,ge=Pe.length;Vt<ge;Vt++)X.push(Pe[Vt])}if(Ct!==null||Ce!==null){var he=null;if(Ct===null)he=Ce;else if(Ce===null)he=Ct;else{var ai=_i.comparePoints(Ct,Ce);he=ai<=0?Ct:Ce}this.queue.remove(U.rightSE),X.push(U.rightSE);for(var $i=U.split(he),_e=0,ir=$i.length;_e<ir;_e++)X.push($i[_e])}X.length>0?(this.tree.remove(U),X.push(R)):(this.segments.push(U),U.prev=Ut)}else{if(Ut&&ct){var mi=Ut.getIntersection(ct);if(mi!==null){if(!Ut.isAnEndpoint(mi))for(var rr=this._splitSafely(Ut,mi),ri=0,Ze=rr.length;ri<Ze;ri++)X.push(rr[ri]);if(!ct.isAnEndpoint(mi))for(var Vi=this._splitSafely(ct,mi),yr=0,gi=Vi.length;yr<gi;yr++)X.push(Vi[yr])}}this.tree.remove(U)}return X}},{key:"_splitSafely",value:function(R,U){this.tree.remove(R);var X=R.rightSE;this.queue.remove(X);var st=R.split(U);return st.push(X),R.consumedBy===void 0&&this.tree.insert(R),st}}]),ft}(),Ln=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Dn=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,cs=function(){function ft(){s(this,ft)}return u(ft,[{key:"run",value:function(R,U,X){Je.type=R,Ne.reset();for(var st=[new en(U,!0)],xt=0,Dt=X.length;xt<Dt;xt++)st.push(new en(X[xt],!1));if(Je.numMultiPolys=st.length,Je.type==="difference")for(var Ut=st[0],ct=1;ct<st.length;)ue(st[ct].bbox,Ut.bbox)!==null?ct++:st.splice(ct,1);if(Je.type==="intersection"){for(var Ct=0,Se=st.length;Ct<Se;Ct++)for(var Ie=st[Ct],ae=Ct+1,Oe=st.length;ae<Oe;ae++)if(ue(Ie.bbox,st[ae].bbox)===null)return[]}for(var Ce=new L(_i.compare),Qe=0,Pe=st.length;Qe<Pe;Qe++)for(var Vt=st[Qe].getSweepEvents(),ge=0,he=Vt.length;ge<he;ge++)if(Ce.insert(Vt[ge]),Ce.size>Ln)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var ai=new Sn(Ce),$i=Ce.size,_e=Ce.pop();_e;){var ir=_e.key;if(Ce.size===$i){var mi=ir.segment;throw new Error("Unable to pop() ".concat(ir.isLeft?"left":"right"," SweepEvent ")+"[".concat(ir.point.x,", ").concat(ir.point.y,"] from segment #").concat(mi.id," ")+"[".concat(mi.leftSE.point.x,", ").concat(mi.leftSE.point.y,"] -> ")+"[".concat(mi.rightSE.point.x,", ").concat(mi.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(Ce.size>Ln)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(ai.segments.length>Dn)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var rr=ai.process(ir),ri=0,Ze=rr.length;ri<Ze;ri++){var Vi=rr[ri];Vi.consumedBy===void 0&&Ce.insert(Vi)}$i=Ce.size,_e=Ce.pop()}Ne.reset();var yr=gr.factory(ai.segments),gi=new qr(yr);return gi.getGeom()}}]),ft}(),Je=new cs,rn=function(N){for(var R=arguments.length,U=new Array(R>1?R-1:0),X=1;X<R;X++)U[X-1]=arguments[X];return Je.run("union",N,U)},Rn=function(N){for(var R=arguments.length,U=new Array(R>1?R-1:0),X=1;X<R;X++)U[X-1]=arguments[X];return Je.run("intersection",N,U)},fn=function(N){for(var R=arguments.length,U=new Array(R>1?R-1:0),X=1;X<R;X++)U[X-1]=arguments[X];return Je.run("xor",N,U)},Dr=function(N){for(var R=arguments.length,U=new Array(R>1?R-1:0),X=1;X<R;X++)U[X-1]=arguments[X];return Je.run("difference",N,U)},us={union:rn,intersection:Rn,xor:fn,difference:Dr};return us})});var vc=Ls((ip,rp)=>{H();(function(s,l){typeof ip=="object"&&typeof rp<"u"?rp.exports=l():typeof define=="function"&&define.amd?define(l):(s=typeof globalThis<"u"?globalThis:s||self,s.maplibregl=l())})(ip,function(){"use strict";var s,l,u;function y(a,T){if(!s)s=T;else if(!l)l=T;else{var E="var sharedChunk = {}; ("+s+")(sharedChunk); ("+l+")(sharedChunk);",B={};s(B),u=T(B),typeof window<"u"&&(u.workerUrl=window.URL.createObjectURL(new Blob([E],{type:"text/javascript"})))}}y(["exports"],function(a){"use strict";var T=E;function E(i,t,r,o){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(o-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=t,this.p2x=r,this.p2y=o}function B(i,t,r,o){let c=new T(i,t,r,o);return function(f){return c.solve(f)}}E.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,t){if(t===void 0&&(t=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,o=0;o<8;o++){var c=this.sampleCurveX(r)-i;if(Math.abs(c)<t)return r;var f=this.sampleCurveDerivativeX(r);if(Math.abs(f)<1e-6)break;r-=c/f}var m=0,x=1;for(r=i,o=0;o<20&&(c=this.sampleCurveX(r),!(Math.abs(c-i)<t));o++)i>c?m=r:x=r,r=.5*(x-m)+m;return r},solve:function(i,t){return this.sampleCurveY(this.solveCurveX(i,t))}};let $=B(.25,.1,.25,1);function L(i,t,r){return Math.min(r,Math.max(t,i))}function it(i,t,r){let o=r-t,c=((i-t)%o+o)%o+t;return c===t?r:c}function pt(i,...t){for(let r of t)for(let o in r)i[o]=r[o];return i}let gt=1;function _t(i,t){i.forEach(r=>{t[r]&&(t[r]=t[r].bind(t))})}function Ot(i,t,r){let o={};for(let c in i)o[c]=t.call(r||this,i[c],c,i);return o}function Lt(i,t,r){let o={};for(let c in i)t.call(r||this,i[c],c,i)&&(o[c]=i[c]);return o}function Nt(i){return Array.isArray(i)?i.map(Nt):typeof i=="object"&&i?Ot(i,Nt):i}let ue={};function oe(i){ue[i]||(typeof console<"u"&&console.warn(i),ue[i]=!0)}function Ee(i,t,r){return(r.y-i.y)*(t.x-i.x)>(t.y-i.y)*(r.x-i.x)}function ve(i){let t=0;for(let r,o,c=0,f=i.length,m=f-1;c<f;m=c++)r=i[c],o=i[m],t+=(o.x-r.x)*(r.y+o.y);return t}function me(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Ge(i){let t={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,o,c,f)=>{let m=c||f;return t[o]=!m||m.toLowerCase(),""}),t["max-age"]){let r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t}let Ne,di,Ri=null;function Yi(i){if(Ri==null){let t=i.navigator?i.navigator.userAgent:null;Ri=!!i.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Ri}function Bi(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}let Vr={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){let t=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(i,t=0){let r=window.document.createElement("canvas"),o=r.getContext("2d");if(!o)throw new Error("failed to create canvas 2d context");return r.width=i.width,r.height=i.height,o.drawImage(i,0,0,i.width,i.height),o.getImageData(-t,-t,i.width+2*t,i.height+2*t)},resolveURL:i=>(Ne||(Ne=document.createElement("a")),Ne.href=i,Ne.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(di==null&&(di=matchMedia("(prefers-reduced-motion: reduce)")),di.matches)}};var ye=Pr;function Pr(i,t){this.x=i,this.y=t}Pr.prototype={clone:function(){return new Pr(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,t){return this.clone()._rotateAround(i,t)},matMult:function(i){return this.clone()._matMult(i)},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(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var t=i.x-this.x,r=i.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,t){return Math.atan2(this.x*t-this.y*i,this.x*i+this.y*t)},_matMult:function(i){var t=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=t,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var t=Math.cos(i),r=Math.sin(i),o=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=o,this},_rotateAround:function(i,t){var r=Math.cos(i),o=Math.sin(i),c=t.y+o*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-o*(this.y-t.y),this.y=c,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Pr.convert=function(i){return i instanceof Pr?i:Array.isArray(i)?new Pr(i[0],i[1]):i};let Gr={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},Qr="mapbox-tiles",_i,dn,zr=500,kr=50;function tn(){typeof caches>"u"||_i||(_i=caches.open(Qr))}let en=1/0,gr={supported:!1,testSupport:function(i){!Sn&&qr&&(Ln?Dn(i):Lr=i)}},Lr,qr,Sn=!1,Ln=!1;function Dn(i){let t=i.createTexture();i.bindTexture(i.TEXTURE_2D,t);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,qr),i.isContextLost())return;gr.supported=!0}catch{}i.deleteTexture(t),Sn=!0}typeof document<"u"&&(qr=document.createElement("img"),qr.onload=function(){Lr&&Dn(Lr),Lr=null,Ln=!0},qr.onerror=function(){Sn=!0,Lr=null},qr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");let cs={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(cs);class Je extends Error{constructor(t,r,o,c){super(`AJAXError: ${r} (${t}): ${o}`),this.status=t,this.statusText=r,this.url=o,this.body=c}}let rn=me()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function Rn(i,t){let r=new AbortController,o=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:rn(),signal:r.signal}),c=!1,f=!1;return i.type==="json"&&o.headers.set("Accept","application/json"),((m,x,b)=>{if(f)return;let S=Date.now();fetch(o).then(A=>A.ok?((z,D,O)=>{(i.type==="arrayBuffer"?z.arrayBuffer():i.type==="json"?z.json():z.text()).then(V=>{f||(D&&O&&function(tt,et,dt){if(tn(),!_i)return;let bt={status:et.status,statusText:et.statusText,headers:new Headers};et.headers.forEach((Et,Rt)=>bt.headers.set(Rt,Et));let vt=Ge(et.headers.get("Cache-Control")||"");vt["no-store"]||(vt["max-age"]&&bt.headers.set("Expires",new Date(dt+1e3*vt["max-age"]).toUTCString()),new Date(bt.headers.get("Expires")).getTime()-dt<42e4||function(Et,Rt){if(dn===void 0)try{new Response(new ReadableStream),dn=!0}catch{dn=!1}dn?Rt(Et.body):Et.blob().then(Rt)}(et,Et=>{let Rt=new Response(Et,bt);tn(),_i&&_i.then(Pt=>Pt.put(function(ee){let le=ee.indexOf("?");return le<0?ee:ee.slice(0,le)}(tt.url),Rt)).catch(Pt=>oe(Pt.message))}))}(o,D,O),c=!0,t(null,V,z.headers.get("Cache-Control"),z.headers.get("Expires")))}).catch(V=>{f||t(new Error(V.message))})})(A,null,S):A.blob().then(z=>t(new Je(A.status,A.statusText,i.url,z)))).catch(A=>{A.code!==20&&t(new Error(A.message))})})(),{cancel:()=>{f=!0,c||r.abort()}}}let fn=function(i,t){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(me()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,t);if(!me()){let o=i.url.substring(0,i.url.indexOf("://"));return(Gr.REGISTERED_PROTOCOLS[o]||Rn)(i,t)}}if(!(/^file:/.test(r=i.url)||/^file:/.test(rn())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Rn(i,t);if(me()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,t,void 0,!0)}var r;return function(o,c){let f=new XMLHttpRequest;f.open(o.method||"GET",o.url,!0),o.type==="arrayBuffer"&&(f.responseType="arraybuffer");for(let m in o.headers)f.setRequestHeader(m,o.headers[m]);return o.type==="json"&&(f.responseType="text",f.setRequestHeader("Accept","application/json")),f.withCredentials=o.credentials==="include",f.onerror=()=>{c(new Error(f.statusText))},f.onload=()=>{if((f.status>=200&&f.status<300||f.status===0)&&f.response!==null){let m=f.response;if(o.type==="json")try{m=JSON.parse(f.response)}catch(x){return c(x)}c(null,m,f.getResponseHeader("Cache-Control"),f.getResponseHeader("Expires"))}else{let m=new Blob([f.response],{type:f.getResponseHeader("Content-Type")});c(new Je(f.status,f.statusText,o.url,m))}},f.send(o.body),{cancel:()=>f.abort()}}(i,t)},Dr=function(i,t){return fn(pt(i,{type:"arrayBuffer"}),t)};function us(i){let t=window.document.createElement("a");return t.href=i,t.protocol===window.document.location.protocol&&t.host===window.document.location.host}let ft="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",N,R;N=[],R=0;let U=function(i,t){if(gr.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),R>=Gr.MAX_PARALLEL_IMAGE_REQUESTS){let f={requestParameters:i,callback:t,cancelled:!1,cancel(){this.cancelled=!0}};return N.push(f),f}R++;let r=!1,o=()=>{if(!r)for(r=!0,R--;N.length&&R<Gr.MAX_PARALLEL_IMAGE_REQUESTS;){let f=N.shift(),{requestParameters:m,callback:x,cancelled:b}=f;b||(f.cancel=U(m,x).cancel)}},c=Dr(i,(f,m,x,b)=>{o(),f?t(f):m&&function(S,A){typeof createImageBitmap=="function"?function(z,D){let O=new Blob([new Uint8Array(z)],{type:"image/png"});createImageBitmap(O).then(V=>{D(null,V)}).catch(V=>{D(new Error(`Could not load image because of ${V.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(S,A):function(z,D){let O=new Image;O.onload=()=>{D(null,O),URL.revokeObjectURL(O.src),O.onload=null,window.requestAnimationFrame(()=>{O.src=ft})},O.onerror=()=>D(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."));let V=new Blob([new Uint8Array(z)],{type:"image/png"});O.src=z.byteLength?URL.createObjectURL(V):ft}(S,A)}(m,(S,A)=>{S!=null?t(S):A!=null&&t(null,A,{cacheControl:x,expires:b})})});return{cancel:()=>{c.cancel(),o()}}};function X(i,t,r){r[i]&&r[i].indexOf(t)!==-1||(r[i]=r[i]||[],r[i].push(t))}function st(i,t,r){if(r&&r[i]){let o=r[i].indexOf(t);o!==-1&&r[i].splice(o,1)}}class xt{constructor(t,r={}){pt(this,r),this.type=t}}class Dt extends xt{constructor(t,r={}){super("error",pt({error:t},r))}}class Ut{on(t,r){return this._listeners=this._listeners||{},X(t,r,this._listeners),this}off(t,r){return st(t,r,this._listeners),st(t,r,this._oneTimeListeners),this}once(t,r){return this._oneTimeListeners=this._oneTimeListeners||{},X(t,r,this._oneTimeListeners),this}fire(t,r){typeof t=="string"&&(t=new xt(t,r||{}));let o=t.type;if(this.listens(o)){t.target=this;let c=this._listeners&&this._listeners[o]?this._listeners[o].slice():[];for(let x of c)x.call(this,t);let f=this._oneTimeListeners&&this._oneTimeListeners[o]?this._oneTimeListeners[o].slice():[];for(let x of f)st(o,x,this._oneTimeListeners),x.call(this,t);let m=this._eventedParent;m&&(pt(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),m.fire(t))}else t instanceof Dt&&console.error(t.error);return this}listens(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)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var ct={$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",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},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:{},"viewport-glyph":{},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",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},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"}}};class Ct{constructor(t,r,o,c){this.message=(t?`${t}: `:"")+o,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function Se(i){let t=i.value;return t?[new Ct(i.key,t,"constants have been deprecated as of v8")]:[]}function Ie(i,...t){for(let r of t)for(let o in r)i[o]=r[o];return i}function ae(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Oe(i){if(Array.isArray(i))return i.map(Oe);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){let t={};for(let r in i)t[r]=Oe(i[r]);return t}return ae(i)}class Ce extends Error{constructor(t,r){super(r),this.message=r,this.key=t}}class Qe{constructor(t,r=[]){this.parent=t,this.bindings={};for(let[o,c]of r)this.bindings[o]=c}concat(t){return new Qe(this,t)}get(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.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}let Pe={kind:"null"},Vt={kind:"number"},ge={kind:"string"},he={kind:"boolean"},ai={kind:"color"},$i={kind:"object"},_e={kind:"value"},ir={kind:"collator"},mi={kind:"formatted"},rr={kind:"resolvedImage"};function ri(i,t){return{kind:"array",itemType:i,N:t}}function Ze(i){if(i.kind==="array"){let t=Ze(i.itemType);return typeof i.N=="number"?`array<${t}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${t}>`}return i.kind}let Vi=[Pe,Vt,ge,he,ai,mi,$i,ri(_e),rr];function yr(i,t){if(t.kind==="error")return null;if(i.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!yr(i.itemType,t.itemType))&&(typeof i.N!="number"||i.N===t.N))return null}else{if(i.kind===t.kind)return null;if(i.kind==="value"){for(let r of Vi)if(!yr(r,t))return null}}return`Expected ${Ze(i)} but found ${Ze(t)} instead.`}function gi(i,t){return t.some(r=>r.kind===i.kind)}function jr(i,t){return t.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}var $r,Vs={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 ps(i){return(i=Math.round(i))<0?0:i>255?255:i}function ds(i){return ps(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function W(i){return(t=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:t>1?1:t;var t}function I(i,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?i+(t-i)*r*6:2*r<1?t:3*r<2?i+(t-i)*(2/3-r)*6:i}try{$r={}.parseCSSColor=function(i){var t,r=i.replace(/ /g,"").toLowerCase();if(r in Vs)return Vs[r].slice();if(r[0]==="#")return r.length===4?(t=parseInt(r.substr(1),16))>=0&&t<=4095?[(3840&t)>>4|(3840&t)>>8,240&t|(240&t)>>4,15&t|(15&t)<<4,1]:null:r.length===7&&(t=parseInt(r.substr(1),16))>=0&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var o=r.indexOf("("),c=r.indexOf(")");if(o!==-1&&c+1===r.length){var f=r.substr(0,o),m=r.substr(o+1,c-(o+1)).split(","),x=1;switch(f){case"rgba":if(m.length!==4)return null;x=W(m.pop());case"rgb":return m.length!==3?null:[ds(m[0]),ds(m[1]),ds(m[2]),x];case"hsla":if(m.length!==4)return null;x=W(m.pop());case"hsl":if(m.length!==3)return null;var b=(parseFloat(m[0])%360+360)%360/360,S=W(m[1]),A=W(m[2]),z=A<=.5?A*(S+1):A+S-A*S,D=2*A-z;return[ps(255*I(D,z,b+1/3)),ps(255*I(D,z,b)),ps(255*I(D,z,b-1/3)),x];default:return null}}return null}}catch{}class P{constructor(t,r,o,c=1){this.r=t,this.g=r,this.b=o,this.a=c}static parse(t){if(!t)return;if(t instanceof P)return t;if(typeof t!="string")return;let r=$r(t);return r?new P(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){let[t,r,o,c]=this.toArray();return`rgba(${Math.round(t)},${Math.round(r)},${Math.round(o)},${c})`}toArray(){let{r:t,g:r,b:o,a:c}=this;return c===0?[0,0,0,0]:[255*t/c,255*r/c,255*o/c,c]}}P.black=new P(0,0,0,1),P.white=new P(1,1,1,1),P.transparent=new P(0,0,0,0),P.red=new P(1,0,0,1);class G{constructor(t,r,o){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=o,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Z{constructor(t,r,o,c,f){this.text=t,this.image=r,this.scale=o,this.fontStack=c,this.textColor=f}}class Y{constructor(t){this.sections=t}static fromString(t){return new Y([new Z(t,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof Y?t:Y.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}serialize(){let t=["format"];for(let r of this.sections){if(r.image){t.push(["image",r.image.name]);continue}t.push(r.text);let o={};r.fontStack&&(o["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(o["font-scale"]=r.scale),r.textColor&&(o["text-color"]=["rgba"].concat(r.textColor.toArray())),t.push(o)}return t}}class at{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new at({name:t,available:!1}):null}serialize(){return["image",this.name]}}function rt(i,t,r,o){return typeof i=="number"&&i>=0&&i<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?o===void 0||typeof o=="number"&&o>=0&&o<=1?null:`Invalid rgba value [${[i,t,r,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[i,t,r,o]:[i,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function nt(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof P||i instanceof G||i instanceof Y||i instanceof at)return!0;if(Array.isArray(i)){for(let t of i)if(!nt(t))return!1;return!0}if(typeof i=="object"){for(let t in i)if(!nt(i[t]))return!1;return!0}return!1}function ot(i){if(i===null)return Pe;if(typeof i=="string")return ge;if(typeof i=="boolean")return he;if(typeof i=="number")return Vt;if(i instanceof P)return ai;if(i instanceof G)return ir;if(i instanceof Y)return mi;if(i instanceof at)return rr;if(Array.isArray(i)){let t=i.length,r;for(let o of i){let c=ot(o);if(r){if(r===c)continue;r=_e;break}r=c}return ri(r||_e,t)}return $i}function St(i){let t=typeof i;return i===null?"":t==="string"||t==="number"||t==="boolean"?String(i):i instanceof P||i instanceof Y||i instanceof at?i.toString():JSON.stringify(i)}class kt{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!nt(t[1]))return r.error("invalid value");let o=t[1],c=ot(o),f=r.expectedType;return c.kind!=="array"||c.N!==0||!f||f.kind!=="array"||typeof f.N=="number"&&f.N!==0||(c=f),new kt(c,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof P?["rgba"].concat(this.value.toArray()):this.value instanceof Y?this.value.serialize():this.value}}class wt{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}let re={string:ge,number:Vt,boolean:he,object:$i};class Jt{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let o,c=1,f=t[0];if(f==="array"){let x,b;if(t.length>2){let S=t[1];if(typeof S!="string"||!(S in re)||S==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);x=re[S],c++}else x=_e;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);b=t[2],c++}o=ri(x,b)}else o=re[f];let m=[];for(;c<t.length;c++){let x=r.parse(t[c],c,_e);if(!x)return null;m.push(x)}return new Jt(o,m)}evaluate(t){for(let r=0;r<this.args.length;r++){let o=this.args[r].evaluate(t);if(!yr(this.type,ot(o)))return o;if(r===this.args.length-1)throw new wt(`Expected value to be of type ${Ze(this.type)}, but found ${Ze(ot(o))} instead.`)}return null}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}serialize(){let t=this.type,r=[t.kind];if(t.kind==="array"){let o=t.itemType;if(o.kind==="string"||o.kind==="number"||o.kind==="boolean"){r.push(o.kind);let c=t.N;(typeof c=="number"||this.args.length>1)&&r.push(c)}}return r.concat(this.args.map(o=>o.serialize()))}}class se{constructor(t){this.type=mi,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let o=t[1];if(!Array.isArray(o)&&typeof o=="object")return r.error("First argument must be an image or text section.");let c=[],f=!1;for(let m=1;m<=t.length-1;++m){let x=t[m];if(f&&typeof x=="object"&&!Array.isArray(x)){f=!1;let b=null;if(x["font-scale"]&&(b=r.parse(x["font-scale"],1,Vt),!b))return null;let S=null;if(x["text-font"]&&(S=r.parse(x["text-font"],1,ri(ge)),!S))return null;let A=null;if(x["text-color"]&&(A=r.parse(x["text-color"],1,ai),!A))return null;let z=c[c.length-1];z.scale=b,z.font=S,z.textColor=A}else{let b=r.parse(t[m],1,_e);if(!b)return null;let S=b.type.kind;if(S!=="string"&&S!=="value"&&S!=="null"&&S!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");f=!0,c.push({content:b,scale:null,font:null,textColor:null})}}return new se(c)}evaluate(t){return new Y(this.sections.map(r=>{let o=r.content.evaluate(t);return ot(o)===rr?new Z("",o,null,null,null):new Z(St(o),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null)}))}eachChild(t){for(let r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor)}outputDefined(){return!1}serialize(){let t=["format"];for(let r of this.sections){t.push(r.content.serialize());let o={};r.scale&&(o["font-scale"]=r.scale.serialize()),r.font&&(o["text-font"]=r.font.serialize()),r.textColor&&(o["text-color"]=r.textColor.serialize()),t.push(o)}return t}}class pe{constructor(t){this.type=rr,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");let o=r.parse(t[1],1,ge);return o?new pe(o):r.error("No image name provided.")}evaluate(t){let r=this.input.evaluate(t),o=at.fromString(r);return o&&t.availableImages&&(o.available=t.availableImages.indexOf(r)>-1),o}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}let Ue={"to-boolean":he,"to-color":ai,"to-number":Vt,"to-string":ge};class De{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let o=t[0];if((o==="to-boolean"||o==="to-string")&&t.length!==2)return r.error("Expected one argument.");let c=Ue[o],f=[];for(let m=1;m<t.length;m++){let x=r.parse(t[m],m,_e);if(!x)return null;f.push(x)}return new De(c,f)}evaluate(t){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(t));if(this.type.kind==="color"){let r,o;for(let c of this.args){if(r=c.evaluate(t),o=null,r instanceof P)return r;if(typeof r=="string"){let f=t.parseColor(r);if(f)return f}else if(Array.isArray(r)&&(o=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:rt(r[0],r[1],r[2],r[3]),!o))return new P(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new wt(o||`Could not parse color from value '${typeof r=="string"?r:String(JSON.stringify(r))}'`)}if(this.type.kind==="number"){let r=null;for(let o of this.args){if(r=o.evaluate(t),r===null)return 0;let c=Number(r);if(!isNaN(c))return c}throw new wt(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?Y.fromString(St(this.args[0].evaluate(t))):this.type.kind==="resolvedImage"?at.fromString(St(this.args[0].evaluate(t))):St(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}serialize(){if(this.type.kind==="formatted")return new se([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new pe(this.args[0]).serialize();let t=[`to-${this.type.kind}`];return this.eachChild(r=>{t.push(r.serialize())}),t}}let ze=["Unknown","Point","LineString","Polygon"];class Te{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?ze[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let r=this._parseColorCache[t];return r||(r=this._parseColorCache[t]=P.parse(t)),r}}class Me{constructor(t,r,o,c){this.name=t,this.type=r,this._evaluate=o,this.args=c}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(t=>t.serialize()))}static parse(t,r){let o=t[0],c=Me.definitions[o];if(!c)return r.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);let f=Array.isArray(c)?c[0]:c.type,m=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,x=m.filter(([S])=>!Array.isArray(S)||S.length===t.length-1),b=null;for(let[S,A]of x){b=new Ta(r.registry,r.path,null,r.scope);let z=[],D=!1;for(let O=1;O<t.length;O++){let V=t[O],tt=Array.isArray(S)?S[O-1]:S.type,et=b.parse(V,1+z.length,tt);if(!et){D=!0;break}z.push(et)}if(!D)if(Array.isArray(S)&&S.length!==z.length)b.error(`Expected ${S.length} arguments, but found ${z.length} instead.`);else{for(let O=0;O<z.length;O++){let V=Array.isArray(S)?S[O]:S.type,tt=z[O];b.concat(O+1).checkSubtype(V,tt.type)}if(b.errors.length===0)return new Me(o,f,A,z)}}if(x.length===1)r.errors.push(...b.errors);else{let S=(x.length?x:m).map(([z])=>{return D=z,Array.isArray(D)?`(${D.map(Ze).join(", ")})`:`(${Ze(D.type)}...)`;var D}).join(" | "),A=[];for(let z=1;z<t.length;z++){let D=r.parse(t[z],1+A.length);if(!D)return null;A.push(Ze(D.type))}r.error(`Expected arguments of type ${S}, but found (${A.join(", ")}) instead.`)}return null}static register(t,r){Me.definitions=r;for(let o in r)t[o]=Me}}class wi{constructor(t,r,o){this.type=ir,this.locale=o,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");let o=t[1];if(typeof o!="object"||Array.isArray(o))return r.error("Collator options argument must be an object.");let c=r.parse(o["case-sensitive"]!==void 0&&o["case-sensitive"],1,he);if(!c)return null;let f=r.parse(o["diacritic-sensitive"]!==void 0&&o["diacritic-sensitive"],1,he);if(!f)return null;let m=null;return o.locale&&(m=r.parse(o.locale,1,ge),!m)?null:new wi(c,f,m)}evaluate(t){return new G(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}serialize(){let t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]}}let xi=8192;function Gi(i,t){i[0]=Math.min(i[0],t[0]),i[1]=Math.min(i[1],t[1]),i[2]=Math.max(i[2],t[0]),i[3]=Math.max(i[3],t[1])}function Wi(i,t){return!(i[0]<=t[0]||i[2]>=t[2]||i[1]<=t[1]||i[3]>=t[3])}function Io(i,t){let r=(180+i[0])/360,o=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,c=Math.pow(2,t.z);return[Math.round(r*c*xi),Math.round(o*c*xi)]}function Co(i,t,r){let o=i[0]-t[0],c=i[1]-t[1],f=i[0]-r[0],m=i[1]-r[1];return o*m-f*c==0&&o*f<=0&&c*m<=0}function ni(i,t){let r=!1;for(let m=0,x=t.length;m<x;m++){let b=t[m];for(let S=0,A=b.length;S<A-1;S++){if(Co(i,b[S],b[S+1]))return!1;(c=b[S])[1]>(o=i)[1]!=(f=b[S+1])[1]>o[1]&&o[0]<(f[0]-c[0])*(o[1]-c[1])/(f[1]-c[1])+c[0]&&(r=!r)}}var o,c,f;return r}function Ec(i,t){for(let r=0;r<t.length;r++)if(ni(i,t[r]))return!0;return!1}function Ao(i,t,r,o){let c=o[0]-r[0],f=o[1]-r[1],m=(i[0]-r[0])*f-c*(i[1]-r[1]),x=(t[0]-r[0])*f-c*(t[1]-r[1]);return m>0&&x<0||m<0&&x>0}function Ic(i,t,r){for(let S of r)for(let A=0;A<S.length-1;++A)if((x=[(m=S[A+1])[0]-(f=S[A])[0],m[1]-f[1]])[0]*(b=[(c=t)[0]-(o=i)[0],c[1]-o[1]])[1]-x[1]*b[0]!=0&&Ao(o,c,f,m)&&Ao(f,m,o,c))return!0;var o,c,f,m,x,b;return!1}function Po(i,t){for(let r=0;r<i.length;++r)if(!ni(i[r],t))return!1;for(let r=0;r<i.length-1;++r)if(Ic(i[r],i[r+1],t))return!1;return!0}function ql(i,t){for(let r=0;r<t.length;r++)if(Po(i,t[r]))return!0;return!1}function zo(i,t,r){let o=[];for(let c=0;c<i.length;c++){let f=[];for(let m=0;m<i[c].length;m++){let x=Io(i[c][m],r);Gi(t,x),f.push(x)}o.push(f)}return o}function ko(i,t,r){let o=[];for(let c=0;c<i.length;c++){let f=zo(i[c],t,r);o.push(f)}return o}function Lo(i,t,r,o){if(i[0]<r[0]||i[0]>r[2]){let c=.5*o,f=i[0]-r[0]>c?-o:r[0]-i[0]>c?o:0;f===0&&(f=i[0]-r[2]>c?-o:r[2]-i[0]>c?o:0),i[0]+=f}Gi(t,i)}function jl(i,t,r,o){let c=Math.pow(2,o.z)*xi,f=[o.x*xi,o.y*xi],m=[];for(let x of i)for(let b of x){let S=[b.x+f[0],b.y+f[1]];Lo(S,t,r,c),m.push(S)}return m}function $l(i,t,r,o){let c=Math.pow(2,o.z)*xi,f=[o.x*xi,o.y*xi],m=[];for(let b of i){let S=[];for(let A of b){let z=[A.x+f[0],A.y+f[1]];Gi(t,z),S.push(z)}m.push(S)}if(t[2]-t[0]<=c/2){(x=t)[0]=x[1]=1/0,x[2]=x[3]=-1/0;for(let b of m)for(let S of b)Lo(S,t,r,c)}var x;return m}class Bn{constructor(t,r){this.type=he,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(nt(t[1])){let o=t[1];if(o.type==="FeatureCollection")for(let c=0;c<o.features.length;++c){let f=o.features[c].geometry.type;if(f==="Polygon"||f==="MultiPolygon")return new Bn(o,o.features[c].geometry)}else if(o.type==="Feature"){let c=o.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new Bn(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new Bn(o,o)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,o){let c=[1/0,1/0,-1/0,-1/0],f=[1/0,1/0,-1/0,-1/0],m=r.canonicalID();if(o.type==="Polygon"){let x=zo(o.coordinates,f,m),b=jl(r.geometry(),c,f,m);if(!Wi(c,f))return!1;for(let S of b)if(!ni(S,x))return!1}if(o.type==="MultiPolygon"){let x=ko(o.coordinates,f,m),b=jl(r.geometry(),c,f,m);if(!Wi(c,f))return!1;for(let S of b)if(!Ec(S,x))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,o){let c=[1/0,1/0,-1/0,-1/0],f=[1/0,1/0,-1/0,-1/0],m=r.canonicalID();if(o.type==="Polygon"){let x=zo(o.coordinates,f,m),b=$l(r.geometry(),c,f,m);if(!Wi(c,f))return!1;for(let S of b)if(!Po(S,x))return!1}if(o.type==="MultiPolygon"){let x=ko(o.coordinates,f,m),b=$l(r.geometry(),c,f,m);if(!Wi(c,f))return!1;for(let S of b)if(!ql(S,x))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}function Ma(i){if(i instanceof Me&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Bn)return!1;let t=!0;return i.eachChild(r=>{t&&!Ma(r)&&(t=!1)}),t}function fs(i){if(i instanceof Me&&i.name==="feature-state")return!1;let t=!0;return i.eachChild(r=>{t&&!fs(r)&&(t=!1)}),t}function Gs(i,t){if(i instanceof Me&&t.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(o=>{r&&!Gs(o,t)&&(r=!1)}),r}class Sa{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");let o=t[1];return r.scope.has(o)?new Sa(o,r.scope.get(o)):r.error(`Unknown variable "${o}". Make sure "${o}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Ta{constructor(t,r=[],o,c=new Qe,f=[]){this.registry=t,this.path=r,this.key=r.map(m=>`[${m}]`).join(""),this.scope=c,this.errors=f,this.expectedType=o}parse(t,r,o,c,f={}){return r?this.concat(r,o,c)._parse(t,f):this._parse(t,f)}_parse(t,r){function o(c,f,m){return m==="assert"?new Jt(f,[c]):m==="coerce"?new De(f,[c]):c}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", []].');let c=t[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let f=this.registry[c];if(f){let m=f.parse(t,this);if(!m)return null;if(this.expectedType){let x=this.expectedType,b=m.type;if(x.kind!=="string"&&x.kind!=="number"&&x.kind!=="boolean"&&x.kind!=="object"&&x.kind!=="array"||b.kind!=="value")if(x.kind!=="color"&&x.kind!=="formatted"&&x.kind!=="resolvedImage"||b.kind!=="value"&&b.kind!=="string"){if(this.checkSubtype(x,b))return null}else m=o(m,x,r.typeAnnotation||"coerce");else m=o(m,x,r.typeAnnotation||"assert")}if(!(m instanceof kt)&&m.type.kind!=="resolvedImage"&&qs(m)){let x=new Te;try{m=new kt(m.type,m.evaluate(x))}catch(b){return this.error(b.message),null}}return m}return this.error(`Unknown expression "${c}". 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.`)}concat(t,r,o){let c=typeof t=="number"?this.path.concat(t):this.path,f=o?this.scope.concat(o):this.scope;return new Ta(this.registry,c,r||null,f,this.errors)}error(t,...r){let o=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new Ce(o,t))}checkSubtype(t,r){let o=yr(t,r);return o&&this.error(o),o}}function qs(i){if(i instanceof Sa)return qs(i.boundExpression);if(i instanceof Me&&i.name==="error"||i instanceof wi||i instanceof Bn)return!1;let t=i instanceof De||i instanceof Jt,r=!0;return i.eachChild(o=>{r=t?r&&qs(o):r&&o instanceof kt}),!!r&&Ma(i)&&Gs(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ea(i,t){let r=i.length-1,o,c,f=0,m=r,x=0;for(;f<=m;)if(x=Math.floor((f+m)/2),o=i[x],c=i[x+1],o<=t){if(x===r||t<c)return x;f=x+1}else{if(!(o>t))throw new wt("Input is not a number.");m=x-1}return 0}class js{constructor(t,r,o){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(let[c,f]of o)this.labels.push(c),this.outputs.push(f)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");let o=r.parse(t[1],1,Vt);if(!o)return null;let c=[],f=null;r.expectedType&&r.expectedType.kind!=="value"&&(f=r.expectedType);for(let m=1;m<t.length;m+=2){let x=m===1?-1/0:t[m],b=t[m+1],S=m,A=m+1;if(typeof x!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',S);if(c.length&&c[c.length-1][0]>=x)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',S);let z=r.parse(b,A,f);if(!z)return null;f=f||z.type,c.push([x,z])}return new js(f,o,c)}evaluate(t){let r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(t);let c=this.input.evaluate(t);if(c<=r[0])return o[0].evaluate(t);let f=r.length;return c>=r[f-1]?o[f-1].evaluate(t):o[Ea(r,c)].evaluate(t)}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}serialize(){let t=["step",this.input.serialize()];for(let r=0;r<this.labels.length;r++)r>0&&t.push(this.labels[r]),t.push(this.outputs[r].serialize());return t}}function Ci(i,t,r){return i*(1-r)+t*r}var $s=Object.freeze({__proto__:null,number:Ci,color:function(i,t,r){return new P(Ci(i.r,t.r,r),Ci(i.g,t.g,r),Ci(i.b,t.b,r),Ci(i.a,t.a,r))},array:function(i,t,r){return i.map((o,c)=>Ci(o,t[c],r))}});let Do=.95047,Wl=1.08883,Zl=4/29,Ia=6/29,Ro=3*Ia*Ia,Cc=Math.PI/180,Ac=180/Math.PI;function Bo(i){return i>.008856451679035631?Math.pow(i,1/3):i/Ro+Zl}function Fo(i){return i>Ia?i*i*i:Ro*(i-Zl)}function Oo(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function No(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Hl(i){let t=No(i.r),r=No(i.g),o=No(i.b),c=Bo((.4124564*t+.3575761*r+.1804375*o)/Do),f=Bo((.2126729*t+.7151522*r+.072175*o)/1);return{l:116*f-16,a:500*(c-f),b:200*(f-Bo((.0193339*t+.119192*r+.9503041*o)/Wl)),alpha:i.a}}function $e(i){let t=(i.l+16)/116,r=isNaN(i.a)?t:t+i.a/500,o=isNaN(i.b)?t:t-i.b/200;return t=1*Fo(t),r=Do*Fo(r),o=Wl*Fo(o),new P(Oo(3.2404542*r-1.5371385*t-.4985314*o),Oo(-.969266*r+1.8760108*t+.041556*o),Oo(.0556434*r-.2040259*t+1.0572252*o),i.alpha)}function Pc(i,t,r){let o=t-i;return i+r*(o>180||o<-180?o-360*Math.round(o/360):o)}let Ws={forward:Hl,reverse:$e,interpolate:function(i,t,r){return{l:Ci(i.l,t.l,r),a:Ci(i.a,t.a,r),b:Ci(i.b,t.b,r),alpha:Ci(i.alpha,t.alpha,r)}}},Zs={forward:function(i){let{l:t,a:r,b:o}=Hl(i),c=Math.atan2(o,r)*Ac;return{h:c<0?c+360:c,c:Math.sqrt(r*r+o*o),l:t,alpha:i.a}},reverse:function(i){let t=i.h*Cc,r=i.c;return $e({l:i.l,a:Math.cos(t)*r,b:Math.sin(t)*r,alpha:i.alpha})},interpolate:function(i,t,r){return{h:Pc(i.h,t.h,r),c:Ci(i.c,t.c,r),l:Ci(i.l,t.l,r),alpha:Ci(i.alpha,t.alpha,r)}}};var Xl=Object.freeze({__proto__:null,lab:Ws,hcl:Zs});class _r{constructor(t,r,o,c,f){this.type=t,this.operator=r,this.interpolation=o,this.input=c,this.labels=[],this.outputs=[];for(let[m,x]of f)this.labels.push(m),this.outputs.push(x)}static interpolationFactor(t,r,o,c){let f=0;if(t.name==="exponential")f=Uo(r,t.base,o,c);else if(t.name==="linear")f=Uo(r,1,o,c);else if(t.name==="cubic-bezier"){let m=t.controlPoints;f=new T(m[0],m[1],m[2],m[3]).solve(Uo(r,1,o,c))}return f}static parse(t,r){let[o,c,f,...m]=t;if(!Array.isArray(c)||c.length===0)return r.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){let S=c[1];if(typeof S!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:S}}else{if(c[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(c[0])}`,1,0);{let S=c.slice(1);if(S.length!==4||S.some(A=>typeof A!="number"||A<0||A>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:S}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(f=r.parse(f,2,Vt),!f)return null;let x=[],b=null;o==="interpolate-hcl"||o==="interpolate-lab"?b=ai:r.expectedType&&r.expectedType.kind!=="value"&&(b=r.expectedType);for(let S=0;S<m.length;S+=2){let A=m[S],z=m[S+1],D=S+3,O=S+4;if(typeof A!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',D);if(x.length&&x[x.length-1][0]>=A)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',D);let V=r.parse(z,O,b);if(!V)return null;b=b||V.type,x.push([A,V])}return b.kind==="number"||b.kind==="color"||b.kind==="array"&&b.itemType.kind==="number"&&typeof b.N=="number"?new _r(b,o,c,f,x):r.error(`Type ${Ze(b)} is not interpolatable.`)}evaluate(t){let r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(t);let c=this.input.evaluate(t);if(c<=r[0])return o[0].evaluate(t);let f=r.length;if(c>=r[f-1])return o[f-1].evaluate(t);let m=Ea(r,c),x=_r.interpolationFactor(this.interpolation,c,r[m],r[m+1]),b=o[m].evaluate(t),S=o[m+1].evaluate(t);return this.operator==="interpolate"?$s[this.type.kind.toLowerCase()](b,S,x):this.operator==="interpolate-hcl"?Zs.reverse(Zs.interpolate(Zs.forward(b),Zs.forward(S),x)):Ws.reverse(Ws.interpolate(Ws.forward(b),Ws.forward(S),x))}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}serialize(){let 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);let r=[this.operator,t,this.input.serialize()];for(let o=0;o<this.labels.length;o++)r.push(this.labels[o],this.outputs[o].serialize());return r}}function Uo(i,t,r,o){let c=o-r,f=i-r;return c===0?0:t===1?f/c:(Math.pow(t,f)-1)/(Math.pow(t,c)-1)}class Ca{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expectected at least one argument.");let o=null,c=r.expectedType;c&&c.kind!=="value"&&(o=c);let f=[];for(let x of t.slice(1)){let b=r.parse(x,1+f.length,o,void 0,{typeAnnotation:"omit"});if(!b)return null;o=o||b.type,f.push(b)}let m=c&&f.some(x=>yr(c,x.type));return new Ca(m?_e:o,f)}evaluate(t){let r,o=null,c=0;for(let f of this.args)if(c++,o=f.evaluate(t),o&&o instanceof at&&!o.available&&(r||(r=o.name),o=null,c===this.args.length&&(o=r)),o!==null)break;return o}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}serialize(){let t=["coalesce"];return this.eachChild(r=>{t.push(r.serialize())}),t}}class Aa{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let o=[];for(let f=1;f<t.length-1;f+=2){let m=t[f];if(typeof m!="string")return r.error(`Expected string, but found ${typeof m} instead.`,f);if(/[^a-zA-Z0-9_]/.test(m))return r.error("Variable names must contain only alphanumeric characters or '_'.",f);let x=r.parse(t[f+1],f+1);if(!x)return null;o.push([m,x])}let c=r.parse(t[t.length-1],t.length-1,r.expectedType,o);return c?new Aa(o,c):null}outputDefined(){return this.result.outputDefined()}serialize(){let t=["let"];for(let[r,o]of this.bindings)t.push(r,o.serialize());return t.push(this.result.serialize()),t}}class Vo{constructor(t,r,o){this.type=t,this.index=r,this.input=o}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let o=r.parse(t[1],1,Vt),c=r.parse(t[2],2,ri(r.expectedType||_e));return o&&c?new Vo(c.type.itemType,o,c):null}evaluate(t){let r=this.index.evaluate(t),o=this.input.evaluate(t);if(r<0)throw new wt(`Array index out of bounds: ${r} < 0.`);if(r>=o.length)throw new wt(`Array index out of bounds: ${r} > ${o.length-1}.`);if(r!==Math.floor(r))throw new wt(`Array index must be an integer, but found ${r} instead.`);return o[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Go{constructor(t,r){this.type=he,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let o=r.parse(t[1],1,_e),c=r.parse(t[2],2,_e);return o&&c?gi(o.type,[he,ge,Vt,Pe,_e])?new Go(o,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ze(o.type)} instead`):null}evaluate(t){let r=this.needle.evaluate(t),o=this.haystack.evaluate(t);if(!o)return!1;if(!jr(r,["boolean","string","number","null"]))throw new wt(`Expected first argument to be of type boolean, string, number or null, but found ${Ze(ot(r))} instead.`);if(!jr(o,["string","array"]))throw new wt(`Expected second argument to be of type array or string, but found ${Ze(ot(o))} instead.`);return o.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class Pa{constructor(t,r,o){this.type=Vt,this.needle=t,this.haystack=r,this.fromIndex=o}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);let o=r.parse(t[1],1,_e),c=r.parse(t[2],2,_e);if(!o||!c)return null;if(!gi(o.type,[he,ge,Vt,Pe,_e]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ze(o.type)} instead`);if(t.length===4){let f=r.parse(t[3],3,Vt);return f?new Pa(o,c,f):null}return new Pa(o,c)}evaluate(t){let r=this.needle.evaluate(t),o=this.haystack.evaluate(t);if(!jr(r,["boolean","string","number","null"]))throw new wt(`Expected first argument to be of type boolean, string, number or null, but found ${Ze(ot(r))} instead.`);if(!jr(o,["string","array"]))throw new wt(`Expected second argument to be of type array or string, but found ${Ze(ot(o))} instead.`);if(this.fromIndex){let c=this.fromIndex.evaluate(t);return o.indexOf(r,c)}return o.indexOf(r)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){let t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class qo{constructor(t,r,o,c,f,m){this.inputType=t,this.type=r,this.input=o,this.cases=c,this.outputs=f,this.otherwise=m}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let o,c;r.expectedType&&r.expectedType.kind!=="value"&&(c=r.expectedType);let f={},m=[];for(let S=2;S<t.length-1;S+=2){let A=t[S],z=t[S+1];Array.isArray(A)||(A=[A]);let D=r.concat(S);if(A.length===0)return D.error("Expected at least one branch label.");for(let V of A){if(typeof V!="number"&&typeof V!="string")return D.error("Branch labels must be numbers or strings.");if(typeof V=="number"&&Math.abs(V)>Number.MAX_SAFE_INTEGER)return D.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof V=="number"&&Math.floor(V)!==V)return D.error("Numeric branch labels must be integer values.");if(o){if(D.checkSubtype(o,ot(V)))return null}else o=ot(V);if(f[String(V)]!==void 0)return D.error("Branch labels must be unique.");f[String(V)]=m.length}let O=r.parse(z,S,c);if(!O)return null;c=c||O.type,m.push(O)}let x=r.parse(t[1],1,_e);if(!x)return null;let b=r.parse(t[t.length-1],t.length-1,c);return b?x.type.kind!=="value"&&r.concat(1).checkSubtype(o,x.type)?null:new qo(o,c,x,f,m,b):null}evaluate(t){let r=this.input.evaluate(t);return(ot(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}serialize(){let t=["match",this.input.serialize()],r=Object.keys(this.cases).sort(),o=[],c={};for(let m of r){let x=c[this.cases[m]];x===void 0?(c[this.cases[m]]=o.length,o.push([this.cases[m],[m]])):o[x][1].push(m)}let f=m=>this.inputType.kind==="number"?Number(m):m;for(let[m,x]of o)t.push(x.length===1?f(x[0]):x.map(f)),t.push(this.outputs[m].serialize());return t.push(this.otherwise.serialize()),t}}class jo{constructor(t,r,o){this.type=t,this.branches=r,this.otherwise=o}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);let c=[];for(let m=1;m<t.length-1;m+=2){let x=r.parse(t[m],m,he);if(!x)return null;let b=r.parse(t[m+1],m+1,o);if(!b)return null;c.push([x,b]),o=o||b.type}let f=r.parse(t[t.length-1],t.length-1,o);return f?new jo(o,c,f):null}evaluate(t){for(let[r,o]of this.branches)if(r.evaluate(t))return o.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[r,o]of this.branches)t(r),t(o);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}serialize(){let t=["case"];return this.eachChild(r=>{t.push(r.serialize())}),t}}class za{constructor(t,r,o,c){this.type=t,this.input=r,this.beginIndex=o,this.endIndex=c}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);let o=r.parse(t[1],1,_e),c=r.parse(t[2],2,Vt);if(!o||!c)return null;if(!gi(o.type,[ri(_e),ge,_e]))return r.error(`Expected first argument to be of type array or string, but found ${Ze(o.type)} instead`);if(t.length===4){let f=r.parse(t[3],3,Vt);return f?new za(o.type,o,c,f):null}return new za(o.type,o,c)}evaluate(t){let r=this.input.evaluate(t),o=this.beginIndex.evaluate(t);if(!jr(r,["string","array"]))throw new wt(`Expected first argument to be of type array or string, but found ${Ze(ot(r))} instead.`);if(this.endIndex){let c=this.endIndex.evaluate(t);return r.slice(o,c)}return r.slice(o)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){let t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}function Kl(i,t){return i==="=="||i==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function Yl(i,t,r,o){return o.compare(t,r)===0}function ms(i,t,r){let o=i!=="=="&&i!=="!=";return class Km{constructor(f,m,x){this.type=he,this.lhs=f,this.rhs=m,this.collator=x,this.hasUntypedArgument=f.type.kind==="value"||m.type.kind==="value"}static parse(f,m){if(f.length!==3&&f.length!==4)return m.error("Expected two or three arguments.");let x=f[0],b=m.parse(f[1],1,_e);if(!b)return null;if(!Kl(x,b.type))return m.concat(1).error(`"${x}" comparisons are not supported for type '${Ze(b.type)}'.`);let S=m.parse(f[2],2,_e);if(!S)return null;if(!Kl(x,S.type))return m.concat(2).error(`"${x}" comparisons are not supported for type '${Ze(S.type)}'.`);if(b.type.kind!==S.type.kind&&b.type.kind!=="value"&&S.type.kind!=="value")return m.error(`Cannot compare types '${Ze(b.type)}' and '${Ze(S.type)}'.`);o&&(b.type.kind==="value"&&S.type.kind!=="value"?b=new Jt(S.type,[b]):b.type.kind!=="value"&&S.type.kind==="value"&&(S=new Jt(b.type,[S])));let A=null;if(f.length===4){if(b.type.kind!=="string"&&S.type.kind!=="string"&&b.type.kind!=="value"&&S.type.kind!=="value")return m.error("Cannot use collator to compare non-string types.");if(A=m.parse(f[3],3,ir),!A)return null}return new Km(b,S,A)}evaluate(f){let m=this.lhs.evaluate(f),x=this.rhs.evaluate(f);if(o&&this.hasUntypedArgument){let b=ot(m),S=ot(x);if(b.kind!==S.kind||b.kind!=="string"&&b.kind!=="number")throw new wt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${b.kind}, ${S.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){let b=ot(m),S=ot(x);if(b.kind!=="string"||S.kind!=="string")return t(f,m,x)}return this.collator?r(f,m,x,this.collator.evaluate(f)):t(f,m,x)}eachChild(f){f(this.lhs),f(this.rhs),this.collator&&f(this.collator)}outputDefined(){return!0}serialize(){let f=[i];return this.eachChild(m=>{f.push(m.serialize())}),f}}}let zc=ms("==",function(i,t,r){return t===r},Yl),kc=ms("!=",function(i,t,r){return t!==r},function(i,t,r,o){return!Yl(0,t,r,o)}),Lc=ms("<",function(i,t,r){return t<r},function(i,t,r,o){return o.compare(t,r)<0}),Dc=ms(">",function(i,t,r){return t>r},function(i,t,r,o){return o.compare(t,r)>0}),Rc=ms("<=",function(i,t,r){return t<=r},function(i,t,r,o){return o.compare(t,r)<=0}),Bc=ms(">=",function(i,t,r){return t>=r},function(i,t,r,o){return o.compare(t,r)>=0});class $o{constructor(t,r,o,c,f){this.type=ge,this.number=t,this.locale=r,this.currency=o,this.minFractionDigits=c,this.maxFractionDigits=f}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");let o=r.parse(t[1],1,Vt);if(!o)return null;let c=t[2];if(typeof c!="object"||Array.isArray(c))return r.error("NumberFormat options argument must be an object.");let f=null;if(c.locale&&(f=r.parse(c.locale,1,ge),!f))return null;let m=null;if(c.currency&&(m=r.parse(c.currency,1,ge),!m))return null;let x=null;if(c["min-fraction-digits"]&&(x=r.parse(c["min-fraction-digits"],1,Vt),!x))return null;let b=null;return c["max-fraction-digits"]&&(b=r.parse(c["max-fraction-digits"],1,Vt),!b)?null:new $o(o,f,m,x,b)}evaluate(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))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){let 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]}}class Wo{constructor(t){this.type=Vt,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let o=r.parse(t[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${Ze(o.type)} instead.`):new Wo(o):null}evaluate(t){let r=this.input.evaluate(t);if(typeof r=="string"||Array.isArray(r))return r.length;throw new wt(`Expected value to be of type string or array, but found ${Ze(ot(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){let t=["length"];return this.eachChild(r=>{t.push(r.serialize())}),t}}let gs={"==":zc,"!=":kc,">":Dc,"<":Lc,">=":Bc,"<=":Rc,array:Jt,at:Vo,boolean:Jt,case:jo,coalesce:Ca,collator:wi,format:se,image:pe,in:Go,"index-of":Pa,interpolate:_r,"interpolate-hcl":_r,"interpolate-lab":_r,length:Wo,let:Aa,literal:kt,match:qo,number:Jt,"number-format":$o,object:Jt,slice:za,step:js,string:Jt,"to-boolean":De,"to-color":De,"to-number":De,"to-string":De,var:Sa,within:Bn};function Jl(i,[t,r,o,c]){t=t.evaluate(i),r=r.evaluate(i),o=o.evaluate(i);let f=c?c.evaluate(i):1,m=rt(t,r,o,f);if(m)throw new wt(m);return new P(t/255*f,r/255*f,o/255*f,f)}function Ql(i,t){return i in t}function Zo(i,t){let r=t[i];return r===void 0?null:r}function Fn(i){return{type:i}}function th(i){return{result:"success",value:i}}function On(i){return{result:"error",value:i}}function ys(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function eh(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Ho(i){return!!i.expression&&i.expression.interpolated}function we(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function ka(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Ye(i){return i}function La(i,t){let r=t.type==="color",o=i.stops&&typeof i.stops[0][0]=="object",c=o||!(o||i.property!==void 0),f=i.type||(Ho(t)?"exponential":"interval");if(r&&((i=Ie({},i)).stops&&(i.stops=i.stops.map(S=>[S[0],P.parse(S[1])])),i.default=P.parse(i.default?i.default:t.default)),i.colorSpace&&i.colorSpace!=="rgb"&&!Xl[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let m,x,b;if(f==="exponential")m=Xo;else if(f==="interval")m=Da;else if(f==="categorical"){m=vi,x=Object.create(null);for(let S of i.stops)x[S[0]]=S[1];b=typeof i.stops[0][0]}else{if(f!=="identity")throw new Error(`Unknown function type "${f}"`);m=Fc}if(o){let S={},A=[];for(let O=0;O<i.stops.length;O++){let V=i.stops[O],tt=V[0].zoom;S[tt]===void 0&&(S[tt]={zoom:tt,type:i.type,property:i.property,default:i.default,stops:[]},A.push(tt)),S[tt].stops.push([V[0].value,V[1]])}let z=[];for(let O of A)z.push([S[O].zoom,La(S[O],t)]);let D={name:"linear"};return{kind:"composite",interpolationType:D,interpolationFactor:_r.interpolationFactor.bind(void 0,D),zoomStops:z.map(O=>O[0]),evaluate:({zoom:O},V)=>Xo({stops:z,base:i.base},t,O).evaluate(O,V)}}if(c){let S=f==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:S,interpolationFactor:_r.interpolationFactor.bind(void 0,S),zoomStops:i.stops.map(A=>A[0]),evaluate:({zoom:A})=>m(i,t,A,x,b)}}return{kind:"source",evaluate(S,A){let z=A&&A.properties?A.properties[i.property]:void 0;return z===void 0?li(i.default,t.default):m(i,t,z,x,b)}}}function li(i,t,r){return i!==void 0?i:t!==void 0?t:r!==void 0?r:void 0}function vi(i,t,r,o,c){return li(typeof r===c?o[r]:void 0,i.default,t.default)}function Da(i,t,r){if(we(r)!=="number")return li(i.default,t.default);let o=i.stops.length;if(o===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[o-1][0])return i.stops[o-1][1];let c=Ea(i.stops.map(f=>f[0]),r);return i.stops[c][1]}function Xo(i,t,r){let o=i.base!==void 0?i.base:1;if(we(r)!=="number")return li(i.default,t.default);let c=i.stops.length;if(c===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[c-1][0])return i.stops[c-1][1];let f=Ea(i.stops.map(A=>A[0]),r),m=function(A,z,D,O){let V=O-D,tt=A-D;return V===0?0:z===1?tt/V:(Math.pow(z,tt)-1)/(Math.pow(z,V)-1)}(r,o,i.stops[f][0],i.stops[f+1][0]),x=i.stops[f][1],b=i.stops[f+1][1],S=$s[t.type]||Ye;if(i.colorSpace&&i.colorSpace!=="rgb"){let A=Xl[i.colorSpace];S=(z,D)=>A.reverse(A.interpolate(A.forward(z),A.forward(D),m))}return typeof x.evaluate=="function"?{evaluate(...A){let z=x.evaluate.apply(void 0,A),D=b.evaluate.apply(void 0,A);if(z!==void 0&&D!==void 0)return S(z,D,m)}}:S(x,b,m)}function Fc(i,t,r){return t.type==="color"?r=P.parse(r):t.type==="formatted"?r=Y.fromString(r.toString()):t.type==="resolvedImage"?r=at.fromString(r.toString()):we(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0),li(r,i.default,t.default)}Me.register(gs,{error:[{kind:"error"},[ge],(i,[t])=>{throw new wt(t.evaluate(i))}],typeof:[ge,[_e],(i,[t])=>Ze(ot(t.evaluate(i)))],"to-rgba":[ri(Vt,4),[ai],(i,[t])=>t.evaluate(i).toArray()],rgb:[ai,[Vt,Vt,Vt],Jl],rgba:[ai,[Vt,Vt,Vt,Vt],Jl],has:{type:he,overloads:[[[ge],(i,[t])=>Ql(t.evaluate(i),i.properties())],[[ge,$i],(i,[t,r])=>Ql(t.evaluate(i),r.evaluate(i))]]},get:{type:_e,overloads:[[[ge],(i,[t])=>Zo(t.evaluate(i),i.properties())],[[ge,$i],(i,[t,r])=>Zo(t.evaluate(i),r.evaluate(i))]]},"feature-state":[_e,[ge],(i,[t])=>Zo(t.evaluate(i),i.featureState||{})],properties:[$i,[],i=>i.properties()],"geometry-type":[ge,[],i=>i.geometryType()],id:[_e,[],i=>i.id()],zoom:[Vt,[],i=>i.globals.zoom],"heatmap-density":[Vt,[],i=>i.globals.heatmapDensity||0],"line-progress":[Vt,[],i=>i.globals.lineProgress||0],accumulated:[_e,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Vt,Fn(Vt),(i,t)=>{let r=0;for(let o of t)r+=o.evaluate(i);return r}],"*":[Vt,Fn(Vt),(i,t)=>{let r=1;for(let o of t)r*=o.evaluate(i);return r}],"-":{type:Vt,overloads:[[[Vt,Vt],(i,[t,r])=>t.evaluate(i)-r.evaluate(i)],[[Vt],(i,[t])=>-t.evaluate(i)]]},"/":[Vt,[Vt,Vt],(i,[t,r])=>t.evaluate(i)/r.evaluate(i)],"%":[Vt,[Vt,Vt],(i,[t,r])=>t.evaluate(i)%r.evaluate(i)],ln2:[Vt,[],()=>Math.LN2],pi:[Vt,[],()=>Math.PI],e:[Vt,[],()=>Math.E],"^":[Vt,[Vt,Vt],(i,[t,r])=>Math.pow(t.evaluate(i),r.evaluate(i))],sqrt:[Vt,[Vt],(i,[t])=>Math.sqrt(t.evaluate(i))],log10:[Vt,[Vt],(i,[t])=>Math.log(t.evaluate(i))/Math.LN10],ln:[Vt,[Vt],(i,[t])=>Math.log(t.evaluate(i))],log2:[Vt,[Vt],(i,[t])=>Math.log(t.evaluate(i))/Math.LN2],sin:[Vt,[Vt],(i,[t])=>Math.sin(t.evaluate(i))],cos:[Vt,[Vt],(i,[t])=>Math.cos(t.evaluate(i))],tan:[Vt,[Vt],(i,[t])=>Math.tan(t.evaluate(i))],asin:[Vt,[Vt],(i,[t])=>Math.asin(t.evaluate(i))],acos:[Vt,[Vt],(i,[t])=>Math.acos(t.evaluate(i))],atan:[Vt,[Vt],(i,[t])=>Math.atan(t.evaluate(i))],min:[Vt,Fn(Vt),(i,t)=>Math.min(...t.map(r=>r.evaluate(i)))],max:[Vt,Fn(Vt),(i,t)=>Math.max(...t.map(r=>r.evaluate(i)))],abs:[Vt,[Vt],(i,[t])=>Math.abs(t.evaluate(i))],round:[Vt,[Vt],(i,[t])=>{let r=t.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Vt,[Vt],(i,[t])=>Math.floor(t.evaluate(i))],ceil:[Vt,[Vt],(i,[t])=>Math.ceil(t.evaluate(i))],"filter-==":[he,[ge,_e],(i,[t,r])=>i.properties()[t.value]===r.value],"filter-id-==":[he,[_e],(i,[t])=>i.id()===t.value],"filter-type-==":[he,[ge],(i,[t])=>i.geometryType()===t.value],"filter-<":[he,[ge,_e],(i,[t,r])=>{let o=i.properties()[t.value],c=r.value;return typeof o==typeof c&&o<c}],"filter-id-<":[he,[_e],(i,[t])=>{let r=i.id(),o=t.value;return typeof r==typeof o&&r<o}],"filter->":[he,[ge,_e],(i,[t,r])=>{let o=i.properties()[t.value],c=r.value;return typeof o==typeof c&&o>c}],"filter-id->":[he,[_e],(i,[t])=>{let r=i.id(),o=t.value;return typeof r==typeof o&&r>o}],"filter-<=":[he,[ge,_e],(i,[t,r])=>{let o=i.properties()[t.value],c=r.value;return typeof o==typeof c&&o<=c}],"filter-id-<=":[he,[_e],(i,[t])=>{let r=i.id(),o=t.value;return typeof r==typeof o&&r<=o}],"filter->=":[he,[ge,_e],(i,[t,r])=>{let o=i.properties()[t.value],c=r.value;return typeof o==typeof c&&o>=c}],"filter-id->=":[he,[_e],(i,[t])=>{let r=i.id(),o=t.value;return typeof r==typeof o&&r>=o}],"filter-has":[he,[_e],(i,[t])=>t.value in i.properties()],"filter-has-id":[he,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[he,[ri(ge)],(i,[t])=>t.value.indexOf(i.geometryType())>=0],"filter-id-in":[he,[ri(_e)],(i,[t])=>t.value.indexOf(i.id())>=0],"filter-in-small":[he,[ge,ri(_e)],(i,[t,r])=>r.value.indexOf(i.properties()[t.value])>=0],"filter-in-large":[he,[ge,ri(_e)],(i,[t,r])=>function(o,c,f,m){for(;f<=m;){let x=f+m>>1;if(c[x]===o)return!0;c[x]>o?m=x-1:f=x+1}return!1}(i.properties()[t.value],r.value,0,r.value.length-1)],all:{type:he,overloads:[[[he,he],(i,[t,r])=>t.evaluate(i)&&r.evaluate(i)],[Fn(he),(i,t)=>{for(let r of t)if(!r.evaluate(i))return!1;return!0}]]},any:{type:he,overloads:[[[he,he],(i,[t,r])=>t.evaluate(i)||r.evaluate(i)],[Fn(he),(i,t)=>{for(let r of t)if(r.evaluate(i))return!0;return!1}]]},"!":[he,[he],(i,[t])=>!t.evaluate(i)],"is-supported-script":[he,[ge],(i,[t])=>{let r=i.globals&&i.globals.isSupportedScript;return!r||r(t.evaluate(i))}],upcase:[ge,[ge],(i,[t])=>t.evaluate(i).toUpperCase()],downcase:[ge,[ge],(i,[t])=>t.evaluate(i).toLowerCase()],concat:[ge,Fn(_e),(i,t)=>t.map(r=>St(r.evaluate(i))).join("")],"resolved-locale":[ge,[ir],(i,[t])=>t.evaluate(i).resolvedLocale()]});class Ko{constructor(t,r){this.expression=t,this._warningHistory={},this._evaluator=new Te,this._defaultValue=r?function(o){return o.type==="color"&&ka(o.default)?new P(0,0,0,0):o.type==="color"?P.parse(o.default)||null:o.default===void 0?null:o.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,o,c,f,m){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=o,this._evaluator.canonical=c,this._evaluator.availableImages=f||null,this._evaluator.formattedSection=m,this.expression.evaluate(this._evaluator)}evaluate(t,r,o,c,f,m){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=o||null,this._evaluator.canonical=c,this._evaluator.availableImages=f||null,this._evaluator.formattedSection=m||null;try{let x=this.expression.evaluate(this._evaluator);if(x==null||typeof x=="number"&&x!=x)return this._defaultValue;if(this._enumValues&&!(x in this._enumValues))throw new wt(`Expected value to be one of ${Object.keys(this._enumValues).map(b=>JSON.stringify(b)).join(", ")}, but found ${JSON.stringify(x)} instead.`);return x}catch(x){return this._warningHistory[x.message]||(this._warningHistory[x.message]=!0,typeof console<"u"&&console.warn(x.message)),this._defaultValue}}}function Ra(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in gs}function Ba(i,t){let r=new Ta(gs,[],t?function(c){let f={color:ai,string:ge,number:Vt,enum:ge,boolean:he,formatted:mi,resolvedImage:rr};return c.type==="array"?ri(f[c.value]||_e,c.length):f[c.type]}(t):void 0),o=r.parse(i,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?th(new Ko(o,t)):On(r.errors)}class Fa{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!fs(r.expression)}evaluateWithoutErrorHandling(t,r,o,c,f,m){return this._styleExpression.evaluateWithoutErrorHandling(t,r,o,c,f,m)}evaluate(t,r,o,c,f,m){return this._styleExpression.evaluate(t,r,o,c,f,m)}}class Oa{constructor(t,r,o,c){this.kind=t,this.zoomStops=o,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!fs(r.expression),this.interpolationType=c}evaluateWithoutErrorHandling(t,r,o,c,f,m){return this._styleExpression.evaluateWithoutErrorHandling(t,r,o,c,f,m)}evaluate(t,r,o,c,f,m){return this._styleExpression.evaluate(t,r,o,c,f,m)}interpolationFactor(t,r,o){return this.interpolationType?_r.interpolationFactor(this.interpolationType,t,r,o):0}}function Yo(i,t){let r=Ba(i,t);if(r.result==="error")return r;let o=r.value.expression,c=Ma(o);if(!c&&!ys(t))return On([new Ce("","data expressions not supported")]);let f=Gs(o,["zoom"]);if(!f&&!eh(t))return On([new Ce("","zoom expressions not supported")]);let m=Na(o);return m||f?m instanceof Ce?On([m]):m instanceof _r&&!Ho(t)?On([new Ce("",'"interpolate" expressions cannot be used with this property')]):th(m?new Oa(c?"camera":"composite",r.value,m.labels,m instanceof _r?m.interpolation:void 0):new Fa(c?"constant":"source",r.value)):On([new Ce("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class _s{constructor(t,r){this._parameters=t,this._specification=r,Ie(this,La(this._parameters,this._specification))}static deserialize(t){return new _s(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Na(i){let t=null;if(i instanceof Aa)t=Na(i.result);else if(i instanceof Ca){for(let r of i.args)if(t=Na(r),t)break}else(i instanceof js||i instanceof _r)&&i.input instanceof Me&&i.input.name==="zoom"&&(t=i);return t instanceof Ce||i.eachChild(r=>{let o=Na(r);o instanceof Ce?t=o:!t&&o?t=new Ce("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&o&&t!==o&&(t=new Ce("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function Wr(i){let t=i.key,r=i.value,o=i.valueSpec||{},c=i.objectElementValidators||{},f=i.style,m=i.styleSpec,x=[],b=we(r);if(b!=="object")return[new Ct(t,r,`object expected, ${b} found`)];for(let S in r){let A=S.split(".")[0],z=o[A]||o["*"],D;if(c[A])D=c[A];else if(o[A])D=lr;else if(c["*"])D=c["*"];else{if(!o["*"]){x.push(new Ct(t,r[S],`unknown property "${S}"`));continue}D=lr}x=x.concat(D({key:(t&&`${t}.`)+S,value:r[S],valueSpec:z,style:f,styleSpec:m,object:r,objectKey:S},r))}for(let S in o)c[S]||o[S].required&&o[S].default===void 0&&r[S]===void 0&&x.push(new Ct(t,r,`missing required property "${S}"`));return x}function ih(i){let t=i.value,r=i.valueSpec,o=i.style,c=i.styleSpec,f=i.key,m=i.arrayElementValidator||lr;if(we(t)!=="array")return[new Ct(f,t,`array expected, ${we(t)} found`)];if(r.length&&t.length!==r.length)return[new Ct(f,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new Ct(f,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let x={type:r.value,values:r.values};c.$version<7&&(x.function=r.function),we(r.value)==="object"&&(x=r.value);let b=[];for(let S=0;S<t.length;S++)b=b.concat(m({array:t,arrayIndex:S,value:t[S],valueSpec:x,style:o,styleSpec:c,key:`${f}[${S}]`}));return b}function rh(i){let t=i.key,r=i.value,o=i.valueSpec,c=we(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new Ct(t,r,`number expected, ${c} found`)]:"minimum"in o&&r<o.minimum?[new Ct(t,r,`${r} is less than the minimum value ${o.minimum}`)]:"maximum"in o&&r>o.maximum?[new Ct(t,r,`${r} is greater than the maximum value ${o.maximum}`)]:[]}function nh(i){let t=i.valueSpec,r=ae(i.value.type),o,c,f,m={},x=r!=="categorical"&&i.value.property===void 0,b=!x,S=we(i.value.stops)==="array"&&we(i.value.stops[0])==="array"&&we(i.value.stops[0][0])==="object",A=Wr({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(O){if(r==="identity")return[new Ct(O.key,O.value,'identity function may not have a "stops" property')];let V=[],tt=O.value;return V=V.concat(ih({key:O.key,value:tt,valueSpec:O.valueSpec,style:O.style,styleSpec:O.styleSpec,arrayElementValidator:z})),we(tt)==="array"&&tt.length===0&&V.push(new Ct(O.key,tt,"array must have at least one stop")),V},default:function(O){return lr({key:O.key,value:O.value,valueSpec:t,style:O.style,styleSpec:O.styleSpec})}}});return r==="identity"&&x&&A.push(new Ct(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||A.push(new Ct(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Ho(i.valueSpec)&&A.push(new Ct(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(b&&!ys(i.valueSpec)?A.push(new Ct(i.key,i.value,"property functions not supported")):x&&!eh(i.valueSpec)&&A.push(new Ct(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!S||i.value.property!==void 0||A.push(new Ct(i.key,i.value,'"property" property is required')),A;function z(O){let V=[],tt=O.value,et=O.key;if(we(tt)!=="array")return[new Ct(et,tt,`array expected, ${we(tt)} found`)];if(tt.length!==2)return[new Ct(et,tt,`array length 2 expected, length ${tt.length} found`)];if(S){if(we(tt[0])!=="object")return[new Ct(et,tt,`object expected, ${we(tt[0])} found`)];if(tt[0].zoom===void 0)return[new Ct(et,tt,"object stop key must have zoom")];if(tt[0].value===void 0)return[new Ct(et,tt,"object stop key must have value")];if(f&&f>ae(tt[0].zoom))return[new Ct(et,tt[0].zoom,"stop zoom values must appear in ascending order")];ae(tt[0].zoom)!==f&&(f=ae(tt[0].zoom),c=void 0,m={}),V=V.concat(Wr({key:`${et}[0]`,value:tt[0],valueSpec:{zoom:{}},style:O.style,styleSpec:O.styleSpec,objectElementValidators:{zoom:rh,value:D}}))}else V=V.concat(D({key:`${et}[0]`,value:tt[0],valueSpec:{},style:O.style,styleSpec:O.styleSpec},tt));return Ra(Oe(tt[1]))?V.concat([new Ct(`${et}[1]`,tt[1],"expressions are not allowed in function stops.")]):V.concat(lr({key:`${et}[1]`,value:tt[1],valueSpec:t,style:O.style,styleSpec:O.styleSpec}))}function D(O,V){let tt=we(O.value),et=ae(O.value),dt=O.value!==null?O.value:V;if(o){if(tt!==o)return[new Ct(O.key,dt,`${tt} stop domain type must match previous stop domain type ${o}`)]}else o=tt;if(tt!=="number"&&tt!=="string"&&tt!=="boolean")return[new Ct(O.key,dt,"stop domain value must be a number, string, or boolean")];if(tt!=="number"&&r!=="categorical"){let bt=`number expected, ${tt} found`;return ys(t)&&r===void 0&&(bt+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ct(O.key,dt,bt)]}return r!=="categorical"||tt!=="number"||isFinite(et)&&Math.floor(et)===et?r!=="categorical"&&tt==="number"&&c!==void 0&&et<c?[new Ct(O.key,dt,"stop domain values must appear in ascending order")]:(c=et,r==="categorical"&&et in m?[new Ct(O.key,dt,"stop domain values must be unique")]:(m[et]=!0,[])):[new Ct(O.key,dt,`integer expected, found ${et}`)]}}function xs(i){let t=(i.expressionContext==="property"?Yo:Ba)(Oe(i.value),i.valueSpec);if(t.result==="error")return t.value.map(o=>new Ct(`${i.key}${o.key}`,i.value,o.message));let r=t.value.expression||t.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Ct(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!fs(r))return[new Ct(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!fs(r))return[new Ct(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Gs(r,["zoom","feature-state"]))return[new Ct(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Ma(r))return[new Ct(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ua(i){let t=i.key,r=i.value,o=i.valueSpec,c=[];return Array.isArray(o.values)?o.values.indexOf(ae(r))===-1&&c.push(new Ct(t,r,`expected one of [${o.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(o.values).indexOf(ae(r))===-1&&c.push(new Ct(t,r,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function Jo(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(let t of i.slice(1))if(!Jo(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}let sh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Va(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Jo(i)||(i=Hs(i));let t=Ba(i,sh);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,o,c)=>t.value.evaluate(r,o,{},c),needGeometry:ah(i)}}function Ga(i,t){return i<t?-1:i>t?1:0}function ah(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let t=1;t<i.length;t++)if(ah(i[t]))return!0;return!1}function Hs(i){if(!i)return!0;let t=i[0];return i.length<=1?t!=="any":t==="=="?Qo(i[1],i[2],"=="):t==="!="?vs(Qo(i[1],i[2],"==")):t==="<"||t===">"||t==="<="||t===">="?Qo(i[1],i[2],t):t==="any"?(r=i.slice(1),["any"].concat(r.map(Hs))):t==="all"?["all"].concat(i.slice(1).map(Hs)):t==="none"?["all"].concat(i.slice(1).map(Hs).map(vs)):t==="in"?qa(i[1],i.slice(2)):t==="!in"?vs(qa(i[1],i.slice(2))):t==="has"?ja(i[1]):t==="!has"?vs(ja(i[1])):t!=="within"||i;var r}function Qo(i,t,r){switch(i){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,i,t]}}function qa(i,t){if(t.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",i,["literal",t.sort(Ga)]]:["filter-in-small",i,["literal",t]]}}function ja(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function vs(i){return["!",i]}function Xs(i){return Jo(Oe(i.value))?xs(Ie({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):oh(i)}function oh(i){let t=i.value,r=i.key;if(we(t)!=="array")return[new Ct(r,t,`array expected, ${we(t)} found`)];let o=i.styleSpec,c,f=[];if(t.length<1)return[new Ct(r,t,"filter array must have at least 1 element")];switch(f=f.concat(Ua({key:`${r}[0]`,value:t[0],valueSpec:o.filter_operator,style:i.style,styleSpec:i.styleSpec})),ae(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&ae(t[1])==="$type"&&f.push(new Ct(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&f.push(new Ct(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(c=we(t[1]),c!=="string"&&f.push(new Ct(`${r}[1]`,t[1],`string expected, ${c} found`)));for(let m=2;m<t.length;m++)c=we(t[m]),ae(t[1])==="$type"?f=f.concat(Ua({key:`${r}[${m}]`,value:t[m],valueSpec:o.geometry_type,style:i.style,styleSpec:i.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&f.push(new Ct(`${r}[${m}]`,t[m],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let m=1;m<t.length;m++)f=f.concat(oh({key:`${r}[${m}]`,value:t[m],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":c=we(t[1]),t.length!==2?f.push(new Ct(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):c!=="string"&&f.push(new Ct(`${r}[1]`,t[1],`string expected, ${c} found`));break;case"within":c=we(t[1]),t.length!==2?f.push(new Ct(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):c!=="object"&&f.push(new Ct(`${r}[1]`,t[1],`object expected, ${c} found`))}return f}function Ks(i,t){let r=i.key,o=i.style,c=i.styleSpec,f=i.value,m=i.objectKey,x=c[`${t}_${i.layerType}`];if(!x)return[];let b=m.match(/^(.*)-transition$/);if(t==="paint"&&b&&x[b[1]]&&x[b[1]].transition)return lr({key:r,value:f,valueSpec:c.transition,style:o,styleSpec:c});let S=i.valueSpec||x[m];if(!S)return[new Ct(r,f,`unknown property "${m}"`)];let A;if(we(f)==="string"&&ys(S)&&!S.tokens&&(A=/^{([^}]+)}$/.exec(f)))return[new Ct(r,f,`"${m}" does not support interpolation syntax
3
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(A[1])} }\`.`)];let z=[];return i.layerType==="symbol"&&(m==="text-field"&&o&&!o.glyphs&&z.push(new Ct(r,f,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&ka(Oe(f))&&ae(f.type)==="identity"&&z.push(new Ct(r,f,'"text-font" does not support identity functions'))),z.concat(lr({key:i.key,value:f,valueSpec:S,style:o,styleSpec:c,expressionContext:"property",propertyType:t,propertyKey:m}))}function lh(i){return Ks(i,"paint")}function hh(i){return Ks(i,"layout")}function ch(i){let t=[],r=i.value,o=i.key,c=i.style,f=i.styleSpec;r.type||r.ref||t.push(new Ct(o,r,'either "type" or "ref" is required'));let m=ae(r.type),x=ae(r.ref);if(r.id){let b=ae(r.id);for(let S=0;S<i.arrayIndex;S++){let A=c.layers[S];ae(A.id)===b&&t.push(new Ct(o,r.id,`duplicate layer id "${r.id}", previously used at line ${A.id.__line__}`))}}if("ref"in r){let b;["type","source","source-layer","filter","layout"].forEach(S=>{S in r&&t.push(new Ct(o,r[S],`"${S}" is prohibited for ref layers`))}),c.layers.forEach(S=>{ae(S.id)===x&&(b=S)}),b?b.ref?t.push(new Ct(o,r.ref,"ref cannot reference another ref layer")):m=ae(b.type):t.push(new Ct(o,r.ref,`ref layer "${x}" not found`))}else if(m!=="background")if(r.source){let b=c.sources&&c.sources[r.source],S=b&&ae(b.type);b?S==="vector"&&m==="raster"?t.push(new Ct(o,r.source,`layer "${r.id}" requires a raster source`)):S==="raster"&&m!=="raster"?t.push(new Ct(o,r.source,`layer "${r.id}" requires a vector source`)):S!=="vector"||r["source-layer"]?S==="raster-dem"&&m!=="hillshade"?t.push(new Ct(o,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):m!=="line"||!r.paint||!r.paint["line-gradient"]||S==="geojson"&&b.lineMetrics||t.push(new Ct(o,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Ct(o,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new Ct(o,r.source,`source "${r.source}" not found`))}else t.push(new Ct(o,r,'missing required property "source"'));return t=t.concat(Wr({key:o,value:r,valueSpec:f.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>lr({key:`${o}.type`,value:r.type,valueSpec:f.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:Xs,layout:b=>Wr({layer:r,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":S=>hh(Ie({layerType:m},S))}}),paint:b=>Wr({layer:r,key:b.key,value:b.value,style:b.style,styleSpec:b.styleSpec,objectElementValidators:{"*":S=>lh(Ie({layerType:m},S))}})}})),t}function bs(i){let t=i.value,r=i.key,o=we(t);return o!=="string"?[new Ct(r,t,`string expected, ${o} found`)]:[]}let uh={promoteId:function({key:i,value:t}){if(we(t)==="string")return bs({key:i,value:t});{let r=[];for(let o in t)r.push(...bs({key:`${i}.${o}`,value:t[o]}));return r}}};function Ys(i){let t=i.value,r=i.key,o=i.styleSpec,c=i.style;if(!t.type)return[new Ct(r,t,'"type" is required')];let f=ae(t.type),m;switch(f){case"vector":case"raster":case"raster-dem":return m=Wr({key:r,value:t,valueSpec:o[`source_${f.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:uh}),m;case"geojson":if(m=Wr({key:r,value:t,valueSpec:o.source_geojson,style:c,styleSpec:o,objectElementValidators:uh}),t.cluster)for(let x in t.clusterProperties){let[b,S]=t.clusterProperties[x],A=typeof b=="string"?[b,["accumulated"],["get",x]]:b;m.push(...xs({key:`${r}.${x}.map`,value:S,expressionContext:"cluster-map"})),m.push(...xs({key:`${r}.${x}.reduce`,value:A,expressionContext:"cluster-reduce"}))}return m;case"video":return Wr({key:r,value:t,valueSpec:o.source_video,style:c,styleSpec:o});case"image":return Wr({key:r,value:t,valueSpec:o.source_image,style:c,styleSpec:o});case"canvas":return[new Ct(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ua({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:c,styleSpec:o})}}function Js(i){let t=i.value,r=i.styleSpec,o=r.light,c=i.style,f=[],m=we(t);if(t===void 0)return f;if(m!=="object")return f=f.concat([new Ct("light",t,`object expected, ${m} found`)]),f;for(let x in t){let b=x.match(/^(.*)-transition$/);f=f.concat(b&&o[b[1]]&&o[b[1]].transition?lr({key:x,value:t[x],valueSpec:r.transition,style:c,styleSpec:r}):o[x]?lr({key:x,value:t[x],valueSpec:o[x],style:c,styleSpec:r}):[new Ct(x,t[x],`unknown property "${x}"`)])}return f}let xr={"*":()=>[],array:ih,boolean:function(i){let t=i.value,r=i.key,o=we(t);return o!=="boolean"?[new Ct(r,t,`boolean expected, ${o} found`)]:[]},number:rh,color:function(i){let t=i.key,r=i.value,o=we(r);return o!=="string"?[new Ct(t,r,`color expected, ${o} found`)]:$r(r)===null?[new Ct(t,r,`color expected, "${r}" found`)]:[]},constants:Se,enum:Ua,filter:Xs,function:nh,layer:ch,object:Wr,source:Ys,light:Js,string:bs,formatted:function(i){return bs(i).length===0?[]:xs(i)},resolvedImage:function(i){return bs(i).length===0?[]:xs(i)}};function lr(i){let t=i.value,r=i.valueSpec,o=i.styleSpec;return r.expression&&ka(ae(t))?nh(i):r.expression&&Ra(Oe(t))?xs(i):r.type&&xr[r.type]?xr[r.type](i):Wr(Ie({},i,{valueSpec:r.type?o[r.type]:r}))}function Oc(i){let t=i.value,r=i.key,o=bs(i);return o.length||(t.indexOf("{fontstack}")===-1&&o.push(new Ct(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&o.push(new Ct(r,t,'"glyphs" url must include a "{range}" token'))),o}function Nn(i,t=ct){let r=[];return r=r.concat(lr({key:"",value:i,valueSpec:t.$root,styleSpec:t,style:i,objectElementValidators:{glyphs:Oc,"*":()=>[]}})),i.constants&&(r=r.concat(Se({key:"constants",value:i.constants,style:i,styleSpec:t}))),ph(r)}function ph(i){return[].concat(i).sort((t,r)=>t.line-r.line)}function ws(i){return function(...t){return ph(i.apply(this,t))}}Nn.source=ws(Ys),Nn.light=ws(Js),Nn.layer=ws(ch),Nn.filter=ws(Xs),Nn.paintProperty=ws(lh),Nn.layoutProperty=ws(hh);let Un=Nn,Nc=Un.light,tl=Un.paintProperty,Uc=Un.layoutProperty;function dh(i,t){let r=!1;if(t&&t.length)for(let o of t)i.fire(new Dt(new Error(o.message))),r=!0;return r}class Vn{constructor(t,r,o){let c=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let m=new Int32Array(this.arrayBuffer);t=m[0],this.d=(r=m[1])+2*(o=m[2]);for(let b=0;b<this.d*this.d;b++){let S=m[3+b],A=m[3+b+1];c.push(S===A?null:m.subarray(S,A))}let x=m[3+c.length+1];this.keys=m.subarray(m[3+c.length],x),this.bboxes=m.subarray(x),this.insert=this._insertReadonly}else{this.d=r+2*o;for(let m=0;m<this.d*this.d;m++)c.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=o,this.scale=r/t,this.uid=0;let f=o/r*t;this.min=-f,this.max=t+f}insert(t,r,o,c,f){this._forEachCell(r,o,c,f,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(o),this.bboxes.push(c),this.bboxes.push(f)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,o,c,f,m){this.cells[f].push(m)}query(t,r,o,c,f){let m=this.min,x=this.max;if(t<=m&&r<=m&&x<=o&&x<=c&&!f)return Array.prototype.slice.call(this.keys);{let b=[];return this._forEachCell(t,r,o,c,this._queryCell,b,{},f),b}}_queryCell(t,r,o,c,f,m,x,b){let S=this.cells[f];if(S!==null){let A=this.keys,z=this.bboxes;for(let D=0;D<S.length;D++){let O=S[D];if(x[O]===void 0){let V=4*O;(b?b(z[V+0],z[V+1],z[V+2],z[V+3]):t<=z[V+2]&&r<=z[V+3]&&o>=z[V+0]&&c>=z[V+1])?(x[O]=!0,m.push(A[O])):x[O]=!1}}}}_forEachCell(t,r,o,c,f,m,x,b){let S=this._convertToCellCoord(t),A=this._convertToCellCoord(r),z=this._convertToCellCoord(o),D=this._convertToCellCoord(c);for(let O=S;O<=z;O++)for(let V=A;V<=D;V++){let tt=this.d*V+O;if((!b||b(this._convertFromCellCoord(O),this._convertFromCellCoord(V),this._convertFromCellCoord(O+1),this._convertFromCellCoord(V+1)))&&f.call(this,t,r,o,c,tt,m,x,b))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,r=3+this.cells.length+1+1,o=0;for(let m=0;m<this.cells.length;m++)o+=this.cells[m].length;let c=new Int32Array(r+o+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let f=r;for(let m=0;m<t.length;m++){let x=t[m];c[3+m]=f,c.set(x,f),f+=x.length}return c[3+t.length]=f,c.set(this.keys,f),f+=this.keys.length,c[3+t.length+1]=f,c.set(this.bboxes,f),f+=this.bboxes.length,c.buffer}static serialize(t,r){let o=t.toArrayBuffer();return r&&r.push(o),{buffer:o}}static deserialize(t){return new Vn(t.buffer)}}let Ms={};function te(i,t,r={}){Object.defineProperty(t,"_classRegistryKey",{value:i,writeable:!1}),Ms[i]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}te("Object",Object),te("TransferableGridIndex",Vn),te("Color",P),te("Error",Error),te("AJAXError",Je),te("ResolvedImage",at),te("StylePropertyFunction",_s),te("StyleExpression",Ko,{omit:["_evaluator"]}),te("ZoomDependentExpression",Oa),te("ZoomConstantExpression",Fa),te("CompoundExpression",Me,{omit:["_evaluate"]});for(let i in gs)gs[i]._classRegistryKey||te(`Expression_${i}`,gs[i]);function el(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function Qs(i,t){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob)return i;if(el(i)||Bi(i))return t&&t.push(i),i;if(ArrayBuffer.isView(i)){let r=i;return t&&t.push(r.buffer),r}if(i instanceof ImageData)return t&&t.push(i.data.buffer),i;if(Array.isArray(i)){let r=[];for(let o of i)r.push(Qs(o,t));return r}if(typeof i=="object"){let r=i.constructor,o=r._classRegistryKey;if(!o)throw new Error("can't serialize object of unregistered class");let c=r.serialize?r.serialize(i,t):{};if(!r.serialize){for(let f in i){if(!i.hasOwnProperty(f)||Ms[o].omit.indexOf(f)>=0)continue;let m=i[f];c[f]=Ms[o].shallow.indexOf(f)>=0?m:Qs(m,t)}i instanceof Error&&(c.message=i.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return o!=="Object"&&(c.$name=o),c}throw new Error("can't serialize object of type "+typeof i)}function Gn(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||el(i)||Bi(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Gn);if(typeof i=="object"){let t=i.$name||"Object";if(!Ms[t])throw new Error(`can't deserialize unregistered class ${t}`);let{klass:r}=Ms[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(i);let o=Object.create(r.prototype);for(let c of Object.keys(i)){if(c==="$name")continue;let f=i[c];o[c]=Ms[t].shallow.indexOf(c)>=0?f:Gn(f)}return o}throw new Error("can't deserialize object of type "+typeof i)}class ta{constructor(){this.first=!0}update(t,r){let 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=r):this.lastFloorZoom<o&&(this.lastIntegerZoom=o,this.lastIntegerZoomTime=r),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=o,!0))}}let Zt={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function il(i){for(let t of i)if(ea(t.charCodeAt(0)))return!0;return!1}function fh(i){for(let t of i)if(!Vc(t.charCodeAt(0)))return!1;return!0}function Vc(i){return!(Zt.Arabic(i)||Zt["Arabic Supplement"](i)||Zt["Arabic Extended-A"](i)||Zt["Arabic Presentation Forms-A"](i)||Zt["Arabic Presentation Forms-B"](i))}function ea(i){return!(i!==746&&i!==747&&(i<4352||!(Zt["Bopomofo Extended"](i)||Zt.Bopomofo(i)||Zt["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Zt["CJK Compatibility Ideographs"](i)||Zt["CJK Compatibility"](i)||Zt["CJK Radicals Supplement"](i)||Zt["CJK Strokes"](i)||!(!Zt["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Zt["CJK Unified Ideographs Extension A"](i)||Zt["CJK Unified Ideographs"](i)||Zt["Enclosed CJK Letters and Months"](i)||Zt["Hangul Compatibility Jamo"](i)||Zt["Hangul Jamo Extended-A"](i)||Zt["Hangul Jamo Extended-B"](i)||Zt["Hangul Jamo"](i)||Zt["Hangul Syllables"](i)||Zt.Hiragana(i)||Zt["Ideographic Description Characters"](i)||Zt.Kanbun(i)||Zt["Kangxi Radicals"](i)||Zt["Katakana Phonetic Extensions"](i)||Zt.Katakana(i)&&i!==12540||!(!Zt["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Zt["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Zt["Unified Canadian Aboriginal Syllabics"](i)||Zt["Unified Canadian Aboriginal Syllabics Extended"](i)||Zt["Vertical Forms"](i)||Zt["Yijing Hexagram Symbols"](i)||Zt["Yi Syllables"](i)||Zt["Yi Radicals"](i))))}function mh(i){return!(ea(i)||function(t){return!!(Zt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||Zt["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||Zt["Letterlike Symbols"](t)||Zt["Number Forms"](t)||Zt["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||Zt["Control Pictures"](t)&&t!==9251||Zt["Optical Character Recognition"](t)||Zt["Enclosed Alphanumerics"](t)||Zt["Geometric Shapes"](t)||Zt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Zt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Zt["CJK Symbols and Punctuation"](t)||Zt.Katakana(t)||Zt["Private Use Area"](t)||Zt["CJK Compatibility Forms"](t)||Zt["Small Form Variants"](t)||Zt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(i))}function gh(i){return i>=1424&&i<=2303||Zt["Arabic Presentation Forms-A"](i)||Zt["Arabic Presentation Forms-B"](i)}function Gc(i,t){return!(!t&&gh(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Zt.Khmer(i))}function qc(i){for(let t of i)if(gh(t.charCodeAt(0)))return!0;return!1}let $a="deferred",rl="loading",nl="loaded",sl=null,hr="unavailable",Tn=null,yh=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(hr="error"),sl&&sl(i)};function al(){Ss.fire(new xt("pluginStateChange",{pluginStatus:hr,pluginURL:Tn}))}let Ss=new Ut,ol=function(){return hr},Wa=function(){if(hr!==$a||!Tn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");hr=rl,al(),Tn&&Dr({url:Tn},i=>{i?yh(i):(hr=nl,al())})},Rr={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>hr===nl||Rr.applyArabicShaping!=null,isLoading:()=>hr===rl,setState(i){hr=i.pluginStatus,Tn=i.pluginURL},isParsed:()=>Rr.applyArabicShaping!=null&&Rr.processBidirectionalText!=null&&Rr.processStyledBidirectionalText!=null,getPluginURL:()=>Tn};class hi{constructor(t,r){this.zoom=t,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ta,this.transition={})}isSupportedScript(t){return function(r,o){for(let c of r)if(!Gc(c.charCodeAt(0),o))return!1;return!0}(t,Rr.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,r=t-Math.floor(t),o=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*o}:{fromScale:.5,toScale:1,t:1-(1-o)*r}}}class Za{constructor(t,r){this.property=t,this.value=r,this.expression=function(o,c){if(ka(o))return new _s(o,c);if(Ra(o)){let f=Yo(o,c);if(f.result==="error")throw new Error(f.value.map(m=>`${m.key}: ${m.message}`).join(", "));return f.value}{let f=o;return typeof o=="string"&&c.type==="color"&&(f=P.parse(o)),{kind:"constant",evaluate:()=>f}}}(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,o){return this.property.possiblyEvaluate(this,t,r,o)}}class Ha{constructor(t){this.property=t,this.value=new Za(t,void 0)}transitioned(t,r){return new _h(this.property,this.value,r,pt({},t.transition,this.transition),t.now)}untransitioned(){return new _h(this.property,this.value,null,{},0)}}class ll{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return Nt(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ha(this._values[t].property)),this._values[t].value=new Za(this._values[t].property,r===null?void 0:Nt(r))}getTransition(t){return Nt(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ha(this._values[t].property)),this._values[t].transition=Nt(r)||void 0}serialize(){let t={};for(let r of Object.keys(this._values)){let o=this.getValue(r);o!==void 0&&(t[r]=o);let c=this.getTransition(r);c!==void 0&&(t[`${r}-transition`]=c)}return t}transitioned(t,r){let o=new xh(this._properties);for(let c of Object.keys(this._values))o._values[c]=this._values[c].transitioned(t,r._values[c]);return o}untransitioned(){let t=new xh(this._properties);for(let r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class _h{constructor(t,r,o,c,f){this.property=t,this.value=r,this.begin=f+c.delay||0,this.end=this.begin+c.duration||0,t.specification.transition&&(c.delay||c.duration)&&(this.prior=o)}possiblyEvaluate(t,r,o){let c=t.now||0,f=this.value.possiblyEvaluate(t,r,o),m=this.prior;if(m){if(c>this.end)return this.prior=null,f;if(this.value.isDataDriven())return this.prior=null,f;if(c<this.begin)return m.possiblyEvaluate(t,r,o);{let x=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(m.possiblyEvaluate(t,r,o),f,function(b){if(b<=0)return 0;if(b>=1)return 1;let S=b*b,A=S*b;return 4*(b<.5?A:3*(b-S)+A-.75)}(x))}}return f}}class xh{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,o){let c=new Xa(this._properties);for(let f of Object.keys(this._values))c._values[f]=this._values[f].possiblyEvaluate(t,r,o);return c}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class jc{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return Nt(this._values[t].value)}setValue(t,r){this._values[t]=new Za(this._values[t].property,r===null?void 0:Nt(r))}serialize(){let t={};for(let r of Object.keys(this._values)){let o=this.getValue(r);o!==void 0&&(t[r]=o)}return t}possiblyEvaluate(t,r,o){let c=new Xa(this._properties);for(let f of Object.keys(this._values))c._values[f]=this._values[f].possiblyEvaluate(t,r,o);return c}}class nn{constructor(t,r,o){this.property=t,this.value=r,this.parameters=o}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,o,c){return this.property.evaluate(this.value,this.parameters,t,r,o,c)}}class Xa{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class ne{constructor(t){this.specification=t}possiblyEvaluate(t,r){return t.expression.evaluate(r)}interpolate(t,r,o){let c=$s[this.specification.type];return c?c(t,r,o):t}}class de{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,o,c){return new nn(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},o,c)}:t.expression,r)}interpolate(t,r,o){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new nn(this,{kind:"constant",value:void 0},t.parameters);let c=$s[this.specification.type];return c?new nn(this,{kind:"constant",value:c(t.value.value,r.value.value,o)},t.parameters):t}evaluate(t,r,o,c,f,m){return t.kind==="constant"?t.value:t.evaluate(r,o,c,f,m)}}class ia extends de{possiblyEvaluate(t,r,o,c){if(t.value===void 0)return new nn(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){let f=t.expression.evaluate(r,null,{},o,c),m=t.property.specification.type==="resolvedImage"&&typeof f!="string"?f.name:f,x=this._calculate(m,m,m,r);return new nn(this,{kind:"constant",value:x},r)}if(t.expression.kind==="camera"){let f=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new nn(this,{kind:"constant",value:f},r)}return new nn(this,t.expression,r)}evaluate(t,r,o,c,f,m){if(t.kind==="source"){let x=t.evaluate(r,o,c,f,m);return this._calculate(x,x,x,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},o,c),t.evaluate({zoom:Math.floor(r.zoom)},o,c),t.evaluate({zoom:Math.floor(r.zoom)+1},o,c),r):t.value}_calculate(t,r,o,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:o,to:r}}interpolate(t){return t}}class ra{constructor(t){this.specification=t}possiblyEvaluate(t,r,o,c){if(t.value!==void 0){if(t.expression.kind==="constant"){let f=t.expression.evaluate(r,null,{},o,c);return this._calculate(f,f,f,r)}return this._calculate(t.expression.evaluate(new hi(Math.floor(r.zoom-1),r)),t.expression.evaluate(new hi(Math.floor(r.zoom),r)),t.expression.evaluate(new hi(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,o,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:o,to:r}}interpolate(t){return t}}class hl{constructor(t){this.specification=t}possiblyEvaluate(t,r,o,c){return!!t.expression.evaluate(r,null,{},o,c)}interpolate(){return!1}}class Fi{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in t){let o=t[r];o.specification.overridable&&this.overridableProperties.push(r);let c=this.defaultPropertyValues[r]=new Za(o,void 0),f=this.defaultTransitionablePropertyValues[r]=new Ha(o);this.defaultTransitioningPropertyValues[r]=f.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=c.possiblyEvaluate({})}}}te("DataDrivenProperty",de),te("DataConstantProperty",ne),te("CrossFadedDataDrivenProperty",ia),te("CrossFadedProperty",ra),te("ColorRampProperty",hl);let qn="-transition";class cr extends Ut{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=(t=t).metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),r.layout&&(this._unevaluatedLayout=new jc(r.layout)),r.paint)){this._transitionablePaint=new ll(r.paint);for(let o in t.paint)this.setPaintProperty(o,t.paint[o],{validate:!1});for(let o in t.layout)this.setLayoutProperty(o,t.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Xa(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,r,o={}){r!=null&&this._validate(Uc,`layers.${this.id}.layout.${t}`,t,r,o)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(qn)?this._transitionablePaint.getTransition(t.slice(0,-qn.length)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,o={}){if(r!=null&&this._validate(tl,`layers.${this.id}.paint.${t}`,t,r,o))return!1;if(t.endsWith(qn))return this._transitionablePaint.setTransition(t.slice(0,-qn.length),r||void 0),!1;{let c=this._transitionablePaint._values[t],f=c.property.specification["property-type"]==="cross-faded-data-driven",m=c.value.isDataDriven(),x=c.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);let b=this._transitionablePaint._values[t].value;return b.isDataDriven()||m||f||this._handleOverridablePaintPropertyUpdate(t,x,b)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,o){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}serialize(){let t={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&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),Lt(t,(r,o)=>!(r===void 0||o==="layout"&&!Object.keys(r).length||o==="paint"&&!Object.keys(r).length))}_validate(t,r,o,c,f={}){return(!f||f.validate!==!1)&&dh(this,t.call(Un,{key:r,layerType:this.type,objectKey:o,value:c,styleSpec:ct,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let r=this.paint.get(t);if(r instanceof nn&&ys(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}let $c={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class na{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class oi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Oi(i,t=1){let r=0,o=0;return{members:i.map(c=>{let f=$c[c.type].BYTES_PER_ELEMENT,m=r=vh(r,Math.max(t,f)),x=c.components||1;return o=Math.max(o,f),r+=f*x,{name:c.name,type:c.type,components:x,offset:m}}),size:vh(r,Math.max(o,t)),alignment:t}}function vh(i,t){return Math.ceil(i/t)*t}class Ts extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){let o=this.length;return this.resize(o+1),this.emplace(o,t,r)}emplace(t,r,o){let c=2*t;return this.int16[c+0]=r,this.int16[c+1]=o,t}}Ts.prototype.bytesPerElement=4,te("StructArrayLayout2i4",Ts);class sa extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o,c){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,o,c)}emplace(t,r,o,c,f){let m=4*t;return this.int16[m+0]=r,this.int16[m+1]=o,this.int16[m+2]=c,this.int16[m+3]=f,t}}sa.prototype.bytesPerElement=8,te("StructArrayLayout4i8",sa);class p extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o,c,f,m){let x=this.length;return this.resize(x+1),this.emplace(x,t,r,o,c,f,m)}emplace(t,r,o,c,f,m,x){let b=6*t;return this.int16[b+0]=r,this.int16[b+1]=o,this.int16[b+2]=c,this.int16[b+3]=f,this.int16[b+4]=m,this.int16[b+5]=x,t}}p.prototype.bytesPerElement=12,te("StructArrayLayout2i4i12",p);class e extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o,c,f,m){let x=this.length;return this.resize(x+1),this.emplace(x,t,r,o,c,f,m)}emplace(t,r,o,c,f,m,x){let b=4*t,S=8*t;return this.int16[b+0]=r,this.int16[b+1]=o,this.uint8[S+4]=c,this.uint8[S+5]=f,this.uint8[S+6]=m,this.uint8[S+7]=x,t}}e.prototype.bytesPerElement=8,te("StructArrayLayout2i4ub8",e);class n extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){let o=this.length;return this.resize(o+1),this.emplace(o,t,r)}emplace(t,r,o){let c=2*t;return this.float32[c+0]=r,this.float32[c+1]=o,t}}n.prototype.bytesPerElement=8,te("StructArrayLayout2f8",n);class h extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,o,c,f,m,x,b,S,A){let z=this.length;return this.resize(z+1),this.emplace(z,t,r,o,c,f,m,x,b,S,A)}emplace(t,r,o,c,f,m,x,b,S,A,z){let D=10*t;return this.uint16[D+0]=r,this.uint16[D+1]=o,this.uint16[D+2]=c,this.uint16[D+3]=f,this.uint16[D+4]=m,this.uint16[D+5]=x,this.uint16[D+6]=b,this.uint16[D+7]=S,this.uint16[D+8]=A,this.uint16[D+9]=z,t}}h.prototype.bytesPerElement=20,te("StructArrayLayout10ui20",h);class d extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,o,c,f,m,x,b,S,A,z,D){let O=this.length;return this.resize(O+1),this.emplace(O,t,r,o,c,f,m,x,b,S,A,z,D)}emplace(t,r,o,c,f,m,x,b,S,A,z,D,O){let V=12*t;return this.int16[V+0]=r,this.int16[V+1]=o,this.int16[V+2]=c,this.int16[V+3]=f,this.uint16[V+4]=m,this.uint16[V+5]=x,this.uint16[V+6]=b,this.uint16[V+7]=S,this.int16[V+8]=A,this.int16[V+9]=z,this.int16[V+10]=D,this.int16[V+11]=O,t}}d.prototype.bytesPerElement=24,te("StructArrayLayout4i4ui4i24",d);class g extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,o){let c=this.length;return this.resize(c+1),this.emplace(c,t,r,o)}emplace(t,r,o,c){let f=3*t;return this.float32[f+0]=r,this.float32[f+1]=o,this.float32[f+2]=c,t}}g.prototype.bytesPerElement=12,te("StructArrayLayout3f12",g);class v extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}v.prototype.bytesPerElement=4,te("StructArrayLayout1ul4",v);class w extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,o,c,f,m,x,b,S){let A=this.length;return this.resize(A+1),this.emplace(A,t,r,o,c,f,m,x,b,S)}emplace(t,r,o,c,f,m,x,b,S,A){let z=10*t,D=5*t;return this.int16[z+0]=r,this.int16[z+1]=o,this.int16[z+2]=c,this.int16[z+3]=f,this.int16[z+4]=m,this.int16[z+5]=x,this.uint32[D+3]=b,this.uint16[z+8]=S,this.uint16[z+9]=A,t}}w.prototype.bytesPerElement=20,te("StructArrayLayout6i1ul2ui20",w);class M extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o,c,f,m){let x=this.length;return this.resize(x+1),this.emplace(x,t,r,o,c,f,m)}emplace(t,r,o,c,f,m,x){let b=6*t;return this.int16[b+0]=r,this.int16[b+1]=o,this.int16[b+2]=c,this.int16[b+3]=f,this.int16[b+4]=m,this.int16[b+5]=x,t}}M.prototype.bytesPerElement=12,te("StructArrayLayout2i2i2i12",M);class C extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o,c,f){let m=this.length;return this.resize(m+1),this.emplace(m,t,r,o,c,f)}emplace(t,r,o,c,f,m){let x=4*t,b=8*t;return this.float32[x+0]=r,this.float32[x+1]=o,this.float32[x+2]=c,this.int16[b+6]=f,this.int16[b+7]=m,t}}C.prototype.bytesPerElement=16,te("StructArrayLayout2f1f2i16",C);class k extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,o,c){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,o,c)}emplace(t,r,o,c,f){let m=12*t,x=3*t;return this.uint8[m+0]=r,this.uint8[m+1]=o,this.float32[x+1]=c,this.float32[x+2]=f,t}}k.prototype.bytesPerElement=12,te("StructArrayLayout2ub2f12",k);class F extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,o){let c=this.length;return this.resize(c+1),this.emplace(c,t,r,o)}emplace(t,r,o,c){let f=3*t;return this.uint16[f+0]=r,this.uint16[f+1]=o,this.uint16[f+2]=c,t}}F.prototype.bytesPerElement=6,te("StructArrayLayout3ui6",F);class q extends oi{_refreshViews(){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)}emplaceBack(t,r,o,c,f,m,x,b,S,A,z,D,O,V,tt,et,dt){let bt=this.length;return this.resize(bt+1),this.emplace(bt,t,r,o,c,f,m,x,b,S,A,z,D,O,V,tt,et,dt)}emplace(t,r,o,c,f,m,x,b,S,A,z,D,O,V,tt,et,dt,bt){let vt=24*t,Et=12*t,Rt=48*t;return this.int16[vt+0]=r,this.int16[vt+1]=o,this.uint16[vt+2]=c,this.uint16[vt+3]=f,this.uint32[Et+2]=m,this.uint32[Et+3]=x,this.uint32[Et+4]=b,this.uint16[vt+10]=S,this.uint16[vt+11]=A,this.uint16[vt+12]=z,this.float32[Et+7]=D,this.float32[Et+8]=O,this.uint8[Rt+36]=V,this.uint8[Rt+37]=tt,this.uint8[Rt+38]=et,this.uint32[Et+10]=dt,this.int16[vt+22]=bt,t}}q.prototype.bytesPerElement=48,te("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",q);class Q extends oi{_refreshViews(){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)}emplaceBack(t,r,o,c,f,m,x,b,S,A,z,D,O,V,tt,et,dt,bt,vt,Et,Rt,Pt,ee,le,Xt,Kt,Wt,Qt){let Yt=this.length;return this.resize(Yt+1),this.emplace(Yt,t,r,o,c,f,m,x,b,S,A,z,D,O,V,tt,et,dt,bt,vt,Et,Rt,Pt,ee,le,Xt,Kt,Wt,Qt)}emplace(t,r,o,c,f,m,x,b,S,A,z,D,O,V,tt,et,dt,bt,vt,Et,Rt,Pt,ee,le,Xt,Kt,Wt,Qt,Yt){let Gt=34*t,fe=17*t;return this.int16[Gt+0]=r,this.int16[Gt+1]=o,this.int16[Gt+2]=c,this.int16[Gt+3]=f,this.int16[Gt+4]=m,this.int16[Gt+5]=x,this.int16[Gt+6]=b,this.int16[Gt+7]=S,this.uint16[Gt+8]=A,this.uint16[Gt+9]=z,this.uint16[Gt+10]=D,this.uint16[Gt+11]=O,this.uint16[Gt+12]=V,this.uint16[Gt+13]=tt,this.uint16[Gt+14]=et,this.uint16[Gt+15]=dt,this.uint16[Gt+16]=bt,this.uint16[Gt+17]=vt,this.uint16[Gt+18]=Et,this.uint16[Gt+19]=Rt,this.uint16[Gt+20]=Pt,this.uint16[Gt+21]=ee,this.uint16[Gt+22]=le,this.uint32[fe+12]=Xt,this.float32[fe+13]=Kt,this.float32[fe+14]=Wt,this.float32[fe+15]=Qt,this.float32[fe+16]=Yt,t}}Q.prototype.bytesPerElement=68,te("StructArrayLayout8i15ui1ul4f68",Q);class j extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}j.prototype.bytesPerElement=4,te("StructArrayLayout1f4",j);class J extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,o){let c=this.length;return this.resize(c+1),this.emplace(c,t,r,o)}emplace(t,r,o,c){let f=3*t;return this.int16[f+0]=r,this.int16[f+1]=o,this.int16[f+2]=c,t}}J.prototype.bytesPerElement=6,te("StructArrayLayout3i6",J);class lt extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,o){let c=this.length;return this.resize(c+1),this.emplace(c,t,r,o)}emplace(t,r,o,c){let f=4*t;return this.uint32[2*t+0]=r,this.uint16[f+2]=o,this.uint16[f+3]=c,t}}lt.prototype.bytesPerElement=8,te("StructArrayLayout1ul2ui8",lt);class ht extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){let o=this.length;return this.resize(o+1),this.emplace(o,t,r)}emplace(t,r,o){let c=2*t;return this.uint16[c+0]=r,this.uint16[c+1]=o,t}}ht.prototype.bytesPerElement=4,te("StructArrayLayout2ui4",ht);class mt extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}mt.prototype.bytesPerElement=2,te("StructArrayLayout1ui2",mt);class ut extends oi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,o,c){let f=this.length;return this.resize(f+1),this.emplace(f,t,r,o,c)}emplace(t,r,o,c,f){let m=4*t;return this.float32[m+0]=r,this.float32[m+1]=o,this.float32[m+2]=c,this.float32[m+3]=f,t}}ut.prototype.bytesPerElement=16,te("StructArrayLayout4f16",ut);class At extends na{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new ye(this.anchorPointX,this.anchorPointY)}}At.prototype.size=20;class Mt extends w{get(t){return new At(this,t)}}te("CollisionBoxArray",Mt);class Tt extends na{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Tt.prototype.size=48;class Ft extends q{get(t){return new Tt(this,t)}}te("PlacedSymbolArray",Ft);class jt extends na{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}jt.prototype.size=68;class It extends Q{get(t){return new jt(this,t)}}te("SymbolInstanceArray",It);class ie extends j{getoffsetX(t){return this.float32[1*t+0]}}te("GlyphOffsetArray",ie);class Ht extends J{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}te("SymbolLineVertexArray",Ht);class xe extends na{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}xe.prototype.size=8;class Fe extends lt{get(t){return new xe(this,t)}}te("FeatureIndexArray",Fe);class ke extends Ts{}class Re extends Ts{}class yi extends p{}class be extends e{}class qe extends n{}class ti extends h{}class Zi extends d{}class vr extends g{}class Br extends v{}class Fr extends M{}class En extends k{}class ur extends F{}class sn extends ht{}let jn=Oi([{name:"a_pos",components:2,type:"Int16"}],4),{members:br}=jn;class je{constructor(t=[]){this.segments=t}prepareSegment(t,r,o,c){let f=this.segments[this.segments.length-1];return t>je.MAX_VERTEX_ARRAY_LENGTH&&oe(`Max vertices per segment is ${je.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!f||f.vertexLength+t>je.MAX_VERTEX_ARRAY_LENGTH||f.sortKey!==c)&&(f={vertexOffset:r.length,primitiveOffset:o.length,vertexLength:0,primitiveLength:0},c!==void 0&&(f.sortKey=c),this.segments.push(f)),f}get(){return this.segments}destroy(){for(let t of this.segments)for(let r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,o,c){return new je([{vertexOffset:t,primitiveOffset:r,vertexLength:o,primitiveLength:c,vaos:{},sortKey:0}])}}function He(i,t){return 256*(i=L(Math.floor(i),0,255))+L(Math.floor(t),0,255)}je.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,te("SegmentVector",je);let Ai=Oi([{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"}]);var nr={exports:{}},ci={exports:{}};ci.exports=function(i,t){var r,o,c,f,m,x,b,S;for(o=i.length-(r=3&i.length),c=t,m=3432918353,x=461845907,S=0;S<o;)b=255&i.charCodeAt(S)|(255&i.charCodeAt(++S))<<8|(255&i.charCodeAt(++S))<<16|(255&i.charCodeAt(++S))<<24,++S,c=27492+(65535&(f=5*(65535&(c=(c^=b=(65535&(b=(b=(65535&b)*m+(((b>>>16)*m&65535)<<16)&4294967295)<<15|b>>>17))*x+(((b>>>16)*x&65535)<<16)&4294967295)<<13|c>>>19))+((5*(c>>>16)&65535)<<16)&4294967295))+((58964+(f>>>16)&65535)<<16);switch(b=0,r){case 3:b^=(255&i.charCodeAt(S+2))<<16;case 2:b^=(255&i.charCodeAt(S+1))<<8;case 1:c^=b=(65535&(b=(b=(65535&(b^=255&i.charCodeAt(S)))*m+(((b>>>16)*m&65535)<<16)&4294967295)<<15|b>>>17))*x+(((b>>>16)*x&65535)<<16)&4294967295}return c^=i.length,c=2246822507*(65535&(c^=c>>>16))+((2246822507*(c>>>16)&65535)<<16)&4294967295,c=3266489909*(65535&(c^=c>>>13))+((3266489909*(c>>>16)&65535)<<16)&4294967295,(c^=c>>>16)>>>0};var $n={exports:{}};$n.exports=function(i,t){for(var r,o=i.length,c=t^o,f=0;o>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(f)|(255&i.charCodeAt(++f))<<8|(255&i.charCodeAt(++f))<<16|(255&i.charCodeAt(++f))<<24))+((1540483477*(r>>>16)&65535)<<16),c=1540483477*(65535&c)+((1540483477*(c>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),o-=4,++f;switch(o){case 3:c^=(255&i.charCodeAt(f+2))<<16;case 2:c^=(255&i.charCodeAt(f+1))<<8;case 1:c=1540483477*(65535&(c^=255&i.charCodeAt(f)))+((1540483477*(c>>>16)&65535)<<16)}return c=1540483477*(65535&(c^=c>>>13))+((1540483477*(c>>>16)&65535)<<16),(c^=c>>>15)>>>0};var an=ci.exports,Ka=$n.exports;nr.exports=an,nr.exports.murmur3=an,nr.exports.murmur2=Ka;var cl=nr.exports;class Ya{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,o,c){this.ids.push(bh(t)),this.positions.push(r,o,c)}getPositions(t){let r=bh(t),o=0,c=this.ids.length-1;for(;o<c;){let m=o+c>>1;this.ids[m]>=r?c=m:o=m+1}let f=[];for(;this.ids[o]===r;)f.push({index:this.positions[3*o],start:this.positions[3*o+1],end:this.positions[3*o+2]}),o++;return f}static serialize(t,r){let o=new Float64Array(t.ids),c=new Uint32Array(t.positions);return Wn(o,c,0,o.length-1),r&&r.push(o.buffer,c.buffer),{ids:o,positions:c}}static deserialize(t){let r=new Ya;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function bh(i){let t=+i;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:cl(String(i))}function Wn(i,t,r,o){for(;r<o;){let c=i[r+o>>1],f=r-1,m=o+1;for(;;){do f++;while(i[f]<c);do m--;while(i[m]>c);if(f>=m)break;Ja(i,f,m),Ja(t,3*f,3*m),Ja(t,3*f+1,3*m+1),Ja(t,3*f+2,3*m+2)}m-r<o-m?(Wn(i,t,r,m),r=m+1):(Wn(i,t,m+1,o),o=m)}}function Ja(i,t,r){let o=i[t];i[t]=i[r],i[r]=o}te("FeaturePositionMap",Ya);class on{constructor(t,r){this.gl=t.gl,this.location=r}}class Es extends on{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class ap extends on{constructor(t,r){super(t,r),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class op extends on{constructor(t,r){super(t,r),this.current=P.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}let ng=new Float32Array(16);function Wc(i){return[He(255*i.r,255*i.g),He(255*i.b,255*i.a)]}class ul{constructor(t,r,o){this.value=t,this.uniformNames=r.map(c=>`u_${c}`),this.type=o}setUniform(t,r,o){t.set(o.constantOr(this.value))}getBinding(t,r,o){return this.type==="color"?new op(t,r):new Es(t,r)}}class Qa{constructor(t,r){this.uniformNames=r.map(o=>`u_${o}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,o,c){let f=c==="u_pattern_to"?this.patternTo:c==="u_pattern_from"?this.patternFrom:c==="u_pixel_ratio_to"?this.pixelRatioTo:c==="u_pixel_ratio_from"?this.pixelRatioFrom:null;f&&t.set(f)}getBinding(t,r,o){return o.substr(0,9)==="u_pattern"?new ap(t,r):new Es(t,r)}}class Zn{constructor(t,r,o,c){this.expression=t,this.type=o,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:o==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(t,r,o,c,f){let m=this.paintVertexArray.length,x=this.expression.evaluate(new hi(0),r,{},c,[],f);this.paintVertexArray.resize(t),this._setPaintValue(m,t,x)}updatePaintArray(t,r,o,c){let f=this.expression.evaluate({zoom:0},o,c);this._setPaintValue(t,r,f)}_setPaintValue(t,r,o){if(this.type==="color"){let c=Wc(o);for(let f=t;f<r;f++)this.paintVertexArray.emplace(f,c[0],c[1])}else{for(let c=t;c<r;c++)this.paintVertexArray.emplace(c,o);this.maxValue=Math.max(this.maxValue,Math.abs(o))}}upload(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))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class mn{constructor(t,r,o,c,f,m){this.expression=t,this.uniformNames=r.map(x=>`u_${x}_t`),this.type=o,this.useIntegerZoom=c,this.zoom=f,this.maxValue=0,this.paintVertexAttributes=r.map(x=>({name:`a_${x}`,type:"Float32",components:o==="color"?4:2,offset:0})),this.paintVertexArray=new m}populatePaintArray(t,r,o,c,f){let m=this.expression.evaluate(new hi(this.zoom),r,{},c,[],f),x=this.expression.evaluate(new hi(this.zoom+1),r,{},c,[],f),b=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(b,t,m,x)}updatePaintArray(t,r,o,c){let f=this.expression.evaluate({zoom:this.zoom},o,c),m=this.expression.evaluate({zoom:this.zoom+1},o,c);this._setPaintValue(t,r,f,m)}_setPaintValue(t,r,o,c){if(this.type==="color"){let f=Wc(o),m=Wc(c);for(let x=t;x<r;x++)this.paintVertexArray.emplace(x,f[0],f[1],m[0],m[1])}else{for(let f=t;f<r;f++)this.paintVertexArray.emplace(f,o,c);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(c))}}upload(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))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,r){let o=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,c=L(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);t.set(c)}getBinding(t,r,o){return new Es(t,r)}}class Is{constructor(t,r,o,c,f,m){this.expression=t,this.type=r,this.useIntegerZoom=o,this.zoom=c,this.layerId=m,this.zoomInPaintVertexArray=new f,this.zoomOutPaintVertexArray=new f}populatePaintArray(t,r,o){let c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(c,t,r.patterns&&r.patterns[this.layerId],o)}updatePaintArray(t,r,o,c,f){this._setPaintValues(t,r,o.patterns&&o.patterns[this.layerId],f)}_setPaintValues(t,r,o,c){if(!c||!o)return;let{min:f,mid:m,max:x}=o,b=c[f],S=c[m],A=c[x];if(b&&S&&A)for(let z=t;z<r;z++)this.zoomInPaintVertexArray.emplace(z,S.tl[0],S.tl[1],S.br[0],S.br[1],b.tl[0],b.tl[1],b.br[0],b.br[1],S.pixelRatio,b.pixelRatio),this.zoomOutPaintVertexArray.emplace(z,S.tl[0],S.tl[1],S.br[0],S.br[1],A.tl[0],A.tl[1],A.br[0],A.br[1],S.pixelRatio,A.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Ai.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Ai.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class lp{constructor(t,r,o){this.binders={},this._buffers=[];let c=[];for(let f in t.paint._values){if(!o(f))continue;let m=t.paint.get(f);if(!(m instanceof nn&&ys(m.property.specification)))continue;let x=sg(f,t.type),b=m.value,S=m.property.specification.type,A=m.property.useIntegerZoom,z=m.property.specification["property-type"],D=z==="cross-faded"||z==="cross-faded-data-driven";if(b.kind==="constant")this.binders[f]=D?new Qa(b.value,x):new ul(b.value,x,S),c.push(`/u_${f}`);else if(b.kind==="source"||D){let O=hp(f,S,"source");this.binders[f]=D?new Is(b,S,A,r,O,t.id):new Zn(b,x,S,O),c.push(`/a_${f}`)}else{let O=hp(f,S,"composite");this.binders[f]=new mn(b,x,S,A,r,O),c.push(`/z_${f}`)}}this.cacheKey=c.sort().join("")}getMaxValue(t){let r=this.binders[t];return r instanceof Zn||r instanceof mn?r.maxValue:0}populatePaintArrays(t,r,o,c,f){for(let m in this.binders){let x=this.binders[m];(x instanceof Zn||x instanceof mn||x instanceof Is)&&x.populatePaintArray(t,r,o,c,f)}}setConstantPatternPositions(t,r){for(let o in this.binders){let c=this.binders[o];c instanceof Qa&&c.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,o,c,f){let m=!1;for(let x in t){let b=r.getPositions(x);for(let S of b){let A=o.feature(S.index);for(let z in this.binders){let D=this.binders[z];if((D instanceof Zn||D instanceof mn||D instanceof Is)&&D.expression.isStateDependent===!0){let O=c.paint.get(z);D.expression=O.value,D.updatePaintArray(S.start,S.end,A,t[x],f),m=!0}}}}return m}defines(){let t=[];for(let r in this.binders){let o=this.binders[r];(o instanceof ul||o instanceof Qa)&&t.push(...o.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return t}getBinderAttributes(){let t=[];for(let r in this.binders){let o=this.binders[r];if(o instanceof Zn||o instanceof mn)for(let c=0;c<o.paintVertexAttributes.length;c++)t.push(o.paintVertexAttributes[c].name);else if(o instanceof Is)for(let c=0;c<Ai.members.length;c++)t.push(Ai.members[c].name)}return t}getBinderUniforms(){let t=[];for(let r in this.binders){let o=this.binders[r];if(o instanceof ul||o instanceof Qa||o instanceof mn)for(let c of o.uniformNames)t.push(c)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){let o=[];for(let c in this.binders){let f=this.binders[c];if(f instanceof ul||f instanceof Qa||f instanceof mn){for(let m of f.uniformNames)if(r[m]){let x=f.getBinding(t,r[m],m);o.push({name:m,property:c,binding:x})}}}return o}setUniforms(t,r,o,c){for(let{name:f,property:m,binding:x}of r)this.binders[m].setUniform(x,c,o.get(m),f)}updatePaintBuffers(t){this._buffers=[];for(let r in this.binders){let o=this.binders[r];if(t&&o instanceof Is){let c=t.fromScale===2?o.zoomInPaintVertexBuffer:o.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(o instanceof Zn||o instanceof mn)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(t){for(let r in this.binders){let o=this.binders[r];(o instanceof Zn||o instanceof mn||o instanceof Is)&&o.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let r=this.binders[t];(r instanceof Zn||r instanceof mn||r instanceof Is)&&r.destroy()}}}class aa{constructor(t,r,o=()=>!0){this.programConfigurations={};for(let c of t)this.programConfigurations[c.id]=new lp(c,r,o);this.needsUpload=!1,this._featureMap=new Ya,this._bufferOffset=0}populatePaintArrays(t,r,o,c,f,m){for(let x in this.programConfigurations)this.programConfigurations[x].populatePaintArrays(t,r,c,f,m);r.id!==void 0&&this._featureMap.add(r.id,o,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,o,c){for(let f of o)this.needsUpload=this.programConfigurations[f.id].updatePaintArrays(t,this._featureMap,r,f,c)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}}function sg(i,t){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"]}[i]||[i.replace(`${t}-`,"").replace(/-/g,"_")]}function hp(i,t,r){let o={color:{source:n,composite:ut},number:{source:j,composite:n}},c=function(f){return{"line-pattern":{source:ti,composite:ti},"fill-pattern":{source:ti,composite:ti},"fill-extrusion-pattern":{source:ti,composite:ti}}[f]}(i);return c&&c[r]||o[t][r]}te("ConstantBinder",ul),te("CrossFadedConstantBinder",Qa),te("SourceExpressionBinder",Zn),te("CrossFadedCompositeBinder",Is),te("CompositeExpressionBinder",mn),te("ProgramConfiguration",lp,{omit:["_buffers"]}),te("ProgramConfigurationSet",aa);var Ni=8192;let Zc=Math.pow(2,14)-1,cp=-Zc-1;function oa(i){let t=Ni/i.extent,r=i.loadGeometry();for(let o=0;o<r.length;o++){let c=r[o];for(let f=0;f<c.length;f++){let m=c[f],x=Math.round(m.x*t),b=Math.round(m.y*t);m.x=L(x,cp,Zc),m.y=L(b,cp,Zc),(x<m.x||x>m.x+1||b<m.y||b>m.y+1)&&oe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function la(i,t){return{type:i.type,id:i.id,properties:i.properties,geometry:t?oa(i):[]}}function wh(i,t,r,o,c){i.emplaceBack(2*t+(o+1)/2,2*r+(c+1)/2)}class Hc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ke,this.indexArray=new ur,this.segments=new je,this.programConfigurations=new aa(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,o){let c=this.layers[0],f=[],m=null,x=!1;c.type==="circle"&&(m=c.layout.get("circle-sort-key"),x=!m.isConstant());for(let{feature:b,id:S,index:A,sourceLayerIndex:z}of t){let D=this.layers[0]._featureFilter.needGeometry,O=la(b,D);if(!this.layers[0]._featureFilter.filter(new hi(this.zoom),O,o))continue;let V=x?m.evaluate(O,{},o):void 0,tt={id:S,properties:b.properties,type:b.type,sourceLayerIndex:z,index:A,geometry:D?O.geometry:oa(b),patterns:{},sortKey:V};f.push(tt)}x&&f.sort((b,S)=>b.sortKey-S.sortKey);for(let b of f){let{geometry:S,index:A,sourceLayerIndex:z}=b,D=t[A].feature;this.addFeature(b,S,A,o),r.featureIndex.insert(D,S,A,z,this.index)}}update(t,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,br),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,o,c){for(let f of r)for(let m of f){let x=m.x,b=m.y;if(x<0||x>=Ni||b<0||b>=Ni)continue;let S=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),A=S.vertexLength;wh(this.layoutVertexArray,x,b,-1,-1),wh(this.layoutVertexArray,x,b,1,-1),wh(this.layoutVertexArray,x,b,1,1),wh(this.layoutVertexArray,x,b,-1,1),this.indexArray.emplaceBack(A,A+1,A+2),this.indexArray.emplaceBack(A,A+3,A+2),S.vertexLength+=4,S.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,o,{},c)}}function up(i,t){for(let r=0;r<i.length;r++)if(to(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(to(i,t[r]))return!0;return!!Xc(i,t)}function ag(i,t,r){return!!to(i,t)||!!Kc(t,i,r)}function pp(i,t){if(i.length===1)return fp(t,i[0]);for(let r=0;r<t.length;r++){let o=t[r];for(let c=0;c<o.length;c++)if(to(i,o[c]))return!0}for(let r=0;r<i.length;r++)if(fp(t,i[r]))return!0;for(let r=0;r<t.length;r++)if(Xc(i,t[r]))return!0;return!1}function og(i,t,r){if(i.length>1){if(Xc(i,t))return!0;for(let o=0;o<t.length;o++)if(Kc(t[o],i,r))return!0}for(let o=0;o<i.length;o++)if(Kc(i[o],t,r))return!0;return!1}function Xc(i,t){if(i.length===0||t.length===0)return!1;for(let r=0;r<i.length-1;r++){let o=i[r],c=i[r+1];for(let f=0;f<t.length-1;f++)if(lg(o,c,t[f],t[f+1]))return!0}return!1}function lg(i,t,r,o){return Ee(i,r,o)!==Ee(t,r,o)&&Ee(i,t,r)!==Ee(i,t,o)}function Kc(i,t,r){let o=r*r;if(t.length===1)return i.distSqr(t[0])<o;for(let c=1;c<t.length;c++)if(dp(i,t[c-1],t[c])<o)return!0;return!1}function dp(i,t,r){let o=t.distSqr(r);if(o===0)return i.distSqr(t);let c=((i.x-t.x)*(r.x-t.x)+(i.y-t.y)*(r.y-t.y))/o;return i.distSqr(c<0?t:c>1?r:r.sub(t)._mult(c)._add(t))}function fp(i,t){let r,o,c,f=!1;for(let m=0;m<i.length;m++){r=i[m];for(let x=0,b=r.length-1;x<r.length;b=x++)o=r[x],c=r[b],o.y>t.y!=c.y>t.y&&t.x<(c.x-o.x)*(t.y-o.y)/(c.y-o.y)+o.x&&(f=!f)}return f}function to(i,t){let r=!1;for(let o=0,c=i.length-1;o<i.length;c=o++){let f=i[o],m=i[c];f.y>t.y!=m.y>t.y&&t.x<(m.x-f.x)*(t.y-f.y)/(m.y-f.y)+f.x&&(r=!r)}return r}function hg(i,t,r){let o=r[0],c=r[2];if(i.x<o.x&&t.x<o.x||i.x>c.x&&t.x>c.x||i.y<o.y&&t.y<o.y||i.y>c.y&&t.y>c.y)return!1;let f=Ee(i,t,r[0]);return f!==Ee(i,t,r[1])||f!==Ee(i,t,r[2])||f!==Ee(i,t,r[3])}function pl(i,t,r){let o=t.paint.get(i).value;return o.kind==="constant"?o.value:r.programConfigurations.get(t.id).getMaxValue(i)}function Mh(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Sh(i,t,r,o,c){if(!t[0]&&!t[1])return i;let f=ye.convert(t)._mult(c);r==="viewport"&&f._rotate(-o);let m=[];for(let x=0;x<i.length;x++)m.push(i[x].sub(f));return m}te("CircleBucket",Hc,{omit:["layers"]});let cg=new Fi({"circle-sort-key":new de(ct.layout_circle["circle-sort-key"])});var ug={paint:new Fi({"circle-radius":new de(ct.paint_circle["circle-radius"]),"circle-color":new de(ct.paint_circle["circle-color"]),"circle-blur":new de(ct.paint_circle["circle-blur"]),"circle-opacity":new de(ct.paint_circle["circle-opacity"]),"circle-translate":new ne(ct.paint_circle["circle-translate"]),"circle-translate-anchor":new ne(ct.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new ne(ct.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new ne(ct.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new de(ct.paint_circle["circle-stroke-width"]),"circle-stroke-color":new de(ct.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new de(ct.paint_circle["circle-stroke-opacity"])}),layout:cg},eo=typeof Float32Array<"u"?Float32Array:Array;function Yc(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function mp(i,t,r){var o=t[0],c=t[1],f=t[2],m=t[3],x=t[4],b=t[5],S=t[6],A=t[7],z=t[8],D=t[9],O=t[10],V=t[11],tt=t[12],et=t[13],dt=t[14],bt=t[15],vt=r[0],Et=r[1],Rt=r[2],Pt=r[3];return i[0]=vt*o+Et*x+Rt*z+Pt*tt,i[1]=vt*c+Et*b+Rt*D+Pt*et,i[2]=vt*f+Et*S+Rt*O+Pt*dt,i[3]=vt*m+Et*A+Rt*V+Pt*bt,i[4]=(vt=r[4])*o+(Et=r[5])*x+(Rt=r[6])*z+(Pt=r[7])*tt,i[5]=vt*c+Et*b+Rt*D+Pt*et,i[6]=vt*f+Et*S+Rt*O+Pt*dt,i[7]=vt*m+Et*A+Rt*V+Pt*bt,i[8]=(vt=r[8])*o+(Et=r[9])*x+(Rt=r[10])*z+(Pt=r[11])*tt,i[9]=vt*c+Et*b+Rt*D+Pt*et,i[10]=vt*f+Et*S+Rt*O+Pt*dt,i[11]=vt*m+Et*A+Rt*V+Pt*bt,i[12]=(vt=r[12])*o+(Et=r[13])*x+(Rt=r[14])*z+(Pt=r[15])*tt,i[13]=vt*c+Et*b+Rt*D+Pt*et,i[14]=vt*f+Et*S+Rt*O+Pt*dt,i[15]=vt*m+Et*A+Rt*V+Pt*bt,i}Math.hypot||(Math.hypot=function(){for(var i=0,t=arguments.length;t--;)i+=arguments[t]*arguments[t];return Math.sqrt(i)});var dl,pg=mp;function Th(i,t,r){var o=t[0],c=t[1],f=t[2],m=t[3];return i[0]=r[0]*o+r[4]*c+r[8]*f+r[12]*m,i[1]=r[1]*o+r[5]*c+r[9]*f+r[13]*m,i[2]=r[2]*o+r[6]*c+r[10]*f+r[14]*m,i[3]=r[3]*o+r[7]*c+r[11]*f+r[15]*m,i}function gp(i,t){let r=Th([],[i.x,i.y,0,1],t);return new ye(r[0]/r[3],r[1]/r[3])}dl=new eo(4),eo!=Float32Array&&(dl[0]=0,dl[1]=0,dl[2]=0,dl[3]=0);class yp extends Hc{}te("HeatmapBucket",yp,{omit:["layers"]});var dg={paint:new Fi({"heatmap-radius":new de(ct.paint_heatmap["heatmap-radius"]),"heatmap-weight":new de(ct.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new ne(ct.paint_heatmap["heatmap-intensity"]),"heatmap-color":new hl(ct.paint_heatmap["heatmap-color"]),"heatmap-opacity":new ne(ct.paint_heatmap["heatmap-opacity"])})};function Jc(i,{width:t,height:r},o,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==t*r*o)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${t*r*o}`)}else c=new Uint8Array(t*r*o);return i.width=t,i.height=r,i.data=c,i}function _p(i,{width:t,height:r},o){if(t===i.width&&r===i.height)return;let c=Jc({},{width:t,height:r},o);Qc(i,c,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,t),height:Math.min(i.height,r)},o),i.width=t,i.height=r,i.data=c.data}function Qc(i,t,r,o,c,f){if(c.width===0||c.height===0)return t;if(c.width>i.width||c.height>i.height||r.x>i.width-c.width||r.y>i.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>t.width||c.height>t.height||o.x>t.width-c.width||o.y>t.height-c.height)throw new RangeError("out of range destination coordinates for image copy");let m=i.data,x=t.data;for(let b=0;b<c.height;b++){let S=((r.y+b)*i.width+r.x)*f,A=((o.y+b)*t.width+o.x)*f;for(let z=0;z<c.width*f;z++)x[A+z]=m[S+z]}return t}class fl{constructor(t,r){Jc(this,t,1,r)}resize(t){_p(this,t,1)}clone(){return new fl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,o,c,f){Qc(t,r,o,c,f,1)}}class Zr{constructor(t,r){Jc(this,t,4,r)}resize(t){_p(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new Zr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,o,c,f){Qc(t,r,o,c,f,4)}}function xp(i){let t={},r=i.resolution||256,o=i.clips?i.clips.length:1,c=i.image||new Zr({width:r,height:o}),f=(m,x,b)=>{t[i.evaluationKey]=b;let S=i.expression.evaluate(t);c.data[m+x+0]=Math.floor(255*S.r/S.a),c.data[m+x+1]=Math.floor(255*S.g/S.a),c.data[m+x+2]=Math.floor(255*S.b/S.a),c.data[m+x+3]=Math.floor(255*S.a)};if(i.clips)for(let m=0,x=0;m<o;++m,x+=4*r)for(let b=0,S=0;b<r;b++,S+=4){let A=b/(r-1),{start:z,end:D}=i.clips[m];f(x,S,z*(1-A)+D*A)}else for(let m=0,x=0;m<r;m++,x+=4)f(0,x,m/(r-1));return c}te("AlphaImage",fl),te("RGBAImage",Zr);var fg={paint:new Fi({"hillshade-illumination-direction":new ne(ct.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new ne(ct.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new ne(ct.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new ne(ct.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new ne(ct.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new ne(ct.paint_hillshade["hillshade-accent-color"])})};let mg=Oi([{name:"a_pos",components:2,type:"Int16"}],4),{members:gg}=mg;var tu={exports:{}};function Eh(i,t,r){r=r||2;var o,c,f,m,x,b,S,A=t&&t.length,z=A?t[0]*r:i.length,D=vp(i,0,z,r,!0),O=[];if(!D||D.next===D.prev)return O;if(A&&(D=function(tt,et,dt,bt){var vt,Et,Rt,Pt=[];for(vt=0,Et=et.length;vt<Et;vt++)(Rt=vp(tt,et[vt]*bt,vt<Et-1?et[vt+1]*bt:tt.length,bt,!1))===Rt.next&&(Rt.steiner=!0),Pt.push(Sg(Rt));for(Pt.sort(bg),vt=0;vt<Pt.length;vt++)dt=Cs(dt=wg(Pt[vt],dt),dt.next);return dt}(i,t,D,r)),i.length>80*r){o=f=i[0],c=m=i[1];for(var V=r;V<z;V+=r)(x=i[V])<o&&(o=x),(b=i[V+1])<c&&(c=b),x>f&&(f=x),b>m&&(m=b);S=(S=Math.max(f-o,m-c))!==0?1/S:0}return ml(D,O,r,o,c,S),O}function vp(i,t,r,o,c){var f,m;if(c===ru(i,t,r,o)>0)for(f=t;f<r;f+=o)m=Mp(f,i[f],i[f+1],m);else for(f=r-o;f>=t;f-=o)m=Mp(f,i[f],i[f+1],m);return m&&Ih(m,m.next)&&(yl(m),m=m.next),m}function Cs(i,t){if(!i)return i;t||(t=i);var r,o=i;do if(r=!1,o.steiner||!Ih(o,o.next)&&Mi(o.prev,o,o.next)!==0)o=o.next;else{if(yl(o),(o=t=o.prev)===o.next)break;r=!0}while(r||o!==t);return t}function ml(i,t,r,o,c,f,m){if(i){!m&&f&&function(A,z,D,O){var V=A;do V.z===null&&(V.z=eu(V.x,V.y,z,D,O)),V.prevZ=V.prev,V.nextZ=V.next,V=V.next;while(V!==A);V.prevZ.nextZ=null,V.prevZ=null,function(tt){var et,dt,bt,vt,Et,Rt,Pt,ee,le=1;do{for(dt=tt,tt=null,Et=null,Rt=0;dt;){for(Rt++,bt=dt,Pt=0,et=0;et<le&&(Pt++,bt=bt.nextZ);et++);for(ee=le;Pt>0||ee>0&&bt;)Pt!==0&&(ee===0||!bt||dt.z<=bt.z)?(vt=dt,dt=dt.nextZ,Pt--):(vt=bt,bt=bt.nextZ,ee--),Et?Et.nextZ=vt:tt=vt,vt.prevZ=Et,Et=vt;dt=bt}Et.nextZ=null,le*=2}while(Rt>1)}(V)}(i,o,c,f);for(var x,b,S=i;i.prev!==i.next;)if(x=i.prev,b=i.next,f?_g(i,o,c,f):yg(i))t.push(x.i/r),t.push(i.i/r),t.push(b.i/r),yl(i),i=b.next,S=b.next;else if((i=b)===S){m?m===1?ml(i=xg(Cs(i),t,r),t,r,o,c,f,2):m===2&&vg(i,t,r,o,c,f):ml(Cs(i),t,r,o,c,f,1);break}}}function yg(i){var t=i.prev,r=i,o=i.next;if(Mi(t,r,o)>=0)return!1;for(var c=i.next.next;c!==i.prev;){if(io(t.x,t.y,r.x,r.y,o.x,o.y,c.x,c.y)&&Mi(c.prev,c,c.next)>=0)return!1;c=c.next}return!0}function _g(i,t,r,o){var c=i.prev,f=i,m=i.next;if(Mi(c,f,m)>=0)return!1;for(var x=c.x>f.x?c.x>m.x?c.x:m.x:f.x>m.x?f.x:m.x,b=c.y>f.y?c.y>m.y?c.y:m.y:f.y>m.y?f.y:m.y,S=eu(c.x<f.x?c.x<m.x?c.x:m.x:f.x<m.x?f.x:m.x,c.y<f.y?c.y<m.y?c.y:m.y:f.y<m.y?f.y:m.y,t,r,o),A=eu(x,b,t,r,o),z=i.prevZ,D=i.nextZ;z&&z.z>=S&&D&&D.z<=A;){if(z!==i.prev&&z!==i.next&&io(c.x,c.y,f.x,f.y,m.x,m.y,z.x,z.y)&&Mi(z.prev,z,z.next)>=0||(z=z.prevZ,D!==i.prev&&D!==i.next&&io(c.x,c.y,f.x,f.y,m.x,m.y,D.x,D.y)&&Mi(D.prev,D,D.next)>=0))return!1;D=D.nextZ}for(;z&&z.z>=S;){if(z!==i.prev&&z!==i.next&&io(c.x,c.y,f.x,f.y,m.x,m.y,z.x,z.y)&&Mi(z.prev,z,z.next)>=0)return!1;z=z.prevZ}for(;D&&D.z<=A;){if(D!==i.prev&&D!==i.next&&io(c.x,c.y,f.x,f.y,m.x,m.y,D.x,D.y)&&Mi(D.prev,D,D.next)>=0)return!1;D=D.nextZ}return!0}function xg(i,t,r){var o=i;do{var c=o.prev,f=o.next.next;!Ih(c,f)&&bp(c,o,o.next,f)&&gl(c,f)&&gl(f,c)&&(t.push(c.i/r),t.push(o.i/r),t.push(f.i/r),yl(o),yl(o.next),o=i=f),o=o.next}while(o!==i);return Cs(o)}function vg(i,t,r,o,c,f){var m=i;do{for(var x=m.next.next;x!==m.prev;){if(m.i!==x.i&&Tg(m,x)){var b=wp(m,x);return m=Cs(m,m.next),b=Cs(b,b.next),ml(m,t,r,o,c,f),void ml(b,t,r,o,c,f)}x=x.next}m=m.next}while(m!==i)}function bg(i,t){return i.x-t.x}function wg(i,t){var r=function(f,m){var x,b=m,S=f.x,A=f.y,z=-1/0;do{if(A<=b.y&&A>=b.next.y&&b.next.y!==b.y){var D=b.x+(A-b.y)*(b.next.x-b.x)/(b.next.y-b.y);if(D<=S&&D>z){if(z=D,D===S){if(A===b.y)return b;if(A===b.next.y)return b.next}x=b.x<b.next.x?b:b.next}}b=b.next}while(b!==m);if(!x)return null;if(S===z)return x;var O,V=x,tt=x.x,et=x.y,dt=1/0;b=x;do S>=b.x&&b.x>=tt&&S!==b.x&&io(A<et?S:z,A,tt,et,A<et?z:S,A,b.x,b.y)&&(O=Math.abs(A-b.y)/(S-b.x),gl(b,f)&&(O<dt||O===dt&&(b.x>x.x||b.x===x.x&&Mg(x,b)))&&(x=b,dt=O)),b=b.next;while(b!==V);return x}(i,t);if(!r)return t;var o=wp(r,i),c=Cs(r,r.next);return Cs(o,o.next),t===r?c:t}function Mg(i,t){return Mi(i.prev,i,t.prev)<0&&Mi(t.next,i,i.next)<0}function eu(i,t,r,o,c){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=32767*(i-r)*c)|i<<8))|i<<4))|i<<2))|i<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-o)*c)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Sg(i){var t=i,r=i;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==i);return r}function io(i,t,r,o,c,f,m,x){return(c-m)*(t-x)-(i-m)*(f-x)>=0&&(i-m)*(o-x)-(r-m)*(t-x)>=0&&(r-m)*(f-x)-(c-m)*(o-x)>=0}function Tg(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!function(r,o){var c=r;do{if(c.i!==r.i&&c.next.i!==r.i&&c.i!==o.i&&c.next.i!==o.i&&bp(c,c.next,r,o))return!0;c=c.next}while(c!==r);return!1}(i,t)&&(gl(i,t)&&gl(t,i)&&function(r,o){var c=r,f=!1,m=(r.x+o.x)/2,x=(r.y+o.y)/2;do c.y>x!=c.next.y>x&&c.next.y!==c.y&&m<(c.next.x-c.x)*(x-c.y)/(c.next.y-c.y)+c.x&&(f=!f),c=c.next;while(c!==r);return f}(i,t)&&(Mi(i.prev,i,t.prev)||Mi(i,t.prev,t))||Ih(i,t)&&Mi(i.prev,i,i.next)>0&&Mi(t.prev,t,t.next)>0)}function Mi(i,t,r){return(t.y-i.y)*(r.x-t.x)-(t.x-i.x)*(r.y-t.y)}function Ih(i,t){return i.x===t.x&&i.y===t.y}function bp(i,t,r,o){var c=Ah(Mi(i,t,r)),f=Ah(Mi(i,t,o)),m=Ah(Mi(r,o,i)),x=Ah(Mi(r,o,t));return c!==f&&m!==x||!(c!==0||!Ch(i,r,t))||!(f!==0||!Ch(i,o,t))||!(m!==0||!Ch(r,i,o))||!(x!==0||!Ch(r,t,o))}function Ch(i,t,r){return t.x<=Math.max(i.x,r.x)&&t.x>=Math.min(i.x,r.x)&&t.y<=Math.max(i.y,r.y)&&t.y>=Math.min(i.y,r.y)}function Ah(i){return i>0?1:i<0?-1:0}function gl(i,t){return Mi(i.prev,i,i.next)<0?Mi(i,t,i.next)>=0&&Mi(i,i.prev,t)>=0:Mi(i,t,i.prev)<0||Mi(i,i.next,t)<0}function wp(i,t){var r=new iu(i.i,i.x,i.y),o=new iu(t.i,t.x,t.y),c=i.next,f=t.prev;return i.next=t,t.prev=i,r.next=c,c.prev=r,o.next=r,r.prev=o,f.next=o,o.prev=f,o}function Mp(i,t,r,o){var c=new iu(i,t,r);return o?(c.next=o.next,c.prev=o,o.next.prev=c,o.next=c):(c.prev=c,c.next=c),c}function yl(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function iu(i,t,r){this.i=i,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ru(i,t,r,o){for(var c=0,f=t,m=r-o;f<r;f+=o)c+=(i[m]-i[f])*(i[f+1]+i[m+1]),m=f;return c}tu.exports=Eh,tu.exports.default=Eh,Eh.deviation=function(i,t,r,o){var c=t&&t.length,f=Math.abs(ru(i,0,c?t[0]*r:i.length,r));if(c)for(var m=0,x=t.length;m<x;m++)f-=Math.abs(ru(i,t[m]*r,m<x-1?t[m+1]*r:i.length,r));var b=0;for(m=0;m<o.length;m+=3){var S=o[m]*r,A=o[m+1]*r,z=o[m+2]*r;b+=Math.abs((i[S]-i[z])*(i[A+1]-i[S+1])-(i[S]-i[A])*(i[z+1]-i[S+1]))}return f===0&&b===0?0:Math.abs((b-f)/f)},Eh.flatten=function(i){for(var t=i[0][0].length,r={vertices:[],holes:[],dimensions:t},o=0,c=0;c<i.length;c++){for(var f=0;f<i[c].length;f++)for(var m=0;m<t;m++)r.vertices.push(i[c][f][m]);c>0&&r.holes.push(o+=i[c-1].length)}return r};var Sp=tu.exports;function Eg(i,t,r,o,c){Tp(i,t,r||0,o||i.length-1,c||Ig)}function Tp(i,t,r,o,c){for(;o>r;){if(o-r>600){var f=o-r+1,m=t-r+1,x=Math.log(f),b=.5*Math.exp(2*x/3),S=.5*Math.sqrt(x*b*(f-b)/f)*(m-f/2<0?-1:1);Tp(i,t,Math.max(r,Math.floor(t-m*b/f+S)),Math.min(o,Math.floor(t+(f-m)*b/f+S)),c)}var A=i[t],z=r,D=o;for(_l(i,r,t),c(i[o],A)>0&&_l(i,r,o);z<D;){for(_l(i,z,D),z++,D--;c(i[z],A)<0;)z++;for(;c(i[D],A)>0;)D--}c(i[r],A)===0?_l(i,r,D):_l(i,++D,o),D<=t&&(r=D+1),t<=D&&(o=D-1)}}function _l(i,t,r){var o=i[t];i[t]=i[r],i[r]=o}function Ig(i,t){return i<t?-1:i>t?1:0}function nu(i,t){let r=i.length;if(r<=1)return[i];let o=[],c,f;for(let m=0;m<r;m++){let x=ve(i[m]);x!==0&&(i[m].area=Math.abs(x),f===void 0&&(f=x<0),f===x<0?(c&&o.push(c),c=[i[m]]):c.push(i[m]))}if(c&&o.push(c),t>1)for(let m=0;m<o.length;m++)o[m].length<=t||(Eg(o[m],t,1,o[m].length-1,Cg),o[m]=o[m].slice(0,t));return o}function Cg(i,t){return t.area-i.area}function su(i,t,r){let o=r.patternDependencies,c=!1;for(let f of t){let m=f.paint.get(`${i}-pattern`);m.isConstant()||(c=!0);let x=m.constantOr(null);x&&(c=!0,o[x.to]=!0,o[x.from]=!0)}return c}function au(i,t,r,o,c){let f=c.patternDependencies;for(let m of t){let x=m.paint.get(`${i}-pattern`).value;if(x.kind!=="constant"){let b=x.evaluate({zoom:o-1},r,{},c.availableImages),S=x.evaluate({zoom:o},r,{},c.availableImages),A=x.evaluate({zoom:o+1},r,{},c.availableImages);b=b&&b.name?b.name:b,S=S&&S.name?S.name:S,A=A&&A.name?A.name:A,f[b]=!0,f[S]=!0,f[A]=!0,r.patterns[m.id]={min:b,mid:S,max:A}}}return r}class ou{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Re,this.indexArray=new ur,this.indexArray2=new sn,this.programConfigurations=new aa(t.layers,t.zoom),this.segments=new je,this.segments2=new je,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,o){this.hasPattern=su("fill",this.layers,r);let c=this.layers[0].layout.get("fill-sort-key"),f=!c.isConstant(),m=[];for(let{feature:x,id:b,index:S,sourceLayerIndex:A}of t){let z=this.layers[0]._featureFilter.needGeometry,D=la(x,z);if(!this.layers[0]._featureFilter.filter(new hi(this.zoom),D,o))continue;let O=f?c.evaluate(D,{},o,r.availableImages):void 0,V={id:b,properties:x.properties,type:x.type,sourceLayerIndex:A,index:S,geometry:z?D.geometry:oa(x),patterns:{},sortKey:O};m.push(V)}f&&m.sort((x,b)=>x.sortKey-b.sortKey);for(let x of m){let{geometry:b,index:S,sourceLayerIndex:A}=x;if(this.hasPattern){let z=au("fill",this.layers,x,this.zoom,r);this.patternFeatures.push(z)}else this.addFeature(x,b,S,o,{});r.featureIndex.insert(t[S].feature,b,S,A,this.index)}}update(t,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,o)}addFeatures(t,r,o){for(let c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,gg),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,r,o,c,f){for(let m of nu(r,500)){let x=0;for(let O of m)x+=O.length;let b=this.segments.prepareSegment(x,this.layoutVertexArray,this.indexArray),S=b.vertexLength,A=[],z=[];for(let O of m){if(O.length===0)continue;O!==m[0]&&z.push(A.length/2);let V=this.segments2.prepareSegment(O.length,this.layoutVertexArray,this.indexArray2),tt=V.vertexLength;this.layoutVertexArray.emplaceBack(O[0].x,O[0].y),this.indexArray2.emplaceBack(tt+O.length-1,tt),A.push(O[0].x),A.push(O[0].y);for(let et=1;et<O.length;et++)this.layoutVertexArray.emplaceBack(O[et].x,O[et].y),this.indexArray2.emplaceBack(tt+et-1,tt+et),A.push(O[et].x),A.push(O[et].y);V.vertexLength+=O.length,V.primitiveLength+=O.length}let D=Sp(A,z);for(let O=0;O<D.length;O+=3)this.indexArray.emplaceBack(S+D[O],S+D[O+1],S+D[O+2]);b.vertexLength+=x,b.primitiveLength+=D.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,o,f,c)}}te("FillBucket",ou,{omit:["layers","patternFeatures"]});let Ag=new Fi({"fill-sort-key":new de(ct.layout_fill["fill-sort-key"])});var Pg={paint:new Fi({"fill-antialias":new ne(ct.paint_fill["fill-antialias"]),"fill-opacity":new de(ct.paint_fill["fill-opacity"]),"fill-color":new de(ct.paint_fill["fill-color"]),"fill-outline-color":new de(ct.paint_fill["fill-outline-color"]),"fill-translate":new ne(ct.paint_fill["fill-translate"]),"fill-translate-anchor":new ne(ct.paint_fill["fill-translate-anchor"]),"fill-pattern":new ia(ct.paint_fill["fill-pattern"])}),layout:Ag};let zg=Oi([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),{members:kg}=zg;var As={},Lg=ye,Ep=ro;function ro(i,t,r,o,c){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=o,this._values=c,i.readFields(Dg,this,t)}function Dg(i,t,r){i==1?t.id=r.readVarint():i==2?function(o,c){for(var f=o.readVarint()+o.pos;o.pos<f;){var m=c._keys[o.readVarint()],x=c._values[o.readVarint()];c.properties[m]=x}}(r,t):i==3?t.type=r.readVarint():i==4&&(t._geometry=r.pos)}function Rg(i){for(var t,r,o=0,c=0,f=i.length,m=f-1;c<f;m=c++)o+=((r=i[m]).x-(t=i[c]).x)*(t.y+r.y);return o}ro.types=["Unknown","Point","LineString","Polygon"],ro.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var t,r=i.readVarint()+i.pos,o=1,c=0,f=0,m=0,x=[];i.pos<r;){if(c<=0){var b=i.readVarint();o=7&b,c=b>>3}if(c--,o===1||o===2)f+=i.readSVarint(),m+=i.readSVarint(),o===1&&(t&&x.push(t),t=[]),t.push(new Lg(f,m));else{if(o!==7)throw new Error("unknown command "+o);t&&t.push(t[0].clone())}}return t&&x.push(t),x},ro.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var t=i.readVarint()+i.pos,r=1,o=0,c=0,f=0,m=1/0,x=-1/0,b=1/0,S=-1/0;i.pos<t;){if(o<=0){var A=i.readVarint();r=7&A,o=A>>3}if(o--,r===1||r===2)(c+=i.readSVarint())<m&&(m=c),c>x&&(x=c),(f+=i.readSVarint())<b&&(b=f),f>S&&(S=f);else if(r!==7)throw new Error("unknown command "+r)}return[m,b,x,S]},ro.prototype.toGeoJSON=function(i,t,r){var o,c,f=this.extent*Math.pow(2,r),m=this.extent*i,x=this.extent*t,b=this.loadGeometry(),S=ro.types[this.type];function A(O){for(var V=0;V<O.length;V++){var tt=O[V];O[V]=[360*(tt.x+m)/f-180,360/Math.PI*Math.atan(Math.exp((180-360*(tt.y+x)/f)*Math.PI/180))-90]}}switch(this.type){case 1:var z=[];for(o=0;o<b.length;o++)z[o]=b[o][0];A(b=z);break;case 2:for(o=0;o<b.length;o++)A(b[o]);break;case 3:for(b=function(O){var V=O.length;if(V<=1)return[O];for(var tt,et,dt=[],bt=0;bt<V;bt++){var vt=Rg(O[bt]);vt!==0&&(et===void 0&&(et=vt<0),et===vt<0?(tt&&dt.push(tt),tt=[O[bt]]):tt.push(O[bt]))}return tt&&dt.push(tt),dt}(b),o=0;o<b.length;o++)for(c=0;c<b[o].length;c++)A(b[o][c])}b.length===1?b=b[0]:S="Multi"+S;var D={type:"Feature",geometry:{type:S,coordinates:b},properties:this.properties};return"id"in this&&(D.id=this.id),D};var Bg=Ep,Ip=Cp;function Cp(i,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(Fg,this,t),this.length=this._features.length}function Fg(i,t,r){i===15?t.version=r.readVarint():i===1?t.name=r.readString():i===5?t.extent=r.readVarint():i===2?t._features.push(r.pos):i===3?t._keys.push(r.readString()):i===4&&t._values.push(function(o){for(var c=null,f=o.readVarint()+o.pos;o.pos<f;){var m=o.readVarint()>>3;c=m===1?o.readString():m===2?o.readFloat():m===3?o.readDouble():m===4?o.readVarint64():m===5?o.readVarint():m===6?o.readSVarint():m===7?o.readBoolean():null}return c}(r))}Cp.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var t=this._pbf.readVarint()+this._pbf.pos;return new Bg(this._pbf,t,this.extent,this._keys,this._values)};var Og=Ip;function Ng(i,t,r){if(i===3){var o=new Og(r,r.readVarint()+r.pos);o.length&&(t[o.name]=o)}}As.VectorTile=function(i,t){this.layers=i.readFields(Ng,{},t)},As.VectorTileFeature=Ep,As.VectorTileLayer=Ip;let Ug=As.VectorTileFeature.types,lu=Math.pow(2,13);function xl(i,t,r,o,c,f,m,x){i.emplaceBack(t,r,2*Math.floor(o*lu)+m,c*lu*2,f*lu*2,Math.round(x))}class hu{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new yi,this.indexArray=new ur,this.programConfigurations=new aa(t.layers,t.zoom),this.segments=new je,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,o){this.features=[],this.hasPattern=su("fill-extrusion",this.layers,r);for(let{feature:c,id:f,index:m,sourceLayerIndex:x}of t){let b=this.layers[0]._featureFilter.needGeometry,S=la(c,b);if(!this.layers[0]._featureFilter.filter(new hi(this.zoom),S,o))continue;let A={id:f,sourceLayerIndex:x,index:m,geometry:b?S.geometry:oa(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(au("fill-extrusion",this.layers,A,this.zoom,r)):this.addFeature(A,A.geometry,m,o,{}),r.featureIndex.insert(c,A.geometry,m,x,this.index,!0)}}addFeatures(t,r,o){for(let c of this.features){let{geometry:f}=c;this.addFeature(c,f,c.index,r,o)}}update(t,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,kg),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,o,c,f){for(let m of nu(r,500)){let x=0;for(let O of m)x+=O.length;let b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let O of m){if(O.length===0||Gg(O))continue;let V=0;for(let tt=0;tt<O.length;tt++){let et=O[tt];if(tt>=1){let dt=O[tt-1];if(!Vg(et,dt)){b.vertexLength+4>je.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let bt=et.sub(dt)._perp()._unit(),vt=dt.dist(et);V+vt>32768&&(V=0),xl(this.layoutVertexArray,et.x,et.y,bt.x,bt.y,0,0,V),xl(this.layoutVertexArray,et.x,et.y,bt.x,bt.y,0,1,V),V+=vt,xl(this.layoutVertexArray,dt.x,dt.y,bt.x,bt.y,0,0,V),xl(this.layoutVertexArray,dt.x,dt.y,bt.x,bt.y,0,1,V);let Et=b.vertexLength;this.indexArray.emplaceBack(Et,Et+2,Et+1),this.indexArray.emplaceBack(Et+1,Et+2,Et+3),b.vertexLength+=4,b.primitiveLength+=2}}}}if(b.vertexLength+x>je.MAX_VERTEX_ARRAY_LENGTH&&(b=this.segments.prepareSegment(x,this.layoutVertexArray,this.indexArray)),Ug[t.type]!=="Polygon")continue;let S=[],A=[],z=b.vertexLength;for(let O of m)if(O.length!==0){O!==m[0]&&A.push(S.length/2);for(let V=0;V<O.length;V++){let tt=O[V];xl(this.layoutVertexArray,tt.x,tt.y,0,0,1,1,0),S.push(tt.x),S.push(tt.y)}}let D=Sp(S,A);for(let O=0;O<D.length;O+=3)this.indexArray.emplaceBack(z+D[O],z+D[O+2],z+D[O+1]);b.primitiveLength+=D.length/3,b.vertexLength+=x}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,o,f,c)}}function Vg(i,t){return i.x===t.x&&(i.x<0||i.x>Ni)||i.y===t.y&&(i.y<0||i.y>Ni)}function Gg(i){return i.every(t=>t.x<0)||i.every(t=>t.x>Ni)||i.every(t=>t.y<0)||i.every(t=>t.y>Ni)}te("FillExtrusionBucket",hu,{omit:["layers","features"]});var qg={paint:new Fi({"fill-extrusion-opacity":new ne(ct["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new de(ct["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new ne(ct["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new ne(ct["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ia(ct["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new de(ct["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new de(ct["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new ne(ct["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function vl(i,t){return i.x*t.x+i.y*t.y}function Ap(i,t){if(i.length===1){let r=0,o=t[r++],c;for(;!c||o.equals(c);)if(c=t[r++],!c)return 1/0;for(;r<t.length;r++){let f=t[r],m=i[0],x=c.sub(o),b=f.sub(o),S=m.sub(o),A=vl(x,x),z=vl(x,b),D=vl(b,b),O=vl(S,x),V=vl(S,b),tt=A*D-z*z,et=(D*O-z*V)/tt,dt=(A*V-z*O)/tt,bt=o.z*(1-et-dt)+c.z*et+f.z*dt;if(isFinite(bt))return bt}return 1/0}{let r=1/0;for(let o of t)r=Math.min(r,o.z);return r}}let jg=Oi([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:$g}=jg,Wg=Oi([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Zg}=Wg,Hg=As.VectorTileFeature.types,Xg=Math.cos(Math.PI/180*37.5),Pp=Math.pow(2,14)/.5;class cu{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new be,this.layoutVertexArray2=new qe,this.indexArray=new ur,this.programConfigurations=new aa(t.layers,t.zoom),this.segments=new je,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,o){this.hasPattern=su("line",this.layers,r);let c=this.layers[0].layout.get("line-sort-key"),f=!c.isConstant(),m=[];for(let{feature:x,id:b,index:S,sourceLayerIndex:A}of t){let z=this.layers[0]._featureFilter.needGeometry,D=la(x,z);if(!this.layers[0]._featureFilter.filter(new hi(this.zoom),D,o))continue;let O=f?c.evaluate(D,{},o):void 0,V={id:b,properties:x.properties,type:x.type,sourceLayerIndex:A,index:S,geometry:z?D.geometry:oa(x),patterns:{},sortKey:O};m.push(V)}f&&m.sort((x,b)=>x.sortKey-b.sortKey);for(let x of m){let{geometry:b,index:S,sourceLayerIndex:A}=x;if(this.hasPattern){let z=au("line",this.layers,x,this.zoom,r);this.patternFeatures.push(z)}else this.addFeature(x,b,S,o,{});r.featureIndex.insert(t[S].feature,b,S,A,this.index)}}update(t,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,o)}addFeatures(t,r,o){for(let c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Zg)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,$g),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,r,o,c,f){let m=this.layers[0].layout,x=m.get("line-join").evaluate(t,{}),b=m.get("line-cap"),S=m.get("line-miter-limit"),A=m.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(let z of r)this.addLine(z,t,x,b,S,A);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,o,f,c)}addLine(t,r,o,c,f,m){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let dt=0;dt<t.length-1;dt++)this.totalDistance+=t[dt].dist(t[dt+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let x=Hg[r.type]==="Polygon",b=t.length;for(;b>=2&&t[b-1].equals(t[b-2]);)b--;let S=0;for(;S<b-1&&t[S].equals(t[S+1]);)S++;if(b<(x?3:2))return;o==="bevel"&&(f=1.05);let A=this.overscaling<=16?122880/(512*this.overscaling):0,z=this.segments.prepareSegment(10*b,this.layoutVertexArray,this.indexArray),D,O,V,tt,et;this.e1=this.e2=-1,x&&(D=t[b-2],et=t[S].sub(D)._unit()._perp());for(let dt=S;dt<b;dt++){if(V=dt===b-1?x?t[S+1]:void 0:t[dt+1],V&&t[dt].equals(V))continue;et&&(tt=et),D&&(O=D),D=t[dt],et=V?V.sub(D)._unit()._perp():tt,tt=tt||et;let bt=tt.add(et);bt.x===0&&bt.y===0||bt._unit();let vt=tt.x*et.x+tt.y*et.y,Et=bt.x*et.x+bt.y*et.y,Rt=Et!==0?1/Et:1/0,Pt=2*Math.sqrt(2-2*Et),ee=Et<Xg&&O&&V,le=tt.x*et.y-tt.y*et.x>0;if(ee&&dt>S){let Wt=D.dist(O);if(Wt>2*A){let Qt=D.sub(D.sub(O)._mult(A/Wt)._round());this.updateDistance(O,Qt),this.addCurrentVertex(Qt,tt,0,0,z),O=Qt}}let Xt=O&&V,Kt=Xt?o:x?"butt":c;if(Xt&&Kt==="round"&&(Rt<m?Kt="miter":Rt<=2&&(Kt="fakeround")),Kt==="miter"&&Rt>f&&(Kt="bevel"),Kt==="bevel"&&(Rt>2&&(Kt="flipbevel"),Rt<f&&(Kt="miter")),O&&this.updateDistance(O,D),Kt==="miter")bt._mult(Rt),this.addCurrentVertex(D,bt,0,0,z);else if(Kt==="flipbevel"){if(Rt>100)bt=et.mult(-1);else{let Wt=Rt*tt.add(et).mag()/tt.sub(et).mag();bt._perp()._mult(Wt*(le?-1:1))}this.addCurrentVertex(D,bt,0,0,z),this.addCurrentVertex(D,bt.mult(-1),0,0,z)}else if(Kt==="bevel"||Kt==="fakeround"){let Wt=-Math.sqrt(Rt*Rt-1),Qt=le?Wt:0,Yt=le?0:Wt;if(O&&this.addCurrentVertex(D,tt,Qt,Yt,z),Kt==="fakeround"){let Gt=Math.round(180*Pt/Math.PI/20);for(let fe=1;fe<Gt;fe++){let ce=fe/Gt;if(ce!==.5){let Xe=ce-.5;ce+=ce*Xe*(ce-1)*((1.0904+vt*(vt*(3.55645-1.43519*vt)-3.2452))*Xe*Xe+(.848013+vt*(.215638*vt-1.06021)))}let Be=et.sub(tt)._mult(ce)._add(tt)._unit()._mult(le?-1:1);this.addHalfVertex(D,Be.x,Be.y,!1,le,0,z)}}V&&this.addCurrentVertex(D,et,-Qt,-Yt,z)}else if(Kt==="butt")this.addCurrentVertex(D,bt,0,0,z);else if(Kt==="square"){let Wt=O?1:-1;this.addCurrentVertex(D,bt,Wt,Wt,z)}else Kt==="round"&&(O&&(this.addCurrentVertex(D,tt,0,0,z),this.addCurrentVertex(D,tt,1,1,z,!0)),V&&(this.addCurrentVertex(D,et,-1,-1,z,!0),this.addCurrentVertex(D,et,0,0,z)));if(ee&&dt<b-1){let Wt=D.dist(V);if(Wt>2*A){let Qt=D.add(V.sub(D)._mult(A/Wt)._round());this.updateDistance(D,Qt),this.addCurrentVertex(Qt,et,0,0,z),D=Qt}}}}addCurrentVertex(t,r,o,c,f,m=!1){let x=r.y*c-r.x,b=-r.y-r.x*c;this.addHalfVertex(t,r.x+r.y*o,r.y-r.x*o,m,!1,o,f),this.addHalfVertex(t,x,b,m,!0,-c,f),this.distance>Pp/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(t,r,o,c,f,m))}addHalfVertex({x:t,y:r},o,c,f,m,x,b){let S=.5*(this.lineClips?this.scaledDistance*(Pp-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(f?1:0),(r<<1)+(m?1:0),Math.round(63*o)+128,Math.round(63*c)+128,1+(x===0?0:x<0?-1:1)|(63&S)<<2,S>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let A=b.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,A),b.primitiveLength++),m?this.e2=A:this.e1=A}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}}te("LineBucket",cu,{omit:["layers","patternFeatures"]});let Kg=new Fi({"line-cap":new ne(ct.layout_line["line-cap"]),"line-join":new de(ct.layout_line["line-join"]),"line-miter-limit":new ne(ct.layout_line["line-miter-limit"]),"line-round-limit":new ne(ct.layout_line["line-round-limit"]),"line-sort-key":new de(ct.layout_line["line-sort-key"])});var zp={paint:new Fi({"line-opacity":new de(ct.paint_line["line-opacity"]),"line-color":new de(ct.paint_line["line-color"]),"line-translate":new ne(ct.paint_line["line-translate"]),"line-translate-anchor":new ne(ct.paint_line["line-translate-anchor"]),"line-width":new de(ct.paint_line["line-width"]),"line-gap-width":new de(ct.paint_line["line-gap-width"]),"line-offset":new de(ct.paint_line["line-offset"]),"line-blur":new de(ct.paint_line["line-blur"]),"line-dasharray":new ra(ct.paint_line["line-dasharray"]),"line-pattern":new ia(ct.paint_line["line-pattern"]),"line-gradient":new hl(ct.paint_line["line-gradient"])}),layout:Kg};let kp=new class extends de{possiblyEvaluate(i,t){return t=new hi(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(i,t)}evaluate(i,t,r,o){return t=pt({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(i,t,r,o)}}(zp.paint.properties["line-width"].specification);function Lp(i,t){return t>0?t+2*i:i}kp.useIntegerZoom=!0;let Yg=Oi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Jg=Oi([{name:"a_projected_pos",components:3,type:"Float32"}],4);Oi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let Qg=Oi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Oi([{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"}]);let Dp=Oi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),ty=Oi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function ey(i,t,r){return i.sections.forEach(o=>{o.text=function(c,f,m){let x=f.layout.get("text-transform").evaluate(m,{});return x==="uppercase"?c=c.toLocaleUpperCase():x==="lowercase"&&(c=c.toLocaleLowerCase()),Rr.applyArabicShaping&&(c=Rr.applyArabicShaping(c)),c}(o.text,t,r)}),i}Oi([{name:"triangle",components:3,type:"Uint16"}]),Oi([{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"}]),Oi([{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"}]),Oi([{type:"Float32",name:"offsetX"}]),Oi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);let bl={"!":"\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"};var Hi=24,uu=ei,Rp=function(i,t,r,o,c){var f,m,x=8*c-o-1,b=(1<<x)-1,S=b>>1,A=-7,z=r?c-1:0,D=r?-1:1,O=i[t+z];for(z+=D,f=O&(1<<-A)-1,O>>=-A,A+=x;A>0;f=256*f+i[t+z],z+=D,A-=8);for(m=f&(1<<-A)-1,f>>=-A,A+=o;A>0;m=256*m+i[t+z],z+=D,A-=8);if(f===0)f=1-S;else{if(f===b)return m?NaN:1/0*(O?-1:1);m+=Math.pow(2,o),f-=S}return(O?-1:1)*m*Math.pow(2,f-o)},Bp=function(i,t,r,o,c,f){var m,x,b,S=8*f-c-1,A=(1<<S)-1,z=A>>1,D=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,O=o?0:f-1,V=o?1:-1,tt=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(x=isNaN(t)?1:0,m=A):(m=Math.floor(Math.log(t)/Math.LN2),t*(b=Math.pow(2,-m))<1&&(m--,b*=2),(t+=m+z>=1?D/b:D*Math.pow(2,1-z))*b>=2&&(m++,b/=2),m+z>=A?(x=0,m=A):m+z>=1?(x=(t*b-1)*Math.pow(2,c),m+=z):(x=t*Math.pow(2,z-1)*Math.pow(2,c),m=0));c>=8;i[r+O]=255&x,O+=V,x/=256,c-=8);for(m=m<<c|x,S+=c;S>0;i[r+O]=255&m,O+=V,m/=256,S-=8);i[r+O-V]|=128*tt};function ei(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}ei.Varint=0,ei.Fixed64=1,ei.Bytes=2,ei.Fixed32=5;var Ps,pu=4294967296,Fp=1/pu,Op=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Hn(i){return i.type===ei.Bytes?i.readVarint()+i.pos:i.pos+1}function no(i,t,r){return r?4294967296*t+(i>>>0):4294967296*(t>>>0)+(i>>>0)}function Np(i,t,r){var o=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(o);for(var c=r.pos-1;c>=i;c--)r.buf[c+o]=r.buf[c]}function iy(i,t){for(var r=0;r<i.length;r++)t.writeVarint(i[r])}function ry(i,t){for(var r=0;r<i.length;r++)t.writeSVarint(i[r])}function ny(i,t){for(var r=0;r<i.length;r++)t.writeFloat(i[r])}function sy(i,t){for(var r=0;r<i.length;r++)t.writeDouble(i[r])}function ay(i,t){for(var r=0;r<i.length;r++)t.writeBoolean(i[r])}function oy(i,t){for(var r=0;r<i.length;r++)t.writeFixed32(i[r])}function ly(i,t){for(var r=0;r<i.length;r++)t.writeSFixed32(i[r])}function hy(i,t){for(var r=0;r<i.length;r++)t.writeFixed64(i[r])}function cy(i,t){for(var r=0;r<i.length;r++)t.writeSFixed64(i[r])}function Ph(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+16777216*i[t+3]}function so(i,t,r){i[r]=t,i[r+1]=t>>>8,i[r+2]=t>>>16,i[r+3]=t>>>24}function Up(i,t){return(i[t]|i[t+1]<<8|i[t+2]<<16)+(i[t+3]<<24)}function uy(i,t,r){i===1&&r.readMessage(py,t)}function py(i,t,r){if(i===3){let{id:o,bitmap:c,width:f,height:m,left:x,top:b,advance:S}=r.readMessage(dy,{});t.push({id:o,bitmap:new fl({width:f+6,height:m+6},c),metrics:{width:f,height:m,left:x,top:b,advance:S}})}}function dy(i,t,r){i===1?t.id=r.readVarint():i===2?t.bitmap=r.readBytes():i===3?t.width=r.readVarint():i===4?t.height=r.readVarint():i===5?t.left=r.readSVarint():i===6?t.top=r.readSVarint():i===7&&(t.advance=r.readVarint())}function Vp(i){let t=0,r=0;for(let m of i)t+=m.w*m.h,r=Math.max(r,m.w);i.sort((m,x)=>x.h-m.h);let o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],c=0,f=0;for(let m of i)for(let x=o.length-1;x>=0;x--){let b=o[x];if(!(m.w>b.w||m.h>b.h)){if(m.x=b.x,m.y=b.y,f=Math.max(f,m.y+m.h),c=Math.max(c,m.x+m.w),m.w===b.w&&m.h===b.h){let S=o.pop();x<o.length&&(o[x]=S)}else m.h===b.h?(b.x+=m.w,b.w-=m.w):m.w===b.w?(b.y+=m.h,b.h-=m.h):(o.push({x:b.x+m.w,y:b.y,w:b.w-m.w,h:m.h}),b.y+=m.h,b.h-=m.h);break}}return{w:c,h:f,fill:t/(c*f)||0}}ei.prototype={destroy:function(){this.buf=null},readFields:function(i,t,r){for(r=r||this.length;this.pos<r;){var o=this.readVarint(),c=o>>3,f=this.pos;this.type=7&o,i(c,t,this),this.pos===f&&this.skip(o)}return t},readMessage:function(i,t){return this.readFields(i,t,this.readVarint()+this.pos)},readFixed32:function(){var i=Ph(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Up(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Ph(this.buf,this.pos)+Ph(this.buf,this.pos+4)*pu;return this.pos+=8,i},readSFixed64:function(){var i=Ph(this.buf,this.pos)+Up(this.buf,this.pos+4)*pu;return this.pos+=8,i},readFloat:function(){var i=Rp(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Rp(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var t,r,o=this.buf;return t=127&(r=o[this.pos++]),r<128?t:(t|=(127&(r=o[this.pos++]))<<7,r<128?t:(t|=(127&(r=o[this.pos++]))<<14,r<128?t:(t|=(127&(r=o[this.pos++]))<<21,r<128?t:function(c,f,m){var x,b,S=m.buf;if(x=(112&(b=S[m.pos++]))>>4,b<128||(x|=(127&(b=S[m.pos++]))<<3,b<128)||(x|=(127&(b=S[m.pos++]))<<10,b<128)||(x|=(127&(b=S[m.pos++]))<<17,b<128)||(x|=(127&(b=S[m.pos++]))<<24,b<128)||(x|=(1&(b=S[m.pos++]))<<31,b<128))return no(c,x,f);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(r=o[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i=this.readVarint()+this.pos,t=this.pos;return this.pos=i,i-t>=12&&Op?function(r,o,c){return Op.decode(r.subarray(o,c))}(this.buf,t,i):function(r,o,c){for(var f="",m=o;m<c;){var x,b,S,A=r[m],z=null,D=A>239?4:A>223?3:A>191?2:1;if(m+D>c)break;D===1?A<128&&(z=A):D===2?(192&(x=r[m+1]))==128&&(z=(31&A)<<6|63&x)<=127&&(z=null):D===3?(b=r[m+2],(192&(x=r[m+1]))==128&&(192&b)==128&&((z=(15&A)<<12|(63&x)<<6|63&b)<=2047||z>=55296&&z<=57343)&&(z=null)):D===4&&(b=r[m+2],S=r[m+3],(192&(x=r[m+1]))==128&&(192&b)==128&&(192&S)==128&&((z=(15&A)<<18|(63&x)<<12|(63&b)<<6|63&S)<=65535||z>=1114112)&&(z=null)),z===null?(z=65533,D=1):z>65535&&(z-=65536,f+=String.fromCharCode(z>>>10&1023|55296),z=56320|1023&z),f+=String.fromCharCode(z),m+=D}return f}(this.buf,t,i)},readBytes:function(){var i=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,i);return this.pos=i,t},readPackedVarint:function(i,t){if(this.type!==ei.Bytes)return i.push(this.readVarint(t));var r=Hn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(t));return i},readPackedSVarint:function(i){if(this.type!==ei.Bytes)return i.push(this.readSVarint());var t=Hn(this);for(i=i||[];this.pos<t;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==ei.Bytes)return i.push(this.readBoolean());var t=Hn(this);for(i=i||[];this.pos<t;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==ei.Bytes)return i.push(this.readFloat());var t=Hn(this);for(i=i||[];this.pos<t;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==ei.Bytes)return i.push(this.readDouble());var t=Hn(this);for(i=i||[];this.pos<t;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==ei.Bytes)return i.push(this.readFixed32());var t=Hn(this);for(i=i||[];this.pos<t;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==ei.Bytes)return i.push(this.readSFixed32());var t=Hn(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==ei.Bytes)return i.push(this.readFixed64());var t=Hn(this);for(i=i||[];this.pos<t;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==ei.Bytes)return i.push(this.readSFixed64());var t=Hn(this);for(i=i||[];this.pos<t;)i.push(this.readSFixed64());return i},skip:function(i){var t=7&i;if(t===ei.Varint)for(;this.buf[this.pos++]>127;);else if(t===ei.Bytes)this.pos=this.readVarint()+this.pos;else if(t===ei.Fixed32)this.pos+=4;else{if(t!==ei.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(i,t){this.writeVarint(i<<3|t)},realloc:function(i){for(var t=this.length||16;t<this.pos+i;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),so(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),so(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),so(this.buf,-1&i,this.pos),so(this.buf,Math.floor(i*Fp),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),so(this.buf,-1&i,this.pos),so(this.buf,Math.floor(i*Fp),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(t,r){var o,c;if(t>=0?(o=t%4294967296|0,c=t/4294967296|0):(c=~(-t/4294967296),4294967295^(o=~(-t%4294967296))?o=o+1|0:(o=0,c=c+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(f,m,x){x.buf[x.pos++]=127&f|128,f>>>=7,x.buf[x.pos++]=127&f|128,f>>>=7,x.buf[x.pos++]=127&f|128,f>>>=7,x.buf[x.pos++]=127&f|128,x.buf[x.pos]=127&(f>>>=7)}(o,0,r),function(f,m){var x=(7&f)<<4;m.buf[m.pos++]|=x|((f>>>=3)?128:0),f&&(m.buf[m.pos++]=127&f|((f>>>=7)?128:0),f&&(m.buf[m.pos++]=127&f|((f>>>=7)?128:0),f&&(m.buf[m.pos++]=127&f|((f>>>=7)?128:0),f&&(m.buf[m.pos++]=127&f|((f>>>=7)?128:0),f&&(m.buf[m.pos++]=127&f)))))}(c,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var t=this.pos;this.pos=function(o,c,f){for(var m,x,b=0;b<c.length;b++){if((m=c.charCodeAt(b))>55295&&m<57344){if(!x){m>56319||b+1===c.length?(o[f++]=239,o[f++]=191,o[f++]=189):x=m;continue}if(m<56320){o[f++]=239,o[f++]=191,o[f++]=189,x=m;continue}m=x-55296<<10|m-56320|65536,x=null}else x&&(o[f++]=239,o[f++]=191,o[f++]=189,x=null);m<128?o[f++]=m:(m<2048?o[f++]=m>>6|192:(m<65536?o[f++]=m>>12|224:(o[f++]=m>>18|240,o[f++]=m>>12&63|128),o[f++]=m>>6&63|128),o[f++]=63&m|128)}return f}(this.buf,i,this.pos);var r=this.pos-t;r>=128&&Np(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Bp(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Bp(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var t=i.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,t){this.pos++;var r=this.pos;i(t,this);var o=this.pos-r;o>=128&&Np(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,t,r){this.writeTag(i,ei.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(i,t){t.length&&this.writeMessage(i,iy,t)},writePackedSVarint:function(i,t){t.length&&this.writeMessage(i,ry,t)},writePackedBoolean:function(i,t){t.length&&this.writeMessage(i,ay,t)},writePackedFloat:function(i,t){t.length&&this.writeMessage(i,ny,t)},writePackedDouble:function(i,t){t.length&&this.writeMessage(i,sy,t)},writePackedFixed32:function(i,t){t.length&&this.writeMessage(i,oy,t)},writePackedSFixed32:function(i,t){t.length&&this.writeMessage(i,ly,t)},writePackedFixed64:function(i,t){t.length&&this.writeMessage(i,hy,t)},writePackedSFixed64:function(i,t){t.length&&this.writeMessage(i,cy,t)},writeBytesField:function(i,t){this.writeTag(i,ei.Bytes),this.writeBytes(t)},writeFixed32Field:function(i,t){this.writeTag(i,ei.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(i,t){this.writeTag(i,ei.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(i,t){this.writeTag(i,ei.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(i,t){this.writeTag(i,ei.Fixed64),this.writeSFixed64(t)},writeVarintField:function(i,t){this.writeTag(i,ei.Varint),this.writeVarint(t)},writeSVarintField:function(i,t){this.writeTag(i,ei.Varint),this.writeSVarint(t)},writeStringField:function(i,t){this.writeTag(i,ei.Bytes),this.writeString(t)},writeFloatField:function(i,t){this.writeTag(i,ei.Fixed32),this.writeFloat(t)},writeDoubleField:function(i,t){this.writeTag(i,ei.Fixed64),this.writeDouble(t)},writeBooleanField:function(i,t){this.writeVarintField(i,Boolean(t))}};class du{constructor(t,{pixelRatio:r,version:o,stretchX:c,stretchY:f,content:m}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=c,this.stretchY=f,this.content=m,this.version=o}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Gp{constructor(t,r){let o={},c={};this.haveRenderCallbacks=[];let f=[];this.addImages(t,o,f),this.addImages(r,c,f);let{w:m,h:x}=Vp(f),b=new Zr({width:m||1,height:x||1});for(let S in t){let A=t[S],z=o[S].paddedRect;Zr.copy(A.data,b,{x:0,y:0},{x:z.x+1,y:z.y+1},A.data)}for(let S in r){let A=r[S],z=c[S].paddedRect,D=z.x+1,O=z.y+1,V=A.data.width,tt=A.data.height;Zr.copy(A.data,b,{x:0,y:0},{x:D,y:O},A.data),Zr.copy(A.data,b,{x:0,y:tt-1},{x:D,y:O-1},{width:V,height:1}),Zr.copy(A.data,b,{x:0,y:0},{x:D,y:O+tt},{width:V,height:1}),Zr.copy(A.data,b,{x:V-1,y:0},{x:D-1,y:O},{width:1,height:tt}),Zr.copy(A.data,b,{x:0,y:0},{x:D+V,y:O},{width:1,height:tt})}this.image=b,this.iconPositions=o,this.patternPositions=c}addImages(t,r,o){for(let c in t){let f=t[c],m={x:0,y:0,w:f.data.width+2,h:f.data.height+2};o.push(m),r[c]=new du(m,f),f.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let o in t.updatedImages)this.patchUpdatedImage(this.iconPositions[o],t.getImage(o),r),this.patchUpdatedImage(this.patternPositions[o],t.getImage(o),r)}patchUpdatedImage(t,r,o){if(!t||!r||t.version===r.version)return;t.version=r.version;let[c,f]=t.tl;o.update(r.data,void 0,{x:c,y:f})}}te("ImagePosition",du),te("ImageAtlas",Gp),a.WritingMode=void 0,(Ps=a.WritingMode||(a.WritingMode={}))[Ps.none=0]="none",Ps[Ps.horizontal=1]="horizontal",Ps[Ps.vertical=2]="vertical",Ps[Ps.horizontalOnly=3]="horizontalOnly";let zh=-17;class wl{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,r){let o=new wl;return o.scale=t||1,o.fontStack=r,o}static forImage(t){let r=new wl;return r.imageName=t,r}}class ao{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){let o=new ao;for(let c=0;c<t.sections.length;c++){let f=t.sections[c];f.image?o.addImageSection(f):o.addTextSection(f,r)}return o}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let r="";for(let o=0;o<t.length;o++){let c=t.charCodeAt(o+1)||null,f=t.charCodeAt(o-1)||null;r+=c&&mh(c)&&!bl[t[o+1]]||f&&mh(f)&&!bl[t[o-1]]||!bl[t[o]]?t[o]:bl[t[o]]}return r}(this.text)}trim(){let t=0;for(let o=0;o<this.text.length&&Lh[this.text.charCodeAt(o)];o++)t++;let r=this.text.length;for(let o=this.text.length-1;o>=0&&o>=t&&Lh[this.text.charCodeAt(o)];o--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){let o=new ao;return o.text=this.text.substring(t,r),o.sectionIndex=this.sectionIndex.slice(t,r),o.sections=this.sections,o}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}addTextSection(t,r){this.text+=t.text,this.sections.push(wl.forText(t.scale,t.fontStack||r));let o=this.sections.length-1;for(let c=0;c<t.text.length;++c)this.sectionIndex.push(o)}addImageSection(t){let r=t.image?t.image.name:"";if(r.length===0)return void oe("Can't add FormattedSection with an empty image.");let o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCharCode(o),this.sections.push(wl.forImage(r)),this.sectionIndex.push(this.sections.length-1)):oe("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function kh(i,t,r,o,c,f,m,x,b,S,A,z,D,O,V,tt){let et=ao.fromFeature(i,c),dt;z===a.WritingMode.vertical&&et.verticalizePunctuation();let{processBidirectionalText:bt,processStyledBidirectionalText:vt}=Rr;if(bt&&et.sections.length===1){dt=[];let Pt=bt(et.toString(),fu(et,S,f,t,o,O,V));for(let ee of Pt){let le=new ao;le.text=ee,le.sections=et.sections;for(let Xt=0;Xt<ee.length;Xt++)le.sectionIndex.push(0);dt.push(le)}}else if(vt){dt=[];let Pt=vt(et.text,et.sectionIndex,fu(et,S,f,t,o,O,V));for(let ee of Pt){let le=new ao;le.text=ee[0],le.sectionIndex=ee[1],le.sections=et.sections,dt.push(le)}}else dt=function(Pt,ee){let le=[],Xt=Pt.text,Kt=0;for(let Wt of ee)le.push(Pt.substring(Kt,Wt)),Kt=Wt;return Kt<Xt.length&&le.push(Pt.substring(Kt,Xt.length)),le}(et,fu(et,S,f,t,o,O,V));let Et=[],Rt={positionedLines:Et,text:et.toString(),top:A[1],bottom:A[1],left:A[0],right:A[0],writingMode:z,iconsInText:!1,verticalizable:!1};return function(Pt,ee,le,Xt,Kt,Wt,Qt,Yt,Gt,fe,ce,Be){let Xe=0,ui=zh,pi=0,Ji=0,Pi=Yt==="right"?1:Yt==="left"?0:.5,zi=0;for(let ki of Kt){ki.trim();let tr=ki.getMaxScale(),ar=(tr-1)*Hi,pr={positionedGlyphs:[],lineOffset:0};Pt.positionedLines[zi]=pr;let Mr=pr.positionedGlyphs,Sr=0;if(!ki.length()){ui+=Wt,++zi;continue}for(let ji=0;ji<ki.length();ji++){let Le=ki.getSection(ji),Or=ki.getSectionIndex(ji),er=ki.getCharCode(ji),or=0,hn=null,gn=null,yn=null,Kn=Hi,cn=!(Gt===a.WritingMode.horizontal||!ce&&!ea(er)||ce&&(Lh[er]||(qi=er,Zt.Arabic(qi)||Zt["Arabic Supplement"](qi)||Zt["Arabic Extended-A"](qi)||Zt["Arabic Presentation Forms-A"](qi)||Zt["Arabic Presentation Forms-B"](qi))));if(Le.imageName){let Hr=Xt[Le.imageName];if(!Hr)continue;yn=Le.imageName,Pt.iconsInText=Pt.iconsInText||!0,gn=Hr.paddedRect;let Tr=Hr.displaySize;Le.scale=Le.scale*Hi/Be,hn={width:Tr[0],height:Tr[1],left:1,top:-3,advance:cn?Tr[1]:Tr[0]},or=ar+(Hi-Tr[1]*Le.scale),Kn=hn.advance;let Yn=cn?Tr[0]*Le.scale-Hi*tr:Tr[1]*Le.scale-Hi*tr;Yn>0&&Yn>Sr&&(Sr=Yn)}else{let Hr=le[Le.fontStack],Tr=Hr&&Hr[er];if(Tr&&Tr.rect)gn=Tr.rect,hn=Tr.metrics;else{let Yn=ee[Le.fontStack],Tl=Yn&&Yn[er];if(!Tl)continue;hn=Tl.metrics}or=(tr-Le.scale)*Hi}cn?(Pt.verticalizable=!0,Mr.push({glyph:er,imageName:yn,x:Xe,y:ui+or,vertical:cn,scale:Le.scale,fontStack:Le.fontStack,sectionIndex:Or,metrics:hn,rect:gn}),Xe+=Kn*Le.scale+fe):(Mr.push({glyph:er,imageName:yn,x:Xe,y:ui+or,vertical:cn,scale:Le.scale,fontStack:Le.fontStack,sectionIndex:Or,metrics:hn,rect:gn}),Xe+=hn.advance*Le.scale+fe)}Mr.length!==0&&(pi=Math.max(Xe-fe,pi),gy(Mr,0,Mr.length-1,Pi,Sr)),Xe=0;let fi=Wt*tr+Sr;pr.lineOffset=Math.max(Sr,ar),ui+=fi,Ji=Math.max(fi,Ji),++zi}var qi;let Qi=ui-zh,{horizontalAlign:sr,verticalAlign:wr}=mu(Qt);(function(ki,tr,ar,pr,Mr,Sr,fi,ji,Le){let Or=(tr-ar)*Mr,er=0;er=Sr!==fi?-ji*pr-zh:(-pr*Le+.5)*fi;for(let or of ki)for(let hn of or.positionedGlyphs)hn.x+=Or,hn.y+=er})(Pt.positionedLines,Pi,sr,wr,pi,Ji,Wt,Qi,Kt.length),Pt.top+=-wr*Qi,Pt.bottom=Pt.top+Qi,Pt.left+=-sr*pi,Pt.right=Pt.left+pi}(Rt,t,r,o,dt,m,x,b,z,S,D,tt),!function(Pt){for(let ee of Pt)if(ee.positionedGlyphs.length!==0)return!1;return!0}(Et)&&Rt}let Lh={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},fy={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function qp(i,t,r,o,c,f){if(t.imageName){let m=o[t.imageName];return m?m.displaySize[0]*t.scale*Hi/f+c:0}{let m=r[t.fontStack],x=m&&m[i];return x?x.metrics.advance*t.scale+c:0}}function jp(i,t,r,o){let c=Math.pow(i-t,2);return o?i<t?c/2:2*c:c+Math.abs(r)*r}function my(i,t,r){let o=0;return i===10&&(o-=1e4),r&&(o+=150),i!==40&&i!==65288||(o+=50),t!==41&&t!==65289||(o+=50),o}function $p(i,t,r,o,c,f){let m=null,x=jp(t,r,c,f);for(let b of o){let S=jp(t-b.x,r,c,f)+b.badness;S<=x&&(m=b,x=S)}return{index:i,x:t,priorBreak:m,badness:x}}function Wp(i){return i?Wp(i.priorBreak).concat(i.index):[]}function fu(i,t,r,o,c,f,m){if(f!=="point")return[];if(!i)return[];let x=[],b=function(D,O,V,tt,et,dt){let bt=0;for(let vt=0;vt<D.length();vt++){let Et=D.getSection(vt);bt+=qp(D.getCharCode(vt),Et,tt,et,O,dt)}return bt/Math.max(1,Math.ceil(bt/V))}(i,t,r,o,c,m),S=i.text.indexOf("\u200B")>=0,A=0;for(let D=0;D<i.length();D++){let O=i.getSection(D),V=i.getCharCode(D);if(Lh[V]||(A+=qp(V,O,o,c,t,m)),D<i.length()-1){let tt=!((z=V)<11904||!(Zt["Bopomofo Extended"](z)||Zt.Bopomofo(z)||Zt["CJK Compatibility Forms"](z)||Zt["CJK Compatibility Ideographs"](z)||Zt["CJK Compatibility"](z)||Zt["CJK Radicals Supplement"](z)||Zt["CJK Strokes"](z)||Zt["CJK Symbols and Punctuation"](z)||Zt["CJK Unified Ideographs Extension A"](z)||Zt["CJK Unified Ideographs"](z)||Zt["Enclosed CJK Letters and Months"](z)||Zt["Halfwidth and Fullwidth Forms"](z)||Zt.Hiragana(z)||Zt["Ideographic Description Characters"](z)||Zt["Kangxi Radicals"](z)||Zt["Katakana Phonetic Extensions"](z)||Zt.Katakana(z)||Zt["Vertical Forms"](z)||Zt["Yi Radicals"](z)||Zt["Yi Syllables"](z)));(fy[V]||tt||O.imageName)&&x.push($p(D+1,A,b,x,my(V,i.getCharCode(D+1),tt&&S),!1))}}var z;return Wp($p(i.length(),A,b,x,0,!0))}function mu(i){let t=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function gy(i,t,r,o,c){if(!o&&!c)return;let f=i[r],m=(i[r].x+f.metrics.advance*f.scale)*o;for(let x=t;x<=r;x++)i[x].x-=m,i[x].y+=c}function yy(i,t,r){let{horizontalAlign:o,verticalAlign:c}=mu(r),f=t[0]-i.displaySize[0]*o,m=t[1]-i.displaySize[1]*c;return{image:i,top:m,bottom:m+i.displaySize[1],left:f,right:f+i.displaySize[0]}}function Zp(i,t,r,o,c,f){let m=i.image,x;if(m.content){let et=m.content,dt=m.pixelRatio||1;x=[et[0]/dt,et[1]/dt,m.displaySize[0]-et[2]/dt,m.displaySize[1]-et[3]/dt]}let b=t.left*f,S=t.right*f,A,z,D,O;r==="width"||r==="both"?(O=c[0]+b-o[3],z=c[0]+S+o[1]):(O=c[0]+(b+S-m.displaySize[0])/2,z=O+m.displaySize[0]);let V=t.top*f,tt=t.bottom*f;return r==="height"||r==="both"?(A=c[1]+V-o[0],D=c[1]+tt+o[2]):(A=c[1]+(V+tt-m.displaySize[1])/2,D=A+m.displaySize[1]),{image:m,top:A,right:z,bottom:D,left:O,collisionPadding:x}}let Xn=128;function Hp(i,t){let{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new hi(i+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:o,interpolationType:c}=r,f=0;for(;f<o.length&&o[f]<=i;)f++;f=Math.max(0,f-1);let m=f;for(;m<o.length&&o[m]<i+1;)m++;m=Math.min(o.length-1,m);let x=o[f],b=o[m];return r.kind==="composite"?{kind:"composite",minZoom:x,maxZoom:b,interpolationType:c}:{kind:"camera",minZoom:x,maxZoom:b,minSize:r.evaluate(new hi(x)),maxSize:r.evaluate(new hi(b)),interpolationType:c}}}class zs extends ye{constructor(t,r,o,c){super(t,r),this.angle=o,c!==void 0&&(this.segment=c)}clone(){return new zs(this.x,this.y,this.angle,this.segment)}}function Xp(i,t,r,o,c){if(t.segment===void 0)return!0;let f=t,m=t.segment+1,x=0;for(;x>-r/2;){if(m--,m<0)return!1;x-=i[m].dist(f),f=i[m]}x+=i[m].dist(i[m+1]),m++;let b=[],S=0;for(;x<r/2;){let A=i[m],z=i[m+1];if(!z)return!1;let D=i[m-1].angleTo(A)-A.angleTo(z);for(D=Math.abs((D+3*Math.PI)%(2*Math.PI)-Math.PI),b.push({distance:x,angleDelta:D}),S+=D;x-b[0].distance>o;)S-=b.shift().angleDelta;if(S>c)return!1;m++,x+=A.dist(z)}return!0}function Kp(i){let t=0;for(let r=0;r<i.length-1;r++)t+=i[r].dist(i[r+1]);return t}function Yp(i,t,r){return i?.6*t*r:0}function Jp(i,t){return Math.max(i?i.right-i.left:0,t?t.right-t.left:0)}function _y(i,t,r,o,c,f){let m=Yp(r,c,f),x=Jp(r,o)*f,b=0,S=Kp(i)/2;for(let A=0;A<i.length-1;A++){let z=i[A],D=i[A+1],O=z.dist(D);if(b+O>S){let V=(S-b)/O,tt=Ci(z.x,D.x,V),et=Ci(z.y,D.y,V),dt=new zs(tt,et,D.angleTo(z),A);return dt._round(),!m||Xp(i,dt,x,m,t)?dt:void 0}b+=O}}function xy(i,t,r,o,c,f,m,x,b){let S=Yp(o,f,m),A=Jp(o,c),z=A*m,D=i[0].x===0||i[0].x===b||i[0].y===0||i[0].y===b;return t-z<t/4&&(t=z+t/4),Qp(i,D?t/2*x%t:(A/2+2*f)*m*x%t,t,S,r,z,D,!1,b)}function Qp(i,t,r,o,c,f,m,x,b){let S=f/2,A=Kp(i),z=0,D=t-r,O=[];for(let V=0;V<i.length-1;V++){let tt=i[V],et=i[V+1],dt=tt.dist(et),bt=et.angleTo(tt);for(;D+r<z+dt;){D+=r;let vt=(D-z)/dt,Et=Ci(tt.x,et.x,vt),Rt=Ci(tt.y,et.y,vt);if(Et>=0&&Et<b&&Rt>=0&&Rt<b&&D-S>=0&&D+S<=A){let Pt=new zs(Et,Rt,bt,V);Pt._round(),o&&!Xp(i,Pt,f,o,c)||O.push(Pt)}}z+=dt}return x||O.length||m||(O=Qp(i,z/2,r,o,c,f,m,!0,b)),O}function td(i,t,r,o,c){let f=[];for(let m=0;m<i.length;m++){let x=i[m],b;for(let S=0;S<x.length-1;S++){let A=x[S],z=x[S+1];A.x<t&&z.x<t||(A.x<t?A=new ye(t,A.y+(t-A.x)/(z.x-A.x)*(z.y-A.y))._round():z.x<t&&(z=new ye(t,A.y+(t-A.x)/(z.x-A.x)*(z.y-A.y))._round()),A.y<r&&z.y<r||(A.y<r?A=new ye(A.x+(r-A.y)/(z.y-A.y)*(z.x-A.x),r)._round():z.y<r&&(z=new ye(A.x+(r-A.y)/(z.y-A.y)*(z.x-A.x),r)._round()),A.x>=o&&z.x>=o||(A.x>=o?A=new ye(o,A.y+(o-A.x)/(z.x-A.x)*(z.y-A.y))._round():z.x>=o&&(z=new ye(o,A.y+(o-A.x)/(z.x-A.x)*(z.y-A.y))._round()),A.y>=c&&z.y>=c||(A.y>=c?A=new ye(A.x+(c-A.y)/(z.y-A.y)*(z.x-A.x),c)._round():z.y>=c&&(z=new ye(A.x+(c-A.y)/(z.y-A.y)*(z.x-A.x),c)._round()),b&&A.equals(b[b.length-1])||(b=[A],f.push(b)),b.push(z)))))}}return f}function ed(i,t,r,o){let c=[],f=i.image,m=f.pixelRatio,x=f.paddedRect.w-2,b=f.paddedRect.h-2,S=i.right-i.left,A=i.bottom-i.top,z=f.stretchX||[[0,x]],D=f.stretchY||[[0,b]],O=(Wt,Qt)=>Wt+Qt[1]-Qt[0],V=z.reduce(O,0),tt=D.reduce(O,0),et=x-V,dt=b-tt,bt=0,vt=V,Et=0,Rt=tt,Pt=0,ee=et,le=0,Xt=dt;if(f.content&&o){let Wt=f.content;bt=Dh(z,0,Wt[0]),Et=Dh(D,0,Wt[1]),vt=Dh(z,Wt[0],Wt[2]),Rt=Dh(D,Wt[1],Wt[3]),Pt=Wt[0]-bt,le=Wt[1]-Et,ee=Wt[2]-Wt[0]-vt,Xt=Wt[3]-Wt[1]-Rt}let Kt=(Wt,Qt,Yt,Gt)=>{let fe=Rh(Wt.stretch-bt,vt,S,i.left),ce=Bh(Wt.fixed-Pt,ee,Wt.stretch,V),Be=Rh(Qt.stretch-Et,Rt,A,i.top),Xe=Bh(Qt.fixed-le,Xt,Qt.stretch,tt),ui=Rh(Yt.stretch-bt,vt,S,i.left),pi=Bh(Yt.fixed-Pt,ee,Yt.stretch,V),Ji=Rh(Gt.stretch-Et,Rt,A,i.top),Pi=Bh(Gt.fixed-le,Xt,Gt.stretch,tt),zi=new ye(fe,Be),qi=new ye(ui,Be),Qi=new ye(ui,Ji),sr=new ye(fe,Ji),wr=new ye(ce/m,Xe/m),ki=new ye(pi/m,Pi/m),tr=t*Math.PI/180;if(tr){let Mr=Math.sin(tr),Sr=Math.cos(tr),fi=[Sr,-Mr,Mr,Sr];zi._matMult(fi),qi._matMult(fi),sr._matMult(fi),Qi._matMult(fi)}let ar=Wt.stretch+Wt.fixed,pr=Qt.stretch+Qt.fixed;return{tl:zi,tr:qi,bl:sr,br:Qi,tex:{x:f.paddedRect.x+1+ar,y:f.paddedRect.y+1+pr,w:Yt.stretch+Yt.fixed-ar,h:Gt.stretch+Gt.fixed-pr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:wr,pixelOffsetBR:ki,minFontScaleX:ee/m/S,minFontScaleY:Xt/m/A,isSDF:r}};if(o&&(f.stretchX||f.stretchY)){let Wt=id(z,et,V),Qt=id(D,dt,tt);for(let Yt=0;Yt<Wt.length-1;Yt++){let Gt=Wt[Yt],fe=Wt[Yt+1];for(let ce=0;ce<Qt.length-1;ce++)c.push(Kt(Gt,Qt[ce],fe,Qt[ce+1]))}}else c.push(Kt({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:x+1},{fixed:0,stretch:b+1}));return c}function Dh(i,t,r){let o=0;for(let c of i)o+=Math.max(t,Math.min(r,c[1]))-Math.max(t,Math.min(r,c[0]));return o}function id(i,t,r){let o=[{fixed:-1,stretch:0}];for(let[c,f]of i){let m=o[o.length-1];o.push({fixed:c-m.stretch,stretch:m.stretch}),o.push({fixed:c-m.stretch,stretch:m.stretch+(f-c)})}return o.push({fixed:t+1,stretch:r}),o}function Rh(i,t,r,o){return i/t*r+o}function Bh(i,t,r,o){return i-t*r/o}te("Anchor",zs);class Fh{constructor(t,r,o,c,f,m,x,b,S,A){if(this.boxStartIndex=t.length,S){let z=m.top,D=m.bottom,O=m.collisionPadding;O&&(z-=O[1],D+=O[3]);let V=D-z;V>0&&(V=Math.max(10,V),this.circleDiameter=V)}else{let z=m.top*x-b,D=m.bottom*x+b,O=m.left*x-b,V=m.right*x+b,tt=m.collisionPadding;if(tt&&(O-=tt[0]*x,z-=tt[1]*x,V+=tt[2]*x,D+=tt[3]*x),A){let et=new ye(O,z),dt=new ye(V,z),bt=new ye(O,D),vt=new ye(V,D),Et=A*Math.PI/180;et._rotate(Et),dt._rotate(Et),bt._rotate(Et),vt._rotate(Et),O=Math.min(et.x,dt.x,bt.x,vt.x),V=Math.max(et.x,dt.x,bt.x,vt.x),z=Math.min(et.y,dt.y,bt.y,vt.y),D=Math.max(et.y,dt.y,bt.y,vt.y)}t.emplaceBack(r.x,r.y,O,z,V,D,o,c,f)}this.boxEndIndex=t.length}}class vy{constructor(t=[],r=by){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;let t=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:r,compare:o}=this,c=r[t];for(;t>0;){let f=t-1>>1,m=r[f];if(o(c,m)>=0)break;r[t]=m,t=f}r[t]=c}_down(t){let{data:r,compare:o}=this,c=this.length>>1,f=r[t];for(;t<c;){let m=1+(t<<1),x=r[m],b=m+1;if(b<this.length&&o(r[b],x)<0&&(m=b,x=r[b]),o(x,f)>=0)break;r[t]=x,t=m}r[t]=f}}function by(i,t){return i<t?-1:i>t?1:0}function wy(i,t=1,r=!1){let o=1/0,c=1/0,f=-1/0,m=-1/0,x=i[0];for(let O=0;O<x.length;O++){let V=x[O];(!O||V.x<o)&&(o=V.x),(!O||V.y<c)&&(c=V.y),(!O||V.x>f)&&(f=V.x),(!O||V.y>m)&&(m=V.y)}let b=Math.min(f-o,m-c),S=b/2,A=new vy([],My);if(b===0)return new ye(o,c);for(let O=o;O<f;O+=b)for(let V=c;V<m;V+=b)A.push(new oo(O+S,V+S,S,i));let z=function(O){let V=0,tt=0,et=0,dt=O[0];for(let bt=0,vt=dt.length,Et=vt-1;bt<vt;Et=bt++){let Rt=dt[bt],Pt=dt[Et],ee=Rt.x*Pt.y-Pt.x*Rt.y;tt+=(Rt.x+Pt.x)*ee,et+=(Rt.y+Pt.y)*ee,V+=3*ee}return new oo(tt/V,et/V,0,O)}(i),D=A.length;for(;A.length;){let O=A.pop();(O.d>z.d||!z.d)&&(z=O,r&&console.log("found best %d after %d probes",Math.round(1e4*O.d)/1e4,D)),O.max-z.d<=t||(S=O.h/2,A.push(new oo(O.p.x-S,O.p.y-S,S,i)),A.push(new oo(O.p.x+S,O.p.y-S,S,i)),A.push(new oo(O.p.x-S,O.p.y+S,S,i)),A.push(new oo(O.p.x+S,O.p.y+S,S,i)),D+=4)}return r&&(console.log(`num probes: ${D}`),console.log(`best distance: ${z.d}`)),z.p}function My(i,t){return t.max-i.max}function oo(i,t,r,o){this.p=new ye(i,t),this.h=r,this.d=function(c,f){let m=!1,x=1/0;for(let b=0;b<f.length;b++){let S=f[b];for(let A=0,z=S.length,D=z-1;A<z;D=A++){let O=S[A],V=S[D];O.y>c.y!=V.y>c.y&&c.x<(V.x-O.x)*(c.y-O.y)/(V.y-O.y)+O.x&&(m=!m),x=Math.min(x,dp(c,O,V))}}return(m?1:-1)*Math.sqrt(x)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}let gu=Number.POSITIVE_INFINITY;function rd(i,t){return t[1]!==gu?function(r,o,c){let f=0,m=0;switch(o=Math.abs(o),c=Math.abs(c),r){case"top-right":case"top-left":case"top":m=c-7;break;case"bottom-right":case"bottom-left":case"bottom":m=7-c}switch(r){case"top-right":case"bottom-right":case"right":f=-o;break;case"top-left":case"bottom-left":case"left":f=o}return[f,m]}(i,t[0],t[1]):function(r,o){let c=0,f=0;o<0&&(o=0);let m=o/Math.sqrt(2);switch(r){case"top-right":case"top-left":f=m-7;break;case"bottom-right":case"bottom-left":f=7-m;break;case"bottom":f=7-o;break;case"top":f=o-7}switch(r){case"top-right":case"bottom-right":c=-m;break;case"top-left":case"bottom-left":c=m;break;case"left":c=o;break;case"right":c=-o}return[c,f]}(i,t[0])}function yu(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Sy(i,t,r,o,c,f,m,x,b,S,A){let z=f.textMaxSize.evaluate(t,{});z===void 0&&(z=m);let D=i.layers[0].layout,O=D.get("icon-offset").evaluate(t,{},A),V=sd(r.horizontal),tt=m/24,et=i.tilePixelRatio*tt,dt=i.tilePixelRatio*z/24,bt=i.tilePixelRatio*x,vt=i.tilePixelRatio*D.get("symbol-spacing"),Et=D.get("text-padding")*i.tilePixelRatio,Rt=D.get("icon-padding")*i.tilePixelRatio,Pt=D.get("text-max-angle")/180*Math.PI,ee=D.get("text-rotation-alignment")!=="viewport"&&D.get("symbol-placement")!=="point",le=D.get("icon-rotation-alignment")==="map"&&D.get("symbol-placement")!=="point",Xt=D.get("symbol-placement"),Kt=vt/2,Wt=D.get("icon-text-fit"),Qt;o&&Wt!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Qt=Zp(o,r.vertical,Wt,D.get("icon-text-fit-padding"),O,tt)),V&&(o=Zp(o,V,Wt,D.get("icon-text-fit-padding"),O,tt)));let Yt=(Gt,fe)=>{fe.x<0||fe.x>=Ni||fe.y<0||fe.y>=Ni||function(ce,Be,Xe,ui,pi,Ji,Pi,zi,qi,Qi,sr,wr,ki,tr,ar,pr,Mr,Sr,fi,ji,Le,Or,er,or,hn){let gn=ce.addToLineVertexArray(Be,Xe),yn,Kn,cn,Hr,Tr=0,Yn=0,Tl=0,bd=0,Iu=-1,Cu=-1,Jn={},wd=cl(""),Au=0,Pu=0;if(zi._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Au,Pu]=zi.layout.get("text-offset").evaluate(Le,{},or).map(Er=>Er*Hi):(Au=zi.layout.get("text-radial-offset").evaluate(Le,{},or)*Hi,Pu=gu),ce.allowVerticalPlacement&&ui.vertical){let Er=zi.layout.get("text-rotate").evaluate(Le,{},or)+90;cn=new Fh(qi,Be,Qi,sr,wr,ui.vertical,ki,tr,ar,Er),Pi&&(Hr=new Fh(qi,Be,Qi,sr,wr,Pi,Mr,Sr,ar,Er))}if(pi){let Er=zi.layout.get("icon-rotate").evaluate(Le,{}),In=zi.layout.get("icon-text-fit")!=="none",El=ed(pi,Er,er,In),Il=Pi?ed(Pi,Er,er,In):void 0;Kn=new Fh(qi,Be,Qi,sr,wr,pi,Mr,Sr,!1,Er),Tr=4*El.length;let Td=ce.iconSizeData,ca=null;Td.kind==="source"?(ca=[Xn*zi.layout.get("icon-size").evaluate(Le,{})],ca[0]>ks&&oe(`${ce.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Td.kind==="composite"&&(ca=[Xn*Or.compositeIconSizes[0].evaluate(Le,{},or),Xn*Or.compositeIconSizes[1].evaluate(Le,{},or)],(ca[0]>ks||ca[1]>ks)&&oe(`${ce.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),ce.addSymbols(ce.icon,El,ca,ji,fi,Le,a.WritingMode.none,Be,gn.lineStartIndex,gn.lineLength,-1,or),Iu=ce.icon.placedSymbolArray.length-1,Il&&(Yn=4*Il.length,ce.addSymbols(ce.icon,Il,ca,ji,fi,Le,a.WritingMode.vertical,Be,gn.lineStartIndex,gn.lineLength,-1,or),Cu=ce.icon.placedSymbolArray.length-1)}let Md=Object.keys(ui.horizontal);for(let Er of Md){let In=ui.horizontal[Er];if(!yn){wd=cl(In.text);let Il=zi.layout.get("text-rotate").evaluate(Le,{},or);yn=new Fh(qi,Be,Qi,sr,wr,In,ki,tr,ar,Il)}let El=In.positionedLines.length===1;if(Tl+=nd(ce,Be,In,Ji,zi,ar,Le,pr,gn,ui.vertical?a.WritingMode.horizontal:a.WritingMode.horizontalOnly,El?Md:[Er],Jn,Iu,Or,or),El)break}ui.vertical&&(bd+=nd(ce,Be,ui.vertical,Ji,zi,ar,Le,pr,gn,a.WritingMode.vertical,["vertical"],Jn,Cu,Or,or));let Fy=yn?yn.boxStartIndex:ce.collisionBoxArray.length,Oy=yn?yn.boxEndIndex:ce.collisionBoxArray.length,Ny=cn?cn.boxStartIndex:ce.collisionBoxArray.length,Uy=cn?cn.boxEndIndex:ce.collisionBoxArray.length,Vy=Kn?Kn.boxStartIndex:ce.collisionBoxArray.length,Gy=Kn?Kn.boxEndIndex:ce.collisionBoxArray.length,qy=Hr?Hr.boxStartIndex:ce.collisionBoxArray.length,jy=Hr?Hr.boxEndIndex:ce.collisionBoxArray.length,_n=-1,Gh=(Er,In)=>Er&&Er.circleDiameter?Math.max(Er.circleDiameter,In):In;_n=Gh(yn,_n),_n=Gh(cn,_n),_n=Gh(Kn,_n),_n=Gh(Hr,_n);let Sd=_n>-1?1:0;Sd&&(_n*=hn/Hi),ce.glyphOffsetArray.length>=lo.MAX_GLYPHS&&oe("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Le.sortKey!==void 0&&ce.addToSortKeyRanges(ce.symbolInstances.length,Le.sortKey),ce.symbolInstances.emplaceBack(Be.x,Be.y,Jn.right>=0?Jn.right:-1,Jn.center>=0?Jn.center:-1,Jn.left>=0?Jn.left:-1,Jn.vertical||-1,Iu,Cu,wd,Fy,Oy,Ny,Uy,Vy,Gy,qy,jy,Qi,Tl,bd,Tr,Yn,Sd,0,ki,Au,Pu,_n)}(i,fe,Gt,r,o,c,Qt,i.layers[0],i.collisionBoxArray,t.index,t.sourceLayerIndex,i.index,et,Et,ee,b,bt,Rt,le,O,t,f,S,A,m)};if(Xt==="line")for(let Gt of td(t.geometry,0,0,Ni,Ni)){let fe=xy(Gt,vt,Pt,r.vertical||V,o,24,dt,i.overscaling,Ni);for(let ce of fe){let Be=V;Be&&Ty(i,Be.text,Kt,ce)||Yt(Gt,ce)}}else if(Xt==="line-center"){for(let Gt of t.geometry)if(Gt.length>1){let fe=_y(Gt,Pt,r.vertical||V,o,24,dt);fe&&Yt(Gt,fe)}}else if(t.type==="Polygon")for(let Gt of nu(t.geometry,0)){let fe=wy(Gt,16);Yt(Gt[0],new zs(fe.x,fe.y,0))}else if(t.type==="LineString")for(let Gt of t.geometry)Yt(Gt,new zs(Gt[0].x,Gt[0].y,0));else if(t.type==="Point")for(let Gt of t.geometry)for(let fe of Gt)Yt([fe],new zs(fe.x,fe.y,0))}let ks=32640;function nd(i,t,r,o,c,f,m,x,b,S,A,z,D,O,V){let tt=function(bt,vt,Et,Rt,Pt,ee,le,Xt){let Kt=Rt.layout.get("text-rotate").evaluate(ee,{})*Math.PI/180,Wt=[];for(let Qt of vt.positionedLines)for(let Yt of Qt.positionedGlyphs){if(!Yt.rect)continue;let Gt=Yt.rect||{},fe=4,ce=!0,Be=1,Xe=0,ui=(Pt||Xt)&&Yt.vertical,pi=Yt.metrics.advance*Yt.scale/2;if(Xt&&vt.verticalizable){let fi=(Yt.scale-1)*Hi,ji=(Hi-Yt.metrics.width*Yt.scale)/2;Xe=Qt.lineOffset/2-(Yt.imageName?-ji:fi)}if(Yt.imageName){let fi=le[Yt.imageName];ce=fi.sdf,Be=fi.pixelRatio,fe=1/Be}let Ji=Pt?[Yt.x+pi,Yt.y]:[0,0],Pi=Pt?[0,0]:[Yt.x+pi+Et[0],Yt.y+Et[1]-Xe],zi=[0,0];ui&&(zi=Pi,Pi=[0,0]);let qi=(Yt.metrics.left-fe)*Yt.scale-pi+Pi[0],Qi=(-Yt.metrics.top-fe)*Yt.scale+Pi[1],sr=qi+Gt.w*Yt.scale/Be,wr=Qi+Gt.h*Yt.scale/Be,ki=new ye(qi,Qi),tr=new ye(sr,Qi),ar=new ye(qi,wr),pr=new ye(sr,wr);if(ui){let fi=new ye(-pi,pi-zh),ji=-Math.PI/2,Le=12-pi,Or=new ye(22-Le,-(Yt.imageName?Le:0)),er=new ye(...zi);ki._rotateAround(ji,fi)._add(Or)._add(er),tr._rotateAround(ji,fi)._add(Or)._add(er),ar._rotateAround(ji,fi)._add(Or)._add(er),pr._rotateAround(ji,fi)._add(Or)._add(er)}if(Kt){let fi=Math.sin(Kt),ji=Math.cos(Kt),Le=[ji,-fi,fi,ji];ki._matMult(Le),tr._matMult(Le),ar._matMult(Le),pr._matMult(Le)}let Mr=new ye(0,0),Sr=new ye(0,0);Wt.push({tl:ki,tr,bl:ar,br:pr,tex:Gt,writingMode:vt.writingMode,glyphOffset:Ji,sectionIndex:Yt.sectionIndex,isSDF:ce,pixelOffsetTL:Mr,pixelOffsetBR:Sr,minFontScaleX:0,minFontScaleY:0})}return Wt}(0,r,x,c,f,m,o,i.allowVerticalPlacement),et=i.textSizeData,dt=null;et.kind==="source"?(dt=[Xn*c.layout.get("text-size").evaluate(m,{})],dt[0]>ks&&oe(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):et.kind==="composite"&&(dt=[Xn*O.compositeTextSizes[0].evaluate(m,{},V),Xn*O.compositeTextSizes[1].evaluate(m,{},V)],(dt[0]>ks||dt[1]>ks)&&oe(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,tt,dt,x,f,m,S,t,b.lineStartIndex,b.lineLength,D,V);for(let bt of A)z[bt]=i.text.placedSymbolArray.length-1;return 4*tt.length}function sd(i){for(let t in i)return i[t];return null}function Ty(i,t,r,o){let c=i.compareText;if(t in c){let f=c[t];for(let m=f.length-1;m>=0;m--)if(o.dist(f[m])<r)return!0}else c[t]=[];return c[t].push(o),!1}let Ey=As.VectorTileFeature.types,Iy=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Oh(i,t,r,o,c,f,m,x,b,S,A,z,D){let O=x?Math.min(ks,Math.round(x[0])):0,V=x?Math.min(ks,Math.round(x[1])):0;i.emplaceBack(t,r,Math.round(32*o),Math.round(32*c),f,m,(O<<1)+(b?1:0),V,16*S,16*A,256*z,256*D)}function _u(i,t,r){i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r),i.emplaceBack(t.x,t.y,r)}function Cy(i){for(let t of i.sections)if(qc(t.text))return!0;return!1}class xu{constructor(t){this.layoutVertexArray=new Zi,this.indexArray=new ur,this.programConfigurations=t,this.segments=new je,this.dynamicLayoutVertexArray=new vr,this.opacityVertexArray=new Br,this.placedSymbolArray=new Ft}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,o,c){this.isEmpty()||(o&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Yg.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Jg.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Iy,!0),this.opacityVertexBuffer.itemSize=1),(o||c)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}te("SymbolBuffers",xu);class vu{constructor(t,r,o){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new o,this.segments=new je,this.collisionVertexArray=new En}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Qg.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}te("CollisionBuffers",vu);class lo{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(m=>m.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=Yc([]),this.placementViewportMatrix=Yc([]);let r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Hp(this.zoom,r["text-size"]),this.iconSizeData=Hp(this.zoom,r["icon-size"]);let o=this.layers[0].layout,c=o.get("symbol-sort-key"),f=o.get("symbol-z-order");this.canOverlap=wu(o,"text-overlap","text-allow-overlap")!=="never"||wu(o,"icon-overlap","icon-allow-overlap")!=="never"||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=f!=="viewport-y"&&!c.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(m=>a.WritingMode[m])),this.stateDependentLayerIds=this.layers.filter(m=>m.isStateDependent()).map(m=>m.id),this.sourceID=t.sourceID}createArrays(){this.text=new xu(new aa(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new xu(new aa(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new ie,this.lineVertexArray=new Ht,this.symbolInstances=new It}calculateGlyphDependencies(t,r,o,c,f){for(let m=0;m<t.length;m++)if(r[t.charCodeAt(m)]=!0,(o||c)&&f){let x=bl[t.charAt(m)];x&&(r[x.charCodeAt(0)]=!0)}}populate(t,r,o){let c=this.layers[0],f=c.layout,m=f.get("text-font"),x=f.get("text-field"),b=f.get("icon-image"),S=(x.value.kind!=="constant"||x.value.value instanceof Y&&!x.value.value.isEmpty()||x.value.value.toString().length>0)&&(m.value.kind!=="constant"||m.value.value.length>0),A=b.value.kind!=="constant"||!!b.value.value||Object.keys(b.parameters).length>0,z=f.get("symbol-sort-key");if(this.features=[],!S&&!A)return;let D=r.iconDependencies,O=r.glyphDependencies,V=r.availableImages,tt=new hi(this.zoom);for(let{feature:et,id:dt,index:bt,sourceLayerIndex:vt}of t){let Et=c._featureFilter.needGeometry,Rt=la(et,Et);if(!c._featureFilter.filter(tt,Rt,o))continue;let Pt,ee;if(Et||(Rt.geometry=oa(et)),S){let Xt=c.getValueAndResolveTokens("text-field",Rt,o,V),Kt=Y.factory(Xt);Cy(Kt)&&(this.hasRTLText=!0),(!this.hasRTLText||ol()==="unavailable"||this.hasRTLText&&Rr.isParsed())&&(Pt=ey(Kt,c,Rt))}if(A){let Xt=c.getValueAndResolveTokens("icon-image",Rt,o,V);ee=Xt instanceof at?Xt:at.fromString(Xt)}if(!Pt&&!ee)continue;let le=this.sortFeaturesByKey?z.evaluate(Rt,{},o):void 0;if(this.features.push({id:dt,text:Pt,icon:ee,index:bt,sourceLayerIndex:vt,geometry:Rt.geometry,properties:et.properties,type:Ey[et.type],sortKey:le}),ee&&(D[ee.name]=!0),Pt){let Xt=m.evaluate(Rt,{},o).join(","),Kt=f.get("text-rotation-alignment")!=="viewport"&&f.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(a.WritingMode.vertical)>=0;for(let Wt of Pt.sections)if(Wt.image)D[Wt.image.name]=!0;else{let Qt=il(Pt.toString()),Yt=Wt.fontStack||Xt,Gt=O[Yt]=O[Yt]||{};this.calculateGlyphDependencies(Wt.text,Gt,Kt,this.allowVerticalPlacement,Qt)}}}f.get("symbol-placement")==="line"&&(this.features=function(et){let dt={},bt={},vt=[],Et=0;function Rt(Xt){vt.push(et[Xt]),Et++}function Pt(Xt,Kt,Wt){let Qt=bt[Xt];return delete bt[Xt],bt[Kt]=Qt,vt[Qt].geometry[0].pop(),vt[Qt].geometry[0]=vt[Qt].geometry[0].concat(Wt[0]),Qt}function ee(Xt,Kt,Wt){let Qt=dt[Kt];return delete dt[Kt],dt[Xt]=Qt,vt[Qt].geometry[0].shift(),vt[Qt].geometry[0]=Wt[0].concat(vt[Qt].geometry[0]),Qt}function le(Xt,Kt,Wt){let Qt=Wt?Kt[0][Kt[0].length-1]:Kt[0][0];return`${Xt}:${Qt.x}:${Qt.y}`}for(let Xt=0;Xt<et.length;Xt++){let Kt=et[Xt],Wt=Kt.geometry,Qt=Kt.text?Kt.text.toString():null;if(!Qt){Rt(Xt);continue}let Yt=le(Qt,Wt),Gt=le(Qt,Wt,!0);if(Yt in bt&&Gt in dt&&bt[Yt]!==dt[Gt]){let fe=ee(Yt,Gt,Wt),ce=Pt(Yt,Gt,vt[fe].geometry);delete dt[Yt],delete bt[Gt],bt[le(Qt,vt[ce].geometry,!0)]=ce,vt[fe].geometry=null}else Yt in bt?Pt(Yt,Gt,Wt):Gt in dt?ee(Yt,Gt,Wt):(Rt(Xt),dt[Yt]=Et-1,bt[Gt]=Et-1)}return vt.filter(Xt=>Xt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((et,dt)=>et.sortKey-dt.sortKey)}update(t,r,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,o),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,o))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(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}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,r){let o=this.lineVertexArray.length;if(t.segment!==void 0){let c=t.dist(r[t.segment+1]),f=t.dist(r[t.segment]),m={};for(let x=t.segment+1;x<r.length;x++)m[x]={x:r[x].x,y:r[x].y,tileUnitDistanceFromAnchor:c},x<r.length-1&&(c+=r[x+1].dist(r[x]));for(let x=t.segment||0;x>=0;x--)m[x]={x:r[x].x,y:r[x].y,tileUnitDistanceFromAnchor:f},x>0&&(f+=r[x-1].dist(r[x]));for(let x=0;x<r.length;x++){let b=m[x];this.lineVertexArray.emplaceBack(b.x,b.y,b.tileUnitDistanceFromAnchor)}}return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(t,r,o,c,f,m,x,b,S,A,z,D){let O=t.indexArray,V=t.layoutVertexArray,tt=t.segments.prepareSegment(4*r.length,V,O,this.canOverlap?m.sortKey:void 0),et=this.glyphOffsetArray.length,dt=tt.vertexLength,bt=this.allowVerticalPlacement&&x===a.WritingMode.vertical?Math.PI/2:0,vt=m.text&&m.text.sections;for(let Et=0;Et<r.length;Et++){let{tl:Rt,tr:Pt,bl:ee,br:le,tex:Xt,pixelOffsetTL:Kt,pixelOffsetBR:Wt,minFontScaleX:Qt,minFontScaleY:Yt,glyphOffset:Gt,isSDF:fe,sectionIndex:ce}=r[Et],Be=tt.vertexLength,Xe=Gt[1];Oh(V,b.x,b.y,Rt.x,Xe+Rt.y,Xt.x,Xt.y,o,fe,Kt.x,Kt.y,Qt,Yt),Oh(V,b.x,b.y,Pt.x,Xe+Pt.y,Xt.x+Xt.w,Xt.y,o,fe,Wt.x,Kt.y,Qt,Yt),Oh(V,b.x,b.y,ee.x,Xe+ee.y,Xt.x,Xt.y+Xt.h,o,fe,Kt.x,Wt.y,Qt,Yt),Oh(V,b.x,b.y,le.x,Xe+le.y,Xt.x+Xt.w,Xt.y+Xt.h,o,fe,Wt.x,Wt.y,Qt,Yt),_u(t.dynamicLayoutVertexArray,b,bt),O.emplaceBack(Be,Be+1,Be+2),O.emplaceBack(Be+1,Be+2,Be+3),tt.vertexLength+=4,tt.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Gt[0]),Et!==r.length-1&&ce===r[Et+1].sectionIndex||t.programConfigurations.populatePaintArrays(V.length,m,m.index,{},D,vt&&vt[ce])}t.placedSymbolArray.emplaceBack(b.x,b.y,et,this.glyphOffsetArray.length-et,dt,S,A,b.segment,o?o[0]:0,o?o[1]:0,c[0],c[1],x,0,!1,0,z)}_addCollisionDebugVertex(t,r,o,c,f,m){return r.emplaceBack(0,0),t.emplaceBack(o.x,o.y,c,f,Math.round(m.x),Math.round(m.y))}addCollisionDebugVertices(t,r,o,c,f,m,x){let b=f.segments.prepareSegment(4,f.layoutVertexArray,f.indexArray),S=b.vertexLength,A=f.layoutVertexArray,z=f.collisionVertexArray,D=x.anchorX,O=x.anchorY;this._addCollisionDebugVertex(A,z,m,D,O,new ye(t,r)),this._addCollisionDebugVertex(A,z,m,D,O,new ye(o,r)),this._addCollisionDebugVertex(A,z,m,D,O,new ye(o,c)),this._addCollisionDebugVertex(A,z,m,D,O,new ye(t,c)),b.vertexLength+=4;let V=f.indexArray;V.emplaceBack(S,S+1),V.emplaceBack(S+1,S+2),V.emplaceBack(S+2,S+3),V.emplaceBack(S+3,S),b.primitiveLength+=4}addDebugCollisionBoxes(t,r,o,c){for(let f=t;f<r;f++){let m=this.collisionBoxArray.get(f);this.addCollisionDebugVertices(m.x1,m.y1,m.x2,m.y2,c?this.textCollisionBox:this.iconCollisionBox,m.anchorPoint,o)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new vu(Fr,Dp.members,sn),this.iconCollisionBox=new vu(Fr,Dp.members,sn);for(let t=0;t<this.symbolInstances.length;t++){let r=this.symbolInstances.get(t);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(t,r,o,c,f,m,x,b,S){let A={};for(let z=r;z<o;z++){let D=t.get(z);A.textBox={x1:D.x1,y1:D.y1,x2:D.x2,y2:D.y2,anchorPointX:D.anchorPointX,anchorPointY:D.anchorPointY},A.textFeatureIndex=D.featureIndex;break}for(let z=c;z<f;z++){let D=t.get(z);A.verticalTextBox={x1:D.x1,y1:D.y1,x2:D.x2,y2:D.y2,anchorPointX:D.anchorPointX,anchorPointY:D.anchorPointY},A.verticalTextFeatureIndex=D.featureIndex;break}for(let z=m;z<x;z++){let D=t.get(z);A.iconBox={x1:D.x1,y1:D.y1,x2:D.x2,y2:D.y2,anchorPointX:D.anchorPointX,anchorPointY:D.anchorPointY},A.iconFeatureIndex=D.featureIndex;break}for(let z=b;z<S;z++){let D=t.get(z);A.verticalIconBox={x1:D.x1,y1:D.y1,x2:D.x2,y2:D.y2,anchorPointX:D.anchorPointX,anchorPointY:D.anchorPointY},A.verticalIconFeatureIndex=D.featureIndex;break}return A}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let o=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,o.textBoxStartIndex,o.textBoxEndIndex,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o.iconBoxStartIndex,o.iconBoxEndIndex,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,r){let o=t.placedSymbolArray.get(r),c=o.vertexStartIndex+4*o.numGlyphs;for(let f=o.vertexStartIndex;f<c;f+=4)t.indexArray.emplaceBack(f,f+1,f+2),t.indexArray.emplaceBack(f+1,f+2,f+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let r=Math.sin(t),o=Math.cos(t),c=[],f=[],m=[];for(let x=0;x<this.symbolInstances.length;++x){m.push(x);let b=this.symbolInstances.get(x);c.push(0|Math.round(r*b.anchorX+o*b.anchorY)),f.push(b.featureIndex)}return m.sort((x,b)=>c[x]-c[b]||f[b]-f[x]),m}addToSortKeyRanges(t,r){let o=this.sortKeyRanges[this.sortKeyRanges.length-1];o&&o.sortKey===r?o.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){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(let r of this.symbolInstanceIndexes){let o=this.symbolInstances.get(r);this.featureSortOrder.push(o.featureIndex),[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((c,f,m)=>{c>=0&&m.indexOf(c)===f&&this.addIndicesForPlacedSymbol(this.text,c)}),o.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,o.verticalPlacedTextSymbolIndex),o.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.placedIconSymbolIndex),o.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}te("SymbolBucket",lo,{omit:["layers","collisionBoxArray","features","compareText"]}),lo.MAX_GLYPHS=65535,lo.addDynamicAttributes=_u;let Ay=new Fi({"symbol-placement":new ne(ct.layout_symbol["symbol-placement"]),"symbol-spacing":new ne(ct.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new ne(ct.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new de(ct.layout_symbol["symbol-sort-key"]),"symbol-z-order":new ne(ct.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new ne(ct.layout_symbol["icon-allow-overlap"]),"icon-overlap":new ne(ct.layout_symbol["icon-overlap"]),"icon-ignore-placement":new ne(ct.layout_symbol["icon-ignore-placement"]),"icon-optional":new ne(ct.layout_symbol["icon-optional"]),"icon-rotation-alignment":new ne(ct.layout_symbol["icon-rotation-alignment"]),"icon-size":new de(ct.layout_symbol["icon-size"]),"icon-text-fit":new ne(ct.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ne(ct.layout_symbol["icon-text-fit-padding"]),"icon-image":new de(ct.layout_symbol["icon-image"]),"icon-rotate":new de(ct.layout_symbol["icon-rotate"]),"icon-padding":new ne(ct.layout_symbol["icon-padding"]),"icon-keep-upright":new ne(ct.layout_symbol["icon-keep-upright"]),"icon-offset":new de(ct.layout_symbol["icon-offset"]),"icon-anchor":new de(ct.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new ne(ct.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new ne(ct.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new ne(ct.layout_symbol["text-rotation-alignment"]),"text-field":new de(ct.layout_symbol["text-field"]),"text-font":new de(ct.layout_symbol["text-font"]),"text-size":new de(ct.layout_symbol["text-size"]),"text-max-width":new de(ct.layout_symbol["text-max-width"]),"text-line-height":new ne(ct.layout_symbol["text-line-height"]),"text-letter-spacing":new de(ct.layout_symbol["text-letter-spacing"]),"text-justify":new de(ct.layout_symbol["text-justify"]),"text-radial-offset":new de(ct.layout_symbol["text-radial-offset"]),"text-variable-anchor":new ne(ct.layout_symbol["text-variable-anchor"]),"text-anchor":new de(ct.layout_symbol["text-anchor"]),"text-max-angle":new ne(ct.layout_symbol["text-max-angle"]),"text-writing-mode":new ne(ct.layout_symbol["text-writing-mode"]),"text-rotate":new de(ct.layout_symbol["text-rotate"]),"text-padding":new ne(ct.layout_symbol["text-padding"]),"text-keep-upright":new ne(ct.layout_symbol["text-keep-upright"]),"text-transform":new de(ct.layout_symbol["text-transform"]),"text-offset":new de(ct.layout_symbol["text-offset"]),"text-allow-overlap":new ne(ct.layout_symbol["text-allow-overlap"]),"text-overlap":new ne(ct.layout_symbol["text-overlap"]),"text-ignore-placement":new ne(ct.layout_symbol["text-ignore-placement"]),"text-optional":new ne(ct.layout_symbol["text-optional"])});var bu={paint:new Fi({"icon-opacity":new de(ct.paint_symbol["icon-opacity"]),"icon-color":new de(ct.paint_symbol["icon-color"]),"icon-halo-color":new de(ct.paint_symbol["icon-halo-color"]),"icon-halo-width":new de(ct.paint_symbol["icon-halo-width"]),"icon-halo-blur":new de(ct.paint_symbol["icon-halo-blur"]),"icon-translate":new ne(ct.paint_symbol["icon-translate"]),"icon-translate-anchor":new ne(ct.paint_symbol["icon-translate-anchor"]),"text-opacity":new de(ct.paint_symbol["text-opacity"]),"text-color":new de(ct.paint_symbol["text-color"],{runtimeType:ai,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new de(ct.paint_symbol["text-halo-color"]),"text-halo-width":new de(ct.paint_symbol["text-halo-width"]),"text-halo-blur":new de(ct.paint_symbol["text-halo-blur"]),"text-translate":new ne(ct.paint_symbol["text-translate"]),"text-translate-anchor":new ne(ct.paint_symbol["text-translate-anchor"])}),layout:Ay};class ad{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Pe,this.defaultValue=t}evaluate(t){if(t.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}te("FormatSectionOverride",ad,{omit:["defaultValue"]});class Nh extends cr{constructor(t){super(t,bu)}recalculate(t,r){if(super.recalculate(t,r),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")==="map"?"map":"viewport"),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"){let o=this.layout.get("text-writing-mode");if(o){let c=[];for(let f of o)c.indexOf(f)<0&&c.push(f);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,o,c){let f=this.layout.get(t).evaluate(r,{},o,c),m=this._unevaluatedLayout._values[t];return m.isDataDriven()||Ra(m.value)||!f?f:function(x,b){return b.replace(/{([^{}]+)}/g,(S,A)=>A in x?String(x[A]):"")}(r.properties,f)}createBucket(t){return new lo(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(let t of bu.paint.overridableProperties){if(!Nh.hasPaintOverride(this.layout,t))continue;let r=this.paint.get(t),o=new ad(r),c=new Ko(o,r.property.specification),f=null;f=r.value.kind==="constant"||r.value.kind==="source"?new Fa("source",c):new Oa("composite",c,r.value.zoomStops,r.value._interpolationType),this.paint._values[t]=new nn(r.property,f,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,o){return!(!this.layout||r.isDataDriven()||o.isDataDriven())&&Nh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){let o=t.get("text-field"),c=bu.paint.properties[r],f=!1,m=x=>{for(let b of x)if(c.overrides&&c.overrides.hasOverride(b))return void(f=!0)};if(o.value.kind==="constant"&&o.value.value instanceof Y)m(o.value.value.sections);else if(o.value.kind==="source"){let x=S=>{f||(S instanceof kt&&ot(S.value)===mi?m(S.value.sections):S instanceof se?m(S.sections):S.eachChild(x))},b=o.value;b._styleExpression&&x(b._styleExpression.expression)}return f}}function wu(i,t,r){let o="never",c=i.get(t);return c?o=c:i.get(r)&&(o="always"),o}var Py={paint:new Fi({"background-color":new ne(ct.paint_background["background-color"]),"background-pattern":new ra(ct.paint_background["background-pattern"]),"background-opacity":new ne(ct.paint_background["background-opacity"])})},zy={paint:new Fi({"raster-opacity":new ne(ct.paint_raster["raster-opacity"]),"raster-hue-rotate":new ne(ct.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new ne(ct.paint_raster["raster-brightness-min"]),"raster-brightness-max":new ne(ct.paint_raster["raster-brightness-max"]),"raster-saturation":new ne(ct.paint_raster["raster-saturation"]),"raster-contrast":new ne(ct.paint_raster["raster-contrast"]),"raster-resampling":new ne(ct.paint_raster["raster-resampling"]),"raster-fade-duration":new ne(ct.paint_raster["raster-fade-duration"])})};class ky extends cr{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}}let Ly={circle:class extends cr{constructor(i){super(i,ug)}createBucket(i){return new Hc(i)}queryRadius(i){let t=i;return pl("circle-radius",this,t)+pl("circle-stroke-width",this,t)+Mh(this.paint.get("circle-translate"))}queryIntersectsFeature(i,t,r,o,c,f,m,x){let b=Sh(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),f.angle,m),S=this.paint.get("circle-radius").evaluate(t,r)+this.paint.get("circle-stroke-width").evaluate(t,r),A=this.paint.get("circle-pitch-alignment")==="map",z=A?b:function(O,V){return O.map(tt=>gp(tt,V))}(b,x),D=A?S*m:S;for(let O of o)for(let V of O){let tt=A?V:gp(V,x),et=D,dt=Th([],[V.x,V.y,0,1],x);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?et*=dt[3]/f.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(et*=f.cameraToCenterDistance/dt[3]),ag(z,tt,et))return!0}return!1}},heatmap:class extends cr{constructor(i){super(i,dg),this._updateColorRamp()}createBucket(i){return new yp(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=xp({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends cr{constructor(i){super(i,fg)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends cr{constructor(i){super(i,Pg)}recalculate(i,t){super.recalculate(i,t);let r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new ou(i)}queryRadius(){return Mh(this.paint.get("fill-translate"))}queryIntersectsFeature(i,t,r,o,c,f,m){return pp(Sh(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),f.angle,m),o)}isTileClipped(){return!0}},"fill-extrusion":class extends cr{constructor(i){super(i,qg)}createBucket(i){return new hu(i)}queryRadius(){return Mh(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,t,r,o,c,f,m,x){let b=Sh(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),f.angle,m),S=this.paint.get("fill-extrusion-height").evaluate(t,r),A=this.paint.get("fill-extrusion-base").evaluate(t,r),z=function(O,V,tt,et){let dt=[];for(let bt of O){let vt=[bt.x,bt.y,0,1];Th(vt,vt,V),dt.push(new ye(vt[0]/vt[3],vt[1]/vt[3]))}return dt}(b,x),D=function(O,V,tt,et){let dt=[],bt=[],vt=et[8]*V,Et=et[9]*V,Rt=et[10]*V,Pt=et[11]*V,ee=et[8]*tt,le=et[9]*tt,Xt=et[10]*tt,Kt=et[11]*tt;for(let Wt of O){let Qt=[],Yt=[];for(let Gt of Wt){let fe=Gt.x,ce=Gt.y,Be=et[0]*fe+et[4]*ce+et[12],Xe=et[1]*fe+et[5]*ce+et[13],ui=et[2]*fe+et[6]*ce+et[14],pi=et[3]*fe+et[7]*ce+et[15],Ji=ui+Rt,Pi=pi+Pt,zi=Be+ee,qi=Xe+le,Qi=ui+Xt,sr=pi+Kt,wr=new ye((Be+vt)/Pi,(Xe+Et)/Pi);wr.z=Ji/Pi,Qt.push(wr);let ki=new ye(zi/sr,qi/sr);ki.z=Qi/sr,Yt.push(ki)}dt.push(Qt),bt.push(Yt)}return[dt,bt]}(o,A,S,x);return function(O,V,tt){let et=1/0;pp(tt,V)&&(et=Ap(tt,V[0]));for(let dt=0;dt<V.length;dt++){let bt=V[dt],vt=O[dt];for(let Et=0;Et<bt.length-1;Et++){let Rt=bt[Et],Pt=[Rt,bt[Et+1],vt[Et+1],vt[Et],Rt];up(tt,Pt)&&(et=Math.min(et,Ap(tt,Pt)))}}return et!==1/0&&et}(D[0],D[1],z)}},line:class extends cr{constructor(i){super(i,zp),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof js,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,t){super.recalculate(i,t),this.paint._values["line-floorwidth"]=kp.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new cu(i)}queryRadius(i){let t=i,r=Lp(pl("line-width",this,t),pl("line-gap-width",this,t)),o=pl("line-offset",this,t);return r/2+Math.abs(o)+Mh(this.paint.get("line-translate"))}queryIntersectsFeature(i,t,r,o,c,f,m){let x=Sh(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),f.angle,m),b=m/2*Lp(this.paint.get("line-width").evaluate(t,r),this.paint.get("line-gap-width").evaluate(t,r)),S=this.paint.get("line-offset").evaluate(t,r);return S&&(o=function(A,z){let D=[];for(let O=0;O<A.length;O++){let V=A[O],tt=[];for(let et=0;et<V.length;et++){let dt=V[et-1],bt=V[et],vt=V[et+1],Et=et===0?new ye(0,0):bt.sub(dt)._unit()._perp(),Rt=et===V.length-1?new ye(0,0):vt.sub(bt)._unit()._perp(),Pt=Et._add(Rt)._unit(),ee=Pt.x*Rt.x+Pt.y*Rt.y;ee!==0&&Pt._mult(1/ee),tt.push(Pt._mult(z)._add(bt))}D.push(tt)}return D}(o,S*m)),function(A,z,D){for(let O=0;O<z.length;O++){let V=z[O];if(A.length>=3){for(let tt=0;tt<V.length;tt++)if(to(A,V[tt]))return!0}if(og(A,V,D))return!0}return!1}(x,o,b)}isTileClipped(){return!0}},symbol:Nh,background:class extends cr{constructor(i){super(i,Py)}},raster:class extends cr{constructor(i){super(i,zy)}}};class Dy{constructor(t){this._callback=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}let od=63710088e-1;class bi{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new bi(it(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let r=Math.PI/180,o=this.lat*r,c=t.lat*r,f=Math.sin(o)*Math.sin(c)+Math.cos(o)*Math.cos(c)*Math.cos((t.lng-this.lng)*r);return od*Math.acos(Math.min(f,1))}toBounds(t=0){let r=360*t/40075017,o=r/Math.cos(Math.PI/180*this.lat);return new ha(new bi(this.lng-o,this.lat-r),new bi(this.lng+o,this.lat+r))}static convert(t){if(t instanceof bi)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new bi(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new bi(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>]")}}class ha{constructor(t,r){t&&(r?this.setSouthWest(t).setNorthEast(r):t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))}setNorthEast(t){return this._ne=t instanceof bi?new bi(t.lng,t.lat):bi.convert(t),this}setSouthWest(t){return this._sw=t instanceof bi?new bi(t.lng,t.lat):bi.convert(t),this}extend(t){let r=this._sw,o=this._ne,c,f;if(t instanceof bi)c=t,f=t;else{if(!(t instanceof ha))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(ha.convert(t)):this.extend(bi.convert(t)):this;if(c=t._sw,f=t._ne,!c||!f)return this}return r||o?(r.lng=Math.min(c.lng,r.lng),r.lat=Math.min(c.lat,r.lat),o.lng=Math.max(f.lng,o.lng),o.lat=Math.max(f.lat,o.lat)):(this._sw=new bi(c.lng,c.lat),this._ne=new bi(f.lng,f.lat)),this}getCenter(){return new bi((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new bi(this.getWest(),this.getNorth())}getSouthEast(){return new bi(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:r,lat:o}=bi.convert(t),c=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&c}static convert(t){return t instanceof ha?t:t&&new ha(t)}}let ld=2*Math.PI*od;function hd(i){return ld*Math.cos(i*Math.PI/180)}function cd(i){return(180+i)/360}function ud(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function pd(i,t){return i/hd(t)}function Mu(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class Uh{constructor(t,r,o=0){this.x=+t,this.y=+r,this.z=+o}static fromLngLat(t,r=0){let o=bi.convert(t);return new Uh(cd(o.lng),ud(o.lat),pd(r,o.lat))}toLngLat(){return new bi(360*this.x-180,Mu(this.y))}toAltitude(){return this.z*hd(Mu(this.y))}meterInMercatorCoordinateUnits(){return 1/ld*(t=Mu(this.y),1/Math.cos(t*Math.PI/180));var t}}function dd(i,t,r){var o=2*Math.PI*6378137/256/Math.pow(2,r);return[i*o-2*Math.PI*6378137/2,t*o-2*Math.PI*6378137/2]}class Su{constructor(t,r,o){this.z=t,this.x=r,this.y=o,this.key=Ml(0,t,t,r,o)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,o){let c=(m=this.y,x=this.z,b=dd(256*(f=this.x),256*(m=Math.pow(2,x)-m-1),x),S=dd(256*(f+1),256*(m+1),x),b[0]+","+b[1]+","+S[0]+","+S[1]);var f,m,x,b,S;let A=function(z,D,O){let V,tt="";for(let et=z;et>0;et--)V=1<<et-1,tt+=(D&V?1:0)+(O&V?2:0);return tt}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(o==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,A).replace(/{bbox-epsg-3857}/g,c)}getTilePoint(t){let r=Math.pow(2,this.z);return new ye((t.x*r-this.x)*Ni,(t.y*r-this.y)*Ni)}toString(){return`${this.z}/${this.x}/${this.y}`}}class fd{constructor(t,r){this.wrap=t,this.canonical=r,this.key=Ml(t,r.z,r.z,r.x,r.y)}}class ln{constructor(t,r,o,c,f){this.overscaledZ=t,this.wrap=r,this.canonical=new Su(o,+c,+f),this.key=Ml(r,t,o,c,f)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){let r=this.canonical.z-t;return t>this.canonical.z?new ln(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ln(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){let o=this.canonical.z-t;return t>this.canonical.z?Ml(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):Ml(this.wrap*+r,t,t,this.canonical.x>>o,this.canonical.y>>o)}isChildOf(t){if(t.wrap!==this.wrap)return!1;let r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new ln(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,o=2*this.canonical.x,c=2*this.canonical.y;return[new ln(r,this.wrap,r,o,c),new ln(r,this.wrap,r,o+1,c),new ln(r,this.wrap,r,o,c+1),new ln(r,this.wrap,r,o+1,c+1)]}isLessThan(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))}wrapped(){return new ln(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new ln(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new fd(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Uh(t.x-this.wrap,t.y))}}function Ml(i,t,r,o,c){(i*=2)<0&&(i=-1*i-1);let f=1<<r;return(f*f*i+f*c+o).toString(36)+r.toString(36)+t.toString(36)}te("CanonicalTileID",Su),te("OverscaledTileID",ln,{omit:["posMatrix"]});class md{constructor(t,r,o){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(o&&o!=="mapbox"&&o!=="terrarium")return void oe(`"${o}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;let c=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=o||"mapbox";for(let f=0;f<c;f++)this.data[this._idx(-1,f)]=this.data[this._idx(0,f)],this.data[this._idx(c,f)]=this.data[this._idx(c-1,f)],this.data[this._idx(f,-1)]=this.data[this._idx(f,0)],this.data[this._idx(f,c)]=this.data[this._idx(f,c-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(c,-1)]=this.data[this._idx(c-1,0)],this.data[this._idx(-1,c)]=this.data[this._idx(0,c-1)],this.data[this._idx(c,c)]=this.data[this._idx(c-1,c-1)]}get(t,r){let o=new Uint8Array(this.data.buffer),c=4*this._idx(t,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(o[c],o[c+1],o[c+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}_unpackMapbox(t,r,o){return(256*t*256+256*r+o)/10-1e4}_unpackTerrarium(t,r,o){return 256*t+r+o/256-32768}getPixels(){return new Zr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,o){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let c=r*this.dim,f=r*this.dim+this.dim,m=o*this.dim,x=o*this.dim+this.dim;switch(r){case-1:c=f-1;break;case 1:f=c+1}switch(o){case-1:m=x-1;break;case 1:x=m+1}let b=-r*this.dim,S=-o*this.dim;for(let A=m;A<x;A++)for(let z=c;z<f;z++)this.data[this._idx(z,A)]=t.data[this._idx(z+b,A+S)]}}te("DEMData",md);class gd{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){let o=t[r];this._stringToNumber[o]=r,this._numberToString[r]=o}}encode(t){return this._stringToNumber[t]}decode(t){return this._numberToString[t]}}class yd{constructor(t,r,o,c,f){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=o,t._y=c,this.properties=t.properties,this.id=f}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class _d{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Vn(Ni,16,0),this.grid3D=new Vn(Ni,16,0),this.featureIndexArray=new Fe,this.promoteId=r}insert(t,r,o,c,f,m){let x=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,c,f);let b=m?this.grid3D:this.grid;for(let S=0;S<r.length;S++){let A=r[S],z=[1/0,1/0,-1/0,-1/0];for(let D=0;D<A.length;D++){let O=A[D];z[0]=Math.min(z[0],O.x),z[1]=Math.min(z[1],O.y),z[2]=Math.max(z[2],O.x),z[3]=Math.max(z[3],O.y)}z[0]<Ni&&z[1]<Ni&&z[2]>=0&&z[3]>=0&&b.insert(x,z[0],z[1],z[2],z[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new As.VectorTile(new uu(this.rawTileData)).layers,this.sourceLayerCoder=new gd(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,o,c){this.loadVTLayers();let f=t.params||{},m=Ni/t.tileSize/t.scale,x=Va(f.filter),b=t.queryGeometry,S=t.queryPadding*m,A=vd(b),z=this.grid.query(A.minX-S,A.minY-S,A.maxX+S,A.maxY+S),D=vd(t.cameraQueryGeometry),O=this.grid3D.query(D.minX-S,D.minY-S,D.maxX+S,D.maxY+S,(et,dt,bt,vt)=>function(Et,Rt,Pt,ee,le){for(let Kt of Et)if(Rt<=Kt.x&&Pt<=Kt.y&&ee>=Kt.x&&le>=Kt.y)return!0;let Xt=[new ye(Rt,Pt),new ye(Rt,le),new ye(ee,le),new ye(ee,Pt)];if(Et.length>2){for(let Kt of Xt)if(to(Et,Kt))return!0}for(let Kt=0;Kt<Et.length-1;Kt++)if(hg(Et[Kt],Et[Kt+1],Xt))return!0;return!1}(t.cameraQueryGeometry,et-S,dt-S,bt+S,vt+S));for(let et of O)z.push(et);z.sort(Ry);let V={},tt;for(let et=0;et<z.length;et++){let dt=z[et];if(dt===tt)continue;tt=dt;let bt=this.featureIndexArray.get(dt),vt=null;this.loadMatchingFeature(V,bt.bucketIndex,bt.sourceLayerIndex,bt.featureIndex,x,f.layers,f.availableImages,r,o,c,(Et,Rt,Pt)=>(vt||(vt=oa(Et)),Rt.queryIntersectsFeature(b,Et,Pt,vt,this.z,t.transform,m,t.pixelPosMatrix)))}return V}loadMatchingFeature(t,r,o,c,f,m,x,b,S,A,z){let D=this.bucketLayerIDs[r];if(m&&!function(et,dt){for(let bt=0;bt<et.length;bt++)if(dt.indexOf(et[bt])>=0)return!0;return!1}(m,D))return;let O=this.sourceLayerCoder.decode(o),V=this.vtLayers[O].feature(c);if(f.needGeometry){let et=la(V,!0);if(!f.filter(new hi(this.tileID.overscaledZ),et,this.tileID.canonical))return}else if(!f.filter(new hi(this.tileID.overscaledZ),V))return;let tt=this.getId(V,O);for(let et=0;et<D.length;et++){let dt=D[et];if(m&&m.indexOf(dt)<0)continue;let bt=b[dt];if(!bt)continue;let vt={};tt&&A&&(vt=A.getState(bt.sourceLayer||"_geojsonTileLayer",tt));let Et=pt({},S[dt]);Et.paint=xd(Et.paint,bt.paint,V,vt,x),Et.layout=xd(Et.layout,bt.layout,V,vt,x);let Rt=!z||z(V,bt,vt);if(!Rt)continue;let Pt=new yd(V,this.z,this.x,this.y,tt);Pt.layer=Et;let ee=t[dt];ee===void 0&&(ee=t[dt]=[]),ee.push({featureIndex:c,feature:Pt,intersectionZ:Rt})}}lookupSymbolFeatures(t,r,o,c,f,m,x,b){let S={};this.loadVTLayers();let A=Va(f);for(let z of t)this.loadMatchingFeature(S,o,c,z,A,m,x,b,r);return S}hasLayer(t){for(let r of this.bucketLayerIDs)for(let o of r)if(t===o)return!0;return!1}getId(t,r){let o=t.id;return this.promoteId&&(o=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof o=="boolean"&&(o=Number(o))),o}}function xd(i,t,r,o,c){return Ot(i,(f,m)=>{let x=t instanceof Xa?t.get(m):null;return x&&x.evaluate?x.evaluate(r,o,c):x})}function vd(i){let t=1/0,r=1/0,o=-1/0,c=-1/0;for(let f of i)t=Math.min(t,f.x),r=Math.min(r,f.y),o=Math.max(o,f.x),c=Math.max(c,f.y);return{minX:t,minY:r,maxX:o,maxY:c}}function Ry(i,t){return t-i}var Tu;te("FeatureIndex",_d,{omit:["rawTileData","sourceLayerCoder"]}),a.PerformanceMarkers=void 0,(Tu=a.PerformanceMarkers||(a.PerformanceMarkers={})).create="create",Tu.load="load",Tu.fullLoad="fullLoad";let Vh=null,Sl=[],Eu=1e3/30,By={mark(i){performance.mark(i)},frame(i){let t=i;Vh!=null&&Sl.push(t-Vh),Vh=t},clearMetrics(){Vh=null,Sl=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(let i in a.PerformanceMarkers)performance.clearMarks(a.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.load),performance.measure("fullLoadTime",a.PerformanceMarkers.create,a.PerformanceMarkers.fullLoad);let i=performance.getEntriesByName("loadTime")[0].duration,t=performance.getEntriesByName("fullLoadTime")[0].duration,r=Sl.length,o=1/(Sl.reduce((f,m)=>f+m,0)/r/1e3),c=Sl.filter(f=>f>Eu).reduce((f,m)=>f+(m-Eu)/Eu,0);return{loadTime:i,fullLoadTime:t,fps:o,percentDroppedFrames:c/(r+c)*100}}};a.AJAXError=Je,a.ARRAY_TYPE=eo,a.Actor=class{constructor(i,t,r){this.target=i,this.parent=t,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},_t(["receive","process"],this),this.invoker=new Dy(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=me()?i:window}send(i,t,r,o,c=!1){let f=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[f]=r);let m=Yi(this.globalScope)?void 0:[];return this.target.postMessage({id:f,type:i,hasCallback:!!r,targetMapId:o,mustQueue:c,sourceMapId:this.mapId,data:Qs(t,m)},m),{cancel:()=>{r&&delete this.callbacks[f],this.target.postMessage({id:f,type:"<cancel>",targetMapId:o,sourceMapId:this.mapId})}}}receive(i){let t=i.data,r=t.id;if(r&&(!t.targetMapId||this.mapId===t.targetMapId))if(t.type==="<cancel>"){delete this.tasks[r];let o=this.cancelCallbacks[r];delete this.cancelCallbacks[r],o&&o()}else me()||t.mustQueue?(this.tasks[r]=t,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,t)}process(){if(!this.taskQueue.length)return;let i=this.taskQueue.shift(),t=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),t&&this.processTask(i,t)}processTask(i,t){if(t.type==="<response>"){let r=this.callbacks[i];delete this.callbacks[i],r&&(t.error?r(Gn(t.error)):r(null,Gn(t.data)))}else{let r=!1,o=Yi(this.globalScope)?void 0:[],c=t.hasCallback?(x,b)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:x?Qs(x):null,data:Qs(b,o)},o)}:x=>{r=!0},f=null,m=Gn(t.data);if(this.parent[t.type])f=this.parent[t.type](t.sourceMapId,m,c);else if(this.parent.getWorkerSource){let x=t.type.split(".");f=this.parent.getWorkerSource(t.sourceMapId,x[0],m.source)[x[1]](m,c)}else c(new Error(`Could not find function ${t.type}`));!r&&f&&f.cancel&&(this.cancelCallbacks[i]=f.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.AlphaImage=fl,a.CanonicalTileID=Su,a.CollisionBoxArray=Mt,a.CollisionCircleLayoutArray=class extends C{},a.Color=P,a.DEMData=md,a.DataConstantProperty=ne,a.DictionaryCoder=gd,a.EXTENT=Ni,a.ErrorEvent=Dt,a.EvaluationParameters=hi,a.Event=xt,a.Evented=Ut,a.FeatureIndex=_d,a.FillBucket=ou,a.FillExtrusionBucket=hu,a.GeoJSONFeature=yd,a.ImageAtlas=Gp,a.ImagePosition=du,a.LineBucket=cu,a.LineStripIndexArray=class extends mt{},a.LngLat=bi,a.LngLatBounds=ha,a.MercatorCoordinate=Uh,a.ONE_EM=Hi,a.OverscaledTileID=ln,a.PerformanceUtils=By,a.PosArray=class extends Ts{},a.Properties=Fi,a.QuadTriangleArray=class extends F{},a.RGBAImage=Zr,a.RasterBoundsArray=class extends sa{},a.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},a.ResourceType=cs,a.SegmentVector=je,a.SymbolBucket=lo,a.Transitionable=ll,a.TriangleIndexArray=ur,a.Uniform1f=Es,a.Uniform1i=class extends on{constructor(i,t){super(i,t),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},a.Uniform2f=class extends on{constructor(i,t){super(i,t),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},a.Uniform3f=class extends on{constructor(i,t){super(i,t),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},a.Uniform4f=ap,a.UniformColor=op,a.UniformMatrix4f=class extends on{constructor(i,t){super(i,t),this.current=ng}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let t=1;t<16;t++)if(i[t]!==this.current[t]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},a.UnwrappedTileID=fd,a.ValidationError=Ct,a.ZoomHistory=ta,a.addDynamicAttributes=_u,a.asyncAll=function(i,t,r){if(!i.length)return r(null,[]);let o=i.length,c=new Array(i.length),f=null;i.forEach((m,x)=>{t(m,(b,S)=>{b&&(f=b),c[x]=S,--o==0&&r(f,c)})})},a.bezier=B,a.bindAll=_t,a.cacheEntryPossiblyAdded=function(i){en++,en>kr&&(i.getActor().send("enforceCacheSizeLimit",zr),en=0)},a.clamp=L,a.clearTileCache=function(i){let t=caches.delete(Qr);i&&t.catch(i).then(()=>i())},a.clipLine=td,a.clone=function(i){var t=new eo(16);return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t},a.clone$1=Nt,a.collisionCircleLayout=ty,a.config=Gr,a.create=function(){var i=new eo(16);return eo!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},a.createExpression=Ba,a.createFilter=Va,a.createLayout=Oi,a.createStyleLayer=function(i){return i.type==="custom"?new ky(i):new Ly[i.type](i)},a.dot=function(i,t){return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]*t[3]},a.ease=$,a.emitValidationErrors=dh,a.enforceCacheSizeLimit=function(i){tn(),_i&&_i.then(t=>{t.keys().then(r=>{for(let o=0;o<r.length-i;o++)t.delete(r[o])})})},a.evaluateSizeForFeature=function(i,{uSize:t,uSizeT:r},{lowerSize:o,upperSize:c}){return i.kind==="source"?o/Xn:i.kind==="composite"?Ci(o/Xn,c/Xn,r):t},a.evaluateSizeForZoom=function(i,t){let r=0,o=0;if(i.kind==="constant")o=i.layoutSize;else if(i.kind!=="source"){let{interpolationType:c,minZoom:f,maxZoom:m}=i,x=c?L(_r.interpolationFactor(c,t,f,m),0,1):0;i.kind==="camera"?o=Ci(i.minSize,i.maxSize,x):r=x}return{uSizeT:r,uSize:o}},a.evaluateVariableOffset=rd,a.evented=Ss,a.exported=Vr,a.exported$1=gr,a.extend=pt,a.filterObject=Lt,a.getAnchorAlignment=mu,a.getAnchorJustification=yu,a.getArrayBuffer=Dr,a.getImage=U,a.getJSON=function(i,t){return fn(pt(i,{type:"json"}),t)},a.getOverlapMode=wu,a.getRTLTextPluginStatus=ol,a.getReferrer=rn,a.getVideo=function(i,t){let r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){t(null,r)};for(let o=0;o<i.length;o++){let c=window.document.createElement("source");us(i[o])||(r.crossOrigin="Anonymous"),c.src=i[o],r.appendChild(c)}return{cancel:()=>{}}},a.identity=Yc,a.invert=function(i,t){var r=t[0],o=t[1],c=t[2],f=t[3],m=t[4],x=t[5],b=t[6],S=t[7],A=t[8],z=t[9],D=t[10],O=t[11],V=t[12],tt=t[13],et=t[14],dt=t[15],bt=r*x-o*m,vt=r*b-c*m,Et=r*S-f*m,Rt=o*b-c*x,Pt=o*S-f*x,ee=c*S-f*b,le=A*tt-z*V,Xt=A*et-D*V,Kt=A*dt-O*V,Wt=z*et-D*tt,Qt=z*dt-O*tt,Yt=D*dt-O*et,Gt=bt*Yt-vt*Qt+Et*Wt+Rt*Kt-Pt*Xt+ee*le;return Gt?(i[0]=(x*Yt-b*Qt+S*Wt)*(Gt=1/Gt),i[1]=(c*Qt-o*Yt-f*Wt)*Gt,i[2]=(tt*ee-et*Pt+dt*Rt)*Gt,i[3]=(D*Pt-z*ee-O*Rt)*Gt,i[4]=(b*Kt-m*Yt-S*Xt)*Gt,i[5]=(r*Yt-c*Kt+f*Xt)*Gt,i[6]=(et*Et-V*ee-dt*vt)*Gt,i[7]=(A*ee-D*Et+O*vt)*Gt,i[8]=(m*Qt-x*Kt+S*le)*Gt,i[9]=(o*Kt-r*Qt-f*le)*Gt,i[10]=(V*Pt-tt*Et+dt*bt)*Gt,i[11]=(z*Et-A*Pt-O*bt)*Gt,i[12]=(x*Xt-m*Wt-b*le)*Gt,i[13]=(r*Wt-o*Xt+c*le)*Gt,i[14]=(tt*vt-V*Rt-et*bt)*Gt,i[15]=(A*Rt-z*vt+D*bt)*Gt,i):null},a.isImageBitmap=Bi,a.isSafari=Yi,a.keysDifference=function(i,t){let r=[];for(let o in i)o in t||r.push(o);return r},a.lazyLoadRTLTextPlugin=function(){Rr.isLoading()||Rr.isLoaded()||ol()!=="deferred"||Wa()},a.makeRequest=fn,a.mapObject=Ot,a.mercatorXfromLng=cd,a.mercatorYfromLat=ud,a.mercatorZfromAltitude=pd,a.mul=pg,a.multiply=mp,a.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},a.number=Ci,a.ortho=function(i,t,r,o,c,f,m){var x=1/(t-r),b=1/(o-c),S=1/(f-m);return i[0]=-2*x,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*b,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*S,i[11]=0,i[12]=(t+r)*x,i[13]=(c+o)*b,i[14]=(m+f)*S,i[15]=1,i},a.parseCacheControl=Ge,a.parseGlyphPBF=function(i){return new uu(i).readFields(uy,[])},a.pbf=uu,a.performSymbolLayout=function(i,t,r,o,c,f,m){i.createArrays(),i.tilePixelRatio=Ni/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;let x=i.layers[0].layout,b=i.layers[0]._unevaluatedLayout._values,S={layoutIconSize:b["icon-size"].possiblyEvaluate(new hi(i.zoom+1),m),layoutTextSize:b["text-size"].possiblyEvaluate(new hi(i.zoom+1),m),textMaxSize:b["text-size"].possiblyEvaluate(new hi(18))};if(i.textSizeData.kind==="composite"){let{minZoom:V,maxZoom:tt}=i.textSizeData;S.compositeTextSizes=[b["text-size"].possiblyEvaluate(new hi(V),m),b["text-size"].possiblyEvaluate(new hi(tt),m)]}if(i.iconSizeData.kind==="composite"){let{minZoom:V,maxZoom:tt}=i.iconSizeData;S.compositeIconSizes=[b["icon-size"].possiblyEvaluate(new hi(V),m),b["icon-size"].possiblyEvaluate(new hi(tt),m)]}let A=x.get("text-line-height")*Hi,z=x.get("text-rotation-alignment")!=="viewport"&&x.get("symbol-placement")!=="point",D=x.get("text-keep-upright"),O=x.get("text-size");for(let V of i.features){let tt=x.get("text-font").evaluate(V,{},m).join(","),et=O.evaluate(V,{},m),dt=S.layoutTextSize.evaluate(V,{},m),bt=S.layoutIconSize.evaluate(V,{},m),vt={horizontal:{},vertical:void 0},Et=V.text,Rt,Pt=[0,0];if(Et){let Xt=Et.toString(),Kt=x.get("text-letter-spacing").evaluate(V,{},m)*Hi,Wt=fh(Xt)?Kt:0,Qt=x.get("text-anchor").evaluate(V,{},m),Yt=x.get("text-variable-anchor");if(!Yt){let Xe=x.get("text-radial-offset").evaluate(V,{},m);Pt=Xe?rd(Qt,[Xe*Hi,gu]):x.get("text-offset").evaluate(V,{},m).map(ui=>ui*Hi)}let Gt=z?"center":x.get("text-justify").evaluate(V,{},m),fe=x.get("symbol-placement"),ce=fe==="point"?x.get("text-max-width").evaluate(V,{},m)*Hi:0,Be=()=>{i.allowVerticalPlacement&&il(Xt)&&(vt.vertical=kh(Et,t,r,c,tt,ce,A,Qt,"left",Wt,Pt,a.WritingMode.vertical,!0,fe,dt,et))};if(!z&&Yt){let Xe=Gt==="auto"?Yt.map(pi=>yu(pi)):[Gt],ui=!1;for(let pi=0;pi<Xe.length;pi++){let Ji=Xe[pi];if(!vt.horizontal[Ji])if(ui)vt.horizontal[Ji]=vt.horizontal[0];else{let Pi=kh(Et,t,r,c,tt,ce,A,"center",Ji,Wt,Pt,a.WritingMode.horizontal,!1,fe,dt,et);Pi&&(vt.horizontal[Ji]=Pi,ui=Pi.positionedLines.length===1)}}Be()}else{Gt==="auto"&&(Gt=yu(Qt));let Xe=kh(Et,t,r,c,tt,ce,A,Qt,Gt,Wt,Pt,a.WritingMode.horizontal,!1,fe,dt,et);Xe&&(vt.horizontal[Gt]=Xe),Be(),il(Xt)&&z&&D&&(vt.vertical=kh(Et,t,r,c,tt,ce,A,Qt,Gt,Wt,Pt,a.WritingMode.vertical,!1,fe,dt,et))}}let ee=!1;if(V.icon&&V.icon.name){let Xt=o[V.icon.name];Xt&&(Rt=yy(c[V.icon.name],x.get("icon-offset").evaluate(V,{},m),x.get("icon-anchor").evaluate(V,{},m)),ee=!!Xt.sdf,i.sdfIcons===void 0?i.sdfIcons=ee:i.sdfIcons!==ee&&oe("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Xt.pixelRatio!==i.pixelRatio||x.get("icon-rotate").constantOr(1)!==0)&&(i.iconsNeedLinear=!0))}let le=sd(vt.horizontal)||vt.vertical;i.iconsInText=!!le&&le.iconsInText,(le||Rt)&&Sy(i,V,vt,Rt,o,S,dt,bt,Pt,ee,m)}f&&i.generateCollisionDebugBuffers()},a.perspective=function(i,t,r,o,c){var f,m=1/Math.tan(t/2);return i[0]=m/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=m,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,c!=null&&c!==1/0?(i[10]=(c+o)*(f=1/(o-c)),i[14]=2*c*o*f):(i[10]=-1,i[14]=-2*o),i},a.pick=function(i,t){let r={};for(let o=0;o<t.length;o++){let c=t[o];c in i&&(r[c]=i[c])}return r},a.plugin=Rr,a.pointGeometry=ye,a.polygonIntersectsPolygon=up,a.potpack=Vp,a.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],a.register=te,a.registerForPluginStateChange=function(i){return i({pluginStatus:hr,pluginURL:Tn}),Ss.on("pluginStateChange",i),i},a.renderColorRamp=xp,a.rotateX=function(i,t,r){var o=Math.sin(r),c=Math.cos(r),f=t[4],m=t[5],x=t[6],b=t[7],S=t[8],A=t[9],z=t[10],D=t[11];return t!==i&&(i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=t[3],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[4]=f*c+S*o,i[5]=m*c+A*o,i[6]=x*c+z*o,i[7]=b*c+D*o,i[8]=S*c-f*o,i[9]=A*c-m*o,i[10]=z*c-x*o,i[11]=D*c-b*o,i},a.rotateZ=function(i,t,r){var o=Math.sin(r),c=Math.cos(r),f=t[0],m=t[1],x=t[2],b=t[3],S=t[4],A=t[5],z=t[6],D=t[7];return t!==i&&(i[8]=t[8],i[9]=t[9],i[10]=t[10],i[11]=t[11],i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15]),i[0]=f*c+S*o,i[1]=m*c+A*o,i[2]=x*c+z*o,i[3]=b*c+D*o,i[4]=S*c-f*o,i[5]=A*c-m*o,i[6]=z*c-x*o,i[7]=D*c-b*o,i},a.scale=function(i,t,r){var o=r[0],c=r[1],f=r[2];return i[0]=t[0]*o,i[1]=t[1]*o,i[2]=t[2]*o,i[3]=t[3]*o,i[4]=t[4]*c,i[5]=t[5]*c,i[6]=t[6]*c,i[7]=t[7]*c,i[8]=t[8]*f,i[9]=t[9]*f,i[10]=t[10]*f,i[11]=t[11]*f,i[12]=t[12],i[13]=t[13],i[14]=t[14],i[15]=t[15],i},a.scale$1=function(i,t,r){return i[0]=t[0]*r,i[1]=t[1]*r,i[2]=t[2]*r,i[3]=t[3]*r,i},a.setCacheLimits=function(i,t){zr=i,kr=t},a.setRTLTextPlugin=function(i,t,r=!1){if(hr===$a||hr===rl||hr===nl)throw new Error("setRTLTextPlugin cannot be called multiple times.");Tn=Vr.resolveURL(i),hr=$a,sl=t,al(),r||Wa()},a.spec=ct,a.sphericalToCartesian=function([i,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(t)*Math.sin(r),y:i*Math.sin(t)*Math.sin(r),z:i*Math.cos(r)}},a.toEvaluationFeature=la,a.transformMat4=Th,a.translate=function(i,t,r){var o,c,f,m,x,b,S,A,z,D,O,V,tt=r[0],et=r[1],dt=r[2];return t===i?(i[12]=t[0]*tt+t[4]*et+t[8]*dt+t[12],i[13]=t[1]*tt+t[5]*et+t[9]*dt+t[13],i[14]=t[2]*tt+t[6]*et+t[10]*dt+t[14],i[15]=t[3]*tt+t[7]*et+t[11]*dt+t[15]):(c=t[1],f=t[2],m=t[3],x=t[4],b=t[5],S=t[6],A=t[7],z=t[8],D=t[9],O=t[10],V=t[11],i[0]=o=t[0],i[1]=c,i[2]=f,i[3]=m,i[4]=x,i[5]=b,i[6]=S,i[7]=A,i[8]=z,i[9]=D,i[10]=O,i[11]=V,i[12]=o*tt+x*et+z*dt+t[12],i[13]=c*tt+b*et+D*dt+t[13],i[14]=f*tt+S*et+O*dt+t[14],i[15]=m*tt+A*et+V*dt+t[15]),i},a.triggerPluginCompletionEvent=yh,a.unicodeBlockLookup=Zt,a.uniqueId=function(){return gt++},a.validateCustomStyleLayer=function(i){let t=[],r=i.id;return r===void 0&&t.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&t.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},a.validateLight=Nc,a.validateStyle=Un,a.vectorTile=As,a.warnOnce=oe,a.wrap=it}),y(["./shared"],function(a){"use strict";function T(W){let I=typeof W;if(I==="number"||I==="boolean"||I==="string"||W==null)return JSON.stringify(W);if(Array.isArray(W)){let Z="[";for(let Y of W)Z+=`${T(Y)},`;return`${Z}]`}let P=Object.keys(W).sort(),G="{";for(let Z=0;Z<P.length;Z++)G+=`${JSON.stringify(P[Z])}:${T(W[P[Z]])},`;return`${G}}`}function E(W){let I="";for(let P of a.refProperties)I+=`/${T(W[P])}`;return I}class B{constructor(I){this.keyCache={},I&&this.replace(I)}replace(I){this._layerConfigs={},this._layers={},this.update(I,[])}update(I,P){for(let Z of I){this._layerConfigs[Z.id]=Z;let Y=this._layers[Z.id]=a.createStyleLayer(Z);Y._featureFilter=a.createFilter(Y.filter),this.keyCache[Z.id]&&delete this.keyCache[Z.id]}for(let Z of P)delete this.keyCache[Z],delete this._layerConfigs[Z],delete this._layers[Z];this.familiesBySource={};let G=function(Z,Y){let at={};for(let nt=0;nt<Z.length;nt++){let ot=Y&&Y[Z[nt].id]||E(Z[nt]);Y&&(Y[Z[nt].id]=ot);let St=at[ot];St||(St=at[ot]=[]),St.push(Z[nt])}let rt=[];for(let nt in at)rt.push(at[nt]);return rt}(Object.values(this._layerConfigs),this.keyCache);for(let Z of G){let Y=Z.map(kt=>this._layers[kt.id]),at=Y[0];if(at.visibility==="none")continue;let rt=at.source||"",nt=this.familiesBySource[rt];nt||(nt=this.familiesBySource[rt]={});let ot=at.sourceLayer||"_geojsonTileLayer",St=nt[ot];St||(St=nt[ot]=[]),St.push(Y)}}}class ${constructor(I){let P={},G=[];for(let rt in I){let nt=I[rt],ot=P[rt]={};for(let St in nt){let kt=nt[+St];if(!kt||kt.bitmap.width===0||kt.bitmap.height===0)continue;let wt={x:0,y:0,w:kt.bitmap.width+2,h:kt.bitmap.height+2};G.push(wt),ot[St]={rect:wt,metrics:kt.metrics}}}let{w:Z,h:Y}=a.potpack(G),at=new a.AlphaImage({width:Z||1,height:Y||1});for(let rt in I){let nt=I[rt];for(let ot in nt){let St=nt[+ot];if(!St||St.bitmap.width===0||St.bitmap.height===0)continue;let kt=P[rt][ot].rect;a.AlphaImage.copy(St.bitmap,at,{x:0,y:0},{x:kt.x+1,y:kt.y+1},St.bitmap)}}this.image=at,this.positions=P}}a.register("GlyphAtlas",$);class L{constructor(I){this.tileID=new a.OverscaledTileID(I.tileID.overscaledZ,I.tileID.wrap,I.tileID.canonical.z,I.tileID.canonical.x,I.tileID.canonical.y),this.uid=I.uid,this.zoom=I.zoom,this.pixelRatio=I.pixelRatio,this.tileSize=I.tileSize,this.source=I.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=I.showCollisionBoxes,this.collectResourceTiming=!!I.collectResourceTiming,this.returnDependencies=!!I.returnDependencies,this.promoteId=I.promoteId}parse(I,P,G,Z,Y){this.status="parsing",this.data=I,this.collisionBoxArray=new a.CollisionBoxArray;let at=new a.DictionaryCoder(Object.keys(I.layers).sort()),rt=new a.FeatureIndex(this.tileID,this.promoteId);rt.bucketLayerIDs=[];let nt={},ot={featureIndex:rt,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:G},St=P.familiesBySource[this.source];for(let ze in St){let Te=I.layers[ze];if(!Te)continue;Te.version===1&&a.warnOnce(`Vector tile source "${this.source}" layer "${ze}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let Me=at.encode(ze),wi=[];for(let xi=0;xi<Te.length;xi++){let Gi=Te.feature(xi),Wi=rt.getId(Gi,ze);wi.push({feature:Gi,id:Wi,index:xi,sourceLayerIndex:Me})}for(let xi of St[ze]){let Gi=xi[0];Gi.minzoom&&this.zoom<Math.floor(Gi.minzoom)||Gi.maxzoom&&this.zoom>=Gi.maxzoom||Gi.visibility!=="none"&&(it(xi,this.zoom,G),(nt[Gi.id]=Gi.createBucket({index:rt.bucketLayerIDs.length,layers:xi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Me,sourceID:this.source})).populate(wi,ot,this.tileID.canonical),rt.bucketLayerIDs.push(xi.map(Wi=>Wi.id)))}}let kt,wt,re,Jt,se=a.mapObject(ot.glyphDependencies,ze=>Object.keys(ze).map(Number));Object.keys(se).length?Z.send("getGlyphs",{uid:this.uid,stacks:se},(ze,Te)=>{kt||(kt=ze,wt=Te,De.call(this))}):wt={};let pe=Object.keys(ot.iconDependencies);pe.length?Z.send("getImages",{icons:pe,source:this.source,tileID:this.tileID,type:"icons"},(ze,Te)=>{kt||(kt=ze,re=Te,De.call(this))}):re={};let Ue=Object.keys(ot.patternDependencies);function De(){if(kt)return Y(kt);if(wt&&re&&Jt){let ze=new $(wt),Te=new a.ImageAtlas(re,Jt);for(let Me in nt){let wi=nt[Me];wi instanceof a.SymbolBucket?(it(wi.layers,this.zoom,G),a.performSymbolLayout(wi,wt,ze.positions,re,Te.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):wi.hasPattern&&(wi instanceof a.LineBucket||wi instanceof a.FillBucket||wi instanceof a.FillExtrusionBucket)&&(it(wi.layers,this.zoom,G),wi.addFeatures(ot,this.tileID.canonical,Te.patternPositions))}this.status="done",Y(null,{buckets:Object.values(nt).filter(Me=>!Me.isEmpty()),featureIndex:rt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ze.image,imageAtlas:Te,glyphMap:this.returnDependencies?wt:null,iconMap:this.returnDependencies?re:null,glyphPositions:this.returnDependencies?ze.positions:null})}}Ue.length?Z.send("getImages",{icons:Ue,source:this.source,tileID:this.tileID,type:"patterns"},(ze,Te)=>{kt||(kt=ze,Jt=Te,De.call(this))}):Jt={},De.call(this)}}function it(W,I,P){let G=new a.EvaluationParameters(I);for(let Z of W)Z.recalculate(G,P)}function pt(W,I){let P=a.getArrayBuffer(W.request,(G,Z,Y,at)=>{G?I(G):Z&&I(null,{vectorTile:new a.vectorTile.VectorTile(new a.pbf(Z)),rawData:Z,cacheControl:Y,expires:at})});return()=>{P.cancel(),I()}}class gt{constructor(I,P,G,Z){this.actor=I,this.layerIndex=P,this.availableImages=G,this.loadVectorData=Z||pt,this.loading={},this.loaded={}}loadTile(I,P){let G=I.uid;this.loading||(this.loading={});let Z=!!(I&&I.request&&I.request.collectResourceTiming)&&new a.RequestPerformance(I.request),Y=this.loading[G]=new L(I);Y.abort=this.loadVectorData(I,(at,rt)=>{if(delete this.loading[G],at||!rt)return Y.status="done",this.loaded[G]=Y,P(at);let nt=rt.rawData,ot={};rt.expires&&(ot.expires=rt.expires),rt.cacheControl&&(ot.cacheControl=rt.cacheControl);let St={};if(Z){let kt=Z.finish();kt&&(St.resourceTiming=JSON.parse(JSON.stringify(kt)))}Y.vectorTile=rt.vectorTile,Y.parse(rt.vectorTile,this.layerIndex,this.availableImages,this.actor,(kt,wt)=>{if(kt||!wt)return P(kt);P(null,a.extend({rawTileData:nt.slice(0)},wt,ot,St))}),this.loaded=this.loaded||{},this.loaded[G]=Y})}reloadTile(I,P){let G=this.loaded,Z=I.uid,Y=this;if(G&&G[Z]){let at=G[Z];at.showCollisionBoxes=I.showCollisionBoxes;let rt=(nt,ot)=>{let St=at.reloadCallback;St&&(delete at.reloadCallback,at.parse(at.vectorTile,Y.layerIndex,this.availableImages,Y.actor,St)),P(nt,ot)};at.status==="parsing"?at.reloadCallback=rt:at.status==="done"&&(at.vectorTile?at.parse(at.vectorTile,this.layerIndex,this.availableImages,this.actor,rt):rt())}}abortTile(I,P){let G=this.loading,Z=I.uid;G&&G[Z]&&G[Z].abort&&(G[Z].abort(),delete G[Z]),P()}removeTile(I,P){let G=this.loaded,Z=I.uid;G&&G[Z]&&delete G[Z],P()}}class _t{constructor(){this.loaded={}}loadTile(I,P){let{uid:G,encoding:Z,rawImageData:Y}=I,at=a.isImageBitmap(Y)?this.getImageData(Y):Y,rt=new a.DEMData(G,at,Z);this.loaded=this.loaded||{},this.loaded[G]=rt,P(null,rt)}getImageData(I){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(I.width,I.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=I.width,this.offscreenCanvas.height=I.height,this.offscreenCanvasContext.drawImage(I,0,0,I.width,I.height);let P=this.offscreenCanvasContext.getImageData(-1,-1,I.width+2,I.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new a.RGBAImage({width:P.width,height:P.height},P.data)}removeTile(I){let P=this.loaded,G=I.uid;P&&P[G]&&delete P[G]}}var Ot=function W(I,P){var G,Z=I&&I.type;if(Z==="FeatureCollection")for(G=0;G<I.features.length;G++)W(I.features[G],P);else if(Z==="GeometryCollection")for(G=0;G<I.geometries.length;G++)W(I.geometries[G],P);else if(Z==="Feature")W(I.geometry,P);else if(Z==="Polygon")Lt(I.coordinates,P);else if(Z==="MultiPolygon")for(G=0;G<I.coordinates.length;G++)Lt(I.coordinates[G],P);return I};function Lt(W,I){if(W.length!==0){Nt(W[0],I);for(var P=1;P<W.length;P++)Nt(W[P],!I)}}function Nt(W,I){for(var P=0,G=0,Z=0,Y=W.length,at=Y-1;Z<Y;at=Z++){var rt=(W[Z][0]-W[at][0])*(W[at][1]+W[Z][1]),nt=P+rt;G+=Math.abs(P)>=Math.abs(rt)?P-nt+rt:rt-nt+P,P=nt}P+G>=0!=!!I&&W.reverse()}let ue=a.vectorTile.VectorTileFeature.prototype.toGeoJSON;class oe{constructor(I){this._feature=I,this.extent=a.EXTENT,this.type=I.type,this.properties=I.tags,"id"in I&&!isNaN(I.id)&&(this.id=parseInt(I.id,10))}loadGeometry(){if(this._feature.type===1){let I=[];for(let P of this._feature.geometry)I.push([new a.pointGeometry(P[0],P[1])]);return I}{let I=[];for(let P of this._feature.geometry){let G=[];for(let Z of P)G.push(new a.pointGeometry(Z[0],Z[1]));I.push(G)}return I}}toGeoJSON(I,P,G){return ue.call(this,I,P,G)}}class Ee{constructor(I){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=a.EXTENT,this.length=I.length,this._features=I}feature(I){return new oe(this._features[I])}}var ve={exports:{}},me=a.pointGeometry,Ge=a.vectorTile.VectorTileFeature,Ne=di;function di(W,I){this.options=I||{},this.features=W,this.length=W.length}function Ri(W,I){this.id=typeof W.id=="number"?W.id:void 0,this.type=W.type,this.rawGeometry=W.type===1?[W.geometry]:W.geometry,this.properties=W.tags,this.extent=I||4096}di.prototype.feature=function(W){return new Ri(this.features[W],this.options.extent)},Ri.prototype.loadGeometry=function(){var W=this.rawGeometry;this.geometry=[];for(var I=0;I<W.length;I++){for(var P=W[I],G=[],Z=0;Z<P.length;Z++)G.push(new me(P[Z][0],P[Z][1]));this.geometry.push(G)}return this.geometry},Ri.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var W=this.geometry,I=1/0,P=-1/0,G=1/0,Z=-1/0,Y=0;Y<W.length;Y++)for(var at=W[Y],rt=0;rt<at.length;rt++){var nt=at[rt];I=Math.min(I,nt.x),P=Math.max(P,nt.x),G=Math.min(G,nt.y),Z=Math.max(Z,nt.y)}return[I,G,P,Z]},Ri.prototype.toGeoJSON=Ge.prototype.toGeoJSON;var Yi=a.pbf,Bi=Ne;function Vr(W){var I=new Yi;return function(P,G){for(var Z in P.layers)G.writeMessage(3,ye,P.layers[Z])}(W,I),I.finish()}function ye(W,I){var P;I.writeVarintField(15,W.version||1),I.writeStringField(1,W.name||""),I.writeVarintField(5,W.extent||4096);var G={keys:[],values:[],keycache:{},valuecache:{}};for(P=0;P<W.length;P++)G.feature=W.feature(P),I.writeMessage(2,Pr,G);var Z=G.keys;for(P=0;P<Z.length;P++)I.writeStringField(3,Z[P]);var Y=G.values;for(P=0;P<Y.length;P++)I.writeMessage(4,zr,Y[P])}function Pr(W,I){var P=W.feature;P.id!==void 0&&I.writeVarintField(1,P.id),I.writeMessage(2,Gr,W),I.writeVarintField(3,P.type),I.writeMessage(4,dn,P)}function Gr(W,I){var P=W.feature,G=W.keys,Z=W.values,Y=W.keycache,at=W.valuecache;for(var rt in P.properties){var nt=P.properties[rt],ot=Y[rt];if(nt!==null){ot===void 0&&(G.push(rt),Y[rt]=ot=G.length-1),I.writeVarint(ot);var St=typeof nt;St!=="string"&&St!=="boolean"&&St!=="number"&&(nt=JSON.stringify(nt));var kt=St+":"+nt,wt=at[kt];wt===void 0&&(Z.push(nt),at[kt]=wt=Z.length-1),I.writeVarint(wt)}}}function Qr(W,I){return(I<<3)+(7&W)}function _i(W){return W<<1^W>>31}function dn(W,I){for(var P=W.loadGeometry(),G=W.type,Z=0,Y=0,at=P.length,rt=0;rt<at;rt++){var nt=P[rt],ot=1;G===1&&(ot=nt.length),I.writeVarint(Qr(1,ot));for(var St=G===3?nt.length-1:nt.length,kt=0;kt<St;kt++){kt===1&&G!==1&&I.writeVarint(Qr(2,St-1));var wt=nt[kt].x-Z,re=nt[kt].y-Y;I.writeVarint(_i(wt)),I.writeVarint(_i(re)),Z+=wt,Y+=re}G===3&&I.writeVarint(Qr(7,1))}}function zr(W,I){var P=typeof W;P==="string"?I.writeStringField(1,W):P==="boolean"?I.writeBooleanField(7,W):P==="number"&&(W%1!=0?I.writeDoubleField(3,W):W<0?I.writeSVarintField(6,W):I.writeVarintField(5,W))}ve.exports=Vr,ve.exports.fromVectorTileJs=Vr,ve.exports.fromGeojsonVt=function(W,I){I=I||{};var P={};for(var G in W)P[G]=new Bi(W[G].features,I),P[G].name=G,P[G].version=I.version,P[G].extent=I.extent;return Vr({layers:P})},ve.exports.GeoJSONWrapper=Bi;var kr=ve.exports;function tn(W,I,P,G,Z,Y){if(Z-G<=P)return;let at=G+Z>>1;en(W,I,at,G,Z,Y%2),tn(W,I,P,G,at-1,Y+1),tn(W,I,P,at+1,Z,Y+1)}function en(W,I,P,G,Z,Y){for(;Z>G;){if(Z-G>600){let ot=Z-G+1,St=P-G+1,kt=Math.log(ot),wt=.5*Math.exp(2*kt/3),re=.5*Math.sqrt(kt*wt*(ot-wt)/ot)*(St-ot/2<0?-1:1);en(W,I,P,Math.max(G,Math.floor(P-St*wt/ot+re)),Math.min(Z,Math.floor(P+(ot-St)*wt/ot+re)),Y)}let at=I[2*P+Y],rt=G,nt=Z;for(gr(W,I,G,P),I[2*Z+Y]>at&&gr(W,I,G,Z);rt<nt;){for(gr(W,I,rt,nt),rt++,nt--;I[2*rt+Y]<at;)rt++;for(;I[2*nt+Y]>at;)nt--}I[2*G+Y]===at?gr(W,I,G,nt):(nt++,gr(W,I,nt,Z)),nt<=P&&(G=nt+1),P<=nt&&(Z=nt-1)}}function gr(W,I,P,G){Lr(W,P,G),Lr(I,2*P,2*G),Lr(I,2*P+1,2*G+1)}function Lr(W,I,P){let G=W[I];W[I]=W[P],W[P]=G}function qr(W,I,P,G){let Z=W-P,Y=I-G;return Z*Z+Y*Y}let Sn=W=>W[0],Ln=W=>W[1];class Dn{constructor(I,P=Sn,G=Ln,Z=64,Y=Float64Array){this.nodeSize=Z,this.points=I;let at=I.length<65536?Uint16Array:Uint32Array,rt=this.ids=new at(I.length),nt=this.coords=new Y(2*I.length);for(let ot=0;ot<I.length;ot++)rt[ot]=ot,nt[2*ot]=P(I[ot]),nt[2*ot+1]=G(I[ot]);tn(rt,nt,Z,0,rt.length-1,0)}range(I,P,G,Z){return function(Y,at,rt,nt,ot,St,kt){let wt=[0,Y.length-1,0],re=[],Jt,se;for(;wt.length;){let pe=wt.pop(),Ue=wt.pop(),De=wt.pop();if(Ue-De<=kt){for(let Me=De;Me<=Ue;Me++)Jt=at[2*Me],se=at[2*Me+1],Jt>=rt&&Jt<=ot&&se>=nt&&se<=St&&re.push(Y[Me]);continue}let ze=Math.floor((De+Ue)/2);Jt=at[2*ze],se=at[2*ze+1],Jt>=rt&&Jt<=ot&&se>=nt&&se<=St&&re.push(Y[ze]);let Te=(pe+1)%2;(pe===0?rt<=Jt:nt<=se)&&(wt.push(De),wt.push(ze-1),wt.push(Te)),(pe===0?ot>=Jt:St>=se)&&(wt.push(ze+1),wt.push(Ue),wt.push(Te))}return re}(this.ids,this.coords,I,P,G,Z,this.nodeSize)}within(I,P,G){return function(Z,Y,at,rt,nt,ot){let St=[0,Z.length-1,0],kt=[],wt=nt*nt;for(;St.length;){let re=St.pop(),Jt=St.pop(),se=St.pop();if(Jt-se<=ot){for(let Te=se;Te<=Jt;Te++)qr(Y[2*Te],Y[2*Te+1],at,rt)<=wt&&kt.push(Z[Te]);continue}let pe=Math.floor((se+Jt)/2),Ue=Y[2*pe],De=Y[2*pe+1];qr(Ue,De,at,rt)<=wt&&kt.push(Z[pe]);let ze=(re+1)%2;(re===0?at-nt<=Ue:rt-nt<=De)&&(St.push(se),St.push(pe-1),St.push(ze)),(re===0?at+nt>=Ue:rt+nt>=De)&&(St.push(pe+1),St.push(Jt),St.push(ze))}return kt}(this.ids,this.coords,I,P,G,this.nodeSize)}}let cs={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:W=>W},Je=Math.fround||(rn=new Float32Array(1),W=>(rn[0]=+W,rn[0]));var rn;class Rn{constructor(I){this.options=X(Object.create(cs),I),this.trees=new Array(this.options.maxZoom+1)}load(I){let{log:P,minZoom:G,maxZoom:Z,nodeSize:Y}=this.options;P&&console.time("total time");let at=`prepare ${I.length} points`;P&&console.time(at),this.points=I;let rt=[];for(let nt=0;nt<I.length;nt++)I[nt].geometry&&rt.push(Dr(I[nt],nt));this.trees[Z+1]=new Dn(rt,st,xt,Y,Float32Array),P&&console.timeEnd(at);for(let nt=Z;nt>=G;nt--){let ot=+Date.now();rt=this._cluster(rt,nt),this.trees[nt]=new Dn(rt,st,xt,Y,Float32Array),P&&console.log("z%d: %d clusters in %dms",nt,rt.length,+Date.now()-ot)}return P&&console.timeEnd("total time"),this}getClusters(I,P){let G=((I[0]+180)%360+360)%360-180,Z=Math.max(-90,Math.min(90,I[1])),Y=I[2]===180?180:((I[2]+180)%360+360)%360-180,at=Math.max(-90,Math.min(90,I[3]));if(I[2]-I[0]>=360)G=-180,Y=180;else if(G>Y){let St=this.getClusters([G,Z,180,at],P),kt=this.getClusters([-180,Z,Y,at],P);return St.concat(kt)}let rt=this.trees[this._limitZoom(P)],nt=rt.range(N(G),R(at),N(Y),R(Z)),ot=[];for(let St of nt){let kt=rt.points[St];ot.push(kt.numPoints?us(kt):this.points[kt.index])}return ot}getChildren(I){let P=this._getOriginId(I),G=this._getOriginZoom(I),Z="No cluster with the specified id.",Y=this.trees[G];if(!Y)throw new Error(Z);let at=Y.points[P];if(!at)throw new Error(Z);let rt=this.options.radius/(this.options.extent*Math.pow(2,G-1)),nt=Y.within(at.x,at.y,rt),ot=[];for(let St of nt){let kt=Y.points[St];kt.parentId===I&&ot.push(kt.numPoints?us(kt):this.points[kt.index])}if(ot.length===0)throw new Error(Z);return ot}getLeaves(I,P,G){let Z=[];return this._appendLeaves(Z,I,P=P||10,G=G||0,0),Z}getTile(I,P,G){let Z=this.trees[this._limitZoom(I)],Y=Math.pow(2,I),{extent:at,radius:rt}=this.options,nt=rt/at,ot=(G-nt)/Y,St=(G+1+nt)/Y,kt={features:[]};return this._addTileFeatures(Z.range((P-nt)/Y,ot,(P+1+nt)/Y,St),Z.points,P,G,Y,kt),P===0&&this._addTileFeatures(Z.range(1-nt/Y,ot,1,St),Z.points,Y,G,Y,kt),P===Y-1&&this._addTileFeatures(Z.range(0,ot,nt/Y,St),Z.points,-1,G,Y,kt),kt.features.length?kt:null}getClusterExpansionZoom(I){let P=this._getOriginZoom(I)-1;for(;P<=this.options.maxZoom;){let G=this.getChildren(I);if(P++,G.length!==1)break;I=G[0].properties.cluster_id}return P}_appendLeaves(I,P,G,Z,Y){let at=this.getChildren(P);for(let rt of at){let nt=rt.properties;if(nt&&nt.cluster?Y+nt.point_count<=Z?Y+=nt.point_count:Y=this._appendLeaves(I,nt.cluster_id,G,Z,Y):Y<Z?Y++:I.push(rt),I.length===G)break}return Y}_addTileFeatures(I,P,G,Z,Y,at){for(let rt of I){let nt=P[rt],ot=nt.numPoints,St,kt,wt;if(ot)St=ft(nt),kt=nt.x,wt=nt.y;else{let se=this.points[nt.index];St=se.properties,kt=N(se.geometry.coordinates[0]),wt=R(se.geometry.coordinates[1])}let re={type:1,geometry:[[Math.round(this.options.extent*(kt*Y-G)),Math.round(this.options.extent*(wt*Y-Z))]],tags:St},Jt;ot?Jt=nt.id:this.options.generateId?Jt=nt.index:this.points[nt.index].id&&(Jt=this.points[nt.index].id),Jt!==void 0&&(re.id=Jt),at.features.push(re)}}_limitZoom(I){return Math.max(this.options.minZoom,Math.min(+I,this.options.maxZoom+1))}_cluster(I,P){let G=[],{radius:Z,extent:Y,reduce:at,minPoints:rt}=this.options,nt=Z/(Y*Math.pow(2,P));for(let ot=0;ot<I.length;ot++){let St=I[ot];if(St.zoom<=P)continue;St.zoom=P;let kt=this.trees[P+1],wt=kt.within(St.x,St.y,nt),re=St.numPoints||1,Jt=re;for(let se of wt){let pe=kt.points[se];pe.zoom>P&&(Jt+=pe.numPoints||1)}if(Jt>re&&Jt>=rt){let se=St.x*re,pe=St.y*re,Ue=at&&re>1?this._map(St,!0):null,De=(ot<<5)+(P+1)+this.points.length;for(let ze of wt){let Te=kt.points[ze];if(Te.zoom<=P)continue;Te.zoom=P;let Me=Te.numPoints||1;se+=Te.x*Me,pe+=Te.y*Me,Te.parentId=De,at&&(Ue||(Ue=this._map(St,!0)),at(Ue,this._map(Te)))}St.parentId=De,G.push(fn(se/Jt,pe/Jt,De,Jt,Ue))}else if(G.push(St),Jt>1)for(let se of wt){let pe=kt.points[se];pe.zoom<=P||(pe.zoom=P,G.push(pe))}}return G}_getOriginId(I){return I-this.points.length>>5}_getOriginZoom(I){return(I-this.points.length)%32}_map(I,P){if(I.numPoints)return P?X({},I.properties):I.properties;let G=this.points[I.index].properties,Z=this.options.map(G);return P&&Z===G?X({},Z):Z}}function fn(W,I,P,G,Z){return{x:Je(W),y:Je(I),zoom:1/0,id:P,parentId:-1,numPoints:G,properties:Z}}function Dr(W,I){let[P,G]=W.geometry.coordinates;return{x:Je(N(P)),y:Je(R(G)),zoom:1/0,index:I,parentId:-1}}function us(W){return{type:"Feature",id:W.id,properties:ft(W),geometry:{type:"Point",coordinates:[(I=W.x,360*(I-.5)),U(W.y)]}};var I}function ft(W){let I=W.numPoints,P=I>=1e4?`${Math.round(I/1e3)}k`:I>=1e3?Math.round(I/100)/10+"k":I;return X(X({},W.properties),{cluster:!0,cluster_id:W.id,point_count:I,point_count_abbreviated:P})}function N(W){return W/360+.5}function R(W){let I=Math.sin(W*Math.PI/180),P=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return P<0?0:P>1?1:P}function U(W){let I=(180-360*W)*Math.PI/180;return 360*Math.atan(Math.exp(I))/Math.PI-90}function X(W,I){for(let P in I)W[P]=I[P];return W}function st(W){return W.x}function xt(W){return W.y}function Dt(W,I,P,G){for(var Z,Y=G,at=P-I>>1,rt=P-I,nt=W[I],ot=W[I+1],St=W[P],kt=W[P+1],wt=I+3;wt<P;wt+=3){var re=Ut(W[wt],W[wt+1],nt,ot,St,kt);if(re>Y)Z=wt,Y=re;else if(re===Y){var Jt=Math.abs(wt-at);Jt<rt&&(Z=wt,rt=Jt)}}Y>G&&(Z-I>3&&Dt(W,I,Z,G),W[Z+2]=Y,P-Z>3&&Dt(W,Z,P,G))}function Ut(W,I,P,G,Z,Y){var at=Z-P,rt=Y-G;if(at!==0||rt!==0){var nt=((W-P)*at+(I-G)*rt)/(at*at+rt*rt);nt>1?(P=Z,G=Y):nt>0&&(P+=at*nt,G+=rt*nt)}return(at=W-P)*at+(rt=I-G)*rt}function ct(W,I,P,G){var Z={id:W===void 0?null:W,type:I,geometry:P,tags:G,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Y){var at=Y.geometry,rt=Y.type;if(rt==="Point"||rt==="MultiPoint"||rt==="LineString")Ct(Y,at);else if(rt==="Polygon"||rt==="MultiLineString")for(var nt=0;nt<at.length;nt++)Ct(Y,at[nt]);else if(rt==="MultiPolygon")for(nt=0;nt<at.length;nt++)for(var ot=0;ot<at[nt].length;ot++)Ct(Y,at[nt][ot])}(Z),Z}function Ct(W,I){for(var P=0;P<I.length;P+=3)W.minX=Math.min(W.minX,I[P]),W.minY=Math.min(W.minY,I[P+1]),W.maxX=Math.max(W.maxX,I[P]),W.maxY=Math.max(W.maxY,I[P+1])}function Se(W,I,P,G){if(I.geometry){var Z=I.geometry.coordinates,Y=I.geometry.type,at=Math.pow(P.tolerance/((1<<P.maxZoom)*P.extent),2),rt=[],nt=I.id;if(P.promoteId?nt=I.properties[P.promoteId]:P.generateId&&(nt=G||0),Y==="Point")Ie(Z,rt);else if(Y==="MultiPoint")for(var ot=0;ot<Z.length;ot++)Ie(Z[ot],rt);else if(Y==="LineString")ae(Z,rt,at,!1);else if(Y==="MultiLineString"){if(P.lineMetrics){for(ot=0;ot<Z.length;ot++)ae(Z[ot],rt=[],at,!1),W.push(ct(nt,"LineString",rt,I.properties));return}Oe(Z,rt,at,!1)}else if(Y==="Polygon")Oe(Z,rt,at,!0);else{if(Y!=="MultiPolygon"){if(Y==="GeometryCollection"){for(ot=0;ot<I.geometry.geometries.length;ot++)Se(W,{id:nt,geometry:I.geometry.geometries[ot],properties:I.properties},P,G);return}throw new Error("Input data is not a valid GeoJSON object.")}for(ot=0;ot<Z.length;ot++){var St=[];Oe(Z[ot],St,at,!0),rt.push(St)}}W.push(ct(nt,Y,rt,I.properties))}}function Ie(W,I){I.push(Ce(W[0])),I.push(Qe(W[1])),I.push(0)}function ae(W,I,P,G){for(var Z,Y,at=0,rt=0;rt<W.length;rt++){var nt=Ce(W[rt][0]),ot=Qe(W[rt][1]);I.push(nt),I.push(ot),I.push(0),rt>0&&(at+=G?(Z*ot-nt*Y)/2:Math.sqrt(Math.pow(nt-Z,2)+Math.pow(ot-Y,2))),Z=nt,Y=ot}var St=I.length-3;I[2]=1,Dt(I,0,St,P),I[St+2]=1,I.size=Math.abs(at),I.start=0,I.end=I.size}function Oe(W,I,P,G){for(var Z=0;Z<W.length;Z++){var Y=[];ae(W[Z],Y,P,G),I.push(Y)}}function Ce(W){return W/360+.5}function Qe(W){var I=Math.sin(W*Math.PI/180),P=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return P<0?0:P>1?1:P}function Pe(W,I,P,G,Z,Y,at,rt){if(G/=I,Y>=(P/=I)&&at<G)return W;if(at<P||Y>=G)return null;for(var nt=[],ot=0;ot<W.length;ot++){var St=W[ot],kt=St.geometry,wt=St.type,re=Z===0?St.minX:St.minY,Jt=Z===0?St.maxX:St.maxY;if(re>=P&&Jt<G)nt.push(St);else if(!(Jt<P||re>=G)){var se=[];if(wt==="Point"||wt==="MultiPoint")Vt(kt,se,P,G,Z);else if(wt==="LineString")ge(kt,se,P,G,Z,!1,rt.lineMetrics);else if(wt==="MultiLineString")ai(kt,se,P,G,Z,!1);else if(wt==="Polygon")ai(kt,se,P,G,Z,!0);else if(wt==="MultiPolygon")for(var pe=0;pe<kt.length;pe++){var Ue=[];ai(kt[pe],Ue,P,G,Z,!0),Ue.length&&se.push(Ue)}if(se.length){if(rt.lineMetrics&&wt==="LineString"){for(pe=0;pe<se.length;pe++)nt.push(ct(St.id,wt,se[pe],St.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"),nt.push(ct(St.id,wt,se,St.tags))}}}return nt.length?nt:null}function Vt(W,I,P,G,Z){for(var Y=0;Y<W.length;Y+=3){var at=W[Y+Z];at>=P&&at<=G&&(I.push(W[Y]),I.push(W[Y+1]),I.push(W[Y+2]))}}function ge(W,I,P,G,Z,Y,at){for(var rt,nt,ot=he(W),St=Z===0?_e:ir,kt=W.start,wt=0;wt<W.length-3;wt+=3){var re=W[wt],Jt=W[wt+1],se=W[wt+2],pe=W[wt+3],Ue=W[wt+4],De=Z===0?re:Jt,ze=Z===0?pe:Ue,Te=!1;at&&(rt=Math.sqrt(Math.pow(re-pe,2)+Math.pow(Jt-Ue,2))),De<P?ze>P&&(nt=St(ot,re,Jt,pe,Ue,P),at&&(ot.start=kt+rt*nt)):De>G?ze<G&&(nt=St(ot,re,Jt,pe,Ue,G),at&&(ot.start=kt+rt*nt)):$i(ot,re,Jt,se),ze<P&&De>=P&&(nt=St(ot,re,Jt,pe,Ue,P),Te=!0),ze>G&&De<=G&&(nt=St(ot,re,Jt,pe,Ue,G),Te=!0),!Y&&Te&&(at&&(ot.end=kt+rt*nt),I.push(ot),ot=he(W)),at&&(kt+=rt)}var Me=W.length-3;re=W[Me],Jt=W[Me+1],se=W[Me+2],(De=Z===0?re:Jt)>=P&&De<=G&&$i(ot,re,Jt,se),Me=ot.length-3,Y&&Me>=3&&(ot[Me]!==ot[0]||ot[Me+1]!==ot[1])&&$i(ot,ot[0],ot[1],ot[2]),ot.length&&I.push(ot)}function he(W){var I=[];return I.size=W.size,I.start=W.start,I.end=W.end,I}function ai(W,I,P,G,Z,Y){for(var at=0;at<W.length;at++)ge(W[at],I,P,G,Z,Y,!1)}function $i(W,I,P,G){W.push(I),W.push(P),W.push(G)}function _e(W,I,P,G,Z,Y){var at=(Y-I)/(G-I);return W.push(Y),W.push(P+(Z-P)*at),W.push(1),at}function ir(W,I,P,G,Z,Y){var at=(Y-P)/(Z-P);return W.push(I+(G-I)*at),W.push(Y),W.push(1),at}function mi(W,I){for(var P=[],G=0;G<W.length;G++){var Z,Y=W[G],at=Y.type;if(at==="Point"||at==="MultiPoint"||at==="LineString")Z=rr(Y.geometry,I);else if(at==="MultiLineString"||at==="Polygon"){Z=[];for(var rt=0;rt<Y.geometry.length;rt++)Z.push(rr(Y.geometry[rt],I))}else if(at==="MultiPolygon")for(Z=[],rt=0;rt<Y.geometry.length;rt++){for(var nt=[],ot=0;ot<Y.geometry[rt].length;ot++)nt.push(rr(Y.geometry[rt][ot],I));Z.push(nt)}P.push(ct(Y.id,at,Z,Y.tags))}return P}function rr(W,I){var P=[];P.size=W.size,W.start!==void 0&&(P.start=W.start,P.end=W.end);for(var G=0;G<W.length;G+=3)P.push(W[G]+I,W[G+1],W[G+2]);return P}function ri(W,I){if(W.transformed)return W;var P,G,Z,Y=1<<W.z,at=W.x,rt=W.y;for(P=0;P<W.features.length;P++){var nt=W.features[P],ot=nt.geometry,St=nt.type;if(nt.geometry=[],St===1)for(G=0;G<ot.length;G+=2)nt.geometry.push(Ze(ot[G],ot[G+1],I,Y,at,rt));else for(G=0;G<ot.length;G++){var kt=[];for(Z=0;Z<ot[G].length;Z+=2)kt.push(Ze(ot[G][Z],ot[G][Z+1],I,Y,at,rt));nt.geometry.push(kt)}}return W.transformed=!0,W}function Ze(W,I,P,G,Z,Y){return[Math.round(P*(W*G-Z)),Math.round(P*(I*G-Y))]}function Vi(W,I,P,G,Z){for(var Y=I===Z.maxZoom?0:Z.tolerance/((1<<I)*Z.extent),at={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:P,y:G,z:I,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},rt=0;rt<W.length;rt++){at.numFeatures++,yr(at,W[rt],Y,Z);var nt=W[rt].minX,ot=W[rt].minY,St=W[rt].maxX,kt=W[rt].maxY;nt<at.minX&&(at.minX=nt),ot<at.minY&&(at.minY=ot),St>at.maxX&&(at.maxX=St),kt>at.maxY&&(at.maxY=kt)}return at}function yr(W,I,P,G){var Z=I.geometry,Y=I.type,at=[];if(Y==="Point"||Y==="MultiPoint")for(var rt=0;rt<Z.length;rt+=3)at.push(Z[rt]),at.push(Z[rt+1]),W.numPoints++,W.numSimplified++;else if(Y==="LineString")gi(at,Z,W,P,!1,!1);else if(Y==="MultiLineString"||Y==="Polygon")for(rt=0;rt<Z.length;rt++)gi(at,Z[rt],W,P,Y==="Polygon",rt===0);else if(Y==="MultiPolygon")for(var nt=0;nt<Z.length;nt++){var ot=Z[nt];for(rt=0;rt<ot.length;rt++)gi(at,ot[rt],W,P,!0,rt===0)}if(at.length){var St=I.tags||null;if(Y==="LineString"&&G.lineMetrics){for(var kt in St={},I.tags)St[kt]=I.tags[kt];St.mapbox_clip_start=Z.start/Z.size,St.mapbox_clip_end=Z.end/Z.size}var wt={geometry:at,type:Y==="Polygon"||Y==="MultiPolygon"?3:Y==="LineString"||Y==="MultiLineString"?2:1,tags:St};I.id!==null&&(wt.id=I.id),W.features.push(wt)}}function gi(W,I,P,G,Z,Y){var at=G*G;if(G>0&&I.size<(Z?at:G))P.numPoints+=I.length/3;else{for(var rt=[],nt=0;nt<I.length;nt+=3)(G===0||I[nt+2]>at)&&(P.numSimplified++,rt.push(I[nt]),rt.push(I[nt+1])),P.numPoints++;Z&&function(ot,St){for(var kt=0,wt=0,re=ot.length,Jt=re-2;wt<re;Jt=wt,wt+=2)kt+=(ot[wt]-ot[Jt])*(ot[wt+1]+ot[Jt+1]);if(kt>0===St)for(wt=0,re=ot.length;wt<re/2;wt+=2){var se=ot[wt],pe=ot[wt+1];ot[wt]=ot[re-2-wt],ot[wt+1]=ot[re-1-wt],ot[re-2-wt]=se,ot[re-1-wt]=pe}}(rt,Y),W.push(rt)}}function jr(W,I){var P=(I=this.options=function(Z,Y){for(var at in Y)Z[at]=Y[at];return Z}(Object.create(this.options),I)).debug;if(P&&console.time("preprocess data"),I.maxZoom<0||I.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(I.promoteId&&I.generateId)throw new Error("promoteId and generateId cannot be used together.");var G=function(Z,Y){var at=[];if(Z.type==="FeatureCollection")for(var rt=0;rt<Z.features.length;rt++)Se(at,Z.features[rt],Y,rt);else Se(at,Z.type==="Feature"?Z:{geometry:Z},Y);return at}(W,I);this.tiles={},this.tileCoords=[],P&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",I.indexMaxZoom,I.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),G=function(Z,Y){var at=Y.buffer/Y.extent,rt=Z,nt=Pe(Z,1,-1-at,at,0,-1,2,Y),ot=Pe(Z,1,1-at,2+at,0,-1,2,Y);return(nt||ot)&&(rt=Pe(Z,1,-at,1+at,0,-1,2,Y)||[],nt&&(rt=mi(nt,1).concat(rt)),ot&&(rt=rt.concat(mi(ot,-1)))),rt}(G,I),G.length&&this.splitTile(G,0,0,0),P&&(G.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 $r(W,I,P){return 32*((1<<W)*P+I)+W}function Vs(W,I){let P=W.tileID.canonical;if(!this._geoJSONIndex)return I(null,null);let G=this._geoJSONIndex.getTile(P.z,P.x,P.y);if(!G)return I(null,null);let Z=new Ee(G.features),Y=kr(Z);Y.byteOffset===0&&Y.byteLength===Y.buffer.byteLength||(Y=new Uint8Array(Y)),I(null,{vectorTile:Z,rawData:Y.buffer})}jr.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},jr.prototype.splitTile=function(W,I,P,G,Z,Y,at){for(var rt=[W,I,P,G],nt=this.options,ot=nt.debug;rt.length;){G=rt.pop(),P=rt.pop(),I=rt.pop(),W=rt.pop();var St=1<<I,kt=$r(I,P,G),wt=this.tiles[kt];if(!wt&&(ot>1&&console.time("creation"),wt=this.tiles[kt]=Vi(W,I,P,G,nt),this.tileCoords.push({z:I,x:P,y:G}),ot)){ot>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",I,P,G,wt.numFeatures,wt.numPoints,wt.numSimplified),console.timeEnd("creation"));var re="z"+I;this.stats[re]=(this.stats[re]||0)+1,this.total++}if(wt.source=W,Z){if(I===nt.maxZoom||I===Z)continue;var Jt=1<<Z-I;if(P!==Math.floor(Y/Jt)||G!==Math.floor(at/Jt))continue}else if(I===nt.indexMaxZoom||wt.numPoints<=nt.indexMaxPoints)continue;if(wt.source=null,W.length!==0){ot>1&&console.time("clipping");var se,pe,Ue,De,ze,Te,Me=.5*nt.buffer/nt.extent,wi=.5-Me,xi=.5+Me,Gi=1+Me;se=pe=Ue=De=null,ze=Pe(W,St,P-Me,P+xi,0,wt.minX,wt.maxX,nt),Te=Pe(W,St,P+wi,P+Gi,0,wt.minX,wt.maxX,nt),W=null,ze&&(se=Pe(ze,St,G-Me,G+xi,1,wt.minY,wt.maxY,nt),pe=Pe(ze,St,G+wi,G+Gi,1,wt.minY,wt.maxY,nt),ze=null),Te&&(Ue=Pe(Te,St,G-Me,G+xi,1,wt.minY,wt.maxY,nt),De=Pe(Te,St,G+wi,G+Gi,1,wt.minY,wt.maxY,nt),Te=null),ot>1&&console.timeEnd("clipping"),rt.push(se||[],I+1,2*P,2*G),rt.push(pe||[],I+1,2*P,2*G+1),rt.push(Ue||[],I+1,2*P+1,2*G),rt.push(De||[],I+1,2*P+1,2*G+1)}}},jr.prototype.getTile=function(W,I,P){var G=this.options,Z=G.extent,Y=G.debug;if(W<0||W>24)return null;var at=1<<W,rt=$r(W,I=(I%at+at)%at,P);if(this.tiles[rt])return ri(this.tiles[rt],Z);Y>1&&console.log("drilling down to z%d-%d-%d",W,I,P);for(var nt,ot=W,St=I,kt=P;!nt&&ot>0;)ot--,St=Math.floor(St/2),kt=Math.floor(kt/2),nt=this.tiles[$r(ot,St,kt)];return nt&&nt.source?(Y>1&&console.log("found parent tile z%d-%d-%d",ot,St,kt),Y>1&&console.time("drilling down"),this.splitTile(nt.source,ot,St,kt,W,I,P),Y>1&&console.timeEnd("drilling down"),this.tiles[rt]?ri(this.tiles[rt],Z):null):null};class ps extends gt{constructor(I,P,G,Z){super(I,P,G,Vs),Z&&(this.loadGeoJSON=Z)}loadData(I,P){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=P,this._pendingLoadDataParams=I,this._state&&this._state!=="Idle"?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())}_loadData(){if(!this._pendingCallback||!this._pendingLoadDataParams)return;let I=this._pendingCallback,P=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;let G=!!(P&&P.request&&P.request.collectResourceTiming)&&new a.RequestPerformance(P.request);this.loadGeoJSON(P,(Z,Y)=>{if(Z||!Y)return I(Z);if(typeof Y!="object")return I(new Error(`Input data given to '${P.source}' is not a valid GeoJSON object.`));{Ot(Y,!0);try{if(P.filter){let rt=a.createExpression(P.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(rt.result==="error")throw new Error(rt.value.map(ot=>`${ot.key}: ${ot.message}`).join(", "));let nt=Y.features.filter(ot=>rt.value.evaluate({zoom:0},ot));Y={type:"FeatureCollection",features:nt}}this._geoJSONIndex=P.cluster?new Rn(function({superclusterOptions:rt,clusterProperties:nt}){if(!nt||!rt)return rt;let ot={},St={},kt={accumulated:null,zoom:0},wt={properties:null},re=Object.keys(nt);for(let Jt of re){let[se,pe]=nt[Jt],Ue=a.createExpression(pe),De=a.createExpression(typeof se=="string"?[se,["accumulated"],["get",Jt]]:se);ot[Jt]=Ue.value,St[Jt]=De.value}return rt.map=Jt=>{wt.properties=Jt;let se={};for(let pe of re)se[pe]=ot[pe].evaluate(kt,wt);return se},rt.reduce=(Jt,se)=>{wt.properties=se;for(let pe of re)kt.accumulated=Jt[pe],Jt[pe]=St[pe].evaluate(kt,wt)},rt}(P)).load(Y.features):function(rt,nt){return new jr(rt,nt)}(Y,P.geojsonVtOptions)}catch(rt){return I(rt)}this.loaded={};let at={};if(G){let rt=G.finish();rt&&(at.resourceTiming={},at.resourceTiming[P.source]=JSON.parse(JSON.stringify(rt)))}I(null,at)}})}coalesce(){this._state==="Coalescing"?this._state="Idle":this._state==="NeedsLoadData"&&(this._state="Coalescing",this._loadData())}reloadTile(I,P){let G=this.loaded;return G&&G[I.uid]?super.reloadTile(I,P):this.loadTile(I,P)}loadGeoJSON(I,P){if(I.request)a.getJSON(I.request,P);else{if(typeof I.data!="string")return P(new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`));try{return P(null,JSON.parse(I.data))}catch{return P(new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`))}}}removeSource(I,P){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),P()}getClusterExpansionZoom(I,P){try{P(null,this._geoJSONIndex.getClusterExpansionZoom(I.clusterId))}catch(G){P(G)}}getClusterChildren(I,P){try{P(null,this._geoJSONIndex.getChildren(I.clusterId))}catch(G){P(G)}}getClusterLeaves(I,P){try{P(null,this._geoJSONIndex.getLeaves(I.clusterId,I.limit,I.offset))}catch(G){P(G)}}}class ds{constructor(I){this.self=I,this.actor=new a.Actor(I,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:gt,geojson:ps},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(P,G)=>{if(this.workerSourceTypes[P])throw new Error(`Worker source with name "${P}" already registered.`);this.workerSourceTypes[P]=G},this.self.registerRTLTextPlugin=P=>{if(a.plugin.isParsed())throw new Error("RTL text plugin already registered.");a.plugin.applyArabicShaping=P.applyArabicShaping,a.plugin.processBidirectionalText=P.processBidirectionalText,a.plugin.processStyledBidirectionalText=P.processStyledBidirectionalText}}setReferrer(I,P){this.referrer=P}setImages(I,P,G){this.availableImages[I]=P;for(let Z in this.workerSources[I]){let Y=this.workerSources[I][Z];for(let at in Y)Y[at].availableImages=P}G()}setLayers(I,P,G){this.getLayerIndex(I).replace(P),G()}updateLayers(I,P,G){this.getLayerIndex(I).update(P.layers,P.removedIds),G()}loadTile(I,P,G){this.getWorkerSource(I,P.type,P.source).loadTile(P,G)}loadDEMTile(I,P,G){this.getDEMWorkerSource(I,P.source).loadTile(P,G)}reloadTile(I,P,G){this.getWorkerSource(I,P.type,P.source).reloadTile(P,G)}abortTile(I,P,G){this.getWorkerSource(I,P.type,P.source).abortTile(P,G)}removeTile(I,P,G){this.getWorkerSource(I,P.type,P.source).removeTile(P,G)}removeDEMTile(I,P){this.getDEMWorkerSource(I,P.source).removeTile(P)}removeSource(I,P,G){if(!this.workerSources[I]||!this.workerSources[I][P.type]||!this.workerSources[I][P.type][P.source])return;let Z=this.workerSources[I][P.type][P.source];delete this.workerSources[I][P.type][P.source],Z.removeSource!==void 0?Z.removeSource(P,G):G()}loadWorkerSource(I,P,G){try{this.self.importScripts(P.url),G()}catch(Z){G(Z.toString())}}syncRTLPluginState(I,P,G){try{a.plugin.setState(P);let Z=a.plugin.getPluginURL();if(a.plugin.isLoaded()&&!a.plugin.isParsed()&&Z!=null){this.self.importScripts(Z);let Y=a.plugin.isParsed();G(Y?void 0:new Error(`RTL Text Plugin failed to import scripts from ${Z}`),Y)}}catch(Z){G(Z.toString())}}getAvailableImages(I){let P=this.availableImages[I];return P||(P=[]),P}getLayerIndex(I){let P=this.layerIndexes[I];return P||(P=this.layerIndexes[I]=new B),P}getWorkerSource(I,P,G){if(this.workerSources[I]||(this.workerSources[I]={}),this.workerSources[I][P]||(this.workerSources[I][P]={}),!this.workerSources[I][P][G]){let Z={send:(Y,at,rt)=>{this.actor.send(Y,at,rt,I)}};this.workerSources[I][P][G]=new this.workerSourceTypes[P](Z,this.getLayerIndex(I),this.getAvailableImages(I))}return this.workerSources[I][P][G]}getDEMWorkerSource(I,P){return this.demWorkerSources[I]||(this.demWorkerSources[I]={}),this.demWorkerSources[I][P]||(this.demWorkerSources[I][P]=new _t),this.demWorkerSources[I][P]}enforceCacheSizeLimit(I,P){a.enforceCacheSizeLimit(P)}}return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new ds(self)),ds}),y(["./shared"],function(a){"use strict";var T=E;function E(p){return!function(e){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 h,d,g=new Blob([""],{type:"text/javascript"}),v=URL.createObjectURL(g);try{d=new Worker(v),h=!0}catch{h=!1}return d&&d.terminate(),URL.revokeObjectURL(v),h}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var h=document.createElement("canvas");h.width=h.height=1;var d=h.getContext("2d");if(!d)return!1;var g=d.getImageData(0,0,1,1);return g&&g.width===h.width}()?(B[n=e&&e.failIfMajorPerformanceCaveat]===void 0&&(B[n]=function(h){var d,g=function(v){var w=document.createElement("canvas"),M=Object.create(E.webGLContextAttributes);return M.failIfMajorPerformanceCaveat=v,w.getContext("webgl",M)||w.getContext("experimental-webgl",M)}(h);if(!g)return!1;try{d=g.createShader(g.VERTEX_SHADER)}catch{return!1}return!(!d||g.isContextLost())&&(g.shaderSource(d,"void main() {}"),g.compileShader(d),g.getShaderParameter(d,g.COMPILE_STATUS)===!0)}(n)),B[n]?document.documentMode?"insufficient ECMAScript 6 support":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 n}(p)}var B={};function $(p,e){if(Array.isArray(p)){if(!Array.isArray(e)||p.length!==e.length)return!1;for(let n=0;n<p.length;n++)if(!$(p[n],e[n]))return!1;return!0}if(typeof p=="object"&&p!==null&&e!==null){if(typeof e!="object"||Object.keys(p).length!==Object.keys(e).length)return!1;for(let n in p)if(!$(p[n],e[n]))return!1;return!0}return p===e}E.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class L{static testProp(e){if(!L.docStyle)return e[0];for(let n=0;n<e.length;n++)if(e[n]in L.docStyle)return e[n];return e[0]}static create(e,n,h){let d=window.document.createElement(e);return n!==void 0&&(d.className=n),h&&h.appendChild(d),d}static createNS(e,n){return window.document.createElementNS(e,n)}static disableDrag(){L.docStyle&&L.selectProp&&(L.userSelect=L.docStyle[L.selectProp],L.docStyle[L.selectProp]="none")}static enableDrag(){L.docStyle&&L.selectProp&&(L.docStyle[L.selectProp]=L.userSelect)}static setTransform(e,n){e.style[L.transformProp]=n}static addEventListener(e,n,h,d={}){e.addEventListener(n,h,"passive"in d?d:d.capture)}static removeEventListener(e,n,h,d={}){e.removeEventListener(n,h,"passive"in d?d:d.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",L.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",L.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",L.suppressClickInternal,!0)},0)}static mousePos(e,n){let h=e.getBoundingClientRect();return new a.pointGeometry(n.clientX-h.left-e.clientLeft,n.clientY-h.top-e.clientTop)}static touchPos(e,n){let h=e.getBoundingClientRect(),d=[];for(let g=0;g<n.length;g++)d.push(new a.pointGeometry(n[g].clientX-h.left-e.clientLeft,n[g].clientY-h.top-e.clientTop));return d}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}}L.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,L.selectProp=L.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),L.transformProp=L.testProp(["transform","WebkitTransform"]);class it{constructor(e){this._transformRequestFn=e}transformRequest(e,n){return this._transformRequestFn&&this._transformRequestFn(e,n)||{url:e}}normalizeSpriteURL(e,n,h){let d=function(g){let v=g.match(pt);if(!v)throw new Error(`Unable to parse URL "${g}"`);return{protocol:v[1],authority:v[2],path:v[3]||"/",params:v[4]?v[4].split("&"):[]}}(e);return d.path+=`${n}${h}`,function(g){let v=g.params.length?`?${g.params.join("&")}`:"";return`${g.protocol}://${g.authority}${g.path}${v}`}(d)}setTransformRequest(e){this._transformRequestFn=e}}let pt=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function gt(p){var e=new a.ARRAY_TYPE(3);return e[0]=p[0],e[1]=p[1],e[2]=p[2],e}var _t,Ot=function(p,e,n){return p[0]=e[0]-n[0],p[1]=e[1]-n[1],p[2]=e[2]-n[2],p};_t=new a.ARRAY_TYPE(3),a.ARRAY_TYPE!=Float32Array&&(_t[0]=0,_t[1]=0,_t[2]=0);var Lt=function(p){var e=p[0],n=p[1];return e*e+n*n};(function(){var p=new a.ARRAY_TYPE(2);a.ARRAY_TYPE!=Float32Array&&(p[0]=0,p[1]=0)})();class Nt{constructor(e,n,h,d){this.context=e,this.format=h,this.texture=e.gl.createTexture(),this.update(n,d)}update(e,n,h){let{width:d,height:g}=e,v=!(this.size&&this.size[0]===d&&this.size[1]===g||h),{context:w}=this,{gl:M}=w;if(this.useMipmap=Boolean(n&&n.useMipmap),M.bindTexture(M.TEXTURE_2D,this.texture),w.pixelStoreUnpackFlipY.set(!1),w.pixelStoreUnpack.set(1),w.pixelStoreUnpackPremultiplyAlpha.set(this.format===M.RGBA&&(!n||n.premultiply!==!1)),v)this.size=[d,g],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||a.isImageBitmap(e)?M.texImage2D(M.TEXTURE_2D,0,this.format,this.format,M.UNSIGNED_BYTE,e):M.texImage2D(M.TEXTURE_2D,0,this.format,d,g,0,this.format,M.UNSIGNED_BYTE,e.data);else{let{x:C,y:k}=h||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||a.isImageBitmap(e)?M.texSubImage2D(M.TEXTURE_2D,0,C,k,M.RGBA,M.UNSIGNED_BYTE,e):M.texSubImage2D(M.TEXTURE_2D,0,C,k,d,g,M.RGBA,M.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&M.generateMipmap(M.TEXTURE_2D)}bind(e,n,h){let{context:d}=this,{gl:g}=d;g.bindTexture(g.TEXTURE_2D,this.texture),h!==g.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(h=g.LINEAR),e!==this.filter&&(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,e),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,h||e),this.filter=e),n!==this.wrap&&(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,n),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function ue(p){let{userImage:e}=p;return!!(e&&e.render&&e.render())&&(p.data.replace(new Uint8Array(e.data.buffer)),!0)}class oe extends a.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new a.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:n,callback:h}of this.requestors)this._notify(n,h);this.requestors=[]}}getImage(e){return this.images[e]}addImage(e,n){this._validate(e,n)&&(this.images[e]=n)}_validate(e,n){let h=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new a.ErrorEvent(new Error(`Image "${e}" has invalid "stretchX" value`))),h=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new a.ErrorEvent(new Error(`Image "${e}" has invalid "stretchY" value`))),h=!1),this._validateContent(n.content,n)||(this.fire(new a.ErrorEvent(new Error(`Image "${e}" has invalid "content" value`))),h=!1),h}_validateStretch(e,n){if(!e)return!0;let h=0;for(let d of e){if(d[0]<h||d[1]<d[0]||n<d[1])return!1;h=d[1]}return!0}_validateContent(e,n){return!(e&&(e.length!==4||e[0]<0||n.data.width<e[0]||e[1]<0||n.data.height<e[1]||e[2]<0||n.data.width<e[2]||e[3]<0||n.data.height<e[3]||e[2]<e[0]||e[3]<e[1]))}updateImage(e,n){n.version=this.images[e].version+1,this.images[e]=n,this.updatedImages[e]=!0}removeImage(e){let n=this.images[e];delete this.images[e],delete this.patterns[e],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e,n){let h=!0;if(!this.isLoaded())for(let d of e)this.images[d]||(h=!1);this.isLoaded()||h?this._notify(e,n):this.requestors.push({ids:e,callback:n})}_notify(e,n){let h={};for(let d of e){this.images[d]||this.fire(new a.Event("styleimagemissing",{id:d}));let g=this.images[d];g?h[d]={data:g.data.clone(),pixelRatio:g.pixelRatio,sdf:g.sdf,version:g.version,stretchX:g.stretchX,stretchY:g.stretchY,content:g.content,hasRenderCallback:Boolean(g.userImage&&g.userImage.render)}:a.warnOnce(`Image "${d}" 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.`)}n(null,h)}getPixelSize(){let{width:e,height:n}=this.atlasImage;return{width:e,height:n}}getPattern(e){let n=this.patterns[e],h=this.getImage(e);if(!h)return null;if(n&&n.position.version===h.version)return n.position;if(n)n.position.version=h.version;else{let d={w:h.data.width+2,h:h.data.height+2,x:0,y:0},g=new a.ImagePosition(d,h);this.patterns[e]={bin:d,position:g}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let n=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Nt(e,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let g in this.patterns)e.push(this.patterns[g].bin);let{w:n,h}=a.potpack(e),d=this.atlasImage;d.resize({width:n||1,height:h||1});for(let g in this.patterns){let{bin:v}=this.patterns[g],w=v.x+1,M=v.y+1,C=this.images[g].data,k=C.width,F=C.height;a.RGBAImage.copy(C,d,{x:0,y:0},{x:w,y:M},{width:k,height:F}),a.RGBAImage.copy(C,d,{x:0,y:F-1},{x:w,y:M-1},{width:k,height:1}),a.RGBAImage.copy(C,d,{x:0,y:0},{x:w,y:M+F},{width:k,height:1}),a.RGBAImage.copy(C,d,{x:k-1,y:0},{x:w-1,y:M},{width:1,height:F}),a.RGBAImage.copy(C,d,{x:0,y:0},{x:w+k,y:M},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let n of e){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;let h=this.images[n];ue(h)&&this.updateImage(n,h)}}}let Ee=1e20;function ve(p,e,n,h,d,g,v,w,M){for(let C=e;C<e+h;C++)me(p,n*g+C,g,d,v,w,M);for(let C=n;C<n+d;C++)me(p,C*g+e,1,h,v,w,M)}function me(p,e,n,h,d,g,v){g[0]=0,v[0]=-Ee,v[1]=Ee,d[0]=p[e];for(let w=1,M=0,C=0;w<h;w++){d[w]=p[e+w*n];let k=w*w;do{let F=g[M];C=(d[w]-d[F]+k-F*F)/(w-F)/2}while(C<=v[M]&&--M>-1);M++,g[M]=w,v[M]=C,v[M+1]=Ee}for(let w=0,M=0;w<h;w++){for(;v[M+1]<w;)M++;let C=g[M],k=w-C;p[e+w*n]=d[C]+k*k}}class Ge{constructor(e,n){this.requestManager=e,this.localIdeographFontFamily=n,this.entries={}}setURL(e){this.url=e}getGlyphs(e,n){let h=[];for(let d in e)for(let g of e[d])h.push({stack:d,id:g});a.asyncAll(h,({stack:d,id:g},v)=>{let w=this.entries[d];w||(w=this.entries[d]={glyphs:{},requests:{},ranges:{}});let M=w.glyphs[g];if(M!==void 0)return void v(null,{stack:d,id:g,glyph:M});if(M=this._tinySDF(w,d,g),M)return w.glyphs[g]=M,void v(null,{stack:d,id:g,glyph:M});let C=Math.floor(g/256);if(256*C>65535)return void v(new Error("glyphs > 65535 not supported"));if(w.ranges[C])return void v(null,{stack:d,id:g,glyph:M});let k=w.requests[C];k||(k=w.requests[C]=[],Ge.loadGlyphRange(d,C,this.url,this.requestManager,(F,q)=>{if(q){for(let Q in q)this._doesCharSupportLocalGlyph(+Q)||(w.glyphs[+Q]=q[+Q]);w.ranges[C]=!0}for(let Q of k)Q(F,q);delete w.requests[C]})),k.push((F,q)=>{F?v(F):q&&v(null,{stack:d,id:g,glyph:q[g]||null})})},(d,g)=>{if(d)n(d);else if(g){let v={};for(let{stack:w,id:M,glyph:C}of g)(v[w]||(v[w]={}))[M]=C&&{id:C.id,bitmap:C.bitmap.clone(),metrics:C.metrics};n(null,v)}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(a.unicodeBlockLookup["CJK Unified Ideographs"](e)||a.unicodeBlockLookup["Hangul Syllables"](e)||a.unicodeBlockLookup.Hiragana(e)||a.unicodeBlockLookup.Katakana(e))}_tinySDF(e,n,h){let d=this.localIdeographFontFamily;if(!d||!this._doesCharSupportLocalGlyph(h))return;let g=e.tinySDF;if(!g){let w="400";/bold/i.test(n)?w="900":/medium/i.test(n)?w="500":/light/i.test(n)&&(w="200"),g=e.tinySDF=new Ge.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:d,fontWeight:w})}let v=g.draw(String.fromCharCode(h));return{id:h,bitmap:new a.AlphaImage({width:v.width||30,height:v.height||30},v.data),metrics:{width:v.glyphWidth||24,height:v.glyphHeight||24,left:v.glyphLeft||0,top:v.glyphTop-27||-8,advance:v.glyphAdvance||24}}}}Ge.loadGlyphRange=function(p,e,n,h,d){let g=256*e,v=g+255,w=h.transformRequest(n.replace("{fontstack}",p).replace("{range}",`${g}-${v}`),a.ResourceType.Glyphs);a.getArrayBuffer(w,(M,C)=>{if(M)d(M);else if(C){let k={};for(let F of a.parseGlyphPBF(C))k[F.id]=F;d(null,k)}})},Ge.TinySDF=class{constructor({fontSize:p=24,buffer:e=3,radius:n=8,cutoff:h=.25,fontFamily:d="sans-serif",fontWeight:g="normal",fontStyle:v="normal"}={}){this.buffer=e,this.cutoff=h,this.radius=n;let w=this.size=p+4*e,M=this._createCanvas(w),C=this.ctx=M.getContext("2d",{willReadFrequently:!0});C.font=`${v} ${g} ${p}px ${d}`,C.textBaseline="alphabetic",C.textAlign="left",C.fillStyle="black",this.gridOuter=new Float64Array(w*w),this.gridInner=new Float64Array(w*w),this.f=new Float64Array(w),this.z=new Float64Array(w+1),this.v=new Uint16Array(w)}_createCanvas(p){let e=document.createElement("canvas");return e.width=e.height=p,e}draw(p){let{width:e,actualBoundingBoxAscent:n,actualBoundingBoxDescent:h,actualBoundingBoxLeft:d,actualBoundingBoxRight:g}=this.ctx.measureText(p),v=Math.ceil(n),w=Math.min(this.size-this.buffer,Math.ceil(g-d)),M=Math.min(this.size-this.buffer,v+Math.ceil(h)),C=w+2*this.buffer,k=M+2*this.buffer,F=Math.max(C*k,0),q=new Uint8ClampedArray(F),Q={data:q,width:C,height:k,glyphWidth:w,glyphHeight:M,glyphTop:v,glyphLeft:0,glyphAdvance:e};if(w===0||M===0)return Q;let{ctx:j,buffer:J,gridInner:lt,gridOuter:ht}=this;j.clearRect(J,J,w,M),j.fillText(p,J,J+v);let mt=j.getImageData(J,J,w,M);ht.fill(Ee,0,F),lt.fill(0,0,F);for(let ut=0;ut<M;ut++)for(let At=0;At<w;At++){let Mt=mt.data[4*(ut*w+At)+3]/255;if(Mt===0)continue;let Tt=(ut+J)*C+At+J;if(Mt===1)ht[Tt]=0,lt[Tt]=Ee;else{let Ft=.5-Mt;ht[Tt]=Ft>0?Ft*Ft:0,lt[Tt]=Ft<0?Ft*Ft:0}}ve(ht,0,0,C,k,C,this.f,this.v,this.z),ve(lt,J,J,w,M,C,this.f,this.v,this.z);for(let ut=0;ut<F;ut++){let At=Math.sqrt(ht[ut])-Math.sqrt(lt[ut]);q[ut]=Math.round(255-255*(At/this.radius+this.cutoff))}return Q}};let Ne=new a.Properties({anchor:new a.DataConstantProperty(a.spec.light.anchor),position:new class{constructor(){this.specification=a.spec.light.position}possiblyEvaluate(p,e){return a.sphericalToCartesian(p.expression.evaluate(e))}interpolate(p,e,n){return{x:a.number(p.x,e.x,n),y:a.number(p.y,e.y,n),z:a.number(p.z,e.z,n)}}},color:new a.DataConstantProperty(a.spec.light.color),intensity:new a.DataConstantProperty(a.spec.light.intensity)}),di="-transition";class Ri extends a.Evented{constructor(e){super(),this._transitionable=new a.Transitionable(Ne),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,n={}){if(!this._validate(a.validateLight,e,n))for(let h in e){let d=e[h];h.endsWith(di)?this._transitionable.setTransition(h.slice(0,-di.length),d):this._transitionable.setValue(h,d)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,h){return(!h||h.validate!==!1)&&a.emitValidationErrors(this,e.call(a.validateStyle,a.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:a.spec})))}}class Yi{constructor(e,n){this.width=e,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,n){let h=e.join(",")+String(n);return this.dashEntry[h]||(this.dashEntry[h]=this.addDash(e,n)),this.dashEntry[h]}getDashRanges(e,n,h){let d=[],g=e.length%2==1?-e[e.length-1]*h:0,v=e[0]*h,w=!0;d.push({left:g,right:v,isDash:w,zeroLength:e[0]===0});let M=e[0];for(let C=1;C<e.length;C++){w=!w;let k=e[C];g=M*h,M+=k,v=M*h,d.push({left:g,right:v,isDash:w,zeroLength:k===0})}return d}addRoundDash(e,n,h){let d=n/2;for(let g=-h;g<=h;g++){let v=this.width*(this.nextRow+h+g),w=0,M=e[w];for(let C=0;C<this.width;C++){C/M.right>1&&(M=e[++w]);let k=Math.abs(C-M.left),F=Math.abs(C-M.right),q=Math.min(k,F),Q,j=g/h*(d+1);if(M.isDash){let J=d-Math.abs(j);Q=Math.sqrt(q*q+J*J)}else Q=d-Math.sqrt(q*q+j*j);this.data[v+C]=Math.max(0,Math.min(255,Q+128))}}}addRegularDash(e){for(let w=e.length-1;w>=0;--w){let M=e[w],C=e[w+1];M.zeroLength?e.splice(w,1):C&&C.isDash===M.isDash&&(C.left=M.left,e.splice(w,1))}let n=e[0],h=e[e.length-1];n.isDash===h.isDash&&(n.left=h.left-this.width,h.right=n.right+this.width);let d=this.width*this.nextRow,g=0,v=e[g];for(let w=0;w<this.width;w++){w/v.right>1&&(v=e[++g]);let M=Math.abs(w-v.left),C=Math.abs(w-v.right),k=Math.min(M,C);this.data[d+w]=Math.max(0,Math.min(255,(v.isDash?k:-k)+128))}}addDash(e,n){let h=n?7:0,d=2*h+1;if(this.nextRow+d>this.height)return a.warnOnce("LineAtlas out of space"),null;let g=0;for(let w=0;w<e.length;w++)g+=e[w];if(g!==0){let w=this.width/g,M=this.getDashRanges(e,this.width,w);n?this.addRoundDash(M,w,h):this.addRegularDash(M)}let v={y:(this.nextRow+h+.5)/this.height,height:2*h/this.height,width:g};return this.nextRow+=d,this.dirty=!0,v}bind(e){let n=e.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}class Bi{constructor(e,n){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=a.uniqueId();let h=this.workerPool.acquire(this.id);for(let d=0;d<h.length;d++){let g=new Bi.Actor(h[d],n,this.id);g.name=`Worker ${d}`,this.actors.push(g)}}broadcast(e,n,h){a.asyncAll(this.actors,(d,g)=>{d.send(e,n,g)},h=h||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}function Vr(p,e,n){let h=function(d,g){if(d)return n(d);if(g){let v=a.pick(a.extend(g,p),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);g.vector_layers&&(v.vectorLayers=g.vector_layers,v.vectorLayerIds=v.vectorLayers.map(w=>w.id)),n(null,v)}};return p.url?a.getJSON(e.transformRequest(p.url,a.ResourceType.Source),h):a.exported.frame(()=>h(null,p))}Bi.Actor=a.Actor;class ye{constructor(e,n,h){this.bounds=a.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=n||0,this.maxzoom=h||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let n=Math.pow(2,e.z),h=Math.floor(a.mercatorXfromLng(this.bounds.getWest())*n),d=Math.floor(a.mercatorYfromLat(this.bounds.getNorth())*n),g=Math.ceil(a.mercatorXfromLng(this.bounds.getEast())*n),v=Math.ceil(a.mercatorYfromLat(this.bounds.getSouth())*n);return e.x>=h&&e.x<g&&e.y>=d&&e.y<v}}class Pr extends a.Evented{constructor(e,n,h,d){if(super(),this.id=e,this.dispatcher=h,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,a.extend(this,a.pick(n,["url","scheme","tileSize","promoteId"])),this._options=a.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d)}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Vr(this._options,this.map._requestManager,(e,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new a.ErrorEvent(e)):n&&(a.extend(this,n),n.bounds&&(this.tileBounds=new ye(n.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.cancel(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}loadTile(e,n){let h=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),d={request:this.map._requestManager.transformRequest(h,a.ResourceType.Tile),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function g(v,w){return delete e.request,e.aborted?n(null):v&&v.status!==404?n(v):(w&&w.resourceTiming&&(e.resourceTiming=w.resourceTiming),this.map._refreshExpiredTiles&&w&&e.setExpiryData(w),e.loadVectorData(w,this.map.painter),a.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}d.request.collectResourceTiming=this._collectResourceTiming,e.actor&&e.state!=="expired"?e.state==="loading"?e.reloadCallback=n:e.request=e.actor.send("reloadTile",d,g.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",d,g.bind(this)))}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id},void 0)}unloadTile(e){e.unloadVectorData(),e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class Gr extends a.Evented{constructor(e,n,h,d){super(),this.id=e,this.dispatcher=h,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=a.extend({type:"raster"},n),a.extend(this,a.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Vr(this._options,this.map._requestManager,(e,n)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new a.ErrorEvent(e)):n&&(a.extend(this,n),n.bounds&&(this.tileBounds=new ye(n.bounds,this.minzoom,this.maxzoom)),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return a.extend({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,n){let h=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.request=a.getImage(this.map._requestManager.transformRequest(h,a.ResourceType.Tile),(d,g,v)=>{if(delete e.request,e.aborted)e.state="unloaded",n(null);else if(d)e.state="errored",n(d);else if(g){this.map._refreshExpiredTiles&&e.setExpiryData(v);let w=this.map.painter.context,M=w.gl;e.texture=this.map.painter.getTileTexture(g.width),e.texture?e.texture.update(g,{useMipmap:!0}):(e.texture=new Nt(w,g,M.RGBA,{useMipmap:!0}),e.texture.bind(M.LINEAR,M.CLAMP_TO_EDGE,M.LINEAR_MIPMAP_NEAREST),w.extTextureFilterAnisotropic&&M.texParameterf(M.TEXTURE_2D,w.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,w.extTextureFilterAnisotropicMax)),e.state="loaded",a.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(e,n){e.request&&(e.request.cancel(),delete e.request),n()}unloadTile(e,n){e.texture&&this.map.painter.saveTileTexture(e.texture),n()}hasTransition(){return!1}}let Qr;class _i extends Gr{constructor(e,n,h,d){super(e,n,h,d),this.type="raster-dem",this.maxzoom=22,this._options=a.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(e,n){let h=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function d(g,v){g&&(e.state="errored",n(g)),v&&(e.dem=v,e.needsHillshadePrepare=!0,e.state="loaded",n(null))}e.request=a.getImage(this.map._requestManager.transformRequest(h,a.ResourceType.Tile),function(g,v){if(delete e.request,e.aborted)e.state="unloaded",n(null);else if(g)e.state="errored",n(g);else if(v){this.map._refreshExpiredTiles&&e.setExpiryData(v),delete v.cacheControl,delete v.expires;let w=a.isImageBitmap(v)&&(Qr==null&&(Qr=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Qr)?v:a.exported.getImageData(v,1),M={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:w,encoding:this.encoding};e.actor&&e.state!=="expired"||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",M,d.bind(this)))}}.bind(this)),e.neighboringTiles=this._getNeighboringTiles(e.tileID)}_getNeighboringTiles(e){let n=e.canonical,h=Math.pow(2,n.z),d=(n.x-1+h)%h,g=n.x===0?e.wrap-1:e.wrap,v=(n.x+1+h)%h,w=n.x+1===h?e.wrap+1:e.wrap,M={};return M[new a.OverscaledTileID(e.overscaledZ,g,n.z,d,n.y).key]={backfilled:!1},M[new a.OverscaledTileID(e.overscaledZ,w,n.z,v,n.y).key]={backfilled:!1},n.y>0&&(M[new a.OverscaledTileID(e.overscaledZ,g,n.z,d,n.y-1).key]={backfilled:!1},M[new a.OverscaledTileID(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},M[new a.OverscaledTileID(e.overscaledZ,w,n.z,v,n.y-1).key]={backfilled:!1}),n.y+1<h&&(M[new a.OverscaledTileID(e.overscaledZ,g,n.z,d,n.y+1).key]={backfilled:!1},M[new a.OverscaledTileID(e.overscaledZ,e.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},M[new a.OverscaledTileID(e.overscaledZ,w,n.z,v,n.y+1).key]={backfilled:!1}),M}unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&e.actor.send("removeDEMTile",{uid:e.uid,source:this.id})}}class dn extends a.Evented{constructor(e,n,h,d){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=h.getActor(),this.setEventedParent(d),this._data=n.data,this._options=a.extend({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;let g=a.EXTENT/this.tileSize;this.workerOptions=a.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*g,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*g,extent:a.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:a.EXTENT,radius:(n.clusterRadius||50)*g,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData("content"),this}getClusterExpansionZoom(e,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id},n),this}getClusterChildren(e,n){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id},n),this}getClusterLeaves(e,n,h,d){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:e,limit:n,offset:h},d),this}_updateWorkerData(e){let n=a.extend({},this.workerOptions),h=this._data;typeof h=="string"?(n.request=this.map._requestManager.transformRequest(a.exported.resolveURL(h),a.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(h),this._pendingLoads++,this.fire(new a.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(d,g)=>{if(this._pendingLoads--,this._removed||g&&g.abandoned)return;let v=null;if(g&&g.resourceTiming&&g.resourceTiming[this.id]&&(v=g.resourceTiming[this.id].slice(0)),this.actor.send(`${this.type}.coalesce`,{source:n.source},null),d)return void this.fire(new a.ErrorEvent(d));let w={dataType:"source",sourceDataType:e};this._collectResourceTiming&&v&&v.length>0&&a.extend(w,{resourceTiming:v}),this.fire(new a.Event("data",w))})}loaded(){return this._pendingLoads===0}loadTile(e,n){let h=e.actor?"reloadTile":"loadTile";e.actor=this.actor;let d={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.request=this.actor.send(h,d,(g,v)=>(delete e.request,e.unloadVectorData(),e.aborted?n(null):g?n(g):(e.loadVectorData(v,this.map.painter,h==="reloadTile"),n(null))))}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e){e.unloadVectorData(),this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return a.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var zr=a.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class kr extends a.Evented{constructor(e,n,h,d){super(),this.id=e,this.dispatcher=h,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(d),this.options=n}load(e,n){this._loaded=!1,this.fire(new a.Event("dataloading",{dataType:"source"})),this.url=this.options.url,a.getImage(this.map._requestManager.transformRequest(this.url,a.ResourceType.Image),(h,d)=>{this._loaded=!0,h?this.fire(new a.ErrorEvent(h)):d&&(this.image=d,e&&(this.coordinates=e),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return this.image&&e.url?(this.options.url=e.url,this.load(e.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}setCoordinates(e){this.coordinates=e;let n=e.map(a.MercatorCoordinate.fromLngLat);this.tileID=function(d){let g=1/0,v=1/0,w=-1/0,M=-1/0;for(let q of d)g=Math.min(g,q.x),v=Math.min(v,q.y),w=Math.max(w,q.x),M=Math.max(M,q.y);let C=Math.max(w-g,M-v),k=Math.max(0,Math.floor(-Math.log(C)/Math.LN2)),F=Math.pow(2,k);return new a.CanonicalTileID(k,Math.floor((g+w)/2*F),Math.floor((v+M)/2*F))}(n),this.minzoom=this.maxzoom=this.tileID.z;let h=n.map(d=>this.tileID.getTilePoint(d)._round());return this._boundsArray=new a.RasterBoundsArray,this._boundsArray.emplaceBack(h[0].x,h[0].y,0,0),this._boundsArray.emplaceBack(h[1].x,h[1].y,a.EXTENT,0),this._boundsArray.emplaceBack(h[3].x,h[3].y,0,a.EXTENT),this._boundsArray.emplaceBack(h[2].x,h[2].y,a.EXTENT,a.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new a.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,zr.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Nt(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(let h in this.tiles){let d=this.tiles[h];d.state!=="loaded"&&(d.state="loaded",d.texture=this.texture)}}loadTile(e,n){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},n(null)):(e.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class tn extends kr{constructor(e,n,h,d){super(e,n,h,d),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;let e=this.options;this.urls=[];for(let n of e.urls)this.urls.push(this.map._requestManager.transformRequest(n,a.ResourceType.Source).url);a.getVideo(this.urls,(n,h)=>{this._loaded=!0,n?this.fire(new a.ErrorEvent(n)):h&&(this.video=h,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let n=this.video.seekable;e<n.start(0)||e>n.end(0)?this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,n=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,zr.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new Nt(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(let h in this.tiles){let d=this.tiles[h];d.state!=="loaded"&&(d.state="loaded",d.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class en extends kr{constructor(e,n,h,d){super(e,n,h,d),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(g=>!Array.isArray(g)||g.length!==2||g.some(v=>typeof v!="number"))||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${e}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new a.ErrorEvent(new a.ValidationError(`sources.${e}`,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 a.ErrorEvent(new a.ValidationError(`sources.${e}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.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())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let n=this.map.painter.context,h=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,zr.members)),this.boundsSegments||(this.boundsSegments=a.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Nt(n,this.canvas,h.RGBA,{premultiply:!0});for(let d in this.tiles){let g=this.tiles[d];g.state!=="loaded"&&(g.state="loaded",g.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}let gr={vector:Pr,raster:Gr,"raster-dem":_i,geojson:dn,video:tn,image:kr,canvas:en};function Lr(p,e){let n=a.create();return a.translate(n,n,[1,1,0]),a.scale(n,n,[.5*p.width,.5*p.height,1]),a.multiply(n,n,p.calculatePosMatrix(e.toUnwrapped()))}function qr(p,e,n,h,d,g){let v=function(F,q,Q){if(F)for(let j of F){let J=q[j];if(J&&J.source===Q&&J.type==="fill-extrusion")return!0}else for(let j in q){let J=q[j];if(J.source===Q&&J.type==="fill-extrusion")return!0}return!1}(d&&d.layers,e,p.id),w=g.maxPitchScaleFactor(),M=p.tilesIn(h,w,v);M.sort(Sn);let C=[];for(let F of M)C.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(e,n,p._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,d,g,w,Lr(p.transform,F.tileID))});let k=function(F){let q={},Q={};for(let j of F){let J=j.queryResults,lt=j.wrappedTileID,ht=Q[lt]=Q[lt]||{};for(let mt in J){let ut=J[mt],At=ht[mt]=ht[mt]||{},Mt=q[mt]=q[mt]||[];for(let Tt of ut)At[Tt.featureIndex]||(At[Tt.featureIndex]=!0,Mt.push(Tt))}}return q}(C);for(let F in k)k[F].forEach(q=>{let Q=q.feature,j=p.getFeatureState(Q.layer["source-layer"],Q.id);Q.source=Q.layer.source,Q.layer["source-layer"]&&(Q.sourceLayer=Q.layer["source-layer"]),Q.state=j});return k}function Sn(p,e){let n=p.tileID,h=e.tileID;return n.overscaledZ-h.overscaledZ||n.canonical.y-h.canonical.y||n.wrap-h.wrap||n.canonical.x-h.canonical.x}class Ln{constructor(e,n){this.tileID=e,this.uid=a.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){let n=e+this.timeAdded;n<a.exported.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}loadVectorData(e,n,h){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(d,g){let v={};if(!g)return v;for(let w of d){let M=w.layerIds.map(C=>g.getLayer(C)).filter(Boolean);if(M.length!==0){w.layers=M,w.stateDependentLayerIds&&(w.stateDependentLayers=w.stateDependentLayerIds.map(C=>M.filter(k=>k.id===C)[0]));for(let C of M)v[C.id]=w}}return v}(e.buckets,n.style),this.hasSymbolBuckets=!1;for(let d in this.buckets){let g=this.buckets[d];if(g instanceof a.SymbolBucket){if(this.hasSymbolBuckets=!0,!h)break;g.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let d in this.buckets){let g=this.buckets[d];if(g instanceof a.SymbolBucket&&g.hasRTLText){this.hasRTLText=!0,a.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(let d in this.buckets){let g=this.buckets[d];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(d).queryRadius(g))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new a.CollisionBoxArray}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let h in this.buckets){let d=this.buckets[h];d.uploadPending()&&d.upload(e)}let n=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Nt(e,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Nt(e,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,n,h,d,g,v,w,M,C,k){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:d,cameraQueryGeometry:g,scale:v,tileSize:this.tileSize,pixelPosMatrix:k,transform:M,params:w,queryPadding:this.queryPadding*C},e,n,h):{}}querySourceFeatures(e,n){let h=this.latestFeatureIndex;if(!h||!h.rawTileData)return;let d=h.loadVTLayers(),g=n?n.sourceLayer:"",v=d._geojsonTileLayer||d[g];if(!v)return;let w=a.createFilter(n&&n.filter),{z:M,x:C,y:k}=this.tileID.canonical,F={z:M,x:C,y:k};for(let q=0;q<v.length;q++){let Q=v.feature(q);if(w.needGeometry){let lt=a.toEvaluationFeature(Q,!0);if(!w.filter(new a.EvaluationParameters(this.tileID.overscaledZ),lt,this.tileID.canonical))continue}else if(!w.filter(new a.EvaluationParameters(this.tileID.overscaledZ),Q))continue;let j=h.getId(Q,g),J=new a.GeoJSONFeature(Q,M,C,k,j);J.tile=F,e.push(J)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let n=this.expirationTime;if(e.cacheControl){let h=a.parseCacheControl(e.cacheControl);h["max-age"]&&(this.expirationTime=Date.now()+1e3*h["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let h=Date.now(),d=!1;if(this.expirationTime>h)d=!1;else if(n)if(this.expirationTime<n)d=!0;else{let g=this.expirationTime-n;g?this.expirationTime=h+Math.max(g,3e4):d=!0}else d=!0;d?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;let h=this.latestFeatureIndex.loadVTLayers();for(let d in this.buckets){if(!n.style.hasLayer(d))continue;let g=this.buckets[d],v=g.layers[0].sourceLayer||"_geojsonTileLayer",w=h[v],M=e[v];if(!w||!M||Object.keys(M).length===0)continue;g.update(M,w,this.imageAtlas&&this.imageAtlas.patternPositions||{});let C=n&&n.style&&n.style.getLayer(d);C&&(this.queryPadding=Math.max(this.queryPadding,C.queryRadius(g)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<a.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=a.exported.now()+e}setDependencies(e,n){let h={};for(let d of n)h[d]=!0;this.dependencies[e]=h}hasDependency(e,n){for(let h of e){let d=this.dependencies[h];if(d){for(let g of n)if(d[g])return!0}}return!1}}class Dn{constructor(e,n){this.max=e,this.onRemove=n,this.reset()}reset(){for(let e in this.data)for(let n of this.data[e])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(e,n,h){let d=e.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);let g={value:n,timeout:void 0};if(h!==void 0&&(g.timeout=setTimeout(()=>{this.remove(e,g)},h)),this.data[d].push(g),this.order.push(d),this.order.length>this.max){let v=this._getAndRemoveByKey(this.order[0]);v&&this.onRemove(v)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let n=this.data[e].shift();return n.timeout&&clearTimeout(n.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),n.value}getByKey(e){let n=this.data[e];return n?n[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,n){if(!this.has(e))return this;let h=e.wrapped().key,d=n===void 0?0:this.data[h].indexOf(n),g=this.data[h][d];return this.data[h].splice(d,1),g.timeout&&clearTimeout(g.timeout),this.data[h].length===0&&delete this.data[h],this.onRemove(g.value),this.order.splice(this.order.indexOf(h),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(e){let n=[];for(let h in this.data)for(let d of this.data[h])e(d.value)||n.push(d);for(let h of n)this.remove(h.value.tileID,h)}}class cs{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,n,h){let d=String(n);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][d]=this.stateChanges[e][d]||{},a.extend(this.stateChanges[e][d],h),this.deletedStates[e]===null){this.deletedStates[e]={};for(let g in this.state[e])g!==d&&(this.deletedStates[e][g]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][d]===null){this.deletedStates[e][d]={};for(let g in this.state[e][d])h[g]||(this.deletedStates[e][d][g]=null)}else for(let g in h)this.deletedStates[e]&&this.deletedStates[e][d]&&this.deletedStates[e][d][g]===null&&delete this.deletedStates[e][d][g]}removeFeatureState(e,n,h){if(this.deletedStates[e]===null)return;let d=String(n);if(this.deletedStates[e]=this.deletedStates[e]||{},h&&n!==void 0)this.deletedStates[e][d]!==null&&(this.deletedStates[e][d]=this.deletedStates[e][d]||{},this.deletedStates[e][d][h]=null);else if(n!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][d])for(h in this.deletedStates[e][d]={},this.stateChanges[e][d])this.deletedStates[e][d][h]=null;else this.deletedStates[e][d]=null;else this.deletedStates[e]=null}getState(e,n){let h=String(n),d=a.extend({},(this.state[e]||{})[h],(this.stateChanges[e]||{})[h]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let g=this.deletedStates[e][n];if(g===null)return{};for(let v in g)delete d[v]}return d}initializeTileState(e,n){e.setFeatureState(this.state,n)}coalesceChanges(e,n){let h={};for(let d in this.stateChanges){this.state[d]=this.state[d]||{};let g={};for(let v in this.stateChanges[d])this.state[d][v]||(this.state[d][v]={}),a.extend(this.state[d][v],this.stateChanges[d][v]),g[v]=this.state[d][v];h[d]=g}for(let d in this.deletedStates){this.state[d]=this.state[d]||{};let g={};if(this.deletedStates[d]===null)for(let v in this.state[d])g[v]={},this.state[d][v]={};else for(let v in this.deletedStates[d]){if(this.deletedStates[d][v]===null)this.state[d][v]={};else for(let w of Object.keys(this.deletedStates[d][v]))delete this.state[d][v][w];g[v]=this.state[d][v]}h[d]=h[d]||{},a.extend(h[d],g)}if(this.stateChanges={},this.deletedStates={},Object.keys(h).length!==0)for(let d in e)e[d].setFeatureState(h,n)}}class Je extends a.Evented{constructor(e,n,h){super(),this.id=e,this.dispatcher=h,this.on("data",d=>{d.dataType==="source"&&d.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&d.dataType==="source"&&d.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(d,g,v,w){let M=new gr[g.type](d,g,v,w);if(M.id!==d)throw new Error(`Expected Source id to be ${d} instead of ${M.id}`);return a.bindAll(["load","abort","unload","serialize","prepare"],M),M}(e,n,h,this),this._tiles={},this._cache=new Dn(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new cs}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(let e in this._tiles){let n=this._tiles[e];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,n){return this._source.loadTile(e,n)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,()=>{})}_abortTile(e){this._source.abortTile&&this._source.abortTile(e,()=>{}),this._source.fire(new a.Event("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let n in this._tiles){let h=this._tiles[n];h.upload(e),h.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(rn).map(e=>e.key)}getRenderableIds(e){let n=[];for(let h in this._tiles)this._isIdRenderable(h,e)&&n.push(this._tiles[h]);return e?n.sort((h,d)=>{let g=h.tileID,v=d.tileID,w=new a.pointGeometry(g.canonical.x,g.canonical.y)._rotate(this.transform.angle),M=new a.pointGeometry(v.canonical.x,v.canonical.y)._rotate(this.transform.angle);return g.overscaledZ-v.overscaledZ||M.y-w.y||M.x-w.x}).map(h=>h.tileID.key):n.map(h=>h.tileID).sort(rn).map(h=>h.key)}hasRenderableParent(e){let n=this.findLoadedParent(e,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(e,n){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(n||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}}_reloadTile(e,n){let h=this._tiles[e];h&&(h.state!=="loading"&&(h.state=n),this._loadTile(h,this._tileLoaded.bind(this,h,e,n)))}_tileLoaded(e,n,h,d){if(d)return e.state="errored",void(d.status!==404?this._source.fire(new a.ErrorEvent(d,{tile:e})):this.update(this.transform));e.timeAdded=a.exported.now(),h==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new a.Event("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let n=this.getRenderableIds();for(let d=0;d<n.length;d++){let g=n[d];if(e.neighboringTiles&&e.neighboringTiles[g]){let v=this.getTileByID(g);h(e,v),h(v,e)}}function h(d,g){d.needsHillshadePrepare=!0;let v=g.tileID.canonical.x-d.tileID.canonical.x,w=g.tileID.canonical.y-d.tileID.canonical.y,M=Math.pow(2,d.tileID.canonical.z),C=g.tileID.key;v===0&&w===0||Math.abs(w)>1||(Math.abs(v)>1&&(Math.abs(v+M)===1?v+=M:Math.abs(v-M)===1&&(v-=M)),g.dem&&d.dem&&(d.dem.backfillBorder(g.dem,v,w),d.neighboringTiles&&d.neighboringTiles[C]&&(d.neighboringTiles[C].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,n,h,d){for(let g in this._tiles){let v=this._tiles[g];if(d[g]||!v.hasData()||v.tileID.overscaledZ<=n||v.tileID.overscaledZ>h)continue;let w=v.tileID;for(;v&&v.tileID.overscaledZ>n+1;){let C=v.tileID.scaledTo(v.tileID.overscaledZ-1);v=this._tiles[C.key],v&&v.hasData()&&(w=C)}let M=w;for(;M.overscaledZ>n;)if(M=M.scaledTo(M.overscaledZ-1),e[M.key]){d[w.key]=w;break}}}findLoadedParent(e,n){if(e.key in this._loadedParentTiles){let h=this._loadedParentTiles[e.key];return h&&h.tileID.overscaledZ>=n?h:null}for(let h=e.overscaledZ-1;h>=n;h--){let d=e.scaledTo(h),g=this._getLoadedTile(d);if(g)return g}}_getLoadedTile(e){let n=this._tiles[e.key];return n&&n.hasData()?n:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let n=Math.ceil(e.width/this._source.tileSize)+1,h=Math.ceil(e.height/this._source.tileSize)+1,d=Math.floor(n*h*5),g=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,d):d;this._cache.setMaxSize(g)}handleWrapJump(e){let n=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,n){let h={};for(let d in this._tiles){let g=this._tiles[d];g.tileID=g.tileID.unwrapTo(g.tileID.wrap+n),h[g.tileID.key]=g}this._tiles=h;for(let d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(let d in this._tiles)this._setTileReloadTimer(d,this._tiles[d])}}update(e){if(this.transform=e,!this._sourceLoaded||this._paused)return;let n;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?n=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(M=>new a.OverscaledTileID(M.canonical.z,M.wrap,M.canonical.z,M.canonical.x,M.canonical.y)):(n=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(n=n.filter(M=>this._source.hasTile(M)))):n=[];let h=e.coveringZoomLevel(this._source),d=Math.max(h-Je.maxOverzooming,this._source.minzoom),g=Math.max(h+Je.maxUnderzooming,this._source.minzoom),v=this._updateRetainedTiles(n,h);if(Rn(this._source.type)){let M={},C={},k=Object.keys(v);for(let F of k){let q=v[F],Q=this._tiles[F];if(!Q||Q.fadeEndTime&&Q.fadeEndTime<=a.exported.now())continue;let j=this.findLoadedParent(q,d);j&&(this._addTile(j.tileID),M[j.tileID.key]=j.tileID),C[F]=q}this._retainLoadedChildren(C,h,g,v);for(let F in M)v[F]||(this._coveredTiles[F]=!0,v[F]=M[F])}for(let M in v)this._tiles[M].clearFadeHold();let w=a.keysDifference(this._tiles,v);for(let M of w){let C=this._tiles[M];C.hasSymbolBuckets&&!C.holdingForFade()?C.setHoldDuration(this.map._fadeDuration):C.hasSymbolBuckets&&!C.symbolFadeFinished()||this._removeTile(M)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,n){let h={},d={},g=Math.max(n-Je.maxOverzooming,this._source.minzoom),v=Math.max(n+Je.maxUnderzooming,this._source.minzoom),w={};for(let M of e){let C=this._addTile(M);h[M.key]=M,C.hasData()||n<this._source.maxzoom&&(w[M.key]=M)}this._retainLoadedChildren(w,n,v,h);for(let M of e){let C=this._tiles[M.key];if(C.hasData())continue;if(n+1>this._source.maxzoom){let F=M.children(this._source.maxzoom)[0],q=this.getTile(F);if(q&&q.hasData()){h[F.key]=F;continue}}else{let F=M.children(this._source.maxzoom);if(h[F[0].key]&&h[F[1].key]&&h[F[2].key]&&h[F[3].key])continue}let k=C.wasRequested();for(let F=M.overscaledZ-1;F>=g;--F){let q=M.scaledTo(F);if(d[q.key]||(d[q.key]=!0,C=this.getTile(q),!C&&k&&(C=this._addTile(q)),C&&(h[q.key]=q,k=C.wasRequested(),C.hasData())))break}}return h}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let n=[],h,d=this._tiles[e].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){h=this._loadedParentTiles[d.key];break}n.push(d.key);let g=d.scaledTo(d.overscaledZ-1);if(h=this._getLoadedTile(g),h)break;d=g}for(let g of n)this._loadedParentTiles[g]=h}}_addTile(e){let n=this._tiles[e.key];if(n)return n;n=this._cache.getAndRemove(e),n&&(this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,n)));let h=n;return n||(n=new Ln(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,e.key,n.state))),n.uses++,this._tiles[e.key]=n,h||this._source.fire(new a.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(e,n){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let h=n.getExpiryTimeout();h&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},h))}_removeTile(e){let n=this._tiles[e];n&&(n.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,n,h){let d=[],g=this.transform;if(!g)return d;let v=h?g.getCameraQueryGeometry(e):e,w=e.map(j=>g.pointCoordinate(j)),M=v.map(j=>g.pointCoordinate(j)),C=this.getIds(),k=1/0,F=1/0,q=-1/0,Q=-1/0;for(let j of M)k=Math.min(k,j.x),F=Math.min(F,j.y),q=Math.max(q,j.x),Q=Math.max(Q,j.y);for(let j=0;j<C.length;j++){let J=this._tiles[C[j]];if(J.holdingForFade())continue;let lt=J.tileID,ht=Math.pow(2,g.zoom-J.tileID.overscaledZ),mt=n*J.queryPadding*a.EXTENT/J.tileSize/ht,ut=[lt.getTilePoint(new a.MercatorCoordinate(k,F)),lt.getTilePoint(new a.MercatorCoordinate(q,Q))];if(ut[0].x-mt<a.EXTENT&&ut[0].y-mt<a.EXTENT&&ut[1].x+mt>=0&&ut[1].y+mt>=0){let At=w.map(Tt=>lt.getTilePoint(Tt)),Mt=M.map(Tt=>lt.getTilePoint(Tt));d.push({tile:J,tileID:lt,queryGeometry:At,cameraQueryGeometry:Mt,scale:ht})}}return d}getVisibleCoordinates(e){let n=this.getRenderableIds(e).map(h=>this._tiles[h].tileID);for(let h of n)h.posMatrix=this.transform.calculatePosMatrix(h.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Rn(this._source.type))for(let e in this._tiles){let n=this._tiles[e];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=a.exported.now())return!0}return!1}setFeatureState(e,n,h){this._state.updateState(e=e||"_geojsonTileLayer",n,h)}removeFeatureState(e,n,h){this._state.removeFeatureState(e=e||"_geojsonTileLayer",n,h)}getFeatureState(e,n){return this._state.getState(e=e||"_geojsonTileLayer",n)}setDependencies(e,n,h){let d=this._tiles[e];d&&d.setDependencies(n,h)}reloadTilesForDependencies(e,n){for(let h in this._tiles)this._tiles[h].hasDependency(e,n)&&this._reloadTile(h,"reloading");this._cache.filter(h=>!h.hasDependency(e,n))}}function rn(p,e){let n=Math.abs(2*p.wrap)-+(p.wrap<0),h=Math.abs(2*e.wrap)-+(e.wrap<0);return p.overscaledZ-e.overscaledZ||h-n||e.canonical.y-p.canonical.y||e.canonical.x-p.canonical.x}function Rn(p){return p==="raster"||p==="image"||p==="video"}Je.maxOverzooming=10,Je.maxUnderzooming=3;let fn="mapboxgl_preloaded_worker_pool";class Dr{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Dr.workerCount;)this.workers.push(new Worker(sa.workerUrl));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[fn]}numActive(){return Object.keys(this.active).length}}let us=Math.floor(a.exported.hardwareConcurrency/2),ft;function N(){return ft||(ft=new Dr),ft}function R(p,e){let n={};for(let h in p)h!=="ref"&&(n[h]=p[h]);return a.refProperties.forEach(h=>{h in e&&(n[h]=e[h])}),n}function U(p){p=p.slice();let e=Object.create(null);for(let n=0;n<p.length;n++)e[p[n].id]=p[n];for(let n=0;n<p.length;n++)"ref"in p[n]&&(p[n]=R(p[n],e[p[n].ref]));return p}Dr.workerCount=Math.max(Math.min(us,6),1);let X={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 st(p,e,n){n.push({command:X.addSource,args:[p,e[p]]})}function xt(p,e,n){e.push({command:X.removeSource,args:[p]}),n[p]=!0}function Dt(p,e,n,h){xt(p,n,h),st(p,e,n)}function Ut(p,e,n){let h;for(h in p[n])if(Object.prototype.hasOwnProperty.call(p[n],h)&&h!=="data"&&!$(p[n][h],e[n][h]))return!1;for(h in e[n])if(Object.prototype.hasOwnProperty.call(e[n],h)&&h!=="data"&&!$(p[n][h],e[n][h]))return!1;return!0}function ct(p,e,n,h,d,g){let v;for(v in e=e||{},p=p||{})Object.prototype.hasOwnProperty.call(p,v)&&($(p[v],e[v])||n.push({command:g,args:[h,v,e[v],d]}));for(v in e)Object.prototype.hasOwnProperty.call(e,v)&&!Object.prototype.hasOwnProperty.call(p,v)&&($(p[v],e[v])||n.push({command:g,args:[h,v,e[v],d]}))}function Ct(p){return p.id}function Se(p,e){return p[e.id]=e,p}class Ie{constructor(e,n){this.reset(e,n)}reset(e,n){this.points=e||[],this._distances=[0];for(let h=1;h<this.points.length;h++)this._distances[h]=this._distances[h-1]+this.points[h].dist(this.points[h-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=a.clamp(e,0,1);let n=1,h=this._distances[n],d=e*this.paddedLength+this.padding;for(;h<d&&n<this._distances.length;)h=this._distances[++n];let g=n-1,v=this._distances[g],w=h-v,M=w>0?(d-v)/w:0;return this.points[g].mult(1-M).add(this.points[n].mult(M))}}function ae(p,e){let n=!0;return p==="always"||p!=="never"&&e!=="never"||(n=!1),n}class Oe{constructor(e,n,h){let d=this.boxCells=[],g=this.circleCells=[];this.xCellCount=Math.ceil(e/h),this.yCellCount=Math.ceil(n/h);for(let v=0;v<this.xCellCount*this.yCellCount;v++)d.push([]),g.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=n,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,n,h,d,g){this._forEachCell(n,h,d,g,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(n),this.bboxes.push(h),this.bboxes.push(d),this.bboxes.push(g)}insertCircle(e,n,h,d){this._forEachCell(n-d,h-d,n+d,h+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(n),this.circles.push(h),this.circles.push(d)}_insertBoxCell(e,n,h,d,g,v){this.boxCells[g].push(v)}_insertCircleCell(e,n,h,d,g,v){this.circleCells[g].push(v)}_query(e,n,h,d,g,v,w){if(h<0||e>this.width||d<0||n>this.height)return[];let M=[];if(e<=0&&n<=0&&this.width<=h&&this.height<=d){if(g)return[{key:null,x1:e,y1:n,x2:h,y2:d}];for(let C=0;C<this.boxKeys.length;C++)M.push({key:this.boxKeys[C],x1:this.bboxes[4*C],y1:this.bboxes[4*C+1],x2:this.bboxes[4*C+2],y2:this.bboxes[4*C+3]});for(let C=0;C<this.circleKeys.length;C++){let k=this.circles[3*C],F=this.circles[3*C+1],q=this.circles[3*C+2];M.push({key:this.circleKeys[C],x1:k-q,y1:F-q,x2:k+q,y2:F+q})}}else this._forEachCell(e,n,h,d,this._queryCell,M,{hitTest:g,overlapMode:v,seenUids:{box:{},circle:{}}},w);return M}query(e,n,h,d){return this._query(e,n,h,d,!1,null)}hitTest(e,n,h,d,g,v){return this._query(e,n,h,d,!0,g,v).length>0}hitTestCircle(e,n,h,d,g){let v=e-h,w=e+h,M=n-h,C=n+h;if(w<0||v>this.width||C<0||M>this.height)return!1;let k=[];return this._forEachCell(v,M,w,C,this._queryCellCircle,k,{hitTest:!0,overlapMode:d,circle:{x:e,y:n,radius:h},seenUids:{box:{},circle:{}}},g),k.length>0}_queryCell(e,n,h,d,g,v,w,M){let{seenUids:C,hitTest:k,overlapMode:F}=w,q=this.boxCells[g];if(q!==null){let j=this.bboxes;for(let J of q)if(!C.box[J]){C.box[J]=!0;let lt=4*J,ht=this.boxKeys[J];if(e<=j[lt+2]&&n<=j[lt+3]&&h>=j[lt+0]&&d>=j[lt+1]&&(!M||M(ht))&&(!k||!ae(F,ht.overlapMode))&&(v.push({key:ht,x1:j[lt],y1:j[lt+1],x2:j[lt+2],y2:j[lt+3]}),k))return!0}}let Q=this.circleCells[g];if(Q!==null){let j=this.circles;for(let J of Q)if(!C.circle[J]){C.circle[J]=!0;let lt=3*J,ht=this.circleKeys[J];if(this._circleAndRectCollide(j[lt],j[lt+1],j[lt+2],e,n,h,d)&&(!M||M(ht))&&(!k||!ae(F,ht.overlapMode))){let mt=j[lt],ut=j[lt+1],At=j[lt+2];if(v.push({key:ht,x1:mt-At,y1:ut-At,x2:mt+At,y2:ut+At}),k)return!0}}}return!1}_queryCellCircle(e,n,h,d,g,v,w,M){let{circle:C,seenUids:k,overlapMode:F}=w,q=this.boxCells[g];if(q!==null){let j=this.bboxes;for(let J of q)if(!k.box[J]){k.box[J]=!0;let lt=4*J,ht=this.boxKeys[J];if(this._circleAndRectCollide(C.x,C.y,C.radius,j[lt+0],j[lt+1],j[lt+2],j[lt+3])&&(!M||M(ht))&&!ae(F,ht.overlapMode))return v.push(!0),!0}}let Q=this.circleCells[g];if(Q!==null){let j=this.circles;for(let J of Q)if(!k.circle[J]){k.circle[J]=!0;let lt=3*J,ht=this.circleKeys[J];if(this._circlesCollide(j[lt],j[lt+1],j[lt+2],C.x,C.y,C.radius)&&(!M||M(ht))&&!ae(F,ht.overlapMode))return v.push(!0),!0}}}_forEachCell(e,n,h,d,g,v,w,M){let C=this._convertToXCellCoord(e),k=this._convertToYCellCoord(n),F=this._convertToXCellCoord(h),q=this._convertToYCellCoord(d);for(let Q=C;Q<=F;Q++)for(let j=k;j<=q;j++)if(g.call(this,e,n,h,d,this.xCellCount*j+Q,v,w,M))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,n,h,d,g,v){let w=d-e,M=g-n,C=h+v;return C*C>w*w+M*M}_circleAndRectCollide(e,n,h,d,g,v,w){let M=(v-d)/2,C=Math.abs(e-(d+M));if(C>M+h)return!1;let k=(w-g)/2,F=Math.abs(n-(g+k));if(F>k+h)return!1;if(C<=M||F<=k)return!0;let q=C-M,Q=F-k;return q*q+Q*Q<=h*h}}function Ce(p,e,n,h,d){let g=a.create();return e?(a.scale(g,g,[1/d,1/d,1]),n||a.rotateZ(g,g,h.angle)):a.multiply(g,h.labelPlaneMatrix,p),g}function Qe(p,e,n,h,d){if(e){let g=a.clone(p);return a.scale(g,g,[d,d,1]),n||a.rotateZ(g,g,-h.angle),g}return h.glCoordMatrix}function Pe(p,e){let n=[p.x,p.y,0,1];Ze(n,n,e);let h=n[3];return{point:new a.pointGeometry(n[0]/h,n[1]/h),signedDistanceFromCamera:h}}function Vt(p,e){return .5+p/e*.5}function ge(p,e){let n=p[0]/p[3],h=p[1]/p[3];return n>=-e[0]&&n<=e[0]&&h>=-e[1]&&h<=e[1]}function he(p,e,n,h,d,g,v,w,M){let C=h?p.textSizeData:p.iconSizeData,k=a.evaluateSizeForZoom(C,n.transform.zoom),F=[256/n.width*2+1,256/n.height*2+1],q=h?p.text.dynamicLayoutVertexArray:p.icon.dynamicLayoutVertexArray;q.clear();let Q=p.lineVertexArray,j=h?p.text.placedSymbolArray:p.icon.placedSymbolArray,J=n.transform.width/n.transform.height,lt=!1;for(let ht=0;ht<j.length;ht++){let mt=j.get(ht);if(mt.hidden||mt.writingMode===a.WritingMode.vertical&&!lt){ri(mt.numGlyphs,q);continue}lt=!1;let ut=[mt.anchorX,mt.anchorY,0,1];if(a.transformMat4(ut,ut,e),!ge(ut,F)){ri(mt.numGlyphs,q);continue}let At=Vt(n.transform.cameraToCenterDistance,ut[3]),Mt=a.evaluateSizeForFeature(C,k,mt),Tt=v?Mt/At:Mt*At,Ft=new a.pointGeometry(mt.anchorX,mt.anchorY),jt=Pe(Ft,d).point,It={},ie=_e(mt,Tt,!1,w,e,d,g,p.glyphOffsetArray,Q,q,jt,Ft,It,J,M);lt=ie.useVertical,(ie.notEnoughRoom||lt||ie.needsFlipping&&_e(mt,Tt,!0,w,e,d,g,p.glyphOffsetArray,Q,q,jt,Ft,It,J,M).notEnoughRoom)&&ri(mt.numGlyphs,q)}h?p.text.dynamicLayoutVertexBuffer.updateData(q):p.icon.dynamicLayoutVertexBuffer.updateData(q)}function ai(p,e,n,h,d,g,v,w,M,C,k,F){let q=w.glyphStartIndex+w.numGlyphs,Q=w.lineStartIndex,j=w.lineStartIndex+w.lineLength,J=e.getoffsetX(w.glyphStartIndex),lt=e.getoffsetX(q-1),ht=mi(p*J,n,h,d,g,v,w.segment,Q,j,M,C,k,F);if(!ht)return null;let mt=mi(p*lt,n,h,d,g,v,w.segment,Q,j,M,C,k,F);return mt?{first:ht,last:mt}:null}function $i(p,e,n,h){return p===a.WritingMode.horizontal&&Math.abs(n.y-e.y)>Math.abs(n.x-e.x)*h?{useVertical:!0}:(p===a.WritingMode.vertical?e.y<n.y:e.x>n.x)?{needsFlipping:!0}:null}function _e(p,e,n,h,d,g,v,w,M,C,k,F,q,Q,j){let J=e/24,lt=p.lineOffsetX*J,ht=p.lineOffsetY*J,mt;if(p.numGlyphs>1){let ut=p.glyphStartIndex+p.numGlyphs,At=p.lineStartIndex,Mt=p.lineStartIndex+p.lineLength,Tt=ai(J,w,lt,ht,n,k,F,p,M,g,q,j);if(!Tt)return{notEnoughRoom:!0};let Ft=Pe(Tt.first.point,v).point,jt=Pe(Tt.last.point,v).point;if(h&&!n){let It=$i(p.writingMode,Ft,jt,Q);if(It)return It}mt=[Tt.first];for(let It=p.glyphStartIndex+1;It<ut-1;It++)mt.push(mi(J*w.getoffsetX(It),lt,ht,n,k,F,p.segment,At,Mt,M,g,q,j));mt.push(Tt.last)}else{if(h&&!n){let At=Pe(F,d).point,Mt=p.lineStartIndex+p.segment+1,Tt=new a.pointGeometry(M.getx(Mt),M.gety(Mt)),Ft=Pe(Tt,d),jt=Ft.signedDistanceFromCamera>0?Ft.point:ir(F,Tt,At,1,d),It=$i(p.writingMode,At,jt,Q);if(It)return It}let ut=mi(J*w.getoffsetX(p.glyphStartIndex),lt,ht,n,k,F,p.segment,p.lineStartIndex,p.lineStartIndex+p.lineLength,M,g,q,j);if(!ut)return{notEnoughRoom:!0};mt=[ut]}for(let ut of mt)a.addDynamicAttributes(C,ut.point,ut.angle);return{}}function ir(p,e,n,h,d){let g=Pe(p.add(p.sub(e)._unit()),d).point,v=n.sub(g);return n.add(v._mult(h/v.mag()))}function mi(p,e,n,h,d,g,v,w,M,C,k,F,q){let Q=h?p-e:p+e,j=Q>0?1:-1,J=0;h&&(j*=-1,J=Math.PI),j<0&&(J+=Math.PI);let lt=j>0?w+v:w+v+1,ht=d,mt=d,ut=0,At=0,Mt=Math.abs(Q),Tt=[];for(;ut+At<=Mt;){if(lt+=j,lt<w||lt>=M)return null;if(mt=ht,Tt.push(ht),ht=F[lt],ht===void 0){let Ht=new a.pointGeometry(C.getx(lt),C.gety(lt)),xe=Pe(Ht,k);if(xe.signedDistanceFromCamera>0)ht=F[lt]=xe.point;else{let Fe=lt-j;ht=ir(ut===0?g:new a.pointGeometry(C.getx(Fe),C.gety(Fe)),Ht,mt,Mt-ut+1,k)}}ut+=At,At=mt.dist(ht)}let Ft=(Mt-ut)/At,jt=ht.sub(mt),It=jt.mult(Ft)._add(mt);It._add(jt._unit()._perp()._mult(n*j));let ie=J+Math.atan2(ht.y-mt.y,ht.x-mt.x);return Tt.push(It),{point:It,angle:q?ie:0,path:Tt}}let rr=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ri(p,e){for(let n=0;n<p;n++){let h=e.length;e.resize(h+4),e.float32.set(rr,3*h)}}function Ze(p,e,n){let h=e[0],d=e[1];return p[0]=n[0]*h+n[4]*d+n[12],p[1]=n[1]*h+n[5]*d+n[13],p[3]=n[3]*h+n[7]*d+n[15],p}let Vi=100;class yr{constructor(e,n=new Oe(e.width+200,e.height+200,25),h=new Oe(e.width+200,e.height+200,25)){this.transform=e,this.grid=n,this.ignoredGrid=h,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Vi,this.screenBottomBoundary=e.height+Vi,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200}placeCollisionBox(e,n,h,d,g){let v=this.projectAndGetPerspectiveRatio(d,e.anchorPointX,e.anchorPointY),w=h*v.perspectiveRatio,M=e.x1*w+v.point.x,C=e.y1*w+v.point.y,k=e.x2*w+v.point.x,F=e.y2*w+v.point.y;return!this.isInsideGrid(M,C,k,F)||n!=="always"&&this.grid.hitTest(M,C,k,F,n,g)?{box:[],offscreen:!1}:{box:[M,C,k,F],offscreen:this.isOffscreen(M,C,k,F)}}placeCollisionCircles(e,n,h,d,g,v,w,M,C,k,F,q,Q){let j=[],J=new a.pointGeometry(n.anchorX,n.anchorY),lt=Pe(J,v),ht=Vt(this.transform.cameraToCenterDistance,lt.signedDistanceFromCamera),mt=(k?g/ht:g*ht)/a.ONE_EM,ut=Pe(J,w).point,At=ai(mt,d,n.lineOffsetX*mt,n.lineOffsetY*mt,!1,ut,J,n,h,w,{},!1),Mt=!1,Tt=!1,Ft=!0;if(At){let jt=.5*q*ht+Q,It=new a.pointGeometry(-100,-100),ie=new a.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Ht=new Ie,xe=At.first,Fe=At.last,ke=[];for(let be=xe.path.length-1;be>=1;be--)ke.push(xe.path[be]);for(let be=1;be<Fe.path.length;be++)ke.push(Fe.path[be]);let Re=2.5*jt;if(M){let be=ke.map(qe=>Pe(qe,M));ke=be.some(qe=>qe.signedDistanceFromCamera<=0)?[]:be.map(qe=>qe.point)}let yi=[];if(ke.length>0){let be=ke[0].clone(),qe=ke[0].clone();for(let ti=1;ti<ke.length;ti++)be.x=Math.min(be.x,ke[ti].x),be.y=Math.min(be.y,ke[ti].y),qe.x=Math.max(qe.x,ke[ti].x),qe.y=Math.max(qe.y,ke[ti].y);yi=be.x>=It.x&&qe.x<=ie.x&&be.y>=It.y&&qe.y<=ie.y?[ke]:qe.x<It.x||be.x>ie.x||qe.y<It.y||be.y>ie.y?[]:a.clipLine([ke],It.x,It.y,ie.x,ie.y)}for(let be of yi){Ht.reset(be,.25*jt);let qe=0;qe=Ht.length<=.5*jt?1:Math.ceil(Ht.paddedLength/Re)+1;for(let ti=0;ti<qe;ti++){let Zi=ti/Math.max(qe-1,1),vr=Ht.lerp(Zi),Br=vr.x+Vi,Fr=vr.y+Vi;j.push(Br,Fr,jt,0);let En=Br-jt,ur=Fr-jt,sn=Br+jt,jn=Fr+jt;if(Ft=Ft&&this.isOffscreen(En,ur,sn,jn),Tt=Tt||this.isInsideGrid(En,ur,sn,jn),e!=="always"&&this.grid.hitTestCircle(Br,Fr,jt,e,F)&&(Mt=!0,!C))return{circles:[],offscreen:!1,collisionDetected:Mt}}}}return{circles:!C&&Mt||!Tt?[]:j,offscreen:Ft,collisionDetected:Mt}}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let n=[],h=1/0,d=1/0,g=-1/0,v=-1/0;for(let k of e){let F=new a.pointGeometry(k.x+Vi,k.y+Vi);h=Math.min(h,F.x),d=Math.min(d,F.y),g=Math.max(g,F.x),v=Math.max(v,F.y),n.push(F)}let w=this.grid.query(h,d,g,v).concat(this.ignoredGrid.query(h,d,g,v)),M={},C={};for(let k of w){let F=k.key;if(M[F.bucketInstanceId]===void 0&&(M[F.bucketInstanceId]={}),M[F.bucketInstanceId][F.featureIndex])continue;let q=[new a.pointGeometry(k.x1,k.y1),new a.pointGeometry(k.x2,k.y1),new a.pointGeometry(k.x2,k.y2),new a.pointGeometry(k.x1,k.y2)];a.polygonIntersectsPolygon(n,q)&&(M[F.bucketInstanceId][F.featureIndex]=!0,C[F.bucketInstanceId]===void 0&&(C[F.bucketInstanceId]=[]),C[F.bucketInstanceId].push(F.featureIndex))}return C}insertCollisionBox(e,n,h,d,g,v){(h?this.ignoredGrid:this.grid).insert({bucketInstanceId:d,featureIndex:g,collisionGroupID:v,overlapMode:n},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,n,h,d,g,v){let w=h?this.ignoredGrid:this.grid,M={bucketInstanceId:d,featureIndex:g,collisionGroupID:v,overlapMode:n};for(let C=0;C<e.length;C+=4)w.insertCircle(M,e[C],e[C+1],e[C+2])}projectAndGetPerspectiveRatio(e,n,h){let d=[n,h,0,1];return Ze(d,d,e),{point:new a.pointGeometry((d[0]/d[3]+1)/2*this.transform.width+Vi,(-d[1]/d[3]+1)/2*this.transform.height+Vi),perspectiveRatio:.5+this.transform.cameraToCenterDistance/d[3]*.5}}isOffscreen(e,n,h,d){return h<Vi||e>=this.screenRightBoundary||d<Vi||n>this.screenBottomBoundary}isInsideGrid(e,n,h,d){return h>=0&&e<this.gridRightBoundary&&d>=0&&n<this.gridBottomBoundary}getViewportMatrix(){let e=a.identity([]);return a.translate(e,e,[-100,-100,0]),e}}function gi(p,e,n){return e*(a.EXTENT/(p.tileSize*Math.pow(2,n-p.tileID.overscaledZ)))}class jr{constructor(e,n,h,d){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?n:-n))):d&&h?1:0,this.placed=h}isHidden(){return this.opacity===0&&!this.placed}}class $r{constructor(e,n,h,d,g){this.text=new jr(e?e.text:null,n,h,g),this.icon=new jr(e?e.icon:null,n,d,g)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Vs{constructor(e,n,h){this.text=e,this.icon=n,this.skipFade=h}}class ps{constructor(){this.invProjMatrix=a.create(),this.viewportMatrix=a.create(),this.circles=[]}}class ds{constructor(e,n,h,d,g){this.bucketInstanceId=e,this.featureIndex=n,this.sourceLayerIndex=h,this.bucketIndex=d,this.tileID=g}}class W{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let n=++this.maxGroupID;this.collisionGroups[e]={ID:n,predicate:h=>h.collisionGroupID===n}}return this.collisionGroups[e]}}function I(p,e,n,h,d){let{horizontalAlign:g,verticalAlign:v}=a.getAnchorAlignment(p),w=-(g-.5)*e,M=-(v-.5)*n,C=a.evaluateVariableOffset(p,h);return new a.pointGeometry(w+C[0]*d,M+C[1]*d)}function P(p,e,n,h,d,g){let{x1:v,x2:w,y1:M,y2:C,anchorPointX:k,anchorPointY:F}=p,q=new a.pointGeometry(e,n);return h&&q._rotate(d?g:-g),{x1:v+q.x,y1:M+q.y,x2:w+q.x,y2:C+q.y,anchorPointX:k,anchorPointY:F}}class G{constructor(e,n,h,d){this.transform=e.clone(),this.collisionIndex=new yr(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new W(h),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,n,h,d){let g=h.getBucket(n),v=h.latestFeatureIndex;if(!g||!v||n.id!==g.layerIds[0])return;let w=h.collisionBoxArray,M=g.layers[0].layout,C=Math.pow(2,this.transform.zoom-h.tileID.overscaledZ),k=h.tileSize/a.EXTENT,F=this.transform.calculatePosMatrix(h.tileID.toUnwrapped()),q=M.get("text-pitch-alignment")==="map",Q=M.get("text-rotation-alignment")==="map",j=gi(h,1,this.transform.zoom),J=Ce(F,q,Q,this.transform,j),lt=null;if(q){let mt=Qe(F,q,Q,this.transform,j);lt=a.multiply([],this.transform.labelPlaneMatrix,mt)}this.retainedQueryData[g.bucketInstanceId]=new ds(g.bucketInstanceId,v,g.sourceLayerIndex,g.index,h.tileID);let ht={bucket:g,layout:M,posMatrix:F,textLabelPlaneMatrix:J,labelToScreenMatrix:lt,scale:C,textPixelRatio:k,holdingForFade:h.holdingForFade(),collisionBoxArray:w,partiallyEvaluatedTextSize:a.evaluateSizeForZoom(g.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(g.sourceID)};if(d)for(let mt of g.sortKeyRanges){let{sortKey:ut,symbolInstanceStart:At,symbolInstanceEnd:Mt}=mt;e.push({sortKey:ut,symbolInstanceStart:At,symbolInstanceEnd:Mt,parameters:ht})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:g.symbolInstances.length,parameters:ht})}attemptAnchorPlacement(e,n,h,d,g,v,w,M,C,k,F,q,Q,j,J){let lt=[q.textOffset0,q.textOffset1],ht=I(e,h,d,lt,g),mt=this.collisionIndex.placeCollisionBox(P(n,ht.x,ht.y,v,w,this.transform.angle),F,M,C,k.predicate);if((!J||this.collisionIndex.placeCollisionBox(P(J,ht.x,ht.y,v,w,this.transform.angle),F,M,C,k.predicate).box.length!==0)&&mt.box.length>0){let ut;return this.prevPlacement&&this.prevPlacement.variableOffsets[q.crossTileID]&&this.prevPlacement.placements[q.crossTileID]&&this.prevPlacement.placements[q.crossTileID].text&&(ut=this.prevPlacement.variableOffsets[q.crossTileID].anchor),this.variableOffsets[q.crossTileID]={textOffset:lt,width:h,height:d,anchor:e,textBoxScale:g,prevAnchor:ut},this.markUsedJustification(Q,e,q,j),Q.allowVerticalPlacement&&(this.markUsedOrientation(Q,j,q),this.placedOrientations[q.crossTileID]=j),{shift:ht,placedGlyphBoxes:mt}}}placeLayerBucketPart(e,n,h){let{bucket:d,layout:g,posMatrix:v,textLabelPlaneMatrix:w,labelToScreenMatrix:M,textPixelRatio:C,holdingForFade:k,collisionBoxArray:F,partiallyEvaluatedTextSize:q,collisionGroup:Q}=e.parameters,j=g.get("text-optional"),J=g.get("icon-optional"),lt=a.getOverlapMode(g,"text-overlap","text-allow-overlap"),ht=lt==="always",mt=a.getOverlapMode(g,"icon-overlap","icon-allow-overlap"),ut=mt==="always",At=g.get("text-rotation-alignment")==="map",Mt=g.get("text-pitch-alignment")==="map",Tt=g.get("icon-text-fit")!=="none",Ft=g.get("symbol-z-order")==="viewport-y",jt=ht&&(ut||!d.hasIconData()||J),It=ut&&(ht||!d.hasTextData()||j);!d.collisionArrays&&F&&d.deserializeCollisionBoxes(F);let ie=(Ht,xe)=>{if(n[Ht.crossTileID])return;if(k)return void(this.placements[Ht.crossTileID]=new Vs(!1,!1,!1));let Fe=!1,ke=!1,Re=!0,yi=null,be={box:null,offscreen:null},qe={box:null,offscreen:null},ti=null,Zi=null,vr=null,Br=0,Fr=0,En=0;xe.textFeatureIndex?Br=xe.textFeatureIndex:Ht.useRuntimeCollisionCircles&&(Br=Ht.featureIndex),xe.verticalTextFeatureIndex&&(Fr=xe.verticalTextFeatureIndex);let ur=xe.textBox;if(ur){let br=He=>{let Ai=a.WritingMode.horizontal;if(d.allowVerticalPlacement&&!He&&this.prevPlacement){let nr=this.prevPlacement.placedOrientations[Ht.crossTileID];nr&&(this.placedOrientations[Ht.crossTileID]=nr,Ai=nr,this.markUsedOrientation(d,Ai,Ht))}return Ai},je=(He,Ai)=>{if(d.allowVerticalPlacement&&Ht.numVerticalGlyphVertices>0&&xe.verticalTextBox){for(let nr of d.writingModes)if(nr===a.WritingMode.vertical?(be=Ai(),qe=be):be=He(),be&&be.box&&be.box.length)break}else be=He()};if(g.get("text-variable-anchor")){let He=g.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ht.crossTileID]){let ci=this.prevPlacement.variableOffsets[Ht.crossTileID];He.indexOf(ci.anchor)>0&&(He=He.filter($n=>$n!==ci.anchor),He.unshift(ci.anchor))}let Ai=(ci,$n,an)=>{let Ka=ci.x2-ci.x1,cl=ci.y2-ci.y1,Ya=Ht.textBoxScale,bh=Tt&&mt==="never"?$n:null,Wn={box:[],offscreen:!1},Ja=lt!=="never"?2*He.length:He.length;for(let on=0;on<Ja;++on){let Es=this.attemptAnchorPlacement(He[on%He.length],ci,Ka,cl,Ya,At,Mt,C,v,Q,on>=He.length?lt:"never",Ht,d,an,bh);if(Es&&(Wn=Es.placedGlyphBoxes,Wn&&Wn.box&&Wn.box.length)){Fe=!0,yi=Es.shift;break}}return Wn};je(()=>Ai(ur,xe.iconBox,a.WritingMode.horizontal),()=>{let ci=xe.verticalTextBox;return d.allowVerticalPlacement&&!(be&&be.box&&be.box.length)&&Ht.numVerticalGlyphVertices>0&&ci?Ai(ci,xe.verticalIconBox,a.WritingMode.vertical):{box:null,offscreen:null}}),be&&(Fe=be.box,Re=be.offscreen);let nr=br(be&&be.box);if(!Fe&&this.prevPlacement){let ci=this.prevPlacement.variableOffsets[Ht.crossTileID];ci&&(this.variableOffsets[Ht.crossTileID]=ci,this.markUsedJustification(d,ci.anchor,Ht,nr))}}else{let He=(Ai,nr)=>{let ci=this.collisionIndex.placeCollisionBox(Ai,lt,C,v,Q.predicate);return ci&&ci.box&&ci.box.length&&(this.markUsedOrientation(d,nr,Ht),this.placedOrientations[Ht.crossTileID]=nr),ci};je(()=>He(ur,a.WritingMode.horizontal),()=>{let Ai=xe.verticalTextBox;return d.allowVerticalPlacement&&Ht.numVerticalGlyphVertices>0&&Ai?He(Ai,a.WritingMode.vertical):{box:null,offscreen:null}}),br(be&&be.box&&be.box.length)}}if(ti=be,Fe=ti&&ti.box&&ti.box.length>0,Re=ti&&ti.offscreen,Ht.useRuntimeCollisionCircles){let br=d.text.placedSymbolArray.get(Ht.centerJustifiedTextSymbolIndex),je=a.evaluateSizeForFeature(d.textSizeData,q,br),He=g.get("text-padding");Zi=this.collisionIndex.placeCollisionCircles(lt,br,d.lineVertexArray,d.glyphOffsetArray,je,v,w,M,h,Mt,Q.predicate,Ht.collisionCircleDiameter,He),Fe=ht||Zi.circles.length>0&&!Zi.collisionDetected,Re=Re&&Zi.offscreen}if(xe.iconFeatureIndex&&(En=xe.iconFeatureIndex),xe.iconBox){let br=je=>{let He=Tt&&yi?P(je,yi.x,yi.y,At,Mt,this.transform.angle):je;return this.collisionIndex.placeCollisionBox(He,mt,C,v,Q.predicate)};qe&&qe.box&&qe.box.length&&xe.verticalIconBox?(vr=br(xe.verticalIconBox),ke=vr.box.length>0):(vr=br(xe.iconBox),ke=vr.box.length>0),Re=Re&&vr.offscreen}let sn=j||Ht.numHorizontalGlyphVertices===0&&Ht.numVerticalGlyphVertices===0,jn=J||Ht.numIconVertices===0;if(sn||jn?jn?sn||(ke=ke&&Fe):Fe=ke&&Fe:ke=Fe=ke&&Fe,Fe&&ti&&ti.box&&this.collisionIndex.insertCollisionBox(ti.box,lt,g.get("text-ignore-placement"),d.bucketInstanceId,qe&&qe.box&&Fr?Fr:Br,Q.ID),ke&&vr&&this.collisionIndex.insertCollisionBox(vr.box,mt,g.get("icon-ignore-placement"),d.bucketInstanceId,En,Q.ID),Zi&&(Fe&&this.collisionIndex.insertCollisionCircles(Zi.circles,lt,g.get("text-ignore-placement"),d.bucketInstanceId,Br,Q.ID),h)){let br=d.bucketInstanceId,je=this.collisionCircleArrays[br];je===void 0&&(je=this.collisionCircleArrays[br]=new ps);for(let He=0;He<Zi.circles.length;He+=4)je.circles.push(Zi.circles[He+0]),je.circles.push(Zi.circles[He+1]),je.circles.push(Zi.circles[He+2]),je.circles.push(Zi.collisionDetected?1:0)}this.placements[Ht.crossTileID]=new Vs(Fe||jt,ke||It,Re||d.justReloaded),n[Ht.crossTileID]=!0};if(Ft){let Ht=d.getSortedSymbolIndexes(this.transform.angle);for(let xe=Ht.length-1;xe>=0;--xe){let Fe=Ht[xe];ie(d.symbolInstances.get(Fe),d.collisionArrays[Fe])}}else for(let Ht=e.symbolInstanceStart;Ht<e.symbolInstanceEnd;Ht++)ie(d.symbolInstances.get(Ht),d.collisionArrays[Ht]);if(h&&d.bucketInstanceId in this.collisionCircleArrays){let Ht=this.collisionCircleArrays[d.bucketInstanceId];a.invert(Ht.invProjMatrix,v),Ht.viewportMatrix=this.collisionIndex.getViewportMatrix()}d.justReloaded=!1}markUsedJustification(e,n,h,d){let g;g=d===a.WritingMode.vertical?h.verticalPlacedTextSymbolIndex:{left:h.leftJustifiedTextSymbolIndex,center:h.centerJustifiedTextSymbolIndex,right:h.rightJustifiedTextSymbolIndex}[a.getAnchorJustification(n)];let v=[h.leftJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.rightJustifiedTextSymbolIndex,h.verticalPlacedTextSymbolIndex];for(let w of v)w>=0&&(e.text.placedSymbolArray.get(w).crossTileID=g>=0&&w!==g?0:h.crossTileID)}markUsedOrientation(e,n,h){let d=n===a.WritingMode.horizontal||n===a.WritingMode.horizontalOnly?n:0,g=n===a.WritingMode.vertical?n:0,v=[h.leftJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.rightJustifiedTextSymbolIndex];for(let w of v)e.text.placedSymbolArray.get(w).placedOrientation=d;h.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(h.verticalPlacedTextSymbolIndex).placedOrientation=g)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let n=this.prevPlacement,h=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;let d=n?n.symbolFadeChange(e):1,g=n?n.opacities:{},v=n?n.variableOffsets:{},w=n?n.placedOrientations:{};for(let M in this.placements){let C=this.placements[M],k=g[M];k?(this.opacities[M]=new $r(k,d,C.text,C.icon),h=h||C.text!==k.text.placed||C.icon!==k.icon.placed):(this.opacities[M]=new $r(null,d,C.text,C.icon,C.skipFade),h=h||C.text||C.icon)}for(let M in g){let C=g[M];if(!this.opacities[M]){let k=new $r(C,d,!1,!1);k.isHidden()||(this.opacities[M]=k,h=h||C.text.placed||C.icon.placed)}}for(let M in v)this.variableOffsets[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.variableOffsets[M]=v[M]);for(let M in w)this.placedOrientations[M]||!this.opacities[M]||this.opacities[M].isHidden()||(this.placedOrientations[M]=w[M]);h?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:e)}updateLayerOpacities(e,n){let h={};for(let d of n){let g=d.getBucket(e);g&&d.latestFeatureIndex&&e.id===g.layerIds[0]&&this.updateBucketOpacities(g,h,d.collisionBoxArray)}}updateBucketOpacities(e,n,h){e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let d=e.layers[0].layout,g=new $r(null,0,!1,!1,!0),v=d.get("text-allow-overlap"),w=d.get("icon-allow-overlap"),M=d.get("text-variable-anchor"),C=d.get("text-rotation-alignment")==="map",k=d.get("text-pitch-alignment")==="map",F=d.get("icon-text-fit")!=="none",q=new $r(null,0,v&&(w||!e.hasIconData()||d.get("icon-optional")),w&&(v||!e.hasTextData()||d.get("text-optional")),!0);!e.collisionArrays&&h&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(h);let Q=(j,J,lt)=>{for(let ht=0;ht<J/4;ht++)j.opacityVertexArray.emplaceBack(lt)};for(let j=0;j<e.symbolInstances.length;j++){let J=e.symbolInstances.get(j),{numHorizontalGlyphVertices:lt,numVerticalGlyphVertices:ht,crossTileID:mt}=J,ut=this.opacities[mt];n[mt]?ut=g:ut||(ut=q,this.opacities[mt]=ut),n[mt]=!0;let At=J.numIconVertices>0,Mt=this.placedOrientations[J.crossTileID],Tt=Mt===a.WritingMode.vertical,Ft=Mt===a.WritingMode.horizontal||Mt===a.WritingMode.horizontalOnly;if(lt>0||ht>0){let jt=wt(ut.text);Q(e.text,lt,Tt?re:jt),Q(e.text,ht,Ft?re:jt);let It=ut.text.isHidden();[J.rightJustifiedTextSymbolIndex,J.centerJustifiedTextSymbolIndex,J.leftJustifiedTextSymbolIndex].forEach(xe=>{xe>=0&&(e.text.placedSymbolArray.get(xe).hidden=It||Tt?1:0)}),J.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(J.verticalPlacedTextSymbolIndex).hidden=It||Ft?1:0);let ie=this.variableOffsets[J.crossTileID];ie&&this.markUsedJustification(e,ie.anchor,J,Mt);let Ht=this.placedOrientations[J.crossTileID];Ht&&(this.markUsedJustification(e,"left",J,Ht),this.markUsedOrientation(e,Ht,J))}if(At){let jt=wt(ut.icon),It=!(F&&J.verticalPlacedIconSymbolIndex&&Tt);J.placedIconSymbolIndex>=0&&(Q(e.icon,J.numIconVertices,It?jt:re),e.icon.placedSymbolArray.get(J.placedIconSymbolIndex).hidden=ut.icon.isHidden()),J.verticalPlacedIconSymbolIndex>=0&&(Q(e.icon,J.numVerticalIconVertices,It?re:jt),e.icon.placedSymbolArray.get(J.verticalPlacedIconSymbolIndex).hidden=ut.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let jt=e.collisionArrays[j];if(jt){let It=new a.pointGeometry(0,0);if(jt.textBox||jt.verticalTextBox){let Ht=!0;if(M){let xe=this.variableOffsets[mt];xe?(It=I(xe.anchor,xe.width,xe.height,xe.textOffset,xe.textBoxScale),C&&It._rotate(k?this.transform.angle:-this.transform.angle)):Ht=!1}jt.textBox&&Z(e.textCollisionBox.collisionVertexArray,ut.text.placed,!Ht||Tt,It.x,It.y),jt.verticalTextBox&&Z(e.textCollisionBox.collisionVertexArray,ut.text.placed,!Ht||Ft,It.x,It.y)}let ie=Boolean(!Ft&&jt.verticalIconBox);jt.iconBox&&Z(e.iconCollisionBox.collisionVertexArray,ut.icon.placed,ie,F?It.x:0,F?It.y:0),jt.verticalIconBox&&Z(e.iconCollisionBox.collisionVertexArray,ut.icon.placed,!ie,F?It.x:0,F?It.y:0)}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.bucketInstanceId in this.collisionCircleArrays){let j=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=j.invProjMatrix,e.placementViewportMatrix=j.viewportMatrix,e.collisionCircleArray=j.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,n){let h=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*h>e}setStale(){this.stale=!0}}function Z(p,e,n,h,d){p.emplaceBack(e?1:0,n?1:0,h||0,d||0),p.emplaceBack(e?1:0,n?1:0,h||0,d||0),p.emplaceBack(e?1:0,n?1:0,h||0,d||0),p.emplaceBack(e?1:0,n?1:0,h||0,d||0)}let Y=Math.pow(2,25),at=Math.pow(2,24),rt=Math.pow(2,17),nt=Math.pow(2,16),ot=Math.pow(2,9),St=Math.pow(2,8),kt=Math.pow(2,1);function wt(p){if(p.opacity===0&&!p.placed)return 0;if(p.opacity===1&&p.placed)return 4294967295;let e=p.placed?1:0,n=Math.floor(127*p.opacity);return n*Y+e*at+n*rt+e*nt+n*ot+e*St+n*kt+e}let re=0;class Jt{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,n,h,d,g){let v=this._bucketParts;for(;this._currentTileIndex<e.length;)if(n.getBucketParts(v,d,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,g())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,v.sort((w,M)=>w.sortKey-M.sortKey));this._currentPartIndex<v.length;)if(n.placeLayerBucketPart(v[this._currentPartIndex],this._seenCrossTileIDs,h),this._currentPartIndex++,g())return!0;return!1}}class se{constructor(e,n,h,d,g,v,w){this.placement=new G(e,g,v,w),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=h,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(e,n,h){let d=a.exported.now(),g=()=>{let v=a.exported.now()-d;return!this._forceFullPlacement&&v>2};for(;this._currentPlacementIndex>=0;){let v=n[e[this._currentPlacementIndex]],w=this.placement.collisionIndex.transform.zoom;if(v.type==="symbol"&&(!v.minzoom||v.minzoom<=w)&&(!v.maxzoom||v.maxzoom>w)){if(this._inProgressLayer||(this._inProgressLayer=new Jt(v)),this._inProgressLayer.continuePlacement(h[v.source],this.placement,this._showCollisionBoxes,v,g))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let pe=512/a.EXTENT/2;class Ue{constructor(e,n,h){this.tileID=e,this.indexedSymbolInstances={},this.bucketInstanceId=h;for(let d=0;d<n.length;d++){let g=n.get(d),v=g.key;this.indexedSymbolInstances[v]||(this.indexedSymbolInstances[v]=[]),this.indexedSymbolInstances[v].push({crossTileID:g.crossTileID,coord:this.getScaledCoordinates(g,e)})}}getScaledCoordinates(e,n){let h=pe/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*a.EXTENT+e.anchorX)*h),y:Math.floor((n.canonical.y*a.EXTENT+e.anchorY)*h)}}findMatches(e,n,h){let d=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let g=0;g<e.length;g++){let v=e.get(g);if(v.crossTileID)continue;let w=this.indexedSymbolInstances[v.key];if(!w)continue;let M=this.getScaledCoordinates(v,n);for(let C of w)if(Math.abs(C.coord.x-M.x)<=d&&Math.abs(C.coord.y-M.y)<=d&&!h[C.crossTileID]){h[C.crossTileID]=!0,v.crossTileID=C.crossTileID;break}}}}class De{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class ze{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let n=Math.round((e-this.lng)/360);if(n!==0)for(let h in this.indexes){let d=this.indexes[h],g={};for(let v in d){let w=d[v];w.tileID=w.tileID.unwrapTo(w.tileID.wrap+n),g[w.tileID.key]=w}this.indexes[h]=g}this.lng=e}addBucket(e,n,h){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let g=0;g<n.symbolInstances.length;g++)n.symbolInstances.get(g).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let d=this.usedCrossTileIDs[e.overscaledZ];for(let g in this.indexes){let v=this.indexes[g];if(Number(g)>e.overscaledZ)for(let w in v){let M=v[w];M.tileID.isChildOf(e)&&M.findMatches(n.symbolInstances,e,d)}else{let w=v[e.scaledTo(Number(g)).key];w&&w.findMatches(n.symbolInstances,e,d)}}for(let g=0;g<n.symbolInstances.length;g++){let v=n.symbolInstances.get(g);v.crossTileID||(v.crossTileID=h.generate(),d[v.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Ue(e,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(e,n){for(let h in n.indexedSymbolInstances)for(let d of n.indexedSymbolInstances[h])delete this.usedCrossTileIDs[e][d.crossTileID]}removeStaleBuckets(e){let n=!1;for(let h in this.indexes){let d=this.indexes[h];for(let g in d)e[d[g].bucketInstanceId]||(this.removeBucketCrossTileIDs(h,d[g]),delete d[g],n=!0)}return n}}class Te{constructor(){this.layerIndexes={},this.crossTileIDs=new De,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,n,h){let d=this.layerIndexes[e.id];d===void 0&&(d=this.layerIndexes[e.id]=new ze);let g=!1,v={};d.handleWrapJump(h);for(let w of n){let M=w.getBucket(e);M&&e.id===M.layerIds[0]&&(M.bucketInstanceId||(M.bucketInstanceId=++this.maxBucketInstanceId),d.addBucket(w.tileID,M,this.crossTileIDs)&&(g=!0),v[M.bucketInstanceId]=!0)}return d.removeStaleBuckets(v)&&(g=!0),g}pruneUnusedLayers(e){let n={};e.forEach(h=>{n[h]=!0});for(let h in this.layerIndexes)n[h]||delete this.layerIndexes[h]}}let Me=(p,e)=>a.emitValidationErrors(p,e&&e.filter(n=>n.identifier!=="source.canvas")),wi=a.pick(X,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),xi=a.pick(X,["setCenter","setZoom","setBearing","setPitch"]),Gi=function(){let p={},e=a.spec.$version;for(let n in a.spec.$root){let h=a.spec.$root[n];if(h.required){let d=null;d=n==="version"?e:h.type==="array"?[]:{},d!=null&&(p[n]=d)}}return p}();class Wi extends a.Evented{constructor(e,n={}){super(),this.map=e,this.dispatcher=new Bi(N(),this),this.imageManager=new oe,this.imageManager.setEventedParent(this),this.glyphManager=new Ge(e._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Yi(256,512),this.crossTileSymbolIndex=new Te,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new a.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",a.getReferrer());let h=this;this._rtlTextPluginCallback=Wi.registerForPluginStateChange(d=>{h.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},(g,v)=>{if(a.triggerPluginCompletionEvent(g),v&&v.every(w=>w))for(let w in h.sourceCaches)h.sourceCaches[w].reload()})}),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;let g=this.sourceCaches[d.sourceId];if(!g)return;let v=g.getSource();if(v&&v.vectorLayerIds)for(let w in this._layers){let M=this._layers[w];M.source===v.id&&this._validateLayer(M)}})}loadURL(e,n={}){this.fire(new a.Event("dataloading",{dataType:"style"}));let h=typeof n.validate!="boolean"||n.validate,d=this.map._requestManager.transformRequest(e,a.ResourceType.Style);this._request=a.getJSON(d,(g,v)=>{this._request=null,g?this.fire(new a.ErrorEvent(g)):v&&this._load(v,h)})}loadJSON(e,n={}){this.fire(new a.Event("dataloading",{dataType:"style"})),this._request=a.exported.frame(()=>{this._request=null,this._load(e,n.validate!==!1)})}loadEmpty(){this.fire(new a.Event("dataloading",{dataType:"style"})),this._load(Gi,!1)}_load(e,n){if(n&&Me(this,a.validateStyle(e)))return;this._loaded=!0,this.stylesheet=e;for(let d in e.sources)this.addSource(d,e.sources[d],{validate:!1});e.sprite?this._loadSprite(e.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);let h=U(this.stylesheet.layers);this._order=h.map(d=>d.id),this._layers={},this._serializedLayers={};for(let d of h)d=a.createStyleLayer(d),d.setEventedParent(this,{layer:{id:d.id}}),this._layers[d.id]=d,this._serializedLayers[d.id]=d.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new Ri(this.stylesheet.light),this.fire(new a.Event("data",{dataType:"style"})),this.fire(new a.Event("style.load"))}_loadSprite(e){this._spriteRequest=function(n,h,d,g){let v,w,M,C=d>1?"@2x":"",k=a.getJSON(h.transformRequest(h.normalizeSpriteURL(n,C,".json"),a.ResourceType.SpriteJSON),(Q,j)=>{k=null,M||(M=Q,v=j,q())}),F=a.getImage(h.transformRequest(h.normalizeSpriteURL(n,C,".png"),a.ResourceType.SpriteImage),(Q,j)=>{F=null,M||(M=Q,w=j,q())});function q(){if(M)g(M);else if(v&&w){let Q=a.exported.getImageData(w),j={};for(let J in v){let{width:lt,height:ht,x:mt,y:ut,sdf:At,pixelRatio:Mt,stretchX:Tt,stretchY:Ft,content:jt}=v[J],It=new a.RGBAImage({width:lt,height:ht});a.RGBAImage.copy(Q,It,{x:mt,y:ut},{x:0,y:0},{width:lt,height:ht}),j[J]={data:It,pixelRatio:Mt,sdf:At,stretchX:Tt,stretchY:Ft,content:jt}}g(null,j)}}return{cancel(){k&&(k.cancel(),k=null),F&&(F.cancel(),F=null)}}}(e,this.map._requestManager,this.map.getPixelRatio(),(n,h)=>{if(this._spriteRequest=null,n)this.fire(new a.ErrorEvent(n));else if(h)for(let d in h)this.imageManager.addImage(d,h[d]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))})}_validateLayer(e){let n=this.sourceCaches[e.source];if(!n)return;let h=e.sourceLayer;if(!h)return;let d=n.getSource();(d.type==="geojson"||d.vectorLayerIds&&d.vectorLayerIds.indexOf(h)===-1)&&this.fire(new a.ErrorEvent(new Error(`Source layer "${h}" does not exist on source "${d.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(e){let n=[];for(let h of e){let d=this._layers[h];d.type!=="custom"&&n.push(d.serialize())}return n}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(let e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;let n=this._changed;if(this._changed){let d=Object.keys(this._updatedLayers),g=Object.keys(this._removedLayers);(d.length||g.length)&&this._updateWorkerLayers(d,g);for(let v in this._updatedSources){let w=this._updatedSources[v];w==="reload"?this._reloadSource(v):w==="clear"&&this._clearSource(v)}this._updateTilesForChangedImages();for(let v in this._updatedPaintProps)this._layers[v].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}let h={};for(let d in this.sourceCaches){let g=this.sourceCaches[d];h[d]=g.used,g.used=!1}for(let d of this._order){let g=this._layers[d];g.recalculate(e,this._availableImages),!g.isHidden(e.zoom)&&g.source&&(this.sourceCaches[g.source].used=!0)}for(let d in h){let g=this.sourceCaches[d];h[d]!==g.used&&g.fire(new a.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:d}))}this.light.recalculate(e),this.z=e.zoom,n&&this.fire(new a.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateWorkerLayers(e,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(e),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setState(e){if(this._checkLoaded(),Me(this,a.validateStyle(e)))return!1;(e=a.clone$1(e)).layers=U(e.layers);let n=function(d,g){if(!d)return[{command:X.setStyle,args:[g]}];let v=[];try{if(!$(d.version,g.version))return[{command:X.setStyle,args:[g]}];$(d.center,g.center)||v.push({command:X.setCenter,args:[g.center]}),$(d.zoom,g.zoom)||v.push({command:X.setZoom,args:[g.zoom]}),$(d.bearing,g.bearing)||v.push({command:X.setBearing,args:[g.bearing]}),$(d.pitch,g.pitch)||v.push({command:X.setPitch,args:[g.pitch]}),$(d.sprite,g.sprite)||v.push({command:X.setSprite,args:[g.sprite]}),$(d.glyphs,g.glyphs)||v.push({command:X.setGlyphs,args:[g.glyphs]}),$(d.transition,g.transition)||v.push({command:X.setTransition,args:[g.transition]}),$(d.light,g.light)||v.push({command:X.setLight,args:[g.light]});let w={},M=[];(function(k,F,q,Q){let j;for(j in F=F||{},k=k||{})Object.prototype.hasOwnProperty.call(k,j)&&(Object.prototype.hasOwnProperty.call(F,j)||xt(j,q,Q));for(j in F)Object.prototype.hasOwnProperty.call(F,j)&&(Object.prototype.hasOwnProperty.call(k,j)?$(k[j],F[j])||(k[j].type==="geojson"&&F[j].type==="geojson"&&Ut(k,F,j)?q.push({command:X.setGeoJSONSourceData,args:[j,F[j].data]}):Dt(j,F,q,Q)):st(j,F,q))})(d.sources,g.sources,M,w);let C=[];d.layers&&d.layers.forEach(k=>{w[k.source]?v.push({command:X.removeLayer,args:[k.id]}):C.push(k)}),v=v.concat(M),function(k,F,q){F=F||[];let Q=(k=k||[]).map(Ct),j=F.map(Ct),J=k.reduce(Se,{}),lt=F.reduce(Se,{}),ht=Q.slice(),mt=Object.create(null),ut,At,Mt,Tt,Ft,jt,It;for(ut=0,At=0;ut<Q.length;ut++)Mt=Q[ut],Object.prototype.hasOwnProperty.call(lt,Mt)?At++:(q.push({command:X.removeLayer,args:[Mt]}),ht.splice(ht.indexOf(Mt,At),1));for(ut=0,At=0;ut<j.length;ut++)Mt=j[j.length-1-ut],ht[ht.length-1-ut]!==Mt&&(Object.prototype.hasOwnProperty.call(J,Mt)?(q.push({command:X.removeLayer,args:[Mt]}),ht.splice(ht.lastIndexOf(Mt,ht.length-At),1)):At++,jt=ht[ht.length-ut],q.push({command:X.addLayer,args:[lt[Mt],jt]}),ht.splice(ht.length-ut,0,Mt),mt[Mt]=!0);for(ut=0;ut<j.length;ut++)if(Mt=j[ut],Tt=J[Mt],Ft=lt[Mt],!mt[Mt]&&!$(Tt,Ft))if($(Tt.source,Ft.source)&&$(Tt["source-layer"],Ft["source-layer"])&&$(Tt.type,Ft.type)){for(It in ct(Tt.layout,Ft.layout,q,Mt,null,X.setLayoutProperty),ct(Tt.paint,Ft.paint,q,Mt,null,X.setPaintProperty),$(Tt.filter,Ft.filter)||q.push({command:X.setFilter,args:[Mt,Ft.filter]}),$(Tt.minzoom,Ft.minzoom)&&$(Tt.maxzoom,Ft.maxzoom)||q.push({command:X.setLayerZoomRange,args:[Mt,Ft.minzoom,Ft.maxzoom]}),Tt)Object.prototype.hasOwnProperty.call(Tt,It)&&It!=="layout"&&It!=="paint"&&It!=="filter"&&It!=="metadata"&&It!=="minzoom"&&It!=="maxzoom"&&(It.indexOf("paint.")===0?ct(Tt[It],Ft[It],q,Mt,It.slice(6),X.setPaintProperty):$(Tt[It],Ft[It])||q.push({command:X.setLayerProperty,args:[Mt,It,Ft[It]]}));for(It in Ft)Object.prototype.hasOwnProperty.call(Ft,It)&&!Object.prototype.hasOwnProperty.call(Tt,It)&&It!=="layout"&&It!=="paint"&&It!=="filter"&&It!=="metadata"&&It!=="minzoom"&&It!=="maxzoom"&&(It.indexOf("paint.")===0?ct(Tt[It],Ft[It],q,Mt,It.slice(6),X.setPaintProperty):$(Tt[It],Ft[It])||q.push({command:X.setLayerProperty,args:[Mt,It,Ft[It]]}))}else q.push({command:X.removeLayer,args:[Mt]}),jt=ht[ht.lastIndexOf(Mt)+1],q.push({command:X.addLayer,args:[Ft,jt]})}(C,g.layers,v)}catch(w){console.warn("Unable to compute style diff:",w),v=[{command:X.setStyle,args:[g]}]}return v}(this.serialize(),e).filter(d=>!(d.command in xi));if(n.length===0)return!1;let h=n.filter(d=>!(d.command in wi));if(h.length>0)throw new Error(`Unimplemented: ${h.map(d=>d.command).join(", ")}.`);return n.forEach(d=>{d.command!=="setTransition"&&this[d.command].apply(this,d.args)}),this.stylesheet=e,!0}addImage(e,n){if(this.getImage(e))return this.fire(new a.ErrorEvent(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,n),this._afterImageUpdated(e)}updateImage(e,n){this.imageManager.updateImage(e,n)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new a.ErrorEvent(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new a.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,n,h={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(a.validateStyle.source,`sources.${e}`,n,null,h))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);let d=this.sourceCaches[e]=new Je(e,n,this.dispatcher);d.style=this,d.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:d.serialize(),sourceId:e})),d.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(let h in this._layers)if(this._layers[h].source===e)return this.fire(new a.ErrorEvent(new Error(`Source "${e}" cannot be removed while layer "${h}" is using it.`)));let n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new a.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,n){this._checkLoaded(),this.sourceCaches[e].getSource().setData(n),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,n,h={}){this._checkLoaded();let d=e.id;if(this.getLayer(d))return void this.fire(new a.ErrorEvent(new Error(`Layer "${d}" already exists on this map.`)));let g;if(e.type==="custom"){if(Me(this,a.validateCustomStyleLayer(e)))return;g=a.createStyleLayer(e)}else{if(typeof e.source=="object"&&(this.addSource(d,e.source),e=a.clone$1(e),e=a.extend(e,{source:d})),this._validate(a.validateStyle.layer,`layers.${d}`,e,{arrayIndex:-1},h))return;g=a.createStyleLayer(e),this._validateLayer(g),g.setEventedParent(this,{layer:{id:d}}),this._serializedLayers[g.id]=g.serialize()}let v=n?this._order.indexOf(n):this._order.length;if(n&&v===-1)this.fire(new a.ErrorEvent(new Error(`Cannot add layer "${d}" before non-existing layer "${n}".`)));else{if(this._order.splice(v,0,d),this._layerOrderChanged=!0,this._layers[d]=g,this._removedLayers[d]&&g.source&&g.type!=="custom"){let w=this._removedLayers[d];delete this._removedLayers[d],w.type!==g.type?this._updatedSources[g.source]="clear":(this._updatedSources[g.source]="reload",this.sourceCaches[g.source].pause())}this._updateLayer(g),g.onAdd&&g.onAdd(this.map)}}moveLayer(e,n){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new a.ErrorEvent(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===n)return;let h=this._order.indexOf(e);this._order.splice(h,1);let d=n?this._order.indexOf(n):this._order.length;n&&d===-1?this.fire(new a.ErrorEvent(new Error(`Cannot move layer "${e}" before non-existing layer "${n}".`))):(this._order.splice(d,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();let n=this._layers[e];if(!n)return void this.fire(new a.ErrorEvent(new Error(`Cannot remove non-existing layer "${e}".`)));n.setEventedParent(null);let h=this._order.indexOf(e);this._order.splice(h,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map)}getLayer(e){return this._layers[e]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,n,h){this._checkLoaded();let d=this.getLayer(e);d?d.minzoom===n&&d.maxzoom===h||(n!=null&&(d.minzoom=n),h!=null&&(d.maxzoom=h),this._updateLayer(d)):this.fire(new a.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,n,h={}){this._checkLoaded();let d=this.getLayer(e);if(d){if(!$(d.filter,n))return n==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(a.validateStyle.filter,`layers.${d.id}.filter`,n,null,h)||(d.filter=a.clone$1(n),this._updateLayer(d)))}else this.fire(new a.ErrorEvent(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return a.clone$1(this.getLayer(e).filter)}setLayoutProperty(e,n,h,d={}){this._checkLoaded();let g=this.getLayer(e);g?$(g.getLayoutProperty(n),h)||(g.setLayoutProperty(n,h,d),this._updateLayer(g)):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,n){let h=this.getLayer(e);if(h)return h.getLayoutProperty(n);this.fire(new a.ErrorEvent(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,n,h,d={}){this._checkLoaded();let g=this.getLayer(e);g?$(g.getPaintProperty(n),h)||(g.setPaintProperty(n,h,d)&&this._updateLayer(g),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new a.ErrorEvent(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,n){return this.getLayer(e).getPaintProperty(n)}setFeatureState(e,n){this._checkLoaded();let h=e.source,d=e.sourceLayer,g=this.sourceCaches[h];if(g===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${h}' does not exist in the map's style.`)));let v=g.getSource().type;v==="geojson"&&d?this.fire(new a.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):v!=="vector"||d?(e.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),g.setFeatureState(d,e.id,n)):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,n){this._checkLoaded();let h=e.source,d=this.sourceCaches[h];if(d===void 0)return void this.fire(new a.ErrorEvent(new Error(`The source '${h}' does not exist in the map's style.`)));let g=d.getSource().type,v=g==="vector"?e.sourceLayer:void 0;g!=="vector"||v?n&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new a.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):d.removeFeatureState(v,e.id,n):this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();let n=e.source,h=e.sourceLayer,d=this.sourceCaches[n];if(d!==void 0)return d.getSource().type!=="vector"||h?(e.id===void 0&&this.fire(new a.ErrorEvent(new Error("The feature id parameter must be provided."))),d.getFeatureState(h,e.id)):void this.fire(new a.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new a.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return a.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return a.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:a.mapObject(this.sourceCaches,e=>e.serialize()),layers:this._serializeLayers(this._order)},e=>e!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(e){let n=v=>this._layers[v].type==="fill-extrusion",h={},d=[];for(let v=this._order.length-1;v>=0;v--){let w=this._order[v];if(n(w)){h[w]=v;for(let M of e){let C=M[w];if(C)for(let k of C)d.push(k)}}}d.sort((v,w)=>w.intersectionZ-v.intersectionZ);let g=[];for(let v=this._order.length-1;v>=0;v--){let w=this._order[v];if(n(w))for(let M=d.length-1;M>=0;M--){let C=d[M].feature;if(h[C.layer.id]<v)break;g.push(C),d.pop()}else for(let M of e){let C=M[w];if(C)for(let k of C)g.push(k.feature)}}return g}queryRenderedFeatures(e,n,h){n&&n.filter&&this._validate(a.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);let d={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new a.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(let v of n.layers){let w=this._layers[v];if(!w)return this.fire(new a.ErrorEvent(new Error(`The layer '${v}' does not exist in the map's style and cannot be queried for features.`))),[];d[w.source]=!0}}let g=[];n.availableImages=this._availableImages;for(let v in this.sourceCaches)n.layers&&!d[v]||g.push(qr(this.sourceCaches[v],this._layers,this._serializedLayers,e,n,h));return this.placement&&g.push(function(v,w,M,C,k,F,q){let Q={},j=F.queryRenderedSymbols(C),J=[];for(let lt of Object.keys(j).map(Number))J.push(q[lt]);J.sort(Sn);for(let lt of J){let ht=lt.featureIndex.lookupSymbolFeatures(j[lt.bucketInstanceId],w,lt.bucketIndex,lt.sourceLayerIndex,k.filter,k.layers,k.availableImages,v);for(let mt in ht){let ut=Q[mt]=Q[mt]||[],At=ht[mt];At.sort((Mt,Tt)=>{let Ft=lt.featureSortOrder;if(Ft){let jt=Ft.indexOf(Mt.featureIndex);return Ft.indexOf(Tt.featureIndex)-jt}return Tt.featureIndex-Mt.featureIndex});for(let Mt of At)ut.push(Mt)}}for(let lt in Q)Q[lt].forEach(ht=>{let mt=ht.feature,ut=M[v[lt].source].getFeatureState(mt.layer["source-layer"],mt.id);mt.source=mt.layer.source,mt.layer["source-layer"]&&(mt.sourceLayer=mt.layer["source-layer"]),mt.state=ut});return Q}(this._layers,this._serializedLayers,this.sourceCaches,e,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(g)}querySourceFeatures(e,n){n&&n.filter&&this._validate(a.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);let h=this.sourceCaches[e];return h?function(d,g){let v=d.getRenderableIds().map(C=>d.getTileByID(C)),w=[],M={};for(let C=0;C<v.length;C++){let k=v[C],F=k.tileID.canonical.key;M[F]||(M[F]=!0,k.querySourceFeatures(w,g))}return w}(h,n):[]}addSourceType(e,n,h){return Wi.getSourceType(e)?h(new Error(`A source type called "${e}" already exists.`)):(Wi.setSourceType(e,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:n.workerSourceURL},h):h(null,null))}getLight(){return this.light.getLight()}setLight(e,n={}){this._checkLoaded();let h=this.light.getLight(),d=!1;for(let v in e)if(!$(e[v],h[v])){d=!0;break}if(!d)return;let g={now:a.exported.now(),transition:a.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,n),this.light.updateTransitions(g)}_validate(e,n,h,d,g={}){return(!g||g.validate!==!1)&&Me(this,e.call(a.validateStyle,a.extend({key:n,style:this.serialize(),value:h,styleSpec:a.spec},d)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(let e in this._layers)this._layers[e].setEventedParent(null);for(let e in this.sourceCaches){let n=this.sourceCaches[e];n.setEventedParent(null),n.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(let n in this.sourceCaches)this.sourceCaches[n].update(e)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,n,h,d,g=!1){let v=!1,w=!1,M={};for(let C of this._order){let k=this._layers[C];if(k.type!=="symbol")continue;if(!M[k.source]){let q=this.sourceCaches[k.source];M[k.source]=q.getRenderableIds(!0).map(Q=>q.getTileByID(Q)).sort((Q,j)=>j.tileID.overscaledZ-Q.tileID.overscaledZ||(Q.tileID.isLessThan(j.tileID)?-1:1))}let F=this.crossTileSymbolIndex.addLayer(k,M[k.source],e.center.lng);v=v||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((g=g||this._layerOrderChanged||h===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.exported.now(),e.zoom))&&(this.pauseablePlacement=new se(e,this._order,g,n,h,d,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,M),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.exported.now()),w=!0),v&&this.pauseablePlacement.placement.setStale()),w||v)for(let C of this._order){let k=this._layers[C];k.type==="symbol"&&this.placement.updateLayerOpacities(k,M[k.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(a.exported.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,n,h){this.imageManager.getImages(n.icons,h),this._updateTilesForChangedImages();let d=this.sourceCaches[n.source];d&&d.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(e,n,h){this.glyphManager.getGlyphs(n.stacks,h)}getResource(e,n,h){return a.makeRequest(n,h)}}Wi.getSourceType=function(p){return gr[p]},Wi.setSourceType=function(p,e){gr[p]=e},Wi.registerForPluginStateChange=a.registerForPluginStateChange;var Io=a.createLayout([{name:"a_pos",type:"Int16",components:2}]),Co={prelude:ni(`#ifdef GL_ES
4
+ precision mediump float;
5
+ #else
6
+ #if !defined(lowp)
7
+ #define lowp
8
+ #endif
9
+ #if !defined(mediump)
10
+ #define mediump
11
+ #endif
12
+ #if !defined(highp)
13
+ #define highp
14
+ #endif
15
+ #endif`,`#ifdef GL_ES
16
+ precision highp float;
17
+ #else
18
+ #if !defined(lowp)
19
+ #define lowp
20
+ #endif
21
+ #if !defined(mediump)
22
+ #define mediump
23
+ #endif
24
+ #if !defined(highp)
25
+ #define highp
26
+ #endif
27
+ #endif
28
+ 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
29
+ );}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;}`),background:ni(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
30
+ #ifdef OVERDRAW_INSPECTOR
31
+ gl_FragColor=vec4(1.0);
32
+ #endif
33
+ }`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:ni(`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;
34
+ #ifdef OVERDRAW_INSPECTOR
35
+ gl_FragColor=vec4(1.0);
36
+ #endif
37
+ }`,"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);}"),circle:ni(`varying vec3 v_data;
38
+ #pragma mapbox: define highp vec4 color
39
+ #pragma mapbox: define mediump float radius
40
+ #pragma mapbox: define lowp float blur
41
+ #pragma mapbox: define lowp float opacity
42
+ #pragma mapbox: define highp vec4 stroke_color
43
+ #pragma mapbox: define mediump float stroke_width
44
+ #pragma mapbox: define lowp float stroke_opacity
45
+ void main() {
46
+ #pragma mapbox: initialize highp vec4 color
47
+ #pragma mapbox: initialize mediump float radius
48
+ #pragma mapbox: initialize lowp float blur
49
+ #pragma mapbox: initialize lowp float opacity
50
+ #pragma mapbox: initialize highp vec4 stroke_color
51
+ #pragma mapbox: initialize mediump float stroke_width
52
+ #pragma mapbox: initialize lowp float stroke_opacity
53
+ 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);
54
+ #ifdef OVERDRAW_INSPECTOR
55
+ gl_FragColor=vec4(1.0);
56
+ #endif
57
+ }`,`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;
58
+ #pragma mapbox: define highp vec4 color
59
+ #pragma mapbox: define mediump float radius
60
+ #pragma mapbox: define lowp float blur
61
+ #pragma mapbox: define lowp float opacity
62
+ #pragma mapbox: define highp vec4 stroke_color
63
+ #pragma mapbox: define mediump float stroke_width
64
+ #pragma mapbox: define lowp float stroke_opacity
65
+ void main(void) {
66
+ #pragma mapbox: initialize highp vec4 color
67
+ #pragma mapbox: initialize mediump float radius
68
+ #pragma mapbox: initialize lowp float blur
69
+ #pragma mapbox: initialize lowp float opacity
70
+ #pragma mapbox: initialize highp vec4 stroke_color
71
+ #pragma mapbox: initialize mediump float stroke_width
72
+ #pragma mapbox: initialize lowp float stroke_opacity
73
+ 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);}`),clippingMask:ni("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);}"),heatmap:ni(`uniform highp float u_intensity;varying vec2 v_extrude;
74
+ #pragma mapbox: define highp float weight
75
+ #define GAUSS_COEF 0.3989422804014327
76
+ void main() {
77
+ #pragma mapbox: initialize highp float weight
78
+ 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);
79
+ #ifdef OVERDRAW_INSPECTOR
80
+ gl_FragColor=vec4(1.0);
81
+ #endif
82
+ }`,`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;
83
+ #pragma mapbox: define highp float weight
84
+ #pragma mapbox: define mediump float radius
85
+ const highp float ZERO=1.0/255.0/16.0;
86
+ #define GAUSS_COEF 0.3989422804014327
87
+ void main(void) {
88
+ #pragma mapbox: initialize highp float weight
89
+ #pragma mapbox: initialize mediump float radius
90
+ 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;}`),heatmapTexture:ni(`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;
91
+ #ifdef OVERDRAW_INSPECTOR
92
+ gl_FragColor=vec4(0.0);
93
+ #endif
94
+ }`,"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;}"),collisionBox:ni("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;}"),collisionCircle:ni("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);}"),debug:ni("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);}"),fill:ni(`#pragma mapbox: define highp vec4 color
95
+ #pragma mapbox: define lowp float opacity
96
+ void main() {
97
+ #pragma mapbox: initialize highp vec4 color
98
+ #pragma mapbox: initialize lowp float opacity
99
+ gl_FragColor=color*opacity;
100
+ #ifdef OVERDRAW_INSPECTOR
101
+ gl_FragColor=vec4(1.0);
102
+ #endif
103
+ }`,`attribute vec2 a_pos;uniform mat4 u_matrix;
104
+ #pragma mapbox: define highp vec4 color
105
+ #pragma mapbox: define lowp float opacity
106
+ void main() {
107
+ #pragma mapbox: initialize highp vec4 color
108
+ #pragma mapbox: initialize lowp float opacity
109
+ gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:ni(`varying vec2 v_pos;
110
+ #pragma mapbox: define highp vec4 outline_color
111
+ #pragma mapbox: define lowp float opacity
112
+ void main() {
113
+ #pragma mapbox: initialize highp vec4 outline_color
114
+ #pragma mapbox: initialize lowp float opacity
115
+ float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
116
+ #ifdef OVERDRAW_INSPECTOR
117
+ gl_FragColor=vec4(1.0);
118
+ #endif
119
+ }`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
120
+ #pragma mapbox: define highp vec4 outline_color
121
+ #pragma mapbox: define lowp float opacity
122
+ void main() {
123
+ #pragma mapbox: initialize highp vec4 outline_color
124
+ #pragma mapbox: initialize lowp float opacity
125
+ gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:ni(`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;
126
+ #pragma mapbox: define lowp float opacity
127
+ #pragma mapbox: define lowp vec4 pattern_from
128
+ #pragma mapbox: define lowp vec4 pattern_to
129
+ void main() {
130
+ #pragma mapbox: initialize lowp float opacity
131
+ #pragma mapbox: initialize mediump vec4 pattern_from
132
+ #pragma mapbox: initialize mediump vec4 pattern_to
133
+ 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;
134
+ #ifdef OVERDRAW_INSPECTOR
135
+ gl_FragColor=vec4(1.0);
136
+ #endif
137
+ }`,`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;
138
+ #pragma mapbox: define lowp float opacity
139
+ #pragma mapbox: define lowp vec4 pattern_from
140
+ #pragma mapbox: define lowp vec4 pattern_to
141
+ #pragma mapbox: define lowp float pixel_ratio_from
142
+ #pragma mapbox: define lowp float pixel_ratio_to
143
+ void main() {
144
+ #pragma mapbox: initialize lowp float opacity
145
+ #pragma mapbox: initialize mediump vec4 pattern_from
146
+ #pragma mapbox: initialize mediump vec4 pattern_to
147
+ #pragma mapbox: initialize lowp float pixel_ratio_from
148
+ #pragma mapbox: initialize lowp float pixel_ratio_to
149
+ 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;}`),fillPattern:ni(`#ifdef GL_ES
150
+ precision highp float;
151
+ #endif
152
+ uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
153
+ #pragma mapbox: define lowp float opacity
154
+ #pragma mapbox: define lowp vec4 pattern_from
155
+ #pragma mapbox: define lowp vec4 pattern_to
156
+ void main() {
157
+ #pragma mapbox: initialize lowp float opacity
158
+ #pragma mapbox: initialize mediump vec4 pattern_from
159
+ #pragma mapbox: initialize mediump vec4 pattern_to
160
+ 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;
161
+ #ifdef OVERDRAW_INSPECTOR
162
+ gl_FragColor=vec4(1.0);
163
+ #endif
164
+ }`,`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;
165
+ #pragma mapbox: define lowp float opacity
166
+ #pragma mapbox: define lowp vec4 pattern_from
167
+ #pragma mapbox: define lowp vec4 pattern_to
168
+ #pragma mapbox: define lowp float pixel_ratio_from
169
+ #pragma mapbox: define lowp float pixel_ratio_to
170
+ void main() {
171
+ #pragma mapbox: initialize lowp float opacity
172
+ #pragma mapbox: initialize mediump vec4 pattern_from
173
+ #pragma mapbox: initialize mediump vec4 pattern_to
174
+ #pragma mapbox: initialize lowp float pixel_ratio_from
175
+ #pragma mapbox: initialize lowp float pixel_ratio_to
176
+ 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);}`),fillExtrusion:ni(`varying vec4 v_color;void main() {gl_FragColor=v_color;
177
+ #ifdef OVERDRAW_INSPECTOR
178
+ gl_FragColor=vec4(1.0);
179
+ #endif
180
+ }`,`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;
181
+ #pragma mapbox: define highp float base
182
+ #pragma mapbox: define highp float height
183
+ #pragma mapbox: define highp vec4 color
184
+ void main() {
185
+ #pragma mapbox: initialize highp float base
186
+ #pragma mapbox: initialize highp float height
187
+ #pragma mapbox: initialize highp vec4 color
188
+ 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;}`),fillExtrusionPattern:ni(`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;
189
+ #pragma mapbox: define lowp float base
190
+ #pragma mapbox: define lowp float height
191
+ #pragma mapbox: define lowp vec4 pattern_from
192
+ #pragma mapbox: define lowp vec4 pattern_to
193
+ #pragma mapbox: define lowp float pixel_ratio_from
194
+ #pragma mapbox: define lowp float pixel_ratio_to
195
+ void main() {
196
+ #pragma mapbox: initialize lowp float base
197
+ #pragma mapbox: initialize lowp float height
198
+ #pragma mapbox: initialize mediump vec4 pattern_from
199
+ #pragma mapbox: initialize mediump vec4 pattern_to
200
+ #pragma mapbox: initialize lowp float pixel_ratio_from
201
+ #pragma mapbox: initialize lowp float pixel_ratio_to
202
+ 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;
203
+ #ifdef OVERDRAW_INSPECTOR
204
+ gl_FragColor=vec4(1.0);
205
+ #endif
206
+ }`,`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;
207
+ #pragma mapbox: define lowp float base
208
+ #pragma mapbox: define lowp float height
209
+ #pragma mapbox: define lowp vec4 pattern_from
210
+ #pragma mapbox: define lowp vec4 pattern_to
211
+ #pragma mapbox: define lowp float pixel_ratio_from
212
+ #pragma mapbox: define lowp float pixel_ratio_to
213
+ void main() {
214
+ #pragma mapbox: initialize lowp float base
215
+ #pragma mapbox: initialize lowp float height
216
+ #pragma mapbox: initialize mediump vec4 pattern_from
217
+ #pragma mapbox: initialize mediump vec4 pattern_to
218
+ #pragma mapbox: initialize lowp float pixel_ratio_from
219
+ #pragma mapbox: initialize lowp float pixel_ratio_to
220
+ 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
221
+ ? a_pos
222
+ : 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;}`),hillshadePrepare:ni(`#ifdef GL_ES
223
+ precision highp float;
224
+ #endif
225
+ 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);
226
+ #ifdef OVERDRAW_INSPECTOR
227
+ gl_FragColor=vec4(1.0);
228
+ #endif
229
+ }`,"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;}"),hillshade:ni(`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;
230
+ #define PI 3.141592653589793
231
+ 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;
232
+ #ifdef OVERDRAW_INSPECTOR
233
+ gl_FragColor=vec4(1.0);
234
+ #endif
235
+ }`,"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;}"),line:ni(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
236
+ #pragma mapbox: define highp vec4 color
237
+ #pragma mapbox: define lowp float blur
238
+ #pragma mapbox: define lowp float opacity
239
+ void main() {
240
+ #pragma mapbox: initialize highp vec4 color
241
+ #pragma mapbox: initialize lowp float blur
242
+ #pragma mapbox: initialize lowp float opacity
243
+ 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);
244
+ #ifdef OVERDRAW_INSPECTOR
245
+ gl_FragColor=vec4(1.0);
246
+ #endif
247
+ }`,`
248
+ #define scale 0.015873016
249
+ 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;
250
+ #pragma mapbox: define highp vec4 color
251
+ #pragma mapbox: define lowp float blur
252
+ #pragma mapbox: define lowp float opacity
253
+ #pragma mapbox: define mediump float gapwidth
254
+ #pragma mapbox: define lowp float offset
255
+ #pragma mapbox: define mediump float width
256
+ void main() {
257
+ #pragma mapbox: initialize highp vec4 color
258
+ #pragma mapbox: initialize lowp float blur
259
+ #pragma mapbox: initialize lowp float opacity
260
+ #pragma mapbox: initialize mediump float gapwidth
261
+ #pragma mapbox: initialize lowp float offset
262
+ #pragma mapbox: initialize mediump float width
263
+ 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);}`),lineGradient:ni(`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;
264
+ #pragma mapbox: define lowp float blur
265
+ #pragma mapbox: define lowp float opacity
266
+ void main() {
267
+ #pragma mapbox: initialize lowp float blur
268
+ #pragma mapbox: initialize lowp float opacity
269
+ 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);
270
+ #ifdef OVERDRAW_INSPECTOR
271
+ gl_FragColor=vec4(1.0);
272
+ #endif
273
+ }`,`
274
+ #define scale 0.015873016
275
+ 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;
276
+ #pragma mapbox: define lowp float blur
277
+ #pragma mapbox: define lowp float opacity
278
+ #pragma mapbox: define mediump float gapwidth
279
+ #pragma mapbox: define lowp float offset
280
+ #pragma mapbox: define mediump float width
281
+ void main() {
282
+ #pragma mapbox: initialize lowp float blur
283
+ #pragma mapbox: initialize lowp float opacity
284
+ #pragma mapbox: initialize mediump float gapwidth
285
+ #pragma mapbox: initialize lowp float offset
286
+ #pragma mapbox: initialize mediump float width
287
+ 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);}`),linePattern:ni(`#ifdef GL_ES
288
+ precision highp float;
289
+ #endif
290
+ 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;
291
+ #pragma mapbox: define lowp vec4 pattern_from
292
+ #pragma mapbox: define lowp vec4 pattern_to
293
+ #pragma mapbox: define lowp float pixel_ratio_from
294
+ #pragma mapbox: define lowp float pixel_ratio_to
295
+ #pragma mapbox: define lowp float blur
296
+ #pragma mapbox: define lowp float opacity
297
+ void main() {
298
+ #pragma mapbox: initialize mediump vec4 pattern_from
299
+ #pragma mapbox: initialize mediump vec4 pattern_to
300
+ #pragma mapbox: initialize lowp float pixel_ratio_from
301
+ #pragma mapbox: initialize lowp float pixel_ratio_to
302
+ #pragma mapbox: initialize lowp float blur
303
+ #pragma mapbox: initialize lowp float opacity
304
+ 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;
305
+ #ifdef OVERDRAW_INSPECTOR
306
+ gl_FragColor=vec4(1.0);
307
+ #endif
308
+ }`,`
309
+ #define scale 0.015873016
310
+ #define LINE_DISTANCE_SCALE 2.0
311
+ 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;
312
+ #pragma mapbox: define lowp float blur
313
+ #pragma mapbox: define lowp float opacity
314
+ #pragma mapbox: define lowp float offset
315
+ #pragma mapbox: define mediump float gapwidth
316
+ #pragma mapbox: define mediump float width
317
+ #pragma mapbox: define lowp float floorwidth
318
+ #pragma mapbox: define lowp vec4 pattern_from
319
+ #pragma mapbox: define lowp vec4 pattern_to
320
+ #pragma mapbox: define lowp float pixel_ratio_from
321
+ #pragma mapbox: define lowp float pixel_ratio_to
322
+ void main() {
323
+ #pragma mapbox: initialize lowp float blur
324
+ #pragma mapbox: initialize lowp float opacity
325
+ #pragma mapbox: initialize lowp float offset
326
+ #pragma mapbox: initialize mediump float gapwidth
327
+ #pragma mapbox: initialize mediump float width
328
+ #pragma mapbox: initialize lowp float floorwidth
329
+ #pragma mapbox: initialize mediump vec4 pattern_from
330
+ #pragma mapbox: initialize mediump vec4 pattern_to
331
+ #pragma mapbox: initialize lowp float pixel_ratio_from
332
+ #pragma mapbox: initialize lowp float pixel_ratio_to
333
+ 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;}`),lineSDF:ni(`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;
334
+ #pragma mapbox: define highp vec4 color
335
+ #pragma mapbox: define lowp float blur
336
+ #pragma mapbox: define lowp float opacity
337
+ #pragma mapbox: define mediump float width
338
+ #pragma mapbox: define lowp float floorwidth
339
+ void main() {
340
+ #pragma mapbox: initialize highp vec4 color
341
+ #pragma mapbox: initialize lowp float blur
342
+ #pragma mapbox: initialize lowp float opacity
343
+ #pragma mapbox: initialize mediump float width
344
+ #pragma mapbox: initialize lowp float floorwidth
345
+ 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);
346
+ #ifdef OVERDRAW_INSPECTOR
347
+ gl_FragColor=vec4(1.0);
348
+ #endif
349
+ }`,`
350
+ #define scale 0.015873016
351
+ #define LINE_DISTANCE_SCALE 2.0
352
+ 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;
353
+ #pragma mapbox: define highp vec4 color
354
+ #pragma mapbox: define lowp float blur
355
+ #pragma mapbox: define lowp float opacity
356
+ #pragma mapbox: define mediump float gapwidth
357
+ #pragma mapbox: define lowp float offset
358
+ #pragma mapbox: define mediump float width
359
+ #pragma mapbox: define lowp float floorwidth
360
+ void main() {
361
+ #pragma mapbox: initialize highp vec4 color
362
+ #pragma mapbox: initialize lowp float blur
363
+ #pragma mapbox: initialize lowp float opacity
364
+ #pragma mapbox: initialize mediump float gapwidth
365
+ #pragma mapbox: initialize lowp float offset
366
+ #pragma mapbox: initialize mediump float width
367
+ #pragma mapbox: initialize lowp float floorwidth
368
+ 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);}`),raster:ni(`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);
369
+ #ifdef OVERDRAW_INSPECTOR
370
+ gl_FragColor=vec4(1.0);
371
+ #endif
372
+ }`,"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;}"),symbolIcon:ni(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
373
+ #pragma mapbox: define lowp float opacity
374
+ void main() {
375
+ #pragma mapbox: initialize lowp float opacity
376
+ lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
377
+ #ifdef OVERDRAW_INSPECTOR
378
+ gl_FragColor=vec4(1.0);
379
+ #endif
380
+ }`,`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;
381
+ #pragma mapbox: define lowp float opacity
382
+ void main() {
383
+ #pragma mapbox: initialize lowp float opacity
384
+ 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 ?
385
+ camera_to_anchor_distance/u_camera_to_center_distance :
386
+ 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));}`),symbolSDF:ni(`#define SDF_PX 8.0
387
+ 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;
388
+ #pragma mapbox: define highp vec4 fill_color
389
+ #pragma mapbox: define highp vec4 halo_color
390
+ #pragma mapbox: define lowp float opacity
391
+ #pragma mapbox: define lowp float halo_width
392
+ #pragma mapbox: define lowp float halo_blur
393
+ void main() {
394
+ #pragma mapbox: initialize highp vec4 fill_color
395
+ #pragma mapbox: initialize highp vec4 halo_color
396
+ #pragma mapbox: initialize lowp float opacity
397
+ #pragma mapbox: initialize lowp float halo_width
398
+ #pragma mapbox: initialize lowp float halo_blur
399
+ 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);
400
+ #ifdef OVERDRAW_INSPECTOR
401
+ gl_FragColor=vec4(1.0);
402
+ #endif
403
+ }`,`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;
404
+ #pragma mapbox: define highp vec4 fill_color
405
+ #pragma mapbox: define highp vec4 halo_color
406
+ #pragma mapbox: define lowp float opacity
407
+ #pragma mapbox: define lowp float halo_width
408
+ #pragma mapbox: define lowp float halo_blur
409
+ void main() {
410
+ #pragma mapbox: initialize highp vec4 fill_color
411
+ #pragma mapbox: initialize highp vec4 halo_color
412
+ #pragma mapbox: initialize lowp float opacity
413
+ #pragma mapbox: initialize lowp float halo_width
414
+ #pragma mapbox: initialize lowp float halo_blur
415
+ 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 ?
416
+ camera_to_anchor_distance/u_camera_to_center_distance :
417
+ 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);}`),symbolTextAndIcon:ni(`#define SDF_PX 8.0
418
+ #define SDF 1.0
419
+ #define ICON 0.0
420
+ 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;
421
+ #pragma mapbox: define highp vec4 fill_color
422
+ #pragma mapbox: define highp vec4 halo_color
423
+ #pragma mapbox: define lowp float opacity
424
+ #pragma mapbox: define lowp float halo_width
425
+ #pragma mapbox: define lowp float halo_blur
426
+ void main() {
427
+ #pragma mapbox: initialize highp vec4 fill_color
428
+ #pragma mapbox: initialize highp vec4 halo_color
429
+ #pragma mapbox: initialize lowp float opacity
430
+ #pragma mapbox: initialize lowp float halo_width
431
+ #pragma mapbox: initialize lowp float halo_blur
432
+ 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;
433
+ #ifdef OVERDRAW_INSPECTOR
434
+ gl_FragColor=vec4(1.0);
435
+ #endif
436
+ 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);
437
+ #ifdef OVERDRAW_INSPECTOR
438
+ gl_FragColor=vec4(1.0);
439
+ #endif
440
+ }`,`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;
441
+ #pragma mapbox: define highp vec4 fill_color
442
+ #pragma mapbox: define highp vec4 halo_color
443
+ #pragma mapbox: define lowp float opacity
444
+ #pragma mapbox: define lowp float halo_width
445
+ #pragma mapbox: define lowp float halo_blur
446
+ void main() {
447
+ #pragma mapbox: initialize highp vec4 fill_color
448
+ #pragma mapbox: initialize highp vec4 halo_color
449
+ #pragma mapbox: initialize lowp float opacity
450
+ #pragma mapbox: initialize lowp float halo_width
451
+ #pragma mapbox: initialize lowp float halo_blur
452
+ 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 ?
453
+ camera_to_anchor_distance/u_camera_to_center_distance :
454
+ 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 ni(p,e){let n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,h=e.match(/attribute ([\w]+) ([\w]+)/g),d=p.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),g=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),v=g?g.concat(d):d,w={};return{fragmentSource:p=p.replace(n,(M,C,k,F,q)=>(w[q]=!0,C==="define"?`
455
+ #ifndef HAS_UNIFORM_u_${q}
456
+ varying ${k} ${F} ${q};
457
+ #else
458
+ uniform ${k} ${F} u_${q};
459
+ #endif
460
+ `:`
461
+ #ifdef HAS_UNIFORM_u_${q}
462
+ ${k} ${F} ${q} = u_${q};
463
+ #endif
464
+ `)),vertexSource:e=e.replace(n,(M,C,k,F,q)=>{let Q=F==="float"?"vec2":"vec4",j=q.match(/color/)?"color":Q;return w[q]?C==="define"?`
465
+ #ifndef HAS_UNIFORM_u_${q}
466
+ uniform lowp float u_${q}_t;
467
+ attribute ${k} ${Q} a_${q};
468
+ varying ${k} ${F} ${q};
469
+ #else
470
+ uniform ${k} ${F} u_${q};
471
+ #endif
472
+ `:j==="vec4"?`
473
+ #ifndef HAS_UNIFORM_u_${q}
474
+ ${q} = a_${q};
475
+ #else
476
+ ${k} ${F} ${q} = u_${q};
477
+ #endif
478
+ `:`
479
+ #ifndef HAS_UNIFORM_u_${q}
480
+ ${q} = unpack_mix_${j}(a_${q}, u_${q}_t);
481
+ #else
482
+ ${k} ${F} ${q} = u_${q};
483
+ #endif
484
+ `:C==="define"?`
485
+ #ifndef HAS_UNIFORM_u_${q}
486
+ uniform lowp float u_${q}_t;
487
+ attribute ${k} ${Q} a_${q};
488
+ #else
489
+ uniform ${k} ${F} u_${q};
490
+ #endif
491
+ `:j==="vec4"?`
492
+ #ifndef HAS_UNIFORM_u_${q}
493
+ ${k} ${F} ${q} = a_${q};
494
+ #else
495
+ ${k} ${F} ${q} = u_${q};
496
+ #endif
497
+ `:`
498
+ #ifndef HAS_UNIFORM_u_${q}
499
+ ${k} ${F} ${q} = unpack_mix_${j}(a_${q}, u_${q}_t);
500
+ #else
501
+ ${k} ${F} ${q} = u_${q};
502
+ #endif
503
+ `}),staticAttributes:h,staticUniforms:v}}class Ec{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,n,h,d,g,v,w,M){this.context=e;let C=this.boundPaintVertexBuffers.length!==d.length;for(let k=0;!C&&k<d.length;k++)this.boundPaintVertexBuffers[k]!==d[k]&&(C=!0);e.extVertexArrayObject&&this.vao&&this.boundProgram===n&&this.boundLayoutVertexBuffer===h&&!C&&this.boundIndexBuffer===g&&this.boundVertexOffset===v&&this.boundDynamicVertexBuffer===w&&this.boundDynamicVertexBuffer2===M?(e.bindVertexArrayOES.set(this.vao),w&&w.bind(),g&&g.dynamicDraw&&g.bind(),M&&M.bind()):this.freshBind(n,h,d,g,v,w,M)}freshBind(e,n,h,d,g,v,w){let M,C=e.numAttributes,k=this.context,F=k.gl;if(k.extVertexArrayObject)this.vao&&this.destroy(),this.vao=k.extVertexArrayObject.createVertexArrayOES(),k.bindVertexArrayOES.set(this.vao),M=0,this.boundProgram=e,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=h,this.boundIndexBuffer=d,this.boundVertexOffset=g,this.boundDynamicVertexBuffer=v,this.boundDynamicVertexBuffer2=w;else{M=k.currentNumAttributes||0;for(let q=C;q<M;q++)F.disableVertexAttribArray(q)}n.enableAttributes(F,e);for(let q of h)q.enableAttributes(F,e);v&&v.enableAttributes(F,e),w&&w.enableAttributes(F,e),n.bind(),n.setVertexAttribPointers(F,e,g);for(let q of h)q.bind(),q.setVertexAttribPointers(F,e,g);v&&(v.bind(),v.setVertexAttribPointers(F,e,g)),d&&d.bind(),w&&(w.bind(),w.setVertexAttribPointers(F,e,g)),k.currentNumAttributes=C}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function Ao(p){let e=[];for(let n=0;n<p.length;n++){if(p[n]===null)continue;let h=p[n].split(" ");e.push(h.pop())}return e}class Ic{constructor(e,n,h,d,g,v){let w=e.gl;this.program=w.createProgram();let M=Ao(h.staticAttributes),C=d?d.getBinderAttributes():[],k=M.concat(C),F=h.staticUniforms?Ao(h.staticUniforms):[],q=d?d.getBinderUniforms():[],Q=F.concat(q),j=[];for(let Mt of Q)j.indexOf(Mt)<0&&j.push(Mt);let J=d?d.defines():[];v&&J.push("#define OVERDRAW_INSPECTOR;");let lt=J.concat(Co.prelude.fragmentSource,h.fragmentSource).join(`
504
+ `),ht=J.concat(Co.prelude.vertexSource,h.vertexSource).join(`
505
+ `),mt=w.createShader(w.FRAGMENT_SHADER);if(w.isContextLost())return void(this.failedToCreate=!0);w.shaderSource(mt,lt),w.compileShader(mt),w.attachShader(this.program,mt);let ut=w.createShader(w.VERTEX_SHADER);if(w.isContextLost())return void(this.failedToCreate=!0);w.shaderSource(ut,ht),w.compileShader(ut),w.attachShader(this.program,ut),this.attributes={};let At={};this.numAttributes=k.length;for(let Mt=0;Mt<this.numAttributes;Mt++)k[Mt]&&(w.bindAttribLocation(this.program,Mt,k[Mt]),this.attributes[k[Mt]]=Mt);w.linkProgram(this.program),w.deleteShader(ut),w.deleteShader(mt);for(let Mt=0;Mt<j.length;Mt++){let Tt=j[Mt];if(Tt&&!At[Tt]){let Ft=w.getUniformLocation(this.program,Tt);Ft&&(At[Tt]=Ft)}}this.fixedUniforms=g(e,At),this.binderUniforms=d?d.getUniforms(e,At):[]}draw(e,n,h,d,g,v,w,M,C,k,F,q,Q,j,J,lt){let ht=e.gl;if(this.failedToCreate)return;e.program.set(this.program),e.setDepthMode(h),e.setStencilMode(d),e.setColorMode(g),e.setCullFace(v);for(let ut in this.fixedUniforms)this.fixedUniforms[ut].set(w[ut]);j&&j.setUniforms(e,this.binderUniforms,q,{zoom:Q});let mt={[ht.LINES]:2,[ht.TRIANGLES]:3,[ht.LINE_STRIP]:1}[n];for(let ut of F.get()){let At=ut.vaos||(ut.vaos={});(At[M]||(At[M]=new Ec)).bind(e,this,C,j?j.getPaintVertexBuffers():[],k,ut.vertexOffset,J,lt),ht.drawElements(n,ut.primitiveLength*mt,ht.UNSIGNED_SHORT,ut.primitiveOffset*mt*2)}}}function Po(p,e,n){let h=1/gi(n,1,e.transform.tileZoom),d=Math.pow(2,n.tileID.overscaledZ),g=n.tileSize*Math.pow(2,e.transform.tileZoom)/d,v=g*(n.tileID.canonical.x+n.tileID.wrap*d),w=g*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[h,p.fromScale,p.toScale],u_fade:p.t,u_pixel_coord_upper:[v>>16,w>>16],u_pixel_coord_lower:[65535&v,65535&w]}}let ql=(p,e,n,h)=>{let d=e.style.light,g=d.properties.get("position"),v=[g.x,g.y,g.z],w=function(){var C=new a.ARRAY_TYPE(9);return a.ARRAY_TYPE!=Float32Array&&(C[1]=0,C[2]=0,C[3]=0,C[5]=0,C[6]=0,C[7]=0),C[0]=1,C[4]=1,C[8]=1,C}();d.properties.get("anchor")==="viewport"&&function(C,k){var F=Math.sin(k),q=Math.cos(k);C[0]=q,C[1]=F,C[2]=0,C[3]=-F,C[4]=q,C[5]=0,C[6]=0,C[7]=0,C[8]=1}(w,-e.transform.angle),function(C,k,F){var q=k[0],Q=k[1],j=k[2];C[0]=q*F[0]+Q*F[3]+j*F[6],C[1]=q*F[1]+Q*F[4]+j*F[7],C[2]=q*F[2]+Q*F[5]+j*F[8]}(v,v,w);let M=d.properties.get("color");return{u_matrix:p,u_lightpos:v,u_lightintensity:d.properties.get("intensity"),u_lightcolor:[M.r,M.g,M.b],u_vertical_gradient:+n,u_opacity:h}},zo=(p,e,n,h,d,g,v)=>a.extend(ql(p,e,n,h),Po(g,e,v),{u_height_factor:-Math.pow(2,d.overscaledZ)/v.tileSize/8}),ko=p=>({u_matrix:p}),Lo=(p,e,n,h)=>a.extend(ko(p),Po(n,e,h)),jl=(p,e)=>({u_matrix:p,u_world:e}),$l=(p,e,n,h,d)=>a.extend(Lo(p,e,n,h),{u_world:d}),Bn=(p,e,n,h)=>{let d=p.transform,g,v;if(h.paint.get("circle-pitch-alignment")==="map"){let w=gi(n,1,d.zoom);g=!0,v=[w,w]}else g=!1,v=d.pixelsToGLUnits;return{u_camera_to_center_distance:d.cameraToCenterDistance,u_scale_with_map:+(h.paint.get("circle-pitch-scale")==="map"),u_matrix:p.translatePosMatrix(e.posMatrix,n,h.paint.get("circle-translate"),h.paint.get("circle-translate-anchor")),u_pitch_with_map:+g,u_device_pixel_ratio:p.pixelRatio,u_extrude_scale:v}},Ma=(p,e,n)=>{let h=gi(n,1,e.zoom),d=Math.pow(2,e.zoom-n.tileID.overscaledZ),g=n.tileID.overscaleFactor();return{u_matrix:p,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:h,u_extrude_scale:[e.pixelsToGLUnits[0]/(h*d),e.pixelsToGLUnits[1]/(h*d)],u_overscale_factor:g}},fs=(p,e,n=1)=>({u_matrix:p,u_color:e,u_overlay:0,u_overlay_scale:n}),Gs=p=>({u_matrix:p}),Sa=(p,e,n,h)=>({u_matrix:p,u_extrude_scale:gi(e,1,n),u_intensity:h});function Ta(p,e){let n=Math.pow(2,e.canonical.z),h=e.canonical.y;return[new a.MercatorCoordinate(0,h/n).toLngLat().lat,new a.MercatorCoordinate(0,(h+1)/n).toLngLat().lat]}let qs=(p,e,n)=>{let h=p.transform;return{u_matrix:Do(p,e,n),u_ratio:1/gi(e,1,h.zoom),u_device_pixel_ratio:p.pixelRatio,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},Ea=(p,e,n,h)=>a.extend(qs(p,e,n),{u_image:0,u_image_height:h}),js=(p,e,n,h)=>{let d=p.transform,g=$s(e,d);return{u_matrix:Do(p,e,n),u_texsize:e.imageAtlasTexture.size,u_ratio:1/gi(e,1,d.zoom),u_device_pixel_ratio:p.pixelRatio,u_image:0,u_scale:[g,h.fromScale,h.toScale],u_fade:h.t,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},Ci=(p,e,n,h,d)=>{let g=p.lineAtlas,v=$s(e,p.transform),w=n.layout.get("line-cap")==="round",M=g.getDash(h.from,w),C=g.getDash(h.to,w),k=M.width*d.fromScale,F=C.width*d.toScale;return a.extend(qs(p,e,n),{u_patternscale_a:[v/k,-M.height/2],u_patternscale_b:[v/F,-C.height/2],u_sdfgamma:g.width/(256*Math.min(k,F)*p.pixelRatio)/2,u_image:0,u_tex_y_a:M.y,u_tex_y_b:C.y,u_mix:d.t})};function $s(p,e){return 1/gi(p,1,e.tileZoom)}function Do(p,e,n){return p.translatePosMatrix(e.tileID.posMatrix,e,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}let Wl=(p,e,n,h,d)=>{return{u_matrix:p,u_tl_parent:e,u_scale_parent:n,u_buffer_scale:1,u_fade_t:h.mix,u_opacity:h.opacity*d.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:d.paint.get("raster-brightness-min"),u_brightness_high:d.paint.get("raster-brightness-max"),u_saturation_factor:(v=d.paint.get("raster-saturation"),v>0?1-1/(1.001-v):-v),u_contrast_factor:(g=d.paint.get("raster-contrast"),g>0?1/(1-g):1+g),u_spin_weights:Zl(d.paint.get("raster-hue-rotate"))};var g,v};function Zl(p){p*=Math.PI/180;let e=Math.sin(p),n=Math.cos(p);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}let Ia=(p,e,n,h,d,g,v,w,M,C)=>{let k=d.transform;return{u_is_size_zoom_constant:+(p==="constant"||p==="source"),u_is_size_feature_constant:+(p==="constant"||p==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:k.cameraToCenterDistance,u_pitch:k.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:k.width/k.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:g,u_label_plane_matrix:v,u_coord_matrix:w,u_is_text:+M,u_pitch_with_map:+h,u_texsize:C,u_texture:0}},Ro=(p,e,n,h,d,g,v,w,M,C,k)=>{let F=d.transform;return a.extend(Ia(p,e,n,h,d,g,v,w,M,C),{u_gamma_scale:h?Math.cos(F._pitch)*F.cameraToCenterDistance:1,u_device_pixel_ratio:d.pixelRatio,u_is_halo:+k})},Cc=(p,e,n,h,d,g,v,w,M,C)=>a.extend(Ro(p,e,n,h,d,g,v,w,!0,M,!0),{u_texsize_icon:C,u_texture_icon:1}),Ac=(p,e,n)=>({u_matrix:p,u_opacity:e,u_color:n}),Bo=(p,e,n,h,d,g)=>a.extend(function(v,w,M,C){let k=M.imageManager.getPattern(v.from.toString()),F=M.imageManager.getPattern(v.to.toString()),{width:q,height:Q}=M.imageManager.getPixelSize(),j=Math.pow(2,C.tileID.overscaledZ),J=C.tileSize*Math.pow(2,M.transform.tileZoom)/j,lt=J*(C.tileID.canonical.x+C.tileID.wrap*j),ht=J*C.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:k.tl,u_pattern_br_a:k.br,u_pattern_tl_b:F.tl,u_pattern_br_b:F.br,u_texsize:[q,Q],u_mix:w.t,u_pattern_size_a:k.displaySize,u_pattern_size_b:F.displaySize,u_scale_a:w.fromScale,u_scale_b:w.toScale,u_tile_units_to_pixels:1/gi(C,1,M.transform.tileZoom),u_pixel_coord_upper:[lt>>16,ht>>16],u_pixel_coord_lower:[65535&lt,65535&ht]}}(h,g,n,d),{u_matrix:p,u_opacity:e}),Fo={fillExtrusion:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_lightpos:new a.Uniform3f(p,e.u_lightpos),u_lightintensity:new a.Uniform1f(p,e.u_lightintensity),u_lightcolor:new a.Uniform3f(p,e.u_lightcolor),u_vertical_gradient:new a.Uniform1f(p,e.u_vertical_gradient),u_opacity:new a.Uniform1f(p,e.u_opacity)}),fillExtrusionPattern:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_lightpos:new a.Uniform3f(p,e.u_lightpos),u_lightintensity:new a.Uniform1f(p,e.u_lightintensity),u_lightcolor:new a.Uniform3f(p,e.u_lightcolor),u_vertical_gradient:new a.Uniform1f(p,e.u_vertical_gradient),u_height_factor:new a.Uniform1f(p,e.u_height_factor),u_image:new a.Uniform1i(p,e.u_image),u_texsize:new a.Uniform2f(p,e.u_texsize),u_pixel_coord_upper:new a.Uniform2f(p,e.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(p,e.u_pixel_coord_lower),u_scale:new a.Uniform3f(p,e.u_scale),u_fade:new a.Uniform1f(p,e.u_fade),u_opacity:new a.Uniform1f(p,e.u_opacity)}),fill:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix)}),fillPattern:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_image:new a.Uniform1i(p,e.u_image),u_texsize:new a.Uniform2f(p,e.u_texsize),u_pixel_coord_upper:new a.Uniform2f(p,e.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(p,e.u_pixel_coord_lower),u_scale:new a.Uniform3f(p,e.u_scale),u_fade:new a.Uniform1f(p,e.u_fade)}),fillOutline:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_world:new a.Uniform2f(p,e.u_world)}),fillOutlinePattern:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_world:new a.Uniform2f(p,e.u_world),u_image:new a.Uniform1i(p,e.u_image),u_texsize:new a.Uniform2f(p,e.u_texsize),u_pixel_coord_upper:new a.Uniform2f(p,e.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(p,e.u_pixel_coord_lower),u_scale:new a.Uniform3f(p,e.u_scale),u_fade:new a.Uniform1f(p,e.u_fade)}),circle:(p,e)=>({u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_scale_with_map:new a.Uniform1i(p,e.u_scale_with_map),u_pitch_with_map:new a.Uniform1i(p,e.u_pitch_with_map),u_extrude_scale:new a.Uniform2f(p,e.u_extrude_scale),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_matrix:new a.UniformMatrix4f(p,e.u_matrix)}),collisionBox:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_pixels_to_tile_units:new a.Uniform1f(p,e.u_pixels_to_tile_units),u_extrude_scale:new a.Uniform2f(p,e.u_extrude_scale),u_overscale_factor:new a.Uniform1f(p,e.u_overscale_factor)}),collisionCircle:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_inv_matrix:new a.UniformMatrix4f(p,e.u_inv_matrix),u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_viewport_size:new a.Uniform2f(p,e.u_viewport_size)}),debug:(p,e)=>({u_color:new a.UniformColor(p,e.u_color),u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_overlay:new a.Uniform1i(p,e.u_overlay),u_overlay_scale:new a.Uniform1f(p,e.u_overlay_scale)}),clippingMask:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix)}),heatmap:(p,e)=>({u_extrude_scale:new a.Uniform1f(p,e.u_extrude_scale),u_intensity:new a.Uniform1f(p,e.u_intensity),u_matrix:new a.UniformMatrix4f(p,e.u_matrix)}),heatmapTexture:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_world:new a.Uniform2f(p,e.u_world),u_image:new a.Uniform1i(p,e.u_image),u_color_ramp:new a.Uniform1i(p,e.u_color_ramp),u_opacity:new a.Uniform1f(p,e.u_opacity)}),hillshade:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_image:new a.Uniform1i(p,e.u_image),u_latrange:new a.Uniform2f(p,e.u_latrange),u_light:new a.Uniform2f(p,e.u_light),u_shadow:new a.UniformColor(p,e.u_shadow),u_highlight:new a.UniformColor(p,e.u_highlight),u_accent:new a.UniformColor(p,e.u_accent)}),hillshadePrepare:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_image:new a.Uniform1i(p,e.u_image),u_dimension:new a.Uniform2f(p,e.u_dimension),u_zoom:new a.Uniform1f(p,e.u_zoom),u_unpack:new a.Uniform4f(p,e.u_unpack)}),line:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_ratio:new a.Uniform1f(p,e.u_ratio),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(p,e.u_units_to_pixels)}),lineGradient:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_ratio:new a.Uniform1f(p,e.u_ratio),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(p,e.u_units_to_pixels),u_image:new a.Uniform1i(p,e.u_image),u_image_height:new a.Uniform1f(p,e.u_image_height)}),linePattern:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_texsize:new a.Uniform2f(p,e.u_texsize),u_ratio:new a.Uniform1f(p,e.u_ratio),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_image:new a.Uniform1i(p,e.u_image),u_units_to_pixels:new a.Uniform2f(p,e.u_units_to_pixels),u_scale:new a.Uniform3f(p,e.u_scale),u_fade:new a.Uniform1f(p,e.u_fade)}),lineSDF:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_ratio:new a.Uniform1f(p,e.u_ratio),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_units_to_pixels:new a.Uniform2f(p,e.u_units_to_pixels),u_patternscale_a:new a.Uniform2f(p,e.u_patternscale_a),u_patternscale_b:new a.Uniform2f(p,e.u_patternscale_b),u_sdfgamma:new a.Uniform1f(p,e.u_sdfgamma),u_image:new a.Uniform1i(p,e.u_image),u_tex_y_a:new a.Uniform1f(p,e.u_tex_y_a),u_tex_y_b:new a.Uniform1f(p,e.u_tex_y_b),u_mix:new a.Uniform1f(p,e.u_mix)}),raster:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_tl_parent:new a.Uniform2f(p,e.u_tl_parent),u_scale_parent:new a.Uniform1f(p,e.u_scale_parent),u_buffer_scale:new a.Uniform1f(p,e.u_buffer_scale),u_fade_t:new a.Uniform1f(p,e.u_fade_t),u_opacity:new a.Uniform1f(p,e.u_opacity),u_image0:new a.Uniform1i(p,e.u_image0),u_image1:new a.Uniform1i(p,e.u_image1),u_brightness_low:new a.Uniform1f(p,e.u_brightness_low),u_brightness_high:new a.Uniform1f(p,e.u_brightness_high),u_saturation_factor:new a.Uniform1f(p,e.u_saturation_factor),u_contrast_factor:new a.Uniform1f(p,e.u_contrast_factor),u_spin_weights:new a.Uniform3f(p,e.u_spin_weights)}),symbolIcon:(p,e)=>({u_is_size_zoom_constant:new a.Uniform1i(p,e.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(p,e.u_is_size_feature_constant),u_size_t:new a.Uniform1f(p,e.u_size_t),u_size:new a.Uniform1f(p,e.u_size),u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_pitch:new a.Uniform1f(p,e.u_pitch),u_rotate_symbol:new a.Uniform1i(p,e.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(p,e.u_aspect_ratio),u_fade_change:new a.Uniform1f(p,e.u_fade_change),u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(p,e.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(p,e.u_coord_matrix),u_is_text:new a.Uniform1i(p,e.u_is_text),u_pitch_with_map:new a.Uniform1i(p,e.u_pitch_with_map),u_texsize:new a.Uniform2f(p,e.u_texsize),u_texture:new a.Uniform1i(p,e.u_texture)}),symbolSDF:(p,e)=>({u_is_size_zoom_constant:new a.Uniform1i(p,e.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(p,e.u_is_size_feature_constant),u_size_t:new a.Uniform1f(p,e.u_size_t),u_size:new a.Uniform1f(p,e.u_size),u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_pitch:new a.Uniform1f(p,e.u_pitch),u_rotate_symbol:new a.Uniform1i(p,e.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(p,e.u_aspect_ratio),u_fade_change:new a.Uniform1f(p,e.u_fade_change),u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(p,e.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(p,e.u_coord_matrix),u_is_text:new a.Uniform1i(p,e.u_is_text),u_pitch_with_map:new a.Uniform1i(p,e.u_pitch_with_map),u_texsize:new a.Uniform2f(p,e.u_texsize),u_texture:new a.Uniform1i(p,e.u_texture),u_gamma_scale:new a.Uniform1f(p,e.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(p,e.u_is_halo)}),symbolTextAndIcon:(p,e)=>({u_is_size_zoom_constant:new a.Uniform1i(p,e.u_is_size_zoom_constant),u_is_size_feature_constant:new a.Uniform1i(p,e.u_is_size_feature_constant),u_size_t:new a.Uniform1f(p,e.u_size_t),u_size:new a.Uniform1f(p,e.u_size),u_camera_to_center_distance:new a.Uniform1f(p,e.u_camera_to_center_distance),u_pitch:new a.Uniform1f(p,e.u_pitch),u_rotate_symbol:new a.Uniform1i(p,e.u_rotate_symbol),u_aspect_ratio:new a.Uniform1f(p,e.u_aspect_ratio),u_fade_change:new a.Uniform1f(p,e.u_fade_change),u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_label_plane_matrix:new a.UniformMatrix4f(p,e.u_label_plane_matrix),u_coord_matrix:new a.UniformMatrix4f(p,e.u_coord_matrix),u_is_text:new a.Uniform1i(p,e.u_is_text),u_pitch_with_map:new a.Uniform1i(p,e.u_pitch_with_map),u_texsize:new a.Uniform2f(p,e.u_texsize),u_texsize_icon:new a.Uniform2f(p,e.u_texsize_icon),u_texture:new a.Uniform1i(p,e.u_texture),u_texture_icon:new a.Uniform1i(p,e.u_texture_icon),u_gamma_scale:new a.Uniform1f(p,e.u_gamma_scale),u_device_pixel_ratio:new a.Uniform1f(p,e.u_device_pixel_ratio),u_is_halo:new a.Uniform1i(p,e.u_is_halo)}),background:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_opacity:new a.Uniform1f(p,e.u_opacity),u_color:new a.UniformColor(p,e.u_color)}),backgroundPattern:(p,e)=>({u_matrix:new a.UniformMatrix4f(p,e.u_matrix),u_opacity:new a.Uniform1f(p,e.u_opacity),u_image:new a.Uniform1i(p,e.u_image),u_pattern_tl_a:new a.Uniform2f(p,e.u_pattern_tl_a),u_pattern_br_a:new a.Uniform2f(p,e.u_pattern_br_a),u_pattern_tl_b:new a.Uniform2f(p,e.u_pattern_tl_b),u_pattern_br_b:new a.Uniform2f(p,e.u_pattern_br_b),u_texsize:new a.Uniform2f(p,e.u_texsize),u_mix:new a.Uniform1f(p,e.u_mix),u_pattern_size_a:new a.Uniform2f(p,e.u_pattern_size_a),u_pattern_size_b:new a.Uniform2f(p,e.u_pattern_size_b),u_scale_a:new a.Uniform1f(p,e.u_scale_a),u_scale_b:new a.Uniform1f(p,e.u_scale_b),u_pixel_coord_upper:new a.Uniform2f(p,e.u_pixel_coord_upper),u_pixel_coord_lower:new a.Uniform2f(p,e.u_pixel_coord_lower),u_tile_units_to_pixels:new a.Uniform1f(p,e.u_tile_units_to_pixels)})};class Oo{constructor(e,n,h){this.context=e;let d=e.gl;this.buffer=d.createBuffer(),this.dynamicDraw=Boolean(h),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let n=this.context.gl;this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let No={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Hl{constructor(e,n,h,d){this.length=n.length,this.attributes=h,this.itemSize=n.bytesPerElement,this.dynamicDraw=d,this.context=e;let g=e.gl;this.buffer=g.createBuffer(),e.bindVertexBuffer.set(this.buffer),g.bufferData(g.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){let n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,n){for(let h=0;h<this.attributes.length;h++){let d=n.attributes[this.attributes[h].name];d!==void 0&&e.enableVertexAttribArray(d)}}setVertexAttribPointers(e,n,h){for(let d=0;d<this.attributes.length;d++){let g=this.attributes[d],v=n.attributes[g.name];v!==void 0&&e.vertexAttribPointer(v,g.components,e[No[g.type]],!1,this.itemSize,g.offset+this.itemSize*(h||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class $e{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Pc extends $e{getDefault(){return a.Color.transparent}set(e){let n=this.current;(e.r!==n.r||e.g!==n.g||e.b!==n.b||e.a!==n.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Ws extends $e{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Zs extends $e{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Xl extends $e{getDefault(){return[!0,!0,!0,!0]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||e[3]!==n[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class _r extends $e{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Uo extends $e{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Ca extends $e{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let n=this.current;(e.func!==n.func||e.ref!==n.ref||e.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class Aa extends $e{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Vo extends $e{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;e?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=e,this.dirty=!1}}class Go extends $e{getDefault(){return[0,1]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Pa extends $e{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;e?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=e,this.dirty=!1}}class qo extends $e{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class jo extends $e{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;e?n.enable(n.BLEND):n.disable(n.BLEND),this.current=e,this.dirty=!1}}class za extends $e{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class Kl extends $e{getDefault(){return a.Color.transparent}set(e){let n=this.current;(e.r!==n.r||e.g!==n.g||e.b!==n.b||e.a!==n.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Yl extends $e{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class ms extends $e{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;e?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=e,this.dirty=!1}}class zc extends $e{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class kc extends $e{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class Lc extends $e{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Dc extends $e{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Rc extends $e{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let n=this.current;(e[0]!==n[0]||e[1]!==n[1]||e[2]!==n[2]||e[3]!==n[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Bc extends $e{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class $o extends $e{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Wo extends $e{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.bindTexture(n.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class gs extends $e{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Jl extends $e{getDefault(){return null}set(e){let n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Ql extends $e{constructor(e){super(e),this.vao=e.extVertexArrayObject}getDefault(){return null}set(e){this.vao&&(e!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(e),this.current=e,this.dirty=!1)}}class Zo extends $e{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Fn extends $e{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class th extends $e{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class On extends $e{constructor(e,n){super(e),this.context=e,this.parent=n}getDefault(){return null}}class ys extends On{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class eh extends On{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Ho{constructor(e,n,h,d){this.context=e,this.width=n,this.height=h;let g=this.framebuffer=e.gl.createFramebuffer();this.colorAttachment=new ys(e,g),d&&(this.depthAttachment=new eh(e,g))}destroy(){let e=this.context.gl,n=this.colorAttachment.get();if(n&&e.deleteTexture(n),this.depthAttachment){let h=this.depthAttachment.get();h&&e.deleteRenderbuffer(h)}e.deleteFramebuffer(this.framebuffer)}}class we{constructor(e,n,h){this.blendFunction=e,this.blendColor=n,this.mask=h}}we.Replace=[1,0],we.disabled=new we(we.Replace,a.Color.transparent,[!1,!1,!1,!1]),we.unblended=new we(we.Replace,a.Color.transparent,[!0,!0,!0,!0]),we.alphaBlended=new we([1,771],a.Color.transparent,[!0,!0,!0,!0]);class ka{constructor(e){this.gl=e,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new Pc(this),this.clearDepth=new Ws(this),this.clearStencil=new Zs(this),this.colorMask=new Xl(this),this.depthMask=new _r(this),this.stencilMask=new Uo(this),this.stencilFunc=new Ca(this),this.stencilOp=new Aa(this),this.stencilTest=new Vo(this),this.depthRange=new Go(this),this.depthTest=new Pa(this),this.depthFunc=new qo(this),this.blend=new jo(this),this.blendFunc=new za(this),this.blendColor=new Kl(this),this.blendEquation=new Yl(this),this.cullFace=new ms(this),this.cullFaceSide=new zc(this),this.frontFace=new kc(this),this.program=new Lc(this),this.activeTexture=new Dc(this),this.viewport=new Rc(this),this.bindFramebuffer=new Bc(this),this.bindRenderbuffer=new $o(this),this.bindTexture=new Wo(this),this.bindVertexBuffer=new gs(this),this.bindElementBuffer=new Jl(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new Ql(this),this.pixelStoreUnpack=new Zo(this),this.pixelStoreUnpackPremultiplyAlpha=new Fn(this),this.pixelStoreUnpackFlipY=new th(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=e.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(e.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,n){return new Oo(this,e,n)}createVertexBuffer(e,n,h){return new Hl(this,e,n,h)}createRenderbuffer(e,n,h){let d=this.gl,g=d.createRenderbuffer();return this.bindRenderbuffer.set(g),d.renderbufferStorage(d.RENDERBUFFER,e,n,h),this.bindRenderbuffer.set(null),g}createFramebuffer(e,n,h){return new Ho(this,e,n,h)}clear({color:e,depth:n}){let h=this.gl,d=0;e&&(d|=h.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(d|=h.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),h.clear(d)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){$(e.blendFunction,we.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class Ye{constructor(e,n,h){this.func=e,this.mask=n,this.range=h}}Ye.ReadOnly=!1,Ye.ReadWrite=!0,Ye.disabled=new Ye(519,Ye.ReadOnly,[0,1]);let La=7680;class li{constructor(e,n,h,d,g,v){this.test=e,this.ref=n,this.mask=h,this.fail=d,this.depthFail=g,this.pass=v}}li.disabled=new li({func:519,mask:0},0,0,La,La,La);class vi{constructor(e,n,h){this.enable=e,this.mode=n,this.frontFace=h}}let Da;function Xo(p,e,n,h,d,g,v){let w=p.context,M=w.gl,C=p.useProgram("collisionBox"),k=[],F=0,q=0;for(let ut=0;ut<h.length;ut++){let At=h[ut],Mt=e.getTile(At),Tt=Mt.getBucket(n);if(!Tt)continue;let Ft=At.posMatrix;d[0]===0&&d[1]===0||(Ft=p.translatePosMatrix(At.posMatrix,Mt,d,g));let jt=v?Tt.textCollisionBox:Tt.iconCollisionBox,It=Tt.collisionCircleArray;if(It.length>0){let ie=a.create(),Ht=Ft;a.mul(ie,Tt.placementInvProjMatrix,p.transform.glCoordMatrix),a.mul(ie,ie,Tt.placementViewportMatrix),k.push({circleArray:It,circleOffset:q,transform:Ht,invTransform:ie}),F+=It.length/4,q=F}jt&&C.draw(w,M.LINES,Ye.disabled,li.disabled,p.colorModeForRenderPass(),vi.disabled,Ma(Ft,p.transform,Mt),n.id,jt.layoutVertexBuffer,jt.indexBuffer,jt.segments,null,p.transform.zoom,null,null,jt.collisionVertexBuffer)}if(!v||!k.length)return;let Q=p.useProgram("collisionCircle"),j=new a.CollisionCircleLayoutArray;j.resize(4*F),j._trim();let J=0;for(let ut of k)for(let At=0;At<ut.circleArray.length/4;At++){let Mt=4*At,Tt=ut.circleArray[Mt+0],Ft=ut.circleArray[Mt+1],jt=ut.circleArray[Mt+2],It=ut.circleArray[Mt+3];j.emplace(J++,Tt,Ft,jt,It,0),j.emplace(J++,Tt,Ft,jt,It,1),j.emplace(J++,Tt,Ft,jt,It,2),j.emplace(J++,Tt,Ft,jt,It,3)}(!Da||Da.length<2*F)&&(Da=function(ut){let At=2*ut,Mt=new a.QuadTriangleArray;Mt.resize(At),Mt._trim();for(let Tt=0;Tt<At;Tt++){let Ft=6*Tt;Mt.uint16[Ft+0]=4*Tt+0,Mt.uint16[Ft+1]=4*Tt+1,Mt.uint16[Ft+2]=4*Tt+2,Mt.uint16[Ft+3]=4*Tt+2,Mt.uint16[Ft+4]=4*Tt+3,Mt.uint16[Ft+5]=4*Tt+0}return Mt}(F));let lt=w.createIndexBuffer(Da,!0),ht=w.createVertexBuffer(j,a.collisionCircleLayout.members,!0);for(let ut of k){let At={u_matrix:ut.transform,u_inv_matrix:ut.invTransform,u_camera_to_center_distance:(mt=p.transform).cameraToCenterDistance,u_viewport_size:[mt.width,mt.height]};Q.draw(w,M.TRIANGLES,Ye.disabled,li.disabled,p.colorModeForRenderPass(),vi.disabled,At,n.id,ht,lt,a.SegmentVector.simpleSegment(0,2*ut.circleOffset,ut.circleArray.length,ut.circleArray.length/2),null,p.transform.zoom,null,null,null)}var mt;ht.destroy(),lt.destroy()}vi.disabled=new vi(!1,1029,2305),vi.backCCW=new vi(!0,1029,2305);let Fc=a.identity(new Float32Array(16));function Ko(p,e,n,h,d,g){let{horizontalAlign:v,verticalAlign:w}=a.getAnchorAlignment(p),M=-(v-.5)*e,C=-(w-.5)*n,k=a.evaluateVariableOffset(p,h);return new a.pointGeometry((M/d+k[0])*g,(C/d+k[1])*g)}function Ra(p,e,n,h,d,g,v,w,M,C){let k=p.text.placedSymbolArray,F=p.text.dynamicLayoutVertexArray,q=p.icon.dynamicLayoutVertexArray,Q={};F.clear();for(let j=0;j<k.length;j++){let J=k.get(j),lt=p.allowVerticalPlacement&&!J.placedOrientation,ht=J.hidden||!J.crossTileID||lt?null:h[J.crossTileID];if(ht){let mt=new a.pointGeometry(J.anchorX,J.anchorY),ut=Pe(mt,n?v:g),At=Vt(d.cameraToCenterDistance,ut.signedDistanceFromCamera),Mt=a.evaluateSizeForFeature(p.textSizeData,M,J)*At/a.ONE_EM;n&&(Mt*=p.tilePixelRatio/w);let{width:Tt,height:Ft,anchor:jt,textOffset:It,textBoxScale:ie}=ht,Ht=Ko(jt,Tt,Ft,It,ie,Mt),xe=n?Pe(mt.add(Ht),g).point:ut.point.add(e?Ht.rotate(-d.angle):Ht),Fe=p.allowVerticalPlacement&&J.placedOrientation===a.WritingMode.vertical?Math.PI/2:0;for(let ke=0;ke<J.numGlyphs;ke++)a.addDynamicAttributes(F,xe,Fe);C&&J.associatedIconIndex>=0&&(Q[J.associatedIconIndex]={shiftedAnchor:xe,angle:Fe})}else ri(J.numGlyphs,F)}if(C){q.clear();let j=p.icon.placedSymbolArray;for(let J=0;J<j.length;J++){let lt=j.get(J);if(lt.hidden)ri(lt.numGlyphs,q);else{let ht=Q[J];if(ht)for(let mt=0;mt<lt.numGlyphs;mt++)a.addDynamicAttributes(q,ht.shiftedAnchor,ht.angle);else ri(lt.numGlyphs,q)}}p.icon.dynamicLayoutVertexBuffer.updateData(q)}p.text.dynamicLayoutVertexBuffer.updateData(F)}function Ba(p,e,n){return n.iconsInText&&e?"symbolTextAndIcon":p?"symbolSDF":"symbolIcon"}function Fa(p,e,n,h,d,g,v,w,M,C,k,F){let q=p.context,Q=q.gl,j=p.transform,J=w==="map",lt=M==="map",ht=w!=="viewport"&&n.layout.get("symbol-placement")!=="point",mt=J&&!lt&&!ht,ut=!n.layout.get("symbol-sort-key").isConstant(),At=!1,Mt=p.depthModeForSublayer(0,Ye.ReadOnly),Tt=n.layout.get("text-variable-anchor"),Ft=[];for(let jt of h){let It=e.getTile(jt),ie=It.getBucket(n);if(!ie)continue;let Ht=d?ie.text:ie.icon;if(!Ht||!Ht.segments.get().length)continue;let xe=Ht.programConfigurations.get(n.id),Fe=d||ie.sdfIcons,ke=d?ie.textSizeData:ie.iconSizeData,Re=lt||j.pitch!==0,yi=p.useProgram(Ba(Fe,d,ie),xe),be=a.evaluateSizeForZoom(ke,j.zoom),qe,ti,Zi,vr,Br=[0,0],Fr=null;if(d){if(ti=It.glyphAtlasTexture,Zi=Q.LINEAR,qe=It.glyphAtlasTexture.size,ie.iconsInText){Br=It.imageAtlasTexture.size,Fr=It.imageAtlasTexture;let an=ke.kind==="composite"||ke.kind==="camera";vr=Re||p.options.rotating||p.options.zooming||an?Q.LINEAR:Q.NEAREST}}else{let an=n.layout.get("icon-size").constantOr(0)!==1||ie.iconsNeedLinear;ti=It.imageAtlasTexture,Zi=Fe||p.options.rotating||p.options.zooming||an||Re?Q.LINEAR:Q.NEAREST,qe=It.imageAtlasTexture.size}let En=gi(It,1,p.transform.zoom),ur=Ce(jt.posMatrix,lt,J,p.transform,En),sn=Qe(jt.posMatrix,lt,J,p.transform,En),jn=Tt&&ie.hasTextData(),br=n.layout.get("icon-text-fit")!=="none"&&jn&&ie.hasIconData();if(ht){let an=n.layout.get("text-rotation-alignment")==="map";he(ie,jt.posMatrix,p,d,ur,sn,lt,C,an)}let je=p.translatePosMatrix(jt.posMatrix,It,g,v),He=ht||d&&Tt||br?Fc:ur,Ai=p.translatePosMatrix(sn,It,g,v,!0),nr=Fe&&n.paint.get(d?"text-halo-width":"icon-halo-width").constantOr(1)!==0,ci;ci=Fe?ie.iconsInText?Cc(ke.kind,be,mt,lt,p,je,He,Ai,qe,Br):Ro(ke.kind,be,mt,lt,p,je,He,Ai,d,qe,!0):Ia(ke.kind,be,mt,lt,p,je,He,Ai,d,qe);let $n={program:yi,buffers:Ht,uniformValues:ci,atlasTexture:ti,atlasTextureIcon:Fr,atlasInterpolation:Zi,atlasInterpolationIcon:vr,isSDF:Fe,hasHalo:nr};if(ut&&ie.canOverlap){At=!0;let an=Ht.segments.get();for(let Ka of an)Ft.push({segments:new a.SegmentVector([Ka]),sortKey:Ka.sortKey,state:$n})}else Ft.push({segments:Ht.segments,sortKey:0,state:$n})}At&&Ft.sort((jt,It)=>jt.sortKey-It.sortKey);for(let jt of Ft){let It=jt.state;if(q.activeTexture.set(Q.TEXTURE0),It.atlasTexture.bind(It.atlasInterpolation,Q.CLAMP_TO_EDGE),It.atlasTextureIcon&&(q.activeTexture.set(Q.TEXTURE1),It.atlasTextureIcon&&It.atlasTextureIcon.bind(It.atlasInterpolationIcon,Q.CLAMP_TO_EDGE)),It.isSDF){let ie=It.uniformValues;It.hasHalo&&(ie.u_is_halo=1,Oa(It.buffers,jt.segments,n,p,It.program,Mt,k,F,ie)),ie.u_is_halo=0}Oa(It.buffers,jt.segments,n,p,It.program,Mt,k,F,It.uniformValues)}}function Oa(p,e,n,h,d,g,v,w,M){let C=h.context;d.draw(C,C.gl.TRIANGLES,g,v,w,vi.disabled,M,n.id,p.layoutVertexBuffer,p.indexBuffer,e,n.paint,h.transform.zoom,p.programConfigurations.get(n.id),p.dynamicLayoutVertexBuffer,p.opacityVertexBuffer)}function Yo(p,e,n,h,d,g,v){let w=p.context.gl,M=n.paint.get("fill-pattern"),C=M&&M.constantOr(1),k=n.getCrossfadeParameters(),F,q,Q,j,J;v?(q=C&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",F=w.LINES):(q=C?"fillPattern":"fill",F=w.TRIANGLES);for(let lt of h){let ht=e.getTile(lt);if(C&&!ht.patternsLoaded())continue;let mt=ht.getBucket(n);if(!mt)continue;let ut=mt.programConfigurations.get(n.id),At=p.useProgram(q,ut);C&&(p.context.activeTexture.set(w.TEXTURE0),ht.imageAtlasTexture.bind(w.LINEAR,w.CLAMP_TO_EDGE),ut.updatePaintBuffers(k));let Mt=M.constantOr(null);if(Mt&&ht.imageAtlas){let Ft=ht.imageAtlas,jt=Ft.patternPositions[Mt.to.toString()],It=Ft.patternPositions[Mt.from.toString()];jt&&It&&ut.setConstantPatternPositions(jt,It)}let Tt=p.translatePosMatrix(lt.posMatrix,ht,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(v){j=mt.indexBuffer2,J=mt.segments2;let Ft=[w.drawingBufferWidth,w.drawingBufferHeight];Q=q==="fillOutlinePattern"&&C?$l(Tt,p,k,ht,Ft):jl(Tt,Ft)}else j=mt.indexBuffer,J=mt.segments,Q=C?Lo(Tt,p,k,ht):ko(Tt);At.draw(p.context,F,d,p.stencilModeForClipping(lt),g,vi.disabled,Q,n.id,mt.layoutVertexBuffer,j,J,n.paint,p.transform.zoom,ut)}}function _s(p,e,n,h,d,g,v){let w=p.context,M=w.gl,C=n.paint.get("fill-extrusion-pattern"),k=C.constantOr(1),F=n.getCrossfadeParameters(),q=n.paint.get("fill-extrusion-opacity");for(let Q of h){let j=e.getTile(Q),J=j.getBucket(n);if(!J)continue;let lt=J.programConfigurations.get(n.id),ht=p.useProgram(k?"fillExtrusionPattern":"fillExtrusion",lt);k&&(p.context.activeTexture.set(M.TEXTURE0),j.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),lt.updatePaintBuffers(F));let mt=C.constantOr(null);if(mt&&j.imageAtlas){let Tt=j.imageAtlas,Ft=Tt.patternPositions[mt.to.toString()],jt=Tt.patternPositions[mt.from.toString()];Ft&&jt&&lt.setConstantPatternPositions(Ft,jt)}let ut=p.translatePosMatrix(Q.posMatrix,j,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),At=n.paint.get("fill-extrusion-vertical-gradient"),Mt=k?zo(ut,p,At,q,Q,F,j):ql(ut,p,At,q);ht.draw(w,w.gl.TRIANGLES,d,g,v,vi.backCCW,Mt,n.id,J.layoutVertexBuffer,J.indexBuffer,J.segments,n.paint,p.transform.zoom,lt)}}function Na(p,e,n,h,d,g){let v=p.context,w=v.gl,M=e.fbo;if(!M)return;let C=p.useProgram("hillshade");v.activeTexture.set(w.TEXTURE0),w.bindTexture(w.TEXTURE_2D,M.colorAttachment.get());let k=((F,q,Q)=>{let j=Q.paint.get("hillshade-shadow-color"),J=Q.paint.get("hillshade-highlight-color"),lt=Q.paint.get("hillshade-accent-color"),ht=Q.paint.get("hillshade-illumination-direction")*(Math.PI/180);Q.paint.get("hillshade-illumination-anchor")==="viewport"&&(ht-=F.transform.angle);let mt=!F.options.moving;return{u_matrix:F.transform.calculatePosMatrix(q.tileID.toUnwrapped(),mt),u_image:0,u_latrange:Ta(0,q.tileID),u_light:[Q.paint.get("hillshade-exaggeration"),ht],u_shadow:j,u_highlight:J,u_accent:lt}})(p,e,n);C.draw(v,w.TRIANGLES,h,d,g,vi.disabled,k,n.id,p.rasterBoundsBuffer,p.quadTriangleIndexBuffer,p.rasterBoundsSegments)}function Wr(p,e,n,h,d,g){let v=p.context,w=v.gl,M=e.dem;if(M&&M.data){let C=M.dim,k=M.stride,F=M.getPixels();if(v.activeTexture.set(w.TEXTURE1),v.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||p.getTileTexture(k),e.demTexture){let Q=e.demTexture;Q.update(F,{premultiply:!1}),Q.bind(w.NEAREST,w.CLAMP_TO_EDGE)}else e.demTexture=new Nt(v,F,w.RGBA,{premultiply:!1}),e.demTexture.bind(w.NEAREST,w.CLAMP_TO_EDGE);v.activeTexture.set(w.TEXTURE0);let q=e.fbo;if(!q){let Q=new Nt(v,{width:C,height:C,data:null},w.RGBA);Q.bind(w.LINEAR,w.CLAMP_TO_EDGE),q=e.fbo=v.createFramebuffer(C,C,!0),q.colorAttachment.set(Q.texture)}v.bindFramebuffer.set(q.framebuffer),v.viewport.set([0,0,C,C]),p.useProgram("hillshadePrepare").draw(v,w.TRIANGLES,h,d,g,vi.disabled,((Q,j)=>{let J=j.stride,lt=a.create();return a.ortho(lt,0,a.EXTENT,-a.EXTENT,0,0,1),a.translate(lt,lt,[0,-a.EXTENT,0]),{u_matrix:lt,u_image:1,u_dimension:[J,J],u_zoom:Q.overscaledZ,u_unpack:j.getUnpackVector()}})(e.tileID,M),n.id,p.rasterBoundsBuffer,p.quadTriangleIndexBuffer,p.rasterBoundsSegments),e.needsHillshadePrepare=!1}}function ih(p,e,n,h,d){let g=h.paint.get("raster-fade-duration");if(g>0){let v=a.exported.now(),w=(v-p.timeAdded)/g,M=e?(v-e.timeAdded)/g:-1,C=n.getSource(),k=d.coveringZoomLevel({tileSize:C.tileSize,roundZoom:C.roundZoom}),F=!e||Math.abs(e.tileID.overscaledZ-k)>Math.abs(p.tileID.overscaledZ-k),q=F&&p.refreshedUponExpiration?1:a.clamp(F?w:1-M,0,1);return p.refreshedUponExpiration&&w>=1&&(p.refreshedUponExpiration=!1),e?{opacity:1,mix:1-q}:{opacity:q,mix:0}}return{opacity:1,mix:0}}let rh=new a.Color(1,0,0,1),nh=new a.Color(0,1,0,1),xs=new a.Color(0,0,1,1),Ua=new a.Color(1,0,1,1),Jo=new a.Color(0,1,1,1);function sh(p,e,n,h){Ga(p,0,e+n/2,p.transform.width,n,h)}function Va(p,e,n,h){Ga(p,e-n/2,0,n,p.transform.height,h)}function Ga(p,e,n,h,d,g){let v=p.context,w=v.gl;w.enable(w.SCISSOR_TEST),w.scissor(e*p.pixelRatio,n*p.pixelRatio,h*p.pixelRatio,d*p.pixelRatio),v.clear({color:g}),w.disable(w.SCISSOR_TEST)}function ah(p,e,n){let h=p.context,d=h.gl,g=n.posMatrix,v=p.useProgram("debug"),w=Ye.disabled,M=li.disabled,C=p.colorModeForRenderPass(),k="$debug";h.activeTexture.set(d.TEXTURE0),p.emptyTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),v.draw(h,d.LINE_STRIP,w,M,C,vi.disabled,fs(g,a.Color.red),k,p.debugBuffer,p.tileBorderIndexBuffer,p.debugSegments);let F=e.getTileByID(n.key).latestRawTileData,q=Math.floor((F&&F.byteLength||0)/1024),Q=e.getTile(n).tileSize,j=512/Math.min(Q,512)*(n.overscaledZ/p.transform.zoom)*.5,J=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(J+=` => ${n.overscaledZ}`),function(lt,ht){lt.initDebugOverlayCanvas();let mt=lt.debugOverlayCanvas,ut=lt.context.gl,At=lt.debugOverlayCanvas.getContext("2d");At.clearRect(0,0,mt.width,mt.height),At.shadowColor="white",At.shadowBlur=2,At.lineWidth=1.5,At.strokeStyle="white",At.textBaseline="top",At.font="bold 36px Open Sans, sans-serif",At.fillText(ht,5,5),At.strokeText(ht,5,5),lt.debugOverlayTexture.update(mt),lt.debugOverlayTexture.bind(ut.LINEAR,ut.CLAMP_TO_EDGE)}(p,`${J} ${q}kb`),v.draw(h,d.TRIANGLES,w,M,we.alphaBlended,vi.disabled,fs(g,a.Color.transparent,j),k,p.debugBuffer,p.quadTriangleIndexBuffer,p.debugSegments)}let Hs={symbol:function(p,e,n,h,d){if(p.renderPass!=="translucent")return;let g=li.disabled,v=p.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(w,M,C,k,F,q,Q){let j=M.transform,J=F==="map",lt=q==="map";for(let ht of w){let mt=k.getTile(ht),ut=mt.getBucket(C);if(!ut||!ut.text||!ut.text.segments.get().length)continue;let At=a.evaluateSizeForZoom(ut.textSizeData,j.zoom),Mt=gi(mt,1,M.transform.zoom),Tt=Ce(ht.posMatrix,lt,J,M.transform,Mt),Ft=C.layout.get("icon-text-fit")!=="none"&&ut.hasIconData();if(At){let jt=Math.pow(2,j.zoom-mt.tileID.overscaledZ);Ra(ut,J,lt,Q,j,Tt,ht.posMatrix,jt,At,Ft)}}}(h,p,n,e,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),d),n.paint.get("icon-opacity").constantOr(1)!==0&&Fa(p,e,n,h,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),g,v),n.paint.get("text-opacity").constantOr(1)!==0&&Fa(p,e,n,h,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),g,v),e.map.showCollisionBoxes&&(Xo(p,e,n,h,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),Xo(p,e,n,h,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(p,e,n,h){if(p.renderPass!=="translucent")return;let d=n.paint.get("circle-opacity"),g=n.paint.get("circle-stroke-width"),v=n.paint.get("circle-stroke-opacity"),w=!n.layout.get("circle-sort-key").isConstant();if(d.constantOr(1)===0&&(g.constantOr(1)===0||v.constantOr(1)===0))return;let M=p.context,C=M.gl,k=p.depthModeForSublayer(0,Ye.ReadOnly),F=li.disabled,q=p.colorModeForRenderPass(),Q=[];for(let j=0;j<h.length;j++){let J=h[j],lt=e.getTile(J),ht=lt.getBucket(n);if(!ht)continue;let mt=ht.programConfigurations.get(n.id),ut={programConfiguration:mt,program:p.useProgram("circle",mt),layoutVertexBuffer:ht.layoutVertexBuffer,indexBuffer:ht.indexBuffer,uniformValues:Bn(p,J,lt,n)};if(w){let At=ht.segments.get();for(let Mt of At)Q.push({segments:new a.SegmentVector([Mt]),sortKey:Mt.sortKey,state:ut})}else Q.push({segments:ht.segments,sortKey:0,state:ut})}w&&Q.sort((j,J)=>j.sortKey-J.sortKey);for(let j of Q){let{programConfiguration:J,program:lt,layoutVertexBuffer:ht,indexBuffer:mt,uniformValues:ut}=j.state;lt.draw(M,C.TRIANGLES,k,F,q,vi.disabled,ut,n.id,ht,mt,j.segments,n.paint,p.transform.zoom,J)}},heatmap:function(p,e,n,h){if(n.paint.get("heatmap-opacity")!==0)if(p.renderPass==="offscreen"){let d=p.context,g=d.gl,v=li.disabled,w=new we([g.ONE,g.ONE],a.Color.transparent,[!0,!0,!0,!0]);(function(M,C,k){let F=M.gl;M.activeTexture.set(F.TEXTURE1),M.viewport.set([0,0,C.width/4,C.height/4]);let q=k.heatmapFbo;if(q)F.bindTexture(F.TEXTURE_2D,q.colorAttachment.get()),M.bindFramebuffer.set(q.framebuffer);else{let Q=F.createTexture();F.bindTexture(F.TEXTURE_2D,Q),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_WRAP_S,F.CLAMP_TO_EDGE),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_WRAP_T,F.CLAMP_TO_EDGE),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_MIN_FILTER,F.LINEAR),F.texParameteri(F.TEXTURE_2D,F.TEXTURE_MAG_FILTER,F.LINEAR),q=k.heatmapFbo=M.createFramebuffer(C.width/4,C.height/4,!1),function(j,J,lt,ht){let mt=j.gl;mt.texImage2D(mt.TEXTURE_2D,0,mt.RGBA,J.width/4,J.height/4,0,mt.RGBA,j.extRenderToTextureHalfFloat?j.extTextureHalfFloat.HALF_FLOAT_OES:mt.UNSIGNED_BYTE,null),ht.colorAttachment.set(lt)}(M,C,Q,q)}})(d,p,n),d.clear({color:a.Color.transparent});for(let M=0;M<h.length;M++){let C=h[M];if(e.hasRenderableParent(C))continue;let k=e.getTile(C),F=k.getBucket(n);if(!F)continue;let q=F.programConfigurations.get(n.id),Q=p.useProgram("heatmap",q),{zoom:j}=p.transform;Q.draw(d,g.TRIANGLES,Ye.disabled,v,w,vi.disabled,Sa(C.posMatrix,k,j,n.paint.get("heatmap-intensity")),n.id,F.layoutVertexBuffer,F.indexBuffer,F.segments,n.paint,p.transform.zoom,q)}d.viewport.set([0,0,p.width,p.height])}else p.renderPass==="translucent"&&(p.context.setColorMode(p.colorModeForRenderPass()),function(d,g){let v=d.context,w=v.gl,M=g.heatmapFbo;if(!M)return;v.activeTexture.set(w.TEXTURE0),w.bindTexture(w.TEXTURE_2D,M.colorAttachment.get()),v.activeTexture.set(w.TEXTURE1);let C=g.colorRampTexture;C||(C=g.colorRampTexture=new Nt(v,g.colorRamp,w.RGBA)),C.bind(w.LINEAR,w.CLAMP_TO_EDGE),d.useProgram("heatmapTexture").draw(v,w.TRIANGLES,Ye.disabled,li.disabled,d.colorModeForRenderPass(),vi.disabled,((k,F,q,Q)=>{let j=a.create();a.ortho(j,0,k.width,k.height,0,0,1);let J=k.context.gl;return{u_matrix:j,u_world:[J.drawingBufferWidth,J.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:F.paint.get("heatmap-opacity")}})(d,g),g.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,g.paint,d.transform.zoom)}(p,n))},line:function(p,e,n,h){if(p.renderPass!=="translucent")return;let d=n.paint.get("line-opacity"),g=n.paint.get("line-width");if(d.constantOr(1)===0||g.constantOr(1)===0)return;let v=p.depthModeForSublayer(0,Ye.ReadOnly),w=p.colorModeForRenderPass(),M=n.paint.get("line-dasharray"),C=n.paint.get("line-pattern"),k=C.constantOr(1),F=n.paint.get("line-gradient"),q=n.getCrossfadeParameters(),Q=k?"linePattern":M?"lineSDF":F?"lineGradient":"line",j=p.context,J=j.gl,lt=!0;for(let ht of h){let mt=e.getTile(ht);if(k&&!mt.patternsLoaded())continue;let ut=mt.getBucket(n);if(!ut)continue;let At=ut.programConfigurations.get(n.id),Mt=p.context.program.get(),Tt=p.useProgram(Q,At),Ft=lt||Tt.program!==Mt,jt=C.constantOr(null);if(jt&&mt.imageAtlas){let ie=mt.imageAtlas,Ht=ie.patternPositions[jt.to.toString()],xe=ie.patternPositions[jt.from.toString()];Ht&&xe&&At.setConstantPatternPositions(Ht,xe)}let It=k?js(p,mt,n,q):M?Ci(p,mt,n,M,q):F?Ea(p,mt,n,ut.lineClipsArray.length):qs(p,mt,n);if(k)j.activeTexture.set(J.TEXTURE0),mt.imageAtlasTexture.bind(J.LINEAR,J.CLAMP_TO_EDGE),At.updatePaintBuffers(q);else if(M&&(Ft||p.lineAtlas.dirty))j.activeTexture.set(J.TEXTURE0),p.lineAtlas.bind(j);else if(F){let ie=ut.gradients[n.id],Ht=ie.texture;if(n.gradientVersion!==ie.version){let xe=256;if(n.stepInterpolant){let Fe=e.getSource().maxzoom,ke=ht.canonical.z===Fe?Math.ceil(1<<p.transform.maxZoom-ht.canonical.z):1;xe=a.clamp(a.nextPowerOfTwo(ut.maxLineLength/a.EXTENT*1024*ke),256,j.maxTextureSize)}ie.gradient=a.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:xe,image:ie.gradient||void 0,clips:ut.lineClipsArray}),ie.texture?ie.texture.update(ie.gradient):ie.texture=new Nt(j,ie.gradient,J.RGBA),ie.version=n.gradientVersion,Ht=ie.texture}j.activeTexture.set(J.TEXTURE0),Ht.bind(n.stepInterpolant?J.NEAREST:J.LINEAR,J.CLAMP_TO_EDGE)}Tt.draw(j,J.TRIANGLES,v,p.stencilModeForClipping(ht),w,vi.disabled,It,n.id,ut.layoutVertexBuffer,ut.indexBuffer,ut.segments,n.paint,p.transform.zoom,At,ut.layoutVertexBuffer2),lt=!1}},fill:function(p,e,n,h){let d=n.paint.get("fill-color"),g=n.paint.get("fill-opacity");if(g.constantOr(1)===0)return;let v=p.colorModeForRenderPass(),w=n.paint.get("fill-pattern"),M=p.opaquePassEnabledForLayer()&&!w.constantOr(1)&&d.constantOr(a.Color.transparent).a===1&&g.constantOr(0)===1?"opaque":"translucent";if(p.renderPass===M){let C=p.depthModeForSublayer(1,p.renderPass==="opaque"?Ye.ReadWrite:Ye.ReadOnly);Yo(p,e,n,h,C,v,!1)}if(p.renderPass==="translucent"&&n.paint.get("fill-antialias")){let C=p.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,Ye.ReadOnly);Yo(p,e,n,h,C,v,!0)}},"fill-extrusion":function(p,e,n,h){let d=n.paint.get("fill-extrusion-opacity");if(d!==0&&p.renderPass==="translucent"){let g=new Ye(p.context.gl.LEQUAL,Ye.ReadWrite,p.depthRangeFor3D);if(d!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))_s(p,e,n,h,g,li.disabled,we.disabled),_s(p,e,n,h,g,p.stencilModeFor3D(),p.colorModeForRenderPass());else{let v=p.colorModeForRenderPass();_s(p,e,n,h,g,li.disabled,v)}}},hillshade:function(p,e,n,h){if(p.renderPass!=="offscreen"&&p.renderPass!=="translucent")return;let d=p.context,g=p.depthModeForSublayer(0,Ye.ReadOnly),v=p.colorModeForRenderPass(),[w,M]=p.renderPass==="translucent"?p.stencilConfigForOverlap(h):[{},h];for(let C of M){let k=e.getTile(C);k.needsHillshadePrepare&&p.renderPass==="offscreen"?Wr(p,k,n,g,li.disabled,v):p.renderPass==="translucent"&&Na(p,k,n,g,w[C.overscaledZ],v)}d.viewport.set([0,0,p.width,p.height])},raster:function(p,e,n,h){if(p.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!h.length)return;let d=p.context,g=d.gl,v=e.getSource(),w=p.useProgram("raster"),M=p.colorModeForRenderPass(),[C,k]=v instanceof kr?[{},h]:p.stencilConfigForOverlap(h),F=k[k.length-1].overscaledZ,q=!p.options.moving;for(let Q of k){let j=p.depthModeForSublayer(Q.overscaledZ-F,n.paint.get("raster-opacity")===1?Ye.ReadWrite:Ye.ReadOnly,g.LESS),J=e.getTile(Q),lt=p.transform.calculatePosMatrix(Q.toUnwrapped(),q);J.registerFadeDuration(n.paint.get("raster-fade-duration"));let ht=e.findLoadedParent(Q,0),mt=ih(J,ht,e,n,p.transform),ut,At,Mt=n.paint.get("raster-resampling")==="nearest"?g.NEAREST:g.LINEAR;d.activeTexture.set(g.TEXTURE0),J.texture.bind(Mt,g.CLAMP_TO_EDGE,g.LINEAR_MIPMAP_NEAREST),d.activeTexture.set(g.TEXTURE1),ht?(ht.texture.bind(Mt,g.CLAMP_TO_EDGE,g.LINEAR_MIPMAP_NEAREST),ut=Math.pow(2,ht.tileID.overscaledZ-J.tileID.overscaledZ),At=[J.tileID.canonical.x*ut%1,J.tileID.canonical.y*ut%1]):J.texture.bind(Mt,g.CLAMP_TO_EDGE,g.LINEAR_MIPMAP_NEAREST);let Tt=Wl(lt,At||[0,0],ut||1,mt,n);v instanceof kr?w.draw(d,g.TRIANGLES,j,li.disabled,M,vi.disabled,Tt,n.id,v.boundsBuffer,p.quadTriangleIndexBuffer,v.boundsSegments):w.draw(d,g.TRIANGLES,j,C[Q.overscaledZ],M,vi.disabled,Tt,n.id,p.rasterBoundsBuffer,p.quadTriangleIndexBuffer,p.rasterBoundsSegments)}},background:function(p,e,n){let h=n.paint.get("background-color"),d=n.paint.get("background-opacity");if(d===0)return;let g=p.context,v=g.gl,w=p.transform,M=w.tileSize,C=n.paint.get("background-pattern");if(p.isPatternMissing(C))return;let k=!C&&h.a===1&&d===1&&p.opaquePassEnabledForLayer()?"opaque":"translucent";if(p.renderPass!==k)return;let F=li.disabled,q=p.depthModeForSublayer(0,k==="opaque"?Ye.ReadWrite:Ye.ReadOnly),Q=p.colorModeForRenderPass(),j=p.useProgram(C?"backgroundPattern":"background"),J=w.coveringTiles({tileSize:M});C&&(g.activeTexture.set(v.TEXTURE0),p.imageManager.bind(p.context));let lt=n.getCrossfadeParameters();for(let ht of J){let mt=p.transform.calculatePosMatrix(ht.toUnwrapped()),ut=C?Bo(mt,d,p,C,{tileID:ht,tileSize:M},lt):Ac(mt,d,h);j.draw(g,v.TRIANGLES,q,F,Q,vi.disabled,ut,n.id,p.tileExtentBuffer,p.quadTriangleIndexBuffer,p.tileExtentSegments)}},debug:function(p,e,n){for(let h=0;h<n.length;h++)ah(p,e,n[h])},custom:function(p,e,n){let h=p.context,d=n.implementation;if(p.renderPass==="offscreen"){let g=d.prerender;g&&(p.setCustomLayerDefaults(),h.setColorMode(p.colorModeForRenderPass()),g.call(d,h.gl,p.transform.customLayerMatrix()),h.setDirty(),p.setBaseState())}else if(p.renderPass==="translucent"){p.setCustomLayerDefaults(),h.setColorMode(p.colorModeForRenderPass()),h.setStencilMode(li.disabled);let g=d.renderingMode==="3d"?new Ye(p.context.gl.LEQUAL,Ye.ReadWrite,p.depthRangeFor3D):p.depthModeForSublayer(0,Ye.ReadOnly);h.setDepthMode(g),d.render(h.gl,p.transform.customLayerMatrix()),h.setDirty(),p.setBaseState(),h.bindFramebuffer.set(null)}}};class Qo{constructor(e,n){this.context=new ka(e),this.transform=n,this._tileTextures={},this.setup(),this.numSublayers=Je.maxUnderzooming+Je.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Te,this.gpuTimers={}}resize(e,n,h){if(this.width=e*h,this.height=n*h,this.pixelRatio=h,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let d of this.style._order)this.style._layers[d].resize()}setup(){let e=this.context,n=new a.PosArray;n.emplaceBack(0,0),n.emplaceBack(a.EXTENT,0),n.emplaceBack(0,a.EXTENT),n.emplaceBack(a.EXTENT,a.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(n,Io.members),this.tileExtentSegments=a.SegmentVector.simpleSegment(0,0,4,2);let h=new a.PosArray;h.emplaceBack(0,0),h.emplaceBack(a.EXTENT,0),h.emplaceBack(0,a.EXTENT),h.emplaceBack(a.EXTENT,a.EXTENT),this.debugBuffer=e.createVertexBuffer(h,Io.members),this.debugSegments=a.SegmentVector.simpleSegment(0,0,4,5);let d=new a.RasterBoundsArray;d.emplaceBack(0,0,0,0),d.emplaceBack(a.EXTENT,0,a.EXTENT,0),d.emplaceBack(0,a.EXTENT,0,a.EXTENT),d.emplaceBack(a.EXTENT,a.EXTENT,a.EXTENT,a.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(d,zr.members),this.rasterBoundsSegments=a.SegmentVector.simpleSegment(0,0,4,2);let g=new a.PosArray;g.emplaceBack(0,0),g.emplaceBack(1,0),g.emplaceBack(0,1),g.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(g,Io.members),this.viewportSegments=a.SegmentVector.simpleSegment(0,0,4,2);let v=new a.LineStripIndexArray;v.emplaceBack(0),v.emplaceBack(1),v.emplaceBack(3),v.emplaceBack(2),v.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(v);let w=new a.TriangleIndexArray;w.emplaceBack(0,1,2),w.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(w),this.emptyTexture=new Nt(e,{width:1,height:1,data:new Uint8Array([0,0,0,0])},e.gl.RGBA);let M=this.context.gl;this.stencilClearMode=new li({func:M.ALWAYS,mask:0},0,255,M.ZERO,M.ZERO,M.ZERO)}clearStencil(){let e=this.context,n=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let h=a.create();a.ortho(h,0,this.width,this.height,0,0,1),a.scale(h,h,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,n.TRIANGLES,Ye.disabled,this.stencilClearMode,we.disabled,vi.disabled,Gs(h),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,n){if(this.currentStencilSource===e.source||!e.isTileClipped()||!n||!n.length)return;this.currentStencilSource=e.source;let h=this.context,d=h.gl;this.nextStencilID+n.length>256&&this.clearStencil(),h.setColorMode(we.disabled),h.setDepthMode(Ye.disabled);let g=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let v of n){let w=this._tileClippingMaskIDs[v.key]=this.nextStencilID++;g.draw(h,d.TRIANGLES,Ye.disabled,new li({func:d.ALWAYS,mask:0},w,255,d.KEEP,d.KEEP,d.REPLACE),we.disabled,vi.disabled,Gs(v.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,n=this.context.gl;return new li({func:n.NOTEQUAL,mask:255},e,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(e){let n=this.context.gl;return new li({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(e){let n=this.context.gl,h=e.sort((v,w)=>w.overscaledZ-v.overscaledZ),d=h[h.length-1].overscaledZ,g=h[0].overscaledZ-d+1;if(g>1){this.currentStencilSource=void 0,this.nextStencilID+g>256&&this.clearStencil();let v={};for(let w=0;w<g;w++)v[w+d]=new li({func:n.GEQUAL,mask:255},w+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=g,[v,h]}return[{[d]:li.disabled},h]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new we([e.CONSTANT_COLOR,e.ONE],new a.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?we.unblended:we.alphaBlended}depthModeForSublayer(e,n,h){if(!this.opaquePassEnabledForLayer())return Ye.disabled;let d=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Ye(h||this.context.gl.LEQUAL,n,[d,d])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,n){this.style=e,this.options=n,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(a.exported.now()),this.imageManager.beginFrame();let h=this.style._order,d=this.style.sourceCaches;for(let M in d){let C=d[M];C.used&&C.prepare(this.context)}let g={},v={},w={};for(let M in d){let C=d[M];g[M]=C.getVisibleCoordinates(),v[M]=g[M].slice().reverse(),w[M]=C.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let M=0;M<h.length;M++)if(this.style._layers[h[M]].is3D()){this.opaquePassCutoff=M;break}this.renderPass="offscreen";for(let M of h){let C=this.style._layers[M];if(!C.hasOffscreenPass()||C.isHidden(this.transform.zoom))continue;let k=v[C.source];(C.type==="custom"||k.length)&&this.renderLayer(this,d[C.source],C,k)}for(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?a.Color.black:a.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],this.renderPass="opaque",this.currentLayer=h.length-1;this.currentLayer>=0;this.currentLayer--){let M=this.style._layers[h[this.currentLayer]],C=d[M.source],k=g[M.source];this._renderTileClippingMasks(M,k),this.renderLayer(this,C,M,k)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){let M=this.style._layers[h[this.currentLayer]],C=d[M.source],k=(M.type==="symbol"?w:v)[M.source];this._renderTileClippingMasks(M,g[M.source]),this.renderLayer(this,C,M,k)}if(this.options.showTileBoundaries){let M,C;Object.values(this.style._layers).forEach(k=>{k.source&&!k.isHidden(this.transform.zoom)&&(k.source!==(C&&C.id)&&(C=this.style.sourceCaches[k.source]),(!M||M.getSource().maxzoom<C.getSource().maxzoom)&&(M=C))}),M&&Hs.debug(this,M,M.getVisibleCoordinates())}this.options.showPadding&&function(M){let C=M.transform.padding;sh(M,M.transform.height-(C.top||0),3,rh),sh(M,C.bottom||0,3,nh),Va(M,C.left||0,3,xs),Va(M,M.transform.width-(C.right||0),3,Ua);let k=M.transform.centerPoint;(function(F,q,Q,j){Ga(F,q-1,Q-10,2,20,j),Ga(F,q-10,Q-1,20,2,j)})(M,k.x,M.transform.height-k.y,Jo)}(this),this.context.setDefault()}renderLayer(e,n,h,d){h.isHidden(this.transform.zoom)||(h.type==="background"||h.type==="custom"||d.length)&&(this.id=h.id,this.gpuTimingStart(h),Hs[h.type](e,n,h,d,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(e){if(!this.options.gpuTiming)return;let n=this.context.extTimerQuery,h=this.gpuTimers[e.id];h||(h=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:n.createQueryEXT()}),h.calls++,n.beginQueryEXT(n.TIME_ELAPSED_EXT,h.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;let e=this.context.extTimerQuery;e.endQueryEXT(e.TIME_ELAPSED_EXT)}collectGpuTimers(){let e=this.gpuTimers;return this.gpuTimers={},e}queryGpuTimers(e){let n={};for(let h in e){let d=e[h],g=this.context.extTimerQuery,v=g.getQueryObjectEXT(d.query,g.QUERY_RESULT_EXT)/1e6;g.deleteQueryEXT(d.query),n[h]=v}return n}translatePosMatrix(e,n,h,d,g){if(!h[0]&&!h[1])return e;let v=g?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(v){let C=Math.sin(v),k=Math.cos(v);h=[h[0]*k-h[1]*C,h[0]*C+h[1]*k]}let w=[g?h[0]:gi(n,h[0],this.transform.zoom),g?h[1]:gi(n,h[1],this.transform.zoom),0],M=new Float32Array(16);return a.translate(M,e,w),M}saveTileTexture(e){let n=this._tileTextures[e.size[0]];n?n.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let n=this._tileTextures[e];return n&&n.length>0?n.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let n=this.imageManager.getPattern(e.from.toString()),h=this.imageManager.getPattern(e.to.toString());return!n||!h}useProgram(e,n){this.cache=this.cache||{};let h=`${e}${n?n.cacheKey:""}${this._showOverdrawInspector?"/overdraw":""}`;return this.cache[h]||(this.cache[h]=new Ic(this.context,e,Co[e],n,Fo[e],this._showOverdrawInspector)),this.cache[h]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Nt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class qa{constructor(e,n){this.points=e,this.planes=n}static fromInvProjectionMatrix(e,n,h){let d=Math.pow(2,h),g=[[-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(w=>a.transformMat4([],w,e)).map(w=>a.scale$1([],w,1/w[3]/n*d)),v=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(w=>{let M=function(q,Q){var j=Q[0],J=Q[1],lt=Q[2],ht=j*j+J*J+lt*lt;return ht>0&&(ht=1/Math.sqrt(ht)),q[0]=Q[0]*ht,q[1]=Q[1]*ht,q[2]=Q[2]*ht,q}([],function(q,Q,j){var J=Q[0],lt=Q[1],ht=Q[2],mt=j[0],ut=j[1],At=j[2];return q[0]=lt*At-ht*ut,q[1]=ht*mt-J*At,q[2]=J*ut-lt*mt,q}([],Ot([],g[w[0]],g[w[1]]),Ot([],g[w[2]],g[w[1]]))),C=-((k=M)[0]*(F=g[w[1]])[0]+k[1]*F[1]+k[2]*F[2]);var k,F;return M.concat(C)});return new qa(g,v)}}class ja{constructor(e,n){this.min=e,this.max=n,this.center=function(h,d,g){return h[0]=.5*d[0],h[1]=.5*d[1],h[2]=.5*d[2],h}([],function(h,d,g){return h[0]=d[0]+g[0],h[1]=d[1]+g[1],h[2]=d[2]+g[2],h}([],this.min,this.max))}quadrant(e){let n=[e%2==0,e<2],h=gt(this.min),d=gt(this.max);for(let g=0;g<n.length;g++)h[g]=n[g]?this.min[g]:this.center[g],d[g]=n[g]?this.center[g]:this.max[g];return d[2]=this.max[2],new ja(h,d)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersects(e){let n=[[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]],h=!0;for(let d=0;d<e.planes.length;d++){let g=e.planes[d],v=0;for(let w=0;w<n.length;w++)a.dot(g,n[w])>=0&&v++;if(v===0)return 0;v!==n.length&&(h=!1)}if(h)return 2;for(let d=0;d<3;d++){let g=Number.MAX_VALUE,v=-Number.MAX_VALUE;for(let w=0;w<e.points.length;w++){let M=e.points[w][d]-this.min[d];g=Math.min(g,M),v=Math.max(v,M)}if(v<0||g>this.max[d]-this.min[d])return 0}return 1}}class vs{constructor(e=0,n=0,h=0,d=0){if(isNaN(e)||e<0||isNaN(n)||n<0||isNaN(h)||h<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=n,this.left=h,this.right=d}interpolate(e,n,h){return n.top!=null&&e.top!=null&&(this.top=a.number(e.top,n.top,h)),n.bottom!=null&&e.bottom!=null&&(this.bottom=a.number(e.bottom,n.bottom,h)),n.left!=null&&e.left!=null&&(this.left=a.number(e.left,n.left,h)),n.right!=null&&e.right!=null&&(this.right=a.number(e.right,n.right,h)),this}getCenter(e,n){let h=a.clamp((this.left+e-this.right)/2,0,e),d=a.clamp((this.top+n-this.bottom)/2,0,n);return new a.pointGeometry(h,d)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new vs(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Xs{constructor(e,n,h,d,g){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=g===void 0||!!g,this._minZoom=e||0,this._maxZoom=n||22,this._minPitch=h??0,this._maxPitch=d??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new a.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new vs,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){let e=new Xs(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.tileSize=this.tileSize,e.latRange=this.latRange,e.width=this.width,e.height=this.height,e._center=this._center,e.zoom=this.zoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._calcMatrices(),e}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){let n=-a.wrap(e,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var h=new a.ARRAY_TYPE(4);return a.ARRAY_TYPE!=Float32Array&&(h[1]=0,h[2]=0),h[0]=1,h[3]=1,h}(),function(h,d,g){var v=d[0],w=d[1],M=d[2],C=d[3],k=Math.sin(g),F=Math.cos(g);h[0]=v*F+M*k,h[1]=w*F+C*k,h[2]=v*-k+M*F,h[3]=w*-k+C*F}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){let n=a.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){let n=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.scale=this.zoomScale(n),this.tileZoom=Math.floor(n),this.zoomFraction=n-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,n,h){this._unmodified=!1,this._edgeInsets.interpolate(e,n,h),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){let n=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(e){let n=[new a.UnwrappedTileID(0,e)];if(this._renderWorldCopies){let h=this.pointCoordinate(new a.pointGeometry(0,0)),d=this.pointCoordinate(new a.pointGeometry(this.width,0)),g=this.pointCoordinate(new a.pointGeometry(this.width,this.height)),v=this.pointCoordinate(new a.pointGeometry(0,this.height)),w=Math.floor(Math.min(h.x,d.x,g.x,v.x)),M=Math.floor(Math.max(h.x,d.x,g.x,v.x)),C=1;for(let k=w-C;k<=M+C;k++)k!==0&&n.push(new a.UnwrappedTileID(k,e))}return n}coveringTiles(e){let n=this.coveringZoomLevel(e),h=n;if(e.minzoom!==void 0&&n<e.minzoom)return[];e.maxzoom!==void 0&&n>e.maxzoom&&(n=e.maxzoom);let d=a.MercatorCoordinate.fromLngLat(this.center),g=Math.pow(2,n),v=[g*d.x,g*d.y,0],w=qa.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n),M=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(M=n);let C=j=>({aabb:new ja([j*g,0,0],[(j+1)*g,g,0]),zoom:0,x:0,y:0,wrap:j,fullyVisible:!1}),k=[],F=[],q=n,Q=e.reparseOverscaled?h:n;if(this._renderWorldCopies)for(let j=1;j<=3;j++)k.push(C(-j)),k.push(C(j));for(k.push(C(0));k.length>0;){let j=k.pop(),J=j.x,lt=j.y,ht=j.fullyVisible;if(!ht){let Tt=j.aabb.intersects(w);if(Tt===0)continue;ht=Tt===2}let mt=j.aabb.distanceX(v),ut=j.aabb.distanceY(v),At=Math.max(Math.abs(mt),Math.abs(ut)),Mt=3+(1<<q-j.zoom)-2;if(j.zoom===q||At>Mt&&j.zoom>=M)F.push({tileID:new a.OverscaledTileID(j.zoom===q?Q:j.zoom,j.wrap,j.zoom,J,lt),distanceSq:Lt([v[0]-.5-J,v[1]-.5-lt])});else for(let Tt=0;Tt<4;Tt++){let Ft=(J<<1)+Tt%2,jt=(lt<<1)+(Tt>>1);k.push({aabb:j.aabb.quadrant(Tt),zoom:j.zoom+1,x:Ft,y:jt,wrap:j.wrap,fullyVisible:ht})}}return F.sort((j,J)=>j.distanceSq-J.distanceSq).map(j=>j.tileID)}resize(e,n){this.width=e,this.height=n,this.pixelsToGLUnits=[2/e,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){let n=a.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new a.pointGeometry(a.mercatorXfromLng(e.lng)*this.worldSize,a.mercatorYfromLat(n)*this.worldSize)}unproject(e){return new a.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}setLocationAtPoint(e,n){let h=this.pointCoordinate(n),d=this.pointCoordinate(this.centerPoint),g=this.locationCoordinate(e),v=new a.MercatorCoordinate(g.x-(h.x-d.x),g.y-(h.y-d.y));this.center=this.coordinateLocation(v),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e){return this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e){return this.coordinateLocation(this.pointCoordinate(e))}locationCoordinate(e){return a.MercatorCoordinate.fromLngLat(e)}coordinateLocation(e){return e.toLngLat()}pointCoordinate(e){let n=[e.x,e.y,0,1],h=[e.x,e.y,1,1];a.transformMat4(n,n,this.pixelMatrixInverse),a.transformMat4(h,h,this.pixelMatrixInverse);let d=n[3],g=h[3],v=n[1]/d,w=h[1]/g,M=n[2]/d,C=h[2]/g,k=M===C?0:(0-M)/(C-M);return new a.MercatorCoordinate(a.number(n[0]/d,h[0]/g,k)/this.worldSize,a.number(v,w,k)/this.worldSize)}coordinatePoint(e){let n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return a.transformMat4(n,n,this.pixelMatrix),new a.pointGeometry(n[0]/n[3],n[1]/n[3])}getBounds(){return new a.LngLatBounds().extend(this.pointLocation(new a.pointGeometry(0,0))).extend(this.pointLocation(new a.pointGeometry(this.width,0))).extend(this.pointLocation(new a.pointGeometry(this.width,this.height))).extend(this.pointLocation(new a.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new a.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(e,n=!1){let h=e.key,d=n?this._alignedPosMatrixCache:this._posMatrixCache;if(d[h])return d[h];let g=e.canonical,v=this.worldSize/this.zoomScale(g.z),w=g.x+Math.pow(2,g.z)*e.wrap,M=a.identity(new Float64Array(16));return a.translate(M,M,[w*v,g.y*v,0]),a.scale(M,M,[v/a.EXTENT,v/a.EXTENT,1]),a.multiply(M,n?this.alignedProjMatrix:this.projMatrix,M),d[h]=new Float32Array(M),d[h]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e,n,h,d,g=-90,v=90,w=-180,M=180,C=this.size,k=this._unmodified;if(this.latRange){let Q=this.latRange;g=a.mercatorYfromLat(Q[1])*this.worldSize,v=a.mercatorYfromLat(Q[0])*this.worldSize,e=v-g<C.y?C.y/(v-g):0}if(this.lngRange){let Q=this.lngRange;w=a.mercatorXfromLng(Q[0])*this.worldSize,M=a.mercatorXfromLng(Q[1])*this.worldSize,n=M-w<C.x?C.x/(M-w):0}let F=this.point,q=Math.max(n||0,e||0);if(q)return this.center=this.unproject(new a.pointGeometry(n?(M+w)/2:F.x,e?(v+g)/2:F.y)),this.zoom+=this.scaleZoom(q),this._unmodified=k,void(this._constraining=!1);if(this.latRange){let Q=F.y,j=C.y/2;Q-j<g&&(d=g+j),Q+j>v&&(d=v-j)}if(this.lngRange){let Q=F.x,j=C.x/2;Q-j<w&&(h=w+j),Q+j>M&&(h=M-j)}h===void 0&&d===void 0||(this.center=this.unproject(new a.pointGeometry(h!==void 0?h:F.x,d!==void 0?d:F.y))),this._unmodified=k,this._constraining=!1}_calcMatrices(){if(!this.height)return;let e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;let n=Math.PI/2+this._pitch,h=this._fov*(.5+e.y/this.height),d=Math.sin(h)*this.cameraToCenterDistance/Math.sin(a.clamp(Math.PI-n-h,.01,Math.PI-.01)),g=this.point,v=g.x,w=g.y,M=1.01*(Math.cos(Math.PI/2-this._pitch)*d+this.cameraToCenterDistance),C=this.height/50,k=new Float64Array(16);a.perspective(k,this._fov,this.width/this.height,C,M),k[8]=2*-e.x/this.width,k[9]=2*e.y/this.height,a.scale(k,k,[1,-1,1]),a.translate(k,k,[0,0,-this.cameraToCenterDistance]),a.rotateX(k,k,this._pitch),a.rotateZ(k,k,this.angle),a.translate(k,k,[-v,-w,0]),this.mercatorMatrix=a.scale([],k,[this.worldSize,this.worldSize,this.worldSize]),a.scale(k,k,[1,1,a.mercatorZfromAltitude(1,this.center.lat)*this.worldSize]),this.projMatrix=k,this.invProjMatrix=a.invert([],this.projMatrix);let F=this.width%2/2,q=this.height%2/2,Q=Math.cos(this.angle),j=Math.sin(this.angle),J=v-Math.round(v)+Q*F+j*q,lt=w-Math.round(w)+Q*q+j*F,ht=new Float64Array(k);if(a.translate(ht,ht,[J>.5?J-1:J,lt>.5?lt-1:lt,0]),this.alignedProjMatrix=ht,k=a.create(),a.scale(k,k,[this.width/2,-this.height/2,1]),a.translate(k,k,[1,-1,0]),this.labelPlaneMatrix=k,k=a.create(),a.scale(k,k,[1,-1,1]),a.translate(k,k,[-1,-1,0]),a.scale(k,k,[2/this.width,2/this.height,1]),this.glCoordMatrix=k,this.pixelMatrix=a.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),k=a.invert(new Float64Array(16),this.pixelMatrix),!k)throw new Error("failed to invert matrix");this.pixelMatrixInverse=k,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let e=this.pointCoordinate(new a.pointGeometry(0,0)),n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return a.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.pointGeometry(0,e))}getCameraQueryGeometry(e){let n=this.getCameraPoint();if(e.length===1)return[e[0],n];{let h=n.x,d=n.y,g=n.x,v=n.y;for(let w of e)h=Math.min(h,w.x),d=Math.min(d,w.y),g=Math.max(g,w.x),v=Math.max(v,w.y);return[new a.pointGeometry(h,d),new a.pointGeometry(g,d),new a.pointGeometry(g,v),new a.pointGeometry(h,v),new a.pointGeometry(h,d)]}}}class oh{constructor(e){this._hashName=e&&encodeURIComponent(e),a.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,h){let d=!1,g=null,v=()=>{g=null,d&&(n(),g=setTimeout(v,300),d=!1)};return()=>(d=!0,g||v(),g)}(this._updateHashUnthrottled.bind(this))}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(e){let n=this._map.getCenter(),h=Math.round(100*this._map.getZoom())/100,d=Math.ceil((h*Math.LN2+Math.log(512/360/.5))/Math.LN10),g=Math.pow(10,d),v=Math.round(n.lng*g)/g,w=Math.round(n.lat*g)/g,M=this._map.getBearing(),C=this._map.getPitch(),k="";if(k+=e?`/${v}/${w}/${h}`:`${h}/${w}/${v}`,(M||C)&&(k+="/"+Math.round(10*M)/10),C&&(k+=`/${Math.round(C)}`),this._hashName){let F=this._hashName,q=!1,Q=window.location.hash.slice(1).split("&").map(j=>{let J=j.split("=")[0];return J===F?(q=!0,`${J}=${k}`):j}).filter(j=>j);return q||Q.push(`${F}=${k}`),`#${Q.join("&")}`}return`#${k}`}_getCurrentHash(){let e=window.location.hash.replace("#","");if(this._hashName){let n;return e.split("&").map(h=>h.split("=")).forEach(h=>{h[0]===this._hashName&&(n=h)}),(n&&n[1]||"").split("/")}return e.split("/")}_onHashChange(){let e=this._getCurrentHash();if(e.length>=3&&!e.some(n=>isNaN(n))){let n=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:n,pitch:+(e[4]||0)}),!0}return!1}_updateHashUnthrottled(){let e=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,e)}catch{}}}let Ks={linearity:.3,easing:a.bezier(0,0,.3,1)},lh=a.extend({deceleration:2500,maxSpeed:1400},Ks),hh=a.extend({deceleration:20,maxSpeed:1400},Ks),ch=a.extend({deceleration:1e3,maxSpeed:360},Ks),bs=a.extend({deceleration:1e3,maxSpeed:90},Ks);class uh{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.exported.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,n=a.exported.now();for(;e.length>0&&n-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let n={zoom:0,bearing:0,pitch:0,pan:new a.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(let{settings:g}of this._inertiaBuffer)n.zoom+=g.zoomDelta||0,n.bearing+=g.bearingDelta||0,n.pitch+=g.pitchDelta||0,g.panDelta&&n.pan._add(g.panDelta),g.around&&(n.around=g.around),g.pinchAround&&(n.pinchAround=g.pinchAround);let h=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(n.pan.mag()){let g=Js(n.pan.mag(),h,a.extend({},lh,e||{}));d.offset=n.pan.mult(g.amount/n.pan.mag()),d.center=this._map.transform.center,Ys(d,g)}if(n.zoom){let g=Js(n.zoom,h,hh);d.zoom=this._map.transform.zoom+g.amount,Ys(d,g)}if(n.bearing){let g=Js(n.bearing,h,ch);d.bearing=this._map.transform.bearing+a.clamp(g.amount,-179,179),Ys(d,g)}if(n.pitch){let g=Js(n.pitch,h,bs);d.pitch=this._map.transform.pitch+g.amount,Ys(d,g)}if(d.zoom||d.bearing){let g=n.pinchAround===void 0?n.around:n.pinchAround;d.around=g?this._map.unproject(g):this._map.getCenter()}return this.clear(),a.extend(d,{noMoveStart:!0})}}function Ys(p,e){(!p.duration||p.duration<e.duration)&&(p.duration=e.duration,p.easing=e.easing)}function Js(p,e,n){let{maxSpeed:h,linearity:d,deceleration:g}=n,v=a.clamp(p*d/(e/1e3),-h,h),w=Math.abs(v)/(g*d);return{easing:n.easing,duration:1e3*w,amount:v*(w/2)}}class xr extends a.Event{constructor(e,n,h,d={}){let g=L.mousePos(n.getCanvasContainer(),h),v=n.unproject(g);super(e,a.extend({point:g,lngLat:v,originalEvent:h},d)),this._defaultPrevented=!1,this.target=n}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class lr extends a.Event{constructor(e,n,h){let d=e==="touchend"?h.changedTouches:h.touches,g=L.touchPos(n.getCanvasContainer(),d),v=g.map(M=>n.unproject(M)),w=g.reduce((M,C,k,F)=>M.add(C.div(F.length)),new a.pointGeometry(0,0));super(e,{points:g,point:w,lngLats:v,lngLat:n.unproject(w),originalEvent:h}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Oc extends a.Event{constructor(e,n,h){super(e,{originalEvent:h}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Nn{constructor(e,n){this._map=e,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new Oc(e.type,this._map,e))}mousedown(e,n){return this._mousedownPos=n,this._firePreventable(new xr(e.type,this._map,e))}mouseup(e){this._map.fire(new xr(e.type,this._map,e))}click(e,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new xr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new xr(e.type,this._map,e))}mouseover(e){this._map.fire(new xr(e.type,this._map,e))}mouseout(e){this._map.fire(new xr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new lr(e.type,this._map,e))}touchmove(e){this._map.fire(new lr(e.type,this._map,e))}touchend(e){this._map.fire(new lr(e.type,this._map,e))}touchcancel(e){this._map.fire(new lr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ph{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,delete this._contextMenuEvent}mousemove(e){this._map.fire(new xr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new xr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new xr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ws{constructor(e,n){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,n){this.isEnabled()&&e.shiftKey&&e.button===0&&(L.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(e,n){if(!this._active)return;let h=n;if(this._lastPos.equals(h)||!this._box&&h.dist(this._startPos)<this._clickTolerance)return;let d=this._startPos;this._lastPos=h,this._box||(this._box=L.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",e));let g=Math.min(d.x,h.x),v=Math.max(d.x,h.x),w=Math.min(d.y,h.y),M=Math.max(d.y,h.y);L.setTransform(this._box,`translate(${g}px,${w}px)`),this._box.style.width=v-g+"px",this._box.style.height=M-w+"px"}mouseupWindow(e,n){if(!this._active||e.button!==0)return;let h=this._startPos,d=n;if(this.reset(),L.suppressClick(),h.x!==d.x||h.y!==d.y)return this._map.fire(new a.Event("boxzoomend",{originalEvent:e})),{cameraAnimation:g=>g.fitScreenCoordinates(h,d,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(L.remove(this._box),this._box=null),L.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,n){return this._map.fire(new a.Event(e,{originalEvent:n}))}}function Un(p,e){let n={};for(let h=0;h<p.length;h++)n[p[h].identifier]=e[h];return n}class Nc{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,n,h){(this.centroid||h.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),h.length===this.numTouches&&(this.centroid=function(d){let g=new a.pointGeometry(0,0);for(let v of d)g._add(v);return g.div(d.length)}(n),this.touches=Un(h,n)))}touchmove(e,n,h){if(this.aborted||!this.centroid)return;let d=Un(h,n);for(let g in this.touches){let v=this.touches[g],w=d[g];(!w||w.dist(v)>30)&&(this.aborted=!0)}}touchend(e,n,h){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),h.length===0){let d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class tl{constructor(e){this.singleTap=new Nc(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,n,h){this.singleTap.touchstart(e,n,h)}touchmove(e,n,h){this.singleTap.touchmove(e,n,h)}touchend(e,n,h){let d=this.singleTap.touchend(e,n,h);if(d){let g=e.timeStamp-this.lastTime<500,v=!this.lastTap||this.lastTap.dist(d)<30;if(g&&v||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class Uc{constructor(){this._zoomIn=new tl({numTouches:1,numTaps:2}),this._zoomOut=new tl({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,n,h){this._zoomIn.touchstart(e,n,h),this._zoomOut.touchstart(e,n,h)}touchmove(e,n,h){this._zoomIn.touchmove(e,n,h),this._zoomOut.touchmove(e,n,h)}touchend(e,n,h){let d=this._zoomIn.touchend(e,n,h),g=this._zoomOut.touchend(e,n,h);return d?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:v=>v.easeTo({duration:300,zoom:v.getZoom()+1,around:v.unproject(d)},{originalEvent:e})}):g?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:v=>v.easeTo({duration:300,zoom:v.getZoom()-1,around:v.unproject(g)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}let dh={0:1,2:2};class Vn{constructor(e){this.reset(),this._clickTolerance=e.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(e,n){return!1}_move(e,n){return{}}mousedown(e,n){if(this._lastPoint)return;let h=L.mouseButton(e);this._correctButton(e,h)&&(this._lastPoint=n,this._eventButton=h)}mousemoveWindow(e,n){let h=this._lastPoint;if(h){if(e.preventDefault(),function(d,g){let v=dh[g];return d.buttons===void 0||(d.buttons&v)!==v}(e,this._eventButton))this.reset();else if(this._moved||!(n.dist(h)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(h,n)}}mouseupWindow(e){this._lastPoint&&L.mouseButton(e)===this._eventButton&&(this._moved&&L.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ms extends Vn{mousedown(e,n){super.mousedown(e,n),this._lastPoint&&(this._active=!0)}_correctButton(e,n){return n===0&&!e.ctrlKey}_move(e,n){return{around:n,panDelta:n.sub(e)}}}class te extends Vn{_correctButton(e,n){return n===0&&e.ctrlKey||n===2}_move(e,n){let h=.8*(n.x-e.x);if(h)return this._active=!0,{bearingDelta:h}}contextmenu(e){e.preventDefault()}}class el extends Vn{_correctButton(e,n){return n===0&&e.ctrlKey||n===2}_move(e,n){let h=-.5*(n.y-e.y);if(h)return this._active=!0,{pitchDelta:h}}contextmenu(e){e.preventDefault()}}class Qs{constructor(e){this._minTouches=1,this._clickTolerance=e.clickTolerance||1,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new a.pointGeometry(0,0)}touchstart(e,n,h){return this._calculateTransform(e,n,h)}touchmove(e,n,h){if(this._active&&!(h.length<this._minTouches))return e.preventDefault(),this._calculateTransform(e,n,h)}touchend(e,n,h){this._calculateTransform(e,n,h),this._active&&h.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,n,h){h.length>0&&(this._active=!0);let d=Un(h,n),g=new a.pointGeometry(0,0),v=new a.pointGeometry(0,0),w=0;for(let C in d){let k=d[C],F=this._touches[C];F&&(g._add(k),v._add(k.sub(F)),w++,d[C]=k)}if(this._touches=d,w<this._minTouches||!v.mag())return;let M=v.div(w);return this._sum._add(M),this._sum.mag()<this._clickTolerance?void 0:{around:g.div(w),panDelta:M}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gn{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(e){}_move(e,n,h){return{}}touchstart(e,n,h){this._firstTwoTouches||h.length<2||(this._firstTwoTouches=[h[0].identifier,h[1].identifier],this._start([n[0],n[1]]))}touchmove(e,n,h){if(!this._firstTwoTouches)return;e.preventDefault();let[d,g]=this._firstTwoTouches,v=ta(h,n,d),w=ta(h,n,g);if(!v||!w)return;let M=this._aroundCenter?null:v.add(w).div(2);return this._move([v,w],M,e)}touchend(e,n,h){if(!this._firstTwoTouches)return;let[d,g]=this._firstTwoTouches,v=ta(h,n,d),w=ta(h,n,g);v&&w||(this._active&&L.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function ta(p,e,n){for(let h=0;h<p.length;h++)if(p[h].identifier===n)return e[h]}function Zt(p,e){return Math.log(p/e)/Math.LN2}class il extends Gn{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,n){let h=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(Zt(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Zt(this._distance,h),pinchAround:n}}}function fh(p,e){return 180*p.angleWith(e)/Math.PI}class Vc extends Gn{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,n){let h=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:fh(this._vector,h),pinchAround:n}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let n=25/(Math.PI*this._minDiameter)*360,h=fh(e,this._startVector);return Math.abs(h)<n}}function ea(p){return Math.abs(p.y)>Math.abs(p.x)}class mh extends Gn{reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}_start(e){this._lastPoints=e,ea(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,n,h){let d=e[0].sub(this._lastPoints[0]),g=e[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(d,g,h.timeStamp),this._valid)return this._lastPoints=e,this._active=!0,{pitchDelta:(d.y+g.y)/2*-.5}}gestureBeginsVertically(e,n,h){if(this._valid!==void 0)return this._valid;let d=e.mag()>=2,g=n.mag()>=2;if(!d&&!g)return;if(!d||!g)return this._firstMove===void 0&&(this._firstMove=h),h-this._firstMove<100&&void 0;let v=e.y>0==n.y>0;return ea(e)&&ea(n)&&v}}let gh={panStep:100,bearingStep:15,pitchStep:10};class Gc{constructor(){let e=gh;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let n=0,h=0,d=0,g=0,v=0;switch(e.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:e.shiftKey?h=-1:(e.preventDefault(),g=-1);break;case 39:e.shiftKey?h=1:(e.preventDefault(),g=1);break;case 38:e.shiftKey?d=1:(e.preventDefault(),v=-1);break;case 40:e.shiftKey?d=-1:(e.preventDefault(),v=1);break;default:return}return this._rotationDisabled&&(h=0,d=0),{cameraAnimation:w=>{let M=w.getZoom();w.easeTo({duration:300,easeId:"keyboardHandler",easing:qc,zoom:n?Math.round(M)+n*(e.shiftKey?2:1):M,bearing:w.getBearing()+h*this._bearingStep,pitch:w.getPitch()+d*this._pitchStep,offset:[-g*this._panStep,-v*this._panStep],center:w.getCenter()},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function qc(p){return p*(2-p)}let $a=4.000244140625;class rl{constructor(e,n){this._map=e,this._el=e.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,a.bindAll(["_onTimeout"],this)}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(e){if(!this.isEnabled())return;let n=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,h=a.exported.now(),d=h-(this._lastWheelEventTime||0);this._lastWheelEventTime=h,n!==0&&n%$a==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(d*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),e.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=e,this._delta-=n,this._active||this._start(e)),e.preventDefault()}_onTimeout(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let n=L.mousePos(this._el,e);this._around=a.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._map.transform;if(this._delta!==0){let w=this._type==="wheel"&&Math.abs(this._delta)>$a?this._wheelZoomRate:this._defaultZoomRate,M=2/(1+Math.exp(-Math.abs(this._delta*w)));this._delta<0&&M!==0&&(M=1/M);let C=typeof this._targetZoom=="number"?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(C*M))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let n=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,h=this._startZoom,d=this._easing,g,v=!1;if(this._type==="wheel"&&h&&d){let w=Math.min((a.exported.now()-this._lastWheelEventTime)/200,1),M=d(w);g=a.number(h,n,M),w<1?this._frameId||(this._frameId=!0):v=!0}else g=n,v=!0;return this._active=!0,v&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!v,zoomDelta:g-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let n=a.ease;if(this._prevEase){let h=this._prevEase,d=(a.exported.now()-h.start)/h.duration,g=h.easing(d+.01)-h.easing(d),v=.27/Math.sqrt(g*g+1e-4)*.01,w=Math.sqrt(.0729-v*v);n=a.bezier(v,w,.25,1)}return this._prevEase={start:a.exported.now(),duration:e,easing:n},n}reset(){this._active=!1}}class nl{constructor(e,n){this._clickZoom=e,this._tapZoom=n}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class sl{constructor(){this.reset()}reset(){this._active=!1}dblclick(e,n){return e.preventDefault(),{cameraAnimation:h=>{h.easeTo({duration:300,zoom:h.getZoom()+(e.shiftKey?-1:1),around:h.unproject(n)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class hr{constructor(){this._tap=new tl({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(e,n,h){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?h.length>0&&(this._swipePoint=n[0],this._swipeTouch=h[0].identifier):this._tap.touchstart(e,n,h))}touchmove(e,n,h){if(this._tapTime){if(this._swipePoint){if(h[0].identifier!==this._swipeTouch)return;let d=n[0],g=d.y-this._swipePoint.y;return this._swipePoint=d,e.preventDefault(),this._active=!0,{zoomDelta:g/128}}}else this._tap.touchmove(e,n,h)}touchend(e,n,h){this._tapTime?this._swipePoint&&h.length===0&&this.reset():this._tap.touchend(e,n,h)&&(this._tapTime=e.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Tn{constructor(e,n,h){this._el=e,this._mousePan=n,this._touchPan=h}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class yh{constructor(e,n,h){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=n,this._mousePitch=h}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class al{constructor(e,n,h,d){this._el=e,this._touchZoom=n,this._touchRotate=h,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}let Ss=p=>p.zoom||p.drag||p.pitch||p.rotate;class ol extends a.Event{}function Wa(p){return p.panDelta&&p.panDelta.mag()||p.zoomDelta||p.bearingDelta||p.pitchDelta}class Rr{constructor(e,n){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new uh(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),a.bindAll(["handleEvent","handleWindowEvent"],this);let h=this._el;this._listeners=[[h,"touchstart",{passive:!0}],[h,"touchmove",{passive:!1}],[h,"touchend",void 0],[h,"touchcancel",void 0],[h,"mousedown",void 0],[h,"mousemove",void 0],[h,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[h,"mouseover",void 0],[h,"mouseout",void 0],[h,"dblclick",void 0],[h,"click",void 0],[h,"keydown",{capture:!1}],[h,"keyup",void 0],[h,"wheel",{passive:!1}],[h,"contextmenu",void 0],[window,"blur",void 0]];for(let[d,g,v]of this._listeners)L.addEventListener(d,g,d===document?this.handleWindowEvent:this.handleEvent,v)}destroy(){for(let[e,n,h]of this._listeners)L.removeEventListener(e,n,e===document?this.handleWindowEvent:this.handleEvent,h)}_addDefaultHandlers(e){let n=this._map,h=n.getCanvasContainer();this._add("mapEvent",new Nn(n,e));let d=n.boxZoom=new ws(n,e);this._add("boxZoom",d);let g=new Uc,v=new sl;n.doubleClickZoom=new nl(v,g),this._add("tapZoom",g),this._add("clickZoom",v);let w=new hr;this._add("tapDragZoom",w);let M=n.touchPitch=new mh;this._add("touchPitch",M);let C=new te(e),k=new el(e);n.dragRotate=new yh(e,C,k),this._add("mouseRotate",C,["mousePitch"]),this._add("mousePitch",k,["mouseRotate"]);let F=new Ms(e),q=new Qs(e);n.dragPan=new Tn(h,F,q),this._add("mousePan",F),this._add("touchPan",q,["touchZoom","touchRotate"]);let Q=new Vc,j=new il;n.touchZoomRotate=new al(h,j,Q,w),this._add("touchRotate",Q,["touchPan","touchZoom"]),this._add("touchZoom",j,["touchPan","touchRotate"]);let J=n.scrollZoom=new rl(n,this);this._add("scrollZoom",J,["mousePan"]);let lt=n.keyboard=new Gc;this._add("keyboard",lt),this._add("blockableMapEvent",new ph(n));for(let ht of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])e.interactive&&e[ht]&&n[ht].enable(e[ht])}_add(e,n,h){this._handlers.push({handlerName:e,handler:n,allowed:h}),this._handlersById[e]=n}stop(e){if(!this._updatingCamera){for(let{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(Ss(this._eventsInProgress))||this.isZooming()}_blockedByActive(e,n,h){for(let d in e)if(d!==h&&(!n||n.indexOf(d)<0))return!0;return!1}handleWindowEvent(e){this.handleEvent(e,`${e.type}Window`)}_getMapTouches(e){let n=[];for(let h of e)this._el.contains(h.target)&&n.push(h);return n}handleEvent(e,n){if(e.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let h=e.type==="renderFrame"?void 0:e,d={needsRenderFrame:!1},g={},v={},w=e.touches,M=w?this._getMapTouches(w):void 0,C=M?L.touchPos(this._el,M):L.mousePos(this._el,e);for(let{handlerName:q,handler:Q,allowed:j}of this._handlers){if(!Q.isEnabled())continue;let J;this._blockedByActive(v,j,q)?Q.reset():Q[n||e.type]&&(J=Q[n||e.type](e,C,M),this.mergeHandlerResult(d,g,J,q,h),J&&J.needsRenderFrame&&this._triggerRenderFrame()),(J||Q.isActive())&&(v[q]=Q)}let k={};for(let q in this._previousActiveHandlers)v[q]||(k[q]=h);this._previousActiveHandlers=v,(Object.keys(k).length||Wa(d))&&(this._changes.push([d,g,k]),this._triggerRenderFrame()),(Object.keys(v).length||Wa(d))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:F}=d;F&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],F(this._map))}mergeHandlerResult(e,n,h,d,g){if(!h)return;a.extend(e,h);let v={handlerName:d,originalEvent:h.originalEvent||g};h.zoomDelta!==void 0&&(n.zoom=v),h.panDelta!==void 0&&(n.drag=v),h.pitchDelta!==void 0&&(n.pitch=v),h.bearingDelta!==void 0&&(n.rotate=v)}_applyChanges(){let e={},n={},h={};for(let[d,g,v]of this._changes)d.panDelta&&(e.panDelta=(e.panDelta||new a.pointGeometry(0,0))._add(d.panDelta)),d.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(e.around=d.around),d.pinchAround!==void 0&&(e.pinchAround=d.pinchAround),d.noInertia&&(e.noInertia=d.noInertia),a.extend(n,g),a.extend(h,v);this._updateMapTransform(e,n,h),this._changes=[]}_updateMapTransform(e,n,h){let d=this._map,g=d.transform;if(!Wa(e))return this._fireEvents(n,h,!0);let{panDelta:v,zoomDelta:w,bearingDelta:M,pitchDelta:C,around:k,pinchAround:F}=e;F!==void 0&&(k=F),d._stop(!0),k=k||d.transform.centerPoint;let q=g.pointLocation(v?k.sub(v):k);M&&(g.bearing+=M),C&&(g.pitch+=C),w&&(g.zoom+=w),g.setLocationAtPoint(q,k),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(n,h,!0)}_fireEvents(e,n,h){let d=Ss(this._eventsInProgress),g=Ss(e),v={};for(let k in e){let{originalEvent:F}=e[k];this._eventsInProgress[k]||(v[`${k}start`]=F),this._eventsInProgress[k]=e[k]}!d&&g&&this._fireEvent("movestart",g.originalEvent);for(let k in v)this._fireEvent(k,v[k]);g&&this._fireEvent("move",g.originalEvent);for(let k in e){let{originalEvent:F}=e[k];this._fireEvent(k,F)}let w={},M;for(let k in this._eventsInProgress){let{handlerName:F,originalEvent:q}=this._eventsInProgress[k];this._handlersById[F].isActive()||(delete this._eventsInProgress[k],M=n[F]||q,w[`${k}end`]=M)}for(let k in w)this._fireEvent(k,w[k]);let C=Ss(this._eventsInProgress);if(h&&(d||g)&&!C){this._updatingCamera=!0;let k=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),F=q=>q!==0&&-this._bearingSnap<q&&q<this._bearingSnap;k?(F(k.bearing||this._map.getBearing())&&(k.bearing=0),this._map.easeTo(k,{originalEvent:M})):(this._map.fire(new a.Event("moveend",{originalEvent:M})),F(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,n){this._map.fire(new a.Event(e,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new ol("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}let hi={extend:(p,...e)=>a.extend(p,...e),run(p){p()},logToElement(p,e=!1,n="log"){let h=window.document.getElementById(n);h&&(e&&(h.innerHTML=""),h.innerHTML+=`<br>${p}`)}};class Za extends a.Evented{constructor(e,n){super(),this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=n.bearingSnap,a.bindAll(["_renderFrameCallback"],this)}getCenter(){return new a.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(e,n){return this.jumpTo({center:e},n)}panBy(e,n,h){return e=a.pointGeometry.convert(e).mult(-1),this.panTo(this.transform.center,a.extend({offset:e},n),h)}panTo(e,n,h){return this.easeTo(a.extend({center:e},n),h)}getZoom(){return this.transform.zoom}setZoom(e,n){return this.jumpTo({zoom:e},n),this}zoomTo(e,n,h){return this.easeTo(a.extend({zoom:e},n),h)}zoomIn(e,n){return this.zoomTo(this.getZoom()+1,e,n),this}zoomOut(e,n){return this.zoomTo(this.getZoom()-1,e,n),this}getBearing(){return this.transform.bearing}setBearing(e,n){return this.jumpTo({bearing:e},n),this}getPadding(){return this.transform.padding}setPadding(e,n){return this.jumpTo({padding:e},n),this}rotateTo(e,n,h){return this.easeTo(a.extend({bearing:e},n),h)}resetNorth(e,n){return this.rotateTo(0,a.extend({duration:1e3},e),n),this}resetNorthPitch(e,n){return this.easeTo(a.extend({bearing:0,pitch:0,duration:1e3},e),n),this}snapToNorth(e,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,n):this}getPitch(){return this.transform.pitch}setPitch(e,n){return this.jumpTo({pitch:e},n),this}cameraForBounds(e,n){e=a.LngLatBounds.convert(e);let h=n&&n.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),h,n)}_cameraForBoxAndBearing(e,n,h,d){let g={top:0,bottom:0,right:0,left:0};if(typeof(d=a.extend({padding:g,offset:[0,0],maxZoom:this.transform.maxZoom},d)).padding=="number"){let Mt=d.padding;d.padding={top:Mt,bottom:Mt,right:Mt,left:Mt}}d.padding=a.extend(g,d.padding);let v=this.transform,w=v.padding,M=v.project(a.LngLat.convert(e)),C=v.project(a.LngLat.convert(n)),k=M.rotate(-h*Math.PI/180),F=C.rotate(-h*Math.PI/180),q=new a.pointGeometry(Math.max(k.x,F.x),Math.max(k.y,F.y)),Q=new a.pointGeometry(Math.min(k.x,F.x),Math.min(k.y,F.y)),j=q.sub(Q),J=(v.width-(w.left+w.right+d.padding.left+d.padding.right))/j.x,lt=(v.height-(w.top+w.bottom+d.padding.top+d.padding.bottom))/j.y;if(lt<0||J<0)return void a.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");let ht=Math.min(v.scaleZoom(v.scale*Math.min(J,lt)),d.maxZoom),mt=a.pointGeometry.convert(d.offset),ut=new a.pointGeometry((d.padding.left-d.padding.right)/2,(d.padding.top-d.padding.bottom)/2).rotate(h*Math.PI/180),At=mt.add(ut).mult(v.scale/v.zoomScale(ht));return{center:v.unproject(M.add(C).div(2).sub(At)),zoom:ht,bearing:h}}fitBounds(e,n,h){return this._fitInternal(this.cameraForBounds(e,n),n,h)}fitScreenCoordinates(e,n,h,d,g){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(a.pointGeometry.convert(e)),this.transform.pointLocation(a.pointGeometry.convert(n)),h,d),d,g)}_fitInternal(e,n,h){return e?(delete(n=a.extend(e,n)).padding,n.linear?this.easeTo(n,h):this.flyTo(n,h)):this}jumpTo(e,n){this.stop();let h=this.transform,d=!1,g=!1,v=!1;return"zoom"in e&&h.zoom!==+e.zoom&&(d=!0,h.zoom=+e.zoom),e.center!==void 0&&(h.center=a.LngLat.convert(e.center)),"bearing"in e&&h.bearing!==+e.bearing&&(g=!0,h.bearing=+e.bearing),"pitch"in e&&h.pitch!==+e.pitch&&(v=!0,h.pitch=+e.pitch),e.padding==null||h.isPaddingEqual(e.padding)||(h.padding=e.padding),this.fire(new a.Event("movestart",n)).fire(new a.Event("move",n)),d&&this.fire(new a.Event("zoomstart",n)).fire(new a.Event("zoom",n)).fire(new a.Event("zoomend",n)),g&&this.fire(new a.Event("rotatestart",n)).fire(new a.Event("rotate",n)).fire(new a.Event("rotateend",n)),v&&this.fire(new a.Event("pitchstart",n)).fire(new a.Event("pitch",n)).fire(new a.Event("pitchend",n)),this.fire(new a.Event("moveend",n))}easeTo(e,n){this._stop(!1,e.easeId),((e=a.extend({offset:[0,0],duration:500,easing:a.ease},e)).animate===!1||!e.essential&&a.exported.prefersReducedMotion)&&(e.duration=0);let h=this.transform,d=this.getZoom(),g=this.getBearing(),v=this.getPitch(),w=this.getPadding(),M="zoom"in e?+e.zoom:d,C="bearing"in e?this._normalizeBearing(e.bearing,g):g,k="pitch"in e?+e.pitch:v,F="padding"in e?e.padding:h.padding,q=a.pointGeometry.convert(e.offset),Q=h.centerPoint.add(q),j=h.pointLocation(Q),J=a.LngLat.convert(e.center||j);this._normalizeCenter(J);let lt=h.project(j),ht=h.project(J).sub(lt),mt=h.zoomScale(M-d),ut,At;e.around&&(ut=a.LngLat.convert(e.around),At=h.locationPoint(ut));let Mt={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||M!==d,this._rotating=this._rotating||g!==C,this._pitching=this._pitching||k!==v,this._padding=!h.isPaddingEqual(F),this._easeId=e.easeId,this._prepareEase(n,e.noMoveStart,Mt),this._ease(Tt=>{if(this._zooming&&(h.zoom=a.number(d,M,Tt)),this._rotating&&(h.bearing=a.number(g,C,Tt)),this._pitching&&(h.pitch=a.number(v,k,Tt)),this._padding&&(h.interpolatePadding(w,F,Tt),Q=h.centerPoint.add(q)),ut)h.setLocationAtPoint(ut,At);else{let Ft=h.zoomScale(h.zoom-d),jt=M>d?Math.min(2,mt):Math.max(.5,mt),It=Math.pow(jt,1-Tt),ie=h.unproject(lt.add(ht.mult(Tt*It)).mult(Ft));h.setLocationAtPoint(h.renderWorldCopies?ie.wrap():ie,Q)}this._fireMoveEvents(n)},Tt=>{this._afterEase(n,Tt)},e),this}_prepareEase(e,n,h={}){this._moving=!0,n||h.moving||this.fire(new a.Event("movestart",e)),this._zooming&&!h.zooming&&this.fire(new a.Event("zoomstart",e)),this._rotating&&!h.rotating&&this.fire(new a.Event("rotatestart",e)),this._pitching&&!h.pitching&&this.fire(new a.Event("pitchstart",e))}_fireMoveEvents(e){this.fire(new a.Event("move",e)),this._zooming&&this.fire(new a.Event("zoom",e)),this._rotating&&this.fire(new a.Event("rotate",e)),this._pitching&&this.fire(new a.Event("pitch",e))}_afterEase(e,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;let h=this._zooming,d=this._rotating,g=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,h&&this.fire(new a.Event("zoomend",e)),d&&this.fire(new a.Event("rotateend",e)),g&&this.fire(new a.Event("pitchend",e)),this.fire(new a.Event("moveend",e))}flyTo(e,n){if(!e.essential&&a.exported.prefersReducedMotion){let Re=a.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Re,n)}this.stop(),e=a.extend({offset:[0,0],speed:1.2,curve:1.42,easing:a.ease},e);let h=this.transform,d=this.getZoom(),g=this.getBearing(),v=this.getPitch(),w=this.getPadding(),M="zoom"in e?a.clamp(+e.zoom,h.minZoom,h.maxZoom):d,C="bearing"in e?this._normalizeBearing(e.bearing,g):g,k="pitch"in e?+e.pitch:v,F="padding"in e?e.padding:h.padding,q=h.zoomScale(M-d),Q=a.pointGeometry.convert(e.offset),j=h.centerPoint.add(Q),J=h.pointLocation(j),lt=a.LngLat.convert(e.center||J);this._normalizeCenter(lt);let ht=h.project(J),mt=h.project(lt).sub(ht),ut=e.curve,At=Math.max(h.width,h.height),Mt=At/q,Tt=mt.mag();if("minZoom"in e){let Re=a.clamp(Math.min(e.minZoom,d,M),h.minZoom,h.maxZoom),yi=At/h.zoomScale(Re-d);ut=Math.sqrt(yi/Tt*2)}let Ft=ut*ut;function jt(Re){let yi=(Mt*Mt-At*At+(Re?-1:1)*Ft*Ft*Tt*Tt)/(2*(Re?Mt:At)*Ft*Tt);return Math.log(Math.sqrt(yi*yi+1)-yi)}function It(Re){return(Math.exp(Re)-Math.exp(-Re))/2}function ie(Re){return(Math.exp(Re)+Math.exp(-Re))/2}let Ht=jt(0),xe=function(Re){return ie(Ht)/ie(Ht+ut*Re)},Fe=function(Re){return At*((ie(Ht)*(It(yi=Ht+ut*Re)/ie(yi))-It(Ht))/Ft)/Tt;var yi},ke=(jt(1)-Ht)/ut;if(Math.abs(Tt)<1e-6||!isFinite(ke)){if(Math.abs(At-Mt)<1e-6)return this.easeTo(e,n);let Re=Mt<At?-1:1;ke=Math.abs(Math.log(Mt/At))/ut,Fe=function(){return 0},xe=function(yi){return Math.exp(Re*ut*yi)}}return e.duration="duration"in e?+e.duration:1e3*ke/("screenSpeed"in e?+e.screenSpeed/ut:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=g!==C,this._pitching=k!==v,this._padding=!h.isPaddingEqual(F),this._prepareEase(n,!1),this._ease(Re=>{let yi=Re*ke,be=1/xe(yi);h.zoom=Re===1?M:d+h.scaleZoom(be),this._rotating&&(h.bearing=a.number(g,C,Re)),this._pitching&&(h.pitch=a.number(v,k,Re)),this._padding&&(h.interpolatePadding(w,F,Re),j=h.centerPoint.add(Q));let qe=Re===1?lt:h.unproject(ht.add(mt.mult(Fe(yi))).mult(be));h.setLocationAtPoint(h.renderWorldCopies?qe.wrap():qe,j),this._fireMoveEvents(n)},()=>this._afterEase(n),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let h=this._onEaseEnd;delete this._onEaseEnd,h.call(this,n)}if(!e){let h=this.handlers;h&&h.stop(!1)}return this}_ease(e,n,h){h.animate===!1||h.duration===0?(e(1),n()):(this._easeStart=a.exported.now(),this._easeOptions=h,this._onEaseFrame=e,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){let e=Math.min((a.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(e,n){e=a.wrap(e,-180,180);let h=Math.abs(e-n);return Math.abs(e-360-n)<h&&(e-=360),Math.abs(e+360-n)<h&&(e+=360),e}_normalizeCenter(e){let n=this.transform;if(!n.renderWorldCopies||n.lngRange)return;let h=e.lng-n.center.lng;e.lng+=h>180?-360:h<-180?360:0}}class Ha{constructor(e={}){this.options=e,a.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options&&this.options.compact,this._container=L.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=L.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=L.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){L.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,n){let h=this._map._getUIString(`AttributionControl.${n}`);e.title=h,e.setAttribute("aria-label",h)}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(e){!e||e.sourceDataType!=="metadata"&&e.sourceDataType!=="visibility"&&e.dataType!=="style"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(d=>typeof d!="string"?"":d)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}let n=this._map.style.sourceCaches;for(let d in n){let g=n[d];if(g.used){let v=g.getSource();v.attribution&&e.indexOf(v.attribution)<0&&e.push(v.attribution)}}e=e.filter(d=>String(d).trim()),e.sort((d,g)=>d.length-g.length),e=e.filter((d,g)=>{for(let v=g+1;v<e.length;v++)if(e[v].indexOf(d)>=0)return!1;return!0});let h=e.join(" | ");h!==this._attribHTML&&(this._attribHTML=h,e.length?(this._innerContainer.innerHTML=h,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class ll{constructor(e={}){this.options=e,a.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=L.create("div","maplibregl-ctrl mapboxgl-ctrl");let n=L.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){L.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){let e=this._container.children;if(e.length){let n=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact","mapboxgl-compact"):n.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class _h{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let n=++this._id;return this._queue.push({callback:e,id:n,cancelled:!1}),n}remove(e){let n=this._currentlyRunning,h=n?this._queue.concat(n):this._queue;for(let d of h)if(d.id===e)return void(d.cancelled=!0)}run(e=0){let n=this._currentlyRunning=this._queue;this._queue=[];for(let h of n)if(!h.cancelled&&(h.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}let xh={"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"},jc={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,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},nn={showCompass:!0,showZoom:!0,visualizePitch:!1};class Xa{constructor(e,n,h=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new te({clickTolerance:e.dragRotate._mouseRotate._clickTolerance}),this.map=e,h&&(this.mousePitch=new el({clickTolerance:e.dragRotate._mousePitch._clickTolerance})),a.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),L.addEventListener(n,"mousedown",this.mousedown),L.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),L.addEventListener(n,"touchmove",this.touchmove),L.addEventListener(n,"touchend",this.touchend),L.addEventListener(n,"touchcancel",this.reset)}down(e,n){this.mouseRotate.mousedown(e,n),this.mousePitch&&this.mousePitch.mousedown(e,n),L.disableDrag()}move(e,n){let h=this.map,d=this.mouseRotate.mousemoveWindow(e,n);if(d&&d.bearingDelta&&h.setBearing(h.getBearing()+d.bearingDelta),this.mousePitch){let g=this.mousePitch.mousemoveWindow(e,n);g&&g.pitchDelta&&h.setPitch(h.getPitch()+g.pitchDelta)}}off(){let e=this.element;L.removeEventListener(e,"mousedown",this.mousedown),L.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),L.removeEventListener(e,"touchmove",this.touchmove),L.removeEventListener(e,"touchend",this.touchend),L.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){L.enableDrag(),L.removeEventListener(window,"mousemove",this.mousemove),L.removeEventListener(window,"mouseup",this.mouseup)}mousedown(e){this.down(a.extend({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),L.mousePos(this.element,e)),L.addEventListener(window,"mousemove",this.mousemove),L.addEventListener(window,"mouseup",this.mouseup)}mousemove(e){this.move(e,L.mousePos(this.element,e))}mouseup(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}touchstart(e){e.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=L.touchPos(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>e.preventDefault()},this._startPos))}touchmove(e){e.targetTouches.length!==1?this.reset():(this._lastPos=L.touchPos(this.element,e.targetTouches)[0],this.move({preventDefault:()=>e.preventDefault()},this._lastPos))}touchend(e){e.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function ne(p,e,n){if(p=new a.LngLat(p.lng,p.lat),e){let h=new a.LngLat(p.lng-360,p.lat),d=new a.LngLat(p.lng+360,p.lat),g=n.locationPoint(p).distSqr(e);n.locationPoint(h).distSqr(e)<g?p=h:n.locationPoint(d).distSqr(e)<g&&(p=d)}for(;Math.abs(p.lng-n.center.lng)>180;){let h=n.locationPoint(p);if(h.x>=0&&h.y>=0&&h.x<=n.width&&h.y<=n.height)break;p.lng>n.center.lng?p.lng-=360:p.lng+=360}return p}let de={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 ia(p,e,n){let h=p.classList;for(let d in de)h.remove(`maplibregl-${n}-anchor-${d}`,`mapboxgl-${n}-anchor-${d}`);h.add(`maplibregl-${n}-anchor-${e}`,`mapboxgl-${n}-anchor-${e}`)}class ra extends a.Evented{constructor(e,n){if(super(),(e instanceof HTMLElement||n)&&(e=a.extend({element:e},n)),a.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,e&&e.element)this._element=e.element,this._offset=a.pointGeometry.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=L.create("div"),this._element.setAttribute("aria-label","Map marker");let h=L.createNS("http://www.w3.org/2000/svg","svg"),d=41,g=27;h.setAttributeNS(null,"display","block"),h.setAttributeNS(null,"height",`${d}px`),h.setAttributeNS(null,"width",`${g}px`),h.setAttributeNS(null,"viewBox",`0 0 ${g} ${d}`);let v=L.createNS("http://www.w3.org/2000/svg","g");v.setAttributeNS(null,"stroke","none"),v.setAttributeNS(null,"stroke-width","1"),v.setAttributeNS(null,"fill","none"),v.setAttributeNS(null,"fill-rule","evenodd");let w=L.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill-rule","nonzero");let M=L.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"transform","translate(3.0, 29.0)"),M.setAttributeNS(null,"fill","#000000");let C=[{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"}];for(let mt of C){let ut=L.createNS("http://www.w3.org/2000/svg","ellipse");ut.setAttributeNS(null,"opacity","0.04"),ut.setAttributeNS(null,"cx","10.5"),ut.setAttributeNS(null,"cy","5.80029008"),ut.setAttributeNS(null,"rx",mt.rx),ut.setAttributeNS(null,"ry",mt.ry),M.appendChild(ut)}let k=L.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"fill",this._color);let F=L.createNS("http://www.w3.org/2000/svg","path");F.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"),k.appendChild(F);let q=L.createNS("http://www.w3.org/2000/svg","g");q.setAttributeNS(null,"opacity","0.25"),q.setAttributeNS(null,"fill","#000000");let Q=L.createNS("http://www.w3.org/2000/svg","path");Q.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"),q.appendChild(Q);let j=L.createNS("http://www.w3.org/2000/svg","g");j.setAttributeNS(null,"transform","translate(6.0, 7.0)"),j.setAttributeNS(null,"fill","#FFFFFF");let J=L.createNS("http://www.w3.org/2000/svg","g");J.setAttributeNS(null,"transform","translate(8.0, 8.0)");let lt=L.createNS("http://www.w3.org/2000/svg","circle");lt.setAttributeNS(null,"fill","#000000"),lt.setAttributeNS(null,"opacity","0.25"),lt.setAttributeNS(null,"cx","5.5"),lt.setAttributeNS(null,"cy","5.5"),lt.setAttributeNS(null,"r","5.4999962");let ht=L.createNS("http://www.w3.org/2000/svg","circle");ht.setAttributeNS(null,"fill","#FFFFFF"),ht.setAttributeNS(null,"cx","5.5"),ht.setAttributeNS(null,"cy","5.5"),ht.setAttributeNS(null,"r","5.4999962"),J.appendChild(lt),J.appendChild(ht),w.appendChild(M),w.appendChild(k),w.appendChild(q),w.appendChild(j),w.appendChild(J),h.appendChild(w),h.setAttributeNS(null,"height",d*this._scale+"px"),h.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(h),this._offset=a.pointGeometry.convert(e&&e.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",h=>{h.preventDefault()}),this._element.addEventListener("mousedown",h=>{h.preventDefault()}),ia(this._element,this._anchor,"marker"),this._popup=null}addTo(e){return this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){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),L.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=a.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let d=Math.sqrt(Math.pow(13.5,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[d,-1*(38.1-13.5+d)],"bottom-right":[-d,-1*(38.1-13.5+d)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,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}_onKeyPress(e){let n=e.code,h=e.charCode||e.keyCode;n!=="Space"&&n!=="Enter"&&h!==32&&h!==13||this.togglePopup()}_onMapClick(e){let n=e.originalEvent.target,h=this._element;this._popup&&(n===h||h.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){let e=this._popup;return e?(e.isOpen()?e.remove():e.addTo(this._map),this):this}_update(e){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=ne(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let h="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?h="rotateX(0deg)":this._pitchAlignment==="map"&&(h=`rotateX(${this._map.getPitch()}deg)`),e&&e.type!=="moveend"||(this._pos=this._pos.round()),L.setTransform(this._element,`${de[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${h} ${n}`)}getOffset(){return this._offset}setOffset(e){return this._offset=a.pointGeometry.convert(e),this._update(),this}_onMove(e){if(!this._isDragging){let n=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=e.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 a.Event("dragstart"))),this.fire(new a.Event("drag")))}_onUp(){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 a.Event("dragend")),this._state="inactive"}_addDragHandler(e){this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.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))}setDraggable(e){return this._draggable=!!e,this._map&&(e?(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}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}let hl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Fi,qn=0,cr=!1,$c={maxWidth:100,unit:"metric"};function na(p,e,n){let h=n&&n.maxWidth||100,d=p._container.clientHeight/2,g=p.unproject([0,d]),v=p.unproject([h,d]),w=g.distanceTo(v);if(n&&n.unit==="imperial"){let M=3.2808*w;M>5280?oi(e,h,M/5280,p._getUIString("ScaleControl.Miles")):oi(e,h,M,p._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?oi(e,h,w/1852,p._getUIString("ScaleControl.NauticalMiles")):w>=1e3?oi(e,h,w/1e3,p._getUIString("ScaleControl.Kilometers")):oi(e,h,w,p._getUIString("ScaleControl.Meters"))}function oi(p,e,n,h){let d=function(g){let v=Math.pow(10,`${Math.floor(g)}`.length-1),w=g/v;return w=w>=10?10:w>=5?5:w>=3?3:w>=2?2:w>=1?1:function(M){let C=Math.pow(10,Math.ceil(-Math.log(M)/Math.LN10));return Math.round(M*C)/C}(w),v*w}(n);p.style.width=e*(d/n)+"px",p.innerHTML=`${d}&nbsp;${h}`}let Oi={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},vh=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ts(p){if(p){if(typeof p=="number"){let e=Math.round(Math.sqrt(.5*Math.pow(p,2)));return{center:new a.pointGeometry(0,0),top:new a.pointGeometry(0,p),"top-left":new a.pointGeometry(e,e),"top-right":new a.pointGeometry(-e,e),bottom:new a.pointGeometry(0,-p),"bottom-left":new a.pointGeometry(e,-e),"bottom-right":new a.pointGeometry(-e,-e),left:new a.pointGeometry(p,0),right:new a.pointGeometry(-p,0)}}if(p instanceof a.pointGeometry||Array.isArray(p)){let e=a.pointGeometry.convert(p);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:a.pointGeometry.convert(p.center||[0,0]),top:a.pointGeometry.convert(p.top||[0,0]),"top-left":a.pointGeometry.convert(p["top-left"]||[0,0]),"top-right":a.pointGeometry.convert(p["top-right"]||[0,0]),bottom:a.pointGeometry.convert(p.bottom||[0,0]),"bottom-left":a.pointGeometry.convert(p["bottom-left"]||[0,0]),"bottom-right":a.pointGeometry.convert(p["bottom-right"]||[0,0]),left:a.pointGeometry.convert(p.left||[0,0]),right:a.pointGeometry.convert(p.right||[0,0])}}return Ts(new a.pointGeometry(0,0))}let sa={supported:T,setRTLTextPlugin:a.setRTLTextPlugin,getRTLTextPluginStatus:a.getRTLTextPluginStatus,Map:class extends Za{constructor(p){var e;if(a.PerformanceUtils.mark(a.PerformanceMarkers.create),(p=a.extend({},jc,p)).minZoom!=null&&p.maxZoom!=null&&p.minZoom>p.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(p.minPitch!=null&&p.maxPitch!=null&&p.minPitch>p.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(p.minPitch!=null&&p.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(p.maxPitch!=null&&p.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Xs(p.minZoom,p.maxZoom,p.minPitch,p.maxPitch,p.renderWorldCopies),{bearingSnap:p.bearingSnap}),this._interactive=p.interactive,this._maxTileCacheSize=p.maxTileCacheSize,this._failIfMajorPerformanceCaveat=p.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=p.preserveDrawingBuffer,this._antialias=p.antialias,this._trackResize=p.trackResize,this._bearingSnap=p.bearingSnap,this._refreshExpiredTiles=p.refreshExpiredTiles,this._fadeDuration=p.fadeDuration,this._crossSourceCollisions=p.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=p.collectResourceTiming,this._renderTaskQueue=new _h,this._controls=[],this._mapId=a.uniqueId(),this._locale=a.extend({},xh,p.locale),this._clickTolerance=p.clickTolerance,this._pixelRatio=(e=p.pixelRatio)!==null&&e!==void 0?e:devicePixelRatio,this._requestManager=new it(p.transformRequest),typeof p.container=="string"){if(this._container=document.getElementById(p.container),!this._container)throw new Error(`Container '${p.container}' not found.`)}else{if(!(p.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=p.container}if(p.maxBounds&&this.setMaxBounds(p.maxBounds),a.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",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),typeof window<"u"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new Rr(this,p),this._hash=p.hash&&new oh(typeof p.hash=="string"&&p.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:p.center,zoom:p.zoom,bearing:p.bearing,pitch:p.pitch}),p.bounds&&(this.resize(),this.fitBounds(p.bounds,a.extend({},p.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=p.localIdeographFontFamily,p.style&&this.setStyle(p.style,{localIdeographFontFamily:p.localIdeographFontFamily}),p.attributionControl&&this.addControl(new Ha({customAttribution:p.customAttribution})),p.maplibreLogo&&this.addControl(new ll,p.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new a.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new a.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new a.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(p,e){if(e===void 0&&(e=p.getDefaultPosition?p.getDefaultPosition():"top-right"),!p||!p.onAdd)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let n=p.onAdd(this);this._controls.push(p);let h=this._controlPositions[e];return e.indexOf("bottom")!==-1?h.insertBefore(n,h.firstChild):h.appendChild(n),this}removeControl(p){if(!p||!p.onRemove)return this.fire(new a.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let e=this._controls.indexOf(p);return e>-1&&this._controls.splice(e,1),p.onRemove(this),this}hasControl(p){return this._controls.indexOf(p)>-1}resize(p){let e=this._containerDimensions(),n=e[0],h=e[1];this._resizeCanvas(n,h,this.getPixelRatio()),this.transform.resize(n,h),this.painter.resize(n,h,this.getPixelRatio());let d=!this._moving;return d&&(this.stop(),this.fire(new a.Event("movestart",p)).fire(new a.Event("move",p))),this.fire(new a.Event("resize",p)),d&&this.fire(new a.Event("moveend",p)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(p){let[e,n]=this._containerDimensions();this._pixelRatio=p,this._resizeCanvas(e,n,p),this.painter.resize(e,n,p)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(p){return this.transform.setMaxBounds(a.LngLatBounds.convert(p)),this._update()}setMinZoom(p){if((p=p??-2)>=-2&&p<=this.transform.maxZoom)return this.transform.minZoom=p,this._update(),this.getZoom()<p&&this.setZoom(p),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(p){if((p=p??22)>=this.transform.minZoom)return this.transform.maxZoom=p,this._update(),this.getZoom()>p&&this.setZoom(p),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(p){if((p=p??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(p>=0&&p<=this.transform.maxPitch)return this.transform.minPitch=p,this._update(),this.getPitch()<p&&this.setPitch(p),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(p){if((p=p??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(p>=this.transform.minPitch)return this.transform.maxPitch=p,this._update(),this.getPitch()>p&&this.setPitch(p),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(p){return this.transform.renderWorldCopies=p,this._update()}project(p){return this.transform.locationPoint(a.LngLat.convert(p))}unproject(p){return this.transform.pointLocation(a.pointGeometry.convert(p))}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(p,e,n){if(p==="mouseenter"||p==="mouseover"){let h=!1;return{layer:e,listener:n,delegates:{mousemove:g=>{let v=this.getLayer(e)?this.queryRenderedFeatures(g.point,{layers:[e]}):[];v.length?h||(h=!0,n.call(this,new xr(p,this,g.originalEvent,{features:v}))):h=!1},mouseout:()=>{h=!1}}}}if(p==="mouseleave"||p==="mouseout"){let h=!1;return{layer:e,listener:n,delegates:{mousemove:v=>{(this.getLayer(e)?this.queryRenderedFeatures(v.point,{layers:[e]}):[]).length?h=!0:h&&(h=!1,n.call(this,new xr(p,this,v.originalEvent)))},mouseout:v=>{h&&(h=!1,n.call(this,new xr(p,this,v.originalEvent)))}}}}{let h=d=>{let g=this.getLayer(e)?this.queryRenderedFeatures(d.point,{layers:[e]}):[];g.length&&(d.features=g,n.call(this,d),delete d.features)};return{layer:e,listener:n,delegates:{[p]:h}}}}on(p,e,n){if(n===void 0)return super.on(p,e);let h=this._createDelegatedListener(p,e,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[p]=this._delegatedListeners[p]||[],this._delegatedListeners[p].push(h);for(let d in h.delegates)this.on(d,h.delegates[d]);return this}once(p,e,n){if(n===void 0)return super.once(p,e);let h=this._createDelegatedListener(p,e,n);for(let d in h.delegates)this.once(d,h.delegates[d]);return this}off(p,e,n){return n===void 0?super.off(p,e):(this._delegatedListeners&&this._delegatedListeners[p]&&(h=>{let d=this._delegatedListeners[p];for(let g=0;g<d.length;g++){let v=d[g];if(v.layer===e&&v.listener===n){for(let w in v.delegates)this.off(w,v.delegates[w]);return d.splice(g,1),this}}})(),this)}queryRenderedFeatures(p,e){if(!this.style)return[];let n;if(e!==void 0||p===void 0||p instanceof a.pointGeometry||Array.isArray(p)||(e=p,p=void 0),e=e||{},(p=p||[[0,0],[this.transform.width,this.transform.height]])instanceof a.pointGeometry||typeof p[0]=="number")n=[a.pointGeometry.convert(p)];else{let h=a.pointGeometry.convert(p[0]),d=a.pointGeometry.convert(p[1]);n=[h,new a.pointGeometry(d.x,h.y),d,new a.pointGeometry(h.x,d.y),h]}return this.style.queryRenderedFeatures(n,e,this.transform)}querySourceFeatures(p,e){return this.style.querySourceFeatures(p,e)}setStyle(p,e){return(e=a.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&p?(this._diffStyle(p,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(p,e))}setTransformRequest(p){return this._requestManager.setTransformRequest(p),this}_getUIString(p){let e=this._locale[p];if(e==null)throw new Error(`Missing UI string '${p}'`);return e}_updateStyle(p,e){return this.style&&(this.style.setEventedParent(null),this.style._remove()),p?(this.style=new Wi(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof p=="string"?this.style.loadURL(p):this.style.loadJSON(p),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Wi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(p,e){if(typeof p=="string"){let n=this._requestManager.transformRequest(p,a.ResourceType.Style);a.getJSON(n,(h,d)=>{h?this.fire(new a.ErrorEvent(h)):d&&this._updateDiff(d,e)})}else typeof p=="object"&&this._updateDiff(p,e)}_updateDiff(p,e){try{this.style.setState(p)&&this._update(!0)}catch(n){a.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(p,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():a.warnOnce("There is no style added to the map.")}addSource(p,e){return this._lazyInitEmptyStyle(),this.style.addSource(p,e),this._update(!0)}isSourceLoaded(p){let e=this.style&&this.style.sourceCaches[p];if(e!==void 0)return e.loaded();this.fire(new a.ErrorEvent(new Error(`There is no source with ID '${p}'`)))}areTilesLoaded(){let p=this.style&&this.style.sourceCaches;for(let e in p){let n=p[e]._tiles;for(let h in n){let d=n[h];if(d.state!=="loaded"&&d.state!=="errored")return!1}}return!0}addSourceType(p,e,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(p,e,n)}removeSource(p){return this.style.removeSource(p),this._update(!0)}getSource(p){return this.style.getSource(p)}addImage(p,e,{pixelRatio:n=1,sdf:h=!1,stretchX:d,stretchY:g,content:v}={}){if(this._lazyInitEmptyStyle(),e instanceof HTMLImageElement||a.isImageBitmap(e)){let{width:w,height:M,data:C}=a.exported.getImageData(e);this.style.addImage(p,{data:new a.RGBAImage({width:w,height:M},C),pixelRatio:n,stretchX:d,stretchY:g,content:v,sdf:h,version:0})}else{if(e.width===void 0||e.height===void 0)return this.fire(new a.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`")));{let{width:w,height:M,data:C}=e,k=e;this.style.addImage(p,{data:new a.RGBAImage({width:w,height:M},new Uint8Array(C)),pixelRatio:n,stretchX:d,stretchY:g,content:v,sdf:h,version:0,userImage:k}),k.onAdd&&k.onAdd(this,p)}}}updateImage(p,e){let n=this.style.getImage(p);if(!n)return this.fire(new a.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let h=e instanceof HTMLImageElement||a.isImageBitmap(e)?a.exported.getImageData(e):e,{width:d,height:g,data:v}=h;if(d===void 0||g===void 0)return this.fire(new a.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`")));if(d!==n.data.width||g!==n.data.height)return this.fire(new a.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));let w=!(e instanceof HTMLImageElement||a.isImageBitmap(e));n.data.replace(v,w),this.style.updateImage(p,n)}hasImage(p){return p?!!this.style.getImage(p):(this.fire(new a.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(p){this.style.removeImage(p)}loadImage(p,e){a.getImage(this._requestManager.transformRequest(p,a.ResourceType.Image),e)}listImages(){return this.style.listImages()}addLayer(p,e){return this._lazyInitEmptyStyle(),this.style.addLayer(p,e),this._update(!0)}moveLayer(p,e){return this.style.moveLayer(p,e),this._update(!0)}removeLayer(p){return this.style.removeLayer(p),this._update(!0)}getLayer(p){return this.style.getLayer(p)}setLayerZoomRange(p,e,n){return this.style.setLayerZoomRange(p,e,n),this._update(!0)}setFilter(p,e,n={}){return this.style.setFilter(p,e,n),this._update(!0)}getFilter(p){return this.style.getFilter(p)}setPaintProperty(p,e,n,h={}){return this.style.setPaintProperty(p,e,n,h),this._update(!0)}getPaintProperty(p,e){return this.style.getPaintProperty(p,e)}setLayoutProperty(p,e,n,h={}){return this.style.setLayoutProperty(p,e,n,h),this._update(!0)}getLayoutProperty(p,e){return this.style.getLayoutProperty(p,e)}setLight(p,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(p,e),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(p,e){return this.style.setFeatureState(p,e),this._update()}removeFeatureState(p,e){return this.style.removeFeatureState(p,e),this._update()}getFeatureState(p){return this.style.getFeatureState(p)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let p=0,e=0;return this._container&&(p=this._container.clientWidth||400,e=this._container.clientHeight||300),[p,e]}_setupContainer(){let p=this._container;p.classList.add("maplibregl-map","mapboxgl-map");let e=this._canvasContainer=L.create("div","maplibregl-canvas-container mapboxgl-canvas-container",p);this._interactive&&e.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=L.create("canvas","maplibregl-canvas mapboxgl-canvas",e),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");let n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());let h=this._controlContainer=L.create("div","maplibregl-control-container mapboxgl-control-container",p),d=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(g=>{d[g]=L.create("div",`maplibregl-ctrl-${g} mapboxgl-ctrl-${g}`,h)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(p,e,n){this._canvas.width=n*p,this._canvas.height=n*e,this._canvas.style.width=`${p}px`,this._canvas.style.height=`${e}px`}_setupPainter(){let p=a.extend({},T.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),e=this._canvas.getContext("webgl",p)||this._canvas.getContext("experimental-webgl",p);e?(this.painter=new Qo(e,this.transform),a.exported$1.testSupport(e)):this.fire(new a.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(p){p.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.Event("webglcontextlost",{originalEvent:p}))}_contextRestored(p){this._setupPainter(),this.resize(),this._update(),this.fire(new a.Event("webglcontextrestored",{originalEvent:p}))}_onMapScroll(p){if(p.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(p){return this.style?(this._styleDirty=this._styleDirty||p,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(p){return this._update(),this._renderTaskQueue.add(p)}_cancelRenderFrame(p){this._renderTaskQueue.remove(p)}_render(p){let e,n=0,h=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(e=h.createQueryEXT(),h.beginQueryEXT(h.TIME_ELAPSED_EXT,e),n=a.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(p),this._removed)return;let d=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let v=this.transform.zoom,w=a.exported.now();this.style.zoomHistory.update(v,w);let M=new a.EvaluationParameters(v,{now:w,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),C=M.crossFadingFactor();C===1&&C===this._crossFadingFactor||(d=!0,this._crossFadingFactor=C),this.style.update(M)}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 a.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,a.PerformanceUtils.mark(a.PerformanceMarkers.load),this.fire(new a.Event("load"))),this.style&&(this.style.hasTransitions()||d)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){let v=a.exported.now()-n;h.endQueryEXT(h.TIME_ELAPSED_EXT,e),setTimeout(()=>{let w=h.getQueryObjectEXT(e,h.QUERY_RESULT_EXT)/1e6;h.deleteQueryEXT(e),this.fire(new a.Event("gpu-timing-frame",{cpuTime:v,gpuTime:w}))},50)}if(this.listens("gpu-timing-layer")){let v=this.painter.collectGpuTimers();setTimeout(()=>{let w=this.painter.queryGpuTimers(v);this.fire(new a.Event("gpu-timing-layer",{layerTimes:w}))},50)}let g=this._sourcesDirty||this._styleDirty||this._placementDirty;return g||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new a.Event("idle")),!this._loaded||this._fullyLoaded||g||(this._fullyLoaded=!0,a.PerformanceUtils.mark(a.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let e of this._controls)e.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),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));let p=this.painter.context.gl.getExtension("WEBGL_lose_context");p&&p.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),L.remove(this._canvasContainer),L.remove(this._controlContainer),this._container.classList.remove("maplibregl-map","mapboxgl-map"),a.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new a.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=a.exported.frame(p=>{a.PerformanceUtils.frame(p),this._frame=null,this._render(p)}))}_onWindowOnline(){this._update()}_onWindowResize(p){this._trackResize&&this.resize({originalEvent:p})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(p){this._showTileBoundaries!==p&&(this._showTileBoundaries=p,this._update())}get showPadding(){return!!this._showPadding}set showPadding(p){this._showPadding!==p&&(this._showPadding=p,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(p){this._showCollisionBoxes!==p&&(this._showCollisionBoxes=p,p?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(p){this._showOverdrawInspector!==p&&(this._showOverdrawInspector=p,this._update())}get repaint(){return!!this._repaint}set repaint(p){this._repaint!==p&&(this._repaint=p,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(p){this._vertices=p,this._update()}_setCacheLimits(p,e){a.setCacheLimits(p,e)}},NavigationControl:class{constructor(p){this.options=a.extend({},nn,p),this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(a.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),L.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),L.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(a.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=L.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let p=this._map.getZoom(),e=p===this._map.getMaxZoom(),n=p===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){let p=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=p}onAdd(p){return this._map=p,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 Xa(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){L.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}_createButton(p,e){let n=L.create("button",p,this._container);return n.type="button",n.addEventListener("click",e),n}_setButtonTitle(p,e){let n=this._map._getUIString(`NavigationControl.${e}`);p.title=n,p.setAttribute("aria-label",n)}},GeolocateControl:class extends a.Evented{constructor(p){super(),this.options=a.extend({},hl,p),a.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(p){var e;return this._map=p,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),e=this._setupUI,Fi!==void 0?e(Fi):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{Fi=n.state!=="denied",e(Fi)}):(Fi=!!window.navigator.geolocation,e(Fi)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(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(),L.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,qn=0,cr=!1}_isOutOfMapMaxBounds(p){let e=this._map.getMaxBounds(),n=p.coords;return e&&(n.longitude<e.getWest()||n.longitude>e.getEast()||n.latitude<e.getSouth()||n.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(p){if(this._map){if(this._isOutOfMapMaxBounds(p))return this._setErrorState(),this.fire(new a.Event("outofmaxbounds",p)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=p,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(p),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(p),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new a.Event("geolocate",p)),this._finish()}}_updateCamera(p){let e=new a.LngLat(p.coords.longitude,p.coords.latitude),n=p.coords.accuracy,h=this._map.getBearing(),d=a.extend({bearing:h},this.options.fitBoundsOptions);this._map.fitBounds(e.toBounds(n),d,{geolocateSource:!0})}_updateMarker(p){if(p){let e=new a.LngLat(p.coords.longitude,p.coords.latitude);this._accuracyCircleMarker.setLngLat(e).addTo(this._map),this._userLocationDotMarker.setLngLat(e).addTo(this._map),this._accuracy=p.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){let p=this._map._container.clientHeight/2,e=this._map.unproject([0,p]),n=this._map.unproject([1,p]),h=e.distanceTo(n),d=Math.ceil(2*this._accuracy/h);this._circleElement.style.width=`${d}px`,this._circleElement.style.height=`${d}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(p){if(this._map){if(this.options.trackUserLocation)if(p.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(p.code===3&&cr)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new a.Event("error",p)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(p){if(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=L.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),L.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",p===!1){a.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{let e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=L.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new ra(this._dotElement),this._circleElement=L.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ra({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",e=>{e.geolocateSource||this._watchState!=="ACTIVE_LOCK"||e.originalEvent&&e.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new a.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return a.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 a.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":qn--,cr=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new a.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let p;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),qn++,qn>1?(p={maximumAge:6e5,timeout:0},cr=!0):(p=this.options.positionOptions,cr=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,p)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Ha,LogoControl:ll,ScaleControl:class{constructor(p){this.options=a.extend({},$c,p),a.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){na(this._map,this._container,this.options)}onAdd(p){return this._map=p,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",p.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){L.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(p){this.options.unit=p,na(this._map,this._container,this.options)}},FullscreenControl:class{constructor(p){this._fullscreen=!1,p&&p.container&&(p.container instanceof HTMLElement?this._container=p.container:a.warnOnce("Full screen control 'container' must be a DOM element.")),a.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(p){return this._map=p,this._container||(this._container=this._map.getContainer()),this._controlContainer=L.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){L.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){let p=this._fullscreenButton=L.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);L.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",p).setAttribute("aria-hidden","true"),p.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let p=this._getTitle();this._fullscreenButton.setAttribute("aria-label",p),this._fullscreenButton.title=p}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&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()}},Popup:class extends a.Evented{constructor(p){super(),this.options=a.extend(Object.create(Oi),p),a.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(p){return this._map&&this.remove(),this._map=p,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","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new a.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&L.remove(this._content),this._container&&(L.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 a.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(p){return this._lngLat=a.LngLat.convert(p),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","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){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","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(p){return this.setDOMContent(document.createTextNode(p))}setHTML(p){let e=document.createDocumentFragment(),n=document.createElement("body"),h;for(n.innerHTML=p;h=n.firstChild,h;)e.appendChild(h);return this.setDOMContent(e)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(p){return this.options.maxWidth=p,this._update(),this}setDOMContent(p){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=L.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(p),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(p){this._container&&this._container.classList.add(p)}removeClassName(p){this._container&&this._container.classList.remove(p)}setOffset(p){return this.options.offset=p,this._update(),this}toggleClassName(p){if(this._container)return this._container.classList.toggle(p)}_createCloseButton(){this.options.closeButton&&(this._closeButton=L.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(p){this._update(p.point)}_onMouseMove(p){this._update(p.point)}_onDrag(p){this._update(p.point)}_update(p){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=L.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=L.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(g=>this._container.classList.add(g)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-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=ne(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!p))return;let e=this._pos=this._trackPointer&&p?p:this._map.project(this._lngLat),n=this.options.anchor,h=Ts(this.options.offset);if(!n){let g=this._container.offsetWidth,v=this._container.offsetHeight,w;w=e.y+h.bottom.y<v?["top"]:e.y>this._map.transform.height-v?["bottom"]:[],e.x<g/2?w.push("left"):e.x>this._map.transform.width-g/2&&w.push("right"),n=w.length===0?"bottom":w.join("-")}let d=e.add(h[n]).round();L.setTransform(this._container,`${de[n]} translate(${d.x}px,${d.y}px)`),ia(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let p=this._container.querySelector(vh);p&&p.focus()}_onClose(){this.remove()}},Marker:ra,Style:Wi,LngLat:a.LngLat,LngLatBounds:a.LngLatBounds,Point:a.pointGeometry,MercatorCoordinate:a.MercatorCoordinate,Evented:a.Evented,AJAXError:a.AJAXError,config:a.config,CanvasSource:en,GeoJSONSource:dn,ImageSource:kr,RasterDEMTileSource:_i,RasterTileSource:Gr,VectorTileSource:Pr,VideoSource:tn,prewarm:function(){N().acquire(fn)},clearPrewarmedResources:function(){let p=ft;p&&(p.isPreloaded()&&p.numActive()===1?(p.release(fn),ft=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 workerCount(){return Dr.workerCount},set workerCount(p){Dr.workerCount=p},get maxParallelImageRequests(){return a.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(p){a.config.MAX_PARALLEL_IMAGE_REQUESTS=p},clearStorage(p){a.clearTileCache(p)},workerUrl:"",addProtocol(p,e){a.config.REGISTERED_PROTOCOLS[p]=e},removeProtocol(p){delete a.config.REGISTERED_PROTOCOLS[p]}};return hi.extend(sa,{isSafari:a.isSafari,getPerformanceMetrics:a.PerformanceUtils.getPerformanceMetrics}),sa});var _=u;return _})});H();Xr();H();Xr();H();H();H();function pa(s){var l=new Error(s);return l.source="ulid",l}var Hh="0123456789ABCDEFGHJKMNPQRSTVWXYZ",co=Hh.length,ku=Math.pow(2,48)-1,Lu=10,Wd=16;function r0(s){var l=Math.floor(s()*co);return l===co&&(l=co-1),Hh.charAt(l)}function n0(s,l){if(isNaN(s))throw new Error(s+" must be a number");if(s>ku)throw pa("cannot encode time greater than "+ku);if(s<0)throw pa("time must be positive");if(Number.isInteger(s)===!1)throw pa("time must be an integer");for(var u=void 0,y="";l>0;l--)u=s%co,y=Hh.charAt(u)+y,s=(s-u)/co;return y}function s0(s,l){for(var u="";s>0;s--)u=r0(l)+u;return u}function Zd(s){if(s.length!==Lu+Wd)throw pa("malformed ulid");var l=s.substr(0,Lu).split("").reverse().reduce(function(u,y,_){var a=Hh.indexOf(y);if(a===-1)throw pa("invalid character found: "+y);return u+=a*Math.pow(co,_)},0);if(l>ku)throw pa("malformed ulid, timestamp too large");return l}function a0(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,l=arguments[1];l||(l=typeof window<"u"?window:null);var u=l&&(l.crypto||l.msCrypto);if(u)return function(){var _=new Uint8Array(1);return u.getRandomValues(_),_[0]/255};try{var y=$d();return function(){return y.randomBytes(1).readUInt8()/255}}catch{}if(s){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return function(){return Math.random()}}throw pa("secure crypto unusable, insecure Math.random not allowed")}function o0(s){return s||(s=a0()),function(u){return isNaN(u)&&(u=Date.now()),n0(u,Lu)+s0(Wd,s)}}var Hd=o0();var Xd=()=>typeof localStorage<"u",l0=24*60*60*1e3,h0=30*l0;function Al(){let s="c"+Hd().toLowerCase();return Xd()&&localStorage.setItem("api-key",s),s}function Kd(){if(!Xd())return Al();let s=localStorage.getItem("api-key");if(s==null||!s.startsWith("c"))return Al();try{let l=Zd(s.slice(1).toUpperCase());return Date.now()-h0<l?s:Al()}catch{return Al()}}H();H();H();var Li=class{constructor(l,u,y,_){this.x=l,this.y=u,this.width=y,this.height=_}get bottom(){return this.y+this.height}get right(){return this.x+this.width}intersects(l){return this.x<l.right&&l.x<this.right&&this.y<l.bottom&&l.y<this.bottom}containsBounds(l){return Li.contains(this,l)}intersection(l){let u=Math.max(this.x,l.x),y=Math.min(this.x+this.width,l.x+l.width),_=Math.max(this.y,l.y),a=Math.min(this.y+this.height,l.y+l.height);return y>u&&a>_?new Li(u,_,y-u,a-_):null}static union(l){if(l.length===0)throw new Error("Union on empty list is not allowed");let{x:u,y}=l[0],_=u+l[0].width,a=y+l[0].height;for(let T=1;T<l.length;++T){let E=l[T];u=Math.min(u,E.x),_=Math.max(_,E.x+E.width),y=Math.min(y,E.y),a=Math.max(a,E.y+E.height)}return new Li(u,y,_-u,a-y)}union(l){return Li.union([this,l])}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(l,u=l){return new Li(this.x*l,this.y*u,this.width*l,this.height*u)}scaleFromCenter(l,u=l){let y=this.width*l,_=this.height*u;return new Li(this.x-.5*(y-this.width),this.y-.5*(_-this.height),y,_)}pad(l,u=l){return new Li(this.x-l,this.y-u,this.width+l*2,this.height+u*2)}round(l=0){let u=Math.round(this.x-l),y=Math.round(this.y-l);return new Li(u,y,Math.round(this.right+l)-u,Math.round(this.bottom+l)-y)}add(l){return new Li(this.x+l.x,this.y+l.y,this.width,this.height)}subtract(l){return new Li(this.x-l.x,this.y-l.y,this.width,this.height)}static fromMultiPolygon(l){if(l.length===0)return new Li(0,0,0,0);let u=l[0][0][0][0],y=l[0][0][0][1],_=u,a=y;for(let[T]of l)for(let[E,B]of T)E<u?u=E:E>_&&(_=E),B<y?y=B:B>a&&(a=B);return new Li(u,y,_-u,a-y)}static fromBbox([l,u,y,_]){return new Li(Math.min(l,y),Math.min(u,_),Math.abs(y-l),Math.abs(_-u))}static fromUpperLeftLowerRight(l,u){return new Li(l.x,l.y,u.x-l.x,u.y-l.y)}static fromJson(l){return new Li(l.x,l.y,l.width,l.height)}static compareArea(l,u){let y=l.width*l.height-u.width*u.height;if(y!==0)return y;let _=l.x-u.x;return _===0?l.y-u.y:_}static contains(l,u){return l.x<=u.x&&l.x+l.width>=u.x+u.width&&l.y<=u.y&&l.y+l.height>=u.y+u.height}};H();var We;(function(s){s[s.Google=3857]="Google",s[s.Wgs84=4326]="Wgs84",s[s.Nztm2000=2193]="Nztm2000",s[s.Citm2000=3793]="Citm2000"})(We||(We={}));var Du={google:We.Google,epsg3857:We.Google,[We.Google]:We.Google,globalmercator:We.Google,wgs84:We.Wgs84,epsg4326:We.Wgs84,[We.Wgs84]:We.Wgs84,nztm:We.Nztm2000,epsg2193:We.Nztm2000,[We.Nztm2000]:We.Nztm2000,nztm2000:We.Nztm2000,citm:We.Citm2000,epsg3793:We.Citm2000,[We.Citm2000]:We.Citm2000,citm2000:We.Citm2000},Ve=class{constructor(l){if(this.code=l,Ve.Codes.has(l))throw new Error(`Duplicate EPSG code created: ${l}`);Ve.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(l){let u=Ve.Codes.get(l);if(u==null)throw new Error(`Invalid EPSG:${l}`);return u}static tryGet(l){if(l!=null)return Ve.Codes.get(l)}static parseCode(l){var u;return l.startsWith("urn:")?Du[l.slice(l.lastIndexOf(":")+1)]:l.startsWith("https://")?Du[l.slice(l.lastIndexOf("/")+1)]:(u=Du[l.replace(/[\W_]/g,"").toLowerCase()])!==null&&u!==void 0?u:null}static parse(l){let u=Ve.parseCode(l);return u==null?null:Ve.get(u)}};Ve.Codes=new Map;Ve.Google=new Ve(We.Google);Ve.Wgs84=new Ve(We.Wgs84);Ve.Nztm2000=new Ve(We.Nztm2000);Ve.Citm2000=new Ve(We.Citm2000);H();var y1="0".charCodeAt(0),_1="1".charCodeAt(0),x1="2".charCodeAt(0),v1="3".charCodeAt(0);H();H();var uo;(function(s){s[s.Xy=0]="Xy",s[s.Yx=1]="Yx"})(uo||(uo={}));function Yd(s){return s===Ve.Nztm2000?uo.Yx:uo.Xy}function c0(s,l){return l.scaleDenominator-s.scaleDenominator}var Rs=class{constructor(l){this.zooms=[],this.indexX=0,this.indexY=1,this.zoomConversionMap=new Map,this.def=l,this.tileSize=l.tileMatrix[0].tileHeight;let u=l.tileMatrix.slice().sort(c0),y={};for(let $ of u){if(y[$.identifier])throw new Error(`Duplicate tileMatrix identifier ${$.identifier}`);if($.tileHeight!==$.tileWidth)throw new Error("Only square tiles supported");if($.tileHeight!==this.tileSize)throw new Error("All tiles must have the same tile size");y[$.identifier]=!0}this.zooms=u;let _=Ve.parse(l.supportedCRS);if(_==null)throw new Error(`Unable to find supported projection ${l.supportedCRS}`);this.projection=_,Yd(this.projection)===uo.Yx&&(this.indexX=1,this.indexY=0);let{lowerCorner:a,upperCorner:T}=l.boundingBox,E=a[this.indexX],B=a[this.indexY];this.extent=new Li(E,B,T[this.indexX]-E,T[this.indexY]-B)}get maxZoom(){return this.zooms.length-1}get identifier(){return this.def.identifier}pixelScale(l){let u=this.zooms[l];if(u==null)throw new Error(`Zoom not found :${l}`);return u.scaleDenominator*28e-5}tileToPixels(l,u){return{x:l*this.tileSize,y:u*this.tileSize}}pixelsToTile(l,u,y){let _=Math.floor(l/this.tileSize),a=Math.floor(u/this.tileSize);return{x:_,y:a,z:y}}sourceToPixels(l,u,y){let _=this.zooms[y],a=this.pixelScale(y),T=(l-_.topLeftCorner[this.indexX])/a,E=(_.topLeftCorner[this.indexY]-u)/a;return{x:T,y:E}}pixelsToSource(l,u,y){let _=this.zooms[y],a=this.pixelScale(y),T=_.topLeftCorner[this.indexX]+l*a,E=_.topLeftCorner[this.indexY]-u*a;return{x:T,y:E}}tileToSource(l){let u=this.tileToPixels(l.x,l.y);return this.pixelsToSource(u.x,u.y,l.z)}tileToSourceBounds(l){let u=this.tileToSource(l),y=this.pixelScale(l.z)*this.tileSize;return new Li(u.x,u.y-y,y,y)}*topLevelTiles(){let{matrixWidth:u,matrixHeight:y}=this.zooms[0];for(let _=0;_<y;++_)for(let a=0;a<u;++a)yield{x:a,y:_,z:0};return null}*coverTile(l){if(l==null)return yield*this.topLevelTiles(),null;let u=l.z+1,{matrixWidth:y,matrixHeight:_}=this.zooms[l.z],{matrixWidth:a,matrixHeight:T}=this.zooms[u],E=a/y,B=T/_,$=Math.floor(l.x*E),L=Math.floor(l.y*B),it=Math.ceil((l.x+1)*E),pt=Math.ceil((l.y+1)*B);for(let gt=L;gt<pt;++gt)for(let _t=$;_t<it;++_t)yield{x:_t,y:gt,z:u};return null}static tileToName(l){return`${l.z}-${l.x}-${l.y}`}static nameToTile(l){let u=l.split("-");if(u.length===3){let y=Number(u[0]),_=Number(u[1]),a=Number(u[2]);if(!(isNaN(y)||isNaN(a)||isNaN(_)))return{x:_,y:a,z:y}}throw new Error(`Invalid tile name '${l}'`)}findBestZoom(l){let u=this.zoomConversionMap.get(l);return u==null&&(u=this.convertZoomLevel(l),this.zoomConversionMap.set(l,u)),u}convertZoomLevel(l){for(let u=0;u<this.zooms.length;u++){let y=this.zooms[u].scaleDenominator-l;if(y>1e-5)continue;if(u===0)return u;let _=this.zooms[u-1].scaleDenominator-l;return Math.abs(y)<_?u:u-1}return this.maxZoom}static convertZoomLevel(l,u,y,_=!0){return u.identifier===y.identifier||(l>=u.maxZoom&&(l=u.maxZoom),_&&l===0)?l:_&&l===u.maxZoom?y.maxZoom:y.findBestZoom(u.zooms[l].scaleDenominator)}};H();var Jd={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"};H();H();var u0={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}]},ii=new Rs(u0);H();var Yh=ua(ef(),1),Qn=new Rs(Yh.Nztm2000),Cn=new Rs(Yh.Nztm2000Quad);var da={All:[ii,Qn,Cn],Defaults:new Map([[Ve.Google.code,ii],[Ve.Nztm2000.code,Qn]]),get(s){let l=this.tryGet(s);if(l==null)throw new Error("Failed to lookup TileMatrixSet: "+s);return l},tryGet(s){var l,u;return s==null?null:typeof s=="number"?(l=this.Defaults.get(s))!==null&&l!==void 0?l:null:(u=this.Defaults.get(s.code))!==null&&u!==void 0?u:null},find(s){if(s==null)return null;let l=Ve.parse(s);if(l!=null)return da.tryGet(l);for(let u of da.All)if(u.identifier===s)return u;return null}};H();var Ru;(function(s){s.Png="png",s.Jpeg="jpeg",s.Webp="webp",s.Avif="avif"})(Ru||(Ru={}));var Bu;(function(s){s.MapboxVectorTiles="pbf"})(Bu||(Bu={}));var Zm=ua(nf(),1);H();var fo={debug:!1,"debug.background":!1,"debug.source":!1,"debug.cog":!1,"debug.screenshot":!1,"debug.layer.linz-aerial":0,"debug.layer.linz-topographic":0,"debug.layer.osm":0},Pl=class{static toUrl(l,u){if(l.debug===!0){u.append("debug","true");for(let[y,_]of Object.entries(l))y==="debug"||fo[y]===_||u.append(y,String(_))}}static fromUrl(l,u){let y=u.get("debug")!=null,_=!1;if(y===!1){for(let[a,T]of Object.entries(fo))_=fa(l,a,T)||_;return _}return _=fa(l,"debug",!0),_=fa(l,"debug.background",u.get("debug.background"))||_,_=fa(l,"debug.source",u.get("debug.source")!=null)||_,_=fa(l,"debug.cog",u.get("debug.cog")!=null)||_,_=fa(l,"debug.screenshot",u.get("debug.screenshot")!=null)||_,_=Ou(l,"debug.layer.linz-aerial",u.get("debug.layer.linz-aerial"))||_,_=Ou(l,"debug.layer.linz-topographic",u.get("debug.layer.linz-topographic"))||_,_=Ou(l,"debug.layer.osm",u.get("debug.layer.osm"))||_,_}};function g0(s,l=0){if(s==null)return l;let u=Number(s);return isNaN(u)?l:u}function fa(s,l,u){return u==null&&(u=fo[l]),s[l]===u?!1:(s[l]=u,!0)}function Ou(s,l,u){return fa(s,l,g0(u))}H();H();H();H();var hf=ua(af(),1),cf=ua(of(),1);H();function lf(s){return[[[s[0],s[1]],[s[2],s[1]],[s[2],s[3]],[s[0],s[3]],[s[0],s[1]]]]}var{intersection:Gu,union:rb}=cf.default;function _0(s,l){return s[0]===l[0]&&s[1]===l[1]}function x0(s,l){return Gu(s,lf(l))}function qu(s,l){let u=[];for(let y of s){let _=hf.default.polygon(y[0],l);_.length!==0&&(_0(_[0],_[_.length-1])||_.push(_[0]),u.push([_]))}return x0(u,l)}H();H();var zl=s=>(s<-360?s=-(-s%360):s>360&&(s=s%360),s<-180?360+s:s>180?s-360:s),ma=(s,l)=>{let u=l-s;return u>180?u-360:u<-180?u+360:u},v0=(s,l)=>zl(s+(l<s?l+360-s:l-s)),Bs={boxLonCenter(s){return zl(s[0]+.5*(s[2]<s[0]?360+s[2]-s[0]:s[2]-s[0]))},delta:ma,crossesAM(s,l){return Math.sign(ma(s,l))!==Math.sign(l-s)},normLon:zl,normExtent(s){return[zl(s[0]),s[1],zl(s[2]),s[3]]},union(s,l){if(l==null)return s.slice();let u=Bs.boxLonCenter(s),y=Bs.boxLonCenter(l);if(ma(u,y)<0)return this.union(l,s);let _=s.slice(),a=v0(u,y);return ma(a,l[0])<ma(a,s[0])&&(_[0]=l[0]),ma(a,l[2])>ma(a,s[2])&&(_[2]=l[2]),l[1]<s[1]&&(_[1]=l[1]),l[3]>s[3]&&(_[3]=l[3]),_},intersects(s,l){if(s[1]>l[3]||l[1]>s[3])return!1;let u=s[0],y=l[0],_=u<s[2]?s[2]:s[2]+360,a=y<l[2]?l[2]:l[2]+360;return u<=a&&y<=_||u+360<=a&&y<=_+360||u<=a+360&&y+360<=_},ringToBbox(s){if(s.length<3)throw new Error("Invalid ring");let l=!1,u=s[0],y=u[0],_=u[1],a=y,T=_,E=y;for(let B=1;B<s.length;++B){let $=s[B],L=$[0];Bs.crossesAM(E,L)&&(l=!l),l&&(L<0?L+=360:(E+=360,B===1&&(y=a=E))),L<y?y=L:L>a&&(a=L);let pt=$[1];pt<_?_=pt:pt>T&&(T=pt),E=$[0]}return[this.normLon(y),_,this.normLon(a),T]},multiPolygonToBbox(s){let l=null;for(let u of s){if(u.length===0)continue;let y=u[0];if(y.length<3)continue;let _=this.ringToBbox(y);l=l==null?_:this.union(l,_)}if(l==null)throw new Error("Invalid multipolygon");return l},bboxToMultiPolygon(s){let l=[s[0],s[1]],u=[s[2],s[1]],y=[s[0],s[3]],_=[s[2],s[3]];return s[0]<s[2]?[[[l,y,_,u,l]]]:[[[l,y,[180,_[1]],[180,u[1]],l]],[[_,u,[-180,l[1]],[-180,y[1]],_]]]}};var b0=[-180,-90,180,90],w0=[180,-90,360,90];function M0(s,l,u){return[l[0]+(u[0]-l[0])*s,l[1]+(u[1]-l[1])*s]}function S0(s){let l=[];for(let u of qu(s,b0))l.push(u);for(let u of qu(s,w0))l.push(u.map(y=>y.map(_=>[_[0]-360,_[1]])));return l}function uf(s,l,u=!0){let y=!1,_=!1,a=s.map(T=>T.map(E=>{let B=[];if(E.length===0)return B;let $=E[0],L=null,it=0;for(let pt of E){let gt=l(pt),_t=gt[0];if(L!=null){let Ot=Bs.crossesAM(it,_t);if(Ot&&(y=!0,_=!_),_&&(_t<0?gt[0]=_t+360:L[0]=it+360),Ot){let Lt=(180-gt[0])/(L[0]-gt[0]),Nt=l(M0(Lt,pt,$));B.push([180,Nt[1]])}}B.push(gt),$=pt,L=gt,it=_t}return B}));return y&&u?S0(a):a}H();H();function T0(s){return{type:"Polygon",coordinates:s}}function pf(s,l={}){return{type:"Feature",geometry:T0(s),properties:l}}function df(s,l={}){return{type:"Feature",geometry:{type:"MultiPolygon",coordinates:s},properties:l}}H();H();H();H();H();H();function ff(s){s("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),s("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),s("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"),s.WGS84=s["EPSG:4326"],s["EPSG:3785"]=s["EPSG:3857"],s.GOOGLE=s["EPSG:3857"],s["EPSG:900913"]=s["EPSG:3857"],s["EPSG:102113"]=s["EPSG:3857"]}H();H();var xn=1,vn=2,mf=4,kl=5,ga=484813681109536e-20,Bt=Math.PI/2,gf=.16666666666666666,yf=.04722222222222222,_f=.022156084656084655,qt=1e-10,Ui=.017453292519943295,bn=57.29577951308232,Ke=Math.PI/4,Ll=Math.PI*2,Ei=3.14159265359;H();var Ir={};Ir.greenwich=0;Ir.lisbon=-9.131906111111;Ir.paris=2.337229166667;Ir.bogota=-74.080916666667;Ir.madrid=-3.687938888889;Ir.rome=12.452333333333;Ir.bern=7.439583333333;Ir.jakarta=106.807719444444;Ir.ferro=-17.666666666667;Ir.brussels=4.367975;Ir.stockholm=18.058277777778;Ir.athens=23.7163375;Ir.oslo=10.722916666667;H();var xf={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};H();var vf=/[\s_\-\/\(\)]/g;function Kr(s,l){if(s[l])return s[l];for(var u=Object.keys(s),y=l.toLowerCase().replace(vf,""),_=-1,a,T;++_<u.length;)if(a=u[_],T=a.toLowerCase().replace(vf,""),T===y)return s[a]}function Dl(s){var l={},u=s.split("+").map(function(E){return E.trim()}).filter(function(E){return E}).reduce(function(E,B){var $=B.split("=");return $.push(!0),E[$[0].toLowerCase()]=$[1],E},{}),y,_,a,T={proj:"projName",datum:"datumCode",rf:function(E){l.rf=parseFloat(E)},lat_0:function(E){l.lat0=E*Ui},lat_1:function(E){l.lat1=E*Ui},lat_2:function(E){l.lat2=E*Ui},lat_ts:function(E){l.lat_ts=E*Ui},lon_0:function(E){l.long0=E*Ui},lon_1:function(E){l.long1=E*Ui},lon_2:function(E){l.long2=E*Ui},alpha:function(E){l.alpha=parseFloat(E)*Ui},lonc:function(E){l.longc=E*Ui},x_0:function(E){l.x0=parseFloat(E)},y_0:function(E){l.y0=parseFloat(E)},k_0:function(E){l.k0=parseFloat(E)},k:function(E){l.k0=parseFloat(E)},a:function(E){l.a=parseFloat(E)},b:function(E){l.b=parseFloat(E)},r_a:function(){l.R_A=!0},zone:function(E){l.zone=parseInt(E,10)},south:function(){l.utmSouth=!0},towgs84:function(E){l.datum_params=E.split(",").map(function(B){return parseFloat(B)})},to_meter:function(E){l.to_meter=parseFloat(E)},units:function(E){l.units=E;var B=Kr(xf,E);B&&(l.to_meter=B.to_meter)},from_greenwich:function(E){l.from_greenwich=E*Ui},pm:function(E){var B=Kr(Ir,E);l.from_greenwich=(B||parseFloat(E))*Ui},nadgrids:function(E){E==="@null"?l.datumCode="none":l.nadgrids=E},axis:function(E){var B="ewnsud";E.length===3&&B.indexOf(E.substr(0,1))!==-1&&B.indexOf(E.substr(1,1))!==-1&&B.indexOf(E.substr(2,1))!==-1&&(l.axis=E)}};for(y in u)_=u[y],y in T?(a=T[y],typeof a=="function"?a(_):l[a]=_):l[y]=_;return typeof l.datumCode=="string"&&l.datumCode!=="WGS84"&&(l.datumCode=l.datumCode.toLowerCase()),l}H();H();var bf=A0,Rl=1,wf=2,Mf=3,Qh=4,Sf=5,ju=-1,E0=/\s/,I0=/[A-Za-z]/,C0=/[A-Za-z84]/,tc=/[,\]]/,Tf=/[\d\.E\-\+]/;function es(s){if(typeof s!="string")throw new Error("not a string");this.text=s.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Rl}es.prototype.readCharicter=function(){var s=this.text[this.place++];if(this.state!==Qh)for(;E0.test(s);){if(this.place>=this.text.length)return;s=this.text[this.place++]}switch(this.state){case Rl:return this.neutral(s);case wf:return this.keyword(s);case Qh:return this.quoted(s);case Sf:return this.afterquote(s);case Mf:return this.number(s);case ju:return}};es.prototype.afterquote=function(s){if(s==='"'){this.word+='"',this.state=Qh;return}if(tc.test(s)){this.word=this.word.trim(),this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in afterquote yet, index '+this.place)};es.prototype.afterItem=function(s){if(s===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Rl;return}if(s==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Rl,this.currentObject=this.stack.pop(),this.currentObject||(this.state=ju);return}};es.prototype.number=function(s){if(Tf.test(s)){this.word+=s;return}if(tc.test(s)){this.word=parseFloat(this.word),this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in number yet, index '+this.place)};es.prototype.quoted=function(s){if(s==='"'){this.state=Sf;return}this.word+=s};es.prototype.keyword=function(s){if(C0.test(s)){this.word+=s;return}if(s==="["){var l=[];l.push(this.word),this.level++,this.root===null?this.root=l:this.currentObject.push(l),this.stack.push(this.currentObject),this.currentObject=l,this.state=Rl;return}if(tc.test(s)){this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in keyword yet, index '+this.place)};es.prototype.neutral=function(s){if(I0.test(s)){this.word=s,this.state=wf;return}if(s==='"'){this.word="",this.state=Qh;return}if(Tf.test(s)){this.word=s,this.state=Mf;return}if(tc.test(s)){this.afterItem(s);return}throw new Error(`havn't handled "`+s+'" in neutral yet, index '+this.place)};es.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===ju)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function A0(s){var l=new es(s);return l.output()}H();function Ef(s,l,u){Array.isArray(l)&&(u.unshift(l),l=null);var y=l?{}:s,_=u.reduce(function(a,T){return ya(T,a),a},y);l&&(s[l]=_)}function ya(s,l){if(!Array.isArray(s)){l[s]=!0;return}var u=s.shift();if(u==="PARAMETER"&&(u=s.shift()),s.length===1){if(Array.isArray(s[0])){l[u]={},ya(s[0],l[u]);return}l[u]=s[0];return}if(!s.length){l[u]=!0;return}if(u==="TOWGS84"){l[u]=s;return}if(u==="AXIS"){u in l||(l[u]=[]),l[u].push(s);return}Array.isArray(u)||(l[u]={});var y;switch(u){case"UNIT":case"PRIMEM":case"VERT_DATUM":l[u]={name:s[0].toLowerCase(),convert:s[1]},s.length===3&&ya(s[2],l[u]);return;case"SPHEROID":case"ELLIPSOID":l[u]={name:s[0],a:s[1],rf:s[2]},s.length===4&&ya(s[3],l[u]);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":s[0]=["name",s[0]],Ef(l,u,s);return;default:for(y=-1;++y<s.length;)if(!Array.isArray(s[y]))return ya(s,l[u]);return Ef(l,u,s)}}var P0=.017453292519943295;function z0(s,l){var u=l[0],y=l[1];!(u in s)&&y in s&&(s[u]=s[y],l.length===3&&(s[u]=l[2](s[u])))}function is(s){return s*P0}function k0(s){if(s.type==="GEOGCS"?s.projName="longlat":s.type==="LOCAL_CS"?(s.projName="identity",s.local=!0):typeof s.PROJECTION=="object"?s.projName=Object.keys(s.PROJECTION)[0]:s.projName=s.PROJECTION,s.AXIS){for(var l="",u=0,y=s.AXIS.length;u<y;++u){var _=s.AXIS[u],a=_[0].toLowerCase();a.indexOf("north")!==-1?l+="n":a.indexOf("south")!==-1?l+="s":a.indexOf("east")!==-1?l+="e":a.indexOf("west")!==-1&&(l+="w")}l.length===2&&(l+="u"),l.length===3&&(s.axis=l)}s.UNIT&&(s.units=s.UNIT.name.toLowerCase(),s.units==="metre"&&(s.units="meter"),s.UNIT.convert&&(s.type==="GEOGCS"?s.DATUM&&s.DATUM.SPHEROID&&(s.to_meter=s.UNIT.convert*s.DATUM.SPHEROID.a):s.to_meter=s.UNIT.convert));var T=s.GEOGCS;s.type==="GEOGCS"&&(T=s),T&&(T.DATUM?s.datumCode=T.DATUM.name.toLowerCase():s.datumCode=T.name.toLowerCase(),s.datumCode.slice(0,2)==="d_"&&(s.datumCode=s.datumCode.slice(2)),(s.datumCode==="new_zealand_geodetic_datum_1949"||s.datumCode==="new_zealand_1949")&&(s.datumCode="nzgd49"),(s.datumCode==="wgs_1984"||s.datumCode==="world_geodetic_system_1984")&&(s.PROJECTION==="Mercator_Auxiliary_Sphere"&&(s.sphere=!0),s.datumCode="wgs84"),s.datumCode.slice(-6)==="_ferro"&&(s.datumCode=s.datumCode.slice(0,-6)),s.datumCode.slice(-8)==="_jakarta"&&(s.datumCode=s.datumCode.slice(0,-8)),~s.datumCode.indexOf("belge")&&(s.datumCode="rnb72"),T.DATUM&&T.DATUM.SPHEROID&&(s.ellps=T.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),s.ellps.toLowerCase().slice(0,13)==="international"&&(s.ellps="intl"),s.a=T.DATUM.SPHEROID.a,s.rf=parseFloat(T.DATUM.SPHEROID.rf,10)),T.DATUM&&T.DATUM.TOWGS84&&(s.datum_params=T.DATUM.TOWGS84),~s.datumCode.indexOf("osgb_1936")&&(s.datumCode="osgb36"),~s.datumCode.indexOf("osni_1952")&&(s.datumCode="osni52"),(~s.datumCode.indexOf("tm65")||~s.datumCode.indexOf("geodetic_datum_of_1965"))&&(s.datumCode="ire65"),s.datumCode==="ch1903+"&&(s.datumCode="ch1903"),~s.datumCode.indexOf("israel")&&(s.datumCode="isr93")),s.b&&!isFinite(s.b)&&(s.b=s.a);function E(L){var it=s.to_meter||1;return L*it}var B=function(L){return z0(s,L)},$=[["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",is],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",is],["x0","false_easting",E],["y0","false_northing",E],["long0","central_meridian",is],["lat0","latitude_of_origin",is],["lat0","standard_parallel_1",is],["lat1","standard_parallel_1",is],["lat2","standard_parallel_2",is],["azimuth","Azimuth"],["alpha","azimuth",is],["srsCode","name"]];$.forEach(B),!s.long0&&s.longc&&(s.projName==="Albers_Conic_Equal_Area"||s.projName==="Lambert_Azimuthal_Equal_Area")&&(s.long0=s.longc),!s.lat_ts&&s.lat1&&(s.projName==="Stereographic_South_Pole"||s.projName==="Polar Stereographic (variant B)")&&(s.lat0=is(s.lat1>0?90:-90),s.lat_ts=s.lat1)}function ec(s){var l=bf(s),u=l.shift(),y=l.shift();l.unshift(["name",y]),l.unshift(["type",u]);var _={};return ya(l,_),k0(_),_}function un(s){var l=this;if(arguments.length===2){var u=arguments[1];typeof u=="string"?u.charAt(0)==="+"?un[s]=Dl(arguments[1]):un[s]=ec(arguments[1]):un[s]=u}else if(arguments.length===1){if(Array.isArray(s))return s.map(function(y){Array.isArray(y)?un.apply(l,y):un(y)});if(typeof s=="string"){if(s in un)return un[s]}else"EPSG"in s?un["EPSG:"+s.EPSG]=s:"ESRI"in s?un["ESRI:"+s.ESRI]=s:"IAU2000"in s?un["IAU2000:"+s.IAU2000]=s:console.log(s);return}}ff(un);var go=un;function L0(s){return typeof s=="string"}function D0(s){return s in go}var R0=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function B0(s){return R0.some(function(l){return s.indexOf(l)>-1})}var F0=["3857","900913","3785","102113"];function O0(s){var l=Kr(s,"authority");if(!!l){var u=Kr(l,"epsg");return u&&F0.indexOf(u)>-1}}function N0(s){var l=Kr(s,"extension");if(!!l)return Kr(l,"proj4")}function U0(s){return s[0]==="+"}function V0(s){if(L0(s)){if(D0(s))return go[s];if(B0(s)){var l=ec(s);if(O0(l))return go["EPSG:3857"];var u=N0(l);return u?Dl(u):l}if(U0(s))return Dl(s)}else return s}var If=V0;H();function $u(s,l){s=s||{};var u,y;if(!l)return s;for(y in l)u=l[y],u!==void 0&&(s[y]=u);return s}H();H();H();function dr(s,l,u){var y=s*l;return u/Math.sqrt(1-y*y)}H();H();function An(s){return s<0?-1:1}function $t(s){return Math.abs(s)<=Ei?s:s-An(s)*Ll}H();function Cr(s,l,u){var y=s*u,_=.5*s;return y=Math.pow((1-y)/(1+y),_),Math.tan(.5*(Bt-l))/y}H();function rs(s,l){for(var u=.5*s,y,_,a=Bt-2*Math.atan(l),T=0;T<=15;T++)if(y=s*Math.sin(a),_=Bt-2*Math.atan(l*Math.pow((1-y)/(1+y),u))-a,a+=_,Math.abs(_)<=1e-10)return a;return-9999}function G0(){var s=this.b/this.a;this.es=1-s*s,"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=dr(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function q0(s){var l=s.x,u=s.y;if(u*bn>90&&u*bn<-90&&l*bn>180&&l*bn<-180)return null;var y,_;if(Math.abs(Math.abs(u)-Bt)<=qt)return null;if(this.sphere)y=this.x0+this.a*this.k0*$t(l-this.long0),_=this.y0+this.a*this.k0*Math.log(Math.tan(Ke+.5*u));else{var a=Math.sin(u),T=Cr(this.e,u,a);y=this.x0+this.a*this.k0*$t(l-this.long0),_=this.y0-this.a*this.k0*Math.log(T)}return s.x=y,s.y=_,s}function j0(s){var l=s.x-this.x0,u=s.y-this.y0,y,_;if(this.sphere)_=Bt-2*Math.atan(Math.exp(-u/(this.a*this.k0)));else{var a=Math.exp(-u/(this.a*this.k0));if(_=rs(this.e,a),_===-9999)return null}return y=$t(this.long0+l/(this.a*this.k0)),s.x=y,s.y=_,s}var $0=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],Cf={init:G0,forward:q0,inverse:j0,names:$0};H();function W0(){}function Af(s){return s}var Z0=["longlat","identity"],Pf={init:W0,forward:Af,inverse:Af,names:Z0};var H0=[Cf,Pf],ic={},rc=[];function zf(s,l){var u=rc.length;return s.names?(rc[u]=s,s.names.forEach(function(y){ic[y.toLowerCase()]=u}),this):(console.log(l),!0)}function X0(s){if(!s)return!1;var l=s.toLowerCase();if(typeof ic[l]<"u"&&rc[ic[l]])return rc[ic[l]]}function K0(){H0.forEach(zf)}var kf={start:K0,add:zf,get:X0};H();H();var Ae={};Ae.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"};Ae.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"};Ae.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"};Ae.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"};Ae.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"};Ae.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"};Ae.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"};Ae.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"};Ae.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"};Ae.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"};Ae.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"};Ae.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"};Ae.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"};Ae.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"};Ae.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."};Ae.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"};Ae.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"};Ae.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"};Ae.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"};Ae.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"};Ae.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"};Ae.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"};Ae.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"};Ae.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"};Ae.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"};Ae.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"};Ae.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"};Ae.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"};Ae.hough={a:6378270,rf:297,ellipseName:"Hough"};Ae.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"};Ae.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"};Ae.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"};Ae.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"};Ae.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"};Ae.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"};Ae.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"};Ae.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"};Ae.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"};Ae.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"};Ae.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"};Ae.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var Lf=Ae.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};Ae.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function Df(s,l,u,y){var _=s*s,a=l*l,T=(_-a)/_,E=0;y?(s*=1-T*(gf+T*(yf+T*_f)),_=s*s,T=0):E=Math.sqrt(T);var B=(_-a)/a;return{es:T,e:E,ep2:B}}function Rf(s,l,u,y,_){if(!s){var a=Kr(Ae,y);a||(a=Lf),s=a.a,l=a.b,u=a.rf}return u&&!l&&(l=(1-1/u)*s),(u===0||Math.abs(s-l)<qt)&&(_=!0,l=s),{a:s,b:l,rf:u,sphere:_}}H();var Xi={};Xi.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"};Xi.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"};Xi.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"};Xi.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"};Xi.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"};Xi.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"};Xi.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"};Xi.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"};Xi.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"};Xi.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"};Xi.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"};Xi.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"};Xi.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"};Xi.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"};Xi.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"};Xi.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"};Xi.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};H();function Y0(s,l,u,y,_,a){var T={};return s===void 0||s==="none"?T.datum_type=kl:T.datum_type=mf,l&&(T.datum_params=l.map(parseFloat),(T.datum_params[0]!==0||T.datum_params[1]!==0||T.datum_params[2]!==0)&&(T.datum_type=xn),T.datum_params.length>3&&(T.datum_params[3]!==0||T.datum_params[4]!==0||T.datum_params[5]!==0||T.datum_params[6]!==0)&&(T.datum_type=vn,T.datum_params[3]*=ga,T.datum_params[4]*=ga,T.datum_params[5]*=ga,T.datum_params[6]=T.datum_params[6]/1e6+1)),T.a=u,T.b=y,T.es=_,T.ep2=a,T}var Bf=Y0;function yo(s,l){if(!(this instanceof yo))return new yo(s);l=l||function(B){if(B)throw B};var u=If(s);if(typeof u!="object"){l(s);return}var y=yo.projections.get(u.projName);if(!y){l(s);return}if(u.datumCode&&u.datumCode!=="none"){var _=Kr(Xi,u.datumCode);_&&(u.datum_params=_.towgs84?_.towgs84.split(","):null,u.ellps=_.ellipse,u.datumName=_.datumName?_.datumName:u.datumCode)}u.k0=u.k0||1,u.axis=u.axis||"enu",u.ellps=u.ellps||"wgs84";var a=Rf(u.a,u.b,u.rf,u.ellps,u.sphere),T=Df(a.a,a.b,a.rf,u.R_A),E=u.datum||Bf(u.datumCode,u.datum_params,a.a,a.b,T.es,T.ep2);$u(this,u),$u(this,y),this.a=a.a,this.b=a.b,this.rf=a.rf,this.sphere=a.sphere,this.es=T.es,this.e=T.e,this.ep2=T.ep2,this.datum=E,this.init(),l(null,this)}yo.projections=kf;yo.projections.start();var Fs=yo;H();H();H();function Ff(s,l){return s.datum_type!==l.datum_type||s.a!==l.a||Math.abs(s.es-l.es)>5e-11?!1:s.datum_type===xn?s.datum_params[0]===l.datum_params[0]&&s.datum_params[1]===l.datum_params[1]&&s.datum_params[2]===l.datum_params[2]:s.datum_type===vn?s.datum_params[0]===l.datum_params[0]&&s.datum_params[1]===l.datum_params[1]&&s.datum_params[2]===l.datum_params[2]&&s.datum_params[3]===l.datum_params[3]&&s.datum_params[4]===l.datum_params[4]&&s.datum_params[5]===l.datum_params[5]&&s.datum_params[6]===l.datum_params[6]:!0}function nc(s,l,u){var y=s.x,_=s.y,a=s.z?s.z:0,T,E,B,$;if(_<-Bt&&_>-1.001*Bt)_=-Bt;else if(_>Bt&&_<1.001*Bt)_=Bt;else{if(_<-Bt)return{x:-1/0,y:-1/0,z:s.z};if(_>Bt)return{x:1/0,y:1/0,z:s.z}}return y>Math.PI&&(y-=2*Math.PI),E=Math.sin(_),$=Math.cos(_),B=E*E,T=u/Math.sqrt(1-l*B),{x:(T+a)*$*Math.cos(y),y:(T+a)*$*Math.sin(y),z:(T*(1-l)+a)*E}}function sc(s,l,u,y){var _=1e-12,a=_*_,T=30,E,B,$,L,it,pt,gt,_t,Ot,Lt,Nt,ue,oe,Ee=s.x,ve=s.y,me=s.z?s.z:0,Ge,Ne,di;if(E=Math.sqrt(Ee*Ee+ve*ve),B=Math.sqrt(Ee*Ee+ve*ve+me*me),E/u<_){if(Ge=0,B/u<_)return Ne=Bt,di=-y,{x:s.x,y:s.y,z:s.z}}else Ge=Math.atan2(ve,Ee);$=me/B,L=E/B,it=1/Math.sqrt(1-l*(2-l)*L*L),_t=L*(1-l)*it,Ot=$*it,oe=0;do oe++,gt=u/Math.sqrt(1-l*Ot*Ot),di=E*_t+me*Ot-gt*(1-l*Ot*Ot),pt=l*gt/(gt+di),it=1/Math.sqrt(1-pt*(2-pt)*L*L),Lt=L*(1-pt)*it,Nt=$*it,ue=Nt*_t-Lt*Ot,_t=Lt,Ot=Nt;while(ue*ue>a&&oe<T);return Ne=Math.atan(Nt/Math.abs(Lt)),{x:Ge,y:Ne,z:di}}function Of(s,l,u){if(l===xn)return{x:s.x+u[0],y:s.y+u[1],z:s.z+u[2]};if(l===vn){var y=u[0],_=u[1],a=u[2],T=u[3],E=u[4],B=u[5],$=u[6];return{x:$*(s.x-B*s.y+E*s.z)+y,y:$*(B*s.x+s.y-T*s.z)+_,z:$*(-E*s.x+T*s.y+s.z)+a}}}function Nf(s,l,u){if(l===xn)return{x:s.x-u[0],y:s.y-u[1],z:s.z-u[2]};if(l===vn){var y=u[0],_=u[1],a=u[2],T=u[3],E=u[4],B=u[5],$=u[6],L=(s.x-y)/$,it=(s.y-_)/$,pt=(s.z-a)/$;return{x:L+B*it-E*pt,y:-B*L+it+T*pt,z:E*L-T*it+pt}}}function ac(s){return s===xn||s===vn}function Uf(s,l,u){return Ff(s,l)||s.datum_type===kl||l.datum_type===kl||s.es===l.es&&s.a===l.a&&!ac(s.datum_type)&&!ac(l.datum_type)?u:(u=nc(u,s.es,s.a),ac(s.datum_type)&&(u=Of(u,s.datum_type,s.datum_params)),ac(l.datum_type)&&(u=Nf(u,l.datum_type,l.datum_params)),sc(u,l.es,l.a,l.b))}H();function Wu(s,l,u){var y=u.x,_=u.y,a=u.z||0,T,E,B,$={};for(B=0;B<3;B++)if(!(l&&B===2&&u.z===void 0))switch(B===0?(T=y,"ew".indexOf(s.axis[B])!==-1?E="x":E="y"):B===1?(T=_,"ns".indexOf(s.axis[B])!==-1?E="y":E="x"):(T=a,E="z"),s.axis[B]){case"e":$[E]=T;break;case"w":$[E]=-T;break;case"n":$[E]=T;break;case"s":$[E]=-T;break;case"u":u[E]!==void 0&&($.z=T);break;case"d":u[E]!==void 0&&($.z=-T);break;default:return null}return $}H();function oc(s){var l={x:s[0],y:s[1]};return s.length>2&&(l.z=s[2]),s.length>3&&(l.m=s[3]),l}H();function Gf(s){Vf(s.x),Vf(s.y)}function Vf(s){if(typeof Number.isFinite=="function"){if(Number.isFinite(s))return;throw new TypeError("coordinates must be finite numbers")}if(typeof s!="number"||s!==s||!isFinite(s))throw new TypeError("coordinates must be finite numbers")}function J0(s,l){return(s.datum.datum_type===xn||s.datum.datum_type===vn)&&l.datumCode!=="WGS84"||(l.datum.datum_type===xn||l.datum.datum_type===vn)&&s.datumCode!=="WGS84"}function _a(s,l,u){var y;if(Array.isArray(u)&&(u=oc(u)),Gf(u),s.datum&&l.datum&&J0(s,l)&&(y=new Fs("WGS84"),u=_a(s,y,u),s=y),s.axis!=="enu"&&(u=Wu(s,!1,u)),s.projName==="longlat")u={x:u.x*Ui,y:u.y*Ui,z:u.z||0};else if(s.to_meter&&(u={x:u.x*s.to_meter,y:u.y*s.to_meter,z:u.z||0}),u=s.inverse(u),!u)return;return s.from_greenwich&&(u.x+=s.from_greenwich),u=Uf(s.datum,l.datum,u),l.from_greenwich&&(u={x:u.x-l.from_greenwich,y:u.y,z:u.z||0}),l.projName==="longlat"?u={x:u.x*bn,y:u.y*bn,z:u.z||0}:(u=l.forward(u),l.to_meter&&(u={x:u.x/l.to_meter,y:u.y/l.to_meter,z:u.z||0})),l.axis!=="enu"?Wu(l,!0,u):u}var qf=Fs("WGS84");function Zu(s,l,u){var y,_,a;return Array.isArray(u)?(y=_a(s,l,u)||{x:NaN,y:NaN},u.length>2?typeof s.name<"u"&&s.name==="geocent"||typeof l.name<"u"&&l.name==="geocent"?typeof y.z=="number"?[y.x,y.y,y.z].concat(u.splice(3)):[y.x,y.y,u[2]].concat(u.splice(3)):[y.x,y.y].concat(u.splice(2)):[y.x,y.y]):(_=_a(s,l,u),a=Object.keys(u),a.length===2||a.forEach(function(T){if(typeof s.name<"u"&&s.name==="geocent"||typeof l.name<"u"&&l.name==="geocent"){if(T==="x"||T==="y"||T==="z")return}else if(T==="x"||T==="y")return;_[T]=u[T]}),_)}function jf(s){return s instanceof Fs?s:s.oProj?s.oProj:Fs(s)}function Q0(s,l,u){s=jf(s);var y=!1,_;return typeof l>"u"?(l=s,s=qf,y=!0):(typeof l.x<"u"||Array.isArray(l))&&(u=l,l=s,s=qf,y=!0),l=jf(l),u?Zu(s,l,u):(_={forward:function(a){return Zu(s,l,a)},inverse:function(a){return Zu(l,s,a)}},y&&(_.oProj=l),_)}var Yr=Q0;H();H();var $f=6,Zf="AJSAJS",Hf="AFAFAF",_o=65,Nr=73,pn=79,Bl=86,Fl=90,Xf={forward:Xu,inverse:t_,toPoint:Ku};function Xu(s,l){return l=l||5,r_(e_({lat:s[1],lon:s[0]}),l)}function t_(s){var l=Yu(Yf(s.toUpperCase()));return l.lat&&l.lon?[l.lon,l.lat,l.lon,l.lat]:[l.left,l.bottom,l.right,l.top]}function Ku(s){var l=Yu(Yf(s.toUpperCase()));return l.lat&&l.lon?[l.lon,l.lat]:[(l.left+l.right)/2,(l.top+l.bottom)/2]}function Hu(s){return s*(Math.PI/180)}function Wf(s){return 180*(s/Math.PI)}function e_(s){var l=s.lat,u=s.lon,y=6378137,_=.00669438,a=.9996,T,E,B,$,L,it,pt,gt=Hu(l),_t=Hu(u),Ot,Lt;Lt=Math.floor((u+180)/6)+1,u===180&&(Lt=60),l>=56&&l<64&&u>=3&&u<12&&(Lt=32),l>=72&&l<84&&(u>=0&&u<9?Lt=31:u>=9&&u<21?Lt=33:u>=21&&u<33?Lt=35:u>=33&&u<42&&(Lt=37)),T=(Lt-1)*6-180+3,Ot=Hu(T),E=_/(1-_),B=y/Math.sqrt(1-_*Math.sin(gt)*Math.sin(gt)),$=Math.tan(gt)*Math.tan(gt),L=E*Math.cos(gt)*Math.cos(gt),it=Math.cos(gt)*(_t-Ot),pt=y*((1-_/4-3*_*_/64-5*_*_*_/256)*gt-(3*_/8+3*_*_/32+45*_*_*_/1024)*Math.sin(2*gt)+(15*_*_/256+45*_*_*_/1024)*Math.sin(4*gt)-35*_*_*_/3072*Math.sin(6*gt));var Nt=a*B*(it+(1-$+L)*it*it*it/6+(5-18*$+$*$+72*L-58*E)*it*it*it*it*it/120)+5e5,ue=a*(pt+B*Math.tan(gt)*(it*it/2+(5-$+9*L+4*L*L)*it*it*it*it/24+(61-58*$+$*$+600*L-330*E)*it*it*it*it*it*it/720));return l<0&&(ue+=1e7),{northing:Math.round(ue),easting:Math.round(Nt),zoneNumber:Lt,zoneLetter:i_(l)}}function Yu(s){var l=s.northing,u=s.easting,y=s.zoneLetter,_=s.zoneNumber;if(_<0||_>60)return null;var a=.9996,T=6378137,E=.00669438,B,$=(1-Math.sqrt(1-E))/(1+Math.sqrt(1-E)),L,it,pt,gt,_t,Ot,Lt,Nt,ue,oe=u-5e5,Ee=l;y<"N"&&(Ee-=1e7),Lt=(_-1)*6-180+3,B=E/(1-E),Ot=Ee/a,Nt=Ot/(T*(1-E/4-3*E*E/64-5*E*E*E/256)),ue=Nt+(3*$/2-27*$*$*$/32)*Math.sin(2*Nt)+(21*$*$/16-55*$*$*$*$/32)*Math.sin(4*Nt)+151*$*$*$/96*Math.sin(6*Nt),L=T/Math.sqrt(1-E*Math.sin(ue)*Math.sin(ue)),it=Math.tan(ue)*Math.tan(ue),pt=B*Math.cos(ue)*Math.cos(ue),gt=T*(1-E)/Math.pow(1-E*Math.sin(ue)*Math.sin(ue),1.5),_t=oe/(L*a);var ve=ue-L*Math.tan(ue)/gt*(_t*_t/2-(5+3*it+10*pt-4*pt*pt-9*B)*_t*_t*_t*_t/24+(61+90*it+298*pt+45*it*it-252*B-3*pt*pt)*_t*_t*_t*_t*_t*_t/720);ve=Wf(ve);var me=(_t-(1+2*it+pt)*_t*_t*_t/6+(5-2*pt+28*it-3*pt*pt+8*B+24*it*it)*_t*_t*_t*_t*_t/120)/Math.cos(ue);me=Lt+Wf(me);var Ge;if(s.accuracy){var Ne=Yu({northing:s.northing+s.accuracy,easting:s.easting+s.accuracy,zoneLetter:s.zoneLetter,zoneNumber:s.zoneNumber});Ge={top:Ne.lat,right:Ne.lon,bottom:ve,left:me}}else Ge={lat:ve,lon:me};return Ge}function i_(s){var l="Z";return 84>=s&&s>=72?l="X":72>s&&s>=64?l="W":64>s&&s>=56?l="V":56>s&&s>=48?l="U":48>s&&s>=40?l="T":40>s&&s>=32?l="S":32>s&&s>=24?l="R":24>s&&s>=16?l="Q":16>s&&s>=8?l="P":8>s&&s>=0?l="N":0>s&&s>=-8?l="M":-8>s&&s>=-16?l="L":-16>s&&s>=-24?l="K":-24>s&&s>=-32?l="J":-32>s&&s>=-40?l="H":-40>s&&s>=-48?l="G":-48>s&&s>=-56?l="F":-56>s&&s>=-64?l="E":-64>s&&s>=-72?l="D":-72>s&&s>=-80&&(l="C"),l}function r_(s,l){var u="00000"+s.easting,y="00000"+s.northing;return s.zoneNumber+s.zoneLetter+n_(s.easting,s.northing,s.zoneNumber)+u.substr(u.length-5,l)+y.substr(y.length-5,l)}function n_(s,l,u){var y=Kf(u),_=Math.floor(s/1e5),a=Math.floor(l/1e5)%20;return s_(_,a,y)}function Kf(s){var l=s%$f;return l===0&&(l=$f),l}function s_(s,l,u){var y=u-1,_=Zf.charCodeAt(y),a=Hf.charCodeAt(y),T=_+s-1,E=a+l,B=!1;T>Fl&&(T=T-Fl+_o-1,B=!0),(T===Nr||_<Nr&&T>Nr||(T>Nr||_<Nr)&&B)&&T++,(T===pn||_<pn&&T>pn||(T>pn||_<pn)&&B)&&(T++,T===Nr&&T++),T>Fl&&(T=T-Fl+_o-1),E>Bl?(E=E-Bl+_o-1,B=!0):B=!1,(E===Nr||a<Nr&&E>Nr||(E>Nr||a<Nr)&&B)&&E++,(E===pn||a<pn&&E>pn||(E>pn||a<pn)&&B)&&(E++,E===Nr&&E++),E>Bl&&(E=E-Bl+_o-1);var $=String.fromCharCode(T)+String.fromCharCode(E);return $}function Yf(s){if(s&&s.length===0)throw"MGRSPoint coverting from nothing";for(var l=s.length,u=null,y="",_,a=0;!/[A-Z]/.test(_=s.charAt(a));){if(a>=2)throw"MGRSPoint bad conversion from: "+s;y+=_,a++}var T=parseInt(y,10);if(a===0||a+3>l)throw"MGRSPoint bad conversion from: "+s;var E=s.charAt(a++);if(E<="A"||E==="B"||E==="Y"||E>="Z"||E==="I"||E==="O")throw"MGRSPoint zone letter "+E+" not handled: "+s;u=s.substring(a,a+=2);for(var B=Kf(T),$=a_(u.charAt(0),B),L=o_(u.charAt(1),B);L<l_(E);)L+=2e6;var it=l-a;if(it%2!==0)throw`MGRSPoint has to have an even number
506
+ of digits after the zone letter and two 100km letters - front
507
+ half for easting meters, second half for
508
+ northing meters`+s;var pt=it/2,gt=0,_t=0,Ot,Lt,Nt,ue,oe;return pt>0&&(Ot=1e5/Math.pow(10,pt),Lt=s.substring(a,a+pt),gt=parseFloat(Lt)*Ot,Nt=s.substring(a+pt),_t=parseFloat(Nt)*Ot),ue=gt+$,oe=_t+L,{easting:ue,northing:oe,zoneLetter:E,zoneNumber:T,accuracy:Ot}}function a_(s,l){for(var u=Zf.charCodeAt(l-1),y=1e5,_=!1;u!==s.charCodeAt(0);){if(u++,u===Nr&&u++,u===pn&&u++,u>Fl){if(_)throw"Bad character: "+s;u=_o,_=!0}y+=1e5}return y}function o_(s,l){if(s>"V")throw"MGRSPoint given invalid Northing "+s;for(var u=Hf.charCodeAt(l-1),y=0,_=!1;u!==s.charCodeAt(0);){if(u++,u===Nr&&u++,u===pn&&u++,u>Bl){if(_)throw"Bad character: "+s;u=_o,_=!0}y+=1e5}return y}function l_(s){var l;switch(s){case"C":l=11e5;break;case"D":l=2e6;break;case"E":l=28e5;break;case"F":l=37e5;break;case"G":l=46e5;break;case"H":l=55e5;break;case"J":l=64e5;break;case"K":l=73e5;break;case"L":l=82e5;break;case"M":l=91e5;break;case"N":l=0;break;case"P":l=8e5;break;case"Q":l=17e5;break;case"R":l=26e5;break;case"S":l=35e5;break;case"T":l=44e5;break;case"U":l=53e5;break;case"V":l=62e5;break;case"W":l=7e6;break;case"X":l=79e5;break;default:l=-1}if(l>=0)return l;throw"Invalid zone letter: "+s}function xo(s,l,u){if(!(this instanceof xo))return new xo(s,l,u);if(Array.isArray(s))this.x=s[0],this.y=s[1],this.z=s[2]||0;else if(typeof s=="object")this.x=s.x,this.y=s.y,this.z=s.z||0;else if(typeof s=="string"&&typeof l>"u"){var y=s.split(",");this.x=parseFloat(y[0],10),this.y=parseFloat(y[1],10),this.z=parseFloat(y[2],10)||0}else this.x=s,this.y=l,this.z=u||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}xo.fromMGRS=function(s){return new xo(Ku(s))};xo.prototype.toMGRS=function(s){return Xu([this.x,this.y],s)};var Jf=xo;H();H();H();var h_=1,c_=.25,Qf=.046875,tm=.01953125,em=.01068115234375,u_=.75,p_=.46875,d_=.013020833333333334,f_=.007120768229166667,m_=.3645833333333333,g_=.005696614583333333,y_=.3076171875;function lc(s){var l=[];l[0]=h_-s*(c_+s*(Qf+s*(tm+s*em))),l[1]=s*(u_-s*(Qf+s*(tm+s*em)));var u=s*s;return l[2]=u*(p_-s*(d_+s*f_)),u*=s,l[3]=u*(m_-s*g_),l[4]=u*s*y_,l}H();function xa(s,l,u,y){return u*=l,l*=l,y[0]*s-u*(y[1]+l*(y[2]+l*(y[3]+l*y[4])))}H();var __=20;function hc(s,l,u){for(var y=1/(1-l),_=s,a=__;a;--a){var T=Math.sin(_),E=1-l*T*T;if(E=(xa(_,T,Math.cos(_),u)-s)*(E*Math.sqrt(E))*y,_-=E,Math.abs(E)<qt)return _}return _}function x_(){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=lc(this.es),this.ml0=xa(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function v_(s){var l=s.x,u=s.y,y=$t(l-this.long0),_,a,T,E=Math.sin(u),B=Math.cos(u);if(this.es){var L=B*y,it=Math.pow(L,2),pt=this.ep2*Math.pow(B,2),gt=Math.pow(pt,2),_t=Math.abs(B)>qt?Math.tan(u):0,Ot=Math.pow(_t,2),Lt=Math.pow(Ot,2);_=1-this.es*Math.pow(E,2),L=L/Math.sqrt(_);var Nt=xa(u,E,B,this.en);a=this.a*(this.k0*L*(1+it/6*(1-Ot+pt+it/20*(5-18*Ot+Lt+14*pt-58*Ot*pt+it/42*(61+179*Lt-Lt*Ot-479*Ot)))))+this.x0,T=this.a*(this.k0*(Nt-this.ml0+E*y*L/2*(1+it/12*(5-Ot+9*pt+4*gt+it/30*(61+Lt-58*Ot+270*pt-330*Ot*pt+it/56*(1385+543*Lt-Lt*Ot-3111*Ot))))))+this.y0}else{var $=B*Math.sin(y);if(Math.abs(Math.abs($)-1)<qt)return 93;if(a=.5*this.a*this.k0*Math.log((1+$)/(1-$))+this.x0,T=B*Math.cos(y)/Math.sqrt(1-Math.pow($,2)),$=Math.abs(T),$>=1){if($-1>qt)return 93;T=0}else T=Math.acos(T);u<0&&(T=-T),T=this.a*this.k0*(T-this.lat0)+this.y0}return s.x=a,s.y=T,s}function b_(s){var l,u,y,_,a=(s.x-this.x0)*(1/this.a),T=(s.y-this.y0)*(1/this.a);if(this.es)if(l=this.ml0+T/this.k0,u=hc(l,this.es,this.en),Math.abs(u)<Bt){var it=Math.sin(u),pt=Math.cos(u),gt=Math.abs(pt)>qt?Math.tan(u):0,_t=this.ep2*Math.pow(pt,2),Ot=Math.pow(_t,2),Lt=Math.pow(gt,2),Nt=Math.pow(Lt,2);l=1-this.es*Math.pow(it,2);var ue=a*Math.sqrt(l)/this.k0,oe=Math.pow(ue,2);l=l*gt,y=u-l*oe/(1-this.es)*.5*(1-oe/12*(5+3*Lt-9*_t*Lt+_t-4*Ot-oe/30*(61+90*Lt-252*_t*Lt+45*Nt+46*_t-oe/56*(1385+3633*Lt+4095*Nt+1574*Nt*Lt)))),_=$t(this.long0+ue*(1-oe/6*(1+2*Lt+_t-oe/20*(5+28*Lt+24*Nt+8*_t*Lt+6*_t-oe/42*(61+662*Lt+1320*Nt+720*Nt*Lt))))/pt)}else y=Bt*An(T),_=0;else{var E=Math.exp(a/this.k0),B=.5*(E-1/E),$=this.lat0+T/this.k0,L=Math.cos($);l=Math.sqrt((1-Math.pow(L,2))/(1+Math.pow(B,2))),y=Math.asin(l),T<0&&(y=-y),B===0&&L===0?_=0:_=$t(Math.atan2(B,L)+this.long0)}return s.x=_,s.y=y,s}var w_=["Transverse_Mercator","Transverse Mercator","tmerc"],im={init:x_,forward:v_,inverse:b_,names:w_};H();H();function cc(s){var l=Math.exp(s);return l=(l-1/l)/2,l}H();function va(s,l){s=Math.abs(s),l=Math.abs(l);var u=Math.max(s,l),y=Math.min(s,l)/(u||1);return u*Math.sqrt(1+Math.pow(y,2))}H();H();function rm(s){var l=1+s,u=l-1;return u===0?s:s*Math.log(l)/u}function nm(s){var l=Math.abs(s);return l=rm(l*(1+l/(va(1,l)+1))),s<0?-l:l}H();function uc(s,l){for(var u=2*Math.cos(2*l),y=s.length-1,_=s[y],a=0,T;--y>=0;)T=-a+u*_+s[y],a=_,_=T;return l+T*Math.sin(2*l)}H();function sm(s,l){for(var u=2*Math.cos(l),y=s.length-1,_=s[y],a=0,T;--y>=0;)T=-a+u*_+s[y],a=_,_=T;return Math.sin(l)*T}H();H();function am(s){var l=Math.exp(s);return l=(l+1/l)/2,l}function Ju(s,l,u){for(var y=Math.sin(l),_=Math.cos(l),a=cc(u),T=am(u),E=2*_*T,B=-2*y*a,$=s.length-1,L=s[$],it=0,pt=0,gt=0,_t,Ot;--$>=0;)_t=pt,Ot=it,pt=L,it=gt,L=-_t+E*pt-B*it+s[$],gt=-Ot+B*pt+E*it;return E=y*T,B=_*a,[E*L-B*gt,E*gt+B*L]}function M_(){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 s=this.es/(1+Math.sqrt(1-this.es)),l=s/(2-s),u=l;this.cgb[0]=l*(2+l*(-2/3+l*(-2+l*(116/45+l*(26/45+l*(-2854/675)))))),this.cbg[0]=l*(-2+l*(2/3+l*(4/3+l*(-82/45+l*(32/45+l*(4642/4725)))))),u=u*l,this.cgb[1]=u*(7/3+l*(-8/5+l*(-227/45+l*(2704/315+l*(2323/945))))),this.cbg[1]=u*(5/3+l*(-16/15+l*(-13/9+l*(904/315+l*(-1522/945))))),u=u*l,this.cgb[2]=u*(56/15+l*(-136/35+l*(-1262/105+l*(73814/2835)))),this.cbg[2]=u*(-26/15+l*(34/21+l*(8/5+l*(-12686/2835)))),u=u*l,this.cgb[3]=u*(4279/630+l*(-332/35+l*(-399572/14175))),this.cbg[3]=u*(1237/630+l*(-12/5+l*(-24832/14175))),u=u*l,this.cgb[4]=u*(4174/315+l*(-144838/6237)),this.cbg[4]=u*(-734/315+l*(109598/31185)),u=u*l,this.cgb[5]=u*(601676/22275),this.cbg[5]=u*(444337/155925),u=Math.pow(l,2),this.Qn=this.k0/(1+l)*(1+u*(1/4+u*(1/64+u/256))),this.utg[0]=l*(-.5+l*(2/3+l*(-37/96+l*(1/360+l*(81/512+l*(-96199/604800)))))),this.gtu[0]=l*(.5+l*(-2/3+l*(5/16+l*(41/180+l*(-127/288+l*(7891/37800)))))),this.utg[1]=u*(-1/48+l*(-1/15+l*(437/1440+l*(-46/105+l*(1118711/3870720))))),this.gtu[1]=u*(13/48+l*(-3/5+l*(557/1440+l*(281/630+l*(-1983433/1935360))))),u=u*l,this.utg[2]=u*(-17/480+l*(37/840+l*(209/4480+l*(-5569/90720)))),this.gtu[2]=u*(61/240+l*(-103/140+l*(15061/26880+l*(167603/181440)))),u=u*l,this.utg[3]=u*(-4397/161280+l*(11/504+l*(830251/7257600))),this.gtu[3]=u*(49561/161280+l*(-179/168+l*(6601661/7257600))),u=u*l,this.utg[4]=u*(-4583/161280+l*(108847/3991680)),this.gtu[4]=u*(34729/80640+l*(-3418889/1995840)),u=u*l,this.utg[5]=u*(-20648693/638668800),this.gtu[5]=u*(212378941/319334400);var y=uc(this.cbg,this.lat0);this.Zb=-this.Qn*(y+sm(this.gtu,2*y))}function S_(s){var l=$t(s.x-this.long0),u=s.y;u=uc(this.cbg,u);var y=Math.sin(u),_=Math.cos(u),a=Math.sin(l),T=Math.cos(l);u=Math.atan2(y,T*_),l=Math.atan2(a*_,va(y,_*T)),l=nm(Math.tan(l));var E=Ju(this.gtu,2*u,2*l);u=u+E[0],l=l+E[1];var B,$;return Math.abs(l)<=2.623395162778?(B=this.a*(this.Qn*l)+this.x0,$=this.a*(this.Qn*u+this.Zb)+this.y0):(B=1/0,$=1/0),s.x=B,s.y=$,s}function T_(s){var l=(s.x-this.x0)*(1/this.a),u=(s.y-this.y0)*(1/this.a);u=(u-this.Zb)/this.Qn,l=l/this.Qn;var y,_;if(Math.abs(l)<=2.623395162778){var a=Ju(this.utg,2*u,2*l);u=u+a[0],l=l+a[1],l=Math.atan(cc(l));var T=Math.sin(u),E=Math.cos(u),B=Math.sin(l),$=Math.cos(l);u=Math.atan2(T*$,va(B,$*E)),l=Math.atan2(B,$*E),y=$t(l+this.long0),_=uc(this.cgb,u)}else y=1/0,_=1/0;return s.x=y,s.y=_,s}var E_=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],vo={init:M_,forward:S_,inverse:T_,names:E_};H();H();function om(s,l){if(s===void 0){if(s=Math.floor(($t(l)+Math.PI)*30/Math.PI)+1,s<0)return 0;if(s>60)return 60}return s}var I_="etmerc";function C_(){var s=om(this.zone,this.long0);if(s===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(s)-183)*Ui,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,vo.init.apply(this),this.forward=vo.forward,this.inverse=vo.inverse}var A_=["Universal Transverse Mercator System","utm"],lm={init:C_,names:A_,dependsOn:I_};H();H();H();function pc(s,l){return Math.pow((1-s)/(1+s),l)}var P_=20;function z_(){var s=Math.sin(this.lat0),l=Math.cos(this.lat0);l*=l,this.rc=Math.sqrt(1-this.es)/(1-this.es*s*s),this.C=Math.sqrt(1+this.es*l*l/(1-this.es)),this.phic0=Math.asin(s/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+Ke)/(Math.pow(Math.tan(.5*this.lat0+Ke),this.C)*pc(this.e*s,this.ratexp))}function k_(s){var l=s.x,u=s.y;return s.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*u+Ke),this.C)*pc(this.e*Math.sin(u),this.ratexp))-Bt,s.x=this.C*l,s}function L_(s){for(var l=1e-14,u=s.x/this.C,y=s.y,_=Math.pow(Math.tan(.5*y+Ke)/this.K,1/this.C),a=P_;a>0&&(y=2*Math.atan(_*pc(this.e*Math.sin(s.y),-.5*this.e))-Bt,!(Math.abs(y-s.y)<l));--a)s.y=y;return a?(s.x=u,s.y=y,s):null}var D_=["gauss"],dc={init:z_,forward:k_,inverse:L_,names:D_};function R_(){dc.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 B_(s){var l,u,y,_;return s.x=$t(s.x-this.long0),dc.forward.apply(this,[s]),l=Math.sin(s.y),u=Math.cos(s.y),y=Math.cos(s.x),_=this.k0*this.R2/(1+this.sinc0*l+this.cosc0*u*y),s.x=_*u*Math.sin(s.x),s.y=_*(this.cosc0*l-this.sinc0*u*y),s.x=this.a*s.x+this.x0,s.y=this.a*s.y+this.y0,s}function F_(s){var l,u,y,_,a;if(s.x=(s.x-this.x0)/this.a,s.y=(s.y-this.y0)/this.a,s.x/=this.k0,s.y/=this.k0,a=Math.sqrt(s.x*s.x+s.y*s.y)){var T=2*Math.atan2(a,this.R2);l=Math.sin(T),u=Math.cos(T),_=Math.asin(u*this.sinc0+s.y*l*this.cosc0/a),y=Math.atan2(s.x*l,a*this.cosc0*u-s.y*this.sinc0*l)}else _=this.phic0,y=0;return s.x=y,s.y=_,dc.inverse.apply(this,[s]),s.x=$t(s.x+this.long0),s}var O_=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],hm={init:R_,forward:B_,inverse:F_,names:O_};H();function N_(s,l,u){return l*=u,Math.tan(.5*(Bt+s))*Math.pow((1-l)/(1+l),.5*u)}function U_(){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)<=qt&&(this.k0=.5*(1+An(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=qt&&(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)<=qt&&(this.k0=.5*this.cons*dr(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Cr(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=dr(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 V_(s){var l=s.x,u=s.y,y=Math.sin(u),_=Math.cos(u),a,T,E,B,$,L,it=$t(l-this.long0);return Math.abs(Math.abs(l-this.long0)-Math.PI)<=qt&&Math.abs(u+this.lat0)<=qt?(s.x=NaN,s.y=NaN,s):this.sphere?(a=2*this.k0/(1+this.sinlat0*y+this.coslat0*_*Math.cos(it)),s.x=this.a*a*_*Math.sin(it)+this.x0,s.y=this.a*a*(this.coslat0*y-this.sinlat0*_*Math.cos(it))+this.y0,s):(T=2*Math.atan(this.ssfn_(u,y,this.e))-Bt,B=Math.cos(T),E=Math.sin(T),Math.abs(this.coslat0)<=qt?($=Cr(this.e,u*this.con,this.con*y),L=2*this.a*this.k0*$/this.cons,s.x=this.x0+L*Math.sin(l-this.long0),s.y=this.y0-this.con*L*Math.cos(l-this.long0),s):(Math.abs(this.sinlat0)<qt?(a=2*this.a*this.k0/(1+B*Math.cos(it)),s.y=a*E):(a=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*E+this.cosX0*B*Math.cos(it))),s.y=a*(this.cosX0*E-this.sinX0*B*Math.cos(it))+this.y0),s.x=a*B*Math.sin(it)+this.x0,s))}function G_(s){s.x-=this.x0,s.y-=this.y0;var l,u,y,_,a,T=Math.sqrt(s.x*s.x+s.y*s.y);if(this.sphere){var E=2*Math.atan(T/(2*this.a*this.k0));return l=this.long0,u=this.lat0,T<=qt?(s.x=l,s.y=u,s):(u=Math.asin(Math.cos(E)*this.sinlat0+s.y*Math.sin(E)*this.coslat0/T),Math.abs(this.coslat0)<qt?this.lat0>0?l=$t(this.long0+Math.atan2(s.x,-1*s.y)):l=$t(this.long0+Math.atan2(s.x,s.y)):l=$t(this.long0+Math.atan2(s.x*Math.sin(E),T*this.coslat0*Math.cos(E)-s.y*this.sinlat0*Math.sin(E))),s.x=l,s.y=u,s)}else if(Math.abs(this.coslat0)<=qt){if(T<=qt)return u=this.lat0,l=this.long0,s.x=l,s.y=u,s;s.x*=this.con,s.y*=this.con,y=T*this.cons/(2*this.a*this.k0),u=this.con*rs(this.e,y),l=this.con*$t(this.con*this.long0+Math.atan2(s.x,-1*s.y))}else _=2*Math.atan(T*this.cosX0/(2*this.a*this.k0*this.ms1)),l=this.long0,T<=qt?a=this.X0:(a=Math.asin(Math.cos(_)*this.sinX0+s.y*Math.sin(_)*this.cosX0/T),l=$t(this.long0+Math.atan2(s.x*Math.sin(_),T*this.cosX0*Math.cos(_)-s.y*this.sinX0*Math.sin(_)))),u=-1*rs(this.e,Math.tan(.5*(Bt+a)));return s.x=l,s.y=u,s}var q_=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],cm={init:U_,forward:V_,inverse:G_,names:q_,ssfn_:N_};H();function j_(){var s=this.lat0;this.lambda0=this.long0;var l=Math.sin(s),u=this.a,y=this.rf,_=1/y,a=2*_-Math.pow(_,2),T=this.e=Math.sqrt(a);this.R=this.k0*u*Math.sqrt(1-a)/(1-a*Math.pow(l,2)),this.alpha=Math.sqrt(1+a/(1-a)*Math.pow(Math.cos(s),4)),this.b0=Math.asin(l/this.alpha);var E=Math.log(Math.tan(Math.PI/4+this.b0/2)),B=Math.log(Math.tan(Math.PI/4+s/2)),$=Math.log((1+T*l)/(1-T*l));this.K=E-this.alpha*B+this.alpha*T/2*$}function $_(s){var l=Math.log(Math.tan(Math.PI/4-s.y/2)),u=this.e/2*Math.log((1+this.e*Math.sin(s.y))/(1-this.e*Math.sin(s.y))),y=-this.alpha*(l+u)+this.K,_=2*(Math.atan(Math.exp(y))-Math.PI/4),a=this.alpha*(s.x-this.lambda0),T=Math.atan(Math.sin(a)/(Math.sin(this.b0)*Math.tan(_)+Math.cos(this.b0)*Math.cos(a))),E=Math.asin(Math.cos(this.b0)*Math.sin(_)-Math.sin(this.b0)*Math.cos(_)*Math.cos(a));return s.y=this.R/2*Math.log((1+Math.sin(E))/(1-Math.sin(E)))+this.y0,s.x=this.R*T+this.x0,s}function W_(s){for(var l=s.x-this.x0,u=s.y-this.y0,y=l/this.R,_=2*(Math.atan(Math.exp(u/this.R))-Math.PI/4),a=Math.asin(Math.cos(this.b0)*Math.sin(_)+Math.sin(this.b0)*Math.cos(_)*Math.cos(y)),T=Math.atan(Math.sin(y)/(Math.cos(this.b0)*Math.cos(y)-Math.sin(this.b0)*Math.tan(_))),E=this.lambda0+T/this.alpha,B=0,$=a,L=-1e3,it=0;Math.abs($-L)>1e-7;){if(++it>20)return;B=1/this.alpha*(Math.log(Math.tan(Math.PI/4+a/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin($))/2)),L=$,$=2*Math.atan(Math.exp(B))-Math.PI/2}return s.x=E,s.y=$,s}var Z_=["somerc"],um={init:j_,forward:$_,inverse:W_,names:Z_};H();function H_(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var s=Math.sin(this.lat0),l=Math.cos(this.lat0),u=this.e*s;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(l,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-u*u);var y=Cr(this.e,this.lat0,s),_=this.bl/l*Math.sqrt((1-this.es)/(1-u*u));_*_<1&&(_=1);var a,T;if(!isNaN(this.longc))this.lat0>=0?a=_+Math.sqrt(_*_-1):a=_-Math.sqrt(_*_-1),this.el=a*Math.pow(y,this.bl),T=.5*(a-1/a),this.gamma0=Math.asin(Math.sin(this.alpha)/_),this.long0=this.longc-Math.asin(T*Math.tan(this.gamma0))/this.bl;else{var E=Cr(this.e,this.lat1,Math.sin(this.lat1)),B=Cr(this.e,this.lat2,Math.sin(this.lat2));this.lat0>=0?this.el=(_+Math.sqrt(_*_-1))*Math.pow(y,this.bl):this.el=(_-Math.sqrt(_*_-1))*Math.pow(y,this.bl);var $=Math.pow(E,this.bl),L=Math.pow(B,this.bl);a=this.el/$,T=.5*(a-1/a);var it=(this.el*this.el-L*$)/(this.el*this.el+L*$),pt=(L-$)/(L+$),gt=$t(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(it*Math.tan(.5*this.bl*gt)/pt)/this.bl,this.long0=$t(this.long0);var _t=$t(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*_t)/T),this.alpha=Math.asin(_*Math.sin(this.gamma0))}this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(_*_-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(_*_-1),Math.cos(this.alpha))}function X_(s){var l=s.x,u=s.y,y=$t(l-this.long0),_,a,T;if(Math.abs(Math.abs(u)-Bt)<=qt)u>0?T=-1:T=1,a=this.al/this.bl*Math.log(Math.tan(Ke+T*this.gamma0*.5)),_=-1*T*Bt*this.al/this.bl;else{var E=Cr(this.e,u,Math.sin(u)),B=this.el/Math.pow(E,this.bl),$=.5*(B-1/B),L=.5*(B+1/B),it=Math.sin(this.bl*y),pt=($*Math.sin(this.gamma0)-it*Math.cos(this.gamma0))/L;Math.abs(Math.abs(pt)-1)<=qt?a=Number.POSITIVE_INFINITY:a=.5*this.al*Math.log((1-pt)/(1+pt))/this.bl,Math.abs(Math.cos(this.bl*y))<=qt?_=this.al*this.bl*y:_=this.al*Math.atan2($*Math.cos(this.gamma0)+it*Math.sin(this.gamma0),Math.cos(this.bl*y))/this.bl}return this.no_rot?(s.x=this.x0+_,s.y=this.y0+a):(_-=this.uc,s.x=this.x0+a*Math.cos(this.alpha)+_*Math.sin(this.alpha),s.y=this.y0+_*Math.cos(this.alpha)-a*Math.sin(this.alpha)),s}function K_(s){var l,u;this.no_rot?(u=s.y-this.y0,l=s.x-this.x0):(u=(s.x-this.x0)*Math.cos(this.alpha)-(s.y-this.y0)*Math.sin(this.alpha),l=(s.y-this.y0)*Math.cos(this.alpha)+(s.x-this.x0)*Math.sin(this.alpha),l+=this.uc);var y=Math.exp(-1*this.bl*u/this.al),_=.5*(y-1/y),a=.5*(y+1/y),T=Math.sin(this.bl*l/this.al),E=(T*Math.cos(this.gamma0)+_*Math.sin(this.gamma0))/a,B=Math.pow(this.el/Math.sqrt((1+E)/(1-E)),1/this.bl);return Math.abs(E-1)<qt?(s.x=this.long0,s.y=Bt):Math.abs(E+1)<qt?(s.x=this.long0,s.y=-1*Bt):(s.y=rs(this.e,B),s.x=$t(this.long0-Math.atan2(_*Math.cos(this.gamma0)-T*Math.sin(this.gamma0),Math.cos(this.bl*l/this.al))/this.bl)),s}var Y_=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"],pm={init:H_,forward:X_,inverse:K_,names:Y_};H();function J_(){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)<qt)){var s=this.b/this.a;this.e=Math.sqrt(1-s*s);var l=Math.sin(this.lat1),u=Math.cos(this.lat1),y=dr(this.e,l,u),_=Cr(this.e,this.lat1,l),a=Math.sin(this.lat2),T=Math.cos(this.lat2),E=dr(this.e,a,T),B=Cr(this.e,this.lat2,a),$=Cr(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>qt?this.ns=Math.log(y/E)/Math.log(_/B):this.ns=l,isNaN(this.ns)&&(this.ns=l),this.f0=y/(this.ns*Math.pow(_,this.ns)),this.rh=this.a*this.f0*Math.pow($,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function Q_(s){var l=s.x,u=s.y;Math.abs(2*Math.abs(u)-Math.PI)<=qt&&(u=An(u)*(Bt-2*qt));var y=Math.abs(Math.abs(u)-Bt),_,a;if(y>qt)_=Cr(this.e,u,Math.sin(u)),a=this.a*this.f0*Math.pow(_,this.ns);else{if(y=u*this.ns,y<=0)return null;a=0}var T=this.ns*$t(l-this.long0);return s.x=this.k0*(a*Math.sin(T))+this.x0,s.y=this.k0*(this.rh-a*Math.cos(T))+this.y0,s}function tx(s){var l,u,y,_,a,T=(s.x-this.x0)/this.k0,E=this.rh-(s.y-this.y0)/this.k0;this.ns>0?(l=Math.sqrt(T*T+E*E),u=1):(l=-Math.sqrt(T*T+E*E),u=-1);var B=0;if(l!==0&&(B=Math.atan2(u*T,u*E)),l!==0||this.ns>0){if(u=1/this.ns,y=Math.pow(l/(this.a*this.f0),u),_=rs(this.e,y),_===-9999)return null}else _=-Bt;return a=$t(B/this.ns+this.long0),s.x=a,s.y=_,s}var ex=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"],dm={init:J_,forward:Q_,inverse:tx,names:ex};H();function ix(){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 rx(s){var l,u,y,_,a,T,E,B=s.x,$=s.y,L=$t(B-this.long0);return l=Math.pow((1+this.e*Math.sin($))/(1-this.e*Math.sin($)),this.alfa*this.e/2),u=2*(Math.atan(this.k*Math.pow(Math.tan($/2+this.s45),this.alfa)/l)-this.s45),y=-L*this.alfa,_=Math.asin(Math.cos(this.ad)*Math.sin(u)+Math.sin(this.ad)*Math.cos(u)*Math.cos(y)),a=Math.asin(Math.cos(u)*Math.sin(y)/Math.cos(_)),T=this.n*a,E=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(_/2+this.s45),this.n),s.y=E*Math.cos(T)/1,s.x=E*Math.sin(T)/1,this.czech||(s.y*=-1,s.x*=-1),s}function nx(s){var l,u,y,_,a,T,E,B,$=s.x;s.x=s.y,s.y=$,this.czech||(s.y*=-1,s.x*=-1),T=Math.sqrt(s.x*s.x+s.y*s.y),a=Math.atan2(s.y,s.x),_=a/Math.sin(this.s0),y=2*(Math.atan(Math.pow(this.ro0/T,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),l=Math.asin(Math.cos(this.ad)*Math.sin(y)-Math.sin(this.ad)*Math.cos(y)*Math.cos(_)),u=Math.asin(Math.cos(y)*Math.sin(_)/Math.cos(l)),s.x=this.long0-u/this.alfa,E=l,B=0;var L=0;do s.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(l/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(E))/(1-this.e*Math.sin(E)),this.e/2))-this.s45),Math.abs(E-s.y)<1e-10&&(B=1),E=s.y,L+=1;while(B===0&&L<15);return L>=15?null:s}var sx=["Krovak","krovak"],fm={init:ix,forward:rx,inverse:nx,names:sx};H();H();function Ki(s,l,u,y,_){return s*_-l*Math.sin(2*_)+u*Math.sin(4*_)-y*Math.sin(6*_)}H();function ns(s){return 1-.25*s*(1+s/16*(3+1.25*s))}H();function ss(s){return .375*s*(1+.25*s*(1+.46875*s))}H();function as(s){return .05859375*s*s*(1+.75*s)}H();function os(s){return s*s*s*(35/3072)}H();function ls(s,l,u){var y=l*u;return s/Math.sqrt(1-y*y)}H();function wn(s){return Math.abs(s)<Bt?s:s-An(s)*Math.PI}H();function ba(s,l,u,y,_){var a,T;a=s/l;for(var E=0;E<15;E++)if(T=(s-(l*a-u*Math.sin(2*a)+y*Math.sin(4*a)-_*Math.sin(6*a)))/(l-2*u*Math.cos(2*a)+4*y*Math.cos(4*a)-6*_*Math.cos(6*a)),a+=T,Math.abs(T)<=1e-10)return a;return NaN}function ax(){this.sphere||(this.e0=ns(this.es),this.e1=ss(this.es),this.e2=as(this.es),this.e3=os(this.es),this.ml0=this.a*Ki(this.e0,this.e1,this.e2,this.e3,this.lat0))}function ox(s){var l,u,y=s.x,_=s.y;if(y=$t(y-this.long0),this.sphere)l=this.a*Math.asin(Math.cos(_)*Math.sin(y)),u=this.a*(Math.atan2(Math.tan(_),Math.cos(y))-this.lat0);else{var a=Math.sin(_),T=Math.cos(_),E=ls(this.a,this.e,a),B=Math.tan(_)*Math.tan(_),$=y*Math.cos(_),L=$*$,it=this.es*T*T/(1-this.es),pt=this.a*Ki(this.e0,this.e1,this.e2,this.e3,_);l=E*$*(1-L*B*(1/6-(8-B+8*it)*L/120)),u=pt-this.ml0+E*a/T*L*(.5+(5-B+6*it)*L/24)}return s.x=l+this.x0,s.y=u+this.y0,s}function lx(s){s.x-=this.x0,s.y-=this.y0;var l=s.x/this.a,u=s.y/this.a,y,_;if(this.sphere){var a=u+this.lat0;y=Math.asin(Math.sin(a)*Math.cos(l)),_=Math.atan2(Math.tan(l),Math.cos(a))}else{var T=this.ml0/this.a+u,E=ba(T,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(E)-Bt)<=qt)return s.x=this.long0,s.y=Bt,u<0&&(s.y*=-1),s;var B=ls(this.a,this.e,Math.sin(E)),$=B*B*B/this.a/this.a*(1-this.es),L=Math.pow(Math.tan(E),2),it=l*this.a/B,pt=it*it;y=E-B*Math.tan(E)/$*it*it*(.5-(1+3*L)*it*it/24),_=it*(1-pt*(L/3+(1+3*L)*L*pt/15))/Math.cos(E)}return s.x=$t(_+this.long0),s.y=wn(y),s}var hx=["Cassini","Cassini_Soldner","cass"],mm={init:ax,forward:ox,inverse:lx,names:hx};H();H();function Mn(s,l){var u;return s>1e-7?(u=s*l,(1-s*s)*(l/(1-u*u)-.5/s*Math.log((1-u)/(1+u)))):2*l}var cx=1,ux=2,px=3,dx=4;function fx(){var s=Math.abs(this.lat0);if(Math.abs(s-Bt)<qt?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(s)<qt?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var l;switch(this.qp=Mn(this.e,1),this.mmf=.5/(1-this.es),this.apa=Mx(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),l=Math.sin(this.lat0),this.sinb1=Mn(this.e,l)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*l*l)*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 mx(s){var l,u,y,_,a,T,E,B,$,L,it=s.x,pt=s.y;if(it=$t(it-this.long0),this.sphere){if(a=Math.sin(pt),L=Math.cos(pt),y=Math.cos(it),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(u=this.mode===this.EQUIT?1+L*y:1+this.sinph0*a+this.cosph0*L*y,u<=qt)return null;u=Math.sqrt(2/u),l=u*L*Math.sin(it),u*=this.mode===this.EQUIT?a:this.cosph0*a-this.sinph0*L*y}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(y=-y),Math.abs(pt+this.lat0)<qt)return null;u=Ke-pt*.5,u=2*(this.mode===this.S_POLE?Math.cos(u):Math.sin(u)),l=u*Math.sin(it),u*=y}}else{switch(E=0,B=0,$=0,y=Math.cos(it),_=Math.sin(it),a=Math.sin(pt),T=Mn(this.e,a),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(E=T/this.qp,B=Math.sqrt(1-E*E)),this.mode){case this.OBLIQ:$=1+this.sinb1*E+this.cosb1*B*y;break;case this.EQUIT:$=1+B*y;break;case this.N_POLE:$=Bt+pt,T=this.qp-T;break;case this.S_POLE:$=pt-Bt,T=this.qp+T;break}if(Math.abs($)<qt)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:$=Math.sqrt(2/$),this.mode===this.OBLIQ?u=this.ymf*$*(this.cosb1*E-this.sinb1*B*y):u=($=Math.sqrt(2/(1+B*y)))*E*this.ymf,l=this.xmf*$*B*_;break;case this.N_POLE:case this.S_POLE:T>=0?(l=($=Math.sqrt(T))*_,u=y*(this.mode===this.S_POLE?$:-$)):l=u=0;break}}return s.x=this.a*l+this.x0,s.y=this.a*u+this.y0,s}function gx(s){s.x-=this.x0,s.y-=this.y0;var l=s.x/this.a,u=s.y/this.a,y,_,a,T,E,B,$;if(this.sphere){var L=0,it,pt=0;if(it=Math.sqrt(l*l+u*u),_=it*.5,_>1)return null;switch(_=2*Math.asin(_),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(pt=Math.sin(_),L=Math.cos(_)),this.mode){case this.EQUIT:_=Math.abs(it)<=qt?0:Math.asin(u*pt/it),l*=pt,u=L*it;break;case this.OBLIQ:_=Math.abs(it)<=qt?this.lat0:Math.asin(L*this.sinph0+u*pt*this.cosph0/it),l*=pt*this.cosph0,u=(L-Math.sin(_)*this.sinph0)*it;break;case this.N_POLE:u=-u,_=Bt-_;break;case this.S_POLE:_-=Bt;break}y=u===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(l,u)}else{if($=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(l/=this.dd,u*=this.dd,B=Math.sqrt(l*l+u*u),B<qt)return s.x=this.long0,s.y=this.lat0,s;T=2*Math.asin(.5*B/this.rq),a=Math.cos(T),l*=T=Math.sin(T),this.mode===this.OBLIQ?($=a*this.sinb1+u*T*this.cosb1/B,E=this.qp*$,u=B*this.cosb1*a-u*this.sinb1*T):($=u*T/B,E=this.qp*$,u=B*a)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(u=-u),E=l*l+u*u,!E)return s.x=this.long0,s.y=this.lat0,s;$=1-E/this.qp,this.mode===this.S_POLE&&($=-$)}y=Math.atan2(l,u),_=Sx(Math.asin($),this.apa)}return s.x=$t(this.long0+y),s.y=_,s}var yx=.3333333333333333,_x=.17222222222222222,xx=.10257936507936508,vx=.06388888888888888,bx=.0664021164021164,wx=.016415012942191543;function Mx(s){var l,u=[];return u[0]=s*yx,l=s*s,u[0]+=l*_x,u[1]=l*vx,l*=s,u[0]+=l*xx,u[1]+=l*bx,u[2]=l*wx,u}function Sx(s,l){var u=s+s;return s+l[0]*Math.sin(u)+l[1]*Math.sin(u+u)+l[2]*Math.sin(u+u+u)}var Tx=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],gm={init:fx,forward:mx,inverse:gx,names:Tx,S_POLE:cx,N_POLE:ux,EQUIT:px,OBLIQ:dx};H();H();function Ur(s){return Math.abs(s)>1&&(s=s>1?1:-1),Math.asin(s)}function Ex(){Math.abs(this.lat1+this.lat2)<qt||(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=dr(this.e3,this.sin_po,this.cos_po),this.qs1=Mn(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=dr(this.e3,this.sin_po,this.cos_po),this.qs2=Mn(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=Mn(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>qt?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 Ix(s){var l=s.x,u=s.y;this.sin_phi=Math.sin(u),this.cos_phi=Math.cos(u);var y=Mn(this.e3,this.sin_phi,this.cos_phi),_=this.a*Math.sqrt(this.c-this.ns0*y)/this.ns0,a=this.ns0*$t(l-this.long0),T=_*Math.sin(a)+this.x0,E=this.rh-_*Math.cos(a)+this.y0;return s.x=T,s.y=E,s}function Cx(s){var l,u,y,_,a,T;return s.x-=this.x0,s.y=this.rh-s.y+this.y0,this.ns0>=0?(l=Math.sqrt(s.x*s.x+s.y*s.y),y=1):(l=-Math.sqrt(s.x*s.x+s.y*s.y),y=-1),_=0,l!==0&&(_=Math.atan2(y*s.x,y*s.y)),y=l*this.ns0/this.a,this.sphere?T=Math.asin((this.c-y*y)/(2*this.ns0)):(u=(this.c-y*y)/this.ns0,T=this.phi1z(this.e3,u)),a=$t(_/this.ns0+this.long0),s.x=a,s.y=T,s}function Ax(s,l){var u,y,_,a,T,E=Ur(.5*l);if(s<qt)return E;for(var B=s*s,$=1;$<=25;$++)if(u=Math.sin(E),y=Math.cos(E),_=s*u,a=1-_*_,T=.5*a*a/y*(l/(1-B)-u/a+.5/s*Math.log((1-_)/(1+_))),E=E+T,Math.abs(T)<=1e-7)return E;return null}var Px=["Albers_Conic_Equal_Area","Albers","aea"],ym={init:Ex,forward:Ix,inverse:Cx,names:Px,phi1z:Ax};H();function zx(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function kx(s){var l,u,y,_,a,T,E,B,$=s.x,L=s.y;return y=$t($-this.long0),l=Math.sin(L),u=Math.cos(L),_=Math.cos(y),T=this.sin_p14*l+this.cos_p14*u*_,a=1,T>0||Math.abs(T)<=qt?(E=this.x0+this.a*a*u*Math.sin(y)/T,B=this.y0+this.a*a*(this.cos_p14*l-this.sin_p14*u*_)/T):(E=this.x0+this.infinity_dist*u*Math.sin(y),B=this.y0+this.infinity_dist*(this.cos_p14*l-this.sin_p14*u*_)),s.x=E,s.y=B,s}function Lx(s){var l,u,y,_,a,T;return s.x=(s.x-this.x0)/this.a,s.y=(s.y-this.y0)/this.a,s.x/=this.k0,s.y/=this.k0,(l=Math.sqrt(s.x*s.x+s.y*s.y))?(_=Math.atan2(l,this.rc),u=Math.sin(_),y=Math.cos(_),T=Ur(y*this.sin_p14+s.y*u*this.cos_p14/l),a=Math.atan2(s.x*u,l*this.cos_p14*y-s.y*this.sin_p14*u),a=$t(this.long0+a)):(T=this.phic0,a=0),s.x=a,s.y=T,s}var Dx=["gnom"],_m={init:zx,forward:kx,inverse:Lx,names:Dx};H();H();function xm(s,l){var u=1-(1-s*s)/(2*s)*Math.log((1-s)/(1+s));if(Math.abs(Math.abs(l)-u)<1e-6)return l<0?-1*Bt:Bt;for(var y=Math.asin(.5*l),_,a,T,E,B=0;B<30;B++)if(a=Math.sin(y),T=Math.cos(y),E=s*a,_=Math.pow(1-E*E,2)/(2*T)*(l/(1-s*s)-a/(1-E*E)+.5/s*Math.log((1-E)/(1+E))),y+=_,Math.abs(_)<=1e-10)return y;return NaN}function Rx(){this.sphere||(this.k0=dr(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Bx(s){var l=s.x,u=s.y,y,_,a=$t(l-this.long0);if(this.sphere)y=this.x0+this.a*a*Math.cos(this.lat_ts),_=this.y0+this.a*Math.sin(u)/Math.cos(this.lat_ts);else{var T=Mn(this.e,Math.sin(u));y=this.x0+this.a*this.k0*a,_=this.y0+this.a*T*.5/this.k0}return s.x=y,s.y=_,s}function Fx(s){s.x-=this.x0,s.y-=this.y0;var l,u;return this.sphere?(l=$t(this.long0+s.x/this.a/Math.cos(this.lat_ts)),u=Math.asin(s.y/this.a*Math.cos(this.lat_ts))):(u=xm(this.e,2*s.y*this.k0/this.a),l=$t(this.long0+s.x/(this.a*this.k0))),s.x=l,s.y=u,s}var Ox=["cea"],vm={init:Rx,forward:Bx,inverse:Fx,names:Ox};H();function Nx(){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 Ux(s){var l=s.x,u=s.y,y=$t(l-this.long0),_=wn(u-this.lat0);return s.x=this.x0+this.a*y*this.rc,s.y=this.y0+this.a*_,s}function Vx(s){var l=s.x,u=s.y;return s.x=$t(this.long0+(l-this.x0)/(this.a*this.rc)),s.y=wn(this.lat0+(u-this.y0)/this.a),s}var Gx=["Equirectangular","Equidistant_Cylindrical","eqc"],bm={init:Nx,forward:Ux,inverse:Vx,names:Gx};H();var wm=20;function qx(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=ns(this.es),this.e1=ss(this.es),this.e2=as(this.es),this.e3=os(this.es),this.ml0=this.a*Ki(this.e0,this.e1,this.e2,this.e3,this.lat0)}function jx(s){var l=s.x,u=s.y,y,_,a,T=$t(l-this.long0);if(a=T*Math.sin(u),this.sphere)Math.abs(u)<=qt?(y=this.a*T,_=-1*this.a*this.lat0):(y=this.a*Math.sin(a)/Math.tan(u),_=this.a*(wn(u-this.lat0)+(1-Math.cos(a))/Math.tan(u)));else if(Math.abs(u)<=qt)y=this.a*T,_=-1*this.ml0;else{var E=ls(this.a,this.e,Math.sin(u))/Math.tan(u);y=E*Math.sin(a),_=this.a*Ki(this.e0,this.e1,this.e2,this.e3,u)-this.ml0+E*(1-Math.cos(a))}return s.x=y+this.x0,s.y=_+this.y0,s}function $x(s){var l,u,y,_,a,T,E,B,$;if(y=s.x-this.x0,_=s.y-this.y0,this.sphere)if(Math.abs(_+this.a*this.lat0)<=qt)l=$t(y/this.a+this.long0),u=0;else{T=this.lat0+_/this.a,E=y*y/this.a/this.a+T*T,B=T;var L;for(a=wm;a;--a)if(L=Math.tan(B),$=-1*(T*(B*L+1)-B-.5*(B*B+E)*L)/((B-T)/L-1),B+=$,Math.abs($)<=qt){u=B;break}l=$t(this.long0+Math.asin(y*Math.tan(B)/this.a)/Math.sin(u))}else if(Math.abs(_+this.ml0)<=qt)u=0,l=$t(this.long0+y/this.a);else{T=(this.ml0+_)/this.a,E=y*y/this.a/this.a+T*T,B=T;var it,pt,gt,_t,Ot;for(a=wm;a;--a)if(Ot=this.e*Math.sin(B),it=Math.sqrt(1-Ot*Ot)*Math.tan(B),pt=this.a*Ki(this.e0,this.e1,this.e2,this.e3,B),gt=this.e0-2*this.e1*Math.cos(2*B)+4*this.e2*Math.cos(4*B)-6*this.e3*Math.cos(6*B),_t=pt/this.a,$=(T*(it*_t+1)-_t-.5*it*(_t*_t+E))/(this.es*Math.sin(2*B)*(_t*_t+E-2*T*_t)/(4*it)+(T-_t)*(it*gt-2/Math.sin(2*B))-gt),B-=$,Math.abs($)<=qt){u=B;break}it=Math.sqrt(1-this.es*Math.pow(Math.sin(u),2))*Math.tan(u),l=$t(this.long0+Math.asin(y*it/this.a)/Math.sin(u))}return s.x=l,s.y=u,s}var Wx=["Polyconic","poly"],Mm={init:qx,forward:jx,inverse:$x,names:Wx};H();function Zx(){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 Hx(s){var l,u=s.x,y=s.y,_=y-this.lat0,a=u-this.long0,T=_/ga*1e-5,E=a,B=1,$=0;for(l=1;l<=10;l++)B=B*T,$=$+this.A[l]*B;var L=$,it=E,pt=1,gt=0,_t,Ot,Lt=0,Nt=0;for(l=1;l<=6;l++)_t=pt*L-gt*it,Ot=gt*L+pt*it,pt=_t,gt=Ot,Lt=Lt+this.B_re[l]*pt-this.B_im[l]*gt,Nt=Nt+this.B_im[l]*pt+this.B_re[l]*gt;return s.x=Nt*this.a+this.x0,s.y=Lt*this.a+this.y0,s}function Xx(s){var l,u=s.x,y=s.y,_=u-this.x0,a=y-this.y0,T=a/this.a,E=_/this.a,B=1,$=0,L,it,pt=0,gt=0;for(l=1;l<=6;l++)L=B*T-$*E,it=$*T+B*E,B=L,$=it,pt=pt+this.C_re[l]*B-this.C_im[l]*$,gt=gt+this.C_im[l]*B+this.C_re[l]*$;for(var _t=0;_t<this.iterations;_t++){var Ot=pt,Lt=gt,Nt,ue,oe=T,Ee=E;for(l=2;l<=6;l++)Nt=Ot*pt-Lt*gt,ue=Lt*pt+Ot*gt,Ot=Nt,Lt=ue,oe=oe+(l-1)*(this.B_re[l]*Ot-this.B_im[l]*Lt),Ee=Ee+(l-1)*(this.B_im[l]*Ot+this.B_re[l]*Lt);Ot=1,Lt=0;var ve=this.B_re[1],me=this.B_im[1];for(l=2;l<=6;l++)Nt=Ot*pt-Lt*gt,ue=Lt*pt+Ot*gt,Ot=Nt,Lt=ue,ve=ve+l*(this.B_re[l]*Ot-this.B_im[l]*Lt),me=me+l*(this.B_im[l]*Ot+this.B_re[l]*Lt);var Ge=ve*ve+me*me;pt=(oe*ve+Ee*me)/Ge,gt=(Ee*ve-oe*me)/Ge}var Ne=pt,di=gt,Ri=1,Yi=0;for(l=1;l<=9;l++)Ri=Ri*Ne,Yi=Yi+this.D[l]*Ri;var Bi=this.lat0+Yi*ga*1e5,Vr=this.long0+di;return s.x=Vr,s.y=Bi,s}var Kx=["New_Zealand_Map_Grid","nzmg"],Sm={init:Zx,forward:Hx,inverse:Xx,names:Kx};H();function Yx(){}function Jx(s){var l=s.x,u=s.y,y=$t(l-this.long0),_=this.x0+this.a*y,a=this.y0+this.a*Math.log(Math.tan(Math.PI/4+u/2.5))*1.25;return s.x=_,s.y=a,s}function Qx(s){s.x-=this.x0,s.y-=this.y0;var l=$t(this.long0+s.x/this.a),u=2.5*(Math.atan(Math.exp(.8*s.y/this.a))-Math.PI/4);return s.x=l,s.y=u,s}var tv=["Miller_Cylindrical","mill"],Tm={init:Yx,forward:Jx,inverse:Qx,names:tv};H();var ev=20;function iv(){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=lc(this.es)}function rv(s){var l,u,y=s.x,_=s.y;if(y=$t(y-this.long0),this.sphere){if(!this.m)_=this.n!==1?Math.asin(this.n*Math.sin(_)):_;else for(var a=this.n*Math.sin(_),T=ev;T;--T){var E=(this.m*_+Math.sin(_)-a)/(this.m+Math.cos(_));if(_-=E,Math.abs(E)<qt)break}l=this.a*this.C_x*y*(this.m+Math.cos(_)),u=this.a*this.C_y*_}else{var B=Math.sin(_),$=Math.cos(_);u=this.a*xa(_,B,$,this.en),l=this.a*y*$/Math.sqrt(1-this.es*B*B)}return s.x=l,s.y=u,s}function nv(s){var l,u,y,_;return s.x-=this.x0,y=s.x/this.a,s.y-=this.y0,l=s.y/this.a,this.sphere?(l/=this.C_y,y=y/(this.C_x*(this.m+Math.cos(l))),this.m?l=Ur((this.m*l+Math.sin(l))/this.n):this.n!==1&&(l=Ur(Math.sin(l)/this.n)),y=$t(y+this.long0),l=wn(l)):(l=hc(s.y/this.a,this.es,this.en),_=Math.abs(l),_<Bt?(_=Math.sin(l),u=this.long0+s.x*Math.sqrt(1-this.es*_*_)/(this.a*Math.cos(l)),y=$t(u)):_-qt<Bt&&(y=this.long0)),s.x=y,s.y=l,s}var sv=["Sinusoidal","sinu"],Em={init:iv,forward:rv,inverse:nv,names:sv};H();function av(){}function ov(s){for(var l=s.x,u=s.y,y=$t(l-this.long0),_=u,a=Math.PI*Math.sin(u);;){var T=-(_+Math.sin(_)-a)/(1+Math.cos(_));if(_+=T,Math.abs(T)<qt)break}_/=2,Math.PI/2-Math.abs(u)<qt&&(y=0);var E=.900316316158*this.a*y*Math.cos(_)+this.x0,B=1.4142135623731*this.a*Math.sin(_)+this.y0;return s.x=E,s.y=B,s}function lv(s){var l,u;s.x-=this.x0,s.y-=this.y0,u=s.y/(1.4142135623731*this.a),Math.abs(u)>.999999999999&&(u=.999999999999),l=Math.asin(u);var y=$t(this.long0+s.x/(.900316316158*this.a*Math.cos(l)));y<-Math.PI&&(y=-Math.PI),y>Math.PI&&(y=Math.PI),u=(2*l+Math.sin(2*l))/Math.PI,Math.abs(u)>1&&(u=1);var _=Math.asin(u);return s.x=y,s.y=_,s}var hv=["Mollweide","moll"],Im={init:av,forward:ov,inverse:lv,names:hv};H();function cv(){Math.abs(this.lat1+this.lat2)<qt||(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=ns(this.es),this.e1=ss(this.es),this.e2=as(this.es),this.e3=os(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=dr(this.e,this.sinphi,this.cosphi),this.ml1=Ki(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<qt?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=dr(this.e,this.sinphi,this.cosphi),this.ml2=Ki(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=Ki(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function uv(s){var l=s.x,u=s.y,y;if(this.sphere)y=this.a*(this.g-u);else{var _=Ki(this.e0,this.e1,this.e2,this.e3,u);y=this.a*(this.g-_)}var a=this.ns*$t(l-this.long0),T=this.x0+y*Math.sin(a),E=this.y0+this.rh-y*Math.cos(a);return s.x=T,s.y=E,s}function pv(s){s.x-=this.x0,s.y=this.rh-s.y+this.y0;var l,u,y,_;this.ns>=0?(u=Math.sqrt(s.x*s.x+s.y*s.y),l=1):(u=-Math.sqrt(s.x*s.x+s.y*s.y),l=-1);var a=0;if(u!==0&&(a=Math.atan2(l*s.x,l*s.y)),this.sphere)return _=$t(this.long0+a/this.ns),y=wn(this.g-u/this.a),s.x=_,s.y=y,s;var T=this.g-u/this.a;return y=ba(T,this.e0,this.e1,this.e2,this.e3),_=$t(this.long0+a/this.ns),s.x=_,s.y=y,s}var dv=["Equidistant_Conic","eqdc"],Cm={init:cv,forward:uv,inverse:pv,names:dv};H();function fv(){this.R=this.a}function mv(s){var l=s.x,u=s.y,y=$t(l-this.long0),_,a;Math.abs(u)<=qt&&(_=this.x0+this.R*y,a=this.y0);var T=Ur(2*Math.abs(u/Math.PI));(Math.abs(y)<=qt||Math.abs(Math.abs(u)-Bt)<=qt)&&(_=this.x0,u>=0?a=this.y0+Math.PI*this.R*Math.tan(.5*T):a=this.y0+Math.PI*this.R*-Math.tan(.5*T));var E=.5*Math.abs(Math.PI/y-y/Math.PI),B=E*E,$=Math.sin(T),L=Math.cos(T),it=L/($+L-1),pt=it*it,gt=it*(2/$-1),_t=gt*gt,Ot=Math.PI*this.R*(E*(it-_t)+Math.sqrt(B*(it-_t)*(it-_t)-(_t+B)*(pt-_t)))/(_t+B);y<0&&(Ot=-Ot),_=this.x0+Ot;var Lt=B+it;return Ot=Math.PI*this.R*(gt*Lt-E*Math.sqrt((_t+B)*(B+1)-Lt*Lt))/(_t+B),u>=0?a=this.y0+Ot:a=this.y0-Ot,s.x=_,s.y=a,s}function gv(s){var l,u,y,_,a,T,E,B,$,L,it,pt,gt;return s.x-=this.x0,s.y-=this.y0,it=Math.PI*this.R,y=s.x/it,_=s.y/it,a=y*y+_*_,T=-Math.abs(_)*(1+a),E=T-2*_*_+y*y,B=-2*T+1+2*_*_+a*a,gt=_*_/B+(2*E*E*E/B/B/B-9*T*E/B/B)/27,$=(T-E*E/3/B)/B,L=2*Math.sqrt(-$/3),it=3*gt/$/L,Math.abs(it)>1&&(it>=0?it=1:it=-1),pt=Math.acos(it)/3,s.y>=0?u=(-L*Math.cos(pt+Math.PI/3)-E/3/B)*Math.PI:u=-(-L*Math.cos(pt+Math.PI/3)-E/3/B)*Math.PI,Math.abs(y)<qt?l=this.long0:l=$t(this.long0+Math.PI*(a-1+Math.sqrt(1+2*(y*y-_*_)+a*a))/2/y),s.x=l,s.y=u,s}var yv=["Van_der_Grinten_I","VanDerGrinten","vandg"],Am={init:fv,forward:mv,inverse:gv,names:yv};H();function _v(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function xv(s){var l=s.x,u=s.y,y=Math.sin(s.y),_=Math.cos(s.y),a=$t(l-this.long0),T,E,B,$,L,it,pt,gt,_t,Ot,Lt,Nt,ue,oe,Ee,ve,me,Ge,Ne,di,Ri,Yi,Bi;return this.sphere?Math.abs(this.sin_p12-1)<=qt?(s.x=this.x0+this.a*(Bt-u)*Math.sin(a),s.y=this.y0-this.a*(Bt-u)*Math.cos(a),s):Math.abs(this.sin_p12+1)<=qt?(s.x=this.x0+this.a*(Bt+u)*Math.sin(a),s.y=this.y0+this.a*(Bt+u)*Math.cos(a),s):(Ge=this.sin_p12*y+this.cos_p12*_*Math.cos(a),ve=Math.acos(Ge),me=ve?ve/Math.sin(ve):1,s.x=this.x0+this.a*me*_*Math.sin(a),s.y=this.y0+this.a*me*(this.cos_p12*y-this.sin_p12*_*Math.cos(a)),s):(T=ns(this.es),E=ss(this.es),B=as(this.es),$=os(this.es),Math.abs(this.sin_p12-1)<=qt?(L=this.a*Ki(T,E,B,$,Bt),it=this.a*Ki(T,E,B,$,u),s.x=this.x0+(L-it)*Math.sin(a),s.y=this.y0-(L-it)*Math.cos(a),s):Math.abs(this.sin_p12+1)<=qt?(L=this.a*Ki(T,E,B,$,Bt),it=this.a*Ki(T,E,B,$,u),s.x=this.x0+(L+it)*Math.sin(a),s.y=this.y0+(L+it)*Math.cos(a),s):(pt=y/_,gt=ls(this.a,this.e,this.sin_p12),_t=ls(this.a,this.e,y),Ot=Math.atan((1-this.es)*pt+this.es*gt*this.sin_p12/(_t*_)),Lt=Math.atan2(Math.sin(a),this.cos_p12*Math.tan(Ot)-this.sin_p12*Math.cos(a)),Lt===0?Ne=Math.asin(this.cos_p12*Math.sin(Ot)-this.sin_p12*Math.cos(Ot)):Math.abs(Math.abs(Lt)-Math.PI)<=qt?Ne=-Math.asin(this.cos_p12*Math.sin(Ot)-this.sin_p12*Math.cos(Ot)):Ne=Math.asin(Math.sin(a)*Math.cos(Ot)/Math.sin(Lt)),Nt=this.e*this.sin_p12/Math.sqrt(1-this.es),ue=this.e*this.cos_p12*Math.cos(Lt)/Math.sqrt(1-this.es),oe=Nt*ue,Ee=ue*ue,di=Ne*Ne,Ri=di*Ne,Yi=Ri*Ne,Bi=Yi*Ne,ve=gt*Ne*(1-di*Ee*(1-Ee)/6+Ri/8*oe*(1-2*Ee)+Yi/120*(Ee*(4-7*Ee)-3*Nt*Nt*(1-7*Ee))-Bi/48*oe),s.x=this.x0+ve*Math.sin(Lt),s.y=this.y0+ve*Math.cos(Lt),s))}function vv(s){s.x-=this.x0,s.y-=this.y0;var l,u,y,_,a,T,E,B,$,L,it,pt,gt,_t,Ot,Lt,Nt,ue,oe,Ee,ve,me,Ge,Ne;return this.sphere?(l=Math.sqrt(s.x*s.x+s.y*s.y),l>2*Bt*this.a?void 0:(u=l/this.a,y=Math.sin(u),_=Math.cos(u),a=this.long0,Math.abs(l)<=qt?T=this.lat0:(T=Ur(_*this.sin_p12+s.y*y*this.cos_p12/l),E=Math.abs(this.lat0)-Bt,Math.abs(E)<=qt?this.lat0>=0?a=$t(this.long0+Math.atan2(s.x,-s.y)):a=$t(this.long0-Math.atan2(-s.x,s.y)):a=$t(this.long0+Math.atan2(s.x*y,l*this.cos_p12*_-s.y*this.sin_p12*y))),s.x=a,s.y=T,s)):(B=ns(this.es),$=ss(this.es),L=as(this.es),it=os(this.es),Math.abs(this.sin_p12-1)<=qt?(pt=this.a*Ki(B,$,L,it,Bt),l=Math.sqrt(s.x*s.x+s.y*s.y),gt=pt-l,T=ba(gt/this.a,B,$,L,it),a=$t(this.long0+Math.atan2(s.x,-1*s.y)),s.x=a,s.y=T,s):Math.abs(this.sin_p12+1)<=qt?(pt=this.a*Ki(B,$,L,it,Bt),l=Math.sqrt(s.x*s.x+s.y*s.y),gt=l-pt,T=ba(gt/this.a,B,$,L,it),a=$t(this.long0+Math.atan2(s.x,s.y)),s.x=a,s.y=T,s):(l=Math.sqrt(s.x*s.x+s.y*s.y),Lt=Math.atan2(s.x,s.y),_t=ls(this.a,this.e,this.sin_p12),Nt=Math.cos(Lt),ue=this.e*this.cos_p12*Nt,oe=-ue*ue/(1-this.es),Ee=3*this.es*(1-oe)*this.sin_p12*this.cos_p12*Nt/(1-this.es),ve=l/_t,me=ve-oe*(1+oe)*Math.pow(ve,3)/6-Ee*(1+3*oe)*Math.pow(ve,4)/24,Ge=1-oe*me*me/2-ve*me*me*me/6,Ot=Math.asin(this.sin_p12*Math.cos(me)+this.cos_p12*Math.sin(me)*Nt),a=$t(this.long0+Math.asin(Math.sin(Lt)*Math.sin(me)/Math.cos(Ot))),Ne=Math.sin(Ot),T=Math.atan2((Ne-this.es*Ge*this.sin_p12)*Math.tan(Ot),Ne*(1-this.es)),s.x=a,s.y=T,s))}var bv=["Azimuthal_Equidistant","aeqd"],Pm={init:_v,forward:xv,inverse:vv,names:bv};H();function wv(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function Mv(s){var l,u,y,_,a,T,E,B,$=s.x,L=s.y;return y=$t($-this.long0),l=Math.sin(L),u=Math.cos(L),_=Math.cos(y),T=this.sin_p14*l+this.cos_p14*u*_,a=1,(T>0||Math.abs(T)<=qt)&&(E=this.a*a*u*Math.sin(y),B=this.y0+this.a*a*(this.cos_p14*l-this.sin_p14*u*_)),s.x=E,s.y=B,s}function Sv(s){var l,u,y,_,a,T,E;return s.x-=this.x0,s.y-=this.y0,l=Math.sqrt(s.x*s.x+s.y*s.y),u=Ur(l/this.a),y=Math.sin(u),_=Math.cos(u),T=this.long0,Math.abs(l)<=qt?(E=this.lat0,s.x=T,s.y=E,s):(E=Ur(_*this.sin_p14+s.y*y*this.cos_p14/l),a=Math.abs(this.lat0)-Bt,Math.abs(a)<=qt?(this.lat0>=0?T=$t(this.long0+Math.atan2(s.x,-s.y)):T=$t(this.long0-Math.atan2(-s.x,s.y)),s.x=T,s.y=E,s):(T=$t(this.long0+Math.atan2(s.x*y,l*this.cos_p14*_-s.y*this.sin_p14*y)),s.x=T,s.y=E,s))}var Tv=["ortho"],zm={init:wv,forward:Mv,inverse:Sv,names:Tv};H();var Ii={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},si={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Ev(){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-Ke/2?this.face=Ii.TOP:this.lat0<=-(Bt-Ke/2)?this.face=Ii.BOTTOM:Math.abs(this.long0)<=Ke?this.face=Ii.FRONT:Math.abs(this.long0)<=Bt+Ke?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 Iv(s){var l={x:0,y:0},u,y,_,a,T,E,B={value:0};if(s.x-=this.long0,this.es!==0?u=Math.atan(this.one_minus_f_squared*Math.tan(s.y)):u=s.y,y=s.x,this.face===Ii.TOP)a=Bt-u,y>=Ke&&y<=Bt+Ke?(B.value=si.AREA_0,_=y-Bt):y>Bt+Ke||y<=-(Bt+Ke)?(B.value=si.AREA_1,_=y>0?y-Ei:y+Ei):y>-(Bt+Ke)&&y<=-Ke?(B.value=si.AREA_2,_=y+Bt):(B.value=si.AREA_3,_=y);else if(this.face===Ii.BOTTOM)a=Bt+u,y>=Ke&&y<=Bt+Ke?(B.value=si.AREA_0,_=-y+Bt):y<Ke&&y>=-Ke?(B.value=si.AREA_1,_=-y):y<-Ke&&y>=-(Bt+Ke)?(B.value=si.AREA_2,_=-y-Bt):(B.value=si.AREA_3,_=y>0?-y+Ei:-y-Ei);else{var $,L,it,pt,gt,_t,Ot;this.face===Ii.RIGHT?y=bo(y,+Bt):this.face===Ii.BACK?y=bo(y,+Ei):this.face===Ii.LEFT&&(y=bo(y,-Bt)),pt=Math.sin(u),gt=Math.cos(u),_t=Math.sin(y),Ot=Math.cos(y),$=gt*Ot,L=gt*_t,it=pt,this.face===Ii.FRONT?(a=Math.acos($),_=fc(a,it,L,B)):this.face===Ii.RIGHT?(a=Math.acos(L),_=fc(a,it,-$,B)):this.face===Ii.BACK?(a=Math.acos(-$),_=fc(a,it,-L,B)):this.face===Ii.LEFT?(a=Math.acos(-L),_=fc(a,it,$,B)):(a=_=0,B.value=si.AREA_0)}return E=Math.atan(12/Ei*(_+Math.acos(Math.sin(_)*Math.cos(Ke))-Bt)),T=Math.sqrt((1-Math.cos(a))/(Math.cos(E)*Math.cos(E))/(1-Math.cos(Math.atan(1/Math.cos(_))))),B.value===si.AREA_1?E+=Bt:B.value===si.AREA_2?E+=Ei:B.value===si.AREA_3&&(E+=1.5*Ei),l.x=T*Math.cos(E),l.y=T*Math.sin(E),l.x=l.x*this.a+this.x0,l.y=l.y*this.a+this.y0,s.x=l.x,s.y=l.y,s}function Cv(s){var l={lam:0,phi:0},u,y,_,a,T,E,B,$,L,it={value:0};if(s.x=(s.x-this.x0)/this.a,s.y=(s.y-this.y0)/this.a,y=Math.atan(Math.sqrt(s.x*s.x+s.y*s.y)),u=Math.atan2(s.y,s.x),s.x>=0&&s.x>=Math.abs(s.y)?it.value=si.AREA_0:s.y>=0&&s.y>=Math.abs(s.x)?(it.value=si.AREA_1,u-=Bt):s.x<0&&-s.x>=Math.abs(s.y)?(it.value=si.AREA_2,u=u<0?u+Ei:u-Ei):(it.value=si.AREA_3,u+=Bt),L=Ei/12*Math.tan(u),T=Math.sin(L)/(Math.cos(L)-1/Math.sqrt(2)),E=Math.atan(T),_=Math.cos(u),a=Math.tan(y),B=1-_*_*a*a*(1-Math.cos(Math.atan(1/Math.cos(E)))),B<-1?B=-1:B>1&&(B=1),this.face===Ii.TOP)$=Math.acos(B),l.phi=Bt-$,it.value===si.AREA_0?l.lam=E+Bt:it.value===si.AREA_1?l.lam=E<0?E+Ei:E-Ei:it.value===si.AREA_2?l.lam=E-Bt:l.lam=E;else if(this.face===Ii.BOTTOM)$=Math.acos(B),l.phi=$-Bt,it.value===si.AREA_0?l.lam=-E+Bt:it.value===si.AREA_1?l.lam=-E:it.value===si.AREA_2?l.lam=-E-Bt:l.lam=E<0?-E-Ei:-E+Ei;else{var pt,gt,_t;pt=B,L=pt*pt,L>=1?_t=0:_t=Math.sqrt(1-L)*Math.sin(E),L+=_t*_t,L>=1?gt=0:gt=Math.sqrt(1-L),it.value===si.AREA_1?(L=gt,gt=-_t,_t=L):it.value===si.AREA_2?(gt=-gt,_t=-_t):it.value===si.AREA_3&&(L=gt,gt=_t,_t=-L),this.face===Ii.RIGHT?(L=pt,pt=-gt,gt=L):this.face===Ii.BACK?(pt=-pt,gt=-gt):this.face===Ii.LEFT&&(L=pt,pt=gt,gt=-L),l.phi=Math.acos(-_t)-Bt,l.lam=Math.atan2(gt,pt),this.face===Ii.RIGHT?l.lam=bo(l.lam,-Bt):this.face===Ii.BACK?l.lam=bo(l.lam,-Ei):this.face===Ii.LEFT&&(l.lam=bo(l.lam,+Bt))}if(this.es!==0){var Ot,Lt,Nt;Ot=l.phi<0?1:0,Lt=Math.tan(l.phi),Nt=this.b/Math.sqrt(Lt*Lt+this.one_minus_f_squared),l.phi=Math.atan(Math.sqrt(this.a*this.a-Nt*Nt)/(this.one_minus_f*Nt)),Ot&&(l.phi=-l.phi)}return l.lam+=this.long0,s.x=l.lam,s.y=l.phi,s}function fc(s,l,u,y){var _;return s<qt?(y.value=si.AREA_0,_=0):(_=Math.atan2(l,u),Math.abs(_)<=Ke?y.value=si.AREA_0:_>Ke&&_<=Bt+Ke?(y.value=si.AREA_1,_-=Bt):_>Bt+Ke||_<=-(Bt+Ke)?(y.value=si.AREA_2,_=_>=0?_-Ei:_+Ei):(y.value=si.AREA_3,_+=Bt)),_}function bo(s,l){var u=s+l;return u<-Ei?u+=Ll:u>+Ei&&(u-=Ll),u}var Av=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],km={init:Ev,forward:Iv,inverse:Cv,names:Av};H();var Qu=[[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]],Ol=[[-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]],Lm=.8487,Dm=1.3523,Rm=bn/5,Pv=1/Rm,wo=18,mc=function(s,l){return s[0]+l*(s[1]+l*(s[2]+l*s[3]))},zv=function(s,l){return s[1]+l*(2*s[2]+l*3*s[3])};function kv(s,l,u,y){for(var _=l;y;--y){var a=s(_);if(_-=a,Math.abs(a)<u)break}return _}function Lv(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function Dv(s){var l=$t(s.x-this.long0),u=Math.abs(s.y),y=Math.floor(u*Rm);y<0?y=0:y>=wo&&(y=wo-1),u=bn*(u-Pv*y);var _={x:mc(Qu[y],u)*l,y:mc(Ol[y],u)};return s.y<0&&(_.y=-_.y),_.x=_.x*this.a*Lm+this.x0,_.y=_.y*this.a*Dm+this.y0,_}function Rv(s){var l={x:(s.x-this.x0)/(this.a*Lm),y:Math.abs(s.y-this.y0)/(this.a*Dm)};if(l.y>=1)l.x/=Qu[wo][0],l.y=s.y<0?-Bt:Bt;else{var u=Math.floor(l.y*wo);for(u<0?u=0:u>=wo&&(u=wo-1);;)if(Ol[u][0]>l.y)--u;else if(Ol[u+1][0]<=l.y)++u;else break;var y=Ol[u],_=5*(l.y-y[0])/(Ol[u+1][0]-y[0]);_=kv(function(a){return(mc(y,a)-l.y)/zv(y,a)},_,qt,100),l.x/=mc(Qu[u],_),l.y=(5*u+_)*Ui,s.y<0&&(l.y=-l.y)}return l.x=$t(l.x+this.long0),l}var Bv=["Robinson","robin"],Bm={init:Lv,forward:Dv,inverse:Rv,names:Bv};H();function Fv(){this.name="geocent"}function Ov(s){var l=nc(s,this.es,this.a);return l}function Nv(s){var l=sc(s,this.es,this.a,this.b);return l}var Uv=["Geocentric","geocentric","geocent","Geocent"],Fm={init:Fv,forward:Ov,inverse:Nv,names:Uv};H();var fr={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},Nl={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 Vv(){if(Object.keys(Nl).forEach(function(u){if(typeof this[u]>"u")this[u]=Nl[u].def;else{if(Nl[u].num&&isNaN(this[u]))throw new Error("Invalid parameter value, must be numeric "+u+" = "+this[u]);Nl[u].num&&(this[u]=parseFloat(this[u]))}Nl[u].degrees&&(this[u]=this[u]*Ui)}.bind(this)),Math.abs(Math.abs(this.lat0)-Bt)<qt?this.mode=this.lat0<0?fr.S_POLE:fr.N_POLE:Math.abs(this.lat0)<qt?this.mode=fr.EQUIT:(this.mode=fr.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 s=this.tilt,l=this.azi;this.cg=Math.cos(l),this.sg=Math.sin(l),this.cw=Math.cos(s),this.sw=Math.sin(s)}function Gv(s){s.x-=this.long0;var l=Math.sin(s.y),u=Math.cos(s.y),y=Math.cos(s.x),_,a;switch(this.mode){case fr.OBLIQ:a=this.sinph0*l+this.cosph0*u*y;break;case fr.EQUIT:a=u*y;break;case fr.S_POLE:a=-l;break;case fr.N_POLE:a=l;break}switch(a=this.pn1/(this.p-a),_=a*u*Math.sin(s.x),this.mode){case fr.OBLIQ:a*=this.cosph0*l-this.sinph0*u*y;break;case fr.EQUIT:a*=l;break;case fr.N_POLE:a*=-(u*y);break;case fr.S_POLE:a*=u*y;break}var T,E;return T=a*this.cg+_*this.sg,E=1/(T*this.sw*this.h1+this.cw),_=(_*this.cg-a*this.sg)*this.cw*E,a=T*E,s.x=_*this.a,s.y=a*this.a,s}function qv(s){s.x/=this.a,s.y/=this.a;var l={x:s.x,y:s.y},u,y,_;_=1/(this.pn1-s.y*this.sw),u=this.pn1*s.x*_,y=this.pn1*s.y*this.cw*_,s.x=u*this.cg+y*this.sg,s.y=y*this.cg-u*this.sg;var a=va(s.x,s.y);if(Math.abs(a)<qt)l.x=0,l.y=s.y;else{var T,E;switch(E=1-a*a*this.pfact,E=(this.p-Math.sqrt(E))/(this.pn1/a+a/this.pn1),T=Math.sqrt(1-E*E),this.mode){case fr.OBLIQ:l.y=Math.asin(T*this.sinph0+s.y*E*this.cosph0/a),s.y=(T-this.sinph0*Math.sin(l.y))*a,s.x*=E*this.cosph0;break;case fr.EQUIT:l.y=Math.asin(s.y*E/a),s.y=T*a,s.x*=E;break;case fr.N_POLE:l.y=Math.asin(T),s.y=-s.y;break;case fr.S_POLE:l.y=-Math.asin(T);break}l.x=Math.atan2(s.x,s.y)}return s.x=l.x+this.long0,s.y=l.y,s}var jv=["Tilted_Perspective","tpers"],Om={init:Vv,forward:Gv,inverse:qv,names:jv};function Nm(s){s.Proj.projections.add(im),s.Proj.projections.add(vo),s.Proj.projections.add(lm),s.Proj.projections.add(hm),s.Proj.projections.add(cm),s.Proj.projections.add(um),s.Proj.projections.add(pm),s.Proj.projections.add(dm),s.Proj.projections.add(fm),s.Proj.projections.add(mm),s.Proj.projections.add(gm),s.Proj.projections.add(ym),s.Proj.projections.add(_m),s.Proj.projections.add(vm),s.Proj.projections.add(bm),s.Proj.projections.add(Mm),s.Proj.projections.add(Sm),s.Proj.projections.add(Tm),s.Proj.projections.add(Em),s.Proj.projections.add(Im),s.Proj.projections.add(Cm),s.Proj.projections.add(Am),s.Proj.projections.add(Pm),s.Proj.projections.add(zm),s.Proj.projections.add(km),s.Proj.projections.add(Bm),s.Proj.projections.add(Fm),s.Proj.projections.add(Om)}Yr.defaultDatum="WGS84";Yr.Proj=Fs;Yr.WGS84=new Yr.Proj("WGS84");Yr.Point=Jf;Yr.toPoint=oc;Yr.defs=go;Yr.transform=_a;Yr.mgrs=Xf;Yr.version="__VERSION__";Nm(Yr);var Mo=Yr;H();H();H();var mr;(function(s){s[s.UInt8=1]="UInt8",s[s.UInt16=2]="UInt16",s[s.UInt32=4]="UInt32",s[s.UInt64=8]="UInt64",s[s.Double=8]="Double",s[s.Float=4]="Float"})(mr||(mr={}));H();var Um=2**32,$v=typeof setImmediate>"u"?setTimeout:setImmediate,Ar=()=>{throw new Error("Method not implemented.")},Pn=class{constructor(){this.isLittleEndian=!0,this.delayMs=Pn.DefaultDelayMs,this.maxChunkCount=10,this.chunks=Pn.DefaultChunkCache(),this.blankFillCount=16,this.maxConcurrentRequests=50,this.toFetch=new Set,this.toFetchPromise=null,this.byteOffset=0,this.getFloat32=Ar,this.getFloat64=Ar,this.getInt8=Ar,this.getInt16=Ar,this.getInt32=Ar,this.setFloat32=Ar,this.setFloat64=Ar,this.setInt8=Ar,this.setInt16=Ar,this.setInt32=Ar,this.setUint8=Ar,this.setUint16=Ar,this.setUint32=Ar,this.setBigInt64=Ar,this.setBigUint64=Ar}static getByteRanges(l,u=32,y=16){if(l.size===0)return{chunks:[],blankFill:[]};let _=[...l.values()].sort((B,$)=>B-$),a=[],T=[];a.push(T);let E=[];for(let B=0;B<_.length;++B){let $=_[B],L=_[B-1];if(T.length>=u)T=[$],a.push(T);else if(B===0||$===L+1)T.push($);else if($<L+y){for(let it=L;it<$;it++)T.push(it+1),E.push(it+1);E.pop()}else T=[$],a.push(T)}return{chunks:a,blankFill:E}}async fetchData(){if(this.toFetch.size===0)return;let l=this.toFetch;this.toFetch=new Set,this.toFetchPromise=null;let u=Pn.getByteRanges(l,this.maxChunkCount,this.blankFillCount),y=[];for(let _ of u.chunks){let a=_[0],T=_[_.length-1],E=a*this.chunkSize,B=T*this.chunkSize+this.chunkSize-E,$=await this.fetchBytes(E,B);if(_.length===1){y[a]=$,this.chunks.set(a,new DataView($));continue}let L=a*this.chunkSize;for(let it of _){let pt=it*this.chunkSize-L,gt=$.slice(pt,pt+this.chunkSize);y[it]=gt,this.chunks.set(it,new DataView(gt))}}}async loadBytes(l,u){if(l<0)throw new Error("Offset must be positive");let y=Math.floor(l/this.chunkSize),_=Math.ceil((l+u)/this.chunkSize)-1;for(let a=y;a<=_;a++)this.chunks.has(a)||this.toFetch.add(a);if(this.toFetch.size!==0){if(this.toFetchPromise==null&&(this.toFetchPromise=new Promise(a=>$v(a,this.delayMs)).then(()=>this.fetchData())),this.toFetch.size>this.maxConcurrentRequests)throw new Error("Too many outstanding requests");await this.toFetchPromise}}getChunkId(l){return Math.floor(l/this.chunkSize)}getUint(l,u){switch(u){case mr.UInt8:return this.getUint8(l);case mr.UInt16:return this.getUint16(l);case mr.UInt32:return this.getUint32(l);case mr.UInt64:return this.getUint64(l)}}bytes(l,u){let y=this.isOneChunk(l,u);if(y){let $=this.getView(y),L=l-y*this.chunkSize;return new Uint8Array($.buffer.slice(L,L+u))}let _=new Uint8Array(u),a=l+u,T=Math.floor(l/this.chunkSize),E=Math.ceil((l+u)/this.chunkSize)-1,B=0;for(let $=T;$<=E;$++){let L=l+B,it=$*this.chunkSize,pt=this.getView($),gt=Math.min(a,it+this.chunkSize),_t=pt.buffer.slice(L-it,gt-it);_.set(new Uint8Array(_t),B),B+=_t.byteLength}return _}getView(l){let u=this.chunks.get(l);if(u==null)throw new Error(`Chunk:${l} is not ready`);return u}isOneChunk(l,u){let y=l+u-1,_=Math.floor(l/this.chunkSize);return Math.floor(y/this.chunkSize)-_<1?_:null}hasBytes(l,u=1){let y=Math.floor(l/this.chunkSize),_=Math.ceil((l+u)/this.chunkSize)-1;for(let a=y;a<=_;a++)if(!this.chunks.has(a))return!1;return!0}toRange(l,u){if(u==null)return`bytes=${l}`;if(l<0)throw new Error("Cannot read from remote source with negative offset and length");return`bytes=${l}-${l+u}`}parseContentRange(l){let[u,y]=l.split(" ");if(u!=="bytes")throw new Error("Failed to parse content-range: "+l);if(y==null)throw new Error("Failed to parse content-range: "+l);let[,_]=y.split("/"),a=Number(_);if(isNaN(a))throw new Error("Failed to parse content-range: "+l);return a}get buffer(){throw new Error("Method not implemented.")}get byteLength(){if(this._byteLength)return this._byteLength;throw Error(".size() has not been fetched.")}getUint8(l){let u=Math.floor(l/this.chunkSize),y=this.chunks.get(u);if(y==null)throw new Error(`Chunk:${u} is not ready`);return y.getUint8(l-u*this.chunkSize)}getUint16(l){let u=this.isOneChunk(l,mr.UInt16);if(u!=null)return this.getView(u).getUint16(l-u*this.chunkSize,this.isLittleEndian);let y=this.getUint8(l),_=this.getUint8(l+mr.UInt8);return this.isLittleEndian?y+(_<<8):(y<<8)+_}getUint32(l){let u=this.isOneChunk(l,mr.UInt32);if(u!=null)return this.getView(u).getUint32(l-u*this.chunkSize,this.isLittleEndian);let y=this.getUint16(l),_=this.getUint16(l+mr.UInt16);return this.isLittleEndian?y+_*65536:y*65536+_}getUint64(l){let u=this.isOneChunk(l,mr.UInt64);if(u!=null){let a=this.getView(u);return Number(a.getBigUint64(l-u*this.chunkSize,this.isLittleEndian))}let y=this.getUint32(l),_=this.getUint32(l+mr.UInt32);return this.isLittleEndian?y+_*Um:y*Um+_}getBigUint64(l){let u=this.isOneChunk(l,mr.UInt64);if(u!=null)return this.getView(u).getBigUint64(l-u*this.chunkSize,this.isLittleEndian);let y=BigInt(this.getUint32(l)),_=BigInt(this.getUint32(l+mr.UInt32));return this.isLittleEndian?y+(_<<BigInt(32)):(y<<BigInt(32))+_}getBigInt64(){throw new Error("Not implemented.")}};Pn.DefaultChunkCache=()=>new Map;Pn.DefaultDelayMs=1;H();H();var So=class extends Error{constructor(l,u,y){super(l),this.name="CompositeError",this.code=u,this.reason=y}static isCompositeError(l){return typeof l!="object"||l==null?!1:l.name==="CompositeError"}};H();var Vm=`PROJCS["NZGD2000 / Chatham Islands TM 2000",
509
+ GEOGCS["NZGD2000",
510
+ DATUM["New_Zealand_Geodetic_Datum_2000",
511
+ SPHEROID["GRS 1980",6378137,298.257222101,
512
+ AUTHORITY["EPSG","7019"]],
513
+ TOWGS84[0,0,0,0,0,0,0],
514
+ AUTHORITY["EPSG","6167"]],
515
+ PRIMEM["Greenwich",0,
516
+ AUTHORITY["EPSG","8901"]],
517
+ UNIT["degree",0.01745329251994328,
518
+ AUTHORITY["EPSG","9122"]],
519
+ AUTHORITY["EPSG","4167"]],
520
+ UNIT["metre",1,
521
+ AUTHORITY["EPSG","9001"]],
522
+ PROJECTION["Transverse_Mercator"],
523
+ PARAMETER["latitude_of_origin",0],
524
+ PARAMETER["central_meridian",-176.5],
525
+ PARAMETER["scale_factor",1],
526
+ PARAMETER["false_easting",3500000],
527
+ PARAMETER["false_northing",10000000],
528
+ AUTHORITY["EPSG","3793"],
529
+ AXIS["Easting",EAST],
530
+ AXIS["Northing",NORTH]]`;H();var Gm=`PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
531
+ GEOGCS["NZGD2000",
532
+ DATUM["New_Zealand_Geodetic_Datum_2000",
533
+ SPHEROID["GRS 1980",6378137,298.257222101,
534
+ AUTHORITY["EPSG","7019"]],
535
+ TOWGS84[0,0,0,0,0,0,0],
536
+ AUTHORITY["EPSG","6167"]],
537
+ PRIMEM["Greenwich",0,
538
+ AUTHORITY["EPSG","8901"]],
539
+ UNIT["degree",0.0174532925199433,
540
+ AUTHORITY["EPSG","9122"]],
541
+ AUTHORITY["EPSG","4167"]],
542
+ PROJECTION["Transverse_Mercator"],
543
+ PARAMETER["latitude_of_origin",0],
544
+ PARAMETER["central_meridian",173],
545
+ PARAMETER["scale_factor",0.9996],
546
+ PARAMETER["false_easting",1600000],
547
+ PARAMETER["false_northing",10000000],
548
+ UNIT["metre",1,
549
+ AUTHORITY["EPSG","9001"]],
550
+ AUTHORITY["EPSG","2193"]]`;Mo.defs(Ve.Nztm2000.toEpsgString(),Gm);Mo.defs(Ve.Citm2000.toEpsgString(),Vm);var tp=new Map;function Wv(s){return s==null?null:typeof s=="number"?s:"code"in s?s.code:"projection"in s?s.projection.code:null}var Os=class{constructor(l){this.epsg=l;try{this.projection=Mo(l.toEpsgString(),Ve.Wgs84.toEpsgString())}catch(u){throw new So(`Failed to create projection: ${l.toEpsgString()}, ${Ve.Wgs84.toEpsgString()}`,500,u)}}static define(l,u){if(tp.get(l.code)!=null)throw new Error("Duplicate projection definition: "+l.toEpsgString());Mo.defs(l.toEpsgString(),u)}static get(l){let u=this.tryGet(l);if(u==null)throw new Error(`Invalid projection: ${l}`);return u}static tryGet(l){let u=Wv(l);if(u==null)return null;let y=tp.get(u);if(y!=null)return y;let _=Ve.tryGet(u);return _==null||Mo.defs(_.toEpsgString())==null?null:(y=new Os(_),tp.set(u,y),y)}projectMultipolygon(l,u){if(u.epsg.code===this.epsg.code)return l;let{toWgs84:y}=this,{fromWgs84:_}=u;return l.map(a=>a.map(T=>T.map(E=>_(y(E)))))}get toWgs84(){return this.projection.forward}get fromWgs84(){return this.projection.inverse}boundsToWgs84BoundingBox(l){let u=this.toWgs84([l.x,l.y]),y=this.toWgs84([l.x+l.width,l.y+l.height]);return[u[0],u[1],y[0],y[1]]}boundsToGeoJsonFeature(l,u={}){let y=[l.x,l.y],_=[l.x+l.width,l.y],a=[l.x,l.y+l.height],T=[l.x+l.width,l.y+l.height],E=uf([[[y,a,T,_,y]]],this.toWgs84),B=E.length===1?pf(E[0],u):df(E,u);return B.bbox=this.boundsToWgs84BoundingBox(l),B}toGeoJson(l){return{type:"FeatureCollection",features:l.map(u=>this.boundsToGeoJsonFeature(u,{name:u.name}))}}static getTiffResZoom(l,u,y=1){let _=0;for(;_<l.zooms.length;++_)if(l.pixelScale(_)<=u*y)return _;if(_===l.zooms.length)return _-1;throw new Error("ResZoom not found")}static tileToWgs84Bbox(l,u){let y=l.tileToSource(u),_=l.tileToSource({x:u.x+1,y:u.y+1,z:u.z}),a=this.get(l),[T,E]=a.toWgs84([y.x,_.y]),[B,$]=a.toWgs84([_.x,y.y]);return[T,E,B,$]}static tileCenterToLatLon(l,u){let y=l.tileToSource({x:u.x+.5,y:u.y+.5,z:u.z}),[_,a]=this.get(l).toWgs84([y.x,y.y]);return Os.wrapLatLon(a,_)}static wrapLatLon(l,u){let y={lat:l,lon:u},_=Math.floor(Math.abs(l)/90)%4,a=l>0?90:-90,T=l%90;switch(_){case 0:y.lat=T;break;case 1:y.lat=a-T,y.lon+=180;break;case 2:y.lat=-T,y.lon+=180;break;case 3:y.lat=-a+T;break}return(y.lon>180||y.lon<-180)&&(y.lon-=Math.floor((y.lon+180)/360)*360),y}static findAlignmentLevels(l,u,y){return Math.max(0,this.getTiffResZoom(l,y,2)-u.z)}static getImagePixelWidth(l,u,y){let _=l.tileToSource(u),a=l.tileToSource({x:u.x+1,y:u.y+1,z:u.z});return Math.round((a.x-_.x)/l.pixelScale(y))*2}};H();var Di={ImageFormat:"png",toHash(s){return`#@${s.lat.toFixed(7)},${s.lon.toFixed(7)},z${s.zoom}`},parseZoom(s){return s==null||s===""?NaN:s.startsWith("z")?parseFloat(s.slice(1)):s.endsWith("z")?parseFloat(s):NaN},fromHash(s){let l={},u=s.replace("#@",""),[y,_,a]=u.split(","),T=parseFloat(y),E=parseFloat(_);!isNaN(T)&&!isNaN(E)&&(l.lat=T,l.lon=E);let B=Di.parseZoom(a);return isNaN(B)||(l.zoom=B),l},baseUrl(){let s=zt.BaseUrl;if(s==="")return window.location.origin;if(!s.startsWith("http"))throw new Error("BaseURL must start with http(s)://");return s},toBaseWmts(){let s=zt.ApiKey==null||zt.ApiKey===""?"":`?api=${zt.ApiKey}`;return`${this.baseUrl()}/v1/tiles/aerial/WMTSCapabilities.xml${s}`},toImageryUrl(s,l){return`${this.baseUrl()}/v1/imagery/${s}/${l}`},toTileUrl(s,l,u,y){let _=zt.ApiKey==null||zt.ApiKey===""?"":`?api=${zt.ApiKey}`,a=`${this.baseUrl()}/v1/tiles/${u}/${l.identifier}`;if(s==="raster")return`${a}/{z}/{x}/{y}.${Di.ImageFormat}${_}`;if(s==="vector-xyz")return`${a}/{z}/{x}/{y}.pbf${_}`;if(s==="style")return`${a}/style/${y}.json${_}`;if(s==="wmts")return`${a}/WMTSCapabilities.xml${_}`;if(s==="attribution")return`${a}/attribution.json${_}`;if(s==="tile-wmts")return`${a}/{TileMatrix}/{TileCol}/{TileRow}.${Di.ImageFormat}${_}`;throw new Error("Unknown url type: "+s)}};var Ul=class{constructor(l,u=0){this.tileMatrix=l,this.extraZoomLevels=u}getStyle(l,u){return l==="topographic"?Di.toTileUrl("style",this.tileMatrix,l,u):{version:8,sources:{basemaps:{type:"raster",tiles:[Di.toTileUrl("raster",this.tileMatrix,l)],tileSize:256}},layers:[{id:"LINZ Raster Basemaps",type:"raster",source:"basemaps"}]}}},Zv=new Ul(Qn,2),Hv=new Ul(Cn),jm=new Ul(ii),Xv=[Zv,Hv,jm];function To(s){for(let l of Xv)if(s===l.tileMatrix.identifier)return l;return jm}function qm(s){return s.identifier===ii.identifier}function zn(s,l,u){if(l.identifier===u.identifier)return s;if(!qm(l)&&!qm(u))throw new Error("Either tileMatrix or targetTileMatrix must be GoogleTms");let y=Os.get(l).fromWgs84([s.lon,s.lat]),_=l.sourceToPixels(y[0],y[1],Math.round(s.zoom)),a={x:_.x/l.tileSize,y:_.y/l.tileSize,z:Math.round(s.zoom)},T=u.tileToSource(a),E=Os.get(u).toWgs84([T.x,T.y]);return{lon:Math.round(E[0]*1e8)/1e8,lat:Math.round(E[1]*1e8)/1e8,zoom:s.zoom}}function $m(s,l){for(let u of s.features){if(u.geometry.type!=="Polygon")throw new Error("Only polygons supported");for(let y of u.geometry.coordinates)for(let _ of y){let a=zn({lat:_[1],lon:_[0],zoom:l.maxZoom},l,ii);_[0]=a.lon,_[1]=a.lat}}}var Wm={[ii.identifier]:{lat:-41.88999621,lon:174.04924373,zoom:5},[Qn.identifier]:{lat:-41.277848,lon:174.6763921,zoom:3},[Cn.identifier]:{lat:-41.88999621,lon:174.04924373,zoom:3}},Jr=class extends Zm.Emitter{constructor(){super(...arguments);this.style=null;this.layerId="aerial";this.tileMatrix=ii;this.debug={...fo}}get layers(){return this._layers==null&&(this._layers=Kv()),this._layers}get isDebug(){return this.debug.debug}get location(){return this._location==null&&(window.addEventListener("popstate",()=>{let u={...Wm[this.tileMatrix.identifier],...Di.fromHash(window.location.hash)};this.setLocation(u)}),this.updateFromUrl(),this._location={...Wm[this.tileMatrix.identifier],...Di.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(u=window.location.search){let y=new URLSearchParams(u),_=y.get("s")??y.get("style"),a=y.get("i")??"aerial",T=(y.get("p")??ii.identifier).toLowerCase(),E=da.All.find(L=>L.identifier.toLowerCase()===T);E==null&&(E=da.get(Ve.parse(T)??Ve.Google)),E.identifier===Qn.identifier&&(E=Cn),Pl.fromUrl(this.debug,y)&&this.emit("change");let $=Jr.toUrl(this);this.style=_??null,this.layerId=a.startsWith("im_")?a.slice(3):a,this.tileMatrix=E,this.layerId==="topographic"&&this.style==null&&(this.style="topographic"),this.emit("tileMatrix",this.tileMatrix),this.emit("layer",this.layerId,this.style),$!==Jr.toUrl(this)&&this.emit("change")}static toUrl(u){let y=new URLSearchParams;return u.style&&y.append("s",u.style),u.layerId!=="aerial"&&y.append("i",u.layerId),u.tileMatrix.identifier!==ii.identifier&&y.append("p",u.tileMatrix.identifier),Pl.toUrl(u.debug,y),y.toString()}toTileUrl(u,y=this.tileMatrix,_=this.layerId,a=this.style){return Di.toTileUrl(u,y,_,a)}getLocation(u){let y=u.getCenter();if(y==null)throw new Error("Invalid Map location");let _=Math.floor((u.getZoom()??0)*1e4)/1e4;return zt.map.transformLocation(y.lat,y.lng,_)}transformLocation(u,y,_){return zn({lat:u,lon:y,zoom:_},ii,this.tileMatrix)}setLocation(u){u.lat===this.location.lat&&u.lon===this.location.lon&&u.zoom===this.location.zoom||(this.location.lat=u.lat,this.location.lon=u.lon,this.location.zoom=u.zoom,this.emit("location",this.location),this.emit("change"))}setTileMatrix(u){this.tileMatrix.identifier!==u.identifier&&(this.emit("tileMatrix",this.tileMatrix),this.emit("change"))}setLayerId(u,y){this.layerId===u&&this.style===y||(this.layerId=u,this.style=y??null,this.emit("layer",this.layerId,this.style),this.emit("change"))}setDebug(u,y=fo[u]){this.debug[u]!==y&&(this.debug[u]=y,this.emit("change"))}};async function Kv(){let s=new Map,l=await fetch(Di.toBaseWmts());if(!l.ok)return s;let _=new DOMParser().parseFromString(await l.text(),"text/xml").getElementsByTagName("Layer"),a=[];for(let T=0;T<_.length;T++){let E=_.item(T);if(E==null)continue;let B=E.getElementsByTagName("ows:Title").item(0)?.textContent,$=E.getElementsByTagName("ows:Identifier").item(0)?.textContent;if(B==null||$==null||B==="aerial")continue;let L=E.getElementsByTagName("ows:Keyword").item(0)?.textContent,it=E.getElementsByTagName("ows:WGS84BoundingBox").item(0),pt=it?.getElementsByTagName("ows:UpperCorner").item(0)?.textContent?.split(" ").map(Number),gt=it?.getElementsByTagName("ows:LowerCorner").item(0)?.textContent?.split(" ").map(Number),_t=E.getElementsByTagName("TileMatrixSet"),Ot=new Set;for(let Lt=0;Lt<_t.length;Lt++){let Nt=Jv(_t.item(Lt)?.textContent??"");Nt!=null&&Ot.add(Nt.code)}pt==null||gt==null||pt.length!==2||a.push({id:$,name:B.replace("aerial ",""),upperLeft:pt,lowerRight:gt,projections:Ot,category:L})}a.sort((T,E)=>T.name.localeCompare(E.name)),Yv(s);for(let T of a)s.set(T.id,T);return s}function Yv(s){s.set("aerial",{id:"aerial",name:"Aerial Imagery",projections:new Set([We.Nztm2000,We.Google]),category:"Basemaps"}),s.set("topographic::topographic",{id:"topographic::topographic",name:"Topographic",projections:new Set([We.Google]),category:"Basemaps"})}function Jv(s){if(s.toLowerCase().startsWith("epsg"))return Ve.parse(s);let l=da.find(s);return l==null?null:l.projection}var Qv=Kd(),zt={get BaseUrl(){return""},get ApiKey(){return Qv},get GoogleAnalytics(){return"UA-23232486-3"},get Version(){return"v6.30.0"},map:new Jr};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 s=document.createElement("script");s.setAttribute("async",""),s.setAttribute("src",`https://www.googletagmanager.com/gtag/js?id=${zt.GoogleAnalytics}`),document.head.appendChild(s)}function wa(s,l,u){zt.GoogleAnalytics!==""&&window.gtag("event",l,{event_category:s,value:u})}H();Xr();var Vl=class extends Ti{render(l){return K("i",{class:"material-icons-round md-36"},l.name)}},kn=class extends Ti{render(l){return K("a",{rel:"noopener",target:"_blank",href:l.href,style:"display:flex;","aria-label":l.ariaLabel},l.children,l.icon?K(Vl,{name:l.icon}):void 0)}};var gc=class extends Ti{constructor(){super(...arguments);this._events=[]}componentWillMount(){this._events.push(zt.map.on("change",()=>this.setState(this.state)))}componentWillUnmount(){for(let u of this._events)u();this._events=[]}render(){if(!zt.map.isDebug)return K("footer",{class:"lui-footer lui-footer-small lui-hide-sm lui-hide-xs",role:"contentinfo"},K("div",{class:"lui-footer-columns"},K("div",{style:"display:flex; align-items:center"},K(kn,{href:"http://www.govt.nz/",ariaLabel:"New Zealand Government"},K("img",{src:"/assets/logo-nz-govt.svg"}))),K("div",{class:"justify-end"},K("ul",{class:"lui-footer-list"},K("li",{class:"lui-footer-inline-list-item"},"\xA9 2021 Land Information New Zealand"),K("li",{class:"lui-footer-inline-list-item"},K(kn,{href:"https://www.linz.govt.nz/contact-us"},"Contact")),K("li",{class:"lui-footer-inline-list-item"},K(kn,{href:"https://www.linz.govt.nz/privacy"},"Privacy")),K("li",{class:"lui-footer-inline-list-item"},K(kn,{href:"https://www.linz.govt.nz/data/linz-data/linz-basemaps/data-attribution"},"Data Attribution"))))))}};H();H();function Hm(s){var l,u,y="";if(typeof s=="string"||typeof s=="number")y+=s;else if(typeof s=="object")if(Array.isArray(s))for(l=0;l<s.length;l++)s[l]&&(u=Hm(s[l]))&&(y&&(y+=" "),y+=u);else for(l in s)s[l]&&(y&&(y+=" "),y+=l);return y}function yc(){for(var s=0,l,u,y="";s<arguments.length;)(l=arguments[s++])&&(u=Hm(l))&&(y&&(y+=" "),y+=u);return y}Xr();H();Xr();Xr();H();Xr();var hs=class extends Ti{constructor(){super(...arguments);this._copyTimeout=null;this.copy=()=>{wa("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 K("div",{class:"LuiDeprecatedForms"},K("label",null,this.props.header),K("div",{class:yc({"lui-menu-label":!0,"menu-copyable":!0,"menu-copyable-copied":this.state.copied})},K("button",{class:"menu-copyable-icon-button",title:"Copy",onClick:this.copy},K("i",{class:"material-icons-round"},this.state.copied?"check":"content_copy")),K("input",{value:this.props.value,readonly:!0})))}};H();Xr();var _c=class extends Ti{constructor(){super(...arguments);this._events=[];this.onChange=u=>{let y=u.target,[_,a]=y.value.split("::");zt.map.setLayerId(_,a),wa("Ui","layer:"+y.value),zt.map.layers.then(T=>{let E=T.get(_);E!=null&&zt.map.emit("bounds",[E.upperLeft,E.lowerRight])}),window.history.pushState(null,"",`?${Jr.toUrl(zt.map)}`)}}componentWillMount(){this.setState({...this.state,currentLayer:zt.map.layerKey}),zt.map.layers.then(u=>this.setState({...this.state,layers:u})),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 u of this._events)u();this._events=[]}render(){return K("div",{class:"LuiDeprecatedForms"},K("h6",null,"Layers"),K("select",{onChange:this.onChange,value:this.state.currentLayer},this.renderAerialLayers()))}renderAerialLayers(){if(this.state.layers==null||this.state.layers.size===0)return;let u=new Map;for(let _ of this.state.layers.values()){if(!_.projections.has(zt.map.tileMatrix.projection.code))continue;let a=u.get(_.category??"Unknown")??[];a.push(K("option",{value:_.id},_.name.replace(` ${_.category}`,""))),u.set(_.category??"Unknown",a)}if(u.size===0)return;let y=[];for(let[_,a]of u.entries())a.length!==0&&y.push(K("optgroup",{label:_},...a));return K(yt,null,y)}};var xc=class extends Ti{constructor(){super(...arguments);this._events=[];this.menuToggle=()=>{let u=!this.state.isMenuOpen;wa("Ui",u?"menu:open":"menu:close"),this.setState({...this.state,isMenuOpen:u})};this.contactUs=()=>{let u="Request Basemaps Developer Access",y=`
551
+ Give us a few key details to sign up for Developer Access to LINZ Basemaps. We will respond with your Apps' unique API key.
552
+
553
+ Your Name:
554
+
555
+ Your Email:
556
+
557
+ Your Service/App URL:
558
+
559
+ `;wa("Ui","contact-us:click"),window.location.href=`mailto:basemaps@linz.govt.nz?subject=${encodeURI(u)}&body=${encodeURI(y)}`};this._validProjections=new Set([We.Google,We.Nztm2000])}componentWillMount(){this.setState({isMenuOpen:!1}),this._events.push(zt.map.on("change",()=>this.setState(this.state))),zt.map.layers.then(u=>this.setState({...this.state,layers:u}))}componentWillUnmount(){for(let u of this._events)u();this._events=[]}render(){if(!zt.map.isDebug)return K("header",{class:"lui-header"},K("div",{class:"lui-header-row"},K("div",{class:"lui-header-col"},K("div",{class:"lui-header-logo"},K("img",{class:"linz-logo",src:"/assets/logo-linz.svg"})),K("div",{class:"lui-header-title"},K("h1",null,"Basemaps"))),K("div",{class:"lui-header-col"},K("div",{class:"lui-header-menu-item"},K("div",{class:"lui-header-menu-icon"},K("i",{class:"material-icons-round md-36",onClick:this.menuToggle,style:{cursor:"pointer"}},this.state.isMenuOpen?"close":"menu"))))),K("div",{class:yc({"lui-menu-drawer":!0,"lui-menu-drawer-closed":!this.state.isMenuOpen,"lui-menu-drawer-wide":!0}),"aria-hidden":this.state.isMenuOpen},K(_c,null),this.renderLinks(),K("h6",null,"Developer API Keys"),K("p",null,"Contact us for free API keys with better support for public web and mobile apps."),K("button",{class:"lui-button lui-button-tertiary contact-us",onClick:this.contactUs},"Contact us"),this.renderAbout()))}renderAboutLi(u,y,_){return K("li",null,K(kn,{href:y},u,_??K(Vl,{name:"launch"})))}renderAbout(){return K(yt,null,K("h6",null,"About Basemaps"),K("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()),K("li",null,K(kn,{href:"https://github.com/linz/basemaps/blob/master/CHANGELOG.md"},"Version ",K("span",{class:"basemaps-version"},zt.Version)))))}renderGithubLogo(){return K("svg",{style:"width: 24px; height: 24px",viewBox:"0 0 24 24"},K("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 K(yt,null,K("h6",null,"90 day API keys"),K("p",null,"API keys expire after 90 days, if a longer duration is needed please request a developer API key"),K(hs,{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 K(yt,null,K(hs,{header:"StyleJSON",value:zt.map.toTileUrl("style")}),K(hs,{header:"XYZ",value:zt.map.toTileUrl("vector-xyz")}));let u=this.validProjections(),y=[];if(u.has(We.Nztm2000)){let _=zt.map.toTileUrl("wmts",Cn);y.push(K(hs,{header:"WMTS: NZTM2000Quad",value:_}))}if(u.has(We.Google)){let _=zt.map.toTileUrl("wmts",ii),a=zt.map.toTileUrl("raster",ii);y.push(K(hs,{header:"WMTS: WebMercatorQuad",value:_})),y.push(K(hs,{header:"XYZ",value:a}))}return K(yt,null,y)}};H();var Eo=ua(vc(),1);Xr();H();H();H();function Ym(s){let l=document.createElement("span");return l.textContent=s,l.innerHTML}var np=class{constructor(l){this.boundaries=[],this.collection=l;let u=l.summaries["linz:zoom"];this.minZoom=u.min,this.maxZoom=u.max,this.bbox=l.extent.spatial.bbox[0]}intersects(l,u){return u>this.maxZoom||u<this.minZoom||!Bs.intersects(l,this.bbox)?!1:this.intersection(Bs.bboxToMultiPolygon(l))}intersection(l){for(let u of this.boundaries)if(Gu(u,l).length>0)return!0;return!1}addBoundary(l){t1(l),this.boundaries.push(l)}};function t1(s){for(let l of s)for(let u of l)if(u.length!==2)throw new Error("Invalid ring wrong length")}function e1(s){var l;let u=new Map,y=[];for(let _ of s.collections){let a=new np(_);y.push(a),u.set(_.id,a)}for(let _ of s.features){let a=u.get((l=_.collection)!==null&&l!==void 0?l:"");if(a==null)throw new Error("Could not match feature to collection: "+_.collection);if(_.geometry.type==="Polygon")a.addBoundary(_.geometry.coordinates);else if(_.geometry.type==="MultiPolygon")for(let T of _.geometry.coordinates)a.addBoundary(T)}return y}function Jm(s){let{interval:l}=s.extent.temporal;if(l==null||l.length===0)return[-1,-1];let u=l[0],y=new Date(u[0]).getFullYear(),_=(u.length<2?y:new Date(u[1]).getFullYear())-1;return[y,_<y?y:_]}var Ns=class{constructor(l){this.attributions=l}static async load(l){let u=await fetch(l);if(u.ok){let y=await u.json();return Ns.fromStac(y)}throw new Error(`fetch attribution failed [${u.status}] ${u.statusText}`)}static fromStac(l){return new Ns(e1(l).reverse())}filter(l,u){u=Math.round(u);let y=[],{attributions:_}=this;if(_==null)return y;for(let a of _)this.isIgnored!=null&&this.isIgnored(a)||a.intersects(l,u)&&y.push(a.collection);return y}renderList(l){if(l.length===0)return"";let u=Ym(l[0].title);if(l.length>1)if(l.length===2)u+=` & ${Ym(l[1].title)}`;else{let[y,_]=Jm(l[1]);for(let a=1;a<l.length;++a){let[T,E]=Jm(l[a]);T!==-1&&(y===-1||T<y)&&(y=T),E!==-1&&(_===-1||E>_)&&(_=E)}y===-1&&(y=_),_!==-1&&(u+=` & others ${y}-${_}`)}return u}};var Gl=ua(vc(),1);var Qm=`\xA9 ${Jd.License} LINZ`,tg=new Map,eg=new Map,bc=class{constructor(l){this._raf=0;this.attributionHtml="";this.bounds=new Gl.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 l=zt.map.layerKeyTms,u=tg.get(l);u==null&&(u=Ns.load(zt.map.toTileUrl("attribution")).catch(()=>null),tg.set(l,u),u.then(y=>{y!=null&&(y.isIgnored=this.isIgnored,eg.set(l,y),this.scheduleRender())})),this.scheduleRender()};this.isIgnored=l=>l.collection.title.toLowerCase().startsWith("geographx");this.renderAttribution=()=>{this._raf=0;let l=eg.get(zt.map.layerKeyTms);if(l==null)return this.removeAttribution();this.zoom=Math.round(this.map.getZoom()??0),this.bounds=this.map.getBounds(),this.zoom+=1;let u=this.mapboxBoundToBbox(this.bounds,zt.map.tileMatrix),y=l.filter(u,this.zoom),_=l.renderList(y);if(_===""?_=Qm:_=Qm+" - "+_,_!==this.attributionHtml){let a=this.attributionHtml=_;this.removeAttribution(),this.attributionControl=new Gl.default.AttributionControl({compact:!1,customAttribution:a}),this.map.addControl(this.attributionControl,"bottom-right")}this.filteredRecords=y};this.map=l,Us(l,this.resetAttribution),l.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(l,u){let y={lon:l.getWest(),lat:l.getSouth(),zoom:this.zoom},_={lon:l.getEast(),lat:l.getNorth(),zoom:this.zoom},a=zn(y,ii,u),T=zn(_,ii,u);return[a.lon,a.lat,T.lon,T.lat]}vectorAttribution(){this.removeAttribution(),this.attributionControl=new Gl.default.AttributionControl({compact:!1}),this.map.addControl(this.attributionControl,"bottom-right")}};H();Xr();function wc(s,l){return K("input",{className:"debug__slider",type:"range",min:"0",max:"1",step:"0.05",value:String(zt.map.debug[`debug.layer.${s}`]),onInput:l})}var Mc=class extends Ti{constructor(){super(...arguments);this.waitForMap=()=>{let u=this.props.map;if(u==null){setTimeout(this.waitForMap,20);return}window.MaplibreMap=u,u.resize(),Us(u,()=>{zt.map.on("change",()=>{if(this.props.map==null)return;let y=Di.toHash(zt.map.getLocation(this.props.map)),_="?"+Jr.toUrl(zt.map);window.history.replaceState(null,"",_+y),this.updateFromConfig()}),this.updateFromConfig(),zt.map.debug["debug.screenshot"]&&u.once("idle",()=>{let y=document.createElement("div");y.id="map-loaded",y.style.width="1px",y.style.height="1px",document.body.appendChild(y)})})};this.toggleCogs=u=>{let y=u.target;zt.map.setDebug("debug.cog",y.checked),this.setVectorShown(y.checked,"cog")};this.toggleSource=u=>{let y=u.target;zt.map.setDebug("debug.source",y.checked),this.setVectorShown(y.checked,"source")};this._layerLoading=new Map;this._styleJson=null;this.adjustTopographic=u=>{let y=u.target;zt.map.setDebug("debug.layer.linz-topographic",Number(y.value))};this.adjustOsm=u=>{zt.map.setDebug("debug.layer.osm",Number(u.target.value))};this.adjustLinzAerial=u=>{zt.map.setDebug("debug.layer.linz-aerial",Number(u.target.value))};this.togglePurple=u=>{let y=u.target;this.setPurple(y.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.setVectorShown(zt.map.debug["debug.source"],"source"),this.setVectorShown(zt.map.debug["debug.cog"],"cog")}render(){return zt.map.debug["debug.screenshot"]?null:K("div",{className:"debug"},K("div",{className:"debug__info"},K("label",{className:"debug__label"},"ImageId"),K("div",{className:"debug__value"},zt.map.layerId)),K("div",{className:"debug__info"},K("label",{className:"debug__label"},"Projection "),K("div",{className:"debug__value"},zt.map.tileMatrix.projection.toEpsgString())),K("div",{className:"debug__info"},K("label",{className:"debug__label"},"TileMatrix "),K("div",{className:"debug__value"},zt.map.tileMatrix.identifier)),this.renderSliders(),this.renderPurple(),this.renderCogToggle(),this.renderSourceToggle())}renderPurple(){if(!zt.map.debug["debug.screenshot"])return K("div",{className:"debug__info"},K("label",{className:"debug__label"},"Purple"),K("input",{type:"checkbox",onClick:this.togglePurple,checked:zt.map.debug["debug.background"]==="magenta"}))}renderCogToggle(){if(!zt.map.layerId.startsWith("01"))return null;let u=Di.toImageryUrl(`im_${zt.map.layerId}`,"covering.geojson");return K(yt,null,K("div",{className:"debug__info"},K("label",{className:"debug__label"},K("a",{href:u,title:"Source geojson"},"Cogs")),K("input",{type:"checkbox",onClick:this.toggleCogs,checked:zt.map.debug["debug.cog"]})),this.state.featureSourceId==null?null:K("div",{className:"debug__info",title:String(this.state.featureCogName)},K("label",{className:"debug__label"},"CogId"),String(this.state.featureCogName).split("/").pop()))}renderSourceToggle(){if(!zt.map.layerId.startsWith("01"))return null;let u=Di.toImageryUrl(`im_${zt.map.layerId}`,"source.geojson");return K(yt,null,K("div",{className:"debug__info"},K("label",{className:"debug__label"},K("a",{href:u,title:"Source geojson"},"Source")),K("input",{type:"checkbox",onClick:this.toggleSource,checked:zt.map.debug["debug.source"]})),this.state.featureSourceId==null?null:K("div",{className:"debug__info",title:String(this.state.featureSourceName)},K("label",{className:"debug__label"},"SourceId"),String(this.state.featureSourceName).split("/").pop()))}trackMouseMove(u,y){let _=`${u}_${y}`,a=`${_}_fill`,T=this.props.map,E,B=y==="source"?"featureSource":"featureCog";T.on("mousemove",a,$=>{let L=$.features;if(L==null||L.length===0)return;let it=L[0];it.id!==E&&(E!=null&&T.setFeatureState({source:_,id:E},{hover:!1}),E=it.id,this.setState({...this.state,[`${B}Id`]:E,[`${B}Name`]:it.properties?.name}),T.setFeatureState({source:_,id:E},{hover:!0}))}),T.on("mouseleave",a,()=>{E!=null&&(T.setFeatureState({source:_,id:E},{hover:!1}),E=void 0,this.setState({...this.state,[`${B}Id`]:void 0,[`${B}Name`]:void 0}))})}setVectorShown(u,y){let _=this.props.map,a=zt.map.layerId,T=`${a}_${y}`,E=`${T}_fill`,B=`${T}_line`;if(u===!1){if(_.getLayer(E)==null)return;_.removeLayer(E),_.removeLayer(B);return}if(_.getLayer(B)!=null)return;let $=y==="source"?"#ff00ff":"#ff0000";this.loadSourceLayer(a,y).then(()=>{_.getLayer(B)==null&&(_.addLayer({id:E,type:"fill",source:T,paint:{"fill-opacity":["case",["boolean",["feature-state","hover"],!1],.25,0],"fill-color":$}}),this.trackMouseMove(a,y),_.addLayer({id:B,type:"line",source:T,paint:{"line-color":$,"line-opacity":["case",["boolean",["feature-state","hover"],!1],1,.5],"line-width":["case",["boolean",["feature-state","hover"],!1],2,1]}}))})}loadSourceLayer(u,y){let _=`${u}-${y}`,a=this._layerLoading.get(_);return a==null&&(a=this._loadSourceLayer(u,y),this._layerLoading.set(_,a)),a}async _loadSourceLayer(u,y){let _=this.props.map,a=`${u}_${y}`,T=`${a}_fill`;if(_.getLayer(T)!=null)return;let E=Di.toImageryUrl(`im_${u}`,y==="source"?"source.geojson":"covering.geojson"),B=await fetch(E);if(!B.ok)return;let $=await B.json();zt.map.tileMatrix.projection!==ii.projection&&$m($,zt.map.tileMatrix);let L=0;for(let it of $.features)it.id=L++;_.addSource(a,{type:"geojson",data:$})}renderSliders(){if(!zt.map.debug["debug.screenshot"])return zt.map.tileMatrix.identifier!==ii.identifier?K("div",{className:"debug__info"},K("label",{className:"debug__label"},"LINZ Aerial"),wc("linz-aerial",this.adjustLinzAerial)):K(yt,null,K("div",{className:"debug__info"},K("label",{className:"debug__label"},"OSM"),wc("osm",this.adjustOsm)),K("div",{className:"debug__info"},K("label",{className:"debug__label"},"Topographic"),wc("linz-topographic",this.adjustTopographic)),K("div",{className:"debug__info"},K("label",{className:"debug__label"},"LINZ Aerial"),wc("linz-aerial",this.adjustLinzAerial)))}get styleJson(){return this._styleJson==null&&(this._styleJson=fetch(Di.toTileUrl("style",zt.map.tileMatrix,"topographic","topographic")).then(u=>u.json())),this._styleJson}async adjustVector(u){let y=await this.styleJson,_=this.props.map;if(_.getSource("LINZ Basemaps")==null){if(u===0)return;let E=y.sources?.["LINZ Basemaps"];if(E==null)return;_.addSource("LINZ Basemaps",E),_.setStyle({..._.getStyle(),glyphs:y.glyphs,sprite:y.sprite}),_.once("style.load",()=>this.adjustVector(u));return}let T=y.layers?.filter(E=>E.type!=="background"&&E.source==="LINZ Basemaps")??[];if(zt.map.layerId!=="topographic"){for(let E of T){let B=E.paint??{};E.type==="symbol"?(B["icon-opacity"]=0,B["text-opacity"]=0):B[`${E.type}-opacity`]=0,E.paint=B}if(u===0){for(let E of T)_.getLayer(E.id)!=null&&_.removeLayer(E.id);return}if(_.getLayer(T[0].id)==null){if(u===0)return;for(let E of T)_.addLayer(E)}for(let E of T)_.getLayer(E.id)!=null&&(E.type==="symbol"?(_.setPaintProperty(E.id,"icon-opacity",u),_.setPaintProperty(E.id,"text-opacity",u)):_.setPaintProperty(E.id,`${E.type}-opacity`,u))}}adjustRaster(u,y){this.props.map.getSource(u)==null&&this.props.map.addSource(u,{type:"raster",tiles:[i1(u)],tileSize:256});let _=this.props.map.getLayer(u)==null;if(y===0){_||this.props.map.removeLayer(u);return}if(_){this.props.map.addLayer({id:u,type:"raster",source:u,minzoom:0,maxzoom:24,paint:{"raster-opacity":0}});let a=`${zt.map.layerId}_source_fill`;this.props.map.getLayer(a)!=null&&this.props.map.moveLayer(u,a)}this.props.map.setPaintProperty(u,"raster-opacity",y)}setPurple(u){zt.map.setDebug("debug.background",u?"magenta":!1),u?document.body.style.backgroundColor="magenta":document.body.style.backgroundColor=""}};function i1(s){if(s==="osm")return"https://tile.openstreetmap.org/{z}/{x}/{y}.png";if(s==="linz-aerial")return Di.toTileUrl("raster",zt.map.tileMatrix,"aerial");throw new Error("Unknown tile server")}H();var ig=ua(vc(),1);Xr();var Sc=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 u=zt.map.transformedLocation,y=this.getStyleType(),_=`${y.layerId}::${y.style}`;if(this.currentStyle!==_){let T=To(zt.map.tileMatrix.identifier).getStyle(y.layerId,y.style);this.currentStyle=_,this.map.setStyle(T)}this.map.setZoom(Math.max(u.zoom-4,0)),this.map.setCenter([u.lon,u.lat]),this.setState(this.state)};this.switchLayer=()=>{let u=this.getStyleType();zt.map.setLayerId(u.layerId,u.style),this.updateMap(),window.history.pushState(null,"",`?${Jr.toUrl(zt.map)}`)}}componentDidMount(){if(zt.map.updateFromUrl(),this.el=document.getElementById("map-switcher-map"),this.el==null)return;let u=zt.map,y=To(u.tileMatrix.identifier),_=this.getStyleType();this.currentStyle=`${_.layerId}::${_.style}`;let a=y.getStyle(_.layerId,_.style),T=u.transformedLocation;this.map=new ig.default.Map({container:this.el,style:a,center:[T.lon,T.lat],zoom:T.zoom,attributionControl:!1}),Us(this.map,()=>{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 u of this._events)u()}getStyleType(){return zt.map.layerId!=="aerial"?{layerId:"aerial"}:{layerId:"topographic",style:"topographic"}}render(){let u=`Switch map to ${this.getStyleType().layerId}`;return K("div",{id:"map-switcher",class:"map-switcher",onClick:this.switchLayer,title:u},K("div",{id:"map-switcher-map",style:{width:"100%",height:"100%",pointerEvents:"none"}}))}};function Us(s,l){if(s.loaded())return l();setTimeout(()=>Us(s,l),100)}var Tc=class extends Ti{constructor(){super(...arguments);this.ignoreNextLocationUpdate=!1;this.updateLocation=()=>{if(this.ignoreNextLocationUpdate){this.ignoreNextLocationUpdate=!1;return}let u=zt.map.location;this.map.setZoom(u.zoom),this.map.setCenter([u.lon,u.lat])};this.updateBounds=u=>{if(zt.map.tileMatrix!==ii){let y=Eo.default.LngLatBounds.convert(u),_=y.getNorthEast(),a=y.getSouthWest(),T=this.map.getZoom(),E=zn({lat:_.lat,lon:_.lng,zoom:T},zt.map.tileMatrix,ii),B=zn({lat:a.lat,lon:a.lng,zoom:T},zt.map.tileMatrix,ii);u=[[E.lon,E.lat],[B.lon,B.lat]]}this.map.fitBounds(u)};this.updateStyle=()=>{this.ensureGeoControl();let y=To(zt.map.tileMatrix.identifier).getStyle(zt.map.layerId,zt.map.style);this.map.setStyle(y),zt.map.tileMatrix!==ii?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===ii){if(this.controlGeo!=null)return;this.controlGeo=new Eo.default.GeolocateControl({}),this.map.addControl(this.controlGeo,"top-left")}else{if(this.controlGeo==null)return;this.map.removeControl(this.controlGeo)}}componentDidMount(){if(zt.map.updateFromUrl(),this.el=document.getElementById("map"),this.el==null)throw new Error("Unable to find #map element");let u=zt.map,_=To(u.tileMatrix.identifier).getStyle(u.layerId,u.style),a=zn(u.location,u.tileMatrix,ii);if(this.map=new Eo.default.Map({container:this.el,style:_,center:[a.lon,a.lat],zoom:a.zoom,attributionControl:!1}),this.mapAttr=new bc(this.map),zt.map.debug["debug.screenshot"]!==!0){let T=new Eo.default.NavigationControl({visualizePitch:!0});this.map.addControl(T,"top-left"),this.map.addControl(new Eo.default.FullscreenControl({container:this.el}))}this.map.on("render",this.onRender),Us(this.map,()=>{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()})}componentWillUnmount(){this.map&&this.map.remove();for(let u of this._events)u();this._events=[]}render(){let u=zt.map.tileMatrix===ii&&!zt.map.isDebug;return K("div",{style:{flex:1,position:"relative"}},K("div",{id:"map",style:{width:"100%",height:"100%"}}),zt.map.isDebug?K(Mc,{map:this.map}):void 0,u?K(Sc,null):void 0)}setLocationUrl(){this.updateUrlTimer=null;let u=zt.map.getLocation(this.map);this.ignoreNextLocationUpdate=!0,zt.map.setLocation(u);let y=Di.toHash(u);window.history.replaceState(null,"",y)}};H();var r1="data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAwA0JaQAA3AA/vuUAAA=";function n1(){let s=document.createElement("canvas");return s.getContext&&s.getContext("2d")?s.toDataURL("image/webp").indexOf("data:image/webp")===0:!1}function s1(){let s=new Image,l=new Promise(u=>{s.onload=()=>u(!0),s.onerror=()=>u(!1)});return s.src=r1,l}function rg(){return new Promise(s=>{if(n1())return s(!0);s1().then(s)})}var sp=class extends Ti{render(){return K(yt,null,K(xc,null),K(Tc,null),K(gc,null))}};document.addEventListener("DOMContentLoaded",async()=>{await await rg()&&(Di.ImageFormat="webp");let l=document.getElementById("main");if(l==null)throw new Error("Missing #main");jd(K(sp,null),l)});
560
+ /**
561
+ * splaytree v3.1.0
562
+ * Fast Splay tree for Node and browser
563
+ *
564
+ * @author Alexander Milevski <info@w8r.name>
565
+ * @license MIT
566
+ * @preserve
567
+ */